@arkyn/components 3.0.1-beta.22 → 3.0.1-beta.23

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 (70) hide show
  1. package/README.md +264 -0
  2. package/dist/bundle.js +1485 -859
  3. package/dist/bundle.umd.cjs +1 -1
  4. package/dist/components/audioUpload/hasFileContent/index.d.ts +13 -0
  5. package/dist/components/audioUpload/hasFileContent/index.d.ts.map +1 -0
  6. package/dist/components/audioUpload/hasFileContent/index.js +26 -0
  7. package/dist/components/audioUpload/index.d.ts +82 -0
  8. package/dist/components/audioUpload/index.d.ts.map +1 -0
  9. package/dist/components/audioUpload/index.js +120 -0
  10. package/dist/components/audioUpload/noFileContent/index.d.ts +12 -0
  11. package/dist/components/audioUpload/noFileContent/index.d.ts.map +1 -0
  12. package/dist/components/audioUpload/noFileContent/index.js +29 -0
  13. package/dist/components/clientOnly.d.ts +86 -0
  14. package/dist/components/clientOnly.d.ts.map +1 -0
  15. package/dist/components/clientOnly.js +86 -0
  16. package/dist/components/fileUpload/hasFileContent/index.d.ts +13 -0
  17. package/dist/components/fileUpload/hasFileContent/index.d.ts.map +1 -0
  18. package/dist/components/fileUpload/hasFileContent/index.js +34 -0
  19. package/dist/components/fileUpload/index.d.ts +94 -0
  20. package/dist/components/fileUpload/index.d.ts.map +1 -0
  21. package/dist/components/fileUpload/index.js +127 -0
  22. package/dist/components/fileUpload/noFileContent/index.d.ts +12 -0
  23. package/dist/components/fileUpload/noFileContent/index.d.ts.map +1 -0
  24. package/dist/components/fileUpload/noFileContent/index.js +29 -0
  25. package/dist/components/imageUpload/hasFileContent/index.d.ts +13 -0
  26. package/dist/components/imageUpload/hasFileContent/index.d.ts.map +1 -0
  27. package/dist/components/imageUpload/hasFileContent/index.js +24 -0
  28. package/dist/components/imageUpload/index.d.ts +114 -0
  29. package/dist/components/imageUpload/index.d.ts.map +1 -0
  30. package/dist/components/imageUpload/index.js +148 -0
  31. package/dist/components/imageUpload/noFileContent/index.d.ts +12 -0
  32. package/dist/components/imageUpload/noFileContent/index.d.ts.map +1 -0
  33. package/dist/components/imageUpload/noFileContent/index.js +29 -0
  34. package/dist/components/table/tableBody/index.d.ts +67 -0
  35. package/dist/components/table/tableBody/index.d.ts.map +1 -0
  36. package/dist/components/table/tableBody/index.js +69 -0
  37. package/dist/components/table/tableCaption/index.d.ts +62 -0
  38. package/dist/components/table/tableCaption/index.d.ts.map +1 -0
  39. package/dist/components/table/tableCaption/index.js +64 -0
  40. package/dist/components/table/tableContainer/index.d.ts +64 -0
  41. package/dist/components/table/tableContainer/index.d.ts.map +1 -0
  42. package/dist/components/table/tableContainer/index.js +66 -0
  43. package/dist/components/table/tableFooter/index.d.ts +45 -0
  44. package/dist/components/table/tableFooter/index.d.ts.map +1 -0
  45. package/dist/components/table/tableFooter/index.js +47 -0
  46. package/dist/components/table/tableHeader/index.d.ts +44 -0
  47. package/dist/components/table/tableHeader/index.d.ts.map +1 -0
  48. package/dist/components/table/tableHeader/index.js +46 -0
  49. package/dist/components/tooltip/index.d.ts.map +1 -1
  50. package/dist/components/tooltip/index.js +1 -1
  51. package/dist/hooks/useDrawer.d.ts +86 -0
  52. package/dist/hooks/useDrawer.d.ts.map +1 -0
  53. package/dist/hooks/useDrawer.js +20 -0
  54. package/dist/hooks/useHydrated.d.ts +76 -0
  55. package/dist/hooks/useHydrated.d.ts.map +1 -0
  56. package/dist/hooks/useHydrated.js +81 -0
  57. package/dist/hooks/useModal.d.ts +81 -0
  58. package/dist/hooks/useModal.d.ts.map +1 -0
  59. package/dist/hooks/useModal.js +20 -0
  60. package/dist/index.d.ts +14 -0
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +14 -0
  63. package/dist/providers/drawerProvider.d.ts +106 -0
  64. package/dist/providers/drawerProvider.d.ts.map +1 -0
  65. package/dist/providers/drawerProvider.js +120 -0
  66. package/dist/providers/modalProvider.d.ts +103 -0
  67. package/dist/providers/modalProvider.d.ts.map +1 -0
  68. package/dist/providers/modalProvider.js +119 -0
  69. package/dist/style.css +1 -1
  70. package/package.json +19 -2
