@true-tech-team/react-components 0.0.3 → 0.0.4

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.
Files changed (41) hide show
  1. package/index.css +1 -1
  2. package/index.d.ts +2 -0
  3. package/index.js +1 -1
  4. package/index.mjs +5047 -3543
  5. package/lib/components/buttons/Button/Button.d.ts +14 -3
  6. package/lib/components/display/Accordion/Accordion.d.ts +112 -0
  7. package/lib/components/display/Accordion/AccordionContainer.d.ts +101 -0
  8. package/lib/components/display/Accordion/AccordionContext.d.ts +57 -0
  9. package/lib/components/display/Accordion/index.d.ts +6 -0
  10. package/lib/components/display/Avatar/Avatar.d.ts +1 -1
  11. package/lib/components/display/Card/Card.d.ts +101 -0
  12. package/lib/components/display/Card/index.d.ts +3 -0
  13. package/lib/components/display/Carousel/Carousel.d.ts +125 -0
  14. package/lib/components/display/Carousel/index.d.ts +3 -0
  15. package/lib/components/display/Collapse/Collapse.d.ts +57 -0
  16. package/lib/components/display/Collapse/index.d.ts +2 -0
  17. package/lib/components/display/CountUp/CountUp.d.ts +119 -0
  18. package/lib/components/display/CountUp/index.d.ts +3 -0
  19. package/lib/components/display/FlipCard/FlipCard.d.ts +125 -0
  20. package/lib/components/display/FlipCard/index.d.ts +3 -0
  21. package/lib/components/display/Icon/index.d.ts +1 -0
  22. package/lib/components/display/PageMessages/PageMessageContent.d.ts +19 -0
  23. package/lib/components/display/PageMessages/PageMessages.d.ts +49 -0
  24. package/lib/components/display/PageMessages/defaultConfigs.d.ts +5 -0
  25. package/lib/components/display/PageMessages/index.d.ts +3 -0
  26. package/lib/components/display/PageMessages/types.d.ts +175 -0
  27. package/lib/components/display/ProgressBar/ProgressBar.d.ts +11 -0
  28. package/lib/components/display/Reveal/Reveal.d.ts +109 -0
  29. package/lib/components/display/Reveal/index.d.ts +3 -0
  30. package/lib/components/display/Spinner/Spinner.d.ts +79 -0
  31. package/lib/components/display/Spinner/index.d.ts +3 -0
  32. package/lib/components/display/StatusIndicator/StatusIndicator.d.ts +1 -1
  33. package/lib/components/index.d.ts +21 -0
  34. package/lib/components/inputs/Toggle/Toggle.d.ts +5 -0
  35. package/lib/components/overlays/LoadingOverlay/LoadingOverlay.d.ts +101 -0
  36. package/lib/components/overlays/LoadingOverlay/index.d.ts +3 -0
  37. package/lib/contexts/PageMessagesContext/PageMessagesContext.d.ts +91 -0
  38. package/lib/contexts/PageMessagesContext/index.d.ts +2 -0
  39. package/lib/contexts/index.d.ts +2 -0
  40. package/lib/providers/GlobalProvider/GlobalProvider.d.ts +6 -1
  41. package/package.json +1 -1
