@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,138 +1,168 @@
1
- import { jsxs as g, jsx as n } from "react/jsx-runtime";
2
- import { useRef as D, useState as G, useCallback as l } from "react";
3
- import { useDropzone as H } from "react-dropzone";
4
- import { formatBytes as s } from "../../lib/format.js";
5
- import { Button as v } from "./Button.js";
1
+ import { jsxs as g, jsx as t } from "react/jsx-runtime";
2
+ import { useRef as E, useState as H, useCallback as a } from "react";
3
+ import { useDropzone as K } from "react-dropzone";
4
+ import { formatBytes as c } from "../../lib/format.js";
5
+ import { Button as k } from "./Button.js";
6
6
  /* empty css */
7
- import { filesFromEvent as J } from "./dropFiles.js";
8
- function Y({
9
- value: i,
10
- onFilesChange: c,
11
- maxFileBytes: a,
12
- maxTotalBytes: f,
13
- maxFiles: d,
14
- accept: C,
15
- disabled: e = !1,
16
- helperText: k,
17
- validationError: I,
18
- summary: N,
19
- className: S
7
+ import { filesFromEvent as q } from "./dropFiles.js";
8
+ import { useStrings as G } from "../../locale/useStrings.js";
9
+ function J(e, l) {
10
+ switch (e.kind) {
11
+ case "tooMany":
12
+ return l.folderDropzoneTooMany(e.count, e.max);
13
+ case "fileTooLarge":
14
+ return l.folderDropzoneFileTooLarge(
15
+ e.name,
16
+ c(e.size),
17
+ c(e.max)
18
+ );
19
+ case "totalTooLarge":
20
+ return l.folderDropzoneTotalTooLarge(
21
+ c(e.total),
22
+ c(e.max)
23
+ );
24
+ }
25
+ }
26
+ function $({
27
+ value: e,
28
+ onFilesChange: l,
29
+ maxFileBytes: f,
30
+ maxTotalBytes: d,
31
+ maxFiles: u,
32
+ accept: D,
33
+ disabled: o = !1,
34
+ helperText: N,
35
+ validationError: T,
36
+ summary: y,
37
+ className: j
20
38
  }) {
21
- const u = D(null), p = D(null), [j, t] = G(""), _ = l(
22
- (o) => {
23
- if (!e && o.length !== 0) {
24
- if (d !== void 0 && o.length > d) {
25
- t(
26
- `Too many files: ${o.length.toString()} selected, ${d.toString()} allowed.`
27
- );
39
+ const i = G(), p = E(null), m = E(null), [C, s] = H(
40
+ null
41
+ ), h = a(
42
+ (n) => {
43
+ if (!o && n.length !== 0) {
44
+ if (u !== void 0 && n.length > u) {
45
+ s({
46
+ kind: "tooMany",
47
+ count: n.length,
48
+ max: u
49
+ });
28
50
  return;
29
51
  }
30
- if (a !== void 0) {
31
- const r = o.find((z) => z.size > a);
52
+ if (f !== void 0) {
53
+ const r = n.find((v) => v.size > f);
32
54
  if (r) {
33
- t(
34
- `"${r.name}" is ${s(r.size)}, over the ${s(a)} per-file cap.`
35
- );
55
+ s({
56
+ kind: "fileTooLarge",
57
+ name: r.name,
58
+ size: r.size,
59
+ max: f
60
+ });
36
61
  return;
37
62
  }
38
63
  }
39
- if (f !== void 0) {
40
- const r = o.reduce((z, q) => z + q.size, 0);
41
- if (r > f) {
42
- t(
43
- `Selection totals ${s(r)}, over the ${s(f)} aggregate cap.`
44
- );
64
+ if (d !== void 0) {
65
+ const r = n.reduce((v, x) => v + x.size, 0);
66
+ if (r > d) {
67
+ s({
68
+ kind: "totalTooLarge",
69
+ total: r,
70
+ max: d
71
+ });
45
72
  return;
46
73
  }
47
74
  }
48
- t(""), c(o);
75
+ s(null), l(n);
49
76
  }
50
77
  },
51
- [e, d, a, f, c]
52
- ), E = l(() => {
53
- u.current?.click();
54
- }, []), R = l(() => {
78
+ [o, u, f, d, l]
79
+ ), M = a(() => {
55
80
  p.current?.click();
56
- }, []), w = l(() => {
57
- e || (t(""), c([]), u.current && (u.current.value = ""), p.current && (p.current.value = ""));
58
- }, [e, c]), { getRootProps: A, isDragActive: $ } = H({
59
- onDrop: _,
60
- disabled: e,
81
+ }, []), R = a(() => {
82
+ m.current?.click();
83
+ }, []), A = a(() => {
84
+ o || (s(null), l([]), p.current && (p.current.value = ""), m.current && (m.current.value = ""));
85
+ }, [o, l]), { getRootProps: F, isDragActive: I } = K({
86
+ onDrop: h,
87
+ disabled: o,
61
88
  noClick: !0,
62
89
  noKeyboard: !0,
63
- getFilesFromEvent: J
64
- }), y = l(
65
- (o) => {
66
- const r = o.target.files;
67
- r && _(Array.from(r));
90
+ getFilesFromEvent: q
91
+ }), L = a(
92
+ (n) => {
93
+ const r = n.target.files;
94
+ r && h(Array.from(r));
68
95
  },
69
- [_]
70
- ), m = I ?? j, h = i.length > 0, P = i.reduce((o, r) => o + r.size, 0), K = [
96
+ [h]
97
+ ), _ = T ?? (C ? J(C, i) : ""), z = e.length > 0, P = e.reduce((n, r) => n + r.size, 0), S = [
71
98
  "aegis-folder-dropzone__surface",
72
- $ ? "aegis-folder-dropzone__surface--active" : "",
73
- e ? "aegis-folder-dropzone__surface--disabled" : "",
74
- m ? "aegis-folder-dropzone__surface--error" : ""
75
- ].filter(Boolean).join(" "), M = ["aegis-folder-dropzone", S ?? ""].filter(Boolean).join(" ");
76
- return /* @__PURE__ */ g("div", { className: M, children: [
77
- /* @__PURE__ */ g("div", { ...A({ className: K }), children: [
99
+ I ? "aegis-folder-dropzone__surface--active" : "",
100
+ o ? "aegis-folder-dropzone__surface--disabled" : "",
101
+ _ ? "aegis-folder-dropzone__surface--error" : ""
102
+ ].filter(Boolean).join(" "), w = ["aegis-folder-dropzone", j ?? ""].filter(Boolean).join(" ");
103
+ return /* @__PURE__ */ g("div", { className: w, children: [
104
+ /* @__PURE__ */ g("div", { ...F({ className: S }), children: [
78
105
  /* @__PURE__ */ g("div", { className: "aegis-folder-dropzone__hint", children: [
79
- /* @__PURE__ */ n("span", { className: "aegis-folder-dropzone__primary", children: $ ? "Drop folder to upload" : h ? `${i.length.toString()} file${i.length === 1 ? "" : "s"} selected · ${s(P)}` : "Drag a folder here, or choose one below" }),
80
- !h && k !== void 0 ? /* @__PURE__ */ n("span", { className: "aegis-folder-dropzone__meta", children: k }) : null
106
+ /* @__PURE__ */ t("span", { className: "aegis-folder-dropzone__primary", children: I ? i.dropzoneDropFolder : z ? i.folderDropzoneSelected(
107
+ e.length,
108
+ c(P)
109
+ ) : i.folderDropzoneHint }),
110
+ !z && N !== void 0 ? /* @__PURE__ */ t("span", { className: "aegis-folder-dropzone__meta", children: N }) : null
81
111
  ] }),
82
112
  /* @__PURE__ */ g("div", { className: "aegis-folder-dropzone__actions", children: [
83
- /* @__PURE__ */ n(
84
- v,
113
+ /* @__PURE__ */ t(
114
+ k,
85
115
  {
86
116
  tone: "secondary",
87
- onClick: E,
88
- disabled: e,
89
- children: "Choose folder"
117
+ onClick: M,
118
+ disabled: o,
119
+ children: i.chooseFolder
90
120
  }
91
121
  ),
92
- /* @__PURE__ */ n(
93
- v,
122
+ /* @__PURE__ */ t(
123
+ k,
94
124
  {
95
125
  tone: "secondary",
96
126
  onClick: R,
97
- disabled: e,
98
- children: "Choose files"
127
+ disabled: o,
128
+ children: i.chooseFiles
99
129
  }
100
130
  ),
101
- h ? /* @__PURE__ */ n(v, { tone: "ghost", onClick: w, disabled: e, children: "Clear" }) : null
131
+ z ? /* @__PURE__ */ t(k, { tone: "ghost", onClick: A, disabled: o, children: i.clear }) : null
102
132
  ] }),
103
- /* @__PURE__ */ n(
133
+ /* @__PURE__ */ t(
104
134
  "input",
105
135
  {
106
- ref: u,
136
+ ref: p,
107
137
  type: "file",
108
138
  multiple: !0,
109
- accept: C,
110
- disabled: e,
139
+ accept: D,
140
+ disabled: o,
111
141
  tabIndex: -1,
112
142
  webkitdirectory: "",
113
143
  className: "aegis-folder-dropzone__input",
114
- onChange: y
144
+ onChange: L
115
145
  }
116
146
  ),
117
- /* @__PURE__ */ n(
147
+ /* @__PURE__ */ t(
118
148
  "input",
119
149
  {
120
- ref: p,
150
+ ref: m,
121
151
  type: "file",
122
152
  multiple: !0,
123
- accept: C,
124
- disabled: e,
153
+ accept: D,
154
+ disabled: o,
125
155
  tabIndex: -1,
126
156
  className: "aegis-folder-dropzone__input",
127
- onChange: y
157
+ onChange: L
128
158
  }
129
159
  )
130
160
  ] }),
131
- N !== void 0 && h ? /* @__PURE__ */ n("div", { className: "aegis-folder-dropzone__summary", children: N }) : null,
132
- m ? /* @__PURE__ */ n("div", { className: "aegis-folder-dropzone__error", role: "alert", children: m }) : null
161
+ y !== void 0 && z ? /* @__PURE__ */ t("div", { className: "aegis-folder-dropzone__summary", children: y }) : null,
162
+ _ ? /* @__PURE__ */ t("div", { className: "aegis-folder-dropzone__error", role: "alert", children: _ }) : null
133
163
  ] });
134
164
  }
135
165
  export {
136
- Y as FolderDropzone
166
+ $ as FolderDropzone
137
167
  };
138
168
  //# sourceMappingURL=FolderDropzone.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FolderDropzone.js","sources":["../../../src/components/ui/FolderDropzone.tsx"],"sourcesContent":["import {\n type ChangeEvent,\n type ReactNode,\n useCallback,\n useRef,\n useState,\n} from 'react';\n\nimport { useDropzone } from 'react-dropzone';\n\nimport { formatBytes } from '../../lib/format';\nimport { Button } from './Button';\nimport './FolderDropzone.css';\nimport { filesFromEvent } from './dropFiles';\n\nexport interface FolderDropzoneProps {\n /** Currently-selected files; the component is controlled. */\n value: File[];\n /**\n * Called with the files of a picked or dropped folder (or picked files).\n * Each file of a folder carries its path inside the dropped or picked\n * folder in `webkitRelativePath`, e.g. `site/docs/intro.md`.\n */\n onFilesChange: (files: File[]) => void;\n /** Per-file ceiling (bytes). Files larger than this are rejected. */\n maxFileBytes?: number;\n /** Aggregate ceiling (bytes). Selections totalling more are rejected. */\n maxTotalBytes?: number;\n /** Hard cap on file count. */\n maxFiles?: number;\n /** `accept` attribute forwarded to the underlying `<input>`. */\n accept?: string;\n disabled?: boolean;\n /** Text shown beneath the drop area. */\n helperText?: ReactNode;\n /** External validation message; rendered in error tone when present. */\n validationError?: string;\n /**\n * Slot rendered below the drop area, e.g. a per-file summary list. Its\n * text is set in the UI face with tabular figures; wrap paths in\n * `MonoValue`.\n */\n summary?: ReactNode;\n className?: string;\n}\n\nexport function FolderDropzone({\n value,\n onFilesChange,\n maxFileBytes,\n maxTotalBytes,\n maxFiles,\n accept,\n disabled = false,\n helperText,\n validationError,\n summary,\n className,\n}: FolderDropzoneProps) {\n const folderInputRef = useRef<HTMLInputElement>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const [internalError, setInternalError] = useState<string>('');\n\n const applyFiles = useCallback(\n (incoming: File[]) => {\n if (disabled) {\n return;\n }\n if (incoming.length === 0) {\n return;\n }\n if (maxFiles !== undefined && incoming.length > maxFiles) {\n setInternalError(\n `Too many files: ${incoming.length.toString()} selected, ${maxFiles.toString()} allowed.`,\n );\n return;\n }\n if (maxFileBytes !== undefined) {\n const offender = incoming.find((f) => f.size > maxFileBytes);\n if (offender) {\n setInternalError(\n `\"${offender.name}\" is ${formatBytes(offender.size)}, over the ${formatBytes(maxFileBytes)} per-file cap.`,\n );\n return;\n }\n }\n if (maxTotalBytes !== undefined) {\n const total = incoming.reduce((acc, f) => acc + f.size, 0);\n if (total > maxTotalBytes) {\n setInternalError(\n `Selection totals ${formatBytes(total)}, over the ${formatBytes(maxTotalBytes)} aggregate cap.`,\n );\n return;\n }\n }\n setInternalError('');\n onFilesChange(incoming);\n },\n [disabled, maxFiles, maxFileBytes, maxTotalBytes, onFilesChange],\n );\n\n const handlePickFolder = useCallback(() => {\n folderInputRef.current?.click();\n }, []);\n\n const handlePickFiles = useCallback(() => {\n fileInputRef.current?.click();\n }, []);\n\n const handleClear = useCallback(() => {\n if (disabled) {\n return;\n }\n setInternalError('');\n onFilesChange([]);\n if (folderInputRef.current) {\n folderInputRef.current.value = '';\n }\n if (fileInputRef.current) {\n fileInputRef.current.value = '';\n }\n }, [disabled, onFilesChange]);\n\n const { getRootProps, isDragActive: dragActive } = useDropzone({\n onDrop: applyFiles,\n disabled,\n noClick: true,\n noKeyboard: true,\n getFilesFromEvent: filesFromEvent,\n });\n\n const handleInputChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const list = event.target.files;\n if (list) {\n applyFiles(Array.from(list));\n }\n },\n [applyFiles],\n );\n\n const errorMessage = validationError ?? internalError;\n const hasFiles = value.length > 0;\n const totalBytes = value.reduce((acc, f) => acc + f.size, 0);\n\n const surfaceClass = [\n 'aegis-folder-dropzone__surface',\n dragActive ? 'aegis-folder-dropzone__surface--active' : '',\n disabled ? 'aegis-folder-dropzone__surface--disabled' : '',\n errorMessage ? 'aegis-folder-dropzone__surface--error' : '',\n ]\n .filter(Boolean)\n .join(' ');\n\n const rootClass = ['aegis-folder-dropzone', className ?? '']\n .filter(Boolean)\n .join(' ');\n\n return (\n <div className={rootClass}>\n <div {...getRootProps({ className: surfaceClass })}>\n <div className=\"aegis-folder-dropzone__hint\">\n <span className=\"aegis-folder-dropzone__primary\">\n {dragActive\n ? 'Drop folder to upload'\n : hasFiles\n ? `${value.length.toString()} file${value.length === 1 ? '' : 's'} selected · ${formatBytes(totalBytes)}`\n : 'Drag a folder here, or choose one below'}\n </span>\n {!hasFiles && helperText !== undefined ? (\n <span className=\"aegis-folder-dropzone__meta\">{helperText}</span>\n ) : null}\n </div>\n <div className=\"aegis-folder-dropzone__actions\">\n <Button\n tone=\"secondary\"\n onClick={handlePickFolder}\n disabled={disabled}\n >\n Choose folder\n </Button>\n <Button\n tone=\"secondary\"\n onClick={handlePickFiles}\n disabled={disabled}\n >\n Choose files\n </Button>\n {hasFiles ? (\n <Button tone=\"ghost\" onClick={handleClear} disabled={disabled}>\n Clear\n </Button>\n ) : null}\n </div>\n <input\n ref={folderInputRef}\n type=\"file\"\n multiple\n accept={accept}\n disabled={disabled}\n tabIndex={-1}\n // @ts-expect-error -- non-standard but supported in Chromium/WebKit\n webkitdirectory=\"\"\n className=\"aegis-folder-dropzone__input\"\n onChange={handleInputChange}\n />\n <input\n ref={fileInputRef}\n type=\"file\"\n multiple\n accept={accept}\n disabled={disabled}\n tabIndex={-1}\n className=\"aegis-folder-dropzone__input\"\n onChange={handleInputChange}\n />\n </div>\n {summary !== undefined && hasFiles ? (\n <div className=\"aegis-folder-dropzone__summary\">{summary}</div>\n ) : null}\n {errorMessage ? (\n <div className=\"aegis-folder-dropzone__error\" role=\"alert\">\n {errorMessage}\n </div>\n ) : null}\n </div>\n );\n}\n"],"names":["FolderDropzone","value","onFilesChange","maxFileBytes","maxTotalBytes","maxFiles","accept","disabled","helperText","validationError","summary","className","folderInputRef","useRef","fileInputRef","internalError","setInternalError","useState","applyFiles","useCallback","incoming","offender","f","formatBytes","total","acc","handlePickFolder","handlePickFiles","handleClear","getRootProps","dragActive","useDropzone","filesFromEvent","handleInputChange","event","list","errorMessage","hasFiles","totalBytes","surfaceClass","rootClass","jsxs","jsx","Button"],"mappings":";;;;;;;AA8CO,SAASA,EAAe;AAAA,EAC7B,OAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,YAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AACF,GAAwB;AACtB,QAAMC,IAAiBC,EAAyB,IAAI,GA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],"sourcesContent":["import {\n type ChangeEvent,\n type ReactNode,\n useCallback,\n useRef,\n useState,\n} from 'react';\n\nimport { useDropzone } from 'react-dropzone';\n\nimport { formatBytes } from '../../lib/format';\nimport { type AegisStrings, useStrings } from '../../locale';\nimport { Button } from './Button';\nimport './FolderDropzone.css';\nimport { filesFromEvent } from './dropFiles';\n\nexport interface FolderDropzoneProps {\n /** Currently-selected files; the component is controlled. */\n value: File[];\n /**\n * Called with the files of a picked or dropped folder (or picked files).\n * Each file of a folder carries its path inside the dropped or picked\n * folder in `webkitRelativePath`, e.g. `site/docs/intro.md`.\n */\n onFilesChange: (files: File[]) => void;\n /** Per-file ceiling (bytes). Files larger than this are rejected. */\n maxFileBytes?: number;\n /** Aggregate ceiling (bytes). Selections totalling more are rejected. */\n maxTotalBytes?: number;\n /** Hard cap on file count. */\n maxFiles?: number;\n /** `accept` attribute forwarded to the underlying `<input>`. */\n accept?: string;\n disabled?: boolean;\n /** Text shown beneath the drop area. */\n helperText?: ReactNode;\n /** External validation message; rendered in error tone when present. */\n validationError?: string;\n /**\n * Slot rendered below the drop area, e.g. a per-file summary list. Its\n * text is set in the UI face with tabular figures; wrap paths in\n * `MonoValue`.\n */\n summary?: ReactNode;\n className?: string;\n}\n\ntype SelectionError =\n | { kind: 'tooMany'; count: number; max: number }\n | { kind: 'fileTooLarge'; name: string; size: number; max: number }\n | { kind: 'totalTooLarge'; total: number; max: number };\n\nfunction selectionErrorText(\n error: SelectionError,\n strings: AegisStrings,\n): string {\n switch (error.kind) {\n case 'tooMany':\n return strings.folderDropzoneTooMany(error.count, error.max);\n case 'fileTooLarge':\n return strings.folderDropzoneFileTooLarge(\n error.name,\n formatBytes(error.size),\n formatBytes(error.max),\n );\n case 'totalTooLarge':\n return strings.folderDropzoneTotalTooLarge(\n formatBytes(error.total),\n formatBytes(error.max),\n );\n }\n}\n\nexport function FolderDropzone({\n value,\n onFilesChange,\n maxFileBytes,\n maxTotalBytes,\n maxFiles,\n accept,\n disabled = false,\n helperText,\n validationError,\n summary,\n className,\n}: FolderDropzoneProps) {\n const strings = useStrings();\n const folderInputRef = useRef<HTMLInputElement>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const [internalError, setInternalError] = useState<SelectionError | null>(\n null,\n );\n\n const applyFiles = useCallback(\n (incoming: File[]) => {\n if (disabled) {\n return;\n }\n if (incoming.length === 0) {\n return;\n }\n if (maxFiles !== undefined && incoming.length > maxFiles) {\n setInternalError({\n kind: 'tooMany',\n count: incoming.length,\n max: maxFiles,\n });\n return;\n }\n if (maxFileBytes !== undefined) {\n const offender = incoming.find((f) => f.size > maxFileBytes);\n if (offender) {\n setInternalError({\n kind: 'fileTooLarge',\n name: offender.name,\n size: offender.size,\n max: maxFileBytes,\n });\n return;\n }\n }\n if (maxTotalBytes !== undefined) {\n const total = incoming.reduce((acc, f) => acc + f.size, 0);\n if (total > maxTotalBytes) {\n setInternalError({\n kind: 'totalTooLarge',\n total,\n max: maxTotalBytes,\n });\n return;\n }\n }\n setInternalError(null);\n onFilesChange(incoming);\n },\n [disabled, maxFiles, maxFileBytes, maxTotalBytes, onFilesChange],\n );\n\n const handlePickFolder = useCallback(() => {\n folderInputRef.current?.click();\n }, []);\n\n const handlePickFiles = useCallback(() => {\n fileInputRef.current?.click();\n }, []);\n\n const handleClear = useCallback(() => {\n if (disabled) {\n return;\n }\n setInternalError(null);\n onFilesChange([]);\n if (folderInputRef.current) {\n folderInputRef.current.value = '';\n }\n if (fileInputRef.current) {\n fileInputRef.current.value = '';\n }\n }, [disabled, onFilesChange]);\n\n const { getRootProps, isDragActive: dragActive } = useDropzone({\n onDrop: applyFiles,\n disabled,\n noClick: true,\n noKeyboard: true,\n getFilesFromEvent: filesFromEvent,\n });\n\n const handleInputChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const list = event.target.files;\n if (list) {\n applyFiles(Array.from(list));\n }\n },\n [applyFiles],\n );\n\n const errorMessage =\n validationError ??\n (internalError ? selectionErrorText(internalError, strings) : '');\n const hasFiles = value.length > 0;\n const totalBytes = value.reduce((acc, f) => acc + f.size, 0);\n\n const surfaceClass = [\n 'aegis-folder-dropzone__surface',\n dragActive ? 'aegis-folder-dropzone__surface--active' : '',\n disabled ? 'aegis-folder-dropzone__surface--disabled' : '',\n errorMessage ? 'aegis-folder-dropzone__surface--error' : '',\n ]\n .filter(Boolean)\n .join(' ');\n\n const rootClass = ['aegis-folder-dropzone', className ?? '']\n .filter(Boolean)\n .join(' ');\n\n return (\n <div className={rootClass}>\n <div {...getRootProps({ className: surfaceClass })}>\n <div className=\"aegis-folder-dropzone__hint\">\n <span className=\"aegis-folder-dropzone__primary\">\n {dragActive\n ? strings.dropzoneDropFolder\n : hasFiles\n ? strings.folderDropzoneSelected(\n value.length,\n formatBytes(totalBytes),\n )\n : strings.folderDropzoneHint}\n </span>\n {!hasFiles && helperText !== undefined ? (\n <span className=\"aegis-folder-dropzone__meta\">{helperText}</span>\n ) : null}\n </div>\n <div className=\"aegis-folder-dropzone__actions\">\n <Button\n tone=\"secondary\"\n onClick={handlePickFolder}\n disabled={disabled}\n >\n {strings.chooseFolder}\n </Button>\n <Button\n tone=\"secondary\"\n onClick={handlePickFiles}\n disabled={disabled}\n >\n {strings.chooseFiles}\n </Button>\n {hasFiles ? (\n <Button tone=\"ghost\" onClick={handleClear} disabled={disabled}>\n {strings.clear}\n </Button>\n ) : null}\n </div>\n <input\n ref={folderInputRef}\n type=\"file\"\n multiple\n accept={accept}\n disabled={disabled}\n tabIndex={-1}\n // @ts-expect-error -- non-standard but supported in Chromium/WebKit\n webkitdirectory=\"\"\n className=\"aegis-folder-dropzone__input\"\n onChange={handleInputChange}\n />\n <input\n ref={fileInputRef}\n type=\"file\"\n multiple\n accept={accept}\n disabled={disabled}\n tabIndex={-1}\n className=\"aegis-folder-dropzone__input\"\n onChange={handleInputChange}\n />\n </div>\n {summary !== undefined && hasFiles ? (\n <div className=\"aegis-folder-dropzone__summary\">{summary}</div>\n ) : null}\n {errorMessage ? (\n <div className=\"aegis-folder-dropzone__error\" role=\"alert\">\n {errorMessage}\n </div>\n ) : null}\n </div>\n );\n}\n"],"names":["selectionErrorText","error","strings","formatBytes","FolderDropzone","value","onFilesChange","maxFileBytes","maxTotalBytes","maxFiles","accept","disabled","helperText","validationError","summary","className","useStrings","folderInputRef","useRef","fileInputRef","internalError","setInternalError","useState","applyFiles","useCallback","incoming","offender","f","total","acc","handlePickFolder","handlePickFiles","handleClear","getRootProps","dragActive","useDropzone","filesFromEvent","handleInputChange","event","list","errorMessage","hasFiles","totalBytes","surfaceClass","rootClass","jsxs","jsx","Button"],"mappings":";;;;;;;;AAoDA,SAASA,EACPC,GACAC,GACQ;AACR,UAAQD,EAAM,MAAA;AAAA,IACZ,KAAK;AACH,aAAOC,EAAQ,sBAAsBD,EAAM,OAAOA,EAAM,GAAG;AAAA,IAC7D,KAAK;AACH,aAAOC,EAAQ;AAAA,QACbD,EAAM;AAAA,QACNE,EAAYF,EAAM,IAAI;AAAA,QACtBE,EAAYF,EAAM,GAAG;AAAA,MAAA;AAAA,IAEzB,KAAK;AACH,aAAOC,EAAQ;AAAA,QACbC,EAAYF,EAAM,KAAK;AAAA,QACvBE,EAAYF,EAAM,GAAG;AAAA,MAAA;AAAA,EACvB;AAEN;AAEO,SAASG,EAAe;AAAA,EAC7B,OAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,YAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AACF,GAAwB;AACtB,QAAMb,IAAUc,EAAA,GACVC,IAAiBC,EAAyB,IAAI,GAC9CC,IAAeD,EAAyB,IAAI,GAC5C,CAACE,GAAeC,CAAgB,IAAIC;AAAA,IACxC;AAAA,EAAA,GAGIC,IAAaC;AAAA,IACjB,CAACC,MAAqB;AACpB,UAAI,CAAAd,KAGAc,EAA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WAAU,kCACb,UAAA;AAAA,QAAA,gBAAAC;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,SAASjB;AAAA,YACT,UAAAnB;AAAA,YAEC,UAAAT,EAAQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAEX,gBAAA4C;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAShB;AAAA,YACT,UAAApB;AAAA,YAEC,UAAAT,EAAQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAEVuC,IACC,gBAAAK,EAACC,GAAA,EAAO,MAAK,SAAQ,SAASf,GAAa,UAAArB,GACxC,UAAAT,EAAQ,MAAA,CACX,IACE;AAAA,MAAA,GACN;AAAA,MACA,gBAAA4C;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,KAAK7B;AAAA,UACL,MAAK;AAAA,UACL,UAAQ;AAAA,UACR,QAAAP;AAAA,UACA,UAAAC;AAAA,UACA,UAAU;AAAA,UAEV,iBAAgB;AAAA,UAChB,WAAU;AAAA,UACV,UAAU0B;AAAA,QAAA;AAAA,MAAA;AAAA,MAEZ,gBAAAS;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,KAAK3B;AAAA,UACL,MAAK;AAAA,UACL,UAAQ;AAAA,UACR,QAAAT;AAAA,UACA,UAAAC;AAAA,UACA,UAAU;AAAA,UACV,WAAU;AAAA,UACV,UAAU0B;AAAA,QAAA;AAAA,MAAA;AAAA,IACZ,GACF;AAAA,IACCvB,MAAY,UAAa2B,IACxB,gBAAAK,EAAC,SAAI,WAAU,kCAAkC,aAAQ,IACvD;AAAA,IACHN,sBACE,OAAA,EAAI,WAAU,gCAA+B,MAAK,SAChD,aACH,IACE;AAAA,EAAA,GACN;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),u=require("./Alert.cjs"),x=require("./Button.cjs");;/* empty css */const b=require("./TextField.cjs"),g=require("./authValidation.cjs");function p({onSubmit:d,submitting:t=!1,error:o,success:i}){const[s,m]=n.useState(""),[c,f]=n.useState(!1),l=s.trim(),a=g.emailError(l),h=r=>{r.preventDefault(),f(!0),a===void 0&&d({email:l})};return i?e.jsx(u.Alert,{tone:"success",children:i}):e.jsxs("form",{className:"aegis-forgotform",onSubmit:h,noValidate:!0,children:[o&&e.jsx(u.Alert,{tone:"error",children:o}),e.jsx(b.TextField,{label:"Email",type:"email",autoComplete:"email",placeholder:"you@example.com",value:s,onChange:r=>m(r.target.value),disabled:t,required:!0,helperText:"We'll send a reset link to this address.",error:c?a:void 0}),e.jsx(x.Button,{tone:"primary",type:"submit",className:"aegis-forgotform__submit",disabled:t,children:t?"Sending…":"Send reset link"})]})}exports.ForgotPasswordForm=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),u=require("react"),d=require("./Alert.cjs"),S=require("./Button.cjs");;/* empty css */const x=require("./TextField.cjs"),b=require("./authValidation.cjs"),p=require("../../locale/useStrings.cjs");function q({onSubmit:m,submitting:r=!1,error:i,success:s}){const e=p.useStrings(),[a,c]=u.useState(""),[f,h]=u.useState(!1),n=a.trim(),l=b.emailError(n,e),g=o=>{o.preventDefault(),h(!0),l===void 0&&m({email:n})};return s?t.jsx(d.Alert,{tone:"success",children:s}):t.jsxs("form",{className:"aegis-forgotform",onSubmit:g,noValidate:!0,children:[i&&t.jsx(d.Alert,{tone:"error",children:i}),t.jsx(x.TextField,{label:e.authEmail,type:"email",autoComplete:"email",placeholder:"you@example.com",value:a,onChange:o=>c(o.target.value),disabled:r,required:!0,helperText:e.authResetHint,error:f?l:void 0}),t.jsx(S.Button,{tone:"primary",type:"submit",className:"aegis-forgotform__submit",disabled:r,children:r?e.authSending:e.authSendResetLink})]})}exports.ForgotPasswordForm=q;
2
2
  //# sourceMappingURL=ForgotPasswordForm.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ForgotPasswordForm.cjs","sources":["../../../src/components/ui/ForgotPasswordForm.tsx"],"sourcesContent":["import { type FormEvent, type ReactElement, useState } from 'react';\n\nimport { Alert } from './Alert';\nimport { Button } from './Button';\nimport './ForgotPasswordForm.css';\nimport { TextField } from './TextField';\nimport { emailError } from './authValidation';\n\ninterface ForgotPasswordFormValues {\n email: string;\n}\n\ninterface ForgotPasswordFormProps {\n /** Called only with a valid email address, trimmed. */\n onSubmit: (values: ForgotPasswordFormValues) => void | Promise<void>;\n submitting?: boolean;\n error?: string;\n success?: string;\n}\n\nexport function ForgotPasswordForm({\n onSubmit,\n submitting = false,\n error,\n success,\n}: ForgotPasswordFormProps): ReactElement {\n const [email, setEmail] = useState('');\n const [submitted, setSubmitted] = useState(false);\n\n const trimmedEmail = email.trim();\n const fieldError = emailError(trimmedEmail);\n\n const handleSubmit = (e: FormEvent<HTMLFormElement>): void => {\n e.preventDefault();\n setSubmitted(true);\n if (fieldError !== undefined) {\n return;\n }\n void onSubmit({ email: trimmedEmail });\n };\n\n if (success) {\n return <Alert tone=\"success\">{success}</Alert>;\n }\n\n return (\n <form className=\"aegis-forgotform\" onSubmit={handleSubmit} noValidate>\n {error && <Alert tone=\"error\">{error}</Alert>}\n <TextField\n label=\"Email\"\n type=\"email\"\n autoComplete=\"email\"\n placeholder=\"you@example.com\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n disabled={submitting}\n required\n helperText=\"We'll send a reset link to this address.\"\n error={submitted ? fieldError : undefined}\n />\n <Button\n tone=\"primary\"\n type=\"submit\"\n className=\"aegis-forgotform__submit\"\n disabled={submitting}\n >\n {submitting ? 'Sending…' : 'Send reset link'}\n </Button>\n </form>\n );\n}\n"],"names":["ForgotPasswordForm","onSubmit","submitting","error","success","email","setEmail","useState","submitted","setSubmitted","trimmedEmail","fieldError","emailError","handleSubmit","e","jsx","Alert","TextField","Button"],"mappings":"wSAoBO,SAASA,EAAmB,CACjC,SAAAC,EACA,WAAAC,EAAa,GACb,MAAAC,EACA,QAAAC,CACF,EAA0C,CACxC,KAAM,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAAS,EAAE,EAC/B,CAACC,EAAWC,CAAY,EAAIF,EAAAA,SAAS,EAAK,EAE1CG,EAAeL,EAAM,KAAA,EACrBM,EAAaC,EAAAA,WAAWF,CAAY,EAEpCG,EAAgBC,GAAwC,CAC5DA,EAAE,eAAA,EACFL,EAAa,EAAI,EACbE,IAAe,QAGdV,EAAS,CAAE,MAAOS,EAAc,CACvC,EAEA,OAAIN,EACKW,EAAAA,IAACC,EAAAA,MAAA,CAAM,KAAK,UAAW,SAAAZ,EAAQ,SAIrC,OAAA,CAAK,UAAU,mBAAmB,SAAUS,EAAc,WAAU,GAClE,SAAA,CAAAV,GAASY,EAAAA,IAACC,QAAA,CAAM,KAAK,QAAS,SAAAb,EAAM,EACrCY,EAAAA,IAACE,EAAAA,UAAA,CACC,MAAM,QACN,KAAK,QACL,aAAa,QACb,YAAY,kBACZ,MAAOZ,EACP,SAAWS,GAAMR,EAASQ,EAAE,OAAO,KAAK,EACxC,SAAUZ,EACV,SAAQ,GACR,WAAW,2CACX,MAAOM,EAAYG,EAAa,MAAA,CAAA,EAElCI,EAAAA,IAACG,EAAAA,OAAA,CACC,KAAK,UACL,KAAK,SACL,UAAU,2BACV,SAAUhB,EAET,WAAa,WAAa,iBAAA,CAAA,CAC7B,EACF,CAEJ"}
1
+ {"version":3,"file":"ForgotPasswordForm.cjs","sources":["../../../src/components/ui/ForgotPasswordForm.tsx"],"sourcesContent":["import { type FormEvent, type ReactElement, useState } from 'react';\n\nimport { useStrings } from '../../locale';\nimport { Alert } from './Alert';\nimport { Button } from './Button';\nimport './ForgotPasswordForm.css';\nimport { TextField } from './TextField';\nimport { emailError } from './authValidation';\n\ninterface ForgotPasswordFormValues {\n email: string;\n}\n\ninterface ForgotPasswordFormProps {\n /** Called only with a valid email address, trimmed. */\n onSubmit: (values: ForgotPasswordFormValues) => void | Promise<void>;\n submitting?: boolean;\n error?: string;\n success?: string;\n}\n\nexport function ForgotPasswordForm({\n onSubmit,\n submitting = false,\n error,\n success,\n}: ForgotPasswordFormProps): ReactElement {\n const strings = useStrings();\n const [email, setEmail] = useState('');\n const [submitted, setSubmitted] = useState(false);\n\n const trimmedEmail = email.trim();\n const fieldError = emailError(trimmedEmail, strings);\n\n const handleSubmit = (e: FormEvent<HTMLFormElement>): void => {\n e.preventDefault();\n setSubmitted(true);\n if (fieldError !== undefined) {\n return;\n }\n void onSubmit({ email: trimmedEmail });\n };\n\n if (success) {\n return <Alert tone=\"success\">{success}</Alert>;\n }\n\n return (\n <form className=\"aegis-forgotform\" onSubmit={handleSubmit} noValidate>\n {error && <Alert tone=\"error\">{error}</Alert>}\n <TextField\n label={strings.authEmail}\n type=\"email\"\n autoComplete=\"email\"\n placeholder=\"you@example.com\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n disabled={submitting}\n required\n helperText={strings.authResetHint}\n error={submitted ? fieldError : undefined}\n />\n <Button\n tone=\"primary\"\n type=\"submit\"\n className=\"aegis-forgotform__submit\"\n disabled={submitting}\n >\n {submitting ? strings.authSending : strings.authSendResetLink}\n </Button>\n </form>\n );\n}\n"],"names":["ForgotPasswordForm","onSubmit","submitting","error","success","strings","useStrings","email","setEmail","useState","submitted","setSubmitted","trimmedEmail","fieldError","emailError","handleSubmit","e","jsx","Alert","TextField","Button"],"mappings":"iVAqBO,SAASA,EAAmB,CACjC,SAAAC,EACA,WAAAC,EAAa,GACb,MAAAC,EACA,QAAAC,CACF,EAA0C,CACxC,MAAMC,EAAUC,EAAAA,WAAA,EACV,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAAS,EAAE,EAC/B,CAACC,EAAWC,CAAY,EAAIF,EAAAA,SAAS,EAAK,EAE1CG,EAAeL,EAAM,KAAA,EACrBM,EAAaC,EAAAA,WAAWF,EAAcP,CAAO,EAE7CU,EAAgBC,GAAwC,CAC5DA,EAAE,eAAA,EACFL,EAAa,EAAI,EACbE,IAAe,QAGdZ,EAAS,CAAE,MAAOW,EAAc,CACvC,EAEA,OAAIR,EACKa,EAAAA,IAACC,EAAAA,MAAA,CAAM,KAAK,UAAW,SAAAd,EAAQ,SAIrC,OAAA,CAAK,UAAU,mBAAmB,SAAUW,EAAc,WAAU,GAClE,SAAA,CAAAZ,GAASc,EAAAA,IAACC,QAAA,CAAM,KAAK,QAAS,SAAAf,EAAM,EACrCc,EAAAA,IAACE,EAAAA,UAAA,CACC,MAAOd,EAAQ,UACf,KAAK,QACL,aAAa,QACb,YAAY,kBACZ,MAAOE,EACP,SAAWS,GAAMR,EAASQ,EAAE,OAAO,KAAK,EACxC,SAAUd,EACV,SAAQ,GACR,WAAYG,EAAQ,cACpB,MAAOK,EAAYG,EAAa,MAAA,CAAA,EAElCI,EAAAA,IAACG,EAAAA,OAAA,CACC,KAAK,UACL,KAAK,SACL,UAAU,2BACV,SAAUlB,EAET,SAAAA,EAAaG,EAAQ,YAAcA,EAAQ,iBAAA,CAAA,CAC9C,EACF,CAEJ"}
@@ -1,49 +1,50 @@
1
- import { jsx as e, jsxs as h } from "react/jsx-runtime";
2
- import { useState as s } from "react";
3
- import { Alert as n } from "./Alert.js";
1
+ import { jsx as t, jsxs as g } from "react/jsx-runtime";
2
+ import { useState as n } from "react";
3
+ import { Alert as u } from "./Alert.js";
4
4
  import { Button as b } from "./Button.js";
5
5
  /* empty css */
6
- import { TextField as g } from "./TextField.js";
6
+ import { TextField as S } from "./TextField.js";
7
7
  import { emailError as v } from "./authValidation.js";
8
- function C({
8
+ import { useStrings as x } from "../../locale/useStrings.js";
9
+ function _({
9
10
  onSubmit: d,
10
11
  submitting: r = !1,
11
- error: o,
12
- success: i
12
+ error: i,
13
+ success: m
13
14
  }) {
14
- const [m, u] = s(""), [f, p] = s(!1), l = m.trim(), a = v(l), c = (t) => {
15
- t.preventDefault(), p(!0), a === void 0 && d({ email: l });
15
+ const e = x(), [a, f] = n(""), [p, c] = n(!1), l = a.trim(), s = v(l, e), h = (o) => {
16
+ o.preventDefault(), c(!0), s === void 0 && d({ email: l });
16
17
  };
17
- return i ? /* @__PURE__ */ e(n, { tone: "success", children: i }) : /* @__PURE__ */ h("form", { className: "aegis-forgotform", onSubmit: c, noValidate: !0, children: [
18
- o && /* @__PURE__ */ e(n, { tone: "error", children: o }),
19
- /* @__PURE__ */ e(
20
- g,
18
+ return m ? /* @__PURE__ */ t(u, { tone: "success", children: m }) : /* @__PURE__ */ g("form", { className: "aegis-forgotform", onSubmit: h, noValidate: !0, children: [
19
+ i && /* @__PURE__ */ t(u, { tone: "error", children: i }),
20
+ /* @__PURE__ */ t(
21
+ S,
21
22
  {
22
- label: "Email",
23
+ label: e.authEmail,
23
24
  type: "email",
24
25
  autoComplete: "email",
25
26
  placeholder: "you@example.com",
26
- value: m,
27
- onChange: (t) => u(t.target.value),
27
+ value: a,
28
+ onChange: (o) => f(o.target.value),
28
29
  disabled: r,
29
30
  required: !0,
30
- helperText: "We'll send a reset link to this address.",
31
- error: f ? a : void 0
31
+ helperText: e.authResetHint,
32
+ error: p ? s : void 0
32
33
  }
33
34
  ),
34
- /* @__PURE__ */ e(
35
+ /* @__PURE__ */ t(
35
36
  b,
36
37
  {
37
38
  tone: "primary",
38
39
  type: "submit",
39
40
  className: "aegis-forgotform__submit",
40
41
  disabled: r,
41
- children: r ? "Sending…" : "Send reset link"
42
+ children: r ? e.authSending : e.authSendResetLink
42
43
  }
43
44
  )
44
45
  ] });
45
46
  }
46
47
  export {
47
- C as ForgotPasswordForm
48
+ _ as ForgotPasswordForm
48
49
  };
49
50
  //# sourceMappingURL=ForgotPasswordForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ForgotPasswordForm.js","sources":["../../../src/components/ui/ForgotPasswordForm.tsx"],"sourcesContent":["import { type FormEvent, type ReactElement, useState } from 'react';\n\nimport { Alert } from './Alert';\nimport { Button } from './Button';\nimport './ForgotPasswordForm.css';\nimport { TextField } from './TextField';\nimport { emailError } from './authValidation';\n\ninterface ForgotPasswordFormValues {\n email: string;\n}\n\ninterface ForgotPasswordFormProps {\n /** Called only with a valid email address, trimmed. */\n onSubmit: (values: ForgotPasswordFormValues) => void | Promise<void>;\n submitting?: boolean;\n error?: string;\n success?: string;\n}\n\nexport function ForgotPasswordForm({\n onSubmit,\n submitting = false,\n error,\n success,\n}: ForgotPasswordFormProps): ReactElement {\n const [email, setEmail] = useState('');\n const [submitted, setSubmitted] = useState(false);\n\n const trimmedEmail = email.trim();\n const fieldError = emailError(trimmedEmail);\n\n const handleSubmit = (e: FormEvent<HTMLFormElement>): void => {\n e.preventDefault();\n setSubmitted(true);\n if (fieldError !== undefined) {\n return;\n }\n void onSubmit({ email: trimmedEmail });\n };\n\n if (success) {\n return <Alert tone=\"success\">{success}</Alert>;\n }\n\n return (\n <form className=\"aegis-forgotform\" onSubmit={handleSubmit} noValidate>\n {error && <Alert tone=\"error\">{error}</Alert>}\n <TextField\n label=\"Email\"\n type=\"email\"\n autoComplete=\"email\"\n placeholder=\"you@example.com\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n disabled={submitting}\n required\n helperText=\"We'll send a reset link to this address.\"\n error={submitted ? fieldError : undefined}\n />\n <Button\n tone=\"primary\"\n type=\"submit\"\n className=\"aegis-forgotform__submit\"\n disabled={submitting}\n >\n {submitting ? 'Sending…' : 'Send reset link'}\n </Button>\n </form>\n );\n}\n"],"names":["ForgotPasswordForm","onSubmit","submitting","error","success","email","setEmail","useState","submitted","setSubmitted","trimmedEmail","fieldError","emailError","handleSubmit","e","jsx","Alert","TextField","Button"],"mappings":";;;;;;;AAoBO,SAASA,EAAmB;AAAA,EACjC,UAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,OAAAC;AAAA,EACA,SAAAC;AACF,GAA0C;AACxC,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAS,EAAE,GAC/B,CAACC,GAAWC,CAAY,IAAIF,EAAS,EAAK,GAE1CG,IAAeL,EAAM,KAAA,GACrBM,IAAaC,EAAWF,CAAY,GAEpCG,IAAe,CAACC,MAAwC;AAG5D,IAFAA,EAAE,eAAA,GACFL,EAAa,EAAI,GACbE,MAAe,UAGdV,EAAS,EAAE,OAAOS,GAAc;AAAA,EACvC;AAEA,SAAIN,IACK,gBAAAW,EAACC,GAAA,EAAM,MAAK,WAAW,UAAAZ,GAAQ,sBAIrC,QAAA,EAAK,WAAU,oBAAmB,UAAUS,GAAc,YAAU,IAClE,UAAA;AAAA,IAAAV,KAAS,gBAAAY,EAACC,GAAA,EAAM,MAAK,SAAS,UAAAb,GAAM;AAAA,IACrC,gBAAAY;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,OAAM;AAAA,QACN,MAAK;AAAA,QACL,cAAa;AAAA,QACb,aAAY;AAAA,QACZ,OAAOZ;AAAA,QACP,UAAU,CAACS,MAAMR,EAASQ,EAAE,OAAO,KAAK;AAAA,QACxC,UAAUZ;AAAA,QACV,UAAQ;AAAA,QACR,YAAW;AAAA,QACX,OAAOM,IAAYG,IAAa;AAAA,MAAA;AAAA,IAAA;AAAA,IAElC,gBAAAI;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,MAAK;AAAA,QACL,WAAU;AAAA,QACV,UAAUhB;AAAA,QAET,cAAa,aAAa;AAAA,MAAA;AAAA,IAAA;AAAA,EAC7B,GACF;AAEJ;"}
1
+ {"version":3,"file":"ForgotPasswordForm.js","sources":["../../../src/components/ui/ForgotPasswordForm.tsx"],"sourcesContent":["import { type FormEvent, type ReactElement, useState } from 'react';\n\nimport { useStrings } from '../../locale';\nimport { Alert } from './Alert';\nimport { Button } from './Button';\nimport './ForgotPasswordForm.css';\nimport { TextField } from './TextField';\nimport { emailError } from './authValidation';\n\ninterface ForgotPasswordFormValues {\n email: string;\n}\n\ninterface ForgotPasswordFormProps {\n /** Called only with a valid email address, trimmed. */\n onSubmit: (values: ForgotPasswordFormValues) => void | Promise<void>;\n submitting?: boolean;\n error?: string;\n success?: string;\n}\n\nexport function ForgotPasswordForm({\n onSubmit,\n submitting = false,\n error,\n success,\n}: ForgotPasswordFormProps): ReactElement {\n const strings = useStrings();\n const [email, setEmail] = useState('');\n const [submitted, setSubmitted] = useState(false);\n\n const trimmedEmail = email.trim();\n const fieldError = emailError(trimmedEmail, strings);\n\n const handleSubmit = (e: FormEvent<HTMLFormElement>): void => {\n e.preventDefault();\n setSubmitted(true);\n if (fieldError !== undefined) {\n return;\n }\n void onSubmit({ email: trimmedEmail });\n };\n\n if (success) {\n return <Alert tone=\"success\">{success}</Alert>;\n }\n\n return (\n <form className=\"aegis-forgotform\" onSubmit={handleSubmit} noValidate>\n {error && <Alert tone=\"error\">{error}</Alert>}\n <TextField\n label={strings.authEmail}\n type=\"email\"\n autoComplete=\"email\"\n placeholder=\"you@example.com\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n disabled={submitting}\n required\n helperText={strings.authResetHint}\n error={submitted ? fieldError : undefined}\n />\n <Button\n tone=\"primary\"\n type=\"submit\"\n className=\"aegis-forgotform__submit\"\n disabled={submitting}\n >\n {submitting ? strings.authSending : strings.authSendResetLink}\n </Button>\n </form>\n );\n}\n"],"names":["ForgotPasswordForm","onSubmit","submitting","error","success","strings","useStrings","email","setEmail","useState","submitted","setSubmitted","trimmedEmail","fieldError","emailError","handleSubmit","e","jsx","Alert","TextField","Button"],"mappings":";;;;;;;;AAqBO,SAASA,EAAmB;AAAA,EACjC,UAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,OAAAC;AAAA,EACA,SAAAC;AACF,GAA0C;AACxC,QAAMC,IAAUC,EAAA,GACV,CAACC,GAAOC,CAAQ,IAAIC,EAAS,EAAE,GAC/B,CAACC,GAAWC,CAAY,IAAIF,EAAS,EAAK,GAE1CG,IAAeL,EAAM,KAAA,GACrBM,IAAaC,EAAWF,GAAcP,CAAO,GAE7CU,IAAe,CAACC,MAAwC;AAG5D,IAFAA,EAAE,eAAA,GACFL,EAAa,EAAI,GACbE,MAAe,UAGdZ,EAAS,EAAE,OAAOW,GAAc;AAAA,EACvC;AAEA,SAAIR,IACK,gBAAAa,EAACC,GAAA,EAAM,MAAK,WAAW,UAAAd,GAAQ,sBAIrC,QAAA,EAAK,WAAU,oBAAmB,UAAUW,GAAc,YAAU,IAClE,UAAA;AAAA,IAAAZ,KAAS,gBAAAc,EAACC,GAAA,EAAM,MAAK,SAAS,UAAAf,GAAM;AAAA,IACrC,gBAAAc;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,OAAOd,EAAQ;AAAA,QACf,MAAK;AAAA,QACL,cAAa;AAAA,QACb,aAAY;AAAA,QACZ,OAAOE;AAAA,QACP,UAAU,CAACS,MAAMR,EAASQ,EAAE,OAAO,KAAK;AAAA,QACxC,UAAUd;AAAA,QACV,UAAQ;AAAA,QACR,YAAYG,EAAQ;AAAA,QACpB,OAAOK,IAAYG,IAAa;AAAA,MAAA;AAAA,IAAA;AAAA,IAElC,gBAAAI;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,MAAK;AAAA,QACL,WAAU;AAAA,QACV,UAAUlB;AAAA,QAET,UAAAA,IAAaG,EAAQ,cAAcA,EAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,EAC9C,GACF;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react");;/* empty css */function t({label:a,description:r,controlId:s,children:o,className:n}){const i=d.useId(),l=`${i}-label`,c=r?`${s??i}-description`:void 0,m=["aegis-form-row",n??""].filter(Boolean).join(" ");return e.jsxs("div",{className:m,children:[e.jsxs("div",{className:"aegis-form-row__label-group",children:[s?e.jsx("label",{className:"aegis-form-row__label",htmlFor:s,children:a}):e.jsx("span",{id:l,className:"aegis-form-row__label",children:a}),r&&e.jsx("span",{id:c,className:"aegis-form-row__description",children:r})]}),s?e.jsx("div",{className:"aegis-form-row__control",children:o}):e.jsx("div",{className:"aegis-form-row__control",role:"group","aria-labelledby":l,"aria-describedby":c,children:o})]})}exports.FormRow=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react");;/* empty css */function b({label:o,description:r,controlId:s,labelBy:m="for",children:i,className:n}){const l=t.useId(),a=`${s??l}-label`,c=r?`${s??l}-description`:void 0,d=["aegis-form-row",n??""].filter(Boolean).join(" ");return e.jsxs("div",{className:d,children:[e.jsxs("div",{className:"aegis-form-row__label-group",children:[s&&m==="for"?e.jsx("label",{id:a,className:"aegis-form-row__label",htmlFor:s,children:o}):e.jsx("span",{id:a,className:"aegis-form-row__label",children:o}),r&&e.jsx("span",{id:c,className:"aegis-form-row__description",children:r})]}),s?e.jsx("div",{className:"aegis-form-row__control",children:i}):e.jsx("div",{className:"aegis-form-row__control",role:"group","aria-labelledby":a,"aria-describedby":c,children:i})]})}exports.FormRow=b;
2
2
  //# sourceMappingURL=FormRow.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormRow.cjs","sources":["../../../src/components/ui/FormRow.tsx"],"sourcesContent":["import { type ReactNode, useId } from 'react';\n\nimport './FormRow.css';\n\ninterface FormRowProps {\n label: string;\n description?: string;\n /**\n * Id of the one control the label names; put the same id on that\n * control. Inside an antd `Form.Item`, put it on the input, not on the\n * item. The description's id is then `${controlId}-description`; set\n * it as the control's `aria-describedby`. Without a controlId the row is\n * a group the label names and the description describes, for several\n * controls or a value that isn't a control.\n */\n controlId?: string;\n children: ReactNode;\n className?: string;\n}\n\nexport function FormRow({\n label,\n description,\n controlId,\n children,\n className,\n}: FormRowProps) {\n const baseId = useId();\n const labelId = `${baseId}-label`;\n const descriptionId = description\n ? `${controlId ?? baseId}-description`\n : undefined;\n const cls = ['aegis-form-row', className ?? ''].filter(Boolean).join(' ');\n\n return (\n <div className={cls}>\n <div className=\"aegis-form-row__label-group\">\n {controlId ? (\n <label className=\"aegis-form-row__label\" htmlFor={controlId}>\n {label}\n </label>\n ) : (\n <span id={labelId} className=\"aegis-form-row__label\">\n {label}\n </span>\n )}\n {description && (\n <span id={descriptionId} className=\"aegis-form-row__description\">\n {description}\n </span>\n )}\n </div>\n {controlId ? (\n <div className=\"aegis-form-row__control\">{children}</div>\n ) : (\n <div\n className=\"aegis-form-row__control\"\n role=\"group\"\n aria-labelledby={labelId}\n aria-describedby={descriptionId}\n >\n {children}\n </div>\n )}\n </div>\n );\n}\n"],"names":["FormRow","label","description","controlId","children","className","baseId","useId","labelId","descriptionId","cls","jsxs","jsx"],"mappings":"qKAoBO,SAASA,EAAQ,CACtB,MAAAC,EACA,YAAAC,EACA,UAAAC,EACA,SAAAC,EACA,UAAAC,CACF,EAAiB,CACf,MAAMC,EAASC,EAAAA,MAAA,EACTC,EAAU,GAAGF,CAAM,SACnBG,EAAgBP,EAClB,GAAGC,GAAaG,CAAM,eACtB,OACEI,EAAM,CAAC,iBAAkBL,GAAa,EAAE,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,EAExE,OACEM,EAAAA,KAAC,MAAA,CAAI,UAAWD,EACd,SAAA,CAAAC,EAAAA,KAAC,MAAA,CAAI,UAAU,8BACZ,SAAA,CAAAR,EACCS,EAAAA,IAAC,QAAA,CAAM,UAAU,wBAAwB,QAAST,EAC/C,SAAAF,CAAA,CACH,EAEAW,MAAC,OAAA,CAAK,GAAIJ,EAAS,UAAU,wBAC1B,SAAAP,EACH,EAEDC,GACCU,EAAAA,IAAC,OAAA,CAAK,GAAIH,EAAe,UAAU,8BAChC,SAAAP,CAAA,CACH,CAAA,EAEJ,EACCC,EACCS,EAAAA,IAAC,MAAA,CAAI,UAAU,0BAA2B,SAAAR,EAAS,EAEnDQ,EAAAA,IAAC,MAAA,CACC,UAAU,0BACV,KAAK,QACL,kBAAiBJ,EACjB,mBAAkBC,EAEjB,SAAAL,CAAA,CAAA,CACH,EAEJ,CAEJ"}
1
+ {"version":3,"file":"FormRow.cjs","sources":["../../../src/components/ui/FormRow.tsx"],"sourcesContent":["import { type ReactNode, useId } from 'react';\n\nimport './FormRow.css';\n\ninterface FormRowBaseProps {\n label: string;\n description?: string;\n children: ReactNode;\n className?: string;\n}\n\ntype FormRowProps = FormRowBaseProps &\n (\n | {\n /**\n * Id of the one control the label names; put the same id on that\n * control. Inside an antd `Form.Item`, put it on the input, not on\n * the item. The label's id is then `${controlId}-label` and the\n * description's `${controlId}-description`; set the description's\n * as the control's `aria-describedby`. Without a controlId the row\n * is a group the label names and the description describes, for\n * several controls or a value that isn't a control.\n */\n controlId: string;\n /**\n * How the label names the control. `'for'`, the default, renders a\n * `<label for={controlId}>`, for an input, select, textarea or\n * button. `'aria-labelledby'` is for a control a `<label>` cannot\n * name, such as a meter, a radio group or a code editor, or a\n * control whose content belongs in its name, such as PickerField:\n * the label is plain text, and the control takes\n * `${controlId}-label` as its `aria-labelledby`.\n */\n labelBy?: 'for' | 'aria-labelledby';\n }\n | { controlId?: undefined; labelBy?: never }\n );\n\n/**\n * Stacked at ≤768 px, the row stretches each direct child marked\n * `data-aegis-field`, as the library's fields are; a host's own field can\n * carry the marker too.\n */\nexport function FormRow({\n label,\n description,\n controlId,\n labelBy = 'for',\n children,\n className,\n}: FormRowProps) {\n const baseId = useId();\n const labelId = `${controlId ?? baseId}-label`;\n const descriptionId = description\n ? `${controlId ?? baseId}-description`\n : undefined;\n const cls = ['aegis-form-row', className ?? ''].filter(Boolean).join(' ');\n\n return (\n <div className={cls}>\n <div className=\"aegis-form-row__label-group\">\n {controlId && labelBy === 'for' ? (\n <label\n id={labelId}\n className=\"aegis-form-row__label\"\n htmlFor={controlId}\n >\n {label}\n </label>\n ) : (\n <span id={labelId} className=\"aegis-form-row__label\">\n {label}\n </span>\n )}\n {description && (\n <span id={descriptionId} className=\"aegis-form-row__description\">\n {description}\n </span>\n )}\n </div>\n {controlId ? (\n <div className=\"aegis-form-row__control\">{children}</div>\n ) : (\n <div\n className=\"aegis-form-row__control\"\n role=\"group\"\n aria-labelledby={labelId}\n aria-describedby={descriptionId}\n >\n {children}\n </div>\n )}\n </div>\n );\n}\n"],"names":["FormRow","label","description","controlId","labelBy","children","className","baseId","useId","labelId","descriptionId","cls","jsxs","jsx"],"mappings":"qKA2CO,SAASA,EAAQ,CACtB,MAAAC,EACA,YAAAC,EACA,UAAAC,EACA,QAAAC,EAAU,MACV,SAAAC,EACA,UAAAC,CACF,EAAiB,CACf,MAAMC,EAASC,EAAAA,MAAA,EACTC,EAAU,GAAGN,GAAaI,CAAM,SAChCG,EAAgBR,EAClB,GAAGC,GAAaI,CAAM,eACtB,OACEI,EAAM,CAAC,iBAAkBL,GAAa,EAAE,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,EAExE,OACEM,EAAAA,KAAC,MAAA,CAAI,UAAWD,EACd,SAAA,CAAAC,EAAAA,KAAC,MAAA,CAAI,UAAU,8BACZ,SAAA,CAAAT,GAAaC,IAAY,MACxBS,EAAAA,IAAC,QAAA,CACC,GAAIJ,EACJ,UAAU,wBACV,QAASN,EAER,SAAAF,CAAA,CAAA,EAGHY,EAAAA,IAAC,OAAA,CAAK,GAAIJ,EAAS,UAAU,wBAC1B,SAAAR,EACH,EAEDC,GACCW,EAAAA,IAAC,OAAA,CAAK,GAAIH,EAAe,UAAU,8BAChC,SAAAR,CAAA,CACH,CAAA,EAEJ,EACCC,EACCU,EAAAA,IAAC,MAAA,CAAI,UAAU,0BAA2B,SAAAR,EAAS,EAEnDQ,EAAAA,IAAC,MAAA,CACC,UAAU,0BACV,KAAK,QACL,kBAAiBJ,EACjB,mBAAkBC,EAEjB,SAAAL,CAAA,CAAA,CACH,EAEJ,CAEJ"}
@@ -1,18 +1,39 @@
1
1
  import { ReactNode } from 'react';
2
- interface FormRowProps {
2
+ interface FormRowBaseProps {
3
3
  label: string;
4
4
  description?: string;
5
- /**
6
- * Id of the one control the label names; put the same id on that
7
- * control. Inside an antd `Form.Item`, put it on the input, not on the
8
- * item. The description's id is then `${controlId}-description`; set
9
- * it as the control's `aria-describedby`. Without a controlId the row is
10
- * a group the label names and the description describes, for several
11
- * controls or a value that isn't a control.
12
- */
13
- controlId?: string;
14
5
  children: ReactNode;
15
6
  className?: string;
16
7
  }
17
- export declare function FormRow({ label, description, controlId, children, className, }: FormRowProps): import("react/jsx-runtime").JSX.Element;
8
+ type FormRowProps = FormRowBaseProps & ({
9
+ /**
10
+ * Id of the one control the label names; put the same id on that
11
+ * control. Inside an antd `Form.Item`, put it on the input, not on
12
+ * the item. The label's id is then `${controlId}-label` and the
13
+ * description's `${controlId}-description`; set the description's
14
+ * as the control's `aria-describedby`. Without a controlId the row
15
+ * is a group the label names and the description describes, for
16
+ * several controls or a value that isn't a control.
17
+ */
18
+ controlId: string;
19
+ /**
20
+ * How the label names the control. `'for'`, the default, renders a
21
+ * `<label for={controlId}>`, for an input, select, textarea or
22
+ * button. `'aria-labelledby'` is for a control a `<label>` cannot
23
+ * name, such as a meter, a radio group or a code editor, or a
24
+ * control whose content belongs in its name, such as PickerField:
25
+ * the label is plain text, and the control takes
26
+ * `${controlId}-label` as its `aria-labelledby`.
27
+ */
28
+ labelBy?: 'for' | 'aria-labelledby';
29
+ } | {
30
+ controlId?: undefined;
31
+ labelBy?: never;
32
+ });
33
+ /**
34
+ * Stacked at ≤768 px, the row stretches each direct child marked
35
+ * `data-aegis-field`, as the library's fields are; a host's own field can
36
+ * carry the marker too.
37
+ */
38
+ export declare function FormRow({ label, description, controlId, labelBy, children, className, }: FormRowProps): import("react/jsx-runtime").JSX.Element;
18
39
  export {};
@@ -1,32 +1,41 @@
1
1
  import { jsxs as c, jsx as a } from "react/jsx-runtime";
2
- import { useId as t } from "react";
2
+ import { useId as _ } from "react";
3
3
  /* empty css */
4
- function g({
5
- label: s,
6
- description: r,
7
- controlId: e,
8
- children: o,
9
- className: d
4
+ function p({
5
+ label: o,
6
+ description: e,
7
+ controlId: r,
8
+ labelBy: d = "for",
9
+ children: i,
10
+ className: n
10
11
  }) {
11
- const i = t(), l = `${i}-label`, m = r ? `${e ?? i}-description` : void 0, n = ["aegis-form-row", d ?? ""].filter(Boolean).join(" ");
12
- return /* @__PURE__ */ c("div", { className: n, children: [
12
+ const l = _(), s = `${r ?? l}-label`, m = e ? `${r ?? l}-description` : void 0, f = ["aegis-form-row", n ?? ""].filter(Boolean).join(" ");
13
+ return /* @__PURE__ */ c("div", { className: f, children: [
13
14
  /* @__PURE__ */ c("div", { className: "aegis-form-row__label-group", children: [
14
- e ? /* @__PURE__ */ a("label", { className: "aegis-form-row__label", htmlFor: e, children: s }) : /* @__PURE__ */ a("span", { id: l, className: "aegis-form-row__label", children: s }),
15
- r && /* @__PURE__ */ a("span", { id: m, className: "aegis-form-row__description", children: r })
15
+ r && d === "for" ? /* @__PURE__ */ a(
16
+ "label",
17
+ {
18
+ id: s,
19
+ className: "aegis-form-row__label",
20
+ htmlFor: r,
21
+ children: o
22
+ }
23
+ ) : /* @__PURE__ */ a("span", { id: s, className: "aegis-form-row__label", children: o }),
24
+ e && /* @__PURE__ */ a("span", { id: m, className: "aegis-form-row__description", children: e })
16
25
  ] }),
17
- e ? /* @__PURE__ */ a("div", { className: "aegis-form-row__control", children: o }) : /* @__PURE__ */ a(
26
+ r ? /* @__PURE__ */ a("div", { className: "aegis-form-row__control", children: i }) : /* @__PURE__ */ a(
18
27
  "div",
19
28
  {
20
29
  className: "aegis-form-row__control",
21
30
  role: "group",
22
- "aria-labelledby": l,
31
+ "aria-labelledby": s,
23
32
  "aria-describedby": m,
24
- children: o
33
+ children: i
25
34
  }
26
35
  )
27
36
  ] });
28
37
  }
29
38
  export {
30
- g as FormRow
39
+ p as FormRow
31
40
  };
32
41
  //# sourceMappingURL=FormRow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormRow.js","sources":["../../../src/components/ui/FormRow.tsx"],"sourcesContent":["import { type ReactNode, useId } from 'react';\n\nimport './FormRow.css';\n\ninterface FormRowProps {\n label: string;\n description?: string;\n /**\n * Id of the one control the label names; put the same id on that\n * control. Inside an antd `Form.Item`, put it on the input, not on the\n * item. The description's id is then `${controlId}-description`; set\n * it as the control's `aria-describedby`. Without a controlId the row is\n * a group the label names and the description describes, for several\n * controls or a value that isn't a control.\n */\n controlId?: string;\n children: ReactNode;\n className?: string;\n}\n\nexport function FormRow({\n label,\n description,\n controlId,\n children,\n className,\n}: FormRowProps) {\n const baseId = useId();\n const labelId = `${baseId}-label`;\n const descriptionId = description\n ? `${controlId ?? baseId}-description`\n : undefined;\n const cls = ['aegis-form-row', className ?? ''].filter(Boolean).join(' ');\n\n return (\n <div className={cls}>\n <div className=\"aegis-form-row__label-group\">\n {controlId ? (\n <label className=\"aegis-form-row__label\" htmlFor={controlId}>\n {label}\n </label>\n ) : (\n <span id={labelId} className=\"aegis-form-row__label\">\n {label}\n </span>\n )}\n {description && (\n <span id={descriptionId} className=\"aegis-form-row__description\">\n {description}\n </span>\n )}\n </div>\n {controlId ? (\n <div className=\"aegis-form-row__control\">{children}</div>\n ) : (\n <div\n className=\"aegis-form-row__control\"\n role=\"group\"\n aria-labelledby={labelId}\n aria-describedby={descriptionId}\n >\n {children}\n </div>\n )}\n </div>\n );\n}\n"],"names":["FormRow","label","description","controlId","children","className","baseId","useId","labelId","descriptionId","cls","jsxs","jsx"],"mappings":";;;AAoBO,SAASA,EAAQ;AAAA,EACtB,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AACF,GAAiB;AACf,QAAMC,IAASC,EAAA,GACTC,IAAU,GAAGF,CAAM,UACnBG,IAAgBP,IAClB,GAAGC,KAAaG,CAAM,iBACtB,QACEI,IAAM,CAAC,kBAAkBL,KAAa,EAAE,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAExE,SACE,gBAAAM,EAAC,OAAA,EAAI,WAAWD,GACd,UAAA;AAAA,IAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,+BACZ,UAAA;AAAA,MAAAR,IACC,gBAAAS,EAAC,SAAA,EAAM,WAAU,yBAAwB,SAAST,GAC/C,UAAAF,EAAA,CACH,IAEA,gBAAAW,EAAC,QAAA,EAAK,IAAIJ,GAAS,WAAU,yBAC1B,UAAAP,GACH;AAAA,MAEDC,KACC,gBAAAU,EAAC,QAAA,EAAK,IAAIH,GAAe,WAAU,+BAChC,UAAAP,EAAA,CACH;AAAA,IAAA,GAEJ;AAAA,IACCC,IACC,gBAAAS,EAAC,OAAA,EAAI,WAAU,2BAA2B,UAAAR,GAAS,IAEnD,gBAAAQ;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,MAAK;AAAA,QACL,mBAAiBJ;AAAA,QACjB,oBAAkBC;AAAA,QAEjB,UAAAL;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GAEJ;AAEJ;"}
1
+ {"version":3,"file":"FormRow.js","sources":["../../../src/components/ui/FormRow.tsx"],"sourcesContent":["import { type ReactNode, useId } from 'react';\n\nimport './FormRow.css';\n\ninterface FormRowBaseProps {\n label: string;\n description?: string;\n children: ReactNode;\n className?: string;\n}\n\ntype FormRowProps = FormRowBaseProps &\n (\n | {\n /**\n * Id of the one control the label names; put the same id on that\n * control. Inside an antd `Form.Item`, put it on the input, not on\n * the item. The label's id is then `${controlId}-label` and the\n * description's `${controlId}-description`; set the description's\n * as the control's `aria-describedby`. Without a controlId the row\n * is a group the label names and the description describes, for\n * several controls or a value that isn't a control.\n */\n controlId: string;\n /**\n * How the label names the control. `'for'`, the default, renders a\n * `<label for={controlId}>`, for an input, select, textarea or\n * button. `'aria-labelledby'` is for a control a `<label>` cannot\n * name, such as a meter, a radio group or a code editor, or a\n * control whose content belongs in its name, such as PickerField:\n * the label is plain text, and the control takes\n * `${controlId}-label` as its `aria-labelledby`.\n */\n labelBy?: 'for' | 'aria-labelledby';\n }\n | { controlId?: undefined; labelBy?: never }\n );\n\n/**\n * Stacked at ≤768 px, the row stretches each direct child marked\n * `data-aegis-field`, as the library's fields are; a host's own field can\n * carry the marker too.\n */\nexport function FormRow({\n label,\n description,\n controlId,\n labelBy = 'for',\n children,\n className,\n}: FormRowProps) {\n const baseId = useId();\n const labelId = `${controlId ?? baseId}-label`;\n const descriptionId = description\n ? `${controlId ?? baseId}-description`\n : undefined;\n const cls = ['aegis-form-row', className ?? ''].filter(Boolean).join(' ');\n\n return (\n <div className={cls}>\n <div className=\"aegis-form-row__label-group\">\n {controlId && labelBy === 'for' ? (\n <label\n id={labelId}\n className=\"aegis-form-row__label\"\n htmlFor={controlId}\n >\n {label}\n </label>\n ) : (\n <span id={labelId} className=\"aegis-form-row__label\">\n {label}\n </span>\n )}\n {description && (\n <span id={descriptionId} className=\"aegis-form-row__description\">\n {description}\n </span>\n )}\n </div>\n {controlId ? (\n <div className=\"aegis-form-row__control\">{children}</div>\n ) : (\n <div\n className=\"aegis-form-row__control\"\n role=\"group\"\n aria-labelledby={labelId}\n aria-describedby={descriptionId}\n >\n {children}\n </div>\n )}\n </div>\n );\n}\n"],"names":["FormRow","label","description","controlId","labelBy","children","className","baseId","useId","labelId","descriptionId","cls","jsxs","jsx"],"mappings":";;;AA2CO,SAASA,EAAQ;AAAA,EACtB,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,UAAAC;AAAA,EACA,WAAAC;AACF,GAAiB;AACf,QAAMC,IAASC,EAAA,GACTC,IAAU,GAAGN,KAAaI,CAAM,UAChCG,IAAgBR,IAClB,GAAGC,KAAaI,CAAM,iBACtB,QACEI,IAAM,CAAC,kBAAkBL,KAAa,EAAE,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAExE,SACE,gBAAAM,EAAC,OAAA,EAAI,WAAWD,GACd,UAAA;AAAA,IAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,+BACZ,UAAA;AAAA,MAAAT,KAAaC,MAAY,QACxB,gBAAAS;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,IAAIJ;AAAA,UACJ,WAAU;AAAA,UACV,SAASN;AAAA,UAER,UAAAF;AAAA,QAAA;AAAA,MAAA,IAGH,gBAAAY,EAAC,QAAA,EAAK,IAAIJ,GAAS,WAAU,yBAC1B,UAAAR,GACH;AAAA,MAEDC,KACC,gBAAAW,EAAC,QAAA,EAAK,IAAIH,GAAe,WAAU,+BAChC,UAAAR,EAAA,CACH;AAAA,IAAA,GAEJ;AAAA,IACCC,IACC,gBAAAU,EAAC,OAAA,EAAI,WAAU,2BAA2B,UAAAR,GAAS,IAEnD,gBAAAQ;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,MAAK;AAAA,QACL,mBAAiBJ;AAAA,QACjB,oBAAkBC;AAAA,QAEjB,UAAAL;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GAEJ;AAEJ;"}