@lets-events/react 12.8.0 → 12.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.
- package/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +6 -0
- package/dist/index.js +22 -0
- package/dist/index.mjs +34 -12
- package/package.json +1 -1
- package/src/components/TimePicker.tsx +27 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @lets-events/react@12.8.
|
|
3
|
+
> @lets-events/react@12.8.1 build
|
|
4
4
|
> tsup src/index.tsx --format esm,cjs --dts --external react
|
|
5
5
|
|
|
6
6
|
[1G[0K[34mCLI[39m Building entry: src/index.tsx
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
[34mCLI[39m Target: es6
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m394.44 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 296ms
|
|
15
|
+
[32mCJS[39m [1mdist/index.js [22m[32m409.79 KB[39m
|
|
16
|
+
[32mCJS[39m ⚡️ Build success in 296ms
|
|
17
17
|
DTS Build start
|
|
18
|
-
DTS ⚡️ Build success in
|
|
18
|
+
DTS ⚡️ Build success in 6147ms
|
|
19
19
|
DTS dist/index.d.mts 403.74 KB
|
|
20
20
|
DTS dist/index.d.ts 403.74 KB
|
|
21
21
|
[1G[0K⠙[1G[0K
|
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -8616,6 +8616,21 @@ var TimePickerIconButton = styled(Button, {
|
|
|
8616
8616
|
padding: "0 !important"
|
|
8617
8617
|
});
|
|
8618
8618
|
var pad = (num) => String(num).padStart(2, "0");
|
|
8619
|
+
var parseTime = (value) => {
|
|
8620
|
+
if (!value) {
|
|
8621
|
+
return {
|
|
8622
|
+
parsedHours: "00",
|
|
8623
|
+
parsedMinutes: "00"
|
|
8624
|
+
};
|
|
8625
|
+
}
|
|
8626
|
+
const [hours, minutes] = value.split(":");
|
|
8627
|
+
const nextHours = Math.min(Math.max(parseInt(hours || "0", 10), 0), 23);
|
|
8628
|
+
const nextMinutes = Math.min(Math.max(parseInt(minutes || "0", 10), 0), 59);
|
|
8629
|
+
return {
|
|
8630
|
+
parsedHours: Number.isNaN(nextHours) ? "00" : pad(nextHours),
|
|
8631
|
+
parsedMinutes: Number.isNaN(nextMinutes) ? "00" : pad(nextMinutes)
|
|
8632
|
+
};
|
|
8633
|
+
};
|
|
8619
8634
|
function TimePicker({
|
|
8620
8635
|
selected,
|
|
8621
8636
|
setSelected,
|
|
@@ -8630,6 +8645,13 @@ function TimePicker({
|
|
|
8630
8645
|
const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
|
|
8631
8646
|
const dropdownRef = (0, import_react11.useRef)(null);
|
|
8632
8647
|
useOnClickOutside(dropdownRef, () => setIsOpen(false));
|
|
8648
|
+
(0, import_react11.useEffect)(() => {
|
|
8649
|
+
const { parsedHours, parsedMinutes } = parseTime(selected);
|
|
8650
|
+
setHours(parsedHours);
|
|
8651
|
+
setMinutes(parsedMinutes);
|
|
8652
|
+
setRawHours(parsedHours);
|
|
8653
|
+
setRawMinutes(parsedMinutes);
|
|
8654
|
+
}, [selected]);
|
|
8633
8655
|
const handleIncrement = (0, import_react11.useCallback)(
|
|
8634
8656
|
(type) => {
|
|
8635
8657
|
if (type === "hours") {
|
package/dist/index.mjs
CHANGED
|
@@ -8384,7 +8384,7 @@ function Drawer({
|
|
|
8384
8384
|
}
|
|
8385
8385
|
|
|
8386
8386
|
// src/components/TimePicker.tsx
|
|
8387
|
-
import { useCallback, useRef as useRef6, useState as useState4 } from "react";
|
|
8387
|
+
import { useCallback, useEffect as useEffect6, useRef as useRef6, useState as useState4 } from "react";
|
|
8388
8388
|
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
8389
8389
|
var TimePickerStyled = styled("div", {
|
|
8390
8390
|
position: "relative",
|
|
@@ -8500,6 +8500,21 @@ var TimePickerIconButton = styled(Button, {
|
|
|
8500
8500
|
padding: "0 !important"
|
|
8501
8501
|
});
|
|
8502
8502
|
var pad = (num) => String(num).padStart(2, "0");
|
|
8503
|
+
var parseTime = (value) => {
|
|
8504
|
+
if (!value) {
|
|
8505
|
+
return {
|
|
8506
|
+
parsedHours: "00",
|
|
8507
|
+
parsedMinutes: "00"
|
|
8508
|
+
};
|
|
8509
|
+
}
|
|
8510
|
+
const [hours, minutes] = value.split(":");
|
|
8511
|
+
const nextHours = Math.min(Math.max(parseInt(hours || "0", 10), 0), 23);
|
|
8512
|
+
const nextMinutes = Math.min(Math.max(parseInt(minutes || "0", 10), 0), 59);
|
|
8513
|
+
return {
|
|
8514
|
+
parsedHours: Number.isNaN(nextHours) ? "00" : pad(nextHours),
|
|
8515
|
+
parsedMinutes: Number.isNaN(nextMinutes) ? "00" : pad(nextMinutes)
|
|
8516
|
+
};
|
|
8517
|
+
};
|
|
8503
8518
|
function TimePicker({
|
|
8504
8519
|
selected,
|
|
8505
8520
|
setSelected,
|
|
@@ -8514,6 +8529,13 @@ function TimePicker({
|
|
|
8514
8529
|
const [isOpen, setIsOpen] = useState4(false);
|
|
8515
8530
|
const dropdownRef = useRef6(null);
|
|
8516
8531
|
useOnClickOutside(dropdownRef, () => setIsOpen(false));
|
|
8532
|
+
useEffect6(() => {
|
|
8533
|
+
const { parsedHours, parsedMinutes } = parseTime(selected);
|
|
8534
|
+
setHours(parsedHours);
|
|
8535
|
+
setMinutes(parsedMinutes);
|
|
8536
|
+
setRawHours(parsedHours);
|
|
8537
|
+
setRawMinutes(parsedMinutes);
|
|
8538
|
+
}, [selected]);
|
|
8517
8539
|
const handleIncrement = useCallback(
|
|
8518
8540
|
(type) => {
|
|
8519
8541
|
if (type === "hours") {
|
|
@@ -9247,7 +9269,7 @@ function Card(_a) {
|
|
|
9247
9269
|
|
|
9248
9270
|
// src/components/TextareaField.tsx
|
|
9249
9271
|
import { TextArea as TextAreaRadix } from "@radix-ui/themes";
|
|
9250
|
-
import React9, { useRef as useRef7, useState as useState5, useEffect as
|
|
9272
|
+
import React9, { useRef as useRef7, useState as useState5, useEffect as useEffect7 } from "react";
|
|
9251
9273
|
import { jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
9252
9274
|
var TextareaFieldStyle = styled(TextAreaRadix, {
|
|
9253
9275
|
display: "flex",
|
|
@@ -9302,7 +9324,7 @@ var TextareaField = React9.forwardRef((_a, forwardedRef) => {
|
|
|
9302
9324
|
var _b = _a, { maxLength, color, top = "-1.75rem" } = _b, props = __objRest(_b, ["maxLength", "color", "top"]);
|
|
9303
9325
|
const inputRef = useRef7(null);
|
|
9304
9326
|
const [remaining, setRemaining] = useState5(maxLength);
|
|
9305
|
-
|
|
9327
|
+
useEffect7(() => {
|
|
9306
9328
|
var _a2;
|
|
9307
9329
|
if (maxLength && inputRef.current) {
|
|
9308
9330
|
setRemaining(maxLength - ((_a2 = inputRef.current.value.length) != null ? _a2 : 0));
|
|
@@ -10938,7 +10960,7 @@ function StateFormField({
|
|
|
10938
10960
|
}
|
|
10939
10961
|
|
|
10940
10962
|
// src/components/FormFields/AddressFormFields/CityFormField.tsx
|
|
10941
|
-
import { useEffect as
|
|
10963
|
+
import { useEffect as useEffect8, useState as useState9 } from "react";
|
|
10942
10964
|
import { useFormContext as useFormContext5, Controller as Controller2 } from "react-hook-form";
|
|
10943
10965
|
import { Fragment as Fragment4, jsx as jsx46 } from "react/jsx-runtime";
|
|
10944
10966
|
function CityFormField({
|
|
@@ -10953,7 +10975,7 @@ function CityFormField({
|
|
|
10953
10975
|
const selectedState = watch(stateName);
|
|
10954
10976
|
const [cities, setCities] = useState9([]);
|
|
10955
10977
|
const [loading, setLoading] = useState9(false);
|
|
10956
|
-
|
|
10978
|
+
useEffect8(() => {
|
|
10957
10979
|
if (!isBrazil) {
|
|
10958
10980
|
setCities([]);
|
|
10959
10981
|
return;
|
|
@@ -11338,10 +11360,10 @@ var EmailFormField = ({
|
|
|
11338
11360
|
import { useController as useController3 } from "react-hook-form";
|
|
11339
11361
|
|
|
11340
11362
|
// src/components/RichEditor/RichEditor.tsx
|
|
11341
|
-
import { useEffect as
|
|
11363
|
+
import { useEffect as useEffect10, useState as useState11 } from "react";
|
|
11342
11364
|
|
|
11343
11365
|
// src/components/RichEditor/QuillComponent.tsx
|
|
11344
|
-
import { useState as useState10, useRef as useRef9, useEffect as
|
|
11366
|
+
import { useState as useState10, useRef as useRef9, useEffect as useEffect9, useCallback as useCallback4 } from "react";
|
|
11345
11367
|
import { useQuill } from "react-quilljs";
|
|
11346
11368
|
|
|
11347
11369
|
// src/utils/uploadService.ts
|
|
@@ -12521,7 +12543,7 @@ var QuillComponent = ({
|
|
|
12521
12543
|
}),
|
|
12522
12544
|
[disabled, quill, addToast, removeToast, uploadConfig, onChange]
|
|
12523
12545
|
);
|
|
12524
|
-
|
|
12546
|
+
useEffect9(() => {
|
|
12525
12547
|
if (quill && value) {
|
|
12526
12548
|
const currentContent = quill.root.innerHTML;
|
|
12527
12549
|
if (currentContent !== value) {
|
|
@@ -12535,7 +12557,7 @@ var QuillComponent = ({
|
|
|
12535
12557
|
}
|
|
12536
12558
|
}
|
|
12537
12559
|
}, [quill, value]);
|
|
12538
|
-
|
|
12560
|
+
useEffect9(() => {
|
|
12539
12561
|
if (quill) {
|
|
12540
12562
|
quill.on("text-change", (delta, oldDelta, source) => {
|
|
12541
12563
|
if (source === "user") {
|
|
@@ -12590,7 +12612,7 @@ var QuillComponent = ({
|
|
|
12590
12612
|
}, 2e3);
|
|
12591
12613
|
}
|
|
12592
12614
|
}, [quill, onChange, handleImageUpload, onCharacterCountChange]);
|
|
12593
|
-
|
|
12615
|
+
useEffect9(() => {
|
|
12594
12616
|
if (quill) {
|
|
12595
12617
|
quill.enable(!disabled);
|
|
12596
12618
|
if (!disabled) {
|
|
@@ -12657,7 +12679,7 @@ var QuillComponent = ({
|
|
|
12657
12679
|
setVideoUrl("");
|
|
12658
12680
|
setShowVideoModal(false);
|
|
12659
12681
|
}, [videoUrl, quill]);
|
|
12660
|
-
|
|
12682
|
+
useEffect9(() => {
|
|
12661
12683
|
const handleClickOutside = (event) => {
|
|
12662
12684
|
if (showVideoModal && videoModalRef.current && !videoModalRef.current.contains(event.target)) {
|
|
12663
12685
|
handleVideoCancel();
|
|
@@ -12820,7 +12842,7 @@ var QuillComponent_default = QuillComponent;
|
|
|
12820
12842
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
12821
12843
|
var RichEditor = (props) => {
|
|
12822
12844
|
const [isClient, setIsClient] = useState11(false);
|
|
12823
|
-
|
|
12845
|
+
useEffect10(() => {
|
|
12824
12846
|
setIsClient(typeof window !== "undefined");
|
|
12825
12847
|
}, []);
|
|
12826
12848
|
if (!isClient) return null;
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useRef, useState } from "react";
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
2
2
|
import { Box } from "./Box";
|
|
3
3
|
import { Button } from "./Button";
|
|
4
4
|
import { TextField, TextFieldSlot } from "./TextField";
|
|
@@ -134,6 +134,24 @@ export type TimePickerProps = {
|
|
|
134
134
|
};
|
|
135
135
|
const pad = (num: number) => String(num).padStart(2, "0");
|
|
136
136
|
|
|
137
|
+
const parseTime = (value?: string) => {
|
|
138
|
+
if (!value) {
|
|
139
|
+
return {
|
|
140
|
+
parsedHours: "00",
|
|
141
|
+
parsedMinutes: "00",
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const [hours, minutes] = value.split(":");
|
|
146
|
+
const nextHours = Math.min(Math.max(parseInt(hours || "0", 10), 0), 23);
|
|
147
|
+
const nextMinutes = Math.min(Math.max(parseInt(minutes || "0", 10), 0), 59);
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
parsedHours: Number.isNaN(nextHours) ? "00" : pad(nextHours),
|
|
151
|
+
parsedMinutes: Number.isNaN(nextMinutes) ? "00" : pad(nextMinutes),
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
|
|
137
155
|
export function TimePicker({
|
|
138
156
|
selected,
|
|
139
157
|
setSelected,
|
|
@@ -150,6 +168,14 @@ export function TimePicker({
|
|
|
150
168
|
|
|
151
169
|
useOnClickOutside(dropdownRef, () => setIsOpen(false));
|
|
152
170
|
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
const { parsedHours, parsedMinutes } = parseTime(selected);
|
|
173
|
+
setHours(parsedHours);
|
|
174
|
+
setMinutes(parsedMinutes);
|
|
175
|
+
setRawHours(parsedHours);
|
|
176
|
+
setRawMinutes(parsedMinutes);
|
|
177
|
+
}, [selected]);
|
|
178
|
+
|
|
153
179
|
const handleIncrement = useCallback(
|
|
154
180
|
(type: "hours" | "minutes") => {
|
|
155
181
|
if (type === "hours") {
|