@luxfi/ui 5.6.0 → 6.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 (155) hide show
  1. package/dist/components/Badge.d.ts.map +1 -0
  2. package/dist/components/Badge.js +91 -0
  3. package/dist/components/Button.d.ts.map +1 -0
  4. package/dist/components/Button.js +137 -0
  5. package/dist/components/Card.d.ts.map +1 -0
  6. package/dist/components/Card.js +86 -0
  7. package/dist/components/IconButton.d.ts.map +1 -0
  8. package/dist/components/IconButton.js +64 -0
  9. package/dist/components/Input.d.ts.map +1 -0
  10. package/dist/components/Input.js +71 -0
  11. package/dist/components/Modal.d.ts.map +1 -0
  12. package/dist/components/Modal.js +98 -0
  13. package/dist/components/Skeleton.d.ts.map +1 -0
  14. package/dist/components/Skeleton.js +44 -0
  15. package/dist/components/Spinner.d.ts.map +1 -0
  16. package/dist/components/Spinner.js +42 -0
  17. package/dist/components/Switch.d.ts.map +1 -0
  18. package/dist/components/Switch.js +10 -0
  19. package/dist/components/TokenLogo.d.ts.map +1 -0
  20. package/dist/components/TokenLogo.js +57 -0
  21. package/dist/components/Tooltip.d.ts.map +1 -0
  22. package/dist/components/Tooltip.js +34 -0
  23. package/dist/components/index.d.ts.map +1 -0
  24. package/dist/components/index.js +19 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +35 -5618
  27. package/dist/theme/index.d.ts.map +1 -0
  28. package/dist/theme/index.js +6 -0
  29. package/dist/theme/themes.d.ts.map +1 -0
  30. package/dist/theme/themes.js +73 -0
  31. package/dist/theme/tokens.d.ts.map +1 -0
  32. package/dist/theme/tokens.js +101 -0
  33. package/package.json +81 -278
  34. package/dist/accordion.cjs +0 -213
  35. package/dist/accordion.js +0 -186
  36. package/dist/alert.cjs +0 -553
  37. package/dist/alert.js +0 -531
  38. package/dist/avatar.cjs +0 -149
  39. package/dist/avatar.js +0 -125
  40. package/dist/badge.cjs +0 -611
  41. package/dist/badge.js +0 -589
  42. package/dist/button.cjs +0 -689
  43. package/dist/button.js +0 -664
  44. package/dist/checkbox.cjs +0 -265
  45. package/dist/checkbox.js +0 -241
  46. package/dist/close-button.cjs +0 -73
  47. package/dist/close-button.js +0 -51
  48. package/dist/collapsible.cjs +0 -702
  49. package/dist/collapsible.js +0 -679
  50. package/dist/color-mode.cjs +0 -96
  51. package/dist/color-mode.js +0 -72
  52. package/dist/dialog.cjs +0 -279
  53. package/dist/dialog.js +0 -246
  54. package/dist/drawer.cjs +0 -207
  55. package/dist/drawer.js +0 -175
  56. package/dist/empty-state.cjs +0 -93
  57. package/dist/empty-state.js +0 -71
  58. package/dist/field.cjs +0 -183
  59. package/dist/field.js +0 -160
  60. package/dist/heading.cjs +0 -46
  61. package/dist/heading.js +0 -40
  62. package/dist/icon-button.cjs +0 -491
  63. package/dist/icon-button.js +0 -470
  64. package/dist/image.cjs +0 -572
  65. package/dist/image.js +0 -551
  66. package/dist/index.cjs +0 -5779
  67. package/dist/input-group.cjs +0 -155
  68. package/dist/input-group.js +0 -133
  69. package/dist/input.cjs +0 -65
  70. package/dist/input.js +0 -59
  71. package/dist/link.cjs +0 -630
  72. package/dist/link.js +0 -606
  73. package/dist/menu.cjs +0 -305
  74. package/dist/menu.js +0 -269
  75. package/dist/pin-input.cjs +0 -182
  76. package/dist/pin-input.js +0 -160
  77. package/dist/popover.cjs +0 -327
  78. package/dist/popover.js +0 -294
  79. package/dist/progress-circle.cjs +0 -152
  80. package/dist/progress-circle.js +0 -128
  81. package/dist/progress.cjs +0 -117
  82. package/dist/progress.js +0 -94
  83. package/dist/provider.cjs +0 -62
  84. package/dist/provider.js +0 -40
  85. package/dist/radio.cjs +0 -177
  86. package/dist/radio.js +0 -153
  87. package/dist/rating.cjs +0 -80
  88. package/dist/rating.js +0 -58
  89. package/dist/select.cjs +0 -791
  90. package/dist/select.js +0 -757
  91. package/dist/separator.cjs +0 -57
  92. package/dist/separator.js +0 -51
  93. package/dist/skeleton.cjs +0 -370
  94. package/dist/skeleton.js +0 -346
  95. package/dist/slider.cjs +0 -138
  96. package/dist/slider.js +0 -115
  97. package/dist/switch.cjs +0 -163
  98. package/dist/switch.js +0 -140
  99. package/dist/table.cjs +0 -1044
  100. package/dist/table.js +0 -1013
  101. package/dist/tabs.cjs +0 -240
  102. package/dist/tabs.js +0 -213
  103. package/dist/tag.cjs +0 -651
  104. package/dist/tag.js +0 -628
  105. package/dist/textarea.cjs +0 -65
  106. package/dist/textarea.js +0 -59
  107. package/dist/toaster.cjs +0 -99
  108. package/dist/toaster.js +0 -96
  109. package/dist/tooltip.cjs +0 -171
  110. package/dist/tooltip.js +0 -148
  111. package/dist/utils.cjs +0 -11
  112. package/dist/utils.js +0 -9
  113. package/src/accordion.tsx +0 -285
  114. package/src/alert.tsx +0 -221
  115. package/src/avatar.tsx +0 -174
  116. package/src/badge.tsx +0 -158
  117. package/src/button.tsx +0 -411
  118. package/src/checkbox.tsx +0 -307
  119. package/src/close-button.tsx +0 -51
  120. package/src/collapsible.tsx +0 -126
  121. package/src/color-mode.tsx +0 -125
  122. package/src/dialog.tsx +0 -356
  123. package/src/drawer.tsx +0 -186
  124. package/src/empty-state.tsx +0 -97
  125. package/src/field.tsx +0 -202
  126. package/src/heading.tsx +0 -55
  127. package/src/icon-button.tsx +0 -192
  128. package/src/image.tsx +0 -280
  129. package/src/index.ts +0 -192
  130. package/src/input-group.tsx +0 -159
  131. package/src/input.tsx +0 -60
  132. package/src/link.tsx +0 -326
  133. package/src/menu.tsx +0 -471
  134. package/src/pin-input.tsx +0 -187
  135. package/src/popover.tsx +0 -400
  136. package/src/progress-circle.tsx +0 -180
  137. package/src/progress.tsx +0 -109
  138. package/src/provider.tsx +0 -12
  139. package/src/radio.tsx +0 -175
  140. package/src/rating.tsx +0 -79
  141. package/src/select.tsx +0 -696
  142. package/src/separator.tsx +0 -59
  143. package/src/skeleton.tsx +0 -302
  144. package/src/slider.tsx +0 -152
  145. package/src/switch.tsx +0 -158
  146. package/src/table.tsx +0 -621
  147. package/src/tabs.tsx +0 -354
  148. package/src/tag.tsx +0 -159
  149. package/src/textarea.tsx +0 -60
  150. package/src/toaster.tsx +0 -117
  151. package/src/tokens.css +0 -438
  152. package/src/tooltip.tsx +0 -184
  153. package/src/utils/cn.ts +0 -7
  154. package/src/utils.ts +0 -6
  155. package/tokens.css +0 -438
