@salesforce/ui-bundle-template-base-react-app 1.117.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/.forceignore +15 -0
  2. package/.gitignore +1 -0
  3. package/CHANGELOG.md +1096 -0
  4. package/LICENSE.txt +82 -0
  5. package/README.md +17 -0
  6. package/package.json +18 -0
  7. package/src/force-app/main/default/uiBundles/base-react-app/.forceignore +15 -0
  8. package/src/force-app/main/default/uiBundles/base-react-app/.graphqlrc.yml +2 -0
  9. package/src/force-app/main/default/uiBundles/base-react-app/.prettierignore +9 -0
  10. package/src/force-app/main/default/uiBundles/base-react-app/.prettierrc +11 -0
  11. package/src/force-app/main/default/uiBundles/base-react-app/CHANGELOG.md +10 -0
  12. package/src/force-app/main/default/uiBundles/base-react-app/README.md +75 -0
  13. package/src/force-app/main/default/uiBundles/base-react-app/_uibundle.uibundle-meta.xml +7 -0
  14. package/src/force-app/main/default/uiBundles/base-react-app/codegen.yml +95 -0
  15. package/src/force-app/main/default/uiBundles/base-react-app/components.json +18 -0
  16. package/src/force-app/main/default/uiBundles/base-react-app/e2e/app.spec.ts +17 -0
  17. package/src/force-app/main/default/uiBundles/base-react-app/eslint.config.js +169 -0
  18. package/src/force-app/main/default/uiBundles/base-react-app/index.html +12 -0
  19. package/src/force-app/main/default/uiBundles/base-react-app/package.json +68 -0
  20. package/src/force-app/main/default/uiBundles/base-react-app/playwright.config.ts +24 -0
  21. package/src/force-app/main/default/uiBundles/base-react-app/scripts/get-graphql-schema.mjs +68 -0
  22. package/src/force-app/main/default/uiBundles/base-react-app/scripts/rewrite-e2e-assets.mjs +23 -0
  23. package/src/force-app/main/default/uiBundles/base-react-app/src/api/graphqlClient.ts +25 -0
  24. package/src/force-app/main/default/uiBundles/base-react-app/src/app.tsx +17 -0
  25. package/src/force-app/main/default/uiBundles/base-react-app/src/appLayout.tsx +83 -0
  26. package/src/force-app/main/default/uiBundles/base-react-app/src/assets/icons/book.svg +3 -0
  27. package/src/force-app/main/default/uiBundles/base-react-app/src/assets/icons/copy.svg +4 -0
  28. package/src/force-app/main/default/uiBundles/base-react-app/src/assets/icons/rocket.svg +3 -0
  29. package/src/force-app/main/default/uiBundles/base-react-app/src/assets/icons/star.svg +3 -0
  30. package/src/force-app/main/default/uiBundles/base-react-app/src/assets/images/codey-1.png +0 -0
  31. package/src/force-app/main/default/uiBundles/base-react-app/src/assets/images/codey-2.png +0 -0
  32. package/src/force-app/main/default/uiBundles/base-react-app/src/assets/images/codey-3.png +0 -0
  33. package/src/force-app/main/default/uiBundles/base-react-app/src/assets/images/vibe-codey.svg +194 -0
  34. package/src/force-app/main/default/uiBundles/base-react-app/src/components/alerts/status-alert.tsx +49 -0
  35. package/src/force-app/main/default/uiBundles/base-react-app/src/components/layouts/card-layout.tsx +29 -0
  36. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/alert.tsx +76 -0
  37. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/badge.tsx +48 -0
  38. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/breadcrumb.tsx +109 -0
  39. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/button.tsx +67 -0
  40. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/calendar.tsx +232 -0
  41. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/card.tsx +103 -0
  42. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/checkbox.tsx +32 -0
  43. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/collapsible.tsx +33 -0
  44. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/datePicker.tsx +127 -0
  45. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/dialog.tsx +162 -0
  46. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/field.tsx +237 -0
  47. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/index.ts +84 -0
  48. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/input.tsx +19 -0
  49. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/label.tsx +22 -0
  50. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/pagination.tsx +132 -0
  51. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/popover.tsx +89 -0
  52. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/select.tsx +193 -0
  53. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/separator.tsx +26 -0
  54. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/skeleton.tsx +14 -0
  55. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/sonner.tsx +20 -0
  56. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/spinner.tsx +16 -0
  57. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/table.tsx +114 -0
  58. package/src/force-app/main/default/uiBundles/base-react-app/src/components/ui/tabs.tsx +88 -0
  59. package/src/force-app/main/default/uiBundles/base-react-app/src/lib/utils.ts +6 -0
  60. package/src/force-app/main/default/uiBundles/base-react-app/src/navigationMenu.tsx +80 -0
  61. package/src/force-app/main/default/uiBundles/base-react-app/src/pages/Home.tsx +12 -0
  62. package/src/force-app/main/default/uiBundles/base-react-app/src/pages/NotFound.tsx +18 -0
  63. package/src/force-app/main/default/uiBundles/base-react-app/src/router-utils.tsx +35 -0
  64. package/src/force-app/main/default/uiBundles/base-react-app/src/routes.tsx +22 -0
  65. package/src/force-app/main/default/uiBundles/base-react-app/src/styles/global.css +135 -0
  66. package/src/force-app/main/default/uiBundles/base-react-app/tsconfig.json +42 -0
  67. package/src/force-app/main/default/uiBundles/base-react-app/tsconfig.node.json +13 -0
  68. package/src/force-app/main/default/uiBundles/base-react-app/ui-bundle.json +7 -0
  69. package/src/force-app/main/default/uiBundles/base-react-app/vite-env.d.ts +1 -0
  70. package/src/force-app/main/default/uiBundles/base-react-app/vite.config.ts +106 -0
  71. package/src/force-app/main/default/uiBundles/base-react-app/vitest-env.d.ts +2 -0
  72. package/src/force-app/main/default/uiBundles/base-react-app/vitest.config.ts +11 -0
  73. package/src/force-app/main/default/uiBundles/base-react-app/vitest.setup.ts +1 -0
