@lincyaw/aegis-ui 0.10.0 → 0.11.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 (334) 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 +107 -100
  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/ChatComposer.cjs +1 -1
  23. package/dist/components/ui/ChatComposer.cjs.map +1 -1
  24. package/dist/components/ui/ChatComposer.js +32 -31
  25. package/dist/components/ui/ChatComposer.js.map +1 -1
  26. package/dist/components/ui/ChatSessionList.cjs +1 -1
  27. package/dist/components/ui/ChatSessionList.cjs.map +1 -1
  28. package/dist/components/ui/ChatSessionList.js +68 -66
  29. package/dist/components/ui/ChatSessionList.js.map +1 -1
  30. package/dist/components/ui/Checkbox.cjs +1 -1
  31. package/dist/components/ui/Checkbox.cjs.map +1 -1
  32. package/dist/components/ui/Checkbox.d.ts +6 -2
  33. package/dist/components/ui/Checkbox.js +21 -17
  34. package/dist/components/ui/Checkbox.js.map +1 -1
  35. package/dist/components/ui/ChoiceCardGroup.cjs +1 -1
  36. package/dist/components/ui/ChoiceCardGroup.cjs.map +1 -1
  37. package/dist/components/ui/ChoiceCardGroup.d.ts +13 -4
  38. package/dist/components/ui/ChoiceCardGroup.js +47 -35
  39. package/dist/components/ui/ChoiceCardGroup.js.map +1 -1
  40. package/dist/components/ui/CodeEditor.cjs +1 -1
  41. package/dist/components/ui/CodeEditor.cjs.map +1 -1
  42. package/dist/components/ui/CodeEditor.d.ts +11 -1
  43. package/dist/components/ui/CodeEditor.js +100 -74
  44. package/dist/components/ui/CodeEditor.js.map +1 -1
  45. package/dist/components/ui/CommandInvocationCard.cjs +1 -1
  46. package/dist/components/ui/CommandInvocationCard.cjs.map +1 -1
  47. package/dist/components/ui/CommandInvocationCard.js +28 -31
  48. package/dist/components/ui/CommandInvocationCard.js.map +1 -1
  49. package/dist/components/ui/CommandPalette.cjs +1 -1
  50. package/dist/components/ui/CommandPalette.cjs.map +1 -1
  51. package/dist/components/ui/CommandPalette.d.ts +3 -3
  52. package/dist/components/ui/CommandPalette.js +75 -75
  53. package/dist/components/ui/CommandPalette.js.map +1 -1
  54. package/dist/components/ui/CommitGraph.cjs +1 -1
  55. package/dist/components/ui/CommitGraph.cjs.map +1 -1
  56. package/dist/components/ui/CommitGraph.d.ts +3 -1
  57. package/dist/components/ui/CommitGraph.js +77 -74
  58. package/dist/components/ui/CommitGraph.js.map +1 -1
  59. package/dist/components/ui/ContentInspectorDialog.cjs +1 -1
  60. package/dist/components/ui/ContentInspectorDialog.cjs.map +1 -1
  61. package/dist/components/ui/ContentInspectorDialog.js +25 -31
  62. package/dist/components/ui/ContentInspectorDialog.js.map +1 -1
  63. package/dist/components/ui/ContentPreview.cjs +2 -2
  64. package/dist/components/ui/ContentPreview.cjs.map +1 -1
  65. package/dist/components/ui/ContentPreview.js +55 -56
  66. package/dist/components/ui/ContentPreview.js.map +1 -1
  67. package/dist/components/ui/DangerZone.cjs +1 -1
  68. package/dist/components/ui/DangerZone.cjs.map +1 -1
  69. package/dist/components/ui/DangerZone.js +13 -12
  70. package/dist/components/ui/DangerZone.js.map +1 -1
  71. package/dist/components/ui/DataList.cjs +1 -1
  72. package/dist/components/ui/DataList.cjs.map +1 -1
  73. package/dist/components/ui/DataList.js +25 -24
  74. package/dist/components/ui/DataList.js.map +1 -1
  75. package/dist/components/ui/DataTable.cjs +1 -1
  76. package/dist/components/ui/DataTable.cjs.map +1 -1
  77. package/dist/components/ui/DataTable.js +41 -41
  78. package/dist/components/ui/DataTable.js.map +1 -1
  79. package/dist/components/ui/DropdownMenu.cjs +1 -1
  80. package/dist/components/ui/DropdownMenu.cjs.map +1 -1
  81. package/dist/components/ui/DropdownMenu.js +41 -40
  82. package/dist/components/ui/DropdownMenu.js.map +1 -1
  83. package/dist/components/ui/EnvironmentSwitcher.cjs +1 -1
  84. package/dist/components/ui/EnvironmentSwitcher.cjs.map +1 -1
  85. package/dist/components/ui/EnvironmentSwitcher.js +26 -24
  86. package/dist/components/ui/EnvironmentSwitcher.js.map +1 -1
  87. package/dist/components/ui/EventTable.cjs +1 -1
  88. package/dist/components/ui/EventTable.cjs.map +1 -1
  89. package/dist/components/ui/EventTable.js +60 -53
  90. package/dist/components/ui/EventTable.js.map +1 -1
  91. package/dist/components/ui/FileDropzone.cjs +1 -1
  92. package/dist/components/ui/FileDropzone.cjs.map +1 -1
  93. package/dist/components/ui/FileDropzone.js +38 -40
  94. package/dist/components/ui/FileDropzone.js.map +1 -1
  95. package/dist/components/ui/FilePreview.cjs +1 -1
  96. package/dist/components/ui/FilePreview.cjs.map +1 -1
  97. package/dist/components/ui/FilePreview.js +60 -61
  98. package/dist/components/ui/FilePreview.js.map +1 -1
  99. package/dist/components/ui/FolderDropzone.cjs +1 -1
  100. package/dist/components/ui/FolderDropzone.cjs.map +1 -1
  101. package/dist/components/ui/FolderDropzone.js +114 -84
  102. package/dist/components/ui/FolderDropzone.js.map +1 -1
  103. package/dist/components/ui/ForgotPasswordForm.cjs +1 -1
  104. package/dist/components/ui/ForgotPasswordForm.cjs.map +1 -1
  105. package/dist/components/ui/ForgotPasswordForm.js +22 -21
  106. package/dist/components/ui/ForgotPasswordForm.js.map +1 -1
  107. package/dist/components/ui/FormRow.cjs +1 -1
  108. package/dist/components/ui/FormRow.cjs.map +1 -1
  109. package/dist/components/ui/FormRow.d.ts +32 -11
  110. package/dist/components/ui/FormRow.js +24 -15
  111. package/dist/components/ui/FormRow.js.map +1 -1
  112. package/dist/components/ui/InboxPage.cjs +1 -1
  113. package/dist/components/ui/InboxPage.cjs.map +1 -1
  114. package/dist/components/ui/InboxPage.d.ts +12 -3
  115. package/dist/components/ui/InboxPage.js +91 -77
  116. package/dist/components/ui/InboxPage.js.map +1 -1
  117. package/dist/components/ui/LoginForm.cjs +1 -1
  118. package/dist/components/ui/LoginForm.cjs.map +1 -1
  119. package/dist/components/ui/LoginForm.js +43 -43
  120. package/dist/components/ui/LoginForm.js.map +1 -1
  121. package/dist/components/ui/MonoValue.cjs +1 -1
  122. package/dist/components/ui/MonoValue.cjs.map +1 -1
  123. package/dist/components/ui/MonoValue.d.ts +5 -1
  124. package/dist/components/ui/MonoValue.js +17 -17
  125. package/dist/components/ui/MonoValue.js.map +1 -1
  126. package/dist/components/ui/NotificationBell.cjs +1 -1
  127. package/dist/components/ui/NotificationBell.cjs.map +1 -1
  128. package/dist/components/ui/NotificationBell.d.ts +17 -1
  129. package/dist/components/ui/NotificationBell.js +129 -75
  130. package/dist/components/ui/NotificationBell.js.map +1 -1
  131. package/dist/components/ui/NumberField.cjs +1 -1
  132. package/dist/components/ui/NumberField.cjs.map +1 -1
  133. package/dist/components/ui/NumberField.d.ts +3 -1
  134. package/dist/components/ui/NumberField.js +52 -49
  135. package/dist/components/ui/NumberField.js.map +1 -1
  136. package/dist/components/ui/ObjectBrowser.cjs +1 -1
  137. package/dist/components/ui/ObjectBrowser.cjs.map +1 -1
  138. package/dist/components/ui/ObjectBrowser.js +83 -78
  139. package/dist/components/ui/ObjectBrowser.js.map +1 -1
  140. package/dist/components/ui/PageSizeSelect.cjs +1 -1
  141. package/dist/components/ui/PageSizeSelect.cjs.map +1 -1
  142. package/dist/components/ui/PageSizeSelect.js +30 -29
  143. package/dist/components/ui/PageSizeSelect.js.map +1 -1
  144. package/dist/components/ui/Panel.cjs.map +1 -1
  145. package/dist/components/ui/Panel.d.ts +5 -2
  146. package/dist/components/ui/Panel.js.map +1 -1
  147. package/dist/components/ui/ParquetViewer.cjs +1 -1
  148. package/dist/components/ui/ParquetViewer.cjs.map +1 -1
  149. package/dist/components/ui/ParquetViewer.js +69 -74
  150. package/dist/components/ui/ParquetViewer.js.map +1 -1
  151. package/dist/components/ui/PasswordField.cjs +1 -1
  152. package/dist/components/ui/PasswordField.cjs.map +1 -1
  153. package/dist/components/ui/PasswordField.js +28 -27
  154. package/dist/components/ui/PasswordField.js.map +1 -1
  155. package/dist/components/ui/PickerField.cjs +1 -1
  156. package/dist/components/ui/PickerField.cjs.map +1 -1
  157. package/dist/components/ui/PickerField.d.ts +25 -6
  158. package/dist/components/ui/PickerField.js +20 -17
  159. package/dist/components/ui/PickerField.js.map +1 -1
  160. package/dist/components/ui/ProjectSelector.cjs +1 -1
  161. package/dist/components/ui/ProjectSelector.cjs.map +1 -1
  162. package/dist/components/ui/ProjectSelector.js +40 -37
  163. package/dist/components/ui/ProjectSelector.js.map +1 -1
  164. package/dist/components/ui/QueryAutocomplete.cjs +1 -1
  165. package/dist/components/ui/QueryAutocomplete.cjs.map +1 -1
  166. package/dist/components/ui/QueryAutocomplete.d.ts +7 -1
  167. package/dist/components/ui/QueryAutocomplete.js +141 -134
  168. package/dist/components/ui/QueryAutocomplete.js.map +1 -1
  169. package/dist/components/ui/RegisterForm.cjs +1 -1
  170. package/dist/components/ui/RegisterForm.cjs.map +1 -1
  171. package/dist/components/ui/RegisterForm.js +41 -40
  172. package/dist/components/ui/RegisterForm.js.map +1 -1
  173. package/dist/components/ui/ResizableSidePanel.cjs +1 -1
  174. package/dist/components/ui/ResizableSidePanel.cjs.map +1 -1
  175. package/dist/components/ui/ResizableSidePanel.js +41 -40
  176. package/dist/components/ui/ResizableSidePanel.js.map +1 -1
  177. package/dist/components/ui/SavedQueryBar.cjs +1 -1
  178. package/dist/components/ui/SavedQueryBar.cjs.map +1 -1
  179. package/dist/components/ui/SavedQueryBar.d.ts +1 -1
  180. package/dist/components/ui/SavedQueryBar.js +375 -277
  181. package/dist/components/ui/SavedQueryBar.js.map +1 -1
  182. package/dist/components/ui/SearchInput.cjs +1 -1
  183. package/dist/components/ui/SearchInput.cjs.map +1 -1
  184. package/dist/components/ui/SearchInput.d.ts +5 -1
  185. package/dist/components/ui/SearchInput.js +28 -24
  186. package/dist/components/ui/SearchInput.js.map +1 -1
  187. package/dist/components/ui/Select.cjs +1 -1
  188. package/dist/components/ui/Select.cjs.map +1 -1
  189. package/dist/components/ui/Select.d.ts +3 -1
  190. package/dist/components/ui/Select.js +21 -19
  191. package/dist/components/ui/Select.js.map +1 -1
  192. package/dist/components/ui/ServiceMap.cjs +1 -1
  193. package/dist/components/ui/ServiceMap.cjs.map +1 -1
  194. package/dist/components/ui/ServiceMap.d.ts +9 -3
  195. package/dist/components/ui/ServiceMap.js +291 -231
  196. package/dist/components/ui/ServiceMap.js.map +1 -1
  197. package/dist/components/ui/Slider.cjs +1 -1
  198. package/dist/components/ui/Slider.cjs.map +1 -1
  199. package/dist/components/ui/Slider.d.ts +3 -1
  200. package/dist/components/ui/Slider.js +11 -9
  201. package/dist/components/ui/Slider.js.map +1 -1
  202. package/dist/components/ui/SparkLine.cjs +1 -1
  203. package/dist/components/ui/SparkLine.cjs.map +1 -1
  204. package/dist/components/ui/SparkLine.js +24 -23
  205. package/dist/components/ui/SparkLine.js.map +1 -1
  206. package/dist/components/ui/Steps.cjs +1 -1
  207. package/dist/components/ui/Steps.cjs.map +1 -1
  208. package/dist/components/ui/Steps.js +25 -29
  209. package/dist/components/ui/Steps.js.map +1 -1
  210. package/dist/components/ui/Terminal.cjs +1 -1
  211. package/dist/components/ui/Terminal.cjs.map +1 -1
  212. package/dist/components/ui/Terminal.js +18 -17
  213. package/dist/components/ui/Terminal.js.map +1 -1
  214. package/dist/components/ui/TextField.cjs +1 -1
  215. package/dist/components/ui/TextField.cjs.map +1 -1
  216. package/dist/components/ui/TextField.js +6 -6
  217. package/dist/components/ui/TextField.js.map +1 -1
  218. package/dist/components/ui/ThemeToggle.cjs +1 -1
  219. package/dist/components/ui/ThemeToggle.cjs.map +1 -1
  220. package/dist/components/ui/ThemeToggle.js +15 -18
  221. package/dist/components/ui/ThemeToggle.js.map +1 -1
  222. package/dist/components/ui/TimeDisplay.cjs +1 -1
  223. package/dist/components/ui/TimeDisplay.cjs.map +1 -1
  224. package/dist/components/ui/TimeDisplay.js +12 -12
  225. package/dist/components/ui/TimeDisplay.js.map +1 -1
  226. package/dist/components/ui/TimeRangePicker.cjs +1 -1
  227. package/dist/components/ui/TimeRangePicker.cjs.map +1 -1
  228. package/dist/components/ui/TimeRangePicker.js +128 -111
  229. package/dist/components/ui/TimeRangePicker.js.map +1 -1
  230. package/dist/components/ui/TraceSpanInspector.cjs +1 -1
  231. package/dist/components/ui/TraceSpanInspector.cjs.map +1 -1
  232. package/dist/components/ui/TraceSpanInspector.js +43 -46
  233. package/dist/components/ui/TraceSpanInspector.js.map +1 -1
  234. package/dist/components/ui/TraceTree.cjs +1 -1
  235. package/dist/components/ui/TraceTree.cjs.map +1 -1
  236. package/dist/components/ui/TraceTree.d.ts +1 -1
  237. package/dist/components/ui/TraceTree.js +33 -33
  238. package/dist/components/ui/TraceTree.js.map +1 -1
  239. package/dist/components/ui/UploadQueue.cjs +1 -1
  240. package/dist/components/ui/UploadQueue.cjs.map +1 -1
  241. package/dist/components/ui/UploadQueue.js +59 -70
  242. package/dist/components/ui/UploadQueue.js.map +1 -1
  243. package/dist/components/ui/authValidation.cjs +1 -1
  244. package/dist/components/ui/authValidation.cjs.map +1 -1
  245. package/dist/components/ui/authValidation.d.ts +2 -2
  246. package/dist/components/ui/authValidation.js +4 -5
  247. package/dist/components/ui/authValidation.js.map +1 -1
  248. package/dist/components/ui/classifyContent.cjs +3 -3
  249. package/dist/components/ui/classifyContent.cjs.map +1 -1
  250. package/dist/components/ui/classifyContent.d.ts +2 -1
  251. package/dist/components/ui/classifyContent.js +52 -54
  252. package/dist/components/ui/classifyContent.js.map +1 -1
  253. package/dist/components/ui/relativeTime.cjs +1 -1
  254. package/dist/components/ui/relativeTime.cjs.map +1 -1
  255. package/dist/components/ui/relativeTime.d.ts +5 -3
  256. package/dist/components/ui/relativeTime.js +15 -6
  257. package/dist/components/ui/relativeTime.js.map +1 -1
  258. package/dist/hooks/popoverOverflow.cjs +2 -0
  259. package/dist/hooks/popoverOverflow.cjs.map +1 -0
  260. package/dist/hooks/popoverOverflow.d.ts +8 -0
  261. package/dist/hooks/popoverOverflow.js +9 -0
  262. package/dist/hooks/popoverOverflow.js.map +1 -0
  263. package/dist/hooks/useDialogPopover.cjs +2 -0
  264. package/dist/hooks/useDialogPopover.cjs.map +1 -0
  265. package/dist/hooks/useDialogPopover.d.ts +23 -0
  266. package/dist/hooks/useDialogPopover.js +48 -0
  267. package/dist/hooks/useDialogPopover.js.map +1 -0
  268. package/dist/hooks/useMenuPopover.cjs +1 -1
  269. package/dist/hooks/useMenuPopover.cjs.map +1 -1
  270. package/dist/hooks/useMenuPopover.d.ts +0 -8
  271. package/dist/hooks/useMenuPopover.js +17 -22
  272. package/dist/hooks/useMenuPopover.js.map +1 -1
  273. package/dist/hooks/useSavedQueries.cjs +1 -1
  274. package/dist/hooks/useSavedQueries.cjs.map +1 -1
  275. package/dist/hooks/useSavedQueries.js +29 -28
  276. package/dist/hooks/useSavedQueries.js.map +1 -1
  277. package/dist/index.d.ts +1 -1
  278. package/dist/layouts/shell/AegisShell.cjs +1 -1
  279. package/dist/layouts/shell/AegisShell.cjs.map +1 -1
  280. package/dist/layouts/shell/AegisShell.js +41 -41
  281. package/dist/layouts/shell/AegisShell.js.map +1 -1
  282. package/dist/layouts/shell/AppSwitcher.cjs +1 -1
  283. package/dist/layouts/shell/AppSwitcher.cjs.map +1 -1
  284. package/dist/layouts/shell/AppSwitcher.js +53 -36
  285. package/dist/layouts/shell/AppSwitcher.js.map +1 -1
  286. package/dist/layouts/shell/AuthRequiredCard.cjs +1 -1
  287. package/dist/layouts/shell/AuthRequiredCard.cjs.map +1 -1
  288. package/dist/layouts/shell/AuthRequiredCard.js +24 -22
  289. package/dist/layouts/shell/AuthRequiredCard.js.map +1 -1
  290. package/dist/layouts/shell/RouteErrorBoundary.cjs +1 -1
  291. package/dist/layouts/shell/RouteErrorBoundary.cjs.map +1 -1
  292. package/dist/layouts/shell/RouteErrorBoundary.d.ts +4 -1
  293. package/dist/layouts/shell/RouteErrorBoundary.js +15 -10
  294. package/dist/layouts/shell/RouteErrorBoundary.js.map +1 -1
  295. package/dist/layouts/shell/ShellInboxPage.cjs +1 -1
  296. package/dist/layouts/shell/ShellInboxPage.cjs.map +1 -1
  297. package/dist/layouts/shell/ShellInboxPage.js +17 -16
  298. package/dist/layouts/shell/ShellInboxPage.js.map +1 -1
  299. package/dist/layouts/shell/ShellNotificationBell.cjs +1 -1
  300. package/dist/layouts/shell/ShellNotificationBell.cjs.map +1 -1
  301. package/dist/layouts/shell/ShellNotificationBell.js +20 -14
  302. package/dist/layouts/shell/ShellNotificationBell.js.map +1 -1
  303. package/dist/layouts/shell/TopHeader.cjs +1 -1
  304. package/dist/layouts/shell/TopHeader.cjs.map +1 -1
  305. package/dist/layouts/shell/TopHeader.js +74 -74
  306. package/dist/layouts/shell/TopHeader.js.map +1 -1
  307. package/dist/layouts/shell/useShellUser.cjs +1 -1
  308. package/dist/layouts/shell/useShellUser.cjs.map +1 -1
  309. package/dist/layouts/shell/useShellUser.js +15 -13
  310. package/dist/layouts/shell/useShellUser.js.map +1 -1
  311. package/dist/lib/chart.cjs +1 -1
  312. package/dist/lib/chart.cjs.map +1 -1
  313. package/dist/lib/chart.d.ts +5 -7
  314. package/dist/lib/chart.js +49 -34
  315. package/dist/lib/chart.js.map +1 -1
  316. package/dist/lib/timeRange.cjs +1 -1
  317. package/dist/lib/timeRange.cjs.map +1 -1
  318. package/dist/lib/timeRange.d.ts +14 -4
  319. package/dist/lib/timeRange.js +41 -40
  320. package/dist/lib/timeRange.js.map +1 -1
  321. package/dist/locale/strings.cjs +1 -1
  322. package/dist/locale/strings.cjs.map +1 -1
  323. package/dist/locale/strings.d.ts +241 -2
  324. package/dist/locale/strings.js +543 -26
  325. package/dist/locale/strings.js.map +1 -1
  326. package/dist/notifications/notificationContext.cjs.map +1 -1
  327. package/dist/notifications/notificationContext.d.ts +12 -2
  328. package/dist/notifications/notificationContext.js.map +1 -1
  329. package/dist/style.css +1 -1
  330. package/dist/theme/antdTheme.cjs +1 -1
  331. package/dist/theme/antdTheme.cjs.map +1 -1
  332. package/dist/theme/antdTheme.js +2 -0
  333. package/dist/theme/antdTheme.js.map +1 -1
  334. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),t=require("react"),v=require("../../agent/core/usePrimitiveSurface.cjs"),y=require("./Avatar.cjs"),u=require("./Button.cjs"),x=require("./Chip.cjs"),_=require("./EmptyState.cjs"),f=require("./ErrorState.cjs");;/* empty css */const w=require("./PageHeader.cjs"),N=require("./Tabs.cjs"),q=require("./relativeTime.cjs"),m={info:"ghost",success:"default",warning:"caution",error:"warning"};function S({items:s,unreadCount:r=s.filter(i=>!i.read).length,onOpen:g,onMarkAllRead:n,error:o,onRetry:l,defaultFilter:h="all",surface:b}){const[i,p]=t.useState(h),c=t.useRef(null),j=v.usePrimitiveSurface(b,s,"list",c),d=t.useMemo(()=>i==="unread"?s.filter(e=>!e.read):s,[s,i]);return a.jsxs("div",{ref:c,className:"aegis-inbox",...j,children:[a.jsx(w.PageHeader,{title:"Inbox",description:"Workspace activity, alerts, and invites in one place.",action:n&&r>0?a.jsx(u.Button,{tone:"secondary",onClick:n,children:"Mark all as read"}):void 0}),a.jsx(N.Tabs,{activeKey:i,onChange:e=>{p(e==="unread"?"unread":"all")},items:[{key:"all",label:"All"},{key:"unread",label:`Unread${r>0?` (${String(r)})`:""}`}],children:o?a.jsx(f.ErrorState,{size:"compact",title:"Couldn't load notifications",description:o.message,action:l&&a.jsx(u.Button,{tone:"secondary",onClick:l,children:"Try again"})}):d.length===0?a.jsx(_.EmptyState,{title:i==="unread"?"No unread items":"No notifications",description:i==="unread"?"You're all caught up.":"Activity will appear here as it happens."}):a.jsx("ul",{className:"aegis-inbox__list",children:d.map(e=>a.jsx("li",{className:"aegis-inbox__row-wrap",children:a.jsxs("button",{type:"button",className:["aegis-inbox__row",e.read?"":"aegis-inbox__row--unread"].filter(Boolean).join(" "),onClick:()=>{g?.(e)},children:[a.jsx(y.Avatar,{name:e.actor??e.title,size:"md"}),a.jsxs("div",{className:"aegis-inbox__row-body",children:[a.jsxs("div",{className:"aegis-inbox__row-head",children:[a.jsx("span",{className:"aegis-inbox__row-title",children:e.title}),a.jsx("span",{className:"aegis-inbox__row-time",children:q.relativeTime(e.timestamp)})]}),e.body&&a.jsx("div",{className:"aegis-inbox__row-text",children:e.body}),(e.category??e.severity)&&a.jsxs("div",{className:"aegis-inbox__row-meta",children:[e.severity&&a.jsx(x.Chip,{tone:m[e.severity],children:e.severity}),e.category&&a.jsx(x.Chip,{tone:"ghost",children:e.category})]})]})]})},e.id))})})]})}exports.InboxPage=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),s=require("react"),N=require("../../agent/core/usePrimitiveSurface.cjs"),E=require("./Alert.cjs"),T=require("./Avatar.cjs"),u=require("./Button.cjs"),p=require("./Chip.cjs"),C=require("./EmptyState.cjs"),P=require("./ErrorState.cjs");;/* empty css */const k=require("./PageHeader.cjs"),A=require("./Tabs.cjs"),B=require("./relativeTime.cjs"),R=require("../../locale/useStrings.cjs"),I={info:"ghost",success:"default",warning:"caution",error:"warning"};function U({items:t,unreadCount:d=t.filter(r=>!r.read).length,onOpen:f,onMarkAllRead:x,error:g,liveError:v,onRetry:o,defaultFilter:m="all",surface:q}){const r=R.useStrings(),[i,w]=s.useState(m),b=s.useRef(null),S=N.usePrimitiveSurface(q,t,"list",b),h=s.useMemo(()=>i==="unread"?t.filter(e=>!e.read):t,[t,i]),a=t.length===0?g:null,c=v??(t.length===0?null:g),y=s.useRef(null),l=s.useRef(null),_=e=>{l.current=e.currentTarget,o?.()};return s.useEffect(()=>{const e=l.current;if(l.current=null,!e||e.isConnected||document.activeElement!==document.body)return;const j=y.current;(j?.querySelector(".aegis-inbox__row")??j)?.focus()},[a,c]),n.jsxs("div",{ref:b,className:"aegis-inbox",...S,children:[n.jsx(k.PageHeader,{title:r.inboxTitle,description:r.inboxDescription,action:x&&d>0?n.jsx(u.Button,{tone:"secondary",onClick:x,children:r.markAllRead}):void 0}),n.jsx(A.Tabs,{activeKey:i,onChange:e=>{w(e==="unread"?"unread":"all")},items:[{key:"all",label:r.inboxAll},{key:"unread",label:r.inboxUnread(d)}],children:a?n.jsx(P.ErrorState,{size:"compact",title:r.notificationsLoadFailed,description:a.message,action:o&&n.jsx(u.Button,{tone:"secondary",onClick:_,children:r.retry})}):n.jsxs("div",{ref:y,className:"aegis-inbox__panel",tabIndex:-1,children:[c&&n.jsxs(E.Alert,{tone:"warning",title:r.inboxStale,children:[c.message,o&&n.jsx("span",{className:"aegis-inbox__stale-action",children:n.jsx(u.Button,{tone:"secondary",onClick:_,children:r.retry})})]}),h.length===0?n.jsx(C.EmptyState,{title:i==="unread"?r.inboxNoUnread:r.inboxEmptyTitle,description:i==="unread"?r.notificationsCaughtUp:r.inboxEmptyDescription}):n.jsx("ul",{className:"aegis-inbox__list",children:h.map(e=>n.jsx("li",{className:"aegis-inbox__row-wrap",children:n.jsxs("button",{type:"button",className:["aegis-inbox__row",e.read?"":"aegis-inbox__row--unread"].filter(Boolean).join(" "),onClick:()=>{f?.(e)},children:[n.jsx(T.Avatar,{name:e.actor??e.title,size:"md"}),n.jsxs("div",{className:"aegis-inbox__row-body",children:[n.jsxs("div",{className:"aegis-inbox__row-head",children:[n.jsx("span",{className:"aegis-inbox__row-title",children:e.title}),n.jsx("span",{className:"aegis-inbox__row-time",children:B.relativeTime(e.timestamp,r)})]}),e.body&&n.jsx("div",{className:"aegis-inbox__row-text",children:e.body}),(e.category??e.severity)&&n.jsxs("div",{className:"aegis-inbox__row-meta",children:[e.severity&&n.jsx(p.Chip,{tone:I[e.severity],children:r.notificationSeverity(e.severity)}),e.category&&n.jsx(p.Chip,{tone:"ghost",children:e.category})]})]})]})},e.id))})]})})]})}exports.InboxPage=U;
