@lets-events/react 2.0.0 → 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.
@@ -0,0 +1,162 @@
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
+ isValid: {
38
+ true: {},
39
+ false: {
40
+ border: '1px solid $error400',
41
+ color: '$error400',
42
+ backgroundColor: '$error50',
43
+ }
44
+ },
45
+ },
46
+
47
+ compoundVariants: [
48
+ {
49
+ isValid: false,
50
+ css: {
51
+ border: '1px solid $error400',
52
+ color: '$error400',
53
+ backgroundColor: '$error50',
54
+ 'input': {
55
+ '&::placeholder': {
56
+ color: '$error400',
57
+ },
58
+ backgroundColor: '$error50',
59
+ },
60
+ '&:has(input:focus)': {
61
+ border: '2px solid $error400',
62
+ },
63
+ '&:has(input:disabled)': {
64
+ 'input': {
65
+ backgroundColor: '$error50',
66
+ },
67
+ backgroundColor: '$error50',
68
+ color: '$error300',
69
+ border: '1px solid $error100',
70
+ cursor: 'not-allowed',
71
+ },
72
+ }
73
+ },
74
+ {
75
+ isValid: true,
76
+ css: {
77
+ '&:has(input:focus)': {
78
+ border: '2px solid $success500',
79
+ },
80
+ '&:has(input:disabled)': {
81
+ backgroundColor: '$dark100',
82
+ color: '$dark400',
83
+ border: '1px solid $dark200',
84
+ cursor: 'not-allowed',
85
+ },
86
+ }
87
+ }
88
+ ],
89
+ })
90
+
91
+ export const TextFieldSlotStyled = styled(TextFieldRadix.Slot, {
92
+ display: 'flex',
93
+ alignItems: 'center',
94
+ justifyContent: 'center',
95
+ })
96
+
97
+ export type TextFieldProps = ComponentProps<typeof TextFieldStyled> & {
98
+ placeholder?: string
99
+ children?: React.ReactNode
100
+ isValid?: boolean,
101
+ name?: string,
102
+ }
103
+
104
+ export type TextFieldSlotProps = ComponentProps<typeof TextFieldStyled> & {
105
+ placeholder?: string
106
+ children?: React.ReactNode
107
+ position?: 'flex-start' | 'flex-end'
108
+ onClick?: () => void,
109
+ }
110
+
111
+ export function TextField({
112
+ children,
113
+ isValid,
114
+ name,
115
+ ...props
116
+ }: TextFieldProps) {
117
+
118
+ return (
119
+ <TextFieldStyled isValid={isValid} name={name} {...props}>
120
+ {children}
121
+ {isValid && (
122
+ <TextFieldSlot position='flex-end' name={name}>
123
+ <Icon name='check' />
124
+ </TextFieldSlot>
125
+ )}
126
+ </TextFieldStyled>
127
+ )
128
+ }
129
+
130
+ export function TextFieldSlot({
131
+ children,
132
+ position = 'flex-start',
133
+ onClick,
134
+ ...props
135
+ }: TextFieldSlotProps) {
136
+ console.log('onclick', onClick)
137
+
138
+ return (
139
+ <>
140
+ {
141
+ !!onClick ?
142
+ <TextFieldSlotStyled {...props} style={{
143
+ position: 'absolute',
144
+ left: position === 'flex-end' ? 'none' : 15,
145
+ right: position === 'flex-start' ? 'none' : 15,
146
+ padding: 13,
147
+ zIndex: 2,
148
+ top: 0,
149
+ cursor: 'pointer',
150
+ }} onClick={() => onClick()}>{children}</TextFieldSlotStyled>
151
+ :
152
+ <TextFieldSlotStyled {...props} style={{
153
+ float: position === 'flex-start' ? 'left' : 'right',
154
+ order: position === 'flex-start' ? 0 : 2,
155
+ marginLeft: position === 'flex-start' ? 0 : 15,
156
+ marginRight: position === 'flex-end' ? 0 : 15,
157
+ }}>{children}</TextFieldSlotStyled>
158
+
159
+ }
160
+ </>
161
+ )
162
+ }
@@ -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,22 @@
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
+
@@ -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,