@mastra/playground-ui 35.0.0 → 35.1.0-alpha.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 (220) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/dist/{code-block-C4Zp_ewI.cjs → code-block-BPI6hA9o.cjs} +2 -2
  3. package/dist/{code-block-C4Zp_ewI.cjs.map → code-block-BPI6hA9o.cjs.map} +1 -1
  4. package/dist/{code-block-CnRVTecy.js → code-block-BdjHwqE4.js} +2 -2
  5. package/dist/{code-block-CnRVTecy.js.map → code-block-BdjHwqE4.js.map} +1 -1
  6. package/dist/{code-editor-DuX_CPRv.js → code-editor-CxHGOvdY.js} +3 -3
  7. package/dist/{code-editor-DuX_CPRv.js.map → code-editor-CxHGOvdY.js.map} +1 -1
  8. package/dist/{code-editor-LhRB_wMh.cjs → code-editor-DVWPuq12.cjs} +3 -3
  9. package/dist/{code-editor-LhRB_wMh.cjs.map → code-editor-DVWPuq12.cjs.map} +1 -1
  10. package/dist/combobox-DQdRtI_v.cjs +245 -0
  11. package/dist/combobox-DQdRtI_v.cjs.map +1 -0
  12. package/dist/combobox-DvRTz5eL.js +223 -0
  13. package/dist/combobox-DvRTz5eL.js.map +1 -0
  14. package/dist/{command-DPEUOKZw.js → command-CkFCH229.js} +86 -43
  15. package/dist/command-CkFCH229.js.map +1 -0
  16. package/dist/{command-D0tQ1Lpz.cjs → command-EI7t_0WS.cjs} +86 -43
  17. package/dist/command-EI7t_0WS.cjs.map +1 -0
  18. package/dist/components/CodeBlock.cjs.js +1 -1
  19. package/dist/components/CodeBlock.es.js +1 -1
  20. package/dist/components/CodeEditor.cjs.js +1 -1
  21. package/dist/components/CodeEditor.es.js +1 -1
  22. package/dist/components/Columns.cjs.js +1 -1
  23. package/dist/components/Columns.es.js +1 -1
  24. package/dist/components/Combobox.cjs.js +2 -4
  25. package/dist/components/Combobox.cjs.js.map +1 -1
  26. package/dist/components/Combobox.es.js +1 -2
  27. package/dist/components/Combobox.es.js.map +1 -1
  28. package/dist/components/Command.cjs.js +1 -1
  29. package/dist/components/Command.es.js +1 -1
  30. package/dist/components/CopyButton.cjs.js +1 -1
  31. package/dist/components/CopyButton.es.js +1 -1
  32. package/dist/components/DataCodeSection.cjs.js +1 -1
  33. package/dist/components/DataCodeSection.es.js +1 -1
  34. package/dist/components/DataDetailsPanel.cjs.js +1 -1
  35. package/dist/components/DataDetailsPanel.es.js +1 -1
  36. package/dist/components/DataKeysAndValues.cjs.js +1 -1
  37. package/dist/components/DataKeysAndValues.es.js +1 -1
  38. package/dist/components/DataList.cjs.js +2 -2
  39. package/dist/components/DataList.es.js +2 -2
  40. package/dist/components/DataPanel.cjs.js +1 -1
  41. package/dist/components/DataPanel.es.js +1 -1
  42. package/dist/components/Dialog.cjs.js +1 -1
  43. package/dist/components/Dialog.es.js +1 -1
  44. package/dist/components/HorizontalBars.cjs.js +1 -1
  45. package/dist/components/HorizontalBars.es.js +1 -1
  46. package/dist/components/LogsDataList.cjs.js +2 -2
  47. package/dist/components/LogsDataList.es.js +2 -2
  48. package/dist/components/MainSidebar.cjs.js +1 -1
  49. package/dist/components/MainSidebar.es.js +1 -1
  50. package/dist/components/MarkdownRenderer.cjs.js +1 -1
  51. package/dist/components/MarkdownRenderer.es.js +1 -1
  52. package/dist/components/MetricsDataTable.cjs.js +1 -1
  53. package/dist/components/MetricsDataTable.es.js +1 -1
  54. package/dist/components/PropertyFilter.cjs.js +1 -1
  55. package/dist/components/PropertyFilter.es.js +1 -1
  56. package/dist/components/ScrollArea.cjs.js +1 -1
  57. package/dist/components/ScrollArea.es.js +1 -1
  58. package/dist/components/SideDialog.cjs.js +1 -1
  59. package/dist/components/SideDialog.es.js +1 -1
  60. package/dist/components/Truncate.cjs.js +1 -1
  61. package/dist/components/Truncate.es.js +1 -1
  62. package/dist/{copy-button-BfiqaCtC.js → copy-button-RffVknBA.js} +2 -2
  63. package/dist/{copy-button-BfiqaCtC.js.map → copy-button-RffVknBA.js.map} +1 -1
  64. package/dist/{copy-button-BaAuAgdC.cjs → copy-button-ler9dH8g.cjs} +3 -3
  65. package/dist/{copy-button-BaAuAgdC.cjs.map → copy-button-ler9dH8g.cjs.map} +1 -1
  66. package/dist/{data-code-section-MygZlpwo.js → data-code-section-BBBffVVs.js} +3 -3
  67. package/dist/{data-code-section-MygZlpwo.js.map → data-code-section-BBBffVVs.js.map} +1 -1
  68. package/dist/{data-code-section-BtFzBCox.cjs → data-code-section-ChVXPz-i.cjs} +3 -3
  69. package/dist/{data-code-section-BtFzBCox.cjs.map → data-code-section-ChVXPz-i.cjs.map} +1 -1
  70. package/dist/{data-keys-and-values-BSeQG7jb.js → data-keys-and-values-C3pzr_d1.js} +2 -2
  71. package/dist/{data-keys-and-values-BSeQG7jb.js.map → data-keys-and-values-C3pzr_d1.js.map} +1 -1
  72. package/dist/{data-keys-and-values-Spy2O_IE.cjs → data-keys-and-values-KIwfkmc7.cjs} +3 -3
  73. package/dist/{data-keys-and-values-Spy2O_IE.cjs.map → data-keys-and-values-KIwfkmc7.cjs.map} +1 -1
  74. package/dist/{data-list-skeleton-COjCBzBF.cjs → data-list-skeleton-BlOwAki1.cjs} +5 -15
  75. package/dist/data-list-skeleton-BlOwAki1.cjs.map +1 -0
  76. package/dist/{data-list-skeleton-DmAqHgws.js → data-list-skeleton-DD7ljjgS.js} +5 -15
  77. package/dist/data-list-skeleton-DD7ljjgS.js.map +1 -0
  78. package/dist/{data-panel-DToYF7cH.cjs → data-panel-DBxE_3ux.cjs} +2 -2
  79. package/dist/{data-panel-DToYF7cH.cjs.map → data-panel-DBxE_3ux.cjs.map} +1 -1
  80. package/dist/{data-panel-DumaHQiP.js → data-panel-DPVF9Yok.js} +2 -2
  81. package/dist/{data-panel-DumaHQiP.js.map → data-panel-DPVF9Yok.js.map} +1 -1
  82. package/dist/{dialog-46zkb32X.cjs → dialog-C0gOGKEK.cjs} +31 -29
  83. package/dist/dialog-C0gOGKEK.cjs.map +1 -0
  84. package/dist/{dialog-CSSfcjSX.js → dialog-DTLHod4X.js} +31 -29
  85. package/dist/dialog-DTLHod4X.js.map +1 -0
  86. package/dist/dialog.css +2 -2
  87. package/dist/hooks/use-autoscroll.cjs.js +110 -0
  88. package/dist/hooks/use-autoscroll.cjs.js.map +1 -0
  89. package/dist/hooks/use-autoscroll.d.ts +2 -0
  90. package/dist/hooks/use-autoscroll.es.js +106 -0
  91. package/dist/hooks/use-autoscroll.es.js.map +1 -0
  92. package/dist/hooks/use-copy-to-clipboard.cjs.js +11 -0
  93. package/dist/hooks/use-copy-to-clipboard.cjs.js.map +1 -0
  94. package/dist/hooks/use-copy-to-clipboard.d.ts +2 -0
  95. package/dist/hooks/use-copy-to-clipboard.es.js +3 -0
  96. package/dist/hooks/use-copy-to-clipboard.es.js.map +1 -0
  97. package/dist/hooks/use-in-view.cjs.js +22 -0
  98. package/dist/hooks/use-in-view.cjs.js.map +1 -0
  99. package/dist/hooks/use-in-view.d.ts +2 -0
  100. package/dist/hooks/use-in-view.es.js +18 -0
  101. package/dist/hooks/use-in-view.es.js.map +1 -0
  102. package/dist/hooks/use-is-mobile.cjs.js +21 -0
  103. package/dist/hooks/use-is-mobile.cjs.js.map +1 -0
  104. package/dist/hooks/use-is-mobile.d.ts +2 -0
  105. package/dist/hooks/use-is-mobile.es.js +17 -0
  106. package/dist/hooks/use-is-mobile.es.js.map +1 -0
  107. package/dist/hooks/use-keyboard-shortcut-label.cjs.js +29 -0
  108. package/dist/hooks/use-keyboard-shortcut-label.cjs.js.map +1 -0
  109. package/dist/hooks/use-keyboard-shortcut-label.d.ts +2 -0
  110. package/dist/hooks/use-keyboard-shortcut-label.es.js +24 -0
  111. package/dist/hooks/use-keyboard-shortcut-label.es.js.map +1 -0
  112. package/dist/{horizontal-bars-DjLETHvH.js → horizontal-bars-r1aEIHUc.js} +2 -2
  113. package/dist/{horizontal-bars-DjLETHvH.js.map → horizontal-bars-r1aEIHUc.js.map} +1 -1
  114. package/dist/{horizontal-bars-C9qp4r47.cjs → horizontal-bars-uPFpgihX.cjs} +2 -2
  115. package/dist/{horizontal-bars-C9qp4r47.cjs.map → horizontal-bars-uPFpgihX.cjs.map} +1 -1
  116. package/dist/index.cjs.js +88 -79
  117. package/dist/index.cjs.js.map +1 -1
  118. package/dist/index.css +55 -30
  119. package/dist/index.es.js +72 -69
  120. package/dist/index.es.js.map +1 -1
  121. package/dist/{logs-data-list-kzBMv1MW.cjs → logs-data-list-3qmFjBz8.cjs} +2 -2
  122. package/dist/{logs-data-list-kzBMv1MW.cjs.map → logs-data-list-3qmFjBz8.cjs.map} +1 -1
  123. package/dist/{logs-data-list-Bkf7oWlx.js → logs-data-list-Dh6c7URj.js} +2 -2
  124. package/dist/{logs-data-list-Bkf7oWlx.js.map → logs-data-list-Dh6c7URj.js.map} +1 -1
  125. package/dist/{main-sidebar-Djs_3tGw.cjs → main-sidebar-ByHmwU4R.cjs} +6 -5
  126. package/dist/main-sidebar-ByHmwU4R.cjs.map +1 -0
  127. package/dist/{main-sidebar-1GVDTtcD.js → main-sidebar-DJSorgYQ.js} +6 -5
  128. package/dist/main-sidebar-DJSorgYQ.js.map +1 -0
  129. package/dist/{markdown-renderer-DyUlVfRt.cjs → markdown-renderer-Dyg_1QXx.cjs} +2 -2
  130. package/dist/{markdown-renderer-DyUlVfRt.cjs.map → markdown-renderer-Dyg_1QXx.cjs.map} +1 -1
  131. package/dist/{markdown-renderer-BYSrmn0E.js → markdown-renderer-QftQuP4g.js} +2 -2
  132. package/dist/{markdown-renderer-BYSrmn0E.js.map → markdown-renderer-QftQuP4g.js.map} +1 -1
  133. package/dist/{metrics-data-table-D7vx2WEJ.cjs → metrics-data-table-AjAA-dqH.cjs} +2 -2
  134. package/dist/{metrics-data-table-D7vx2WEJ.cjs.map → metrics-data-table-AjAA-dqH.cjs.map} +1 -1
  135. package/dist/{metrics-data-table-DryqJWoI.js → metrics-data-table-hSmtDNck.js} +2 -2
  136. package/dist/{metrics-data-table-DryqJWoI.js.map → metrics-data-table-hSmtDNck.js.map} +1 -1
  137. package/dist/{multi-column-BzL86JPK.cjs → multi-column-BbVNPvhh.cjs} +2 -2
  138. package/dist/{multi-column-BzL86JPK.cjs.map → multi-column-BbVNPvhh.cjs.map} +1 -1
  139. package/dist/{multi-column-C1sXoVG3.js → multi-column-o9qcoBXV.js} +2 -2
  140. package/dist/{multi-column-C1sXoVG3.js.map → multi-column-o9qcoBXV.js.map} +1 -1
  141. package/dist/{property-filter-creator-DU8pl6-6.cjs → property-filter-creator-CaG_zPdy.cjs} +4 -3
  142. package/dist/property-filter-creator-CaG_zPdy.cjs.map +1 -0
  143. package/dist/{property-filter-creator-B9tK0VY3.js → property-filter-creator-Cl9E6wxf.js} +4 -3
  144. package/dist/property-filter-creator-Cl9E6wxf.js.map +1 -0
  145. package/dist/scroll-area-BtcyzOxO.cjs +243 -0
  146. package/dist/scroll-area-BtcyzOxO.cjs.map +1 -0
  147. package/dist/scroll-area-DjZ6nTm5.js +221 -0
  148. package/dist/scroll-area-DjZ6nTm5.js.map +1 -0
  149. package/dist/src/ds/components/Combobox/combobox-styles.d.ts +5 -12
  150. package/dist/src/ds/components/Combobox/combobox.d.ts +13 -4
  151. package/dist/src/ds/components/Combobox/combobox.stories.d.ts +1 -0
  152. package/dist/src/ds/components/Combobox/index.d.ts +0 -1
  153. package/dist/src/ds/components/Command/command.d.ts +5 -1
  154. package/dist/src/ds/components/Command/command.stories.d.ts +1 -0
  155. package/dist/src/ds/components/DataList/data-list-root.d.ts +3 -4
  156. package/dist/src/ds/components/Dialog/dialog.d.ts +2 -0
  157. package/dist/src/ds/components/MainSidebar/main-sidebar-nav-item-classes.d.ts +12 -0
  158. package/dist/src/ds/components/MainSidebar/main-sidebar-nav-link.d.ts +0 -13
  159. package/dist/src/ds/components/MainSidebar/main-sidebar.d.ts +2 -1
  160. package/dist/src/ds/components/ScrollArea/scroll-area.d.ts +12 -0
  161. package/dist/src/ds/components/ScrollArea/scroll-area.stories.d.ts +2 -0
  162. package/dist/src/hooks/use-copy-to-clipboard.d.ts +9 -1
  163. package/dist/src/hooks/use-keyboard-shortcut-label.d.ts +2 -0
  164. package/dist/src/index.d.ts +1 -1
  165. package/dist/src/lib/file/index.d.ts +1 -0
  166. package/dist/src/lib/file/schemes.d.ts +26 -0
  167. package/dist/{traces-data-list-BPTKzaN6.cjs → traces-data-list-BNmnKyDD.cjs} +8 -3
  168. package/dist/traces-data-list-BNmnKyDD.cjs.map +1 -0
  169. package/dist/{traces-data-list-CB7frfpp.js → traces-data-list-DRyI45Ke.js} +8 -3
  170. package/dist/traces-data-list-DRyI45Ke.js.map +1 -0
  171. package/dist/{truncate-C9bKR_02.js → truncate-B8_8wx-G.js} +2 -2
  172. package/dist/{truncate-C9bKR_02.js.map → truncate-B8_8wx-G.js.map} +1 -1
  173. package/dist/{truncate-RL2aHd1a.cjs → truncate-Csk5KmAy.cjs} +2 -2
  174. package/dist/{truncate-RL2aHd1a.cjs.map → truncate-Csk5KmAy.cjs.map} +1 -1
  175. package/dist/use-copy-to-clipboard-D7L_l6_x.js +127 -0
  176. package/dist/use-copy-to-clipboard-D7L_l6_x.js.map +1 -0
  177. package/dist/use-copy-to-clipboard-DHaJCGet.cjs +131 -0
  178. package/dist/use-copy-to-clipboard-DHaJCGet.cjs.map +1 -0
  179. package/package.json +12 -6
  180. package/dist/combobox-B2TriE9Z.cjs +0 -77
  181. package/dist/combobox-B2TriE9Z.cjs.map +0 -1
  182. package/dist/combobox-q2xPfCZc.js +0 -75
  183. package/dist/combobox-q2xPfCZc.js.map +0 -1
  184. package/dist/command-D0tQ1Lpz.cjs.map +0 -1
  185. package/dist/command-DPEUOKZw.js.map +0 -1
  186. package/dist/components/ScrollableContainer.cjs.js +0 -10
  187. package/dist/components/ScrollableContainer.cjs.js.map +0 -1
  188. package/dist/components/ScrollableContainer.d.ts +0 -2
  189. package/dist/components/ScrollableContainer.es.js +0 -2
  190. package/dist/components/ScrollableContainer.es.js.map +0 -1
  191. package/dist/data-list-skeleton-COjCBzBF.cjs.map +0 -1
  192. package/dist/data-list-skeleton-DmAqHgws.js.map +0 -1
  193. package/dist/dialog-46zkb32X.cjs.map +0 -1
  194. package/dist/dialog-CSSfcjSX.js.map +0 -1
  195. package/dist/main-sidebar-1GVDTtcD.js.map +0 -1
  196. package/dist/main-sidebar-Djs_3tGw.cjs.map +0 -1
  197. package/dist/multi-combobox-DkFLK64B.cjs +0 -193
  198. package/dist/multi-combobox-DkFLK64B.cjs.map +0 -1
  199. package/dist/multi-combobox-Y3gT0MqV.js +0 -189
  200. package/dist/multi-combobox-Y3gT0MqV.js.map +0 -1
  201. package/dist/property-filter-creator-B9tK0VY3.js.map +0 -1
  202. package/dist/property-filter-creator-DU8pl6-6.cjs.map +0 -1
  203. package/dist/scroll-area-BqJfcT94.cjs +0 -230
  204. package/dist/scroll-area-BqJfcT94.cjs.map +0 -1
  205. package/dist/scroll-area-BtDqmqBK.js +0 -208
  206. package/dist/scroll-area-BtDqmqBK.js.map +0 -1
  207. package/dist/scrollable-container-BqOFHwdb.js +0 -151
  208. package/dist/scrollable-container-BqOFHwdb.js.map +0 -1
  209. package/dist/scrollable-container-Btq-TfCL.cjs +0 -153
  210. package/dist/scrollable-container-Btq-TfCL.cjs.map +0 -1
  211. package/dist/src/ds/components/Combobox/multi-combobox.d.ts +0 -22
  212. package/dist/src/ds/components/ScrollableContainer/index.d.ts +0 -1
  213. package/dist/src/ds/components/ScrollableContainer/scrollable-container.d.ts +0 -8
  214. package/dist/src/ds/components/ScrollableContainer/scrollable-container.stories.d.ts +0 -10
  215. package/dist/traces-data-list-BPTKzaN6.cjs.map +0 -1
  216. package/dist/traces-data-list-CB7frfpp.js.map +0 -1
  217. package/dist/use-copy-to-clipboard-CGqfkXnN.js +0 -73
  218. package/dist/use-copy-to-clipboard-CGqfkXnN.js.map +0 -1
  219. package/dist/use-copy-to-clipboard-CQgIuR1c.cjs +0 -77
  220. package/dist/use-copy-to-clipboard-CQgIuR1c.cjs.map +0 -1
