kelt-ui-kit-react 1.3.4 → 1.3.6
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/index.js +795 -781
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/dataTable/DataTable.tsx +1 -1
- package/src/dataTable/dataTable.css +16 -13
- package/src/form/Form.view.tsx +12 -0
- package/src/select/Select.tsx +27 -4
- package/src/select/Select.view.tsx +1 -1
- package/src/select/select.css +17 -1
package/package.json
CHANGED
|
@@ -70,7 +70,7 @@ export function DataTable<T>(props: DataTableProps<T>) {
|
|
|
70
70
|
};
|
|
71
71
|
}, [onLoadMore, hasMore]);
|
|
72
72
|
return (
|
|
73
|
-
<div>
|
|
73
|
+
<div className="data-table-container">
|
|
74
74
|
{name && <h2 className="mb-2">{name}</h2>}
|
|
75
75
|
{element}
|
|
76
76
|
<table className={`data-table ${className ? className : ""}`} id={id}>
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
.data-table {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
.data-table-container {
|
|
2
|
+
overflow: auto;
|
|
3
|
+
.data-table {
|
|
4
|
+
width: 100%;
|
|
5
|
+
border-spacing: 5px;
|
|
6
|
+
font-size: 14px;
|
|
7
|
+
color: #333;
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
thead {
|
|
10
|
+
margin-bottom: 1rem;
|
|
11
|
+
position: sticky;
|
|
12
|
+
top: 0;
|
|
13
|
+
background-color: #fff;
|
|
14
|
+
th {
|
|
15
|
+
color: #bdbaba;
|
|
16
|
+
min-width: 100px;
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
}
|
|
17
20
|
}
|
package/src/form/Form.view.tsx
CHANGED
|
@@ -37,6 +37,18 @@ export const FormView = (): JSX.Element => {
|
|
|
37
37
|
label: "Password",
|
|
38
38
|
type: TypeInputEnum.PASSWORD,
|
|
39
39
|
},
|
|
40
|
+
{
|
|
41
|
+
value: "",
|
|
42
|
+
name: "selectOption",
|
|
43
|
+
label: "Select Option",
|
|
44
|
+
placeholder: "Choose an option",
|
|
45
|
+
type: TypeInputEnum.SELECT,
|
|
46
|
+
options: [
|
|
47
|
+
{ value: "option1", label: "Option 1" },
|
|
48
|
+
{ value: "option2", label: "Option 2" },
|
|
49
|
+
{ value: "option3", label: "Option 3" },
|
|
50
|
+
],
|
|
51
|
+
},
|
|
40
52
|
];
|
|
41
53
|
|
|
42
54
|
// Fonction qui sera appelée lors de la soumission du formulaire
|
package/src/select/Select.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { useRef } from "react";
|
|
1
|
+
import { useCallback, useRef } from "react";
|
|
2
|
+
import { Icon } from "../icon/Icon";
|
|
2
3
|
import "./select.css";
|
|
3
4
|
import { SelectOptionInterface } from "./selectOption.interface";
|
|
4
5
|
|
|
@@ -49,12 +50,23 @@ export const Select = ({
|
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
|
-
|
|
53
|
+
const resetValue = useCallback(() => {
|
|
54
|
+
if (onChange) {
|
|
55
|
+
onChange("");
|
|
56
|
+
}
|
|
57
|
+
}, [onChange]);
|
|
53
58
|
return (
|
|
54
59
|
<div id={id} className={`select-container ${className ? className : ""}`}>
|
|
55
|
-
{label &&
|
|
60
|
+
{label && (
|
|
61
|
+
<label htmlFor={`select-${id}`} className="select-container-label">
|
|
62
|
+
{label}
|
|
63
|
+
</label>
|
|
64
|
+
)}
|
|
56
65
|
<select
|
|
66
|
+
defaultValue=""
|
|
67
|
+
required
|
|
57
68
|
disabled={disabled}
|
|
69
|
+
id={`select-${id}`}
|
|
58
70
|
className="select-container-select"
|
|
59
71
|
value={value ?? defaultValue ?? (multiple ? [] : "")}
|
|
60
72
|
onChange={handleChange}
|
|
@@ -62,7 +74,9 @@ export const Select = ({
|
|
|
62
74
|
ref={(el) => (inputRefs.current[id ?? "select"] = el)}
|
|
63
75
|
>
|
|
64
76
|
{placeholder && !defaultValue && !multiple && (
|
|
65
|
-
<option value="">
|
|
77
|
+
<option selected disabled hidden value="">
|
|
78
|
+
{placeholder}
|
|
79
|
+
</option>
|
|
66
80
|
)}
|
|
67
81
|
{options.map((option, index) => (
|
|
68
82
|
<option key={index} value={option.value}>
|
|
@@ -70,6 +84,15 @@ export const Select = ({
|
|
|
70
84
|
</option>
|
|
71
85
|
))}
|
|
72
86
|
</select>
|
|
87
|
+
{value !== "" && placeholder && (
|
|
88
|
+
<div
|
|
89
|
+
className="clear-btn"
|
|
90
|
+
onClick={resetValue}
|
|
91
|
+
aria-label="Réinitialiser"
|
|
92
|
+
>
|
|
93
|
+
<Icon classIcon="bi-x" />
|
|
94
|
+
</div>
|
|
95
|
+
)}
|
|
73
96
|
</div>
|
|
74
97
|
);
|
|
75
98
|
};
|
package/src/select/select.css
CHANGED
|
@@ -8,7 +8,23 @@
|
|
|
8
8
|
right: 1rem;
|
|
9
9
|
pointer-events: none;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
select:invalid {
|
|
12
|
+
color: gray;
|
|
13
|
+
}
|
|
14
|
+
option {
|
|
15
|
+
color: #000;
|
|
16
|
+
}
|
|
17
|
+
.clear-btn {
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 2px;
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
z-index: 5;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
bottom: 0;
|
|
25
|
+
right: 30px;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
}
|
|
12
28
|
&::before {
|
|
13
29
|
border-left: var(--size) solid transparent;
|
|
14
30
|
border-right: var(--size) solid transparent;
|