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/dist/datePicker/DatePicker.d.ts +1 -0
- package/dist/datePicker/DatePicker.view.d.ts +1 -0
- package/dist/index.html +6 -31
- package/dist/index.js +926 -910
- package/dist/modal/Modal.d.ts +2 -0
- package/dist/quantity/Quantity.d.ts +2 -1
- package/dist/style.css +2 -2
- package/package.json +2 -1
- package/src/App.menu.tsx +8 -0
- package/src/datePicker/DatePicker.tsx +25 -0
- package/src/datePicker/DatePicker.view.tsx +9 -0
- package/src/modal/Modal.tsx +9 -1
- package/src/quantity/Quantity.tsx +15 -1
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.
|
|
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
|
+
};
|
package/src/modal/Modal.tsx
CHANGED
|
@@ -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
|
|
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">
|
|
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 ${
|