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,242 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { iconCheck, InlineIcon } from "nexus-icons";
4
+ import { cloneElement, useId, useLayoutEffect, useRef, useState, } from "react";
5
+ import { cx } from "../../Helpers/ClassHelpers.js";
6
+ import { followAnchor, isPopoverOpen, placeAtPoint, placeUnderAnchor } from "../../Helpers/PopoverHelpers.js";
7
+ export function isMenuItem(entry) {
8
+ return "value" in entry;
9
+ }
10
+ const ITEM_ROLE = {
11
+ menu: "menuitem",
12
+ radio: "menuitemradio",
13
+ checkbox: "menuitemcheckbox",
14
+ };
15
+ const ENABLED_ITEM = '.nx-menu__item:not([aria-disabled="true"])';
16
+ function enabledItems(panel) {
17
+ return Array.from(panel.querySelectorAll(ENABLED_ITEM));
18
+ }
19
+ /** Focuses the item at `index`, counting from the end when negative and wrapping past either end. */
20
+ function focusItemAt(panel, index) {
21
+ const items = enabledItems(panel);
22
+ if (items.length === 0)
23
+ return;
24
+ items[((index % items.length) + items.length) % items.length]?.focus();
25
+ }
26
+ function canShow(panel) {
27
+ return Boolean(panel && typeof panel.showPopover === "function");
28
+ }
29
+ function hide(panel) {
30
+ if (isPopoverOpen(panel))
31
+ panel?.hidePopover();
32
+ }
33
+ function mergeRefs(...refs) {
34
+ return node => {
35
+ for (const ref of refs) {
36
+ if (typeof ref === "function")
37
+ ref(node);
38
+ else if (ref)
39
+ ref.current = node;
40
+ }
41
+ };
42
+ }
43
+ /**
44
+ * The list of a menu inside a native popover. Arrow keys move between items, Home and End jump, a letter jumps to
45
+ * the next item starting with it, Enter or Space chooses, Esc closes, and Tab closes and moves on.
46
+ */
47
+ export function MenuPanel({ id, items, onSelect, kind = "menu", size = "md", closeOnSelect = true, className, ref, onToggle, ...labelling }) {
48
+ function choose(item, event) {
49
+ if (item.disabled) {
50
+ event.preventDefault();
51
+ return;
52
+ }
53
+ onSelect?.(item.value, item);
54
+ if (closeOnSelect)
55
+ hide(event.currentTarget.closest(".nx-menu"));
56
+ }
57
+ function onKeyDown(event) {
58
+ const panel = event.currentTarget;
59
+ const items = enabledItems(panel);
60
+ const current = items.indexOf(document.activeElement);
61
+ const { key } = event;
62
+ if (key === "ArrowDown")
63
+ focusItemAt(panel, current + 1);
64
+ else if (key === "ArrowUp")
65
+ focusItemAt(panel, current < 0 ? -1 : current - 1);
66
+ else if (key === "Home")
67
+ focusItemAt(panel, 0);
68
+ else if (key === "End")
69
+ focusItemAt(panel, -1);
70
+ else if (key === "Tab") {
71
+ // The menu closes and focus returns to its button, so Tab moves on from there.
72
+ hide(panel);
73
+ return;
74
+ }
75
+ else if (key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey && key !== " ") {
76
+ // A letter jumps to the next item that starts with it.
77
+ const letter = key.toLowerCase();
78
+ const from = current + 1;
79
+ const match = items.slice(from).concat(items.slice(0, from)).find(item => item.textContent?.trim().toLowerCase().startsWith(letter));
80
+ if (match)
81
+ match.focus();
82
+ else
83
+ return;
84
+ }
85
+ else
86
+ return;
87
+ event.preventDefault();
88
+ }
89
+ // Focus follows the pointer, so the arrow keys carry on from the item under it. Only a pointer that moved counts:
90
+ // a menu opened from the keyboard under a resting pointer keeps the focus on its first item.
91
+ const pointerRef = useRef({ x: 0, y: 0 });
92
+ function onPointerMove(event) {
93
+ const last = pointerRef.current;
94
+ if (event.clientX === last.x && event.clientY === last.y)
95
+ return;
96
+ pointerRef.current = { x: event.clientX, y: event.clientY };
97
+ const item = event.currentTarget;
98
+ if (item.getAttribute("aria-disabled") !== "true" && document.activeElement !== item)
99
+ item.focus();
100
+ }
101
+ const role = ITEM_ROLE[kind];
102
+ // When any item has an icon, every item keeps the icon column, so the labels line up.
103
+ const hasIcons = items.some(entry => isMenuItem(entry) && entry.icon);
104
+ return (_jsx("div", { ref: ref, id: id, popover: "auto", role: "menu", tabIndex: -1, className: cx("nx-popover", "nx-menu", `nx-menu--${size}`, className), onToggle: onToggle, onKeyDown: onKeyDown, ...labelling, children: _jsx("div", { role: "none", className: "nx-menu__list", children: items.map((entry, index) => {
105
+ // Items are keyed by their value, so a separator keyed by its index alone collided with an item whose value
106
+ // was that number ("5" in a menu of projects). The prefix keeps the two apart.
107
+ if (!isMenuItem(entry)) {
108
+ if ("separator" in entry)
109
+ return _jsx("div", { role: "separator", className: "nx-menu__separator" }, `nx-at-${index}`);
110
+ return (_jsx("div", { role: "presentation", className: "nx-menu__heading", children: entry.heading }, `nx-at-${index}`));
111
+ }
112
+ const item = entry;
113
+ const content = (_jsxs(_Fragment, { children: [kind !== "menu" && _jsx("span", { className: "nx-menu__check", children: item.checked && _jsx(InlineIcon, { icon: iconCheck }) }), hasIcons && _jsx("span", { className: "nx-menu__icon", children: item.icon }), _jsxs("span", { className: "nx-menu__body", children: [_jsx("span", { className: "nx-menu__label", children: item.label }), item.description && _jsx("span", { className: "nx-menu__description", children: item.description })] }), item.shortcut && _jsx("kbd", { className: "nx-menu__shortcut", children: item.shortcut })] }));
114
+ const shared = {
115
+ role,
116
+ className: cx("nx-menu__item", item.tone === "danger" && "nx-menu__item--danger", item.checked && "nx-menu__item--checked"),
117
+ tabIndex: -1,
118
+ title: item.title,
119
+ "aria-disabled": item.disabled || undefined,
120
+ "aria-checked": kind === "menu" ? undefined : Boolean(item.checked),
121
+ onPointerMove,
122
+ };
123
+ return item.href && !item.disabled ? (_jsx("a", { ...shared, href: item.href, target: item.target, rel: item.target === "_blank" ? "noopener" : undefined, onClick: event => choose(item, event), children: content }, item.value)) : (_jsx("button", { ...shared, type: "button", onClick: event => choose(item, event), children: content }, item.value));
124
+ }) }) }));
125
+ }
126
+ /**
127
+ * A dropdown menu: a button that opens a list of actions in a native popover under it (above it when there is no
128
+ * room). Click or Enter opens it, ArrowDown opens it on the first item, Esc closes it and returns focus to the button.
129
+ *
130
+ * @example
131
+ * <Menu items={items} onSelect={value => run(value)}>
132
+ * <Button iconEnd={<InlineIcon icon={iconChevronDown} />}>Actions</Button>
133
+ * </Menu>
134
+ */
135
+ export function Menu({ children, align = "start", "aria-label": ariaLabel, onOpenChange, ...panelProps }) {
136
+ const id = useId();
137
+ const triggerId = children.props.id ?? `${id}-trigger`;
138
+ const panelId = `${id}-menu`;
139
+ const triggerRef = useRef(null);
140
+ const panelRef = useRef(null);
141
+ const [open, setOpen] = useState(false);
142
+ // Set on pointer down while the menu is open: that press closes the menu (light dismiss), and its click must not reopen it.
143
+ const dismissingRef = useRef(false);
144
+ function place() {
145
+ const panel = panelRef.current;
146
+ const trigger = triggerRef.current;
147
+ if (panel && trigger)
148
+ placeUnderAnchor(panel, trigger.getBoundingClientRect(), { align });
149
+ }
150
+ function show(focus) {
151
+ const panel = panelRef.current;
152
+ if (!canShow(panel) || isPopoverOpen(panel))
153
+ return;
154
+ panel.showPopover();
155
+ place();
156
+ if (focus === "panel")
157
+ panel.focus();
158
+ else
159
+ focusItemAt(panel, focus === "first" ? 0 : -1);
160
+ }
161
+ // The panel is fixed, so it follows the button while the page scrolls or the window changes size.
162
+ useLayoutEffect(() => {
163
+ if (!open)
164
+ return;
165
+ return followAnchor(place);
166
+ // eslint-disable-next-line react-hooks/exhaustive-deps
167
+ }, [open, align]);
168
+ function onToggle(event) {
169
+ const isOpen = event.newState === "open";
170
+ setOpen(isOpen);
171
+ onOpenChange?.(isOpen);
172
+ }
173
+ const triggerProps = {
174
+ ref: mergeRefs(triggerRef, children.props.ref),
175
+ id: triggerId,
176
+ "aria-haspopup": "menu",
177
+ "aria-expanded": open,
178
+ "aria-controls": panelId,
179
+ onPointerDown: event => {
180
+ children.props.onPointerDown?.(event);
181
+ dismissingRef.current = isPopoverOpen(panelRef.current);
182
+ },
183
+ onClick: event => {
184
+ children.props.onClick?.(event);
185
+ if (event.defaultPrevented)
186
+ return;
187
+ if (dismissingRef.current) {
188
+ dismissingRef.current = false;
189
+ return;
190
+ }
191
+ if (isPopoverOpen(panelRef.current))
192
+ hide(panelRef.current);
193
+ // A click from the keyboard (Enter or Space) starts on the first item; a pointer click leaves the pointer in charge.
194
+ else
195
+ show(event.detail === 0 ? "first" : "panel");
196
+ },
197
+ onKeyDown: event => {
198
+ children.props.onKeyDown?.(event);
199
+ if (event.defaultPrevented)
200
+ return;
201
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
202
+ event.preventDefault();
203
+ show(event.key === "ArrowDown" ? "first" : "last");
204
+ }
205
+ },
206
+ };
207
+ return (_jsxs(_Fragment, { children: [cloneElement(children, triggerProps), _jsx(MenuPanel, { ref: panelRef, id: panelId, "aria-label": ariaLabel, "aria-labelledby": ariaLabel ? undefined : triggerId, onToggle: onToggle, ...panelProps })] }));
208
+ }
209
+ /**
210
+ * A menu that opens where the user right-clicks (or presses Shift+F10) over its content, kept inside the window.
211
+ * The wrapper takes no space of its own (`display: contents`), so it can wrap a table row or a grid cell.
212
+ */
213
+ export function ContextMenu({ children, "aria-label": ariaLabel = "Context menu", disabled = false, onOpenChange, ...panelProps }) {
214
+ const panelId = useId();
215
+ const panelRef = useRef(null);
216
+ // When the last press happened: a contextmenu event right after one comes from the mouse or a long touch.
217
+ // When a pointer was last pressed. Never pressed has to be long ago, not zero: zero is 1.5 seconds after the page
218
+ // loaded, and a context menu opened from the keyboard in that moment would be placed as a pointer's.
219
+ const pressedAtRef = useRef(Number.NEGATIVE_INFINITY);
220
+ function onContextMenu(event) {
221
+ const panel = panelRef.current;
222
+ if (disabled || !canShow(panel))
223
+ return;
224
+ event.preventDefault();
225
+ hide(panel);
226
+ panel.showPopover();
227
+ const fromPointer = performance.now() - pressedAtRef.current < 1500;
228
+ if (fromPointer) {
229
+ placeAtPoint(panel, event.clientX, event.clientY);
230
+ panel.focus();
231
+ }
232
+ else {
233
+ // From the keyboard (Shift+F10, the Menu key): browsers report the event at the element or at 0,0, so the
234
+ // menu opens under the focused element like a dropdown (above it when there is no room), on its first item.
235
+ placeUnderAnchor(panel, event.target.getBoundingClientRect());
236
+ focusItemAt(panel, 0);
237
+ }
238
+ }
239
+ return (_jsxs("div", { className: "nx-context-target", onPointerDown: () => {
240
+ pressedAtRef.current = performance.now();
241
+ }, onContextMenu: onContextMenu, children: [children, _jsx(MenuPanel, { ref: panelRef, id: panelId, "aria-label": ariaLabel, onToggle: onOpenChange && (event => onOpenChange(event.newState === "open")), ...panelProps })] }));
242
+ }
@@ -0,0 +1,64 @@
1
+ import { type CSSProperties, type ReactNode } from "react";
2
+ import { type PopoverAlign } from "../../Helpers/PopoverHelpers.ts";
3
+ import type { Size } from "../../Interfaces/TypeInterfaces.ts";
4
+ import { type ButtonVariant } from "./Button.tsx";
5
+ export interface SplitButtonOption<T extends string = string> {
6
+ value: T;
7
+ label: ReactNode;
8
+ /** A second line in the menu: what this action does. */
9
+ description?: ReactNode;
10
+ /** Icon on the main button and in the menu. */
11
+ icon?: ReactNode;
12
+ disabled?: boolean;
13
+ }
14
+ export interface SplitButtonProps<T extends string = string> {
15
+ /** The actions. The chosen one is the main button; the others wait in the menu. */
16
+ options: readonly SplitButtonOption<T>[];
17
+ /** Runs when the main button is clicked. */
18
+ onAction: (value: T, option: SplitButtonOption<T>) => void;
19
+ /** The action shown first, unless a remembered choice exists. Default: the first option. */
20
+ defaultValue?: T;
21
+ /** The action shown, controlled. */
22
+ value?: T;
23
+ /** After the user picks another action in the menu. */
24
+ onValueChange?: (value: T, option: SplitButtonOption<T>) => void;
25
+ /**
26
+ * Remembers the picked action in the browser under this key, so the next visit starts with it,
27
+ * e.g. `storageKey="pull-request"`. Keys are shared by every split button with the same name.
28
+ */
29
+ storageKey?: string;
30
+ /** Picking an action in the menu also runs it. Default false: it only becomes the main button, as on GitHub. */
31
+ runOnSelect?: boolean;
32
+ /** Default `primary`. */
33
+ variant?: ButtonVariant;
34
+ /** Default `md`. */
35
+ size?: Size;
36
+ /** Shows a spinner on the main button and blocks both buttons while the action runs. */
37
+ loading?: boolean;
38
+ disabled?: boolean;
39
+ /** Fills the width of its container. */
40
+ block?: boolean;
41
+ /** `submit` makes the main button submit its form. Default `button`. */
42
+ type?: "button" | "submit";
43
+ /** The form the main button submits, when it is not inside it. */
44
+ form?: string;
45
+ /** Sends the chosen action's value with the form, through a hidden input. */
46
+ name?: string;
47
+ /** Name of the arrow button for screen readers. Default "More actions". */
48
+ menuLabel?: string;
49
+ /** Which edge of the button the menu lines up with. Default `end`. */
50
+ align?: PopoverAlign;
51
+ className?: string;
52
+ style?: CSSProperties;
53
+ }
54
+ /**
55
+ * A main action with a menu of alternatives, like "Create pull request" with "Create draft pull request".
56
+ * Picking an alternative makes it the main button, and with `storageKey` the browser remembers it for next time.
57
+ *
58
+ * @example
59
+ * <SplitButton storageKey="pull-request" onAction={create} options={[
60
+ * { value: "create", label: "Create pull request" },
61
+ * { value: "draft", label: "Create draft pull request", description: "Cannot be merged until marked ready" },
62
+ * ]} />
63
+ */
64
+ export declare function SplitButton<T extends string>({ options, onAction, defaultValue, value, onValueChange, storageKey, runOnSelect, variant, size, loading, disabled, block, type, form, name, menuLabel, align, className, style, }: SplitButtonProps<T>): import("react").JSX.Element | null;
@@ -0,0 +1,129 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { iconChevronDown, InlineIcon } from "nexus-icons";
4
+ import { 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 "./Button.js";
8
+ import { MenuPanel } from "./Menu.js";
9
+ const STORAGE_PREFIX = "nx-split:";
10
+ function readChoice(key) {
11
+ if (!key)
12
+ return null;
13
+ try {
14
+ return localStorage.getItem(STORAGE_PREFIX + key);
15
+ }
16
+ catch {
17
+ return null;
18
+ }
19
+ }
20
+ function saveChoice(key, value) {
21
+ if (!key)
22
+ return;
23
+ try {
24
+ localStorage.setItem(STORAGE_PREFIX + key, value);
25
+ }
26
+ catch {
27
+ // Storage blocked (private mode, for example): the choice lasts until the page reloads.
28
+ }
29
+ }
30
+ /**
31
+ * A main action with a menu of alternatives, like "Create pull request" with "Create draft pull request".
32
+ * Picking an alternative makes it the main button, and with `storageKey` the browser remembers it for next time.
33
+ *
34
+ * @example
35
+ * <SplitButton storageKey="pull-request" onAction={create} options={[
36
+ * { value: "create", label: "Create pull request" },
37
+ * { value: "draft", label: "Create draft pull request", description: "Cannot be merged until marked ready" },
38
+ * ]} />
39
+ */
40
+ export function SplitButton({ options, onAction, defaultValue, value, onValueChange, storageKey, runOnSelect = false, variant = "primary", size = "md", loading = false, disabled = false, block = false, type = "button", form, name, menuLabel = "More actions", align = "end", className, style, }) {
41
+ const id = useId();
42
+ const panelId = `${id}-menu`;
43
+ const toggleRef = useRef(null);
44
+ const panelRef = useRef(null);
45
+ const dismissingRef = useRef(false);
46
+ const [open, setOpen] = useState(false);
47
+ const [chosen, setChosen] = useState(defaultValue);
48
+ const usable = (candidate) => options.find(option => option.value === candidate && !option.disabled);
49
+ // The remembered choice applies before the first paint, so the button never shows the default and then switches.
50
+ useLayoutEffect(() => {
51
+ const saved = usable(readChoice(storageKey));
52
+ if (saved)
53
+ setChosen(saved.value);
54
+ // eslint-disable-next-line react-hooks/exhaustive-deps
55
+ }, [storageKey]);
56
+ const current = usable(value ?? chosen) ?? options.find(option => !option.disabled) ?? options[0];
57
+ if (!current)
58
+ return null;
59
+ function place() {
60
+ const panel = panelRef.current;
61
+ const toggle = toggleRef.current;
62
+ const anchor = toggle?.parentElement;
63
+ // The menu lines up with the whole button, and its arrow points at the half that opened it.
64
+ if (panel && toggle && anchor)
65
+ placeUnderAnchor(panel, anchor.getBoundingClientRect(), { align, arrowAt: toggle.getBoundingClientRect() });
66
+ }
67
+ function show(focusFirst) {
68
+ const panel = panelRef.current;
69
+ if (!panel || typeof panel.showPopover !== "function" || isPopoverOpen(panel))
70
+ return;
71
+ panel.showPopover();
72
+ place();
73
+ if (focusFirst)
74
+ panel.querySelector('.nx-menu__item:not([aria-disabled="true"])')?.focus();
75
+ else
76
+ panel.focus();
77
+ }
78
+ function hide() {
79
+ if (isPopoverOpen(panelRef.current))
80
+ panelRef.current?.hidePopover();
81
+ }
82
+ useLayoutEffect(() => {
83
+ if (!open)
84
+ return;
85
+ return followAnchor(place);
86
+ // eslint-disable-next-line react-hooks/exhaustive-deps
87
+ }, [open, align]);
88
+ function onToggle(event) {
89
+ setOpen(event.newState === "open");
90
+ }
91
+ function pick(next) {
92
+ const option = usable(next);
93
+ if (!option || !current)
94
+ return;
95
+ if (value === undefined)
96
+ setChosen(next);
97
+ saveChoice(storageKey, next);
98
+ if (next !== current.value)
99
+ onValueChange?.(next, option);
100
+ if (runOnSelect)
101
+ onAction(next, option);
102
+ }
103
+ const items = options.map(option => ({
104
+ value: option.value,
105
+ label: option.label,
106
+ description: option.description,
107
+ icon: option.icon,
108
+ disabled: option.disabled,
109
+ checked: option.value === current.value,
110
+ }));
111
+ const blocked = disabled || loading;
112
+ return (_jsxs("div", { className: cx("nx-split", `nx-split--${variant}`, `nx-split--${size}`, block && "nx-split--block", className), style: style, children: [_jsx(Button, { type: type, form: form, variant: variant, size: size, icon: current.icon, loading: loading, disabled: disabled, className: "nx-split__main", onClick: () => onAction(current.value, current), children: current.label }), name && _jsx("input", { type: "hidden", name: name, form: form, value: current.value }), _jsx(Button, { ref: toggleRef, variant: variant, size: size, disabled: blocked, className: "nx-split__toggle", "aria-label": menuLabel, title: menuLabel, "aria-haspopup": "menu", "aria-expanded": open, "aria-controls": panelId, icon: _jsx(InlineIcon, { icon: iconChevronDown }), onPointerDown: () => {
113
+ dismissingRef.current = isPopoverOpen(panelRef.current);
114
+ }, onClick: event => {
115
+ if (dismissingRef.current) {
116
+ dismissingRef.current = false;
117
+ return;
118
+ }
119
+ if (isPopoverOpen(panelRef.current))
120
+ hide();
121
+ else
122
+ show(event.detail === 0);
123
+ }, onKeyDown: event => {
124
+ if (event.key === "ArrowDown") {
125
+ event.preventDefault();
126
+ show(true);
127
+ }
128
+ } }), _jsx(MenuPanel, { ref: panelRef, id: panelId, kind: "radio", size: size, items: items, onSelect: pick, "aria-label": menuLabel, onToggle: onToggle, className: "nx-split__menu" })] }));
129
+ }
@@ -0,0 +1,80 @@
1
+ import { type ReactNode } from "react";
2
+ import type { Size } from "../../Interfaces/TypeInterfaces.ts";
3
+ export interface TabButtonOption<T extends string = string> {
4
+ value: T;
5
+ label: ReactNode;
6
+ /** Shown before the label, e.g. `<InlineIcon icon={iconSun} />`. It takes the primary color while selected. */
7
+ icon?: ReactNode;
8
+ /** A second line in muted text. Shown by the `list` design only. */
9
+ description?: ReactNode;
10
+ /** A count or short tag at the end of the row, e.g. `3`. Shown by the `list` design only. */
11
+ badge?: ReactNode;
12
+ disabled?: boolean;
13
+ /** Tooltip. With `labels="selected"`, a text label is the default tooltip. */
14
+ title?: string;
15
+ }
16
+ /** `all`: every option shows its label. `selected`: options show only their icon, and the selected one adds its label. */
17
+ export type TabButtonLabels = "all" | "selected";
18
+ /** `nav`: a horizontal track with a sliding indicator. `list`: a vertical list of rows, for settings pages and side panels. */
19
+ export type TabButtonDesign = "nav" | "list";
20
+ interface TabButtonsBaseProps<T extends string> {
21
+ options: readonly TabButtonOption<T>[];
22
+ /** Default `nav`. `list` stacks the options as full-width rows with a bar at the selected one. */
23
+ design?: TabButtonDesign;
24
+ /** Default `md`. */
25
+ size?: Size;
26
+ /** `neutral` (default): a raised indicator. `primary`: a solid primary indicator, for a choice that matters. */
27
+ tone?: "neutral" | "primary";
28
+ /**
29
+ * Default `all`. `selected` keeps a toolbar compact: icons only, and the selected option grows to show its label.
30
+ * Every option needs an icon; hidden labels are still read by screen readers and shown as tooltips. `nav` design only.
31
+ */
32
+ labels?: TabButtonLabels;
33
+ /** Fills the width of its container. With `labels="all"`, options share the width equally. A `list` always fills it. */
34
+ block?: boolean;
35
+ /** Radio (or checkbox) group name, for forms. Default: a unique id. */
36
+ name?: string;
37
+ /**
38
+ * Id of the form the choice belongs to, as the HTML `form` attribute. An id that matches no form keeps the choice out
39
+ * of every form, for a switch inside a form that is not one of its values, such as an editor's view.
40
+ */
41
+ form?: string;
42
+ className?: string;
43
+ }
44
+ /** One option at a time: radio buttons, and an indicator that slides to the selection. */
45
+ interface TabButtonsOneProps<T extends string> {
46
+ multiple?: false;
47
+ /** The selected option. A value that matches no option leaves every option unselected. */
48
+ value: T;
49
+ onChange: (value: T) => void;
50
+ }
51
+ /**
52
+ * Several options at once: checkboxes, each chosen option raised on its own, and the options wrap onto more rows when
53
+ * they do not fit, so a picker of 26 letters or 33 symbols stays one control on a phone.
54
+ */
55
+ interface TabButtonsManyProps<T extends string> {
56
+ multiple: true;
57
+ /** The chosen options. Values that match no option are ignored, and never handed back. */
58
+ value: readonly T[];
59
+ /** The chosen values after each change, in option order. */
60
+ onChange: (values: T[]) => void;
61
+ }
62
+ /** A label is required: pass `aria-label`, or `aria-labelledby` pointing at a visible heading. */
63
+ export type TabButtonsProps<T extends string = string> = TabButtonsBaseProps<T> & (TabButtonsOneProps<T> | TabButtonsManyProps<T>) & ({
64
+ "aria-label": string;
65
+ "aria-labelledby"?: never;
66
+ } | {
67
+ "aria-labelledby": string;
68
+ "aria-label"?: never;
69
+ });
70
+ /**
71
+ * Tab buttons: pick one option from a small set, such as Light / Dark / System.
72
+ * The `nav` design slides an indicator to the selection; the `list` design stacks the options as rows, each with an
73
+ * icon, a label, a description, and a badge, for settings pages and side panels. Built on native radio buttons, so
74
+ * arrow keys move the selection and screen readers announce it. To switch between page panels, use tabs with panels instead.
75
+ *
76
+ * `multiple` picks several at once, such as the weekdays a rule runs on: native checkboxes (Tab moves between them,
77
+ * Space toggles one), every chosen option raised as the single choice's indicator is, and the options wrap.
78
+ */
79
+ export declare function TabButtons<T extends string>(props: TabButtonsProps<T>): import("react").JSX.Element;
80
+ export {};
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useId } from "react";
4
+ import { cx } from "../../Helpers/ClassHelpers.js";
5
+ /**
6
+ * Tab buttons: pick one option from a small set, such as Light / Dark / System.
7
+ * The `nav` design slides an indicator to the selection; the `list` design stacks the options as rows, each with an
8
+ * icon, a label, a description, and a badge, for settings pages and side panels. Built on native radio buttons, so
9
+ * arrow keys move the selection and screen readers announce it. To switch between page panels, use tabs with panels instead.
10
+ *
11
+ * `multiple` picks several at once, such as the weekdays a rule runs on: native checkboxes (Tab moves between them,
12
+ * Space toggles one), every chosen option raised as the single choice's indicator is, and the options wrap.
13
+ */
14
+ export function TabButtons(props) {
15
+ const { options, design = "nav", size = "md", tone = "neutral", labels = "all", block = false, name, form, className, multiple: _multiple, value: _value, onChange: _onChange, ...labelling } = props;
16
+ const generatedName = useId();
17
+ const groupName = name ?? generatedName;
18
+ const list = design === "list";
19
+ const labelsSelected = !list && labels === "selected";
20
+ const chosen = props.multiple ? new Set(props.value) : null;
21
+ // One choice slides one indicator; several have no single place for it, so each chosen option draws its own.
22
+ const index = chosen ? -1 : options.findIndex(option => option.value === props.value);
23
+ const style = { "--nx-tabs-count": Math.max(options.length, 1), "--nx-tabs-index": Math.max(index, 0) };
24
+ const isChecked = (option) => (chosen ? chosen.has(option.value) : option.value === props.value);
25
+ const toggle = (option, checked) => {
26
+ if (!props.multiple) {
27
+ props.onChange(option.value);
28
+ return;
29
+ }
30
+ const next = new Set(props.value);
31
+ if (checked)
32
+ next.add(option.value);
33
+ else
34
+ next.delete(option.value);
35
+ props.onChange(options.filter(one => next.has(one.value)).map(one => one.value));
36
+ };
37
+ return (_jsxs("div", { role: chosen ? "group" : "radiogroup", "aria-orientation": list && !chosen ? "vertical" : undefined, ...labelling, className: cx("nx-tabs", `nx-tabs--${size}`, list && "nx-tabs--list", tone === "primary" && "nx-tabs--primary", labelsSelected && "nx-tabs--labels-selected", chosen && !list && "nx-tabs--multiple", block && "nx-tabs--block", className), style: list || chosen ? undefined : style, children: [index >= 0 && !list && !labelsSelected && _jsx("span", { className: "nx-tabs__indicator", "aria-hidden": "true" }), options.map(option => (_jsxs("label", { className: "nx-tabs__option", title: option.title ?? (labelsSelected && typeof option.label === "string" ? option.label : undefined), children: [_jsx("input", { type: chosen ? "checkbox" : "radio", className: "nx-visually-hidden", name: groupName, form: form, value: option.value, checked: isChecked(option), disabled: option.disabled, onChange: event => toggle(option, event.currentTarget.checked) }), option.icon, _jsxs("span", { className: "nx-tabs__label", children: [_jsx("span", { className: "nx-tabs__text", children: option.label }), list && option.description && _jsx("span", { className: "nx-tabs__description", children: option.description })] }), list && option.badge !== undefined && option.badge !== null && _jsx("span", { className: "nx-tabs__badge", children: option.badge })] }, option.value)))] }));
38
+ }
@@ -0,0 +1,23 @@
1
+ import type { ApiFormProps, FormValues } from "../../Interfaces/FormInterfaces.ts";
2
+ /**
3
+ * A `SubmitForm` that sends its values to an API: an endpoint (`ROOMS.update`, or `{ module, path, method }` in place),
4
+ * a URL outside the app's modules (`{ url, method }`, as JSON), both sent through the app's `api` without its toasts, or
5
+ * a function that sends them with a client of the app's own. The answer is read as Nexus API responses
6
+ * (`{ isSuccess, errorMessages: [{ message, inputName }], result }`, or one message at the top level), ASP.NET Core problem
7
+ * details, or any JSON by its status. On success a toast says so and the values become the form's own; on failure the
8
+ * server's own words show - every message it sent, on the inputs they name and the rest under the form, with our message
9
+ * by status only for an answer that explains nothing - and the first input with a message takes focus. `loadValue` loads
10
+ * the record to edit, with placeholders and Retry.
11
+ *
12
+ * @example
13
+ * const ROOMS = apiController(NexusModule.Reservation, "Room", "room");
14
+ *
15
+ * <ApiForm
16
+ * inputs={ROOM_INPUTS}
17
+ * loadValue={signal => api.get<Room>(ROOMS.details, { params: { id }, signal, toast: false }).then(unwrapApiResult)}
18
+ * api={ROOMS.update}
19
+ * onSuccess={room => table.updateRow(room)}
20
+ * onCancel={close}
21
+ * />
22
+ */
23
+ export declare function ApiForm<TValues extends FormValues = FormValues>(props: ApiFormProps<TValues>): import("react").JSX.Element;