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
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { ChangeEvent, useRef } from "react";
|
|
2
|
-
import { Button } from "../Button";
|
|
3
|
-
|
|
4
|
-
interface ButtonFileProps {
|
|
5
|
-
onFileSelected?: (file: File, buffer: ArrayBuffer) => void;
|
|
6
|
-
accept?: string;
|
|
7
|
-
buttonText?: string;
|
|
8
|
-
buttonClassName?: string;
|
|
9
|
-
containerClassName?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const ButtonFile = ({
|
|
13
|
-
onFileSelected,
|
|
14
|
-
accept = "*",
|
|
15
|
-
buttonText = "Choisir un fichier",
|
|
16
|
-
buttonClassName,
|
|
17
|
-
containerClassName,
|
|
18
|
-
}: ButtonFileProps) => {
|
|
19
|
-
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
20
|
-
|
|
21
|
-
const handleFileChange = (e: ChangeEvent<HTMLInputElement>) => {
|
|
22
|
-
const file = e.target.files?.[0];
|
|
23
|
-
|
|
24
|
-
if (file && onFileSelected) {
|
|
25
|
-
const reader = new FileReader();
|
|
26
|
-
|
|
27
|
-
reader.onload = (event: ProgressEvent<FileReader>) => {
|
|
28
|
-
const buffer = event.target?.result as ArrayBuffer;
|
|
29
|
-
onFileSelected(file, buffer);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
reader.readAsArrayBuffer(file);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const handleButtonClick = () => {
|
|
37
|
-
fileInputRef.current?.click();
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<div className={containerClassName}>
|
|
42
|
-
<input
|
|
43
|
-
type="file"
|
|
44
|
-
ref={fileInputRef}
|
|
45
|
-
onChange={handleFileChange}
|
|
46
|
-
className="hidden"
|
|
47
|
-
accept={accept}
|
|
48
|
-
/>
|
|
49
|
-
<Button
|
|
50
|
-
onClick={handleButtonClick}
|
|
51
|
-
className={
|
|
52
|
-
buttonClassName ||
|
|
53
|
-
"bg-green-500 hover:bg-green-600 text-white font-medium py-3 px-6 rounded-lg transition-colors duration-200"
|
|
54
|
-
}
|
|
55
|
-
title={buttonText || "Choisir un fichier"}
|
|
56
|
-
/>
|
|
57
|
-
</div>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { ButtonFile } from "./ButtonFile";
|
|
2
|
-
|
|
3
|
-
export const ButtonFileView = () => {
|
|
4
|
-
const handleZipFile = (file: File, buffer: ArrayBuffer) => {
|
|
5
|
-
console.log("Fichier sélectionné:", file.name);
|
|
6
|
-
console.log("Type:", file.type);
|
|
7
|
-
console.log("Taille:", file.size);
|
|
8
|
-
console.log("Buffer:", buffer);
|
|
9
|
-
console.log("Taille du buffer:", buffer.byteLength);
|
|
10
|
-
|
|
11
|
-
// Convertir en Uint8Array si nécessaire
|
|
12
|
-
const uint8Array = new Uint8Array(buffer);
|
|
13
|
-
console.log("Uint8Array:", uint8Array);
|
|
14
|
-
|
|
15
|
-
// Faites ce que vous voulez avec le buffer ici
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<div className="min-h-screen bg-gray-50 p-8">
|
|
20
|
-
<div className="max-w-2xl mx-auto space-y-6">
|
|
21
|
-
<div className="border-2 border-dashed border-gray-300 rounded-lg p-8 text-center bg-white">
|
|
22
|
-
<h2 className="text-2xl font-semibold mb-6 text-gray-800">
|
|
23
|
-
Exemple 1 : Fichier ZIP
|
|
24
|
-
</h2>
|
|
25
|
-
<ButtonFile
|
|
26
|
-
onFileSelected={handleZipFile}
|
|
27
|
-
accept=".zip"
|
|
28
|
-
buttonText="Sélectionner un ZIP"
|
|
29
|
-
/>
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
<div className="border-2 border-dashed border-gray-300 rounded-lg p-8 text-center bg-white">
|
|
33
|
-
<h2 className="text-2xl font-semibold mb-6 text-gray-800">
|
|
34
|
-
Exemple 2 : Tout type de fichier
|
|
35
|
-
</h2>
|
|
36
|
-
<ButtonFile
|
|
37
|
-
onFileSelected={(file: File, buffer: ArrayBuffer) => {
|
|
38
|
-
console.log(
|
|
39
|
-
"Fichier:",
|
|
40
|
-
file.name,
|
|
41
|
-
"Buffer size:",
|
|
42
|
-
buffer.byteLength,
|
|
43
|
-
);
|
|
44
|
-
}}
|
|
45
|
-
buttonText="Sélectionner n'importe quel fichier"
|
|
46
|
-
buttonClassName="bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-4 rounded"
|
|
47
|
-
/>
|
|
48
|
-
</div>
|
|
49
|
-
|
|
50
|
-
<div className="border-2 border-dashed border-gray-300 rounded-lg p-8 text-center bg-white">
|
|
51
|
-
<h2 className="text-2xl font-semibold mb-6 text-gray-800">
|
|
52
|
-
Exemple 3 : Images uniquement
|
|
53
|
-
</h2>
|
|
54
|
-
<ButtonFile
|
|
55
|
-
onFileSelected={(file: File, buffer: ArrayBuffer) => {
|
|
56
|
-
console.log("Image:", file.name);
|
|
57
|
-
// Créer une URL pour prévisualiser l'image
|
|
58
|
-
const blob = new Blob([buffer], { type: file.type });
|
|
59
|
-
const url = URL.createObjectURL(blob);
|
|
60
|
-
console.log("URL de prévisualisation:", url);
|
|
61
|
-
}}
|
|
62
|
-
accept="image/*"
|
|
63
|
-
buttonText="Sélectionner une image"
|
|
64
|
-
buttonClassName="bg-purple-500 hover:bg-purple-600 text-white font-medium py-3 px-6 rounded-lg"
|
|
65
|
-
/>
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
);
|
|
70
|
-
};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
-
import { DynamicForm } from "../../form/Form";
|
|
3
|
-
import { FormInterface, FormValuesInterface } from "../../form/form.interface";
|
|
4
|
-
import { Icon } from "../../icon/Icon";
|
|
5
|
-
import { IconSizeEnum } from "../../icon/iconSize.enum";
|
|
6
|
-
import "./buttonFilters.css";
|
|
7
|
-
export type ButtonActionsProps<
|
|
8
|
-
T extends { [key: string]: string | number | boolean | Date | string[] },
|
|
9
|
-
> = {
|
|
10
|
-
className?: string;
|
|
11
|
-
onClick?: (e: React.MouseEvent) => void;
|
|
12
|
-
title: string;
|
|
13
|
-
classIcon?: string;
|
|
14
|
-
sizeIcon?: IconSizeEnum;
|
|
15
|
-
dataForm: FormInterface[];
|
|
16
|
-
onChange?: (values: FormValuesInterface<T>) => void;
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
id?: string;
|
|
19
|
-
};
|
|
20
|
-
export const ButtonFilters = <
|
|
21
|
-
T extends { [key: string]: string | number | boolean | Date | string[] },
|
|
22
|
-
>({
|
|
23
|
-
className,
|
|
24
|
-
onClick,
|
|
25
|
-
title,
|
|
26
|
-
classIcon,
|
|
27
|
-
sizeIcon,
|
|
28
|
-
disabled = false,
|
|
29
|
-
id,
|
|
30
|
-
dataForm,
|
|
31
|
-
onChange,
|
|
32
|
-
}: ButtonActionsProps<T>) => {
|
|
33
|
-
const buttonRef = useRef<HTMLButtonElement | null>(null);
|
|
34
|
-
const [openFilters, setOpenFilters] = useState(false);
|
|
35
|
-
const handleClick = (e: React.MouseEvent) => {
|
|
36
|
-
e.preventDefault();
|
|
37
|
-
setOpenFilters(!openFilters);
|
|
38
|
-
if (onClick) {
|
|
39
|
-
onClick(e);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
const handleClickOutside = useCallback(
|
|
43
|
-
(event: MouseEvent) => {
|
|
44
|
-
if (
|
|
45
|
-
buttonRef.current &&
|
|
46
|
-
!buttonRef.current.contains(event.target as Node)
|
|
47
|
-
) {
|
|
48
|
-
setOpenFilters(false);
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
[setOpenFilters],
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
if (openFilters) {
|
|
56
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
57
|
-
} else {
|
|
58
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return () => {
|
|
62
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
63
|
-
};
|
|
64
|
-
}, [openFilters, handleClickOutside]);
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<>
|
|
68
|
-
<button
|
|
69
|
-
ref={buttonRef}
|
|
70
|
-
id={id ?? ""}
|
|
71
|
-
disabled={disabled}
|
|
72
|
-
type="button"
|
|
73
|
-
onClick={(e) => handleClick(e)}
|
|
74
|
-
className={` ${className} button--filters button--transparent `}
|
|
75
|
-
>
|
|
76
|
-
{classIcon && (
|
|
77
|
-
<span>
|
|
78
|
-
<Icon
|
|
79
|
-
classIcon={classIcon}
|
|
80
|
-
size={sizeIcon || IconSizeEnum.EXTRA_SMALL}
|
|
81
|
-
/>
|
|
82
|
-
</span>
|
|
83
|
-
)}
|
|
84
|
-
<span className=" flex-1">{title}</span>
|
|
85
|
-
{openFilters && (
|
|
86
|
-
<div
|
|
87
|
-
className="button--filters-overlay"
|
|
88
|
-
onClick={(e) => e.stopPropagation()}
|
|
89
|
-
>
|
|
90
|
-
<div className="button--filters-overlay-content">
|
|
91
|
-
<DynamicForm
|
|
92
|
-
onChange={onChange as any}
|
|
93
|
-
initialForm={dataForm}
|
|
94
|
-
hideSubmit
|
|
95
|
-
/>
|
|
96
|
-
</div>
|
|
97
|
-
</div>
|
|
98
|
-
)}
|
|
99
|
-
</button>
|
|
100
|
-
</>
|
|
101
|
-
);
|
|
102
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
.button--filters {
|
|
2
|
-
position: relative;
|
|
3
|
-
.button--filters-overlay {
|
|
4
|
-
position: absolute;
|
|
5
|
-
margin-top: 0.25rem;
|
|
6
|
-
top: 100%;
|
|
7
|
-
left: 0;
|
|
8
|
-
background-color: white;
|
|
9
|
-
border: 1px solid #ccc;
|
|
10
|
-
padding: 10px;
|
|
11
|
-
z-index: 1000;
|
|
12
|
-
border-radius: 4px;
|
|
13
|
-
width: 100%;
|
|
14
|
-
.button--filters-overlay-content {
|
|
15
|
-
display: flex;
|
|
16
|
-
gap: 0.5rem;
|
|
17
|
-
label {
|
|
18
|
-
color: #333;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { useCallback, useState } from "react";
|
|
2
|
-
import { Icon } from "../icon/Icon";
|
|
3
|
-
import { PositionOverlay } from "../overlayPanel/OverlayPanel";
|
|
4
|
-
import "./card.css";
|
|
5
|
-
import { CardInterface } from "./card.interface";
|
|
6
|
-
import { CardActionInterface } from "./cardAction.interface";
|
|
7
|
-
import { CardAction } from "./cardAction/CardAction";
|
|
8
|
-
type CardProps = {
|
|
9
|
-
item: CardInterface;
|
|
10
|
-
actions?: CardActionInterface[];
|
|
11
|
-
className?: string;
|
|
12
|
-
handleClick?: (item: CardInterface) => void;
|
|
13
|
-
onClose?: (item: CardInterface) => void;
|
|
14
|
-
children?: JSX.Element;
|
|
15
|
-
customAction?: JSX.Element;
|
|
16
|
-
positionOverlay?: PositionOverlay;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// Composant Card modifié
|
|
20
|
-
export const Card = ({
|
|
21
|
-
item,
|
|
22
|
-
actions,
|
|
23
|
-
className,
|
|
24
|
-
handleClick,
|
|
25
|
-
onClose,
|
|
26
|
-
customAction,
|
|
27
|
-
positionOverlay,
|
|
28
|
-
children,
|
|
29
|
-
}: CardProps): JSX.Element => {
|
|
30
|
-
const [cliqueAction, setCliqueAction] = useState(false);
|
|
31
|
-
const [openActions, setOpenActions] = useState(false);
|
|
32
|
-
const [positions, setPositions] = useState<{ top: number; left: number }>();
|
|
33
|
-
const onClickClose = (e: React.MouseEvent, item: CardInterface) => {
|
|
34
|
-
e.stopPropagation();
|
|
35
|
-
if (onClose) {
|
|
36
|
-
onClose(item);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const onClickCard = useCallback(
|
|
40
|
-
(e: React.MouseEvent, item: CardInterface) => {
|
|
41
|
-
e.stopPropagation();
|
|
42
|
-
if (openActions) {
|
|
43
|
-
setPositions(undefined);
|
|
44
|
-
return setOpenActions(false);
|
|
45
|
-
}
|
|
46
|
-
if (
|
|
47
|
-
(e.target as HTMLElement).closest(".qte") ||
|
|
48
|
-
(e.target as HTMLElement).closest(".card-action-menu button") ||
|
|
49
|
-
(e.target as HTMLElement).closest(".card-actions")
|
|
50
|
-
) {
|
|
51
|
-
return; // Ne propage pas l'événement si le clic est dans Quantity
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
setCliqueAction(!cliqueAction);
|
|
55
|
-
|
|
56
|
-
if (handleClick && e.button !== 2) {
|
|
57
|
-
handleClick(item);
|
|
58
|
-
} else {
|
|
59
|
-
setPositions({ top: e.clientY, left: e.clientX });
|
|
60
|
-
setOpenActions(true);
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
[
|
|
64
|
-
setCliqueAction,
|
|
65
|
-
setPositions,
|
|
66
|
-
handleClick,
|
|
67
|
-
openActions,
|
|
68
|
-
setOpenActions,
|
|
69
|
-
cliqueAction,
|
|
70
|
-
]
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<div
|
|
75
|
-
onContextMenu={(e) => e.preventDefault()}
|
|
76
|
-
onMouseDown={(e) => onClickCard(e, item)}
|
|
77
|
-
className={`card ${className ?? ""} ${
|
|
78
|
-
cliqueAction ? "card--active" : ""
|
|
79
|
-
} `}
|
|
80
|
-
>
|
|
81
|
-
{children}
|
|
82
|
-
{!children && (
|
|
83
|
-
<>
|
|
84
|
-
<div className="card-text d-flex">
|
|
85
|
-
{item.image && (
|
|
86
|
-
<div className="card-img">
|
|
87
|
-
<img src={item.image} alt={"card-image"} />
|
|
88
|
-
</div>
|
|
89
|
-
)}
|
|
90
|
-
{item.title && <div className="card-title">{item.title}</div>}
|
|
91
|
-
{item.description && (
|
|
92
|
-
<div className="card-content">{item.description}</div>
|
|
93
|
-
)}
|
|
94
|
-
</div>
|
|
95
|
-
<div className="card-footer">
|
|
96
|
-
{customAction && (
|
|
97
|
-
<div className="card-custom-action">{customAction}</div>
|
|
98
|
-
)}
|
|
99
|
-
<div className="d-flex flex-1 align-items-center">
|
|
100
|
-
{item.prix && <div className="card-prix">{item.prix}</div>}
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
103
|
-
{onClose && (
|
|
104
|
-
<div
|
|
105
|
-
className="ml-2 cursor-pointer"
|
|
106
|
-
onClick={(e) => onClickClose(e, item)}
|
|
107
|
-
>
|
|
108
|
-
<Icon classIcon="bi-trash3" />
|
|
109
|
-
</div>
|
|
110
|
-
)}
|
|
111
|
-
{actions && (
|
|
112
|
-
<CardAction
|
|
113
|
-
openActions={openActions}
|
|
114
|
-
setOpenActions={setOpenActions}
|
|
115
|
-
actions={actions}
|
|
116
|
-
item={item}
|
|
117
|
-
positions={positions}
|
|
118
|
-
positionOverlay={positionOverlay}
|
|
119
|
-
/>
|
|
120
|
-
)}
|
|
121
|
-
</>
|
|
122
|
-
)}
|
|
123
|
-
</div>
|
|
124
|
-
);
|
|
125
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
|
-
import { Grid } from "../grid/Grid";
|
|
3
|
-
import { GridInterface } from "../grid/grid.interface";
|
|
4
|
-
import { Quantity } from "../quantity/Quantity";
|
|
5
|
-
import { Card } from "./Card";
|
|
6
|
-
import { CardInterface } from "./card.interface";
|
|
7
|
-
import { CardActionInterface } from "./cardAction.interface";
|
|
8
|
-
export const CardView = (): JSX.Element => {
|
|
9
|
-
const [actions, setActions] = useState<GridInterface[]>([]);
|
|
10
|
-
const mockItems: CardInterface[] = [
|
|
11
|
-
{
|
|
12
|
-
title: "Client",
|
|
13
|
-
image:
|
|
14
|
-
"https://www.papapiqueetmamancoud.fr/media/cache/app_product_small_thumbnail_listing_cropped/41/a2/e90184ab12b765859580b529d2ec.jpg",
|
|
15
|
-
description: "Description 1",
|
|
16
|
-
prix: "59.18 €",
|
|
17
|
-
quantity: 12,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
title: "Produits",
|
|
21
|
-
prix: "59.18 €",
|
|
22
|
-
quantity: 1,
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
title: "Total",
|
|
26
|
-
description: "Description 3",
|
|
27
|
-
quantity: 1,
|
|
28
|
-
},
|
|
29
|
-
];
|
|
30
|
-
const actionsCard: CardActionInterface[] = useMemo(() => {
|
|
31
|
-
return [
|
|
32
|
-
{
|
|
33
|
-
icon: "bi-trash3",
|
|
34
|
-
label: "Supprimer la transaction",
|
|
35
|
-
type: "menu",
|
|
36
|
-
onClick: (item: CardInterface) => console.log(item),
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
icon: "bi-trash3",
|
|
40
|
-
label: "Editer la transaction",
|
|
41
|
-
type: "menu",
|
|
42
|
-
onClick: (item: CardInterface) => console.log(item),
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
icon: "bi-pencil",
|
|
46
|
-
label: "Editer",
|
|
47
|
-
onClick: (item: CardInterface) => console.log(item),
|
|
48
|
-
},
|
|
49
|
-
];
|
|
50
|
-
}, []);
|
|
51
|
-
|
|
52
|
-
const setQuantity = useCallback((item: CardInterface, qte: number) => {
|
|
53
|
-
console.log(qte, item);
|
|
54
|
-
}, []);
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
const initActions: GridInterface[] = mockItems.map((item) => {
|
|
57
|
-
return {
|
|
58
|
-
children: (
|
|
59
|
-
<Card
|
|
60
|
-
className="card--horizontal"
|
|
61
|
-
item={item}
|
|
62
|
-
actions={actionsCard}
|
|
63
|
-
customAction={
|
|
64
|
-
<Quantity pas={1} item={item} setQuantity={setQuantity} />
|
|
65
|
-
}
|
|
66
|
-
/>
|
|
67
|
-
),
|
|
68
|
-
};
|
|
69
|
-
});
|
|
70
|
-
setActions(initActions);
|
|
71
|
-
}, [setActions, setQuantity]);
|
|
72
|
-
return <Grid items={actions} />;
|
|
73
|
-
};
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
.card {
|
|
2
|
-
border: 1px solid #cfbdbd;
|
|
3
|
-
border-radius: 10px;
|
|
4
|
-
padding: 1rem;
|
|
5
|
-
max-width: 200px;
|
|
6
|
-
height: 100%;
|
|
7
|
-
overflow: hidden;
|
|
8
|
-
position: relative;
|
|
9
|
-
flex-wrap: wrap;
|
|
10
|
-
|
|
11
|
-
.card-overlay {
|
|
12
|
-
display: none;
|
|
13
|
-
position: absolute;
|
|
14
|
-
background-color: rgba(0, 0, 0, 0.1);
|
|
15
|
-
width: 100%;
|
|
16
|
-
left: 0;
|
|
17
|
-
right: 0;
|
|
18
|
-
top: 0;
|
|
19
|
-
bottom: 0;
|
|
20
|
-
pointer-events: none;
|
|
21
|
-
}
|
|
22
|
-
.bi-three-dots-vertical {
|
|
23
|
-
display: none;
|
|
24
|
-
}
|
|
25
|
-
.card-custom-action {
|
|
26
|
-
display: flex;
|
|
27
|
-
flex: 1;
|
|
28
|
-
justify-content: start;
|
|
29
|
-
align-items: center;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.bi-trash3 {
|
|
33
|
-
font-size: 1rem;
|
|
34
|
-
}
|
|
35
|
-
.card-text {
|
|
36
|
-
width: 100%;
|
|
37
|
-
}
|
|
38
|
-
.card-footer {
|
|
39
|
-
display: flex;
|
|
40
|
-
flex: 1;
|
|
41
|
-
align-items: center;
|
|
42
|
-
justify-content: space-between;
|
|
43
|
-
}
|
|
44
|
-
&.card--horizontal {
|
|
45
|
-
display: flex;
|
|
46
|
-
flex-direction: row;
|
|
47
|
-
align-items: center;
|
|
48
|
-
min-height: 56px;
|
|
49
|
-
max-width: initial;
|
|
50
|
-
.card-img {
|
|
51
|
-
margin-right: 0.5rem;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.card-content {
|
|
55
|
-
flex: 1;
|
|
56
|
-
min-width: 200px;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.card-title {
|
|
60
|
-
width: calc(100% - 20px);
|
|
61
|
-
margin-bottom: 1rem;
|
|
62
|
-
}
|
|
63
|
-
.card-action {
|
|
64
|
-
position: absolute;
|
|
65
|
-
right: 10px;
|
|
66
|
-
top: 10px;
|
|
67
|
-
}
|
|
68
|
-
.card-prix {
|
|
69
|
-
flex: 1;
|
|
70
|
-
display: flex;
|
|
71
|
-
justify-content: flex-end;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
&:not(.card--horizontal) {
|
|
76
|
-
.card-title {
|
|
77
|
-
margin-bottom: 1rem;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.card-img {
|
|
82
|
-
width: 30px;
|
|
83
|
-
|
|
84
|
-
img {
|
|
85
|
-
width: 100%;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.card-title {
|
|
90
|
-
font-size: 14px;
|
|
91
|
-
font-weight: 600;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.card-content {
|
|
95
|
-
font-size: 14px;
|
|
96
|
-
font-weight: 400;
|
|
97
|
-
display: none;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
@container (min-width: 992px) {
|
|
101
|
-
.card {
|
|
102
|
-
.card-custom-action {
|
|
103
|
-
justify-content: end;
|
|
104
|
-
}
|
|
105
|
-
.bi-three-dots-vertical {
|
|
106
|
-
display: block;
|
|
107
|
-
}
|
|
108
|
-
.bi-three-dots {
|
|
109
|
-
display: none;
|
|
110
|
-
}
|
|
111
|
-
&.card--horizontal {
|
|
112
|
-
.card-actions {
|
|
113
|
-
margin-left: 0.5rem;
|
|
114
|
-
}
|
|
115
|
-
.card-footer {
|
|
116
|
-
display: flex;
|
|
117
|
-
flex: 1;
|
|
118
|
-
justify-content: space-between;
|
|
119
|
-
}
|
|
120
|
-
.card-text {
|
|
121
|
-
width: 300px;
|
|
122
|
-
display: flex;
|
|
123
|
-
align-items: center;
|
|
124
|
-
}
|
|
125
|
-
.card-content {
|
|
126
|
-
display: flex;
|
|
127
|
-
}
|
|
128
|
-
.card-title {
|
|
129
|
-
min-width: auto;
|
|
130
|
-
width: auto;
|
|
131
|
-
margin-right: 1rem;
|
|
132
|
-
margin-bottom: 0;
|
|
133
|
-
}
|
|
134
|
-
.card-prix {
|
|
135
|
-
flex: inherit;
|
|
136
|
-
min-width: auto;
|
|
137
|
-
}
|
|
138
|
-
.card-action {
|
|
139
|
-
position: relative;
|
|
140
|
-
right: initial;
|
|
141
|
-
top: initial;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|