@lets-events/react 4.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 +13 -0
- package/dist/index.d.mts +2855 -164
- package/dist/index.d.ts +2855 -164
- package/dist/index.js +1428 -403
- package/dist/index.mjs +1374 -369
- package/package.json +1 -1
- package/src/components/Alert.tsx +256 -0
- 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 -348
- package/src/components/ButtonGroup.tsx +484 -477
- package/src/components/CheckboxGroup.tsx +214 -208
- package/src/components/Container.tsx +40 -0
- package/src/components/Dropdown.tsx +167 -109
- package/src/components/Filter.tsx +164 -95
- package/src/components/Flex.tsx +118 -47
- package/src/components/Grid.tsx +138 -0
- package/src/components/Icon.tsx +47 -47
- package/src/components/Modal.tsx +109 -0
- package/src/components/RadioGroup.tsx +210 -203
- package/src/components/Section.tsx +34 -0
- package/src/components/Step.tsx +148 -0
- package/src/components/Switch.tsx +109 -0
- package/src/components/Text.tsx +32 -26
- package/src/components/TextField.tsx +241 -193
- package/src/index.tsx +27 -23
- package/src/styles/index.ts +38 -38
- package/src/types/typographyValues.ts +179 -0
- package/tsconfig.json +3 -3
- package/src/components/BadgeText.tsx +0 -29
- package/src/components/BodyText.tsx +0 -24
- package/src/components/CaptionText.tsx +0 -16
- package/src/components/DisplayText.tsx +0 -26
- package/src/components/Headline.tsx +0 -29
- package/src/components/Label.tsx +0 -28
- package/src/components/Subtitle.tsx +0 -26
- package/src/components/TooltipText.tsx +0 -15
package/src/components/Flex.tsx
CHANGED
|
@@ -1,47 +1,118 @@
|
|
|
1
|
-
import { ComponentProps, ElementType } from 'react';
|
|
2
|
-
import { styled } from '../styles'
|
|
3
|
-
import { Flex as FlexRadix } from "@radix-ui/themes";
|
|
4
|
-
export const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
import { ComponentProps, ElementType } from 'react';
|
|
2
|
+
import { styled } from '../styles'
|
|
3
|
+
import { Flex as FlexRadix } from "@radix-ui/themes";
|
|
4
|
+
export const FlexStyled = styled(FlexRadix, {
|
|
5
|
+
variants: {
|
|
6
|
+
display: {
|
|
7
|
+
'flex': { display: 'flex' },
|
|
8
|
+
'inline-flex': { display: 'inline-flex' }
|
|
9
|
+
},
|
|
10
|
+
align: {
|
|
11
|
+
start: { alignItems: 'flex-start' },
|
|
12
|
+
center: { alignItems: 'center' },
|
|
13
|
+
end: { alignItems: 'flex-end' },
|
|
14
|
+
stretch: { alignItems: 'stretch' },
|
|
15
|
+
baseline: { alignItems: 'baseline' },
|
|
16
|
+
},
|
|
17
|
+
justify: {
|
|
18
|
+
start: { justifyContent: 'flex-start' },
|
|
19
|
+
center: { justifyContent: 'center' },
|
|
20
|
+
end: { justifyContent: 'flex-end' },
|
|
21
|
+
between: { justifyContent: 'space-between' },
|
|
22
|
+
around: { justifyContent: 'space-around' },
|
|
23
|
+
evenly: { justifyContent: 'space-evenly' },
|
|
24
|
+
},
|
|
25
|
+
direction: {
|
|
26
|
+
row: { flexDirection: 'row' },
|
|
27
|
+
column: { flexDirection: 'column' },
|
|
28
|
+
'row-reverse': { flexDirection: 'row-reverse' },
|
|
29
|
+
'column-reverse': { flexDirection: 'column-reverse' },
|
|
30
|
+
},
|
|
31
|
+
gap: {
|
|
32
|
+
2: { gap: '$2' },
|
|
33
|
+
4: { gap: '$4' },
|
|
34
|
+
6: { gap: '$6' },
|
|
35
|
+
8: { gap: '$8' },
|
|
36
|
+
10: { gap: '$10' },
|
|
37
|
+
12: { gap: '$12' },
|
|
38
|
+
14: { gap: '$14' },
|
|
39
|
+
16: { gap: '$16' },
|
|
40
|
+
20: { gap: '$20' },
|
|
41
|
+
22: { gap: '$22' },
|
|
42
|
+
24: { gap: '$24' },
|
|
43
|
+
32: { gap: '$32' },
|
|
44
|
+
36: { gap: '$36' },
|
|
45
|
+
40: { gap: '$40' },
|
|
46
|
+
48: { gap: '$48' },
|
|
47
|
+
56: { gap: '$56' },
|
|
48
|
+
64: { gap: '$64' },
|
|
49
|
+
72: { gap: '$72' },
|
|
50
|
+
80: { gap: '$80' },
|
|
51
|
+
full: { gap: '$full' },
|
|
52
|
+
},
|
|
53
|
+
gapY: {
|
|
54
|
+
2: { gap: '$2' },
|
|
55
|
+
4: { gap: '$4' },
|
|
56
|
+
6: { gap: '$6' },
|
|
57
|
+
8: { gap: '$8' },
|
|
58
|
+
10: { gap: '$10' },
|
|
59
|
+
12: { gap: '$12' },
|
|
60
|
+
14: { gap: '$14' },
|
|
61
|
+
16: { gap: '$16' },
|
|
62
|
+
20: { gap: '$20' },
|
|
63
|
+
22: { gap: '$22' },
|
|
64
|
+
24: { gap: '$24' },
|
|
65
|
+
32: { gap: '$32' },
|
|
66
|
+
36: { gap: '$36' },
|
|
67
|
+
40: { gap: '$40' },
|
|
68
|
+
48: { gap: '$48' },
|
|
69
|
+
56: { gap: '$56' },
|
|
70
|
+
64: { gap: '$64' },
|
|
71
|
+
72: { gap: '$72' },
|
|
72
|
+
80: { gap: '$80' },
|
|
73
|
+
full: { gap: '$full' },
|
|
74
|
+
},
|
|
75
|
+
gapX: {
|
|
76
|
+
2: { gap: '$2' },
|
|
77
|
+
4: { gap: '$4' },
|
|
78
|
+
6: { gap: '$6' },
|
|
79
|
+
8: { gap: '$8' },
|
|
80
|
+
10: { gap: '$10' },
|
|
81
|
+
12: { gap: '$12' },
|
|
82
|
+
14: { gap: '$14' },
|
|
83
|
+
16: { gap: '$16' },
|
|
84
|
+
20: { gap: '$20' },
|
|
85
|
+
22: { gap: '$22' },
|
|
86
|
+
24: { gap: '$24' },
|
|
87
|
+
32: { gap: '$32' },
|
|
88
|
+
36: { gap: '$36' },
|
|
89
|
+
40: { gap: '$40' },
|
|
90
|
+
48: { gap: '$48' },
|
|
91
|
+
56: { gap: '$56' },
|
|
92
|
+
64: { gap: '$64' },
|
|
93
|
+
72: { gap: '$72' },
|
|
94
|
+
80: { gap: '$80' },
|
|
95
|
+
full: { gap: '$full' },
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
defaultVariants: {
|
|
99
|
+
display: 'flex',
|
|
100
|
+
direction: 'row',
|
|
101
|
+
gap: 10,
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
export type FlexProps = ComponentProps<typeof FlexStyled> & {
|
|
107
|
+
as?: ElementType,
|
|
108
|
+
children: React.ReactNode
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
export function Flex({ children, ...props }: FlexProps) {
|
|
113
|
+
return (
|
|
114
|
+
<FlexStyled {...props}>
|
|
115
|
+
{children}
|
|
116
|
+
</FlexStyled>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { ComponentProps, ElementType } from 'react';
|
|
2
|
+
import { styled } from '../styles'
|
|
3
|
+
import { Grid as GridRadix } from "@radix-ui/themes";
|
|
4
|
+
export const GridStyled = styled(GridRadix, {
|
|
5
|
+
display: 'grid',
|
|
6
|
+
variants: {
|
|
7
|
+
display: {
|
|
8
|
+
'grid': { display: 'grid' },
|
|
9
|
+
'inline-grid': { display: 'inline-grid' },
|
|
10
|
+
},
|
|
11
|
+
align: {
|
|
12
|
+
start: { alignItems: 'start' },
|
|
13
|
+
center: { alignItems: 'center' },
|
|
14
|
+
end: { alignItems: 'end' },
|
|
15
|
+
stretch: { alignItems: 'stretch' },
|
|
16
|
+
},
|
|
17
|
+
justify: {
|
|
18
|
+
start: { justifyContent: 'start' },
|
|
19
|
+
center: { justifyContent: 'center' },
|
|
20
|
+
end: { justifyContent: 'end' },
|
|
21
|
+
between: { justifyContent: 'space-between' },
|
|
22
|
+
},
|
|
23
|
+
flow: {
|
|
24
|
+
row: { gridAutoFlow: 'row' },
|
|
25
|
+
column: { gridAutoFlow: 'column' },
|
|
26
|
+
'row-dense': { gridAutoFlow: 'row dense' },
|
|
27
|
+
'column-dense': { gridAutoFlow: 'column dense' },
|
|
28
|
+
},
|
|
29
|
+
columns: {
|
|
30
|
+
1: { gridTemplateColumns: 'repeat(1, 1fr)' },
|
|
31
|
+
2: { gridTemplateColumns: 'repeat(2, 1fr)' },
|
|
32
|
+
3: { gridTemplateColumns: 'repeat(3, 1fr)' },
|
|
33
|
+
4: { gridTemplateColumns: 'repeat(4, 1fr)' },
|
|
34
|
+
6: { gridTemplateColumns: 'repeat(6, 1fr)' },
|
|
35
|
+
12: { gridTemplateColumns: 'repeat(12, 1fr)' },
|
|
36
|
+
},
|
|
37
|
+
rows: {
|
|
38
|
+
1: { gridTemplateRows: 'repeat(1, 1fr)' },
|
|
39
|
+
2: { gridTemplateRows: 'repeat(2, 1fr)' },
|
|
40
|
+
3: { gridTemplateRows: 'repeat(3, 1fr)' },
|
|
41
|
+
4: { gridTemplateRows: 'repeat(4, 1fr)' },
|
|
42
|
+
5: { gridTemplateRows: 'repeat(5, 1fr)' },
|
|
43
|
+
6: { gridTemplateRows: 'repeat(6, 1fr)' },
|
|
44
|
+
7: { gridTemplateRows: 'repeat(7, 1fr)' },
|
|
45
|
+
8: { gridTemplateRows: 'repeat(8, 1fr)' },
|
|
46
|
+
9: { gridTemplateRows: 'repeat(9, 1fr)' },
|
|
47
|
+
10: { gridTemplateRows: 'repeat(10, 1fr)' },
|
|
48
|
+
11: { gridTemplateRows: 'repeat(11, 1fr)' },
|
|
49
|
+
12: { gridTemplateRows: 'repeat(12, 1fr)' },
|
|
50
|
+
auto: { gridTemplateRows: 'auto' },
|
|
51
|
+
},
|
|
52
|
+
gap: {
|
|
53
|
+
2: { gap: '$2' },
|
|
54
|
+
4: { gap: '$4' },
|
|
55
|
+
6: { gap: '$6' },
|
|
56
|
+
8: { gap: '$8' },
|
|
57
|
+
10: { gap: '$10' },
|
|
58
|
+
12: { gap: '$12' },
|
|
59
|
+
14: { gap: '$14' },
|
|
60
|
+
16: { gap: '$16' },
|
|
61
|
+
20: { gap: '$20' },
|
|
62
|
+
22: { gap: '$22' },
|
|
63
|
+
24: { gap: '$24' },
|
|
64
|
+
32: { gap: '$32' },
|
|
65
|
+
36: { gap: '$36' },
|
|
66
|
+
40: { gap: '$40' },
|
|
67
|
+
48: { gap: '$48' },
|
|
68
|
+
56: { gap: '$56' },
|
|
69
|
+
64: { gap: '$64' },
|
|
70
|
+
72: { gap: '$72' },
|
|
71
|
+
80: { gap: '$80' },
|
|
72
|
+
full: { gap: '$full' },
|
|
73
|
+
},
|
|
74
|
+
gapX: {
|
|
75
|
+
2: { gap: '$2' },
|
|
76
|
+
4: { gap: '$4' },
|
|
77
|
+
6: { gap: '$6' },
|
|
78
|
+
8: { gap: '$8' },
|
|
79
|
+
10: { gap: '$10' },
|
|
80
|
+
12: { gap: '$12' },
|
|
81
|
+
14: { gap: '$14' },
|
|
82
|
+
16: { gap: '$16' },
|
|
83
|
+
20: { gap: '$20' },
|
|
84
|
+
22: { gap: '$22' },
|
|
85
|
+
24: { gap: '$24' },
|
|
86
|
+
32: { gap: '$32' },
|
|
87
|
+
36: { gap: '$36' },
|
|
88
|
+
40: { gap: '$40' },
|
|
89
|
+
48: { gap: '$48' },
|
|
90
|
+
56: { gap: '$56' },
|
|
91
|
+
64: { gap: '$64' },
|
|
92
|
+
72: { gap: '$72' },
|
|
93
|
+
80: { gap: '$80' },
|
|
94
|
+
full: { gap: '$full' },
|
|
95
|
+
},
|
|
96
|
+
gapY: {
|
|
97
|
+
2: { gap: '$2' },
|
|
98
|
+
4: { gap: '$4' },
|
|
99
|
+
6: { gap: '$6' },
|
|
100
|
+
8: { gap: '$8' },
|
|
101
|
+
10: { gap: '$10' },
|
|
102
|
+
12: { gap: '$12' },
|
|
103
|
+
14: { gap: '$14' },
|
|
104
|
+
16: { gap: '$16' },
|
|
105
|
+
20: { gap: '$20' },
|
|
106
|
+
22: { gap: '$22' },
|
|
107
|
+
24: { gap: '$24' },
|
|
108
|
+
32: { gap: '$32' },
|
|
109
|
+
36: { gap: '$36' },
|
|
110
|
+
40: { gap: '$40' },
|
|
111
|
+
48: { gap: '$48' },
|
|
112
|
+
56: { gap: '$56' },
|
|
113
|
+
64: { gap: '$64' },
|
|
114
|
+
72: { gap: '$72' },
|
|
115
|
+
80: { gap: '$80' },
|
|
116
|
+
full: { gap: '$full' },
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
defaultVariants: {
|
|
120
|
+
gap: 10,
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
export type GridProps = ComponentProps<typeof GridStyled> & {
|
|
126
|
+
as?: ElementType
|
|
127
|
+
children: React.ReactNode,
|
|
128
|
+
areas?: string
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
export function Grid({ children, ...props }: GridProps) {
|
|
133
|
+
return (
|
|
134
|
+
<GridStyled {...props}>
|
|
135
|
+
{children}
|
|
136
|
+
</GridStyled>
|
|
137
|
+
)
|
|
138
|
+
}
|
package/src/components/Icon.tsx
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
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" | "size"> {
|
|
13
|
-
name: IconName;
|
|
14
|
-
size?: 'xs' | 'sm' | 'md' | 'xl';
|
|
15
|
-
prefix?: IconPrefix;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const Icon = ({ name, prefix = "fas", size = "sm", color = "currentColor", className = "", ...props }: IconProps) => {
|
|
19
|
-
const sizeMap = {
|
|
20
|
-
|
|
21
|
-
'xs': { width: '0.625rem', height: '0.625rem', fontSize: '0.625rem' },
|
|
22
|
-
'sm': { width: '0.625rem', height: '0.625rem', fontSize: '0.625rem' },
|
|
23
|
-
'md': { width: '0.75rem', height: '0.75rem', fontSize: '0.75rem' },
|
|
24
|
-
'xl': { width: '1rem', height: '1rem', fontSize: '1rem' },
|
|
25
|
-
undefined: { width: '0.75rem', height: '0.75rem', fontSize: '0.75rem' },
|
|
26
|
-
} as const;
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<FontAwesomeIcon
|
|
30
|
-
icon={[prefix, name]}
|
|
31
|
-
style={sizeMap[size]}
|
|
32
|
-
color={color}
|
|
33
|
-
className={className}
|
|
34
|
-
{...props}
|
|
35
|
-
width={sizeMap[size]?.width}
|
|
36
|
-
height={sizeMap[size]?.height}
|
|
37
|
-
/>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
Icon.propTypes = {
|
|
41
|
-
name: PropTypes.string.isRequired,
|
|
42
|
-
prefix: PropTypes.string,
|
|
43
|
-
size: PropTypes.string,
|
|
44
|
-
color: PropTypes.string,
|
|
45
|
-
className: PropTypes.string,
|
|
46
|
-
};
|
|
47
|
-
|
|
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" | "size"> {
|
|
13
|
+
name: IconName;
|
|
14
|
+
size?: 'xs' | 'sm' | 'md' | 'xl';
|
|
15
|
+
prefix?: IconPrefix;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const Icon = ({ name, prefix = "fas", size = "sm", color = "currentColor", className = "", ...props }: IconProps) => {
|
|
19
|
+
const sizeMap = {
|
|
20
|
+
|
|
21
|
+
'xs': { width: '0.625rem', height: '0.625rem', fontSize: '0.625rem' },
|
|
22
|
+
'sm': { width: '0.625rem', height: '0.625rem', fontSize: '0.625rem' },
|
|
23
|
+
'md': { width: '0.75rem', height: '0.75rem', fontSize: '0.75rem' },
|
|
24
|
+
'xl': { width: '1rem', height: '1rem', fontSize: '1rem' },
|
|
25
|
+
undefined: { width: '0.75rem', height: '0.75rem', fontSize: '0.75rem' },
|
|
26
|
+
} as const;
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<FontAwesomeIcon
|
|
30
|
+
icon={[prefix, name]}
|
|
31
|
+
style={sizeMap[size]}
|
|
32
|
+
color={color}
|
|
33
|
+
className={className}
|
|
34
|
+
{...props}
|
|
35
|
+
width={sizeMap[size]?.width}
|
|
36
|
+
height={sizeMap[size]?.height}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
Icon.propTypes = {
|
|
41
|
+
name: PropTypes.string.isRequired,
|
|
42
|
+
prefix: PropTypes.string,
|
|
43
|
+
size: PropTypes.string,
|
|
44
|
+
color: PropTypes.string,
|
|
45
|
+
className: PropTypes.string,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
48
|
export default Icon;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { ComponentProps } from 'react'
|
|
2
|
+
import { styled } from '../styles'
|
|
3
|
+
import { Dialog as ModalRadix } from "@radix-ui/themes";
|
|
4
|
+
import { Button } from './Button';
|
|
5
|
+
import Icon from './Icon';
|
|
6
|
+
import { Box } from './Box';
|
|
7
|
+
import { Flex } from './Flex';
|
|
8
|
+
export const ModalStyled = styled('div', {
|
|
9
|
+
fontFamily: '$default',
|
|
10
|
+
lineHeight: '$base',
|
|
11
|
+
fontSize: '$13',
|
|
12
|
+
borderRadius: '$sm',
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export const ModalContentStyled = styled(ModalRadix.Content, {
|
|
16
|
+
fontFamily: '$default',
|
|
17
|
+
lineHeight: '$base',
|
|
18
|
+
fontSize: '$13',
|
|
19
|
+
maxWidth: '502px',
|
|
20
|
+
width: '100%',
|
|
21
|
+
border: '1px solid $neutral',
|
|
22
|
+
borderRadius: '$2xl',
|
|
23
|
+
boxShadow: '0px 4px 4px 0px rgba(35, 53, 67, 0.08), 0px 2px 4px 0px rgba(35, 53, 67, 0.16)',
|
|
24
|
+
})
|
|
25
|
+
const ModalHeaderStyled = styled('div', {
|
|
26
|
+
borderBottom: '1px solid $neutral300',
|
|
27
|
+
padding: '$16 $24',
|
|
28
|
+
textAlign: 'center',
|
|
29
|
+
position: 'relative',
|
|
30
|
+
display: 'flex',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
justifyContent: 'center',
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const ModalIconClose = styled(Icon, {
|
|
36
|
+
position: 'absolute',
|
|
37
|
+
right: '$24',
|
|
38
|
+
cursor: 'pointer'
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
const ModalFooterStyled = styled('div', {
|
|
42
|
+
borderTop: '1px solid $neutral300',
|
|
43
|
+
padding: '$16 $24',
|
|
44
|
+
|
|
45
|
+
'.modal-footer-flex': {
|
|
46
|
+
justifyContent: 'flex-end'
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
export const ModalTitleStyled = styled(ModalRadix.Title, {
|
|
51
|
+
fontFamily: '$default',
|
|
52
|
+
lineHeight: '$base',
|
|
53
|
+
fontSize: '$18',
|
|
54
|
+
fontWeight: 'medium',
|
|
55
|
+
fontStyle: 'normal',
|
|
56
|
+
textTransform: 'uppercase'
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
export type ModalProps = ComponentProps<typeof ModalStyled> & {
|
|
60
|
+
trigger: React.ReactNode,
|
|
61
|
+
title?: string
|
|
62
|
+
children: React.ReactNode,
|
|
63
|
+
cancel?: boolean
|
|
64
|
+
cancelText?: string,
|
|
65
|
+
action?: boolean
|
|
66
|
+
actionText?: string;
|
|
67
|
+
onAction?: () => void;
|
|
68
|
+
}
|
|
69
|
+
export function Modal({ children, title, trigger, cancel, cancelText, action, actionText, onAction, ...props }: ModalProps) {
|
|
70
|
+
return (
|
|
71
|
+
<ModalRadix.Root>
|
|
72
|
+
<ModalStyled {...props}>
|
|
73
|
+
<ModalRadix.Trigger>
|
|
74
|
+
{trigger}
|
|
75
|
+
</ModalRadix.Trigger>
|
|
76
|
+
|
|
77
|
+
<ModalContentStyled>
|
|
78
|
+
<ModalHeaderStyled>
|
|
79
|
+
{title && <ModalTitleStyled>{title}</ModalTitleStyled>}
|
|
80
|
+
<ModalRadix.Close>
|
|
81
|
+
<ModalIconClose name='close' size='xl' />
|
|
82
|
+
</ModalRadix.Close>
|
|
83
|
+
</ModalHeaderStyled>
|
|
84
|
+
<Box>
|
|
85
|
+
{children}
|
|
86
|
+
</Box>
|
|
87
|
+
{cancel || action ? (
|
|
88
|
+
<ModalFooterStyled>
|
|
89
|
+
<Flex gap="10" justify="end" width={'100%'} className='modal-footer-flex'>
|
|
90
|
+
|
|
91
|
+
{action && onAction && (
|
|
92
|
+
<ModalRadix.Close>
|
|
93
|
+
<Button variant='contained' color='brand' onClick={onAction}>{actionText ? actionText : 'Salvar'}</Button>
|
|
94
|
+
</ModalRadix.Close>
|
|
95
|
+
)}
|
|
96
|
+
{cancel && (
|
|
97
|
+
<ModalRadix.Close>
|
|
98
|
+
<Button variant="outlined" color="neutral">
|
|
99
|
+
{cancelText ? cancelText : 'cancelar'}
|
|
100
|
+
</Button>
|
|
101
|
+
</ModalRadix.Close>
|
|
102
|
+
)}
|
|
103
|
+
</Flex>
|
|
104
|
+
</ModalFooterStyled>) : null}
|
|
105
|
+
</ModalContentStyled>
|
|
106
|
+
</ModalStyled>
|
|
107
|
+
</ModalRadix.Root>
|
|
108
|
+
)
|
|
109
|
+
}
|