@@ -0,0 +1,119 @@
1
+ import { default as React } from 'react';
2
+ import { BaseComponentProps, ComponentSize } from '../../../types/component.types';
3
+ /**
4
+ * Easing functions for animation
5
+ */
6
+ export type EasingFunction = 'linear' | 'easeOut' | 'easeIn' | 'easeInOut' | 'easeOutCubic' | 'easeInCubic' | 'easeOutExpo';
7
+ /**
8
+ * Props for the CountUp component
9
+ */
10
+ export interface CountUpProps extends Omit<BaseComponentProps, 'children'> {
11
+ /**
12
+ * Target value to count to
13
+ */
14
+ value: number;
15
+ /**
16
+ * Starting value
17
+ * @default 0
18
+ */
19
+ start?: number;
20
+ /**
21
+ * Animation duration in milliseconds
22
+ * @default 2000
23
+ */
24
+ duration?: number;
25
+ /**
26
+ * Easing function for animation
27
+ * @default 'easeOutCubic'
28
+ */
29
+ easing?: EasingFunction;
30
+ /**
31
+ * Prefix to display before the number
32
+ */
33
+ prefix?: string;
34
+ /**
35
+ * Suffix to display after the number
36
+ */
37
+ suffix?: string;
38
+ /**
39
+ * Number of decimal places
40
+ * @default 0
41
+ */
42
+ decimals?: number;
43
+ /**
44
+ * Thousands separator
45
+ * @default ','
46
+ */
47
+ separator?: string;
48
+ /**
49
+ * Decimal separator
50
+ * @default '.'
51
+ */
52
+ decimalSeparator?: string;
53
+ /**
54
+ * Whether to start animation when element becomes visible
55
+ * @default true
56
+ */
57
+ triggerOnVisible?: boolean;
58
+ /**
59
+ * Visibility threshold (0-1) for Intersection Observer
60
+ * @default 0.1
61
+ */
62
+ visibilityThreshold?: number;
63
+ /**
64
+ * Callback when animation starts
65
+ */
66
+ onStart?: () => void;
67
+ /**
68
+ * Callback when animation ends
69
+ */
70
+ onEnd?: () => void;
71
+ /**
72
+ * Custom format function
73
+ */
74
+ formatFn?: (value: number) => string;
75
+ /**
76
+ * Size of the component
77
+ * @default 'md'
78
+ */
79
+ size?: ComponentSize;
80
+ /**
81
+ * Whether to start animation immediately (if triggerOnVisible is false)
82
+ * @default true
83
+ */
84
+ autoStart?: boolean;
85
+ /**
86
+ * Delay before starting animation (ms)
87
+ * @default 0
88
+ */
89
+ delay?: number;
90
+ }
91
+ /**
92
+ * CountUp - Animated number counting component
93
+ *
94
+ * @example
95
+ * ```tsx
96
+ * <CountUp value={1000} />
97
+ * ```
98
+ *
99
+ * @example
100
+ * ```tsx
101
+ * <CountUp
102
+ * value={1234.56}
103
+ * prefix="$"
104
+ * decimals={2}
105
+ * duration={3000}
106
+ * />
107
+ * ```
108
+ *
109
+ * @example
110
+ * ```tsx
111
+ * <CountUp
112
+ * value={99}
113
+ * suffix="%"
114
+ * easing="easeOutExpo"
115
+ * />
116
+ * ```
117
+ */
118
+ export declare const CountUp: React.ForwardRefExoticComponent<CountUpProps & React.RefAttributes<HTMLSpanElement>>;
119
+ export default CountUp;
@@ -0,0 +1,3 @@
1
+ export { CountUp } from './CountUp';
2
+ export type { CountUpProps, EasingFunction } from './CountUp';
3
+ export { default } from './CountUp';
@@ -0,0 +1,125 @@
1
+ import { default as React, ReactNode } from 'react';
2
+ import { BaseComponentProps } from '../../../types/component.types';
3
+ /**
4
+ * Direction of the flip animation
5
+ */
6
+ export type FlipDirection = 'horizontal' | 'vertical';
7
+ /**
8
+ * How the flip is triggered
9
+ */
10
+ export type FlipTrigger = 'click' | 'hover' | 'manual';
11
+ /**
12
+ * Props for the FlipCard component
13
+ */
14
+ export interface FlipCardProps extends Omit<BaseComponentProps, 'children'> {
15
+ /**
16
+ * Content for the front face of the card
17
+ */
18
+ front: ReactNode;
19
+ /**
20
+ * Content for the back face of the card
21
+ */
22
+ back: ReactNode;
23
+ /**
24
+ * Whether the card is flipped (controlled mode)
25
+ */
26
+ isFlipped?: boolean;
27
+ /**
28
+ * Default flipped state (uncontrolled mode)
29
+ * @default false
30
+ */
31
+ defaultFlipped?: boolean;
32
+ /**
33
+ * Callback when flip state changes
34
+ */
35
+ onFlipChange?: (isFlipped: boolean) => void;
36
+ /**
37
+ * How the flip is triggered
38
+ * @default 'click'
39
+ */
40
+ flipTrigger?: FlipTrigger;
41
+ /**
42
+ * Direction of the flip animation
43
+ * @default 'horizontal'
44
+ */
45
+ flipDirection?: FlipDirection;
46
+ /**
47
+ * Animation duration in milliseconds
48
+ * @default 600
49
+ */
50
+ duration?: number;
51
+ /**
52
+ * CSS easing function
53
+ * @default 'ease-in-out'
54
+ */
55
+ easing?: string;
56
+ /**
57
+ * Callback when flip animation starts
58
+ */
59
+ onFlipStart?: (toFlipped: boolean) => void;
60
+ /**
61
+ * Callback when flip animation ends
62
+ */
63
+ onFlipEnd?: (isFlipped: boolean) => void;
64
+ /**
65
+ * Whether the card is disabled (no flip interaction)
66
+ * @default false
67
+ */
68
+ disabled?: boolean;
69
+ /**
70
+ * Fixed height for the card (required for 3D perspective)
71
+ */
72
+ height?: string | number;
73
+ /**
74
+ * Fixed width for the card
75
+ */
76
+ width?: string | number;
77
+ /**
78
+ * Perspective distance for 3D effect
79
+ * @default 1000
80
+ */
81
+ perspective?: number;
82
+ /**
83
+ * ARIA label for the flip action (accessibility)
84
+ * @default 'Flip card'
85
+ */
86
+ flipButtonAriaLabel?: string;
87
+ }
88
+ /**
89
+ * FlipCard - An animated card component that flips to reveal back content
90
+ *
91
+ * @example
92
+ * ```tsx
93
+ * <FlipCard
94
+ * front={<div>Front content</div>}
95
+ * back={<div>Back content</div>}
96
+ * height={200}
97
+ * width={300}
98
+ * />
99
+ * ```
100
+ *
101
+ * @example
102
+ * ```tsx
103
+ * // Controlled mode
104
+ * const [isFlipped, setIsFlipped] = useState(false);
105
+ * <FlipCard
106
+ * front={<div>Front</div>}
107
+ * back={<div>Back</div>}
108
+ * isFlipped={isFlipped}
109
+ * onFlipChange={setIsFlipped}
110
+ * flipTrigger="manual"
111
+ * />
112
+ * ```
113
+ *
114
+ * @example
115
+ * ```tsx
116
+ * // Hover to flip
117
+ * <FlipCard
118
+ * front={<div>Hover me</div>}
119
+ * back={<div>Back side</div>}
120
+ * flipTrigger="hover"
121
+ * />
122
+ * ```
123
+ */
124
+ export declare const FlipCard: React.ForwardRefExoticComponent<FlipCardProps & React.RefAttributes<HTMLDivElement>>;
125
+ export default FlipCard;
@@ -0,0 +1,3 @@
1
+ export { FlipCard } from './FlipCard';
2
+ export type { FlipCardProps, FlipDirection, FlipTrigger } from './FlipCard';
3
+ export { default } from './FlipCard';
@@ -1,3 +1,4 @@
1
1
  export { Icon } from './Icon';
