@lets-events/react 12.1.13 → 12.2.1

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 Fragment6 = REACT_FRAGMENT_TYPE;
146
+ var Fragment5 = 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 = Fragment6;
205
+ exports.Fragment = Fragment5;
206
206
  exports.Lazy = Lazy;
207
207
  exports.Memo = Memo;
208
208
  exports.Portal = Portal;
@@ -8001,6 +8001,12 @@ var DrawerHeaderCloseButton = styled("button", {
8001
8001
  border: "none",
8002
8002
  cursor: "pointer"
8003
8003
  });
8004
+ var GoBackButtonStyled = styled("button", {
8005
+ background: "none",
8006
+ padding: "0",
8007
+ border: "none",
8008
+ cursor: "pointer"
8009
+ });
8004
8010
 
8005
8011
  // src/components/Drawer/index.tsx
8006
8012
  import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
@@ -8010,7 +8016,9 @@ function Drawer({
8010
8016
  width,
8011
8017
  backgroundColor,
8012
8018
  title,
8013
- children
8019
+ children,
8020
+ goBackIcon,
8021
+ goBackAction
8014
8022
  }) {
8015
8023
  if (!isOpen) return null;
8016
8024
  const drawerContainerRef = useRef4(null);
@@ -8064,7 +8072,10 @@ function Drawer({
8064
8072
  },
8065
8073
  children: [
8066
8074
  /* @__PURE__ */ jsxs7(DrawerHeaderDiv, { children: [
8067
- /* @__PURE__ */ jsx16(DrawerHeaderTitle, { children: title }),
8075
+ /* @__PURE__ */ jsxs7(Flex2, { gap: 8, children: [
8076
+ goBackIcon && goBackIcon && /* @__PURE__ */ jsx16(GoBackButtonStyled, { type: "button", onClick: goBackAction, children: goBackIcon }),
8077
+ /* @__PURE__ */ jsx16(DrawerHeaderTitle, { children: title })
8078
+ ] }),
8068
8079
  /* @__PURE__ */ jsx16(DrawerHeaderCloseButton, { onClick: onClose, children: /* @__PURE__ */ jsx16(Icon_default, { size: "xl", color: "$dark600", name: "xmark" }) })
8069
8080
  ] }),
8070
8081
  children
@@ -9281,9 +9292,9 @@ function Tooltip({
9281
9292
  ] }) });
9282
9293
  }
9283
9294
 
9284
- // src/components/MultiSelect.tsx
9295
+ // src/components/MultiSelect/index.tsx
9285
9296
  import React9, { useCallback as useCallback2, useRef as useRef7, useState as useState7 } from "react";
9286
- import { DropdownMenu as DropdownMenu3, Theme as Theme3 } from "@radix-ui/themes";
9297
+ import { DropdownMenu as DropdownMenu4, Theme as Theme3 } from "@radix-ui/themes";
9287
9298
  import { FontAwesomeIcon as FontAwesomeIcon3 } from "@fortawesome/react-fontawesome";
