@lets-events/react 12.2.1 → 12.2.2

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.
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- > @lets-events/react@12.2.1 build
3
+ > @lets-events/react@12.2.2 build
4
4
  > tsup src/index.tsx --format esm,cjs --dts --external react
5
5
 
6
6
  CLI Building entry: src/index.tsx
@@ -10,12 +10,12 @@
10
10
  CLI Target: es6
11
11
  ESM Build start
12
12
  CJS Build start
13
- ESM dist/index.mjs 378.47 KB
14
- ESM ⚡️ Build success in 358ms
15
- CJS dist/index.js 392.42 KB
16
- CJS ⚡️ Build success in 360ms
13
+ ESM dist/index.mjs 379.06 KB
14
+ ESM ⚡️ Build success in 419ms
15
+ CJS dist/index.js 393.01 KB
16
+ CJS ⚡️ Build success in 420ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 7045ms
18
+ DTS ⚡️ Build success in 6505ms
19
19
  DTS dist/index.d.mts 389.04 KB
20
20
  DTS dist/index.d.ts 389.04 KB
21
21
  ⠙
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @lets-events/react
2
2
 
3
+ ## 12.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - RichEditor HTML Stylization
8
+
3
9
  ## 12.2.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -8183,7 +8183,7 @@ function Drawer({
8183
8183
  },
