@rangka/client 0.1.1 → 0.1.3

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 (317) hide show
  1. package/dist/App.d.ts.map +1 -1
  2. package/dist/App.js +7 -1
  3. package/dist/App.js.map +1 -1
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +2 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/main.d.ts.map +1 -1
  9. package/dist/main.js +20 -0
  10. package/dist/main.js.map +1 -1
  11. package/dist/shell/assets/index-63v1sBS3.css +1 -0
  12. package/dist/shell/assets/index-Dh7K40cQ.js +8634 -0
  13. package/dist/shell/assets/vendor-query-B2cydN5j.js +1 -0
  14. package/dist/shell/assets/vendor-radix-BJxYPxPb.js +69 -0
  15. package/dist/shell/assets/vendor-router-ET_myMt5.js +17 -0
  16. package/dist/shell/index.html +5 -2
  17. package/dist/theme.css +82 -0
  18. package/dist/widgets/components/lazy-manifest.d.ts +11 -0
  19. package/dist/widgets/components/lazy-manifest.d.ts.map +1 -0
  20. package/dist/widgets/components/lazy-manifest.js +32 -0
  21. package/dist/widgets/components/lazy-manifest.js.map +1 -0
  22. package/dist/widgets/components/register.js +12 -12
  23. package/dist/widgets/components/register.js.map +1 -1
  24. package/dist/widgets/loader.d.ts +3 -0
  25. package/dist/widgets/loader.d.ts.map +1 -0
  26. package/dist/widgets/loader.js +73 -0
  27. package/dist/widgets/loader.js.map +1 -0
  28. package/dist/widgets/renderer/LazyWidget.d.ts +8 -0
  29. package/dist/widgets/renderer/LazyWidget.d.ts.map +1 -0
  30. package/dist/widgets/renderer/LazyWidget.js +31 -0
  31. package/dist/widgets/renderer/LazyWidget.js.map +1 -0
  32. package/dist/widgets/renderer/WidgetErrorBoundary.d.ts +17 -0
  33. package/dist/widgets/renderer/WidgetErrorBoundary.d.ts.map +1 -0
  34. package/dist/widgets/renderer/WidgetErrorBoundary.js +18 -0
  35. package/dist/widgets/renderer/WidgetErrorBoundary.js.map +1 -0
  36. package/dist/widgets/renderer/WidgetRenderer.d.ts.map +1 -1
  37. package/dist/widgets/renderer/WidgetRenderer.js +8 -6
  38. package/dist/widgets/renderer/WidgetRenderer.js.map +1 -1
  39. package/package.json +7 -4
  40. package/.claude/skills/add-widget/SKILL.md +0 -101
  41. package/.turbo/turbo-build.log +0 -29
  42. package/CHANGELOG.md +0 -25
  43. package/CLAUDE.md +0 -236
  44. package/components.json +0 -25
  45. package/dist/components/ui/chart.d.ts +0 -45
  46. package/dist/components/ui/chart.d.ts.map +0 -1
  47. package/dist/components/ui/chart.js +0 -119
  48. package/dist/components/ui/chart.js.map +0 -1
  49. package/dist/shell/assets/index--35CAvcP.js +0 -8715
  50. package/dist/shell/assets/index-COLmoPYo.css +0 -1
  51. package/index.html +0 -12
  52. package/src/App.tsx +0 -44
  53. package/src/__tests__/setup.ts +0 -1
  54. package/src/api/auth.ts +0 -41
  55. package/src/api/boot.ts +0 -10
  56. package/src/api/client.ts +0 -26
  57. package/src/api/paths.ts +0 -3
  58. package/src/api/token.ts +0 -13
  59. package/src/auth/LoginForm.tsx +0 -67
  60. package/src/auth/SessionExpired.tsx +0 -24
  61. package/src/auth/SetupForm.tsx +0 -76
  62. package/src/boot/BootGate.tsx +0 -35
  63. package/src/boot/BootProvider.tsx +0 -28
  64. package/src/boot/types.ts +0 -9
  65. package/src/boot/useBoot.ts +0 -111
  66. package/src/components/Icon.tsx +0 -17
  67. package/src/components/ui/accordion.tsx +0 -82
  68. package/src/components/ui/alert-dialog.tsx +0 -180
  69. package/src/components/ui/alert.tsx +0 -76
  70. package/src/components/ui/aspect-ratio.tsx +0 -9
  71. package/src/components/ui/avatar.tsx +0 -94
  72. package/src/components/ui/badge.tsx +0 -45
  73. package/src/components/ui/breadcrumb.tsx +0 -104
  74. package/src/components/ui/button-group.tsx +0 -78
  75. package/src/components/ui/button.tsx +0 -65
  76. package/src/components/ui/calendar.tsx +0 -187
  77. package/src/components/ui/card.tsx +0 -85
  78. package/src/components/ui/carousel.tsx +0 -229
  79. package/src/components/ui/chart.tsx +0 -339
  80. package/src/components/ui/checkbox.tsx +0 -27
  81. package/src/components/ui/collapsible.tsx +0 -21
  82. package/src/components/ui/combobox.tsx +0 -275
  83. package/src/components/ui/command.tsx +0 -178
  84. package/src/components/ui/context-menu.tsx +0 -242
  85. package/src/components/ui/dialog.tsx +0 -146
  86. package/src/components/ui/direction.tsx +0 -20
  87. package/src/components/ui/drawer.tsx +0 -118
  88. package/src/components/ui/dropdown-menu.tsx +0 -247
  89. package/src/components/ui/empty.tsx +0 -94
  90. package/src/components/ui/field.tsx +0 -224
  91. package/src/components/ui/hover-card.tsx +0 -36
  92. package/src/components/ui/input-group.tsx +0 -142
  93. package/src/components/ui/input-otp.tsx +0 -86
  94. package/src/components/ui/input.tsx +0 -19
  95. package/src/components/ui/item.tsx +0 -182
  96. package/src/components/ui/kbd.tsx +0 -26
  97. package/src/components/ui/label.tsx +0 -19
  98. package/src/components/ui/menubar.tsx +0 -260
  99. package/src/components/ui/native-select.tsx +0 -55
  100. package/src/components/ui/navigation-menu.tsx +0 -160
  101. package/src/components/ui/pagination.tsx +0 -112
  102. package/src/components/ui/popover.tsx +0 -74
  103. package/src/components/ui/progress.tsx +0 -31
  104. package/src/components/ui/radio-group.tsx +0 -42
  105. package/src/components/ui/resizable.tsx +0 -42
  106. package/src/components/ui/scroll-area.tsx +0 -53
  107. package/src/components/ui/select.tsx +0 -185
  108. package/src/components/ui/separator.tsx +0 -26
  109. package/src/components/ui/sheet.tsx +0 -128
  110. package/src/components/ui/sidebar.tsx +0 -669
  111. package/src/components/ui/skeleton.tsx +0 -13
  112. package/src/components/ui/slider.tsx +0 -54
  113. package/src/components/ui/sonner.tsx +0 -43
  114. package/src/components/ui/spinner.tsx +0 -16
  115. package/src/components/ui/switch.tsx +0 -33
  116. package/src/components/ui/table.tsx +0 -87
  117. package/src/components/ui/tabs.tsx +0 -80
  118. package/src/components/ui/textarea.tsx +0 -18
  119. package/src/components/ui/toggle-group.tsx +0 -86
  120. package/src/components/ui/toggle.tsx +0 -44
  121. package/src/components/ui/tooltip.tsx +0 -53
  122. package/src/context/MetaContext.tsx +0 -22
  123. package/src/context/ModuleContext.tsx +0 -62
  124. package/src/context/PermissionsContext.tsx +0 -39
  125. package/src/context/ShellProviders.tsx +0 -33
  126. package/src/context/UserContext.tsx +0 -16
  127. package/src/data/QueryProvider.tsx +0 -7
  128. package/src/data/queryClient.ts +0 -18
  129. package/src/data/useModelMeta.ts +0 -17
  130. package/src/data/useMutation.ts +0 -60
  131. package/src/data/useRecord.ts +0 -29
  132. package/src/data/useSource.ts +0 -112
  133. package/src/hooks/use-mobile.ts +0 -19
  134. package/src/index.css +0 -260
  135. package/src/index.ts +0 -16
  136. package/src/lib/utils.ts +0 -6
  137. package/src/main.tsx +0 -17
  138. package/src/router/NotFound.tsx +0 -8
  139. package/src/router/RouterProvider.tsx +0 -7
  140. package/src/router/buildRouteTree.tsx +0 -63
  141. package/src/router/createShellRouter.ts +0 -9
  142. package/src/router/hooks.ts +0 -43
  143. package/src/shell/CommandPalette.tsx +0 -76
  144. package/src/shell/ConfirmDialog.tsx +0 -34
  145. package/src/shell/ConfirmProvider.tsx +0 -56
  146. package/src/shell/DrawerContext.tsx +0 -44
  147. package/src/shell/HeaderActions.tsx +0 -31
  148. package/src/shell/ModuleSelectorPage.tsx +0 -149
  149. package/src/shell/PageOutlet.tsx +0 -21
  150. package/src/shell/ShellContext.tsx +0 -45
  151. package/src/shell/ShellDevTools.tsx +0 -153
  152. package/src/shell/ShellLayout.tsx +0 -231
  153. package/src/shell/Toast.tsx +0 -58
  154. package/src/shell/ToastProvider.tsx +0 -60
  155. package/src/shell/app-sidebar/AppSidebar.tsx +0 -44
  156. package/src/shell/app-sidebar/ModuleSwitcher.tsx +0 -87
  157. package/src/shell/app-sidebar/NavMain.tsx +0 -64
  158. package/src/shell/app-sidebar/NavUser.tsx +0 -97
  159. package/src/shell/app-sidebar/SearchMenu.tsx +0 -22
  160. package/src/shell/app-sidebar/index.ts +0 -8
  161. package/src/shell/app-sidebar/types.ts +0 -38
  162. package/src/shell/types.ts +0 -6
  163. package/src/shell/useBreadcrumbs.ts +0 -42
  164. package/src/studio/bridge.ts +0 -125
  165. package/src/studio/index.ts +0 -3
  166. package/src/studio/overlay.ts +0 -47
  167. package/src/studio/types.ts +0 -32
  168. package/src/studio/walker.ts +0 -48
  169. package/src/vite-env.d.ts +0 -1
  170. package/src/widgets/__tests__/action-edge-cases.test.ts +0 -281
  171. package/src/widgets/__tests__/action.test.ts +0 -236
  172. package/src/widgets/__tests__/attachment-widget.test.tsx +0 -85
  173. package/src/widgets/__tests__/attachments-widget.test.tsx +0 -109
  174. package/src/widgets/__tests__/binding.test.ts +0 -76
  175. package/src/widgets/__tests__/button-widget.test.tsx +0 -145
  176. package/src/widgets/__tests__/checkbox-widget.test.tsx +0 -158
  177. package/src/widgets/__tests__/code-widget.test.tsx +0 -64
  178. package/src/widgets/__tests__/computed-widget.test.tsx +0 -62
  179. package/src/widgets/__tests__/condition-edge-cases.test.ts +0 -120
  180. package/src/widgets/__tests__/condition.test.ts +0 -221
  181. package/src/widgets/__tests__/context.test.ts +0 -99
  182. package/src/widgets/__tests__/data-widget.test.tsx +0 -204
  183. package/src/widgets/__tests__/datepicker-widget.test.tsx +0 -66
  184. package/src/widgets/__tests__/datetime-widget.test.tsx +0 -67
  185. package/src/widgets/__tests__/drawer-widget.test.tsx +0 -149
  186. package/src/widgets/__tests__/dynamic-link-widget.test.tsx +0 -52
  187. package/src/widgets/__tests__/edge-cases.test.ts +0 -232
  188. package/src/widgets/__tests__/evaluator.test.ts +0 -107
  189. package/src/widgets/__tests__/functions.test.ts +0 -147
  190. package/src/widgets/__tests__/grid-widget.test.tsx +0 -137
  191. package/src/widgets/__tests__/hooks.test.tsx +0 -249
  192. package/src/widgets/__tests__/icon-widget.test.tsx +0 -129
  193. package/src/widgets/__tests__/input-widget.test.tsx +0 -264
  194. package/src/widgets/__tests__/integration.test.ts +0 -116
  195. package/src/widgets/__tests__/json-widget.test.tsx +0 -70
  196. package/src/widgets/__tests__/link-widget.test.tsx +0 -92
  197. package/src/widgets/__tests__/many-to-many-widget.test.tsx +0 -93
  198. package/src/widgets/__tests__/modal-widget.test.tsx +0 -148
  199. package/src/widgets/__tests__/money-widget.test.tsx +0 -97
  200. package/src/widgets/__tests__/parser.test.ts +0 -171
  201. package/src/widgets/__tests__/reactive-variables.test.ts +0 -383
  202. package/src/widgets/__tests__/renderer.test.tsx +0 -300
  203. package/src/widgets/__tests__/repeat-widget.test.tsx +0 -229
  204. package/src/widgets/__tests__/select-widget.test.tsx +0 -231
  205. package/src/widgets/__tests__/sequence-widget.test.tsx +0 -58
  206. package/src/widgets/__tests__/shell-integration.test.tsx +0 -1343
  207. package/src/widgets/__tests__/split-widget.test.tsx +0 -133
  208. package/src/widgets/__tests__/state-edge-cases.test.ts +0 -118
  209. package/src/widgets/__tests__/state.test.ts +0 -106
  210. package/src/widgets/__tests__/table-data-binding.test.tsx +0 -482
  211. package/src/widgets/__tests__/table-filter-popover.test.tsx +0 -486
  212. package/src/widgets/__tests__/table-search.test.tsx +0 -305
  213. package/src/widgets/__tests__/table-widget.test.tsx +0 -509
  214. package/src/widgets/__tests__/textarea-widget.test.tsx +0 -105
  215. package/src/widgets/__tests__/tracker-validator-edge-cases.test.ts +0 -242
  216. package/src/widgets/__tests__/tracker.test.ts +0 -133
  217. package/src/widgets/__tests__/tree-widget.test.tsx +0 -97
  218. package/src/widgets/__tests__/use-model-source.test.ts +0 -67
  219. package/src/widgets/__tests__/validator.test.ts +0 -208
  220. package/src/widgets/action/dispatcher.ts +0 -334
  221. package/src/widgets/action/index.ts +0 -2
  222. package/src/widgets/binding/index.ts +0 -2
  223. package/src/widgets/binding/resolver.ts +0 -61
  224. package/src/widgets/components/AttachmentWidget.tsx +0 -111
  225. package/src/widgets/components/AttachmentsWidget.tsx +0 -121
  226. package/src/widgets/components/BadgeWidget.tsx +0 -35
  227. package/src/widgets/components/ButtonWidget.tsx +0 -43
  228. package/src/widgets/components/CardWidget.tsx +0 -68
  229. package/src/widgets/components/CheckboxWidget.tsx +0 -39
  230. package/src/widgets/components/CodeWidget.tsx +0 -44
  231. package/src/widgets/components/ColumnWidget.tsx +0 -22
  232. package/src/widgets/components/ComputedWidget.tsx +0 -49
  233. package/src/widgets/components/DataWidget.tsx +0 -189
  234. package/src/widgets/components/DatePickerWidget.tsx +0 -73
  235. package/src/widgets/components/DatetimeWidget.tsx +0 -160
  236. package/src/widgets/components/DividerWidget.tsx +0 -37
  237. package/src/widgets/components/DrawerWidget.tsx +0 -52
  238. package/src/widgets/components/DynamicLinkWidget.tsx +0 -130
  239. package/src/widgets/components/GridWidget.tsx +0 -134
  240. package/src/widgets/components/GroupWidget.tsx +0 -111
  241. package/src/widgets/components/IconWidget.tsx +0 -29
  242. package/src/widgets/components/ImageWidget.tsx +0 -28
  243. package/src/widgets/components/InputWidget.tsx +0 -70
  244. package/src/widgets/components/JsonWidget.tsx +0 -78
  245. package/src/widgets/components/LinkWidget.tsx +0 -99
  246. package/src/widgets/components/ManyToManyWidget.tsx +0 -125
  247. package/src/widgets/components/ModalWidget.tsx +0 -52
  248. package/src/widgets/components/MoneyWidget.tsx +0 -80
  249. package/src/widgets/components/RepeatWidget.tsx +0 -66
  250. package/src/widgets/components/ScrollAreaWidget.tsx +0 -40
  251. package/src/widgets/components/SectionWidget.tsx +0 -78
  252. package/src/widgets/components/SelectWidget.tsx +0 -63
  253. package/src/widgets/components/SequenceWidget.tsx +0 -32
  254. package/src/widgets/components/SpacerWidget.tsx +0 -29
  255. package/src/widgets/components/SplitWidget.tsx +0 -60
  256. package/src/widgets/components/StackWidget.tsx +0 -44
  257. package/src/widgets/components/TableWidget.tsx +0 -366
  258. package/src/widgets/components/TextWidget.tsx +0 -44
  259. package/src/widgets/components/TextareaWidget.tsx +0 -49
  260. package/src/widgets/components/TreeWidget.tsx +0 -109
  261. package/src/widgets/components/index.ts +0 -30
  262. package/src/widgets/components/register.ts +0 -93
  263. package/src/widgets/components/table/CellRenderers.tsx +0 -83
  264. package/src/widgets/components/table/TablePagination.tsx +0 -45
  265. package/src/widgets/components/table/TableToolbar.tsx +0 -285
  266. package/src/widgets/components/table/filter-operators.ts +0 -134
  267. package/src/widgets/components/table/index.ts +0 -11
  268. package/src/widgets/condition/evaluator.ts +0 -57
  269. package/src/widgets/condition/index.ts +0 -1
  270. package/src/widgets/context/builder.ts +0 -99
  271. package/src/widgets/context/index.ts +0 -8
  272. package/src/widgets/context/types.ts +0 -37
  273. package/src/widgets/data/index.ts +0 -5
  274. package/src/widgets/data/useModelQuery.ts +0 -116
  275. package/src/widgets/data/useModelRecord.ts +0 -37
  276. package/src/widgets/expression/evaluator.ts +0 -100
  277. package/src/widgets/expression/functions.ts +0 -131
  278. package/src/widgets/expression/index.ts +0 -13
  279. package/src/widgets/expression/parser.ts +0 -229
  280. package/src/widgets/expression/types.ts +0 -45
  281. package/src/widgets/form/FormContext.ts +0 -29
  282. package/src/widgets/form/FormProvider.tsx +0 -84
  283. package/src/widgets/form/FormWidget.tsx +0 -42
  284. package/src/widgets/form/index.ts +0 -4
  285. package/src/widgets/form/useFormState.ts +0 -127
  286. package/src/widgets/form/useFormSubmit.ts +0 -90
  287. package/src/widgets/form/useFormValidation.ts +0 -62
  288. package/src/widgets/hooks/index.ts +0 -8
  289. package/src/widgets/hooks/useAction.ts +0 -83
  290. package/src/widgets/hooks/useBind.ts +0 -34
  291. package/src/widgets/hooks/useCondition.ts +0 -21
  292. package/src/widgets/hooks/useDataQuery.ts +0 -48
  293. package/src/widgets/hooks/useExpression.ts +0 -14
  294. package/src/widgets/hooks/usePageState.ts +0 -21
  295. package/src/widgets/hooks/useSurfaceContext.ts +0 -11
  296. package/src/widgets/hooks/useWidgetContext.ts +0 -14
  297. package/src/widgets/index.ts +0 -80
  298. package/src/widgets/lib/layout-props.ts +0 -135
  299. package/src/widgets/reactivity/index.ts +0 -11
  300. package/src/widgets/reactivity/tracker.ts +0 -139
  301. package/src/widgets/reactivity/variables.ts +0 -213
  302. package/src/widgets/registry.ts +0 -41
  303. package/src/widgets/renderer/SlotRenderer.tsx +0 -47
  304. package/src/widgets/renderer/WidgetRenderer.tsx +0 -191
  305. package/src/widgets/renderer/index.ts +0 -4
  306. package/src/widgets/shell/WidgetSlotRenderer.tsx +0 -73
  307. package/src/widgets/shell/index.ts +0 -4
  308. package/src/widgets/shell/useActionHandlers.ts +0 -170
  309. package/src/widgets/state/index.ts +0 -2
  310. package/src/widgets/state/store.ts +0 -96
  311. package/src/widgets/types.ts +0 -28
  312. package/src/widgets/validation/index.ts +0 -2
  313. package/src/widgets/validation/validator.ts +0 -140
  314. package/tsconfig.json +0 -27
  315. package/tsconfig.tsbuildinfo +0 -1
  316. package/vite.config.ts +0 -21
  317. package/vitest.config.ts +0 -16
