@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
@@ -0,0 +1,685 @@
1
+ "use client";
2
+ import * as Collapsible from '@radix-ui/react-collapsible';
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/collapsible.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
+ function useUpdateEffect(effect, deps) {
613
+ const isFirstMount = React3__default.useRef(true);
614
+ React3__default.useEffect(() => {
615
+ if (isFirstMount.current) {
616
+ isFirstMount.current = false;
617
+ return;
618
+ }
619
+ return effect();
620
+ }, deps);
621
+ }
622
+ function scrollToElement(id) {
623
+ const el = document.getElementById(id);
624
+ if (el) {
625
+ el.scrollIntoView({ behavior: "smooth", block: "start" });
626
+ }
627
+ }
628
+ var CUT_ID = "CollapsibleDetails";
629
+ var CollapsibleDetails = (props) => {
630
+ const { children, id = CUT_ID, onClick, isExpanded: isExpandedProp = false, text: textProp, loading, noScroll, ...rest } = props;
631
+ const [isExpanded, setIsExpanded] = React3__default.useState(isExpandedProp);
632
+ const handleClick = React3__default.useCallback((event) => {
633
+ setIsExpanded((flag) => !flag);
634
+ if (!noScroll) {
635
+ scrollToElement(id);
636
+ }
637
+ onClick?.(event);
638
+ }, [id, noScroll, onClick]);
639
+ useUpdateEffect(() => {
640
+ setIsExpanded(isExpandedProp);
641
+ if (isExpandedProp && !noScroll) {
642
+ scrollToElement(id);
643
+ }
644
+ }, [isExpandedProp, id, noScroll]);
645
+ const text = isExpanded ? textProp?.[1] ?? "Hide details" : textProp?.[0] ?? "View details";
646
+ return /* @__PURE__ */ jsxs(Collapsible.Root, { open: isExpanded, children: [
647
+ /* @__PURE__ */ jsx(Collapsible.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
648
+ Link,
649
+ {
650
+ className: "text-sm underline decoration-dashed w-fit",
651
+ onClick: handleClick,
652
+ loading,
653
+ ...rest,
654
+ children: /* @__PURE__ */ jsx("span", { id, children: text })
655
+ }
656
+ ) }),
657
+ /* @__PURE__ */ jsx(Collapsible.Content, { children })
658
+ ] });
659
+ };
660
+ var CollapsibleList = (props) => {
661
+ const CUT_LENGTH = 3;
662
+ const { items, renderItem, triggerProps, cutLength = CUT_LENGTH, text: textProp, defaultExpanded = false, className, ...rest } = props;
663
+ const [isExpanded, setIsExpanded] = React3__default.useState(defaultExpanded);
664
+ React3__default.useEffect(() => {
665
+ setIsExpanded(defaultExpanded);
666
+ }, [defaultExpanded]);
667
+ const handleToggle = React3__default.useCallback(() => {
668
+ setIsExpanded((flag) => !flag);
669
+ }, []);
670
+ const text = isExpanded ? textProp?.[1] ?? "Hide" : textProp?.[0] ?? "Show all";
671
+ return /* @__PURE__ */ jsx(Collapsible.Root, { open: isExpanded, children: /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col w-full", className), ...rest, children: [
672
+ items.slice(0, isExpanded ? void 0 : cutLength).map(renderItem),
673
+ items.length > cutLength && /* @__PURE__ */ jsx(Collapsible.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
674
+ Link,
675
+ {
676
+ className: "text-sm underline decoration-dashed w-fit min-w-0",
677
+ onClick: handleToggle,
678
+ ...triggerProps,
679
+ children: text
680
+ }
681
+ ) })
682
+ ] }) });
683
+ };
684
+
685
+ export { CollapsibleDetails, CollapsibleList };