@eylulg/ui 0.0.0-stage → 1.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 (367) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +328 -2
  3. package/dist/chrome/Anchor.d.ts +3 -0
  4. package/dist/chrome/Anchor.js +14 -0
  5. package/dist/chrome/Anchor.js.map +1 -0
  6. package/dist/chrome/AppShell.d.ts +28 -0
  7. package/dist/chrome/AppShell.js +57 -0
  8. package/dist/chrome/AppShell.js.map +1 -0
  9. package/dist/chrome/BrandLogo.d.ts +13 -0
  10. package/dist/chrome/BrandLogo.js +33 -0
  11. package/dist/chrome/BrandLogo.js.map +1 -0
  12. package/dist/chrome/BrandMark.d.ts +12 -0
  13. package/dist/chrome/BrandMark.js +40 -0
  14. package/dist/chrome/BrandMark.js.map +1 -0
  15. package/dist/chrome/LinkRouter.d.ts +19 -0
  16. package/dist/chrome/LinkRouter.js +28 -0
  17. package/dist/chrome/LinkRouter.js.map +1 -0
  18. package/dist/chrome/MobileMenu.d.ts +19 -0
  19. package/dist/chrome/MobileMenu.js +52 -0
  20. package/dist/chrome/MobileMenu.js.map +1 -0
  21. package/dist/chrome/ProjectSwitcher.d.ts +30 -0
  22. package/dist/chrome/ProjectSwitcher.js +64 -0
  23. package/dist/chrome/ProjectSwitcher.js.map +1 -0
  24. package/dist/chrome/ProjectSwitcherMenu.d.ts +13 -0
  25. package/dist/chrome/ProjectSwitcherMenu.js +50 -0
  26. package/dist/chrome/ProjectSwitcherMenu.js.map +1 -0
  27. package/dist/chrome/SidebarNav.d.ts +34 -0
  28. package/dist/chrome/SidebarNav.js +106 -0
  29. package/dist/chrome/SidebarNav.js.map +1 -0
  30. package/dist/chrome/SiteFooter.d.ts +37 -0
  31. package/dist/chrome/SiteFooter.js +105 -0
  32. package/dist/chrome/SiteFooter.js.map +1 -0
  33. package/dist/chrome/TextSizeToggle.d.ts +11 -0
  34. package/dist/chrome/TextSizeToggle.js +38 -0
  35. package/dist/chrome/TextSizeToggle.js.map +1 -0
  36. package/dist/chrome/ThemeToggle.d.ts +26 -0
  37. package/dist/chrome/ThemeToggle.js +100 -0
  38. package/dist/chrome/ThemeToggle.js.map +1 -0
  39. package/dist/chrome/ThemeToggleMenu.d.ts +16 -0
  40. package/dist/chrome/ThemeToggleMenu.js +42 -0
  41. package/dist/chrome/ThemeToggleMenu.js.map +1 -0
  42. package/dist/chrome/TopNav.d.ts +42 -0
  43. package/dist/chrome/TopNav.js +117 -0
  44. package/dist/chrome/TopNav.js.map +1 -0
  45. package/dist/chrome/brandLogoPath.d.ts +2 -0
  46. package/dist/chrome/brandLogoPath.js +7 -0
  47. package/dist/chrome/brandLogoPath.js.map +1 -0
  48. package/dist/chrome/index.d.ts +28 -0
  49. package/dist/chrome/index.js +15 -0
  50. package/dist/chrome/projects.d.ts +28 -0
  51. package/dist/chrome/projects.js +105 -0
  52. package/dist/chrome/projects.js.map +1 -0
  53. package/dist/chrome/themeChoices.d.ts +6 -0
  54. package/dist/chrome/themeChoices.js +18 -0
  55. package/dist/chrome/themeChoices.js.map +1 -0
  56. package/dist/chrome/themeScript.d.ts +16 -0
  57. package/dist/chrome/themeScript.js +20 -0
  58. package/dist/chrome/themeScript.js.map +1 -0
  59. package/dist/chrome/types.d.ts +17 -0
  60. package/dist/chrome/useTextSize.d.ts +16 -0
  61. package/dist/chrome/useTextSize.js +64 -0
  62. package/dist/chrome/useTextSize.js.map +1 -0
  63. package/dist/chrome/useTheme.d.ts +19 -0
  64. package/dist/chrome/useTheme.js +86 -0
  65. package/dist/chrome/useTheme.js.map +1 -0
  66. package/dist/components/Avatar/Avatar.d.ts +39 -0
  67. package/dist/components/Avatar/Avatar.js +122 -0
  68. package/dist/components/Avatar/Avatar.js.map +1 -0
  69. package/dist/components/Avatar/index.d.ts +2 -0
  70. package/dist/components/Avatar/index.js +2 -0
  71. package/dist/components/Badge/Badge.d.ts +19 -0
  72. package/dist/components/Badge/Badge.js +77 -0
  73. package/dist/components/Badge/Badge.js.map +1 -0
  74. package/dist/components/Badge/index.d.ts +2 -0
  75. package/dist/components/Badge/index.js +2 -0
  76. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +18 -0
  77. package/dist/components/Breadcrumbs/Breadcrumbs.js +40 -0
  78. package/dist/components/Breadcrumbs/Breadcrumbs.js.map +1 -0
  79. package/dist/components/Breadcrumbs/index.d.ts +2 -0
  80. package/dist/components/Breadcrumbs/index.js +2 -0
  81. package/dist/components/Button/Button.d.ts +39 -0
  82. package/dist/components/Button/Button.js +73 -0
  83. package/dist/components/Button/Button.js.map +1 -0
  84. package/dist/components/Button/buttonStyles.d.ts +21 -0
  85. package/dist/components/Button/buttonStyles.js +32 -0
  86. package/dist/components/Button/buttonStyles.js.map +1 -0
  87. package/dist/components/Button/index.d.ts +2 -0
  88. package/dist/components/Button/index.js +4 -0
  89. package/dist/components/Card/Card.d.ts +47 -0
  90. package/dist/components/Card/Card.js +119 -0
  91. package/dist/components/Card/Card.js.map +1 -0
  92. package/dist/components/Card/index.d.ts +2 -0
  93. package/dist/components/Card/index.js +2 -0
  94. package/dist/components/Chart/BarChart.d.ts +24 -0
  95. package/dist/components/Chart/BarChart.js +327 -0
  96. package/dist/components/Chart/BarChart.js.map +1 -0
  97. package/dist/components/Chart/ChartFrame.d.ts +27 -0
  98. package/dist/components/Chart/ChartFrame.js +80 -0
  99. package/dist/components/Chart/ChartFrame.js.map +1 -0
  100. package/dist/components/Chart/ChartLegend.d.ts +28 -0
  101. package/dist/components/Chart/ChartLegend.js +53 -0
  102. package/dist/components/Chart/ChartLegend.js.map +1 -0
  103. package/dist/components/Chart/ChartTable.d.ts +11 -0
  104. package/dist/components/Chart/ChartTable.js +48 -0
  105. package/dist/components/Chart/ChartTable.js.map +1 -0
  106. package/dist/components/Chart/ChartTooltip.d.ts +33 -0
  107. package/dist/components/Chart/ChartTooltip.js +56 -0
  108. package/dist/components/Chart/ChartTooltip.js.map +1 -0
  109. package/dist/components/Chart/HeatGrid.d.ts +50 -0
  110. package/dist/components/Chart/HeatGrid.js +256 -0
  111. package/dist/components/Chart/HeatGrid.js.map +1 -0
  112. package/dist/components/Chart/LineChart.d.ts +23 -0
  113. package/dist/components/Chart/LineChart.js +248 -0
  114. package/dist/components/Chart/LineChart.js.map +1 -0
  115. package/dist/components/Chart/format.d.ts +24 -0
  116. package/dist/components/Chart/format.js +134 -0
  117. package/dist/components/Chart/format.js.map +1 -0
  118. package/dist/components/Chart/geometry.d.ts +11 -0
  119. package/dist/components/Chart/geometry.js +69 -0
  120. package/dist/components/Chart/geometry.js.map +1 -0
  121. package/dist/components/Chart/index.d.ts +9 -0
  122. package/dist/components/Chart/index.js +6 -0
  123. package/dist/components/Chart/interaction.d.ts +43 -0
  124. package/dist/components/Chart/interaction.js +106 -0
  125. package/dist/components/Chart/interaction.js.map +1 -0
  126. package/dist/components/Chart/labels.d.ts +3 -0
  127. package/dist/components/Chart/labels.js +23 -0
  128. package/dist/components/Chart/labels.js.map +1 -0
  129. package/dist/components/Chart/scale.d.ts +15 -0
  130. package/dist/components/Chart/scale.js +54 -0
  131. package/dist/components/Chart/scale.js.map +1 -0
  132. package/dist/components/Chart/series.d.ts +14 -0
  133. package/dist/components/Chart/series.js +72 -0
  134. package/dist/components/Chart/series.js.map +1 -0
  135. package/dist/components/Chart/summary.d.ts +8 -0
  136. package/dist/components/Chart/summary.js +56 -0
  137. package/dist/components/Chart/summary.js.map +1 -0
  138. package/dist/components/Chart/types.d.ts +50 -0
  139. package/dist/components/Chart/useElementWidth.d.ts +6 -0
  140. package/dist/components/Chart/useElementWidth.js +25 -0
  141. package/dist/components/Chart/useElementWidth.js.map +1 -0
  142. package/dist/components/Checkbox/Checkbox.d.ts +9 -0
  143. package/dist/components/Checkbox/Checkbox.js +36 -0
  144. package/dist/components/Checkbox/Checkbox.js.map +1 -0
  145. package/dist/components/Checkbox/index.d.ts +2 -0
  146. package/dist/components/Checkbox/index.js +2 -0
  147. package/dist/components/CodeBlock/CodeBlock.d.ts +22 -0
  148. package/dist/components/CodeBlock/CodeBlock.js +56 -0
  149. package/dist/components/CodeBlock/CodeBlock.js.map +1 -0
  150. package/dist/components/CodeBlock/index.d.ts +2 -0
  151. package/dist/components/CodeBlock/index.js +2 -0
  152. package/dist/components/Combobox/Combobox.d.ts +34 -0
  153. package/dist/components/Combobox/Combobox.js +106 -0
  154. package/dist/components/Combobox/Combobox.js.map +1 -0
  155. package/dist/components/Combobox/index.d.ts +2 -0
  156. package/dist/components/Combobox/index.js +2 -0
  157. package/dist/components/CommandPalette/CommandPalette.d.ts +74 -0
  158. package/dist/components/CommandPalette/CommandPalette.js +51 -0
  159. package/dist/components/CommandPalette/CommandPalette.js.map +1 -0
  160. package/dist/components/CommandPalette/CommandPaletteOverlay.d.ts +11 -0
  161. package/dist/components/CommandPalette/CommandPaletteOverlay.js +180 -0
  162. package/dist/components/CommandPalette/CommandPaletteOverlay.js.map +1 -0
  163. package/dist/components/CommandPalette/index.d.ts +2 -0
  164. package/dist/components/CommandPalette/index.js +2 -0
  165. package/dist/components/DatePicker/DatePicker.d.ts +25 -0
  166. package/dist/components/DatePicker/DatePicker.js +142 -0
  167. package/dist/components/DatePicker/DatePicker.js.map +1 -0
  168. package/dist/components/DatePicker/index.d.ts +2 -0
  169. package/dist/components/DatePicker/index.js +2 -0
  170. package/dist/components/Dialog/Dialog.d.ts +37 -0
  171. package/dist/components/Dialog/Dialog.js +33 -0
  172. package/dist/components/Dialog/Dialog.js.map +1 -0
  173. package/dist/components/Dialog/DialogOverlay.d.ts +3 -0
  174. package/dist/components/Dialog/DialogOverlay.js +72 -0
  175. package/dist/components/Dialog/DialogOverlay.js.map +1 -0
  176. package/dist/components/Dialog/index.d.ts +2 -0
  177. package/dist/components/Dialog/index.js +2 -0
  178. package/dist/components/Drawer/Drawer.d.ts +36 -0
  179. package/dist/components/Drawer/Drawer.js +33 -0
  180. package/dist/components/Drawer/Drawer.js.map +1 -0
  181. package/dist/components/Drawer/DrawerOverlay.d.ts +3 -0
  182. package/dist/components/Drawer/DrawerOverlay.js +71 -0
  183. package/dist/components/Drawer/DrawerOverlay.js.map +1 -0
  184. package/dist/components/Drawer/index.d.ts +2 -0
  185. package/dist/components/Drawer/index.js +2 -0
  186. package/dist/components/DropdownMenu/DropdownMenu.d.ts +49 -0
  187. package/dist/components/DropdownMenu/DropdownMenu.js +52 -0
  188. package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -0
  189. package/dist/components/DropdownMenu/DropdownMenuParts.d.ts +6 -0
  190. package/dist/components/DropdownMenu/DropdownMenuParts.js +76 -0
  191. package/dist/components/DropdownMenu/DropdownMenuParts.js.map +1 -0
  192. package/dist/components/DropdownMenu/index.d.ts +2 -0
  193. package/dist/components/DropdownMenu/index.js +2 -0
  194. package/dist/components/EmptyState/EmptyState.d.ts +19 -0
  195. package/dist/components/EmptyState/EmptyState.js +51 -0
  196. package/dist/components/EmptyState/EmptyState.js.map +1 -0
  197. package/dist/components/EmptyState/index.d.ts +2 -0
  198. package/dist/components/EmptyState/index.js +2 -0
  199. package/dist/components/FileDropZone/FileDropZone.d.ts +41 -0
  200. package/dist/components/FileDropZone/FileDropZone.js +94 -0
  201. package/dist/components/FileDropZone/FileDropZone.js.map +1 -0
  202. package/dist/components/FileDropZone/index.d.ts +2 -0
  203. package/dist/components/FileDropZone/index.js +2 -0
  204. package/dist/components/IconButton/IconButton.d.ts +17 -0
  205. package/dist/components/IconButton/IconButton.js +37 -0
  206. package/dist/components/IconButton/IconButton.js.map +1 -0
  207. package/dist/components/IconButton/index.d.ts +2 -0
  208. package/dist/components/IconButton/index.js +2 -0
  209. package/dist/components/Input/Input.d.ts +21 -0
  210. package/dist/components/Input/Input.js +43 -0
  211. package/dist/components/Input/Input.js.map +1 -0
  212. package/dist/components/Input/index.d.ts +2 -0
  213. package/dist/components/Input/index.js +2 -0
  214. package/dist/components/Kbd/Kbd.d.ts +16 -0
  215. package/dist/components/Kbd/Kbd.js +35 -0
  216. package/dist/components/Kbd/Kbd.js.map +1 -0
  217. package/dist/components/Kbd/index.d.ts +2 -0
  218. package/dist/components/Kbd/index.js +2 -0
  219. package/dist/components/PageHeader/PageHeader.d.ts +18 -0
  220. package/dist/components/PageHeader/PageHeader.js +45 -0
  221. package/dist/components/PageHeader/PageHeader.js.map +1 -0
  222. package/dist/components/PageHeader/index.d.ts +2 -0
  223. package/dist/components/PageHeader/index.js +2 -0
  224. package/dist/components/Pagination/Pagination.d.ts +32 -0
  225. package/dist/components/Pagination/Pagination.js +124 -0
  226. package/dist/components/Pagination/Pagination.js.map +1 -0
  227. package/dist/components/Pagination/index.d.ts +2 -0
  228. package/dist/components/Pagination/index.js +2 -0
  229. package/dist/components/Popover/Popover.d.ts +27 -0
  230. package/dist/components/Popover/Popover.js +33 -0
  231. package/dist/components/Popover/Popover.js.map +1 -0
  232. package/dist/components/Popover/PopoverOverlay.d.ts +3 -0
  233. package/dist/components/Popover/PopoverOverlay.js +39 -0
  234. package/dist/components/Popover/PopoverOverlay.js.map +1 -0
  235. package/dist/components/Popover/index.d.ts +2 -0
  236. package/dist/components/Popover/index.js +2 -0
  237. package/dist/components/ProgressBar/ProgressBar.d.ts +19 -0
  238. package/dist/components/ProgressBar/ProgressBar.js +52 -0
  239. package/dist/components/ProgressBar/ProgressBar.js.map +1 -0
  240. package/dist/components/ProgressBar/index.d.ts +2 -0
  241. package/dist/components/ProgressBar/index.js +2 -0
  242. package/dist/components/RadioGroup/RadioGroup.d.ts +14 -0
  243. package/dist/components/RadioGroup/RadioGroup.js +46 -0
  244. package/dist/components/RadioGroup/RadioGroup.js.map +1 -0
  245. package/dist/components/RadioGroup/index.d.ts +2 -0
  246. package/dist/components/RadioGroup/index.js +2 -0
  247. package/dist/components/SegmentedControl/SegmentedControl.d.ts +32 -0
  248. package/dist/components/SegmentedControl/SegmentedControl.js +55 -0
  249. package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -0
  250. package/dist/components/SegmentedControl/index.d.ts +2 -0
  251. package/dist/components/SegmentedControl/index.js +2 -0
  252. package/dist/components/Select/Select.d.ts +28 -0
  253. package/dist/components/Select/Select.js +64 -0
  254. package/dist/components/Select/Select.js.map +1 -0
  255. package/dist/components/Select/index.d.ts +2 -0
  256. package/dist/components/Select/index.js +2 -0
  257. package/dist/components/Skeleton/Skeleton.d.ts +13 -0
  258. package/dist/components/Skeleton/Skeleton.js +33 -0
  259. package/dist/components/Skeleton/Skeleton.js.map +1 -0
  260. package/dist/components/Skeleton/index.d.ts +2 -0
  261. package/dist/components/Skeleton/index.js +2 -0
  262. package/dist/components/Spinner/Spinner.d.ts +12 -0
  263. package/dist/components/Spinner/Spinner.js +29 -0
  264. package/dist/components/Spinner/Spinner.js.map +1 -0
  265. package/dist/components/Spinner/index.d.ts +2 -0
  266. package/dist/components/Spinner/index.js +2 -0
  267. package/dist/components/Stat/Stat.d.ts +49 -0
  268. package/dist/components/Stat/Stat.js +125 -0
  269. package/dist/components/Stat/Stat.js.map +1 -0
  270. package/dist/components/Stat/index.d.ts +2 -0
  271. package/dist/components/Stat/index.js +2 -0
  272. package/dist/components/Switch/Switch.d.ts +11 -0
  273. package/dist/components/Switch/Switch.js +39 -0
  274. package/dist/components/Switch/Switch.js.map +1 -0
  275. package/dist/components/Switch/index.d.ts +2 -0
  276. package/dist/components/Switch/index.js +2 -0
  277. package/dist/components/Table/Table.d.ts +41 -0
  278. package/dist/components/Table/Table.js +121 -0
  279. package/dist/components/Table/Table.js.map +1 -0
  280. package/dist/components/Table/index.d.ts +2 -0
  281. package/dist/components/Table/index.js +2 -0
  282. package/dist/components/Tabs/Tabs.d.ts +10 -0
  283. package/dist/components/Tabs/Tabs.js +58 -0
  284. package/dist/components/Tabs/Tabs.js.map +1 -0
  285. package/dist/components/Tabs/index.d.ts +2 -0
  286. package/dist/components/Tabs/index.js +2 -0
  287. package/dist/components/Tag/Tag.d.ts +16 -0
  288. package/dist/components/Tag/Tag.js +48 -0
  289. package/dist/components/Tag/Tag.js.map +1 -0
  290. package/dist/components/Tag/index.d.ts +2 -0
  291. package/dist/components/Tag/index.js +2 -0
  292. package/dist/components/Textarea/Textarea.d.ts +28 -0
  293. package/dist/components/Textarea/Textarea.js +30 -0
  294. package/dist/components/Textarea/Textarea.js.map +1 -0
  295. package/dist/components/Textarea/index.d.ts +2 -0
  296. package/dist/components/Textarea/index.js +2 -0
  297. package/dist/components/Toast/Toast.d.ts +52 -0
  298. package/dist/components/Toast/Toast.js +77 -0
  299. package/dist/components/Toast/Toast.js.map +1 -0
  300. package/dist/components/Toast/ToastItem.d.ts +6 -0
  301. package/dist/components/Toast/ToastItem.js +127 -0
  302. package/dist/components/Toast/ToastItem.js.map +1 -0
  303. package/dist/components/Toast/index.d.ts +2 -0
  304. package/dist/components/Toast/index.js +2 -0
  305. package/dist/components/Tooltip/Tooltip.d.ts +17 -0
  306. package/dist/components/Tooltip/Tooltip.js +38 -0
  307. package/dist/components/Tooltip/Tooltip.js.map +1 -0
  308. package/dist/components/Tooltip/TooltipOverlay.d.ts +5 -0
  309. package/dist/components/Tooltip/TooltipOverlay.js +27 -0
  310. package/dist/components/Tooltip/TooltipOverlay.js.map +1 -0
  311. package/dist/components/Tooltip/index.d.ts +2 -0
  312. package/dist/components/Tooltip/index.js +2 -0
  313. package/dist/fonts.css +21 -0
  314. package/dist/index.d.ts +38 -0
  315. package/dist/index.js +43 -0
  316. package/dist/internal/Field.d.ts +13 -0
  317. package/dist/internal/Field.js +29 -0
  318. package/dist/internal/Field.js.map +1 -0
  319. package/dist/internal/LazyDialogTrigger.d.ts +8 -0
  320. package/dist/internal/LazyDialogTrigger.js +15 -0
  321. package/dist/internal/LazyDialogTrigger.js.map +1 -0
  322. package/dist/internal/PreloadOnIntent.d.ts +15 -0
  323. package/dist/internal/PreloadOnIntent.js +26 -0
  324. package/dist/internal/PreloadOnIntent.js.map +1 -0
  325. package/dist/internal/Spinner.d.ts +3 -0
  326. package/dist/internal/Spinner.js +14 -0
  327. package/dist/internal/Spinner.js.map +1 -0
  328. package/dist/internal/focusRing.d.ts +2 -0
  329. package/dist/internal/focusRing.js +7 -0
  330. package/dist/internal/focusRing.js.map +1 -0
  331. package/dist/internal/lazyModule.d.ts +15 -0
  332. package/dist/internal/lazyModule.js +54 -0
  333. package/dist/internal/lazyModule.js.map +1 -0
  334. package/dist/internal/surfaces.d.ts +8 -0
  335. package/dist/internal/surfaces.js +13 -0
  336. package/dist/internal/surfaces.js.map +1 -0
  337. package/dist/internal/types.d.ts +5 -0
  338. package/dist/internal/useLazyMenuTrigger.d.ts +23 -0
  339. package/dist/internal/useLazyMenuTrigger.js +47 -0
  340. package/dist/internal/useLazyMenuTrigger.js.map +1 -0
  341. package/dist/reset.css +52 -0
  342. package/dist/styles/themes/scales.d.ts +2 -0
  343. package/dist/styles/themes/scales.js +132 -0
  344. package/dist/styles/themes/scales.js.map +1 -0
  345. package/dist/styles/themes/variants.d.ts +41 -0
  346. package/dist/styles/themes/variants.js +180 -0
  347. package/dist/styles/themes/variants.js.map +1 -0
  348. package/dist/styles.css +2 -0
  349. package/dist/theme.css +557 -0
  350. package/dist/themes/all.css +158 -0
  351. package/dist/themes/assistant.css +25 -0
  352. package/dist/themes/control-room.css +25 -0
  353. package/dist/themes/plain-language.css +25 -0
  354. package/dist/themes/portfolio.css +25 -0
  355. package/dist/themes/review.css +25 -0
  356. package/dist/themes/sudoku.css +25 -0
  357. package/dist/themes/tokens.css +25 -0
  358. package/dist/themes/watchlist.css +25 -0
  359. package/dist/themes/workspace.css +25 -0
  360. package/dist/tokens.css +351 -0
  361. package/dist/utils/cx.d.ts +23 -0
  362. package/dist/utils/cx.js +25 -0
  363. package/dist/utils/cx.js.map +1 -0
  364. package/dist/utils/cxLite.d.ts +12 -0
  365. package/dist/utils/cxLite.js +23 -0
  366. package/dist/utils/cxLite.js.map +1 -0
  367. package/package.json +304 -4
