@lets-events/react 12.2.9 → 12.2.11

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.
Files changed (90) hide show
  1. package/.eslintrc.json +2 -2
  2. package/.turbo/turbo-build.log +19 -21
  3. package/CHANGELOG.md +12 -0
  4. package/dist/index.css +171 -0
  5. package/dist/index.d.mts +375 -3
  6. package/dist/index.d.ts +375 -3
  7. package/dist/index.js +43 -22
  8. package/dist/index.mjs +42 -22
  9. package/package.json +1 -1
  10. package/src/components/Alert.tsx +303 -303
  11. package/src/components/Avatar.tsx +55 -55
  12. package/src/components/Badge.tsx +125 -125
  13. package/src/components/Box.tsx +3 -3
  14. package/src/components/Button/index.tsx +16 -16
  15. package/src/components/Button/styledComponents.ts +300 -300
  16. package/src/components/ButtonGroup.tsx +484 -484
  17. package/src/components/Calendar/index.tsx +148 -148
  18. package/src/components/Calendar/styledComponents.ts +250 -250
  19. package/src/components/Card.tsx +48 -48
  20. package/src/components/CheckboxGroup.tsx +176 -176
  21. package/src/components/Container.tsx +39 -39
  22. package/src/components/Divider.tsx +7 -0
  23. package/src/components/Drawer/index.tsx +148 -138
  24. package/src/components/Drawer/styledComponents.ts +52 -52
  25. package/src/components/Dropdown.tsx +302 -302
  26. package/src/components/Filter.tsx +164 -164
  27. package/src/components/Flex.tsx +118 -118
  28. package/src/components/FormFields/AddressFormFields/CityFormField.tsx +111 -111
  29. package/src/components/FormFields/AddressFormFields/CountryFormField.tsx +33 -33
  30. package/src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx +39 -39
  31. package/src/components/FormFields/AddressFormFields/StateFormField.tsx +32 -32
  32. package/src/components/FormFields/AddressFormFields/index.tsx +141 -141
  33. package/src/components/FormFields/BirthDateFormField.tsx +84 -84
  34. package/src/components/FormFields/CNPJFormField.tsx +87 -87
  35. package/src/components/FormFields/CPFFormField.tsx +78 -78
  36. package/src/components/FormFields/CalendarFormField.tsx +95 -95
  37. package/src/components/FormFields/CheckboxGroupFormField.tsx +91 -91
  38. package/src/components/FormFields/EmailFormField.tsx +27 -27
  39. package/src/components/FormFields/Form.tsx +39 -39
  40. package/src/components/FormFields/IdentityDocumentNumberFormField.tsx +32 -32
  41. package/src/components/FormFields/MultiSelectFormField.tsx +64 -64
  42. package/src/components/FormFields/PhoneFormField.tsx +40 -40
  43. package/src/components/FormFields/RadioGroupFormField.tsx +84 -84
  44. package/src/components/FormFields/RichEditorFormField.tsx +103 -102
  45. package/src/components/FormFields/SelectFormField.tsx +93 -93
  46. package/src/components/FormFields/SwitchFormField.tsx +46 -46
  47. package/src/components/FormFields/TextAreaFormField.tsx +57 -57
  48. package/src/components/FormFields/TextFormField.tsx +112 -112
  49. package/src/components/FormFields/TimePickerFormField.tsx +88 -88
  50. package/src/components/FormFields/subComponents/ErrorFormMessage.tsx +36 -36
  51. package/src/components/FormFields/subComponents/FormLabel.tsx +29 -29
  52. package/src/components/FormFields/utils/validation.ts +23 -23
  53. package/src/components/Grid.tsx +137 -137
  54. package/src/components/Icon.tsx +47 -47
  55. package/src/components/MenuDropdown/index.tsx +38 -38
  56. package/src/components/MenuDropdown/styledComponents.ts +31 -31
  57. package/src/components/Modal.tsx +90 -90
  58. package/src/components/MultiSelect/index.tsx +243 -243
  59. package/src/components/MultiSelect/styledComponents.ts +160 -160
  60. package/src/components/RadioGroup.tsx +210 -210
  61. package/src/components/RichEditor/QuillComponent.tsx +457 -455
  62. package/src/components/RichEditor/RichEditor.tsx +49 -49
  63. package/src/components/RichEditor/index.ts +2 -2
  64. package/src/components/RichEditor/styledComponents.ts +1151 -1151
  65. package/src/components/Section.tsx +33 -33
  66. package/src/components/Step.tsx +164 -164
  67. package/src/components/Switch.tsx +108 -108
  68. package/src/components/Text.tsx +38 -38
  69. package/src/components/TextField.tsx +372 -372
  70. package/src/components/TextareaField.tsx +127 -127
  71. package/src/components/TimePicker.tsx +328 -328
  72. package/src/components/Toast/components/ToastItem.tsx +41 -41
  73. package/src/components/Toast/components/ToastProvider.tsx +63 -63
  74. package/src/components/Toast/hooks/useToast.ts +12 -12
  75. package/src/components/Toast/index.tsx +5 -5
  76. package/src/components/Toast/styles/index.ts +135 -135
  77. package/src/components/Toast/types/index.ts +46 -46
  78. package/src/components/Tooltip/index.tsx +66 -66
  79. package/src/components/Tooltip/styles.ts +77 -77
  80. package/src/hooks/useCountries.ts +41 -41
  81. package/src/hooks/useImageUpload.ts +139 -139
  82. package/src/hooks/useOnClickOutside.tsx +42 -42
  83. package/src/index.tsx +69 -68
  84. package/src/styles/index.ts +38 -38
  85. package/src/types/typographyValues.ts +178 -178
  86. package/src/utils/getNestedValue.ts +3 -3
  87. package/src/utils/states.ts +29 -29
  88. package/src/utils/uploadService.ts +180 -180
  89. package/tsconfig.json +3 -3
  90. package/tsup.config.ts +38 -38
