@lets-events/react 2.0.0 → 4.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 +12 -0
- package/dist/index.d.mts +7288 -7
- package/dist/index.d.ts +7288 -7
- package/dist/index.js +3030 -21
- package/dist/index.mjs +3004 -20
- package/package.json +8 -1
- package/src/components/Avatar.tsx +56 -0
- package/src/components/Badge.tsx +121 -0
- package/src/components/BadgeText.tsx +29 -0
- package/src/components/BodyText.tsx +24 -0
- package/src/components/Box.tsx +3 -0
- package/src/components/Button.tsx +349 -0
- package/src/components/ButtonGroup.tsx +478 -0
- package/src/components/CaptionText.tsx +16 -0
- package/src/components/CheckboxGroup.tsx +208 -0
- package/src/components/DisplayText.tsx +26 -0
- package/src/components/Dropdown.tsx +109 -0
- package/src/components/Filter.tsx +96 -0
- package/src/components/Flex.tsx +47 -0
- package/src/components/Headline.tsx +29 -0
- package/src/components/Icon.tsx +48 -0
- package/src/components/Label.tsx +28 -0
- package/src/components/RadioGroup.tsx +204 -0
- package/src/components/Subtitle.tsx +26 -0
- package/src/components/Text.tsx +8 -11
- package/src/components/TextField.tsx +193 -0
- package/src/components/TooltipText.tsx +15 -0
- package/src/index.tsx +22 -0
- package/src/styles/index.ts +2 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { ComponentProps, useState } from 'react'
|
|
2
|
+
import { styled } from '../styles'
|
|
3
|
+
import { TextField as TextFieldRadix } from "@radix-ui/themes";
|
|
4
|
+
import Icon from './Icon';
|
|
5
|
+
|
|
6
|
+
export const TextFieldStyled = styled(TextFieldRadix.Root, {
|
|
7
|
+
height: '$40',
|
|
8
|
+
fontFamily: '$default',
|
|
9
|
+
letterSpacing: '0px',
|
|
10
|
+
fontSize: '$13',
|
|
11
|
+
padding: '$12 $14',
|
|
12
|
+
borderRadius: '$sm',
|
|
13
|
+
boxSizing: 'border-box',
|
|
14
|
+
color: '$dark500',
|
|
15
|
+
border: '1px solid $dark300',
|
|
16
|
+
position: 'relative',
|
|
17
|
+
display: 'flex',
|
|
18
|
+
'input': {
|
|
19
|
+
order: 1,
|
|
20
|
+
border: 'none',
|
|
21
|
+
outline: 'none',
|
|
22
|
+
padding: 0,
|
|
23
|
+
margin: 0,
|
|
24
|
+
width: '100%',
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
'&:has(input:focus)': {
|
|
28
|
+
border: '2px solid $brand300',
|
|
29
|
+
},
|
|
30
|
+
'&:has(input:disabled)': {
|
|
31
|
+
backgroundColor: '$dark100',
|
|
32
|
+
color: '$dark400',
|
|
33
|
+
border: '1px solid $dark200',
|
|
34
|
+
cursor: 'not-allowed',
|
|
35
|
+
},
|
|
36
|
+
variants: {
|
|
37
|
+
color: {
|
|
38
|
+
default: {
|
|
39
|
+
color: '$dark400',
|
|
40
|
+
border: '1px solid $dark200',
|
|
41
|
+
'&:has(input:focus)': {
|
|
42
|
+
border: '2px solid $brand300',
|
|
43
|
+
},
|
|
44
|
+
'&:has(input:disabled)': {
|
|
45
|
+
backgroundColor: '$dark100',
|
|
46
|
+
color: '$dark400',
|
|
47
|
+
border: '1px solid $dark200',
|
|
48
|
+
cursor: 'not-allowed',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
error:{
|
|
52
|
+
border: '1px solid $error400',
|
|
53
|
+
color: '$error400',
|
|
54
|
+
'input::placeholder': {
|
|
55
|
+
color: '$error400',
|
|
56
|
+
},
|
|
57
|
+
'& hast(input:focus)': {
|
|
58
|
+
border: '2px solid $error400',
|
|
59
|
+
},
|
|
60
|
+
'&:has(input:disabled)': {
|
|
61
|
+
backgroundColor: '$error50',
|
|
62
|
+
color: '$error300',
|
|
63
|
+
border: '1px solid $error100',
|
|
64
|
+
cursor: 'not-allowed',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
},
|
|
69
|
+
isValid: {
|
|
70
|
+
true: {},
|
|
71
|
+
false: {
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
compoundVariants: [
|
|
77
|
+
{
|
|
78
|
+
isValid: false,
|
|
79
|
+
css: {
|
|
80
|
+
border: '1px solid $error400',
|
|
81
|
+
color: '$error400',
|
|
82
|
+
backgroundColor: '$error50',
|
|
83
|
+
'input': {
|
|
84
|
+
'&::placeholder': {
|
|
85
|
+
color: '$error400',
|
|
86
|
+
},
|
|
87
|
+
backgroundColor: '$error50',
|
|
88
|
+
},
|
|
89
|
+
'&:has(input:focus)': {
|
|
90
|
+
border: '2px solid $error400',
|
|
91
|
+
},
|
|
92
|
+
'&:has(input:disabled)': {
|
|
93
|
+
'input': {
|
|
94
|
+
backgroundColor: '$error50',
|
|
95
|
+
},
|
|
96
|
+
backgroundColor: '$error50',
|
|
97
|
+
color: '$error300',
|
|
98
|
+
border: '1px solid $error100',
|
|
99
|
+
cursor: 'not-allowed',
|
|
100
|
+
},
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
isValid: true,
|
|
105
|
+
css: {
|
|
106
|
+
'&:has(input:focus)': {
|
|
107
|
+
border: '2px solid $success500',
|
|
108
|
+
},
|
|
109
|
+
'&:has(input:disabled)': {
|
|
110
|
+
backgroundColor: '$dark100',
|
|
111
|
+
color: '$dark400',
|
|
112
|
+
border: '1px solid $dark200',
|
|
113
|
+
cursor: 'not-allowed',
|
|
114
|
+
},
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
export const TextFieldSlotStyled = styled(TextFieldRadix.Slot, {
|
|
121
|
+
display: 'flex',
|
|
122
|
+
alignItems: 'center',
|
|
123
|
+
justifyContent: 'center',
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
export type TextFieldProps = ComponentProps<typeof TextFieldStyled> & {
|
|
127
|
+
placeholder?: string
|
|
128
|
+
children?: React.ReactNode
|
|
129
|
+
isValid?: boolean,
|
|
130
|
+
name?: string,
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export type TextFieldSlotProps = Omit<ComponentProps<typeof TextFieldStyled>, 'color'> & {
|
|
134
|
+
placeholder?: string
|
|
135
|
+
children?: React.ReactNode
|
|
136
|
+
position?: 'flex-start' | 'flex-end'
|
|
137
|
+
onClick?: () => void,
|
|
138
|
+
color?: "error" | "success" | undefined
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function TextField({
|
|
142
|
+
children,
|
|
143
|
+
isValid,
|
|
144
|
+
name,
|
|
145
|
+
color,
|
|
146
|
+
...props
|
|
147
|
+
}: TextFieldProps) {
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<TextFieldStyled color={color} isValid={isValid} name={name} {...props}>
|
|
151
|
+
{children}
|
|
152
|
+
{isValid && (
|
|
153
|
+
<TextFieldSlot position='flex-end' name={name} color={color as TextFieldSlotProps['color']}>
|
|
154
|
+
<Icon name='check' />
|
|
155
|
+
</TextFieldSlot>
|
|
156
|
+
)}
|
|
157
|
+
</TextFieldStyled>
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function TextFieldSlot({
|
|
162
|
+
children,
|
|
163
|
+
position = 'flex-start',
|
|
164
|
+
onClick,
|
|
165
|
+
...props
|
|
166
|
+
}: TextFieldSlotProps) {
|
|
167
|
+
console.log('onclick', onClick)
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<>
|
|
171
|
+
{
|
|
172
|
+
!!onClick ?
|
|
173
|
+
<TextFieldSlotStyled {...{ ...props, color: undefined }} style={{
|
|
174
|
+
position: 'absolute',
|
|
175
|
+
left: position === 'flex-end' ? 'none' : 15,
|
|
176
|
+
right: position === 'flex-start' ? 'none' : 15,
|
|
177
|
+
padding: 13,
|
|
178
|
+
zIndex: 2,
|
|
179
|
+
top: 0,
|
|
180
|
+
cursor: 'pointer',
|
|
181
|
+
}} onClick={() => onClick()}>{children}</TextFieldSlotStyled>
|
|
182
|
+
:
|
|
183
|
+
<TextFieldSlotStyled {...{ ...props, color: undefined }} style={{
|
|
184
|
+
float: position === 'flex-start' ? 'left' : 'right',
|
|
185
|
+
order: position === 'flex-start' ? 0 : 2,
|
|
186
|
+
marginLeft: position === 'flex-start' ? 0 : 15,
|
|
187
|
+
marginRight: position === 'flex-end' ? 0 : 15,
|
|
188
|
+
}}>{children}</TextFieldSlotStyled>
|
|
189
|
+
|
|
190
|
+
}
|
|
191
|
+
</>
|
|
192
|
+
)
|
|
193
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentProps, ElementType } from 'react'
|
|
2
|
+
import { styled } from '../styles'
|
|
3
|
+
|
|
4
|
+
export const TooltipText = styled('span', {
|
|
5
|
+
fontFamily: '$default',
|
|
6
|
+
color: '$gray100',
|
|
7
|
+
letterSpacing: '0px',
|
|
8
|
+
fontSize: '$13',
|
|
9
|
+
lineHeight: '$16',
|
|
10
|
+
fontWeight: '$regular',
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export interface TooltipTextProps extends ComponentProps<typeof TooltipText> {
|
|
14
|
+
as?: ElementType
|
|
15
|
+
}
|
package/src/index.tsx
CHANGED
|
@@ -1 +1,23 @@
|
|
|
1
|
+
export * from './components/Icon'
|
|
1
2
|
export * from './components/Text'
|
|
3
|
+
export * from './components/DisplayText'
|
|
4
|
+
export * from './components/Headline'
|
|
5
|
+
export * from './components/Subtitle'
|
|
6
|
+
export * from './components/BodyText'
|
|
7
|
+
export * from './components/Label'
|
|
8
|
+
export * from './components/BadgeText'
|
|
9
|
+
export * from './components/CaptionText'
|
|
10
|
+
export * from './components/TooltipText'
|
|
11
|
+
|
|
12
|
+
export * from './components/Button'
|
|
13
|
+
export * from './components/ButtonGroup'
|
|
14
|
+
export * from './components/Avatar'
|
|
15
|
+
export * from './components/Flex'
|
|
16
|
+
export * from './components/Box'
|
|
17
|
+
export * from './components/TextField'
|
|
18
|
+
export * from './components/RadioGroup'
|
|
19
|
+
export * from './components/CheckboxGroup'
|
|
20
|
+
export * from './components/Filter'
|
|
21
|
+
export * from './components/Dropdown'
|
|
22
|
+
export * from './components/Badge'
|
|
23
|
+
|
package/src/styles/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
radii,
|
|
8
8
|
space,
|
|
9
9
|
} from '@lets-events/tokens'
|
|
10
|
+
|
|
10
11
|
import { createStitches, defaultThemeMap } from '@stitches/react'
|
|
11
12
|
|
|
12
13
|
export const {
|
|
@@ -23,6 +24,7 @@ export const {
|
|
|
23
24
|
...defaultThemeMap,
|
|
24
25
|
height: 'space',
|
|
25
26
|
width: 'space',
|
|
27
|
+
gap: 'space'
|
|
26
28
|
},
|
|
27
29
|
theme: {
|
|
28
30
|
colors,
|