@@ -0,0 +1,64 @@
1
+ import { TableHTMLAttributes } from "react";
2
+ import "./styles.css";
3
+ type TableContainerProps = TableHTMLAttributes<HTMLTableElement>;
4
+ /**
5
+ * TableContainer component - wraps table content in a styled container with responsive behavior
6
+ *
7
+ * @param props - TableContainer component properties
8
+ *
9
+ * **...All valid HTML properties for table element**
10
+ *
11
+ * @returns TableContainer JSX element
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * // Basic table container
16
+ * <TableContainer>
17
+ * <TableHeader>
18
+ * <th>Name</th>
19
+ * <th>Email</th>
20
+ * </TableHeader>
21
+ * <TableBody>
22
+ * <tr>
23
+ * <td>John Doe</td>
24
+ * <td>john@example.com</td>
25
+ * </tr>
26
+ * </TableBody>
27
+ * </TableContainer>
28
+ *
29
+ * // Table container with custom styling
30
+ * <TableContainer className="custom-table">
31
+ * <TableCaption>
32
+ * User Management Table
33
+ * </TableCaption>
34
+ * <TableHeader>
35
+ * <th>ID</th>
36
+ * <th>User</th>
37
+ * <th>Status</th>
38
+ * </TableHeader>
39
+ * <TableBody emptyMessage="No users found">
40
+ * // table rows...
41
+ * </TableBody>
42
+ * <TableFooter>
43
+ * <Pagination />
44
+ * </TableFooter>
45
+ * </TableContainer>
46
+ *
47
+ * // Responsive table with overflow handling
48
+ * <TableContainer style={{ maxWidth: '100%', overflowX: 'auto' }}>
49
+ * <TableHeader>
50
+ * <th>Product</th>
51
+ * <th>Description</th>
52
+ * <th>Price</th>
53
+ * <th>Stock</th>
54
+ * <th>Actions</th>
55
+ * </TableHeader>
56
+ * <TableBody>
57
+ * // table rows...
58
+ * </TableBody>
59
+ * </TableContainer>
60
+ * ```
61
+ */
62
+ declare function TableContainer(props: TableContainerProps): import("react/jsx-runtime").JSX.Element;
63
+ export { TableContainer };
64
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/table/tableContainer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,cAAc,CAAC;AAEtB,KAAK,mBAAmB,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,iBAAS,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CASjD;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,66 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ /**
4
+ * TableContainer component - wraps table content in a styled container with responsive behavior
5
+ *
6
+ * @param props - TableContainer component properties
7
+ *
8
+ * **...All valid HTML properties for table element**
9
+ *
10
+ * @returns TableContainer JSX element
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * // Basic table container
15
+ * <TableContainer>
16
+ * <TableHeader>
17
+ * <th>Name</th>
18
+ * <th>Email</th>
19
+ * </TableHeader>
20
+ * <TableBody>
21
+ * <tr>
22
+ * <td>John Doe</td>
23
+ * <td>john@example.com</td>
24
+ * </tr>
25
+ * </TableBody>
26
+ * </TableContainer>
27
+ *
28
+ * // Table container with custom styling
29
+ * <TableContainer className="custom-table">
30
+ * <TableCaption>
31
+ * User Management Table
32
+ * </TableCaption>
33
+ * <TableHeader>
34
+ * <th>ID</th>
35
+ * <th>User</th>
36
+ * <th>Status</th>
37
+ * </TableHeader>
38
+ * <TableBody emptyMessage="No users found">
39
+ * // table rows...
40
+ * </TableBody>
41
+ * <TableFooter>
42
+ * <Pagination />
43
+ * </TableFooter>
44
+ * </TableContainer>
45
+ *
46
+ * // Responsive table with overflow handling
47
+ * <TableContainer style={{ maxWidth: '100%', overflowX: 'auto' }}>
48
+ * <TableHeader>
49
+ * <th>Product</th>
50
+ * <th>Description</th>
51
+ * <th>Price</th>
52
+ * <th>Stock</th>
53
+ * <th>Actions</th>
54
+ * </TableHeader>
55
+ * <TableBody>
56
+ * // table rows...
57
+ * </TableBody>
58
+ * </TableContainer>
59
+ * ```
60
+ */
61
+ function TableContainer(props) {
62
+ const { children, className: baseClassName, ...rest } = props;
63
+ const className = `arkynTableContainer ${baseClassName}`;
64
+ return (_jsx("div", { className: className.trim(), ...rest, children: _jsx("table", { children: children }) }));
65
+ }
66
+ export { TableContainer };
@@ -0,0 +1,45 @@
1
+ import { HTMLAttributes } from "react";
2
+ import "./styles.css";
3
+ type TableFooterProps = HTMLAttributes<HTMLTableSectionElement>;
4
+ /**
5
+ * TableFooter component - used to render the footer section of a table with content container
6
+ *
7
+ * @param props - TableFooter component properties
8
+ *
9
+ * **...All valid HTML properties for tfoot element**
10
+ *
11
+ * @returns TableFooter JSX element
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * // Basic table footer with pagination
16
+ * <TableFooter>
17
+ * <div>Showing 1-10 of 100 results</div>
18
+ * <Pagination />
19
+ * </TableFooter>
20
+ *
21
+ * // Table footer with custom styling
22
+ * <TableFooter className="custom-footer">
23
+ * <Button>Load More</Button>
24
+ * </TableFooter>
25
+ *
26
+ * // Complete table usage
27
+ * <TableContainer>
28
+ * <TableHeader>
29
+ * <th>Name</th>
30
+ * <th>Email</th>
31
+ * </TableHeader>
32
+ * <TableBody>
33
+ * // table rows...
34
+ * </TableBody>
35
+ * <TableFooter>
36
+ * <div className="pagination-info">
37
+ * Total: 250 items
38
+ * </div>
39
+ * </TableFooter>
40
+ * </TableContainer>
41
+ * ```
42
+ */
43
+ declare function TableFooter(props: TableFooterProps): import("react/jsx-runtime").JSX.Element;
44
+ export { TableFooter };
45
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/table/tableFooter/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,cAAc,CAAC;AAEtB,KAAK,gBAAgB,GAAG,cAAc,CAAC,uBAAuB,CAAC,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,iBAAS,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAc3C;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ /**
4
+ * TableFooter component - used to render the footer section of a table with content container
5
+ *
6
+ * @param props - TableFooter component properties
7
+ *
8
+ * **...All valid HTML properties for tfoot element**
9
+ *
10
+ * @returns TableFooter JSX element
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * // Basic table footer with pagination
15
+ * <TableFooter>
16
+ * <div>Showing 1-10 of 100 results</div>
17
+ * <Pagination />
18
+ * </TableFooter>
19
+ *
20
+ * // Table footer with custom styling
21
+ * <TableFooter className="custom-footer">
22
+ * <Button>Load More</Button>
23
+ * </TableFooter>
24
+ *
25
+ * // Complete table usage
26
+ * <TableContainer>
27
+ * <TableHeader>
28
+ * <th>Name</th>
29
+ * <th>Email</th>
30
+ * </TableHeader>
31
+ * <TableBody>
32
+ * // table rows...
33
+ * </TableBody>
34
+ * <TableFooter>
35
+ * <div className="pagination-info">
36
+ * Total: 250 items
37
+ * </div>
38
+ * </TableFooter>
39
+ * </TableContainer>
40
+ * ```
41
+ */
42
+ function TableFooter(props) {
43
+ const { className: baseClassName, children, ...rest } = props;
44
+ const className = `arkynTableFooter ${baseClassName}`;
45
+ return (_jsxs("tfoot", { className: className.trim(), ...rest, children: [_jsx("tr", { className: "spacingRow" }), _jsx("tr", { children: _jsx("th", { colSpan: 100, children: _jsx("div", { className: "arkynTableFooterContent", children: children }) }) })] }));
46
+ }
47
+ export { TableFooter };
@@ -0,0 +1,44 @@
1
+ import { HTMLAttributes } from "react";
2
+ import "./styles.css";
3
+ type TableHeaderProps = HTMLAttributes<HTMLTableSectionElement>;
4
+ /**
5
+ * TableHeader component - used to render the header section of a table with automatic spacing
6
+ *
7
+ * @param props - TableHeader component properties
8
+ *
9
+ * **...All valid HTML properties for thead element**
10
+ *
11
+ * @returns TableHeader JSX element
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * // Basic table header
16
+ * <TableHeader>
17
+ * <th>Name</th>
18
+ * <th>Email</th>
19
+ * <th>Actions</th>
20
+ * </TableHeader>
21
+ *
22
+ * // Table header with custom styling
23
+ * <TableHeader className="custom-header">
24
+ * <th>Product</th>
25
+ * <th>Price</th>
26
+ * <th>Stock</th>
27
+ * </TableHeader>
28
+ *
29
+ * // Complete table usage
30
+ * <TableContainer>
31
+ * <TableHeader>
32
+ * <th>ID</th>
33
+ * <th>User</th>
34
+ * <th>Status</th>
35
+ * </TableHeader>
36
+ * <TableBody>
37
+ * // table rows...
38
+ * </TableBody>
39
+ * </TableContainer>
40
+ * ```
41
+ */
42
+ declare function TableHeader(props: TableHeaderProps): import("react/jsx-runtime").JSX.Element;
43
+ export { TableHeader };
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/table/tableHeader/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,cAAc,CAAC;AAEtB,KAAK,gBAAgB,GAAG,cAAc,CAAC,uBAAuB,CAAC,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,iBAAS,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAU3C;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ /**
4
+ * TableHeader component - used to render the header section of a table with automatic spacing
5
+ *
6
+ * @param props - TableHeader component properties
7
+ *
8
+ * **...All valid HTML properties for thead element**
9
+ *
10
+ * @returns TableHeader JSX element
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * // Basic table header
15
+ * <TableHeader>
16
+ * <th>Name</th>
17
+ * <th>Email</th>
18
+ * <th>Actions</th>
19
+ * </TableHeader>
20
+ *
21
+ * // Table header with custom styling
22
+ * <TableHeader className="custom-header">
23
+ * <th>Product</th>
24
+ * <th>Price</th>
25
+ * <th>Stock</th>
26
+ * </TableHeader>
27
+ *
28
+ * // Complete table usage
29
+ * <TableContainer>
30
+ * <TableHeader>
31
+ * <th>ID</th>
32
+ * <th>User</th>
33
+ * <th>Status</th>
34
+ * </TableHeader>
35
+ * <TableBody>
36
+ * // table rows...
37
+ * </TableBody>
38
+ * </TableContainer>
39
+ * ```
40
+ */
41
+ function TableHeader(props) {
42
+ const { className: baseClassName, children, ...rest } = props;
43
+ const className = `arkynTableHeader ${baseClassName}`;
44
+ return (_jsxs("thead", { className: className.trim(), ...rest, children: [_jsx("tr", { children: children }), _jsx("tr", { className: "spacingRow" })] }));
45
+ }
46
+ export { TableHeader };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,SAAS,EAKV,MAAM,OAAO,CAAC;AACf,OAAO,cAAc,CAAC;AAEtB,KAAK,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,GAAG;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAClD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAEH,iBAAS,OAAO,CAAC,KAAK,EAAE,YAAY,2CAkFnC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,SAAS,EAKV,MAAM,OAAO,CAAC;AACf,OAAO,cAAc,CAAC;AAEtB,KAAK,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,GAAG;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAClD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAEH,iBAAS,OAAO,CAAC,KAAK,EAAE,YAAY,2CAqFnC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -130,6 +130,6 @@ function Tooltip(props) {
130
130
  };