@@ -1,138 +1,148 @@
1
- import { ComponentProps, ReactNode, useRef } from "react";
2
- import { colors, Colors } from "@lets-events/tokens";
3
- import Icon from "../Icon";
4
- import {
5
- DrawerOverlayStyled,
6
- DrawerContainerStyled,
7
- DrawerHeaderDiv,
8
- DrawerHeaderTitle,
9
- DrawerHeaderCloseButton,
10
- GoBackButtonStyled,
11
- } from "./styledComponents";
12
- import { useOnClickOutside } from "../../hooks/useOnClickOutside";
13
- import { Flex } from "../Flex";
14
-
15
- export type DrawerProps = ComponentProps<typeof DrawerOverlayStyled> & {
16
- isOpen: boolean;
17
- onClose: () => void;
18
- width?: string;
19
- backgroundColor?: keyof Colors;
20
- title: string;
21
- children?: ReactNode;
22
- goBackIcon?: ReactNode;
23
- goBackAction?: () => void;
24
- };
25
-
26
- export function Drawer({
27
- isOpen,
28
- onClose,
29
- width,
30
- backgroundColor,
31
- title,
32
- children,
33
- goBackIcon,
34
- goBackAction
35
- }: DrawerProps) {
36
- if (!isOpen) return null;
37
- const drawerContainerRef = useRef<HTMLDivElement>(null);
38
-
39
- useOnClickOutside(drawerContainerRef, (event?: MouseEvent | TouchEvent) => {
40
- if (!event || !drawerContainerRef.current) {
41
- return;
42
- }
43
-
44
- let target = event.target as Element;
45
-
46
- if (target.tagName === "HTML" || target.tagName === "BODY") {
47
- if (event instanceof MouseEvent) {
48
- const actualElement = document.elementFromPoint(
49
- event.clientX,
50
- event.clientY
51
- );
52
- if (actualElement) {
53
- target = actualElement;
54
- }
55
- }
56
- }
57
-
58
- let currentElement: Element | null = target;
59
- let hierarchy = [];
60
- while (currentElement && currentElement !== document.body) {
61
- hierarchy.push({
62
- tagName: currentElement.tagName,
63
- className: currentElement.className,
64
- id: currentElement.id,
65
- attributes: Array.from(currentElement.attributes || []).map((attr) => ({
66
- name: attr.name,
67
- value: attr.value,
68
- })),
69
- });
70
- currentElement = currentElement.parentElement;
71
- }
72
-
73
- if (drawerContainerRef.current?.contains(target)) {
74
- return;
75
- }
76
- const isDropdownOpen =
77
- target.closest("[data-radix-popper-content-wrapper]") ||
78
- target.closest('[role="dialog"]') ||
79
- target.closest('[data-state="open"]') ||
80
- target.closest("[data-radix-dropdown-menu-content]") ||
81
- target.closest("[data-radix-dropdown-menu-root]") ||
82
- target.closest("[data-radix-dropdown-menu-trigger]") ||
83
- target.closest("[data-radix-dropdown-menu-portal]") ||
84
- target.closest("[data-radix-dropdown-menu-item]") ||
85
- target.closest("[data-radix-dropdown-menu-checkbox-item]") ||
86
- target.closest("[data-radix-dropdown-menu-radio-item]") ||
87
- target.closest("[data-radix-dropdown-menu-separator]") ||
88
- target.closest("[data-radix-dropdown-menu-label]") ||
89
- target.closest("[data-radix-dropdown-menu-group]") ||
90
- target.closest("[data-radix-dropdown-menu-sub]") ||
91
- target.closest("[data-radix-dropdown-menu-sub-trigger]") ||
92
- target.closest("[data-radix-dropdown-menu-sub-content]") ||
93
- target.closest("[data-radix-dropdown-menu-radio-group]");
94
-
95
- const shouldPreventClose =
96
- isDropdownOpen ||
97
- target.closest("[data-radix-dropdown-menu-root]") ||
98
- target.closest("[data-radix-dropdown-menu-trigger]") ||
99
- target.closest("[data-radix-dropdown-menu-content]") ||
100
- target.closest("[data-radix-dropdown-menu-portal]") ||
101
- target.closest("[data-radix-dropdown-menu-item]") ||
102
- target.closest("[data-radix-dropdown-menu-checkbox-item]") ||
103
- target.closest("[data-radix-dropdown-menu-radio-item]") ||
104
- target.closest("[data-radix-dropdown-menu-separator]") ||
105
- target.closest("[data-radix-dropdown-menu-label]") ||
106
- target.closest("[data-radix-dropdown-menu-group]") ||
107
- target.closest("[data-radix-dropdown-menu-sub]") ||
108
- target.closest("[data-radix-dropdown-menu-sub-trigger]") ||
109
- target.closest("[data-radix-dropdown-menu-sub-content]") ||
110
- target.closest("[data-radix-dropdown-menu-radio-group]");
111
-
112
- if (!shouldPreventClose) {
113
- onClose();
114
- }
115
- });
116
- return (
117
- <DrawerOverlayStyled>
118
- <DrawerContainerStyled
119
- ref={drawerContainerRef}
120
- style={{
121
- width: width ?? "34.25rem",
122
- backgroundColor: colors[backgroundColor ?? "neutral50"],
123
- }}
124
- >
125
- <DrawerHeaderDiv>
126
- <Flex gap={8} align="center">
127
- {(goBackIcon && goBackIcon) && <GoBackButtonStyled type="button" onClick={goBackAction}>{goBackIcon}</GoBackButtonStyled>}
128
- <DrawerHeaderTitle>{title}</DrawerHeaderTitle>
129
- </Flex>
130
- <DrawerHeaderCloseButton onClick={onClose}>
131
- <Icon size={"xl"} color="$dark600" name="xmark" />
132
- </DrawerHeaderCloseButton>
133
- </DrawerHeaderDiv>
134
- {children}
135
- </DrawerContainerStyled>
136
- </DrawerOverlayStyled>
137
- );
138
- }
1
+ import { ComponentProps, ReactNode, useRef } from "react";
2
+ import { colors, Colors } from "@lets-events/tokens";
3
+ import Icon from "../Icon";
4
+ import {
5
+ DrawerOverlayStyled,
6
+ DrawerContainerStyled,
7
+ DrawerHeaderDiv,
8
+ DrawerHeaderTitle,
9
+ DrawerHeaderCloseButton,
10
+ GoBackButtonStyled,
11
+ } from "./styledComponents";
12
+ import { useOnClickOutside } from "../../hooks/useOnClickOutside";
13
+ import { Flex } from "../Flex";
14
+
15
+ export type DrawerProps = ComponentProps<typeof DrawerOverlayStyled> & {
16
+ isOpen: boolean;
17
+ onClose: () => void;
18
+ width?: string;
19
+ backgroundColor?: keyof Colors;
20
+ title: string;
21
+ children?: ReactNode;
22
+ goBackIcon?: ReactNode;
23
+ goBackAction?: () => void;
24
+ zIndex?: number;
25
+ };
26
+
27
+ export function Drawer({
28
+ isOpen,
29
+ onClose,
30
+ width,
31
+ backgroundColor,
32
+ title,
33
+ children,
34
+ goBackIcon,
35
+ goBackAction,
36
+ zIndex,
37
+ }: DrawerProps) {
38
+ if (!isOpen) return null;
39
+ const drawerContainerRef = useRef<HTMLDivElement>(null);
40
+
41
+ useOnClickOutside(drawerContainerRef, (event?: MouseEvent | TouchEvent) => {
42
+ if (!event || !drawerContainerRef.current) {
43
+ return;
44
+ }
45
+
46
+ let target = event.target as Element;
47
+
48
+ if (target.tagName === "HTML" || target.tagName === "BODY") {
49
+ if (event instanceof MouseEvent) {
50
+ const actualElement = document.elementFromPoint(
51
+ event.clientX,
52
+ event.clientY
53
+ );
54
+ if (actualElement) {
55
+ target = actualElement;
56
+ }
57
+ }
58
+ }
59
+
60
+ let currentElement: Element | null = target;
61
+ let hierarchy = [];
62
+ while (currentElement && currentElement !== document.body) {
63
+ hierarchy.push({
64
+ tagName: currentElement.tagName,
65
+ className: currentElement.className,
66
+ id: currentElement.id,
67
+ attributes: Array.from(currentElement.attributes || []).map((attr) => ({
68
+ name: attr.name,
69
+ value: attr.value,
70
+ })),
71
+ });
72
+ currentElement = currentElement.parentElement;
73
+ }
74
+
75
+ if (drawerContainerRef.current?.contains(target)) {
76
+ return;
77
+ }
78
+ const isDropdownOpen =
79
+ target.closest("[data-radix-popper-content-wrapper]") ||
80
+ target.closest('[role="dialog"]') ||
81
+ target.closest('[data-state="open"]') ||
82
+ target.closest("[data-radix-dropdown-menu-content]") ||
83
+ target.closest("[data-radix-dropdown-menu-root]") ||
84
+ target.closest("[data-radix-dropdown-menu-trigger]") ||
85
+ target.closest("[data-radix-dropdown-menu-portal]") ||
86
+ target.closest("[data-radix-dropdown-menu-item]") ||
87
+ target.closest("[data-radix-dropdown-menu-checkbox-item]") ||
88
+ target.closest("[data-radix-dropdown-menu-radio-item]") ||
89
+ target.closest("[data-radix-dropdown-menu-separator]") ||
90
+ target.closest("[data-radix-dropdown-menu-label]") ||
91
+ target.closest("[data-radix-dropdown-menu-group]") ||
92
+ target.closest("[data-radix-dropdown-menu-sub]") ||
93
+ target.closest("[data-radix-dropdown-menu-sub-trigger]") ||
94
+ target.closest("[data-radix-dropdown-menu-sub-content]") ||
95
+ target.closest("[data-radix-dropdown-menu-radio-group]");
96
+
97
+ const shouldPreventClose =
98
+ isDropdownOpen ||
99
+ target.closest("[data-radix-dropdown-menu-root]") ||
100
+ target.closest("[data-radix-dropdown-menu-trigger]") ||
101
+ target.closest("[data-radix-dropdown-menu-content]") ||
102
+ target.closest("[data-radix-dropdown-menu-portal]") ||
103
+ target.closest("[data-radix-dropdown-menu-item]") ||
104
+ target.closest("[data-radix-dropdown-menu-checkbox-item]") ||
105
+ target.closest("[data-radix-dropdown-menu-radio-item]") ||
106
+ target.closest("[data-radix-dropdown-menu-separator]") ||
107
+ target.closest("[data-radix-dropdown-menu-label]") ||
108
+ target.closest("[data-radix-dropdown-menu-group]") ||
109
+ target.closest("[data-radix-dropdown-menu-sub]") ||
110
+ target.closest("[data-radix-dropdown-menu-sub-trigger]") ||
111
+ target.closest("[data-radix-dropdown-menu-sub-content]") ||
112
+ target.closest("[data-radix-dropdown-menu-radio-group]");
113
+
114
+ if (!shouldPreventClose) {
115
+ onClose?.();
116
+ }
117
+ });
118
+ return (
119
+ <DrawerOverlayStyled
120
+ css={{
121
+ zIndex,
122
+ }}
123
+ >
124
+ <DrawerContainerStyled
125
+ ref={drawerContainerRef}
126
+ style={{
127
+ width: width ?? "34.25rem",
128
+ backgroundColor: colors[backgroundColor ?? "neutral50"],
129
+ }}
130
+ >
131
+ <DrawerHeaderDiv>
132
+ <Flex gap={8} align="center">
133
+ {goBackIcon && goBackIcon && (
134
+ <GoBackButtonStyled type="button" onClick={goBackAction}>
135
+ {goBackIcon}
136
+ </GoBackButtonStyled>
137
+ )}
138
+ <DrawerHeaderTitle>{title}</DrawerHeaderTitle>
139
+ </Flex>
140
+ <DrawerHeaderCloseButton onClick={onClose}>
141
+ <Icon size={"xl"} color="$dark600" name="xmark" />
142
+ </DrawerHeaderCloseButton>
143
+ </DrawerHeaderDiv>
144
+ {children}
145
+ </DrawerContainerStyled>
146
+ </DrawerOverlayStyled>
147
+ );
148
+ }
@@ -1,52 +1,52 @@
1
- import { styled } from "../../styles";
2
-
3
- export const DrawerOverlayStyled = styled("div", {
4
- position: "fixed",
5
- top: 0,
6
- right: 0,
7
- width: "100vw",
8
- height: "100vh",
9
- background: "rgba(0, 0, 0, 0.4)",
10
- zIndex: 1000,
11
- });
12
-
13
- export const DrawerContainerStyled = styled("div", {
14
- position: "absolute",
15
- top: 0,
16
- right: 0,
17
- maxWidth: "calc(100% - 2rem)",
18
- height: "100%",
19
- background: "$neutral50",
20
- display: "flex",
21
- flexDirection: "column",
22
- boxShadow: "-4px 0 12px rgba(0, 0, 0, 0.2)",
23
- padding: "1.5rem 0",
24
- overflowY: "auto",
25
- });
26
-
27
- export const DrawerHeaderDiv = styled("div", {
28
- display: "flex",
29
- justifyContent: "space-between",
30
- alignItems: "center",
31
- borderBottom: "1px solid $neutral300",
32
- padding: "0 1.5rem 1rem",
33
- position: "relative",
34
- });
35
- export const DrawerHeaderTitle = styled("h2", {
36
- fontSize: "1.125rem",
37
- fontWeight: "400",
38
- fontFamily: "Work Sans",
39
- color: "$dark800",
40
- margin: "0",
41
- });
42
- export const DrawerHeaderCloseButton = styled("button", {
43
- background: "none",
44
- border: "none",
45
- cursor: "pointer",
46
- });
47
- export const GoBackButtonStyled = styled("button", {
48
- background: "none",
49
- padding: "0",
50
- border: "none",
51
- cursor: "pointer",
52
- });
1
+ import { styled } from "../../styles";
2
+
3
+ export const DrawerOverlayStyled = styled("div", {
4
+ position: "fixed",
5
+ top: 0,
6
+ right: 0,
7
+ width: "100vw",
8
+ height: "100vh",
9
+ background: "rgba(0, 0, 0, 0.4)",
10
+ zIndex: 1000,
11
+ });
12
+
13
+ export const DrawerContainerStyled = styled("div", {
14
+ position: "absolute",
15
+ top: 0,
16
+ right: 0,
17
+ maxWidth: "calc(100% - 2rem)",
18
+ height: "100%",
19
+ background: "$neutral50",
20
+ display: "flex",
21
+ flexDirection: "column",
22
+ boxShadow: "-4px 0 12px rgba(0, 0, 0, 0.2)",
23
+ padding: "1.5rem 0",
24
+ overflowY: "auto",
25
+ });
26
+
27
+ export const DrawerHeaderDiv = styled("div", {
28
+ display: "flex",
29
+ justifyContent: "space-between",
30
+ alignItems: "center",
31
+ borderBottom: "1px solid $neutral300",
32
+ padding: "0 1.5rem 1rem",
33
+ position: "relative",
34
+ });
35
+ export const DrawerHeaderTitle = styled("h2", {
36
+ fontSize: "1.125rem",
37
+ fontWeight: "400",
38
+ fontFamily: "Work Sans",
39
+ color: "$dark800",
40
+ margin: "0",
41
+ });
42
+ export const DrawerHeaderCloseButton = styled("button", {
43
+ background: "none",
44
+ border: "none",
45
+ cursor: "pointer",
46
+ });
47
+ export const GoBackButtonStyled = styled("button", {
48
+ background: "none",
49
+ padding: "0",
50
+ border: "none",
51
+ cursor: "pointer",
52
+ });