@jmruthers/pace-core 0.5.139 → 0.5.141
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/{DataTable-JXFCA2BJ.js → DataTable-EGIN2NKK.js} +3 -3
- package/dist/{EventLogo-rFL_kRjk.d.ts → EventLogo-B3V3otev.d.ts} +307 -1
- package/dist/{chunk-BOOI7GK2.js → chunk-3R472UXR.js} +117 -1
- package/dist/chunk-3R472UXR.js.map +1 -0
- package/dist/{chunk-5JMOHWDI.js → chunk-ALUN6O3G.js} +492 -324
- package/dist/chunk-ALUN6O3G.js.map +1 -0
- package/dist/{chunk-6DXZ6V5Q.js → chunk-PZV3XZKJ.js} +2 -2
- package/dist/{chunk-TLT2ZR3L.js → chunk-WKTQM2IC.js} +2 -2
- package/dist/components.d.ts +3 -1
- package/dist/components.js +15 -3
- package/dist/components.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/dist/rbac/index.d.ts +94 -1
- package/dist/rbac/index.js +4 -2
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +17 -5
- package/dist/utils.js.map +1 -1
- package/docs/api/README.md +2 -2
- package/docs/api/classes/ColumnFactory.md +1 -1
- 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/enums/FileCategory.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/BadgeProps.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CalendarProps.md +40 -0
- 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/DataRecord.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/EventAppRoleData.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/ExportColumn.md +1 -1
- package/docs/api/interfaces/ExportOptions.md +1 -1
- package/docs/api/interfaces/FileDisplayProps.md +1 -1
- package/docs/api/interfaces/FileMetadata.md +1 -1
- package/docs/api/interfaces/FileReference.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/GrantEventAppRoleParams.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/ProtectedRouteProps.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/RBACLogger.md +1 -1
- package/docs/api/interfaces/ResourcePermissions.md +155 -0
- package/docs/api/interfaces/RevokeEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RoleManagementResult.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/SessionRestorationLoaderProps.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/SwitchProps.md +1 -1
- package/docs/api/interfaces/TabsContentProps.md +9 -0
- package/docs/api/interfaces/TabsListProps.md +9 -0
- package/docs/api/interfaces/TabsProps.md +9 -0
- package/docs/api/interfaces/TabsTriggerProps.md +9 -0
- package/docs/api/interfaces/TextareaProps.md +53 -0
- 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/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UseResourcePermissionsOptions.md +34 -0
- 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 +289 -2
- package/docs/getting-started/examples/basic-auth-app.md +196 -0
- package/docs/getting-started/examples/full-featured-app.md +616 -0
- package/package.json +3 -1
- package/src/components/Calendar/Calendar.test.tsx +338 -0
- package/src/components/Calendar/Calendar.tsx +192 -0
- package/src/components/Calendar/index.ts +10 -0
- package/src/components/Tabs/Tabs.test.tsx +439 -0
- package/src/components/Tabs/Tabs.tsx +202 -0
- package/src/components/Tabs/index.ts +10 -0
- package/src/components/Textarea/Textarea.test.tsx +269 -0
- package/src/components/Textarea/Textarea.tsx +133 -0
- package/src/components/Textarea/index.ts +10 -0
- package/src/components/index.ts +11 -0
- package/src/index.ts +11 -0
- package/src/rbac/hooks/index.ts +2 -0
- package/src/rbac/hooks/useResourcePermissions.test.ts +633 -0
- package/src/rbac/hooks/useResourcePermissions.ts +235 -0
- package/src/utils/performance/bundleAnalysis.ts +17 -3
- package/dist/chunk-5JMOHWDI.js.map +0 -1
- package/dist/chunk-BOOI7GK2.js.map +0 -1
- /package/dist/{DataTable-JXFCA2BJ.js.map → DataTable-EGIN2NKK.js.map} +0 -0
- /package/dist/{chunk-6DXZ6V5Q.js.map → chunk-PZV3XZKJ.js.map} +0 -0
- /package/dist/{chunk-TLT2ZR3L.js.map → chunk-WKTQM2IC.js.map} +0 -0
package/docs/api/modules.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
[@jmruthers/pace-core - v0.5.
|
|
1
|
+
[@jmruthers/pace-core - v0.5.141](README.md) / Exports
|
|
2
2
|
|
|
3
|
-
# @jmruthers/pace-core - v0.5.
|
|
3
|
+
# @jmruthers/pace-core - v0.5.141
|
|
4
4
|
|
|
5
5
|
**`File`**
|
|
6
6
|
|
|
@@ -54,6 +54,7 @@ import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';
|
|
|
54
54
|
|
|
55
55
|
- [BadgeProps](interfaces/BadgeProps.md)
|
|
56
56
|
- [ButtonProps](interfaces/ButtonProps.md)
|
|
57
|
+
- [CalendarProps](interfaces/CalendarProps.md)
|
|
57
58
|
- [CardProps](interfaces/CardProps.md)
|
|
58
59
|
- [DataTableProps](interfaces/DataTableProps.md)
|
|
59
60
|
- [DataRecord](interfaces/DataRecord.md)
|
|
@@ -85,6 +86,11 @@ import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';
|
|
|
85
86
|
- [PublicPageLayoutProps](interfaces/PublicPageLayoutProps.md)
|
|
86
87
|
- [SessionRestorationLoaderProps](interfaces/SessionRestorationLoaderProps.md)
|
|
87
88
|
- [SwitchProps](interfaces/SwitchProps.md)
|
|
89
|
+
- [TabsProps](interfaces/TabsProps.md)
|
|
90
|
+
- [TabsListProps](interfaces/TabsListProps.md)
|
|
91
|
+
- [TabsTriggerProps](interfaces/TabsTriggerProps.md)
|
|
92
|
+
- [TabsContentProps](interfaces/TabsContentProps.md)
|
|
93
|
+
- [TextareaProps](interfaces/TextareaProps.md)
|
|
88
94
|
- [ToastProps](interfaces/ToastProps.md)
|
|
89
95
|
- [ToastActionElement](interfaces/ToastActionElement.md)
|
|
90
96
|
- [UserMenuProps](interfaces/UserMenuProps.md)
|
|
@@ -119,6 +125,8 @@ import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';
|
|
|
119
125
|
- [RBACLogger](interfaces/RBACLogger.md)
|
|
120
126
|
- [UseResolvedScopeOptions](interfaces/UseResolvedScopeOptions.md)
|
|
121
127
|
- [UseResolvedScopeReturn](interfaces/UseResolvedScopeReturn.md)
|
|
128
|
+
- [UseResourcePermissionsOptions](interfaces/UseResourcePermissionsOptions.md)
|
|
129
|
+
- [ResourcePermissions](interfaces/ResourcePermissions.md)
|
|
122
130
|
- [EventAppRoleData](interfaces/EventAppRoleData.md)
|
|
123
131
|
- [RevokeEventAppRoleParams](interfaces/RevokeEventAppRoleParams.md)
|
|
124
132
|
- [GrantEventAppRoleParams](interfaces/GrantEventAppRoleParams.md)
|
|
@@ -192,6 +200,7 @@ import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';
|
|
|
192
200
|
- [AvatarFallback](modules.md#avatarfallback)
|
|
193
201
|
- [Badge](modules.md#badge)
|
|
194
202
|
- [Button](modules.md#button)
|
|
203
|
+
- [Calendar](modules.md#calendar)
|
|
195
204
|
- [Card](modules.md#card)
|
|
196
205
|
- [CardHeader](modules.md#cardheader)
|
|
197
206
|
- [CardTitle](modules.md#cardtitle)
|
|
@@ -272,6 +281,11 @@ import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';
|
|
|
272
281
|
- [TableHead](modules.md#tablehead)
|
|
273
282
|
- [TableCell](modules.md#tablecell)
|
|
274
283
|
- [TableCaption](modules.md#tablecaption)
|
|
284
|
+
- [Tabs](modules.md#tabs)
|
|
285
|
+
- [TabsList](modules.md#tabslist)
|
|
286
|
+
- [TabsTrigger](modules.md#tabstrigger)
|
|
287
|
+
- [TabsContent](modules.md#tabscontent)
|
|
288
|
+
- [Textarea](modules.md#textarea)
|
|
275
289
|
- [ToastProvider](modules.md#toastprovider)
|
|
276
290
|
- [ToastViewport](modules.md#toastviewport)
|
|
277
291
|
- [Toast](modules.md#toast)
|
|
@@ -368,6 +382,7 @@ import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';
|
|
|
368
382
|
- [useCachedPermissions](modules.md#usecachedpermissions)
|
|
369
383
|
- [useRBAC](modules.md#userbac)
|
|
370
384
|
- [useResolvedScope](modules.md#useresolvedscope)
|
|
385
|
+
- [useResourcePermissions](modules.md#useresourcepermissions)
|
|
371
386
|
- [useRoleManagement](modules.md#userolemanagement)
|
|
372
387
|
- [isValidPermission](modules.md#isvalidpermission)
|
|
373
388
|
- [getPermissionsForRole](modules.md#getpermissionsforrole)
|
|
@@ -1190,6 +1205,51 @@ A flexible, accessible button component with multiple variants and sizes.
|
|
|
1190
1205
|
|
|
1191
1206
|
___
|
|
1192
1207
|
|
|
1208
|
+
### Calendar
|
|
1209
|
+
|
|
1210
|
+
▸ **Calendar**(`props`): `ReactNode`
|
|
1211
|
+
|
|
1212
|
+
Calendar component
|
|
1213
|
+
A flexible, accessible calendar component for date selection.
|
|
1214
|
+
Built on react-day-picker with pace-core styling.
|
|
1215
|
+
|
|
1216
|
+
#### Parameters
|
|
1217
|
+
|
|
1218
|
+
| Name | Type | Description |
|
|
1219
|
+
| :------ | :------ | :------ |
|
|
1220
|
+
| `props` | [`CalendarProps`](interfaces/CalendarProps.md) & `RefAttributes`\<`HTMLDivElement`\> | Calendar configuration and styling |
|
|
1221
|
+
|
|
1222
|
+
#### Returns
|
|
1223
|
+
|
|
1224
|
+
`ReactNode`
|
|
1225
|
+
|
|
1226
|
+
JSX.Element - The rendered calendar element
|
|
1227
|
+
|
|
1228
|
+
**`Example`**
|
|
1229
|
+
|
|
1230
|
+
```tsx
|
|
1231
|
+
// Single date selection
|
|
1232
|
+
<Calendar
|
|
1233
|
+
mode="single"
|
|
1234
|
+
selected={date}
|
|
1235
|
+
onSelect={setDate}
|
|
1236
|
+
/>
|
|
1237
|
+
|
|
1238
|
+
// With disabled dates
|
|
1239
|
+
<Calendar
|
|
1240
|
+
mode="single"
|
|
1241
|
+
selected={date}
|
|
1242
|
+
onSelect={setDate}
|
|
1243
|
+
disabled={(date) => date < new Date()}
|
|
1244
|
+
/>
|
|
1245
|
+
```
|
|
1246
|
+
|
|
1247
|
+
#### Defined in
|
|
1248
|
+
|
|
1249
|
+
[packages/core/src/components/Calendar/Calendar.tsx:104](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/Calendar/Calendar.tsx#L104)
|
|
1250
|
+
|
|
1251
|
+
___
|
|
1252
|
+
|
|
1193
1253
|
### Card
|
|
1194
1254
|
|
|
1195
1255
|
▸ **Card**(`props`): `ReactNode`
|
|
@@ -3892,6 +3952,189 @@ ___
|
|
|
3892
3952
|
|
|
3893
3953
|
___
|
|
3894
3954
|
|
|
3955
|
+
### Tabs
|
|
3956
|
+
|
|
3957
|
+
▸ **Tabs**(`props`): `ReactNode`
|
|
3958
|
+
|
|
3959
|
+
Tabs root component
|
|
3960
|
+
Provides the context for tab navigation and state management
|
|
3961
|
+
|
|
3962
|
+
#### Parameters
|
|
3963
|
+
|
|
3964
|
+
| Name | Type |
|
|
3965
|
+
| :------ | :------ |
|
|
3966
|
+
| `props` | [`TabsProps`](interfaces/TabsProps.md) & `RefAttributes`\<`HTMLDivElement`\> |
|
|
3967
|
+
|
|
3968
|
+
#### Returns
|
|
3969
|
+
|
|
3970
|
+
`ReactNode`
|
|
3971
|
+
|
|
3972
|
+
**`Component`**
|
|
3973
|
+
|
|
3974
|
+
**`Example`**
|
|
3975
|
+
|
|
3976
|
+
```tsx
|
|
3977
|
+
<Tabs defaultValue="tab1">
|
|
3978
|
+
<TabsList>...</TabsList>
|
|
3979
|
+
<TabsContent value="tab1">...</TabsContent>
|
|
3980
|
+
</Tabs>
|
|
3981
|
+
```
|
|
3982
|
+
|
|
3983
|
+
#### Defined in
|
|
3984
|
+
|
|
3985
|
+
[packages/core/src/components/Tabs/Tabs.tsx:80](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/Tabs/Tabs.tsx#L80)
|
|
3986
|
+
|
|
3987
|
+
___
|
|
3988
|
+
|
|
3989
|
+
### TabsList
|
|
3990
|
+
|
|
3991
|
+
▸ **TabsList**(`props`): `ReactNode`
|
|
3992
|
+
|
|
3993
|
+
TabsList component
|
|
3994
|
+
Container for tab triggers
|
|
3995
|
+
|
|
3996
|
+
#### Parameters
|
|
3997
|
+
|
|
3998
|
+
| Name | Type |
|
|
3999
|
+
| :------ | :------ |
|
|
4000
|
+
| `props` | [`TabsListProps`](interfaces/TabsListProps.md) & `RefAttributes`\<`HTMLDivElement`\> |
|
|
4001
|
+
|
|
4002
|
+
#### Returns
|
|
4003
|
+
|
|
4004
|
+
`ReactNode`
|
|
4005
|
+
|
|
4006
|
+
**`Component`**
|
|
4007
|
+
|
|
4008
|
+
**`Example`**
|
|
4009
|
+
|
|
4010
|
+
```tsx
|
|
4011
|
+
<TabsList>
|
|
4012
|
+
<TabsTrigger value="tab1">Tab 1</TabsTrigger>
|
|
4013
|
+
<TabsTrigger value="tab2">Tab 2</TabsTrigger>
|
|
4014
|
+
</TabsList>
|
|
4015
|
+
```
|
|
4016
|
+
|
|
4017
|
+
#### Defined in
|
|
4018
|
+
|
|
4019
|
+
[packages/core/src/components/Tabs/Tabs.tsx:108](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/Tabs/Tabs.tsx#L108)
|
|
4020
|
+
|
|
4021
|
+
___
|
|
4022
|
+
|
|
4023
|
+
### TabsTrigger
|
|
4024
|
+
|
|
4025
|
+
▸ **TabsTrigger**(`props`): `ReactNode`
|
|
4026
|
+
|
|
4027
|
+
TabsTrigger component
|
|
4028
|
+
Individual tab button that activates a tab panel
|
|
4029
|
+
|
|
4030
|
+
#### Parameters
|
|
4031
|
+
|
|
4032
|
+
| Name | Type |
|
|
4033
|
+
| :------ | :------ |
|
|
4034
|
+
| `props` | [`TabsTriggerProps`](interfaces/TabsTriggerProps.md) & `RefAttributes`\<`HTMLButtonElement`\> |
|
|
4035
|
+
|
|
4036
|
+
#### Returns
|
|
4037
|
+
|
|
4038
|
+
`ReactNode`
|
|
4039
|
+
|
|
4040
|
+
**`Component`**
|
|
4041
|
+
|
|
4042
|
+
**`Example`**
|
|
4043
|
+
|
|
4044
|
+
```tsx
|
|
4045
|
+
<TabsTrigger value="tab1">Tab 1</TabsTrigger>
|
|
4046
|
+
|
|
4047
|
+
// With icon
|
|
4048
|
+
<TabsTrigger value="transport">
|
|
4049
|
+
<Plane size={16} /> Transport
|
|
4050
|
+
</TabsTrigger>
|
|
4051
|
+
```
|
|
4052
|
+
|
|
4053
|
+
#### Defined in
|
|
4054
|
+
|
|
4055
|
+
[packages/core/src/components/Tabs/Tabs.tsx:145](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/Tabs/Tabs.tsx#L145)
|
|
4056
|
+
|
|
4057
|
+
___
|
|
4058
|
+
|
|
4059
|
+
### TabsContent
|
|
4060
|
+
|
|
4061
|
+
▸ **TabsContent**(`props`): `ReactNode`
|
|
4062
|
+
|
|
4063
|
+
TabsContent component
|
|
4064
|
+
Container for tab panel content
|
|
4065
|
+
|
|
4066
|
+
#### Parameters
|
|
4067
|
+
|
|
4068
|
+
| Name | Type |
|
|
4069
|
+
| :------ | :------ |
|
|
4070
|
+
| `props` | [`TabsContentProps`](interfaces/TabsContentProps.md) & `RefAttributes`\<`HTMLDivElement`\> |
|
|
4071
|
+
|
|
4072
|
+
#### Returns
|
|
4073
|
+
|
|
4074
|
+
`ReactNode`
|
|
4075
|
+
|
|
4076
|
+
**`Component`**
|
|
4077
|
+
|
|
4078
|
+
**`Example`**
|
|
4079
|
+
|
|
4080
|
+
```tsx
|
|
4081
|
+
<TabsContent value="tab1">
|
|
4082
|
+
<div>Content for tab 1</div>
|
|
4083
|
+
</TabsContent>
|
|
4084
|
+
```
|
|
4085
|
+
|
|
4086
|
+
#### Defined in
|
|
4087
|
+
|
|
4088
|
+
[packages/core/src/components/Tabs/Tabs.tsx:181](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/Tabs/Tabs.tsx#L181)
|
|
4089
|
+
|
|
4090
|
+
___
|
|
4091
|
+
|
|
4092
|
+
### Textarea
|
|
4093
|
+
|
|
4094
|
+
▸ **Textarea**(`props`): `ReactNode`
|
|
4095
|
+
|
|
4096
|
+
Textarea component
|
|
4097
|
+
A flexible, accessible textarea component with multiple variants and sizes.
|
|
4098
|
+
Matches the Input component API and styling for consistency.
|
|
4099
|
+
|
|
4100
|
+
#### Parameters
|
|
4101
|
+
|
|
4102
|
+
| Name | Type | Description |
|
|
4103
|
+
| :------ | :------ | :------ |
|
|
4104
|
+
| `props` | [`TextareaProps`](interfaces/TextareaProps.md) & `RefAttributes`\<`HTMLTextAreaElement`\> | Textarea configuration and styling |
|
|
4105
|
+
|
|
4106
|
+
#### Returns
|
|
4107
|
+
|
|
4108
|
+
`ReactNode`
|
|
4109
|
+
|
|
4110
|
+
JSX.Element - The rendered textarea element
|
|
4111
|
+
|
|
4112
|
+
**`Example`**
|
|
4113
|
+
|
|
4114
|
+
```tsx
|
|
4115
|
+
// Basic textarea
|
|
4116
|
+
<Textarea placeholder="Enter your message..." />
|
|
4117
|
+
|
|
4118
|
+
// Textarea with error state
|
|
4119
|
+
<Textarea
|
|
4120
|
+
placeholder="Comments"
|
|
4121
|
+
error={true}
|
|
4122
|
+
/>
|
|
4123
|
+
|
|
4124
|
+
// Large textarea with destructive variant
|
|
4125
|
+
<Textarea
|
|
4126
|
+
variant="destructive"
|
|
4127
|
+
size="lg"
|
|
4128
|
+
placeholder="Error textarea"
|
|
4129
|
+
/>
|
|
4130
|
+
```
|
|
4131
|
+
|
|
4132
|
+
#### Defined in
|
|
4133
|
+
|
|
4134
|
+
[packages/core/src/components/Textarea/Textarea.tsx:96](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/Textarea/Textarea.tsx#L96)
|
|
4135
|
+
|
|
4136
|
+
___
|
|
4137
|
+
|
|
3895
4138
|
### ToastProvider
|
|
3896
4139
|
|
|
3897
4140
|
▸ **ToastProvider**(`props`, `deprecatedLegacyContext?`): `ReactNode`
|
|
@@ -6757,6 +7000,50 @@ const permission = useCan(userId, resolvedScope, permission);
|
|
|
6757
7000
|
|
|
6758
7001
|
___
|
|
6759
7002
|
|
|
7003
|
+
### useResourcePermissions
|
|
7004
|
+
|
|
7005
|
+
▸ **useResourcePermissions**(`resource`, `options?`): [`ResourcePermissions`](interfaces/ResourcePermissions.md)
|
|
7006
|
+
|
|
7007
|
+
Hook to check permissions for a specific resource
|
|
7008
|
+
|
|
7009
|
+
This hook encapsulates the common pattern of checking create/update/delete/read
|
|
7010
|
+
permissions for a resource type. It handles scope resolution, user context,
|
|
7011
|
+
and provides a simple API for permission checking.
|
|
7012
|
+
|
|
7013
|
+
#### Parameters
|
|
7014
|
+
|
|
7015
|
+
| Name | Type | Description |
|
|
7016
|
+
| :------ | :------ | :------ |
|
|
7017
|
+
| `resource` | `string` | The resource name (e.g., 'contacts', 'risks', 'journal') |
|
|
7018
|
+
| `options` | [`UseResourcePermissionsOptions`](interfaces/UseResourcePermissionsOptions.md) | Optional configuration |
|
|
7019
|
+
|
|
7020
|
+
#### Returns
|
|
7021
|
+
|
|
7022
|
+
[`ResourcePermissions`](interfaces/ResourcePermissions.md)
|
|
7023
|
+
|
|
7024
|
+
Object with permission check functions and scope
|
|
7025
|
+
|
|
7026
|
+
**`Example`**
|
|
7027
|
+
|
|
7028
|
+
```tsx
|
|
7029
|
+
function useContacts() {
|
|
7030
|
+
const { canCreate, canUpdate, canDelete } = useResourcePermissions('contacts');
|
|
7031
|
+
|
|
7032
|
+
const addContact = async (data: ContactData) => {
|
|
7033
|
+
if (!canCreate('contacts')) {
|
|
7034
|
+
throw new Error("Permission denied");
|
|
7035
|
+
}
|
|
7036
|
+
// ... perform mutation
|
|
7037
|
+
};
|
|
7038
|
+
}
|
|
7039
|
+
```
|
|
7040
|
+
|
|
7041
|
+
#### Defined in
|
|
7042
|
+
|
|
7043
|
+
[packages/core/src/rbac/hooks/useResourcePermissions.ts:102](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/rbac/hooks/useResourcePermissions.ts#L102)
|
|
7044
|
+
|
|
7045
|
+
___
|
|
7046
|
+
|
|
6760
7047
|
### useRoleManagement
|
|
6761
7048
|
|
|
6762
7049
|
▸ **useRoleManagement**(): `Object`
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Basic Authentication App
|
|
2
|
+
|
|
3
|
+
A minimal PACE Core application showing just authentication and basic UI components.
|
|
4
|
+
|
|
5
|
+
## 🎯 What This Example Shows
|
|
6
|
+
|
|
7
|
+
- Basic authentication setup
|
|
8
|
+
- Simple login/logout flow
|
|
9
|
+
- Basic dashboard with cards
|
|
10
|
+
- Responsive navigation
|
|
11
|
+
- Minimal code structure
|
|
12
|
+
|
|
13
|
+
## 📁 Project Structure
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
src/
|
|
17
|
+
├── App.tsx # Main app with providers
|
|
18
|
+
├── lib/
|
|
19
|
+
│ └── supabase.ts # Supabase client
|
|
20
|
+
├── components/
|
|
21
|
+
│ ├── LoginPage.tsx # Login form
|
|
22
|
+
│ ├── Dashboard.tsx # Simple dashboard
|
|
23
|
+
│ └── Navigation.tsx # Basic navigation
|
|
24
|
+
└── main.tsx # App entry point
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 🚀 Implementation
|
|
28
|
+
|
|
29
|
+
### 1. App.tsx - Main Application
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { UnifiedAuthProvider } from '@jmruthers/pace-core';
|
|
33
|
+
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
|
34
|
+
import { supabase } from './lib/supabase';
|
|
35
|
+
import { LoginPage } from './components/LoginPage';
|
|
36
|
+
import { Dashboard } from './components/Dashboard';
|
|
37
|
+
|
|
38
|
+
function App() {
|
|
39
|
+
return (
|
|
40
|
+
<UnifiedAuthProvider
|
|
41
|
+
supabaseClient={supabase}
|
|
42
|
+
appName="basic-auth-app"
|
|
43
|
+
>
|
|
44
|
+
<BrowserRouter>
|
|
45
|
+
<Routes>
|
|
46
|
+
<Route path="/login" element={<LoginPage />} />
|
|
47
|
+
<Route path="/" element={<Dashboard />} />
|
|
48
|
+
</Routes>
|
|
49
|
+
</BrowserRouter>
|
|
50
|
+
</UnifiedAuthProvider>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default App;
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 2. lib/supabase.ts - Supabase Client
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { createClient } from '@supabase/supabase-js';
|
|
61
|
+
|
|
62
|
+
const supabaseUrl = process.env.REACT_APP_SUPABASE_URL!;
|
|
63
|
+
const supabaseAnonKey = process.env.REACT_APP_SUPABASE_ANON_KEY!;
|
|
64
|
+
|
|
65
|
+
export const supabase = createClient(supabaseUrl, supabaseAnonKey);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 3. components/LoginPage.tsx - Login Form
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import { LoginForm, Card, CardHeader, CardTitle, CardContent } from '@jmruthers/pace-core';
|
|
72
|
+
import { useNavigate } from 'react-router-dom';
|
|
73
|
+
|
|
74
|
+
export function LoginPage() {
|
|
75
|
+
const navigate = useNavigate();
|
|
76
|
+
|
|
77
|
+
const handleLoginSuccess = () => {
|
|
78
|
+
navigate('/');
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<div className="min-h-screen flex items-center justify-center bg-sec-50">
|
|
83
|
+
<Card className="w-full max-w-md">
|
|
84
|
+
<CardHeader>
|
|
85
|
+
<CardTitle className="text-center">Welcome Back</CardTitle>
|
|
86
|
+
</CardHeader>
|
|
87
|
+
<CardContent>
|
|
88
|
+
<LoginForm onLoginSuccess={handleLoginSuccess} />
|
|
89
|
+
</CardContent>
|
|
90
|
+
</Card>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 4. components/Dashboard.tsx - Simple Dashboard
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
import { Card, CardHeader, CardTitle, CardContent, Button } from '@jmruthers/pace-core';
|
|
100
|
+
import { useUnifiedAuth } from '@jmruthers/pace-core';
|
|
101
|
+
import { useNavigate } from 'react-router-dom';
|
|
102
|
+
|
|
103
|
+
export function Dashboard() {
|
|
104
|
+
const { user, signOut } = useUnifiedAuth();
|
|
105
|
+
const navigate = useNavigate();
|
|
106
|
+
|
|
107
|
+
const handleSignOut = async () => {
|
|
108
|
+
await signOut();
|
|
109
|
+
navigate('/login');
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<div className="min-h-screen bg-sec-50 p-6">
|
|
114
|
+
<div className="max-w-4xl mx-auto">
|
|
115
|
+
{/* Header */}
|
|
116
|
+
<div className="flex justify-between items-center mb-8">
|
|
117
|
+
<h1 className="text-3xl font-bold text-sec-900">Dashboard</h1>
|
|
118
|
+
<div className="flex items-center gap-4">
|
|
119
|
+
<span className="text-sec-600">Welcome, {user?.email}</span>
|
|
120
|
+
<Button variant="outline" onClick={handleSignOut}>
|
|
121
|
+
Sign Out
|
|
122
|
+
</Button>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
{/* Content Cards */}
|
|
127
|
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
128
|
+
<Card>
|
|
129
|
+
<CardHeader>
|
|
130
|
+
<CardTitle>Getting Started</CardTitle>
|
|
131
|
+
</CardHeader>
|
|
132
|
+
<CardContent>
|
|
133
|
+
<p className="text-sec-600">
|
|
134
|
+
Welcome to your PACE Core application! This is a basic example showing authentication and UI components.
|
|
135
|
+
</p>
|
|
136
|
+
</CardContent>
|
|
137
|
+
</Card>
|
|
138
|
+
|
|
139
|
+
<Card>
|
|
140
|
+
<CardHeader>
|
|
141
|
+
<CardTitle>Next Steps</CardTitle>
|
|
142
|
+
</CardHeader>
|
|
143
|
+
<CardContent>
|
|
144
|
+
<p className="text-sec-600">
|
|
145
|
+
Explore the examples to learn about DataTables, forms, navigation, and more advanced features.
|
|
146
|
+
</p>
|
|
147
|
+
</CardContent>
|
|
148
|
+
</Card>
|
|
149
|
+
|
|
150
|
+
<Card>
|
|
151
|
+
<CardHeader>
|
|
152
|
+
<CardTitle>Resources</CardTitle>
|
|
153
|
+
</CardHeader>
|
|
154
|
+
<CardContent>
|
|
155
|
+
<p className="text-sec-600">
|
|
156
|
+
Check out the documentation for implementation guides, API reference, and best practices.
|
|
157
|
+
</p>
|
|
158
|
+
</CardContent>
|
|
159
|
+
</Card>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## 🔧 Environment Setup
|
|
168
|
+
|
|
169
|
+
Create `.env.local`:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
REACT_APP_SUPABASE_URL=https://your-project.supabase.co
|
|
173
|
+
REACT_APP_SUPABASE_ANON_KEY=your-anon-key-here
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## 🎉 What You Get
|
|
177
|
+
|
|
178
|
+
- ✅ User authentication with Supabase
|
|
179
|
+
- ✅ Protected dashboard route
|
|
180
|
+
- ✅ Responsive UI components
|
|
181
|
+
- ✅ Clean, minimal code structure
|
|
182
|
+
- ✅ Easy to extend and customize
|
|
183
|
+
|
|
184
|
+
## 🚀 Next Steps
|
|
185
|
+
|
|
186
|
+
- **Add more features** - Forms, data tables, navigation
|
|
187
|
+
- **Implement RBAC** - Role-based access control
|
|
188
|
+
- **Add organisation support** - Multi-tenant features
|
|
189
|
+
- **Explore components** - See all available UI components
|
|
190
|
+
|
|
191
|
+
## 📚 Related Documentation
|
|
192
|
+
|
|
193
|
+
- **[Quick Start](../quick-start.md)** - Build a full-featured app
|
|
194
|
+
- **[Core Concepts](../core-concepts/)** - Understand authentication and RBAC
|
|
195
|
+
- **[API Reference](../api-reference/)** - Explore all components and hooks
|
|
196
|
+
- **[Implementation Guides](../implementation-guides/)** - Advanced patterns
|