2
2
  export type { IconProps } from './Icon';
3
3
  export { default } from './Icon';
4
+ export type { IconName } from './icons';
@@ -0,0 +1,19 @@
1
+ import { ExtendedComponentSize } from '../../../types/component.types';
2
+ import { PageMessageState, PageMessageStateConfig, LoadingStateConfig } from './types';
3
+ import { PageMessagesGlobalActions } from '../../../contexts/PageMessagesContext';
4
+ export interface PageMessageContentProps {
5
+ /** The active page message state */
6
+ state: PageMessageState;
7
+ /** Configuration for the state */
8
+ config: PageMessageStateConfig | LoadingStateConfig;
9
+ /** Size variant */
10
+ size: ExtendedComponentSize;
11
+ /** Error message (extracted from error prop) */
12
+ errorMessage?: string;
13
+ /** Global actions from context */
14
+ actions: PageMessagesGlobalActions;
15
+ }
16
+ /**
17
+ * Internal component that renders the page message content
18
+ */
19
+ export declare function PageMessageContent({ state, config, size, errorMessage, actions, }: PageMessageContentProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,49 @@
1
+ import { default as React } from 'react';
2
+ import { PageMessagesProps } from './types';
3
+ /**
4
+ * PageMessages - Handles page-level states like loading, error, forbidden, etc.
5
+ *
6
+ * States are displayed based on priority (loading > error > forbidden > etc.)
7
+ * When no state is active, children are rendered directly without any wrapper.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * // Basic usage
12
+ * <PageMessages loading={isLoading} error={error}>
13
+ * <MyContent />
14
+ * </PageMessages>
15
+ * ```
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * // With custom configuration
20
+ * <PageMessages
21
+ * empty={items.length === 0}
22
+ * emptyConfig={{
23
+ * title: 'No items yet',
24
+ * description: 'Create your first item to get started',
25
+ * primaryAction: {
26
+ * label: 'Create Item',
27
+ * onClick: handleCreate,
28
+ * },
29
+ * }}
30
+ * >
31
+ * <ItemList items={items} />
32
+ * </PageMessages>
33
+ * ```
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * // With custom renderer
38
+ * <PageMessages
39
+ * error={error}
40
+ * errorConfig={{
41
+ * render: () => <CustomErrorPage error={error} />,
42
+ * }}
43
+ * >
44
+ * <Dashboard />
45
+ * </PageMessages>
46
+ * ```
47
+ */
48
+ export declare const PageMessages: React.ForwardRefExoticComponent<PageMessagesProps & React.RefAttributes<HTMLDivElement>>;
49
+ export default PageMessages;
@@ -0,0 +1,5 @@
1
+ import { PageMessagesDefaults } from '../../../contexts/PageMessagesContext';
2
+ /**
3
+ * Built-in default configurations for all page message states
4
+ */
5
+ export declare const DEFAULT_CONFIGS: Required<PageMessagesDefaults>;
@@ -0,0 +1,3 @@
1
+ export { PageMessages } from './PageMessages';
2
+ export type { PageMessagesProps, PageMessageState, PageMessageStateConfig, PageMessageAction, LoadingStateConfig, } from './types';
3
+ export { getActiveState } from './types';
@@ -0,0 +1,175 @@
1
+ import { ReactNode } from 'react';
2
+ import { BaseComponentProps, ExtendedComponentSize } from '../../../types/component.types';
3
+ import { IconName } from '../Icon/icons';
4
+ import { SpinnerProps } from '../Spinner';
5
+ import { ButtonProps } from '../../buttons/Button';
6
+ /**
7
+ * Available page message state types
8
+ */
9
+ export type PageMessageState = 'loading' | 'error' | 'forbidden' | 'not-found' | 'empty' | 'maintenance' | 'offline' | 'unauthorized' | 'timeout';
10
+ /**
11
+ * Action button configuration for page messages
12
+ */
13
+ export interface PageMessageAction {
14
+ /** Button label */
15
+ label: string;
16
+ /** Click handler */
17
+ onClick: () => void;
18
+ /** Button variant */
19
+ variant?: ButtonProps['variant'];
20
+ /** Loading state for the button */
21
+ loading?: boolean;
22
+ /** Icon to display */
23
+ icon?: IconName | ReactNode;
24
+ }
25
+ /**
26
+ * Configuration for a single page message state
27
+ */
28
+ export interface PageMessageStateConfig {
29
+ /** Title text displayed prominently */
30
+ title?: string;
31
+ /** Description or subtitle text */
32
+ description?: string;
33
+ /** Icon name from registry or custom ReactNode */
34
+ icon?: IconName | ReactNode;
35
+ /** Primary action button */
36
+ primaryAction?: PageMessageAction;
37
+ /** Secondary action button */
38
+ secondaryAction?: PageMessageAction;
39
+ /** Custom render function for complete control */
40
+ render?: () => ReactNode;
41
+ }
42
+ /**
43
+ * Props for loading state specifically
44
+ */
45
+ export interface LoadingStateConfig extends Omit<PageMessageStateConfig, 'icon'> {
46
+ /** Spinner props passthrough */
47
+ spinnerProps?: Partial<SpinnerProps>;
48
+ /** Whether to show text alongside spinner */
49
+ showText?: boolean;
50
+ }
51
+ /**
52
+ * Props for the PageMessages component
53
+ */
54
+ export interface PageMessagesProps extends BaseComponentProps {
55
+ /**
56
+ * Whether the page is in loading state
57
+ * Priority: 1 (highest)
58
+ */
59
+ loading?: boolean;
60
+ /**
61
+ * Whether the page has an error
62
+ * Priority: 2
63
+ */
64
+ error?: boolean | Error | string;
65
+ /**
66
+ * Whether access is forbidden (403)
67
+ * Priority: 3
68
+ */
69
+ forbidden?: boolean;
70
+ /**
71
+ * Whether the resource is not found (404)
72
+ * Priority: 4
73
+ */
74
+ notFound?: boolean;
75
+ /**
76
+ * Whether the user is unauthorized (401)
77
+ * Priority: 5
78
+ */
79
+ unauthorized?: boolean;
80
+ /**
81
+ * Whether the page is in maintenance mode
82
+ * Priority: 6
83
+ */
84
+ maintenance?: boolean;
85
+ /**
86
+ * Whether the user is offline
87
+ * Priority: 7
88
+ */
89
+ offline?: boolean;
90
+ /**
91
+ * Whether there was a timeout
92
+ * Priority: 8
93
+ */
94
+ timeout?: boolean;
95
+ /**
96
+ * Whether the data is empty
97
+ * Priority: 9 (lowest)
98
+ */
99
+ empty?: boolean;
100
+ /**
101
+ * Custom loading state configuration
102
+ */
103
+ loadingConfig?: LoadingStateConfig;
104
+ /**
105
+ * Custom error state configuration
106
+ */
107
+ errorConfig?: PageMessageStateConfig;
108
+ /**
109
+ * Custom forbidden state configuration
110
+ */
111
+ forbiddenConfig?: PageMessageStateConfig;
112
+ /**
113
+ * Custom not-found state configuration
114
+ */
115
+ notFoundConfig?: PageMessageStateConfig;
116
+ /**
117
+ * Custom unauthorized state configuration
118
+ */
119
+ unauthorizedConfig?: PageMessageStateConfig;
120
+ /**
121
+ * Custom maintenance state configuration
122
+ */
123
+ maintenanceConfig?: PageMessageStateConfig;
124
+ /**
125
+ * Custom offline state configuration
126
+ */
127
+ offlineConfig?: PageMessageStateConfig;
128
+ /**
129
+ * Custom timeout state configuration
130
+ */
131
+ timeoutConfig?: PageMessageStateConfig;
132
+ /**
133
+ * Custom empty state configuration
134
+ */
135
+ emptyConfig?: PageMessageStateConfig;
136
+ /**
137
+ * Size variant affecting icon and text sizes
138
+ * @default 'md'
139
+ */
140
+ size?: ExtendedComponentSize;
141
+ /**
142
+ * Callback when retry action is triggered (for error/timeout states)
143
+ */
144
+ onRetry?: () => void;
145
+ /**
146
+ * Callback when go back action is triggered
147
+ */
148
+ onGoBack?: () => void;
149
+ /**
150
+ * Callback when go home action is triggered
151
+ */
152
+ onGoHome?: () => void;
153
+ /**
154
+ * Callback when login action is triggered (for unauthorized/forbidden)
155
+ */
156
+ onLogin?: () => void;
157
+ /**
158
+ * Whether to use fullscreen mode
159
+ * @default false
160
+ */
161
+ fullScreen?: boolean;
162
+ /**
163
+ * Whether to center the message vertically
164
+ * @default true
165
+ */
166
+ centerVertically?: boolean;
167
+ /**
168
+ * Minimum height when not fullscreen
169
+ */
170
+ minHeight?: string | number;
171
+ }
172
+ /**
173
+ * Determines which state to display based on priority
174
+ */
175
+ export declare function getActiveState(props: PageMessagesProps): PageMessageState | null;
@@ -47,6 +47,17 @@ export interface ProgressBarProps extends Omit<BaseComponentProps, 'children'> {
47
47
  * Custom format function for the value display
48
48
  */
49
49
  formatValue?: (value: number, max: number) => string;
50
+ /**
51
+ * Indeterminate mode - shows infinite loading animation
52
+ * When true, value prop is ignored
53
+ * @default false
54
+ */
55
+ indeterminate?: boolean;
56
+ /**
57
+ * Buffer/secondary progress value (0-100)
58
+ * Shows a secondary progress track for buffering states
59
+ */
60
+ bufferValue?: number;
50
61
  }
51
62
  /**
52
63
  * ProgressBar - Linear progress indicator for showing task completion or loading states
@@ -0,0 +1,109 @@
1
+ import { default as React } from 'react';
2
+ import { BaseComponentProps } from '../../../types/component.types';
3
+ /**
4
+ * Animation types available for reveal
5
+ */
6
+ export type RevealAnimation = 'fade' | 'slideUp' | 'slideDown' | 'slideLeft' | 'slideRight' | 'zoom' | 'zoomIn' | 'zoomOut';
7
+ /**
8
+ * Props for the Reveal component
9
+ */
10
+ export interface RevealProps extends BaseComponentProps {
11
+ /**
12
+ * Animation type
13
+ * @default 'fade'
14
+ */
15
+ animation?: RevealAnimation;
16
+ /**
17
+ * Animation duration in milliseconds
18
+ * @default 500
19
+ */
20
+ duration?: number;
21
+ /**
22
+ * Delay before animation starts (ms)
23
+ * @default 0
24
+ */
25
+ delay?: number;
26
+ /**
27
+ * CSS easing function
28
+ * @default 'ease-out'
29
+ */
30
+ easing?: string;
31
+ /**
32
+ * Visibility threshold (0-1) for Intersection Observer
33
+ * @default 0.1
34
+ */
35
+ threshold?: number;
36
+ /**
37
+ * Whether to animate only once
38
+ * @default true
39
+ */
40
+ triggerOnce?: boolean;
41
+ /**
42
+ * Distance for slide animations
43
+ * @default '20px'
44
+ */
45
+ distance?: string;
46
+ /**
47
+ * Whether to stagger children animations
48
+ * @default false
49
+ */
50
+ cascade?: boolean;
51
+ /**
52
+ * Delay between staggered children (ms)
53
+ * @default 100
54
+ */
55
+ cascadeDelay?: number;
56
+ /**
57
+ * Callback when element is revealed
58
+ */
59
+ onReveal?: () => void;
60
+ /**
61
+ * Whether the component is initially visible (skips animation)
62
+ * @default false
63
+ */
64
+ initiallyVisible?: boolean;
65
+ /**
66
+ * Root margin for Intersection Observer
67
+ * @default '0px'
68
+ */
69
+ rootMargin?: string;
70
+ /**
71
+ * Play animation immediately on mount without requiring scroll
72
+ * Useful for hero sections or elements visible on initial page load
73
+ * @default false
74
+ */
75
+ playOnMount?: boolean;
76
+ }
77
+ /**
78
+ * Reveal - Intersection Observer-based reveal animation component
79
+ *
80
+ * @example
81
+ * ```tsx
82
+ * <Reveal animation="slideUp">
83
+ * <div>Content that animates in when scrolled into view</div>
84
+ * </Reveal>
85
+ * ```
86
+ *
87
+ * @example
88
+ * ```tsx
89
+ * <Reveal animation="fade" cascade cascadeDelay={100}>
90
+ * <div>First item</div>
91
+ * <div>Second item</div>
92
+ * <div>Third item</div>
93
+ * </Reveal>
94
+ * ```
95
+ *
96
+ * @example
97
+ * ```tsx
98
+ * <Reveal
99
+ * animation="zoom"
100
+ * duration={800}
101
+ * delay={200}
102
+ * onReveal={() => console.log('Revealed!')}
103
+ * >
104
+ * <Card>Animated card</Card>
105
+ * </Reveal>
106
+ * ```
107
+ */
108
+ export declare const Reveal: React.ForwardRefExoticComponent<RevealProps & React.RefAttributes<HTMLDivElement>>;
109
+ export default Reveal;
@@ -0,0 +1,3 @@
1
+ export { Reveal } from './Reveal';
2
+ export type { RevealProps, RevealAnimation } from './Reveal';
3
+ export { default } from './Reveal';