@prismiq/react 0.1.0
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.
- package/README.md +88 -0
- package/dist/CustomSQLEditor-BXB4rf1q.d.cts +1297 -0
- package/dist/CustomSQLEditor-DYeId0Gp.d.ts +1297 -0
- package/dist/DashboardDialog-B3vYC5Gs.d.ts +1106 -0
- package/dist/DashboardDialog-LHmrtNQU.d.cts +1106 -0
- package/dist/accessibility-2yy5yqRR.d.cts +145 -0
- package/dist/accessibility-2yy5yqRR.d.ts +145 -0
- package/dist/charts/index.cjs +110 -0
- package/dist/charts/index.cjs.map +1 -0
- package/dist/charts/index.d.cts +2 -0
- package/dist/charts/index.d.ts +2 -0
- package/dist/charts/index.js +5 -0
- package/dist/charts/index.js.map +1 -0
- package/dist/chunk-2H5WTH4K.js +2409 -0
- package/dist/chunk-2H5WTH4K.js.map +1 -0
- package/dist/chunk-4AVL6GQK.cjs +470 -0
- package/dist/chunk-4AVL6GQK.cjs.map +1 -0
- package/dist/chunk-EX74SI67.js +455 -0
- package/dist/chunk-EX74SI67.js.map +1 -0
- package/dist/chunk-FEABEF3J.cjs +7543 -0
- package/dist/chunk-FEABEF3J.cjs.map +1 -0
- package/dist/chunk-JTCBZDHY.js +126 -0
- package/dist/chunk-JTCBZDHY.js.map +1 -0
- package/dist/chunk-LMTG3LRC.cjs +326 -0
- package/dist/chunk-LMTG3LRC.cjs.map +1 -0
- package/dist/chunk-MDXGGZSW.cjs +273 -0
- package/dist/chunk-MDXGGZSW.cjs.map +1 -0
- package/dist/chunk-MOAEEF5P.js +7510 -0
- package/dist/chunk-MOAEEF5P.js.map +1 -0
- package/dist/chunk-NK7HKX2J.cjs +2459 -0
- package/dist/chunk-NK7HKX2J.cjs.map +1 -0
- package/dist/chunk-NY6TZLST.cjs +8781 -0
- package/dist/chunk-NY6TZLST.cjs.map +1 -0
- package/dist/chunk-T6STUE7E.js +321 -0
- package/dist/chunk-T6STUE7E.js.map +1 -0
- package/dist/chunk-TRW7DKLP.cjs +141 -0
- package/dist/chunk-TRW7DKLP.cjs.map +1 -0
- package/dist/chunk-UPYINBZU.js +8706 -0
- package/dist/chunk-UPYINBZU.js.map +1 -0
- package/dist/chunk-WWTT2OJ5.js +246 -0
- package/dist/chunk-WWTT2OJ5.js.map +1 -0
- package/dist/components/index.cjs +222 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.d.cts +207 -0
- package/dist/components/index.d.ts +207 -0
- package/dist/components/index.js +5 -0
- package/dist/components/index.js.map +1 -0
- package/dist/dashboard/index.cjs +140 -0
- package/dist/dashboard/index.cjs.map +1 -0
- package/dist/dashboard/index.d.cts +302 -0
- package/dist/dashboard/index.d.ts +302 -0
- package/dist/dashboard/index.js +7 -0
- package/dist/dashboard/index.js.map +1 -0
- package/dist/export/index.cjs +32 -0
- package/dist/export/index.cjs.map +1 -0
- package/dist/export/index.d.cts +197 -0
- package/dist/export/index.d.ts +197 -0
- package/dist/export/index.js +3 -0
- package/dist/export/index.js.map +1 -0
- package/dist/index-C-Qcuu4Y.d.cts +821 -0
- package/dist/index-rPc7ijt8.d.ts +821 -0
- package/dist/index.cjs +1486 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1435 -0
- package/dist/index.d.ts +1435 -0
- package/dist/index.js +926 -0
- package/dist/index.js.map +1 -0
- package/dist/ssr/index.cjs +64 -0
- package/dist/ssr/index.cjs.map +1 -0
- package/dist/ssr/index.d.cts +213 -0
- package/dist/ssr/index.d.ts +213 -0
- package/dist/ssr/index.js +3 -0
- package/dist/ssr/index.js.map +1 -0
- package/dist/types-WrCbOeAV.d.cts +569 -0
- package/dist/types-WrCbOeAV.d.ts +569 -0
- package/dist/utils/index.cjs +64 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +112 -0
- package/dist/utils/index.d.ts +112 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +110 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SSR (Server-Side Rendering) utilities for Next.js compatibility.
|
|
5
|
+
*
|
|
6
|
+
* These utilities help components work correctly with:
|
|
7
|
+
* - Next.js App Router
|
|
8
|
+
* - React Server Components
|
|
9
|
+
* - Hydration
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* import { useIsClient, ClientOnly } from '@prismiq/react/ssr';
|
|
14
|
+
*
|
|
15
|
+
* function MyComponent() {
|
|
16
|
+
* const isClient = useIsClient();
|
|
17
|
+
*
|
|
18
|
+
* if (!isClient) {
|
|
19
|
+
* return <Skeleton />;
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* return <Chart data={data} />;
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* // Or use ClientOnly wrapper
|
|
26
|
+
* <ClientOnly fallback={<Skeleton />}>
|
|
27
|
+
* <Chart data={data} />
|
|
28
|
+
* </ClientOnly>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Hook that returns true when running in the browser.
|
|
34
|
+
*
|
|
35
|
+
* Useful for:
|
|
36
|
+
* - Conditionally rendering browser-only components
|
|
37
|
+
* - Avoiding hydration mismatches
|
|
38
|
+
* - Waiting for window/document access
|
|
39
|
+
*
|
|
40
|
+
* @returns true when running in browser, false during SSR
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* function WindowSize() {
|
|
45
|
+
* const isClient = useIsClient();
|
|
46
|
+
*
|
|
47
|
+
* if (!isClient) {
|
|
48
|
+
* return <span>Loading...</span>;
|
|
49
|
+
* }
|
|
50
|
+
*
|
|
51
|
+
* return <span>{window.innerWidth}px</span>;
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
declare function useIsClient(): boolean;
|
|
56
|
+
interface ClientOnlyProps {
|
|
57
|
+
/** Content to render on the client. */
|
|
58
|
+
children: ReactNode;
|
|
59
|
+
/** Fallback content to show during SSR. */
|
|
60
|
+
fallback?: ReactNode;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Component that only renders its children on the client.
|
|
64
|
+
*
|
|
65
|
+
* Use this to wrap components that:
|
|
66
|
+
* - Access window or document
|
|
67
|
+
* - Use browser-only APIs
|
|
68
|
+
* - Would cause hydration mismatches
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```tsx
|
|
72
|
+
* <ClientOnly fallback={<SkeletonChart type="bar" />}>
|
|
73
|
+
* <BarChart data={data} />
|
|
74
|
+
* </ClientOnly>
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
declare function ClientOnly({ children, fallback }: ClientOnlyProps): ReactNode;
|
|
78
|
+
/**
|
|
79
|
+
* Safely get window width (returns default during SSR).
|
|
80
|
+
*
|
|
81
|
+
* @param defaultWidth - Default width to return during SSR
|
|
82
|
+
* @returns Current window width or default
|
|
83
|
+
*/
|
|
84
|
+
declare function getWindowWidth(defaultWidth?: number): number;
|
|
85
|
+
/**
|
|
86
|
+
* Safely get window height (returns default during SSR).
|
|
87
|
+
*
|
|
88
|
+
* @param defaultHeight - Default height to return during SSR
|
|
89
|
+
* @returns Current window height or default
|
|
90
|
+
*/
|
|
91
|
+
declare function getWindowHeight(defaultHeight?: number): number;
|
|
92
|
+
/**
|
|
93
|
+
* Check if code is running in browser environment.
|
|
94
|
+
*
|
|
95
|
+
* @returns true if running in browser
|
|
96
|
+
*/
|
|
97
|
+
declare function isBrowser(): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Check if code is running in server environment.
|
|
100
|
+
*
|
|
101
|
+
* @returns true if running on server
|
|
102
|
+
*/
|
|
103
|
+
declare function isServer(): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Safely get a value from localStorage.
|
|
106
|
+
*
|
|
107
|
+
* @param key - Storage key
|
|
108
|
+
* @param defaultValue - Default value if key doesn't exist or during SSR
|
|
109
|
+
* @returns Stored value or default
|
|
110
|
+
*/
|
|
111
|
+
declare function getLocalStorage<T>(key: string, defaultValue: T): T;
|
|
112
|
+
/**
|
|
113
|
+
* Safely set a value in localStorage.
|
|
114
|
+
*
|
|
115
|
+
* @param key - Storage key
|
|
116
|
+
* @param value - Value to store
|
|
117
|
+
*/
|
|
118
|
+
declare function setLocalStorage<T>(key: string, value: T): void;
|
|
119
|
+
/**
|
|
120
|
+
* Safely remove a value from localStorage.
|
|
121
|
+
*
|
|
122
|
+
* @param key - Storage key to remove
|
|
123
|
+
*/
|
|
124
|
+
declare function removeLocalStorage(key: string): void;
|
|
125
|
+
interface WindowSize {
|
|
126
|
+
width: number;
|
|
127
|
+
height: number;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Hook to get and track window size with SSR support.
|
|
131
|
+
*
|
|
132
|
+
* @param defaultSize - Default size to use during SSR
|
|
133
|
+
* @returns Current window size
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```tsx
|
|
137
|
+
* function ResponsiveComponent() {
|
|
138
|
+
* const { width } = useWindowSize();
|
|
139
|
+
*
|
|
140
|
+
* if (width < 768) {
|
|
141
|
+
* return <MobileView />;
|
|
142
|
+
* }
|
|
143
|
+
*
|
|
144
|
+
* return <DesktopView />;
|
|
145
|
+
* }
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
declare function useWindowSize(defaultSize?: WindowSize): WindowSize;
|
|
149
|
+
/**
|
|
150
|
+
* Hook to check if a media query matches with SSR support.
|
|
151
|
+
*
|
|
152
|
+
* @param query - CSS media query string
|
|
153
|
+
* @param defaultValue - Default value during SSR
|
|
154
|
+
* @returns Whether the media query matches
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```tsx
|
|
158
|
+
* function ResponsiveComponent() {
|
|
159
|
+
* const isMobile = useMediaQuery('(max-width: 768px)');
|
|
160
|
+
* const prefersDark = useMediaQuery('(prefers-color-scheme: dark)');
|
|
161
|
+
*
|
|
162
|
+
* return isMobile ? <MobileView /> : <DesktopView />;
|
|
163
|
+
* }
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
declare function useMediaQuery(query: string, defaultValue?: boolean): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Default breakpoints matching common design systems.
|
|
169
|
+
*/
|
|
170
|
+
declare const BREAKPOINTS: {
|
|
171
|
+
readonly xs: 0;
|
|
172
|
+
readonly sm: 640;
|
|
173
|
+
readonly md: 768;
|
|
174
|
+
readonly lg: 1024;
|
|
175
|
+
readonly xl: 1280;
|
|
176
|
+
readonly '2xl': 1536;
|
|
177
|
+
};
|
|
178
|
+
type Breakpoint = keyof typeof BREAKPOINTS;
|
|
179
|
+
/**
|
|
180
|
+
* Hook to get current breakpoint with SSR support.
|
|
181
|
+
*
|
|
182
|
+
* @param defaultBreakpoint - Default breakpoint during SSR
|
|
183
|
+
* @returns Current breakpoint
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```tsx
|
|
187
|
+
* function ResponsiveComponent() {
|
|
188
|
+
* const breakpoint = useBreakpoint();
|
|
189
|
+
*
|
|
190
|
+
* const columns = {
|
|
191
|
+
* xs: 1,
|
|
192
|
+
* sm: 2,
|
|
193
|
+
* md: 3,
|
|
194
|
+
* lg: 4,
|
|
195
|
+
* xl: 6,
|
|
196
|
+
* '2xl': 6,
|
|
197
|
+
* }[breakpoint];
|
|
198
|
+
*
|
|
199
|
+
* return <Grid columns={columns} />;
|
|
200
|
+
* }
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
declare function useBreakpoint(defaultBreakpoint?: Breakpoint): Breakpoint;
|
|
204
|
+
/**
|
|
205
|
+
* Hook to check if current width is at or above a breakpoint.
|
|
206
|
+
*
|
|
207
|
+
* @param breakpoint - Breakpoint to check
|
|
208
|
+
* @param defaultValue - Default value during SSR
|
|
209
|
+
* @returns Whether width is at or above breakpoint
|
|
210
|
+
*/
|
|
211
|
+
declare function useIsBreakpoint(breakpoint: Breakpoint, defaultValue?: boolean): boolean;
|
|
212
|
+
|
|
213
|
+
export { BREAKPOINTS, type Breakpoint, ClientOnly, type ClientOnlyProps, type WindowSize, getLocalStorage, getWindowHeight, getWindowWidth, isBrowser, isServer, removeLocalStorage, setLocalStorage, useBreakpoint, useIsBreakpoint, useIsClient, useMediaQuery, useWindowSize };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { BREAKPOINTS, ClientOnly, getLocalStorage, getWindowHeight, getWindowWidth, isBrowser, isServer, removeLocalStorage, setLocalStorage, useBreakpoint, useIsBreakpoint, useIsClient, useMediaQuery, useWindowSize } from '../chunk-JTCBZDHY.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|