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.
Files changed (243) hide show
  1. package/dist/badge/Badge.d.ts +1 -3
  2. package/dist/button/button.interface.d.ts +1 -1
  3. package/dist/dataTable/DataTable.d.ts +3 -17
  4. package/dist/dataTable/dataTable.interface.d.ts +3 -21
  5. package/dist/dataTable/dataTableActions/DataTableAction.d.ts +2 -2
  6. package/dist/dataTable/dataTableColumn/DataTableColumn.d.ts +7 -13
  7. package/dist/dataTable/dataTableLoading/DataTableLoading.d.ts +3 -1
  8. package/dist/dataTable/dataTableRow/DataTableRow.d.ts +3 -5
  9. package/dist/expands/expand/expand.d.ts +1 -1
  10. package/dist/form/form.enum.d.ts +0 -1
  11. package/dist/form/input/Input.d.ts +0 -3
  12. package/dist/form/inputNumber/InputNumber.d.ts +2 -0
  13. package/dist/icon/Icon.d.ts +1 -1
  14. package/dist/icon/icon.interface.d.ts +0 -1
  15. package/dist/index.d.ts +0 -1
  16. package/dist/index.js +2836 -3652
  17. package/dist/overlayPanel/OverlayPanel.d.ts +1 -3
  18. package/dist/select/Select.d.ts +1 -4
  19. package/dist/select/selectOption.interface.d.ts +0 -1
  20. package/dist/style.css +1 -1
  21. package/dist/tabs/Tabs.d.ts +1 -2
  22. package/package.json +1 -1
  23. package/src/badge/Badge.tsx +1 -9
  24. package/src/badge/badge.css +0 -4
  25. package/src/button/Button.tsx +1 -1
  26. package/src/button/button.interface.tsx +1 -1
  27. package/src/card/card.css +3 -23
  28. package/src/card/cardAction/CardAction.tsx +4 -4
  29. package/src/damier/damier.css +3 -2
  30. package/src/dataTable/DataTable.tsx +45 -670
  31. package/src/dataTable/DataTable.view.tsx +14 -47
  32. package/src/dataTable/dataTable.css +5 -153
  33. package/src/dataTable/dataTable.interface.ts +3 -21
  34. package/src/dataTable/dataTableActions/DataTableAction.tsx +2 -2
  35. package/src/dataTable/dataTableColumn/DataTableColumn.tsx +14 -64
  36. package/src/dataTable/dataTableLoading/DataTableLoading.tsx +15 -4
  37. package/src/dataTable/dataTableRow/DataTableRow.tsx +33 -60
  38. package/src/expands/Expands.tsx +16 -2
  39. package/src/expands/expand/expand.tsx +18 -6
  40. package/src/form/Form.tsx +12 -13
  41. package/src/form/form.css +2 -13
  42. package/src/form/form.enum.ts +0 -1
  43. package/src/form/input/Input.tsx +7 -61
  44. package/src/form/input/input.css +1 -23
  45. package/src/form/inputNumber/InputNumber.tsx +11 -6
  46. package/src/form/inputPrice/InputPrice.tsx +4 -2
  47. package/src/icon/Icon.tsx +2 -6
  48. package/src/icon/icon.interface.tsx +0 -1
  49. package/src/index.ts +0 -2
  50. package/src/overlayPanel/OverlayPanel.tsx +10 -23
  51. package/src/overlayPanel/overlay.context.tsx +4 -6
  52. package/src/overlayPanel/overlayPanel.css +1 -10
  53. package/src/select/Select.tsx +38 -134
  54. package/src/select/select.css +14 -65
  55. package/src/select/selectOption.interface.ts +0 -1
  56. package/src/sidebar/Sidebar.tsx +80 -9
  57. package/src/sidebar/sidebar.css +18 -1
  58. package/src/tabs/Tabs.tsx +1 -19
  59. package/dist/_core/type/generiqueType.d.ts +0 -4
  60. package/dist/dataTable/dataTableColumn/dataTableColumnFilter/DataTableColumnFilter.d.ts +0 -10
  61. package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDate/DataTableColumnFilterDate.d.ts +0 -9
  62. package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDateRange/dataTableColumnFilterDateRange.d.ts +0 -9
  63. package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterEnum/DataTableColumnFilterEnum.d.ts +0 -13
  64. package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterString/DataTableColumnFilterString.d.ts +0 -9
  65. package/dist/dataTable/dataTableColumn/dataTableColumnSort/DataTableColumnSort.d.ts +0 -11
  66. package/dist/dataTable/dataTableFilters/DataTableFilters.d.ts +0 -7
  67. package/dist/dataTable/dataTableRow/dataTableRowOverlay/DataTableRowOverlay.d.ts +0 -12
  68. package/dist/dataTable/dataTableRow/dataTableRowValue/DataTableRowValue.d.ts +0 -11
  69. package/kelt-ui-kit-react-1.6.9.tgz +0 -0
  70. package/package/README.md +0 -46
  71. package/package/index.html +0 -20
  72. package/package/package.json +0 -56
  73. package/package/public/favicon.ico +0 -0
  74. package/package/public/index.html +0 -18
  75. package/package/public/logo192.png +0 -0
  76. package/package/public/logo512.png +0 -0
  77. package/package/public/manifest.json +0 -25
  78. package/package/public/robots.txt +0 -3
  79. package/package/src/App.css +0 -11
  80. package/package/src/App.menu.tsx +0 -249
  81. package/package/src/App.routes.tsx +0 -16
  82. package/package/src/App.tsx +0 -30
  83. package/package/src/_core/hooks/HistoryProvider.tsx +0 -25
  84. package/package/src/_core/hooks/ImageChecker.tsx +0 -26
  85. package/package/src/_core/hooks/imageExist.tsx +0 -9
  86. package/package/src/_core/hooks/isEAN13.tsx +0 -16
  87. package/package/src/_core/hooks/objectToQueryParams.tsx +0 -32
  88. package/package/src/_core/hooks/useCurrency.tsx +0 -18
  89. package/package/src/_core/hooks/useDateutils.ts +0 -64
  90. package/package/src/_core/hooks/useIsMobile.ts +0 -18
  91. package/package/src/_core/hooks/useToken.tsx +0 -19
  92. package/package/src/_core/hooks/useValidate.tsx +0 -18
  93. package/package/src/_core/hooks/widgetSupport.tsx +0 -39
  94. package/package/src/action/Action.view.tsx +0 -21
  95. package/package/src/action/ButtonAction.tsx +0 -32
  96. package/package/src/action/action.css +0 -20
  97. package/package/src/badge/Badge.tsx +0 -34
  98. package/package/src/badge/Badge.view.tsx +0 -15
  99. package/package/src/badge/badge.css +0 -55
  100. package/package/src/button/Button.tsx +0 -46
  101. package/package/src/button/Button.view.tsx +0 -85
  102. package/package/src/button/button.css +0 -53
  103. package/package/src/button/button.interface.tsx +0 -21
  104. package/package/src/button/buttonActions/ButtonActions.tsx +0 -104
  105. package/package/src/button/buttonFile/ButtonFile.tsx +0 -59
  106. package/package/src/button/buttonFile/ButtonFile.view.tsx +0 -70
  107. package/package/src/button/buttonFilters/ButtonFilters.tsx +0 -102
  108. package/package/src/button/buttonFilters/buttonFilters.css +0 -22
  109. package/package/src/card/Card.tsx +0 -125
  110. package/package/src/card/Card.view.tsx +0 -73
  111. package/package/src/card/card.css +0 -145
  112. package/package/src/card/card.interface.tsx +0 -9
  113. package/package/src/card/cardAction/CardAction.tsx +0 -135
  114. package/package/src/card/cardAction/cardAction.css +0 -10
  115. package/package/src/card/cardAction.interface.tsx +0 -10
  116. package/package/src/card/hook/useCardInteractions.tsx +0 -30
  117. package/package/src/carousel/Carousel.css +0 -44
  118. package/package/src/carousel/Carousel.tsx +0 -115
  119. package/package/src/carousel/Carousel.view.tsx +0 -13
  120. package/package/src/damier/Damier.tsx +0 -64
  121. package/package/src/damier/Damier.view.tsx +0 -31
  122. package/package/src/damier/damier.css +0 -50
  123. package/package/src/damier/damierCell/DamierCell.tsx +0 -18
  124. package/package/src/damier/damierCell/damierCell.interface.tsx +0 -5
  125. package/package/src/dataTable/DataTable.tsx +0 -259
  126. package/package/src/dataTable/DataTable.view.tsx +0 -62
  127. package/package/src/dataTable/dataTable.css +0 -30
  128. package/package/src/dataTable/dataTable.interface.ts +0 -30
  129. package/package/src/dataTable/dataTableActions/DataTableAction.tsx +0 -44
  130. package/package/src/dataTable/dataTableColumn/DataTableColumn.tsx +0 -27
  131. package/package/src/dataTable/dataTableLoading/DataTableLoading.tsx +0 -21
  132. package/package/src/dataTable/dataTableRow/DataTableRow.tsx +0 -54
  133. package/package/src/datePicker/DatePicker.tsx +0 -110
  134. package/package/src/datePicker/DatePicker.view.tsx +0 -9
  135. package/package/src/datePicker/datePicker.css +0 -77
  136. package/package/src/expands/Expands.tsx +0 -42
  137. package/package/src/expands/Expands.view.tsx +0 -90
  138. package/package/src/expands/expand/expand.interface.tsx +0 -8
  139. package/package/src/expands/expand/expand.tsx +0 -75
  140. package/package/src/expands/expands.css +0 -97
  141. package/package/src/filAriane/FilAriane.tsx +0 -57
  142. package/package/src/filAriane/FilAriane.view.tsx +0 -28
  143. package/package/src/filAriane/filAriane.css +0 -23
  144. package/package/src/filAriane/filAriane.interface.tsx +0 -6
  145. package/package/src/form/Form.tsx +0 -279
  146. package/package/src/form/Form.view.tsx +0 -59
  147. package/package/src/form/form.css +0 -62
  148. package/package/src/form/form.enum.ts +0 -13
  149. package/package/src/form/form.interface.tsx +0 -37
  150. package/package/src/form/input/Input.tsx +0 -106
  151. package/package/src/form/input/input.css +0 -26
  152. package/package/src/form/inputNumber/InputNumber.tsx +0 -132
  153. package/package/src/form/inputNumber/InputNumber.view.tsx +0 -15
  154. package/package/src/form/inputPrice/InputPrice.tsx +0 -42
  155. package/package/src/form/inputPrice/InputPrice.view.tsx +0 -15
  156. package/package/src/form/textArea/TextArea.tsx +0 -59
  157. package/package/src/form/textArea/TextArea.view.tsx +0 -34
  158. package/package/src/form/textArea/textArea.css +0 -9
  159. package/package/src/grid/Grid.tsx +0 -21
  160. package/package/src/grid/Grid.view.tsx +0 -24
  161. package/package/src/grid/col/Col.tsx +0 -15
  162. package/package/src/grid/col/colStyled/ColStyled.tsx +0 -41
  163. package/package/src/grid/container/Container.tsx +0 -8
  164. package/package/src/grid/container/container.css +0 -5
  165. package/package/src/grid/grid.interface.tsx +0 -7
  166. package/package/src/grid/row/Row.tsx +0 -12
  167. package/package/src/grid/row/row.css +0 -18
  168. package/package/src/header/Header.tsx +0 -62
  169. package/package/src/header/Header.view.tsx +0 -5
  170. package/package/src/header/header.css +0 -26
  171. package/package/src/header/header.interface.tsx +0 -10
  172. package/package/src/home/Home.tsx +0 -3
  173. package/package/src/icon/Icon.tsx +0 -6
  174. package/package/src/icon/Icons.view.tsx +0 -29
  175. package/package/src/icon/icon.css +0 -20
  176. package/package/src/icon/icon.interface.tsx +0 -6
  177. package/package/src/icon/iconSize.enum.ts +0 -7
  178. package/package/src/index.css +0 -502
  179. package/package/src/index.ts +0 -58
  180. package/package/src/loader/Loader.tsx +0 -37
  181. package/package/src/loader/Loader.view.tsx +0 -20
  182. package/package/src/loader/loader.css +0 -30
  183. package/package/src/logo.svg +0 -1
  184. package/package/src/main.tsx +0 -10
  185. package/package/src/menus/Menus.tsx +0 -42
  186. package/package/src/menus/Menus.view.tsx +0 -39
  187. package/package/src/menus/menu/Menu.tsx +0 -17
  188. package/package/src/menus/menu/menu.interface.tsx +0 -9
  189. package/package/src/menus/menus.css +0 -47
  190. package/package/src/message/Message.tsx +0 -30
  191. package/package/src/message/Message.view.tsx +0 -22
  192. package/package/src/message/message.css +0 -29
  193. package/package/src/modal/Modal.tsx +0 -59
  194. package/package/src/modal/Modal.view.tsx +0 -26
  195. package/package/src/modal/modal.css +0 -71
  196. package/package/src/notFound/NotFound.tsx +0 -3
  197. package/package/src/overlayPanel/OverlayPanel.tsx +0 -195
  198. package/package/src/overlayPanel/OverlayPanel.view.tsx +0 -25
  199. package/package/src/overlayPanel/overlay.context.tsx +0 -28
  200. package/package/src/overlayPanel/overlayPanel.css +0 -35
  201. package/package/src/overlayPanel/overlayPanelStyled/OverlayPanelStyled.tsx +0 -18
  202. package/package/src/pdfViewer/PdfViewer.tsx +0 -73
  203. package/package/src/pdfViewer/PdfViewer.view.tsx +0 -5
  204. package/package/src/quantity/Quantity.tsx +0 -103
  205. package/package/src/quantity/Quantity.view.tsx +0 -0
  206. package/package/src/quantity/quantity.css +0 -26
  207. package/package/src/search/Search.tsx +0 -161
  208. package/package/src/search/Search.view.tsx +0 -14
  209. package/package/src/search/search.css +0 -59
  210. package/package/src/select/Select.tsx +0 -103
  211. package/package/src/select/Select.view.tsx +0 -71
  212. package/package/src/select/select.css +0 -69
  213. package/package/src/select/selectOption.interface.ts +0 -4
  214. package/package/src/sidebar/Sidebar.tsx +0 -208
  215. package/package/src/sidebar/Sidebar.view.tsx +0 -17
  216. package/package/src/sidebar/sidebar.css +0 -104
  217. package/package/src/sidebarData/SidebarData.tsx +0 -19
  218. package/package/src/sidebarData/SidebarData.view.tsx +0 -19
  219. package/package/src/sidebarData/sidebarData.css +0 -27
  220. package/package/src/tabs/Tabs.tsx +0 -90
  221. package/package/src/tabs/Tabs.view.tsx +0 -20
  222. package/package/src/tabs/tabs.css +0 -24
  223. package/package/src/toaster/Toaster.tsx +0 -55
  224. package/package/src/toaster/Toaster.view.tsx +0 -24
  225. package/package/src/toaster/store/useToasterStore.tsx +0 -41
  226. package/package/src/toaster/toaster.css +0 -87
  227. package/package/tsconfig.json +0 -28
  228. package/package/vite.config.ts +0 -20
  229. package/package/vite.config.ts.timestamp-1733262892554-a13dfef6e8a29.mjs +0 -24
  230. package/package/vite.config.ts.timestamp-1757847121745-e5a5bf54b81b.mjs +0 -28
  231. package/package/vite.config.ts.timestamp-1759742478362-4ac5c5a7db34b.mjs +0 -28
  232. package/src/_core/type/generiqueType.tsx +0 -4
  233. package/src/dataTable/dataTableColumn/dataTableColumnFilter/DataTableColumnFilter.tsx +0 -36
  234. package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilter.css +0 -0
  235. package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDate/DataTableColumnFilterDate.tsx +0 -39
  236. package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDateRange/dataTableColumnFilterDateRange.tsx +0 -80
  237. package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterEnum/DataTableColumnFilterEnum.tsx +0 -89
  238. package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterString/DataTableColumnFilterString.tsx +0 -37
  239. package/src/dataTable/dataTableColumn/dataTableColumnSort/DataTableColumnSort.tsx +0 -42
  240. package/src/dataTable/dataTableFilters/DataTableFilters.tsx +0 -91
  241. package/src/dataTable/dataTableFilters/dataTableFilters.css +0 -16
  242. package/src/dataTable/dataTableRow/dataTableRowOverlay/DataTableRowOverlay.tsx +0 -80
  243. package/src/dataTable/dataTableRow/dataTableRowValue/DataTableRowValue.tsx +0 -123
