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

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 (109) hide show
  1. package/README.md +138 -0
  2. package/index.css +1 -1
  3. package/index.d.ts +10 -0
  4. package/index.js +1 -1
  5. package/index.mjs +10539 -6746
  6. package/lib/components/buttons/ButtonToggleGroup/ButtonToggleGroup.d.ts +79 -0
  7. package/lib/components/buttons/ButtonToggleGroup/ButtonToggleGroupContext.d.ts +38 -0
  8. package/lib/components/buttons/ButtonToggleGroup/ButtonToggleGroupItem.d.ts +37 -0
  9. package/lib/components/buttons/ButtonToggleGroup/index.d.ts +7 -0
  10. package/lib/components/buttons/ToggleButton/ToggleButton.d.ts +96 -0
  11. package/lib/components/buttons/ToggleButton/index.d.ts +3 -0
  12. package/lib/components/display/Icon/icons/BookmarkFilled.d.ts +3 -0
  13. package/lib/components/display/Icon/icons/ChevronsLeft.d.ts +3 -0
  14. package/lib/components/display/Icon/icons/ChevronsRight.d.ts +3 -0
  15. package/lib/components/display/Icon/icons/HeartFilled.d.ts +3 -0
  16. package/lib/components/display/Icon/icons/More.d.ts +3 -0
  17. package/lib/components/display/Icon/icons/StarFilled.d.ts +3 -0
  18. package/lib/components/display/Icon/icons/ThumbsUpFilled.d.ts +3 -0
  19. package/lib/components/display/Icon/icons/index.d.ts +15 -1
  20. package/lib/components/display/OverflowText/OverflowText.d.ts +81 -0
  21. package/lib/components/display/OverflowText/index.d.ts +2 -0
  22. package/lib/components/display/ScrollArea/ScrollArea.d.ts +112 -0
  23. package/lib/components/display/ScrollArea/index.d.ts +3 -0
  24. package/lib/components/display/Tabs/Tab.d.ts +41 -0
  25. package/lib/components/display/Tabs/TabList.d.ts +27 -0
  26. package/lib/components/display/Tabs/TabPanel.d.ts +31 -0
  27. package/lib/components/display/Tabs/Tabs.d.ts +90 -0
  28. package/lib/components/display/Tabs/TabsContext.d.ts +63 -0
  29. package/lib/components/display/Tabs/index.d.ts +11 -0
  30. package/lib/components/display/TruncatedList/TruncatedList.d.ts +69 -0
  31. package/lib/components/display/TruncatedList/index.d.ts +2 -0
  32. package/lib/components/display/index.d.ts +3 -0
  33. package/lib/components/index.d.ts +44 -0
  34. package/lib/components/inputs/CheckboxGroup/CheckboxGroup.d.ts +122 -0
  35. package/lib/components/inputs/CheckboxGroup/CheckboxGroupContext.d.ts +42 -0
  36. package/lib/components/inputs/CheckboxGroup/CheckboxGroupItem.d.ts +50 -0
  37. package/lib/components/inputs/CheckboxGroup/index.d.ts +7 -0
  38. package/lib/components/layout/AdaptiveGrid/AdaptiveGrid.d.ts +100 -0
  39. package/lib/components/layout/AdaptiveGrid/index.d.ts +2 -0
  40. package/lib/components/layout/MasonryLayout/MasonryLayout.d.ts +74 -0
  41. package/lib/components/layout/MasonryLayout/index.d.ts +2 -0
  42. package/lib/components/layout/Panes/Pane.d.ts +72 -0
  43. package/lib/components/layout/Panes/Panes.d.ts +75 -0
  44. package/lib/components/layout/Panes/PanesContext.d.ts +60 -0
  45. package/lib/components/layout/Panes/index.d.ts +6 -0
  46. package/lib/components/layout/ResponsiveStack/ResponsiveStack.d.ts +99 -0
  47. package/lib/components/layout/ResponsiveStack/index.d.ts +2 -0
  48. package/lib/components/layout/index.d.ts +4 -0
  49. package/lib/components/navigation/BottomNavigation/BottomNavigation.d.ts +53 -0
  50. package/lib/components/navigation/BottomNavigation/BottomNavigationContext.d.ts +27 -0
  51. package/lib/components/navigation/BottomNavigation/BottomNavigationItem.d.ts +59 -0
  52. package/lib/components/navigation/BottomNavigation/index.d.ts +7 -0
  53. package/lib/components/navigation/Breadcrumbs/BreadcrumbItem.d.ts +37 -0
  54. package/lib/components/navigation/Breadcrumbs/BreadcrumbSeparator.d.ts +22 -0
  55. package/lib/components/navigation/Breadcrumbs/Breadcrumbs.d.ts +96 -0
  56. package/lib/components/navigation/Breadcrumbs/index.d.ts +9 -0
  57. package/lib/components/navigation/Breadcrumbs/useBreadcrumbsFromPath.d.ts +73 -0
  58. package/lib/components/navigation/CollapsibleSidebar/CollapsibleSidebar.d.ts +113 -0
  59. package/lib/components/navigation/CollapsibleSidebar/index.d.ts +2 -0
  60. package/lib/components/navigation/NavLink/NavLink.d.ts +74 -0
  61. package/lib/components/navigation/NavLink/index.d.ts +3 -0
  62. package/lib/components/navigation/Navbar/Navbar.d.ts +81 -0
  63. package/lib/components/navigation/Navbar/NavbarActions.d.ts +21 -0
  64. package/lib/components/navigation/Navbar/NavbarBrand.d.ts +29 -0
  65. package/lib/components/navigation/Navbar/NavbarCollapse.d.ts +26 -0
  66. package/lib/components/navigation/Navbar/NavbarContext.d.ts +50 -0
  67. package/lib/components/navigation/Navbar/NavbarNav.d.ts +22 -0
  68. package/lib/components/navigation/Navbar/NavbarToggle.d.ts +21 -0
  69. package/lib/components/navigation/Navbar/index.d.ts +15 -0
  70. package/lib/components/navigation/Pagination/Pagination.d.ts +99 -0
  71. package/lib/components/navigation/Pagination/index.d.ts +3 -0
  72. package/lib/components/navigation/SideNav/SideNav.d.ts +89 -0
  73. package/lib/components/navigation/SideNav/SideNavContext.d.ts +43 -0
  74. package/lib/components/navigation/SideNav/SideNavDivider.d.ts +22 -0
  75. package/lib/components/navigation/SideNav/SideNavGroup.d.ts +44 -0
  76. package/lib/components/navigation/SideNav/SideNavItem.d.ts +71 -0
  77. package/lib/components/navigation/SideNav/index.d.ts +11 -0
  78. package/lib/components/navigation/Stepper/Step.d.ts +57 -0
  79. package/lib/components/navigation/Stepper/Stepper.d.ts +80 -0
  80. package/lib/components/navigation/Stepper/StepperContext.d.ts +58 -0
  81. package/lib/components/navigation/Stepper/index.d.ts +7 -0
  82. package/lib/components/navigation/index.d.ts +16 -0
  83. package/lib/components/overlays/Alert/Alert.d.ts +102 -0
  84. package/lib/components/overlays/Alert/AlertContext.d.ts +94 -0
  85. package/lib/components/overlays/Alert/AlertPresets.d.ts +42 -0
  86. package/lib/components/overlays/Alert/AlertProvider.d.ts +40 -0
  87. package/lib/components/overlays/Alert/index.d.ts +11 -0
  88. package/lib/components/overlays/Dialog/Dialog.d.ts +197 -0
  89. package/lib/components/overlays/Dialog/DialogContext.d.ts +75 -0
  90. package/lib/components/overlays/Dialog/DialogProvider.d.ts +30 -0
  91. package/lib/components/overlays/Dialog/index.d.ts +9 -0
  92. package/lib/components/overlays/Toast/Toast.d.ts +103 -0
  93. package/lib/components/overlays/Toast/ToastContainer.d.ts +37 -0
  94. package/lib/components/overlays/Toast/ToastContext.d.ts +126 -0
  95. package/lib/components/overlays/Toast/ToastProvider.d.ts +71 -0
  96. package/lib/components/overlays/Toast/index.d.ts +11 -0
  97. package/lib/hooks/index.d.ts +10 -0
  98. package/lib/hooks/useAlert/index.d.ts +2 -0
  99. package/lib/hooks/useAlert/useAlert.d.ts +99 -0
  100. package/lib/hooks/useAsyncToast/index.d.ts +2 -0
  101. package/lib/hooks/useAsyncToast/useAsyncToast.d.ts +93 -0
  102. package/lib/hooks/useDialog/index.d.ts +2 -0
  103. package/lib/hooks/useDialog/useDialog.d.ts +58 -0
  104. package/lib/hooks/useResizeObserver/index.d.ts +2 -0
  105. package/lib/hooks/useResizeObserver/useResizeObserver.d.ts +69 -0
  106. package/lib/hooks/useToast/index.d.ts +2 -0
  107. package/lib/hooks/useToast/useToast.d.ts +97 -0
  108. package/lib/providers/GlobalProvider/GlobalProvider.d.ts +16 -1
  109. package/package.json +1 -1
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Options for the resize observer hook
3
+ */
4
+ export interface UseResizeObserverOptions {
5
+ /**
6
+ * Callback when size changes
7
+ */
8
+ onResize?: (entry: ResizeObserverEntry) => void;
9
+ /**
10
+ * Debounce delay for resize callback (ms)
11
+ * @default 0
12
+ */
13
+ debounce?: number;
14
+ /**
15
+ * Which box model to observe
16
+ * @default 'border-box'
17
+ */
18
+ box?: ResizeObserverBoxOptions;
19
+ /**
20
+ * Whether to disable the observer
21
+ * @default false
22
+ */
23
+ disabled?: boolean;
24
+ }
25
+ /**
26
+ * Return value from useResizeObserver
27
+ */
28
+ export interface UseResizeObserverReturn {
29
+ /**
30
+ * Ref callback to attach to the observed element
31
+ */
32
+ ref: (node: HTMLElement | null) => void;
33
+ /**
34
+ * Current width of the element
35
+ */
36
+ width: number;
37
+ /**
38
+ * Current height of the element
39
+ */
40
+ height: number;
41
+ /**
42
+ * The observed element
43
+ */
44
+ element: HTMLElement | null;
45
+ }
46
+ /**
47
+ * Hook that observes element resize using ResizeObserver
48
+ *
49
+ * @example
50
+ * ```tsx
51
+ * const { ref, width, height } = useResizeObserver();
52
+ *
53
+ * return (
54
+ * <div ref={ref}>
55
+ * Width: {width}, Height: {height}
56
+ * </div>
57
+ * );
58
+ * ```
59
+ *
60
+ * @example
61
+ * ```tsx
62
+ * const { ref, width } = useResizeObserver({
63
+ * onResize: (entry) => console.log('Resized:', entry),
64
+ * debounce: 100,
65
+ * });
66
+ * ```
67
+ */
68
+ export declare function useResizeObserver(options?: UseResizeObserverOptions): UseResizeObserverReturn;
69
+ export default useResizeObserver;
@@ -0,0 +1,2 @@
1
+ export { useToast } from './useToast';
2
+ export type { UseToastOptions, UseToastReturn } from './useToast';
@@ -0,0 +1,97 @@
1
+ import { ToastContextValue, ToastData } from '../../components/overlays/Toast';
2
+ /**
3
+ * Hook options
4
+ */
5
+ export interface UseToastOptions {
6
+ /**
7
+ * Default props to apply to all toasts
8
+ */
9
+ defaultProps?: Partial<ToastData>;
10
+ }
11
+ /**
12
+ * Hook return type
13
+ */
14
+ export interface UseToastReturn {
15
+ /**
16
+ * Add a toast with full configuration
17
+ * @returns Toast ID
18
+ */
19
+ toast: (data: ToastData) => string;
20
+ /**
21
+ * Show a success toast
22
+ * @returns Toast ID
23
+ */
24
+ success: (message: string, options?: Partial<ToastData>) => string;
25
+ /**
26
+ * Show an error toast
27
+ * @returns Toast ID
28
+ */
29
+ error: (message: string, options?: Partial<ToastData>) => string;
30
+ /**
31
+ * Show a warning toast
32
+ * @returns Toast ID
33
+ */
34
+ warning: (message: string, options?: Partial<ToastData>) => string;
35
+ /**
36
+ * Show an info toast
37
+ * @returns Toast ID
38
+ */
39
+ info: (message: string, options?: Partial<ToastData>) => string;
40
+ /**
41
+ * Show a loading toast
42
+ * @returns Toast ID
43
+ */
44
+ loading: (message: string, options?: Partial<ToastData>) => string;
45
+ /**
46
+ * Update an existing toast
47
+ */
48
+ update: (id: string, data: Partial<ToastData>) => void;
49
+ /**
50
+ * Dismiss a specific toast
51
+ */
52
+ dismiss: (id: string) => void;
53
+ /**
54
+ * Dismiss all toasts
55
+ */
56
+ dismissAll: () => void;
57
+ /**
58
+ * Promise-based toast that shows loading, then success/error
59
+ */
60
+ promise: ToastContextValue['promise'];
61
+ }
62
+ /**
63
+ * Hook for programmatically creating toasts
64
+ *
65
+ * @example
66
+ * ```tsx
67
+ * function MyComponent() {
68
+ * const toast = useToast();
69
+ *
70
+ * const handleSave = () => {
71
+ * toast.success('Changes saved successfully');
72
+ * };
73
+ *
74
+ * const handleError = () => {
75
+ * toast.error('Failed to save changes', {
76
+ * action: { label: 'Retry', onClick: handleSave }
77
+ * });
78
+ * };
79
+ *
80
+ * const handleAsyncOperation = async () => {
81
+ * await toast.promise(
82
+ * fetchData(),
83
+ * {
84
+ * loading: 'Fetching data...',
85
+ * success: (data) => `Loaded ${data.length} items`,
86
+ * error: (err) => `Error: ${err.message}`,
87
+ * }
88
+ * );
89
+ * };
90
+ *
91
+ * return (
92
+ * <Button onClick={handleSave}>Save</Button>
93
+ * );
94
+ * }
95
+ * ```
96
+ */
97
+ export declare function useToast(options?: UseToastOptions): UseToastReturn;
@@ -1,5 +1,8 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { PageMessagesProviderProps } from '../../contexts/PageMessagesContext';
3
+ import { DialogProviderProps } from '../../components/overlays/Dialog';
4
+ import { AlertProviderProps } from '../../components/overlays/Alert';
5
+ import { ToastProviderProps } from '../../components/overlays/Toast';
3
6
  import { ThemeConfig } from '../../types';
