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