@dafaz-ui/react 4.0.2 → 4.0.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,5 +1,5 @@
1
1
 
2
- > @dafaz-ui/react@4.0.2 build
2
+ > @dafaz-ui/react@4.0.3 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.39 KB
12
- ESM ⚡️ Build success in 38ms
13
- CJS dist/index.js 21.90 KB
14
- CJS ⚡️ Build success in 38ms
11
+ CJS dist/index.js 22.22 KB
12
+ CJS ⚡️ Build success in 36ms
13
+ ESM dist/index.mjs 19.70 KB
14
+ ESM ⚡️ Build success in 36ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 4507ms
16
+ DTS ⚡️ Build success in 4361ms
17
17
  DTS dist/index.d.mts 103.71 KB
18
18
  DTS dist/index.d.ts 103.71 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @dafaz-ui/react
2
2
 
3
+ ## 4.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - add feat to select input component
8
+
3
9
  ## 4.0.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -710,7 +710,7 @@ var SelectUI = styled("select", {
710
710
  transition: "border 0.2s linear",
711
711
  width: "100%",
712
712
  margin: 0,
713
- padding: "$1 $2",
713
+ padding: "$1 $1",
714
714
  "&:focus": {
715
715
  outline: 0,
716
716
  borderBottom: "2px solid $dafaz400"
@@ -760,6 +760,7 @@ var OptionUI = styled("option", {
760
760
  });
761
761
 
762
762
  // src/components/Select/index.tsx
763
+ var import_react4 = require("react");
763
764
  var import_jsx_runtime7 = require("react/jsx-runtime");
764
765
  function Select(_a) {
765
766
  var _b = _a, {
@@ -771,12 +772,28 @@ function Select(_a) {
771
772
  "placeholder",
772
773
  "items"
773
774
  ]);
774
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(SelectUI, __spreadProps(__spreadValues({ size }, props), { defaultValue: "", children: [
775
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OptionUI, { className: "placeholder", value: "", children: placeholder }),
776
- items.map((item) => {
777
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OptionUI, { value: item.value, children: item.label }, item.id);
775
+ const [value, setValue] = (0, import_react4.useState)("");
776
+ function handleSelect(event) {
777
+ setValue(() => {
778
+ return event.target.value;
779
+ });
780
+ }
781
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
782
+ SelectUI,
783
+ __spreadProps(__spreadValues({
784
+ size
785
+ }, props), {
786
+ value,
787
+ onChange: handleSelect,
788
+ style: { opacity: value != "" ? 1 : 0.75 },
789
+ children: [
790
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OptionUI, { className: "placeholder", value: "", children: placeholder }),
791
+ items.map((item) => {
792
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OptionUI, { value: item.value, children: item.label }, item.id);
793
+ })
794
+ ]
778
795
  })
779
- ] }));
796
+ );
780
797
  }
781
798
  Select.displayName = "Select";
782
799
 
