@dafaz-ui/react 4.0.9 → 4.0.11

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.9 build
2
+ > @dafaz-ui/react@4.0.11 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
- ESM dist/index.mjs 19.64 KB
12
- ESM ⚡️ Build success in 34ms
13
- CJS dist/index.js 22.16 KB
14
- CJS ⚡️ Build success in 35ms
11
+ ESM dist/index.mjs 20.05 KB
12
+ ESM ⚡️ Build success in 41ms
13
+ CJS dist/index.js 22.58 KB
14
+ CJS ⚡️ Build success in 42ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 4427ms
17
- DTS dist/index.d.mts 103.73 KB
18
- DTS dist/index.d.ts 103.73 KB
16
+ DTS ⚡️ Build success in 4546ms
17
+ DTS dist/index.d.mts 103.69 KB
18
+ DTS dist/index.d.ts 103.69 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @dafaz-ui/react
2
2
 
3
+ ## 4.0.11
4
+
5
+ ### Patch Changes
6
+
7
+ - fix ref to Radio field
8
+
9
+ ## 4.0.10
10
+
11
+ ### Patch Changes
12
+
13
+ - fix key radio
14
+
3
15
  ## 4.0.9
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -663,14 +663,11 @@ interface CheckboxIUProps extends ComponentProps<typeof CheckBoxUI> {
663
663
  disabled?: boolean;
664
664
  }
665
665
 
666
- interface CheckboxProps {
666
+ interface CheckboxProps extends CheckboxIUProps {
667
667
  id: string;
668
668
  label: string;
669
669
  }
670
- declare function CheckBox({ id, label, size, disabled, ...props }: CheckboxIUProps & CheckboxProps): react_jsx_runtime.JSX.Element;
671
- declare namespace CheckBox {
672
- var displayName: string;
673
- }
670
+ declare const CheckBox: react.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
674
671
 
675
672
  declare const HeadingUI: _stitches_react_types_styled_component.StyledComponent<"h2", {
676
673
  mode?: "white" | "default" | undefined;
package/dist/index.d.ts CHANGED
@@ -663,14 +663,11 @@ interface CheckboxIUProps extends ComponentProps<typeof CheckBoxUI> {
663
663
  disabled?: boolean;
664
664
  }
665
665
 
666
- interface CheckboxProps {
666
+ interface CheckboxProps extends CheckboxIUProps {
667
667
  id: string;
668
668
  label: string;
669
669
  }
670
- declare function CheckBox({ id, label, size, disabled, ...props }: CheckboxIUProps & CheckboxProps): react_jsx_runtime.JSX.Element;
671
- declare namespace CheckBox {
672
- var displayName: string;
673
- }
670
+ declare const CheckBox: react.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
674
671
 
675
672
  declare const HeadingUI: _stitches_react_types_styled_component.StyledComponent<"h2", {
676
673
  mode?: "white" | "default" | undefined;
package/dist/index.js CHANGED
@@ -323,6 +323,9 @@ function Button(_a) {
323
323
  }
324
324
  Button.displayName = "Button";
325
325
 
326
+ // src/components/CheckBox/index.tsx
327
+ var import_react2 = require("react");
328
+
326
329
  // src/components/CheckBox/styles.ts
327
330
  var Checkbox = __toESM(require("@radix-ui/react-checkbox"));
328
331
  var CheckBoxUI = styled(Checkbox.Root, {
@@ -443,25 +446,46 @@ var Label = styled("label", {
443
446
  });
444
447
 
445
448
  // src/components/CheckBox/index.tsx
446
- var import_react2 = require("@phosphor-icons/react");
449
+ var import_react3 = require("@phosphor-icons/react");
447
450
  var import_jsx_runtime3 = require("react/jsx-runtime");
448
- function CheckBox(_a) {
449
- var _b = _a, {
450
- id,
451
- label,
452
- size,
453
- disabled = false
454
- } = _b, props = __objRest(_b, [
455
- "id",
456
- "label",
457
- "size",
458
- "disabled"
459
- ]);
460
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Label, { disabled, htmlFor: id, size, children: [
461
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckBoxUI, __spreadProps(__spreadValues({ disabled, id }, props), { size, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckBoxIndicator, { asChild: true, size, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react2.Check, { weight: "bold" }) }) })),
462
- label
463
- ] });
464
- }
451
+ var CheckBox = (0, import_react2.forwardRef)(
452
+ (_a, ref) => {
453
+ var _b = _a, {
454
+ id,
455
+ label,
456
+ size,
457
+ disabled = false,
458
+ checked,
459
+ onCheckedChange,
460
+ value
461
+ } = _b, props = __objRest(_b, [
462
+ "id",
463
+ "label",
464
+ "size",
465
+ "disabled",
466
+ "checked",
467
+ "onCheckedChange",
468
+ "value"
469
+ ]);
470
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Label, { disabled, htmlFor: id, size, children: [
471
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
472
+ CheckBoxUI,
473
+ __spreadProps(__spreadValues({
474
+ ref,
475
+ checked,
476
+ onCheckedChange,
477
+ disabled,
478
+ id,
479
+ size,
480
+ value
481
+ }, props), {
482
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckBoxIndicator, { asChild: true, size, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react3.Check, { weight: "bold" }) })
483
+ })
484
+ ),
485
+ label
486
+ ] });
487
+ }
488
+ );
465
489
  CheckBox.displayName = "CheckBox";
