@lets-events/react 12.3.2 → 12.3.4

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/dist/index.mjs CHANGED
@@ -143,7 +143,7 @@ var require_react_is_development = __commonJS({
143
143
  var ContextProvider = REACT_PROVIDER_TYPE;
144
144
  var Element = REACT_ELEMENT_TYPE;
145
145
  var ForwardRef = REACT_FORWARD_REF_TYPE;
146
- var Fragment5 = REACT_FRAGMENT_TYPE;
146
+ var Fragment6 = REACT_FRAGMENT_TYPE;
147
147
  var Lazy = REACT_LAZY_TYPE;
148
148
  var Memo = REACT_MEMO_TYPE;
149
149
  var Portal = REACT_PORTAL_TYPE;
@@ -202,7 +202,7 @@ var require_react_is_development = __commonJS({
202
202
  exports.ContextProvider = ContextProvider;
203
203
  exports.Element = Element;
204
204
  exports.ForwardRef = ForwardRef;
205
- exports.Fragment = Fragment5;
205
+ exports.Fragment = Fragment6;
206
206
  exports.Lazy = Lazy;
207
207
  exports.Memo = Memo;
208
208
  exports.Portal = Portal;
@@ -1236,6 +1236,9 @@ var {
1236
1236
  lineHeights,
1237
1237
  radii,
1238
1238
  space
1239
+ },
1240
+ media: {
1241
+ md: "(max-width: 690px)"
1239
1242
  }
1240
1243
  });
1241
1244
 
@@ -8026,9 +8029,6 @@ function Calendar(_a) {
8026
8029
  ] })) });
8027
8030
  }
8028
8031
 
8029
- // src/components/Drawer/index.tsx
8030
- import { useRef as useRef4 } from "react";
8031
-
8032
8032
  // src/components/Drawer/styledComponents.ts
