@thalavaisankar/atoms 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (769) hide show
  1. package/LICENSE +24 -0
  2. package/README.md +196 -2
  3. package/THIRD_PARTY_NOTICES.md +275 -0
  4. package/dist/blocks/index.d.mts +2 -0
  5. package/dist/blocks/index.mjs +1 -0
  6. package/dist/blocks/index.mjs.map +1 -0
  7. package/dist/components/ui/accordion/accordion.mjs +194 -0
  8. package/dist/components/ui/accordion/accordion.mjs.map +1 -0
  9. package/dist/components/ui/accordion/index.mjs +15 -0
  10. package/dist/components/ui/accordion/index.mjs.map +1 -0
  11. package/dist/components/ui/activity-feed/activity-feed.mjs +287 -0
  12. package/dist/components/ui/activity-feed/activity-feed.mjs.map +1 -0
  13. package/dist/components/ui/activity-feed/index.mjs +39 -0
  14. package/dist/components/ui/activity-feed/index.mjs.map +1 -0
  15. package/dist/components/ui/alert/alert.mjs +128 -0
  16. package/dist/components/ui/alert/alert.mjs.map +1 -0
  17. package/dist/components/ui/alert/index.mjs +17 -0
  18. package/dist/components/ui/alert/index.mjs.map +1 -0
  19. package/dist/components/ui/animated-label/animated-label.mjs +89 -0
  20. package/dist/components/ui/animated-label/animated-label.mjs.map +1 -0
  21. package/dist/components/ui/animated-label/index.mjs +9 -0
  22. package/dist/components/ui/animated-label/index.mjs.map +1 -0
  23. package/dist/components/ui/animated-number/animated-number.mjs +101 -0
  24. package/dist/components/ui/animated-number/animated-number.mjs.map +1 -0
  25. package/dist/components/ui/animated-number/index.mjs +5 -0
  26. package/dist/components/ui/animated-number/index.mjs.map +1 -0
  27. package/dist/components/ui/avatar/avatar.mjs +130 -0
  28. package/dist/components/ui/avatar/avatar.mjs.map +1 -0
  29. package/dist/components/ui/avatar/index.mjs +17 -0
  30. package/dist/components/ui/avatar/index.mjs.map +1 -0
  31. package/dist/components/ui/avatar-group/avatar-group.mjs +49 -0
  32. package/dist/components/ui/avatar-group/avatar-group.mjs.map +1 -0
  33. package/dist/components/ui/avatar-group/index.mjs +5 -0
  34. package/dist/components/ui/avatar-group/index.mjs.map +1 -0
  35. package/dist/components/ui/badge/badge-motion.mjs +108 -0
  36. package/dist/components/ui/badge/badge-motion.mjs.map +1 -0
  37. package/dist/components/ui/badge/badge.mjs +314 -0
  38. package/dist/components/ui/badge/badge.mjs.map +1 -0
  39. package/dist/components/ui/badge/index.mjs +27 -0
  40. package/dist/components/ui/badge/index.mjs.map +1 -0
  41. package/dist/components/ui/badge/readable-ink.mjs +36 -0
  42. package/dist/components/ui/badge/readable-ink.mjs.map +1 -0
  43. package/dist/components/ui/badge-group/badge-group.mjs +132 -0
  44. package/dist/components/ui/badge-group/badge-group.mjs.map +1 -0
  45. package/dist/components/ui/badge-group/index.mjs +5 -0
  46. package/dist/components/ui/badge-group/index.mjs.map +1 -0
  47. package/dist/components/ui/breadcrumb/breadcrumb.mjs +108 -0
  48. package/dist/components/ui/breadcrumb/breadcrumb.mjs.map +1 -0
  49. package/dist/components/ui/breadcrumb/index.mjs +19 -0
  50. package/dist/components/ui/breadcrumb/index.mjs.map +1 -0
  51. package/dist/components/ui/button/button-variants.mjs +80 -0
  52. package/dist/components/ui/button/button-variants.mjs.map +1 -0
  53. package/dist/components/ui/button/button.mjs +74 -0
  54. package/dist/components/ui/button/button.mjs.map +1 -0
  55. package/dist/components/ui/button/index.mjs +17 -0
  56. package/dist/components/ui/button/index.mjs.map +1 -0
  57. package/dist/components/ui/button/social-button.mjs +45 -0
  58. package/dist/components/ui/button/social-button.mjs.map +1 -0
  59. package/dist/components/ui/button/social-logos.mjs +179 -0
  60. package/dist/components/ui/button/social-logos.mjs.map +1 -0
  61. package/dist/components/ui/button/split-button.mjs +72 -0
  62. package/dist/components/ui/button/split-button.mjs.map +1 -0
  63. package/dist/components/ui/button-group/button-group.mjs +58 -0
  64. package/dist/components/ui/button-group/button-group.mjs.map +1 -0
  65. package/dist/components/ui/button-group/index.mjs +11 -0
  66. package/dist/components/ui/button-group/index.mjs.map +1 -0
  67. package/dist/components/ui/card/card.mjs +131 -0
  68. package/dist/components/ui/card/card.mjs.map +1 -0
  69. package/dist/components/ui/card/index.mjs +23 -0
  70. package/dist/components/ui/card/index.mjs.map +1 -0
  71. package/dist/components/ui/chart/bar-list.mjs +87 -0
  72. package/dist/components/ui/chart/bar-list.mjs.map +1 -0
  73. package/dist/components/ui/chart/chart-colors.mjs +68 -0
  74. package/dist/components/ui/chart/chart-colors.mjs.map +1 -0
  75. package/dist/components/ui/chart/chart-geometry.mjs +152 -0
  76. package/dist/components/ui/chart/chart-geometry.mjs.map +1 -0
  77. package/dist/components/ui/chart/chart-specialized.mjs +194 -0
  78. package/dist/components/ui/chart/chart-specialized.mjs.map +1 -0
  79. package/dist/components/ui/chart/chart.mjs +648 -0
  80. package/dist/components/ui/chart/chart.mjs.map +1 -0
  81. package/dist/components/ui/chart/index.mjs +88 -0
  82. package/dist/components/ui/chart/index.mjs.map +1 -0
  83. package/dist/components/ui/chart/radial-meter.mjs +142 -0
  84. package/dist/components/ui/chart/radial-meter.mjs.map +1 -0
  85. package/dist/components/ui/chart/types.mjs +1 -0
  86. package/dist/components/ui/chart/types.mjs.map +1 -0
  87. package/dist/components/ui/checkbox/checkbox.mjs +183 -0
  88. package/dist/components/ui/checkbox/checkbox.mjs.map +1 -0
  89. package/dist/components/ui/checkbox/index.mjs +11 -0
  90. package/dist/components/ui/checkbox/index.mjs.map +1 -0
  91. package/dist/components/ui/checklist/checklist.mjs +353 -0
  92. package/dist/components/ui/checklist/checklist.mjs.map +1 -0
  93. package/dist/components/ui/checklist/index.mjs +33 -0
  94. package/dist/components/ui/checklist/index.mjs.map +1 -0
  95. package/dist/components/ui/chip/chip.mjs +202 -0
  96. package/dist/components/ui/chip/chip.mjs.map +1 -0
  97. package/dist/components/ui/chip/index.mjs +13 -0
  98. package/dist/components/ui/chip/index.mjs.map +1 -0
  99. package/dist/components/ui/chip-group/chip-group.mjs +204 -0
  100. package/dist/components/ui/chip-group/chip-group.mjs.map +1 -0
  101. package/dist/components/ui/chip-group/index.mjs +11 -0
  102. package/dist/components/ui/chip-group/index.mjs.map +1 -0
  103. package/dist/components/ui/code-snippet/code-highlighter.mjs +16 -0
  104. package/dist/components/ui/code-snippet/code-highlighter.mjs.map +1 -0
  105. package/dist/components/ui/code-snippet/code-snippet.mjs +437 -0
  106. package/dist/components/ui/code-snippet/code-snippet.mjs.map +1 -0
  107. package/dist/components/ui/code-snippet/index.mjs +17 -0
  108. package/dist/components/ui/code-snippet/index.mjs.map +1 -0
  109. package/dist/components/ui/code-snippet/labels.mjs +16 -0
  110. package/dist/components/ui/code-snippet/labels.mjs.map +1 -0
  111. package/dist/components/ui/code-snippet/tokenize.mjs +715 -0
  112. package/dist/components/ui/code-snippet/tokenize.mjs.map +1 -0
  113. package/dist/components/ui/code-snippet/types.mjs +1 -0
  114. package/dist/components/ui/code-snippet/types.mjs.map +1 -0
  115. package/dist/components/ui/collapsible/collapsible.mjs +85 -0
  116. package/dist/components/ui/collapsible/collapsible.mjs.map +1 -0
  117. package/dist/components/ui/collapsible/index.mjs +15 -0
  118. package/dist/components/ui/collapsible/index.mjs.map +1 -0
  119. package/dist/components/ui/color-picker/color-picker.mjs +852 -0
  120. package/dist/components/ui/color-picker/color-picker.mjs.map +1 -0
  121. package/dist/components/ui/color-picker/index.mjs +47 -0
  122. package/dist/components/ui/color-picker/index.mjs.map +1 -0
  123. package/dist/components/ui/combobox/combobox.mjs +745 -0
  124. package/dist/components/ui/combobox/combobox.mjs.map +1 -0
  125. package/dist/components/ui/combobox/index.mjs +27 -0
  126. package/dist/components/ui/combobox/index.mjs.map +1 -0
  127. package/dist/components/ui/command/command.mjs +439 -0
  128. package/dist/components/ui/command/command.mjs.map +1 -0
  129. package/dist/components/ui/command/index.mjs +31 -0
  130. package/dist/components/ui/command/index.mjs.map +1 -0
  131. package/dist/components/ui/compare-slider/compare-slider.mjs +335 -0
  132. package/dist/components/ui/compare-slider/compare-slider.mjs.map +1 -0
  133. package/dist/components/ui/compare-slider/index.mjs +17 -0
  134. package/dist/components/ui/compare-slider/index.mjs.map +1 -0
  135. package/dist/components/ui/context-menu/context-menu.mjs +184 -0
  136. package/dist/components/ui/context-menu/context-menu.mjs.map +1 -0
  137. package/dist/components/ui/context-menu/index.mjs +37 -0
  138. package/dist/components/ui/context-menu/index.mjs.map +1 -0
  139. package/dist/components/ui/data-table/active-filters.mjs +69 -0
  140. package/dist/components/ui/data-table/active-filters.mjs.map +1 -0
  141. package/dist/components/ui/data-table/body-row.mjs +118 -0
  142. package/dist/components/ui/data-table/body-row.mjs.map +1 -0
  143. package/dist/components/ui/data-table/cards.mjs +76 -0
  144. package/dist/components/ui/data-table/cards.mjs.map +1 -0
  145. package/dist/components/ui/data-table/data-table.mjs +680 -0
  146. package/dist/components/ui/data-table/data-table.mjs.map +1 -0
  147. package/dist/components/ui/data-table/empty.mjs +26 -0
  148. package/dist/components/ui/data-table/empty.mjs.map +1 -0
  149. package/dist/components/ui/data-table/expand.mjs +70 -0
  150. package/dist/components/ui/data-table/expand.mjs.map +1 -0
  151. package/dist/components/ui/data-table/faceted-filter.mjs +112 -0
  152. package/dist/components/ui/data-table/faceted-filter.mjs.map +1 -0
  153. package/dist/components/ui/data-table/features.mjs +96 -0
  154. package/dist/components/ui/data-table/features.mjs.map +1 -0
  155. package/dist/components/ui/data-table/grip.mjs +37 -0
  156. package/dist/components/ui/data-table/grip.mjs.map +1 -0
  157. package/dist/components/ui/data-table/header-cell.mjs +85 -0
  158. package/dist/components/ui/data-table/header-cell.mjs.map +1 -0
  159. package/dist/components/ui/data-table/index.mjs +55 -0
  160. package/dist/components/ui/data-table/index.mjs.map +1 -0
  161. package/dist/components/ui/data-table/labels.mjs +55 -0
  162. package/dist/components/ui/data-table/labels.mjs.map +1 -0
  163. package/dist/components/ui/data-table/load-more.mjs +56 -0
  164. package/dist/components/ui/data-table/load-more.mjs.map +1 -0
  165. package/dist/components/ui/data-table/move-item.mjs +11 -0
  166. package/dist/components/ui/data-table/move-item.mjs.map +1 -0
  167. package/dist/components/ui/data-table/persist.mjs +65 -0
  168. package/dist/components/ui/data-table/persist.mjs.map +1 -0
  169. package/dist/components/ui/data-table/selection-bar.mjs +51 -0
  170. package/dist/components/ui/data-table/selection-bar.mjs.map +1 -0
  171. package/dist/components/ui/data-table/tabs.mjs +48 -0
  172. package/dist/components/ui/data-table/tabs.mjs.map +1 -0
  173. package/dist/components/ui/data-table/toolbar.mjs +92 -0
  174. package/dist/components/ui/data-table/toolbar.mjs.map +1 -0
  175. package/dist/components/ui/data-table/use-reorder.mjs +239 -0
  176. package/dist/components/ui/data-table/use-reorder.mjs.map +1 -0
  177. package/dist/components/ui/data-table/use-reveal.mjs +24 -0
  178. package/dist/components/ui/data-table/use-reveal.mjs.map +1 -0
  179. package/dist/components/ui/data-table/use-table-state.mjs +38 -0
  180. package/dist/components/ui/data-table/use-table-state.mjs.map +1 -0
  181. package/dist/components/ui/data-table/view-options.mjs +66 -0
  182. package/dist/components/ui/data-table/view-options.mjs.map +1 -0
  183. package/dist/components/ui/date-picker/calendar.mjs +466 -0
  184. package/dist/components/ui/date-picker/calendar.mjs.map +1 -0
  185. package/dist/components/ui/date-picker/date-picker.mjs +366 -0
  186. package/dist/components/ui/date-picker/date-picker.mjs.map +1 -0
  187. package/dist/components/ui/date-picker/index.mjs +17 -0
  188. package/dist/components/ui/date-picker/index.mjs.map +1 -0
  189. package/dist/components/ui/date-picker/presets.mjs +49 -0
  190. package/dist/components/ui/date-picker/presets.mjs.map +1 -0
  191. package/dist/components/ui/description-list/description-list.mjs +40 -0
  192. package/dist/components/ui/description-list/description-list.mjs.map +1 -0
  193. package/dist/components/ui/description-list/index.mjs +15 -0
  194. package/dist/components/ui/description-list/index.mjs.map +1 -0
  195. package/dist/components/ui/dialog/dialog-stepper.mjs +23 -0
  196. package/dist/components/ui/dialog/dialog-stepper.mjs.map +1 -0
  197. package/dist/components/ui/dialog/dialog.mjs +343 -0
  198. package/dist/components/ui/dialog/dialog.mjs.map +1 -0
  199. package/dist/components/ui/dialog/focus-return.mjs +21 -0
  200. package/dist/components/ui/dialog/focus-return.mjs.map +1 -0
  201. package/dist/components/ui/dialog/index.mjs +33 -0
  202. package/dist/components/ui/dialog/index.mjs.map +1 -0
  203. package/dist/components/ui/divider/divider.mjs +130 -0
  204. package/dist/components/ui/divider/divider.mjs.map +1 -0
  205. package/dist/components/ui/divider/index.mjs +6 -0
  206. package/dist/components/ui/divider/index.mjs.map +1 -0
  207. package/dist/components/ui/dock/dock.mjs +444 -0
  208. package/dist/components/ui/dock/dock.mjs.map +1 -0
  209. package/dist/components/ui/dock/index.mjs +19 -0
  210. package/dist/components/ui/dock/index.mjs.map +1 -0
  211. package/dist/components/ui/document-editor/block-actions.mjs +118 -0
  212. package/dist/components/ui/document-editor/block-actions.mjs.map +1 -0
  213. package/dist/components/ui/document-editor/block-commands.mjs +182 -0
  214. package/dist/components/ui/document-editor/block-commands.mjs.map +1 -0
  215. package/dist/components/ui/document-editor/block-handle.mjs +387 -0
  216. package/dist/components/ui/document-editor/block-handle.mjs.map +1 -0
  217. package/dist/components/ui/document-editor/block-morph.mjs +95 -0
  218. package/dist/components/ui/document-editor/block-morph.mjs.map +1 -0
  219. package/dist/components/ui/document-editor/block-selection.mjs +81 -0
  220. package/dist/components/ui/document-editor/block-selection.mjs.map +1 -0
  221. package/dist/components/ui/document-editor/blocks.mjs +30 -0
  222. package/dist/components/ui/document-editor/blocks.mjs.map +1 -0
  223. package/dist/components/ui/document-editor/bubble-menu.mjs +120 -0
  224. package/dist/components/ui/document-editor/bubble-menu.mjs.map +1 -0
  225. package/dist/components/ui/document-editor/code-block.mjs +89 -0
  226. package/dist/components/ui/document-editor/code-block.mjs.map +1 -0
  227. package/dist/components/ui/document-editor/collaboration-types.mjs +9 -0
  228. package/dist/components/ui/document-editor/collaboration-types.mjs.map +1 -0
  229. package/dist/components/ui/document-editor/collaboration.mjs +198 -0
  230. package/dist/components/ui/document-editor/collaboration.mjs.map +1 -0
  231. package/dist/components/ui/document-editor/columns.mjs +52 -0
  232. package/dist/components/ui/document-editor/columns.mjs.map +1 -0
  233. package/dist/components/ui/document-editor/contents.mjs +60 -0
  234. package/dist/components/ui/document-editor/contents.mjs.map +1 -0
  235. package/dist/components/ui/document-editor/date-chip.mjs +115 -0
  236. package/dist/components/ui/document-editor/date-chip.mjs.map +1 -0
  237. package/dist/components/ui/document-editor/date-words.mjs +101 -0
  238. package/dist/components/ui/document-editor/date-words.mjs.map +1 -0
  239. package/dist/components/ui/document-editor/doc-labels.mjs +19 -0
  240. package/dist/components/ui/document-editor/doc-labels.mjs.map +1 -0
  241. package/dist/components/ui/document-editor/document-editor.mjs +496 -0
  242. package/dist/components/ui/document-editor/document-editor.mjs.map +1 -0
  243. package/dist/components/ui/document-editor/emoji-suggest.mjs +81 -0
  244. package/dist/components/ui/document-editor/emoji-suggest.mjs.map +1 -0
  245. package/dist/components/ui/document-editor/focus-mode.mjs +32 -0
  246. package/dist/components/ui/document-editor/focus-mode.mjs.map +1 -0
  247. package/dist/components/ui/document-editor/geometry.mjs +35 -0
  248. package/dist/components/ui/document-editor/geometry.mjs.map +1 -0
  249. package/dist/components/ui/document-editor/ghost-text.mjs +154 -0
  250. package/dist/components/ui/document-editor/ghost-text.mjs.map +1 -0
  251. package/dist/components/ui/document-editor/gliding-caret.mjs +118 -0
  252. package/dist/components/ui/document-editor/gliding-caret.mjs.map +1 -0
  253. package/dist/components/ui/document-editor/headings.mjs +64 -0
  254. package/dist/components/ui/document-editor/headings.mjs.map +1 -0
  255. package/dist/components/ui/document-editor/image.mjs +318 -0
  256. package/dist/components/ui/document-editor/image.mjs.map +1 -0
  257. package/dist/components/ui/document-editor/index.mjs +131 -0
  258. package/dist/components/ui/document-editor/index.mjs.map +1 -0
  259. package/dist/components/ui/document-editor/labels.mjs +96 -0
  260. package/dist/components/ui/document-editor/labels.mjs.map +1 -0
  261. package/dist/components/ui/document-editor/link-card.mjs +138 -0
  262. package/dist/components/ui/document-editor/link-card.mjs.map +1 -0
  263. package/dist/components/ui/document-editor/mentions.mjs +105 -0
  264. package/dist/components/ui/document-editor/mentions.mjs.map +1 -0
  265. package/dist/components/ui/document-editor/outline.mjs +138 -0
  266. package/dist/components/ui/document-editor/outline.mjs.map +1 -0
  267. package/dist/components/ui/document-editor/section-fold.mjs +124 -0
  268. package/dist/components/ui/document-editor/section-fold.mjs.map +1 -0
  269. package/dist/components/ui/document-editor/slash-command.mjs +210 -0
  270. package/dist/components/ui/document-editor/slash-command.mjs.map +1 -0
  271. package/dist/components/ui/document-editor/suggest-list.mjs +187 -0
  272. package/dist/components/ui/document-editor/suggest-list.mjs.map +1 -0
  273. package/dist/components/ui/document-editor/table.mjs +242 -0
  274. package/dist/components/ui/document-editor/table.mjs.map +1 -0
  275. package/dist/components/ui/document-editor/templates.mjs +66 -0
  276. package/dist/components/ui/document-editor/templates.mjs.map +1 -0
  277. package/dist/components/ui/document-editor/toggle.mjs +176 -0
  278. package/dist/components/ui/document-editor/toggle.mjs.map +1 -0
  279. package/dist/components/ui/document-editor/typography-rules.mjs +8 -0
  280. package/dist/components/ui/document-editor/typography-rules.mjs.map +1 -0
  281. package/dist/components/ui/document-editor/use-editor-value.mjs +34 -0
  282. package/dist/components/ui/document-editor/use-editor-value.mjs.map +1 -0
  283. package/dist/components/ui/drawer/drawer-nav.mjs +153 -0
  284. package/dist/components/ui/drawer/drawer-nav.mjs.map +1 -0
  285. package/dist/components/ui/drawer/drawer.mjs +334 -0
  286. package/dist/components/ui/drawer/drawer.mjs.map +1 -0
  287. package/dist/components/ui/drawer/index.mjs +37 -0
  288. package/dist/components/ui/drawer/index.mjs.map +1 -0
  289. package/dist/components/ui/drawer/use-swipe-to-close.mjs +77 -0
  290. package/dist/components/ui/drawer/use-swipe-to-close.mjs.map +1 -0
  291. package/dist/components/ui/dropdown-menu/dropdown-menu.mjs +567 -0
  292. package/dist/components/ui/dropdown-menu/dropdown-menu.mjs.map +1 -0
  293. package/dist/components/ui/dropdown-menu/index.mjs +43 -0
  294. package/dist/components/ui/dropdown-menu/index.mjs.map +1 -0
  295. package/dist/components/ui/editable-text/editable-text.mjs +148 -0
  296. package/dist/components/ui/editable-text/editable-text.mjs.map +1 -0
  297. package/dist/components/ui/editable-text/index.mjs +6 -0
  298. package/dist/components/ui/editable-text/index.mjs.map +1 -0
  299. package/dist/components/ui/emoji-picker/emoji-data.mjs +469 -0
  300. package/dist/components/ui/emoji-picker/emoji-data.mjs.map +1 -0
  301. package/dist/components/ui/emoji-picker/emoji-picker.mjs +464 -0
  302. package/dist/components/ui/emoji-picker/emoji-picker.mjs.map +1 -0
  303. package/dist/components/ui/emoji-picker/index.mjs +19 -0
  304. package/dist/components/ui/emoji-picker/index.mjs.map +1 -0
  305. package/dist/components/ui/empty-state/empty-state.mjs +110 -0
  306. package/dist/components/ui/empty-state/empty-state.mjs.map +1 -0
  307. package/dist/components/ui/empty-state/index.mjs +17 -0
  308. package/dist/components/ui/empty-state/index.mjs.map +1 -0
  309. package/dist/components/ui/event-calendar/calendar-math.mjs +256 -0
  310. package/dist/components/ui/event-calendar/calendar-math.mjs.map +1 -0
  311. package/dist/components/ui/event-calendar/context.mjs +51 -0
  312. package/dist/components/ui/event-calendar/context.mjs.map +1 -0
  313. package/dist/components/ui/event-calendar/editor.mjs +292 -0
  314. package/dist/components/ui/event-calendar/editor.mjs.map +1 -0
  315. package/dist/components/ui/event-calendar/event-block.mjs +55 -0
  316. package/dist/components/ui/event-calendar/event-block.mjs.map +1 -0
  317. package/dist/components/ui/event-calendar/event-calendar.mjs +438 -0
  318. package/dist/components/ui/event-calendar/event-calendar.mjs.map +1 -0
  319. package/dist/components/ui/event-calendar/event-keys.mjs +41 -0
  320. package/dist/components/ui/event-calendar/event-keys.mjs.map +1 -0
  321. package/dist/components/ui/event-calendar/index.mjs +37 -0
  322. package/dist/components/ui/event-calendar/index.mjs.map +1 -0
  323. package/dist/components/ui/event-calendar/month-grid.mjs +207 -0
  324. package/dist/components/ui/event-calendar/month-grid.mjs.map +1 -0
  325. package/dist/components/ui/event-calendar/narrow.mjs +193 -0
  326. package/dist/components/ui/event-calendar/narrow.mjs.map +1 -0
  327. package/dist/components/ui/event-calendar/time-grid.mjs +534 -0
  328. package/dist/components/ui/event-calendar/time-grid.mjs.map +1 -0
  329. package/dist/components/ui/expandable-search/expandable-search.mjs +174 -0
  330. package/dist/components/ui/expandable-search/expandable-search.mjs.map +1 -0
  331. package/dist/components/ui/expandable-search/index.mjs +6 -0
  332. package/dist/components/ui/expandable-search/index.mjs.map +1 -0
  333. package/dist/components/ui/field/field.mjs +444 -0
  334. package/dist/components/ui/field/field.mjs.map +1 -0
  335. package/dist/components/ui/field/index.mjs +21 -0
  336. package/dist/components/ui/field/index.mjs.map +1 -0
  337. package/dist/components/ui/file-card/file-card.mjs +198 -0
  338. package/dist/components/ui/file-card/file-card.mjs.map +1 -0
  339. package/dist/components/ui/file-card/file-icon.mjs +66 -0
  340. package/dist/components/ui/file-card/file-icon.mjs.map +1 -0
  341. package/dist/components/ui/file-card/file-types.mjs +70 -0
  342. package/dist/components/ui/file-card/file-types.mjs.map +1 -0
  343. package/dist/components/ui/file-card/index.mjs +32 -0
  344. package/dist/components/ui/file-card/index.mjs.map +1 -0
  345. package/dist/components/ui/file-preview/context.mjs +77 -0
  346. package/dist/components/ui/file-preview/context.mjs.map +1 -0
  347. package/dist/components/ui/file-preview/file-preview.mjs +865 -0
  348. package/dist/components/ui/file-preview/file-preview.mjs.map +1 -0
  349. package/dist/components/ui/file-preview/index.mjs +56 -0
  350. package/dist/components/ui/file-preview/index.mjs.map +1 -0
  351. package/dist/components/ui/file-preview/pdf.mjs +250 -0
  352. package/dist/components/ui/file-preview/pdf.mjs.map +1 -0
  353. package/dist/components/ui/file-preview/renderers.mjs +257 -0
  354. package/dist/components/ui/file-preview/renderers.mjs.map +1 -0
  355. package/dist/components/ui/file-upload/file-upload.mjs +633 -0
  356. package/dist/components/ui/file-upload/file-upload.mjs.map +1 -0
  357. package/dist/components/ui/file-upload/index.mjs +42 -0
  358. package/dist/components/ui/file-upload/index.mjs.map +1 -0
  359. package/dist/components/ui/file-upload/validate.mjs +111 -0
  360. package/dist/components/ui/file-upload/validate.mjs.map +1 -0
  361. package/dist/components/ui/flag/flag.mjs +39 -0
  362. package/dist/components/ui/flag/flag.mjs.map +1 -0
  363. package/dist/components/ui/flag/index.mjs +7 -0
  364. package/dist/components/ui/flag/index.mjs.map +1 -0
  365. package/dist/components/ui/floating-window/floating-window.mjs +255 -0
  366. package/dist/components/ui/floating-window/floating-window.mjs.map +1 -0
  367. package/dist/components/ui/floating-window/index.mjs +11 -0
  368. package/dist/components/ui/floating-window/index.mjs.map +1 -0
  369. package/dist/components/ui/form/form-section.mjs +87 -0
  370. package/dist/components/ui/form/form-section.mjs.map +1 -0
  371. package/dist/components/ui/form/form.mjs +205 -0
  372. package/dist/components/ui/form/form.mjs.map +1 -0
  373. package/dist/components/ui/form/index.mjs +29 -0
  374. package/dist/components/ui/form/index.mjs.map +1 -0
  375. package/dist/components/ui/globe/globe-data.mjs +9 -0
  376. package/dist/components/ui/globe/globe-data.mjs.map +1 -0
  377. package/dist/components/ui/globe/globe-math.mjs +269 -0
  378. package/dist/components/ui/globe/globe-math.mjs.map +1 -0
  379. package/dist/components/ui/globe/globe.mjs +719 -0
  380. package/dist/components/ui/globe/globe.mjs.map +1 -0
  381. package/dist/components/ui/globe/index.mjs +13 -0
  382. package/dist/components/ui/globe/index.mjs.map +1 -0
  383. package/dist/components/ui/highlight-match/highlight-children.mjs +13 -0
  384. package/dist/components/ui/highlight-match/highlight-children.mjs.map +1 -0
  385. package/dist/components/ui/highlight-match/highlight-match-variants.mjs +17 -0
  386. package/dist/components/ui/highlight-match/highlight-match-variants.mjs.map +1 -0
  387. package/dist/components/ui/highlight-match/highlight-match.mjs +37 -0
  388. package/dist/components/ui/highlight-match/highlight-match.mjs.map +1 -0
  389. package/dist/components/ui/highlight-match/index.mjs +15 -0
  390. package/dist/components/ui/highlight-match/index.mjs.map +1 -0
  391. package/dist/components/ui/highlight-match/match-ranges.mjs +50 -0
  392. package/dist/components/ui/highlight-match/match-ranges.mjs.map +1 -0
  393. package/dist/components/ui/histogram-slider/histogram-slider.mjs +83 -0
  394. package/dist/components/ui/histogram-slider/histogram-slider.mjs.map +1 -0
  395. package/dist/components/ui/histogram-slider/index.mjs +6 -0
  396. package/dist/components/ui/histogram-slider/index.mjs.map +1 -0
  397. package/dist/components/ui/hold-button/hold-button.mjs +258 -0
  398. package/dist/components/ui/hold-button/hold-button.mjs.map +1 -0
  399. package/dist/components/ui/hold-button/index.mjs +6 -0
  400. package/dist/components/ui/hold-button/index.mjs.map +1 -0
  401. package/dist/components/ui/hover-card/hover-card.mjs +111 -0
  402. package/dist/components/ui/hover-card/hover-card.mjs.map +1 -0
  403. package/dist/components/ui/hover-card/index.mjs +21 -0
  404. package/dist/components/ui/hover-card/index.mjs.map +1 -0
  405. package/dist/components/ui/ink-tray/index.mjs +29 -0
  406. package/dist/components/ui/ink-tray/index.mjs.map +1 -0
  407. package/dist/components/ui/ink-tray/ink-tray-art.mjs +68 -0
  408. package/dist/components/ui/ink-tray/ink-tray-art.mjs.map +1 -0
  409. package/dist/components/ui/ink-tray/ink-tray.mjs +350 -0
  410. package/dist/components/ui/ink-tray/ink-tray.mjs.map +1 -0
  411. package/dist/components/ui/input/index.mjs +41 -0
  412. package/dist/components/ui/input/index.mjs.map +1 -0
  413. package/dist/components/ui/input/input.mjs +268 -0
  414. package/dist/components/ui/input/input.mjs.map +1 -0
  415. package/dist/components/ui/input/number-input.mjs +272 -0
  416. package/dist/components/ui/input/number-input.mjs.map +1 -0
  417. package/dist/components/ui/input/password-input.mjs +49 -0
  418. package/dist/components/ui/input/password-input.mjs.map +1 -0
  419. package/dist/components/ui/input/phone-input-countries.mjs +216 -0
  420. package/dist/components/ui/input/phone-input-countries.mjs.map +1 -0
  421. package/dist/components/ui/input/phone-input.mjs +326 -0
  422. package/dist/components/ui/input/phone-input.mjs.map +1 -0
  423. package/dist/components/ui/input/use-controllable-state.mjs +24 -0
  424. package/dist/components/ui/input/use-controllable-state.mjs.map +1 -0
  425. package/dist/components/ui/input/use-hold-repeat.mjs +35 -0
  426. package/dist/components/ui/input/use-hold-repeat.mjs.map +1 -0
  427. package/dist/components/ui/input-group/index.mjs +11 -0
  428. package/dist/components/ui/input-group/index.mjs.map +1 -0
  429. package/dist/components/ui/input-group/input-group.mjs +78 -0
  430. package/dist/components/ui/input-group/input-group.mjs.map +1 -0
  431. package/dist/components/ui/island/index.mjs +23 -0
  432. package/dist/components/ui/island/index.mjs.map +1 -0
  433. package/dist/components/ui/island/island.mjs +328 -0
  434. package/dist/components/ui/island/island.mjs.map +1 -0
  435. package/dist/components/ui/kbd/index.mjs +6 -0
  436. package/dist/components/ui/kbd/index.mjs.map +1 -0
  437. package/dist/components/ui/kbd/kbd.mjs +73 -0
  438. package/dist/components/ui/kbd/kbd.mjs.map +1 -0
  439. package/dist/components/ui/keypad/index.mjs +23 -0
  440. package/dist/components/ui/keypad/index.mjs.map +1 -0
  441. package/dist/components/ui/keypad/keypad.mjs +345 -0
  442. package/dist/components/ui/keypad/keypad.mjs.map +1 -0
  443. package/dist/components/ui/label/index.mjs +7 -0
  444. package/dist/components/ui/label/index.mjs.map +1 -0
  445. package/dist/components/ui/label/label.mjs +117 -0
  446. package/dist/components/ui/label/label.mjs.map +1 -0
  447. package/dist/components/ui/lightbox/index.mjs +47 -0
  448. package/dist/components/ui/lightbox/index.mjs.map +1 -0
  449. package/dist/components/ui/lightbox/labels.mjs +23 -0
  450. package/dist/components/ui/lightbox/labels.mjs.map +1 -0
  451. package/dist/components/ui/lightbox/lightbox.mjs +1359 -0
  452. package/dist/components/ui/lightbox/lightbox.mjs.map +1 -0
  453. package/dist/components/ui/link/index.mjs +6 -0
  454. package/dist/components/ui/link/index.mjs.map +1 -0
  455. package/dist/components/ui/link/link.mjs +64 -0
  456. package/dist/components/ui/link/link.mjs.map +1 -0
  457. package/dist/components/ui/list/index.mjs +35 -0
  458. package/dist/components/ui/list/index.mjs.map +1 -0
  459. package/dist/components/ui/list/list.mjs +505 -0
  460. package/dist/components/ui/list/list.mjs.map +1 -0
  461. package/dist/components/ui/load-more/index.mjs +23 -0
  462. package/dist/components/ui/load-more/index.mjs.map +1 -0
  463. package/dist/components/ui/load-more/load-more.mjs +409 -0
  464. package/dist/components/ui/load-more/load-more.mjs.map +1 -0
  465. package/dist/components/ui/map/index.mjs +27 -0
  466. package/dist/components/ui/map/index.mjs.map +1 -0
  467. package/dist/components/ui/map/map-style.mjs +169 -0
  468. package/dist/components/ui/map/map-style.mjs.map +1 -0
  469. package/dist/components/ui/map/map.mjs +624 -0
  470. package/dist/components/ui/map/map.mjs.map +1 -0
  471. package/dist/components/ui/map-pin/index.mjs +6 -0
  472. package/dist/components/ui/map-pin/index.mjs.map +1 -0
  473. package/dist/components/ui/map-pin/map-pin.mjs +55 -0
  474. package/dist/components/ui/map-pin/map-pin.mjs.map +1 -0
  475. package/dist/components/ui/mention/index.mjs +29 -0
  476. package/dist/components/ui/mention/index.mjs.map +1 -0
  477. package/dist/components/ui/mention/mention.mjs +262 -0
  478. package/dist/components/ui/mention/mention.mjs.map +1 -0
  479. package/dist/components/ui/mention/split-mentions.mjs +24 -0
  480. package/dist/components/ui/mention/split-mentions.mjs.map +1 -0
  481. package/dist/components/ui/menubar/index.mjs +39 -0
  482. package/dist/components/ui/menubar/index.mjs.map +1 -0
  483. package/dist/components/ui/menubar/menubar.mjs +222 -0
  484. package/dist/components/ui/menubar/menubar.mjs.map +1 -0
  485. package/dist/components/ui/meter/index.mjs +21 -0
  486. package/dist/components/ui/meter/index.mjs.map +1 -0
  487. package/dist/components/ui/meter/meter.mjs +167 -0
  488. package/dist/components/ui/meter/meter.mjs.map +1 -0
  489. package/dist/components/ui/multi-select/index.mjs +25 -0
  490. package/dist/components/ui/multi-select/index.mjs.map +1 -0
  491. package/dist/components/ui/multi-select/multi-select.mjs +285 -0
  492. package/dist/components/ui/multi-select/multi-select.mjs.map +1 -0
  493. package/dist/components/ui/navigation-menu/index.mjs +41 -0
  494. package/dist/components/ui/navigation-menu/index.mjs.map +1 -0
  495. package/dist/components/ui/navigation-menu/navigation-menu.mjs +396 -0
  496. package/dist/components/ui/navigation-menu/navigation-menu.mjs.map +1 -0
  497. package/dist/components/ui/notebook-page/index.mjs +15 -0
  498. package/dist/components/ui/notebook-page/index.mjs.map +1 -0
  499. package/dist/components/ui/notebook-page/notebook-page.mjs +162 -0
  500. package/dist/components/ui/notebook-page/notebook-page.mjs.map +1 -0
  501. package/dist/components/ui/notification-inbox/index.mjs +47 -0
  502. package/dist/components/ui/notification-inbox/index.mjs.map +1 -0
  503. package/dist/components/ui/notification-inbox/notification-inbox.mjs +422 -0
  504. package/dist/components/ui/notification-inbox/notification-inbox.mjs.map +1 -0
  505. package/dist/components/ui/number-field/index.mjs +24 -0
  506. package/dist/components/ui/number-field/index.mjs.map +1 -0
  507. package/dist/components/ui/number-field/number-field.mjs +460 -0
  508. package/dist/components/ui/number-field/number-field.mjs.map +1 -0
  509. package/dist/components/ui/number-field/number-format.mjs +48 -0
  510. package/dist/components/ui/number-field/number-format.mjs.map +1 -0
  511. package/dist/components/ui/otp-input/index.mjs +9 -0
  512. package/dist/components/ui/otp-input/index.mjs.map +1 -0
  513. package/dist/components/ui/otp-input/otp-input.mjs +285 -0
  514. package/dist/components/ui/otp-input/otp-input.mjs.map +1 -0
  515. package/dist/components/ui/pager/index.mjs +7 -0
  516. package/dist/components/ui/pager/index.mjs.map +1 -0
  517. package/dist/components/ui/pager/pager.mjs +86 -0
  518. package/dist/components/ui/pager/pager.mjs.map +1 -0
  519. package/dist/components/ui/pagination/index.mjs +23 -0
  520. package/dist/components/ui/pagination/index.mjs.map +1 -0
  521. package/dist/components/ui/pagination/pagination.mjs +210 -0
  522. package/dist/components/ui/pagination/pagination.mjs.map +1 -0
  523. package/dist/components/ui/password-strength/index.mjs +21 -0
  524. package/dist/components/ui/password-strength/index.mjs.map +1 -0
  525. package/dist/components/ui/password-strength/password-rules.mjs +25 -0
  526. package/dist/components/ui/password-strength/password-rules.mjs.map +1 -0
  527. package/dist/components/ui/password-strength/password-strength.mjs +125 -0
  528. package/dist/components/ui/password-strength/password-strength.mjs.map +1 -0
  529. package/dist/components/ui/popover/index.mjs +31 -0
  530. package/dist/components/ui/popover/index.mjs.map +1 -0
  531. package/dist/components/ui/popover/popover.mjs +574 -0
  532. package/dist/components/ui/popover/popover.mjs.map +1 -0
  533. package/dist/components/ui/progress/index.mjs +15 -0
  534. package/dist/components/ui/progress/index.mjs.map +1 -0
  535. package/dist/components/ui/progress/progress.mjs +224 -0
  536. package/dist/components/ui/progress/progress.mjs.map +1 -0
  537. package/dist/components/ui/prose/index.mjs +6 -0
  538. package/dist/components/ui/prose/index.mjs.map +1 -0
  539. package/dist/components/ui/prose/prose.mjs +89 -0
  540. package/dist/components/ui/prose/prose.mjs.map +1 -0
  541. package/dist/components/ui/radio-group/index.mjs +15 -0
  542. package/dist/components/ui/radio-group/index.mjs.map +1 -0
  543. package/dist/components/ui/radio-group/radio-group.mjs +88 -0
  544. package/dist/components/ui/radio-group/radio-group.mjs.map +1 -0
  545. package/dist/components/ui/rating/index.mjs +6 -0
  546. package/dist/components/ui/rating/index.mjs.map +1 -0
  547. package/dist/components/ui/rating/rating.mjs +119 -0
  548. package/dist/components/ui/rating/rating.mjs.map +1 -0
  549. package/dist/components/ui/rich-text-editor/bubble-menu.mjs +120 -0
  550. package/dist/components/ui/rich-text-editor/bubble-menu.mjs.map +1 -0
  551. package/dist/components/ui/rich-text-editor/image-links.mjs +63 -0
  552. package/dist/components/ui/rich-text-editor/image-links.mjs.map +1 -0
  553. package/dist/components/ui/rich-text-editor/index.mjs +37 -0
  554. package/dist/components/ui/rich-text-editor/index.mjs.map +1 -0
  555. package/dist/components/ui/rich-text-editor/labels.mjs +27 -0
  556. package/dist/components/ui/rich-text-editor/labels.mjs.map +1 -0
  557. package/dist/components/ui/rich-text-editor/rich-text-editor.mjs +149 -0
  558. package/dist/components/ui/rich-text-editor/rich-text-editor.mjs.map +1 -0
  559. package/dist/components/ui/rich-text-editor/toolbar.mjs +325 -0
  560. package/dist/components/ui/rich-text-editor/toolbar.mjs.map +1 -0
  561. package/dist/components/ui/save-bar/index.mjs +13 -0
  562. package/dist/components/ui/save-bar/index.mjs.map +1 -0
  563. package/dist/components/ui/save-bar/save-bar.mjs +59 -0
  564. package/dist/components/ui/save-bar/save-bar.mjs.map +1 -0
  565. package/dist/components/ui/scroll-area/index.mjs +6 -0
  566. package/dist/components/ui/scroll-area/index.mjs.map +1 -0
  567. package/dist/components/ui/scroll-area/scroll-area.mjs +148 -0
  568. package/dist/components/ui/scroll-area/scroll-area.mjs.map +1 -0
  569. package/dist/components/ui/scroll-area/use-drag-scroll.mjs +134 -0
  570. package/dist/components/ui/scroll-area/use-drag-scroll.mjs.map +1 -0
  571. package/dist/components/ui/select/index.mjs +23 -0
  572. package/dist/components/ui/select/index.mjs.map +1 -0
  573. package/dist/components/ui/select/select.mjs +216 -0
  574. package/dist/components/ui/select/select.mjs.map +1 -0
  575. package/dist/components/ui/sheet/index.mjs +23 -0
  576. package/dist/components/ui/sheet/index.mjs.map +1 -0
  577. package/dist/components/ui/sheet/sheet.mjs +292 -0
  578. package/dist/components/ui/sheet/sheet.mjs.map +1 -0
  579. package/dist/components/ui/sidebar/index.mjs +122 -0
  580. package/dist/components/ui/sidebar/index.mjs.map +1 -0
  581. package/dist/components/ui/sidebar/sidebar-group.mjs +75 -0
  582. package/dist/components/ui/sidebar/sidebar-group.mjs.map +1 -0
  583. package/dist/components/ui/sidebar/sidebar-item.mjs +199 -0
  584. package/dist/components/ui/sidebar/sidebar-item.mjs.map +1 -0
  585. package/dist/components/ui/sidebar/sidebar-panels.mjs +182 -0
  586. package/dist/components/ui/sidebar/sidebar-panels.mjs.map +1 -0
  587. package/dist/components/ui/sidebar/sidebar-peek.mjs +324 -0
  588. package/dist/components/ui/sidebar/sidebar-peek.mjs.map +1 -0
  589. package/dist/components/ui/sidebar/sidebar-rich.mjs +65 -0
  590. package/dist/components/ui/sidebar/sidebar-rich.mjs.map +1 -0
  591. package/dist/components/ui/sidebar/sidebar-tree.mjs +224 -0
  592. package/dist/components/ui/sidebar/sidebar-tree.mjs.map +1 -0
  593. package/dist/components/ui/sidebar/sidebar.mjs +205 -0
  594. package/dist/components/ui/sidebar/sidebar.mjs.map +1 -0
  595. package/dist/components/ui/sidebar/variants.mjs +396 -0
  596. package/dist/components/ui/sidebar/variants.mjs.map +1 -0
  597. package/dist/components/ui/signature/index.mjs +6 -0
  598. package/dist/components/ui/signature/index.mjs.map +1 -0
  599. package/dist/components/ui/signature/signature.mjs +145 -0
  600. package/dist/components/ui/signature/signature.mjs.map +1 -0
  601. package/dist/components/ui/signature-pad/index.mjs +19 -0
  602. package/dist/components/ui/signature-pad/index.mjs.map +1 -0
  603. package/dist/components/ui/signature-pad/signature-pad.mjs +210 -0
  604. package/dist/components/ui/signature-pad/signature-pad.mjs.map +1 -0
  605. package/dist/components/ui/signature-pad/strokes.mjs +68 -0
  606. package/dist/components/ui/signature-pad/strokes.mjs.map +1 -0
  607. package/dist/components/ui/skeleton/index.mjs +9 -0
  608. package/dist/components/ui/skeleton/index.mjs.map +1 -0
  609. package/dist/components/ui/skeleton/skeleton.mjs +58 -0
  610. package/dist/components/ui/skeleton/skeleton.mjs.map +1 -0
  611. package/dist/components/ui/slide/index.mjs +25 -0
  612. package/dist/components/ui/slide/index.mjs.map +1 -0
  613. package/dist/components/ui/slide/slide.mjs +159 -0
  614. package/dist/components/ui/slide/slide.mjs.map +1 -0
  615. package/dist/components/ui/slider/index.mjs +21 -0
  616. package/dist/components/ui/slider/index.mjs.map +1 -0
  617. package/dist/components/ui/slider/slider-input.mjs +449 -0
  618. package/dist/components/ui/slider/slider-input.mjs.map +1 -0
  619. package/dist/components/ui/slider/slider.mjs +235 -0
  620. package/dist/components/ui/slider/slider.mjs.map +1 -0
  621. package/dist/components/ui/slides/index.mjs +31 -0
  622. package/dist/components/ui/slides/index.mjs.map +1 -0
  623. package/dist/components/ui/slides/slides.mjs +890 -0
  624. package/dist/components/ui/slides/slides.mjs.map +1 -0
  625. package/dist/components/ui/smooth-anchors/index.mjs +17 -0
  626. package/dist/components/ui/smooth-anchors/index.mjs.map +1 -0
  627. package/dist/components/ui/smooth-anchors/smooth-anchors.mjs +75 -0
  628. package/dist/components/ui/smooth-anchors/smooth-anchors.mjs.map +1 -0
  629. package/dist/components/ui/smooth-anchors/smooth-scroll.mjs +87 -0
  630. package/dist/components/ui/smooth-anchors/smooth-scroll.mjs.map +1 -0
  631. package/dist/components/ui/spinner/index.mjs +6 -0
  632. package/dist/components/ui/spinner/index.mjs.map +1 -0
  633. package/dist/components/ui/spinner/spinner.mjs +49 -0
  634. package/dist/components/ui/spinner/spinner.mjs.map +1 -0
  635. package/dist/components/ui/stat/index.mjs +29 -0
  636. package/dist/components/ui/stat/index.mjs.map +1 -0
  637. package/dist/components/ui/stat/stat.mjs +226 -0
  638. package/dist/components/ui/stat/stat.mjs.map +1 -0
  639. package/dist/components/ui/status-bar/index.mjs +17 -0
  640. package/dist/components/ui/status-bar/index.mjs.map +1 -0
  641. package/dist/components/ui/status-bar/status-bar.mjs +96 -0
  642. package/dist/components/ui/status-bar/status-bar.mjs.map +1 -0
  643. package/dist/components/ui/stepper/index.mjs +25 -0
  644. package/dist/components/ui/stepper/index.mjs.map +1 -0
  645. package/dist/components/ui/stepper/stepper.mjs +235 -0
  646. package/dist/components/ui/stepper/stepper.mjs.map +1 -0
  647. package/dist/components/ui/steps/index.mjs +9 -0
  648. package/dist/components/ui/steps/index.mjs.map +1 -0
  649. package/dist/components/ui/steps/steps.mjs +70 -0
  650. package/dist/components/ui/steps/steps.mjs.map +1 -0
  651. package/dist/components/ui/swatch-grid/index.mjs +7 -0
  652. package/dist/components/ui/swatch-grid/index.mjs.map +1 -0
  653. package/dist/components/ui/swatch-grid/swatch-grid.mjs +110 -0
  654. package/dist/components/ui/swatch-grid/swatch-grid.mjs.map +1 -0
  655. package/dist/components/ui/switch/index.mjs +7 -0
  656. package/dist/components/ui/switch/index.mjs.map +1 -0
  657. package/dist/components/ui/switch/switch.mjs +79 -0
  658. package/dist/components/ui/switch/switch.mjs.map +1 -0
  659. package/dist/components/ui/tab-strip/index.mjs +13 -0
  660. package/dist/components/ui/tab-strip/index.mjs.map +1 -0
  661. package/dist/components/ui/tab-strip/tab-strip.mjs +244 -0
  662. package/dist/components/ui/tab-strip/tab-strip.mjs.map +1 -0
  663. package/dist/components/ui/table/index.mjs +27 -0
  664. package/dist/components/ui/table/index.mjs.map +1 -0
  665. package/dist/components/ui/table/table.mjs +290 -0
  666. package/dist/components/ui/table/table.mjs.map +1 -0
  667. package/dist/components/ui/table-of-contents/index.mjs +20 -0
  668. package/dist/components/ui/table-of-contents/index.mjs.map +1 -0
  669. package/dist/components/ui/table-of-contents/scroll-spy.mjs +60 -0
  670. package/dist/components/ui/table-of-contents/scroll-spy.mjs.map +1 -0
  671. package/dist/components/ui/table-of-contents/table-of-contents.mjs +371 -0
  672. package/dist/components/ui/table-of-contents/table-of-contents.mjs.map +1 -0
  673. package/dist/components/ui/table-of-contents/use-headings.mjs +40 -0
  674. package/dist/components/ui/table-of-contents/use-headings.mjs.map +1 -0
  675. package/dist/components/ui/tablet-frame/index.mjs +7 -0
  676. package/dist/components/ui/tablet-frame/index.mjs.map +1 -0
  677. package/dist/components/ui/tablet-frame/tablet-frame.mjs +48 -0
  678. package/dist/components/ui/tablet-frame/tablet-frame.mjs.map +1 -0
  679. package/dist/components/ui/tabs/index.mjs +25 -0
  680. package/dist/components/ui/tabs/index.mjs.map +1 -0
  681. package/dist/components/ui/tabs/tabs.mjs +382 -0
  682. package/dist/components/ui/tabs/tabs.mjs.map +1 -0
  683. package/dist/components/ui/tabs/use-tabs-indicator.mjs +90 -0
  684. package/dist/components/ui/tabs/use-tabs-indicator.mjs.map +1 -0
  685. package/dist/components/ui/tags-input/index.mjs +9 -0
  686. package/dist/components/ui/tags-input/index.mjs.map +1 -0
  687. package/dist/components/ui/tags-input/split.mjs +38 -0
  688. package/dist/components/ui/tags-input/split.mjs.map +1 -0
  689. package/dist/components/ui/tags-input/tags-input.mjs +328 -0
  690. package/dist/components/ui/tags-input/tags-input.mjs.map +1 -0
  691. package/dist/components/ui/terminal/index.mjs +41 -0
  692. package/dist/components/ui/terminal/index.mjs.map +1 -0
  693. package/dist/components/ui/terminal/terminal.mjs +287 -0
  694. package/dist/components/ui/terminal/terminal.mjs.map +1 -0
  695. package/dist/components/ui/textarea/index.mjs +21 -0
  696. package/dist/components/ui/textarea/index.mjs.map +1 -0
  697. package/dist/components/ui/textarea/textarea.mjs +244 -0
  698. package/dist/components/ui/textarea/textarea.mjs.map +1 -0
  699. package/dist/components/ui/theme-provider/index.mjs +6 -0
  700. package/dist/components/ui/theme-provider/index.mjs.map +1 -0
  701. package/dist/components/ui/theme-provider/theme-provider.mjs +70 -0
  702. package/dist/components/ui/theme-provider/theme-provider.mjs.map +1 -0
  703. package/dist/components/ui/toast/index.mjs +19 -0
  704. package/dist/components/ui/toast/index.mjs.map +1 -0
  705. package/dist/components/ui/toast/store.mjs +96 -0
  706. package/dist/components/ui/toast/store.mjs.map +1 -0
  707. package/dist/components/ui/toast/toast.mjs +395 -0
  708. package/dist/components/ui/toast/toast.mjs.map +1 -0
  709. package/dist/components/ui/toggle/index.mjs +13 -0
  710. package/dist/components/ui/toggle/index.mjs.map +1 -0
  711. package/dist/components/ui/toggle/toggle.mjs +123 -0
  712. package/dist/components/ui/toggle/toggle.mjs.map +1 -0
  713. package/dist/components/ui/toggle-group/index.mjs +11 -0
  714. package/dist/components/ui/toggle-group/index.mjs.map +1 -0
  715. package/dist/components/ui/toggle-group/toggle-group.mjs +243 -0
  716. package/dist/components/ui/toggle-group/toggle-group.mjs.map +1 -0
  717. package/dist/components/ui/toggletip/index.mjs +6 -0
  718. package/dist/components/ui/toggletip/index.mjs.map +1 -0
  719. package/dist/components/ui/toggletip/toggletip.mjs +95 -0
  720. package/dist/components/ui/toggletip/toggletip.mjs.map +1 -0
  721. package/dist/components/ui/toolbar/index.mjs +21 -0
  722. package/dist/components/ui/toolbar/index.mjs.map +1 -0
  723. package/dist/components/ui/toolbar/toolbar.mjs +130 -0
  724. package/dist/components/ui/toolbar/toolbar.mjs.map +1 -0
  725. package/dist/components/ui/tooltip/index.mjs +29 -0
  726. package/dist/components/ui/tooltip/index.mjs.map +1 -0
  727. package/dist/components/ui/tooltip/tooltip.mjs +640 -0
  728. package/dist/components/ui/tooltip/tooltip.mjs.map +1 -0
  729. package/dist/components/ui/tree/index.mjs +11 -0
  730. package/dist/components/ui/tree/index.mjs.map +1 -0
  731. package/dist/components/ui/tree/tree.mjs +450 -0
  732. package/dist/components/ui/tree/tree.mjs.map +1 -0
  733. package/dist/index.d.mts +19397 -0
  734. package/dist/index.mjs +157 -0
  735. package/dist/index.mjs.map +1 -0
  736. package/dist/lib/color.mjs +78 -0
  737. package/dist/lib/color.mjs.map +1 -0
  738. package/dist/lib/create-context.mjs +31 -0
  739. package/dist/lib/create-context.mjs.map +1 -0
  740. package/dist/lib/date.mjs +116 -0
  741. package/dist/lib/date.mjs.map +1 -0
  742. package/dist/lib/density.mjs +79 -0
  743. package/dist/lib/density.mjs.map +1 -0
  744. package/dist/lib/field-context.mjs +13 -0
  745. package/dist/lib/field-context.mjs.map +1 -0
  746. package/dist/lib/filter.mjs +28 -0
  747. package/dist/lib/filter.mjs.map +1 -0
  748. package/dist/lib/gesture.mjs +38 -0
  749. package/dist/lib/gesture.mjs.map +1 -0
  750. package/dist/lib/hit-area.mjs +14 -0
  751. package/dist/lib/hit-area.mjs.map +1 -0
  752. package/dist/lib/labels.mjs +27 -0
  753. package/dist/lib/labels.mjs.map +1 -0
  754. package/dist/lib/morph-box.mjs +56 -0
  755. package/dist/lib/morph-box.mjs.map +1 -0
  756. package/dist/lib/motion.mjs +70 -0
  757. package/dist/lib/motion.mjs.map +1 -0
  758. package/dist/lib/pulse.mjs +69 -0
  759. package/dist/lib/pulse.mjs.map +1 -0
  760. package/dist/lib/roving-focus.mjs +74 -0
  761. package/dist/lib/roving-focus.mjs.map +1 -0
  762. package/dist/lib/theme.mjs +67 -0
  763. package/dist/lib/theme.mjs.map +1 -0
  764. package/dist/lib/tv.mjs +11 -0
  765. package/dist/lib/tv.mjs.map +1 -0
  766. package/dist/lib/utils.mjs +82 -0
  767. package/dist/lib/utils.mjs.map +1 -0
  768. package/dist/styles.css +2 -0
  769. package/package.json +133 -4
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/ui/table/table.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\nimport { useDensity, type Density } from \"../../../lib/density.mjs\"\nimport { tv, type VariantProps } from \"../../../lib/tv.mjs\"\n\n/*\n * Styled table parts. Every stripe, hover and pinned cell is mixed into `--table-surface`, the\n * opaque surface the table sits on, so a Card or a Dialog around it blends in and a pinned cell\n * covers what slides under it. `border-separate` throughout: collapsed borders don't move with a\n * sticky or a dragged cell.\n */\nconst roundedRows = [\n \"[&_td]:border-b-0 [&_th]:border-b-0 [&_tbody>tr]:bg-transparent!\",\n \"[&_tbody>tr>td]:transition-colors [&_tbody>tr>td]:duration-fast [&_tbody>tr>td]:ease-out\",\n \"[&_tbody>tr>td:first-child]:rounded-s-(--table-row-radius) [&_tbody>tr>td:last-child]:rounded-e-(--table-row-radius)\",\n \"[&_td[data-sticky]]:bg-(--table-surface) [&_td[data-dragging]]:bg-(--table-surface)\",\n \"[&_tbody>tr[data-dragging]>td]:bg-[color-mix(in_oklab,var(--foreground)_4%,var(--table-surface))]\",\n \"[&_tbody>tr[data-state=selected]>td]:bg-[color-mix(in_oklab,var(--foreground)_5%,var(--table-surface))]\",\n \"[&_tbody>tr[aria-current=true]>td]:bg-[color-mix(in_oklab,var(--foreground)_7%,var(--table-surface))]\",\n]\n\nexport const tableVariants = tv({\n slots: {\n container: [\n \"relative isolate overflow-auto outline-none [--table-surface:var(--surface,var(--background))]\",\n // Outside the box: the rows are opaque and would cover a ring drawn inside it.\n \"focus-visible:outline-2 focus-visible:outline-focus focus-visible:outline-solid\",\n ],\n table: \"w-full border-separate border-spacing-0 text-sm\",\n header: \"\",\n body: [\n \"[&>tr[aria-current=true]]:bg-[color-mix(in_oklab,var(--foreground)_5%,var(--table-surface))] dark:[&>tr[aria-current=true]]:bg-[color-mix(in_oklab,var(--foreground)_9%,var(--table-surface))]\",\n ],\n footer:\n \"bg-[color-mix(in_oklab,var(--muted)_50%,var(--table-surface))] font-medium tabular-nums [&>tr]:bg-inherit [&>tr>td]:border-t [&>tr>td]:border-b-0 [&>tr>td]:border-border\",\n row: \"bg-(--table-surface) transition-colors duration-fast ease-out data-[state=selected]:bg-muted\",\n head: \"border-b border-border text-start align-middle font-medium whitespace-nowrap text-muted-foreground transition-[height,padding] duration-base ease-out motion-reduce-fade\",\n cell: \"border-b border-border align-middle whitespace-nowrap transition-[height,padding] duration-base ease-out motion-reduce-fade [tbody>tr:last-child>&]:border-b-0\",\n caption: \"caption-bottom pt-3 text-start text-sm text-muted-foreground\",\n cellText: \"flex min-w-0 flex-col gap-0.5\",\n },\n variants: {\n variant: {\n minimal: {\n // Bleeds a strip past the table and pads it back, so a focus ring at the edge isn't clipped.\n container: [\n \"[--table-bleed:max(4px,--spacing(1))] [--table-pad:var(--table-bleed)]\",\n \"-m-(--table-bleed) w-[calc(100%+var(--table-bleed)*2)] scroll-p-(--table-bleed) p-(--table-bleed)\",\n \"scroll-fade-x has-[[data-sticky]]:[-webkit-mask-image:none] has-[[data-sticky]]:[mask-image:none]\",\n ],\n table: [\n \"[&_tr>*:first-child]:ps-0 [&_tr>*:last-child]:pe-0\",\n \"[&_tr>[data-sticky]:first-child]:shadow-[calc(var(--table-bleed)*-1)_0_0_var(--table-surface)] rtl:[&_tr>[data-sticky]:first-child]:shadow-[var(--table-bleed)_0_0_var(--table-surface)]\",\n \"[&_tr>[data-sticky]:last-child]:shadow-[var(--table-bleed)_0_0_var(--table-surface)] rtl:[&_tr>[data-sticky]:last-child]:shadow-[calc(var(--table-bleed)*-1)_0_0_var(--table-surface)]\",\n ],\n },\n container: { container: \"w-full rounded-xl bg-(--table-surface) text-card-foreground ring-1 ring-border\" },\n \"full-bleed\": {\n container: [\n \"[--table-edge:var(--card-inset,var(--page-inset,0px))] [--table-inset:var(--card-inset,var(--page-inset,calc(var(--spacing)*4)))]\",\n // Its card would clip a ring outside.\n \"mx-[calc(var(--table-edge)*-1)] w-[calc(100%+var(--table-edge)*2)] focus-visible:-outline-offset-2\",\n \"[[data-slot=card-content]:last-child>&:last-child]:-mb-(--card-inset) [[data-slot=card-content]:last-child>&:last-child]:rounded-b-xl\",\n \"scroll-fade-x has-[[data-sticky]]:[-webkit-mask-image:none] has-[[data-sticky]]:[mask-image:none]\",\n ],\n table: \"[&_tr>*:first-child]:ps-(--table-inset) [&_tr>*:last-child]:pe-(--table-inset)\",\n },\n rounded: {\n container: [\n \"[--table-bleed:calc(var(--spacing)*3)] [--table-pad:--spacing(1)] [--table-row-radius:var(--radius-md)]\",\n \"-mx-(--table-bleed) -my-1 w-[calc(100%+var(--table-bleed)*2)] px-(--table-bleed) py-1\",\n \"scroll-fade-x has-[[data-sticky]]:[-webkit-mask-image:none] has-[[data-sticky]]:[mask-image:none]\",\n ],\n // The chips reach a step past the text, so the columns line up with the heading above.\n table: [\n ...roundedRows,\n \"-mx-(--table-bleed) w-[calc(100%+var(--table-bleed)*2)] [&_tr>*:first-child]:ps-(--table-bleed) [&_tr>*:last-child]:pe-(--table-bleed)\",\n ],\n },\n inset: {\n container:\n \"w-full rounded-xl bg-(--table-surface) p-1.5 text-card-foreground ring-1 ring-border [--table-pad:calc(var(--spacing)*1.5)] [--table-row-radius:calc(var(--radius-xl)-var(--spacing)*1.5)]\",\n table: roundedRows,\n },\n separated: {\n container: \"-my-2 w-full py-0.5 [--table-pad:--spacing(0.5)] [--table-row-radius:var(--radius-lg)]\",\n table: [\n ...roundedRows,\n \"border-spacing-y-2 [&_tbody>tr>td]:bg-(--table-surface)\",\n \"[&_tbody>tr>td]:shadow-[inset_0_1px_0_0_var(--border),inset_0_-1px_0_0_var(--border)]\",\n \"[&_tbody>tr>td:first-child]:shadow-[inset_1px_0_0_0_var(--border),inset_0_1px_0_0_var(--border),inset_0_-1px_0_0_var(--border)] rtl:[&_tbody>tr>td:first-child]:shadow-[inset_-1px_0_0_0_var(--border),inset_0_1px_0_0_var(--border),inset_0_-1px_0_0_var(--border)]\",\n \"[&_tbody>tr>td:last-child]:shadow-[inset_-1px_0_0_0_var(--border),inset_0_1px_0_0_var(--border),inset_0_-1px_0_0_var(--border)] rtl:[&_tbody>tr>td:last-child]:shadow-[inset_1px_0_0_0_var(--border),inset_0_1px_0_0_var(--border),inset_0_-1px_0_0_var(--border)]\",\n \"[&_tbody>tr>td:only-child]:shadow-[inset_0_0_0_1px_var(--border)]\",\n ],\n },\n },\n density: {\n compact: { container: \"[--table-head-h:--spacing(9)]\", head: \"h-9 px-3\", cell: \"h-9 px-3 py-1.5\" },\n comfortable: { container: \"[--table-head-h:--spacing(12)]\", head: \"h-12 px-4\", cell: \"h-12 px-4 py-3\" },\n },\n striped: {\n // Skips rows that already say something else.\n true: {\n body: \"[&>tr:nth-child(even_of_:not([data-static])):not(:hover,[data-state=selected],[aria-current=true])]:bg-[color-mix(in_oklab,var(--muted)_40%,var(--table-surface))]\",\n },\n },\n hoverable: { true: {} },\n stickyHeader: {\n true: {\n container: \"scroll-pt-[calc(var(--table-head-h)+var(--table-pad,4px))]\",\n head: \"sticky top-[calc(var(--table-pad,0px)*-1)] z-20 bg-(--table-surface)\",\n },\n },\n align: {\n start: {},\n center: { head: \"text-center\", cell: \"text-center\" },\n end: { head: \"text-end\", cell: \"text-end\" },\n },\n numeric: { true: { cell: \"text-end tabular-nums\" } },\n sticky: {\n start: {\n head: \"sticky start-0 z-30 border-e bg-(--table-surface)\",\n cell: \"sticky start-0 z-10 border-e bg-inherit\",\n },\n end: {\n head: \"sticky end-0 z-30 border-s bg-(--table-surface)\",\n cell: \"sticky end-0 z-10 border-s bg-inherit\",\n },\n },\n },\n compoundVariants: [\n {\n hoverable: true,\n variant: [\"minimal\", \"container\", \"full-bleed\"],\n class: {\n body: [\n \"[@media(hover:hover)]:[&>tr:not([data-static],[data-state=selected]):hover]:bg-[color-mix(in_oklab,var(--muted)_50%,var(--table-surface))]\",\n \"[@media(hover:hover)]:[&>tr[aria-current=true]:hover]:bg-[color-mix(in_oklab,var(--foreground)_7%,var(--table-surface))] dark:[@media(hover:hover)]:[&>tr[aria-current=true]:hover]:bg-[color-mix(in_oklab,var(--foreground)_12%,var(--table-surface))]\",\n ],\n },\n },\n {\n hoverable: true,\n variant: [\"rounded\", \"inset\", \"separated\"],\n class: {\n table:\n \"[@media(hover:hover)]:[&_tbody>tr:not([data-static],[data-state=selected],[aria-current=true]):hover>td]:bg-[color-mix(in_oklab,var(--foreground)_4%,var(--table-surface))]\",\n },\n },\n ],\n defaultVariants: { variant: \"minimal\", density: \"compact\", hoverable: true, align: \"start\" },\n})\n\ntype TableVariant = NonNullable<VariantProps<typeof tableVariants>[\"variant\"]>\nexport type TableAlign = \"start\" | \"center\" | \"end\"\nexport type TableSticky = \"start\" | \"end\"\n\ninterface TableContextValue {\n variant: TableVariant\n density: Density\n striped: boolean\n hoverable: boolean\n stickyHeader: boolean\n}\n\nconst TableContext = React.createContext<TableContextValue | null>(null)\n\nfunction useTableContext(part: string) {\n const ctx = React.useContext(TableContext)\n if (!ctx) throw new Error(`<${part}> must be used within <Table>`)\n return ctx\n}\n\n/* ─── Table ───────────────────────────────────────────────────────────────── */\n\nexport interface TableProps extends React.ComponentProps<\"table\"> {\n /** What the table lists, for assistive tech. A `TableCaption` names it too. */\n label?: string\n /** minimal sits on the page; container, full-bleed and inset frame it; rounded and separated draw rows as shapes. */\n variant?: TableVariant\n /** Row height and cell padding. Falls back to the nearest DensityProvider. */\n density?: Density\n /** Tint every second row. */\n striped?: boolean\n /** Tint a row under the pointer. */\n hoverable?: boolean\n /** Pin the head while the body scrolls. Cap the height with `containerProps`. */\n stickyHeader?: boolean\n /** Props for the scroll box, e.g. `{ className: \"max-h-96\" }`. `containerRef` reaches the element. */\n containerProps?: Omit<React.ComponentProps<\"div\">, \"ref\"> & { [key: `data-${string}`]: unknown }\n /** The scroll box. */\n containerRef?: React.Ref<HTMLDivElement>\n}\n\n/** A `<table>` in its scroll box. While it overflows, the box can be focused and scrolled by key. */\nexport function Table({\n label,\n variant = \"minimal\",\n density: densityProp,\n striped = false,\n hoverable = true,\n stickyHeader = false,\n containerProps,\n containerRef: containerRefProp,\n className,\n children,\n ...props\n}: TableProps) {\n const density = useDensity(densityProp)\n const slots = tableVariants({ variant, density, striped, hoverable, stickyHeader })\n const containerRef = React.useRef<HTMLDivElement>(null)\n React.useImperativeHandle(containerRefProp, () => containerRef.current as HTMLDivElement, [])\n // Where a keyboard can't otherwise scroll it, and what it's called then.\n const [scrolls, setScrolls] = React.useState<{ captionId?: string } | null>(null)\n\n React.useEffect(() => {\n const box = containerRef.current\n const table = box?.querySelector(\"table\")\n if (!box || !table) return\n const observer = new ResizeObserver(() => {\n const overflows = box.scrollWidth > box.clientWidth + 1 || box.scrollHeight > box.clientHeight + 1\n setScrolls((was) => (!overflows ? null : was && was.captionId === table.caption?.id ? was : { captionId: table.caption?.id }))\n })\n observer.observe(box)\n observer.observe(table)\n return () => observer.disconnect()\n }, [])\n\n const context = React.useMemo(\n () => ({ variant, density, striped, hoverable, stickyHeader }),\n [variant, density, striped, hoverable, stickyHeader],\n )\n const { className: containerClassName, ...containerRest } = containerProps ?? {}\n const named = Boolean(label || scrolls?.captionId)\n\n return (\n <TableContext.Provider value={context}>\n <div\n ref={containerRef}\n data-slot=\"table-container\"\n data-variant={variant}\n // A scroll box nobody can reach is a table some people can't read.\n tabIndex={scrolls ? 0 : undefined}\n role={scrolls && named ? \"region\" : undefined}\n aria-label={scrolls && label ? label : undefined}\n aria-labelledby={scrolls && !label ? scrolls.captionId : undefined}\n className={slots.container({ className: containerClassName })}\n {...containerRest}\n >\n <table data-slot=\"table\" aria-label={label} className={slots.table({ className })} {...props}>\n {children}\n </table>\n </div>\n </TableContext.Provider>\n )\n}\n\n/* ─── Sections ────────────────────────────────────────────────────────────── */\n\nexport function TableHeader({ className, ...props }: React.ComponentProps<\"thead\">) {\n return <thead data-slot=\"table-header\" className={tableVariants(useTableContext(\"TableHeader\")).header({ className })} {...props} />\n}\n\nexport function TableBody({ className, ...props }: React.ComponentProps<\"tbody\">) {\n return <tbody data-slot=\"table-body\" className={tableVariants(useTableContext(\"TableBody\")).body({ className })} {...props} />\n}\n\n/** A muted totals band. */\nexport function TableFooter({ className, ...props }: React.ComponentProps<\"tfoot\">) {\n return <tfoot data-slot=\"table-footer\" className={tableVariants(useTableContext(\"TableFooter\")).footer({ className })} {...props} />\n}\n\n/** A line under the table that also names it. */\nexport function TableCaption({ className, id, ...props }: React.ComponentProps<\"caption\">) {\n const auto = React.useId()\n return (\n <caption\n data-slot=\"table-caption\"\n id={id ?? auto}\n className={tableVariants(useTableContext(\"TableCaption\")).caption({ className })}\n {...props}\n />\n )\n}\n\n/* ─── Rows and cells ──────────────────────────────────────────────────────── */\n\nexport interface TableRowProps extends React.ComponentProps<\"tr\"> {\n /** Paint the selected fill. */\n selected?: boolean\n /** The record open elsewhere: an ink tint and `aria-current`. */\n current?: boolean\n}\n\nexport function TableRow({ selected, current, className, ...props }: TableRowProps) {\n return (\n <tr\n data-slot=\"table-row\"\n data-state={selected ? \"selected\" : undefined}\n aria-current={current ? \"true\" : undefined}\n className={tableVariants(useTableContext(\"TableRow\")).row({ className })}\n {...props}\n />\n )\n}\n\nexport interface TableHeadProps extends Omit<React.ComponentProps<\"th\">, \"align\"> {\n align?: TableAlign\n /** Pin the column to an edge while the rest scrolls sideways. */\n sticky?: TableSticky\n}\n\nexport function TableHead({ align = \"start\", sticky, className, ...props }: TableHeadProps) {\n const ctx = useTableContext(\"TableHead\")\n return (\n <th\n scope=\"col\"\n data-slot=\"table-head\"\n data-sticky={sticky}\n className={tableVariants({ ...ctx, align, sticky }).head({ className })}\n {...props}\n />\n )\n}\n\nexport interface TableCellProps extends Omit<React.ComponentProps<\"td\">, \"align\"> {\n align?: TableAlign\n /** End-aligned, with figures of one width. */\n numeric?: boolean\n /** Pin the cell to an edge; it takes its row's fill. */\n sticky?: TableSticky\n}\n\nexport function TableCell({ align = \"start\", numeric, sticky, className, ...props }: TableCellProps) {\n const ctx = useTableContext(\"TableCell\")\n return (\n <td\n data-slot=\"table-cell\"\n data-sticky={sticky}\n className={tableVariants({ ...ctx, align, numeric, sticky }).cell({ className })}\n {...props}\n />\n )\n}\n\nexport interface TableCellTextProps extends Omit<React.ComponentProps<\"div\">, \"children\"> {\n primary: React.ReactNode\n secondary?: React.ReactNode\n}\n\n/** Two lines in a cell: a label over a quieter one. */\nexport function TableCellText({ primary, secondary, className, ...props }: TableCellTextProps) {\n return (\n <div data-slot=\"table-cell-text\" className={tableVariants().cellText({ className })} {...props}>\n <span className=\"truncate font-medium text-foreground\">{primary}</span>\n {secondary ? <span className=\"truncate text-xs text-muted-foreground\">{secondary}</span> : null}\n </div>\n )\n}\n\nexport interface TableEmptyProps extends Omit<React.ComponentProps<\"td\">, \"align\"> {\n /** How many columns the message spans. */\n colSpan: number\n}\n\n/** A full-width row for a body with nothing in it. */\nexport function TableEmpty({ colSpan, className, children = \"No results.\", ...props }: TableEmptyProps) {\n return (\n <TableRow data-static=\"\">\n <TableCell\n colSpan={colSpan}\n align=\"center\"\n className={className ?? \"h-24 text-muted-foreground\"}\n {...props}\n >\n {children}\n </TableCell>\n </TableRow>\n )\n}\n"],"mappings":";AA2PQ,cAwGJ,YAxGI;AAzPR,YAAY,WAAW;AAEvB,SAAS,kBAAgC;AACzC,SAAS,UAA6B;AAQtC,MAAM,cAAc;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,E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MACN,WAAW,aAAa;AAAA,MACvB,GAAG;AAAA,MAEH;AAAA;AAAA,EACH,GACF;AAEJ;","names":[]}
@@ -0,0 +1,20 @@
1
+ import {
2
+ TableOfContents,
3
+ TableOfContentsTitle,
4
+ TableOfContentsList,
5
+ TableOfContentsItem,
6
+ tableOfContentsVariants
7
+ } from "./table-of-contents.mjs";
8
+ import { useScrollSpy, computeActive } from "./scroll-spy.mjs";
9
+ import { useHeadings } from "./use-headings.mjs";
10
+ export {
11
+ TableOfContents,
12
+ TableOfContentsItem,
13
+ TableOfContentsList,
14
+ TableOfContentsTitle,
15
+ computeActive,
16
+ tableOfContentsVariants,
17
+ useHeadings,
18
+ useScrollSpy
19
+ };
20
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/ui/table-of-contents/index.ts"],"sourcesContent":["export {\n TableOfContents,\n TableOfContentsTitle,\n TableOfContentsList,\n TableOfContentsItem,\n tableOfContentsVariants,\n type TableOfContentsProps,\n type TableOfContentsTitleProps,\n type TableOfContentsListProps,\n type TableOfContentsItemProps,\n type TableOfContentsVariant,\n} from \"./table-of-contents.mjs\"\nexport { useScrollSpy, computeActive, type ScrollSpyOptions } from \"./scroll-spy.mjs\"\nexport { useHeadings, type Heading } from \"./use-headings.mjs\"\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AACP,SAAS,cAAc,qBAA4C;AACnE,SAAS,mBAAiC;","names":[]}
@@ -0,0 +1,60 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ function find(id, container) {
4
+ if (container) return container.querySelector(`#${CSS.escape(id)}`);
5
+ return document.getElementById(id);
6
+ }
7
+ function computeActive(ids, container) {
8
+ if (ids.length === 0) return null;
9
+ const viewTop = container ? container.getBoundingClientRect().top : 0;
10
+ const viewHeight = container ? container.clientHeight : window.innerHeight;
11
+ const scroller = container ?? document.scrollingElement ?? document.documentElement;
12
+ const scrolled = scroller.scrollTop > 0;
13
+ if (scrolled && scroller.scrollTop + scroller.clientHeight >= scroller.scrollHeight - 2) return ids[ids.length - 1];
14
+ let active = null;
15
+ for (const id of ids) {
16
+ const el = find(id, container);
17
+ if (!el) continue;
18
+ const margin = Number.parseFloat(getComputedStyle(el).scrollMarginTop) || 0;
19
+ const top = el.getBoundingClientRect().top - viewTop - margin;
20
+ if (top <= 1) {
21
+ active = id;
22
+ continue;
23
+ }
24
+ if (top < viewHeight / 2) active = id;
25
+ break;
26
+ }
27
+ return active ?? ids[0];
28
+ }
29
+ function useScrollSpy(ids, options = {}) {
30
+ const { container } = options;
31
+ const [active, setActive] = React.useState(ids[0] ?? null);
32
+ const key = ids.join("\0");
33
+ React.useEffect(() => {
34
+ const list = key ? key.split("\0") : [];
35
+ const pane = container?.current ?? null;
36
+ const target = pane ?? window;
37
+ let frame = 0;
38
+ const read = () => {
39
+ frame = 0;
40
+ setActive(computeActive(list, pane));
41
+ };
42
+ const schedule = () => {
43
+ if (!frame) frame = requestAnimationFrame(read);
44
+ };
45
+ schedule();
46
+ target.addEventListener("scroll", schedule, { passive: true });
47
+ window.addEventListener("resize", schedule);
48
+ return () => {
49
+ cancelAnimationFrame(frame);
50
+ target.removeEventListener("scroll", schedule);
51
+ window.removeEventListener("resize", schedule);
52
+ };
53
+ }, [key, container]);
54
+ return active;
55
+ }
56
+ export {
57
+ computeActive,
58
+ useScrollSpy
59
+ };
60
+ //# sourceMappingURL=scroll-spy.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/ui/table-of-contents/scroll-spy.ts"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\n/*\n * Which section is being read. A heading counts as reached once it sits where an anchor jump\n * would park it: the top of the view plus its own scroll-margin-top, so the spy agrees with the\n * jump under a sticky header without a second offset. The first heading not yet reached wins if\n * it's already in the top half of the view; lower down, the reader is still in the one before it.\n * At the very end of a view that scrolled, the last section wins: closing sections are often too\n * short to ever reach the top.\n */\n\nfunction find(id: string, container: HTMLElement | null) {\n if (container) return container.querySelector<HTMLElement>(`#${CSS.escape(id)}`)\n return document.getElementById(id)\n}\n\nexport function computeActive(ids: readonly string[], container: HTMLElement | null): string | null {\n if (ids.length === 0) return null\n const viewTop = container ? container.getBoundingClientRect().top : 0\n const viewHeight = container ? container.clientHeight : window.innerHeight\n const scroller = container ?? document.scrollingElement ?? document.documentElement\n const scrolled = scroller.scrollTop > 0\n if (scrolled && scroller.scrollTop + scroller.clientHeight >= scroller.scrollHeight - 2) return ids[ids.length - 1]\n\n let active: string | null = null\n for (const id of ids) {\n const el = find(id, container)\n if (!el) continue\n const margin = Number.parseFloat(getComputedStyle(el).scrollMarginTop) || 0\n const top = el.getBoundingClientRect().top - viewTop - margin\n if (top <= 1) {\n active = id\n continue\n }\n if (top < viewHeight / 2) active = id\n break\n }\n return active ?? ids[0]\n}\n\nexport interface ScrollSpyOptions {\n /** A scroll pane to watch instead of the window. */\n container?: React.RefObject<HTMLElement | null>\n}\n\n/** The id of the section being read, for a nav of your own. Starts on the first id. */\nexport function useScrollSpy(ids: readonly string[], options: ScrollSpyOptions = {}) {\n const { container } = options\n const [active, setActive] = React.useState<string | null>(ids[0] ?? null)\n const key = ids.join(\"\\u0000\")\n\n React.useEffect(() => {\n const list = key ? key.split(\"\\u0000\") : []\n const pane = container?.current ?? null\n const target: HTMLElement | Window = pane ?? window\n let frame = 0\n const read = () => {\n frame = 0\n setActive(computeActive(list, pane))\n }\n const schedule = () => {\n if (!frame) frame = requestAnimationFrame(read)\n }\n schedule()\n target.addEventListener(\"scroll\", schedule, { passive: true })\n window.addEventListener(\"resize\", schedule)\n return () => {\n cancelAnimationFrame(frame)\n target.removeEventListener(\"scroll\", schedule)\n window.removeEventListener(\"resize\", schedule)\n }\n }, [key, container])\n\n return active\n}\n"],"mappings":";AAEA,YAAY,WAAW;AAWvB,SAAS,KAAK,IAAY,WAA+B;AACvD,MAAI,UAAW,QAAO,UAAU,cAA2B,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,MAAO,SAAQ,sBAAsB,IAAI;AAAA,IAChD;AACA,aAAS;AACT,WAAO,iBAAiB,UAAU,UAAU,EAAE,SAAS,KAAK,CAAC;AAC7D,WAAO,iBAAiB,UAAU,QAAQ;AAC1C,WAAO,MAAM;AACX,2BAAqB,KAAK;AAC1B,aAAO,oBAAoB,UAAU,QAAQ;AAC7C,aAAO,oBAAoB,UAAU,QAAQ;AAAA,IAC/C;AAAA,EACF,GAAG,CAAC,KAAK,SAAS,CAAC;AAEnB,SAAO;AACT;","names":[]}
@@ -0,0 +1,371 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { Slot } from "radix-ui";
5
+ import { useDensity } from "../../../lib/density.mjs";
6
+ import { tv } from "../../../lib/tv.mjs";
7
+ import { useScrollSpy } from "./scroll-spy.mjs";
8
+ const indicatorBase = [
9
+ "before:pointer-events-none before:absolute before:top-0 before:content-[''] before:h-(--toc-indicator-h) before:translate-y-(--toc-indicator-y) before:opacity-0",
10
+ "data-[indicator=visible]:before:opacity-100 data-indicator-motion:before:transition-[translate,height,opacity] before:duration-base before:ease-out",
11
+ "motion-reduce:before:transition-[opacity] motion-reduce:before:duration-reduced motion-reduce:before:ease-linear"
12
+ ];
13
+ const tableOfContentsVariants = tv({
14
+ slots: {
15
+ root: "group/toc flex flex-col gap-3 self-start",
16
+ title: "eyebrow font-semibold",
17
+ list: "relative flex flex-col [counter-reset:toc]",
18
+ row: "transition-opacity duration-base ease-out starting:opacity-0 data-collapsed:hidden motion-reduce-fade",
19
+ item: [
20
+ "relative flex gap-2 text-sm text-pretty text-muted-foreground outline-none duration-fast ease-out hover:text-foreground",
21
+ "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus aria-[current=location]:text-foreground"
22
+ ],
23
+ number: "shrink-0 tabular-nums",
24
+ minimap: "flex cursor-pointer flex-col items-end gap-2 self-end py-2 pr-0.5 pl-4 transition-opacity duration-base ease-out group-hover/toc:opacity-0 group-has-[:focus-visible]/toc:opacity-0 motion-reduce-fade",
25
+ dash: "h-0.5 w-4 rounded-full bg-muted-foreground/35 transition-[width,background-color] duration-base ease-out motion-reduce-fade data-[level=3]:w-2.5 data-active:w-6 data-active:bg-primary",
26
+ fold: "mt-1 self-start rounded-sm px-2.5 py-1 text-xs font-medium text-muted-foreground hover:text-foreground cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-focus"
27
+ },
28
+ variants: {
29
+ variant: {
30
+ pill: {
31
+ title: "pl-4.5",
32
+ list: [
33
+ "gap-0.5 pl-2",
34
+ indicatorBase,
35
+ "before:right-0 before:left-2 before:rounded-md before:bg-accent",
36
+ "after:pointer-events-none after:absolute after:top-0 after:left-0 after:h-4 after:w-[3px] after:rounded-r-full after:bg-primary after:opacity-0 after:content-['']",
37
+ "after:translate-y-[calc(var(--toc-indicator-y)_+_var(--toc-indicator-h)/2_-_--spacing(2))] data-[indicator=visible]:after:opacity-100",
38
+ "data-indicator-motion:after:transition-[translate,opacity] after:duration-base after:ease-out motion-reduce:after:transition-[opacity]"
39
+ ],
40
+ item: "rounded-md px-2.5 font-medium transition-[color,background-color] hover:bg-accent/60 aria-[current=location]:bg-transparent aria-[current=location]:font-semibold"
41
+ },
42
+ line: {
43
+ title: "pl-4",
44
+ list: [
45
+ "border-l border-border",
46
+ indicatorBase,
47
+ "before:-left-px before:w-0.5 before:rounded-full before:bg-primary"
48
+ ],
49
+ item: [
50
+ "rounded-sm pl-4 pr-2 transition-colors aria-[current=location]:font-medium",
51
+ "before:absolute before:inset-y-0 before:-left-px before:w-px before:bg-foreground/25 before:opacity-0 before:content-[''] before:transition-opacity before:duration-fast before:ease-out hover:before:opacity-100 aria-[current=location]:before:hidden"
52
+ ]
53
+ },
54
+ progress: {
55
+ title: "pl-4",
56
+ list: [
57
+ "border-l border-border",
58
+ indicatorBase,
59
+ "before:-left-px before:w-0.5 before:rounded-full before:bg-primary"
60
+ ],
61
+ item: [
62
+ "rounded-sm pl-4 pr-2 transition-colors aria-[current=location]:font-medium",
63
+ "before:absolute before:inset-y-0 before:-left-px before:w-px before:bg-foreground/25 before:opacity-0 before:content-[''] before:transition-opacity before:duration-fast before:ease-out hover:before:opacity-100 aria-[current=location]:before:hidden"
64
+ ]
65
+ },
66
+ dash: {
67
+ item: [
68
+ "items-start rounded-sm pr-2 transition-colors aria-[current=location]:font-medium",
69
+ "before:mt-2.5 before:h-px before:w-4 before:shrink-0 before:origin-left before:scale-x-50 before:rounded-full before:bg-muted-foreground/40 before:content-['']",
70
+ "before:transition-[scale,background-color] before:duration-base before:ease-out motion-reduce:before:transition-[background-color]",
71
+ "[&:not([aria-current]):hover]:before:scale-x-75 [&:not([aria-current]):hover]:before:bg-muted-foreground",
72
+ "aria-[current=location]:before:scale-x-100 aria-[current=location]:before:bg-primary"
73
+ ]
74
+ },
75
+ plain: {
76
+ item: "rounded-sm pr-2 transition-colors aria-[current=location]:font-medium"
77
+ },
78
+ minimap: {
79
+ root: "relative",
80
+ title: "sr-only",
81
+ list: [
82
+ "absolute top-0 right-0 z-20 w-60 max-w-[calc(100vw-2rem)] p-1 rounded-lg bg-popover text-popover-foreground shadow-lg ring-1 ring-border ring-inset [--surface:var(--popover)]",
83
+ "pointer-events-none opacity-0 [clip-path:inset(0_0_calc(100%-var(--toc-rest-h,0px))_calc(100%-var(--toc-rest-w,0px))_round_var(--radius-lg))]",
84
+ "transition-[opacity,clip-path] duration-base ease-out motion-reduce-fade",
85
+ "group-hover/toc:pointer-events-auto group-hover/toc:opacity-100 group-hover/toc:[clip-path:inset(0_round_var(--radius-lg))]",
86
+ "group-has-[:focus-visible]/toc:pointer-events-auto group-has-[:focus-visible]/toc:opacity-100 group-has-[:focus-visible]/toc:[clip-path:inset(0_round_var(--radius-lg))]"
87
+ ],
88
+ item: "rounded-md px-2 transition-colors hover:bg-accent focus-visible:bg-accent focus-visible:ring-0 aria-[current=location]:bg-accent aria-[current=location]:font-medium"
89
+ }
90
+ },
91
+ density: {
92
+ compact: { item: "py-1 pointer-coarse:py-2.5" },
93
+ comfortable: { item: "py-1.5 pointer-coarse:py-2.5" }
94
+ },
95
+ level: {
96
+ 2: {
97
+ row: "[counter-increment:toc] [counter-reset:toc-sub]",
98
+ number: "before:content-[counter(toc)_'.']"
99
+ },
100
+ 3: {
101
+ row: "[counter-increment:toc-sub]",
102
+ number: "before:content-[counter(toc)_'.'_counter(toc-sub)]"
103
+ }
104
+ }
105
+ },
106
+ compoundVariants: [
107
+ { variant: "pill", level: 3, class: { item: "pl-6.5" } },
108
+ { variant: ["line", "progress"], level: 3, class: { item: "pl-8" } },
109
+ { variant: ["dash", "plain"], level: 3, class: { item: "pl-4" } },
110
+ { variant: "minimap", level: 3, class: { item: "pl-6" } }
111
+ ],
112
+ defaultVariants: { variant: "pill", density: "compact", level: 2 }
113
+ });
114
+ const TocContext = React.createContext(null);
115
+ function useToc(part) {
116
+ const ctx = React.useContext(TocContext);
117
+ if (!ctx) throw new Error(`${part} must be used within <TableOfContents>.`);
118
+ return ctx;
119
+ }
120
+ const idOf = (href) => href && href.startsWith("#") && href.length > 1 ? decodeURIComponent(href.slice(1)) : null;
121
+ function TableOfContents({
122
+ variant = "pill",
123
+ density: densityProp,
124
+ numbered = false,
125
+ value,
126
+ defaultValue,
127
+ onValueChange,
128
+ container,
129
+ className,
130
+ children,
131
+ "aria-label": ariaLabel = "On this page",
132
+ ...props
133
+ }) {
134
+ const density = useDensity(densityProp);
135
+ const navRef = React.useRef(null);
136
+ const [ids, setIds] = React.useState([]);
137
+ const [held, setHeld] = React.useState(null);
138
+ const [started, setStarted] = React.useState(false);
139
+ React.useEffect(() => {
140
+ const nav = navRef.current;
141
+ if (!nav) return;
142
+ const collect = () => {
143
+ const next = Array.from(nav.querySelectorAll("[data-toc-id]")).map((el) => el.dataset.tocId ?? "");
144
+ setIds((prev) => prev.join("\0") === next.join("\0") ? prev : next);
145
+ setStarted(true);
146
+ };
147
+ queueMicrotask(collect);
148
+ const observer = new MutationObserver(collect);
149
+ observer.observe(nav, {
150
+ childList: true,
151
+ subtree: true,
152
+ attributes: true,
153
+ attributeFilter: ["data-toc-id"]
154
+ });
155
+ return () => observer.disconnect();
156
+ }, []);
157
+ const spied = useScrollSpy(ids, { container });
158
+ const reading = started && ids.length > 0 ? spied : defaultValue ?? null;
159
+ const active = value ?? held ?? reading;
160
+ React.useEffect(() => {
161
+ if (!held) return;
162
+ const target = container?.current ?? window;
163
+ const release = () => setHeld(null);
164
+ const onKey = (event) => {
165
+ if (["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End", " "].includes(event.key)) release();
166
+ };
167
+ target.addEventListener("wheel", release, { passive: true });
168
+ target.addEventListener("touchmove", release, { passive: true });
169
+ window.addEventListener("keydown", onKey);
170
+ return () => {
171
+ target.removeEventListener("wheel", release);
172
+ target.removeEventListener("touchmove", release);
173
+ window.removeEventListener("keydown", onKey);
174
+ };
175
+ }, [held, container]);
176
+ const reported = React.useRef(null);
177
+ React.useEffect(() => {
178
+ const current = held ?? reading;
179
+ if (!current || current === reported.current) return;
180
+ reported.current = current;
181
+ onValueChange?.(current);
182
+ }, [held, reading, onValueChange]);
183
+ const select = (id, event) => {
184
+ setHeld(id);
185
+ const pane = container?.current;
186
+ if (!pane) return;
187
+ const heading = pane.querySelector(`#${CSS.escape(id)}`);
188
+ if (!heading) return;
189
+ event.preventDefault();
190
+ const margin = Number.parseFloat(getComputedStyle(heading).scrollMarginTop) || 0;
191
+ const top = heading.getBoundingClientRect().top - pane.getBoundingClientRect().top + pane.scrollTop - margin;
192
+ const reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
193
+ pane.scrollTo({ top, behavior: reduce ? "auto" : "smooth" });
194
+ history.replaceState(null, "", `#${id}`);
195
+ };
196
+ const context = {
197
+ variant,
198
+ density,
199
+ numbered,
200
+ active,
201
+ container,
202
+ select
203
+ };
204
+ return /* @__PURE__ */ jsx(TocContext.Provider, { value: context, children: /* @__PURE__ */ jsx(
205
+ "nav",
206
+ {
207
+ ref: navRef,
208
+ "aria-label": ariaLabel,
209
+ "data-slot": "table-of-contents",
210
+ className: tableOfContentsVariants({ variant }).root({ className }),
211
+ ...props,
212
+ children
213
+ }
214
+ ) });
215
+ }
216
+ function TableOfContentsTitle({ asChild = false, className, ...props }) {
217
+ const { variant } = useToc("TableOfContentsTitle");
218
+ const Comp = asChild ? Slot.Root : "p";
219
+ return /* @__PURE__ */ jsx(
220
+ Comp,
221
+ {
222
+ "data-slot": "table-of-contents-title",
223
+ className: tableOfContentsVariants({ variant }).title({ className }),
224
+ ...props
225
+ }
226
+ );
227
+ }
228
+ const ListContext = React.createContext({
229
+ folded: () => false
230
+ });
231
+ const IndexContext = React.createContext(0);
232
+ function TableOfContentsList({
233
+ limit,
234
+ moreLabel = (hidden) => `Show ${hidden} more`,
235
+ lessLabel = "Show less",
236
+ className,
237
+ children,
238
+ ...props
239
+ }) {
240
+ const { variant, active } = useToc("TableOfContentsList");
241
+ const listRef = React.useRef(null);
242
+ const columnRef = React.useRef(null);
243
+ const items = React.Children.toArray(children).filter(React.isValidElement);
244
+ const activeIndex = items.findIndex((item) => idOf(item.props.href) === active);
245
+ const foldable = limit !== void 0 && items.length - limit > 2;
246
+ const [open, setOpen] = React.useState(false);
247
+ const expanded = !foldable || open || activeIndex >= (limit ?? Infinity);
248
+ const listContext = React.useMemo(
249
+ () => ({ folded: (index) => !expanded && index >= (limit ?? Infinity) }),
250
+ [expanded, limit]
251
+ );
252
+ const sliding = variant === "pill" || variant === "line" || variant === "progress";
253
+ React.useLayoutEffect(() => {
254
+ const list = listRef.current;
255
+ if (!list) return;
256
+ const place = () => {
257
+ const row = active ? list.querySelector(`[data-toc-id="${CSS.escape(active)}"]`)?.closest("li") : null;
258
+ if (!sliding || !row || row.offsetParent === null) {
259
+ list.removeAttribute("data-indicator");
260
+ return;
261
+ }
262
+ const y = variant === "progress" ? 0 : row.offsetTop;
263
+ const h = variant === "progress" ? row.offsetTop + row.offsetHeight : row.offsetHeight;
264
+ list.style.setProperty("--toc-indicator-y", `${y}px`);
265
+ list.style.setProperty("--toc-indicator-h", `${h}px`);
266
+ if (list.getAttribute("data-indicator") !== "visible") {
267
+ list.setAttribute("data-indicator", "visible");
268
+ requestAnimationFrame(() => list.setAttribute("data-indicator-motion", ""));
269
+ }
270
+ const rail = list.closest("[data-slot=table-of-contents]");
271
+ for (const el of [rail, rail?.parentElement]) {
272
+ if (!el || el.scrollHeight <= el.clientHeight + 1) continue;
273
+ const style = getComputedStyle(el);
274
+ if (!/(auto|scroll)/.test(style.overflowY)) continue;
275
+ const rowTop = row.getBoundingClientRect().top - el.getBoundingClientRect().top + el.scrollTop;
276
+ if (rowTop < el.scrollTop) el.scrollTop = rowTop;
277
+ else if (rowTop + row.offsetHeight > el.scrollTop + el.clientHeight)
278
+ el.scrollTop = rowTop + row.offsetHeight - el.clientHeight;
279
+ break;
280
+ }
281
+ };
282
+ place();
283
+ const observer = new ResizeObserver(place);
284
+ observer.observe(list);
285
+ return () => observer.disconnect();
286
+ }, [active, sliding, variant, expanded]);
287
+ React.useLayoutEffect(() => {
288
+ const list = listRef.current;
289
+ const column = columnRef.current;
290
+ if (!list || !column) return;
291
+ const write = () => {
292
+ list.style.setProperty("--toc-rest-w", `${column.offsetWidth}px`);
293
+ list.style.setProperty("--toc-rest-h", `${column.offsetHeight}px`);
294
+ };
295
+ write();
296
+ const observer = new ResizeObserver(write);
297
+ observer.observe(column);
298
+ return () => observer.disconnect();
299
+ }, [variant]);
300
+ const slots = tableOfContentsVariants({ variant });
301
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
302
+ variant === "minimap" ? /* @__PURE__ */ jsx("div", { ref: columnRef, "aria-hidden": true, "data-slot": "table-of-contents-minimap", className: slots.minimap(), children: items.map((item, index) => {
303
+ const id = idOf(item.props.href);
304
+ return /* @__PURE__ */ jsx(
305
+ "span",
306
+ {
307
+ "data-level": item.props.level ?? 2,
308
+ "data-active": id !== null && id === active ? "" : void 0,
309
+ className: slots.dash()
310
+ },
311
+ id ?? index
312
+ );
313
+ }) }) : null,
314
+ /* @__PURE__ */ jsx(ListContext.Provider, { value: listContext, children: /* @__PURE__ */ jsxs("ol", { ref: listRef, "data-slot": "table-of-contents-list", className: slots.list({ className }), ...props, children: [
315
+ React.Children.map(children, (child, index) => /* @__PURE__ */ jsx(IndexContext.Provider, { value: index, children: child })),
316
+ foldable ? /* @__PURE__ */ jsx("li", { className: "list-none", children: /* @__PURE__ */ jsx(
317
+ "button",
318
+ {
319
+ type: "button",
320
+ className: slots.fold(),
321
+ "aria-expanded": expanded,
322
+ onClick: () => setOpen((o) => !o),
323
+ children: expanded ? lessLabel : moreLabel(items.length - (limit ?? 0))
324
+ }
325
+ ) }) : null
326
+ ] }) })
327
+ ] });
328
+ }
329
+ function TableOfContentsItem({
330
+ href,
331
+ level = 2,
332
+ className,
333
+ children,
334
+ onClick,
335
+ ...props
336
+ }) {
337
+ const { variant, density, numbered, active, select } = useToc("TableOfContentsItem");
338
+ const { folded } = React.useContext(ListContext);
339
+ const index = React.useContext(IndexContext);
340
+ const id = idOf(href);
341
+ const current = id !== null && id === active;
342
+ const slots = tableOfContentsVariants({ variant, density, level });
343
+ return /* @__PURE__ */ jsx("li", { "data-slot": "table-of-contents-row", "data-collapsed": folded(index) || void 0, className: slots.row(), children: /* @__PURE__ */ jsxs(
344
+ "a",
345
+ {
346
+ href,
347
+ "data-slot": "table-of-contents-item",
348
+ "data-level": level,
349
+ "data-toc-id": id ?? void 0,
350
+ "aria-current": current ? "location" : void 0,
351
+ className: slots.item({ className }),
352
+ onClick: (event) => {
353
+ onClick?.(event);
354
+ if (!event.defaultPrevented && id) select(id, event);
355
+ },
356
+ ...props,
357
+ children: [
358
+ numbered ? /* @__PURE__ */ jsx("span", { "aria-hidden": true, "data-slot": "table-of-contents-number", className: slots.number() }) : null,
359
+ /* @__PURE__ */ jsx("span", { className: "min-w-0", children })
360
+ ]
361
+ }
362
+ ) });
363
+ }
364
+ export {
365
+ TableOfContents,
366
+ TableOfContentsItem,
367
+ TableOfContentsList,
368
+ TableOfContentsTitle,
369
+ tableOfContentsVariants
370
+ };
371
+ //# sourceMappingURL=table-of-contents.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/ui/table-of-contents/table-of-contents.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Slot } from \"radix-ui\"\n\nimport { useDensity, type Density } from \"../../../lib/density.mjs\"\nimport { tv } from \"../../../lib/tv.mjs\"\n\nimport { useScrollSpy } from \"./scroll-spy.mjs\"\n\n/*\n * The on-this-page nav beside a long document. Its items are plain anchors, so the jump, the hash\n * and the back button stay the browser's; the nav reads the ids its own links point at and spies\n * on those headings (see scroll-spy.ts), marking the section being read with an indicator the list\n * draws as its own ::before / ::after, positioned by --toc-indicator-y/h. Six looks share one\n * behaviour.\n */\nconst indicatorBase = [\n \"before:pointer-events-none before:absolute before:top-0 before:content-[''] before:h-(--toc-indicator-h) before:translate-y-(--toc-indicator-y) before:opacity-0\",\n \"data-[indicator=visible]:before:opacity-100 data-indicator-motion:before:transition-[translate,height,opacity] before:duration-base before:ease-out\",\n \"motion-reduce:before:transition-[opacity] motion-reduce:before:duration-reduced motion-reduce:before:ease-linear\",\n]\n\nexport const tableOfContentsVariants = tv({\n slots: {\n root: \"group/toc flex flex-col gap-3 self-start\",\n title: \"eyebrow font-semibold\",\n list: \"relative flex flex-col [counter-reset:toc]\",\n row: \"transition-opacity duration-base ease-out starting:opacity-0 data-collapsed:hidden motion-reduce-fade\",\n item: [\n \"relative flex gap-2 text-sm text-pretty text-muted-foreground outline-none duration-fast ease-out hover:text-foreground\",\n \"focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus aria-[current=location]:text-foreground\",\n ],\n number: \"shrink-0 tabular-nums\",\n minimap:\n \"flex cursor-pointer flex-col items-end gap-2 self-end py-2 pr-0.5 pl-4 transition-opacity duration-base ease-out group-hover/toc:opacity-0 group-has-[:focus-visible]/toc:opacity-0 motion-reduce-fade\",\n dash: \"h-0.5 w-4 rounded-full bg-muted-foreground/35 transition-[width,background-color] duration-base ease-out motion-reduce-fade data-[level=3]:w-2.5 data-active:w-6 data-active:bg-primary\",\n fold: \"mt-1 self-start rounded-sm px-2.5 py-1 text-xs font-medium text-muted-foreground hover:text-foreground cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-focus\",\n },\n variants: {\n variant: {\n pill: {\n title: \"pl-4.5\",\n list: [\n \"gap-0.5 pl-2\",\n indicatorBase,\n \"before:right-0 before:left-2 before:rounded-md before:bg-accent\",\n \"after:pointer-events-none after:absolute after:top-0 after:left-0 after:h-4 after:w-[3px] after:rounded-r-full after:bg-primary after:opacity-0 after:content-['']\",\n \"after:translate-y-[calc(var(--toc-indicator-y)_+_var(--toc-indicator-h)/2_-_--spacing(2))] data-[indicator=visible]:after:opacity-100\",\n \"data-indicator-motion:after:transition-[translate,opacity] after:duration-base after:ease-out motion-reduce:after:transition-[opacity]\",\n ],\n item: \"rounded-md px-2.5 font-medium transition-[color,background-color] hover:bg-accent/60 aria-[current=location]:bg-transparent aria-[current=location]:font-semibold\",\n },\n line: {\n title: \"pl-4\",\n list: [\n \"border-l border-border\",\n indicatorBase,\n \"before:-left-px before:w-0.5 before:rounded-full before:bg-primary\",\n ],\n item: [\n \"rounded-sm pl-4 pr-2 transition-colors aria-[current=location]:font-medium\",\n \"before:absolute before:inset-y-0 before:-left-px before:w-px before:bg-foreground/25 before:opacity-0 before:content-[''] before:transition-opacity before:duration-fast before:ease-out hover:before:opacity-100 aria-[current=location]:before:hidden\",\n ],\n },\n progress: {\n title: \"pl-4\",\n list: [\n \"border-l border-border\",\n indicatorBase,\n \"before:-left-px before:w-0.5 before:rounded-full before:bg-primary\",\n ],\n item: [\n \"rounded-sm pl-4 pr-2 transition-colors aria-[current=location]:font-medium\",\n \"before:absolute before:inset-y-0 before:-left-px before:w-px before:bg-foreground/25 before:opacity-0 before:content-[''] before:transition-opacity before:duration-fast before:ease-out hover:before:opacity-100 aria-[current=location]:before:hidden\",\n ],\n },\n dash: {\n item: [\n \"items-start rounded-sm pr-2 transition-colors aria-[current=location]:font-medium\",\n \"before:mt-2.5 before:h-px before:w-4 before:shrink-0 before:origin-left before:scale-x-50 before:rounded-full before:bg-muted-foreground/40 before:content-['']\",\n \"before:transition-[scale,background-color] before:duration-base before:ease-out motion-reduce:before:transition-[background-color]\",\n \"[&:not([aria-current]):hover]:before:scale-x-75 [&:not([aria-current]):hover]:before:bg-muted-foreground\",\n \"aria-[current=location]:before:scale-x-100 aria-[current=location]:before:bg-primary\",\n ],\n },\n plain: {\n item: \"rounded-sm pr-2 transition-colors aria-[current=location]:font-medium\",\n },\n minimap: {\n root: \"relative\",\n title: \"sr-only\",\n list: [\n \"absolute top-0 right-0 z-20 w-60 max-w-[calc(100vw-2rem)] p-1 rounded-lg bg-popover text-popover-foreground shadow-lg ring-1 ring-border ring-inset [--surface:var(--popover)]\",\n \"pointer-events-none opacity-0 [clip-path:inset(0_0_calc(100%-var(--toc-rest-h,0px))_calc(100%-var(--toc-rest-w,0px))_round_var(--radius-lg))]\",\n \"transition-[opacity,clip-path] duration-base ease-out motion-reduce-fade\",\n \"group-hover/toc:pointer-events-auto group-hover/toc:opacity-100 group-hover/toc:[clip-path:inset(0_round_var(--radius-lg))]\",\n \"group-has-[:focus-visible]/toc:pointer-events-auto group-has-[:focus-visible]/toc:opacity-100 group-has-[:focus-visible]/toc:[clip-path:inset(0_round_var(--radius-lg))]\",\n ],\n item: \"rounded-md px-2 transition-colors hover:bg-accent focus-visible:bg-accent focus-visible:ring-0 aria-[current=location]:bg-accent aria-[current=location]:font-medium\",\n },\n },\n density: {\n compact: { item: \"py-1 pointer-coarse:py-2.5\" },\n comfortable: { item: \"py-1.5 pointer-coarse:py-2.5\" },\n },\n level: {\n 2: {\n row: \"[counter-increment:toc] [counter-reset:toc-sub]\",\n number: \"before:content-[counter(toc)_'.']\",\n },\n 3: {\n row: \"[counter-increment:toc-sub]\",\n number: \"before:content-[counter(toc)_'.'_counter(toc-sub)]\",\n },\n },\n },\n compoundVariants: [\n { variant: \"pill\", level: 3, class: { item: \"pl-6.5\" } },\n { variant: [\"line\", \"progress\"], level: 3, class: { item: \"pl-8\" } },\n { variant: [\"dash\", \"plain\"], level: 3, class: { item: \"pl-4\" } },\n { variant: \"minimap\", level: 3, class: { item: \"pl-6\" } },\n ],\n defaultVariants: { variant: \"pill\", density: \"compact\", level: 2 },\n})\n\nexport type TableOfContentsVariant = \"pill\" | \"line\" | \"progress\" | \"dash\" | \"plain\" | \"minimap\"\n\ninterface TocContextValue {\n variant: TableOfContentsVariant\n density: Density\n numbered: boolean\n active: string | null\n container: React.RefObject<HTMLElement | null> | undefined\n select: (id: string, event: React.MouseEvent<HTMLAnchorElement>) => void\n}\n\nconst TocContext = React.createContext<TocContextValue | null>(null)\n\nfunction useToc(part: string) {\n const ctx = React.useContext(TocContext)\n if (!ctx) throw new Error(`${part} must be used within <TableOfContents>.`)\n return ctx\n}\n\nconst idOf = (href: string | undefined) =>\n href && href.startsWith(\"#\") && href.length > 1 ? decodeURIComponent(href.slice(1)) : null\n\nexport interface TableOfContentsProps extends React.ComponentProps<\"nav\"> {\n /** Six looks over one behaviour. */\n variant?: TableOfContentsVariant\n /** 28px or 32px rows (44px on touch). Falls back to the nearest DensityProvider. */\n density?: Density\n /** Number the items (1., and 2.1 for a level-3 item). */\n numbered?: boolean\n /** The active section's id, to drive the mark yourself. The spy still reports through onValueChange. */\n value?: string\n /** The section marked before the spy's first reading, so the server render already has one. */\n defaultValue?: string\n /** Called with the id of the section being read, as the reader scrolls or clicks an item. */\n onValueChange?: (id: string) => void\n /** A scroll pane to watch instead of the window; items then scroll the pane alone. */\n container?: React.RefObject<HTMLElement | null>\n}\n\nexport function TableOfContents({\n variant = \"pill\",\n density: densityProp,\n numbered = false,\n value,\n defaultValue,\n onValueChange,\n container,\n className,\n children,\n \"aria-label\": ariaLabel = \"On this page\",\n ...props\n}: TableOfContentsProps) {\n const density = useDensity(densityProp)\n const navRef = React.useRef<HTMLElement>(null)\n const [ids, setIds] = React.useState<string[]>([])\n const [held, setHeld] = React.useState<string | null>(null)\n const [started, setStarted] = React.useState(false)\n\n // The ids the nav's own links point at, in document order, read again whenever its items change.\n React.useEffect(() => {\n const nav = navRef.current\n if (!nav) return\n const collect = () => {\n const next = Array.from(nav.querySelectorAll<HTMLElement>(\"[data-toc-id]\")).map((el) => el.dataset.tocId ?? \"\")\n setIds((prev) => (prev.join(\"\\u0000\") === next.join(\"\\u0000\") ? prev : next))\n setStarted(true)\n }\n queueMicrotask(collect)\n const observer = new MutationObserver(collect)\n observer.observe(nav, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: [\"data-toc-id\"],\n })\n return () => observer.disconnect()\n }, [])\n\n const spied = useScrollSpy(ids, { container })\n const reading = started && ids.length > 0 ? spied : (defaultValue ?? null)\n const active = value ?? held ?? reading\n\n // A clicked item holds the mark while the page travels, until the reader scrolls themselves.\n React.useEffect(() => {\n if (!held) return\n const target: HTMLElement | Window = container?.current ?? window\n const release = () => setHeld(null)\n const onKey = (event: KeyboardEvent) => {\n if ([\"ArrowUp\", \"ArrowDown\", \"PageUp\", \"PageDown\", \"Home\", \"End\", \" \"].includes(event.key)) release()\n }\n target.addEventListener(\"wheel\", release, { passive: true })\n target.addEventListener(\"touchmove\", release, { passive: true })\n window.addEventListener(\"keydown\", onKey)\n return () => {\n target.removeEventListener(\"wheel\", release)\n target.removeEventListener(\"touchmove\", release)\n window.removeEventListener(\"keydown\", onKey)\n }\n }, [held, container])\n\n // Report the section being read as it changes.\n const reported = React.useRef<string | null>(null)\n React.useEffect(() => {\n const current = held ?? reading\n if (!current || current === reported.current) return\n reported.current = current\n onValueChange?.(current)\n }, [held, reading, onValueChange])\n\n const select = (id: string, event: React.MouseEvent<HTMLAnchorElement>) => {\n setHeld(id)\n const pane = container?.current\n if (!pane) return\n // In a pane, scroll the pane alone: a native jump would move the page around it too.\n const heading = pane.querySelector<HTMLElement>(`#${CSS.escape(id)}`)\n if (!heading) return\n event.preventDefault()\n const margin = Number.parseFloat(getComputedStyle(heading).scrollMarginTop) || 0\n const top = heading.getBoundingClientRect().top - pane.getBoundingClientRect().top + pane.scrollTop - margin\n const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches\n pane.scrollTo({ top, behavior: reduce ? \"auto\" : \"smooth\" })\n history.replaceState(null, \"\", `#${id}`)\n }\n\n const context: TocContextValue = {\n variant,\n density,\n numbered,\n active,\n container,\n select,\n }\n\n return (\n <TocContext.Provider value={context}>\n <nav\n ref={navRef}\n aria-label={ariaLabel}\n data-slot=\"table-of-contents\"\n className={tableOfContentsVariants({ variant }).root({ className })}\n {...props}\n >\n {children}\n </nav>\n </TocContext.Provider>\n )\n}\n\nexport interface TableOfContentsTitleProps extends React.ComponentProps<\"p\"> {\n /** Render your own element instead, such as an <h2>. */\n asChild?: boolean\n}\n\n/** The overline above the list (visually hidden on minimap). */\nexport function TableOfContentsTitle({ asChild = false, className, ...props }: TableOfContentsTitleProps) {\n const { variant } = useToc(\"TableOfContentsTitle\")\n const Comp = asChild ? Slot.Root : \"p\"\n return (\n <Comp\n data-slot=\"table-of-contents-title\"\n className={tableOfContentsVariants({ variant }).title({ className })}\n {...props}\n />\n )\n}\n\ninterface ListContextValue {\n folded: (index: number) => boolean\n}\n\nconst ListContext = React.createContext<ListContextValue>({\n folded: () => false,\n})\nconst IndexContext = React.createContext(0)\n\nexport interface TableOfContentsListProps extends React.ComponentProps<\"ol\"> {\n /** Show this many items and fold the rest behind a \"Show N more\" button. */\n limit?: number\n /** The folded button's label, given the count it hides. */\n moreLabel?: (hidden: number) => React.ReactNode\n /** The button's label once the list is open. */\n lessLabel?: React.ReactNode\n}\n\n/** The <ol>. It draws the indicator as its own ::before/::after; on minimap it is the panel, beside the dash column. */\nexport function TableOfContentsList({\n limit,\n moreLabel = (hidden) => `Show ${hidden} more`,\n lessLabel = \"Show less\",\n className,\n children,\n ...props\n}: TableOfContentsListProps) {\n const { variant, active } = useToc(\"TableOfContentsList\")\n const listRef = React.useRef<HTMLOListElement>(null)\n const columnRef = React.useRef<HTMLDivElement>(null)\n const items = React.Children.toArray(children).filter(React.isValidElement) as React.ReactElement<{\n href?: string\n level?: 2 | 3\n }>[]\n const activeIndex = items.findIndex((item) => idOf(item.props.href) === active)\n\n // Lists only a couple over the limit stay whole; a folded list opens on its own for its active item.\n const foldable = limit !== undefined && items.length - limit > 2\n const [open, setOpen] = React.useState(false)\n const expanded = !foldable || open || activeIndex >= (limit ?? Infinity)\n const listContext = React.useMemo<ListContextValue>(\n () => ({ folded: (index) => !expanded && index >= (limit ?? Infinity) }),\n [expanded, limit],\n )\n\n const sliding = variant === \"pill\" || variant === \"line\" || variant === \"progress\"\n\n // Place the indicator on the active row, written straight to the list so measuring never renders.\n React.useLayoutEffect(() => {\n const list = listRef.current\n if (!list) return\n const place = () => {\n const row = active\n ? list.querySelector<HTMLElement>(`[data-toc-id=\"${CSS.escape(active)}\"]`)?.closest(\"li\")\n : null\n if (!sliding || !row || row.offsetParent === null) {\n list.removeAttribute(\"data-indicator\")\n return\n }\n const y = variant === \"progress\" ? 0 : row.offsetTop\n const h = variant === \"progress\" ? row.offsetTop + row.offsetHeight : row.offsetHeight\n list.style.setProperty(\"--toc-indicator-y\", `${y}px`)\n list.style.setProperty(\"--toc-indicator-h\", `${h}px`)\n if (list.getAttribute(\"data-indicator\") !== \"visible\") {\n list.setAttribute(\"data-indicator\", \"visible\")\n // Armed a frame later, so the mark never slides in on load.\n requestAnimationFrame(() => list.setAttribute(\"data-indicator-motion\", \"\"))\n }\n // A rail that scrolls on its own keeps the active item in view, scrolling only itself.\n const rail = list.closest<HTMLElement>(\"[data-slot=table-of-contents]\")\n for (const el of [rail, rail?.parentElement]) {\n if (!el || el.scrollHeight <= el.clientHeight + 1) continue\n const style = getComputedStyle(el)\n if (!/(auto|scroll)/.test(style.overflowY)) continue\n const rowTop = row.getBoundingClientRect().top - el.getBoundingClientRect().top + el.scrollTop\n if (rowTop < el.scrollTop) el.scrollTop = rowTop\n else if (rowTop + row.offsetHeight > el.scrollTop + el.clientHeight)\n el.scrollTop = rowTop + row.offsetHeight - el.clientHeight\n break\n }\n }\n place()\n const observer = new ResizeObserver(place)\n observer.observe(list)\n return () => observer.disconnect()\n }, [active, sliding, variant, expanded])\n\n // The minimap panel grows out of the dash column's corner.\n React.useLayoutEffect(() => {\n const list = listRef.current\n const column = columnRef.current\n if (!list || !column) return\n const write = () => {\n list.style.setProperty(\"--toc-rest-w\", `${column.offsetWidth}px`)\n list.style.setProperty(\"--toc-rest-h\", `${column.offsetHeight}px`)\n }\n write()\n const observer = new ResizeObserver(write)\n observer.observe(column)\n return () => observer.disconnect()\n }, [variant])\n\n const slots = tableOfContentsVariants({ variant })\n return (\n <>\n {variant === \"minimap\" ? (\n <div ref={columnRef} aria-hidden data-slot=\"table-of-contents-minimap\" className={slots.minimap()}>\n {items.map((item, index) => {\n const id = idOf(item.props.href)\n return (\n <span\n key={id ?? index}\n data-level={item.props.level ?? 2}\n data-active={id !== null && id === active ? \"\" : undefined}\n className={slots.dash()}\n />\n )\n })}\n </div>\n ) : null}\n <ListContext.Provider value={listContext}>\n <ol ref={listRef} data-slot=\"table-of-contents-list\" className={slots.list({ className })} {...props}>\n {React.Children.map(children, (child, index) => (\n <IndexContext.Provider value={index}>{child}</IndexContext.Provider>\n ))}\n {foldable ? (\n <li className=\"list-none\">\n <button\n type=\"button\"\n className={slots.fold()}\n aria-expanded={expanded}\n onClick={() => setOpen((o) => !o)}\n >\n {expanded ? lessLabel : moreLabel(items.length - (limit ?? 0))}\n </button>\n </li>\n ) : null}\n </ol>\n </ListContext.Provider>\n </>\n )\n}\n\nexport interface TableOfContentsItemProps extends React.ComponentProps<\"a\"> {\n /** \"#\" plus the heading's id, which the spy watches. A link that leaves the page is shown but not spied. */\n href: string\n /** A section, or a subsection that steps in under its parent. */\n level?: 2 | 3\n}\n\n/** One link in its <li>. The active item carries aria-current=\"location\". */\nexport function TableOfContentsItem({\n href,\n level = 2,\n className,\n children,\n onClick,\n ...props\n}: TableOfContentsItemProps) {\n const { variant, density, numbered, active, select } = useToc(\"TableOfContentsItem\")\n const { folded } = React.useContext(ListContext)\n const index = React.useContext(IndexContext)\n const id = idOf(href)\n const current = id !== null && id === active\n const slots = tableOfContentsVariants({ variant, density, level })\n return (\n <li data-slot=\"table-of-contents-row\" data-collapsed={folded(index) || undefined} className={slots.row()}>\n <a\n href={href}\n data-slot=\"table-of-contents-item\"\n data-level={level}\n data-toc-id={id ?? undefined}\n aria-current={current ? \"location\" : undefined}\n className={slots.item({ className })}\n onClick={(event) => {\n onClick?.(event)\n if (!event.defaultPrevented && id) select(id, event)\n }}\n {...props}\n >\n {numbered ? <span aria-hidden data-slot=\"table-of-contents-number\" className={slots.number()} /> : null}\n <span className=\"min-w-0\">{children}</span>\n </a>\n </li>\n )\n}\n"],"mappings":";AAqQM,SAuIF,UAvIE,KAwJE,YAxJF;AAnQN,YAAY,WAAW;AACvB,SAAS,YAAY;AAErB,SAAS,kBAAgC;AACzC,SAAS,UAAU;AAEnB,SAAS,oBAAoB;AAS7B,MAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,0BAA0B,GAAG;AAAA,EACxC,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,IACN,KAAK;AAAA,IACL,MAAM;AAAA,MACJ;AAAA,MACA;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,IACR,SACE;AAAA,IACF,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AAAA,EACA,UAAU;AAAA,IACR,SAAS;AAAA,MACP,MAAM;AAAA,QACJ,OAAO;AAAA,QACP,MAAM;AAAA,UACJ;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QACA,MAAM;AAAA,MACR;AAAA,MACA,MAAM;AAAA,QACJ,OAAO;AAAA,QACP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AAM,QAAQ,wBAAwB,EAAE,SAAS,SAAS,MAAM,CAAC;AACjE,SACE,oBAAC,QAAG,aAAU,yBAAwB,kBAAgB,OAAO,KAAK,KAAK,QAAW,WAAW,MAAM,IAAI,GACrG;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,aAAU;AAAA,MACV,cAAY;AAAA,MACZ,eAAa,MAAM;AAAA,MACnB,gBAAc,UAAU,aAAa;AAAA,MACrC,WAAW,MAAM,KAAK,EAAE,UAAU,CAAC;AAAA,MACnC,SAAS,CAAC,UAAU;AAClB,kBAAU,KAAK;AACf,YAAI,CAAC,MAAM,oBAAoB,GAAI,QAAO,IAAI,KAAK;AAAA,MACrD;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,mBAAW,oBAAC,UAAK,eAAW,MAAC,aAAU,4BAA2B,WAAW,MAAM,OAAO,GAAG,IAAK;AAAA,QACnG,oBAAC,UAAK,WAAU,WAAW,UAAS;AAAA;AAAA;AAAA,EACtC,GACF;AAEJ;","names":[]}
@@ -0,0 +1,40 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ const EMPTY = [];
4
+ function labelOf(heading) {
5
+ const own = heading.querySelector("[data-slot=heading-text]");
6
+ if (own) return (own.textContent ?? "").trim();
7
+ const clone = heading.cloneNode(true);
8
+ clone.querySelectorAll("button, [aria-hidden='true']").forEach((el) => el.remove());
9
+ clone.querySelectorAll("a").forEach((a) => {
10
+ if ((a.textContent ?? "").trim() === "#") a.remove();
11
+ });
12
+ return (clone.textContent ?? "").trim();
13
+ }
14
+ function read(selector) {
15
+ const found = Array.from(document.querySelectorAll(selector)).filter((h) => h.id);
16
+ if (found.length === 0) return EMPTY;
17
+ const depths = found.map((h) => Number(h.tagName.slice(1)) || 2);
18
+ const top = Math.min(...depths);
19
+ return found.map((h, i) => ({ id: h.id, text: labelOf(h), level: depths[i] > top ? 3 : 2 }));
20
+ }
21
+ function useHeadings(selector = "h2[id], h3[id]", key) {
22
+ const cache = React.useRef({ json: "[]", value: EMPTY });
23
+ const subscribe = React.useCallback((onChange) => {
24
+ const observer = new MutationObserver(onChange);
25
+ observer.observe(document.body, { childList: true, subtree: true, characterData: true });
26
+ return () => observer.disconnect();
27
+ }, []);
28
+ const getSnapshot = React.useCallback(() => {
29
+ void key;
30
+ const next = read(selector);
31
+ const json = JSON.stringify(next);
32
+ if (json !== cache.current.json) cache.current = { json, value: next };
33
+ return cache.current.value;
34
+ }, [selector, key]);
35
+ return React.useSyncExternalStore(subscribe, getSnapshot, () => EMPTY);
36
+ }
37
+ export {
38
+ useHeadings
39
+ };
40
+ //# sourceMappingURL=use-headings.mjs.map