4
7
  export interface GlobalProviderProps {
5
8
  /**
@@ -18,6 +21,18 @@ export interface GlobalProviderProps {
18
21
  * PageMessages default configuration
19
22
  */
20
23
  pageMessagesConfig?: Omit<PageMessagesProviderProps, 'children'>;
24
+ /**
25
+ * Dialog provider configuration
26
+ */
27
+ dialogConfig?: Omit<DialogProviderProps, 'children'>;
28
+ /**
29
+ * Alert provider configuration
30
+ */
31
+ alertConfig?: Omit<AlertProviderProps, 'children'>;
32
+ /**
33
+ * Toast provider configuration
34
+ */
35
+ toastConfig?: Omit<ToastProviderProps, 'children'>;
21
36
  }
22
37
  /**
23
38
  * GlobalProvider component that wraps the entire application
@@ -57,5 +72,5 @@ export interface GlobalProviderProps {
57
72
  * </GlobalProvider>
58
73
  * ```
59
74
  */
60
- export declare function GlobalProvider({ children, themeConfig, injectGlobalStyles, pageMessagesConfig, }: GlobalProviderProps): import("react/jsx-runtime").JSX.Element;
75
+ export declare function GlobalProvider({ children, themeConfig, injectGlobalStyles, pageMessagesConfig, dialogConfig, alertConfig, toastConfig, }: GlobalProviderProps): import("react/jsx-runtime").JSX.Element;
61
76
  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.4",
3
+ "version": "0.0.5",
4
4
  "description": "React TypeScript component library",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",