@geekmidas/ui 9.0.2 → 10.0.0-alpha.1

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 (106) hide show
  1. package/dist/button-BB4n8b0z.mjs +46 -0
  2. package/dist/button-BB4n8b0z.mjs.map +1 -0
  3. package/dist/button-BSp9VyHi.cjs +58 -0
  4. package/dist/button-BSp9VyHi.cjs.map +1 -0
  5. package/dist/chunk-CUT6urMc.cjs +30 -0
  6. package/dist/components/data-display/index.cjs +27 -0
  7. package/dist/components/data-display/index.d.cts +2 -0
  8. package/dist/components/data-display/index.d.mts +2 -0
  9. package/dist/components/data-display/index.mjs +6 -0
  10. package/dist/components/feedback/index.cjs +26 -0
  11. package/dist/components/feedback/index.d.cts +2 -0
  12. package/dist/components/feedback/index.d.mts +2 -0
  13. package/dist/components/feedback/index.mjs +6 -0
  14. package/dist/components/layout/index.cjs +26 -0
  15. package/dist/components/layout/index.d.cts +2 -0
  16. package/dist/components/layout/index.d.mts +2 -0
  17. package/dist/components/layout/index.mjs +6 -0
  18. package/dist/components/ui/index.cjs +73 -0
  19. package/dist/components/ui/index.d.cts +2 -0
  20. package/dist/components/ui/index.d.mts +2 -0
  21. package/dist/components/ui/index.mjs +7 -0
  22. package/dist/data-display-BSUj4rIc.cjs +1318 -0
  23. package/dist/data-display-BSUj4rIc.cjs.map +1 -0
  24. package/dist/data-display-IcuThGEY.mjs +1186 -0
  25. package/dist/data-display-IcuThGEY.mjs.map +1 -0
  26. package/dist/feedback-B9rTsQdJ.cjs +505 -0
  27. package/dist/feedback-B9rTsQdJ.cjs.map +1 -0
  28. package/dist/feedback-DBLrs44v.mjs +379 -0
  29. package/dist/feedback-DBLrs44v.mjs.map +1 -0
  30. package/dist/hooks/index.cjs +1 -1
  31. package/dist/hooks/index.d.cts +1 -1
  32. package/dist/hooks/index.d.mts +1 -1
  33. package/dist/hooks/index.mjs +1 -1
  34. package/dist/{hooks-DuxmSO-h.cjs → hooks-C5O7RXTd.cjs} +3 -31
  35. package/dist/{hooks-DuxmSO-h.cjs.map → hooks-C5O7RXTd.cjs.map} +1 -1
  36. package/dist/{hooks-DBc-Cw9X.mjs → hooks-Dhkovxbo.mjs} +1 -1
  37. package/dist/{hooks-DBc-Cw9X.mjs.map → hooks-Dhkovxbo.mjs.map} +1 -1
  38. package/dist/index-BHdsb44U.d.mts +102 -0
  39. package/dist/index-BHdsb44U.d.mts.map +1 -0
  40. package/dist/index-CBBJ6vmK.d.cts +154 -0
  41. package/dist/index-CBBJ6vmK.d.cts.map +1 -0
  42. package/dist/index-CcP4i-Xr.d.cts +102 -0
  43. package/dist/index-CcP4i-Xr.d.cts.map +1 -0
  44. package/dist/index-D4moB7PV.d.mts +153 -0
  45. package/dist/index-D4moB7PV.d.mts.map +1 -0
  46. package/dist/index-DDztdxvr.d.mts +329 -0
  47. package/dist/index-DDztdxvr.d.mts.map +1 -0
  48. package/dist/{index-DmtSyJ1q.d.mts → index-DTIa7Ryw.d.cts} +1 -1
  49. package/dist/{index-DmtSyJ1q.d.mts.map → index-DTIa7Ryw.d.cts.map} +1 -1
  50. package/dist/index-DsQW2bkf.d.mts +154 -0
  51. package/dist/index-DsQW2bkf.d.mts.map +1 -0
  52. package/dist/{index-QNnnyGjB.d.cts → index-DvzSne29.d.mts} +1 -1
  53. package/dist/{index-QNnnyGjB.d.cts.map → index-DvzSne29.d.mts.map} +1 -1
  54. package/dist/index-FnnlSxxr.d.cts +153 -0
  55. package/dist/index-FnnlSxxr.d.cts.map +1 -0
  56. package/dist/index-uRu0ad4_.d.cts +329 -0
  57. package/dist/index-uRu0ad4_.d.cts.map +1 -0
  58. package/dist/index.cjs +144 -2560
  59. package/dist/index.d.cts +8 -727
  60. package/dist/index.d.mts +8 -727
  61. package/dist/index.mjs +12 -2428
  62. package/dist/layout-CIIQOb1x.mjs +387 -0
  63. package/dist/layout-CIIQOb1x.mjs.map +1 -0
  64. package/dist/layout-CcO0svmw.cjs +513 -0
  65. package/dist/layout-CcO0svmw.cjs.map +1 -0
  66. package/dist/lib/utils.cjs +3 -0
  67. package/dist/lib/utils.d.cts +2 -0
  68. package/dist/lib/utils.d.mts +2 -0
  69. package/dist/lib/utils.mjs +3 -0
  70. package/dist/styles/theme.cjs +1 -1
  71. package/dist/styles/theme.d.cts +1 -1
  72. package/dist/styles/theme.d.mts +1 -1
  73. package/dist/styles/theme.mjs +1 -1
  74. package/dist/table-CrFSBSDe.mjs +129 -0
  75. package/dist/table-CrFSBSDe.mjs.map +1 -0
  76. package/dist/table-DNX6iqH5.cjs +237 -0
  77. package/dist/table-DNX6iqH5.cjs.map +1 -0
  78. package/dist/{theme-BRGSS8qx.cjs → theme-BBoDSysS.cjs} +1 -1
  79. package/dist/{theme-BRGSS8qx.cjs.map → theme-BBoDSysS.cjs.map} +1 -1
  80. package/dist/{theme-vpDwDfcR.d.mts → theme-BsXPj5m4.d.cts} +1 -1
  81. package/dist/{theme-B5mGkTlU.d.cts.map → theme-BsXPj5m4.d.cts.map} +1 -1
  82. package/dist/{theme-DAiFBbyM.mjs → theme-DI0sgbjj.mjs} +1 -1
  83. package/dist/{theme-DAiFBbyM.mjs.map → theme-DI0sgbjj.mjs.map} +1 -1
  84. package/dist/{theme-B5mGkTlU.d.cts → theme-aIIK_kn9.d.mts} +1 -1
  85. package/dist/{theme-vpDwDfcR.d.mts.map → theme-aIIK_kn9.d.mts.map} +1 -1
  86. package/dist/tooltip-BuTZvLTX.cjs +82 -0
  87. package/dist/tooltip-BuTZvLTX.cjs.map +1 -0
  88. package/dist/tooltip-z8o59BXq.mjs +46 -0
  89. package/dist/tooltip-z8o59BXq.mjs.map +1 -0
  90. package/dist/ui-B6Pj_ZAW.mjs +296 -0
  91. package/dist/ui-B6Pj_ZAW.mjs.map +1 -0
  92. package/dist/ui-PFNfvwdv.cjs +542 -0
  93. package/dist/ui-PFNfvwdv.cjs.map +1 -0
  94. package/dist/utils-0J5jzmnT.mjs +11 -0
  95. package/dist/utils-0J5jzmnT.mjs.map +1 -0
  96. package/dist/utils-3XfDEz8-.d.cts +9 -0
  97. package/dist/utils-3XfDEz8-.d.cts.map +1 -0
  98. package/dist/utils-CgSGIxhd.d.mts +9 -0
  99. package/dist/utils-CgSGIxhd.d.mts.map +1 -0
  100. package/dist/utils-DTuzb7hO.cjs +17 -0
  101. package/dist/utils-DTuzb7hO.cjs.map +1 -0
  102. package/package.json +1 -1
  103. package/dist/index.cjs.map +0 -1
  104. package/dist/index.d.cts.map +0 -1
  105. package/dist/index.d.mts.map +0 -1
  106. package/dist/index.mjs.map +0 -1
