@schandlergarcia/sf-web-components 1.0.13 ā 1.0.15
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schandlergarcia/sf-web-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "Reusable Salesforce web components library with Tailwind CSS v4 and shadcn/ui",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"dist",
|
|
29
29
|
"scripts",
|
|
30
|
+
"src/templates",
|
|
30
31
|
"README.md",
|
|
31
32
|
".a4drules"
|
|
32
33
|
],
|
package/scripts/postinstall.mjs
CHANGED
|
@@ -116,8 +116,76 @@ for (const pathToRemove of pathsToRemove) {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
// Copy page templates
|
|
120
|
+
const templatesDir = path.join(path.dirname(__dirname), 'src/templates/pages');
|
|
121
|
+
const targetPagesDir = path.join(cwd, 'src/pages');
|
|
122
|
+
|
|
123
|
+
console.log('\nš Installing page templates...\n');
|
|
124
|
+
|
|
125
|
+
let templatesInstalled = 0;
|
|
126
|
+
const installedTemplates = [];
|
|
127
|
+
|
|
128
|
+
if (fs.existsSync(templatesDir)) {
|
|
129
|
+
// Create target pages directory if it doesn't exist
|
|
130
|
+
if (!fs.existsSync(targetPagesDir)) {
|
|
131
|
+
fs.mkdirSync(targetPagesDir, { recursive: true });
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const templates = fs.readdirSync(templatesDir).filter(f => f.endsWith('.template'));
|
|
135
|
+
|
|
136
|
+
for (const template of templates) {
|
|
137
|
+
const sourcePath = path.join(templatesDir, template);
|
|
138
|
+
const targetFileName = template.replace('.template', '');
|
|
139
|
+
const targetPath = path.join(targetPagesDir, targetFileName);
|
|
140
|
+
const pageName = targetFileName.replace('.tsx', '');
|
|
141
|
+
|
|
142
|
+
// Always overwrite to ensure latest templates
|
|
143
|
+
try {
|
|
144
|
+
const content = fs.readFileSync(sourcePath, 'utf-8');
|
|
145
|
+
fs.writeFileSync(targetPath, content, 'utf-8');
|
|
146
|
+
console.log(` ā Installed ${targetFileName}`);
|
|
147
|
+
templatesInstalled++;
|
|
148
|
+
installedTemplates.push(pageName);
|
|
149
|
+
} catch (error) {
|
|
150
|
+
console.error(` ā Failed to install ${targetFileName}: ${error.message}`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Update routes.tsx to use the installed templates
|
|
156
|
+
const routesPath = path.join(cwd, 'src/routes.tsx');
|
|
157
|
+
if (fs.existsSync(routesPath) && installedTemplates.length > 0) {
|
|
158
|
+
console.log('\nš Updating routes.tsx...\n');
|
|
159
|
+
|
|
160
|
+
try {
|
|
161
|
+
let routesContent = fs.readFileSync(routesPath, 'utf-8');
|
|
162
|
+
let routesUpdated = false;
|
|
163
|
+
|
|
164
|
+
for (const pageName of installedTemplates) {
|
|
165
|
+
// Match import statements like: import Home from './features/.../Home' or import Home from './pages/Home'
|
|
166
|
+
const importRegex = new RegExp(`import ${pageName} from ['"]\\./(features|pages)/[^'"]+/${pageName}['"];?`, 'g');
|
|
167
|
+
|
|
168
|
+
if (importRegex.test(routesContent)) {
|
|
169
|
+
routesContent = routesContent.replace(
|
|
170
|
+
importRegex,
|
|
171
|
+
`import ${pageName} from './pages/${pageName}';`
|
|
172
|
+
);
|
|
173
|
+
routesUpdated = true;
|
|
174
|
+
console.log(` ā Updated ${pageName} import`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (routesUpdated) {
|
|
179
|
+
fs.writeFileSync(routesPath, routesContent, 'utf-8');
|
|
180
|
+
}
|
|
181
|
+
} catch (error) {
|
|
182
|
+
console.error(` ā Failed to update routes.tsx: ${error.message}`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
119
186
|
console.log('\nš Summary:');
|
|
120
187
|
console.log(` - Updated ${filesUpdated} files`);
|
|
121
188
|
console.log(` - Migrated ${importsUpdated} imports`);
|
|
122
189
|
console.log(` - Removed ${removedCount} local items`);
|
|
190
|
+
console.log(` - Installed ${templatesInstalled} page templates`);
|
|
123
191
|
console.log('\nā
Migration complete! All imports now use @schandlergarcia/sf-web-components\n');
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { useNavigate } from "react-router";
|
|
3
|
+
import { Button } from '@schandlergarcia/sf-web-components';
|
|
4
|
+
|
|
5
|
+
export default function HomePage() {
|
|
6
|
+
const navigate = useNavigate();
|
|
7
|
+
const [searchText, setSearchText] = useState("");
|
|
8
|
+
|
|
9
|
+
const handleSearch = (e: React.FormEvent) => {
|
|
10
|
+
e.preventDefault();
|
|
11
|
+
// Navigate to your search results page
|
|
12
|
+
console.log("Search:", searchText);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div className="flex min-h-[80vh] items-center justify-center px-4 sm:px-6 lg:px-8">
|
|
17
|
+
<div className="w-full max-w-4xl">
|
|
18
|
+
<div className="text-center mb-8">
|
|
19
|
+
<h1 className="text-4xl font-bold text-slate-900 dark:text-slate-50 mb-4">
|
|
20
|
+
Welcome
|
|
21
|
+
</h1>
|
|
22
|
+
<p className="text-lg text-slate-600 dark:text-slate-300">
|
|
23
|
+
Your application is ready to go.
|
|
24
|
+
</p>
|
|
25
|
+
</div>
|
|
26
|
+
<form onSubmit={handleSearch} className="flex flex-col gap-4 items-center">
|
|
27
|
+
<div className="flex gap-2 w-full max-w-2xl">
|
|
28
|
+
<input
|
|
29
|
+
type="text"
|
|
30
|
+
value={searchText}
|
|
31
|
+
onChange={(e) => setSearchText(e.target.value)}
|
|
32
|
+
placeholder="Search..."
|
|
33
|
+
className="flex-1 px-4 py-2 border border-slate-300 dark:border-slate-700 rounded-lg bg-white dark:bg-slate-900 text-slate-900 dark:text-slate-50 focus:outline-none focus:ring-2 focus:ring-slate-400"
|
|
34
|
+
/>
|
|
35
|
+
<Button type="submit">Search</Button>
|
|
36
|
+
</div>
|
|
37
|
+
<div className="flex gap-2">
|
|
38
|
+
<Button variant="outline" onClick={() => navigate("/about")}>
|
|
39
|
+
Learn More
|
|
40
|
+
</Button>
|
|
41
|
+
</div>
|
|
42
|
+
</form>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useNavigate } from "react-router";
|
|
2
|
+
import { Button } from '@schandlergarcia/sf-web-components';
|
|
3
|
+
|
|
4
|
+
export default function NotFound() {
|
|
5
|
+
const navigate = useNavigate();
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<div className="flex min-h-[80vh] items-center justify-center px-4 sm:px-6 lg:px-8">
|
|
9
|
+
<div className="w-full max-w-2xl text-center">
|
|
10
|
+
<h1 className="text-6xl font-bold text-slate-900 dark:text-slate-50 mb-4">404</h1>
|
|
11
|
+
<h2 className="text-2xl font-semibold text-slate-700 dark:text-slate-300 mb-4">Page Not Found</h2>
|
|
12
|
+
<p className="text-lg text-slate-600 dark:text-slate-400 mb-8">
|
|
13
|
+
The page you're looking for doesn't exist.
|
|
14
|
+
</p>
|
|
15
|
+
<Button onClick={() => navigate("/")}>Go Home</Button>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default function Search() {
|
|
2
|
+
return (
|
|
3
|
+
<div className="flex min-h-[80vh] items-center justify-center px-4 sm:px-6 lg:px-8">
|
|
4
|
+
<div className="w-full max-w-4xl">
|
|
5
|
+
<div className="text-center mb-8">
|
|
6
|
+
<h1 className="text-4xl font-bold text-slate-900 dark:text-slate-50 mb-4">Search</h1>
|
|
7
|
+
<p className="text-lg text-slate-600 dark:text-slate-300">Find records across your organization.</p>
|
|
8
|
+
</div>
|
|
9
|
+
<div className="flex gap-2">
|
|
10
|
+
<input
|
|
11
|
+
type="text"
|
|
12
|
+
placeholder="Search..."
|
|
13
|
+
className="flex-1 px-4 py-2 border border-slate-300 dark:border-slate-700 rounded-lg bg-white dark:bg-slate-900 text-slate-900 dark:text-slate-50 focus:outline-none focus:ring-2 focus:ring-slate-400"
|
|
14
|
+
/>
|
|
15
|
+
<button className="px-4 py-2 bg-slate-900 dark:bg-slate-50 text-white dark:text-slate-900 rounded-lg hover:bg-slate-700 dark:hover:bg-slate-200 transition-colors">
|
|
16
|
+
Search
|
|
17
|
+
</button>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
}
|