@lets-events/react 10.1.2 → 11.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.
Files changed (47) hide show
  1. package/.eslintrc.json +2 -2
  2. package/.turbo/turbo-build.log +18 -19
  3. package/CHANGELOG.md +3 -3
  4. package/dist/index.d.mts +5 -5
  5. package/dist/index.d.ts +5 -5
  6. package/dist/index.js +43 -28
  7. package/dist/index.mjs +43 -28
  8. package/package.json +1 -1
  9. package/src/components/Alert.tsx +303 -303
  10. package/src/components/Avatar.tsx +55 -55
  11. package/src/components/Badge.tsx +128 -128
  12. package/src/components/Box.tsx +3 -3
  13. package/src/components/Button/index.tsx +12 -12
  14. package/src/components/Button/styledComponents.ts +275 -250
  15. package/src/components/ButtonGroup.tsx +484 -484
  16. package/src/components/Calendar/index.tsx +136 -136
  17. package/src/components/Calendar/styledComponents.ts +209 -209
  18. package/src/components/Card.tsx +69 -69
  19. package/src/components/CheckboxGroup.tsx +214 -214
  20. package/src/components/Container.tsx +39 -39
  21. package/src/components/Dropdown.tsx +167 -167
  22. package/src/components/Filter.tsx +164 -164
  23. package/src/components/Flex.tsx +118 -118
  24. package/src/components/Grid.tsx +137 -137
  25. package/src/components/Icon.tsx +47 -47
  26. package/src/components/Modal.tsx +90 -90
  27. package/src/components/RadioGroup.tsx +210 -210
  28. package/src/components/Section.tsx +33 -33
  29. package/src/components/Step.tsx +164 -164
  30. package/src/components/Switch.tsx +108 -108
  31. package/src/components/Text.tsx +39 -30
  32. package/src/components/TextField.tsx +299 -299
  33. package/src/components/TextareaField.tsx +101 -101
  34. package/src/components/TimePicker.tsx +298 -298
  35. package/src/components/Toast/components/ToastItem.tsx +41 -41
  36. package/src/components/Toast/components/ToastProvider.tsx +63 -63
  37. package/src/components/Toast/hooks/useToast.ts +12 -12
  38. package/src/components/Toast/index.tsx +5 -5
  39. package/src/components/Toast/styles/index.ts +135 -135
  40. package/src/components/Toast/types/index.ts +46 -46
  41. package/src/components/Tooltip/index.tsx +66 -66
  42. package/src/components/Tooltip/styles.ts +77 -77
  43. package/src/hooks/useOnClickOutside.tsx +20 -20
  44. package/src/index.tsx +33 -33
  45. package/src/styles/index.ts +38 -38
  46. package/src/types/typographyValues.ts +178 -178
  47. 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
+ }