@jmruthers/pace-core 0.5.60 → 0.5.61
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 +2 -2
- package/dist/{PublicLoadingSpinner-SL8WaQN7.d.ts → PublicLoadingSpinner-CrMOrhNz.d.ts} +4 -28
- package/dist/{chunk-SFMRBGGK.js → chunk-44SAHU2N.js} +133 -134
- package/dist/chunk-44SAHU2N.js.map +1 -0
- package/dist/{chunk-ITPVFKDH.js → chunk-4ULBJNIT.js} +128 -11
- package/dist/chunk-4ULBJNIT.js.map +1 -0
- package/dist/{chunk-NMNDTCOR.js → chunk-HFDYTSAP.js} +2 -2
- package/dist/{chunk-NQ4TOOO6.js → chunk-L3RV2ALE.js} +1 -1
- package/dist/chunk-L3RV2ALE.js.map +1 -0
- package/dist/components.d.ts +2 -2
- package/dist/components.js +3 -5
- package/dist/components.js.map +1 -1
- package/dist/hooks.d.ts +3 -63
- package/dist/hooks.js +28 -143
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/{organisation-t-vvQC3g.d.ts → organisation-DD0yBbGU.d.ts} +1 -1
- package/dist/providers.d.ts +2 -2
- package/dist/styles/index.d.ts +1 -1
- package/dist/styles/index.js +1 -1
- package/dist/{usePublicRouteParams-CdoFxnJK.d.ts → usePublicRouteParams-Cu6oKazv.d.ts} +63 -2
- package/docs/README.md +1 -1
- package/docs/api/README.md +2 -2
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +1 -1
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +1 -1
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +1 -1
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +1 -1
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventContextType.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/EventProviderProps.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACContextType.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RBACProviderProps.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +37 -52
- package/docs/architecture/README.md +1 -3
- package/docs/consuming-app-example.md +3 -3
- package/docs/consuming-app-vite-config.md +1 -1
- package/docs/documentation-style-checklist.md +2 -2
- package/docs/getting-started/examples/basic-auth-app.md +2 -2
- package/docs/getting-started/installation.md +2 -2
- package/docs/getting-started/quick-start.md +1 -1
- package/docs/migration/README.md +6 -6
- package/docs/migration/quick-migration-guide.md +3 -3
- package/docs/migration/v0.4.15-tailwind-scanning.md +1 -1
- package/docs/migration/v0.4.16-css-first-approach.md +1 -1
- package/docs/migration/v0.4.17-source-path-fix.md +4 -4
- package/docs/migration-guide.md +2 -2
- package/docs/quick-reference.md +4 -4
- package/docs/styles/README.md +3 -3
- package/docs/troubleshooting/README.md +2 -2
- package/docs/troubleshooting/common-issues.md +1 -1
- package/docs/troubleshooting/styling-issues.md +2 -2
- package/docs/troubleshooting/tailwind-content-scanning.md +2 -2
- package/docs/usage.md +2 -2
- package/package.json +2 -6
- package/src/components/Toast/Toast.test.tsx +51 -21
- package/src/components/Toast/Toast.tsx +13 -35
- package/src/components/Toast/index.ts +0 -1
- package/src/components/index.ts +0 -1
- package/src/index.ts +1 -1
- package/src/rbac/__tests__/rbac-engine-core-logic.test.ts +1 -1
- package/src/rbac/__tests__/rbac-engine-simplified.test.ts +1 -1
- package/src/styles/core.css +32 -37
- package/src/styles/index.ts +1 -1
- package/dist/chunk-ITPVFKDH.js.map +0 -1
- package/dist/chunk-NQ4TOOO6.js.map +0 -1
- package/dist/chunk-SFMRBGGK.js.map +0 -1
- package/dist/styles/core.css +0 -242
- package/dist/styles/fonts/georama-italic.woff2 +0 -0
- package/dist/styles/fonts/georama.woff2 +0 -0
- package/dist/styles/fonts/open-sans-italic.woff2 +0 -0
- package/dist/styles/fonts/open-sans.woff2 +0 -0
- package/dist/styles/fonts/reddit-mono.woff2 +0 -0
- package/src/styles/base.css +0 -208
- package/src/styles/semantic.css +0 -24
- /package/dist/{chunk-NMNDTCOR.js.map → chunk-HFDYTSAP.js.map} +0 -0
|
@@ -23,7 +23,7 @@ import { DataTable, Button } from '@jmruthers/pace-core';
|
|
|
23
23
|
|
|
24
24
|
// Import the core CSS file (in your app's entry point)
|
|
25
25
|
import './app.css'; // Your app's color palette (must come first)
|
|
26
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
26
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
27
27
|
|
|
28
28
|
interface User {
|
|
29
29
|
id: string;
|
|
@@ -125,7 +125,7 @@ import { DataTable, Button, useUnifiedAuth } from '@jmruthers/pace-core';
|
|
|
125
125
|
|
|
126
126
|
// Import the core CSS file (in your app's entry point)
|
|
127
127
|
import './app.css'; // Your app's color palette (must come first)
|
|
128
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
128
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
129
129
|
|
|
130
130
|
// ❌ Bad - Incomplete imports
|
|
131
131
|
import { DataTable } from '@jmruthers/pace-core';
|
|
@@ -119,7 +119,7 @@ import { UnifiedAuthProvider } from '@jmruthers/pace-core';
|
|
|
119
119
|
import { supabase } from './hooks/useSupabase';
|
|
120
120
|
import LoginForm from './components/LoginForm';
|
|
121
121
|
import Dashboard from './components/Dashboard';
|
|
122
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
122
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
123
123
|
|
|
124
124
|
function App() {
|
|
125
125
|
return (
|
|
@@ -505,7 +505,7 @@ The app uses PACE Core's design system. You can customize:
|
|
|
505
505
|
### Common Issues
|
|
506
506
|
|
|
507
507
|
**Styling not working:**
|
|
508
|
-
- Ensure CSS import is first: `import '@jmruthers/pace-core/styles/core.css';`
|
|
508
|
+
- Ensure CSS import is first: `import '@jmruthers/pace-core/src/styles/core.css';`
|
|
509
509
|
- Check Vite configuration for content scanning
|
|
510
510
|
|
|
511
511
|
**Authentication not working:**
|
|
@@ -112,7 +112,7 @@ export default defineConfig({
|
|
|
112
112
|
|
|
113
113
|
```tsx
|
|
114
114
|
// src/main.tsx (or your app's entry point)
|
|
115
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
115
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
116
116
|
import React from 'react';
|
|
117
117
|
import ReactDOM from 'react-dom/client';
|
|
118
118
|
import App from './App';
|
|
@@ -245,7 +245,7 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
|
245
245
|
|
|
246
246
|
Before asking for help, verify:
|
|
247
247
|
|
|
248
|
-
- [ ] CSS file is imported: `import '@jmruthers/pace-core/styles/core.css'`
|
|
248
|
+
- [ ] CSS file is imported: `import '@jmruthers/pace-core/src/styles/core.css'`
|
|
249
249
|
- [ ] Vite config includes pace-core in content scanning
|
|
250
250
|
- [ ] Using Tailwind v4 (not v3)
|
|
251
251
|
- [ ] Dev server restarted after config changes
|
|
@@ -139,7 +139,7 @@ import { supabase } from './lib/supabase'
|
|
|
139
139
|
import App from './App.tsx'
|
|
140
140
|
|
|
141
141
|
// CRITICAL: Import the CSS system - includes everything you need
|
|
142
|
-
import '@jmruthers/pace-core/styles/core.css'
|
|
142
|
+
import '@jmruthers/pace-core/src/styles/core.css'
|
|
143
143
|
|
|
144
144
|
// ⚠️ CRITICAL: Setup RBAC before using any RBAC features
|
|
145
145
|
setupRBAC(supabase)
|
package/docs/migration/README.md
CHANGED
|
@@ -79,7 +79,7 @@ npm install @jmruthers/pace-core@latest
|
|
|
79
79
|
**CRITICAL**: Fixed Tailwind v4 theme file with missing semantic colors and circular @apply references.
|
|
80
80
|
|
|
81
81
|
**Impact**:
|
|
82
|
-
- Build failures when importing `@jmruthers/pace-core/styles/core.css`
|
|
82
|
+
- Build failures when importing `@jmruthers/pace-core/src/styles/core.css`
|
|
83
83
|
- Missing semantic colors (ring, border, background, foreground, etc.)
|
|
84
84
|
- Component classes not working due to circular references
|
|
85
85
|
|
|
@@ -103,7 +103,7 @@ npm install @jmruthers/pace-core@latest
|
|
|
103
103
|
**Usage** (now works out-of-the-box):
|
|
104
104
|
```tsx
|
|
105
105
|
/* main.tsx */
|
|
106
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
106
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
```ts
|
|
@@ -154,7 +154,7 @@ PACE Core now supports Tailwind CSS v4 with modern CSS-first configuration.
|
|
|
154
154
|
@tailwind utilities;
|
|
155
155
|
|
|
156
156
|
/* After (v4) */
|
|
157
|
-
@import '@jmruthers/pace-core/styles/core.css';
|
|
157
|
+
@import '@jmruthers/pace-core/src/styles/core.css';
|
|
158
158
|
```
|
|
159
159
|
|
|
160
160
|
For complete Tailwind v4 setup instructions, see the [Styling Guide](../styles/README.md#tailwind-css-v4-setup).
|
|
@@ -284,7 +284,7 @@ import { UnifiedAuthProvider } from '@jmruthers/pace-core';
|
|
|
284
284
|
|
|
285
285
|
// Import the core CSS file - app.css must come first for proper @theme processing
|
|
286
286
|
import './app.css'; // Your app's color palette
|
|
287
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
287
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
288
288
|
|
|
289
289
|
function App() {
|
|
290
290
|
return (
|
|
@@ -354,7 +354,7 @@ import { Button, Modal } from '@jmruthers/pace-core';
|
|
|
354
354
|
|
|
355
355
|
// Import the core CSS file (in your app's entry point)
|
|
356
356
|
import './app.css'; // Your app's color palette (must come first)
|
|
357
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
357
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
358
358
|
|
|
359
359
|
function MyComponent() {
|
|
360
360
|
return (
|
|
@@ -454,7 +454,7 @@ echo "Migration complete! Please review changes and test thoroughly."
|
|
|
454
454
|
**Solution**: Import the CSS files in your app's entry point:
|
|
455
455
|
```tsx
|
|
456
456
|
import './app.css'; // Your app's color palette (must come first)
|
|
457
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
457
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
458
458
|
```
|
|
459
459
|
|
|
460
460
|
### Issue 4: TypeScript Errors
|
|
@@ -107,10 +107,10 @@ export default defineConfig({
|
|
|
107
107
|
**Update CSS imports:**
|
|
108
108
|
```tsx
|
|
109
109
|
// Before
|
|
110
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
110
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
111
111
|
|
|
112
112
|
// After
|
|
113
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
113
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
114
114
|
```
|
|
115
115
|
|
|
116
116
|
### Source Path Fix (v0.4.17+)
|
|
@@ -195,7 +195,7 @@ import { Button, useUnifiedAuth } from '@jmruthers/pace-core';
|
|
|
195
195
|
**Solution**:
|
|
196
196
|
```tsx
|
|
197
197
|
// Ensure CSS import is first
|
|
198
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
198
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
199
199
|
import { Button } from '@jmruthers/pace-core';
|
|
200
200
|
```
|
|
201
201
|
|
|
@@ -229,7 +229,7 @@ grep -c "\.bg-\|\.text-\|\.p-\|\.m-\|\.w-\|\.h-\|\.flex\|\.grid" dist/assets/*.c
|
|
|
229
229
|
### Issue: Components still unstyled
|
|
230
230
|
|
|
231
231
|
**Solution:**
|
|
232
|
-
1. Verify CSS import: `import '@jmruthers/pace-core/styles/core.css'`
|
|
232
|
+
1. Verify CSS import: `import '@jmruthers/pace-core/src/styles/core.css'`
|
|
233
233
|
2. Check Vite configuration includes source files
|
|
234
234
|
3. Restart dev server after changes
|
|
235
235
|
|
|
@@ -259,7 +259,7 @@ grep -c "\.bg-\|\.text-\|\.p-\|\.m-\|\.w-\|\.h-\|\.flex\|\.grid" dist/assets/*.c
|
|
|
259
259
|
### Issue: Components still unstyled
|
|
260
260
|
|
|
261
261
|
**Solution:**
|
|
262
|
-
1. Verify CSS import: `import '@jmruthers/pace-core/styles/core.css'`
|
|
262
|
+
1. Verify CSS import: `import '@jmruthers/pace-core/src/styles/core.css'`
|
|
263
263
|
2. Check Vite configuration includes source files
|
|
264
264
|
3. Restart dev server after changes
|
|
265
265
|
4. Use fallback configuration if CSS-first approach fails
|
|
@@ -6,7 +6,7 @@ This guide explains the critical fix in pace-core v0.4.17 that resolves the @sou
|
|
|
6
6
|
|
|
7
7
|
**Issue**: The @source directives in `core.css` were using incorrect relative paths, preventing Tailwind v4 from scanning the pace-core source files.
|
|
8
8
|
|
|
9
|
-
**Root Cause**: Since `core.css` is located in `
|
|
9
|
+
**Root Cause**: Since `core.css` is located in `src/styles/core.css`, the relative paths `./src/**/*.{js,ts,jsx,tsx}` were looking for `dist/src/` which doesn't exist.
|
|
10
10
|
|
|
11
11
|
## ✅ The Fix
|
|
12
12
|
|
|
@@ -52,8 +52,8 @@ node_modules/@jmruthers/pace-core/
|
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
**Path Resolution**:
|
|
55
|
-
- From `
|
|
56
|
-
- The `../` goes up one directory from `
|
|
55
|
+
- From `src/styles/core.css` to `src/` requires `../src/`
|
|
56
|
+
- The `../` goes up one directory from `src/styles/` to `src/`
|
|
57
57
|
- Then `src/` goes into the source directory
|
|
58
58
|
|
|
59
59
|
## 🚀 Migration Steps
|
|
@@ -209,7 +209,7 @@ You'll know the fix was successful when:
|
|
|
209
209
|
### Issue: Components still unstyled
|
|
210
210
|
|
|
211
211
|
**Solution**:
|
|
212
|
-
1. Verify CSS import: `import '@jmruthers/pace-core/styles/core.css'`
|
|
212
|
+
1. Verify CSS import: `import '@jmruthers/pace-core/src/styles/core.css'`
|
|
213
213
|
2. Restart dev server after changes
|
|
214
214
|
3. Check browser dev tools for missing classes
|
|
215
215
|
|
package/docs/migration-guide.md
CHANGED
|
@@ -53,7 +53,7 @@ Replace old style imports with the new two-file system:
|
|
|
53
53
|
// import '@jmruthers/pace-core/styles/theme.css';
|
|
54
54
|
|
|
55
55
|
// NEW - Import both CSS files in the correct order
|
|
56
|
-
import '@jmruthers/pace-core/styles/core.css'; // Import core first
|
|
56
|
+
import '@jmruthers/pace-core/src/styles/core.css'; // Import core first
|
|
57
57
|
import './app.css'; // Import app-specific colors second
|
|
58
58
|
```
|
|
59
59
|
|
|
@@ -183,7 +183,7 @@ To customize your app's colors, simply update the `--color-main-*`, `--color-sec
|
|
|
183
183
|
- Make sure you're importing the core CSS file in your app's entry point:
|
|
184
184
|
```tsx
|
|
185
185
|
import './app.css'; // Your app's color palette (must come first)
|
|
186
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
186
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
187
187
|
```
|
|
188
188
|
- Check that Tailwind CSS v4 is properly configured
|
|
189
189
|
- Ensure your Vite configuration includes the `@tailwindcss/vite` plugin
|
package/docs/quick-reference.md
CHANGED
|
@@ -38,7 +38,7 @@ import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
|
|
|
38
38
|
|
|
39
39
|
// Import the core CSS file - app.css must come first for proper @theme processing
|
|
40
40
|
import './app.css'; // Your app's color palette
|
|
41
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
41
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
42
42
|
|
|
43
43
|
function App() {
|
|
44
44
|
return (
|
|
@@ -379,7 +379,7 @@ export default defineConfig({
|
|
|
379
379
|
});
|
|
380
380
|
|
|
381
381
|
// main.tsx
|
|
382
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
382
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
383
383
|
```
|
|
384
384
|
|
|
385
385
|
**What's included automatically**:
|
|
@@ -401,14 +401,14 @@ module.exports = {
|
|
|
401
401
|
|
|
402
402
|
// index.css or main.tsx
|
|
403
403
|
import './app.css'; // Your app's color palette (must come first)
|
|
404
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
404
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
405
405
|
```
|
|
406
406
|
|
|
407
407
|
### Using Design Tokens
|
|
408
408
|
```tsx
|
|
409
409
|
// Import the core CSS file
|
|
410
410
|
import './app.css'; // Your app's color palette (must come first)
|
|
411
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
411
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
412
412
|
|
|
413
413
|
// Use in your CSS
|
|
414
414
|
.my-component {
|
package/docs/styles/README.md
CHANGED
|
@@ -149,7 +149,7 @@ Every app must define three color palettes with complete shade ranges (50-950):
|
|
|
149
149
|
|
|
150
150
|
```tsx
|
|
151
151
|
// In your app's entry point (e.g., main.tsx)
|
|
152
|
-
import '@jmruthers/pace-core/styles/core.css'; // Import core first
|
|
152
|
+
import '@jmruthers/pace-core/src/styles/core.css'; // Import core first
|
|
153
153
|
import './app.css'; // Import app-specific colors second
|
|
154
154
|
```
|
|
155
155
|
|
|
@@ -223,7 +223,7 @@ Create `src/app.css` in your consuming app with your brand colors and source dir
|
|
|
223
223
|
|
|
224
224
|
```tsx
|
|
225
225
|
// In your app's entry point (e.g., main.tsx)
|
|
226
|
-
import '@jmruthers/pace-core/styles/core.css'; // Import core first
|
|
226
|
+
import '@jmruthers/pace-core/src/styles/core.css'; // Import core first
|
|
227
227
|
import './app.css'; // Import app-specific colors second
|
|
228
228
|
```
|
|
229
229
|
|
|
@@ -357,7 +357,7 @@ PACE Core also provides semantic color utilities that automatically map to your
|
|
|
357
357
|
|
|
358
358
|
**Solution**: Ensure you've imported both CSS files in the correct order:
|
|
359
359
|
```tsx
|
|
360
|
-
import '@jmruthers/pace-core/styles/core.css'; // Import core first
|
|
360
|
+
import '@jmruthers/pace-core/src/styles/core.css'; // Import core first
|
|
361
361
|
import './app.css'; // Import app-specific colors second
|
|
362
362
|
```
|
|
363
363
|
|
|
@@ -37,7 +37,7 @@ Comprehensive troubleshooting guide for PACE Core applications. Find solutions t
|
|
|
37
37
|
**Quick Fix:**
|
|
38
38
|
```tsx
|
|
39
39
|
// ✅ Make sure you import the CSS
|
|
40
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
40
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
**Common Causes:**
|
|
@@ -333,7 +333,7 @@ console.log('User roles:', userRoles);
|
|
|
333
333
|
**Quick Fix:**
|
|
334
334
|
```tsx
|
|
335
335
|
// ✅ Import CSS first
|
|
336
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
336
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
337
337
|
import { Button } from '@jmruthers/pace-core';
|
|
338
338
|
```
|
|
339
339
|
|
|
@@ -58,7 +58,7 @@ export default defineConfig({
|
|
|
58
58
|
**Solution**: Import the CSS file in your main entry point:
|
|
59
59
|
```tsx
|
|
60
60
|
// src/main.tsx or src/index.tsx
|
|
61
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
61
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
### Issue: Colors not working
|
|
@@ -195,7 +195,7 @@ export default defineConfig({
|
|
|
195
195
|
|
|
196
196
|
Before asking for help, verify:
|
|
197
197
|
|
|
198
|
-
- [ ] CSS file is imported: `import '@jmruthers/pace-core/styles/core.css'`
|
|
198
|
+
- [ ] CSS file is imported: `import '@jmruthers/pace-core/src/styles/core.css'`
|
|
199
199
|
- [ ] Vite config includes pace-core in content scanning
|
|
200
200
|
- [ ] Using Tailwind v4 (not v3)
|
|
201
201
|
- [ ] Dev server restarted after config changes
|
|
@@ -62,7 +62,7 @@ If source file scanning doesn't work, use the pre-built CSS approach:
|
|
|
62
62
|
|
|
63
63
|
```tsx
|
|
64
64
|
// src/main.tsx
|
|
65
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
65
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
66
66
|
// Don't import your own Tailwind CSS
|
|
67
67
|
```
|
|
68
68
|
|
|
@@ -110,7 +110,7 @@ export default defineConfig({
|
|
|
110
110
|
|
|
111
111
|
```tsx
|
|
112
112
|
// src/main.tsx
|
|
113
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
113
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
114
114
|
```
|
|
115
115
|
|
|
116
116
|
## 🔍 Verification Steps
|
package/docs/usage.md
CHANGED
|
@@ -41,7 +41,7 @@ In your app's entry point (e.g., `main.tsx` or root layout):
|
|
|
41
41
|
|
|
42
42
|
```tsx
|
|
43
43
|
// Import the core CSS file first
|
|
44
|
-
import '@jmruthers/pace-core/styles/core.css';
|
|
44
|
+
import '@jmruthers/pace-core/src/styles/core.css';
|
|
45
45
|
|
|
46
46
|
// Import your app-specific colors second
|
|
47
47
|
import './app.css';
|
|
@@ -176,7 +176,7 @@ PACE Core also provides semantic color utilities that automatically map to your
|
|
|
176
176
|
## Troubleshooting
|
|
177
177
|
|
|
178
178
|
### Colors Not Appearing
|
|
179
|
-
- Ensure you've imported `@jmruthers/pace-core/styles/core.css`
|
|
179
|
+
- Ensure you've imported `@jmruthers/pace-core/src/styles/core.css`
|
|
180
180
|
- If using custom palettes, check that your `app.css` defines the complete palette
|
|
181
181
|
- Verify Tailwind v4 is installed
|
|
182
182
|
- Check that font files are available in your `/fonts` directory
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jmruthers/pace-core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.61",
|
|
4
4
|
"description": "Clean, modern React component library with Tailwind v4 styling and native utilities",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -57,11 +57,7 @@
|
|
|
57
57
|
"import": "./dist/rbac/eslint-rules.js",
|
|
58
58
|
"default": "./dist/rbac/eslint-rules.js"
|
|
59
59
|
},
|
|
60
|
-
"./styles/core.css": "./
|
|
61
|
-
"./styles": {
|
|
62
|
-
"import": "./dist/styles/index.js",
|
|
63
|
-
"default": "./dist/styles/index.js"
|
|
64
|
-
},
|
|
60
|
+
"./styles/core.css": "./src/styles/core.css",
|
|
65
61
|
"./theming/runtime": {
|
|
66
62
|
"types": "./dist/theming/runtime.d.ts",
|
|
67
63
|
"import": "./dist/theming/runtime.js",
|
|
@@ -16,24 +16,15 @@ import {
|
|
|
16
16
|
ToastViewport,
|
|
17
17
|
ToastProvider,
|
|
18
18
|
Toaster,
|
|
19
|
-
useToast,
|
|
20
19
|
ToastProps
|
|
21
20
|
} from './Toast';
|
|
21
|
+
import { useToast, reset } from '../../hooks/useToast';
|
|
22
22
|
import { renderWithProviders } from '../../__tests__/helpers/test-utils';
|
|
23
23
|
|
|
24
|
-
// Mock console methods to avoid noise in tests
|
|
25
|
-
const originalConsoleLog = console.log;
|
|
26
|
-
|
|
27
24
|
describe('Toast Component System', () => {
|
|
28
25
|
beforeEach(() => {
|
|
29
26
|
vi.clearAllMocks();
|
|
30
|
-
//
|
|
31
|
-
console.log = vi.fn();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
afterEach(() => {
|
|
35
|
-
// Restore console methods
|
|
36
|
-
console.log = originalConsoleLog;
|
|
27
|
+
reset(); // Reset toast state between tests
|
|
37
28
|
});
|
|
38
29
|
|
|
39
30
|
// ToastProvider component tests
|
|
@@ -126,6 +117,30 @@ describe('Toast Component System', () => {
|
|
|
126
117
|
|
|
127
118
|
expect(screen.getByTestId('toast-viewport')).toBeInTheDocument();
|
|
128
119
|
});
|
|
120
|
+
|
|
121
|
+
it('renders toasts when they exist in state', () => {
|
|
122
|
+
// Create a test component that adds a toast
|
|
123
|
+
function TestComponent() {
|
|
124
|
+
const { toast } = useToast();
|
|
125
|
+
|
|
126
|
+
React.useEffect(() => {
|
|
127
|
+
toast({
|
|
128
|
+
title: 'Test Toast',
|
|
129
|
+
description: 'This is a test toast'
|
|
130
|
+
});
|
|
131
|
+
}, [toast]);
|
|
132
|
+
|
|
133
|
+
return <Toaster />;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
renderWithProviders(<TestComponent />);
|
|
137
|
+
|
|
138
|
+
// Wait for the toast to appear
|
|
139
|
+
waitFor(() => {
|
|
140
|
+
expect(screen.getByText('Test Toast')).toBeInTheDocument();
|
|
141
|
+
expect(screen.getByText('This is a test toast')).toBeInTheDocument();
|
|
142
|
+
});
|
|
143
|
+
});
|
|
129
144
|
});
|
|
130
145
|
|
|
131
146
|
// useToast hook tests
|
|
@@ -148,42 +163,57 @@ describe('Toast Component System', () => {
|
|
|
148
163
|
expect(screen.getByText('Dismiss')).toBeInTheDocument();
|
|
149
164
|
});
|
|
150
165
|
|
|
151
|
-
it('
|
|
166
|
+
it('adds toast to state when triggered', async () => {
|
|
152
167
|
const user = userEvent.setup();
|
|
153
168
|
|
|
154
169
|
function TestComponent() {
|
|
155
|
-
const { toast } = useToast();
|
|
170
|
+
const { toast, toasts } = useToast();
|
|
156
171
|
|
|
157
172
|
return (
|
|
158
|
-
<
|
|
173
|
+
<div>
|
|
174
|
+
<button onClick={() => toast({ title: 'Test Toast' })}>Show Toast</button>
|
|
175
|
+
<div data-testid="toast-count">{toasts.length}</div>
|
|
176
|
+
</div>
|
|
159
177
|
);
|
|
160
178
|
}
|
|
161
179
|
|
|
162
180
|
renderWithProviders(<TestComponent />);
|
|
163
181
|
|
|
182
|
+
expect(screen.getByTestId('toast-count')).toHaveTextContent('0');
|
|
183
|
+
|
|
164
184
|
const button = screen.getByText('Show Toast');
|
|
165
185
|
await user.click(button);
|
|
166
186
|
|
|
167
|
-
expect(
|
|
187
|
+
expect(screen.getByTestId('toast-count')).toHaveTextContent('1');
|
|
168
188
|
});
|
|
169
189
|
|
|
170
|
-
it('
|
|
190
|
+
it('dismisses toast when dismiss is called', async () => {
|
|
171
191
|
const user = userEvent.setup();
|
|
172
192
|
|
|
173
193
|
function TestComponent() {
|
|
174
|
-
const { dismiss } = useToast();
|
|
194
|
+
const { toast, dismiss, toasts } = useToast();
|
|
175
195
|
|
|
176
196
|
return (
|
|
177
|
-
<
|
|
197
|
+
<div>
|
|
198
|
+
<button onClick={() => toast({ title: 'Test Toast' })}>Show Toast</button>
|
|
199
|
+
<button onClick={() => dismiss()}>Dismiss</button>
|
|
200
|
+
<div data-testid="toast-count">{toasts.length}</div>
|
|
201
|
+
</div>
|
|
178
202
|
);
|
|
179
203
|
}
|
|
180
204
|
|
|
181
205
|
renderWithProviders(<TestComponent />);
|
|
182
206
|
|
|
183
|
-
const
|
|
184
|
-
await user.click(
|
|
207
|
+
const showButton = screen.getByText('Show Toast');
|
|
208
|
+
await user.click(showButton);
|
|
209
|
+
|
|
210
|
+
expect(screen.getByTestId('toast-count')).toHaveTextContent('1');
|
|
211
|
+
|
|
212
|
+
const dismissButton = screen.getByText('Dismiss');
|
|
213
|
+
await user.click(dismissButton);
|
|
185
214
|
|
|
186
|
-
|
|
215
|
+
// Toast should be marked as closed but still in array
|
|
216
|
+
expect(screen.getByTestId('toast-count')).toHaveTextContent('1');
|
|
187
217
|
});
|
|
188
218
|
});
|
|
189
219
|
|
|
@@ -89,6 +89,7 @@ import * as React from "react"
|
|
|
89
89
|
import * as ToastPrimitives from "@radix-ui/react-toast"
|
|
90
90
|
import { X } from "lucide-react"
|
|
91
91
|
import { cn } from "../../utils/cn"
|
|
92
|
+
import { useToast } from "../../hooks/useToast"
|
|
92
93
|
|
|
93
94
|
const ToastProvider = ToastPrimitives.Provider
|
|
94
95
|
|
|
@@ -268,45 +269,12 @@ export interface ToastProps extends React.ComponentPropsWithoutRef<typeof ToastP
|
|
|
268
269
|
|
|
269
270
|
export interface ToastActionElement extends React.ReactElement<typeof ToastAction> {}
|
|
270
271
|
|
|
271
|
-
// Simple useToast hook
|
|
272
|
-
/**
|
|
273
|
-
* useToast hook
|
|
274
|
-
* Hook for managing toast notifications
|
|
275
|
-
*
|
|
276
|
-
* @returns Object with toast and dismiss functions
|
|
277
|
-
*
|
|
278
|
-
* @example
|
|
279
|
-
* ```tsx
|
|
280
|
-
* const { toast, dismiss } = useToast();
|
|
281
|
-
*
|
|
282
|
-
* // Show a toast
|
|
283
|
-
* toast({
|
|
284
|
-
* title: "Success!",
|
|
285
|
-
* description: "Your changes have been saved."
|
|
286
|
-
* });
|
|
287
|
-
*
|
|
288
|
-
* // Dismiss all toasts
|
|
289
|
-
* dismiss();
|
|
290
|
-
* ```
|
|
291
|
-
*/
|
|
292
|
-
export function useToast() {
|
|
293
|
-
return {
|
|
294
|
-
toast: (props: any) => {
|
|
295
|
-
console.log('Toast:', props);
|
|
296
|
-
},
|
|
297
|
-
dismiss: () => {
|
|
298
|
-
console.log('Toast dismissed');
|
|
299
|
-
}
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
// Simple Toaster component
|
|
304
272
|
/**
|
|
305
273
|
* Toaster component
|
|
306
|
-
* Container component that
|
|
274
|
+
* Container component that renders actual toast notifications
|
|
307
275
|
* Should be placed at the root of your application
|
|
308
276
|
*
|
|
309
|
-
* @returns JSX.Element - The toast provider with viewport
|
|
277
|
+
* @returns JSX.Element - The toast provider with viewport and rendered toasts
|
|
310
278
|
*
|
|
311
279
|
* @example
|
|
312
280
|
* ```tsx
|
|
@@ -321,9 +289,19 @@ export function useToast() {
|
|
|
321
289
|
* ```
|
|
322
290
|
*/
|
|
323
291
|
export function Toaster() {
|
|
292
|
+
const { toasts } = useToast();
|
|
293
|
+
|
|
324
294
|
return (
|
|
325
295
|
<ToastProvider data-testid="toast-provider">
|
|
326
296
|
<ToastViewport />
|
|
297
|
+
{toasts.map((toast: any) => (
|
|
298
|
+
<Toast key={toast.id} {...toast}>
|
|
299
|
+
{toast.title && <ToastTitle>{toast.title}</ToastTitle>}
|
|
300
|
+
{toast.description && <ToastDescription>{toast.description}</ToastDescription>}
|
|
301
|
+
{toast.action && toast.action}
|
|
302
|
+
<ToastClose onClick={toast.dismiss} />
|
|
303
|
+
</Toast>
|
|
304
|
+
))}
|
|
327
305
|
</ToastProvider>
|
|
328
306
|
);
|
|
329
307
|
}
|
package/src/components/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -105,8 +105,8 @@ export {
|
|
|
105
105
|
ToastTitle,
|
|
106
106
|
ToastDescription,
|
|
107
107
|
ToastClose,
|
|
108
|
-
useToast,
|
|
109
108
|
} from './components/Toast/Toast';
|
|
109
|
+
export { useToast } from './hooks/useToast';
|
|
110
110
|
export type { ToastActionElement, ToastProps } from './components/Toast/Toast';
|
|
111
111
|
|
|
112
112
|
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, TooltipRoot } from './components/Tooltip/Tooltip';
|
|
@@ -205,7 +205,7 @@ describe('RBACEngine - Core Logic Tests', () => {
|
|
|
205
205
|
return Promise.resolve({
|
|
206
206
|
data: [
|
|
207
207
|
{
|
|
208
|
-
permission_type: 'read',
|
|
208
|
+
permission_type: 'read:page.organisation',
|
|
209
209
|
role_name: 'org_admin',
|
|
210
210
|
has_permission: true,
|
|
211
211
|
granted_at: '2023-01-01T00:00:00Z'
|
|
@@ -93,7 +93,7 @@ describe('RBACEngine - Simplified Tests', () => {
|
|
|
93
93
|
if (funcName === 'rbac_permissions_get') {
|
|
94
94
|
return Promise.resolve({
|
|
95
95
|
data: [{
|
|
96
|
-
permission_type: 'read',
|
|
96
|
+
permission_type: 'read:page.users',
|
|
97
97
|
resource_name: 'users',
|
|
98
98
|
role_name: 'org_admin',
|
|
99
99
|
has_permission: true,
|