import React from 'react'; import { P as Permission, R as Role } from '../index-CEh-y2dx.mjs'; interface PermissionGateProps { children: React.ReactNode; /** * Single permission to check */ permission?: Permission; /** * Multiple permissions to check */ permissions?: Permission[]; /** * User's permissions (pass from session or context) */ userPermissions: Permission[]; /** * If true, user must have ALL permissions. If false, user needs ANY permission. * @default false */ requireAll?: boolean; /** * Fallback content to render if permission check fails * @default null */ fallback?: React.ReactNode; } /** * Component that renders children only if user has required permissions * * @example * ```tsx * // Server Component * import { PermissionGate } from '@yourusername/next-rbac/react'; * import { auth } from '@/auth'; * import { getUserPermissions } from '@/lib/rbac'; * * export default async function Page() { * const session = await auth(); * const permissions = await getUserPermissions(session.user.id); * * return ( * * * * ); * } * ``` * * @example * ```tsx * // Client Component with Context * 'use client'; * import { PermissionGate } from '@yourusername/next-rbac/react'; * import { usePermissions } from './hooks'; * * export function MyComponent() { * const { permissions } = usePermissions(); * * return ( * * * * ); * } * ``` */ declare function PermissionGate({ children, permission, permissions, userPermissions, requireAll, fallback, }: PermissionGateProps): React.JSX.Element; interface RoleGateProps { children: React.ReactNode; /** * Single role to check */ role?: Role; /** * Multiple roles to check */ roles?: Role[]; /** * User's role (pass from session or context) */ userRole: Role | null; /** * Fallback content to render if role check fails * @default null */ fallback?: React.ReactNode; } /** * Component that renders children only if user has required role * * @example * ```tsx * // Server Component * import { RoleGate } from '@yourusername/next-rbac/react'; * import { auth } from '@/auth'; * * export default async function Page() { * const session = await auth(); * * return ( * * * * ); * } * ``` * * @example * ```tsx * // Client Component * 'use client'; * import { RoleGate } from '@yourusername/next-rbac/react'; * import { useSession } from 'next-auth/react'; * * export function MyComponent() { * const { data: session } = useSession(); * * return ( * * * * ); * } * ``` */ declare function RoleGate({ children, role, roles, userRole, fallback, }: RoleGateProps): React.JSX.Element; export { PermissionGate, RoleGate };