@lets-events/react 11.7.10 → 11.8.1

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.
Files changed (77) hide show
  1. package/.eslintrc.json +2 -2
  2. package/.turbo/turbo-build.log +18 -20
  3. package/CHANGELOG.md +8 -2
  4. package/dist/index.css +171 -0
  5. package/dist/index.d.mts +4 -0
  6. package/dist/index.d.ts +4 -0
  7. package/dist/index.js +122 -76
  8. package/dist/index.mjs +128 -82
  9. package/package.json +1 -1
  10. package/src/components/Alert.tsx +303 -303
  11. package/src/components/Avatar.tsx +55 -55
  12. package/src/components/Badge.tsx +125 -125
  13. package/src/components/Box.tsx +3 -3
  14. package/src/components/Button/index.tsx +16 -16
  15. package/src/components/Button/styledComponents.ts +287 -287
  16. package/src/components/ButtonGroup.tsx +484 -484
  17. package/src/components/Calendar/index.tsx +136 -136
  18. package/src/components/Calendar/styledComponents.ts +209 -209
  19. package/src/components/Card.tsx +48 -48
  20. package/src/components/CheckboxGroup.tsx +176 -176
  21. package/src/components/Container.tsx +39 -39
  22. package/src/components/Drawer/index.tsx +55 -55
  23. package/src/components/Drawer/styledComponents.ts +46 -46
  24. package/src/components/Dropdown.tsx +302 -302
  25. package/src/components/Filter.tsx +164 -164
  26. package/src/components/Flex.tsx +118 -118
  27. package/src/components/FormFields/AddressFormFields/CityFormField.tsx +111 -111
  28. package/src/components/FormFields/AddressFormFields/CountryFormField.tsx +33 -33
  29. package/src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx +39 -39
  30. package/src/components/FormFields/AddressFormFields/StateFormField.tsx +32 -32
  31. package/src/components/FormFields/AddressFormFields/index.tsx +141 -141
  32. package/src/components/FormFields/BirthDateFormField.tsx +84 -84
  33. package/src/components/FormFields/CNPJFormField.tsx +87 -87
  34. package/src/components/FormFields/CPFFormField.tsx +78 -78
  35. package/src/components/FormFields/CheckboxGroupFormField.tsx +91 -91
  36. package/src/components/FormFields/EmailFormField.tsx +27 -27
  37. package/src/components/FormFields/Form.tsx +39 -39
  38. package/src/components/FormFields/IdentityDocumentNumberFormField.tsx +40 -40
  39. package/src/components/FormFields/MultiSelectFormField.tsx +55 -55
  40. package/src/components/FormFields/PhoneFormField.tsx +40 -40
  41. package/src/components/FormFields/RadioGroupFormField.tsx +84 -84
  42. package/src/components/FormFields/SelectFormField.tsx +93 -93
  43. package/src/components/FormFields/TextAreaFormField.tsx +48 -48
  44. package/src/components/FormFields/TextFormField.tsx +112 -112
  45. package/src/components/FormFields/subComponents/ErrorFormMessage.tsx +36 -36
  46. package/src/components/FormFields/subComponents/FormLabel.tsx +29 -29
  47. package/src/components/FormFields/utils/validation.ts +23 -23
  48. package/src/components/Grid.tsx +137 -137
  49. package/src/components/Icon.tsx +47 -47
  50. package/src/components/MenuDropdown/index.tsx +38 -38
  51. package/src/components/MenuDropdown/styledComponents.ts +31 -31
  52. package/src/components/Modal.tsx +90 -90
  53. package/src/components/MultiSelect.tsx +267 -218
  54. package/src/components/RadioGroup.tsx +210 -210
  55. package/src/components/Section.tsx +33 -33
  56. package/src/components/Step.tsx +164 -164
  57. package/src/components/Switch.tsx +108 -108
  58. package/src/components/Text.tsx +38 -38
  59. package/src/components/TextField.tsx +365 -365
  60. package/src/components/TextareaField.tsx +128 -128
  61. package/src/components/TimePicker.tsx +298 -298
  62. package/src/components/Toast/components/ToastItem.tsx +41 -41
  63. package/src/components/Toast/components/ToastProvider.tsx +63 -63
  64. package/src/components/Toast/hooks/useToast.ts +12 -12
  65. package/src/components/Toast/index.tsx +5 -5
  66. package/src/components/Toast/styles/index.ts +135 -135
  67. package/src/components/Toast/types/index.ts +46 -46
  68. package/src/components/Tooltip/index.tsx +66 -66
  69. package/src/components/Tooltip/styles.ts +77 -77
  70. package/src/hooks/useCountries.ts +41 -41
  71. package/src/hooks/useOnClickOutside.tsx +20 -20
  72. package/src/index.tsx +54 -54
  73. package/src/styles/index.ts +38 -38
  74. package/src/types/typographyValues.ts +178 -178
  75. package/src/utils/getNestedValue.ts +3 -3
  76. package/src/utils/states.ts +29 -29
  77. package/tsconfig.json +3 -3