8033
8033
  var DrawerOverlayStyled = styled("div", {
8034
8034
  position: "fixed",
@@ -8037,27 +8037,69 @@ var DrawerOverlayStyled = styled("div", {
8037
8037
  width: "100vw",
8038
8038
  height: "100vh",
8039
8039
  background: "rgba(0, 0, 0, 0.4)",
8040
- zIndex: 1e3
8040
+ transition: "opacity 200ms ease",
8041
+ variants: {
8042
+ open: {
8043
+ true: {
8044
+ opacity: "1"
8045
+ },
8046
+ false: {
8047
+ pointerEvents: "none",
8048
+ opacity: "0"
8049
+ }
8050
+ }
8051
+ }
8052
+ });
8053
+ var DrawerWrapper = styled("div", {
8054
+ position: "absolute",
8055
+ top: 0,
8056
+ right: 0,
8057
+ height: "100vh",
8058
+ overflow: "hidden",
8059
+ variants: {
8060
+ open: {
8061
+ true: {},
8062
+ false: {
8063
+ pointerEvents: "none"
8064
+ }
8065
+ }
8066
+ }
8041
8067
  });
8042
8068
  var DrawerContainerStyled = styled("div", {
8043
8069
  position: "absolute",
8044
8070
  top: 0,
8045
8071
  right: 0,
8046
- maxWidth: "calc(100% - 2rem)",
8047
- height: "100%",
8072
+ height: "100vh",
8048
8073
  background: "$neutral50",
8049
8074
  display: "flex",
8050
8075
  flexDirection: "column",
8051
8076
  boxShadow: "-4px 0 12px rgba(0, 0, 0, 0.2)",
8052
- padding: "1.5rem 0",
8053
- overflowY: "auto"
8077
+ overflowY: "auto",
8078
+ width: "100%",
8079
+ boxSizing: "border-box",
8080
+ "@md": {
8081
+ minWidth: "100vw",
8082
+ maxWidth: "100vw"
8083
+ },
8084
+ transition: "transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1)",
8085
+ paddingBottom: "1.5rem",
8086
+ variants: {
8087
+ open: {
8088
+ true: {
8089
+ transform: "translateX(0) scale(1)"
8090
+ },
8091
+ false: {
8092
+ transform: "translateX(110%) scale(0.98)"
8093
+ }
8094
+ }
8095
+ }
8054
8096
  });
8055
8097
  var DrawerHeaderDiv = styled("div", {
8056
8098
  display: "flex",
8057
8099
  justifyContent: "space-between",
8058
8100
  alignItems: "center",
8059
8101
  borderBottom: "1px solid $neutral300",
8060
- padding: "0 1.5rem 1rem",
8102
+ padding: "1.5rem 1rem",
8061
8103
  position: "relative"
8062
8104
  });
8063
8105
  var DrawerHeaderTitle = styled("h2", {
@@ -8080,7 +8122,7 @@ var GoBackButtonStyled = styled("button", {
8080
8122
  });
8081
8123
 
8082
8124
  // src/components/Drawer/index.tsx
8083
- import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
8125
+ import { Fragment, jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
8084
8126
  function Drawer({
8085
8127
  isOpen,
8086
8128
  onClose,
@@ -8090,82 +8132,59 @@ function Drawer({
8090
8132
  children,
8091
8133
  goBackIcon,
8092
8134
  goBackAction,
8093
- zIndex
8135
+ zIndex = 1e3
8094
8136
  }) {
8095
- if (!isOpen) return null;
8096
- const drawerContainerRef = useRef4(null);
8097
- useOnClickOutside(drawerContainerRef, (event) => {
8098
- var _a;
8099
- if (!event || !drawerContainerRef.current) {
8100
- return;
8101
- }
8102
- let target = event.target;
8103
- if (target.tagName === "HTML" || target.tagName === "BODY") {
8104
- if (event instanceof MouseEvent) {
8105
- const actualElement = document.elementFromPoint(
8106
- event.clientX,
8107
- event.clientY
8108
- );
8109
- if (actualElement) {
8110
- target = actualElement;
8111
- }
8112
- }
8113
- }
8114
- let currentElement = target;
8115
- let hierarchy = [];
8116
- while (currentElement && currentElement !== document.body) {
8117
- hierarchy.push({
8118
- tagName: currentElement.tagName,
8119
- className: currentElement.className,
8120
- id: currentElement.id,
8121
- attributes: Array.from(currentElement.attributes || []).map((attr) => ({
8122
- name: attr.name,
8123
- value: attr.value
8124
- }))
8125
- });
8126
- currentElement = currentElement.parentElement;
8127
- }
8128
- if ((_a = drawerContainerRef.current) == null ? void 0 : _a.contains(target)) {
8129
- return;
8130
- }
8131
- const isDropdownOpen = target.closest("[data-radix-popper-content-wrapper]") || target.closest('[role="dialog"]') || target.closest('[data-state="open"]') || target.closest("[data-radix-dropdown-menu-content]") || target.closest("[data-radix-dropdown-menu-root]") || target.closest("[data-radix-dropdown-menu-trigger]") || target.closest("[data-radix-dropdown-menu-portal]") || target.closest("[data-radix-dropdown-menu-item]") || target.closest("[data-radix-dropdown-menu-checkbox-item]") || target.closest("[data-radix-dropdown-menu-radio-item]") || target.closest("[data-radix-dropdown-menu-separator]") || target.closest("[data-radix-dropdown-menu-label]") || target.closest("[data-radix-dropdown-menu-group]") || target.closest("[data-radix-dropdown-menu-sub]") || target.closest("[data-radix-dropdown-menu-sub-trigger]") || target.closest("[data-radix-dropdown-menu-sub-content]") || target.closest("[data-radix-dropdown-menu-radio-group]");
8132
- const shouldPreventClose = isDropdownOpen || target.closest("[data-radix-dropdown-menu-root]") || target.closest("[data-radix-dropdown-menu-trigger]") || target.closest("[data-radix-dropdown-menu-content]") || target.closest("[data-radix-dropdown-menu-portal]") || target.closest("[data-radix-dropdown-menu-item]") || target.closest("[data-radix-dropdown-menu-checkbox-item]") || target.closest("[data-radix-dropdown-menu-radio-item]") || target.closest("[data-radix-dropdown-menu-separator]") || target.closest("[data-radix-dropdown-menu-label]") || target.closest("[data-radix-dropdown-menu-group]") || target.closest("[data-radix-dropdown-menu-sub]") || target.closest("[data-radix-dropdown-menu-sub-trigger]") || target.closest("[data-radix-dropdown-menu-sub-content]") || target.closest("[data-radix-dropdown-menu-radio-group]");
8133
- if (!shouldPreventClose) {
8134
- onClose == null ? void 0 : onClose();
8135
- }
8136
- });
8137
- return /* @__PURE__ */ jsx16(
8138
- DrawerOverlayStyled,
8139
- {
8140
- css: {
8141
- zIndex
8142
- },
8143
- children: /* @__PURE__ */ jsxs7(
8144
- DrawerContainerStyled,
8145
- {
8146
- ref: drawerContainerRef,
8147
- style: {
8148
- width: width != null ? width : "34.25rem",
8149
- backgroundColor: colors[backgroundColor != null ? backgroundColor : "neutral50"]
8150
- },
8151
- children: [
8152
- /* @__PURE__ */ jsxs7(DrawerHeaderDiv, { children: [
8153
- /* @__PURE__ */ jsxs7(Flex2, { gap: 8, align: "center", children: [
8154
- goBackIcon && goBackIcon && /* @__PURE__ */ jsx16(GoBackButtonStyled, { type: "button", onClick: goBackAction, children: goBackIcon }),
8155
- /* @__PURE__ */ jsx16(DrawerHeaderTitle, { children: title })
8137
+ return /* @__PURE__ */ jsxs7(Fragment, { children: [
8138
+ /* @__PURE__ */ jsx16(
8139
+ DrawerOverlayStyled,
8140
+ {
8141
+ css: {
8142
+ zIndex
8143
+ },
8144
+ onClick: onClose,
8145
+ open: isOpen
8146
+ }
8147
+ ),
8148
+ /* @__PURE__ */ jsx16(
8149
+ DrawerWrapper,
8150
+ {
8151
+ css: {
8152
+ zIndex: zIndex + 1,
8153
+ width: width != null ? width : "34.25rem"
8154
+ },
8155
+ children: /* @__PURE__ */ jsxs7(
8156
+ DrawerContainerStyled,
8157
+ {
8158
+ open: isOpen,
8159
+ css: {
8160
+ backgroundColor: colors[backgroundColor != null ? backgroundColor : "neutral50"]
8161
+ },
8162
+ children: [
8163
+ /* @__PURE__ */ jsxs7(DrawerHeaderDiv, { children: [
8164
+ /* @__PURE__ */ jsxs7(Flex2, { gap: 8, align: "center", children: [
8165
+ goBackIcon && goBackIcon && /* @__PURE__ */ jsx16(GoBackButtonStyled, { type: "button", onClick: goBackAction, children: goBackIcon }),
8166
+ /* @__PURE__ */ jsx16(DrawerHeaderTitle, { children: title })
8167
+ ] }),
8168
+ /* @__PURE__ */ jsx16(DrawerHeaderCloseButton, { onClick: onClose, children: /* @__PURE__ */ jsx16(Icon_default, { size: "xl", color: "$dark600", name: "xmark" }) })
8156
8169
  ] }),
8157
- /* @__PURE__ */ jsx16(DrawerHeaderCloseButton, { onClick: onClose, children: /* @__PURE__ */ jsx16(Icon_default, { size: "xl", color: "$dark600", name: "xmark" }) })
8158
- ] }),
8159
- children
8160
- ]
8161
- }
8162
- )
8163
- }
8164
- );
8170
+ isOpen ? children : null,
8171
+ isOpen ? children : null,
8172
+ isOpen ? children : null,
8173
+ isOpen ? children : null,
8174
+ isOpen ? children : null,
8175
+ isOpen ? children : null,
8176
+ isOpen ? children : null,
8177
+ isOpen ? children : null
8178
+ ]
8179
+ }
8180
+ )
8181
+ }
8182
+ )
8183
+ ] });
8165
8184
  }
8166
8185
 
8167
8186
  // src/components/TimePicker.tsx
8168
- import { useCallback, useRef as useRef5, useState as useState3 } from "react";
8187
+ import { useCallback, useRef as useRef4, useState as useState3 } from "react";
8169
8188
  import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
8170
8189
  var TimePickerStyled = styled("div", {
8171
8190
  position: "relative",
@@ -8293,7 +8312,7 @@ function TimePicker({
8293
8312
  const [rawHours, setRawHours] = useState3("00");
8294
8313
  const [rawMinutes, setRawMinutes] = useState3("00");
8295
8314
  const [isOpen, setIsOpen] = useState3(false);
8296
- const dropdownRef = useRef5(null);
8315
+ const dropdownRef = useRef4(null);
8297
8316
  useOnClickOutside(dropdownRef, () => setIsOpen(false));
8298
8317
  const handleIncrement = useCallback(
8299
8318
  (type) => {
@@ -8495,7 +8514,7 @@ function TimePicker({
8495
8514
 
8496
8515
  // src/components/Alert.tsx
8497
8516
  import { Theme as Theme2, AlertDialog } from "@radix-ui/themes";
8498
- import { Fragment, jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
8517
+ import { Fragment as Fragment2, jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
8499
8518
  var AlertDialogSimpleStyled = styled(AlertDialog.Content, {
8500
8519
  fontFamily: "$default",
8501
8520
  lineHeight: "$base",
@@ -8609,10 +8628,10 @@ function Alert(_a) {
8609
8628
  "completAlert",
8610
8629
  "simpleAlert"
8611
8630
  ]);
8612
- return /* @__PURE__ */ jsxs9(Fragment, { children: [
8631
+ return /* @__PURE__ */ jsxs9(Fragment2, { children: [
8613
8632
  simpleAlert && /* @__PURE__ */ jsx18(Theme2, { children: /* @__PURE__ */ jsxs9(AlertDialog.Root, { children: [
8614
8633
  /* @__PURE__ */ jsx18(AlertDialog.Trigger, { children: trigger }),
8615
- /* @__PURE__ */ jsx18(Fragment, { children: /* @__PURE__ */ jsxs9(AlertDialogSimpleStyled, __spreadProps(__spreadValues({}, props), { children: [
8634
+ /* @__PURE__ */ jsx18(Fragment2, { children: /* @__PURE__ */ jsxs9(AlertDialogSimpleStyled, __spreadProps(__spreadValues({}, props), { children: [
8616
8635
  /* @__PURE__ */ jsx18(AlertDialogDescriptionStyled, { children: simpleAlert.description }),
8617
8636
  simpleAlert.cancel && /* @__PURE__ */ jsx18(AlertDialog.Cancel, { children: /* @__PURE__ */ jsx18(Button, { variant: "text", children: /* @__PURE__ */ jsx18(Icon_default, { name: "close" }) }) })
8618
8637
  ] })) })
@@ -9006,13 +9025,23 @@ var CardStyled = styled(CardRadix, {
9006
9025
  }
9007
9026
  });
9008
9027
  function Card(_a) {
9009
- var _b = _a, { asChild, children } = _b, props = __objRest(_b, ["asChild", "children"]);
9010
- return /* @__PURE__ */ jsx21(CardStyled, __spreadProps(__spreadValues({}, props), { children }));
9028
+ var _b = _a, {
9029
+ asChild,
9030
+ children,
9031
+ padding,
9032
+ radius
9033
+ } = _b, props = __objRest(_b, [
9034
+ "asChild",
9035
+ "children",
9036
+ "padding",
9037
+ "radius"
9038
+ ]);
9039
+ return /* @__PURE__ */ jsx21(CardStyled, __spreadProps(__spreadValues({}, props), { css: { padding, borderRadius: radius }, children }));
9011
9040
  }
9012
9041
 
9013
9042
  // src/components/TextareaField.tsx
9014
9043
  import { TextArea as TextAreaRadix } from "@radix-ui/themes";
9015
- import React8, { useRef as useRef6, useState as useState4, useEffect as useEffect4 } from "react";
9044
+ import React8, { useRef as useRef5, useState as useState4, useEffect as useEffect4 } from "react";
9016
9045
  import { jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
9017
9046
  var TextareaFieldStyle = styled(TextAreaRadix, {
9018
9047
  display: "flex",
@@ -9079,7 +9108,7 @@ var TextareaLimitIndicator = styled("div", {
9079
9108
  });
9080
9109
  var TextareaField = React8.forwardRef((_a, forwardedRef) => {
9081
9110
  var _b = _a, { maxLength, color } = _b, props = __objRest(_b, ["maxLength", "color"]);
9082
- const inputRef = useRef6(null);
9111
+ const inputRef = useRef5(null);
9083
9112
  const [remaining, setRemaining] = useState4(maxLength);
9084
9113
  useEffect4(() => {
9085
9114
  var _a2;
@@ -9377,7 +9406,7 @@ function Tooltip({
9377
9406
  }
9378
9407
 
9379
9408
  // src/components/MultiSelect/index.tsx
9380
- import React9, { useCallback as useCallback2, useRef as useRef7, useState as useState7 } from "react";
9409
+ import React9, { useCallback as useCallback2, useRef as useRef6, useState as useState7 } from "react";
9381
9410
  import { DropdownMenu as DropdownMenu4, Theme as Theme3 } from "@radix-ui/themes";
9382
9411
  import { FontAwesomeIcon as FontAwesomeIcon3 } from "@fortawesome/react-fontawesome";
9383
9412
  import {
@@ -9554,7 +9583,7 @@ var MultiSelect = React9.forwardRef(
9554
9583
  selectedScroll = false
9555
9584
  }, fowardedRef) => {
9556
9585
  const [isOpen, setIsOpen] = useState7(false);
9557
- const triggerRef = useRef7(null);
9586
+ const triggerRef = useRef6(null);
9558
9587
  const [allOptionsSelected, setAllOptionsSelected] = useState7(false);
9559
9588
  const labelByValue = useMemo2(() => {
9560
9589
  return options.reduce((prev, curr) => {
@@ -10661,14 +10690,14 @@ var brazilianStates = [
10661
10690
  ];
10662
10691
 
10663
10692
  // src/components/FormFields/AddressFormFields/StateFormField.tsx
10664
- import { Fragment as Fragment2, jsx as jsx44 } from "react/jsx-runtime";
10693
+ import { Fragment as Fragment3, jsx as jsx44 } from "react/jsx-runtime";
10665
10694
  function StateFormField({
10666
10695
  name,
10667
10696
  label,
10668
10697
  required,
10669
10698
  isBrazil
10670
10699
  }) {
10671
- return /* @__PURE__ */ jsx44(Fragment2, { children: isBrazil ? /* @__PURE__ */ jsx44(
10700
+ return /* @__PURE__ */ jsx44(Fragment3, { children: isBrazil ? /* @__PURE__ */ jsx44(
10672
10701
  SelectFormField,
10673
10702
  {
10674
10703
  name,
@@ -10682,7 +10711,7 @@ function StateFormField({
10682
10711
  // src/components/FormFields/AddressFormFields/CityFormField.tsx
10683
10712
  import { useEffect as useEffect5, useState as useState8 } from "react";
10684
10713
  import { useFormContext as useFormContext5, Controller as Controller2 } from "react-hook-form";
10685
- import { Fragment as Fragment3, jsx as jsx45 } from "react/jsx-runtime";
10714
+ import { Fragment as Fragment4, jsx as jsx45 } from "react/jsx-runtime";
10686
10715
  function CityFormField({
10687
10716
  name,
10688
10717
  label,
@@ -10734,7 +10763,7 @@ function CityFormField({
10734
10763
  }
10735
10764
  fetchCities();
10736
10765
  }, [selectedState, isBrazil]);
10737
- return /* @__PURE__ */ jsx45(Fragment3, { children: isBrazil && cities.length > 0 ? /* @__PURE__ */ jsx45(
10766
+ return /* @__PURE__ */ jsx45(Fragment4, { children: isBrazil && cities.length > 0 ? /* @__PURE__ */ jsx45(
10738
10767
  Controller2,
10739
10768
  {
10740
10769
  name,
@@ -11086,7 +11115,7 @@ import { useController as useController3 } from "react-hook-form";
11086
11115
  import { useEffect as useEffect7, useState as useState10 } from "react";
11087
11116
 
11088
11117
  // src/components/RichEditor/QuillComponent.tsx
11089
- import { useState as useState9, useRef as useRef8, useEffect as useEffect6, useCallback as useCallback4 } from "react";
11118
+ import { useState as useState9, useRef as useRef7, useEffect as useEffect6, useCallback as useCallback4 } from "react";
11090
11119
  import { useQuill } from "react-quilljs";
11091
11120
 
11092
11121
  // src/utils/uploadService.ts
@@ -12159,8 +12188,8 @@ var QuillComponent = ({
12159
12188
  const [videoUrl, setVideoUrl] = useState9("");
12160
12189
  const [showLinkModal, setShowLinkModal] = useState9(false);
12161
12190
  const [linkUrl, setLinkUrl] = useState9("");
12162
- const videoModalRef = useRef8(null);
12163
- const linkModalRef = useRef8(null);
12191
+ const videoModalRef = useRef7(null);
12192
+ const linkModalRef = useRef7(null);
12164
12193
  const { addToast, removeToast } = useToast();
12165
12194
  const formatHTML = (html) => {
12166
12195
  const parser = new DOMParser();
@@ -12565,7 +12594,7 @@ var RichEditor_default = RichEditor;
12565
12594
 
12566
12595
  // src/components/FormFields/RichEditorFormField.tsx
12567
12596
  import { useState as useState11 } from "react";
12568
- import { Fragment as Fragment4, jsx as jsx53, jsxs as jsxs27 } from "react/jsx-runtime";
12597
+ import { Fragment as Fragment5, jsx as jsx53, jsxs as jsxs27 } from "react/jsx-runtime";
12569
12598
  var RichEditorFormField = (_a) => {
12570
12599
  var _b = _a, {
12571
12600
  name,
@@ -12620,7 +12649,7 @@ var RichEditorFormField = (_a) => {
12620
12649
  }
12621
12650
  ),
12622
12651
  /* @__PURE__ */ jsx53(Badge, { color: "grey", size: "xs", children: caracterQuantity })
12623
- ] }) : /* @__PURE__ */ jsx53(Fragment4, { children: label && /* @__PURE__ */ jsx53(
12652
+ ] }) : /* @__PURE__ */ jsx53(Fragment5, { children: label && /* @__PURE__ */ jsx53(
12624
12653
  FormLabel,
12625
12654
  {
12626
12655
  name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lets-events/react",
3
- "version": "12.3.2",
3
+ "version": "12.3.4",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -45,8 +45,20 @@ export const CardStyled = styled(CardRadix, {
45
45
  export type CardProps = ComponentProps<typeof CardStyled> & {
46
46
  children: React.ReactNode;
47
47
  as?: ElementType;
48
+ padding?: string;
49
+ radius?: string;
48
50
  };
49
51
 
50
- export function Card({ asChild, children, ...props }: CardProps) {
51
- return <CardStyled {...props}>{children}</CardStyled>;
52
+ export function Card({
53
+ asChild,
54
+ children,
55
+ padding,
56
+ radius,
57
+ ...props
58
+ }: CardProps) {
59
+ return (
60
+ <CardStyled {...props} css={{ padding, borderRadius: radius }}>
61
+ {children}
62
+ </CardStyled>
63
+ );
52
64
  }
@@ -8,6 +8,7 @@ import {
8
8
  DrawerHeaderTitle,
9
9
  DrawerHeaderCloseButton,
10
10
  GoBackButtonStyled,
11
+ DrawerWrapper,
11
12
  } from "./styledComponents";
12
13
  import { useOnClickOutside } from "../../hooks/useOnClickOutside";
13
14
  import { Flex } from "../Flex";
@@ -33,116 +34,52 @@ export function Drawer({
33
34
  children,
34
35
  goBackIcon,
35
36
  goBackAction,
36
- zIndex,
37
+ zIndex = 1000,
37
38
  }: 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
39
  return (
119
- <DrawerOverlayStyled
120
- css={{
121
- zIndex,
122
- }}
123
- >
124
- <DrawerContainerStyled
125
- ref={drawerContainerRef}
126
- style={{
40
+ <>
41
+ <DrawerOverlayStyled
42
+ css={{
43
+ zIndex,
44
+ }}
45
+ onClick={onClose}
46
+ open={isOpen}
47
+ />
48
+ <DrawerWrapper
49
+ css={{
50
+ zIndex: zIndex + 1,
127
51
  width: width ?? "34.25rem",
128
- backgroundColor: colors[backgroundColor ?? "neutral50"],
129
52
  }}
130
53
  >
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>
54
+ <DrawerContainerStyled
55
+ open={isOpen}
56
+ css={{
57
+ backgroundColor: colors[backgroundColor ?? "neutral50"],
58
+ }}
59
+ >
60
+ <DrawerHeaderDiv>
61
+ <Flex gap={8} align="center">
62
+ {goBackIcon && goBackIcon && (
63
+ <GoBackButtonStyled type="button" onClick={goBackAction}>
64
+ {goBackIcon}
65
+ </GoBackButtonStyled>
66
+ )}
67
+ <DrawerHeaderTitle>{title}</DrawerHeaderTitle>
68
+ </Flex>
69
+ <DrawerHeaderCloseButton onClick={onClose}>
70
+ <Icon size={"xl"} color="$dark600" name="xmark" />
71
+ </DrawerHeaderCloseButton>
72
+ </DrawerHeaderDiv>
73
+ {isOpen ? children : null}
74
+ {isOpen ? children : null}
75
+ {isOpen ? children : null}
76
+ {isOpen ? children : null}
77
+ {isOpen ? children : null}
78
+ {isOpen ? children : null}
79
+ {isOpen ? children : null}
80
+ {isOpen ? children : null}
81
+ </DrawerContainerStyled>
82
+ </DrawerWrapper>
83
+ </>
147
84
  );
148
85
  }