@@ -0,0 +1,6 @@
1
+ import { clsx, type ClassValue } from 'clsx';
2
+ import { twMerge } from 'tailwind-merge';
3
+
4
+ export function cn(...inputs: ClassValue[]) {
5
+ return twMerge(clsx(inputs));
6
+ }
@@ -0,0 +1,80 @@
1
+ import { Link, useLocation } from 'react-router';
2
+ import { getAllRoutes } from './router-utils';
3
+ import { useState } from 'react';
4
+
5
+ export default function NavigationMenu() {
6
+ const [isOpen, setIsOpen] = useState(false);
7
+ const location = useLocation();
8
+
9
+ const isActive = (path: string) => location.pathname === path;
10
+
11
+ const toggleMenu = () => setIsOpen(!isOpen);
12
+
13
+ const navigationRoutes: { path: string; label: string }[] = getAllRoutes()
14
+ .filter(
15
+ route =>
16
+ route.handle?.showInNavigation === true &&
17
+ route.fullPath !== undefined &&
18
+ route.handle?.label !== undefined
19
+ )
20
+ .map(
21
+ route =>
22
+ ({
23
+ path: route.fullPath,
24
+ label: route.handle?.label,
25
+ }) as { path: string; label: string }
26
+ );
27
+
28
+ return (
29
+ <nav className="bg-white border-b border-gray-200">
30
+ <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
31
+ <div className="flex justify-between items-center h-16">
32
+ <Link to="/" className="text-xl font-semibold text-gray-900">
33
+ React App
34
+ </Link>
35
+ <button
36
+ onClick={toggleMenu}
37
+ className="p-2 rounded-md text-gray-700 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"
38
+ aria-label="Toggle menu"
39
+ >
40
+ <div className="w-6 h-6 flex flex-col justify-center space-y-1.5">
41
+ <span
42
+ className={`block h-0.5 w-6 bg-current transition-all ${
43
+ isOpen ? 'rotate-45 translate-y-2' : ''
44
+ }`}
45
+ />
46
+ <span
47
+ className={`block h-0.5 w-6 bg-current transition-all ${isOpen ? 'opacity-0' : ''}`}
48
+ />
49
+ <span
50
+ className={`block h-0.5 w-6 bg-current transition-all ${
51
+ isOpen ? '-rotate-45 -translate-y-2' : ''
52
+ }`}
53
+ />
54
+ </div>
55
+ </button>
56
+ </div>
57
+ {isOpen && (
58
+ <div className="pb-4">
59
+ <div className="flex flex-col space-y-2">
60
+ {navigationRoutes.map(item => (
61
+ <Link
62
+ key={item.path}
63
+ to={item.path}
64
+ onClick={() => setIsOpen(false)}
65
+ className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
66
+ isActive(item.path)
67
+ ? 'bg-blue-100 text-blue-700'
68
+ : 'text-gray-700 hover:bg-gray-100'
69
+ }`}
70
+ >
71
+ {item.label}
72
+ </Link>
73
+ ))}
74
+ </div>
75
+ </div>
76
+ )}
77
+ </div>
78
+ </nav>
79
+ );
80
+ }
@@ -0,0 +1,12 @@
1
+ export default function Home() {
2
+ return (
3
+ <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
4
+ <div className="text-center">
5
+ <h1 className="text-4xl font-bold text-gray-900 mb-4">Home</h1>
6
+ <p className="text-lg text-gray-600 mb-8">
7
+ Welcome to your React application.
8
+ </p>
9
+ </div>
10
+ </div>
11
+ );
12
+ }
@@ -0,0 +1,18 @@
1
+ import { Link } from 'react-router';
2
+
3
+ export default function NotFound() {
4
+ return (
5
+ <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
6
+ <div className="text-center">
7
+ <h1 className="text-4xl font-bold text-gray-900 mb-4">404</h1>
8
+ <p className="text-lg text-gray-600 mb-8">Page not found</p>
9
+ <Link
10
+ to="/"
11
+ className="inline-block px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors"
12
+ >
13
+ Go to Home
14
+ </Link>
15
+ </div>
16
+ </div>
17
+ );
18
+ }
@@ -0,0 +1,35 @@
1
+ import type { RouteObject } from 'react-router';
2
+ import { routes } from './routes';
3
+
4
+ export type RouteWithFullPath = RouteObject & { fullPath: string };
5
+
6
+ const flatMapRoutes = (
7
+ route: RouteObject,
8
+ parentPath: string = ''
9
+ ): RouteWithFullPath[] => {
10
+ let fullPath: string;
11
+
12
+ if (route.index) {
13
+ fullPath = parentPath || '/';
14
+ } else if (route.path) {
15
+ if (route.path.startsWith('/')) {
16
+ fullPath = route.path;
17
+ } else {
18
+ fullPath =
19
+ parentPath === '/' ? `/${route.path}` : `${parentPath}/${route.path}`;
20
+ }
21
+ } else {
22
+ fullPath = parentPath;
23
+ }
24
+
25
+ const routeWithPath = { ...route, fullPath };
26
+
27
+ const childRoutes =
28
+ route.children?.flatMap(child => flatMapRoutes(child, fullPath)) || [];
29
+
30
+ return [routeWithPath, ...childRoutes];
31
+ };
32
+
33
+ export const getAllRoutes = (): RouteWithFullPath[] => {
34
+ return routes.flatMap(route => flatMapRoutes(route));
35
+ };
@@ -0,0 +1,22 @@
1
+ import type { RouteObject } from 'react-router';
2
+ import AppLayout from '@/appLayout';
3
+ import Home from './pages/Home';
4
+ import NotFound from './pages/NotFound';
5
+
6
+ export const routes: RouteObject[] = [
7
+ {
8
+ path: '/',
9
+ element: <AppLayout />,
10
+ children: [
11
+ {
12
+ index: true,
13
+ element: <Home />,
14
+ handle: { showInNavigation: true, label: 'Home' },
15
+ },
16
+ {
17
+ path: '*',
18
+ element: <NotFound />,
19
+ },
20
+ ],
21
+ },
22
+ ];
@@ -0,0 +1,135 @@
1
+ @import 'tailwindcss';
2
+
3
+ @layer base {
4
+ html,
5
+ body,
6
+ #root {
7
+ @apply min-h-screen;
8
+ }
9
+
10
+ body {
11
+ @apply antialiased bg-white;
12
+ }
13
+ }
14
+
15
+ @import 'tw-animate-css';
16
+ @import 'shadcn/tailwind.css';
17
+
18
+ @custom-variant dark (&:is(.dark *));
19
+
20
+ @theme inline {
21
+ --color-background: var(--background);
22
+ --color-foreground: var(--foreground);
23
+ --color-card: var(--card);
24
+ --color-card-foreground: var(--card-foreground);
25
+ --color-popover: var(--popover);
26
+ --color-popover-foreground: var(--popover-foreground);
27
+ --color-primary: var(--primary);
28
+ --color-primary-foreground: var(--primary-foreground);
29
+ --color-secondary: var(--secondary);
30
+ --color-secondary-foreground: var(--secondary-foreground);
31
+ --color-muted: var(--muted);
32
+ --color-muted-foreground: var(--muted-foreground);
33
+ --color-accent: var(--accent);
34
+ --color-accent-foreground: var(--accent-foreground);
35
+ --color-destructive: var(--destructive);
36
+ --color-destructive-foreground: var(--destructive-foreground);
37
+ --color-border: var(--border);
38
+ --color-input: var(--input);
39
+ --color-ring: var(--ring);
40
+ --color-chart-1: var(--chart-1);
41
+ --color-chart-2: var(--chart-2);
42
+ --color-chart-3: var(--chart-3);
43
+ --color-chart-4: var(--chart-4);
44
+ --color-chart-5: var(--chart-5);
45
+ --radius-sm: calc(var(--radius) - 4px);
46
+ --radius-md: calc(var(--radius) - 2px);
47
+ --radius-lg: var(--radius);
48
+ --radius-xl: calc(var(--radius) + 4px);
49
+ --color-sidebar: var(--sidebar);
50
+ --color-sidebar-foreground: var(--sidebar-foreground);
51
+ --color-sidebar-primary: var(--sidebar-primary);
52
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
53
+ --color-sidebar-accent: var(--sidebar-accent);
54
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
55
+ --color-sidebar-border: var(--sidebar-border);
56
+ --color-sidebar-ring: var(--sidebar-ring);
57
+ }
58
+
59
+ :root {
60
+ --radius: 0.625rem;
61
+ --background: oklch(1 0 0);
62
+ --foreground: oklch(0.145 0 0);
63
+ --card: oklch(1 0 0);
64
+ --card-foreground: oklch(0.145 0 0);
65
+ --popover: oklch(1 0 0);
66
+ --popover-foreground: oklch(0.145 0 0);
67
+ --primary: oklch(0.205 0 0);
68
+ --primary-foreground: oklch(0.985 0 0);
69
+ --secondary: oklch(0.97 0 0);
70
+ --secondary-foreground: oklch(0.205 0 0);
71
+ --muted: oklch(0.97 0 0);
72
+ --muted-foreground: oklch(0.556 0 0);
73
+ --accent: oklch(0.97 0 0);
74
+ --accent-foreground: oklch(0.205 0 0);
75
+ --destructive: oklch(0.577 0.245 27.325);
76
+ --border: oklch(0.922 0 0);
77
+ --input: oklch(0.922 0 0);
78
+ --ring: oklch(0.708 0 0);
79
+ --chart-1: oklch(0.646 0.222 41.116);
80
+ --chart-2: oklch(0.6 0.118 184.704);
81
+ --chart-3: oklch(0.398 0.07 227.392);
82
+ --chart-4: oklch(0.828 0.189 84.429);
83
+ --chart-5: oklch(0.769 0.188 70.08);
84
+ --sidebar: oklch(0.985 0 0);
85
+ --sidebar-foreground: oklch(0.145 0 0);
86
+ --sidebar-primary: oklch(0.205 0 0);
87
+ --sidebar-primary-foreground: oklch(0.985 0 0);
88
+ --sidebar-accent: oklch(0.97 0 0);
89
+ --sidebar-accent-foreground: oklch(0.205 0 0);
90
+ --sidebar-border: oklch(0.922 0 0);
91
+ --sidebar-ring: oklch(0.708 0 0);
92
+ }
93
+
94
+ .dark {
95
+ --background: oklch(0.145 0 0);
96
+ --foreground: oklch(0.985 0 0);
97
+ --card: oklch(0.205 0 0);
98
+ --card-foreground: oklch(0.985 0 0);
99
+ --popover: oklch(0.205 0 0);
100
+ --popover-foreground: oklch(0.985 0 0);
101
+ --primary: oklch(0.922 0 0);
102
+ --primary-foreground: oklch(0.205 0 0);
103
+ --secondary: oklch(0.269 0 0);
104
+ --secondary-foreground: oklch(0.985 0 0);
105
+ --muted: oklch(0.269 0 0);
106
+ --muted-foreground: oklch(0.708 0 0);
107
+ --accent: oklch(0.269 0 0);
108
+ --accent-foreground: oklch(0.985 0 0);
109
+ --destructive: oklch(0.704 0.191 22.216);
110
+ --border: oklch(1 0 0 / 10%);
111
+ --input: oklch(1 0 0 / 15%);
112
+ --ring: oklch(0.556 0 0);
113
+ --chart-1: oklch(0.488 0.243 264.376);
114
+ --chart-2: oklch(0.696 0.17 162.48);
115
+ --chart-3: oklch(0.769 0.188 70.08);
116
+ --chart-4: oklch(0.627 0.265 303.9);
117
+ --chart-5: oklch(0.645 0.246 16.439);
118
+ --sidebar: oklch(0.205 0 0);
119
+ --sidebar-foreground: oklch(0.985 0 0);
120
+ --sidebar-primary: oklch(0.488 0.243 264.376);
121
+ --sidebar-primary-foreground: oklch(0.985 0 0);
122
+ --sidebar-accent: oklch(0.269 0 0);
123
+ --sidebar-accent-foreground: oklch(0.985 0 0);
124
+ --sidebar-border: oklch(1 0 0 / 10%);
125
+ --sidebar-ring: oklch(0.556 0 0);
126
+ }
127
+
128
+ @layer base {
129
+ * {
130
+ @apply border-border outline-ring/50;
131
+ }
132
+ body {
133
+ @apply bg-background text-foreground;
134
+ }
135
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
8
+
9
+ /* Bundler mode */
10
+ "moduleResolution": "bundler",
11
+ "allowImportingTsExtensions": true,
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "noEmit": true,
15
+ "jsx": "react-jsx",
16
+
17
+ /* Linting */
18
+ "strict": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "noFallthroughCasesInSwitch": true,
22
+
23
+ /* Path mapping */
24
+ "baseUrl": ".",
25
+ "paths": {
26
+ "@/*": ["./src/*"],
27
+ "@api/*": ["./src/api/*"],
28
+ "@components/*": ["./src/components/*"],
29
+ "@utils/*": ["./src/utils/*"],
30
+ "@styles/*": ["./src/styles/*"],
31
+ "@assets/*": ["./src/assets/*"]
32
+ }
33
+ },
34
+ "include": [
35
+ "src",
36
+ "e2e",
37
+ "vite-env.d.ts",
38
+ "vitest-env.d.ts",
39
+ "vitest.setup.ts"
40
+ ],
41
+ "references": [{ "path": "./tsconfig.node.json" }]
42
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
5
+ "skipLibCheck": true,
6
+ "module": "ESNext",
7
+ "moduleResolution": "bundler",
8
+ "allowSyntheticDefaultImports": true,
9
+ "strict": true,
10
+ "outDir": "./build"
11
+ },
12
+ "include": ["vite.config.ts"]
13
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "outputDir": "dist",
3
+ "routing": {
4
+ "trailingSlash": "never",
5
+ "fallback": "index.html"
6
+ }
7
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,106 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { defineConfig } from 'vite';
3
+ import react from '@vitejs/plugin-react';
4
+ import path from 'path';
5
+ import { resolve } from 'path';
6
+ import tailwindcss from '@tailwindcss/vite';
7
+ import salesforce from '@salesforce/vite-plugin-ui-bundle';
8
+ import codegen from 'vite-plugin-graphql-codegen';
9
+
10
+ const schemaPath = resolve(__dirname, '../../../../../schema.graphql');
11
+ const schemaExists = existsSync(schemaPath);
12
+
13
+ export default defineConfig(({ mode }) => {
14
+ return {
15
+ base: './',
16
+ plugins: [
17
+ tailwindcss(),
18
+ react(),
19
+ salesforce(),
20
+ // Only add codegen when schema exists (e.g. after `npm run graphql:schema`).
21
+ // In CI or when schema is not checked in, skip codegen so build succeeds.
22
+ ...(schemaExists
23
+ ? [
24
+ codegen({
25
+ configFilePathOverride: resolve(__dirname, 'codegen.yml'),
26
+ runOnStart: true,
27
+ runOnBuild: true,
28
+ enableWatcher: true,
29
+ throwOnBuild: true,
30
+ }),
31
+ ]
32
+ : []),
33
+ ] as import('vite').PluginOption[],
34
+
35
+ // Build configuration for MPA
36
+ build: {
37
+ outDir: resolve(__dirname, 'dist'),
38
+ assetsDir: 'assets',
39
+ sourcemap: false,
40
+ },
41
+
42
+ // Resolve aliases (shared between build and test)
43
+ resolve: {
44
+ dedupe: ['react', 'react-dom'],
45
+ alias: {
46
+ '@': path.resolve(__dirname, './src'),
47
+ '@api': path.resolve(__dirname, './src/api'),
48
+ '@components': path.resolve(__dirname, './src/components'),
49
+ '@utils': path.resolve(__dirname, './src/utils'),
50
+ '@styles': path.resolve(__dirname, './src/styles'),
51
+ '@assets': path.resolve(__dirname, './src/assets'),
52
+ },
53
+ },
54
+
55
+ // Vitest configuration
56
+ test: {
57
+ // Override root for tests (build uses src/pages as root)
58
+ root: resolve(__dirname),
59
+
60
+ // Use jsdom environment for React component testing
61
+ environment: 'jsdom',
62
+
63
+ // Setup files to run before each test
64
+ setupFiles: ['./src/test/setup.ts'],
65
+
66
+ // Global test patterns
67
+ include: [
68
+ 'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
69
+ 'src/**/__tests__/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
70
+ ],
71
+
72
+ // Coverage configuration
73
+ coverage: {
74
+ provider: 'v8',
75
+ reporter: ['text', 'html', 'clover', 'json'],
76
+ exclude: [
77
+ 'node_modules/',
78
+ 'src/test/',
79
+ 'src/**/*.d.ts',
80
+ 'src/main.tsx',
81
+ 'src/vite-env.d.ts',
82
+ 'src/components/**/index.ts',
83
+ '**/*.config.ts',
84
+ 'build/',
85
+ 'dist/',
86
+ 'coverage/',
87
+ 'eslint.config.js',
88
+ ],
89
+ thresholds: {
90
+ global: {
91
+ branches: 85,
92
+ functions: 85,
93
+ lines: 85,
94
+ statements: 85,
95
+ },
96
+ },
97
+ },
98
+
99
+ // Test timeout
100
+ testTimeout: 10000,
101
+
102
+ // Globals for easier testing
103
+ globals: true,
104
+ },
105
+ };
106
+ });
@@ -0,0 +1,2 @@
1
+ /// <reference types="vitest" />
2
+ /// <reference types="@testing-library/jest-dom" />
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ import react from '@vitejs/plugin-react';
3
+
4
+ export default defineConfig({
5
+ plugins: [react()],
6
+ test: {
7
+ globals: true,
8
+ environment: 'jsdom',
9
+ setupFiles: './vitest.setup.ts',
10
+ },
11
+ });
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/vitest';