@lets-events/react 12.1.1 → 12.1.3

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.1.1 build
3
+ > @lets-events/react@12.1.3 build
4
4
  > tsup src/index.tsx --format esm,cjs --dts --external react
5
5
 
6
6
  CLI Building entry: src/index.tsx
@@ -10,14 +10,12 @@
10
10
  CLI Target: es6
11
11
  ESM Build start
12
12
  CJS Build start
13
- CJS dist/index.css 27.00 KB
14
- CJS dist/index.js 363.99 KB
15
- CJS ⚡️ Build success in 564ms
16
- ESM dist/index.css 27.00 KB
17
13
  ESM dist/index.mjs 350.42 KB
18
- ESM ⚡️ Build success in 566ms
14
+ ESM ⚡️ Build success in 408ms
15
+ CJS dist/index.js 363.98 KB
16
+ CJS ⚡️ Build success in 409ms
19
17
  DTS Build start
20
- DTS ⚡️ Build success in 9573ms
21
- DTS dist/index.d.mts 379.16 KB
22
- DTS dist/index.d.ts 379.16 KB
18
+ DTS ⚡️ Build success in 7471ms
19
+ DTS dist/index.d.mts 379.14 KB
20
+ DTS dist/index.d.ts 379.14 KB
23
21
  ⠙
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @lets-events/react
2
2
 
3
+ ## 12.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - TextareaField maxLength control
8
+
9
+ ## 12.1.2
10
+
11
+ ### Patch Changes
12
+
13
+ - added quill
14
+
3
15
  ## 12.1.1
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -14344,7 +14344,6 @@ interface RichEditorProps {
14344
14344
  onChange?: (value: string) => void;
14345
14345
  placeholder?: string;
14346
14346
  label?: string;
14347
- required?: boolean;
14348
14347
  disabled?: boolean;
14349
14348
  className?: string;
14350
14349
  uploadConfig: UploadConfig$1;
package/dist/index.d.ts CHANGED
@@ -14344,7 +14344,6 @@ interface RichEditorProps {
14344
14344
  onChange?: (value: string) => void;
14345
14345
  placeholder?: string;
14346
14346
  label?: string;
14347
- required?: boolean;
14348
14347
  disabled?: boolean;
14349
14348
  className?: string;
14350
14349
  uploadConfig: UploadConfig$1;
package/dist/index.js CHANGED
@@ -9087,19 +9087,21 @@ var TextareaLimitIndicator = styled("div", {
9087
9087
  padding: "$4"
9088
9088
  }
9089
9089
  });
9090
- var TextareaField = import_react11.default.forwardRef((_a, fowardedRef) => {
9090
+ var TextareaField = import_react11.default.forwardRef((_a, forwardedRef) => {
9091
9091
  var _b = _a, { maxLength, color } = _b, props = __objRest(_b, ["maxLength", "color"]);
9092
9092
  const inputRef = (0, import_react11.useRef)(null);
9093
- const badgeRef = (0, import_react11.useRef)(null);
9094
- const updateCharCountBadge = () => {
9095
- var _a2, _b2;
9096
- if (!maxLength || !badgeRef.current) return;
9097
- const remainingChars = maxLength - ((_b2 = (_a2 = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a2.value.length) != null ? _b2 : 0);
9098
- badgeRef.current.textContent = String(remainingChars);
9099
- };
9093
+ const [remaining, setRemaining] = (0, import_react11.useState)(maxLength);
9094
+ (0, import_react11.useEffect)(() => {
9095
+ var _a2;
9096
+ if (maxLength && inputRef.current) {
9097
+ setRemaining(maxLength - ((_a2 = inputRef.current.value.length) != null ? _a2 : 0));
9098
+ }
9099
+ }, [maxLength]);
9100
9100
  const handleInput = (e) => {
9101
9101
  var _a2;
9102
- updateCharCountBadge();
9102
+ if (maxLength) {
9103
+ setRemaining(maxLength - e.currentTarget.value.length);
9104
+ }
9103
9105
  (_a2 = props.onInput) == null ? void 0 : _a2.call(props, e);
9104
9106
  };
9105
9107
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(TextareaContainer, { color, children: [
@@ -9110,18 +9112,16 @@ var TextareaField = import_react11.default.forwardRef((_a, fowardedRef) => {
9110
9112
  ref: (r) => {
9111
9113
  if (!r) return;
9112
9114
  inputRef.current = r;
9113
- if (fowardedRef) {
9114
- if (typeof fowardedRef === "function") fowardedRef(r);
9115
- else {
9116
- fowardedRef.current = r;
9117
- }
9115
+ if (forwardedRef) {
9116
+ if (typeof forwardedRef === "function") forwardedRef(r);
9117
+ else forwardedRef.current = r;
9118
9118
  }
9119
9119
  },
9120
9120
  onInput: handleInput,
9121
9121
  maxLength
9122
9122
  }, props)
9123
9123
  ),
9124
- maxLength && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TextareaLimitIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { typography: "badgeMedium", ref: badgeRef, children: maxLength }) })
9124
+ maxLength && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TextareaLimitIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { typography: "badgeMedium", children: remaining }) })
9125
9125
  ] });
