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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kelt-ui-kit-react",
3
3
  "type": "module",
4
- "version": "1.3.1",
4
+ "version": "1.3.3",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
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 ${v.className} form-group-${v.type}`}
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} />}
@@ -16,7 +16,7 @@ export const FormView = (): JSX.Element => {
16
16
  label: "Nom",
17
17
  focus: true,
18
18
  name: "nom",
19
- type: TypeInputEnum.TEXT,
19
+ type: TypeInputEnum.PASSWORD,
20
20
  required: true,
21
21
  },
22
22
  {
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;
@@ -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?: string;
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 = "text",
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
  };
@@ -0,0 +1,16 @@
1
+ .input-container {
2
+ position: relative;
3
+ min-width: 250px;
4
+ width: 100%;
5
+ .input-password-icon {
6
+ position: absolute;
7
+ right: 10px;
8
+ height: 100%;
9
+ top: 0;
10
+ display: flex;
11
+ align-items: center;
12
+ }
13
+ input {
14
+ width: 100%;
15
+ }
16
+ }