@@ -861,7 +878,7 @@ function TextArea(_a) {
861
878
  TextArea.displayName = "TextArea";
862
879
 
863
880
  // src/components/TextInput/index.tsx
864
- var import_react4 = require("react");
881
+ var import_react5 = require("react");
865
882
 
866
883
  // src/components/TextInput/styles.ts
867
884
  var InputContainer = styled("div", {
@@ -926,7 +943,7 @@ var Sufix = styled("span", {
926
943
 
927
944
  // src/components/TextInput/index.tsx
928
945
  var import_jsx_runtime10 = require("react/jsx-runtime");
929
- var TextInput = (0, import_react4.forwardRef)(
946
+ var TextInput = (0, import_react5.forwardRef)(
930
947
  (_a, ref) => {
931
948
  var _b = _a, {
932
949
  withShadow = false,
@@ -939,7 +956,7 @@ var TextInput = (0, import_react4.forwardRef)(
939
956
  "requiredText",
940
957
  "id"
941
958
  ]);
942
- const [hiddenOptional, setHiddenOptional] = (0, import_react4.useState)(required);
959
+ const [hiddenOptional, setHiddenOptional] = (0, import_react5.useState)(required);
943
960
  function handleOnChange(event) {
944
961
  if (!required) {
945
962
  if (event.target.value === "") {
package/dist/index.mjs CHANGED
@@ -661,7 +661,7 @@ var SelectUI = styled("select", {
661
661
  transition: "border 0.2s linear",
662
662
  width: "100%",
663
663
  margin: 0,
664
- padding: "$1 $2",
664
+ padding: "$1 $1",
665
665
  "&:focus": {
666
666
  outline: 0,
667
667
  borderBottom: "2px solid $dafaz400"
@@ -711,6 +711,7 @@ var OptionUI = styled("option", {
711
711
  });
712
712
 
713
713
  // src/components/Select/index.tsx
714
+ import { useState } from "react";
714
715
  import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
715
716
  function Select(_a) {
716
717
  var _b = _a, {
@@ -722,12 +723,28 @@ function Select(_a) {
722
723
  "placeholder",
723
724
  "items"
724
725
  ]);
725
- return /* @__PURE__ */ jsxs3(SelectUI, __spreadProps(__spreadValues({ size }, props), { defaultValue: "", children: [
726
- /* @__PURE__ */ jsx7(OptionUI, { className: "placeholder", value: "", children: placeholder }),
727
- items.map((item) => {
728
- return /* @__PURE__ */ jsx7(OptionUI, { value: item.value, children: item.label }, item.id);
726
+ const [value, setValue] = useState("");
727
+ function handleSelect(event) {
728
+ setValue(() => {
729
+ return event.target.value;
730
+ });
731
+ }
732
+ return /* @__PURE__ */ jsxs3(
733
+ SelectUI,
734
+ __spreadProps(__spreadValues({
735
+ size
736
+ }, props), {
737
+ value,
738
+ onChange: handleSelect,
739
+ style: { opacity: value != "" ? 1 : 0.75 },
740
+ children: [
741
+ /* @__PURE__ */ jsx7(OptionUI, { className: "placeholder", value: "", children: placeholder }),
742
+ items.map((item) => {
743
+ return /* @__PURE__ */ jsx7(OptionUI, { value: item.value, children: item.label }, item.id);
744
+ })
745
+ ]
729
746
  })
730
- ] }));
747
+ );
731
748
  }
732
749
  Select.displayName = "Select";
733
750
 
@@ -814,7 +831,7 @@ TextArea.displayName = "TextArea";
814
831
  // src/components/TextInput/index.tsx
815
832
  import {
816
833
  forwardRef,
817
- useState
834
+ useState as useState2
818
835
  } from "react";
819
836
 
820
837
  // src/components/TextInput/styles.ts
@@ -893,7 +910,7 @@ var TextInput = forwardRef(
893
910
  "requiredText",
894
911
  "id"
895
912
  ]);
896
- const [hiddenOptional, setHiddenOptional] = useState(required);
913
+ const [hiddenOptional, setHiddenOptional] = useState2(required);
897
914
  function handleOnChange(event) {
898
915
  if (!required) {
899
916
  if (event.target.value === "") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dafaz-ui/react",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -21,7 +21,6 @@
21
21
  "@types/react-dom": "^18.3.1",
22
22
  "eslint-config-prettier": "^9.1.0",
23
23
  "prettier": "^3.3.3",
24
- "react": "^18.3.1",
25
24
  "tsup": "^8.3.5",
26
25
  "typescript": "^5.6.3"
27
26
  },
@@ -29,6 +28,7 @@
29
28
  "@phosphor-icons/react": "^2.1.7",
30
29
  "@radix-ui/react-checkbox": "^1.1.2",
31
30
  "@radix-ui/react-radio-group": "^1.2.1",
32
- "@stitches/react": "^1.2.8"
31
+ "@stitches/react": "^1.2.8",
32
+ "react": "^18.3.1"
33
33
  }
34
34
  }
@@ -1,5 +1,7 @@
1
1
  import { SelectUI, SelectUIProps, OptionUI } from './styles'
2
2
 
3
+ import { ChangeEvent, useState } from 'react'
4
+
3
5
  interface Item {
4
6
  id: string
5
7
  label: string
@@ -17,8 +19,22 @@ export function Select({
17
19
  items,
18
20
  ...props
19
21
  }: SelectUIProps & SelectProps) {
22
+ const [value, setValue] = useState('')
23
+
24
+ function handleSelect(event: ChangeEvent<HTMLSelectElement>) {
25
+ setValue(() => {
26
+ return event.target.value
27
+ })
28
+ }
29
+
20
30
  return (
21
- <SelectUI size={size} {...props} defaultValue="">
31
+ <SelectUI
32
+ size={size}
33
+ {...props}
34
+ value={value}
35
+ onChange={handleSelect}
36
+ style={{ opacity: value != '' ? 1 : 0.75 }}
37
+ >
22
38
  <OptionUI className="placeholder" value="">
23
39
  {placeholder}
24
40
  </OptionUI>
@@ -20,7 +20,7 @@ export const SelectUI = styled('select', {
20
20
 
21
21
  width: '100%',
22
22
  margin: 0,
23
- padding: '$1 $2',
23
+ padding: '$1 $1',
24
24
 
25
25
  '&:focus': {
26
26
  outline: 0,