@marimo-team/islands 0.23.9-dev2 → 0.23.9-dev20

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 (273) hide show
  1. package/dist/{ConnectedDataExplorerComponent-2lBNiUv6.js → ConnectedDataExplorerComponent-DSyAzzpW.js} +20 -20
  2. package/dist/ErrorBoundary-rULOrC_p.js +175 -0
  3. package/dist/{ImageComparisonComponent-CNHIsPDj.js → ImageComparisonComponent-CHrI72em.js} +1 -1
  4. package/dist/{Plot-4wn-lMVn.js → Plot-CAYS29h9.js} +1 -1
  5. package/dist/{_baseUniq-CxZRxRRo.js → _baseUniq-B_2Hw7zG.js} +3 -3
  6. package/dist/{any-language-editor-VWs_7v27.js → any-language-editor-DfdpyDv_.js} +23 -23
  7. package/dist/architecture-7HQA4BMR-Kyc44TmC.js +6 -0
  8. package/dist/{architectureDiagram-VXUJARFQ-CXVJxFhH.js → architectureDiagram-VXUJARFQ-CT2SuxNw.js} +15 -15
  9. package/dist/{arrays-CldYf7p7.js → arrays-sEtDRoG4.js} +1 -1
  10. package/dist/assets/__vite-browser-external-Ddfz4Fpd.js +1 -0
  11. package/dist/assets/{worker-CpBbwbQo.js → worker-CgL6N0XX.js} +2 -2
  12. package/dist/{blockDiagram-VD42YOAC-DGDaxR8I.js → blockDiagram-VD42YOAC-Dy7hlFla.js} +7 -7
  13. package/dist/{button-Dj4BTre0.js → button-C5K9fIPF.js} +2 -2
  14. package/dist/{c4Diagram-YG6GDRKO-C2hc6ne8.js → c4Diagram-YG6GDRKO-BXlAmZ8Z.js} +4 -4
  15. package/dist/{capabilities-C9rrYCzf.js → capabilities-BceAxrAW.js} +2 -2
  16. package/dist/{channel-BBoIVUrJ.js → channel-D_PHgcig.js} +1 -1
  17. package/dist/{chat-ui-D3XBept8.js → chat-ui-s5fKbcIr.js} +3084 -3057
  18. package/dist/{check-BcUIXnUT.js → check-DTbrK0zt.js} +1 -1
  19. package/dist/{chunk-4F5CHEZ2-BZq7Kom7.js → chunk-4F5CHEZ2-D9nGEHV8.js} +1 -1
  20. package/dist/{chunk-5FQGJX7Z-BOg95xG5.js → chunk-5FQGJX7Z-BNjes6Yx.js} +5 -5
  21. package/dist/{chunk-ABZYJK2D-D0cLy8Bb.js → chunk-ABZYJK2D-Dz0-H2B5.js} +1 -1
  22. package/dist/{chunk-ATLVNIR6-BXsEjlHF.js → chunk-ATLVNIR6-o0Z5MZLd.js} +1 -1
  23. package/dist/{chunk-B2363JML-D9-XOau1.js → chunk-B2363JML-KEJpLGGP.js} +1 -1
  24. package/dist/{chunk-B4BG7PRW-Q1usn6T3.js → chunk-B4BG7PRW-BL98U9B4.js} +4 -4
  25. package/dist/{chunk-DI55MBZ5-D1qLYNrb.js → chunk-DI55MBZ5-Dwkn0LWm.js} +4 -4
  26. package/dist/{chunk-EXTU4WIE-BKNXdLmD.js → chunk-EXTU4WIE-9sNjmQrB.js} +1 -1
  27. package/dist/{chunk-FRFDVMJY-BSBUAX7r.js → chunk-FRFDVMJY-DzQqMWrl.js} +1 -1
  28. package/dist/{chunk-JA3XYJ7Z-D6c6cOBG.js → chunk-JA3XYJ7Z-C32Y7Epf.js} +2 -2
  29. package/dist/{chunk-JZLCHNYA-BvsPHJmL.js → chunk-JZLCHNYA-C6ftyVMN.js} +4 -4
  30. package/dist/{chunk-N4CR4FBY-8ycT-O9a.js → chunk-N4CR4FBY-DUhGZhZs.js} +5 -5
  31. package/dist/{chunk-PL6DKKU2-B0MTXvyc.js → chunk-PL6DKKU2-D7km-08O.js} +1 -1
  32. package/dist/{chunk-QN33PNHL-Bb-eUBW3.js → chunk-QN33PNHL-0K6SDYn3.js} +1 -1
  33. package/dist/{chunk-QXUST7PY-DV8yRwBd.js → chunk-QXUST7PY-DMhsRpYK.js} +5 -5
  34. package/dist/{chunk-S3R3BYOJ-mQeCz5CE.js → chunk-S3R3BYOJ-oAe3dEbO.js} +3 -3
  35. package/dist/{chunk-SJTYNZTY-CEG4F0pB.js → chunk-SJTYNZTY-BkJrPRFC.js} +1 -1
  36. package/dist/{chunk-TCCFYFTB-d3HOqL2I.js → chunk-TCCFYFTB-D58KeXnC.js} +6 -6
  37. package/dist/{chunk-TQ3KTPDO-DiCtqVSi.js → chunk-TQ3KTPDO-D_yA_wAb.js} +1 -1
  38. package/dist/{chunk-TZMSLE5B-BqW10dHe.js → chunk-TZMSLE5B-yBKS_DQU.js} +1 -1
  39. package/dist/{chunk-UMXZTB3W-97iS1iEl.js → chunk-UMXZTB3W-D7uwvNjd.js} +1 -1
  40. package/dist/{classDiagram-2ON5EDUG--Yh__LHb.js → classDiagram-2ON5EDUG-QjoAcuFE.js} +10 -10
  41. package/dist/{classDiagram-v2-WZHVMYZB-BC7X7Xtc.js → classDiagram-v2-WZHVMYZB-bUCv4gu2.js} +10 -10
  42. package/dist/{clone-BuIIsfA8.js → clone-Q4Fqwn6q.js} +1 -1
  43. package/dist/{code-block-37QAKDTI-BsGy1AOJ.js → code-block-37QAKDTI-m92Yc8pv.js} +2 -2
  44. package/dist/{code-visibility-Dt0Aq6-t.js → code-visibility-DvMXzzJz.js} +8425 -8595
  45. package/dist/{constants-D0gkYoE2.js → constants-T20xxyNf.js} +2 -2
  46. package/dist/{copy-DLf4aN7I.js → copy-BuQpJEzp.js} +2 -2
  47. package/dist/{dagre-6UL2VRFP-DRBWoQUw.js → dagre-6UL2VRFP-J0JKgwOt.js} +11 -11
  48. package/dist/{dagre-VYEPqXIV.js → dagre-By_QsQgc.js} +11 -11
  49. package/dist/{data-grid-overlay-editor-efe5ZagF.js → data-grid-overlay-editor-mfEJ5475.js} +2 -2
  50. package/dist/{diagram-PSM6KHXK-H66ATWP2.js → diagram-PSM6KHXK-DYgJuNk9.js} +18 -18
  51. package/dist/{diagram-QEK2KX5R-DItl5Wns.js → diagram-QEK2KX5R-CKdBR2sb.js} +14 -14
  52. package/dist/{diagram-S2PKOQOG-CtuW_ZuL.js → diagram-S2PKOQOG-Dpi7mo5W.js} +14 -14
  53. package/dist/dist-0Fif7jnk.js +5 -0
  54. package/dist/{dist-Dh3wkoyH.js → dist-4j4c7bjm.js} +2 -2
  55. package/dist/{dist-CDFZi-QD.js → dist-B3P2fFpz.js} +1 -1
  56. package/dist/{dist-BNyrZfqT.js → dist-B3pZ0Ab6.js} +2 -2
  57. package/dist/dist-B5h_9sHB.js +6 -0
  58. package/dist/dist-B9M6R5ye.js +5 -0
  59. package/dist/dist-BCt3tnck.js +8 -0
  60. package/dist/{dist-BrBucRXs.js → dist-BTfv03uy.js} +2 -2
  61. package/dist/dist-BUIJwMwn.js +8 -0
  62. package/dist/{dist-CYEylvZA.js → dist-BbbIBDiQ.js} +1 -1
  63. package/dist/{dist-KnujRhFL.js → dist-BcuoonNH.js} +4 -4
  64. package/dist/{dist-DJ6zJQZ4.js → dist-Bde4a2kU.js} +2 -2
  65. package/dist/{dist-t_qL7eB8.js → dist-Bfwsv11D.js} +2 -2
  66. package/dist/{dist-CNtV21T_.js → dist-BhM8gdSO.js} +4 -4
  67. package/dist/{dist-nuW5EDYT.js → dist-BotSqB48.js} +2 -2
  68. package/dist/dist-BpquMd3k.js +5 -0
  69. package/dist/dist-BzJsqYfz.js +5 -0
  70. package/dist/{dist-D029TiHd.js → dist-Bz_sYWbr.js} +2 -2
  71. package/dist/{dist-D3ZI9nhS.js → dist-C1BYNeCR.js} +4 -4
  72. package/dist/{dist-Bc5pmZIw.js → dist-C5VC_yzu.js} +1 -1
  73. package/dist/dist-CA5ELXAf.js +6 -0
  74. package/dist/dist-CLBRs6Uv.js +5 -0
  75. package/dist/{dist-Dhk6FMb0.js → dist-CLJWPTX2.js} +3 -3
  76. package/dist/{dist-C34oIrQ9.js → dist-CLUtPrdy.js} +1 -1
  77. package/dist/dist-CStVCMbq.js +5 -0
  78. package/dist/{dist-B8RaFTRF.js → dist-CUCNs1ja.js} +2 -2
  79. package/dist/dist-CZRIEY3Y.js +8 -0
  80. package/dist/{dist-UcOPnRMa.js → dist-CcXxepx6.js} +3 -3
  81. package/dist/dist-CuUHbFD0.js +5 -0
  82. package/dist/{dist-B8BjrFUE.js → dist-Cy1WxgBD.js} +5 -5
  83. package/dist/{dist-WdPUFc56.js → dist-D4CewLk6.js} +1 -1
  84. package/dist/{dist-DMZNjfX4.js → dist-DRfcqpxJ.js} +2 -2
  85. package/dist/dist-DV7Iabxb.js +8 -0
  86. package/dist/{dist-usPCDYx8.js → dist-D_bzzWBm.js} +1 -1
  87. package/dist/{dist-BvCfQQQE.js → dist-DgnE8F-r.js} +1 -1
  88. package/dist/{dist-JEhxD_cn.js → dist-DhHh0jLg.js} +1 -1
  89. package/dist/{dist-DGAfI2rB.js → dist-DqAWR3CS.js} +2 -2
  90. package/dist/{dist--sWVZwjW.js → dist-Du8WkPuU.js} +1 -1
  91. package/dist/dist-DuEeHMvL.js +5 -0
  92. package/dist/{dist-BTyJtnNg.js → dist-DxvORzUR.js} +1 -1
  93. package/dist/{dist-B507mf_I.js → dist-RqXTaiir.js} +2 -2
  94. package/dist/{dist-Yrfc6L0I.js → dist-fQ0ViXGs.js} +3 -3
  95. package/dist/{dist-B4LJpMEg.js → dist-h2c8sZvT.js} +1 -1
  96. package/dist/{dist-C2ej4eOH.js → dist-luvabDEB.js} +2 -2
  97. package/dist/{dist-B52GXZbd.js → dist-p2qyWijU.js} +2 -2
  98. package/dist/{erDiagram-Q2GNP2WA--19X2kU5.js → erDiagram-Q2GNP2WA-BU-m41EQ.js} +10 -10
  99. package/dist/{error-banner-CVkfBUT3.js → error-banner-5bz0L9hS.js} +3 -3
  100. package/dist/{esm-CWp0KQeK.js → esm-BfhQmZjp.js} +4 -4
  101. package/dist/{esm-DjNnlmpf.js → esm-Duie8iU-.js} +23 -23
  102. package/dist/{extends-vAi97cpa.js → extends-BgdxCfYu.js} +6 -6
  103. package/dist/{flatten-CzBvFdvC.js → flatten-Bbw7g6-K.js} +1 -1
  104. package/dist/{flowDiagram-NV44I4VS-DQmWlo7f.js → flowDiagram-NV44I4VS-CRoXKjGq.js} +10 -10
  105. package/dist/{formats-Dsy9kkZu.js → formats-BiH6HX1V.js} +4 -4
  106. package/dist/{ganttDiagram-JELNMOA3-BOGXJ8Lk.js → ganttDiagram-JELNMOA3-7mq5f9cO.js} +7 -7
  107. package/dist/{gitGraph-G5XIXVHT-DGlbae5m.js → gitGraph-G5XIXVHT-DiniR35k.js} +3 -3
  108. package/dist/{gitGraphDiagram-V2S2FVAM-DjzxfF0P.js → gitGraphDiagram-V2S2FVAM-Dfuokq6w.js} +13 -13
  109. package/dist/{glide-data-editor-DucgdjRo.js → glide-data-editor-Ck-MRdns.js} +557 -557
  110. package/dist/{graphlib-CVPKjKCS.js → graphlib-Ns7y5crs.js} +5 -5
  111. package/dist/{hasIn-COs6vImh.js → hasIn-Deg7jl_j.js} +3 -3
  112. package/dist/{html-to-image-CpggM7u1.js → html-to-image-CTU_-PnW.js} +109 -109
  113. package/dist/{info-VBDWY6EO-D2lvLLw5.js → info-VBDWY6EO-DVZvGhkQ.js} +3 -3
  114. package/dist/{infoDiagram-HS3SLOUP-ChNufFsP.js → infoDiagram-HS3SLOUP-CEnzWruK.js} +13 -13
  115. package/dist/{input-D4kjoQUB.js → input-BwcGY_X1.js} +70 -67
  116. package/dist/{isEmpty-Dd8mx_WL.js → isEmpty-CJJMn-QP.js} +1 -1
  117. package/dist/{isSymbol-BvIfMnn6.js → isSymbol-CoUCgMCM.js} +1 -1
  118. package/dist/{journeyDiagram-XKPGCS4Q-BO_O4Ij1.js → journeyDiagram-XKPGCS4Q-8XYSU1GI.js} +3 -3
  119. package/dist/{kanban-definition-3W4ZIXB7-CPpiiiWk.js → kanban-definition-3W4ZIXB7--9pT9z1R.js} +7 -7
  120. package/dist/{label-BLqV33b1.js → label-LWtdw5i8.js} +3 -3
  121. package/dist/{linear-2NnK4cxi.js → linear-B5-AFRiR.js} +2 -2
  122. package/dist/{loader-Dr8Qem8p.js → loader-BWLPpjKK.js} +2 -2
  123. package/dist/main.js +1688 -1569
  124. package/dist/{memoize-C9ltv0Cw.js → memoize-BOtf2yFf.js} +1 -1
  125. package/dist/{merge-CHn7Yx0N.js → merge-Be1CqGnU.js} +1 -1
  126. package/dist/mermaid-4DMBBIKO-DIdL224_.js +6 -0
  127. package/dist/{mermaid-DO-Daq7u.js → mermaid-YK4c8MNC.js} +44 -44
  128. package/dist/{mermaid-parser.core-DreccfmS.js → mermaid-parser.core-C3XRsazI.js} +8 -8
  129. package/dist/{min-BNz2lZfk.js → min-Dtgc8txR.js} +4 -4
  130. package/dist/{mindmap-definition-VGOIOE7T-CC1_Vl0f.js → mindmap-definition-VGOIOE7T-B-4mnfFG.js} +9 -9
  131. package/dist/{now-Sgq5m3D-.js → now-Ch98bJO_.js} +2 -2
  132. package/dist/{number-overlay-editor-CpKi64Fy.js → number-overlay-editor-D-a0qCT8.js} +1 -1
  133. package/dist/{once-rJImu7SE.js → once-DPuqGUeo.js} +1 -1
  134. package/dist/{packet-DYOGHKS2-CmWtF3uO.js → packet-DYOGHKS2-34raHOiB.js} +3 -3
  135. package/dist/{pick-CRAXxDYn.js → pick-D1Qo8s2C.js} +4 -4
  136. package/dist/{pie-VRWISCQL-B6u8vus8.js → pie-VRWISCQL-BaLlzZa3.js} +3 -3
  137. package/dist/{pieDiagram-ADFJNKIX-Di34MOFQ.js → pieDiagram-ADFJNKIX-Cr3cNpZY.js} +15 -15
  138. package/dist/{precisionRound-CnHPY_5v.js → precisionRound-Tqb4mg-H.js} +1 -1
  139. package/dist/{process-output-X8TR20AK.js → process-output-CVDHJqo6.js} +36 -28
  140. package/dist/{quadrantDiagram-AYHSOK5B-B9kVk1ny.js → quadrantDiagram-AYHSOK5B-BuNL8Q93.js} +4 -4
  141. package/dist/{radar-ZZBFDIW7-XAmXSa8s.js → radar-ZZBFDIW7-Ci7bfoZa.js} +3 -3
  142. package/dist/{react-vega-Dh6-UKKe.js → react-vega-B0sAlDTL.js} +9 -9
  143. package/dist/react-vega-B6ncY2Tp.js +9 -0
  144. package/dist/{requirementDiagram-UZGBJVZJ-BxGfGYEx.js → requirementDiagram-UZGBJVZJ-BG2lLUN1.js} +9 -9
  145. package/dist/{reveal-component-Cj2fUG1Q.js → reveal-component-Dskn4JVk.js} +31 -31
  146. package/dist/{sankeyDiagram-TZEHDZUN-D09PBJ-n.js → sankeyDiagram-TZEHDZUN-DMal8sps.js} +3 -3
  147. package/dist/{sequenceDiagram-WL72ISMW-t_Dpemj0.js → sequenceDiagram-WL72ISMW-DT6Tk-Eo.js} +4 -4
  148. package/dist/{spec-hVaaZsY5.js → spec-CyLiCjSf.js} +4 -4
  149. package/dist/{stateDiagram-FKZM4ZOC-B18gTP_j.js → stateDiagram-FKZM4ZOC-CB_lodq3.js} +12 -12
  150. package/dist/{stateDiagram-v2-4FDKWEC3-B6e_t14A.js → stateDiagram-v2-4FDKWEC3-E0RGjKsm.js} +10 -10
  151. package/dist/stex-KfRnSHzF.js +4 -0
  152. package/dist/{strings-BiIhGaI8.js → strings-Bu3vlb6W.js} +7 -7
  153. package/dist/style.css +1 -1
  154. package/dist/{swiper-component-DlD2GU2g.js → swiper-component-B2t5sN1q.js} +3 -3
  155. package/dist/{time-C1SGcFMH.js → time-CsmIF9YZ.js} +3 -3
  156. package/dist/{timeline-definition-IT6M3QCI-DJnh1ks5.js → timeline-definition-IT6M3QCI-NfSKRvH0.js} +2 -2
  157. package/dist/{toDate-CIpC_34u.js → toDate-DNWCUEQp.js} +5 -5
  158. package/dist/{tooltip-DRaMBu06.js → tooltip-C5FYOpQc.js} +4 -4
  159. package/dist/{treemap-GDKQZRPO-Du95DV6u.js → treemap-GDKQZRPO-Cl6OQh8D.js} +3 -3
  160. package/dist/{types-Dzuoc3LN.js → types-CVvp1fKr.js} +2 -9
  161. package/dist/{useAsyncData-C56Khv_R.js → useAsyncData-xWFWzCee.js} +2 -2
  162. package/dist/{useDateFormatter-B_9k85Ex.js → useDateFormatter-BA4FCquG.js} +2 -2
  163. package/dist/{useDeepCompareMemoize-Dt98v2ua.js → useDeepCompareMemoize-DSChED4g.js} +1 -1
  164. package/dist/{useIframeCapabilities-BkYHTrss.js → useIframeCapabilities-C4JTXTIh.js} +1 -1
  165. package/dist/{useLifecycle-BF6-z62y.js → useLifecycle-B81PFEja.js} +4 -4
  166. package/dist/{useTheme-DykuNHR2.js → useTheme-EmVyK9N9.js} +23 -21
  167. package/dist/{vega-component-cSdqoAxe.js → vega-component-BCunE3-9.js} +18 -18
  168. package/dist/{vega-loader.browser-3_z8GoFC.js → vega-loader.browser-CZ-J8Py3.js} +3 -3
  169. package/dist/{xychartDiagram-PRI3JC2R-Dk2d_bX0.js → xychartDiagram-PRI3JC2R-BvwftqMA.js} +9 -9
  170. package/dist/{zod-BWkcDORu.js → zod-CoBiJ5v4.js} +3 -3
  171. package/package.json +1 -1
  172. package/src/components/app-config/user-config-form.tsx +36 -0
  173. package/src/components/chat/__tests__/chat-utils.test.ts +269 -0
  174. package/src/components/chat/chat-utils.ts +14 -58
  175. package/src/components/data-table/TableBottomBar.tsx +27 -6
  176. package/src/components/data-table/TableTopBar.tsx +7 -1
  177. package/src/components/data-table/__tests__/TableBottomBar.test.tsx +73 -0
  178. package/src/components/data-table/__tests__/column-explorer.test.tsx +128 -0
  179. package/src/components/data-table/__tests__/column-header.test.tsx +110 -277
  180. package/src/components/data-table/__tests__/data-table.test.tsx +52 -1
  181. package/src/components/data-table/__tests__/date-filter-inputs.test.tsx +33 -0
  182. package/src/components/data-table/__tests__/filter-pill-editor.test.tsx +75 -38
  183. package/src/components/data-table/__tests__/filter-pills.test.tsx +287 -0
  184. package/src/components/data-table/__tests__/filter-test-utils.ts +47 -0
  185. package/src/components/data-table/__tests__/filters.test.ts +5 -5
  186. package/src/components/data-table/__tests__/header-items.test.tsx +47 -1
  187. package/src/components/data-table/__tests__/useColumnVisibility.test.ts +42 -0
  188. package/src/components/data-table/add-filter-button.tsx +85 -0
  189. package/src/components/data-table/column-explorer-panel/column-explorer.tsx +98 -26
  190. package/src/components/data-table/column-header.tsx +94 -691
  191. package/src/components/data-table/columns.tsx +3 -4
  192. package/src/components/data-table/context-menu.tsx +26 -12
  193. package/src/components/data-table/data-table.tsx +125 -56
  194. package/src/components/data-table/date-filter-inputs.tsx +13 -10
  195. package/src/components/data-table/export-actions.tsx +17 -6
  196. package/src/components/data-table/filter-by-values-picker.tsx +13 -19
  197. package/src/components/data-table/filter-editor-context.tsx +34 -0
  198. package/src/components/data-table/filter-pill-editor.tsx +152 -175
  199. package/src/components/data-table/filter-pills.tsx +190 -153
  200. package/src/components/data-table/filters/builders.ts +102 -0
  201. package/src/components/data-table/filters/defaults.ts +31 -0
  202. package/src/components/data-table/filters/format.ts +131 -0
  203. package/src/components/data-table/filters/guards.ts +51 -0
  204. package/src/components/data-table/filters/index.ts +7 -0
  205. package/src/components/data-table/filters/operators.ts +76 -0
  206. package/src/components/data-table/filters/serialize.ts +186 -0
  207. package/src/components/data-table/filters/types.ts +33 -0
  208. package/src/components/data-table/header-items.tsx +25 -85
  209. package/src/components/data-table/hooks/use-column-visibility.ts +56 -0
  210. package/src/components/data-table/pagination.tsx +16 -3
  211. package/src/components/data-table/table-explorer-panel/table-explorer-panel.tsx +16 -6
  212. package/src/components/data-table/value-chips.tsx +52 -0
  213. package/src/components/dependency-graph/minimap-content.tsx +2 -2
  214. package/src/components/editor/errors/mangled-local-chip.tsx +50 -0
  215. package/src/components/editor/output/MarimoErrorOutput.tsx +110 -27
  216. package/src/components/editor/output/MarimoTracebackOutput.tsx +51 -34
  217. package/src/components/ui/number-field.tsx +13 -1
  218. package/src/core/cells/__tests__/actions.test.ts +48 -0
  219. package/src/core/cells/actions.ts +5 -6
  220. package/src/core/codemirror/__tests__/setup.test.ts +29 -0
  221. package/src/core/codemirror/cells/traceback-decorations.ts +1 -1
  222. package/src/core/codemirror/cm.ts +3 -2
  223. package/src/core/config/__tests__/config-schema.test.ts +2 -0
  224. package/src/core/config/config-schema.ts +1 -0
  225. package/src/css/app/Cell.css +0 -1
  226. package/src/plugins/impl/DataTablePlugin.tsx +94 -33
  227. package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +1 -0
  228. package/src/plugins/impl/chat/ChatPlugin.tsx +7 -1
  229. package/src/plugins/impl/chat/__tests__/chat-ui.test.ts +278 -0
  230. package/src/plugins/impl/chat/chat-ui.tsx +106 -59
  231. package/src/plugins/impl/chat/types.ts +5 -0
  232. package/src/plugins/impl/data-frames/DataFramePlugin.tsx +8 -6
  233. package/src/stories/dataframe.stories.tsx +1 -0
  234. package/src/utils/__tests__/local-variables.test.ts +132 -0
  235. package/src/utils/dates.ts +39 -0
  236. package/src/utils/local-variables.ts +67 -0
  237. package/dist/ErrorBoundary-D3wrPNma.js +0 -167
  238. package/dist/architecture-7HQA4BMR-CS9jOrqM.js +0 -6
  239. package/dist/assets/__vite-browser-external-CAdMKBac.js +0 -1
  240. package/dist/dist-21ButRCu.js +0 -8
  241. package/dist/dist-B--tLnAP.js +0 -5
  242. package/dist/dist-BoHGySTM.js +0 -5
  243. package/dist/dist-ByAz19Qc.js +0 -5
  244. package/dist/dist-C1Ap5CYU.js +0 -5
  245. package/dist/dist-C93EysN4.js +0 -5
  246. package/dist/dist-CY-lVor6.js +0 -8
  247. package/dist/dist-CYDuv4bR.js +0 -8
  248. package/dist/dist-Cfo5EE2t.js +0 -6
  249. package/dist/dist-CjivSDvN.js +0 -5
  250. package/dist/dist-Cqwx-MH7.js +0 -5
  251. package/dist/dist-DbpcoFAV.js +0 -6
  252. package/dist/dist-FUNenbiQ.js +0 -5
  253. package/dist/dist-zhSud5X3.js +0 -8
  254. package/dist/mermaid-4DMBBIKO-B7VQMwJx.js +0 -6
  255. package/dist/react-vega-Cavbrg4l.js +0 -9
  256. package/dist/stex-ChDHQs3R.js +0 -4
  257. package/src/components/data-table/__tests__/column-header.test.ts +0 -65
  258. package/src/components/data-table/filters.ts +0 -386
  259. /package/dist/{_baseFor-BGiY-cm1.js → _baseFor-4jw-lnCC.js} +0 -0
  260. /package/dist/{clsx-CyyyQ8Ue.js → clsx-CIWA5tNO.js} +0 -0
  261. /package/dist/{defaultLocale-DoeErsX2.js → defaultLocale-BoHTsDG6.js} +0 -0
  262. /package/dist/{defaultLocale-BpsHxBd7.js → defaultLocale-u-3osm0P.js} +0 -0
  263. /package/dist/{dist-CCADb07R.js → dist-DNdhYsgW.js} +0 -0
  264. /package/dist/{emotion-is-prop-valid.esm-DtW2o230.js → emotion-is-prop-valid.esm-DzSb5hsH.js} +0 -0
  265. /package/dist/{invariant-UcGKQEhF.js → invariant-wRzNXIsJ.js} +0 -0
  266. /package/dist/{jsx-runtime-COBk7ree.js → jsx-runtime-DebpN0FN.js} +0 -0
  267. /package/dist/{main-CThhXnXU.js → main-Tj_-QTyF.js} +0 -0
  268. /package/dist/{micromark-factory-space-CwHmg6iz.js → micromark-factory-space-DF2w36zS.js} +0 -0
  269. /package/dist/{ordinal-B43ZeR68.js → ordinal-ArJavP1Q.js} +0 -0
  270. /package/dist/{purify.es-DT70lfR0.js → purify.es-H92eMd9-.js} +0 -0
  271. /package/dist/{range-BOiA8qqU.js → range-C-rmrM1O.js} +0 -0
  272. /package/dist/{react-dom-BWRJ_g_k.js → react-dom-BTJzcVJ9.js} +0 -0
  273. /package/dist/{stex-DrxP7bb3.js → stex-BIsgBmK4.js} +0 -0