2
2
  //# sourceMappingURL=InboxPage.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"InboxPage.cjs","sources":["../../../src/components/ui/InboxPage.tsx"],"sourcesContent":["import { type ReactElement, useMemo, useRef, useState } from 'react';\n\nimport {\n type PrimitiveSurface,\n usePrimitiveSurface,\n} from '../../agent/core/usePrimitiveSurface';\nimport type { AegisNotification } from '../../notifications';\nimport { Avatar } from './Avatar';\nimport { Button } from './Button';\nimport { Chip } from './Chip';\nimport { EmptyState } from './EmptyState';\nimport { ErrorState } from './ErrorState';\nimport './InboxPage.css';\nimport { PageHeader } from './PageHeader';\nimport { Tabs } from './Tabs';\nimport { relativeTime } from './relativeTime';\n\ntype Filter = 'all' | 'unread';\n\nexport type InboxPageSurface = PrimitiveSurface<AegisNotification[]>;\n\nexport interface InboxPageProps {\n items: AegisNotification[];\n /** Shown on the Unread tab. Defaults to the number of unread `items`. */\n unreadCount?: number;\n /**\n * Fired when the user opens an item. The host marks it read and\n * navigates to `item.to`.\n */\n onOpen?: (item: AegisNotification) => void;\n /** Renders \"Mark all as read\" while anything is unread. */\n onMarkAllRead?: () => void;\n /** Set when the items failed to load; shown in place of the list. */\n error?: Error | null;\n /** Renders a retry button alongside `error`. */\n onRetry?: () => void;\n defaultFilter?: Filter;\n surface?: InboxPageSurface;\n}\n\nconst SEVERITY_TONE: Record<\n NonNullable<AegisNotification['severity']>,\n 'default' | 'caution' | 'warning' | 'ghost'\n> = {\n info: 'ghost',\n success: 'default',\n warning: 'caution',\n error: 'warning',\n};\n\nexport function InboxPage({\n items,\n unreadCount = items.filter((n) => !n.read).length,\n onOpen,\n onMarkAllRead,\n error,\n onRetry,\n defaultFilter = 'all',\n surface,\n}: InboxPageProps): ReactElement {\n const [filter, setFilter] = useState<Filter>(defaultFilter);\n const wrapRef = useRef<HTMLDivElement>(null);\n const agentAttrs = usePrimitiveSurface(surface, items, 'list', wrapRef);\n\n const visible = useMemo(\n () => (filter === 'unread' ? items.filter((n) => !n.read) : items),\n [items, filter],\n );\n\n return (\n <div ref={wrapRef} className=\"aegis-inbox\" {...agentAttrs}>\n <PageHeader\n title=\"Inbox\"\n description=\"Workspace activity, alerts, and invites in one place.\"\n action={\n onMarkAllRead && unreadCount > 0 ? (\n <Button tone=\"secondary\" onClick={onMarkAllRead}>\n Mark all as read\n </Button>\n ) : undefined\n }\n />\n\n <Tabs\n activeKey={filter}\n onChange={(key) => {\n setFilter(key === 'unread' ? 'unread' : 'all');\n }}\n items={[\n { key: 'all', label: 'All' },\n {\n key: 'unread',\n label: `Unread${unreadCount > 0 ? ` (${String(unreadCount)})` : ''}`,\n },\n ]}\n >\n {error ? (\n <ErrorState\n size=\"compact\"\n title=\"Couldn't load notifications\"\n description={error.message}\n action={\n onRetry && (\n <Button tone=\"secondary\" onClick={onRetry}>\n Try again\n </Button>\n )\n }\n />\n ) : visible.length === 0 ? (\n <EmptyState\n title={filter === 'unread' ? 'No unread items' : 'No notifications'}\n description={\n filter === 'unread'\n ? \"You're all caught up.\"\n : 'Activity will appear here as it happens.'\n }\n />\n ) : (\n <ul className=\"aegis-inbox__list\">\n {visible.map((item) => (\n <li key={item.id} className=\"aegis-inbox__row-wrap\">\n <button\n type=\"button\"\n className={[\n 'aegis-inbox__row',\n item.read ? '' : 'aegis-inbox__row--unread',\n ]\n .filter(Boolean)\n .join(' ')}\n onClick={() => {\n onOpen?.(item);\n }}\n >\n <Avatar name={item.actor ?? item.title} size=\"md\" />\n <div className=\"aegis-inbox__row-body\">\n <div className=\"aegis-inbox__row-head\">\n <span className=\"aegis-inbox__row-title\">\n {item.title}\n </span>\n <span className=\"aegis-inbox__row-time\">\n {relativeTime(item.timestamp)}\n </span>\n </div>\n {item.body && (\n <div className=\"aegis-inbox__row-text\">{item.body}</div>\n )}\n {(item.category ?? item.severity) && (\n <div className=\"aegis-inbox__row-meta\">\n {item.severity && (\n <Chip tone={SEVERITY_TONE[item.severity]}>\n {item.severity}\n </Chip>\n )}\n {item.category && (\n <Chip tone=\"ghost\">{item.category}</Chip>\n )}\n </div>\n )}\n </div>\n </button>\n </li>\n ))}\n </ul>\n )}\n </Tabs>\n </div>\n );\n}\n"],"names":["SEVERITY_TONE","InboxPage","items","unreadCount","n","onOpen","onMarkAllRead","error","onRetry","defaultFilter","surface","filter","setFilter","useState","wrapRef","useRef","agentAttrs","usePrimitiveSurface","visible","useMemo","jsx","PageHeader","Button","Tabs","key","ErrorState","EmptyState","item","jsxs","Avatar","relativeTime","Chip"],"mappings":"icAwCMA,EAGF,CACF,KAAM,QACN,QAAS,UACT,QAAS,UACT,MAAO,SACT,EAEO,SAASC,EAAU,CACxB,MAAAC,EACA,YAAAC,EAAcD,EAAM,OAAQE,GAAM,CAACA,EAAE,IAAI,EAAE,OAC3C,OAAAC,EACA,cAAAC,EACA,MAAAC,EACA,QAAAC,EACA,cAAAC,EAAgB,MAChB,QAAAC,CACF,EAAiC,CAC/B,KAAM,CAACC,EAAQC,CAAS,EAAIC,EAAAA,SAAiBJ,CAAa,EACpDK,EAAUC,EAAAA,OAAuB,IAAI,EACrCC,EAAaC,EAAAA,oBAAoBP,EAASR,EAAO,OAAQY,CAAO,EAEh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,SAAA,CAAAP,MAACS,EAAAA,QAAO,KAAMF,EAAK,OAASA,EAAK,MAAO,KAAK,KAAK,EAClDC,EAAAA,KAAC,MAAA,CAAI,UAAU,wBACb,SAAA,CAAAA,EAAAA,KAAC,MAAA,CAAI,UAAU,wBACb,SAAA,CAAAR,EAAAA,IAAC,OAAA,CAAK,UAAU,yBACb,SAAAO,EAAK,MACR,QACC,OAAA,CAAK,UAAU,wBACb,SAAAG,EAAAA,aAAaH,EAAK,SAAS,CAAA,CAC9B,CAAA,EACF,EACCA,EAAK,MACJP,EAAAA,IAAC,OAAI,UAAU,wBAAyB,WAAK,KAAK,GAElDO,EAAK,UAAYA,EAAK,WACtBC,OAAC,MAAA,CAAI,UAAU,wBACZ,SAAA,CAAAD,EAAK,gBACHI,EAAAA,KAAA,CAAK,KAAM/B,EAAc2B,EAAK,QAAQ,EACpC,SAAAA,EAAK,QAAA,CACR,EAEDA,EAAK,UACJP,EAAAA,IAACW,QAAK,KAAK,QAAS,WAAK,QAAA,CAAS,CAAA,CAAA,CAEtC,CAAA,CAAA,CAEJ,CAAA,CAAA,CAAA,GAtCKJ,EAAK,EAwCd,CACD,CAAA,CACH,CAAA,CAAA,CAEJ,EACF,CAEJ"}
