@cognite/aura 0.3.5 → 1.46104.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 (446) hide show
  1. package/CHANGELOG.md +264 -0
  2. package/DESIGN.md +638 -281
  3. package/LICENSE +21 -0
  4. package/README.md +21 -13
  5. package/dist/colors-deprecated.css +587 -0
  6. package/dist/colors.css +803 -830
  7. package/dist/components/index.d.ts +63 -57
  8. package/dist/components/index.js +62 -59
  9. package/dist/components/index.js.map +1 -0
  10. package/dist/components/ui/core/accordion/accordion.d.ts +19 -18
  11. package/dist/components/ui/core/accordion/accordion.js +99 -78
  12. package/dist/components/ui/core/accordion/accordion.js.map +1 -0
  13. package/dist/components/ui/core/action-toolbar/action-toolbar-motion.d.ts +8 -0
  14. package/dist/components/ui/core/action-toolbar/action-toolbar-motion.js +125 -0
  15. package/dist/components/ui/core/action-toolbar/action-toolbar-motion.js.map +1 -0
  16. package/dist/components/ui/core/action-toolbar/action-toolbar.d.ts +31 -31
  17. package/dist/components/ui/core/action-toolbar/action-toolbar.js +156 -106
  18. package/dist/components/ui/core/action-toolbar/action-toolbar.js.map +1 -0
  19. package/dist/components/ui/core/alert/alert.d.ts +25 -25
  20. package/dist/components/ui/core/alert/alert.js +181 -152
  21. package/dist/components/ui/core/alert/alert.js.map +1 -0
  22. package/dist/components/ui/core/avatar/avatar.d.ts +10 -9
  23. package/dist/components/ui/core/avatar/avatar.js +75 -65
  24. package/dist/components/ui/core/avatar/avatar.js.map +1 -0
  25. package/dist/components/ui/core/badge/badge.d.ts +13 -12
  26. package/dist/components/ui/core/badge/badge.js +88 -72
  27. package/dist/components/ui/core/badge/badge.js.map +1 -0
  28. package/dist/components/ui/core/banner/banner.d.ts +18 -18
  29. package/dist/components/ui/core/banner/banner.js +179 -142
  30. package/dist/components/ui/core/banner/banner.js.map +1 -0
  31. package/dist/components/ui/core/breadcrumb/breadcrumb.d.ts +12 -12
  32. package/dist/components/ui/core/breadcrumb/breadcrumb.js +139 -104
  33. package/dist/components/ui/core/breadcrumb/breadcrumb.js.map +1 -0
  34. package/dist/components/ui/core/button/button.d.ts +7 -7
  35. package/dist/components/ui/core/button/button.gallery.d.ts +2 -0
  36. package/dist/components/ui/core/button/button.gallery.js +76 -0
  37. package/dist/components/ui/core/button/button.gallery.js.map +1 -0
  38. package/dist/components/ui/core/button/button.js +57 -47
  39. package/dist/components/ui/core/button/button.js.map +1 -0
  40. package/dist/components/ui/core/button-group/button-group.d.ts +9 -9
  41. package/dist/components/ui/core/button-group/button-group.js +50 -40
  42. package/dist/components/ui/core/button-group/button-group.js.map +1 -0
  43. package/dist/components/ui/core/calendar/calendar-header.d.ts +7 -7
  44. package/dist/components/ui/core/calendar/calendar-header.js +102 -63
  45. package/dist/components/ui/core/calendar/calendar-header.js.map +1 -0
  46. package/dist/components/ui/core/calendar/calendar-utils.d.ts +30 -30
  47. package/dist/components/ui/core/calendar/calendar-utils.js +116 -39
  48. package/dist/components/ui/core/calendar/calendar-utils.js.map +1 -0
  49. package/dist/components/ui/core/calendar/calendar.d.ts +10 -10
  50. package/dist/components/ui/core/calendar/calendar.js +95 -66
  51. package/dist/components/ui/core/calendar/calendar.js.map +1 -0
  52. package/dist/components/ui/core/calendar/constants.js +3 -0
  53. package/dist/components/ui/core/calendar/constants.js.map +1 -0
  54. package/dist/components/ui/core/card/card.d.ts +20 -20
  55. package/dist/components/ui/core/card/card.js +133 -104
  56. package/dist/components/ui/core/card/card.js.map +1 -0
  57. package/dist/components/ui/core/chart/chart.d.ts +55 -53
  58. package/dist/components/ui/core/chart/chart.js +196 -116
  59. package/dist/components/ui/core/chart/chart.js.map +1 -0
  60. package/dist/components/ui/core/chart/index.d.ts +2 -2
  61. package/dist/components/ui/core/chart/index.js +3 -2
  62. package/dist/components/ui/core/chart/index.js.map +1 -0
  63. package/dist/components/ui/core/checkbox/checkbox.d.ts +9 -9
  64. package/dist/components/ui/core/checkbox/checkbox.js +88 -68
  65. package/dist/components/ui/core/checkbox/checkbox.js.map +1 -0
  66. package/dist/components/ui/core/checkbox/checkbox.metadata.d.ts +1 -1
  67. package/dist/components/ui/core/checkbox/checkbox.metadata.js +6 -7
  68. package/dist/components/ui/core/checkbox/checkbox.metadata.js.map +1 -0
  69. package/dist/components/ui/core/code-block/code-block.d.ts +19 -19
  70. package/dist/components/ui/core/code-block/code-block.js +259 -175
  71. package/dist/components/ui/core/code-block/code-block.js.map +1 -0
  72. package/dist/components/ui/core/collapsible/collapsible.d.ts +5 -5
  73. package/dist/components/ui/core/collapsible/collapsible.js +36 -30
  74. package/dist/components/ui/core/collapsible/collapsible.js.map +1 -0
  75. package/dist/components/ui/core/combobox/combobox.d.ts +13 -13
  76. package/dist/components/ui/core/combobox/combobox.js +89 -40
  77. package/dist/components/ui/core/combobox/combobox.js.map +1 -0
  78. package/dist/components/ui/core/command/command.d.ts +20 -18
  79. package/dist/components/ui/core/command/command.js +137 -85
  80. package/dist/components/ui/core/command/command.js.map +1 -0
  81. package/dist/components/ui/core/conversation/conversation.d.ts +14 -0
  82. package/dist/components/ui/core/conversation/conversation.js +51 -0
  83. package/dist/components/ui/core/conversation/conversation.js.map +1 -0
  84. package/dist/components/ui/core/count/count.d.ts +8 -6
  85. package/dist/components/ui/core/count/count.js +51 -21
  86. package/dist/components/ui/core/count/count.js.map +1 -0
  87. package/dist/components/ui/core/data-grid/data-grid-cell.d.ts +7 -7
  88. package/dist/components/ui/core/data-grid/data-grid-cell.js +22 -22
  89. package/dist/components/ui/core/data-grid/data-grid-cell.js.map +1 -0
  90. package/dist/components/ui/core/data-grid/data-grid-filter-clauses.d.ts +14 -0
  91. package/dist/components/ui/core/data-grid/data-grid-filter-clauses.js +36 -0
  92. package/dist/components/ui/core/data-grid/data-grid-filter-clauses.js.map +1 -0
  93. package/dist/components/ui/core/data-grid/data-grid-filter-panel.d.ts +41 -0
  94. package/dist/components/ui/core/data-grid/data-grid-filter-panel.js +273 -0
  95. package/dist/components/ui/core/data-grid/data-grid-filter-panel.js.map +1 -0
  96. package/dist/components/ui/core/data-grid/data-grid-footer.d.ts +6 -0
  97. package/dist/components/ui/core/data-grid/data-grid-footer.js +34 -0
  98. package/dist/components/ui/core/data-grid/data-grid-footer.js.map +1 -0
  99. package/dist/components/ui/core/data-grid/data-grid-header-row.d.ts +10 -10
  100. package/dist/components/ui/core/data-grid/data-grid-header-row.js +69 -55
  101. package/dist/components/ui/core/data-grid/data-grid-header-row.js.map +1 -0
  102. package/dist/components/ui/core/data-grid/data-grid-header.d.ts +11 -0
  103. package/dist/components/ui/core/data-grid/data-grid-header.js +67 -0
  104. package/dist/components/ui/core/data-grid/data-grid-header.js.map +1 -0
  105. package/dist/components/ui/core/data-grid/data-grid-row.d.ts +15 -15
  106. package/dist/components/ui/core/data-grid/data-grid-row.js +104 -76
  107. package/dist/components/ui/core/data-grid/data-grid-row.js.map +1 -0
  108. package/dist/components/ui/core/data-grid/data-grid.d.ts +85 -35
  109. package/dist/components/ui/core/data-grid/data-grid.fixtures.d.ts +7 -7
  110. package/dist/components/ui/core/data-grid/data-grid.fixtures.js +139 -0
  111. package/dist/components/ui/core/data-grid/data-grid.fixtures.js.map +1 -0
  112. package/dist/components/ui/core/data-grid/data-grid.js +402 -132
  113. package/dist/components/ui/core/data-grid/data-grid.js.map +1 -0
  114. package/dist/components/ui/core/data-grid/data-grid.utils.d.ts +3 -3
  115. package/dist/components/ui/core/data-grid/data-grid.utils.js +44 -33
  116. package/dist/components/ui/core/data-grid/data-grid.utils.js.map +1 -0
  117. package/dist/components/ui/core/data-grid/index.d.ts +4 -1
  118. package/dist/components/ui/core/data-grid/index.js +5 -2
  119. package/dist/components/ui/core/data-grid/index.js.map +1 -0
  120. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.d.ts +11 -13
  121. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +85 -61
  122. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js.map +1 -0
  123. package/dist/components/ui/core/date-time-pickers/date-picker/index.d.ts +3 -3
  124. package/dist/components/ui/core/date-time-pickers/date-picker/index.js +3 -0
  125. package/dist/components/ui/core/date-time-pickers/date-picker/index.js.map +1 -0
  126. package/dist/components/ui/core/date-time-pickers/date-picker/types.d.ts +14 -14
  127. package/dist/components/ui/core/date-time-pickers/date-picker/types.js +3 -0
  128. package/dist/components/ui/core/date-time-pickers/date-picker/types.js.map +1 -0
  129. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.d.ts +2 -2
  130. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +51 -36
  131. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js.map +1 -0
  132. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.d.ts +11 -13
  133. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +89 -64
  134. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js.map +1 -0
  135. package/dist/components/ui/core/date-time-pickers/date-range-picker/index.d.ts +3 -3
  136. package/dist/components/ui/core/date-time-pickers/date-range-picker/index.js +3 -0
  137. package/dist/components/ui/core/date-time-pickers/date-range-picker/index.js.map +1 -0
  138. package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +20 -20
  139. package/dist/components/ui/core/date-time-pickers/date-range-picker/types.js +3 -0
  140. package/dist/components/ui/core/date-time-pickers/date-range-picker/types.js.map +1 -0
  141. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.d.ts +4 -4
  142. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +95 -60
  143. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js.map +1 -0
  144. package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.d.ts +15 -0
  145. package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.js +120 -0
  146. package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.js.map +1 -0
  147. package/dist/components/ui/core/date-time-pickers/date-time-picker/index.d.ts +3 -1
  148. package/dist/components/ui/core/date-time-pickers/date-time-picker/index.js +3 -0
  149. package/dist/components/ui/core/date-time-pickers/date-time-picker/index.js.map +1 -0
  150. package/dist/components/ui/core/date-time-pickers/date-time-picker/types.d.ts +25 -32
  151. package/dist/components/ui/core/date-time-pickers/date-time-picker/types.js +3 -0
  152. package/dist/components/ui/core/date-time-pickers/date-time-picker/types.js.map +1 -0
  153. package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.d.ts +2 -2
  154. package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.js +78 -0
  155. package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.js.map +1 -0
  156. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.d.ts +13 -15
  157. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +165 -119
  158. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js.map +1 -0
  159. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.d.ts +3 -3
  160. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.js +3 -0
  161. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.js.map +1 -0
  162. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +37 -37
  163. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.js +3 -0
  164. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.js.map +1 -0
  165. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.d.ts +3 -3
  166. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +163 -104
  167. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js.map +1 -0
  168. package/dist/components/ui/core/date-time-pickers/index.d.ts +17 -12
  169. package/dist/components/ui/core/date-time-pickers/index.js +10 -6
  170. package/dist/components/ui/core/date-time-pickers/index.js.map +1 -0
  171. package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.d.ts +5 -5
  172. package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js +52 -42
  173. package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js.map +1 -0
  174. package/dist/components/ui/core/date-time-pickers/shared/constants.d.ts +6 -1
  175. package/dist/components/ui/core/date-time-pickers/shared/constants.js +23 -0
  176. package/dist/components/ui/core/date-time-pickers/shared/constants.js.map +1 -0
  177. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.d.ts +16 -15
  178. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +87 -64
  179. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js.map +1 -0
  180. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.d.ts +10 -9
  181. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js +89 -38
  182. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js.map +1 -0
  183. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.d.ts +5 -5
  184. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +34 -23
  185. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js.map +1 -0
  186. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.d.ts +23 -23
  187. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js +95 -52
  188. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js.map +1 -0
  189. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.d.ts +5 -5
  190. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js +22 -18
  191. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js.map +1 -0
  192. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.d.ts +19 -19
  193. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js +41 -24
  194. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js.map +1 -0
  195. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.d.ts +13 -13
  196. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +33 -24
  197. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js.map +1 -0
  198. package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.d.ts +5 -5
  199. package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js +9 -4
  200. package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js.map +1 -0
  201. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.d.ts +13 -9
  202. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +22 -17
  203. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js.map +1 -0
  204. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.d.ts +2 -2
  205. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.js +3 -0
  206. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.js.map +1 -0
  207. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.d.ts +13 -13
  208. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +49 -40
  209. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js.map +1 -0
  210. package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.d.ts +7 -7
  211. package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +41 -34
  212. package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js.map +1 -0
  213. package/dist/components/ui/core/date-time-pickers/time-picker/index.d.ts +3 -3
  214. package/dist/components/ui/core/date-time-pickers/time-picker/index.js +3 -0
  215. package/dist/components/ui/core/date-time-pickers/time-picker/index.js.map +1 -0
  216. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.d.ts +12 -14
  217. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +99 -79
  218. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js.map +1 -0
  219. package/dist/components/ui/core/date-time-pickers/time-picker/types.d.ts +20 -20
  220. package/dist/components/ui/core/date-time-pickers/time-picker/types.js +3 -0
  221. package/dist/components/ui/core/date-time-pickers/time-picker/types.js.map +1 -0
  222. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.d.ts +2 -2
  223. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +63 -41
  224. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js.map +1 -0
  225. package/dist/components/ui/core/date-time-pickers/time-range-picker/index.d.ts +3 -1
  226. package/dist/components/ui/core/date-time-pickers/time-range-picker/index.js +3 -0
  227. package/dist/components/ui/core/date-time-pickers/time-range-picker/index.js.map +1 -0
  228. package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.d.ts +14 -0
  229. package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.js +115 -0
  230. package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.js.map +1 -0
  231. package/dist/components/ui/core/date-time-pickers/time-range-picker/types.d.ts +30 -36
  232. package/dist/components/ui/core/date-time-pickers/time-range-picker/types.js +3 -0
  233. package/dist/components/ui/core/date-time-pickers/time-range-picker/types.js.map +1 -0
  234. package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.d.ts +2 -2
  235. package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.js +145 -0
  236. package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.js.map +1 -0
  237. package/dist/components/ui/core/date-time-pickers/utils/date-input.d.ts +56 -0
  238. package/dist/components/ui/core/date-time-pickers/utils/date-input.js +67 -0
  239. package/dist/components/ui/core/date-time-pickers/utils/date-input.js.map +1 -0
  240. package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.d.ts +18 -18
  241. package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.js +42 -0
  242. package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.js.map +1 -0
  243. package/dist/components/ui/core/date-time-pickers/utils/format-utils.d.ts +31 -29
  244. package/dist/components/ui/core/date-time-pickers/utils/format-utils.js +56 -0
  245. package/dist/components/ui/core/date-time-pickers/utils/format-utils.js.map +1 -0
  246. package/dist/components/ui/core/date-time-pickers/utils/segment-utils.d.ts +21 -21
  247. package/dist/components/ui/core/date-time-pickers/utils/segment-utils.js +170 -0
  248. package/dist/components/ui/core/date-time-pickers/utils/segment-utils.js.map +1 -0
  249. package/dist/components/ui/core/date-time-pickers/utils/time-utils.d.ts +28 -28
  250. package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +88 -7
  251. package/dist/components/ui/core/date-time-pickers/utils/time-utils.js.map +1 -0
  252. package/dist/components/ui/core/date-time-pickers/utils/time-validation.d.ts +17 -17
  253. package/dist/components/ui/core/date-time-pickers/utils/time-validation.js +43 -0
  254. package/dist/components/ui/core/date-time-pickers/utils/time-validation.js.map +1 -0
  255. package/dist/components/ui/core/dialog/dialog.d.ts +12 -9
  256. package/dist/components/ui/core/dialog/dialog.js +90 -82
  257. package/dist/components/ui/core/dialog/dialog.js.map +1 -0
  258. package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +22 -19
  259. package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +204 -149
  260. package/dist/components/ui/core/dropdown-menu/dropdown-menu.js.map +1 -0
  261. package/dist/components/ui/core/empty-state/empty-state.context.d.ts +4 -4
  262. package/dist/components/ui/core/empty-state/empty-state.context.js +8 -5
  263. package/dist/components/ui/core/empty-state/empty-state.context.js.map +1 -0
  264. package/dist/components/ui/core/empty-state/empty-state.d.ts +14 -14
  265. package/dist/components/ui/core/empty-state/empty-state.js +96 -82
  266. package/dist/components/ui/core/empty-state/empty-state.js.map +1 -0
  267. package/dist/components/ui/core/helper-text/helper-text.d.ts +7 -7
  268. package/dist/components/ui/core/helper-text/helper-text.js +55 -36
  269. package/dist/components/ui/core/helper-text/helper-text.js.map +1 -0
  270. package/dist/components/ui/core/hover-card/hover-card.d.ts +7 -6
  271. package/dist/components/ui/core/hover-card/hover-card.js +56 -52
  272. package/dist/components/ui/core/hover-card/hover-card.js.map +1 -0
  273. package/dist/components/ui/core/inline-citation/inline-citation.d.ts +26 -25
  274. package/dist/components/ui/core/inline-citation/inline-citation.js +121 -97
  275. package/dist/components/ui/core/inline-citation/inline-citation.js.map +1 -0
  276. package/dist/components/ui/core/input/input.d.ts +2 -2
  277. package/dist/components/ui/core/input/input.js +15 -13
  278. package/dist/components/ui/core/input/input.js.map +1 -0
  279. package/dist/components/ui/core/input-group/input-group.d.ts +25 -14
  280. package/dist/components/ui/core/input-group/input-group.js +149 -76
  281. package/dist/components/ui/core/input-group/input-group.js.map +1 -0
  282. package/dist/components/ui/core/item/item.d.ts +20 -0
  283. package/dist/components/ui/core/item/item.js +93 -0
  284. package/dist/components/ui/core/item/item.js.map +1 -0
  285. package/dist/components/ui/core/kbd/kbd.d.ts +3 -3
  286. package/dist/components/ui/core/kbd/kbd.js +24 -20
  287. package/dist/components/ui/core/kbd/kbd.js.map +1 -0
  288. package/dist/components/ui/core/label/label.d.ts +3 -3
  289. package/dist/components/ui/core/label/label.js +33 -26
  290. package/dist/components/ui/core/label/label.js.map +1 -0
  291. package/dist/components/ui/core/loader/loader.d.ts +6 -6
  292. package/dist/components/ui/core/loader/loader.js +97 -80
  293. package/dist/components/ui/core/loader/loader.js.map +1 -0
  294. package/dist/components/ui/core/message/message-response-default-streamdown-controls.d.ts +9 -9
  295. package/dist/components/ui/core/message/message-response-default-streamdown-controls.js +19 -12
  296. package/dist/components/ui/core/message/message-response-default-streamdown-controls.js.map +1 -0
  297. package/dist/components/ui/core/message/message-response-math-plugin.d.ts +3 -0
  298. package/dist/components/ui/core/message/message-response-math-plugin.js +6 -0
  299. package/dist/components/ui/core/message/message-response-math-plugin.js.map +1 -0
  300. package/dist/components/ui/core/message/message.d.ts +27 -23
  301. package/dist/components/ui/core/message/message.js +453 -316
  302. package/dist/components/ui/core/message/message.js.map +1 -0
  303. package/dist/components/ui/core/overflow-list/overflow-list.d.ts +21 -0
  304. package/dist/components/ui/core/overflow-list/overflow-list.js +197 -0
  305. package/dist/components/ui/core/overflow-list/overflow-list.js.map +1 -0
  306. package/dist/components/ui/core/overflow-list/overflow-list.utils.d.ts +37 -35
  307. package/dist/components/ui/core/overflow-list/overflow-list.utils.js +206 -0
  308. package/dist/components/ui/core/overflow-list/overflow-list.utils.js.map +1 -0
  309. package/dist/components/ui/core/pagination/pagination-size-context.d.ts +2 -2
  310. package/dist/components/ui/core/pagination/pagination-size-context.js +6 -5
  311. package/dist/components/ui/core/pagination/pagination-size-context.js.map +1 -0
  312. package/dist/components/ui/core/pagination/pagination-teleport.d.ts +9 -9
  313. package/dist/components/ui/core/pagination/pagination-teleport.js +127 -84
  314. package/dist/components/ui/core/pagination/pagination-teleport.js.map +1 -0
  315. package/dist/components/ui/core/pagination/pagination-teleport.utils.js +6 -6
  316. package/dist/components/ui/core/pagination/pagination-teleport.utils.js.map +1 -0
  317. package/dist/components/ui/core/pagination/pagination.d.ts +39 -39
  318. package/dist/components/ui/core/pagination/pagination.js +294 -234
  319. package/dist/components/ui/core/pagination/pagination.js.map +1 -0
  320. package/dist/components/ui/core/popover/popover.d.ts +12 -11
  321. package/dist/components/ui/core/popover/popover.js +104 -89
  322. package/dist/components/ui/core/popover/popover.js.map +1 -0
  323. package/dist/components/ui/core/progress/progress.d.ts +9 -8
  324. package/dist/components/ui/core/progress/progress.js +50 -35
  325. package/dist/components/ui/core/progress/progress.js.map +1 -0
  326. package/dist/components/ui/core/prompt-input/prompt-input.d.ts +27 -27
  327. package/dist/components/ui/core/prompt-input/prompt-input.js +342 -271
  328. package/dist/components/ui/core/prompt-input/prompt-input.js.map +1 -0
  329. package/dist/components/ui/core/radio-group/radio-group.d.ts +12 -12
  330. package/dist/components/ui/core/radio-group/radio-group.js +88 -58
  331. package/dist/components/ui/core/radio-group/radio-group.js.map +1 -0
  332. package/dist/components/ui/core/reasoning/reasoning.d.ts +7 -7
  333. package/dist/components/ui/core/reasoning/reasoning.js +68 -56
  334. package/dist/components/ui/core/reasoning/reasoning.js.map +1 -0
  335. package/dist/components/ui/core/scroll-area/scroll-area.d.ts +4 -4
  336. package/dist/components/ui/core/scroll-area/scroll-area.js +50 -40
  337. package/dist/components/ui/core/scroll-area/scroll-area.js.map +1 -0
  338. package/dist/components/ui/core/search/search.d.ts +8 -8
  339. package/dist/components/ui/core/search/search.js +122 -76
  340. package/dist/components/ui/core/search/search.js.map +1 -0
  341. package/dist/components/ui/core/segmented-control/segmented-control.d.ts +10 -10
  342. package/dist/components/ui/core/segmented-control/segmented-control.js +203 -149
  343. package/dist/components/ui/core/segmented-control/segmented-control.js.map +1 -0
  344. package/dist/components/ui/core/select/select.d.ts +27 -26
  345. package/dist/components/ui/core/select/select.js +213 -168
  346. package/dist/components/ui/core/select/select.js.map +1 -0
  347. package/dist/components/ui/core/separator/separator.d.ts +2 -2
  348. package/dist/components/ui/core/separator/separator.js +13 -13
  349. package/dist/components/ui/core/separator/separator.js.map +1 -0
  350. package/dist/components/ui/core/shimmer/shimmer.d.ts +8 -8
  351. package/dist/components/ui/core/shimmer/shimmer.js +64 -40
  352. package/dist/components/ui/core/shimmer/shimmer.js.map +1 -0
  353. package/dist/components/ui/core/skeleton/skeleton.d.ts +2 -2
  354. package/dist/components/ui/core/skeleton/skeleton.js +13 -13
  355. package/dist/components/ui/core/skeleton/skeleton.js.map +1 -0
  356. package/dist/components/ui/core/slider/slider.d.ts +7 -7
  357. package/dist/components/ui/core/slider/slider.js +51 -39
  358. package/dist/components/ui/core/slider/slider.js.map +1 -0
  359. package/dist/components/ui/core/sonner-toast/sonner-toast.d.ts +2 -2
  360. package/dist/components/ui/core/sonner-toast/sonner-toast.js +67 -54
  361. package/dist/components/ui/core/sonner-toast/sonner-toast.js.map +1 -0
  362. package/dist/components/ui/core/sources/sources.d.ts +12 -12
  363. package/dist/components/ui/core/sources/sources.js +87 -58
  364. package/dist/components/ui/core/sources/sources.js.map +1 -0
  365. package/dist/components/ui/core/switch/switch.d.ts +9 -9
  366. package/dist/components/ui/core/switch/switch.js +83 -61
  367. package/dist/components/ui/core/switch/switch.js.map +1 -0
  368. package/dist/components/ui/core/switch/switch.metadata.d.ts +1 -1
  369. package/dist/components/ui/core/switch/switch.metadata.js +8 -0
  370. package/dist/components/ui/core/switch/switch.metadata.js.map +1 -0
  371. package/dist/components/ui/core/tabs/tabs.d.ts +20 -18
  372. package/dist/components/ui/core/tabs/tabs.js +176 -147
  373. package/dist/components/ui/core/tabs/tabs.js.map +1 -0
  374. package/dist/components/ui/core/tabs/tabs.utils.d.ts +1 -1
  375. package/dist/components/ui/core/tabs/tabs.utils.js +10 -6
  376. package/dist/components/ui/core/tabs/tabs.utils.js.map +1 -0
  377. package/dist/components/ui/core/textarea/textarea.d.ts +2 -2
  378. package/dist/components/ui/core/textarea/textarea.js +13 -13
  379. package/dist/components/ui/core/textarea/textarea.js.map +1 -0
  380. package/dist/components/ui/core/toggle/toggle.d.ts +9 -9
  381. package/dist/components/ui/core/toggle/toggle.js +60 -54
  382. package/dist/components/ui/core/toggle/toggle.js.map +1 -0
  383. package/dist/components/ui/core/tool/tool.d.ts +18 -18
  384. package/dist/components/ui/core/tool/tool.js +167 -126
  385. package/dist/components/ui/core/tool/tool.js.map +1 -0
  386. package/dist/components/ui/core/toolbar/toolbar.d.ts +37 -0
  387. package/dist/components/ui/core/toolbar/toolbar.js +171 -0
  388. package/dist/components/ui/core/toolbar/toolbar.js.map +1 -0
  389. package/dist/components/ui/core/tooltip/tooltip.d.ts +8 -7
  390. package/dist/components/ui/core/tooltip/tooltip.js +53 -46
  391. package/dist/components/ui/core/tooltip/tooltip.js.map +1 -0
  392. package/dist/components/ui/core/topbar/topbar.d.ts +26 -26
  393. package/dist/components/ui/core/topbar/topbar.js +160 -105
  394. package/dist/components/ui/core/topbar/topbar.js.map +1 -0
  395. package/dist/components/ui/core/tree/tree.d.ts +20 -0
  396. package/dist/components/ui/core/tree/tree.js +100 -0
  397. package/dist/components/ui/core/tree/tree.js.map +1 -0
  398. package/dist/eslint/index.d.ts +5 -5
  399. package/dist/eslint/index.js +9 -5
  400. package/dist/eslint/index.js.map +1 -0
  401. package/dist/eslint/no-overriding-styles.d.ts +1 -1
  402. package/dist/eslint/no-overriding-styles.js +341 -201
  403. package/dist/eslint/no-overriding-styles.js.map +1 -0
  404. package/dist/icons/index.d.ts +1 -1
  405. package/dist/icons/index.js +2 -0
  406. package/dist/icons/index.js.map +1 -0
  407. package/dist/index.d.ts +1 -1
  408. package/dist/index.js +3 -0
  409. package/dist/index.js.map +1 -0
  410. package/dist/lib/ai/types.d.ts +43 -43
  411. package/dist/lib/ai/types.js +3 -0
  412. package/dist/lib/ai/types.js.map +1 -0
  413. package/dist/lib/decorative-variant-classes.d.ts +53 -0
  414. package/dist/lib/decorative-variant-classes.js +58 -0
  415. package/dist/lib/decorative-variant-classes.js.map +1 -0
  416. package/dist/lib/highlight-code.d.ts +11 -8
  417. package/dist/lib/highlight-code.js +58 -40
  418. package/dist/lib/highlight-code.js.map +1 -0
  419. package/dist/lib/portal-container-context.d.ts +1 -1
  420. package/dist/lib/portal-container-context.js +8 -8
  421. package/dist/lib/portal-container-context.js.map +1 -0
  422. package/dist/lib/shared-theme-from-url.d.ts +13 -0
  423. package/dist/lib/shared-theme-from-url.js +61 -0
  424. package/dist/lib/shared-theme-from-url.js.map +1 -0
  425. package/dist/lib/style-scope.d.ts +2 -2
  426. package/dist/lib/style-scope.js +6 -6
  427. package/dist/lib/style-scope.js.map +1 -0
  428. package/dist/lib/theme-share-url.d.ts +31 -0
  429. package/dist/lib/theme-share-url.js +116 -0
  430. package/dist/lib/theme-share-url.js.map +1 -0
  431. package/dist/lib/types.d.ts +39 -39
  432. package/dist/lib/types.js +3 -0
  433. package/dist/lib/types.js.map +1 -0
  434. package/dist/lib/use-controllable-state.d.ts +4 -7
  435. package/dist/lib/use-controllable-state.js +34 -21
  436. package/dist/lib/use-controllable-state.js.map +1 -0
  437. package/dist/lib/utils.d.ts +63 -34
  438. package/dist/lib/utils.js +134 -32
  439. package/dist/lib/utils.js.map +1 -0
  440. package/dist/styles.css +2 -1
  441. package/dist/styles.source.css +24 -12
  442. package/dist/utils/assign-ref.d.ts +3 -0
  443. package/dist/utils/assign-ref.js +13 -0
  444. package/dist/utils/assign-ref.js.map +1 -0
  445. package/package.json +46 -11
  446. package/src/components/ui/core/button/button.md +93 -0
