@lets-events/react 12.10.3 → 12.10.5

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 (96) hide show
  1. package/.eslintrc.json +2 -2
  2. package/.turbo/turbo-build.log +21 -19
  3. package/CHANGELOG.md +12 -0
  4. package/dist/index.d.mts +8 -3
  5. package/dist/index.d.ts +8 -3
  6. package/dist/index.js +187 -77
  7. package/dist/index.mjs +187 -77
  8. package/package.json +1 -1
  9. package/src/components/Alert.tsx +303 -303
  10. package/src/components/Avatar.tsx +55 -55
  11. package/src/components/Badge.tsx +123 -123
  12. package/src/components/Box.tsx +3 -3
  13. package/src/components/Button/index.tsx +74 -74
  14. package/src/components/Button/styledComponents.ts +361 -361
  15. package/src/components/ButtonGroup.tsx +484 -484
  16. package/src/components/Calendar/index.tsx +168 -168
  17. package/src/components/Calendar/styledComponents.ts +480 -480
  18. package/src/components/Card.tsx +67 -67
  19. package/src/components/CheckboxGroup.tsx +176 -176
  20. package/src/components/Container.tsx +39 -39
  21. package/src/components/Divider.tsx +7 -7
  22. package/src/components/DoubleCalendar/index.tsx +204 -182
  23. package/src/components/Drawer/index.tsx +103 -103
  24. package/src/components/Drawer/styledComponents.ts +97 -97
  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 +98 -98
  37. package/src/components/FormFields/CheckboxGroupFormField.tsx +91 -91
  38. package/src/components/FormFields/DateAndTimeFormField.tsx +217 -217
  39. package/src/components/FormFields/DoubleCalendarFormField.tsx +96 -96
  40. package/src/components/FormFields/EmailFormField.tsx +27 -27
  41. package/src/components/FormFields/Form.tsx +39 -39
  42. package/src/components/FormFields/IdentityDocumentNumberFormField.tsx +32 -32
  43. package/src/components/FormFields/MultiSelectFormField.tsx +64 -64
  44. package/src/components/FormFields/PhoneFormField.tsx +40 -40
  45. package/src/components/FormFields/RadioGroupFormField.tsx +86 -86
  46. package/src/components/FormFields/RichEditorFormField.tsx +105 -103
  47. package/src/components/FormFields/SelectFormField.tsx +113 -113
  48. package/src/components/FormFields/SwitchFormField.tsx +46 -46
  49. package/src/components/FormFields/TextAreaFormField.tsx +61 -61
  50. package/src/components/FormFields/TextFormField.tsx +112 -112
  51. package/src/components/FormFields/TimePickerFormField.tsx +88 -88
  52. package/src/components/FormFields/subComponents/ErrorFormMessage.tsx +36 -36
  53. package/src/components/FormFields/subComponents/FormLabel.tsx +36 -36
  54. package/src/components/FormFields/utils/validation.ts +23 -23
  55. package/src/components/Grid.tsx +137 -137
  56. package/src/components/Icon.tsx +47 -47
  57. package/src/components/MenuDropdown/index.tsx +38 -38
  58. package/src/components/MenuDropdown/styledComponents.ts +31 -31
  59. package/src/components/Modal.tsx +110 -110
  60. package/src/components/MultiSelect/index.tsx +305 -305
  61. package/src/components/MultiSelect/styledComponents.ts +160 -160
  62. package/src/components/RadioGroup.tsx +210 -210
  63. package/src/components/RichEditor/QuillComponent.tsx +415 -468
  64. package/src/components/RichEditor/RichEditor.tsx +53 -49
  65. package/src/components/RichEditor/RichTextPresenter.tsx +18 -18
  66. package/src/components/RichEditor/editorConfig.ts +149 -0
  67. package/src/components/RichEditor/index.ts +3 -3
  68. package/src/components/RichEditor/styledComponents.ts +1175 -1170
  69. package/src/components/RichEditor/types.ts +12 -0
  70. package/src/components/Section.tsx +33 -33
  71. package/src/components/Step.tsx +164 -164
  72. package/src/components/Switch.tsx +108 -108
  73. package/src/components/Text.tsx +38 -38
  74. package/src/components/TextField.tsx +372 -372
  75. package/src/components/TextareaField.tsx +116 -116
  76. package/src/components/TimePicker.tsx +357 -357
  77. package/src/components/Toast/components/ToastItem.tsx +41 -41
  78. package/src/components/Toast/components/ToastProvider.tsx +63 -63
  79. package/src/components/Toast/hooks/useToast.ts +12 -12
  80. package/src/components/Toast/index.tsx +5 -5
  81. package/src/components/Toast/styles/index.ts +135 -135
  82. package/src/components/Toast/types/index.ts +46 -46
  83. package/src/components/ToggleElement/index.tsx +58 -58
  84. package/src/components/Tooltip/index.tsx +73 -73
  85. package/src/components/Tooltip/styles.ts +77 -77
  86. package/src/hooks/useCountries.ts +41 -41
  87. package/src/hooks/useImageUpload.ts +139 -139
  88. package/src/hooks/useOnClickOutside.tsx +42 -42
  89. package/src/index.tsx +72 -72
  90. package/src/styles/index.ts +41 -41
  91. package/src/types/typographyValues.ts +178 -178
  92. package/src/utils/getNestedValue.ts +3 -3
  93. package/src/utils/states.ts +29 -29
  94. package/src/utils/uploadService.ts +180 -180
  95. package/tsconfig.json +3 -3
  96. package/tsup.config.ts +38 -38