@@ -0,0 +1,379 @@
1
+ import { cn } from "./utils-0J5jzmnT.mjs";
2
+ import { Button } from "./button-BB4n8b0z.mjs";
3
+ import { getLogLevelColor, getMethodColor, getStatusColor } from "./theme-DI0sgbjj.mjs";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { FileQuestion, Inbox, Loader2, Pause, Play, Search, ServerOff } from "lucide-react";
6
+ import * as React from "react";
7
+ import { cva } from "class-variance-authority";
8
+
9
+ //#region src/components/feedback/empty-state.tsx
10
+ const emptyStateVariants = cva("flex flex-col items-center justify-center text-center", {
11
+ variants: { size: {
12
+ sm: "gap-2 p-4",
13
+ md: "gap-3 p-6",
14
+ lg: "gap-4 p-8"
15
+ } },
16
+ defaultVariants: { size: "md" }
17
+ });
18
+ const EmptyState = React.forwardRef(({ className, size, icon, title, description, action, secondaryAction, children,...props }, ref) => {
19
+ const iconSize = size === "sm" ? "h-8 w-8" : size === "lg" ? "h-16 w-16" : "h-12 w-12";
20
+ return /* @__PURE__ */ jsxs("div", {
21
+ ref,
22
+ className: cn(emptyStateVariants({
23
+ size,
24
+ className
25
+ })),
26
+ ...props,
27
+ children: [
28
+ icon && /* @__PURE__ */ jsx("div", {
29
+ className: cn("text-muted-foreground", iconSize),
30
+ children: icon
31
+ }),
32
+ title && /* @__PURE__ */ jsx("h3", {
33
+ className: cn("font-semibold text-foreground", size === "sm" && "text-sm", size === "lg" && "text-xl"),
34
+ children: title
35
+ }),
36
+ description && /* @__PURE__ */ jsx("p", {
37
+ className: cn("text-muted-foreground max-w-sm", size === "sm" && "text-xs", size === "lg" && "text-base", !size && "text-sm"),
38
+ children: description
39
+ }),
40
+ children,
41
+ (action || secondaryAction) && /* @__PURE__ */ jsxs("div", {
42
+ className: "flex items-center gap-2 mt-2",
43
+ children: [action && /* @__PURE__ */ jsx(Button, {
44
+ size: size === "sm" ? "sm" : size === "lg" ? "default" : "sm",
45
+ onClick: action.onClick,
46
+ children: action.label
47
+ }), secondaryAction && /* @__PURE__ */ jsx(Button, {
48
+ variant: "outline",
49
+ size: size === "sm" ? "sm" : size === "lg" ? "default" : "sm",
50
+ onClick: secondaryAction.onClick,
51
+ children: secondaryAction.label
52
+ })]
53
+ })
54
+ ]
55
+ });
56
+ });
57
+ EmptyState.displayName = "EmptyState";
58
+ const NoData = React.forwardRef(({ title = "No data",...props }, ref) => {
59
+ return /* @__PURE__ */ jsx(EmptyState, {
60
+ ref,
61
+ icon: /* @__PURE__ */ jsx(Inbox, { className: "h-full w-full" }),
62
+ title,
63
+ ...props
64
+ });
65
+ });
66
+ NoData.displayName = "NoData";
67
+ const NoResults = React.forwardRef(({ title = "No results found", searchTerm, description,...props }, ref) => {
68
+ const desc = description ?? (searchTerm ? `No results found for "${searchTerm}". Try adjusting your search.` : "Try adjusting your search or filters.");
69
+ return /* @__PURE__ */ jsx(EmptyState, {
70
+ ref,
71
+ icon: /* @__PURE__ */ jsx(Search, { className: "h-full w-full" }),
72
+ title,
73
+ description: desc,
74
+ ...props
75
+ });
76
+ });
77
+ NoResults.displayName = "NoResults";
78
+ const NotFound = React.forwardRef(({ title = "Page not found", description = "The page you're looking for doesn't exist or has been moved.",...props }, ref) => {
79
+ return /* @__PURE__ */ jsx(EmptyState, {
80
+ ref,
81
+ icon: /* @__PURE__ */ jsx(FileQuestion, { className: "h-full w-full" }),
82
+ title,
83
+ description,
84
+ ...props
85
+ });
86
+ });
87
+ NotFound.displayName = "NotFound";
88
+ const ServerError = React.forwardRef(({ title = "Something went wrong", description = "An unexpected error occurred. Please try again later.",...props }, ref) => {
89
+ return /* @__PURE__ */ jsx(EmptyState, {
90
+ ref,
91
+ icon: /* @__PURE__ */ jsx(ServerOff, { className: "h-full w-full" }),
92
+ title,
93
+ description,
94
+ ...props
95
+ });
96
+ });
97
+ ServerError.displayName = "ServerError";
98
+
99
+ //#endregion
100
+ //#region src/components/feedback/live-indicator.tsx
101
+ const liveIndicatorVariants = cva("inline-flex items-center gap-2 rounded-full text-sm font-medium", {
102
+ variants: {
103
+ size: {
104
+ sm: "h-6 px-2 text-xs",
105
+ md: "h-7 px-2.5",
106
+ lg: "h-8 px-3"
107
+ },
108
+ variant: {
109
+ default: "bg-surface border border-border",
110
+ solid: ""
111
+ }
112
+ },
113
+ defaultVariants: {
114
+ size: "md",
115
+ variant: "default"
116
+ }
117
+ });
118
+ const LiveIndicator = React.forwardRef(({ className, size, variant, live = true, liveLabel = "Live", pausedLabel = "Paused", toggleable = false, onLiveToggle, liveColor = "#22c55e",...props }, ref) => {
119
+ const handleToggle = () => {
120
+ onLiveToggle?.(!live);
121
+ };
122
+ const dotColor = live ? liveColor : "#6b7280";
123
+ const textColor = live ? liveColor : void 0;
124
+ return /* @__PURE__ */ jsxs("div", {
125
+ ref,
126
+ className: cn(liveIndicatorVariants({
127
+ size,
128
+ variant,
129
+ className
130
+ }), variant === "solid" && live && "bg-green-500/10", variant === "solid" && !live && "bg-muted"),
131
+ ...props,
132
+ children: [
133
+ /* @__PURE__ */ jsx("span", {
134
+ className: cn("rounded-full", live && "animate-pulse"),
135
+ style: {
136
+ backgroundColor: dotColor,
137
+ width: size === "sm" ? 6 : size === "lg" ? 10 : 8,
138
+ height: size === "sm" ? 6 : size === "lg" ? 10 : 8
139
+ }
140
+ }),
141
+ /* @__PURE__ */ jsx("span", {
142
+ style: { color: textColor },
143
+ children: live ? liveLabel : pausedLabel
144
+ }),
145
+ toggleable && /* @__PURE__ */ jsx(Button, {
146
+ variant: "ghost",
147
+ size: "icon",
148
+ className: cn("ml-1 rounded-full", size === "sm" && "h-4 w-4", size === "md" && "h-5 w-5", size === "lg" && "h-6 w-6"),
149
+ onClick: handleToggle,
150
+ children: live ? /* @__PURE__ */ jsx(Pause, { className: cn(size === "sm" && "h-2.5 w-2.5", size === "md" && "h-3 w-3", size === "lg" && "h-3.5 w-3.5") }) : /* @__PURE__ */ jsx(Play, { className: cn(size === "sm" && "h-2.5 w-2.5", size === "md" && "h-3 w-3", size === "lg" && "h-3.5 w-3.5") })
151
+ })
152
+ ]
153
+ });
154
+ });
155
+ LiveIndicator.displayName = "LiveIndicator";
156
+ const connectionStatusConfig = {
157
+ connected: {
158
+ color: "#22c55e",
159
+ label: "Connected",
160
+ pulse: false
161
+ },
162
+ connecting: {
163
+ color: "#f59e0b",
164
+ label: "Connecting...",
165
+ pulse: true
166
+ },
167
+ disconnected: {
168
+ color: "#6b7280",
169
+ label: "Disconnected",
170
+ pulse: false
171
+ },
172
+ error: {
173
+ color: "#ef4444",
174
+ label: "Error",
175
+ pulse: true
176
+ }
177
+ };
178
+ const ConnectionStatus = React.forwardRef(({ className, status, showLabel = true, size = "md",...props }, ref) => {
179
+ const config = connectionStatusConfig[status];
180
+ const dotSize = size === "sm" ? 6 : size === "lg" ? 10 : 8;
181
+ return /* @__PURE__ */ jsxs("div", {
182
+ ref,
183
+ className: cn("inline-flex items-center gap-2", className),
184
+ ...props,
185
+ children: [/* @__PURE__ */ jsx("span", {
186
+ className: cn("rounded-full", config.pulse && "animate-pulse"),
187
+ style: {
188
+ backgroundColor: config.color,
189
+ width: dotSize,
190
+ height: dotSize
191
+ }
192
+ }), showLabel && /* @__PURE__ */ jsx("span", {
193
+ className: cn("text-sm", size === "sm" && "text-xs", size === "lg" && "text-base"),
194
+ style: { color: config.color },
195
+ children: config.label
196
+ })]
197
+ });
198
+ });
199
+ ConnectionStatus.displayName = "ConnectionStatus";
200
+
201
+ //#endregion
202
+ //#region src/components/feedback/loading.tsx
203
+ const spinnerVariants = cva("animate-spin text-muted-foreground", {
204
+ variants: { size: {
205
+ xs: "h-3 w-3",
206
+ sm: "h-4 w-4",
207
+ md: "h-6 w-6",
208
+ lg: "h-8 w-8",
209
+ xl: "h-12 w-12"
210
+ } },
211
+ defaultVariants: { size: "md" }
212
+ });
213
+ const Spinner = React.forwardRef(({ className, size,...props }, ref) => {
214
+ return /* @__PURE__ */ jsx(Loader2, {
215
+ ref,
216
+ className: cn(spinnerVariants({
217
+ size,
218
+ className
219
+ })),
220
+ ...props
221
+ });
222
+ });
223
+ Spinner.displayName = "Spinner";
224
+ const loadingOverlayVariants = cva("absolute inset-0 flex items-center justify-center bg-background/80 backdrop-blur-sm", {
225
+ variants: { variant: {
226
+ default: "bg-background/80",
227
+ dark: "bg-background/90",
228
+ light: "bg-background/50"
229
+ } },
230
+ defaultVariants: { variant: "default" }
231
+ });
232
+ const LoadingOverlay = React.forwardRef(({ className, variant, loading = true, text, spinnerSize = "lg", children,...props }, ref) => {
233
+ if (!loading) return null;
234
+ return /* @__PURE__ */ jsx("div", {
235
+ ref,
236
+ className: cn(loadingOverlayVariants({
237
+ variant,
238
+ className
239
+ })),
240
+ ...props,
241
+ children: /* @__PURE__ */ jsxs("div", {
242
+ className: "flex flex-col items-center gap-3",
243
+ children: [
244
+ /* @__PURE__ */ jsx(Spinner, { size: spinnerSize }),
245
+ text && /* @__PURE__ */ jsx("span", {
246
+ className: "text-sm text-muted-foreground",
247
+ children: text
248
+ }),
249
+ children
250
+ ]
251
+ })
252
+ });
253
+ });
254
+ LoadingOverlay.displayName = "LoadingOverlay";
255
+ const LoadingContainer = React.forwardRef(({ className, loading = false, loadingText, spinnerSize, overlayVariant, children,...props }, ref) => {
256
+ return /* @__PURE__ */ jsxs("div", {
257
+ ref,
258
+ className: cn("relative", className),
259
+ ...props,
260
+ children: [children, /* @__PURE__ */ jsx(LoadingOverlay, {
261
+ loading,
262
+ text: loadingText,
263
+ spinnerSize,
264
+ variant: overlayVariant
265
+ })]
266
+ });
267
+ });
268
+ LoadingContainer.displayName = "LoadingContainer";
269
+ const LoadingDots = React.forwardRef(({ className, size = "md",...props }, ref) => {
270
+ const dotSize = size === "sm" ? "h-1 w-1" : size === "lg" ? "h-2.5 w-2.5" : "h-1.5 w-1.5";
271
+ const gap = size === "sm" ? "gap-1" : size === "lg" ? "gap-2" : "gap-1.5";
272
+ return /* @__PURE__ */ jsxs("div", {
273
+ ref,
274
+ className: cn("flex items-center", gap, className),
275
+ ...props,
276
+ children: [
277
+ /* @__PURE__ */ jsx("span", {
278
+ className: cn(dotSize, "rounded-full bg-muted-foreground animate-bounce"),
279
+ style: { animationDelay: "0ms" }
280
+ }),
281
+ /* @__PURE__ */ jsx("span", {
282
+ className: cn(dotSize, "rounded-full bg-muted-foreground animate-bounce"),
283
+ style: { animationDelay: "150ms" }
284
+ }),
285
+ /* @__PURE__ */ jsx("span", {
286
+ className: cn(dotSize, "rounded-full bg-muted-foreground animate-bounce"),
287
+ style: { animationDelay: "300ms" }
288
+ })
289
+ ]
290
+ });
291
+ });
292
+ LoadingDots.displayName = "LoadingDots";
293
+ const Skeleton = React.forwardRef(({ className, width, height, rounded = "md", style,...props }, ref) => {
294
+ const roundedClass = rounded === true ? "rounded-md" : rounded === false ? "" : rounded === "sm" ? "rounded-sm" : rounded === "lg" ? "rounded-lg" : rounded === "full" ? "rounded-full" : "rounded-md";
295
+ return /* @__PURE__ */ jsx("div", {
296
+ ref,
297
+ className: cn("animate-pulse bg-muted", roundedClass, className),
298
+ style: {
299
+ width,
300
+ height,
301
+ ...style
302
+ },
303
+ ...props
304
+ });
305
+ });
306
+ Skeleton.displayName = "Skeleton";
307
+
308
+ //#endregion
309
+ //#region src/components/feedback/status-badge.tsx
310
+ const statusBadgeVariants = cva("inline-flex items-center justify-center rounded-full text-xs font-medium", {
311
+ variants: { size: {
312
+ sm: "h-5 min-w-5 px-1.5",
313
+ md: "h-6 min-w-6 px-2",
314
+ lg: "h-7 min-w-7 px-2.5"
315
+ } },
316
+ defaultVariants: { size: "md" }
317
+ });
318
+ const StatusBadge = React.forwardRef(({ className, size, status, method, logLevel, color: customColor, pulse, children, style,...props }, ref) => {
319
+ let color = customColor;
320
+ let content = children;
321
+ if (status !== void 0) {
322
+ color = color ?? getStatusColor(status);
323
+ content = content ?? String(status);
324
+ } else if (method) {
325
+ color = color ?? getMethodColor(method);
326
+ content = content ?? method.toUpperCase();
327
+ } else if (logLevel) {
328
+ color = color ?? getLogLevelColor(logLevel);
329
+ content = content ?? logLevel.toUpperCase();
330
+ }
331
+ const backgroundColor = color ? `${color}20` : void 0;
332
+ const textColor = color;
333
+ return /* @__PURE__ */ jsxs("span", {
334
+ ref,
335
+ className: cn(statusBadgeVariants({
336
+ size,
337
+ className
338
+ })),
339
+ style: {
340
+ backgroundColor,
341
+ color: textColor,
342
+ ...style
343
+ },
344
+ ...props,
345
+ children: [pulse && /* @__PURE__ */ jsx("span", {
346
+ className: "mr-1.5 h-1.5 w-1.5 rounded-full animate-pulse",
347
+ style: { backgroundColor: color }
348
+ }), content]
349
+ });
350
+ });
351
+ StatusBadge.displayName = "StatusBadge";
352
+ const HttpStatusBadge = React.forwardRef(({ code,...props }, ref) => {
353
+ return /* @__PURE__ */ jsx(StatusBadge, {
354
+ ref,
355
+ status: code,
356
+ ...props
357
+ });
358
+ });
359
+ HttpStatusBadge.displayName = "HttpStatusBadge";
360
+ const HttpMethodBadge = React.forwardRef(({ method,...props }, ref) => {
361
+ return /* @__PURE__ */ jsx(StatusBadge, {
362
+ ref,
363
+ method,
364
+ ...props
365
+ });
366
+ });
367
+ HttpMethodBadge.displayName = "HttpMethodBadge";
368
+ const LogLevelBadge = React.forwardRef(({ level,...props }, ref) => {
369
+ return /* @__PURE__ */ jsx(StatusBadge, {
370
+ ref,
371
+ logLevel: level,
372
+ ...props
373
+ });
374
+ });
375
+ LogLevelBadge.displayName = "LogLevelBadge";
376
+
377
+ //#endregion
378
+ export { ConnectionStatus, EmptyState, HttpMethodBadge, HttpStatusBadge, LiveIndicator, LoadingContainer, LoadingDots, LoadingOverlay, LogLevelBadge, NoData, NoResults, NotFound, ServerError, Skeleton, Spinner, StatusBadge, emptyStateVariants, liveIndicatorVariants, loadingOverlayVariants, spinnerVariants, statusBadgeVariants };
379
+ //# sourceMappingURL=feedback-DBLrs44v.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedback-DBLrs44v.mjs","names":[],"sources":["../src/components/feedback/empty-state.tsx","../src/components/feedback/live-indicator.tsx","../src/components/feedback/loading.tsx","../src/components/feedback/status-badge.tsx"],"sourcesContent":["'use client';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { FileQuestion, Inbox, Search, ServerOff } from 'lucide-react';\nimport * as React from 'react';\nimport { cn } from '../../lib/utils';\nimport { Button } from '../ui/button';\n\nconst emptyStateVariants = cva(\n\t'flex flex-col items-center justify-center text-center',\n\t{\n\t\tvariants: {\n\t\t\tsize: {\n\t\t\t\tsm: 'gap-2 p-4',\n\t\t\t\tmd: 'gap-3 p-6',\n\t\t\t\tlg: 'gap-4 p-8',\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tsize: 'md',\n\t\t},\n\t},\n);\n\nexport interface EmptyStateProps\n\textends React.HTMLAttributes<HTMLDivElement>,\n\t\tVariantProps<typeof emptyStateVariants> {\n\t/** Icon to display */\n\ticon?: React.ReactNode;\n\t/** Title text */\n\ttitle?: string;\n\t/** Description text */\n\tdescription?: string;\n\t/** Primary action button */\n\taction?: {\n\t\tlabel: string;\n\t\tonClick: () => void;\n\t};\n\t/** Secondary action button */\n\tsecondaryAction?: {\n\t\tlabel: string;\n\t\tonClick: () => void;\n\t};\n}\n\nconst EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tsize,\n\t\t\ticon,\n\t\t\ttitle,\n\t\t\tdescription,\n\t\t\taction,\n\t\t\tsecondaryAction,\n\t\t\tchildren,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst iconSize =\n\t\t\tsize === 'sm' ? 'h-8 w-8' : size === 'lg' ? 'h-16 w-16' : 'h-12 w-12';\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cn(emptyStateVariants({ size, className }))}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{icon && (\n\t\t\t\t\t<div className={cn('text-muted-foreground', iconSize)}>{icon}</div>\n\t\t\t\t)}\n\t\t\t\t{title && (\n\t\t\t\t\t<h3\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'font-semibold text-foreground',\n\t\t\t\t\t\t\tsize === 'sm' && 'text-sm',\n\t\t\t\t\t\t\tsize === 'lg' && 'text-xl',\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{title}\n\t\t\t\t\t</h3>\n\t\t\t\t)}\n\t\t\t\t{description && (\n\t\t\t\t\t<p\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'text-muted-foreground max-w-sm',\n\t\t\t\t\t\t\tsize === 'sm' && 'text-xs',\n\t\t\t\t\t\t\tsize === 'lg' && 'text-base',\n\t\t\t\t\t\t\t!size && 'text-sm',\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{description}\n\t\t\t\t\t</p>\n\t\t\t\t)}\n\t\t\t\t{children}\n\t\t\t\t{(action || secondaryAction) && (\n\t\t\t\t\t<div className=\"flex items-center gap-2 mt-2\">\n\t\t\t\t\t\t{action && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tsize={size === 'sm' ? 'sm' : size === 'lg' ? 'default' : 'sm'}\n\t\t\t\t\t\t\t\tonClick={action.onClick}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{action.label}\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{secondaryAction && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\t\tsize={size === 'sm' ? 'sm' : size === 'lg' ? 'default' : 'sm'}\n\t\t\t\t\t\t\t\tonClick={secondaryAction.onClick}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{secondaryAction.label}\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t},\n);\nEmptyState.displayName = 'EmptyState';\n\n// Preset empty states for common use cases\n\nexport interface NoDataProps extends Omit<EmptyStateProps, 'icon' | 'title'> {\n\ttitle?: string;\n}\n\nconst NoData = React.forwardRef<HTMLDivElement, NoDataProps>(\n\t({ title = 'No data', ...props }, ref) => {\n\t\treturn (\n\t\t\t<EmptyState\n\t\t\t\tref={ref}\n\t\t\t\ticon={<Inbox className=\"h-full w-full\" />}\n\t\t\t\ttitle={title}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nNoData.displayName = 'NoData';\n\nexport interface NoResultsProps\n\textends Omit<EmptyStateProps, 'icon' | 'title'> {\n\ttitle?: string;\n\tsearchTerm?: string;\n}\n\nconst NoResults = React.forwardRef<HTMLDivElement, NoResultsProps>(\n\t({ title = 'No results found', searchTerm, description, ...props }, ref) => {\n\t\tconst desc =\n\t\t\tdescription ??\n\t\t\t(searchTerm\n\t\t\t\t? `No results found for \"${searchTerm}\". Try adjusting your search.`\n\t\t\t\t: 'Try adjusting your search or filters.');\n\n\t\treturn (\n\t\t\t<EmptyState\n\t\t\t\tref={ref}\n\t\t\t\ticon={<Search className=\"h-full w-full\" />}\n\t\t\t\ttitle={title}\n\t\t\t\tdescription={desc}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nNoResults.displayName = 'NoResults';\n\nexport interface NotFoundProps extends Omit<EmptyStateProps, 'icon' | 'title'> {\n\ttitle?: string;\n}\n\nconst NotFound = React.forwardRef<HTMLDivElement, NotFoundProps>(\n\t(\n\t\t{\n\t\t\ttitle = 'Page not found',\n\t\t\tdescription = \"The page you're looking for doesn't exist or has been moved.\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\treturn (\n\t\t\t<EmptyState\n\t\t\t\tref={ref}\n\t\t\t\ticon={<FileQuestion className=\"h-full w-full\" />}\n\t\t\t\ttitle={title}\n\t\t\t\tdescription={description}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nNotFound.displayName = 'NotFound';\n\nexport interface ServerErrorProps\n\textends Omit<EmptyStateProps, 'icon' | 'title'> {\n\ttitle?: string;\n}\n\nconst ServerError = React.forwardRef<HTMLDivElement, ServerErrorProps>(\n\t(\n\t\t{\n\t\t\ttitle = 'Something went wrong',\n\t\t\tdescription = 'An unexpected error occurred. Please try again later.',\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\treturn (\n\t\t\t<EmptyState\n\t\t\t\tref={ref}\n\t\t\t\ticon={<ServerOff className=\"h-full w-full\" />}\n\t\t\t\ttitle={title}\n\t\t\t\tdescription={description}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nServerError.displayName = 'ServerError';\n\nexport {\n\tEmptyState,\n\tNoData,\n\tNoResults,\n\tNotFound,\n\tServerError,\n\temptyStateVariants,\n};\n","'use client';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { Pause, Play } from 'lucide-react';\nimport * as React from 'react';\nimport { cn } from '../../lib/utils';\nimport { Button } from '../ui/button';\n\nconst liveIndicatorVariants = cva(\n\t'inline-flex items-center gap-2 rounded-full text-sm font-medium',\n\t{\n\t\tvariants: {\n\t\t\tsize: {\n\t\t\t\tsm: 'h-6 px-2 text-xs',\n\t\t\t\tmd: 'h-7 px-2.5',\n\t\t\t\tlg: 'h-8 px-3',\n\t\t\t},\n\t\t\tvariant: {\n\t\t\t\tdefault: 'bg-surface border border-border',\n\t\t\t\tsolid: '',\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tsize: 'md',\n\t\t\tvariant: 'default',\n\t\t},\n\t},\n);\n\nexport interface LiveIndicatorProps\n\textends Omit<React.HTMLAttributes<HTMLDivElement>, 'onToggle'>,\n\t\tVariantProps<typeof liveIndicatorVariants> {\n\t/** Whether the indicator is in live/active state */\n\tlive?: boolean;\n\t/** Label to show when live */\n\tliveLabel?: string;\n\t/** Label to show when paused */\n\tpausedLabel?: string;\n\t/** Whether to show a toggle button */\n\ttoggleable?: boolean;\n\t/** Callback when toggled */\n\tonLiveToggle?: (live: boolean) => void;\n\t/** Custom color for the dot when live */\n\tliveColor?: string;\n}\n\nconst LiveIndicator = React.forwardRef<HTMLDivElement, LiveIndicatorProps>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tsize,\n\t\t\tvariant,\n\t\t\tlive = true,\n\t\t\tliveLabel = 'Live',\n\t\t\tpausedLabel = 'Paused',\n\t\t\ttoggleable = false,\n\t\t\tonLiveToggle,\n\t\t\tliveColor = '#22c55e',\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst handleToggle = () => {\n\t\t\tonLiveToggle?.(!live);\n\t\t};\n\n\t\tconst dotColor = live ? liveColor : '#6b7280';\n\t\tconst textColor = live ? liveColor : undefined;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cn(\n\t\t\t\t\tliveIndicatorVariants({ size, variant, className }),\n\t\t\t\t\tvariant === 'solid' && live && 'bg-green-500/10',\n\t\t\t\t\tvariant === 'solid' && !live && 'bg-muted',\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t<span\n\t\t\t\t\tclassName={cn('rounded-full', live && 'animate-pulse')}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tbackgroundColor: dotColor,\n\t\t\t\t\t\twidth: size === 'sm' ? 6 : size === 'lg' ? 10 : 8,\n\t\t\t\t\t\theight: size === 'sm' ? 6 : size === 'lg' ? 10 : 8,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t\t<span style={{ color: textColor }}>\n\t\t\t\t\t{live ? liveLabel : pausedLabel}\n\t\t\t\t</span>\n\t\t\t\t{toggleable && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'ml-1 rounded-full',\n\t\t\t\t\t\t\tsize === 'sm' && 'h-4 w-4',\n\t\t\t\t\t\t\tsize === 'md' && 'h-5 w-5',\n\t\t\t\t\t\t\tsize === 'lg' && 'h-6 w-6',\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tonClick={handleToggle}\n\t\t\t\t\t>\n\t\t\t\t\t\t{live ? (\n\t\t\t\t\t\t\t<Pause\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\tsize === 'sm' && 'h-2.5 w-2.5',\n\t\t\t\t\t\t\t\t\tsize === 'md' && 'h-3 w-3',\n\t\t\t\t\t\t\t\t\tsize === 'lg' && 'h-3.5 w-3.5',\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Play\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\tsize === 'sm' && 'h-2.5 w-2.5',\n\t\t\t\t\t\t\t\t\tsize === 'md' && 'h-3 w-3',\n\t\t\t\t\t\t\t\t\tsize === 'lg' && 'h-3.5 w-3.5',\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Button>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t},\n);\nLiveIndicator.displayName = 'LiveIndicator';\n\nexport interface ConnectionStatusProps\n\textends React.HTMLAttributes<HTMLDivElement> {\n\t/** Connection status */\n\tstatus: 'connected' | 'connecting' | 'disconnected' | 'error';\n\t/** Whether to show label */\n\tshowLabel?: boolean;\n\t/** Size of the indicator */\n\tsize?: 'sm' | 'md' | 'lg';\n}\n\nconst connectionStatusConfig = {\n\tconnected: {\n\t\tcolor: '#22c55e',\n\t\tlabel: 'Connected',\n\t\tpulse: false,\n\t},\n\tconnecting: {\n\t\tcolor: '#f59e0b',\n\t\tlabel: 'Connecting...',\n\t\tpulse: true,\n\t},\n\tdisconnected: {\n\t\tcolor: '#6b7280',\n\t\tlabel: 'Disconnected',\n\t\tpulse: false,\n\t},\n\terror: {\n\t\tcolor: '#ef4444',\n\t\tlabel: 'Error',\n\t\tpulse: true,\n\t},\n};\n\nconst ConnectionStatus = React.forwardRef<\n\tHTMLDivElement,\n\tConnectionStatusProps\n>(({ className, status, showLabel = true, size = 'md', ...props }, ref) => {\n\tconst config = connectionStatusConfig[status];\n\tconst dotSize = size === 'sm' ? 6 : size === 'lg' ? 10 : 8;\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={cn('inline-flex items-center gap-2', className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span\n\t\t\t\tclassName={cn('rounded-full', config.pulse && 'animate-pulse')}\n\t\t\t\tstyle={{\n\t\t\t\t\tbackgroundColor: config.color,\n\t\t\t\t\twidth: dotSize,\n\t\t\t\t\theight: dotSize,\n\t\t\t\t}}\n\t\t\t/>\n\t\t\t{showLabel && (\n\t\t\t\t<span\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'text-sm',\n\t\t\t\t\t\tsize === 'sm' && 'text-xs',\n\t\t\t\t\t\tsize === 'lg' && 'text-base',\n\t\t\t\t\t)}\n\t\t\t\t\tstyle={{ color: config.color }}\n\t\t\t\t>\n\t\t\t\t\t{config.label}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t</div>\n\t);\n});\nConnectionStatus.displayName = 'ConnectionStatus';\n\nexport { LiveIndicator, ConnectionStatus, liveIndicatorVariants };\n","'use client';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { Loader2 } from 'lucide-react';\nimport * as React from 'react';\nimport { cn } from '../../lib/utils';\n\nconst spinnerVariants = cva('animate-spin text-muted-foreground', {\n\tvariants: {\n\t\tsize: {\n\t\t\txs: 'h-3 w-3',\n\t\t\tsm: 'h-4 w-4',\n\t\t\tmd: 'h-6 w-6',\n\t\t\tlg: 'h-8 w-8',\n\t\t\txl: 'h-12 w-12',\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tsize: 'md',\n\t},\n});\n\nexport interface SpinnerProps\n\textends Omit<React.SVGAttributes<SVGSVGElement>, 'children'>,\n\t\tVariantProps<typeof spinnerVariants> {}\n\nconst Spinner = React.forwardRef<SVGSVGElement, SpinnerProps>(\n\t({ className, size, ...props }, ref) => {\n\t\treturn (\n\t\t\t<Loader2\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cn(spinnerVariants({ size, className }))}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nSpinner.displayName = 'Spinner';\n\nconst loadingOverlayVariants = cva(\n\t'absolute inset-0 flex items-center justify-center bg-background/80 backdrop-blur-sm',\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault: 'bg-background/80',\n\t\t\t\tdark: 'bg-background/90',\n\t\t\t\tlight: 'bg-background/50',\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tvariant: 'default',\n\t\t},\n\t},\n);\n\nexport interface LoadingOverlayProps\n\textends React.HTMLAttributes<HTMLDivElement>,\n\t\tVariantProps<typeof loadingOverlayVariants> {\n\t/** Whether the overlay is visible */\n\tloading?: boolean;\n\t/** Text to display below spinner */\n\ttext?: string;\n\t/** Spinner size */\n\tspinnerSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n}\n\nconst LoadingOverlay = React.forwardRef<HTMLDivElement, LoadingOverlayProps>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tvariant,\n\t\t\tloading = true,\n\t\t\ttext,\n\t\t\tspinnerSize = 'lg',\n\t\t\tchildren,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tif (!loading) return null;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cn(loadingOverlayVariants({ variant, className }))}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t<div className=\"flex flex-col items-center gap-3\">\n\t\t\t\t\t<Spinner size={spinnerSize} />\n\t\t\t\t\t{text && (\n\t\t\t\t\t\t<span className=\"text-sm text-muted-foreground\">{text}</span>\n\t\t\t\t\t)}\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t},\n);\nLoadingOverlay.displayName = 'LoadingOverlay';\n\nexport interface LoadingContainerProps\n\textends React.HTMLAttributes<HTMLDivElement> {\n\t/** Whether the container is loading */\n\tloading?: boolean;\n\t/** Text to display below spinner */\n\tloadingText?: string;\n\t/** Spinner size */\n\tspinnerSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\t/** Overlay variant */\n\toverlayVariant?: 'default' | 'dark' | 'light';\n}\n\nconst LoadingContainer = React.forwardRef<\n\tHTMLDivElement,\n\tLoadingContainerProps\n>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tloading = false,\n\t\t\tloadingText,\n\t\t\tspinnerSize,\n\t\t\toverlayVariant,\n\t\t\tchildren,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\treturn (\n\t\t\t<div ref={ref} className={cn('relative', className)} {...props}>\n\t\t\t\t{children}\n\t\t\t\t<LoadingOverlay\n\t\t\t\t\tloading={loading}\n\t\t\t\t\ttext={loadingText}\n\t\t\t\t\tspinnerSize={spinnerSize}\n\t\t\t\t\tvariant={overlayVariant}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t},\n);\nLoadingContainer.displayName = 'LoadingContainer';\n\nexport interface LoadingDotsProps extends React.HTMLAttributes<HTMLDivElement> {\n\t/** Size of dots */\n\tsize?: 'sm' | 'md' | 'lg';\n}\n\nconst LoadingDots = React.forwardRef<HTMLDivElement, LoadingDotsProps>(\n\t({ className, size = 'md', ...props }, ref) => {\n\t\tconst dotSize =\n\t\t\tsize === 'sm' ? 'h-1 w-1' : size === 'lg' ? 'h-2.5 w-2.5' : 'h-1.5 w-1.5';\n\t\tconst gap = size === 'sm' ? 'gap-1' : size === 'lg' ? 'gap-2' : 'gap-1.5';\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cn('flex items-center', gap, className)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t<span\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\tdotSize,\n\t\t\t\t\t\t'rounded-full bg-muted-foreground animate-bounce',\n\t\t\t\t\t)}\n\t\t\t\t\tstyle={{ animationDelay: '0ms' }}\n\t\t\t\t/>\n\t\t\t\t<span\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\tdotSize,\n\t\t\t\t\t\t'rounded-full bg-muted-foreground animate-bounce',\n\t\t\t\t\t)}\n\t\t\t\t\tstyle={{ animationDelay: '150ms' }}\n\t\t\t\t/>\n\t\t\t\t<span\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\tdotSize,\n\t\t\t\t\t\t'rounded-full bg-muted-foreground animate-bounce',\n\t\t\t\t\t)}\n\t\t\t\t\tstyle={{ animationDelay: '300ms' }}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t},\n);\nLoadingDots.displayName = 'LoadingDots';\n\nexport interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n\t/** Width of the skeleton */\n\twidth?: string | number;\n\t/** Height of the skeleton */\n\theight?: string | number;\n\t/** Whether to use rounded corners */\n\trounded?: boolean | 'sm' | 'md' | 'lg' | 'full';\n}\n\nconst Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(\n\t({ className, width, height, rounded = 'md', style, ...props }, ref) => {\n\t\tconst roundedClass =\n\t\t\trounded === true\n\t\t\t\t? 'rounded-md'\n\t\t\t\t: rounded === false\n\t\t\t\t\t? ''\n\t\t\t\t\t: rounded === 'sm'\n\t\t\t\t\t\t? 'rounded-sm'\n\t\t\t\t\t\t: rounded === 'lg'\n\t\t\t\t\t\t\t? 'rounded-lg'\n\t\t\t\t\t\t\t: rounded === 'full'\n\t\t\t\t\t\t\t\t? 'rounded-full'\n\t\t\t\t\t\t\t\t: 'rounded-md';\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cn('animate-pulse bg-muted', roundedClass, className)}\n\t\t\t\tstyle={{\n\t\t\t\t\twidth,\n\t\t\t\t\theight,\n\t\t\t\t\t...style,\n\t\t\t\t}}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nSkeleton.displayName = 'Skeleton';\n\nexport {\n\tSpinner,\n\tLoadingOverlay,\n\tLoadingContainer,\n\tLoadingDots,\n\tSkeleton,\n\tspinnerVariants,\n\tloadingOverlayVariants,\n};\n","'use client';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport * as React from 'react';\nimport { cn } from '../../lib/utils';\nimport {\n\tgetLogLevelColor,\n\tgetMethodColor,\n\tgetStatusColor,\n} from '../../styles/theme';\n\nconst statusBadgeVariants = cva(\n\t'inline-flex items-center justify-center rounded-full text-xs font-medium',\n\t{\n\t\tvariants: {\n\t\t\tsize: {\n\t\t\t\tsm: 'h-5 min-w-5 px-1.5',\n\t\t\t\tmd: 'h-6 min-w-6 px-2',\n\t\t\t\tlg: 'h-7 min-w-7 px-2.5',\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tsize: 'md',\n\t\t},\n\t},\n);\n\nexport interface StatusBadgeProps\n\textends React.HTMLAttributes<HTMLSpanElement>,\n\t\tVariantProps<typeof statusBadgeVariants> {\n\t/** HTTP status code to display */\n\tstatus?: number;\n\t/** HTTP method to display */\n\tmethod?: string;\n\t/** Log level to display */\n\tlogLevel?: string;\n\t/** Custom color (overrides automatic color) */\n\tcolor?: string;\n\t/** Whether to show a pulsing dot */\n\tpulse?: boolean;\n}\n\nconst StatusBadge = React.forwardRef<HTMLSpanElement, StatusBadgeProps>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tsize,\n\t\t\tstatus,\n\t\t\tmethod,\n\t\t\tlogLevel,\n\t\t\tcolor: customColor,\n\t\t\tpulse,\n\t\t\tchildren,\n\t\t\tstyle,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\t// Determine color based on props\n\t\tlet color = customColor;\n\t\tlet content = children;\n\n\t\tif (status !== undefined) {\n\t\t\tcolor = color ?? getStatusColor(status);\n\t\t\tcontent = content ?? String(status);\n\t\t} else if (method) {\n\t\t\tcolor = color ?? getMethodColor(method);\n\t\t\tcontent = content ?? method.toUpperCase();\n\t\t} else if (logLevel) {\n\t\t\tcolor = color ?? getLogLevelColor(logLevel);\n\t\t\tcontent = content ?? logLevel.toUpperCase();\n\t\t}\n\n\t\tconst backgroundColor = color ? `${color}20` : undefined;\n\t\tconst textColor = color;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cn(statusBadgeVariants({ size, className }))}\n\t\t\t\tstyle={{\n\t\t\t\t\tbackgroundColor,\n\t\t\t\t\tcolor: textColor,\n\t\t\t\t\t...style,\n\t\t\t\t}}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{pulse && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName=\"mr-1.5 h-1.5 w-1.5 rounded-full animate-pulse\"\n\t\t\t\t\t\tstyle={{ backgroundColor: color }}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{content}\n\t\t\t</span>\n\t\t);\n\t},\n);\nStatusBadge.displayName = 'StatusBadge';\n\nexport interface HttpStatusBadgeProps\n\textends Omit<StatusBadgeProps, 'status' | 'method' | 'logLevel'> {\n\t/** HTTP status code */\n\tcode: number;\n}\n\nconst HttpStatusBadge = React.forwardRef<HTMLSpanElement, HttpStatusBadgeProps>(\n\t({ code, ...props }, ref) => {\n\t\treturn <StatusBadge ref={ref} status={code} {...props} />;\n\t},\n);\nHttpStatusBadge.displayName = 'HttpStatusBadge';\n\nexport interface HttpMethodBadgeProps\n\textends Omit<StatusBadgeProps, 'status' | 'method' | 'logLevel'> {\n\t/** HTTP method */\n\tmethod: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';\n}\n\nconst HttpMethodBadge = React.forwardRef<HTMLSpanElement, HttpMethodBadgeProps>(\n\t({ method, ...props }, ref) => {\n\t\treturn <StatusBadge ref={ref} method={method} {...props} />;\n\t},\n);\nHttpMethodBadge.displayName = 'HttpMethodBadge';\n\nexport interface LogLevelBadgeProps\n\textends Omit<StatusBadgeProps, 'status' | 'method' | 'logLevel'> {\n\t/** Log level */\n\tlevel: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';\n}\n\nconst LogLevelBadge = React.forwardRef<HTMLSpanElement, LogLevelBadgeProps>(\n\t({ level, ...props }, ref) => {\n\t\treturn <StatusBadge ref={ref} logLevel={level} {...props} />;\n\t},\n);\nLogLevelBadge.displayName = 'LogLevelBadge';\n\nexport {\n\tStatusBadge,\n\tHttpStatusBadge,\n\tHttpMethodBadge,\n\tLogLevelBadge,\n\tstatusBadgeVariants,\n};\n"],"mappings":";;;;;;;;;AAQA,MAAM,qBAAqB,IAC1B,yDACA;CACC,UAAU,EACT,MAAM;EACL,IAAI;EACJ,IAAI;EACJ,IAAI;CACJ,EACD;CACD,iBAAiB,EAChB,MAAM,KACN;AACD,EACD;AAuBD,MAAM,aAAa,MAAM,WACxB,CACC,EACC,WACA,MACA,MACA,OACA,aACA,QACA,iBACA,SACA,GAAG,OACH,EACD,QACI;CACJ,MAAM,WACL,SAAS,OAAO,YAAY,SAAS,OAAO,cAAc;AAE3D,wBACC,KAAC;EACK;EACL,WAAW,GAAG,mBAAmB;GAAE;GAAM;EAAW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EACH;EACD,GAAI;aAEH,yBACA,IAAC;GACA,WAAU;GACV,OAAO,EAAE,iBAAiB,MAAO;IAChC,EAEF;GACK;AAER,EACD;AACD,YAAY,cAAc;AAQ1B,MAAM,kBAAkB,MAAM,WAC7B,CAAC,EAAE,KAAM,GAAG,OAAO,EAAE,QAAQ;AAC5B,wBAAO,IAAC;EAAiB;EAAK,QAAQ;EAAM,GAAI;GAAS;AACzD,EACD;AACD,gBAAgB,cAAc;AAQ9B,MAAM,kBAAkB,MAAM,WAC7B,CAAC,EAAE,OAAQ,GAAG,OAAO,EAAE,QAAQ;AAC9B,wBAAO,IAAC;EAAiB;EAAa;EAAQ,GAAI;GAAS;AAC3D,EACD;AACD,gBAAgB,cAAc;AAQ9B,MAAM,gBAAgB,MAAM,WAC3B,CAAC,EAAE,MAAO,GAAG,OAAO,EAAE,QAAQ;AAC7B,wBAAO,IAAC;EAAiB;EAAK,UAAU;EAAO,GAAI;GAAS;AAC5D,EACD;AACD,cAAc,cAAc"}
@@ -1,4 +1,4 @@
1
- const require_hooks = require('../hooks-DuxmSO-h.cjs');
1
+ const require_hooks = require('../hooks-C5O7RXTd.cjs');
2
2
 