466
490
 
467
491
  // src/components/Heading/styles.ts
@@ -524,7 +548,7 @@ var RadioUI = styled(RadioGroup.Root, {
524
548
  });
525
549
 
526
550
  // src/components/Radio/RadioItem/index.tsx
527
- var import_react3 = require("@phosphor-icons/react");
551
+ var import_react4 = require("@phosphor-icons/react");
528
552
 
529
553
  // src/components/Radio/RadioItem/styles.ts
530
554
  var RadioGroup2 = __toESM(require("@radix-ui/react-radio-group"));
@@ -663,7 +687,7 @@ function RadioItem(_a) {
663
687
  "disabled"
664
688
  ]);
665
689
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(RadioItemContainer, { children: [
666
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RadioItemUI, __spreadProps(__spreadValues({ disabled, id }, props), { size, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RadioIndicator, { asChild: true, size, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react3.Check, { weight: "bold" }) }) })),
690
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RadioItemUI, __spreadProps(__spreadValues({ disabled, id }, props), { size, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RadioIndicator, { asChild: true, size, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react4.Check, { weight: "bold" }) }) })),
667
691
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Label2, { disabled, htmlFor: id, size, children: label })
668
692
  ] }, id);
669
693
  }
@@ -690,7 +714,8 @@ function Radio(_a) {
690
714
  value: item.value,
691
715
  size,
692
716
  disabled
693
- }
717
+ },
718
+ item.id
694
719
  );
695
720
  }) }));
696
721
  }
@@ -762,7 +787,7 @@ var OptionUI = styled("option", {
762
787
  });
763
788
 
764
789
  // src/components/Select/index.tsx
765
- var import_react4 = require("react");
790
+ var import_react5 = require("react");
766
791
  var import_jsx_runtime7 = require("react/jsx-runtime");
