@k3-tech/react-kit 0.0.72 → 0.0.74

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 (535) hide show
  1. package/dist/index.d.ts +11 -0
  2. package/dist/index.js +6132 -3995
  3. package/dist/kit/builder/data-table/components/DataTable.d.ts +21 -2
  4. package/dist/kit/builder/upload-wizard/UploadWizard.d.ts +54 -0
  5. package/dist/kit/builder/upload-wizard/UploadWizardMappingStep.d.ts +61 -0
  6. package/dist/kit/builder/upload-wizard/UploadWizardPreviewStep.d.ts +27 -0
  7. package/dist/kit/builder/upload-wizard/UploadWizardResultStep.d.ts +15 -0
  8. package/dist/kit/builder/upload-wizard/UploadWizardStepper.d.ts +6 -0
  9. package/dist/kit/builder/upload-wizard/UploadWizardUploadStep.d.ts +43 -0
  10. package/dist/kit/builder/upload-wizard/index.d.ts +8 -0
  11. package/dist/kit/builder/upload-wizard/types.d.ts +91 -0
  12. package/dist/kit/builder/upload-wizard/useFilePreview.d.ts +50 -0
  13. package/dist/kit/components/data-display/DescriptionList.d.ts +17 -0
  14. package/dist/kit/components/data-display/EmptyState.d.ts +13 -0
  15. package/dist/kit/components/data-display/StatCard.d.ts +49 -0
  16. package/dist/kit/components/data-display/index.d.ts +4 -0
  17. package/dist/kit/components/file-action/FileAction.d.ts +38 -0
  18. package/dist/kit/components/file-action/index.d.ts +2 -0
  19. package/dist/kit/components/fileuploader/FileUploader.d.ts +1 -1
  20. package/dist/kit/components/fileuploader/types.d.ts +2 -0
  21. package/dist/kit/components/import-progress/ImportProgress.d.ts +16 -0
  22. package/dist/kit/components/import-progress/index.d.ts +2 -0
  23. package/dist/kit/components/info-tip/InfoTip.d.ts +7 -0
  24. package/dist/kit/components/info-tip/index.d.ts +2 -0
  25. package/dist/kit/components/loading-overlay/LoadingOverlay.d.ts +9 -0
  26. package/dist/kit/components/loading-overlay/index.d.ts +2 -0
  27. package/dist/kit/components/product-cell/ProductCell.d.ts +13 -0
  28. package/dist/kit/components/product-cell/index.d.ts +2 -0
  29. package/dist/kit/components/row-actions/RowActions.d.ts +53 -0
  30. package/dist/kit/components/row-actions/index.d.ts +2 -0
  31. package/dist/kit/components/setting-row/SettingRow.d.ts +12 -0
  32. package/dist/kit/components/setting-row/index.d.ts +2 -0
  33. package/dist/kit/components/status-text/StatusText.d.ts +20 -0
  34. package/dist/kit/components/status-text/index.d.ts +2 -0
  35. package/dist/kit/components/tree/Tree.d.ts +42 -0
  36. package/dist/kit/components/tree/index.d.ts +2 -0
  37. package/dist/kit/themes/base.css +3 -3
  38. package/dist/kit/themes/clean-slate.css +871 -397
  39. package/dist/kit/themes/default.css +1327 -412
  40. package/dist/kit/themes/minimal-modern.css +871 -397
  41. package/dist/kit/themes/spotify.css +871 -397
  42. package/dist/shadcn/ui/alert.d.ts +1 -1
  43. package/dist/shadcn/ui/badge.d.ts +1 -1
  44. package/dist/shadcn/ui/button.d.ts +3 -1
  45. package/dist/shadcn/ui/progress.d.ts +10 -1
  46. package/package.json +5 -1
  47. package/.babelrc +0 -12
  48. package/.storybook/main.ts +0 -22
  49. package/.storybook/preview.ts +0 -198
  50. package/Dockerfile.storybook +0 -43
  51. package/biome.json +0 -10
  52. package/components.json +0 -20
  53. package/dist/chunks/index.js +0 -5168
  54. package/dist/chunks/ort.bundle.min.js +0 -4
  55. package/dist/chunks/ort.webgpu.bundle.min.js +0 -4
  56. package/dist/index.d.ts.map +0 -1
  57. package/dist/kit/builder/auth/components/Can.d.ts.map +0 -1
  58. package/dist/kit/builder/auth/components/RequireAuth.d.ts.map +0 -1
  59. package/dist/kit/builder/auth/components/ShowWhenAuthenticated.d.ts.map +0 -1
  60. package/dist/kit/builder/auth/components/ShowWhenError.d.ts.map +0 -1
  61. package/dist/kit/builder/auth/components/ShowWhenLoading.d.ts.map +0 -1
  62. package/dist/kit/builder/auth/components/ShowWhenUnauthenticated.d.ts.map +0 -1
  63. package/dist/kit/builder/auth/components/withPermission.d.ts.map +0 -1
  64. package/dist/kit/builder/auth/hooks/action-hooks.d.ts.map +0 -1
  65. package/dist/kit/builder/auth/hooks/core-hooks.d.ts.map +0 -1
  66. package/dist/kit/builder/auth/hooks/index.d.ts.map +0 -1
  67. package/dist/kit/builder/auth/hooks/permission-hooks.d.ts.map +0 -1
  68. package/dist/kit/builder/auth/hooks/token-hooks.d.ts.map +0 -1
  69. package/dist/kit/builder/auth/index.d.ts.map +0 -1
  70. package/dist/kit/builder/auth/providers/AuthProvider.d.ts.map +0 -1
  71. package/dist/kit/builder/auth/types/adapter-config.d.ts.map +0 -1
  72. package/dist/kit/builder/auth/types/adapter.d.ts.map +0 -1
  73. package/dist/kit/builder/auth/types/core.d.ts.map +0 -1
  74. package/dist/kit/builder/auth/types/index.d.ts.map +0 -1
  75. package/dist/kit/builder/auth/types/middleware.d.ts.map +0 -1
  76. package/dist/kit/builder/auth/types/permissions.d.ts.map +0 -1
  77. package/dist/kit/builder/auth/types/state.d.ts.map +0 -1
  78. package/dist/kit/builder/auth/types/storage.d.ts.map +0 -1
  79. package/dist/kit/builder/auth/types/token-manager.d.ts.map +0 -1
  80. package/dist/kit/builder/auth/types/utils.d.ts.map +0 -1
  81. package/dist/kit/builder/auth/utils/auth-adapter.d.ts.map +0 -1
  82. package/dist/kit/builder/auth/utils/client-adapters/apollo-link.d.ts.map +0 -1
  83. package/dist/kit/builder/auth/utils/client-adapters/axios.d.ts.map +0 -1
  84. package/dist/kit/builder/auth/utils/client-adapters/fetch.d.ts.map +0 -1
  85. package/dist/kit/builder/auth/utils/client-adapters/graphql.d.ts.map +0 -1
  86. package/dist/kit/builder/auth/utils/client-adapters/index.d.ts.map +0 -1
  87. package/dist/kit/builder/auth/utils/client-adapters/rest.d.ts.map +0 -1
  88. package/dist/kit/builder/auth/utils/client-adapters/urql-exchange.d.ts.map +0 -1
  89. package/dist/kit/builder/auth/utils/permission-checker.d.ts.map +0 -1
  90. package/dist/kit/builder/auth/utils/storage/browser.d.ts.map +0 -1
  91. package/dist/kit/builder/auth/utils/storage/cookie.d.ts.map +0 -1
  92. package/dist/kit/builder/auth/utils/storage/encryption.d.ts.map +0 -1
  93. package/dist/kit/builder/auth/utils/storage/env.d.ts.map +0 -1
  94. package/dist/kit/builder/auth/utils/storage/factory.d.ts.map +0 -1
  95. package/dist/kit/builder/auth/utils/storage/index.d.ts.map +0 -1
  96. package/dist/kit/builder/auth/utils/storage/memory.d.ts.map +0 -1
  97. package/dist/kit/builder/auth/utils/token-manager.d.ts.map +0 -1
  98. package/dist/kit/builder/data-table/components/DataTable.d.ts.map +0 -1
  99. package/dist/kit/builder/data-table/components/DataTableColumnHeader.d.ts.map +0 -1
  100. package/dist/kit/builder/data-table/components/DataTableFilterPanel.d.ts.map +0 -1
  101. package/dist/kit/builder/data-table/components/DataTablePagination.d.ts.map +0 -1
  102. package/dist/kit/builder/data-table/components/DataTableViewOptions.d.ts.map +0 -1
  103. package/dist/kit/builder/data-table/index.d.ts.map +0 -1
  104. package/dist/kit/builder/data-table/types.d.ts.map +0 -1
  105. package/dist/kit/builder/data-table/utils/dotAccessor.d.ts.map +0 -1
  106. package/dist/kit/builder/dialog/index.d.ts.map +0 -1
  107. package/dist/kit/builder/dialog/provider.d.ts.map +0 -1
  108. package/dist/kit/builder/form/components/FormBuilder.d.ts.map +0 -1
  109. package/dist/kit/builder/form/components/FormBuilderActions.d.ts.map +0 -1
  110. package/dist/kit/builder/form/components/FormBuilderContext.d.ts.map +0 -1
  111. package/dist/kit/builder/form/components/FormBuilderField.d.ts.map +0 -1
  112. package/dist/kit/builder/form/components/fields/ArrayField.d.ts.map +0 -1
  113. package/dist/kit/builder/form/components/fields/AutocompleteField.d.ts.map +0 -1
  114. package/dist/kit/builder/form/components/fields/CheckboxField.d.ts.map +0 -1
  115. package/dist/kit/builder/form/components/fields/DateField.d.ts.map +0 -1
  116. package/dist/kit/builder/form/components/fields/DatePickerField.d.ts.map +0 -1
  117. package/dist/kit/builder/form/components/fields/DateRangePickerField.d.ts.map +0 -1
  118. package/dist/kit/builder/form/components/fields/DateTimePickerField.d.ts.map +0 -1
  119. package/dist/kit/builder/form/components/fields/DateTimeRangePickerField.d.ts.map +0 -1
  120. package/dist/kit/builder/form/components/fields/FileField.d.ts.map +0 -1
  121. package/dist/kit/builder/form/components/fields/MonthPickerField.d.ts.map +0 -1
  122. package/dist/kit/builder/form/components/fields/MonthRangePickerField.d.ts.map +0 -1
  123. package/dist/kit/builder/form/components/fields/NumberField.d.ts.map +0 -1
  124. package/dist/kit/builder/form/components/fields/ObjectField.d.ts.map +0 -1
  125. package/dist/kit/builder/form/components/fields/RadioField.d.ts.map +0 -1
  126. package/dist/kit/builder/form/components/fields/SelectField.d.ts.map +0 -1
  127. package/dist/kit/builder/form/components/fields/SwitchField.d.ts.map +0 -1
  128. package/dist/kit/builder/form/components/fields/TextField.d.ts.map +0 -1
  129. package/dist/kit/builder/form/components/fields/TextareaField.d.ts.map +0 -1
  130. package/dist/kit/builder/form/components/fields/TimePickerField.d.ts.map +0 -1
  131. package/dist/kit/builder/form/components/fields/TimeRangePickerField.d.ts.map +0 -1
  132. package/dist/kit/builder/form/components/fields/index.d.ts.map +0 -1
  133. package/dist/kit/builder/form/components/fields/types.d.ts.map +0 -1
  134. package/dist/kit/builder/form/components/index.d.ts.map +0 -1
  135. package/dist/kit/builder/form/components/sectionNodes.d.ts.map +0 -1
  136. package/dist/kit/builder/form/hooks/useFormBuilder.d.ts.map +0 -1
  137. package/dist/kit/builder/form/index.d.ts.map +0 -1
  138. package/dist/kit/builder/form/types.d.ts.map +0 -1
  139. package/dist/kit/builder/form/utils/common-forms.d.ts.map +0 -1
  140. package/dist/kit/builder/form/utils/dependencies.d.ts.map +0 -1
  141. package/dist/kit/builder/form/utils/field-factories.d.ts.map +0 -1
  142. package/dist/kit/builder/form/utils/index.d.ts.map +0 -1
  143. package/dist/kit/builder/form/utils/section-factories.d.ts.map +0 -1
  144. package/dist/kit/builder/form/utils/transformers.d.ts.map +0 -1
  145. package/dist/kit/builder/form/utils/validations.d.ts.map +0 -1
  146. package/dist/kit/builder/form/utils/validators.d.ts.map +0 -1
  147. package/dist/kit/builder/page/Page.d.ts.map +0 -1
  148. package/dist/kit/builder/page/PageBackButton.d.ts.map +0 -1
  149. package/dist/kit/builder/page/index.d.ts.map +0 -1
  150. package/dist/kit/builder/section/SectionBuilder.d.ts.map +0 -1
  151. package/dist/kit/builder/section/SectionContainer.d.ts.map +0 -1
  152. package/dist/kit/builder/section/index.d.ts.map +0 -1
  153. package/dist/kit/builder/section/types.d.ts.map +0 -1
  154. package/dist/kit/builder/stack-dialog/context.d.ts.map +0 -1
  155. package/dist/kit/builder/stack-dialog/hooks.d.ts.map +0 -1
  156. package/dist/kit/builder/stack-dialog/index.d.ts.map +0 -1
  157. package/dist/kit/builder/stack-dialog/provider.d.ts.map +0 -1
  158. package/dist/kit/builder/stack-dialog/renderer.d.ts.map +0 -1
  159. package/dist/kit/builder/stack-dialog/types.d.ts.map +0 -1
  160. package/dist/kit/components/autocomplete/Autocomplete.d.ts.map +0 -1
  161. package/dist/kit/components/autocomplete/index.d.ts.map +0 -1
  162. package/dist/kit/components/autocomplete/types.d.ts.map +0 -1
  163. package/dist/kit/components/data-table-headers/DataTableHeader.d.ts.map +0 -1
  164. package/dist/kit/components/data-table-headers/DebouncedFilterField.d.ts.map +0 -1
  165. package/dist/kit/components/data-table-headers/FilterFieldRenderer.d.ts.map +0 -1
  166. package/dist/kit/components/data-table-headers/index.d.ts.map +0 -1
  167. package/dist/kit/components/data-table-headers/types.d.ts.map +0 -1
  168. package/dist/kit/components/data-table-headers/urlSerialization.d.ts.map +0 -1
  169. package/dist/kit/components/data-table-headers/useDataTableHeaderUrl.d.ts.map +0 -1
  170. package/dist/kit/components/datepicker/DatePicker.d.ts.map +0 -1
  171. package/dist/kit/components/datepicker/DateRangePicker.d.ts.map +0 -1
  172. package/dist/kit/components/datepicker/index.d.ts.map +0 -1
  173. package/dist/kit/components/datetimepicker/DateTimePicker.d.ts.map +0 -1
  174. package/dist/kit/components/datetimepicker/DateTimeRangePicker.d.ts.map +0 -1
  175. package/dist/kit/components/datetimepicker/index.d.ts.map +0 -1
  176. package/dist/kit/components/fileuploader/FileUploader.d.ts.map +0 -1
  177. package/dist/kit/components/fileuploader/image-preprocess.d.ts.map +0 -1
  178. package/dist/kit/components/fileuploader/index.d.ts.map +0 -1
  179. package/dist/kit/components/fileuploader/types.d.ts.map +0 -1
  180. package/dist/kit/components/forminfo/FormInfoError.d.ts.map +0 -1
  181. package/dist/kit/components/forminfo/index.d.ts.map +0 -1
  182. package/dist/kit/components/info-tooltip/InfoTooltip.d.ts.map +0 -1
  183. package/dist/kit/components/keyboard/Keyboard.d.ts.map +0 -1
  184. package/dist/kit/components/keyboard/index.d.ts.map +0 -1
  185. package/dist/kit/components/login/Login.d.ts.map +0 -1
  186. package/dist/kit/components/login/index.d.ts.map +0 -1
  187. package/dist/kit/components/monthpicker/MonthInput.d.ts.map +0 -1
  188. package/dist/kit/components/monthpicker/MonthPicker.d.ts.map +0 -1
  189. package/dist/kit/components/monthpicker/MonthRangeInput.d.ts.map +0 -1
  190. package/dist/kit/components/monthpicker/MonthRangePicker.d.ts.map +0 -1
  191. package/dist/kit/components/numpad/Numpad.d.ts.map +0 -1
  192. package/dist/kit/components/numpad/index.d.ts.map +0 -1
  193. package/dist/kit/components/timepicker/TimePicker.d.ts.map +0 -1
  194. package/dist/kit/components/timepicker/TimeRangePicker.d.ts.map +0 -1
  195. package/dist/kit/components/timepicker/index.d.ts.map +0 -1
  196. package/dist/kit/layouts/admin/components/AdminLayout.d.ts.map +0 -1
  197. package/dist/kit/layouts/admin/components/ThemeToggle.d.ts.map +0 -1
  198. package/dist/kit/layouts/admin/hooks/menu.d.ts.map +0 -1
  199. package/dist/kit/layouts/admin/providers/AdminMenuProvider.d.ts.map +0 -1
  200. package/dist/kit/layouts/admin/types/index.d.ts.map +0 -1
  201. package/dist/kit/providers/ThemeProvider.d.ts.map +0 -1
  202. package/dist/shadcn/hooks/use-mobile.d.ts.map +0 -1
  203. package/dist/shadcn/lib/utils.d.ts.map +0 -1
  204. package/dist/shadcn/ui/accordion.d.ts.map +0 -1
  205. package/dist/shadcn/ui/alert-dialog.d.ts.map +0 -1
  206. package/dist/shadcn/ui/alert.d.ts.map +0 -1
  207. package/dist/shadcn/ui/aspect-ratio.d.ts.map +0 -1
  208. package/dist/shadcn/ui/avatar.d.ts.map +0 -1
  209. package/dist/shadcn/ui/badge.d.ts.map +0 -1
  210. package/dist/shadcn/ui/breadcrumb.d.ts.map +0 -1
  211. package/dist/shadcn/ui/button.d.ts.map +0 -1
  212. package/dist/shadcn/ui/calendar.d.ts.map +0 -1
  213. package/dist/shadcn/ui/card.d.ts.map +0 -1
  214. package/dist/shadcn/ui/carousel.d.ts.map +0 -1
  215. package/dist/shadcn/ui/chart.d.ts.map +0 -1
  216. package/dist/shadcn/ui/checkbox.d.ts.map +0 -1
  217. package/dist/shadcn/ui/collapsible.d.ts.map +0 -1
  218. package/dist/shadcn/ui/command.d.ts.map +0 -1
  219. package/dist/shadcn/ui/context-menu.d.ts.map +0 -1
  220. package/dist/shadcn/ui/dialog.d.ts.map +0 -1
  221. package/dist/shadcn/ui/drawer.d.ts.map +0 -1
  222. package/dist/shadcn/ui/dropdown-menu.d.ts.map +0 -1
  223. package/dist/shadcn/ui/form.d.ts.map +0 -1
  224. package/dist/shadcn/ui/hover-card.d.ts.map +0 -1
  225. package/dist/shadcn/ui/input-otp.d.ts.map +0 -1
  226. package/dist/shadcn/ui/input.d.ts.map +0 -1
  227. package/dist/shadcn/ui/label.d.ts.map +0 -1
  228. package/dist/shadcn/ui/menubar.d.ts.map +0 -1
  229. package/dist/shadcn/ui/navigation-menu.d.ts.map +0 -1
  230. package/dist/shadcn/ui/pagination.d.ts.map +0 -1
  231. package/dist/shadcn/ui/popover.d.ts.map +0 -1
  232. package/dist/shadcn/ui/progress.d.ts.map +0 -1
  233. package/dist/shadcn/ui/radio-group.d.ts.map +0 -1
  234. package/dist/shadcn/ui/resizable.d.ts.map +0 -1
  235. package/dist/shadcn/ui/scroll-area.d.ts.map +0 -1
  236. package/dist/shadcn/ui/select.d.ts.map +0 -1
  237. package/dist/shadcn/ui/separator.d.ts.map +0 -1
  238. package/dist/shadcn/ui/sheet.d.ts.map +0 -1
  239. package/dist/shadcn/ui/sidebar.d.ts.map +0 -1
  240. package/dist/shadcn/ui/skeleton.d.ts.map +0 -1
  241. package/dist/shadcn/ui/slider.d.ts.map +0 -1
  242. package/dist/shadcn/ui/sonner.d.ts.map +0 -1
  243. package/dist/shadcn/ui/switch.d.ts.map +0 -1
  244. package/dist/shadcn/ui/table.d.ts.map +0 -1
  245. package/dist/shadcn/ui/tabs.d.ts.map +0 -1
  246. package/dist/shadcn/ui/textarea.d.ts.map +0 -1
  247. package/dist/shadcn/ui/toggle-group.d.ts.map +0 -1
  248. package/dist/shadcn/ui/toggle.d.ts.map +0 -1
  249. package/dist/shadcn/ui/tooltip.d.ts.map +0 -1
  250. package/src/index.ts +0 -100
  251. package/src/kit/builder/auth/components/Can.tsx +0 -27
  252. package/src/kit/builder/auth/components/RequireAuth.tsx +0 -78
  253. package/src/kit/builder/auth/components/ShowWhenAuthenticated.tsx +0 -10
  254. package/src/kit/builder/auth/components/ShowWhenError.tsx +0 -10
  255. package/src/kit/builder/auth/components/ShowWhenLoading.tsx +0 -10
  256. package/src/kit/builder/auth/components/ShowWhenUnauthenticated.tsx +0 -10
  257. package/src/kit/builder/auth/components/withPermission.tsx +0 -23
  258. package/src/kit/builder/auth/hooks/action-hooks.ts +0 -34
  259. package/src/kit/builder/auth/hooks/core-hooks.ts +0 -65
  260. package/src/kit/builder/auth/hooks/index.ts +0 -4
  261. package/src/kit/builder/auth/hooks/permission-hooks.ts +0 -43
  262. package/src/kit/builder/auth/hooks/token-hooks.ts +0 -25
  263. package/src/kit/builder/auth/index.ts +0 -132
  264. package/src/kit/builder/auth/providers/AuthProvider.tsx +0 -131
  265. package/src/kit/builder/auth/types/adapter-config.ts +0 -44
  266. package/src/kit/builder/auth/types/adapter.ts +0 -132
  267. package/src/kit/builder/auth/types/core.ts +0 -27
  268. package/src/kit/builder/auth/types/index.ts +0 -9
  269. package/src/kit/builder/auth/types/middleware.ts +0 -20
  270. package/src/kit/builder/auth/types/permissions.ts +0 -23
  271. package/src/kit/builder/auth/types/state.ts +0 -16
  272. package/src/kit/builder/auth/types/storage.ts +0 -21
  273. package/src/kit/builder/auth/types/token-manager.ts +0 -9
  274. package/src/kit/builder/auth/types/utils.ts +0 -55
  275. package/src/kit/builder/auth/utils/auth-adapter.ts +0 -437
  276. package/src/kit/builder/auth/utils/client-adapters/apollo-link.ts +0 -30
  277. package/src/kit/builder/auth/utils/client-adapters/axios.ts +0 -61
  278. package/src/kit/builder/auth/utils/client-adapters/fetch.ts +0 -48
  279. package/src/kit/builder/auth/utils/client-adapters/graphql.ts +0 -60
  280. package/src/kit/builder/auth/utils/client-adapters/index.ts +0 -6
  281. package/src/kit/builder/auth/utils/client-adapters/rest.ts +0 -60
  282. package/src/kit/builder/auth/utils/client-adapters/urql-exchange.ts +0 -76
  283. package/src/kit/builder/auth/utils/permission-checker.ts +0 -150
  284. package/src/kit/builder/auth/utils/storage/browser.ts +0 -99
  285. package/src/kit/builder/auth/utils/storage/cookie.ts +0 -116
  286. package/src/kit/builder/auth/utils/storage/encryption.ts +0 -80
  287. package/src/kit/builder/auth/utils/storage/env.ts +0 -2
  288. package/src/kit/builder/auth/utils/storage/factory.ts +0 -37
  289. package/src/kit/builder/auth/utils/storage/index.ts +0 -6
  290. package/src/kit/builder/auth/utils/storage/memory.ts +0 -15
  291. package/src/kit/builder/auth/utils/token-manager.ts +0 -55
  292. package/src/kit/builder/data-table/components/DataTable.tsx +0 -662
  293. package/src/kit/builder/data-table/components/DataTableColumnHeader.tsx +0 -67
  294. package/src/kit/builder/data-table/components/DataTableFilterPanel.tsx +0 -160
  295. package/src/kit/builder/data-table/components/DataTablePagination.tsx +0 -135
  296. package/src/kit/builder/data-table/components/DataTableViewOptions.tsx +0 -51
  297. package/src/kit/builder/data-table/index.ts +0 -6
  298. package/src/kit/builder/data-table/types.ts +0 -44
  299. package/src/kit/builder/data-table/utils/dotAccessor.ts +0 -6
  300. package/src/kit/builder/dialog/index.ts +0 -6
  301. package/src/kit/builder/dialog/provider.tsx +0 -170
  302. package/src/kit/builder/form/components/FormBuilder.tsx +0 -333
  303. package/src/kit/builder/form/components/FormBuilderActions.tsx +0 -78
  304. package/src/kit/builder/form/components/FormBuilderContext.tsx +0 -52
  305. package/src/kit/builder/form/components/FormBuilderField.tsx +0 -476
  306. package/src/kit/builder/form/components/fields/ArrayField.tsx +0 -312
  307. package/src/kit/builder/form/components/fields/AutocompleteField.tsx +0 -99
  308. package/src/kit/builder/form/components/fields/CheckboxField.tsx +0 -78
  309. package/src/kit/builder/form/components/fields/DateField.tsx +0 -55
  310. package/src/kit/builder/form/components/fields/DatePickerField.tsx +0 -48
  311. package/src/kit/builder/form/components/fields/DateRangePickerField.tsx +0 -72
  312. package/src/kit/builder/form/components/fields/DateTimePickerField.tsx +0 -55
  313. package/src/kit/builder/form/components/fields/DateTimeRangePickerField.tsx +0 -65
  314. package/src/kit/builder/form/components/fields/FileField.tsx +0 -38
  315. package/src/kit/builder/form/components/fields/MonthPickerField.tsx +0 -34
  316. package/src/kit/builder/form/components/fields/MonthRangePickerField.tsx +0 -42
  317. package/src/kit/builder/form/components/fields/NumberField.tsx +0 -88
  318. package/src/kit/builder/form/components/fields/ObjectField.tsx +0 -35
  319. package/src/kit/builder/form/components/fields/RadioField.tsx +0 -48
  320. package/src/kit/builder/form/components/fields/SelectField.tsx +0 -47
  321. package/src/kit/builder/form/components/fields/SwitchField.tsx +0 -76
  322. package/src/kit/builder/form/components/fields/TextField.tsx +0 -26
  323. package/src/kit/builder/form/components/fields/TextareaField.tsx +0 -21
  324. package/src/kit/builder/form/components/fields/TimePickerField.tsx +0 -36
  325. package/src/kit/builder/form/components/fields/TimeRangePickerField.tsx +0 -44
  326. package/src/kit/builder/form/components/fields/index.ts +0 -21
  327. package/src/kit/builder/form/components/fields/types.ts +0 -18
  328. package/src/kit/builder/form/components/index.ts +0 -3
  329. package/src/kit/builder/form/components/sectionNodes.tsx +0 -148
  330. package/src/kit/builder/form/hooks/useFormBuilder.ts +0 -457
  331. package/src/kit/builder/form/index.ts +0 -4
  332. package/src/kit/builder/form/types.ts +0 -294
  333. package/src/kit/builder/form/utils/common-forms.ts +0 -68
  334. package/src/kit/builder/form/utils/dependencies.ts +0 -56
  335. package/src/kit/builder/form/utils/field-factories.ts +0 -177
  336. package/src/kit/builder/form/utils/index.ts +0 -17
  337. package/src/kit/builder/form/utils/section-factories.ts +0 -38
  338. package/src/kit/builder/form/utils/transformers.ts +0 -100
  339. package/src/kit/builder/form/utils/validations.ts +0 -22
  340. package/src/kit/builder/form/utils/validators.ts +0 -20
  341. package/src/kit/builder/page/Page.tsx +0 -205
  342. package/src/kit/builder/page/PageBackButton.tsx +0 -52
  343. package/src/kit/builder/page/index.ts +0 -1
  344. package/src/kit/builder/section/SectionBuilder.tsx +0 -443
  345. package/src/kit/builder/section/SectionContainer.tsx +0 -85
  346. package/src/kit/builder/section/index.ts +0 -2
  347. package/src/kit/builder/section/types.ts +0 -83
  348. package/src/kit/builder/stack-dialog/context.ts +0 -15
  349. package/src/kit/builder/stack-dialog/hooks.ts +0 -13
  350. package/src/kit/builder/stack-dialog/index.ts +0 -12
  351. package/src/kit/builder/stack-dialog/provider.tsx +0 -51
  352. package/src/kit/builder/stack-dialog/renderer.tsx +0 -36
  353. package/src/kit/builder/stack-dialog/types.ts +0 -34
  354. package/src/kit/components/autocomplete/Autocomplete.tsx +0 -732
  355. package/src/kit/components/autocomplete/index.ts +0 -3
  356. package/src/kit/components/autocomplete/types.ts +0 -27
  357. package/src/kit/components/data-table-headers/DataTableHeader.tsx +0 -158
  358. package/src/kit/components/data-table-headers/DebouncedFilterField.tsx +0 -83
  359. package/src/kit/components/data-table-headers/FilterFieldRenderer.tsx +0 -194
  360. package/src/kit/components/data-table-headers/index.ts +0 -6
  361. package/src/kit/components/data-table-headers/types.ts +0 -89
  362. package/src/kit/components/data-table-headers/urlSerialization.ts +0 -173
  363. package/src/kit/components/data-table-headers/useDataTableHeaderUrl.ts +0 -107
  364. package/src/kit/components/datepicker/DatePicker.tsx +0 -173
  365. package/src/kit/components/datepicker/DateRangePicker.tsx +0 -526
  366. package/src/kit/components/datepicker/index.ts +0 -2
  367. package/src/kit/components/datetimepicker/DateTimePicker.tsx +0 -420
  368. package/src/kit/components/datetimepicker/DateTimeRangePicker.tsx +0 -676
  369. package/src/kit/components/datetimepicker/index.ts +0 -2
  370. package/src/kit/components/fileuploader/FileUploader.tsx +0 -880
  371. package/src/kit/components/fileuploader/image-preprocess.ts +0 -253
  372. package/src/kit/components/fileuploader/index.ts +0 -4
  373. package/src/kit/components/fileuploader/types.ts +0 -94
  374. package/src/kit/components/forminfo/FormInfoError.tsx +0 -135
  375. package/src/kit/components/forminfo/index.ts +0 -1
  376. package/src/kit/components/info-tooltip/InfoTooltip.tsx +0 -18
  377. package/src/kit/components/keyboard/Keyboard.tsx +0 -916
  378. package/src/kit/components/keyboard/index.ts +0 -4
  379. package/src/kit/components/login/Login.tsx +0 -141
  380. package/src/kit/components/login/index.ts +0 -1
  381. package/src/kit/components/monthpicker/MonthInput.tsx +0 -131
  382. package/src/kit/components/monthpicker/MonthPicker.tsx +0 -224
  383. package/src/kit/components/monthpicker/MonthRangeInput.tsx +0 -153
  384. package/src/kit/components/monthpicker/MonthRangePicker.tsx +0 -409
  385. package/src/kit/components/numpad/Numpad.tsx +0 -377
  386. package/src/kit/components/numpad/index.ts +0 -4
  387. package/src/kit/components/timepicker/TimePicker.tsx +0 -319
  388. package/src/kit/components/timepicker/TimeRangePicker.tsx +0 -368
  389. package/src/kit/components/timepicker/index.ts +0 -2
  390. package/src/kit/layouts/admin/components/AdminLayout.tsx +0 -419
  391. package/src/kit/layouts/admin/components/ThemeToggle.tsx +0 -54
  392. package/src/kit/layouts/admin/hooks/menu.ts +0 -32
  393. package/src/kit/layouts/admin/providers/AdminMenuProvider.tsx +0 -78
  394. package/src/kit/layouts/admin/types/index.ts +0 -26
  395. package/src/kit/providers/ThemeProvider.tsx +0 -90
  396. package/src/kit/themes/base.css +0 -11
  397. package/src/kit/themes/clean-slate.css +0 -155
  398. package/src/kit/themes/default.css +0 -197
  399. package/src/kit/themes/minimal-modern.css +0 -155
  400. package/src/kit/themes/spotify.css +0 -164
  401. package/src/shadcn/hooks/use-mobile.ts +0 -21
  402. package/src/shadcn/lib/utils.ts +0 -6
  403. package/src/shadcn/ui/accordion.tsx +0 -66
  404. package/src/shadcn/ui/alert-dialog.tsx +0 -157
  405. package/src/shadcn/ui/alert.tsx +0 -66
  406. package/src/shadcn/ui/aspect-ratio.tsx +0 -11
  407. package/src/shadcn/ui/avatar.tsx +0 -53
  408. package/src/shadcn/ui/badge.tsx +0 -46
  409. package/src/shadcn/ui/breadcrumb.tsx +0 -111
  410. package/src/shadcn/ui/button.tsx +0 -59
  411. package/src/shadcn/ui/calendar.tsx +0 -217
  412. package/src/shadcn/ui/card.tsx +0 -92
  413. package/src/shadcn/ui/carousel.tsx +0 -240
  414. package/src/shadcn/ui/chart.tsx +0 -353
  415. package/src/shadcn/ui/checkbox.tsx +0 -32
  416. package/src/shadcn/ui/collapsible.tsx +0 -33
  417. package/src/shadcn/ui/command.tsx +0 -184
  418. package/src/shadcn/ui/context-menu.tsx +0 -252
  419. package/src/shadcn/ui/dialog.tsx +0 -146
  420. package/src/shadcn/ui/drawer.tsx +0 -135
  421. package/src/shadcn/ui/dropdown-menu.tsx +0 -257
  422. package/src/shadcn/ui/form.tsx +0 -168
  423. package/src/shadcn/ui/hover-card.tsx +0 -44
  424. package/src/shadcn/ui/input-otp.tsx +0 -77
  425. package/src/shadcn/ui/input.tsx +0 -21
  426. package/src/shadcn/ui/label.tsx +0 -24
  427. package/src/shadcn/ui/menubar.tsx +0 -276
  428. package/src/shadcn/ui/navigation-menu.tsx +0 -168
  429. package/src/shadcn/ui/pagination.tsx +0 -128
  430. package/src/shadcn/ui/popover.tsx +0 -48
  431. package/src/shadcn/ui/progress.tsx +0 -31
  432. package/src/shadcn/ui/radio-group.tsx +0 -45
  433. package/src/shadcn/ui/resizable.tsx +0 -56
  434. package/src/shadcn/ui/scroll-area.tsx +0 -58
  435. package/src/shadcn/ui/select.tsx +0 -185
  436. package/src/shadcn/ui/separator.tsx +0 -28
  437. package/src/shadcn/ui/sheet.tsx +0 -139
  438. package/src/shadcn/ui/sidebar.tsx +0 -726
  439. package/src/shadcn/ui/skeleton.tsx +0 -13
  440. package/src/shadcn/ui/slider.tsx +0 -63
  441. package/src/shadcn/ui/sonner.tsx +0 -37
  442. package/src/shadcn/ui/switch.tsx +0 -31
  443. package/src/shadcn/ui/table.tsx +0 -134
  444. package/src/shadcn/ui/tabs.tsx +0 -66
  445. package/src/shadcn/ui/textarea.tsx +0 -18
  446. package/src/shadcn/ui/toggle-group.tsx +0 -73
  447. package/src/shadcn/ui/toggle.tsx +0 -47
  448. package/src/shadcn/ui/tooltip.tsx +0 -61
  449. package/src/stories/FileUploader.stories.tsx +0 -185
  450. package/src/stories/kit/builder/DataTable.Basic.stories.tsx +0 -71
  451. package/src/stories/kit/builder/DataTable.Filters.stories.tsx +0 -98
  452. package/src/stories/kit/builder/DataTable.Pagination.stories.tsx +0 -73
  453. package/src/stories/kit/builder/DataTable.SelectionAndActions.stories.tsx +0 -77
  454. package/src/stories/kit/builder/DataTable.Sorting.stories.tsx +0 -67
  455. package/src/stories/kit/builder/Dialog.stories.tsx +0 -90
  456. package/src/stories/kit/builder/Form.ArrayLayouts.stories.tsx +0 -177
  457. package/src/stories/kit/builder/Form.Autocomplete.stories.tsx +0 -220
  458. package/src/stories/kit/builder/Form.Basic.stories.tsx +0 -79
  459. package/src/stories/kit/builder/Form.Complex.stories.tsx +0 -569
  460. package/src/stories/kit/builder/Form.DateTime.stories.tsx +0 -70
  461. package/src/stories/kit/builder/Form.Dynamic.stories.tsx +0 -926
  462. package/src/stories/kit/builder/Form.Files.stories.tsx +0 -136
  463. package/src/stories/kit/builder/Form.MultipleFormBuilder.stories.tsx +0 -377
  464. package/src/stories/kit/builder/Form.Pickers.stories.tsx +0 -75
  465. package/src/stories/kit/builder/Form.Simple.stories.tsx +0 -91
  466. package/src/stories/kit/builder/Form.Time.stories.tsx +0 -68
  467. package/src/stories/kit/builder/Page.stories.tsx +0 -115
  468. package/src/stories/kit/builder/Section.stories.tsx +0 -282
  469. package/src/stories/kit/components/Autocomplete.stories.tsx +0 -313
  470. package/src/stories/kit/components/DatePicker.stories.tsx +0 -195
  471. package/src/stories/kit/components/DateRangePicker.stories.tsx +0 -195
  472. package/src/stories/kit/components/Keyboard.stories.tsx +0 -263
  473. package/src/stories/kit/components/Login.stories.tsx +0 -167
  474. package/src/stories/kit/components/MonthPicker.stories.tsx +0 -100
  475. package/src/stories/kit/components/MonthRangePicker.stories.tsx +0 -117
  476. package/src/stories/kit/components/Numpad.stories.tsx +0 -195
  477. package/src/stories/kit/components/TimePicker.stories.tsx +0 -71
  478. package/src/stories/kit/components/TimeRangePicker.stories.tsx +0 -43
  479. package/src/stories/kit/layouts/admin/AdminLayout.Basic.stories.tsx +0 -118
  480. package/src/stories/kit/layouts/admin/AdminLayout.Collapsible.stories.tsx +0 -81
  481. package/src/stories/kit/layouts/admin/AdminLayout.Complex.stories.tsx +0 -251
  482. package/src/stories/kit/layouts/admin/AdminLayout.CustomSidebarHeaderComponent.stories.tsx +0 -80
  483. package/src/stories/kit/layouts/admin/AdminLayout.CustomSidebarTitleAndIcon.stories.tsx +0 -70
  484. package/src/stories/kit/layouts/admin/AdminLayout.HeaderSlots.stories.tsx +0 -87
  485. package/src/stories/shadcn/ui/Accordion.stories.tsx +0 -117
  486. package/src/stories/shadcn/ui/Alert.stories.tsx +0 -36
  487. package/src/stories/shadcn/ui/AlertDialog.stories.tsx +0 -73
  488. package/src/stories/shadcn/ui/AspectRatio.stories.tsx +0 -58
  489. package/src/stories/shadcn/ui/Avatar.stories.tsx +0 -26
  490. package/src/stories/shadcn/ui/Badge.stories.tsx +0 -28
  491. package/src/stories/shadcn/ui/Breadcrumb.stories.tsx +0 -47
  492. package/src/stories/shadcn/ui/Button.stories.tsx +0 -51
  493. package/src/stories/shadcn/ui/Calendar.stories.tsx +0 -33
  494. package/src/stories/shadcn/ui/Card.stories.tsx +0 -39
  495. package/src/stories/shadcn/ui/Carousel.stories.tsx +0 -37
  496. package/src/stories/shadcn/ui/Chart.stories.tsx +0 -72
  497. package/src/stories/shadcn/ui/Checkbox.stories.tsx +0 -64
  498. package/src/stories/shadcn/ui/Collapsible.stories.tsx +0 -40
  499. package/src/stories/shadcn/ui/Command.stories.tsx +0 -53
  500. package/src/stories/shadcn/ui/ContextMenu.stories.tsx +0 -67
  501. package/src/stories/shadcn/ui/Dialog.stories.tsx +0 -45
  502. package/src/stories/shadcn/ui/Drawer.stories.tsx +0 -49
  503. package/src/stories/shadcn/ui/DropdownMenu.stories.tsx +0 -75
  504. package/src/stories/shadcn/ui/Form.stories.tsx +0 -93
  505. package/src/stories/shadcn/ui/HoverCard.stories.tsx +0 -43
  506. package/src/stories/shadcn/ui/Input.stories.tsx +0 -41
  507. package/src/stories/shadcn/ui/InputOtp.stories.tsx +0 -39
  508. package/src/stories/shadcn/ui/Label.stories.tsx +0 -29
  509. package/src/stories/shadcn/ui/Menubar.stories.tsx +0 -87
  510. package/src/stories/shadcn/ui/NavigationMenu.stories.tsx +0 -78
  511. package/src/stories/shadcn/ui/Pagination.stories.tsx +0 -51
  512. package/src/stories/shadcn/ui/Popover.stories.tsx +0 -53
  513. package/src/stories/shadcn/ui/Progress.stories.tsx +0 -30
  514. package/src/stories/shadcn/ui/RadioGroup.stories.tsx +0 -31
  515. package/src/stories/shadcn/ui/Resizable.stories.tsx +0 -55
  516. package/src/stories/shadcn/ui/ScrollArea.stories.tsx +0 -84
  517. package/src/stories/shadcn/ui/Select.stories.tsx +0 -61
  518. package/src/stories/shadcn/ui/Separator.stories.tsx +0 -35
  519. package/src/stories/shadcn/ui/Sheet.stories.tsx +0 -48
  520. package/src/stories/shadcn/ui/Sidebar.stories.tsx +0 -131
  521. package/src/stories/shadcn/ui/Skeleton.stories.tsx +0 -23
  522. package/src/stories/shadcn/ui/Slider.stories.tsx +0 -21
  523. package/src/stories/shadcn/ui/Sonner.stories.tsx +0 -49
  524. package/src/stories/shadcn/ui/Switch.stories.tsx +0 -28
  525. package/src/stories/shadcn/ui/Table.stories.tsx +0 -374
  526. package/src/stories/shadcn/ui/Tabs.stories.tsx +0 -31
  527. package/src/stories/shadcn/ui/Textarea.stories.tsx +0 -42
  528. package/src/stories/shadcn/ui/Toggle.stories.tsx +0 -44
  529. package/src/stories/shadcn/ui/ToggleGroup.stories.tsx +0 -28
  530. package/src/stories/shadcn/ui/Tooltip.stories.tsx +0 -30
  531. package/tsconfig.json +0 -20
  532. package/tsconfig.lib.json +0 -52
  533. package/tsconfig.spec.json +0 -38
  534. package/tsconfig.tsbuildinfo +0 -1
  535. package/vite.config.ts +0 -93