package/dist/index.mjs CHANGED
@@ -8359,6 +8359,7 @@ function DoubleCalendar(_a) {
8359
8359
  var _b = _a, {
8360
8360
  action,
8361
8361
  actionText,
8362
+ simpleAction,
8362
8363
  calendarLayout,
8363
8364
  selected,
8364
8365
  setSelected,
@@ -8372,6 +8373,7 @@ function DoubleCalendar(_a) {
8372
8373
  } = _b, props = __objRest(_b, [
8373
8374
  "action",
8374
8375
  "actionText",
8376
+ "simpleAction",
8375
8377
  "calendarLayout",
8376
8378
  "selected",
8377
8379
  "setSelected",
@@ -8489,7 +8491,28 @@ function DoubleCalendar(_a) {
8489
8491
  children: actionText != null ? actionText : "Aplicar"
8490
8492
  }
8491
8493
  )
8492
- ] })
8494
+ ] }),
8495
+ simpleAction && /* @__PURE__ */ jsx16(CalendarFooterStyled, { children: /* @__PURE__ */ jsx16(
8496
+ "div",
8497
+ {
8498
+ style: { display: "flex", justifyContent: "center", padding: "1rem", width: "100%" },
8499
+ children: /* @__PURE__ */ jsx16(
8500
+ Button,
8501
+ {
8502
+ style: { margin: "0 0.5rem" },
8503
+ variant: "text",
8504
+ color: "brand",
8505
+ type: "button",
8506
+ onClick: () => {
8507
+ setShowCalendar(false);
8508
+ },
8509
+ size: "medium",
8510
+ fontWeight: "medium",
8511
+ children: actionText != null ? actionText : "Aplicar"
8512
+ }
8513
+ )
8514
+ }
8515
+ ) })
8493
8516
  ] })
8494
8517
  ] })) });
8495
8518
  }
@@ -12790,9 +12813,141 @@ var QuillEditor = styled("div", {
12790
12813
  // Container snow
12791
12814
  "& .ql-container.ql-snow": {
12792
12815
  border: "1px solid #ccc"
12816
+ },
12817
+ "& button.ql-list:first-child": {
12818
+ borderLeft: "1px solid #C2C3C7",
12819
+ paddingLeft: "16px",
12820
+ width: "38px"
12793
12821
  }
12794
12822
  });
12795
12823
 
