@lincyaw/aegis-ui 0.10.0 → 0.12.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 (396) hide show
  1. package/dist/agent/ask/AskPanel.cjs +1 -1
  2. package/dist/agent/ask/AskPanel.cjs.map +1 -1
  3. package/dist/agent/ask/AskPanel.d.ts +5 -0
  4. package/dist/agent/ask/AskPanel.js +105 -98
  5. package/dist/agent/ask/AskPanel.js.map +1 -1
  6. package/dist/commands/commandContext.cjs.map +1 -1
  7. package/dist/commands/commandContext.d.ts +4 -1
  8. package/dist/commands/commandContext.js.map +1 -1
  9. package/dist/components/ui/AgentPanel.cjs +1 -1
  10. package/dist/components/ui/AgentPanel.cjs.map +1 -1
  11. package/dist/components/ui/AgentPanel.js +15 -14
  12. package/dist/components/ui/AgentPanel.js.map +1 -1
  13. package/dist/components/ui/Avatar.cjs +1 -1
  14. package/dist/components/ui/Avatar.cjs.map +1 -1
  15. package/dist/components/ui/Avatar.js +21 -19
  16. package/dist/components/ui/Avatar.js.map +1 -1
  17. package/dist/components/ui/BlastRadiusBar.cjs +1 -1
  18. package/dist/components/ui/BlastRadiusBar.cjs.map +1 -1
  19. package/dist/components/ui/BlastRadiusBar.d.ts +16 -4
  20. package/dist/components/ui/BlastRadiusBar.js +27 -23
  21. package/dist/components/ui/BlastRadiusBar.js.map +1 -1
  22. package/dist/components/ui/Button.cjs.map +1 -1
  23. package/dist/components/ui/Button.d.ts +4 -2
  24. package/dist/components/ui/Button.js.map +1 -1
  25. package/dist/components/ui/ChatComposer.cjs +1 -1
  26. package/dist/components/ui/ChatComposer.cjs.map +1 -1
  27. package/dist/components/ui/ChatComposer.js +32 -31
  28. package/dist/components/ui/ChatComposer.js.map +1 -1
  29. package/dist/components/ui/ChatSessionList.cjs +1 -1
  30. package/dist/components/ui/ChatSessionList.cjs.map +1 -1
  31. package/dist/components/ui/ChatSessionList.js +68 -66
  32. package/dist/components/ui/ChatSessionList.js.map +1 -1
  33. package/dist/components/ui/CheckGrid.cjs +1 -1
  34. package/dist/components/ui/CheckGrid.cjs.map +1 -1
  35. package/dist/components/ui/CheckGrid.js +18 -17
  36. package/dist/components/ui/CheckGrid.js.map +1 -1
  37. package/dist/components/ui/Checkbox.cjs +1 -1
  38. package/dist/components/ui/Checkbox.cjs.map +1 -1
  39. package/dist/components/ui/Checkbox.d.ts +6 -2
  40. package/dist/components/ui/Checkbox.js +21 -17
  41. package/dist/components/ui/Checkbox.js.map +1 -1
  42. package/dist/components/ui/ChoiceCardGroup.cjs +1 -1
  43. package/dist/components/ui/ChoiceCardGroup.cjs.map +1 -1
  44. package/dist/components/ui/ChoiceCardGroup.d.ts +13 -4
  45. package/dist/components/ui/ChoiceCardGroup.js +47 -35
  46. package/dist/components/ui/ChoiceCardGroup.js.map +1 -1
  47. package/dist/components/ui/CodeEditor.cjs +1 -1
  48. package/dist/components/ui/CodeEditor.cjs.map +1 -1
  49. package/dist/components/ui/CodeEditor.d.ts +11 -1
  50. package/dist/components/ui/CodeEditor.js +108 -74
  51. package/dist/components/ui/CodeEditor.js.map +1 -1
  52. package/dist/components/ui/CommandInvocationCard.cjs +1 -1
  53. package/dist/components/ui/CommandInvocationCard.cjs.map +1 -1
  54. package/dist/components/ui/CommandInvocationCard.js +23 -26
  55. package/dist/components/ui/CommandInvocationCard.js.map +1 -1
  56. package/dist/components/ui/CommandPalette.cjs +1 -1
  57. package/dist/components/ui/CommandPalette.cjs.map +1 -1
  58. package/dist/components/ui/CommandPalette.d.ts +3 -3
  59. package/dist/components/ui/CommandPalette.js +75 -75
  60. package/dist/components/ui/CommandPalette.js.map +1 -1
  61. package/dist/components/ui/CommitGraph.cjs +1 -1
  62. package/dist/components/ui/CommitGraph.cjs.map +1 -1
  63. package/dist/components/ui/CommitGraph.d.ts +3 -1
  64. package/dist/components/ui/CommitGraph.js +77 -74
  65. package/dist/components/ui/CommitGraph.js.map +1 -1
  66. package/dist/components/ui/ContentInspectorDialog.cjs +1 -1
  67. package/dist/components/ui/ContentInspectorDialog.cjs.map +1 -1
  68. package/dist/components/ui/ContentInspectorDialog.js +25 -31
  69. package/dist/components/ui/ContentInspectorDialog.js.map +1 -1
  70. package/dist/components/ui/ContentPreview.cjs +2 -2
  71. package/dist/components/ui/ContentPreview.cjs.map +1 -1
  72. package/dist/components/ui/ContentPreview.js +55 -56
  73. package/dist/components/ui/ContentPreview.js.map +1 -1
  74. package/dist/components/ui/DangerZone.cjs +1 -1
  75. package/dist/components/ui/DangerZone.cjs.map +1 -1
  76. package/dist/components/ui/DangerZone.js +9 -8
  77. package/dist/components/ui/DangerZone.js.map +1 -1
  78. package/dist/components/ui/DataList.cjs +1 -1
  79. package/dist/components/ui/DataList.cjs.map +1 -1
  80. package/dist/components/ui/DataList.js +27 -25
  81. package/dist/components/ui/DataList.js.map +1 -1
  82. package/dist/components/ui/DataTable.cjs +1 -1
  83. package/dist/components/ui/DataTable.cjs.map +1 -1
  84. package/dist/components/ui/DataTable.d.ts +2 -1
  85. package/dist/components/ui/DataTable.js +141 -124
  86. package/dist/components/ui/DataTable.js.map +1 -1
  87. package/dist/components/ui/DiffViewer.cjs +1 -1
  88. package/dist/components/ui/DiffViewer.cjs.map +1 -1
  89. package/dist/components/ui/DiffViewer.js +29 -25
  90. package/dist/components/ui/DiffViewer.js.map +1 -1
  91. package/dist/components/ui/DropdownMenu.cjs +1 -1
  92. package/dist/components/ui/DropdownMenu.cjs.map +1 -1
  93. package/dist/components/ui/DropdownMenu.d.ts +1 -0
  94. package/dist/components/ui/DropdownMenu.js +41 -40
  95. package/dist/components/ui/DropdownMenu.js.map +1 -1
  96. package/dist/components/ui/EnvironmentSwitcher.cjs +1 -1
  97. package/dist/components/ui/EnvironmentSwitcher.cjs.map +1 -1
  98. package/dist/components/ui/EnvironmentSwitcher.js +26 -24
  99. package/dist/components/ui/EnvironmentSwitcher.js.map +1 -1
  100. package/dist/components/ui/EventTable.cjs +1 -1
  101. package/dist/components/ui/EventTable.cjs.map +1 -1
  102. package/dist/components/ui/EventTable.js +60 -53
  103. package/dist/components/ui/EventTable.js.map +1 -1
  104. package/dist/components/ui/FileDropzone.cjs +1 -1
  105. package/dist/components/ui/FileDropzone.cjs.map +1 -1
  106. package/dist/components/ui/FileDropzone.js +40 -42
  107. package/dist/components/ui/FileDropzone.js.map +1 -1
  108. package/dist/components/ui/FilePreview.cjs +1 -1
  109. package/dist/components/ui/FilePreview.cjs.map +1 -1
  110. package/dist/components/ui/FilePreview.js +63 -61
  111. package/dist/components/ui/FilePreview.js.map +1 -1
  112. package/dist/components/ui/FolderDropzone.cjs +1 -1
  113. package/dist/components/ui/FolderDropzone.cjs.map +1 -1
  114. package/dist/components/ui/FolderDropzone.js +114 -84
  115. package/dist/components/ui/FolderDropzone.js.map +1 -1
  116. package/dist/components/ui/ForgotPasswordForm.cjs +1 -1
  117. package/dist/components/ui/ForgotPasswordForm.cjs.map +1 -1
  118. package/dist/components/ui/ForgotPasswordForm.js +22 -21
  119. package/dist/components/ui/ForgotPasswordForm.js.map +1 -1
  120. package/dist/components/ui/FormRow.cjs +1 -1
  121. package/dist/components/ui/FormRow.cjs.map +1 -1
  122. package/dist/components/ui/FormRow.d.ts +32 -11
  123. package/dist/components/ui/FormRow.js +24 -15
  124. package/dist/components/ui/FormRow.js.map +1 -1
  125. package/dist/components/ui/InboxPage.cjs +1 -1
  126. package/dist/components/ui/InboxPage.cjs.map +1 -1
  127. package/dist/components/ui/InboxPage.d.ts +12 -3
  128. package/dist/components/ui/InboxPage.js +91 -77
  129. package/dist/components/ui/InboxPage.js.map +1 -1
  130. package/dist/components/ui/LoginForm.cjs +1 -1
  131. package/dist/components/ui/LoginForm.cjs.map +1 -1
  132. package/dist/components/ui/LoginForm.js +43 -43
  133. package/dist/components/ui/LoginForm.js.map +1 -1
  134. package/dist/components/ui/MonoValue.cjs +1 -1
  135. package/dist/components/ui/MonoValue.cjs.map +1 -1
  136. package/dist/components/ui/MonoValue.d.ts +5 -1
  137. package/dist/components/ui/MonoValue.js +17 -17
  138. package/dist/components/ui/MonoValue.js.map +1 -1
  139. package/dist/components/ui/NotificationBell.cjs +1 -1
  140. package/dist/components/ui/NotificationBell.cjs.map +1 -1
  141. package/dist/components/ui/NotificationBell.d.ts +17 -1
  142. package/dist/components/ui/NotificationBell.js +129 -75
  143. package/dist/components/ui/NotificationBell.js.map +1 -1
  144. package/dist/components/ui/NumberField.cjs +1 -1
  145. package/dist/components/ui/NumberField.cjs.map +1 -1
  146. package/dist/components/ui/NumberField.d.ts +3 -1
  147. package/dist/components/ui/NumberField.js +52 -49
  148. package/dist/components/ui/NumberField.js.map +1 -1
  149. package/dist/components/ui/ObjectBrowser.cjs +1 -1
  150. package/dist/components/ui/ObjectBrowser.cjs.map +1 -1
  151. package/dist/components/ui/ObjectBrowser.js +83 -78
  152. package/dist/components/ui/ObjectBrowser.js.map +1 -1
  153. package/dist/components/ui/PageSizeSelect.cjs +1 -1
  154. package/dist/components/ui/PageSizeSelect.cjs.map +1 -1
  155. package/dist/components/ui/PageSizeSelect.js +30 -29
  156. package/dist/components/ui/PageSizeSelect.js.map +1 -1
  157. package/dist/components/ui/Panel.cjs.map +1 -1
  158. package/dist/components/ui/Panel.d.ts +5 -2
  159. package/dist/components/ui/Panel.js.map +1 -1
  160. package/dist/components/ui/ParetoChart.cjs +1 -1
  161. package/dist/components/ui/ParetoChart.cjs.map +1 -1
  162. package/dist/components/ui/ParetoChart.js +247 -212
  163. package/dist/components/ui/ParetoChart.js.map +1 -1
  164. package/dist/components/ui/ParquetViewer.cjs +1 -1
  165. package/dist/components/ui/ParquetViewer.cjs.map +1 -1
  166. package/dist/components/ui/ParquetViewer.js +69 -74
  167. package/dist/components/ui/ParquetViewer.js.map +1 -1
  168. package/dist/components/ui/PasswordField.cjs +1 -1
  169. package/dist/components/ui/PasswordField.cjs.map +1 -1
  170. package/dist/components/ui/PasswordField.js +28 -27
  171. package/dist/components/ui/PasswordField.js.map +1 -1
  172. package/dist/components/ui/PickerField.cjs +1 -1
  173. package/dist/components/ui/PickerField.cjs.map +1 -1
  174. package/dist/components/ui/PickerField.d.ts +25 -6
  175. package/dist/components/ui/PickerField.js +20 -17
  176. package/dist/components/ui/PickerField.js.map +1 -1
  177. package/dist/components/ui/ProjectSelector.cjs +1 -1
  178. package/dist/components/ui/ProjectSelector.cjs.map +1 -1
  179. package/dist/components/ui/ProjectSelector.js +40 -37
  180. package/dist/components/ui/ProjectSelector.js.map +1 -1
  181. package/dist/components/ui/QueryAutocomplete.cjs +1 -1
  182. package/dist/components/ui/QueryAutocomplete.cjs.map +1 -1
  183. package/dist/components/ui/QueryAutocomplete.d.ts +11 -2
  184. package/dist/components/ui/QueryAutocomplete.js +146 -126
  185. package/dist/components/ui/QueryAutocomplete.js.map +1 -1
  186. package/dist/components/ui/RankBar.cjs +1 -1
  187. package/dist/components/ui/RankBar.cjs.map +1 -1
  188. package/dist/components/ui/RankBar.js +9 -9
  189. package/dist/components/ui/RankBar.js.map +1 -1
  190. package/dist/components/ui/RegisterForm.cjs +1 -1
  191. package/dist/components/ui/RegisterForm.cjs.map +1 -1
  192. package/dist/components/ui/RegisterForm.js +41 -40
  193. package/dist/components/ui/RegisterForm.js.map +1 -1
  194. package/dist/components/ui/ReplayStepStrip.cjs +1 -1
  195. package/dist/components/ui/ReplayStepStrip.cjs.map +1 -1
  196. package/dist/components/ui/ReplayStepStrip.d.ts +6 -3
  197. package/dist/components/ui/ReplayStepStrip.js +71 -61
  198. package/dist/components/ui/ReplayStepStrip.js.map +1 -1
  199. package/dist/components/ui/ResizableSidePanel.cjs +1 -1
  200. package/dist/components/ui/ResizableSidePanel.cjs.map +1 -1
  201. package/dist/components/ui/ResizableSidePanel.js +41 -40
  202. package/dist/components/ui/ResizableSidePanel.js.map +1 -1
  203. package/dist/components/ui/SavedQueryBar.cjs +1 -1
  204. package/dist/components/ui/SavedQueryBar.cjs.map +1 -1
  205. package/dist/components/ui/SavedQueryBar.d.ts +1 -1
  206. package/dist/components/ui/SavedQueryBar.js +375 -277
  207. package/dist/components/ui/SavedQueryBar.js.map +1 -1
  208. package/dist/components/ui/SearchInput.cjs +1 -1
  209. package/dist/components/ui/SearchInput.cjs.map +1 -1
  210. package/dist/components/ui/SearchInput.d.ts +5 -1
  211. package/dist/components/ui/SearchInput.js +28 -24
  212. package/dist/components/ui/SearchInput.js.map +1 -1
  213. package/dist/components/ui/Select.cjs +1 -1
  214. package/dist/components/ui/Select.cjs.map +1 -1
  215. package/dist/components/ui/Select.d.ts +3 -1
  216. package/dist/components/ui/Select.js +21 -19
  217. package/dist/components/ui/Select.js.map +1 -1
  218. package/dist/components/ui/ServiceMap.cjs +1 -1
  219. package/dist/components/ui/ServiceMap.cjs.map +1 -1
  220. package/dist/components/ui/ServiceMap.d.ts +18 -4
  221. package/dist/components/ui/ServiceMap.js +353 -228
  222. package/dist/components/ui/ServiceMap.js.map +1 -1
  223. package/dist/components/ui/Slider.cjs +1 -1
  224. package/dist/components/ui/Slider.cjs.map +1 -1
  225. package/dist/components/ui/Slider.d.ts +3 -1
  226. package/dist/components/ui/Slider.js +11 -9
  227. package/dist/components/ui/Slider.js.map +1 -1
  228. package/dist/components/ui/SparkLine.cjs +1 -1
  229. package/dist/components/ui/SparkLine.cjs.map +1 -1
  230. package/dist/components/ui/SparkLine.d.ts +5 -2
  231. package/dist/components/ui/SparkLine.js +36 -31
  232. package/dist/components/ui/SparkLine.js.map +1 -1
  233. package/dist/components/ui/Steps.cjs +1 -1
  234. package/dist/components/ui/Steps.cjs.map +1 -1
  235. package/dist/components/ui/Steps.js +25 -29
  236. package/dist/components/ui/Steps.js.map +1 -1
  237. package/dist/components/ui/TableOfContents.cjs +1 -1
  238. package/dist/components/ui/TableOfContents.cjs.map +1 -1
  239. package/dist/components/ui/TableOfContents.js +16 -19
  240. package/dist/components/ui/TableOfContents.js.map +1 -1
  241. package/dist/components/ui/Tabs.cjs +2 -2
  242. package/dist/components/ui/Tabs.cjs.map +1 -1
  243. package/dist/components/ui/Tabs.js +107 -87
  244. package/dist/components/ui/Tabs.js.map +1 -1
  245. package/dist/components/ui/Terminal.cjs +1 -1
  246. package/dist/components/ui/Terminal.cjs.map +1 -1
  247. package/dist/components/ui/Terminal.js +18 -17
  248. package/dist/components/ui/Terminal.js.map +1 -1
  249. package/dist/components/ui/TextField.cjs +1 -1
  250. package/dist/components/ui/TextField.cjs.map +1 -1
  251. package/dist/components/ui/TextField.js +6 -6
  252. package/dist/components/ui/TextField.js.map +1 -1
  253. package/dist/components/ui/ThemeToggle.cjs +1 -1
  254. package/dist/components/ui/ThemeToggle.cjs.map +1 -1
  255. package/dist/components/ui/ThemeToggle.js +15 -18
  256. package/dist/components/ui/ThemeToggle.js.map +1 -1
  257. package/dist/components/ui/TimeDisplay.cjs +1 -1
  258. package/dist/components/ui/TimeDisplay.cjs.map +1 -1
  259. package/dist/components/ui/TimeDisplay.js +12 -12
  260. package/dist/components/ui/TimeDisplay.js.map +1 -1
  261. package/dist/components/ui/TimeRangePicker.cjs +1 -1
  262. package/dist/components/ui/TimeRangePicker.cjs.map +1 -1
  263. package/dist/components/ui/TimeRangePicker.d.ts +12 -1
  264. package/dist/components/ui/TimeRangePicker.js +136 -113
  265. package/dist/components/ui/TimeRangePicker.js.map +1 -1
  266. package/dist/components/ui/Timeline.cjs.map +1 -1
  267. package/dist/components/ui/Timeline.d.ts +4 -4
  268. package/dist/components/ui/Timeline.js.map +1 -1
  269. package/dist/components/ui/TimelineChart.cjs +2 -2
  270. package/dist/components/ui/TimelineChart.cjs.map +1 -1
  271. package/dist/components/ui/TimelineChart.d.ts +1 -0
  272. package/dist/components/ui/TimelineChart.js +131 -137
  273. package/dist/components/ui/TimelineChart.js.map +1 -1
  274. package/dist/components/ui/TraceSpanInspector.cjs +1 -1
  275. package/dist/components/ui/TraceSpanInspector.cjs.map +1 -1
  276. package/dist/components/ui/TraceSpanInspector.js +43 -46
  277. package/dist/components/ui/TraceSpanInspector.js.map +1 -1
  278. package/dist/components/ui/TraceTree.cjs +1 -1
  279. package/dist/components/ui/TraceTree.cjs.map +1 -1
  280. package/dist/components/ui/TraceTree.d.ts +5 -1
  281. package/dist/components/ui/TraceTree.js +98 -97
  282. package/dist/components/ui/TraceTree.js.map +1 -1
  283. package/dist/components/ui/TrajectoryStep.cjs +2 -1
  284. package/dist/components/ui/TrajectoryStep.cjs.map +1 -1
  285. package/dist/components/ui/TrajectoryStep.js +64 -43
  286. package/dist/components/ui/TrajectoryStep.js.map +1 -1
  287. package/dist/components/ui/UploadQueue.cjs +1 -1
  288. package/dist/components/ui/UploadQueue.cjs.map +1 -1
  289. package/dist/components/ui/UploadQueue.js +59 -70
  290. package/dist/components/ui/UploadQueue.js.map +1 -1
  291. package/dist/components/ui/authValidation.cjs +1 -1
  292. package/dist/components/ui/authValidation.cjs.map +1 -1
  293. package/dist/components/ui/authValidation.d.ts +2 -2
  294. package/dist/components/ui/authValidation.js +4 -5
  295. package/dist/components/ui/authValidation.js.map +1 -1
  296. package/dist/components/ui/classifyContent.cjs +3 -3
  297. package/dist/components/ui/classifyContent.cjs.map +1 -1
  298. package/dist/components/ui/classifyContent.d.ts +2 -1
  299. package/dist/components/ui/classifyContent.js +52 -54
  300. package/dist/components/ui/classifyContent.js.map +1 -1
  301. package/dist/components/ui/relativeTime.cjs +1 -1
  302. package/dist/components/ui/relativeTime.cjs.map +1 -1
  303. package/dist/components/ui/relativeTime.d.ts +5 -3
  304. package/dist/components/ui/relativeTime.js +15 -6
  305. package/dist/components/ui/relativeTime.js.map +1 -1
  306. package/dist/components/ui/useColumnWidths.cjs +1 -1
  307. package/dist/components/ui/useColumnWidths.cjs.map +1 -1
  308. package/dist/components/ui/useColumnWidths.d.ts +6 -1
  309. package/dist/components/ui/useColumnWidths.js +139 -123
  310. package/dist/components/ui/useColumnWidths.js.map +1 -1
  311. package/dist/hooks/popoverOverflow.cjs +2 -0
  312. package/dist/hooks/popoverOverflow.cjs.map +1 -0
  313. package/dist/hooks/popoverOverflow.d.ts +8 -0
  314. package/dist/hooks/popoverOverflow.js +9 -0
  315. package/dist/hooks/popoverOverflow.js.map +1 -0
  316. package/dist/hooks/useDialogPopover.cjs +2 -0
  317. package/dist/hooks/useDialogPopover.cjs.map +1 -0
  318. package/dist/hooks/useDialogPopover.d.ts +23 -0
  319. package/dist/hooks/useDialogPopover.js +48 -0
  320. package/dist/hooks/useDialogPopover.js.map +1 -0
  321. package/dist/hooks/useMenuPopover.cjs +1 -1
  322. package/dist/hooks/useMenuPopover.cjs.map +1 -1
  323. package/dist/hooks/useMenuPopover.d.ts +0 -8
  324. package/dist/hooks/useMenuPopover.js +17 -22
  325. package/dist/hooks/useMenuPopover.js.map +1 -1
  326. package/dist/hooks/useSavedQueries.cjs +1 -1
  327. package/dist/hooks/useSavedQueries.cjs.map +1 -1
  328. package/dist/hooks/useSavedQueries.js +29 -28
  329. package/dist/hooks/useSavedQueries.js.map +1 -1
  330. package/dist/index.d.ts +1 -1
  331. package/dist/layouts/shell/AegisShell.cjs +1 -1
  332. package/dist/layouts/shell/AegisShell.cjs.map +1 -1
  333. package/dist/layouts/shell/AegisShell.js +58 -59
  334. package/dist/layouts/shell/AegisShell.js.map +1 -1
  335. package/dist/layouts/shell/AppSwitcher.cjs +1 -1
  336. package/dist/layouts/shell/AppSwitcher.cjs.map +1 -1
  337. package/dist/layouts/shell/AppSwitcher.js +53 -36
  338. package/dist/layouts/shell/AppSwitcher.js.map +1 -1
  339. package/dist/layouts/shell/AuthRequiredCard.cjs +1 -1
  340. package/dist/layouts/shell/AuthRequiredCard.cjs.map +1 -1
  341. package/dist/layouts/shell/AuthRequiredCard.js +24 -22
  342. package/dist/layouts/shell/AuthRequiredCard.js.map +1 -1
  343. package/dist/layouts/shell/RouteErrorBoundary.cjs +1 -1
  344. package/dist/layouts/shell/RouteErrorBoundary.cjs.map +1 -1
  345. package/dist/layouts/shell/RouteErrorBoundary.d.ts +4 -1
  346. package/dist/layouts/shell/RouteErrorBoundary.js +15 -10
  347. package/dist/layouts/shell/RouteErrorBoundary.js.map +1 -1
  348. package/dist/layouts/shell/ShellInboxPage.cjs +1 -1
  349. package/dist/layouts/shell/ShellInboxPage.cjs.map +1 -1
  350. package/dist/layouts/shell/ShellInboxPage.js +17 -16
  351. package/dist/layouts/shell/ShellInboxPage.js.map +1 -1
  352. package/dist/layouts/shell/ShellNotificationBell.cjs +1 -1
  353. package/dist/layouts/shell/ShellNotificationBell.cjs.map +1 -1
  354. package/dist/layouts/shell/ShellNotificationBell.js +20 -14
  355. package/dist/layouts/shell/ShellNotificationBell.js.map +1 -1
  356. package/dist/layouts/shell/TopHeader.cjs +1 -1
  357. package/dist/layouts/shell/TopHeader.cjs.map +1 -1
  358. package/dist/layouts/shell/TopHeader.js +74 -74
  359. package/dist/layouts/shell/TopHeader.js.map +1 -1
  360. package/dist/layouts/shell/useShellUser.cjs +1 -1
  361. package/dist/layouts/shell/useShellUser.cjs.map +1 -1
  362. package/dist/layouts/shell/useShellUser.js +15 -13
  363. package/dist/layouts/shell/useShellUser.js.map +1 -1
  364. package/dist/lib/breakAtSeparators.cjs +2 -0
  365. package/dist/lib/breakAtSeparators.cjs.map +1 -0
  366. package/dist/lib/breakAtSeparators.d.ts +6 -0
  367. package/dist/lib/breakAtSeparators.js +10 -0
  368. package/dist/lib/breakAtSeparators.js.map +1 -0
  369. package/dist/lib/chart.cjs +1 -1
  370. package/dist/lib/chart.cjs.map +1 -1
  371. package/dist/lib/chart.d.ts +5 -7
  372. package/dist/lib/chart.js +49 -34
  373. package/dist/lib/chart.js.map +1 -1
  374. package/dist/lib/timeRange.cjs +1 -1
  375. package/dist/lib/timeRange.cjs.map +1 -1
  376. package/dist/lib/timeRange.d.ts +14 -4
  377. package/dist/lib/timeRange.js +41 -40
  378. package/dist/lib/timeRange.js.map +1 -1
  379. package/dist/locale/strings.cjs +1 -1
  380. package/dist/locale/strings.cjs.map +1 -1
  381. package/dist/locale/strings.d.ts +247 -2
  382. package/dist/locale/strings.js +562 -37
  383. package/dist/locale/strings.js.map +1 -1
  384. package/dist/notifications/notificationContext.cjs.map +1 -1
  385. package/dist/notifications/notificationContext.d.ts +12 -2
  386. package/dist/notifications/notificationContext.js.map +1 -1
  387. package/dist/style.css +1 -1
  388. package/dist/theme/antdTheme.cjs +1 -1
  389. package/dist/theme/antdTheme.cjs.map +1 -1
  390. package/dist/theme/antdTheme.js +52 -29
  391. package/dist/theme/antdTheme.js.map +1 -1
  392. package/dist/transports/agentm/AgentmChannelProvider.cjs +1 -1
  393. package/dist/transports/agentm/AgentmChannelProvider.cjs.map +1 -1
  394. package/dist/transports/agentm/AgentmChannelProvider.js +66 -61
  395. package/dist/transports/agentm/AgentmChannelProvider.js.map +1 -1
  396. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MonoValue.js","sources":["../../../src/components/ui/MonoValue.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useRef } from 'react';\n\nimport {\n type PrimitiveSurface,\n usePrimitiveSurface,\n} from '../../agent/core/usePrimitiveSurface';\nimport './MonoValue.css';\n\nexport type MonoValueSurface = PrimitiveSurface<ReactNode>;\n\ninterface MonoValueProps {\n children: ReactNode;\n size?: 'sm' | 'base' | 'lg';\n weight?: 'regular' | 'medium';\n /** Ink colour. `danger` is the anomaly red — failures only. */\n tone?: 'default' | 'success' | 'danger' | 'muted';\n inverted?: boolean;\n /** Break the value at any character, so a long id such as a digest fits a narrow column. */\n wrap?: boolean;\n as?: 'span' | 'div';\n className?: string;\n style?: CSSProperties;\n surface?: MonoValueSurface;\n}\n\n/**\n * An id, a path or a piece of code in the mono face. Numbers, durations and\n * times are not set in it: they take the numeric face (`--font-numeric`) with\n * tabular figures.\n */\nexport function MonoValue({\n children,\n size = 'base',\n weight = 'medium',\n tone = 'default',\n inverted = false,\n wrap = false,\n as: Tag = 'span',\n className,\n style,\n surface,\n}: MonoValueProps) {\n const wrapRef = useRef<HTMLDivElement | null>(null);\n const agentAttrs = usePrimitiveSurface(surface, children, 'value', wrapRef);\n const cls = [\n 'aegis-mono',\n `aegis-mono--${size}`,\n `aegis-mono--${weight}`,\n tone === 'default' ? '' : `aegis-mono--${tone}`,\n inverted ? 'aegis-mono--inverted' : '',\n wrap ? 'aegis-mono--wrap' : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n return (\n <Tag ref={wrapRef} className={cls} style={style} {...agentAttrs}>\n {children}\n </Tag>\n );\n}\n"],"names":["MonoValue","children","size","weight","tone","inverted","wrap","Tag","className","style","surface","wrapRef","useRef","agentAttrs","usePrimitiveSurface","cls","jsx"],"mappings":";;;;AA8BO,SAASA,EAAU;AAAA,EACxB,UAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,QAAAC,IAAS;AAAA,EACT,MAAAC,IAAO;AAAA,EACP,UAAAC,IAAW;AAAA,EACX,MAAAC,IAAO;AAAA,EACP,IAAIC,IAAM;AAAA,EACV,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AACF,GAAmB;AACjB,QAAMC,IAAUC,EAA8B,IAAI,GAC5CC,IAAaC,EAAoBJ,GAAST,GAAU,SAASU,CAAO,GACpEI,IAAM;AAAA,IACV;AAAA,IACA,eAAeb,CAAI;AAAA,IACnB,eAAeC,CAAM;AAAA,IACrBC,MAAS,YAAY,KAAK,eAAeA,CAAI;AAAA,IAC7CC,IAAW,yBAAyB;AAAA,IACpCC,IAAO,qBAAqB;AAAA,IAC5BE,KAAa;AAAA,EAAA,EAEZ,OAAO,OAAO,EACd,KAAK,GAAG;AACX,SACE,gBAAAQ,EAACT,KAAI,KAAKI,GAAS,WAAWI,GAAK,OAAAN,GAAe,GAAGI,GAClD,UAAAZ,EAAA,CACH;AAEJ;"}
1
+ {"version":3,"file":"MonoValue.js","sources":["../../../src/components/ui/MonoValue.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useRef } from 'react';\n\nimport {\n type PrimitiveSurface,\n usePrimitiveSurface,\n} from '../../agent/core/usePrimitiveSurface';\nimport './MonoValue.css';\n\nexport type MonoValueSurface = PrimitiveSurface<ReactNode>;\n\ninterface MonoValueProps {\n children: ReactNode;\n size?: 'sm' | 'base' | 'lg';\n weight?: 'regular' | 'medium';\n /** Ink colour. `danger` is the anomaly red — failures only. */\n tone?: 'default' | 'success' | 'danger' | 'muted';\n inverted?: boolean;\n /**\n * Break a long value at any character, so an id such as a digest fits a\n * narrow column. A text or number value is never broken narrower than\n * itself or 16 characters, whichever is less, so `null` and `1` stay whole.\n */\n wrap?: boolean;\n as?: 'span' | 'div';\n className?: string;\n style?: CSSProperties;\n surface?: MonoValueSurface;\n}\n\n/**\n * An id, a path or a piece of code in the mono face. Numbers, durations and\n * times are not set in it: they take the numeric face (`--font-numeric`) with\n * tabular figures.\n */\nexport function MonoValue({\n children,\n size = 'base',\n weight = 'medium',\n tone = 'default',\n inverted = false,\n wrap = false,\n as: Tag = 'span',\n className,\n style,\n surface,\n}: MonoValueProps) {\n const wrapRef = useRef<HTMLDivElement | null>(null);\n const agentAttrs = usePrimitiveSurface(surface, children, 'value', wrapRef);\n const cls = [\n 'aegis-mono',\n `aegis-mono--${size}`,\n `aegis-mono--${weight}`,\n tone === 'default' ? '' : `aegis-mono--${tone}`,\n inverted ? 'aegis-mono--inverted' : '',\n wrap ? 'aegis-mono--wrap' : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n const length =\n typeof children === 'string' || typeof children === 'number'\n ? String(children).length\n : undefined;\n const lengthStyle =\n wrap && length !== undefined\n ? ({ '--aegis-mono-length': length, ...style } as CSSProperties)\n : style;\n return (\n <Tag ref={wrapRef} className={cls} style={lengthStyle} {...agentAttrs}>\n {children}\n </Tag>\n );\n}\n"],"names":["MonoValue","children","size","weight","tone","inverted","wrap","Tag","className","style","surface","wrapRef","useRef","agentAttrs","usePrimitiveSurface","cls","length","lengthStyle","jsx"],"mappings":";;;;AAkCO,SAASA,EAAU;AAAA,EACxB,UAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,QAAAC,IAAS;AAAA,EACT,MAAAC,IAAO;AAAA,EACP,UAAAC,IAAW;AAAA,EACX,MAAAC,IAAO;AAAA,EACP,IAAIC,IAAM;AAAA,EACV,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AACF,GAAmB;AACjB,QAAMC,IAAUC,EAA8B,IAAI,GAC5CC,IAAaC,EAAoBJ,GAAST,GAAU,SAASU,CAAO,GACpEI,IAAM;AAAA,IACV;AAAA,IACA,eAAeb,CAAI;AAAA,IACnB,eAAeC,CAAM;AAAA,IACrBC,MAAS,YAAY,KAAK,eAAeA,CAAI;AAAA,IAC7CC,IAAW,yBAAyB;AAAA,IACpCC,IAAO,qBAAqB;AAAA,IAC5BE,KAAa;AAAA,EAAA,EAEZ,OAAO,OAAO,EACd,KAAK,GAAG,GACLQ,IACJ,OAAOf,KAAa,YAAY,OAAOA,KAAa,WAChD,OAAOA,CAAQ,EAAE,SACjB,QACAgB,IACJX,KAAQU,MAAW,SACd,EAAE,uBAAuBA,GAAQ,GAAGP,EAAA,IACrCA;AACN,SACE,gBAAAS,EAACX,GAAA,EAAI,KAAKI,GAAS,WAAWI,GAAK,OAAOE,GAAc,GAAGJ,GACxD,UAAAZ,EAAA,CACH;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),h=require("@ant-design/icons"),N=require("antd"),j=require("../../agent/core/hooks.cjs");;/* empty css */const u=require("./linkComponent.cjs"),x=require("./relativeTime.cjs"),b=8,v=360;function y({items:t,unreadCount:s=t.filter(o=>!o.read).length,onOpen:c,inboxPath:r,linkComponent:p=u.DefaultLink,width:d=v,action:a}){const[o,n]=m.useState(!1),_=j.useAegisAction(a),l=t.slice(0,b),f=i=>{n(!1),c?.(i)},g=e.jsxs("div",{className:"aegis-notif-pop",style:{width:d},children:[e.jsxs("div",{className:"aegis-notif-pop__head",children:[e.jsx("span",{className:"aegis-notif-pop__title",children:"Notifications"}),s>0&&e.jsxs("span",{className:"aegis-notif-pop__count",children:[s," unread"]})]}),l.length===0?e.jsx("div",{className:"aegis-notif-pop__empty",children:"You're all caught up."}):e.jsx("ul",{className:"aegis-notif-pop__list",children:l.map(i=>e.jsx("li",{className:"aegis-notif-pop__item-wrap",children:e.jsxs("button",{type:"button",className:["aegis-notif-pop__item",i.read?"":"aegis-notif-pop__item--unread"].filter(Boolean).join(" "),onClick:()=>{f(i)},children:[e.jsx("span",{className:"aegis-notif-pop__dot","aria-hidden":"true","data-unread":!i.read}),e.jsxs("span",{className:"aegis-notif-pop__body",children:[e.jsxs("span",{className:"aegis-notif-pop__row",children:[e.jsx("span",{className:"aegis-notif-pop__item-title",children:i.title}),e.jsx("span",{className:"aegis-notif-pop__time",children:x.relativeTime(i.timestamp)})]}),i.body&&e.jsx("span",{className:"aegis-notif-pop__item-body",children:i.body})]})]})},i.id))}),e.jsx("div",{className:"aegis-notif-pop__foot",onClickCapture:()=>{n(!1)},children:e.jsx(p,{to:r,className:"aegis-notif-pop__view-all",children:"View all"})})]});return e.jsx(N.Popover,{content:g,trigger:"click",open:o,onOpenChange:n,placement:"bottomRight",arrow:!1,classNames:{root:"aegis-notif-pop__overlay"},children:e.jsxs("button",{type:"button",className:"aegis-notif-bell","aria-label":s>0?`Notifications: ${String(s)} unread`:"Notifications","data-agent-action-id":a?.id,onClick:a?()=>void _.invoke():void 0,children:[e.jsx(h.BellOutlined,{className:"aegis-notif-bell__icon"}),s>0&&e.jsx("span",{className:"aegis-notif-bell__badge","aria-hidden":"true",children:s>99?"99+":s})]})})}exports.NotificationBell=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("react"),f=require("@ant-design/icons"),C=require("antd"),S=require("../../agent/core/hooks.cjs"),w=require("../../hooks/popoverOverflow.cjs"),B=require("../../hooks/useDialogPopover.cjs"),j=require("./Button.cjs"),I=require("./ErrorState.cjs");;/* empty css */const P=require("./linkComponent.cjs"),F=require("./relativeTime.cjs"),A=require("../../locale/useStrings.cjs"),L=8,T=360;function D({items:d,unreadCount:o=d.filter(i=>!i.read).length,onOpen:N,inboxPath:b,linkComponent:v=P.DefaultLink,width:y=T,action:p,liveError:E,error:_,onRetry:r}){const i=A.useStrings(),a=B.useDialogPopover(),{open:g,focusPanel:u}=a,t=x.useId(),m=`${t}-stale`,q=S.useAegisAction(p),h=d.slice(0,L),n=d.length===0?_??null:null,l=n?null:E??_??null;let c=null;n?c=i.notificationsLoadFailedNote(n.message):l&&(c=i.notificationsStaleNote(l.message)),x.useEffect(()=>{g&&document.activeElement===document.body&&u()},[n,l,g,u]);const k=s=>{a.close(),N?.(s)},O=e.jsxs("div",{ref:a.panelRef,id:t,className:"aegis-notif-pop",style:{width:y},role:"dialog","aria-labelledby":`${t}-title`,tabIndex:-1,children:[e.jsxs("div",{className:"aegis-notif-pop__head",children:[e.jsx("span",{id:`${t}-title`,className:"aegis-notif-pop__title",children:i.notifications}),o>0&&e.jsx("span",{className:"aegis-notif-pop__count",children:i.unreadCount(o)})]}),l&&e.jsxs("div",{className:"aegis-notif-pop__stale",children:[e.jsx(f.ExclamationCircleFilled,{className:"aegis-notif-pop__stale-icon","aria-hidden":!0}),e.jsxs("div",{className:"aegis-notif-pop__stale-body",children:[e.jsxs("span",{children:[e.jsx("span",{className:"aegis-notif-pop__stale-title",children:i.notificationsStale})," ",l.message]}),r&&e.jsx(j.Button,{tone:"secondary",onClick:r,children:i.retry})]})]}),n?e.jsx(I.ErrorState,{size:"compact",title:i.notificationsLoadFailed,description:n.message,action:r&&e.jsx(j.Button,{tone:"secondary",onClick:r,children:i.retry})}):h.length===0?e.jsx("div",{className:"aegis-notif-pop__empty",children:i.notificationsCaughtUp}):e.jsx("ul",{className:"aegis-notif-pop__list",children:h.map(s=>e.jsx("li",{className:"aegis-notif-pop__item-wrap",children:e.jsxs("button",{type:"button",className:["aegis-notif-pop__item",s.read?"":"aegis-notif-pop__item--unread"].filter(Boolean).join(" "),onClick:()=>{k(s)},children:[e.jsx("span",{className:"aegis-notif-pop__dot","aria-hidden":"true","data-unread":!s.read}),e.jsxs("span",{className:"aegis-notif-pop__body",children:[e.jsxs("span",{className:"aegis-notif-pop__row",children:[e.jsx("span",{className:"aegis-notif-pop__item-title",children:s.title}),e.jsx("span",{className:"aegis-notif-pop__time",children:F.relativeTime(s.timestamp,i)})]}),s.body&&e.jsx("span",{className:"aegis-notif-pop__item-body",children:s.body})]})]})},s.id))}),e.jsx("div",{className:"aegis-notif-pop__foot",onClickCapture:a.close,children:e.jsx(v,{to:b,className:"aegis-notif-pop__view-all",children:i.viewAll})})]});return e.jsx(C.Popover,{content:O,trigger:"click",open:a.open,onOpenChange:a.setOpen,placement:"bottomRight",autoAdjustOverflow:w.POPOVER_OVERFLOW,arrow:!1,classNames:{root:"aegis-notif-pop__overlay"},children:e.jsx("span",{className:"aegis-notif-bell__anchor",children:e.jsxs("button",{ref:a.triggerRef,type:"button",className:"aegis-notif-bell","aria-describedby":c?m:void 0,"aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.open?t:void 0,"aria-label":i.notificationBellLabel(o),"data-agent-action-id":p?.id,onClick:p?()=>void q.invoke():void 0,children:[e.jsx(f.BellOutlined,{className:"aegis-notif-bell__icon"}),o>0&&e.jsx("span",{className:"aegis-notif-bell__badge","aria-hidden":"true",children:o>99?"99+":o}),c&&e.jsxs(e.Fragment,{children:[e.jsx(f.ExclamationCircleFilled,{className:"aegis-notif-bell__stale","aria-hidden":!0}),e.jsx("span",{id:m,className:"aegis-notif-bell__description",children:c})]})]})})})}exports.NotificationBell=D;
2
2
  //# sourceMappingURL=NotificationBell.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationBell.cjs","sources":["../../../src/components/ui/NotificationBell.tsx"],"sourcesContent":["import { type ReactElement, useState } from 'react';\n\nimport { BellOutlined } from '@ant-design/icons';\nimport { Popover } from 'antd';\n\nimport { useAegisAction } from '../../agent/core/hooks';\nimport type { AegisAction } from '../../agent/core/types';\nimport type { AegisNotification } from '../../notifications';\nimport './NotificationBell.css';\nimport { DefaultLink, type LinkComponent } from './linkComponent';\nimport { relativeTime } from './relativeTime';\n\nexport interface NotificationBellProps {\n /** Newest first; the popover previews the first few. */\n items: AegisNotification[];\n /** Shown on the badge. Defaults to the number of unread `items`. */\n unreadCount?: number;\n /**\n * Fired when the user opens an item; the popover closes first. The host\n * marks it read and navigates to `item.to`.\n */\n onOpen?: (item: AegisNotification) => void;\n /** Path to the full inbox page, e.g. '/inbox'. */\n inboxPath: string;\n /** Renders the \"View all\" link. Defaults to an `<a href>`. */\n linkComponent?: LinkComponent;\n /** Override popover width in px. Defaults to 360. */\n width?: number;\n /** Optional aegis-ui agent action — fired when the bell is clicked. */\n action?: AegisAction<void, unknown>;\n}\n\nconst MAX_PREVIEW_ITEMS = 8;\nconst DEFAULT_WIDTH = 360;\n\nexport function NotificationBell({\n items,\n unreadCount = items.filter((n) => !n.read).length,\n onOpen,\n inboxPath,\n linkComponent: LinkImpl = DefaultLink,\n width = DEFAULT_WIDTH,\n action,\n}: NotificationBellProps): ReactElement {\n const [open, setOpen] = useState(false);\n const bound = useAegisAction<void, unknown>(action);\n\n const preview = items.slice(0, MAX_PREVIEW_ITEMS);\n\n const handleItemClick = (item: AegisNotification): void => {\n setOpen(false);\n onOpen?.(item);\n };\n\n const content = (\n <div className=\"aegis-notif-pop\" style={{ width }}>\n <div className=\"aegis-notif-pop__head\">\n <span className=\"aegis-notif-pop__title\">Notifications</span>\n {unreadCount > 0 && (\n <span className=\"aegis-notif-pop__count\">{unreadCount} unread</span>\n )}\n </div>\n {preview.length === 0 ? (\n <div className=\"aegis-notif-pop__empty\">You&apos;re all caught up.</div>\n ) : (\n <ul className=\"aegis-notif-pop__list\">\n {preview.map((item) => (\n <li key={item.id} className=\"aegis-notif-pop__item-wrap\">\n <button\n type=\"button\"\n className={[\n 'aegis-notif-pop__item',\n item.read ? '' : 'aegis-notif-pop__item--unread',\n ]\n .filter(Boolean)\n .join(' ')}\n onClick={() => {\n handleItemClick(item);\n }}\n >\n <span\n className=\"aegis-notif-pop__dot\"\n aria-hidden=\"true\"\n data-unread={!item.read}\n />\n <span className=\"aegis-notif-pop__body\">\n <span className=\"aegis-notif-pop__row\">\n <span className=\"aegis-notif-pop__item-title\">\n {item.title}\n </span>\n <span className=\"aegis-notif-pop__time\">\n {relativeTime(item.timestamp)}\n </span>\n </span>\n {item.body && (\n <span className=\"aegis-notif-pop__item-body\">\n {item.body}\n </span>\n )}\n </span>\n </button>\n </li>\n ))}\n </ul>\n )}\n {/* Following the link closes the popover. */}\n <div\n className=\"aegis-notif-pop__foot\"\n onClickCapture={() => {\n setOpen(false);\n }}\n >\n <LinkImpl to={inboxPath} className=\"aegis-notif-pop__view-all\">\n View all\n </LinkImpl>\n </div>\n </div>\n );\n\n return (\n <Popover\n content={content}\n trigger=\"click\"\n open={open}\n onOpenChange={setOpen}\n placement=\"bottomRight\"\n arrow={false}\n classNames={{ root: 'aegis-notif-pop__overlay' }}\n >\n <button\n type=\"button\"\n className=\"aegis-notif-bell\"\n aria-label={\n unreadCount > 0\n ? `Notifications: ${String(unreadCount)} unread`\n : 'Notifications'\n }\n data-agent-action-id={action?.id}\n onClick={action ? () => void bound.invoke() : undefined}\n >\n <BellOutlined className=\"aegis-notif-bell__icon\" />\n {unreadCount > 0 && (\n <span className=\"aegis-notif-bell__badge\" aria-hidden=\"true\">\n {unreadCount > 99 ? '99+' : unreadCount}\n </span>\n )}\n </button>\n </Popover>\n );\n}\n"],"names":["MAX_PREVIEW_ITEMS","DEFAULT_WIDTH","NotificationBell","items","unreadCount","n","onOpen","inboxPath","LinkImpl","DefaultLink","width","action","open","setOpen","useState","bound","useAegisAction","preview","handleItemClick","item","content","jsxs","jsx","relativeTime","Popover","BellOutlined"],"mappings":"8UAgCMA,EAAoB,EACpBC,EAAgB,IAEf,SAASC,EAAiB,CAC/B,MAAAC,EACA,YAAAC,EAAcD,EAAM,OAAQE,GAAM,CAACA,EAAE,IAAI,EAAE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aJ,EAAK,SAAS,CAAA,CAC9B,CAAA,EACF,EACCA,EAAK,MACJG,EAAAA,IAAC,QAAK,UAAU,6BACb,WAAK,IAAA,CACR,CAAA,CAAA,CAEJ,CAAA,CAAA,CAAA,CACF,EAjCOH,EAAK,EAkCd,CACD,EACH,EAGFG,EAAAA,IAAC,MAAA,CACC,UAAU,wBACV,eAAgB,IAAM,CACpBT,EAAQ,EAAK,CACf,EAEA,eAACL,EAAA,CAAS,GAAID,EAAW,UAAU,4BAA4B,SAAA,UAAA,CAE/D,CAAA,CAAA,CACF,EACF,EAGF,OACEe,EAAAA,IAACE,EAAAA,QAAA,CACC,QAAAJ,EACA,QAAQ,QACR,KAAAR,EACA,aAAcC,EACd,UAAU,cACV,MAAO,GACP,WAAY,CAAE,KAAM,0BAAA,EAEpB,SAAAQ,EAAAA,KAAC,SAAA,CACC,KAAK,SACL,UAAU,mBACV,aACEjB,EAAc,EACV,kBAAkB,OAAOA,CAAW,CAAC,UACrC,gBAEN,uBAAsBO,GAAQ,GAC9B,QAASA,EAAS,IAAM,KAAKI,EAAM,SAAW,OAE9C,SAAA,CAAAO,EAAAA,IAACG,EAAAA,aAAA,CAAa,UAAU,wBAAA,CAAyB,EAChDrB,EAAc,GACbkB,EAAAA,IAAC,OAAA,CAAK,UAAU,0BAA0B,cAAY,OACnD,SAAAlB,EAAc,GAAK,MAAQA,CAAA,CAC9B,CAAA,CAAA,CAAA,CAEJ,CAAA,CAGN"}
1
+ {"version":3,"file":"NotificationBell.cjs","sources":["../../../src/components/ui/NotificationBell.tsx"],"sourcesContent":["import { type ReactElement, useEffect, useId } from 'react';\n\nimport { BellOutlined, ExclamationCircleFilled } from '@ant-design/icons';\nimport { Popover } from 'antd';\n\nimport { useAegisAction } from '../../agent/core/hooks';\nimport type { AegisAction } from '../../agent/core/types';\nimport { POPOVER_OVERFLOW } from '../../hooks/popoverOverflow';\nimport { useDialogPopover } from '../../hooks/useDialogPopover';\nimport { useStrings } from '../../locale';\nimport type { AegisNotification } from '../../notifications';\nimport { Button } from './Button';\nimport { ErrorState } from './ErrorState';\nimport './NotificationBell.css';\nimport { DefaultLink, type LinkComponent } from './linkComponent';\nimport { relativeTime } from './relativeTime';\n\nexport interface NotificationBellProps {\n /** Newest first; the popover previews the first few. */\n items: AegisNotification[];\n /** Shown on the badge. Defaults to the number of unread `items`. */\n unreadCount?: number;\n /**\n * Fired when the user opens an item; the popover closes first. The host\n * marks it read and navigates to `item.to`.\n */\n onOpen?: (item: AegisNotification) => void;\n /** Path to the full inbox page, e.g. '/inbox'. */\n inboxPath: string;\n /** Renders the \"View all\" link. Defaults to an `<a href>`. */\n linkComponent?: LinkComponent;\n /** Override popover width in px. Defaults to 360. */\n width?: number;\n /** Optional aegis-ui agent action — fired when the bell is clicked. */\n action?: AegisAction<void, unknown>;\n /**\n * Set while live updates are failing: the bell shows a caution mark and\n * the popover says the items may be out of date. The count stays.\n */\n liveError?: Error | null;\n /**\n * Why loading failed. With no `items`, the bell shows the caution mark and\n * the popover says the notifications couldn't load; with `items`, it is\n * shown like `liveError`.\n */\n error?: Error | null;\n /**\n * Renders a retry button where the popover says loading failed or the\n * items may be out of date.\n */\n onRetry?: () => void;\n}\n\nconst MAX_PREVIEW_ITEMS = 8;\nconst DEFAULT_WIDTH = 360;\n\nexport function NotificationBell({\n items,\n unreadCount = items.filter((n) => !n.read).length,\n onOpen,\n inboxPath,\n linkComponent: LinkImpl = DefaultLink,\n width = DEFAULT_WIDTH,\n action,\n liveError,\n error,\n onRetry,\n}: NotificationBellProps): ReactElement {\n const strings = useStrings();\n const popover = useDialogPopover<HTMLDivElement>();\n const { open, focusPanel } = popover;\n const panelId = useId();\n const staleId = `${panelId}-stale`;\n const bound = useAegisAction<void, unknown>(action);\n\n const preview = items.slice(0, MAX_PREVIEW_ITEMS);\n const loadError = items.length === 0 ? (error ?? null) : null;\n const staleError = loadError ? null : (liveError ?? error ?? null);\n let caution: string | null = null;\n if (loadError) {\n caution = strings.notificationsLoadFailedNote(loadError.message);\n } else if (staleError) {\n caution = strings.notificationsStaleNote(staleError.message);\n }\n\n // A retry that works removes the retry button that had focus, which\n // would leave the open panel without it.\n useEffect(() => {\n if (open && document.activeElement === document.body) {\n focusPanel();\n }\n }, [loadError, staleError, open, focusPanel]);\n\n const handleItemClick = (item: AegisNotification): void => {\n popover.close();\n onOpen?.(item);\n };\n\n const content = (\n <div\n ref={popover.panelRef}\n id={panelId}\n className=\"aegis-notif-pop\"\n style={{ width }}\n role=\"dialog\"\n aria-labelledby={`${panelId}-title`}\n tabIndex={-1}\n >\n <div className=\"aegis-notif-pop__head\">\n <span id={`${panelId}-title`} className=\"aegis-notif-pop__title\">\n {strings.notifications}\n </span>\n {unreadCount > 0 && (\n <span className=\"aegis-notif-pop__count\">\n {strings.unreadCount(unreadCount)}\n </span>\n )}\n </div>\n {staleError && (\n <div className=\"aegis-notif-pop__stale\">\n <ExclamationCircleFilled\n className=\"aegis-notif-pop__stale-icon\"\n aria-hidden\n />\n <div className=\"aegis-notif-pop__stale-body\">\n <span>\n <span className=\"aegis-notif-pop__stale-title\">\n {strings.notificationsStale}\n </span>{' '}\n {staleError.message}\n </span>\n {onRetry && (\n <Button tone=\"secondary\" onClick={onRetry}>\n {strings.retry}\n </Button>\n )}\n </div>\n </div>\n )}\n {loadError ? (\n <ErrorState\n size=\"compact\"\n title={strings.notificationsLoadFailed}\n description={loadError.message}\n action={\n onRetry && (\n <Button tone=\"secondary\" onClick={onRetry}>\n {strings.retry}\n </Button>\n )\n }\n />\n ) : preview.length === 0 ? (\n <div className=\"aegis-notif-pop__empty\">\n {strings.notificationsCaughtUp}\n </div>\n ) : (\n <ul className=\"aegis-notif-pop__list\">\n {preview.map((item) => (\n <li key={item.id} className=\"aegis-notif-pop__item-wrap\">\n <button\n type=\"button\"\n className={[\n 'aegis-notif-pop__item',\n item.read ? '' : 'aegis-notif-pop__item--unread',\n ]\n .filter(Boolean)\n .join(' ')}\n onClick={() => {\n handleItemClick(item);\n }}\n >\n <span\n className=\"aegis-notif-pop__dot\"\n aria-hidden=\"true\"\n data-unread={!item.read}\n />\n <span className=\"aegis-notif-pop__body\">\n <span className=\"aegis-notif-pop__row\">\n <span className=\"aegis-notif-pop__item-title\">\n {item.title}\n </span>\n <span className=\"aegis-notif-pop__time\">\n {relativeTime(item.timestamp, strings)}\n </span>\n </span>\n {item.body && (\n <span className=\"aegis-notif-pop__item-body\">\n {item.body}\n </span>\n )}\n </span>\n </button>\n </li>\n ))}\n </ul>\n )}\n {/* Following the link closes the popover. */}\n <div className=\"aegis-notif-pop__foot\" onClickCapture={popover.close}>\n <LinkImpl to={inboxPath} className=\"aegis-notif-pop__view-all\">\n {strings.viewAll}\n </LinkImpl>\n </div>\n </div>\n );\n\n return (\n <Popover\n content={content}\n trigger=\"click\"\n open={popover.open}\n onOpenChange={popover.setOpen}\n placement=\"bottomRight\"\n autoAdjustOverflow={POPOVER_OVERFLOW}\n arrow={false}\n classNames={{ root: 'aegis-notif-pop__overlay' }}\n >\n {/* antd sets aria-describedby on its child to the popover's id, so\n the wrapper takes that and the bell keeps its own description. */}\n <span className=\"aegis-notif-bell__anchor\">\n <button\n ref={popover.triggerRef}\n type=\"button\"\n className=\"aegis-notif-bell\"\n aria-describedby={caution ? staleId : undefined}\n aria-haspopup=\"dialog\"\n aria-expanded={popover.open}\n aria-controls={popover.open ? panelId : undefined}\n aria-label={strings.notificationBellLabel(unreadCount)}\n data-agent-action-id={action?.id}\n onClick={action ? () => void bound.invoke() : undefined}\n >\n <BellOutlined className=\"aegis-notif-bell__icon\" />\n {unreadCount > 0 && (\n <span className=\"aegis-notif-bell__badge\" aria-hidden=\"true\">\n {unreadCount > 99 ? '99+' : unreadCount}\n </span>\n )}\n {caution && (\n <>\n <ExclamationCircleFilled\n className=\"aegis-notif-bell__stale\"\n aria-hidden\n />\n <span id={staleId} className=\"aegis-notif-bell__description\">\n {caution}\n </span>\n </>\n )}\n </button>\n </span>\n </Popover>\n );\n}\n"],"names":["MAX_PREVIEW_ITEMS","DEFAULT_WIDTH","NotificationBell","items","unreadCount","n","onOpen","inboxPath","LinkImpl","DefaultLink","width","action","liveError","error","onRetry","strings","useStrings","popover","useDialogPopover","open","focusPanel","panelId","useId","staleId","bound","useAegisAction","preview","loadError","staleError","caution","useEffect","handleItemClick","item","content","jsxs","jsx","ExclamationCircleFilled","Button","ErrorState","Popover","POPOVER_OVERFLOW","BellOutlined","Fragment"],"mappings":"0gBAqDMA,EAAoB,EACpBC,EAAgB,IAEf,SAASC,EAAiB,CAC/B,MAAAC,EACA,YAAAC,EAAcD,EAAM,OAAQE,GAAM,CAACA,EAAE,IAAI,EAAE,OAC3C,OAAAC,EACA,UAAAC,EACA,cAAeC,EAAWC,EAAAA,YAC1B,MAAAC,EAAQT,EACR,OAAAU,EACA,UAAAC,EACA,MAAAC,EACA,QAAAC,CACF,EAAwC,CACtC,MAAMC,EAAUC,EAAAA,WAAA,EACVC,EAAUC,EAAAA,iBAAA,EACV,CAAE,KAAAC,EAAM,WAAAC,CAAA,EAAeH,EACvBI,EAAUC,EAAAA,MAAA,EACVC,EAAU,GAAGF,CAAO,SACpBG,EAAQC,EAAAA,eAA8Bd,CAAM,EAE5Ce,EAAUvB,EAAM,MAAM,EAAGH,CAAiB,EAC1C2B,EAAYxB,EAAM,SAAW,EAAKU,GAAS,KAAQ,KACnDe,EAAaD,EAAY,KAAQf,GAAaC,GAAS,KAC7D,IAAIgB,EAAyB,KACzBF,EACFE,EAAUd,EAAQ,4BAA4BY,EAAU,OAAO,EACtDC,IACTC,EAAUd,EAAQ,uBAAuBa,EAAW,OAAO,GAK7DE,EAAAA,UAAU,IAAM,CACVX,GAAQ,SAAS,gBAAkB,SAAS,MAC9CC,EAAA,CAEJ,EAAG,CAACO,EAAWC,EAAYT,EAAMC,CAAU,CAAC,EAE5C,MAAMW,EAAmBC,GAAkC,CACzDf,EAAQ,MAAA,EACRX,IAAS0B,CAAI,CACf,EAEMC,EACJC,EAAAA,KAAC,MAAA,CACC,IAAKjB,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M,SAAW,OAE9C,SAAA,CAAAW,EAAAA,IAACM,EAAAA,aAAA,CAAa,UAAU,wBAAA,CAAyB,EAChDrC,EAAc,GACb+B,EAAAA,IAAC,OAAA,CAAK,UAAU,0BAA0B,cAAY,OACnD,SAAA/B,EAAc,GAAK,MAAQA,CAAA,CAC9B,EAEDyB,GACCK,EAAAA,KAAAQ,WAAA,CACE,SAAA,CAAAP,EAAAA,IAACC,EAAAA,wBAAA,CACC,UAAU,0BACV,cAAW,EAAA,CAAA,QAEZ,OAAA,CAAK,GAAIb,EAAS,UAAU,gCAC1B,SAAAM,CAAA,CACH,CAAA,CAAA,CACF,CAAA,CAAA,CAAA,CAEJ,CACF,CAAA,CAAA,CAGN"}
@@ -20,5 +20,21 @@ export interface NotificationBellProps {
20
20
  width?: number;
21
21
  /** Optional aegis-ui agent action — fired when the bell is clicked. */
22
22
  action?: AegisAction<void, unknown>;
23
+ /**
24
+ * Set while live updates are failing: the bell shows a caution mark and
25
+ * the popover says the items may be out of date. The count stays.
26
+ */
27
+ liveError?: Error | null;
28
+ /**
29
+ * Why loading failed. With no `items`, the bell shows the caution mark and
30
+ * the popover says the notifications couldn't load; with `items`, it is
31
+ * shown like `liveError`.
32
+ */
33
+ error?: Error | null;
34
+ /**
35
+ * Renders a retry button where the popover says loading failed or the
36
+ * items may be out of date.
37
+ */
38
+ onRetry?: () => void;
23
39
  }
24
- export declare function NotificationBell({ items, unreadCount, onOpen, inboxPath, linkComponent: LinkImpl, width, action, }: NotificationBellProps): ReactElement;
40
+ export declare function NotificationBell({ items, unreadCount, onOpen, inboxPath, linkComponent: LinkImpl, width, action, liveError, error, onRetry, }: NotificationBellProps): ReactElement;
@@ -1,100 +1,154 @@
1
- import { jsxs as o, jsx as i } from "react/jsx-runtime";
2
- import { useState as h } from "react";
3
- import { BellOutlined as N } from "@ant-design/icons";
4
- import { Popover as b } from "antd";
5
- import { useAegisAction as v } from "../../agent/core/hooks.js";
1
+ import { jsxs as o, jsx as e, Fragment as x } from "react/jsx-runtime";
2
+ import { useId as A, useEffect as F } from "react";
3
+ import { ExclamationCircleFilled as u, BellOutlined as L } from "@ant-design/icons";
4
+ import { Popover as P } from "antd";
5
+ import { useAegisAction as B } from "../../agent/core/hooks.js";
6
+ import { POPOVER_OVERFLOW as S } from "../../hooks/popoverOverflow.js";
7
+ import { useDialogPopover as j } from "../../hooks/useDialogPopover.js";
8
+ import { Button as b } from "./Button.js";
9
+ import { ErrorState as D } from "./ErrorState.js";
6
10
  /* empty css */
7
- import { DefaultLink as u } from "./linkComponent.js";
8
- import { relativeTime as y } from "./relativeTime.js";
9
- const k = 8, w = 360;
10
- function O({
11
- items: l,
12
- unreadCount: a = l.filter((t) => !t.read).length,
13
- onOpen: c,
14
- inboxPath: r,
15
- linkComponent: d = u,
16
- width: m = w,
17
- action: s
11
+ import { DefaultLink as T } from "./linkComponent.js";
12
+ import { relativeTime as R } from "./relativeTime.js";
13
+ import { useStrings as V } from "../../locale/useStrings.js";
14
+ const W = 8, $ = 360;
15
+ function ie({
16
+ items: d,
17
+ unreadCount: n = d.filter((i) => !i.read).length,
18
+ onOpen: v,
19
+ inboxPath: y,
20
+ linkComponent: E = T,
21
+ width: k = $,
22
+ action: m,
23
+ liveError: I,
24
+ error: f,
25
+ onRetry: p
18
26
  }) {
19
- const [t, n] = h(!1), f = v(s), p = l.slice(0, k), _ = (e) => {
20
- n(!1), c?.(e);
21
- }, g = /* @__PURE__ */ o("div", { className: "aegis-notif-pop", style: { width: m }, children: [
22
- /* @__PURE__ */ o("div", { className: "aegis-notif-pop__head", children: [
23
- /* @__PURE__ */ i("span", { className: "aegis-notif-pop__title", children: "Notifications" }),
24
- a > 0 && /* @__PURE__ */ o("span", { className: "aegis-notif-pop__count", children: [
25
- a,
26
- " unread"
27
- ] })
28
- ] }),
29
- p.length === 0 ? /* @__PURE__ */ i("div", { className: "aegis-notif-pop__empty", children: "You're all caught up." }) : /* @__PURE__ */ i("ul", { className: "aegis-notif-pop__list", children: p.map((e) => /* @__PURE__ */ i("li", { className: "aegis-notif-pop__item-wrap", children: /* @__PURE__ */ o(
30
- "button",
31
- {
32
- type: "button",
33
- className: [
34
- "aegis-notif-pop__item",
35
- e.read ? "" : "aegis-notif-pop__item--unread"
36
- ].filter(Boolean).join(" "),
37
- onClick: () => {
38
- _(e);
39
- },
40
- children: [
41
- /* @__PURE__ */ i(
42
- "span",
27
+ const i = V(), t = j(), { open: _, focusPanel: g } = t, l = A(), h = `${l}-stale`, O = B(m), N = d.slice(0, W), s = d.length === 0 ? f ?? null : null, c = s ? null : I ?? f ?? null;
28
+ let r = null;
29
+ s ? r = i.notificationsLoadFailedNote(s.message) : c && (r = i.notificationsStaleNote(c.message)), F(() => {
30
+ _ && document.activeElement === document.body && g();
31
+ }, [s, c, _, g]);
32
+ const w = (a) => {
33
+ t.close(), v?.(a);
34
+ }, C = /* @__PURE__ */ o(
35
+ "div",
36
+ {
37
+ ref: t.panelRef,
38
+ id: l,
39
+ className: "aegis-notif-pop",
40
+ style: { width: k },
41
+ role: "dialog",
42
+ "aria-labelledby": `${l}-title`,
43
+ tabIndex: -1,
44
+ children: [
45
+ /* @__PURE__ */ o("div", { className: "aegis-notif-pop__head", children: [
46
+ /* @__PURE__ */ e("span", { id: `${l}-title`, className: "aegis-notif-pop__title", children: i.notifications }),
47
+ n > 0 && /* @__PURE__ */ e("span", { className: "aegis-notif-pop__count", children: i.unreadCount(n) })
48
+ ] }),
49
+ c && /* @__PURE__ */ o("div", { className: "aegis-notif-pop__stale", children: [
50
+ /* @__PURE__ */ e(
51
+ u,
43
52
  {
44
- className: "aegis-notif-pop__dot",
45
- "aria-hidden": "true",
46
- "data-unread": !e.read
53
+ className: "aegis-notif-pop__stale-icon",
54
+ "aria-hidden": !0
47
55
  }
48
56
  ),
49
- /* @__PURE__ */ o("span", { className: "aegis-notif-pop__body", children: [
50
- /* @__PURE__ */ o("span", { className: "aegis-notif-pop__row", children: [
51
- /* @__PURE__ */ i("span", { className: "aegis-notif-pop__item-title", children: e.title }),
52
- /* @__PURE__ */ i("span", { className: "aegis-notif-pop__time", children: y(e.timestamp) })
57
+ /* @__PURE__ */ o("div", { className: "aegis-notif-pop__stale-body", children: [
58
+ /* @__PURE__ */ o("span", { children: [
59
+ /* @__PURE__ */ e("span", { className: "aegis-notif-pop__stale-title", children: i.notificationsStale }),
60
+ " ",
61
+ c.message
53
62
  ] }),
54
- e.body && /* @__PURE__ */ i("span", { className: "aegis-notif-pop__item-body", children: e.body })
63
+ p && /* @__PURE__ */ e(b, { tone: "secondary", onClick: p, children: i.retry })
55
64
  ] })
56
- ]
57
- }
58
- ) }, e.id)) }),
59
- /* @__PURE__ */ i(
60
- "div",
61
- {
62
- className: "aegis-notif-pop__foot",
63
- onClickCapture: () => {
64
- n(!1);
65
- },
66
- children: /* @__PURE__ */ i(d, { to: r, className: "aegis-notif-pop__view-all", children: "View all" })
67
- }
68
- )
69
- ] });
70
- return /* @__PURE__ */ i(
71
- b,
65
+ ] }),
66
+ s ? /* @__PURE__ */ e(
67
+ D,
68
+ {
69
+ size: "compact",
70
+ title: i.notificationsLoadFailed,
71
+ description: s.message,
72
+ action: p && /* @__PURE__ */ e(b, { tone: "secondary", onClick: p, children: i.retry })
73
+ }
74
+ ) : N.length === 0 ? /* @__PURE__ */ e("div", { className: "aegis-notif-pop__empty", children: i.notificationsCaughtUp }) : /* @__PURE__ */ e("ul", { className: "aegis-notif-pop__list", children: N.map((a) => /* @__PURE__ */ e("li", { className: "aegis-notif-pop__item-wrap", children: /* @__PURE__ */ o(
75
+ "button",
76
+ {
77
+ type: "button",
78
+ className: [
79
+ "aegis-notif-pop__item",
80
+ a.read ? "" : "aegis-notif-pop__item--unread"
81
+ ].filter(Boolean).join(" "),
82
+ onClick: () => {
83
+ w(a);
84
+ },
85
+ children: [
86
+ /* @__PURE__ */ e(
87
+ "span",
88
+ {
89
+ className: "aegis-notif-pop__dot",
90
+ "aria-hidden": "true",
91
+ "data-unread": !a.read
92
+ }
93
+ ),
94
+ /* @__PURE__ */ o("span", { className: "aegis-notif-pop__body", children: [
95
+ /* @__PURE__ */ o("span", { className: "aegis-notif-pop__row", children: [
96
+ /* @__PURE__ */ e("span", { className: "aegis-notif-pop__item-title", children: a.title }),
97
+ /* @__PURE__ */ e("span", { className: "aegis-notif-pop__time", children: R(a.timestamp, i) })
98
+ ] }),
99
+ a.body && /* @__PURE__ */ e("span", { className: "aegis-notif-pop__item-body", children: a.body })
100
+ ] })
101
+ ]
102
+ }
103
+ ) }, a.id)) }),
104
+ /* @__PURE__ */ e("div", { className: "aegis-notif-pop__foot", onClickCapture: t.close, children: /* @__PURE__ */ e(E, { to: y, className: "aegis-notif-pop__view-all", children: i.viewAll }) })
105
+ ]
106
+ }
107
+ );
108
+ return /* @__PURE__ */ e(
109
+ P,
72
110
  {
73
- content: g,
111
+ content: C,
74
112
  trigger: "click",
75
- open: t,
76
- onOpenChange: n,
113
+ open: t.open,
114
+ onOpenChange: t.setOpen,
77
115
  placement: "bottomRight",
116
+ autoAdjustOverflow: S,
78
117
  arrow: !1,
79
118
  classNames: { root: "aegis-notif-pop__overlay" },
80
- children: /* @__PURE__ */ o(
119
+ children: /* @__PURE__ */ e("span", { className: "aegis-notif-bell__anchor", children: /* @__PURE__ */ o(
81
120
  "button",
82
121
  {
122
+ ref: t.triggerRef,
83
123
  type: "button",
84
124
  className: "aegis-notif-bell",
85
- "aria-label": a > 0 ? `Notifications: ${String(a)} unread` : "Notifications",
86
- "data-agent-action-id": s?.id,
87
- onClick: s ? () => void f.invoke() : void 0,
125
+ "aria-describedby": r ? h : void 0,
126
+ "aria-haspopup": "dialog",
127
+ "aria-expanded": t.open,
128
+ "aria-controls": t.open ? l : void 0,
129
+ "aria-label": i.notificationBellLabel(n),
130
+ "data-agent-action-id": m?.id,
131
+ onClick: m ? () => void O.invoke() : void 0,
88
132
  children: [
89
- /* @__PURE__ */ i(N, { className: "aegis-notif-bell__icon" }),
90
- a > 0 && /* @__PURE__ */ i("span", { className: "aegis-notif-bell__badge", "aria-hidden": "true", children: a > 99 ? "99+" : a })
133
+ /* @__PURE__ */ e(L, { className: "aegis-notif-bell__icon" }),
134
+ n > 0 && /* @__PURE__ */ e("span", { className: "aegis-notif-bell__badge", "aria-hidden": "true", children: n > 99 ? "99+" : n }),
135
+ r && /* @__PURE__ */ o(x, { children: [
136
+ /* @__PURE__ */ e(
137
+ u,
138
+ {
139
+ className: "aegis-notif-bell__stale",
140
+ "aria-hidden": !0
141
+ }
142
+ ),
143
+ /* @__PURE__ */ e("span", { id: h, className: "aegis-notif-bell__description", children: r })
144
+ ] })
91
145
  ]
92
146
  }
93
- )
147
+ ) })
94
148
  }
95
149
  );
96
150
  }
97
151
  export {
98
- O as NotificationBell
152
+ ie as NotificationBell
99
153
  };
100
154
  //# sourceMappingURL=NotificationBell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationBell.js","sources":["../../../src/components/ui/NotificationBell.tsx"],"sourcesContent":["import { type ReactElement, useState } from 'react';\n\nimport { BellOutlined } from '@ant-design/icons';\nimport { Popover } from 'antd';\n\nimport { useAegisAction } from '../../agent/core/hooks';\nimport type { AegisAction } from '../../agent/core/types';\nimport type { AegisNotification } from '../../notifications';\nimport './NotificationBell.css';\nimport { DefaultLink, type LinkComponent } from './linkComponent';\nimport { relativeTime } from './relativeTime';\n\nexport interface NotificationBellProps {\n /** Newest first; the popover previews the first few. */\n items: AegisNotification[];\n /** Shown on the badge. Defaults to the number of unread `items`. */\n unreadCount?: number;\n /**\n * Fired when the user opens an item; the popover closes first. The host\n * marks it read and navigates to `item.to`.\n */\n onOpen?: (item: AegisNotification) => void;\n /** Path to the full inbox page, e.g. '/inbox'. */\n inboxPath: string;\n /** Renders the \"View all\" link. Defaults to an `<a href>`. */\n linkComponent?: LinkComponent;\n /** Override popover width in px. Defaults to 360. */\n width?: number;\n /** Optional aegis-ui agent action — fired when the bell is clicked. */\n action?: AegisAction<void, unknown>;\n}\n\nconst MAX_PREVIEW_ITEMS = 8;\nconst DEFAULT_WIDTH = 360;\n\nexport function NotificationBell({\n items,\n unreadCount = items.filter((n) => !n.read).length,\n onOpen,\n inboxPath,\n linkComponent: LinkImpl = DefaultLink,\n width = DEFAULT_WIDTH,\n action,\n}: NotificationBellProps): ReactElement {\n const [open, setOpen] = useState(false);\n const bound = useAegisAction<void, unknown>(action);\n\n const preview = items.slice(0, MAX_PREVIEW_ITEMS);\n\n const handleItemClick = (item: AegisNotification): void => {\n setOpen(false);\n onOpen?.(item);\n };\n\n const content = (\n <div className=\"aegis-notif-pop\" style={{ width }}>\n <div className=\"aegis-notif-pop__head\">\n <span className=\"aegis-notif-pop__title\">Notifications</span>\n {unreadCount > 0 && (\n <span className=\"aegis-notif-pop__count\">{unreadCount} unread</span>\n )}\n </div>\n {preview.length === 0 ? (\n <div className=\"aegis-notif-pop__empty\">You&apos;re all caught up.</div>\n ) : (\n <ul className=\"aegis-notif-pop__list\">\n {preview.map((item) => (\n <li key={item.id} className=\"aegis-notif-pop__item-wrap\">\n <button\n type=\"button\"\n className={[\n 'aegis-notif-pop__item',\n item.read ? '' : 'aegis-notif-pop__item--unread',\n ]\n .filter(Boolean)\n .join(' ')}\n onClick={() => {\n handleItemClick(item);\n }}\n >\n <span\n className=\"aegis-notif-pop__dot\"\n aria-hidden=\"true\"\n data-unread={!item.read}\n />\n <span className=\"aegis-notif-pop__body\">\n <span className=\"aegis-notif-pop__row\">\n <span className=\"aegis-notif-pop__item-title\">\n {item.title}\n </span>\n <span className=\"aegis-notif-pop__time\">\n {relativeTime(item.timestamp)}\n </span>\n </span>\n {item.body && (\n <span className=\"aegis-notif-pop__item-body\">\n {item.body}\n </span>\n )}\n </span>\n </button>\n </li>\n ))}\n </ul>\n )}\n {/* Following the link closes the popover. */}\n <div\n className=\"aegis-notif-pop__foot\"\n onClickCapture={() => {\n setOpen(false);\n }}\n >\n <LinkImpl to={inboxPath} className=\"aegis-notif-pop__view-all\">\n View all\n </LinkImpl>\n </div>\n </div>\n );\n\n return (\n <Popover\n content={content}\n trigger=\"click\"\n open={open}\n onOpenChange={setOpen}\n placement=\"bottomRight\"\n arrow={false}\n classNames={{ root: 'aegis-notif-pop__overlay' }}\n >\n <button\n type=\"button\"\n className=\"aegis-notif-bell\"\n aria-label={\n unreadCount > 0\n ? `Notifications: ${String(unreadCount)} unread`\n : 'Notifications'\n }\n data-agent-action-id={action?.id}\n onClick={action ? () => void bound.invoke() : undefined}\n >\n <BellOutlined className=\"aegis-notif-bell__icon\" />\n {unreadCount > 0 && (\n <span className=\"aegis-notif-bell__badge\" aria-hidden=\"true\">\n {unreadCount > 99 ? '99+' : unreadCount}\n </span>\n )}\n </button>\n </Popover>\n );\n}\n"],"names":["MAX_PREVIEW_ITEMS","DEFAULT_WIDTH","NotificationBell","items","unreadCount","n","onOpen","inboxPath","LinkImpl","DefaultLink","width","action","open","setOpen","useState","bound","useAegisAction","preview","handleItemClick","item","content","jsxs","jsx","relativeTime","Popover","BellOutlined"],"mappings":";;;;;;;;AAgCA,MAAMA,IAAoB,GACpBC,IAAgB;AAEf,SAASC,EAAiB;AAAA,EAC/B,OAAAC;AAAA,EACA,aAAAC,IAAcD,EAAM,OAAO,CAACE,MAAM,CAACA,EAAE,IAAI,EAAE;AAAA,EAC3C,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAeC,IAAWC;AAAA,EAC1B,OAAAC,IAAQT;AAAA,EACR,QAAAU;AACF,GAAwC;AACtC,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAS,EAAK,GAChCC,IAAQC,EAA8BL,CAAM,GAE5CM,IAAUd,EAAM,MAAM,GAAGH,CAAiB,GAE1CkB,IAAkB,CAACC,MAAkC;AACzD,IAAAN,EAAQ,EAAK,GACbP,IAASa,CAAI;AAAA,EACf,GAEMC,sBACH,OAAA,EAAI,WAAU,mBAAkB,OAAO,EAAE,OAAAV,KACxC,UAAA;AAAA,IAAA,gBAAAW,EAAC,OAAA,EAAI,WAAU,yBACb,UAAA;AAAA,MAAA,gBAAAC,EAAC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A,QACC,WAAU;AAAA,QACV,gBAAgB,MAAM;AACpB,UAAAT,EAAQ,EAAK;AAAA,QACf;AAAA,QAEA,4BAACL,GAAA,EAAS,IAAID,GAAW,WAAU,6BAA4B,UAAA,WAAA,CAE/D;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAGF,SACE,gBAAAe;AAAA,IAACE;AAAA,IAAA;AAAA,MACC,SAAAJ;AAAA,MACA,SAAQ;AAAA,MACR,MAAAR;AAAA,MACA,cAAcC;AAAA,MACd,WAAU;AAAA,MACV,OAAO;AAAA,MACP,YAAY,EAAE,MAAM,2BAAA;AAAA,MAEpB,UAAA,gBAAAQ;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,WAAU;AAAA,UACV,cACEjB,IAAc,IACV,kBAAkB,OAAOA,CAAW,CAAC,YACrC;AAAA,UAEN,wBAAsBO,GAAQ;AAAA,UAC9B,SAASA,IAAS,MAAM,KAAKI,EAAM,WAAW;AAAA,UAE9C,UAAA;AAAA,YAAA,gBAAAO,EAACG,GAAA,EAAa,WAAU,yBAAA,CAAyB;AAAA,YAChDrB,IAAc,KACb,gBAAAkB,EAAC,QAAA,EAAK,WAAU,2BAA0B,eAAY,QACnD,UAAAlB,IAAc,KAAK,QAAQA,EAAA,CAC9B;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"NotificationBell.js","sources":["../../../src/components/ui/NotificationBell.tsx"],"sourcesContent":["import { type ReactElement, useEffect, useId } from 'react';\n\nimport { BellOutlined, ExclamationCircleFilled } from '@ant-design/icons';\nimport { Popover } from 'antd';\n\nimport { useAegisAction } from '../../agent/core/hooks';\nimport type { AegisAction } from '../../agent/core/types';\nimport { POPOVER_OVERFLOW } from '../../hooks/popoverOverflow';\nimport { useDialogPopover } from '../../hooks/useDialogPopover';\nimport { useStrings } from '../../locale';\nimport type { AegisNotification } from '../../notifications';\nimport { Button } from './Button';\nimport { ErrorState } from './ErrorState';\nimport './NotificationBell.css';\nimport { DefaultLink, type LinkComponent } from './linkComponent';\nimport { relativeTime } from './relativeTime';\n\nexport interface NotificationBellProps {\n /** Newest first; the popover previews the first few. */\n items: AegisNotification[];\n /** Shown on the badge. Defaults to the number of unread `items`. */\n unreadCount?: number;\n /**\n * Fired when the user opens an item; the popover closes first. The host\n * marks it read and navigates to `item.to`.\n */\n onOpen?: (item: AegisNotification) => void;\n /** Path to the full inbox page, e.g. '/inbox'. */\n inboxPath: string;\n /** Renders the \"View all\" link. Defaults to an `<a href>`. */\n linkComponent?: LinkComponent;\n /** Override popover width in px. Defaults to 360. */\n width?: number;\n /** Optional aegis-ui agent action — fired when the bell is clicked. */\n action?: AegisAction<void, unknown>;\n /**\n * Set while live updates are failing: the bell shows a caution mark and\n * the popover says the items may be out of date. The count stays.\n */\n liveError?: Error | null;\n /**\n * Why loading failed. With no `items`, the bell shows the caution mark and\n * the popover says the notifications couldn't load; with `items`, it is\n * shown like `liveError`.\n */\n error?: Error | null;\n /**\n * Renders a retry button where the popover says loading failed or the\n * items may be out of date.\n */\n onRetry?: () => void;\n}\n\nconst MAX_PREVIEW_ITEMS = 8;\nconst DEFAULT_WIDTH = 360;\n\nexport function NotificationBell({\n items,\n unreadCount = items.filter((n) => !n.read).length,\n onOpen,\n inboxPath,\n linkComponent: LinkImpl = DefaultLink,\n width = DEFAULT_WIDTH,\n action,\n liveError,\n error,\n onRetry,\n}: NotificationBellProps): ReactElement {\n const strings = useStrings();\n const popover = useDialogPopover<HTMLDivElement>();\n const { open, focusPanel } = popover;\n const panelId = useId();\n const staleId = `${panelId}-stale`;\n const bound = useAegisAction<void, unknown>(action);\n\n const preview = items.slice(0, MAX_PREVIEW_ITEMS);\n const loadError = items.length === 0 ? (error ?? null) : null;\n const staleError = loadError ? null : (liveError ?? error ?? null);\n let caution: string | null = null;\n if (loadError) {\n caution = strings.notificationsLoadFailedNote(loadError.message);\n } else if (staleError) {\n caution = strings.notificationsStaleNote(staleError.message);\n }\n\n // A retry that works removes the retry button that had focus, which\n // would leave the open panel without it.\n useEffect(() => {\n if (open && document.activeElement === document.body) {\n focusPanel();\n }\n }, [loadError, staleError, open, focusPanel]);\n\n const handleItemClick = (item: AegisNotification): void => {\n popover.close();\n onOpen?.(item);\n };\n\n const content = (\n <div\n ref={popover.panelRef}\n id={panelId}\n className=\"aegis-notif-pop\"\n style={{ width }}\n role=\"dialog\"\n aria-labelledby={`${panelId}-title`}\n tabIndex={-1}\n >\n <div className=\"aegis-notif-pop__head\">\n <span id={`${panelId}-title`} className=\"aegis-notif-pop__title\">\n {strings.notifications}\n </span>\n {unreadCount > 0 && (\n <span className=\"aegis-notif-pop__count\">\n {strings.unreadCount(unreadCount)}\n </span>\n )}\n </div>\n {staleError && (\n <div className=\"aegis-notif-pop__stale\">\n <ExclamationCircleFilled\n className=\"aegis-notif-pop__stale-icon\"\n aria-hidden\n />\n <div className=\"aegis-notif-pop__stale-body\">\n <span>\n <span className=\"aegis-notif-pop__stale-title\">\n {strings.notificationsStale}\n </span>{' '}\n {staleError.message}\n </span>\n {onRetry && (\n <Button tone=\"secondary\" onClick={onRetry}>\n {strings.retry}\n </Button>\n )}\n </div>\n </div>\n )}\n {loadError ? (\n <ErrorState\n size=\"compact\"\n title={strings.notificationsLoadFailed}\n description={loadError.message}\n action={\n onRetry && (\n <Button tone=\"secondary\" onClick={onRetry}>\n {strings.retry}\n </Button>\n )\n }\n />\n ) : preview.length === 0 ? (\n <div className=\"aegis-notif-pop__empty\">\n {strings.notificationsCaughtUp}\n </div>\n ) : (\n <ul className=\"aegis-notif-pop__list\">\n {preview.map((item) => (\n <li key={item.id} className=\"aegis-notif-pop__item-wrap\">\n <button\n type=\"button\"\n className={[\n 'aegis-notif-pop__item',\n item.read ? '' : 'aegis-notif-pop__item--unread',\n ]\n .filter(Boolean)\n .join(' ')}\n onClick={() => {\n handleItemClick(item);\n }}\n >\n <span\n className=\"aegis-notif-pop__dot\"\n aria-hidden=\"true\"\n data-unread={!item.read}\n />\n <span className=\"aegis-notif-pop__body\">\n <span className=\"aegis-notif-pop__row\">\n <span className=\"aegis-notif-pop__item-title\">\n {item.title}\n </span>\n <span className=\"aegis-notif-pop__time\">\n {relativeTime(item.timestamp, strings)}\n </span>\n </span>\n {item.body && (\n <span className=\"aegis-notif-pop__item-body\">\n {item.body}\n </span>\n )}\n </span>\n </button>\n </li>\n ))}\n </ul>\n )}\n {/* Following the link closes the popover. */}\n <div className=\"aegis-notif-pop__foot\" onClickCapture={popover.close}>\n <LinkImpl to={inboxPath} className=\"aegis-notif-pop__view-all\">\n {strings.viewAll}\n </LinkImpl>\n </div>\n </div>\n );\n\n return (\n <Popover\n content={content}\n trigger=\"click\"\n open={popover.open}\n onOpenChange={popover.setOpen}\n placement=\"bottomRight\"\n autoAdjustOverflow={POPOVER_OVERFLOW}\n arrow={false}\n classNames={{ root: 'aegis-notif-pop__overlay' }}\n >\n {/* antd sets aria-describedby on its child to the popover's id, so\n the wrapper takes that and the bell keeps its own description. */}\n <span className=\"aegis-notif-bell__anchor\">\n <button\n ref={popover.triggerRef}\n type=\"button\"\n className=\"aegis-notif-bell\"\n aria-describedby={caution ? staleId : undefined}\n aria-haspopup=\"dialog\"\n aria-expanded={popover.open}\n aria-controls={popover.open ? panelId : undefined}\n aria-label={strings.notificationBellLabel(unreadCount)}\n data-agent-action-id={action?.id}\n onClick={action ? () => void bound.invoke() : undefined}\n >\n <BellOutlined className=\"aegis-notif-bell__icon\" />\n {unreadCount > 0 && (\n <span className=\"aegis-notif-bell__badge\" aria-hidden=\"true\">\n {unreadCount > 99 ? '99+' : unreadCount}\n </span>\n )}\n {caution && (\n <>\n <ExclamationCircleFilled\n className=\"aegis-notif-bell__stale\"\n aria-hidden\n />\n <span id={staleId} className=\"aegis-notif-bell__description\">\n {caution}\n </span>\n </>\n )}\n </button>\n </span>\n </Popover>\n );\n}\n"],"names":["MAX_PREVIEW_ITEMS","DEFAULT_WIDTH","NotificationBell","items","unreadCount","n","onOpen","inboxPath","LinkImpl","DefaultLink","width","action","liveError","error","onRetry","strings","useStrings","popover","useDialogPopover","open","focusPanel","panelId","useId","staleId","bound","useAegisAction","preview","loadError","staleError","caution","useEffect","handleItemClick","item","content","jsxs","jsx","ExclamationCircleFilled","Button","ErrorState","Popover","POPOVER_OVERFLOW","BellOutlined","Fragment"],"mappings":";;;;;;;;;;;;;AAqDA,MAAMA,IAAoB,GACpBC,IAAgB;AAEf,SAASC,GAAiB;AAAA,EAC/B,OAAAC;AAAA,EACA,aAAAC,IAAcD,EAAM,OAAO,CAACE,MAAM,CAACA,EAAE,IAAI,EAAE;AAAA,EAC3C,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAeC,IAAWC;AAAA,EAC1B,OAAAC,IAAQT;AAAA,EACR,QAAAU;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AACF,GAAwC;AACtC,QAAMC,IAAUC,EAAA,GACVC,IAAUC,EAAA,GACV,EAAE,MAAAC,GAAM,YAAAC,EAAA,IAAeH,GACvBI,IAAUC,EAAA,GACVC,IAAU,GAAGF,CAAO,UACpBG,IAAQC,EAA8Bd,CAAM,GAE5Ce,IAAUvB,EAAM,MAAM,GAAGH,CAAiB,GAC1C2B,IAAYxB,EAAM,WAAW,IAAKU,KAAS,OAAQ,MACnDe,IAAaD,IAAY,OAAQf,KAAaC,KAAS;AAC7D,MAAIgB,IAAyB;AAC7B,EAAIF,IACFE,IAAUd,EAAQ,4BAA4BY,EAAU,OAAO,IACtDC,MACTC,IAAUd,EAAQ,uBAAuBa,EAAW,OAAO,IAK7DE,EAAU,MAAM;AACd,IAAIX,KAAQ,SAAS,kBAAkB,SAAS,QAC9CC,EAAA;AAAA,EAEJ,GAAG,CAACO,GAAWC,GAAYT,GAAMC,CAAU,CAAC;AAE5C,QAAMW,IAAkB,CAACC,MAAkC;AACzD,IAAAf,EAAQ,MAAA,GACRX,IAAS0B,CAAI;AAAA,EACf,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toStringTag,{value:"Module"});const q=require("react/jsx-runtime"),b=require("react");;/* empty css */const F=require("./TextField.cjs"),L=/^-?\d+$/,$=/^-?(\d+\.?\d*|\.\d+)$/,C=/^-?$/,V=/^-?\.?$/;function m(e){return e===void 0?"":String(e)}function B(e,r,s){return Math.min(s??1/0,Math.max(r??-1/0,e))}function G({value:e,onChange:r,label:s,ariaLabel:v,integer:i=!1,min:n,max:p,step:w=1,unit:x,placeholder:E,helperText:I,error:y,disabled:A=!1,id:N,className:T}){const g=i?L:$,l=t=>g.test(t.trim())?Number(t.trim()):void 0,[a,u]=b.useState(()=>m(e)),[D,d]=b.useState(e);e!==D&&(d(e),e!==l(a)&&u(m(e)));const f=l(a),M=(i?C:V).test(a.trim())||f!==void 0?void 0:i?"Enter a whole number":"Enter a number",S=t=>{const c=l(t);u(t),d(c),r(c)},h=t=>{const o=B((f??n??0)+t*w,n,p);u(m(o)),d(o),r(o)},P=t=>{const o={ArrowUp:1,ArrowDown:-1,PageUp:10,PageDown:-10}[t.key];o!==void 0&&(t.preventDefault(),h(o))},R=n===void 0||n<0?"text":i?"numeric":"decimal",j=["aegis-number-field",T??""].filter(Boolean).join(" ");return q.jsx(F.TextField,{className:j,id:N,label:s,"aria-label":s===void 0?v:void 0,role:"spinbutton","aria-valuenow":f,"aria-valuemin":n,"aria-valuemax":p,inputMode:R,autoComplete:"off",value:a,placeholder:E,disabled:A,error:M??y,helperText:I,trailingIcon:x,onChange:t=>{S(t.target.value)},onKeyDown:P})}exports.NumberField=G;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react/jsx-runtime"),g=require("react");;/* empty css */const $=require("./TextField.cjs"),C=require("../../locale/useStrings.cjs"),V=/^-?\d+$/,B=/^-?(\d+\.?\d*|\.\d+)$/,G=/^-?$/,U=/^-?\.?$/;function m(e){return e===void 0?"":String(e)}function _(e,n,s){return Math.min(s??1/0,Math.max(n??-1/0,e))}function k({value:e,onChange:n,label:s,ariaLabel:v,integer:i=!1,min:r,max:p,step:y=1,unit:N,placeholder:w,helperText:x,error:I,disabled:A=!1,id:S,"aria-describedby":T,className:E}){const b=C.useStrings(),D=i?V:B,u=t=>D.test(t.trim())?Number(t.trim()):void 0,[a,l]=g.useState(()=>m(e)),[M,d]=g.useState(e);e!==M&&(d(e),e!==u(a)&&l(m(e)));const f=u(a),h=(i?G:U).test(a.trim())||f!==void 0?void 0:i?b.enterWholeNumber:b.enterNumber,q=t=>{const c=u(t);l(t),d(c),n(c)},P=t=>{const o=_((f??r??0)+t*y,r,p);l(m(o)),d(o),n(o)},R=t=>{const o={ArrowUp:1,ArrowDown:-1,PageUp:10,PageDown:-10}[t.key];o!==void 0&&(t.preventDefault(),P(o))},j=r===void 0||r<0?"text":i?"numeric":"decimal",F=["aegis-number-field",E??""].filter(Boolean).join(" ");return L.jsx($.TextField,{className:F,id:S,label:s,"aria-label":s===void 0?v:void 0,"aria-describedby":T,role:"spinbutton","aria-valuenow":f,"aria-valuemin":r,"aria-valuemax":p,inputMode:j,autoComplete:"off",value:a,placeholder:w,disabled:A,error:h??I,helperText:x,trailingIcon:N,onChange:t=>{q(t.target.value)},onKeyDown:R})}exports.NumberField=k;
2
2
  //# sourceMappingURL=NumberField.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"NumberField.cjs","sources":["../../../src/components/ui/NumberField.tsx"],"sourcesContent":["import { type KeyboardEvent, type ReactNode, useState } from 'react';\n\nimport './NumberField.css';\nimport { TextField } from './TextField';\n\ninterface NumberFieldProps {\n /** `undefined` when the field is empty or its text is not a number. */\n value: number | undefined;\n onChange: (value: number | undefined) => void;\n label?: string;\n /** Accessible name for a field shown without a visible label. */\n ariaLabel?: string;\n /** Whole numbers only: a decimal is refused, as a backend `int` field would. */\n integer?: boolean;\n /** Bounds for the arrow keys, announced to assistive tech. A typed value outside them is still passed on, for the host to judge. */\n min?: number;\n max?: number;\n /** What the arrow keys add or take away; PageUp / PageDown move ten steps. */\n step?: number;\n /** Unit shown inside the field, e.g. `ms`. */\n unit?: ReactNode;\n placeholder?: string;\n helperText?: ReactNode;\n /** A problem the host found with the value, e.g. out of range. */\n error?: string;\n disabled?: boolean;\n id?: string;\n className?: string;\n}\n\nconst INTEGER = /^-?\\d+$/;\nconst DECIMAL = /^-?(\\d+\\.?\\d*|\\.\\d+)$/;\n/** Text that may still become a number as the user keeps typing. */\nconst PARTIAL_INTEGER = /^-?$/;\nconst PARTIAL_DECIMAL = /^-?\\.?$/;\n\nfunction format(value: number | undefined): string {\n return value === undefined ? '' : String(value);\n}\n\nfunction clamp(value: number, min?: number, max?: number): number {\n return Math.min(max ?? Infinity, Math.max(min ?? -Infinity, value));\n}\n\n/**\n * A text field for one number. It keeps the text as typed, hands the host\n * the parsed number (or `undefined`), and says itself when the text is not\n * a number of the right kind, since the host never sees that text.\n */\nexport function NumberField({\n value,\n onChange,\n label,\n ariaLabel,\n integer = false,\n min,\n max,\n step = 1,\n unit,\n placeholder,\n helperText,\n error,\n disabled = false,\n id,\n className,\n}: NumberFieldProps) {\n const pattern = integer ? INTEGER : DECIMAL;\n const parse = (raw: string): number | undefined =>\n pattern.test(raw.trim()) ? Number(raw.trim()) : undefined;\n\n const [text, setText] = useState(() => format(value));\n const [shownValue, setShownValue] = useState(value);\n if (value !== shownValue) {\n setShownValue(value);\n if (value !== parse(text)) {\n setText(format(value));\n }\n }\n\n const parsed = parse(text);\n const partial = (integer ? PARTIAL_INTEGER : PARTIAL_DECIMAL).test(\n text.trim(),\n );\n const formatError =\n partial || parsed !== undefined\n ? undefined\n : integer\n ? 'Enter a whole number'\n : 'Enter a number';\n\n const edit = (next: string): void => {\n const nextValue = parse(next);\n setText(next);\n setShownValue(nextValue);\n onChange(nextValue);\n };\n\n const stepBy = (steps: number): void => {\n const from = parsed ?? min ?? 0;\n const next = clamp(from + steps * step, min, max);\n setText(format(next));\n setShownValue(next);\n onChange(next);\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>): void => {\n const steps: Partial<Record<string, number>> = {\n ArrowUp: 1,\n ArrowDown: -1,\n PageUp: 10,\n PageDown: -10,\n };\n const by = steps[event.key];\n if (by !== undefined) {\n event.preventDefault();\n stepBy(by);\n }\n };\n\n const allowsNegative = min === undefined || min < 0;\n const inputMode = allowsNegative ? 'text' : integer ? 'numeric' : 'decimal';\n const cls = ['aegis-number-field', className ?? ''].filter(Boolean).join(' ');\n\n return (\n <TextField\n className={cls}\n id={id}\n label={label}\n aria-label={label === undefined ? ariaLabel : undefined}\n role=\"spinbutton\"\n aria-valuenow={parsed}\n aria-valuemin={min}\n aria-valuemax={max}\n inputMode={inputMode}\n autoComplete=\"off\"\n value={text}\n placeholder={placeholder}\n disabled={disabled}\n error={formatError ?? error}\n helperText={helperText}\n trailingIcon={unit}\n onChange={(event) => {\n edit(event.target.value);\n }}\n onKeyDown={onKeyDown}\n />\n );\n}\n"],"names":["INTEGER","DECIMAL","PARTIAL_INTEGER","PARTIAL_DECIMAL","format","value","clamp","min","max","NumberField","onChange","label","ariaLabel","integer","step","unit","placeholder","helperText","error","disabled","id","className","pattern","parse","raw","text","setText","useState","shownValue","setShownValue","parsed","formatError","edit","next","nextValue","stepBy","steps","onKeyDown","event","by","inputMode","cls","jsx","TextField"],"mappings":"4MA8BMA,EAAU,UACVC,EAAU,wBAEVC,EAAkB,OAClBC,EAAkB,UAExB,SAASC,EAAOC,EAAmC,CACjD,OAAOA,IAAU,OAAY,GAAK,OAAOA,CAAK,CAChD,CAEA,SAASC,EAAMD,EAAeE,EAAcC,EAAsB,CAChE,OAAO,KAAK,IAAIA,GAAO,IAAU,KAAK,IAAID,GAAO,KAAWF,CAAK,CAAC,CACpE,CAOO,SAASI,EAAY,CAC1B,MAAAJ,EACA,SAAAK,EACA,MAAAC,EACA,UAAAC,EACA,QAAAC,EAAU,GACV,IAAAN,EACA,IAAAC,EACA,KAAAM,EAAO,EACP,KAAAC,EACA,YAAAC,EACA,WAAAC,EACA,MAAAC,EACA,SAAAC,EAAW,GACX,GAAAC,EAC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AU,OAAYC,EAAY,OAC9C,KAAK,aACL,gBAAekB,EACf,gBAAevB,EACf,gBAAeC,EACf,UAAAgC,EACA,aAAa,MACb,MAAOf,EACP,YAAAT,EACA,SAAAG,EACA,MAAOY,GAAeb,EACtB,WAAAD,EACA,aAAcF,EACd,SAAWuB,GAAU,CACnBN,EAAKM,EAAM,OAAO,KAAK,CACzB,EACA,UAAAD,CAAA,CAAA,CAGN"}
1
+ {"version":3,"file":"NumberField.cjs","sources":["../../../src/components/ui/NumberField.tsx"],"sourcesContent":["import { type KeyboardEvent, type ReactNode, useState } from 'react';\n\nimport { useStrings } from '../../locale';\nimport './NumberField.css';\nimport { TextField } from './TextField';\n\ninterface NumberFieldProps {\n /** `undefined` when the field is empty or its text is not a number. */\n value: number | undefined;\n onChange: (value: number | undefined) => void;\n label?: string;\n /** Accessible name for a field shown without a visible label. */\n ariaLabel?: string;\n /** Whole numbers only: a decimal is refused, as a backend `int` field would. */\n integer?: boolean;\n /** Bounds for the arrow keys, announced to assistive tech. A typed value outside them is still passed on, for the host to judge. */\n min?: number;\n max?: number;\n /** What the arrow keys add or take away; PageUp / PageDown move ten steps. */\n step?: number;\n /** Unit shown inside the field, e.g. `ms`. */\n unit?: ReactNode;\n placeholder?: string;\n helperText?: ReactNode;\n /** A problem the host found with the value, e.g. out of range. */\n error?: string;\n disabled?: boolean;\n id?: string;\n /** Ids of the text that describes the field, such as a FormRow's description; read before the field's own helper or error text. */\n 'aria-describedby'?: string;\n className?: string;\n}\n\nconst INTEGER = /^-?\\d+$/;\nconst DECIMAL = /^-?(\\d+\\.?\\d*|\\.\\d+)$/;\n/** Text that may still become a number as the user keeps typing. */\nconst PARTIAL_INTEGER = /^-?$/;\nconst PARTIAL_DECIMAL = /^-?\\.?$/;\n\nfunction format(value: number | undefined): string {\n return value === undefined ? '' : String(value);\n}\n\nfunction clamp(value: number, min?: number, max?: number): number {\n return Math.min(max ?? Infinity, Math.max(min ?? -Infinity, value));\n}\n\n/**\n * A text field for one number. It keeps the text as typed, hands the host\n * the parsed number (or `undefined`), and says itself when the text is not\n * a number of the right kind, since the host never sees that text.\n */\nexport function NumberField({\n value,\n onChange,\n label,\n ariaLabel,\n integer = false,\n min,\n max,\n step = 1,\n unit,\n placeholder,\n helperText,\n error,\n disabled = false,\n id,\n 'aria-describedby': describedBy,\n className,\n}: NumberFieldProps) {\n const strings = useStrings();\n const pattern = integer ? INTEGER : DECIMAL;\n const parse = (raw: string): number | undefined =>\n pattern.test(raw.trim()) ? Number(raw.trim()) : undefined;\n\n const [text, setText] = useState(() => format(value));\n const [shownValue, setShownValue] = useState(value);\n if (value !== shownValue) {\n setShownValue(value);\n if (value !== parse(text)) {\n setText(format(value));\n }\n }\n\n const parsed = parse(text);\n const partial = (integer ? PARTIAL_INTEGER : PARTIAL_DECIMAL).test(\n text.trim(),\n );\n const formatError =\n partial || parsed !== undefined\n ? undefined\n : integer\n ? strings.enterWholeNumber\n : strings.enterNumber;\n\n const edit = (next: string): void => {\n const nextValue = parse(next);\n setText(next);\n setShownValue(nextValue);\n onChange(nextValue);\n };\n\n const stepBy = (steps: number): void => {\n const from = parsed ?? min ?? 0;\n const next = clamp(from + steps * step, min, max);\n setText(format(next));\n setShownValue(next);\n onChange(next);\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>): void => {\n const steps: Partial<Record<string, number>> = {\n ArrowUp: 1,\n ArrowDown: -1,\n PageUp: 10,\n PageDown: -10,\n };\n const by = steps[event.key];\n if (by !== undefined) {\n event.preventDefault();\n stepBy(by);\n }\n };\n\n const allowsNegative = min === undefined || min < 0;\n const inputMode = allowsNegative ? 'text' : integer ? 'numeric' : 'decimal';\n const cls = ['aegis-number-field', className ?? ''].filter(Boolean).join(' ');\n\n return (\n <TextField\n className={cls}\n id={id}\n label={label}\n aria-label={label === undefined ? ariaLabel : undefined}\n aria-describedby={describedBy}\n role=\"spinbutton\"\n aria-valuenow={parsed}\n aria-valuemin={min}\n aria-valuemax={max}\n inputMode={inputMode}\n autoComplete=\"off\"\n value={text}\n placeholder={placeholder}\n disabled={disabled}\n error={formatError ?? error}\n helperText={helperText}\n trailingIcon={unit}\n onChange={(event) => {\n edit(event.target.value);\n }}\n onKeyDown={onKeyDown}\n />\n );\n}\n"],"names":["INTEGER","DECIMAL","PARTIAL_INTEGER","PARTIAL_DECIMAL","format","value","clamp","min","max","NumberField","onChange","label","ariaLabel","integer","step","unit","placeholder","helperText","error","disabled","id","describedBy","className","strings","useStrings","pattern","parse","raw","text","setText","useState","shownValue","setShownValue","parsed","formatError","edit","next","nextValue","stepBy","steps","onKeyDown","event","by","inputMode","cls","jsx","TextField"],"mappings":"qPAiCMA,EAAU,UACVC,EAAU,wBAEVC,EAAkB,OAClBC,EAAkB,UAExB,SAASC,EAAOC,EAAmC,CACjD,OAAOA,IAAU,OAAY,GAAK,OAAOA,CAAK,CAChD,CAEA,SAASC,EAAMD,EAAeE,EAAcC,EAAsB,CAChE,OAAO,KAAK,IAAIA,GAAO,IAAU,KAAK,IAAID,GAAO,KAAWF,CAAK,CAAC,CACpE,CAOO,SAASI,EAAY,CAC1B,MAAAJ,EACA,SAAAK,EACA,MAAAC,EACA,UAAAC,EACA,QAAAC,EAAU,GACV,IAAAN,EACA,IAAAC,EACA,KAAAM,EAAO,EACP,KAAAC,EACA,YAAAC,EACA,WAAAC,EACA,MAAAC,EACA,SAAAC,EAAW,GACX,GAAAC,EACA,mBAAoBC,EACpB,UAAAC,CACF,EAAqB,CACnB,MAAMC,EAAUC,EAAAA,WAAA,EACVC,EAAUZ,EAAUb,EAAUC,EAC9ByB,EAASC,GACbF,EAAQ,KAAKE,EAAI,KAAA,CAAM,EAAI,OAAOA,EAAI,KAAA,CAAM,EAAI,OAE5C,CAACC,EAAMC,CAAO,EAAIC,EAAAA,SAAS,IAAM1B,EAAOC,CAAK,CAAC,EAC9C,CAAC0B,EAAYC,CAAa,EAAIF,EAAAA,SAASzB,CAAK,EAC9CA,IAAU0B,IACZC,EAAc3B,CAAK,EACfA,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umberFieldProps {
21
21
  error?: string;
22
22
  disabled?: boolean;
23
23
  id?: string;
24
+ /** Ids of the text that describes the field, such as a FormRow's description; read before the field's own helper or error text. */
25
+ 'aria-describedby'?: string;
24
26
  className?: string;
25
27
  }
26
28
  /**
@@ -28,5 +30,5 @@ interface NumberFieldProps {
28
30
  * the parsed number (or `undefined`), and says itself when the text is not
29
31
  * a number of the right kind, since the host never sees that text.
30
32
  */
31
- export declare function NumberField({ value, onChange, label, ariaLabel, integer, min, max, step, unit, placeholder, helperText, error, disabled, id, className, }: NumberFieldProps): import("react/jsx-runtime").JSX.Element;
33
+ export declare function NumberField({ value, onChange, label, ariaLabel, integer, min, max, step, unit, placeholder, helperText, error, disabled, id, 'aria-describedby': describedBy, className, }: NumberFieldProps): import("react/jsx-runtime").JSX.Element;
32
34
  export {};