@@ -1,27 +0,0 @@
1
- import type { CanProps } from '../types';
2
- import { useCan } from '../hooks';
3
-
4
- /**
5
- * Component for conditional rendering based on permissions.
6
- *
7
- * @example
8
- * ```tsx
9
- * <Can permissions="post:edit" fallback={<ReadOnlyView />}>
10
- * <EditButton />
11
- * </Can>
12
- * ```
13
- */
14
- export function Can<
15
- TRole extends string = string,
16
- TPermission extends string = string,
17
- >({
18
- children,
19
- fallback = null,
20
- roles,
21
- permissions,
22
- requireAll = true,
23
- }: CanProps<TRole, TPermission>) {
24
- const allowed = useCan({ roles, permissions, requireAll });
25
- if (!allowed) return fallback;
26
- return children;
27
- }
@@ -1,78 +0,0 @@
1
- import type { RequireAuthProps } from '../types';
2
- import { useAuthContext } from '../providers/AuthProvider';
3
-
4
- /**
5
- * Component that requires authentication
6
- * Optionally checks for specific roles and permissions
7
- *
8
- * @example
9
- * ```tsx
10
- * // Basic authentication check
11
- * <RequireAuth fallback={<Login />}>
12
- * <Dashboard />
13
- * </RequireAuth>
14
- *
15
- * // With role check
16
- * <RequireAuth
17
- * roles="admin"
18
- * fallback={<Forbidden />}
19
- * loadingFallback={<Spinner />}
20
- * >
21
- * <AdminPanel />
22
- * </RequireAuth>
23
- *
24
- * // With permission check
25
- * <RequireAuth
26
- * permissions={['post:edit', 'post:delete']}
27
- * fallback={<Forbidden />}
28
- * >
29
- * <PostEditor />
30
- * </RequireAuth>
31
- *
32
- * // Complex rule
33
- * <RequireAuth
34
- * roles={['admin', 'moderator']}
35
- * permissions={{
36
- * operator: 'OR',
37
- * permissions: ['post:edit', 'post:delete']
38
- * }}
39
- * requireAll={false}
40
- * fallback={<Forbidden />}
41
- * >
42
- * <ContentManager />
43
- * </RequireAuth>
44
- * ```
45
- */
46
- export function RequireAuth<
47
- TRole extends string = string,
48
- TPermission extends string = string,
49
- >({
50
- children,
51
- fallback = null,
52
- loadingFallback = null,
53
- roles,
54
- permissions,
55
- requireAll = true,
56
- }: RequireAuthProps<TRole, TPermission>) {
57
- const { status, can } = useAuthContext();
58
-
59
- if (status === 'loading' || status === 'idle') {
60
- return loadingFallback;
61
- }
62
-
63
- if (status !== 'authenticated') {
64
- return fallback;
65
- }
66
-
67
- if (!roles && !permissions) {
68
- return children;
69
- }
70
-
71
- const allowed = can({ roles, permissions, requireAll });
72
-
73
- if (!allowed) {
74
- return fallback;
75
- }
76
-
77
- return children;
78
- }
@@ -1,10 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import { useAuthContext } from '../providers/AuthProvider';
3
-
4
- /**
5
- * Component that shows children only when authenticated.
6
- */
7
- export function ShowWhenAuthenticated({ children }: { children: ReactNode }) {
8
- const { status } = useAuthContext();
9
- return status === 'authenticated' ? children : null;
10
- }
@@ -1,10 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import { useAuthContext } from '../providers/AuthProvider';
3
-
4
- /**
5
- * Component that shows children only when there's an error.
6
- */
7
- export function ShowWhenError({ children }: { children: ReactNode }) {
8
- const { status } = useAuthContext();
9
- return status === 'error' ? children : null;
10
- }
@@ -1,10 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import { useAuthContext } from '../providers/AuthProvider';
3
-
4
- /**
5
- * Component that shows children only while loading.
6
- */
7
- export function ShowWhenLoading({ children }: { children: ReactNode }) {
8
- const { status } = useAuthContext();
9
- return status === 'loading' ? children : null;
10
- }
@@ -1,10 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import { useAuthContext } from '../providers/AuthProvider';
3
-
4
- /**
5
- * Component that shows children only when NOT authenticated.
6
- */
7
- export function ShowWhenUnauthenticated({ children }: { children: ReactNode }) {
8
- const { status } = useAuthContext();
9
- return status === 'unauthenticated' ? children : null;
10
- }
@@ -1,23 +0,0 @@
1
- import type { ComponentType } from 'react';
2
- import type { WithPermissionOptions } from '../types';
3
- import { useCan } from '../hooks';
4
-
5
- /**
6
- * Higher-order component that wraps a component with permission checks.
7
- */
8
- export function withPermission<
9
- TRole extends string = string,
10
- TPermission extends string = string,
11
- TProps extends Record<string, unknown> = Record<string, unknown>,
12
- >(
13
- Component: ComponentType<TProps>,
14
- options: WithPermissionOptions<TRole, TPermission>,
15
- ): ComponentType<TProps> {
16
- const WithPermissionWrapper = (props: TProps) => {
17
- const allowed = useCan(options);
18
- if (!allowed) return null;
19
- return <Component {...props} />;
20
- };
21
- WithPermissionWrapper.displayName = `WithPermission(${Component.displayName ?? Component.name ?? 'Component'})`;
22
- return WithPermissionWrapper as ComponentType<TProps>;
23
- }
@@ -1,34 +0,0 @@
1
- import type { AuthSession } from '../types';
2
- import { useAuthContext } from '../providers/AuthProvider';
3
-
4
- /**
5
- * Hook to get the login function.
6
- */
7
- export function useLogin<TCredentials = unknown>() {
8
- const { login } = useAuthContext();
9
- return login as ((credentials: TCredentials) => Promise<unknown>) | undefined;
10
- }
11
-
12
- /**
13
- * Hook to get the logout function.
14
- */
15
- export function useLogout() {
16
- const { logout } = useAuthContext();
17
- return logout;
18
- }
19
-
20
- /**
21
- * Hook to get the refresh function.
22
- */
23
- export function useRefresh() {
24
- const { refresh } = useAuthContext();
25
- return refresh;
26
- }
27
-
28
- /**
29
- * Hook to get the setSession function.
30
- */
31
- export function useSetSession<TSession extends AuthSession>() {
32
- const { setSession } = useAuthContext();
33
- return setSession as (session: TSession | null) => Promise<unknown>;
34
- }
@@ -1,65 +0,0 @@
1
- import type { AuthSession } from '../types';
2
- import { useAuthContext } from '../providers/AuthProvider';
3
-
4
- /**
5
- * Hook to access the entire auth context
6
- */
7
- export function useAuth() {
8
- return useAuthContext();
9
- }
10
-
11
- /**
12
- * Hook to get the current auth status
13
- */
14
- export function useAuthStatus() {
15
- const { status } = useAuthContext();
16
- return status;
17
- }
18
-
19
- /**
20
- * Hook to check if user is authenticated
21
- */
22
- export function useIsAuthenticated() {
23
- const { status } = useAuthContext();
24
- return status === 'authenticated';
25
- }
26
-
27
- /**
28
- * Hook to get the current session
29
- */
30
- export function useAuthSession<TSession extends AuthSession>() {
31
- const { session } = useAuthContext();
32
- return session as TSession | null;
33
- }
34
-
35
- /**
36
- * Hook to get the current user
37
- */
38
- export function useAuthUser<TUser>() {
39
- const { user } = useAuthContext();
40
- return user as TUser | null;
41
- }
42
-
43
- /**
44
- * Hook to get user roles
45
- */
46
- export function useAuthRoles<TRole extends string = string>() {
47
- const { roles } = useAuthContext();
48
- return roles as TRole[];
49
- }
50
-
51
- /**
52
- * Hook to get user permissions
53
- */
54
- export function useAuthPermissions<TPermission extends string = string>() {
55
- const { permissions } = useAuthContext();
56
- return permissions as TPermission[];
57
- }
58
-
59
- /**
60
- * Hook to get authentication error
61
- */
62
- export function useAuthError() {
63
- const { error } = useAuthContext();
64
- return error;
65
- }
@@ -1,4 +0,0 @@
1
- export * from './core-hooks';
2
- export * from './permission-hooks';
3
- export * from './token-hooks';
4
- export * from './action-hooks';
@@ -1,43 +0,0 @@
1
- import type {
2
- PermissionPolicy,
3
- PermissionRule,
4
- WithPermissionOptions,
5
- } from '../types';
6
- import { useAuthContext } from '../providers/AuthProvider';
7
-
8
- /**
9
- * Hook to check if user has specific permission(s).
10
- */
11
- export function usePermission<TPermission extends string = string>(
12
- permission: TPermission | TPermission[] | PermissionPolicy<TPermission>,
13
- options?: { requireAll?: boolean },
14
- ) {
15
- const { hasPermission } = useAuthContext();
16
- return hasPermission(permission, options);
17
- }
18
-
19
- /**
20
- * Hook to check if user has specific role(s).
21
- */
22
- export function useRole<TRole extends string = string>(
23
- roles: TRole | TRole[],
24
- options?: { requireAll?: boolean },
25
- ) {
26
- const { hasRole } = useAuthContext();
27
- return hasRole(roles, options);
28
- }
29
-
30
- /**
31
- * Hook to check complex permission rules.
32
- */
33
- export function useCan<
34
- TRole extends string = string,
35
- TPermission extends string = string,
36
- >(
37
- rule:
38
- | WithPermissionOptions<TRole, TPermission>
39
- | PermissionRule<TRole, TPermission>,
40
- ) {
41
- const { can } = useAuthContext();
42
- return can(rule as PermissionRule<TRole, TPermission>);
43
- }
@@ -1,25 +0,0 @@
1
- import { useAuthContext } from '../providers/AuthProvider';
2
-
3
- /**
4
- * Hook to get the current auth token.
5
- */
6
- export function useAuthToken() {
7
- const { getToken } = useAuthContext();
8
- return getToken();
9
- }
10
-
11
- /**
12
- * Hook to check if token is expired.
13
- */
14
- export function useIsTokenExpired() {
15
- const { isTokenExpired } = useAuthContext();
16
- return isTokenExpired();
17
- }
18
-
19
- /**
20
- * Hook to get time until token expiry in milliseconds.
21
- */
22
- export function useTimeUntilExpiry() {
23
- const { getTimeUntilExpiry } = useAuthContext();
24
- return getTimeUntilExpiry();
25
- }
@@ -1,132 +0,0 @@
1
- // ============================================================================
2
- // Core
3
- // ============================================================================
4
-
5
- export { createAuthAdapter } from "./utils/auth-adapter";
6
- export { AuthProvider, useAuthContext } from "./providers/AuthProvider";
7
-
8
- // ============================================================================
9
- // Storage
10
- // ============================================================================
11
-
12
- export {
13
- createStorage,
14
- createMemoryStorage,
15
- createBrowserStorage,
16
- createCookieStorage,
17
- } from "./utils/storage";
18
-
19
- // ============================================================================
20
- // Utilities
21
- // ============================================================================
22
-
23
- export { createTokenManager } from "./utils/token-manager";
24
- export {
25
- expandPermissions,
26
- expandRoles,
27
- checkPermissions,
28
- checkRoles,
29
- evaluatePermissionRule,
30
- } from "./utils/permission-checker";
31
-
32
- // ============================================================================
33
- // Client Adapters
34
- // ============================================================================
35
-
36
- export {
37
- createGraphQLAuthAdapter,
38
- createRESTAuthAdapter,
39
- createAxiosAuthInterceptor,
40
- createAuthFetch,
41
- createApolloAuthLink,
42
- } from "./utils/client-adapters";
43
-
44
- export type {
45
- GraphQLClientAdapterOptions,
46
- RESTClientAdapterOptions,
47
- } from "./utils/client-adapters";
48
-
49
- // ============================================================================
50
- // Hooks
51
- // ============================================================================
52
-
53
- export {
54
- useAuth,
55
- useAuthStatus,
56
- useIsAuthenticated,
57
- useAuthSession,
58
- useAuthUser,
59
- useAuthRoles,
60
- useAuthPermissions,
61
- useAuthError,
62
- usePermission,
63
- useRole,
64
- useCan,
65
- useAuthToken,
66
- useIsTokenExpired,
67
- useTimeUntilExpiry,
68
- useLogin,
69
- useLogout,
70
- useRefresh,
71
- useSetSession,
72
- } from "./hooks";
73
-
74
- // ============================================================================
75
- // Components
76
- // ============================================================================
77
-
78
- export { RequireAuth } from "./components/RequireAuth";
79
- export { Can } from "./components/Can";
80
- export { withPermission } from "./components/withPermission";
81
- export { ShowWhenAuthenticated } from "./components/ShowWhenAuthenticated";
82
- export { ShowWhenUnauthenticated } from "./components/ShowWhenUnauthenticated";
83
- export { ShowWhenLoading } from "./components/ShowWhenLoading";
84
- export { ShowWhenError } from "./components/ShowWhenError";
85
-
86
- // ============================================================================
87
- // Types
88
- // ============================================================================
89
-
90
- export type {
91
- // Core types
92
- AuthStatus,
93
- TokenType,
94
- RefreshStrategy,
95
- AuthSession,
96
- // Permission types
97
- PermissionOperator,
98
- PermissionPolicy,
99
- PermissionRule,
100
- PermissionHierarchy,
101
- RoleHierarchy,
102
- // State types
103
- AuthAdapterState,
104
- AuthAdapterSubscriber,
105
- // Storage types
106
- AuthStorage,
107
- StorageType,
108
- StorageOptions,
109
- // Middleware types
110
- AuthMiddleware,
111
- // Token manager types
112
- TokenManager,
113
- // Adapter types
114
- AuthAdapterConfig,
115
- AuthAdapter,
116
- // Context types
117
- AuthContextValue,
118
- // Component prop types
119
- RequireAuthProps,
120
- CanProps,
121
- WithPermissionOptions,
122
- // Client adapter types
123
- GraphQLAuthClient,
124
- RESTAuthClient,
125
- ClientAdapter,
126
- // Utility types
127
- InferSession,
128
- InferUser,
129
- InferRole,
130
- InferPermission,
131
- InferCredentials,
132
- } from "./types";
@@ -1,131 +0,0 @@
1
- import {
2
- createContext,
3
- useContext,
4
- useEffect,
5
- useMemo,
6
- useSyncExternalStore,
7
- } from 'react';
8
- import type { ReactNode } from 'react';
9
- import type { AuthAdapter, AuthContextValue, AuthSession } from '../types';
10
-
11
- type AnyAuthContextValue = AuthContextValue<
12
- unknown,
13
- string,
14
- string,
15
- AuthSession<unknown, string, string>,
16
- unknown
17
- >;
18
-
19
- const AuthContext = createContext<AnyAuthContextValue | undefined>(undefined);
20
-
21
- type AuthProviderProps<
22
- TUser = unknown,
23
- TRole extends string = string,
24
- TPermission extends string = string,
25
- TSession extends AuthSession<TUser, TRole, TPermission> = AuthSession<
26
- TUser,
27
- TRole,
28
- TPermission
29
- >,
30
- TCredentials = unknown,
31
- > = {
32
- adapter: AuthAdapter<TUser, TRole, TPermission, TSession, TCredentials>;
33
- children: ReactNode;
34
- autoSync?: boolean;
35
- };
36
-
37
- /**
38
- * AuthProvider component - wraps your app with authentication context
39
- *
40
- * @example
41
- * ```tsx
42
- * import { AuthProvider, createAuthAdapter } from '@k3mart/react-kit/auth2';
43
- *
44
- * const authAdapter = createAuthAdapter({
45
- * // ... configuration
46
- * });
47
- *
48
- * function App() {
49
- * return (
50
- * <AuthProvider adapter={authAdapter}>
51
- * <YourApp />
52
- * </AuthProvider>
53
- * );
54
- * }
55
- * ```
56
- */
57
- export function AuthProvider<
58
- TUser = unknown,
59
- TRole extends string = string,
60
- TPermission extends string = string,
61
- TSession extends AuthSession<TUser, TRole, TPermission> = AuthSession<
62
- TUser,
63
- TRole,
64
- TPermission
65
- >,
66
- TCredentials = unknown,
67
- >({
68
- adapter,
69
- children,
70
- autoSync = true,
71
- }: AuthProviderProps<TUser, TRole, TPermission, TSession, TCredentials>) {
72
- const state = useSyncExternalStore(
73
- adapter.subscribe,
74
- adapter.getState,
75
- adapter.getState,
76
- );
77
-
78
- useEffect(() => {
79
- if (!autoSync) return;
80
- adapter.sync().catch(() => undefined);
81
- }, [adapter, autoSync]);
82
-
83
- const value = useMemo<
84
- AuthContextValue<TUser, TRole, TPermission, TSession, TCredentials>
85
- >(() => {
86
- const login = adapter.login
87
- ? async (credentials: TCredentials) => {
88
- if (!adapter.login) {
89
- throw new Error('Login is not configured');
90
- }
91
- return await adapter.login(credentials);
92
- }
93
- : undefined;
94
-
95
- return {
96
- state,
97
- status: state.status,
98
- session: state.session,
99
- user: state.user,
100
- roles: state.roles,
101
- permissions: state.permissions,
102
- error: state.error,
103
- login,
104
- logout: adapter.logout,
105
- refresh: adapter.refresh,
106
- setSession: adapter.setSession,
107
- hasRole: adapter.hasRole,
108
- hasPermission: adapter.hasPermission,
109
- can: adapter.can,
110
- getToken: adapter.getToken,
111
- isTokenExpired: adapter.isTokenExpired,
112
- getTimeUntilExpiry: adapter.getTimeUntilExpiry,
113
- };
114
- }, [adapter, state]);
115
-
116
- const contextValue = value as unknown as AnyAuthContextValue;
117
-
118
- return (
119
- <AuthContext.Provider value={contextValue}>{children}</AuthContext.Provider>
120
- );
121
- }
122
-
123
- /**
124
- * Hook to access auth context
125
- * Must be used within AuthProvider
126
- */
127
- export function useAuthContext(): AnyAuthContextValue {
128
- const ctx = useContext(AuthContext);
129
- if (!ctx) throw new Error('useAuthContext must be used within AuthProvider');
130
- return ctx;
131
- }
@@ -1,44 +0,0 @@
1
- import type { AuthSession, RefreshStrategy } from './core';
2
- import type { PermissionHierarchy, RoleHierarchy } from './permissions';
3
- import type { AuthAdapterState } from './state';
4
- import type { AuthMiddleware } from './middleware';
5
- import type { TokenManager } from './token-manager';
6
- import type { AuthStorage } from './storage';
7
-
8
- export type AuthAdapterConfig<
9
- TUser = unknown,
10
- TRole extends string = string,
11
- TPermission extends string = string,
12
- TSession extends AuthSession<TUser, TRole, TPermission> = AuthSession<
13
- TUser,
14
- TRole,
15
- TPermission
16
- >,
17
- TCredentials = unknown,
18
- > = {
19
- storage?: AuthStorage<TSession>;
20
- loadSession?: () => Promise<TSession | null>;
21
- login?: (credentials: TCredentials) => Promise<TSession>;
22
- logout?: (session: TSession | null) => Promise<void> | void;
23
- refresh?: (session: TSession) => Promise<TSession>;
24
- resolveUser?: (session: TSession | null) => TUser | null;
25
- resolveRoles?: (session: TSession | null) => TRole[];
26
- resolvePermissions?: (session: TSession | null) => TPermission[];
27
- shouldRefresh?: (session: TSession) => boolean;
28
- onStateChange?: (
29
- state: AuthAdapterState<TSession, TUser, TRole, TPermission>,
30
- ) => void;
31
-
32
- refreshStrategy?: RefreshStrategy;
33
- refreshThreshold?: number;
34
- autoRefresh?: boolean;
35
- permissionHierarchy?: PermissionHierarchy<TPermission>;
36
- roleHierarchy?: RoleHierarchy<TRole>;
37
- middleware?: AuthMiddleware<TSession, TUser, TRole, TPermission>[];
38
- tokenManager?: TokenManager;
39
- retryConfig?: {
40
- maxRetries?: number;
41
- retryDelay?: number;
42
- retryOn?: (error: unknown) => boolean;
43
- };
44
- };