@luxfi/ui 6.1.3 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/dist/accordion.cjs +213 -0
  2. package/dist/accordion.d.cts +74 -0
  3. package/dist/accordion.d.ts +74 -0
  4. package/dist/accordion.js +186 -0
  5. package/dist/alert.cjs +430 -0
  6. package/dist/alert.d.cts +30 -0
  7. package/dist/alert.d.ts +30 -0
  8. package/dist/alert.js +408 -0
  9. package/dist/avatar.cjs +149 -0
  10. package/dist/avatar.d.cts +25 -0
  11. package/dist/avatar.d.ts +25 -0
  12. package/dist/avatar.js +125 -0
  13. package/dist/badge.cjs +452 -0
  14. package/dist/badge.d.cts +19 -0
  15. package/dist/badge.d.ts +19 -0
  16. package/dist/badge.js +431 -0
  17. package/dist/bank.cjs +272 -0
  18. package/dist/bank.d.cts +76 -0
  19. package/dist/bank.d.ts +76 -0
  20. package/dist/bank.js +258 -0
  21. package/dist/button.cjs +578 -0
  22. package/dist/button.d.cts +55 -0
  23. package/dist/button.d.ts +55 -0
  24. package/dist/button.js +553 -0
  25. package/dist/checkbox.cjs +265 -0
  26. package/dist/checkbox.d.cts +31 -0
  27. package/dist/checkbox.d.ts +31 -0
  28. package/dist/checkbox.js +241 -0
  29. package/dist/close-button.cjs +92 -0
  30. package/dist/close-button.d.cts +9 -0
  31. package/dist/close-button.d.ts +9 -0
  32. package/dist/close-button.js +70 -0
  33. package/dist/collapsible.cjs +555 -0
  34. package/dist/collapsible.d.cts +23 -0
  35. package/dist/collapsible.d.ts +23 -0
  36. package/dist/collapsible.js +532 -0
  37. package/dist/color-mode.cjs +96 -0
  38. package/dist/color-mode.d.cts +25 -0
  39. package/dist/color-mode.d.ts +25 -0
  40. package/dist/color-mode.js +72 -0
  41. package/dist/dialog.cjs +295 -0
  42. package/dist/dialog.d.cts +65 -0
  43. package/dist/dialog.d.ts +65 -0
  44. package/dist/dialog.js +263 -0
  45. package/dist/drawer.cjs +231 -0
  46. package/dist/drawer.d.cts +36 -0
  47. package/dist/drawer.d.ts +36 -0
  48. package/dist/drawer.js +199 -0
  49. package/dist/empty-state.cjs +93 -0
  50. package/dist/empty-state.d.cts +13 -0
  51. package/dist/empty-state.d.ts +13 -0
  52. package/dist/empty-state.js +71 -0
  53. package/dist/expiration-selector.cjs +138 -0
  54. package/dist/expiration-selector.d.cts +16 -0
  55. package/dist/expiration-selector.d.ts +16 -0
  56. package/dist/expiration-selector.js +116 -0
  57. package/dist/field.cjs +183 -0
  58. package/dist/field.d.cts +24 -0
  59. package/dist/field.d.ts +24 -0
  60. package/dist/field.js +160 -0
  61. package/dist/greeks-display.cjs +114 -0
  62. package/dist/greeks-display.d.cts +14 -0
  63. package/dist/greeks-display.d.ts +14 -0
  64. package/dist/greeks-display.js +92 -0
  65. package/dist/heading.cjs +41 -0
  66. package/dist/heading.d.cts +10 -0
  67. package/dist/heading.d.ts +10 -0
  68. package/dist/heading.js +35 -0
  69. package/dist/icon-button.cjs +367 -0
  70. package/dist/icon-button.d.cts +33 -0
  71. package/dist/icon-button.d.ts +33 -0
  72. package/dist/icon-button.js +345 -0
  73. package/dist/image.cjs +425 -0
  74. package/dist/image.d.cts +57 -0
  75. package/dist/image.d.ts +57 -0
  76. package/dist/image.js +404 -0
  77. package/dist/index.cjs +7220 -0
  78. package/dist/index.d.cts +55 -0
  79. package/dist/index.d.ts +55 -0
  80. package/dist/index.js +7043 -0
  81. package/dist/input-group.cjs +155 -0
  82. package/dist/input-group.d.cts +17 -0
  83. package/dist/input-group.d.ts +17 -0
  84. package/dist/input-group.js +133 -0
  85. package/dist/input.cjs +65 -0
  86. package/dist/input.d.cts +11 -0
  87. package/dist/input.d.ts +11 -0
  88. package/dist/input.js +59 -0
  89. package/dist/link.cjs +483 -0
  90. package/dist/link.d.cts +37 -0
  91. package/dist/link.d.ts +37 -0
  92. package/dist/link.js +459 -0
  93. package/dist/menu.cjs +305 -0
  94. package/dist/menu.d.cts +84 -0
  95. package/dist/menu.d.ts +84 -0
  96. package/dist/menu.js +269 -0
  97. package/dist/option-chain.cjs +221 -0
  98. package/dist/option-chain.d.cts +37 -0
  99. package/dist/option-chain.d.ts +37 -0
  100. package/dist/option-chain.js +199 -0
  101. package/dist/option-position.cjs +164 -0
  102. package/dist/option-position.d.cts +29 -0
  103. package/dist/option-position.d.ts +29 -0
  104. package/dist/option-position.js +142 -0
  105. package/dist/pin-input.cjs +182 -0
  106. package/dist/pin-input.d.cts +25 -0
  107. package/dist/pin-input.d.ts +25 -0
  108. package/dist/pin-input.js +160 -0
  109. package/dist/pnl-diagram.cjs +453 -0
  110. package/dist/pnl-diagram.d.cts +11 -0
  111. package/dist/pnl-diagram.d.ts +11 -0
  112. package/dist/pnl-diagram.js +431 -0
  113. package/dist/popover.cjs +342 -0
  114. package/dist/popover.d.cts +73 -0
  115. package/dist/popover.d.ts +73 -0
  116. package/dist/popover.js +310 -0
  117. package/dist/progress-circle.cjs +152 -0
  118. package/dist/progress-circle.d.cts +47 -0
  119. package/dist/progress-circle.d.ts +47 -0
  120. package/dist/progress-circle.js +128 -0
  121. package/dist/progress.cjs +117 -0
  122. package/dist/progress.d.cts +28 -0
  123. package/dist/progress.d.ts +28 -0
  124. package/dist/progress.js +94 -0
  125. package/dist/provider.cjs +62 -0
  126. package/dist/provider.d.cts +7 -0
  127. package/dist/provider.d.ts +7 -0
  128. package/dist/provider.js +40 -0
  129. package/dist/radio.cjs +177 -0
  130. package/dist/radio.d.cts +53 -0
  131. package/dist/radio.d.ts +53 -0
  132. package/dist/radio.js +153 -0
  133. package/dist/rating.cjs +80 -0
  134. package/dist/rating.d.cts +14 -0
  135. package/dist/rating.d.ts +14 -0
  136. package/dist/rating.js +58 -0
  137. package/dist/select.cjs +644 -0
  138. package/dist/select.d.cts +130 -0
  139. package/dist/select.d.ts +130 -0
  140. package/dist/select.js +610 -0
  141. package/dist/separator.cjs +57 -0
  142. package/dist/separator.d.cts +13 -0
  143. package/dist/separator.d.ts +13 -0
  144. package/dist/separator.js +51 -0
  145. package/dist/skeleton.cjs +223 -0
  146. package/dist/skeleton.d.cts +60 -0
  147. package/dist/skeleton.d.ts +60 -0
  148. package/dist/skeleton.js +199 -0
  149. package/dist/slider.cjs +138 -0
  150. package/dist/slider.d.cts +24 -0
  151. package/dist/slider.d.ts +24 -0
  152. package/dist/slider.js +115 -0
  153. package/dist/strategy-builder.cjs +373 -0
  154. package/dist/strategy-builder.d.cts +26 -0
  155. package/dist/strategy-builder.d.ts +26 -0
  156. package/dist/strategy-builder.js +351 -0
  157. package/dist/switch.cjs +163 -0
  158. package/dist/switch.d.cts +27 -0
  159. package/dist/switch.d.ts +27 -0
  160. package/dist/switch.js +140 -0
  161. package/dist/table.cjs +897 -0
  162. package/dist/table.d.cts +107 -0
  163. package/dist/table.d.ts +107 -0
  164. package/dist/table.js +866 -0
  165. package/dist/tabs.cjs +240 -0
  166. package/dist/tabs.d.cts +78 -0
  167. package/dist/tabs.d.ts +78 -0
  168. package/dist/tabs.js +213 -0
  169. package/dist/tag.cjs +529 -0
  170. package/dist/tag.d.cts +21 -0
  171. package/dist/tag.d.ts +21 -0
  172. package/dist/tag.js +507 -0
  173. package/dist/textarea.cjs +65 -0
  174. package/dist/textarea.d.cts +11 -0
  175. package/dist/textarea.d.ts +11 -0
  176. package/dist/textarea.js +59 -0
  177. package/dist/toaster.cjs +99 -0
  178. package/dist/toaster.d.cts +29 -0
  179. package/dist/toaster.d.ts +29 -0
  180. package/dist/toaster.js +96 -0
  181. package/dist/tooltip.cjs +172 -0
  182. package/dist/tooltip.d.cts +38 -0
  183. package/dist/tooltip.d.ts +38 -0
  184. package/dist/tooltip.js +150 -0
  185. package/dist/utils.cjs +11 -0
  186. package/dist/utils.d.cts +5 -0
  187. package/dist/utils.d.ts +5 -0
  188. package/dist/utils.js +9 -0
  189. package/package.json +284 -89
  190. package/src/accordion.tsx +285 -0
  191. package/src/alert.tsx +221 -0
  192. package/src/avatar.tsx +174 -0
  193. package/src/badge.tsx +147 -0
  194. package/src/bank.tsx +325 -0
  195. package/src/button.tsx +477 -0
  196. package/src/checkbox.tsx +307 -0
  197. package/src/close-button.tsx +77 -0
  198. package/src/collapsible.tsx +126 -0
  199. package/src/color-mode.tsx +125 -0
  200. package/src/dialog.tsx +346 -0
  201. package/src/drawer.tsx +186 -0
  202. package/src/empty-state.tsx +97 -0
  203. package/src/expiration-selector.tsx +163 -0
  204. package/src/field.tsx +202 -0
  205. package/src/greeks-display.tsx +138 -0
  206. package/src/heading.tsx +44 -0
  207. package/src/icon-button.tsx +217 -0
  208. package/src/image.tsx +280 -0
  209. package/src/index.ts +267 -138
  210. package/src/input-group.tsx +159 -0
  211. package/src/input.tsx +60 -0
  212. package/src/link.tsx +326 -0
  213. package/src/menu.tsx +471 -0
  214. package/src/option-chain.tsx +261 -0
  215. package/src/option-position.tsx +200 -0
  216. package/src/pin-input.tsx +187 -0
  217. package/src/pnl-diagram.tsx +458 -0
  218. package/src/popover.tsx +386 -0
  219. package/src/progress-circle.tsx +180 -0
  220. package/src/progress.tsx +109 -0
  221. package/src/provider.tsx +12 -0
  222. package/src/radio.tsx +175 -0
  223. package/src/rating.tsx +79 -0
  224. package/src/select.tsx +696 -0
  225. package/src/separator.tsx +59 -0
  226. package/src/skeleton.tsx +254 -0
  227. package/src/slider.tsx +152 -0
  228. package/src/strategy-builder.tsx +466 -0
  229. package/src/switch.tsx +158 -0
  230. package/src/table.tsx +621 -0
  231. package/src/tabs.tsx +354 -0
  232. package/src/tag.tsx +159 -0
  233. package/src/textarea.tsx +60 -0
  234. package/src/toaster.tsx +117 -0
  235. package/src/tokens.css +438 -0
  236. package/src/tooltip.tsx +191 -0
  237. package/src/utils/cn.ts +7 -0
  238. package/src/utils.ts +6 -0
  239. package/tokens.css +438 -0
  240. package/LICENSE +0 -122
  241. package/README.md +0 -109
