@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,79 @@
1
+ import { default as React } from 'react';
2
+ import { BaseComponentProps, ExtendedComponentSize } from '../../../types/component.types';
3
+ /**
4
+ * Visual style of the spinner animation
5
+ */
6
+ export type SpinnerStyle = 'circular' | 'dots' | 'bars' | 'pulse';
7
+ /**
8
+ * Color variant of the spinner
9
+ */
10
+ export type SpinnerVariant = 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info' | 'neutral' | 'currentColor';
11
+ /**
12
+ * Animation speed of the spinner
13
+ */
14
+ export type SpinnerSpeed = 'slow' | 'normal' | 'fast';
15
+ /**
16
+ * Props for the Spinner component
17
+ */
18
+ export interface SpinnerProps extends Omit<BaseComponentProps, 'children'> {
19
+ /**
20
+ * Visual style of the spinner animation
21
+ * @default 'circular'
22
+ */
23
+ spinnerStyle?: SpinnerStyle;
24
+ /**
25
+ * Size of the spinner
26
+ * @default 'md'
27
+ */
28
+ size?: ExtendedComponentSize;
29
+ /**
30
+ * Color variant of the spinner
31
+ * @default 'primary'
32
+ */
33
+ variant?: SpinnerVariant;
34
+ /**
35
+ * Animation speed
36
+ * @default 'normal'
37
+ */
38
+ speed?: SpinnerSpeed;
39
+ /**
40
+ * Stroke width for circular spinner style
41
+ * @default 3
42
+ */
43
+ strokeWidth?: number;
44
+ /**
45
+ * Screen reader text
46
+ * @default 'Loading...'
47
+ */
48
+ srText?: string;
49
+ /**
50
+ * Whether to show the screen reader text visually
51
+ * @default false
52
+ */
53
+ showSrText?: boolean;
54
+ }
55
+ /**
56
+ * Spinner - Animated loading indicator with multiple configurable styles
57
+ *
58
+ * @example
59
+ * ```tsx
60
+ * <Spinner />
61
+ * ```
62
+ *
63
+ * @example
64
+ * ```tsx
65
+ * <Spinner spinnerStyle="dots" size="lg" variant="primary" />
66
+ * ```
67
+ *
68
+ * @example
69
+ * ```tsx
70
+ * <Spinner spinnerStyle="bars" speed="fast" variant="success" />
71
+ * ```
72
+ *
73
+ * @example
74
+ * ```tsx
75
+ * <Spinner spinnerStyle="pulse" size="xl" />
76
+ * ```
77
+ */
78
+ export declare const Spinner: React.ForwardRefExoticComponent<SpinnerProps & React.RefAttributes<HTMLDivElement>>;
79
+ export default Spinner;
@@ -0,0 +1,3 @@
1
+ export { Spinner } from './Spinner';
2
+ export type { SpinnerProps, SpinnerStyle, SpinnerVariant, SpinnerSpeed } from './Spinner';
3
+ export { default } from './Spinner';
@@ -8,7 +8,7 @@ export interface StatusIndicatorProps extends BaseComponentProps {
8
8
  * Status variant of the indicator
9
9
  * @default 'neutral'
10
10
  */
11
- status?: 'success' | 'warning' | 'error' | 'info' | 'neutral' | 'processing';
11
+ status?: 'online' | 'offline' | 'away' | 'busy' | 'success' | 'warning' | 'error' | 'info' | 'neutral' | 'processing';
12
12
  /**
13
13
  * Size of the indicator
14
14
  * @default 'md'
@@ -22,6 +22,25 @@ export { KPI } from './display/KPI';
22
22
  export type { KPIProps } from './display/KPI';
23
23
  export { Skeleton } from './display/Skeleton';
24
24
  export type { SkeletonProps } from './display/Skeleton';
25
+ export { Spinner } from './display/Spinner';
26
+ export type { SpinnerProps, SpinnerStyle, SpinnerVariant, SpinnerSpeed } from './display/Spinner';
27
+ export { Collapse } from './display/Collapse';
28
+ export type { CollapseProps } from './display/Collapse';
29
+ export { Accordion, AccordionContainer, AccordionContext, useAccordionContext, useAccordionContextStrict, } from './display/Accordion';
30
+ export type { AccordionProps, AccordionIconPosition, AccordionContainerProps, AccordionControlsPosition, AccordionContextValue, AccordionMode, } from './display/Accordion';
31
+ export { Card } from './display/Card';
32
+ export type { CardProps, CardVariant, CardPadding } from './display/Card';
33
+ export { FlipCard } from './display/FlipCard';
34
+ export type { FlipCardProps, FlipDirection, FlipTrigger } from './display/FlipCard';
35
+ export { CountUp } from './display/CountUp';
36
+ export type { CountUpProps, EasingFunction } from './display/CountUp';
37
+ export { Reveal } from './display/Reveal';
38
+ export type { RevealProps, RevealAnimation } from './display/Reveal';
39
+ export { Carousel } from './display/Carousel';
40
+ export type { CarouselProps } from './display/Carousel';
41
+ export { PageMessages } from './display/PageMessages';
42
+ export type { PageMessagesProps, PageMessageState, PageMessageStateConfig, PageMessageAction, LoadingStateConfig, } from './display/PageMessages';
43
+ export { getActiveState } from './display/PageMessages';
25
44
  export { Portal } from './overlays/Portal';
26
45
  export type { PortalProps } from './overlays/Portal';
27
46
  export { Popover } from './overlays/Popover';
@@ -32,6 +51,8 @@ export { Menu, MenuList, MenuItem, MenuDivider, MenuGroup, MenuContext, useMenuC
32
51
  export type { MenuProps, MenuListProps, MenuItemProps, MenuDividerProps, MenuGroupProps, MenuContextValue, SelectionMode, } from './overlays/Menu';
33
52
  export { Dropdown } from './overlays/Dropdown';
34
53
  export type { DropdownProps } from './overlays/Dropdown';
54
+ export { LoadingOverlay } from './overlays/LoadingOverlay';
55
+ export type { LoadingOverlayProps, LoadingOverlayMode } from './overlays/LoadingOverlay';
35
56
  export { Input } from './inputs/Input';
36
57
  export type { InputProps, ValidationResult, FormatMask, ValidationTiming, InputType, } from './inputs/Input';
37
58
  export { Autocomplete } from './inputs/Autocomplete';
@@ -11,6 +11,11 @@ export interface ToggleProps extends Omit<InputBaseProps, 'value' | 'onChange' |
11
11
  * @default 'md'
12
12
  */
13
13
  size?: ComponentSize;
14
+ /**
15
+ * Whether the toggle is in loading state
16
+ * @default false
17
+ */
18
+ loading?: boolean;
14
19
  /**
15
20
  * Whether the toggle is checked
16
21
  */
@@ -0,0 +1,101 @@
1
+ import { default as React, ReactNode } from 'react';
2
+ import { BaseComponentProps, ExtendedComponentSize } from '../../../types/component.types';
3
+ import { SpinnerSpeed, SpinnerStyle, SpinnerVariant } from '../../display/Spinner';
4
+ /**
5
+ * Loading overlay mode
6
+ */
7
+ export type LoadingOverlayMode = 'container' | 'fullscreen';
8
+ /**
9
+ * Props for the LoadingOverlay component
10
+ */
11
+ export interface LoadingOverlayProps extends BaseComponentProps {
12
+ /**
13
+ * Whether the overlay is visible
14
+ * @default true
15
+ */
16
+ visible?: boolean;
17
+ /**
18
+ * Mode: cover parent container or full screen
19
+ * @default 'container'
20
+ */
21
+ mode?: LoadingOverlayMode;
22
+ /**
23
+ * Spinner style to use
24
+ * @default 'circular'
25
+ */
26
+ spinnerStyle?: SpinnerStyle;
27
+ /**
28
+ * Spinner size
29
+ * @default 'lg'
30
+ */
31
+ spinnerSize?: ExtendedComponentSize;
32
+ /**
33
+ * Spinner color variant
34
+ * @default 'primary'
35
+ */
36
+ spinnerVariant?: SpinnerVariant;
37
+ /**
38
+ * Spinner animation speed
39
+ * @default 'normal'
40
+ */
41
+ spinnerSpeed?: SpinnerSpeed;
42
+ /**
43
+ * Optional message to display below spinner
44
+ */
45
+ message?: ReactNode;
46
+ /**
47
+ * Enable backdrop blur effect
48
+ * @default false
49
+ */
50
+ blur?: boolean;
51
+ /**
52
+ * Backdrop opacity (0-1)
53
+ * @default 0.7
54
+ */
55
+ backdropOpacity?: number;
56
+ /**
57
+ * Custom z-index for the overlay
58
+ */
59
+ zIndex?: number;
60
+ /**
61
+ * Transition duration in milliseconds
62
+ * @default 200
63
+ */
64
+ transitionDuration?: number;
65
+ /**
66
+ * Custom spinner element (overrides spinnerStyle, spinnerSize, spinnerVariant)
67
+ */
68
+ customSpinner?: ReactNode;
69
+ /**
70
+ * Border radius for the overlay to match child content
71
+ * Accepts any valid CSS border-radius value
72
+ */
73
+ borderRadius?: string | number;
74
+ }
75
+ /**
76
+ * LoadingOverlay - Overlay component for showing loading state over content
77
+ *
78
+ * @example
79
+ * ```tsx
80
+ * // Container mode - wraps content
81
+ * <LoadingOverlay visible={isLoading}>
82
+ * <div>Content to overlay</div>
83
+ * </LoadingOverlay>
84
+ * ```
85
+ *
86
+ * @example
87
+ * ```tsx
88
+ * // Fullscreen mode
89
+ * <LoadingOverlay visible={isLoading} mode="fullscreen" message="Loading..." />
90
+ * ```
91
+ *
92
+ * @example
93
+ * ```tsx
94
+ * // With blur effect
95
+ * <LoadingOverlay visible={isLoading} blur backdropOpacity={0.5}>
96
+ * <div>Blurred content</div>
97
+ * </LoadingOverlay>
98
+ * ```
99
+ */
100
+ export declare const LoadingOverlay: React.ForwardRefExoticComponent<LoadingOverlayProps & React.RefAttributes<HTMLDivElement>>;
101
+ export default LoadingOverlay;
@@ -0,0 +1,3 @@
1
+ export { LoadingOverlay } from './LoadingOverlay';
2
+ export type { LoadingOverlayProps, LoadingOverlayMode } from './LoadingOverlay';
3
+ export { default } from './LoadingOverlay';
@@ -0,0 +1,91 @@
1
+ import { ReactNode } from 'react';
2
+ import { PageMessageStateConfig, LoadingStateConfig, PageMessagesProps } from '../../components/display/PageMessages/types';
3
+ /**
4
+ * Default configurations for all page message states
5
+ */
6
+ export interface PageMessagesDefaults {
7
+ /** Default loading configuration */
8
+ loading?: LoadingStateConfig;
9
+ /** Default error configuration */
10
+ error?: PageMessageStateConfig;
11
+ /** Default forbidden configuration */
12
+ forbidden?: PageMessageStateConfig;
13
+ /** Default not-found configuration */
14
+ notFound?: PageMessageStateConfig;
15
+ /** Default unauthorized configuration */
16
+ unauthorized?: PageMessageStateConfig;
17
+ /** Default maintenance configuration */
18
+ maintenance?: PageMessageStateConfig;
19
+ /** Default offline configuration */
20
+ offline?: PageMessageStateConfig;
21
+ /** Default timeout configuration */
22
+ timeout?: PageMessageStateConfig;
23
+ /** Default empty configuration */
24
+ empty?: PageMessageStateConfig;
25
+ }
26
+ /**
27
+ * Global actions that can be provided app-wide
28
+ */
29
+ export interface PageMessagesGlobalActions {
30
+ /** Default retry handler */
31
+ onRetry?: () => void;
32
+ /** Default go back handler */
33
+ onGoBack?: () => void;
34
+ /** Default go home handler */
35
+ onGoHome?: () => void;
36
+ /** Default login handler */
37
+ onLogin?: () => void;
38
+ }
39
+ /**
40
+ * Context value for PageMessages
41
+ */
42
+ export interface PageMessagesContextValue {
43
+ /** Default state configurations */
44
+ defaults: PageMessagesDefaults;
45
+ /** Global action handlers */
46
+ actions: PageMessagesGlobalActions;
47
+ /** Default component props */
48
+ defaultProps?: Partial<Pick<PageMessagesProps, 'size' | 'fullScreen' | 'centerVertically' | 'minHeight'>>;
49
+ }
50
+ export interface PageMessagesProviderProps {
51
+ children: ReactNode;
52
+ /** Default configurations for page message states */
53
+ defaults?: PageMessagesDefaults;
54
+ /** Global action handlers */
55
+ actions?: PageMessagesGlobalActions;
56
+ /** Default component props */
57
+ defaultProps?: PageMessagesContextValue['defaultProps'];
58
+ }
59
+ /**
60
+ * Provider for PageMessages defaults and global configuration
61
+ *
62
+ * @example
63
+ * ```tsx
64
+ * <PageMessagesProvider
65
+ * defaults={{
66
+ * error: {
67
+ * title: 'Oops! Something went wrong',
68
+ * description: 'Please try again later',
69
+ * icon: 'error',
70
+ * },
71
+ * }}
72
+ * actions={{
73
+ * onGoHome: () => router.push('/'),
74
+ * onLogin: () => router.push('/login'),
75
+ * }}
76
+ * >
77
+ * <App />
78
+ * </PageMessagesProvider>
79
+ * ```
80
+ */
81
+ export declare function PageMessagesProvider({ children, defaults, actions, defaultProps, }: PageMessagesProviderProps): import("react/jsx-runtime").JSX.Element;
82
+ /**
83
+ * Hook to access PageMessages context
84
+ * Returns undefined if not within provider (uses built-in defaults)
85
+ */
86
+ export declare function usePageMessages(): PageMessagesContextValue | undefined;
87
+ /**
88
+ * Hook to get merged configuration (context defaults + component props)
89
+ * For internal use by PageMessages component
90
+ */
91
+ export declare function usePageMessagesConfig(componentProps: Partial<PageMessagesProps>): PageMessagesContextValue;
@@ -0,0 +1,2 @@
1
+ export { PageMessagesProvider, usePageMessages, usePageMessagesConfig, } from './PageMessagesContext';
2
+ export type { PageMessagesProviderProps, PageMessagesContextValue, PageMessagesDefaults, PageMessagesGlobalActions, } from './PageMessagesContext';
@@ -1,2 +1,4 @@
1
1
  export { ThemeProvider, useTheme } from './ThemeContext';
2
2
  export type { ThemeProviderProps } from './ThemeContext';
3
+ export { PageMessagesProvider, usePageMessages } from './PageMessagesContext';
4
+ export type { PageMessagesProviderProps, PageMessagesContextValue, PageMessagesDefaults, PageMessagesGlobalActions, } from './PageMessagesContext';
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import { PageMessagesProviderProps } from '../../contexts/PageMessagesContext';
2
3
  import { ThemeConfig } from '../../types';
3
4
  export interface GlobalProviderProps {
4
5
  /**
@@ -13,6 +14,10 @@ export interface GlobalProviderProps {
13
14
  * Whether to inject global styles (default: true)
14
15
  */
15
16
  injectGlobalStyles?: boolean;
17
+ /**
18
+ * PageMessages default configuration
19
+ */
20
+ pageMessagesConfig?: Omit<PageMessagesProviderProps, 'children'>;
16
21
  }
17
22
  /**
18
23
  * GlobalProvider component that wraps the entire application
@@ -52,5 +57,5 @@ export interface GlobalProviderProps {
52
57
  * </GlobalProvider>
53
58
  * ```
54
59
  */
55
- export declare function GlobalProvider({ children, themeConfig, injectGlobalStyles, }: GlobalProviderProps): import("react/jsx-runtime").JSX.Element;
60
+ export declare function GlobalProvider({ children, themeConfig, injectGlobalStyles, pageMessagesConfig, }: GlobalProviderProps): import("react/jsx-runtime").JSX.Element;
56
61
  export default GlobalProvider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@true-tech-team/react-components",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "React TypeScript component library",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",