@k3-tech/react-kit 0.0.72 → 0.0.73

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 (491) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +5 -1
  3. package/.babelrc +0 -12
  4. package/.storybook/main.ts +0 -22
  5. package/.storybook/preview.ts +0 -198
  6. package/Dockerfile.storybook +0 -43
  7. package/biome.json +0 -10
  8. package/components.json +0 -20
  9. package/dist/chunks/index.js +0 -5168
  10. package/dist/chunks/ort.bundle.min.js +0 -4
  11. package/dist/chunks/ort.webgpu.bundle.min.js +0 -4
  12. package/dist/index.d.ts.map +0 -1
  13. package/dist/kit/builder/auth/components/Can.d.ts.map +0 -1
  14. package/dist/kit/builder/auth/components/RequireAuth.d.ts.map +0 -1
  15. package/dist/kit/builder/auth/components/ShowWhenAuthenticated.d.ts.map +0 -1
  16. package/dist/kit/builder/auth/components/ShowWhenError.d.ts.map +0 -1
  17. package/dist/kit/builder/auth/components/ShowWhenLoading.d.ts.map +0 -1
  18. package/dist/kit/builder/auth/components/ShowWhenUnauthenticated.d.ts.map +0 -1
  19. package/dist/kit/builder/auth/components/withPermission.d.ts.map +0 -1
  20. package/dist/kit/builder/auth/hooks/action-hooks.d.ts.map +0 -1
  21. package/dist/kit/builder/auth/hooks/core-hooks.d.ts.map +0 -1
  22. package/dist/kit/builder/auth/hooks/index.d.ts.map +0 -1
  23. package/dist/kit/builder/auth/hooks/permission-hooks.d.ts.map +0 -1
  24. package/dist/kit/builder/auth/hooks/token-hooks.d.ts.map +0 -1
  25. package/dist/kit/builder/auth/index.d.ts.map +0 -1
  26. package/dist/kit/builder/auth/providers/AuthProvider.d.ts.map +0 -1
  27. package/dist/kit/builder/auth/types/adapter-config.d.ts.map +0 -1
  28. package/dist/kit/builder/auth/types/adapter.d.ts.map +0 -1
  29. package/dist/kit/builder/auth/types/core.d.ts.map +0 -1
  30. package/dist/kit/builder/auth/types/index.d.ts.map +0 -1
  31. package/dist/kit/builder/auth/types/middleware.d.ts.map +0 -1
  32. package/dist/kit/builder/auth/types/permissions.d.ts.map +0 -1
  33. package/dist/kit/builder/auth/types/state.d.ts.map +0 -1
  34. package/dist/kit/builder/auth/types/storage.d.ts.map +0 -1
  35. package/dist/kit/builder/auth/types/token-manager.d.ts.map +0 -1
  36. package/dist/kit/builder/auth/types/utils.d.ts.map +0 -1
  37. package/dist/kit/builder/auth/utils/auth-adapter.d.ts.map +0 -1
  38. package/dist/kit/builder/auth/utils/client-adapters/apollo-link.d.ts.map +0 -1
  39. package/dist/kit/builder/auth/utils/client-adapters/axios.d.ts.map +0 -1
  40. package/dist/kit/builder/auth/utils/client-adapters/fetch.d.ts.map +0 -1
  41. package/dist/kit/builder/auth/utils/client-adapters/graphql.d.ts.map +0 -1
  42. package/dist/kit/builder/auth/utils/client-adapters/index.d.ts.map +0 -1
  43. package/dist/kit/builder/auth/utils/client-adapters/rest.d.ts.map +0 -1
  44. package/dist/kit/builder/auth/utils/client-adapters/urql-exchange.d.ts.map +0 -1
  45. package/dist/kit/builder/auth/utils/permission-checker.d.ts.map +0 -1
  46. package/dist/kit/builder/auth/utils/storage/browser.d.ts.map +0 -1
  47. package/dist/kit/builder/auth/utils/storage/cookie.d.ts.map +0 -1
  48. package/dist/kit/builder/auth/utils/storage/encryption.d.ts.map +0 -1
  49. package/dist/kit/builder/auth/utils/storage/env.d.ts.map +0 -1
  50. package/dist/kit/builder/auth/utils/storage/factory.d.ts.map +0 -1
  51. package/dist/kit/builder/auth/utils/storage/index.d.ts.map +0 -1
  52. package/dist/kit/builder/auth/utils/storage/memory.d.ts.map +0 -1
  53. package/dist/kit/builder/auth/utils/token-manager.d.ts.map +0 -1
  54. package/dist/kit/builder/data-table/components/DataTable.d.ts.map +0 -1
  55. package/dist/kit/builder/data-table/components/DataTableColumnHeader.d.ts.map +0 -1
  56. package/dist/kit/builder/data-table/components/DataTableFilterPanel.d.ts.map +0 -1
  57. package/dist/kit/builder/data-table/components/DataTablePagination.d.ts.map +0 -1
  58. package/dist/kit/builder/data-table/components/DataTableViewOptions.d.ts.map +0 -1
  59. package/dist/kit/builder/data-table/index.d.ts.map +0 -1
  60. package/dist/kit/builder/data-table/types.d.ts.map +0 -1
  61. package/dist/kit/builder/data-table/utils/dotAccessor.d.ts.map +0 -1
  62. package/dist/kit/builder/dialog/index.d.ts.map +0 -1
  63. package/dist/kit/builder/dialog/provider.d.ts.map +0 -1
  64. package/dist/kit/builder/form/components/FormBuilder.d.ts.map +0 -1
  65. package/dist/kit/builder/form/components/FormBuilderActions.d.ts.map +0 -1
  66. package/dist/kit/builder/form/components/FormBuilderContext.d.ts.map +0 -1
  67. package/dist/kit/builder/form/components/FormBuilderField.d.ts.map +0 -1
  68. package/dist/kit/builder/form/components/fields/ArrayField.d.ts.map +0 -1
  69. package/dist/kit/builder/form/components/fields/AutocompleteField.d.ts.map +0 -1
  70. package/dist/kit/builder/form/components/fields/CheckboxField.d.ts.map +0 -1
  71. package/dist/kit/builder/form/components/fields/DateField.d.ts.map +0 -1
  72. package/dist/kit/builder/form/components/fields/DatePickerField.d.ts.map +0 -1
  73. package/dist/kit/builder/form/components/fields/DateRangePickerField.d.ts.map +0 -1
  74. package/dist/kit/builder/form/components/fields/DateTimePickerField.d.ts.map +0 -1
  75. package/dist/kit/builder/form/components/fields/DateTimeRangePickerField.d.ts.map +0 -1
  76. package/dist/kit/builder/form/components/fields/FileField.d.ts.map +0 -1
  77. package/dist/kit/builder/form/components/fields/MonthPickerField.d.ts.map +0 -1
  78. package/dist/kit/builder/form/components/fields/MonthRangePickerField.d.ts.map +0 -1
  79. package/dist/kit/builder/form/components/fields/NumberField.d.ts.map +0 -1
  80. package/dist/kit/builder/form/components/fields/ObjectField.d.ts.map +0 -1
  81. package/dist/kit/builder/form/components/fields/RadioField.d.ts.map +0 -1
  82. package/dist/kit/builder/form/components/fields/SelectField.d.ts.map +0 -1
  83. package/dist/kit/builder/form/components/fields/SwitchField.d.ts.map +0 -1
  84. package/dist/kit/builder/form/components/fields/TextField.d.ts.map +0 -1
  85. package/dist/kit/builder/form/components/fields/TextareaField.d.ts.map +0 -1
  86. package/dist/kit/builder/form/components/fields/TimePickerField.d.ts.map +0 -1
  87. package/dist/kit/builder/form/components/fields/TimeRangePickerField.d.ts.map +0 -1
  88. package/dist/kit/builder/form/components/fields/index.d.ts.map +0 -1
  89. package/dist/kit/builder/form/components/fields/types.d.ts.map +0 -1
  90. package/dist/kit/builder/form/components/index.d.ts.map +0 -1
  91. package/dist/kit/builder/form/components/sectionNodes.d.ts.map +0 -1
  92. package/dist/kit/builder/form/hooks/useFormBuilder.d.ts.map +0 -1
  93. package/dist/kit/builder/form/index.d.ts.map +0 -1
  94. package/dist/kit/builder/form/types.d.ts.map +0 -1
  95. package/dist/kit/builder/form/utils/common-forms.d.ts.map +0 -1
  96. package/dist/kit/builder/form/utils/dependencies.d.ts.map +0 -1
  97. package/dist/kit/builder/form/utils/field-factories.d.ts.map +0 -1
  98. package/dist/kit/builder/form/utils/index.d.ts.map +0 -1
  99. package/dist/kit/builder/form/utils/section-factories.d.ts.map +0 -1
  100. package/dist/kit/builder/form/utils/transformers.d.ts.map +0 -1
  101. package/dist/kit/builder/form/utils/validations.d.ts.map +0 -1
  102. package/dist/kit/builder/form/utils/validators.d.ts.map +0 -1
  103. package/dist/kit/builder/page/Page.d.ts.map +0 -1
  104. package/dist/kit/builder/page/PageBackButton.d.ts.map +0 -1
  105. package/dist/kit/builder/page/index.d.ts.map +0 -1
  106. package/dist/kit/builder/section/SectionBuilder.d.ts.map +0 -1
  107. package/dist/kit/builder/section/SectionContainer.d.ts.map +0 -1
  108. package/dist/kit/builder/section/index.d.ts.map +0 -1
  109. package/dist/kit/builder/section/types.d.ts.map +0 -1
  110. package/dist/kit/builder/stack-dialog/context.d.ts.map +0 -1
  111. package/dist/kit/builder/stack-dialog/hooks.d.ts.map +0 -1
  112. package/dist/kit/builder/stack-dialog/index.d.ts.map +0 -1
  113. package/dist/kit/builder/stack-dialog/provider.d.ts.map +0 -1
  114. package/dist/kit/builder/stack-dialog/renderer.d.ts.map +0 -1
  115. package/dist/kit/builder/stack-dialog/types.d.ts.map +0 -1
  116. package/dist/kit/components/autocomplete/Autocomplete.d.ts.map +0 -1
  117. package/dist/kit/components/autocomplete/index.d.ts.map +0 -1
  118. package/dist/kit/components/autocomplete/types.d.ts.map +0 -1
  119. package/dist/kit/components/data-table-headers/DataTableHeader.d.ts.map +0 -1
  120. package/dist/kit/components/data-table-headers/DebouncedFilterField.d.ts.map +0 -1
  121. package/dist/kit/components/data-table-headers/FilterFieldRenderer.d.ts.map +0 -1
  122. package/dist/kit/components/data-table-headers/index.d.ts.map +0 -1
  123. package/dist/kit/components/data-table-headers/types.d.ts.map +0 -1
  124. package/dist/kit/components/data-table-headers/urlSerialization.d.ts.map +0 -1
  125. package/dist/kit/components/data-table-headers/useDataTableHeaderUrl.d.ts.map +0 -1
  126. package/dist/kit/components/datepicker/DatePicker.d.ts.map +0 -1
  127. package/dist/kit/components/datepicker/DateRangePicker.d.ts.map +0 -1
  128. package/dist/kit/components/datepicker/index.d.ts.map +0 -1
  129. package/dist/kit/components/datetimepicker/DateTimePicker.d.ts.map +0 -1
  130. package/dist/kit/components/datetimepicker/DateTimeRangePicker.d.ts.map +0 -1
  131. package/dist/kit/components/datetimepicker/index.d.ts.map +0 -1
  132. package/dist/kit/components/fileuploader/FileUploader.d.ts.map +0 -1
  133. package/dist/kit/components/fileuploader/image-preprocess.d.ts.map +0 -1
  134. package/dist/kit/components/fileuploader/index.d.ts.map +0 -1
  135. package/dist/kit/components/fileuploader/types.d.ts.map +0 -1
  136. package/dist/kit/components/forminfo/FormInfoError.d.ts.map +0 -1
  137. package/dist/kit/components/forminfo/index.d.ts.map +0 -1
  138. package/dist/kit/components/info-tooltip/InfoTooltip.d.ts.map +0 -1
  139. package/dist/kit/components/keyboard/Keyboard.d.ts.map +0 -1
  140. package/dist/kit/components/keyboard/index.d.ts.map +0 -1
  141. package/dist/kit/components/login/Login.d.ts.map +0 -1
  142. package/dist/kit/components/login/index.d.ts.map +0 -1
  143. package/dist/kit/components/monthpicker/MonthInput.d.ts.map +0 -1
  144. package/dist/kit/components/monthpicker/MonthPicker.d.ts.map +0 -1
  145. package/dist/kit/components/monthpicker/MonthRangeInput.d.ts.map +0 -1
  146. package/dist/kit/components/monthpicker/MonthRangePicker.d.ts.map +0 -1
  147. package/dist/kit/components/numpad/Numpad.d.ts.map +0 -1
  148. package/dist/kit/components/numpad/index.d.ts.map +0 -1
  149. package/dist/kit/components/timepicker/TimePicker.d.ts.map +0 -1
  150. package/dist/kit/components/timepicker/TimeRangePicker.d.ts.map +0 -1
  151. package/dist/kit/components/timepicker/index.d.ts.map +0 -1
  152. package/dist/kit/layouts/admin/components/AdminLayout.d.ts.map +0 -1
  153. package/dist/kit/layouts/admin/components/ThemeToggle.d.ts.map +0 -1
  154. package/dist/kit/layouts/admin/hooks/menu.d.ts.map +0 -1
  155. package/dist/kit/layouts/admin/providers/AdminMenuProvider.d.ts.map +0 -1
  156. package/dist/kit/layouts/admin/types/index.d.ts.map +0 -1
  157. package/dist/kit/providers/ThemeProvider.d.ts.map +0 -1
  158. package/dist/shadcn/hooks/use-mobile.d.ts.map +0 -1
  159. package/dist/shadcn/lib/utils.d.ts.map +0 -1
  160. package/dist/shadcn/ui/accordion.d.ts.map +0 -1
  161. package/dist/shadcn/ui/alert-dialog.d.ts.map +0 -1
  162. package/dist/shadcn/ui/alert.d.ts.map +0 -1
  163. package/dist/shadcn/ui/aspect-ratio.d.ts.map +0 -1
  164. package/dist/shadcn/ui/avatar.d.ts.map +0 -1
  165. package/dist/shadcn/ui/badge.d.ts.map +0 -1
  166. package/dist/shadcn/ui/breadcrumb.d.ts.map +0 -1
  167. package/dist/shadcn/ui/button.d.ts.map +0 -1
  168. package/dist/shadcn/ui/calendar.d.ts.map +0 -1
  169. package/dist/shadcn/ui/card.d.ts.map +0 -1
  170. package/dist/shadcn/ui/carousel.d.ts.map +0 -1
  171. package/dist/shadcn/ui/chart.d.ts.map +0 -1
  172. package/dist/shadcn/ui/checkbox.d.ts.map +0 -1
  173. package/dist/shadcn/ui/collapsible.d.ts.map +0 -1
  174. package/dist/shadcn/ui/command.d.ts.map +0 -1
  175. package/dist/shadcn/ui/context-menu.d.ts.map +0 -1
  176. package/dist/shadcn/ui/dialog.d.ts.map +0 -1
  177. package/dist/shadcn/ui/drawer.d.ts.map +0 -1
  178. package/dist/shadcn/ui/dropdown-menu.d.ts.map +0 -1
  179. package/dist/shadcn/ui/form.d.ts.map +0 -1
  180. package/dist/shadcn/ui/hover-card.d.ts.map +0 -1
  181. package/dist/shadcn/ui/input-otp.d.ts.map +0 -1
  182. package/dist/shadcn/ui/input.d.ts.map +0 -1
  183. package/dist/shadcn/ui/label.d.ts.map +0 -1
  184. package/dist/shadcn/ui/menubar.d.ts.map +0 -1
  185. package/dist/shadcn/ui/navigation-menu.d.ts.map +0 -1
  186. package/dist/shadcn/ui/pagination.d.ts.map +0 -1
  187. package/dist/shadcn/ui/popover.d.ts.map +0 -1
  188. package/dist/shadcn/ui/progress.d.ts.map +0 -1
  189. package/dist/shadcn/ui/radio-group.d.ts.map +0 -1
  190. package/dist/shadcn/ui/resizable.d.ts.map +0 -1
  191. package/dist/shadcn/ui/scroll-area.d.ts.map +0 -1
  192. package/dist/shadcn/ui/select.d.ts.map +0 -1
  193. package/dist/shadcn/ui/separator.d.ts.map +0 -1
  194. package/dist/shadcn/ui/sheet.d.ts.map +0 -1
  195. package/dist/shadcn/ui/sidebar.d.ts.map +0 -1
  196. package/dist/shadcn/ui/skeleton.d.ts.map +0 -1
  197. package/dist/shadcn/ui/slider.d.ts.map +0 -1
  198. package/dist/shadcn/ui/sonner.d.ts.map +0 -1
  199. package/dist/shadcn/ui/switch.d.ts.map +0 -1
  200. package/dist/shadcn/ui/table.d.ts.map +0 -1
  201. package/dist/shadcn/ui/tabs.d.ts.map +0 -1
  202. package/dist/shadcn/ui/textarea.d.ts.map +0 -1
  203. package/dist/shadcn/ui/toggle-group.d.ts.map +0 -1
  204. package/dist/shadcn/ui/toggle.d.ts.map +0 -1
  205. package/dist/shadcn/ui/tooltip.d.ts.map +0 -1
  206. package/src/index.ts +0 -100
  207. package/src/kit/builder/auth/components/Can.tsx +0 -27
  208. package/src/kit/builder/auth/components/RequireAuth.tsx +0 -78
  209. package/src/kit/builder/auth/components/ShowWhenAuthenticated.tsx +0 -10
  210. package/src/kit/builder/auth/components/ShowWhenError.tsx +0 -10
  211. package/src/kit/builder/auth/components/ShowWhenLoading.tsx +0 -10
  212. package/src/kit/builder/auth/components/ShowWhenUnauthenticated.tsx +0 -10
  213. package/src/kit/builder/auth/components/withPermission.tsx +0 -23
  214. package/src/kit/builder/auth/hooks/action-hooks.ts +0 -34
  215. package/src/kit/builder/auth/hooks/core-hooks.ts +0 -65
  216. package/src/kit/builder/auth/hooks/index.ts +0 -4
  217. package/src/kit/builder/auth/hooks/permission-hooks.ts +0 -43
  218. package/src/kit/builder/auth/hooks/token-hooks.ts +0 -25
  219. package/src/kit/builder/auth/index.ts +0 -132
  220. package/src/kit/builder/auth/providers/AuthProvider.tsx +0 -131
  221. package/src/kit/builder/auth/types/adapter-config.ts +0 -44
  222. package/src/kit/builder/auth/types/adapter.ts +0 -132
  223. package/src/kit/builder/auth/types/core.ts +0 -27
  224. package/src/kit/builder/auth/types/index.ts +0 -9
  225. package/src/kit/builder/auth/types/middleware.ts +0 -20
  226. package/src/kit/builder/auth/types/permissions.ts +0 -23
  227. package/src/kit/builder/auth/types/state.ts +0 -16
  228. package/src/kit/builder/auth/types/storage.ts +0 -21
  229. package/src/kit/builder/auth/types/token-manager.ts +0 -9
  230. package/src/kit/builder/auth/types/utils.ts +0 -55
  231. package/src/kit/builder/auth/utils/auth-adapter.ts +0 -437
  232. package/src/kit/builder/auth/utils/client-adapters/apollo-link.ts +0 -30
  233. package/src/kit/builder/auth/utils/client-adapters/axios.ts +0 -61
  234. package/src/kit/builder/auth/utils/client-adapters/fetch.ts +0 -48
  235. package/src/kit/builder/auth/utils/client-adapters/graphql.ts +0 -60
  236. package/src/kit/builder/auth/utils/client-adapters/index.ts +0 -6
  237. package/src/kit/builder/auth/utils/client-adapters/rest.ts +0 -60
  238. package/src/kit/builder/auth/utils/client-adapters/urql-exchange.ts +0 -76
  239. package/src/kit/builder/auth/utils/permission-checker.ts +0 -150
  240. package/src/kit/builder/auth/utils/storage/browser.ts +0 -99
  241. package/src/kit/builder/auth/utils/storage/cookie.ts +0 -116
  242. package/src/kit/builder/auth/utils/storage/encryption.ts +0 -80
  243. package/src/kit/builder/auth/utils/storage/env.ts +0 -2
  244. package/src/kit/builder/auth/utils/storage/factory.ts +0 -37
  245. package/src/kit/builder/auth/utils/storage/index.ts +0 -6
  246. package/src/kit/builder/auth/utils/storage/memory.ts +0 -15
  247. package/src/kit/builder/auth/utils/token-manager.ts +0 -55
  248. package/src/kit/builder/data-table/components/DataTable.tsx +0 -662
  249. package/src/kit/builder/data-table/components/DataTableColumnHeader.tsx +0 -67
  250. package/src/kit/builder/data-table/components/DataTableFilterPanel.tsx +0 -160
  251. package/src/kit/builder/data-table/components/DataTablePagination.tsx +0 -135
  252. package/src/kit/builder/data-table/components/DataTableViewOptions.tsx +0 -51
  253. package/src/kit/builder/data-table/index.ts +0 -6
  254. package/src/kit/builder/data-table/types.ts +0 -44
  255. package/src/kit/builder/data-table/utils/dotAccessor.ts +0 -6
  256. package/src/kit/builder/dialog/index.ts +0 -6
  257. package/src/kit/builder/dialog/provider.tsx +0 -170
  258. package/src/kit/builder/form/components/FormBuilder.tsx +0 -333
  259. package/src/kit/builder/form/components/FormBuilderActions.tsx +0 -78
  260. package/src/kit/builder/form/components/FormBuilderContext.tsx +0 -52
  261. package/src/kit/builder/form/components/FormBuilderField.tsx +0 -476
  262. package/src/kit/builder/form/components/fields/ArrayField.tsx +0 -312
  263. package/src/kit/builder/form/components/fields/AutocompleteField.tsx +0 -99
  264. package/src/kit/builder/form/components/fields/CheckboxField.tsx +0 -78
  265. package/src/kit/builder/form/components/fields/DateField.tsx +0 -55
  266. package/src/kit/builder/form/components/fields/DatePickerField.tsx +0 -48
  267. package/src/kit/builder/form/components/fields/DateRangePickerField.tsx +0 -72
  268. package/src/kit/builder/form/components/fields/DateTimePickerField.tsx +0 -55
  269. package/src/kit/builder/form/components/fields/DateTimeRangePickerField.tsx +0 -65
  270. package/src/kit/builder/form/components/fields/FileField.tsx +0 -38
  271. package/src/kit/builder/form/components/fields/MonthPickerField.tsx +0 -34
  272. package/src/kit/builder/form/components/fields/MonthRangePickerField.tsx +0 -42
  273. package/src/kit/builder/form/components/fields/NumberField.tsx +0 -88
  274. package/src/kit/builder/form/components/fields/ObjectField.tsx +0 -35
  275. package/src/kit/builder/form/components/fields/RadioField.tsx +0 -48
  276. package/src/kit/builder/form/components/fields/SelectField.tsx +0 -47
  277. package/src/kit/builder/form/components/fields/SwitchField.tsx +0 -76
  278. package/src/kit/builder/form/components/fields/TextField.tsx +0 -26
  279. package/src/kit/builder/form/components/fields/TextareaField.tsx +0 -21
  280. package/src/kit/builder/form/components/fields/TimePickerField.tsx +0 -36
  281. package/src/kit/builder/form/components/fields/TimeRangePickerField.tsx +0 -44
  282. package/src/kit/builder/form/components/fields/index.ts +0 -21
  283. package/src/kit/builder/form/components/fields/types.ts +0 -18
  284. package/src/kit/builder/form/components/index.ts +0 -3
  285. package/src/kit/builder/form/components/sectionNodes.tsx +0 -148
  286. package/src/kit/builder/form/hooks/useFormBuilder.ts +0 -457
  287. package/src/kit/builder/form/index.ts +0 -4
  288. package/src/kit/builder/form/types.ts +0 -294
  289. package/src/kit/builder/form/utils/common-forms.ts +0 -68
  290. package/src/kit/builder/form/utils/dependencies.ts +0 -56
  291. package/src/kit/builder/form/utils/field-factories.ts +0 -177
  292. package/src/kit/builder/form/utils/index.ts +0 -17
  293. package/src/kit/builder/form/utils/section-factories.ts +0 -38
  294. package/src/kit/builder/form/utils/transformers.ts +0 -100
  295. package/src/kit/builder/form/utils/validations.ts +0 -22
  296. package/src/kit/builder/form/utils/validators.ts +0 -20
  297. package/src/kit/builder/page/Page.tsx +0 -205
  298. package/src/kit/builder/page/PageBackButton.tsx +0 -52
  299. package/src/kit/builder/page/index.ts +0 -1
  300. package/src/kit/builder/section/SectionBuilder.tsx +0 -443
  301. package/src/kit/builder/section/SectionContainer.tsx +0 -85
  302. package/src/kit/builder/section/index.ts +0 -2
  303. package/src/kit/builder/section/types.ts +0 -83
  304. package/src/kit/builder/stack-dialog/context.ts +0 -15
  305. package/src/kit/builder/stack-dialog/hooks.ts +0 -13
  306. package/src/kit/builder/stack-dialog/index.ts +0 -12
  307. package/src/kit/builder/stack-dialog/provider.tsx +0 -51
  308. package/src/kit/builder/stack-dialog/renderer.tsx +0 -36
  309. package/src/kit/builder/stack-dialog/types.ts +0 -34
  310. package/src/kit/components/autocomplete/Autocomplete.tsx +0 -732
  311. package/src/kit/components/autocomplete/index.ts +0 -3
  312. package/src/kit/components/autocomplete/types.ts +0 -27
  313. package/src/kit/components/data-table-headers/DataTableHeader.tsx +0 -158
  314. package/src/kit/components/data-table-headers/DebouncedFilterField.tsx +0 -83
  315. package/src/kit/components/data-table-headers/FilterFieldRenderer.tsx +0 -194
  316. package/src/kit/components/data-table-headers/index.ts +0 -6
  317. package/src/kit/components/data-table-headers/types.ts +0 -89
  318. package/src/kit/components/data-table-headers/urlSerialization.ts +0 -173
  319. package/src/kit/components/data-table-headers/useDataTableHeaderUrl.ts +0 -107
  320. package/src/kit/components/datepicker/DatePicker.tsx +0 -173
  321. package/src/kit/components/datepicker/DateRangePicker.tsx +0 -526
  322. package/src/kit/components/datepicker/index.ts +0 -2
  323. package/src/kit/components/datetimepicker/DateTimePicker.tsx +0 -420
  324. package/src/kit/components/datetimepicker/DateTimeRangePicker.tsx +0 -676
  325. package/src/kit/components/datetimepicker/index.ts +0 -2
  326. package/src/kit/components/fileuploader/FileUploader.tsx +0 -880
  327. package/src/kit/components/fileuploader/image-preprocess.ts +0 -253
  328. package/src/kit/components/fileuploader/index.ts +0 -4
  329. package/src/kit/components/fileuploader/types.ts +0 -94
  330. package/src/kit/components/forminfo/FormInfoError.tsx +0 -135
  331. package/src/kit/components/forminfo/index.ts +0 -1
  332. package/src/kit/components/info-tooltip/InfoTooltip.tsx +0 -18
  333. package/src/kit/components/keyboard/Keyboard.tsx +0 -916
  334. package/src/kit/components/keyboard/index.ts +0 -4
  335. package/src/kit/components/login/Login.tsx +0 -141
  336. package/src/kit/components/login/index.ts +0 -1
  337. package/src/kit/components/monthpicker/MonthInput.tsx +0 -131
  338. package/src/kit/components/monthpicker/MonthPicker.tsx +0 -224
  339. package/src/kit/components/monthpicker/MonthRangeInput.tsx +0 -153
  340. package/src/kit/components/monthpicker/MonthRangePicker.tsx +0 -409
  341. package/src/kit/components/numpad/Numpad.tsx +0 -377
  342. package/src/kit/components/numpad/index.ts +0 -4
  343. package/src/kit/components/timepicker/TimePicker.tsx +0 -319
  344. package/src/kit/components/timepicker/TimeRangePicker.tsx +0 -368
  345. package/src/kit/components/timepicker/index.ts +0 -2
  346. package/src/kit/layouts/admin/components/AdminLayout.tsx +0 -419
  347. package/src/kit/layouts/admin/components/ThemeToggle.tsx +0 -54
  348. package/src/kit/layouts/admin/hooks/menu.ts +0 -32
  349. package/src/kit/layouts/admin/providers/AdminMenuProvider.tsx +0 -78
  350. package/src/kit/layouts/admin/types/index.ts +0 -26
  351. package/src/kit/providers/ThemeProvider.tsx +0 -90
  352. package/src/kit/themes/base.css +0 -11
  353. package/src/kit/themes/clean-slate.css +0 -155
  354. package/src/kit/themes/default.css +0 -197
  355. package/src/kit/themes/minimal-modern.css +0 -155
  356. package/src/kit/themes/spotify.css +0 -164
  357. package/src/shadcn/hooks/use-mobile.ts +0 -21
  358. package/src/shadcn/lib/utils.ts +0 -6
  359. package/src/shadcn/ui/accordion.tsx +0 -66
  360. package/src/shadcn/ui/alert-dialog.tsx +0 -157
  361. package/src/shadcn/ui/alert.tsx +0 -66
  362. package/src/shadcn/ui/aspect-ratio.tsx +0 -11
  363. package/src/shadcn/ui/avatar.tsx +0 -53
  364. package/src/shadcn/ui/badge.tsx +0 -46
  365. package/src/shadcn/ui/breadcrumb.tsx +0 -111
  366. package/src/shadcn/ui/button.tsx +0 -59
  367. package/src/shadcn/ui/calendar.tsx +0 -217
  368. package/src/shadcn/ui/card.tsx +0 -92
  369. package/src/shadcn/ui/carousel.tsx +0 -240
  370. package/src/shadcn/ui/chart.tsx +0 -353
  371. package/src/shadcn/ui/checkbox.tsx +0 -32
  372. package/src/shadcn/ui/collapsible.tsx +0 -33
  373. package/src/shadcn/ui/command.tsx +0 -184
  374. package/src/shadcn/ui/context-menu.tsx +0 -252
  375. package/src/shadcn/ui/dialog.tsx +0 -146
  376. package/src/shadcn/ui/drawer.tsx +0 -135
  377. package/src/shadcn/ui/dropdown-menu.tsx +0 -257
  378. package/src/shadcn/ui/form.tsx +0 -168
  379. package/src/shadcn/ui/hover-card.tsx +0 -44
  380. package/src/shadcn/ui/input-otp.tsx +0 -77
  381. package/src/shadcn/ui/input.tsx +0 -21
  382. package/src/shadcn/ui/label.tsx +0 -24
  383. package/src/shadcn/ui/menubar.tsx +0 -276
  384. package/src/shadcn/ui/navigation-menu.tsx +0 -168
  385. package/src/shadcn/ui/pagination.tsx +0 -128
  386. package/src/shadcn/ui/popover.tsx +0 -48
  387. package/src/shadcn/ui/progress.tsx +0 -31
  388. package/src/shadcn/ui/radio-group.tsx +0 -45
  389. package/src/shadcn/ui/resizable.tsx +0 -56
  390. package/src/shadcn/ui/scroll-area.tsx +0 -58
  391. package/src/shadcn/ui/select.tsx +0 -185
  392. package/src/shadcn/ui/separator.tsx +0 -28
  393. package/src/shadcn/ui/sheet.tsx +0 -139
  394. package/src/shadcn/ui/sidebar.tsx +0 -726
  395. package/src/shadcn/ui/skeleton.tsx +0 -13
  396. package/src/shadcn/ui/slider.tsx +0 -63
  397. package/src/shadcn/ui/sonner.tsx +0 -37
  398. package/src/shadcn/ui/switch.tsx +0 -31
  399. package/src/shadcn/ui/table.tsx +0 -134
  400. package/src/shadcn/ui/tabs.tsx +0 -66
  401. package/src/shadcn/ui/textarea.tsx +0 -18
  402. package/src/shadcn/ui/toggle-group.tsx +0 -73
  403. package/src/shadcn/ui/toggle.tsx +0 -47
  404. package/src/shadcn/ui/tooltip.tsx +0 -61
  405. package/src/stories/FileUploader.stories.tsx +0 -185
  406. package/src/stories/kit/builder/DataTable.Basic.stories.tsx +0 -71
  407. package/src/stories/kit/builder/DataTable.Filters.stories.tsx +0 -98
  408. package/src/stories/kit/builder/DataTable.Pagination.stories.tsx +0 -73
  409. package/src/stories/kit/builder/DataTable.SelectionAndActions.stories.tsx +0 -77
  410. package/src/stories/kit/builder/DataTable.Sorting.stories.tsx +0 -67
  411. package/src/stories/kit/builder/Dialog.stories.tsx +0 -90
  412. package/src/stories/kit/builder/Form.ArrayLayouts.stories.tsx +0 -177
  413. package/src/stories/kit/builder/Form.Autocomplete.stories.tsx +0 -220
  414. package/src/stories/kit/builder/Form.Basic.stories.tsx +0 -79
  415. package/src/stories/kit/builder/Form.Complex.stories.tsx +0 -569
  416. package/src/stories/kit/builder/Form.DateTime.stories.tsx +0 -70
  417. package/src/stories/kit/builder/Form.Dynamic.stories.tsx +0 -926
  418. package/src/stories/kit/builder/Form.Files.stories.tsx +0 -136
  419. package/src/stories/kit/builder/Form.MultipleFormBuilder.stories.tsx +0 -377
  420. package/src/stories/kit/builder/Form.Pickers.stories.tsx +0 -75
  421. package/src/stories/kit/builder/Form.Simple.stories.tsx +0 -91
  422. package/src/stories/kit/builder/Form.Time.stories.tsx +0 -68
  423. package/src/stories/kit/builder/Page.stories.tsx +0 -115
  424. package/src/stories/kit/builder/Section.stories.tsx +0 -282
  425. package/src/stories/kit/components/Autocomplete.stories.tsx +0 -313
  426. package/src/stories/kit/components/DatePicker.stories.tsx +0 -195
  427. package/src/stories/kit/components/DateRangePicker.stories.tsx +0 -195
  428. package/src/stories/kit/components/Keyboard.stories.tsx +0 -263
  429. package/src/stories/kit/components/Login.stories.tsx +0 -167
  430. package/src/stories/kit/components/MonthPicker.stories.tsx +0 -100
  431. package/src/stories/kit/components/MonthRangePicker.stories.tsx +0 -117
  432. package/src/stories/kit/components/Numpad.stories.tsx +0 -195
  433. package/src/stories/kit/components/TimePicker.stories.tsx +0 -71
  434. package/src/stories/kit/components/TimeRangePicker.stories.tsx +0 -43
  435. package/src/stories/kit/layouts/admin/AdminLayout.Basic.stories.tsx +0 -118
  436. package/src/stories/kit/layouts/admin/AdminLayout.Collapsible.stories.tsx +0 -81
  437. package/src/stories/kit/layouts/admin/AdminLayout.Complex.stories.tsx +0 -251
  438. package/src/stories/kit/layouts/admin/AdminLayout.CustomSidebarHeaderComponent.stories.tsx +0 -80
  439. package/src/stories/kit/layouts/admin/AdminLayout.CustomSidebarTitleAndIcon.stories.tsx +0 -70
  440. package/src/stories/kit/layouts/admin/AdminLayout.HeaderSlots.stories.tsx +0 -87
  441. package/src/stories/shadcn/ui/Accordion.stories.tsx +0 -117
  442. package/src/stories/shadcn/ui/Alert.stories.tsx +0 -36
  443. package/src/stories/shadcn/ui/AlertDialog.stories.tsx +0 -73
  444. package/src/stories/shadcn/ui/AspectRatio.stories.tsx +0 -58
  445. package/src/stories/shadcn/ui/Avatar.stories.tsx +0 -26
  446. package/src/stories/shadcn/ui/Badge.stories.tsx +0 -28
  447. package/src/stories/shadcn/ui/Breadcrumb.stories.tsx +0 -47
  448. package/src/stories/shadcn/ui/Button.stories.tsx +0 -51
  449. package/src/stories/shadcn/ui/Calendar.stories.tsx +0 -33
  450. package/src/stories/shadcn/ui/Card.stories.tsx +0 -39
  451. package/src/stories/shadcn/ui/Carousel.stories.tsx +0 -37
  452. package/src/stories/shadcn/ui/Chart.stories.tsx +0 -72
  453. package/src/stories/shadcn/ui/Checkbox.stories.tsx +0 -64
  454. package/src/stories/shadcn/ui/Collapsible.stories.tsx +0 -40
  455. package/src/stories/shadcn/ui/Command.stories.tsx +0 -53
  456. package/src/stories/shadcn/ui/ContextMenu.stories.tsx +0 -67
  457. package/src/stories/shadcn/ui/Dialog.stories.tsx +0 -45
  458. package/src/stories/shadcn/ui/Drawer.stories.tsx +0 -49
  459. package/src/stories/shadcn/ui/DropdownMenu.stories.tsx +0 -75
  460. package/src/stories/shadcn/ui/Form.stories.tsx +0 -93
  461. package/src/stories/shadcn/ui/HoverCard.stories.tsx +0 -43
  462. package/src/stories/shadcn/ui/Input.stories.tsx +0 -41
  463. package/src/stories/shadcn/ui/InputOtp.stories.tsx +0 -39
  464. package/src/stories/shadcn/ui/Label.stories.tsx +0 -29
  465. package/src/stories/shadcn/ui/Menubar.stories.tsx +0 -87
  466. package/src/stories/shadcn/ui/NavigationMenu.stories.tsx +0 -78
  467. package/src/stories/shadcn/ui/Pagination.stories.tsx +0 -51
  468. package/src/stories/shadcn/ui/Popover.stories.tsx +0 -53
  469. package/src/stories/shadcn/ui/Progress.stories.tsx +0 -30
  470. package/src/stories/shadcn/ui/RadioGroup.stories.tsx +0 -31
  471. package/src/stories/shadcn/ui/Resizable.stories.tsx +0 -55
  472. package/src/stories/shadcn/ui/ScrollArea.stories.tsx +0 -84
  473. package/src/stories/shadcn/ui/Select.stories.tsx +0 -61
  474. package/src/stories/shadcn/ui/Separator.stories.tsx +0 -35
  475. package/src/stories/shadcn/ui/Sheet.stories.tsx +0 -48
  476. package/src/stories/shadcn/ui/Sidebar.stories.tsx +0 -131
  477. package/src/stories/shadcn/ui/Skeleton.stories.tsx +0 -23
  478. package/src/stories/shadcn/ui/Slider.stories.tsx +0 -21
  479. package/src/stories/shadcn/ui/Sonner.stories.tsx +0 -49
  480. package/src/stories/shadcn/ui/Switch.stories.tsx +0 -28
  481. package/src/stories/shadcn/ui/Table.stories.tsx +0 -374
  482. package/src/stories/shadcn/ui/Tabs.stories.tsx +0 -31
  483. package/src/stories/shadcn/ui/Textarea.stories.tsx +0 -42
  484. package/src/stories/shadcn/ui/Toggle.stories.tsx +0 -44
  485. package/src/stories/shadcn/ui/ToggleGroup.stories.tsx +0 -28
  486. package/src/stories/shadcn/ui/Tooltip.stories.tsx +0 -30
  487. package/tsconfig.json +0 -20
  488. package/tsconfig.lib.json +0 -52
  489. package/tsconfig.spec.json +0 -38
  490. package/tsconfig.tsbuildinfo +0 -1
  491. 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
- };