@@ -0,0 +1,41 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type CellProps as AriaCellProps, type ColumnProps as AriaColumnProps, type RowProps as AriaRowProps, type TableBodyProps as AriaTableBodyProps, type TableHeaderProps as AriaTableHeaderProps, type TableProps as AriaTableProps } from 'react-aria-components';
3
+ export type CellAlign = 'start' | 'end';
4
+ export interface TableProps extends AriaTableProps {
5
+ /**
6
+ * Height limit of the scroll container, for example "24rem". The header
7
+ * stays visible while the body scrolls.
8
+ */
9
+ maxHeight?: string;
10
+ /** Class for the scroll container around the table. */
11
+ containerClassName?: string;
12
+ }
13
+ /**
14
+ * A data table on React Aria's Table: arrow keys move between cells, Space
15
+ * toggles selection, and pressing a sortable column header sorts it. The
16
+ * header is sticky inside the scroll container. No virtualisation, so keep it
17
+ * to a few hundred rows.
18
+ */
19
+ export declare function Table({ maxHeight, containerClassName, className, ...props }: TableProps): import("react").JSX.Element;
20
+ export interface TableHeaderProps<T extends object> extends AriaTableHeaderProps<T> {
21
+ /** Accessible name of the selection column in single selection mode. */
22
+ selectionLabel?: string;
23
+ }
24
+ /** Adds a selection column with a select all checkbox when the table is selectable. */
25
+ export declare function TableHeader<T extends object>({ columns, children, selectionLabel, ...props }: TableHeaderProps<T>): import("react").JSX.Element;
26
+ export interface ColumnProps extends Omit<AriaColumnProps, 'children'> {
27
+ children: ReactNode;
28
+ /** Right aligns the header, for numeric columns. Pair with `align="end"` on cells. */
29
+ align?: CellAlign;
30
+ }
31
+ export declare function Column({ children, align: alignment, className, ...props }: ColumnProps): import("react").JSX.Element;
32
+ export interface TableBodyProps<T extends object> extends AriaTableBodyProps<T> {
33
+ /** Text or element shown when there are no rows. */
34
+ emptyState?: ReactNode;
35
+ }
36
+ export declare function TableBody<T extends object>({ emptyState: empty, ...props }: TableBodyProps<T>): import("react").JSX.Element;
37
+ export declare function Row<T extends object>({ id, columns, children, className, ...props }: AriaRowProps<T>): import("react").JSX.Element;
38
+ export interface CellProps extends AriaCellProps {
39
+ align?: CellAlign;
40
+ }
41
+ export declare function Cell({ align: alignment, className, ...props }: CellProps): import("react").JSX.Element;
@@ -0,0 +1,121 @@
1
+ "use client";
2
+ import { focusRing } from "../../internal/focusRing.js";
3
+ import { cx } from "../../utils/cx.js";
4
+ import { Checkbox as Checkbox$1 } from "../Checkbox/Checkbox.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { ArrowDown, ArrowUp, ChevronsUpDown } from "lucide-react";
7
+ import { Cell, Collection, Column, Row, Table, TableBody, TableHeader, composeRenderProps, useTableOptions } from "react-aria-components";
8
+ // src/components/Table/Table.tsx
9
+ var container = "w-full overflow-auto rounded-lg border border-subtle bg-primary";
10
+ var table = "w-full border-separate border-spacing-0 text-sm text-primary outline-none";
11
+ var headerCell = "sticky top-0 z-10 border-b border-subtle bg-secondary px-cell-x py-cell-y text-left text-xs font-semibold whitespace-nowrap text-tertiary";
12
+ var sortableHeader = "cursor-pointer data-hovered:text-secondary";
13
+ var bodyCell = "border-b border-subtle px-cell-x py-cell-y font-data text-secondary";
14
+ var rowBase = "cursor-default outline-none data-hovered:bg-hover data-selected:bg-brand-subtle data-focus-visible:outline-2 data-focus-visible:outline-solid data-focus-visible:-outline-offset-2 data-focus-visible:outline-focus";
15
+ var selectionCell = "w-10 px-cell-x";
16
+ var emptyState = "px-cell-x py-10 text-center text-sm text-tertiary";
17
+ var headerKey = { id: "ui-table-header" };
18
+ var bodyKey = { id: "ui-table-body" };
19
+ var align = {
20
+ start: "text-left",
21
+ end: "text-right tabular-nums"
22
+ };
23
+ /**
24
+ * A data table on React Aria's Table: arrow keys move between cells, Space
25
+ * toggles selection, and pressing a sortable column header sorts it. The
26
+ * header is sticky inside the scroll container. No virtualisation, so keep it
27
+ * to a few hundred rows.
28
+ */
29
+ function Table$1({ maxHeight, containerClassName, className, ...props }) {
30
+ return /* @__PURE__ */ jsx("div", {
31
+ className: cx(container, containerClassName),
32
+ style: { maxHeight },
33
+ children: /* @__PURE__ */ jsx(Table, {
34
+ ...props,
35
+ className: composeRenderProps(className, (consumer) => cx(table, consumer))
36
+ })
37
+ });
38
+ }
39
+ /** Adds a selection column with a select all checkbox when the table is selectable. */
40
+ function TableHeader$1({ columns, children, selectionLabel = "Selection", ...props }) {
41
+ const { selectionBehavior, selectionMode } = useTableOptions();
42
+ const hasSelectionColumn = selectionBehavior === "toggle" && selectionMode !== "none";
43
+ return /* @__PURE__ */ jsxs(TableHeader, {
44
+ ...props,
45
+ ...headerKey,
46
+ columns,
47
+ children: [hasSelectionColumn && /* @__PURE__ */ jsx(Column, {
48
+ className: cx(headerCell, selectionCell),
49
+ children: selectionMode === "multiple" ? /* @__PURE__ */ jsx(Checkbox$1, { slot: "selection" }) : /* @__PURE__ */ jsx("span", {
50
+ className: "sr-only",
51
+ children: selectionLabel
52
+ })
53
+ }), /* @__PURE__ */ jsx(Collection, {
54
+ items: columns,
55
+ children
56
+ })]
57
+ });
58
+ }
59
+ function Column$1({ children, align: alignment = "start", className, ...props }) {
60
+ return /* @__PURE__ */ jsx(Column, {
61
+ ...props,
62
+ className: composeRenderProps(className, (consumer, { allowsSorting }) => cx(headerCell, align[alignment], allowsSorting && sortableHeader, focusRing, consumer)),
63
+ children: ({ allowsSorting, sortDirection }) => /* @__PURE__ */ jsxs("span", {
64
+ className: cx("inline-flex items-center gap-1", alignment === "end" && "flex-row-reverse"),
65
+ children: [children, allowsSorting && /* @__PURE__ */ jsx(SortIcon, { direction: sortDirection })]
66
+ })
67
+ });
68
+ }
69
+ function SortIcon({ direction }) {
70
+ if (direction === "ascending") return /* @__PURE__ */ jsx(ArrowUp, {
71
+ "aria-hidden": "true",
72
+ className: "size-3.5"
73
+ });
74
+ if (direction === "descending") return /* @__PURE__ */ jsx(ArrowDown, {
75
+ "aria-hidden": "true",
76
+ className: "size-3.5"
77
+ });
78
+ return /* @__PURE__ */ jsx(ChevronsUpDown, {
79
+ "aria-hidden": "true",
80
+ className: "size-3.5 text-fg-disabled"
81
+ });
82
+ }
83
+ function TableBody$1({ emptyState: empty, ...props }) {
84
+ function renderEmptyState() {
85
+ return /* @__PURE__ */ jsx("div", {
86
+ className: emptyState,
87
+ children: empty
88
+ });
89
+ }
90
+ return /* @__PURE__ */ jsx(TableBody, {
91
+ ...props,
92
+ ...bodyKey,
93
+ renderEmptyState: empty ? renderEmptyState : void 0
94
+ });
95
+ }
96
+ function Row$1({ id, columns, children, className, ...props }) {
97
+ const { selectionBehavior, selectionMode } = useTableOptions();
98
+ const hasSelectionCell = selectionBehavior === "toggle" && selectionMode !== "none";
99
+ return /* @__PURE__ */ jsxs(Row, {
100
+ ...props,
101
+ id,
102
+ columns,
103
+ className: composeRenderProps(className, (consumer) => cx(rowBase, consumer)),
104
+ children: [hasSelectionCell && /* @__PURE__ */ jsx(Cell, {
105
+ className: cx(bodyCell, selectionCell),
106
+ children: /* @__PURE__ */ jsx(Checkbox$1, { slot: "selection" })
107
+ }), /* @__PURE__ */ jsx(Collection, {
108
+ items: columns,
109
+ children
110
+ })]
111
+ });
112
+ }
113
+ function Cell$1({ align: alignment = "start", className, ...props }) {
114
+ return /* @__PURE__ */ jsx(Cell, {
115
+ ...props,
116
+ className: composeRenderProps(className, (consumer) => cx(bodyCell, align[alignment], consumer))
117
+ });
118
+ }
119
+ export { Cell$1 as Cell, Column$1 as Column, Row$1 as Row, Table$1 as Table, TableBody$1 as TableBody, TableHeader$1 as TableHeader };
120
+
121
+ //# sourceMappingURL=Table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Table.js","names":["Table","AriaTable","TableHeader","AriaTableHeader","AriaColumn","Checkbox","Column","TableBody","AriaTableBody","Row","AriaRow","AriaCell","Cell"],"sources":["../../../src/components/Table/Table.tsx"],"sourcesContent":["import { ArrowDown, ArrowUp, ChevronsUpDown } from 'lucide-react';\nimport type { ReactNode } from 'react';\nimport {\n Cell as AriaCell,\n Collection,\n Column as AriaColumn,\n Row as AriaRow,\n Table as AriaTable,\n TableBody as AriaTableBody,\n TableHeader as AriaTableHeader,\n composeRenderProps,\n useTableOptions,\n type CellProps as AriaCellProps,\n type ColumnProps as AriaColumnProps,\n type RowProps as AriaRowProps,\n type TableBodyProps as AriaTableBodyProps,\n type TableHeaderProps as AriaTableHeaderProps,\n type TableProps as AriaTableProps,\n} from 'react-aria-components';\nimport { focusRing } from '../../internal/focusRing';\nimport { cx } from '../../utils/cx';\nimport { Checkbox } from '../Checkbox/Checkbox';\n\nexport type CellAlign = 'start' | 'end';\n\nexport interface TableProps extends AriaTableProps {\n /**\n * Height limit of the scroll container, for example \"24rem\". The header\n * stays visible while the body scrolls.\n */\n maxHeight?: string;\n /** Class for the scroll container around the table. */\n containerClassName?: string;\n}\n\nconst container = 'w-full overflow-auto rounded-lg border border-subtle bg-primary';\nconst table = 'w-full border-separate border-spacing-0 text-sm text-primary outline-none';\nconst headerCell =\n 'sticky top-0 z-10 border-b border-subtle bg-secondary px-cell-x py-cell-y text-left text-xs font-semibold whitespace-nowrap text-tertiary';\nconst sortableHeader = 'cursor-pointer data-hovered:text-secondary';\nconst bodyCell = 'border-b border-subtle px-cell-x py-cell-y font-data text-secondary';\nconst rowBase =\n 'cursor-default outline-none data-hovered:bg-hover data-selected:bg-brand-subtle data-focus-visible:outline-2 data-focus-visible:outline-solid data-focus-visible:-outline-offset-2 data-focus-visible:outline-focus';\nconst selectionCell = 'w-10 px-cell-x';\nconst emptyState = 'px-cell-x py-10 text-center text-sm text-tertiary';\n\nconst headerKey = { id: 'ui-table-header' };\nconst bodyKey = { id: 'ui-table-body' };\n\nconst align: Record<CellAlign, string> = {\n start: 'text-left',\n end: 'text-right tabular-nums',\n};\n\n/**\n * A data table on React Aria's Table: arrow keys move between cells, Space\n * toggles selection, and pressing a sortable column header sorts it. The\n * header is sticky inside the scroll container. No virtualisation, so keep it\n * to a few hundred rows.\n */\nexport function Table({ maxHeight, containerClassName, className, ...props }: TableProps) {\n return (\n <div className={cx(container, containerClassName)} style={{ maxHeight }}>\n <AriaTable\n {...props}\n className={composeRenderProps(className, (consumer) => cx(table, consumer))}\n />\n </div>\n );\n}\n\nexport interface TableHeaderProps<T extends object> extends AriaTableHeaderProps<T> {\n /** Accessible name of the selection column in single selection mode. */\n selectionLabel?: string;\n}\n\n/** Adds a selection column with a select all checkbox when the table is selectable. */\nexport function TableHeader<T extends object>({\n columns,\n children,\n selectionLabel = 'Selection',\n ...props\n}: TableHeaderProps<T>) {\n const { selectionBehavior, selectionMode } = useTableOptions();\n const hasSelectionColumn = selectionBehavior === 'toggle' && selectionMode !== 'none';\n\n return (\n <AriaTableHeader {...props} {...headerKey} columns={columns}>\n {hasSelectionColumn && (\n <AriaColumn className={cx(headerCell, selectionCell)}>\n {selectionMode === 'multiple' ? (\n <Checkbox slot='selection' />\n ) : (\n <span className='sr-only'>{selectionLabel}</span>\n )}\n </AriaColumn>\n )}\n <Collection items={columns}>{children}</Collection>\n </AriaTableHeader>\n );\n}\n\nexport interface ColumnProps extends Omit<AriaColumnProps, 'children'> {\n children: ReactNode;\n /** Right aligns the header, for numeric columns. Pair with `align=\"end\"` on cells. */\n align?: CellAlign;\n}\n\nexport function Column({ children, align: alignment = 'start', className, ...props }: ColumnProps) {\n return (\n <AriaColumn\n {...props}\n className={composeRenderProps(className, (consumer, { allowsSorting }) =>\n cx(headerCell, align[alignment], allowsSorting && sortableHeader, focusRing, consumer),\n )}\n >\n {({ allowsSorting, sortDirection }) => (\n <span\n className={cx(\n 'inline-flex items-center gap-1',\n alignment === 'end' && 'flex-row-reverse',\n )}\n >\n {children}\n {allowsSorting && <SortIcon direction={sortDirection} />}\n </span>\n )}\n </AriaColumn>\n );\n}\n\nfunction SortIcon({ direction }: { direction: 'ascending' | 'descending' | undefined }) {\n if (direction === 'ascending') return <ArrowUp aria-hidden='true' className='size-3.5' />;\n if (direction === 'descending') return <ArrowDown aria-hidden='true' className='size-3.5' />;\n return <ChevronsUpDown aria-hidden='true' className='size-3.5 text-fg-disabled' />;\n}\n\nexport interface TableBodyProps<T extends object> extends AriaTableBodyProps<T> {\n /** Text or element shown when there are no rows. */\n emptyState?: ReactNode;\n}\n\nexport function TableBody<T extends object>({ emptyState: empty, ...props }: TableBodyProps<T>) {\n function renderEmptyState() {\n return <div className={emptyState}>{empty}</div>;\n }\n\n return (\n <AriaTableBody\n {...props}\n {...bodyKey}\n renderEmptyState={empty ? renderEmptyState : undefined}\n />\n );\n}\n\nexport function Row<T extends object>({\n id,\n columns,\n children,\n className,\n ...props\n}: AriaRowProps<T>) {\n const { selectionBehavior, selectionMode } = useTableOptions();\n const hasSelectionCell = selectionBehavior === 'toggle' && selectionMode !== 'none';\n\n return (\n <AriaRow\n {...props}\n id={id}\n columns={columns}\n className={composeRenderProps(className, (consumer) => cx(rowBase, consumer))}\n >\n {hasSelectionCell && (\n <AriaCell className={cx(bodyCell, selectionCell)}>\n <Checkbox slot='selection' />\n </AriaCell>\n )}\n <Collection items={columns}>{children}</Collection>\n </AriaRow>\n );\n}\n\nexport interface CellProps extends AriaCellProps {\n align?: CellAlign;\n}\n\nexport function Cell({ align: alignment = 'start', className, ...props }: CellProps) {\n return (\n <AriaCell\n {...props}\n className={composeRenderProps(className, (consumer) =>\n cx(bodyCell, align[alignment], consumer),\n )}\n />\n );\n}\n"],"mappings":";;;;;;;;AAmCA,IAAM,YAAY;AAClB,IAAM,QAAQ;AACd,IAAM,aACJ;AACF,IAAM,iBAAiB;AACvB,IAAM,WAAW;AACjB,IAAM,UACJ;AACF,IAAM,gBAAgB;AACtB,IAAM,aAAa;AAEnB,IAAM,YAAY,EAAE,IAAI,kBAAkB;AAC1C,IAAM,UAAU,EAAE,IAAI,gBAAgB;AAEtC,IAAM,QAAmC;CACvC,OAAO;CACP,KAAK;AACP;;;;;;;AAQA,SAAgBA,QAAM,EAAE,WAAW,oBAAoB,WAAW,GAAG,SAAqB;CACxF,OACE,oBAAC,OAAD;EAAK,WAAW,GAAG,WAAW,kBAAkB;EAAG,OAAO,EAAE,UAAU;EACpE,UAAA,oBAACC,OAAD;GACE,GAAI;GACJ,WAAW,mBAAmB,YAAY,aAAa,GAAG,OAAO,QAAQ,CAAC;EAC3E,CAAA;CACE,CAAA;AAET;;AAQA,SAAgBC,cAA8B,EAC5C,SACA,UACA,iBAAiB,aACjB,GAAG,SACmB;CACtB,MAAM,EAAE,mBAAmB,kBAAkB,gBAAgB;CAC7D,MAAM,qBAAqB,sBAAsB,YAAY,kBAAkB;CAE/E,OACE,qBAACC,aAAD;EAAiB,GAAI;EAAO,GAAI;EAAoB;EAApD,UAAA,CACG,sBACC,oBAACC,QAAD;GAAY,WAAW,GAAG,YAAY,aAAa;GAChD,UAAA,kBAAkB,aACjB,oBAACC,YAAD,EAAU,MAAK,YAAa,CAAA,IAE5B,oBAAC,QAAD;IAAM,WAAU;IAAW,UAAA;GAAqB,CAAA;EAExC,CAAA,GAEd,oBAAC,YAAD;GAAY,OAAO;GAAU;EAAqB,CAAA,CACnC;;AAErB;AAQA,SAAgBC,SAAO,EAAE,UAAU,OAAO,YAAY,SAAS,WAAW,GAAG,SAAsB;CACjG,OACE,oBAACF,QAAD;EACE,GAAI;EACJ,WAAW,mBAAmB,YAAY,UAAU,EAAE,oBACpD,GAAG,YAAY,MAAM,YAAY,iBAAiB,gBAAgB,WAAW,QAAQ,CACvF;EAEE,WAAA,EAAE,eAAe,oBACjB,qBAAC,QAAD;GACE,WAAW,GACT,kCACA,cAAc,SAAS,kBACzB;GAJF,UAAA,CAMG,UACA,iBAAiB,oBAAC,UAAD,EAAU,WAAW,cAAgB,CAAA,CACnD;;CAEE,CAAA;AAEhB;AAEA,SAAS,SAAS,EAAE,aAAoE;CACtF,IAAI,cAAc,aAAa,OAAO,oBAAC,SAAD;EAAS,eAAY;EAAO,WAAU;CAAY,CAAA;CACxF,IAAI,cAAc,cAAc,OAAO,oBAAC,WAAD;EAAW,eAAY;EAAO,WAAU;CAAY,CAAA;CAC3F,OAAO,oBAAC,gBAAD;EAAgB,eAAY;EAAO,WAAU;CAA6B,CAAA;AACnF;AAOA,SAAgBG,YAA4B,EAAE,YAAY,OAAO,GAAG,SAA4B;CAC9F,SAAS,mBAAmB;EAC1B,OAAO,oBAAC,OAAD;GAAK,WAAW;GAAa,UAAA;EAAW,CAAA;CACjD;CAEA,OACE,oBAACC,WAAD;EACE,GAAI;EACJ,GAAI;EACJ,kBAAkB,QAAQ,mBAAmB,KAAA;CAC9C,CAAA;AAEL;AAEA,SAAgBC,MAAsB,EACpC,IACA,SACA,UACA,WACA,GAAG,SACe;CAClB,MAAM,EAAE,mBAAmB,kBAAkB,gBAAgB;CAC7D,MAAM,mBAAmB,sBAAsB,YAAY,kBAAkB;CAE7E,OACE,qBAACC,KAAD;EACE,GAAI;EACA;EACK;EACT,WAAW,mBAAmB,YAAY,aAAa,GAAG,SAAS,QAAQ,CAAC;EAJ9E,UAAA,CAMG,oBACC,oBAACC,MAAD;GAAU,WAAW,GAAG,UAAU,aAAa;GAC7C,UAAA,oBAACN,YAAD,EAAU,MAAK,YAAa,CAAA;EACpB,CAAA,GAEZ,oBAAC,YAAD;GAAY,OAAO;GAAU;EAAqB,CAAA,CAC3C;;AAEb;AAMA,SAAgBO,OAAK,EAAE,OAAO,YAAY,SAAS,WAAW,GAAG,SAAoB;CACnF,OACE,oBAACD,MAAD;EACE,GAAI;EACJ,WAAW,mBAAmB,YAAY,aACxC,GAAG,UAAU,MAAM,YAAY,QAAQ,CACzC;CACD,CAAA;AAEL"}
@@ -0,0 +1,2 @@
1
+ export { Cell, Column, Row, Table, TableBody, TableHeader } from './Table';
2
+ export type { CellAlign, CellProps, ColumnProps, TableBodyProps, TableHeaderProps, TableProps, } from './Table';
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export { Cell, Column, Row, Table, TableBody, TableHeader } from "./Table.js";
@@ -0,0 +1,10 @@
1
+ import { type TabListProps as AriaTabListProps, type TabPanelProps as AriaTabPanelProps, type TabProps as AriaTabProps, type TabsProps as AriaTabsProps } from 'react-aria-components';
2
+ export type TabsProps = AriaTabsProps;
3
+ /** Arrow keys move between tabs, Home and End jump to the first and last. */
4
+ export declare function Tabs({ className, ...props }: TabsProps): import("react").JSX.Element;
5
+ export type TabListProps<T extends object> = AriaTabListProps<T>;
6
+ export declare function TabList<T extends object>({ className, ...props }: TabListProps<T>): import("react").JSX.Element;
7
+ export type TabProps = AriaTabProps;
8
+ export declare function Tab({ className, ...props }: TabProps): import("react").JSX.Element;
9
+ export type TabPanelProps = AriaTabPanelProps;
10
+ export declare function TabPanel({ className, ...props }: TabPanelProps): import("react").JSX.Element;
@@ -0,0 +1,58 @@
1
+ "use client";
2
+ import { focusRing } from "../../internal/focusRing.js";
3
+ import { cx } from "../../utils/cx.js";
4
+ import { useEffect, useRef } from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { Tab, TabList, TabPanel, Tabs, composeRenderProps } from "react-aria-components";
7
+ // src/components/Tabs/Tabs.tsx
8
+ /** Arrow keys move between tabs, Home and End jump to the first and last. */
9
+ function Tabs$1({ className, ...props }) {
10
+ return /* @__PURE__ */ jsx(Tabs, {
11
+ ...props,
12
+ className: composeRenderProps(className, (consumer, { orientation }) => cx("flex gap-4", orientation === "vertical" ? "flex-row" : "flex-col", consumer))
13
+ });
14
+ }
15
+ function scrollSelectedIntoView(list) {
16
+ const tab = list.querySelector("[aria-selected=\"true\"]");
17
+ if (!tab) return;
18
+ const listBox = list.getBoundingClientRect();
19
+ const tabBox = tab.getBoundingClientRect();
20
+ if (tabBox.left < listBox.left) list.scrollLeft -= listBox.left - tabBox.left;
21
+ else if (tabBox.right > listBox.right) list.scrollLeft += tabBox.right - listBox.right;
22
+ }
23
+ function TabList$1({ className, ...props }) {
24
+ const ref = useRef(null);
25
+ useEffect(() => {
26
+ const list = ref.current;
27
+ if (!list) return;
28
+ const observer = new MutationObserver(() => scrollSelectedIntoView(list));
29
+ observer.observe(list, {
30
+ subtree: true,
31
+ childList: true,
32
+ attributes: true,
33
+ attributeFilter: ["aria-selected"]
34
+ });
35
+ scrollSelectedIntoView(list);
36
+ return () => observer.disconnect();
37
+ }, []);
38
+ return /* @__PURE__ */ jsx(TabList, {
39
+ ...props,
40
+ ref,
41
+ className: composeRenderProps(className, (consumer, { orientation }) => cx("flex gap-1", orientation === "vertical" ? "flex-col border-r border-subtle pr-2" : "[scrollbar-width:none] overflow-x-auto border-b border-subtle [&::-webkit-scrollbar]:hidden", consumer))
42
+ });
43
+ }
44
+ function Tab$1({ className, ...props }) {
45
+ return /* @__PURE__ */ jsx(Tab, {
46
+ ...props,
47
+ className: composeRenderProps(className, (consumer) => cx("relative -mb-px shrink-0 cursor-pointer rounded-t-sm border-b-2 border-transparent px-3 py-item-y text-sm font-semibold whitespace-nowrap text-tertiary transition-colors", "data-hovered:text-secondary", "data-selected:border-brand data-selected:text-brand", "data-disabled:cursor-not-allowed data-disabled:text-disabled", focusRing, consumer))
48
+ });
49
+ }
50
+ function TabPanel$1({ className, ...props }) {
51
+ return /* @__PURE__ */ jsx(TabPanel, {
52
+ ...props,
53
+ className: composeRenderProps(className, (consumer) => cx("rounded-md text-sm text-secondary", focusRing, consumer))
54
+ });
55
+ }
56
+ export { Tab$1 as Tab, TabList$1 as TabList, TabPanel$1 as TabPanel, Tabs$1 as Tabs };
57
+
58
+ //# sourceMappingURL=Tabs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tabs.js","names":["Tabs","AriaTabs","TabList","AriaTabList","Tab","AriaTab","TabPanel","AriaTabPanel"],"sources":["../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport {\n Tab as AriaTab,\n TabList as AriaTabList,\n TabPanel as AriaTabPanel,\n Tabs as AriaTabs,\n composeRenderProps,\n type TabListProps as AriaTabListProps,\n type TabPanelProps as AriaTabPanelProps,\n type TabProps as AriaTabProps,\n type TabsProps as AriaTabsProps,\n} from 'react-aria-components';\nimport { focusRing } from '../../internal/focusRing';\nimport { cx } from '../../utils/cx';\n\nexport type TabsProps = AriaTabsProps;\n\n/** Arrow keys move between tabs, Home and End jump to the first and last. */\nexport function Tabs({ className, ...props }: TabsProps) {\n return (\n <AriaTabs\n {...props}\n className={composeRenderProps(className, (consumer, { orientation }) =>\n cx('flex gap-4', orientation === 'vertical' ? 'flex-row' : 'flex-col', consumer),\n )}\n />\n );\n}\n\nexport type TabListProps<T extends object> = AriaTabListProps<T>;\n\n// Brings the selected tab into view when the list scrolls sideways.\nfunction scrollSelectedIntoView(list: HTMLElement) {\n const tab = list.querySelector('[aria-selected=\"true\"]');\n if (!tab) return;\n const listBox = list.getBoundingClientRect();\n const tabBox = tab.getBoundingClientRect();\n if (tabBox.left < listBox.left) list.scrollLeft -= listBox.left - tabBox.left;\n else if (tabBox.right > listBox.right) list.scrollLeft += tabBox.right - listBox.right;\n}\n\nexport function TabList<T extends object>({ className, ...props }: TabListProps<T>) {\n const ref = useRef<HTMLDivElement>(null);\n // The tabs mount after the list, so watch for them and for selection changes.\n useEffect(() => {\n const list = ref.current;\n if (!list) return;\n const observer = new MutationObserver(() => scrollSelectedIntoView(list));\n observer.observe(list, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['aria-selected'],\n });\n scrollSelectedIntoView(list);\n return () => observer.disconnect();\n }, []);\n return (\n <AriaTabList\n {...props}\n ref={ref}\n className={composeRenderProps(className, (consumer, { orientation }) =>\n cx(\n 'flex gap-1',\n orientation === 'vertical'\n ? 'flex-col border-r border-subtle pr-2'\n : '[scrollbar-width:none] overflow-x-auto border-b border-subtle [&::-webkit-scrollbar]:hidden',\n consumer,\n ),\n )}\n />\n );\n}\n\nexport type TabProps = AriaTabProps;\n\nexport function Tab({ className, ...props }: TabProps) {\n return (\n <AriaTab\n {...props}\n className={composeRenderProps(className, (consumer) =>\n cx(\n 'relative -mb-px shrink-0 cursor-pointer rounded-t-sm border-b-2 border-transparent px-3 py-item-y text-sm font-semibold whitespace-nowrap text-tertiary transition-colors',\n 'data-hovered:text-secondary',\n 'data-selected:border-brand data-selected:text-brand',\n 'data-disabled:cursor-not-allowed data-disabled:text-disabled',\n focusRing,\n consumer,\n ),\n )}\n />\n );\n}\n\nexport type TabPanelProps = AriaTabPanelProps;\n\nexport function TabPanel({ className, ...props }: TabPanelProps) {\n return (\n <AriaTabPanel\n {...props}\n className={composeRenderProps(className, (consumer) =>\n cx('rounded-md text-sm text-secondary', focusRing, consumer),\n )}\n />\n );\n}\n"],"mappings":";;;;;;;;AAkBA,SAAgBA,OAAK,EAAE,WAAW,GAAG,SAAoB;CACvD,OACE,oBAACC,MAAD;EACE,GAAI;EACJ,WAAW,mBAAmB,YAAY,UAAU,EAAE,kBACpD,GAAG,cAAc,gBAAgB,aAAa,aAAa,YAAY,QAAQ,CACjF;CACD,CAAA;AAEL;AAKA,SAAS,uBAAuB,MAAmB;CACjD,MAAM,MAAM,KAAK,cAAc,0BAAwB;CACvD,IAAI,CAAC,KAAK;CACV,MAAM,UAAU,KAAK,sBAAsB;CAC3C,MAAM,SAAS,IAAI,sBAAsB;CACzC,IAAI,OAAO,OAAO,QAAQ,MAAM,KAAK,cAAc,QAAQ,OAAO,OAAO;MACpE,IAAI,OAAO,QAAQ,QAAQ,OAAO,KAAK,cAAc,OAAO,QAAQ,QAAQ;AACnF;AAEA,SAAgBC,UAA0B,EAAE,WAAW,GAAG,SAA0B;CAClF,MAAM,MAAM,OAAuB,IAAI;CAEvC,gBAAgB;EACd,MAAM,OAAO,IAAI;EACjB,IAAI,CAAC,MAAM;EACX,MAAM,WAAW,IAAI,uBAAuB,uBAAuB,IAAI,CAAC;EACxE,SAAS,QAAQ,MAAM;GACrB,SAAS;GACT,WAAW;GACX,YAAY;GACZ,iBAAiB,CAAC,eAAe;EACnC,CAAC;EACD,uBAAuB,IAAI;EAC3B,aAAa,SAAS,WAAW;CACnC,GAAG,CAAC,CAAC;CACL,OACE,oBAACC,SAAD;EACE,GAAI;EACC;EACL,WAAW,mBAAmB,YAAY,UAAU,EAAE,kBACpD,GACE,cACA,gBAAgB,aACZ,yCACA,+FACJ,QACF,CACF;CACD,CAAA;AAEL;AAIA,SAAgBC,MAAI,EAAE,WAAW,GAAG,SAAmB;CACrD,OACE,oBAACC,KAAD;EACE,GAAI;EACJ,WAAW,mBAAmB,YAAY,aACxC,GACE,6KACA,+BACA,uDACA,gEACA,WACA,QACF,CACF;CACD,CAAA;AAEL;AAIA,SAAgBC,WAAS,EAAE,WAAW,GAAG,SAAwB;CAC/D,OACE,oBAACC,UAAD;EACE,GAAI;EACJ,WAAW,mBAAmB,YAAY,aACxC,GAAG,qCAAqC,WAAW,QAAQ,CAC7D;CACD,CAAA;AAEL"}
@@ -0,0 +1,2 @@
1
+ export { Tabs, TabList, Tab, TabPanel } from './Tabs';
2
+ export type { TabsProps, TabListProps, TabProps, TabPanelProps } from './Tabs';
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export { Tab, TabList, TabPanel, Tabs } from "./Tabs.js";
@@ -0,0 +1,16 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type TagGroupProps as AriaTagGroupProps, type TagListProps, type TagProps as AriaTagProps } from 'react-aria-components';
3
+ export interface TagGroupProps<T extends object> extends Omit<AriaTagGroupProps, 'children'>, Pick<TagListProps<T>, 'items' | 'children' | 'renderEmptyState'> {
4
+ label?: ReactNode;
5
+ hint?: ReactNode;
6
+ errorMessage?: string;
7
+ }
8
+ /**
9
+ * A focusable group of tags. Pass `onRemove` to make every tag removable with
10
+ * its close button or the Delete and Backspace keys.
11
+ */
12
+ export declare function TagGroup<T extends object>({ label, hint, errorMessage, items, children, renderEmptyState, className, ...props }: TagGroupProps<T>): import("react").JSX.Element;
13
+ export interface TagProps extends Omit<AriaTagProps, 'children'> {
14
+ children: ReactNode;
15
+ }
16
+ export declare function Tag({ children, className, ...props }: TagProps): import("react").JSX.Element;
@@ -0,0 +1,48 @@
1
+ "use client";
2
+ import { FieldErrorMessage, FieldHint, FieldLabel } from "../../internal/Field.js";
3
+ import { focusRing } from "../../internal/focusRing.js";
4
+ import { cx } from "../../utils/cx.js";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ import { X } from "lucide-react";
7
+ import { Button, Tag, TagGroup, TagList, composeRenderProps } from "react-aria-components";
8
+ // src/components/Tag/Tag.tsx
9
+ /**
10
+ * A focusable group of tags. Pass `onRemove` to make every tag removable with
11
+ * its close button or the Delete and Backspace keys.
12
+ */
13
+ function TagGroup$1({ label, hint, errorMessage, items, children, renderEmptyState, className, ...props }) {
14
+ return /* @__PURE__ */ jsxs(TagGroup, {
15
+ ...props,
16
+ className: cx("flex flex-col gap-1.5", typeof className === "string" ? className : void 0),
17
+ children: [
18
+ label && /* @__PURE__ */ jsx(FieldLabel, { children: label }),
19
+ /* @__PURE__ */ jsx(TagList, {
20
+ items,
21
+ renderEmptyState,
22
+ className: "flex flex-wrap gap-1.5 outline-none",
23
+ children
24
+ }),
25
+ hint && /* @__PURE__ */ jsx(FieldHint, { children: hint }),
26
+ errorMessage && /* @__PURE__ */ jsx(FieldErrorMessage, { children: errorMessage })
27
+ ]
28
+ });
29
+ }
30
+ function Tag$1({ children, className, ...props }) {
31
+ const textValue = props.textValue ?? (typeof children === "string" ? children : void 0);
32
+ return /* @__PURE__ */ jsx(Tag, {
33
+ ...props,
34
+ textValue,
35
+ className: composeRenderProps(className, (consumer, { allowsRemoving, selectionMode }) => cx("relative inline-flex h-7 cursor-default items-center gap-1 rounded-sm border border-default bg-primary px-2 text-sm font-medium text-secondary", "data-selected:border-brand data-selected:bg-brand-subtle data-selected:text-brand", "data-disabled:text-disabled", (allowsRemoving || selectionMode !== "none" || props.href) && "touch-target", focusRing, consumer)),
36
+ children: ({ allowsRemoving }) => /* @__PURE__ */ jsxs(Fragment, { children: [children, allowsRemoving && /* @__PURE__ */ jsx(Button, {
37
+ slot: "remove",
38
+ className: cx("-mr-1 flex size-5 cursor-pointer items-center justify-center rounded-xs text-fg-tertiary", "data-hovered:bg-hover data-hovered:text-fg-secondary", "outline-none data-focus-visible:outline-2 data-focus-visible:outline-solid data-focus-visible:outline-offset-2 data-focus-visible:outline-focus"),
39
+ children: /* @__PURE__ */ jsx(X, {
40
+ "aria-hidden": "true",
41
+ className: "size-3.5"
42
+ })
43
+ })] })
44
+ });
45
+ }
46
+ export { Tag$1 as Tag, TagGroup$1 as TagGroup };
47
+
48
+ //# sourceMappingURL=Tag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tag.js","names":["TagGroup","AriaTagGroup","Tag","AriaTag","_Fragment","AriaButton"],"sources":["../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import { X } from 'lucide-react';\nimport type { ReactNode } from 'react';\nimport {\n Button as AriaButton,\n Tag as AriaTag,\n TagGroup as AriaTagGroup,\n TagList,\n composeRenderProps,\n type TagGroupProps as AriaTagGroupProps,\n type TagListProps,\n type TagProps as AriaTagProps,\n} from 'react-aria-components';\nimport { FieldErrorMessage, FieldHint, FieldLabel } from '../../internal/Field';\nimport { focusRing } from '../../internal/focusRing';\nimport { cx } from '../../utils/cx';\n\nexport interface TagGroupProps<T extends object>\n extends\n Omit<AriaTagGroupProps, 'children'>,\n Pick<TagListProps<T>, 'items' | 'children' | 'renderEmptyState'> {\n label?: ReactNode;\n hint?: ReactNode;\n errorMessage?: string;\n}\n\n/**\n * A focusable group of tags. Pass `onRemove` to make every tag removable with\n * its close button or the Delete and Backspace keys.\n */\nexport function TagGroup<T extends object>({\n label,\n hint,\n errorMessage,\n items,\n children,\n renderEmptyState,\n className,\n ...props\n}: TagGroupProps<T>) {\n return (\n <AriaTagGroup\n {...props}\n className={cx('flex flex-col gap-1.5', typeof className === 'string' ? className : undefined)}\n >\n {label && <FieldLabel>{label}</FieldLabel>}\n <TagList\n items={items}\n renderEmptyState={renderEmptyState}\n className='flex flex-wrap gap-1.5 outline-none'\n >\n {children}\n </TagList>\n {hint && <FieldHint>{hint}</FieldHint>}\n {errorMessage && <FieldErrorMessage>{errorMessage}</FieldErrorMessage>}\n </AriaTagGroup>\n );\n}\n\nexport interface TagProps extends Omit<AriaTagProps, 'children'> {\n children: ReactNode;\n}\n\nexport function Tag({ children, className, ...props }: TagProps) {\n const textValue = props.textValue ?? (typeof children === 'string' ? children : undefined);\n return (\n <AriaTag\n {...props}\n textValue={textValue}\n className={composeRenderProps(className, (consumer, { allowsRemoving, selectionMode }) =>\n cx(\n 'relative inline-flex h-7 cursor-default items-center gap-1 rounded-sm border border-default bg-primary px-2 text-sm font-medium text-secondary',\n 'data-selected:border-brand data-selected:bg-brand-subtle data-selected:text-brand',\n 'data-disabled:text-disabled',\n (allowsRemoving || selectionMode !== 'none' || props.href) && 'touch-target',\n focusRing,\n consumer,\n ),\n )}\n >\n {({ allowsRemoving }) => (\n <>\n {children}\n {allowsRemoving && (\n <AriaButton\n slot='remove'\n className={cx(\n '-mr-1 flex size-5 cursor-pointer items-center justify-center rounded-xs text-fg-tertiary',\n 'data-hovered:bg-hover data-hovered:text-fg-secondary',\n focusRing,\n )}\n >\n <X aria-hidden='true' className='size-3.5' />\n </AriaButton>\n )}\n </>\n )}\n </AriaTag>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA6BA,SAAgBA,WAA2B,EACzC,OACA,MACA,cACA,OACA,UACA,kBACA,WACA,GAAG,SACgB;CACnB,OACE,qBAACC,UAAD;EACE,GAAI;EACJ,WAAW,GAAG,yBAAyB,OAAO,cAAc,WAAW,YAAY,KAAA,CAAS;EAF9F,UAAA;GAIG,SAAS,oBAAC,YAAD,EAAA,UAAa,MAAkB,CAAA;GACzC,oBAAC,SAAD;IACS;IACW;IAClB,WAAU;IAET;GACM,CAAA;GACR,QAAQ,oBAAC,WAAD,EAAA,UAAY,KAAgB,CAAA;GACpC,gBAAgB,oBAAC,mBAAD,EAAA,UAAoB,aAAgC,CAAA;EACzD;;AAElB;AAMA,SAAgBC,MAAI,EAAE,UAAU,WAAW,GAAG,SAAmB;CAC/D,MAAM,YAAY,MAAM,cAAc,OAAO,aAAa,WAAW,WAAW,KAAA;CAChF,OACE,oBAACC,KAAD;EACE,GAAI;EACO;EACX,WAAW,mBAAmB,YAAY,UAAU,EAAE,gBAAgB,oBACpE,GACE,kJACA,qFACA,gCACC,kBAAkB,kBAAkB,UAAU,MAAM,SAAS,gBAC9D,WACA,QACF,CACF;EAEE,WAAA,EAAE,qBACF,qBAAAC,UAAA,EAAA,UAAA,CACG,UACA,kBACC,oBAACC,QAAD;GACE,MAAK;GACL,WAAW,GACT,4FACA,wDAAA,iJAEF;GAEA,UAAA,oBAAC,GAAD;IAAG,eAAY;IAAO,WAAU;GAAY,CAAA;EAClC,CAAA,CAEd,EAAA,CAAA;CAEG,CAAA;AAEb"}
@@ -0,0 +1,2 @@
1
+ export { Tag, TagGroup } from './Tag';
2
+ export type { TagProps, TagGroupProps } from './Tag';
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export { Tag, TagGroup } from "./Tag.js";
@@ -0,0 +1,28 @@
1
+ import type { ReactNode, Ref } from 'react';
2
+ import { type TextFieldProps } from 'react-aria-components';
3
+ export type TextareaFont = 'sans' | 'data';
4
+ export interface TextareaProps extends Omit<TextFieldProps, 'children' | 'autoCapitalize' | 'autoCorrect' | 'spellCheck'> {
5
+ label?: ReactNode;
6
+ hint?: ReactNode;
7
+ errorMessage?: string;
8
+ placeholder?: string;
9
+ /** Visible rows before scrolling. */
10
+ rows?: number;
11
+ /** Allow the user to resize vertically. */
12
+ resizable?: boolean;
13
+ textareaClassName?: string;
14
+ /**
15
+ * `data` uses the theme's data font (monospace in some variants), for code,
16
+ * logs and generated output. The default is the interface font.
17
+ */
18
+ font?: TextareaFont;
19
+ /** Turn off for identifiers, code and commands. */
20
+ autoCapitalize?: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters';
21
+ /** Turn off for code and technical text. */
22
+ autoCorrect?: 'on' | 'off';
23
+ /** Browser spell checking. Turn off for code. */
24
+ spellCheck?: boolean | 'true' | 'false';
25
+ /** Ref to the native textarea element. */
26
+ ref?: Ref<HTMLTextAreaElement>;
27
+ }
28
+ export declare function Textarea({ label, hint, errorMessage, placeholder, rows, resizable, textareaClassName, font, autoCapitalize, autoCorrect, spellCheck, ref, className, isInvalid, ...props }: TextareaProps): import("react").JSX.Element;
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import { FieldErrorMessage, FieldHint, FieldLabel, controlBase } from "../../internal/Field.js";
3
+ import { cx } from "../../utils/cx.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { TextArea, TextField, composeRenderProps } from "react-aria-components";
6
+ // src/components/Textarea/Textarea.tsx
7
+ function Textarea({ label, hint, errorMessage, placeholder, rows = 4, resizable = true, textareaClassName, font = "sans", autoCapitalize, autoCorrect, spellCheck, ref, className, isInvalid, ...props }) {
8
+ return /* @__PURE__ */ jsxs(TextField, {
9
+ ...props,
10
+ isInvalid: isInvalid ?? Boolean(errorMessage),
11
+ className: composeRenderProps(className, (consumer) => cx("flex flex-col gap-1.5", consumer)),
12
+ children: [
13
+ label && /* @__PURE__ */ jsx(FieldLabel, { children: label }),
14
+ /* @__PURE__ */ jsx(TextArea, {
15
+ ref,
16
+ rows,
17
+ autoCapitalize,
18
+ autoCorrect,
19
+ spellCheck,
20
+ placeholder,
21
+ className: composeRenderProps(textareaClassName, (consumer) => cx(controlBase, "px-3 py-2", font === "data" && "font-data", resizable ? "resize-y" : "resize-none", consumer))
22
+ }),
23
+ hint && !errorMessage && /* @__PURE__ */ jsx(FieldHint, { children: hint }),
24
+ /* @__PURE__ */ jsx(FieldErrorMessage, { children: errorMessage })
25
+ ]
26
+ });
27
+ }
28
+ export { Textarea };
29
+
30
+ //# sourceMappingURL=Textarea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Textarea.js","names":["AriaTextArea"],"sources":["../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport {\n TextArea as AriaTextArea,\n TextField,\n composeRenderProps,\n type TextFieldProps,\n} from 'react-aria-components';\nimport { FieldErrorMessage, FieldHint, FieldLabel, controlBase } from '../../internal/Field';\nimport { cx } from '../../utils/cx';\n\nexport type TextareaFont = 'sans' | 'data';\n\nexport interface TextareaProps extends Omit<\n TextFieldProps,\n 'children' | 'autoCapitalize' | 'autoCorrect' | 'spellCheck'\n> {\n label?: ReactNode;\n hint?: ReactNode;\n errorMessage?: string;\n placeholder?: string;\n /** Visible rows before scrolling. */\n rows?: number;\n /** Allow the user to resize vertically. */\n resizable?: boolean;\n textareaClassName?: string;\n /**\n * `data` uses the theme's data font (monospace in some variants), for code,\n * logs and generated output. The default is the interface font.\n */\n font?: TextareaFont;\n /** Turn off for identifiers, code and commands. */\n autoCapitalize?: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters';\n /** Turn off for code and technical text. */\n autoCorrect?: 'on' | 'off';\n /** Browser spell checking. Turn off for code. */\n spellCheck?: boolean | 'true' | 'false';\n /** Ref to the native textarea element. */\n ref?: Ref<HTMLTextAreaElement>;\n}\n\nexport function Textarea({\n label,\n hint,\n errorMessage,\n placeholder,\n rows = 4,\n resizable = true,\n textareaClassName,\n font = 'sans',\n autoCapitalize,\n autoCorrect,\n spellCheck,\n ref,\n className,\n isInvalid,\n ...props\n}: TextareaProps) {\n return (\n <TextField\n {...props}\n isInvalid={isInvalid ?? Boolean(errorMessage)}\n className={composeRenderProps(className, (consumer) => cx('flex flex-col gap-1.5', consumer))}\n >\n {label && <FieldLabel>{label}</FieldLabel>}\n <AriaTextArea\n ref={ref}\n rows={rows}\n autoCapitalize={autoCapitalize}\n autoCorrect={autoCorrect}\n spellCheck={spellCheck}\n placeholder={placeholder}\n className={composeRenderProps(textareaClassName, (consumer) =>\n cx(\n controlBase,\n 'px-3 py-2',\n font === 'data' && 'font-data',\n resizable ? 'resize-y' : 'resize-none',\n consumer,\n ),\n )}\n />\n {hint && !errorMessage && <FieldHint>{hint}</FieldHint>}\n <FieldErrorMessage>{errorMessage}</FieldErrorMessage>\n </TextField>\n );\n}\n"],"mappings":";;;;;;AAwCA,SAAgB,SAAS,EACvB,OACA,MACA,cACA,aACA,OAAO,GACP,YAAY,MACZ,mBACA,OAAO,QACP,gBACA,aACA,YACA,KACA,WACA,WACA,GAAG,SACa;CAChB,OACE,qBAAC,WAAD;EACE,GAAI;EACJ,WAAW,aAAa,QAAQ,YAAY;EAC5C,WAAW,mBAAmB,YAAY,aAAa,GAAG,yBAAyB,QAAQ,CAAC;EAH9F,UAAA;GAKG,SAAS,oBAAC,YAAD,EAAA,UAAa,MAAkB,CAAA;GACzC,oBAACA,UAAD;IACO;IACC;IACU;IACH;IACD;IACC;IACb,WAAW,mBAAmB,oBAAoB,aAChD,GACE,aACA,aACA,SAAS,UAAU,aACnB,YAAY,aAAa,eACzB,QACF,CACF;GACD,CAAA;GACA,QAAQ,CAAC,gBAAgB,oBAAC,WAAD,EAAA,UAAY,KAAgB,CAAA;GACtD,oBAAC,mBAAD,EAAA,UAAoB,aAAgC,CAAA;EAC3C;;AAEf"}
@@ -0,0 +1,2 @@
1
+ export { Textarea } from './Textarea';
2
+ export type { TextareaProps } from './Textarea';
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export { Textarea } from "./Textarea.js";
@@ -0,0 +1,52 @@
1
+ import { type ReactNode } from 'react';
2
+ export type ToastVariant = 'info' | 'success' | 'warning' | 'error';
3
+ export interface ToastAction {
4
+ /** Verb first, such as "Undo" or "Open issue". */
5
+ label: string;
6
+ /** Runs on press; the toast closes afterwards. */
7
+ onPress: () => void;
8
+ }
9
+ export interface ToastOptions {
10
+ title: ReactNode;
11
+ description?: ReactNode;
12
+ variant?: ToastVariant;
13
+ /** Milliseconds before the toast closes. Pass `null` to keep it until dismissed. */
14
+ duration?: number | null;
15
+ /** A button in the toast, such as Undo. Its label is its own accessible name. */
16
+ action?: ToastAction;
17
+ }
18
+ export interface ToastRecord extends Required<Pick<ToastOptions, 'title' | 'variant'>> {
19
+ id: string;
20
+ description?: ReactNode;
21
+ duration: number | null;
22
+ action?: ToastAction;
23
+ }
24
+ export interface ToastApi {
25
+ /** Shows a toast and returns its id. */
26
+ toast: (options: ToastOptions) => string;
27
+ /** Closes one toast by id, or all of them when called without an id. */
28
+ dismiss: (id?: string) => void;
29
+ }
30
+ export type ToastPlacement = 'top-right' | 'bottom-right' | 'bottom-center';
31
+ export interface ToastProviderProps {
32
+ children: ReactNode;
33
+ /** Default auto-close delay in milliseconds. */
34
+ duration?: number;
35
+ placement?: ToastPlacement;
36
+ /** Accessible name for the notifications region. */
37
+ label?: string;
38
+ /** Upper bound on visible toasts; the oldest are dropped first. */
39
+ maxVisible?: number;
40
+ }
41
+ /**
42
+ * Hosts the notification region and exposes `useToast`. The region is a
43
+ * polite live region that is always present in the DOM, so screen readers
44
+ * announce each toast as it is added. Timers pause while a toast is hovered
45
+ * or has focus, so nobody loses a message they are reading. A toast can carry
46
+ * an action button, closes on Escape while it has focus, and when it closes
47
+ * with focus inside, focus goes back to where it was before the user
48
+ * entered the toast.
49
+ */
50
+ export declare function ToastProvider({ children, duration, placement, label, maxVisible, }: ToastProviderProps): import("react").JSX.Element;
51
+ /** Returns `{ toast, dismiss }`. Must be called inside a ToastProvider. */
52
+ export declare function useToast(): ToastApi;
@@ -0,0 +1,77 @@
1
+ "use client";
2
+ import { createLazyModule } from "../../internal/lazyModule.js";
3
+ import { cx } from "../../utils/cx.js";
4
+ import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ // src/components/Toast/Toast.tsx
7
+ var ToastContext = createContext(null);
8
+ var placements = {
9
+ "top-right": "top-4 right-4 items-end",
10
+ "bottom-right": "bottom-4 right-4 items-end",
11
+ "bottom-center": "bottom-4 left-1/2 -translate-x-1/2 items-center"
12
+ };
13
+ var items = /*#__PURE__*/ createLazyModule(() => import("./ToastItem.js"));
14
+ var counter = 0;
15
+ var nextId = () => `ui-toast-${++counter}`;
16
+ /**
17
+ * Hosts the notification region and exposes `useToast`. The region is a
18
+ * polite live region that is always present in the DOM, so screen readers
19
+ * announce each toast as it is added. Timers pause while a toast is hovered
20
+ * or has focus, so nobody loses a message they are reading. A toast can carry
21
+ * an action button, closes on Escape while it has focus, and when it closes
22
+ * with focus inside, focus goes back to where it was before the user
23
+ * entered the toast.
24
+ */
25
+ function ToastProvider({ children, duration = 5e3, placement = "bottom-right", label = "Notifications", maxVisible = 5 }) {
26
+ const [toasts, setToasts] = useState([]);
27
+ const loaded = items.useModule(toasts.length > 0);
28
+ const dismiss = useCallback((id) => {
29
+ setToasts((current) => id ? current.filter((item) => item.id !== id) : []);
30
+ }, []);
31
+ const toast = useCallback(({ title, description, variant = "info", duration: own, action }) => {
32
+ const id = nextId();
33
+ const record = {
34
+ id,
35
+ title,
36
+ description,
37
+ variant,
38
+ duration: own === void 0 ? duration : own,
39
+ action
40
+ };
41
+ setToasts((current) => [...current, record].slice(-maxVisible));
42
+ return id;
43
+ }, [duration, maxVisible]);
44
+ useEffect(() => {
45
+ const handle = window.setTimeout(items.preload, 2e3);
46
+ return () => window.clearTimeout(handle);
47
+ }, []);
48
+ const api = useMemo(() => ({
49
+ toast,
50
+ dismiss
51
+ }), [toast, dismiss]);
52
+ return /* @__PURE__ */ jsxs(ToastContext.Provider, {
53
+ value: api,
54
+ children: [children, /* @__PURE__ */ jsx("section", {
55
+ "aria-label": label,
56
+ className: cx("pointer-events-none fixed z-50", placements[placement]),
57
+ children: /* @__PURE__ */ jsx("ol", {
58
+ "aria-live": "polite",
59
+ "aria-relevant": "additions text",
60
+ className: "flex w-[22rem] max-w-[calc(100vw-2rem)] flex-col gap-2",
61
+ children: loaded && toasts.map((item) => /* @__PURE__ */ jsx(loaded.ToastItem, {
62
+ toast: item,
63
+ onDismiss: dismiss
64
+ }, item.id))
65
+ })
66
+ })]
67
+ });
68
+ }
69
+ /** Returns `{ toast, dismiss }`. Must be called inside a ToastProvider. */
70
+ function useToast() {
71
+ const context = useContext(ToastContext);
72
+ if (!context) throw new Error("useToast must be used inside a <ToastProvider>.");
73
+ return context;
74
+ }
75
+ export { ToastProvider, useToast };
76
+
77
+ //# sourceMappingURL=Toast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toast.js","names":[],"sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n type ReactNode,\n} from 'react';\nimport { createLazyModule } from '../../internal/lazyModule';\nimport { cx } from '../../utils/cx';\n\nexport type ToastVariant = 'info' | 'success' | 'warning' | 'error';\n\nexport interface ToastAction {\n /** Verb first, such as \"Undo\" or \"Open issue\". */\n label: string;\n /** Runs on press; the toast closes afterwards. */\n onPress: () => void;\n}\n\nexport interface ToastOptions {\n title: ReactNode;\n description?: ReactNode;\n variant?: ToastVariant;\n /** Milliseconds before the toast closes. Pass `null` to keep it until dismissed. */\n duration?: number | null;\n /** A button in the toast, such as Undo. Its label is its own accessible name. */\n action?: ToastAction;\n}\n\nexport interface ToastRecord extends Required<Pick<ToastOptions, 'title' | 'variant'>> {\n id: string;\n description?: ReactNode;\n duration: number | null;\n action?: ToastAction;\n}\n\nexport interface ToastApi {\n /** Shows a toast and returns its id. */\n toast: (options: ToastOptions) => string;\n /** Closes one toast by id, or all of them when called without an id. */\n dismiss: (id?: string) => void;\n}\n\nconst ToastContext = createContext<ToastApi | null>(null);\n\nexport type ToastPlacement = 'top-right' | 'bottom-right' | 'bottom-center';\n\nexport interface ToastProviderProps {\n children: ReactNode;\n /** Default auto-close delay in milliseconds. */\n duration?: number;\n placement?: ToastPlacement;\n /** Accessible name for the notifications region. */\n label?: string;\n /** Upper bound on visible toasts; the oldest are dropped first. */\n maxVisible?: number;\n}\n\nconst placements: Record<ToastPlacement, string> = {\n 'top-right': 'top-4 right-4 items-end',\n 'bottom-right': 'bottom-4 right-4 items-end',\n 'bottom-center': 'bottom-4 left-1/2 -translate-x-1/2 items-center',\n};\n\nconst items = /*#__PURE__*/ createLazyModule(() => import('./ToastItem'));\n\nlet counter = 0;\nconst nextId = () => `ui-toast-${++counter}`;\n\n/**\n * Hosts the notification region and exposes `useToast`. The region is a\n * polite live region that is always present in the DOM, so screen readers\n * announce each toast as it is added. Timers pause while a toast is hovered\n * or has focus, so nobody loses a message they are reading. A toast can carry\n * an action button, closes on Escape while it has focus, and when it closes\n * with focus inside, focus goes back to where it was before the user\n * entered the toast.\n */\nexport function ToastProvider({\n children,\n duration = 5000,\n placement = 'bottom-right',\n label = 'Notifications',\n maxVisible = 5,\n}: ToastProviderProps) {\n const [toasts, setToasts] = useState<ToastRecord[]>([]);\n const loaded = items.useModule(toasts.length > 0);\n\n const dismiss = useCallback((id?: string) => {\n setToasts((current) => (id ? current.filter((item) => item.id !== id) : []));\n }, []);\n\n const toast = useCallback(\n ({ title, description, variant = 'info', duration: own, action }: ToastOptions) => {\n const id = nextId();\n const record: ToastRecord = {\n id,\n title,\n description,\n variant,\n duration: own === undefined ? duration : own,\n action,\n };\n setToasts((current) => [...current, record].slice(-maxVisible));\n return id;\n },\n [duration, maxVisible],\n );\n\n // The code for a toast downloads once the page is idle, so a toast about a lost connection can still show.\n useEffect(() => {\n const handle = window.setTimeout(items.preload, 2000);\n return () => window.clearTimeout(handle);\n }, []);\n\n const api = useMemo(() => ({ toast, dismiss }), [toast, dismiss]);\n\n return (\n <ToastContext.Provider value={api}>\n {children}\n <section\n aria-label={label}\n className={cx('pointer-events-none fixed z-50', placements[placement])}\n >\n <ol\n aria-live='polite'\n aria-relevant='additions text'\n className='flex w-[22rem] max-w-[calc(100vw-2rem)] flex-col gap-2'\n >\n {loaded &&\n toasts.map((item) => (\n <loaded.ToastItem key={item.id} toast={item} onDismiss={dismiss} />\n ))}\n </ol>\n </section>\n </ToastContext.Provider>\n );\n}\n\n/** Returns `{ toast, dismiss }`. Must be called inside a ToastProvider. */\nexport function useToast(): ToastApi {\n const context = useContext(ToastContext);\n if (!context) {\n throw new Error('useToast must be used inside a <ToastProvider>.');\n }\n return context;\n}\n"],"mappings":";;;;;;AA6CA,IAAM,eAAe,cAA+B,IAAI;AAexD,IAAM,aAA6C;CACjD,aAAa;CACb,gBAAgB;CAChB,iBAAiB;AACnB;AAEA,IAAM,QAAsB,qCAAuB,OAAO,iBAAc;AAExE,IAAI,UAAU;AACd,IAAM,eAAe,YAAY,EAAE;;;;;;;;;;AAWnC,SAAgB,cAAc,EAC5B,UACA,WAAW,KACX,YAAY,gBACZ,QAAQ,iBACR,aAAa,KACQ;CACrB,MAAM,CAAC,QAAQ,aAAa,SAAwB,CAAC,CAAC;CACtD,MAAM,SAAS,MAAM,UAAU,OAAO,SAAS,CAAC;CAEhD,MAAM,UAAU,aAAa,OAAgB;EAC3C,WAAW,YAAa,KAAK,QAAQ,QAAQ,SAAS,KAAK,OAAO,EAAE,IAAI,CAAC,CAAE;CAC7E,GAAG,CAAC,CAAC;CAEL,MAAM,QAAQ,aACX,EAAE,OAAO,aAAa,UAAU,QAAQ,UAAU,KAAK,aAA2B;EACjF,MAAM,KAAK,OAAO;EAClB,MAAM,SAAsB;GAC1B;GACA;GACA;GACA;GACA,UAAU,QAAQ,KAAA,IAAY,WAAW;GACzC;EACF;EACA,WAAW,YAAY,CAAC,GAAG,SAAS,MAAM,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;EAC9D,OAAO;CACT,GACA,CAAC,UAAU,UAAU,CACvB;CAGA,gBAAgB;EACd,MAAM,SAAS,OAAO,WAAW,MAAM,SAAS,GAAI;EACpD,aAAa,OAAO,aAAa,MAAM;CACzC,GAAG,CAAC,CAAC;CAEL,MAAM,MAAM,eAAe;EAAE;EAAO;CAAQ,IAAI,CAAC,OAAO,OAAO,CAAC;CAEhE,OACE,qBAAC,aAAa,UAAd;EAAuB,OAAO;EAA9B,UAAA,CACG,UACD,oBAAC,WAAD;GACE,cAAY;GACZ,WAAW,GAAG,kCAAkC,WAAW,UAAU;GAErE,UAAA,oBAAC,MAAD;IACE,aAAU;IACV,iBAAc;IACd,WAAU;IAET,UAAA,UACC,OAAO,KAAK,SACV,oBAAC,OAAO,WAAR;KAAgC,OAAO;KAAM,WAAW;IAAU,GAA3C,KAAK,EAAsC,CACnE;GACD,CAAA;EACG,CAAA,CACY;;AAE3B;;AAGA,SAAgB,WAAqB;CACnC,MAAM,UAAU,WAAW,YAAY;CACvC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,iDAAiD;CAEnE,OAAO;AACT"}
@@ -0,0 +1,6 @@
1
+ import type { ToastRecord } from './Toast';
2
+ /** One toast. ToastProvider loads this module when the first toast is added. */
3
+ export declare function ToastItem({ toast, onDismiss, }: {
4
+ toast: ToastRecord;
5
+ onDismiss: (id: string) => void;
6
+ }): import("react").JSX.Element;