@lets-events/react 11.7.10 → 11.8.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.
Files changed (77) hide show
  1. package/.eslintrc.json +2 -2
  2. package/.turbo/turbo-build.log +18 -20
  3. package/CHANGELOG.md +8 -2
  4. package/dist/index.css +171 -0
  5. package/dist/index.d.mts +4 -0
  6. package/dist/index.d.ts +4 -0
  7. package/dist/index.js +122 -76
  8. package/dist/index.mjs +128 -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 +267 -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",
@@ -9362,6 +9362,12 @@ var StyledTrigger = styled("div", {
9362
9362
  error: {
9363
9363
  border: "1px solid $error400"
9364
9364
  }
9365
+ },
9366
+ disabled: {
9367
+ true: {
9368
+ cursor: "not-allowed",
9369
+ border: "1px solid $dark100"
9370
+ }
9365
9371
  }
9366
9372
  },
9367
9373
  defaultVariants: {
@@ -9374,29 +9380,21 @@ var itemStyle = {
9374
9380
  boxSizing: "border-box",
9375
9381
  backgroundColor: "$dark50",
9376
9382
  display: "block",
9383
+ cursor: "pointer",
9377
9384
  "&:hover": {
9378
9385
  backgroundColor: "$dark100"
9379
9386
  }
9380
9387
  };
9388
+ var StyledItem2 = styled("div", __spreadValues({}, itemStyle));
9381
9389
  var BadgeWrapper = styled("div", {
9382
9390
  flex: "1",
9383
9391
  display: "flex",
9384
- justifyContent: "start",
9385
- flexWrap: "wrap",
9386
- gap: "4px"
9392
+ gap: "4px",
9393
+ marginTop: "8px",
9394
+ flexDirection: "column"
9387
9395
  });
9388
9396
  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
- }
9397
+ cursor: "pointer"
9400
9398
  });
9401
9399
  var MultiSelect = React9.forwardRef(
9402
9400
  ({
@@ -9406,7 +9404,10 @@ var MultiSelect = React9.forwardRef(
9406
9404
  options,
9407
9405
  color,
9408
9406
  width = "100%",
9409
- zIndex = "auto"
9407
+ zIndex = "auto",
9408
+ showSelectedValues = true,
9409
+ singleSelect = false,
9410
+ disabled = false
9410
9411
  }, fowardedRef) => {
9411
9412
  var _a;
9412
9413
  const [isOpen, setIsOpen] = useState6(false);
@@ -9426,72 +9427,117 @@ var MultiSelect = React9.forwardRef(
9426
9427
  [selectedValues, onValueChange]
9427
9428
  );
9428
9429
  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;
9443
- }
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,
9430
+ const text = useMemo(() => {
9431
+ if (selectedValues.length > 0 && singleSelect) {
9432
+ const value = selectedValues[0];
9433
+ return labelByValue[value];
9434
+ }
9435
+ return placeholder != null ? placeholder : "Selecione";
9436
+ }, [selectedValues, placeholder, singleSelect]);
9437
+ const handleItemClick = (v) => {
9438
+ onValueChange == null ? void 0 : onValueChange([v]);
9439
+ setIsOpen(false);
9440
+ };
9441
+ return /* @__PURE__ */ jsxs14(Theme3, { children: [
9442
+ /* @__PURE__ */ jsxs14(DropdownMenu3.Root, { open: isOpen, onOpenChange: () => setIsOpen(false), children: [
9443
+ /* @__PURE__ */ jsx26(
9444
+ DropdownMenu3.Trigger,
9445
+ {
9446
+ onClick: () => {
9447
+ if (disabled) return;
9448
+ setIsOpen(true);
9449
+ },
9450
+ children: /* @__PURE__ */ jsxs14(
9451
+ StyledTrigger,
9466
9452
  {
9467
- icon: isOpen ? faChevronUp2 : faChevronDown2,
9468
- size: "sm",
9469
- color: colors.dark600
9453
+ css: {
9454
+ width
9455
+ },
9456
+ ref: (r) => {
9457
+ if (!r) return;
9458
+ triggerRef.current = r;
9459
+ if (fowardedRef) {
9460
+ if (typeof fowardedRef === "function") fowardedRef(r);
9461
+ else {
9462
+ fowardedRef.current = r;
9463
+ }
9464
+ }
9465
+ },
9466
+ color,
9467
+ disabled,
9468
+ children: [
9469
+ /* @__PURE__ */ jsx26(
9470
+ Text,
9471
+ {
9472
+ typography: "labelMedium",
9473
+ css: {
9474
+ flex: 1,
9475
+ overflow: "hidden",
9476
+ whiteSpace: "nowrap",
9477
+ textOverflow: "ellipsis"
9478
+ },
9479
+ color: disabled ? "dark400" : void 0,
9480
+ children: text
9481
+ }
9482
+ ),
9483
+ /* @__PURE__ */ jsx26(
9484
+ FontAwesomeIcon3,
9485
+ {
9486
+ icon: isOpen ? faChevronUp2 : faChevronDown2,
9487
+ size: "sm",
9488
+ color: disabled ? colors.dark400 : colors.dark600
9489
+ }
9490
+ )
9491
+ ]
9470
9492
  }
9471
9493
  )
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
+ }
9495
+ ),
9496
+ /* @__PURE__ */ jsx26(
9497
+ StyledContent,
9498
+ {
9499
+ css: {
9500
+ width: menuWidth ? menuWidth + "px" : width,
9501
+ zIndex
9502
+ },
9503
+ children: !singleSelect ? /* @__PURE__ */ jsx26(
9504
+ CheckboxGroup,
9505
+ {
9506
+ value: selectedValues,
9507
+ onValueChange: (v) => {
9508
+ onValueChange == null ? void 0 : onValueChange(v);
9509
+ },
9510
+ 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)) })
9511
+ }
9512
+ ) : /* @__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)) })
9513
+ }
9514
+ )
9515
+ ] }),
9516
+ selectedValues.length > 0 && showSelectedValues && /* @__PURE__ */ jsx26(Fragment2, { children: /* @__PURE__ */ jsx26(BadgeWrapper, { children: selectedValues.map((value) => {
9517
+ return /* @__PURE__ */ jsxs14(Flex2, { gap: 4, children: [
9518
+ /* @__PURE__ */ jsx26(
9519
+ BadgeCloseBtn,
9484
9520
  {
9485
- value: selectedValues,
9486
- onValueChange: (v) => {
9487
- onValueChange == null ? void 0 : onValueChange(v);
9521
+ onClick: (e) => {
9522
+ e.stopPropagation();
9523
+ handleRemove(value);
9488
9524
  },
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)) })
9525
+ role: "button",
9526
+ children: /* @__PURE__ */ jsx26(FontAwesomeIcon3, { icon: faSquareXmark, size: "sm" })
9527
+ }
9528
+ ),
9529
+ /* @__PURE__ */ jsx26(
9530
+ Text,
9531
+ {
9532
+ typography: "captionMedium",
9533
+ fontWeight: "regular",
9534
+ color: "dark600",
9535
+ children: labelByValue[value]
9490
9536
  }
9491
9537
  )
9492
- }
9493
- )
9494
- ] }) });
9538
+ ] });
9539
+ }) }) })
9540
+ ] });
9495
9541
  }
