kelt-ui-kit-react 1.8.2 → 1.8.3
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/.github/workflows/publish.yml +31 -0
- package/dist/_core/type/generiqueType.d.ts +4 -0
- package/dist/badge/Badge.d.ts +3 -1
- package/dist/button/button.interface.d.ts +1 -1
- package/dist/dataTable/DataTable.d.ts +17 -3
- package/dist/dataTable/dataTable.interface.d.ts +21 -3
- package/dist/dataTable/dataTableActions/DataTableAction.d.ts +2 -2
- package/dist/dataTable/dataTableColumn/DataTableColumn.d.ts +13 -7
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/DataTableColumnFilter.d.ts +10 -0
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDate/DataTableColumnFilterDate.d.ts +9 -0
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDateRange/dataTableColumnFilterDateRange.d.ts +9 -0
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterEnum/DataTableColumnFilterEnum.d.ts +13 -0
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterString/DataTableColumnFilterString.d.ts +9 -0
- package/dist/dataTable/dataTableColumn/dataTableColumnSort/DataTableColumnSort.d.ts +11 -0
- package/dist/dataTable/dataTableFilters/DataTableFilters.d.ts +7 -0
- package/dist/dataTable/dataTableLoading/DataTableLoading.d.ts +1 -3
- package/dist/dataTable/dataTableRow/DataTableRow.d.ts +5 -3
- package/dist/dataTable/dataTableRow/dataTableRowOverlay/DataTableRowOverlay.d.ts +12 -0
- package/dist/dataTable/dataTableRow/dataTableRowValue/DataTableRowValue.d.ts +11 -0
- package/dist/expands/expand/expand.d.ts +1 -1
- package/dist/form/form.enum.d.ts +1 -0
- package/dist/form/input/Input.d.ts +3 -0
- package/dist/form/inputNumber/InputNumber.d.ts +0 -2
- package/dist/icon/Icon.d.ts +1 -1
- package/dist/icon/icon.interface.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3652 -2836
- package/dist/overlayPanel/OverlayPanel.d.ts +3 -1
- package/dist/select/Select.d.ts +4 -1
- package/dist/select/selectOption.interface.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/tabs/Tabs.d.ts +2 -1
- package/kelt-ui-kit-react-1.6.9.tgz +0 -0
- package/package/README.md +46 -0
- package/package/index.html +20 -0
- package/package/package.json +56 -0
- package/package/public/favicon.ico +0 -0
- package/package/public/index.html +18 -0
- package/package/public/logo192.png +0 -0
- package/package/public/logo512.png +0 -0
- package/package/public/manifest.json +25 -0
- package/package/public/robots.txt +3 -0
- package/package/src/App.css +11 -0
- package/package/src/App.menu.tsx +249 -0
- package/package/src/App.routes.tsx +16 -0
- package/package/src/App.tsx +30 -0
- package/package/src/_core/hooks/HistoryProvider.tsx +25 -0
- package/package/src/_core/hooks/ImageChecker.tsx +26 -0
- package/package/src/_core/hooks/imageExist.tsx +9 -0
- package/package/src/_core/hooks/isEAN13.tsx +16 -0
- package/package/src/_core/hooks/objectToQueryParams.tsx +32 -0
- package/package/src/_core/hooks/useCurrency.tsx +18 -0
- package/package/src/_core/hooks/useDateutils.ts +64 -0
- package/package/src/_core/hooks/useIsMobile.ts +18 -0
- package/package/src/_core/hooks/useToken.tsx +19 -0
- package/package/src/_core/hooks/useValidate.tsx +18 -0
- package/package/src/_core/hooks/widgetSupport.tsx +39 -0
- package/package/src/action/Action.view.tsx +21 -0
- package/package/src/action/ButtonAction.tsx +32 -0
- package/package/src/action/action.css +20 -0
- package/package/src/badge/Badge.tsx +34 -0
- package/package/src/badge/Badge.view.tsx +15 -0
- package/package/src/badge/badge.css +55 -0
- package/package/src/button/Button.tsx +46 -0
- package/package/src/button/Button.view.tsx +85 -0
- package/package/src/button/button.css +53 -0
- package/package/src/button/button.interface.tsx +21 -0
- package/package/src/button/buttonActions/ButtonActions.tsx +104 -0
- package/package/src/button/buttonFile/ButtonFile.tsx +59 -0
- package/package/src/button/buttonFile/ButtonFile.view.tsx +70 -0
- package/package/src/button/buttonFilters/ButtonFilters.tsx +102 -0
- package/package/src/button/buttonFilters/buttonFilters.css +22 -0
- package/package/src/card/Card.tsx +125 -0
- package/package/src/card/Card.view.tsx +73 -0
- package/package/src/card/card.css +145 -0
- package/package/src/card/card.interface.tsx +9 -0
- package/package/src/card/cardAction/CardAction.tsx +135 -0
- package/package/src/card/cardAction/cardAction.css +10 -0
- package/package/src/card/cardAction.interface.tsx +10 -0
- package/package/src/card/hook/useCardInteractions.tsx +30 -0
- package/package/src/carousel/Carousel.css +44 -0
- package/package/src/carousel/Carousel.tsx +115 -0
- package/package/src/carousel/Carousel.view.tsx +13 -0
- package/package/src/damier/Damier.tsx +64 -0
- package/package/src/damier/Damier.view.tsx +31 -0
- package/package/src/damier/damier.css +50 -0
- package/package/src/damier/damierCell/DamierCell.tsx +18 -0
- package/package/src/damier/damierCell/damierCell.interface.tsx +5 -0
- package/package/src/dataTable/DataTable.tsx +259 -0
- package/package/src/dataTable/DataTable.view.tsx +62 -0
- package/package/src/dataTable/dataTable.css +30 -0
- package/package/src/dataTable/dataTable.interface.ts +30 -0
- package/package/src/dataTable/dataTableActions/DataTableAction.tsx +44 -0
- package/package/src/dataTable/dataTableColumn/DataTableColumn.tsx +27 -0
- package/package/src/dataTable/dataTableLoading/DataTableLoading.tsx +21 -0
- package/package/src/dataTable/dataTableRow/DataTableRow.tsx +54 -0
- package/package/src/datePicker/DatePicker.tsx +110 -0
- package/package/src/datePicker/DatePicker.view.tsx +9 -0
- package/package/src/datePicker/datePicker.css +77 -0
- package/package/src/expands/Expands.tsx +42 -0
- package/package/src/expands/Expands.view.tsx +90 -0
- package/package/src/expands/expand/expand.interface.tsx +8 -0
- package/package/src/expands/expand/expand.tsx +75 -0
- package/package/src/expands/expands.css +97 -0
- package/package/src/filAriane/FilAriane.tsx +57 -0
- package/package/src/filAriane/FilAriane.view.tsx +28 -0
- package/package/src/filAriane/filAriane.css +23 -0
- package/package/src/filAriane/filAriane.interface.tsx +6 -0
- package/package/src/form/Form.tsx +279 -0
- package/package/src/form/Form.view.tsx +59 -0
- package/package/src/form/form.css +62 -0
- package/package/src/form/form.enum.ts +13 -0
- package/package/src/form/form.interface.tsx +37 -0
- package/package/src/form/input/Input.tsx +106 -0
- package/package/src/form/input/input.css +26 -0
- package/package/src/form/inputNumber/InputNumber.tsx +132 -0
- package/package/src/form/inputNumber/InputNumber.view.tsx +15 -0
- package/package/src/form/inputPrice/InputPrice.tsx +42 -0
- package/package/src/form/inputPrice/InputPrice.view.tsx +15 -0
- package/package/src/form/textArea/TextArea.tsx +59 -0
- package/package/src/form/textArea/TextArea.view.tsx +34 -0
- package/package/src/form/textArea/textArea.css +9 -0
- package/package/src/grid/Grid.tsx +21 -0
- package/package/src/grid/Grid.view.tsx +24 -0
- package/package/src/grid/col/Col.tsx +15 -0
- package/package/src/grid/col/colStyled/ColStyled.tsx +41 -0
- package/package/src/grid/container/Container.tsx +8 -0
- package/package/src/grid/container/container.css +5 -0
- package/package/src/grid/grid.interface.tsx +7 -0
- package/package/src/grid/row/Row.tsx +12 -0
- package/package/src/grid/row/row.css +18 -0
- package/package/src/header/Header.tsx +62 -0
- package/package/src/header/Header.view.tsx +5 -0
- package/package/src/header/header.css +26 -0
- package/package/src/header/header.interface.tsx +10 -0
- package/package/src/home/Home.tsx +3 -0
- package/package/src/icon/Icon.tsx +6 -0
- package/package/src/icon/Icons.view.tsx +29 -0
- package/package/src/icon/icon.css +20 -0
- package/package/src/icon/icon.interface.tsx +6 -0
- package/package/src/icon/iconSize.enum.ts +7 -0
- package/package/src/index.css +502 -0
- package/package/src/index.ts +58 -0
- package/package/src/loader/Loader.tsx +37 -0
- package/package/src/loader/Loader.view.tsx +20 -0
- package/package/src/loader/loader.css +30 -0
- package/package/src/logo.svg +1 -0
- package/package/src/main.tsx +10 -0
- package/package/src/menus/Menus.tsx +42 -0
- package/package/src/menus/Menus.view.tsx +39 -0
- package/package/src/menus/menu/Menu.tsx +17 -0
- package/package/src/menus/menu/menu.interface.tsx +9 -0
- package/package/src/menus/menus.css +47 -0
- package/package/src/message/Message.tsx +30 -0
- package/package/src/message/Message.view.tsx +22 -0
- package/package/src/message/message.css +29 -0
- package/package/src/modal/Modal.tsx +59 -0
- package/package/src/modal/Modal.view.tsx +26 -0
- package/package/src/modal/modal.css +71 -0
- package/package/src/notFound/NotFound.tsx +3 -0
- package/package/src/overlayPanel/OverlayPanel.tsx +195 -0
- package/package/src/overlayPanel/OverlayPanel.view.tsx +25 -0
- package/package/src/overlayPanel/overlay.context.tsx +28 -0
- package/package/src/overlayPanel/overlayPanel.css +35 -0
- package/package/src/overlayPanel/overlayPanelStyled/OverlayPanelStyled.tsx +18 -0
- package/package/src/pdfViewer/PdfViewer.tsx +73 -0
- package/package/src/pdfViewer/PdfViewer.view.tsx +5 -0
- package/package/src/quantity/Quantity.tsx +103 -0
- package/package/src/quantity/Quantity.view.tsx +0 -0
- package/package/src/quantity/quantity.css +26 -0
- package/package/src/search/Search.tsx +161 -0
- package/package/src/search/Search.view.tsx +14 -0
- package/package/src/search/search.css +59 -0
- package/package/src/select/Select.tsx +103 -0
- package/package/src/select/Select.view.tsx +71 -0
- package/package/src/select/select.css +69 -0
- package/package/src/select/selectOption.interface.ts +4 -0
- package/package/src/sidebar/Sidebar.tsx +208 -0
- package/package/src/sidebar/Sidebar.view.tsx +17 -0
- package/package/src/sidebar/sidebar.css +104 -0
- package/package/src/sidebarData/SidebarData.tsx +19 -0
- package/package/src/sidebarData/SidebarData.view.tsx +19 -0
- package/package/src/sidebarData/sidebarData.css +27 -0
- package/package/src/tabs/Tabs.tsx +90 -0
- package/package/src/tabs/Tabs.view.tsx +20 -0
- package/package/src/tabs/tabs.css +24 -0
- package/package/src/toaster/Toaster.tsx +55 -0
- package/package/src/toaster/Toaster.view.tsx +24 -0
- package/package/src/toaster/store/useToasterStore.tsx +41 -0
- package/package/src/toaster/toaster.css +87 -0
- package/package/tsconfig.json +28 -0
- package/package/vite.config.ts +20 -0
- package/package/vite.config.ts.timestamp-1733262892554-a13dfef6e8a29.mjs +24 -0
- package/package/vite.config.ts.timestamp-1757847121745-e5a5bf54b81b.mjs +28 -0
- package/package/vite.config.ts.timestamp-1759742478362-4ac5c5a7db34b.mjs +28 -0
- package/package.json +1 -1
- package/src/_core/type/generiqueType.tsx +4 -0
- package/src/badge/Badge.tsx +9 -1
- package/src/badge/badge.css +4 -0
- package/src/button/Button.tsx +1 -1
- package/src/button/button.interface.tsx +1 -1
- package/src/card/card.css +23 -3
- package/src/card/cardAction/CardAction.tsx +4 -4
- package/src/dataTable/DataTable.tsx +670 -45
- package/src/dataTable/DataTable.view.tsx +47 -14
- package/src/dataTable/dataTable.css +153 -5
- package/src/dataTable/dataTable.interface.ts +21 -3
- package/src/dataTable/dataTableActions/DataTableAction.tsx +2 -2
- package/src/dataTable/dataTableColumn/DataTableColumn.tsx +64 -14
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/DataTableColumnFilter.tsx +36 -0
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilter.css +0 -0
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDate/DataTableColumnFilterDate.tsx +39 -0
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDateRange/dataTableColumnFilterDateRange.tsx +80 -0
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterEnum/DataTableColumnFilterEnum.tsx +89 -0
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterString/DataTableColumnFilterString.tsx +37 -0
- package/src/dataTable/dataTableColumn/dataTableColumnSort/DataTableColumnSort.tsx +42 -0
- package/src/dataTable/dataTableFilters/DataTableFilters.tsx +91 -0
- package/src/dataTable/dataTableFilters/dataTableFilters.css +16 -0
- package/src/dataTable/dataTableLoading/DataTableLoading.tsx +4 -15
- package/src/dataTable/dataTableRow/DataTableRow.tsx +60 -33
- package/src/dataTable/dataTableRow/dataTableRowOverlay/DataTableRowOverlay.tsx +80 -0
- package/src/dataTable/dataTableRow/dataTableRowValue/DataTableRowValue.tsx +123 -0
- package/src/expands/Expands.tsx +2 -16
- package/src/expands/expand/expand.tsx +6 -18
- package/src/form/Form.tsx +13 -12
- package/src/form/form.css +13 -2
- package/src/form/form.enum.ts +1 -0
- package/src/form/input/Input.tsx +61 -7
- package/src/form/input/input.css +23 -1
- package/src/form/inputNumber/InputNumber.tsx +6 -11
- package/src/form/inputPrice/InputPrice.tsx +2 -4
- package/src/icon/Icon.tsx +6 -2
- package/src/icon/icon.interface.tsx +1 -0
- package/src/index.ts +2 -0
- package/src/overlayPanel/OverlayPanel.tsx +23 -10
- package/src/overlayPanel/overlay.context.tsx +6 -4
- package/src/overlayPanel/overlayPanel.css +10 -1
- package/src/select/Select.tsx +134 -38
- package/src/select/select.css +65 -14
- package/src/select/selectOption.interface.ts +1 -0
- package/src/sidebar/Sidebar.tsx +9 -80
- package/src/sidebar/sidebar.css +1 -18
- package/src/tabs/Tabs.tsx +19 -1
- package/vite.config.ts.timestamp-1757847121745-e5a5bf54b81b.mjs +28 -28
- package/vite.config.ts.timestamp-1759742478362-4ac5c5a7db34b.mjs +28 -28
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { forwardRef, useCallback } from "react";
|
|
2
|
+
import { TypeInputEnum } from "../form.enum";
|
|
3
|
+
import "../input/input.css";
|
|
4
|
+
|
|
5
|
+
export type InputNumberProps = {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
value?: string; // ⚠️ string pour gérer la saisie manuelle
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
pattern?: string; // regex pour validation (ex: "^-?\\d*[.,]?\\d*$" pour nombre décimal)
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
inputMode?: "numeric" | "decimal";
|
|
15
|
+
autoFocus?: boolean;
|
|
16
|
+
maxLength?: number;
|
|
17
|
+
autoComplete?: string;
|
|
18
|
+
tabIndex?: number;
|
|
19
|
+
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
20
|
+
onChange?: (
|
|
21
|
+
e: React.ChangeEvent<HTMLInputElement>,
|
|
22
|
+
valueFormat?: string,
|
|
23
|
+
) => void;
|
|
24
|
+
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
25
|
+
onClick?: (e: React.MouseEvent<HTMLInputElement>) => void;
|
|
26
|
+
onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(
|
|
30
|
+
(
|
|
31
|
+
{
|
|
32
|
+
id,
|
|
33
|
+
name,
|
|
34
|
+
value = "",
|
|
35
|
+
placeholder,
|
|
36
|
+
className,
|
|
37
|
+
disabled = false,
|
|
38
|
+
required = false,
|
|
39
|
+
autoFocus = false,
|
|
40
|
+
maxLength = 10,
|
|
41
|
+
autoComplete = "off",
|
|
42
|
+
tabIndex = 0,
|
|
43
|
+
inputMode = "numeric",
|
|
44
|
+
pattern,
|
|
45
|
+
onChange,
|
|
46
|
+
onBlur,
|
|
47
|
+
onClick,
|
|
48
|
+
onKeyDown,
|
|
49
|
+
onFocus,
|
|
50
|
+
},
|
|
51
|
+
ref,
|
|
52
|
+
) => {
|
|
53
|
+
const handleChange = useCallback(
|
|
54
|
+
(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
55
|
+
let newValue = e.target.value.replace(",", ".");
|
|
56
|
+
|
|
57
|
+
// ✅ Autoriser les chiffres, . , et - (mais - seulement au début)
|
|
58
|
+
if (!/^-?\d*[.,]?\d*$/.test(newValue) && newValue !== "") {
|
|
59
|
+
return; // saisie invalide → on ignore
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ✅ Empêcher plus de maxLength
|
|
63
|
+
if (maxLength && newValue.length > maxLength) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
onChange?.(e, newValue);
|
|
68
|
+
},
|
|
69
|
+
[onChange, maxLength],
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
73
|
+
if (onKeyDown) {
|
|
74
|
+
onKeyDown(e);
|
|
75
|
+
}
|
|
76
|
+
// ✅ Autoriser chiffres, contrôle, ., , et -
|
|
77
|
+
const allowed =
|
|
78
|
+
/[0-9]|Backspace|Delete|ArrowLeft|ArrowRight|Tab|Enter|Home|End/.test(
|
|
79
|
+
e.key,
|
|
80
|
+
) ||
|
|
81
|
+
e.key === "." ||
|
|
82
|
+
e.key === "," ||
|
|
83
|
+
e.key === "-";
|
|
84
|
+
|
|
85
|
+
if (!allowed) {
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// ❌ Interdire plusieurs "-" ou "-" ailleurs que début
|
|
91
|
+
if (e.key === "-") {
|
|
92
|
+
const cursorPos = (e.target as HTMLInputElement).selectionStart ?? 0;
|
|
93
|
+
if (cursorPos !== 0 || value.includes("-")) {
|
|
94
|
+
e.preventDefault();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<div className="input-container input-container-number">
|
|
101
|
+
<input
|
|
102
|
+
ref={ref}
|
|
103
|
+
id={id}
|
|
104
|
+
name={name}
|
|
105
|
+
type={TypeInputEnum.TEXT} // reste en text pour éviter les comportements natifs bizarres
|
|
106
|
+
value={value}
|
|
107
|
+
placeholder={placeholder}
|
|
108
|
+
disabled={disabled}
|
|
109
|
+
required={required}
|
|
110
|
+
autoFocus={autoFocus}
|
|
111
|
+
autoComplete={autoComplete}
|
|
112
|
+
pattern={pattern}
|
|
113
|
+
tabIndex={tabIndex}
|
|
114
|
+
inputMode={inputMode} // mobile keyboard adaptatif
|
|
115
|
+
spellCheck="false"
|
|
116
|
+
className={`input-field ${className ?? ""}`}
|
|
117
|
+
onChange={handleChange}
|
|
118
|
+
onWheel={(e) => e.currentTarget.blur()}
|
|
119
|
+
onKeyDown={handleKeyDown}
|
|
120
|
+
onFocus={onFocus}
|
|
121
|
+
onBlur={onBlur}
|
|
122
|
+
onClick={(e) => {
|
|
123
|
+
e.stopPropagation();
|
|
124
|
+
onClick?.(e);
|
|
125
|
+
}}
|
|
126
|
+
/>
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
},
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
InputNumber.displayName = "InputNumber";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { InputNumber } from "./InputNumber";
|
|
3
|
+
|
|
4
|
+
export const InputNumberView = () => {
|
|
5
|
+
const [value, setValue] = useState("");
|
|
6
|
+
return (
|
|
7
|
+
<InputNumber
|
|
8
|
+
id="input-number-example"
|
|
9
|
+
name="inputNumber"
|
|
10
|
+
placeholder="Enter a number"
|
|
11
|
+
value={value}
|
|
12
|
+
onChange={(e) => setValue(e.target.value)}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { forwardRef, useCallback } from "react";
|
|
2
|
+
import { InputNumber, InputNumberProps } from "../inputNumber/InputNumber";
|
|
3
|
+
|
|
4
|
+
export type InputPriceProps = Omit<InputNumberProps, "onChange"> & {
|
|
5
|
+
locale?: string; // ex: 'fr-FR'
|
|
6
|
+
currency?: string; // ex: 'EUR'
|
|
7
|
+
allowDecimals?: boolean;
|
|
8
|
+
onChange?: (value: string) => void;
|
|
9
|
+
value?: string;
|
|
10
|
+
};
|
|
11
|
+
export const InputPrice = forwardRef<HTMLInputElement, InputPriceProps>(
|
|
12
|
+
(
|
|
13
|
+
{
|
|
14
|
+
value = "",
|
|
15
|
+
locale = "fr-FR",
|
|
16
|
+
currency = "EUR",
|
|
17
|
+
allowDecimals = true,
|
|
18
|
+
onChange,
|
|
19
|
+
...props
|
|
20
|
+
},
|
|
21
|
+
ref,
|
|
22
|
+
) => {
|
|
23
|
+
const handleBlur = useCallback(() => {
|
|
24
|
+
if (onChange) {
|
|
25
|
+
let newValue = value.replace(",", ".");
|
|
26
|
+
onChange(parseFloat(newValue || "0").toFixed(2));
|
|
27
|
+
}
|
|
28
|
+
}, [onChange, value]);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<InputNumber
|
|
32
|
+
{...props}
|
|
33
|
+
ref={ref}
|
|
34
|
+
pattern="[0-9]*[.,]?[0-9]*"
|
|
35
|
+
inputMode="decimal" // mobile keyboard adaptatif
|
|
36
|
+
value={value ?? ""}
|
|
37
|
+
onChange={(e) => onChange?.(e.target.value)}
|
|
38
|
+
onBlur={handleBlur} // Force le formatage à 2 décimales en sortie
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { InputPrice } from "./InputPrice";
|
|
3
|
+
|
|
4
|
+
export const InputPriceView = () => {
|
|
5
|
+
const [value, setValue] = useState("");
|
|
6
|
+
return (
|
|
7
|
+
<InputPrice
|
|
8
|
+
id="input-price-example"
|
|
9
|
+
name="inputPrice"
|
|
10
|
+
placeholder="Enter a price"
|
|
11
|
+
value={value}
|
|
12
|
+
onChange={setValue}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import "./textArea.css";
|
|
3
|
+
export type TextAreaProps = {
|
|
4
|
+
name: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
value?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
width?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
onChange?: (value: string, name: string) => void;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
rows?: number;
|
|
13
|
+
cols?: number;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export const TextArea = ({
|
|
17
|
+
name,
|
|
18
|
+
id,
|
|
19
|
+
value,
|
|
20
|
+
disabled,
|
|
21
|
+
width,
|
|
22
|
+
className,
|
|
23
|
+
onChange,
|
|
24
|
+
placeholder,
|
|
25
|
+
cols,
|
|
26
|
+
rows,
|
|
27
|
+
required = false,
|
|
28
|
+
}: TextAreaProps) => {
|
|
29
|
+
const [textAreaValue, setTextAreaValue] = useState(value);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setTextAreaValue(value);
|
|
32
|
+
}, [value]);
|
|
33
|
+
|
|
34
|
+
const handleChange = useCallback(
|
|
35
|
+
(e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
36
|
+
const newValue = e.target.value;
|
|
37
|
+
setTextAreaValue(newValue);
|
|
38
|
+
if (onChange) {
|
|
39
|
+
onChange(newValue, name);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
[onChange, name]
|
|
43
|
+
);
|
|
44
|
+
return (
|
|
45
|
+
<textarea
|
|
46
|
+
id={id}
|
|
47
|
+
style={{ width: width }}
|
|
48
|
+
className={`form-control-textarea ${className ?? ""}`}
|
|
49
|
+
name={name}
|
|
50
|
+
disabled={disabled}
|
|
51
|
+
value={textAreaValue}
|
|
52
|
+
onChange={handleChange}
|
|
53
|
+
placeholder={placeholder}
|
|
54
|
+
cols={cols}
|
|
55
|
+
rows={rows}
|
|
56
|
+
required={required}
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { TextArea } from "./TextArea";
|
|
3
|
+
|
|
4
|
+
export const TextAreaView = () => {
|
|
5
|
+
const textAreaData = useMemo(
|
|
6
|
+
() => [
|
|
7
|
+
{
|
|
8
|
+
name: "textArea",
|
|
9
|
+
value:
|
|
10
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
|
|
11
|
+
placeholder: "Enter text here...",
|
|
12
|
+
rows: 5,
|
|
13
|
+
cols: 50,
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
[]
|
|
17
|
+
);
|
|
18
|
+
return (
|
|
19
|
+
<div>
|
|
20
|
+
<h1>TextArea</h1>
|
|
21
|
+
{textAreaData.map((textArea, index) => (
|
|
22
|
+
<div key={index}>
|
|
23
|
+
<TextArea
|
|
24
|
+
name={textArea.name}
|
|
25
|
+
value={textArea.value}
|
|
26
|
+
placeholder={textArea.placeholder}
|
|
27
|
+
rows={textArea.rows}
|
|
28
|
+
cols={textArea.cols}
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
))}
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Col } from "./col/Col";
|
|
2
|
+
import { Container } from "./container/Container";
|
|
3
|
+
import { GridInterface } from "./grid.interface";
|
|
4
|
+
import { Row } from "./row/Row";
|
|
5
|
+
type GridProps = {
|
|
6
|
+
items: GridInterface[];
|
|
7
|
+
className?: string;
|
|
8
|
+
scroll?: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Grid = ({ items, className, scroll }: GridProps) => {
|
|
12
|
+
return (
|
|
13
|
+
<Container>
|
|
14
|
+
<Row scroll={scroll} className={className}>
|
|
15
|
+
{items.map((item, id) => (
|
|
16
|
+
<Col key={id} {...item} />
|
|
17
|
+
))}
|
|
18
|
+
</Row>
|
|
19
|
+
</Container>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Grid } from "./Grid";
|
|
2
|
+
import { GridInterface } from "./grid.interface";
|
|
3
|
+
|
|
4
|
+
export const GridView = (): JSX.Element => {
|
|
5
|
+
const mockItems: GridInterface[] = [
|
|
6
|
+
{
|
|
7
|
+
md: 6,
|
|
8
|
+
lg: 4,
|
|
9
|
+
children: <>test</>,
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
md: 6,
|
|
13
|
+
lg: 4,
|
|
14
|
+
children: <>test 2 </>,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
md: 6,
|
|
18
|
+
lg: 4,
|
|
19
|
+
children: <>test 3 </>,
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
return <Grid items={mockItems} />;
|
|
24
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ColStyled } from "./colStyled/ColStyled";
|
|
2
|
+
type ColProps = {
|
|
3
|
+
xs?: number;
|
|
4
|
+
sm?: number;
|
|
5
|
+
md?: number;
|
|
6
|
+
lg?: number;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export const Col: React.FC<ColProps> = ({ xs, sm, md, lg, children }) => {
|
|
10
|
+
return (
|
|
11
|
+
<ColStyled $xs={xs} $sm={sm} $md={md} $lg={lg}>
|
|
12
|
+
{children}
|
|
13
|
+
</ColStyled>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
const getColWidth = (size = 12) => `${(size / 12) * 100}%`;
|
|
3
|
+
type ColStyledProps = {
|
|
4
|
+
$xs?: number;
|
|
5
|
+
$sm?: number;
|
|
6
|
+
$md?: number;
|
|
7
|
+
$lg?: number;
|
|
8
|
+
};
|
|
9
|
+
export const ColStyled = styled.div<ColStyledProps>`
|
|
10
|
+
padding: 0 15px;
|
|
11
|
+
flex: 0 0 ${({ $xs }) => getColWidth($xs)};
|
|
12
|
+
max-width: ${({ $xs }) => getColWidth($xs)};
|
|
13
|
+
margin-bottom: 0.5rem;
|
|
14
|
+
margin-top: 0.5rem;
|
|
15
|
+
${({ $sm }) =>
|
|
16
|
+
$sm &&
|
|
17
|
+
css`
|
|
18
|
+
@container (min-width: 576px) {
|
|
19
|
+
flex: 0 0 ${getColWidth($sm)};
|
|
20
|
+
max-width: ${getColWidth($sm)};
|
|
21
|
+
}
|
|
22
|
+
`}
|
|
23
|
+
|
|
24
|
+
${({ $md }) =>
|
|
25
|
+
$md &&
|
|
26
|
+
css`
|
|
27
|
+
@container (min-width: 768px) {
|
|
28
|
+
flex: 0 0 ${getColWidth($md)};
|
|
29
|
+
max-width: ${getColWidth($md)};
|
|
30
|
+
}
|
|
31
|
+
`}
|
|
32
|
+
|
|
33
|
+
${({ $lg }) =>
|
|
34
|
+
$lg &&
|
|
35
|
+
css`
|
|
36
|
+
@container (min-width: 992px) {
|
|
37
|
+
flex: 0 0 ${getColWidth($lg)};
|
|
38
|
+
max-width: ${getColWidth($lg)};
|
|
39
|
+
}
|
|
40
|
+
`}
|
|
41
|
+
`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "./row.css";
|
|
2
|
+
type RowProps = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
scroll?: boolean;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const Row: React.FC<RowProps> = ({ children, className, scroll }) => (
|
|
9
|
+
<div className={`grid-row ${className ?? ""} ${scroll ? "scroll" : ""}`}>
|
|
10
|
+
{children}
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.grid-row {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-wrap: wrap;
|
|
4
|
+
margin: 0 -15px;
|
|
5
|
+
&.scroll {
|
|
6
|
+
overflow-x: auto;
|
|
7
|
+
flex-wrap: nowrap;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@container (min-width: 998px) {
|
|
12
|
+
.grid-row {
|
|
13
|
+
&.scroll {
|
|
14
|
+
overflow-x: auto;
|
|
15
|
+
flex-wrap: wrap;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useCallback, useRef, useState } from "react";
|
|
2
|
+
import { Icon } from "../icon/Icon";
|
|
3
|
+
import { IconSizeEnum } from "../icon/iconSize.enum";
|
|
4
|
+
import { OverlayPanel } from "../overlayPanel/OverlayPanel";
|
|
5
|
+
import "./header.css";
|
|
6
|
+
import { HeaderInterface } from "./header.interface";
|
|
7
|
+
|
|
8
|
+
export const Header = ({
|
|
9
|
+
children,
|
|
10
|
+
logo,
|
|
11
|
+
onClickMenu,
|
|
12
|
+
userChildren,
|
|
13
|
+
positionFixed,
|
|
14
|
+
onClickLogo,
|
|
15
|
+
showBackNavigation,
|
|
16
|
+
onClickBackNavigation,
|
|
17
|
+
}: HeaderInterface): JSX.Element => {
|
|
18
|
+
const refButton = useRef<HTMLDivElement>(null);
|
|
19
|
+
const [openOverlay, setOpenOverlay] = useState(false);
|
|
20
|
+
const onClickUser = useCallback(() => {
|
|
21
|
+
setOpenOverlay(!openOverlay);
|
|
22
|
+
}, [openOverlay, setOpenOverlay]);
|
|
23
|
+
return (
|
|
24
|
+
<div className={`header ${positionFixed ? "header--fixed" : ""}`}>
|
|
25
|
+
<div className="flex-1 d-flex align-items-center">
|
|
26
|
+
<span onClick={onClickMenu}>
|
|
27
|
+
<Icon size={IconSizeEnum.MEDIUM} classIcon="bi-list"></Icon>
|
|
28
|
+
</span>
|
|
29
|
+
{showBackNavigation && (
|
|
30
|
+
<span className="chevron-back" onClick={onClickBackNavigation}>
|
|
31
|
+
<Icon
|
|
32
|
+
size={IconSizeEnum.EXTRA_SMALL}
|
|
33
|
+
classIcon="bi-caret-left-fill"
|
|
34
|
+
></Icon>
|
|
35
|
+
</span>
|
|
36
|
+
)}
|
|
37
|
+
|
|
38
|
+
<span
|
|
39
|
+
className={`header-logo ${onClickLogo && "cursor-pointer"} `}
|
|
40
|
+
onClick={onClickLogo}
|
|
41
|
+
>
|
|
42
|
+
{logo && <img src={logo} alt="logo" />}
|
|
43
|
+
</span>
|
|
44
|
+
</div>
|
|
45
|
+
<div className="d-flex align-items-center">
|
|
46
|
+
{children}
|
|
47
|
+
<div ref={refButton} onClick={onClickUser}>
|
|
48
|
+
<Icon size={IconSizeEnum.MEDIUM} classIcon="bi-person-circle"></Icon>
|
|
49
|
+
</div>
|
|
50
|
+
{openOverlay && refButton.current && (
|
|
51
|
+
<OverlayPanel
|
|
52
|
+
position="bottomRight"
|
|
53
|
+
show={openOverlay}
|
|
54
|
+
closeOverlay={setOpenOverlay}
|
|
55
|
+
referenceElement={refButton.current}
|
|
56
|
+
children={userChildren}
|
|
57
|
+
/>
|
|
58
|
+
)}
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.header {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: space-between;
|
|
4
|
+
align-items: center;
|
|
5
|
+
padding: 1rem;
|
|
6
|
+
height: 50px;
|
|
7
|
+
border-bottom: 1px solid #cfbdbd;
|
|
8
|
+
background-color: #fff;
|
|
9
|
+
width: 100%;
|
|
10
|
+
|
|
11
|
+
&.header--fixed {
|
|
12
|
+
position: fixed;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.header-logo {
|
|
16
|
+
margin-left: 1rem;
|
|
17
|
+
|
|
18
|
+
img {
|
|
19
|
+
width: 50px;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.bi {
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface HeaderInterface {
|
|
2
|
+
logo?: string;
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
positionFixed?: boolean;
|
|
5
|
+
onClickMenu?: () => void;
|
|
6
|
+
userChildren?: React.ReactNode;
|
|
7
|
+
onClickLogo?: () => void;
|
|
8
|
+
showBackNavigation?: boolean;
|
|
9
|
+
onClickBackNavigation?: () => void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Icon } from "./Icon";
|
|
2
|
+
import { IconInterface } from "./icon.interface";
|
|
3
|
+
|
|
4
|
+
export const IconsView = (): JSX.Element => {
|
|
5
|
+
const mockItems: IconInterface[] = [
|
|
6
|
+
{
|
|
7
|
+
classIcon: "bi-list",
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
classIcon: "bi-person-circle",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
classIcon: "bi-volume-mute-fill",
|
|
14
|
+
},
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<p>
|
|
20
|
+
<a href="https://icons.getbootstrap.com/#usage" target="_blank">
|
|
21
|
+
Liste des icons utilisables
|
|
22
|
+
</a>
|
|
23
|
+
</p>
|
|
24
|
+
{mockItems.map((item, idx) => (
|
|
25
|
+
<Icon key={idx} classIcon={item.classIcon} />
|
|
26
|
+
))}
|
|
27
|
+
</>
|
|
28
|
+
);
|
|
29
|
+
};
|