tcce-design-system-test 0.3.41 → 0.3.42

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.
@@ -23,12 +23,15 @@ import { HTMLMotionProps } from 'motion/react';
23
23
  import { InputHTMLAttributes } from 'react';
24
24
  import { IStyledComponentBase } from 'styled-components/dist/types';
25
25
  import { JSX } from 'react/jsx-runtime';
26
+ import { JSXElementConstructor } from 'react';
26
27
  import { KeyboardEvent as KeyboardEvent_2 } from 'react';
27
28
  import { LabelHTMLAttributes } from 'react';
28
29
  import { MemoExoticComponent } from 'react';
29
30
  import { MouseEventHandler } from 'react';
30
31
  import { PropsWithChildren } from 'react';
32
+ import { ReactElement } from 'react';
31
33
  import { ReactNode } from 'react';
34
+ import { ReactPortal } from 'react';
32
35
  import { RefAttributes } from 'react';
33
36
  import { RefObject } from 'react';
34
37
  import { RemixiconComponentType } from '@remixicon/react';
@@ -44,6 +47,22 @@ import { toast } from 'sonner';
44
47
  import { ToasterProps } from 'sonner';
45
48
  import { Updater } from '@tanstack/react-table';
46
49
 
50
+ declare interface AbilityContextProps {
51
+ children: React.ReactNode;
52
+ initialAbilities?: UserAbilities;
53
+ user?: User;
54
+ }
55
+
56
+ export declare interface AbilityContextValue {
57
+ userAbilities: UserAbilities;
58
+ can: (requiredPermissions: string | string[], mode?: 'all' | 'any') => boolean;
59
+ updateAbilities: (abilities: UserAbilities) => void;
60
+ setAbilities: (abilities: UserAbilities) => void;
61
+ clearAbilities: () => void;
62
+ }
63
+
64
+ export declare const AbilityProvider: ({ children, initialAbilities, user }: AbilityContextProps) => JSX.Element;
65
+
47
66
  /**
48
67
  * Valid input types supported by the FormField component
49
68
  */
@@ -172,6 +191,15 @@ declare type ButtonSize = 'sm' | 'md' | 'lg';
172
191
 
173
192
  declare type ButtonVariant = 'primary' | 'secondary' | 'cancel' | 'outline';
174
193
 
194
+ export declare const Can: ({ requiredPermissions, mode, children, fallback }: CanProps) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | ReactPortal | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | JSX.Element | null;
195
+
196
+ export declare interface CanProps {
197
+ requiredPermissions: string | string[];
198
+ mode?: 'all' | 'any';
199
+ children: React.ReactNode;
200
+ fallback?: React.ReactNode;
201
+ }
202
+
175
203
  export declare const Card: ({ variant, size, disabled, onClick, children, ...props }: CardProps) => JSX.Element;
176
204
 
177
205
  export declare const CardBody: ({ children, showDivider, ...props }: CardBodyProps) => JSX.Element;
@@ -2077,6 +2105,13 @@ export declare interface TooltipProps {
2077
2105
  */
2078
2106
  export declare type TooltipTrigger = 'hover' | 'click';
2079
2107
 
2108
+ export declare const useAbility: () => AbilityContextValue;
2109
+
2110
+ /**
2111
+ * Hook for permission checking directly
2112
+ */
2113
+ export declare const useCan: (permissions: string | string[], mode?: "all" | "any") => boolean;
2114
+
2080
2115
  export declare const useColumnFilter: (columnId: string) => {
2081
2116
  selectedValues: string[];
2082
2117
  handleChange: (values: string[]) => void;
@@ -2107,6 +2142,10 @@ export declare interface User {
2107
2142
  permissions?: Permission[];
2108
2143
  }
2109
2144
 
2145
+ export declare interface UserAbilities {
2146
+ permissions: string[];
2147
+ }
2148
+
2110
2149
  /**
2111
2150
  * User menu item configuration
2112
2151
  * Defines a single item in the user profile dropdown menu.