@dafaz-ui/react 4.0.17 → 4.0.18

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,5 +1,5 @@
1
1
 
2
- > @dafaz-ui/react@4.0.17 build
2
+ > @dafaz-ui/react@4.0.18 build
3
3
  > tsup src/index.tsx --format esm,cjs --dts --external react
4
4
 
5
5
  CLI Building entry: src/index.tsx
@@ -8,11 +8,11 @@
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- CJS dist/index.js 22.60 KB
12
- CJS ⚡️ Build success in 38ms
13
- ESM dist/index.mjs 20.08 KB
14
- ESM ⚡️ Build success in 38ms
11
+ ESM dist/index.mjs 20.31 KB
12
+ ESM ⚡️ Build success in 37ms
13
+ CJS dist/index.js 22.84 KB
14
+ CJS ⚡️ Build success in 37ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 4972ms
16
+ DTS ⚡️ Build success in 4493ms
17
17
  DTS dist/index.d.mts 103.82 KB
18
18
  DTS dist/index.d.ts 103.82 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @dafaz-ui/react
2
2
 
3
+ ## 4.0.18
4
+
5
+ ### Patch Changes
6
+
7
+ - fix checkbox value
8
+
3
9
  ## 4.0.17
4
10
 
5
11
  ### Patch Changes
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)(value);
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: checked ? 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(value);
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: checked ? 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] = useState("");
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 useState2
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] = useState2(required);
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@dafaz-ui/react",
3
- "version": "4.0.17",
3
+ "version": "4.0.18",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -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(value)
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={checked ? value : ''}
49
+ value={checkValue}
40
50
  {...props}
41
51
  >
42
52
  <CheckBoxIndicator asChild size={size}>