kelt-ui-kit-react 1.3.1 → 1.3.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/dist/form/input/Input.d.ts +2 -1
- package/dist/index.js +668 -657
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/form/Form.tsx +3 -1
- package/src/form/Form.view.tsx +1 -1
- package/src/form/form.css +17 -0
- package/src/form/input/Input.tsx +21 -5
- package/src/form/input/input.css +16 -0
package/package.json
CHANGED
package/src/form/Form.tsx
CHANGED
|
@@ -163,7 +163,9 @@ export const DynamicForm = forwardRef(
|
|
|
163
163
|
return (
|
|
164
164
|
<div
|
|
165
165
|
key={key}
|
|
166
|
-
className={`d-flex flex-column ${
|
|
166
|
+
className={`d-flex flex-column ${
|
|
167
|
+
v.className ?? ""
|
|
168
|
+
} form-group form-group-${v.type}`}
|
|
167
169
|
>
|
|
168
170
|
{v.label && <label>{v.label}</label>}
|
|
169
171
|
{v.icon && <Icon classIcon={v.icon} />}
|
package/src/form/Form.view.tsx
CHANGED
package/src/form/form.css
CHANGED
|
@@ -9,6 +9,23 @@ input {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
form {
|
|
12
|
+
&.form-row {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: row;
|
|
15
|
+
flex-wrap: wrap;
|
|
16
|
+
align-items: center;
|
|
17
|
+
.form-group {
|
|
18
|
+
margin-right: 1rem;
|
|
19
|
+
flex: 1;
|
|
20
|
+
padding: 0;
|
|
21
|
+
.input-container {
|
|
22
|
+
min-width: auto;
|
|
23
|
+
input {
|
|
24
|
+
min-width: auto;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
12
29
|
label {
|
|
13
30
|
font-weight: 600;
|
|
14
31
|
font-size: 0.85rem;
|
package/src/form/input/Input.tsx
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Icon } from "../../icon/Icon";
|
|
3
|
+
import { TypeInputEnum } from "../form.enum";
|
|
1
4
|
import "./input.css";
|
|
2
5
|
|
|
3
6
|
export interface InputProps {
|
|
4
7
|
id: string; // obligatoire pour le label for
|
|
5
8
|
name: string;
|
|
6
|
-
type?:
|
|
9
|
+
type?: TypeInputEnum;
|
|
7
10
|
onInvalid?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
8
11
|
value?: string | number;
|
|
9
12
|
placeholder?: string;
|
|
@@ -26,7 +29,7 @@ export interface InputProps {
|
|
|
26
29
|
export const Input = ({
|
|
27
30
|
id,
|
|
28
31
|
name,
|
|
29
|
-
type =
|
|
32
|
+
type = TypeInputEnum.TEXT,
|
|
30
33
|
value,
|
|
31
34
|
onInvalid,
|
|
32
35
|
placeholder,
|
|
@@ -45,15 +48,18 @@ export const Input = ({
|
|
|
45
48
|
onChange,
|
|
46
49
|
onBlur,
|
|
47
50
|
}: InputProps) => {
|
|
51
|
+
// Si le type est password, on utilise l'input de type password
|
|
52
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
48
53
|
return (
|
|
49
|
-
|
|
54
|
+
<div className="input-container">
|
|
50
55
|
<input type="text" style={{ display: "none" }} />
|
|
56
|
+
|
|
51
57
|
<input
|
|
52
58
|
ref={ref}
|
|
53
59
|
id={id}
|
|
54
60
|
name={name}
|
|
55
61
|
inputMode={inputMode ?? (type === "number" ? "numeric" : "text")}
|
|
56
|
-
type={type}
|
|
62
|
+
type={showPassword ? TypeInputEnum.TEXT : type}
|
|
57
63
|
spellCheck="false"
|
|
58
64
|
value={value}
|
|
59
65
|
placeholder={placeholder}
|
|
@@ -71,6 +77,16 @@ export const Input = ({
|
|
|
71
77
|
className={`input-field ${className ?? ""}`}
|
|
72
78
|
onInvalid={onInvalid}
|
|
73
79
|
/>
|
|
74
|
-
|
|
80
|
+
<>
|
|
81
|
+
{type === TypeInputEnum.PASSWORD && (
|
|
82
|
+
<div
|
|
83
|
+
onClick={() => setShowPassword(!showPassword)}
|
|
84
|
+
className="input-password-icon"
|
|
85
|
+
>
|
|
86
|
+
<Icon classIcon={showPassword ? "bi-eye-slash" : "bi-eye"} />
|
|
87
|
+
</div>
|
|
88
|
+
)}
|
|
89
|
+
</>
|
|
90
|
+
</div>
|
|
75
91
|
);
|
|
76
92
|
};
|
package/src/form/input/input.css
CHANGED