diff --git a/.prettierrc b/.prettierrc index 40ce067..b520eac 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,9 +1,9 @@ { "endOfLine": "lf", - "semi": false, - "singleQuote": false, + "semi": true, + "singleQuote": true, "tabWidth": 2, - "trailingComma": "es5", + "trailingComma": "all", "printWidth": 80, "plugins": ["prettier-plugin-tailwindcss"], "tailwindStylesheet": "packages/ui/src/styles/globals.css", diff --git a/apps/web/components.json b/apps/web/components.json index 74c5fbb..4590e0d 100644 --- a/apps/web/components.json +++ b/apps/web/components.json @@ -14,8 +14,8 @@ "components": "@/components", "hooks": "@/hooks", "lib": "@/lib", - "utils": "@workspace/ui/lib/utils", - "ui": "@workspace/ui/components" + "utils": "@repo/ui/lib/utils", + "ui": "@repo/ui/components" }, "rtl": false, "menuColor": "default-translucent", diff --git a/apps/web/eslint.config.js b/apps/web/eslint.config.js index d49b5cb..13d3cd1 100644 --- a/apps/web/eslint.config.js +++ b/apps/web/eslint.config.js @@ -1,21 +1,21 @@ // @ts-check -import { tanstackConfig } from "@tanstack/eslint-config" +import { tanstackConfig } from '@tanstack/eslint-config'; export default [ ...tanstackConfig, { rules: { - "import/no-cycle": "off", - "import/order": "off", - "import/consistent-type-specifier-style": "off", - "sort-imports": "off", - "@typescript-eslint/array-type": "off", - "@typescript-eslint/require-await": "off", - "pnpm/json-enforce-catalog": "off", + 'import/no-cycle': 'off', + 'import/order': 'off', + 'import/consistent-type-specifier-style': 'off', + 'sort-imports': 'off', + '@typescript-eslint/array-type': 'off', + '@typescript-eslint/require-await': 'off', + 'pnpm/json-enforce-catalog': 'off', }, }, { - ignores: ["eslint.config.js", ".prettierrc"], + ignores: ['eslint.config.js', '.prettierrc'], }, -] +]; diff --git a/apps/web/package.json b/apps/web/package.json index 19afdc9..b56fea9 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -18,7 +18,7 @@ "@tanstack/react-router": "latest", "@tanstack/react-router-devtools": "latest", "@tanstack/react-start": "latest", - "@workspace/ui": "workspace:*", + "@repo/ui": "workspace:*", "lucide-react": "^1.84.0", "react": "^19.3.1", "react-dom": "^19.3.1", diff --git a/apps/web/src/routeTree.gen.ts b/apps/web/src/routeTree.gen.ts index 3b361e9..dceedff 100644 --- a/apps/web/src/routeTree.gen.ts +++ b/apps/web/src/routeTree.gen.ts @@ -8,43 +8,43 @@ // You should NOT make any changes in this file as it will be overwritten. // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. -import { Route as rootRouteImport } from "./routes/__root" -import { Route as IndexRouteImport } from "./routes/index" +import { Route as rootRouteImport } from './routes/__root' +import { Route as IndexRouteImport } from './routes/index' const IndexRoute = IndexRouteImport.update({ - id: "/", - path: "/", + id: '/', + path: '/', getParentRoute: () => rootRouteImport, } as any) export interface FileRoutesByFullPath { - "/": typeof IndexRoute + '/': typeof IndexRoute } export interface FileRoutesByTo { - "/": typeof IndexRoute + '/': typeof IndexRoute } export interface FileRoutesById { __root__: typeof rootRouteImport - "/": typeof IndexRoute + '/': typeof IndexRoute } export interface FileRouteTypes { fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: "/" + fullPaths: '/' fileRoutesByTo: FileRoutesByTo - to: "/" - id: "__root__" | "/" + to: '/' + id: '__root__' | '/' fileRoutesById: FileRoutesById } export interface RootRouteChildren { IndexRoute: typeof IndexRoute } -declare module "@tanstack/react-router" { +declare module '@tanstack/react-router' { interface FileRoutesByPath { - "/": { - id: "/" - path: "/" - fullPath: "/" + '/': { + id: '/' + path: '/' + fullPath: '/' preLoaderRoute: typeof IndexRouteImport parentRoute: typeof rootRouteImport } @@ -58,9 +58,9 @@ export const routeTree = rootRouteImport ._addFileChildren(rootRouteChildren) ._addFileTypes() -import type { getRouter } from "./router.tsx" -import type { createStart } from "@tanstack/react-start" -declare module "@tanstack/react-start" { +import type { getRouter } from './router.tsx' +import type { createStart } from '@tanstack/react-start' +declare module '@tanstack/react-start' { interface Register { ssr: true router: Awaited> diff --git a/apps/web/src/router.tsx b/apps/web/src/router.tsx index d91c337..4e67cd5 100644 --- a/apps/web/src/router.tsx +++ b/apps/web/src/router.tsx @@ -1,20 +1,20 @@ -import { createRouter as createTanStackRouter } from "@tanstack/react-router" -import { routeTree } from "./routeTree.gen" +import { createRouter as createTanStackRouter } from '@tanstack/react-router'; +import { routeTree } from './routeTree.gen'; export function getRouter() { const router = createTanStackRouter({ routeTree, scrollRestoration: true, - defaultPreload: "intent", + defaultPreload: 'intent', defaultPreloadStaleTime: 0, - }) + }); - return router + return router; } -declare module "@tanstack/react-router" { +declare module '@tanstack/react-router' { interface Register { - router: ReturnType + router: ReturnType; } } diff --git a/apps/web/src/routes/__root.tsx b/apps/web/src/routes/__root.tsx index 33e2a8c..ac80770 100644 --- a/apps/web/src/routes/__root.tsx +++ b/apps/web/src/routes/__root.tsx @@ -1,24 +1,25 @@ -import { HeadContent, Scripts, createRootRoute } from "@tanstack/react-router" +import { HeadContent, Scripts, createRootRoute } from '@tanstack/react-router'; -import appCss from "@workspace/ui/globals.css?url" +import appCss from '@repo/ui/globals.css?url'; +import { TooltipProvider } from '@repo/ui/components/tooltip'; export const Route = createRootRoute({ head: () => ({ meta: [ { - charSet: "utf-8", + charSet: 'utf-8', }, { - name: "viewport", - content: "width=device-width, initial-scale=1", + name: 'viewport', + content: 'width=device-width, initial-scale=1', }, { - title: "TanStack Start Starter", + title: 'TanStack Start Starter', }, ], links: [ { - rel: "stylesheet", + rel: 'stylesheet', href: appCss, }, ], @@ -30,7 +31,7 @@ export const Route = createRootRoute({ ), shellComponent: RootDocument, -}) +}); function RootDocument({ children }: { children: React.ReactNode }) { return ( @@ -39,9 +40,9 @@ function RootDocument({ children }: { children: React.ReactNode }) { - {children} + {children} - ) + ); } diff --git a/apps/web/src/routes/index.tsx b/apps/web/src/routes/index.tsx index 4a27091..85756d0 100644 --- a/apps/web/src/routes/index.tsx +++ b/apps/web/src/routes/index.tsx @@ -1,7 +1,7 @@ -import { createFileRoute } from "@tanstack/react-router" -import { Button } from "@workspace/ui/components/button" +import { createFileRoute } from '@tanstack/react-router'; +import { Button } from '@repo/ui/components/button'; -export const Route = createFileRoute("/")({ component: App }) +export const Route = createFileRoute('/')({ component: App }); function App() { return ( @@ -15,5 +15,5 @@ function App() { - ) + ); } diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json index 75ef6fa..79c0686 100644 --- a/apps/web/tsconfig.json +++ b/apps/web/tsconfig.json @@ -14,7 +14,7 @@ "types": ["vite/client"], "paths": { "@/*": ["./src/*"], - "@workspace/ui/*": ["../../packages/ui/src/*"] + "@repo/ui/*": ["../../packages/ui/src/*"] }, /* Bundler mode */ diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index 403424f..602dc1c 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -1,12 +1,12 @@ -import { defineConfig } from "vite" -import { devtools } from "@tanstack/devtools-vite" -import { tanstackStart } from "@tanstack/react-start/plugin/vite" -import viteReact from "@vitejs/plugin-react" -import tailwindcss from "@tailwindcss/vite" +import { defineConfig } from 'vite'; +import { devtools } from '@tanstack/devtools-vite'; +import { tanstackStart } from '@tanstack/react-start/plugin/vite'; +import viteReact from '@vitejs/plugin-react'; +import tailwindcss from '@tailwindcss/vite'; const config = defineConfig({ resolve: { tsconfigPaths: true }, plugins: [devtools(), tailwindcss(), tanstackStart(), viteReact()], -}) +}); -export default config +export default config; diff --git a/package.json b/package.json index 522d8d3..cee39ba 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "devDependencies": { "prettier": "^3.10.1", "prettier-plugin-tailwindcss": "^0.8.1", - "turbo": "^2.11.11", - "typescript": "^6.0.2" + "turbo": "^2.11.13", + "typescript": "^6.0.3" }, "packageManager": "pnpm@11.25.0", "engines": { diff --git a/packages/ui/components.json b/packages/ui/components.json index 0dc2dc1..c6b9658 100644 --- a/packages/ui/components.json +++ b/packages/ui/components.json @@ -11,11 +11,11 @@ }, "iconLibrary": "lucide", "aliases": { - "components": "@workspace/ui/components", - "utils": "@workspace/ui/lib/utils", - "hooks": "@workspace/ui/hooks", - "lib": "@workspace/ui/lib", - "ui": "@workspace/ui/components" + "components": "@repo/ui/components", + "utils": "@repo/ui/lib/utils", + "hooks": "@repo/ui/hooks", + "lib": "@repo/ui/lib", + "ui": "@repo/ui/components" }, "rtl": false, "menuColor": "default-translucent", diff --git a/packages/ui/eslint.config.js b/packages/ui/eslint.config.js index d49b5cb..13d3cd1 100644 --- a/packages/ui/eslint.config.js +++ b/packages/ui/eslint.config.js @@ -1,21 +1,21 @@ // @ts-check -import { tanstackConfig } from "@tanstack/eslint-config" +import { tanstackConfig } from '@tanstack/eslint-config'; export default [ ...tanstackConfig, { rules: { - "import/no-cycle": "off", - "import/order": "off", - "import/consistent-type-specifier-style": "off", - "sort-imports": "off", - "@typescript-eslint/array-type": "off", - "@typescript-eslint/require-await": "off", - "pnpm/json-enforce-catalog": "off", + 'import/no-cycle': 'off', + 'import/order': 'off', + 'import/consistent-type-specifier-style': 'off', + 'sort-imports': 'off', + '@typescript-eslint/array-type': 'off', + '@typescript-eslint/require-await': 'off', + 'pnpm/json-enforce-catalog': 'off', }, }, { - ignores: ["eslint.config.js", ".prettierrc"], + ignores: ['eslint.config.js', '.prettierrc'], }, -] +]; diff --git a/packages/ui/eslint.config.ts b/packages/ui/eslint.config.ts index d734ef3..a0bdf89 100644 --- a/packages/ui/eslint.config.ts +++ b/packages/ui/eslint.config.ts @@ -1,3 +1,3 @@ -import { tanstackConfig } from "@tanstack/eslint-config" +import { tanstackConfig } from '@tanstack/eslint-config'; -export default [...tanstackConfig] +export default [...tanstackConfig]; diff --git a/packages/ui/package.json b/packages/ui/package.json index 722baa3..9e47517 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,5 +1,5 @@ { - "name": "@workspace/ui", + "name": "@repo/ui", "version": "0.0.0", "type": "module", "private": true, @@ -11,11 +11,17 @@ "dependencies": { "@base-ui/react": "^1.9.0", "@fontsource-variable/geist": "^5.3.0", + "@shadcn/react": "^0.3.1", "class-variance-authority": "^0.7.1", "cn": "^0.5.2", + "date-fns": "^4.4.0", + "embla-carousel-react": "^8.6.0", + "input-otp": "^1.5.0", "lucide-react": "^1.84.0", "react": "^19.3.1", + "react-day-picker": "^10.0.2", "react-dom": "^19.3.1", + "react-resizable-panels": "^4.27.0", "shadcn": "^4.23.1", "tw-animate-css": "^1.4.0", "zod": "^4.6.7" diff --git a/packages/ui/src/components/.gitkeep b/packages/ui/src/components/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/packages/ui/src/components/alert-dialog.tsx b/packages/ui/src/components/alert-dialog.tsx new file mode 100644 index 0000000..fb2fe25 --- /dev/null +++ b/packages/ui/src/components/alert-dialog.tsx @@ -0,0 +1,185 @@ +import * as React from 'react'; +import { AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog'; +import { cn } from 'cn'; + +import { Button } from '@repo/ui/components/button'; + +function AlertDialog({ ...props }: AlertDialogPrimitive.Root.Props) { + return ; +} + +function AlertDialogTrigger({ ...props }: AlertDialogPrimitive.Trigger.Props) { + return ( + + ); +} + +function AlertDialogPortal({ ...props }: AlertDialogPrimitive.Portal.Props) { + return ( + + ); +} + +function AlertDialogOverlay({ + className, + ...props +}: AlertDialogPrimitive.Backdrop.Props) { + return ( + + ); +} + +function AlertDialogContent({ + className, + size = 'default', + ...props +}: AlertDialogPrimitive.Popup.Props & { + size?: 'default' | 'sm'; +}) { + return ( + + + + + ); +} + +function AlertDialogHeader({ + className, + ...props +}: React.ComponentProps<'div'>) { + return ( +
+ ); +} + +function AlertDialogFooter({ + className, + ...props +}: React.ComponentProps<'div'>) { + return ( +
+ ); +} + +function AlertDialogMedia({ + className, + ...props +}: React.ComponentProps<'div'>) { + return ( +
+ ); +} + +function AlertDialogTitle({ + className, + ...props +}: React.ComponentProps) { + return ( + + ); +} + +function AlertDialogDescription({ + className, + ...props +}: React.ComponentProps) { + return ( + + ); +} + +function AlertDialogAction({ + className, + ...props +}: React.ComponentProps) { + return ( + + ); +} + +function CarouselNext({ + className, + variant = 'outline', + size = 'icon-sm', + ...props +}: React.ComponentProps) { + const { orientation, scrollNext, canScrollNext } = useCarousel(); + + return ( + + ); +} + +export { + type CarouselApi, + Carousel, + CarouselContent, + CarouselItem, + CarouselPrevious, + CarouselNext, + useCarousel, +}; diff --git a/packages/ui/src/components/checkbox.tsx b/packages/ui/src/components/checkbox.tsx new file mode 100644 index 0000000..d8e1700 --- /dev/null +++ b/packages/ui/src/components/checkbox.tsx @@ -0,0 +1,25 @@ +import { Checkbox as CheckboxPrimitive } from '@base-ui/react/checkbox'; +import { cn } from 'cn'; +import { CheckIcon } from 'lucide-react'; + +function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) { + return ( + + + + + + ); +} + +export { Checkbox }; diff --git a/packages/ui/src/components/collapsible.tsx b/packages/ui/src/components/collapsible.tsx new file mode 100644 index 0000000..ef053df --- /dev/null +++ b/packages/ui/src/components/collapsible.tsx @@ -0,0 +1,19 @@ +import { Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible'; + +function Collapsible({ ...props }: CollapsiblePrimitive.Root.Props) { + return ; +} + +function CollapsibleTrigger({ ...props }: CollapsiblePrimitive.Trigger.Props) { + return ( + + ); +} + +function CollapsibleContent({ ...props }: CollapsiblePrimitive.Panel.Props) { + return ( + + ); +} + +export { Collapsible, CollapsibleTrigger, CollapsibleContent }; diff --git a/packages/ui/src/components/combobox.tsx b/packages/ui/src/components/combobox.tsx new file mode 100644 index 0000000..7ab9829 --- /dev/null +++ b/packages/ui/src/components/combobox.tsx @@ -0,0 +1,298 @@ +import * as React from 'react'; +import { Combobox as ComboboxPrimitive } from '@base-ui/react'; +import { cn } from 'cn'; + +import { Button } from '@repo/ui/components/button'; +import { + InputGroup, + InputGroupAddon, + InputGroupButton, + InputGroupInput, +} from '@repo/ui/components/input-group'; +import { ChevronDownIcon, XIcon, CheckIcon } from 'lucide-react'; + +const Combobox = ComboboxPrimitive.Root; + +function ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) { + return ; +} + +function ComboboxTrigger({ + className, + children, + ...props +}: ComboboxPrimitive.Trigger.Props) { + return ( + + {children} + + + ); +} + +function ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) { + return ( + } + className={cn(className)} + {...props} + > + + + ); +} + +function ComboboxInput({ + className, + children, + disabled = false, + showTrigger = true, + showClear = false, + ...props +}: ComboboxPrimitive.Input.Props & { + showTrigger?: boolean; + showClear?: boolean; +}) { + return ( + + } + {...props} + /> + + {showTrigger && ( + } + data-slot="input-group-button" + className="group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent" + disabled={disabled} + /> + )} + {showClear && } + + {children} + + ); +} + +function ComboboxContent({ + className, + side = 'bottom', + sideOffset = 6, + align = 'start', + alignOffset = 0, + anchor, + ...props +}: ComboboxPrimitive.Popup.Props & + Pick< + ComboboxPrimitive.Positioner.Props, + 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor' + >) { + return ( + + + + + + ); +} + +function ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) { + return ( + + ); +} + +function ComboboxItem({ + className, + children, + ...props +}: ComboboxPrimitive.Item.Props) { + return ( + + {children} + + } + > + + + + ); +} + +function ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) { + return ( + + ); +} + +function ComboboxLabel({ + className, + ...props +}: ComboboxPrimitive.GroupLabel.Props) { + return ( + + ); +} + +function ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) { + return ( + + ); +} + +function ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) { + return ( + + ); +} + +function ComboboxSeparator({ + className, + ...props +}: ComboboxPrimitive.Separator.Props) { + return ( + + ); +} + +function ComboboxChips({ + className, + ...props +}: React.ComponentPropsWithRef & + ComboboxPrimitive.Chips.Props) { + return ( + + ); +} + +function ComboboxChip({ + className, + children, + showRemove = true, + ...props +}: ComboboxPrimitive.Chip.Props & { + showRemove?: boolean; +}) { + return ( + + {children} + {showRemove && ( + } + className="-ml-1 opacity-50 hover:opacity-100" + data-slot="combobox-chip-remove" + > + + + )} + + ); +} + +function ComboboxChipsInput({ + className, + ...props +}: ComboboxPrimitive.Input.Props) { + return ( + + ); +} + +function useComboboxAnchor() { + return React.useRef(null); +} + +export { + Combobox, + ComboboxInput, + ComboboxContent, + ComboboxList, + ComboboxItem, + ComboboxGroup, + ComboboxLabel, + ComboboxCollection, + ComboboxEmpty, + ComboboxSeparator, + ComboboxChips, + ComboboxChip, + ComboboxChipsInput, + ComboboxTrigger, + ComboboxValue, + useComboboxAnchor, +}; diff --git a/packages/ui/src/components/dialog.tsx b/packages/ui/src/components/dialog.tsx new file mode 100644 index 0000000..b627736 --- /dev/null +++ b/packages/ui/src/components/dialog.tsx @@ -0,0 +1,157 @@ +import * as React from 'react'; +import { Dialog as DialogPrimitive } from '@base-ui/react/dialog'; +import { cn } from 'cn'; + +import { Button } from '@repo/ui/components/button'; +import { XIcon } from 'lucide-react'; + +function Dialog({ ...props }: DialogPrimitive.Root.Props) { + return ; +} + +function DialogTrigger({ ...props }: DialogPrimitive.Trigger.Props) { + return ; +} + +function DialogPortal({ ...props }: DialogPrimitive.Portal.Props) { + return ; +} + +function DialogClose({ ...props }: DialogPrimitive.Close.Props) { + return ; +} + +function DialogOverlay({ + className, + ...props +}: DialogPrimitive.Backdrop.Props) { + return ( + + ); +} + +function DialogContent({ + className, + children, + showCloseButton = true, + ...props +}: DialogPrimitive.Popup.Props & { + showCloseButton?: boolean; +}) { + return ( + + + + {children} + {showCloseButton && ( + + } + > + + Close + + )} + + + ); +} + +function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) { + return ( +
+ ); +} + +function DialogFooter({ + className, + showCloseButton = false, + children, + ...props +}: React.ComponentProps<'div'> & { + showCloseButton?: boolean; +}) { + return ( +
+ {children} + {showCloseButton && ( + }> + Close + + )} +
+ ); +} + +function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) { + return ( + + ); +} + +function DialogDescription({ + className, + ...props +}: DialogPrimitive.Description.Props) { + return ( + + ); +} + +export { + Dialog, + DialogClose, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogOverlay, + DialogPortal, + DialogTitle, + DialogTrigger, +}; diff --git a/packages/ui/src/components/drawer.tsx b/packages/ui/src/components/drawer.tsx new file mode 100644 index 0000000..11796fd --- /dev/null +++ b/packages/ui/src/components/drawer.tsx @@ -0,0 +1,225 @@ +import * as React from 'react'; +import { Drawer as DrawerPrimitive } from '@base-ui/react/drawer'; +import { cn } from 'cn'; + +type DrawerContextProps = { + hasSnapPoints: boolean; + modal: DrawerPrimitive.Root.Props['modal']; + showSwipeHandle: boolean; + swipeDirection: NonNullable; +}; + +const DrawerContext = React.createContext(null); + +function useDrawer() { + const context = React.useContext(DrawerContext); + + if (!context) { + throw new Error('useDrawer must be used within a Drawer.'); + } + + return context; +} + +function Drawer({ + modal = true, + showSwipeHandle = false, + snapPoints, + swipeDirection = 'down', + ...props +}: DrawerPrimitive.Root.Props & { + showSwipeHandle?: boolean; +}) { + const hasSnapPoints = snapPoints != null && snapPoints.length > 0; + const contextValue = React.useMemo( + () => ({ hasSnapPoints, modal, showSwipeHandle, swipeDirection }), + [hasSnapPoints, modal, showSwipeHandle, swipeDirection], + ); + + return ( + + + + ); +} + +function DrawerTrigger({ ...props }: DrawerPrimitive.Trigger.Props) { + return ; +} + +function DrawerPortal({ ...props }: DrawerPrimitive.Portal.Props) { + return ; +} + +function DrawerClose({ ...props }: DrawerPrimitive.Close.Props) { + return ; +} + +function DrawerOverlay({ + className, + ...props +}: DrawerPrimitive.Backdrop.Props) { + return ( + + ); +} + +function DrawerSwipeHandle({ + className, + ...props +}: React.ComponentProps<'div'>) { + return ( +