nexus-shared 1.1.21 → 3.0.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 (376) hide show
  1. package/CHANGELOG.md +262 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1000 -0
  4. package/dist/Client.Index.d.ts +55 -0
  5. package/dist/Client.Index.js +60 -0
  6. package/dist/Components/Chats/Chat.d.ts +28 -0
  7. package/dist/Components/Chats/Chat.js +19 -0
  8. package/dist/Components/Chats/ChatButton.d.ts +26 -0
  9. package/dist/Components/Chats/ChatButton.js +41 -0
  10. package/dist/Components/Chats/ChatComposer.d.ts +41 -0
  11. package/dist/Components/Chats/ChatComposer.js +177 -0
  12. package/dist/Components/Chats/ChatConversations.d.ts +35 -0
  13. package/dist/Components/Chats/ChatConversations.js +38 -0
  14. package/dist/Components/Chats/ChatPanel.d.ts +66 -0
  15. package/dist/Components/Chats/ChatPanel.js +94 -0
  16. package/dist/Components/Chats/ChatParts.d.ts +87 -0
  17. package/dist/Components/Chats/ChatParts.js +100 -0
  18. package/dist/Components/Chats/ChatThread.d.ts +22 -0
  19. package/dist/Components/Chats/ChatThread.js +96 -0
  20. package/dist/Components/Documents/Button.d.ts +29 -0
  21. package/dist/Components/Documents/Button.js +11 -0
  22. package/dist/Components/Documents/Menu.d.ts +102 -0
  23. package/dist/Components/Documents/Menu.js +242 -0
  24. package/dist/Components/Documents/SplitButton.d.ts +64 -0
  25. package/dist/Components/Documents/SplitButton.js +129 -0
  26. package/dist/Components/Documents/TabButtons.d.ts +80 -0
  27. package/dist/Components/Documents/TabButtons.js +38 -0
  28. package/dist/Components/Forms/ApiForm.d.ts +23 -0
  29. package/dist/Components/Forms/ApiForm.js +100 -0
  30. package/dist/Components/Forms/Crud.d.ts +17 -0
  31. package/dist/Components/Forms/Crud.js +708 -0
  32. package/dist/Components/Forms/CrudParts.d.ts +15 -0
  33. package/dist/Components/Forms/CrudParts.js +36 -0
  34. package/dist/Components/Forms/ExcelImport.d.ts +42 -0
  35. package/dist/Components/Forms/ExcelImport.js +190 -0
  36. package/dist/Components/Forms/Form.d.ts +52 -0
  37. package/dist/Components/Forms/Form.js +323 -0
  38. package/dist/Components/Forms/SubmitForm.d.ts +65 -0
  39. package/dist/Components/Forms/SubmitForm.js +198 -0
  40. package/dist/Components/Inputs/Calendar.d.ts +69 -0
  41. package/dist/Components/Inputs/Calendar.js +258 -0
  42. package/dist/Components/Inputs/CheckBox.d.ts +53 -0
  43. package/dist/Components/Inputs/CheckBox.js +87 -0
  44. package/dist/Components/Inputs/CheckBoxGroup.d.ts +20 -0
  45. package/dist/Components/Inputs/CheckBoxGroup.js +80 -0
  46. package/dist/Components/Inputs/ChoiceField.d.ts +122 -0
  47. package/dist/Components/Inputs/ChoiceField.js +169 -0
  48. package/dist/Components/Inputs/DatePicker.d.ts +54 -0
  49. package/dist/Components/Inputs/DatePicker.js +246 -0
  50. package/dist/Components/Inputs/DateRangePicker.d.ts +62 -0
  51. package/dist/Components/Inputs/DateRangePicker.js +283 -0
  52. package/dist/Components/Inputs/DateTimePicker.d.ts +75 -0
  53. package/dist/Components/Inputs/DateTimePicker.js +400 -0
  54. package/dist/Components/Inputs/Dropdown.d.ts +117 -0
  55. package/dist/Components/Inputs/Dropdown.js +839 -0
  56. package/dist/Components/Inputs/DropdownParts.d.ts +84 -0
  57. package/dist/Components/Inputs/DropdownParts.js +102 -0
  58. package/dist/Components/Inputs/EditorShell.d.ts +45 -0
  59. package/dist/Components/Inputs/EditorShell.js +214 -0
  60. package/dist/Components/Inputs/Field.d.ts +53 -0
  61. package/dist/Components/Inputs/Field.js +16 -0
  62. package/dist/Components/Inputs/GroupForm.d.ts +20 -0
  63. package/dist/Components/Inputs/GroupForm.js +172 -0
  64. package/dist/Components/Inputs/InputField.d.ts +59 -0
  65. package/dist/Components/Inputs/InputField.js +169 -0
  66. package/dist/Components/Inputs/InputRenderer.d.ts +37 -0
  67. package/dist/Components/Inputs/InputRenderer.js +99 -0
  68. package/dist/Components/Inputs/MarkdownEditor.d.ts +67 -0
  69. package/dist/Components/Inputs/MarkdownEditor.js +289 -0
  70. package/dist/Components/Inputs/NumberBox.d.ts +53 -0
  71. package/dist/Components/Inputs/NumberBox.js +228 -0
  72. package/dist/Components/Inputs/RadioGroup.d.ts +20 -0
  73. package/dist/Components/Inputs/RadioGroup.js +43 -0
  74. package/dist/Components/Inputs/ReadOnlyNotice.d.ts +36 -0
  75. package/dist/Components/Inputs/ReadOnlyNotice.js +117 -0
  76. package/dist/Components/Inputs/RichTextEditor.d.ts +103 -0
  77. package/dist/Components/Inputs/RichTextEditor.js +1170 -0
  78. package/dist/Components/Inputs/RichTextParts.d.ts +63 -0
  79. package/dist/Components/Inputs/RichTextParts.js +157 -0
  80. package/dist/Components/Inputs/RowsInput.d.ts +115 -0
  81. package/dist/Components/Inputs/RowsInput.js +308 -0
  82. package/dist/Components/Inputs/Slider.d.ts +87 -0
  83. package/dist/Components/Inputs/Slider.js +216 -0
  84. package/dist/Components/Inputs/TabularForm.d.ts +27 -0
  85. package/dist/Components/Inputs/TabularForm.js +348 -0
  86. package/dist/Components/Inputs/TextArea.d.ts +43 -0
  87. package/dist/Components/Inputs/TextArea.js +31 -0
  88. package/dist/Components/Inputs/TextBox.d.ts +52 -0
  89. package/dist/Components/Inputs/TextBox.js +58 -0
  90. package/dist/Components/Inputs/TextField.d.ts +31 -0
  91. package/dist/Components/Inputs/TextField.js +35 -0
  92. package/dist/Components/Inputs/TimePanel.d.ts +34 -0
  93. package/dist/Components/Inputs/TimePanel.js +288 -0
  94. package/dist/Components/Inputs/TimePicker.d.ts +54 -0
  95. package/dist/Components/Inputs/TimePicker.js +240 -0
  96. package/dist/Components/Inputs/TreeView.d.ts +160 -0
  97. package/dist/Components/Inputs/TreeView.js +947 -0
  98. package/dist/Components/Layouts/MessageBox.d.ts +71 -0
  99. package/dist/Components/Layouts/MessageBox.js +104 -0
  100. package/dist/Components/Layouts/Popup.d.ts +92 -0
  101. package/dist/Components/Layouts/Popup.js +376 -0
  102. package/dist/Components/Layouts/PopupContext.d.ts +2 -0
  103. package/dist/Components/Layouts/PopupContext.js +4 -0
  104. package/dist/Components/Layouts/PopupDock.d.ts +22 -0
  105. package/dist/Components/Layouts/PopupDock.js +121 -0
  106. package/dist/Components/Layouts/PopupHost.d.ts +56 -0
  107. package/dist/Components/Layouts/PopupHost.js +163 -0
  108. package/dist/Components/Layouts/PopupRules.d.ts +30 -0
  109. package/dist/Components/Layouts/PopupRules.js +63 -0
  110. package/dist/Components/Layouts/ThemePicker.d.ts +13 -0
  111. package/dist/Components/Layouts/ThemePicker.js +22 -0
  112. package/dist/Components/Layouts/ThemeScript.d.ts +14 -0
  113. package/dist/Components/Layouts/ThemeScript.js +13 -0
  114. package/dist/Components/Layouts/ThemeSwitcher.d.ts +13 -0
  115. package/dist/Components/Layouts/ThemeSwitcher.js +49 -0
  116. package/dist/Components/Layouts/Toaster.d.ts +76 -0
  117. package/dist/Components/Layouts/Toaster.js +172 -0
  118. package/dist/Components/Viewers/DataTable.d.ts +25 -0
  119. package/dist/Components/Viewers/DataTable.js +596 -0
  120. package/dist/Components/Viewers/DataTableColumns.d.ts +28 -0
  121. package/dist/Components/Viewers/DataTableColumns.js +243 -0
  122. package/dist/Components/Viewers/DataTableParts.d.ts +138 -0
  123. package/dist/Components/Viewers/DataTableParts.js +157 -0
  124. package/dist/Components/Viewers/MarkdownView.d.ts +26 -0
  125. package/dist/Components/Viewers/MarkdownView.js +79 -0
  126. package/dist/Components/Viewers/RichTextView.d.ts +18 -0
  127. package/dist/Components/Viewers/RichTextView.js +17 -0
  128. package/dist/Helpers/AnimationHelpers.d.ts +6 -0
  129. package/dist/Helpers/AnimationHelpers.js +35 -0
  130. package/dist/Helpers/ApiClient.d.ts +96 -0
  131. package/dist/Helpers/ApiClient.js +200 -0
  132. package/dist/Helpers/ApiFormHelpers.d.ts +49 -0
  133. package/dist/Helpers/ApiFormHelpers.js +120 -0
  134. package/dist/Helpers/ApiModules.d.ts +131 -0
  135. package/dist/Helpers/ApiModules.js +195 -0
  136. package/dist/Helpers/ApiResponses.d.ts +51 -0
  137. package/dist/Helpers/ApiResponses.js +250 -0
  138. package/dist/Helpers/ApiRoutes.d.ts +140 -0
  139. package/dist/Helpers/ApiRoutes.js +183 -0
  140. package/dist/Helpers/ApiToasts.d.ts +21 -0
  141. package/dist/Helpers/ApiToasts.js +22 -0
  142. package/dist/Helpers/ChatBackend.d.ts +134 -0
  143. package/dist/Helpers/ChatBackend.js +332 -0
  144. package/dist/Helpers/ChatHelpers.d.ts +189 -0
  145. package/dist/Helpers/ChatHelpers.js +486 -0
  146. package/dist/Helpers/ChatHooks.d.ts +81 -0
  147. package/dist/Helpers/ChatHooks.js +175 -0
  148. package/dist/Helpers/ChatStore.d.ts +132 -0
  149. package/dist/Helpers/ChatStore.js +394 -0
  150. package/dist/Helpers/ChatSummaries.d.ts +39 -0
  151. package/dist/Helpers/ChatSummaries.js +118 -0
  152. package/dist/Helpers/ClassHelpers.d.ts +3 -0
  153. package/dist/Helpers/ClassHelpers.js +4 -0
  154. package/dist/Helpers/CrudBackend.d.ts +98 -0
  155. package/dist/Helpers/CrudBackend.js +214 -0
  156. package/dist/Helpers/CrudHelpers.d.ts +111 -0
  157. package/dist/Helpers/CrudHelpers.js +267 -0
  158. package/dist/Helpers/DateHelpers.d.ts +88 -0
  159. package/dist/Helpers/DateHelpers.js +363 -0
  160. package/dist/Helpers/DatePreferences.d.ts +14 -0
  161. package/dist/Helpers/DatePreferences.js +94 -0
  162. package/dist/Helpers/DateTimeHelpers.d.ts +87 -0
  163. package/dist/Helpers/DateTimeHelpers.js +286 -0
  164. package/dist/Helpers/DragHelpers.d.ts +129 -0
  165. package/dist/Helpers/DragHelpers.js +281 -0
  166. package/dist/Helpers/DropdownHelpers.d.ts +56 -0
  167. package/dist/Helpers/DropdownHelpers.js +180 -0
  168. package/dist/Helpers/ExcelBackend.d.ts +106 -0
  169. package/dist/Helpers/ExcelBackend.js +290 -0
  170. package/dist/Helpers/ExcelHelpers.d.ts +98 -0
  171. package/dist/Helpers/ExcelHelpers.js +302 -0
  172. package/dist/Helpers/FormDrafts.d.ts +18 -0
  173. package/dist/Helpers/FormDrafts.js +76 -0
  174. package/dist/Helpers/FormStore.d.ts +233 -0
  175. package/dist/Helpers/FormStore.js +752 -0
  176. package/dist/Helpers/InputParamsHelpers.d.ts +79 -0
  177. package/dist/Helpers/InputParamsHelpers.js +388 -0
  178. package/dist/Helpers/MarkdownEditing.d.ts +27 -0
  179. package/dist/Helpers/MarkdownEditing.js +250 -0
  180. package/dist/Helpers/MarkdownHelpers.d.ts +82 -0
  181. package/dist/Helpers/MarkdownHelpers.js +775 -0
  182. package/dist/Helpers/MessageBuilder.d.ts +74 -0
  183. package/dist/Helpers/MessageBuilder.js +252 -0
  184. package/dist/Helpers/NepaliCalendar.d.ts +25 -0
  185. package/dist/Helpers/NepaliCalendar.js +107 -0
  186. package/dist/Helpers/NumberHelpers.d.ts +71 -0
  187. package/dist/Helpers/NumberHelpers.js +202 -0
  188. package/dist/Helpers/Permissions.d.ts +62 -0
  189. package/dist/Helpers/Permissions.js +133 -0
  190. package/dist/Helpers/PopoverHelpers.d.ts +68 -0
  191. package/dist/Helpers/PopoverHelpers.js +195 -0
  192. package/dist/Helpers/RichTextHelpers.d.ts +77 -0
  193. package/dist/Helpers/RichTextHelpers.js +1072 -0
  194. package/dist/Helpers/RowsStore.d.ts +166 -0
  195. package/dist/Helpers/RowsStore.js +606 -0
  196. package/dist/Helpers/TableColumns.d.ts +47 -0
  197. package/dist/Helpers/TableColumns.js +282 -0
  198. package/dist/Helpers/TableExport.d.ts +30 -0
  199. package/dist/Helpers/TableExport.js +97 -0
  200. package/dist/Helpers/TableHelpers.d.ts +110 -0
  201. package/dist/Helpers/TableHelpers.js +301 -0
  202. package/dist/Helpers/TableStore.d.ts +142 -0
  203. package/dist/Helpers/TableStore.js +530 -0
  204. package/dist/Helpers/ThemeHelpers.d.ts +15 -0
  205. package/dist/Helpers/ThemeHelpers.js +16 -0
  206. package/dist/Helpers/TimeHelpers.d.ts +73 -0
  207. package/dist/Helpers/TimeHelpers.js +253 -0
  208. package/dist/Helpers/TreeStore.d.ts +188 -0
  209. package/dist/Helpers/TreeStore.js +577 -0
  210. package/dist/Helpers/ValidationHelpers.d.ts +124 -0
  211. package/dist/Helpers/ValidationHelpers.js +301 -0
  212. package/dist/Interfaces/ApiInterfaces.d.ts +174 -0
  213. package/dist/Interfaces/ApiInterfaces.js +30 -0
  214. package/dist/Interfaces/ChatInterfaces.d.ts +240 -0
  215. package/{src/sso-client.tsx → dist/Interfaces/ChatInterfaces.js} +1 -1
  216. package/dist/Interfaces/CrudInterfaces.d.ts +232 -0
  217. package/dist/Interfaces/CrudInterfaces.js +1 -0
  218. package/dist/Interfaces/DateInterfaces.d.ts +154 -0
  219. package/dist/Interfaces/DateInterfaces.js +29 -0
  220. package/dist/Interfaces/ExcelInterfaces.d.ts +215 -0
  221. package/dist/Interfaces/ExcelInterfaces.js +45 -0
  222. package/dist/Interfaces/FormInterfaces.d.ts +402 -0
  223. package/dist/Interfaces/FormInterfaces.js +1 -0
  224. package/dist/Interfaces/InputInterfaces.d.ts +141 -0
  225. package/dist/Interfaces/InputInterfaces.js +1 -0
  226. package/dist/Interfaces/MessageInterfaces.d.ts +111 -0
  227. package/dist/Interfaces/MessageInterfaces.js +5 -0
  228. package/dist/Interfaces/TableInterfaces.d.ts +351 -0
  229. package/dist/Interfaces/TableInterfaces.js +1 -0
  230. package/dist/Interfaces/ThemeInterfaces.d.ts +17 -0
  231. package/dist/Interfaces/ThemeInterfaces.js +17 -0
  232. package/dist/Interfaces/TypeInterfaces.d.ts +4 -0
  233. package/dist/Interfaces/TypeInterfaces.js +1 -0
  234. package/dist/Server.Index.d.ts +2 -0
  235. package/dist/Server.Index.js +5 -0
  236. package/dist/Services/ApiProxy.d.ts +32 -0
  237. package/dist/Services/ApiProxy.js +111 -0
  238. package/dist/Services/BrowserApi.d.ts +95 -0
  239. package/dist/Services/BrowserApi.js +129 -0
  240. package/dist/Services/ChatApi.d.ts +37 -0
  241. package/dist/Services/ChatApi.js +98 -0
  242. package/dist/Services/ExcelApi.d.ts +46 -0
  243. package/dist/Services/ExcelApi.js +196 -0
  244. package/dist/Services/ServerApi.d.ts +54 -0
  245. package/dist/Services/ServerApi.js +78 -0
  246. package/dist/Services/ThemeService.d.ts +17 -0
  247. package/dist/Services/ThemeService.js +83 -0
  248. package/dist/Shared.Index.d.ts +51 -0
  249. package/dist/Shared.Index.js +55 -0
  250. package/package.json +85 -33
  251. package/src/Styles/Nexus.Base.css +70 -0
  252. package/src/Styles/Nexus.Button.css +153 -0
  253. package/src/Styles/Nexus.Calendar.css +275 -0
  254. package/src/Styles/Nexus.Chat.css +1489 -0
  255. package/src/Styles/Nexus.Choice.css +345 -0
  256. package/src/Styles/Nexus.Crud.css +161 -0
  257. package/src/Styles/Nexus.DateTime.css +81 -0
  258. package/src/Styles/Nexus.Dropdown.css +774 -0
  259. package/src/Styles/Nexus.Editor.css +297 -0
  260. package/src/Styles/Nexus.Excel.css +370 -0
  261. package/src/Styles/Nexus.Form.css +321 -0
  262. package/src/Styles/Nexus.Index.css +36 -0
  263. package/src/Styles/Nexus.Input.css +637 -0
  264. package/src/Styles/Nexus.Markdown.css +265 -0
  265. package/src/Styles/Nexus.Menu.css +259 -0
  266. package/src/Styles/Nexus.Popup.css +731 -0
  267. package/src/Styles/Nexus.RichText.css +463 -0
  268. package/src/Styles/Nexus.Rows.css +596 -0
  269. package/src/Styles/Nexus.Slider.css +278 -0
  270. package/src/Styles/Nexus.Tab.Buttons.css +419 -0
  271. package/src/Styles/Nexus.Table.css +1296 -0
  272. package/src/Styles/Nexus.Theme.Picker.css +232 -0
  273. package/src/Styles/Nexus.Themes.css +194 -0
  274. package/src/Styles/Nexus.Time.css +147 -0
  275. package/src/Styles/Nexus.Toast.css +265 -0
  276. package/src/Styles/Nexus.Tokens.css +72 -0
  277. package/src/Styles/Nexus.Tree.css +435 -0
  278. package/src/api-services/authentication-service.tsx +0 -23
  279. package/src/api-services/preference-service.tsx +0 -5
  280. package/src/api-services/system-service.tsx +0 -29
  281. package/src/client.ts +0 -31
  282. package/src/components/documents/button.tsx +0 -133
  283. package/src/components/documents/icon-box.tsx +0 -93
  284. package/src/components/documents/page-title.tsx +0 -7
  285. package/src/components/documents/tab-button.tsx +0 -172
  286. package/src/components/documents/tag.tsx +0 -30
  287. package/src/components/index.js +0 -0
  288. package/src/components/inputs/checkbox-input.tsx +0 -66
  289. package/src/components/inputs/input-box.tsx +0 -48
  290. package/src/components/inputs/input-element.tsx +0 -65
  291. package/src/components/inputs/input-form.tsx +0 -164
  292. package/src/components/inputs/input.tsx +0 -181
  293. package/src/components/inputs/number-input.tsx +0 -108
  294. package/src/components/inputs/radiobox-input.tsx +0 -53
  295. package/src/components/inputs/textarea-input.tsx +0 -47
  296. package/src/components/inputs/textbox-input.tsx +0 -45
  297. package/src/components/layouts/global-dialogbox.tsx +0 -431
  298. package/src/components/layouts/global-layout.tsx +0 -64
  299. package/src/components/layouts/layout-helpers.tsx +0 -20
  300. package/src/components/layouts/panels/user-panel.tsx +0 -112
  301. package/src/components/layouts/utility-menu.tsx +0 -49
  302. package/src/components/panels/theme-panel.tsx +0 -46
  303. package/src/helpers/bitwise-helpers.tsx +0 -11
  304. package/src/helpers/browser-helpers.tsx +0 -156
  305. package/src/helpers/datasource-helpers.tsx +0 -99
  306. package/src/helpers/element-helpers.tsx +0 -123
  307. package/src/helpers/input-helpers.tsx +0 -74
  308. package/src/helpers/string-helpers.tsx +0 -28
  309. package/src/helpers/utility-helpers.tsx +0 -45
  310. package/src/helpers/validation-helpers.tsx +0 -302
  311. package/src/index.ts +0 -26
  312. package/src/interface.ts +0 -19
  313. package/src/interfaces/auth-token-interfaces.tsx +0 -6
  314. package/src/interfaces/browser-interfaces.tsx +0 -36
  315. package/src/interfaces/button-interfaces.tsx +0 -63
  316. package/src/interfaces/datasource-interfaces.tsx +0 -22
  317. package/src/interfaces/datatable-interfaces.tsx +0 -25
  318. package/src/interfaces/dialogbox-interfaces.tsx +0 -5
  319. package/src/interfaces/exception-interfaces.tsx +0 -99
  320. package/src/interfaces/http-interfaces.tsx +0 -129
  321. package/src/interfaces/icon-interfaces.tsx +0 -129
  322. package/src/interfaces/input-interfaces.tsx +0 -410
  323. package/src/interfaces/layout-interfaces.tsx +0 -191
  324. package/src/interfaces/menu-interfaces.tsx +0 -53
  325. package/src/interfaces/message-interfaces.tsx +0 -32
  326. package/src/interfaces/permission-interfaces.tsx +0 -9
  327. package/src/interfaces/storage-interfaces.tsx +0 -5
  328. package/src/interfaces/system-interfaces.tsx +0 -22
  329. package/src/interfaces/theme-interfaces.tsx +0 -123
  330. package/src/interfaces/type-interfaces.tsx +0 -28
  331. package/src/interfaces/user-interfaces.tsx +0 -47
  332. package/src/nexus-client.tsx +0 -21
  333. package/src/nexus.environments.tsx +0 -66
  334. package/src/proxy-api/proxy-backend.tsx +0 -60
  335. package/src/proxy-api/proxy-constants.tsx +0 -28
  336. package/src/proxy-api/proxy-helpers.tsx +0 -91
  337. package/src/proxy-api-client.tsx +0 -1
  338. package/src/proxy-api-server.tsx +0 -2
  339. package/src/services/http-client-services.tsx +0 -75
  340. package/src/services/http-services.tsx +0 -158
  341. package/src/services/loader-service.tsx +0 -185
  342. package/src/services/localstorage-service.tsx +0 -119
  343. package/src/services/message-services.tsx +0 -383
  344. package/src/services/theme-service.tsx +0 -163
  345. package/src/services/user-services.tsx +0 -10
  346. package/src/sso-config/auth-token-validation.ts +0 -16
  347. package/src/sso-config/callback-route.tsx +0 -35
  348. package/src/sso-config/cookie-encryption.ts +0 -51
  349. package/src/sso-config/cookie-helpers.tsx +0 -102
  350. package/src/sso-config/forgot-password-route.tsx +0 -36
  351. package/src/sso-config/oauth-callback-state.ts +0 -61
  352. package/src/sso-config/pkce-helpers.ts +0 -9
  353. package/src/sso-config/provider-complete-route.tsx +0 -18
  354. package/src/sso-config/redirect-context-actions.tsx +0 -45
  355. package/src/sso-config/redirect-context-helpers.tsx +0 -159
  356. package/src/sso-config/redirect-context-persist.tsx +0 -18
  357. package/src/sso-config/redirect-context-route.tsx +0 -45
  358. package/src/sso-config/refresh-route.tsx +0 -23
  359. package/src/sso-config/sign-in-route.tsx +0 -74
  360. package/src/sso-config/sign-out-route.tsx +0 -57
  361. package/src/sso-config/sign-up-route.tsx +0 -57
  362. package/src/sso-config/sso-backend-flow.ts +0 -38
  363. package/src/sso-config/sso-complete-route.tsx +0 -50
  364. package/src/sso-config/sso-config.ts +0 -59
  365. package/src/sso-config/sso-interfaces.tsx +0 -99
  366. package/src/sso-config/sso-response-helpers.tsx +0 -20
  367. package/src/sso-server.tsx +0 -21
  368. package/src/styles/nexus.animation.css +0 -269
  369. package/src/styles/nexus.core.css +0 -119
  370. package/src/styles/nexus.dialog.css +0 -144
  371. package/src/styles/nexus.grid-view.css +0 -42
  372. package/src/styles/nexus.icon.css +0 -51
  373. package/src/styles/nexus.input.css +0 -207
  374. package/src/styles/nexus.loader.css +0 -11
  375. package/src/styles/nexus.logic.css +0 -47
  376. package/src/styles/nexus.utility.css +0 -347