@@ -1,224 +0,0 @@
1
- 'use client';
2
-
3
- import { useMemo } from 'react';
4
- import { cva, type VariantProps } from 'class-variance-authority';
5
-
6
- import { cn } from '@/lib/utils';
7
- import { Label } from '@/components/ui/label';
8
- import { Separator } from '@/components/ui/separator';
9
-
10
- function FieldSet({ className, ...props }: React.ComponentProps<'fieldset'>) {
11
- return (
12
- <fieldset
13
- data-slot="field-set"
14
- className={cn(
15
- 'flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3',
16
- className,
17
- )}
18
- {...props}
19
- />
20
- );
21
- }
22
-
23
- function FieldLegend({
24
- className,
25
- variant = 'legend',
26
- ...props
27
- }: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {
28
- return (
29
- <legend
30
- data-slot="field-legend"
31
- data-variant={variant}
32
- className={cn(
33
- 'mb-2.5 font-medium data-[variant=label]:text-xs data-[variant=legend]:text-sm',
34
- className,
35
- )}
36
- {...props}
37
- />
38
- );
39
- }
40
-
41
- function FieldGroup({ className, ...props }: React.ComponentProps<'div'>) {
42
- return (
43
- <div
44
- data-slot="field-group"
45
- className={cn(
46
- 'group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4',
47
- className,
48
- )}
49
- {...props}
50
- />
51
- );
52
- }
53
-
54
- const fieldVariants = cva('group/field flex w-full gap-2 data-[invalid=true]:text-destructive', {
55
- variants: {
56
- orientation: {
57
- vertical: 'flex-col *:w-full [&>.sr-only]:w-auto',
58
- horizontal:
59
- 'flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',
60
- responsive:
61
- 'flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',
62
- },
63
- },
64
- defaultVariants: {
65
- orientation: 'vertical',
66
- },
67
- });
68
-
69
- function Field({
70
- className,
71
- orientation = 'vertical',
72
- ...props
73
- }: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>) {
74
- return (
75
- <div
76
- role="group"
77
- data-slot="field"
78
- data-orientation={orientation}
79
- className={cn(fieldVariants({ orientation }), className)}
80
- {...props}
81
- />
82
- );
83
- }
84
-
85
- function FieldContent({ className, ...props }: React.ComponentProps<'div'>) {
86
- return (
87
- <div
88
- data-slot="field-content"
89
- className={cn('group/field-content flex flex-1 flex-col gap-0.5 leading-snug', className)}
90
- {...props}
91
- />
92
- );
93
- }
94
-
95
- function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>) {
96
- return (
97
- <Label
98
- data-slot="field-label"
99
- className={cn(
100
- 'group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-none has-[>[data-slot=field]]:border *:data-[slot=field]:p-2 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10',
101
- 'has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col',
102
- className,
103
- )}
104
- {...props}
105
- />
106
- );
107
- }
108
-
109
- function FieldTitle({ className, ...props }: React.ComponentProps<'div'>) {
110
- return (
111
- <div
112
- data-slot="field-label"
113
- className={cn(
114
- 'flex w-fit items-center gap-2 text-xs/relaxed group-data-[disabled=true]/field:opacity-50',
115
- className,
116
- )}
117
- {...props}
118
- />
119
- );
120
- }
121
-
122
- function FieldDescription({ className, ...props }: React.ComponentProps<'p'>) {
123
- return (
124
- <p
125
- data-slot="field-description"
126
- className={cn(
127
- 'text-left text-xs/relaxed leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5',
128
- 'last:mt-0 nth-last-2:-mt-1',
129
- '[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary',
130
- className,
131
- )}
132
- {...props}
133
- />
134
- );
135
- }
136
-
137
- function FieldSeparator({
138
- children,
139
- className,
140
- ...props
141
- }: React.ComponentProps<'div'> & {
142
- children?: React.ReactNode;
143
- }) {
144
- return (
145
- <div
146
- data-slot="field-separator"
147
- data-content={!!children}
148
- className={cn(
149
- 'relative -my-2 h-5 text-xs group-data-[variant=outline]/field-group:-mb-2',
150
- className,
151
- )}
152
- {...props}
153
- >
154
- <Separator className="absolute inset-0 top-1/2" />
155
- {children && (
156
- <span
157
- className="relative mx-auto block w-fit bg-background px-2 text-muted-foreground"
158
- data-slot="field-separator-content"
159
- >
160
- {children}
161
- </span>
162
- )}
163
- </div>
164
- );
165
- }
166
-
167
- function FieldError({
168
- className,
169
- children,
170
- errors,
171
- ...props
172
- }: React.ComponentProps<'div'> & {
173
- errors?: Array<{ message?: string } | undefined>;
174
- }) {
175
- const content = useMemo(() => {
176
- if (children) {
177
- return children;
178
- }
179
-
180
- if (!errors?.length) {
181
- return null;
182
- }
183
-
184
- const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()];
185
-
186
- if (uniqueErrors?.length == 1) {
187
- return uniqueErrors[0]?.message;
188
- }
189
-
190
- return (
191
- <ul className="ml-4 flex list-disc flex-col gap-1">
192
- {uniqueErrors.map((error, index) => error?.message && <li key={index}>{error.message}</li>)}
193
- </ul>
194
- );
195
- }, [children, errors]);
196
-
197
- if (!content) {
198
- return null;
199
- }
200
-
201
- return (
202
- <div
203
- role="alert"
204
- data-slot="field-error"
205
- className={cn('text-xs font-normal text-destructive', className)}
206
- {...props}
207
- >
208
- {content}
209
- </div>
210
- );
211
- }
212
-
213
- export {
214
- Field,
215
- FieldLabel,
216
- FieldDescription,
217
- FieldError,
218
- FieldGroup,
219
- FieldLegend,
220
- FieldSeparator,
221
- FieldSet,
222
- FieldContent,
223
- FieldTitle,
224
- };
@@ -1,36 +0,0 @@
1
- import * as React from 'react';
2
- import { HoverCard as HoverCardPrimitive } from 'radix-ui';
3
-
4
- import { cn } from '@/lib/utils';
5
-
6
- function HoverCard({ ...props }: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
7
- return <HoverCardPrimitive.Root data-slot="hover-card" {...props} />;
8
- }
9
-
10
- function HoverCardTrigger({ ...props }: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {
11
- return <HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />;
12
- }
13
-
14
- function HoverCardContent({
15
- className,
16
- align = 'center',
17
- sideOffset = 4,
18
- ...props
19
- }: React.ComponentProps<typeof HoverCardPrimitive.Content>) {
20
- return (
21
- <HoverCardPrimitive.Portal data-slot="hover-card-portal">
22
- <HoverCardPrimitive.Content
23
- data-slot="hover-card-content"
24
- align={align}
25
- sideOffset={sideOffset}
26
- className={cn(
27
- 'z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-none bg-popover p-2.5 text-xs/relaxed text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
28
- className,
29
- )}
30
- {...props}
31
- />
32
- </HoverCardPrimitive.Portal>
33
- );
34
- }
35
-
36
- export { HoverCard, HoverCardTrigger, HoverCardContent };
@@ -1,142 +0,0 @@
1
- import * as React from 'react';
2
- import { cva, type VariantProps } from 'class-variance-authority';
3
-
4
- import { cn } from '@/lib/utils';
5
- import { Button } from '@/components/ui/button';
6
- import { Input } from '@/components/ui/input';
7
- import { Textarea } from '@/components/ui/textarea';
8
-
9
- function InputGroup({ className, ...props }: React.ComponentProps<'div'>) {
10
- return (
11
- <div
12
- data-slot="input-group"
13
- role="group"
14
- className={cn(
15
- 'group/input-group relative flex h-8 w-full min-w-0 items-center rounded-none border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-1 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-1 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5',
16
- className,
17
- )}
18
- {...props}
19
- />
20
- );
21
- }
22
-
23
- const inputGroupAddonVariants = cva(
24
- "flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-xs font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-none [&>svg:not([class*='size-'])]:size-4",
25
- {
26
- variants: {
27
- align: {
28
- 'inline-start': 'order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]',
29
- 'inline-end': 'order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]',
30
- 'block-start':
31
- 'order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2',
32
- 'block-end':
33
- 'order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2',
34
- },
35
- },
36
- defaultVariants: {
37
- align: 'inline-start',
38
- },
39
- },
40
- );
41
-
42
- function InputGroupAddon({
43
- className,
44
- align = 'inline-start',
45
- ...props
46
- }: React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>) {
47
- return (
48
- <div
49
- role="group"
50
- data-slot="input-group-addon"
51
- data-align={align}
52
- className={cn(inputGroupAddonVariants({ align }), className)}
53
- onClick={(e) => {
54
- if ((e.target as HTMLElement).closest('button')) {
55
- return;
56
- }
57
- e.currentTarget.parentElement?.querySelector('input')?.focus();
58
- }}
59
- {...props}
60
- />
61
- );
62
- }
63
-
64
- const inputGroupButtonVariants = cva('flex items-center gap-2 text-xs shadow-none', {
65
- variants: {
66
- size: {
67
- xs: "h-6 gap-1 rounded-none px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
68
- sm: 'gap-1',
69
- 'icon-xs': 'size-6 rounded-none p-0 has-[>svg]:p-0',
70
- 'icon-sm': 'size-7 p-0 has-[>svg]:p-0',
71
- },
72
- },
73
- defaultVariants: {
74
- size: 'xs',
75
- },
76
- });
77
-
78
- function InputGroupButton({
79
- className,
80
- type = 'button',
81
- variant = 'ghost',
82
- size = 'xs',
83
- ...props
84
- }: Omit<React.ComponentProps<typeof Button>, 'size'> &
85
- VariantProps<typeof inputGroupButtonVariants>) {
86
- return (
87
- <Button
88
- type={type}
89
- data-size={size}
90
- variant={variant}
91
- className={cn(inputGroupButtonVariants({ size }), className)}
92
- {...props}
93
- />
94
- );
95
- }
96
-
97
- function InputGroupText({ className, ...props }: React.ComponentProps<'span'>) {
98
- return (
99
- <span
100
- className={cn(
101
- "flex items-center gap-2 text-xs text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
102
- className,
103
- )}
104
- {...props}
105
- />
106
- );
107
- }
108
-
109
- function InputGroupInput({ className, ...props }: React.ComponentProps<'input'>) {
110
- return (
111
- <Input
112
- data-slot="input-group-control"
113
- className={cn(
114
- 'flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent',
115
- className,
116
- )}
117
- {...props}
118
- />
119
- );
120
- }
121
-
122
- function InputGroupTextarea({ className, ...props }: React.ComponentProps<'textarea'>) {
123
- return (
124
- <Textarea
125
- data-slot="input-group-control"
126
- className={cn(
127
- 'flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent',
128
- className,
129
- )}
130
- {...props}
131
- />
132
- );
133
- }
134
-
135
- export {
136
- InputGroup,
137
- InputGroupAddon,
138
- InputGroupButton,
139
- InputGroupText,
140
- InputGroupInput,
141
- InputGroupTextarea,
142
- };
@@ -1,86 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { OTPInput, OTPInputContext } from 'input-otp';
5
-
6
- import { cn } from '@/lib/utils';
7
- import { MinusIcon } from 'lucide-react';
8
-
9
- function InputOTP({
10
- className,
11
- containerClassName,
12
- ...props
13
- }: React.ComponentProps<typeof OTPInput> & {
14
- containerClassName?: string;
15
- }) {
16
- return (
17
- <OTPInput
18
- data-slot="input-otp"
19
- containerClassName={cn(
20
- 'cn-input-otp flex items-center has-disabled:opacity-50',
21
- containerClassName,
22
- )}
23
- spellCheck={false}
24
- className={cn('disabled:cursor-not-allowed', className)}
25
- {...props}
26
- />
27
- );
28
- }
29
-
30
- function InputOTPGroup({ className, ...props }: React.ComponentProps<'div'>) {
31
- return (
32
- <div
33
- data-slot="input-otp-group"
34
- className={cn(
35
- 'flex items-center rounded-none has-aria-invalid:border-destructive has-aria-invalid:ring-1 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40',
36
- className,
37
- )}
38
- {...props}
39
- />
40
- );
41
- }
42
-
43
- function InputOTPSlot({
44
- index,
45
- className,
46
- ...props
47
- }: React.ComponentProps<'div'> & {
48
- index: number;
49
- }) {
50
- const inputOTPContext = React.useContext(OTPInputContext);
51
- const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
52
-
53
- return (
54
- <div
55
- data-slot="input-otp-slot"
56
- data-active={isActive}
57
- className={cn(
58
- 'relative flex size-8 items-center justify-center border-y border-r border-input text-xs transition-all outline-none first:rounded-none first:border-l last:rounded-none aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-1 data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40',
59
- className,
60
- )}
61
- {...props}
62
- >
63
- {char}
64
- {hasFakeCaret && (
65
- <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
66
- <div className="h-4 w-px animate-caret-blink bg-foreground duration-1000" />
67
- </div>
68
- )}
69
- </div>
70
- );
71
- }
72
-
73
- function InputOTPSeparator({ ...props }: React.ComponentProps<'div'>) {
74
- return (
75
- <div
76
- data-slot="input-otp-separator"
77
- className="flex items-center [&_svg:not([class*='size-'])]:size-4"
78
- role="separator"
79
- {...props}
80
- >
81
- <MinusIcon />
82
- </div>
83
- );
84
- }
85
-
86
- export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
@@ -1,19 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import { cn } from '@/lib/utils';
4
-
5
- function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
6
- return (
7
- <input
8
- type={type}
9
- data-slot="input"
10
- className={cn(
11
- 'h-8 w-full min-w-0 rounded-none border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40',
12
- className,
13
- )}
14
- {...props}
15
- />
16
- );
17
- }
18
-
19
- export { Input };
@@ -1,182 +0,0 @@
1
- import * as React from 'react';
2
- import { cva, type VariantProps } from 'class-variance-authority';
3
- import { Slot } from 'radix-ui';
4
-
5
- import { cn } from '@/lib/utils';
6
- import { Separator } from '@/components/ui/separator';
7
-
8
- function ItemGroup({ className, ...props }: React.ComponentProps<'div'>) {
9
- return (
10
- <div
11
- role="list"
12
- data-slot="item-group"
13
- className={cn(
14
- 'group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2',
15
- className,
16
- )}
17
- {...props}
18
- />
19
- );
20
- }
21
-
22
- function ItemSeparator({ className, ...props }: React.ComponentProps<typeof Separator>) {
23
- return (
24
- <Separator
25
- data-slot="item-separator"
26
- orientation="horizontal"
27
- className={cn('my-2', className)}
28
- {...props}
29
- />
30
- );
31
- }
32
-
33
- const itemVariants = cva(
34
- 'group/item flex w-full flex-wrap items-center rounded-none border text-xs transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted',
35
- {
36
- variants: {
37
- variant: {
38
- default: 'border-transparent',
39
- outline: 'border-border',
40
- muted: 'border-transparent bg-muted/50',
41
- },
42
- size: {
43
- default: 'gap-2.5 px-3 py-2.5',
44
- sm: 'gap-2.5 px-3 py-2.5',
45
- xs: 'gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0',
46
- },
47
- },
48
- defaultVariants: {
49
- variant: 'default',
50
- size: 'default',
51
- },
52
- },
53
- );
54
-
55
- function Item({
56
- className,
57
- variant = 'default',
58
- size = 'default',
59
- asChild = false,
60
- ...props
61
- }: React.ComponentProps<'div'> & VariantProps<typeof itemVariants> & { asChild?: boolean }) {
62
- const Comp = asChild ? Slot.Root : 'div';
63
- return (
64
- <Comp
65
- data-slot="item"
66
- data-variant={variant}
67
- data-size={size}
68
- className={cn(itemVariants({ variant, size, className }))}
69
- {...props}
70
- />
71
- );
72
- }
73
-
74
- const itemMediaVariants = cva(
75
- 'flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none',
76
- {
77
- variants: {
78
- variant: {
79
- default: 'bg-transparent',
80
- icon: "[&_svg:not([class*='size-'])]:size-4",
81
- image:
82
- 'size-10 overflow-hidden rounded-none group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover',
83
- },
84
- },
85
- defaultVariants: {
86
- variant: 'default',
87
- },
88
- },
89
- );
90
-
91
- function ItemMedia({
92
- className,
93
- variant = 'default',
94
- ...props
95
- }: React.ComponentProps<'div'> & VariantProps<typeof itemMediaVariants>) {
96
- return (
97
- <div
98
- data-slot="item-media"
99
- data-variant={variant}
100
- className={cn(itemMediaVariants({ variant, className }))}
101
- {...props}
102
- />
103
- );
104
- }
105
-
106
- function ItemContent({ className, ...props }: React.ComponentProps<'div'>) {
107
- return (
108
- <div
109
- data-slot="item-content"
110
- className={cn(
111
- 'flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none',
112
- className,
113
- )}
114
- {...props}
115
- />
116
- );
117
- }
118
-
119
- function ItemTitle({ className, ...props }: React.ComponentProps<'div'>) {
120
- return (
121
- <div
122
- data-slot="item-title"
123
- className={cn(
124
- 'line-clamp-1 flex w-fit items-center gap-2 text-xs font-medium underline-offset-4',
125
- className,
126
- )}
127
- {...props}
128
- />
129
- );
130
- }
131
-
132
- function ItemDescription({ className, ...props }: React.ComponentProps<'p'>) {
133
- return (
134
- <p
135
- data-slot="item-description"
136
- className={cn(
137
- 'line-clamp-2 text-left text-xs/relaxed font-normal text-muted-foreground group-data-[size=xs]/item:text-xs/relaxed [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary',
138
- className,
139
- )}
140
- {...props}
141
- />
142
- );
143
- }
144
-
145
- function ItemActions({ className, ...props }: React.ComponentProps<'div'>) {
146
- return (
147
- <div data-slot="item-actions" className={cn('flex items-center gap-2', className)} {...props} />
148
- );
149
- }
150
-
151
- function ItemHeader({ className, ...props }: React.ComponentProps<'div'>) {
152
- return (
153
- <div
154
- data-slot="item-header"
155
- className={cn('flex basis-full items-center justify-between gap-2', className)}
156
- {...props}
157
- />
158
- );
159
- }
160
-
161
- function ItemFooter({ className, ...props }: React.ComponentProps<'div'>) {
162
- return (
163
- <div
164
- data-slot="item-footer"
165
- className={cn('flex basis-full items-center justify-between gap-2', className)}
166
- {...props}
167
- />
168
- );
169
- }
170
-
171
- export {
172
- Item,
173
- ItemMedia,
174
- ItemContent,
175
- ItemActions,
176
- ItemGroup,
177
- ItemSeparator,
178
- ItemTitle,
179
- ItemDescription,
180
- ItemHeader,
181
- ItemFooter,
182
- };