1
+ {"version":3,"file":"InboxPage.cjs","sources":["../../../src/components/ui/InboxPage.tsx"],"sourcesContent":["import {\n type MouseEvent,\n type ReactElement,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport {\n type PrimitiveSurface,\n usePrimitiveSurface,\n} from '../../agent/core/usePrimitiveSurface';\nimport { useStrings } from '../../locale';\nimport type { AegisNotification } from '../../notifications';\nimport { Alert } from './Alert';\nimport { Avatar } from './Avatar';\nimport { Button } from './Button';\nimport { Chip } from './Chip';\nimport { EmptyState } from './EmptyState';\nimport { ErrorState } from './ErrorState';\nimport './InboxPage.css';\nimport { PageHeader } from './PageHeader';\nimport { Tabs } from './Tabs';\nimport { relativeTime } from './relativeTime';\n\ntype Filter = 'all' | 'unread';\n\nexport type InboxPageSurface = PrimitiveSurface<AegisNotification[]>;\n\nexport interface InboxPageProps {\n items: AegisNotification[];\n /** Shown on the Unread tab. Defaults to the number of unread `items`. */\n unreadCount?: number;\n /**\n * Fired when the user opens an item. The host marks it read and\n * navigates to `item.to`.\n */\n onOpen?: (item: AegisNotification) => void;\n /** Renders \"Mark all as read\" while anything is unread. */\n onMarkAllRead?: () => void;\n /**\n * Set when loading failed. With no `items` it is shown in place of the\n * list; items from an earlier load stay under a notice, as for\n * `liveError`.\n */\n error?: Error | null;\n /**\n * Set while keeping the items current is failing; a notice above the\n * list says it may be out of date, and the list stays.\n */\n liveError?: Error | null;\n /** Renders a retry button alongside `error` and `liveError`. */\n onRetry?: () => void;\n defaultFilter?: Filter;\n surface?: InboxPageSurface;\n}\n\nconst SEVERITY_TONE: Record<\n NonNullable<AegisNotification['severity']>,\n 'default' | 'caution' | 'warning' | 'ghost'\n> = {\n info: 'ghost',\n success: 'default',\n warning: 'caution',\n error: 'warning',\n};\n\nexport function InboxPage({\n items,\n unreadCount = items.filter((n) => !n.read).length,\n onOpen,\n onMarkAllRead,\n error,\n liveError,\n onRetry,\n defaultFilter = 'all',\n surface,\n}: InboxPageProps): ReactElement {\n const strings = useStrings();\n const [filter, setFilter] = useState<Filter>(defaultFilter);\n const wrapRef = useRef<HTMLDivElement>(null);\n const agentAttrs = usePrimitiveSurface(surface, items, 'list', wrapRef);\n\n const visible = useMemo(\n () => (filter === 'unread' ? items.filter((n) => !n.read) : items),\n [items, filter],\n );\n const loadError = items.length === 0 ? error : null;\n const staleError = liveError ?? (items.length === 0 ? null : error);\n\n const panelRef = useRef<HTMLDivElement>(null);\n const retryButton = useRef<HTMLButtonElement | null>(null);\n const retry = (event: MouseEvent<HTMLButtonElement>): void => {\n retryButton.current = event.currentTarget;\n onRetry?.();\n };\n // A retry that works removes its retry button, and focus with it;\n // focus goes on to the first item, or to the list area when it is empty.\n // Only the first state change after a press counts, so a later background\n // recovery leaves focus where it is.\n useEffect(() => {\n const button = retryButton.current;\n retryButton.current = null;\n if (!button || button.isConnected) {\n return;\n }\n if (document.activeElement !== document.body) {\n return;\n }\n const panel = panelRef.current;\n (panel?.querySelector<HTMLElement>('.aegis-inbox__row') ?? panel)?.focus();\n }, [loadError, staleError]);\n\n return (\n <div ref={wrapRef} className=\"aegis-inbox\" {...agentAttrs}>\n <PageHeader\n title={strings.inboxTitle}\n description={strings.inboxDescription}\n action={\n onMarkAllRead && unreadCount > 0 ? (\n <Button tone=\"secondary\" onClick={onMarkAllRead}>\n {strings.markAllRead}\n </Button>\n ) : undefined\n }\n />\n\n <Tabs\n activeKey={filter}\n onChange={(key) => {\n setFilter(key === 'unread' ? 'unread' : 'all');\n }}\n items={[\n { key: 'all', label: strings.inboxAll },\n { key: 'unread', label: strings.inboxUnread(unreadCount) },\n ]}\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={retry}>\n {strings.retry}\n </Button>\n )\n }\n />\n ) : (\n <div ref={panelRef} className=\"aegis-inbox__panel\" tabIndex={-1}>\n {staleError && (\n <Alert tone=\"warning\" title={strings.inboxStale}>\n {staleError.message}\n {onRetry && (\n <span className=\"aegis-inbox__stale-action\">\n <Button tone=\"secondary\" onClick={retry}>\n {strings.retry}\n </Button>\n </span>\n )}\n </Alert>\n )}\n {visible.length === 0 ? (\n <EmptyState\n title={\n filter === 'unread'\n ? strings.inboxNoUnread\n : strings.inboxEmptyTitle\n }\n description={\n filter === 'unread'\n ? strings.notificationsCaughtUp\n : strings.inboxEmptyDescription\n }\n />\n ) : (\n <ul className=\"aegis-inbox__list\">\n {visible.map((item) => (\n <li key={item.id} className=\"aegis-inbox__row-wrap\">\n <button\n type=\"button\"\n className={[\n 'aegis-inbox__row',\n item.read ? '' : 'aegis-inbox__row--unread',\n ]\n .filter(Boolean)\n .join(' ')}\n onClick={() => {\n onOpen?.(item);\n }}\n >\n <Avatar name={item.actor ?? item.title} size=\"md\" />\n <div className=\"aegis-inbox__row-body\">\n <div className=\"aegis-inbox__row-head\">\n <span className=\"aegis-inbox__row-title\">\n {item.title}\n </span>\n <span className=\"aegis-inbox__row-time\">\n {relativeTime(item.timestamp, strings)}\n </span>\n </div>\n {item.body && (\n <div className=\"aegis-inbox__row-text\">\n {item.body}\n </div>\n )}\n {(item.category ?? item.severity) && (\n <div className=\"aegis-inbox__row-meta\">\n {item.severity && (\n <Chip tone={SEVERITY_TONE[item.severity]}>\n {strings.notificationSeverity(item.severity)}\n </Chip>\n )}\n {item.category && (\n <Chip tone=\"ghost\">{item.category}</Chip>\n )}\n </div>\n )}\n </div>\n </button>\n </li>\n ))}\n </ul>\n )}\n </div>\n )}\n </Tabs>\n </div>\n );\n}\n"],"names":["SEVERITY_TONE","InboxPage","items","unreadCount","n","onOpen","onMarkAllRead","error","liveError","onRetry","defaultFilter","surface","strings","useStrings","filter","setFilter","useState","wrapRef","useRef","agentAttrs","usePrimitiveSurface","visible","useMemo","loadError","staleError","panelRef","retryButton","retry","event","useEffect","button","panel","jsx","PageHeader","Button","Tabs","key","ErrorState","Alert","EmptyState","item","jsxs","Avatar","Chip"],"mappings":"mgBA0DMA,EAGF,CACF,KAAM,QACN,QAAS,UACT,QAAS,UACT,MAAO,SACT,EAEO,SAASC,EAAU,CACxB,MAAAC,EACA,YAAAC,EAAcD,EAAM,OAAQE,GAAM,CAACA,EAAE,IAAI,EAAE,OAC3C,OAAAC,EACA,cAAAC,EACA,MAAAC,EACA,UAAAC,EACA,QAAAC,EACA,cAAAC,EAAgB,MAChB,QAAAC,CACF,EAAiC,CAC/B,MAAMC,EAAUC,EAAAA,WAAA,EACV,CAACC,EAAQC,CAAS,EAAIC,EAAAA,SAAiBN,CAAa,EACpDO,EAAUC,EAAAA,OAAuB,IAAI,EACrCC,EAAaC,EAAAA,oBAAoBT,EAAST,EAAO,OAAQe,CAAO,EAEhEI,EAAUC,EAAAA,QACd,IAAOR,IA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ACtBC,OAAC,MAAA,CAAI,UAAU,wBACZ,SAAA,CAAAD,EAAK,UACJR,EAAAA,IAACW,EAAAA,KAAA,CAAK,KAAM3C,EAAcwC,EAAK,QAAQ,EACpC,SAAA5B,EAAQ,qBAAqB4B,EAAK,QAAQ,EAC7C,EAEDA,EAAK,UACJR,EAAAA,IAACW,QAAK,KAAK,QAAS,WAAK,QAAA,CAAS,CAAA,CAAA,CAEtC,CAAA,CAAA,CAEJ,CAAA,CAAA,CAAA,GAxCKH,EAAK,EA0Cd,CACD,CAAA,CACH,CAAA,CAAA,CAEJ,CAAA,CAAA,CAEJ,EACF,CAEJ"}
@@ -14,12 +14,21 @@ export interface InboxPageProps {
14
14
  onOpen?: (item: AegisNotification) => void;
15
15
  /** Renders "Mark all as read" while anything is unread. */
16
16
  onMarkAllRead?: () => void;
17
- /** Set when the items failed to load; shown in place of the list. */
17
+ /**
18
+ * Set when loading failed. With no `items` it is shown in place of the
19
+ * list; items from an earlier load stay under a notice, as for
20
+ * `liveError`.
21
+ */
18
22
  error?: Error | null;
19
- /** Renders a retry button alongside `error`. */
23
+ /**
24
+ * Set while keeping the items current is failing; a notice above the
25
+ * list says it may be out of date, and the list stays.
26
+ */
27
+ liveError?: Error | null;
28
+ /** Renders a retry button alongside `error` and `liveError`. */
20
29
  onRetry?: () => void;
21
30
  defaultFilter?: Filter;
22
31
  surface?: InboxPageSurface;
23
32
  }