3
3
  exports.useDebounce = require_hooks.useDebounce;
4
4
  exports.useLocalStorage = require_hooks.useLocalStorage;
@@ -1,2 +1,2 @@
1
- import { UseWebSocketOptions, UseWebSocketReturn, WebSocketStatus, useDebounce, useLocalStorage, useWebSocket } from "../index-QNnnyGjB.cjs";
1
+ import { UseWebSocketOptions, UseWebSocketReturn, WebSocketStatus, useDebounce, useLocalStorage, useWebSocket } from "../index-DTIa7Ryw.cjs";
2
2
  export { UseWebSocketOptions, UseWebSocketReturn, WebSocketStatus, useDebounce, useLocalStorage, useWebSocket };
@@ -1,2 +1,2 @@
1
- import { UseWebSocketOptions, UseWebSocketReturn, WebSocketStatus, useDebounce, useLocalStorage, useWebSocket } from "../index-DmtSyJ1q.mjs";
1
+ import { UseWebSocketOptions, UseWebSocketReturn, WebSocketStatus, useDebounce, useLocalStorage, useWebSocket } from "../index-DvzSne29.mjs";
2
2
  export { UseWebSocketOptions, UseWebSocketReturn, WebSocketStatus, useDebounce, useLocalStorage, useWebSocket };
