@lets-events/react 5.0.0 → 6.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.
@@ -1,109 +1,109 @@
1
- import { ComponentProps } from 'react'
2
- import { styled } from '../styles'
3
- import { Dialog as ModalRadix } from "@radix-ui/themes";
4
- import { Button } from './Button';
5
- import Icon from './Icon';
6
- import { Box } from './Box';
7
- import { Flex } from './Flex';
8
- export const ModalStyled = styled('div', {
9
- fontFamily: '$default',
10
- lineHeight: '$base',
11
- fontSize: '$13',
12
- borderRadius: '$sm',
13
- })
14
-
15
- export const ModalContentStyled = styled(ModalRadix.Content, {
16
- fontFamily: '$default',
17
- lineHeight: '$base',
18
- fontSize: '$13',
19
- maxWidth: '502px',
20
- width: '100%',
21
- border: '1px solid $neutral',
22
- borderRadius: '$2xl',
23
- boxShadow: '0px 4px 4px 0px rgba(35, 53, 67, 0.08), 0px 2px 4px 0px rgba(35, 53, 67, 0.16)',
24
- })
25
- const ModalHeaderStyled = styled('div', {
26
- borderBottom: '1px solid $neutral300',
27
- padding: '$16 $24',
28
- textAlign: 'center',
29
- position: 'relative',
30
- display: 'flex',
31
- alignItems: 'center',
32
- justifyContent: 'center',
33
- })
34
-
35
- const ModalIconClose = styled(Icon, {
36
- position: 'absolute',
37
- right: '$24',
38
- cursor: 'pointer'
39
- })
40
-
41
- const ModalFooterStyled = styled('div', {
42
- borderTop: '1px solid $neutral300',
43
- padding: '$16 $24',
44
-
45
- '.modal-footer-flex': {
46
- justifyContent: 'flex-end'
47
- }
48
- })
49
-
50
- export const ModalTitleStyled = styled(ModalRadix.Title, {
51
- fontFamily: '$default',
52
- lineHeight: '$base',
53
- fontSize: '$18',
54
- fontWeight: 'medium',
55
- fontStyle: 'normal',
56
- textTransform: 'uppercase'
57
- })
58
-
59
- export type ModalProps = ComponentProps<typeof ModalStyled> & {
60
- trigger: React.ReactNode,
61
- title?: string
62
- children: React.ReactNode,
63
- cancel?: boolean
64
- cancelText?: string,
65
- action?: boolean
66
- actionText?: string;
67
- onAction?: () => void;
68
- }
69
- export function Modal({ children, title, trigger, cancel, cancelText, action, actionText, onAction, ...props }: ModalProps) {
70
- return (
71
- <ModalRadix.Root>
72
- <ModalStyled {...props}>
73
- <ModalRadix.Trigger>
74
- {trigger}
75
- </ModalRadix.Trigger>
76
-
77
- <ModalContentStyled>
78
- <ModalHeaderStyled>
79
- {title && <ModalTitleStyled>{title}</ModalTitleStyled>}
80
- <ModalRadix.Close>
81
- <ModalIconClose name='close' size='xl' />
82
- </ModalRadix.Close>
83
- </ModalHeaderStyled>
84
- <Box>
85
- {children}
86
- </Box>
87
- {cancel || action ? (
88
- <ModalFooterStyled>
89
- <Flex gap="10" justify="end" width={'100%'} className='modal-footer-flex'>
90
-
91
- {action && onAction && (
92
- <ModalRadix.Close>
93
- <Button variant='contained' color='brand' onClick={onAction}>{actionText ? actionText : 'Salvar'}</Button>
94
- </ModalRadix.Close>
95
- )}
96
- {cancel && (
97
- <ModalRadix.Close>
98
- <Button variant="outlined" color="neutral">
99
- {cancelText ? cancelText : 'cancelar'}
100
- </Button>
101
- </ModalRadix.Close>
102
- )}
103
- </Flex>
104
- </ModalFooterStyled>) : null}
105
- </ModalContentStyled>
106
- </ModalStyled>
107
- </ModalRadix.Root>
108
- )
1
+ import { ComponentProps } from 'react'
2
+ import { styled } from '../styles'
3
+ import { Dialog as ModalRadix } from "@radix-ui/themes";
4
+ import { Button } from './Button';
5
+ import Icon from './Icon';
6
+ import { Box } from './Box';
7
+ import { Flex } from './Flex';
8
+ export const ModalStyled = styled('div', {
9
+ fontFamily: '$default',
10
+ lineHeight: '$base',
11
+ fontSize: '$13',
12
+ borderRadius: '$sm',
13
+ })
14
+
15
+ export const ModalContentStyled = styled(ModalRadix.Content, {
16
+ fontFamily: '$default',
17
+ lineHeight: '$base',
18
+ fontSize: '$13',
19
+ maxWidth: '502px',
20
+ width: '100%',
21
+ border: '1px solid $neutral',
22
+ borderRadius: '$2xl',
23
+ boxShadow: '0px 4px 4px 0px rgba(35, 53, 67, 0.08), 0px 2px 4px 0px rgba(35, 53, 67, 0.16)',
24
+ })
25
+ const ModalHeaderStyled = styled('div', {
26
+ borderBottom: '1px solid $neutral300',
27
+ padding: '$16 $24',
28
+ textAlign: 'center',
29
+ position: 'relative',
30
+ display: 'flex',
31
+ alignItems: 'center',
32
+ justifyContent: 'center',
33
+ })
34
+
35
+ const ModalIconClose = styled(Icon, {
36
+ position: 'absolute',
37
+ right: '$24',
38
+ cursor: 'pointer'
39
+ })
40
+
41
+ const ModalFooterStyled = styled('div', {
42
+ borderTop: '1px solid $neutral300',
43
+ padding: '$16 $24',
44
+
45
+ '.modal-footer-flex': {
46
+ justifyContent: 'flex-end'
47
+ }
48
+ })
49
+
50
+ export const ModalTitleStyled = styled(ModalRadix.Title, {
51
+ fontFamily: '$default',
52
+ lineHeight: '$base',
53
+ fontSize: '$18',
54
+ fontWeight: 'medium',
55
+ fontStyle: 'normal',
56
+ textTransform: 'uppercase'
57
+ })
58
+
59
+ export type ModalProps = ComponentProps<typeof ModalStyled> & {
60
+ trigger: React.ReactNode,
61
+ title?: string
62
+ children: React.ReactNode,
63
+ cancel?: boolean
64
+ cancelText?: string,
65
+ action?: boolean
66
+ actionText?: string;
67
+ onAction?: () => void;
68
+ }
69
+ export function Modal({ children, title, trigger, cancel, cancelText, action, actionText, onAction, ...props }: ModalProps) {
70
+ return (
71
+ <ModalRadix.Root>
72
+ <ModalStyled {...props}>
73
+ <ModalRadix.Trigger>
74
+ {trigger}
75
+ </ModalRadix.Trigger>
76
+
77
+ <ModalContentStyled>
78
+ <ModalHeaderStyled>
79
+ {title && <ModalTitleStyled>{title}</ModalTitleStyled>}
80
+ <ModalRadix.Close>
81
+ <ModalIconClose name='close' size='xl' />
82
+ </ModalRadix.Close>
83
+ </ModalHeaderStyled>
84
+ <Box>
85
+ {children}
86
+ </Box>
87
+ {cancel || action ? (
88
+ <ModalFooterStyled>
89
+ <Flex gap="10" justify="end" width={'100%'} className='modal-footer-flex'>
90
+
91
+ {action && onAction && (
92
+ <ModalRadix.Close>
93
+ <Button variant='contained' color='brand' onClick={onAction}>{actionText ? actionText : 'Salvar'}</Button>
94
+ </ModalRadix.Close>
95
+ )}
96
+ {cancel && (
97
+ <ModalRadix.Close>
98
+ <Button variant="outlined" color="neutral">
99
+ {cancelText ? cancelText : 'cancelar'}
100
+ </Button>
101
+ </ModalRadix.Close>
102
+ )}
103
+ </Flex>
104
+ </ModalFooterStyled>) : null}
105
+ </ModalContentStyled>
106
+ </ModalStyled>
107
+ </ModalRadix.Root>
108
+ )
109
109
  }
@@ -1,204 +1,211 @@
1
- import { ComponentProps } from 'react'
2
- import { styled } from '../styles'
3
- import { RadioGroup as RadioGroupRadix } from "@radix-ui/themes";
4
-
5
- export const RadioGroupStyled = styled(RadioGroupRadix.Root, {
6
- fontFamily: '$default',
7
- letterSpacing: '0px',
8
- fontSize: '$13',
9
-
10
- 'label': {
11
- display: 'flex',
12
- alignItems: 'center',
13
- gap: '$8',
14
- cursor: 'pointer',
15
- '&:focus button, &:hover button': {
16
- transition: 'all 300ms ease-out',
17
- boxShadow: '0px 0px 0px 4px rgba(56, 129, 255, 0.50)'
18
- }
19
- },
20
- 'label button': {
21
- backgroundColor: '$white',
22
- borderRadius: '$full',
23
- height: '$16',
24
- width: '$16',
25
- position: 'relative',
26
- border: '2px solid $dark300',
27
- cursor: 'pointer',
28
- },
29
- 'label button[data-state=checked]:before': {
30
- backgroundColor: '$dark50',
31
- content: '',
32
- width: '8px',
33
- height: '8px',
34
- position: 'absolute',
35
- top: '2px',
36
- right: '2px',
37
- borderRadius: '$full',
38
- zIndex: 2,
39
- },
40
- 'label button[data-state=checked]:after': {
41
- backgroundColor: '$brand500',
42
- content: '',
43
- height: '$16',
44
- width: '$16',
45
- position: 'absolute',
46
- top: '-2px',
47
- right: '-2px',
48
- borderRadius: '$full',
49
- zIndex: 1,
50
- },
51
-
52
- variants: {
53
- color: {
54
- success: {
55
- 'label': {
56
- '&:focus button, &:hover button': {
57
- boxShadow: '0px 0px 0px 4px rgba(38, 167, 67, 0.50)',
58
- }
59
- },
60
- 'label button': {
61
- borderColor: '$green500',
62
- backgroundColor: '$dark50',
63
- },
64
- 'label button[data-state=checked]:after': {
65
- backgroundColor: '$green500',
66
- },
67
- },
68
- blue: {},
69
- error: {
70
- 'label': {
71
- '&:focus button, &:hover button': {
72
- boxShadow: '0px 0px 0px 4px rgba(225, 86, 98, 0.50)'
73
- }
74
- },
75
- 'label button': {
76
- borderColor: '$error400',
77
- backgroundColor: '$dark50',
78
- },
79
- 'label button[data-state=checked]:after': {
80
- backgroundColor: '$error600',
81
- },
82
- }
83
- },
84
- disabled: {
85
- true: {
86
- 'label': {
87
- cursor: 'not-allowed',
88
- opacity: 0.5,
89
- '&:focus button, &:hover button': {
90
- boxShadow: 'none',
91
- }
92
- },
93
- 'label button': {
94
- cursor: 'not-allowed',
95
- }
96
- },
97
- false: {}
98
- }
99
- },
100
-
101
- compoundVariants: [
102
- {
103
- color: 'blue',
104
- disabled: false,
105
- css: {
106
- 'label': {
107
- '&:focus button, &:hover button': {
108
- boxShadow: '0px 0px 0px 4px rgba(56, 129, 255, 0.50)'
109
- }
110
- },
111
- 'label button': {
112
- borderColor: '$dark300',
113
- },
114
- 'label button[data-state=checked]:after': {
115
- backgroundColor: '$brand500',
116
- },
117
- }
118
- },
119
-
120
- {
121
- color: 'blue',
122
- disabled: true,
123
- css: {
124
- 'label button': {
125
- borderColor: '$brand100',
126
- backgroundColor: '$dark50',
127
- },
128
- 'label button[data-state=checked]:after': {
129
- backgroundColor: '$brand100',
130
- },
131
- }
132
- },
133
-
134
- {
135
- color: 'success',
136
- disabled: true,
137
- css: {
138
- 'label button': {
139
- borderColor: '$success100',
140
- backgroundColor: '$dark50',
141
- },
142
- 'label button[data-state=checked]:after': {
143
- backgroundColor: '$success100',
144
- }
145
- }
146
- },
147
-
148
- {
149
- color: 'error',
150
- disabled: true,
151
- css: {
152
- 'label button': {
153
- borderColor: '$error100',
154
- backgroundColor: '$dark50',
155
- },
156
- 'label button[data-state=checked]:after': {
157
- backgroundColor: '$error100',
158
- }
159
- }
160
- }
161
- ],
162
- defaultVariants: {
163
- color: 'blue',
164
- disabled: false
165
- }
166
- })
167
-
168
- export type RadioGroupProps = ComponentProps<typeof RadioGroupStyled> & {
169
- placeholder?: string
170
- children?: React.ReactNode
171
- color?: string
172
- disabled?: boolean
173
- }
174
-
175
- export type RadioItemProps = {
176
- children?: React.ReactNode
177
- value: string
178
- }
179
-
180
- export function RadioGroup({
181
- children,
182
- disabled,
183
- ...props
184
- }: RadioGroupProps) {
185
- return (
186
- <RadioGroupStyled
187
- disabled={disabled}
188
- {...props}
189
- >
190
- {children}
191
- </RadioGroupStyled>
192
- )
193
- }
194
-
195
- export function RadioItem({
196
- children,
197
- ...props
198
- }: RadioItemProps) {
199
- return (
200
- <RadioGroupRadix.Item {...props}>
201
- {children}
202
- </RadioGroupRadix.Item>
203
- )
1
+ import { ComponentProps } from 'react'
2
+ import { styled } from '../styles'
3
+ import { RadioGroup as RadioGroupRadix } from "@radix-ui/themes";
4
+ import { typographyLabelValues } from "../types/typographyValues";
5
+
6
+ export const RadioGroupStyled = styled(RadioGroupRadix.Root, {
7
+ fontFamily: '$default',
8
+
9
+ 'label': {
10
+ display: 'flex',
11
+ alignItems: 'center',
12
+ gap: '$8',
13
+ cursor: 'pointer',
14
+ '&:focus button, &:hover button': {
15
+ transition: 'all 300ms ease-out',
16
+ boxShadow: '0px 0px 0px 4px rgba(56, 129, 255, 0.50)'
17
+ }
18
+ },
19
+ 'label button': {
20
+ backgroundColor: '$white',
21
+ borderRadius: '$full',
22
+ height: '$16',
23
+ width: '$16',
24
+ position: 'relative',
25
+ border: '2px solid $dark300',
26
+ cursor: 'pointer',
27
+ },
28
+ 'label button[data-state=checked]:before': {
29
+ backgroundColor: '$dark50',
30
+ content: '',
31
+ width: '8px',
32
+ height: '8px',
33
+ position: 'absolute',
34
+ top: '2px',
35
+ right: '2px',
36
+ borderRadius: '$full',
37
+ zIndex: 2,
38
+ },
39
+ 'label button[data-state=checked]:after': {
40
+ backgroundColor: '$brand500',
41
+ content: '',
42
+ height: '$16',
43
+ width: '$16',
44
+ position: 'absolute',
45
+ top: '-2px',
46
+ right: '-2px',
47
+ borderRadius: '$full',
48
+ zIndex: 1,
49
+ },
50
+ variants: {
51
+ color: {
52
+ success: {
53
+ 'label': {
54
+ '&:focus button, &:hover button': {
55
+ boxShadow: '0px 0px 0px 4px rgba(38, 167, 67, 0.50)',
56
+ }
57
+ },
58
+ 'label button': {
59
+ borderColor: '$green500',
60
+ backgroundColor: '$dark50',
61
+ },
62
+ 'label button[data-state=checked]:after': {
63
+ backgroundColor: '$green500',
64
+ },
65
+ },
66
+ blue: {},
67
+ error: {
68
+ 'label': {
69
+ '&:focus button, &:hover button': {
70
+ boxShadow: '0px 0px 0px 4px rgba(225, 86, 98, 0.50)'
71
+ }
72
+ },
73
+ 'label button': {
74
+ borderColor: '$error400',
75
+ backgroundColor: '$dark50',
76
+ },
77
+ 'label button[data-state=checked]:after': {
78
+ backgroundColor: '$error600',
79
+ },
80
+ }
81
+ },
82
+ disabled: {
83
+ true: {
84
+ 'label': {
85
+ cursor: 'not-allowed',
86
+ opacity: 0.5,
87
+ '&:focus button, &:hover button': {
88
+ boxShadow: 'none',
89
+ }
90
+ },
91
+ 'label button': {
92
+ cursor: 'not-allowed',
93
+ }
94
+ },
95
+ false: {}
96
+ },
97
+ typography: typographyLabelValues,
98
+ fontWeight: {
99
+ regular: { fontWeight: '$regular' },
100
+ medium: { fontWeight: '$medium' },
101
+ semibold: { fontWeight: '$semibold' },
102
+ bold: { fontWeight: '$bold' },
103
+ },
104
+ },
105
+
106
+ compoundVariants: [
107
+ {
108
+ color: 'blue',
109
+ disabled: false,
110
+ css: {
111
+ 'label': {
112
+ '&:focus button, &:hover button': {
113
+ boxShadow: '0px 0px 0px 4px rgba(56, 129, 255, 0.50)'
114
+ }
115
+ },
116
+ 'label button': {
117
+ borderColor: '$dark300',
118
+ },
119
+ 'label button[data-state=checked]:after': {
120
+ backgroundColor: '$brand500',
121
+ },
122
+ }
123
+ },
124
+
125
+ {
126
+ color: 'blue',
127
+ disabled: true,
128
+ css: {
129
+ 'label button': {
130
+ borderColor: '$brand100',
131
+ backgroundColor: '$dark50',
132
+ },
133
+ 'label button[data-state=checked]:after': {
134
+ backgroundColor: '$brand100',
135
+ },
136
+ }
137
+ },
138
+
139
+ {
140
+ color: 'success',
141
+ disabled: true,
142
+ css: {
143
+ 'label button': {
144
+ borderColor: '$success100',
145
+ backgroundColor: '$dark50',
146
+ },
147
+ 'label button[data-state=checked]:after': {
148
+ backgroundColor: '$success100',
149
+ }
150
+ }
151
+ },
152
+
153
+ {
154
+ color: 'error',
155
+ disabled: true,
156
+ css: {
157
+ 'label button': {
158
+ borderColor: '$error100',
159
+ backgroundColor: '$dark50',
160
+ },
161
+ 'label button[data-state=checked]:after': {
162
+ backgroundColor: '$error100',
163
+ }
164
+ }
165
+ }
166
+ ],
167
+ defaultVariants: {
168
+ color: 'blue',
169
+ disabled: false
170
+ }
171
+ })
172
+
173
+ export type RadioGroupProps = ComponentProps<typeof RadioGroupStyled> & {
174
+ placeholder?: string
175
+ children?: React.ReactNode
176
+ color?: string
177
+ disabled?: boolean
178
+ typography?: string
179
+ fontWeight?: 'regular' | 'medium' | 'semibold' | 'bold',
180
+ }
181
+
182
+ export type RadioItemProps = {
183
+ children?: React.ReactNode
184
+ value: string
185
+ }
186
+
187
+ export function RadioGroup({
188
+ children,
189
+ disabled,
190
+ ...props
191
+ }: RadioGroupProps) {
192
+ return (
193
+ <RadioGroupStyled
194
+ disabled={disabled}
195
+ {...props}
196
+ >
197
+ {children}
198
+ </RadioGroupStyled>
199
+ )
200
+ }
201
+
202
+ export function RadioItem({
203
+ children,
204
+ ...props
205
+ }: RadioItemProps) {
206
+ return (
207
+ <RadioGroupRadix.Item {...props}>
208
+ {children}
209
+ </RadioGroupRadix.Item>
210
+ )
204
211
  }