kelt-ui-kit-react 1.8.9 → 1.9.0

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.
Files changed (120) hide show
  1. package/dist/App.js +22 -0
  2. package/dist/App.menu.js +251 -0
  3. package/dist/App.routes.js +8 -0
  4. package/dist/_core/hooks/HistoryProvider.js +29 -0
  5. package/dist/_core/hooks/ImageChecker.js +68 -0
  6. package/dist/_core/hooks/imageExist.js +5 -0
  7. package/dist/_core/hooks/isEAN13.js +10 -0
  8. package/dist/_core/hooks/objectToQueryParams.js +28 -0
  9. package/dist/_core/hooks/useCurrency.js +12 -0
  10. package/dist/_core/hooks/useDateutils.js +59 -0
  11. package/dist/_core/hooks/useIsMobile.js +13 -0
  12. package/dist/_core/hooks/useToken.js +17 -0
  13. package/dist/_core/hooks/useValidate.js +15 -0
  14. package/dist/_core/hooks/widgetSupport.js +18 -0
  15. package/dist/action/Action.view.js +22 -0
  16. package/dist/action/ButtonAction.js +25 -0
  17. package/dist/badge/Badge.js +25 -0
  18. package/dist/badge/Badge.view.js +5 -0
  19. package/dist/button/Button.js +25 -0
  20. package/dist/button/Button.view.js +74 -0
  21. package/dist/button/button.interface.js +1 -0
  22. package/dist/button/buttonActions/ButtonActions.js +55 -0
  23. package/dist/button/buttonFile/ButtonFile.js +37 -0
  24. package/dist/button/buttonFile/ButtonFile.view.js +35 -0
  25. package/dist/button/buttonFilters/ButtonFilters.js +47 -0
  26. package/dist/card/Card.js +57 -0
  27. package/dist/card/Card.view.js +60 -0
  28. package/dist/card/card.interface.js +1 -0
  29. package/dist/card/cardAction/CardAction.js +66 -0
  30. package/dist/card/cardAction.interface.js +1 -0
  31. package/dist/card/hook/useCardInteractions.js +25 -0
  32. package/dist/carousel/Carousel.js +67 -0
  33. package/dist/carousel/Carousel.view.js +16 -0
  34. package/dist/damier/Damier.js +48 -0
  35. package/dist/damier/Damier.view.js +22 -0
  36. package/dist/damier/damierCell/DamierCell.js +21 -0
  37. package/dist/damier/damierCell/damierCell.interface.js +1 -0
  38. package/dist/dataTable/DataTable.js +117 -0
  39. package/dist/dataTable/DataTable.view.js +48 -0
  40. package/dist/dataTable/dataTable.interface.js +1 -0
  41. package/dist/dataTable/dataTableActions/DataTableAction.js +26 -0
  42. package/dist/dataTable/dataTableColumn/DataTableColumn.js +21 -0
  43. package/dist/dataTable/dataTableLoading/DataTableLoading.js +16 -0
  44. package/dist/dataTable/dataTableRow/DataTableRow.js +39 -0
  45. package/dist/datePicker/DatePicker.js +64 -0
  46. package/dist/datePicker/DatePicker.view.js +5 -0
  47. package/dist/expands/Expands.js +28 -0
  48. package/dist/expands/Expands.view.js +67 -0
  49. package/dist/expands/expand/expand.interface.js +1 -0
  50. package/dist/expands/expand/expand.js +40 -0
  51. package/dist/filAriane/FilAriane.js +28 -0
  52. package/dist/filAriane/FilAriane.view.js +28 -0
  53. package/dist/filAriane/filAriane.interface.js +1 -0
  54. package/dist/form/Form.js +135 -0
  55. package/dist/form/Form.view.js +50 -0
  56. package/dist/form/form.enum.js +14 -0
  57. package/dist/form/form.interface.js +1 -0
  58. package/dist/form/input/Input.js +26 -0
  59. package/dist/form/inputNumber/InputNumber.js +57 -0
  60. package/dist/form/inputNumber/InputNumber.view.js +7 -0
  61. package/dist/form/inputPrice/InputPrice.js +36 -0
  62. package/dist/form/inputPrice/InputPrice.view.js +7 -0
  63. package/dist/form/textArea/TextArea.js +18 -0
  64. package/dist/form/textArea/TextArea.view.js +15 -0
  65. package/dist/grid/Grid.js +19 -0
  66. package/dist/grid/Grid.view.js +22 -0
  67. package/dist/grid/col/Col.js +17 -0
  68. package/dist/grid/col/colStyled/ColStyled.js +26 -0
  69. package/dist/grid/container/Container.js +17 -0
  70. package/dist/grid/grid.interface.js +1 -0
  71. package/dist/grid/row/Row.js +17 -0
  72. package/dist/header/Header.js +26 -0
  73. package/dist/header/Header.view.js +5 -0
  74. package/dist/header/header.interface.js +1 -0
  75. package/dist/home/Home.js +4 -0
  76. package/dist/icon/Icon.js +6 -0
  77. package/dist/icon/Icons.view.js +27 -0
  78. package/dist/icon/icon.interface.js +1 -0
  79. package/dist/icon/iconSize.enum.js +8 -0
  80. package/dist/index.js +50 -5382
  81. package/dist/loader/Loader.js +20 -0
  82. package/dist/loader/Loader.view.js +9 -0
  83. package/dist/main.js +7 -0
  84. package/dist/menus/Menus.js +23 -0
  85. package/dist/menus/Menus.view.js +48 -0
  86. package/dist/menus/menu/Menu.js +15 -0
  87. package/dist/menus/menu/menu.interface.js +1 -0
  88. package/dist/message/Message.js +33 -0
  89. package/dist/message/Message.view.js +11 -0
  90. package/dist/modal/Modal.js +27 -0
  91. package/dist/modal/Modal.view.js +22 -0
  92. package/dist/notFound/NotFound.js +4 -0
  93. package/dist/overlayPanel/OverlayPanel.js +132 -0
  94. package/dist/overlayPanel/OverlayPanel.view.js +20 -0
  95. package/dist/overlayPanel/overlay.context.js +26 -0
  96. package/dist/overlayPanel/overlayPanelStyled/OverlayPanelStyled.js +13 -0
  97. package/dist/pdfViewer/PdfViewer.js +71 -0
  98. package/dist/pdfViewer/PdfViewer.view.js +5 -0
  99. package/dist/quantity/Quantity.js +60 -0
  100. package/dist/quantity/Quantity.view.js +1 -0
  101. package/dist/search/Search.js +80 -0
  102. package/dist/search/Search.view.js +8 -0
  103. package/dist/select/Select.d.ts +2 -1
  104. package/dist/select/Select.js +41 -0
  105. package/dist/select/Select.view.js +75 -0
  106. package/dist/select/selectOption.interface.js +1 -0
  107. package/dist/sidebar/Sidebar.js +132 -0
  108. package/dist/sidebar/Sidebar.view.js +11 -0
  109. package/dist/sidebarData/SidebarData.js +17 -0
  110. package/dist/sidebarData/SidebarData.view.js +14 -0
  111. package/dist/tabs/Tabs.js +41 -0
  112. package/dist/tabs/Tabs.view.js +26 -0
  113. package/dist/toaster/Toaster.js +37 -0
  114. package/dist/toaster/Toaster.view.js +16 -0
  115. package/dist/toaster/store/useToasterStore.js +22 -0
  116. package/package.json +1 -1
  117. package/src/dataTable/DataTable.tsx +10 -3
  118. package/src/dataTable/dataTableRow/DataTableRow.tsx +23 -10
  119. package/src/select/Select.tsx +4 -1
  120. package/vite.config.ts.timestamp-1787675603363-8ddae73d076bd.mjs +28 -0
