@luxfi/ui 1.0.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 (124) hide show
  1. package/dist/accordion.cjs +213 -0
  2. package/dist/accordion.js +186 -0
  3. package/dist/alert.cjs +553 -0
  4. package/dist/alert.js +531 -0
  5. package/dist/avatar.cjs +149 -0
  6. package/dist/avatar.js +125 -0
  7. package/dist/badge.cjs +611 -0
  8. package/dist/badge.js +589 -0
  9. package/dist/button.cjs +689 -0
  10. package/dist/button.js +664 -0
  11. package/dist/checkbox.cjs +265 -0
  12. package/dist/checkbox.js +241 -0
  13. package/dist/close-button.cjs +73 -0
  14. package/dist/close-button.js +51 -0
  15. package/dist/collapsible.cjs +711 -0
  16. package/dist/collapsible.js +685 -0
  17. package/dist/color-mode.cjs +36 -0
  18. package/dist/color-mode.js +32 -0
  19. package/dist/dialog.cjs +279 -0
  20. package/dist/dialog.js +246 -0
  21. package/dist/drawer.cjs +207 -0
  22. package/dist/drawer.js +175 -0
  23. package/dist/empty-state.cjs +93 -0
  24. package/dist/empty-state.js +71 -0
  25. package/dist/field.cjs +183 -0
  26. package/dist/field.js +160 -0
  27. package/dist/heading.cjs +46 -0
  28. package/dist/heading.js +40 -0
  29. package/dist/icon-button.cjs +491 -0
  30. package/dist/icon-button.js +470 -0
  31. package/dist/image.cjs +572 -0
  32. package/dist/image.js +551 -0
  33. package/dist/index.cjs +5749 -0
  34. package/dist/index.js +5586 -0
  35. package/dist/input-group.cjs +155 -0
  36. package/dist/input-group.js +133 -0
  37. package/dist/input.cjs +65 -0
  38. package/dist/input.js +59 -0
  39. package/dist/link.cjs +639 -0
  40. package/dist/link.js +612 -0
  41. package/dist/menu.cjs +305 -0
  42. package/dist/menu.js +269 -0
  43. package/dist/pin-input.cjs +182 -0
  44. package/dist/pin-input.js +160 -0
  45. package/dist/popover.cjs +327 -0
  46. package/dist/popover.js +294 -0
  47. package/dist/progress-circle.cjs +152 -0
  48. package/dist/progress-circle.js +128 -0
  49. package/dist/progress.cjs +117 -0
  50. package/dist/progress.js +94 -0
  51. package/dist/provider.cjs +22 -0
  52. package/dist/provider.js +20 -0
  53. package/dist/radio.cjs +177 -0
  54. package/dist/radio.js +153 -0
  55. package/dist/rating.cjs +80 -0
  56. package/dist/rating.js +58 -0
  57. package/dist/select.cjs +791 -0
  58. package/dist/select.js +757 -0
  59. package/dist/separator.cjs +57 -0
  60. package/dist/separator.js +51 -0
  61. package/dist/skeleton.cjs +370 -0
  62. package/dist/skeleton.js +346 -0
  63. package/dist/slider.cjs +138 -0
  64. package/dist/slider.js +115 -0
  65. package/dist/switch.cjs +163 -0
  66. package/dist/switch.js +140 -0
  67. package/dist/table.cjs +1053 -0
  68. package/dist/table.js +1019 -0
  69. package/dist/tabs.cjs +240 -0
  70. package/dist/tabs.js +213 -0
  71. package/dist/tag.cjs +651 -0
  72. package/dist/tag.js +628 -0
  73. package/dist/textarea.cjs +65 -0
  74. package/dist/textarea.js +59 -0
  75. package/dist/toaster.cjs +99 -0
  76. package/dist/toaster.js +96 -0
  77. package/dist/tooltip.cjs +171 -0
  78. package/dist/tooltip.js +148 -0
  79. package/dist/utils.cjs +11 -0
  80. package/dist/utils.js +9 -0
  81. package/package.json +296 -0
  82. package/src/accordion.tsx +285 -0
  83. package/src/alert.tsx +221 -0
  84. package/src/avatar.tsx +174 -0
  85. package/src/badge.tsx +158 -0
  86. package/src/button.tsx +411 -0
  87. package/src/checkbox.tsx +307 -0
  88. package/src/close-button.tsx +51 -0
  89. package/src/collapsible.tsx +126 -0
  90. package/src/color-mode.tsx +37 -0
  91. package/src/dialog.tsx +356 -0
  92. package/src/drawer.tsx +186 -0
  93. package/src/empty-state.tsx +97 -0
  94. package/src/field.tsx +202 -0
  95. package/src/heading.tsx +55 -0
  96. package/src/icon-button.tsx +192 -0
  97. package/src/image.tsx +280 -0
  98. package/src/index.ts +192 -0
  99. package/src/input-group.tsx +159 -0
  100. package/src/input.tsx +60 -0
  101. package/src/link.tsx +333 -0
  102. package/src/menu.tsx +471 -0
  103. package/src/pin-input.tsx +187 -0
  104. package/src/popover.tsx +400 -0
  105. package/src/progress-circle.tsx +180 -0
  106. package/src/progress.tsx +109 -0
  107. package/src/provider.tsx +12 -0
  108. package/src/radio.tsx +175 -0
  109. package/src/rating.tsx +79 -0
  110. package/src/select.tsx +696 -0
  111. package/src/separator.tsx +59 -0
  112. package/src/skeleton.tsx +302 -0
  113. package/src/slider.tsx +152 -0
  114. package/src/switch.tsx +158 -0
  115. package/src/table.tsx +621 -0
  116. package/src/tabs.tsx +354 -0
  117. package/src/tag.tsx +159 -0
  118. package/src/textarea.tsx +60 -0
  119. package/src/toaster.tsx +117 -0
  120. package/src/tokens.css +438 -0
  121. package/src/tooltip.tsx +184 -0
  122. package/src/utils/cn.ts +7 -0
  123. package/src/utils.ts +6 -0
  124. package/tokens.css +438 -0
