@archytechtor/ui 0.0.0-stage → 0.1.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 (449) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +105 -2
  3. package/dist/components/accordion/accordion.d.ts +25 -0
  4. package/dist/components/accordion/accordion.js +88 -0
  5. package/dist/components/accordion/index.d.ts +3 -0
  6. package/dist/components/accordion/index.js +1 -0
  7. package/dist/components/accordion/types.d.ts +39 -0
  8. package/dist/components/alert/alert.d.ts +25 -0
  9. package/dist/components/alert/alert.js +59 -0
  10. package/dist/components/alert/index.d.ts +3 -0
  11. package/dist/components/alert/index.js +3 -0
  12. package/dist/components/alert/types.d.ts +32 -0
  13. package/dist/components/alert/types.js +19 -0
  14. package/dist/components/alert-dialog/alert-dialog.d.ts +73 -0
  15. package/dist/components/alert-dialog/alert-dialog.js +170 -0
  16. package/dist/components/alert-dialog/index.d.ts +3 -0
  17. package/dist/components/alert-dialog/index.js +1 -0
  18. package/dist/components/alert-dialog/types.d.ts +80 -0
  19. package/dist/components/aspect-ratio/aspect-ratio.d.ts +8 -0
  20. package/dist/components/aspect-ratio/aspect-ratio.js +20 -0
  21. package/dist/components/aspect-ratio/index.d.ts +3 -0
  22. package/dist/components/aspect-ratio/index.js +1 -0
  23. package/dist/components/aspect-ratio/types.d.ts +8 -0
  24. package/dist/components/attachment/attachment.d.ts +57 -0
  25. package/dist/components/attachment/attachment.js +139 -0
  26. package/dist/components/attachment/index.d.ts +3 -0
  27. package/dist/components/attachment/index.js +3 -0
  28. package/dist/components/attachment/types.d.ts +79 -0
  29. package/dist/components/attachment/types.js +43 -0
  30. package/dist/components/avatar/avatar.d.ts +39 -0
  31. package/dist/components/avatar/avatar.js +88 -0
  32. package/dist/components/avatar/index.d.ts +3 -0
  33. package/dist/components/avatar/index.js +3 -0
  34. package/dist/components/avatar/types.d.ts +54 -0
  35. package/dist/components/avatar/types.js +21 -0
  36. package/dist/components/badge/badge.d.ts +7 -0
  37. package/dist/components/badge/badge.js +23 -0
  38. package/dist/components/badge/index.d.ts +3 -0
  39. package/dist/components/badge/index.js +3 -0
  40. package/dist/components/badge/types.d.ts +21 -0
  41. package/dist/components/badge/types.js +26 -0
  42. package/dist/components/breadcrumb/breadcrumb.d.ts +43 -0
  43. package/dist/components/breadcrumb/breadcrumb.js +115 -0
  44. package/dist/components/breadcrumb/index.d.ts +3 -0
  45. package/dist/components/breadcrumb/index.js +1 -0
  46. package/dist/components/breadcrumb/types.d.ts +36 -0
  47. package/dist/components/bubble/bubble.d.ts +25 -0
  48. package/dist/components/bubble/bubble.js +69 -0
  49. package/dist/components/bubble/index.d.ts +3 -0
  50. package/dist/components/bubble/index.js +3 -0
  51. package/dist/components/bubble/types.d.ts +51 -0
  52. package/dist/components/bubble/types.js +60 -0
  53. package/dist/components/button/button.d.ts +7 -0
  54. package/dist/components/button/button.js +155 -0
  55. package/dist/components/button/index.d.ts +4 -0
  56. package/dist/components/button/index.js +4 -0
  57. package/dist/components/button/types.d.ts +80 -0
  58. package/dist/components/button/types.js +99 -0
  59. package/dist/components/button/use-hold-to-confirm.d.ts +25 -0
  60. package/dist/components/button/use-hold-to-confirm.js +161 -0
  61. package/dist/components/button-group/button-group.d.ts +20 -0
  62. package/dist/components/button-group/button-group.js +62 -0
  63. package/dist/components/button-group/index.d.ts +3 -0
  64. package/dist/components/button-group/index.js +3 -0
  65. package/dist/components/button-group/types.d.ts +30 -0
  66. package/dist/components/button-group/types.js +19 -0
  67. package/dist/components/calendar/calendar.d.ts +15 -0
  68. package/dist/components/calendar/calendar.js +157 -0
  69. package/dist/components/calendar/index.d.ts +3 -0
  70. package/dist/components/calendar/index.js +1 -0
  71. package/dist/components/calendar/types.d.ts +21 -0
  72. package/dist/components/card/card.d.ts +43 -0
  73. package/dist/components/card/card.js +97 -0
  74. package/dist/components/card/index.d.ts +3 -0
  75. package/dist/components/card/index.js +3 -0
  76. package/dist/components/card/types.d.ts +44 -0
  77. package/dist/components/card/types.js +19 -0
  78. package/dist/components/carousel/carousel.d.ts +36 -0
  79. package/dist/components/carousel/carousel.js +190 -0
  80. package/dist/components/carousel/index.d.ts +3 -0
  81. package/dist/components/carousel/index.js +1 -0
  82. package/dist/components/carousel/types.d.ts +79 -0
  83. package/dist/components/chart/chart.d.ts +35 -0
  84. package/dist/components/chart/chart.js +212 -0
  85. package/dist/components/chart/index.d.ts +3 -0
  86. package/dist/components/chart/index.js +1 -0
  87. package/dist/components/chart/types.d.ts +89 -0
  88. package/dist/components/chart/types.js +7 -0
  89. package/dist/components/checkbox/checkbox.d.ts +7 -0
  90. package/dist/components/checkbox/checkbox.js +31 -0
  91. package/dist/components/checkbox/index.d.ts +3 -0
  92. package/dist/components/checkbox/index.js +1 -0
  93. package/dist/components/checkbox/types.d.ts +25 -0
  94. package/dist/components/code-block/code-block.d.ts +49 -0
  95. package/dist/components/code-block/code-block.js +188 -0
  96. package/dist/components/code-block/highlighter.d.ts +15 -0
  97. package/dist/components/code-block/highlighter.js +123 -0
  98. package/dist/components/code-block/index.d.ts +5 -0
  99. package/dist/components/code-block/index.js +5 -0
  100. package/dist/components/code-block/types.d.ts +94 -0
  101. package/dist/components/code-block/types.js +38 -0
  102. package/dist/components/code-block/use-highlighted-code.d.ts +9 -0
  103. package/dist/components/code-block/use-highlighted-code.js +67 -0
  104. package/dist/components/collapsible/collapsible.d.ts +19 -0
  105. package/dist/components/collapsible/collapsible.js +44 -0
  106. package/dist/components/collapsible/index.d.ts +3 -0
  107. package/dist/components/collapsible/index.js +1 -0
  108. package/dist/components/collapsible/types.d.ts +26 -0
  109. package/dist/components/combobox/combobox.d.ts +104 -0
  110. package/dist/components/combobox/combobox.js +365 -0
  111. package/dist/components/combobox/index.d.ts +3 -0
  112. package/dist/components/combobox/index.js +1 -0
  113. package/dist/components/combobox/types.d.ts +229 -0
  114. package/dist/components/command/command.d.ts +55 -0
  115. package/dist/components/command/command.js +179 -0
  116. package/dist/components/command/index.d.ts +3 -0
  117. package/dist/components/command/index.js +1 -0
  118. package/dist/components/command/types.d.ts +69 -0
  119. package/dist/components/context-menu/context-menu.d.ts +92 -0
  120. package/dist/components/context-menu/context-menu.js +270 -0
  121. package/dist/components/context-menu/index.d.ts +3 -0
  122. package/dist/components/context-menu/index.js +1 -0
  123. package/dist/components/context-menu/types.d.ts +138 -0
  124. package/dist/components/data-table/data-table-features.d.ts +21 -0
  125. package/dist/components/data-table/data-table-features.js +22 -0
  126. package/dist/components/data-table/data-table.d.ts +69 -0
  127. package/dist/components/data-table/data-table.js +283 -0
  128. package/dist/components/data-table/index.d.ts +4 -0
  129. package/dist/components/data-table/index.js +3 -0
  130. package/dist/components/data-table/types.d.ts +63 -0
  131. package/dist/components/date-input/date-input.d.ts +7 -0
  132. package/dist/components/date-input/date-input.js +147 -0
  133. package/dist/components/date-input/index.d.ts +3 -0
  134. package/dist/components/date-input/index.js +1 -0
  135. package/dist/components/date-input/types.d.ts +27 -0
  136. package/dist/components/date-picker/date-picker.d.ts +7 -0
  137. package/dist/components/date-picker/date-picker.js +74 -0
  138. package/dist/components/date-picker/index.d.ts +3 -0
  139. package/dist/components/date-picker/index.js +1 -0
  140. package/dist/components/date-picker/types.d.ts +38 -0
  141. package/dist/components/date-range-picker/date-range-picker.d.ts +7 -0
  142. package/dist/components/date-range-picker/date-range-picker.js +89 -0
  143. package/dist/components/date-range-picker/index.d.ts +3 -0
  144. package/dist/components/date-range-picker/index.js +1 -0
  145. package/dist/components/date-range-picker/types.d.ts +43 -0
  146. package/dist/components/dialog/dialog.d.ts +61 -0
  147. package/dist/components/dialog/dialog.js +160 -0
  148. package/dist/components/dialog/index.d.ts +3 -0
  149. package/dist/components/dialog/index.js +1 -0
  150. package/dist/components/dialog/types.d.ts +68 -0
  151. package/dist/components/drawer/drawer.d.ts +69 -0
  152. package/dist/components/drawer/drawer.js +245 -0
  153. package/dist/components/drawer/index.d.ts +3 -0
  154. package/dist/components/drawer/index.js +1 -0
  155. package/dist/components/drawer/types.d.ts +93 -0
  156. package/dist/components/dropdown-menu/dropdown-menu.d.ts +92 -0
  157. package/dist/components/dropdown-menu/dropdown-menu.js +268 -0
  158. package/dist/components/dropdown-menu/index.d.ts +3 -0
  159. package/dist/components/dropdown-menu/index.js +1 -0
  160. package/dist/components/dropdown-menu/types.d.ts +143 -0
  161. package/dist/components/empty/empty.d.ts +37 -0
  162. package/dist/components/empty/empty.js +84 -0
  163. package/dist/components/empty/index.d.ts +3 -0
  164. package/dist/components/empty/index.js +3 -0
  165. package/dist/components/empty/types.d.ts +39 -0
  166. package/dist/components/empty/types.js +13 -0
  167. package/dist/components/expanded-card/expanded-card.d.ts +43 -0
  168. package/dist/components/expanded-card/expanded-card.js +352 -0
  169. package/dist/components/expanded-card/index.d.ts +3 -0
  170. package/dist/components/expanded-card/index.js +1 -0
  171. package/dist/components/expanded-card/types.d.ts +52 -0
  172. package/dist/components/field/field.d.ts +62 -0
  173. package/dist/components/field/field.js +173 -0
  174. package/dist/components/field/index.d.ts +3 -0
  175. package/dist/components/field/index.js +3 -0
  176. package/dist/components/field/types.d.ts +81 -0
  177. package/dist/components/field/types.js +21 -0
  178. package/dist/components/form/form.d.ts +49 -0
  179. package/dist/components/form/form.js +136 -0
  180. package/dist/components/form/index.d.ts +3 -0
  181. package/dist/components/form/index.js +1 -0
  182. package/dist/components/form/types.d.ts +59 -0
  183. package/dist/components/hover-card/hover-card.d.ts +19 -0
  184. package/dist/components/hover-card/hover-card.js +63 -0
  185. package/dist/components/hover-card/index.d.ts +3 -0
  186. package/dist/components/hover-card/index.js +1 -0
  187. package/dist/components/hover-card/types.d.ts +27 -0
  188. package/dist/components/image-gallery/image-gallery.d.ts +8 -0
  189. package/dist/components/image-gallery/image-gallery.js +294 -0
  190. package/dist/components/image-gallery/index.d.ts +4 -0
  191. package/dist/components/image-gallery/index.js +3 -0
  192. package/dist/components/image-gallery/masonry.d.ts +11 -0
  193. package/dist/components/image-gallery/masonry.js +62 -0
  194. package/dist/components/image-gallery/types.d.ts +80 -0
  195. package/dist/components/input/index.d.ts +3 -0
  196. package/dist/components/input/index.js +1 -0
  197. package/dist/components/input/input.d.ts +7 -0
  198. package/dist/components/input/input.js +18 -0
  199. package/dist/components/input/types.d.ts +28 -0
  200. package/dist/components/input-group/index.d.ts +3 -0
  201. package/dist/components/input-group/index.js +3 -0
  202. package/dist/components/input-group/input-group.d.ts +37 -0
  203. package/dist/components/input-group/input-group.js +103 -0
  204. package/dist/components/input-group/types.d.ts +64 -0
  205. package/dist/components/input-group/types.js +31 -0
  206. package/dist/components/input-otp/index.d.ts +3 -0
  207. package/dist/components/input-otp/index.js +1 -0
  208. package/dist/components/input-otp/input-otp.d.ts +25 -0
  209. package/dist/components/input-otp/input-otp.js +76 -0
  210. package/dist/components/input-otp/types.d.ts +43 -0
  211. package/dist/components/item/index.d.ts +3 -0
  212. package/dist/components/item/index.js +3 -0
  213. package/dist/components/item/item.d.ts +61 -0
  214. package/dist/components/item/item.js +149 -0
  215. package/dist/components/item/types.d.ts +75 -0
  216. package/dist/components/item/types.js +48 -0
  217. package/dist/components/kbd/index.d.ts +3 -0
  218. package/dist/components/kbd/index.js +1 -0
  219. package/dist/components/kbd/kbd.d.ts +13 -0
  220. package/dist/components/kbd/kbd.js +30 -0
  221. package/dist/components/kbd/types.d.ts +9 -0
  222. package/dist/components/label/index.d.ts +3 -0
  223. package/dist/components/label/index.js +1 -0
  224. package/dist/components/label/label.d.ts +7 -0
  225. package/dist/components/label/label.js +17 -0
  226. package/dist/components/label/types.d.ts +8 -0
  227. package/dist/components/loader/index.d.ts +3 -0
  228. package/dist/components/loader/index.js +3 -0
  229. package/dist/components/loader/loader.d.ts +8 -0
  230. package/dist/components/loader/loader.js +386 -0
  231. package/dist/components/loader/types.d.ts +27 -0
  232. package/dist/components/loader/types.js +58 -0
  233. package/dist/components/marker/index.d.ts +3 -0
  234. package/dist/components/marker/index.js +3 -0
  235. package/dist/components/marker/marker.d.ts +19 -0
  236. package/dist/components/marker/marker.js +51 -0
  237. package/dist/components/marker/types.d.ts +30 -0
  238. package/dist/components/marker/types.js +16 -0
  239. package/dist/components/menubar/index.d.ts +3 -0
  240. package/dist/components/menubar/index.js +1 -0
  241. package/dist/components/menubar/menubar.d.ts +98 -0
  242. package/dist/components/menubar/menubar.js +284 -0
  243. package/dist/components/menubar/types.d.ts +146 -0
  244. package/dist/components/message/index.d.ts +3 -0
  245. package/dist/components/message/index.js +1 -0
  246. package/dist/components/message/message.d.ts +37 -0
  247. package/dist/components/message/message.js +83 -0
  248. package/dist/components/message/types.d.ts +32 -0
  249. package/dist/components/message-scroller/index.d.ts +4 -0
  250. package/dist/components/message-scroller/index.js +3 -0
  251. package/dist/components/message-scroller/message-scroller-primitive.d.ts +21 -0
  252. package/dist/components/message-scroller/message-scroller-primitive.js +1349 -0
  253. package/dist/components/message-scroller/message-scroller.d.ts +39 -0
  254. package/dist/components/message-scroller/message-scroller.js +103 -0
  255. package/dist/components/message-scroller/types.d.ts +107 -0
  256. package/dist/components/money-input/index.d.ts +3 -0
  257. package/dist/components/money-input/index.js +1 -0
  258. package/dist/components/money-input/money-input.d.ts +7 -0
  259. package/dist/components/money-input/money-input.js +143 -0
  260. package/dist/components/money-input/types.d.ts +20 -0
  261. package/dist/components/morph-image/index.d.ts +3 -0
  262. package/dist/components/morph-image/index.js +3 -0
  263. package/dist/components/morph-image/morph-image.d.ts +8 -0
  264. package/dist/components/morph-image/morph-image.js +155 -0
  265. package/dist/components/morph-image/types.d.ts +38 -0
  266. package/dist/components/morph-image/types.js +18 -0
  267. package/dist/components/native-select/index.d.ts +3 -0
  268. package/dist/components/native-select/index.js +3 -0
  269. package/dist/components/native-select/native-select.d.ts +20 -0
  270. package/dist/components/native-select/native-select.js +57 -0
  271. package/dist/components/native-select/types.d.ts +52 -0
  272. package/dist/components/native-select/types.js +23 -0
  273. package/dist/components/navigation-menu/index.d.ts +3 -0
  274. package/dist/components/navigation-menu/index.js +3 -0
  275. package/dist/components/navigation-menu/navigation-menu.d.ts +50 -0
  276. package/dist/components/navigation-menu/navigation-menu.js +145 -0
  277. package/dist/components/navigation-menu/types.d.ts +79 -0
  278. package/dist/components/navigation-menu/types.js +15 -0
  279. package/dist/components/number-stepper/index.d.ts +3 -0
  280. package/dist/components/number-stepper/index.js +3 -0
  281. package/dist/components/number-stepper/number-stepper.d.ts +9 -0
  282. package/dist/components/number-stepper/number-stepper.js +223 -0
  283. package/dist/components/number-stepper/types.d.ts +47 -0
  284. package/dist/components/number-stepper/types.js +174 -0
  285. package/dist/components/pagination/index.d.ts +3 -0
  286. package/dist/components/pagination/index.js +1 -0
  287. package/dist/components/pagination/pagination.d.ts +43 -0
  288. package/dist/components/pagination/pagination.js +121 -0
  289. package/dist/components/pagination/types.d.ts +37 -0
  290. package/dist/components/phone-input/index.d.ts +3 -0
  291. package/dist/components/phone-input/index.js +1 -0
  292. package/dist/components/phone-input/phone-input.d.ts +7 -0
  293. package/dist/components/phone-input/phone-input.js +54 -0
  294. package/dist/components/phone-input/types.d.ts +12 -0
  295. package/dist/components/popover/index.d.ts +3 -0
  296. package/dist/components/popover/index.js +1 -0
  297. package/dist/components/popover/popover.d.ts +37 -0
  298. package/dist/components/popover/popover.js +100 -0
  299. package/dist/components/popover/types.d.ts +51 -0
  300. package/dist/components/progress/index.d.ts +3 -0
  301. package/dist/components/progress/index.js +1 -0
  302. package/dist/components/progress/progress.d.ts +32 -0
  303. package/dist/components/progress/progress.js +100 -0
  304. package/dist/components/progress/types.d.ts +31 -0
  305. package/dist/components/questionnaire/index.d.ts +3 -0
  306. package/dist/components/questionnaire/index.js +1 -0
  307. package/dist/components/questionnaire/questionnaire-primitive.js +1563 -0
  308. package/dist/components/questionnaire/questionnaire.d.ts +91 -0
  309. package/dist/components/questionnaire/questionnaire.js +315 -0
  310. package/dist/components/questionnaire/types.d.ts +203 -0
  311. package/dist/components/radio-group/index.d.ts +3 -0
  312. package/dist/components/radio-group/index.js +1 -0
  313. package/dist/components/radio-group/radio-group.d.ts +13 -0
  314. package/dist/components/radio-group/radio-group.js +44 -0
  315. package/dist/components/radio-group/types.d.ts +33 -0
  316. package/dist/components/reorder-list/index.d.ts +3 -0
  317. package/dist/components/reorder-list/index.js +1 -0
  318. package/dist/components/reorder-list/reorder-list.d.ts +19 -0
  319. package/dist/components/reorder-list/reorder-list.js +279 -0
  320. package/dist/components/reorder-list/types.d.ts +65 -0
  321. package/dist/components/resizable/index.d.ts +3 -0
  322. package/dist/components/resizable/index.js +1 -0
  323. package/dist/components/resizable/resizable.d.ts +19 -0
  324. package/dist/components/resizable/resizable.js +44 -0
  325. package/dist/components/resizable/types.d.ts +89 -0
  326. package/dist/components/scroll-area/index.d.ts +3 -0
  327. package/dist/components/scroll-area/index.js +1 -0
  328. package/dist/components/scroll-area/scroll-area.d.ts +13 -0
  329. package/dist/components/scroll-area/scroll-area.js +47 -0
  330. package/dist/components/scroll-area/types.d.ts +19 -0
  331. package/dist/components/select/index.d.ts +3 -0
  332. package/dist/components/select/index.js +1 -0
  333. package/dist/components/select/select.d.ts +61 -0
  334. package/dist/components/select/select.js +183 -0
  335. package/dist/components/select/types.d.ts +100 -0
  336. package/dist/components/separator/index.d.ts +3 -0
  337. package/dist/components/separator/index.js +1 -0
  338. package/dist/components/separator/separator.d.ts +7 -0
  339. package/dist/components/separator/separator.js +20 -0
  340. package/dist/components/separator/types.d.ts +9 -0
  341. package/dist/components/sheet/index.d.ts +3 -0
  342. package/dist/components/sheet/index.js +1 -0
  343. package/dist/components/sheet/sheet.d.ts +61 -0
  344. package/dist/components/sheet/sheet.js +155 -0
  345. package/dist/components/sheet/types.d.ts +69 -0
  346. package/dist/components/sidebar/index.d.ts +3 -0
  347. package/dist/components/sidebar/index.js +3 -0
  348. package/dist/components/sidebar/sidebar.d.ts +145 -0
  349. package/dist/components/sidebar/sidebar.js +550 -0
  350. package/dist/components/sidebar/types.d.ts +186 -0
  351. package/dist/components/sidebar/types.js +42 -0
  352. package/dist/components/sidebar/use-mobile.js +21 -0
  353. package/dist/components/skeleton/index.d.ts +3 -0
  354. package/dist/components/skeleton/index.js +1 -0
  355. package/dist/components/skeleton/skeleton.d.ts +8 -0
  356. package/dist/components/skeleton/skeleton.js +18 -0
  357. package/dist/components/skeleton/types.d.ts +5 -0
  358. package/dist/components/slider/index.d.ts +3 -0
  359. package/dist/components/slider/index.js +1 -0
  360. package/dist/components/slider/slider.d.ts +7 -0
  361. package/dist/components/slider/slider.js +106 -0
  362. package/dist/components/slider/types.d.ts +39 -0
  363. package/dist/components/spinner/index.d.ts +3 -0
  364. package/dist/components/spinner/index.js +1 -0
  365. package/dist/components/spinner/spinner.d.ts +7 -0
  366. package/dist/components/spinner/spinner.js +21 -0
  367. package/dist/components/spinner/types.d.ts +8 -0
  368. package/dist/components/switch/index.d.ts +3 -0
  369. package/dist/components/switch/index.js +3 -0
  370. package/dist/components/switch/switch.d.ts +7 -0
  371. package/dist/components/switch/switch.js +32 -0
  372. package/dist/components/switch/types.d.ts +37 -0
  373. package/dist/components/switch/types.js +23 -0
  374. package/dist/components/table/index.d.ts +3 -0
  375. package/dist/components/table/index.js +1 -0
  376. package/dist/components/table/table.d.ts +49 -0
  377. package/dist/components/table/table.js +112 -0
  378. package/dist/components/table/types.d.ts +33 -0
  379. package/dist/components/tabs/index.d.ts +3 -0
  380. package/dist/components/tabs/index.js +3 -0
  381. package/dist/components/tabs/tabs.d.ts +25 -0
  382. package/dist/components/tabs/tabs.js +81 -0
  383. package/dist/components/tabs/types.d.ts +61 -0
  384. package/dist/components/tabs/types.js +18 -0
  385. package/dist/components/textarea/index.d.ts +3 -0
  386. package/dist/components/textarea/index.js +1 -0
  387. package/dist/components/textarea/textarea.d.ts +7 -0
  388. package/dist/components/textarea/textarea.js +17 -0
  389. package/dist/components/textarea/types.d.ts +26 -0
  390. package/dist/components/toast/index.d.ts +3 -0
  391. package/dist/components/toast/index.js +1 -0
  392. package/dist/components/toast/toast.d.ts +63 -0
  393. package/dist/components/toast/toast.js +321 -0
  394. package/dist/components/toast/types.d.ts +120 -0
  395. package/dist/components/toggle/index.d.ts +3 -0
  396. package/dist/components/toggle/index.js +3 -0
  397. package/dist/components/toggle/toggle.d.ts +7 -0
  398. package/dist/components/toggle/toggle.js +32 -0
  399. package/dist/components/toggle/types.d.ts +35 -0
  400. package/dist/components/toggle/types.js +37 -0
  401. package/dist/components/toggle-group/index.d.ts +3 -0
  402. package/dist/components/toggle-group/index.js +1 -0
  403. package/dist/components/toggle-group/toggle-group.d.ts +13 -0
  404. package/dist/components/toggle-group/toggle-group.js +88 -0
  405. package/dist/components/toggle-group/types.d.ts +52 -0
  406. package/dist/components/tooltip/index.d.ts +3 -0
  407. package/dist/components/tooltip/index.js +1 -0
  408. package/dist/components/tooltip/tooltip.d.ts +25 -0
  409. package/dist/components/tooltip/tooltip.js +79 -0
  410. package/dist/components/tooltip/types.d.ts +48 -0
  411. package/dist/components/trace/index.d.ts +3 -0
  412. package/dist/components/trace/index.js +1 -0
  413. package/dist/components/trace/trace.d.ts +52 -0
  414. package/dist/components/trace/trace.js +132 -0
  415. package/dist/components/trace/types.d.ts +54 -0
  416. package/dist/components/typography/index.d.ts +3 -0
  417. package/dist/components/typography/index.js +3 -0
  418. package/dist/components/typography/types.d.ts +29 -0
  419. package/dist/components/typography/types.js +25 -0
  420. package/dist/components/typography/typography.d.ts +7 -0
  421. package/dist/components/typography/typography.js +40 -0
  422. package/dist/components/video-player/index.d.ts +6 -0
  423. package/dist/components/video-player/index.js +5 -0
  424. package/dist/components/video-player/types.d.ts +143 -0
  425. package/dist/components/video-player/use-video-player.js +319 -0
  426. package/dist/components/video-player/video-player-context.d.ts +45 -0
  427. package/dist/components/video-player/video-player-context.js +15 -0
  428. package/dist/components/video-player/video-player-controls.d.ts +38 -0
  429. package/dist/components/video-player/video-player-controls.js +226 -0
  430. package/dist/components/video-player/video-player-overlay.d.ts +13 -0
  431. package/dist/components/video-player/video-player-overlay.js +113 -0
  432. package/dist/components/video-player/video-player.d.ts +8 -0
  433. package/dist/components/video-player/video-player.js +139 -0
  434. package/dist/index.d.ts +244 -0
  435. package/dist/index.js +114 -0
  436. package/dist/lib/floating.d.ts +44 -0
  437. package/dist/lib/focus-source.js +51 -0
  438. package/dist/lib/format.d.ts +67 -0
  439. package/dist/lib/format.js +130 -0
  440. package/dist/lib/locale.d.ts +104 -0
  441. package/dist/lib/locale.js +103 -0
  442. package/dist/lib/part-props.d.ts +15 -0
  443. package/dist/lib/use-controllable-state.js +22 -0
  444. package/dist/lib/utils.d.ts +9 -0
  445. package/dist/lib/utils.js +16 -0
  446. package/dist/styles/index.css +126 -0
  447. package/dist/styles/theme.css +80 -0
  448. package/dist/styles/utilities.css +553 -0
  449. package/package.json +89 -3