767
792
  function Select(_a) {
768
793
  var _b = _a, {
@@ -774,7 +799,7 @@ function Select(_a) {
774
799
  "placeholder",
775
800
  "items"
776
801
  ]);
777
- const [value, setValue] = (0, import_react4.useState)("");
802
+ const [value, setValue] = (0, import_react5.useState)("");
778
803
  function handleSelect(event) {
779
804
  setValue(() => {
780
805
  return event.target.value;
@@ -880,7 +905,7 @@ function TextArea(_a) {
880
905
  TextArea.displayName = "TextArea";
881
906
 
882
907
  // src/components/TextInput/index.tsx
883
- var import_react5 = require("react");
908
+ var import_react6 = require("react");
884
909
 
885
910
  // src/components/TextInput/styles.ts
886
911
  var InputContainer = styled("div", {
@@ -945,7 +970,7 @@ var Sufix = styled("span", {
945
970
 
946
971
  // src/components/TextInput/index.tsx
947
972
  var import_jsx_runtime10 = require("react/jsx-runtime");
948
- var TextInput = (0, import_react5.forwardRef)(
973
+ var TextInput = (0, import_react6.forwardRef)(
949
974
  (_a, ref) => {
950
975
  var _b = _a, {
951
976
  withShadow = false,
@@ -958,7 +983,7 @@ var TextInput = (0, import_react5.forwardRef)(
958
983
  "requiredText",
959
984
  "id"
960
985
  ]);
961
- const [hiddenOptional, setHiddenOptional] = (0, import_react5.useState)(required);
986
+ const [hiddenOptional, setHiddenOptional] = (0, import_react6.useState)(required);
962
987
  function handleOnChange(event) {
963
988
  if (!required) {
964
989
  if (event.target.value === "") {
package/dist/index.mjs CHANGED
@@ -274,6 +274,9 @@ function Button(_a) {
274
274
  }
275
275
  Button.displayName = "Button";
276
276
 
277
+ // src/components/CheckBox/index.tsx
278
+ import { forwardRef } from "react";
279
+
277
280
  // src/components/CheckBox/styles.ts
278
281
  import * as Checkbox from "@radix-ui/react-checkbox";
279
282
  var CheckBoxUI = styled(Checkbox.Root, {
@@ -396,23 +399,44 @@ var Label = styled("label", {
396
399
  // src/components/CheckBox/index.tsx
397
400
  import { Check } from "@phosphor-icons/react";
398
401
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
399
- function CheckBox(_a) {
400
- var _b = _a, {
401
- id,
402
- label,
403
- size,
404
- disabled = false
405
- } = _b, props = __objRest(_b, [
406
- "id",
407
- "label",
408
- "size",
409
- "disabled"
410
- ]);
411
- return /* @__PURE__ */ jsxs(Label, { disabled, htmlFor: id, size, children: [
412
- /* @__PURE__ */ jsx3(CheckBoxUI, __spreadProps(__spreadValues({ disabled, id }, props), { size, children: /* @__PURE__ */ jsx3(CheckBoxIndicator, { asChild: true, size, children: /* @__PURE__ */ jsx3(Check, { weight: "bold" }) }) })),
413
- label
414
- ] });
415
- }
402
+ var CheckBox = forwardRef(
403
+ (_a, ref) => {
404
+ var _b = _a, {
405
+ id,
406
+ label,
407
+ size,
408
+ disabled = false,
409
+ checked,
410
+ onCheckedChange,
411
+ value
412
+ } = _b, props = __objRest(_b, [
413
+ "id",
414
+ "label",
415
+ "size",
416
+ "disabled",
417
+ "checked",
418
+ "onCheckedChange",
419
+ "value"
420
+ ]);
421
+ return /* @__PURE__ */ jsxs(Label, { disabled, htmlFor: id, size, children: [
422
+ /* @__PURE__ */ jsx3(
423
+ CheckBoxUI,
424
+ __spreadProps(__spreadValues({
425
+ ref,
426
+ checked,
427
+ onCheckedChange,
428
+ disabled,
429
+ id,
430
+ size,
431
+ value
432
+ }, props), {
433
+ children: /* @__PURE__ */ jsx3(CheckBoxIndicator, { asChild: true, size, children: /* @__PURE__ */ jsx3(Check, { weight: "bold" }) })
434
+ })
435
+ ),
436
+ label
437
+ ] });
438
+ }
439
+ );
416
440
  CheckBox.displayName = "CheckBox";
417
441
 
418
442
  // src/components/Heading/styles.ts
@@ -641,7 +665,8 @@ function Radio(_a) {
641
665
  value: item.value,
642
666
  size,
643
667
  disabled
644
- }
668
+ },
669
+ item.id
645
670
  );
646
671
  }) }));
647
672
  }
@@ -832,7 +857,7 @@ TextArea.displayName = "TextArea";
832
857
 
833
858
  // src/components/TextInput/index.tsx
834
859
  import {
835
- forwardRef,
860
+ forwardRef as forwardRef2,
836
861
  useState as useState2
837
862
  } from "react";
838
863
 
@@ -899,7 +924,7 @@ var Sufix = styled("span", {
899
924
 
900
925
  // src/components/TextInput/index.tsx
901
926
  import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
902
- var TextInput = forwardRef(
927
+ var TextInput = forwardRef2(
903
928
  (_a, ref) => {
904
929
  var _b = _a, {
905
930
  withShadow = false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dafaz-ui/react",
3
- "version": "4.0.9",
3
+ "version": "4.0.11",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -1,28 +1,49 @@
1
+ import { forwardRef, type ElementRef } from 'react'
1
2
  import { CheckBoxIndicator, CheckBoxUI, Label, CheckboxIUProps } from './styles'
2
3
  import { Check } from '@phosphor-icons/react'
3
4
 
4
- interface CheckboxProps {
5
+ interface CheckboxProps extends CheckboxIUProps {
5
6
  id: string
6
7
  label: string
7
8
  }
8
9
 
9
- export function CheckBox({
10
- id,
11
- label,
12
- size,
13
- disabled = false,
14
- ...props
15
- }: CheckboxIUProps & CheckboxProps) {
16
- return (
17
- <Label disabled={disabled} htmlFor={id} size={size}>
18
- <CheckBoxUI disabled={disabled} id={id} {...props} size={size}>
19
- <CheckBoxIndicator asChild size={size}>
20
- <Check weight="bold" />
21
- </CheckBoxIndicator>
22
- </CheckBoxUI>
23
- {label}
24
- </Label>
25
- )
26
- }
10
+ export const CheckBox = forwardRef<
11
+ ElementRef<typeof CheckBoxUI>,
12
+ CheckboxProps
13
+ >(
14
+ (
15
+ {
16
+ id,
17
+ label,
18
+ size,
19
+ disabled = false,
20
+ checked,
21
+ onCheckedChange,
22
+ value,
23
+ ...props
24
+ }: CheckboxProps,
25
+ ref,
26
+ ) => {
27
+ return (
28
+ <Label disabled={disabled} htmlFor={id} size={size}>
29
+ <CheckBoxUI
30
+ ref={ref}
31
+ checked={checked}
32
+ onCheckedChange={onCheckedChange}
33
+ disabled={disabled}
34
+ id={id}
35
+ size={size}
36
+ value={value}
37
+ {...props}
38
+ >
39
+ <CheckBoxIndicator asChild size={size}>
40
+ <Check weight="bold" />
41
+ </CheckBoxIndicator>
42
+ </CheckBoxUI>
43
+ {label}
44
+ </Label>
45
+ )
46
+ },
47
+ )
27
48
 
28
49
  CheckBox.displayName = 'CheckBox'
@@ -22,6 +22,7 @@ export function Radio({
22
22
  {items.map((item) => {
23
23
  return (
24
24
  <RadioItem
25
+ key={item.id}
25
26
  id={item.id}
26
27
  label={item.label}
27
28
  value={item.value}