@lets-events/react 12.2.10 → 12.2.12
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 +19 -21
- package/CHANGELOG.md +12 -0
- package/dist/index.css +171 -0
- package/dist/index.d.mts +377 -3
- package/dist/index.d.ts +377 -3
- package/dist/index.js +73 -27
- package/dist/index.mjs +72 -27
- package/package.json +1 -1
- 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 +300 -300
- package/src/components/ButtonGroup.tsx +484 -484
- package/src/components/Calendar/index.tsx +148 -148
- package/src/components/Calendar/styledComponents.ts +250 -250
- package/src/components/Card.tsx +48 -48
- package/src/components/CheckboxGroup.tsx +176 -176
- package/src/components/Container.tsx +39 -39
- package/src/components/Divider.tsx +7 -0
- package/src/components/Drawer/index.tsx +148 -138
- package/src/components/Drawer/styledComponents.ts +52 -52
- package/src/components/Dropdown.tsx +302 -302
- package/src/components/Filter.tsx +164 -164
- package/src/components/Flex.tsx +118 -118
- package/src/components/FormFields/AddressFormFields/CityFormField.tsx +111 -111
- package/src/components/FormFields/AddressFormFields/CountryFormField.tsx +33 -33
- package/src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx +39 -39
- package/src/components/FormFields/AddressFormFields/StateFormField.tsx +32 -32
- package/src/components/FormFields/AddressFormFields/index.tsx +141 -141
- package/src/components/FormFields/BirthDateFormField.tsx +84 -84
- package/src/components/FormFields/CNPJFormField.tsx +87 -87
- package/src/components/FormFields/CPFFormField.tsx +78 -78
- package/src/components/FormFields/CalendarFormField.tsx +95 -95
- package/src/components/FormFields/CheckboxGroupFormField.tsx +91 -91
- package/src/components/FormFields/EmailFormField.tsx +27 -27
- package/src/components/FormFields/Form.tsx +39 -39
- package/src/components/FormFields/IdentityDocumentNumberFormField.tsx +32 -32
- package/src/components/FormFields/MultiSelectFormField.tsx +64 -64
- package/src/components/FormFields/PhoneFormField.tsx +40 -40
- package/src/components/FormFields/RadioGroupFormField.tsx +84 -84
- package/src/components/FormFields/RichEditorFormField.tsx +103 -103
- package/src/components/FormFields/SelectFormField.tsx +93 -93
- package/src/components/FormFields/SwitchFormField.tsx +46 -46
- package/src/components/FormFields/TextAreaFormField.tsx +57 -57
- package/src/components/FormFields/TextFormField.tsx +112 -112
- package/src/components/FormFields/TimePickerFormField.tsx +88 -88
- package/src/components/FormFields/subComponents/ErrorFormMessage.tsx +36 -36
- package/src/components/FormFields/subComponents/FormLabel.tsx +29 -29
- package/src/components/FormFields/utils/validation.ts +23 -23
- package/src/components/Grid.tsx +137 -137
- package/src/components/Icon.tsx +47 -47
- package/src/components/MenuDropdown/index.tsx +38 -38
- package/src/components/MenuDropdown/styledComponents.ts +31 -31
- package/src/components/Modal.tsx +107 -90
- package/src/components/MultiSelect/index.tsx +243 -243
- package/src/components/MultiSelect/styledComponents.ts +160 -160
- package/src/components/RadioGroup.tsx +210 -210
- package/src/components/RichEditor/QuillComponent.tsx +457 -457
- package/src/components/RichEditor/RichEditor.tsx +49 -49
- package/src/components/RichEditor/index.ts +2 -2
- package/src/components/RichEditor/styledComponents.ts +1151 -1151
- 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 +372 -372
- package/src/components/TextareaField.tsx +127 -127
- package/src/components/TimePicker.tsx +328 -328
- 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/useCountries.ts +41 -41
- package/src/hooks/useImageUpload.ts +139 -139
- package/src/hooks/useOnClickOutside.tsx +42 -42
- package/src/index.tsx +69 -68
- package/src/styles/index.ts +38 -38
- package/src/types/typographyValues.ts +178 -178
- package/src/utils/getNestedValue.ts +3 -3
- package/src/utils/states.ts +29 -29
- package/src/utils/uploadService.ts +180 -180
- package/tsconfig.json +3 -3
- package/tsup.config.ts +38 -38
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;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import React, { ReactNode, HTMLAttributes, useRef } from "react";
|
|
2
|
-
import {
|
|
3
|
-
MenuDropdownContainerStyled,
|
|
4
|
-
TriggerButtonStyled,
|
|
5
|
-
MenuItemsContainerStyled,
|
|
6
|
-
} from "./styledComponents";
|
|
7
|
-
import Icon from "../Icon";
|
|
8
|
-
import { useOnClickOutside } from "../../hooks/useOnClickOutside";
|
|
9
|
-
|
|
10
|
-
export type MenuDropdownProps = HTMLAttributes<HTMLDivElement> & {
|
|
11
|
-
children: ReactNode;
|
|
12
|
-
isOpen: boolean;
|
|
13
|
-
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export function MenuDropdown({
|
|
17
|
-
children,
|
|
18
|
-
isOpen,
|
|
19
|
-
setIsOpen,
|
|
20
|
-
}: MenuDropdownProps) {
|
|
21
|
-
const dropdownItemsContainerRef = useRef<HTMLDivElement>(null);
|
|
22
|
-
|
|
23
|
-
useOnClickOutside(dropdownItemsContainerRef, () => {
|
|
24
|
-
setIsOpen(false);
|
|
25
|
-
});
|
|
26
|
-
return (
|
|
27
|
-
<MenuDropdownContainerStyled>
|
|
28
|
-
<TriggerButtonStyled onClick={() => setIsOpen(!isOpen)}>
|
|
29
|
-
<Icon name="ellipsis" size="xl" color="#FFFFFF" />
|
|
30
|
-
</TriggerButtonStyled>
|
|
31
|
-
{isOpen && (
|
|
32
|
-
<MenuItemsContainerStyled ref={dropdownItemsContainerRef}>
|
|
33
|
-
{children}
|
|
34
|
-
</MenuItemsContainerStyled>
|
|
35
|
-
)}
|
|
36
|
-
</MenuDropdownContainerStyled>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
1
|
+
import React, { ReactNode, HTMLAttributes, useRef } from "react";
|
|
2
|
+
import {
|
|
3
|
+
MenuDropdownContainerStyled,
|
|
4
|
+
TriggerButtonStyled,
|
|
5
|
+
MenuItemsContainerStyled,
|
|
6
|
+
} from "./styledComponents";
|
|
7
|
+
import Icon from "../Icon";
|
|
8
|
+
import { useOnClickOutside } from "../../hooks/useOnClickOutside";
|
|
9
|
+
|
|
10
|
+
export type MenuDropdownProps = HTMLAttributes<HTMLDivElement> & {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
isOpen: boolean;
|
|
13
|
+
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function MenuDropdown({
|
|
17
|
+
children,
|
|
18
|
+
isOpen,
|
|
19
|
+
setIsOpen,
|
|
20
|
+
}: MenuDropdownProps) {
|
|
21
|
+
const dropdownItemsContainerRef = useRef<HTMLDivElement>(null);
|
|
22
|
+
|
|
23
|
+
useOnClickOutside(dropdownItemsContainerRef, () => {
|
|
24
|
+
setIsOpen(false);
|
|
25
|
+
});
|
|
26
|
+
return (
|
|
27
|
+
<MenuDropdownContainerStyled>
|
|
28
|
+
<TriggerButtonStyled onClick={() => setIsOpen(!isOpen)}>
|
|
29
|
+
<Icon name="ellipsis" size="xl" color="#FFFFFF" />
|
|
30
|
+
</TriggerButtonStyled>
|
|
31
|
+
{isOpen && (
|
|
32
|
+
<MenuItemsContainerStyled ref={dropdownItemsContainerRef}>
|
|
33
|
+
{children}
|
|
34
|
+
</MenuItemsContainerStyled>
|
|
35
|
+
)}
|
|
36
|
+
</MenuDropdownContainerStyled>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { styled } from "../../styles";
|
|
2
|
-
|
|
3
|
-
export const MenuDropdownContainerStyled = styled("div", {
|
|
4
|
-
position: "relative",
|
|
5
|
-
width: "fit-content",
|
|
6
|
-
});
|
|
7
|
-
export const TriggerButtonStyled = styled("button", {
|
|
8
|
-
backgroundColor: "$brand500",
|
|
9
|
-
boxShadow: "0px 4px 4px 0px #23354314",
|
|
10
|
-
borderRadius: "$full",
|
|
11
|
-
border: "none",
|
|
12
|
-
height: "1.875rem",
|
|
13
|
-
width: "1.875rem",
|
|
14
|
-
cursor: "pointer",
|
|
15
|
-
});
|
|
16
|
-
export const MenuItemsContainerStyled = styled("div", {
|
|
17
|
-
position: "absolute",
|
|
18
|
-
right: 0,
|
|
19
|
-
top: "2.125rem",
|
|
20
|
-
zIndex: "999",
|
|
21
|
-
width: "fit-content",
|
|
22
|
-
minWidth: "5rem",
|
|
23
|
-
background: "#fff",
|
|
24
|
-
maxWidth: "18.75rem",
|
|
25
|
-
margin: "auto",
|
|
26
|
-
boxShadow: "0px 4px 4px 0px rgba(35, 53, 67, 0.0784313725)",
|
|
27
|
-
border: "1px solid $dark300",
|
|
28
|
-
borderRadius: "0.5rem",
|
|
29
|
-
padding: "0.5rem 0",
|
|
30
|
-
height: "fit-content",
|
|
31
|
-
});
|
|
1
|
+
import { styled } from "../../styles";
|
|
2
|
+
|
|
3
|
+
export const MenuDropdownContainerStyled = styled("div", {
|
|
4
|
+
position: "relative",
|
|
5
|
+
width: "fit-content",
|
|
6
|
+
});
|
|
7
|
+
export const TriggerButtonStyled = styled("button", {
|
|
8
|
+
backgroundColor: "$brand500",
|
|
9
|
+
boxShadow: "0px 4px 4px 0px #23354314",
|
|
10
|
+
borderRadius: "$full",
|
|
11
|
+
border: "none",
|
|
12
|
+
height: "1.875rem",
|
|
13
|
+
width: "1.875rem",
|
|
14
|
+
cursor: "pointer",
|
|
15
|
+
});
|
|
16
|
+
export const MenuItemsContainerStyled = styled("div", {
|
|
17
|
+
position: "absolute",
|
|
18
|
+
right: 0,
|
|
19
|
+
top: "2.125rem",
|
|
20
|
+
zIndex: "999",
|
|
21
|
+
width: "fit-content",
|
|
22
|
+
minWidth: "5rem",
|
|
23
|
+
background: "#fff",
|
|
24
|
+
maxWidth: "18.75rem",
|
|
25
|
+
margin: "auto",
|
|
26
|
+
boxShadow: "0px 4px 4px 0px rgba(35, 53, 67, 0.0784313725)",
|
|
27
|
+
border: "1px solid $dark300",
|
|
28
|
+
borderRadius: "0.5rem",
|
|
29
|
+
padding: "0.5rem 0",
|
|
30
|
+
height: "fit-content",
|
|
31
|
+
});
|
package/src/components/Modal.tsx
CHANGED
|
@@ -1,90 +1,107 @@
|
|
|
1
|
-
import { ComponentProps } from "react";
|
|
2
|
-
import { styled } from "../styles";
|
|
3
|
-
import { Dialog as ModalRadix } from "radix-ui";
|
|
4
|
-
import Icon from "./Icon";
|
|
5
|
-
import { Box } from "./Box";
|
|
6
|
-
import { Text } from "./Text";
|
|
7
|
-
|
|
8
|
-
const ModalContentStyled = styled(ModalRadix.Content, {
|
|
9
|
-
fontFamily: "$default",
|
|
10
|
-
lineHeight: "$base",
|
|
11
|
-
fontSize: "$13",
|
|
12
|
-
maxWidth: "502px",
|
|
13
|
-
width: "100%",
|
|
14
|
-
border: "1px solid $neutral",
|
|
15
|
-
borderRadius: "$2xl",
|
|
16
|
-
boxShadow:
|
|
17
|
-
"0px 4px 4px 0px rgba(35, 53, 67, 0.08), 0px 2px 4px 0px rgba(35, 53, 67, 0.16)",
|
|
18
|
-
position: "fixed",
|
|
19
|
-
top: "50%",
|
|
20
|
-
left: "50%",
|
|
21
|
-
transform: "translate(-50%, -50%)",
|
|
22
|
-
backgroundColor: "$dark50",
|
|
23
|
-
zIndex:
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const ModalOverlay = styled(ModalRadix.Overlay, {
|
|
27
|
-
position: "fixed",
|
|
28
|
-
inset: 0,
|
|
29
|
-
opacity: 1,
|
|
30
|
-
backgroundColor: "rgba(0, 0, 0, .5)",
|
|
31
|
-
zIndex:
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const ModalHeaderStyled = styled("div", {
|
|
35
|
-
borderBottom: "1px solid $neutral300",
|
|
36
|
-
padding: "$18 $24",
|
|
37
|
-
textAlign: "center",
|
|
38
|
-
position: "relative",
|
|
39
|
-
display: "flex",
|
|
40
|
-
alignItems: "center",
|
|
41
|
-
justifyContent: "center",
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
const ModalIconClose = styled(Icon, {
|
|
45
|
-
position: "absolute",
|
|
46
|
-
right: "$24",
|
|
47
|
-
cursor: "pointer",
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
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 ModalRadix.Root> & {
|
|
60
|
-
trigger?: React.ReactNode;
|
|
61
|
-
title?: string;
|
|
62
|
-
children: React.ReactNode;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { styled } from "../styles";
|
|
3
|
+
import { Dialog as ModalRadix } from "radix-ui";
|
|
4
|
+
import Icon from "./Icon";
|
|
5
|
+
import { Box } from "./Box";
|
|
6
|
+
import { Text } from "./Text";
|
|
7
|
+
|
|
8
|
+
const ModalContentStyled = styled(ModalRadix.Content, {
|
|
9
|
+
fontFamily: "$default",
|
|
10
|
+
lineHeight: "$base",
|
|
11
|
+
fontSize: "$13",
|
|
12
|
+
maxWidth: "502px",
|
|
13
|
+
width: "100%",
|
|
14
|
+
border: "1px solid $neutral",
|
|
15
|
+
borderRadius: "$2xl",
|
|
16
|
+
boxShadow:
|
|
17
|
+
"0px 4px 4px 0px rgba(35, 53, 67, 0.08), 0px 2px 4px 0px rgba(35, 53, 67, 0.16)",
|
|
18
|
+
position: "fixed",
|
|
19
|
+
top: "50%",
|
|
20
|
+
left: "50%",
|
|
21
|
+
transform: "translate(-50%, -50%)",
|
|
22
|
+
backgroundColor: "$dark50",
|
|
23
|
+
zIndex: "10001",
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const ModalOverlay = styled(ModalRadix.Overlay, {
|
|
27
|
+
position: "fixed",
|
|
28
|
+
inset: 0,
|
|
29
|
+
opacity: 1,
|
|
30
|
+
backgroundColor: "rgba(0, 0, 0, .5)",
|
|
31
|
+
zIndex: "10000",
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const ModalHeaderStyled = styled("div", {
|
|
35
|
+
borderBottom: "1px solid $neutral300",
|
|
36
|
+
padding: "$18 $24",
|
|
37
|
+
textAlign: "center",
|
|
38
|
+
position: "relative",
|
|
39
|
+
display: "flex",
|
|
40
|
+
alignItems: "center",
|
|
41
|
+
justifyContent: "center",
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const ModalIconClose = styled(Icon, {
|
|
45
|
+
position: "absolute",
|
|
46
|
+
right: "$24",
|
|
47
|
+
cursor: "pointer",
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
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 ModalRadix.Root> & {
|
|
60
|
+
trigger?: React.ReactNode;
|
|
61
|
+
title?: string;
|
|
62
|
+
children: React.ReactNode;
|
|
63
|
+
zIndex?: number;
|
|
64
|
+
maxWidth?: number;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export function Modal({
|
|
68
|
+
children,
|
|
69
|
+
title,
|
|
70
|
+
trigger,
|
|
71
|
+
zIndex,
|
|
72
|
+
maxWidth,
|
|
73
|
+
...props
|
|
74
|
+
}: ModalProps) {
|
|
75
|
+
return (
|
|
76
|
+
<ModalRadix.Root {...props}>
|
|
77
|
+
{trigger && <ModalRadix.Trigger asChild>{trigger}</ModalRadix.Trigger>}
|
|
78
|
+
<ModalRadix.Portal>
|
|
79
|
+
<ModalOverlay
|
|
80
|
+
css={{
|
|
81
|
+
zIndex,
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
<ModalContentStyled
|
|
85
|
+
css={{
|
|
86
|
+
maxWidth,
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
{title && (
|
|
90
|
+
<ModalHeaderStyled>
|
|
91
|
+
<ModalTitleStyled asChild>
|
|
92
|
+
<Text typography={"headline6"} fontWeight={"medium"}>
|
|
93
|
+
{title}
|
|
94
|
+
</Text>
|
|
95
|
+
</ModalTitleStyled>
|
|
96
|
+
<ModalRadix.Close asChild>
|
|
97
|
+
<ModalIconClose name="close" size="xl" />
|
|
98
|
+
</ModalRadix.Close>
|
|
99
|
+
</ModalHeaderStyled>
|
|
100
|
+
)}
|
|
101
|
+
<Box>{children}</Box>
|
|
102
|
+
</ModalContentStyled>
|
|
103
|
+
</ModalOverlay>
|
|
104
|
+
</ModalRadix.Portal>
|
|
105
|
+
</ModalRadix.Root>
|
|
106
|
+
);
|
|
107
|
+
}
|