@@ -0,0 +1,190 @@
1
+ "use client";
2
+ import { cn } from "../../lib/utils.js";
3
+ import { texts } from "../../lib/locale.js";
4
+ import { Button } from "../button/button.js";
5
+ import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { createContext, useCallback, useContext, useEffect, useEffectEvent, useState } from "react";
8
+ import useEmblaCarousel from "embla-carousel-react";
9
+ // src/components/carousel/carousel.tsx
10
+ /** Состояние карусели */
11
+ const CarouselContext = createContext(null);
12
+ /**
13
+ * Состояние карусели: API, направление, функции прокрутки
14
+ * @returns состояние из Carousel
15
+ */
16
+ function useCarousel() {
17
+ const context = useContext(CarouselContext);
18
+ if (!context) throw new Error("useCarousel работает только внутри Carousel");
19
+ return context;
20
+ }
21
+ /**
22
+ * Карусель на Embla: слайды листаются свайпом, кнопками и стрелками клавиатуры
23
+ * @param props - пропсы карусели
24
+ * @returns div с role="region"
25
+ */
26
+ function Carousel({ orientation = "horizontal", opts, setApi, plugins, className, children, ...props }) {
27
+ const axis = orientation === "horizontal" ? "x" : "y";
28
+ const [carouselRef, api] = useEmblaCarousel({
29
+ ...opts,
30
+ axis
31
+ }, plugins);
32
+ const [canScrollPrev, setCanScrollPrev] = useState(false);
33
+ const [canScrollNext, setCanScrollNext] = useState(false);
34
+ const updateScroll = useCallback((carouselApi) => {
35
+ if (!carouselApi) return;
36
+ setCanScrollPrev(carouselApi.canScrollPrev());
37
+ setCanScrollNext(carouselApi.canScrollNext());
38
+ }, []);
39
+ const scrollPrev = useCallback(() => {
40
+ api?.scrollPrev();
41
+ }, [api]);
42
+ const scrollNext = useCallback(() => {
43
+ api?.scrollNext();
44
+ }, [api]);
45
+ /**
46
+ * Стрелки влево и вправо листают слайды
47
+ * @param event - нажатие клавиши
48
+ */
49
+ const handleKeyDown = (event) => {
50
+ if (event.key === "ArrowLeft") {
51
+ event.preventDefault();
52
+ scrollPrev();
53
+ } else if (event.key === "ArrowRight") {
54
+ event.preventDefault();
55
+ scrollNext();
56
+ }
57
+ };
58
+ const notifyApi = useEffectEvent((carouselApi) => setApi?.(carouselApi));
59
+ useEffect(() => {
60
+ if (api) notifyApi(api);
61
+ }, [api]);
62
+ useEffect(() => {
63
+ if (!api) return;
64
+ updateScroll(api);
65
+ api.on("reInit", updateScroll);
66
+ api.on("select", updateScroll);
67
+ return () => {
68
+ api.off("reInit", updateScroll);
69
+ api.off("select", updateScroll);
70
+ };
71
+ }, [api, updateScroll]);
72
+ const context = {
73
+ carouselRef,
74
+ api,
75
+ opts,
76
+ orientation,
77
+ scrollPrev,
78
+ scrollNext,
79
+ canScrollPrev,
80
+ canScrollNext
81
+ };
82
+ const classes = cn("relative", className);
83
+ return /* @__PURE__ */ jsx(CarouselContext.Provider, {
84
+ value: context,
85
+ children: /* @__PURE__ */ jsx("div", {
86
+ onKeyDownCapture: handleKeyDown,
87
+ className: classes,
88
+ role: "region",
89
+ "aria-roledescription": texts.carousel,
90
+ "data-slot": "carousel",
91
+ ...props,
92
+ children
93
+ })
94
+ });
95
+ }
96
+ /**
97
+ * Лента слайдов: область прокрутки с CarouselItem внутри
98
+ * @param props - пропсы ленты; className уходит на внутренний flex-контейнер
99
+ * @returns div
100
+ */
101
+ function CarouselContent({ className, ...props }) {
102
+ const { carouselRef, orientation } = useCarousel();
103
+ const classes = cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className);
104
+ return /* @__PURE__ */ jsx("div", {
105
+ ref: carouselRef,
106
+ className: "overflow-hidden",
107
+ "data-slot": "carousel-content",
108
+ children: /* @__PURE__ */ jsx("div", {
109
+ className: classes,
110
+ ...props
111
+ })
112
+ });
113
+ }
114
+ /**
115
+ * Слайд: по умолчанию во всю ширину; basis-1/2, basis-1/3 — несколько слайдов в ряд
116
+ * @param props - пропсы слайда
117
+ * @returns div с role="group"
118
+ */
119
+ function CarouselItem({ className, ...props }) {
120
+ const { orientation } = useCarousel();
121
+ const classes = cn("min-w-0", "shrink-0", "grow-0", "basis-full", orientation === "horizontal" ? "pl-4" : "pt-4", className);
122
+ return /* @__PURE__ */ jsx("div", {
123
+ role: "group",
124
+ "aria-roledescription": texts.slide,
125
+ "data-slot": "carousel-item",
126
+ className: classes,
127
+ ...props
128
+ });
129
+ }
130
+ /**
131
+ * Кнопка «назад»: круглая, слева от карусели, неактивна на первом слайде
132
+ * @param props - пропсы кнопки; по умолчанию variant="outline", size="icon-sm"
133
+ * @returns кнопка
134
+ */
135
+ function CarouselPrevious({ className, variant = "outline", size = "icon-sm", label = texts.previousSlide, onClick, ...props }) {
136
+ const { orientation, scrollPrev, canScrollPrev } = useCarousel();
137
+ const classes = cn("absolute", "touch-manipulation", "rounded-full", orientation === "horizontal" ? "inset-y-0 -left-12 my-auto" : "-top-12 left-1/2 -translate-x-1/2 rotate-90", className);
138
+ /**
139
+ * Нажатие: пролистать назад и передать событие наружу
140
+ * @param event - нажатие
141
+ */
142
+ const handleClick = (event) => {
143
+ scrollPrev();
144
+ onClick?.(event);
145
+ };
146
+ return /* @__PURE__ */ jsxs(Button, {
147
+ "data-slot": "carousel-previous",
148
+ variant,
149
+ size,
150
+ className: classes,
151
+ disabled: !canScrollPrev,
152
+ onClick: handleClick,
153
+ ...props,
154
+ children: [/* @__PURE__ */ jsx(ChevronLeftIcon, {}), /* @__PURE__ */ jsx("span", {
155
+ className: "sr-only",
156
+ children: label
157
+ })]
158
+ });
159
+ }
160
+ /**
161
+ * Кнопка «вперёд»: круглая, справа от карусели, неактивна на последнем слайде
162
+ * @param props - пропсы кнопки; по умолчанию variant="outline", size="icon-sm"
163
+ * @returns кнопка
164
+ */
165
+ function CarouselNext({ className, variant = "outline", size = "icon-sm", label = texts.nextSlide, onClick, ...props }) {
166
+ const { orientation, scrollNext, canScrollNext } = useCarousel();
167
+ const classes = cn("absolute", "touch-manipulation", "rounded-full", orientation === "horizontal" ? "inset-y-0 -right-12 my-auto" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", className);
168
+ /**
169
+ * Нажатие: пролистать вперёд и передать событие наружу
170
+ * @param event - нажатие
171
+ */
172
+ const handleClick = (event) => {
173
+ scrollNext();
174
+ onClick?.(event);
175
+ };
176
+ return /* @__PURE__ */ jsxs(Button, {
177
+ "data-slot": "carousel-next",
178
+ variant,
179
+ size,
180
+ className: classes,
181
+ disabled: !canScrollNext,
182
+ onClick: handleClick,
183
+ ...props,
184
+ children: [/* @__PURE__ */ jsx(ChevronRightIcon, {}), /* @__PURE__ */ jsx("span", {
185
+ className: "sr-only",
186
+ children: label
187
+ })]
188
+ });
189
+ }
190
+ export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel };
@@ -0,0 +1,3 @@
1
+ import { CarouselApiT, CarouselContentPropsT, CarouselContextI, CarouselItemPropsT, CarouselNextPropsT, CarouselOptionsT, CarouselOrientationT, CarouselPluginT, CarouselPreviousPropsT, CarouselPropsT } from "./types.js";
2
+ import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel } from "./carousel.js";
3
+ export { Carousel, type CarouselApiT, CarouselContent, type CarouselContentPropsT, type CarouselContextI, CarouselItem, type CarouselItemPropsT, CarouselNext, type CarouselNextPropsT, type CarouselOptionsT, type CarouselOrientationT, type CarouselPluginT, CarouselPrevious, type CarouselPreviousPropsT, type CarouselPropsT, useCarousel };
@@ -0,0 +1 @@
1
+ export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel } from "./carousel.js";
@@ -0,0 +1,79 @@
1
+ import { ButtonPropsT } from "../button/types.js";
2
+ import { ComponentProps } from "react";
3
+ import useEmblaCarousel, { UseEmblaCarouselType } from "embla-carousel-react";
4
+ /**
5
+ * API карусели Embla: scrollTo(), selectedScrollSnap(), on('select')…
6
+ */
7
+ export type CarouselApiT = UseEmblaCarouselType[1];
8
+ /**
9
+ * Параметры useEmblaCarousel
10
+ */
11
+ export type UseCarouselParametersT = Parameters<typeof useEmblaCarousel>;
12
+ /**
13
+ * Настройки Embla: loop, align, slidesToScroll…
14
+ */
15
+ export type CarouselOptionsT = UseCarouselParametersT[0];
16
+ /**
17
+ * Плагины Embla: автопрокрутка, колесо мыши…
18
+ */
19
+ export type CarouselPluginT = UseCarouselParametersT[1];
20
+ /**
21
+ * Направление карусели
22
+ */
23
+ export type CarouselOrientationT = 'horizontal' | 'vertical';
24
+ /**
25
+ * Состояние карусели для частей
26
+ * @property carouselRef - ref на область прокрутки
27
+ * @property api - API Embla
28
+ * @property opts - настройки Embla
29
+ * @property orientation - направление
30
+ * @property scrollPrev - к предыдущему слайду
31
+ * @property scrollNext - к следующему слайду
32
+ * @property canScrollPrev - есть слайд слева
33
+ * @property canScrollNext - есть слайд справа
34
+ */
35
+ export interface CarouselContextI {
36
+ carouselRef: UseEmblaCarouselType[0];
37
+ api: CarouselApiT;
38
+ opts?: CarouselOptionsT;
39
+ orientation: CarouselOrientationT;
40
+ scrollPrev: () => void;
41
+ scrollNext: () => void;
42
+ canScrollPrev: boolean;
43
+ canScrollNext: boolean;
44
+ }
45
+ /**
46
+ * Пропсы карусели
47
+ */
48
+ export type CarouselPropsT = ComponentProps<'div'> & {
49
+ /** Настройки Embla: loop, align, slidesToScroll… */
50
+ opts?: CarouselOptionsT;
51
+ /** Плагины Embla: автопрокрутка и другие */
52
+ plugins?: CarouselPluginT;
53
+ /** Направление: horizontal или vertical. По умолчанию horizontal */
54
+ orientation?: CarouselOrientationT;
55
+ /** Получить API Embla, когда карусель готова */
56
+ setApi?: (api: CarouselApiT) => void;
57
+ };
58
+ /**
59
+ * Пропсы ленты слайдов
60
+ */
61
+ export type CarouselContentPropsT = ComponentProps<'div'>;
62
+ /**
63
+ * Пропсы слайда
64
+ */
65
+ export type CarouselItemPropsT = ComponentProps<'div'>;
66
+ /**
67
+ * Пропсы кнопки «назад»
68
+ */
69
+ export type CarouselPreviousPropsT = ButtonPropsT & {
70
+ /** Подпись для скринридеров. По умолчанию «Предыдущий слайд» */
71
+ label?: string;
72
+ };
73
+ /**
74
+ * Пропсы кнопки «вперёд»
75
+ */
76
+ export type CarouselNextPropsT = ButtonPropsT & {
77
+ /** Подпись для скринридеров. По умолчанию «Следующий слайд» */
78
+ label?: string;
79
+ };
@@ -0,0 +1,35 @@
1
+ import { ChartContainerPropsT, ChartLegendContentPropsT, ChartStylePropsT, ChartTooltipContentPropsT } from "./types.js";
2
+ import * as RechartsPrimitive from "recharts";
3
+ /**
4
+ * Контейнер графика: подстраивает график под размер, задаёт цвета рядов и оформление осей.
5
+ * Высоту задайте через className, по умолчанию пропорции 16:9
6
+ * @param props - пропсы контейнера; config — подписи и цвета рядов
7
+ * @returns div с графиком
8
+ */
9
+ export declare function ChartContainer({ id, className, children, config, initialDimension, ...props }: ChartContainerPropsT): import("react").JSX.Element;
10
+ /**
11
+ * Стили графика: CSS-переменные --color-<ключ> для светлой и тёмной темы
12
+ * @param props - id графика и настройки рядов
13
+ * @returns style или null, если цветов нет
14
+ */
15
+ export declare function ChartStyle({ id, config }: ChartStylePropsT): import("react").JSX.Element | null;
16
+ /**
17
+ * Подсказка графика: Tooltip из recharts. В content передайте ChartTooltipContent
18
+ */
19
+ export declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
20
+ /**
21
+ * Содержимое подсказки: заголовок и значения рядов с цветными отметками. Числа — в формате ru-RU
22
+ * @param props - данные от recharts и настройки вида
23
+ * @returns div или null, если подсказка скрыта
24
+ */
25
+ export declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey }: ChartTooltipContentPropsT): import("react").JSX.Element | null;
26
+ /**
27
+ * Легенда графика: Legend из recharts. В content передайте ChartLegendContent
28
+ */
29
+ export declare const ChartLegend: import("react").MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
30
+ /**
31
+ * Содержимое легенды: цветной квадрат или иконка и подпись каждого ряда
32
+ * @param props - данные от recharts и настройки вида
33
+ * @returns div или null, если рядов нет
34
+ */
35
+ export declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey }: ChartLegendContentPropsT): import("react").JSX.Element | null;
@@ -0,0 +1,212 @@
1
+ "use client";
2
+ import { cn } from "../../lib/utils.js";
3
+ import { formatNumber } from "../../lib/format.js";
4
+ import { THEMES } from "./types.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { createContext, useContext, useId } from "react";
7
+ import * as RechartsPrimitive from "recharts";
8
+ // src/components/chart/chart.tsx
9
+ /** Размер графика до первого замера контейнера */
10
+ const INITIAL_DIMENSION = {
11
+ width: 320,
12
+ height: 200
13
+ };
14
+ /** Настройки рядов текущего графика */
15
+ const ChartContext = createContext(null);
16
+ /**
17
+ * Настройки рядов текущего графика
18
+ * @returns настройки из ChartContainer
19
+ */
20
+ function useChart() {
21
+ const context = useContext(ChartContext);
22
+ if (!context) throw new Error("useChart работает только внутри ChartContainer");
23
+ return context;
24
+ }
25
+ /**
26
+ * Контейнер графика: подстраивает график под размер, задаёт цвета рядов и оформление осей.
27
+ * Высоту задайте через className, по умолчанию пропорции 16:9
28
+ * @param props - пропсы контейнера; config — подписи и цвета рядов
29
+ * @returns div с графиком
30
+ */
31
+ function ChartContainer({ id, className, children, config, initialDimension = INITIAL_DIMENSION, ...props }) {
32
+ const uniqueId = useId();
33
+ const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`;
34
+ const context = { config };
35
+ const classes = cn("flex", "aspect-video", "justify-center", "text-xs", "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", "[&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50", "[&_.recharts-curve.recharts-tooltip-cursor]:stroke-border", "[&_.recharts-dot[stroke='#fff']]:stroke-transparent", "[&_.recharts-layer]:outline-hidden", "[&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border", "[&_.recharts-radial-bar-background-sector]:fill-muted", "[&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted", "[&_.recharts-reference-line_[stroke='#ccc']]:stroke-border", "[&_.recharts-sector]:outline-hidden", "[&_.recharts-sector[stroke='#fff']]:stroke-transparent", "[&_.recharts-surface]:outline-hidden", className);
36
+ return /* @__PURE__ */ jsx(ChartContext.Provider, {
37
+ value: context,
38
+ children: /* @__PURE__ */ jsxs("div", {
39
+ "data-slot": "chart",
40
+ "data-chart": chartId,
41
+ className: classes,
42
+ ...props,
43
+ children: [/* @__PURE__ */ jsx(ChartStyle, {
44
+ id: chartId,
45
+ config
46
+ }), /* @__PURE__ */ jsx(RechartsPrimitive.ResponsiveContainer, {
47
+ initialDimension,
48
+ children
49
+ })]
50
+ })
51
+ });
52
+ }
53
+ /**
54
+ * Стили графика: CSS-переменные --color-<ключ> для светлой и тёмной темы
55
+ * @param props - id графика и настройки рядов
56
+ * @returns style или null, если цветов нет
57
+ */
58
+ function ChartStyle({ id, config }) {
59
+ const colorConfig = [];
60
+ for (const entry of Object.entries(config)) if (entry[1].theme ?? entry[1].color) colorConfig.push(entry);
61
+ if (colorConfig.length === 0) return null;
62
+ const blocks = [];
63
+ for (const [theme, prefix] of Object.entries(THEMES)) {
64
+ const lines = [];
65
+ for (const [key, itemConfig] of colorConfig) {
66
+ const color = itemConfig.theme?.[theme] ?? itemConfig.color;
67
+ if (color) lines.push(` --color-${key}: ${color};`);
68
+ }
69
+ const body = lines.join("\n");
70
+ blocks.push(`${prefix} [data-chart=${id}] {\n${body}\n}`);
71
+ }
72
+ const html = { __html: blocks.join("\n") };
73
+ return /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: html });
74
+ }
75
+ /**
76
+ * Подсказка графика: Tooltip из recharts. В content передайте ChartTooltipContent
77
+ */
78
+ const ChartTooltip = RechartsPrimitive.Tooltip;
79
+ /**
80
+ * Найти настройки ряда по данным точки
81
+ * @param config - настройки рядов
82
+ * @param payload - данные точки из recharts
83
+ * @param key - ключ ряда или поля с его именем
84
+ * @returns настройки ряда или undefined
85
+ */
86
+ function getPayloadConfig(config, payload, key) {
87
+ if (typeof payload !== "object" || payload === null) return;
88
+ const innerPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
89
+ const record = payload;
90
+ let configLabelKey = key;
91
+ if (typeof record[key] === "string") configLabelKey = record[key];
92
+ else if (innerPayload && typeof innerPayload[key] === "string") configLabelKey = innerPayload[key];
93
+ if (configLabelKey in config) return config[configLabelKey];
94
+ return config[key];
95
+ }
96
+ /**
97
+ * Содержимое подсказки: заголовок и значения рядов с цветными отметками. Числа — в формате ru-RU
98
+ * @param props - данные от recharts и настройки вида
99
+ * @returns div или null, если подсказка скрыта
100
+ */
101
+ function ChartTooltipContent({ active, payload, className, indicator = "dot", hideLabel = false, hideIndicator = false, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey }) {
102
+ const { config } = useChart();
103
+ if (!active || !payload?.length) return null;
104
+ const nestLabel = payload.length === 1 && indicator !== "dot";
105
+ const labelClasses = cn("font-medium", labelClassName);
106
+ let tooltipLabel = null;
107
+ if (!hideLabel) {
108
+ const [item] = payload;
109
+ const itemConfig = getPayloadConfig(config, item, String(labelKey ?? item?.dataKey ?? item?.name ?? "value"));
110
+ const value = !labelKey && typeof label === "string" ? config[label]?.label ?? label : itemConfig?.label;
111
+ if (labelFormatter) tooltipLabel = /* @__PURE__ */ jsx("div", {
112
+ className: labelClasses,
113
+ children: labelFormatter(value, payload)
114
+ });
115
+ else if (value) tooltipLabel = /* @__PURE__ */ jsx("div", {
116
+ className: labelClasses,
117
+ children: value
118
+ });
119
+ }
120
+ const rows = [];
121
+ payload.forEach((item, index) => {
122
+ if (item.type === "none") return;
123
+ const key = String(nameKey ?? item.name ?? item.dataKey ?? "value");
124
+ const itemConfig = getPayloadConfig(config, item, key);
125
+ const indicatorColor = color ?? item.payload?.fill ?? item.color;
126
+ const rowClasses = cn("flex", "w-full", "flex-wrap", "items-stretch", "gap-2", "[&>svg]:h-2.5", "[&>svg]:w-2.5", "[&>svg]:text-muted-foreground", indicator === "dot" && "items-center");
127
+ if (formatter && item?.value !== void 0 && item.name) {
128
+ rows.push(/* @__PURE__ */ jsx("div", {
129
+ className: rowClasses,
130
+ children: formatter(item.value, item.name, item, index, item.payload)
131
+ }, index));
132
+ return;
133
+ }
134
+ const indicatorClasses = cn("shrink-0", "rounded-[2px]", "border-(--color-border)", "bg-(--color-bg)", {
135
+ "h-2.5 w-2.5": indicator === "dot",
136
+ "w-1": indicator === "line",
137
+ "w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
138
+ "my-0.5": nestLabel && indicator === "dashed"
139
+ });
140
+ const indicatorStyle = {
141
+ "--color-bg": indicatorColor,
142
+ "--color-border": indicatorColor
143
+ };
144
+ const valueAlign = nestLabel ? "items-end" : "items-center";
145
+ const formattedValue = typeof item.value === "number" ? formatNumber(item.value) : String(item.value);
146
+ const valueClasses = cn("flex", "flex-1", "justify-between", "gap-4", "leading-none", valueAlign);
147
+ let marker = null;
148
+ if (itemConfig?.icon) marker = /* @__PURE__ */ jsx(itemConfig.icon, {});
149
+ else if (!hideIndicator) marker = /* @__PURE__ */ jsx("div", {
150
+ className: indicatorClasses,
151
+ style: indicatorStyle
152
+ });
153
+ rows.push(/* @__PURE__ */ jsxs("div", {
154
+ className: rowClasses,
155
+ children: [marker, /* @__PURE__ */ jsxs("div", {
156
+ className: valueClasses,
157
+ children: [/* @__PURE__ */ jsxs("div", {
158
+ className: "grid gap-1.5",
159
+ children: [nestLabel ? tooltipLabel : null, /* @__PURE__ */ jsx("span", {
160
+ className: "text-muted-foreground",
161
+ children: itemConfig?.label ?? item.name
162
+ })]
163
+ }), item.value != null && /* @__PURE__ */ jsx("span", {
164
+ className: "font-mono font-medium text-foreground tabular-nums",
165
+ children: formattedValue
166
+ })]
167
+ })]
168
+ }, index));
169
+ });
170
+ const classes = cn("grid", "min-w-32", "items-start", "gap-1.5", "rounded-lg", "border", "border-border/50", "bg-background", "px-2.5", "py-1.5", "text-xs", "shadow-xl", className);
171
+ return /* @__PURE__ */ jsxs("div", {
172
+ className: classes,
173
+ children: [nestLabel ? null : tooltipLabel, /* @__PURE__ */ jsx("div", {
174
+ className: "grid gap-1.5",
175
+ children: rows
176
+ })]
177
+ });
178
+ }
179
+ /**
180
+ * Легенда графика: Legend из recharts. В content передайте ChartLegendContent
181
+ */
182
+ const ChartLegend = RechartsPrimitive.Legend;
183
+ /**
184
+ * Содержимое легенды: цветной квадрат или иконка и подпись каждого ряда
185
+ * @param props - данные от recharts и настройки вида
186
+ * @returns div или null, если рядов нет
187
+ */
188
+ function ChartLegendContent({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }) {
189
+ const { config } = useChart();
190
+ if (!payload?.length) return null;
191
+ const items = [];
192
+ payload.forEach((item, index) => {
193
+ if (item.type === "none") return;
194
+ const key = String(nameKey ?? item.dataKey ?? "value");
195
+ const itemConfig = getPayloadConfig(config, item, key);
196
+ const markerStyle = { backgroundColor: item.color };
197
+ const marker = itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsx("div", {
198
+ className: "h-2 w-2 shrink-0 rounded-[2px]",
199
+ style: markerStyle
200
+ });
201
+ items.push(/* @__PURE__ */ jsxs("div", {
202
+ className: "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground",
203
+ children: [marker, itemConfig?.label]
204
+ }, index));
205
+ });
206
+ const classes = cn("flex", "items-center", "justify-center", "gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className);
207
+ return /* @__PURE__ */ jsx("div", {
208
+ className: classes,
209
+ children: items
210
+ });
211
+ }
212
+ export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };
@@ -0,0 +1,3 @@
1
+ import { ChartConfigT, ChartContainerPropsT, ChartIndicatorT, ChartLegendContentPropsT, ChartStylePropsT, ChartTooltipContentPropsT } from "./types.js";
2
+ import { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent } from "./chart.js";
3
+ export { type ChartConfigT, ChartContainer, type ChartContainerPropsT, type ChartIndicatorT, ChartLegend, ChartLegendContent, type ChartLegendContentPropsT, ChartStyle, type ChartStylePropsT, ChartTooltip, ChartTooltipContent, type ChartTooltipContentPropsT };
@@ -0,0 +1 @@
1
+ export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent } from "./chart.js";
@@ -0,0 +1,89 @@
1
+ import { ComponentProps, ComponentType, ReactNode } from "react";
2
+ import * as RechartsPrimitive from "recharts";
3
+ import { TooltipValueType } from "recharts";
4
+ /** Темы и их селекторы: светлая — без селектора, тёмная — .dark */
5
+ export declare const THEMES: {
6
+ readonly light: "";
7
+ readonly dark: ".dark";
8
+ };
9
+ /**
10
+ * Имя ряда в подсказке
11
+ */
12
+ export type TooltipNameT = number | string;
13
+ /**
14
+ * Тема графика
15
+ */
16
+ export type ChartThemeT = keyof typeof THEMES;
17
+ /**
18
+ * Настройки рядов графика: подпись, иконка и цвет каждого ряда по его ключу.
19
+ * Цвет попадает в CSS-переменную --color-<ключ>
20
+ */
21
+ export type ChartConfigT = Record<string, {
22
+ /** Подпись ряда в подсказке и легенде */
23
+ label?: ReactNode;
24
+ /** Иконка вместо цветного квадрата */
25
+ icon?: ComponentType;
26
+ } & ({
27
+ /** Цвет ряда: var(--chart-1), oklch(…) */
28
+ color?: string;
29
+ /** Цвет для каждой темы — вместо color */
30
+ theme?: never;
31
+ } | {
32
+ /** Цвет ряда — вместо theme */
33
+ color?: never;
34
+ /** Цвет для каждой темы: { light, dark } */
35
+ theme: Record<ChartThemeT, string>;
36
+ })>;
37
+ /**
38
+ * Пропсы контейнера графика
39
+ */
40
+ export type ChartContainerPropsT = Omit<ComponentProps<'div'>, 'children'> & {
41
+ /** Настройки рядов: подписи и цвета */
42
+ config: ChartConfigT;
43
+ /** График recharts: BarChart, LineChart, AreaChart, PieChart… */
44
+ children: ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];
45
+ /** Размер до первого замера контейнера, px. По умолчанию 320×200 */
46
+ initialDimension?: {
47
+ /** Ширина */
48
+ width: number;
49
+ /** Высота */
50
+ height: number;
51
+ };
52
+ };
53
+ /**
54
+ * Пропсы стилей графика
55
+ */
56
+ export type ChartStylePropsT = {
57
+ /** id графика из data-chart */
58
+ id: string;
59
+ /** Настройки рядов */
60
+ config: ChartConfigT;
61
+ };
62
+ /**
63
+ * Вид отметки ряда в подсказке: dot — квадрат, line — полоса, dashed — пунктир
64
+ */
65
+ export type ChartIndicatorT = 'line' | 'dot' | 'dashed';
66
+ /**
67
+ * Пропсы содержимого подсказки
68
+ */
69
+ export type ChartTooltipContentPropsT = ComponentProps<typeof RechartsPrimitive.Tooltip> & ComponentProps<'div'> & Omit<RechartsPrimitive.DefaultTooltipContentProps<TooltipValueType, TooltipNameT>, 'accessibilityLayer'> & {
70
+ /** Скрыть заголовок подсказки */
71
+ hideLabel?: boolean;
72
+ /** Скрыть цветные отметки рядов */
73
+ hideIndicator?: boolean;
74
+ /** Вид отметки: dot, line или dashed. По умолчанию dot */
75
+ indicator?: ChartIndicatorT;
76
+ /** Поле данных с именем ряда — ключом в config */
77
+ nameKey?: string;
78
+ /** Поле данных с заголовком — ключом в config */
79
+ labelKey?: string;
80
+ };
81
+ /**
82
+ * Пропсы содержимого легенды
83
+ */
84
+ export type ChartLegendContentPropsT = ComponentProps<'div'> & RechartsPrimitive.DefaultLegendContentProps & {
85
+ /** Скрыть иконки рядов из config */
86
+ hideIcon?: boolean;
87
+ /** Поле данных с именем ряда — ключом в config */
88
+ nameKey?: string;
89
+ };
@@ -0,0 +1,7 @@
1
+ // src/components/chart/types.ts
2
+ /** Темы и их селекторы: светлая — без селектора, тёмная — .dark */
3
+ const THEMES = {
4
+ light: "",
5
+ dark: ".dark"
6
+ };
7
+ export { THEMES };
@@ -0,0 +1,7 @@
1
+ import { CheckboxPropsT } from "./types.js";
2
+ /**
3
+ * Флажок: отметить или снять отметку
4
+ * @param props - пропсы флажка
5
+ * @returns элемент с role=checkbox
6
+ */
7
+ export declare function Checkbox({ className, onCheckedChange, ...props }: CheckboxPropsT): import("react").JSX.Element;