@tscircuit/fake-snippets 0.0.1
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.
- package/.github/CODEOWNERS +1 -0
- package/.github/workflows/bun-formatcheck.yml +26 -0
- package/.github/workflows/bun-test.yml +28 -0
- package/.github/workflows/bun-typecheck.yml +26 -0
- package/.github/workflows/bundle-size-analysis.yml +79 -0
- package/.github/workflows/playwright-test.yml +37 -0
- package/.github/workflows/stale.yml +40 -0
- package/.github/workflows/update-snapshots.yml +49 -0
- package/CONTRIBUTING.md +59 -0
- package/LICENSE +21 -0
- package/README.md +113 -0
- package/biome.json +60 -0
- package/bun-tests/fake-snippets-api/fixtures/get-circuit-json.ts +148 -0
- package/bun-tests/fake-snippets-api/fixtures/get-test-server.ts +96 -0
- package/bun-tests/fake-snippets-api/fixtures/start-server.ts +44 -0
- package/bun-tests/fake-snippets-api/routes/accounts/get_account_balance.test.ts +18 -0
- package/bun-tests/fake-snippets-api/routes/health.test.ts +9 -0
- package/bun-tests/fake-snippets-api/routes/order_files/get.test.ts +48 -0
- package/bun-tests/fake-snippets-api/routes/order_files/upload.test.ts +77 -0
- package/bun-tests/fake-snippets-api/routes/orders/create.test.ts +19 -0
- package/bun-tests/fake-snippets-api/routes/orders/get.test.ts +38 -0
- package/bun-tests/fake-snippets-api/routes/orders/list.test.ts +30 -0
- package/bun-tests/fake-snippets-api/routes/orders/update.test.ts +46 -0
- package/bun-tests/fake-snippets-api/routes/snippets/add_star.test.ts +114 -0
- package/bun-tests/fake-snippets-api/routes/snippets/create.test.ts +28 -0
- package/bun-tests/fake-snippets-api/routes/snippets/delete.test.ts +106 -0
- package/bun-tests/fake-snippets-api/routes/snippets/download.test.ts +90 -0
- package/bun-tests/fake-snippets-api/routes/snippets/generate_from_jlcpcb.test.ts +25 -0
- package/bun-tests/fake-snippets-api/routes/snippets/get_image.test.ts +113 -0
- package/bun-tests/fake-snippets-api/routes/snippets/images.test.ts +112 -0
- package/bun-tests/fake-snippets-api/routes/snippets/list.test.ts +62 -0
- package/bun-tests/fake-snippets-api/routes/snippets/list_newest.test.ts +48 -0
- package/bun-tests/fake-snippets-api/routes/snippets/list_trending.test.ts +69 -0
- package/bun-tests/fake-snippets-api/routes/snippets/remove_star.test.ts +110 -0
- package/bun-tests/fake-snippets-api/routes/snippets/search.test.ts +75 -0
- package/bun-tests/fake-snippets-api/routes/snippets/star-count.test.ts +44 -0
- package/bun-tests/fake-snippets-api/routes/snippets/update.test.ts +116 -0
- package/bun-tests/parts-engine.test.ts +18 -0
- package/bun.lockb +0 -0
- package/bunfig.toml +2 -0
- package/components.json +20 -0
- package/dist/assets/editor_example_1-1000w.webp +0 -0
- package/dist/assets/editor_example_1-1200w.webp +0 -0
- package/dist/assets/editor_example_1-1600w.webp +0 -0
- package/dist/assets/editor_example_1-2000w.webp +0 -0
- package/dist/assets/editor_example_1-400w.webp +0 -0
- package/dist/assets/editor_example_1-600w.webp +0 -0
- package/dist/assets/editor_example_1-800w.webp +0 -0
- package/dist/assets/editor_example_1_more_square-1000w.webp +0 -0
- package/dist/assets/editor_example_1_more_square-1200w.webp +0 -0
- package/dist/assets/editor_example_1_more_square-1600w.webp +0 -0
- package/dist/assets/editor_example_1_more_square-2000w.webp +0 -0
- package/dist/assets/editor_example_1_more_square-400w.webp +0 -0
- package/dist/assets/editor_example_1_more_square-600w.webp +0 -0
- package/dist/assets/editor_example_1_more_square-800w.webp +0 -0
- package/dist/assets/editor_example_2-1000w.webp +0 -0
- package/dist/assets/editor_example_2-1200w.webp +0 -0
- package/dist/assets/editor_example_2-1600w.webp +0 -0
- package/dist/assets/editor_example_2-2000w.webp +0 -0
- package/dist/assets/editor_example_2-400w.webp +0 -0
- package/dist/assets/editor_example_2-600w.webp +0 -0
- package/dist/assets/editor_example_2-800w.webp +0 -0
- package/dist/assets/example_schematic-1000w.webp +0 -0
- package/dist/assets/example_schematic-1200w.webp +0 -0
- package/dist/assets/example_schematic-1600w.webp +0 -0
- package/dist/assets/example_schematic-2000w.webp +0 -0
- package/dist/assets/example_schematic-400w.webp +0 -0
- package/dist/assets/example_schematic-600w.webp +0 -0
- package/dist/assets/example_schematic-800w.webp +0 -0
- package/dist/bundle.js +3270 -0
- package/dist/robots.txt +9 -0
- package/dist/sitemap.xml +118 -0
- package/docs/CIRCUIT_JSON_SOURCE_COMPONENT_OVERVIEW.md +151 -0
- package/fake-snippets-api/README.md +6 -0
- package/fake-snippets-api/biome.json +47 -0
- package/fake-snippets-api/bun.lockb +0 -0
- package/fake-snippets-api/lib/db/autoload-dev-snippets.ts +84 -0
- package/fake-snippets-api/lib/db/autoload-snippets.json +24 -0
- package/fake-snippets-api/lib/db/db-client.ts +343 -0
- package/fake-snippets-api/lib/db/schema.ts +112 -0
- package/fake-snippets-api/lib/db/seed.ts +1608 -0
- package/fake-snippets-api/lib/middleware/with-ctx-error.ts +26 -0
- package/fake-snippets-api/lib/middleware/with-db.ts +15 -0
- package/fake-snippets-api/lib/middleware/with-error-handling.ts +24 -0
- package/fake-snippets-api/lib/middleware/with-optional-session-auth.ts +34 -0
- package/fake-snippets-api/lib/middleware/with-request-logging.ts +54 -0
- package/fake-snippets-api/lib/middleware/with-session-auth.ts +39 -0
- package/fake-snippets-api/lib/middleware/with-winter-spec.ts +24 -0
- package/fake-snippets-api/next-env.d.ts +5 -0
- package/fake-snippets-api/routes/api/accounts/get.ts +21 -0
- package/fake-snippets-api/routes/api/accounts/get_account_balance.ts +22 -0
- package/fake-snippets-api/routes/api/accounts/update.ts +32 -0
- package/fake-snippets-api/routes/api/ai/[...anyroute].ts +31 -0
- package/fake-snippets-api/routes/api/ai.ts +2 -0
- package/fake-snippets-api/routes/api/aistream/[...anyroute].ts +65 -0
- package/fake-snippets-api/routes/api/health.ts +9 -0
- package/fake-snippets-api/routes/api/internal/sessions/create_without_auth.ts +63 -0
- package/fake-snippets-api/routes/api/order_files/get.ts +28 -0
- package/fake-snippets-api/routes/api/order_files/upload.ts +43 -0
- package/fake-snippets-api/routes/api/orders/create.ts +41 -0
- package/fake-snippets-api/routes/api/orders/get.ts +28 -0
- package/fake-snippets-api/routes/api/orders/list.ts +15 -0
- package/fake-snippets-api/routes/api/orders/update.ts +50 -0
- package/fake-snippets-api/routes/api/snippets/add_star.ts +42 -0
- package/fake-snippets-api/routes/api/snippets/create.ts +55 -0
- package/fake-snippets-api/routes/api/snippets/delete.ts +41 -0
- package/fake-snippets-api/routes/api/snippets/download.ts +148 -0
- package/fake-snippets-api/routes/api/snippets/generate_from_jlcpcb.ts +55 -0
- package/fake-snippets-api/routes/api/snippets/get.ts +50 -0
- package/fake-snippets-api/routes/api/snippets/get_image.ts +65 -0
- package/fake-snippets-api/routes/api/snippets/images/[author]/[snippet_name]/[typeFormat].ts +74 -0
- package/fake-snippets-api/routes/api/snippets/list.ts +28 -0
- package/fake-snippets-api/routes/api/snippets/list_newest.ts +13 -0
- package/fake-snippets-api/routes/api/snippets/list_trending.ts +21 -0
- package/fake-snippets-api/routes/api/snippets/remove_star.ts +42 -0
- package/fake-snippets-api/routes/api/snippets/search.ts +18 -0
- package/fake-snippets-api/routes/api/snippets/update.ts +86 -0
- package/favicon.ico +0 -0
- package/index.html +23 -0
- package/landing.html +23 -0
- package/package.json +164 -0
- package/playwright-tests/ai-page.spec.ts +19 -0
- package/playwright-tests/cmd-click.spec.ts +43 -0
- package/playwright-tests/dashboard-page.spec.ts +10 -0
- package/playwright-tests/editor-page.spec.ts +15 -0
- package/playwright-tests/files-dialog.spec.ts +19 -0
- package/playwright-tests/footprint-dialog/footprint-dialog.spec.ts +27 -0
- package/playwright-tests/footprint-dialog/footprint-insertion.spec.ts +38 -0
- package/playwright-tests/footprint-dialog/footprint-preview.spec.ts +34 -0
- package/playwright-tests/footprint-dialog/footprint-selection.spec.ts +29 -0
- package/playwright-tests/handle-manual-edits.spec.ts +55 -0
- package/playwright-tests/home-page.spec.ts +10 -0
- package/playwright-tests/images.spec.ts +17 -0
- package/playwright-tests/manual-edits.spec.ts +89 -0
- package/playwright-tests/preview-page.spec.ts +14 -0
- package/playwright-tests/quickstart-page.spec.ts +10 -0
- package/playwright-tests/search-links.spec.ts +21 -0
- package/playwright-tests/search.spec.ts +27 -0
- package/playwright-tests/snapshots/ai-page.spec.ts-AI-Page-lg.png +0 -0
- package/playwright-tests/snapshots/ai-page.spec.ts-AI-Page-md.png +0 -0
- package/playwright-tests/snapshots/ai-page.spec.ts-AI-Page-xs.png +0 -0
- package/playwright-tests/snapshots/cmd-click.spec.ts-underlined-imports.png +0 -0
- package/playwright-tests/snapshots/dashboard-page.spec.ts-Dashboard-page-lg.png +0 -0
- package/playwright-tests/snapshots/dashboard-page.spec.ts-Dashboard-page-md.png +0 -0
- package/playwright-tests/snapshots/dashboard-page.spec.ts-Dashboard-page-xs.png +0 -0
- package/playwright-tests/snapshots/editor-page.spec.ts-editor-with-snippet.png +0 -0
- package/playwright-tests/snapshots/error-fallback.spec.ts-error-fallback-lg.png +0 -0
- package/playwright-tests/snapshots/error-fallback.spec.ts-error-fallback-md.png +0 -0
- package/playwright-tests/snapshots/error-fallback.spec.ts-error-fallback-xs.png +0 -0
- package/playwright-tests/snapshots/files-dialog.spec.ts-view-snippet-files.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-dialog.spec.ts-footprint-preview-lg.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-dialog.spec.ts-footprint-preview-md.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-dialog.spec.ts-footprint-preview-xs.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-insertion.spec.ts-footprint-insertion-lg.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-insertion.spec.ts-footprint-insertion-md.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-insertion.spec.ts-footprint-insertion-xs.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-preview.spec.ts-footprint-preview-lg.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-preview.spec.ts-footprint-preview-md.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-preview.spec.ts-footprint-preview-xs.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-selection.spec.ts-footprint-preview-lg.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-selection.spec.ts-footprint-preview-md.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-selection.spec.ts-footprint-preview-xs.png +0 -0
- package/playwright-tests/snapshots/handle-manual-edits.spec.ts-handle-manual-edits.png +0 -0
- package/playwright-tests/snapshots/home-page.spec.ts-Home-page-lg.png +0 -0
- package/playwright-tests/snapshots/home-page.spec.ts-Home-page-md.png +0 -0
- package/playwright-tests/snapshots/home-page.spec.ts-Home-page-xs.png +0 -0
- package/playwright-tests/snapshots/images.spec.ts-pcb-image.png +0 -0
- package/playwright-tests/snapshots/images.spec.ts-schematic-image.png +0 -0
- package/playwright-tests/snapshots/manual-edits.spec.ts-editor-manual-edits.png +0 -0
- package/playwright-tests/snapshots/manual-edits.spec.ts-manual-edits-view.png +0 -0
- package/playwright-tests/snapshots/preview-page.spec.ts-preview-snippet-pcb.png +0 -0
- package/playwright-tests/snapshots/preview-page.spec.ts-preview-snippet-schematic.png +0 -0
- package/playwright-tests/snapshots/quickstart-page.spec.ts-Quickstart-Pagelg.png +0 -0
- package/playwright-tests/snapshots/quickstart-page.spec.ts-Quickstart-Pagemd.png +0 -0
- package/playwright-tests/snapshots/quickstart-page.spec.ts-Quickstart-Pagexs.png +0 -0
- package/playwright-tests/snapshots/search-links.spec.ts-search-links.png +0 -0
- package/playwright-tests/snapshots/search.spec.ts-search-lg.png +0 -0
- package/playwright-tests/snapshots/search.spec.ts-search-md.png +0 -0
- package/playwright-tests/snapshots/search.spec.ts-search-xs.png +0 -0
- package/playwright-tests/snapshots/star.spec.ts-remove-star-button.png +0 -0
- package/playwright-tests/snapshots/star.spec.ts-star-button.png +0 -0
- package/playwright-tests/snapshots/update-description.spec.ts-update-description.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-after-lg.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-after-md.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-after-xs.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-before-lg.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-before-md.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-before-xs.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-files.png +0 -0
- package/playwright-tests/star.spec.ts +40 -0
- package/playwright-tests/update-description.spec.ts +18 -0
- package/playwright-tests/view-snippet.spec.ts +35 -0
- package/playwright-tests/viewports.ts +5 -0
- package/playwright.config.ts +27 -0
- package/postcss.config.js +6 -0
- package/public/robots.txt +9 -0
- package/renovate.json +24 -0
- package/scripts/generate-image-sizes.ts +58 -0
- package/scripts/generate-sitemap.ts +103 -0
- package/scripts/generate_bundle_stats.js +192 -0
- package/scripts/snapshot.ts +35 -0
- package/src/App.tsx +113 -0
- package/src/ContextProviders.tsx +9 -0
- package/src/assets/originals/editor_example_1.webp +0 -0
- package/src/assets/originals/editor_example_1_more_square.webp +0 -0
- package/src/assets/originals/editor_example_2.webp +0 -0
- package/src/assets/originals/example_schematic.webp +0 -0
- package/src/components/AiChatInterface.tsx +221 -0
- package/src/components/AiChatMessage.tsx +86 -0
- package/src/components/Analytics.tsx +30 -0
- package/src/components/BomTable.tsx +69 -0
- package/src/components/ChatInput.tsx +53 -0
- package/src/components/CircuitToSvgWithMouseControl.tsx +78 -0
- package/src/components/CmdKMenu.tsx +301 -0
- package/src/components/CodeAndPreview.tsx +258 -0
- package/src/components/CodeEditor.tsx +460 -0
- package/src/components/CodeEditorHeader.tsx +160 -0
- package/src/components/CreateNewSnippetWithAiHero.tsx +77 -0
- package/src/components/DownloadButtonAndMenu.tsx +212 -0
- package/src/components/EditorNav.tsx +428 -0
- package/src/components/ErrorFallback.tsx +25 -0
- package/src/components/ErrorTabContent.tsx +122 -0
- package/src/components/FAQ.tsx +113 -0
- package/src/components/Footer.tsx +134 -0
- package/src/components/Footer2.tsx +100 -0
- package/src/components/FootprintDialog.tsx +342 -0
- package/src/components/Header.tsx +187 -0
- package/src/components/Header2.tsx +135 -0
- package/src/components/HeaderDropdown.tsx +83 -0
- package/src/components/HeaderLogin.tsx +94 -0
- package/src/components/JLCPCBImportDialog.tsx +155 -0
- package/src/components/LandingHero.tsx +175 -0
- package/src/components/LatestSnippets.tsx +39 -0
- package/src/components/OptimizedImage.tsx +96 -0
- package/src/components/OrderPreviewContent.tsx +61 -0
- package/src/components/ParametersEditor.tsx +140 -0
- package/src/components/PcbViewerWithContainerHeight.tsx +47 -0
- package/src/components/PrefetchPageLink.tsx +45 -0
- package/src/components/PreviewContent.tsx +375 -0
- package/src/components/PreviewEmptyState.tsx +16 -0
- package/src/components/RunButton.tsx +27 -0
- package/src/components/SearchComponent.tsx +163 -0
- package/src/components/ShippingInformationForm.tsx +423 -0
- package/src/components/SnippetLink.tsx +37 -0
- package/src/components/StaticPreviewContent.tsx +89 -0
- package/src/components/StaticViewSnippetHeader.tsx +70 -0
- package/src/components/StaticViewSnippetSidebar.tsx +100 -0
- package/src/components/TableViewer/CircuitJsonTableViewer.tsx +316 -0
- package/src/components/TableViewer/ClickableText.tsx +21 -0
- package/src/components/TableViewer/HeaderCell.tsx +27 -0
- package/src/components/TableViewer/Modal.tsx +39 -0
- package/src/components/TrendingSnippetCarousel.tsx +77 -0
- package/src/components/TypeBadge.tsx +31 -0
- package/src/components/ViewSnippetHeader.tsx +144 -0
- package/src/components/ViewSnippetSidebar.tsx +162 -0
- package/src/components/dialogs/confirm-delete-snippet-dialog.tsx +80 -0
- package/src/components/dialogs/create-order-dialog.tsx +146 -0
- package/src/components/dialogs/create-use-dialog.tsx +34 -0
- package/src/components/dialogs/edit-description-dialog.tsx +96 -0
- package/src/components/dialogs/files-dialog.tsx +70 -0
- package/src/components/dialogs/import-snippet-dialog.tsx +84 -0
- package/src/components/dialogs/rename-snippet-dialog.tsx +81 -0
- package/src/components/dialogs/view-ts-files-dialog.tsx +89 -0
- package/src/components/ui/accordion.tsx +55 -0
- package/src/components/ui/alert-dialog.tsx +139 -0
- package/src/components/ui/alert.tsx +59 -0
- package/src/components/ui/aspect-ratio.tsx +5 -0
- package/src/components/ui/avatar.tsx +48 -0
- package/src/components/ui/badge.tsx +36 -0
- package/src/components/ui/breadcrumb.tsx +118 -0
- package/src/components/ui/button.tsx +58 -0
- package/src/components/ui/calendar.tsx +73 -0
- package/src/components/ui/card.tsx +76 -0
- package/src/components/ui/carousel.tsx +260 -0
- package/src/components/ui/chart.tsx +363 -0
- package/src/components/ui/checkbox.tsx +28 -0
- package/src/components/ui/collapsible.tsx +9 -0
- package/src/components/ui/combobox.tsx +178 -0
- package/src/components/ui/command.tsx +151 -0
- package/src/components/ui/context-menu.tsx +202 -0
- package/src/components/ui/dialog.tsx +120 -0
- package/src/components/ui/drawer.tsx +116 -0
- package/src/components/ui/dropdown-menu.tsx +203 -0
- package/src/components/ui/form.tsx +182 -0
- package/src/components/ui/hover-card.tsx +27 -0
- package/src/components/ui/input-otp.tsx +69 -0
- package/src/components/ui/input.tsx +25 -0
- package/src/components/ui/label.tsx +24 -0
- package/src/components/ui/menubar.tsx +238 -0
- package/src/components/ui/navigation-menu.tsx +129 -0
- package/src/components/ui/pagination.tsx +121 -0
- package/src/components/ui/popover.tsx +31 -0
- package/src/components/ui/progress.tsx +26 -0
- package/src/components/ui/radio-group.tsx +42 -0
- package/src/components/ui/resizable.tsx +43 -0
- package/src/components/ui/scroll-area.tsx +46 -0
- package/src/components/ui/searchable-select.tsx +94 -0
- package/src/components/ui/select.tsx +162 -0
- package/src/components/ui/separator.tsx +29 -0
- package/src/components/ui/sheet.tsx +141 -0
- package/src/components/ui/skeleton.tsx +18 -0
- package/src/components/ui/slider.tsx +26 -0
- package/src/components/ui/sonner.tsx +30 -0
- package/src/components/ui/switch.tsx +27 -0
- package/src/components/ui/table.tsx +120 -0
- package/src/components/ui/tabs.tsx +53 -0
- package/src/components/ui/textarea.tsx +24 -0
- package/src/components/ui/toast.tsx +128 -0
- package/src/components/ui/toaster.tsx +33 -0
- package/src/components/ui/toggle-group.tsx +59 -0
- package/src/components/ui/toggle.tsx +43 -0
- package/src/components/ui/tooltip.tsx +28 -0
- package/src/entry-server.tsx +12 -0
- package/src/hooks/use-account-balance.ts +24 -0
- package/src/hooks/use-ai-api.ts +35 -0
- package/src/hooks/use-axios.ts +20 -0
- package/src/hooks/use-code-completion-ai-api.ts +11 -0
- package/src/hooks/use-compiled-tsx.ts +37 -0
- package/src/hooks/use-copy-to-clipboard.ts +26 -0
- package/src/hooks/use-create-snippet-mutation.ts +62 -0
- package/src/hooks/use-current-snippet-id.ts +75 -0
- package/src/hooks/use-current-snippet.ts +24 -0
- package/src/hooks/use-global-store.ts +33 -0
- package/src/hooks/use-is-using-fake-api.ts +3 -0
- package/src/hooks/use-run-tsx/construct-circuit.tsx +64 -0
- package/src/hooks/use-run-tsx/eval-compiled-js.ts +9 -0
- package/src/hooks/use-run-tsx/index.tsx +251 -0
- package/src/hooks/use-save-snippet.ts +66 -0
- package/src/hooks/use-sign-in.ts +22 -0
- package/src/hooks/use-snippet-by-name.ts +25 -0
- package/src/hooks/use-snippet.ts +23 -0
- package/src/hooks/use-snippets-base-api-url.ts +3 -0
- package/src/hooks/use-toast.tsx +208 -0
- package/src/hooks/use-typecheck.ts +54 -0
- package/src/hooks/use-url-params.ts +31 -0
- package/src/hooks/use-warn-user-on-page-change.ts +23 -0
- package/src/hooks/useForkSnippetMutation.ts +52 -0
- package/src/index.css +21 -0
- package/src/lib/__tests__/constants.test.ts +66 -0
- package/src/lib/base64ToBytes.ts +5 -0
- package/src/lib/bytesToBase64.ts +4 -0
- package/src/lib/codemirror/basic-setup.ts +51 -0
- package/src/lib/constants.ts +12 -0
- package/src/lib/decodeUrlHashToText.ts +15 -0
- package/src/lib/defaultCodeForBlankCode.tsx +7 -0
- package/src/lib/download-fns/createBlobURL.ts +4 -0
- package/src/lib/download-fns/download-assembly-svg.ts +12 -0
- package/src/lib/download-fns/download-circuit-json-fn.ts +12 -0
- package/src/lib/download-fns/download-dsn-file-fn.ts +12 -0
- package/src/lib/download-fns/download-fabrication-files.ts +233 -0
- package/src/lib/download-fns/download-gltf.ts +49 -0
- package/src/lib/download-fns/download-kicad-files.ts +27 -0
- package/src/lib/download-fns/download-readable-netlist.ts +12 -0
- package/src/lib/download-fns/download-schematic-svg.ts +12 -0
- package/src/lib/download-fns/download-simple-route-json.ts +17 -0
- package/src/lib/encodeTextToUrlHash.ts +17 -0
- package/src/lib/get-snippet-template.ts +26 -0
- package/src/lib/handleManualEditsImport.tsx +65 -0
- package/src/lib/jlc-parts-engine.ts +69 -0
- package/src/lib/templates/blank-3d-model-template.ts +12 -0
- package/src/lib/templates/blank-circuit-board-template.ts +24 -0
- package/src/lib/templates/blank-footprint-template.ts +29 -0
- package/src/lib/templates/blank-package-template.ts +22 -0
- package/src/lib/templates/blinking-led-board-template.ts +63 -0
- package/src/lib/templates/manual-edits-template.ts +5 -0
- package/src/lib/templates/usb-c-led-flashlight-template.ts +22 -0
- package/src/lib/utils/checkIfManualEditsImported.ts +6 -0
- package/src/lib/utils/getSyntaxError.ts +13 -0
- package/src/lib/utils/index.ts +6 -0
- package/src/lib/utils/load-prettier.ts +18 -0
- package/src/lib/utils/parseFootprintParams.ts +52 -0
- package/src/lib/utils/parseJsonOrNull.ts +8 -0
- package/src/lib/utils/pcbManualEditEventHandler.ts +156 -0
- package/src/main.tsx +10 -0
- package/src/pages/ai.tsx +92 -0
- package/src/pages/authorize.tsx +54 -0
- package/src/pages/dashboard.tsx +165 -0
- package/src/pages/dev-login.tsx +68 -0
- package/src/pages/editor.tsx +28 -0
- package/src/pages/landing.tsx +236 -0
- package/src/pages/my-orders.tsx +54 -0
- package/src/pages/newest.tsx +16 -0
- package/src/pages/preview.tsx +70 -0
- package/src/pages/quickstart.tsx +198 -0
- package/src/pages/search.tsx +26 -0
- package/src/pages/settings.tsx +25 -0
- package/src/pages/user-profile.tsx +97 -0
- package/src/pages/view-order.tsx +123 -0
- package/src/pages/view-snippet.tsx +149 -0
- package/src/prettier.ts +9 -0
- package/src/vite-env.d.ts +1 -0
- package/tailwind.config.js +47 -0
- package/tsconfig.json +30 -0
- package/vercel.json +50 -0
- package/vite.config.ts +146 -0
- package/winterspec.config.ts +6 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
|
3
|
+
import {
|
|
4
|
+
CheckIcon,
|
|
5
|
+
ChevronRightIcon,
|
|
6
|
+
DotFilledIcon,
|
|
7
|
+
} from "@radix-ui/react-icons"
|
|
8
|
+
|
|
9
|
+
import { cn } from "@/lib/utils"
|
|
10
|
+
|
|
11
|
+
const DropdownMenu = DropdownMenuPrimitive.Root
|
|
12
|
+
|
|
13
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
|
|
14
|
+
|
|
15
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group
|
|
16
|
+
|
|
17
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal
|
|
18
|
+
|
|
19
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub
|
|
20
|
+
|
|
21
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
|
|
22
|
+
|
|
23
|
+
const DropdownMenuSubTrigger = React.forwardRef<
|
|
24
|
+
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
|
|
25
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
26
|
+
inset?: boolean
|
|
27
|
+
}
|
|
28
|
+
>(({ className, inset, children, ...props }, ref) => (
|
|
29
|
+
<DropdownMenuPrimitive.SubTrigger
|
|
30
|
+
ref={ref}
|
|
31
|
+
className={cn(
|
|
32
|
+
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100 dark:focus:bg-slate-800 dark:data-[state=open]:bg-slate-800",
|
|
33
|
+
inset && "pl-8",
|
|
34
|
+
className,
|
|
35
|
+
)}
|
|
36
|
+
{...props}
|
|
37
|
+
>
|
|
38
|
+
{children}
|
|
39
|
+
<ChevronRightIcon className="ml-auto h-4 w-4" />
|
|
40
|
+
</DropdownMenuPrimitive.SubTrigger>
|
|
41
|
+
))
|
|
42
|
+
DropdownMenuSubTrigger.displayName =
|
|
43
|
+
DropdownMenuPrimitive.SubTrigger.displayName
|
|
44
|
+
|
|
45
|
+
const DropdownMenuSubContent = React.forwardRef<
|
|
46
|
+
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
|
|
47
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
|
|
48
|
+
>(({ className, ...props }, ref) => (
|
|
49
|
+
<DropdownMenuPrimitive.SubContent
|
|
50
|
+
ref={ref}
|
|
51
|
+
className={cn(
|
|
52
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-slate-200 bg-white p-1 text-slate-950 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 dark:border-slate-800 dark:bg-slate-950 dark:text-slate-50",
|
|
53
|
+
className,
|
|
54
|
+
)}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
))
|
|
58
|
+
DropdownMenuSubContent.displayName =
|
|
59
|
+
DropdownMenuPrimitive.SubContent.displayName
|
|
60
|
+
|
|
61
|
+
const DropdownMenuContent = React.forwardRef<
|
|
62
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
|
|
63
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
|
|
64
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
65
|
+
<DropdownMenuPrimitive.Portal>
|
|
66
|
+
<DropdownMenuPrimitive.Content
|
|
67
|
+
ref={ref}
|
|
68
|
+
sideOffset={sideOffset}
|
|
69
|
+
className={cn(
|
|
70
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md dark:border-slate-800 dark:bg-slate-950 dark:text-slate-50",
|
|
71
|
+
"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",
|
|
72
|
+
className,
|
|
73
|
+
)}
|
|
74
|
+
{...props}
|
|
75
|
+
/>
|
|
76
|
+
</DropdownMenuPrimitive.Portal>
|
|
77
|
+
))
|
|
78
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
|
|
79
|
+
|
|
80
|
+
const DropdownMenuItem = React.forwardRef<
|
|
81
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
|
|
82
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
|
|
83
|
+
inset?: boolean
|
|
84
|
+
}
|
|
85
|
+
>(({ className, inset, ...props }, ref) => (
|
|
86
|
+
<DropdownMenuPrimitive.Item
|
|
87
|
+
ref={ref}
|
|
88
|
+
className={cn(
|
|
89
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-slate-100 focus:text-slate-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-slate-800 dark:focus:text-slate-50",
|
|
90
|
+
inset && "pl-8",
|
|
91
|
+
className,
|
|
92
|
+
)}
|
|
93
|
+
{...props}
|
|
94
|
+
/>
|
|
95
|
+
))
|
|
96
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
|
|
97
|
+
|
|
98
|
+
const DropdownMenuCheckboxItem = React.forwardRef<
|
|
99
|
+
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
|
|
100
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
|
|
101
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
102
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
103
|
+
ref={ref}
|
|
104
|
+
className={cn(
|
|
105
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-slate-100 focus:text-slate-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-slate-800 dark:focus:text-slate-50",
|
|
106
|
+
className,
|
|
107
|
+
)}
|
|
108
|
+
checked={checked}
|
|
109
|
+
{...props}
|
|
110
|
+
>
|
|
111
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
112
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
113
|
+
<CheckIcon className="h-4 w-4" />
|
|
114
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
115
|
+
</span>
|
|
116
|
+
{children}
|
|
117
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
118
|
+
))
|
|
119
|
+
DropdownMenuCheckboxItem.displayName =
|
|
120
|
+
DropdownMenuPrimitive.CheckboxItem.displayName
|
|
121
|
+
|
|
122
|
+
const DropdownMenuRadioItem = React.forwardRef<
|
|
123
|
+
React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
|
|
124
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
|
|
125
|
+
>(({ className, children, ...props }, ref) => (
|
|
126
|
+
<DropdownMenuPrimitive.RadioItem
|
|
127
|
+
ref={ref}
|
|
128
|
+
className={cn(
|
|
129
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-slate-100 focus:text-slate-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-slate-800 dark:focus:text-slate-50",
|
|
130
|
+
className,
|
|
131
|
+
)}
|
|
132
|
+
{...props}
|
|
133
|
+
>
|
|
134
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
135
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
136
|
+
<DotFilledIcon className="h-4 w-4 fill-current" />
|
|
137
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
138
|
+
</span>
|
|
139
|
+
{children}
|
|
140
|
+
</DropdownMenuPrimitive.RadioItem>
|
|
141
|
+
))
|
|
142
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
|
|
143
|
+
|
|
144
|
+
const DropdownMenuLabel = React.forwardRef<
|
|
145
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
|
|
146
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
|
|
147
|
+
inset?: boolean
|
|
148
|
+
}
|
|
149
|
+
>(({ className, inset, ...props }, ref) => (
|
|
150
|
+
<DropdownMenuPrimitive.Label
|
|
151
|
+
ref={ref}
|
|
152
|
+
className={cn(
|
|
153
|
+
"px-2 py-1.5 text-sm font-semibold",
|
|
154
|
+
inset && "pl-8",
|
|
155
|
+
className,
|
|
156
|
+
)}
|
|
157
|
+
{...props}
|
|
158
|
+
/>
|
|
159
|
+
))
|
|
160
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
|
|
161
|
+
|
|
162
|
+
const DropdownMenuSeparator = React.forwardRef<
|
|
163
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
|
|
164
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
|
|
165
|
+
>(({ className, ...props }, ref) => (
|
|
166
|
+
<DropdownMenuPrimitive.Separator
|
|
167
|
+
ref={ref}
|
|
168
|
+
className={cn("-mx-1 my-1 h-px bg-slate-100 dark:bg-slate-800", className)}
|
|
169
|
+
{...props}
|
|
170
|
+
/>
|
|
171
|
+
))
|
|
172
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
|
|
173
|
+
|
|
174
|
+
const DropdownMenuShortcut = ({
|
|
175
|
+
className,
|
|
176
|
+
...props
|
|
177
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
178
|
+
return (
|
|
179
|
+
<span
|
|
180
|
+
className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
|
|
181
|
+
{...props}
|
|
182
|
+
/>
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut"
|
|
186
|
+
|
|
187
|
+
export {
|
|
188
|
+
DropdownMenu,
|
|
189
|
+
DropdownMenuTrigger,
|
|
190
|
+
DropdownMenuContent,
|
|
191
|
+
DropdownMenuItem,
|
|
192
|
+
DropdownMenuCheckboxItem,
|
|
193
|
+
DropdownMenuRadioItem,
|
|
194
|
+
DropdownMenuLabel,
|
|
195
|
+
DropdownMenuSeparator,
|
|
196
|
+
DropdownMenuShortcut,
|
|
197
|
+
DropdownMenuGroup,
|
|
198
|
+
DropdownMenuPortal,
|
|
199
|
+
DropdownMenuSub,
|
|
200
|
+
DropdownMenuSubContent,
|
|
201
|
+
DropdownMenuSubTrigger,
|
|
202
|
+
DropdownMenuRadioGroup,
|
|
203
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as LabelPrimitive from "@radix-ui/react-label"
|
|
3
|
+
import { Slot } from "@radix-ui/react-slot"
|
|
4
|
+
import {
|
|
5
|
+
Controller,
|
|
6
|
+
ControllerProps,
|
|
7
|
+
FieldPath,
|
|
8
|
+
FieldValues,
|
|
9
|
+
FormProvider,
|
|
10
|
+
useFormContext,
|
|
11
|
+
} from "react-hook-form"
|
|
12
|
+
|
|
13
|
+
import { cn } from "@/lib/utils"
|
|
14
|
+
import { Label } from "@/components/ui/label"
|
|
15
|
+
|
|
16
|
+
const Form = FormProvider
|
|
17
|
+
|
|
18
|
+
type FormFieldContextValue<
|
|
19
|
+
TFieldValues extends FieldValues = FieldValues,
|
|
20
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
21
|
+
> = {
|
|
22
|
+
name: TName
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const FormFieldContext = React.createContext<FormFieldContextValue>(
|
|
26
|
+
{} as FormFieldContextValue,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
const FormField = <
|
|
30
|
+
TFieldValues extends FieldValues = FieldValues,
|
|
31
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
32
|
+
>({
|
|
33
|
+
...props
|
|
34
|
+
}: ControllerProps<TFieldValues, TName>) => {
|
|
35
|
+
return (
|
|
36
|
+
<FormFieldContext.Provider value={{ name: props.name }}>
|
|
37
|
+
<Controller {...props} />
|
|
38
|
+
</FormFieldContext.Provider>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const useFormField = () => {
|
|
43
|
+
const fieldContext = React.useContext(FormFieldContext)
|
|
44
|
+
const itemContext = React.useContext(FormItemContext)
|
|
45
|
+
const { getFieldState, formState } = useFormContext()
|
|
46
|
+
|
|
47
|
+
const fieldState = getFieldState(fieldContext.name, formState)
|
|
48
|
+
|
|
49
|
+
if (!fieldContext) {
|
|
50
|
+
throw new Error("useFormField should be used within <FormField>")
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const { id } = itemContext
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
id,
|
|
57
|
+
name: fieldContext.name,
|
|
58
|
+
formItemId: `${id}-form-item`,
|
|
59
|
+
formDescriptionId: `${id}-form-item-description`,
|
|
60
|
+
formMessageId: `${id}-form-item-message`,
|
|
61
|
+
...fieldState,
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
type FormItemContextValue = {
|
|
66
|
+
id: string
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const FormItemContext = React.createContext<FormItemContextValue>(
|
|
70
|
+
{} as FormItemContextValue,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
const FormItem = React.forwardRef<
|
|
74
|
+
HTMLDivElement,
|
|
75
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
76
|
+
>(({ className, ...props }, ref) => {
|
|
77
|
+
const id = React.useId()
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<FormItemContext.Provider value={{ id }}>
|
|
81
|
+
<div ref={ref} className={cn("space-y-2", className)} {...props} />
|
|
82
|
+
</FormItemContext.Provider>
|
|
83
|
+
)
|
|
84
|
+
})
|
|
85
|
+
FormItem.displayName = "FormItem"
|
|
86
|
+
|
|
87
|
+
const FormLabel = React.forwardRef<
|
|
88
|
+
React.ElementRef<typeof LabelPrimitive.Root>,
|
|
89
|
+
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
|
|
90
|
+
>(({ className, ...props }, ref) => {
|
|
91
|
+
const { error, formItemId } = useFormField()
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<Label
|
|
95
|
+
ref={ref}
|
|
96
|
+
className={cn(error && "text-red-500 dark:text-red-900", className)}
|
|
97
|
+
htmlFor={formItemId}
|
|
98
|
+
{...props}
|
|
99
|
+
/>
|
|
100
|
+
)
|
|
101
|
+
})
|
|
102
|
+
FormLabel.displayName = "FormLabel"
|
|
103
|
+
|
|
104
|
+
const FormControl = React.forwardRef<
|
|
105
|
+
React.ElementRef<typeof Slot>,
|
|
106
|
+
React.ComponentPropsWithoutRef<typeof Slot>
|
|
107
|
+
>(({ ...props }, ref) => {
|
|
108
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<Slot
|
|
112
|
+
ref={ref}
|
|
113
|
+
id={formItemId}
|
|
114
|
+
aria-describedby={
|
|
115
|
+
!error
|
|
116
|
+
? `${formDescriptionId}`
|
|
117
|
+
: `${formDescriptionId} ${formMessageId}`
|
|
118
|
+
}
|
|
119
|
+
aria-invalid={!!error}
|
|
120
|
+
{...props}
|
|
121
|
+
/>
|
|
122
|
+
)
|
|
123
|
+
})
|
|
124
|
+
FormControl.displayName = "FormControl"
|
|
125
|
+
|
|
126
|
+
const FormDescription = React.forwardRef<
|
|
127
|
+
HTMLParagraphElement,
|
|
128
|
+
React.HTMLAttributes<HTMLParagraphElement>
|
|
129
|
+
>(({ className, ...props }, ref) => {
|
|
130
|
+
const { formDescriptionId } = useFormField()
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<p
|
|
134
|
+
ref={ref}
|
|
135
|
+
id={formDescriptionId}
|
|
136
|
+
className={cn(
|
|
137
|
+
"text-[0.8rem] text-slate-500 dark:text-slate-400",
|
|
138
|
+
className,
|
|
139
|
+
)}
|
|
140
|
+
{...props}
|
|
141
|
+
/>
|
|
142
|
+
)
|
|
143
|
+
})
|
|
144
|
+
FormDescription.displayName = "FormDescription"
|
|
145
|
+
|
|
146
|
+
const FormMessage = React.forwardRef<
|
|
147
|
+
HTMLParagraphElement,
|
|
148
|
+
React.HTMLAttributes<HTMLParagraphElement>
|
|
149
|
+
>(({ className, children, ...props }, ref) => {
|
|
150
|
+
const { error, formMessageId } = useFormField()
|
|
151
|
+
const body = error ? String(error?.message) : children
|
|
152
|
+
|
|
153
|
+
if (!body) {
|
|
154
|
+
return null
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<p
|
|
159
|
+
ref={ref}
|
|
160
|
+
id={formMessageId}
|
|
161
|
+
className={cn(
|
|
162
|
+
"text-[0.8rem] font-medium text-red-500 dark:text-red-900",
|
|
163
|
+
className,
|
|
164
|
+
)}
|
|
165
|
+
{...props}
|
|
166
|
+
>
|
|
167
|
+
{body}
|
|
168
|
+
</p>
|
|
169
|
+
)
|
|
170
|
+
})
|
|
171
|
+
FormMessage.displayName = "FormMessage"
|
|
172
|
+
|
|
173
|
+
export {
|
|
174
|
+
useFormField,
|
|
175
|
+
Form,
|
|
176
|
+
FormItem,
|
|
177
|
+
FormLabel,
|
|
178
|
+
FormControl,
|
|
179
|
+
FormDescription,
|
|
180
|
+
FormMessage,
|
|
181
|
+
FormField,
|
|
182
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as HoverCardPrimitive from "@radix-ui/react-hover-card"
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
|
|
6
|
+
const HoverCard = HoverCardPrimitive.Root
|
|
7
|
+
|
|
8
|
+
const HoverCardTrigger = HoverCardPrimitive.Trigger
|
|
9
|
+
|
|
10
|
+
const HoverCardContent = React.forwardRef<
|
|
11
|
+
React.ElementRef<typeof HoverCardPrimitive.Content>,
|
|
12
|
+
React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>
|
|
13
|
+
>(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
|
|
14
|
+
<HoverCardPrimitive.Content
|
|
15
|
+
ref={ref}
|
|
16
|
+
align={align}
|
|
17
|
+
sideOffset={sideOffset}
|
|
18
|
+
className={cn(
|
|
19
|
+
"z-50 w-64 rounded-md border border-slate-200 bg-white p-4 text-slate-950 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 dark:border-slate-800 dark:bg-slate-950 dark:text-slate-50",
|
|
20
|
+
className,
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
))
|
|
25
|
+
HoverCardContent.displayName = HoverCardPrimitive.Content.displayName
|
|
26
|
+
|
|
27
|
+
export { HoverCard, HoverCardTrigger, HoverCardContent }
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { DashIcon } from "@radix-ui/react-icons"
|
|
3
|
+
import { OTPInput, OTPInputContext } from "input-otp"
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
|
+
|
|
7
|
+
const InputOTP = React.forwardRef<
|
|
8
|
+
React.ElementRef<typeof OTPInput>,
|
|
9
|
+
React.ComponentPropsWithoutRef<typeof OTPInput>
|
|
10
|
+
>(({ className, containerClassName, ...props }, ref) => (
|
|
11
|
+
<OTPInput
|
|
12
|
+
ref={ref}
|
|
13
|
+
containerClassName={cn(
|
|
14
|
+
"flex items-center gap-2 has-[:disabled]:opacity-50",
|
|
15
|
+
containerClassName,
|
|
16
|
+
)}
|
|
17
|
+
className={cn("disabled:cursor-not-allowed", className)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
))
|
|
21
|
+
InputOTP.displayName = "InputOTP"
|
|
22
|
+
|
|
23
|
+
const InputOTPGroup = React.forwardRef<
|
|
24
|
+
React.ElementRef<"div">,
|
|
25
|
+
React.ComponentPropsWithoutRef<"div">
|
|
26
|
+
>(({ className, ...props }, ref) => (
|
|
27
|
+
<div ref={ref} className={cn("flex items-center", className)} {...props} />
|
|
28
|
+
))
|
|
29
|
+
InputOTPGroup.displayName = "InputOTPGroup"
|
|
30
|
+
|
|
31
|
+
const InputOTPSlot = React.forwardRef<
|
|
32
|
+
React.ElementRef<"div">,
|
|
33
|
+
React.ComponentPropsWithoutRef<"div"> & { index: number }
|
|
34
|
+
>(({ index, className, ...props }, ref) => {
|
|
35
|
+
const inputOTPContext = React.useContext(OTPInputContext)
|
|
36
|
+
const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index]
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
ref={ref}
|
|
41
|
+
className={cn(
|
|
42
|
+
"relative flex h-9 w-9 items-center justify-center border-y border-r border-slate-200 text-sm shadow-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md dark:border-slate-800",
|
|
43
|
+
isActive && "z-10 ring-1 ring-slate-950 dark:ring-slate-300",
|
|
44
|
+
className,
|
|
45
|
+
)}
|
|
46
|
+
{...props}
|
|
47
|
+
>
|
|
48
|
+
{char}
|
|
49
|
+
{hasFakeCaret && (
|
|
50
|
+
<div className="pointer-events-none absolute inset-0 flex items-center justify-center">
|
|
51
|
+
<div className="h-4 w-px animate-caret-blink bg-slate-950 duration-1000 dark:bg-slate-50" />
|
|
52
|
+
</div>
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
)
|
|
56
|
+
})
|
|
57
|
+
InputOTPSlot.displayName = "InputOTPSlot"
|
|
58
|
+
|
|
59
|
+
const InputOTPSeparator = React.forwardRef<
|
|
60
|
+
React.ElementRef<"div">,
|
|
61
|
+
React.ComponentPropsWithoutRef<"div">
|
|
62
|
+
>(({ ...props }, ref) => (
|
|
63
|
+
<div ref={ref} role="separator" {...props}>
|
|
64
|
+
<DashIcon />
|
|
65
|
+
</div>
|
|
66
|
+
))
|
|
67
|
+
InputOTPSeparator.displayName = "InputOTPSeparator"
|
|
68
|
+
|
|
69
|
+
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "@/lib/utils"
|
|
4
|
+
|
|
5
|
+
export interface InputProps
|
|
6
|
+
extends React.InputHTMLAttributes<HTMLInputElement> {}
|
|
7
|
+
|
|
8
|
+
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
9
|
+
({ className, type, ...props }, ref) => {
|
|
10
|
+
return (
|
|
11
|
+
<input
|
|
12
|
+
type={type}
|
|
13
|
+
className={cn(
|
|
14
|
+
"flex h-9 w-full rounded-md border border-slate-200 bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-slate-950 placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-slate-950 disabled:cursor-not-allowed disabled:opacity-50 dark:border-slate-800 dark:file:text-slate-50 dark:placeholder:text-slate-400 dark:focus-visible:ring-slate-300",
|
|
15
|
+
className,
|
|
16
|
+
)}
|
|
17
|
+
ref={ref}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
21
|
+
},
|
|
22
|
+
)
|
|
23
|
+
Input.displayName = "Input"
|
|
24
|
+
|
|
25
|
+
export { Input }
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as LabelPrimitive from "@radix-ui/react-label"
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
|
+
|
|
7
|
+
const labelVariants = cva(
|
|
8
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
const Label = React.forwardRef<
|
|
12
|
+
React.ElementRef<typeof LabelPrimitive.Root>,
|
|
13
|
+
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
|
|
14
|
+
VariantProps<typeof labelVariants>
|
|
15
|
+
>(({ className, ...props }, ref) => (
|
|
16
|
+
<LabelPrimitive.Root
|
|
17
|
+
ref={ref}
|
|
18
|
+
className={cn(labelVariants(), className)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
))
|
|
22
|
+
Label.displayName = LabelPrimitive.Root.displayName
|
|
23
|
+
|
|
24
|
+
export { Label }
|