9288
9299
  import {
9289
9300
  faChevronDown as faChevronDown2,
@@ -9291,7 +9302,9 @@ import {
9291
9302
  faSquareXmark
9292
9303
  } from "@fortawesome/free-solid-svg-icons";
9293
9304
  import { useMemo } from "react";
9294
- import { Fragment as Fragment2, jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
9305
+
9306
+ // src/components/MultiSelect/styledComponents.ts
9307
+ import { DropdownMenu as DropdownMenu3 } from "@radix-ui/themes";
9295
9308
  var StyledContent = styled(DropdownMenu3.Content, {
9296
9309
  backgroundColor: "$dark50",
9297
9310
  borderRadius: "$sm",
@@ -9375,12 +9388,67 @@ var StyledFlexWithMaxHeight = styled(Flex2, {
9375
9388
  hasMaxHeight: false
9376
9389
  }
9377
9390
  });
9391
+ var StyledFlexSelectedItems = styled(Flex2, {
9392
+ overflowY: "auto",
9393
+ margin: "8px 0",
9394
+ "&::-webkit-scrollbar": {
9395
+ width: "4px"
9396
+ },
9397
+ "&::-webkit-scrollbar-track": {
9398
+ backgroundColor: "$dark100",
9399
+ borderRadius: "2px"
9400
+ },
9401
+ "&::-webkit-scrollbar-thumb": {
9402
+ backgroundColor: "$dark300",
9403
+ borderRadius: "2px",
9404
+ "&:hover": {
9405
+ backgroundColor: "$dark400"
9406
+ }
9407
+ }
9408
+ });
9378
9409
  var StyledText = styled(Text, {
9379
9410
  flex: 1,
9380
9411
  overflow: "hidden",
9381
9412
  whiteSpace: "nowrap",
9382
9413
  textOverflow: "ellipsis"
9383
9414
  });
9415
+ var ButtonSelectAllStyled = styled("button", {
9416
+ display: "flex !important",
9417
+ alignItems: "center",
9418
+ justifyContent: "flex-start",
9419
+ gap: "$8",
9420
+ border: "none",
9421
+ "div": {
9422
+ backgroundCcolor: "#fff",
9423
+ borderRadius: "2px",
9424
+ height: "$16",
9425
+ width: "$16",
9426
+ position: "relative",
9427
+ border: "2px solid $dark300",
9428
+ cursor: "pointer",
9429
+ boxSizing: "border-box",
9430
+ "&.checked::before": {
9431
+ backgroundImage: `url("data:image/svg+xml,%3Csvg%20width='16'%20height='16'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3E%3Cpath%20d='M2%200C0.896875%200%200%200.896875%200%202V12C0%2013.1031%200.896875%2014%202%2014H12C13.1031%2014%2014%2013.1031%2014%2012V2C14%200.896875%2013.1031%200%2012%200H2ZM10.5312%205.53125L6.53125%209.53125C6.2375%209.825%205.7625%209.825%205.47188%209.53125L3.47187%207.53125C3.17812%207.2375%203.17812%206.7625%203.47187%206.47188C3.76562%206.18125%204.24062%206.17813%204.53125%206.47188L6%207.94063L9.46875%204.46875C9.7625%204.175%2010.2375%204.175%2010.5281%204.46875C10.8187%204.7625%2010.8219%205.2375%2010.5281%205.52812L10.5312%205.53125Z'%20fill='%23004ED2'/%3E%3C/svg%3E")`,
9432
+ content: "",
9433
+ width: "1rem",
9434
+ height: "1rem",
9435
+ position: "absolute",
9436
+ top: "-1px",
9437
+ right: "-2px",
9438
+ zIndex: "2",
9439
+ backgroundRepeat: "no-repeat"
9440
+ }
9441
+ },
9442
+ "&:hover": {
9443
+ "div": {
9444
+ transition: "all 300ms ease-out",
9445
+ boxShadow: "rgba(56, 129, 255, 0.5) 0px 0px 0px 4px"
9446
+ }
9447
+ }
9448
+ });
9449
+
9450
+ // src/components/MultiSelect/index.tsx
9451
+ import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
9384
9452
  var MultiSelect = React9.forwardRef(
9385
9453
  ({
9386
9454
  placeholder,
@@ -9394,10 +9462,14 @@ var MultiSelect = React9.forwardRef(
9394
9462
  singleSelect = false,
9395
9463
  selectedOrientation = "column",
9396
9464
  disabled = false,
9397
- maxHeight
9465
+ maxHeight,
9466
+ selectedAllOptions = false,
9467
+ selectedAllText,
9468
+ selectedScroll = false
9398
9469
  }, fowardedRef) => {
9399
9470
  const [isOpen, setIsOpen] = useState7(false);
9400
9471
  const triggerRef = useRef7(null);
9472
+ const [allOptionsSelected, setAllOptionsSelected] = useState7(false);
9401
9473
  const labelByValue = useMemo(() => {
9402
9474
  return options.reduce((prev, curr) => {
9403
9475
  return __spreadProps(__spreadValues({}, prev), {
@@ -9412,6 +9484,21 @@ var MultiSelect = React9.forwardRef(
9412
9484
  },
9413
9485
  [selectedValues, onValueChange]
9414
9486
  );
9487
+ const handleSelectAll = useCallback2(
9488
+ (e) => {
9489
+ e.preventDefault();
9490
+ e.stopPropagation();
9491
+ const allSelected = selectedValues.length === options.length;
9492
+ if (allSelected) {
9493
+ onValueChange == null ? void 0 : onValueChange([]);
9494
+ setAllOptionsSelected(false);
9495
+ } else {
9496
+ onValueChange == null ? void 0 : onValueChange(options.map((o) => o.value));
9497
+ setAllOptionsSelected(true);
9498
+ }
9499
+ },
9500
+ [selectedValues, options, onValueChange]
9501
+ );
9415
9502
  const text = useMemo(() => {
9416
9503
  if (selectedValues.length > 0 && singleSelect) {
9417
9504
  const value = selectedValues[0];
@@ -9432,9 +9519,9 @@ var MultiSelect = React9.forwardRef(
9432
9519
  },
9433
9520
  [disabled]
9434
9521
  );
9435
- return /* @__PURE__ */ jsxs14(Theme3, { children: [
9436
- /* @__PURE__ */ jsxs14(DropdownMenu3.Root, { children: [
9437
- /* @__PURE__ */ jsx26(DropdownMenu3.Trigger, { children: /* @__PURE__ */ jsxs14(
9522
+ return /* @__PURE__ */ jsxs14(Theme3, { style: width !== "100%" ? { width } : void 0, children: [
9523
+ /* @__PURE__ */ jsxs14(DropdownMenu4.Root, { open: isOpen, onOpenChange: setIsOpen, children: [
9524
+ /* @__PURE__ */ jsx26(DropdownMenu4.Trigger, { children: /* @__PURE__ */ jsxs14(
9438
9525
  StyledTrigger,
9439
9526
  {
9440
9527
  ref: (r) => {
@@ -9442,9 +9529,7 @@ var MultiSelect = React9.forwardRef(
9442
9529
  triggerRef.current = r;
9443
9530
  if (fowardedRef) {
9444
9531
  if (typeof fowardedRef === "function") fowardedRef(r);
9445
- else {
9446
- fowardedRef.current = r;
9447
- }
9532
+ else fowardedRef.current = r;
9448
9533
  }
9449
9534
  },
9450
9535
  color,
@@ -9484,15 +9569,32 @@ var MultiSelect = React9.forwardRef(
9484
9569
  value: selectedValues,
9485
9570
  onValueChange: (v) => {
9486
9571
  onValueChange == null ? void 0 : onValueChange(v);
9572
+ if (allOptionsSelected) {
9573
+ setAllOptionsSelected(false);
9574
+ }
9487
9575
  },
9488
- children: /* @__PURE__ */ jsx26(
9576
+ children: /* @__PURE__ */ jsxs14(
9489
9577
  StyledFlexWithMaxHeight,
9490
9578
  {
9491
9579
  direction: "column",
9492
9580
  gap: 8,
9493
9581
  hasMaxHeight: !!maxHeight,
9494
9582
  style: maxHeight ? { maxHeight } : void 0,
9495
- children: options.map(({ value, label }, i) => /* @__PURE__ */ jsx26(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ jsx26(Text, { typography: "labelSmall", children: label }) }, i))
9583
+ children: [
9584
+ selectedAllOptions && /* @__PURE__ */ jsxs14(
9585
+ ButtonSelectAllStyled,
9586
+ {
9587
+ css: itemStyle,
9588
+ onClick: (e) => handleSelectAll(e),
9589
+ type: "button",
9590
+ children: [
9591
+ /* @__PURE__ */ jsx26("div", { className: allOptionsSelected ? "checked" : "" }),
9592
+ /* @__PURE__ */ jsx26(Text, { typography: "labelSmall", children: selectedAllText ? selectedAllText : "Selecionar Todos" })
9593
+ ]
9594
+ }
9595
+ ),
9596
+ options.map(({ value, label }, i) => /* @__PURE__ */ jsx26(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ jsx26(Text, { typography: "labelSmall", children: label }) }, i))
9597
+ ]
9496
9598
  }
9497
9599
  )
9498
9600
  }
@@ -9509,14 +9611,14 @@ var MultiSelect = React9.forwardRef(
9509
9611
  }
9510
9612
  )
9511
9613
  ] }),
9512
- selectedValues.length > 0 && showSelectedValues && /* @__PURE__ */ jsx26(Fragment2, { children: /* @__PURE__ */ jsx26(
9513
- Flex2,
9614
+ selectedValues.length > 0 && showSelectedValues && /* @__PURE__ */ jsx26(
9615
+ StyledFlexSelectedItems,
9514
9616
  {
9515
9617
  direction: selectedOrientation,
9516
9618
  gap: 8,
9517
9619
  align: selectedOrientation === "column" ? "start" : "center",
9518
9620
  justify: "start",
9519
- css: { margin: "8px 0" },
9621
+ css: __spreadValues({}, selectedScroll && { maxHeight: maxHeight || "400px" }),
9520
9622
  children: selectedValues.map((value) => /* @__PURE__ */ jsxs14(
9521
9623
  Flex2,
9522
9624
  {
@@ -9549,7 +9651,7 @@ var MultiSelect = React9.forwardRef(
9549
9651
  value
9550
9652
  ))
9551
9653
  }
9552
- ) })
9654
+ )
9553
9655
  ] });
9554
9656
  }
9555
9657
  );
@@ -10055,7 +10157,7 @@ var PhoneFormField = ({
10055
10157
  };
10056
10158
 
10057
10159
  // src/components/FormFields/CPFFormField.tsx
10058
- import { useFormContext as useFormContext4, useWatch } from "react-hook-form";
10160
+ import { useFormContext as useFormContext3, useWatch } from "react-hook-form";
10059
10161
  import { jsx as jsx37, jsxs as jsxs20 } from "react/jsx-runtime";
10060
10162
  var isValidCPF = (cpf) => {
10061
10163
  cpf = cpf.replace(/[^\d]+/g, "");
@@ -10080,7 +10182,7 @@ var CPFFormField = ({
10080
10182
  validationErrorMessage,
10081
10183
  foreignerLabel
10082
10184
  }) => {
10083
- const { control, setValue } = useFormContext4();
10185
+ const { control, setValue } = useFormContext3();
10084
10186
  const foreigner = useWatch({ name: "foreigner", control });
10085
10187
  return /* @__PURE__ */ jsxs20(Flex2, { direction: "column", children: [
10086
10188
  /* @__PURE__ */ jsx37(
@@ -10274,10 +10376,10 @@ var IdentityDocumentNumberFormField = ({
10274
10376
  };
10275
10377
 
10276
10378
  // src/components/FormFields/AddressFormFields/index.tsx
10277
- import { useFormContext as useFormContext7, useWatch as useWatch2, useFormState } from "react-hook-form";
10379
+ import { useFormContext as useFormContext6, useWatch as useWatch2, useFormState } from "react-hook-form";
10278
10380
 
10279
10381
  // src/components/FormFields/SelectFormField.tsx
10280
- import { useFormContext as useFormContext5, Controller } from "react-hook-form";
10382
+ import { useFormContext as useFormContext4, Controller } from "react-hook-form";
10281
10383
 
10282
10384
  // src/utils/getNestedValue.ts
10283
10385
  function getNestedValue(obj, path) {
@@ -10299,7 +10401,7 @@ var SelectFormField = ({
10299
10401
  const {
10300
10402
  control,
10301
10403
  formState: { errors }
10302
- } = useFormContext5();
10404
+ } = useFormContext4();
10303
10405
  const fieldError = getNestedValue(errors, name);
10304
10406
  const haveError = !!fieldError;
10305
10407
  const errorMsg = fieldError == null ? void 0 : fieldError.message;
@@ -10464,14 +10566,14 @@ var brazilianStates = [
10464
10566
  ];
10465
10567
 
10466
10568
  // src/components/FormFields/AddressFormFields/StateFormField.tsx
10467
- import { Fragment as Fragment3, jsx as jsx44 } from "react/jsx-runtime";
10569
+ import { Fragment as Fragment2, jsx as jsx44 } from "react/jsx-runtime";
10468
10570
  function StateFormField({
10469
10571
  name,
10470
10572
  label,
10471
10573
  required,
10472
10574
  isBrazil
10473
10575
  }) {
10474
- return /* @__PURE__ */ jsx44(Fragment3, { children: isBrazil ? /* @__PURE__ */ jsx44(
10576
+ return /* @__PURE__ */ jsx44(Fragment2, { children: isBrazil ? /* @__PURE__ */ jsx44(
10475
10577
  SelectFormField,
10476
10578
  {
10477
10579
  name,
@@ -10484,8 +10586,8 @@ function StateFormField({
10484
10586
 
10485
10587
  // src/components/FormFields/AddressFormFields/CityFormField.tsx
10486
10588
  import { useEffect as useEffect5, useState as useState8 } from "react";
10487
- import { useFormContext as useFormContext6, Controller as Controller2 } from "react-hook-form";
10488
- import { Fragment as Fragment4, jsx as jsx45 } from "react/jsx-runtime";
10589
+ import { useFormContext as useFormContext5, Controller as Controller2 } from "react-hook-form";
10590
+ import { Fragment as Fragment3, jsx as jsx45 } from "react/jsx-runtime";
10489
10591
  function CityFormField({
10490
10592
  name,
10491
10593
  label,
@@ -10494,7 +10596,7 @@ function CityFormField({
10494
10596
  isBrazil,
10495
10597
  placeholder
10496
10598
  }) {
10497
- const { control, watch } = useFormContext6();
10599
+ const { control, watch } = useFormContext5();
10498
10600
  const selectedState = watch(stateName);
10499
10601
  const [cities, setCities] = useState8([]);
10500
10602
  const [loading, setLoading] = useState8(false);
@@ -10537,7 +10639,7 @@ function CityFormField({
10537
10639
  }
10538
10640
  fetchCities();
10539
10641
  }, [selectedState, isBrazil]);
10540
- return /* @__PURE__ */ jsx45(Fragment4, { children: isBrazil && cities.length > 0 ? /* @__PURE__ */ jsx45(
10642
+ return /* @__PURE__ */ jsx45(Fragment3, { children: isBrazil && cities.length > 0 ? /* @__PURE__ */ jsx45(
10541
10643
  Controller2,
10542
10644
  {
10543
10645
  name,
@@ -10598,7 +10700,7 @@ function AddressFormFields({
10598
10700
  required,
10599
10701
  layout = "column"
10600
10702
  }) {
10601
- const { control, setValue } = useFormContext7();
10703
+ const { control, setValue } = useFormContext6();
10602
10704
  const { errors } = useFormState({ control });
10603
10705
  const selectedCountry = useWatch2({ control, name: `${name}.country` });
10604
10706
  const isBrazil = selectedCountry === "Brasil";
@@ -10697,7 +10799,7 @@ function AddressFormFields({
10697
10799
  }
10698
10800
 
10699
10801
  // src/components/FormFields/RadioGroupFormField.tsx
10700
- import { Controller as Controller3, useFormContext as useFormContext8 } from "react-hook-form";
10802
+ import { Controller as Controller3, useFormContext as useFormContext7 } from "react-hook-form";
10701
10803
  import { jsx as jsx47, jsxs as jsxs23 } from "react/jsx-runtime";
10702
10804
  var RadioGroupFormField = ({
10703
10805
  name,
@@ -10713,7 +10815,7 @@ var RadioGroupFormField = ({
10713
10815
  const {
10714
10816
  control,
10715
10817
  formState: { errors }
10716
- } = useFormContext8();
10818
+ } = useFormContext7();
10717
10819
  const fieldError = getNestedValue(errors, name);
10718
10820
  const haveError = !!fieldError;
10719
10821
  const errorMsg = fieldError == null ? void 0 : fieldError.message;
@@ -10758,7 +10860,7 @@ var RadioGroupFormField = ({
10758
10860
  };
10759
10861
 
10760
10862
  // src/components/FormFields/CheckboxGroupFormField.tsx
10761
- import { Controller as Controller4, useFormContext as useFormContext9 } from "react-hook-form";
10863
+ import { Controller as Controller4, useFormContext as useFormContext8 } from "react-hook-form";
10762
10864
  import { jsx as jsx48, jsxs as jsxs24 } from "react/jsx-runtime";
10763
10865
  var CheckboxGroupFormField = ({
10764
10866
  name,
@@ -10774,7 +10876,7 @@ var CheckboxGroupFormField = ({
10774
10876
  const {
10775
10877
  control,
10776
10878
  formState: { errors }
10777
- } = useFormContext9();
10879
+ } = useFormContext8();
10778
10880
  const fieldError = getNestedValue(errors, name);
10779
10881
  const haveError = !!fieldError;
10780
10882
  const errorMsg = fieldError == null ? void 0 : fieldError.message;
@@ -10826,7 +10928,7 @@ var CheckboxGroupFormField = ({
10826
10928
  };
10827
10929
 
10828
10930
  // src/components/FormFields/SwitchFormField.tsx
10829
- import { useFormContext as useFormContext10, Controller as Controller5 } from "react-hook-form";
10931
+ import { useFormContext as useFormContext9, Controller as Controller5 } from "react-hook-form";
10830
10932
  import { jsx as jsx49, jsxs as jsxs25 } from "react/jsx-runtime";
10831
10933
  var SwitchFormField = ({
10832
10934
  name,
@@ -10837,7 +10939,7 @@ var SwitchFormField = ({
10837
10939
  const {
10838
10940
  control,
10839
10941
  watch: watchForm
10840
- } = useFormContext10();
10942
+ } = useFormContext9();
10841
10943
  if (watch) {
10842
10944
  watchForm(name);
10843
10945
  }
@@ -12343,7 +12445,7 @@ var RichEditor_default = RichEditor;
12343
12445
 
12344
12446
  // src/components/FormFields/RichEditorFormField.tsx
12345
12447
  import { useState as useState11 } from "react";
12346
- import { Fragment as Fragment5, jsx as jsx53, jsxs as jsxs27 } from "react/jsx-runtime";
12448
+ import { Fragment as Fragment4, jsx as jsx53, jsxs as jsxs27 } from "react/jsx-runtime";
12347
12449
  var RichEditorFormField = (_a) => {
12348
12450
  var _b = _a, {
12349
12451
  name,
@@ -12394,7 +12496,7 @@ var RichEditorFormField = (_a) => {
12394
12496
  }
12395
12497
  ),
12396
12498
  /* @__PURE__ */ jsx53(Badge, { color: "grey", size: "xs", children: caracterQuantity })
12397
- ] }) : /* @__PURE__ */ jsx53(Fragment5, { children: label && /* @__PURE__ */ jsx53(
12499
+ ] }) : /* @__PURE__ */ jsx53(Fragment4, { children: label && /* @__PURE__ */ jsx53(
12398
12500
  FormLabel,
12399
12501
  {
12400
12502
  name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lets-events/react",
3
- "version": "12.1.13",
3
+ "version": "12.2.1",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -7,8 +7,10 @@ import {
7
7
  DrawerHeaderDiv,
8
8
  DrawerHeaderTitle,
9
9
  DrawerHeaderCloseButton,
10
+ GoBackButtonStyled,
10
11
  } from "./styledComponents";
11
12
  import { useOnClickOutside } from "../../hooks/useOnClickOutside";
13
+ import { Flex } from "../Flex";
12
14
 
13
15
  export type DrawerProps = ComponentProps<typeof DrawerOverlayStyled> & {
14
16
  isOpen: boolean;
@@ -17,6 +19,8 @@ export type DrawerProps = ComponentProps<typeof DrawerOverlayStyled> & {
17
19
  backgroundColor?: keyof Colors;
18
20
  title: string;
19
21
  children?: ReactNode;
22
+ goBackIcon?: ReactNode;
23
+ goBackAction: () => void;
20
24
  };
21
25
 
22
26
  export function Drawer({
@@ -26,6 +30,8 @@ export function Drawer({
26
30
  backgroundColor,
27
31
  title,
28
32
  children,
33
+ goBackIcon,
34
+ goBackAction
29
35
  }: DrawerProps) {
30
36
  if (!isOpen) return null;
31
37
  const drawerContainerRef = useRef<HTMLDivElement>(null);
@@ -117,7 +123,10 @@ export function Drawer({
117
123
  }}
118
124
  >
119
125
  <DrawerHeaderDiv>
120
- <DrawerHeaderTitle>{title}</DrawerHeaderTitle>
126
+ <Flex gap={8}>
127
+ {(goBackIcon && goBackIcon) && <GoBackButtonStyled type="button" onClick={goBackAction}>{goBackIcon}</GoBackButtonStyled>}
128
+ <DrawerHeaderTitle>{title}</DrawerHeaderTitle>
129
+ </Flex>
121
130
  <DrawerHeaderCloseButton onClick={onClose}>
122
131
  <Icon size={"xl"} color="$dark600" name="xmark" />
123
132
  </DrawerHeaderCloseButton>
@@ -44,3 +44,9 @@ export const DrawerHeaderCloseButton = styled("button", {
44
44
  border: "none",
45
45
  cursor: "pointer",
46
46
  });
47
+ export const GoBackButtonStyled = styled("button", {
48
+ background: "none",
49
+ padding: "0",
50
+ border: "none",
51
+ cursor: "pointer",
52
+ });
@@ -1,4 +1,4 @@
1
- import { useController, useFormContext } from "react-hook-form";
1
+ import { useController } from "react-hook-form";
2
2
  import { Flex } from "../Flex";
3
3
  import { FormLabel } from "./subComponents/FormLabel";
4
4
  import { ErrorFormMessage } from "./subComponents/ErrorFormMessage";