package/dist/link.cjs ADDED
@@ -0,0 +1,483 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var React = require('react');
5
+ var clsx = require('clsx');
6
+ var tailwindMerge = require('tailwind-merge');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
+
29
+ // src/link.tsx
30
+ function cn(...inputs) {
31
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
32
+ }
33
+ var SHIM_PROPS = [
34
+ "w",
35
+ "h",
36
+ "minW",
37
+ "maxW",
38
+ "display",
39
+ "flexGrow",
40
+ "flexShrink",
41
+ "flexBasis",
42
+ "fontWeight",
43
+ "textStyle",
44
+ "borderRadius",
45
+ "alignSelf",
46
+ "alignItems",
47
+ "justifyContent",
48
+ "color",
49
+ "mt",
50
+ "mb",
51
+ "ml",
52
+ "mr",
53
+ "height",
54
+ "overflow",
55
+ "whiteSpace",
56
+ "textOverflow",
57
+ "textTransform",
58
+ "gap",
59
+ "gridTemplateColumns",
60
+ "minWidth",
61
+ "boxSize",
62
+ "py",
63
+ "px",
64
+ "p",
65
+ "hideBelow",
66
+ "fontSize",
67
+ "flexWrap",
68
+ "wordBreak",
69
+ "lineHeight",
70
+ "marginRight",
71
+ "position",
72
+ "background"
73
+ ];
74
+ var S = 4;
75
+ function dim(v) {
76
+ if (v == null) return void 0;
77
+ if (typeof v === "number") return `${v * S}px`;
78
+ if (typeof v === "string") return v;
79
+ if (typeof v === "object") {
80
+ const o = v;
81
+ return o.base ?? o.lg ?? o.xl ?? Object.values(o)[0];
82
+ }
83
+ return void 0;
84
+ }
85
+ function sp(v) {
86
+ if (v === void 0) return void 0;
87
+ return typeof v === "number" ? `${v * S}px` : v;
88
+ }
89
+ function shimToStyle(props) {
90
+ const s = {};
91
+ if (props.w !== void 0) s.width = dim(props.w);
92
+ if (props.h !== void 0) s.height = dim(props.h);
93
+ if (props.minW !== void 0) s.minWidth = dim(props.minW);
94
+ if (props.maxW !== void 0) s.maxWidth = dim(props.maxW);
95
+ if (props.display !== void 0) s.display = props.display;
96
+ if (props.flexGrow !== void 0) s.flexGrow = props.flexGrow;
97
+ if (props.flexShrink !== void 0) s.flexShrink = props.flexShrink;
98
+ if (props.flexBasis !== void 0) s.flexBasis = props.flexBasis;
99
+ if (props.fontWeight !== void 0) s.fontWeight = props.fontWeight;
100
+ if (props.borderRadius !== void 0) s.borderRadius = props.borderRadius;
101
+ if (props.alignSelf !== void 0) s.alignSelf = props.alignSelf;
102
+ if (props.alignItems !== void 0) s.alignItems = props.alignItems;
103
+ if (props.justifyContent !== void 0) s.justifyContent = props.justifyContent;
104
+ if (props.color !== void 0) s.color = props.color;
105
+ if (props.mt !== void 0) s.marginTop = sp(props.mt);
106
+ if (props.mb !== void 0) s.marginBottom = sp(props.mb);
107
+ if (props.ml !== void 0) s.marginLeft = sp(props.ml);
108
+ if (props.mr !== void 0) s.marginRight = sp(props.mr);
109
+ if (props.height !== void 0) s.height = props.height;
110
+ if (props.overflow !== void 0) s.overflow = props.overflow;
111
+ if (props.whiteSpace !== void 0) s.whiteSpace = props.whiteSpace;
112
+ if (props.textOverflow !== void 0) s.textOverflow = props.textOverflow;
113
+ if (props.textTransform !== void 0) s.textTransform = props.textTransform;
114
+ if (props.gap !== void 0) s.gap = sp(props.gap);
115
+ if (props.gridTemplateColumns !== void 0) s.gridTemplateColumns = props.gridTemplateColumns;
116
+ if (props.minWidth !== void 0) s.minWidth = props.minWidth;
117
+ if (props.boxSize !== void 0) {
118
+ const v = typeof props.boxSize === "number" ? `${props.boxSize * S}px` : props.boxSize;
119
+ s.width = v;
120
+ s.height = v;
121
+ }
122
+ if (props.py !== void 0) {
123
+ const v = sp(props.py);
124
+ s.paddingTop = v;
125
+ s.paddingBottom = v;
126
+ }
127
+ if (props.px !== void 0) {
128
+ const v = sp(props.px);
129
+ s.paddingLeft = v;
130
+ s.paddingRight = v;
131
+ }
132
+ if (props.p !== void 0) s.padding = sp(props.p);
133
+ if (props.fontSize !== void 0) s.fontSize = props.fontSize;
134
+ if (props.flexWrap !== void 0) s.flexWrap = props.flexWrap;
135
+ if (props.wordBreak !== void 0) s.wordBreak = props.wordBreak;
136
+ if (props.lineHeight !== void 0) s.lineHeight = props.lineHeight;
137
+ if (props.marginRight !== void 0) s.marginRight = props.marginRight;
138
+ if (props.position !== void 0) s.position = props.position;
139
+ if (props.background !== void 0) s.background = props.background;
140
+ return s;
141
+ }
142
+ function stripShims(props) {
143
+ const out = { ...props };
144
+ for (const k of SHIM_PROPS) delete out[k];
145
+ return out;
146
+ }
147
+ var SKELETON_CLASSES = [
148
+ "animate-skeleton-shimmer rounded-sm",
149
+ "bg-[linear-gradient(90deg,var(--color-skeleton-start)_0%,var(--color-skeleton-end)_50%,var(--color-skeleton-start)_100%)]",
150
+ "bg-[length:200%_100%]"
151
+ ].join(" ");
152
+ var HIDE_BELOW_MAP = { lg: "lg:hidden", md: "md:hidden", sm: "sm:hidden" };
153
+ var Skeleton = React__namespace.forwardRef(
154
+ function Skeleton2(props, ref) {
155
+ const { loading = false, asChild, className, children, style: styleProp, as: Component = "div", ...allRest } = props;
156
+ const shimStyle = shimToStyle(props);
157
+ const mergedStyle = Object.keys(shimStyle).length > 0 || styleProp ? { ...shimStyle, ...styleProp } : void 0;
158
+ const hideBelowClass = props.hideBelow ? HIDE_BELOW_MAP[props.hideBelow] : void 0;
159
+ const cls = hideBelowClass ? cn(className, hideBelowClass) : className;
160
+ const htmlRest = stripShims(allRest);
161
+ if (!loading) {
162
+ if (asChild && React__namespace.isValidElement(children)) return children;
163
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, className: cls, style: mergedStyle, ...htmlRest, children });
164
+ }
165
+ if (asChild && React__namespace.isValidElement(children)) {
166
+ return /* @__PURE__ */ jsxRuntime.jsx(
167
+ Component,
168
+ {
169
+ ref,
170
+ "data-loading": true,
171
+ className: cn(SKELETON_CLASSES, "text-transparent [&_*]:invisible", cls),
172
+ style: mergedStyle,
173
+ ...htmlRest,
174
+ children
175
+ }
176
+ );
177
+ }
178
+ return /* @__PURE__ */ jsxRuntime.jsx(
179
+ Component,
180
+ {
181
+ ref,
182
+ "data-loading": true,
183
+ className: cn(SKELETON_CLASSES, children ? "text-transparent [&_*]:invisible" : "min-h-5", cls),
184
+ style: mergedStyle,
185
+ ...htmlRest,
186
+ children
187
+ }
188
+ );
189
+ }
190
+ );
191
+ React__namespace.forwardRef(
192
+ function SkeletonCircle2(props, ref) {
193
+ const { size = 40, loading = true, className, ...rest } = props;
194
+ const dimension = typeof size === "number" ? `${size}px` : size;
195
+ return /* @__PURE__ */ jsxRuntime.jsx(
196
+ Skeleton,
197
+ {
198
+ ref,
199
+ loading,
200
+ className: cn("rounded-full shrink-0", className),
201
+ style: { width: dimension, height: dimension, ...rest.style },
202
+ ...rest
203
+ }
204
+ );
205
+ }
206
+ );
207
+ React__namespace.forwardRef(
208
+ function SkeletonText2(props, ref) {
209
+ const { noOfLines = 3, loading = true, className, ...rest } = props;
210
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...rest, children: Array.from({ length: noOfLines }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
211
+ Skeleton,
212
+ {
213
+ loading,
214
+ className: cn("h-4", index === noOfLines - 1 && "max-w-[80%]")
215
+ },
216
+ index
217
+ )) });
218
+ }
219
+ );
220
+ var ArrowIcon = ({ className, style }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className, style, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11 3h6v6M17 3L7 13M14 11v6H3V6h6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
221
+ function stripUtmParams(url) {
222
+ try {
223
+ const urlObj = new URL(url);
224
+ for (const param of ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"]) {
225
+ urlObj.searchParams.delete(param);
226
+ }
227
+ return urlObj.toString();
228
+ } catch {
229
+ return url;
230
+ }
231
+ }
232
+ var VARIANT_CLASSES = {
233
+ primary: cn(
234
+ "text-[var(--color-link-primary)]",
235
+ "hover:no-underline hover:text-[var(--color-link-primary-hover)]",
236
+ "data-[hover]:no-underline data-[hover]:text-[var(--color-link-primary-hover)]"
237
+ ),
238
+ secondary: cn(
239
+ "text-[var(--color-link-secondary)]",
240
+ "hover:no-underline hover:text-[var(--color-hover)]",
241
+ "data-[hover]:no-underline data-[hover]:text-[var(--color-hover)]"
242
+ ),
243
+ subtle: cn(
244
+ "text-[var(--color-link-subtle)]",
245
+ "hover:text-[var(--color-link-subtle-hover)] hover:underline hover:decoration-[var(--color-link-subtle-hover)]",
246
+ "data-[hover]:text-[var(--color-link-subtle-hover)] data-[hover]:underline data-[hover]:decoration-[var(--color-link-subtle-hover)]"
247
+ ),
248
+ underlaid: cn(
249
+ "text-[var(--color-link-primary)] bg-[var(--color-link-underlaid-bg)]",
250
+ "px-2 py-1.5 rounded-md text-sm",
251
+ "hover:text-[var(--color-link-primary-hover)] hover:no-underline",
252
+ "data-[hover]:text-[var(--color-link-primary-hover)] data-[hover]:no-underline"
253
+ ),
254
+ menu: cn(
255
+ "text-[var(--color-link-menu)]",
256
+ "hover:text-[var(--color-hover)] hover:no-underline",
257
+ "data-[hover]:text-[var(--color-hover)] data-[hover]:no-underline"
258
+ ),
259
+ navigation: cn(
260
+ "text-[var(--color-link-nav-fg)] bg-transparent",
261
+ "hover:text-[var(--color-link-nav-fg-hover)] hover:no-underline",
262
+ "data-[hover]:text-[var(--color-link-nav-fg-hover)] data-[hover]:no-underline",
263
+ "data-[selected]:text-[var(--color-link-nav-fg-selected)] data-[selected]:bg-[var(--color-link-nav-bg-selected)]",
264
+ "data-[active]:text-[var(--color-link-nav-fg-active)]"
265
+ ),
266
+ plain: cn(
267
+ "text-inherit",
268
+ "hover:no-underline",
269
+ "data-[hover]:no-underline"
270
+ )
271
+ };
272
+ var BASE_CLASSES = "inline-flex items-center gap-0 cursor-pointer data-[disabled]:cursor-not-allowed";
273
+ var LinkExternalIcon = ({ color }) => /* @__PURE__ */ jsxRuntime.jsx(
274
+ ArrowIcon,
275
+ {
276
+ className: cn(
277
+ "size-3 align-middle shrink-0",
278
+ "group-hover:text-inherit"
279
+ ),
280
+ style: color ? { color } : { color: "var(--color-icon-secondary)" },
281
+ "aria-hidden": "true"
282
+ }
283
+ );
284
+ var SPACING = 4;
285
+ function resolveSpacing(v) {
286
+ if (v === void 0) return void 0;
287
+ if (typeof v === "number") return `${v * SPACING}px`;
288
+ if (typeof v === "string") return v;
289
+ if (typeof v === "object" && v !== null) {
290
+ const base = v.base;
291
+ if (base !== void 0) return typeof base === "number" ? `${base * SPACING}px` : base;
292
+ const lg = v.lg;
293
+ if (lg !== void 0) return typeof lg === "number" ? `${lg * SPACING}px` : lg;
294
+ }
295
+ return void 0;
296
+ }
297
+ var Link = React__namespace.default.forwardRef(
298
+ function Link2(props, ref) {
299
+ const {
300
+ external,
301
+ loading,
302
+ href,
303
+ children,
304
+ disabled,
305
+ noIcon,
306
+ iconColor,
307
+ variant = "primary",
308
+ className,
309
+ asChild: _asChild,
310
+ // Strip Next.js-specific props (accepted for compat, not used)
311
+ shallow: _shallow,
312
+ prefetch: _prefetch,
313
+ scroll: _scroll,
314
+ // Strip Chakra style props
315
+ fontWeight: _fontWeight,
316
+ whiteSpace: _whiteSpace,
317
+ wordBreak: _wordBreak,
318
+ textStyle: _textStyle,
319
+ ml: _ml,
320
+ mr: _mr,
321
+ display: _display,
322
+ alignItems: _alignItems,
323
+ flexShrink: _flexShrink,
324
+ minW: _minW,
325
+ justifyContent: _justifyContent,
326
+ position: _position,
327
+ ...rest
328
+ } = props;
329
+ const shimStyle = {};
330
+ if (_fontWeight !== void 0) shimStyle.fontWeight = _fontWeight;
331
+ if (_whiteSpace) shimStyle.whiteSpace = _whiteSpace;
332
+ if (_wordBreak) shimStyle.wordBreak = _wordBreak;
333
+ if (_ml !== void 0) shimStyle.marginLeft = resolveSpacing(_ml);
334
+ if (_mr !== void 0) shimStyle.marginRight = resolveSpacing(_mr);
335
+ if (_display) shimStyle.display = _display;
336
+ if (_alignItems) shimStyle.alignItems = _alignItems;
337
+ if (_flexShrink !== void 0) shimStyle.flexShrink = _flexShrink;
338
+ if (_minW !== void 0) shimStyle.minWidth = typeof _minW === "number" ? `${_minW * SPACING}px` : _minW;
339
+ if (_justifyContent) shimStyle.justifyContent = _justifyContent;
340
+ if (_position) shimStyle.position = _position;
341
+ const linkClasses = cn(BASE_CLASSES, VARIANT_CLASSES[variant], className);
342
+ const linkStyle = Object.keys(shimStyle).length > 0 ? shimStyle : void 0;
343
+ if (external) {
344
+ const processedHref = typeof href === "string" ? stripUtmParams(href) : href;
345
+ return /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { loading, ref, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
346
+ "a",
347
+ {
348
+ href: processedHref,
349
+ className: cn("group", linkClasses),
350
+ style: linkStyle,
351
+ target: "_blank",
352
+ rel: "noopener noreferrer",
353
+ ...disabled ? { "data-disabled": true } : {},
354
+ ...rest,
355
+ children: [
356
+ children,
357
+ !noIcon && /* @__PURE__ */ jsxRuntime.jsx(LinkExternalIcon, { color: iconColor })
358
+ ]
359
+ }
360
+ ) });
361
+ }
362
+ if (href) {
363
+ return /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { loading, ref, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
364
+ "a",
365
+ {
366
+ href,
367
+ className: linkClasses,
368
+ style: linkStyle,
369
+ ...disabled ? { "data-disabled": true } : {},
370
+ ...rest,
371
+ children
372
+ }
373
+ ) });
374
+ }
375
+ return /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { loading, ref, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
376
+ "span",
377
+ {
378
+ className: linkClasses,
379
+ ...disabled ? { "data-disabled": true } : {},
380
+ ...rest,
381
+ children
382
+ }
383
+ ) });
384
+ }
385
+ );
386
+ var LinkBox = React__namespace.default.forwardRef(
387
+ function LinkBox2(props, ref) {
388
+ const { className, ...rest } = props;
389
+ return /* @__PURE__ */ jsxRuntime.jsx(
390
+ "div",
391
+ {
392
+ ref,
393
+ className: cn("relative", className),
394
+ ...rest
395
+ }
396
+ );
397
+ }
398
+ );
399
+ var LinkOverlay = React__namespace.default.forwardRef(
400
+ function LinkOverlay2(props, ref) {
401
+ const {
402
+ children,
403
+ external,
404
+ loading,
405
+ href,
406
+ noIcon,
407
+ iconColor,
408
+ variant = "primary",
409
+ className,
410
+ disabled,
411
+ asChild: _asChild2,
412
+ shallow: _shallow2,
413
+ prefetch: _prefetch2,
414
+ scroll: _scroll2,
415
+ fontWeight: _fw2,
416
+ whiteSpace: _ws2,
417
+ wordBreak: _wb2,
418
+ textStyle: _ts2,
419
+ ml: _ml2,
420
+ mr: _mr2,
421
+ display: _d2,
422
+ alignItems: _ai2,
423
+ flexShrink: _fs2,
424
+ minW: _mw2,
425
+ justifyContent: _jc2,
426
+ position: _p2,
427
+ ...rest
428
+ } = props;
429
+ const overlayClasses = cn(
430
+ BASE_CLASSES,
431
+ VARIANT_CLASSES[variant],
432
+ // Static positioning with a ::before pseudo-element that covers the LinkBox
433
+ "static",
434
+ 'before:absolute before:inset-0 before:z-0 before:content-[""]',
435
+ className
436
+ );
437
+ if (external) {
438
+ const processedHref = typeof href === "string" ? stripUtmParams(href) : href;
439
+ return /* @__PURE__ */ jsxRuntime.jsx(
440
+ "a",
441
+ {
442
+ ref,
443
+ href: loading ? void 0 : processedHref,
444
+ className: overlayClasses,
445
+ target: "_blank",
446
+ rel: "noopener noreferrer",
447
+ ...rest,
448
+ children: (children || !noIcon && href) && /* @__PURE__ */ jsxRuntime.jsxs(Skeleton, { display: "inline-flex", alignItems: "center", loading, maxW: "100%", h: "100%", children: [
449
+ children,
450
+ !noIcon && href && /* @__PURE__ */ jsxRuntime.jsx(LinkExternalIcon, { color: iconColor })
451
+ ] })
452
+ }
453
+ );
454
+ }
455
+ const content = children ? /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { display: "inline-flex", alignItems: "center", loading, maxW: "100%", h: "100%", children }) : null;
456
+ if (href) {
457
+ return /* @__PURE__ */ jsxRuntime.jsx(
458
+ "a",
459
+ {
460
+ ref,
461
+ href,
462
+ className: overlayClasses,
463
+ ...rest,
464
+ children: content
465
+ }
466
+ );
467
+ }
468
+ return /* @__PURE__ */ jsxRuntime.jsx(
469
+ "span",
470
+ {
471
+ ref,
472
+ className: overlayClasses,
473
+ ...rest,
474
+ children: content
475
+ }
476
+ );
477
+ }
478
+ );
479
+
480
+ exports.Link = Link;
481
+ exports.LinkBox = LinkBox;
482
+ exports.LinkExternalIcon = LinkExternalIcon;
483
+ exports.LinkOverlay = LinkOverlay;
@@ -0,0 +1,37 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default from 'react';
3
+
4
+ type LinkVariant = 'primary' | 'secondary' | 'subtle' | 'underlaid' | 'menu' | 'navigation' | 'plain';
5
+ interface LinkProps extends Omit<React__default.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {
6
+ readonly href?: string;
7
+ readonly loading?: boolean;
8
+ readonly external?: boolean;
9
+ readonly iconColor?: string;
10
+ readonly noIcon?: boolean;
11
+ readonly disabled?: boolean;
12
+ readonly variant?: LinkVariant;
13
+ readonly asChild?: boolean;
14
+ readonly shallow?: boolean;
15
+ readonly prefetch?: boolean;
16
+ readonly scroll?: boolean;
17
+ readonly fontWeight?: string | number;
18
+ readonly whiteSpace?: string;
19
+ readonly wordBreak?: string;
20
+ readonly textStyle?: string;
21
+ readonly ml?: number | string | Record<string, string | number>;
22
+ readonly mr?: number | string;
23
+ readonly display?: string;
24
+ readonly alignItems?: string;
25
+ readonly flexShrink?: number;
26
+ readonly minW?: number | string;
27
+ readonly justifyContent?: string;
28
+ readonly position?: string;
29
+ }
30
+ declare const LinkExternalIcon: ({ color }: {
31
+ color?: string;
32
+ }) => react_jsx_runtime.JSX.Element;
33
+ declare const Link: React__default.ForwardRefExoticComponent<LinkProps & React__default.RefAttributes<HTMLAnchorElement>>;
34
+ declare const LinkBox: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLDivElement> & React__default.RefAttributes<HTMLDivElement>>;
35
+ declare const LinkOverlay: React__default.ForwardRefExoticComponent<LinkProps & React__default.RefAttributes<HTMLAnchorElement>>;
36
+
37
+ export { Link, LinkBox, LinkExternalIcon, LinkOverlay, type LinkProps };
package/dist/link.d.ts ADDED
@@ -0,0 +1,37 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default from 'react';
3
+
4
+ type LinkVariant = 'primary' | 'secondary' | 'subtle' | 'underlaid' | 'menu' | 'navigation' | 'plain';
5
+ interface LinkProps extends Omit<React__default.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {
6
+ readonly href?: string;
7
+ readonly loading?: boolean;
8
+ readonly external?: boolean;
9
+ readonly iconColor?: string;
10
+ readonly noIcon?: boolean;
11
+ readonly disabled?: boolean;
12
+ readonly variant?: LinkVariant;
13
+ readonly asChild?: boolean;
14
+ readonly shallow?: boolean;
15
+ readonly prefetch?: boolean;
16
+ readonly scroll?: boolean;
17
+ readonly fontWeight?: string | number;
18
+ readonly whiteSpace?: string;
19
+ readonly wordBreak?: string;
20
+ readonly textStyle?: string;
21
+ readonly ml?: number | string | Record<string, string | number>;
22
+ readonly mr?: number | string;
23
+ readonly display?: string;
24
+ readonly alignItems?: string;
25
+ readonly flexShrink?: number;
26
+ readonly minW?: number | string;
27
+ readonly justifyContent?: string;
28
+ readonly position?: string;
29
+ }
30
+ declare const LinkExternalIcon: ({ color }: {
31
+ color?: string;
32
+ }) => react_jsx_runtime.JSX.Element;
33
+ declare const Link: React__default.ForwardRefExoticComponent<LinkProps & React__default.RefAttributes<HTMLAnchorElement>>;
34
+ declare const LinkBox: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLDivElement> & React__default.RefAttributes<HTMLDivElement>>;
35
+ declare const LinkOverlay: React__default.ForwardRefExoticComponent<LinkProps & React__default.RefAttributes<HTMLAnchorElement>>;
36
+
37
+ export { Link, LinkBox, LinkExternalIcon, LinkOverlay, type LinkProps };