12824
+ // src/components/RichEditor/editorConfig.ts
12825
+ var TEXT_FORMATS = ["bold", "italic", "underline"];
12826
+ var MEDIA_FORMATS = ["link", "image", "video"];
12827
+ var buildToolbarFromElements = (elements) => {
12828
+ const toolbar = [];
12829
+ if (elements.includes("header")) {
12830
+ toolbar.push([{ header: [1, 2, false] }]);
12831
+ }
12832
+ const textGroup = elements.filter(
12833
+ (element) => TEXT_FORMATS.includes(element)
12834
+ );
12835
+ if (textGroup.length > 0) {
12836
+ toolbar.push(textGroup);
12837
+ }
12838
+ const colorGroup = [];
12839
+ if (elements.includes("color")) colorGroup.push({ color: [] });
12840
+ if (elements.includes("background")) colorGroup.push({ background: [] });
12841
+ if (colorGroup.length > 0) {
12842
+ toolbar.push(colorGroup);
12843
+ }
12844
+ if (elements.includes("align")) {
12845
+ toolbar.push([{ align: [] }]);
12846
+ }
12847
+ if (elements.includes("list")) {
12848
+ toolbar.push([{ list: "ordered" }, { list: "bullet" }]);
12849
+ }
12850
+ const mediaGroup = elements.filter(
12851
+ (element) => MEDIA_FORMATS.includes(element)
12852
+ );
12853
+ if (mediaGroup.length > 0) {
12854
+ toolbar.push(mediaGroup);
12855
+ }
12856
+ return toolbar;
12857
+ };
12858
+ var buildFormatsFromElements = (elements) => elements;
12859
+ var getEditorModulesAndFormats = (richEditorElements, simpleVersion = false, disableVideo = false) => {
12860
+ const clipboard = { matchVisual: false };
12861
+ if (richEditorElements && richEditorElements.length > 0) {
12862
+ return {
12863
+ modules: {
12864
+ toolbar: buildToolbarFromElements(richEditorElements),
12865
+ clipboard
12866
+ },
12867
+ formats: buildFormatsFromElements(richEditorElements)
12868
+ };
12869
+ }
12870
+ if (simpleVersion) {
12871
+ return {
12872
+ modules: {
12873
+ toolbar: [
12874
+ [{ header: [1, 2, false] }],
12875
+ ["bold", "italic", "underline"],
12876
+ [{ color: [] }, { background: [] }],
12877
+ [{ align: [] }],
12878
+ [{ list: "ordered" }, { list: "bullet" }]
12879
+ ],
12880
+ clipboard
12881
+ },
12882
+ formats: [
12883
+ "header",
12884
+ "bold",
12885
+ "italic",
12886
+ "underline",
12887
+ "color",
12888
+ "background",
12889
+ "align",
12890
+ "list"
12891
+ ]
12892
+ };
12893
+ }
12894
+ if (disableVideo) {
12895
+ return {
12896
+ modules: {
12897
+ toolbar: [
12898
+ [{ header: [1, 2, false] }],
12899
+ ["bold", "italic", "underline", "strike"],
12900
+ [{ color: [] }, { background: [] }],
12901
+ [{ align: [] }],
12902
+ [{ list: "ordered" }, { list: "bullet" }],
12903
+ ["link", "image"]
12904
+ ],
12905
+ clipboard
12906
+ },
12907
+ formats: [
12908
+ "header",
12909
+ "bold",
12910
+ "italic",
12911
+ "underline",
12912
+ "strike",
12913
+ "color",
12914
+ "background",
12915
+ "align",
12916
+ "list",
12917
+ "link",
12918
+ "image"
12919
+ ]
12920
+ };
12921
+ }
12922
+ return {
12923
+ modules: {
12924
+ toolbar: [
12925
+ [{ header: [1, 2, false] }],
12926
+ ["bold", "italic", "underline", "strike"],
12927
+ [{ color: [] }, { background: [] }],
12928
+ [{ align: [] }],
12929
+ [{ list: "ordered" }, { list: "bullet" }],
12930
+ ["link", "image", "video"]
12931
+ ],
12932
+ clipboard
12933
+ },
12934
+ formats: [
12935
+ "header",
12936
+ "bold",
12937
+ "italic",
12938
+ "underline",
12939
+ "strike",
12940
+ "color",
12941
+ "background",
12942
+ "align",
12943
+ "list",
12944
+ "link",
12945
+ "image",
12946
+ "video"
12947
+ ]
12948
+ };
12949
+ };
12950
+
12796
12951
  // src/components/RichEditor/QuillComponent.tsx
12797
12952
  import { jsx as jsx53, jsxs as jsxs29 } from "react/jsx-runtime";