package/dist/table.js ADDED
@@ -0,0 +1,1019 @@
1
+ "use client";
2
+ import { throttle } from 'es-toolkit';
3
+ import * as React3 from 'react';
4
+ import React3__default from 'react';
5
+ import { clsx } from 'clsx';
6
+ import { twMerge } from 'tailwind-merge';
7
+ import NextLink from 'next/link';
8
+ import { jsx, jsxs } from 'react/jsx-runtime';
9
+
10
+ // src/table.tsx
11
+ function cn(...inputs) {
12
+ return twMerge(clsx(inputs));
13
+ }
14
+ var SPACING_SCALE = 4;
15
+ function toStylePx(value) {
16
+ if (value === void 0) return void 0;
17
+ if (typeof value === "string") return value;
18
+ return `${value * SPACING_SCALE}px`;
19
+ }
20
+ function extractSkeletonStyleProps(props) {
21
+ const style = {};
22
+ const rest = {};
23
+ function resolveDimension(value) {
24
+ if (value === void 0 || value === null) return void 0;
25
+ if (typeof value === "number") return `${value * SPACING_SCALE}px`;
26
+ if (typeof value === "string") return value;
27
+ if (typeof value === "object") {
28
+ const obj = value;
29
+ return obj.base ?? obj.lg ?? obj.xl ?? Object.values(obj)[0];
30
+ }
31
+ return void 0;
32
+ }
33
+ for (const [key, value] of Object.entries(props)) {
34
+ if (value === void 0) continue;
35
+ switch (key) {
36
+ case "w": {
37
+ const v = resolveDimension(value);
38
+ if (v) style.width = v;
39
+ break;
40
+ }
41
+ case "h": {
42
+ const v = resolveDimension(value);
43
+ if (v) style.height = v;
44
+ break;
45
+ }
46
+ case "minW": {
47
+ const v = resolveDimension(value);
48
+ if (v) style.minWidth = v;
49
+ break;
50
+ }
51
+ case "maxW": {
52
+ const v = resolveDimension(value);
53
+ if (v) style.maxWidth = v;
54
+ break;
55
+ }
56
+ case "height":
57
+ style.height = value;
58
+ break;
59
+ case "display":
60
+ style.display = value;
61
+ break;
62
+ case "flexGrow":
63
+ style.flexGrow = value;
64
+ break;
65
+ case "flexShrink":
66
+ style.flexShrink = value;
67
+ break;
68
+ case "flexBasis":
69
+ style.flexBasis = value;
70
+ break;
71
+ case "fontWeight":
72
+ style.fontWeight = value;
73
+ break;
74
+ case "borderRadius":
75
+ style.borderRadius = value;
76
+ break;
77
+ case "alignSelf":
78
+ style.alignSelf = value;
79
+ break;
80
+ case "alignItems":
81
+ style.alignItems = value;
82
+ break;
83
+ case "justifyContent":
84
+ style.justifyContent = value;
85
+ break;
86
+ case "color":
87
+ style.color = value;
88
+ break;
89
+ case "mt":
90
+ style.marginTop = toStylePx(value);
91
+ break;
92
+ case "mb":
93
+ style.marginBottom = toStylePx(value);
94
+ break;
95
+ case "ml":
96
+ style.marginLeft = toStylePx(value);
97
+ break;
98
+ case "mr":
99
+ style.marginRight = toStylePx(value);
100
+ break;
101
+ case "overflow":
102
+ style.overflow = value;
103
+ break;
104
+ case "whiteSpace":
105
+ style.whiteSpace = value;
106
+ break;
107
+ case "textOverflow":
108
+ style.textOverflow = value;
109
+ break;
110
+ case "textTransform":
111
+ style.textTransform = value;
112
+ break;
113
+ case "gap":
114
+ style.gap = typeof value === "number" ? `${value * SPACING_SCALE}px` : value;
115
+ break;
116
+ case "gridTemplateColumns":
117
+ style.gridTemplateColumns = value;
118
+ break;
119
+ case "minWidth":
120
+ style.minWidth = value;
121
+ break;
122
+ case "boxSize": {
123
+ const s = typeof value === "number" ? `${value * SPACING_SCALE}px` : value;
124
+ style.width = s;
125
+ style.height = s;
126
+ break;
127
+ }
128
+ case "py": {
129
+ const v = toStylePx(value);
130
+ style.paddingTop = v;
131
+ style.paddingBottom = v;
132
+ break;
133
+ }
134
+ case "px": {
135
+ const v = toStylePx(value);
136
+ style.paddingLeft = v;
137
+ style.paddingRight = v;
138
+ break;
139
+ }
140
+ case "p": {
141
+ const v = toStylePx(value);
142
+ style.padding = v;
143
+ break;
144
+ }
145
+ case "hideBelow":
146
+ break;
147
+ // handled via className
148
+ case "textStyle":
149
+ break;
150
+ // drop textStyle, not directly applicable
151
+ case "fontSize":
152
+ style.fontSize = value;
153
+ break;
154
+ case "flexWrap":
155
+ style.flexWrap = value;
156
+ break;
157
+ case "wordBreak":
158
+ style.wordBreak = value;
159
+ break;
160
+ case "lineHeight":
161
+ style.lineHeight = value;
162
+ break;
163
+ case "marginRight":
164
+ style.marginRight = value;
165
+ break;
166
+ case "position":
167
+ style.position = value;
168
+ break;
169
+ case "background":
170
+ style.background = value;
171
+ break;
172
+ default:
173
+ rest[key] = value;
174
+ break;
175
+ }
176
+ }
177
+ return { style, rest };
178
+ }
179
+ var Skeleton = React3.forwardRef(
180
+ function Skeleton2(props, ref) {
181
+ const {
182
+ loading = false,
183
+ asChild,
184
+ className,
185
+ children,
186
+ style: styleProp,
187
+ // Destructure style-prop shims so they don't leak into DOM
188
+ w: _w,
189
+ h: _h,
190
+ minW: _minW,
191
+ maxW: _maxW,
192
+ display: _display,
193
+ flexGrow: _flexGrow,
194
+ flexShrink: _flexShrink,
195
+ flexBasis: _flexBasis,
196
+ fontWeight: _fontWeight,
197
+ textStyle: _textStyle,
198
+ borderRadius: _borderRadius,
199
+ alignSelf: _alignSelf,
200
+ alignItems: _alignItems,
201
+ justifyContent: _justifyContent,
202
+ color: _color,
203
+ mt: _mt,
204
+ mb: _mb,
205
+ ml: _ml,
206
+ mr: _mr,
207
+ height: _height,
208
+ overflow: _overflow,
209
+ whiteSpace: _whiteSpace,
210
+ textOverflow: _textOverflow,
211
+ textTransform: _textTransform,
212
+ gap: _gap,
213
+ gridTemplateColumns: _gridTemplateColumns,
214
+ minWidth: _minWidth,
215
+ boxSize: _boxSize,
216
+ py: _py,
217
+ px: _px,
218
+ p: _p,
219
+ hideBelow: _hideBelow,
220
+ fontSize: _fontSize,
221
+ flexWrap: _flexWrap,
222
+ wordBreak: _wordBreak,
223
+ lineHeight: _lineHeight,
224
+ marginRight: _marginRight,
225
+ position: _position,
226
+ background: _background,
227
+ as: Component = "div",
228
+ ...htmlRest
229
+ } = props;
230
+ const { style: shimStyle } = extractSkeletonStyleProps({
231
+ w: _w,
232
+ h: _h,
233
+ minW: _minW,
234
+ maxW: _maxW,
235
+ display: _display,
236
+ flexGrow: _flexGrow,
237
+ flexShrink: _flexShrink,
238
+ flexBasis: _flexBasis,
239
+ fontWeight: _fontWeight,
240
+ textStyle: _textStyle,
241
+ borderRadius: _borderRadius,
242
+ alignSelf: _alignSelf,
243
+ alignItems: _alignItems,
244
+ justifyContent: _justifyContent,
245
+ color: _color,
246
+ mt: _mt,
247
+ mb: _mb,
248
+ ml: _ml,
249
+ mr: _mr,
250
+ height: _height,
251
+ overflow: _overflow,
252
+ whiteSpace: _whiteSpace,
253
+ textOverflow: _textOverflow,
254
+ textTransform: _textTransform,
255
+ gap: _gap,
256
+ gridTemplateColumns: _gridTemplateColumns,
257
+ minWidth: _minWidth,
258
+ boxSize: _boxSize,
259
+ py: _py,
260
+ px: _px,
261
+ p: _p,
262
+ hideBelow: _hideBelow,
263
+ fontSize: _fontSize,
264
+ flexWrap: _flexWrap,
265
+ wordBreak: _wordBreak,
266
+ lineHeight: _lineHeight,
267
+ marginRight: _marginRight,
268
+ position: _position,
269
+ background: _background
270
+ });
271
+ const mergedStyle = Object.keys(shimStyle).length > 0 || styleProp ? { ...shimStyle, ...styleProp } : void 0;
272
+ const HIDE_BELOW_MAP = { lg: "lg:hidden", md: "md:hidden", sm: "sm:hidden" };
273
+ const hideBelowClass = _hideBelow ? HIDE_BELOW_MAP[_hideBelow] : void 0;
274
+ const finalClassName = hideBelowClass ? cn(className, hideBelowClass) : className;
275
+ if (!loading) {
276
+ if (asChild && React3.isValidElement(children)) {
277
+ return children;
278
+ }
279
+ return /* @__PURE__ */ jsx(Component, { ref, className: finalClassName, style: mergedStyle, ...htmlRest, children });
280
+ }
281
+ if (asChild && React3.isValidElement(children)) {
282
+ return /* @__PURE__ */ jsx(
283
+ Component,
284
+ {
285
+ ref,
286
+ "data-loading": true,
287
+ className: cn(
288
+ "animate-skeleton-shimmer rounded-sm",
289
+ "bg-[linear-gradient(90deg,var(--color-skeleton-start)_0%,var(--color-skeleton-end)_50%,var(--color-skeleton-start)_100%)]",
290
+ "bg-[length:200%_100%]",
291
+ "text-transparent [&_*]:invisible",
292
+ finalClassName
293
+ ),
294
+ style: mergedStyle,
295
+ ...htmlRest,
296
+ children
297
+ }
298
+ );
299
+ }
300
+ return /* @__PURE__ */ jsx(
301
+ Component,
302
+ {
303
+ ref,
304
+ "data-loading": true,
305
+ className: cn(
306
+ "animate-skeleton-shimmer rounded-sm",
307
+ "bg-[linear-gradient(90deg,var(--color-skeleton-start)_0%,var(--color-skeleton-end)_50%,var(--color-skeleton-start)_100%)]",
308
+ "bg-[length:200%_100%]",
309
+ children ? "text-transparent [&_*]:invisible" : "min-h-5",
310
+ finalClassName
311
+ ),
312
+ style: mergedStyle,
313
+ ...htmlRest,
314
+ children
315
+ }
316
+ );
317
+ }
318
+ );
319
+ React3.forwardRef(
320
+ function SkeletonCircle2(props, ref) {
321
+ const { size = 40, loading = true, className, ...rest } = props;
322
+ const dimension = typeof size === "number" ? `${size}px` : size;
323
+ return /* @__PURE__ */ jsx(
324
+ Skeleton,
325
+ {
326
+ ref,
327
+ loading,
328
+ className: cn("rounded-full shrink-0", className),
329
+ style: { width: dimension, height: dimension, ...rest.style },
330
+ ...rest
331
+ }
332
+ );
333
+ }
334
+ );
335
+ React3.forwardRef(
336
+ function SkeletonText2(props, ref) {
337
+ const { noOfLines = 3, loading = true, className, ...rest } = props;
338
+ return /* @__PURE__ */ jsx("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...rest, children: Array.from({ length: noOfLines }).map((_, index) => /* @__PURE__ */ jsx(
339
+ Skeleton,
340
+ {
341
+ loading,
342
+ className: cn("h-4", index === noOfLines - 1 && "max-w-[80%]")
343
+ },
344
+ index
345
+ )) });
346
+ }
347
+ );
348
+ var ArrowIcon = ({ className, style }) => /* @__PURE__ */ jsx("svg", { className, style, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M11 3h6v6M17 3L7 13M14 11v6H3V6h6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
349
+ function stripUtmParams(url) {
350
+ try {
351
+ const urlObj = new URL(url);
352
+ for (const param of ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"]) {
353
+ urlObj.searchParams.delete(param);
354
+ }
355
+ return urlObj.toString();
356
+ } catch {
357
+ return url;
358
+ }
359
+ }
360
+ var VARIANT_CLASSES = {
361
+ primary: cn(
362
+ "text-[var(--color-link-primary)]",
363
+ "hover:no-underline hover:text-[var(--color-link-primary-hover)]",
364
+ "data-[hover]:no-underline data-[hover]:text-[var(--color-link-primary-hover)]"
365
+ ),
366
+ secondary: cn(
367
+ "text-[var(--color-link-secondary)]",
368
+ "hover:no-underline hover:text-[var(--color-hover)]",
369
+ "data-[hover]:no-underline data-[hover]:text-[var(--color-hover)]"
370
+ ),
371
+ subtle: cn(
372
+ "text-[var(--color-link-subtle)]",
373
+ "hover:text-[var(--color-link-subtle-hover)] hover:underline hover:decoration-[var(--color-link-subtle-hover)]",
374
+ "data-[hover]:text-[var(--color-link-subtle-hover)] data-[hover]:underline data-[hover]:decoration-[var(--color-link-subtle-hover)]"
375
+ ),
376
+ underlaid: cn(
377
+ "text-[var(--color-link-primary)] bg-[var(--color-link-underlaid-bg)]",
378
+ "px-2 py-1.5 rounded-md text-sm",
379
+ "hover:text-[var(--color-link-primary-hover)] hover:no-underline",
380
+ "data-[hover]:text-[var(--color-link-primary-hover)] data-[hover]:no-underline"
381
+ ),
382
+ menu: cn(
383
+ "text-[var(--color-link-menu)]",
384
+ "hover:text-[var(--color-hover)] hover:no-underline",
385
+ "data-[hover]:text-[var(--color-hover)] data-[hover]:no-underline"
386
+ ),
387
+ navigation: cn(
388
+ "text-[var(--color-link-nav-fg)] bg-transparent",
389
+ "hover:text-[var(--color-link-nav-fg-hover)] hover:no-underline",
390
+ "data-[hover]:text-[var(--color-link-nav-fg-hover)] data-[hover]:no-underline",
391
+ "data-[selected]:text-[var(--color-link-nav-fg-selected)] data-[selected]:bg-[var(--color-link-nav-bg-selected)]",
392
+ "data-[active]:text-[var(--color-link-nav-fg-active)]"
393
+ ),
394
+ plain: cn(
395
+ "text-inherit",
396
+ "hover:no-underline",
397
+ "data-[hover]:no-underline"
398
+ )
399
+ };
400
+ var BASE_CLASSES = "inline-flex items-center gap-0 cursor-pointer data-[disabled]:cursor-not-allowed";
401
+ var LinkExternalIcon = ({ color }) => /* @__PURE__ */ jsx(
402
+ ArrowIcon,
403
+ {
404
+ className: cn(
405
+ "size-3 align-middle shrink-0",
406
+ "group-hover:text-inherit"
407
+ ),
408
+ style: color ? { color } : { color: "var(--color-icon-secondary)" },
409
+ "aria-hidden": "true"
410
+ }
411
+ );
412
+ var splitProps = (props) => {
413
+ const { scroll = true, shallow = false, prefetch = false, ...rest } = props;
414
+ return {
415
+ own: rest,
416
+ next: {
417
+ href: rest.href ?? "",
418
+ scroll,
419
+ shallow,
420
+ prefetch
421
+ }
422
+ };
423
+ };
424
+ var SPACING = 4;
425
+ function resolveSpacing(v) {
426
+ if (v === void 0) return void 0;
427
+ if (typeof v === "number") return `${v * SPACING}px`;
428
+ if (typeof v === "string") return v;
429
+ if (typeof v === "object" && v !== null) {
430
+ const base = v.base;
431
+ if (base !== void 0) return typeof base === "number" ? `${base * SPACING}px` : base;
432
+ const lg = v.lg;
433
+ if (lg !== void 0) return typeof lg === "number" ? `${lg * SPACING}px` : lg;
434
+ }
435
+ return void 0;
436
+ }
437
+ var Link = React3__default.forwardRef(
438
+ function Link2(props, ref) {
439
+ const { own, next } = splitProps(props);
440
+ const {
441
+ external,
442
+ loading,
443
+ href,
444
+ children,
445
+ disabled,
446
+ noIcon,
447
+ iconColor,
448
+ variant = "primary",
449
+ className,
450
+ asChild: _asChild,
451
+ // Strip Chakra style props
452
+ fontWeight: _fontWeight,
453
+ whiteSpace: _whiteSpace,
454
+ wordBreak: _wordBreak,
455
+ textStyle: _textStyle,
456
+ ml: _ml,
457
+ mr: _mr,
458
+ display: _display,
459
+ alignItems: _alignItems,
460
+ flexShrink: _flexShrink,
461
+ minW: _minW,
462
+ justifyContent: _justifyContent,
463
+ position: _position,
464
+ ...rest
465
+ } = own;
466
+ const shimStyle = {};
467
+ if (_fontWeight !== void 0) shimStyle.fontWeight = _fontWeight;
468
+ if (_whiteSpace) shimStyle.whiteSpace = _whiteSpace;
469
+ if (_wordBreak) shimStyle.wordBreak = _wordBreak;
470
+ if (_ml !== void 0) shimStyle.marginLeft = resolveSpacing(_ml);
471
+ if (_mr !== void 0) shimStyle.marginRight = resolveSpacing(_mr);
472
+ if (_display) shimStyle.display = _display;
473
+ if (_alignItems) shimStyle.alignItems = _alignItems;
474
+ if (_flexShrink !== void 0) shimStyle.flexShrink = _flexShrink;
475
+ if (_minW !== void 0) shimStyle.minWidth = typeof _minW === "number" ? `${_minW * SPACING}px` : _minW;
476
+ if (_justifyContent) shimStyle.justifyContent = _justifyContent;
477
+ if (_position) shimStyle.position = _position;
478
+ const linkClasses = cn(BASE_CLASSES, VARIANT_CLASSES[variant], className);
479
+ const linkStyle = Object.keys(shimStyle).length > 0 ? shimStyle : void 0;
480
+ if (external) {
481
+ const processedHref = typeof href === "string" ? stripUtmParams(href) : href;
482
+ return /* @__PURE__ */ jsx(Skeleton, { loading, ref, asChild: true, children: /* @__PURE__ */ jsxs(
483
+ "a",
484
+ {
485
+ href: processedHref,
486
+ className: cn("group", linkClasses),
487
+ style: linkStyle,
488
+ target: "_blank",
489
+ rel: "noopener noreferrer",
490
+ ...disabled ? { "data-disabled": true } : {},
491
+ ...rest,
492
+ children: [
493
+ children,
494
+ !noIcon && /* @__PURE__ */ jsx(LinkExternalIcon, { color: iconColor })
495
+ ]
496
+ }
497
+ ) });
498
+ }
499
+ return /* @__PURE__ */ jsx(Skeleton, { loading, ref, asChild: true, children: next.href ? /* @__PURE__ */ jsx(
500
+ NextLink,
501
+ {
502
+ ...next,
503
+ className: linkClasses,
504
+ style: linkStyle,
505
+ ...disabled ? { "data-disabled": true } : {},
506
+ ...rest,
507
+ children
508
+ }
509
+ ) : /* @__PURE__ */ jsx(
510
+ "span",
511
+ {
512
+ className: linkClasses,
513
+ ...disabled ? { "data-disabled": true } : {},
514
+ ...rest,
515
+ children
516
+ }
517
+ ) });
518
+ }
519
+ );
520
+ React3__default.forwardRef(
521
+ function LinkBox2(props, ref) {
522
+ const { className, ...rest } = props;
523
+ return /* @__PURE__ */ jsx(
524
+ "div",
525
+ {
526
+ ref,
527
+ className: cn("relative", className),
528
+ ...rest
529
+ }
530
+ );
531
+ }
532
+ );
533
+ React3__default.forwardRef(
534
+ function LinkOverlay2(props, ref) {
535
+ const { own, next } = splitProps(props);
536
+ const {
537
+ children,
538
+ external,
539
+ loading,
540
+ href,
541
+ noIcon,
542
+ iconColor,
543
+ variant = "primary",
544
+ className,
545
+ disabled,
546
+ asChild: _asChild2,
547
+ fontWeight: _fw2,
548
+ whiteSpace: _ws2,
549
+ wordBreak: _wb2,
550
+ textStyle: _ts2,
551
+ ml: _ml2,
552
+ mr: _mr2,
553
+ display: _d2,
554
+ alignItems: _ai2,
555
+ flexShrink: _fs2,
556
+ minW: _mw2,
557
+ justifyContent: _jc2,
558
+ position: _p2,
559
+ ...rest
560
+ } = own;
561
+ const overlayClasses = cn(
562
+ BASE_CLASSES,
563
+ VARIANT_CLASSES[variant],
564
+ // Static positioning with a ::before pseudo-element that covers the LinkBox
565
+ "static",
566
+ 'before:absolute before:inset-0 before:z-0 before:content-[""]',
567
+ className
568
+ );
569
+ if (external) {
570
+ const processedHref = typeof href === "string" ? stripUtmParams(href) : href;
571
+ return /* @__PURE__ */ jsx(
572
+ "a",
573
+ {
574
+ ref,
575
+ href: loading ? void 0 : processedHref,
576
+ className: overlayClasses,
577
+ target: "_blank",
578
+ rel: "noopener noreferrer",
579
+ ...rest,
580
+ children: (children || !noIcon && href) && /* @__PURE__ */ jsxs(Skeleton, { display: "inline-flex", alignItems: "center", loading, maxW: "100%", h: "100%", children: [
581
+ children,
582
+ !noIcon && href && /* @__PURE__ */ jsx(LinkExternalIcon, { color: iconColor })
583
+ ] })
584
+ }
585
+ );
586
+ }
587
+ const content = children ? /* @__PURE__ */ jsx(Skeleton, { display: "inline-flex", alignItems: "center", loading, maxW: "100%", h: "100%", children }) : null;
588
+ if (next.href) {
589
+ const anchorRest = rest;
590
+ return /* @__PURE__ */ jsx(
591
+ NextLink,
592
+ {
593
+ ref,
594
+ ...next,
595
+ className: overlayClasses,
596
+ ...anchorRest,
597
+ children: content
598
+ }
599
+ );
600
+ }
601
+ return /* @__PURE__ */ jsx(
602
+ "span",
603
+ {
604
+ ref,
605
+ className: overlayClasses,
606
+ ...rest,
607
+ children: content
608
+ }
609
+ );
610
+ }
611
+ );
612
+ var ArrowIcon2 = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M5 12h14M12 5l7 7-7 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
613
+ var SPACING_SCALE2 = 4;
614
+ function toPixels(value) {
615
+ if (value === void 0) return void 0;
616
+ if (typeof value === "string") return value;
617
+ return `${value * SPACING_SCALE2}px`;
618
+ }
619
+ function extractStyles(props) {
620
+ const style = {};
621
+ const rest = {};
622
+ for (const [key, value] of Object.entries(props)) {
623
+ if (value === void 0) continue;
624
+ switch (key) {
625
+ case "width":
626
+ case "w":
627
+ style.width = value;
628
+ break;
629
+ case "minWidth":
630
+ case "minW":
631
+ style.minWidth = value;
632
+ break;
633
+ case "maxWidth":
634
+ case "maxW":
635
+ style.maxWidth = value;
636
+ break;
637
+ case "height":
638
+ case "h":
639
+ style.height = value;
640
+ break;
641
+ case "textAlign":
642
+ style.textAlign = value;
643
+ break;
644
+ case "verticalAlign":
645
+ style.verticalAlign = value;
646
+ break;
647
+ case "whiteSpace":
648
+ style.whiteSpace = value;
649
+ break;
650
+ case "wordBreak":
651
+ style.wordBreak = value;
652
+ break;
653
+ case "textTransform":
654
+ style.textTransform = value;
655
+ break;
656
+ case "fontSize":
657
+ style.fontSize = value;
658
+ break;
659
+ case "lineHeight":
660
+ style.lineHeight = value;
661
+ break;
662
+ case "animation":
663
+ style.animation = value;
664
+ break;
665
+ case "tableLayout":
666
+ style.tableLayout = value;
667
+ break;
668
+ case "p":
669
+ style.padding = toPixels(value);
670
+ break;
671
+ case "px": {
672
+ const px = toPixels(value);
673
+ style.paddingLeft = px;
674
+ style.paddingRight = px;
675
+ break;
676
+ }
677
+ case "py": {
678
+ const py = toPixels(value);
679
+ style.paddingTop = py;
680
+ style.paddingBottom = py;
681
+ break;
682
+ }
683
+ case "pr":
684
+ style.paddingRight = toPixels(value);
685
+ break;
686
+ case "pl":
687
+ style.paddingLeft = toPixels(value);
688
+ break;
689
+ case "pt":
690
+ style.paddingTop = toPixels(value);
691
+ break;
692
+ case "pb":
693
+ style.paddingBottom = toPixels(value);
694
+ break;
695
+ case "m":
696
+ style.margin = toPixels(value);
697
+ break;
698
+ case "mx": {
699
+ const mx = toPixels(value);
700
+ style.marginLeft = mx;
701
+ style.marginRight = mx;
702
+ break;
703
+ }
704
+ case "my": {
705
+ const my = toPixels(value);
706
+ style.marginTop = my;
707
+ style.marginBottom = my;
708
+ break;
709
+ }
710
+ case "mr":
711
+ style.marginRight = toPixels(value);
712
+ break;
713
+ case "ml":
714
+ style.marginLeft = toPixels(value);
715
+ break;
716
+ case "mt":
717
+ style.marginTop = toPixels(value);
718
+ break;
719
+ case "mb":
720
+ style.marginBottom = toPixels(value);
721
+ break;
722
+ case "position":
723
+ style.position = value;
724
+ break;
725
+ case "top":
726
+ style.top = typeof value === "number" ? `${value}px` : value;
727
+ break;
728
+ case "left":
729
+ style.left = typeof value === "number" ? `${value}px` : value;
730
+ break;
731
+ case "right":
732
+ style.right = typeof value === "number" ? `${value}px` : value;
733
+ break;
734
+ case "bottom":
735
+ style.bottom = typeof value === "number" ? `${value}px` : value;
736
+ break;
737
+ case "zIndex":
738
+ style.zIndex = value;
739
+ break;
740
+ case "backgroundColor":
741
+ if (typeof value === "string") {
742
+ style.backgroundColor = value;
743
+ }
744
+ break;
745
+ case "boxShadow":
746
+ style.boxShadow = value;
747
+ break;
748
+ case "alignItems":
749
+ style.alignItems = value;
750
+ break;
751
+ case "fontWeight":
752
+ style.fontWeight = value;
753
+ break;
754
+ case "color":
755
+ if (typeof value === "string") {
756
+ style.color = value;
757
+ }
758
+ break;
759
+ case "overflow":
760
+ style.overflow = value;
761
+ break;
762
+ case "borderBottomStyle":
763
+ style.borderBottomStyle = value;
764
+ break;
765
+ case "borderRadius":
766
+ style.borderRadius = value;
767
+ break;
768
+ case "display":
769
+ style.display = value;
770
+ break;
771
+ // Chakra pseudo-props: silently drop
772
+ case "_first":
773
+ case "_last":
774
+ break;
775
+ default:
776
+ rest[key] = value;
777
+ break;
778
+ }
779
+ }
780
+ return { style, rest };
781
+ }
782
+ function resolveResponsive(value) {
783
+ if (value === void 0 || value === null) return void 0;
784
+ if (typeof value === "string") return value;
785
+ if (typeof value === "number") return `${value}px`;
786
+ if (typeof value === "object" && value !== null && "base" in value) {
787
+ return value.base;
788
+ }
789
+ return void 0;
790
+ }
791
+ var TableRoot = React3.forwardRef(
792
+ function TableRoot2(props, ref) {
793
+ const { className, style: styleProp, children, ...other } = props;
794
+ const rawMinW = other.minWidth ?? other.minW;
795
+ const resolvedMinW = resolveResponsive(rawMinW);
796
+ if (resolvedMinW) {
797
+ other.minWidth = resolvedMinW;
798
+ delete other.minW;
799
+ }
800
+ const { style: extracted, rest } = extractStyles(other);
801
+ const merged = { ...extracted, ...styleProp };
802
+ return /* @__PURE__ */ jsx(
803
+ "table",
804
+ {
805
+ ref,
806
+ className: cn("w-full border-collapse text-sm", className),
807
+ style: merged,
808
+ ...rest,
809
+ children
810
+ }
811
+ );
812
+ }
813
+ );
814
+ var TableHeader = React3.forwardRef(
815
+ function TableHeader2(props, ref) {
816
+ const { className, style: styleProp, children, ...other } = props;
817
+ const { style: extracted, rest } = extractStyles(other);
818
+ const merged = { ...extracted, ...styleProp };
819
+ return /* @__PURE__ */ jsx(
820
+ "thead",
821
+ {
822
+ ref,
823
+ className: cn("", className),
824
+ style: merged,
825
+ ...rest,
826
+ children
827
+ }
828
+ );
829
+ }
830
+ );
831
+ var TableBody = React3.forwardRef(
832
+ function TableBody2(props, ref) {
833
+ const { className, style: styleProp, children, ...other } = props;
834
+ const { style: extracted, rest } = extractStyles(other);
835
+ const merged = { ...extracted, ...styleProp };
836
+ return /* @__PURE__ */ jsx(
837
+ "tbody",
838
+ {
839
+ ref,
840
+ className: cn("", className),
841
+ style: merged,
842
+ ...rest,
843
+ children
844
+ }
845
+ );
846
+ }
847
+ );
848
+ var TableRow = React3.forwardRef(
849
+ function TableRow2(props, ref) {
850
+ const { className, style: styleProp, children, ...other } = props;
851
+ const { style: extracted, rest } = extractStyles(other);
852
+ const merged = { ...extracted, ...styleProp };
853
+ return /* @__PURE__ */ jsx(
854
+ "tr",
855
+ {
856
+ ref,
857
+ className: cn("", className),
858
+ style: merged,
859
+ ...rest,
860
+ children
861
+ }
862
+ );
863
+ }
864
+ );
865
+ var TableCell = React3.forwardRef(
866
+ function TableCell2(props, ref) {
867
+ const { isNumeric, className, style: styleProp, children, ...other } = props;
868
+ const { style: extracted, rest } = extractStyles(other);
869
+ const merged = {
870
+ ...isNumeric ? { textAlign: "right" } : {},
871
+ ...extracted,
872
+ ...styleProp
873
+ };
874
+ return /* @__PURE__ */ jsx(
875
+ "td",
876
+ {
877
+ ref,
878
+ className: cn("px-3 py-2.5 align-top text-sm", className),
879
+ style: merged,
880
+ ...rest,
881
+ children
882
+ }
883
+ );
884
+ }
885
+ );
886
+ var TableColumnHeader = React3.forwardRef(
887
+ function TableColumnHeader2(props, ref) {
888
+ const { isNumeric, className, style: styleProp, children, ...other } = props;
889
+ const { style: extracted, rest } = extractStyles(other);
890
+ const merged = {
891
+ ...isNumeric ? { textAlign: "right" } : {},
892
+ ...extracted,
893
+ ...styleProp
894
+ };
895
+ return /* @__PURE__ */ jsx(
896
+ "th",
897
+ {
898
+ ref,
899
+ className: cn(
900
+ "px-3 py-2 text-xs font-semibold uppercase tracking-wider",
901
+ "bg-[var(--color-table-header-bg)] text-[var(--color-table-header-fg)]",
902
+ className
903
+ ),
904
+ style: merged,
905
+ ...rest,
906
+ children
907
+ }
908
+ );
909
+ }
910
+ );
911
+ var TableColumnHeaderSortable = (props) => {
912
+ const { sortField, sortValue, onSortToggle, children, disabled, indicatorPosition = "left", contentAfter, ...rest } = props;
913
+ const handleSortToggle = React3.useCallback(() => {
914
+ onSortToggle(sortField);
915
+ }, [onSortToggle, sortField]);
916
+ const isActive = sortValue.includes(sortField);
917
+ const isAsc = sortValue.toLowerCase().includes("asc");
918
+ return /* @__PURE__ */ jsxs(TableColumnHeader, { ...rest, children: [
919
+ /* @__PURE__ */ jsxs(Link, { onClick: disabled ? void 0 : handleSortToggle, className: "relative", children: [
920
+ isActive && /* @__PURE__ */ jsx(
921
+ "span",
922
+ {
923
+ className: cn(
924
+ "absolute top-0 inline-flex h-full w-4 items-center",
925
+ indicatorPosition === "left" ? "-left-5" : "-right-5",
926
+ isAsc ? "-rotate-90" : "rotate-90"
927
+ ),
928
+ children: /* @__PURE__ */ jsx(ArrowIcon2, { className: "h-4 w-4" })
929
+ }
930
+ ),
931
+ children
932
+ ] }),
933
+ contentAfter
934
+ ] });
935
+ };
936
+ var ACTION_BAR_SHADOW = "0 4px 4px -4px rgb(0 0 0 / 10%), 0 2px 4px -4px rgb(0 0 0 / 6%)";
937
+ var TableHeaderSticky = (props) => {
938
+ const { top, children, className, style: styleProp, ...rest } = props;
939
+ const ref = React3.useRef(null);
940
+ const [isStuck, setIsStuck] = React3.useState(false);
941
+ const handleScroll = React3.useCallback(() => {
942
+ if (Number(ref.current?.getBoundingClientRect().y) <= (Number(top) || 0)) {
943
+ setIsStuck(true);
944
+ } else {
945
+ setIsStuck(false);
946
+ }
947
+ }, [top]);
948
+ React3.useEffect(() => {
949
+ const throttledHandleScroll = throttle(handleScroll, 300);
950
+ window.addEventListener("scroll", throttledHandleScroll);
951
+ return () => {
952
+ window.removeEventListener("scroll", throttledHandleScroll);
953
+ };
954
+ }, [handleScroll]);
955
+ return /* @__PURE__ */ jsx(
956
+ TableHeader,
957
+ {
958
+ ref,
959
+ className: cn("sticky z-[1] bg-white dark:bg-black", className),
960
+ style: {
961
+ top: top ? `${top}px` : 0,
962
+ boxShadow: isStuck ? ACTION_BAR_SHADOW : "none",
963
+ ...styleProp
964
+ },
965
+ ...rest,
966
+ children
967
+ }
968
+ );
969
+ };
970
+ var TableCaption = React3.forwardRef(
971
+ function TableCaption2(props, ref) {
972
+ const { className, style: styleProp, children, ...other } = props;
973
+ const { style: extracted, rest } = extractStyles(other);
974
+ const merged = { ...extracted, ...styleProp };
975
+ return /* @__PURE__ */ jsx(
976
+ "caption",
977
+ {
978
+ ref,
979
+ className: cn("px-3 py-2 text-sm text-[var(--color-table-header-fg)]", className),
980
+ style: merged,
981
+ ...rest,
982
+ children
983
+ }
984
+ );
985
+ }
986
+ );
987
+ var TableFooter = React3.forwardRef(
988
+ function TableFooter2(props, ref) {
989
+ const { className, style: styleProp, children, ...other } = props;
990
+ const { style: extracted, rest } = extractStyles(other);
991
+ const merged = { ...extracted, ...styleProp };
992
+ return /* @__PURE__ */ jsx(
993
+ "tfoot",
994
+ {
995
+ ref,
996
+ className: cn("", className),
997
+ style: merged,
998
+ ...rest,
999
+ children
1000
+ }
1001
+ );
1002
+ }
1003
+ );
1004
+ var TableScrollWrapper = React3.forwardRef(
1005
+ function TableScrollWrapper2(props, ref) {
1006
+ const { className, children, ...rest } = props;
1007
+ return /* @__PURE__ */ jsx(
1008
+ "div",
1009
+ {
1010
+ ref,
1011
+ className: cn("w-full overflow-x-auto", className),
1012
+ ...rest,
1013
+ children
1014
+ }
1015
+ );
1016
+ }
1017
+ );
1018
+
1019
+ export { TableBody, TableCaption, TableCell, TableColumnHeader, TableColumnHeaderSortable, TableFooter, TableHeader, TableHeaderSticky, TableRoot, TableRow, TableScrollWrapper };