@lets-events/react 11.7.10 → 11.8.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.
Files changed (77) hide show
  1. package/.eslintrc.json +2 -2
  2. package/.turbo/turbo-build.log +18 -20
  3. package/CHANGELOG.md +3 -3
  4. package/dist/index.css +171 -0
  5. package/dist/index.d.mts +2 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +104 -76
  8. package/dist/index.mjs +110 -82
  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 +287 -287
  16. package/src/components/ButtonGroup.tsx +484 -484
  17. package/src/components/Calendar/index.tsx +136 -136
  18. package/src/components/Calendar/styledComponents.ts +209 -209
  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/Drawer/index.tsx +55 -55
  23. package/src/components/Drawer/styledComponents.ts +46 -46
  24. package/src/components/Dropdown.tsx +302 -302
  25. package/src/components/Filter.tsx +164 -164
  26. package/src/components/Flex.tsx +118 -118
  27. package/src/components/FormFields/AddressFormFields/CityFormField.tsx +111 -111
  28. package/src/components/FormFields/AddressFormFields/CountryFormField.tsx +33 -33
  29. package/src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx +39 -39
  30. package/src/components/FormFields/AddressFormFields/StateFormField.tsx +32 -32
  31. package/src/components/FormFields/AddressFormFields/index.tsx +141 -141
  32. package/src/components/FormFields/BirthDateFormField.tsx +84 -84
  33. package/src/components/FormFields/CNPJFormField.tsx +87 -87
  34. package/src/components/FormFields/CPFFormField.tsx +78 -78
  35. package/src/components/FormFields/CheckboxGroupFormField.tsx +91 -91
  36. package/src/components/FormFields/EmailFormField.tsx +27 -27
  37. package/src/components/FormFields/Form.tsx +39 -39
  38. package/src/components/FormFields/IdentityDocumentNumberFormField.tsx +40 -40
  39. package/src/components/FormFields/MultiSelectFormField.tsx +55 -55
  40. package/src/components/FormFields/PhoneFormField.tsx +40 -40
  41. package/src/components/FormFields/RadioGroupFormField.tsx +84 -84
  42. package/src/components/FormFields/SelectFormField.tsx +93 -93
  43. package/src/components/FormFields/TextAreaFormField.tsx +48 -48
  44. package/src/components/FormFields/TextFormField.tsx +112 -112
  45. package/src/components/FormFields/subComponents/ErrorFormMessage.tsx +36 -36
  46. package/src/components/FormFields/subComponents/FormLabel.tsx +29 -29
  47. package/src/components/FormFields/utils/validation.ts +23 -23
  48. package/src/components/Grid.tsx +137 -137
  49. package/src/components/Icon.tsx +47 -47
  50. package/src/components/MenuDropdown/index.tsx +38 -38
  51. package/src/components/MenuDropdown/styledComponents.ts +31 -31
  52. package/src/components/Modal.tsx +90 -90
  53. package/src/components/MultiSelect.tsx +252 -218
  54. package/src/components/RadioGroup.tsx +210 -210
  55. package/src/components/Section.tsx +33 -33
  56. package/src/components/Step.tsx +164 -164
  57. package/src/components/Switch.tsx +108 -108
  58. package/src/components/Text.tsx +38 -38
  59. package/src/components/TextField.tsx +365 -365
  60. package/src/components/TextareaField.tsx +128 -128
  61. package/src/components/TimePicker.tsx +298 -298
  62. package/src/components/Toast/components/ToastItem.tsx +41 -41
  63. package/src/components/Toast/components/ToastProvider.tsx +63 -63
  64. package/src/components/Toast/hooks/useToast.ts +12 -12
  65. package/src/components/Toast/index.tsx +5 -5
  66. package/src/components/Toast/styles/index.ts +135 -135
  67. package/src/components/Toast/types/index.ts +46 -46
  68. package/src/components/Tooltip/index.tsx +66 -66
  69. package/src/components/Tooltip/styles.ts +77 -77
  70. package/src/hooks/useCountries.ts +41 -41
  71. package/src/hooks/useOnClickOutside.tsx +20 -20
  72. package/src/index.tsx +54 -54
  73. package/src/styles/index.ts +38 -38
  74. package/src/types/typographyValues.ts +178 -178
  75. package/src/utils/getNestedValue.ts +3 -3
  76. package/src/utils/states.ts +29 -29
  77. package/tsconfig.json +3 -3