@@ -1,41 +1,41 @@
1
- import { useState } from 'react'
2
- import Icon from '../../Icon'
3
- import { ToastComponentProps } from '../types'
4
- import {
5
- ToastRoot,
6
- ToastClose,
7
- } from '../styles'
8
- import { Text } from '../../Text'
9
-
10
- export default function ToastItem({
11
- toast,
12
- onRemove,
13
- }:ToastComponentProps) {
14
- const [open, setOpen] = useState(true)
15
-
16
- const handleOpenChange = (open: boolean) => {
17
- setOpen(open)
18
- if (!open) {
19
- onRemove(toast.id)
20
- }
21
- }
22
-
23
- return (
24
- <ToastRoot
25
- type={toast.type}
26
- duration={toast.duration}
27
- open={open}
28
- onOpenChange={handleOpenChange}
29
- >
30
- {toast?.icon && <Icon name={toast.icon} size='xl'/>}
31
-
32
- <div style={{ flex: 1 }}>
33
- <Text typography={'bodyS'} fontWeight={'medium'}>{toast.message}</Text>
34
- </div>
35
-
36
- <ToastClose aria-label="Close">
37
- <Icon name="xmark" size="md" />
38
- </ToastClose>
39
- </ToastRoot>
40
- )
41
- }
1
+ import { useState } from 'react'
2
+ import Icon from '../../Icon'
3
+ import { ToastComponentProps } from '../types'
4
+ import {
5
+ ToastRoot,
6
+ ToastClose,
7
+ } from '../styles'
8
+ import { Text } from '../../Text'
9
+
10
+ export default function ToastItem({
11
+ toast,
12
+ onRemove,
13
+ }:ToastComponentProps) {
14
+ const [open, setOpen] = useState(true)
15
+
16
+ const handleOpenChange = (open: boolean) => {
17
+ setOpen(open)
18
+ if (!open) {
19
+ onRemove(toast.id)
20
+ }
21
+ }
22
+
23
+ return (
24
+ <ToastRoot
25
+ type={toast.type}
26
+ duration={toast.duration}
27
+ open={open}
28
+ onOpenChange={handleOpenChange}
29
+ >
30
+ {toast?.icon && <Icon name={toast.icon} size='xl'/>}
31
+
32
+ <div style={{ flex: 1 }}>
33
+ <Text typography={'bodyS'} fontWeight={'medium'}>{toast.message}</Text>
34
+ </div>
35
+
36
+ <ToastClose aria-label="Close">
37
+ <Icon name="xmark" size="md" />
38
+ </ToastClose>
39
+ </ToastRoot>
40
+ )
41
+ }
@@ -1,63 +1,63 @@
1
- import { createContext, useState } from 'react'
2
- import * as ToastPrimitive from '@radix-ui/react-toast'
3
- import ToastItem from './ToastItem'
4
- import { ToastViewport } from '../styles'
5
- import { ToastProviderProps, ToastContextType, Toast } from '../types'
6
-
7
- export const ToastContext = createContext<ToastContextType | null>(null)
8
-
9
- export default function ToastProvider ({
10
- children,
11
- defaultDuration = 5000,
12
- maxToasts = 5,
13
- swipeDirection = 'right',
14
- }:ToastProviderProps) {
15
- const [toasts, setToasts] = useState<Toast[]>([])
16
-
17
- const addToast = (toastData: Omit<Toast, 'id' | 'createdAt'>): string => {
18
- const id = Math.random().toString(36).substr(2, 9)
19
- const newToast: Toast = {
20
- id,
21
- ...toastData,
22
- type: toastData?.type || 'info',
23
- duration: toastData?.duration || defaultDuration,
24
- createdAt: Date.now(),
25
- }
26
-
27
- setToasts((prevToasts) => {
28
- const updatedToasts = [...prevToasts, newToast]
29
- return updatedToasts.slice(-maxToasts)
30
- })
31
-
32
- return id
33
- }
34
-
35
- const removeToast = (id: string): void => {
36
- setToasts((prevToasts) => prevToasts.filter((toast) => toast.id !== id))
37
- }
38
-
39
- const removeAllToasts = (): void => {
40
- setToasts([])
41
- }
42
-
43
- const contextValue: ToastContextType = {
44
- toasts,
45
- addToast,
46
- removeToast,
47
- removeAllToasts,
48
- }
49
-
50
- return (
51
- <ToastContext.Provider value={contextValue}>
52
- <ToastPrimitive.Provider swipeDirection={swipeDirection}>
53
- {children}
54
-
55
- {toasts.map((toast) => (
56
- <ToastItem key={toast.id} toast={toast} onRemove={removeToast} />
57
- ))}
58
-
59
- <ToastViewport />
60
- </ToastPrimitive.Provider>
61
- </ToastContext.Provider>
62
- )
63
- }
1
+ import { createContext, useState } from 'react'
2
+ import * as ToastPrimitive from '@radix-ui/react-toast'
3
+ import ToastItem from './ToastItem'
4
+ import { ToastViewport } from '../styles'
5
+ import { ToastProviderProps, ToastContextType, Toast } from '../types'
6
+
7
+ export const ToastContext = createContext<ToastContextType | null>(null)
8
+
9
+ export default function ToastProvider ({
10
+ children,
11
+ defaultDuration = 5000,
12
+ maxToasts = 5,
13
+ swipeDirection = 'right',
14
+ }:ToastProviderProps) {
15
+ const [toasts, setToasts] = useState<Toast[]>([])
16
+
17
+ const addToast = (toastData: Omit<Toast, 'id' | 'createdAt'>): string => {
18
+ const id = Math.random().toString(36).substr(2, 9)
19
+ const newToast: Toast = {
20
+ id,
21
+ ...toastData,
22
+ type: toastData?.type || 'info',
23
+ duration: toastData?.duration || defaultDuration,
24
+ createdAt: Date.now(),
25
+ }
26
+
27
+ setToasts((prevToasts) => {
28
+ const updatedToasts = [...prevToasts, newToast]
29
+ return updatedToasts.slice(-maxToasts)
30
+ })
31
+
32
+ return id
33
+ }
34
+
35
+ const removeToast = (id: string): void => {
36
+ setToasts((prevToasts) => prevToasts.filter((toast) => toast.id !== id))
37
+ }
38
+
39
+ const removeAllToasts = (): void => {
40
+ setToasts([])
41
+ }
42
+
43
+ const contextValue: ToastContextType = {
44
+ toasts,
45
+ addToast,
46
+ removeToast,
47
+ removeAllToasts,
48
+ }
49
+
50
+ return (
51
+ <ToastContext.Provider value={contextValue}>
52
+ <ToastPrimitive.Provider swipeDirection={swipeDirection}>
53
+ {children}
54
+
55
+ {toasts.map((toast) => (
56
+ <ToastItem key={toast.id} toast={toast} onRemove={removeToast} />
57
+ ))}
58
+
59
+ <ToastViewport />
60
+ </ToastPrimitive.Provider>
61
+ </ToastContext.Provider>
62
+ )
63
+ }
@@ -1,12 +1,12 @@
1
- import { useContext } from 'react'
2
- import { ToastContextType } from '../types'
3
- import { ToastContext } from '../components/ToastProvider'
4
-
5
-
6
- export const useToast = (): ToastContextType => {
7
- const context = useContext(ToastContext)
8
- if (!context) {
9
- throw new Error('useToast deve ser usado dentro de um ToastProvider')
10
- }
11
- return context
12
- }
1
+ import { useContext } from 'react'
2
+ import { ToastContextType } from '../types'
3
+ import { ToastContext } from '../components/ToastProvider'
4
+
5
+
6
+ export const useToast = (): ToastContextType => {
7
+ const context = useContext(ToastContext)
8
+ if (!context) {
9
+ throw new Error('useToast deve ser usado dentro de um ToastProvider')
10
+ }
11
+ return context
12
+ }
@@ -1,5 +1,5 @@
1
- export { default as ToastItem } from './components/ToastItem'
2
- export { default as ToastProvider } from './components/ToastProvider'
3
- export * from './hooks/useToast'
4
- export * from './types'
5
-
1
+ export { default as ToastItem } from './components/ToastItem'
2
+ export { default as ToastProvider } from './components/ToastProvider'
3
+ export * from './hooks/useToast'
4
+ export * from './types'
5
+
@@ -1,135 +1,135 @@
1
- import { keyframes } from '@stitches/react'
2
- import * as ToastPrimitive from '@radix-ui/react-toast'
3
- import { styled } from '../../../styles'
4
-
5
- const slideIn = keyframes({
6
- from: {
7
- transform: 'translateX(calc(100% + 25px))',
8
- opacity: 0,
9
- },
10
- to: {
11
- transform: 'translateX(0)',
12
- opacity: 1,
13
- },
14
- })
15
-
16
- const slideOut = keyframes({
17
- from: {
18
- transform: 'translateX(0)',
19
- opacity: 1,
20
- },
21
- to: {
22
- transform: 'translateX(calc(100% + 25px))',
23
- opacity: 0,
24
- },
25
- })
26
-
27
- const swipeOut = keyframes({
28
- from: {
29
- transform: 'translateX(var(--radix-toast-swipe-end-x))',
30
- opacity: 1,
31
- },
32
- to: {
33
- transform: 'translateX(calc(100% + 25px))',
34
- opacity: 0,
35
- },
36
- })
37
-
38
- export const ToastViewport = styled(ToastPrimitive.Viewport, {
39
- position: 'fixed',
40
- top: 0,
41
- right: 0,
42
- display: 'flex',
43
- flexDirection: 'column',
44
- padding: 25,
45
- gap: 10,
46
- width: 390,
47
- maxWidth: '100vw',
48
- margin: 0,
49
- listStyle: 'none',
50
- zIndex: 2147483647,
51
- outline: 'none',
52
- })
53
-
54
- export const ToastRoot = styled(ToastPrimitive.Root, {
55
- backgroundColor: '$neutral50',
56
- borderRadius: '$sm' ,
57
- boxShadow:
58
- 'hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px',
59
- padding: '$16',
60
- gap: '$8',
61
- display: 'flex',
62
- alignItems: 'center',
63
- border: '1px solid',
64
- position: 'relative',
65
- zIndex: 9999,
66
-
67
- '&[data-state="open"]': {
68
- animation: `${slideIn} 150ms cubic-bezier(0.16, 1, 0.3, 1)`,
69
- },
70
- '&[data-state="closed"]': {
71
- animation: `${slideOut} 100ms ease-in`,
72
- },
73
- '&[data-swipe="move"]': {
74
- transform: 'translateX(var(--radix-toast-swipe-move-x))',
75
- },
76
- '&[data-swipe="cancel"]': {
77
- transform: 'translateX(0)',
78
- transition: 'transform 200ms ease-out',
79
- },
80
- '&[data-swipe="end"]': {
81
- animation: `${swipeOut} 100ms ease-out`,
82
- },
83
- $$toastColor: 'inherit',
84
- color: '$$toastColor',
85
- borderColor: '$$toastColor',
86
- variants: {
87
- type: {
88
- success: {
89
- $$toastColor: '$colors$success600',
90
- backgroundColor: '$success50',
91
- },
92
- error: {
93
- $$toastColor: '$colors$error600',
94
- backgroundColor: '$error50',
95
- },
96
- warning: {
97
- $$toastColor: '$colors$warning600',
98
- backgroundColor: '$warning50',
99
- },
100
- info: {
101
- $$toastColor: '$colors$info600',
102
- backgroundColor: '$info50',
103
- },
104
- },
105
- },
106
-
107
- defaultVariants: {
108
- type: 'info',
109
- },
110
- })
111
-
112
-
113
- export const ToastClose = styled(ToastPrimitive.Close, {
114
- border: 'none',
115
- backgroundColor: 'transparent',
116
- display: 'flex',
117
- alignItems: 'center',
118
- justifyContent: 'center',
119
- color: 'inherit',
120
- borderRadius: 4,
121
- padding: 4,
122
- cursor: 'pointer',
123
- opacity: 0.7,
124
-
125
- '&:hover': {
126
- opacity: 1,
127
- backgroundColor: 'rgba(0, 0, 0, 0.05)',
128
- },
129
-
130
- '&:focus': {
131
- boxShadow: '0 0 0 2px currentColor',
132
- opacity: 1,
133
- },
134
- })
135
-
1
+ import { keyframes } from '@stitches/react'
2
+ import * as ToastPrimitive from '@radix-ui/react-toast'
3
+ import { styled } from '../../../styles'
4
+
5
+ const slideIn = keyframes({
6
+ from: {
7
+ transform: 'translateX(calc(100% + 25px))',
8
+ opacity: 0,
9
+ },
10
+ to: {
11
+ transform: 'translateX(0)',
12
+ opacity: 1,
13
+ },
14
+ })
15
+
16
+ const slideOut = keyframes({
17
+ from: {
18
+ transform: 'translateX(0)',
19
+ opacity: 1,
20
+ },
21
+ to: {
22
+ transform: 'translateX(calc(100% + 25px))',
23
+ opacity: 0,
24
+ },
25
+ })
26
+
27
+ const swipeOut = keyframes({
28
+ from: {
29
+ transform: 'translateX(var(--radix-toast-swipe-end-x))',
30
+ opacity: 1,
31
+ },
32
+ to: {
33
+ transform: 'translateX(calc(100% + 25px))',
34
+ opacity: 0,
35
+ },
36
+ })
37
+
38
+ export const ToastViewport = styled(ToastPrimitive.Viewport, {
39
+ position: 'fixed',
40
+ top: 0,
41
+ right: 0,
42
+ display: 'flex',
43
+ flexDirection: 'column',
44
+ padding: 25,
45
+ gap: 10,
46
+ width: 390,
47
+ maxWidth: '100vw',
48
+ margin: 0,
49
+ listStyle: 'none',
50
+ zIndex: 2147483647,
51
+ outline: 'none',
52
+ })
53
+
54
+ export const ToastRoot = styled(ToastPrimitive.Root, {
55
+ backgroundColor: '$neutral50',
56
+ borderRadius: '$sm' ,
57
+ boxShadow:
58
+ 'hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px',
59
+ padding: '$16',
60
+ gap: '$8',
61
+ display: 'flex',
62
+ alignItems: 'center',
63
+ border: '1px solid',
64
+ position: 'relative',
65
+ zIndex: 9999,
66
+
67
+ '&[data-state="open"]': {
68
+ animation: `${slideIn} 150ms cubic-bezier(0.16, 1, 0.3, 1)`,
69
+ },
70
+ '&[data-state="closed"]': {
71
+ animation: `${slideOut} 100ms ease-in`,
72
+ },
73
+ '&[data-swipe="move"]': {
74
+ transform: 'translateX(var(--radix-toast-swipe-move-x))',
75
+ },
76
+ '&[data-swipe="cancel"]': {
77
+ transform: 'translateX(0)',
78
+ transition: 'transform 200ms ease-out',
79
+ },
80
+ '&[data-swipe="end"]': {
81
+ animation: `${swipeOut} 100ms ease-out`,
82
+ },
83
+ $$toastColor: 'inherit',
84
+ color: '$$toastColor',
85
+ borderColor: '$$toastColor',
86
+ variants: {
87
+ type: {
88
+ success: {
89
+ $$toastColor: '$colors$success600',
90
+ backgroundColor: '$success50',
91
+ },
92
+ error: {
93
+ $$toastColor: '$colors$error600',
94
+ backgroundColor: '$error50',
95
+ },
96
+ warning: {
97
+ $$toastColor: '$colors$warning600',
98
+ backgroundColor: '$warning50',
99
+ },
100
+ info: {
101
+ $$toastColor: '$colors$info600',
102
+ backgroundColor: '$info50',
103
+ },
104
+ },
105
+ },
106
+
107
+ defaultVariants: {
108
+ type: 'info',
109
+ },
110
+ })
111
+
112
+
113
+ export const ToastClose = styled(ToastPrimitive.Close, {
114
+ border: 'none',
115
+ backgroundColor: 'transparent',
116
+ display: 'flex',
117
+ alignItems: 'center',
118
+ justifyContent: 'center',
119
+ color: 'inherit',
120
+ borderRadius: 4,
121
+ padding: 4,
122
+ cursor: 'pointer',
123
+ opacity: 0.7,
124
+
125
+ '&:hover': {
126
+ opacity: 1,
127
+ backgroundColor: 'rgba(0, 0, 0, 0.05)',
128
+ },
129
+
130
+ '&:focus': {
131
+ boxShadow: '0 0 0 2px currentColor',
132
+ opacity: 1,
133
+ },
134
+ })
135
+
@@ -1,46 +1,46 @@
1
- import { ReactNode } from 'react'
2
- import { IconName } from '@fortawesome/fontawesome-svg-core'
3
-
4
- export type ToastType = 'success' | 'error' | 'warning' | 'info'
5
-
6
- export interface ToastConfig {
7
- icon: string
8
- }
9
-
10
- export interface ToastOptions {
11
- type?: ToastType
12
- title?: string
13
- duration?: number
14
- }
15
-
16
- export interface Toast {
17
- id: string
18
- message: string
19
- icon?: IconName,
20
- type?: ToastType
21
- duration?: number
22
- createdAt: number
23
- }
24
-
25
- export interface ToastContextType {
26
- toasts: Toast[]
27
- addToast: (toast: Omit<Toast, 'id' | 'createdAt'>) => string
28
- removeToast: (id: string) => void
29
- removeAllToasts: () => void
30
- }
31
-
32
- export interface ToastProviderProps {
33
- children: ReactNode
34
- defaultDuration?: number
35
- maxToasts?: number
36
- swipeDirection?: 'right' | 'left' | 'up' | 'down'
37
- }
38
-
39
- export interface ToastComponentProps {
40
- toast: Toast
41
- onRemove: (id: string) => void
42
- }
43
-
44
- export interface ToasterShowOptions extends ToastOptions {
45
- onClose?: () => void
46
- }
1
+ import { ReactNode } from 'react'
2
+ import { IconName } from '@fortawesome/fontawesome-svg-core'
3
+
4
+ export type ToastType = 'success' | 'error' | 'warning' | 'info'
5
+
6
+ export interface ToastConfig {
7
+ icon: string
8
+ }
9
+
10
+ export interface ToastOptions {
11
+ type?: ToastType
12
+ title?: string
13
+ duration?: number
14
+ }
15
+
16
+ export interface Toast {
17
+ id: string
18
+ message: string
19
+ icon?: IconName,
20
+ type?: ToastType
21
+ duration?: number
22
+ createdAt: number
23
+ }
24
+
25
+ export interface ToastContextType {
26
+ toasts: Toast[]
27
+ addToast: (toast: Omit<Toast, 'id' | 'createdAt'>) => string
28
+ removeToast: (id: string) => void
29
+ removeAllToasts: () => void
30
+ }
31
+
32
+ export interface ToastProviderProps {
33
+ children: ReactNode
34
+ defaultDuration?: number
35
+ maxToasts?: number
36
+ swipeDirection?: 'right' | 'left' | 'up' | 'down'
37
+ }
38
+
39
+ export interface ToastComponentProps {
40
+ toast: Toast
41
+ onRemove: (id: string) => void
42
+ }
43
+
44
+ export interface ToasterShowOptions extends ToastOptions {
45
+ onClose?: () => void
46
+ }