@@ -0,0 +1,269 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import type { UIMessage } from "ai";
4
+ import { describe, expect, it } from "vitest";
5
+ import { hasPendingToolCalls } from "../chat-utils";
6
+
7
+ /**
8
+ * `hasPendingToolCalls` powers `sendAutomaticallyWhen` in `mo.ui.chat`:
9
+ * returns true only when the last assistant message *ends* with a tool
10
+ * call in a ready-to-round-trip state. Any trailing non-tool part (text,
11
+ * file, source-*, reasoning, data-*, new step-start) means the assistant
12
+ * has already answered and we leave the next turn to the user. The
13
+ * approval flow relies on this firing for `approval-responded`.
14
+ */
15
+
16
+ const userMessage = (text: string): UIMessage => ({
17
+ id: `user-${text}`,
18
+ role: "user",
19
+ parts: [{ type: "text", text }],
20
+ });
21
+
22
+ const assistantToolMessage = (
23
+ parts: UIMessage["parts"],
24
+ id = "assistant-1",
25
+ ): UIMessage => ({
26
+ id,
27
+ role: "assistant",
28
+ parts,
29
+ });
30
+
31
+ describe("hasPendingToolCalls", () => {
32
+ it("returns false when there are no messages", () => {
33
+ expect(hasPendingToolCalls([])).toBe(false);
34
+ });
35
+
36
+ it("returns false when the last message is a user message", () => {
37
+ expect(hasPendingToolCalls([userMessage("hi")])).toBe(false);
38
+ });
39
+
40
+ it("returns false when the last assistant message has no tool parts", () => {
41
+ expect(
42
+ hasPendingToolCalls([
43
+ userMessage("hi"),
44
+ assistantToolMessage([{ type: "text", text: "hello!" }]),
45
+ ]),
46
+ ).toBe(false);
47
+ });
48
+
49
+ it("returns false while a tool is still streaming or awaiting approval", () => {
50
+ expect(
51
+ hasPendingToolCalls([
52
+ userMessage("delete it"),
53
+ assistantToolMessage([
54
+ {
55
+ type: "tool-delete_file",
56
+ toolCallId: "call-1",
57
+ state: "approval-requested",
58
+ input: { path: "secrets.env" },
59
+ approval: { id: "approval-1" },
60
+ } as unknown as UIMessage["parts"][number],
61
+ ]),
62
+ ]),
63
+ ).toBe(false);
64
+ });
65
+
66
+ it("returns true when the user has responded to an approval request", () => {
67
+ // The chat must auto-resume as soon as Approve/Deny is clicked.
68
+ expect(
69
+ hasPendingToolCalls([
70
+ userMessage("delete it"),
71
+ assistantToolMessage([
72
+ {
73
+ type: "tool-delete_file",
74
+ toolCallId: "call-1",
75
+ state: "approval-responded",
76
+ input: { path: "secrets.env" },
77
+ approval: { id: "approval-1", approved: true },
78
+ } as unknown as UIMessage["parts"][number],
79
+ ]),
80
+ ]),
81
+ ).toBe(true);
82
+ });
83
+
84
+ it("returns true when a tool reached a terminal output state", () => {
85
+ expect(
86
+ hasPendingToolCalls([
87
+ userMessage("run it"),
88
+ assistantToolMessage([
89
+ {
90
+ type: "tool-run_query",
91
+ toolCallId: "call-1",
92
+ state: "output-available",
93
+ input: { sql: "select 1" },
94
+ output: 1,
95
+ } as unknown as UIMessage["parts"][number],
96
+ ]),
97
+ ]),
98
+ ).toBe(true);
99
+ });
100
+
101
+ it("returns false when only some tool calls are ready", () => {
102
+ expect(
103
+ hasPendingToolCalls([
104
+ userMessage("two things"),
105
+ assistantToolMessage([
106
+ {
107
+ type: "tool-first",
108
+ toolCallId: "call-1",
109
+ state: "output-available",
110
+ input: {},
111
+ output: 1,
112
+ } as unknown as UIMessage["parts"][number],
113
+ {
114
+ type: "tool-second",
115
+ toolCallId: "call-2",
116
+ state: "input-available",
117
+ input: {},
118
+ } as unknown as UIMessage["parts"][number],
119
+ ]),
120
+ ]),
121
+ ).toBe(false);
122
+ });
123
+
124
+ it("returns false once the assistant has appended text after the tool result", () => {
125
+ expect(
126
+ hasPendingToolCalls([
127
+ userMessage("run it"),
128
+ assistantToolMessage([
129
+ {
130
+ type: "tool-run_query",
131
+ toolCallId: "call-1",
132
+ state: "output-available",
133
+ input: {},
134
+ output: 1,
135
+ } as unknown as UIMessage["parts"][number],
136
+ { type: "text", text: "The query returned 1." },
137
+ ]),
138
+ ]),
139
+ ).toBe(false);
140
+ });
141
+
142
+ it("returns false when a file part trails the completed tool call", () => {
143
+ // Regression: tool → text → file used to loop because only trailing
144
+ // text counted as "the assistant has answered".
145
+ expect(
146
+ hasPendingToolCalls([
147
+ userMessage("show me Starry Night"),
148
+ assistantToolMessage([
149
+ { type: "step-start" },
150
+ {
151
+ type: "tool-search_artwork",
152
+ toolCallId: "call-1",
153
+ state: "output-available",
154
+ input: { artist: "Van Gogh" },
155
+ output: { title: "The Starry Night" },
156
+ } as unknown as UIMessage["parts"][number],
157
+ { type: "text", text: "Here is the painting:" },
158
+ {
159
+ type: "file",
160
+ mediaType: "image/jpeg",
161
+ url: "https://example.com/starry-night.jpg",
162
+ } as unknown as UIMessage["parts"][number],
163
+ ]),
164
+ ]),
165
+ ).toBe(false);
166
+ });
167
+
168
+ it("returns false when a source-url part trails the completed tool call", () => {
169
+ expect(
170
+ hasPendingToolCalls([
171
+ userMessage("cite your sources"),
172
+ assistantToolMessage([
173
+ {
174
+ type: "tool-web_search",
175
+ toolCallId: "call-1",
176
+ state: "output-available",
177
+ input: { q: "marimo notebook" },
178
+ output: "found",
179
+ } as unknown as UIMessage["parts"][number],
180
+ { type: "text", text: "marimo is a reactive notebook." },
181
+ {
182
+ type: "source-url",
183
+ sourceId: "src-1",
184
+ url: "https://marimo.io",
185
+ } as unknown as UIMessage["parts"][number],
186
+ ]),
187
+ ]),
188
+ ).toBe(false);
189
+ });
190
+
191
+ it("returns false when a reasoning part trails the completed tool call", () => {
192
+ expect(
193
+ hasPendingToolCalls([
194
+ userMessage("explain"),
195
+ assistantToolMessage([
196
+ {
197
+ type: "tool-lookup",
198
+ toolCallId: "call-1",
199
+ state: "output-available",
200
+ input: {},
201
+ output: 1,
202
+ } as unknown as UIMessage["parts"][number],
203
+ {
204
+ type: "reasoning",
205
+ text: "Now I'll summarize.",
206
+ } as unknown as UIMessage["parts"][number],
207
+ ]),
208
+ ]),
209
+ ).toBe(false);
210
+ });
211
+
212
+ it("returns false when a new step-start follows the completed tool call", () => {
213
+ expect(
214
+ hasPendingToolCalls([
215
+ userMessage("multi-step"),
216
+ assistantToolMessage([
217
+ { type: "step-start" },
218
+ {
219
+ type: "tool-run_query",
220
+ toolCallId: "call-1",
221
+ state: "output-available",
222
+ input: {},
223
+ output: 1,
224
+ } as unknown as UIMessage["parts"][number],
225
+ { type: "step-start" },
226
+ ]),
227
+ ]),
228
+ ).toBe(false);
229
+ });
230
+
231
+ it("ignores providerExecuted tools", () => {
232
+ // Provider-side tools are resolved by the model, not the runtime, so
233
+ // they must not drive an auto-resume.
234
+ expect(
235
+ hasPendingToolCalls([
236
+ userMessage("hi"),
237
+ assistantToolMessage([
238
+ {
239
+ type: "tool-web_search",
240
+ toolCallId: "call-1",
241
+ state: "output-available",
242
+ input: {},
243
+ output: 1,
244
+ providerExecuted: true,
245
+ } as unknown as UIMessage["parts"][number],
246
+ ]),
247
+ ]),
248
+ ).toBe(false);
249
+ });
250
+
251
+ it("returns true for dynamic-tool parts in a terminal state", () => {
252
+ // `dynamic-tool` parts must drive auto-resume alongside `tool-*`.
253
+ expect(
254
+ hasPendingToolCalls([
255
+ userMessage("run it"),
256
+ assistantToolMessage([
257
+ {
258
+ type: "dynamic-tool",
259
+ toolName: "run_query",
260
+ toolCallId: "call-1",
261
+ state: "output-available",
262
+ input: {},
263
+ output: 1,
264
+ } as unknown as UIMessage["parts"][number],
265
+ ]),
266
+ ]),
267
+ ).toBe(true);
268
+ });
269
+ });
@@ -5,7 +5,8 @@ import {
5
5
  type ChatAddToolOutputFunction,
6
6
  type FileUIPart,
7
7
  isToolUIPart,
8
- type ToolUIPart,
8
+ lastAssistantMessageIsCompleteWithApprovalResponses,
9
+ lastAssistantMessageIsCompleteWithToolCalls,
9
10
  type UIMessage,
10
11
  } from "ai";