9126
9126
  });
9127
9127
 
@@ -10953,6 +10953,7 @@ var import_react_hook_form11 = require("react-hook-form");
10953
10953
  // src/components/RichEditor/QuillComponent.tsx
10954
10954
  var import_react20 = require("react");
10955
10955
  var import_react_quilljs = require("react-quilljs");
10956
+ var import_quill_snow = require("quill/dist/quill.snow.css");
10956
10957
 
10957
10958
  // src/utils/uploadService.ts
10958
10959
  var generateUniqueFilename = (originalName) => {
package/dist/index.mjs CHANGED
@@ -8913,7 +8913,7 @@ function Card(_a) {
8913
8913
 
8914
8914
  // src/components/TextareaField.tsx
8915
8915
  import { TextArea as TextAreaRadix } from "@radix-ui/themes";
8916
- import React8, { useRef as useRef6 } from "react";
8916
+ import React8, { useRef as useRef6, useState as useState4, useEffect as useEffect4 } from "react";
8917
8917
  import { jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
8918
8918
  var TextareaFieldStyle = styled(TextAreaRadix, {
8919
8919
  display: "flex",
@@ -8978,19 +8978,21 @@ var TextareaLimitIndicator = styled("div", {
8978
8978
  padding: "$4"
8979
8979
  }
8980
8980
  });
8981
- var TextareaField = React8.forwardRef((_a, fowardedRef) => {
8981
+ var TextareaField = React8.forwardRef((_a, forwardedRef) => {
8982
8982
  var _b = _a, { maxLength, color } = _b, props = __objRest(_b, ["maxLength", "color"]);
8983
8983
  const inputRef = useRef6(null);
8984
- const badgeRef = useRef6(null);
8985
- const updateCharCountBadge = () => {
8986
- var _a2, _b2;
8987
- if (!maxLength || !badgeRef.current) return;
8988
- const remainingChars = maxLength - ((_b2 = (_a2 = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a2.value.length) != null ? _b2 : 0);
8989
- badgeRef.current.textContent = String(remainingChars);
8990
- };
8984
+ const [remaining, setRemaining] = useState4(maxLength);
8985
+ useEffect4(() => {
8986
+ var _a2;
8987
+ if (maxLength && inputRef.current) {
8988
+ setRemaining(maxLength - ((_a2 = inputRef.current.value.length) != null ? _a2 : 0));
8989
+ }
8990
+ }, [maxLength]);
8991
8991
  const handleInput = (e) => {
8992
8992
  var _a2;
8993
- updateCharCountBadge();
8993
+ if (maxLength) {
8994
+ setRemaining(maxLength - e.currentTarget.value.length);
8995
+ }
8994
8996
  (_a2 = props.onInput) == null ? void 0 : _a2.call(props, e);
8995
8997
  };
8996
8998
  return /* @__PURE__ */ jsxs10(TextareaContainer, { color, children: [
@@ -9001,23 +9003,21 @@ var TextareaField = React8.forwardRef((_a, fowardedRef) => {
9001
9003
  ref: (r) => {
9002
9004
  if (!r) return;
9003
9005
  inputRef.current = r;
9004
- if (fowardedRef) {
9005
- if (typeof fowardedRef === "function") fowardedRef(r);
9006
- else {
9007
- fowardedRef.current = r;
9008
- }
9006
+ if (forwardedRef) {
9007
+ if (typeof forwardedRef === "function") forwardedRef(r);
9008
+ else forwardedRef.current = r;
9009
9009
  }
9010
9010
  },
9011
9011
  onInput: handleInput,
9012
9012
  maxLength
9013
9013
  }, props)
9014
9014
  ),
9015
- maxLength && /* @__PURE__ */ jsx22(TextareaLimitIndicator, { children: /* @__PURE__ */ jsx22(Text, { typography: "badgeMedium", ref: badgeRef, children: maxLength }) })
9015
+ maxLength && /* @__PURE__ */ jsx22(TextareaLimitIndicator, { children: /* @__PURE__ */ jsx22(Text, { typography: "badgeMedium", children: remaining }) })
9016
9016
  ] });
9017
9017
  });
9018
9018
 
9019
9019
  // src/components/Toast/components/ToastItem.tsx
9020
- import { useState as useState4 } from "react";
9020
+ import { useState as useState5 } from "react";
9021
9021
 
9022
9022
  // src/components/Toast/styles/index.ts
9023
9023
  import { keyframes as keyframes2 } from "@stitches/react";
@@ -9148,7 +9148,7 @@ function ToastItem({
9148
9148
  toast,
9149
9149
  onRemove
9150
9150
  }) {
9151
- const [open, setOpen] = useState4(true);
9151
+ const [open, setOpen] = useState5(true);
9152
9152
  const handleOpenChange = (open2) => {
9153
9153
  setOpen(open2);
9154
9154
  if (!open2) {
@@ -9172,7 +9172,7 @@ function ToastItem({
9172
9172
  }
9173
9173
 
9174
9174
  // src/components/Toast/components/ToastProvider.tsx
9175
- import { createContext, useState as useState5 } from "react";
9175
+ import { createContext, useState as useState6 } from "react";
9176
9176
  import * as ToastPrimitive2 from "@radix-ui/react-toast";
9177
9177
  import { jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
9178
9178
  var ToastContext = createContext(null);
@@ -9182,7 +9182,7 @@ function ToastProvider({
9182
9182
  maxToasts = 5,
9183
9183
  swipeDirection = "right"
9184
9184
  }) {
9185
- const [toasts, setToasts] = useState5([]);
9185
+ const [toasts, setToasts] = useState6([]);
9186
9186
  const addToast = (toastData) => {
9187
9187
  const id = Math.random().toString(36).substr(2, 9);
9188
9188
  const newToast = __spreadProps(__spreadValues({
@@ -9278,7 +9278,7 @@ function Tooltip({
9278
9278
  }
9279
9279
 
9280
9280
  // src/components/MultiSelect.tsx
9281
- import React9, { useCallback as useCallback2, useRef as useRef7, useState as useState6 } from "react";
9281
+ import React9, { useCallback as useCallback2, useRef as useRef7, useState as useState7 } from "react";
9282
9282
  import { DropdownMenu as DropdownMenu3, Theme as Theme3 } from "@radix-ui/themes";
9283
9283
  import { FontAwesomeIcon as FontAwesomeIcon3 } from "@fortawesome/react-fontawesome";
9284
9284
  import {
@@ -9392,7 +9392,7 @@ var MultiSelect = React9.forwardRef(
9392
9392
  disabled = false,
9393
9393
  maxHeight
9394
9394
  }, fowardedRef) => {
9395
- const [isOpen, setIsOpen] = useState6(false);
9395
+ const [isOpen, setIsOpen] = useState7(false);
9396
9396
  const triggerRef = useRef7(null);
9397
9397
  const labelByValue = useMemo(() => {
9398
9398
  return options.reduce((prev, curr) => {
@@ -10484,7 +10484,7 @@ function StateFormField({
10484
10484
  }
10485
10485
 
10486
10486
  // src/components/FormFields/AddressFormFields/CityFormField.tsx
10487
- import { useEffect as useEffect4, useState as useState7 } from "react";
10487
+ import { useEffect as useEffect5, useState as useState8 } from "react";
10488
10488
  import { useFormContext as useFormContext6, Controller as Controller2 } from "react-hook-form";
10489
10489
  import { Fragment as Fragment4, jsx as jsx45 } from "react/jsx-runtime";
10490
10490
  function CityFormField({
@@ -10497,9 +10497,9 @@ function CityFormField({
10497
10497
  }) {
10498
10498
  const { control, watch } = useFormContext6();
10499
10499
  const selectedState = watch(stateName);
10500
- const [cities, setCities] = useState7([]);
10501
- const [loading, setLoading] = useState7(false);
10502
- useEffect4(() => {
10500
+ const [cities, setCities] = useState8([]);
10501
+ const [loading, setLoading] = useState8(false);
10502
+ useEffect5(() => {
10503
10503
  if (!isBrazil) {
10504
10504
  setCities([]);
10505
10505
  return;
@@ -10851,8 +10851,9 @@ var EmailFormField = ({
10851
10851
  import { useController as useController3 } from "react-hook-form";
10852
10852
 
10853
10853
  // src/components/RichEditor/QuillComponent.tsx
10854
- import { useState as useState8, useRef as useRef8, useEffect as useEffect5, useCallback as useCallback4 } from "react";
10854
+ import { useState as useState9, useRef as useRef8, useEffect as useEffect6, useCallback as useCallback4 } from "react";
10855
10855
  import { useQuill } from "react-quilljs";
10856
+ import "quill/dist/quill.snow.css";
10856
10857
 
10857
10858
  // src/utils/uploadService.ts
10858
10859
  var generateUniqueFilename = (originalName) => {
@@ -11054,10 +11055,10 @@ var QuillComponent = ({
11054
11055
  className,
11055
11056
  uploadConfig
11056
11057
  }) => {
11057
- const [showVideoModal, setShowVideoModal] = useState8(false);
11058
- const [videoUrl, setVideoUrl] = useState8("");
11059
- const [showLinkModal, setShowLinkModal] = useState8(false);
11060
- const [linkUrl, setLinkUrl] = useState8("");
11058
+ const [showVideoModal, setShowVideoModal] = useState9(false);
11059
+ const [videoUrl, setVideoUrl] = useState9("");
11060
+ const [showLinkModal, setShowLinkModal] = useState9(false);
11061
+ const [linkUrl, setLinkUrl] = useState9("");
11061
11062
  const videoModalRef = useRef8(null);
11062
11063
  const linkModalRef = useRef8(null);
11063
11064
  const { addToast, removeToast } = useToast();
@@ -11124,7 +11125,7 @@ var QuillComponent = ({
11124
11125
  }),
11125
11126
  [disabled, quill, addToast, removeToast, uploadConfig]
11126
11127
  );
11127
- useEffect5(() => {
11128
+ useEffect6(() => {
11128
11129
  if (quill && value) {
11129
11130
  const currentContent = quill.root.innerHTML;
11130
11131
  if (currentContent !== value) {
@@ -11138,7 +11139,7 @@ var QuillComponent = ({
11138
11139
  }
11139
11140
  }
11140
11141
  }, [quill, value]);
11141
- useEffect5(() => {
11142
+ useEffect6(() => {
11142
11143
  if (quill) {
11143
11144
  quill.on("text-change", (delta, oldDelta, source) => {
11144
11145
  if (source === "user") {
@@ -11187,7 +11188,7 @@ var QuillComponent = ({
11187
11188
  }, 2e3);
11188
11189
  }
11189
11190
  }, [quill, onChange, handleImageUpload]);
11190
- useEffect5(() => {
11191
+ useEffect6(() => {
11191
11192
  if (quill) {
11192
11193
  quill.enable(!disabled);
11193
11194
  if (!disabled) {
@@ -11252,7 +11253,7 @@ var QuillComponent = ({
11252
11253
  setVideoUrl("");
11253
11254
  setShowVideoModal(false);
11254
11255
  }, [videoUrl, quill]);
11255
- useEffect5(() => {
11256
+ useEffect6(() => {
11256
11257
  const handleClickOutside = (event) => {
11257
11258
  if (showVideoModal && videoModalRef.current && !videoModalRef.current.contains(event.target)) {
11258
11259
  handleVideoCancel();
@@ -11620,11 +11621,11 @@ var TimePickerFormField = (_a) => {
11620
11621
  };
11621
11622
 
11622
11623
  // src/hooks/useImageUpload.ts
11623
- import { useState as useState9, useCallback as useCallback7 } from "react";
11624
+ import { useState as useState10, useCallback as useCallback7 } from "react";
11624
11625
  var useImageUpload = (options) => {
11625
- const [isUploading, setIsUploading] = useState9(false);
11626
- const [progress, setProgress] = useState9(null);
11627
- const [error, setError] = useState9(null);
11626
+ const [isUploading, setIsUploading] = useState10(false);
11627
+ const [progress, setProgress] = useState10(null);
11628
+ const [error, setError] = useState10(null);
11628
11629
  const {
11629
11630
  onSuccess,
11630
11631
  onError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lets-events/react",
3
- "version": "12.1.1",
3
+ "version": "12.1.3",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -41,6 +41,7 @@
41
41
  "dotenv": "^17.2.1",
42
42
  "i18n-iso-countries": "^7.14.0",
43
43
  "npm": "^11.4.2",
44
+ "quill": "^2.0.3",
44
45
  "radix-ui": "^1.4.2",
45
46
  "react-day-picker": "^9.6.7",
46
47
  "react-hook-form": "^7.57.0",
@@ -19,7 +19,6 @@ export interface RichEditorProps {
19
19
  onChange?: (value: string) => void;
20
20
  placeholder?: string;
21
21
  label?: string;
22
- required?: boolean;
23
22
  disabled?: boolean;
24
23
  className?: string;
25
24
  uploadConfig: UploadConfig;
@@ -1,7 +1,6 @@
1
- import { TextArea as TextAreaRadix, Flex, Box } from "@radix-ui/themes";
1
+ import { TextArea as TextAreaRadix } from "@radix-ui/themes";
2
2
  import { styled } from "../styles";
3
- import React, { ComponentProps, useRef } from "react";
4
-
3
+ import React, { ComponentProps, useRef, useState, useEffect } from "react";
5
4
  import { typographyValues } from "../types/typographyValues";
6
5
  import { Text } from "./Text";
7
6
 
@@ -59,12 +58,6 @@ const TextareaContainer = styled("div", {
59
58
  },
60
59
  });
61
60
 
62
- export type TextareaFieldProps = Omit<
63
- ComponentProps<typeof TextareaFieldStyle>,
64
- "color"
65
- > &
66
- ComponentProps<typeof TextareaContainer>;
67
-
68
61
  const TextareaLimitIndicator = styled("div", {
69
62
  padding: "$12 $16",
70
63
  borderTop: "1px solid $neutral300",
@@ -80,21 +73,29 @@ const TextareaLimitIndicator = styled("div", {
80
73
  },
81
74
  });
82
75
 
76
+ export type TextareaFieldProps = Omit<
77
+ ComponentProps<typeof TextareaFieldStyle>,
78
+ "color"
79
+ > &
80
+ ComponentProps<typeof TextareaContainer>;
81
+
83
82
  export const TextareaField = React.forwardRef<
84
83
  HTMLTextAreaElement,
85
84
  TextareaFieldProps
86
- >(({ maxLength, color, ...props }, fowardedRef) => {
85
+ >(({ maxLength, color, ...props }, forwardedRef) => {
87
86
  const inputRef = useRef<HTMLTextAreaElement>(null);
88
- const badgeRef = useRef<HTMLSpanElement>(null);
87
+ const [remaining, setRemaining] = useState(maxLength);
89
88
 
90
- const updateCharCountBadge = () => {
91
- if (!maxLength || !badgeRef.current) return;
92
- const remainingChars = maxLength - (inputRef?.current?.value.length ?? 0);
93
- badgeRef.current.textContent = String(remainingChars);
94
- };
89
+ useEffect(() => {
90
+ if (maxLength && inputRef.current) {
91
+ setRemaining(maxLength - (inputRef.current.value.length ?? 0));
92
+ }
93
+ }, [maxLength]);
95
94
 
96
95
  const handleInput = (e: React.FormEvent<HTMLTextAreaElement>) => {
97
- updateCharCountBadge();
96
+ if (maxLength) {
97
+ setRemaining(maxLength - e.currentTarget.value.length);
98
+ }
98
99
  props.onInput?.(e);
99
100
  };
100
101
 
@@ -105,11 +106,9 @@ export const TextareaField = React.forwardRef<
105
106
  ref={(r) => {
106
107
  if (!r) return;
107
108
  inputRef.current = r;
108
- if (fowardedRef) {
109
- if (typeof fowardedRef === "function") fowardedRef(r);
110
- else {
111
- fowardedRef.current = r;
112
- }
109
+ if (forwardedRef) {
110
+ if (typeof forwardedRef === "function") forwardedRef(r);
111
+ else forwardedRef.current = r;
113
112
  }
114
113
  }}
115
114
  onInput={handleInput}
@@ -118,8 +117,8 @@ export const TextareaField = React.forwardRef<
118
117
  />
119
118
  {maxLength && (
120
119
  <TextareaLimitIndicator>
121
- <Text typography={"badgeMedium"} ref={badgeRef}>
122
- {maxLength}
120
+ <Text typography="badgeMedium">
121
+ {remaining}
123
122
  </Text>
124
123
  </TextareaLimitIndicator>
125
124
  )}