@@ -1,22 +1,22 @@
1
- import { ComponentProps, ForwardRefExoticComponent, RefAttributes } from 'react';
2
- import { CollapsibleRootProps, CollapsiblePanelProps } from '@base-ui/react';
3
- import { ToolUIPart } from '../../../../lib/ai/types';
4
- import { CollapsibleTrigger } from '../collapsible/collapsible';
5
- declare const Tool: ForwardRefExoticComponent<Omit<CollapsibleRootProps, 'ref'> & RefAttributes<HTMLDivElement>>;
6
- type ToolHeaderProps = Omit<ComponentProps<typeof CollapsibleTrigger>, 'type'> & {
7
- title?: string;
8
- type: ToolUIPart['type'];
9
- hasError?: boolean;
1
+ import type { ComponentProps, ForwardRefExoticComponent, RefAttributes } from "react";
2
+ import type { CollapsibleRootProps, CollapsiblePanelProps } from "@base-ui/react";
3
+ import type { ToolUIPart } from "../../../../lib/ai/types";
4
+ import { CollapsibleTrigger } from "../collapsible/collapsible";
5
+ declare const Tool: ForwardRefExoticComponent<Omit<CollapsibleRootProps, "ref"> & RefAttributes<HTMLDivElement>>;
6
+ type ToolHeaderProps = Omit<ComponentProps<typeof CollapsibleTrigger>, "type"> & {
7
+ title?: string;
8
+ type: ToolUIPart["type"];
9
+ hasError?: boolean;
10
10
  };
11
- declare const ToolHeader: ForwardRefExoticComponent<Omit<ToolHeaderProps, 'ref'> & RefAttributes<HTMLButtonElement>>;
12
- declare const ToolContent: ForwardRefExoticComponent<Omit<CollapsiblePanelProps, 'ref'> & RefAttributes<HTMLDivElement>>;
13
- type ToolInputProps = ComponentProps<'div'> & {
14
- input: ToolUIPart['input'];
11
+ declare const ToolHeader: ForwardRefExoticComponent<Omit<ToolHeaderProps, "ref"> & RefAttributes<HTMLButtonElement>>;
12
+ declare const ToolContent: ForwardRefExoticComponent<Omit<CollapsiblePanelProps, "ref"> & RefAttributes<HTMLDivElement>>;
13
+ type ToolInputProps = ComponentProps<"div"> & {
14
+ input: ToolUIPart["input"];
15
15
  };
16
- declare const ToolInput: ForwardRefExoticComponent<Omit<ToolInputProps, 'ref'> & RefAttributes<HTMLDivElement>>;
17
- type ToolOutputProps = ComponentProps<'div'> & {
18
- output: ToolUIPart['output'];
19
- errorText: ToolUIPart['errorText'];
16
+ declare const ToolInput: ForwardRefExoticComponent<Omit<ToolInputProps, "ref"> & RefAttributes<HTMLDivElement>>;
17
+ type ToolOutputProps = ComponentProps<"div"> & {
18
+ output: ToolUIPart["output"];
19
+ errorText: ToolUIPart["errorText"];
20
20
  };
21
- declare const ToolOutput: ForwardRefExoticComponent<Omit<ToolOutputProps, 'ref'> & RefAttributes<HTMLDivElement>>;
21
+ declare const ToolOutput: ForwardRefExoticComponent<Omit<ToolOutputProps, "ref"> & RefAttributes<HTMLDivElement>>;
22
22
  export { Tool, ToolHeader, ToolContent, ToolInput, ToolOutput };
@@ -1,127 +1,168 @@
1
- import { cn as e } from "../../../../lib/utils.js";
2
- import { Button as t } from "../button/button.js";
3
- import { CodeBlock as n, CodeBlockCollapseButton as r, CodeBlockCopyButton as i, CodeBlockDownloadButton as a } from "../code-block/code-block.js";
4
- import { Badge as o } from "../badge/badge.js";
5
- import { Collapsible as s, CollapsibleContent as c, CollapsibleTrigger as l } from "../collapsible/collapsible.js";
6
- import { forwardRef as u } from "react";
7
- import { IconSelector as d } from "@tabler/icons-react";
8
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
9
- //#region libs/aura/src/components/ui/core/tool/tool.tsx
10
- var m = u(({ className: t, ...n }, r) => /* @__PURE__ */ f(s, {
11
- ref: r,
12
- "data-slot": "tool",
13
- className: e("group not-prose w-full bg-background rounded-md flex flex-col gap-2", t),
14
- ...n
15
- }));
16
- m.displayName = "Tool";
17
- var h = u(({ className: e, title: n, type: r, hasError: i = !1, ...a }, s) => /* @__PURE__ */ f(l, {
18
- ref: s,
19
- "data-slot": "tool-header",
20
- className: e,
21
- render: /* @__PURE__ */ p(t, {
22
- variant: "ghost",
23
- className: "w-full justify-between text-base leading-5 tracking-tighter",
24
- children: [/* @__PURE__ */ f("span", { children: n ?? r.substring(r.indexOf("-") + 1) }), /* @__PURE__ */ p("div", {
25
- className: "flex items-center gap-2",
26
- children: [i ? /* @__PURE__ */ f(o, {
27
- outline: !0,
28
- className: "bg-background text-destructive-foreground border-border",
29
- children: "Error"
30
- }) : null, /* @__PURE__ */ f(d, { className: "h-4 w-4" })]
31
- })]
32
- }),
33
- ...a
34
- }));
35
- h.displayName = "ToolHeader";
36
- var g = u(({ className: t, ...n }, r) => /* @__PURE__ */ f(c, {
37
- ref: r,
38
- "data-slot": "tool-content",
39
- className: e("flex min-h-0 flex-col gap-4 py-3 text-popover-foreground outline-none", t),
40
- ...n
41
- }));
42
- g.displayName = "ToolContent";
43
- var _ = u(({ className: t, input: o, ...s }, c) => /* @__PURE__ */ p("div", {
44
- ref: c,
45
- "data-slot": "tool-input",
46
- className: e("min-h-0 space-y-2 overflow-x-hidden overflow-y-visible px-3.25", t),
47
- ...s,
48
- children: [/* @__PURE__ */ f("h4", {
49
- className: "text-sm font-medium uppercase tracking-wide text-muted-foreground",
50
- children: "Parameters"
51
- }), /* @__PURE__ */ f("div", {
52
- className: "min-h-0 rounded-md bg-muted/50",
53
- children: /* @__PURE__ */ p(n, {
54
- code: JSON.stringify(o, null, 2),
55
- language: "json",
56
- collapsed: !0,
57
- children: [
58
- /* @__PURE__ */ f(i, {}),
59
- /* @__PURE__ */ f(a, { fileName: "tool-parameters.json" }),
60
- /* @__PURE__ */ f(r, {})
61
- ]
62
- })
63
- })]
64
- }));
65
- _.displayName = "ToolInput";
66
- var v = u(({ className: t, output: o, errorText: s, ...c }, l) => {
67
- if (o == null && !s) return null;
68
- let u = null;
69
- return typeof o == "string" ? u = /* @__PURE__ */ p(n, {
70
- code: o,
71
- language: "json",
72
- collapsed: !0,
73
- children: [
74
- /* @__PURE__ */ f(i, {}),
75
- /* @__PURE__ */ f(a, { fileName: "tool-result.json" }),
76
- /* @__PURE__ */ f(r, {})
77
- ]
78
- }) : o == null ? u = null : typeof o == "object" ? u = /* @__PURE__ */ p(n, {
79
- code: JSON.stringify(o, null, 2),
80
- language: "json",
81
- collapsed: !0,
82
- children: [
83
- /* @__PURE__ */ f(i, {}),
84
- /* @__PURE__ */ f(a, { fileName: "tool-result.json" }),
85
- /* @__PURE__ */ f(r, {})
86
- ]
87
- }) : (typeof o == "number" || typeof o == "boolean" || typeof o == "bigint") && (u = /* @__PURE__ */ p(n, {
88
- code: String(o),
89
- language: "json",
90
- collapsed: !0,
91
- children: [
92
- /* @__PURE__ */ f(i, {}),
93
- /* @__PURE__ */ f(a, { fileName: "tool-result.json" }),
94
- /* @__PURE__ */ f(r, {})
95
- ]
96
- })), s ? /* @__PURE__ */ f("div", {
97
- ref: l,
98
- "data-slot": "tool-output",
99
- className: e("space-y-2 px-3.25", t),
100
- ...c,
101
- children: /* @__PURE__ */ p("div", {
102
- className: "flex flex-col gap-2 text-sm",
103
- children: [/* @__PURE__ */ f("span", {
104
- className: "font-medium text-destructive-foreground",
105
- children: "ERROR"
106
- }), /* @__PURE__ */ f("span", {
107
- className: "text-foreground",
108
- children: s
109
- })]
110
- })
111
- }) : /* @__PURE__ */ p("div", {
112
- ref: l,
113
- "data-slot": "tool-output",
114
- className: e("space-y-2 px-3.25", t),
115
- ...c,
116
- children: [/* @__PURE__ */ f("h4", {
117
- className: "text-sm font-medium uppercase tracking-wide text-muted-foreground",
118
- children: "Result"
119
- }), /* @__PURE__ */ f("div", {
120
- className: "min-h-0 overflow-x-auto rounded-md bg-muted-background/50 text-xs text-foreground [&_table]:w-full",
121
- children: u
122
- })]
123
- });
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { IconSelector } from "@tabler/icons-react";
4
+ import { cn, isJsonString } from "../../../../lib/utils.js";
5
+ import { Badge } from "../badge/badge.js";
6
+ import { Button } from "../button/button.js";
7
+ import { CodeBlock, CodeBlockCollapseButton, CodeBlockCopyButton, CodeBlockDownloadButton } from "../code-block/code-block.js";
8
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../collapsible/collapsible.js";
9
+ const Tool = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ _jsx(Collapsible, {
10
+ ref: ref,
11
+ "data-slot": "tool",
12
+ className: cn('group not-prose w-full bg-card-background rounded-md flex flex-col gap-2', className),
13
+ ...props
14
+ }));
15
+ Tool.displayName = 'Tool';
16
+ const ToolHeader = /*#__PURE__*/ forwardRef(({ className, title, type, hasError = false, ...props }, ref)=>/*#__PURE__*/ _jsx(CollapsibleTrigger, {
17
+ ref: ref,
18
+ "data-slot": "tool-header",
19
+ className: className,
20
+ render: /*#__PURE__*/ _jsxs(Button, {
21
+ variant: "ghost",
22
+ className: "w-full justify-between text-base leading-5 tracking-tighter",
23
+ children: [
24
+ /*#__PURE__*/ _jsx("span", {
25
+ children: title ?? type.substring(type.indexOf('-') + 1)
26
+ }),
27
+ /*#__PURE__*/ _jsxs("div", {
28
+ className: "flex items-center gap-2",
29
+ children: [
30
+ hasError ? /*#__PURE__*/ _jsx(Badge, {
31
+ outline: true,
32
+ className: "bg-card-background text-critical-foreground-strong border-default",
33
+ children: "Error"
34
+ }) : null,
35
+ /*#__PURE__*/ _jsx(IconSelector, {
36
+ className: "h-4 w-4"
37
+ })
38
+ ]
39
+ })
40
+ ]
41
+ }),
42
+ ...props
43
+ }));
44
+ ToolHeader.displayName = 'ToolHeader';
45
+ const ToolContent = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ _jsx(CollapsibleContent, {
46
+ ref: ref,
47
+ "data-slot": "tool-content",
48
+ className: cn(/* min-h-0: flex descendants (e.g. CodeBlock max-height) may shrink */ 'flex min-h-0 flex-col gap-4 py-3 text-popover-foreground outline-none', className),
49
+ ...props
50
+ }));
51
+ ToolContent.displayName = 'ToolContent';
52
+ const ToolInput = /*#__PURE__*/ forwardRef(({ className, input, ...props }, ref)=>/*#__PURE__*/ _jsxs("div", {
53
+ ref: ref,
54
+ "data-slot": "tool-input",
55
+ className: cn('min-h-0 space-y-2 overflow-x-hidden overflow-y-visible px-3.25', className),
56
+ ...props,
57
+ children: [
58
+ /*#__PURE__*/ _jsx("h4", {
59
+ className: "text-sm font-medium uppercase tracking-wide text-muted-foreground",
60
+ children: "Parameters"
61
+ }),
62
+ /*#__PURE__*/ _jsx("div", {
63
+ className: "min-h-0 rounded-md bg-muted/50",
64
+ children: /*#__PURE__*/ _jsxs(CodeBlock, {
65
+ code: JSON.stringify(input, null, 2),
66
+ language: "json",
67
+ collapsed: true,
68
+ children: [
69
+ /*#__PURE__*/ _jsx(CodeBlockCopyButton, {}),
70
+ /*#__PURE__*/ _jsx(CodeBlockDownloadButton, {
71
+ fileName: "tool-parameters.json"
72
+ }),
73
+ /*#__PURE__*/ _jsx(CodeBlockCollapseButton, {})
74
+ ]
75
+ })
76
+ })
77
+ ]
78
+ }));
79
+ ToolInput.displayName = 'ToolInput';
80
+ const ToolOutput = /*#__PURE__*/ forwardRef(({ className, output, errorText, ...props }, ref)=>{
81
+ if ((output === null || output === undefined) && !errorText) {
82
+ return null;
83
+ }
84
+ let outputElement = null;
85
+ if (typeof output === 'string') {
86
+ outputElement = /*#__PURE__*/ _jsxs(CodeBlock, {
87
+ code: output,
88
+ language: isJsonString(output) ? 'json' : 'text',
89
+ collapsed: true,
90
+ children: [
91
+ /*#__PURE__*/ _jsx(CodeBlockCopyButton, {}),
92
+ /*#__PURE__*/ _jsx(CodeBlockDownloadButton, {
93
+ fileName: "tool-result.json"
94
+ }),
95
+ /*#__PURE__*/ _jsx(CodeBlockCollapseButton, {})
96
+ ]
97
+ });
98
+ } else if (output === null || output === undefined) {
99
+ outputElement = null;
100
+ } else if (typeof output === 'object') {
101
+ outputElement = /*#__PURE__*/ _jsxs(CodeBlock, {
102
+ code: JSON.stringify(output, null, 2),
103
+ language: "json",
104
+ collapsed: true,
105
+ children: [
106
+ /*#__PURE__*/ _jsx(CodeBlockCopyButton, {}),
107
+ /*#__PURE__*/ _jsx(CodeBlockDownloadButton, {
108
+ fileName: "tool-result.json"
109
+ }),
110
+ /*#__PURE__*/ _jsx(CodeBlockCollapseButton, {})
111
+ ]
112
+ });
113
+ } else if (typeof output === 'number' || typeof output === 'boolean' || typeof output === 'bigint') {
114
+ outputElement = /*#__PURE__*/ _jsxs(CodeBlock, {
115
+ code: String(output),
116
+ language: "json",
117
+ collapsed: true,
118
+ children: [
119
+ /*#__PURE__*/ _jsx(CodeBlockCopyButton, {}),
120
+ /*#__PURE__*/ _jsx(CodeBlockDownloadButton, {
121
+ fileName: "tool-result.json"
122
+ }),
123
+ /*#__PURE__*/ _jsx(CodeBlockCollapseButton, {})
124
+ ]
125
+ });
126
+ }
127
+ if (errorText) {
128
+ return /*#__PURE__*/ _jsx("div", {
129
+ ref: ref,
130
+ "data-slot": "tool-output",
131
+ className: cn('space-y-2 px-3.25', className),
132
+ ...props,
133
+ children: /*#__PURE__*/ _jsxs("div", {
134
+ className: "flex flex-col gap-2 text-sm",
135
+ children: [
136
+ /*#__PURE__*/ _jsx("span", {
137
+ className: "font-medium text-critical-foreground-strong",
138
+ children: "ERROR"
139
+ }),
140
+ /*#__PURE__*/ _jsx("span", {
141
+ className: "text-base-foreground",
142
+ children: errorText
143
+ })
144
+ ]
145
+ })
146
+ });
147
+ }
148
+ return /*#__PURE__*/ _jsxs("div", {
149
+ ref: ref,
150
+ "data-slot": "tool-output",
151
+ className: cn('space-y-2 px-3.25', className),
152
+ ...props,
153
+ children: [
154
+ /*#__PURE__*/ _jsx("h4", {
155
+ className: "text-sm font-medium uppercase tracking-wide text-muted-foreground",
156
+ children: "Result"
157
+ }),
158
+ /*#__PURE__*/ _jsx("div", {
159
+ className: "min-h-0 overflow-x-auto rounded-md bg-muted-background/50 text-xs text-base-foreground [&_table]:w-full",
160
+ children: outputElement
161
+ })
162
+ ]
163
+ });
124
164
  });
125
- v.displayName = "ToolOutput";
126
- //#endregion
127
- export { m as Tool, g as ToolContent, h as ToolHeader, _ as ToolInput, v as ToolOutput };
165
+ ToolOutput.displayName = 'ToolOutput';
166
+ export { Tool, ToolHeader, ToolContent, ToolInput, ToolOutput };
167
+
168
+ //# sourceMappingURL=tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/tool/tool.tsx"],"sourcesContent":["import type {\n ComponentProps,\n ComponentRef,\n ForwardRefExoticComponent,\n ReactNode,\n RefAttributes,\n} from 'react';\nimport { forwardRef } from 'react';\n\nimport type {\n CollapsibleRootProps,\n CollapsiblePanelProps,\n} from '@base-ui/react';\nimport { IconSelector } from '@tabler/icons-react';\n\nimport type { ToolUIPart } from '../../../../lib/ai/types';\nimport type { CodeLanguage } from '../../../../lib/highlight-code';\nimport { cn, isJsonString } from '../../../../lib/utils';\nimport { Badge } from '../badge/badge';\nimport { Button } from '../button/button';\nimport {\n CodeBlock,\n CodeBlockCollapseButton,\n CodeBlockCopyButton,\n CodeBlockDownloadButton,\n} from '../code-block/code-block';\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from '../collapsible/collapsible';\n\ntype ToolProps = ComponentProps<typeof Collapsible>;\n\nconst Tool: ForwardRefExoticComponent<\n Omit<CollapsibleRootProps, 'ref'> & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<typeof Collapsible>, ToolProps>(\n ({ className, ...props }, ref) => (\n <Collapsible\n ref={ref}\n data-slot=\"tool\"\n className={cn(\n 'group not-prose w-full bg-card-background rounded-md flex flex-col gap-2',\n className\n )}\n {...props}\n />\n )\n);\nTool.displayName = 'Tool';\n\ntype ToolHeaderProps = Omit<\n ComponentProps<typeof CollapsibleTrigger>,\n 'type'\n> & {\n title?: string;\n type: ToolUIPart['type'];\n hasError?: boolean;\n};\n\nconst ToolHeader: ForwardRefExoticComponent<\n Omit<ToolHeaderProps, 'ref'> & RefAttributes<HTMLButtonElement>\n> = forwardRef<ComponentRef<typeof CollapsibleTrigger>, ToolHeaderProps>(\n ({ className, title, type, hasError = false, ...props }, ref) => (\n <CollapsibleTrigger\n ref={ref}\n data-slot=\"tool-header\"\n className={className}\n render={\n <Button\n variant=\"ghost\"\n className=\"w-full justify-between text-base leading-5 tracking-tighter\"\n >\n <span>{title ?? type.substring(type.indexOf('-') + 1)}</span>\n <div className=\"flex items-center gap-2\">\n {hasError ? (\n <Badge\n outline\n className=\"bg-card-background text-critical-foreground-strong border-default\"\n >\n Error\n </Badge>\n ) : null}\n <IconSelector className=\"h-4 w-4\" />\n </div>\n </Button>\n }\n {...props}\n />\n )\n);\nToolHeader.displayName = 'ToolHeader';\n\ntype ToolContentProps = ComponentProps<typeof CollapsibleContent>;\n\nconst ToolContent: ForwardRefExoticComponent<\n Omit<CollapsiblePanelProps, 'ref'> & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<typeof CollapsibleContent>, ToolContentProps>(\n ({ className, ...props }, ref) => (\n <CollapsibleContent\n ref={ref}\n data-slot=\"tool-content\"\n className={cn(\n /* min-h-0: flex descendants (e.g. CodeBlock max-height) may shrink */\n 'flex min-h-0 flex-col gap-4 py-3 text-popover-foreground outline-none',\n className\n )}\n {...props}\n />\n )\n);\nToolContent.displayName = 'ToolContent';\n\ntype ToolInputProps = ComponentProps<'div'> & {\n input: ToolUIPart['input'];\n};\n\nconst ToolInput: ForwardRefExoticComponent<\n Omit<ToolInputProps, 'ref'> & RefAttributes<HTMLDivElement>\n> = forwardRef<HTMLDivElement, ToolInputProps>(\n ({ className, input, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"tool-input\"\n className={cn(\n 'min-h-0 space-y-2 overflow-x-hidden overflow-y-visible px-3.25',\n className\n )}\n {...props}\n >\n <h4 className=\"text-sm font-medium uppercase tracking-wide text-muted-foreground\">\n Parameters\n </h4>\n <div className=\"min-h-0 rounded-md bg-muted/50\">\n <CodeBlock\n code={JSON.stringify(input, null, 2)}\n language=\"json\"\n collapsed\n >\n <CodeBlockCopyButton />\n <CodeBlockDownloadButton fileName=\"tool-parameters.json\" />\n <CodeBlockCollapseButton />\n </CodeBlock>\n </div>\n </div>\n )\n);\nToolInput.displayName = 'ToolInput';\n\ntype ToolOutputProps = ComponentProps<'div'> & {\n output: ToolUIPart['output'];\n errorText: ToolUIPart['errorText'];\n};\n\nconst ToolOutput: ForwardRefExoticComponent<\n Omit<ToolOutputProps, 'ref'> & RefAttributes<HTMLDivElement>\n> = forwardRef<HTMLDivElement, ToolOutputProps>(\n ({ className, output, errorText, ...props }, ref) => {\n if ((output === null || output === undefined) && !errorText) {\n return null;\n }\n\n let outputElement: ReactNode = null;\n if (typeof output === 'string') {\n outputElement = (\n <CodeBlock\n code={output}\n language={(isJsonString(output) ? 'json' : 'text') as CodeLanguage}\n collapsed\n >\n <CodeBlockCopyButton />\n <CodeBlockDownloadButton fileName=\"tool-result.json\" />\n <CodeBlockCollapseButton />\n </CodeBlock>\n );\n } else if (output === null || output === undefined) {\n outputElement = null;\n } else if (typeof output === 'object') {\n outputElement = (\n <CodeBlock\n code={JSON.stringify(output, null, 2)}\n language=\"json\"\n collapsed\n >\n <CodeBlockCopyButton />\n <CodeBlockDownloadButton fileName=\"tool-result.json\" />\n <CodeBlockCollapseButton />\n </CodeBlock>\n );\n } else if (\n typeof output === 'number' ||\n typeof output === 'boolean' ||\n typeof output === 'bigint'\n ) {\n outputElement = (\n <CodeBlock code={String(output)} language=\"json\" collapsed>\n <CodeBlockCopyButton />\n <CodeBlockDownloadButton fileName=\"tool-result.json\" />\n <CodeBlockCollapseButton />\n </CodeBlock>\n );\n }\n\n if (errorText) {\n return (\n <div\n ref={ref}\n data-slot=\"tool-output\"\n className={cn('space-y-2 px-3.25', className)}\n {...props}\n >\n <div className=\"flex flex-col gap-2 text-sm\">\n <span className=\"font-medium text-critical-foreground-strong\">\n ERROR\n </span>\n <span className=\"text-base-foreground\">{errorText}</span>\n </div>\n </div>\n );\n }\n\n return (\n <div\n ref={ref}\n data-slot=\"tool-output\"\n className={cn('space-y-2 px-3.25', className)}\n {...props}\n >\n <h4 className=\"text-sm font-medium uppercase tracking-wide text-muted-foreground\">\n Result\n </h4>\n <div className=\"min-h-0 overflow-x-auto rounded-md bg-muted-background/50 text-xs text-base-foreground [&_table]:w-full\">\n {outputElement}\n </div>\n </div>\n );\n }\n);\nToolOutput.displayName = 'ToolOutput';\n\nexport { Tool, ToolHeader, ToolContent, ToolInput, ToolOutput };\n"],"names":["forwardRef","IconSelector","cn","isJsonString","Badge","Button","CodeBlock","CodeBlockCollapseButton","CodeBlockCopyButton","CodeBlockDownloadButton","Collapsible","CollapsibleContent","CollapsibleTrigger","Tool","className","props","ref","data-slot","displayName","ToolHeader","title","type","hasError","render","variant","span","substring","indexOf","div","outline","ToolContent","ToolInput","input","h4","code","JSON","stringify","language","collapsed","fileName","ToolOutput","output","errorText","undefined","outputElement","String"],"mappings":";AAOA,SAASA,UAAU,QAAQ,QAAQ;AAMnC,SAASC,YAAY,QAAQ,sBAAsB;AAInD,SAASC,EAAE,EAAEC,YAAY,QAAQ,2BAAwB;AACzD,SAASC,KAAK,QAAQ,oBAAiB;AACvC,SAASC,MAAM,QAAQ,sBAAmB;AAC1C,SACEC,SAAS,EACTC,uBAAuB,EACvBC,mBAAmB,EACnBC,uBAAuB,QAClB,8BAA2B;AAClC,SACEC,WAAW,EACXC,kBAAkB,EAClBC,kBAAkB,QACb,gCAA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C,GAAGC,KAAK;;0BAET,KAACkB;gBAAGnB,WAAU;0BAAoE;;0BAGlF,KAACc;gBAAId,WAAU;0BACZ8B;;;;AAIT;AAEFJ,WAAWtB,WAAW,GAAG;AAEzB,SAASL,IAAI,EAAEM,UAAU,EAAEW,WAAW,EAAEC,SAAS,EAAES,UAAU,GAAG"}
@@ -0,0 +1,37 @@
1
+ import { type ComponentProps, type ForwardRefExoticComponent, type ReactNode, type RefAttributes } from "react";
2
+ import type { ToolbarButtonProps, ToolbarGroupProps, ToolbarRootProps, ToolbarSeparatorProps } from "@base-ui/react/toolbar";
3
+ import { Toolbar as ToolbarPrimitive } from "@base-ui/react/toolbar";
4
+ import { type VariantProps } from "class-variance-authority";
5
+ import type { ClassProp } from "class-variance-authority/types";
6
+ import { buttonVariants } from "../button/button";
7
+ import { segmentedControlButtonVariants, segmentedControlListVariants } from "../segmented-control/segmented-control";
8
+ interface ToolbarVariantProps {
9
+ floating?: boolean | null;
10
+ }
11
+ declare const toolbarVariants: (props?: (ToolbarVariantProps & ClassProp) | undefined) => string;
12
+ declare const Toolbar: ForwardRefExoticComponent<Omit<ToolbarRootProps & ToolbarVariantProps, "ref"> & RefAttributes<HTMLDivElement>>;
13
+ declare const ToolbarButton: ForwardRefExoticComponent<Omit<ToolbarButtonProps & VariantProps<typeof buttonVariants>, "ref"> & RefAttributes<HTMLButtonElement>>;
14
+ declare const ToolbarSeparator: ForwardRefExoticComponent<Omit<ToolbarSeparatorProps, "ref"> & RefAttributes<HTMLDivElement>>;
15
+ declare const ToolbarGroup: ForwardRefExoticComponent<Omit<ToolbarGroupProps, "ref"> & RefAttributes<HTMLDivElement>>;
16
+ type ToolbarTitleProps = ComponentProps<"span"> & {
17
+ badge?: ReactNode;
18
+ dropdown?: boolean;
19
+ };
20
+ declare function ToolbarTitle({ className, children, badge, dropdown, ...props }: ToolbarTitleProps): ReactNode;
21
+ type ToolbarSegmentedControlProps = Omit<ToolbarPrimitive.Group.Props, "onChange"> & VariantProps<typeof segmentedControlListVariants> & {
22
+ value?: string;
23
+ defaultValue?: string;
24
+ onValueChange?: (value: string) => void;
25
+ };
26
+ /**
27
+ * A single-select segmented control that participates in the Toolbar roving
28
+ * tabindex as real toolbar items (so arrow keys traverse it and the toolbar
29
+ * remains a single tab stop), while reusing SegmentedControl's styling and
30
+ * sliding indicator.
31
+ */
32
+ declare function ToolbarSegmentedControl({ className, size, value, defaultValue, onValueChange, children, ...props }: ToolbarSegmentedControlProps): ReactNode;
33
+ type ToolbarSegmentedControlButtonProps = ComponentProps<typeof ToolbarPrimitive.Button> & VariantProps<typeof segmentedControlButtonVariants> & {
34
+ value: string;
35
+ };
36
+ declare function ToolbarSegmentedControlButton({ className, size, tabContent, value, onClick, children, ...props }: ToolbarSegmentedControlButtonProps): ReactNode;
37
+ export { Toolbar, ToolbarButton, ToolbarGroup, ToolbarSegmentedControl, ToolbarSegmentedControlButton, ToolbarSeparator, ToolbarTitle, toolbarVariants };
@@ -0,0 +1,171 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createContext, forwardRef, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
3
+ import { Toolbar as ToolbarPrimitive } from "@base-ui/react/toolbar";
4
+ import { IconChevronDown } from "@tabler/icons-react";
5
+ import { cva } from "class-variance-authority";
6
+ import { cn } from "../../../../lib/utils.js";
7
+ import { buttonVariants } from "../button/button.js";
8
+ import { SegmentedControlIndicator, segmentedControlButtonVariants, segmentedControlListVariants } from "../segmented-control/segmented-control.js";
9
+ const toolbarVariants = cva('flex items-center justify-start data-[orientation=horizontal]:flex-row data-[orientation=vertical]:flex-col data-[orientation=horizontal]:gap-1.5 data-[orientation=vertical]:gap-1', {
10
+ variants: {
11
+ floating: {
12
+ true: 'rounded-xl border bg-popover-background shadow-sm data-[orientation=horizontal]:p-1.5 data-[orientation=vertical]:p-1',
13
+ false: ''
14
+ }
15
+ },
16
+ defaultVariants: {
17
+ floating: true
18
+ }
19
+ });
20
+ const Toolbar = /*#__PURE__*/ forwardRef(({ orientation, floating, className, ...props }, ref)=>{
21
+ return /*#__PURE__*/ _jsx(ToolbarPrimitive.Root, {
22
+ ref: ref,
23
+ "data-slot": "toolbar",
24
+ className: cn(toolbarVariants({
25
+ floating,
26
+ className
27
+ })),
28
+ orientation: orientation,
29
+ ...props
30
+ });
31
+ });
32
+ const ToolbarButton = /*#__PURE__*/ forwardRef(({ className, variant = 'ghost', size, render, ...props }, ref)=>{
33
+ return /*#__PURE__*/ _jsx(ToolbarPrimitive.Button, {
34
+ ref: ref,
35
+ "data-slot": "toolbar-button",
36
+ className: cn(buttonVariants({
37
+ variant,
38
+ size,
39
+ className
40
+ })),
41
+ render: render,
42
+ ...props
43
+ });
44
+ });
45
+ const ToolbarSeparator = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>{
46
+ return /*#__PURE__*/ _jsx(ToolbarPrimitive.Separator, {
47
+ ref: ref,
48
+ "data-slot": "toolbar-separator",
49
+ className: cn('bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-4 data-[orientation=vertical]:h-4 data-[orientation=vertical]:w-px', className),
50
+ ...props
51
+ });
52
+ });
53
+ const ToolbarGroup = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>{
54
+ return /*#__PURE__*/ _jsx(ToolbarPrimitive.Group, {
55
+ ref: ref,
56
+ "data-slot": "toolbar-group",
57
+ className: cn('flex items-center gap-1', className),
58
+ ...props
59
+ });
60
+ });
61
+ function ToolbarTitle({ className, children, badge, dropdown = false, ...props }) {
62
+ return /*#__PURE__*/ _jsxs("span", {
63
+ "data-slot": "toolbar-title",
64
+ className: cn('inline-flex h-9 items-center gap-2 text-sm font-medium text-foreground whitespace-nowrap px-2 [[data-slot=toolbar-button]_&]:px-0', className),
65
+ ...props,
66
+ children: [
67
+ /*#__PURE__*/ _jsxs("span", {
68
+ "data-slot": "toolbar-title-content",
69
+ className: "inline-flex items-center gap-2",
70
+ children: [
71
+ children,
72
+ badge
73
+ ]
74
+ }),
75
+ dropdown ? /*#__PURE__*/ _jsx(IconChevronDown, {
76
+ className: "size-4 shrink-0 text-muted-foreground"
77
+ }) : null
78
+ ]
79
+ });
80
+ }
81
+ const ToolbarSegmentedControlContext = /*#__PURE__*/ createContext(null);
82
+ function useToolbarSegmentedControlContext() {
83
+ const context = useContext(ToolbarSegmentedControlContext);
84
+ if (!context) {
85
+ throw new Error('ToolbarSegmentedControlButton must be used within a ToolbarSegmentedControl');
86
+ }
87
+ return context;
88
+ }
89
+ /**
90
+ * A single-select segmented control that participates in the Toolbar roving
91
+ * tabindex as real toolbar items (so arrow keys traverse it and the toolbar
92
+ * remains a single tab stop), while reusing SegmentedControl's styling and
93
+ * sliding indicator.
94
+ */ function ToolbarSegmentedControl({ className, size, value, defaultValue, onValueChange, children, ...props }) {
95
+ const resolvedSize = size ?? 'default';
96
+ const isControlled = value !== undefined;
97
+ const [internalValue, setInternalValue] = useState(defaultValue);
98
+ const currentValue = isControlled ? value : internalValue;
99
+ const onValueChangeRef = useRef(onValueChange);
100
+ useEffect(()=>{
101
+ onValueChangeRef.current = onValueChange;
102
+ }, [
103
+ onValueChange
104
+ ]);
105
+ const setValue = useCallback((next)=>{
106
+ if (!isControlled) {
107
+ setInternalValue(next);
108
+ }
109
+ onValueChangeRef.current?.(next);
110
+ }, [
111
+ isControlled
112
+ ]);
113
+ // useMemo required by @eslint-react/no-unstable-context-value — without it
114
+ // a new object is created every render, causing unnecessary re-renders in
115
+ // all context consumers.
116
+ const contextValue = useMemo(()=>({
117
+ value: currentValue,
118
+ setValue,
119
+ size: resolvedSize
120
+ }), [
121
+ currentValue,
122
+ setValue,
123
+ resolvedSize
124
+ ]);
125
+ return /*#__PURE__*/ _jsx(ToolbarSegmentedControlContext.Provider, {
126
+ value: contextValue,
127
+ children: /*#__PURE__*/ _jsxs(ToolbarPrimitive.Group, {
128
+ "data-slot": "toolbar-segmented-control",
129
+ className: cn(segmentedControlListVariants({
130
+ size
131
+ }), className),
132
+ ...props,
133
+ children: [
134
+ /*#__PURE__*/ _jsx(SegmentedControlIndicator, {
135
+ size: resolvedSize,
136
+ activeSelector: "[data-active]"
137
+ }),
138
+ children
139
+ ]
140
+ })
141
+ });
142
+ }
143
+ function ToolbarSegmentedControlButton({ className, size, tabContent, value, onClick, children, ...props }) {
144
+ const context = useToolbarSegmentedControlContext();
145
+ const resolvedSize = size ?? context.size;
146
+ const isActive = context.value === value;
147
+ return /*#__PURE__*/ _jsx(ToolbarPrimitive.Button, {
148
+ "data-slot": "toolbar-segmented-control-trigger",
149
+ "aria-pressed": isActive,
150
+ "data-active": isActive ? '' : undefined,
151
+ className: cn(segmentedControlButtonVariants({
152
+ size: resolvedSize,
153
+ tabContent
154
+ }), className),
155
+ onClick: (event)=>{
156
+ onClick?.(event);
157
+ if (!event.defaultPrevented) {
158
+ context.setValue(value);
159
+ }
160
+ },
161
+ ...props,
162
+ children: children
163
+ });
164
+ }
165
+ Toolbar.displayName = 'Toolbar';
166
+ ToolbarButton.displayName = 'ToolbarButton';
167
+ ToolbarSeparator.displayName = 'ToolbarSeparator';
168
+ ToolbarGroup.displayName = 'ToolbarGroup';
169
+ export { Toolbar, ToolbarButton, ToolbarGroup, ToolbarSegmentedControl, ToolbarSegmentedControlButton, ToolbarSeparator, ToolbarTitle, toolbarVariants };
170
+
171
+ //# sourceMappingURL=toolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/toolbar/toolbar.tsx"],"sourcesContent":["import {\n type ComponentProps,\n type ComponentRef,\n type Context,\n type ForwardRefExoticComponent,\n type ReactNode,\n type RefAttributes,\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport type {\n ToolbarButtonProps,\n ToolbarGroupProps,\n ToolbarRootProps,\n ToolbarSeparatorProps,\n} from '@base-ui/react/toolbar';\nimport { Toolbar as ToolbarPrimitive } from '@base-ui/react/toolbar';\nimport { IconChevronDown } from '@tabler/icons-react';\nimport { type VariantProps, cva } from 'class-variance-authority';\nimport type { ClassProp } from 'class-variance-authority/types';\n\nimport { cn } from '../../../../lib/utils';\nimport { buttonVariants } from '../button/button';\nimport {\n type SegmentedControlSize,\n SegmentedControlIndicator,\n segmentedControlButtonVariants,\n segmentedControlListVariants,\n} from '../segmented-control/segmented-control';\n\ninterface ToolbarVariantProps {\n floating?: boolean | null;\n}\n\nconst toolbarVariants: (\n props?: (ToolbarVariantProps & ClassProp) | undefined\n) => string = cva(\n 'flex items-center justify-start data-[orientation=horizontal]:flex-row data-[orientation=vertical]:flex-col data-[orientation=horizontal]:gap-1.5 data-[orientation=vertical]:gap-1',\n {\n variants: {\n floating: {\n true: 'rounded-xl border bg-popover-background shadow-sm data-[orientation=horizontal]:p-1.5 data-[orientation=vertical]:p-1',\n false: '',\n },\n },\n defaultVariants: {\n floating: true,\n },\n }\n);\n\ntype ToolbarProps = ToolbarPrimitive.Root.Props & ToolbarVariantProps;\n\nconst Toolbar: ForwardRefExoticComponent<\n Omit<ToolbarRootProps & ToolbarVariantProps, 'ref'> &\n RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<typeof ToolbarPrimitive.Root>, ToolbarProps>(\n ({ orientation, floating, className, ...props }, ref) => {\n return (\n <ToolbarPrimitive.Root\n ref={ref}\n data-slot=\"toolbar\"\n className={cn(toolbarVariants({ floating, className }))}\n orientation={orientation}\n {...props}\n />\n );\n }\n);\n\nconst ToolbarButton: ForwardRefExoticComponent<\n Omit<ToolbarButtonProps & VariantProps<typeof buttonVariants>, 'ref'> &\n RefAttributes<HTMLButtonElement>\n> = forwardRef<\n ComponentRef<typeof ToolbarPrimitive.Button>,\n ToolbarPrimitive.Button.Props & VariantProps<typeof buttonVariants>\n>(({ className, variant = 'ghost', size, render, ...props }, ref) => {\n return (\n <ToolbarPrimitive.Button\n ref={ref}\n data-slot=\"toolbar-button\"\n className={cn(buttonVariants({ variant, size, className }))}\n render={render}\n {...props}\n />\n );\n});\n\nconst ToolbarSeparator: ForwardRefExoticComponent<\n Omit<ToolbarSeparatorProps, 'ref'> & RefAttributes<HTMLDivElement>\n> = forwardRef<\n ComponentRef<typeof ToolbarPrimitive.Separator>,\n ToolbarPrimitive.Separator.Props\n>(({ className, ...props }, ref) => {\n return (\n <ToolbarPrimitive.Separator\n ref={ref}\n data-slot=\"toolbar-separator\"\n className={cn(\n 'bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-4 data-[orientation=vertical]:h-4 data-[orientation=vertical]:w-px',\n className\n )}\n {...props}\n />\n );\n});\n\nconst ToolbarGroup: ForwardRefExoticComponent<\n Omit<ToolbarGroupProps, 'ref'> & RefAttributes<HTMLDivElement>\n> = forwardRef<\n ComponentRef<typeof ToolbarPrimitive.Group>,\n ToolbarPrimitive.Group.Props\n>(({ className, ...props }, ref) => {\n return (\n <ToolbarPrimitive.Group\n ref={ref}\n data-slot=\"toolbar-group\"\n className={cn('flex items-center gap-1', className)}\n {...props}\n />\n );\n});\n\ntype ToolbarTitleProps = ComponentProps<'span'> & {\n badge?: ReactNode;\n dropdown?: boolean;\n};\n\nfunction ToolbarTitle({\n className,\n children,\n badge,\n dropdown = false,\n ...props\n}: ToolbarTitleProps): ReactNode {\n return (\n <span\n data-slot=\"toolbar-title\"\n className={cn(\n 'inline-flex h-9 items-center gap-2 text-sm font-medium text-foreground whitespace-nowrap px-2 [[data-slot=toolbar-button]_&]:px-0',\n className\n )}\n {...props}\n >\n <span\n data-slot=\"toolbar-title-content\"\n className=\"inline-flex items-center gap-2\"\n >\n {children}\n {badge}\n </span>\n {dropdown ? (\n <IconChevronDown className=\"size-4 shrink-0 text-muted-foreground\" />\n ) : null}\n </span>\n );\n}\n\ninterface ToolbarSegmentedControlContextValue {\n value: string | undefined;\n setValue: (value: string) => void;\n size: SegmentedControlSize;\n}\n\nconst ToolbarSegmentedControlContext: Context<ToolbarSegmentedControlContextValue | null> =\n createContext<ToolbarSegmentedControlContextValue | null>(null);\n\nfunction useToolbarSegmentedControlContext(): ToolbarSegmentedControlContextValue {\n const context = useContext(ToolbarSegmentedControlContext);\n if (!context) {\n throw new Error(\n 'ToolbarSegmentedControlButton must be used within a ToolbarSegmentedControl'\n );\n }\n return context;\n}\n\ntype ToolbarSegmentedControlProps = Omit<\n ToolbarPrimitive.Group.Props,\n 'onChange'\n> &\n VariantProps<typeof segmentedControlListVariants> & {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n };\n\n/**\n * A single-select segmented control that participates in the Toolbar roving\n * tabindex as real toolbar items (so arrow keys traverse it and the toolbar\n * remains a single tab stop), while reusing SegmentedControl's styling and\n * sliding indicator.\n */\nfunction ToolbarSegmentedControl({\n className,\n size,\n value,\n defaultValue,\n onValueChange,\n children,\n ...props\n}: ToolbarSegmentedControlProps): ReactNode {\n const resolvedSize = size ?? 'default';\n const isControlled = value !== undefined;\n const [internalValue, setInternalValue] = useState(defaultValue);\n const currentValue = isControlled ? value : internalValue;\n\n const onValueChangeRef = useRef(onValueChange);\n useEffect(() => {\n onValueChangeRef.current = onValueChange;\n }, [onValueChange]);\n\n const setValue = useCallback(\n (next: string): void => {\n if (!isControlled) {\n setInternalValue(next);\n }\n onValueChangeRef.current?.(next);\n },\n [isControlled]\n );\n\n // useMemo required by @eslint-react/no-unstable-context-value — without it\n // a new object is created every render, causing unnecessary re-renders in\n // all context consumers.\n const contextValue = useMemo<ToolbarSegmentedControlContextValue>(\n () => ({ value: currentValue, setValue, size: resolvedSize }),\n [currentValue, setValue, resolvedSize]\n );\n\n return (\n <ToolbarSegmentedControlContext.Provider value={contextValue}>\n <ToolbarPrimitive.Group\n data-slot=\"toolbar-segmented-control\"\n className={cn(segmentedControlListVariants({ size }), className)}\n {...props}\n >\n <SegmentedControlIndicator\n size={resolvedSize}\n activeSelector=\"[data-active]\"\n />\n {children}\n </ToolbarPrimitive.Group>\n </ToolbarSegmentedControlContext.Provider>\n );\n}\n\ntype ToolbarSegmentedControlButtonProps = ComponentProps<\n typeof ToolbarPrimitive.Button\n> &\n VariantProps<typeof segmentedControlButtonVariants> & {\n value: string;\n };\n\nfunction ToolbarSegmentedControlButton({\n className,\n size,\n tabContent,\n value,\n onClick,\n children,\n ...props\n}: ToolbarSegmentedControlButtonProps): ReactNode {\n const context = useToolbarSegmentedControlContext();\n const resolvedSize = size ?? context.size;\n const isActive = context.value === value;\n\n return (\n <ToolbarPrimitive.Button\n data-slot=\"toolbar-segmented-control-trigger\"\n aria-pressed={isActive}\n data-active={isActive ? '' : undefined}\n className={cn(\n segmentedControlButtonVariants({ size: resolvedSize, tabContent }),\n className\n )}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) {\n context.setValue(value);\n }\n }}\n {...props}\n >\n {children}\n </ToolbarPrimitive.Button>\n );\n}\n\nToolbar.displayName = 'Toolbar';\nToolbarButton.displayName = 'ToolbarButton';\nToolbarSeparator.displayName = 'ToolbarSeparator';\nToolbarGroup.displayName = 'ToolbarGroup';\n\nexport {\n Toolbar,\n ToolbarButton,\n ToolbarGroup,\n ToolbarSegmentedControl,\n ToolbarSegmentedControlButton,\n ToolbarSeparator,\n ToolbarTitle,\n toolbarVariants,\n};\n"],"names":["createContext","forwardRef","useCallback","useContext","useEffect","useMemo","useRef","useState","Toolbar","ToolbarPrimitive","IconChevronDown","cva","cn","buttonVariants","SegmentedControlIndicator","segmentedControlButtonVariants","segmentedControlListVariants","toolbarVariants","variants","floating","true","false","defaultVariants","orientation","className","props","ref","Root","data-slot","ToolbarButton","variant","size","render","Button","ToolbarSeparator","Separator","ToolbarGroup","Group","ToolbarTitle","children","badge","dropdown","span","ToolbarSegmentedControlContext","useToolbarSegmentedControlContext","context","Error","ToolbarSegmentedControl","value","defaultValue","onValueChange","resolvedSize","isControlled","undefined","internalValue","setInternalValue","currentValue","onValueChangeRef","current","setValue","next","contextValue","Provider","activeSelector","ToolbarSegmentedControlButton","tabContent","onClick","isActive","aria-pressed","data-active","event","defaultPrevented","displayName"],"mappings":";AAAA,S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