kelt-ui-kit-react 1.8.0 → 1.8.2

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 (125) hide show
  1. package/dist/App.d.ts +3 -0
  2. package/dist/App.menu.d.ts +10 -0
  3. package/dist/App.routes.d.ts +1 -0
  4. package/dist/_core/hooks/HistoryProvider.d.ts +5 -0
  5. package/dist/_core/hooks/ImageChecker.d.ts +7 -0
  6. package/dist/_core/hooks/imageExist.d.ts +7 -0
  7. package/dist/_core/hooks/isEAN13.d.ts +1 -0
  8. package/dist/_core/hooks/objectToQueryParams.d.ts +1 -0
  9. package/dist/_core/hooks/useCurrency.d.ts +3 -0
  10. package/dist/_core/hooks/useDateutils.d.ts +4 -0
  11. package/dist/_core/hooks/useIsMobile.d.ts +1 -0
  12. package/dist/_core/hooks/useToken.d.ts +3 -0
  13. package/dist/_core/hooks/useValidate.d.ts +5 -0
  14. package/dist/_core/hooks/widgetSupport.d.ts +1 -0
  15. package/dist/action/Action.view.d.ts +1 -0
  16. package/dist/action/ButtonAction.d.ts +10 -0
  17. package/dist/badge/Badge.d.ts +10 -0
  18. package/dist/badge/Badge.view.d.ts +1 -0
  19. package/dist/button/Button.d.ts +3 -0
  20. package/dist/button/Button.view.d.ts +1 -0
  21. package/dist/button/button.interface.d.ts +21 -0
  22. package/dist/button/buttonActions/ButtonActions.d.ts +14 -0
  23. package/dist/button/buttonFile/ButtonFile.d.ts +9 -0
  24. package/dist/button/buttonFile/ButtonFile.view.d.ts +1 -0
  25. package/dist/button/buttonFilters/ButtonFilters.d.ts +19 -0
  26. package/dist/card/Card.d.ts +16 -0
  27. package/dist/card/Card.view.d.ts +1 -0
  28. package/dist/card/card.interface.d.ts +10 -0
  29. package/dist/card/cardAction/CardAction.d.ts +16 -0
  30. package/dist/card/cardAction.interface.d.ts +10 -0
  31. package/dist/card/hook/useCardInteractions.d.ts +8 -0
  32. package/dist/carousel/Carousel.d.ts +16 -0
  33. package/dist/carousel/Carousel.view.d.ts +1 -0
  34. package/dist/damier/Damier.d.ts +11 -0
  35. package/dist/damier/Damier.view.d.ts +1 -0
  36. package/dist/damier/damierCell/DamierCell.d.ts +8 -0
  37. package/dist/damier/damierCell/damierCell.interface.d.ts +6 -0
  38. package/dist/dataTable/DataTable.d.ts +23 -0
  39. package/dist/dataTable/DataTable.view.d.ts +1 -0
  40. package/dist/dataTable/dataTable.interface.d.ts +33 -0
  41. package/dist/dataTable/dataTableActions/DataTableAction.d.ts +9 -0
  42. package/dist/dataTable/dataTableColumn/DataTableColumn.d.ts +9 -0
  43. package/dist/dataTable/dataTableLoading/DataTableLoading.d.ts +7 -0
  44. package/dist/dataTable/dataTableRow/DataTableRow.d.ts +9 -0
  45. package/dist/datePicker/DatePicker.d.ts +9 -0
  46. package/dist/datePicker/DatePicker.view.d.ts +1 -0
  47. package/dist/expands/Expands.d.ts +11 -0
  48. package/dist/expands/Expands.view.d.ts +1 -0
  49. package/dist/expands/expand/expand.d.ts +10 -0
  50. package/dist/expands/expand/expand.interface.d.ts +9 -0
  51. package/dist/favicon.ico +0 -0
  52. package/dist/filAriane/FilAriane.d.ts +10 -0
  53. package/dist/filAriane/FilAriane.view.d.ts +1 -0
  54. package/dist/filAriane/filAriane.interface.d.ts +6 -0
  55. package/dist/form/Form.d.ts +31 -0
  56. package/dist/form/Form.view.d.ts +1 -0
  57. package/dist/form/form.enum.d.ts +13 -0
  58. package/dist/form/form.interface.d.ts +36 -0
  59. package/dist/form/input/Input.d.ts +26 -0
  60. package/dist/form/inputNumber/InputNumber.d.ts +22 -0
  61. package/dist/form/inputNumber/InputNumber.view.d.ts +1 -0
  62. package/dist/form/inputPrice/InputPrice.d.ts +16 -0
  63. package/dist/form/inputPrice/InputPrice.view.d.ts +1 -0
  64. package/dist/form/textArea/TextArea.d.ts +15 -0
  65. package/dist/form/textArea/TextArea.view.d.ts +1 -0
  66. package/dist/grid/Grid.d.ts +9 -0
  67. package/dist/grid/Grid.view.d.ts +1 -0
  68. package/dist/grid/col/Col.d.ts +10 -0
  69. package/dist/grid/col/colStyled/ColStyled.d.ts +9 -0
  70. package/dist/grid/container/Container.d.ts +7 -0
  71. package/dist/grid/grid.interface.d.ts +8 -0
  72. package/dist/grid/row/Row.d.ts +8 -0
  73. package/dist/header/Header.d.ts +3 -0
  74. package/dist/header/Header.view.d.ts +1 -0
  75. package/dist/header/header.interface.d.ts +11 -0
  76. package/dist/home/Home.d.ts +1 -0
  77. package/dist/icon/Icon.d.ts +3 -0
  78. package/dist/icon/Icons.view.d.ts +1 -0
  79. package/dist/icon/icon.interface.d.ts +6 -0
  80. package/dist/icon/iconSize.enum.d.ts +7 -0
  81. package/dist/index.d.ts +49 -0
  82. package/dist/index.html +18 -0
  83. package/dist/index.js +5354 -0
  84. package/dist/loader/Loader.d.ts +9 -0
  85. package/dist/loader/Loader.view.d.ts +1 -0
  86. package/dist/logo192.png +0 -0
  87. package/dist/logo512.png +0 -0
  88. package/dist/main.d.ts +1 -0
  89. package/dist/manifest.json +25 -0
  90. package/dist/menus/Menus.d.ts +7 -0
  91. package/dist/menus/Menus.view.d.ts +1 -0
  92. package/dist/menus/menu/Menu.d.ts +8 -0
  93. package/dist/menus/menu/menu.interface.d.ts +10 -0
  94. package/dist/message/Message.d.ts +7 -0
  95. package/dist/message/Message.view.d.ts +1 -0
  96. package/dist/modal/Modal.d.ts +15 -0
  97. package/dist/modal/Modal.view.d.ts +1 -0
  98. package/dist/notFound/NotFound.d.ts +1 -0
  99. package/dist/overlayPanel/OverlayPanel.d.ts +21 -0
  100. package/dist/overlayPanel/OverlayPanel.view.d.ts +1 -0
  101. package/dist/overlayPanel/overlay.context.d.ts +11 -0
  102. package/dist/overlayPanel/overlayPanelStyled/OverlayPanelStyled.d.ts +7 -0
  103. package/dist/pdfViewer/PdfViewer.d.ts +12 -0
  104. package/dist/pdfViewer/PdfViewer.view.d.ts +1 -0
  105. package/dist/quantity/Quantity.d.ts +12 -0
  106. package/dist/quantity/Quantity.view.d.ts +0 -0
  107. package/dist/robots.txt +3 -0
  108. package/dist/search/Search.d.ts +23 -0
  109. package/dist/search/Search.view.d.ts +1 -0
  110. package/dist/select/Select.d.ts +19 -0
  111. package/dist/select/Select.view.d.ts +1 -0
  112. package/dist/select/selectOption.interface.d.ts +4 -0
  113. package/dist/sidebar/Sidebar.d.ts +13 -0
  114. package/dist/sidebar/Sidebar.view.d.ts +1 -0
  115. package/dist/sidebarData/SidebarData.d.ts +8 -0
  116. package/dist/sidebarData/SidebarData.view.d.ts +1 -0
  117. package/dist/style.css +5 -0
  118. package/dist/tabs/Tabs.d.ts +18 -0
  119. package/dist/tabs/Tabs.view.d.ts +1 -0
  120. package/dist/toaster/Toaster.d.ts +2 -0
  121. package/dist/toaster/Toaster.view.d.ts +1 -0
  122. package/dist/toaster/store/useToasterStore.d.ts +19 -0
  123. package/package.json +1 -1
  124. package/src/sidebar/Sidebar.tsx +59 -7
  125. package/src/sidebar/sidebar.css +6 -0