131
131
  }, [orientation, tooltipId]);
132
132
  const className = `arkynTooltip ${size} ${adjustedOrientation} ${baseClassName}`;
133
- return (_jsxs("div", { className: className.trim(), ...rest, ref: tooltipRef, children: [children, _jsx("div", { className: "arkynTooltipText", id: tooltipId, children: text })] }));
133
+ return (_jsxs("div", { className: className.trim(), ...rest, ref: tooltipRef, children: [children, _jsx("div", { className: "arkynTooltipText", id: tooltipId, dangerouslySetInnerHTML: { __html: text } })] }));
134
134
  }
135
135
  export { Tooltip };
@@ -0,0 +1,86 @@
1
+ import { DrawerContextProps } from "../providers/drawerProvider";
2
+ type OpenDrawerProps<T = any> = (data?: T) => void;
3
+ /**
4
+ * useDrawer hook - provides access to drawer context for managing drawer state and data
5
+ *
6
+ * @param key - Optional drawer identifier key. When provided, returns functions for a specific drawer
7
+ *
8
+ * @returns When called without key: Complete drawer context with all drawer management functions
9
+ * @returns When called with key: Object containing drawer-specific functions:
10
+ * - `drawerIsOpen`: Boolean indicating if the specific drawer is open
11
+ * - `drawerData`: Data associated with the specific drawer
12
+ * - `openDrawer`: Function to open the specific drawer with optional data
13
+ * - `closeDrawer`: Function to close the specific drawer
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * // Basic usage - access to full drawer context
18
+ * function DrawerManager() {
19
+ * const drawerContext = useDrawer();
20
+ *
21
+ * return (
22
+ * <div>
23
+ * <button onClick={() => drawerContext.openDrawer('navigation', { section: 'main' })}>
24
+ * Open Navigation
25
+ * </button>
26
+ * <button onClick={() => drawerContext.openDrawer('filters', { category: 'electronics' })}>
27
+ * Open Filters
28
+ * </button>
29
+ * </div>
30
+ * );
31
+ * }
32
+ *
33
+ * // Usage with specific drawer key
34
+ * function NavigationDrawer() {
35
+ * const { drawerIsOpen, drawerData, openDrawer, closeDrawer } = useDrawer('navigation');
36
+ *
37
+ * return (
38
+ * <Drawer isOpen={drawerIsOpen} onClose={closeDrawer} position="left">
39
+ * <h2>Navigation</h2>
40
+ * <p>Current section: {drawerData?.section}</p>
41
+ * <button onClick={closeDrawer}>Close</button>
42
+ * </Drawer>
43
+ * );
44
+ * }
45
+ *
46
+ * // Usage with typed data
47
+ * interface FilterData {
48
+ * category: string;
49
+ * priceRange: [number, number];
50
+ * brands: string[];
51
+ * }
52
+ *
53
+ * function FilterDrawer() {
54
+ * const { drawerIsOpen, drawerData, closeDrawer } = useDrawer<FilterData>('filters');
55
+ *
56
+ * return (
57
+ * <Drawer isOpen={drawerIsOpen} onClose={closeDrawer} position="right">
58
+ * <h2>Filters</h2>
59
+ * <p>Category: {drawerData?.category}</p>
60
+ * <p>Price: ${drawerData?.priceRange?.[0]} - ${drawerData?.priceRange?.[1]}</p>
61
+ * <p>Brands: {drawerData?.brands?.join(', ')}</p>
62
+ * </Drawer>
63
+ * );
64
+ * }
65
+ *
66
+ * // Usage with DrawerProvider
67
+ * function App() {
68
+ * return (
69
+ * <DrawerProvider>
70
+ * <NavigationDrawer />
71
+ * <FilterDrawer />
72
+ * <DrawerManager />
73
+ * </DrawerProvider>
74
+ * );
75
+ * }
76
+ * ```
77
+ */
78
+ declare function useDrawer<T = any>(): DrawerContextProps<T>;
79
+ declare function useDrawer<T = any>(key: string): {
80
+ drawerIsOpen: boolean;
81
+ drawerData: T;
82
+ openDrawer: OpenDrawerProps<T>;
83
+ closeDrawer: () => void;
84
+ };
85
+ export { useDrawer };
86
+ //# sourceMappingURL=useDrawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDrawer.d.ts","sourceRoot":"","sources":["../../src/hooks/useDrawer.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEhF,KAAK,eAAe,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AAEH,iBAAS,SAAS,CAAC,CAAC,GAAG,GAAG,KAAK,kBAAkB,CAAC,CAAC,CAAC,CAAC;AACrD,iBAAS,SAAS,CAAC,CAAC,GAAG,GAAG,EACxB,GAAG,EAAE,MAAM,GACV;IACD,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,CAAC,CAAC;IACd,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAC/B,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC;AA6BF,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { useContext } from "react";
2
+ import { drawerContext } from "../providers/drawerProvider";
3
+ function useDrawer(key) {
4
+ const contextData = useContext(drawerContext);
5
+ if (Object.entries(contextData).length === 0) {
6
+ throw new Error("useDrawer must be used within a Provider");
7
+ }
8
+ if (key) {
9
+ const { drawerData: contextDrawerData, drawerIsOpen: contextDrawerIsOpen, openDrawer: contextOpenDrawer, closeDrawer: contextCloseDrawer, } = contextData;
10
+ const drawerIsOpen = contextDrawerIsOpen(key);
11
+ const drawerData = contextDrawerData(key);
12
+ const openDrawer = (data) => contextOpenDrawer(key, data);
13
+ const closeDrawer = () => contextCloseDrawer(key);
14
+ return { drawerIsOpen, drawerData, openDrawer, closeDrawer };
15
+ }
16
+ else {
17
+ return contextData;
18
+ }
19
+ }
20
+ export { useDrawer };
@@ -0,0 +1,76 @@
1
+ /**
2
+ * useHydrated hook - detects if the component is hydrated on the client side
3
+ *
4
+ * This hook is useful for preventing hydration mismatches when rendering different content
5
+ * on server and client sides. It returns false during SSR and true after hydration.
6
+ *
7
+ * @returns Boolean indicating if the component is hydrated
8
+ * - `true`: Component is hydrated on the client side
9
+ * - `false`: Component is being rendered on the server side or before hydration
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * // Basic usage to prevent hydration mismatches
14
+ * function ClientOnlyComponent() {
15
+ * const isHydrated = useHydrated();
16
+ *
17
+ * if (!isHydrated) {
18
+ * return <div>Loading...</div>;
19
+ * }
20
+ *
21
+ * return (
22
+ * <div>
23
+ * <p>This content is only rendered on the client</p>
24
+ * <p>Current time: {new Date().toLocaleString()}</p>
25
+ * </div>
26
+ * );
27
+ * }
28
+ *
29
+ * // Conditional rendering based on hydration state
30
+ * function ResponsiveComponent() {
31
+ * const isHydrated = useHydrated();
32
+ *
33
+ * return (
34
+ * <div>
35
+ * <h1>My App</h1>
36
+ * {isHydrated ? (
37
+ * <InteractiveWidget />
38
+ * ) : (
39
+ * <StaticPlaceholder />
40
+ * )}
41
+ * </div>
42
+ * );
43
+ * }
44
+ *
45
+ * // Using with client-only features
46
+ * function LocationComponent() {
47
+ * const isHydrated = useHydrated();
48
+ * const [location, setLocation] = useState(null);
49
+ *
50
+ * useEffect(() => {
51
+ * if (isHydrated && navigator.geolocation) {
52
+ * navigator.geolocation.getCurrentPosition((pos) => {
53
+ * setLocation(pos.coords);
54
+ * });
55
+ * }
56
+ * }, [isHydrated]);
57
+ *
58
+ * if (!isHydrated) {
59
+ * return <div>Preparing location services...</div>;
60
+ * }
61
+ *
62
+ * return (
63
+ * <div>
64
+ * {location ? (
65
+ * <p>Your location: {location.latitude}, {location.longitude}</p>
66
+ * ) : (
67
+ * <p>Getting your location...</p>
68
+ * )}
69
+ * </div>
70
+ * );
71
+ * }
72
+ * ```
73
+ */
74
+ declare function useHydrated(): boolean;
75
+ export { useHydrated };
76
+ //# sourceMappingURL=useHydrated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHydrated.d.ts","sourceRoot":"","sources":["../../src/hooks/useHydrated.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AAEH,iBAAS,WAAW,YAMnB;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { useSyncExternalStore } from "react";
2
+ function subscribe() {
3
+ return () => { };
4
+ }
5
+ /**
6
+ * useHydrated hook - detects if the component is hydrated on the client side
7
+ *
8
+ * This hook is useful for preventing hydration mismatches when rendering different content
9
+ * on server and client sides. It returns false during SSR and true after hydration.
10
+ *
11
+ * @returns Boolean indicating if the component is hydrated
12
+ * - `true`: Component is hydrated on the client side
13
+ * - `false`: Component is being rendered on the server side or before hydration
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * // Basic usage to prevent hydration mismatches
18
+ * function ClientOnlyComponent() {
19
+ * const isHydrated = useHydrated();
20
+ *
21
+ * if (!isHydrated) {
22
+ * return <div>Loading...</div>;
23
+ * }
24
+ *
25
+ * return (
26
+ * <div>
27
+ * <p>This content is only rendered on the client</p>
28
+ * <p>Current time: {new Date().toLocaleString()}</p>
29
+ * </div>
30
+ * );
31
+ * }
32
+ *
33
+ * // Conditional rendering based on hydration state
34
+ * function ResponsiveComponent() {
35
+ * const isHydrated = useHydrated();
36
+ *
37
+ * return (
38
+ * <div>
39
+ * <h1>My App</h1>
40
+ * {isHydrated ? (
41
+ * <InteractiveWidget />
42
+ * ) : (
43
+ * <StaticPlaceholder />
44
+ * )}
45
+ * </div>
46
+ * );
47
+ * }
48
+ *
49
+ * // Using with client-only features
50
+ * function LocationComponent() {
51
+ * const isHydrated = useHydrated();
52
+ * const [location, setLocation] = useState(null);
53
+ *
54
+ * useEffect(() => {
55
+ * if (isHydrated && navigator.geolocation) {
56
+ * navigator.geolocation.getCurrentPosition((pos) => {
57
+ * setLocation(pos.coords);
58
+ * });
59
+ * }
60
+ * }, [isHydrated]);
61
+ *
62
+ * if (!isHydrated) {
63
+ * return <div>Preparing location services...</div>;
64
+ * }
65
+ *
66
+ * return (
67
+ * <div>
68
+ * {location ? (
69
+ * <p>Your location: {location.latitude}, {location.longitude}</p>
70
+ * ) : (
71
+ * <p>Getting your location...</p>
72
+ * )}
73
+ * </div>
74
+ * );
75
+ * }
76
+ * ```
77
+ */
78
+ function useHydrated() {
79
+ return useSyncExternalStore(subscribe, () => true, () => false);
80
+ }
81
+ export { useHydrated };