@dafaz-ui/react 4.0.17 → 4.0.19
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 +5 -5
- package/CHANGELOG.md +12 -0
- package/dist/index.js +10 -2
- package/dist/index.mjs +15 -7
- package/package.json +1 -1
- package/src/components/CheckBox/index.tsx +13 -3
package/.turbo/turbo-build.log
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
> @dafaz-ui/react@4.0.
|
2
|
+
> @dafaz-ui/react@4.0.19 build
|
3
3
|
> tsup src/index.tsx --format esm,cjs --dts --external react
|
4
4
|
|
5
5
|
[34mCLI[39m Building entry: src/index.tsx
|
@@ -8,11 +8,11 @@
|
|
8
8
|
[34mCLI[39m Target: es6
|
9
9
|
[34mESM[39m Build start
|
10
10
|
[34mCJS[39m Build start
|
11
|
-
[
|
12
|
-
[32mCJS[39m ⚡️ Build success in 38ms
|
13
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m20.08 KB[39m
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m20.33 KB[39m
|
14
12
|
[32mESM[39m ⚡️ Build success in 38ms
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m22.86 KB[39m
|
14
|
+
[32mCJS[39m ⚡️ Build success in 39ms
|
15
15
|
[34mDTS[39m Build start
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
16
|
+
[32mDTS[39m ⚡️ Build success in 4462ms
|
17
17
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m103.82 KB[39m
|
18
18
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m103.82 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
@@ -455,7 +455,7 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
455
455
|
label,
|
456
456
|
size,
|
457
457
|
disabled = false,
|
458
|
-
checked,
|
458
|
+
checked = false,
|
459
459
|
onCheckedChange,
|
460
460
|
value
|
461
461
|
} = _b, props = __objRest(_b, [
|
@@ -467,6 +467,14 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
467
467
|
"onCheckedChange",
|
468
468
|
"value"
|
469
469
|
]);
|
470
|
+
const [checkValue, setCheckValue] = (0, import_react2.useState)(checked ? value : void 0);
|
471
|
+
(0, import_react2.useEffect)(() => {
|
472
|
+
if (checked) {
|
473
|
+
setCheckValue(value);
|
474
|
+
} else {
|
475
|
+
setCheckValue(void 0);
|
476
|
+
}
|
477
|
+
}, [checked, value]);
|
470
478
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Label, { htmlFor: id, disabled, size, children: [
|
471
479
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
472
480
|
CheckBoxUI,
|
@@ -477,7 +485,7 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
477
485
|
disabled,
|
478
486
|
id,
|
479
487
|
size,
|
480
|
-
value:
|
488
|
+
value: checkValue
|
481
489
|
}, props), {
|
482
490
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckBoxIndicator, { asChild: true, size, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react3.Check, { weight: "bold" }) })
|
483
491
|
})
|
package/dist/index.mjs
CHANGED
@@ -275,7 +275,7 @@ function Button(_a) {
|
|
275
275
|
Button.displayName = "Button";
|
276
276
|
|
277
277
|
// src/components/CheckBox/index.tsx
|
278
|
-
import { forwardRef } from "react";
|
278
|
+
import { forwardRef, useEffect, useState } from "react";
|
279
279
|
|
280
280
|
// src/components/CheckBox/styles.ts
|
281
281
|
import * as Checkbox from "@radix-ui/react-checkbox";
|
@@ -406,7 +406,7 @@ var CheckBox = forwardRef(
|
|
406
406
|
label,
|
407
407
|
size,
|
408
408
|
disabled = false,
|
409
|
-
checked,
|
409
|
+
checked = false,
|
410
410
|
onCheckedChange,
|
411
411
|
value
|
412
412
|
} = _b, props = __objRest(_b, [
|
@@ -418,6 +418,14 @@ var CheckBox = forwardRef(
|
|
418
418
|
"onCheckedChange",
|
419
419
|
"value"
|
420
420
|
]);
|
421
|
+
const [checkValue, setCheckValue] = useState(checked ? value : void 0);
|
422
|
+
useEffect(() => {
|
423
|
+
if (checked) {
|
424
|
+
setCheckValue(value);
|
425
|
+
} else {
|
426
|
+
setCheckValue(void 0);
|
427
|
+
}
|
428
|
+
}, [checked, value]);
|
421
429
|
return /* @__PURE__ */ jsxs(Label, { htmlFor: id, disabled, size, children: [
|
422
430
|
/* @__PURE__ */ jsx3(
|
423
431
|
CheckBoxUI,
|
@@ -428,7 +436,7 @@ var CheckBox = forwardRef(
|
|
428
436
|
disabled,
|
429
437
|
id,
|
430
438
|
size,
|
431
|
-
value:
|
439
|
+
value: checkValue
|
432
440
|
}, props), {
|
433
441
|
children: /* @__PURE__ */ jsx3(CheckBoxIndicator, { asChild: true, size, children: /* @__PURE__ */ jsx3(Check, { weight: "bold" }) })
|
434
442
|
})
|
@@ -738,7 +746,7 @@ var OptionUI = styled("option", {
|
|
738
746
|
});
|
739
747
|
|
740
748
|
// src/components/Select/index.tsx
|
741
|
-
import { useState } from "react";
|
749
|
+
import { useState as useState2 } from "react";
|
742
750
|
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
743
751
|
function Select(_a) {
|
744
752
|
var _b = _a, {
|
@@ -750,7 +758,7 @@ function Select(_a) {
|
|
750
758
|
"placeholder",
|
751
759
|
"items"
|
752
760
|
]);
|
753
|
-
const [value, setValue] =
|
761
|
+
const [value, setValue] = useState2("");
|
754
762
|
function handleSelect(event) {
|
755
763
|
setValue(() => {
|
756
764
|
return event.target.value;
|
@@ -858,7 +866,7 @@ TextArea.displayName = "TextArea";
|
|
858
866
|
// src/components/TextInput/index.tsx
|
859
867
|
import {
|
860
868
|
forwardRef as forwardRef2,
|
861
|
-
useState as
|
869
|
+
useState as useState3
|
862
870
|
} from "react";
|
863
871
|
|
864
872
|
// src/components/TextInput/styles.ts
|
@@ -937,7 +945,7 @@ var TextInput = forwardRef2(
|
|
937
945
|
"requiredText",
|
938
946
|
"id"
|
939
947
|
]);
|
940
|
-
const [hiddenOptional, setHiddenOptional] =
|
948
|
+
const [hiddenOptional, setHiddenOptional] = useState3(required);
|
941
949
|
function handleOnChange(event) {
|
942
950
|
if (!required) {
|
943
951
|
if (event.target.value === "") {
|
package/package.json
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { forwardRef, type ElementRef } from 'react'
|
1
|
+
import { forwardRef, useEffect, useState, type ElementRef } from 'react'
|
2
2
|
import { CheckBoxIndicator, CheckBoxUI, Label, CheckboxIUProps } from './styles'
|
3
3
|
import { Check } from '@phosphor-icons/react'
|
4
4
|
|
@@ -20,13 +20,23 @@ export const CheckBox = forwardRef<
|
|
20
20
|
label,
|
21
21
|
size,
|
22
22
|
disabled = false,
|
23
|
-
checked,
|
23
|
+
checked = false,
|
24
24
|
onCheckedChange,
|
25
25
|
value,
|
26
26
|
...props
|
27
27
|
}: CheckboxProps,
|
28
28
|
ref,
|
29
29
|
) => {
|
30
|
+
const [checkValue, setCheckValue] = useState(checked ? value : undefined)
|
31
|
+
|
32
|
+
useEffect(() => {
|
33
|
+
if (checked) {
|
34
|
+
setCheckValue(value)
|
35
|
+
} else {
|
36
|
+
setCheckValue(undefined)
|
37
|
+
}
|
38
|
+
}, [checked, value])
|
39
|
+
|
30
40
|
return (
|
31
41
|
<Label htmlFor={id} disabled={disabled} size={size}>
|
32
42
|
<CheckBoxUI
|
@@ -36,7 +46,7 @@ export const CheckBox = forwardRef<
|
|
36
46
|
disabled={disabled}
|
37
47
|
id={id}
|
38
48
|
size={size}
|
39
|
-
value={
|
49
|
+
value={checkValue}
|
40
50
|
{...props}
|
41
51
|
>
|
42
52
|
<CheckBoxIndicator asChild size={size}>
|