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 @@
1
+ export {};
@@ -0,0 +1,141 @@
1
+ import type { ReactNode } from "react";
2
+ /**
3
+ * How a field shows its label:
4
+ * - `standard`: above the box. Easiest to scan, and the default.
5
+ * - `outlined`: inside the box like a placeholder, rising onto the top border on focus or once there is a value.
6
+ * - `inbox`: small, inside the top of a taller box.
7
+ */
8
+ export type InputDesign = "standard" | "outlined" | "inbox";
9
+ /** When a field shows its own validation message. Submitting the form always shows it. */
10
+ export type ValidateOn = "blur" | "change" | "submit";
11
+ /** A regular expression with the message shown when a value does not match. Plain strings, so params stay serializable. */
12
+ export interface TextPattern {
13
+ /** Regular expression source. It must match the whole value, as with the HTML `pattern` attribute. */
14
+ source: string;
15
+ /** Shown when the value does not match. */
16
+ message: string;
17
+ }
18
+ /** Custom check. Receives the trimmed value, also when it is empty; returns a message to fail. */
19
+ export type TextValidator = (value: string) => string | null | undefined;
20
+ /** Validation rules for text, named like the HTML attributes. */
21
+ export interface TextRules {
22
+ required?: boolean;
23
+ /** Fewest characters, counted like the HTML attribute. Not checked on an empty value; use `required` for that. */
24
+ minLength?: number;
25
+ /** Most characters. Inputs also stop typing at this length. */
26
+ maxLength?: number;
27
+ /** A `TEXT_PATTERNS` entry, a regular expression source, or a `RegExp`. Not checked on an empty value. */
28
+ pattern?: TextPattern | string | RegExp;
29
+ /** Message for a `pattern` given as a string or `RegExp`. Default: "<field> is not valid." */
30
+ patternMessage?: string;
31
+ /** Runs after the built-in rules pass. */
32
+ validate?: TextValidator;
33
+ }
34
+ /** Custom check for a number. Receives the value, or `null` when the field is empty; returns a message to fail. */
35
+ export type NumberValidator = (value: number | null) => string | null | undefined;
36
+ /** Validation rules for a number, named like the HTML attributes. */
37
+ export interface NumberRules {
38
+ required?: boolean;
39
+ /** Smallest value allowed. Below 0 also allows typing a minus sign. */
40
+ min?: number;
41
+ /** Largest value allowed. */
42
+ max?: number;
43
+ /** Runs after the built-in rules pass. */
44
+ validate?: NumberValidator;
45
+ }
46
+ /** How a number is shown. Plain values, so they can come from params. */
47
+ export interface NumberFormatOptions {
48
+ /** Most digits after the decimal point. Typing stops there, and other values round to it. `0` allows whole numbers only. */
49
+ decimals?: number;
50
+ /** Always shows `decimals` digits, e.g. 1,250.00 for amounts. */
51
+ fixedDecimals?: boolean;
52
+ /** Group separators while the field is not being edited: 1,250,000. */
53
+ grouping?: boolean;
54
+ /** Locale of the separators, e.g. `en-IN` for 12,50,000 or `de-DE` for 1.250.000,5. Default `en-US`, so server and browser agree. */
55
+ locale?: string;
56
+ }
57
+ /** The value of a choice. Numbers are kept as numbers, so ids from an API come back with their type. */
58
+ export type OptionValue = string | number;
59
+ /** One option of a checkbox group, a radio group, and later a dropdown. */
60
+ export interface ChoiceOption<T extends OptionValue = string> {
61
+ value: T;
62
+ label: ReactNode;
63
+ /** A second line under the label. */
64
+ description?: ReactNode;
65
+ /** Shown before the label, e.g. `<Icon name="wifi" />`. */
66
+ icon?: ReactNode;
67
+ disabled?: boolean;
68
+ }
69
+ /** `default`: a box or circle beside each label. `cards`: each option is a card, for choices that need a description. */
70
+ export type ChoiceDesign = "default" | "cards";
71
+ /** Custom check for a single checkbox or switch; returns a message to fail. */
72
+ export type CheckValidator = (checked: boolean) => string | null | undefined;
73
+ /** Validation rules for a single checkbox or switch. */
74
+ export interface CheckRules {
75
+ /** Must be checked, e.g. "I accept the terms". */
76
+ required?: boolean;
77
+ validate?: CheckValidator;
78
+ }
79
+ /** Validation rules for a set of chosen values. */
80
+ export interface SelectionRules<T extends OptionValue = OptionValue> {
81
+ /** At least one choice. */
82
+ required?: boolean;
83
+ /** Fewest choices. Not checked when nothing is chosen; use `required` for that. */
84
+ min?: number;
85
+ /** Most choices. A checkbox group also stops further choices at this count. */
86
+ max?: number;
87
+ /** Runs after the built-in rules pass, with the chosen values. */
88
+ validate?: (values: T[]) => string | null | undefined;
89
+ }
90
+ /** A labelled point under a slider's track, e.g. `{ value: 50, label: "Mid-range" }`. Clicking it moves the nearest thumb there. */
91
+ export interface SliderMark {
92
+ value: number;
93
+ /** Default: the value, formatted like the slider's value. */
94
+ label?: ReactNode;
95
+ }
96
+ /** Any object can be a dropdown item: API rows as they come, or `ChoiceOption`s. Fields are read by key. */
97
+ export type DropdownItem = object;
98
+ /**
99
+ * How a dropdown column draws its field:
100
+ * - `text`: the value as text, cut with an ellipsis. The default.
101
+ * - `muted`: text in the muted color, for secondary details such as an email or a role.
102
+ * - `code`: short muted text with even digits, such as a country code or an employee number.
103
+ * - `avatar`: a round photo from a URL; the initials of the item's label when there is no URL or it fails to load.
104
+ * - `image`: a small picture from a URL, 4:3, such as a flag or a logo.
105
+ * - `icon`: a Tabler icon by name, such as `"wifi"`.
106
+ */
107
+ export type DropdownColumnType = "text" | "muted" | "code" | "avatar" | "image" | "icon";
108
+ /** One column of a dropdown's rows. Plain values, so a list of fields can describe it; `render` is the only function. */
109
+ export interface DropdownColumn<TItem extends DropdownItem = DropdownItem> {
110
+ /** The item's field, e.g. `"username"`. */
111
+ key: string;
112
+ /** Heading of the column. The list shows a header row when any column has one. */
113
+ header?: string;
114
+ /** Default `text`. */
115
+ type?: DropdownColumnType;
116
+ /** A CSS grid track: `"6rem"`, `"auto"`, `"1fr"`. Default: `auto` for avatar, image, icon, and code; `minmax(0, 1fr)` for text. */
117
+ width?: string;
118
+ /** Default `start`. */
119
+ align?: "start" | "center" | "end";
120
+ /** Draws the cell instead of `type`. */
121
+ render?: (item: TItem) => ReactNode;
122
+ }
123
+ /** What `loadOptions` receives: the search text and the page to load. `skip` suits APIs that take skip and take (max) counts. */
124
+ export interface DropdownPageRequest {
125
+ search: string;
126
+ /** From 1. */
127
+ page: number;
128
+ pageSize: number;
129
+ /** Items before this page: `(page - 1) * pageSize`. */
130
+ skip: number;
131
+ /** Aborted when a newer search replaces this request, or the dropdown unmounts. */
132
+ signal: AbortSignal;
133
+ }
134
+ /** What `loadOptions` returns for one page. */
135
+ export interface DropdownPage<TItem extends DropdownItem = DropdownItem> {
136
+ items: readonly TItem[];
137
+ /** Whether another page follows. Default: the page was full (`items.length === pageSize`). */
138
+ hasMore?: boolean;
139
+ /** All matches on the server, shown as "25 of 1,240" under the list. */
140
+ total?: number;
141
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,111 @@
1
+ /** The actions the builder knows by name (`MESSAGE_ACTION_NAMES`); `actionWords(name)` gives their words. */
2
+ export type MessageActionName = "load" | "save" | "create" | "update" | "delete" | "trash" | "restore" | "recover" | "flag" | "unflag" | "pin" | "unpin" | "send" | "submit" | "upload" | "download" | "import" | "export" | "copy" | "approve" | "reject" | "cancel";
3
+ /** The words of an action. */
4
+ export interface ActionWords {
5
+ /** "save", or with the object inside: "move {object} to the trash". */
6
+ verb: string;
7
+ /** "saved", "moved to the trash". */
8
+ done: string;
9
+ /** "Saving", "Moving {object} to the trash". */
10
+ doing: string;
11
+ /** What a message names when nothing else is named: "the changes", "the file". */
12
+ object: string;
13
+ /** Whether the action sends values the server checks, which words a refusal as "did not accept the values". */
14
+ sendsValues?: boolean;
15
+ }
16
+ /**
17
+ * What a call or a button does, for its messages: "Room 204 saved.", "Could not delete 3 rooms." A name from
18
+ * `MESSAGE_ACTION_NAMES`, or the words of an action of your own: `{ verb: "check in", done: "checked in", doing: "Checking in",
19
+ * object: "the guest" }`.
20
+ */
21
+ export type MessageAction = MessageActionName | ActionWords;
22
+ /**
23
+ * The kinds of message:
24
+ * - `success`: "Room 204 saved.", "3 rooms deleted.", "Saved."
25
+ * - `failure`: "Could not save Room 204."
26
+ * - `reason`: why it failed, by HTTP status: "You do not have permission to delete Room 204."
27
+ * - `loading`: "Saving Room 204…"
28
+ * - `confirm`: "Delete 3 rooms?"
29
+ * - `confirmDetail`: the line under a question, such as "This cannot be undone." (empty for most actions)
30
+ * - `label`: the action on a button: "Delete", "Move to the trash"
31
+ */
32
+ export type MessageKind = "success" | "failure" | "reason" | "loading" | "confirm" | "confirmDetail" | "label";
33
+ /** What a message is about. Every part is optional: a message without a subject names the action's object. */
34
+ export interface MessageContext {
35
+ /** Default `save`. */
36
+ action?: MessageAction;
37
+ /** "Room 204", or a noun with `count`: "room". */
38
+ subject?: string;
39
+ /** How many: 3 with subject "room" → "3 rooms". */
40
+ count?: number;
41
+ /** The plural of `subject` when adding "s" is wrong: "people". */
42
+ plural?: string;
43
+ /** The HTTP status of a failure, for `reason`. */
44
+ status?: number;
45
+ /** Nothing reached the server, for `reason`. */
46
+ network?: boolean;
47
+ /** The server did not answer in time, for `reason`. */
48
+ timeout?: boolean;
49
+ }
50
+ /** A message ready to show: a toast's tone, title, and line under it. */
51
+ export interface BuiltMessage {
52
+ tone: "success" | "danger";
53
+ title: string;
54
+ message?: string;
55
+ }
56
+ /**
57
+ * Every text the builder uses, in one table. Filled in: `{act}` (the verb with its object: "delete Room 204"), `{acting}`
58
+ * ("Deleting Room 204"), `{verb}`, `{done}`, `{doing}`, `{object}` (what is named, or the action's object),
59
+ * `{target}` (what is named, or "this record"), `{status}`, `{module}`, and `{env}`. A capital first letter
60
+ * (`{Object}`, `{Act}`) capitalizes the value. Change them all at once with `configureMessages`, to reword or translate.
61
+ */
62
+ export interface MessageTexts {
63
+ /** "{Object} {done}." → "Room 204 saved." */
64
+ success: string;
65
+ /** With nothing named: "{Done}." → "Saved." */
66
+ successPlain: string;
67
+ /** "Could not {act}." */
68
+ failure: string;
69
+ /** "{Acting}…" */
70
+ loading: string;
71
+ /** "{Act}?" */
72
+ confirm: string;
73
+ /** A button: "{Verb}". */
74
+ label: string;
75
+ /** The line under a question, by action. */
76
+ confirmDetails: Partial<Record<MessageActionName, string>>;
77
+ /** Why a call failed. */
78
+ reasons: MessageReasons;
79
+ }
80
+ export interface MessageReasons {
81
+ /** Nothing reached the server. */
82
+ network: string;
83
+ /** No answer in time, or 408. */
84
+ timeout: string;
85
+ /** 400 or 422 for an action that sends values. */
86
+ rejectedValues: string;
87
+ /** 400 or 422 for the rest. */
88
+ rejected: string;
89
+ /** 401. */
90
+ signedOut: string;
91
+ /** 403. */
92
+ forbidden: string;
93
+ /** 404 or 410. */
94
+ notFound: string;
95
+ /** 405. */
96
+ notAllowed: string;
97
+ /** 409. */
98
+ conflict: string;
99
+ /** 413. */
100
+ tooLarge: string;
101
+ /** 429. */
102
+ tooMany: string;
103
+ /** 502, 503, 504. */
104
+ unavailable: string;
105
+ /** Other 5xx. */
106
+ serverError: string;
107
+ /** Any other status: "{status}" is the number. */
108
+ other: string;
109
+ /** A module whose API root is not set: "{module}" and "{env}". */
110
+ notConfigured: string;
111
+ }
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Types of the message builder: what an action is called ("save", "saved", "Saving"), the kinds of message built from
3
+ * it, and the one table of texts every message comes from.
4
+ */
5
+ export {};
@@ -0,0 +1,351 @@
1
+ import type { CSSProperties, ReactNode, Ref } from "react";
2
+ import type { TableStore } from "../Helpers/TableStore.ts";
3
+ import type { ExcelEndpoints } from "./ExcelInterfaces.ts";
4
+ import type { Size, Tone } from "./TypeInterfaces.ts";
5
+ /** A row's id: its `rowKey` field, such as `id`. */
6
+ export type TableKey = string | number;
7
+ /** A row of a data table: any object. */
8
+ export type TableRow = object;
9
+ /** How a column shows its values. */
10
+ export type TableColumnFormat = "text" | "number" | "money" | "percent" | "date" | "time" | "date-time" | "boolean";
11
+ /** One of the values a column can hold, with its label: a status, a type. With a `tone`, the cell shows it as a tag. */
12
+ export interface TableColumnOption {
13
+ value: unknown;
14
+ label: string;
15
+ /** Draws the value as a tag with a dot of this color. */
16
+ tone?: Tone;
17
+ }
18
+ /** One column: which field it shows, how, and what the user can do with it. */
19
+ export interface TableColumn<TRow extends TableRow = TableRow> {
20
+ /** The field: `"name"`, or a path into the row, `"guest.name"`. It is also the column's id and its sort name. */
21
+ key: string;
22
+ /** The heading, and the column's name in the Columns menu and the details view. */
23
+ label: string;
24
+ /**
25
+ * The heading of the band above this column: "Amount details" over the quantity, the price, and the total. Columns
26
+ * next to each other that name the same group share one heading spanning them all, and the columns with no group keep
27
+ * one heading of their own, as tall as both rows. A table whose columns name no group has one header row, as before.
28
+ *
29
+ * The bands are read off the order on screen, so a column the user drags out of its run takes its group's heading
30
+ * with it and the run it left is drawn with the same heading twice.
31
+ */
32
+ group?: string;
33
+ /** Default `text`. Numbers, money, and percents line up at the end; dates and times follow the user's settings. */
34
+ format?: TableColumnFormat;
35
+ /** Digits after the decimal point of a number (money: 2). */
36
+ decimals?: number;
37
+ /** Text before a number, such as "Rs. ". */
38
+ prefix?: string;
39
+ /** Text after a number, such as " kg". */
40
+ suffix?: string;
41
+ /** Labels for the values the column holds, such as the names of an enum's numbers. */
42
+ options?: readonly TableColumnOption[];
43
+ /** The value when it is not one field: `row => row.first + " " + row.last`. Sorting and searching use it too. */
44
+ value?: (row: TRow) => unknown;
45
+ /** Draws the cell. Default: the value in the column's format. */
46
+ render?: (row: TRow, value: unknown) => ReactNode;
47
+ /** Text the search looks in. Default: the value as text (labels of `options`, ISO dates). */
48
+ text?: (row: TRow) => string;
49
+ /** Width: pixels or a CSS length ("12rem"). Default: by content. */
50
+ width?: number | string;
51
+ /** Narrowest the column gets. Default by format. */
52
+ minWidth?: number | string;
53
+ /** Default: `end` for numbers, money, and percents, `center` for booleans, else `start`. */
54
+ align?: "start" | "center" | "end";
55
+ /** Default true. */
56
+ sortable?: boolean;
57
+ /** Name the server sorts by, when it differs from `key`. */
58
+ sortKey?: string;
59
+ /** The table's search looks in this column. Default true. (A server searches as it likes.) */
60
+ searchable?: boolean;
61
+ /** Starts hidden; the Columns menu shows it. */
62
+ hidden?: boolean;
63
+ /** The Columns menu can hide it. Default true. */
64
+ hideable?: boolean;
65
+ /** Long text wraps onto more lines instead of ending in "…". */
66
+ wrap?: boolean;
67
+ /** The user can drag the heading to another place, or move it from its menu. Default true. */
68
+ movable?: boolean;
69
+ /** The user can drag the edge of the heading to change the width. Default true; `false` for a column that must keep its width. */
70
+ resizable?: boolean;
71
+ /** The user can keep the column on the left or the right while the others scroll. Default true. */
72
+ pinnable?: boolean;
73
+ /** Pinned before the user pins anything: `left` keeps it at the start, `right` at the end. */
74
+ pinned?: TablePinSide;
75
+ }
76
+ /** Which side a pinned column stays on while the others scroll. */
77
+ export type TablePinSide = "left" | "right";
78
+ export type TableSortDirection = "asc" | "desc";
79
+ export interface TableSort {
80
+ /** A column's `key` (its `sortKey` goes to a server). */
81
+ key: string;
82
+ direction: TableSortDirection;
83
+ }
84
+ /** What the table shows: the search, the sort, and the page. */
85
+ export interface TableQuery {
86
+ /** The search text, trimmed. */
87
+ search: string;
88
+ sort: TableSort | null;
89
+ /** The page, from 1. */
90
+ page: number;
91
+ pageSize: number;
92
+ }
93
+ /** One page of rows, as a server sends it. */
94
+ export interface TablePage<TRow extends TableRow = TableRow> {
95
+ rows: readonly TRow[];
96
+ /** Every row there is. Default: the rows given. */
97
+ total?: number;
98
+ /** The rows that match the search. Default: `total`. */
99
+ matches?: number;
100
+ }
101
+ /**
102
+ * Loads rows for a query: every row (a list the table searches, sorts, and pages itself) or one page (the server did it).
103
+ * It may answer at once, without a promise, such as from a cache.
104
+ */
105
+ export type TableLoader<TRow extends TableRow = TableRow> = (query: TableQuery, signal: AbortSignal) => TablePage<TRow> | readonly TRow[] | Promise<TablePage<TRow> | readonly TRow[]>;
106
+ /** `client`: the table has every row and pages them itself. `server`: each page comes from the loader. */
107
+ export type TablePaging = "client" | "server";
108
+ /** `loading`: the first rows are on their way. `ready`: rows (or none) are shown. `error`: the rows could not load. */
109
+ export type TableStatus = "loading" | "ready" | "error";
110
+ /** What the table shows now. A new object after every change. */
111
+ export interface TableState<TRow extends TableRow = TableRow> {
112
+ status: TableStatus;
113
+ /** A load runs while rows show: another page, a search, a sort, a reload. */
114
+ refreshing: boolean;
115
+ /** Why the rows could not load. */
116
+ error: string | null;
117
+ /** The rows on the page. */
118
+ rows: readonly TRow[];
119
+ /** How many rows come before the page: its first row is number `offset + 1`. */
120
+ offset: number;
121
+ /** Every row there is. */
122
+ total: number;
123
+ /** The rows that match the search. */
124
+ matches: number;
125
+ query: TableQuery;
126
+ /** The selected rows by key (keys as text), in the order they were picked. */
127
+ selected: ReadonlyMap<string, TRow>;
128
+ /** Rows with an action running. */
129
+ busy: ReadonlySet<string>;
130
+ /** Rows just added or changed, highlighted for a moment. */
131
+ flashed: ReadonlySet<string>;
132
+ /** Keys of the hidden columns. */
133
+ hidden: ReadonlySet<string>;
134
+ /** Column keys in the order the user put them. Empty: the order the columns were given in. */
135
+ order: readonly string[];
136
+ /** Widths the user set, in pixels, by column key (and by `#index`, `#actions` for the table's own columns). */
137
+ widths: Readonly<Record<string, number>>;
138
+ /** The side each pinned column stays on, by column key. */
139
+ pinned: Readonly<Record<string, TablePinSide>>;
140
+ }
141
+ /** A column as the table draws it: where it sits, whether it is pinned, and how far from that edge. */
142
+ export interface TableViewColumn<TRow extends TableRow = TableRow> {
143
+ column: TableColumn<TRow>;
144
+ /** The side it stays on, or null when it scrolls with the rest. */
145
+ pin: TablePinSide | null;
146
+ /** Pixels from that edge, once the table has measured the columns before it. */
147
+ offset: number;
148
+ /** The last pinned column of its side: the one that shows the shadow while columns scroll under it. */
149
+ edge: boolean;
150
+ /** The user can drag its edge to change the width. */
151
+ resizable: boolean;
152
+ /** The user can drag it to another place. */
153
+ movable: boolean;
154
+ /** Its width in pixels, once the user has set one. */
155
+ width?: number;
156
+ }
157
+ /**
158
+ * One cell of the band above the headings: a group's heading over the columns next to each other that name it, or a
159
+ * single column with no group, whose own heading stands in the band row and is as tall as both rows.
160
+ */
161
+ export interface TableHeadBand<TRow extends TableRow = TableRow> {
162
+ /** The heading above the columns, or `null` for a column with no group. */
163
+ group: string | null;
164
+ /** The columns under it, in the order they are drawn. One, for a column with no group. */
165
+ columns: TableViewColumn<TRow>[];
166
+ }
167
+ /**
168
+ * What a table needs to work a spreadsheet: the model's Excel endpoints, and what the page knows that the table does
169
+ * not. The search, the sort, and how many rows the search leaves are the table's own and are sent for it.
170
+ */
171
+ export interface TableExcel {
172
+ /** The model's endpoints, from `excelEndpoints(controller)`. */
173
+ endpoints: ExcelEndpoints;
174
+ /** What one row is, for the questions and the messages: "city". Default: what the backend's settings say. */
175
+ subject?: string;
176
+ /** Values the endpoints' own params need, such as a parent's id. */
177
+ params?: Record<string, string | number>;
178
+ /** The filters the page holds, beside the table's search and sort, read when an export is asked for. */
179
+ filters?: () => Record<string, unknown>;
180
+ /** After an import wrote something. The table reloads itself either way. */
181
+ onImported?: () => void;
182
+ }
183
+ /** An item of the table's options menu (⋮): Import, Print, a report of the page's own. */
184
+ export interface TableMenuAction {
185
+ /** Tells items apart; a test or a style can find it by `data-action`. */
186
+ id: string;
187
+ label: string;
188
+ icon?: ReactNode;
189
+ /** A second line in the menu. */
190
+ description?: string;
191
+ /** `danger` for items that lose something. */
192
+ tone?: "danger";
193
+ disabled?: boolean;
194
+ /** A line above the item, to start a group. */
195
+ separator?: boolean;
196
+ onSelect: () => void;
197
+ }
198
+ /** An action on one row, in its row: an icon button (`inline`) or an item of the row's menu. */
199
+ export interface TableRowAction<TRow extends TableRow = TableRow> {
200
+ /** Tells actions apart; a test or a style can find it by `data-action`. */
201
+ id: string;
202
+ label: string;
203
+ /** Needed for an `inline` action, which shows only its icon. */
204
+ icon?: ReactNode;
205
+ /** A second line in the menu. */
206
+ description?: string;
207
+ /** `danger` for actions that lose something. */
208
+ tone?: "danger";
209
+ /** Shown as an icon button on the row; the rest are in the row's menu. */
210
+ inline?: boolean;
211
+ disabled?: boolean;
212
+ /** Runs the action. While a promise it returns runs, the row is busy and its actions wait. */
213
+ onSelect: (row: TRow) => unknown;
214
+ }
215
+ /** An action on the selected rows, on the bar that shows while rows are selected. */
216
+ export interface TableMassAction<TRow extends TableRow = TableRow> {
217
+ id: string;
218
+ label: string;
219
+ icon?: ReactNode;
220
+ tone?: "danger";
221
+ disabled?: boolean;
222
+ /** Runs the action. While a promise it returns runs, the bar waits. */
223
+ onSelect: (rows: TRow[]) => unknown;
224
+ }
225
+ /** Props of `DataTable`. */
226
+ export interface DataTableProps<TRow extends TableRow = TableRow> {
227
+ /** The columns, in their order on screen. Keep the array stable (a constant or `useMemo`). */
228
+ columns: readonly TableColumn<TRow>[];
229
+ /** Every row, given by the page. The table searches, sorts, and pages them. */
230
+ rows?: readonly TRow[];
231
+ /** Loads the rows: every row once (`paging="client"`), or one page per query (`paging="server"`). */
232
+ load?: TableLoader<TRow>;
233
+ /** Default `client`. */
234
+ paging?: TablePaging;
235
+ /** Loads again, from the first page, when it changes: another list behind the same table, such as a CRUD's trash. */
236
+ loadKey?: string | number;
237
+ /** The field that tells rows apart. Default `id`. */
238
+ rowKey?: string | ((row: TRow) => TableKey);
239
+ /** Names a row for screen readers and messages ("Select Sita Sharma"). Default: the first column's text. */
240
+ rowLabel?: (row: TRow) => string;
241
+ /** The store behind the table, from `useTable()`, to reload, change rows, or read the selection from outside. */
242
+ table?: TableStore<TRow>;
243
+ /** The table's name for screen readers, such as "Guests". A visible heading can name it through `aria-labelledby`. */
244
+ "aria-label"?: string;
245
+ "aria-labelledby"?: string;
246
+ /** A search box. Default true. */
247
+ searchable?: boolean;
248
+ /** Default "Search…". */
249
+ searchPlaceholder?: string;
250
+ /** Before the search box, on the left of the bar: tabs, filters. */
251
+ toolbar?: ReactNode;
252
+ /** At the end of the bar: an Add button. */
253
+ actions?: ReactNode;
254
+ /** The Columns panel, where columns are shown, hidden, and dragged into another order. Default true. */
255
+ columnsMenu?: boolean;
256
+ /**
257
+ * The spreadsheet side of this table, against the backend's Excel controller. The options menu (⋮) then offers
258
+ * **Download template**, **Import from a spreadsheet** (the file is verified, the person goes over the rows, and the
259
+ * table reloads once they are written) and, where the endpoints have one, **Export to Excel** - which asks the
260
+ * server with the search and the sort on screen instead of writing a file of the rows this browser happens to hold.
261
+ *
262
+ * It replaces `onImport`, which is the hook for a page that imports its own way.
263
+ */
264
+ excel?: TableExcel;
265
+ /** A Reload button. Default true when rows are loaded. */
266
+ reloadable?: boolean;
267
+ /** When the user presses Reload, before the rows load again: drop a cache of your own. */
268
+ onReload?: () => void;
269
+ /** Columns can be dragged into another order (also from each heading's menu). Default true. */
270
+ reorderable?: boolean;
271
+ /** Columns can be resized by dragging the edge of a heading. Default true; a single column opts out with `resizable: false`. */
272
+ resizable?: boolean;
273
+ /** Columns can be pinned to the left or the right. Default true; a single column opts out with `pinnable: false`. */
274
+ pinnable?: boolean;
275
+ /** Items of the options menu (⋮), after Export and Print: Import, a report, anything of the page's own. */
276
+ moreActions?: readonly TableMenuAction[];
277
+ /** An Export item in the options menu, which writes the shown columns as a CSV file. Default true. */
278
+ exportable?: boolean;
279
+ /** A Print item in the options menu, which prints the shown columns. Default true. */
280
+ printable?: boolean;
281
+ /** Name of the file an export writes, and the heading a print shows. Default: the table's `aria-label`, else "Table". */
282
+ exportName?: string;
283
+ /** An Import item in the options menu, which calls this: the page asks for a file and loads it. */
284
+ onImport?: () => void;
285
+ /** A checkbox on each row, and a bar of `massActions` while rows are selected. */
286
+ selectable?: boolean;
287
+ /** Most rows that can be selected. Default 500. */
288
+ maxSelection?: number;
289
+ /** After the selection changes. */
290
+ onSelectionChange?: (rows: TRow[]) => void;
291
+ /** Actions on the selected rows. A function gets the selected rows. */
292
+ massActions?: readonly TableMassAction<TRow>[] | ((rows: TRow[]) => readonly TableMassAction<TRow>[]);
293
+ /** Actions of each row. */
294
+ rowActions?: (row: TRow) => readonly TableRowAction<TRow>[];
295
+ /** A double-click on a row, such as to open its details. */
296
+ onRowOpen?: (row: TRow) => void;
297
+ /**
298
+ * A single click opens a row, not only a double-click: for tables whose rows are opened to be read more than they
299
+ * are selected. A click on a control in the row (its menu, a link, a checkbox) still does only what that control
300
+ * does, and so does a click that ends a text selection, so a value can still be copied out of a cell.
301
+ */
302
+ openOnClick?: boolean;
303
+ /**
304
+ * Rows kept in a section above the page, which the user folds open: the records they pinned. They are the rows as
305
+ * they came from their own endpoint, and the same records also show in the list below. Leave it out for no section.
306
+ */
307
+ pinnedRows?: readonly TRow[];
308
+ /** The pinned rows are on their way: the section shows that it is loading. */
309
+ pinnedLoading?: boolean;
310
+ /** What the section is called. Default "Pinned". */
311
+ pinnedLabel?: string;
312
+ /** Most rows that can be pinned, shown beside the count so the user knows the limit. */
313
+ pinnedMax?: number;
314
+ /** Rows per page. Default 10, or the user's last choice with `stateKey`. */
315
+ pageSize?: number;
316
+ /** Choices of rows per page. Default 10, 25, 50, 100. */
317
+ pageSizes?: readonly number[];
318
+ /** The sort before the user picks one. Default none: the order the rows came in. */
319
+ defaultSort?: TableSort | null;
320
+ /**
321
+ * Row numbers in the first column. Default: on when `selectable`, where the number becomes the row's checkbox as soon
322
+ * as the pointer is over the row or anything is selected.
323
+ */
324
+ numbered?: boolean;
325
+ /** Remembers the page size, the sort, hidden columns, the order, widths, and pins of the columns, and whether the
326
+ * pinned section is open, on this device. */
327
+ stateKey?: string;
328
+ /** Milliseconds after the last key before a search goes to a server. Default 300; a table with every row searches at once. */
329
+ searchDelay?: number;
330
+ /** Shown when there are no rows at all. Default "No records yet." */
331
+ emptyMessage?: ReactNode;
332
+ /** Beside the empty message, such as an Add button. */
333
+ emptyAction?: ReactNode;
334
+ /** The tallest the table grows before its rows scroll under a header that stays: pixels or a CSS length. */
335
+ maxHeight?: number | string;
336
+ /**
337
+ * The table takes the whole height it is given instead of growing with its rows: the bar stays on top, the rows
338
+ * scroll inside the frame under a header that stays, and the footer sits at the bottom of the page. The page around
339
+ * it never scrolls, so the footer never moves and no scrollbar comes and goes as rows load.
340
+ *
341
+ * It needs a parent with a height. An `AdminPage` gives it one: the admin shell is exactly the window, and a page
342
+ * holding a filling table stretches it to the room under the heading. `maxHeight` is ignored while it is on.
343
+ */
344
+ fill?: boolean;
345
+ /** Row height and text size. Default `md`. */
346
+ size?: Extract<Size, "sm" | "md">;
347
+ id?: string;
348
+ className?: string;
349
+ style?: CSSProperties;
350
+ ref?: Ref<TableStore<TRow>>;
351
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ /** Light, dark, or whatever the operating system uses. */
2
+ export type ThemeMode = "light" | "dark" | "system";
3
+ export interface ThemeOption {
4
+ /** The `data-nx-theme` value: lowercase letters, digits, and dashes. */
5
+ id: string;
6
+ name: string;
7
+ description: string;
8
+ }
9
+ /** The themes in `nexus-shared/styles.css`. Each has a light and a dark palette. */
10
+ export declare const NEXUS_THEMES: readonly ThemeOption[];
11
+ export declare const DEFAULT_THEME = "nexus";
12
+ /** Browser storage keys for the saved choice. */
13
+ export declare const THEME_STORAGE_KEY = "nx-theme";
14
+ export declare const THEME_MODE_STORAGE_KEY = "nx-mode";
15
+ /** Attributes on `<html>` that select the theme and the mode. Without `data-nx-mode`, the system setting applies. */
16
+ export declare const THEME_ATTRIBUTE = "data-nx-theme";
17
+ export declare const THEME_MODE_ATTRIBUTE = "data-nx-mode";
@@ -0,0 +1,17 @@
1
+ /** The themes in `nexus-shared/styles.css`. Each has a light and a dark palette. */
2
+ export const NEXUS_THEMES = [
3
+ { id: "nexus", name: "Nexus", description: "Neutral grays with a confident blue" },
4
+ { id: "github", name: "GitHub", description: "Primer grays with GitHub green" },
5
+ { id: "nord", name: "Nord", description: "Arctic, north-bluish calm" },
6
+ { id: "dracula", name: "Dracula", description: "The dark purple classic, Alucard in light" },
7
+ { id: "solarized", name: "Solarized", description: "Warm cream or deep teal, precise accents" },
8
+ { id: "catppuccin", name: "Catppuccin", description: "Soothing pastels: Latte and Mocha" },
9
+ { id: "rose-pine", name: "Rosé Pine", description: "Muted pine, iris, and rose" },
10
+ ];
11
+ export const DEFAULT_THEME = "nexus";
12
+ /** Browser storage keys for the saved choice. */
13
+ export const THEME_STORAGE_KEY = "nx-theme";
14
+ export const THEME_MODE_STORAGE_KEY = "nx-mode";
15
+ /** Attributes on `<html>` that select the theme and the mode. Without `data-nx-mode`, the system setting applies. */
16
+ export const THEME_ATTRIBUTE = "data-nx-theme";
17
+ export const THEME_MODE_ATTRIBUTE = "data-nx-mode";
@@ -0,0 +1,4 @@
1
+ /** A value that may be missing: `string | UN`. */
2
+ export type UN = undefined | null;
3
+ export type Size = "sm" | "md" | "lg";
4
+ export type Tone = "neutral" | "primary" | "success" | "warning" | "danger" | "info";