@@ -0,0 +1,215 @@
1
+ import type { ApiEndpoint, ApiModuleValue, AppModule } from "./ApiInterfaces.ts";
2
+ /**
3
+ * What one column of a sheet holds. It decides the cell's format in the file, the check the spreadsheet makes while
4
+ * the person types, and the input the review editors draw. The numbers are the backend's (`EExcelDataTypes`); an
5
+ * object, not an enum, so a test that strips types can import it.
6
+ */
7
+ export declare const ExcelDataType: {
8
+ /** One line of text: a name, a code. */
9
+ readonly Text: 0;
10
+ /** Many lines of text: a description, a note. */
11
+ readonly Note: 1;
12
+ /** A whole number, no decimals. */
13
+ readonly WholeNumber: 2;
14
+ /** A number with decimals. */
15
+ readonly Decimal: 3;
16
+ /** Money: decimals fixed at the backend's places. */
17
+ readonly Amount: 4;
18
+ /** A date with no time, as an ISO date: `2026-09-29`. */
19
+ readonly Date: 5;
20
+ /** A date and a time, zone-less, as `2026-09-29 14:30`. */
21
+ readonly DateTime: 6;
22
+ /** A time of day with no date: `14:30`. */
23
+ readonly Time: 7;
24
+ /** Yes or No. */
25
+ readonly YesNo: 8;
26
+ /** A choice from a list the backend owns, picked in the sheet and travelling as its key. */
27
+ readonly List: 9;
28
+ };
29
+ export type ExcelDataType = (typeof ExcelDataType)[keyof typeof ExcelDataType];
30
+ /** What one row of an upload turned out to be. The backend's `EExcelRowKinds`. */
31
+ export declare const ExcelRowKind: {
32
+ /** Nothing is wrong with it and it is not a record yet: this is what an import writes. */
33
+ readonly New: 0;
34
+ /** It is already a record, or repeats a row earlier in the file. Nothing updates it. */
35
+ readonly Duplicate: 1;
36
+ /** Something in it has to be fixed before it can be written. */
37
+ readonly Invalid: 2;
38
+ };
39
+ export type ExcelRowKind = (typeof ExcelRowKind)[keyof typeof ExcelRowKind];
40
+ /** One column of a sheet: enough to draw a heading, know what the cell holds, and check it before anything is sent. */
41
+ export interface ExcelColumnInfo {
42
+ /** The property behind it, and the key every row's values are held under: `CityName`. */
43
+ field: string;
44
+ /** The heading the person reads: "City name". */
45
+ header: string;
46
+ dataType: ExcelDataType;
47
+ /** A row with this cell empty is refused. */
48
+ isRequired?: boolean;
49
+ /** The file fills it, not the person. */
50
+ isReadOnly?: boolean;
51
+ /** It is a choice: it travels as a key with its words beside it, and is picked in the sheet. */
52
+ isReference?: boolean;
53
+ /** The list it picks from. */
54
+ list?: string | null;
55
+ minLength?: number;
56
+ maxLength?: number;
57
+ /** Least value of a number. Only a number has one. */
58
+ minimum?: number | null;
59
+ /** Most value of a number. */
60
+ maximum?: number | null;
61
+ /** What the person reads about this column, in their words. */
62
+ note?: string | null;
63
+ }
64
+ /**
65
+ * The limits and the shape of a sheet, asked for before either side is offered: so an export that will be cut short is
66
+ * said before it is written, and the editors know what they are drawing. It is the same for everybody and changes once
67
+ * a release, so it is kept.
68
+ */
69
+ export interface ExcelSettings {
70
+ /** What one row is: "City". */
71
+ subject: string;
72
+ /** What the downloaded template is called. */
73
+ templateFileName?: string;
74
+ /** Rows the template offers to fill. */
75
+ sheetRows?: number;
76
+ /** The most rows one export writes. Over this, the person is warned first. */
77
+ maxExportRows: number;
78
+ /** The most rows one import takes. */
79
+ maxImportRows: number;
80
+ /** The columns, in the order they read. */
81
+ columns: ExcelColumnInfo[];
82
+ /**
83
+ * How each column should be drawn as an input. **Empty** until the backend can describe an input, and `columns` is
84
+ * what the editors draw from until it is not.
85
+ */
86
+ inputs?: readonly unknown[];
87
+ }
88
+ /** One thing wrong with one cell, told so the person can find it. */
89
+ export interface ExcelCellProblem {
90
+ /** The row of the sheet, the number down the side of the file. */
91
+ row: number;
92
+ /** The column, counting from 1. */
93
+ column: number;
94
+ /** The cell as a spreadsheet names it: `B7`. */
95
+ cell: string;
96
+ /** The column's heading, in the person's words. */
97
+ header: string;
98
+ /** The property behind it, which is what an editor binds to. */
99
+ field: string;
100
+ /** What to tell the person, in plain words. */
101
+ message: string;
102
+ /** The unique code of the line that found it, for a developer. */
103
+ messageCode?: string;
104
+ /** What kind of failure it is, as a number. */
105
+ errorCode?: number;
106
+ }
107
+ /** One row of the review: what it holds, what it turned out to be, and what is wrong with it. */
108
+ export interface ExcelReviewRow {
109
+ /** The row of the sheet, so the person can find it in their own file. */
110
+ number: number;
111
+ kind: ExcelRowKind;
112
+ /** What each column held, by the property's name. A choice holds its key, never a plain id. */
113
+ values: Record<string, string | null>;
114
+ /** What the person picked in each choice, for the review to show. */
115
+ labels?: Record<string, string | null>;
116
+ /** Everything wrong with the row, one per cell. */
117
+ problems?: ExcelCellProblem[];
118
+ /** Why it is a duplicate, in the person's words. */
119
+ duplicate?: string | null;
120
+ }
121
+ /** What a verify answers: the whole upload, counted and told row by row. Nothing was written. */
122
+ export interface ExcelVerifyAnswer {
123
+ /** What one row is. */
124
+ subject: string;
125
+ /** Rows that had something in them. Empty rows of the template are not counted. */
126
+ read: number;
127
+ /** Rows an import would write. */
128
+ new: number;
129
+ /** Rows that are already records, or repeat one earlier in the file. */
130
+ duplicates: number;
131
+ /** Rows with something to fix. */
132
+ invalid: number;
133
+ /** An import would write something and nothing is waiting on a fix. */
134
+ isReady: boolean;
135
+ /** The upload in one sentence, for above the review. */
136
+ note: string;
137
+ /** The columns, in the order they read. */
138
+ columns: ExcelColumnInfo[];
139
+ /** Every row that had something in it. */
140
+ rows: ExcelReviewRow[];
141
+ /** Empty until the backend can describe an input. */
142
+ inputs?: readonly unknown[];
143
+ }
144
+ /**
145
+ * One row as it travels, in text and nothing else. The same shape in both directions, which is the point: a verify
146
+ * reads it out of the file and answers with it, the person fixes what they need to, and the import sends the same rows
147
+ * back to be read again by the same code. A reference column holds its key.
148
+ */
149
+ export interface ExcelSheetRow {
150
+ /** The row of the sheet this came from, so every problem can name where it is. */
151
+ number: number;
152
+ /** What each column held, by the property's name. A reference holds its key. */
153
+ values: Record<string, string | null>;
154
+ /** What the person picked in each reference column: "Nepal (NP)". */
155
+ labels?: Record<string, string | null>;
156
+ }
157
+ /** What an import did: what it wrote, and what it did not, in the person's words. */
158
+ export interface ExcelImportAnswer {
159
+ /** Rows the request carried. */
160
+ sent: number;
161
+ /** Records written. */
162
+ created: number;
163
+ /** Rows that were already records. Nothing was updated. */
164
+ duplicates: number;
165
+ /** Rows that still had something to fix. */
166
+ invalid: number;
167
+ /** The rows nothing was written for, so the person sees which and why without asking again. */
168
+ refused?: ExcelReviewRow[];
169
+ /** What happened, in one sentence. */
170
+ note: string;
171
+ }
172
+ /**
173
+ * The endpoints of one model's spreadsheets. `excelEndpoints` builds the Nexus ones; an app on another backend writes
174
+ * its own object of the same four or five.
175
+ *
176
+ * `export` is the model's own action, because only the model knows what the person has on screen - the search, the
177
+ * filters, which list they are looking at, and whose rows they may see. Without one, no export is offered.
178
+ */
179
+ export interface ExcelEndpoints<TModule extends ApiModuleValue = AppModule> {
180
+ /** The limits and the shape of the sheet. The one answer a browser may keep. */
181
+ settings: ApiEndpoint<TModule>;
182
+ /** The template to fill, as a file. */
183
+ template: ApiEndpoint<TModule>;
184
+ /** A filled file read and judged, with nothing written. */
185
+ verify: ApiEndpoint<TModule>;
186
+ /** Writes the rows a verify answered with, as the person left them. */
187
+ import: ApiEndpoint<TModule>;
188
+ /** The model's own export, with the search on screen. */
189
+ export?: ApiEndpoint<TModule>;
190
+ }
191
+ /** What the person has on screen, as an export asks for it. The model's own filters go in `filters`. */
192
+ export interface ExcelExportQuery {
193
+ /** The search box's text. */
194
+ search?: string | null;
195
+ /** The sorted column, as the server names it. */
196
+ sort?: string | null;
197
+ /** Which way it is sorted. */
198
+ direction?: "asc" | "desc";
199
+ /** The filters the page holds, sent as they are: a list, a date range, a status. */
200
+ filters?: Record<string, unknown>;
201
+ }
202
+ /** A file an endpoint answered with, and what it says about itself. */
203
+ export interface ExcelDownload {
204
+ blob: Blob;
205
+ /** The name the answer gave it (`Content-Disposition`), else the one that was asked for. */
206
+ fileName: string;
207
+ /** Rows written into the file, when the answer says. */
208
+ rows?: number;
209
+ /** Rows asked for that did not fit under the limit. */
210
+ skipped?: number;
211
+ /** The most rows one export writes, as the backend has it. */
212
+ limit?: number;
213
+ /** What to tell the person when rows were left out. */
214
+ note?: string;
215
+ }
@@ -0,0 +1,45 @@
1
+ /*
2
+ * Types of the spreadsheet side: what a model's sheet is made of, what a verify answers, what an import sends back, and
3
+ * the endpoints that serve all three. One shape travels both ways (`ExcelSheetRow`), so a verify and an import can
4
+ * never disagree about a row.
5
+ *
6
+ * A reference column travels as its **key** - an encrypted id made for the person who downloaded the file - with the
7
+ * words they picked beside it. The plain id in the sheet is theirs to read and is never read back, so a value copied
8
+ * out of a spreadsheet, or out of a verify answer, cannot be posted to an endpoint as an id.
9
+ */
10
+ /**
11
+ * What one column of a sheet holds. It decides the cell's format in the file, the check the spreadsheet makes while
12
+ * the person types, and the input the review editors draw. The numbers are the backend's (`EExcelDataTypes`); an
13
+ * object, not an enum, so a test that strips types can import it.
14
+ */
15
+ export const ExcelDataType = {
16
+ /** One line of text: a name, a code. */
17
+ Text: 0,
18
+ /** Many lines of text: a description, a note. */
19
+ Note: 1,
20
+ /** A whole number, no decimals. */
21
+ WholeNumber: 2,
22
+ /** A number with decimals. */
23
+ Decimal: 3,
24
+ /** Money: decimals fixed at the backend's places. */
25
+ Amount: 4,
26
+ /** A date with no time, as an ISO date: `2026-09-29`. */
27
+ Date: 5,
28
+ /** A date and a time, zone-less, as `2026-09-29 14:30`. */
29
+ DateTime: 6,
30
+ /** A time of day with no date: `14:30`. */
31
+ Time: 7,
32
+ /** Yes or No. */
33
+ YesNo: 8,
34
+ /** A choice from a list the backend owns, picked in the sheet and travelling as its key. */
35
+ List: 9,
36
+ };
37
+ /** What one row of an upload turned out to be. The backend's `EExcelRowKinds`. */
38
+ export const ExcelRowKind = {
39
+ /** Nothing is wrong with it and it is not a record yet: this is what an import writes. */
40
+ New: 0,
41
+ /** It is already a record, or repeats a row earlier in the file. Nothing updates it. */
42
+ Duplicate: 1,
43
+ /** Something in it has to be fixed before it can be written. */
44
+ Invalid: 2,
45
+ };
@@ -0,0 +1,402 @@
1
+ import type { CSSProperties, ReactNode, Ref } from "react";
2
+ import type { CheckBoxOnlyProps, CheckBoxProps } from "../Components/Inputs/CheckBox.tsx";
3
+ import type { CheckBoxGroupProps } from "../Components/Inputs/CheckBoxGroup.tsx";
4
+ import type { DatePickerProps } from "../Components/Inputs/DatePicker.tsx";
5
+ import type { DateRangePickerProps } from "../Components/Inputs/DateRangePicker.tsx";
6
+ import type { DateTimePickerProps } from "../Components/Inputs/DateTimePicker.tsx";
7
+ import type { DropdownProps } from "../Components/Inputs/Dropdown.tsx";
8
+ import type { MarkdownEditorProps } from "../Components/Inputs/MarkdownEditor.tsx";
9
+ import type { NumberBoxProps } from "../Components/Inputs/NumberBox.tsx";
10
+ import type { RadioGroupProps } from "../Components/Inputs/RadioGroup.tsx";
11
+ import type { RichTextEditorProps } from "../Components/Inputs/RichTextEditor.tsx";
12
+ import type { RangeSliderProps, SliderProps } from "../Components/Inputs/Slider.tsx";
13
+ import type { TextAreaProps } from "../Components/Inputs/TextArea.tsx";
14
+ import type { TextBoxProps, TextBoxType } from "../Components/Inputs/TextBox.tsx";
15
+ import type { TimePickerProps } from "../Components/Inputs/TimePicker.tsx";
16
+ import type { TreeViewProps } from "../Components/Inputs/TreeView.tsx";
17
+ import type { FormStore } from "../Helpers/FormStore.ts";
18
+ import type { ApiEndpoint, ApiResult } from "./ApiInterfaces.ts";
19
+ import type { DatePreferences } from "./DateInterfaces.ts";
20
+ import type { InputDesign, OptionValue } from "./InputInterfaces.ts";
21
+ import type { Size } from "./TypeInterfaces.ts";
22
+ /** Where a form places an input. The input itself ignores these keys. */
23
+ export interface InputLayoutParams {
24
+ /** Optional heading before this field when the section changes (Form only). */
25
+ section?: string;
26
+ /** Columns the input spans in a form's 12-column grid, and in a group form's section. Default 12, the full width. */
27
+ span?: number;
28
+ /** The column's width in a tabular form: a CSS length ("9rem") or pixels. Default by type, e.g. 10rem for text. */
29
+ width?: number | string;
30
+ /** The column's share of the spare width in a tabular form. Default 1; checkboxes, switches, and radios 0 (their width only). */
31
+ grow?: number;
32
+ /** Leaves the input out, e.g. a field only some roles may see. Its value stays in the data as it was. */
33
+ hidden?: boolean;
34
+ /**
35
+ * Other inputs of the same form this one follows (Form only). When any of their values changes, this input draws
36
+ * again — without mounting again, so nothing typed in it is lost — and its params are read afresh: a getter for
37
+ * `hidden`, `readOnly`, `readOnlyMessage`, `label`, `hint` or `options` answers for the values as they are now. Its
38
+ * own rule is checked again too, so a `required` that a getter just switched on or off counts at once. Name the
39
+ * input itself to follow its own typing (a hint that says what the typed text will become).
40
+ *
41
+ * An input that names any is asked `hidden` every time it draws, so it can come and go; one that names none is
42
+ * asked once, when the form draws.
43
+ */
44
+ dependsOn?: readonly string[];
45
+ }
46
+ /** What every input's params have. */
47
+ export interface InputParamsBase<TType extends string = string> extends InputLayoutParams {
48
+ /** Which input: "text", "number", "dropdown", "date", "tabular", ... */
49
+ type: TType;
50
+ /** The key of the value in the form's data, and in each row of a tabular or group form. */
51
+ name: string;
52
+ label?: ReactNode;
53
+ readOnly?: boolean;
54
+ disabled?: boolean;
55
+ }
56
+ /** Props the form sets itself: it holds the value and the element. */
57
+ type FormOwnedProps = "type" | "name" | "ref" | "value" | "checked";
58
+ /** Omit that keeps each member of a union apart, so a dropdown's `multiple: true` still decides its value's type. */
59
+ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
60
+ /** An input's params: its component's props without the ones the form owns, plus the base keys. */
61
+ export type InputParamsOf<TType extends string, TProps> = DistributiveOmit<TProps, FormOwnedProps> & InputParamsBase<TType>;
62
+ /** `TextBox`: "text", "email", "password", "search", "tel", or "url". */
63
+ export type TextInputParams = InputParamsOf<TextBoxType, TextBoxProps>;
64
+ export type TextAreaParams = InputParamsOf<"textarea", TextAreaProps>;
65
+ export type NumberInputParams = InputParamsOf<"number", NumberBoxProps>;
66
+ /** A checkbox: `true` or `false`. `defaultChecked` is the value of a new row. */
67
+ export type CheckBoxParams = InputParamsOf<"checkbox", CheckBoxProps & CheckBoxOnlyProps>;
68
+ export type SwitchParams = InputParamsOf<"switch", CheckBoxProps>;
69
+ /**
70
+ * One radio button, on or off. In a tabular or group form only one row can have it on, like a primary address: turning
71
+ * it on in a row turns it off in the others. `required` there means one row must have it.
72
+ */
73
+ export type RadioParams = InputParamsOf<"radio", CheckBoxProps>;
74
+ export type CheckBoxGroupParams = InputParamsOf<"checkbox-group", CheckBoxGroupProps<OptionValue>>;
75
+ export type RadioGroupParams = InputParamsOf<"radio-group", RadioGroupProps<OptionValue>>;
76
+ /** A list of params holds dropdowns of many item types (countries, staff), so items are `any` here: typed columns and callbacks fit. */
77
+ export type DropdownParams = InputParamsOf<"dropdown", DropdownProps<any, OptionValue>>;
78
+ export type DateParams = InputParamsOf<"date", DatePickerProps>;
79
+ export type DateRangeParams = InputParamsOf<"date-range", DateRangePickerProps>;
80
+ export type TimeParams = InputParamsOf<"time", TimePickerProps>;
81
+ export type DateTimeParams = InputParamsOf<"date-time", DateTimePickerProps>;
82
+ export type SliderParams = InputParamsOf<"slider", SliderProps>;
83
+ export type RangeSliderParams = InputParamsOf<"range-slider", RangeSliderProps>;
84
+ export type MarkdownParams = InputParamsOf<"markdown", MarkdownEditorProps>;
85
+ /** `RichTextEditor`: the value is sanitized HTML. */
86
+ export type RichTextParams = InputParamsOf<"rich-text", RichTextEditorProps>;
87
+ export type TreeParams = InputParamsOf<"tree", TreeViewProps<any>>;
88
+ /** `TabularForm`: rows of inputs in a table. The value is an array of row objects. */
89
+ export type TabularParams = InputParamsOf<"tabular", TabularFormProps>;
90
+ /** `GroupForm`: the same rows, each as a section of inputs. */
91
+ export type GroupParams = InputParamsOf<"group", GroupFormProps>;
92
+ /** The params of any input: the root type every form takes as `inputs`. */
93
+ export type InputParams = TextInputParams | TextAreaParams | NumberInputParams | CheckBoxParams | SwitchParams | RadioParams | CheckBoxGroupParams | RadioGroupParams | DropdownParams | DateParams | DateRangeParams | TimeParams | DateTimeParams | SliderParams | RangeSliderParams | MarkdownParams | RichTextParams | TreeParams | TabularParams | GroupParams;
94
+ export type InputType = InputParams["type"];
95
+ /** Settings a check needs to write its message the way the field shows values: the user's date and time settings. */
96
+ export interface InputValidationContext {
97
+ /** Default: English (AD) dates as YYYY-MM-DD and 12-hour times. Components pass the user's own (`useDatePreferences`). */
98
+ preferences?: DatePreferences;
99
+ }
100
+ /** One row of a tabular or group form: the values by input name, plus any other fields the row came with, such as its id. */
101
+ export type RowValue = Record<string, unknown>;
102
+ /** Props shared by `TabularForm` and `GroupForm`. The value is an array of rows; each row holds one value per input. */
103
+ export interface RowsInputProps<TRow extends RowValue = RowValue> {
104
+ /** The inputs of one row, as params. Keep the array stable (a constant or `useMemo`): a new one checks every row again. */
105
+ inputs: readonly InputParams[];
106
+ label?: ReactNode;
107
+ /** Help text under the rows. An error takes its place. */
108
+ hint?: ReactNode;
109
+ /** An error from outside, such as a server message. Shown under the rows. */
110
+ error?: string | null;
111
+ /** What one row is, e.g. "Address": the Add button says "Add address", sections are "Address 1", and messages name it. Default "Row" (tabular) or "Item" (group). */
112
+ itemLabel?: string;
113
+ /** The plural of `itemLabel`, for messages such as "Add at least 2 addresses". Default: `itemLabel` with an English plural ending. */
114
+ itemLabelPlural?: string;
115
+ /** Text of the Add button. Default "Add " and the item label. */
116
+ addLabel?: string;
117
+ /** Shown while there are no rows. Default "No <items> yet." */
118
+ emptyMessage?: ReactNode;
119
+ /** Form field name. The form's data gets the rows as JSON under it: `JSON.parse(formData.get(name))`. */
120
+ name?: string;
121
+ /** Id of the form the rows belong to, when they sit outside it. */
122
+ form?: string;
123
+ /** The rows. With `value`, the input is controlled; pair it with `onValueChange`. Passing back the array it gave does nothing. */
124
+ value?: readonly TRow[];
125
+ defaultValue?: readonly TRow[];
126
+ /** Every row, after each change: a value typed or picked, a row added, removed, or moved. */
127
+ onValueChange?: (rows: TRow[]) => void;
128
+ /**
129
+ * After a value changes in a row, with the row as it is now and the input's name. Return values to set in the same
130
+ * row, e.g. `{ amount: row.quantity * row.rate }`, or nothing.
131
+ */
132
+ onRowChange?: (row: TRow, name: string, index: number) => Partial<TRow> | null | undefined | void;
133
+ /** Values of a new row, over each input's `defaultValue` (`defaultChecked` for checkboxes). A function gets the new row's index. */
134
+ newRow?: Partial<TRow> | ((index: number) => Partial<TRow>);
135
+ /**
136
+ * The field that holds a row's id, e.g. "id". Rows keep their ids through edits, moves, and saves; new rows have none,
137
+ * and a copied row drops it. Default: rows are told apart by position when they load.
138
+ */
139
+ rowKey?: string;
140
+ /** At least one row. */
141
+ required?: boolean;
142
+ /** Fewest rows. Not checked with no rows at all; use `required` for that. */
143
+ min?: number;
144
+ /** Most rows. The Add button stops at this count. */
145
+ max?: number;
146
+ /** Inputs whose values must differ between rows, such as an email or a phone number. Text compares without case and spaces around it. */
147
+ unique?: readonly string[];
148
+ /** Runs after the other rules pass, with every row, e.g. to check that debits equal credits. Runs after each change: keep it quick. */
149
+ validate?: (rows: TRow[]) => string | null | undefined;
150
+ /** Rows can be added. Default true. */
151
+ addable?: boolean;
152
+ /** Rows can be removed. Default true. */
153
+ removable?: boolean;
154
+ /** Rows can be moved up and down. Default false. */
155
+ sortable?: boolean;
156
+ /**
157
+ * Values a row's **position** decides rather than the user: a bitwise enum's value, a line number, a running total.
158
+ * It is asked after every change — a value typed, a row added, removed, duplicated or **moved** — with every row,
159
+ * and returns one patch per row (or nothing at all, or nothing for a row).
160
+ *
161
+ * The patches are written as if code had set them, so only the cells whose value really changed are drawn again:
162
+ * moving a row renumbers the column in front of the user and leaves focus where they put it. It runs after every
163
+ * change, so keep it quick, and pair it with `cellReadOnly` when the user must not type what it writes.
164
+ */
165
+ deriveRows?: (rows: TRow[]) => (Partial<TRow> | null | undefined)[] | null | undefined;
166
+ /**
167
+ * Which cells hold a **generated** value rather than a typed one: an enum's bitwise value, a line's total. It is
168
+ * asked for every cell as it renders, so a column can lock and unlock while the form around it changes — params are
169
+ * fixed once a form opens, and this is the one thing about a cell that is not.
170
+ *
171
+ * Return the reason to lock the cell and say why (the input wears its read-only lock and shows the note), `true` to
172
+ * lock it without a reason, or nothing to leave the cell as its params have it. Locking a cell never stops code from
173
+ * writing it: that is the point.
174
+ */
175
+ cellReadOnly?: (row: TRow, name: string, index: number) => string | boolean | null | undefined;
176
+ /**
177
+ * Rows the user did not write and may not change, such as the fields a class inherits from its parent: every cell of
178
+ * such a row is read-only with the reason returned, and in a tabular form its menu offers nothing and no row can be
179
+ * moved above it. Return the reason, `true` for no reason, or nothing. Keep such rows first: nothing reorders them.
180
+ */
181
+ rowReadOnly?: (row: TRow, index: number) => string | boolean | null | undefined;
182
+ /**
183
+ * Params of one cell that differ from its column's: a picker whose choices depend on the row, such as a type argument
184
+ * that takes a key type in one row and a model in the next. Asked as the row draws, which is when one of its values
185
+ * changes; return the keys to change (`{ options, selectedOptions }`), or nothing for the column's own params.
186
+ *
187
+ * Return the **same object** for the same answer (keep them in a map by what decides them): a new object draws the
188
+ * cell again, and a picker indexes its options once per array. Rules still come from the column's params — a row's
189
+ * value is checked the same way in every row — so change what is offered here, not what is required.
190
+ */
191
+ cellParams?: (row: TRow, name: string, index: number) => Partial<InputParams> | null | undefined;
192
+ /** Every input is read-only, and rows cannot be added, removed, or moved. */
193
+ readOnly?: boolean;
194
+ /** What the rows say when someone tries to change them. Default "Read-only: these rows cannot be changed." */
195
+ readOnlyMessage?: string;
196
+ disabled?: boolean;
197
+ /** Size of every input. Default `md`. */
198
+ size?: Size;
199
+ /** Name used in messages. Default: the label, when it is text. */
200
+ fieldName?: string;
201
+ id?: string;
202
+ className?: string;
203
+ style?: CSSProperties;
204
+ /** Name of the rows for screen readers, when there is no `label`. */
205
+ "aria-label"?: string;
206
+ ref?: Ref<RowsInputHandle<TRow>>;
207
+ }
208
+ /** What `ref` gives on a tabular or group form. */
209
+ export interface RowsInputHandle<TRow extends RowValue = RowValue> {
210
+ /** Every row as it is now. */
211
+ getValue: () => TRow[];
212
+ /** Replaces every row, e.g. with fresh data from a server. The rows given become the ones a form reset returns to. */
213
+ setValue: (rows: readonly TRow[]) => void;
214
+ /** Adds a row with these values (over `newRow`), at `index` or at the end, and focuses its first input. */
215
+ add: (values?: Partial<TRow>, index?: number) => void;
216
+ /** Removes the row at `index`. */
217
+ remove: (index: number) => void;
218
+ /** Checks every row, shows every message, and focuses the first problem. Returns whether all is valid. */
219
+ validate: () => boolean;
220
+ /** Brings the row at `index` into view and focuses its input named `name`, or its first input. */
221
+ focusRow: (index: number, name?: string) => void;
222
+ /** Focuses the first input of the first row, or the Add button. */
223
+ focus: () => void;
224
+ }
225
+ /** `TabularForm`: rows of inputs in a table, one column per input. */
226
+ export interface TabularFormProps<TRow extends RowValue = RowValue> extends RowsInputProps<TRow> {
227
+ /** The tallest the table grows before it scrolls, with the header row kept in view: pixels or a CSS length. Default 440. */
228
+ maxHeight?: number | string;
229
+ /** The row number column. Default true; it is also the button of each row's menu. */
230
+ numbered?: boolean;
231
+ }
232
+ /** `GroupForm`: each row as a section of inputs, laid out on a 12-column grid by each input's `span`. */
233
+ export interface GroupFormProps<TRow extends RowValue = RowValue> extends RowsInputProps<TRow> {
234
+ /** Label design of every input that does not set its own. Default `standard`. */
235
+ design?: InputDesign;
236
+ /** Sections can collapse to one line with a summary. Default true. */
237
+ collapsible?: boolean;
238
+ /** Sections start collapsed. New sections always start open. */
239
+ defaultCollapsed?: boolean;
240
+ /** Title of a section. Default: the item label and number, "Address 1". */
241
+ sectionTitle?: (row: TRow, index: number) => ReactNode;
242
+ /**
243
+ * What a collapsed section shows after its title: the inputs whose values to list (`["city", "country"]`), or a
244
+ * function. Default: the first three inputs with a value.
245
+ */
246
+ summary?: readonly string[] | ((row: TRow, index: number) => ReactNode);
247
+ }
248
+ /** A form's values: one per input name, plus any other fields the record came with, such as its id. */
249
+ export type FormValues = Record<string, unknown>;
250
+ /** Messages by input name. An empty value clears a message. */
251
+ export type FormErrors = Record<string, string | null | undefined>;
252
+ /**
253
+ * What a form's own rule returns after checking the values together (a password and its confirmation, a start before an
254
+ * end): nothing when all is well, messages by input name, or a message about the whole form.
255
+ */
256
+ export type FormRuleResult = FormErrors | string | null | undefined | void;
257
+ /** Props of `Form`, and of `SubmitForm` and `ApiForm`, which build on it. */
258
+ export interface FormProps<TValues extends FormValues = FormValues> {
259
+ /** The inputs, in their order on screen. Keep the array stable (a constant or `useMemo`): a new one checks every value again. */
260
+ inputs: readonly InputParams[];
261
+ /**
262
+ * The store behind the form, from `useForm()`, so the page can read and watch values and call the form from outside.
263
+ * Default: the form's own. A store outlives the form, so values typed in a form that unmounts (a closed tab) stay.
264
+ */
265
+ form?: FormStore<TValues>;
266
+ /** The values the form opens with, such as a record to edit. Read once, when the store is new; `form.load(values)` loads others. */
267
+ defaultValue?: Partial<TValues>;
268
+ /** After every change: a value typed or picked, set from code, loaded, or reset. `name` is `null` for a load or a reset. */
269
+ onValueChange?: (values: TValues, name: string | null) => void;
270
+ /**
271
+ * After the user changes a value, with the values as they are now. Return values to set in the same form, e.g.
272
+ * `{ amount: values.quantity * values.rate }`, or nothing.
273
+ */
274
+ onFieldChange?: (name: string, value: unknown, values: TValues) => Partial<TValues> | null | undefined | void;
275
+ /**
276
+ * Checks the values together, after the inputs' own rules, e.g. that a confirmation matches a password. Return messages
277
+ * by input name, a message for the whole form, or nothing. It runs after every change, so keep it quick. A message on
278
+ * an input shows once that input was left, and every message shows on submit.
279
+ */
280
+ validate?: (values: TValues) => FormRuleResult;
281
+ /**
282
+ * Keeps unsaved changes on this device (IndexedDB) under this key, and brings them back when the form opens again: a
283
+ * reload, a crash, a closed tab. Make it unique per user, record, and form, e.g. `hotel-3:user-8:room:204`. Cleared after
284
+ * a save, a reset, or a cancel.
285
+ */
286
+ draftKey?: string;
287
+ /** Label design of every input that does not set its own. */
288
+ design?: InputDesign;
289
+ /** Size of every input that does not set its own. Default `md`. */
290
+ size?: Size;
291
+ /** Every input is read-only, and nothing is checked. */
292
+ readOnly?: boolean;
293
+ /** Every input is disabled, and nothing is checked. */
294
+ disabled?: boolean;
295
+ /** Shows placeholders in place of the inputs, e.g. while the values load. */
296
+ loading?: boolean;
297
+ id?: string;
298
+ className?: string;
299
+ style?: CSSProperties;
300
+ /** The store, as `form` gives it. */
301
+ ref?: Ref<FormStore<TValues>>;
302
+ }
303
+ /** What `onSubmit` gets besides the values. */
304
+ export interface FormSubmitContext<TValues extends FormValues = FormValues> {
305
+ /** Only the values that changed since the form opened or last saved, e.g. for a PATCH request. */
306
+ changes: Partial<TValues>;
307
+ /** The values the form opened with, or saved last. */
308
+ initial: TValues;
309
+ form: FormStore<TValues>;
310
+ /** Aborted when the form unmounts, so a request can stop. */
311
+ signal: AbortSignal;
312
+ }
313
+ /**
314
+ * What `onSubmit` returns. Nothing, `true`, or `{ ok: true }`: saved, and the values become the form's own (`values` from
315
+ * the server, such as a new id, go on top). `false`: not saved, and nothing to show. `{ ok: false }`: not saved, with
316
+ * messages by input name and a message for the form.
317
+ */
318
+ export type FormSubmitResult<TValues extends FormValues = FormValues> = void | undefined | boolean | {
319
+ ok: true;
320
+ values?: Partial<TValues>;
321
+ } | {
322
+ ok: false;
323
+ errors?: FormErrors;
324
+ message?: string | null;
325
+ };
326
+ /** Where `SubmitForm` puts its buttons: at the end with the status line before them, at the start, or nowhere (`FormButtons` elsewhere). */
327
+ export type FormButtonsPlacement = "end" | "start" | false;
328
+ /** Props of `SubmitForm`: a `Form` in a `<form>`, checked on submit, with Save, Cancel, and Reset. */
329
+ export interface SubmitFormProps<TValues extends FormValues = FormValues> extends FormProps<TValues> {
330
+ /**
331
+ * Runs when every value is valid. Return or resolve nothing to say the values were saved, `false` when they were not,
332
+ * or `{ ok: false, errors, message }` to show why. A thrown error shows its message. It runs once at a time: Save waits
333
+ * with a spinner, and another submit does nothing until it ends.
334
+ */
335
+ onSubmit: (values: TValues, context: FormSubmitContext<TValues>) => FormSubmitResult<TValues> | Promise<FormSubmitResult<TValues>>;
336
+ /** After a save, once the saved values are the form's own: close a popup, go to another page. */
337
+ onSaved?: (values: TValues, form: FormStore<TValues>) => void;
338
+ /** Shows a Cancel button. */
339
+ onCancel?: () => void;
340
+ /** Cancel asks before it drops changed values. Default true. */
341
+ confirmCancel?: boolean;
342
+ /** Default "Save". */
343
+ submitLabel?: ReactNode;
344
+ /** Default: a floppy disk. `null` shows none. */
345
+ submitIcon?: ReactNode | null;
346
+ /** Default "Cancel". */
347
+ cancelLabel?: ReactNode;
348
+ /** Shows a Reset button, which brings back the values the form opened with (or saved last). */
349
+ resettable?: boolean;
350
+ /** Default "Reset". */
351
+ resetLabel?: ReactNode;
352
+ /** After a save, the form goes back to the values it opened with, ready for the next entry. Default: the saved values stay. */
353
+ resetOnSuccess?: boolean;
354
+ /** Where the buttons go. Default `end`. With `false`, put a `FormButtons` with the same `form` elsewhere, such as a popup's footer. */
355
+ buttons?: FormButtonsPlacement;
356
+ /** Asks before the page closes or reloads with unsaved changes. Default: true without a `draftKey` (a draft keeps them). */
357
+ confirmLeave?: boolean;
358
+ /** Name for screen readers. */
359
+ "aria-label"?: string;
360
+ "aria-labelledby"?: string;
361
+ }
362
+ /** A request an API form sends to a URL outside the app's modules, through the app's `api`. A module's API is an endpoint. */
363
+ export interface ApiRequest {
364
+ url: string;
365
+ /** Default `POST`. */
366
+ method?: "POST" | "PUT" | "PATCH" | "DELETE";
367
+ headers?: Record<string, string>;
368
+ /** `json` (default) sends the values as JSON; `form-data` as fields, with lists and objects as JSON text. */
369
+ bodyType?: "json" | "form-data";
370
+ credentials?: RequestCredentials;
371
+ }
372
+ /** Sends a form's values with the app's own client. Return what it answers: a `Response`, a parsed body, or an `ApiResult`. */
373
+ export type ApiSend<TValues extends FormValues = FormValues> = (body: unknown, context: FormSubmitContext<TValues>) => Promise<unknown>;
374
+ /** Props of `ApiForm`: a `SubmitForm` that sends the values to an API and shows the server's messages on their inputs. */
375
+ export interface ApiFormProps<TValues extends FormValues = FormValues> extends Omit<SubmitFormProps<TValues>, "onSubmit" | "onSaved"> {
376
+ /**
377
+ * Where the values go: an endpoint (`ROOMS.update`, or `{ module, path, method }` in place; `{id}` in its path comes
378
+ * from the values), a request to a URL outside the app's modules (`{ url, method }`), or a function that sends them
379
+ * with a client of the app's own. Endpoints and requests go through `api`, with the app's headers and sign-in handling.
380
+ */
381
+ api: ApiRequest | ApiEndpoint | ApiSend<TValues>;
382
+ /** Shapes what is sent, e.g. `{ items: [values] }` for a batch endpoint. May be async. Default: the values. */
383
+ transform?: (values: TValues, context: FormSubmitContext<TValues>) => unknown;
384
+ /**
385
+ * Reads the server's answer. Default: the app's reader (`configureApi({ read })`), else `readApiResponse`: Nexus API
386
+ * responses (`{ isSuccess, message, inputName, result }`), ASP.NET Core problem details (`{ title, errors }`), and
387
+ * any JSON by its HTTP status.
388
+ */
389
+ readResponse?: (body: unknown, status: number | undefined) => ApiResult;
390
+ /** After a save, once the saved values are the form's own, with what the server sent back: close a popup, update a table row. */
391
+ onSuccess?: (result: unknown, values: TValues, form: FormStore<TValues>) => void;
392
+ /** After a failed save, with the server's answer. The form already shows its messages. */
393
+ onError?: (response: ApiResult, values: TValues) => void;
394
+ /** The toast after a save: text, or `false` for none. Default: the server's message, else the endpoint's ("Room saved."), else "Saved." */
395
+ successMessage?: ReactNode | false;
396
+ /**
397
+ * Loads the values to edit, e.g. a record by id. Placeholders show while it runs, and a failure offers Retry. It runs
398
+ * once; give the form a new `key` to load another record.
399
+ */
400
+ loadValue?: (signal: AbortSignal) => Promise<Partial<TValues> | null | undefined>;
401
+ }
402
+ export {};