@luxfi/ui 5.6.0 → 6.0.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 (125) hide show
  1. package/README.md +109 -0
  2. package/package.json +81 -278
  3. package/dist/accordion.cjs +0 -213
  4. package/dist/accordion.js +0 -186
  5. package/dist/alert.cjs +0 -553
  6. package/dist/alert.js +0 -531
  7. package/dist/avatar.cjs +0 -149
  8. package/dist/avatar.js +0 -125
  9. package/dist/badge.cjs +0 -611
  10. package/dist/badge.js +0 -589
  11. package/dist/button.cjs +0 -689
  12. package/dist/button.js +0 -664
  13. package/dist/checkbox.cjs +0 -265
  14. package/dist/checkbox.js +0 -241
  15. package/dist/close-button.cjs +0 -73
  16. package/dist/close-button.js +0 -51
  17. package/dist/collapsible.cjs +0 -702
  18. package/dist/collapsible.js +0 -679
  19. package/dist/color-mode.cjs +0 -96
  20. package/dist/color-mode.js +0 -72
  21. package/dist/dialog.cjs +0 -279
  22. package/dist/dialog.js +0 -246
  23. package/dist/drawer.cjs +0 -207
  24. package/dist/drawer.js +0 -175
  25. package/dist/empty-state.cjs +0 -93
  26. package/dist/empty-state.js +0 -71
  27. package/dist/field.cjs +0 -183
  28. package/dist/field.js +0 -160
  29. package/dist/heading.cjs +0 -46
  30. package/dist/heading.js +0 -40
  31. package/dist/icon-button.cjs +0 -491
  32. package/dist/icon-button.js +0 -470
  33. package/dist/image.cjs +0 -572
  34. package/dist/image.js +0 -551
  35. package/dist/index.cjs +0 -5779
  36. package/dist/index.js +0 -5619
  37. package/dist/input-group.cjs +0 -155
  38. package/dist/input-group.js +0 -133
  39. package/dist/input.cjs +0 -65
  40. package/dist/input.js +0 -59
  41. package/dist/link.cjs +0 -630
  42. package/dist/link.js +0 -606
  43. package/dist/menu.cjs +0 -305
  44. package/dist/menu.js +0 -269
  45. package/dist/pin-input.cjs +0 -182
  46. package/dist/pin-input.js +0 -160
  47. package/dist/popover.cjs +0 -327
  48. package/dist/popover.js +0 -294
  49. package/dist/progress-circle.cjs +0 -152
  50. package/dist/progress-circle.js +0 -128
  51. package/dist/progress.cjs +0 -117
  52. package/dist/progress.js +0 -94
  53. package/dist/provider.cjs +0 -62
  54. package/dist/provider.js +0 -40
  55. package/dist/radio.cjs +0 -177
  56. package/dist/radio.js +0 -153
  57. package/dist/rating.cjs +0 -80
  58. package/dist/rating.js +0 -58
  59. package/dist/select.cjs +0 -791
  60. package/dist/select.js +0 -757
  61. package/dist/separator.cjs +0 -57
  62. package/dist/separator.js +0 -51
  63. package/dist/skeleton.cjs +0 -370
  64. package/dist/skeleton.js +0 -346
  65. package/dist/slider.cjs +0 -138
  66. package/dist/slider.js +0 -115
  67. package/dist/switch.cjs +0 -163
  68. package/dist/switch.js +0 -140
  69. package/dist/table.cjs +0 -1044
  70. package/dist/table.js +0 -1013
  71. package/dist/tabs.cjs +0 -240
  72. package/dist/tabs.js +0 -213
  73. package/dist/tag.cjs +0 -651
  74. package/dist/tag.js +0 -628
  75. package/dist/textarea.cjs +0 -65
  76. package/dist/textarea.js +0 -59
  77. package/dist/toaster.cjs +0 -99
  78. package/dist/toaster.js +0 -96
  79. package/dist/tooltip.cjs +0 -171
  80. package/dist/tooltip.js +0 -148
  81. package/dist/utils.cjs +0 -11
  82. package/dist/utils.js +0 -9
  83. package/src/accordion.tsx +0 -285
  84. package/src/alert.tsx +0 -221
  85. package/src/avatar.tsx +0 -174
  86. package/src/badge.tsx +0 -158
  87. package/src/button.tsx +0 -411
  88. package/src/checkbox.tsx +0 -307
  89. package/src/close-button.tsx +0 -51
  90. package/src/collapsible.tsx +0 -126
  91. package/src/color-mode.tsx +0 -125
  92. package/src/dialog.tsx +0 -356
  93. package/src/drawer.tsx +0 -186
  94. package/src/empty-state.tsx +0 -97
  95. package/src/field.tsx +0 -202
  96. package/src/heading.tsx +0 -55
  97. package/src/icon-button.tsx +0 -192
  98. package/src/image.tsx +0 -280
  99. package/src/index.ts +0 -192
  100. package/src/input-group.tsx +0 -159
  101. package/src/input.tsx +0 -60
  102. package/src/link.tsx +0 -326
  103. package/src/menu.tsx +0 -471
  104. package/src/pin-input.tsx +0 -187
  105. package/src/popover.tsx +0 -400
  106. package/src/progress-circle.tsx +0 -180
  107. package/src/progress.tsx +0 -109
  108. package/src/provider.tsx +0 -12
  109. package/src/radio.tsx +0 -175
  110. package/src/rating.tsx +0 -79
  111. package/src/select.tsx +0 -696
  112. package/src/separator.tsx +0 -59
  113. package/src/skeleton.tsx +0 -302
  114. package/src/slider.tsx +0 -152
  115. package/src/switch.tsx +0 -158
  116. package/src/table.tsx +0 -621
  117. package/src/tabs.tsx +0 -354
  118. package/src/tag.tsx +0 -159
  119. package/src/textarea.tsx +0 -60
  120. package/src/toaster.tsx +0 -117
  121. package/src/tokens.css +0 -438
  122. package/src/tooltip.tsx +0 -184
  123. package/src/utils/cn.ts +0 -7
  124. package/src/utils.ts +0 -6
  125. package/tokens.css +0 -438
