@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,56 @@
1
+ "use client";
2
+ import { cx } from "../../utils/cx.js";
3
+ import { IconButton } from "../IconButton/IconButton.js";
4
+ import { useEffect, useState } from "react";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ import { Check, Copy } from "lucide-react";
7
+ // src/components/CodeBlock/CodeBlock.tsx
8
+ var copiedForMs = 2e3;
9
+ var frame = "relative rounded-lg border border-subtle bg-secondary";
10
+ var pre = "overflow-auto rounded-lg p-4 font-data text-sm text-primary outline-none focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-focus";
11
+ /**
12
+ * Preformatted text in the theme's data font, for generated output, commands
13
+ * and code samples. The block is focusable so a keyboard user can scroll it,
14
+ * and it is a labelled group so a screen reader names it. With `copyable` a
15
+ * button copies the text and a polite status confirms it.
16
+ */
17
+ function CodeBlock({ children, label, copyable = false, copyLabel = "Copy code", copiedLabel = "Copied", wrap = false, className }) {
18
+ const [copied, setCopied] = useState(false);
19
+ useEffect(() => {
20
+ if (!copied) return;
21
+ const timer = window.setTimeout(() => setCopied(false), copiedForMs);
22
+ return () => window.clearTimeout(timer);
23
+ }, [copied]);
24
+ async function handleCopy() {
25
+ try {
26
+ await navigator.clipboard.writeText(children);
27
+ setCopied(true);
28
+ } catch {
29
+ setCopied(false);
30
+ }
31
+ }
32
+ return /* @__PURE__ */ jsxs("div", {
33
+ className: cx(frame, className),
34
+ children: [/* @__PURE__ */ jsx("pre", {
35
+ role: "group",
36
+ "aria-label": label,
37
+ tabIndex: 0,
38
+ className: cx(pre, copyable && "pr-14", wrap && "break-words whitespace-pre-wrap"),
39
+ children: /* @__PURE__ */ jsx("code", { children })
40
+ }), copyable && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(IconButton, {
41
+ icon: copied ? Check : Copy,
42
+ "aria-label": copyLabel,
43
+ variant: "tertiary",
44
+ size: "sm",
45
+ className: "absolute top-2 right-2",
46
+ onPress: handleCopy
47
+ }), /* @__PURE__ */ jsx("span", {
48
+ role: "status",
49
+ className: "sr-only",
50
+ children: copied ? copiedLabel : ""
51
+ })] })]
52
+ });
53
+ }
54
+ export { CodeBlock };
55
+
56
+ //# sourceMappingURL=CodeBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeBlock.js","names":["_Fragment"],"sources":["../../../src/components/CodeBlock/CodeBlock.tsx"],"sourcesContent":["import { Check, Copy } from 'lucide-react';\nimport { useEffect, useState } from 'react';\nimport { cx } from '../../utils/cx';\nimport { IconButton } from '../IconButton/IconButton';\n\nexport interface CodeBlockProps {\n /** The text to show, exactly as it should be copied. */\n children: string;\n /** Accessible name of the block, such as \"Generated Tailwind theme\". */\n label: string;\n /** Adds a button that copies the text. */\n copyable?: boolean;\n /** Accessible name of the copy button. */\n copyLabel?: string;\n /** Announced after copying. */\n copiedLabel?: string;\n /** Wrap long lines instead of scrolling sideways. */\n wrap?: boolean;\n className?: string;\n}\n\nconst copiedForMs = 2000;\n\nconst frame = 'relative rounded-lg border border-subtle bg-secondary';\nconst pre =\n 'overflow-auto rounded-lg p-4 font-data text-sm text-primary outline-none focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-focus';\n\n/**\n * Preformatted text in the theme's data font, for generated output, commands\n * and code samples. The block is focusable so a keyboard user can scroll it,\n * and it is a labelled group so a screen reader names it. With `copyable` a\n * button copies the text and a polite status confirms it.\n */\nexport function CodeBlock({\n children,\n label,\n copyable = false,\n copyLabel = 'Copy code',\n copiedLabel = 'Copied',\n wrap = false,\n className,\n}: CodeBlockProps) {\n const [copied, setCopied] = useState(false);\n\n useEffect(() => {\n if (!copied) return;\n const timer = window.setTimeout(() => setCopied(false), copiedForMs);\n return () => window.clearTimeout(timer);\n }, [copied]);\n\n async function handleCopy() {\n try {\n await navigator.clipboard.writeText(children);\n setCopied(true);\n } catch {\n setCopied(false);\n }\n }\n\n return (\n <div className={cx(frame, className)}>\n <pre\n role='group'\n aria-label={label}\n // A scrollable region must be reachable by keyboard, hence the tab stop on the group.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n tabIndex={0}\n className={cx(pre, copyable && 'pr-14', wrap && 'break-words whitespace-pre-wrap')}\n >\n <code>{children}</code>\n </pre>\n {copyable && (\n <>\n <IconButton\n icon={copied ? Check : Copy}\n aria-label={copyLabel}\n variant='tertiary'\n size='sm'\n className='absolute top-2 right-2'\n onPress={handleCopy}\n />\n <span role='status' className='sr-only'>\n {copied ? copiedLabel : ''}\n </span>\n </>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAqBA,IAAM,cAAc;AAEpB,IAAM,QAAQ;AACd,IAAM,MACJ;;;;;;;AAQF,SAAgB,UAAU,EACxB,UACA,OACA,WAAW,OACX,YAAY,aACZ,cAAc,UACd,OAAO,OACP,aACiB;CACjB,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK;CAE1C,gBAAgB;EACd,IAAI,CAAC,QAAQ;EACb,MAAM,QAAQ,OAAO,iBAAiB,UAAU,KAAK,GAAG,WAAW;EACnE,aAAa,OAAO,aAAa,KAAK;CACxC,GAAG,CAAC,MAAM,CAAC;CAEX,eAAe,aAAa;EAC1B,IAAI;GACF,MAAM,UAAU,UAAU,UAAU,QAAQ;GAC5C,UAAU,IAAI;EAChB,QAAQ;GACN,UAAU,KAAK;EACjB;CACF;CAEA,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,OAAO,SAAS;EAAnC,UAAA,CACE,oBAAC,OAAD;GACE,MAAK;GACL,cAAY;GAGZ,UAAU;GACV,WAAW,GAAG,KAAK,YAAY,SAAS,QAAQ,iCAAiC;GAEjF,UAAA,oBAAC,QAAD,EAAO,SAAe,CAAA;EACnB,CAAA,GACJ,YACC,qBAAAA,UAAA,EAAA,UAAA,CACE,oBAAC,YAAD;GACE,MAAM,SAAS,QAAQ;GACvB,cAAY;GACZ,SAAQ;GACR,MAAK;GACL,WAAU;GACV,SAAS;EACV,CAAA,GACD,oBAAC,QAAD;GAAM,MAAK;GAAS,WAAU;GAC3B,UAAA,SAAS,cAAc;EACpB,CAAA,CACN,EAAA,CAAA,CAED;;AAET"}
@@ -0,0 +1,2 @@
1
+ export { CodeBlock } from './CodeBlock';
2
+ export type { CodeBlockProps } from './CodeBlock';
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export { CodeBlock } from "./CodeBlock.js";
@@ -0,0 +1,34 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type ComboBoxProps, type ListBoxItemProps, type ListBoxSectionProps } from 'react-aria-components';
3
+ export interface ComboboxProps<T extends object> extends Omit<ComboBoxProps<T>, 'children'> {
4
+ label?: ReactNode;
5
+ hint?: ReactNode;
6
+ errorMessage?: string;
7
+ placeholder?: string;
8
+ /** Shows a spinner in the field while results load, for example from useAsyncList. */
9
+ isLoading?: boolean;
10
+ /** Announced while loading. */
11
+ loadingLabel?: string;
12
+ /** Shown in the popover when nothing matches. Defaults to "No results". */
13
+ emptyState?: ReactNode;
14
+ children: ReactNode | ((item: T) => ReactNode);
15
+ }
16
+ /**
17
+ * A text field with a filtered list of suggestions. Works with static items,
18
+ * with `items` and a render function, and with async data: pass `items`,
19
+ * `inputValue` and `onInputChange` from useAsyncList and set `isLoading`
20
+ * while a request is in flight.
21
+ */
22
+ export declare function Combobox<T extends object>({ label, hint, errorMessage, placeholder, isLoading, loadingLabel, emptyState, children, className, isInvalid, ...props }: ComboboxProps<T>): import("react").JSX.Element;
23
+ export interface ComboboxItemProps extends Omit<ListBoxItemProps, 'children'> {
24
+ children: ReactNode;
25
+ /** Secondary line under the label. */
26
+ description?: ReactNode;
27
+ }
28
+ export declare function ComboboxItem({ children, description, className, ...props }: ComboboxItemProps): import("react").JSX.Element;
29
+ export interface ComboboxSectionProps<T extends object> extends Omit<ListBoxSectionProps<T>, 'children'> {
30
+ /** Visible group heading, also the group's accessible name. */
31
+ title?: ReactNode;
32
+ children: ReactNode;
33
+ }
34
+ export declare function ComboboxSection<T extends object>({ title, children, className, ...props }: ComboboxSectionProps<T>): import("react").JSX.Element;
@@ -0,0 +1,106 @@
1
+ "use client";
2
+ import { FieldErrorMessage, FieldHint, FieldLabel } from "../../internal/Field.js";
3
+ import { listItem, popoverSurface } from "../../internal/surfaces.js";
4
+ import { cx } from "../../utils/cx.js";
5
+ import { Spinner } from "../Spinner/Spinner.js";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { ChevronDown } from "lucide-react";
8
+ import { Button, ComboBox, Group, Header, Input, ListBox, ListBoxItem, ListBoxSection, Popover, Text, composeRenderProps } from "react-aria-components";
9
+ // src/components/Combobox/Combobox.tsx
10
+ var field = "flex h-control-md items-center gap-2 rounded-md border border-control bg-primary pr-1 pl-3 shadow-xs transition-shadow data-disabled:cursor-not-allowed data-disabled:border-disabled data-disabled:bg-disabled data-focus-within:border-brand data-focus-within:ring-4 data-focus-within:ring-focus/25 data-invalid:border-error data-invalid:data-focus-within:border-error data-invalid:data-focus-within:ring-error/25";
11
+ var input = "min-w-0 flex-1 bg-transparent text-md text-primary outline-none placeholder:text-placeholder disabled:cursor-not-allowed disabled:text-disabled";
12
+ var toggle = "flex size-control-xs shrink-0 cursor-pointer items-center justify-center rounded-sm text-fg-tertiary outline-none data-focus-visible:outline-2 data-focus-visible:outline-solid data-focus-visible:outline-focus data-hovered:bg-hover";
13
+ var emptyText = "px-item-x py-item-y text-sm text-tertiary";
14
+ /**
15
+ * A text field with a filtered list of suggestions. Works with static items,
16
+ * with `items` and a render function, and with async data: pass `items`,
17
+ * `inputValue` and `onInputChange` from useAsyncList and set `isLoading`
18
+ * while a request is in flight.
19
+ */
20
+ function Combobox({ label, hint, errorMessage, placeholder, isLoading = false, loadingLabel = "Loading results", emptyState = "No results", children, className, isInvalid, ...props }) {
21
+ function renderEmptyState() {
22
+ if (isLoading) return /* @__PURE__ */ jsx("div", {
23
+ className: emptyText,
24
+ children: loadingLabel
25
+ });
26
+ return /* @__PURE__ */ jsx("div", {
27
+ className: emptyText,
28
+ children: emptyState
29
+ });
30
+ }
31
+ return /* @__PURE__ */ jsxs(ComboBox, {
32
+ ...props,
33
+ allowsEmptyCollection: true,
34
+ isInvalid: isInvalid ?? Boolean(errorMessage),
35
+ className: composeRenderProps(className, (consumer) => cx("flex flex-col gap-1.5", consumer)),
36
+ children: [
37
+ label && /* @__PURE__ */ jsx(FieldLabel, { children: label }),
38
+ /* @__PURE__ */ jsxs(Group, {
39
+ className: field,
40
+ children: [
41
+ /* @__PURE__ */ jsx(Input, {
42
+ placeholder,
43
+ className: input
44
+ }),
45
+ isLoading && /* @__PURE__ */ jsx(Spinner, {
46
+ size: "sm",
47
+ label: loadingLabel
48
+ }),
49
+ /* @__PURE__ */ jsx(Button, {
50
+ className: toggle,
51
+ children: /* @__PURE__ */ jsx(ChevronDown, {
52
+ "aria-hidden": "true",
53
+ className: "size-4"
54
+ })
55
+ })
56
+ ]
57
+ }),
58
+ hint && !errorMessage && /* @__PURE__ */ jsx(FieldHint, { children: hint }),
59
+ /* @__PURE__ */ jsx(FieldErrorMessage, { children: errorMessage }),
60
+ /* @__PURE__ */ jsx(Popover, {
61
+ offset: 4,
62
+ className: cx(popoverSurface, "w-(--trigger-width)"),
63
+ children: /* @__PURE__ */ jsx(ListBox, {
64
+ renderEmptyState,
65
+ className: "max-h-72 outline-none",
66
+ children
67
+ })
68
+ })
69
+ ]
70
+ });
71
+ }
72
+ function ComboboxItem({ children, description, className, ...props }) {
73
+ const textValue = props.textValue ?? (typeof children === "string" ? children : void 0);
74
+ return /* @__PURE__ */ jsx(ListBoxItem, {
75
+ ...props,
76
+ textValue,
77
+ className: composeRenderProps(className, (consumer) => cx(listItem, "data-selected:font-medium", consumer)),
78
+ children: description ? /* @__PURE__ */ jsxs("span", {
79
+ className: "flex min-w-0 flex-1 flex-col",
80
+ children: [/* @__PURE__ */ jsx("span", {
81
+ className: "truncate",
82
+ children
83
+ }), /* @__PURE__ */ jsx("span", {
84
+ className: "truncate text-xs text-tertiary",
85
+ children: description
86
+ })]
87
+ }) : /* @__PURE__ */ jsx(Text, {
88
+ slot: "label",
89
+ className: "min-w-0 flex-1 truncate",
90
+ children
91
+ })
92
+ });
93
+ }
94
+ function ComboboxSection({ title, children, className, ...props }) {
95
+ return /* @__PURE__ */ jsxs(ListBoxSection, {
96
+ ...props,
97
+ className: cx("flex flex-col", className),
98
+ children: [title && /* @__PURE__ */ jsx(Header, {
99
+ className: "px-item-x pt-2 pb-1 text-xs font-semibold text-tertiary",
100
+ children: title
101
+ }), children]
102
+ });
103
+ }
104
+ export { Combobox, ComboboxItem, ComboboxSection };
105
+
106
+ //# sourceMappingURL=Combobox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Combobox.js","names":["AriaButton"],"sources":["../../../src/components/Combobox/Combobox.tsx"],"sourcesContent":["import { ChevronDown } from 'lucide-react';\nimport type { ReactNode } from 'react';\nimport {\n Button as AriaButton,\n ComboBox,\n Group,\n Header,\n Input,\n ListBox,\n ListBoxItem,\n ListBoxSection,\n Popover,\n Text,\n composeRenderProps,\n type ComboBoxProps,\n type ListBoxItemProps,\n type ListBoxSectionProps,\n} from 'react-aria-components';\nimport { FieldErrorMessage, FieldHint, FieldLabel } from '../../internal/Field';\nimport { listItem, listSectionHeader, popoverSurface } from '../../internal/surfaces';\nimport { cx } from '../../utils/cx';\nimport { Spinner } from '../Spinner/Spinner';\n\nexport interface ComboboxProps<T extends object> extends Omit<ComboBoxProps<T>, 'children'> {\n label?: ReactNode;\n hint?: ReactNode;\n errorMessage?: string;\n placeholder?: string;\n /** Shows a spinner in the field while results load, for example from useAsyncList. */\n isLoading?: boolean;\n /** Announced while loading. */\n loadingLabel?: string;\n /** Shown in the popover when nothing matches. Defaults to \"No results\". */\n emptyState?: ReactNode;\n children: ReactNode | ((item: T) => ReactNode);\n}\n\nconst field =\n 'flex h-control-md items-center gap-2 rounded-md border border-control bg-primary pr-1 pl-3 shadow-xs transition-shadow data-disabled:cursor-not-allowed data-disabled:border-disabled data-disabled:bg-disabled data-focus-within:border-brand data-focus-within:ring-4 data-focus-within:ring-focus/25 data-invalid:border-error data-invalid:data-focus-within:border-error data-invalid:data-focus-within:ring-error/25';\nconst input =\n 'min-w-0 flex-1 bg-transparent text-md text-primary outline-none placeholder:text-placeholder disabled:cursor-not-allowed disabled:text-disabled';\nconst toggle =\n 'flex size-control-xs shrink-0 cursor-pointer items-center justify-center rounded-sm text-fg-tertiary outline-none data-focus-visible:outline-2 data-focus-visible:outline-solid data-focus-visible:outline-focus data-hovered:bg-hover';\nconst emptyText = 'px-item-x py-item-y text-sm text-tertiary';\n\n/**\n * A text field with a filtered list of suggestions. Works with static items,\n * with `items` and a render function, and with async data: pass `items`,\n * `inputValue` and `onInputChange` from useAsyncList and set `isLoading`\n * while a request is in flight.\n */\nexport function Combobox<T extends object>({\n label,\n hint,\n errorMessage,\n placeholder,\n isLoading = false,\n loadingLabel = 'Loading results',\n emptyState = 'No results',\n children,\n className,\n isInvalid,\n ...props\n}: ComboboxProps<T>) {\n function renderEmptyState() {\n if (isLoading) return <div className={emptyText}>{loadingLabel}</div>;\n return <div className={emptyText}>{emptyState}</div>;\n }\n\n return (\n <ComboBox\n {...props}\n allowsEmptyCollection\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 <Group className={field}>\n <Input placeholder={placeholder} className={input} />\n {isLoading && <Spinner size='sm' label={loadingLabel} />}\n <AriaButton className={toggle}>\n <ChevronDown aria-hidden='true' className='size-4' />\n </AriaButton>\n </Group>\n {hint && !errorMessage && <FieldHint>{hint}</FieldHint>}\n <FieldErrorMessage>{errorMessage}</FieldErrorMessage>\n <Popover offset={4} className={cx(popoverSurface, 'w-(--trigger-width)')}>\n <ListBox renderEmptyState={renderEmptyState} className='max-h-72 outline-none'>\n {children}\n </ListBox>\n </Popover>\n </ComboBox>\n );\n}\n\nexport interface ComboboxItemProps extends Omit<ListBoxItemProps, 'children'> {\n children: ReactNode;\n /** Secondary line under the label. */\n description?: ReactNode;\n}\n\nexport function ComboboxItem({ children, description, className, ...props }: ComboboxItemProps) {\n const textValue = props.textValue ?? (typeof children === 'string' ? children : undefined);\n return (\n <ListBoxItem\n {...props}\n textValue={textValue}\n className={composeRenderProps(className, (consumer) =>\n cx(listItem, 'data-selected:font-medium', consumer),\n )}\n >\n {description ? (\n <span className='flex min-w-0 flex-1 flex-col'>\n <span className='truncate'>{children}</span>\n <span className='truncate text-xs text-tertiary'>{description}</span>\n </span>\n ) : (\n <Text slot='label' className='min-w-0 flex-1 truncate'>\n {children}\n </Text>\n )}\n </ListBoxItem>\n );\n}\n\nexport interface ComboboxSectionProps<T extends object> extends Omit<\n ListBoxSectionProps<T>,\n 'children'\n> {\n /** Visible group heading, also the group's accessible name. */\n title?: ReactNode;\n children: ReactNode;\n}\n\nexport function ComboboxSection<T extends object>({\n title,\n children,\n className,\n ...props\n}: ComboboxSectionProps<T>) {\n return (\n <ListBoxSection {...props} className={cx('flex flex-col', className)}>\n {title && <Header className={listSectionHeader}>{title}</Header>}\n {children}\n </ListBoxSection>\n );\n}\n"],"mappings":";;;;;;;;;AAqCA,IAAM,QACJ;AACF,IAAM,QACJ;AACF,IAAM,SACJ;AACF,IAAM,YAAY;;;;;;;AAQlB,SAAgB,SAA2B,EACzC,OACA,MACA,cACA,aACA,YAAY,OACZ,eAAe,mBACf,aAAa,cACb,UACA,WACA,WACA,GAAG,SACgB;CACnB,SAAS,mBAAmB;EAC1B,IAAI,WAAW,OAAO,oBAAC,OAAD;GAAK,WAAW;GAAY,UAAA;EAAkB,CAAA;EACpE,OAAO,oBAAC,OAAD;GAAK,WAAW;GAAY,UAAA;EAAgB,CAAA;CACrD;CAEA,OACE,qBAAC,UAAD;EACE,GAAI;EACJ,uBAAA;EACA,WAAW,aAAa,QAAQ,YAAY;EAC5C,WAAW,mBAAmB,YAAY,aAAa,GAAG,yBAAyB,QAAQ,CAAC;EAJ9F,UAAA;GAMG,SAAS,oBAAC,YAAD,EAAA,UAAa,MAAkB,CAAA;GACzC,qBAAC,OAAD;IAAO,WAAW;IAAlB,UAAA;KACE,oBAAC,OAAD;MAAoB;MAAa,WAAW;KAAQ,CAAA;KACnD,aAAa,oBAAC,SAAD;MAAS,MAAK;MAAK,OAAO;KAAe,CAAA;KACvD,oBAACA,QAAD;MAAY,WAAW;MACrB,UAAA,oBAAC,aAAD;OAAa,eAAY;OAAO,WAAU;MAAU,CAAA;KAC1C,CAAA;IACP;;GACN,QAAQ,CAAC,gBAAgB,oBAAC,WAAD,EAAA,UAAY,KAAgB,CAAA;GACtD,oBAAC,mBAAD,EAAA,UAAoB,aAAgC,CAAA;GACpD,oBAAC,SAAD;IAAS,QAAQ;IAAG,WAAW,GAAG,gBAAgB,qBAAqB;IACrE,UAAA,oBAAC,SAAD;KAA2B;KAAkB,WAAU;KACpD;IACM,CAAA;GACF,CAAA;EACD;;AAEd;AAQA,SAAgB,aAAa,EAAE,UAAU,aAAa,WAAW,GAAG,SAA4B;CAC9F,MAAM,YAAY,MAAM,cAAc,OAAO,aAAa,WAAW,WAAW,KAAA;CAChF,OACE,oBAAC,aAAD;EACE,GAAI;EACO;EACX,WAAW,mBAAmB,YAAY,aACxC,GAAG,UAAU,6BAA6B,QAAQ,CACpD;EAEC,UAAA,cACC,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACE,oBAAC,QAAD;IAAM,WAAU;IAAY;GAAe,CAAA,GAC3C,oBAAC,QAAD;IAAM,WAAU;IAAkC,UAAA;GAAkB,CAAA,CAChE;EAEN,CAAA,IAAA,oBAAC,MAAD;GAAM,MAAK;GAAQ,WAAU;GAC1B;EACG,CAAA;CAEG,CAAA;AAEjB;AAWA,SAAgB,gBAAkC,EAChD,OACA,UACA,WACA,GAAG,SACuB;CAC1B,OACE,qBAAC,gBAAD;EAAgB,GAAI;EAAO,WAAW,GAAG,iBAAiB,SAAS;EAAnE,UAAA,CACG,SAAS,oBAAC,QAAD;GAAQ,WAAA;GAA+B,UAAA;EAAc,CAAA,GAC9D,QACa;;AAEpB"}
@@ -0,0 +1,2 @@
1
+ export { Combobox, ComboboxItem, ComboboxSection } from './Combobox';
2
+ export type { ComboboxProps, ComboboxItemProps, ComboboxSectionProps } from './Combobox';
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export { Combobox, ComboboxItem, ComboboxSection } from "./Combobox.js";
@@ -0,0 +1,74 @@
1
+ import { type Dispatch, type ReactNode, type SetStateAction } from 'react';
2
+ import type { Key, MenuItemProps, MenuSectionProps } from 'react-aria-components';
3
+ import type { IconComponent } from '../../internal/types';
4
+ export interface CommandPalettePage {
5
+ /** Identifies the page. The search text resets when it changes. */
6
+ id: string;
7
+ /** Shown before the search field and announced when the page opens, such as "Change status". */
8
+ title: string;
9
+ }
10
+ export interface CommandPaletteProps {
11
+ isOpen: boolean;
12
+ onOpenChange: (isOpen: boolean) => void;
13
+ /** Called with the id of the chosen command. The palette closes afterwards unless `closeOnAction` is false. */
14
+ onAction?: (key: Key) => void;
15
+ /**
16
+ * Whether choosing a command closes the palette. Set it to false when some
17
+ * commands open a sub page: keep the page in your state, render its commands
18
+ * as `children`, and call `onOpenChange(false)` yourself after a final command.
19
+ */
20
+ closeOnAction?: boolean;
21
+ /** Called with the search text as the user types. */
22
+ onSearchChange?: (value: string) => void;
23
+ /**
24
+ * The sub page being shown, or nothing for the top level. While it is set the
25
+ * palette shows its title and a back button, and Backspace in an empty
26
+ * search field calls `onBack`.
27
+ */
28
+ page?: CommandPalettePage;
29
+ /** Go up one level: Backspace in an empty search field, or the back button. */
30
+ onBack?: () => void;
31
+ /** Accessible name of the back button. */
32
+ backLabel?: string;
33
+ /** Accessible name of the dialog. */
34
+ label?: string;
35
+ /** Accessible name and placeholder of the search field. */
36
+ searchLabel?: string;
37
+ placeholder?: string;
38
+ /** Shown when nothing matches the search. */
39
+ emptyState?: ReactNode;
40
+ /** CommandGroup and CommandItem elements. */
41
+ children: ReactNode;
42
+ }
43
+ export interface CommandGroupProps extends Omit<MenuSectionProps<object>, 'children'> {
44
+ /** Visible heading, also the group's accessible name. */
45
+ heading: ReactNode;
46
+ children: ReactNode;
47
+ }
48
+ export interface CommandItemProps extends Omit<MenuItemProps, 'children'> {
49
+ children: ReactNode;
50
+ /** A lucide-react style component, or an element such as `<Inbox />`. */
51
+ icon?: IconComponent | ReactNode;
52
+ /** Secondary line. It joins the accessible name after the label, so the name contains the visible text. */
53
+ description?: ReactNode;
54
+ /** Keys of the shortcut that runs this command outside the palette, such as ['⌘', 'N']. */
55
+ shortcut?: string[];
56
+ }
57
+ /**
58
+ * A searchable list of commands in a modal, opened with Cmd or Ctrl and K
59
+ * through useCommandPaletteShortcut. Focus starts in the search field, typing
60
+ * filters every group, arrow keys move through matches, Enter runs a command
61
+ * and closes the palette, and Escape closes it. Focus then returns to where it
62
+ * was before opening.
63
+ *
64
+ * The palette's code loads the first time `isOpen` becomes true. Pressing Cmd
65
+ * or Ctrl with useCommandPaletteShortcut starts the download ahead of the K.
66
+ */
67
+ export declare function CommandPalette(props: CommandPaletteProps): import("react").JSX.Element | null;
68
+ export declare function CommandGroup(props: CommandGroupProps): import("react").JSX.Element | null;
69
+ export declare function CommandItem(props: CommandItemProps): import("react").JSX.Element | null;
70
+ /**
71
+ * Toggles the palette with Cmd+K on macOS or Ctrl+K elsewhere. Pass the state
72
+ * setter of `isOpen`. `key` changes the letter.
73
+ */
74
+ export declare function useCommandPaletteShortcut(setOpen: Dispatch<SetStateAction<boolean>>, key?: string): void;
@@ -0,0 +1,51 @@
1
+ "use client";
2
+ import { createLazyModule } from "../../internal/lazyModule.js";
3
+ import { useEffect } from "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ // src/components/CommandPalette/CommandPalette.tsx
6
+ var palette = /*#__PURE__*/ createLazyModule(() => import("./CommandPaletteOverlay.js"));
7
+ /**
8
+ * A searchable list of commands in a modal, opened with Cmd or Ctrl and K
9
+ * through useCommandPaletteShortcut. Focus starts in the search field, typing
10
+ * filters every group, arrow keys move through matches, Enter runs a command
11
+ * and closes the palette, and Escape closes it. Focus then returns to where it
12
+ * was before opening.
13
+ *
14
+ * The palette's code loads the first time `isOpen` becomes true. Pressing Cmd
15
+ * or Ctrl with useCommandPaletteShortcut starts the download ahead of the K.
16
+ */
17
+ function CommandPalette(props) {
18
+ const loaded = palette.useModule(props.isOpen);
19
+ return loaded ? /* @__PURE__ */ jsx(loaded.CommandPalette, { ...props }) : null;
20
+ }
21
+ function CommandGroup(props) {
22
+ const loaded = palette.get();
23
+ return loaded ? /* @__PURE__ */ jsx(loaded.CommandGroup, { ...props }) : null;
24
+ }
25
+ function CommandItem(props) {
26
+ const loaded = palette.get();
27
+ return loaded ? /* @__PURE__ */ jsx(loaded.CommandItem, { ...props }) : null;
28
+ }
29
+ /**
30
+ * Toggles the palette with Cmd+K on macOS or Ctrl+K elsewhere. Pass the state
31
+ * setter of `isOpen`. `key` changes the letter.
32
+ */
33
+ function useCommandPaletteShortcut(setOpen, key = "k") {
34
+ useEffect(() => {
35
+ function toggle(open) {
36
+ return !open;
37
+ }
38
+ function handleKeyDown(event) {
39
+ if (!(event.metaKey || event.ctrlKey)) return;
40
+ palette.preload();
41
+ if (event.key.toLowerCase() !== key.toLowerCase()) return;
42
+ event.preventDefault();
43
+ setOpen(toggle);
44
+ }
45
+ window.addEventListener("keydown", handleKeyDown);
46
+ return () => window.removeEventListener("keydown", handleKeyDown);
47
+ }, [setOpen, key]);
48
+ }
49
+ export { CommandGroup, CommandItem, CommandPalette, useCommandPaletteShortcut };
50
+
51
+ //# sourceMappingURL=CommandPalette.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandPalette.js","names":[],"sources":["../../../src/components/CommandPalette/CommandPalette.tsx"],"sourcesContent":["import { useEffect, type Dispatch, type ReactNode, type SetStateAction } from 'react';\nimport type { Key, MenuItemProps, MenuSectionProps } from 'react-aria-components';\nimport { createLazyModule } from '../../internal/lazyModule';\nimport type { IconComponent } from '../../internal/types';\n\nexport interface CommandPalettePage {\n /** Identifies the page. The search text resets when it changes. */\n id: string;\n /** Shown before the search field and announced when the page opens, such as \"Change status\". */\n title: string;\n}\n\nexport interface CommandPaletteProps {\n isOpen: boolean;\n onOpenChange: (isOpen: boolean) => void;\n /** Called with the id of the chosen command. The palette closes afterwards unless `closeOnAction` is false. */\n onAction?: (key: Key) => void;\n /**\n * Whether choosing a command closes the palette. Set it to false when some\n * commands open a sub page: keep the page in your state, render its commands\n * as `children`, and call `onOpenChange(false)` yourself after a final command.\n */\n closeOnAction?: boolean;\n /** Called with the search text as the user types. */\n onSearchChange?: (value: string) => void;\n /**\n * The sub page being shown, or nothing for the top level. While it is set the\n * palette shows its title and a back button, and Backspace in an empty\n * search field calls `onBack`.\n */\n page?: CommandPalettePage;\n /** Go up one level: Backspace in an empty search field, or the back button. */\n onBack?: () => void;\n /** Accessible name of the back button. */\n backLabel?: string;\n /** Accessible name of the dialog. */\n label?: string;\n /** Accessible name and placeholder of the search field. */\n searchLabel?: string;\n placeholder?: string;\n /** Shown when nothing matches the search. */\n emptyState?: ReactNode;\n /** CommandGroup and CommandItem elements. */\n children: ReactNode;\n}\n\nexport interface CommandGroupProps extends Omit<MenuSectionProps<object>, 'children'> {\n /** Visible heading, also the group's accessible name. */\n heading: ReactNode;\n children: ReactNode;\n}\n\nexport interface CommandItemProps extends Omit<MenuItemProps, 'children'> {\n children: ReactNode;\n /** A lucide-react style component, or an element such as `<Inbox />`. */\n icon?: IconComponent | ReactNode;\n /** Secondary line. It joins the accessible name after the label, so the name contains the visible text. */\n description?: ReactNode;\n /** Keys of the shortcut that runs this command outside the palette, such as ['⌘', 'N']. */\n shortcut?: string[];\n}\n\nconst palette = /*#__PURE__*/ createLazyModule(() => import('./CommandPaletteOverlay'));\n\n/**\n * A searchable list of commands in a modal, opened with Cmd or Ctrl and K\n * through useCommandPaletteShortcut. Focus starts in the search field, typing\n * filters every group, arrow keys move through matches, Enter runs a command\n * and closes the palette, and Escape closes it. Focus then returns to where it\n * was before opening.\n *\n * The palette's code loads the first time `isOpen` becomes true. Pressing Cmd\n * or Ctrl with useCommandPaletteShortcut starts the download ahead of the K.\n */\nexport function CommandPalette(props: CommandPaletteProps) {\n const loaded = palette.useModule(props.isOpen);\n return loaded ? <loaded.CommandPalette {...props} /> : null;\n}\n\nexport function CommandGroup(props: CommandGroupProps) {\n const loaded = palette.get();\n return loaded ? <loaded.CommandGroup {...props} /> : null;\n}\n\nexport function CommandItem(props: CommandItemProps) {\n const loaded = palette.get();\n return loaded ? <loaded.CommandItem {...props} /> : null;\n}\n\n/**\n * Toggles the palette with Cmd+K on macOS or Ctrl+K elsewhere. Pass the state\n * setter of `isOpen`. `key` changes the letter.\n */\nexport function useCommandPaletteShortcut(setOpen: Dispatch<SetStateAction<boolean>>, key = 'k') {\n useEffect(() => {\n function toggle(open: boolean) {\n return !open;\n }\n\n function handleKeyDown(event: KeyboardEvent) {\n if (!(event.metaKey || event.ctrlKey)) return;\n palette.preload();\n if (event.key.toLowerCase() !== key.toLowerCase()) return;\n event.preventDefault();\n setOpen(toggle);\n }\n\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [setOpen, key]);\n}\n"],"mappings":";;;;;AA8DA,IAAM,UAAwB,qCAAuB,OAAO,6BAA0B;;;;;;;;;;;AAYtF,SAAgB,eAAe,OAA4B;CACzD,MAAM,SAAS,QAAQ,UAAU,MAAM,MAAM;CAC7C,OAAO,SAAS,oBAAC,OAAO,gBAAR,EAAuB,GAAI,MAAQ,CAAA,IAAI;AACzD;AAEA,SAAgB,aAAa,OAA0B;CACrD,MAAM,SAAS,QAAQ,IAAI;CAC3B,OAAO,SAAS,oBAAC,OAAO,cAAR,EAAqB,GAAI,MAAQ,CAAA,IAAI;AACvD;AAEA,SAAgB,YAAY,OAAyB;CACnD,MAAM,SAAS,QAAQ,IAAI;CAC3B,OAAO,SAAS,oBAAC,OAAO,aAAR,EAAoB,GAAI,MAAQ,CAAA,IAAI;AACtD;;;;;AAMA,SAAgB,0BAA0B,SAA4C,MAAM,KAAK;CAC/F,gBAAgB;EACd,SAAS,OAAO,MAAe;GAC7B,OAAO,CAAC;EACV;EAEA,SAAS,cAAc,OAAsB;GAC3C,IAAI,EAAE,MAAM,WAAW,MAAM,UAAU;GACvC,QAAQ,QAAQ;GAChB,IAAI,MAAM,IAAI,YAAY,MAAM,IAAI,YAAY,GAAG;GACnD,MAAM,eAAe;GACrB,QAAQ,MAAM;EAChB;EAEA,OAAO,iBAAiB,WAAW,aAAa;EAChD,aAAa,OAAO,oBAAoB,WAAW,aAAa;CAClE,GAAG,CAAC,SAAS,GAAG,CAAC;AACnB"}
@@ -0,0 +1,11 @@
1
+ import type { CommandGroupProps, CommandItemProps, CommandPaletteProps } from './CommandPalette';
2
+ /**
3
+ * A searchable list of commands in a modal, opened with Cmd or Ctrl and K
4
+ * through useCommandPaletteShortcut. Focus starts in the search field, typing
5
+ * filters every group, arrow keys move through matches, Enter runs a command
6
+ * and closes the palette, and Escape closes it. Focus then returns to where it
7
+ * was before opening.
8
+ */
9
+ export declare function CommandPalette({ isOpen, onOpenChange, onAction, closeOnAction, onSearchChange, page, onBack, backLabel, label, searchLabel, placeholder, emptyState, children, }: CommandPaletteProps): import("react").JSX.Element;
10
+ export declare function CommandGroup({ heading, children, className, ...props }: CommandGroupProps): import("react").JSX.Element;
11
+ export declare function CommandItem({ children, icon, description, shortcut, className, ...props }: CommandItemProps): import("react").JSX.Element;
@@ -0,0 +1,180 @@
1
+ "use client";
2
+ import { listItem, listSectionHeader } from "../../internal/surfaces.js";
3
+ import { cx } from "../../utils/cx.js";
4
+ import { IconButton } from "../IconButton/IconButton.js";
5
+ import { Kbd } from "../Kbd/Kbd.js";
6
+ import { isValidElement, useEffect, useRef, useState } from "react";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { ArrowLeft, Search } from "lucide-react";
9
+ import { Autocomplete, Dialog, Header, Input, Menu as Menu$1, MenuItem, MenuSection, Modal, ModalOverlay, SearchField, Text, composeRenderProps, useFilter } from "react-aria-components";
10
+ // src/components/CommandPalette/CommandPaletteOverlay.tsx
11
+ var overlay = "fixed inset-0 z-50 flex items-start justify-center bg-overlay p-4 pt-[12vh] transition-opacity duration-150 data-entering:opacity-0 data-exiting:opacity-0 motion-reduce:transition-none";
12
+ var modal = "w-full max-w-xl overflow-hidden rounded-xl border border-subtle bg-elevated text-primary shadow-xl";
13
+ var searchRow = "flex h-control-lg items-center gap-2 border-b border-subtle px-4 data-focus-within:bg-secondary";
14
+ var searchInput = "min-w-0 flex-1 bg-transparent text-md text-primary outline-none placeholder:text-placeholder [&::-webkit-search-cancel-button]:hidden";
15
+ var list = "max-h-[min(24rem,60vh)] overflow-auto p-1 outline-none";
16
+ var itemIcon = "inline-flex shrink-0 text-fg-tertiary [&>svg]:size-4";
17
+ var empty = "px-4 py-8 text-center text-sm text-tertiary";
18
+ var pageTitle = "shrink-0 rounded-sm bg-tertiary px-2 py-0.5 text-xs font-medium text-secondary";
19
+ /**
20
+ * A searchable list of commands in a modal, opened with Cmd or Ctrl and K
21
+ * through useCommandPaletteShortcut. Focus starts in the search field, typing
22
+ * filters every group, arrow keys move through matches, Enter runs a command
23
+ * and closes the palette, and Escape closes it. Focus then returns to where it
24
+ * was before opening.
25
+ */
26
+ function CommandPalette({ isOpen, onOpenChange, onAction, closeOnAction = true, onSearchChange, page, onBack, backLabel = "Back", label = "Command palette", searchLabel = "Search commands", placeholder = "Type a command or search", emptyState = "No results", children }) {
27
+ return /* @__PURE__ */ jsx(ModalOverlay, {
28
+ isOpen,
29
+ onOpenChange,
30
+ isDismissable: true,
31
+ className: overlay,
32
+ children: /* @__PURE__ */ jsx(Modal, {
33
+ className: modal,
34
+ children: /* @__PURE__ */ jsx(Dialog, {
35
+ "aria-label": label,
36
+ className: "outline-none",
37
+ children: ({ close }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
38
+ role: "status",
39
+ className: "sr-only",
40
+ children: page?.title
41
+ }), /* @__PURE__ */ jsx(CommandSearch, {
42
+ close,
43
+ onAction,
44
+ closeOnAction,
45
+ onSearchChange,
46
+ page,
47
+ onBack,
48
+ backLabel,
49
+ searchLabel,
50
+ placeholder,
51
+ emptyState,
52
+ children
53
+ }, page?.id)] })
54
+ })
55
+ })
56
+ });
57
+ }
58
+ function CommandSearch({ close, onAction, closeOnAction, onSearchChange, page, onBack, backLabel, searchLabel, placeholder, emptyState, children }) {
59
+ const { contains } = useFilter({ sensitivity: "base" });
60
+ const inputRef = useRef(null);
61
+ const [search, setSearch] = useState("");
62
+ useEffect(() => {
63
+ inputRef.current?.focus();
64
+ }, []);
65
+ function handleAction(key) {
66
+ onAction?.(key);
67
+ if (closeOnAction) close();
68
+ }
69
+ function handleSearchChange(value) {
70
+ setSearch(value);
71
+ onSearchChange?.(value);
72
+ }
73
+ function handleKeyDown(event) {
74
+ if (event.key !== "Backspace" || search !== "" || !page) return;
75
+ event.preventDefault();
76
+ onBack?.();
77
+ }
78
+ function handleBack() {
79
+ onBack?.();
80
+ }
81
+ function renderEmptyState() {
82
+ return /* @__PURE__ */ jsx("div", {
83
+ className: empty,
84
+ children: emptyState
85
+ });
86
+ }
87
+ return /* @__PURE__ */ jsxs(Autocomplete, {
88
+ filter: contains,
89
+ inputValue: search,
90
+ onInputChange: handleSearchChange,
91
+ children: [/* @__PURE__ */ jsxs(SearchField, {
92
+ "aria-label": searchLabel,
93
+ className: searchRow,
94
+ children: [page ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(IconButton, {
95
+ icon: ArrowLeft,
96
+ "aria-label": backLabel,
97
+ variant: "tertiary",
98
+ size: "sm",
99
+ className: "-ml-2 shrink-0",
100
+ onPress: handleBack
101
+ }), /* @__PURE__ */ jsx("span", {
102
+ className: pageTitle,
103
+ children: page.title
104
+ })] }) : /* @__PURE__ */ jsx(Search, {
105
+ "aria-hidden": "true",
106
+ className: "size-5 shrink-0 text-fg-tertiary"
107
+ }), /* @__PURE__ */ jsx(Input, {
108
+ ref: inputRef,
109
+ role: "combobox",
110
+ "aria-expanded": true,
111
+ placeholder,
112
+ onKeyDown: handleKeyDown,
113
+ className: searchInput
114
+ })]
115
+ }), /* @__PURE__ */ jsx(Menu$1, {
116
+ onAction: handleAction,
117
+ renderEmptyState,
118
+ className: list,
119
+ children
120
+ })]
121
+ });
122
+ }
123
+ function CommandGroup({ heading, children, className, ...props }) {
124
+ return /* @__PURE__ */ jsxs(MenuSection, {
125
+ ...props,
126
+ className: cx("flex flex-col", className),
127
+ children: [/* @__PURE__ */ jsx(Header, {
128
+ className: listSectionHeader,
129
+ children: heading
130
+ }), children]
131
+ });
132
+ }
133
+ function isIconComponent(icon) {
134
+ return typeof icon === "function" || typeof icon === "object" && icon !== null && !isValidElement(icon) && "$$typeof" in icon;
135
+ }
136
+ function renderIcon(icon) {
137
+ if (isIconComponent(icon)) return /* @__PURE__ */ jsx(icon, {
138
+ "aria-hidden": "true",
139
+ className: "size-4 shrink-0 text-fg-tertiary"
140
+ });
141
+ if (!icon) return null;
142
+ return /* @__PURE__ */ jsx("span", {
143
+ "aria-hidden": "true",
144
+ className: itemIcon,
145
+ children: icon
146
+ });
147
+ }
148
+ function CommandItem({ children, icon, description, shortcut, className, ...props }) {
149
+ const textValue = props.textValue ?? (typeof children === "string" ? children : void 0);
150
+ return /* @__PURE__ */ jsxs(MenuItem, {
151
+ ...props,
152
+ textValue,
153
+ className: composeRenderProps(className, (consumer) => cx(listItem, consumer)),
154
+ children: [
155
+ renderIcon(icon),
156
+ description ? /* @__PURE__ */ jsxs("span", {
157
+ className: "flex min-w-0 flex-1 flex-col",
158
+ children: [/* @__PURE__ */ jsx("span", {
159
+ className: "truncate",
160
+ children
161
+ }), /* @__PURE__ */ jsx("span", {
162
+ className: "truncate text-xs text-tertiary",
163
+ children: description
164
+ })]
165
+ }) : /* @__PURE__ */ jsx(Text, {
166
+ slot: "label",
167
+ className: "min-w-0 flex-1 truncate",
168
+ children
169
+ }),
170
+ shortcut && /* @__PURE__ */ jsx(Kbd, {
171
+ keys: shortcut,
172
+ decorative: true,
173
+ className: "ml-4"
174
+ })
175
+ ]
176
+ });
177
+ }
178
+ export { CommandGroup, CommandItem, CommandPalette };
179
+
180
+ //# sourceMappingURL=CommandPaletteOverlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandPaletteOverlay.js","names":["_Fragment","Menu","Icon"],"sources":["../../../src/components/CommandPalette/CommandPaletteOverlay.tsx"],"sourcesContent":["import { ArrowLeft, Search } from 'lucide-react';\nimport {\n isValidElement,\n useEffect,\n useRef,\n useState,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n} from 'react';\nimport {\n Autocomplete,\n Dialog,\n Header,\n Input,\n Menu,\n MenuItem,\n MenuSection,\n Modal,\n ModalOverlay,\n SearchField,\n Text,\n composeRenderProps,\n useFilter,\n type Key,\n} from 'react-aria-components';\nimport { listItem, listSectionHeader } from '../../internal/surfaces';\nimport type { IconComponent } from '../../internal/types';\nimport { cx } from '../../utils/cx';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Kbd } from '../Kbd/Kbd';\nimport type { CommandGroupProps, CommandItemProps, CommandPaletteProps } from './CommandPalette';\n\nconst overlay =\n 'fixed inset-0 z-50 flex items-start justify-center bg-overlay p-4 pt-[12vh] transition-opacity duration-150 data-entering:opacity-0 data-exiting:opacity-0 motion-reduce:transition-none';\nconst modal =\n 'w-full max-w-xl overflow-hidden rounded-xl border border-subtle bg-elevated text-primary shadow-xl';\nconst searchRow =\n 'flex h-control-lg items-center gap-2 border-b border-subtle px-4 data-focus-within:bg-secondary';\nconst searchInput =\n 'min-w-0 flex-1 bg-transparent text-md text-primary outline-none placeholder:text-placeholder [&::-webkit-search-cancel-button]:hidden';\nconst list = 'max-h-[min(24rem,60vh)] overflow-auto p-1 outline-none';\nconst itemIcon = 'inline-flex shrink-0 text-fg-tertiary [&>svg]:size-4';\nconst empty = 'px-4 py-8 text-center text-sm text-tertiary';\nconst pageTitle = 'shrink-0 rounded-sm bg-tertiary px-2 py-0.5 text-xs font-medium text-secondary';\n\n/**\n * A searchable list of commands in a modal, opened with Cmd or Ctrl and K\n * through useCommandPaletteShortcut. Focus starts in the search field, typing\n * filters every group, arrow keys move through matches, Enter runs a command\n * and closes the palette, and Escape closes it. Focus then returns to where it\n * was before opening.\n */\nexport function CommandPalette({\n isOpen,\n onOpenChange,\n onAction,\n closeOnAction = true,\n onSearchChange,\n page,\n onBack,\n backLabel = 'Back',\n label = 'Command palette',\n searchLabel = 'Search commands',\n placeholder = 'Type a command or search',\n emptyState = 'No results',\n children,\n}: CommandPaletteProps) {\n return (\n <ModalOverlay isOpen={isOpen} onOpenChange={onOpenChange} isDismissable className={overlay}>\n <Modal className={modal}>\n <Dialog aria-label={label} className='outline-none'>\n {({ close }) => (\n <>\n <span role='status' className='sr-only'>\n {page?.title}\n </span>\n <CommandSearch\n key={page?.id}\n close={close}\n onAction={onAction}\n closeOnAction={closeOnAction}\n onSearchChange={onSearchChange}\n page={page}\n onBack={onBack}\n backLabel={backLabel}\n searchLabel={searchLabel}\n placeholder={placeholder}\n emptyState={emptyState}\n >\n {children}\n </CommandSearch>\n </>\n )}\n </Dialog>\n </Modal>\n </ModalOverlay>\n );\n}\n\ninterface CommandSearchProps extends Pick<\n CommandPaletteProps,\n | 'onAction'\n | 'onSearchChange'\n | 'page'\n | 'onBack'\n | 'searchLabel'\n | 'placeholder'\n | 'emptyState'\n | 'children'\n> {\n close: () => void;\n closeOnAction: boolean;\n backLabel: string;\n}\n\nfunction CommandSearch({\n close,\n onAction,\n closeOnAction,\n onSearchChange,\n page,\n onBack,\n backLabel,\n searchLabel,\n placeholder,\n emptyState,\n children,\n}: CommandSearchProps) {\n const { contains } = useFilter({ sensitivity: 'base' });\n const inputRef = useRef<HTMLInputElement>(null);\n const [search, setSearch] = useState('');\n\n // The search field, not the dialog, receives focus on open, as in the WAI combobox pattern.\n useEffect(() => {\n inputRef.current?.focus();\n }, []);\n\n function handleAction(key: Key) {\n onAction?.(key);\n if (closeOnAction) close();\n }\n\n function handleSearchChange(value: string) {\n setSearch(value);\n onSearchChange?.(value);\n }\n\n function handleKeyDown(event: ReactKeyboardEvent<HTMLInputElement>) {\n if (event.key !== 'Backspace' || search !== '' || !page) return;\n event.preventDefault();\n onBack?.();\n }\n\n function handleBack() {\n onBack?.();\n }\n\n function renderEmptyState() {\n return <div className={empty}>{emptyState}</div>;\n }\n\n return (\n <Autocomplete filter={contains} inputValue={search} onInputChange={handleSearchChange}>\n <SearchField aria-label={searchLabel} className={searchRow}>\n {page ? (\n <>\n <IconButton\n icon={ArrowLeft}\n aria-label={backLabel}\n variant='tertiary'\n size='sm'\n className='-ml-2 shrink-0'\n onPress={handleBack}\n />\n <span className={pageTitle}>{page.title}</span>\n </>\n ) : (\n <Search aria-hidden='true' className='size-5 shrink-0 text-fg-tertiary' />\n )}\n <Input\n ref={inputRef}\n // A combobox popup is exempt from axe scrollable-region-focusable, and keeps focus in the field.\n role='combobox'\n aria-expanded\n placeholder={placeholder}\n onKeyDown={handleKeyDown}\n className={searchInput}\n />\n </SearchField>\n <Menu onAction={handleAction} renderEmptyState={renderEmptyState} className={list}>\n {children}\n </Menu>\n </Autocomplete>\n );\n}\n\nexport function CommandGroup({ heading, children, className, ...props }: CommandGroupProps) {\n return (\n <MenuSection {...props} className={cx('flex flex-col', className)}>\n <Header className={listSectionHeader}>{heading}</Header>\n {children}\n </MenuSection>\n );\n}\n\nfunction isIconComponent(icon: IconComponent | ReactNode): icon is IconComponent {\n return (\n typeof icon === 'function' ||\n (typeof icon === 'object' && icon !== null && !isValidElement(icon) && '$$typeof' in icon)\n );\n}\n\nfunction renderIcon(icon: IconComponent | ReactNode) {\n if (isIconComponent(icon)) {\n const Icon = icon;\n return <Icon aria-hidden='true' className='size-4 shrink-0 text-fg-tertiary' />;\n }\n if (!icon) return null;\n return (\n <span aria-hidden='true' className={itemIcon}>\n {icon}\n </span>\n );\n}\n\nexport function CommandItem({\n children,\n icon,\n description,\n shortcut,\n className,\n ...props\n}: CommandItemProps) {\n const textValue = props.textValue ?? (typeof children === 'string' ? children : undefined);\n return (\n <MenuItem\n {...props}\n textValue={textValue}\n className={composeRenderProps(className, (consumer) => cx(listItem, consumer))}\n >\n {renderIcon(icon)}\n {description ? (\n <span className='flex min-w-0 flex-1 flex-col'>\n <span className='truncate'>{children}</span>\n <span className='truncate text-xs text-tertiary'>{description}</span>\n </span>\n ) : (\n <Text slot='label' className='min-w-0 flex-1 truncate'>\n {children}\n </Text>\n )}\n {shortcut && <Kbd keys={shortcut} decorative className='ml-4' />}\n </MenuItem>\n );\n}\n"],"mappings":";;;;;;;;;;AAgCA,IAAM,UACJ;AACF,IAAM,QACJ;AACF,IAAM,YACJ;AACF,IAAM,cACJ;AACF,IAAM,OAAO;AACb,IAAM,WAAW;AACjB,IAAM,QAAQ;AACd,IAAM,YAAY;;;;;;;;AASlB,SAAgB,eAAe,EAC7B,QACA,cACA,UACA,gBAAgB,MAChB,gBACA,MACA,QACA,YAAY,QACZ,QAAQ,mBACR,cAAc,mBACd,cAAc,4BACd,aAAa,cACb,YACsB;CACtB,OACE,oBAAC,cAAD;EAAsB;EAAsB;EAAc,eAAA;EAAc,WAAW;EACjF,UAAA,oBAAC,OAAD;GAAO,WAAW;GAChB,UAAA,oBAAC,QAAD;IAAQ,cAAY;IAAO,WAAU;IACjC,WAAA,EAAE,YACF,qBAAAA,UAAA,EAAA,UAAA,CACE,oBAAC,QAAD;KAAM,MAAK;KAAS,WAAU;KAC3B,UAAA,MAAM;IACH,CAAA,GACN,oBAAC,eAAD;KAES;KACG;KACK;KACC;KACV;KACE;KACG;KACE;KACA;KACD;KAEX;IACY,GAbR,MAAM,EAaE,CACf,EAAA,CAAA;GAEE,CAAA;EACH,CAAA;CACK,CAAA;AAElB;AAkBA,SAAS,cAAc,EACrB,OACA,UACA,eACA,gBACA,MACA,QACA,WACA,aACA,aACA,YACA,YACqB;CACrB,MAAM,EAAE,aAAa,UAAU,EAAE,aAAa,OAAO,CAAC;CACtD,MAAM,WAAW,OAAyB,IAAI;CAC9C,MAAM,CAAC,QAAQ,aAAa,SAAS,EAAE;CAGvC,gBAAgB;EACd,SAAS,SAAS,MAAM;CAC1B,GAAG,CAAC,CAAC;CAEL,SAAS,aAAa,KAAU;EAC9B,WAAW,GAAG;EACd,IAAI,eAAe,MAAM;CAC3B;CAEA,SAAS,mBAAmB,OAAe;EACzC,UAAU,KAAK;EACf,iBAAiB,KAAK;CACxB;CAEA,SAAS,cAAc,OAA6C;EAClE,IAAI,MAAM,QAAQ,eAAe,WAAW,MAAM,CAAC,MAAM;EACzD,MAAM,eAAe;EACrB,SAAS;CACX;CAEA,SAAS,aAAa;EACpB,SAAS;CACX;CAEA,SAAS,mBAAmB;EAC1B,OAAO,oBAAC,OAAD;GAAK,WAAW;GAAQ,UAAA;EAAgB,CAAA;CACjD;CAEA,OACE,qBAAC,cAAD;EAAc,QAAQ;EAAU,YAAY;EAAQ,eAAe;EAAnE,UAAA,CACE,qBAAC,aAAD;GAAa,cAAY;GAAa,WAAW;GAAjD,UAAA,CACG,OACC,qBAAAA,UAAA,EAAA,UAAA,CACE,oBAAC,YAAD;IACE,MAAM;IACN,cAAY;IACZ,SAAQ;IACR,MAAK;IACL,WAAU;IACV,SAAS;GACV,CAAA,GACD,oBAAC,QAAD;IAAM,WAAW;IAAY,UAAA,KAAK;GAAY,CAAA,CAC9C,EAAA,CAAA,IAEF,oBAAC,QAAD;IAAQ,eAAY;IAAO,WAAU;GAAoC,CAAA,GAE3E,oBAAC,OAAD;IACE,KAAK;IAEL,MAAK;IACL,iBAAA;IACa;IACb,WAAW;IACX,WAAW;GACZ,CAAA,CACU;EACb,CAAA,GAAA,oBAACC,QAAD;GAAM,UAAU;GAAgC;GAAkB,WAAW;GAC1E;EACG,CAAA,CACM;;AAElB;AAEA,SAAgB,aAAa,EAAE,SAAS,UAAU,WAAW,GAAG,SAA4B;CAC1F,OACE,qBAAC,aAAD;EAAa,GAAI;EAAO,WAAW,GAAG,iBAAiB,SAAS;EAAhE,UAAA,CACE,oBAAC,QAAD;GAAQ,WAAW;GAAoB,UAAA;EAAgB,CAAA,GACtD,QACU;;AAEjB;AAEA,SAAS,gBAAgB,MAAwD;CAC/E,OACE,OAAO,SAAS,cACf,OAAO,SAAS,YAAY,SAAS,QAAQ,CAAC,eAAe,IAAI,KAAK,cAAc;AAEzF;AAEA,SAAS,WAAW,MAAiC;CACnD,IAAI,gBAAgB,IAAI,GAEtB,OAAO,oBAACC,MAAD;EAAM,eAAY;EAAO,WAAU;CAAoC,CAAA;CAEhF,IAAI,CAAC,MAAM,OAAO;CAClB,OACE,oBAAC,QAAD;EAAM,eAAY;EAAO,WAAW;EACjC,UAAA;CACG,CAAA;AAEV;AAEA,SAAgB,YAAY,EAC1B,UACA,MACA,aACA,UACA,WACA,GAAG,SACgB;CACnB,MAAM,YAAY,MAAM,cAAc,OAAO,aAAa,WAAW,WAAW,KAAA;CAChF,OACE,qBAAC,UAAD;EACE,GAAI;EACO;EACX,WAAW,mBAAmB,YAAY,aAAa,GAAG,UAAU,QAAQ,CAAC;EAH/E,UAAA;GAKG,WAAW,IAAI;GACf,cACC,qBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,oBAAC,QAAD;KAAM,WAAU;KAAY;IAAe,CAAA,GAC3C,oBAAC,QAAD;KAAM,WAAU;KAAkC,UAAA;IAAkB,CAAA,CAChE;GAEN,CAAA,IAAA,oBAAC,MAAD;IAAM,MAAK;IAAQ,WAAU;IAC1B;GACG,CAAA;GAEP,YAAY,oBAAC,KAAD;IAAK,MAAM;IAAU,YAAA;IAAW,WAAU;GAAQ,CAAA;EACvD;;AAEd"}
@@ -0,0 +1,2 @@
1
+ export { CommandGroup, CommandItem, CommandPalette, useCommandPaletteShortcut, } from './CommandPalette';
2
+ export type { CommandGroupProps, CommandItemProps, CommandPaletteProps } from './CommandPalette';
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export { CommandGroup, CommandItem, CommandPalette, useCommandPaletteShortcut } from "./CommandPalette.js";
@@ -0,0 +1,25 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type DatePickerProps as AriaDatePickerProps, type DateRangePickerProps as AriaDateRangePickerProps, type DateValue } from 'react-aria-components';
3
+ interface FieldProps {
4
+ /** Visible label. If omitted, pass `aria-label`. */
5
+ label?: ReactNode;
6
+ /** Helper text below the field, linked with aria-describedby. */
7
+ hint?: ReactNode;
8
+ /** Error text. Setting it also marks the field invalid. */
9
+ errorMessage?: string;
10
+ /** Accessible name of the button that opens the calendar. */
11
+ calendarLabel?: string;
12
+ }
13
+ export interface DatePickerProps<T extends DateValue> extends AriaDatePickerProps<T>, FieldProps {
14
+ }
15
+ export interface DateRangePickerProps<T extends DateValue> extends AriaDateRangePickerProps<T>, FieldProps {
16
+ }
17
+ /**
18
+ * A date field with typed segments and a calendar popover. Arrow keys change
19
+ * a segment, typing fills it, and the calendar button opens a month grid where
20
+ * arrow keys move between days and Enter picks one.
21
+ */
22
+ export declare function DatePicker<T extends DateValue>({ label, hint, errorMessage, calendarLabel, isInvalid, className, ...props }: DatePickerProps<T>): import("react").JSX.Element;
23
+ /** Like DatePicker, with a start and an end date and a range calendar. */
24
+ export declare function DateRangePicker<T extends DateValue>({ label, hint, errorMessage, calendarLabel, isInvalid, className, ...props }: DateRangePickerProps<T>): import("react").JSX.Element;
25
+ export {};