package/dist/index.mjs CHANGED
@@ -256,7 +256,7 @@ var require_react_is_development = __commonJS({
256
256
  var ContextProvider = REACT_PROVIDER_TYPE;
257
257
  var Element = REACT_ELEMENT_TYPE;
258
258
  var ForwardRef = REACT_FORWARD_REF_TYPE;
259
- var Fragment4 = REACT_FRAGMENT_TYPE;
259
+ var Fragment5 = REACT_FRAGMENT_TYPE;
260
260
  var Lazy = REACT_LAZY_TYPE;
261
261
  var Memo = REACT_MEMO_TYPE;
262
262
  var Portal = REACT_PORTAL_TYPE;
@@ -315,7 +315,7 @@ var require_react_is_development = __commonJS({
315
315
  exports.ContextProvider = ContextProvider;
316
316
  exports.Element = Element;
317
317
  exports.ForwardRef = ForwardRef;
318
- exports.Fragment = Fragment4;
318
+ exports.Fragment = Fragment5;
319
319
  exports.Lazy = Lazy;
320
320
  exports.Memo = Memo;
321
321
  exports.Portal = Portal;
@@ -9331,11 +9331,11 @@ import { FontAwesomeIcon as FontAwesomeIcon3 } from "@fortawesome/react-fontawes
9331
9331
  import {
9332
9332
  faChevronDown as faChevronDown2,
9333
9333
  faChevronUp as faChevronUp2,
9334
- faX
9334
+ faSquareXmark
9335
9335
  } from "@fortawesome/free-solid-svg-icons";
9336
9336
  import { useCallback as useCallback2, useMemo, useRef as useRef7, useState as useState6 } from "react";
9337
9337
  import React9 from "react";
9338
- import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
9338
+ import { Fragment as Fragment2, jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
9339
9339
  var StyledContent = styled(DropdownMenu3.Content, {
9340
9340
  backgroundColor: "$dark50",
9341
9341
  borderRadius: "$sm",
@@ -9374,29 +9374,21 @@ var itemStyle = {
9374
9374
  boxSizing: "border-box",
9375
9375
  backgroundColor: "$dark50",
9376
9376
  display: "block",
9377
+ cursor: "pointer",
9377
9378
  "&:hover": {
9378
9379
  backgroundColor: "$dark100"
9379
9380
  }
9380
9381
  };
9382
+ var StyledItem2 = styled("div", __spreadValues({}, itemStyle));
9381
9383
  var BadgeWrapper = styled("div", {
9382
9384
  flex: "1",
9383
9385
  display: "flex",
9384
- justifyContent: "start",
9385
- flexWrap: "wrap",
9386
- gap: "4px"
9386
+ gap: "4px",
9387
+ marginTop: "8px",
9388
+ flexDirection: "column"
9387
9389
  });
9388
9390
  var BadgeCloseBtn = styled("div", {
9389
- borderRadius: "100%",
9390
- width: "16px",
9391
- height: "16px",
9392
- minWidth: "16px",
9393
- minHeight: "16px",
9394
- display: "flex",
9395
- justifyContent: "center",
9396
- alignItems: "center",
9397
- "&:hover": {
9398
- backgroundColor: "$dark600"
9399
- }
9391
+ cursor: "pointer"
9400
9392
  });
9401
9393
  var MultiSelect = React9.forwardRef(
9402
9394
  ({
@@ -9406,7 +9398,9 @@ var MultiSelect = React9.forwardRef(
9406
9398
  options,
9407
9399
  color,
9408
9400
  width = "100%",
9409
- zIndex = "auto"
9401
+ zIndex = "auto",
9402
+ showSelectedValues = true,
9403
+ singleSelect = false
9410
9404
  }, fowardedRef) => {
9411
9405
  var _a;
9412
9406
  const [isOpen, setIsOpen] = useState6(false);
@@ -9426,72 +9420,106 @@ var MultiSelect = React9.forwardRef(
9426
9420
  [selectedValues, onValueChange]
9427
9421
  );
9428
9422
  const menuWidth = (_a = triggerRef.current) == null ? void 0 : _a.offsetWidth;
9429
- return /* @__PURE__ */ jsx26(Theme3, { children: /* @__PURE__ */ jsxs14(DropdownMenu3.Root, { open: isOpen, onOpenChange: () => setIsOpen(false), children: [
9430
- /* @__PURE__ */ jsx26(DropdownMenu3.Trigger, { onClick: () => setIsOpen(true), children: /* @__PURE__ */ jsxs14(
9431
- StyledTrigger,
9432
- {
9433
- css: {
9434
- width
9435
- },
9436
- ref: (r) => {
9437
- if (!r) return;
9438
- triggerRef.current = r;
9439
- if (fowardedRef) {
9440
- if (typeof fowardedRef === "function") fowardedRef(r);
9441
- else {
9442
- fowardedRef.current = r;
9423
+ const text = useMemo(() => {
9424
+ if (selectedValues.length > 0 && singleSelect) {
9425
+ const value = selectedValues[0];
9426
+ return labelByValue[value];
9427
+ }
9428
+ return placeholder != null ? placeholder : "Selecione";
9429
+ }, [selectedValues, placeholder, singleSelect]);
9430
+ const handleItemClick = (v) => {
9431
+ onValueChange == null ? void 0 : onValueChange([v]);
9432
+ setIsOpen(false);
9433
+ };
9434
+ return /* @__PURE__ */ jsxs14(Theme3, { children: [
9435
+ /* @__PURE__ */ jsxs14(DropdownMenu3.Root, { open: isOpen, onOpenChange: () => setIsOpen(false), children: [
9436
+ /* @__PURE__ */ jsx26(DropdownMenu3.Trigger, { onClick: () => setIsOpen(true), children: /* @__PURE__ */ jsxs14(
9437
+ StyledTrigger,
9438
+ {
9439
+ css: {
9440
+ width
9441
+ },
9442
+ ref: (r) => {
9443
+ if (!r) return;
9444
+ triggerRef.current = r;
9445
+ if (fowardedRef) {
9446
+ if (typeof fowardedRef === "function") fowardedRef(r);
9447
+ else {
9448
+ fowardedRef.current = r;
9449
+ }
9443
9450
  }
9444
- }
9445
- },
9446
- color,
9447
- children: [
9448
- selectedValues.length === 0 ? /* @__PURE__ */ jsx26(Text, { typography: "labelMedium", css: { flex: 1 }, children: placeholder != null ? placeholder : "Selecione" }) : /* @__PURE__ */ jsx26(BadgeWrapper, { children: selectedValues.map((value) => {
9449
- return /* @__PURE__ */ jsx26(Badge, { size: "sm", color: "dark", children: /* @__PURE__ */ jsxs14(Flex2, { justify: "between", align: "center", children: [
9450
- /* @__PURE__ */ jsx26(Text, { typography: "badgeSmall", color: "dark100", children: labelByValue[value] }),
9451
- /* @__PURE__ */ jsx26(
9452
- BadgeCloseBtn,
9453
- {
9454
- onClick: (e) => {
9455
- e.stopPropagation();
9456
- handleRemove(value);
9457
- },
9458
- role: "button",
9459
- children: /* @__PURE__ */ jsx26(FontAwesomeIcon3, { icon: faX, size: "xs" })
9460
- }
9461
- )
9462
- ] }) }, value);
9463
- }) }),
9464
- /* @__PURE__ */ jsx26(
9465
- FontAwesomeIcon3,
9451
+ },
9452
+ color,
9453
+ children: [
9454
+ /* @__PURE__ */ jsx26(
9455
+ Text,
9456
+ {
9457
+ typography: "labelMedium",
9458
+ css: {
9459
+ flex: 1,
9460
+ overflow: "hidden",
9461
+ whiteSpace: "nowrap",
9462
+ textOverflow: "ellipsis"
9463
+ },
9464
+ children: text
9465
+ }
9466
+ ),
9467
+ /* @__PURE__ */ jsx26(
9468
+ FontAwesomeIcon3,
9469
+ {
9470
+ icon: isOpen ? faChevronUp2 : faChevronDown2,
9471
+ size: "sm",
9472
+ color: colors.dark600
9473
+ }
9474
+ )
9475
+ ]
9476
+ }
9477
+ ) }),
9478
+ /* @__PURE__ */ jsx26(
9479
+ StyledContent,
9480
+ {
9481
+ css: {
9482
+ width: menuWidth ? menuWidth + "px" : width,
9483
+ zIndex
9484
+ },
9485
+ children: !singleSelect ? /* @__PURE__ */ jsx26(
9486
+ CheckboxGroup,
9466
9487
  {
9467
- icon: isOpen ? faChevronUp2 : faChevronDown2,
9468
- size: "sm",
9469
- color: colors.dark600
9488
+ value: selectedValues,
9489
+ onValueChange: (v) => {
9490
+ onValueChange == null ? void 0 : onValueChange(v);
9491
+ },
9492
+ children: /* @__PURE__ */ jsx26(Flex2, { direction: "column", gap: 8, children: options.map(({ value, label }, i) => /* @__PURE__ */ jsx26(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ jsx26(Text, { typography: "labelSmall", children: label }) }, i)) })
9470
9493
  }
9471
- )
9472
- ]
9473
- }
9474
- ) }),
9475
- /* @__PURE__ */ jsx26(
9476
- StyledContent,
9477
- {
9478
- css: {
9479
- width: menuWidth ? menuWidth + "px" : width,
9480
- zIndex
9481
- },
9482
- children: /* @__PURE__ */ jsx26(
9483
- CheckboxGroup,
9494
+ ) : /* @__PURE__ */ jsx26(Flex2, { direction: "column", gap: 8, children: options.map(({ value, label }, i) => /* @__PURE__ */ jsx26(StyledItem2, { onClick: () => handleItemClick(value), children: /* @__PURE__ */ jsx26(Text, { typography: "labelSmall", children: label }) }, i)) })
9495
+ }
9496
+ )
9497
+ ] }),
9498
+ selectedValues.length > 0 && showSelectedValues && /* @__PURE__ */ jsx26(Fragment2, { children: /* @__PURE__ */ jsx26(BadgeWrapper, { children: selectedValues.map((value) => {
9499
+ return /* @__PURE__ */ jsxs14(Flex2, { gap: 4, children: [
9500
+ /* @__PURE__ */ jsx26(
9501
+ BadgeCloseBtn,
9484
9502
  {
9485
- value: selectedValues,
9486
- onValueChange: (v) => {
9487
- onValueChange == null ? void 0 : onValueChange(v);
9503
+ onClick: (e) => {
9504
+ e.stopPropagation();
9505
+ handleRemove(value);
9488
9506
  },
9489
- children: /* @__PURE__ */ jsx26(Flex2, { direction: "column", gap: 8, children: options.map(({ value, label }, i) => /* @__PURE__ */ jsx26(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ jsx26(Text, { typography: "labelSmall", children: label }) }, i)) })
9507
+ role: "button",
9508
+ children: /* @__PURE__ */ jsx26(FontAwesomeIcon3, { icon: faSquareXmark, size: "sm" })
9509
+ }
9510
+ ),
9511
+ /* @__PURE__ */ jsx26(
9512
+ Text,
9513
+ {
9514
+ typography: "captionMedium",
9515
+ fontWeight: "regular",
9516
+ color: "dark600",
9517
+ children: labelByValue[value]
9490
9518
  }
9491
9519
  )
9492
- }
9493
- )
9494
- ] }) });
9520
+ ] });
9521
+ }) }) })
9522
+ ] });
9495
9523
  }
9496
9524
  );
9497
9525
 
@@ -10395,14 +10423,14 @@ var brazilianStates = [
10395
10423
  ];
10396
10424
 
10397
10425
  // src/components/FormFields/AddressFormFields/StateFormField.tsx
10398
- import { Fragment as Fragment2, jsx as jsx44 } from "react/jsx-runtime";
10426
+ import { Fragment as Fragment3, jsx as jsx44 } from "react/jsx-runtime";
10399
10427
  function StateFormField({
10400
10428
  name,
10401
10429
  label,
10402
10430
  required,
10403
10431
  isBrazil
10404
10432
  }) {
10405
- return /* @__PURE__ */ jsx44(Fragment2, { children: isBrazil ? /* @__PURE__ */ jsx44(
10433
+ return /* @__PURE__ */ jsx44(Fragment3, { children: isBrazil ? /* @__PURE__ */ jsx44(
10406
10434
  SelectFormField,
10407
10435
  {
10408
10436
  name,
@@ -10416,7 +10444,7 @@ function StateFormField({
10416
10444
  // src/components/FormFields/AddressFormFields/CityFormField.tsx
10417
10445
  import { useEffect as useEffect4, useState as useState7 } from "react";
10418
10446
  import { useFormContext as useFormContext6, Controller as Controller2 } from "react-hook-form";
10419
- import { Fragment as Fragment3, jsx as jsx45 } from "react/jsx-runtime";
10447
+ import { Fragment as Fragment4, jsx as jsx45 } from "react/jsx-runtime";
10420
10448
  function CityFormField({
10421
10449
  name,
10422
10450
  label,
@@ -10468,7 +10496,7 @@ function CityFormField({
10468
10496
  }
10469
10497
  fetchCities();
10470
10498
  }, [selectedState, isBrazil]);
10471
- return /* @__PURE__ */ jsx45(Fragment3, { children: isBrazil && cities.length > 0 ? /* @__PURE__ */ jsx45(
10499
+ return /* @__PURE__ */ jsx45(Fragment4, { children: isBrazil && cities.length > 0 ? /* @__PURE__ */ jsx45(
10472
10500
  Controller2,
10473
10501
  {
10474
10502
  name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lets-events/react",
3
- "version": "11.7.10",
3
+ "version": "11.8.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",