@pagamio/frontend-commons-lib 0.8.272 → 0.8.274
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.
|
@@ -14,8 +14,6 @@ function DatePicker({ value, disabled, name, placeholder, onChange }) {
|
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
setSelectedDate(getValidDate(value));
|
|
16
16
|
}, [value]);
|
|
17
|
-
// Only set defaultValue when a value is explicitly provided
|
|
18
|
-
const datepickerDefaultValue = selectedDate ?? undefined;
|
|
19
17
|
const datepickerTheme = {
|
|
20
18
|
root: {
|
|
21
19
|
input: {
|
|
@@ -74,12 +72,16 @@ function DatePicker({ value, disabled, name, placeholder, onChange }) {
|
|
|
74
72
|
},
|
|
75
73
|
},
|
|
76
74
|
};
|
|
77
|
-
return (_jsx("div", { children: _jsx(Datepicker, { value: selectedDate ??
|
|
78
|
-
|
|
75
|
+
return (_jsx("div", { children: _jsx(Datepicker, { value: selectedDate ?? null, label: placeholder || 'Select date', onChange: (date) => {
|
|
76
|
+
if (!date) {
|
|
77
|
+
setSelectedDate(null);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const validDate = new Date(date);
|
|
79
81
|
setSelectedDate(validDate);
|
|
80
82
|
if (onChange && !Number.isNaN(validDate.getTime())) {
|
|
81
83
|
onChange(validDate);
|
|
82
84
|
}
|
|
83
|
-
},
|
|
85
|
+
}, name: name, className: "", disabled: disabled, theme: datepickerTheme }) }));
|
|
84
86
|
}
|
|
85
87
|
export default DatePicker;
|
|
@@ -38,6 +38,6 @@ const TextField = ({ value, placeholder, name, type = 'text', label, error = fal
|
|
|
38
38
|
const [showPassword, setShowPassword] = useState(false);
|
|
39
39
|
// Determine the input type based on whether it's a password field and visibility toggle state
|
|
40
40
|
const inputType = type === 'password' && showPassword ? 'text' : type;
|
|
41
|
-
return (_jsxs("div", { className: "flex flex-col gap-y-2", children: [_jsx(Label, { htmlFor: name, children: label }), _jsxs("div", { className: "relative", children: [_jsx(TextInput, { id: name, color: error ? 'failure' : 'gray', name: name, placeholder: placeholder, type: inputType, required: true, value: value, onChange: (e) => setValue(e.target.value), onBlur: onBlur, onKeyDown: onKeyDown }), helperText && _jsx("span", { className: "text-sm text-red-500 mt-1", children: helperText }), type === 'password' && (_jsx(Button, { type: "button", size: "icon", variant: "ghost", onClick: () => setShowPassword(!showPassword), className: "absolute right-
|
|
41
|
+
return (_jsxs("div", { className: "flex flex-col gap-y-2", children: [_jsx(Label, { htmlFor: name, children: label }), _jsxs("div", { className: "relative", children: [_jsx(TextInput, { id: name, color: error ? 'failure' : 'gray', name: name, placeholder: placeholder, type: inputType, required: true, value: value, onChange: (e) => setValue(e.target.value), onBlur: onBlur, onKeyDown: onKeyDown }), helperText && _jsx("span", { className: "text-sm text-red-500 mt-1", children: helperText }), type === 'password' && (_jsx(Button, { type: "button", size: "icon", variant: "ghost", onClick: () => setShowPassword(!showPassword), className: "absolute right-1 top-1/2 -translate-y-1/2 text-foreground/70 hover:text-foreground", children: showPassword ? _jsx(HiEyeOff, { className: "h-5 w-5" }) : _jsx(HiEye, { className: "h-5 w-5" }) }))] })] }));
|
|
42
42
|
};
|
|
43
43
|
export default TextField;
|
package/lib/styles.css
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagamio/frontend-commons-lib",
|
|
3
3
|
"description": "Pagamio library for Frontend reusable components like the form engine and table container",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.274",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"provenance": false
|