@luxfi/ui 7.1.0 → 7.2.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.
- package/dist/alert.cjs +22 -50
- package/dist/alert.js +22 -50
- package/dist/bank.d.cts +1 -1
- package/dist/bank.d.ts +1 -1
- package/dist/index.cjs +105 -172
- package/dist/index.js +105 -172
- package/dist/input.cjs +25 -36
- package/dist/input.js +25 -36
- package/dist/tag.cjs +15 -35
- package/dist/tag.js +15 -35
- package/dist/textarea.cjs +25 -36
- package/dist/textarea.js +25 -36
- package/package.json +1 -2
- package/src/alert.tsx +23 -51
- package/src/input.tsx +27 -36
- package/src/tag.tsx +17 -35
- package/src/textarea.tsx +27 -36
package/src/textarea.tsx
CHANGED
|
@@ -1,41 +1,32 @@
|
|
|
1
|
-
import { cva } from 'class-variance-authority';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
|
|
4
3
|
import { cn } from './utils';
|
|
5
4
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
defaultVariants: {
|
|
34
|
-
size: 'md',
|
|
35
|
-
variant: 'outline',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
);
|
|
5
|
+
const TEXTAREA_BASE = [
|
|
6
|
+
'w-full appearance-none outline-none transition-colors resize-y',
|
|
7
|
+
'bg-[var(--color-input-bg)] text-[var(--color-input-fg)] border-[var(--color-input-border)]',
|
|
8
|
+
'placeholder:text-[var(--color-input-placeholder,theme(colors.gray.400))]',
|
|
9
|
+
'hover:border-[var(--color-input-border-hover,theme(colors.gray.400))]',
|
|
10
|
+
'focus:border-[var(--color-input-border-focus,theme(colors.blue.500))]',
|
|
11
|
+
'focus:placeholder:text-[var(--color-input-placeholder-focus,theme(colors.gray.300))]',
|
|
12
|
+
'disabled:opacity-40 disabled:cursor-not-allowed',
|
|
13
|
+
'read-only:opacity-70',
|
|
14
|
+
'data-[invalid]:border-[var(--color-input-border-invalid,theme(colors.red.500))]',
|
|
15
|
+
].join(' ');
|
|
16
|
+
|
|
17
|
+
const TEXTAREA_SIZE_CLASSES: Record<string, string> = {
|
|
18
|
+
xs: 'px-2 py-1 text-xs rounded',
|
|
19
|
+
sm: 'px-3 py-2 text-sm rounded-md',
|
|
20
|
+
md: 'px-4 py-2 text-base rounded-md',
|
|
21
|
+
lg: 'px-4 py-3 text-lg rounded-lg',
|
|
22
|
+
'2xl': 'px-4 py-3 text-xl rounded-lg',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const TEXTAREA_VARIANT_CLASSES: Record<string, string> = {
|
|
26
|
+
outline: 'border border-solid',
|
|
27
|
+
filled: 'border-0 bg-[var(--color-input-filled-bg,theme(colors.gray.100))]',
|
|
28
|
+
unstyled: 'border-0 bg-transparent p-0',
|
|
29
|
+
};
|
|
39
30
|
|
|
40
31
|
type TextareaSize = 'xs' | 'sm' | 'md' | 'lg' | '2xl';
|
|
41
32
|
type TextareaVariant = 'outline' | 'filled' | 'unstyled';
|
|
@@ -46,11 +37,11 @@ export interface TextareaProps extends Omit<React.ComponentPropsWithRef<'textare
|
|
|
46
37
|
}
|
|
47
38
|
|
|
48
39
|
export const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
49
|
-
({ size, variant, className, ...rest }, ref) => {
|
|
40
|
+
({ size = 'md', variant = 'outline', className, ...rest }, ref) => {
|
|
50
41
|
return (
|
|
51
42
|
<textarea
|
|
52
43
|
ref={ ref }
|
|
53
|
-
className={ cn(
|
|
44
|
+
className={ cn(TEXTAREA_BASE, TEXTAREA_SIZE_CLASSES[size], TEXTAREA_VARIANT_CLASSES[variant], className) }
|
|
54
45
|
{ ...rest }
|
|
55
46
|
/>
|
|
56
47
|
);
|