@@ -0,0 +1,25 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { Badge } from "../badge/Badge";
14
+ import { Icon } from "../icon/Icon";
15
+ import "./button.css";
16
+ export var Button = function (_a) {
17
+ var className = _a.className, onClick = _a.onClick, badge = _a.badge, title = _a.title, sizeIcon = _a.sizeIcon, id = _a.id, classIcon = _a.classIcon, _b = _a.positionicon, positionicon = _b === void 0 ? 1 : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c;
18
+ var handleClick = function (e) {
19
+ e.stopPropagation();
20
+ if (onClick) {
21
+ onClick(e);
22
+ }
23
+ };
24
+ return (_jsxs("button", __assign({ id: id !== null && id !== void 0 ? id : "", disabled: disabled, type: "submit", onClick: function (e) { return handleClick(e); }, className: className }, { children: [badge && _jsx(Badge, __assign({}, badge)), classIcon && positionicon == 1 && (_jsx("span", __assign({ className: "".concat(title ? "mr-2" : "") }, { children: _jsx(Icon, { size: sizeIcon, classIcon: classIcon }) }))), _jsx("span", { children: title }), classIcon && positionicon == 2 && (_jsx("span", __assign({ className: "ml-2" }, { children: _jsx(Icon, { classIcon: classIcon }) })))] })));
25
+ };
@@ -0,0 +1,74 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useMemo } from "react";
14
+ import { TypeInputEnum } from "../form/form.enum";
15
+ import { Button } from "./Button";
16
+ import { ButtonActions, } from "./buttonActions/ButtonActions";
17
+ import { ButtonFilters } from "./buttonFilters/ButtonFilters";
18
+ export var ButtonView = function () {
19
+ var initialValues = [
20
+ {
21
+ value: false,
22
+ name: "test1",
23
+ label: "test 1",
24
+ type: TypeInputEnum.CHECKBOX,
25
+ },
26
+ {
27
+ value: false,
28
+ name: "test2",
29
+ label: "test 2",
30
+ type: TypeInputEnum.CHECKBOX,
31
+ },
32
+ ];
33
+ var mockButtonItems = [
34
+ {
35
+ title: "Envoyer",
36
+ onClick: function () { return console.log("Envoyer"); },
37
+ classIcon: "bi-send",
38
+ disabled: true,
39
+ positionicon: 1,
40
+ badge: {
41
+ className: "badge--primary",
42
+ title: "Badge",
43
+ sizeIcon: undefined,
44
+ classIcon: "bi-check-circle",
45
+ onClick: function () { return console.log("Badge clicked"); },
46
+ },
47
+ },
48
+ {
49
+ title: "Annuler",
50
+ onClick: function () { return console.log("Envoyer"); },
51
+ className: "button--secondary",
52
+ },
53
+ ];
54
+ var mockButtonAction = useMemo(function () {
55
+ return {
56
+ title: "Supprimer",
57
+ onClick: function () { return console.log("Supprimer"); },
58
+ className: "button--secondary",
59
+ actions: [
60
+ {
61
+ id: "1",
62
+ label: "Supprimer",
63
+ onClick: function () { return console.log("Supprimer action"); },
64
+ },
65
+ {
66
+ id: "2",
67
+ label: "Supprimer définitivement",
68
+ onClick: function () { return console.log("Supprimer définitivement"); },
69
+ },
70
+ ],
71
+ };
72
+ }, []);
73
+ return (_jsxs("div", __assign({ className: "d-flex" }, { children: [mockButtonItems.map(function (item, index) { return (_jsx("div", __assign({ className: "mr-2" }, { children: _jsx(Button, __assign({}, item)) }), index)); }), _jsx(ButtonActions, __assign({}, mockButtonAction)), _jsx("div", __assign({ className: "ml-2" }, { children: _jsx(ButtonFilters, __assign({ classIcon: "bi-send" }, mockButtonAction, { dataForm: initialValues })) }))] })));
74
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,55 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { useCallback, useMemo, useRef, useState } from "react";
14
+ import { Icon } from "../../icon/Icon";
15
+ import { IconSizeEnum } from "../../icon/iconSize.enum";
16
+ import { Menus } from "../../menus/Menus";
17
+ import { OverlayPanel } from "../../overlayPanel/OverlayPanel";
18
+ import { Button } from "../Button";
19
+ export var ButtonActions = function (_a) {
20
+ var className = _a.className, onClick = _a.onClick, title = _a.title, actions = _a.actions, _b = _a.positionActions, positionActions = _b === void 0 ? "topRight" : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, id = _a.id;
21
+ var handleClick = function (e) {
22
+ e.preventDefault();
23
+ if (onClick) {
24
+ onClick(e);
25
+ }
26
+ };
27
+ var refButton = useRef(null);
28
+ var _d = useState(false), openOverlay = _d[0], setOpenOverlay = _d[1];
29
+ var onClickActions = useCallback(function (e) {
30
+ e.stopPropagation();
31
+ if (actions)
32
+ setOpenOverlay(!openOverlay);
33
+ }, [openOverlay, setOpenOverlay]);
34
+ var overlayMenu = useMemo(function () {
35
+ if (!actions)
36
+ return [];
37
+ return actions.map(function (a, index) {
38
+ var _a;
39
+ return {
40
+ id: (_a = a.id) !== null && _a !== void 0 ? _a : index,
41
+ icon: a.icon,
42
+ name: a.label,
43
+ children: (_jsx(Button, { classIcon: a.icon, sizeIcon: IconSizeEnum.LARGE, onClick: function (e) {
44
+ e.stopPropagation();
45
+ closeOverlay();
46
+ a.onClick && a.onClick(a);
47
+ }, title: a.label || "" }, index)),
48
+ };
49
+ });
50
+ }, [actions]);
51
+ var closeOverlay = useCallback(function () {
52
+ setOpenOverlay(false);
53
+ }, [setOpenOverlay]);
54
+ return (_jsxs(_Fragment, { children: [_jsxs("button", __assign({ id: id !== null && id !== void 0 ? id : "", disabled: disabled, type: "submit", onClick: function (e) { return handleClick(e); }, className: " ".concat(className, " button-actions") }, { children: [_jsx("span", __assign({ className: "mr-2 flex-1" }, { children: title })), _jsx("span", __assign({ className: "ml-2", ref: refButton, onClick: function (e) { return onClickActions(e); } }, { children: _jsx(Icon, { classIcon: "bi-chevron-up" }) }))] })), actions && openOverlay && refButton.current && (_jsx(OverlayPanel, { show: openOverlay, position: positionActions, closeOverlay: setOpenOverlay, referenceElement: refButton.current, children: _jsx("div", { children: _jsx(Menus, { className: "card-action-menu", items: overlayMenu }) }) }))] }));
55
+ };
@@ -0,0 +1,37 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useRef } from "react";
14
+ import { Button } from "../Button";
15
+ export var ButtonFile = function (_a) {
16
+ var onFileSelected = _a.onFileSelected, _b = _a.accept, accept = _b === void 0 ? "*" : _b, _c = _a.buttonText, buttonText = _c === void 0 ? "Choisir un fichier" : _c, buttonClassName = _a.buttonClassName, containerClassName = _a.containerClassName;
17
+ var fileInputRef = useRef(null);
18
+ var handleFileChange = function (e) {
19
+ var _a;
20
+ var file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
21
+ if (file && onFileSelected) {
22
+ var reader = new FileReader();
23
+ reader.onload = function (event) {
24
+ var _a;
25
+ var buffer = (_a = event.target) === null || _a === void 0 ? void 0 : _a.result;
26
+ onFileSelected(file, buffer);
27
+ };
28
+ reader.readAsArrayBuffer(file);
29
+ }
30
+ };
31
+ var handleButtonClick = function () {
32
+ var _a;
33
+ (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click();
34
+ };
35
+ return (_jsxs("div", __assign({ className: containerClassName }, { children: [_jsx("input", { type: "file", ref: fileInputRef, onChange: handleFileChange, className: "hidden", accept: accept }), _jsx(Button, { onClick: handleButtonClick, className: buttonClassName ||
36
+ "bg-green-500 hover:bg-green-600 text-white font-medium py-3 px-6 rounded-lg transition-colors duration-200", title: buttonText || "Choisir un fichier" })] })));
37
+ };
@@ -0,0 +1,35 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { ButtonFile } from "./ButtonFile";
14
+ export var ButtonFileView = function () {
15
+ var handleZipFile = function (file, buffer) {
16
+ console.log("Fichier sélectionné:", file.name);
17
+ console.log("Type:", file.type);
18
+ console.log("Taille:", file.size);
19
+ console.log("Buffer:", buffer);
20
+ console.log("Taille du buffer:", buffer.byteLength);
21
+ // Convertir en Uint8Array si nécessaire
22
+ var uint8Array = new Uint8Array(buffer);
23
+ console.log("Uint8Array:", uint8Array);
24
+ // Faites ce que vous voulez avec le buffer ici
25
+ };
26
+ return (_jsx("div", __assign({ className: "min-h-screen bg-gray-50 p-8" }, { children: _jsxs("div", __assign({ className: "max-w-2xl mx-auto space-y-6" }, { children: [_jsxs("div", __assign({ className: "border-2 border-dashed border-gray-300 rounded-lg p-8 text-center bg-white" }, { children: [_jsx("h2", __assign({ className: "text-2xl font-semibold mb-6 text-gray-800" }, { children: "Exemple 1 : Fichier ZIP" })), _jsx(ButtonFile, { onFileSelected: handleZipFile, accept: ".zip", buttonText: "S\u00E9lectionner un ZIP" })] })), _jsxs("div", __assign({ className: "border-2 border-dashed border-gray-300 rounded-lg p-8 text-center bg-white" }, { children: [_jsx("h2", __assign({ className: "text-2xl font-semibold mb-6 text-gray-800" }, { children: "Exemple 2 : Tout type de fichier" })), _jsx(ButtonFile, { onFileSelected: function (file, buffer) {
27
+ console.log("Fichier:", file.name, "Buffer size:", buffer.byteLength);
28
+ }, buttonText: "S\u00E9lectionner n'importe quel fichier", buttonClassName: "bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-4 rounded" })] })), _jsxs("div", __assign({ className: "border-2 border-dashed border-gray-300 rounded-lg p-8 text-center bg-white" }, { children: [_jsx("h2", __assign({ className: "text-2xl font-semibold mb-6 text-gray-800" }, { children: "Exemple 3 : Images uniquement" })), _jsx(ButtonFile, { onFileSelected: function (file, buffer) {
29
+ console.log("Image:", file.name);
30
+ // Créer une URL pour prévisualiser l'image
31
+ var blob = new Blob([buffer], { type: file.type });
32
+ var url = URL.createObjectURL(blob);
33
+ console.log("URL de prévisualisation:", url);
34
+ }, accept: "image/*", buttonText: "S\u00E9lectionner une image", buttonClassName: "bg-purple-500 hover:bg-purple-600 text-white font-medium py-3 px-6 rounded-lg" })] }))] })) })));
35
+ };
@@ -0,0 +1,47 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { useCallback, useEffect, useRef, useState } from "react";
14
+ import { DynamicForm } from "../../form/Form";
15
+ import { Icon } from "../../icon/Icon";
16
+ import { IconSizeEnum } from "../../icon/iconSize.enum";
17
+ import "./buttonFilters.css";
18
+ export var ButtonFilters = function (_a) {
19
+ var className = _a.className, onClick = _a.onClick, title = _a.title, classIcon = _a.classIcon, sizeIcon = _a.sizeIcon, _b = _a.disabled, disabled = _b === void 0 ? false : _b, id = _a.id, dataForm = _a.dataForm, onChange = _a.onChange;
20
+ var buttonRef = useRef(null);
21
+ var _c = useState(false), openFilters = _c[0], setOpenFilters = _c[1];
22
+ var handleClick = function (e) {
23
+ e.preventDefault();
24
+ setOpenFilters(!openFilters);
25
+ if (onClick) {
26
+ onClick(e);
27
+ }
28
+ };
29
+ var handleClickOutside = useCallback(function (event) {
30
+ if (buttonRef.current &&
31
+ !buttonRef.current.contains(event.target)) {
32
+ setOpenFilters(false);
33
+ }
34
+ }, [setOpenFilters]);
35
+ useEffect(function () {
36
+ if (openFilters) {
37
+ document.addEventListener("mousedown", handleClickOutside);
38
+ }
39
+ else {
40
+ document.removeEventListener("mousedown", handleClickOutside);
41
+ }
42
+ return function () {
43
+ document.removeEventListener("mousedown", handleClickOutside);
44
+ };
45
+ }, [openFilters, handleClickOutside]);
46
+ return (_jsx(_Fragment, { children: _jsxs("button", __assign({ ref: buttonRef, id: id !== null && id !== void 0 ? id : "", disabled: disabled, type: "button", onClick: function (e) { return handleClick(e); }, className: " ".concat(className, " button--filters button--transparent ") }, { children: [classIcon && (_jsx("span", { children: _jsx(Icon, { classIcon: classIcon, size: sizeIcon || IconSizeEnum.EXTRA_SMALL }) })), _jsx("span", __assign({ className: " flex-1" }, { children: title })), openFilters && (_jsx("div", __assign({ className: "button--filters-overlay", onClick: function (e) { return e.stopPropagation(); } }, { children: _jsx("div", __assign({ className: "button--filters-overlay-content" }, { children: _jsx(DynamicForm, { onChange: onChange, initialForm: dataForm, hideSubmit: true }) })) })))] })) }));
47
+ };
@@ -0,0 +1,57 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { useCallback, useState } from "react";
14
+ import { Icon } from "../icon/Icon";
15
+ import "./card.css";
16
+ import { CardAction } from "./cardAction/CardAction";
17
+ // Composant Card modifié
18
+ export var Card = function (_a) {
19
+ var item = _a.item, actions = _a.actions, className = _a.className, handleClick = _a.handleClick, onClose = _a.onClose, customAction = _a.customAction, positionOverlay = _a.positionOverlay, children = _a.children;
20
+ var _b = useState(false), cliqueAction = _b[0], setCliqueAction = _b[1];
21
+ var _c = useState(false), openActions = _c[0], setOpenActions = _c[1];
22
+ var _d = useState(), positions = _d[0], setPositions = _d[1];
23
+ var onClickClose = function (e, item) {
24
+ e.stopPropagation();
25
+ if (onClose) {
26
+ onClose(item);
27
+ }
28
+ };
29
+ var onClickCard = useCallback(function (e, item) {
30
+ e.stopPropagation();
31
+ if (openActions) {
32
+ setPositions(undefined);
33
+ return setOpenActions(false);
34
+ }
35
+ if (e.target.closest(".qte") ||
36
+ e.target.closest(".card-action-menu button") ||
37
+ e.target.closest(".card-actions")) {
38
+ return; // Ne propage pas l'événement si le clic est dans Quantity
39
+ }
40
+ setCliqueAction(!cliqueAction);
41
+ if (handleClick && e.button !== 2) {
42
+ handleClick(item);
43
+ }
44
+ else {
45
+ setPositions({ top: e.clientY, left: e.clientX });
46
+ setOpenActions(true);
47
+ }
48
+ }, [
49
+ setCliqueAction,
50
+ setPositions,
51
+ handleClick,
52
+ openActions,
53
+ setOpenActions,
54
+ cliqueAction,
55
+ ]);
56
+ return (_jsxs("div", __assign({ onContextMenu: function (e) { return e.preventDefault(); }, onMouseDown: function (e) { return onClickCard(e, item); }, className: "card ".concat(className !== null && className !== void 0 ? className : "", " ").concat(cliqueAction ? "card--active" : "", " ") }, { children: [children, !children && (_jsxs(_Fragment, { children: [_jsxs("div", __assign({ className: "card-text d-flex" }, { children: [item.image && (_jsx("div", __assign({ className: "card-img" }, { children: _jsx("img", { src: item.image, alt: "card-image" }) }))), item.title && _jsx("div", __assign({ className: "card-title" }, { children: item.title })), item.description && (_jsx("div", __assign({ className: "card-content" }, { children: item.description })))] })), _jsxs("div", __assign({ className: "card-footer" }, { children: [customAction && (_jsx("div", __assign({ className: "card-custom-action" }, { children: customAction }))), _jsx("div", __assign({ className: "d-flex flex-1 align-items-center" }, { children: item.prix && _jsx("div", __assign({ className: "card-prix" }, { children: item.prix })) }))] })), onClose && (_jsx("div", __assign({ className: "ml-2 cursor-pointer", onClick: function (e) { return onClickClose(e, item); } }, { children: _jsx(Icon, { classIcon: "bi-trash3" }) }))), actions && (_jsx(CardAction, { openActions: openActions, setOpenActions: setOpenActions, actions: actions, item: item, positions: positions, positionOverlay: positionOverlay }))] }))] })));
57
+ };
@@ -0,0 +1,60 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useMemo, useState } from "react";
3
+ import { Grid } from "../grid/Grid";
4
+ import { Quantity } from "../quantity/Quantity";
5
+ import { Card } from "./Card";
6
+ export var CardView = function () {
7
+ var _a = useState([]), actions = _a[0], setActions = _a[1];
8
+ var mockItems = [
9
+ {
10
+ title: "Client",
11
+ image: "https://www.papapiqueetmamancoud.fr/media/cache/app_product_small_thumbnail_listing_cropped/41/a2/e90184ab12b765859580b529d2ec.jpg",
12
+ description: "Description 1",
13
+ prix: "59.18 €",
14
+ quantity: 12,
15
+ },
16
+ {
17
+ title: "Produits",
18
+ prix: "59.18 €",
19
+ quantity: 1,
20
+ },
21
+ {
22
+ title: "Total",
23
+ description: "Description 3",
24
+ quantity: 1,
25
+ },
26
+ ];
27
+ var actionsCard = useMemo(function () {
28
+ return [
29
+ {
30
+ icon: "bi-trash3",
31
+ label: "Supprimer la transaction",
32
+ type: "menu",
33
+ onClick: function (item) { return console.log(item); },
34
+ },
35
+ {
36
+ icon: "bi-trash3",
37
+ label: "Editer la transaction",
38
+ type: "menu",
39
+ onClick: function (item) { return console.log(item); },
40
+ },
41
+ {
42
+ icon: "bi-pencil",
43
+ label: "Editer",
44
+ onClick: function (item) { return console.log(item); },
45
+ },
46
+ ];
47
+ }, []);
48
+ var setQuantity = useCallback(function (item, qte) {
49
+ console.log(qte, item);
50
+ }, []);
51
+ useEffect(function () {
52
+ var initActions = mockItems.map(function (item) {
53
+ return {
54
+ children: (_jsx(Card, { className: "card--horizontal", item: item, actions: actionsCard, customAction: _jsx(Quantity, { pas: 1, item: item, setQuantity: setQuantity }) })),
55
+ };
56
+ });
57
+ setActions(initActions);
58
+ }, [setActions, setQuantity]);
59
+ return _jsx(Grid, { items: actions });
60
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,66 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
14
+ import { Button } from "../../button/Button";
15
+ import { Icon } from "../../icon/Icon";
16
+ import { IconSizeEnum } from "../../icon/iconSize.enum";
17
+ import { Menus } from "../../menus/Menus";
18
+ import { OverlayPanel } from "../../overlayPanel/OverlayPanel";
19
+ import "./cardAction.css";
20
+ export var CardAction = function (_a) {
21
+ var actions = _a.actions, openActions = _a.openActions, item = _a.item, positions = _a.positions, positionOverlay = _a.positionOverlay, setOpenActions = _a.setOpenActions;
22
+ var overlaypanelRef = useRef(null);
23
+ var _b = useState(positionOverlay), position = _b[0], setPosition = _b[1];
24
+ var refButton = useRef(null);
25
+ var _c = useState(openActions !== null && openActions !== void 0 ? openActions : false), openOverlay = _c[0], setOpenOverlay = _c[1];
26
+ useEffect(function () {
27
+ if (openActions) {
28
+ setOpenOverlay(openActions);
29
+ }
30
+ }, [openActions]);
31
+ var handleChangeOverlay = useCallback(function (e, openOverlay) {
32
+ if (actions.length === 0)
33
+ return;
34
+ e.preventDefault();
35
+ setPosition("bottomRight");
36
+ if (setOpenActions) {
37
+ setOpenActions(openOverlay);
38
+ }
39
+ }, [setPosition, setOpenActions]);
40
+ var closeOverlay = useCallback(function () {
41
+ setPosition(undefined);
42
+ setOpenOverlay(false);
43
+ if (setOpenActions) {
44
+ setOpenActions(false);
45
+ }
46
+ }, [setOpenOverlay, setPosition, setOpenActions]);
47
+ var overlayMenu = useMemo(function () {
48
+ return actions === null || actions === void 0 ? void 0 : actions.filter(function (a) { return a.type === "menu"; }).map(function (a, index) {
49
+ var label = a.label || "";
50
+ if (a.setLabel && item) {
51
+ label = a.setLabel(item);
52
+ }
53
+ return {
54
+ id: index,
55
+ icon: a.icon,
56
+ name: a.label,
57
+ children: (_jsx(Button, { classIcon: a.icon, disabled: item && a.disabled ? a.disabled(item) : false, sizeIcon: IconSizeEnum.LARGE, onClick: function (e) {
58
+ e.stopPropagation();
59
+ closeOverlay();
60
+ a.onClick && item && a.onClick(item);
61
+ }, title: label }, index)),
62
+ };
63
+ });
64
+ }, [actions]);
65
+ return (_jsxs("div", __assign({ className: "card-actions" }, { children: [_jsxs("div", __assign({ ref: refButton, className: "card-action ".concat(actions.filter(function (a) { return a.type === "menu"; }).length ? "visible" : "hidden"), onClick: function (e) { return handleChangeOverlay(e, !openOverlay); } }, { children: [_jsx(Icon, { size: IconSizeEnum.MEDIUM, classIcon: "bi-three-dots-vertical cursor-pointer" }), _jsx(Icon, { size: IconSizeEnum.MEDIUM, classIcon: "bi-three-dots cursor-pointer" })] })), openOverlay && refButton.current && (_jsx(OverlayPanel, { position: position, show: openOverlay, ref: overlaypanelRef, closeOverlay: closeOverlay, coordonnees: positions, referenceElement: refButton.current, children: _jsx("div", { children: _jsx(Menus, { className: "card-action-menu", items: overlayMenu }) }) }))] })));
66
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import { useEffect, useRef, useState } from "react";
2
+ // Hook personnalisé pour détecter les clics en dehors et le survol
3
+ export var useCardInteractions = function (callback) {
4
+ var ref = useRef(null);
5
+ var _a = useState(false), isHovered = _a[0], setIsHovered = _a[1];
6
+ useEffect(function () {
7
+ var handleClickOutside = function (event) {
8
+ if (ref.current && !ref.current.contains(event.target)) {
9
+ callback();
10
+ }
11
+ };
12
+ document.addEventListener("mousedown", handleClickOutside);
13
+ return function () {
14
+ document.removeEventListener("mousedown", handleClickOutside);
15
+ };
16
+ }, [callback]);
17
+ var mouseHandlers = {
18
+ onMouseEnter: function () { return setIsHovered(true); },
19
+ onMouseLeave: function () {
20
+ setIsHovered(false);
21
+ callback(); // Déclenche le callback quand la souris quitte la carte
22
+ },
23
+ };
24
+ return { ref: ref, isHovered: isHovered, mouseHandlers: mouseHandlers };
25
+ };
@@ -0,0 +1,67 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import React, { useCallback, useEffect, useState } from "react";
14
+ import { Icon } from "../icon/Icon";
15
+ import "./Carousel.css";
16
+ export var Carousel = function (_a) {
17
+ var children = _a.children, _b = _a.showControls, showControls = _b === void 0 ? true : _b, _c = _a.itemsToScroll, itemsToScroll = _c === void 0 ? 1 : _c, _d = _a.breakpoints, breakpoints = _d === void 0 ? {
18
+ sm: 2,
19
+ md: 3,
20
+ lg: 4,
21
+ xl: 5,
22
+ } : _d;
23
+ var _e = useState(0), currentIndex = _e[0], setCurrentIndex = _e[1];
24
+ var totalItems = children.length;
25
+ var _f = useState(1), itemsToShow = _f[0], setItemsToShow = _f[1];
26
+ useEffect(function () {
27
+ var updateItemsToShow = function () {
28
+ var width = window.innerWidth;
29
+ if (breakpoints.xl && width >= 1200) {
30
+ return setItemsToShow(breakpoints.xl);
31
+ }
32
+ if (breakpoints.lg && width >= 992) {
33
+ return setItemsToShow(breakpoints.lg);
34
+ }
35
+ if (breakpoints.md && width >= 768) {
36
+ return setItemsToShow(breakpoints.md);
37
+ }
38
+ if (breakpoints.sm && width >= 576) {
39
+ return setItemsToShow(breakpoints.sm);
40
+ }
41
+ };
42
+ updateItemsToShow();
43
+ window.addEventListener("resize", updateItemsToShow);
44
+ return function () { return window.removeEventListener("resize", updateItemsToShow); };
45
+ }, [breakpoints]);
46
+ var nextSlide = useCallback(function (e) {
47
+ e.preventDefault();
48
+ setCurrentIndex(function (prevIndex) {
49
+ return Math.min(prevIndex + itemsToScroll, totalItems - itemsToShow);
50
+ });
51
+ }, [setCurrentIndex]);
52
+ var prevSlide = useCallback(function (e) {
53
+ e.preventDefault();
54
+ setCurrentIndex(function (prevIndex) { return Math.max(prevIndex - itemsToScroll, 0); });
55
+ }, [setCurrentIndex]);
56
+ var isNextDisabled = currentIndex + itemsToScroll >= totalItems - itemsToShow + 1;
57
+ var allItemsVisible = totalItems <= itemsToShow;
58
+ var isPrevDisabled = currentIndex <= 0;
59
+ return (_jsxs("div", __assign({ className: "carousel" }, { children: [showControls && !allItemsVisible && (_jsx("div", __assign({ className: "carousel-control prev ".concat(isPrevDisabled && "disabled"), onClick: prevSlide }, { children: _jsx(Icon, { classIcon: "bi-chevron-left" }) }))), _jsx("div", __assign({ className: "carousel-container" }, { children: _jsx("div", __assign({ className: "carousel-slides-wrapper", style: {
60
+ display: "flex",
61
+ transform: "translateX(-".concat((currentIndex * 100) / itemsToShow, "%)"),
62
+ transition: "transform 0.5s ease-in-out",
63
+ } }, { children: React.Children.map(children, function (child) { return (_jsx("div", __assign({ className: "carousel-slide", style: {
64
+ minWidth: "".concat(100 / itemsToShow, "%"),
65
+ boxSizing: "border-box",
66
+ } }, { children: child }))); }) })) })), showControls && !allItemsVisible && (_jsx("div", __assign({ className: "carousel-control next ".concat(isNextDisabled && "disabled"), onClick: nextSlide }, { children: _jsx(Icon, { classIcon: "bi-chevron-right" }) })))] })));
67
+ };
@@ -0,0 +1,16 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { Carousel } from "./Carousel";
14
+ export var CarouselView = function () {
15
+ return (_jsxs(Carousel, __assign({ showControls: true }, { children: [_jsx("div", __assign({ style: { background: "red" } }, { children: "Slide 1" })), _jsx("div", __assign({ style: { background: "blue" } }, { children: "Slide 2" })), _jsx("div", __assign({ style: { background: "green" } }, { children: "Slide 3" })), _jsx("div", __assign({ style: { background: "orange" } }, { children: "Slide 4" })), _jsx("div", __assign({ style: { background: "purple" } }, { children: "Slide 5" }))] })));
16
+ };
@@ -0,0 +1,48 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { useEffect, useMemo, useState } from "react";
14
+ import "./damier.css";
15
+ import { DamierCell } from "./damierCell/DamierCell";
16
+ export var Damier = function (_a) {
17
+ var cols = _a.cols, rows = _a.rows, _b = _a.damierCells, damierCells = _b === void 0 ? [] : _b, _c = _a.page, page = _c === void 0 ? 1 : _c, onClick = _a.onClick;
18
+ var nbCols = useMemo(function () { return cols !== null && cols !== void 0 ? cols : 9; }, [cols]);
19
+ var nbRows = useMemo(function () { return Math.max(1, rows !== null && rows !== void 0 ? rows : 9); }, [rows]);
20
+ var _d = useState(1), currentPage = _d[0], setCurrentPage = _d[1];
21
+ useEffect(function () {
22
+ setCurrentPage(page);
23
+ }, [page]);
24
+ // Génération des cases du damier
25
+ var grid = useMemo(function () {
26
+ var rowsArray = [];
27
+ for (var row = 0; row < nbRows; row++) {
28
+ var colsArray = [];
29
+ var _loop_1 = function (col) {
30
+ var position = col + row * nbCols;
31
+ var cell = damierCells === null || damierCells === void 0 ? void 0 : damierCells.find(function (cell) { return cell.position === position + 1; });
32
+ if (!cell) {
33
+ colsArray.push(_jsx("div", { className: "cell cell--empty" }, "".concat(row, "-").concat(col)));
34
+ }
35
+ else {
36
+ colsArray.push(_jsx(DamierCell, { onClick: onClick, cell: cell }, "".concat(row, "-").concat(col)));
37
+ }
38
+ };
39
+ for (var col = 0; col < nbCols; col++) {
40
+ _loop_1(col);
41
+ }
42
+ rowsArray.push(_jsx("div", __assign({ className: "row" }, { children: colsArray }), row));
43
+ }
44
+ return rowsArray;
45
+ }, [nbCols, nbRows, currentPage]);
46
+ var damierStyle = useMemo(function () { return ({ "--rows": String(nbRows) }); }, [nbRows]);
47
+ return (_jsx("div", __assign({ className: "damier", style: damierStyle }, { children: grid })));
48
+ };