@schandlergarcia/sf-web-components 1.9.9 → 1.9.10
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 +374 -53
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,103 +1,416 @@
|
|
|
1
1
|
# @schandlergarcia/sf-web-components
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Comprehensive React component library for Salesforce web applications with 100+ TypeScript components, built on Tailwind CSS v4 and shadcn/ui.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- ✅ **102+ TypeScript Components** - Cards, charts, forms, filters, chat UI, and more
|
|
8
|
+
- ✅ **Zero-Config Installation** - Postinstall script handles everything automatically
|
|
9
|
+
- ✅ **Complete Dashboard Framework** - Pre-built layouts, metric cards, and data visualization
|
|
10
|
+
- ✅ **Account Search & Detail** - Full example pages with filtering, sorting, and pagination
|
|
11
|
+
- ✅ **Tailwind CSS v4** - Modern styling with dark mode support
|
|
12
|
+
- ✅ **Type-Safe** - Full TypeScript support with exported interfaces
|
|
13
|
+
|
|
14
|
+
---
|
|
6
15
|
|
|
7
16
|
## Installation
|
|
8
17
|
|
|
18
|
+
### Prerequisites
|
|
19
|
+
|
|
20
|
+
- Salesforce web application generated with `sf webapp generate --template react-ts`
|
|
21
|
+
- Node.js 18+ and npm
|
|
22
|
+
- Tailwind CSS v4 configured in your project
|
|
23
|
+
|
|
24
|
+
### Steps
|
|
25
|
+
|
|
9
26
|
```bash
|
|
10
|
-
|
|
27
|
+
# 1. Navigate to your web application directory
|
|
28
|
+
cd force-app/main/default/webapplications/YOUR_APP_NAME
|
|
29
|
+
|
|
30
|
+
# 2. Install the component library
|
|
31
|
+
npm install @schandlergarcia/sf-web-components@latest
|
|
32
|
+
|
|
33
|
+
# 3. Run postinstall script (npm sometimes skips automatic postinstall)
|
|
34
|
+
node node_modules/@schandlergarcia/sf-web-components/scripts/postinstall.mjs
|
|
35
|
+
|
|
36
|
+
# 4. Install required type definitions for D3 charts
|
|
37
|
+
npm install --save-dev @types/d3 @types/topojson-client
|
|
38
|
+
|
|
39
|
+
# 5. Build to verify installation
|
|
40
|
+
npm run build
|
|
41
|
+
|
|
42
|
+
# 6. Start development server
|
|
43
|
+
npm run dev
|
|
11
44
|
```
|
|
12
45
|
|
|
13
|
-
|
|
46
|
+
### What Gets Installed
|
|
47
|
+
|
|
48
|
+
The postinstall script automatically:
|
|
49
|
+
|
|
50
|
+
✅ **Copies 102 component files** to `src/components/library/`
|
|
51
|
+
- UI components (buttons, inputs, cards, alerts)
|
|
52
|
+
- HeroUI wrappers (modals, dropdowns, tabs)
|
|
53
|
+
- Charts (D3 visualizations, bar/line charts, geo maps)
|
|
54
|
+
- Cards (metric cards, chart cards, table cards, status cards)
|
|
55
|
+
- Forms (form renderer, form fields, validation)
|
|
56
|
+
- Filters (search, date range, multi-select, numeric range)
|
|
57
|
+
- Chat components (message UI, typing indicators, suggestions)
|
|
14
58
|
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
59
|
+
✅ **Installs complete routes configuration** at `src/routes.tsx`
|
|
60
|
+
- Home page with account search
|
|
61
|
+
- `/accounts` - Account search with filters and sorting
|
|
62
|
+
- `/accounts/:recordId` - Account detail page
|
|
63
|
+
- NotFound page
|
|
19
64
|
|
|
20
|
-
|
|
65
|
+
✅ **Installs 4 page templates** to `src/pages/`
|
|
66
|
+
- `Home.tsx` - Search interface with UIButton and UIInput
|
|
67
|
+
- `NotFound.tsx` - 404 error page
|
|
68
|
+
- `Search.tsx` - Generic search page
|
|
69
|
+
- `BlankDashboard.tsx` - Empty dashboard template
|
|
21
70
|
|
|
22
|
-
|
|
71
|
+
✅ **Copies type definitions** to `src/types/`
|
|
72
|
+
- `conversation.ts` - Types for AgentforceConversationClient
|
|
73
|
+
|
|
74
|
+
✅ **Copies utility files** to `src/lib/`
|
|
75
|
+
- `utils.ts` - Helper functions (cn, etc.)
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Using the Dashboard Framework
|
|
80
|
+
|
|
81
|
+
### Quick Start - Building a Dashboard
|
|
23
82
|
|
|
24
83
|
```tsx
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
84
|
+
import { MetricCard, ChartCard, TableCard } from '@/components/library';
|
|
85
|
+
import { PageContainer } from '@/components/library/layout/PageContainer';
|
|
27
86
|
|
|
28
|
-
function
|
|
87
|
+
export default function Dashboard() {
|
|
29
88
|
return (
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
89
|
+
<PageContainer>
|
|
90
|
+
{/* Metrics Row */}
|
|
91
|
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6">
|
|
92
|
+
<MetricCard
|
|
93
|
+
title="Total Revenue"
|
|
94
|
+
value="$1.2M"
|
|
95
|
+
change="+12.5%"
|
|
96
|
+
changeType="positive"
|
|
97
|
+
/>
|
|
98
|
+
<MetricCard
|
|
99
|
+
title="Active Users"
|
|
100
|
+
value={1284}
|
|
101
|
+
change="+8.2%"
|
|
102
|
+
changeType="positive"
|
|
103
|
+
/>
|
|
104
|
+
<MetricCard
|
|
105
|
+
title="Conversion Rate"
|
|
106
|
+
value="3.2%"
|
|
107
|
+
change="-0.5%"
|
|
108
|
+
changeType="negative"
|
|
109
|
+
/>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
{/* Charts Row */}
|
|
113
|
+
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
|
114
|
+
<ChartCard
|
|
115
|
+
title="Revenue Trend"
|
|
116
|
+
description="Last 6 months"
|
|
117
|
+
chartType="line"
|
|
118
|
+
data={revenueData}
|
|
119
|
+
/>
|
|
120
|
+
<TableCard
|
|
121
|
+
title="Top Accounts"
|
|
122
|
+
columns={columns}
|
|
123
|
+
data={accountsData}
|
|
124
|
+
/>
|
|
125
|
+
</div>
|
|
126
|
+
</PageContainer>
|
|
33
127
|
);
|
|
34
128
|
}
|
|
35
129
|
```
|
|
36
130
|
|
|
37
|
-
###
|
|
131
|
+
### Available Components
|
|
38
132
|
|
|
39
|
-
|
|
133
|
+
#### UI Components (`@/components/library/ui/`)
|
|
134
|
+
```tsx
|
|
135
|
+
import { UIButton, UIInput, Card, Alert, EmptyState, Checkbox, Label } from '@/components/library';
|
|
40
136
|
|
|
41
|
-
|
|
42
|
-
|
|
137
|
+
<UIButton variant="primary">Click Me</UIButton>
|
|
138
|
+
<UIInput placeholder="Search..." />
|
|
139
|
+
<Alert variant="success">Success message</Alert>
|
|
43
140
|
```
|
|
44
141
|
|
|
45
|
-
|
|
142
|
+
#### Cards (`@/components/library/cards/`)
|
|
143
|
+
```tsx
|
|
144
|
+
import { MetricCard, ChartCard, TableCard, StatusCard, ListCard } from '@/components/library';
|
|
145
|
+
|
|
146
|
+
<MetricCard title="Revenue" value="$1.2M" change="+12%" changeType="positive" />
|
|
147
|
+
<ChartCard title="Sales" chartType="bar" data={data} />
|
|
148
|
+
<TableCard title="Accounts" columns={cols} data={rows} />
|
|
149
|
+
```
|
|
46
150
|
|
|
47
|
-
|
|
151
|
+
#### Charts (`@/components/library/charts/`)
|
|
152
|
+
```tsx
|
|
153
|
+
import { D3Chart, D3ChartTemplates } from '@/components/library';
|
|
154
|
+
|
|
155
|
+
<D3Chart
|
|
156
|
+
data={data}
|
|
157
|
+
width={600}
|
|
158
|
+
height={400}
|
|
159
|
+
chartType="bar"
|
|
160
|
+
xKey="month"
|
|
161
|
+
yKey="revenue"
|
|
162
|
+
/>
|
|
163
|
+
```
|
|
48
164
|
|
|
49
|
-
|
|
50
|
-
|
|
165
|
+
#### Filters (`@/components/library/filters/`)
|
|
166
|
+
```tsx
|
|
167
|
+
import { SearchFilter, SelectFilter, DateRangeFilter, FilterBar } from '@/components/library';
|
|
51
168
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
theme: {
|
|
58
|
-
extend: {}
|
|
59
|
-
}
|
|
60
|
-
} satisfies Config;
|
|
169
|
+
<FilterBar>
|
|
170
|
+
<SearchFilter field="name" placeholder="Search accounts..." />
|
|
171
|
+
<SelectFilter field="industry" options={industries} />
|
|
172
|
+
<DateRangeFilter field="createdDate" />
|
|
173
|
+
</FilterBar>
|
|
61
174
|
```
|
|
62
175
|
|
|
63
|
-
|
|
176
|
+
#### Forms (`@/components/library/forms/`)
|
|
177
|
+
```tsx
|
|
178
|
+
import { FormRenderer, FormField, FormModal } from '@/components/library';
|
|
179
|
+
|
|
180
|
+
<FormRenderer
|
|
181
|
+
fields={fields}
|
|
182
|
+
values={values}
|
|
183
|
+
onChange={handleChange}
|
|
184
|
+
onSubmit={handleSubmit}
|
|
185
|
+
/>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Common Patterns
|
|
64
189
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
190
|
+
#### Dashboard with Filters
|
|
191
|
+
```tsx
|
|
192
|
+
import { PageContainer } from '@/components/library/layout/PageContainer';
|
|
193
|
+
import { MetricCard } from '@/components/library/cards/MetricCard';
|
|
194
|
+
import { FilterBar, SearchFilter, SelectFilter } from '@/components/library/filters';
|
|
195
|
+
|
|
196
|
+
export default function FilteredDashboard() {
|
|
197
|
+
const [filters, setFilters] = useState({});
|
|
72
198
|
|
|
73
|
-
|
|
199
|
+
return (
|
|
200
|
+
<PageContainer>
|
|
201
|
+
<FilterBar>
|
|
202
|
+
<SearchFilter field="search" onChange={setFilters} />
|
|
203
|
+
<SelectFilter field="status" options={statusOptions} onChange={setFilters} />
|
|
204
|
+
</FilterBar>
|
|
205
|
+
|
|
206
|
+
<div className="grid grid-cols-3 gap-6">
|
|
207
|
+
<MetricCard title="Total" value={data.total} />
|
|
208
|
+
<MetricCard title="Active" value={data.active} />
|
|
209
|
+
<MetricCard title="Pending" value={data.pending} />
|
|
210
|
+
</div>
|
|
211
|
+
</PageContainer>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
```
|
|
74
215
|
|
|
216
|
+
#### Data Table with Actions
|
|
75
217
|
```tsx
|
|
76
|
-
import {
|
|
218
|
+
import { TableCard } from '@/components/library/cards/TableCard';
|
|
219
|
+
import { UIButton } from '@/components/library/ui/UIButton';
|
|
220
|
+
|
|
221
|
+
const columns = [
|
|
222
|
+
{ key: 'name', label: 'Name' },
|
|
223
|
+
{ key: 'status', label: 'Status' },
|
|
224
|
+
{
|
|
225
|
+
key: 'actions',
|
|
226
|
+
label: 'Actions',
|
|
227
|
+
render: (row) => <UIButton onClick={() => handleEdit(row)}>Edit</UIButton>
|
|
228
|
+
}
|
|
229
|
+
];
|
|
230
|
+
|
|
231
|
+
<TableCard title="Accounts" columns={columns} data={accounts} />
|
|
232
|
+
```
|
|
77
233
|
|
|
78
|
-
|
|
79
|
-
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Resetting Your App
|
|
237
|
+
|
|
238
|
+
If you need to remove the component library and start fresh:
|
|
239
|
+
|
|
240
|
+
### Option 1: Remove Components Only
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# Run the removal script
|
|
244
|
+
node node_modules/@schandlergarcia/sf-web-components/scripts/remove-local-components.mjs
|
|
245
|
+
|
|
246
|
+
# This removes:
|
|
247
|
+
# - src/components/library/
|
|
248
|
+
# - src/pages/Home.tsx, Search.tsx, BlankDashboard.tsx (keeps NotFound.tsx)
|
|
249
|
+
# - src/types/conversation.ts
|
|
250
|
+
# - Reverts routes.tsx to minimal default
|
|
80
251
|
```
|
|
81
252
|
|
|
82
|
-
|
|
253
|
+
### Option 2: Full Reset
|
|
83
254
|
|
|
84
255
|
```bash
|
|
85
|
-
#
|
|
256
|
+
# 1. Uninstall the package
|
|
257
|
+
npm uninstall @schandlergarcia/sf-web-components
|
|
258
|
+
|
|
259
|
+
# 2. Manually delete installed files
|
|
260
|
+
rm -rf src/components/library
|
|
261
|
+
rm -rf src/types/conversation.ts
|
|
262
|
+
rm src/pages/Home.tsx src/pages/Search.tsx src/pages/BlankDashboard.tsx
|
|
263
|
+
|
|
264
|
+
# 3. Restore default routes.tsx
|
|
265
|
+
cat > src/routes.tsx << 'EOF'
|
|
266
|
+
import type { RouteObject } from 'react-router';
|
|
267
|
+
import AppLayout from './appLayout';
|
|
268
|
+
import NotFound from './pages/NotFound';
|
|
269
|
+
|
|
270
|
+
export const routes: RouteObject[] = [
|
|
271
|
+
{
|
|
272
|
+
path: "/",
|
|
273
|
+
element: <AppLayout />,
|
|
274
|
+
children: [
|
|
275
|
+
{
|
|
276
|
+
path: '*',
|
|
277
|
+
element: <NotFound />
|
|
278
|
+
}
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
];
|
|
282
|
+
EOF
|
|
283
|
+
|
|
284
|
+
# 4. Clean install
|
|
86
285
|
npm install
|
|
286
|
+
npm run build
|
|
287
|
+
```
|
|
87
288
|
|
|
88
|
-
|
|
289
|
+
### Reset Command Center (for enginewebexperience app)
|
|
290
|
+
|
|
291
|
+
If you're working on the `enginewebexperience` app specifically:
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
# This script resets the command center to the blank dashboard template
|
|
295
|
+
npm run reset:command-center
|
|
296
|
+
|
|
297
|
+
# Or run directly:
|
|
298
|
+
bash node_modules/@schandlergarcia/sf-web-components/scripts/reset-command-center.sh
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## Troubleshooting
|
|
304
|
+
|
|
305
|
+
### Postinstall didn't run automatically
|
|
306
|
+
|
|
307
|
+
**Problem:** After `npm install`, component library isn't copied and routes aren't updated.
|
|
308
|
+
|
|
309
|
+
**Solution:** Run postinstall manually:
|
|
310
|
+
```bash
|
|
311
|
+
node node_modules/@schandlergarcia/sf-web-components/scripts/postinstall.mjs
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Build errors about missing D3 types
|
|
315
|
+
|
|
316
|
+
**Problem:** TypeScript errors about `module 'd3'` or `module 'topojson-client'`.
|
|
317
|
+
|
|
318
|
+
**Solution:** Install type definitions:
|
|
319
|
+
```bash
|
|
320
|
+
npm install --save-dev @types/d3 @types/topojson-client
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Buttons appear blank/invisible
|
|
324
|
+
|
|
325
|
+
**Problem:** UIButton text is invisible (white text on transparent background).
|
|
326
|
+
|
|
327
|
+
**Solution:** This was fixed in v1.9.7+. Update to the latest version:
|
|
328
|
+
```bash
|
|
329
|
+
npm install @schandlergarcia/sf-web-components@latest
|
|
330
|
+
node node_modules/@schandlergarcia/sf-web-components/scripts/postinstall.mjs
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### "Old UI" still showing after install
|
|
334
|
+
|
|
335
|
+
**Problem:** Home page shows the scaffolded UI instead of component library UI.
|
|
336
|
+
|
|
337
|
+
**Solution:** Fixed in v1.9.9+. Update and re-run postinstall:
|
|
338
|
+
```bash
|
|
339
|
+
npm install @schandlergarcia/sf-web-components@latest
|
|
340
|
+
node node_modules/@schandlergarcia/sf-web-components/scripts/postinstall.mjs
|
|
89
341
|
npm run build
|
|
342
|
+
```
|
|
90
343
|
|
|
91
|
-
|
|
92
|
-
|
|
344
|
+
### Account detail pages show 404
|
|
345
|
+
|
|
346
|
+
**Problem:** Clicking on an account in search results shows 404.
|
|
347
|
+
|
|
348
|
+
**Solution:** Routes template includes account detail route. Re-run postinstall:
|
|
349
|
+
```bash
|
|
350
|
+
node node_modules/@schandlergarcia/sf-web-components/scripts/postinstall.mjs
|
|
93
351
|
```
|
|
94
352
|
|
|
95
|
-
|
|
353
|
+
### ESLint errors about `.sfdx` directory
|
|
354
|
+
|
|
355
|
+
**Problem:** ESLint errors about files in `src/components/library/.sfdx/`.
|
|
356
|
+
|
|
357
|
+
**Solution:** Fixed in v1.9.6+. The postinstall script now skips hidden directories.
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## Package Scripts
|
|
362
|
+
|
|
363
|
+
Available npm scripts in the consuming application:
|
|
96
364
|
|
|
97
365
|
```bash
|
|
98
|
-
|
|
366
|
+
# Development
|
|
367
|
+
npm run dev # Start Vite dev server
|
|
368
|
+
npm run build # TypeScript check + Vite build
|
|
369
|
+
npm run lint # Run ESLint
|
|
370
|
+
|
|
371
|
+
# GraphQL (if using)
|
|
372
|
+
npm run graphql:schema # Fetch GraphQL schema from Salesforce org
|
|
373
|
+
npm run graphql:codegen # Generate TypeScript types from schema
|
|
374
|
+
|
|
375
|
+
# Testing
|
|
376
|
+
npm run test # Run Vitest tests
|
|
99
377
|
```
|
|
100
378
|
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## Component Documentation
|
|
382
|
+
|
|
383
|
+
For detailed component API documentation, see:
|
|
384
|
+
- [Component Library Reference](https://github.com/schandlergarcia/sf-web-components/blob/main/COMPONENTS.md)
|
|
385
|
+
- [TypeScript Migration Guide](https://github.com/schandlergarcia/sf-web-components/blob/main/docs/TYPESCRIPT_MIGRATION.md)
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## Version History
|
|
390
|
+
|
|
391
|
+
### Latest: v1.9.9 (2026-03-29)
|
|
392
|
+
- Fixed routes template importing wrong Home page
|
|
393
|
+
- Now uses installed Home.tsx with component library UI
|
|
394
|
+
|
|
395
|
+
### v1.9.8 (2026-03-29)
|
|
396
|
+
- Added complete routes.tsx template with account search & detail
|
|
397
|
+
- Zero-config installation
|
|
398
|
+
|
|
399
|
+
### v1.9.7 (2026-03-29)
|
|
400
|
+
- Fixed UIButton using non-existent brand colors
|
|
401
|
+
- Changed to standard blue colors
|
|
402
|
+
|
|
403
|
+
### v1.9.6 (2026-03-29)
|
|
404
|
+
- Fixed AgentforceConversationClient type definitions
|
|
405
|
+
- Postinstall now skips hidden directories
|
|
406
|
+
|
|
407
|
+
### v1.9.5 (2026-03-29)
|
|
408
|
+
- Updated glob dependency to v13.0.6
|
|
409
|
+
- Fixed security vulnerabilities
|
|
410
|
+
|
|
411
|
+
See [CHANGELOG.md](./CHANGELOG.md) for full version history.
|
|
412
|
+
|
|
413
|
+
---
|
|
101
414
|
|
|
102
415
|
## 🤖 AI Agent Skills
|
|
103
416
|
|
|
@@ -120,7 +433,15 @@ When you install this package, Claude Code automatically discovers the skills an
|
|
|
120
433
|
|
|
121
434
|
Check `.a4drules/skills/` for the full list of included agent skills.
|
|
122
435
|
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## Support
|
|
439
|
+
|
|
440
|
+
- **Issues:** [GitHub Issues](https://github.com/schandlergarcia/sf-web-components/issues)
|
|
441
|
+
- **Package:** [npm](https://www.npmjs.com/package/@schandlergarcia/sf-web-components)
|
|
442
|
+
|
|
443
|
+
---
|
|
123
444
|
|
|
124
445
|
## License
|
|
125
446
|
|
|
126
|
-
MIT
|
|
447
|
+
MIT License - See LICENSE.txt for details
|
package/package.json
CHANGED