@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.
- package/.eslintrc.json +2 -2
- package/.turbo/turbo-build.log +20 -18
- package/CHANGELOG.md +8 -1
- package/dist/index.d.mts +42 -11
- package/dist/index.d.ts +42 -11
- package/dist/index.js +585 -141
- package/dist/index.mjs +589 -145
- package/package.json +1 -1
- package/src/components/Alert.tsx +255 -255
- package/src/components/Avatar.tsx +55 -55
- package/src/components/Badge.tsx +129 -121
- package/src/components/Box.tsx +3 -3
- package/src/components/Button.tsx +328 -342
- package/src/components/ButtonGroup.tsx +484 -477
- package/src/components/CheckboxGroup.tsx +214 -208
- package/src/components/Container.tsx +39 -39
- package/src/components/Dropdown.tsx +167 -109
- package/src/components/Filter.tsx +164 -95
- package/src/components/Flex.tsx +117 -117
- package/src/components/Grid.tsx +137 -137
- package/src/components/Icon.tsx +47 -47
- package/src/components/Modal.tsx +108 -108
- package/src/components/RadioGroup.tsx +210 -203
- package/src/components/Section.tsx +33 -33
- package/src/components/Step.tsx +147 -147
- package/src/components/Switch.tsx +108 -108
- package/src/components/Text.tsx +31 -31
- package/src/components/TextField.tsx +241 -193
- package/src/index.tsx +27 -27
- package/src/styles/index.ts +38 -38
- package/src/types/typographyValues.ts +179 -0
- package/tsconfig.json +3 -3
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { ComponentProps, ElementType } from 'react';
|
|
2
|
-
import { styled } from '../styles';
|
|
3
|
-
import { Section as SectionRadix } from '@radix-ui/themes';
|
|
4
|
-
|
|
5
|
-
export const SectionStyled = styled(SectionRadix, {
|
|
6
|
-
variants: {
|
|
7
|
-
size: {
|
|
8
|
-
xs: { maxWidth: '576px' },
|
|
9
|
-
sm: { minWidth: '577px', maxWidth: '767px' },
|
|
10
|
-
md: { mixWidth: '768px', maxWidth: '991px' },
|
|
11
|
-
lg: { mixWidth: '992px', maxWidth: '1199px' },
|
|
12
|
-
xl: { mixWidth: '1200px', maxWidth: '1399px' },
|
|
13
|
-
xxl: { mixWidth: '1400px' },
|
|
14
|
-
responsive: { width: '100%', maxWidth: '100%', minWidth: '100%' }
|
|
15
|
-
},
|
|
16
|
-
display: {
|
|
17
|
-
none: { display: 'none' },
|
|
18
|
-
initial: { display: 'initial' },
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
defaultVariants: {
|
|
22
|
-
size: 'md',
|
|
23
|
-
display: 'initial'
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
export type SectionProps = ComponentProps<typeof SectionStyled> & {
|
|
28
|
-
as?: ElementType;
|
|
29
|
-
children: React.ReactNode;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export function Section({ children, ...props }: SectionProps) {
|
|
33
|
-
return <SectionStyled {...props}>{children}</SectionStyled>;
|
|
1
|
+
import { ComponentProps, ElementType } from 'react';
|
|
2
|
+
import { styled } from '../styles';
|
|
3
|
+
import { Section as SectionRadix } from '@radix-ui/themes';
|
|
4
|
+
|
|
5
|
+
export const SectionStyled = styled(SectionRadix, {
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
xs: { maxWidth: '576px' },
|
|
9
|
+
sm: { minWidth: '577px', maxWidth: '767px' },
|
|
10
|
+
md: { mixWidth: '768px', maxWidth: '991px' },
|
|
11
|
+
lg: { mixWidth: '992px', maxWidth: '1199px' },
|
|
12
|
+
xl: { mixWidth: '1200px', maxWidth: '1399px' },
|
|
13
|
+
xxl: { mixWidth: '1400px' },
|
|
14
|
+
responsive: { width: '100%', maxWidth: '100%', minWidth: '100%' }
|
|
15
|
+
},
|
|
16
|
+
display: {
|
|
17
|
+
none: { display: 'none' },
|
|
18
|
+
initial: { display: 'initial' },
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
size: 'md',
|
|
23
|
+
display: 'initial'
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export type SectionProps = ComponentProps<typeof SectionStyled> & {
|
|
28
|
+
as?: ElementType;
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export function Section({ children, ...props }: SectionProps) {
|
|
33
|
+
return <SectionStyled {...props}>{children}</SectionStyled>;
|
|
34
34
|
}
|
package/src/components/Step.tsx
CHANGED
|
@@ -1,148 +1,148 @@
|
|
|
1
|
-
import React, { ComponentProps, ElementType } from 'react'
|
|
2
|
-
import { styled } from '../styles'
|
|
3
|
-
import { Box, Tabs as StepRadix } from "@radix-ui/themes";
|
|
4
|
-
|
|
5
|
-
export const StepStyled = styled('div', {
|
|
6
|
-
fontFamily: '$default',
|
|
7
|
-
color: '$gray100',
|
|
8
|
-
letterSpacing: '0px',
|
|
9
|
-
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
const StepTriggerStyled = styled(StepRadix.Trigger, {
|
|
13
|
-
all: 'unset',
|
|
14
|
-
position: 'relative',
|
|
15
|
-
display: 'flex',
|
|
16
|
-
alignItems: 'center',
|
|
17
|
-
justifyContent: 'center',
|
|
18
|
-
fontSize: '$16',
|
|
19
|
-
fontWeight: '$medium',
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
minWidth: '32px',
|
|
23
|
-
minHeight: '32px',
|
|
24
|
-
marginRight: '40px',
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
'&:last-of-type': {
|
|
28
|
-
marginRight: 0,
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
'& > span:first-of-type': {
|
|
33
|
-
width: '32px',
|
|
34
|
-
height: '32px',
|
|
35
|
-
borderRadius: '$full',
|
|
36
|
-
backgroundColor: '$neutral50',
|
|
37
|
-
border: '1px solid $neutral200',
|
|
38
|
-
color: '$gray700',
|
|
39
|
-
display: 'flex',
|
|
40
|
-
alignItems: 'center',
|
|
41
|
-
justifyContent: 'center',
|
|
42
|
-
zIndex: 1,
|
|
43
|
-
position: 'relative',
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
'&[data-state="active"] > span:first-of-type': {
|
|
49
|
-
backgroundColor: '$blue500',
|
|
50
|
-
borderColor: '$blue500',
|
|
51
|
-
color: 'white',
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
'& > span:last-of-type': {
|
|
56
|
-
display: 'none',
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
'&:not(:first-of-type)::before': {
|
|
61
|
-
content: '""',
|
|
62
|
-
position: 'absolute',
|
|
63
|
-
top: '50%',
|
|
64
|
-
right: 'calc(100% + 4px)',
|
|
65
|
-
transform: 'translateY(-50%)',
|
|
66
|
-
width: '32px',
|
|
67
|
-
height: '8px',
|
|
68
|
-
borderRadius: '$sm',
|
|
69
|
-
backgroundColor: '$neutral50',
|
|
70
|
-
zIndex: 0,
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
'&[data-state="active"]::before': {
|
|
75
|
-
backgroundColor: '$blue500',
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
'&[data-filled="true"] > span:first-of-type': {
|
|
79
|
-
backgroundColor: '$blue500',
|
|
80
|
-
borderColor: '$blue500',
|
|
81
|
-
color: 'white',
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
'&[data-filled="true"]::before': {
|
|
85
|
-
backgroundColor: '$blue500',
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
const StepListStyled = styled(StepRadix.List, {
|
|
90
|
-
display: 'flex',
|
|
91
|
-
alignItems: 'center',
|
|
92
|
-
justifyContent: 'flex-start',
|
|
93
|
-
gap: '$4',
|
|
94
|
-
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
export type StepProps = ComponentProps<typeof StepStyled> & {
|
|
98
|
-
children: React.ReactNode,
|
|
99
|
-
defaultValue: number
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
export function Step({ children, defaultValue, ...props }: StepProps) {
|
|
103
|
-
return (
|
|
104
|
-
<StepRadix.Root defaultValue={String(defaultValue)}>
|
|
105
|
-
<StepStyled {...props}>
|
|
106
|
-
{children}
|
|
107
|
-
</StepStyled>
|
|
108
|
-
</StepRadix.Root>
|
|
109
|
-
|
|
110
|
-
)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export function StepTrigger({ value, children, currentStep, ...props }: { value: number, children: React.ReactNode | string, currentStep?: number, onClick: () => void }) {
|
|
114
|
-
const isActiveOrPrevious = currentStep !== undefined && value <= currentStep
|
|
115
|
-
console.log(isActiveOrPrevious, 'isActiveOrPrevius', currentStep)
|
|
116
|
-
return (
|
|
117
|
-
<StepTriggerStyled data-filled={isActiveOrPrevious} value={String(value)} {...props}>{children}</StepTriggerStyled>
|
|
118
|
-
)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export function StepContent({ value, children, ...props }: { value: number, children: React.ReactNode }) {
|
|
122
|
-
return (
|
|
123
|
-
<StepRadix.Content value={String(value)} {...props}>
|
|
124
|
-
{children}
|
|
125
|
-
</StepRadix.Content>
|
|
126
|
-
)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export function StepList({ children, currentStep, ...props }: { children: React.ReactNode, currentStep: number }) {
|
|
130
|
-
return (
|
|
131
|
-
<StepListStyled {...props}>
|
|
132
|
-
{React.Children.map(children, (child) => {
|
|
133
|
-
if (React.isValidElement(child) && child.type === StepTrigger) {
|
|
134
|
-
return React.cloneElement(child, { currentStep } as any)
|
|
135
|
-
}
|
|
136
|
-
return child
|
|
137
|
-
})}
|
|
138
|
-
</StepListStyled>
|
|
139
|
-
)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export function StepWrapper({ children, ...props }: { children: React.ReactNode }) {
|
|
143
|
-
return (
|
|
144
|
-
<Box {...props}>
|
|
145
|
-
{children}
|
|
146
|
-
</Box>
|
|
147
|
-
)
|
|
1
|
+
import React, { ComponentProps, ElementType } from 'react'
|
|
2
|
+
import { styled } from '../styles'
|
|
3
|
+
import { Box, Tabs as StepRadix } from "@radix-ui/themes";
|
|
4
|
+
|
|
5
|
+
export const StepStyled = styled('div', {
|
|
6
|
+
fontFamily: '$default',
|
|
7
|
+
color: '$gray100',
|
|
8
|
+
letterSpacing: '0px',
|
|
9
|
+
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
const StepTriggerStyled = styled(StepRadix.Trigger, {
|
|
13
|
+
all: 'unset',
|
|
14
|
+
position: 'relative',
|
|
15
|
+
display: 'flex',
|
|
16
|
+
alignItems: 'center',
|
|
17
|
+
justifyContent: 'center',
|
|
18
|
+
fontSize: '$16',
|
|
19
|
+
fontWeight: '$medium',
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
minWidth: '32px',
|
|
23
|
+
minHeight: '32px',
|
|
24
|
+
marginRight: '40px',
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
'&:last-of-type': {
|
|
28
|
+
marginRight: 0,
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
'& > span:first-of-type': {
|
|
33
|
+
width: '32px',
|
|
34
|
+
height: '32px',
|
|
35
|
+
borderRadius: '$full',
|
|
36
|
+
backgroundColor: '$neutral50',
|
|
37
|
+
border: '1px solid $neutral200',
|
|
38
|
+
color: '$gray700',
|
|
39
|
+
display: 'flex',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
justifyContent: 'center',
|
|
42
|
+
zIndex: 1,
|
|
43
|
+
position: 'relative',
|
|
44
|
+
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
'&[data-state="active"] > span:first-of-type': {
|
|
49
|
+
backgroundColor: '$blue500',
|
|
50
|
+
borderColor: '$blue500',
|
|
51
|
+
color: 'white',
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
'& > span:last-of-type': {
|
|
56
|
+
display: 'none',
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
'&:not(:first-of-type)::before': {
|
|
61
|
+
content: '""',
|
|
62
|
+
position: 'absolute',
|
|
63
|
+
top: '50%',
|
|
64
|
+
right: 'calc(100% + 4px)',
|
|
65
|
+
transform: 'translateY(-50%)',
|
|
66
|
+
width: '32px',
|
|
67
|
+
height: '8px',
|
|
68
|
+
borderRadius: '$sm',
|
|
69
|
+
backgroundColor: '$neutral50',
|
|
70
|
+
zIndex: 0,
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
'&[data-state="active"]::before': {
|
|
75
|
+
backgroundColor: '$blue500',
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
'&[data-filled="true"] > span:first-of-type': {
|
|
79
|
+
backgroundColor: '$blue500',
|
|
80
|
+
borderColor: '$blue500',
|
|
81
|
+
color: 'white',
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
'&[data-filled="true"]::before': {
|
|
85
|
+
backgroundColor: '$blue500',
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const StepListStyled = styled(StepRadix.List, {
|
|
90
|
+
display: 'flex',
|
|
91
|
+
alignItems: 'center',
|
|
92
|
+
justifyContent: 'flex-start',
|
|
93
|
+
gap: '$4',
|
|
94
|
+
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
export type StepProps = ComponentProps<typeof StepStyled> & {
|
|
98
|
+
children: React.ReactNode,
|
|
99
|
+
defaultValue: number
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
export function Step({ children, defaultValue, ...props }: StepProps) {
|
|
103
|
+
return (
|
|
104
|
+
<StepRadix.Root defaultValue={String(defaultValue)}>
|
|
105
|
+
<StepStyled {...props}>
|
|
106
|
+
{children}
|
|
107
|
+
</StepStyled>
|
|
108
|
+
</StepRadix.Root>
|
|
109
|
+
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function StepTrigger({ value, children, currentStep, ...props }: { value: number, children: React.ReactNode | string, currentStep?: number, onClick: () => void }) {
|
|
114
|
+
const isActiveOrPrevious = currentStep !== undefined && value <= currentStep
|
|
115
|
+
console.log(isActiveOrPrevious, 'isActiveOrPrevius', currentStep)
|
|
116
|
+
return (
|
|
117
|
+
<StepTriggerStyled data-filled={isActiveOrPrevious} value={String(value)} {...props}>{children}</StepTriggerStyled>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function StepContent({ value, children, ...props }: { value: number, children: React.ReactNode }) {
|
|
122
|
+
return (
|
|
123
|
+
<StepRadix.Content value={String(value)} {...props}>
|
|
124
|
+
{children}
|
|
125
|
+
</StepRadix.Content>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function StepList({ children, currentStep, ...props }: { children: React.ReactNode, currentStep: number }) {
|
|
130
|
+
return (
|
|
131
|
+
<StepListStyled {...props}>
|
|
132
|
+
{React.Children.map(children, (child) => {
|
|
133
|
+
if (React.isValidElement(child) && child.type === StepTrigger) {
|
|
134
|
+
return React.cloneElement(child, { currentStep } as any)
|
|
135
|
+
}
|
|
136
|
+
return child
|
|
137
|
+
})}
|
|
138
|
+
</StepListStyled>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function StepWrapper({ children, ...props }: { children: React.ReactNode }) {
|
|
143
|
+
return (
|
|
144
|
+
<Box {...props}>
|
|
145
|
+
{children}
|
|
146
|
+
</Box>
|
|
147
|
+
)
|
|
148
148
|
}
|
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
import { Switch as RadixSwitch } from '@radix-ui/themes'
|
|
2
|
-
import type { ComponentProps } from 'react'
|
|
3
|
-
import { styled } from '../styles'
|
|
4
|
-
|
|
5
|
-
export const SwitchStyled = styled(RadixSwitch, {
|
|
6
|
-
all: 'unset',
|
|
7
|
-
borderRadius: '$full',
|
|
8
|
-
position: 'relative',
|
|
9
|
-
display: 'flex',
|
|
10
|
-
alignItems: 'center',
|
|
11
|
-
justifyContent: 'center',
|
|
12
|
-
transition: 'all 0.3s',
|
|
13
|
-
cursor: 'pointer',
|
|
14
|
-
|
|
15
|
-
'&::before': {
|
|
16
|
-
content: '""',
|
|
17
|
-
position: 'absolute',
|
|
18
|
-
borderRadius: '$full',
|
|
19
|
-
pointerEvents: 'none',
|
|
20
|
-
cursor: 'pointer',
|
|
21
|
-
},
|
|
22
|
-
'span': {
|
|
23
|
-
position: 'absolute',
|
|
24
|
-
top: '50%',
|
|
25
|
-
left: 0,
|
|
26
|
-
transform: 'translate(0, -50%)',
|
|
27
|
-
borderRadius: '50%',
|
|
28
|
-
transition: 'all 0.3s',
|
|
29
|
-
cursor: 'pointer',
|
|
30
|
-
borderWidth: '1px',
|
|
31
|
-
borderStyle: 'solid',
|
|
32
|
-
boxShadow: '0px 0px 4px 0px rgba(0, 0, 0, 0.24)',
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
'&[data-state="checked"] span': {
|
|
36
|
-
left: 'auto',
|
|
37
|
-
transform: 'translate(50%, -50%)',
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
variants: {
|
|
41
|
-
color: {
|
|
42
|
-
brand: {
|
|
43
|
-
'&::before': {
|
|
44
|
-
backgroundColor: '$brand50',
|
|
45
|
-
},
|
|
46
|
-
'span': {
|
|
47
|
-
backgroundColor: '$dark50',
|
|
48
|
-
borderColor: '$neutral300',
|
|
49
|
-
},
|
|
50
|
-
'&[data-state="checked"] span': {
|
|
51
|
-
backgroundColor: '$brand500',
|
|
52
|
-
borderColor: '$brand500',
|
|
53
|
-
},
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
size: {
|
|
57
|
-
sm: {
|
|
58
|
-
width: '32px',
|
|
59
|
-
height: '20px',
|
|
60
|
-
'&::before': {
|
|
61
|
-
width: '$32',
|
|
62
|
-
height: '$12',
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
'span': {
|
|
66
|
-
width: '$20',
|
|
67
|
-
height: '$20',
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
md: {
|
|
71
|
-
width: '40px',
|
|
72
|
-
height: '20px',
|
|
73
|
-
'&::before': {
|
|
74
|
-
width: '40px',
|
|
75
|
-
height: '16px',
|
|
76
|
-
},
|
|
77
|
-
'span': {
|
|
78
|
-
width: '24px',
|
|
79
|
-
height: '24px',
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
lg: {
|
|
83
|
-
width: '56px',
|
|
84
|
-
height: '32px',
|
|
85
|
-
'&::before': {
|
|
86
|
-
width: '56px',
|
|
87
|
-
height: '24px',
|
|
88
|
-
},
|
|
89
|
-
'span': {
|
|
90
|
-
width: '32px',
|
|
91
|
-
height: '32px',
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
defaultVariants: {
|
|
97
|
-
size: 'md',
|
|
98
|
-
color: 'brand',
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
})
|
|
102
|
-
export type SwitchProps = ComponentProps<typeof RadixSwitch> & {
|
|
103
|
-
color?: 'brand'
|
|
104
|
-
size?: 'sm' | 'md' | 'lg'
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export function Switch(props: SwitchProps) {
|
|
108
|
-
return <SwitchStyled color="brand" defaultChecked {...props} />
|
|
1
|
+
import { Switch as RadixSwitch } from '@radix-ui/themes'
|
|
2
|
+
import type { ComponentProps } from 'react'
|
|
3
|
+
import { styled } from '../styles'
|
|
4
|
+
|
|
5
|
+
export const SwitchStyled = styled(RadixSwitch, {
|
|
6
|
+
all: 'unset',
|
|
7
|
+
borderRadius: '$full',
|
|
8
|
+
position: 'relative',
|
|
9
|
+
display: 'flex',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
transition: 'all 0.3s',
|
|
13
|
+
cursor: 'pointer',
|
|
14
|
+
|
|
15
|
+
'&::before': {
|
|
16
|
+
content: '""',
|
|
17
|
+
position: 'absolute',
|
|
18
|
+
borderRadius: '$full',
|
|
19
|
+
pointerEvents: 'none',
|
|
20
|
+
cursor: 'pointer',
|
|
21
|
+
},
|
|
22
|
+
'span': {
|
|
23
|
+
position: 'absolute',
|
|
24
|
+
top: '50%',
|
|
25
|
+
left: 0,
|
|
26
|
+
transform: 'translate(0, -50%)',
|
|
27
|
+
borderRadius: '50%',
|
|
28
|
+
transition: 'all 0.3s',
|
|
29
|
+
cursor: 'pointer',
|
|
30
|
+
borderWidth: '1px',
|
|
31
|
+
borderStyle: 'solid',
|
|
32
|
+
boxShadow: '0px 0px 4px 0px rgba(0, 0, 0, 0.24)',
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
'&[data-state="checked"] span': {
|
|
36
|
+
left: 'auto',
|
|
37
|
+
transform: 'translate(50%, -50%)',
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
variants: {
|
|
41
|
+
color: {
|
|
42
|
+
brand: {
|
|
43
|
+
'&::before': {
|
|
44
|
+
backgroundColor: '$brand50',
|
|
45
|
+
},
|
|
46
|
+
'span': {
|
|
47
|
+
backgroundColor: '$dark50',
|
|
48
|
+
borderColor: '$neutral300',
|
|
49
|
+
},
|
|
50
|
+
'&[data-state="checked"] span': {
|
|
51
|
+
backgroundColor: '$brand500',
|
|
52
|
+
borderColor: '$brand500',
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
size: {
|
|
57
|
+
sm: {
|
|
58
|
+
width: '32px',
|
|
59
|
+
height: '20px',
|
|
60
|
+
'&::before': {
|
|
61
|
+
width: '$32',
|
|
62
|
+
height: '$12',
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
'span': {
|
|
66
|
+
width: '$20',
|
|
67
|
+
height: '$20',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
md: {
|
|
71
|
+
width: '40px',
|
|
72
|
+
height: '20px',
|
|
73
|
+
'&::before': {
|
|
74
|
+
width: '40px',
|
|
75
|
+
height: '16px',
|
|
76
|
+
},
|
|
77
|
+
'span': {
|
|
78
|
+
width: '24px',
|
|
79
|
+
height: '24px',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
lg: {
|
|
83
|
+
width: '56px',
|
|
84
|
+
height: '32px',
|
|
85
|
+
'&::before': {
|
|
86
|
+
width: '56px',
|
|
87
|
+
height: '24px',
|
|
88
|
+
},
|
|
89
|
+
'span': {
|
|
90
|
+
width: '32px',
|
|
91
|
+
height: '32px',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
defaultVariants: {
|
|
97
|
+
size: 'md',
|
|
98
|
+
color: 'brand',
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
})
|
|
102
|
+
export type SwitchProps = ComponentProps<typeof RadixSwitch> & {
|
|
103
|
+
color?: 'brand'
|
|
104
|
+
size?: 'sm' | 'md' | 'lg'
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function Switch(props: SwitchProps) {
|
|
108
|
+
return <SwitchStyled color="brand" defaultChecked {...props} />
|
|
109
109
|
}
|
package/src/components/Text.tsx
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { ComponentProps, ElementType } from 'react'
|
|
2
|
-
import { styled } from '../styles'
|
|
3
|
-
import { Text as TextRadix } from '@radix-ui/themes'
|
|
4
|
-
import { CSS } from '@stitches/react'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
export type TextProps = ComponentProps<typeof TextStyle> & {
|
|
23
|
-
as?: ElementType,
|
|
24
|
-
asChild?: boolean
|
|
25
|
-
css?: CSS
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function Text({ ...props }: TextProps) {
|
|
29
|
-
return (
|
|
30
|
-
<TextStyle {...props} />
|
|
31
|
-
)
|
|
1
|
+
import { ComponentProps, ElementType } from 'react'
|
|
2
|
+
import { styled } from '../styles'
|
|
3
|
+
import { Text as TextRadix } from '@radix-ui/themes'
|
|
4
|
+
import { CSS } from '@stitches/react'
|
|
5
|
+
import { typographyValues } from '../types/typographyValues'
|
|
6
|
+
|
|
7
|
+
export const TextStyle = styled(TextRadix, {
|
|
8
|
+
fontFamily: '$default',
|
|
9
|
+
lineHeight: '$base',
|
|
10
|
+
color: '$gray100',
|
|
11
|
+
variants: {
|
|
12
|
+
typography: typographyValues,
|
|
13
|
+
fontWeight: {
|
|
14
|
+
regular: { fontWeight: '$regular' },
|
|
15
|
+
medium: { fontWeight: '$medium' },
|
|
16
|
+
semibold: { fontWeight: '$semibold' },
|
|
17
|
+
bold: { fontWeight: '$bold' },
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
export type TextProps = ComponentProps<typeof TextStyle> & {
|
|
23
|
+
as?: ElementType,
|
|
24
|
+
asChild?: boolean
|
|
25
|
+
css?: CSS
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function Text({ ...props }: TextProps) {
|
|
29
|
+
return (
|
|
30
|
+
<TextStyle {...props} />
|
|
31
|
+
)
|
|
32
32
|
}
|