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,243 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { iconArrowBackUp, iconColumns3, iconGripVertical, iconPin, InlineIcon } from "nexus-icons";
4
+ import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
5
+ import { cx } from "../../Helpers/ClassHelpers.js";
6
+ import { followAnchor, isPopoverOpen, placeUnderAnchor } from "../../Helpers/PopoverHelpers.js";
7
+ import { Button } from "../Documents/Button.js";
8
+ /** The rows of the panel: a band for every run of neighbours that name the same group, as the header draws them. */
9
+ function panelRows(columns, groups) {
10
+ const rows = [];
11
+ for (const column of columns) {
12
+ const group = groups.get(column.key);
13
+ const last = rows[rows.length - 1];
14
+ if (group && last && last.band === group)
15
+ last.columns.push(column);
16
+ else if (group)
17
+ rows.push({ band: group, columns: [column] });
18
+ else
19
+ rows.push({ band: null, column });
20
+ }
21
+ return rows;
22
+ }
23
+ /** The keys of a row, in order: one column, or every column of a band. */
24
+ function rowKeys(row) {
25
+ return row.band === null ? [row.column.key] : row.columns.map(column => column.key);
26
+ }
27
+ /** Moves `from` to `to` in a list. */
28
+ function moveItem(items, from, to) {
29
+ const next = [...items];
30
+ const [item] = next.splice(from, 1);
31
+ if (item === undefined)
32
+ return next;
33
+ next.splice(to, 0, item);
34
+ return next;
35
+ }
36
+ /** Which place the pointer is over, by the middle of each row: the index the row held would take. */
37
+ function dropIndex(boxes, y, from) {
38
+ for (let index = 0; index < boxes.length; index++) {
39
+ const box = boxes[index];
40
+ if (y < box.top + box.height / 2)
41
+ return index > from ? index - 1 : index;
42
+ }
43
+ return boxes.length - 1;
44
+ }
45
+ /** The room kept between the panel and the window's edge, and the least height it is ever given. */
46
+ const PANEL_MARGIN = 8;
47
+ const PANEL_MIN_HEIGHT = 160;
48
+ /** The text of a label that may be a node, for an accessible name. */
49
+ function textOf(label) {
50
+ return typeof label === "string" || typeof label === "number" ? String(label) : "the column";
51
+ }
52
+ /**
53
+ * The button that opens the Columns panel, and the panel itself: a checkbox per column, bands with their columns under
54
+ * them, and a handle to drag a row into another place. The panel is a popover under the button, so it closes on Esc,
55
+ * on a click outside, and on Tab.
56
+ *
57
+ * @example
58
+ * <TableColumnsPanel columns={columns} hidden={state.hidden} pinned={state.pinned}
59
+ * onToggle={(key, hide) => table.setHidden(key, hide)} onOrder={keys => table.setOrder(keys)} />
60
+ */
61
+ export function TableColumnsPanel({ columns, hidden, pinned, reorderable = true, size = "md", changed = false, onToggle, onOrder, onReset, "aria-label": ariaLabel = "Columns", }) {
62
+ const id = useId();
63
+ const panelId = `${id}-columns`;
64
+ const triggerId = `${id}-columns-trigger`;
65
+ const triggerRef = useRef(null);
66
+ const panelRef = useRef(null);
67
+ const [open, setOpen] = useState(false);
68
+ // Set on pointer down while the panel is open: that press closes it, and its click must not open it again.
69
+ const dismissing = useRef(false);
70
+ // While a row is held: its key, the list it may move in, and where it would land.
71
+ const [drag, setDrag] = useState(null);
72
+ const [said, setSaid] = useState("");
73
+ // The columns of a band that were already hidden when its checkbox was cleared: shown again, the band keeps them off.
74
+ const bandMemory = useRef(new Map());
75
+ const all = columns.map(column => ({
76
+ key: column.key,
77
+ label: column.label,
78
+ shown: !hidden.has(column.key),
79
+ pin: pinned[column.key] ?? column.pinned ?? null,
80
+ movable: reorderable && column.movable !== false,
81
+ hideable: column.hideable !== false,
82
+ }));
83
+ const groups = new Map(columns.map(column => [column.key, column.group]));
84
+ const rows = panelRows(all, groups);
85
+ const shownCount = all.filter(column => column.shown).length;
86
+ const bands = rows.some(row => row.band !== null);
87
+ function place() {
88
+ const panel = panelRef.current;
89
+ const trigger = triggerRef.current;
90
+ if (!panel || !trigger)
91
+ return;
92
+ // Measured at its own height, then capped to the room on the side it landed on: a table with many columns keeps
93
+ // its heading, its note and Reset in the window, and the list of columns scrolls instead.
94
+ panel.style.maxHeight = "";
95
+ placeUnderAnchor(panel, trigger.getBoundingClientRect(), { align: "end" });
96
+ const top = panel.getBoundingClientRect().top;
97
+ panel.style.maxHeight = `${Math.max(PANEL_MIN_HEIGHT, window.innerHeight - top - PANEL_MARGIN)}px`;
98
+ }
99
+ // The panel is fixed, so it follows the button while the page or a scroller moves.
100
+ useLayoutEffect(() => {
101
+ if (!open)
102
+ return;
103
+ return followAnchor(place);
104
+ // eslint-disable-next-line react-hooks/exhaustive-deps
105
+ }, [open]);
106
+ // A panel opened again starts without the last move's message, so a screen reader is not told about an old move.
107
+ useEffect(() => {
108
+ if (!open)
109
+ setSaid("");
110
+ }, [open]);
111
+ /** The whole order after moving a row of `list` ("" for the panel itself, a band's name for its own columns). */
112
+ function moved(list, from, to) {
113
+ if (list === "") {
114
+ const next = moveItem(rows, from, to);
115
+ return next.flatMap(rowKeys);
116
+ }
117
+ const band = rows.find(row => row.band === list);
118
+ if (!band || band.band === null)
119
+ return null;
120
+ const next = moveItem(band.columns, from, to);
121
+ return rows.flatMap(row => (row.band === list ? next.map(column => column.key) : rowKeys(row)));
122
+ }
123
+ function move(list, from, to, label) {
124
+ const length = list === "" ? rows.length : rows.find(row => row.band === list)?.columns.length;
125
+ if (!length)
126
+ return;
127
+ const target = Math.min(Math.max(to, 0), length - 1);
128
+ if (target === from)
129
+ return;
130
+ const order = moved(list, from, target);
131
+ if (!order)
132
+ return;
133
+ onOrder(order);
134
+ setSaid(list === "" ? `${label} is now ${target + 1} of ${length}.` : `${label} is now ${target + 1} of ${length} in ${list}.`);
135
+ }
136
+ function onHandleKeyDown(event, list, index, label) {
137
+ const length = list === "" ? rows.length : (rows.find(row => row.band === list)?.columns.length ?? 0);
138
+ const step = event.key === "ArrowUp" ? -1 : event.key === "ArrowDown" ? 1 : event.key === "Home" ? -index : event.key === "End" ? length - 1 - index : 0;
139
+ if (!step)
140
+ return;
141
+ event.preventDefault();
142
+ move(list, index, index + step, label);
143
+ }
144
+ function onHandlePointerDown(event, list, index, key, label) {
145
+ if (event.button !== 0)
146
+ return;
147
+ // A row moves inside its own list only: a band among the bands, a column of a band among its siblings.
148
+ const owner = event.currentTarget.closest("[data-list]");
149
+ if (!owner)
150
+ return;
151
+ const handle = event.currentTarget;
152
+ const boxes = [...owner.children].map(child => child.getBoundingClientRect());
153
+ handle.setPointerCapture(event.pointerId);
154
+ setDrag({ key, list, to: index });
155
+ const end = (done, y) => {
156
+ handle.removeEventListener("pointermove", onMove);
157
+ handle.removeEventListener("pointerup", up);
158
+ handle.removeEventListener("pointercancel", cancel);
159
+ handle.removeEventListener("keydown", escape);
160
+ setDrag(null);
161
+ if (done && y !== undefined)
162
+ move(list, index, dropIndex(boxes, y, index), label);
163
+ };
164
+ const onMove = (moved) => setDrag({ key, list, to: dropIndex(boxes, moved.clientY, index) });
165
+ const up = (moved) => {
166
+ if (handle.hasPointerCapture(moved.pointerId))
167
+ handle.releasePointerCapture(moved.pointerId);
168
+ end(true, moved.clientY);
169
+ };
170
+ const cancel = () => end(false);
171
+ // Esc puts the row back where it was.
172
+ const escape = (key) => {
173
+ if (key.key !== "Escape")
174
+ return;
175
+ key.preventDefault();
176
+ key.stopPropagation();
177
+ end(false);
178
+ };
179
+ handle.addEventListener("pointermove", onMove);
180
+ handle.addEventListener("pointerup", up);
181
+ handle.addEventListener("pointercancel", cancel);
182
+ handle.addEventListener("keydown", escape);
183
+ }
184
+ /** The band's checkbox: off hides every column under it, on brings back the ones it was not already hiding. */
185
+ function toggleBand(band, columnsOfBand, show) {
186
+ if (show) {
187
+ const kept = new Set(bandMemory.current.get(band) ?? []);
188
+ bandMemory.current.delete(band);
189
+ for (const column of columnsOfBand)
190
+ if (!column.shown && !kept.has(column.key))
191
+ onToggle(column.key, false);
192
+ return;
193
+ }
194
+ bandMemory.current.set(band, columnsOfBand.filter(column => !column.shown).map(column => column.key));
195
+ for (const column of columnsOfBand)
196
+ if (column.shown)
197
+ onToggle(column.key, true);
198
+ }
199
+ function hidePopover(panel) {
200
+ if (isPopoverOpen(panel))
201
+ panel.hidePopover();
202
+ }
203
+ /** One column's row: the handle, the checkbox, the label, and a mark when it is pinned. */
204
+ function columnRow(column, list, index, inBand, bandOff) {
205
+ const lastShown = column.shown && shownCount <= 1;
206
+ return (_jsxs("li", { className: cx("nx-columns__row", inBand && "nx-columns__row--child"), "data-held": drag?.key === column.key ? "" : undefined, "data-drop": drag && drag.list === list && drag.key !== column.key && drag.to === index ? "" : undefined, children: [column.movable && !bandOff ? (_jsx("button", { type: "button", className: "nx-columns__handle", "aria-label": `Move ${textOf(column.label)}`, title: inBand ? `Drag to move it inside ${list}, or use the arrow keys` : "Drag to move, or use the arrow keys", onPointerDown: event => onHandlePointerDown(event, list, index, column.key, textOf(column.label)), onKeyDown: event => onHandleKeyDown(event, list, index, textOf(column.label)), children: _jsx(InlineIcon, { icon: iconGripVertical }) })) : (_jsx("span", { className: "nx-columns__handle nx-columns__handle--fixed", "aria-hidden": "true" })), _jsxs("label", { className: "nx-choice nx-choice--sm nx-columns__choice", children: [_jsx("input", { type: "checkbox", className: "nx-choice__control nx-choice__control--checkbox", checked: column.shown && !bandOff, disabled: bandOff || !column.hideable || lastShown, title: bandOff ? `${list} is hidden` : column.hideable ? undefined : "Always shown", onChange: event => onToggle(column.key, !event.currentTarget.checked) }), _jsx("span", { className: "nx-choice__text", children: _jsx("span", { className: "nx-choice__label nx-columns__label", children: column.label }) })] }), column.pin && (_jsxs("span", { className: "nx-columns__pin", title: `Pinned to the ${column.pin === "left" ? "left" : "right"}`, children: [_jsx(InlineIcon, { icon: iconPin }), _jsx("span", { className: "nx-visually-hidden", children: `Pinned to the ${column.pin === "left" ? "left" : "right"}` })] }))] }, column.key));
207
+ }
208
+ return (_jsxs(_Fragment, { children: [_jsx(Button, { ref: triggerRef, id: triggerId, size: size === "sm" ? "sm" : "md", icon: _jsx(InlineIcon, { icon: iconColumns3 }), "aria-label": ariaLabel, "aria-haspopup": "dialog", "aria-expanded": open, "aria-controls": panelId, title: "Columns: show, hide, and arrange", onPointerDown: () => {
209
+ dismissing.current = isPopoverOpen(panelRef.current);
210
+ }, onClick: () => {
211
+ if (dismissing.current) {
212
+ dismissing.current = false;
213
+ return;
214
+ }
215
+ const panel = panelRef.current;
216
+ if (!panel)
217
+ return;
218
+ if (isPopoverOpen(panel))
219
+ hidePopover(panel);
220
+ else {
221
+ panel.showPopover();
222
+ place();
223
+ panel.focus();
224
+ }
225
+ } }), _jsxs("div", { ref: panelRef, id: panelId, popover: "auto", role: "dialog", tabIndex: -1, "aria-labelledby": `${panelId}-title`, className: cx("nx-popover", "nx-columns", size === "sm" && "nx-columns--sm"), "data-dragging": drag ? "" : undefined, onToggle: (event) => setOpen(event.newState === "open"), onKeyDown: event => {
226
+ if (event.key === "Tab")
227
+ hidePopover(event.currentTarget);
228
+ }, children: [_jsxs("div", { className: "nx-columns__head", children: [_jsx("span", { className: "nx-columns__title", id: `${panelId}-title`, children: "Columns" }), _jsxs("span", { className: "nx-columns__count", children: [shownCount, " of ", all.length, " shown"] })] }), _jsx("ul", { className: "nx-columns__list", "data-list": "", children: rows.map((row, index) => {
229
+ if (row.band === null)
230
+ return columnRow(row.column, "", index, false, false);
231
+ const band = row.band;
232
+ // A band whose columns were split into two runs is drawn twice, so a row is known by its first column, never
233
+ // by the band's name: two rows under one name would be one row to React.
234
+ const bandId = `band:${row.columns[0].key}`;
235
+ const shown = row.columns.filter(column => column.shown).length;
236
+ const movable = row.columns.every(column => column.movable);
237
+ const last = shown > 0 && shownCount - shown < 1;
238
+ return (_jsxs("li", { className: "nx-columns__row nx-columns__row--band", "data-held": drag?.key === bandId ? "" : undefined, "data-drop": drag && drag.list === "" && drag.key !== bandId && drag.to === index ? "" : undefined, children: [_jsxs("div", { className: "nx-columns__band", children: [movable ? (_jsx("button", { type: "button", className: "nx-columns__handle", "aria-label": `Move ${band}`, title: "Drag to move the whole band, or use the arrow keys", onPointerDown: event => onHandlePointerDown(event, "", index, bandId, band), onKeyDown: event => onHandleKeyDown(event, "", index, band), children: _jsx(InlineIcon, { icon: iconGripVertical }) })) : (_jsx("span", { className: "nx-columns__handle nx-columns__handle--fixed", "aria-hidden": "true" })), _jsxs("label", { className: "nx-choice nx-choice--sm nx-columns__choice", children: [_jsx("input", { type: "checkbox", className: "nx-choice__control nx-choice__control--checkbox", checked: shown > 0, disabled: last, ref: input => {
239
+ if (input)
240
+ input.indeterminate = shown > 0 && shown < row.columns.length;
241
+ }, "aria-label": `${band}: ${shown} of ${row.columns.length} shown`, onChange: event => toggleBand(band, row.columns, event.currentTarget.checked) }), _jsx("span", { className: "nx-choice__text", children: _jsx("span", { className: "nx-choice__label nx-columns__label", children: band }) })] }), _jsxs("span", { className: "nx-columns__band-count", children: [shown, " / ", row.columns.length] })] }), _jsx("ul", { className: "nx-columns__children", "data-list": band, children: row.columns.map((column, childIndex) => columnRow(column, band, childIndex, true, shown === 0)) })] }, bandId));
242
+ }) }), _jsxs("p", { className: "nx-columns__note", children: [reorderable ? "Drag a handle, or move it with the arrow keys." : "This table keeps the order of its columns.", bands ? " A column under a band moves inside it; the band moves as one." : ""] }), onReset && (_jsx("div", { className: "nx-columns__foot", children: _jsx(Button, { size: "sm", variant: "ghost", icon: _jsx(InlineIcon, { icon: iconArrowBackUp }), disabled: !changed, onClick: () => onReset(), children: "Reset columns" }) })), _jsx("span", { className: "nx-visually-hidden", "aria-live": "polite", children: said })] })] }));
243
+ }
@@ -0,0 +1,138 @@
1
+ import { type IconNode } from "nexus-icons";
2
+ import { type CSSProperties, type MouseEvent, type ReactNode } from "react";
3
+ import { type CellTextOptions } from "../../Helpers/TableHelpers.ts";
4
+ import type { TableColumn, TableRow, TableRowAction, TableState, TableViewColumn } from "../../Interfaces/TableInterfaces.ts";
5
+ /** A number as the table writes counts: 1,234. */
6
+ export declare const formatCount: (count: number) => string;
7
+ /** A value in its column's format: text, a tag for an option with a tone, a check for `true`. Empty values show a dash. */
8
+ export declare function TableCellValue<TRow extends TableRow>({ column, row, options }: {
9
+ column: TableColumn<TRow>;
10
+ row: TRow;
11
+ options: CellTextOptions;
12
+ }): import("react").JSX.Element;
13
+ /**
14
+ * A cell's own style: where a pinned column sits, and the width its values fit in. Once the user has set any width, a
15
+ * `<colgroup>` gives every column its width and the cells only cap their text.
16
+ */
17
+ export declare function columnStyle<TRow extends TableRow>(view: TableViewColumn<TRow>, sized: boolean): CSSProperties;
18
+ /** Where the table's own columns sit, and whether they stay while the rest scrolls. */
19
+ export interface TableFrameColumns {
20
+ /** The numbers and checkbox column: `null` when the table has neither. */
21
+ index: {
22
+ offset: number;
23
+ edge: boolean;
24
+ } | null;
25
+ actions: {
26
+ offset: number;
27
+ edge: boolean;
28
+ } | null;
29
+ }
30
+ /**
31
+ * The widths of the columns, once the user has changed one: the table then lays out its columns from this list
32
+ * (`table-layout: fixed`), so dragging one edge moves that edge only. The last column takes the space left over.
33
+ */
34
+ export declare function TableColumnGroup<TRow extends TableRow>({ columns, widths, frame, colRefs, }: {
35
+ columns: readonly TableViewColumn<TRow>[];
36
+ widths: Readonly<Record<string, number>>;
37
+ frame: TableFrameColumns;
38
+ colRefs: Map<string, HTMLTableColElement>;
39
+ }): import("react").JSX.Element;
40
+ /** The number of a row, its checkbox, or both: the number until the pointer is over the row or something is selected. */
41
+ export declare function TableIndexCell({ heading, rowSpan, own, number, numbered, selectable, checkbox, }: {
42
+ heading?: boolean;
43
+ /** 2 in the heading while the header has a band of group headings above the columns' own. */
44
+ rowSpan?: number;
45
+ own: {
46
+ offset: number;
47
+ edge: boolean;
48
+ } | null;
49
+ /** The row's number, or "#" in the heading. */
50
+ number?: ReactNode;
51
+ numbered: boolean;
52
+ selectable: boolean;
53
+ checkbox?: ReactNode;
54
+ }): import("react").JSX.Element;
55
+ export interface TableRowViewProps<TRow extends TableRow> {
56
+ row: TRow;
57
+ rowKey: string;
58
+ number: number;
59
+ label: string;
60
+ columns: readonly TableViewColumn<TRow>[];
61
+ cellOptions: CellTextOptions;
62
+ selectable: boolean;
63
+ selected: boolean;
64
+ /** No more rows can be selected, and this one is not. */
65
+ selectionFull: boolean;
66
+ busy: boolean;
67
+ flashed: boolean;
68
+ numbered: boolean;
69
+ /** A row of the pinned section above the page: its number is a pin. */
70
+ pinned?: boolean;
71
+ /** Where the table's own columns sit; `null` for the ones it does not have. */
72
+ frame: TableFrameColumns;
73
+ /** The user gave a column a width, so the table lays its columns out from the `<colgroup>`. */
74
+ sized: boolean;
75
+ actions: readonly TableRowAction<TRow>[] | null;
76
+ onToggle: (row: TRow, on: boolean, event: MouseEvent<HTMLInputElement>) => void;
77
+ onAction: (row: TRow, action: TableRowAction<TRow>) => void;
78
+ onOpen?: (row: TRow) => void;
79
+ /** A single click opens the row, as a double-click does. */
80
+ openOnClick?: boolean;
81
+ }
82
+ /** One row. It renders again only when its row, its state, or the columns change. */
83
+ declare function TableRowViewInner<TRow extends TableRow>({ row, rowKey, number, label, columns, cellOptions, selectable, selected, selectionFull, busy, flashed, numbered, pinned, frame, sized, actions, onToggle, onAction, onOpen, openOnClick, }: TableRowViewProps<TRow>): import("react").JSX.Element;
84
+ export declare const TableRowView: typeof TableRowViewInner;
85
+ /**
86
+ * The head of the pinned section: one row across the table with a button that folds the pinned records open and shut,
87
+ * how many there are, and the most that can be pinned.
88
+ */
89
+ export declare function TablePinnedHead({ span, label, count, max, loading, open, onToggle }: {
90
+ span: number;
91
+ label: string;
92
+ count: number;
93
+ max?: number;
94
+ loading: boolean;
95
+ open: boolean;
96
+ onToggle: () => void;
97
+ }): import("react").JSX.Element;
98
+ /** Placeholder rows while the first rows load, in the shape of the columns. */
99
+ export declare function TableSkeletonRows({ count, cells, frame, sized }: {
100
+ count: number;
101
+ cells: number;
102
+ frame: TableFrameColumns;
103
+ sized: boolean;
104
+ }): import("react").JSX.Element;
105
+ /** A row across the table with a message: an empty list, no matches, a failed load. */
106
+ export declare function TableMessageRow({ span, icon, title, detail, tone, children }: {
107
+ span: number;
108
+ icon: IconNode;
109
+ title: ReactNode;
110
+ detail?: ReactNode;
111
+ tone?: "danger";
112
+ children?: ReactNode;
113
+ }): import("react").JSX.Element;
114
+ /** The pager: previous, the page buttons (1 … 5 6 7 … 24), next. */
115
+ export declare function TablePager({ page, matches, pageSize, disabled, onPage }: {
116
+ page: number;
117
+ matches: number;
118
+ pageSize: number;
119
+ disabled: boolean;
120
+ onPage: (page: number) => void;
121
+ }): import("react").JSX.Element | null;
122
+ /** Rows per page, as a menu of the choices. Inside the search box (`compact`) it shows only the number. */
123
+ export declare function TablePageSize({ pageSize, pageSizes, compact, onChange }: {
124
+ pageSize: number;
125
+ pageSizes: readonly number[];
126
+ compact?: boolean;
127
+ onChange: (size: number) => void;
128
+ }): import("react").JSX.Element | null;
129
+ /**
130
+ * Under the table: which rows show and how many the search left ("Showing 41–50 of 234 · filtered from 1,000"), the page
131
+ * of how many, and the pager.
132
+ */
133
+ export declare function TableFooter<TRow extends TableRow>({ state, disabled, onPage }: {
134
+ state: TableState<TRow>;
135
+ disabled: boolean;
136
+ onPage: (page: number) => void;
137
+ }): import("react").JSX.Element;
138
+ export {};
@@ -0,0 +1,157 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { iconCheck, iconChevronDown, iconChevronLeft, iconChevronRight, iconDotsVertical, iconLoader2, iconPin, InlineIcon } from "nexus-icons";
4
+ import { memo } from "react";
5
+ import { cx } from "../../Helpers/ClassHelpers.js";
6
+ import { columnAlign, columnOption, columnValue, cssLength, formatCellText, pageButtons, pageCount, TABLE_ACTIONS_COLUMN, TABLE_INDEX_COLUMN, } from "../../Helpers/TableHelpers.js";
7
+ import { Button } from "../Documents/Button.js";
8
+ import { Menu } from "../Documents/Menu.js";
9
+ /*
10
+ * The parts of a data table: a cell in its column's format, a row with its number and checkbox in one column and its
11
+ * actions, the widths of the columns the user set, the head of the pinned section, the pager, and the footer. The
12
+ * details view of the CRUD draws values with the same `TableCellValue`.
13
+ */
14
+ const countFormat = new Intl.NumberFormat("en-US");
15
+ /** A number as the table writes counts: 1,234. */
16
+ export const formatCount = (count) => countFormat.format(count);
17
+ /** A value in its column's format: text, a tag for an option with a tone, a check for `true`. Empty values show a dash. */
18
+ export function TableCellValue({ column, row, options }) {
19
+ const value = columnValue(column, row);
20
+ if (column.render)
21
+ return _jsx(_Fragment, { children: column.render(row, value) });
22
+ const option = columnOption(column, value);
23
+ if (option?.tone) {
24
+ return (_jsx("span", { className: "nx-table__tag", "data-tone": option.tone, children: option.label }));
25
+ }
26
+ if (column.format === "boolean" && !option) {
27
+ const on = value === true || value === "true" || value === 1;
28
+ return on ? (_jsxs("span", { className: "nx-table__yes", children: [_jsx(InlineIcon, { icon: iconCheck }), _jsx("span", { className: "nx-visually-hidden", children: "Yes" })] })) : (_jsx("span", { className: "nx-table__no", children: "No" }));
29
+ }
30
+ // A moment needs the browser's zone, unknown while the page hydrates: nothing shows until then, not another zone's time.
31
+ if (column.format === "date-time" && !options.timeZone && value)
32
+ return _jsx("span", { className: "nx-table__pending" });
33
+ const text = formatCellText(column, value, options);
34
+ if (!text)
35
+ return _jsx("span", { className: "nx-table__dash", children: "\u2014" });
36
+ return _jsx(_Fragment, { children: text });
37
+ }
38
+ /**
39
+ * A cell's own style: where a pinned column sits, and the width its values fit in. Once the user has set any width, a
40
+ * `<colgroup>` gives every column its width and the cells only cap their text.
41
+ */
42
+ export function columnStyle(view, sized) {
43
+ const style = {};
44
+ if (view.pin === "left")
45
+ style.left = view.offset;
46
+ else if (view.pin === "right")
47
+ style.right = view.offset;
48
+ if (sized) {
49
+ // The widths come from the colgroup now; the narrowest the column may become stays on the cell, for a resize to read.
50
+ style.minWidth = cssLength(view.column.minWidth);
51
+ style["--nx-col-max"] = "100%";
52
+ return style;
53
+ }
54
+ const width = cssLength(view.column.width);
55
+ style.width = width;
56
+ style.minWidth = cssLength(view.column.minWidth) ?? width;
57
+ style["--nx-col-max"] = width;
58
+ return style;
59
+ }
60
+ const ownStyle = (own, side) => (side === "left" ? { left: own?.offset ?? 0 } : { right: own?.offset ?? 0 });
61
+ /** What a column takes while the table lays out from its widths, when it has none of its own: a column shown again. */
62
+ const FALLBACK_COLUMN_WIDTH = "12rem";
63
+ /**
64
+ * The widths of the columns, once the user has changed one: the table then lays out its columns from this list
65
+ * (`table-layout: fixed`), so dragging one edge moves that edge only. The last column takes the space left over.
66
+ */
67
+ export function TableColumnGroup({ columns, widths, frame, colRefs, }) {
68
+ const hold = (key) => (element) => {
69
+ if (element)
70
+ colRefs.set(key, element);
71
+ else
72
+ colRefs.delete(key);
73
+ };
74
+ const own = (key, on) => on && _jsx("col", { ref: hold(key), style: { width: widths[key] } }, key);
75
+ return (_jsxs("colgroup", { children: [own(TABLE_INDEX_COLUMN, Boolean(frame.index)), columns.map(view => (_jsx("col", { ref: hold(view.column.key), style: { width: widths[view.column.key] ?? cssLength(view.column.width) ?? FALLBACK_COLUMN_WIDTH } }, view.column.key))), _jsx("col", { className: "nx-table__col-filler" }), own(TABLE_ACTIONS_COLUMN, Boolean(frame.actions))] }));
76
+ }
77
+ /** The number of a row, its checkbox, or both: the number until the pointer is over the row or something is selected. */
78
+ export function TableIndexCell({ heading, rowSpan, own, number, numbered, selectable, checkbox, }) {
79
+ const shared = {
80
+ className: cx(heading ? "nx-table__heading" : "nx-table__cell", "nx-table__cell--index"),
81
+ "data-col": TABLE_INDEX_COLUMN,
82
+ "data-pin": "left",
83
+ "data-pin-edge": own?.edge || undefined,
84
+ // Both in one cell: the number gives way to the checkbox under the pointer, and once anything is selected.
85
+ "data-swap": (numbered && selectable) || undefined,
86
+ style: ownStyle(own, "left"),
87
+ };
88
+ const content = (_jsxs(_Fragment, { children: [numbered && (_jsx("span", { className: "nx-table__number", "aria-hidden": selectable || undefined, children: number })), checkbox] }));
89
+ return heading ? (_jsx("th", { scope: "col", rowSpan: rowSpan, ...shared, children: content })) : (_jsx("td", { ...shared, children: content }));
90
+ }
91
+ /** What in a row is a control of its own: a click there does what the control does, and never opens the row. */
92
+ const ROW_CONTROLS = "button, a, input, select, textarea, label, [role=menu], [role=menuitem]";
93
+ /**
94
+ * Whether a click on a row should open it. Never on one of its controls. A single click also does not when it ends a
95
+ * text selection inside the row — somebody dragging across a cell to copy a code is not asking for a popup — but a
96
+ * double-click is not asked that, because a double-click selects the word under the pointer on its way in.
97
+ */
98
+ function opensRow(event, single) {
99
+ if (event.target.closest(ROW_CONTROLS))
100
+ return false;
101
+ if (!single)
102
+ return true;
103
+ const selection = window.getSelection();
104
+ return !(selection && !selection.isCollapsed && event.currentTarget.contains(selection.anchorNode));
105
+ }
106
+ /** One row. It renders again only when its row, its state, or the columns change. */
107
+ function TableRowViewInner({ row, rowKey, number, label, columns, cellOptions, selectable, selected, selectionFull, busy, flashed, numbered, pinned, frame, sized, actions, onToggle, onAction, onOpen, openOnClick, }) {
108
+ const inline = actions?.filter(action => action.inline && action.icon) ?? [];
109
+ const inMenu = actions?.filter(action => !(action.inline && action.icon)) ?? [];
110
+ const items = inMenu.map(action => ({ value: action.id, label: action.label, icon: action.icon, description: action.description, tone: action.tone, disabled: action.disabled }));
111
+ return (_jsxs("tr", { className: "nx-table__row", "data-key": rowKey, "data-pinned": pinned || undefined, "data-selected": selected || undefined, "data-busy": busy || undefined, "data-flash": flashed || undefined, "aria-busy": busy || undefined, "data-open": (onOpen && openOnClick) || undefined,
112
+ // One way in: with a single click the row is already open by the time a double-click would arrive.
113
+ onClick: onOpen && openOnClick ? event => opensRow(event, true) && onOpen(row) : undefined, onDoubleClick: onOpen && !openOnClick ? event => opensRow(event, false) && onOpen(row) : undefined, children: [frame.index && (_jsx(TableIndexCell, { own: frame.index, number: pinned ? _jsx(InlineIcon, { icon: iconPin, className: "nx-table__pin-mark" }) : formatCount(number), numbered: numbered || Boolean(pinned), selectable: selectable, checkbox: selectable && (_jsx("label", { className: "nx-choice nx-choice--sm nx-table__check", title: selectionFull ? "No more rows can be selected." : undefined, children: _jsx("input", { type: "checkbox", className: "nx-choice__control nx-choice__control--checkbox", checked: selected, disabled: selectionFull && !selected, "aria-label": `Select ${label}`, onClick: event => onToggle(row, event.currentTarget.checked, event), onChange: () => undefined }) })) })), columns.map(view => (_jsx("td", { className: cx("nx-table__cell", `nx-table__cell--${columnAlign(view.column)}`, view.column.wrap && "nx-table__cell--wrap"), "data-col": view.column.key, "data-pin": view.pin ?? undefined, "data-pin-edge": (view.pin && view.edge) || undefined, style: columnStyle(view, sized), children: _jsx("span", { className: "nx-table__value", children: _jsx(TableCellValue, { column: view.column, row: row, options: cellOptions }) }) }, view.column.key))), sized && _jsx("td", { className: "nx-table__cell nx-table__cell--filler" }), frame.actions && (_jsx("td", { className: "nx-table__cell nx-table__cell--actions", "data-col": TABLE_ACTIONS_COLUMN, "data-pin": "right", "data-pin-edge": frame.actions.edge || undefined, style: ownStyle(frame.actions, "right"), children: _jsxs("div", { className: "nx-table__actions", children: [inline.map(action => (_jsx(Button, { variant: "ghost", size: "sm", icon: action.icon, hoverTone: action.tone === "danger" ? "danger" : undefined, "aria-label": `${action.label}: ${label}`, title: action.label, "data-action": action.id, disabled: busy || action.disabled, onClick: () => onAction(row, action) }, action.id))), items.length > 0 && (_jsx(Menu, { items: items, align: "end", "aria-label": `Actions: ${label}`, onSelect: value => onAction(row, inMenu.find(action => action.id === value)), children: _jsx(Button, { variant: "ghost", size: "sm", icon: _jsx(InlineIcon, { icon: iconDotsVertical }), loading: busy, "aria-label": `More actions: ${label}`, title: "More actions" }) })), items.length === 0 && busy && _jsx(Button, { variant: "ghost", size: "sm", loading: true, "aria-label": `Working: ${label}` })] }) }))] }));
114
+ }
115
+ export const TableRowView = memo(TableRowViewInner);
116
+ /**
117
+ * The head of the pinned section: one row across the table with a button that folds the pinned records open and shut,
118
+ * how many there are, and the most that can be pinned.
119
+ */
120
+ export function TablePinnedHead({ span, label, count, max, loading, open, onToggle }) {
121
+ return (_jsx("tr", { className: "nx-table__row nx-table__pin-row", children: _jsx("td", { colSpan: span, className: "nx-table__pin-cell", children: _jsxs("button", { type: "button", className: "nx-table__pin-toggle", "aria-expanded": open, onClick: onToggle, "data-table-pins": true, children: [_jsx(InlineIcon, { icon: iconChevronRight, className: "nx-table__pin-caret" }), _jsx(InlineIcon, { icon: iconPin, className: "nx-table__pin-icon" }), _jsx("span", { className: "nx-table__pin-title", children: label }), (count > 0 || !loading) && (_jsx("span", { className: "nx-table__pin-count", children: max ? `${formatCount(count)} of ${formatCount(max)}` : formatCount(count) })), loading && _jsx(InlineIcon, { icon: iconLoader2, className: "nx-spin nx-table__pin-loading" })] }) }) }));
122
+ }
123
+ /** Placeholder rows while the first rows load, in the shape of the columns. */
124
+ export function TableSkeletonRows({ count, cells, frame, sized }) {
125
+ return (_jsx(_Fragment, { children: Array.from({ length: count }, (_, index) => (_jsxs("tr", { className: "nx-table__row nx-table__row--skeleton", "aria-hidden": "true", children: [frame.index && _jsx("td", { className: "nx-table__cell nx-table__cell--index", "data-pin": "left", style: ownStyle(frame.index, "left") }), Array.from({ length: cells }, (_, cell) => (_jsx("td", { className: "nx-table__cell", children: _jsx("span", { className: "nx-table__bone", style: { width: `${45 + ((index * 7 + cell * 13) % 45)}%` } }) }, cell))), sized && _jsx("td", { className: "nx-table__cell nx-table__cell--filler" }), frame.actions && _jsx("td", { className: "nx-table__cell nx-table__cell--actions", "data-pin": "right", style: ownStyle(frame.actions, "right") })] }, index))) }));
126
+ }
127
+ /** A row across the table with a message: an empty list, no matches, a failed load. */
128
+ export function TableMessageRow({ span, icon, title, detail, tone, children }) {
129
+ return (_jsx("tr", { className: "nx-table__row nx-table__row--message", children: _jsx("td", { colSpan: span, className: "nx-table__message-cell", children: _jsxs("div", { className: "nx-table__message", "data-tone": tone, role: tone === "danger" ? "alert" : undefined, children: [_jsx(InlineIcon, { icon: icon, className: "nx-table__message-icon" }), _jsx("p", { className: "nx-table__message-title", children: title }), detail && _jsx("p", { className: "nx-table__message-detail", children: detail }), children && _jsx("div", { className: "nx-table__message-actions", children: children })] }) }) }));
130
+ }
131
+ /** The pager: previous, the page buttons (1 … 5 6 7 … 24), next. */
132
+ export function TablePager({ page, matches, pageSize, disabled, onPage }) {
133
+ const pages = pageCount(matches, pageSize);
134
+ if (pages <= 1)
135
+ return null;
136
+ return (_jsxs("nav", { className: "nx-table__pager", "aria-label": "Pages", children: [_jsx(Button, { variant: "ghost", size: "sm", icon: _jsx(InlineIcon, { icon: iconChevronLeft }), "aria-label": "Previous page", disabled: disabled || page <= 1, onClick: () => onPage(page - 1) }), _jsx("span", { className: "nx-table__page-list", children: pageButtons(page, pages).map((entry, index) => entry === "gap" ? (_jsx("span", { className: "nx-table__page-gap", "aria-hidden": "true", children: "\u2026" }, `gap-${index}`)) : (_jsx("button", { type: "button", className: "nx-table__page", "aria-current": entry === page ? "page" : undefined, "aria-label": `Page ${entry}`, disabled: disabled && entry !== page, onClick: () => entry !== page && onPage(entry), children: formatCount(entry) }, entry))) }), _jsx(Button, { variant: "ghost", size: "sm", icon: _jsx(InlineIcon, { icon: iconChevronRight }), "aria-label": "Next page", disabled: disabled || page >= pages, onClick: () => onPage(page + 1) })] }));
137
+ }
138
+ /** Rows per page, as a menu of the choices. Inside the search box (`compact`) it shows only the number. */
139
+ export function TablePageSize({ pageSize, pageSizes, compact = false, onChange }) {
140
+ if (pageSizes.length < 2)
141
+ return null;
142
+ const items = pageSizes.map(size => ({ value: String(size), label: `${formatCount(size)} per page`, checked: size === pageSize }));
143
+ return (_jsx(Menu, { items: items, kind: "radio", size: "sm", align: compact ? "start" : "end", "aria-label": "Rows per page", onSelect: value => onChange(Number(value)), children: _jsx(Button, { variant: "ghost", size: "sm", iconEnd: _jsx(InlineIcon, { icon: iconChevronDown }), className: cx("nx-table__page-size", compact && "nx-table__page-size--field"), "aria-label": `Rows per page: ${pageSize}`, title: "Rows per page", children: compact ? formatCount(pageSize) : `${formatCount(pageSize)} / page` }) }));
144
+ }
145
+ /**
146
+ * Under the table: which rows show and how many the search left ("Showing 41–50 of 234 · filtered from 1,000"), the page
147
+ * of how many, and the pager.
148
+ */
149
+ export function TableFooter({ state, disabled, onPage }) {
150
+ const { status, rows, offset, matches, total, query } = state;
151
+ if (status !== "ready" || total === 0)
152
+ return _jsx("div", { className: "nx-table__footer" });
153
+ const first = rows.length ? offset + 1 : 0;
154
+ const last = offset + rows.length;
155
+ const pages = pageCount(matches, query.pageSize);
156
+ return (_jsxs("div", { className: "nx-table__footer", children: [_jsxs("p", { className: "nx-table__range", "aria-live": "polite", children: [rows.length ? (_jsxs(_Fragment, { children: ["Showing ", _jsx("b", { children: `${formatCount(first)}–${formatCount(last)}` }), " of ", _jsx("b", { children: formatCount(matches) })] })) : (_jsx(_Fragment, { children: "No rows on this page" })), query.search && matches !== total && _jsxs("span", { className: "nx-table__range-all", children: [" \u00B7 filtered from ", formatCount(total)] })] }), _jsxs("div", { className: "nx-table__paging", children: [_jsxs("span", { className: "nx-table__page-info", children: ["Page ", formatCount(query.page), " of ", formatCount(pages)] }), _jsx(TablePager, { page: query.page, matches: matches, pageSize: query.pageSize, disabled: disabled, onPage: onPage })] })] }));
157
+ }
@@ -0,0 +1,26 @@
1
+ import type { ComponentPropsWithoutRef, ReactNode } from "react";
2
+ /** Which links open in a new tab: links to other sites (`external`), `all`, or `none`. */
3
+ export type MarkdownLinkTarget = "external" | "all" | "none";
4
+ export interface MarkdownViewProps extends Omit<ComponentPropsWithoutRef<"div">, "children"> {
5
+ /** The Markdown text. */
6
+ value: string;
7
+ /** Every line break inside a paragraph shows as a line break, as in GitHub comments. Default true. */
8
+ breaks?: boolean;
9
+ /** Which links open in a new tab. Default `external`. */
10
+ newTab?: MarkdownLinkTarget;
11
+ /** Shown when the text is empty. */
12
+ placeholder?: ReactNode;
13
+ /**
14
+ * Called when a task box is clicked, with the line of its marker (from 0) and its new state; see `toggleMarkdownTask`.
15
+ * Without it, task boxes are read-only.
16
+ */
17
+ onTaskToggle?: (line: number, checked: boolean) => void;
18
+ }
19
+ /**
20
+ * Shows Markdown as formatted text: headings, lists, tasks, tables, code, quotes, links, and images. Raw HTML stays
21
+ * text and unsafe addresses are dropped, so it is safe for text from any user. It has no state, so it renders on the
22
+ * server as well.
23
+ *
24
+ * @example <MarkdownView value={room.description} />
25
+ */
26
+ export declare function MarkdownView({ value, breaks, newTab, placeholder, onTaskToggle, className, ...rest }: MarkdownViewProps): import("react").JSX.Element;