kelt-ui-kit-react 1.8.3 → 1.8.4
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/badge/Badge.d.ts +1 -3
- package/dist/button/button.interface.d.ts +1 -1
- package/dist/dataTable/DataTable.d.ts +3 -17
- package/dist/dataTable/dataTable.interface.d.ts +3 -21
- package/dist/dataTable/dataTableActions/DataTableAction.d.ts +2 -2
- package/dist/dataTable/dataTableColumn/DataTableColumn.d.ts +7 -13
- package/dist/dataTable/dataTableLoading/DataTableLoading.d.ts +3 -1
- package/dist/dataTable/dataTableRow/DataTableRow.d.ts +3 -5
- package/dist/expands/expand/expand.d.ts +1 -1
- package/dist/form/form.enum.d.ts +0 -1
- package/dist/form/input/Input.d.ts +0 -3
- package/dist/form/inputNumber/InputNumber.d.ts +2 -0
- package/dist/icon/Icon.d.ts +1 -1
- package/dist/icon/icon.interface.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +2836 -3652
- package/dist/overlayPanel/OverlayPanel.d.ts +1 -3
- package/dist/select/Select.d.ts +1 -4
- package/dist/select/selectOption.interface.d.ts +0 -1
- package/dist/style.css +1 -1
- package/dist/tabs/Tabs.d.ts +1 -2
- package/package.json +1 -1
- package/src/badge/Badge.tsx +1 -9
- package/src/badge/badge.css +0 -4
- package/src/button/Button.tsx +1 -1
- package/src/button/button.interface.tsx +1 -1
- package/src/card/card.css +3 -23
- package/src/card/cardAction/CardAction.tsx +4 -4
- package/src/damier/damier.css +3 -2
- package/src/dataTable/DataTable.tsx +45 -670
- package/src/dataTable/DataTable.view.tsx +14 -47
- package/src/dataTable/dataTable.css +5 -153
- package/src/dataTable/dataTable.interface.ts +3 -21
- package/src/dataTable/dataTableActions/DataTableAction.tsx +2 -2
- package/src/dataTable/dataTableColumn/DataTableColumn.tsx +14 -64
- package/src/dataTable/dataTableLoading/DataTableLoading.tsx +15 -4
- package/src/dataTable/dataTableRow/DataTableRow.tsx +33 -60
- package/src/expands/Expands.tsx +16 -2
- package/src/expands/expand/expand.tsx +18 -6
- package/src/form/Form.tsx +12 -13
- package/src/form/form.css +2 -13
- package/src/form/form.enum.ts +0 -1
- package/src/form/input/Input.tsx +7 -61
- package/src/form/input/input.css +1 -23
- package/src/form/inputNumber/InputNumber.tsx +11 -6
- package/src/form/inputPrice/InputPrice.tsx +4 -2
- package/src/icon/Icon.tsx +2 -6
- package/src/icon/icon.interface.tsx +0 -1
- package/src/index.ts +0 -2
- package/src/overlayPanel/OverlayPanel.tsx +10 -23
- package/src/overlayPanel/overlay.context.tsx +4 -6
- package/src/overlayPanel/overlayPanel.css +1 -10
- package/src/select/Select.tsx +38 -134
- package/src/select/select.css +14 -65
- package/src/select/selectOption.interface.ts +0 -1
- package/src/sidebar/Sidebar.tsx +80 -9
- package/src/sidebar/sidebar.css +18 -1
- package/src/tabs/Tabs.tsx +1 -19
- package/dist/_core/type/generiqueType.d.ts +0 -4
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/DataTableColumnFilter.d.ts +0 -10
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDate/DataTableColumnFilterDate.d.ts +0 -9
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDateRange/dataTableColumnFilterDateRange.d.ts +0 -9
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterEnum/DataTableColumnFilterEnum.d.ts +0 -13
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterString/DataTableColumnFilterString.d.ts +0 -9
- package/dist/dataTable/dataTableColumn/dataTableColumnSort/DataTableColumnSort.d.ts +0 -11
- package/dist/dataTable/dataTableFilters/DataTableFilters.d.ts +0 -7
- package/dist/dataTable/dataTableRow/dataTableRowOverlay/DataTableRowOverlay.d.ts +0 -12
- package/dist/dataTable/dataTableRow/dataTableRowValue/DataTableRowValue.d.ts +0 -11
- package/kelt-ui-kit-react-1.6.9.tgz +0 -0
- package/package/README.md +0 -46
- package/package/index.html +0 -20
- package/package/package.json +0 -56
- package/package/public/favicon.ico +0 -0
- package/package/public/index.html +0 -18
- package/package/public/logo192.png +0 -0
- package/package/public/logo512.png +0 -0
- package/package/public/manifest.json +0 -25
- package/package/public/robots.txt +0 -3
- package/package/src/App.css +0 -11
- package/package/src/App.menu.tsx +0 -249
- package/package/src/App.routes.tsx +0 -16
- package/package/src/App.tsx +0 -30
- package/package/src/_core/hooks/HistoryProvider.tsx +0 -25
- package/package/src/_core/hooks/ImageChecker.tsx +0 -26
- package/package/src/_core/hooks/imageExist.tsx +0 -9
- package/package/src/_core/hooks/isEAN13.tsx +0 -16
- package/package/src/_core/hooks/objectToQueryParams.tsx +0 -32
- package/package/src/_core/hooks/useCurrency.tsx +0 -18
- package/package/src/_core/hooks/useDateutils.ts +0 -64
- package/package/src/_core/hooks/useIsMobile.ts +0 -18
- package/package/src/_core/hooks/useToken.tsx +0 -19
- package/package/src/_core/hooks/useValidate.tsx +0 -18
- package/package/src/_core/hooks/widgetSupport.tsx +0 -39
- package/package/src/action/Action.view.tsx +0 -21
- package/package/src/action/ButtonAction.tsx +0 -32
- package/package/src/action/action.css +0 -20
- package/package/src/badge/Badge.tsx +0 -34
- package/package/src/badge/Badge.view.tsx +0 -15
- package/package/src/badge/badge.css +0 -55
- package/package/src/button/Button.tsx +0 -46
- package/package/src/button/Button.view.tsx +0 -85
- package/package/src/button/button.css +0 -53
- package/package/src/button/button.interface.tsx +0 -21
- package/package/src/button/buttonActions/ButtonActions.tsx +0 -104
- package/package/src/button/buttonFile/ButtonFile.tsx +0 -59
- package/package/src/button/buttonFile/ButtonFile.view.tsx +0 -70
- package/package/src/button/buttonFilters/ButtonFilters.tsx +0 -102
- package/package/src/button/buttonFilters/buttonFilters.css +0 -22
- package/package/src/card/Card.tsx +0 -125
- package/package/src/card/Card.view.tsx +0 -73
- package/package/src/card/card.css +0 -145
- package/package/src/card/card.interface.tsx +0 -9
- package/package/src/card/cardAction/CardAction.tsx +0 -135
- package/package/src/card/cardAction/cardAction.css +0 -10
- package/package/src/card/cardAction.interface.tsx +0 -10
- package/package/src/card/hook/useCardInteractions.tsx +0 -30
- package/package/src/carousel/Carousel.css +0 -44
- package/package/src/carousel/Carousel.tsx +0 -115
- package/package/src/carousel/Carousel.view.tsx +0 -13
- package/package/src/damier/Damier.tsx +0 -64
- package/package/src/damier/Damier.view.tsx +0 -31
- package/package/src/damier/damier.css +0 -50
- package/package/src/damier/damierCell/DamierCell.tsx +0 -18
- package/package/src/damier/damierCell/damierCell.interface.tsx +0 -5
- package/package/src/dataTable/DataTable.tsx +0 -259
- package/package/src/dataTable/DataTable.view.tsx +0 -62
- package/package/src/dataTable/dataTable.css +0 -30
- package/package/src/dataTable/dataTable.interface.ts +0 -30
- package/package/src/dataTable/dataTableActions/DataTableAction.tsx +0 -44
- package/package/src/dataTable/dataTableColumn/DataTableColumn.tsx +0 -27
- package/package/src/dataTable/dataTableLoading/DataTableLoading.tsx +0 -21
- package/package/src/dataTable/dataTableRow/DataTableRow.tsx +0 -54
- package/package/src/datePicker/DatePicker.tsx +0 -110
- package/package/src/datePicker/DatePicker.view.tsx +0 -9
- package/package/src/datePicker/datePicker.css +0 -77
- package/package/src/expands/Expands.tsx +0 -42
- package/package/src/expands/Expands.view.tsx +0 -90
- package/package/src/expands/expand/expand.interface.tsx +0 -8
- package/package/src/expands/expand/expand.tsx +0 -75
- package/package/src/expands/expands.css +0 -97
- package/package/src/filAriane/FilAriane.tsx +0 -57
- package/package/src/filAriane/FilAriane.view.tsx +0 -28
- package/package/src/filAriane/filAriane.css +0 -23
- package/package/src/filAriane/filAriane.interface.tsx +0 -6
- package/package/src/form/Form.tsx +0 -279
- package/package/src/form/Form.view.tsx +0 -59
- package/package/src/form/form.css +0 -62
- package/package/src/form/form.enum.ts +0 -13
- package/package/src/form/form.interface.tsx +0 -37
- package/package/src/form/input/Input.tsx +0 -106
- package/package/src/form/input/input.css +0 -26
- package/package/src/form/inputNumber/InputNumber.tsx +0 -132
- package/package/src/form/inputNumber/InputNumber.view.tsx +0 -15
- package/package/src/form/inputPrice/InputPrice.tsx +0 -42
- package/package/src/form/inputPrice/InputPrice.view.tsx +0 -15
- package/package/src/form/textArea/TextArea.tsx +0 -59
- package/package/src/form/textArea/TextArea.view.tsx +0 -34
- package/package/src/form/textArea/textArea.css +0 -9
- package/package/src/grid/Grid.tsx +0 -21
- package/package/src/grid/Grid.view.tsx +0 -24
- package/package/src/grid/col/Col.tsx +0 -15
- package/package/src/grid/col/colStyled/ColStyled.tsx +0 -41
- package/package/src/grid/container/Container.tsx +0 -8
- package/package/src/grid/container/container.css +0 -5
- package/package/src/grid/grid.interface.tsx +0 -7
- package/package/src/grid/row/Row.tsx +0 -12
- package/package/src/grid/row/row.css +0 -18
- package/package/src/header/Header.tsx +0 -62
- package/package/src/header/Header.view.tsx +0 -5
- package/package/src/header/header.css +0 -26
- package/package/src/header/header.interface.tsx +0 -10
- package/package/src/home/Home.tsx +0 -3
- package/package/src/icon/Icon.tsx +0 -6
- package/package/src/icon/Icons.view.tsx +0 -29
- package/package/src/icon/icon.css +0 -20
- package/package/src/icon/icon.interface.tsx +0 -6
- package/package/src/icon/iconSize.enum.ts +0 -7
- package/package/src/index.css +0 -502
- package/package/src/index.ts +0 -58
- package/package/src/loader/Loader.tsx +0 -37
- package/package/src/loader/Loader.view.tsx +0 -20
- package/package/src/loader/loader.css +0 -30
- package/package/src/logo.svg +0 -1
- package/package/src/main.tsx +0 -10
- package/package/src/menus/Menus.tsx +0 -42
- package/package/src/menus/Menus.view.tsx +0 -39
- package/package/src/menus/menu/Menu.tsx +0 -17
- package/package/src/menus/menu/menu.interface.tsx +0 -9
- package/package/src/menus/menus.css +0 -47
- package/package/src/message/Message.tsx +0 -30
- package/package/src/message/Message.view.tsx +0 -22
- package/package/src/message/message.css +0 -29
- package/package/src/modal/Modal.tsx +0 -59
- package/package/src/modal/Modal.view.tsx +0 -26
- package/package/src/modal/modal.css +0 -71
- package/package/src/notFound/NotFound.tsx +0 -3
- package/package/src/overlayPanel/OverlayPanel.tsx +0 -195
- package/package/src/overlayPanel/OverlayPanel.view.tsx +0 -25
- package/package/src/overlayPanel/overlay.context.tsx +0 -28
- package/package/src/overlayPanel/overlayPanel.css +0 -35
- package/package/src/overlayPanel/overlayPanelStyled/OverlayPanelStyled.tsx +0 -18
- package/package/src/pdfViewer/PdfViewer.tsx +0 -73
- package/package/src/pdfViewer/PdfViewer.view.tsx +0 -5
- package/package/src/quantity/Quantity.tsx +0 -103
- package/package/src/quantity/Quantity.view.tsx +0 -0
- package/package/src/quantity/quantity.css +0 -26
- package/package/src/search/Search.tsx +0 -161
- package/package/src/search/Search.view.tsx +0 -14
- package/package/src/search/search.css +0 -59
- package/package/src/select/Select.tsx +0 -103
- package/package/src/select/Select.view.tsx +0 -71
- package/package/src/select/select.css +0 -69
- package/package/src/select/selectOption.interface.ts +0 -4
- package/package/src/sidebar/Sidebar.tsx +0 -208
- package/package/src/sidebar/Sidebar.view.tsx +0 -17
- package/package/src/sidebar/sidebar.css +0 -104
- package/package/src/sidebarData/SidebarData.tsx +0 -19
- package/package/src/sidebarData/SidebarData.view.tsx +0 -19
- package/package/src/sidebarData/sidebarData.css +0 -27
- package/package/src/tabs/Tabs.tsx +0 -90
- package/package/src/tabs/Tabs.view.tsx +0 -20
- package/package/src/tabs/tabs.css +0 -24
- package/package/src/toaster/Toaster.tsx +0 -55
- package/package/src/toaster/Toaster.view.tsx +0 -24
- package/package/src/toaster/store/useToasterStore.tsx +0 -41
- package/package/src/toaster/toaster.css +0 -87
- package/package/tsconfig.json +0 -28
- package/package/vite.config.ts +0 -20
- package/package/vite.config.ts.timestamp-1733262892554-a13dfef6e8a29.mjs +0 -24
- package/package/vite.config.ts.timestamp-1757847121745-e5a5bf54b81b.mjs +0 -28
- package/package/vite.config.ts.timestamp-1759742478362-4ac5c5a7db34b.mjs +0 -28
- package/src/_core/type/generiqueType.tsx +0 -4
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/DataTableColumnFilter.tsx +0 -36
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilter.css +0 -0
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDate/DataTableColumnFilterDate.tsx +0 -39
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDateRange/dataTableColumnFilterDateRange.tsx +0 -80
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterEnum/DataTableColumnFilterEnum.tsx +0 -89
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterString/DataTableColumnFilterString.tsx +0 -37
- package/src/dataTable/dataTableColumn/dataTableColumnSort/DataTableColumnSort.tsx +0 -42
- package/src/dataTable/dataTableFilters/DataTableFilters.tsx +0 -91
- package/src/dataTable/dataTableFilters/dataTableFilters.css +0 -16
- package/src/dataTable/dataTableRow/dataTableRowOverlay/DataTableRowOverlay.tsx +0 -80
- package/src/dataTable/dataTableRow/dataTableRowValue/DataTableRowValue.tsx +0 -123
package/src/form/Form.tsx
CHANGED
|
@@ -14,7 +14,7 @@ import { Input } from "./input/Input";
|
|
|
14
14
|
import { TextArea } from "./textArea/TextArea";
|
|
15
15
|
|
|
16
16
|
export type FormProps<
|
|
17
|
-
T extends { [key: string]: string | number | boolean | Date | string[] }
|
|
17
|
+
T extends { [key: string]: string | number | boolean | Date | string[] }
|
|
18
18
|
> = {
|
|
19
19
|
id?: string;
|
|
20
20
|
className?: string;
|
|
@@ -49,7 +49,7 @@ export const DynamicForm = forwardRef(
|
|
|
49
49
|
getValues?: () => FormValuesInterface<T>;
|
|
50
50
|
updateFormValue?: (values: FormValuesInterface<T>) => void;
|
|
51
51
|
setBtnDisabledSubmit?: (disabled: boolean) => void;
|
|
52
|
-
}
|
|
52
|
+
}>
|
|
53
53
|
) => {
|
|
54
54
|
const [btnDisabledSubmit, setBtnDisabledSubmit] = useState(disabledSubmit);
|
|
55
55
|
const [values, setValues] = useState<FormValuesInterface<T>>(() => {
|
|
@@ -67,7 +67,7 @@ export const DynamicForm = forwardRef(
|
|
|
67
67
|
const handleChangeInput = useCallback(
|
|
68
68
|
(
|
|
69
69
|
event: React.ChangeEvent<HTMLInputElement>,
|
|
70
|
-
forminterface: FormInterface
|
|
70
|
+
forminterface: FormInterface
|
|
71
71
|
) => {
|
|
72
72
|
const { name, type, checked, value } = event.target;
|
|
73
73
|
const newValue = type === "checkbox" ? checked : value;
|
|
@@ -84,7 +84,7 @@ export const DynamicForm = forwardRef(
|
|
|
84
84
|
return updatedValues;
|
|
85
85
|
});
|
|
86
86
|
},
|
|
87
|
-
[onChange]
|
|
87
|
+
[onChange]
|
|
88
88
|
);
|
|
89
89
|
const handleChangeTextArea = useCallback(
|
|
90
90
|
(name: string, value: string, forminterface: FormInterface) => {
|
|
@@ -100,14 +100,14 @@ export const DynamicForm = forwardRef(
|
|
|
100
100
|
return updatedValues;
|
|
101
101
|
});
|
|
102
102
|
},
|
|
103
|
-
[onChange]
|
|
103
|
+
[onChange]
|
|
104
104
|
);
|
|
105
105
|
/** Gestion des <select> */
|
|
106
106
|
const handleChangeSelect = useCallback(
|
|
107
107
|
(
|
|
108
108
|
newValue: string | string[],
|
|
109
109
|
name: string,
|
|
110
|
-
forminterface: FormInterface
|
|
110
|
+
forminterface: FormInterface
|
|
111
111
|
) => {
|
|
112
112
|
if (forminterface.onChange) {
|
|
113
113
|
forminterface.onChange(newValue, name);
|
|
@@ -119,7 +119,7 @@ export const DynamicForm = forwardRef(
|
|
|
119
119
|
return updatedValues;
|
|
120
120
|
});
|
|
121
121
|
},
|
|
122
|
-
[onChange]
|
|
122
|
+
[onChange]
|
|
123
123
|
);
|
|
124
124
|
|
|
125
125
|
const handleSubmit = useCallback(
|
|
@@ -129,7 +129,7 @@ export const DynamicForm = forwardRef(
|
|
|
129
129
|
onSubmit(values);
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
|
-
[onSubmit, values]
|
|
132
|
+
[onSubmit, values]
|
|
133
133
|
);
|
|
134
134
|
|
|
135
135
|
const resetForm = () => {
|
|
@@ -162,7 +162,7 @@ export const DynamicForm = forwardRef(
|
|
|
162
162
|
const getValues = () => values;
|
|
163
163
|
|
|
164
164
|
const updateFormValue: (values: FormValuesInterface<T>) => void = (
|
|
165
|
-
values
|
|
165
|
+
values
|
|
166
166
|
) => {
|
|
167
167
|
setValues((prevValues) => ({
|
|
168
168
|
...prevValues,
|
|
@@ -189,10 +189,10 @@ export const DynamicForm = forwardRef(
|
|
|
189
189
|
{initialForm.map((v, key) => {
|
|
190
190
|
const required = v.onRequired
|
|
191
191
|
? v.onRequired(v.value)
|
|
192
|
-
:
|
|
192
|
+
: v.required ?? false;
|
|
193
193
|
const disabled = v.onDisabled
|
|
194
194
|
? v.onDisabled(v.value)
|
|
195
|
-
:
|
|
195
|
+
: v.disabled ?? false;
|
|
196
196
|
|
|
197
197
|
return (
|
|
198
198
|
<div
|
|
@@ -249,7 +249,6 @@ export const DynamicForm = forwardRef(
|
|
|
249
249
|
autoFocus={v.focus ?? false}
|
|
250
250
|
required={required}
|
|
251
251
|
step={v.step ?? "0.01"}
|
|
252
|
-
disabledDebounce={true}
|
|
253
252
|
value={values[v.name] as string | number}
|
|
254
253
|
checked={
|
|
255
254
|
v.type === "checkbox" ? !!values[v.name] : undefined
|
|
@@ -276,5 +275,5 @@ export const DynamicForm = forwardRef(
|
|
|
276
275
|
</div>
|
|
277
276
|
</form>
|
|
278
277
|
);
|
|
279
|
-
}
|
|
278
|
+
}
|
|
280
279
|
);
|
package/src/form/form.css
CHANGED
|
@@ -4,12 +4,10 @@ input {
|
|
|
4
4
|
border-radius: 4px;
|
|
5
5
|
margin: 0.25rem 0 0.25rem 0;
|
|
6
6
|
min-width: 250px;
|
|
7
|
-
|
|
8
7
|
&:focus-visible {
|
|
9
|
-
outline:
|
|
8
|
+
outline: 1px solid #9696a7;
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
input[type="checkbox"],
|
|
14
12
|
input[type="radio"] {
|
|
15
13
|
min-width: auto;
|
|
@@ -18,46 +16,38 @@ input[type="radio"] {
|
|
|
18
16
|
height: 18px;
|
|
19
17
|
width: 18px;
|
|
20
18
|
}
|
|
21
|
-
|
|
22
19
|
form {
|
|
23
20
|
&.form-row {
|
|
24
21
|
display: flex;
|
|
25
22
|
flex-direction: row;
|
|
26
23
|
flex-wrap: wrap;
|
|
27
24
|
align-items: center;
|
|
28
|
-
|
|
29
25
|
.form-group {
|
|
30
26
|
margin-right: 1rem;
|
|
31
27
|
flex: 1;
|
|
32
28
|
padding: 0;
|
|
33
|
-
|
|
34
29
|
.input-container {
|
|
35
30
|
min-width: auto;
|
|
36
|
-
|
|
37
31
|
input {
|
|
38
32
|
min-width: auto;
|
|
39
33
|
}
|
|
40
34
|
}
|
|
41
35
|
}
|
|
42
36
|
}
|
|
43
|
-
|
|
44
37
|
label {
|
|
45
38
|
font-weight: 600;
|
|
46
39
|
font-size: 0.85rem;
|
|
47
40
|
padding-bottom: 0.15rem;
|
|
48
41
|
}
|
|
49
|
-
|
|
50
42
|
.form-group-checkbox {
|
|
51
43
|
display: flex;
|
|
52
44
|
flex-direction: row;
|
|
53
45
|
align-items: center;
|
|
54
46
|
margin-top: 0.5rem;
|
|
55
|
-
|
|
56
47
|
label {
|
|
57
48
|
margin-right: 1rem;
|
|
58
49
|
padding: 0;
|
|
59
50
|
}
|
|
60
|
-
|
|
61
51
|
input {
|
|
62
52
|
min-width: auto;
|
|
63
53
|
padding: 0;
|
|
@@ -66,8 +56,7 @@ form {
|
|
|
66
56
|
width: 18px;
|
|
67
57
|
}
|
|
68
58
|
}
|
|
69
|
-
|
|
70
59
|
button {
|
|
71
60
|
margin-top: 1rem;
|
|
72
61
|
}
|
|
73
|
-
}
|
|
62
|
+
}
|
package/src/form/form.enum.ts
CHANGED
package/src/form/input/Input.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { forwardRef,
|
|
1
|
+
import { forwardRef, useState } from "react";
|
|
2
2
|
import { Icon } from "../../icon/Icon";
|
|
3
3
|
import { TypeInputEnum } from "../form.enum";
|
|
4
4
|
import "./input.css";
|
|
@@ -15,15 +15,12 @@ export interface InputProps {
|
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
autoFocus?: boolean;
|
|
17
17
|
required?: boolean;
|
|
18
|
-
disabledDebounce?: boolean;
|
|
19
18
|
minLength?: number;
|
|
20
19
|
maxLength?: number;
|
|
21
|
-
width?: string;
|
|
22
20
|
autoComplete?: string;
|
|
23
21
|
step?: string;
|
|
24
22
|
tabIndex?: number;
|
|
25
23
|
checked?: boolean;
|
|
26
|
-
showClearButton?: boolean;
|
|
27
24
|
handleKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
28
25
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
29
26
|
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
@@ -37,13 +34,11 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
|
37
34
|
name,
|
|
38
35
|
type = TypeInputEnum.TEXT,
|
|
39
36
|
value,
|
|
40
|
-
width,
|
|
41
37
|
onInvalid,
|
|
42
38
|
placeholder,
|
|
43
39
|
className,
|
|
44
40
|
inputMode,
|
|
45
41
|
minLength,
|
|
46
|
-
disabledDebounce = false,
|
|
47
42
|
maxLength,
|
|
48
43
|
autoFocus = false,
|
|
49
44
|
disabled = false,
|
|
@@ -52,61 +47,18 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
|
52
47
|
tabIndex = 0,
|
|
53
48
|
step,
|
|
54
49
|
checked,
|
|
55
|
-
showClearButton = false,
|
|
56
50
|
onChange,
|
|
57
51
|
onBlur,
|
|
58
52
|
onClick,
|
|
59
53
|
handleKeyDown,
|
|
60
54
|
},
|
|
61
|
-
ref
|
|
55
|
+
ref
|
|
62
56
|
) => {
|
|
63
57
|
// Si le type est password, on utilise l'input de type password
|
|
64
58
|
const [showPassword, setShowPassword] = useState(false);
|
|
65
|
-
const [localValue, setLocalValue] = useState(value ?? "");
|
|
66
|
-
const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
67
|
-
|
|
68
|
-
const triggerOnChange = (nextValue: string) => {
|
|
69
|
-
if (!onChange) return;
|
|
70
|
-
|
|
71
|
-
const syntheticEvent = {
|
|
72
|
-
target: { value: nextValue, name, id },
|
|
73
|
-
currentTarget: { value: nextValue, name, id },
|
|
74
|
-
} as unknown as React.ChangeEvent<HTMLInputElement>;
|
|
75
|
-
|
|
76
|
-
onChange(syntheticEvent);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
80
|
-
const value = e.target.value; // 👈 capturer avant le setTimeout
|
|
81
|
-
setLocalValue(value);
|
|
82
|
-
if (!onChange) return;
|
|
83
|
-
if (disabledDebounce) {
|
|
84
|
-
onChange(e);
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
88
|
-
debounceRef.current = setTimeout(() => {
|
|
89
|
-
onChange({ ...e, target: { ...e.target, value } }); // 👈 passer la valeur capturée
|
|
90
|
-
}, 300);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const handleClear = (e: React.MouseEvent<HTMLDivElement>) => {
|
|
94
|
-
e.stopPropagation();
|
|
95
|
-
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
96
|
-
setLocalValue("");
|
|
97
|
-
triggerOnChange("");
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const hasValue = String(localValue ?? "").length > 0;
|
|
101
|
-
const hasClearButtonSlot = showClearButton && type === TypeInputEnum.TEXT;
|
|
102
|
-
const canShowClearButton =
|
|
103
|
-
showClearButton && hasValue && !disabled && type === TypeInputEnum.TEXT;
|
|
104
59
|
|
|
105
60
|
return (
|
|
106
|
-
<div
|
|
107
|
-
className={`input-container ${`input-container-${type}`} `}
|
|
108
|
-
style={{ width }}
|
|
109
|
-
>
|
|
61
|
+
<div className={`input-container ${`input-container-${type}`} `}>
|
|
110
62
|
<input name={`hide-${name}`} type="text" style={{ display: "none" }} />
|
|
111
63
|
|
|
112
64
|
<input
|
|
@@ -116,7 +68,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
|
116
68
|
inputMode={inputMode ?? (type === "number" ? "numeric" : "text")}
|
|
117
69
|
type={showPassword ? TypeInputEnum.TEXT : type}
|
|
118
70
|
spellCheck="false"
|
|
119
|
-
value={
|
|
71
|
+
value={value}
|
|
120
72
|
placeholder={placeholder}
|
|
121
73
|
disabled={disabled}
|
|
122
74
|
required={required}
|
|
@@ -126,7 +78,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
|
126
78
|
autoFocus={autoFocus}
|
|
127
79
|
minLength={minLength}
|
|
128
80
|
maxLength={maxLength}
|
|
129
|
-
onChange={
|
|
81
|
+
onChange={onChange}
|
|
130
82
|
checked={checked}
|
|
131
83
|
onKeyDown={handleKeyDown}
|
|
132
84
|
onBlur={onBlur}
|
|
@@ -134,16 +86,10 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
|
134
86
|
e.stopPropagation();
|
|
135
87
|
onClick && onClick(e);
|
|
136
88
|
}}
|
|
137
|
-
className={`input-field ${
|
|
89
|
+
className={`input-field ${className ?? ""}`}
|
|
138
90
|
onInvalid={onInvalid}
|
|
139
91
|
/>
|
|
140
92
|
|
|
141
|
-
{canShowClearButton && (
|
|
142
|
-
<div onClick={handleClear} className="input-clear-icon" role="button">
|
|
143
|
-
<Icon classIcon="bi-x-circle" />
|
|
144
|
-
</div>
|
|
145
|
-
)}
|
|
146
|
-
|
|
147
93
|
{type === TypeInputEnum.PASSWORD && (
|
|
148
94
|
<div
|
|
149
95
|
onClick={() => setShowPassword(!showPassword)}
|
|
@@ -154,7 +100,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
|
154
100
|
)}
|
|
155
101
|
</div>
|
|
156
102
|
);
|
|
157
|
-
}
|
|
103
|
+
}
|
|
158
104
|
);
|
|
159
105
|
|
|
160
106
|
Input.displayName = "Input";
|
package/src/form/input/input.css
CHANGED
|
@@ -2,18 +2,15 @@
|
|
|
2
2
|
position: relative;
|
|
3
3
|
min-width: 250px;
|
|
4
4
|
width: 100%;
|
|
5
|
-
|
|
6
5
|
&.input-container-radio,
|
|
7
6
|
&.input-container-checkbox {
|
|
8
7
|
min-width: 10px;
|
|
9
8
|
width: 10px;
|
|
10
|
-
|
|
11
9
|
input {
|
|
12
10
|
width: 10px;
|
|
13
11
|
min-width: 10px;
|
|
14
12
|
}
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
.input-password-icon {
|
|
18
15
|
position: absolute;
|
|
19
16
|
right: 10px;
|
|
@@ -22,27 +19,8 @@
|
|
|
22
19
|
display: flex;
|
|
23
20
|
align-items: center;
|
|
24
21
|
}
|
|
25
|
-
|
|
26
|
-
.input-clear-icon {
|
|
27
|
-
position: absolute;
|
|
28
|
-
right: 8px;
|
|
29
|
-
width: 24px;
|
|
30
|
-
height: 100%;
|
|
31
|
-
top: 0;
|
|
32
|
-
display: flex;
|
|
33
|
-
align-items: center;
|
|
34
|
-
justify-content: center;
|
|
35
|
-
cursor: pointer;
|
|
36
|
-
z-index: 2;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.with-clear-button {
|
|
40
|
-
padding-right: 40px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
22
|
input {
|
|
44
23
|
width: 100%;
|
|
45
24
|
font-size: 0.8rem;
|
|
46
|
-
box-sizing: border-box;
|
|
47
25
|
}
|
|
48
|
-
}
|
|
26
|
+
}
|
|
@@ -8,8 +8,10 @@ export type InputNumberProps = {
|
|
|
8
8
|
value?: string; // ⚠️ string pour gérer la saisie manuelle
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
className?: string;
|
|
11
|
+
pattern?: string; // regex pour validation (ex: "^-?\\d*[.,]?\\d*$" pour nombre décimal)
|
|
11
12
|
disabled?: boolean;
|
|
12
13
|
required?: boolean;
|
|
14
|
+
inputMode?: "numeric" | "decimal";
|
|
13
15
|
autoFocus?: boolean;
|
|
14
16
|
maxLength?: number;
|
|
15
17
|
autoComplete?: string;
|
|
@@ -17,7 +19,7 @@ export type InputNumberProps = {
|
|
|
17
19
|
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
18
20
|
onChange?: (
|
|
19
21
|
e: React.ChangeEvent<HTMLInputElement>,
|
|
20
|
-
valueFormat?: string
|
|
22
|
+
valueFormat?: string,
|
|
21
23
|
) => void;
|
|
22
24
|
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
23
25
|
onClick?: (e: React.MouseEvent<HTMLInputElement>) => void;
|
|
@@ -38,13 +40,15 @@ export const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(
|
|
|
38
40
|
maxLength = 10,
|
|
39
41
|
autoComplete = "off",
|
|
40
42
|
tabIndex = 0,
|
|
43
|
+
inputMode = "numeric",
|
|
44
|
+
pattern,
|
|
41
45
|
onChange,
|
|
42
46
|
onBlur,
|
|
43
47
|
onClick,
|
|
44
48
|
onKeyDown,
|
|
45
49
|
onFocus,
|
|
46
50
|
},
|
|
47
|
-
ref
|
|
51
|
+
ref,
|
|
48
52
|
) => {
|
|
49
53
|
const handleChange = useCallback(
|
|
50
54
|
(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
@@ -62,7 +66,7 @@ export const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(
|
|
|
62
66
|
|
|
63
67
|
onChange?.(e, newValue);
|
|
64
68
|
},
|
|
65
|
-
[onChange, maxLength]
|
|
69
|
+
[onChange, maxLength],
|
|
66
70
|
);
|
|
67
71
|
|
|
68
72
|
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
@@ -72,7 +76,7 @@ export const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(
|
|
|
72
76
|
// ✅ Autoriser chiffres, contrôle, ., , et -
|
|
73
77
|
const allowed =
|
|
74
78
|
/[0-9]|Backspace|Delete|ArrowLeft|ArrowRight|Tab|Enter|Home|End/.test(
|
|
75
|
-
e.key
|
|
79
|
+
e.key,
|
|
76
80
|
) ||
|
|
77
81
|
e.key === "." ||
|
|
78
82
|
e.key === "," ||
|
|
@@ -105,8 +109,9 @@ export const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(
|
|
|
105
109
|
required={required}
|
|
106
110
|
autoFocus={autoFocus}
|
|
107
111
|
autoComplete={autoComplete}
|
|
112
|
+
pattern={pattern}
|
|
108
113
|
tabIndex={tabIndex}
|
|
109
|
-
inputMode=
|
|
114
|
+
inputMode={inputMode} // mobile keyboard adaptatif
|
|
110
115
|
spellCheck="false"
|
|
111
116
|
className={`input-field ${className ?? ""}`}
|
|
112
117
|
onChange={handleChange}
|
|
@@ -121,7 +126,7 @@ export const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(
|
|
|
121
126
|
/>
|
|
122
127
|
</div>
|
|
123
128
|
);
|
|
124
|
-
}
|
|
129
|
+
},
|
|
125
130
|
);
|
|
126
131
|
|
|
127
132
|
InputNumber.displayName = "InputNumber";
|
|
@@ -18,7 +18,7 @@ export const InputPrice = forwardRef<HTMLInputElement, InputPriceProps>(
|
|
|
18
18
|
onChange,
|
|
19
19
|
...props
|
|
20
20
|
},
|
|
21
|
-
ref
|
|
21
|
+
ref,
|
|
22
22
|
) => {
|
|
23
23
|
const handleBlur = useCallback(() => {
|
|
24
24
|
if (onChange) {
|
|
@@ -31,10 +31,12 @@ export const InputPrice = forwardRef<HTMLInputElement, InputPriceProps>(
|
|
|
31
31
|
<InputNumber
|
|
32
32
|
{...props}
|
|
33
33
|
ref={ref}
|
|
34
|
+
pattern="[0-9]*[.,]?[0-9]*"
|
|
35
|
+
inputMode="decimal" // mobile keyboard adaptatif
|
|
34
36
|
value={value ?? ""}
|
|
35
37
|
onChange={(e) => onChange?.(e.target.value)}
|
|
36
38
|
onBlur={handleBlur} // Force le formatage à 2 décimales en sortie
|
|
37
39
|
/>
|
|
38
40
|
);
|
|
39
|
-
}
|
|
41
|
+
},
|
|
40
42
|
);
|
package/src/icon/Icon.tsx
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import "./icon.css";
|
|
2
2
|
import { IconInterface } from "./icon.interface";
|
|
3
3
|
|
|
4
|
-
export const Icon = ({
|
|
5
|
-
classIcon
|
|
6
|
-
size,
|
|
7
|
-
onClick,
|
|
8
|
-
}: IconInterface): JSX.Element => {
|
|
9
|
-
return <i className={`bi ${classIcon} ${size ?? "sm"}`} onClick={onClick} />;
|
|
4
|
+
export const Icon = ({ classIcon, size }: IconInterface): JSX.Element => {
|
|
5
|
+
return <i className={`bi ${classIcon} ${size ?? "sm"}`} />;
|
|
10
6
|
};
|
package/src/index.ts
CHANGED
|
@@ -19,13 +19,11 @@ export { useIsMobile } from "./_core/hooks/useIsMobile";
|
|
|
19
19
|
export { useToken } from "./_core/hooks/useToken";
|
|
20
20
|
export { useValidate } from "./_core/hooks/useValidate";
|
|
21
21
|
export { WidgetSupport } from "./_core/hooks/widgetSupport";
|
|
22
|
-
|
|
23
22
|
export { ButtonAction } from "./action/ButtonAction";
|
|
24
23
|
export { Badge } from "./badge/Badge";
|
|
25
24
|
export { Button } from "./button/Button";
|
|
26
25
|
export { ButtonActions } from "./button/buttonActions/ButtonActions";
|
|
27
26
|
export { ButtonFile } from "./button/buttonFile/ButtonFile";
|
|
28
|
-
export { ButtonFilters } from "./button/buttonFilters/ButtonFilters";
|
|
29
27
|
export { Card } from "./card/Card";
|
|
30
28
|
export { Carousel } from "./carousel/Carousel";
|
|
31
29
|
export { Damier } from "./damier/Damier";
|
|
@@ -23,15 +23,13 @@ export type PositionOverlay =
|
|
|
23
23
|
| "bottomRight";
|
|
24
24
|
|
|
25
25
|
export type OverlayPanelProps = {
|
|
26
|
-
referenceElement?: HTMLElement
|
|
26
|
+
referenceElement?: HTMLElement;
|
|
27
27
|
coordonnees?: { top: number; left: number };
|
|
28
28
|
position?: PositionOverlay;
|
|
29
29
|
children: React.ReactNode;
|
|
30
30
|
show?: boolean;
|
|
31
31
|
id?: string;
|
|
32
|
-
className?: string;
|
|
33
32
|
closeOverlay?: (close: boolean) => void;
|
|
34
|
-
usePortal?: boolean;
|
|
35
33
|
};
|
|
36
34
|
|
|
37
35
|
export const OverlayPanel = forwardRef(
|
|
@@ -42,19 +40,17 @@ export const OverlayPanel = forwardRef(
|
|
|
42
40
|
coordonnees,
|
|
43
41
|
children,
|
|
44
42
|
show,
|
|
45
|
-
className,
|
|
46
43
|
id,
|
|
47
44
|
closeOverlay,
|
|
48
|
-
usePortal = true,
|
|
49
45
|
}: OverlayPanelProps,
|
|
50
46
|
ref: React.Ref<{
|
|
51
47
|
setCoords?: (coords: { top: number; left: number }) => void;
|
|
52
|
-
}
|
|
48
|
+
}>
|
|
53
49
|
) => {
|
|
54
50
|
const { activeOverlayId, setActiveOverlay } = useOverlayContext();
|
|
55
51
|
const [isShow, setIsShow] = useState(show || false);
|
|
56
52
|
const [coords, setCoords] = useState<{ top: number; left: number }>(
|
|
57
|
-
coordonnees ?? { top: 0, left: 0 }
|
|
53
|
+
coordonnees ?? { top: 0, left: 0 }
|
|
58
54
|
);
|
|
59
55
|
const boxRef = useRef<HTMLDivElement>(null);
|
|
60
56
|
const overlayId = useId();
|
|
@@ -151,7 +147,7 @@ export const OverlayPanel = forwardRef(
|
|
|
151
147
|
closeOverlay(false);
|
|
152
148
|
}
|
|
153
149
|
},
|
|
154
|
-
[closeOverlay, setActiveOverlay]
|
|
150
|
+
[closeOverlay, setActiveOverlay]
|
|
155
151
|
);
|
|
156
152
|
useEffect(() => {
|
|
157
153
|
const handleClickOutside = (event: MouseEvent) => {
|
|
@@ -176,10 +172,10 @@ export const OverlayPanel = forwardRef(
|
|
|
176
172
|
|
|
177
173
|
if (!isShow) return null;
|
|
178
174
|
|
|
179
|
-
|
|
175
|
+
return ReactDOM.createPortal(
|
|
180
176
|
<OverlayPanelStyled ref={boxRef} $top={coords.top} $left={coords.left}>
|
|
181
177
|
<div
|
|
182
|
-
className={`overlayPanel ${
|
|
178
|
+
className={`overlayPanel ${
|
|
183
179
|
coords.top > 0 || coords.left > 0 ? "visible" : "hide"
|
|
184
180
|
}`}
|
|
185
181
|
>
|
|
@@ -190,19 +186,10 @@ export const OverlayPanel = forwardRef(
|
|
|
190
186
|
>
|
|
191
187
|
<Icon classIcon="bi-x-lg" />
|
|
192
188
|
</button>
|
|
193
|
-
|
|
189
|
+
{children}
|
|
194
190
|
</div>
|
|
195
|
-
</OverlayPanelStyled
|
|
191
|
+
</OverlayPanelStyled>,
|
|
192
|
+
document.body
|
|
196
193
|
);
|
|
197
|
-
|
|
198
|
-
if (!usePortal) {
|
|
199
|
-
return (
|
|
200
|
-
<div className={`overlayPanel overlayPanel--no-portal `} ref={boxRef}>
|
|
201
|
-
<div onClick={(e) => e.stopPropagation()}>{children}</div>
|
|
202
|
-
</div>
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
return ReactDOM.createPortal(overlayContent, document.body);
|
|
207
|
-
},
|
|
194
|
+
}
|
|
208
195
|
);
|
|
@@ -7,11 +7,6 @@ interface OverlayContextType {
|
|
|
7
7
|
|
|
8
8
|
const OverlayContext = createContext<OverlayContextType | undefined>(undefined);
|
|
9
9
|
|
|
10
|
-
const defaultOverlayContext: OverlayContextType = {
|
|
11
|
-
activeOverlayId: null,
|
|
12
|
-
setActiveOverlay: () => {},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
10
|
export const OverlayProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
16
11
|
children,
|
|
17
12
|
}) => {
|
|
@@ -26,5 +21,8 @@ export const OverlayProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
26
21
|
|
|
27
22
|
export const useOverlayContext = () => {
|
|
28
23
|
const context = useContext(OverlayContext);
|
|
29
|
-
|
|
24
|
+
if (!context) {
|
|
25
|
+
throw new Error("useOverlayContext must be used within an OverlayProvider");
|
|
26
|
+
}
|
|
27
|
+
return context;
|
|
30
28
|
};
|
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
.overlayPanel {
|
|
2
2
|
position: relative;
|
|
3
3
|
|
|
4
|
-
&.overlayPanel--no-portal {
|
|
5
|
-
position: absolute;
|
|
6
|
-
z-index: 14 !important;
|
|
7
|
-
width: 100%;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
4
|
&.hide {
|
|
11
5
|
visibility: hidden;
|
|
12
6
|
}
|
|
13
|
-
|
|
14
7
|
&.visible {
|
|
15
8
|
visibility: visible !important;
|
|
16
9
|
}
|
|
17
|
-
|
|
18
10
|
button {
|
|
19
11
|
span {
|
|
20
12
|
text-align: left;
|
|
21
13
|
}
|
|
22
14
|
}
|
|
23
|
-
|
|
24
15
|
.toggle-btn {
|
|
25
16
|
display: flex;
|
|
26
17
|
justify-content: flex-end;
|
|
@@ -41,4 +32,4 @@
|
|
|
41
32
|
font-size: 1rem;
|
|
42
33
|
}
|
|
43
34
|
}
|
|
44
|
-
}
|
|
35
|
+
}
|