24
- export declare function InboxPage({ items, unreadCount, onOpen, onMarkAllRead, error, onRetry, defaultFilter, surface, }: InboxPageProps): ReactElement;
33
+ export declare function InboxPage({ items, unreadCount, onOpen, onMarkAllRead, error, liveError, onRetry, defaultFilter, surface, }: InboxPageProps): ReactElement;
25
34
  export {};
@@ -1,104 +1,118 @@
1
- import { jsxs as o, jsx as i } from "react/jsx-runtime";
2
- import { useState as _, useRef as y, useMemo as v } from "react";
3
- import { usePrimitiveSurface as x } from "../../agent/core/usePrimitiveSurface.js";
4
- import { Avatar as w } from "./Avatar.js";
5
- import { Button as p } from "./Button.js";
6
- import { Chip as m } from "./Chip.js";
7
- import { EmptyState as N } from "./EmptyState.js";
8
- import { ErrorState as k } from "./ErrorState.js";
1
+ import { jsxs as i, jsx as n } from "react/jsx-runtime";
2
+ import { useState as T, useRef as d, useMemo as k, useEffect as A } from "react";
3
+ import { usePrimitiveSurface as j } from "../../agent/core/usePrimitiveSurface.js";
4
+ import { Alert as B } from "./Alert.js";
5
+ import { Avatar as I } from "./Avatar.js";
6
+ import { Button as u } from "./Button.js";
7
+ import { Chip as y } from "./Chip.js";
8
+ import { EmptyState as P } from "./EmptyState.js";
9
+ import { ErrorState as U } from "./ErrorState.js";
9
10
  /* empty css */