11
12
  import { useState } from "react";
@@ -17,7 +18,6 @@ import type {
17
18
  InvokeAiToolRequest,
18
19
  InvokeAiToolResponse,
19
20
  } from "@/core/network/types";
20
- import { logNever } from "@/utils/assertNever";
21
21
  import { blobToString } from "@/utils/fileToBase64";
22
22
  import { Logger } from "@/utils/Logger";
23
23
  import { getAICompletionBodyWithAttachments } from "../editor/ai/completion-utils";
@@ -169,69 +169,25 @@ export async function handleToolCall({
169
169
  }
170
170
 
171
171
  /**
172
- * Returns true if a tool call is "ready to be sent back to the server" — i.e.
173
- * either it has reached a terminal output state, or the user has just supplied
174
- * an approval response that the server hasn't seen yet.
175
- */
176
- function isToolCallReadyToSend(state: ToolUIPart["state"]): boolean {
177
- switch (state) {
178
- case "output-available":
179
- case "output-error":
180
- case "output-denied":
181
- case "approval-responded":
182
- return true;
183
- case "input-streaming":
184
- case "input-available":
185
- case "approval-requested":
186
- return false;
187
- default:
188
- logNever(state);
189
- return false;
190
- }
191
- }
192
-
193
- /**
194
- * Checks if we should send a message automatically based on the messages.
195
- * We auto-send when every tool call on the last assistant message has either
196
- * finished (output-available/error/denied) or has just received a user
197
- * approval response, and the assistant hasn't replied yet.
172
+ * Auto-send the next turn when the last assistant message ends with a
173
+ * tool call ready to round-trip. Any non-tool trailing part (text, file,
174
+ * source-*, reasoning, data-*, new step-start) means the assistant has
175
+ * already answered, so we leave the next turn to the user. State checks
176
+ * are delegated to the SDK to stay in sync with upstream.
198
177
  */
199
178
  export function hasPendingToolCalls(messages: UIMessage[]): boolean {
200
- if (messages.length === 0) {
201
- return false;
202
- }
203
-
204
- const lastMessage = messages[messages.length - 1];
205
- const parts = lastMessage.parts;
206
-
207
- if (parts.length === 0) {
208
- return false;
209
- }
210
-
211
- // Only auto-send if the last message is an assistant message
212
- // Because assistant messages are the ones that can have tool calls
213
- if (lastMessage.role !== "assistant") {
179
+ const lastMessage = messages.at(-1);
180
+ if (!lastMessage || lastMessage.role !== "assistant") {
214
181
  return false;
215
182
  }
216
-
217
- const toolParts = parts.filter(isToolUIPart);
218
-
219
- if (toolParts.length === 0) {
183
+ const lastPart = lastMessage.parts.at(-1);
184
+ if (!lastPart || !isToolUIPart(lastPart)) {
220
185
  return false;
221
186
  }
222
-
223
- const allToolCallsReady = toolParts.every((part) =>
224
- isToolCallReadyToSend(part.state),
187
+ return (
188
+ lastAssistantMessageIsCompleteWithToolCalls({ messages }) ||
189
+ lastAssistantMessageIsCompleteWithApprovalResponses({ messages })
225
190
  );
226
-
227
- // Check if the last part has any text content
228
- const lastPart = parts[parts.length - 1];
229
- const hasTextContent =
230
- lastPart.type === "text" && lastPart.text?.trim().length > 0;
231
-
232
- Logger.debug("All tool calls ready to send: %s", allToolCallsReady);
233
-
234
- return allToolCallsReady && !hasTextContent;
235
191
  }
236
192
 
237
193
  export function useFileState() {
@@ -7,8 +7,13 @@ import type { GetRowIds } from "@/plugins/impl/DataTablePlugin";
7
7
  import { cn } from "@/utils/cn";
8
8
  import { Events } from "@/utils/events";
9
9
  import { prettyNumber } from "@/utils/numbers";
10
+ import {
11
+ PANEL_TYPES,
12
+ type PanelType,
13
+ } from "../editor/chrome/panels/context-aware-panel/context-aware-panel";
10
14
  import { Button } from "../ui/button";
11
15
  import { toast } from "../ui/use-toast";
16
+ import { getColumnCountForDisplay } from "./hooks/use-column-visibility";
12
17
  import { DataTablePagination, prettifyRowColumnCount } from "./pagination";
13
18
  import { CellSelectionStats } from "./range-focus/cell-selection-stats";
14
19
  import type { DataTableSelection } from "./types";
@@ -22,6 +27,7 @@ interface TableBottomBarProps<TData> {
22
27
  getRowIds?: GetRowIds;
23
28
  showPageSizeSelector?: boolean;
24
29
  tableLoading?: boolean;
30
+ togglePanel?: (panelType: PanelType) => void;
25
31
  part?: string;
26
32
  className?: string;
27
33
  }
@@ -35,6 +41,7 @@ export const TableBottomBar = <TData,>({
35
41
  getRowIds,
36
42
  showPageSizeSelector,
37
43
  tableLoading,
44
+ togglePanel,
38
45
  part,
39
46
  className,
40
47
  }: TableBottomBarProps<TData>) => {
@@ -140,13 +147,27 @@ export const TableBottomBar = <TData,>({
140
147
  );
141
148
  }
142
149
 
150
+ const { totalColumns: effectiveTotalColumns, hiddenColumns } =
151
+ getColumnCountForDisplay(table, totalColumns);
152
+ const { rowsAndColumns, hiddenSuffix } = prettifyRowColumnCount({
153
+ numRows: table.getRowCount(),
154
+ totalColumns: effectiveTotalColumns,
155
+ hiddenColumns,
156
+ locale,
157
+ });
158
+
143
159
  return (
144
- <span>
145
- {prettifyRowColumnCount({
146
- numRows: table.getRowCount(),
147
- totalColumns,
148
- locale,
149
- })}
160
+ <span className="flex items-center gap-1">
161
+ <span>{rowsAndColumns}</span>
162
+ {hiddenSuffix && (
163
+ <button
164
+ type="button"
165
+ className="text-xs underline-offset-2 hover:underline cursor-pointer"
166
+ onClick={() => togglePanel?.(PANEL_TYPES.COLUMN_EXPLORER)}
167
+ >
168
+ {hiddenSuffix}
169
+ </button>
170
+ )}
150
171
  </span>
151
172
  );
152
173
  };
@@ -35,6 +35,7 @@ interface TableTopBarProps extends Partial<ExportActionProps> {
35
35
  togglePanel?: (panelType: PanelType) => void;
36
36
  isAnyPanelOpen?: boolean;
37
37
  sizeBytes?: number | null;
38
+ sizeBytesIsLoading?: boolean;
38
39
  }
39
40
 
40
41
  export const TableTopBar: React.FC<TableTopBarProps> = ({
@@ -50,6 +51,7 @@ export const TableTopBar: React.FC<TableTopBarProps> = ({
50
51
  isAnyPanelOpen,
51
52
  downloadAs,
52
53
  sizeBytes,
54
+ sizeBytesIsLoading,
53
55
  }) => {
54
56
  const [internalValue, setInternalValue] = useState(searchQuery || "");
55
57
  const debouncedSearch = useDebounce(internalValue, 500);
@@ -133,7 +135,11 @@ export const TableTopBar: React.FC<TableTopBarProps> = ({
133
135
  </Button>
134
136
  )}
135
137
  {downloadAs && (
136
- <ExportMenu downloadAs={downloadAs} sizeBytes={sizeBytes} />
138
+ <ExportMenu
139
+ downloadAs={downloadAs}
140
+ sizeBytes={sizeBytes}
141
+ sizeBytesIsLoading={sizeBytesIsLoading}
142
+ />
137
143
  )}
138
144
  </div>
139
145
  </div>
@@ -0,0 +1,73 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+ "use no memo";
3
+
4
+ import { getCoreRowModel, useReactTable } from "@tanstack/react-table";
5
+ import { render, screen } from "@testing-library/react";
6
+ import { describe, expect, it, vi } from "vitest";
7
+ import { TooltipProvider } from "@/components/ui/tooltip";
8
+ import { CellSelectionProvider } from "../range-focus/provider";
9
+ import { TableBottomBar } from "../TableBottomBar";
10
+
11
+ function renderWithTable(opts: {
12
+ totalColumns: number;
13
+ hiddenColumns?: string[];
14
+ togglePanel?: (panelType: string) => void;
15
+ }) {
16
+ const Wrapper = () => {
17
+ const table = useReactTable({
18
+ data: [] as Array<Record<string, unknown>>,
19
+ columns: Array.from({ length: opts.totalColumns }, (_, i) => ({
20
+ id: `col${i}`,
21
+ enableHiding: true,
22
+ })),
23
+ getCoreRowModel: getCoreRowModel(),
24
+ locale: "en-US",
25
+ state: {
26
+ columnVisibility: Object.fromEntries(
27
+ (opts.hiddenColumns ?? []).map((c) => [c, false]),
28
+ ),
29
+ },
30
+ });
31
+
32
+ return (
33
+ <TableBottomBar
34
+ pagination={false}
35
+ totalColumns={opts.totalColumns}
36
+ table={table}
37
+ togglePanel={opts.togglePanel}
38
+ />
39
+ );
40
+ };
41
+
42
+ return render(
43
+ <TooltipProvider>
44
+ <CellSelectionProvider>
45
+ <Wrapper />
46
+ </CellSelectionProvider>
47
+ </TooltipProvider>,
48
+ );
49
+ }
50
+
51
+ describe("TableBottomBar — hidden column count", () => {
52
+ it("does not render '(n hidden)' when no columns are hidden", () => {
53
+ renderWithTable({ totalColumns: 3 });
54
+ expect(screen.queryByText(/hidden/)).toBeNull();
55
+ });
56
+
57
+ it("renders 'X visible (n hidden)' when columns are hidden", () => {
58
+ renderWithTable({ totalColumns: 3, hiddenColumns: ["col1"] });
59
+ expect(screen.getByText(/2 visible/)).toBeInTheDocument();
60
+ expect(screen.getByText(/\(1 hidden\)/)).toBeInTheDocument();
61
+ });
62
+
63
+ it("invokes togglePanel('column-explorer') when '(n hidden)' is clicked", () => {
64
+ const togglePanel = vi.fn();
65
+ renderWithTable({
66
+ totalColumns: 3,
67
+ hiddenColumns: ["col1"],
68
+ togglePanel,
69
+ });
70
+ screen.getByText(/\(1 hidden\)/).click();
71
+ expect(togglePanel).toHaveBeenCalledWith("column-explorer");
72
+ });
73
+ });
@@ -0,0 +1,128 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import {
4
+ type ColumnDef,
5
+ getCoreRowModel,
6
+ useReactTable,
7
+ } from "@tanstack/react-table";
8
+ import { fireEvent, render, screen } from "@testing-library/react";
9
+ import { beforeAll, describe, expect, it, vi } from "vitest";
10
+ import { TooltipProvider } from "@/components/ui/tooltip";
11
+ import { ColumnExplorerPanel } from "../column-explorer-panel/column-explorer";
12
+ import type { FieldTypesWithExternalType } from "../types";
13
+
14
+ beforeAll(() => {
15
+ global.HTMLElement.prototype.scrollIntoView = () => {};
16
+ if (!global.HTMLElement.prototype.hasPointerCapture) {
17
+ global.HTMLElement.prototype.hasPointerCapture = () => false;
18
+ }
19
+ });
20
+
21
+ const FIELD_TYPES: FieldTypesWithExternalType = [
22
+ ["customer_name", ["string", "str"]],
23
+ ["cust_age", ["integer", "int"]],
24
+ ["order_total", ["number", "float"]],
25
+ ];
26
+
27
+ type Row = Record<string, unknown>;
28
+
29
+ const TEST_COLUMNS: ColumnDef<Row>[] = [
30
+ { id: "customer_name", accessorKey: "customer_name" },
31
+ { id: "cust_age", accessorKey: "cust_age" },
32
+ { id: "order_total", accessorKey: "order_total" },
33
+ ];
34
+
35
+ interface HarnessProps {
36
+ totalColumns?: number;
37
+ initiallyHidden?: string[];
38
+ }
39
+
40
+ function PanelHarness({
41
+ totalColumns = 3,
42
+ initiallyHidden = [],
43
+ }: HarnessProps) {
44
+ const table = useReactTable<Row>({
45
+ data: [],
46
+ columns: TEST_COLUMNS,
47
+ getCoreRowModel: getCoreRowModel(),
48
+ locale: "en-US",
49
+ state: {
50
+ columnVisibility: Object.fromEntries(
51
+ initiallyHidden.map((id) => [id, false]),
52
+ ),
53
+ },
54
+ });
55
+ return (
56
+ <ColumnExplorerPanel
57
+ previewColumn={vi.fn().mockResolvedValue({})}
58
+ fieldTypes={FIELD_TYPES}
59
+ totalRows={3}
60
+ totalColumns={totalColumns}
61
+ tableId="t1"
62
+ table={table}
63
+ />
64
+ );
65
+ }
66
+
67
+ function renderPanel(props?: HarnessProps) {
68
+ return render(
69
+ <TooltipProvider>
70
+ <PanelHarness {...(props ?? {})} />
71
+ </TooltipProvider>,
72
+ );
73
+ }
74
+
75
+ function getSearchInput() {
76
+ return screen.getByPlaceholderText("Search columns...");
77
+ }
78
+
79
+ describe("ColumnExplorerPanel search", () => {
80
+ it("shows all columns when search is empty", () => {
81
+ renderPanel();
82
+ expect(screen.getByText("customer_name")).toBeInTheDocument();
83
+ expect(screen.getByText("cust_age")).toBeInTheDocument();
84
+ expect(screen.getByText("order_total")).toBeInTheDocument();
85
+ });
86
+
87
+ it("matches a word prefix against any column word", () => {
88
+ renderPanel();
89
+ fireEvent.change(getSearchInput(), { target: { value: "cust" } });
90
+ expect(screen.getByText("customer_name")).toBeInTheDocument();
91
+ expect(screen.getByText("cust_age")).toBeInTheDocument();
92
+ expect(screen.queryByText("order_total")).not.toBeInTheDocument();
93
+ });
94
+
95
+ it("matches multi-word queries across column words in any order", () => {
96
+ renderPanel();
97
+ fireEvent.change(getSearchInput(), { target: { value: "name cust" } });
98
+ expect(screen.getByText("customer_name")).toBeInTheDocument();
99
+ expect(screen.queryByText("cust_age")).not.toBeInTheDocument();
100
+ expect(screen.queryByText("order_total")).not.toBeInTheDocument();
101
+ });
102
+
103
+ it("filters out columns that don't match any needle word", () => {
104
+ renderPanel();
105
+ fireEvent.change(getSearchInput(), { target: { value: "xyz" } });
106
+ expect(screen.queryByText("customer_name")).not.toBeInTheDocument();
107
+ expect(screen.queryByText("cust_age")).not.toBeInTheDocument();
108
+ expect(screen.queryByText("order_total")).not.toBeInTheDocument();
109
+ });
110
+ });
111
+
112
+ describe("ColumnExplorerPanel header counts", () => {
113
+ it("uses rendered-subset total when a clipped column is hidden", () => {
114
+ // Dataset has 100 columns server-side; only 3 are rendered into the
115
+ // TanStack table (the clipped subset). Hiding one of the rendered columns
116
+ // must report "2 visible (1 hidden)", not "99 visible (1 hidden)".
117
+ renderPanel({ totalColumns: 100, initiallyHidden: ["cust_age"] });
118
+ expect(screen.getByText(/2 visible/)).toBeInTheDocument();
119
+ expect(screen.getByText(/\(1 hidden\)/)).toBeInTheDocument();
120
+ expect(screen.queryByText(/99 visible/)).not.toBeInTheDocument();
121
+ });
122
+
123
+ it("uses dataset-wide total when no column is hidden", () => {
124
+ renderPanel({ totalColumns: 100 });
125
+ expect(screen.getByText(/100 columns/)).toBeInTheDocument();
126
+ expect(screen.queryByText(/hidden/)).not.toBeInTheDocument();
127
+ });
128
+ });