@@ -1,230 +0,0 @@
1
- 'use strict';
2
-
3
- const jsxRuntime = require('react/jsx-runtime');
4
- const scrollArea = require('@base-ui/react/scroll-area');
5
- const React = require('react');
6
- const utils = require('./utils-vA5sWo9W.cjs');
7
-
8
- function _interopNamespaceDefault(e) {
9
- const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
10
- if (e) {
11
- for (const k in e) {
12
- if (k !== 'default') {
13
- const d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: () => e[k]
17
- });
18
- }
19
- }
20
- }
21
- n.default = e;
22
- return Object.freeze(n);
23
- }
24
-
25
- const React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
26
-
27
- const SCROLL_END_THRESHOLD = 8;
28
- const useAutoscroll = (ref, { enabled = true }) => {
29
- const shouldScrollRef = React.useRef(enabled);
30
- const scrollFrameRef = React.useRef(null);
31
- const userScrollIntentRef = React.useRef(false);
32
- const userScrollIntentTimeoutRef = React.useRef(null);
33
- React.useEffect(() => {
34
- if (!enabled) return;
35
- if (!ref?.current) return;
36
- const area = ref.current;
37
- const scrollToEnd = () => {
38
- if (!shouldScrollRef.current) return;
39
- if (scrollFrameRef.current !== null) {
40
- cancelAnimationFrame(scrollFrameRef.current);
41
- }
42
- scrollFrameRef.current = requestAnimationFrame(() => {
43
- if (shouldScrollRef.current) {
44
- area.scrollTop = area.scrollHeight;
45
- }
46
- scrollFrameRef.current = null;
47
- });
48
- };
49
- const mutationObserver = new MutationObserver(scrollToEnd);
50
- mutationObserver.observe(area, {
51
- childList: true,
52
- // observe direct children changes
53
- subtree: true,
54
- // observe all descendants
55
- characterData: true
56
- // observe text content changes
57
- });
58
- const resizeObserver = new ResizeObserver(scrollToEnd);
59
- resizeObserver.observe(area);
60
- const cancelPendingScroll = () => {
61
- if (scrollFrameRef.current !== null) {
62
- cancelAnimationFrame(scrollFrameRef.current);
63
- scrollFrameRef.current = null;
64
- }
65
- };
66
- const stopFollowing = () => {
67
- shouldScrollRef.current = false;
68
- cancelPendingScroll();
69
- };
70
- const registerUserScrollIntent = () => {
71
- userScrollIntentRef.current = true;
72
- if (userScrollIntentTimeoutRef.current !== null) {
73
- window.clearTimeout(userScrollIntentTimeoutRef.current);
74
- }
75
- userScrollIntentTimeoutRef.current = window.setTimeout(() => {
76
- userScrollIntentRef.current = false;
77
- userScrollIntentTimeoutRef.current = null;
78
- }, 250);
79
- };
80
- const handleWheel = (event) => {
81
- registerUserScrollIntent();
82
- if (event.deltaY < 0) {
83
- stopFollowing();
84
- }
85
- };
86
- const handleKeyDown = (event) => {
87
- registerUserScrollIntent();
88
- if (["ArrowUp", "PageUp", "Home"].includes(event.key)) {
89
- stopFollowing();
90
- }
91
- };
92
- const handleScroll = (e) => {
93
- const scrollElement = e.target;
94
- const currentPosition = scrollElement.scrollTop + scrollElement.clientHeight;
95
- const totalHeight = scrollElement.scrollHeight;
96
- const isAtEnd = currentPosition >= totalHeight - SCROLL_END_THRESHOLD;
97
- if (isAtEnd) {
98
- shouldScrollRef.current = true;
99
- return;
100
- }
101
- if (userScrollIntentRef.current) {
102
- shouldScrollRef.current = false;
103
- cancelPendingScroll();
104
- }
105
- };
106
- area.addEventListener("wheel", handleWheel, { passive: true });
107
- area.addEventListener("touchmove", registerUserScrollIntent, { passive: true });
108
- area.addEventListener("pointerdown", registerUserScrollIntent);
109
- area.addEventListener("keydown", handleKeyDown);
110
- area.addEventListener("scroll", handleScroll);
111
- scrollToEnd();
112
- return () => {
113
- area.removeEventListener("wheel", handleWheel);
114
- area.removeEventListener("touchmove", registerUserScrollIntent);
115
- area.removeEventListener("pointerdown", registerUserScrollIntent);
116
- area.removeEventListener("keydown", handleKeyDown);
117
- area.removeEventListener("scroll", handleScroll);
118
- mutationObserver.disconnect();
119
- resizeObserver.disconnect();
120
- cancelPendingScroll();
121
- if (userScrollIntentTimeoutRef.current !== null) {
122
- window.clearTimeout(userScrollIntentTimeoutRef.current);
123
- userScrollIntentTimeoutRef.current = null;
124
- }
125
- };
126
- }, [enabled, ref]);
127
- };
128
-
129
- function resolveMask(mask, orientation) {
130
- if (mask === false) return { top: false, bottom: false, left: false, right: false };
131
- const vertical = orientation === "vertical" || orientation === "both";
132
- const horizontal = orientation === "horizontal" || orientation === "both";
133
- const sides = { top: vertical, bottom: vertical, left: horizontal, right: horizontal };
134
- if (mask === true || mask === void 0) return sides;
135
- if (mask.y !== void 0) {
136
- sides.top = mask.y;
137
- sides.bottom = mask.y;
138
- }
139
- if (mask.x !== void 0) {
140
- sides.left = mask.x;
141
- sides.right = mask.x;
142
- }
143
- if (mask.top !== void 0) sides.top = mask.top;
144
- if (mask.bottom !== void 0) sides.bottom = mask.bottom;
145
- if (mask.left !== void 0) sides.left = mask.left;
146
- if (mask.right !== void 0) sides.right = mask.right;
147
- return sides;
148
- }
149
- function maskClasses(sides) {
150
- return utils.cn(
151
- sides.top && "data-[overflow-y-start]:mask-t-from-[calc(100%-2rem)]",
152
- sides.bottom && "data-[overflow-y-end]:mask-b-from-[calc(100%-2rem)]",
153
- sides.left && "data-[overflow-x-start]:mask-l-from-[calc(100%-2rem)]",
154
- sides.right && "data-[overflow-x-end]:mask-r-from-[calc(100%-2rem)]"
155
- );
156
- }
157
- const ScrollArea = React__namespace.forwardRef(
158
- ({
159
- className,
160
- children,
161
- viewPortClassName,
162
- maxHeight,
163
- autoScroll = false,
164
- orientation = "vertical",
165
- mask,
166
- showMask,
167
- viewportRef,
168
- ...props
169
- }, ref) => {
170
- const areaRef = React__namespace.useRef(null);
171
- useAutoscroll(areaRef, { enabled: autoScroll });
172
- const setViewportRef = React__namespace.useCallback(
173
- (node) => {
174
- areaRef.current = node;
175
- if (typeof viewportRef === "function") viewportRef(node);
176
- else if (viewportRef) viewportRef.current = node;
177
- },
178
- [viewportRef]
179
- );
180
- const effectiveMask = mask !== void 0 ? mask : showMask;
181
- const sides = resolveMask(effectiveMask, orientation);
182
- const viewportStyle = {};
183
- if (maxHeight) viewportStyle.maxHeight = maxHeight;
184
- if (orientation === "vertical") {
185
- viewportStyle.overflowX = "hidden";
186
- viewportStyle.overflowY = "scroll";
187
- } else if (orientation === "horizontal") {
188
- viewportStyle.overflowX = "scroll";
189
- viewportStyle.overflowY = "hidden";
190
- }
191
- const contentStyle = orientation === "vertical" ? { minWidth: "0px" } : orientation === "horizontal" ? { minHeight: "0px" } : void 0;
192
- return /* @__PURE__ */ jsxRuntime.jsxs(scrollArea.ScrollArea.Root, { ref, className: utils.cn("relative overflow-hidden", className), ...props, children: [
193
- /* @__PURE__ */ jsxRuntime.jsx(
194
- scrollArea.ScrollArea.Viewport,
195
- {
196
- ref: setViewportRef,
197
- className: utils.cn("h-full w-full rounded-[inherit]", maskClasses(sides), viewPortClassName),
198
- style: viewportStyle,
199
- children: /* @__PURE__ */ jsxRuntime.jsx(scrollArea.ScrollArea.Content, { style: contentStyle, children })
200
- }
201
- ),
202
- (orientation === "vertical" || orientation === "both") && /* @__PURE__ */ jsxRuntime.jsx(ScrollBar, { orientation: "vertical" }),
203
- (orientation === "horizontal" || orientation === "both") && /* @__PURE__ */ jsxRuntime.jsx(ScrollBar, { orientation: "horizontal" }),
204
- orientation === "both" && /* @__PURE__ */ jsxRuntime.jsx(scrollArea.ScrollArea.Corner, {})
205
- ] });
206
- }
207
- );
208
- ScrollArea.displayName = "ScrollArea";
209
- const ScrollBar = React__namespace.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
210
- scrollArea.ScrollArea.Scrollbar,
211
- {
212
- ref,
213
- orientation,
214
- className: utils.cn(
215
- "flex touch-none select-none transition-opacity duration-normal ease-out-custom",
216
- "opacity-0 data-[hovering]:opacity-100 data-[scrolling]:opacity-100 data-[scrolling]:duration-0",
217
- orientation === "vertical" && "h-full w-1.5 p-px",
218
- orientation === "horizontal" && "h-1.5 w-full flex-col p-px",
219
- className
220
- ),
221
- ...props,
222
- children: /* @__PURE__ */ jsxRuntime.jsx(scrollArea.ScrollArea.Thumb, { className: "relative flex-1 rounded-full bg-neutral4/30 hover:bg-neutral4/60 transition-colors duration-normal" })
223
- }
224
- ));
225
- ScrollBar.displayName = "ScrollBar";
226
-
227
- exports.ScrollArea = ScrollArea;
228
- exports.ScrollBar = ScrollBar;
229
- exports.useAutoscroll = useAutoscroll;
230
- //# sourceMappingURL=scroll-area-BqJfcT94.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scroll-area-BqJfcT94.cjs","sources":["../src/hooks/use-autoscroll.tsx","../src/ds/components/ScrollArea/scroll-area.tsx"],"sourcesContent":["import React, { useRef } from 'react';\n\nexport interface UseAutoscrollOptions {\n enabled?: boolean;\n}\n\nconst SCROLL_END_THRESHOLD = 8;\n\nexport const useAutoscroll = (ref: React.RefObject<HTMLElement | null>, { enabled = true }: UseAutoscrollOptions) => {\n const shouldScrollRef = useRef(enabled);\n const scrollFrameRef = useRef<number | null>(null);\n const userScrollIntentRef = useRef(false);\n const userScrollIntentTimeoutRef = useRef<number | null>(null);\n\n React.useEffect(() => {\n if (!enabled) return;\n if (!ref?.current) return;\n\n const area = ref.current;\n\n const scrollToEnd = () => {\n if (!shouldScrollRef.current) return;\n\n if (scrollFrameRef.current !== null) {\n cancelAnimationFrame(scrollFrameRef.current);\n }\n\n scrollFrameRef.current = requestAnimationFrame(() => {\n if (shouldScrollRef.current) {\n area.scrollTop = area.scrollHeight;\n }\n scrollFrameRef.current = null;\n });\n };\n\n const mutationObserver = new MutationObserver(scrollToEnd);\n\n mutationObserver.observe(area, {\n childList: true, // observe direct children changes\n subtree: true, // observe all descendants\n characterData: true, // observe text content changes\n });\n\n const resizeObserver = new ResizeObserver(scrollToEnd);\n resizeObserver.observe(area);\n\n const cancelPendingScroll = () => {\n if (scrollFrameRef.current !== null) {\n cancelAnimationFrame(scrollFrameRef.current);\n scrollFrameRef.current = null;\n }\n };\n\n const stopFollowing = () => {\n shouldScrollRef.current = false;\n cancelPendingScroll();\n };\n\n const registerUserScrollIntent = () => {\n userScrollIntentRef.current = true;\n\n if (userScrollIntentTimeoutRef.current !== null) {\n window.clearTimeout(userScrollIntentTimeoutRef.current);\n }\n\n userScrollIntentTimeoutRef.current = window.setTimeout(() => {\n userScrollIntentRef.current = false;\n userScrollIntentTimeoutRef.current = null;\n }, 250);\n };\n\n const handleWheel = (event: WheelEvent) => {\n registerUserScrollIntent();\n\n if (event.deltaY < 0) {\n stopFollowing();\n }\n };\n\n const handleKeyDown = (event: KeyboardEvent) => {\n registerUserScrollIntent();\n\n if (['ArrowUp', 'PageUp', 'Home'].includes(event.key)) {\n stopFollowing();\n }\n };\n\n const handleScroll = (e: Event) => {\n const scrollElement = e.target as HTMLElement;\n const currentPosition = scrollElement.scrollTop + scrollElement.clientHeight;\n const totalHeight = scrollElement.scrollHeight;\n const isAtEnd = currentPosition >= totalHeight - SCROLL_END_THRESHOLD;\n\n if (isAtEnd) {\n shouldScrollRef.current = true;\n return;\n }\n\n if (userScrollIntentRef.current) {\n shouldScrollRef.current = false;\n cancelPendingScroll();\n }\n };\n\n area.addEventListener('wheel', handleWheel, { passive: true });\n area.addEventListener('touchmove', registerUserScrollIntent, { passive: true });\n area.addEventListener('pointerdown', registerUserScrollIntent);\n area.addEventListener('keydown', handleKeyDown);\n area.addEventListener('scroll', handleScroll);\n scrollToEnd();\n\n return () => {\n area.removeEventListener('wheel', handleWheel);\n area.removeEventListener('touchmove', registerUserScrollIntent);\n area.removeEventListener('pointerdown', registerUserScrollIntent);\n area.removeEventListener('keydown', handleKeyDown);\n area.removeEventListener('scroll', handleScroll);\n mutationObserver.disconnect();\n resizeObserver.disconnect();\n cancelPendingScroll();\n\n if (userScrollIntentTimeoutRef.current !== null) {\n window.clearTimeout(userScrollIntentTimeoutRef.current);\n userScrollIntentTimeoutRef.current = null;\n }\n };\n }, [enabled, ref]);\n};\n","import { ScrollArea as ScrollAreaPrimitive } from '@base-ui/react/scroll-area';\nimport * as React from 'react';\n\nimport { useAutoscroll } from '@/hooks/use-autoscroll';\nimport { cn } from '@/lib/utils';\n\ntype Orientation = 'vertical' | 'horizontal' | 'both';\n\nexport type MaskSides = {\n top?: boolean;\n bottom?: boolean;\n left?: boolean;\n right?: boolean;\n /** Shorthand: sets both `left` and `right`. Per-side keys override. */\n x?: boolean;\n /** Shorthand: sets both `top` and `bottom`. Per-side keys override. */\n y?: boolean;\n};\n\n/**\n * - `true` / omitted: fade the edges that match `orientation`.\n * - `false`: no fade.\n * - object: per-side override on top of the orientation default.\n */\nexport type ScrollAreaMask = boolean | MaskSides;\n\nexport type ScrollAreaProps = React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> & {\n viewPortClassName?: string;\n maxHeight?: string;\n autoScroll?: boolean;\n orientation?: Orientation;\n /** Fade content at the edges where it's clipped by overflow. Defaults to the axes matching `orientation`. */\n mask?: ScrollAreaMask;\n /** @deprecated Use `mask` instead. Retained for backward compatibility. */\n showMask?: boolean;\n /**\n * Ref to the scrolling viewport element. Use this as the scroll element for a\n * virtualizer (`getScrollElement: () => viewportRef.current`) so the list can\n * virtualize while still using the ScrollArea's overlay scrollbar + masks.\n */\n viewportRef?: React.Ref<HTMLDivElement>;\n};\n\ntype ResolvedMask = { top: boolean; bottom: boolean; left: boolean; right: boolean };\n\nfunction resolveMask(mask: ScrollAreaMask | undefined, orientation: Orientation): ResolvedMask {\n if (mask === false) return { top: false, bottom: false, left: false, right: false };\n\n const vertical = orientation === 'vertical' || orientation === 'both';\n const horizontal = orientation === 'horizontal' || orientation === 'both';\n const sides: ResolvedMask = { top: vertical, bottom: vertical, left: horizontal, right: horizontal };\n\n if (mask === true || mask === undefined) return sides;\n\n if (mask.y !== undefined) {\n sides.top = mask.y;\n sides.bottom = mask.y;\n }\n if (mask.x !== undefined) {\n sides.left = mask.x;\n sides.right = mask.x;\n }\n if (mask.top !== undefined) sides.top = mask.top;\n if (mask.bottom !== undefined) sides.bottom = mask.bottom;\n if (mask.left !== undefined) sides.left = mask.left;\n if (mask.right !== undefined) sides.right = mask.right;\n\n return sides;\n}\n\nfunction maskClasses(sides: ResolvedMask) {\n return cn(\n sides.top && 'data-[overflow-y-start]:mask-t-from-[calc(100%-2rem)]',\n sides.bottom && 'data-[overflow-y-end]:mask-b-from-[calc(100%-2rem)]',\n sides.left && 'data-[overflow-x-start]:mask-l-from-[calc(100%-2rem)]',\n sides.right && 'data-[overflow-x-end]:mask-r-from-[calc(100%-2rem)]',\n );\n}\n\nconst ScrollArea = React.forwardRef<HTMLDivElement, ScrollAreaProps>(\n (\n {\n className,\n children,\n viewPortClassName,\n maxHeight,\n autoScroll = false,\n orientation = 'vertical',\n mask,\n showMask,\n viewportRef,\n ...props\n },\n ref,\n ) => {\n const areaRef = React.useRef<HTMLDivElement>(null);\n useAutoscroll(areaRef, { enabled: autoScroll });\n\n // Keep the internal autoscroll ref while also exposing the viewport to callers\n // (e.g. a virtualizer's scroll element).\n const setViewportRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n areaRef.current = node;\n if (typeof viewportRef === 'function') viewportRef(node);\n else if (viewportRef) (viewportRef as React.MutableRefObject<HTMLDivElement | null>).current = node;\n },\n [viewportRef],\n );\n\n const effectiveMask: ScrollAreaMask | undefined = mask !== undefined ? mask : showMask;\n const sides = resolveMask(effectiveMask, orientation);\n\n const viewportStyle: React.CSSProperties = {};\n if (maxHeight) viewportStyle.maxHeight = maxHeight;\n if (orientation === 'vertical') {\n viewportStyle.overflowX = 'hidden';\n viewportStyle.overflowY = 'scroll';\n } else if (orientation === 'horizontal') {\n viewportStyle.overflowX = 'scroll';\n viewportStyle.overflowY = 'hidden';\n }\n\n // Base UI's ScrollAreaContent forces `min-width: fit-content` so the\n // content can grow wider than the viewport (required for horizontal scroll\n // measurement). For vertical-only scroll we override it so children shrink\n // to the viewport width instead of forcing horizontal scroll.\n const contentStyle: React.CSSProperties | undefined =\n orientation === 'vertical'\n ? { minWidth: '0px' }\n : orientation === 'horizontal'\n ? { minHeight: '0px' }\n : undefined;\n\n return (\n <ScrollAreaPrimitive.Root ref={ref} className={cn('relative overflow-hidden', className)} {...props}>\n <ScrollAreaPrimitive.Viewport\n ref={setViewportRef}\n className={cn('h-full w-full rounded-[inherit]', maskClasses(sides), viewPortClassName)}\n style={viewportStyle}\n >\n <ScrollAreaPrimitive.Content style={contentStyle}>{children}</ScrollAreaPrimitive.Content>\n </ScrollAreaPrimitive.Viewport>\n {(orientation === 'vertical' || orientation === 'both') && <ScrollBar orientation=\"vertical\" />}\n {(orientation === 'horizontal' || orientation === 'both') && <ScrollBar orientation=\"horizontal\" />}\n {orientation === 'both' && <ScrollAreaPrimitive.Corner />}\n </ScrollAreaPrimitive.Root>\n );\n },\n);\nScrollArea.displayName = 'ScrollArea';\n\nconst ScrollBar = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Scrollbar>\n>(({ className, orientation = 'vertical', ...props }, ref) => (\n <ScrollAreaPrimitive.Scrollbar\n ref={ref}\n orientation={orientation}\n className={cn(\n 'flex touch-none select-none transition-opacity duration-normal ease-out-custom',\n 'opacity-0 data-[hovering]:opacity-100 data-[scrolling]:opacity-100 data-[scrolling]:duration-0',\n orientation === 'vertical' && 'h-full w-1.5 p-px',\n orientation === 'horizontal' && 'h-1.5 w-full flex-col p-px',\n className,\n )}\n {...props}\n >\n <ScrollAreaPrimitive.Thumb className=\"relative flex-1 rounded-full bg-neutral4/30 hover:bg-neutral4/60 transition-colors duration-normal\" />\n </ScrollAreaPrimitive.Scrollbar>\n));\nScrollBar.displayName = 'ScrollBar';\n\nexport { ScrollArea, ScrollBar };\n"],"names":["useRef","cn","React","jsxs","ScrollAreaPrimitive","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,oBAAA,GAAuB,CAAA;AAEtB,MAAM,gBAAgB,CAAC,GAAA,EAA0C,EAAE,OAAA,GAAU,MAAK,KAA4B;AACnH,EAAA,MAAM,eAAA,GAAkBA,aAAO,OAAO,CAAA;AACtC,EAAA,MAAM,cAAA,GAA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;AAAA,EAEJ;AACF;AACA,UAAA,CAAW,WAAA,GAAc,YAAA;AAEzB,MAAM,SAAA,GAAYF,gBAAA,CAAM,UAAA,CAGtB,CAAC,EAAE,SAAA,EAAW,WAAA,GAAc,UAAA,EAAY,GAAG,KAAA,EAAM,EAAG,GAAA,qBACpDG,cAAA;AAAA,EAACD,qBAAA,CAAoB,SAAA;AAAA,EAApB;AAAA,IACC,GAAA;AAAA,IACA,WAAA;AAAA,IACA,SAAA,EAAWH,QAAA;AAAA,MACT,gFAAA;AAAA,MACA,gGAAA;AAAA,MACA,gBAAgB,UAAA,IAAc,mBAAA;AAAA,MAC9B,gBAAgB,YAAA,IAAgB,4BAAA;AAAA,MAChC;AAAA,KACF;AAAA,IACC,GAAG,KAAA;AAAA,IAEJ,QAAA,kBAAAI,cAAA,CAACD,qBAAA,CAAoB,KAAA,EAApB,EAA0B,WAAU,oGAAA,EAAqG;AAAA;AAC5I,CACD;AACD,SAAA,CAAU,WAAA,GAAc,WAAA;;;;;;"}
@@ -1,208 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { ScrollArea as ScrollArea$1 } from '@base-ui/react/scroll-area';
3
- import * as React from 'react';
4
- import React__default, { useRef } from 'react';
5
- import { c as cn } from './utils-CzYGxqbG.js';
6
-
7
- const SCROLL_END_THRESHOLD = 8;
8
- const useAutoscroll = (ref, { enabled = true }) => {
9
- const shouldScrollRef = useRef(enabled);
10
- const scrollFrameRef = useRef(null);
11
- const userScrollIntentRef = useRef(false);
12
- const userScrollIntentTimeoutRef = useRef(null);
13
- React__default.useEffect(() => {
14
- if (!enabled) return;
15
- if (!ref?.current) return;
16
- const area = ref.current;
17
- const scrollToEnd = () => {
18
- if (!shouldScrollRef.current) return;
19
- if (scrollFrameRef.current !== null) {
20
- cancelAnimationFrame(scrollFrameRef.current);
21
- }
22
- scrollFrameRef.current = requestAnimationFrame(() => {
23
- if (shouldScrollRef.current) {
24
- area.scrollTop = area.scrollHeight;
25
- }
26
- scrollFrameRef.current = null;
27
- });
28
- };
29
- const mutationObserver = new MutationObserver(scrollToEnd);
30
- mutationObserver.observe(area, {
31
- childList: true,
32
- // observe direct children changes
33
- subtree: true,
34
- // observe all descendants
35
- characterData: true
36
- // observe text content changes
37
- });
38
- const resizeObserver = new ResizeObserver(scrollToEnd);
39
- resizeObserver.observe(area);
40
- const cancelPendingScroll = () => {
41
- if (scrollFrameRef.current !== null) {
42
- cancelAnimationFrame(scrollFrameRef.current);
43
- scrollFrameRef.current = null;
44
- }
45
- };
46
- const stopFollowing = () => {
47
- shouldScrollRef.current = false;
48
- cancelPendingScroll();
49
- };
50
- const registerUserScrollIntent = () => {
51
- userScrollIntentRef.current = true;
52
- if (userScrollIntentTimeoutRef.current !== null) {
53
- window.clearTimeout(userScrollIntentTimeoutRef.current);
54
- }
55
- userScrollIntentTimeoutRef.current = window.setTimeout(() => {
56
- userScrollIntentRef.current = false;
57
- userScrollIntentTimeoutRef.current = null;
58
- }, 250);
59
- };
60
- const handleWheel = (event) => {
61
- registerUserScrollIntent();
62
- if (event.deltaY < 0) {
63
- stopFollowing();
64
- }
65
- };
66
- const handleKeyDown = (event) => {
67
- registerUserScrollIntent();
68
- if (["ArrowUp", "PageUp", "Home"].includes(event.key)) {
69
- stopFollowing();
70
- }
71
- };
72
- const handleScroll = (e) => {
73
- const scrollElement = e.target;
74
- const currentPosition = scrollElement.scrollTop + scrollElement.clientHeight;
75
- const totalHeight = scrollElement.scrollHeight;
76
- const isAtEnd = currentPosition >= totalHeight - SCROLL_END_THRESHOLD;
77
- if (isAtEnd) {
78
- shouldScrollRef.current = true;
79
- return;
80
- }
81
- if (userScrollIntentRef.current) {
82
- shouldScrollRef.current = false;
83
- cancelPendingScroll();
84
- }
85
- };
86
- area.addEventListener("wheel", handleWheel, { passive: true });
87
- area.addEventListener("touchmove", registerUserScrollIntent, { passive: true });
88
- area.addEventListener("pointerdown", registerUserScrollIntent);
89
- area.addEventListener("keydown", handleKeyDown);
90
- area.addEventListener("scroll", handleScroll);
91
- scrollToEnd();
92
- return () => {
93
- area.removeEventListener("wheel", handleWheel);
94
- area.removeEventListener("touchmove", registerUserScrollIntent);
95
- area.removeEventListener("pointerdown", registerUserScrollIntent);
96
- area.removeEventListener("keydown", handleKeyDown);
97
- area.removeEventListener("scroll", handleScroll);
98
- mutationObserver.disconnect();
99
- resizeObserver.disconnect();
100
- cancelPendingScroll();
101
- if (userScrollIntentTimeoutRef.current !== null) {
102
- window.clearTimeout(userScrollIntentTimeoutRef.current);
103
- userScrollIntentTimeoutRef.current = null;
104
- }
105
- };
106
- }, [enabled, ref]);
107
- };
108
-
109
- function resolveMask(mask, orientation) {
110
- if (mask === false) return { top: false, bottom: false, left: false, right: false };
111
- const vertical = orientation === "vertical" || orientation === "both";
112
- const horizontal = orientation === "horizontal" || orientation === "both";
113
- const sides = { top: vertical, bottom: vertical, left: horizontal, right: horizontal };
114
- if (mask === true || mask === void 0) return sides;
115
- if (mask.y !== void 0) {
116
- sides.top = mask.y;
117
- sides.bottom = mask.y;
118
- }
119
- if (mask.x !== void 0) {
120
- sides.left = mask.x;
121
- sides.right = mask.x;
122
- }
123
- if (mask.top !== void 0) sides.top = mask.top;
124
- if (mask.bottom !== void 0) sides.bottom = mask.bottom;
125
- if (mask.left !== void 0) sides.left = mask.left;
126
- if (mask.right !== void 0) sides.right = mask.right;
127
- return sides;
128
- }
129
- function maskClasses(sides) {
130
- return cn(
131
- sides.top && "data-[overflow-y-start]:mask-t-from-[calc(100%-2rem)]",
132
- sides.bottom && "data-[overflow-y-end]:mask-b-from-[calc(100%-2rem)]",
133
- sides.left && "data-[overflow-x-start]:mask-l-from-[calc(100%-2rem)]",
134
- sides.right && "data-[overflow-x-end]:mask-r-from-[calc(100%-2rem)]"
135
- );
136
- }
137
- const ScrollArea = React.forwardRef(
138
- ({
139
- className,
140
- children,
141
- viewPortClassName,
142
- maxHeight,
143
- autoScroll = false,
144
- orientation = "vertical",
145
- mask,
146
- showMask,
147
- viewportRef,
148
- ...props
149
- }, ref) => {
150
- const areaRef = React.useRef(null);
151
- useAutoscroll(areaRef, { enabled: autoScroll });
152
- const setViewportRef = React.useCallback(
153
- (node) => {
154
- areaRef.current = node;
155
- if (typeof viewportRef === "function") viewportRef(node);
156
- else if (viewportRef) viewportRef.current = node;
157
- },
158
- [viewportRef]
159
- );
160
- const effectiveMask = mask !== void 0 ? mask : showMask;
161
- const sides = resolveMask(effectiveMask, orientation);
162
- const viewportStyle = {};
163
- if (maxHeight) viewportStyle.maxHeight = maxHeight;
164
- if (orientation === "vertical") {
165
- viewportStyle.overflowX = "hidden";
166
- viewportStyle.overflowY = "scroll";
167
- } else if (orientation === "horizontal") {
168
- viewportStyle.overflowX = "scroll";
169
- viewportStyle.overflowY = "hidden";
170
- }
171
- const contentStyle = orientation === "vertical" ? { minWidth: "0px" } : orientation === "horizontal" ? { minHeight: "0px" } : void 0;
172
- return /* @__PURE__ */ jsxs(ScrollArea$1.Root, { ref, className: cn("relative overflow-hidden", className), ...props, children: [
173
- /* @__PURE__ */ jsx(
174
- ScrollArea$1.Viewport,
175
- {
176
- ref: setViewportRef,
177
- className: cn("h-full w-full rounded-[inherit]", maskClasses(sides), viewPortClassName),
178
- style: viewportStyle,
179
- children: /* @__PURE__ */ jsx(ScrollArea$1.Content, { style: contentStyle, children })
180
- }
181
- ),
182
- (orientation === "vertical" || orientation === "both") && /* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" }),
183
- (orientation === "horizontal" || orientation === "both") && /* @__PURE__ */ jsx(ScrollBar, { orientation: "horizontal" }),
184
- orientation === "both" && /* @__PURE__ */ jsx(ScrollArea$1.Corner, {})
185
- ] });
186
- }
187
- );
188
- ScrollArea.displayName = "ScrollArea";
189
- const ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(
190
- ScrollArea$1.Scrollbar,
191
- {
192
- ref,
193
- orientation,
194
- className: cn(
195
- "flex touch-none select-none transition-opacity duration-normal ease-out-custom",
196
- "opacity-0 data-[hovering]:opacity-100 data-[scrolling]:opacity-100 data-[scrolling]:duration-0",
197
- orientation === "vertical" && "h-full w-1.5 p-px",
198
- orientation === "horizontal" && "h-1.5 w-full flex-col p-px",
199
- className
200
- ),
201
- ...props,
202
- children: /* @__PURE__ */ jsx(ScrollArea$1.Thumb, { className: "relative flex-1 rounded-full bg-neutral4/30 hover:bg-neutral4/60 transition-colors duration-normal" })
203
- }
204
- ));
205
- ScrollBar.displayName = "ScrollBar";
206
-
207
- export { ScrollArea as S, ScrollBar as a, useAutoscroll as u };
208
- //# sourceMappingURL=scroll-area-BtDqmqBK.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scroll-area-BtDqmqBK.js","sources":["../src/hooks/use-autoscroll.tsx","../src/ds/components/ScrollArea/scroll-area.tsx"],"sourcesContent":["import React, { useRef } from 'react';\n\nexport interface UseAutoscrollOptions {\n enabled?: boolean;\n}\n\nconst SCROLL_END_THRESHOLD = 8;\n\nexport const useAutoscroll = (ref: React.RefObject<HTMLElement | null>, { enabled = true }: UseAutoscrollOptions) => {\n const shouldScrollRef = useRef(enabled);\n const scrollFrameRef = useRef<number | null>(null);\n const userScrollIntentRef = useRef(false);\n const userScrollIntentTimeoutRef = useRef<number | null>(null);\n\n React.useEffect(() => {\n if (!enabled) return;\n if (!ref?.current) return;\n\n const area = ref.current;\n\n const scrollToEnd = () => {\n if (!shouldScrollRef.current) return;\n\n if (scrollFrameRef.current !== null) {\n cancelAnimationFrame(scrollFrameRef.current);\n }\n\n scrollFrameRef.current = requestAnimationFrame(() => {\n if (shouldScrollRef.current) {\n area.scrollTop = area.scrollHeight;\n }\n scrollFrameRef.current = null;\n });\n };\n\n const mutationObserver = new MutationObserver(scrollToEnd);\n\n mutationObserver.observe(area, {\n childList: true, // observe direct children changes\n subtree: true, // observe all descendants\n characterData: true, // observe text content changes\n });\n\n const resizeObserver = new ResizeObserver(scrollToEnd);\n resizeObserver.observe(area);\n\n const cancelPendingScroll = () => {\n if (scrollFrameRef.current !== null) {\n cancelAnimationFrame(scrollFrameRef.current);\n scrollFrameRef.current = null;\n }\n };\n\n const stopFollowing = () => {\n shouldScrollRef.current = false;\n cancelPendingScroll();\n };\n\n const registerUserScrollIntent = () => {\n userScrollIntentRef.current = true;\n\n if (userScrollIntentTimeoutRef.current !== null) {\n window.clearTimeout(userScrollIntentTimeoutRef.current);\n }\n\n userScrollIntentTimeoutRef.current = window.setTimeout(() => {\n userScrollIntentRef.current = false;\n userScrollIntentTimeoutRef.current = null;\n }, 250);\n };\n\n const handleWheel = (event: WheelEvent) => {\n registerUserScrollIntent();\n\n if (event.deltaY < 0) {\n stopFollowing();\n }\n };\n\n const handleKeyDown = (event: KeyboardEvent) => {\n registerUserScrollIntent();\n\n if (['ArrowUp', 'PageUp', 'Home'].includes(event.key)) {\n stopFollowing();\n }\n };\n\n const handleScroll = (e: Event) => {\n const scrollElement = e.target as HTMLElement;\n const currentPosition = scrollElement.scrollTop + scrollElement.clientHeight;\n const totalHeight = scrollElement.scrollHeight;\n const isAtEnd = currentPosition >= totalHeight - SCROLL_END_THRESHOLD;\n\n if (isAtEnd) {\n shouldScrollRef.current = true;\n return;\n }\n\n if (userScrollIntentRef.current) {\n shouldScrollRef.current = false;\n cancelPendingScroll();\n }\n };\n\n area.addEventListener('wheel', handleWheel, { passive: true });\n area.addEventListener('touchmove', registerUserScrollIntent, { passive: true });\n area.addEventListener('pointerdown', registerUserScrollIntent);\n area.addEventListener('keydown', handleKeyDown);\n area.addEventListener('scroll', handleScroll);\n scrollToEnd();\n\n return () => {\n area.removeEventListener('wheel', handleWheel);\n area.removeEventListener('touchmove', registerUserScrollIntent);\n area.removeEventListener('pointerdown', registerUserScrollIntent);\n area.removeEventListener('keydown', handleKeyDown);\n area.removeEventListener('scroll', handleScroll);\n mutationObserver.disconnect();\n resizeObserver.disconnect();\n cancelPendingScroll();\n\n if (userScrollIntentTimeoutRef.current !== null) {\n window.clearTimeout(userScrollIntentTimeoutRef.current);\n userScrollIntentTimeoutRef.current = null;\n }\n };\n }, [enabled, ref]);\n};\n","import { ScrollArea as ScrollAreaPrimitive } from '@base-ui/react/scroll-area';\nimport * as React from 'react';\n\nimport { useAutoscroll } from '@/hooks/use-autoscroll';\nimport { cn } from '@/lib/utils';\n\ntype Orientation = 'vertical' | 'horizontal' | 'both';\n\nexport type MaskSides = {\n top?: boolean;\n bottom?: boolean;\n left?: boolean;\n right?: boolean;\n /** Shorthand: sets both `left` and `right`. Per-side keys override. */\n x?: boolean;\n /** Shorthand: sets both `top` and `bottom`. Per-side keys override. */\n y?: boolean;\n};\n\n/**\n * - `true` / omitted: fade the edges that match `orientation`.\n * - `false`: no fade.\n * - object: per-side override on top of the orientation default.\n */\nexport type ScrollAreaMask = boolean | MaskSides;\n\nexport type ScrollAreaProps = React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> & {\n viewPortClassName?: string;\n maxHeight?: string;\n autoScroll?: boolean;\n orientation?: Orientation;\n /** Fade content at the edges where it's clipped by overflow. Defaults to the axes matching `orientation`. */\n mask?: ScrollAreaMask;\n /** @deprecated Use `mask` instead. Retained for backward compatibility. */\n showMask?: boolean;\n /**\n * Ref to the scrolling viewport element. Use this as the scroll element for a\n * virtualizer (`getScrollElement: () => viewportRef.current`) so the list can\n * virtualize while still using the ScrollArea's overlay scrollbar + masks.\n */\n viewportRef?: React.Ref<HTMLDivElement>;\n};\n\ntype ResolvedMask = { top: boolean; bottom: boolean; left: boolean; right: boolean };\n\nfunction resolveMask(mask: ScrollAreaMask | undefined, orientation: Orientation): ResolvedMask {\n if (mask === false) return { top: false, bottom: false, left: false, right: false };\n\n const vertical = orientation === 'vertical' || orientation === 'both';\n const horizontal = orientation === 'horizontal' || orientation === 'both';\n const sides: ResolvedMask = { top: vertical, bottom: vertical, left: horizontal, right: horizontal };\n\n if (mask === true || mask === undefined) return sides;\n\n if (mask.y !== undefined) {\n sides.top = mask.y;\n sides.bottom = mask.y;\n }\n if (mask.x !== undefined) {\n sides.left = mask.x;\n sides.right = mask.x;\n }\n if (mask.top !== undefined) sides.top = mask.top;\n if (mask.bottom !== undefined) sides.bottom = mask.bottom;\n if (mask.left !== undefined) sides.left = mask.left;\n if (mask.right !== undefined) sides.right = mask.right;\n\n return sides;\n}\n\nfunction maskClasses(sides: ResolvedMask) {\n return cn(\n sides.top && 'data-[overflow-y-start]:mask-t-from-[calc(100%-2rem)]',\n sides.bottom && 'data-[overflow-y-end]:mask-b-from-[calc(100%-2rem)]',\n sides.left && 'data-[overflow-x-start]:mask-l-from-[calc(100%-2rem)]',\n sides.right && 'data-[overflow-x-end]:mask-r-from-[calc(100%-2rem)]',\n );\n}\n\nconst ScrollArea = React.forwardRef<HTMLDivElement, ScrollAreaProps>(\n (\n {\n className,\n children,\n viewPortClassName,\n maxHeight,\n autoScroll = false,\n orientation = 'vertical',\n mask,\n showMask,\n viewportRef,\n ...props\n },\n ref,\n ) => {\n const areaRef = React.useRef<HTMLDivElement>(null);\n useAutoscroll(areaRef, { enabled: autoScroll });\n\n // Keep the internal autoscroll ref while also exposing the viewport to callers\n // (e.g. a virtualizer's scroll element).\n const setViewportRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n areaRef.current = node;\n if (typeof viewportRef === 'function') viewportRef(node);\n else if (viewportRef) (viewportRef as React.MutableRefObject<HTMLDivElement | null>).current = node;\n },\n [viewportRef],\n );\n\n const effectiveMask: ScrollAreaMask | undefined = mask !== undefined ? mask : showMask;\n const sides = resolveMask(effectiveMask, orientation);\n\n const viewportStyle: React.CSSProperties = {};\n if (maxHeight) viewportStyle.maxHeight = maxHeight;\n if (orientation === 'vertical') {\n viewportStyle.overflowX = 'hidden';\n viewportStyle.overflowY = 'scroll';\n } else if (orientation === 'horizontal') {\n viewportStyle.overflowX = 'scroll';\n viewportStyle.overflowY = 'hidden';\n }\n\n // Base UI's ScrollAreaContent forces `min-width: fit-content` so the\n // content can grow wider than the viewport (required for horizontal scroll\n // measurement). For vertical-only scroll we override it so children shrink\n // to the viewport width instead of forcing horizontal scroll.\n const contentStyle: React.CSSProperties | undefined =\n orientation === 'vertical'\n ? { minWidth: '0px' }\n : orientation === 'horizontal'\n ? { minHeight: '0px' }\n : undefined;\n\n return (\n <ScrollAreaPrimitive.Root ref={ref} className={cn('relative overflow-hidden', className)} {...props}>\n <ScrollAreaPrimitive.Viewport\n ref={setViewportRef}\n className={cn('h-full w-full rounded-[inherit]', maskClasses(sides), viewPortClassName)}\n style={viewportStyle}\n >\n <ScrollAreaPrimitive.Content style={contentStyle}>{children}</ScrollAreaPrimitive.Content>\n </ScrollAreaPrimitive.Viewport>\n {(orientation === 'vertical' || orientation === 'both') && <ScrollBar orientation=\"vertical\" />}\n {(orientation === 'horizontal' || orientation === 'both') && <ScrollBar orientation=\"horizontal\" />}\n {orientation === 'both' && <ScrollAreaPrimitive.Corner />}\n </ScrollAreaPrimitive.Root>\n );\n },\n);\nScrollArea.displayName = 'ScrollArea';\n\nconst ScrollBar = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Scrollbar>\n>(({ className, orientation = 'vertical', ...props }, ref) => (\n <ScrollAreaPrimitive.Scrollbar\n ref={ref}\n orientation={orientation}\n className={cn(\n 'flex touch-none select-none transition-opacity duration-normal ease-out-custom',\n 'opacity-0 data-[hovering]:opacity-100 data-[scrolling]:opacity-100 data-[scrolling]:duration-0',\n orientation === 'vertical' && 'h-full w-1.5 p-px',\n orientation === 'horizontal' && 'h-1.5 w-full flex-col p-px',\n className,\n )}\n {...props}\n >\n <ScrollAreaPrimitive.Thumb className=\"relative flex-1 rounded-full bg-neutral4/30 hover:bg-neutral4/60 transition-colors duration-normal\" />\n </ScrollAreaPrimitive.Scrollbar>\n));\nScrollBar.displayName = 'ScrollBar';\n\nexport { ScrollArea, ScrollBar };\n"],"names":["React","ScrollAreaPrimitive"],"mappings":";;;;;;AAMA,MAAM,oBAAA,GAAuB,CAAA;AAEtB,MAAM,gBAAgB,CAAC,GAAA,E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G,WAAA,KAAgB,MAAA,oBAAU,GAAA,CAACA,YAAA,CAAoB,QAApB,EAA2B;AAAA,KAAA,EACzD,CAAA;AAAA,EAEJ;AACF;AACA,UAAA,CAAW,WAAA,GAAc,YAAA;AAEzB,MAAM,SAAA,GAAY,KAAA,CAAM,UAAA,CAGtB,CAAC,EAAE,SAAA,EAAW,WAAA,GAAc,UAAA,EAAY,GAAG,KAAA,EAAM,EAAG,GAAA,qBACpD,GAAA;AAAA,EAACA,YAAA,CAAoB,SAAA;AAAA,EAApB;AAAA,IACC,GAAA;AAAA,IACA,WAAA;AAAA,IACA,SAAA,EAAW,EAAA;AAAA,MACT,gFAAA;AAAA,MACA,gGAAA;AAAA,MACA,gBAAgB,UAAA,IAAc,mBAAA;AAAA,MAC9B,gBAAgB,YAAA,IAAgB,4BAAA;AAAA,MAChC;AAAA,KACF;AAAA,IACC,GAAG,KAAA;AAAA,IAEJ,QAAA,kBAAA,GAAA,CAACA,YAAA,CAAoB,KAAA,EAApB,EAA0B,WAAU,oGAAA,EAAqG;AAAA;AAC5I,CACD;AACD,SAAA,CAAU,WAAA,GAAc,WAAA;;;;"}
@@ -1,151 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useRef, useState, useEffect, useCallback } from 'react';
3
- import { c as cn } from './utils-CzYGxqbG.js';
4
-
5
- const INDICATOR_WIDTH = 40;
6
- const INDICATOR_HEIGHT = 150;
7
- const INDICATOR_SPACE = 10;
8
- const ScrollableContainer = ({
9
- className,
10
- children,
11
- scrollSpeed = 100,
12
- scrollIntervalTime = 20
13
- }) => {
14
- const containerRef = useRef(null);
15
- const scrollInterval = useRef(null);
16
- const [containerHeight, setContainerHeight] = useState(0);
17
- const [containerRight, setContainerRight] = useState(0);
18
- const [containerTop, setContainerTop] = useState(0);
19
- const [containerLeft, setContainerLeft] = useState(0);
20
- const [showRightIndicator, setShowRightIndicator] = useState(false);
21
- const [showLeftIndicator, setShowLeftIndicator] = useState(false);
22
- useEffect(() => {
23
- const updatePositions = () => {
24
- if (!containerRef.current) return;
25
- const canScrollRight = containerRef.current.scrollLeft < containerRef.current.scrollWidth - containerRef.current.clientWidth;
26
- setShowRightIndicator(canScrollRight);
27
- setContainerHeight(containerRef.current.clientHeight);
28
- const rect = containerRef.current.getBoundingClientRect();
29
- setContainerRight(rect.right);
30
- setContainerLeft(rect.left);
31
- setContainerTop(rect.top);
32
- };
33
- updatePositions();
34
- const resizeObserver = new ResizeObserver(updatePositions);
35
- if (containerRef.current) {
36
- resizeObserver.observe(containerRef.current);
37
- }
38
- const handleScroll = () => {
39
- if (!containerRef.current) return;
40
- const canScrollLeft = containerRef.current.scrollLeft > 0;
41
- const canScrollRight = containerRef.current.scrollLeft < containerRef.current.scrollWidth - containerRef.current.clientWidth;
42
- setShowLeftIndicator(canScrollLeft);
43
- setShowRightIndicator(canScrollRight);
44
- updatePositions();
45
- };
46
- containerRef?.current?.addEventListener("scroll", handleScroll);
47
- const container = containerRef.current;
48
- return () => {
49
- if (container) {
50
- resizeObserver.unobserve(container);
51
- container.removeEventListener("scroll", handleScroll);
52
- }
53
- };
54
- }, []);
55
- const ScrollIndicator = ({
56
- isVisible,
57
- position,
58
- containerHeight: containerHeight2,
59
- containerTop: containerTop2,
60
- containerRight: containerRight2,
61
- onStartScrolling,
62
- onStopScrolling
63
- }) => {
64
- if (!isVisible) return null;
65
- const styles = {
66
- top: containerHeight2 < INDICATOR_HEIGHT ? containerTop2 : containerTop2 + (containerHeight2 - INDICATOR_HEIGHT) / 2,
67
- width: INDICATOR_WIDTH,
68
- height: containerHeight2 < INDICATOR_HEIGHT ? `${containerHeight2}px` : `${INDICATOR_HEIGHT}px`
69
- };
70
- return /* @__PURE__ */ jsxs(
71
- "button",
72
- {
73
- onMouseDown: onStartScrolling,
74
- onTouchStart: onStartScrolling,
75
- onMouseUp: onStopScrolling,
76
- onTouchEnd: onStopScrolling,
77
- onTouchCancel: onStopScrolling,
78
- className: "bg-surface4 text-neutral3 border-surface5 hover:border-neutral3 fixed z-10 flex items-center justify-center rounded-lg border text-2xl hover:text-white",
79
- style: {
80
- ...styles,
81
- left: position === "left" ? containerLeft + INDICATOR_SPACE : containerRight2 - INDICATOR_WIDTH - INDICATOR_SPACE
82
- },
83
- children: [
84
- " ",
85
- position === "left" ? "«" : "»"
86
- ]
87
- }
88
- );
89
- };
90
- const startScrolling = useCallback(
91
- (direction, e) => {
92
- e?.preventDefault();
93
- e?.stopPropagation();
94
- if (scrollInterval.current) {
95
- clearInterval(scrollInterval.current);
96
- scrollInterval.current = null;
97
- }
98
- if (containerRef.current) {
99
- containerRef.current.scrollBy({
100
- left: direction === "right" ? scrollSpeed * 2 : -scrollSpeed * 2,
101
- behavior: "smooth"
102
- });
103
- }
104
- scrollInterval.current = setInterval(() => {
105
- if (containerRef.current) {
106
- containerRef.current.scrollBy({
107
- left: direction === "right" ? scrollSpeed : -scrollSpeed,
108
- behavior: "smooth"
109
- });
110
- }
111
- }, scrollIntervalTime);
112
- },
113
- [scrollSpeed, scrollIntervalTime]
114
- );
115
- const stopScrolling = useCallback(() => {
116
- if (scrollInterval.current) {
117
- clearInterval(scrollInterval.current);
118
- scrollInterval.current = null;
119
- }
120
- }, []);
121
- return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: cn("relative max-h-full overflow-auto", className), children: [
122
- children,
123
- /* @__PURE__ */ jsx(
124
- ScrollIndicator,
125
- {
126
- isVisible: showLeftIndicator,
127
- position: "left",
128
- containerHeight,
129
- containerTop,
130
- containerRight,
131
- onStartScrolling: (e) => startScrolling("left", e),
132
- onStopScrolling: stopScrolling
133
- }
134
- ),
135
- /* @__PURE__ */ jsx(
136
- ScrollIndicator,
137
- {
138
- isVisible: showRightIndicator,
139
- position: "right",
140
- containerHeight,
141
- containerTop,
142
- containerRight,
143
- onStartScrolling: (e) => startScrolling("right", e),
144
- onStopScrolling: stopScrolling
145
- }
146
- )
147
- ] });
148
- };
149
-
150
- export { ScrollableContainer as S };
151
- //# sourceMappingURL=scrollable-container-BqOFHwdb.js.map