@@ -1,3 +1,3 @@
1
- import { useDebounce, useLocalStorage, useWebSocket } from "../hooks-DBc-Cw9X.mjs";
1
+ import { useDebounce, useLocalStorage, useWebSocket } from "../hooks-Dhkovxbo.mjs";
2
2
 
3
3
  export { useDebounce, useLocalStorage, useWebSocket };
@@ -1,27 +1,5 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
22
-
23
- //#endregion
24
- const react = __toESM(require("react"));
1
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
2
+ const react = require_chunk.__toESM(require("react"));
25
3
 
26
4
  //#region src/hooks/use-debounce.ts
27
5
  /**
@@ -225,12 +203,6 @@ function useWebSocket(url, options = {}) {
225
203
  }
226
204
 
227
205
  //#endregion
228
- Object.defineProperty(exports, '__toESM', {
229
- enumerable: true,
230
- get: function () {
231
- return __toESM;
232
- }
233
- });
234
206
  Object.defineProperty(exports, 'useDebounce', {
235
207
  enumerable: true,
236
208
  get: function () {
@@ -249,4 +221,4 @@ Object.defineProperty(exports, 'useWebSocket', {
249
221
  return useWebSocket;
250
222
  }
251
223
  });
252
- //# sourceMappingURL=hooks-DuxmSO-h.cjs.map
224
+ //# sourceMappingURL=hooks-C5O7RXTd.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks-DuxmSO-h.cjs","names":["value: T","delay: number","key: string","initialValue: T","event: StorageEvent","value: T | ((prev: T) => T)","url: string | null","options: UseWebSocketOptions","data: string | object"],"sources":["../src/hooks/use-debounce.ts","../src/hooks/use-local-storage.ts","../src/hooks/use-websocket.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/**\n * Debounces a value by delaying updates until after a specified delay.\n *\n * @example\n * ```tsx\n * const [search, setSearch] = useState('');\n * const debouncedSearch = useDebounce(search, 300);\n *\n * useEffect(() => {\n * // Only fires 300ms after user stops typing\n * fetchResults(debouncedSearch);\n * }, [debouncedSearch]);\n * ```\n */\nexport function useDebounce<T>(value: T, delay: number): T {\n\tconst [debouncedValue, setDebouncedValue] = useState<T>(value);\n\n\tuseEffect(() => {\n\t\tconst timer = setTimeout(() => {\n\t\t\tsetDebouncedValue(value);\n\t\t}, delay);\n\n\t\treturn () => {\n\t\t\tclearTimeout(timer);\n\t\t};\n\t}, [value, delay]);\n\n\treturn debouncedValue;\n}\n\nexport default useDebounce;\n","import { useCallback, useEffect, useState } from 'react';\n\n/**\n * Syncs state with localStorage, with SSR support.\n *\n * @example\n * ```tsx\n * const [theme, setTheme] = useLocalStorage('theme', 'dark');\n *\n * // Value persists across page reloads\n * setTheme('light');\n * ```\n */\nexport function useLocalStorage<T>(\n\tkey: string,\n\tinitialValue: T,\n): [T, (value: T | ((prev: T) => T)) => void, () => void] {\n\t// Get initial value from localStorage or use provided initial value\n\tconst readValue = useCallback((): T => {\n\t\tif (typeof window === 'undefined') {\n\t\t\treturn initialValue;\n\t\t}\n\n\t\ttry {\n\t\t\tconst item = window.localStorage.getItem(key);\n\t\t\treturn item ? (JSON.parse(item) as T) : initialValue;\n\t\t} catch (_error) {\n\t\t\treturn initialValue;\n\t\t}\n\t}, [initialValue, key]);\n\n\tconst [storedValue, setStoredValue] = useState<T>(readValue);\n\n\t// Update state when key changes\n\tuseEffect(() => {\n\t\tsetStoredValue(readValue());\n\t}, [readValue]);\n\n\t// Listen for storage changes from other tabs/windows\n\tuseEffect(() => {\n\t\tconst handleStorageChange = (event: StorageEvent) => {\n\t\t\tif (event.key === key && event.newValue !== null) {\n\t\t\t\ttry {\n\t\t\t\t\tsetStoredValue(JSON.parse(event.newValue) as T);\n\t\t\t\t} catch {\n\t\t\t\t\tsetStoredValue(event.newValue as unknown as T);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener('storage', handleStorageChange);\n\t\treturn () => window.removeEventListener('storage', handleStorageChange);\n\t}, [key]);\n\n\t// Setter that also updates localStorage\n\tconst setValue = useCallback(\n\t\t(value: T | ((prev: T) => T)) => {\n\t\t\ttry {\n\t\t\t\t// Allow value to be a function for functional updates\n\t\t\t\tconst valueToStore =\n\t\t\t\t\tvalue instanceof Function ? value(storedValue) : value;\n\n\t\t\t\tsetStoredValue(valueToStore);\n\n\t\t\t\tif (typeof window !== 'undefined') {\n\t\t\t\t\twindow.localStorage.setItem(key, JSON.stringify(valueToStore));\n\n\t\t\t\t\t// Dispatch event for other components using the same key\n\t\t\t\t\twindow.dispatchEvent(\n\t\t\t\t\t\tnew StorageEvent('storage', {\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tnewValue: JSON.stringify(valueToStore),\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (_error) {}\n\t\t},\n\t\t[key, storedValue],\n\t);\n\n\t// Remove value from localStorage\n\tconst removeValue = useCallback(() => {\n\t\ttry {\n\t\t\tif (typeof window !== 'undefined') {\n\t\t\t\twindow.localStorage.removeItem(key);\n\t\t\t\tsetStoredValue(initialValue);\n\t\t\t}\n\t\t} catch (_error) {}\n\t}, [key, initialValue]);\n\n\treturn [storedValue, setValue, removeValue];\n}\n\nexport default useLocalStorage;\n","import { useCallback, useEffect, useRef, useState } from 'react';\n\nexport type WebSocketStatus = 'connecting' | 'connected' | 'disconnected';\n\nexport interface UseWebSocketOptions {\n\t/**\n\t * Automatically reconnect on disconnect.\n\t * @default true\n\t */\n\treconnect?: boolean;\n\t/**\n\t * Reconnection delay in milliseconds.\n\t * @default 3000\n\t */\n\treconnectDelay?: number;\n\t/**\n\t * Maximum reconnection attempts.\n\t * @default 5\n\t */\n\tmaxReconnectAttempts?: number;\n\t/**\n\t * Callback when connection opens.\n\t */\n\tonOpen?: (event: Event) => void;\n\t/**\n\t * Callback when connection closes.\n\t */\n\tonClose?: (event: CloseEvent) => void;\n\t/**\n\t * Callback when an error occurs.\n\t */\n\tonError?: (event: Event) => void;\n\t/**\n\t * Callback when a message is received.\n\t */\n\tonMessage?: (event: MessageEvent) => void;\n}\n\nexport interface UseWebSocketReturn<T = unknown> {\n\t/**\n\t * Current connection status.\n\t */\n\tstatus: WebSocketStatus;\n\t/**\n\t * Last received message (parsed as JSON if possible).\n\t */\n\tlastMessage: T | null;\n\t/**\n\t * Send a message through the WebSocket.\n\t */\n\tsend: (data: string | object) => void;\n\t/**\n\t * Manually connect to the WebSocket.\n\t */\n\tconnect: () => void;\n\t/**\n\t * Manually disconnect from the WebSocket.\n\t */\n\tdisconnect: () => void;\n}\n\n/**\n * Hook for managing WebSocket connections with auto-reconnect.\n *\n * @example\n * ```tsx\n * const { status, lastMessage, send } = useWebSocket<LogEntry>(\n * 'ws://localhost:3000/ws',\n * {\n * onMessage: (event) => console.log('Received:', event.data),\n * }\n * );\n *\n * // Send a message\n * send({ type: 'subscribe', channel: 'logs' });\n *\n * // Check connection status\n * if (status === 'connected') {\n * // ...\n * }\n * ```\n */\nexport function useWebSocket<T = unknown>(\n\turl: string | null,\n\toptions: UseWebSocketOptions = {},\n): UseWebSocketReturn<T> {\n\tconst {\n\t\treconnect = true,\n\t\treconnectDelay = 3000,\n\t\tmaxReconnectAttempts = 5,\n\t\tonOpen,\n\t\tonClose,\n\t\tonError,\n\t\tonMessage,\n\t} = options;\n\n\tconst [status, setStatus] = useState<WebSocketStatus>('disconnected');\n\tconst [lastMessage, setLastMessage] = useState<T | null>(null);\n\n\tconst wsRef = useRef<WebSocket | null>(null);\n\tconst reconnectAttemptsRef = useRef(0);\n\tconst reconnectTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(\n\t\tnull,\n\t);\n\n\tconst connect = useCallback(() => {\n\t\tif (!url || wsRef.current?.readyState === WebSocket.OPEN) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Clean up existing connection\n\t\tif (wsRef.current) {\n\t\t\twsRef.current.close();\n\t\t}\n\n\t\tsetStatus('connecting');\n\n\t\tconst ws = new WebSocket(url);\n\n\t\tws.onopen = (event) => {\n\t\t\tsetStatus('connected');\n\t\t\treconnectAttemptsRef.current = 0;\n\t\t\tonOpen?.(event);\n\t\t};\n\n\t\tws.onclose = (event) => {\n\t\t\tsetStatus('disconnected');\n\t\t\tonClose?.(event);\n\n\t\t\t// Attempt reconnection if enabled\n\t\t\tif (\n\t\t\t\treconnect &&\n\t\t\t\t!event.wasClean &&\n\t\t\t\treconnectAttemptsRef.current < maxReconnectAttempts\n\t\t\t) {\n\t\t\t\treconnectAttemptsRef.current += 1;\n\t\t\t\treconnectTimeoutRef.current = setTimeout(() => {\n\t\t\t\t\tconnect();\n\t\t\t\t}, reconnectDelay);\n\t\t\t}\n\t\t};\n\n\t\tws.onerror = (event) => {\n\t\t\tonError?.(event);\n\t\t};\n\n\t\tws.onmessage = (event) => {\n\t\t\ttry {\n\t\t\t\tconst data = JSON.parse(event.data) as T;\n\t\t\t\tsetLastMessage(data);\n\t\t\t} catch {\n\t\t\t\tsetLastMessage(event.data as unknown as T);\n\t\t\t}\n\t\t\tonMessage?.(event);\n\t\t};\n\n\t\twsRef.current = ws;\n\t}, [\n\t\turl,\n\t\treconnect,\n\t\treconnectDelay,\n\t\tmaxReconnectAttempts,\n\t\tonOpen,\n\t\tonClose,\n\t\tonError,\n\t\tonMessage,\n\t]);\n\n\tconst disconnect = useCallback(() => {\n\t\tif (reconnectTimeoutRef.current) {\n\t\t\tclearTimeout(reconnectTimeoutRef.current);\n\t\t\treconnectTimeoutRef.current = null;\n\t\t}\n\n\t\tif (wsRef.current) {\n\t\t\twsRef.current.close(1000, 'Manual disconnect');\n\t\t\twsRef.current = null;\n\t\t}\n\n\t\treconnectAttemptsRef.current = maxReconnectAttempts; // Prevent auto-reconnect\n\t\tsetStatus('disconnected');\n\t}, [maxReconnectAttempts]);\n\n\tconst send = useCallback((data: string | object) => {\n\t\tif (wsRef.current?.readyState === WebSocket.OPEN) {\n\t\t\tconst message = typeof data === 'string' ? data : JSON.stringify(data);\n\t\t\twsRef.current.send(message);\n\t\t} else {\n\t\t}\n\t}, []);\n\n\t// Connect on mount if URL is provided\n\tuseEffect(() => {\n\t\tif (url) {\n\t\t\tconnect();\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (reconnectTimeoutRef.current) {\n\t\t\t\tclearTimeout(reconnectTimeoutRef.current);\n\t\t\t}\n\t\t\tif (wsRef.current) {\n\t\t\t\twsRef.current.close(1000, 'Component unmount');\n\t\t\t}\n\t\t};\n\t}, [url, connect]);\n\n\treturn {\n\t\tstatus,\n\t\tlastMessage,\n\t\tsend,\n\t\tconnect,\n\t\tdisconnect,\n\t};\n}\n\nexport default useWebSocket;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,SAAgB,YAAeA,OAAUC,OAAkB;CAC1D,MAAM,CAAC,gBAAgB,kBAAkB,GAAG,oBAAY,MAAM;AAE9D,sBAAU,MAAM;EACf,MAAM,QAAQ,WAAW,MAAM;AAC9B,qBAAkB,MAAM;EACxB,GAAE,MAAM;AAET,SAAO,MAAM;AACZ,gBAAa,MAAM;EACnB;C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ACA;EACA;CACA,EAAC;CAEF,MAAM,aAAa,uBAAY,MAAM;AACpC,MAAI,oBAAoB,SAAS;AAChC,gBAAa,oBAAoB,QAAQ;AACzC,uBAAoB,UAAU;EAC9B;AAED,MAAI,MAAM,SAAS;AAClB,SAAM,QAAQ,MAAM,KAAM,oBAAoB;AAC9C,SAAM,UAAU;EAChB;AAED,uBAAqB,UAAU;AAC/B,YAAU,eAAe;CACzB,GAAE,CAAC,oBAAqB,EAAC;CAE1B,MAAM,OAAO,uBAAY,CAACC,SAA0B;AACnD,MAAI,MAAM,SAAS,eAAe,UAAU,MAAM;GACjD,MAAM,iBAAiB,SAAS,WAAW,OAAO,KAAK,UAAU,KAAK;AACtE,SAAM,QAAQ,KAAK,QAAQ;EAC3B;CAED,GAAE,CAAE,EAAC;AAGN,sBAAU,MAAM;AACf,MAAI,IACH,UAAS;AAGV,SAAO,MAAM;AACZ,OAAI,oBAAoB,QACvB,cAAa,oBAAoB,QAAQ;AAE1C,OAAI,MAAM,QACT,OAAM,QAAQ,MAAM,KAAM,oBAAoB;EAE/C;CACD,GAAE,CAAC,KAAK,OAAQ,EAAC;AAElB,QAAO;EACN;EACA;EACA;EACA;EACA;CACA;AACD"}
1
+ {"version":3,"file":"hooks-C5O7RXTd.cjs","names":["value: T","delay: number","key: string","initialValue: T","event: StorageEvent","value: T | ((prev: T) => T)","url: string | null","options: UseWebSocketOptions","data: string | object"],"sources":["../src/hooks/use-debounce.ts","../src/hooks/use-local-storage.ts","../src/hooks/use-websocket.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/**\n * Debounces a value by delaying updates until after a specified delay.\n *\n * @example\n * ```tsx\n * const [search, setSearch] = useState('');\n * const debouncedSearch = useDebounce(search, 300);\n *\n * useEffect(() => {\n * // Only fires 300ms after user stops typing\n * fetchResults(debouncedSearch);\n * }, [debouncedSearch]);\n * ```\n */\nexport function useDebounce<T>(value: T, delay: number): T {\n\tconst [debouncedValue, setDebouncedValue] = useState<T>(value);\n\n\tuseEffect(() => {\n\t\tconst timer = setTimeout(() => {\n\t\t\tsetDebouncedValue(value);\n\t\t}, delay);\n\n\t\treturn () => {\n\t\t\tclearTimeout(timer);\n\t\t};\n\t}, [value, delay]);\n\n\treturn debouncedValue;\n}\n\nexport default useDebounce;\n","import { useCallback, useEffect, useState } from 'react';\n\n/**\n * Syncs state with localStorage, with SSR support.\n *\n * @example\n * ```tsx\n * const [theme, setTheme] = useLocalStorage('theme', 'dark');\n *\n * // Value persists across page reloads\n * setTheme('light');\n * ```\n */\nexport function useLocalStorage<T>(\n\tkey: string,\n\tinitialValue: T,\n): [T, (value: T | ((prev: T) => T)) => void, () => void] {\n\t// Get initial value from localStorage or use provided initial value\n\tconst readValue = useCallback((): T => {\n\t\tif (typeof window === 'undefined') {\n\t\t\treturn initialValue;\n\t\t}\n\n\t\ttry {\n\t\t\tconst item = window.localStorage.getItem(key);\n\t\t\treturn item ? (JSON.parse(item) as T) : initialValue;\n\t\t} catch (_error) {\n\t\t\treturn initialValue;\n\t\t}\n\t}, [initialValue, key]);\n\n\tconst [storedValue, setStoredValue] = useState<T>(readValue);\n\n\t// Update state when key changes\n\tuseEffect(() => {\n\t\tsetStoredValue(readValue());\n\t}, [readValue]);\n\n\t// Listen for storage changes from other tabs/windows\n\tuseEffect(() => {\n\t\tconst handleStorageChange = (event: StorageEvent) => {\n\t\t\tif (event.key === key && event.newValue !== null) {\n\t\t\t\ttry {\n\t\t\t\t\tsetStoredValue(JSON.parse(event.newValue) as T);\n\t\t\t\t} catch {\n\t\t\t\t\tsetStoredValue(event.newValue as unknown as T);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener('storage', handleStorageChange);\n\t\treturn () => window.removeEventListener('storage', handleStorageChange);\n\t}, [key]);\n\n\t// Setter that also updates localStorage\n\tconst setValue = useCallback(\n\t\t(value: T | ((prev: T) => T)) => {\n\t\t\ttry {\n\t\t\t\t// Allow value to be a function for functional updates\n\t\t\t\tconst valueToStore =\n\t\t\t\t\tvalue instanceof Function ? value(storedValue) : value;\n\n\t\t\t\tsetStoredValue(valueToStore);\n\n\t\t\t\tif (typeof window !== 'undefined') {\n\t\t\t\t\twindow.localStorage.setItem(key, JSON.stringify(valueToStore));\n\n\t\t\t\t\t// Dispatch event for other components using the same key\n\t\t\t\t\twindow.dispatchEvent(\n\t\t\t\t\t\tnew StorageEvent('storage', {\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tnewValue: JSON.stringify(valueToStore),\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (_error) {}\n\t\t},\n\t\t[key, storedValue],\n\t);\n\n\t// Remove value from localStorage\n\tconst removeValue = useCallback(() => {\n\t\ttry {\n\t\t\tif (typeof window !== 'undefined') {\n\t\t\t\twindow.localStorage.removeItem(key);\n\t\t\t\tsetStoredValue(initialValue);\n\t\t\t}\n\t\t} catch (_error) {}\n\t}, [key, initialValue]);\n\n\treturn [storedValue, setValue, removeValue];\n}\n\nexport default useLocalStorage;\n","import { useCallback, useEffect, useRef, useState } from 'react';\n\nexport type WebSocketStatus = 'connecting' | 'connected' | 'disconnected';\n\nexport interface UseWebSocketOptions {\n\t/**\n\t * Automatically reconnect on disconnect.\n\t * @default true\n\t */\n\treconnect?: boolean;\n\t/**\n\t * Reconnection delay in milliseconds.\n\t * @default 3000\n\t */\n\treconnectDelay?: number;\n\t/**\n\t * Maximum reconnection attempts.\n\t * @default 5\n\t */\n\tmaxReconnectAttempts?: number;\n\t/**\n\t * Callback when connection opens.\n\t */\n\tonOpen?: (event: Event) => void;\n\t/**\n\t * Callback when connection closes.\n\t */\n\tonClose?: (event: CloseEvent) => void;\n\t/**\n\t * Callback when an error occurs.\n\t */\n\tonError?: (event: Event) => void;\n\t/**\n\t * Callback when a message is received.\n\t */\n\tonMessage?: (event: MessageEvent) => void;\n}\n\nexport interface UseWebSocketReturn<T = unknown> {\n\t/**\n\t * Current connection status.\n\t */\n\tstatus: WebSocketStatus;\n\t/**\n\t * Last received message (parsed as JSON if possible).\n\t */\n\tlastMessage: T | null;\n\t/**\n\t * Send a message through the WebSocket.\n\t */\n\tsend: (data: string | object) => void;\n\t/**\n\t * Manually connect to the WebSocket.\n\t */\n\tconnect: () => void;\n\t/**\n\t * Manually disconnect from the WebSocket.\n\t */\n\tdisconnect: () => void;\n}\n\n/**\n * Hook for managing WebSocket connections with auto-reconnect.\n *\n * @example\n * ```tsx\n * const { status, lastMessage, send } = useWebSocket<LogEntry>(\n * 'ws://localhost:3000/ws',\n * {\n * onMessage: (event) => console.log('Received:', event.data),\n * }\n * );\n *\n * // Send a message\n * send({ type: 'subscribe', channel: 'logs' });\n *\n * // Check connection status\n * if (status === 'connected') {\n * // ...\n * }\n * ```\n */\nexport function useWebSocket<T = unknown>(\n\turl: string | null,\n\toptions: UseWebSocketOptions = {},\n): UseWebSocketReturn<T> {\n\tconst {\n\t\treconnect = true,\n\t\treconnectDelay = 3000,\n\t\tmaxReconnectAttempts = 5,\n\t\tonOpen,\n\t\tonClose,\n\t\tonError,\n\t\tonMessage,\n\t} = options;\n\n\tconst [status, setStatus] = useState<WebSocketStatus>('disconnected');\n\tconst [lastMessage, setLastMessage] = useState<T | null>(null);\n\n\tconst wsRef = useRef<WebSocket | null>(null);\n\tconst reconnectAttemptsRef = useRef(0);\n\tconst reconnectTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(\n\t\tnull,\n\t);\n\n\tconst connect = useCallback(() => {\n\t\tif (!url || wsRef.current?.readyState === WebSocket.OPEN) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Clean up existing connection\n\t\tif (wsRef.current) {\n\t\t\twsRef.current.close();\n\t\t}\n\n\t\tsetStatus('connecting');\n\n\t\tconst ws = new WebSocket(url);\n\n\t\tws.onopen = (event) => {\n\t\t\tsetStatus('connected');\n\t\t\treconnectAttemptsRef.current = 0;\n\t\t\tonOpen?.(event);\n\t\t};\n\n\t\tws.onclose = (event) => {\n\t\t\tsetStatus('disconnected');\n\t\t\tonClose?.(event);\n\n\t\t\t// Attempt reconnection if enabled\n\t\t\tif (\n\t\t\t\treconnect &&\n\t\t\t\t!event.wasClean &&\n\t\t\t\treconnectAttemptsRef.current < maxReconnectAttempts\n\t\t\t) {\n\t\t\t\treconnectAttemptsRef.current += 1;\n\t\t\t\treconnectTimeoutRef.current = setTimeout(() => {\n\t\t\t\t\tconnect();\n\t\t\t\t}, reconnectDelay);\n\t\t\t}\n\t\t};\n\n\t\tws.onerror = (event) => {\n\t\t\tonError?.(event);\n\t\t};\n\n\t\tws.onmessage = (event) => {\n\t\t\ttry {\n\t\t\t\tconst data = JSON.parse(event.data) as T;\n\t\t\t\tsetLastMessage(data);\n\t\t\t} catch {\n\t\t\t\tsetLastMessage(event.data as unknown as T);\n\t\t\t}\n\t\t\tonMessage?.(event);\n\t\t};\n\n\t\twsRef.current = ws;\n\t}, [\n\t\turl,\n\t\treconnect,\n\t\treconnectDelay,\n\t\tmaxReconnectAttempts,\n\t\tonOpen,\n\t\tonClose,\n\t\tonError,\n\t\tonMessage,\n\t]);\n\n\tconst disconnect = useCallback(() => {\n\t\tif (reconnectTimeoutRef.current) {\n\t\t\tclearTimeout(reconnectTimeoutRef.current);\n\t\t\treconnectTimeoutRef.current = null;\n\t\t}\n\n\t\tif (wsRef.current) {\n\t\t\twsRef.current.close(1000, 'Manual disconnect');\n\t\t\twsRef.current = null;\n\t\t}\n\n\t\treconnectAttemptsRef.current = maxReconnectAttempts; // Prevent auto-reconnect\n\t\tsetStatus('disconnected');\n\t}, [maxReconnectAttempts]);\n\n\tconst send = useCallback((data: string | object) => {\n\t\tif (wsRef.current?.readyState === WebSocket.OPEN) {\n\t\t\tconst message = typeof data === 'string' ? data : JSON.stringify(data);\n\t\t\twsRef.current.send(message);\n\t\t} else {\n\t\t}\n\t}, []);\n\n\t// Connect on mount if URL is provided\n\tuseEffect(() => {\n\t\tif (url) {\n\t\t\tconnect();\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (reconnectTimeoutRef.current) {\n\t\t\t\tclearTimeout(reconnectTimeoutRef.current);\n\t\t\t}\n\t\t\tif (wsRef.current) {\n\t\t\t\twsRef.current.close(1000, 'Component unmount');\n\t\t\t}\n\t\t};\n\t}, [url, connect]);\n\n\treturn {\n\t\tstatus,\n\t\tlastMessage,\n\t\tsend,\n\t\tconnect,\n\t\tdisconnect,\n\t};\n}\n\nexport default useWebSocket;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,SAAgB,YAAeA,OAAUC,OAAkB;CAC1D,MAAM,CAAC,gBAAgB,kBAAkB,GAAG,oBAAY,MAAM;AAE9D,sBAAU,MAAM;EACf,MAAM,QAAQ,WAAW,MAAM;AAC9B,qBAAkB,MAAM;EACxB,GAAE,MAAM;AAET,SAAO,MAAM;AACZ,gBAAa,MAAM;EACnB;CACD,GAAE,CAAC,OAAO,KAAM,EAAC;AAElB,QAAO;AACP;;;;;;;;;;;;;;;ACjBD,SAAgB,gBACfC,KACAC,cACyD;CAEzD,MAAM,YAAY,uBAAY,MAAS;AACtC,aAAW,WAAW,YACrB,QAAO;AAGR,MAAI;GACH,MAAM,OAAO,OAAO,aAAa,QAAQ,IAAI;AAC7C,UAAO,OAAQ,KAAK,MAAM,KAAK,GAAS;EACxC,SAAQ,QAAQ;AAChB,UAAO;EACP;CACD,GAAE,CAAC,cAAc,GAAI,EAAC;CAEvB,MAAM,CAAC,aAAa,eAAe,GAAG,oBAAY,UAAU;AAG5D,sBAAU,MAAM;AACf,iBAAe,WAAW,CAAC;CAC3B,GAAE,CAAC,SAAU,EAAC;AAGf,sBAAU,MAAM;EACf,MAAM,sBAAsB,CAACC,UAAwB;AACpD,OAAI,MAAM,QAAQ,OAAO,MAAM,aAAa,KAC3C,KAAI;AACH,mBAAe,KAAK,MAAM,MAAM,SAAS,CAAM;GAC/C,QAAO;AACP,mBAAe,MAAM,SAAyB;GAC9C;EAEF;AAED,SAAO,iBAAiB,WAAW,oBAAoB;AACvD,SAAO,MAAM,OAAO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ACA;EACA;EACA;EACA;CACA;AACD"}
@@ -203,4 +203,4 @@ function useWebSocket(url, options = {}) {
203
203
 
204
204
  //#endregion
205
205
  export { useDebounce, useLocalStorage, useWebSocket };
206
- //# sourceMappingURL=hooks-DBc-Cw9X.mjs.map
206
+ //# sourceMappingURL=hooks-Dhkovxbo.mjs.map