@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,109 @@
1
+ import { styled } from '../styles'
2
+ import { ComponentProps, ElementType } from 'react'
3
+ import { Theme, DropdownMenu as DropdownMenuRadix } from '@radix-ui/themes'
4
+
5
+ const DropdownMenuStyled = styled('div', {
6
+ fontFamily: '$default',
7
+ color: '$dark600',
8
+ letterSpacing: '0px',
9
+ cursor: 'pointer',
10
+ border: '1px solid $dark300',
11
+ borderRadius: '$xs',
12
+ padding: '$8 $12',
13
+ width: 'calc(100% - 24px)',
14
+ display: 'flex',
15
+ 'button': {
16
+ fontFamily: '$default',
17
+ color: '$dark600',
18
+ letterSpacing: '0px',
19
+ backgroundColor: 'transparent',
20
+ border: 'none',
21
+ width: '100%',
22
+ outline: 'none',
23
+ display: 'flex',
24
+ alignItems: 'center',
25
+ gap: '$8',
26
+ cursor: 'pointer',
27
+ 'svg': {
28
+ marginLeft: 'auto',
29
+ }
30
+ },
31
+
32
+ })
33
+
34
+ const DropdownMenuContentStyled = styled(DropdownMenuRadix.Content, {
35
+ background: 'white',
36
+ padding: '$8 $12',
37
+ border: '1px solid $dark300',
38
+ borderRadius: '$xs',
39
+ boxShadow: '0px 4px 4px 0px rgba(35, 53, 67, 0.08)',
40
+ width: 'calc(var(--radix-popper-anchor-width) - 24px);',
41
+ minWidth: '100%',
42
+ marginTop: '3px',
43
+
44
+
45
+ })
46
+ const DropdownMenuItemStyled = styled(DropdownMenuRadix.Item, {
47
+ fontFamily: '$default',
48
+ color: '$dark600',
49
+ letterSpacing: '0px',
50
+ padding: '$8 $12',
51
+ '&:hover, &:focus': {
52
+ backgroundColor: 'transparent',
53
+ border: 'none',
54
+ outline: 'none',
55
+ cursor: 'pointer',
56
+ }
57
+
58
+ })
59
+
60
+ export type DropdownMenuProps = ComponentProps<typeof DropdownMenuRadix.Root> & {
61
+ as?: ElementType,
62
+ placeholder?: string,
63
+ }
64
+ export type DropdownMenuItemProps = ComponentProps<typeof DropdownMenuItemStyled> & {
65
+ as?: ElementType,
66
+ value: string,
67
+ }
68
+
69
+
70
+ export function DropdownMenu({
71
+ children,
72
+ placeholder,
73
+ ...props
74
+ }: DropdownMenuProps) {
75
+ return (
76
+ <Theme>
77
+ <DropdownMenuRadix.Root {...props}>
78
+ <DropdownMenuStyled>
79
+ <DropdownMenuRadix.Trigger>
80
+ <button aria-label={placeholder || 'Fitrar'}>
81
+ <span>{placeholder || 'Fitrar'}</span>
82
+ <DropdownMenuRadix.TriggerIcon />
83
+ </button>
84
+ </DropdownMenuRadix.Trigger>
85
+ <DropdownMenuContentStyled avoidCollisions={false}
86
+ align="start"
87
+ alignOffset={-14}>
88
+ <DropdownMenuRadix.Group>
89
+ {children}
90
+ </DropdownMenuRadix.Group>
91
+ </DropdownMenuContentStyled>
92
+ </DropdownMenuStyled>
93
+ </DropdownMenuRadix.Root>
94
+ </Theme>
95
+ )
96
+ }
97
+
98
+
99
+
100
+ export function DropdownMenuItem({
101
+ children,
102
+ ...props
103
+ }: DropdownMenuItemProps) {
104
+ return (
105
+ <DropdownMenuItemStyled {...props}>
106
+ {children}
107
+ </DropdownMenuItemStyled>
108
+ )
109
+ }
@@ -0,0 +1,96 @@
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
+ const FilterStyled = styled('div', {
7
+ fontFamily: '$default',
8
+ color: '$dark600',
9
+ letterSpacing: '0px',
10
+ cursor: 'pointer',
11
+ border: '1px solid $dark300',
12
+ borderRadius: '$xs',
13
+ padding: '$8 $12',
14
+ width: 'calc(100% - 24px)',
15
+ display: 'flex',
16
+ 'button': {
17
+ fontFamily: '$default',
18
+ color: '$dark600',
19
+ letterSpacing: '0px',
20
+ backgroundColor: 'transparent',
21
+ border: 'none',
22
+ width: '100%',
23
+ outline: 'none',
24
+ display: 'flex',
25
+ alignItems: 'center',
26
+ gap: '$8',
27
+ cursor: 'pointer',
28
+ 'svg:last-child': {
29
+ marginLeft: 'auto',
30
+ }
31
+ },
32
+
33
+ })
34
+
35
+ const FilterContentStyled = styled(DropdownMenu.Content, {
36
+ background: 'white',
37
+ padding: '$8 $12',
38
+ border: '1px solid $dark300',
39
+ borderRadius: '$xs',
40
+ boxShadow: '0px 4px 4px 0px rgba(35, 53, 67, 0.08)',
41
+ width: 'calc(var(--radix-popper-anchor-width) - 24px);',
42
+ minWidth: '100%',
43
+ marginTop: '3px',
44
+
45
+ })
46
+
47
+ export type FilterProps = ComponentProps<typeof DropdownMenu.Root> & {
48
+ as?: ElementType,
49
+ placeholder?: string,
50
+ }
51
+ export type FilterItemProps = ComponentProps<typeof CheckboxItem> & {
52
+ as?: ElementType,
53
+ value: string,
54
+ }
55
+
56
+
57
+ export function Filter({
58
+ children,
59
+ placeholder,
60
+ ...props
61
+ }: FilterProps) {
62
+ return (
63
+ <Theme>
64
+ <DropdownMenu.Root {...props}>
65
+ <FilterStyled>
66
+ <DropdownMenu.Trigger>
67
+ <button aria-label={placeholder || 'Fitrar'}>
68
+ <Icon name='filter' />
69
+ <span>{placeholder || 'Fitrar'}</span>
70
+ <DropdownMenu.TriggerIcon />
71
+ </button>
72
+ </DropdownMenu.Trigger>
73
+ <FilterContentStyled avoidCollisions={false}
74
+ align="start"
75
+ alignOffset={-14}>
76
+ <CheckboxGroup>
77
+ {children}
78
+ </CheckboxGroup>
79
+ </FilterContentStyled>
80
+ </FilterStyled>
81
+ </DropdownMenu.Root>
82
+ </Theme>
83
+ )
84
+ }
85
+
86
+
87
+ export function FilterItem({
88
+ children,
89
+ ...props
90
+ }: FilterItemProps) {
91
+ return (
92
+ <CheckboxItem {...props} style={{ padding: '8px 12px' }}>
93
+ {children}
94
+ </CheckboxItem>
95
+ )
96
+ }
@@ -0,0 +1,47 @@
1
+ import { ComponentProps, ElementType } from 'react';
2
+ import { styled } from '../styles'
3
+ import { Flex as FlexRadix } from "@radix-ui/themes";
4
+ export const Flex = styled(FlexRadix, {
5
+ display: 'flex',
6
+ variants: {
7
+ direction: {
8
+ row: { flexDirection: 'row' },
9
+ column: { flexDirection: 'column' },
10
+ 'row-reverse': { flexDirection: 'row-reverse' },
11
+ 'column-reverse': { flexDirection: 'column-reverse' },
12
+ },
13
+ gap: {
14
+ 2: { gap: '$2' },
15
+ 4: { gap: '$4' },
16
+ 6: { gap: '$6' },
17
+ 8: { gap: '$8' },
18
+ 10: { gap: '$10' },
19
+ 12: { gap: '$12' },
20
+ 14: { gap: '$14' },
21
+ 16: { gap: '$16' },
22
+ 20: { gap: '$20' },
23
+ 22: { gap: '$22' },
24
+ 24: { gap: '$24' },
25
+ 32: { gap: '$32' },
26
+ 36: { gap: '$36' },
27
+ 40: { gap: '$40' },
28
+ 48: { gap: '$48' },
29
+ 56: { gap: '$56' },
30
+ 64: { gap: '$64' },
31
+ 72: { gap: '$72' },
32
+ 80: { gap: '$80' },
33
+ full: { gap: '$full' },
34
+ }
35
+ },
36
+ defaultVariants: {
37
+ direction: 'row',
38
+ gap: 10,
39
+ }
40
+
41
+ })
42
+
43
+ export type FlexProps = ComponentProps<typeof Flex> & {
44
+ as?: ElementType
45
+ }
46
+
47
+
@@ -0,0 +1,29 @@
1
+ import { ComponentProps, ElementType } from 'react'
2
+ import { styled } from '../styles'
3
+ import { Heading } from '@radix-ui/themes'
4
+
5
+ export const Headline = styled(Heading, {
6
+ fontFamily: '$default',
7
+ color: '$gray100',
8
+ letterSpacing: '0px',
9
+ variants: {
10
+ size: {
11
+ 1: { fontSize: '$48', lineHeight: '$64', fontWeight: '$semibold' },
12
+ 2: { fontSize: '$32', lineHeight: '$48', fontWeight: '$semibold' },
13
+ 3: { fontSize: '$24', lineHeight: '$40', fontWeight: '$semibold' },
14
+ 4: { fontSize: '$20', lineHeight: '$36', fontWeight: '$semibold' },
15
+ 5: { fontSize: '$18', lineHeight: '$24', fontWeight: '$semibold' },
16
+ 6: { fontSize: '$18', lineHeight: '$34', fontWeight: '$medium' },
17
+ 7: { fontSize: '$16', lineHeight: '$32', fontWeight: '$semibold' },
18
+ 8: { fontSize: '$16', lineHeight: '$32', fontWeight: '$medium' },
19
+ },
20
+ },
21
+
22
+ defaultVariants: {
23
+ size: 1,
24
+ },
25
+ })
26
+
27
+ export type HeadlineProps = ComponentProps<typeof Headline> & {
28
+ as?: ElementType
29
+ }
@@ -0,0 +1,37 @@
1
+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
2
+ import { library } from "@fortawesome/fontawesome-svg-core";
3
+ import { fas } from "@fortawesome/free-solid-svg-icons";
4
+ import { far } from "@fortawesome/free-regular-svg-icons";
5
+ import { fab } from "@fortawesome/free-brands-svg-icons";
6
+ import { IconName, IconPrefix } from "@fortawesome/fontawesome-svg-core";
7
+ import { FontAwesomeIconProps } from "@fortawesome/react-fontawesome";
8
+ import PropTypes from "prop-types";
9
+
10
+ library.add(fas, far, fab);
11
+
12
+ interface IconProps extends Omit<FontAwesomeIconProps, "icon"> {
13
+ name: IconName;
14
+ prefix?: IconPrefix;
15
+ }
16
+
17
+ export const Icon = ({ name, prefix = "fas", size = "1x", color = "currentColor", className = "", ...props }: IconProps) => {
18
+ return (
19
+ <FontAwesomeIcon
20
+ icon={[prefix, name]}
21
+ size={size}
22
+ color={color}
23
+ className={className}
24
+ {...props}
25
+ />
26
+ );
27
+ };
28
+
29
+ Icon.propTypes = {
30
+ name: PropTypes.string.isRequired,
31
+ prefix: PropTypes.string,
32
+ size: PropTypes.string,
33
+ color: PropTypes.string,
34
+ className: PropTypes.string,
35
+ };
36
+
37
+ export default Icon;
@@ -0,0 +1,28 @@
1
+ import { ComponentProps, ElementType } from 'react'
2
+ import { styled } from '../styles'
3
+ import { Text } from '@radix-ui/themes'
4
+
5
+ export const Label = styled(Text, {
6
+ fontFamily: '$default',
7
+ color: '$gray100',
8
+ letterSpacing: '0px',
9
+ variants: {
10
+ size: {
11
+ 1: { fontSize: '$18', lineHeight: '$22', fontWeight: '$semibold' },
12
+ 2: { fontSize: '$14', lineHeight: '$16', fontWeight: '$medium' },
13
+ 3: { fontSize: '$14', lineHeight: '$16', fontWeight: '$regular' },
14
+ 4: { fontSize: '$13', lineHeight: '$16', fontWeight: '$semibold', letterSpacing: '2px' },
15
+ 5: { fontSize: '$13', lineHeight: '$16', fontWeight: '$medium' },
16
+ 6: { fontSize: '$13', lineHeight: '$16', fontWeight: '$regular' },
17
+ 7: { fontSize: '$12', lineHeight: '$12', fontWeight: '$regular' },
18
+ },
19
+ },
20
+
21
+ defaultVariants: {
22
+ size: '1',
23
+ },
24
+ })
25
+
26
+ export type LabelProps = ComponentProps<typeof Label> & {
27
+ as?: ElementType
28
+ }
@@ -0,0 +1,202 @@
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
+ isValid: {
54
+ true: {
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
+ false: {
69
+ 'label': {
70
+ '&:focus button, &:hover button': {
71
+ boxShadow: '0px 0px 0px 4px rgba(225, 86, 98, 0.50)'
72
+ }
73
+ },
74
+ 'label button': {
75
+ borderColor: '$error400',
76
+ backgroundColor: '$dark50',
77
+ },
78
+ 'label button[data-state=checked]:after': {
79
+ backgroundColor: '$error600',
80
+ },
81
+ }
82
+ },
83
+ disabled: {
84
+ true: {
85
+ 'label': {
86
+ cursor: 'not-allowed',
87
+ opacity: 0.5,
88
+ '&:focus button, &:hover button': {
89
+ boxShadow: 'none',
90
+ }
91
+ },
92
+ 'label button': {
93
+ cursor: 'not-allowed',
94
+ }
95
+ },
96
+ false: {}
97
+ }
98
+ },
99
+
100
+ compoundVariants: [
101
+
102
+ {
103
+ isValid: undefined,
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
+ isValid: undefined,
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
+ isValid: true,
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
+ isValid: false,
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
+ })
163
+
164
+ export type RadioGroupProps = ComponentProps<typeof RadioGroupStyled> & {
165
+ placeholder?: string
166
+ children?: React.ReactNode
167
+ isValid?: boolean
168
+ disabled?: boolean
169
+ }
170
+
171
+ export type RadioItemProps = {
172
+ children?: React.ReactNode
173
+ value: string
174
+ }
175
+
176
+ export function RadioGroup({
177
+ children,
178
+ isValid,
179
+ disabled,
180
+ ...props
181
+ }: RadioGroupProps) {
182
+ return (
183
+ <RadioGroupStyled
184
+ disabled={disabled}
185
+ isValid={isValid}
186
+ {...props}
187
+ >
188
+ {children}
189
+ </RadioGroupStyled>
190
+ )
191
+ }
192
+
193
+ export function RadioItem({
194
+ children,
195
+ ...props
196
+ }: RadioItemProps) {
197
+ return (
198
+ <RadioGroupRadix.Item {...props}>
199
+ {children}
200
+ </RadioGroupRadix.Item>
201
+ )
202
+ }
@@ -0,0 +1,26 @@
1
+ import { ComponentProps, ElementType } from 'react'
2
+ import { styled } from '../styles'
3
+ import { Text } from '@radix-ui/themes'
4
+
5
+ export const Subtitle = styled(Text, {
6
+ fontFamily: '$default',
7
+ color: '$gray100',
8
+ letterSpacing: '0px',
9
+ variants: {
10
+ size: {
11
+ 1: { fontSize: '$20', lineHeight: '$36', fontWeight: '$regular' },
12
+ 2: { fontSize: '$18', lineHeight: '$34', fontWeight: '$regular' },
13
+ 3: { fontSize: '$16', lineHeight: '$32', fontWeight: '$regular' },
14
+ 4: { fontSize: '$14', lineHeight: '$24', fontWeight: '$regular' },
15
+ 5: { fontSize: '$14', lineHeight: '$16', fontWeight: '$semibold' },
16
+ },
17
+ },
18
+
19
+ defaultVariants: {
20
+ size: 1,
21
+ },
22
+ })
23
+
24
+ export type SubtitleProps = ComponentProps<typeof Subtitle> & {
25
+ as?: ElementType
26
+ }
@@ -1,21 +1,18 @@
1
1
  import { ComponentProps, ElementType } from 'react'