8184
8184
  children: [
8185
8185
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(DrawerHeaderDiv, { children: [
8186
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Flex2, { gap: 8, children: [
8186
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Flex2, { gap: 8, align: "center", children: [
8187
8187
  goBackIcon && goBackIcon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(GoBackButtonStyled, { type: "button", onClick: goBackAction, children: goBackIcon }),
8188
8188
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DrawerHeaderTitle, { children: title })
8189
8189
  ] }),
@@ -9466,8 +9466,10 @@ var itemStyle = {
9466
9466
  }
9467
9467
  };
9468
9468
  var StyledItem2 = styled("div", __spreadValues({}, itemStyle));
9469
- var BadgeCloseBtn = styled("div", {
9470
- cursor: "pointer"
9469
+ var CloseBtnStyled = styled("button", {
9470
+ cursor: "pointer",
9471
+ background: "none",
9472
+ border: "none"
9471
9473
  });
9472
9474
  var StyledFlexWithMaxHeight = styled(Flex2, {
9473
9475
  variants: {
@@ -9734,13 +9736,13 @@ var MultiSelect = import_react16.default.forwardRef(
9734
9736
  css: { flexWrap: "wrap" },
9735
9737
  children: [
9736
9738
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9737
- BadgeCloseBtn,
9739
+ CloseBtnStyled,
9738
9740
  {
9739
9741
  onClick: (e) => {
9740
9742
  e.stopPropagation();
9741
9743
  handleRemove(value);
9742
9744
  },
9743
- role: "button",
9745
+ type: "button",
9744
9746
  children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons3.faSquareXmark, size: "sm" })
9745
9747
  }
9746
9748
  ),
@@ -11308,7 +11310,8 @@ var QuillEditor = styled("div", {
11308
11310
  marginBottom: 0
11309
11311
  },
11310
11312
  "& h1": {
11311
- fontSize: "2em"
11313
+ fontSize: "2em",
11314
+ lineHeight: "2em!important"
11312
11315
  },
11313
11316
  "& h2": {
11314
11317
  fontSize: "1.5em"
@@ -12167,6 +12170,17 @@ var QuillComponent = ({
12167
12170
  const videoModalRef = (0, import_react20.useRef)(null);
12168
12171
  const linkModalRef = (0, import_react20.useRef)(null);
12169
12172
  const { addToast, removeToast } = useToast();
12173
+ const formatHTML = (html) => {
12174
+ const parser = new DOMParser();
12175
+ const doc = parser.parseFromString(html, "text/html");
12176
+ doc.querySelectorAll("h1").forEach((h1) => {
12177
+ h1.setAttribute("style", `${h1.getAttribute("style") || ""}line-height: 2em;`);
12178
+ });
12179
+ doc.querySelectorAll("img").forEach((img) => {
12180
+ img.setAttribute("style", `${img.getAttribute("style") || ""}max-width: 100%; height: auto; width: auto;`);
12181
+ });
12182
+ return doc.body.innerHTML;
12183
+ };
12170
12184
  const modules = simpleVersion ? {
12171
12185
  toolbar: [
12172
12186
  ["bold", "italic", "underline"],
@@ -12229,7 +12243,7 @@ var QuillComponent = ({
12229
12243
  const index = selection ? selection.index : quill.getLength();
12230
12244
  quill.insertEmbed(index, "image", uploadedFile.url);
12231
12245
  quill.setSelection(index + 1, 0);
12232
- onChange == null ? void 0 : onChange(quill.root.innerHTML);
12246
+ onChange == null ? void 0 : onChange(formatHTML(quill.root.innerHTML));
12233
12247
  } catch (error) {
12234
12248
  console.error("Erro no upload:", error);
12235
12249
  addToast({
@@ -12264,7 +12278,7 @@ var QuillComponent = ({
12264
12278
  quill.deleteText(maxLength, count - maxLength);
12265
12279
  return;
12266
12280
  }
12267
- onChange == null ? void 0 : onChange(quill.root.innerHTML);
12281
+ onChange == null ? void 0 : onChange(formatHTML(quill.root.innerHTML));
12268
12282
  onCharacterCountChange == null ? void 0 : onCharacterCountChange(count);
12269
12283
  }
12270
12284
  });
package/dist/index.mjs CHANGED
@@ -8072,7 +8072,7 @@ function Drawer({
8072
8072
  },
8073
8073
  children: [
8074
8074
  /* @__PURE__ */ jsxs7(DrawerHeaderDiv, { children: [
8075
- /* @__PURE__ */ jsxs7(Flex2, { gap: 8, children: [
8075
+ /* @__PURE__ */ jsxs7(Flex2, { gap: 8, align: "center", children: [
8076
8076
  goBackIcon && goBackIcon && /* @__PURE__ */ jsx16(GoBackButtonStyled, { type: "button", onClick: goBackAction, children: goBackIcon }),
8077
8077
  /* @__PURE__ */ jsx16(DrawerHeaderTitle, { children: title })
8078
8078
  ] }),
@@ -9359,8 +9359,10 @@ var itemStyle = {
9359
9359
  }
9360
9360
  };
9361
9361
  var StyledItem2 = styled("div", __spreadValues({}, itemStyle));
9362
- var BadgeCloseBtn = styled("div", {
9363
- cursor: "pointer"
9362
+ var CloseBtnStyled = styled("button", {
9363
+ cursor: "pointer",
9364
+ background: "none",
9365
+ border: "none"
9364
9366
  });
9365
9367
  var StyledFlexWithMaxHeight = styled(Flex2, {
9366
9368
  variants: {
@@ -9627,13 +9629,13 @@ var MultiSelect = React9.forwardRef(
9627
9629
  css: { flexWrap: "wrap" },
9628
9630
  children: [
9629
9631
  /* @__PURE__ */ jsx26(
9630
- BadgeCloseBtn,
9632
+ CloseBtnStyled,
9631
9633
  {
9632
9634
  onClick: (e) => {
9633
9635
  e.stopPropagation();
9634
9636
  handleRemove(value);
9635
9637
  },
9636
- role: "button",
9638
+ type: "button",
9637
9639
  children: /* @__PURE__ */ jsx26(FontAwesomeIcon3, { icon: faSquareXmark, size: "sm" })
9638
9640
  }
9639
9641
  ),
@@ -11206,7 +11208,8 @@ var QuillEditor = styled("div", {
11206
11208
  marginBottom: 0
11207
11209
  },
11208
11210
  "& h1": {
11209
- fontSize: "2em"
11211
+ fontSize: "2em",
11212
+ lineHeight: "2em!important"
11210
11213
  },
11211
11214
  "& h2": {
11212
11215
  fontSize: "1.5em"
@@ -12065,6 +12068,17 @@ var QuillComponent = ({
12065
12068
  const videoModalRef = useRef8(null);
12066
12069
  const linkModalRef = useRef8(null);
12067
12070
  const { addToast, removeToast } = useToast();
12071
+ const formatHTML = (html) => {
12072
+ const parser = new DOMParser();
12073
+ const doc = parser.parseFromString(html, "text/html");
12074
+ doc.querySelectorAll("h1").forEach((h1) => {
12075
+ h1.setAttribute("style", `${h1.getAttribute("style") || ""}line-height: 2em;`);
12076
+ });
12077
+ doc.querySelectorAll("img").forEach((img) => {
12078
+ img.setAttribute("style", `${img.getAttribute("style") || ""}max-width: 100%; height: auto; width: auto;`);
12079
+ });
12080
+ return doc.body.innerHTML;
12081
+ };
12068
12082
  const modules = simpleVersion ? {
12069
12083
  toolbar: [
12070
12084
  ["bold", "italic", "underline"],
@@ -12127,7 +12141,7 @@ var QuillComponent = ({
12127
12141
  const index = selection ? selection.index : quill.getLength();
12128
12142
  quill.insertEmbed(index, "image", uploadedFile.url);
12129
12143
  quill.setSelection(index + 1, 0);
12130
- onChange == null ? void 0 : onChange(quill.root.innerHTML);
12144
+ onChange == null ? void 0 : onChange(formatHTML(quill.root.innerHTML));
12131
12145
  } catch (error) {
12132
12146
  console.error("Erro no upload:", error);
12133
12147
  addToast({
@@ -12162,7 +12176,7 @@ var QuillComponent = ({
12162
12176
  quill.deleteText(maxLength, count - maxLength);
12163
12177
  return;
12164
12178
  }
12165
- onChange == null ? void 0 : onChange(quill.root.innerHTML);
12179
+ onChange == null ? void 0 : onChange(formatHTML(quill.root.innerHTML));
12166
12180
  onCharacterCountChange == null ? void 0 : onCharacterCountChange(count);
12167
12181
  }
12168
12182
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lets-events/react",
3
- "version": "12.2.1",
3
+ "version": "12.2.2",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -123,7 +123,7 @@ export function Drawer({
123
123
  }}
124
124
  >
125
125
  <DrawerHeaderDiv>
126
- <Flex gap={8}>
126
+ <Flex gap={8} align="center">
127
127
  {(goBackIcon && goBackIcon) && <GoBackButtonStyled type="button" onClick={goBackAction}>{goBackIcon}</GoBackButtonStyled>}
128
128
  <DrawerHeaderTitle>{title}</DrawerHeaderTitle>
129
129
  </Flex>
@@ -11,7 +11,7 @@ import {
11
11
  import { colors } from "@lets-events/tokens";
12
12
  import { ComponentProps, useMemo } from "react";
13
13
  import { Flex } from "../Flex";
14
- import { BadgeCloseBtn, ButtonSelectAllStyled, itemStyle, StyledContent, StyledFlexSelectedItems, StyledFlexWithMaxHeight, StyledItem, StyledText, StyledTrigger } from "./styledComponents";
14
+ import { CloseBtnStyled, ButtonSelectAllStyled, itemStyle, StyledContent, StyledFlexSelectedItems, StyledFlexWithMaxHeight, StyledItem, StyledText, StyledTrigger } from "./styledComponents";
15
15
 
16
16
  export type MultiSelectProps = ComponentProps<typeof StyledTrigger> & {
17
17
  placeholder?: string;
@@ -217,15 +217,15 @@ export const MultiSelect = React.forwardRef<HTMLDivElement, MultiSelectProps>(
217
217
  align={"center"}
218
218
  css={{ flexWrap: "wrap" }}
219
219
  >
220
- <BadgeCloseBtn
220
+ <CloseBtnStyled
221
221
  onClick={(e) => {
222
222
  e.stopPropagation();
223
223
  handleRemove(value);
224
224
  }}
225
- role="button"
225
+ type="button"
226
226
  >
227
227
  <FontAwesomeIcon icon={faSquareXmark} size="sm" />
228
- </BadgeCloseBtn>
228
+ </CloseBtnStyled>
229
229
  <Text
230
230
  typography={"captionMedium"}
231
231
  fontWeight={"regular"}
@@ -67,8 +67,10 @@ export const StyledItem = styled("div", {
67
67
  ...itemStyle,
68
68
  });
69
69
 
70
- export const BadgeCloseBtn = styled("div", {
70
+ export const CloseBtnStyled = styled("button", {
71
71
  cursor: "pointer",
72
+ background: "none",
73
+ border: "none",
72
74
  });
73
75
 
74
76
  export const StyledFlexWithMaxHeight = styled(Flex, {
@@ -26,7 +26,20 @@ const QuillComponent: React.FC<RichEditorProps> = ({
26
26
  const videoModalRef = useRef<HTMLDivElement>(null);
27
27
  const linkModalRef = useRef<HTMLDivElement>(null);
28
28
  const { addToast, removeToast } = useToast();
29
+ const formatHTML = (html: string) => {
30
+ const parser = new DOMParser();
31
+ const doc = parser.parseFromString(html, "text/html");
29
32
 
33
+ doc.querySelectorAll("h1").forEach((h1) => {
34
+ h1.setAttribute("style", `${h1.getAttribute("style") || ""}line-height: 2em;`);
35
+ });
36
+
37
+ doc.querySelectorAll("img").forEach((img) => {
38
+ img.setAttribute("style", `${img.getAttribute("style") || ""}max-width: 100%; height: auto; width: auto;`);
39
+ });
40
+
41
+ return doc.body.innerHTML;
42
+ };
30
43
  const modules = simpleVersion
31
44
  ? {
32
45
  toolbar: [
@@ -99,7 +112,7 @@ const QuillComponent: React.FC<RichEditorProps> = ({
99
112
  const index = selection ? selection.index : quill.getLength();
100
113
  quill.insertEmbed(index, "image", uploadedFile.url);
101
114
  quill.setSelection(index + 1, 0);
102
- onChange?.(quill.root.innerHTML);
115
+ onChange?.(formatHTML(quill.root.innerHTML));
103
116
  } catch (error) {
104
117
  console.error("Erro no upload:", error);
105
118
  addToast({
@@ -132,15 +145,15 @@ const QuillComponent: React.FC<RichEditorProps> = ({
132
145
  if (quill) {
133
146
  quill.on("text-change", (delta: any, oldDelta: any, source: string) => {
134
147
  if (source === "user") {
135
- const text = quill.getText().trim();
136
- const count = text.length;
148
+ const text = quill.getText().trim()
149
+ const count = text.length
137
150
 
138
151
  if (maxLength !== undefined && count > maxLength) {
139
- quill.deleteText(maxLength, count - maxLength);
140
- return;
152
+ quill.deleteText(maxLength, count - maxLength)
153
+ return
141
154
  }
142
- onChange?.(quill.root.innerHTML);
143
- onCharacterCountChange?.(count);
155
+ onChange?.(formatHTML(quill.root.innerHTML))
156
+ onCharacterCountChange?.(count)
144
157
  }
145
158
  });
146
159
 
@@ -89,6 +89,7 @@ export const QuillEditor = styled("div", {
89
89
 
90
90
  "& h1": {
91
91
  fontSize: "2em",
92
+ lineHeight: '2em!important',
92
93
  },
93
94
 
94
95
  "& h2": {