9496
9542
  );
9497
9543
 
@@ -10395,14 +10441,14 @@ var brazilianStates = [
10395
10441
  ];
10396
10442
 
10397
10443
  // src/components/FormFields/AddressFormFields/StateFormField.tsx
10398
- import { Fragment as Fragment2, jsx as jsx44 } from "react/jsx-runtime";
10444
+ import { Fragment as Fragment3, jsx as jsx44 } from "react/jsx-runtime";
10399
10445
  function StateFormField({
10400
10446
  name,
10401
10447
  label,
10402
10448
  required,
10403
10449
  isBrazil
10404
10450
  }) {
10405
- return /* @__PURE__ */ jsx44(Fragment2, { children: isBrazil ? /* @__PURE__ */ jsx44(
10451
+ return /* @__PURE__ */ jsx44(Fragment3, { children: isBrazil ? /* @__PURE__ */ jsx44(
10406
10452
  SelectFormField,
10407
10453
  {
10408
10454
  name,
@@ -10416,7 +10462,7 @@ function StateFormField({
10416
10462
  // src/components/FormFields/AddressFormFields/CityFormField.tsx
10417
10463
  import { useEffect as useEffect4, useState as useState7 } from "react";
10418
10464
  import { useFormContext as useFormContext6, Controller as Controller2 } from "react-hook-form";
10419
- import { Fragment as Fragment3, jsx as jsx45 } from "react/jsx-runtime";
10465
+ import { Fragment as Fragment4, jsx as jsx45 } from "react/jsx-runtime";
10420
10466
  function CityFormField({
10421
10467
  name,
10422
10468
  label,
@@ -10468,7 +10514,7 @@ function CityFormField({
10468
10514
  }
10469
10515
  fetchCities();
10470
10516
  }, [selectedState, isBrazil]);
10471
- return /* @__PURE__ */ jsx45(Fragment3, { children: isBrazil && cities.length > 0 ? /* @__PURE__ */ jsx45(
10517
+ return /* @__PURE__ */ jsx45(Fragment4, { children: isBrazil && cities.length > 0 ? /* @__PURE__ */ jsx45(
10472
10518
  Controller2,
10473
10519
  {
10474
10520
  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.1",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",