package/src/radio.tsx DELETED
@@ -1,175 +0,0 @@
1
- import * as RadixRadioGroup from '@radix-ui/react-radio-group';
2
- // chakra() HOC removed — pure Radix + Tailwind
3
- import * as React from 'react';
4
-
5
- import { cn } from './utils';
6
-
7
- // ─── Size classes ───────────────────────────────────────────────────
8
- const SIZE_CLASSES = {
9
- xs: {
10
- root: 'gap-1.5',
11
- control: 'h-3 w-3',
12
- indicator: 'h-1.5 w-1.5',
13
- label: 'text-xs',
14
- },
15
- sm: {
16
- root: 'gap-1.5',
17
- control: 'h-3.5 w-3.5',
18
- indicator: 'h-1.5 w-1.5',
19
- label: 'text-xs',
20
- },
21
- md: {
22
- root: 'gap-2',
23
- control: 'h-4 w-4',
24
- indicator: 'h-2 w-2',
25
- label: 'text-sm',
26
- },
27
- lg: {
28
- root: 'gap-2.5',
29
- control: 'h-5 w-5',
30
- indicator: 'h-2.5 w-2.5',
31
- label: 'text-base',
32
- },
33
- } as const;
34
-
35
- type RadioSize = keyof typeof SIZE_CLASSES;
36
-
37
- // ─── Size context ───────────────────────────────────────────────────
38
- const RadioSizeContext = React.createContext<RadioSize>('md');
39
-
40
- // ─── RadioGroup ─────────────────────────────────────────────────────
41
- export interface RadioGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'dir'> {
42
- name?: string;
43
- required?: boolean;
44
- disabled?: boolean;
45
- readOnly?: boolean;
46
- orientation?: 'horizontal' | 'vertical';
47
- loop?: boolean;
48
- defaultValue?: string;
49
- value?: string | null;
50
- onValueChange?: (details: { value: string | null }) => void;
51
- size?: RadioSize;
52
- }
53
-
54
- const RadioGroupBase = React.forwardRef<HTMLDivElement, RadioGroupProps>(
55
- function RadioGroup(props, ref) {
56
- const {
57
- children,
58
- name,
59
- required,
60
- disabled = false,
61
- readOnly = false,
62
- orientation = 'vertical',
63
- loop = true,
64
- defaultValue,
65
- value,
66
- onValueChange,
67
- size = 'md',
68
- className,
69
- ...rest
70
- } = props;
71
-
72
- const handleValueChange = React.useCallback(
73
- (nextValue: string) => {
74
- if (readOnly) return;
75
- onValueChange?.({ value: nextValue });
76
- },
77
- [ readOnly, onValueChange ],
78
- );
79
-
80
- return (
81
- <RadioSizeContext.Provider value={ size }>
82
- <RadixRadioGroup.Root
83
- ref={ ref }
84
- name={ name }
85
- required={ required }
86
- disabled={ disabled || readOnly }
87
- orientation={ orientation }
88
- loop={ loop }
89
- defaultValue={ defaultValue }
90
- value={ value ?? undefined }
91
- onValueChange={ handleValueChange }
92
- className={ cn(
93
- 'flex',
94
- orientation === 'vertical' ? 'flex-col gap-3' : 'flex-row gap-6',
95
- className,
96
- ) }
97
- { ...rest }
98
- >
99
- { children }
100
- </RadixRadioGroup.Root>
101
- </RadioSizeContext.Provider>
102
- );
103
- },
104
- );
105
-
106
- export const RadioGroup = RadioGroupBase;
107
-
108
- const NOOP = () => { /* noop */ };
109
-
110
- // ─── Radio ──────────────────────────────────────────────────────────
111
- export interface RadioProps extends Omit<React.ComponentPropsWithoutRef<'label'>, 'onChange'> {
112
- rootRef?: React.Ref<HTMLLabelElement>;
113
- inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
114
- value: string;
115
- disabled?: boolean;
116
- }
117
-
118
- const RadioBase = React.forwardRef<HTMLInputElement, RadioProps>(
119
- function Radio(props, ref) {
120
- const { children, inputProps, rootRef, value, disabled, className, ...rest } = props;
121
- const size = React.useContext(RadioSizeContext);
122
- const sizeClasses = SIZE_CLASSES[size];
123
-
124
- return (
125
- <label
126
- ref={ rootRef }
127
- className={ cn(
128
- 'inline-flex items-center cursor-pointer select-none',
129
- sizeClasses.root,
130
- disabled && 'opacity-50 cursor-not-allowed',
131
- className,
132
- ) }
133
- data-disabled={ disabled || undefined }
134
- { ...rest }
135
- >
136
- <RadixRadioGroup.Item
137
- value={ value }
138
- disabled={ disabled }
139
- className={ cn(
140
- 'inline-flex items-center justify-center shrink-0 rounded-full',
141
- 'border-2 border-current/30',
142
- 'data-[state=checked]:border-gray-800 dark:border-white',
143
- 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-500',
144
- 'transition-colors duration-150',
145
- sizeClasses.control,
146
- ) }
147
- >
148
- <RadixRadioGroup.Indicator
149
- className={ cn(
150
- 'block rounded-full bg-gray-800 dark:bg-white',
151
- sizeClasses.indicator,
152
- ) }
153
- />
154
- </RadixRadioGroup.Item>
155
- { /* Hidden native input for form compatibility and ref forwarding */ }
156
- <input
157
- ref={ ref }
158
- type="radio"
159
- className="sr-only"
160
- value={ value }
161
- disabled={ disabled }
162
- tabIndex={ -1 }
163
- aria-hidden
164
- onChange={ NOOP }
165
- { ...inputProps }
166
- />
167
- { children != null && (
168
- <span className={ sizeClasses.label }>{ children }</span>
169
- ) }
170
- </label>
171
- );
172
- },
173
- );
174
-
175
- export const Radio = RadioBase;
package/src/rating.tsx DELETED
@@ -1,79 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import { cn } from './utils';
4
-
5
- // Inline star icons
6
- const StarFilledIcon = ({ className }: { readonly className?: string }) => (
7
- <svg className={ className } viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
8
- <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"/>
9
- </svg>
10
- );
11
- const StarOutlineIcon = ({ className }: { readonly className?: string }) => (
12
- <svg className={ className } viewBox="0 0 20 20" fill="none" stroke="currentColor" xmlns="http://www.w3.org/2000/svg">
13
- <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" strokeWidth="1.5"/>
14
- </svg>
15
- );
16
-
17
- export interface RatingProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
18
- count?: number;
19
- label?: string | Array<string>;
20
- defaultValue?: number;
21
- onValueChange?: ({ value }: { value: number }) => void;
22
- readOnly?: boolean;
23
- }
24
-
25
- export const Rating = React.forwardRef<HTMLDivElement, RatingProps>(
26
- function Rating(props, ref) {
27
- const { count = 5, label: labelProp, defaultValue = 0, onValueChange, readOnly, className, ...rest } = props;
28
-
29
- const [ value, setValue ] = React.useState(defaultValue);
30
- const [ hoveredIndex, setHoveredIndex ] = React.useState(-1);
31
-
32
- const highlightedIndex = hoveredIndex >= 0 && !readOnly ? hoveredIndex + 1 : value;
33
- const label = Array.isArray(labelProp) ? labelProp[highlightedIndex - 1] : labelProp;
34
-
35
- const handleClick = React.useCallback((index: number) => () => {
36
- if (readOnly) return;
37
- setValue(index);
38
- onValueChange?.({ value: index });
39
- }, [ readOnly, onValueChange ]);
40
-
41
- const handleMouseEnter = React.useCallback((index: number) => () => {
42
- if (readOnly) return;
43
- setHoveredIndex(index);
44
- }, [ readOnly ]);
45
-
46
- const handleMouseLeave = React.useCallback(() => {
47
- setHoveredIndex(-1);
48
- }, []);
49
-
50
- return (
51
- <div ref={ ref } className={ cn('inline-flex items-center gap-1', className) } { ...rest }>
52
- <div className="inline-flex items-center" onMouseLeave={ handleMouseLeave }>
53
- { Array.from({ length: count }).map((_, index) => {
54
- const filled = index < highlightedIndex;
55
- const starIndex = index + 1;
56
-
57
- return (
58
- <button
59
- key={ index }
60
- type="button"
61
- tabIndex={ readOnly ? -1 : 0 }
62
- aria-label={ `Rate ${ starIndex } of ${ count }` }
63
- className={ cn(
64
- 'inline-flex items-center justify-center w-5 h-5 text-current',
65
- readOnly ? 'cursor-default' : 'cursor-pointer',
66
- ) }
67
- onClick={ handleClick(starIndex) }
68
- onMouseEnter={ handleMouseEnter(index) }
69
- >
70
- { filled ? <StarFilledIcon className="w-5 h-5"/> : <StarOutlineIcon className="w-5 h-5"/> }
71
- </button>
72
- );
73
- }) }
74
- </div>
75
- { label && <span className="text-sm">{ label }</span> }
76
- </div>
77
- );
78
- },
79
- );