@tscircuit/cli 0.0.394 → 0.1.2

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 (246) hide show
  1. package/.github/workflows/bun-formatcheck.yml +26 -0
  2. package/.github/workflows/bun-pver-release.yml +25 -0
  3. package/.github/workflows/{typecheck.yml → bun-typecheck.yml} +0 -3
  4. package/LICENSE +21 -0
  5. package/README.md +33 -36
  6. package/biome.json +9 -9
  7. package/bun.lockb +0 -0
  8. package/cli/CliContext.ts +8 -0
  9. package/cli/auth/login/register.ts +73 -0
  10. package/cli/auth/logout/register.ts +11 -0
  11. package/cli/auth/register.ts +5 -0
  12. package/cli/clone/register.ts +99 -0
  13. package/cli/config/print/register.ts +12 -0
  14. package/cli/config/register.ts +5 -0
  15. package/cli/dev/register.ts +111 -0
  16. package/cli/main.ts +33 -0
  17. package/dist/main.js +537 -0
  18. package/docs/file-server-api-usage.md +57 -0
  19. package/docs/run-frame-usage.md +14 -0
  20. package/example-dir/manual-edits.json +1 -0
  21. package/example-dir/snippet.d.ts +13 -0
  22. package/example-dir/snippet.tsx +20 -0
  23. package/example-dir/types.d.ts +11 -0
  24. package/lib/cli-config/TypedConfigStore.ts +50 -0
  25. package/lib/cli-config/index.ts +16 -0
  26. package/lib/dependency-analysis/DependencyAnalyzer.ts +129 -0
  27. package/lib/dependency-analysis/getLocalFileDependencies.ts +101 -0
  28. package/lib/dependency-analysis/installNodeModuleTypes.ts +74 -0
  29. package/lib/index.ts +2 -0
  30. package/lib/project-config/index.ts +5 -0
  31. package/lib/registry-api/endpoint-types.ts +20 -0
  32. package/lib/registry-api/get-ky.ts +30 -0
  33. package/lib/server/EventsWatcher.ts +75 -0
  34. package/lib/server/createServer.ts +62 -0
  35. package/lib/site/getIndex.ts +18 -0
  36. package/package.json +27 -144
  37. package/tsconfig.json +25 -22
  38. package/.github/workflows/formatbot.yml +0 -63
  39. package/.github/workflows/release.yml +0 -40
  40. package/.github/workflows/test.yml +0 -32
  41. package/.github/workflows/windows-tests.yml +0 -32
  42. package/.prettierrc +0 -1
  43. package/DEVELOPMENT.md +0 -7
  44. package/api/README.md +0 -3
  45. package/api/db/generic-json-level.ts +0 -123
  46. package/api/db/get-db.ts +0 -26
  47. package/api/db/schema.ts +0 -65
  48. package/api/db/zod-level-db.ts +0 -148
  49. package/api/index.ts +0 -4
  50. package/api/lib/middlewares/with-db.ts +0 -18
  51. package/api/lib/middlewares/with-debug-request-logging.ts +0 -13
  52. package/api/lib/middlewares/with-error-response.ts +0 -37
  53. package/api/lib/with-winter-spec.ts +0 -9
  54. package/api/lib/zod/export_parameters.ts +0 -25
  55. package/api/routes/api/db/download.ts +0 -25
  56. package/api/routes/api/dev_package_examples/create.ts +0 -43
  57. package/api/routes/api/dev_package_examples/get.ts +0 -46
  58. package/api/routes/api/dev_package_examples/list.ts +0 -36
  59. package/api/routes/api/dev_package_examples/update.ts +0 -59
  60. package/api/routes/api/dev_server/reset.ts +0 -13
  61. package/api/routes/api/export_files/create.ts +0 -27
  62. package/api/routes/api/export_files/download.ts +0 -25
  63. package/api/routes/api/export_requests/create.ts +0 -30
  64. package/api/routes/api/export_requests/get.ts +0 -43
  65. package/api/routes/api/export_requests/list.ts +0 -26
  66. package/api/routes/api/export_requests/update.ts +0 -34
  67. package/api/routes/api/health.ts +0 -11
  68. package/api/routes/api/package_info/create.ts +0 -26
  69. package/api/routes/api/package_info/get.ts +0 -16
  70. package/api/routes/health.ts +0 -11
  71. package/api/routes/index.ts +0 -16
  72. package/api/server.ts +0 -20
  73. package/api/static-routes.ts +0 -24
  74. package/api/tests/fixtures/get-test-server.ts +0 -31
  75. package/api/tests/fixtures/start-server.ts +0 -41
  76. package/api/tests/routes/dev_package_examples/create.test.ts +0 -19
  77. package/api/tests/routes/dev_package_examples/get.test.ts +0 -25
  78. package/api/tests/routes/dev_package_examples/list.test.ts +0 -32
  79. package/api/tests/routes/dev_package_examples/update.test.ts +0 -38
  80. package/api/tests/routes/export_files/create.test.ts +0 -18
  81. package/api/tests/routes/export_files/download.test.ts +0 -29
  82. package/api/tests/routes/export_requests/create.test.ts +0 -24
  83. package/api/tests/routes/export_requests/get.test.ts +0 -41
  84. package/api/tests/routes/export_requests/list.test.ts +0 -35
  85. package/api/tests/routes/export_requests/update.test.ts +0 -50
  86. package/api/tests/routes/health.test.ts +0 -10
  87. package/bunfig.toml +0 -2
  88. package/cli/cli.ts +0 -13
  89. package/cli/lib/cmd-fns/add.ts +0 -34
  90. package/cli/lib/cmd-fns/auth-login.ts +0 -59
  91. package/cli/lib/cmd-fns/auth-logout.ts +0 -7
  92. package/cli/lib/cmd-fns/auth-sessions-create.ts +0 -3
  93. package/cli/lib/cmd-fns/auth-sessions-get.ts +0 -3
  94. package/cli/lib/cmd-fns/auth-sessions-list.ts +0 -5
  95. package/cli/lib/cmd-fns/config-clear.ts +0 -5
  96. package/cli/lib/cmd-fns/config-print-config.ts +0 -6
  97. package/cli/lib/cmd-fns/config-reveal-location.ts +0 -5
  98. package/cli/lib/cmd-fns/config-set-log-requests.ts +0 -7
  99. package/cli/lib/cmd-fns/config-set-registry.ts +0 -9
  100. package/cli/lib/cmd-fns/config-set-runtime.ts +0 -7
  101. package/cli/lib/cmd-fns/config-set-session.ts +0 -7
  102. package/cli/lib/cmd-fns/dev/check-if-initialized.ts +0 -22
  103. package/cli/lib/cmd-fns/dev/derive-selector-from-pcb-component-id.ts +0 -23
  104. package/cli/lib/cmd-fns/dev/dev-server-request-handler.ts +0 -61
  105. package/cli/lib/cmd-fns/dev/find-available-port.ts +0 -32
  106. package/cli/lib/cmd-fns/dev/fulfill-export-requests.ts +0 -162
  107. package/cli/lib/cmd-fns/dev/get-dev-server-axios.ts +0 -29
  108. package/cli/lib/cmd-fns/dev/index.ts +0 -168
  109. package/cli/lib/cmd-fns/dev/infer-export-name-from-source.ts +0 -17
  110. package/cli/lib/cmd-fns/dev/mark-all-examples-loading.ts +0 -18
  111. package/cli/lib/cmd-fns/dev/soupify-and-upload-example-file.ts +0 -62
  112. package/cli/lib/cmd-fns/dev/start-dev-server.ts +0 -34
  113. package/cli/lib/cmd-fns/dev/start-edit-event-watcher.ts +0 -347
  114. package/cli/lib/cmd-fns/dev/start-export-request-watcher.ts +0 -33
  115. package/cli/lib/cmd-fns/dev/start-fs-watcher.ts +0 -54
  116. package/cli/lib/cmd-fns/dev/upload-examples-from-directory.ts +0 -42
  117. package/cli/lib/cmd-fns/dev-server-fulfill-export-requests.ts +0 -43
  118. package/cli/lib/cmd-fns/dev-server-upload.ts +0 -56
  119. package/cli/lib/cmd-fns/export-gerbers.ts +0 -28
  120. package/cli/lib/cmd-fns/export-kicad-pcb.ts +0 -36
  121. package/cli/lib/cmd-fns/export-pnp-csv.ts +0 -32
  122. package/cli/lib/cmd-fns/gen-jlcpcb-component.ts +0 -64
  123. package/cli/lib/cmd-fns/go.ts +0 -14
  124. package/cli/lib/cmd-fns/index.ts +0 -46
  125. package/cli/lib/cmd-fns/init/create-or-modify-npmrc.ts +0 -21
  126. package/cli/lib/cmd-fns/init/get-generated-npmrc.ts +0 -8
  127. package/cli/lib/cmd-fns/init/get-generated-readme.ts +0 -41
  128. package/cli/lib/cmd-fns/init/get-generated-tsconfig.ts +0 -34
  129. package/cli/lib/cmd-fns/init/index.ts +0 -193
  130. package/cli/lib/cmd-fns/install.ts +0 -34
  131. package/cli/lib/cmd-fns/lint.ts +0 -43
  132. package/cli/lib/cmd-fns/open.ts +0 -19
  133. package/cli/lib/cmd-fns/package-examples-create.ts +0 -36
  134. package/cli/lib/cmd-fns/package-examples-get.ts +0 -20
  135. package/cli/lib/cmd-fns/package-examples-list.ts +0 -18
  136. package/cli/lib/cmd-fns/package-files-create.ts +0 -31
  137. package/cli/lib/cmd-fns/package-files-download.ts +0 -29
  138. package/cli/lib/cmd-fns/package-files-get.ts +0 -3
  139. package/cli/lib/cmd-fns/package-files-list.ts +0 -28
  140. package/cli/lib/cmd-fns/package-files-upload-directory.ts +0 -6
  141. package/cli/lib/cmd-fns/package-releases-create.ts +0 -35
  142. package/cli/lib/cmd-fns/package-releases-get.ts +0 -3
  143. package/cli/lib/cmd-fns/package-releases-list.ts +0 -32
  144. package/cli/lib/cmd-fns/package-releases-update.ts +0 -45
  145. package/cli/lib/cmd-fns/packages-create.ts +0 -16
  146. package/cli/lib/cmd-fns/packages-get.ts +0 -16
  147. package/cli/lib/cmd-fns/packages-list.ts +0 -16
  148. package/cli/lib/cmd-fns/publish/index.ts +0 -336
  149. package/cli/lib/cmd-fns/remove.ts +0 -31
  150. package/cli/lib/cmd-fns/render.ts +0 -45
  151. package/cli/lib/cmd-fns/soupify.ts +0 -31
  152. package/cli/lib/cmd-fns/uninstall.ts +0 -31
  153. package/cli/lib/cmd-fns/version.ts +0 -38
  154. package/cli/lib/create-config-manager.ts +0 -97
  155. package/cli/lib/export-fns/export-bom-csv.ts +0 -32
  156. package/cli/lib/export-fns/export-gerbers.ts +0 -108
  157. package/cli/lib/export-fns/export-kicad-pcb.ts +0 -32
  158. package/cli/lib/export-fns/export-pnp-csv.ts +0 -31
  159. package/cli/lib/get-program.ts +0 -387
  160. package/cli/lib/param-handlers/index.ts +0 -21
  161. package/cli/lib/param-handlers/interact-for-local-directory.ts +0 -58
  162. package/cli/lib/param-handlers/interact-for-local-file.ts +0 -59
  163. package/cli/lib/param-handlers/interact-for-package-example-id.ts +0 -25
  164. package/cli/lib/param-handlers/interact-for-package-name-with-version.ts +0 -63
  165. package/cli/lib/param-handlers/interact-for-package-name.ts +0 -45
  166. package/cli/lib/param-handlers/interact-for-package-release-id.ts +0 -15
  167. package/cli/lib/param-handlers/interact-for-registry-url.ts +0 -27
  168. package/cli/lib/param-handlers/interact-for-runtime.ts +0 -33
  169. package/cli/lib/param-handlers/param-handler-type.ts +0 -7
  170. package/cli/lib/posthog.ts +0 -23
  171. package/cli/lib/soupify/get-export-name-from-file.ts +0 -29
  172. package/cli/lib/soupify/get-tmp-entrpoint-filepath.ts +0 -15
  173. package/cli/lib/soupify/index.ts +0 -1
  174. package/cli/lib/soupify/run-entrypoint-file.ts +0 -59
  175. package/cli/lib/soupify/soupify-with-core.ts +0 -74
  176. package/cli/lib/soupify/soupify.ts +0 -6
  177. package/cli/lib/util/app-context.ts +0 -17
  178. package/cli/lib/util/create-context-and-run-program.ts +0 -168
  179. package/cli/lib/util/get-all-package-files.ts +0 -66
  180. package/cli/lib/util/lint-project.ts +0 -137
  181. package/cli/tests/export-gerber-keyboard.test.ts +0 -16
  182. package/cli/tests/export-gerber.test.ts +0 -49
  183. package/cli/tests/export-kicad-pcb.test.ts +0 -23
  184. package/cli/tests/export-pnp-csv.test.ts +0 -24
  185. package/cli/tests/fixtures/preload.ts +0 -54
  186. package/cli/tests/init.test.ts +0 -9
  187. package/cli/tests/open.test.ts +0 -9
  188. package/cli/tests/soupify-builder.test.ts +0 -9
  189. package/cli/tests/soupify-core.test.ts +0 -9
  190. package/dist/cli.js +0 -3676
  191. package/docs/EDIT_EVENT_PIPELINE.md +0 -34
  192. package/example-project/README.md +0 -18
  193. package/example-project/examples/basic-capacitor.tsx +0 -5
  194. package/example-project/examples/basic-chip.tsx +0 -26
  195. package/example-project/examples/basic-resistor.tsx +0 -3
  196. package/example-project/examples/macrokeypad.tsx +0 -59
  197. package/example-project/index.ts +0 -1
  198. package/example-project/package.json +0 -5
  199. package/example-project/src/ArduinoProMicroBreakout.tsx +0 -37
  200. package/example-project/src/Key.tsx +0 -46
  201. package/example-project/src/Keyswitch.tsx +0 -26
  202. package/example-project/src/KeyswitchSocket.tsx +0 -56
  203. package/example-project/src/MyCircuit.tsx +0 -38
  204. package/example-project/src/manual-edits.ts +0 -93
  205. package/frontend/README.md +0 -3
  206. package/frontend/bun.lockb +0 -0
  207. package/frontend/components/command-k.tsx +0 -86
  208. package/frontend/components/dialogs/generic-export-dialog.tsx +0 -189
  209. package/frontend/components/dialogs/gerber-export-dialog.tsx +0 -168
  210. package/frontend/components/global-context-providers.tsx +0 -11
  211. package/frontend/components/select-example-search.tsx +0 -118
  212. package/frontend/components/ui/alert-dialog.tsx +0 -139
  213. package/frontend/components/ui/alert.tsx +0 -59
  214. package/frontend/components/ui/breadcrumb.tsx +0 -115
  215. package/frontend/components/ui/button.tsx +0 -57
  216. package/frontend/components/ui/card.tsx +0 -76
  217. package/frontend/components/ui/command.tsx +0 -153
  218. package/frontend/components/ui/context-menu.tsx +0 -202
  219. package/frontend/components/ui/dialog.tsx +0 -120
  220. package/frontend/components/ui/menubar.tsx +0 -238
  221. package/frontend/components/ui/navigation-menu.tsx +0 -128
  222. package/frontend/components/ui/popover.tsx +0 -31
  223. package/frontend/components/ui/select.tsx +0 -162
  224. package/frontend/components/ui/tabs.tsx +0 -53
  225. package/frontend/components/ui/toggle-group.tsx +0 -59
  226. package/frontend/components/ui/toggle.tsx +0 -43
  227. package/frontend/components/ui/tooltip.tsx +0 -28
  228. package/frontend/components.json +0 -17
  229. package/frontend/hooks/toast-if-api-not-connected.ts +0 -23
  230. package/frontend/hooks/use-active-dev-package-example-lite.ts +0 -39
  231. package/frontend/hooks/use-dev-package-examples.tsx +0 -18
  232. package/frontend/hooks/use-global-store.ts +0 -42
  233. package/frontend/index.css +0 -76
  234. package/frontend/index.html +0 -13
  235. package/frontend/lib/utils.ts +0 -6
  236. package/frontend/main.tsx +0 -13
  237. package/frontend/tailwind.config.js +0 -74
  238. package/frontend/views/App.tsx +0 -22
  239. package/frontend/views/Header.tsx +0 -55
  240. package/frontend/views/HeaderMenu.tsx +0 -326
  241. package/frontend/views/MainContentView.tsx +0 -172
  242. package/frontend/vite-env.d.ts +0 -1
  243. package/frontend/vite.config.ts +0 -50
  244. package/renovate.json +0 -16
  245. package/scripts/build-cli.ts +0 -12
  246. package/tsup.config.ts +0 -7
