nexus-shared 1.1.20 → 2.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 (332) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +903 -0
  3. package/dist/Client.Index.d.ts +44 -0
  4. package/dist/Client.Index.js +49 -0
  5. package/dist/Components/Documents/Button.d.ts +29 -0
  6. package/dist/Components/Documents/Button.js +11 -0
  7. package/dist/Components/Documents/Menu.d.ts +102 -0
  8. package/dist/Components/Documents/Menu.js +238 -0
  9. package/dist/Components/Documents/SplitButton.d.ts +64 -0
  10. package/dist/Components/Documents/SplitButton.js +127 -0
  11. package/dist/Components/Documents/TabButtons.d.ts +62 -0
  12. package/dist/Components/Documents/TabButtons.js +19 -0
  13. package/dist/Components/Forms/ApiForm.d.ts +21 -0
  14. package/dist/Components/Forms/ApiForm.js +99 -0
  15. package/dist/Components/Forms/Crud.d.ts +17 -0
  16. package/dist/Components/Forms/Crud.js +556 -0
  17. package/dist/Components/Forms/CrudParts.d.ts +15 -0
  18. package/dist/Components/Forms/CrudParts.js +36 -0
  19. package/dist/Components/Forms/Form.d.ts +52 -0
  20. package/dist/Components/Forms/Form.js +319 -0
  21. package/dist/Components/Forms/SubmitForm.d.ts +65 -0
  22. package/dist/Components/Forms/SubmitForm.js +198 -0
  23. package/dist/Components/Inputs/Calendar.d.ts +69 -0
  24. package/dist/Components/Inputs/Calendar.js +258 -0
  25. package/dist/Components/Inputs/CheckBox.d.ts +53 -0
  26. package/dist/Components/Inputs/CheckBox.js +87 -0
  27. package/dist/Components/Inputs/CheckBoxGroup.d.ts +20 -0
  28. package/dist/Components/Inputs/CheckBoxGroup.js +80 -0
  29. package/dist/Components/Inputs/ChoiceField.d.ts +122 -0
  30. package/dist/Components/Inputs/ChoiceField.js +169 -0
  31. package/dist/Components/Inputs/DatePicker.d.ts +54 -0
  32. package/dist/Components/Inputs/DatePicker.js +246 -0
  33. package/dist/Components/Inputs/DateRangePicker.d.ts +62 -0
  34. package/dist/Components/Inputs/DateRangePicker.js +283 -0
  35. package/dist/Components/Inputs/DateTimePicker.d.ts +75 -0
  36. package/dist/Components/Inputs/DateTimePicker.js +399 -0
  37. package/dist/Components/Inputs/Dropdown.d.ts +117 -0
  38. package/dist/Components/Inputs/Dropdown.js +839 -0
  39. package/dist/Components/Inputs/DropdownParts.d.ts +84 -0
  40. package/dist/Components/Inputs/DropdownParts.js +102 -0
  41. package/dist/Components/Inputs/EditorShell.d.ts +45 -0
  42. package/dist/Components/Inputs/EditorShell.js +214 -0
  43. package/dist/Components/Inputs/Field.d.ts +53 -0
  44. package/dist/Components/Inputs/Field.js +16 -0
  45. package/dist/Components/Inputs/GroupForm.d.ts +20 -0
  46. package/dist/Components/Inputs/GroupForm.js +170 -0
  47. package/dist/Components/Inputs/InputField.d.ts +59 -0
  48. package/dist/Components/Inputs/InputField.js +169 -0
  49. package/dist/Components/Inputs/InputRenderer.d.ts +35 -0
  50. package/dist/Components/Inputs/InputRenderer.js +99 -0
  51. package/dist/Components/Inputs/MarkdownEditor.d.ts +67 -0
  52. package/dist/Components/Inputs/MarkdownEditor.js +289 -0
  53. package/dist/Components/Inputs/NumberBox.d.ts +53 -0
  54. package/dist/Components/Inputs/NumberBox.js +228 -0
  55. package/dist/Components/Inputs/RadioGroup.d.ts +20 -0
  56. package/dist/Components/Inputs/RadioGroup.js +43 -0
  57. package/dist/Components/Inputs/ReadOnlyNotice.d.ts +36 -0
  58. package/dist/Components/Inputs/ReadOnlyNotice.js +116 -0
  59. package/dist/Components/Inputs/RichTextEditor.d.ts +103 -0
  60. package/dist/Components/Inputs/RichTextEditor.js +1170 -0
  61. package/dist/Components/Inputs/RichTextParts.d.ts +63 -0
  62. package/dist/Components/Inputs/RichTextParts.js +157 -0
  63. package/dist/Components/Inputs/RowsInput.d.ts +104 -0
  64. package/dist/Components/Inputs/RowsInput.js +259 -0
  65. package/dist/Components/Inputs/Slider.d.ts +87 -0
  66. package/dist/Components/Inputs/Slider.js +216 -0
  67. package/dist/Components/Inputs/TabularForm.d.ts +23 -0
  68. package/dist/Components/Inputs/TabularForm.js +283 -0
  69. package/dist/Components/Inputs/TextArea.d.ts +43 -0
  70. package/dist/Components/Inputs/TextArea.js +31 -0
  71. package/dist/Components/Inputs/TextBox.d.ts +52 -0
  72. package/dist/Components/Inputs/TextBox.js +58 -0
  73. package/dist/Components/Inputs/TextField.d.ts +31 -0
  74. package/dist/Components/Inputs/TextField.js +35 -0
  75. package/dist/Components/Inputs/TimePanel.d.ts +34 -0
  76. package/dist/Components/Inputs/TimePanel.js +288 -0
  77. package/dist/Components/Inputs/TimePicker.d.ts +54 -0
  78. package/dist/Components/Inputs/TimePicker.js +239 -0
  79. package/dist/Components/Inputs/TreeView.d.ts +160 -0
  80. package/dist/Components/Inputs/TreeView.js +947 -0
  81. package/dist/Components/Layouts/MessageBox.d.ts +71 -0
  82. package/dist/Components/Layouts/MessageBox.js +104 -0
  83. package/dist/Components/Layouts/Popup.d.ts +92 -0
  84. package/dist/Components/Layouts/Popup.js +376 -0
  85. package/dist/Components/Layouts/PopupContext.d.ts +2 -0
  86. package/dist/Components/Layouts/PopupContext.js +4 -0
  87. package/dist/Components/Layouts/PopupDock.d.ts +22 -0
  88. package/dist/Components/Layouts/PopupDock.js +121 -0
  89. package/dist/Components/Layouts/PopupHost.d.ts +56 -0
  90. package/dist/Components/Layouts/PopupHost.js +163 -0
  91. package/dist/Components/Layouts/PopupRules.d.ts +30 -0
  92. package/dist/Components/Layouts/PopupRules.js +63 -0
  93. package/dist/Components/Layouts/ThemePicker.d.ts +13 -0
  94. package/dist/Components/Layouts/ThemePicker.js +22 -0
  95. package/dist/Components/Layouts/ThemeScript.d.ts +14 -0
  96. package/dist/Components/Layouts/ThemeScript.js +13 -0
  97. package/dist/Components/Layouts/ThemeSwitcher.d.ts +13 -0
  98. package/dist/Components/Layouts/ThemeSwitcher.js +29 -0
  99. package/dist/Components/Layouts/Toaster.d.ts +76 -0
  100. package/dist/Components/Layouts/Toaster.js +172 -0
  101. package/dist/Components/Viewers/DataTable.d.ts +25 -0
  102. package/dist/Components/Viewers/DataTable.js +542 -0
  103. package/dist/Components/Viewers/DataTableParts.d.ts +134 -0
  104. package/dist/Components/Viewers/DataTableParts.js +145 -0
  105. package/dist/Components/Viewers/MarkdownView.d.ts +26 -0
  106. package/dist/Components/Viewers/MarkdownView.js +79 -0
  107. package/dist/Components/Viewers/RichTextView.d.ts +18 -0
  108. package/dist/Components/Viewers/RichTextView.js +17 -0
  109. package/dist/Helpers/AnimationHelpers.d.ts +6 -0
  110. package/dist/Helpers/AnimationHelpers.js +35 -0
  111. package/dist/Helpers/ApiClient.d.ts +74 -0
  112. package/dist/Helpers/ApiClient.js +197 -0
  113. package/dist/Helpers/ApiFormHelpers.d.ts +26 -0
  114. package/dist/Helpers/ApiFormHelpers.js +56 -0
  115. package/dist/Helpers/ApiModules.d.ts +135 -0
  116. package/dist/Helpers/ApiModules.js +194 -0
  117. package/dist/Helpers/ApiResponses.d.ts +41 -0
  118. package/dist/Helpers/ApiResponses.js +159 -0
  119. package/dist/Helpers/ApiRoutes.d.ts +150 -0
  120. package/dist/Helpers/ApiRoutes.js +191 -0
  121. package/dist/Helpers/ApiToasts.d.ts +21 -0
  122. package/dist/Helpers/ApiToasts.js +22 -0
  123. package/dist/Helpers/ClassHelpers.d.ts +3 -0
  124. package/dist/Helpers/ClassHelpers.js +4 -0
  125. package/dist/Helpers/CrudBackend.d.ts +56 -0
  126. package/dist/Helpers/CrudBackend.js +119 -0
  127. package/dist/Helpers/CrudHelpers.d.ts +76 -0
  128. package/dist/Helpers/CrudHelpers.js +202 -0
  129. package/dist/Helpers/DateHelpers.d.ts +88 -0
  130. package/dist/Helpers/DateHelpers.js +363 -0
  131. package/dist/Helpers/DatePreferences.d.ts +14 -0
  132. package/dist/Helpers/DatePreferences.js +94 -0
  133. package/dist/Helpers/DateTimeHelpers.d.ts +87 -0
  134. package/dist/Helpers/DateTimeHelpers.js +286 -0
  135. package/dist/Helpers/DragHelpers.d.ts +129 -0
  136. package/dist/Helpers/DragHelpers.js +281 -0
  137. package/dist/Helpers/DropdownHelpers.d.ts +56 -0
  138. package/dist/Helpers/DropdownHelpers.js +180 -0
  139. package/dist/Helpers/FormDrafts.d.ts +18 -0
  140. package/dist/Helpers/FormDrafts.js +76 -0
  141. package/dist/Helpers/FormStore.d.ts +231 -0
  142. package/dist/Helpers/FormStore.js +734 -0
  143. package/dist/Helpers/InputParamsHelpers.d.ts +79 -0
  144. package/dist/Helpers/InputParamsHelpers.js +388 -0
  145. package/dist/Helpers/MarkdownEditing.d.ts +27 -0
  146. package/dist/Helpers/MarkdownEditing.js +250 -0
  147. package/dist/Helpers/MarkdownHelpers.d.ts +82 -0
  148. package/dist/Helpers/MarkdownHelpers.js +775 -0
  149. package/dist/Helpers/MessageBuilder.d.ts +74 -0
  150. package/dist/Helpers/MessageBuilder.js +254 -0
  151. package/dist/Helpers/NepaliCalendar.d.ts +25 -0
  152. package/dist/Helpers/NepaliCalendar.js +107 -0
  153. package/dist/Helpers/NumberHelpers.d.ts +71 -0
  154. package/dist/Helpers/NumberHelpers.js +202 -0
  155. package/dist/Helpers/Permissions.d.ts +62 -0
  156. package/dist/Helpers/Permissions.js +133 -0
  157. package/dist/Helpers/PopoverHelpers.d.ts +43 -0
  158. package/dist/Helpers/PopoverHelpers.js +91 -0
  159. package/dist/Helpers/RichTextHelpers.d.ts +77 -0
  160. package/dist/Helpers/RichTextHelpers.js +1072 -0
  161. package/dist/Helpers/RowsStore.d.ts +160 -0
  162. package/dist/Helpers/RowsStore.js +584 -0
  163. package/dist/Helpers/TableColumns.d.ts +40 -0
  164. package/dist/Helpers/TableColumns.js +254 -0
  165. package/dist/Helpers/TableExport.d.ts +30 -0
  166. package/dist/Helpers/TableExport.js +97 -0
  167. package/dist/Helpers/TableHelpers.d.ts +102 -0
  168. package/dist/Helpers/TableHelpers.js +281 -0
  169. package/dist/Helpers/TableStore.d.ts +142 -0
  170. package/dist/Helpers/TableStore.js +530 -0
  171. package/dist/Helpers/ThemeHelpers.d.ts +15 -0
  172. package/dist/Helpers/ThemeHelpers.js +16 -0
  173. package/dist/Helpers/TimeHelpers.d.ts +73 -0
  174. package/dist/Helpers/TimeHelpers.js +253 -0
  175. package/dist/Helpers/TreeStore.d.ts +188 -0
  176. package/dist/Helpers/TreeStore.js +577 -0
  177. package/dist/Helpers/ValidationHelpers.d.ts +124 -0
  178. package/dist/Helpers/ValidationHelpers.js +301 -0
  179. package/dist/Interfaces/ApiInterfaces.d.ts +149 -0
  180. package/dist/Interfaces/ApiInterfaces.js +24 -0
  181. package/dist/Interfaces/CrudInterfaces.d.ts +171 -0
  182. package/{src/sso-client.tsx → dist/Interfaces/CrudInterfaces.js} +1 -1
  183. package/dist/Interfaces/DateInterfaces.d.ts +154 -0
  184. package/dist/Interfaces/DateInterfaces.js +29 -0
  185. package/dist/Interfaces/FormInterfaces.d.ts +352 -0
  186. package/dist/Interfaces/FormInterfaces.js +1 -0
  187. package/dist/Interfaces/InputInterfaces.d.ts +141 -0
  188. package/dist/Interfaces/InputInterfaces.js +1 -0
  189. package/dist/Interfaces/MessageInterfaces.d.ts +111 -0
  190. package/dist/Interfaces/MessageInterfaces.js +5 -0
  191. package/dist/Interfaces/TableInterfaces.d.ts +291 -0
  192. package/dist/Interfaces/TableInterfaces.js +1 -0
  193. package/dist/Interfaces/ThemeInterfaces.d.ts +17 -0
  194. package/dist/Interfaces/ThemeInterfaces.js +17 -0
  195. package/dist/Interfaces/TypeInterfaces.d.ts +4 -0
  196. package/dist/Interfaces/TypeInterfaces.js +1 -0
  197. package/dist/Server.Index.d.ts +2 -0
  198. package/dist/Server.Index.js +5 -0
  199. package/dist/Services/ApiProxy.d.ts +32 -0
  200. package/dist/Services/ApiProxy.js +111 -0
  201. package/dist/Services/BrowserApi.d.ts +78 -0
  202. package/dist/Services/BrowserApi.js +111 -0
  203. package/dist/Services/ServerApi.d.ts +49 -0
  204. package/dist/Services/ServerApi.js +75 -0
  205. package/dist/Services/ThemeService.d.ts +17 -0
  206. package/dist/Services/ThemeService.js +83 -0
  207. package/dist/Shared.Index.d.ts +43 -0
  208. package/dist/Shared.Index.js +47 -0
  209. package/package.json +82 -33
  210. package/src/Styles/Nexus.Base.css +70 -0
  211. package/src/Styles/Nexus.Button.css +151 -0
  212. package/src/Styles/Nexus.Calendar.css +275 -0
  213. package/src/Styles/Nexus.Choice.css +345 -0
  214. package/src/Styles/Nexus.Crud.css +84 -0
  215. package/src/Styles/Nexus.DateTime.css +81 -0
  216. package/src/Styles/Nexus.Dropdown.css +774 -0
  217. package/src/Styles/Nexus.Editor.css +297 -0
  218. package/src/Styles/Nexus.Form.css +298 -0
  219. package/src/Styles/Nexus.Index.css +34 -0
  220. package/src/Styles/Nexus.Input.css +637 -0
  221. package/src/Styles/Nexus.Markdown.css +265 -0
  222. package/src/Styles/Nexus.Menu.css +249 -0
  223. package/src/Styles/Nexus.Popup.css +731 -0
  224. package/src/Styles/Nexus.RichText.css +463 -0
  225. package/src/Styles/Nexus.Rows.css +566 -0
  226. package/src/Styles/Nexus.Slider.css +278 -0
  227. package/src/Styles/Nexus.Tab.Buttons.css +364 -0
  228. package/src/Styles/Nexus.Table.css +1014 -0
  229. package/src/Styles/Nexus.Theme.Picker.css +159 -0
  230. package/src/Styles/Nexus.Themes.css +194 -0
  231. package/src/Styles/Nexus.Time.css +147 -0
  232. package/src/Styles/Nexus.Toast.css +265 -0
  233. package/src/Styles/Nexus.Tokens.css +72 -0
  234. package/src/Styles/Nexus.Tree.css +435 -0
  235. package/src/api-services/authentication-service.tsx +0 -23
  236. package/src/api-services/preference-service.tsx +0 -5
  237. package/src/api-services/system-service.tsx +0 -34
  238. package/src/client.ts +0 -31
  239. package/src/components/documents/button.tsx +0 -142
  240. package/src/components/documents/icon-box.tsx +0 -93
  241. package/src/components/documents/page-title.tsx +0 -7
  242. package/src/components/documents/tab-button.tsx +0 -172
  243. package/src/components/documents/tag.tsx +0 -30
  244. package/src/components/index.js +0 -0
  245. package/src/components/inputs/checkbox-input.tsx +0 -66
  246. package/src/components/inputs/input-box.tsx +0 -48
  247. package/src/components/inputs/input-element.tsx +0 -65
  248. package/src/components/inputs/input-form.tsx +0 -164
  249. package/src/components/inputs/input.tsx +0 -181
  250. package/src/components/inputs/number-input.tsx +0 -108
  251. package/src/components/inputs/radiobox-input.tsx +0 -53
  252. package/src/components/inputs/textarea-input.tsx +0 -47
  253. package/src/components/inputs/textbox-input.tsx +0 -45
  254. package/src/components/layouts/global-dialogbox.tsx +0 -431
  255. package/src/components/layouts/global-layout.tsx +0 -59
  256. package/src/components/layouts/layout-helpers.tsx +0 -20
  257. package/src/components/layouts/panels/user-panel.tsx +0 -112
  258. package/src/components/layouts/utility-menu.tsx +0 -49
  259. package/src/components/panels/theme-panel.tsx +0 -46
  260. package/src/helpers/bitwise-helpers.tsx +0 -11
  261. package/src/helpers/browser-helpers.tsx +0 -156
  262. package/src/helpers/datasource-helpers.tsx +0 -99
  263. package/src/helpers/element-helpers.tsx +0 -57
  264. package/src/helpers/input-helpers.tsx +0 -74
  265. package/src/helpers/string-helpers.tsx +0 -28
  266. package/src/helpers/utility-helpers.tsx +0 -45
  267. package/src/helpers/validation-helpers.tsx +0 -302
  268. package/src/index.ts +0 -26
  269. package/src/interface.ts +0 -19
  270. package/src/interfaces/auth-token-interfaces.tsx +0 -6
  271. package/src/interfaces/browser-interfaces.tsx +0 -36
  272. package/src/interfaces/button-interfaces.tsx +0 -63
  273. package/src/interfaces/datasource-interfaces.tsx +0 -22
  274. package/src/interfaces/datatable-interfaces.tsx +0 -25
  275. package/src/interfaces/dialogbox-interfaces.tsx +0 -5
  276. package/src/interfaces/exception-interfaces.tsx +0 -99
  277. package/src/interfaces/http-interfaces.tsx +0 -129
  278. package/src/interfaces/icon-interfaces.tsx +0 -129
  279. package/src/interfaces/input-interfaces.tsx +0 -410
  280. package/src/interfaces/layout-interfaces.tsx +0 -191
  281. package/src/interfaces/menu-interfaces.tsx +0 -49
  282. package/src/interfaces/message-interfaces.tsx +0 -32
  283. package/src/interfaces/permission-interfaces.tsx +0 -9
  284. package/src/interfaces/storage-interfaces.tsx +0 -5
  285. package/src/interfaces/system-interfaces.tsx +0 -22
  286. package/src/interfaces/theme-interfaces.tsx +0 -123
  287. package/src/interfaces/type-interfaces.tsx +0 -28
  288. package/src/interfaces/user-interfaces.tsx +0 -47
  289. package/src/nexus-client.tsx +0 -21
  290. package/src/nexus.environments.tsx +0 -66
  291. package/src/proxy-api/proxy-backend.tsx +0 -60
  292. package/src/proxy-api/proxy-constants.tsx +0 -28
  293. package/src/proxy-api/proxy-helpers.tsx +0 -91
  294. package/src/proxy-api-client.tsx +0 -1
  295. package/src/proxy-api-server.tsx +0 -2
  296. package/src/services/http-client-services.tsx +0 -75
  297. package/src/services/http-services.tsx +0 -158
  298. package/src/services/loader-service.tsx +0 -185
  299. package/src/services/localstorage-service.tsx +0 -119
  300. package/src/services/message-services.tsx +0 -383
  301. package/src/services/theme-service.tsx +0 -161
  302. package/src/services/user-services.tsx +0 -10
  303. package/src/sso-config/auth-token-validation.ts +0 -16
  304. package/src/sso-config/callback-route.tsx +0 -35
  305. package/src/sso-config/cookie-encryption.ts +0 -51
  306. package/src/sso-config/cookie-helpers.tsx +0 -102
  307. package/src/sso-config/forgot-password-route.tsx +0 -36
  308. package/src/sso-config/oauth-callback-state.ts +0 -61
  309. package/src/sso-config/pkce-helpers.ts +0 -9
  310. package/src/sso-config/provider-complete-route.tsx +0 -18
  311. package/src/sso-config/redirect-context-actions.tsx +0 -45
  312. package/src/sso-config/redirect-context-helpers.tsx +0 -159
  313. package/src/sso-config/redirect-context-persist.tsx +0 -18
  314. package/src/sso-config/redirect-context-route.tsx +0 -45
  315. package/src/sso-config/refresh-route.tsx +0 -23
  316. package/src/sso-config/sign-in-route.tsx +0 -74
  317. package/src/sso-config/sign-out-route.tsx +0 -57
  318. package/src/sso-config/sign-up-route.tsx +0 -57
  319. package/src/sso-config/sso-backend-flow.ts +0 -38
  320. package/src/sso-config/sso-complete-route.tsx +0 -50
  321. package/src/sso-config/sso-config.ts +0 -59
  322. package/src/sso-config/sso-interfaces.tsx +0 -99
  323. package/src/sso-config/sso-response-helpers.tsx +0 -20
  324. package/src/sso-server.tsx +0 -21
  325. package/src/styles/nexus.animation.css +0 -269
  326. package/src/styles/nexus.core.css +0 -119
  327. package/src/styles/nexus.dialog.css +0 -144
  328. package/src/styles/nexus.icon.css +0 -51
  329. package/src/styles/nexus.input.css +0 -207
  330. package/src/styles/nexus.loader.css +0 -11
  331. package/src/styles/nexus.logic.css +0 -47
  332. package/src/styles/nexus.utility.css +0 -347
