@dafaz-ui/react 2.2.2 → 3.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.
- package/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +660 -12
- package/dist/index.d.ts +660 -12
- package/dist/index.js +387 -28
- package/dist/index.mjs +372 -26
- package/package.json +4 -1
- package/src/components/Box/index.tsx +2 -0
- package/src/components/Box/styles.ts +2 -0
- package/src/components/CheckBox/index.tsx +25 -0
- package/src/components/CheckBox/styles.ts +128 -0
- package/src/components/Radio/RadioItem/index.tsx +32 -0
- package/src/components/Radio/RadioItem/styles.ts +130 -0
- package/src/components/Radio/index.tsx +29 -0
- package/src/components/Radio/styles.ts +25 -0
- package/src/components/TextArea/index.tsx +21 -0
- package/src/components/TextArea/styles.ts +40 -0
- package/src/components/TextInput/index.tsx +1 -1
- package/src/index.tsx +4 -1
@@ -0,0 +1,130 @@
|
|
1
|
+
import type { ComponentProps } from 'react'
|
2
|
+
import { keyframes, styled } from '../../../styles'
|
3
|
+
import * as RadioGroup from '@radix-ui/react-radio-group'
|
4
|
+
|
5
|
+
export const RadioItemContainer = styled('div', {
|
6
|
+
display: 'flex',
|
7
|
+
alignItems: 'center',
|
8
|
+
gap: '$2',
|
9
|
+
})
|
10
|
+
|
11
|
+
export const RadioItemUI = styled(RadioGroup.Item, {
|
12
|
+
all: 'unset',
|
13
|
+
borderRadius: '$full',
|
14
|
+
lineHeight: 0,
|
15
|
+
cursor: 'pointer',
|
16
|
+
overflow: 'hidden',
|
17
|
+
boxSizing: 'border-box',
|
18
|
+
display: 'flex',
|
19
|
+
justifyContent: 'center',
|
20
|
+
alignItems: 'center',
|
21
|
+
borderBottom: '2px solid $dafaz600',
|
22
|
+
transition: 'border 0.1s linear',
|
23
|
+
|
24
|
+
'&:focus,&[data-state="checked"]': {
|
25
|
+
backgroundColor: '$dafaz600',
|
26
|
+
borderColor: '$dafaz600',
|
27
|
+
},
|
28
|
+
|
29
|
+
'&[data-state="unchecked"]': {
|
30
|
+
backgroundColor: '$gray800',
|
31
|
+
},
|
32
|
+
|
33
|
+
'&:hover': {
|
34
|
+
borderColor: '$dafaz600',
|
35
|
+
},
|
36
|
+
|
37
|
+
variants: {
|
38
|
+
size: {
|
39
|
+
lg: {
|
40
|
+
width: '$7',
|
41
|
+
height: '$7',
|
42
|
+
borderBottom: '2px solid $dafaz600',
|
43
|
+
},
|
44
|
+
md: {
|
45
|
+
width: '$5',
|
46
|
+
height: '$5',
|
47
|
+
borderBottom: '1px solid $dafaz600',
|
48
|
+
},
|
49
|
+
sm: {
|
50
|
+
width: '$5',
|
51
|
+
height: '$5',
|
52
|
+
borderBottom: '0.5px solid $dafaz600',
|
53
|
+
},
|
54
|
+
},
|
55
|
+
},
|
56
|
+
defaultVariants: {
|
57
|
+
size: 'lg',
|
58
|
+
},
|
59
|
+
})
|
60
|
+
|
61
|
+
const slideIn = keyframes({
|
62
|
+
from: { transform: 'translateY(-100%)' },
|
63
|
+
to: { transform: 'translateY(0)' },
|
64
|
+
})
|
65
|
+
|
66
|
+
const slideOut = keyframes({
|
67
|
+
from: { transform: 'translateY(0)' },
|
68
|
+
to: { transform: 'translateY(100%)' },
|
69
|
+
})
|
70
|
+
|
71
|
+
export const RadioIndicator = styled(RadioGroup.Indicator, {
|
72
|
+
color: '$white',
|
73
|
+
|
74
|
+
'&[data-state="checked"]': {
|
75
|
+
animation: `${slideIn} 200ms ease-out`,
|
76
|
+
},
|
77
|
+
|
78
|
+
'&[data-state="unchecked"]': {
|
79
|
+
animation: `${slideOut} 200ms ease-out`,
|
80
|
+
},
|
81
|
+
|
82
|
+
variants: {
|
83
|
+
size: {
|
84
|
+
lg: {
|
85
|
+
width: '$5',
|
86
|
+
height: '$5',
|
87
|
+
},
|
88
|
+
md: {
|
89
|
+
width: '$4',
|
90
|
+
height: '$4',
|
91
|
+
},
|
92
|
+
sm: {
|
93
|
+
width: '$3',
|
94
|
+
height: '$3',
|
95
|
+
},
|
96
|
+
},
|
97
|
+
},
|
98
|
+
defaultVariants: {
|
99
|
+
size: 'lg',
|
100
|
+
},
|
101
|
+
})
|
102
|
+
|
103
|
+
export const Label = styled('label', {
|
104
|
+
fontFamily: '$app',
|
105
|
+
lineHeight: 0,
|
106
|
+
color: '$white',
|
107
|
+
fontWeight: '$regular',
|
108
|
+
cursor: 'pointer',
|
109
|
+
|
110
|
+
variants: {
|
111
|
+
size: {
|
112
|
+
lg: {
|
113
|
+
fontSize: '$xl',
|
114
|
+
},
|
115
|
+
md: {
|
116
|
+
fontSize: '$lg',
|
117
|
+
},
|
118
|
+
sm: {
|
119
|
+
fontSize: '$md',
|
120
|
+
},
|
121
|
+
},
|
122
|
+
},
|
123
|
+
defaultVariants: {
|
124
|
+
size: 'lg',
|
125
|
+
},
|
126
|
+
})
|
127
|
+
|
128
|
+
export interface RadioItemUIProps extends ComponentProps<typeof RadioItemUI> {
|
129
|
+
size?: 'sm' | 'md' | 'lg'
|
130
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { RadioUI, RadioUIProps } from './styles'
|
2
|
+
import { RadioItem } from './RadioItem'
|
3
|
+
|
4
|
+
interface Item {
|
5
|
+
id: string
|
6
|
+
label: string
|
7
|
+
value: string
|
8
|
+
}
|
9
|
+
|
10
|
+
interface RadioGroupProps extends RadioUIProps {
|
11
|
+
items: Item[]
|
12
|
+
}
|
13
|
+
|
14
|
+
export function Radio({ items, size, ...props }: RadioGroupProps) {
|
15
|
+
return (
|
16
|
+
<RadioUI {...props}>
|
17
|
+
{items.map((item) => {
|
18
|
+
return (
|
19
|
+
<RadioItem
|
20
|
+
id={item.id}
|
21
|
+
label={item.label}
|
22
|
+
value={item.value}
|
23
|
+
size={size}
|
24
|
+
/>
|
25
|
+
)
|
26
|
+
})}
|
27
|
+
</RadioUI>
|
28
|
+
)
|
29
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import type { ComponentProps } from 'react'
|
2
|
+
import { styled } from '../../styles'
|
3
|
+
import * as RadioGroup from '@radix-ui/react-radio-group'
|
4
|
+
|
5
|
+
export const RadioUI = styled(RadioGroup.Root, {
|
6
|
+
all: 'unset',
|
7
|
+
display: 'flex',
|
8
|
+
flexDirection: 'column',
|
9
|
+
gap: '$4',
|
10
|
+
|
11
|
+
variants: {
|
12
|
+
size: {
|
13
|
+
lg: {},
|
14
|
+
md: {},
|
15
|
+
sm: {},
|
16
|
+
},
|
17
|
+
},
|
18
|
+
defaultVariants: {
|
19
|
+
size: 'lg',
|
20
|
+
},
|
21
|
+
})
|
22
|
+
|
23
|
+
export interface RadioUIProps extends ComponentProps<typeof RadioUI> {
|
24
|
+
size?: 'sm' | 'md' | 'lg'
|
25
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import type { ReactNode } from 'react'
|
2
|
+
import { TextAreaUI, type TextAreaUIProps } from './styles'
|
3
|
+
|
4
|
+
interface TextAreaProps {
|
5
|
+
children?: ReactNode
|
6
|
+
placeholder?: string
|
7
|
+
disabled?: boolean
|
8
|
+
}
|
9
|
+
|
10
|
+
export function TextArea({
|
11
|
+
children,
|
12
|
+
...props
|
13
|
+
}: TextAreaUIProps & TextAreaProps) {
|
14
|
+
return (
|
15
|
+
<TextAreaUI rows={3} {...props}>
|
16
|
+
{children}
|
17
|
+
</TextAreaUI>
|
18
|
+
)
|
19
|
+
}
|
20
|
+
|
21
|
+
TextArea.displayName = 'TextArea'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import type { ComponentProps } from 'react'
|
2
|
+
import { styled } from '../../styles'
|
3
|
+
|
4
|
+
export const TextAreaUI = styled('textarea', {
|
5
|
+
fontFamily: '$app',
|
6
|
+
fontSize: '$lg',
|
7
|
+
color: '$white',
|
8
|
+
fontWeight: '$regular',
|
9
|
+
resize: 'vertical',
|
10
|
+
|
11
|
+
border: '0.7px solid $gray400',
|
12
|
+
|
13
|
+
margin: 0,
|
14
|
+
backgroundColor: 'transparent',
|
15
|
+
borderBottom: '2px solid $dafaz600',
|
16
|
+
borderRadius: '$md',
|
17
|
+
boxSizing: 'border-box',
|
18
|
+
display: 'flex',
|
19
|
+
alignItems: 'baseline',
|
20
|
+
width: '100%',
|
21
|
+
padding: '$1 $2',
|
22
|
+
|
23
|
+
'&:focus': {
|
24
|
+
outline: 0,
|
25
|
+
},
|
26
|
+
|
27
|
+
'&:disabled': {
|
28
|
+
opacity: 0.5,
|
29
|
+
cursor: 'not-allowed',
|
30
|
+
},
|
31
|
+
|
32
|
+
'&::placeholder': {
|
33
|
+
fontSize: '$xl',
|
34
|
+
fontWeight: '$regular',
|
35
|
+
color: '$white',
|
36
|
+
opacity: 0.75,
|
37
|
+
},
|
38
|
+
})
|
39
|
+
|
40
|
+
export interface TextAreaUIProps extends ComponentProps<typeof TextAreaUI> {}
|
package/src/index.tsx
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
export * from './components/Box'
|
2
2
|
export * from './components/Button'
|
3
|
-
export * from './components/
|
3
|
+
export * from './components/CheckBox'
|
4
4
|
export * from './components/Heading'
|
5
|
+
export * from './components/Radio'
|
6
|
+
export * from './components/Text'
|
7
|
+
export * from './components/TextArea'
|
5
8
|
export * from './components/TextInput'
|
6
9
|
|
7
10
|
export * from './styles'
|