kelt-ui-kit-react 0.9.2 → 0.9.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kelt-ui-kit-react",
3
3
  "type": "module",
4
- "version": "0.9.2",
4
+ "version": "0.9.4",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -9,6 +9,7 @@
9
9
  "@types/node": "^22.5.5",
10
10
  "@vitejs/plugin-react": "^4.3.1",
11
11
  "bootstrap-icons": "^1.11.3",
12
+ "react-day-picker": "^9.7.0",
12
13
  "styled-components": "^6.1.13",
13
14
  "vite": "^5.4.6",
14
15
  "vite-plugin-dts": "^4.2.2",
package/src/App.menu.tsx CHANGED
@@ -6,6 +6,7 @@ import { CardView } from "./card/Card.view";
6
6
  import { CarouselView } from "./carousel/Carousel.view";
7
7
  import { DamierView } from "./damier/Damier.view";
8
8
  import { DataTableView } from "./dataTable/DataTable.view";
9
+ import { DatePickerView } from "./datePicker/DatePicker.view";
9
10
  import { ExpandsView } from "./expands/Expands.view";
10
11
  import { FilArianeView } from "./filAriane/FilAriane.view";
11
12
  import { FormView } from "./form/Form.view";
@@ -194,6 +195,13 @@ export const MenuList: MenuProps[] = [
194
195
  children: <NavLink to="/text-area">Text</NavLink>,
195
196
  element: <TextAreaView />,
196
197
  },
198
+ {
199
+ id: 24,
200
+ name: "Date picker",
201
+ link: "/date-picker",
202
+ children: <NavLink to="/date-picker">Date picker</NavLink>,
203
+ element: <DatePickerView />,
204
+ },
197
205
  ];
198
206
 
199
207
  export const AppMenu = (): JSX.Element => {
@@ -0,0 +1,25 @@
1
+ import { format } from "date-fns";
2
+ import { useState } from "react";
3
+ import { DayPicker } from "react-day-picker";
4
+
5
+ export const DatePicker = () => {
6
+ const [selectedDate, setSelectedDate] = useState<Date | undefined>();
7
+
8
+ return (
9
+ <div>
10
+ <h2>Sélectionnez une date :</h2>
11
+ <DayPicker
12
+ mode="single"
13
+ selected={selectedDate}
14
+ onSelect={setSelectedDate}
15
+ />
16
+
17
+ {selectedDate && (
18
+ <p>
19
+ Date sélectionnée :{" "}
20
+ <strong>{format(selectedDate, "dd/MM/yyyy")}</strong>
21
+ </p>
22
+ )}
23
+ </div>
24
+ );
25
+ };
@@ -0,0 +1,9 @@
1
+ import { DatePicker } from "./DatePicker";
2
+
3
+ export const DatePickerView = () => {
4
+ return (
5
+ <div>
6
+ <DatePicker />
7
+ </div>
8
+ );
9
+ };
@@ -11,6 +11,8 @@ interface ModalProps {
11
11
  titleButton?: string;
12
12
  children: ReactNode;
13
13
  title?: string;
14
+ styleContainer?: React.CSSProperties;
15
+ classNameContainer?: string;
14
16
  }
15
17
 
16
18
  export const Modal: React.FC<ModalProps> = ({
@@ -20,12 +22,18 @@ export const Modal: React.FC<ModalProps> = ({
20
22
  onSubmit,
21
23
  titleButton,
22
24
  title,
25
+ styleContainer = {},
26
+ classNameContainer = "",
23
27
  }) => {
24
28
  if (!isOpen) return null;
25
29
 
26
30
  return createPortal(
27
31
  <div className="modal-overlay" onMouseDown={onClose}>
28
- <div className="modal-container" onMouseDown={(e) => e.stopPropagation()}>
32
+ <div
33
+ className={`modal-container ${classNameContainer}`}
34
+ style={styleContainer}
35
+ onMouseDown={(e) => e.stopPropagation()}
36
+ >
29
37
  <div className="modal-header">
30
38
  {title && <h2 className="modal-title">{title}</h2>}
31
39
  <div className="modal-close-button" onClick={onClose}>
@@ -6,6 +6,7 @@ import "./Quantity.css";
6
6
  export interface QuantityProps {
7
7
  setQuantity?: (item: CardInterface, qte: number) => void;
8
8
  item: CardInterface;
9
+ onClickQuantity?: (item: CardInterface) => void;
9
10
  pas: number;
10
11
  disabled?: boolean;
11
12
  disabledPlus?: boolean;
@@ -14,6 +15,7 @@ export interface QuantityProps {
14
15
  export const Quantity = ({
15
16
  setQuantity,
16
17
  item,
18
+ onClickQuantity,
17
19
  disabled,
18
20
  disabledPlus,
19
21
  disabledMinus,
@@ -65,6 +67,16 @@ export const Quantity = ({
65
67
  setQte(item.quantity);
66
68
  }
67
69
  }, [item.quantity, setQte]);
70
+ const handleClick = useCallback(
71
+ (e: React.MouseEvent<HTMLSpanElement, MouseEvent>) => {
72
+ e.stopPropagation();
73
+ if (onClickQuantity) {
74
+ onClickQuantity(item);
75
+ }
76
+ },
77
+ [onClickQuantity, item]
78
+ );
79
+
68
80
  return (
69
81
  <div className="qte ">
70
82
  <div
@@ -75,7 +87,9 @@ export const Quantity = ({
75
87
  >
76
88
  <Icon size={IconSizeEnum.LARGE} classIcon="bi bi-dash-square" />
77
89
  </div>
78
- <span className="qte-label">{qte}</span>
90
+ <span onClick={(e) => handleClick(e)} className="qte-label">
91
+ {qte}
92
+ </span>
79
93
  <div
80
94
  onClick={(e) => incrementQte(e)}
81
95
  className={`qte-action qte-action--plus ${