@@ -1,120 +0,0 @@
1
- import * as React from "react"
2
- import * as DialogPrimitive from "@radix-ui/react-dialog"
3
- import { Cross2Icon } from "@radix-ui/react-icons"
4
-
5
- import { cn } from "frontend/lib/utils"
6
-
7
- const Dialog = DialogPrimitive.Root
8
-
9
- const DialogTrigger = DialogPrimitive.Trigger
10
-
11
- const DialogPortal = DialogPrimitive.Portal
12
-
13
- const DialogClose = DialogPrimitive.Close
14
-
15
- const DialogOverlay = React.forwardRef<
16
- React.ElementRef<typeof DialogPrimitive.Overlay>,
17
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
18
- >(({ className, ...props }, ref) => (
19
- <DialogPrimitive.Overlay
20
- ref={ref}
21
- className={cn(
22
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
23
- className,
24
- )}
25
- {...props}
26
- />
27
- ))
28
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
29
-
30
- const DialogContent = React.forwardRef<
31
- React.ElementRef<typeof DialogPrimitive.Content>,
32
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
33
- >(({ className, children, ...props }, ref) => (
34
- <DialogPortal>
35
- <DialogOverlay />
36
- <DialogPrimitive.Content
37
- ref={ref}
38
- className={cn(
39
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
40
- className,
41
- )}
42
- {...props}
43
- >
44
- {children}
45
- <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
46
- <Cross2Icon className="h-4 w-4" />
47
- <span className="sr-only">Close</span>
48
- </DialogPrimitive.Close>
49
- </DialogPrimitive.Content>
50
- </DialogPortal>
51
- ))
52
- DialogContent.displayName = DialogPrimitive.Content.displayName
53
-
54
- const DialogHeader = ({
55
- className,
56
- ...props
57
- }: React.HTMLAttributes<HTMLDivElement>) => (
58
- <div
59
- className={cn(
60
- "flex flex-col space-y-1.5 text-center sm:text-left",
61
- className,
62
- )}
63
- {...props}
64
- />
65
- )
66
- DialogHeader.displayName = "DialogHeader"
67
-
68
- const DialogFooter = ({
69
- className,
70
- ...props
71
- }: React.HTMLAttributes<HTMLDivElement>) => (
72
- <div
73
- className={cn(
74
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
75
- className,
76
- )}
77
- {...props}
78
- />
79
- )
80
- DialogFooter.displayName = "DialogFooter"
81
-
82
- const DialogTitle = React.forwardRef<
83
- React.ElementRef<typeof DialogPrimitive.Title>,
84
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
85
- >(({ className, ...props }, ref) => (
86
- <DialogPrimitive.Title
87
- ref={ref}
88
- className={cn(
89
- "text-lg font-semibold leading-none tracking-tight",
90
- className,
91
- )}
92
- {...props}
93
- />
94
- ))
95
- DialogTitle.displayName = DialogPrimitive.Title.displayName
96
-
97
- const DialogDescription = React.forwardRef<
98
- React.ElementRef<typeof DialogPrimitive.Description>,
99
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
100
- >(({ className, ...props }, ref) => (
101
- <DialogPrimitive.Description
102
- ref={ref}
103
- className={cn("text-sm text-muted-foreground", className)}
104
- {...props}
105
- />
106
- ))
107
- DialogDescription.displayName = DialogPrimitive.Description.displayName
108
-
109
- export {
110
- Dialog,
111
- DialogPortal,
112
- DialogOverlay,
113
- DialogTrigger,
114
- DialogClose,
115
- DialogContent,
116
- DialogHeader,
117
- DialogFooter,
118
- DialogTitle,
119
- DialogDescription,
120
- }
@@ -1,238 +0,0 @@
1
- import * as React from "react"
2
- import {
3
- CheckIcon,
4
- ChevronRightIcon,
5
- DotFilledIcon,
6
- } from "@radix-ui/react-icons"
7
- import * as MenubarPrimitive from "@radix-ui/react-menubar"
8
-
9
- import { cn } from "frontend/lib/utils"
10
-
11
- const MenubarMenu = MenubarPrimitive.Menu
12
-
13
- const MenubarGroup = MenubarPrimitive.Group
14
-
15
- const MenubarPortal = MenubarPrimitive.Portal
16
-
17
- const MenubarSub = MenubarPrimitive.Sub
18
-
19
- const MenubarRadioGroup = MenubarPrimitive.RadioGroup
20
-
21
- const Menubar = React.forwardRef<
22
- React.ElementRef<typeof MenubarPrimitive.Root>,
23
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Root>
24
- >(({ className, ...props }, ref) => (
25
- <MenubarPrimitive.Root
26
- ref={ref}
27
- className={cn(
28
- "flex h-9 items-center space-x-1 rounded-md border bg-background p-1 shadow-sm",
29
- className,
30
- )}
31
- {...props}
32
- />
33
- ))
34
- Menubar.displayName = MenubarPrimitive.Root.displayName
35
-
36
- const MenubarTrigger = React.forwardRef<
37
- React.ElementRef<typeof MenubarPrimitive.Trigger>,
38
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>
39
- >(({ className, ...props }, ref) => (
40
- <MenubarPrimitive.Trigger
41
- ref={ref}
42
- className={cn(
43
- "flex cursor-default select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
44
- className,
45
- )}
46
- {...props}
47
- />
48
- ))
49
- MenubarTrigger.displayName = MenubarPrimitive.Trigger.displayName
50
-
51
- const MenubarSubTrigger = React.forwardRef<
52
- React.ElementRef<typeof MenubarPrimitive.SubTrigger>,
53
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubTrigger> & {
54
- inset?: boolean
55
- }
56
- >(({ className, inset, children, ...props }, ref) => (
57
- <MenubarPrimitive.SubTrigger
58
- ref={ref}
59
- className={cn(
60
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
61
- inset && "pl-8",
62
- className,
63
- )}
64
- {...props}
65
- >
66
- {children}
67
- <ChevronRightIcon className="ml-auto h-4 w-4" />
68
- </MenubarPrimitive.SubTrigger>
69
- ))
70
- MenubarSubTrigger.displayName = MenubarPrimitive.SubTrigger.displayName
71
-
72
- const MenubarSubContent = React.forwardRef<
73
- React.ElementRef<typeof MenubarPrimitive.SubContent>,
74
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubContent>
75
- >(({ className, ...props }, ref) => (
76
- <MenubarPrimitive.SubContent
77
- ref={ref}
78
- className={cn(
79
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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",
80
- className,
81
- )}
82
- {...props}
83
- />
84
- ))
85
- MenubarSubContent.displayName = MenubarPrimitive.SubContent.displayName
86
-
87
- const MenubarContent = React.forwardRef<
88
- React.ElementRef<typeof MenubarPrimitive.Content>,
89
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Content>
90
- >(
91
- (
92
- { className, align = "start", alignOffset = -4, sideOffset = 8, ...props },
93
- ref,
94
- ) => (
95
- <MenubarPrimitive.Portal>
96
- <MenubarPrimitive.Content
97
- ref={ref}
98
- align={align}
99
- alignOffset={alignOffset}
100
- sideOffset={sideOffset}
101
- className={cn(
102
- "z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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",
103
- className,
104
- )}
105
- {...props}
106
- />
107
- </MenubarPrimitive.Portal>
108
- ),
109
- )
110
- MenubarContent.displayName = MenubarPrimitive.Content.displayName
111
-
112
- const MenubarItem = React.forwardRef<
113
- React.ElementRef<typeof MenubarPrimitive.Item>,
114
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Item> & {
115
- inset?: boolean
116
- }
117
- >(({ className, inset, ...props }, ref) => (
118
- <MenubarPrimitive.Item
119
- ref={ref}
120
- className={cn(
121
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
122
- inset && "pl-8",
123
- className,
124
- )}
125
- {...props}
126
- />
127
- ))
128
- MenubarItem.displayName = MenubarPrimitive.Item.displayName
129
-
130
- const MenubarCheckboxItem = React.forwardRef<
131
- React.ElementRef<typeof MenubarPrimitive.CheckboxItem>,
132
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.CheckboxItem>
133
- >(({ className, children, checked, ...props }, ref) => (
134
- <MenubarPrimitive.CheckboxItem
135
- ref={ref}
136
- className={cn(
137
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
138
- className,
139
- )}
140
- checked={checked}
141
- {...props}
142
- >
143
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
144
- <MenubarPrimitive.ItemIndicator>
145
- <CheckIcon className="h-4 w-4" />
146
- </MenubarPrimitive.ItemIndicator>
147
- </span>
148
- {children}
149
- </MenubarPrimitive.CheckboxItem>
150
- ))
151
- MenubarCheckboxItem.displayName = MenubarPrimitive.CheckboxItem.displayName
152
-
153
- const MenubarRadioItem = React.forwardRef<
154
- React.ElementRef<typeof MenubarPrimitive.RadioItem>,
155
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.RadioItem>
156
- >(({ className, children, ...props }, ref) => (
157
- <MenubarPrimitive.RadioItem
158
- ref={ref}
159
- className={cn(
160
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
161
- className,
162
- )}
163
- {...props}
164
- >
165
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
166
- <MenubarPrimitive.ItemIndicator>
167
- <DotFilledIcon className="h-4 w-4 fill-current" />
168
- </MenubarPrimitive.ItemIndicator>
169
- </span>
170
- {children}
171
- </MenubarPrimitive.RadioItem>
172
- ))
173
- MenubarRadioItem.displayName = MenubarPrimitive.RadioItem.displayName
174
-
175
- const MenubarLabel = React.forwardRef<
176
- React.ElementRef<typeof MenubarPrimitive.Label>,
177
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Label> & {
178
- inset?: boolean
179
- }
180
- >(({ className, inset, ...props }, ref) => (
181
- <MenubarPrimitive.Label
182
- ref={ref}
183
- className={cn(
184
- "px-2 py-1.5 text-sm font-semibold",
185
- inset && "pl-8",
186
- className,
187
- )}
188
- {...props}
189
- />
190
- ))
191
- MenubarLabel.displayName = MenubarPrimitive.Label.displayName
192
-
193
- const MenubarSeparator = React.forwardRef<
194
- React.ElementRef<typeof MenubarPrimitive.Separator>,
195
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Separator>
196
- >(({ className, ...props }, ref) => (
197
- <MenubarPrimitive.Separator
198
- ref={ref}
199
- className={cn("-mx-1 my-1 h-px bg-muted", className)}
200
- {...props}
201
- />
202
- ))
203
- MenubarSeparator.displayName = MenubarPrimitive.Separator.displayName
204
-
205
- const MenubarShortcut = ({
206
- className,
207
- ...props
208
- }: React.HTMLAttributes<HTMLSpanElement>) => {
209
- return (
210
- <span
211
- className={cn(
212
- "ml-auto text-xs tracking-widest text-muted-foreground",
213
- className,
214
- )}
215
- {...props}
216
- />
217
- )
218
- }
219
- MenubarShortcut.displayname = "MenubarShortcut"
220
-
221
- export {
222
- Menubar,
223
- MenubarMenu,
224
- MenubarTrigger,
225
- MenubarContent,
226
- MenubarItem,
227
- MenubarSeparator,
228
- MenubarLabel,
229
- MenubarCheckboxItem,
230
- MenubarRadioGroup,
231
- MenubarRadioItem,
232
- MenubarPortal,
233
- MenubarSubContent,
234
- MenubarSubTrigger,
235
- MenubarGroup,
236
- MenubarSub,
237
- MenubarShortcut,
238
- }
@@ -1,128 +0,0 @@
1
- import * as React from "react"
2
- import { ChevronDownIcon } from "@radix-ui/react-icons"
3
- import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu"
4
- import { cva } from "class-variance-authority"
5
-
6
- import { cn } from "frontend/lib/utils"
7
-
8
- const NavigationMenu = React.forwardRef<
9
- React.ElementRef<typeof NavigationMenuPrimitive.Root>,
10
- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root>
11
- >(({ className, children, ...props }, ref) => (
12
- <NavigationMenuPrimitive.Root
13
- ref={ref}
14
- className={cn(
15
- "relative z-10 flex max-w-max flex-1 items-center justify-center",
16
- className,
17
- )}
18
- {...props}
19
- >
20
- {children}
21
- <NavigationMenuViewport />
22
- </NavigationMenuPrimitive.Root>
23
- ))
24
- NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName
25
-
26
- const NavigationMenuList = React.forwardRef<
27
- React.ElementRef<typeof NavigationMenuPrimitive.List>,
28
- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>
29
- >(({ className, ...props }, ref) => (
30
- <NavigationMenuPrimitive.List
31
- ref={ref}
32
- className={cn(
33
- "group flex flex-1 list-none items-center justify-center space-x-1",
34
- className,
35
- )}
36
- {...props}
37
- />
38
- ))
39
- NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName
40
-
41
- const NavigationMenuItem = NavigationMenuPrimitive.Item
42
-
43
- const navigationMenuTriggerStyle = cva(
44
- "group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50",
45
- )
46
-
47
- const NavigationMenuTrigger = React.forwardRef<
48
- React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,
49
- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>
50
- >(({ className, children, ...props }, ref) => (
51
- <NavigationMenuPrimitive.Trigger
52
- ref={ref}
53
- className={cn(navigationMenuTriggerStyle(), "group", className)}
54
- {...props}
55
- >
56
- {children}{" "}
57
- <ChevronDownIcon
58
- className="relative top-[1px] ml-1 h-3 w-3 transition duration-300 group-data-[state=open]:rotate-180"
59
- aria-hidden="true"
60
- />
61
- </NavigationMenuPrimitive.Trigger>
62
- ))
63
- NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName
64
-
65
- const NavigationMenuContent = React.forwardRef<
66
- React.ElementRef<typeof NavigationMenuPrimitive.Content>,
67
- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>
68
- >(({ className, ...props }, ref) => (
69
- <NavigationMenuPrimitive.Content
70
- ref={ref}
71
- className={cn(
72
- "left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ",
73
- className,
74
- )}
75
- {...props}
76
- />
77
- ))
78
- NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName
79
-
80
- const NavigationMenuLink = NavigationMenuPrimitive.Link
81
-
82
- const NavigationMenuViewport = React.forwardRef<
83
- React.ElementRef<typeof NavigationMenuPrimitive.Viewport>,
84
- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>
85
- >(({ className, ...props }, ref) => (
86
- <div className={cn("absolute left-0 top-full flex justify-center")}>
87
- <NavigationMenuPrimitive.Viewport
88
- className={cn(
89
- "origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",
90
- className,
91
- )}
92
- ref={ref}
93
- {...props}
94
- />
95
- </div>
96
- ))
97
- NavigationMenuViewport.displayName =
98
- NavigationMenuPrimitive.Viewport.displayName
99
-
100
- const NavigationMenuIndicator = React.forwardRef<
101
- React.ElementRef<typeof NavigationMenuPrimitive.Indicator>,
102
- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator>
103
- >(({ className, ...props }, ref) => (
104
- <NavigationMenuPrimitive.Indicator
105
- ref={ref}
106
- className={cn(
107
- "top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",
108
- className,
109
- )}
110
- {...props}
111
- >
112
- <div className="relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md" />
113
- </NavigationMenuPrimitive.Indicator>
114
- ))
115
- NavigationMenuIndicator.displayName =
116
- NavigationMenuPrimitive.Indicator.displayName
117
-
118
- export {
119
- navigationMenuTriggerStyle,
120
- NavigationMenu,
121
- NavigationMenuList,
122
- NavigationMenuItem,
123
- NavigationMenuContent,
124
- NavigationMenuTrigger,
125
- NavigationMenuLink,
126
- NavigationMenuIndicator,
127
- NavigationMenuViewport,
128
- }
@@ -1,31 +0,0 @@
1
- import * as React from "react"
2
- import * as PopoverPrimitive from "@radix-ui/react-popover"
3
-
4
- import { cn } from "frontend/lib/utils"
5
-
6
- const Popover = PopoverPrimitive.Root
7
-
8
- const PopoverTrigger = PopoverPrimitive.Trigger
9
-
10
- const PopoverAnchor = PopoverPrimitive.Anchor
11
-
12
- const PopoverContent = React.forwardRef<
13
- React.ElementRef<typeof PopoverPrimitive.Content>,
14
- React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
15
- >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
16
- <PopoverPrimitive.Portal>
17
- <PopoverPrimitive.Content
18
- ref={ref}
19
- align={align}
20
- sideOffset={sideOffset}
21
- className={cn(
22
- "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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",
23
- className,
24
- )}
25
- {...props}
26
- />
27
- </PopoverPrimitive.Portal>
28
- ))
29
- PopoverContent.displayName = PopoverPrimitive.Content.displayName
30
-
31
- export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }
@@ -1,162 +0,0 @@
1
- import * as React from "react"
2
- import {
3
- CaretSortIcon,
4
- CheckIcon,
5
- ChevronDownIcon,
6
- ChevronUpIcon,
7
- } from "@radix-ui/react-icons"
8
- import * as SelectPrimitive from "@radix-ui/react-select"
9
-
10
- import { cn } from "frontend/lib/utils"
11
-
12
- const Select = SelectPrimitive.Root
13
-
14
- const SelectGroup = SelectPrimitive.Group
15
-
16
- const SelectValue = SelectPrimitive.Value
17
-
18
- const SelectTrigger = React.forwardRef<
19
- React.ElementRef<typeof SelectPrimitive.Trigger>,
20
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
21
- >(({ className, children, ...props }, ref) => (
22
- <SelectPrimitive.Trigger
23
- ref={ref}
24
- className={cn(
25
- "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
26
- className,
27
- )}
28
- {...props}
29
- >
30
- {children}
31
- <SelectPrimitive.Icon asChild>
32
- <CaretSortIcon className="h-4 w-4 opacity-50" />
33
- </SelectPrimitive.Icon>
34
- </SelectPrimitive.Trigger>
35
- ))
36
- SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
37
-
38
- const SelectScrollUpButton = React.forwardRef<
39
- React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
40
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
41
- >(({ className, ...props }, ref) => (
42
- <SelectPrimitive.ScrollUpButton
43
- ref={ref}
44
- className={cn(
45
- "flex cursor-default items-center justify-center py-1",
46
- className,
47
- )}
48
- {...props}
49
- >
50
- <ChevronUpIcon />
51
- </SelectPrimitive.ScrollUpButton>
52
- ))
53
- SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
54
-
55
- const SelectScrollDownButton = React.forwardRef<
56
- React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
57
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
58
- >(({ className, ...props }, ref) => (
59
- <SelectPrimitive.ScrollDownButton
60
- ref={ref}
61
- className={cn(
62
- "flex cursor-default items-center justify-center py-1",
63
- className,
64
- )}
65
- {...props}
66
- >
67
- <ChevronDownIcon />
68
- </SelectPrimitive.ScrollDownButton>
69
- ))
70
- SelectScrollDownButton.displayName =
71
- SelectPrimitive.ScrollDownButton.displayName
72
-
73
- const SelectContent = React.forwardRef<
74
- React.ElementRef<typeof SelectPrimitive.Content>,
75
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
76
- >(({ className, children, position = "popper", ...props }, ref) => (
77
- <SelectPrimitive.Portal>
78
- <SelectPrimitive.Content
79
- ref={ref}
80
- className={cn(
81
- "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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",
82
- position === "popper" &&
83
- "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
84
- className,
85
- )}
86
- position={position}
87
- {...props}
88
- >
89
- <SelectScrollUpButton />
90
- <SelectPrimitive.Viewport
91
- className={cn(
92
- "p-1",
93
- position === "popper" &&
94
- "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]",
95
- )}
96
- >
97
- {children}
98
- </SelectPrimitive.Viewport>
99
- <SelectScrollDownButton />
100
- </SelectPrimitive.Content>
101
- </SelectPrimitive.Portal>
102
- ))
103
- SelectContent.displayName = SelectPrimitive.Content.displayName
104
-
105
- const SelectLabel = React.forwardRef<
106
- React.ElementRef<typeof SelectPrimitive.Label>,
107
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
108
- >(({ className, ...props }, ref) => (
109
- <SelectPrimitive.Label
110
- ref={ref}
111
- className={cn("px-2 py-1.5 text-sm font-semibold", className)}
112
- {...props}
113
- />
114
- ))
115
- SelectLabel.displayName = SelectPrimitive.Label.displayName
116
-
117
- const SelectItem = React.forwardRef<
118
- React.ElementRef<typeof SelectPrimitive.Item>,
119
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
120
- >(({ className, children, ...props }, ref) => (
121
- <SelectPrimitive.Item
122
- ref={ref}
123
- className={cn(
124
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
125
- className,
126
- )}
127
- {...props}
128
- >
129
- <span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
130
- <SelectPrimitive.ItemIndicator>
131
- <CheckIcon className="h-4 w-4" />
132
- </SelectPrimitive.ItemIndicator>
133
- </span>
134
- <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
135
- </SelectPrimitive.Item>
136
- ))
137
- SelectItem.displayName = SelectPrimitive.Item.displayName
138
-
139
- const SelectSeparator = React.forwardRef<
140
- React.ElementRef<typeof SelectPrimitive.Separator>,
141
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
142
- >(({ className, ...props }, ref) => (
143
- <SelectPrimitive.Separator
144
- ref={ref}
145
- className={cn("-mx-1 my-1 h-px bg-muted", className)}
146
- {...props}
147
- />
148
- ))
149
- SelectSeparator.displayName = SelectPrimitive.Separator.displayName
150
-
151
- export {
152
- Select,
153
- SelectGroup,
154
- SelectValue,
155
- SelectTrigger,
156
- SelectContent,
157
- SelectLabel,
158
- SelectItem,
159
- SelectSeparator,
160
- SelectScrollUpButton,
161
- SelectScrollDownButton,
162
- }