10
- import { PageHeader as S } from "./PageHeader.js";
11
- import { Tabs as E } from "./Tabs.js";
12
- import { relativeTime as T } from "./relativeTime.js";
13
- const C = {
11
+ import { PageHeader as z } from "./PageHeader.js";
12
+ import { Tabs as D } from "./Tabs.js";
13
+ import { relativeTime as F } from "./relativeTime.js";
14
+ import { useStrings as R } from "../../locale/useStrings.js";
15
+ const q = {
14
16
  info: "ghost",
15
17
  success: "default",
16
18
  warning: "caution",
17
19
  error: "warning"
18
20
  };
19
- function O({
20
- items: r,
21
- unreadCount: n = r.filter((a) => !a.read).length,
22
- onOpen: g,
23
- onMarkAllRead: t,
24
- error: s,
25
- onRetry: l,
26
- defaultFilter: h = "all",
27
- surface: f
21
+ function ee({
22
+ items: o,
23
+ unreadCount: m = o.filter((r) => !r.read).length,
24
+ onOpen: v,
25
+ onMarkAllRead: p,
26
+ error: g,
27
+ liveError: w,
28
+ onRetry: a,
29
+ defaultFilter: N = "all",
30
+ surface: E
28
31
  }) {
29
- const [a, u] = _(h), c = y(null), b = x(f, r, "list", c), d = v(
30
- () => a === "unread" ? r.filter((e) => !e.read) : r,
31
- [r, a]
32
- );
33
- return /* @__PURE__ */ o("div", { ref: c, className: "aegis-inbox", ...b, children: [
34
- /* @__PURE__ */ i(
35
- S,
32
+ const r = R(), [t, S] = T(N), b = d(null), C = j(E, o, "list", b), f = k(
33
+ () => t === "unread" ? o.filter((e) => !e.read) : o,
34
+ [o, t]
35
+ ), s = o.length === 0 ? g : null, l = w ?? (o.length === 0 ? null : g), h = d(null), c = d(null), x = (e) => {
36
+ c.current = e.currentTarget, a?.();
37
+ };
38
+ return A(() => {
39
+ const e = c.current;
40
+ if (c.current = null, !e || e.isConnected || document.activeElement !== document.body)
41
+ return;
42
+ const _ = h.current;
43
+ (_?.querySelector(".aegis-inbox__row") ?? _)?.focus();
44
+ }, [s, l]), /* @__PURE__ */ i("div", { ref: b, className: "aegis-inbox", ...C, children: [
45
+ /* @__PURE__ */ n(
46
+ z,
36
47
  {
37
- title: "Inbox",
38
- description: "Workspace activity, alerts, and invites in one place.",
39
- action: t && n > 0 ? /* @__PURE__ */ i(p, { tone: "secondary", onClick: t, children: "Mark all as read" }) : void 0
48
+ title: r.inboxTitle,
49
+ description: r.inboxDescription,
50
+ action: p && m > 0 ? /* @__PURE__ */ n(u, { tone: "secondary", onClick: p, children: r.markAllRead }) : void 0
40
51
  }
41
52
  ),
42
- /* @__PURE__ */ i(
43
- E,
53
+ /* @__PURE__ */ n(
54
+ D,
44
55
  {
45
- activeKey: a,
56
+ activeKey: t,
46
57
  onChange: (e) => {
47
- u(e === "unread" ? "unread" : "all");
58
+ S(e === "unread" ? "unread" : "all");
48
59
  },
49
60
  items: [
50
- { key: "all", label: "All" },
51
- {
52
- key: "unread",
53
- label: `Unread${n > 0 ? ` (${String(n)})` : ""}`
54
- }
61
+ { key: "all", label: r.inboxAll },
62
+ { key: "unread", label: r.inboxUnread(m) }
55
63
  ],
56
- children: s ? /* @__PURE__ */ i(
57
- k,
64
+ children: s ? /* @__PURE__ */ n(
65
+ U,
58
66
  {
59
67
  size: "compact",
60
- title: "Couldn't load notifications",
68
+ title: r.notificationsLoadFailed,
61
69
  description: s.message,
62
- action: l && /* @__PURE__ */ i(p, { tone: "secondary", onClick: l, children: "Try again" })
63
- }
64
- ) : d.length === 0 ? /* @__PURE__ */ i(
65
- N,
66
- {
67
- title: a === "unread" ? "No unread items" : "No notifications",
68
- description: a === "unread" ? "You're all caught up." : "Activity will appear here as it happens."
70
+ action: a && /* @__PURE__ */ n(u, { tone: "secondary", onClick: x, children: r.retry })
69
71
  }
70
- ) : /* @__PURE__ */ i("ul", { className: "aegis-inbox__list", children: d.map((e) => /* @__PURE__ */ i("li", { className: "aegis-inbox__row-wrap", children: /* @__PURE__ */ o(
71
- "button",
72
- {
73
- type: "button",
74
- className: [
75
- "aegis-inbox__row",
76
- e.read ? "" : "aegis-inbox__row--unread"
77
- ].filter(Boolean).join(" "),
78
- onClick: () => {
79
- g?.(e);
80
- },
81
- children: [
82
- /* @__PURE__ */ i(w, { name: e.actor ?? e.title, size: "md" }),
83
- /* @__PURE__ */ o("div", { className: "aegis-inbox__row-body", children: [
84
- /* @__PURE__ */ o("div", { className: "aegis-inbox__row-head", children: [
85
- /* @__PURE__ */ i("span", { className: "aegis-inbox__row-title", children: e.title }),
86
- /* @__PURE__ */ i("span", { className: "aegis-inbox__row-time", children: T(e.timestamp) })
87
- ] }),
88
- e.body && /* @__PURE__ */ i("div", { className: "aegis-inbox__row-text", children: e.body }),
89
- (e.category ?? e.severity) && /* @__PURE__ */ o("div", { className: "aegis-inbox__row-meta", children: [
90
- e.severity && /* @__PURE__ */ i(m, { tone: C[e.severity], children: e.severity }),
91
- e.category && /* @__PURE__ */ i(m, { tone: "ghost", children: e.category })
72
+ ) : /* @__PURE__ */ i("div", { ref: h, className: "aegis-inbox__panel", tabIndex: -1, children: [
73
+ l && /* @__PURE__ */ i(B, { tone: "warning", title: r.inboxStale, children: [
74
+ l.message,
75
+ a && /* @__PURE__ */ n("span", { className: "aegis-inbox__stale-action", children: /* @__PURE__ */ n(u, { tone: "secondary", onClick: x, children: r.retry }) })
76
+ ] }),
77
+ f.length === 0 ? /* @__PURE__ */ n(
78
+ P,
79
+ {
80
+ title: t === "unread" ? r.inboxNoUnread : r.inboxEmptyTitle,
81
+ description: t === "unread" ? r.notificationsCaughtUp : r.inboxEmptyDescription
82
+ }
83
+ ) : /* @__PURE__ */ n("ul", { className: "aegis-inbox__list", children: f.map((e) => /* @__PURE__ */ n("li", { className: "aegis-inbox__row-wrap", children: /* @__PURE__ */ i(
84
+ "button",
85
+ {
86
+ type: "button",
87
+ className: [
88
+ "aegis-inbox__row",
89
+ e.read ? "" : "aegis-inbox__row--unread"
90
+ ].filter(Boolean).join(" "),
91
+ onClick: () => {
92
+ v?.(e);
93
+ },
94
+ children: [
95
+ /* @__PURE__ */ n(I, { name: e.actor ?? e.title, size: "md" }),
96
+ /* @__PURE__ */ i("div", { className: "aegis-inbox__row-body", children: [
97
+ /* @__PURE__ */ i("div", { className: "aegis-inbox__row-head", children: [
98
+ /* @__PURE__ */ n("span", { className: "aegis-inbox__row-title", children: e.title }),
99
+ /* @__PURE__ */ n("span", { className: "aegis-inbox__row-time", children: F(e.timestamp, r) })
100
+ ] }),
101
+ e.body && /* @__PURE__ */ n("div", { className: "aegis-inbox__row-text", children: e.body }),
102
+ (e.category ?? e.severity) && /* @__PURE__ */ i("div", { className: "aegis-inbox__row-meta", children: [
103
+ e.severity && /* @__PURE__ */ n(y, { tone: q[e.severity], children: r.notificationSeverity(e.severity) }),
104
+ e.category && /* @__PURE__ */ n(y, { tone: "ghost", children: e.category })
105
+ ] })
92
106
  ] })
93
- ] })
94
- ]
95
- }
96
- ) }, e.id)) })
107
+ ]
108
+ }
109
+ ) }, e.id)) })
110
+ ] })
97
111
  }
98
112
  )
99
113
  ] });
100
114
  }
101
115
  export {
102
- O as InboxPage
116
+ ee as InboxPage
103
117
  };
104
118
  //# sourceMappingURL=InboxPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InboxPage.js","sources":["../../../src/components/ui/InboxPage.tsx"],"sourcesContent":["import { type ReactElement, useMemo, useRef, useState } from 'react';\n\nimport {\n type PrimitiveSurface,\n usePrimitiveSurface,\n} from '../../agent/core/usePrimitiveSurface';\nimport type { AegisNotification } from '../../notifications';\nimport { Avatar } from './Avatar';\nimport { Button } from './Button';\nimport { Chip } from './Chip';\nimport { EmptyState } from './EmptyState';\nimport { ErrorState } from './ErrorState';\nimport './InboxPage.css';\nimport { PageHeader } from './PageHeader';\nimport { Tabs } from './Tabs';\nimport { relativeTime } from './relativeTime';\n\ntype Filter = 'all' | 'unread';\n\nexport type InboxPageSurface = PrimitiveSurface<AegisNotification[]>;\n\nexport interface InboxPageProps {\n items: AegisNotification[];\n /** Shown on the Unread tab. Defaults to the number of unread `items`. */\n unreadCount?: number;\n /**\n * Fired when the user opens an item. The host marks it read and\n * navigates to `item.to`.\n */\n onOpen?: (item: AegisNotification) => void;\n /** Renders \"Mark all as read\" while anything is unread. */\n onMarkAllRead?: () => void;\n /** Set when the items failed to load; shown in place of the list. */\n error?: Error | null;\n /** Renders a retry button alongside `error`. */\n onRetry?: () => void;\n defaultFilter?: Filter;\n surface?: InboxPageSurface;\n}\n\nconst SEVERITY_TONE: Record<\n NonNullable<AegisNotification['severity']>,\n 'default' | 'caution' | 'warning' | 'ghost'\n> = {\n info: 'ghost',\n success: 'default',\n warning: 'caution',\n error: 'warning',\n};\n\nexport function InboxPage({\n items,\n unreadCount = items.filter((n) => !n.read).length,\n onOpen,\n onMarkAllRead,\n error,\n onRetry,\n defaultFilter = 'all',\n surface,\n}: InboxPageProps): ReactElement {\n const [filter, setFilter] = useState<Filter>(defaultFilter);\n const wrapRef = useRef<HTMLDivElement>(null);\n const agentAttrs = usePrimitiveSurface(surface, items, 'list', wrapRef);\n\n const visible = useMemo(\n () => (filter === 'unread' ? items.filter((n) => !n.read) : items),\n [items, filter],\n );\n\n return (\n <div ref={wrapRef} className=\"aegis-inbox\" {...agentAttrs}>\n <PageHeader\n title=\"Inbox\"\n description=\"Workspace activity, alerts, and invites in one place.\"\n action={\n onMarkAllRead && unreadCount > 0 ? (\n <Button tone=\"secondary\" onClick={onMarkAllRead}>\n Mark all as read\n </Button>\n ) : undefined\n }\n />\n\n <Tabs\n activeKey={filter}\n onChange={(key) => {\n setFilter(key === 'unread' ? 'unread' : 'all');\n }}\n items={[\n { key: 'all', label: 'All' },\n {\n key: 'unread',\n label: `Unread${unreadCount > 0 ? ` (${String(unreadCount)})` : ''}`,\n },\n ]}\n >\n {error ? (\n <ErrorState\n size=\"compact\"\n title=\"Couldn't load notifications\"\n description={error.message}\n action={\n onRetry && (\n <Button tone=\"secondary\" onClick={onRetry}>\n Try again\n </Button>\n )\n }\n />\n ) : visible.length === 0 ? (\n <EmptyState\n title={filter === 'unread' ? 'No unread items' : 'No notifications'}\n description={\n filter === 'unread'\n ? \"You're all caught up.\"\n : 'Activity will appear here as it happens.'\n }\n />\n ) : (\n <ul className=\"aegis-inbox__list\">\n {visible.map((item) => (\n <li key={item.id} className=\"aegis-inbox__row-wrap\">\n <button\n type=\"button\"\n className={[\n 'aegis-inbox__row',\n item.read ? '' : 'aegis-inbox__row--unread',\n ]\n .filter(Boolean)\n .join(' ')}\n onClick={() => {\n onOpen?.(item);\n }}\n >\n <Avatar name={item.actor ?? item.title} size=\"md\" />\n <div className=\"aegis-inbox__row-body\">\n <div className=\"aegis-inbox__row-head\">\n <span className=\"aegis-inbox__row-title\">\n {item.title}\n </span>\n <span className=\"aegis-inbox__row-time\">\n {relativeTime(item.timestamp)}\n </span>\n </div>\n {item.body && (\n <div className=\"aegis-inbox__row-text\">{item.body}</div>\n )}\n {(item.category ?? item.severity) && (\n <div className=\"aegis-inbox__row-meta\">\n {item.severity && (\n <Chip tone={SEVERITY_TONE[item.severity]}>\n {item.severity}\n </Chip>\n )}\n {item.category && (\n <Chip tone=\"ghost\">{item.category}</Chip>\n )}\n </div>\n )}\n </div>\n </button>\n </li>\n ))}\n </ul>\n )}\n </Tabs>\n </div>\n );\n}\n"],"names":["SEVERITY_TONE","InboxPage","items","unreadCount","n","onOpen","onMarkAllRead","error","onRetry","defaultFilter","surface","filter","setFilter","useState","wrapRef","useRef","agentAttrs","usePrimitiveSurface","visible","useMemo","jsx","P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AAU,yBAAyB,YAAK,MAAK;AAAA,iBAElDO,EAAK,YAAYA,EAAK,aACtB,gBAAAC,EAAC,OAAA,EAAI,WAAU,yBACZ,UAAA;AAAA,kBAAAD,EAAK,8BACHI,GAAA,EAAK,MAAM/B,EAAc2B,EAAK,QAAQ,GACpC,UAAAA,EAAK,SAAA,CACR;AAAA,kBAEDA,EAAK,YACJ,gBAAAP,EAACW,KAAK,MAAK,SAAS,YAAK,SAAA,CAAS;AAAA,gBAAA,EAAA,CAEtC;AAAA,cAAA,EAAA,CAEJ;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA,KAtCKJ,EAAK,EAwCd,CACD,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAEJ,GACF;AAEJ;"}
1
+ {"version":3,"file":"InboxPage.js","sources":["../../../src/components/ui/InboxPage.tsx"],"sourcesContent":["import {\n type MouseEvent,\n type ReactElement,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport {\n type PrimitiveSurface,\n usePrimitiveSurface,\n} from '../../agent/core/usePrimitiveSurface';\nimport { useStrings } from '../../locale';\nimport type { AegisNotification } from '../../notifications';\nimport { Alert } from './Alert';\nimport { Avatar } from './Avatar';\nimport { Button } from './Button';\nimport { Chip } from './Chip';\nimport { EmptyState } from './EmptyState';\nimport { ErrorState } from './ErrorState';\nimport './InboxPage.css';\nimport { PageHeader } from './PageHeader';\nimport { Tabs } from './Tabs';\nimport { relativeTime } from './relativeTime';\n\ntype Filter = 'all' | 'unread';\n\nexport type InboxPageSurface = PrimitiveSurface<AegisNotification[]>;\n\nexport interface InboxPageProps {\n items: AegisNotification[];\n /** Shown on the Unread tab. Defaults to the number of unread `items`. */\n unreadCount?: number;\n /**\n * Fired when the user opens an item. The host marks it read and\n * navigates to `item.to`.\n */\n onOpen?: (item: AegisNotification) => void;\n /** Renders \"Mark all as read\" while anything is unread. */\n onMarkAllRead?: () => void;\n /**\n * Set when loading failed. With no `items` it is shown in place of the\n * list; items from an earlier load stay under a notice, as for\n * `liveError`.\n */\n error?: Error | null;\n /**\n * Set while keeping the items current is failing; a notice above the\n * list says it may be out of date, and the list stays.\n */\n liveError?: Error | null;\n /** Renders a retry button alongside `error` and `liveError`. */\n onRetry?: () => void;\n defaultFilter?: Filter;\n surface?: InboxPageSurface;\n}\n\nconst SEVERITY_TONE: Record<\n NonNullable<AegisNotification['severity']>,\n 'default' | 'caution' | 'warning' | 'ghost'\n> = {\n info: 'ghost',\n success: 'default',\n warning: 'caution',\n error: 'warning',\n};\n\nexport function InboxPage({\n items,\n unreadCount = items.filter((n) => !n.read).length,\n onOpen,\n onMarkAllRead,\n error,\n liveError,\n onRetry,\n defaultFilter = 'all',\n surface,\n}: InboxPageProps): ReactElement {\n const strings = useStrings();\n const [filter, setFilter] = useState<Filter>(defaultFilter);\n const wrapRef = useRef<HTMLDivElement>(null);\n const agentAttrs = usePrimitiveSurface(surface, items, 'list', wrapRef);\n\n const visible = useMemo(\n () => (filter === 'unread' ? items.filter((n) => !n.read) : items),\n [items, filter],\n );\n const loadError = items.length === 0 ? error : null;\n const staleError = liveError ?? (items.length === 0 ? null : error);\n\n const panelRef = useRef<HTMLDivElement>(null);\n const retryButton = useRef<HTMLButtonElement | null>(null);\n const retry = (event: MouseEvent<HTMLButtonElement>): void => {\n retryButton.current = event.currentTarget;\n onRetry?.();\n };\n // A retry that works removes its retry button, and focus with it;\n // focus goes on to the first item, or to the list area when it is empty.\n // Only the first state change after a press counts, so a later background\n // recovery leaves focus where it is.\n useEffect(() => {\n const button = retryButton.current;\n retryButton.current = null;\n if (!button || button.isConnected) {\n return;\n }\n if (document.activeElement !== document.body) {\n return;\n }\n const panel = panelRef.current;\n (panel?.querySelector<HTMLElement>('.aegis-inbox__row') ?? panel)?.focus();\n }, [loadError, staleError]);\n\n return (\n <div ref={wrapRef} className=\"aegis-inbox\" {...agentAttrs}>\n <PageHeader\n title={strings.inboxTitle}\n description={strings.inboxDescription}\n action={\n onMarkAllRead && unreadCount > 0 ? (\n <Button tone=\"secondary\" onClick={onMarkAllRead}>\n {strings.markAllRead}\n </Button>\n ) : undefined\n }\n />\n\n <Tabs\n activeKey={filter}\n onChange={(key) => {\n setFilter(key === 'unread' ? 'unread' : 'all');\n }}\n items={[\n { key: 'all', label: strings.inboxAll },\n { key: 'unread', label: strings.inboxUnread(unreadCount) },\n ]}\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={retry}>\n {strings.retry}\n </Button>\n )\n }\n />\n ) : (\n <div ref={panelRef} className=\"aegis-inbox__panel\" tabIndex={-1}>\n {staleError && (\n <Alert tone=\"warning\" title={strings.inboxStale}>\n {staleError.message}\n {onRetry && (\n <span className=\"aegis-inbox__stale-action\">\n <Button tone=\"secondary\" onClick={retry}>\n {strings.retry}\n </Button>\n </span>\n )}\n </Alert>\n )}\n {visible.length === 0 ? (\n <EmptyState\n title={\n filter === 'unread'\n ? strings.inboxNoUnread\n : strings.inboxEmptyTitle\n }\n description={\n filter === 'unread'\n ? strings.notificationsCaughtUp\n : strings.inboxEmptyDescription\n }\n />\n ) : (\n <ul className=\"aegis-inbox__list\">\n {visible.map((item) => (\n <li key={item.id} className=\"aegis-inbox__row-wrap\">\n <button\n type=\"button\"\n className={[\n 'aegis-inbox__row',\n item.read ? '' : 'aegis-inbox__row--unread',\n ]\n .filter(Boolean)\n .join(' ')}\n onClick={() => {\n onOpen?.(item);\n }}\n >\n <Avatar name={item.actor ?? item.title} size=\"md\" />\n <div className=\"aegis-inbox__row-body\">\n <div className=\"aegis-inbox__row-head\">\n <span className=\"aegis-inbox__row-title\">\n {item.title}\n </span>\n <span className=\"aegis-inbox__row-time\">\n {relativeTime(item.timestamp, strings)}\n </span>\n </div>\n {item.body && (\n <div className=\"aegis-inbox__row-text\">\n {item.body}\n </div>\n )}\n {(item.category ?? item.severity) && (\n <div className=\"aegis-inbox__row-meta\">\n {item.severity && (\n <Chip tone={SEVERITY_TONE[item.severity]}>\n {strings.notificationSeverity(item.severity)}\n </Chip>\n )}\n {item.category && (\n <Chip tone=\"ghost\">{item.category}</Chip>\n )}\n </div>\n )}\n </div>\n </button>\n </li>\n ))}\n </ul>\n )}\n </div>\n )}\n </Tabs>\n </div>\n );\n}\n"],"names":["SEVERITY_TONE","InboxPage","items","unreadCount","n","onOpen","onMarkAllRead","error","liveError","onRetry","defaultFilter","surface","strings","useStrings","filter","setFilter","useState","wrapRef","useRef","agentAttrs","usePrimitiveSurface","visible","useMemo","loadError","staleError","panelRef","retryButton","retry","event","useEffect","button","panel","jsx","PageHeader","Button","Tabs","key","ErrorState","Alert","EmptyState","item","jsxs","Avatar","Chip"],"mappings":";;;;;;;;;;;;;;AA0DA,MAAMA,IAGF;AAAA,EACF,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACT;AAEO,SAASC,GAAU;AAAA,EACxB,OAAAC;AAAA,EACA,aAAAC,IAAcD,EAAM,OAAO,CAACE,MAAM,CAACA,EAAE,IAAI,EAAE;AAAA,EAC3C,QAAAC;AAAA,EACA,eAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,SAAAC;AACF,GAAiC;AAC/B,QAAMC,IAAUC,EAAA,GACV,CAACC,GAAQC,CAAS,IAAIC,EAAiBN,CAAa,GACpDO,IAAUC,EAAuB,IAAI,GACrCC,IAAaC,EAAoBT,GAAST,GAAO,QAAQe,CAAO,GAEhEI,IAAUC;AAAA,IACd,MAAOR,MAAW,WAAWZ,EAAM,OAAO,CAACE,MAAM,CAACA,EAAE,IAAI,IAAIF;AAAA,IAC5D,CAACA,GAAOY,CAAM;AAAA,EAAA,GAEVS,IAAYrB,EAAM,WAAW,IAAIK,IAAQ,MACzCiB,IAAahB,MAAcN,EAAM,WAAW,IAAI,OAAOK,IAEvDkB,IAAWP,EAAuB,IAA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A,CACvC;AAAA,kBAAA,GACF;AAAA,kBACC4B,EAAK,QACJ,gBAAAR,EAAC,SAAI,WAAU,yBACZ,YAAK,MACR;AAAA,mBAEAQ,EAAK,YAAYA,EAAK,aACtB,gBAAAC,EAAC,OAAA,EAAI,WAAU,yBACZ,UAAA;AAAA,oBAAAD,EAAK,YACJ,gBAAAR,EAACW,GAAA,EAAK,MAAM3C,EAAcwC,EAAK,QAAQ,GACpC,UAAA5B,EAAQ,qBAAqB4B,EAAK,QAAQ,GAC7C;AAAA,oBAEDA,EAAK,YACJ,gBAAAR,EAACW,KAAK,MAAK,SAAS,YAAK,SAAA,CAAS;AAAA,kBAAA,EAAA,CAEtC;AAAA,gBAAA,EAAA,CAEJ;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA,KAxCKH,EAAK,EA0Cd,CACD,EAAA,CACH;AAAA,QAAA,EAAA,CAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAEJ,GACF;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),y=require("./Alert.cjs"),w=require("./Button.cjs"),C=require("./Checkbox.cjs");;/* empty css */const E=require("./PasswordField.cjs"),_=require("./TextField.cjs"),O=require("./authValidation.cjs");function F({onSubmit:x,submitting:t=!1,error:n,onForgotPassword:o,showRememberMe:u=!0,action:i,method:f="POST",hiddenFields:d}){const[m,g]=s.useState(""),[l,h]=s.useState(""),[c,v]=s.useState(!1),[p,j]=s.useState(!1),b=m.trim(),a={email:b===""?O.EMAIL_REQUIRED:void 0,password:l===""?"Enter your password.":void 0},S=r=>{if(j(!0),a.email??a.password){r.preventDefault();return}i||r.preventDefault(),x?.({email:b,password:l,remember:c})};return e.jsxs("form",{className:"aegis-loginform",onSubmit:S,action:i,method:i?f:void 0,noValidate:!0,children:[n&&e.jsx(y.Alert,{tone:"error",children:n}),d&&Object.entries(d).map(([r,q])=>e.jsx("input",{type:"hidden",name:r,value:q},r)),e.jsx(_.TextField,{label:"Email",type:"email",name:"username",autoComplete:"username",placeholder:"you@example.com",value:m,onChange:r=>g(r.target.value),readOnly:t,required:!0,error:p?a.email:void 0}),e.jsx(E.PasswordField,{label:"Password",name:"password",autoComplete:"current-password",placeholder:"••••••••",value:l,onChange:r=>h(r.target.value),readOnly:t,required:!0,error:p?a.password:void 0}),(u||o)&&e.jsxs("div",{className:"aegis-loginform__row",children:[u?e.jsx(C.Checkbox,{checked:c,onChange:v,disabled:t,label:"Remember me"}):e.jsx("span",{}),o&&e.jsx("button",{type:"button",className:"aegis-loginform__forgot",onClick:o,disabled:t,children:"Forgot password?"})]}),e.jsx(w.Button,{tone:"primary",type:"submit",className:"aegis-loginform__submit",disabled:t,children:t?"Signing in…":"Sign in"})]})}exports.LoginForm=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react"),y=require("./Alert.cjs"),C=require("./Button.cjs"),P=require("./Checkbox.cjs");;/* empty css */const _=require("./PasswordField.cjs"),O=require("./TextField.cjs"),E=require("../../locale/useStrings.cjs");function F({onSubmit:b,submitting:s=!1,error:u,onForgotPassword:i,showRememberMe:d=!0,action:l,method:x="POST",hiddenFields:m}){const t=E.useStrings(),[c,f]=o.useState(""),[n,v]=o.useState(""),[p,j]=o.useState(!1),[h,q]=o.useState(!1),g=c.trim(),a={email:g===""?t.authEmailRequired:void 0,password:n===""?t.authPasswordRequired:void 0},S=r=>{if(q(!0),a.email??a.password){r.preventDefault();return}l||r.preventDefault(),b?.({email:g,password:n,remember:p})};return e.jsxs("form",{className:"aegis-loginform",onSubmit:S,action:l,method:l?x:void 0,noValidate:!0,children:[u&&e.jsx(y.Alert,{tone:"error",children:u}),m&&Object.entries(m).map(([r,w])=>e.jsx("input",{type:"hidden",name:r,value:w},r)),e.jsx(O.TextField,{label:t.authEmail,type:"email",name:"username",autoComplete:"username",placeholder:"you@example.com",value:c,onChange:r=>f(r.target.value),readOnly:s,required:!0,error:h?a.email:void 0}),e.jsx(_.PasswordField,{label:t.authPassword,name:"password",autoComplete:"current-password",placeholder:"••••••••",value:n,onChange:r=>v(r.target.value),readOnly:s,required:!0,error:h?a.password:void 0}),(d||i)&&e.jsxs("div",{className:"aegis-loginform__row",children:[d?e.jsx(P.Checkbox,{checked:p,onChange:j,disabled:s,label:t.authRememberMe}):e.jsx("span",{}),i&&e.jsx("button",{type:"button",className:"aegis-loginform__forgot",onClick:i,disabled:s,children:t.authForgotPassword})]}),e.jsx(C.Button,{tone:"primary",type:"submit",className:"aegis-loginform__submit",disabled:s,children:s?t.authSigningIn:t.signIn})]})}exports.LoginForm=F;
2
2
  //# sourceMappingURL=LoginForm.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"LoginForm.cjs","sources":["../../../src/components/ui/LoginForm.tsx"],"sourcesContent":["import { type FormEvent, type ReactElement, useState } from 'react';\n\nimport { Alert } from './Alert';\nimport { Button } from './Button';\nimport { Checkbox } from './Checkbox';\nimport './LoginForm.css';\nimport { PasswordField } from './PasswordField';\nimport { TextField } from './TextField';\nimport { EMAIL_REQUIRED } from './authValidation';\n\ninterface LoginFormValues {\n email: string;\n password: string;\n remember: boolean;\n}\n\ninterface LoginFormProps {\n /** Called only once both fields are filled; `email` arrives trimmed. */\n onSubmit?: (values: LoginFormValues) => void | Promise<void>;\n submitting?: boolean;\n error?: string;\n onForgotPassword?: () => void;\n showRememberMe?: boolean;\n // When set, a filled-in form submits natively to this URL so the\n // browser's password manager can detect the credential submission.\n // onSubmit is still invoked (without preventDefault) for caller-side\n // bookkeeping.\n action?: string;\n method?: 'GET' | 'POST';\n // Extra hidden inputs co-submitted with username/password — e.g. PKCE\n // params for an SSO authorization endpoint.\n hiddenFields?: Record<string, string>;\n}\n\nexport function LoginForm({\n onSubmit,\n submitting = false,\n error,\n onForgotPassword,\n showRememberMe = true,\n action,\n method = 'POST',\n hiddenFields,\n}: LoginFormProps): ReactElement {\n const [email, setEmail] = useState('');\n const [password, setPassword] = useState('');\n const [remember, setRemember] = useState(false);\n const [submitted, setSubmitted] = useState(false);\n\n const trimmedEmail = email.trim();\n const errors = {\n email: trimmedEmail === '' ? EMAIL_REQUIRED : undefined,\n password: password === '' ? 'Enter your password.' : undefined,\n };\n\n const handleSubmit = (e: FormEvent<HTMLFormElement>): void => {\n setSubmitted(true);\n if (errors.email ?? errors.password) {\n e.preventDefault();\n return;\n }\n if (!action) {\n e.preventDefault();\n }\n void onSubmit?.({ email: trimmedEmail, password, remember });\n };\n\n return (\n <form\n className=\"aegis-loginform\"\n onSubmit={handleSubmit}\n action={action}\n method={action ? method : undefined}\n noValidate\n >\n {error && <Alert tone=\"error\">{error}</Alert>}\n {hiddenFields &&\n Object.entries(hiddenFields).map(([k, v]) => (\n <input key={k} type=\"hidden\" name={k} value={v} />\n ))}\n {/* readOnly (not disabled) while submitting: disabled inputs are excluded\n from native form submission per the HTML spec, which breaks the\n action-URL path (SSO/PKCE) since React flushes setSubmitting(true)\n synchronously inside the submit handler — the browser would then\n serialize the form with username/password missing. */}\n <TextField\n label=\"Email\"\n type=\"email\"\n name=\"username\"\n autoComplete=\"username\"\n placeholder=\"you@example.com\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n readOnly={submitting}\n required\n error={submitted ? errors.email : undefined}\n />\n <PasswordField\n label=\"Password\"\n name=\"password\"\n autoComplete=\"current-password\"\n placeholder=\"••••••••\"\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n readOnly={submitting}\n required\n error={submitted ? errors.password : undefined}\n />\n {(showRememberMe || onForgotPassword) && (\n <div className=\"aegis-loginform__row\">\n {showRememberMe ? (\n <Checkbox\n checked={remember}\n onChange={setRemember}\n disabled={submitting}\n label=\"Remember me\"\n />\n ) : (\n <span />\n )}\n {onForgotPassword && (\n <button\n type=\"button\"\n className=\"aegis-loginform__forgot\"\n onClick={onForgotPassword}\n disabled={submitting}\n >\n Forgot password?\n </button>\n )}\n </div>\n )}\n <Button\n tone=\"primary\"\n type=\"submit\"\n className=\"aegis-loginform__submit\"\n disabled={submitting}\n >\n {submitting ? 'Signing in…' : 'Sign in'}\n </Button>\n </form>\n );\n}\n"],"names":["LoginForm","onSubmit","submitting","error","onForgotPassword","showRememberMe","action","method","hiddenFields","email","setEmail","useState","password","setPassword","remember","setRemember","submitted","setSubmitted","trimmedEmail","errors","EMAIL_REQUIRED","handleSubmit","e","jsxs","jsx","Alert","k","v","TextField","PasswordField","Checkbox","Button"],"mappings":"4VAkCO,SAASA,EAAU,CACxB,SAAAC,EACA,WAAAC,EAAa,GACb,MAAAC,EACA,iBAAAC,EACA,eAAAC,EAAiB,GACjB,OAAAC,EACA,OAAAC,EAAS,OACT,aAAAC,CACF,EAAiC,CAC/B,KAAM,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAAS,EAAE,EAC/B,CAACC,EAAUC,CAAW,EAAIF,EAAAA,SAAS,EAAE,EACrC,CAACG,EAAUC,CAAW,EAAIJ,EAAAA,SAAS,EAAK,EACxC,CAACK,EAAWC,CAAY,EAAIN,EAAAA,SAAS,EAAK,EAE1CO,EAAeT,EAAM,KAAA,EACrBU,EAAS,CACb,MAAOD,IAAiB,GAAKE,EAAAA,eAAiB,OAC9C,SAAUR,IAAa,GAAK,uBAAyB,MAAA,EAGjDS,EAAgBC,GAAwC,CAE5D,GADAL,EAAa,EAAI,EACbE,EAAO,OAASA,EAAO,SAAU,CACnCG,EAAE,eAAA,EACF,MACF,CACKhB,GACHgB,EAAE,eAAA,EAECrB,IAAW,CAAE,MAAOiB,EAAc,SAAAN,EAAU,SAAAE,EAAU,CAC7D,EAEA,OACES,EAAAA,KAAC,OAAA,CACC,UAAU,kBACV,SAAUF,EACV,OAAAf,EACA,OAAQA,EAASC,EAAS,OAC1B,WAAU,GAET,SAAA,CAAAJ,GAASqB,EAAAA,IAACC,QAAA,CAAM,KAAK,QAAS,SAAAtB,EAAM,EACpCK,GACC,OAAO,QAAQA,CAAY,EAAE,IAAI,CAAC,CAACkB,EAAGC,CAAC,IACrCH,EAAAA,IAAC,QAAA,CAAc,KAAK,SAAS,KAAME,EAAG,MAAOC,GAAjCD,CAAoC,CACjD,EAMHF,EAAAA,IAACI,EAAAA,UAAA,CACC,MAAM,QACN,KAAK,QACL,KAAK,WACL,aAAa,WACb,YAAY,kBACZ,MAAOnB,EACP,SAAWa,GAAMZ,EAASY,EAAE,OAAO,KAAK,EACxC,SAAUpB,EACV,SAAQ,GACR,MAAOc,EAAYG,EAAO,MAAQ,MAAA,CAAA,EAEpCK,EAAAA,IAACK,EAAAA,cAAA,CACC,MAAM,WACN,KAAK,WACL,aAAa,mBACb,YAAY,WACZ,MAAOjB,EACP,SAAWU,GAAMT,EAAYS,EAAE,OAAO,KAAK,EAC3C,SAAUpB,EACV,SAAQ,GACR,MAAOc,EAAYG,EAAO,SAAW,MAAA,CAAA,GAErCd,GAAkBD,IAClBmB,EAAAA,KAAC,MAAA,CAAI,UAAU,uBACZ,SAAA,CAAAlB,EACCmB,EAAAA,IAACM,EAAAA,SAAA,CACC,QAAShB,EACT,SAAUC,EACV,SAAUb,EACV,MAAM,aAAA,CAAA,QAGP,OAAA,EAAK,EAEPE,GACCoB,EAAAA,IAAC,SAAA,CACC,KAAK,SACL,UAAU,0BACV,QAASpB,EACT,SAAUF,EACX,SAAA,kBAAA,CAAA,CAED,EAEJ,EAEFsB,EAAAA,IAACO,EAAAA,OAAA,CACC,KAAK,UACL,KAAK,SACL,UAAU,0BACV,SAAU7B,EAET,WAAa,cAAgB,SAAA,CAAA,CAChC,CAAA,CAAA,CAGN"}
1
+ {"version":3,"file":"LoginForm.cjs","sources":["../../../src/components/ui/LoginForm.tsx"],"sourcesContent":["import { type FormEvent, type ReactElement, useState } from 'react';\n\nimport { useStrings } from '../../locale';\nimport { Alert } from './Alert';\nimport { Button } from './Button';\nimport { Checkbox } from './Checkbox';\nimport './LoginForm.css';\nimport { PasswordField } from './PasswordField';\nimport { TextField } from './TextField';\n\ninterface LoginFormValues {\n email: string;\n password: string;\n remember: boolean;\n}\n\ninterface LoginFormProps {\n /** Called only once both fields are filled; `email` arrives trimmed. */\n onSubmit?: (values: LoginFormValues) => void | Promise<void>;\n submitting?: boolean;\n error?: string;\n onForgotPassword?: () => void;\n showRememberMe?: boolean;\n // When set, a filled-in form submits natively to this URL so the\n // browser's password manager can detect the credential submission.\n // onSubmit is still invoked (without preventDefault) for caller-side\n // bookkeeping.\n action?: string;\n method?: 'GET' | 'POST';\n // Extra hidden inputs co-submitted with username/password — e.g. PKCE\n // params for an SSO authorization endpoint.\n hiddenFields?: Record<string, string>;\n}\n\nexport function LoginForm({\n onSubmit,\n submitting = false,\n error,\n onForgotPassword,\n showRememberMe = true,\n action,\n method = 'POST',\n hiddenFields,\n}: LoginFormProps): ReactElement {\n const strings = useStrings();\n const [email, setEmail] = useState('');\n const [password, setPassword] = useState('');\n const [remember, setRemember] = useState(false);\n const [submitted, setSubmitted] = useState(false);\n\n const trimmedEmail = email.trim();\n const errors = {\n email: trimmedEmail === '' ? strings.authEmailRequired : undefined,\n password: password === '' ? strings.authPasswordRequired : undefined,\n };\n\n const handleSubmit = (e: FormEvent<HTMLFormElement>): void => {\n setSubmitted(true);\n if (errors.email ?? errors.password) {\n e.preventDefault();\n return;\n }\n if (!action) {\n e.preventDefault();\n }\n void onSubmit?.({ email: trimmedEmail, password, remember });\n };\n\n return (\n <form\n className=\"aegis-loginform\"\n onSubmit={handleSubmit}\n action={action}\n method={action ? method : undefined}\n noValidate\n >\n {error && <Alert tone=\"error\">{error}</Alert>}\n {hiddenFields &&\n Object.entries(hiddenFields).map(([k, v]) => (\n <input key={k} type=\"hidden\" name={k} value={v} />\n ))}\n {/* readOnly (not disabled) while submitting: disabled inputs are excluded\n from native form submission per the HTML spec, which breaks the\n action-URL path (SSO/PKCE) since React flushes setSubmitting(true)\n synchronously inside the submit handler — the browser would then\n serialize the form with username/password missing. */}\n <TextField\n label={strings.authEmail}\n type=\"email\"\n name=\"username\"\n autoComplete=\"username\"\n placeholder=\"you@example.com\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n readOnly={submitting}\n required\n error={submitted ? errors.email : undefined}\n />\n <PasswordField\n label={strings.authPassword}\n name=\"password\"\n autoComplete=\"current-password\"\n placeholder=\"••••••••\"\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n readOnly={submitting}\n required\n error={submitted ? errors.password : undefined}\n />\n {(showRememberMe || onForgotPassword) && (\n <div className=\"aegis-loginform__row\">\n {showRememberMe ? (\n <Checkbox\n checked={remember}\n onChange={setRemember}\n disabled={submitting}\n label={strings.authRememberMe}\n />\n ) : (\n <span />\n )}\n {onForgotPassword && (\n <button\n type=\"button\"\n className=\"aegis-loginform__forgot\"\n onClick={onForgotPassword}\n disabled={submitting}\n >\n {strings.authForgotPassword}\n </button>\n )}\n </div>\n )}\n <Button\n tone=\"primary\"\n type=\"submit\"\n className=\"aegis-loginform__submit\"\n disabled={submitting}\n >\n {submitting ? strings.authSigningIn : strings.signIn}\n </Button>\n </form>\n );\n}\n"],"names":["LoginForm","onSubmit","submitting","error","onForgotPassword","showRememberMe","action","method","hiddenFields","strings","useStrings","email","setEmail","useState","password","setPassword","remember","setRemember","submitted","setSubmitted","trimmedEmail","errors","handleSubmit","e","jsxs","jsx","Alert","k","v","TextField","PasswordField","Checkbox","Button"],"mappings":"mWAkCO,SAASA,EAAU,CACxB,SAAAC,EACA,WAAAC,EAAa,GACb,MAAAC,EACA,iBAAAC,EACA,eAAAC,EAAiB,GACjB,OAAAC,EACA,OAAAC,EAAS,OACT,aAAAC,CACF,EAAiC,CAC/B,MAAMC,EAAUC,EAAAA,WAAA,EACV,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAAS,EAAE,EAC/B,CAACC,EAAUC,CAAW,EAAIF,EAAAA,SAAS,EAAE,EACrC,CAACG,EAAUC,CAAW,EAAIJ,EAAAA,SAAS,EAAK,EACxC,CAACK,EAAWC,CAAY,EAAIN,EAAAA,SAAS,EAAK,EAE1CO,EAAeT,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,SAAUC,EACV,SAAUf,EACV,MAAOO,EAAQ,cAAA,CAAA,QAGhB,OAAA,EAAK,EAEPL,GACCqB,EAAAA,IAAC,SAAA,CACC,KAAK,SACL,UAAU,0BACV,QAASrB,EACT,SAAUF,EAET,SAAAO,EAAQ,kBAAA,CAAA,CACX,EAEJ,EAEFgB,EAAAA,IAACO,EAAAA,OAAA,CACC,KAAK,UACL,KAAK,SACL,UAAU,0BACV,SAAU9B,EAET,SAAAA,EAAaO,EAAQ,cAAgBA,EAAQ,MAAA,CAAA,CAChD,CAAA,CAAA,CAGN"}
@@ -1,101 +1,101 @@
1
- import { jsxs as b, jsx as r } from "react/jsx-runtime";
2
- import { useState as t } from "react";
3
- import { Alert as E } from "./Alert.js";
4
- import { Button as _ } from "./Button.js";
5
- import { Checkbox as x } from "./Checkbox.js";
1
+ import { jsxs as b, jsx as a } from "react/jsx-runtime";
2
+ import { useState as i } from "react";
3
+ import { Alert as _ } from "./Alert.js";
4
+ import { Button as q } from "./Button.js";
5
+ import { Checkbox as E } from "./Checkbox.js";
6
6
  /* empty css */
7
7
  import { PasswordField as N } from "./PasswordField.js";
8
8
  import { TextField as O } from "./TextField.js";
9
- import { EMAIL_REQUIRED as j } from "./authValidation.js";
10
- function F({
11
- onSubmit: h,
9
+ import { useStrings as P } from "../../locale/useStrings.js";
10
+ function V({
11
+ onSubmit: g,
12
12
  submitting: o = !1,
13
- error: s,
13
+ error: n,
14
14
  onForgotPassword: m,
15
- showRememberMe: n = !0,
16
- action: l,
15
+ showRememberMe: d = !0,
16
+ action: s,
17
17
  method: v = "POST",
18
- hiddenFields: d
18
+ hiddenFields: u
19
19
  }) {
20
- const [p, g] = t(""), [i, w] = t(""), [u, y] = t(!1), [c, S] = t(!1), f = p.trim(), a = {
21
- email: f === "" ? j : void 0,
22
- password: i === "" ? "Enter your password." : void 0
20
+ const r = P(), [p, w] = i(""), [l, y] = i(""), [c, S] = i(!1), [f, C] = i(!1), h = p.trim(), t = {
21
+ email: h === "" ? r.authEmailRequired : void 0,
22
+ password: l === "" ? r.authPasswordRequired : void 0
23
23
  };
24
24
  return /* @__PURE__ */ b(
25
25
  "form",
26
26
  {
27
27
  className: "aegis-loginform",
28
28
  onSubmit: (e) => {
29
- if (S(!0), a.email ?? a.password) {
29
+ if (C(!0), t.email ?? t.password) {
30
30
  e.preventDefault();
31
31
  return;
32
32
  }
33
- l || e.preventDefault(), h?.({ email: f, password: i, remember: u });
33
+ s || e.preventDefault(), g?.({ email: h, password: l, remember: c });
34
34
  },
35
- action: l,
36
- method: l ? v : void 0,
35
+ action: s,
36
+ method: s ? v : void 0,
37
37
  noValidate: !0,
38
38
  children: [
39
- s && /* @__PURE__ */ r(E, { tone: "error", children: s }),
40
- d && Object.entries(d).map(([e, C]) => /* @__PURE__ */ r("input", { type: "hidden", name: e, value: C }, e)),
41
- /* @__PURE__ */ r(
39
+ n && /* @__PURE__ */ a(_, { tone: "error", children: n }),
40
+ u && Object.entries(u).map(([e, x]) => /* @__PURE__ */ a("input", { type: "hidden", name: e, value: x }, e)),
41
+ /* @__PURE__ */ a(
42
42
  O,
43
43
  {
44
- label: "Email",
44
+ label: r.authEmail,
45
45
  type: "email",
46
46
  name: "username",
47
47
  autoComplete: "username",
48
48
  placeholder: "you@example.com",
49
49
  value: p,
50
- onChange: (e) => g(e.target.value),
50
+ onChange: (e) => w(e.target.value),
51
51
  readOnly: o,
52
52
  required: !0,
53
- error: c ? a.email : void 0
53
+ error: f ? t.email : void 0
54
54
  }
55
55
  ),
56
- /* @__PURE__ */ r(
56
+ /* @__PURE__ */ a(
57
57
  N,
58
58
  {
59
- label: "Password",
59
+ label: r.authPassword,
60
60
  name: "password",
61
61
  autoComplete: "current-password",
62
62
  placeholder: "••••••••",
63
- value: i,
64
- onChange: (e) => w(e.target.value),
63
+ value: l,
64
+ onChange: (e) => y(e.target.value),
65
65
  readOnly: o,
66
66
  required: !0,
67
- error: c ? a.password : void 0
67
+ error: f ? t.password : void 0
68
68
  }
69
69
  ),
70
- (n || m) && /* @__PURE__ */ b("div", { className: "aegis-loginform__row", children: [
71
- n ? /* @__PURE__ */ r(
72
- x,
70
+ (d || m) && /* @__PURE__ */ b("div", { className: "aegis-loginform__row", children: [
71
+ d ? /* @__PURE__ */ a(
72
+ E,
73
73
  {
74
- checked: u,
75
- onChange: y,
74
+ checked: c,
75
+ onChange: S,
76
76
  disabled: o,
77
- label: "Remember me"
77
+ label: r.authRememberMe
78
78
  }
79
- ) : /* @__PURE__ */ r("span", {}),
80
- m && /* @__PURE__ */ r(
79
+ ) : /* @__PURE__ */ a("span", {}),
80
+ m && /* @__PURE__ */ a(
81
81
  "button",
82
82
  {
83
83
  type: "button",
84
84
  className: "aegis-loginform__forgot",
85
85
  onClick: m,
86
86
  disabled: o,
87
- children: "Forgot password?"
87
+ children: r.authForgotPassword
88
88
  }
89
89
  )
90
90
  ] }),
91
- /* @__PURE__ */ r(
92
- _,
91
+ /* @__PURE__ */ a(
92
+ q,
93
93
  {
94
94
  tone: "primary",
95
95
  type: "submit",
96
96
  className: "aegis-loginform__submit",
97
97
  disabled: o,
98
- children: o ? "Signing in…" : "Sign in"
98
+ children: o ? r.authSigningIn : r.signIn
99
99
  }
100
100
  )
101
101
  ]
@@ -103,6 +103,6 @@ function F({
103
103
  );
104
104
  }
105
105
  export {
106
- F as LoginForm
106
+ V as LoginForm
107
107
  };
108
108
  //# sourceMappingURL=LoginForm.js.map