create-tauri-ui 0.1.0
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/README.md +41 -0
- package/dist/index.mjs +53 -0
- package/index.js +3 -0
- package/package.json +62 -0
- package/templates/next/.env +1 -0
- package/templates/next/.github/workflows/release.yml +108 -0
- package/templates/next/.vscode/extensions.json +3 -0
- package/templates/next/LICENSE +21 -0
- package/templates/next/README.md +82 -0
- package/templates/next/app-icon.png +0 -0
- package/templates/next/next-env.d.ts +5 -0
- package/templates/next/next.config.js +17 -0
- package/templates/next/package.json +82 -0
- package/templates/next/pnpm-lock.yaml +4318 -0
- package/templates/next/postcss.config.js +6 -0
- package/templates/next/prettier.config.js +35 -0
- package/templates/next/public/avatars/01.png +0 -0
- package/templates/next/public/avatars/02.png +0 -0
- package/templates/next/public/avatars/03.png +0 -0
- package/templates/next/public/avatars/04.png +0 -0
- package/templates/next/public/avatars/05.png +0 -0
- package/templates/next/src/app/examples/authentication/components/user-auth-form.tsx +71 -0
- package/templates/next/src/app/examples/authentication/page.tsx +80 -0
- package/templates/next/src/app/examples/cards/components/cookie-settings.tsx +60 -0
- package/templates/next/src/app/examples/cards/components/create-account.tsx +60 -0
- package/templates/next/src/app/examples/cards/components/date-picker.tsx +18 -0
- package/templates/next/src/app/examples/cards/components/github-card.tsx +81 -0
- package/templates/next/src/app/examples/cards/components/notifications.tsx +51 -0
- package/templates/next/src/app/examples/cards/components/payment-method.tsx +117 -0
- package/templates/next/src/app/examples/cards/components/report-an-issue.tsx +82 -0
- package/templates/next/src/app/examples/cards/components/share-document.tsx +116 -0
- package/templates/next/src/app/examples/cards/components/team-members.tsx +147 -0
- package/templates/next/src/app/examples/cards/page.tsx +75 -0
- package/templates/next/src/app/examples/cards/styles.css +63 -0
- package/templates/next/src/app/examples/dashboard/components/date-range-picker.tsx +66 -0
- package/templates/next/src/app/examples/dashboard/components/main-nav.tsx +38 -0
- package/templates/next/src/app/examples/dashboard/components/overview.tsx +78 -0
- package/templates/next/src/app/examples/dashboard/components/recent-sales.tsx +67 -0
- package/templates/next/src/app/examples/dashboard/components/search.tsx +13 -0
- package/templates/next/src/app/examples/dashboard/components/team-switcher.tsx +205 -0
- package/templates/next/src/app/examples/dashboard/components/user-nav.tsx +67 -0
- package/templates/next/src/app/examples/dashboard/page.tsx +147 -0
- package/templates/next/src/app/examples/forms/account/account-form.tsx +219 -0
- package/templates/next/src/app/examples/forms/account/page.tsx +18 -0
- package/templates/next/src/app/examples/forms/appearance/appearance-form.tsx +164 -0
- package/templates/next/src/app/examples/forms/appearance/page.tsx +18 -0
- package/templates/next/src/app/examples/forms/components/sidebar-nav.tsx +43 -0
- package/templates/next/src/app/examples/forms/display/display-form.tsx +132 -0
- package/templates/next/src/app/examples/forms/display/page.tsx +17 -0
- package/templates/next/src/app/examples/forms/layout.tsx +57 -0
- package/templates/next/src/app/examples/forms/notifications/notifications-form.tsx +221 -0
- package/templates/next/src/app/examples/forms/notifications/page.tsx +18 -0
- package/templates/next/src/app/examples/forms/page.tsx +17 -0
- package/templates/next/src/app/examples/forms/profile-form.tsx +190 -0
- package/templates/next/src/app/examples/layout.tsx +7 -0
- package/templates/next/src/app/examples/music/components/album-artwork.tsx +84 -0
- package/templates/next/src/app/examples/music/components/menu.tsx +178 -0
- package/templates/next/src/app/examples/music/components/podcast-empty-placeholder.tsx +53 -0
- package/templates/next/src/app/examples/music/components/sidebar.tsx +100 -0
- package/templates/next/src/app/examples/music/data/albums.ts +71 -0
- package/templates/next/src/app/examples/music/data/playlists.ts +16 -0
- package/templates/next/src/app/examples/music/page.tsx +134 -0
- package/templates/next/src/app/examples/music/styles.css +65 -0
- package/templates/next/src/app/examples/playground/components/code-viewer.tsx +89 -0
- package/templates/next/src/app/examples/playground/components/icons.tsx +153 -0
- package/templates/next/src/app/examples/playground/components/maxlength-selector.tsx +55 -0
- package/templates/next/src/app/examples/playground/components/model-selector.tsx +163 -0
- package/templates/next/src/app/examples/playground/components/preset-actions.tsx +124 -0
- package/templates/next/src/app/examples/playground/components/preset-save.tsx +44 -0
- package/templates/next/src/app/examples/playground/components/preset-selector.tsx +82 -0
- package/templates/next/src/app/examples/playground/components/preset-share.tsx +46 -0
- package/templates/next/src/app/examples/playground/components/temperature-selector.tsx +57 -0
- package/templates/next/src/app/examples/playground/components/top-p-selector.tsx +54 -0
- package/templates/next/src/app/examples/playground/data/models.ts +62 -0
- package/templates/next/src/app/examples/playground/data/presets.ts +47 -0
- package/templates/next/src/app/examples/playground/page.tsx +160 -0
- package/templates/next/src/app/examples/playground/styles.css +65 -0
- package/templates/next/src/app/examples/tasks/components/columns.tsx +120 -0
- package/templates/next/src/app/examples/tasks/components/data-table-column-header.tsx +66 -0
- package/templates/next/src/app/examples/tasks/components/data-table-faceted-filter.tsx +147 -0
- package/templates/next/src/app/examples/tasks/components/data-table-pagination.tsx +97 -0
- package/templates/next/src/app/examples/tasks/components/data-table-row-actions.tsx +82 -0
- package/templates/next/src/app/examples/tasks/components/data-table-toolbar.tsx +63 -0
- package/templates/next/src/app/examples/tasks/components/data-table-view-options.tsx +59 -0
- package/templates/next/src/app/examples/tasks/components/data-table.tsx +126 -0
- package/templates/next/src/app/examples/tasks/components/user-nav.tsx +67 -0
- package/templates/next/src/app/examples/tasks/data/data.tsx +71 -0
- package/templates/next/src/app/examples/tasks/data/schema.ts +13 -0
- package/templates/next/src/app/examples/tasks/data/seed.ts +20 -0
- package/templates/next/src/app/examples/tasks/data/tasks.json +702 -0
- package/templates/next/src/app/examples/tasks/page.tsx +47 -0
- package/templates/next/src/app/layout.tsx +43 -0
- package/templates/next/src/app/page.tsx +5 -0
- package/templates/next/src/assets/Inter.var.woff2 +0 -0
- package/templates/next/src/assets/logo.png +0 -0
- package/templates/next/src/components/examples/.eslintrc.json +6 -0
- package/templates/next/src/components/examples/accordion/demo.tsx +32 -0
- package/templates/next/src/components/examples/alert/demo.tsx +15 -0
- package/templates/next/src/components/examples/alert/destructive.tsx +15 -0
- package/templates/next/src/components/examples/alert-dialog/demo.tsx +35 -0
- package/templates/next/src/components/examples/aspect-ratio/demo.tsx +16 -0
- package/templates/next/src/components/examples/avatar/demo.tsx +10 -0
- package/templates/next/src/components/examples/badge/demo.tsx +5 -0
- package/templates/next/src/components/examples/badge/destructive.tsx +5 -0
- package/templates/next/src/components/examples/badge/outline.tsx +5 -0
- package/templates/next/src/components/examples/badge/secondary.tsx +5 -0
- package/templates/next/src/components/examples/button/as-child.tsx +10 -0
- package/templates/next/src/components/examples/button/demo.tsx +5 -0
- package/templates/next/src/components/examples/button/destructive.tsx +5 -0
- package/templates/next/src/components/examples/button/ghost.tsx +5 -0
- package/templates/next/src/components/examples/button/link.tsx +5 -0
- package/templates/next/src/components/examples/button/loading.tsx +12 -0
- package/templates/next/src/components/examples/button/outline.tsx +5 -0
- package/templates/next/src/components/examples/button/secondary.tsx +5 -0
- package/templates/next/src/components/examples/button/with-icon.tsx +11 -0
- package/templates/next/src/components/examples/calendar/date-picker.tsx +43 -0
- package/templates/next/src/components/examples/calendar/date-range-picker.tsx +65 -0
- package/templates/next/src/components/examples/calendar/demo.tsx +18 -0
- package/templates/next/src/components/examples/calendar/react-hook-form.tsx +101 -0
- package/templates/next/src/components/examples/calendar/with-presets.tsx +62 -0
- package/templates/next/src/components/examples/card/demo.tsx +79 -0
- package/templates/next/src/components/examples/card/with-form.tsx +59 -0
- package/templates/next/src/components/examples/checkbox/demo.tsx +17 -0
- package/templates/next/src/components/examples/checkbox/disabled.tsx +15 -0
- package/templates/next/src/components/examples/checkbox/react-hook-form-multiple.tsx +127 -0
- package/templates/next/src/components/examples/checkbox/react-hook-form-single.tsx +72 -0
- package/templates/next/src/components/examples/checkbox/with-text.tsx +22 -0
- package/templates/next/src/components/examples/collapsible/demo.tsx +46 -0
- package/templates/next/src/components/examples/combobox/demo.tsx +90 -0
- package/templates/next/src/components/examples/combobox/dropdown-menu.tsx +110 -0
- package/templates/next/src/components/examples/combobox/popover.tsx +124 -0
- package/templates/next/src/components/examples/combobox/react-hook-form.tsx +135 -0
- package/templates/next/src/components/examples/command/combobox.tsx +90 -0
- package/templates/next/src/components/examples/command/demo.tsx +62 -0
- package/templates/next/src/components/examples/command/dialog.tsx +86 -0
- package/templates/next/src/components/examples/command/dropdown-menu.tsx +110 -0
- package/templates/next/src/components/examples/command/popover.tsx +124 -0
- package/templates/next/src/components/examples/context-menu/demo.tsx +67 -0
- package/templates/next/src/components/examples/data-table/columns.tsx +110 -0
- package/templates/next/src/components/examples/data-table/data-table.tsx +185 -0
- package/templates/next/src/components/examples/data-table/demo.tsx +41 -0
- package/templates/next/src/components/examples/date-picker/demo.tsx +43 -0
- package/templates/next/src/components/examples/date-picker/react-hook-form.tsx +101 -0
- package/templates/next/src/components/examples/date-picker/with-presets.tsx +62 -0
- package/templates/next/src/components/examples/date-picker/with-range.tsx +65 -0
- package/templates/next/src/components/examples/dialog/demo.tsx +47 -0
- package/templates/next/src/components/examples/dropdown-menu/checkboxes.tsx +53 -0
- package/templates/next/src/components/examples/dropdown-menu/demo.tsx +122 -0
- package/templates/next/src/components/examples/dropdown-menu/radio-group.tsx +37 -0
- package/templates/next/src/components/examples/hover-card/demo.tsx +39 -0
- package/templates/next/src/components/examples/index.tsx +213 -0
- package/templates/next/src/components/examples/input/demo.tsx +5 -0
- package/templates/next/src/components/examples/input/disabled.tsx +5 -0
- package/templates/next/src/components/examples/input/file.tsx +11 -0
- package/templates/next/src/components/examples/input/react-hook-form.tsx +65 -0
- package/templates/next/src/components/examples/input/with-button.tsx +11 -0
- package/templates/next/src/components/examples/input/with-label.tsx +11 -0
- package/templates/next/src/components/examples/input/with-text.tsx +12 -0
- package/templates/next/src/components/examples/label/demo.tsx +13 -0
- package/templates/next/src/components/examples/menubar/demo.tsx +107 -0
- package/templates/next/src/components/examples/navigation-menu/demo.tsx +144 -0
- package/templates/next/src/components/examples/popover/demo.tsx +67 -0
- package/templates/next/src/components/examples/progress/demo.tsx +16 -0
- package/templates/next/src/components/examples/radio-group/demo.tsx +21 -0
- package/templates/next/src/components/examples/radio-group/react-hook-form.tsx +88 -0
- package/templates/next/src/components/examples/scroll-area/demo.tsx +26 -0
- package/templates/next/src/components/examples/select/demo.tsx +31 -0
- package/templates/next/src/components/examples/select/react-hook-form.tsx +83 -0
- package/templates/next/src/components/examples/separator/demo.tsx +22 -0
- package/templates/next/src/components/examples/sheet/demo.tsx +47 -0
- package/templates/next/src/components/examples/sheet/position.tsx +75 -0
- package/templates/next/src/components/examples/sheet/size.tsx +75 -0
- package/templates/next/src/components/examples/skeleton/demo.tsx +13 -0
- package/templates/next/src/components/examples/slider/demo.tsx +16 -0
- package/templates/next/src/components/examples/switch/demo.tsx +11 -0
- package/templates/next/src/components/examples/switch/react-hook-form.tsx +101 -0
- package/templates/next/src/components/examples/table/demo.tsx +80 -0
- package/templates/next/src/components/examples/tabs/demo.tsx +69 -0
- package/templates/next/src/components/examples/textarea/demo.tsx +5 -0
- package/templates/next/src/components/examples/textarea/disabled.tsx +5 -0
- package/templates/next/src/components/examples/textarea/react-hook-form.tsx +77 -0
- package/templates/next/src/components/examples/textarea/with-button.tsx +11 -0
- package/templates/next/src/components/examples/textarea/with-label.tsx +11 -0
- package/templates/next/src/components/examples/textarea/with-text.tsx +14 -0
- package/templates/next/src/components/examples/toast/demo.tsx +26 -0
- package/templates/next/src/components/examples/toast/destructive.tsx +25 -0
- package/templates/next/src/components/examples/toast/simple.tsx +21 -0
- package/templates/next/src/components/examples/toast/with-action.tsx +24 -0
- package/templates/next/src/components/examples/toast/with-title.tsx +22 -0
- package/templates/next/src/components/examples/toggle/demo.tsx +11 -0
- package/templates/next/src/components/examples/toggle/disabled.tsx +11 -0
- package/templates/next/src/components/examples/toggle/lg.tsx +11 -0
- package/templates/next/src/components/examples/toggle/outline.tsx +11 -0
- package/templates/next/src/components/examples/toggle/sm.tsx +11 -0
- package/templates/next/src/components/examples/toggle/with-text.tsx +12 -0
- package/templates/next/src/components/examples/tooltip/demo.tsx +27 -0
- package/templates/next/src/components/examples/typography/blockquote.tsx +8 -0
- package/templates/next/src/components/examples/typography/demo.tsx +119 -0
- package/templates/next/src/components/examples/typography/h1.tsx +7 -0
- package/templates/next/src/components/examples/typography/h2.tsx +7 -0
- package/templates/next/src/components/examples/typography/h3.tsx +7 -0
- package/templates/next/src/components/examples/typography/h4.tsx +7 -0
- package/templates/next/src/components/examples/typography/inline-code.tsx +7 -0
- package/templates/next/src/components/examples/typography/large.tsx +5 -0
- package/templates/next/src/components/examples/typography/lead.tsx +8 -0
- package/templates/next/src/components/examples/typography/list.tsx +9 -0
- package/templates/next/src/components/examples/typography/muted.tsx +5 -0
- package/templates/next/src/components/examples/typography/p.tsx +8 -0
- package/templates/next/src/components/examples/typography/small.tsx +5 -0
- package/templates/next/src/components/examples/typography/table.tsx +44 -0
- package/templates/next/src/components/examples-nav.tsx +70 -0
- package/templates/next/src/components/greeting.tsx +21 -0
- package/templates/next/src/components/icons.tsx +154 -0
- package/templates/next/src/components/menu-mode-toggle.tsx +46 -0
- package/templates/next/src/components/menu.tsx +268 -0
- package/templates/next/src/components/mode-toggle.tsx +43 -0
- package/templates/next/src/components/page-header.tsx +50 -0
- package/templates/next/src/components/react-hook-form/form.tsx +176 -0
- package/templates/next/src/components/style-switcher.tsx +19 -0
- package/templates/next/src/components/tailwind-indicator.tsx +18 -0
- package/templates/next/src/components/theme-provider.tsx +9 -0
- package/templates/next/src/components/ui/accordion.tsx +60 -0
- package/templates/next/src/components/ui/alert-dialog.tsx +150 -0
- package/templates/next/src/components/ui/alert.tsx +61 -0
- package/templates/next/src/components/ui/aspect-ratio.tsx +7 -0
- package/templates/next/src/components/ui/avatar.tsx +50 -0
- package/templates/next/src/components/ui/badge.tsx +36 -0
- package/templates/next/src/components/ui/button.tsx +51 -0
- package/templates/next/src/components/ui/calendar.tsx +64 -0
- package/templates/next/src/components/ui/card.tsx +81 -0
- package/templates/next/src/components/ui/checkbox.tsx +30 -0
- package/templates/next/src/components/ui/collapsible.tsx +11 -0
- package/templates/next/src/components/ui/command.tsx +155 -0
- package/templates/next/src/components/ui/context-menu.tsx +200 -0
- package/templates/next/src/components/ui/dialog.tsx +128 -0
- package/templates/next/src/components/ui/dropdown-menu.tsx +200 -0
- package/templates/next/src/components/ui/hover-card.tsx +29 -0
- package/templates/next/src/components/ui/input.tsx +27 -0
- package/templates/next/src/components/ui/label.tsx +26 -0
- package/templates/next/src/components/ui/menubar.tsx +236 -0
- package/templates/next/src/components/ui/navigation-menu.tsx +130 -0
- package/templates/next/src/components/ui/popover.tsx +31 -0
- package/templates/next/src/components/ui/progress.tsx +28 -0
- package/templates/next/src/components/ui/radio-group.tsx +44 -0
- package/templates/next/src/components/ui/scroll-area.tsx +48 -0
- package/templates/next/src/components/ui/select.tsx +120 -0
- package/templates/next/src/components/ui/separator.tsx +31 -0
- package/templates/next/src/components/ui/sheet.tsx +230 -0
- package/templates/next/src/components/ui/skeleton.tsx +17 -0
- package/templates/next/src/components/ui/slider.tsx +28 -0
- package/templates/next/src/components/ui/switch.tsx +29 -0
- package/templates/next/src/components/ui/table.tsx +114 -0
- package/templates/next/src/components/ui/tabs.tsx +55 -0
- package/templates/next/src/components/ui/textarea.tsx +26 -0
- package/templates/next/src/components/ui/toast.tsx +129 -0
- package/templates/next/src/components/ui/toaster.tsx +35 -0
- package/templates/next/src/components/ui/toggle.tsx +45 -0
- package/templates/next/src/components/ui/tooltip.tsx +30 -0
- package/templates/next/src/components/ui/use-toast.ts +191 -0
- package/templates/next/src/data/albums.ts +71 -0
- package/templates/next/src/data/playlists.ts +16 -0
- package/templates/next/src/hooks/use-lock-body.ts +12 -0
- package/templates/next/src/hooks/use-mounted.ts +11 -0
- package/templates/next/src/hooks/use-mutation-observer.ts +20 -0
- package/templates/next/src/lib/fonts.ts +11 -0
- package/templates/next/src/lib/utils.ts +19 -0
- package/templates/next/src/styles/globals.css +124 -0
- package/templates/next/src-tauri/Cargo.lock +3636 -0
- package/templates/next/src-tauri/Cargo.toml +36 -0
- package/templates/next/src-tauri/build.rs +3 -0
- package/templates/next/src-tauri/icons/128x128.png +0 -0
- package/templates/next/src-tauri/icons/128x128@2x.png +0 -0
- package/templates/next/src-tauri/icons/32x32.png +0 -0
- package/templates/next/src-tauri/icons/Square107x107Logo.png +0 -0
- package/templates/next/src-tauri/icons/Square142x142Logo.png +0 -0
- package/templates/next/src-tauri/icons/Square150x150Logo.png +0 -0
- package/templates/next/src-tauri/icons/Square284x284Logo.png +0 -0
- package/templates/next/src-tauri/icons/Square30x30Logo.png +0 -0
- package/templates/next/src-tauri/icons/Square310x310Logo.png +0 -0
- package/templates/next/src-tauri/icons/Square44x44Logo.png +0 -0
- package/templates/next/src-tauri/icons/Square71x71Logo.png +0 -0
- package/templates/next/src-tauri/icons/Square89x89Logo.png +0 -0
- package/templates/next/src-tauri/icons/StoreLogo.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-hdpi/ic_launcher.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-hdpi/ic_launcher_foreground.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-mdpi/ic_launcher.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-mdpi/ic_launcher_foreground.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-xhdpi/ic_launcher.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
- package/templates/next/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/templates/next/src-tauri/icons/icon.icns +0 -0
- package/templates/next/src-tauri/icons/icon.ico +0 -0
- package/templates/next/src-tauri/icons/icon.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-20x20@1x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-20x20@2x-1.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-20x20@2x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-20x20@3x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-29x29@1x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-29x29@2x-1.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-29x29@2x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-29x29@3x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-40x40@1x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-40x40@2x-1.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-40x40@2x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-40x40@3x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-512@2x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-60x60@2x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-60x60@3x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-76x76@1x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-76x76@2x.png +0 -0
- package/templates/next/src-tauri/icons/ios/AppIcon-83.5x83.5@2x.png +0 -0
- package/templates/next/src-tauri/src/main.rs +19 -0
- package/templates/next/src-tauri/tauri.conf.json +63 -0
- package/templates/next/tailwind.config.js +80 -0
- package/templates/next/tsconfig.json +35 -0
- package/templates/vite/.github/workflows/release.yml +108 -0
- package/templates/vite/.vscode/extensions.json +3 -0
- package/templates/vite/README.md +7 -0
- package/templates/vite/app-icon.png +0 -0
- package/templates/vite/index.html +16 -0
- package/templates/vite/package.json +75 -0
- package/templates/vite/pnpm-lock.yaml +4569 -0
- package/templates/vite/postcss.config.js +6 -0
- package/templates/vite/prettier.config.cjs +35 -0
- package/templates/vite/src/App.tsx +39 -0
- package/templates/vite/src/aa +34 -0
- package/templates/vite/src/assets/Inter.var.woff2 +0 -0
- package/templates/vite/src/components/icons.tsx +154 -0
- package/templates/vite/src/components/menu-mode-toggle.tsx +46 -0
- package/templates/vite/src/components/menu.tsx +232 -0
- package/templates/vite/src/components/tailwind-indicator.tsx +18 -0
- package/templates/vite/src/components/theme-provider.tsx +9 -0
- package/templates/vite/src/components/ui/accordion.tsx +60 -0
- package/templates/vite/src/components/ui/alert-dialog.tsx +150 -0
- package/templates/vite/src/components/ui/alert.tsx +61 -0
- package/templates/vite/src/components/ui/aspect-ratio.tsx +7 -0
- package/templates/vite/src/components/ui/avatar.tsx +50 -0
- package/templates/vite/src/components/ui/badge.tsx +36 -0
- package/templates/vite/src/components/ui/button.tsx +51 -0
- package/templates/vite/src/components/ui/calendar.tsx +64 -0
- package/templates/vite/src/components/ui/card.tsx +81 -0
- package/templates/vite/src/components/ui/checkbox.tsx +30 -0
- package/templates/vite/src/components/ui/collapsible.tsx +11 -0
- package/templates/vite/src/components/ui/command.tsx +155 -0
- package/templates/vite/src/components/ui/context-menu.tsx +200 -0
- package/templates/vite/src/components/ui/dialog.tsx +128 -0
- package/templates/vite/src/components/ui/dropdown-menu.tsx +200 -0
- package/templates/vite/src/components/ui/hover-card.tsx +29 -0
- package/templates/vite/src/components/ui/input.tsx +27 -0
- package/templates/vite/src/components/ui/label.tsx +26 -0
- package/templates/vite/src/components/ui/menubar.tsx +236 -0
- package/templates/vite/src/components/ui/navigation-menu.tsx +130 -0
- package/templates/vite/src/components/ui/popover.tsx +31 -0
- package/templates/vite/src/components/ui/progress.tsx +28 -0
- package/templates/vite/src/components/ui/radio-group.tsx +44 -0
- package/templates/vite/src/components/ui/scroll-area.tsx +48 -0
- package/templates/vite/src/components/ui/select.tsx +120 -0
- package/templates/vite/src/components/ui/separator.tsx +31 -0
- package/templates/vite/src/components/ui/sheet.tsx +230 -0
- package/templates/vite/src/components/ui/skeleton.tsx +17 -0
- package/templates/vite/src/components/ui/slider.tsx +28 -0
- package/templates/vite/src/components/ui/switch.tsx +29 -0
- package/templates/vite/src/components/ui/table.tsx +114 -0
- package/templates/vite/src/components/ui/tabs.tsx +55 -0
- package/templates/vite/src/components/ui/textarea.tsx +26 -0
- package/templates/vite/src/components/ui/toast.tsx +129 -0
- package/templates/vite/src/components/ui/toaster.tsx +35 -0
- package/templates/vite/src/components/ui/toggle.tsx +45 -0
- package/templates/vite/src/components/ui/tooltip.tsx +30 -0
- package/templates/vite/src/components/ui/use-toast.ts +191 -0
- package/templates/vite/src/dashboard/components/date-range-picker.tsx +66 -0
- package/templates/vite/src/dashboard/components/main-nav.tsx +38 -0
- package/templates/vite/src/dashboard/components/overview.tsx +78 -0
- package/templates/vite/src/dashboard/components/recent-sales.tsx +67 -0
- package/templates/vite/src/dashboard/components/search.tsx +13 -0
- package/templates/vite/src/dashboard/components/team-switcher.tsx +205 -0
- package/templates/vite/src/dashboard/components/user-nav.tsx +67 -0
- package/templates/vite/src/dashboard/page.tsx +140 -0
- package/templates/vite/src/lib/utils.ts +19 -0
- package/templates/vite/src/main.tsx +10 -0
- package/templates/vite/src/styles/globals.css +124 -0
- package/templates/vite/src/vite-env.d.ts +1 -0
- package/templates/vite/src-tauri/Cargo.lock +3636 -0
- package/templates/vite/src-tauri/Cargo.toml +33 -0
- package/templates/vite/src-tauri/build.rs +3 -0
- package/templates/vite/src-tauri/icons/128x128.png +0 -0
- package/templates/vite/src-tauri/icons/128x128@2x.png +0 -0
- package/templates/vite/src-tauri/icons/32x32.png +0 -0
- package/templates/vite/src-tauri/icons/Square107x107Logo.png +0 -0
- package/templates/vite/src-tauri/icons/Square142x142Logo.png +0 -0
- package/templates/vite/src-tauri/icons/Square150x150Logo.png +0 -0
- package/templates/vite/src-tauri/icons/Square284x284Logo.png +0 -0
- package/templates/vite/src-tauri/icons/Square30x30Logo.png +0 -0
- package/templates/vite/src-tauri/icons/Square310x310Logo.png +0 -0
- package/templates/vite/src-tauri/icons/Square44x44Logo.png +0 -0
- package/templates/vite/src-tauri/icons/Square71x71Logo.png +0 -0
- package/templates/vite/src-tauri/icons/Square89x89Logo.png +0 -0
- package/templates/vite/src-tauri/icons/StoreLogo.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-hdpi/ic_launcher.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-hdpi/ic_launcher_foreground.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-mdpi/ic_launcher.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-mdpi/ic_launcher_foreground.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-xhdpi/ic_launcher.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
- package/templates/vite/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/templates/vite/src-tauri/icons/icon.icns +0 -0
- package/templates/vite/src-tauri/icons/icon.ico +0 -0
- package/templates/vite/src-tauri/icons/icon.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-20x20@1x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-20x20@2x-1.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-20x20@2x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-20x20@3x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-29x29@1x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-29x29@2x-1.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-29x29@2x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-29x29@3x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-40x40@1x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-40x40@2x-1.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-40x40@2x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-40x40@3x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-512@2x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-60x60@2x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-60x60@3x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-76x76@1x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-76x76@2x.png +0 -0
- package/templates/vite/src-tauri/icons/ios/AppIcon-83.5x83.5@2x.png +0 -0
- package/templates/vite/src-tauri/src/main.rs +16 -0
- package/templates/vite/src-tauri/tauri.conf.json +63 -0
- package/templates/vite/tailwind.config.js +78 -0
- package/templates/vite/tsconfig.json +26 -0
- package/templates/vite/tsconfig.node.json +9 -0
- package/templates/vite/vite.config.ts +33 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { zodResolver } from "@hookform/resolvers/zod"
|
|
4
|
+
import { useForm } from "react-hook-form"
|
|
5
|
+
import * as z from "zod"
|
|
6
|
+
|
|
7
|
+
import { Button } from "@/components/ui/button"
|
|
8
|
+
import { Checkbox } from "@/components/ui/checkbox"
|
|
9
|
+
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"
|
|
10
|
+
import { Switch } from "@/components/ui/switch"
|
|
11
|
+
import { toast } from "@/components/ui/use-toast"
|
|
12
|
+
import {
|
|
13
|
+
Form,
|
|
14
|
+
FormControl,
|
|
15
|
+
FormDescription,
|
|
16
|
+
FormField,
|
|
17
|
+
FormItem,
|
|
18
|
+
FormLabel,
|
|
19
|
+
FormMessage,
|
|
20
|
+
} from "@/components/react-hook-form/form"
|
|
21
|
+
|
|
22
|
+
const notificationsFormSchema = z.object({
|
|
23
|
+
type: z.enum(["all", "mentions", "none"], {
|
|
24
|
+
required_error: "You need to select a notification type.",
|
|
25
|
+
}),
|
|
26
|
+
mobile: z.boolean().default(false).optional(),
|
|
27
|
+
communication_emails: z.boolean().default(false).optional(),
|
|
28
|
+
social_emails: z.boolean().default(false).optional(),
|
|
29
|
+
marketing_emails: z.boolean().default(false).optional(),
|
|
30
|
+
security_emails: z.boolean(),
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
type NotificationsFormValues = z.infer<typeof notificationsFormSchema>
|
|
34
|
+
|
|
35
|
+
// This can come from your database or API.
|
|
36
|
+
const defaultValues: Partial<NotificationsFormValues> = {
|
|
37
|
+
communication_emails: false,
|
|
38
|
+
marketing_emails: false,
|
|
39
|
+
social_emails: true,
|
|
40
|
+
security_emails: true,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function NotificationsForm() {
|
|
44
|
+
const form = useForm<NotificationsFormValues>({
|
|
45
|
+
resolver: zodResolver(notificationsFormSchema),
|
|
46
|
+
defaultValues,
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
function onSubmit(data: NotificationsFormValues) {
|
|
50
|
+
toast({
|
|
51
|
+
title: "You submitted the following values:",
|
|
52
|
+
description: (
|
|
53
|
+
<pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
|
|
54
|
+
<code className="text-white">{JSON.stringify(data, null, 2)}</code>
|
|
55
|
+
</pre>
|
|
56
|
+
),
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Form {...form}>
|
|
62
|
+
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
|
|
63
|
+
<FormField
|
|
64
|
+
control={form.control}
|
|
65
|
+
name="type"
|
|
66
|
+
render={({ field }) => (
|
|
67
|
+
<FormItem className="space-y-3">
|
|
68
|
+
<FormLabel>Notify me about...</FormLabel>
|
|
69
|
+
<FormControl>
|
|
70
|
+
<RadioGroup
|
|
71
|
+
onValueChange={field.onChange}
|
|
72
|
+
defaultValue={field.value}
|
|
73
|
+
className="flex flex-col space-y-1"
|
|
74
|
+
>
|
|
75
|
+
<FormItem className="flex items-center space-x-3 space-y-0">
|
|
76
|
+
<FormControl>
|
|
77
|
+
<RadioGroupItem value="all" />
|
|
78
|
+
</FormControl>
|
|
79
|
+
<FormLabel className="font-normal">
|
|
80
|
+
All new messages
|
|
81
|
+
</FormLabel>
|
|
82
|
+
</FormItem>
|
|
83
|
+
<FormItem className="flex items-center space-x-3 space-y-0">
|
|
84
|
+
<FormControl>
|
|
85
|
+
<RadioGroupItem value="mentions" />
|
|
86
|
+
</FormControl>
|
|
87
|
+
<FormLabel className="font-normal">
|
|
88
|
+
Direct messages and mentions
|
|
89
|
+
</FormLabel>
|
|
90
|
+
</FormItem>
|
|
91
|
+
<FormItem className="flex items-center space-x-3 space-y-0">
|
|
92
|
+
<FormControl>
|
|
93
|
+
<RadioGroupItem value="none" />
|
|
94
|
+
</FormControl>
|
|
95
|
+
<FormLabel className="font-normal">Nothing</FormLabel>
|
|
96
|
+
</FormItem>
|
|
97
|
+
</RadioGroup>
|
|
98
|
+
</FormControl>
|
|
99
|
+
<FormMessage />
|
|
100
|
+
</FormItem>
|
|
101
|
+
)}
|
|
102
|
+
/>
|
|
103
|
+
<div>
|
|
104
|
+
<h3 className="mb-4 text-lg font-medium">Email Notifications</h3>
|
|
105
|
+
<div className="space-y-4">
|
|
106
|
+
<FormField
|
|
107
|
+
control={form.control}
|
|
108
|
+
name="communication_emails"
|
|
109
|
+
render={({ field }) => (
|
|
110
|
+
<FormItem className="flex flex-row items-center justify-between rounded-lg border p-4">
|
|
111
|
+
<div className="space-y-0.5">
|
|
112
|
+
<FormLabel className="text-base">
|
|
113
|
+
Communication emails
|
|
114
|
+
</FormLabel>
|
|
115
|
+
<FormDescription>
|
|
116
|
+
Receive emails about your account activity.
|
|
117
|
+
</FormDescription>
|
|
118
|
+
</div>
|
|
119
|
+
<FormControl>
|
|
120
|
+
<Switch
|
|
121
|
+
checked={field.value}
|
|
122
|
+
onCheckedChange={field.onChange}
|
|
123
|
+
/>
|
|
124
|
+
</FormControl>
|
|
125
|
+
</FormItem>
|
|
126
|
+
)}
|
|
127
|
+
/>
|
|
128
|
+
<FormField
|
|
129
|
+
control={form.control}
|
|
130
|
+
name="marketing_emails"
|
|
131
|
+
render={({ field }) => (
|
|
132
|
+
<FormItem className="flex flex-row items-center justify-between rounded-lg border p-4">
|
|
133
|
+
<div className="space-y-0.5">
|
|
134
|
+
<FormLabel className="text-base">
|
|
135
|
+
Marketing emails
|
|
136
|
+
</FormLabel>
|
|
137
|
+
<FormDescription>
|
|
138
|
+
Receive emails about new products, features, and more.
|
|
139
|
+
</FormDescription>
|
|
140
|
+
</div>
|
|
141
|
+
<FormControl>
|
|
142
|
+
<Switch
|
|
143
|
+
checked={field.value}
|
|
144
|
+
onCheckedChange={field.onChange}
|
|
145
|
+
/>
|
|
146
|
+
</FormControl>
|
|
147
|
+
</FormItem>
|
|
148
|
+
)}
|
|
149
|
+
/>
|
|
150
|
+
<FormField
|
|
151
|
+
control={form.control}
|
|
152
|
+
name="social_emails"
|
|
153
|
+
render={({ field }) => (
|
|
154
|
+
<FormItem className="flex flex-row items-center justify-between rounded-lg border p-4">
|
|
155
|
+
<div className="space-y-0.5">
|
|
156
|
+
<FormLabel className="text-base">Social emails</FormLabel>
|
|
157
|
+
<FormDescription>
|
|
158
|
+
Receive emails for friend requests, follows, and more.
|
|
159
|
+
</FormDescription>
|
|
160
|
+
</div>
|
|
161
|
+
<FormControl>
|
|
162
|
+
<Switch
|
|
163
|
+
checked={field.value}
|
|
164
|
+
onCheckedChange={field.onChange}
|
|
165
|
+
/>
|
|
166
|
+
</FormControl>
|
|
167
|
+
</FormItem>
|
|
168
|
+
)}
|
|
169
|
+
/>
|
|
170
|
+
<FormField
|
|
171
|
+
control={form.control}
|
|
172
|
+
name="security_emails"
|
|
173
|
+
render={({ field }) => (
|
|
174
|
+
<FormItem className="flex flex-row items-center justify-between rounded-lg border p-4">
|
|
175
|
+
<div className="space-y-0.5">
|
|
176
|
+
<FormLabel className="text-base">Security emails</FormLabel>
|
|
177
|
+
<FormDescription>
|
|
178
|
+
Receive emails about your account activity and security.
|
|
179
|
+
</FormDescription>
|
|
180
|
+
</div>
|
|
181
|
+
<FormControl>
|
|
182
|
+
<Switch
|
|
183
|
+
checked={field.value}
|
|
184
|
+
onCheckedChange={field.onChange}
|
|
185
|
+
disabled
|
|
186
|
+
aria-readonly
|
|
187
|
+
/>
|
|
188
|
+
</FormControl>
|
|
189
|
+
</FormItem>
|
|
190
|
+
)}
|
|
191
|
+
/>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
<FormField
|
|
195
|
+
control={form.control}
|
|
196
|
+
name="mobile"
|
|
197
|
+
render={({ field }) => (
|
|
198
|
+
<FormItem className="flex flex-row items-start space-x-3 space-y-0">
|
|
199
|
+
<FormControl>
|
|
200
|
+
<Checkbox
|
|
201
|
+
checked={field.value}
|
|
202
|
+
onCheckedChange={field.onChange}
|
|
203
|
+
/>
|
|
204
|
+
</FormControl>
|
|
205
|
+
<div className="space-y-1 leading-none">
|
|
206
|
+
<FormLabel>
|
|
207
|
+
Use different settings for my mobile devices
|
|
208
|
+
</FormLabel>
|
|
209
|
+
<FormDescription>
|
|
210
|
+
You can manage your mobile notifications in the{" "}
|
|
211
|
+
<a href="/examples/forms">mobile settings</a> page.
|
|
212
|
+
</FormDescription>
|
|
213
|
+
</div>
|
|
214
|
+
</FormItem>
|
|
215
|
+
)}
|
|
216
|
+
/>
|
|
217
|
+
<Button type="submit">Update notifications</Button>
|
|
218
|
+
</form>
|
|
219
|
+
</Form>
|
|
220
|
+
)
|
|
221
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Separator } from "@/components/ui/separator"
|
|
2
|
+
import { AccountForm } from "@/app/examples/forms/account/account-form"
|
|
3
|
+
import { NotificationsForm } from "@/app/examples/forms/notifications/notifications-form"
|
|
4
|
+
|
|
5
|
+
export default function SettingsNotificationsPage() {
|
|
6
|
+
return (
|
|
7
|
+
<div className="space-y-6">
|
|
8
|
+
<div>
|
|
9
|
+
<h3 className="text-lg font-medium">Notifications</h3>
|
|
10
|
+
<p className="text-sm text-muted-foreground">
|
|
11
|
+
Configure how you receive notifications.
|
|
12
|
+
</p>
|
|
13
|
+
</div>
|
|
14
|
+
<Separator />
|
|
15
|
+
<NotificationsForm />
|
|
16
|
+
</div>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Separator } from "@/components/ui/separator"
|
|
2
|
+
import { ProfileForm } from "@/app/examples/forms/profile-form"
|
|
3
|
+
|
|
4
|
+
export default function SettingsProfilePage() {
|
|
5
|
+
return (
|
|
6
|
+
<div className="space-y-6">
|
|
7
|
+
<div>
|
|
8
|
+
<h3 className="text-lg font-medium">Profile</h3>
|
|
9
|
+
<p className="text-sm text-muted-foreground">
|
|
10
|
+
This is how others will see you on the site.
|
|
11
|
+
</p>
|
|
12
|
+
</div>
|
|
13
|
+
<Separator />
|
|
14
|
+
<ProfileForm />
|
|
15
|
+
</div>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { zodResolver } from "@hookform/resolvers/zod"
|
|
4
|
+
import { useFieldArray, useForm } from "react-hook-form"
|
|
5
|
+
import * as z from "zod"
|
|
6
|
+
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
import { Button } from "@/components/ui/button"
|
|
9
|
+
import { Input } from "@/components/ui/input"
|
|
10
|
+
import {
|
|
11
|
+
Select,
|
|
12
|
+
SelectContent,
|
|
13
|
+
SelectItem,
|
|
14
|
+
SelectTrigger,
|
|
15
|
+
SelectValue,
|
|
16
|
+
} from "@/components/ui/select"
|
|
17
|
+
import { Textarea } from "@/components/ui/textarea"
|
|
18
|
+
import { toast } from "@/components/ui/use-toast"
|
|
19
|
+
import {
|
|
20
|
+
Form,
|
|
21
|
+
FormControl,
|
|
22
|
+
FormDescription,
|
|
23
|
+
FormField,
|
|
24
|
+
FormItem,
|
|
25
|
+
FormLabel,
|
|
26
|
+
FormMessage,
|
|
27
|
+
} from "@/components/react-hook-form/form"
|
|
28
|
+
|
|
29
|
+
const profileFormSchema = z.object({
|
|
30
|
+
username: z
|
|
31
|
+
.string()
|
|
32
|
+
.min(2, {
|
|
33
|
+
message: "Username must be at least 2 characters.",
|
|
34
|
+
})
|
|
35
|
+
.max(30, {
|
|
36
|
+
message: "Username must not be longer than 30 characters.",
|
|
37
|
+
}),
|
|
38
|
+
email: z
|
|
39
|
+
.string({
|
|
40
|
+
required_error: "Please select an email to display.",
|
|
41
|
+
})
|
|
42
|
+
.email(),
|
|
43
|
+
bio: z.string().max(160).min(4),
|
|
44
|
+
urls: z
|
|
45
|
+
.array(
|
|
46
|
+
z.object({
|
|
47
|
+
value: z.string().url({ message: "Please enter a valid URL." }),
|
|
48
|
+
})
|
|
49
|
+
)
|
|
50
|
+
.optional(),
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
type ProfileFormValues = z.infer<typeof profileFormSchema>
|
|
54
|
+
|
|
55
|
+
// This can come from your database or API.
|
|
56
|
+
const defaultValues: Partial<ProfileFormValues> = {
|
|
57
|
+
bio: "I own a computer.",
|
|
58
|
+
urls: [
|
|
59
|
+
{ value: "https://shadcn.com" },
|
|
60
|
+
{ value: "http://twitter.com/shadcn" },
|
|
61
|
+
],
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function ProfileForm() {
|
|
65
|
+
const form = useForm<ProfileFormValues>({
|
|
66
|
+
resolver: zodResolver(profileFormSchema),
|
|
67
|
+
defaultValues,
|
|
68
|
+
mode: "onChange",
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
const { fields, append } = useFieldArray({
|
|
72
|
+
name: "urls",
|
|
73
|
+
control: form.control,
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
function onSubmit(data: ProfileFormValues) {
|
|
77
|
+
toast({
|
|
78
|
+
title: "You submitted the following values:",
|
|
79
|
+
description: (
|
|
80
|
+
<pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
|
|
81
|
+
<code className="text-white">{JSON.stringify(data, null, 2)}</code>
|
|
82
|
+
</pre>
|
|
83
|
+
),
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<Form {...form}>
|
|
89
|
+
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
|
|
90
|
+
<FormField
|
|
91
|
+
control={form.control}
|
|
92
|
+
name="username"
|
|
93
|
+
render={({ field }) => (
|
|
94
|
+
<FormItem>
|
|
95
|
+
<FormLabel>Username</FormLabel>
|
|
96
|
+
<FormControl>
|
|
97
|
+
<Input placeholder="shadcn" {...field} />
|
|
98
|
+
</FormControl>
|
|
99
|
+
<FormDescription>
|
|
100
|
+
This is your public display name. It can be your real name or a
|
|
101
|
+
pseudonym. You can only change this once every 30 days.
|
|
102
|
+
</FormDescription>
|
|
103
|
+
<FormMessage />
|
|
104
|
+
</FormItem>
|
|
105
|
+
)}
|
|
106
|
+
/>
|
|
107
|
+
<FormField
|
|
108
|
+
control={form.control}
|
|
109
|
+
name="email"
|
|
110
|
+
render={({ field }) => (
|
|
111
|
+
<FormItem>
|
|
112
|
+
<FormLabel>Email</FormLabel>
|
|
113
|
+
<Select onValueChange={field.onChange} defaultValue={field.value}>
|
|
114
|
+
<FormControl>
|
|
115
|
+
<SelectTrigger>
|
|
116
|
+
<SelectValue placeholder="Select a verified email to display" />
|
|
117
|
+
</SelectTrigger>
|
|
118
|
+
</FormControl>
|
|
119
|
+
<SelectContent>
|
|
120
|
+
<SelectItem value="m@example.com">m@example.com</SelectItem>
|
|
121
|
+
<SelectItem value="m@google.com">m@google.com</SelectItem>
|
|
122
|
+
<SelectItem value="m@support.com">m@support.com</SelectItem>
|
|
123
|
+
</SelectContent>
|
|
124
|
+
</Select>
|
|
125
|
+
<FormDescription>
|
|
126
|
+
You can manage verified email addresses in your{" "}
|
|
127
|
+
<a href="/examples/forms">email settings</a>.
|
|
128
|
+
</FormDescription>
|
|
129
|
+
<FormMessage />
|
|
130
|
+
</FormItem>
|
|
131
|
+
)}
|
|
132
|
+
/>
|
|
133
|
+
<FormField
|
|
134
|
+
control={form.control}
|
|
135
|
+
name="bio"
|
|
136
|
+
render={({ field }) => (
|
|
137
|
+
<FormItem>
|
|
138
|
+
<FormLabel>Bio</FormLabel>
|
|
139
|
+
<FormControl>
|
|
140
|
+
<Textarea
|
|
141
|
+
placeholder="Tell us a little bit about yourself"
|
|
142
|
+
className="resize-none"
|
|
143
|
+
{...field}
|
|
144
|
+
/>
|
|
145
|
+
</FormControl>
|
|
146
|
+
<FormDescription>
|
|
147
|
+
You can <span>@mention</span> other users and organizations to
|
|
148
|
+
link to them.
|
|
149
|
+
</FormDescription>
|
|
150
|
+
<FormMessage />
|
|
151
|
+
</FormItem>
|
|
152
|
+
)}
|
|
153
|
+
/>
|
|
154
|
+
<div>
|
|
155
|
+
{fields.map((field, index) => (
|
|
156
|
+
<FormField
|
|
157
|
+
control={form.control}
|
|
158
|
+
key={field.id}
|
|
159
|
+
name={`urls.${index}`}
|
|
160
|
+
render={() => (
|
|
161
|
+
<FormItem>
|
|
162
|
+
<FormLabel className={cn(index !== 0 && "sr-only")}>
|
|
163
|
+
URLs
|
|
164
|
+
</FormLabel>
|
|
165
|
+
<FormDescription className={cn(index !== 0 && "sr-only")}>
|
|
166
|
+
Add links to your website, blog, or social media profiles.
|
|
167
|
+
</FormDescription>
|
|
168
|
+
<FormControl>
|
|
169
|
+
<Input {...form.register(`urls.${index}.value`)} />
|
|
170
|
+
</FormControl>
|
|
171
|
+
<FormMessage />
|
|
172
|
+
</FormItem>
|
|
173
|
+
)}
|
|
174
|
+
/>
|
|
175
|
+
))}
|
|
176
|
+
<Button
|
|
177
|
+
type="button"
|
|
178
|
+
variant="link"
|
|
179
|
+
size="sm"
|
|
180
|
+
className="mt-1"
|
|
181
|
+
onClick={() => append({ value: "" })}
|
|
182
|
+
>
|
|
183
|
+
Add URL
|
|
184
|
+
</Button>
|
|
185
|
+
</div>
|
|
186
|
+
<Button type="submit">Update profile</Button>
|
|
187
|
+
</form>
|
|
188
|
+
</Form>
|
|
189
|
+
)
|
|
190
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import Image from "next/image"
|
|
2
|
+
import { ListMusic, PlusCircle } from "lucide-react"
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
import { AspectRatio } from "@/components/ui/aspect-ratio"
|
|
6
|
+
import {
|
|
7
|
+
ContextMenu,
|
|
8
|
+
ContextMenuContent,
|
|
9
|
+
ContextMenuItem,
|
|
10
|
+
ContextMenuSeparator,
|
|
11
|
+
ContextMenuSub,
|
|
12
|
+
ContextMenuSubContent,
|
|
13
|
+
ContextMenuSubTrigger,
|
|
14
|
+
ContextMenuTrigger,
|
|
15
|
+
} from "@/components/ui/context-menu"
|
|
16
|
+
|
|
17
|
+
import { Album } from "../data/albums"
|
|
18
|
+
import { playlists } from "../data/playlists"
|
|
19
|
+
|
|
20
|
+
interface AlbumArtworkProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
21
|
+
album: Album
|
|
22
|
+
aspectRatio?: "portrait" | "square"
|
|
23
|
+
width?: number
|
|
24
|
+
height?: number
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function AlbumArtwork({
|
|
28
|
+
album,
|
|
29
|
+
aspectRatio = "portrait",
|
|
30
|
+
width,
|
|
31
|
+
height,
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
}: AlbumArtworkProps) {
|
|
35
|
+
return (
|
|
36
|
+
<div className={cn("space-y-3", className)} {...props}>
|
|
37
|
+
<ContextMenu>
|
|
38
|
+
<ContextMenuTrigger>
|
|
39
|
+
<div className="overflow-hidden rounded-md">
|
|
40
|
+
<Image
|
|
41
|
+
src={album.cover}
|
|
42
|
+
alt={album.name}
|
|
43
|
+
width={width}
|
|
44
|
+
height={height}
|
|
45
|
+
className={cn(
|
|
46
|
+
"h-auto w-auto object-cover transition-all hover:scale-105",
|
|
47
|
+
aspectRatio === "portrait" ? "aspect-[3/4]" : "aspect-square"
|
|
48
|
+
)}
|
|
49
|
+
/>
|
|
50
|
+
</div>
|
|
51
|
+
</ContextMenuTrigger>
|
|
52
|
+
<ContextMenuContent className="w-40">
|
|
53
|
+
<ContextMenuItem>Add to Library</ContextMenuItem>
|
|
54
|
+
<ContextMenuSub>
|
|
55
|
+
<ContextMenuSubTrigger>Add to Playlist</ContextMenuSubTrigger>
|
|
56
|
+
<ContextMenuSubContent className="w-48">
|
|
57
|
+
<ContextMenuItem>
|
|
58
|
+
<PlusCircle className="mr-2 h-4 w-4" />
|
|
59
|
+
New Playlist
|
|
60
|
+
</ContextMenuItem>
|
|
61
|
+
<ContextMenuSeparator />
|
|
62
|
+
{playlists.map((playlist) => (
|
|
63
|
+
<ContextMenuItem key={playlist}>
|
|
64
|
+
<ListMusic className="mr-2 h-4 w-4" /> {playlist}
|
|
65
|
+
</ContextMenuItem>
|
|
66
|
+
))}
|
|
67
|
+
</ContextMenuSubContent>
|
|
68
|
+
</ContextMenuSub>
|
|
69
|
+
<ContextMenuSeparator />
|
|
70
|
+
<ContextMenuItem>Play Next</ContextMenuItem>
|
|
71
|
+
<ContextMenuItem>Play Later</ContextMenuItem>
|
|
72
|
+
<ContextMenuItem>Create Station</ContextMenuItem>
|
|
73
|
+
<ContextMenuSeparator />
|
|
74
|
+
<ContextMenuItem>Like</ContextMenuItem>
|
|
75
|
+
<ContextMenuItem>Share</ContextMenuItem>
|
|
76
|
+
</ContextMenuContent>
|
|
77
|
+
</ContextMenu>
|
|
78
|
+
<div className="space-y-1 text-sm">
|
|
79
|
+
<h3 className="font-medium leading-none">{album.name}</h3>
|
|
80
|
+
<p className="text-xs text-muted-foreground">{album.artist}</p>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
)
|
|
84
|
+
}
|