@dafaz-ui/react 4.0.1 → 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.
- package/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +26 -9
- package/dist/index.mjs +25 -8
- package/package.json +3 -3
- package/src/components/Select/index.tsx +17 -1
- package/src/components/Select/styles.ts +1 -1
- package/src/components/TextInput/index.tsx +1 -0
package/.turbo/turbo-build.log
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
> @dafaz-ui/react@4.0.
|
2
|
+
> @dafaz-ui/react@4.0.3 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
|
-
[
|
13
|
-
[
|
14
|
-
[
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m22.22 KB[39m
|
12
|
+
[32mCJS[39m ⚡️ Build success in 36ms
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m19.70 KB[39m
|
14
|
+
[32mESM[39m ⚡️ Build success in 36ms
|
15
15
|
[34mDTS[39m Build start
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
17
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m103.
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m103.
|
16
|
+
[32mDTS[39m ⚡️ Build success in 4361ms
|
17
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m103.71 KB[39m
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m103.71 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
@@ -1962,6 +1962,7 @@ interface TextInputProps extends ComponentProps<typeof InputUI> {
|
|
1962
1962
|
withShadow?: boolean;
|
1963
1963
|
placeholder?: string;
|
1964
1964
|
type?: string;
|
1965
|
+
id: string;
|
1965
1966
|
}
|
1966
1967
|
declare const TextInput: react.ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & react.RefAttributes<HTMLInputElement>>;
|
1967
1968
|
|
package/dist/index.d.ts
CHANGED
@@ -1962,6 +1962,7 @@ interface TextInputProps extends ComponentProps<typeof InputUI> {
|
|
1962
1962
|
withShadow?: boolean;
|
1963
1963
|
placeholder?: string;
|
1964
1964
|
type?: string;
|
1965
|
+
id: string;
|
1965
1966
|
}
|
1966
1967
|
declare const TextInput: react.ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & react.RefAttributes<HTMLInputElement>>;
|
1967
1968
|
|
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 $
|
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
|
-
|
775
|
-
|
776
|
-
|
777
|
-
return
|
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
|
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,
|
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,
|
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 $
|
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
|
-
|
726
|
-
|
727
|
-
|
728
|
-
return
|
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] =
|
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.
|
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
|
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>
|