@@ -1,64 +0,0 @@
1
- export function FormatDate(date: Date, format: string): string {
2
- const days = [
3
- "Dimanche",
4
- "Lundi",
5
- "Mardi",
6
- "Mercredi",
7
- "Jeudi",
8
- "Vendredi",
9
- "Samedi",
10
- ];
11
- const months = [
12
- "janvier",
13
- "février",
14
- "mars",
15
- "avril",
16
- "mai",
17
- "juin",
18
- "juillet",
19
- "août",
20
- "septembre",
21
- "octobre",
22
- "novembre",
23
- "décembre",
24
- ];
25
-
26
- if (!date) return "";
27
-
28
- const year = date.getFullYear().toString();
29
- const month = String(date.getMonth() + 1).padStart(2, "0"); // Mois en chiffres
30
- const day = String(date.getDate()).padStart(2, "0");
31
- const hours = String(date.getHours()).padStart(2, "0");
32
- const minutes = String(date.getMinutes()).padStart(2, "0");
33
- const seconds = String(date.getSeconds()).padStart(2, "0");
34
-
35
- const dayName = days[date.getDay()];
36
- const monthName = months[date.getMonth()];
37
-
38
- return format
39
- .replace("dddd", dayName) // Remplace d'abord "dddd"
40
- .replace("MMMM", monthName) // Puis "MMMM" pour éviter de modifier "MM"
41
- .replace("YYYY", year)
42
- .replace("MM", month) // Enfin, "MM" pour éviter d'écraser les valeurs de "MMMM"
43
- .replace("DD", day)
44
- .replace("HH", hours)
45
- .replace("mm", minutes)
46
- .replace("ss", seconds);
47
- }
48
- export function LocalDateStringToUTC(dateStr: string): string {
49
- const [year, month, day] = dateStr.split("-").map(Number);
50
-
51
- // Crée une date en heure locale
52
- const localDate = new Date(year, month - 1, day, 0, 0, 0);
53
-
54
- // Convertit en UTC ISO
55
- return localDate.toISOString();
56
- }
57
- export function localDateStartToUTC(dateStr: string): Date {
58
- const [y, m, d] = dateStr.split("-").map(Number);
59
- return new Date(y, m - 1, d, 0, 0, 0, 0);
60
- }
61
- export function localDateEndToUTC(dateStr: string): Date {
62
- const [y, m, d] = dateStr.split("-").map(Number);
63
- return new Date(y, m - 1, d, 23, 59, 59, 999);
64
- }
@@ -1,18 +0,0 @@
1
- import { useEffect, useState } from "react";
2
-
3
- export const useIsMobile = (maxWidth: number = 768) => {
4
- const [isMobile, setIsMobile] = useState(
5
- typeof window !== "undefined" ? window.innerWidth <= maxWidth : false
6
- );
7
-
8
- useEffect(() => {
9
- const handleResize = () => {
10
- setIsMobile(window.innerWidth <= maxWidth);
11
- };
12
-
13
- window.addEventListener("resize", handleResize);
14
- return () => window.removeEventListener("resize", handleResize);
15
- }, [maxWidth]);
16
-
17
- return isMobile;
18
- };
@@ -1,19 +0,0 @@
1
- import { jwtDecode } from "jwt-decode";
2
- import { useCallback } from "react";
3
-
4
- export const useToken = () => {
5
- const getTokenValidate = useCallback((): string | null => {
6
- const token = localStorage.getItem("token");
7
- if (!token) {
8
- return null;
9
- }
10
- const decoded = jwtDecode(token);
11
- const currentTime = Date.now() / 1000; // Convertir en secondes
12
- if (!decoded.exp || decoded.exp < currentTime) {
13
- return null;
14
- }
15
- return token;
16
- }, []);
17
-
18
- return { getTokenValidate };
19
- };
@@ -1,18 +0,0 @@
1
- export const useValidate = () => {
2
- const isValidateEmail = (input: string): boolean => {
3
- const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
4
- return emailRegex.test(input);
5
- };
6
-
7
- const isValidateTel = (input: string): boolean => {
8
- const emailRegex = /^\+?[0-9\s.-]{7,15}$/;
9
- return emailRegex.test(input);
10
- };
11
-
12
- const isValidateCodePostal = (input: string): boolean => {
13
- const emailRegex = /^[0-9]{5}$/;
14
- return emailRegex.test(input);
15
- };
16
-
17
- return { isValidateEmail, isValidateTel, isValidateCodePostal };
18
- };
@@ -1,39 +0,0 @@
1
- import { useEffect, useRef } from "react";
2
-
3
- export const WidgetSupport = () => {
4
- const targetRef = useRef<HTMLDivElement>(null);
5
- useEffect(() => {
6
- if (!targetRef.current) return;
7
- const script = document.createElement("script");
8
- script.type = "text/javascript";
9
- script.innerHTML = `
10
- !function(e,t,n){
11
- function a(){
12
- var e = t.getElementsByTagName("script")[0],
13
- n = t.createElement("script");
14
- n.type = "text/javascript";
15
- n.async = true;
16
- n.src = "https://beacon-v2.helpscout.net";
17
- e.parentNode.insertBefore(n,e);
18
- }
19
- if(e.Beacon = n = function(t,n,a){
20
- e.Beacon.readyQueue.push({method: t, options: n, data: a});
21
- }, n.readyQueue = [], t.readyState === "complete") return a();
22
- e.attachEvent ? e.attachEvent("onload", a) : e.addEventListener("load", a, false);
23
- }(window, document, window.Beacon || function(){});
24
-
25
- window.Beacon('init', '5deebca7-9d32-4a66-abba-f94a05fa0522');
26
- `;
27
- targetRef.current.appendChild(script);
28
-
29
- return () => {
30
- targetRef?.current?.removeChild(script);
31
- };
32
- }, []);
33
-
34
- return (
35
- <div>
36
- <div ref={targetRef} />
37
- </div>
38
- );
39
- };
@@ -1,21 +0,0 @@
1
- import { ButtonAction } from "./ButtonAction";
2
-
3
- export const ActionView = (): JSX.Element => {
4
- return (
5
- <div className="d-flex">
6
- <ButtonAction
7
- className="mr-2"
8
- onClick={() => console.log("Envoyer")}
9
- title="Envoyer"
10
- classIcon="bi-send"
11
- badge={{
12
- className: "badge--primary",
13
- title: "Badge",
14
- sizeIcon: undefined,
15
- classIcon: "bi-check-circle",
16
- onClick: () => console.log("Badge clicked"),
17
- }}
18
- />
19
- </div>
20
- );
21
- };
@@ -1,32 +0,0 @@
1
- import { Badge, BadgeInterface } from "../badge/Badge";
2
- import { Icon } from "../icon/Icon";
3
- import { IconSizeEnum } from "../icon/iconSize.enum";
4
- import "./action.css";
5
-
6
- export type ButtonActionProps = {
7
- className?: string;
8
- onClick?: (e: React.MouseEvent) => void;
9
- title?: string;
10
- classIcon?: string;
11
- badge?: BadgeInterface;
12
- };
13
- export const ButtonAction = ({
14
- className,
15
- onClick,
16
- title,
17
- classIcon,
18
- badge,
19
- }: ButtonActionProps) => {
20
- const handleClick = (e: React.MouseEvent) => {
21
- if (onClick) {
22
- onClick(e);
23
- }
24
- };
25
- return (
26
- <div className={`action ${className}`} onClick={handleClick}>
27
- {badge && <Badge {...badge} />}
28
- {classIcon && <Icon classIcon={classIcon} size={IconSizeEnum.LARGE} />}
29
- <small>{title}</small>
30
- </div>
31
- );
32
- };
@@ -1,20 +0,0 @@
1
- .action {
2
- background-color: var(--tertiary-color);
3
- color: #fff;
4
- position: relative;
5
- display: flex;
6
- align-items: center;
7
- flex-direction: column;
8
- justify-content: center;
9
- padding: 0.5rem 0.5rem;
10
- min-width: 120px;
11
- text-align: center;
12
- cursor: pointer;
13
- border-radius: 4px;
14
- height: 100%;
15
- .badge {
16
- position: absolute;
17
- right: 10px;
18
- top: -10px;
19
- }
20
- }
@@ -1,34 +0,0 @@
1
- import { useCallback } from "react";
2
- import { Icon } from "../icon/Icon";
3
- import { IconSizeEnum } from "../icon/iconSize.enum";
4
- import "./badge.css";
5
- export type BadgeInterface = {
6
- className?: string;
7
- onClick?: (e: React.MouseEvent) => void;
8
- title?: string;
9
- sizeIcon?: IconSizeEnum;
10
- classIcon?: string;
11
- };
12
- export const Badge = ({
13
- className,
14
- onClick,
15
- title,
16
- sizeIcon,
17
- classIcon,
18
- }: BadgeInterface) => {
19
- const handleClick = useCallback((e: React.MouseEvent) => {
20
- e.stopPropagation();
21
- if (onClick) {
22
- onClick(e);
23
- }
24
- }, []);
25
- return (
26
- <div
27
- onClick={handleClick}
28
- className={`badge ${className ? className : ""}`}
29
- >
30
- {classIcon && <Icon size={sizeIcon} classIcon={classIcon}></Icon>}
31
- <span>{title}</span>
32
- </div>
33
- );
34
- };
@@ -1,15 +0,0 @@
1
- import { Badge } from "./Badge";
2
-
3
- export const BadgeView = (): JSX.Element => {
4
- return (
5
- <>
6
- <Badge
7
- className="badge--primary"
8
- title="Badge"
9
- sizeIcon={undefined}
10
- classIcon="bi-check-circle"
11
- onClick={() => console.log("Badge clicked")}
12
- />
13
- </>
14
- );
15
- };
@@ -1,55 +0,0 @@
1
- .badge {
2
- display: flex;
3
- align-items: center;
4
- padding: 0.25em 0.4em;
5
- font-size: 0.5rem;
6
- font-weight: 700;
7
- line-height: 1;
8
- color: #fff;
9
- width: fit-content;
10
- text-transform: uppercase;
11
- border-radius: 0.2rem;
12
- background-color: #007bff;
13
- border: 1px solid transparent;
14
- .bi {
15
- font-size: 0.8rem;
16
- margin-right: 0.25rem;
17
- }
18
- &.badge-primary {
19
- background-color: var(--primary-color);
20
- border-color: var(--primary-color);
21
- }
22
- &.badge-secondary {
23
- background-color: var(--secondary-color);
24
- border-color: var(--secondary-color);
25
- }
26
- &.badge-success {
27
- background-color: #28a745;
28
- border-color: #28a745;
29
- }
30
- &.badge-danger {
31
- background-color: #dc3545;
32
- border-color: #dc3545;
33
- }
34
- &.badge-warning {
35
- background-color: #ffc107;
36
- border-color: #ffc107;
37
- }
38
- &.badge-info {
39
- background-color: #17a2b8;
40
- border-color: #17a2b8;
41
- }
42
- &.badge-light {
43
- background-color: #f8f9fa;
44
- border-color: #f8f9fa;
45
- color: #212529;
46
- }
47
- &.badge-dark {
48
- background-color: #343a40;
49
- border-color: #343a40;
50
- }
51
- &.badge-link {
52
- color: #007bff;
53
- text-decoration: none;
54
- }
55
- }
@@ -1,46 +0,0 @@
1
- import { Badge } from "../badge/Badge";
2
- import { Icon } from "../icon/Icon";
3
- import "./button.css";
4
- import { ButtonInterface } from "./button.interface";
5
-
6
- export const Button = ({
7
- className,
8
- onClick,
9
- badge,
10
- title,
11
- sizeIcon,
12
- id,
13
- classIcon,
14
- positionicon = 1,
15
- disabled = false,
16
- }: ButtonInterface) => {
17
- const handleClick = (e: React.MouseEvent) => {
18
- e.stopPropagation();
19
- if (onClick) {
20
- onClick(e);
21
- }
22
- };
23
-
24
- return (
25
- <button
26
- id={id ?? ""}
27
- disabled={disabled}
28
- type="submit"
29
- onClick={(e) => handleClick(e)}
30
- className={className}
31
- >
32
- {badge && <Badge {...badge} />}
33
- {classIcon && positionicon == 1 && (
34
- <span className={`${title ? "mr-2" : ""}`}>
35
- <Icon size={sizeIcon} classIcon={classIcon}></Icon>
36
- </span>
37
- )}
38
- <span>{title}</span>
39
- {classIcon && positionicon == 2 && (
40
- <span className="ml-2">
41
- <Icon classIcon={classIcon}></Icon>
42
- </span>
43
- )}
44
- </button>
45
- );
46
- };
@@ -1,85 +0,0 @@
1
- import { useMemo } from "react";
2
- import { TypeInputEnum } from "../form/form.enum";
3
- import { FormInterface } from "../form/form.interface";
4
- import { Button } from "./Button";
5
- import { ButtonInterface } from "./button.interface";
6
- import {
7
- ButtonActions,
8
- ButtonActionsProps,
9
- } from "./buttonActions/ButtonActions";
10
- import { ButtonFilters } from "./buttonFilters/ButtonFilters";
11
-
12
- export const ButtonView = (): JSX.Element => {
13
- const initialValues: FormInterface[] = [
14
- {
15
- value: false,
16
- name: "test1",
17
- label: "test 1",
18
- type: TypeInputEnum.CHECKBOX,
19
- },
20
- {
21
- value: false,
22
- name: "test2",
23
- label: "test 2",
24
- type: TypeInputEnum.CHECKBOX,
25
- },
26
- ];
27
- const mockButtonItems: ButtonInterface[] = [
28
- {
29
- title: "Envoyer",
30
- onClick: () => console.log("Envoyer"),
31
- classIcon: "bi-send",
32
- disabled: true,
33
- positionicon: 1,
34
- badge: {
35
- className: "badge--primary",
36
- title: "Badge",
37
- sizeIcon: undefined,
38
- classIcon: "bi-check-circle",
39
- onClick: () => console.log("Badge clicked"),
40
- },
41
- },
42
- {
43
- title: "Annuler",
44
- onClick: () => console.log("Envoyer"),
45
- className: "button--secondary",
46
- },
47
- ];
48
- const mockButtonAction: ButtonActionsProps = useMemo(() => {
49
- return {
50
- title: "Supprimer",
51
- onClick: () => console.log("Supprimer"),
52
- className: "button--secondary",
53
-
54
- actions: [
55
- {
56
- id: "1",
57
- label: "Supprimer",
58
- onClick: () => console.log("Supprimer action"),
59
- },
60
- {
61
- id: "2",
62
- label: "Supprimer définitivement",
63
- onClick: () => console.log("Supprimer définitivement"),
64
- },
65
- ],
66
- };
67
- }, []);
68
- return (
69
- <div className="d-flex">
70
- {mockButtonItems.map((item, index) => (
71
- <div className="mr-2" key={index}>
72
- <Button {...item} />
73
- </div>
74
- ))}
75
- <ButtonActions {...mockButtonAction} />
76
- <div className="ml-2">
77
- <ButtonFilters
78
- classIcon="bi-send"
79
- {...mockButtonAction}
80
- dataForm={initialValues}
81
- />
82
- </div>
83
- </div>
84
- );
85
- };
@@ -1,53 +0,0 @@
1
- button {
2
- background-color: var(--primary-color);
3
- color: white;
4
- border: none;
5
- padding: 10px;
6
- border-radius: 5px;
7
- cursor: pointer;
8
- font-size: 16px;
9
- font-weight: 500;
10
- transition: background-color 0.3s;
11
- display: flex;
12
- max-height: 40px;
13
- min-width: 150px;
14
- position: relative;
15
- align-items: center;
16
- justify-content: center;
17
- font-family: "Raleway", sans-serif !important;
18
- .badge {
19
- position: absolute;
20
- right: 10px;
21
- top: -10px;
22
- }
23
- &:disabled {
24
- opacity: 0.7;
25
- cursor: not-allowed;
26
- }
27
- &.button--primary {
28
- background-color: var(--primary-color);
29
- }
30
-
31
- &.button--secondary {
32
- background-color: var(--secondary-color);
33
- }
34
- &.button--tertiary {
35
- background-color: var(--tertiary-color);
36
- }
37
- &.button--transparent {
38
- background-color: transparent;
39
- color: var(--primary-color);
40
- border: 1px solid;
41
- }
42
- &.button--success {
43
- background-color: var(--success-color);
44
- }
45
-
46
- &.button--info {
47
- background-color: var(--info-color);
48
- }
49
-
50
- &.button--warning {
51
- background-color: var(--warning-color);
52
- }
53
- }
@@ -1,21 +0,0 @@
1
- import { BadgeInterface } from "../badge/Badge";
2
- import { IconSizeEnum } from "../icon/iconSize.enum";
3
-
4
- export interface ButtonInterface {
5
- className?: string;
6
- badge?: BadgeInterface;
7
- id?: string;
8
- onClick?: (e: React.MouseEvent) => void;
9
- title: string;
10
- classIcon?: string;
11
- positionicon?: number;
12
- disabled?: boolean;
13
- sizeIcon?: IconSizeEnum;
14
- }
15
- export interface buttonActionInterface {
16
- icon?: string;
17
- id?: number | string;
18
- label: string;
19
- disabled?: boolean;
20
- onClick: (a: buttonActionInterface) => void;
21
- }
@@ -1,104 +0,0 @@
1
- import { useCallback, useMemo, useRef, useState } from "react";
2
- import { Icon } from "../../icon/Icon";
3
- import { IconSizeEnum } from "../../icon/iconSize.enum";
4
- import { MenuInterface } from "../../menus/menu/menu.interface";
5
- import { Menus } from "../../menus/Menus";
6
- import { OverlayPanel, PositionOverlay } from "../../overlayPanel/OverlayPanel";
7
- import { Button } from "../Button";
8
- import { buttonActionInterface } from "../button.interface";
9
-
10
- export type ButtonActionsProps = {
11
- className?: string;
12
- onClick?: (e: React.MouseEvent) => void;
13
- title: string;
14
- actions?: buttonActionInterface[];
15
- classIcon?: string;
16
- positionActions?: PositionOverlay;
17
- disabled?: boolean;
18
- id?: string;
19
- };
20
- export const ButtonActions = ({
21
- className,
22
- onClick,
23
- title,
24
- actions,
25
- positionActions = "topRight",
26
- disabled = false,
27
- id,
28
- }: ButtonActionsProps) => {
29
- const handleClick = (e: React.MouseEvent) => {
30
- e.preventDefault();
31
- if (onClick) {
32
- onClick(e);
33
- }
34
- };
35
- const refButton = useRef<HTMLDivElement>(null);
36
- const [openOverlay, setOpenOverlay] = useState(false);
37
- const onClickActions = useCallback(
38
- (e: React.MouseEvent) => {
39
- e.stopPropagation();
40
- if (actions) setOpenOverlay(!openOverlay);
41
- },
42
- [openOverlay, setOpenOverlay],
43
- );
44
- const overlayMenu: MenuInterface[] = useMemo(() => {
45
- if (!actions) return [];
46
- return actions.map((a, index) => {
47
- return {
48
- id: a.id ?? index,
49
- icon: a.icon,
50
- name: a.label,
51
- children: (
52
- <Button
53
- key={index}
54
- classIcon={a.icon}
55
- sizeIcon={IconSizeEnum.LARGE}
56
- onClick={(e) => {
57
- e.stopPropagation();
58
- closeOverlay();
59
- a.onClick && a.onClick(a);
60
- }}
61
- title={a.label || ""}
62
- />
63
- ),
64
- };
65
- }) as MenuInterface[];
66
- }, [actions]);
67
- const closeOverlay = useCallback(() => {
68
- setOpenOverlay(false);
69
- }, [setOpenOverlay]);
70
- return (
71
- <>
72
- <button
73
- id={id ?? ""}
74
- disabled={disabled}
75
- type="submit"
76
- onClick={(e) => handleClick(e)}
77
- className={` ${className} button-actions`}
78
- >
79
- <span className="mr-2 flex-1">{title}</span>
80
-
81
- <span
82
- className="ml-2"
83
- ref={refButton}
84
- onClick={(e) => onClickActions(e)}
85
- >
86
- <Icon classIcon="bi-chevron-up" />
87
- </span>
88
- </button>
89
- {actions && openOverlay && refButton.current && (
90
- <OverlayPanel
91
- show={openOverlay}
92
- position={positionActions}
93
- closeOverlay={setOpenOverlay}
94
- referenceElement={refButton.current}
95
- children={
96
- <div>
97
- <Menus className="card-action-menu" items={overlayMenu} />
98
- </div>
99
- }
100
- />
101
- )}
102
- </>
103
- );
104
- };