12798
12953
  var QuillComponent = ({
@@ -12804,6 +12959,7 @@ var QuillComponent = ({
12804
12959
  uploadConfig,
12805
12960
  simpleVersion = false,
12806
12961
  disableVideo = false,
12962
+ richEditorElements,
12807
12963
  onCharacterCountChange,
12808
12964
  maxLength
12809
12965
  }) => {
@@ -12819,65 +12975,11 @@ var QuillComponent = ({
12819
12975
  const doc = parser.parseFromString(html, "text/html");
12820
12976
  return doc.body.innerHTML;
12821
12977
  };
12822
- const modules = simpleVersion ? {
12823
- toolbar: [
12824
- [{ header: [1, 2, false] }],
12825
- ["bold", "italic", "underline"],
12826
- [{ color: [] }, { background: [] }],
12827
- [{ align: [] }],
12828
- [{ list: "ordered" }, { list: "bullet" }]
12829
- ],
12830
- clipboard: {
12831
- matchVisual: false
12832
- }
12833
- } : disableVideo ? {
12834
- toolbar: [
12835
- [{ header: [1, 2, false] }],
12836
- ["bold", "italic", "underline", "strike"],
12837
- [{ color: [] }, { background: [] }],
12838
- [{ align: [] }],
12839
- [{ list: "ordered" }, { list: "bullet" }],
12840
- ["link", "image"]
12841
- ],
12842
- clipboard: {
12843
- matchVisual: false
12844
- }
12845
- } : {
12846
- toolbar: [
12847
- [{ header: [1, 2, false] }],
12848
- ["bold", "italic", "underline", "strike"],
12849
- [{ color: [] }, { background: [] }],
12850
- [{ align: [] }],
12851
- [{ list: "ordered" }, { list: "bullet" }],
12852
- ["link", "image", "video"]
12853
- ],
12854
- clipboard: {
12855
- matchVisual: false
12856
- }
12857
- };
12858
- const formats = simpleVersion ? [
12859
- "header",
12860
- "bold",
12861
- "italic",
12862
- "underline",
12863
- "color",
12864
- "background",
12865
- "align",
12866
- "list"
12867
- ] : [
12868
- "header",
12869
- "bold",
12870
- "italic",
12871
- "underline",
12872
- "strike",
12873
- "color",
12874
- "background",
12875
- "align",
12876
- "list",
12877
- "link",
12878
- "image",
12879
- "video"
12880
- ];
12978
+ const { modules, formats } = getEditorModulesAndFormats(
12979
+ richEditorElements,
12980
+ simpleVersion,
12981
+ disableVideo
12982
+ );
12881
12983
  const { quill, quillRef } = useQuill({
12882
12984
  theme: "snow",
12883
12985
  modules,
@@ -12947,21 +13049,27 @@ var QuillComponent = ({
12947
13049
  });
12948
13050
  const toolbar = quill.getModule("toolbar");
12949
13051
  if (toolbar) {
12950
- toolbar.addHandler("link", () => setShowLinkModal(true));
12951
- toolbar.addHandler("video", () => setShowVideoModal(true));
12952
- toolbar.addHandler("image", () => {
12953
- const input = document.createElement("input");
12954
- input.setAttribute("type", "file");
12955
- input.setAttribute("accept", "image/*");
12956
- input.click();
12957
- input.onchange = () => __async(null, null, function* () {
12958
- var _a;
12959
- const file = (_a = input.files) == null ? void 0 : _a[0];
12960
- if (file) {
12961
- yield handleImageUpload(file);
12962
- }
13052
+ if (formats.includes("link")) {
13053
+ toolbar.addHandler("link", () => setShowLinkModal(true));
13054
+ }
13055
+ if (formats.includes("video")) {
13056
+ toolbar.addHandler("video", () => setShowVideoModal(true));
13057
+ }
13058
+ if (formats.includes("image")) {
13059
+ toolbar.addHandler("image", () => {
13060
+ const input = document.createElement("input");
13061
+ input.setAttribute("type", "file");
13062
+ input.setAttribute("accept", "image/*");
13063
+ input.click();
13064
+ input.onchange = () => __async(null, null, function* () {
13065
+ var _a;
13066
+ const file = (_a = input.files) == null ? void 0 : _a[0];
13067
+ if (file) {
13068
+ yield handleImageUpload(file);
13069
+ }
13070
+ });
12963
13071
  });
12964
- });
13072
+ }
12965
13073
  }
12966
13074
  setTimeout(() => {
12967
13075
  var _a, _b;
@@ -12985,7 +13093,7 @@ var QuillComponent = ({
12985
13093
  }
12986
13094
  }, 2e3);
12987
13095
  }
12988
- }, [quill, onChange, handleImageUpload, onCharacterCountChange]);
13096
+ }, [quill, onChange, handleImageUpload, onCharacterCountChange, formats]);
12989
13097
  useEffect9(() => {
12990
13098
  if (quill) {
12991
13099
  quill.enable(!disabled);
@@ -13249,7 +13357,8 @@ var RichEditorFormField = (_a) => {
13249
13357
  validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
13250
13358
  maxLength,
13251
13359
  simpleVersion = false,
13252
- disableVideo = false
13360
+ disableVideo = false,
13361
+ richEditorElements
13253
13362
  } = _b, props = __objRest(_b, [
13254
13363
  "name",
13255
13364
  "label",
@@ -13258,7 +13367,8 @@ var RichEditorFormField = (_a) => {
13258
13367
  "validationErrorMessage",
13259
13368
  "maxLength",
13260
13369
  "simpleVersion",
13261
- "disableVideo"
13370
+ "disableVideo",
13371
+ "richEditorElements"
13262
13372
  ]);
13263
13373
  const { field, fieldState } = useController3({
13264
13374
  name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lets-events/react",
3
- "version": "12.10.3",
3
+ "version": "12.10.5",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",