@lets-events/react 11.4.1 → 11.5.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/.eslintrc.json +2 -2
- package/.turbo/turbo-build.log +20 -18
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +126 -0
- package/dist/index.mjs +125 -0
- package/package.json +3 -2
- package/src/components/Alert.tsx +303 -303
- package/src/components/Avatar.tsx +55 -55
- package/src/components/Badge.tsx +125 -125
- package/src/components/Box.tsx +3 -3
- package/src/components/Button/index.tsx +16 -16
- package/src/components/Button/styledComponents.ts +287 -287
- package/src/components/ButtonGroup.tsx +484 -484
- package/src/components/Calendar/index.tsx +136 -136
- package/src/components/Calendar/styledComponents.ts +209 -209
- package/src/components/Card.tsx +48 -48
- package/src/components/CheckboxGroup.tsx +196 -196
- package/src/components/Container.tsx +39 -39
- package/src/components/Drawer/index.tsx +48 -48
- package/src/components/Drawer/styledComponents.ts +46 -46
- package/src/components/Dropdown.tsx +167 -167
- package/src/components/Filter.tsx +164 -164
- package/src/components/Flex.tsx +118 -118
- package/src/components/FormFields/ErrorFormMessage.tsx +36 -36
- package/src/components/FormFields/Form.tsx +25 -25
- package/src/components/FormFields/FormLabel.tsx +29 -29
- package/src/components/FormFields/MultiSelectFormField.tsx +59 -59
- package/src/components/FormFields/PhoneFormField.tsx +130 -0
- package/src/components/FormFields/TextAreaFormField.tsx +46 -46
- package/src/components/FormFields/TextFormField.tsx +46 -46
- package/src/components/Grid.tsx +137 -137
- package/src/components/Icon.tsx +47 -47
- package/src/components/MenuDropdown/index.tsx +30 -30
- package/src/components/MenuDropdown/styledComponents.ts +31 -31
- package/src/components/Modal.tsx +90 -90
- package/src/components/MultiSelect.tsx +218 -218
- package/src/components/RadioGroup.tsx +210 -210
- package/src/components/Section.tsx +33 -33
- package/src/components/Step.tsx +164 -164
- package/src/components/Switch.tsx +108 -108
- package/src/components/Text.tsx +38 -38
- package/src/components/TextField.tsx +315 -315
- package/src/components/TextareaField.tsx +128 -128
- package/src/components/TimePicker.tsx +298 -298
- package/src/components/Toast/components/ToastItem.tsx +41 -41
- package/src/components/Toast/components/ToastProvider.tsx +63 -63
- package/src/components/Toast/hooks/useToast.ts +12 -12
- package/src/components/Toast/index.tsx +5 -5
- package/src/components/Toast/styles/index.ts +135 -135
- package/src/components/Toast/types/index.ts +46 -46
- package/src/components/Tooltip/index.tsx +66 -66
- package/src/components/Tooltip/styles.ts +77 -77
- package/src/hooks/useOnClickOutside.tsx +20 -20
- package/src/index.tsx +45 -44
- package/src/styles/index.ts +38 -38
- package/src/types/typographyValues.ts +178 -178
- package/tsconfig.json +3 -3
|
@@ -1,167 +1,167 @@
|
|
|
1
|
-
import { ComponentProps, ElementType } from 'react'
|
|
2
|
-
import { Theme, DropdownMenu as DropdownMenuRadix } from '@radix-ui/themes'
|
|
3
|
-
import { styled } from '../styles'
|
|
4
|
-
import { typographyLabelValues } from '../types/typographyValues'
|
|
5
|
-
|
|
6
|
-
const DropdownMenuItemStyled = styled(DropdownMenuRadix.Item, {
|
|
7
|
-
fontFamily: '$default',
|
|
8
|
-
color: '$dark600',
|
|
9
|
-
letterSpacing: '0px',
|
|
10
|
-
padding: '$8 $12',
|
|
11
|
-
'&:hover, &:focus': {
|
|
12
|
-
backgroundColor: 'transparent',
|
|
13
|
-
border: 'none',
|
|
14
|
-
outline: 'none',
|
|
15
|
-
cursor: 'pointer',
|
|
16
|
-
},
|
|
17
|
-
variants: {
|
|
18
|
-
typography: typographyLabelValues,
|
|
19
|
-
fontWeight: {
|
|
20
|
-
regular: { fontWeight: '$regular' },
|
|
21
|
-
medium: { fontWeight: '$medium' },
|
|
22
|
-
semibold: { fontWeight: '$semibold' },
|
|
23
|
-
bold: { fontWeight: '$bold' },
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
const DropdownMenuStyled = styled('div', {
|
|
29
|
-
fontFamily: '$default',
|
|
30
|
-
color: '$dark600',
|
|
31
|
-
letterSpacing: '0px',
|
|
32
|
-
cursor: 'pointer',
|
|
33
|
-
border: '1px solid $dark300',
|
|
34
|
-
borderRadius: '$xs',
|
|
35
|
-
padding: '$8 $12',
|
|
36
|
-
width: 'calc(100% - 24px)',
|
|
37
|
-
display: 'flex',
|
|
38
|
-
'button': {
|
|
39
|
-
fontFamily: '$default',
|
|
40
|
-
color: '$dark600',
|
|
41
|
-
letterSpacing: '0px',
|
|
42
|
-
backgroundColor: 'transparent',
|
|
43
|
-
border: 'none',
|
|
44
|
-
width: '100%',
|
|
45
|
-
outline: 'none',
|
|
46
|
-
display: 'flex',
|
|
47
|
-
alignItems: 'center',
|
|
48
|
-
gap: '$8',
|
|
49
|
-
cursor: 'pointer',
|
|
50
|
-
'svg': {
|
|
51
|
-
marginLeft: 'auto',
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
variants: {
|
|
55
|
-
typography: {
|
|
56
|
-
labelLarge: {
|
|
57
|
-
'button': {
|
|
58
|
-
fontSize: '$labelLarge',
|
|
59
|
-
lineHeight: '$labelLarge',
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
labelMedium: {
|
|
63
|
-
'button': {
|
|
64
|
-
fontSize: '$labelMedium',
|
|
65
|
-
lineHeight: '$labelMedium',
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
labelSmall: {
|
|
69
|
-
'button': {
|
|
70
|
-
fontSize: '$labelSmall',
|
|
71
|
-
lineHeight: '$labelSmall',
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
labelExtraSmall: {
|
|
75
|
-
'button': {
|
|
76
|
-
fontSize: '$labelExtraSmall',
|
|
77
|
-
lineHeight: '$labelExtraSmall',
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
fontWeight: {
|
|
82
|
-
regular: { 'button': { fontWeight: '$regular' } },
|
|
83
|
-
medium: { 'button': { fontWeight: '$medium' } },
|
|
84
|
-
semibold: { 'button': { fontWeight: '$semibold' } },
|
|
85
|
-
bold: { 'button': { fontWeight: '$bold' } },
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
const DropdownMenuContentStyled = styled(DropdownMenuRadix.Content, {
|
|
91
|
-
background: 'white',
|
|
92
|
-
padding: '$8 $12',
|
|
93
|
-
border: '1px solid $dark300',
|
|
94
|
-
borderRadius: '$xs',
|
|
95
|
-
boxShadow: '0px 4px 4px 0px rgba(35, 53, 67, 0.08)',
|
|
96
|
-
width: 'calc(var(--radix-popper-anchor-width) - 24px);',
|
|
97
|
-
minWidth: '100%',
|
|
98
|
-
marginTop: '3px',
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
export type DropdownMenuProps = ComponentProps<typeof DropdownMenuRadix.Root> & {
|
|
104
|
-
as?: ElementType
|
|
105
|
-
placeholder?: string
|
|
106
|
-
fontWeight: 'regular' | 'medium' | 'semibold' | 'bold'
|
|
107
|
-
typography: 'labelExtraSmall' | 'labelSmall' | 'labelMedium' | 'labelLarge'
|
|
108
|
-
children: React.ReactNode
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export type DropdownMenuItemProps = ComponentProps<typeof DropdownMenuItemStyled> & {
|
|
112
|
-
as?: ElementType
|
|
113
|
-
value: string
|
|
114
|
-
typography: DropdownMenuProps['typography']
|
|
115
|
-
fontWeight: DropdownMenuProps['fontWeight']
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/* Componente principal */
|
|
119
|
-
export function DropdownMenu({
|
|
120
|
-
children,
|
|
121
|
-
placeholder,
|
|
122
|
-
typography,
|
|
123
|
-
fontWeight,
|
|
124
|
-
...props
|
|
125
|
-
}: DropdownMenuProps) {
|
|
126
|
-
return (
|
|
127
|
-
<Theme>
|
|
128
|
-
<DropdownMenuRadix.Root {...props}>
|
|
129
|
-
<DropdownMenuStyled typography={typography} fontWeight={fontWeight}>
|
|
130
|
-
<DropdownMenuRadix.Trigger>
|
|
131
|
-
<button aria-label={placeholder || 'Filtrar'}>
|
|
132
|
-
<span>{placeholder || 'Filtrar'}</span>
|
|
133
|
-
<DropdownMenuRadix.TriggerIcon />
|
|
134
|
-
</button>
|
|
135
|
-
</DropdownMenuRadix.Trigger>
|
|
136
|
-
<DropdownMenuContentStyled
|
|
137
|
-
avoidCollisions={false}
|
|
138
|
-
align="start"
|
|
139
|
-
alignOffset={-14}
|
|
140
|
-
>
|
|
141
|
-
<DropdownMenuRadix.Group>
|
|
142
|
-
{children}
|
|
143
|
-
</DropdownMenuRadix.Group>
|
|
144
|
-
</DropdownMenuContentStyled>
|
|
145
|
-
</DropdownMenuStyled>
|
|
146
|
-
</DropdownMenuRadix.Root>
|
|
147
|
-
</Theme>
|
|
148
|
-
)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/* Componente de item */
|
|
152
|
-
export function DropdownMenuItem({
|
|
153
|
-
children,
|
|
154
|
-
typography,
|
|
155
|
-
fontWeight,
|
|
156
|
-
...props
|
|
157
|
-
}: DropdownMenuItemProps) {
|
|
158
|
-
return (
|
|
159
|
-
<DropdownMenuItemStyled
|
|
160
|
-
typography={typography}
|
|
161
|
-
fontWeight={fontWeight}
|
|
162
|
-
{...props}
|
|
163
|
-
>
|
|
164
|
-
{children}
|
|
165
|
-
</DropdownMenuItemStyled>
|
|
166
|
-
)
|
|
167
|
-
}
|
|
1
|
+
import { ComponentProps, ElementType } from 'react'
|
|
2
|
+
import { Theme, DropdownMenu as DropdownMenuRadix } from '@radix-ui/themes'
|
|
3
|
+
import { styled } from '../styles'
|
|
4
|
+
import { typographyLabelValues } from '../types/typographyValues'
|
|
5
|
+
|
|
6
|
+
const DropdownMenuItemStyled = styled(DropdownMenuRadix.Item, {
|
|
7
|
+
fontFamily: '$default',
|
|
8
|
+
color: '$dark600',
|
|
9
|
+
letterSpacing: '0px',
|
|
10
|
+
padding: '$8 $12',
|
|
11
|
+
'&:hover, &:focus': {
|
|
12
|
+
backgroundColor: 'transparent',
|
|
13
|
+
border: 'none',
|
|
14
|
+
outline: 'none',
|
|
15
|
+
cursor: 'pointer',
|
|
16
|
+
},
|
|
17
|
+
variants: {
|
|
18
|
+
typography: typographyLabelValues,
|
|
19
|
+
fontWeight: {
|
|
20
|
+
regular: { fontWeight: '$regular' },
|
|
21
|
+
medium: { fontWeight: '$medium' },
|
|
22
|
+
semibold: { fontWeight: '$semibold' },
|
|
23
|
+
bold: { fontWeight: '$bold' },
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const DropdownMenuStyled = styled('div', {
|
|
29
|
+
fontFamily: '$default',
|
|
30
|
+
color: '$dark600',
|
|
31
|
+
letterSpacing: '0px',
|
|
32
|
+
cursor: 'pointer',
|
|
33
|
+
border: '1px solid $dark300',
|
|
34
|
+
borderRadius: '$xs',
|
|
35
|
+
padding: '$8 $12',
|
|
36
|
+
width: 'calc(100% - 24px)',
|
|
37
|
+
display: 'flex',
|
|
38
|
+
'button': {
|
|
39
|
+
fontFamily: '$default',
|
|
40
|
+
color: '$dark600',
|
|
41
|
+
letterSpacing: '0px',
|
|
42
|
+
backgroundColor: 'transparent',
|
|
43
|
+
border: 'none',
|
|
44
|
+
width: '100%',
|
|
45
|
+
outline: 'none',
|
|
46
|
+
display: 'flex',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
gap: '$8',
|
|
49
|
+
cursor: 'pointer',
|
|
50
|
+
'svg': {
|
|
51
|
+
marginLeft: 'auto',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
variants: {
|
|
55
|
+
typography: {
|
|
56
|
+
labelLarge: {
|
|
57
|
+
'button': {
|
|
58
|
+
fontSize: '$labelLarge',
|
|
59
|
+
lineHeight: '$labelLarge',
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
labelMedium: {
|
|
63
|
+
'button': {
|
|
64
|
+
fontSize: '$labelMedium',
|
|
65
|
+
lineHeight: '$labelMedium',
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
labelSmall: {
|
|
69
|
+
'button': {
|
|
70
|
+
fontSize: '$labelSmall',
|
|
71
|
+
lineHeight: '$labelSmall',
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
labelExtraSmall: {
|
|
75
|
+
'button': {
|
|
76
|
+
fontSize: '$labelExtraSmall',
|
|
77
|
+
lineHeight: '$labelExtraSmall',
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
fontWeight: {
|
|
82
|
+
regular: { 'button': { fontWeight: '$regular' } },
|
|
83
|
+
medium: { 'button': { fontWeight: '$medium' } },
|
|
84
|
+
semibold: { 'button': { fontWeight: '$semibold' } },
|
|
85
|
+
bold: { 'button': { fontWeight: '$bold' } },
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
const DropdownMenuContentStyled = styled(DropdownMenuRadix.Content, {
|
|
91
|
+
background: 'white',
|
|
92
|
+
padding: '$8 $12',
|
|
93
|
+
border: '1px solid $dark300',
|
|
94
|
+
borderRadius: '$xs',
|
|
95
|
+
boxShadow: '0px 4px 4px 0px rgba(35, 53, 67, 0.08)',
|
|
96
|
+
width: 'calc(var(--radix-popper-anchor-width) - 24px);',
|
|
97
|
+
minWidth: '100%',
|
|
98
|
+
marginTop: '3px',
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
export type DropdownMenuProps = ComponentProps<typeof DropdownMenuRadix.Root> & {
|
|
104
|
+
as?: ElementType
|
|
105
|
+
placeholder?: string
|
|
106
|
+
fontWeight: 'regular' | 'medium' | 'semibold' | 'bold'
|
|
107
|
+
typography: 'labelExtraSmall' | 'labelSmall' | 'labelMedium' | 'labelLarge'
|
|
108
|
+
children: React.ReactNode
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export type DropdownMenuItemProps = ComponentProps<typeof DropdownMenuItemStyled> & {
|
|
112
|
+
as?: ElementType
|
|
113
|
+
value: string
|
|
114
|
+
typography: DropdownMenuProps['typography']
|
|
115
|
+
fontWeight: DropdownMenuProps['fontWeight']
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* Componente principal */
|
|
119
|
+
export function DropdownMenu({
|
|
120
|
+
children,
|
|
121
|
+
placeholder,
|
|
122
|
+
typography,
|
|
123
|
+
fontWeight,
|
|
124
|
+
...props
|
|
125
|
+
}: DropdownMenuProps) {
|
|
126
|
+
return (
|
|
127
|
+
<Theme>
|
|
128
|
+
<DropdownMenuRadix.Root {...props}>
|
|
129
|
+
<DropdownMenuStyled typography={typography} fontWeight={fontWeight}>
|
|
130
|
+
<DropdownMenuRadix.Trigger>
|
|
131
|
+
<button aria-label={placeholder || 'Filtrar'}>
|
|
132
|
+
<span>{placeholder || 'Filtrar'}</span>
|
|
133
|
+
<DropdownMenuRadix.TriggerIcon />
|
|
134
|
+
</button>
|
|
135
|
+
</DropdownMenuRadix.Trigger>
|
|
136
|
+
<DropdownMenuContentStyled
|
|
137
|
+
avoidCollisions={false}
|
|
138
|
+
align="start"
|
|
139
|
+
alignOffset={-14}
|
|
140
|
+
>
|
|
141
|
+
<DropdownMenuRadix.Group>
|
|
142
|
+
{children}
|
|
143
|
+
</DropdownMenuRadix.Group>
|
|
144
|
+
</DropdownMenuContentStyled>
|
|
145
|
+
</DropdownMenuStyled>
|
|
146
|
+
</DropdownMenuRadix.Root>
|
|
147
|
+
</Theme>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* Componente de item */
|
|
152
|
+
export function DropdownMenuItem({
|
|
153
|
+
children,
|
|
154
|
+
typography,
|
|
155
|
+
fontWeight,
|
|
156
|
+
...props
|
|
157
|
+
}: DropdownMenuItemProps) {
|
|
158
|
+
return (
|
|
159
|
+
<DropdownMenuItemStyled
|
|
160
|
+
typography={typography}
|
|
161
|
+
fontWeight={fontWeight}
|
|
162
|
+
{...props}
|
|
163
|
+
>
|
|
164
|
+
{children}
|
|
165
|
+
</DropdownMenuItemStyled>
|
|
166
|
+
)
|
|
167
|
+
}
|
|
@@ -1,165 +1,165 @@
|
|
|
1
|
-
import { styled } from '../styles'
|
|
2
|
-
import { ComponentProps, ElementType } from 'react'
|
|
3
|
-
import { Theme, DropdownMenu } from '@radix-ui/themes'
|
|
4
|
-
import { CheckboxGroup, CheckboxItem } from './CheckboxGroup'
|
|
5
|
-
import { Icon } from './Icon'
|
|
6
|
-
import { typographyLabelValues } from '../types/typographyValues'
|
|
7
|
-
|
|
8
|
-
const FilterContentStyled = styled(DropdownMenu.Content, {
|
|
9
|
-
background: 'white',
|
|
10
|
-
padding: '$8 $12',
|
|
11
|
-
border: '1px solid $dark300',
|
|
12
|
-
borderRadius: '$xs',
|
|
13
|
-
boxShadow: '0px 4px 4px 0px rgba(35, 53, 67, 0.08)',
|
|
14
|
-
width: 'calc(var(--radix-popper-anchor-width) - 24px);',
|
|
15
|
-
minWidth: '100%',
|
|
16
|
-
marginTop: '3px',
|
|
17
|
-
fontFamily: '$default',
|
|
18
|
-
variants: {
|
|
19
|
-
typography: typographyLabelValues,
|
|
20
|
-
fontWeight: {
|
|
21
|
-
regular: {
|
|
22
|
-
fontWeight: '$regular'
|
|
23
|
-
},
|
|
24
|
-
medium: {
|
|
25
|
-
fontWeight: '$medium'
|
|
26
|
-
},
|
|
27
|
-
semibold: {
|
|
28
|
-
fontWeight: '$semibold'
|
|
29
|
-
},
|
|
30
|
-
bold: {
|
|
31
|
-
fontWeight: '$bold'
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
})
|
|
36
|
-
const FilterStyled = styled('div', {
|
|
37
|
-
fontFamily: '$default',
|
|
38
|
-
color: '$dark600',
|
|
39
|
-
letterSpacing: '0px',
|
|
40
|
-
cursor: 'pointer',
|
|
41
|
-
border: '1px solid $dark300',
|
|
42
|
-
borderRadius: '$xs',
|
|
43
|
-
padding: '$8 $12',
|
|
44
|
-
width: 'calc(100% - 24px)',
|
|
45
|
-
display: 'flex',
|
|
46
|
-
'button': {
|
|
47
|
-
fontFamily: '$default',
|
|
48
|
-
color: '$dark600',
|
|
49
|
-
letterSpacing: '0px',
|
|
50
|
-
backgroundColor: 'transparent',
|
|
51
|
-
border: 'none',
|
|
52
|
-
width: '100%',
|
|
53
|
-
outline: 'none',
|
|
54
|
-
display: 'flex',
|
|
55
|
-
alignItems: 'center',
|
|
56
|
-
gap: '$8',
|
|
57
|
-
cursor: 'pointer',
|
|
58
|
-
'svg:last-child': {
|
|
59
|
-
marginLeft: 'auto',
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
variants: {
|
|
63
|
-
typography: {
|
|
64
|
-
labelLarge: {
|
|
65
|
-
'span': {
|
|
66
|
-
fontSize: '$labelLarge',
|
|
67
|
-
lineHeight: '$labelLarge',
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
labelMedium: {
|
|
71
|
-
'span': {
|
|
72
|
-
fontSize: '$labelMedium',
|
|
73
|
-
lineHeight: '$labelMedium',
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
labelSmall: {
|
|
77
|
-
'span': {
|
|
78
|
-
fontSize: '$labelSmall',
|
|
79
|
-
lineHeight: '$labelSmall',
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
labelExtraSmall: {
|
|
83
|
-
'span': {
|
|
84
|
-
fontSize: '$labelExtraSmall',
|
|
85
|
-
lineHeight: '$labelExtraSmall',
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
fontWeight: {
|
|
90
|
-
regular: {
|
|
91
|
-
'span': { fontWeight: '$regular' }
|
|
92
|
-
},
|
|
93
|
-
medium: {
|
|
94
|
-
'span': { fontWeight: '$medium' }
|
|
95
|
-
},
|
|
96
|
-
semibold: {
|
|
97
|
-
'span': { fontWeight: '$semibold' }
|
|
98
|
-
},
|
|
99
|
-
bold: {
|
|
100
|
-
'span': { fontWeight: '$bold' }
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
}
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
export type FilterProps = ComponentProps<typeof DropdownMenu.Root> & {
|
|
108
|
-
as?: ElementType,
|
|
109
|
-
placeholder?: string,
|
|
110
|
-
fontWeight: 'regular' | 'medium' | 'semibold' | 'bold',
|
|
111
|
-
typography: 'labelExtraSmall' | 'labelSmall' | 'labelMedium' | 'labelLarge',
|
|
112
|
-
}
|
|
113
|
-
export type FilterItemProps = ComponentProps<typeof CheckboxItem> & {
|
|
114
|
-
as?: ElementType,
|
|
115
|
-
value: string,
|
|
116
|
-
typography: FilterProps['typography'],
|
|
117
|
-
fontWeight: FilterProps['fontWeight'],
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
export function Filter({
|
|
122
|
-
children,
|
|
123
|
-
placeholder,
|
|
124
|
-
typography,
|
|
125
|
-
fontWeight,
|
|
126
|
-
...props
|
|
127
|
-
}: FilterProps) {
|
|
128
|
-
return (
|
|
129
|
-
<Theme>
|
|
130
|
-
<DropdownMenu.Root {...props}>
|
|
131
|
-
<FilterStyled typography={typography} fontWeight={fontWeight}>
|
|
132
|
-
<DropdownMenu.Trigger>
|
|
133
|
-
<button aria-label={placeholder || 'Fitrar'}>
|
|
134
|
-
<Icon name='filter' />
|
|
135
|
-
<span>{placeholder || 'Fitrar'}</span>
|
|
136
|
-
<DropdownMenu.TriggerIcon />
|
|
137
|
-
</button>
|
|
138
|
-
</DropdownMenu.Trigger>
|
|
139
|
-
<FilterContentStyled avoidCollisions={false}
|
|
140
|
-
align="start"
|
|
141
|
-
alignOffset={-14}
|
|
142
|
-
typography={typography}
|
|
143
|
-
fontWeight={fontWeight}
|
|
144
|
-
>
|
|
145
|
-
<CheckboxGroup>
|
|
146
|
-
{children}
|
|
147
|
-
</CheckboxGroup>
|
|
148
|
-
</FilterContentStyled>
|
|
149
|
-
</FilterStyled>
|
|
150
|
-
</DropdownMenu.Root>
|
|
151
|
-
</Theme>
|
|
152
|
-
)
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
export function FilterItem({
|
|
157
|
-
children,
|
|
158
|
-
...props
|
|
159
|
-
}: FilterItemProps) {
|
|
160
|
-
return (
|
|
161
|
-
<CheckboxItem {...props} style={{ padding: '8px 12px' }}>
|
|
162
|
-
{children}
|
|
163
|
-
</CheckboxItem>
|
|
164
|
-
)
|
|
1
|
+
import { styled } from '../styles'
|
|
2
|
+
import { ComponentProps, ElementType } from 'react'
|
|
3
|
+
import { Theme, DropdownMenu } from '@radix-ui/themes'
|
|
4
|
+
import { CheckboxGroup, CheckboxItem } from './CheckboxGroup'
|
|
5
|
+
import { Icon } from './Icon'
|
|
6
|
+
import { typographyLabelValues } from '../types/typographyValues'
|
|
7
|
+
|
|
8
|
+
const FilterContentStyled = styled(DropdownMenu.Content, {
|
|
9
|
+
background: 'white',
|
|
10
|
+
padding: '$8 $12',
|
|
11
|
+
border: '1px solid $dark300',
|
|
12
|
+
borderRadius: '$xs',
|
|
13
|
+
boxShadow: '0px 4px 4px 0px rgba(35, 53, 67, 0.08)',
|
|
14
|
+
width: 'calc(var(--radix-popper-anchor-width) - 24px);',
|
|
15
|
+
minWidth: '100%',
|
|
16
|
+
marginTop: '3px',
|
|
17
|
+
fontFamily: '$default',
|
|
18
|
+
variants: {
|
|
19
|
+
typography: typographyLabelValues,
|
|
20
|
+
fontWeight: {
|
|
21
|
+
regular: {
|
|
22
|
+
fontWeight: '$regular'
|
|
23
|
+
},
|
|
24
|
+
medium: {
|
|
25
|
+
fontWeight: '$medium'
|
|
26
|
+
},
|
|
27
|
+
semibold: {
|
|
28
|
+
fontWeight: '$semibold'
|
|
29
|
+
},
|
|
30
|
+
bold: {
|
|
31
|
+
fontWeight: '$bold'
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
const FilterStyled = styled('div', {
|
|
37
|
+
fontFamily: '$default',
|
|
38
|
+
color: '$dark600',
|
|
39
|
+
letterSpacing: '0px',
|
|
40
|
+
cursor: 'pointer',
|
|
41
|
+
border: '1px solid $dark300',
|
|
42
|
+
borderRadius: '$xs',
|
|
43
|
+
padding: '$8 $12',
|
|
44
|
+
width: 'calc(100% - 24px)',
|
|
45
|
+
display: 'flex',
|
|
46
|
+
'button': {
|
|
47
|
+
fontFamily: '$default',
|
|
48
|
+
color: '$dark600',
|
|
49
|
+
letterSpacing: '0px',
|
|
50
|
+
backgroundColor: 'transparent',
|
|
51
|
+
border: 'none',
|
|
52
|
+
width: '100%',
|
|
53
|
+
outline: 'none',
|
|
54
|
+
display: 'flex',
|
|
55
|
+
alignItems: 'center',
|
|
56
|
+
gap: '$8',
|
|
57
|
+
cursor: 'pointer',
|
|
58
|
+
'svg:last-child': {
|
|
59
|
+
marginLeft: 'auto',
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
variants: {
|
|
63
|
+
typography: {
|
|
64
|
+
labelLarge: {
|
|
65
|
+
'span': {
|
|
66
|
+
fontSize: '$labelLarge',
|
|
67
|
+
lineHeight: '$labelLarge',
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
labelMedium: {
|
|
71
|
+
'span': {
|
|
72
|
+
fontSize: '$labelMedium',
|
|
73
|
+
lineHeight: '$labelMedium',
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
labelSmall: {
|
|
77
|
+
'span': {
|
|
78
|
+
fontSize: '$labelSmall',
|
|
79
|
+
lineHeight: '$labelSmall',
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
labelExtraSmall: {
|
|
83
|
+
'span': {
|
|
84
|
+
fontSize: '$labelExtraSmall',
|
|
85
|
+
lineHeight: '$labelExtraSmall',
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
fontWeight: {
|
|
90
|
+
regular: {
|
|
91
|
+
'span': { fontWeight: '$regular' }
|
|
92
|
+
},
|
|
93
|
+
medium: {
|
|
94
|
+
'span': { fontWeight: '$medium' }
|
|
95
|
+
},
|
|
96
|
+
semibold: {
|
|
97
|
+
'span': { fontWeight: '$semibold' }
|
|
98
|
+
},
|
|
99
|
+
bold: {
|
|
100
|
+
'span': { fontWeight: '$bold' }
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
export type FilterProps = ComponentProps<typeof DropdownMenu.Root> & {
|
|
108
|
+
as?: ElementType,
|
|
109
|
+
placeholder?: string,
|
|
110
|
+
fontWeight: 'regular' | 'medium' | 'semibold' | 'bold',
|
|
111
|
+
typography: 'labelExtraSmall' | 'labelSmall' | 'labelMedium' | 'labelLarge',
|
|
112
|
+
}
|
|
113
|
+
export type FilterItemProps = ComponentProps<typeof CheckboxItem> & {
|
|
114
|
+
as?: ElementType,
|
|
115
|
+
value: string,
|
|
116
|
+
typography: FilterProps['typography'],
|
|
117
|
+
fontWeight: FilterProps['fontWeight'],
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
export function Filter({
|
|
122
|
+
children,
|
|
123
|
+
placeholder,
|
|
124
|
+
typography,
|
|
125
|
+
fontWeight,
|
|
126
|
+
...props
|
|
127
|
+
}: FilterProps) {
|
|
128
|
+
return (
|
|
129
|
+
<Theme>
|
|
130
|
+
<DropdownMenu.Root {...props}>
|
|
131
|
+
<FilterStyled typography={typography} fontWeight={fontWeight}>
|
|
132
|
+
<DropdownMenu.Trigger>
|
|
133
|
+
<button aria-label={placeholder || 'Fitrar'}>
|
|
134
|
+
<Icon name='filter' />
|
|
135
|
+
<span>{placeholder || 'Fitrar'}</span>
|
|
136
|
+
<DropdownMenu.TriggerIcon />
|
|
137
|
+
</button>
|
|
138
|
+
</DropdownMenu.Trigger>
|
|
139
|
+
<FilterContentStyled avoidCollisions={false}
|
|
140
|
+
align="start"
|
|
141
|
+
alignOffset={-14}
|
|
142
|
+
typography={typography}
|
|
143
|
+
fontWeight={fontWeight}
|
|
144
|
+
>
|
|
145
|
+
<CheckboxGroup>
|
|
146
|
+
{children}
|
|
147
|
+
</CheckboxGroup>
|
|
148
|
+
</FilterContentStyled>
|
|
149
|
+
</FilterStyled>
|
|
150
|
+
</DropdownMenu.Root>
|
|
151
|
+
</Theme>
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
export function FilterItem({
|
|
157
|
+
children,
|
|
158
|
+
...props
|
|
159
|
+
}: FilterItemProps) {
|
|
160
|
+
return (
|
|
161
|
+
<CheckboxItem {...props} style={{ padding: '8px 12px' }}>
|
|
162
|
+
{children}
|
|
163
|
+
</CheckboxItem>
|
|
164
|
+
)
|
|
165
165
|
}
|