package/src/link.tsx DELETED
@@ -1,326 +0,0 @@
1
- import React from 'react';
2
-
3
- import { cn } from './utils';
4
-
5
- // Inline external link arrow icon
6
- const ArrowIcon = ({ className, style }: { readonly className?: string; readonly style?: React.CSSProperties }) => (
7
- <svg className={ className } style={ style } viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
8
- <path d="M11 3h6v6M17 3L7 13M14 11v6H3V6h6" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
9
- </svg>
10
- );
11
-
12
- // Strip UTM params for privacy (standalone, no config dependency)
13
- function stripUtmParams(url: string): string {
14
- try {
15
- const urlObj = new URL(url);
16
- for (const param of [ 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content' ]) {
17
- urlObj.searchParams.delete(param);
18
- }
19
- return urlObj.toString();
20
- } catch {
21
- return url;
22
- }
23
- }
24
-
25
- import { Skeleton } from './skeleton';
26
-
27
- type LinkVariant = 'primary' | 'secondary' | 'subtle' | 'underlaid' | 'menu' | 'navigation' | 'plain';
28
-
29
- export interface LinkProps
30
- extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {
31
- readonly href?: string;
32
- readonly loading?: boolean;
33
- readonly external?: boolean;
34
- readonly iconColor?: string;
35
- readonly noIcon?: boolean;
36
- readonly disabled?: boolean;
37
- readonly variant?: LinkVariant;
38
- readonly asChild?: boolean;
39
- // Next.js-specific props accepted for compatibility (ignored by base <a>)
40
- readonly shallow?: boolean;
41
- readonly prefetch?: boolean;
42
- readonly scroll?: boolean;
43
- // Legacy Chakra style-prop shims
44
- readonly fontWeight?: string | number;
45
- readonly whiteSpace?: string;
46
- readonly wordBreak?: string;
47
- readonly textStyle?: string;
48
- readonly ml?: number | string | Record<string, string | number>;
49
- readonly mr?: number | string;
50
- readonly display?: string;
51
- readonly alignItems?: string;
52
- readonly flexShrink?: number;
53
- readonly minW?: number | string;
54
- readonly justifyContent?: string;
55
- readonly position?: string;
56
- }
57
-
58
- const VARIANT_CLASSES: Record<LinkVariant, string> = {
59
- primary: cn(
60
- 'text-[var(--color-link-primary)]',
61
- 'hover:no-underline hover:text-[var(--color-link-primary-hover)]',
62
- 'data-[hover]:no-underline data-[hover]:text-[var(--color-link-primary-hover)]',
63
- ),
64
- secondary: cn(
65
- 'text-[var(--color-link-secondary)]',
66
- 'hover:no-underline hover:text-[var(--color-hover)]',
67
- 'data-[hover]:no-underline data-[hover]:text-[var(--color-hover)]',
68
- ),
69
- subtle: cn(
70
- 'text-[var(--color-link-subtle)]',
71
- 'hover:text-[var(--color-link-subtle-hover)] hover:underline hover:decoration-[var(--color-link-subtle-hover)]',
72
- 'data-[hover]:text-[var(--color-link-subtle-hover)] data-[hover]:underline data-[hover]:decoration-[var(--color-link-subtle-hover)]',
73
- ),
74
- underlaid: cn(
75
- 'text-[var(--color-link-primary)] bg-[var(--color-link-underlaid-bg)]',
76
- 'px-2 py-1.5 rounded-md text-sm',
77
- 'hover:text-[var(--color-link-primary-hover)] hover:no-underline',
78
- 'data-[hover]:text-[var(--color-link-primary-hover)] data-[hover]:no-underline',
79
- ),
80
- menu: cn(
81
- 'text-[var(--color-link-menu)]',
82
- 'hover:text-[var(--color-hover)] hover:no-underline',
83
- 'data-[hover]:text-[var(--color-hover)] data-[hover]:no-underline',
84
- ),
85
- navigation: cn(
86
- 'text-[var(--color-link-nav-fg)] bg-transparent',
87
- 'hover:text-[var(--color-link-nav-fg-hover)] hover:no-underline',
88
- 'data-[hover]:text-[var(--color-link-nav-fg-hover)] data-[hover]:no-underline',
89
- 'data-[selected]:text-[var(--color-link-nav-fg-selected)] data-[selected]:bg-[var(--color-link-nav-bg-selected)]',
90
- 'data-[active]:text-[var(--color-link-nav-fg-active)]',
91
- ),
92
- plain: cn(
93
- 'text-inherit',
94
- 'hover:no-underline',
95
- 'data-[hover]:no-underline',
96
- ),
97
- };
98
-
99
- const BASE_CLASSES = 'inline-flex items-center gap-0 cursor-pointer data-[disabled]:cursor-not-allowed';
100
-
101
- export const LinkExternalIcon = ({ color }: { color?: string }) => (
102
- <ArrowIcon
103
- className={ cn(
104
- 'size-3 align-middle shrink-0',
105
- 'group-hover:text-inherit',
106
- ) }
107
- style={ color ? { color } : { color: 'var(--color-icon-secondary)' } }
108
- aria-hidden="true"
109
- />
110
- );
111
-
112
- const SPACING = 4;
113
-
114
- function resolveSpacing(v: number | string | Record<string, string | number> | undefined): string | undefined {
115
- if (v === undefined) return undefined;
116
- if (typeof v === 'number') return `${ v * SPACING }px`;
117
- if (typeof v === 'string') return v;
118
- // Responsive object - use base value
119
- if (typeof v === 'object' && v !== null) {
120
- const base = (v as Record<string, string | number>).base;
121
- if (base !== undefined) return typeof base === 'number' ? `${ base * SPACING }px` : base;
122
- const lg = (v as Record<string, string | number>).lg;
123
- if (lg !== undefined) return typeof lg === 'number' ? `${ lg * SPACING }px` : lg;
124
- }
125
- return undefined;
126
- }
127
-
128
- export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
129
- function Link(props, ref) {
130
- const {
131
- external,
132
- loading,
133
- href,
134
- children,
135
- disabled,
136
- noIcon,
137
- iconColor,
138
- variant = 'primary',
139
- className,
140
- asChild: _asChild,
141
- // Strip Next.js-specific props (accepted for compat, not used)
142
- shallow: _shallow,
143
- prefetch: _prefetch,
144
- scroll: _scroll,
145
- // Strip Chakra style props
146
- fontWeight: _fontWeight,
147
- whiteSpace: _whiteSpace,
148
- wordBreak: _wordBreak,
149
- textStyle: _textStyle,
150
- ml: _ml,
151
- mr: _mr,
152
- display: _display,
153
- alignItems: _alignItems,
154
- flexShrink: _flexShrink,
155
- minW: _minW,
156
- justifyContent: _justifyContent,
157
- position: _position,
158
- ...rest
159
- } = props;
160
-
161
- // Build inline style from Chakra style props
162
- const shimStyle: React.CSSProperties = {};
163
- if (_fontWeight !== undefined) shimStyle.fontWeight = _fontWeight;
164
- if (_whiteSpace) shimStyle.whiteSpace = _whiteSpace as React.CSSProperties['whiteSpace'];
165
- if (_wordBreak) shimStyle.wordBreak = _wordBreak as React.CSSProperties['wordBreak'];
166
- if (_ml !== undefined) shimStyle.marginLeft = resolveSpacing(_ml);
167
- if (_mr !== undefined) shimStyle.marginRight = resolveSpacing(_mr);
168
- if (_display) shimStyle.display = _display;
169
- if (_alignItems) shimStyle.alignItems = _alignItems;
170
- if (_flexShrink !== undefined) shimStyle.flexShrink = _flexShrink;
171
- if (_minW !== undefined) shimStyle.minWidth = typeof _minW === 'number' ? `${ _minW * SPACING }px` : _minW;
172
- if (_justifyContent) shimStyle.justifyContent = _justifyContent;
173
- if (_position) shimStyle.position = _position as React.CSSProperties['position'];
174
-
175
- const linkClasses = cn(BASE_CLASSES, VARIANT_CLASSES[variant], className);
176
- const linkStyle = Object.keys(shimStyle).length > 0 ? shimStyle : undefined;
177
-
178
- if (external) {
179
- const processedHref = typeof href === 'string' ? stripUtmParams(href) : href;
180
-
181
- return (
182
- <Skeleton loading={ loading } ref={ ref as React.ForwardedRef<HTMLDivElement> } asChild>
183
- <a
184
- href={ processedHref }
185
- className={ cn('group', linkClasses) }
186
- style={ linkStyle }
187
- target="_blank"
188
- rel="noopener noreferrer"
189
- { ...(disabled ? { 'data-disabled': true } : {}) }
190
- { ...rest }
191
- >
192
- { children }
193
- { !noIcon && <LinkExternalIcon color={ iconColor }/> }
194
- </a>
195
- </Skeleton>
196
- );
197
- }
198
-
199
- // Internal link: render a plain <a> tag. Framework-specific routing
200
- // (e.g. Next.js Link) should be provided by the consuming app's wrapper.
201
- if (href) {
202
- return (
203
- <Skeleton loading={ loading } ref={ ref as React.ForwardedRef<HTMLDivElement> } asChild>
204
- <a
205
- href={ href }
206
- className={ linkClasses }
207
- style={ linkStyle }
208
- { ...(disabled ? { 'data-disabled': true } : {}) }
209
- { ...rest }
210
- >
211
- { children }
212
- </a>
213
- </Skeleton>
214
- );
215
- }
216
-
217
- return (
218
- <Skeleton loading={ loading } ref={ ref as React.ForwardedRef<HTMLDivElement> } asChild>
219
- <span
220
- className={ linkClasses }
221
- { ...(disabled ? { 'data-disabled': true } : {}) }
222
- { ...rest as React.HTMLAttributes<HTMLSpanElement> }
223
- >
224
- { children }
225
- </span>
226
- </Skeleton>
227
- );
228
- },
229
- );
230
-
231
- export const LinkBox = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
232
- function LinkBox(props, ref) {
233
- const { className, ...rest } = props;
234
- return (
235
- <div
236
- ref={ ref }
237
- className={ cn('relative', className) }
238
- { ...rest }
239
- />
240
- );
241
- },
242
- );
243
-
244
- export const LinkOverlay = React.forwardRef<HTMLAnchorElement, LinkProps>(
245
- function LinkOverlay(props, ref) {
246
- const {
247
- children,
248
- external,
249
- loading,
250
- href,
251
- noIcon,
252
- iconColor,
253
- variant = 'primary',
254
- className,
255
- disabled,
256
- asChild: _asChild2,
257
- shallow: _shallow2,
258
- prefetch: _prefetch2,
259
- scroll: _scroll2,
260
- fontWeight: _fw2, whiteSpace: _ws2, wordBreak: _wb2, textStyle: _ts2,
261
- ml: _ml2, mr: _mr2, display: _d2, alignItems: _ai2, flexShrink: _fs2,
262
- minW: _mw2, justifyContent: _jc2, position: _p2,
263
- ...rest
264
- } = props;
265
-
266
- const overlayClasses = cn(
267
- BASE_CLASSES,
268
- VARIANT_CLASSES[variant],
269
- // Static positioning with a ::before pseudo-element that covers the LinkBox
270
- 'static',
271
- 'before:absolute before:inset-0 before:z-0 before:content-[""]',
272
- className,
273
- );
274
-
275
- if (external) {
276
- const processedHref = typeof href === 'string' ? stripUtmParams(href) : href;
277
-
278
- return (
279
- <a
280
- ref={ ref }
281
- href={ loading ? undefined : processedHref }
282
- className={ overlayClasses }
283
- target="_blank"
284
- rel="noopener noreferrer"
285
- { ...rest }
286
- >
287
- { (children || (!noIcon && href)) && (
288
- <Skeleton display="inline-flex" alignItems="center" loading={ loading } maxW="100%" h="100%">
289
- { children }
290
- { !noIcon && href && <LinkExternalIcon color={ iconColor }/> }
291
- </Skeleton>
292
- ) }
293
- </a>
294
- );
295
- }
296
-
297
- const content = children ? (
298
- <Skeleton display="inline-flex" alignItems="center" loading={ loading } maxW="100%" h="100%">
299
- { children }
300
- </Skeleton>
301
- ) : null;
302
-
303
- if (href) {
304
- return (
305
- <a
306
- ref={ ref }
307
- href={ href }
308
- className={ overlayClasses }
309
- { ...rest }
310
- >
311
- { content }
312
- </a>
313
- );
314
- }
315
-
316
- return (
317
- <span
318
- ref={ ref as React.ForwardedRef<HTMLDivElement> }
319
- className={ overlayClasses }
320
- { ...rest as React.HTMLAttributes<HTMLSpanElement> }
321
- >
322
- { content }
323
- </span>
324
- );
325
- },
326
- );