@@ -0,0 +1,18 @@
1
+ import { default as React } from 'react';
2
+
3
+ export type TabItem = {
4
+ key: string;
5
+ title: React.ReactNode;
6
+ panel: React.ReactNode;
7
+ disabled?: boolean;
8
+ };
9
+ export type TabsProps = {
10
+ items: TabItem[];
11
+ defaultIndex?: number;
12
+ index?: number;
13
+ onChange?: (nextIndex: number) => void;
14
+ className?: string;
15
+ tabClassName?: string;
16
+ panelClassName?: string;
17
+ };
18
+ export declare const Tabs: ({ items, defaultIndex, index, onChange, className, tabClassName, panelClassName, }: TabsProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const TabsView: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+
2
+ export declare const Toaster: () => import('react').ReactPortal | null;
@@ -0,0 +1 @@
1
+ export declare const ToasterView: () => JSX.Element;
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ type ToasterState = {
3
+ title: string;
4
+ description?: string;
5
+ severity?: "info" | "success" | "error" | "warning";
6
+ children?: React.ReactNode;
7
+ visible: boolean;
8
+ duration: number;
9
+ close?: boolean;
10
+ showToast: (title: string, options?: {
11
+ description?: string;
12
+ severity?: "info" | "success" | "error" | "warning";
13
+ duration?: number;
14
+ children?: React.ReactNode;
15
+ }) => void;
16
+ hideToast: () => void;
17
+ };
18
+ export declare const useToasterStore: import('zustand').UseBoundStore<import('zustand').StoreApi<ToasterState>>;
19
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kelt-ui-kit-react",
3
3
  "type": "module",
4
- "version": "1.8.0",
4
+ "version": "1.8.2",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -15,6 +15,9 @@ export interface SidebarProps {
15
15
  onClose?: (close: boolean) => void;
16
16
  }
17
17
 
18
+ const SWIPE_CLOSE_THRESHOLD = 60; // px à parcourir pour fermer
19
+ const SWIPE_AXIS_LOCK_THRESHOLD = 10; // px pour déterminer l'axe du geste
20
+
18
21
  export const Sidebar = ({
19
22
  open,
20
23
  children,
@@ -27,10 +30,13 @@ export const Sidebar = ({
27
30
  displayOverlay = true,
28
31
  }: SidebarProps): JSX.Element => {
29
32
  const [isOpen, setIsOpen] = useState(open || false);
33
+ const [dragX, setDragX] = useState(0);
34
+ const [isDragging, setIsDragging] = useState(false);
30
35
  const sidebarRef = useRef<HTMLDivElement | null>(null);
31
36
  const rootRef = useRef<HTMLDivElement | null>(null);
32
37
  const touchStartX = useRef(0);
33
38
  const touchStartY = useRef(0);
39
+ const axisLocked = useRef<"x" | "y" | null>(null);
34
40
 
35
41
  // Créer le conteneur une seule fois
36
42
  useEffect(() => {
@@ -78,20 +84,61 @@ export const Sidebar = ({
78
84
  const touch = event.touches[0];
79
85
  touchStartX.current = touch.clientX;
80
86
  touchStartY.current = touch.clientY;
87
+ axisLocked.current = null;
88
+ setIsDragging(false);
89
+ setDragX(0);
81
90
  }, []);
82
91
 
83
- const handleTouchEnd = useCallback(
92
+ const handleTouchMove = useCallback(
84
93
  (event: React.TouchEvent) => {
85
94
  if (!isOpen) return;
86
95
 
87
- const touch = event.changedTouches[0];
96
+ const touch = event.touches[0];
88
97
  const deltaX = touch.clientX - touchStartX.current;
89
- const deltaY = Math.abs(touch.clientY - touchStartY.current);
98
+ const deltaY = touch.clientY - touchStartY.current;
99
+
100
+ // Détermine l'axe du geste une seule fois, dès qu'on a un déplacement suffisant
101
+ if (!axisLocked.current) {
102
+ if (
103
+ Math.abs(deltaX) < SWIPE_AXIS_LOCK_THRESHOLD &&
104
+ Math.abs(deltaY) < SWIPE_AXIS_LOCK_THRESHOLD
105
+ ) {
106
+ return; // pas encore assez de mouvement pour trancher
107
+ }
108
+ axisLocked.current = Math.abs(deltaX) > Math.abs(deltaY) ? "x" : "y";
109
+ }
90
110
 
91
- // Ferme seulement sur un vrai swipe horizontal gauche -> droite.
92
- if (deltaX > 60 && deltaY < 40) {
93
- toggleSidebar();
111
+ if (axisLocked.current !== "x") return; // c'est un scroll vertical, on laisse faire
112
+
113
+ // On gère le swipe horizontal nous-mêmes : on empêche le scroll natif
114
+ // et on bloque le bounce/scroll de la page pendant le drag
115
+ event.preventDefault();
116
+
117
+ setIsDragging(true);
118
+ // On ne permet que le swipe vers la droite (fermeture), pas de drag négatif
119
+ setDragX(Math.max(0, deltaX));
120
+ },
121
+ [isOpen],
122
+ );
123
+
124
+ const handleTouchEnd = useCallback(
125
+ (event: React.TouchEvent) => {
126
+ if (!isOpen) {
127
+ return;
94
128
  }
129
+
130
+ if (axisLocked.current === "x") {
131
+ const touch = event.changedTouches[0];
132
+ const deltaX = touch.clientX - touchStartX.current;
133
+
134
+ if (deltaX > SWIPE_CLOSE_THRESHOLD) {
135
+ toggleSidebar();
136
+ }
137
+ }
138
+
139
+ setIsDragging(false);
140
+ setDragX(0);
141
+ axisLocked.current = null;
95
142
  },
96
143
  [isOpen, toggleSidebar],
97
144
  );
@@ -136,9 +183,14 @@ export const Sidebar = ({
136
183
  )}
137
184
  <div
138
185
  ref={sidebarRef}
139
- style={width ? { width: width } : {}}
186
+ style={{
187
+ ...(width ? { width } : {}),
188
+ transform: dragX ? `translateX(${dragX}px)` : undefined,
189
+ transition: isDragging ? "none" : undefined,
190
+ }}
140
191
  className={`sidebar ${isOpen ? "open" : "closed"} ${className ?? ""}`}
141
192
  onTouchStart={handleTouchStart}
193
+ onTouchMove={handleTouchMove}
142
194
  onTouchEnd={handleTouchEnd}
143
195
  >
144
196
  <div className="sidebar-header">
@@ -1,3 +1,9 @@
1
+ .sidebar {
2
+ touch-action: pan-y;
3
+ /* laisse le scroll vertical natif, gère le X nous-même */
4
+ will-change: transform;
5
+ }
6
+
1
7
  .overlay {
2
8
  touch-action: none;
3
9
  }