@@ -0,0 +1,171 @@
1
+ import type { CSSProperties, ReactNode, Ref } from "react";
2
+ import type { PopupSize } from "../Components/Layouts/Popup.tsx";
3
+ import type { TableStore } from "../Helpers/TableStore.ts";
4
+ import type { ApiEndpoint } from "./ApiInterfaces.ts";
5
+ import type { FormProps, FormValues, InputParams } from "./FormInterfaces.ts";
6
+ import type { InputDesign } from "./InputInterfaces.ts";
7
+ import type { DataTableProps, TableColumn, TableMassAction, TablePaging, TableRowAction } from "./TableInterfaces.ts";
8
+ /**
9
+ * The lists of a controller: every active record (`normal`), the flagged ones, the archive, the trash, and the deleted
10
+ * ones (which can go back to the trash). The records the user pinned are not a list of their own: they sit above the
11
+ * active list, and in it.
12
+ */
13
+ export type CrudMode = "normal" | "flag" | "archive" | "trash" | "deleted";
14
+ /** The built-in actions on one record. */
15
+ export type CrudRowActionName = "view" | "edit" | "flag" | "pin" | "archive" | "restore" | "trash" | "recover" | "delete" | "trashFromDelete";
16
+ /** The built-in actions on many records at once. */
17
+ export type CrudMassActionName = "flag" | "pin" | "archive" | "restore" | "trash" | "recover" | "delete" | "trashFromDelete" | "description";
18
+ /** Every built-in action: Add, the row actions, and a new description for many records. */
19
+ export type CrudActionName = "create" | CrudRowActionName | "description";
20
+ /**
21
+ * The endpoints a CRUD calls. `apiController` (and an app's `MODULES.controller`) builds all of them for a Nexus
22
+ * controller; another backend lists its own. Leave one out, and its action or list is not offered.
23
+ */
24
+ export interface CrudEndpoints {
25
+ /** Every record of a list, for tables that page in the browser: `Room/NormalListing`, `Room/TrashListing`, … */
26
+ lists?: Partial<Record<CrudMode, ApiEndpoint>>;
27
+ /** One page of a list, for tables that page on the server: `Room/NormalPagination`, … */
28
+ pages?: Partial<Record<CrudMode, ApiEndpoint>>;
29
+ /**
30
+ * The records the user pinned: `Room/PinListing`. They show in a section above the active list, which the user folds
31
+ * open, and in the list itself. Without it there is no pinned section, and nothing counts the pins against the limit.
32
+ */
33
+ pins?: ApiEndpoint;
34
+ /** One record by its key: `{id}` in the path. */
35
+ details?: ApiEndpoint;
36
+ create?: ApiEndpoint;
37
+ update?: ApiEndpoint;
38
+ flag?: ApiEndpoint;
39
+ /** Pins a record, or unpins it: `Room/Pin/{id}`. */
40
+ pin?: ApiEndpoint;
41
+ archive?: ApiEndpoint;
42
+ restore?: ApiEndpoint;
43
+ trash?: ApiEndpoint;
44
+ recover?: ApiEndpoint;
45
+ delete?: ApiEndpoint;
46
+ trashFromDelete?: ApiEndpoint;
47
+ /** Actions on many records, sent the selected keys. */
48
+ mass?: Partial<Record<CrudMassActionName, ApiEndpoint>>;
49
+ }
50
+ /** Inputs of the Add and Edit forms: one list for both, a list for each, or a function of the action and the row. */
51
+ export type CrudInputs<TRow extends FormValues = FormValues> = readonly InputParams[] | {
52
+ create?: readonly InputParams[];
53
+ edit?: readonly InputParams[];
54
+ } | ((action: "create" | "edit", row: TRow | null) => readonly InputParams[] | Promise<readonly InputParams[]>);
55
+ /** The Add and Edit popups and their forms. */
56
+ export interface CrudFormOptions<TRow extends FormValues = FormValues> {
57
+ /** Width of the popups. Default `md`, or `lg` for forms of more than 8 inputs. */
58
+ size?: PopupSize;
59
+ /** Values of a new record, over each input's default. */
60
+ newValues?: Partial<TRow> | (() => Partial<TRow>);
61
+ /**
62
+ * What Edit opens with: the row as the table has it (`row`, the default), the record from the `details` endpoint
63
+ * (`details`, for fields a list leaves out), or a function that loads it.
64
+ */
65
+ load?: "row" | "details" | ((row: TRow, signal: AbortSignal) => Promise<Partial<TRow> | null | undefined>);
66
+ /** Shapes what is sent, e.g. to add a parent's id. Default: the values, with the fields the record came with. */
67
+ transform?: (values: TRow, context: {
68
+ action: "create" | "edit";
69
+ row: TRow | null;
70
+ }) => unknown;
71
+ /** The form's own rule over its values. */
72
+ validate?: FormProps<TRow>["validate"];
73
+ /** Derived values: return values to set after a change. */
74
+ onFieldChange?: FormProps<TRow>["onFieldChange"];
75
+ /** Label design of every input that does not set its own. */
76
+ design?: InputDesign;
77
+ /**
78
+ * Keeps unsaved values on this device, per record, under keys that start with this: `hotel-3:user-8:guests`.
79
+ * Make it unique per user.
80
+ */
81
+ draftKey?: string;
82
+ }
83
+ /** The details popup that View opens. */
84
+ export interface CrudDetailsOptions<TRow extends FormValues = FormValues> {
85
+ /** The fields to show. Default: every column, hidden ones too. */
86
+ columns?: readonly TableColumn<TRow>[];
87
+ /** Draws the details instead. */
88
+ render?: (row: TRow) => ReactNode;
89
+ /** Default `md`. */
90
+ size?: PopupSize;
91
+ }
92
+ /** What changed, for `onChange`. */
93
+ export interface CrudChange<TRow extends FormValues = FormValues> {
94
+ action: CrudActionName;
95
+ /** The records as they are now; for actions that took them out of the list, as they were. */
96
+ rows: TRow[];
97
+ mode: CrudMode;
98
+ }
99
+ /** Table settings a CRUD passes on to its `DataTable`. */
100
+ export type CrudTableOptions<TRow extends FormValues = FormValues> = Pick<DataTableProps<TRow>, "pageSize" | "pageSizes" | "defaultSort" | "numbered" | "maxHeight" | "size" | "searchPlaceholder" | "maxSelection" | "emptyMessage" | "columnsMenu" | "stateKey" | "searchDelay" | "reorderable" | "resizable" | "pinnable" | "moreActions" | "exportable" | "printable" | "exportName" | "onImport">;
101
+ /** Props of `Crud`. */
102
+ export interface CrudProps<TRow extends FormValues = FormValues> {
103
+ /** The endpoints: `MODULES.controller(NexusModule.Reservation, "Guest", "guest")`, or an object of your own. */
104
+ api: CrudEndpoints;
105
+ /** The table's columns. */
106
+ columns: readonly TableColumn<TRow>[];
107
+ /** The inputs of the Add and Edit forms. */
108
+ inputs: CrudInputs<TRow>;
109
+ /** What one record is: "guest". Titles ("Add guest"), questions, and messages use it. Default: the endpoints' subject, else "record". */
110
+ subject?: string;
111
+ /** Its plural, when adding "s" is wrong: "people". */
112
+ subjectPlural?: string;
113
+ /** Tells popups and saved table settings apart. Default: the subject. */
114
+ name?: string;
115
+ /** The field that tells records apart. Default `id`. */
116
+ rowKey?: string;
117
+ /** Names a record in titles and questions: "Sita Sharma". Default: the first column's text. */
118
+ rowLabel?: (row: TRow) => string;
119
+ /** `client` (default): each list loads once, and the table searches, sorts, and pages it. `server`: every page is a request. */
120
+ paging?: TablePaging;
121
+ /** The lists to offer, in order. Default all five; each also needs its endpoint and the user's permission. */
122
+ modes?: readonly CrudMode[];
123
+ /** The list shown first. Default the first one offered. */
124
+ defaultMode?: CrudMode;
125
+ /** The built-in actions to offer. Default all; each also needs its endpoint and the user's permission. */
126
+ actions?: readonly CrudActionName[];
127
+ /** More actions on a row, after the built-in ones. */
128
+ rowActions?: (row: TRow, mode: CrudMode) => readonly TableRowAction<TRow>[];
129
+ /** More actions on selected rows, or `false` for no selection at all. */
130
+ massActions?: false | ((rows: TRow[], mode: CrudMode) => readonly TableMassAction<TRow>[]);
131
+ /** The Add and Edit forms. */
132
+ form?: CrudFormOptions<TRow>;
133
+ /** The details popup, or `false` for none. */
134
+ details?: false | CrudDetailsOptions<TRow>;
135
+ /**
136
+ * Keeps lists this long (milliseconds) while the page is open, so going back to a list shows it at once; changes update
137
+ * or drop what is kept. Default 5 minutes; `false` loads every time. Cleared when the page closes.
138
+ */
139
+ cache?: false | {
140
+ lifetime?: number;
141
+ };
142
+ /** Before the Add button: more buttons, such as Import. */
143
+ toolbar?: ReactNode;
144
+ /** Settings of the table. */
145
+ table?: CrudTableOptions<TRow>;
146
+ /** After every change the CRUD made: a record added, saved, archived, deleted. */
147
+ onChange?: (change: CrudChange<TRow>) => void;
148
+ /** The table's name for screen readers. Default: the plural of the subject ("Guests"). */
149
+ "aria-label"?: string;
150
+ "aria-labelledby"?: string;
151
+ id?: string;
152
+ className?: string;
153
+ style?: CSSProperties;
154
+ ref?: Ref<CrudHandle<TRow>>;
155
+ }
156
+ /** What `ref` gives on a CRUD. */
157
+ export interface CrudHandle<TRow extends FormValues = FormValues> {
158
+ /** The table's store: rows, selection, `reload`. */
159
+ table: TableStore<TRow>;
160
+ /** The list shown. */
161
+ mode: CrudMode;
162
+ setMode: (mode: CrudMode) => void;
163
+ /** Loads the list again, past the cache. */
164
+ reload: () => Promise<void>;
165
+ /** Opens the Add popup, with these values over the new record's. */
166
+ create: (values?: Partial<TRow>) => void;
167
+ /** Opens the Edit popup of a record. */
168
+ edit: (row: TRow) => void;
169
+ /** Opens the details popup of a record. */
170
+ view: (row: TRow) => void;
171
+ }
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Dates in Nexus apps are calendar dates: a day, with no time of day and no time zone. A value is always an ISO
3
+ * date string in the Gregorian calendar, `"2026-09-17"`, whatever calendar the user sees it in. That is what a form
4
+ * sends, what an API stores (`DateOnly` in .NET), and what never shifts by a day between time zones.
5
+ */
6
+ /** The calendar a date is shown and picked in: `ad` Gregorian (English), `bs` Bikram Sambat (Nepali). Values stay Gregorian. */
7
+ export type CalendarType = "ad" | "bs";
8
+ /** How a Nepali date is written: `latin` (2083, Ashwin, 1) or `devanagari` (२०८३, असोज, १). Gregorian dates are always Latin. */
9
+ export type DateScript = "latin" | "devanagari";
10
+ /** A date as its parts in one calendar. Month and day start at 1. */
11
+ export interface DateParts {
12
+ year: number;
13
+ month: number;
14
+ day: number;
15
+ }
16
+ /**
17
+ * A date the components accept: an ISO date `"2026-09-17"`, an ISO date-time (with a zone it is read in the browser's
18
+ * local time; without one its date part is taken), or a `Date` (read in local time, like `new Date()`).
19
+ */
20
+ export type DateInput = string | Date | null | undefined;
21
+ /**
22
+ * The user's date and time settings, saved in local storage and read by every date and time component.
23
+ * - `calendar`: which calendar the pickers show. Default `ad`.
24
+ * - `format`: how a date is written, with the tokens of `formatDate`: `YYYY-MM-DD`, `DD/MM/YYYY`, `MMM DD, YYYY`, ... Default `YYYY-MM-DD`.
25
+ * - `script`: digits and names of Nepali dates. Default `latin`.
26
+ * - `timeFormat`: how a time is written, with the tokens of `formatTime`: `hh:mm A` (12-hour) or `HH:mm` (24-hour), ...
27
+ * Default `hh:mm A`. Optional here, so date-only settings stay valid; `useDatePreferences` always fills it.
28
+ */
29
+ export interface DatePreferences {
30
+ calendar: CalendarType;
31
+ format: string;
32
+ script: DateScript;
33
+ timeFormat?: string;
34
+ }
35
+ export declare const DEFAULT_TIME_FORMAT = "hh:mm A";
36
+ export declare const DEFAULT_DATE_PREFERENCES: Required<DatePreferences>;
37
+ /** Local storage keys of the date and time settings. Other code (a settings page, a login bootstrap) may write them. */
38
+ export declare const DATE_STORAGE_KEYS: {
39
+ readonly calendar: "nx-date-calendar";
40
+ readonly format: "nx-date-format";
41
+ readonly script: "nx-date-script";
42
+ readonly timeFormat: "nx-time-format";
43
+ };
44
+ /** Formats offered in a settings page. Any string of tokens works; these are the common ones. */
45
+ export declare const DATE_FORMATS: readonly string[];
46
+ /** Time formats offered in a settings page: 12-hour with and without a leading zero, and 24-hour. Seconds are added when a field needs them. */
47
+ export declare const TIME_FORMATS: readonly string[];
48
+ /**
49
+ * A time of day the components accept: an ISO time `"14:30"` or `"14:30:15"`, an ISO date-time (with a zone, the
50
+ * browser's local time of that instant; without one, its time part), or a `Date` (its local time, like `new Date()`).
51
+ * Like a date, a time value has no zone: "14:30" is half past two wherever the form is opened (a .NET `TimeOnly`).
52
+ */
53
+ export type TimeInput = string | Date | null | undefined;
54
+ /** Custom check for a time. Receives the ISO time, or `null` when the field is empty; returns a message to fail. */
55
+ export type TimeValidator = (value: string | null) => string | null | undefined;
56
+ /** Validation rules for a time, named like the HTML attributes. Limits are inclusive. */
57
+ export interface TimeRules {
58
+ required?: boolean;
59
+ /** Earliest time allowed, e.g. "09:00". With `max` earlier than `min`, the allowed range runs past midnight: "22:00" to "06:00". */
60
+ min?: TimeInput;
61
+ /** Latest time allowed, e.g. "18:00". */
62
+ max?: TimeInput;
63
+ /** Seconds between allowed times, counted from midnight, as in HTML: 60 (default) for any minute, 900 for quarter hours, 1 for seconds. */
64
+ step?: number;
65
+ /** Runs after the built-in rules pass. */
66
+ validate?: TimeValidator;
67
+ }
68
+ /**
69
+ * A moment the date and time components accept. Unlike a date or a time of day, a date-time value is an instant: the
70
+ * same moment everywhere, held as a UTC ISO string, `"2026-09-17T08:45:00.000Z"`, and shown in the user's time zone.
71
+ * - an ISO date-time with a zone: `"2026-09-17T08:45:00Z"`, `"2026-09-17T14:30:00+05:45"`;
72
+ * - an ISO date-time without a zone, `"2026-09-17T08:45:00"`, is read as UTC: that is how a .NET `DateTime` saved as
73
+ * UTC often comes back from a database, with its "Z" lost, and reading it as local time would move it;
74
+ * - a date alone, `"2026-09-17"`, is the first moment of that day in the user's time zone;
75
+ * - a `Date`, or milliseconds since 1970 (`Date.now()`).
76
+ */
77
+ export type DateTimeInput = string | number | Date | null | undefined;
78
+ /** A moment as the user sees it in a time zone: an ISO date and an ISO time of day with seconds. */
79
+ export interface LocalDateTime {
80
+ /** "2026-09-17" */
81
+ date: string;
82
+ /** "14:30:00" */
83
+ time: string;
84
+ }
85
+ /** Custom check for a date-time. Receives the UTC ISO value, or `null` when the field is empty; returns a message to fail. */
86
+ export type DateTimeValidator = (value: string | null) => string | null | undefined;
87
+ /**
88
+ * Validation rules for a date-time, named like the HTML attributes. Limits are inclusive. `min` and `max` are moments;
89
+ * `minTime`, `maxTime`, and `step` apply to the time of day where the user is, on every day.
90
+ */
91
+ export interface DateTimeRules {
92
+ required?: boolean;
93
+ /** Earliest moment allowed, e.g. `new Date()` for "not in the past". */
94
+ min?: DateTimeInput;
95
+ /** Latest moment allowed. */
96
+ max?: DateTimeInput;
97
+ /** Earliest time of day allowed, e.g. "09:00" for opening hours. With `maxTime` earlier than `minTime`, the hours run past midnight. */
98
+ minTime?: TimeInput;
99
+ /** Latest time of day allowed, e.g. "18:00". */
100
+ maxTime?: TimeInput;
101
+ /** Seconds between allowed times, counted from each midnight: 60 (default) for any minute, 900 for quarter hours, 1 for seconds. */
102
+ step?: number;
103
+ /** Runs after the built-in rules pass. */
104
+ validate?: DateTimeValidator;
105
+ }
106
+ /** Custom check for a date. Receives the ISO date, or `null` when the field is empty; returns a message to fail. */
107
+ export type DateValidator = (value: string | null) => string | null | undefined;
108
+ /** Validation rules for a date, named like the HTML attributes. Limits are inclusive. */
109
+ export interface DateRules {
110
+ required?: boolean;
111
+ /** Earliest date allowed. */
112
+ min?: DateInput;
113
+ /** Latest date allowed. */
114
+ max?: DateInput;
115
+ /** Runs after the built-in rules pass. */
116
+ validate?: DateValidator;
117
+ }
118
+ /** A start and an end, as ISO dates. Either may still be `null`; both `null` is an empty range. */
119
+ export type DateRange = readonly [string | null, string | null];
120
+ /** A range the components accept: a start and an end, each a `DateInput`, or nothing. */
121
+ export type DateRangeInput = readonly [DateInput, DateInput] | null | undefined;
122
+ /** Custom check for a date range. Receives the range, with `null` ends when empty; returns a message to fail. */
123
+ export type DateRangeValidator = (range: DateRange) => string | null | undefined;
124
+ /** Validation rules for a date range. `min` and `max` bound both ends; a distance is the end minus the start, in days. */
125
+ export interface DateRangeRules {
126
+ /** A range with a start and no end (or the reverse) is never valid; `required` also refuses an empty one. */
127
+ required?: boolean;
128
+ /** Earliest day of the range. */
129
+ min?: DateInput;
130
+ /** Latest day of the range. */
131
+ max?: DateInput;
132
+ /** Fewest days from the start to the end: `1` puts the end after the start, as the nights of a stay. Default 0, so one day is a range. */
133
+ minDistance?: number;
134
+ /** Most days from the start to the end, e.g. 30 for a stay of up to 30 nights. */
135
+ maxDistance?: number;
136
+ /** Runs after the built-in rules pass. */
137
+ validate?: DateRangeValidator;
138
+ }
139
+ /** A day in a calendar grid, given to `renderDay` so an event calendar can draw markers inside the cell. */
140
+ export interface CalendarDay {
141
+ /** The ISO date, always Gregorian. */
142
+ iso: string;
143
+ /** The day in the calendar being shown (`ad` or `bs`). */
144
+ parts: DateParts;
145
+ /** 0 = Sunday. */
146
+ weekday: number;
147
+ /** Belongs to the month before or after the one shown. */
148
+ outside: boolean;
149
+ today: boolean;
150
+ selected: boolean;
151
+ /** Between the two ends of a range, or of the range being picked. */
152
+ inRange: boolean;
153
+ disabled: boolean;
154
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Dates in Nexus apps are calendar dates: a day, with no time of day and no time zone. A value is always an ISO
3
+ * date string in the Gregorian calendar, `"2026-09-17"`, whatever calendar the user sees it in. That is what a form
4
+ * sends, what an API stores (`DateOnly` in .NET), and what never shifts by a day between time zones.
5
+ */
6
+ export const DEFAULT_TIME_FORMAT = "hh:mm A";
7
+ export const DEFAULT_DATE_PREFERENCES = { calendar: "ad", format: "YYYY-MM-DD", script: "latin", timeFormat: DEFAULT_TIME_FORMAT };
8
+ /** Local storage keys of the date and time settings. Other code (a settings page, a login bootstrap) may write them. */
9
+ export const DATE_STORAGE_KEYS = {
10
+ calendar: "nx-date-calendar",
11
+ format: "nx-date-format",
12
+ script: "nx-date-script",
13
+ timeFormat: "nx-time-format",
14
+ };
15
+ /** Formats offered in a settings page. Any string of tokens works; these are the common ones. */
16
+ export const DATE_FORMATS = [
17
+ "YYYY-MM-DD",
18
+ "DD/MM/YYYY",
19
+ "MM/DD/YYYY",
20
+ "DD.MM.YYYY",
21
+ "D MMMM YYYY",
22
+ "DD MMM YYYY",
23
+ "MMM DD, YYYY",
24
+ "MMMM DD, YYYY",
25
+ "ddd, DD MMM YYYY",
26
+ "dddd, MMMM DD, YYYY",
27
+ ];
28
+ /** Time formats offered in a settings page: 12-hour with and without a leading zero, and 24-hour. Seconds are added when a field needs them. */
29
+ export const TIME_FORMATS = ["hh:mm A", "h:mm A", "hh:mm a", "HH:mm", "H:mm"];