2
2
  import { styled } from '../styles'
3
+ import { Text as TextRadix } from '@radix-ui/themes'
3
4
 
4
- export const Text = styled('p', {
5
+ export const Text = styled(TextRadix, {
5
6
  fontFamily: '$default',
6
7
  lineHeight: '$base',
7
- margin: 0,
8
8
  color: '$gray100',
9
-
9
+ letterSpacing: '$2',
10
+ fontWeight: '$semibold',
10
11
  variants: {
11
12
  size: {
12
- xs: { fontSize: '$xs' },
13
- sm: { fontSize: '$sm' },
14
- md: { fontSize: '$md' },
15
- lg: { fontSize: '$lg' },
16
- '2xl': { fontSize: '$2xl' },
17
- '4xl': { fontSize: '$4xl' },
18
- full: { fontSize: '$full' },
13
+ lg: { fontSize: '$56' },
14
+ md: { fontSize: '$48' },
15
+ sm: { fontSize: '$36' },
19
16
  },
20
17
  },
21
18
 
@@ -24,6 +21,6 @@ export const Text = styled('p', {
24
21
  },
25
22
  })
26
23
 
27
- export interface TextProps extends ComponentProps<typeof Text> {
24
+ export type TextProps = ComponentProps<typeof Text> & {
28
25
  as?: ElementType
29
26
  }