kelt-ui-kit-react 1.8.3 → 1.8.5
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/badge/Badge.d.ts +1 -3
- package/dist/button/button.interface.d.ts +1 -1
- package/dist/dataTable/DataTable.d.ts +3 -17
- package/dist/dataTable/dataTable.interface.d.ts +4 -21
- package/dist/dataTable/dataTableActions/DataTableAction.d.ts +2 -2
- package/dist/dataTable/dataTableColumn/DataTableColumn.d.ts +7 -13
- package/dist/dataTable/dataTableLoading/DataTableLoading.d.ts +3 -1
- package/dist/dataTable/dataTableRow/DataTableRow.d.ts +3 -5
- package/dist/expands/expand/expand.d.ts +1 -1
- package/dist/form/form.enum.d.ts +0 -1
- package/dist/form/input/Input.d.ts +0 -3
- package/dist/form/inputNumber/InputNumber.d.ts +2 -0
- package/dist/icon/Icon.d.ts +1 -1
- package/dist/icon/icon.interface.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +2759 -3573
- package/dist/overlayPanel/OverlayPanel.d.ts +1 -3
- package/dist/select/Select.d.ts +1 -4
- package/dist/select/selectOption.interface.d.ts +0 -1
- package/dist/style.css +1 -1
- package/dist/tabs/Tabs.d.ts +1 -2
- package/package.json +1 -1
- package/src/badge/Badge.tsx +1 -9
- package/src/badge/badge.css +0 -4
- package/src/button/Button.tsx +1 -1
- package/src/button/button.interface.tsx +1 -1
- package/src/card/card.css +3 -23
- package/src/card/cardAction/CardAction.tsx +4 -4
- package/src/damier/damier.css +3 -2
- package/src/dataTable/DataTable.tsx +45 -670
- package/src/dataTable/DataTable.view.tsx +14 -47
- package/src/dataTable/dataTable.css +5 -153
- package/src/dataTable/dataTable.interface.ts +4 -21
- package/src/dataTable/dataTableActions/DataTableAction.tsx +2 -2
- package/src/dataTable/dataTableColumn/DataTableColumn.tsx +14 -64
- package/src/dataTable/dataTableLoading/DataTableLoading.tsx +15 -4
- package/src/dataTable/dataTableRow/DataTableRow.tsx +35 -60
- package/src/expands/Expands.tsx +16 -2
- package/src/expands/expand/expand.tsx +18 -6
- package/src/form/Form.tsx +12 -13
- package/src/form/form.css +2 -13
- package/src/form/form.enum.ts +0 -1
- package/src/form/input/Input.tsx +7 -61
- package/src/form/input/input.css +1 -23
- package/src/form/inputNumber/InputNumber.tsx +11 -6
- package/src/form/inputPrice/InputPrice.tsx +4 -2
- package/src/icon/Icon.tsx +2 -6
- package/src/icon/icon.interface.tsx +0 -1
- package/src/index.ts +0 -2
- package/src/overlayPanel/OverlayPanel.tsx +10 -23
- package/src/overlayPanel/overlay.context.tsx +4 -6
- package/src/overlayPanel/overlayPanel.css +1 -10
- package/src/select/Select.tsx +38 -134
- package/src/select/select.css +14 -65
- package/src/select/selectOption.interface.ts +0 -1
- package/src/sidebar/Sidebar.tsx +80 -9
- package/src/sidebar/sidebar.css +18 -1
- package/src/tabs/Tabs.tsx +1 -19
- package/dist/_core/type/generiqueType.d.ts +0 -4
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/DataTableColumnFilter.d.ts +0 -10
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDate/DataTableColumnFilterDate.d.ts +0 -9
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDateRange/dataTableColumnFilterDateRange.d.ts +0 -9
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterEnum/DataTableColumnFilterEnum.d.ts +0 -13
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterString/DataTableColumnFilterString.d.ts +0 -9
- package/dist/dataTable/dataTableColumn/dataTableColumnSort/DataTableColumnSort.d.ts +0 -11
- package/dist/dataTable/dataTableFilters/DataTableFilters.d.ts +0 -7
- package/dist/dataTable/dataTableRow/dataTableRowOverlay/DataTableRowOverlay.d.ts +0 -12
- package/dist/dataTable/dataTableRow/dataTableRowValue/DataTableRowValue.d.ts +0 -11
- package/kelt-ui-kit-react-1.6.9.tgz +0 -0
- package/package/README.md +0 -46
- package/package/index.html +0 -20
- package/package/package.json +0 -56
- package/package/public/favicon.ico +0 -0
- package/package/public/index.html +0 -18
- package/package/public/logo192.png +0 -0
- package/package/public/logo512.png +0 -0
- package/package/public/manifest.json +0 -25
- package/package/public/robots.txt +0 -3
- package/package/src/App.css +0 -11
- package/package/src/App.menu.tsx +0 -249
- package/package/src/App.routes.tsx +0 -16
- package/package/src/App.tsx +0 -30
- package/package/src/_core/hooks/HistoryProvider.tsx +0 -25
- package/package/src/_core/hooks/ImageChecker.tsx +0 -26
- package/package/src/_core/hooks/imageExist.tsx +0 -9
- package/package/src/_core/hooks/isEAN13.tsx +0 -16
- package/package/src/_core/hooks/objectToQueryParams.tsx +0 -32
- package/package/src/_core/hooks/useCurrency.tsx +0 -18
- package/package/src/_core/hooks/useDateutils.ts +0 -64
- package/package/src/_core/hooks/useIsMobile.ts +0 -18
- package/package/src/_core/hooks/useToken.tsx +0 -19
- package/package/src/_core/hooks/useValidate.tsx +0 -18
- package/package/src/_core/hooks/widgetSupport.tsx +0 -39
- package/package/src/action/Action.view.tsx +0 -21
- package/package/src/action/ButtonAction.tsx +0 -32
- package/package/src/action/action.css +0 -20
- package/package/src/badge/Badge.tsx +0 -34
- package/package/src/badge/Badge.view.tsx +0 -15
- package/package/src/badge/badge.css +0 -55
- package/package/src/button/Button.tsx +0 -46
- package/package/src/button/Button.view.tsx +0 -85
- package/package/src/button/button.css +0 -53
- package/package/src/button/button.interface.tsx +0 -21
- package/package/src/button/buttonActions/ButtonActions.tsx +0 -104
- package/package/src/button/buttonFile/ButtonFile.tsx +0 -59
- package/package/src/button/buttonFile/ButtonFile.view.tsx +0 -70
- package/package/src/button/buttonFilters/ButtonFilters.tsx +0 -102
- package/package/src/button/buttonFilters/buttonFilters.css +0 -22
- package/package/src/card/Card.tsx +0 -125
- package/package/src/card/Card.view.tsx +0 -73
- package/package/src/card/card.css +0 -145
- package/package/src/card/card.interface.tsx +0 -9
- package/package/src/card/cardAction/CardAction.tsx +0 -135
- package/package/src/card/cardAction/cardAction.css +0 -10
- package/package/src/card/cardAction.interface.tsx +0 -10
- package/package/src/card/hook/useCardInteractions.tsx +0 -30
- package/package/src/carousel/Carousel.css +0 -44
- package/package/src/carousel/Carousel.tsx +0 -115
- package/package/src/carousel/Carousel.view.tsx +0 -13
- package/package/src/damier/Damier.tsx +0 -64
- package/package/src/damier/Damier.view.tsx +0 -31
- package/package/src/damier/damier.css +0 -50
- package/package/src/damier/damierCell/DamierCell.tsx +0 -18
- package/package/src/damier/damierCell/damierCell.interface.tsx +0 -5
- package/package/src/dataTable/DataTable.tsx +0 -259
- package/package/src/dataTable/DataTable.view.tsx +0 -62
- package/package/src/dataTable/dataTable.css +0 -30
- package/package/src/dataTable/dataTable.interface.ts +0 -30
- package/package/src/dataTable/dataTableActions/DataTableAction.tsx +0 -44
- package/package/src/dataTable/dataTableColumn/DataTableColumn.tsx +0 -27
- package/package/src/dataTable/dataTableLoading/DataTableLoading.tsx +0 -21
- package/package/src/dataTable/dataTableRow/DataTableRow.tsx +0 -54
- package/package/src/datePicker/DatePicker.tsx +0 -110
- package/package/src/datePicker/DatePicker.view.tsx +0 -9
- package/package/src/datePicker/datePicker.css +0 -77
- package/package/src/expands/Expands.tsx +0 -42
- package/package/src/expands/Expands.view.tsx +0 -90
- package/package/src/expands/expand/expand.interface.tsx +0 -8
- package/package/src/expands/expand/expand.tsx +0 -75
- package/package/src/expands/expands.css +0 -97
- package/package/src/filAriane/FilAriane.tsx +0 -57
- package/package/src/filAriane/FilAriane.view.tsx +0 -28
- package/package/src/filAriane/filAriane.css +0 -23
- package/package/src/filAriane/filAriane.interface.tsx +0 -6
- package/package/src/form/Form.tsx +0 -279
- package/package/src/form/Form.view.tsx +0 -59
- package/package/src/form/form.css +0 -62
- package/package/src/form/form.enum.ts +0 -13
- package/package/src/form/form.interface.tsx +0 -37
- package/package/src/form/input/Input.tsx +0 -106
- package/package/src/form/input/input.css +0 -26
- package/package/src/form/inputNumber/InputNumber.tsx +0 -132
- package/package/src/form/inputNumber/InputNumber.view.tsx +0 -15
- package/package/src/form/inputPrice/InputPrice.tsx +0 -42
- package/package/src/form/inputPrice/InputPrice.view.tsx +0 -15
- package/package/src/form/textArea/TextArea.tsx +0 -59
- package/package/src/form/textArea/TextArea.view.tsx +0 -34
- package/package/src/form/textArea/textArea.css +0 -9
- package/package/src/grid/Grid.tsx +0 -21
- package/package/src/grid/Grid.view.tsx +0 -24
- package/package/src/grid/col/Col.tsx +0 -15
- package/package/src/grid/col/colStyled/ColStyled.tsx +0 -41
- package/package/src/grid/container/Container.tsx +0 -8
- package/package/src/grid/container/container.css +0 -5
- package/package/src/grid/grid.interface.tsx +0 -7
- package/package/src/grid/row/Row.tsx +0 -12
- package/package/src/grid/row/row.css +0 -18
- package/package/src/header/Header.tsx +0 -62
- package/package/src/header/Header.view.tsx +0 -5
- package/package/src/header/header.css +0 -26
- package/package/src/header/header.interface.tsx +0 -10
- package/package/src/home/Home.tsx +0 -3
- package/package/src/icon/Icon.tsx +0 -6
- package/package/src/icon/Icons.view.tsx +0 -29
- package/package/src/icon/icon.css +0 -20
- package/package/src/icon/icon.interface.tsx +0 -6
- package/package/src/icon/iconSize.enum.ts +0 -7
- package/package/src/index.css +0 -502
- package/package/src/index.ts +0 -58
- package/package/src/loader/Loader.tsx +0 -37
- package/package/src/loader/Loader.view.tsx +0 -20
- package/package/src/loader/loader.css +0 -30
- package/package/src/logo.svg +0 -1
- package/package/src/main.tsx +0 -10
- package/package/src/menus/Menus.tsx +0 -42
- package/package/src/menus/Menus.view.tsx +0 -39
- package/package/src/menus/menu/Menu.tsx +0 -17
- package/package/src/menus/menu/menu.interface.tsx +0 -9
- package/package/src/menus/menus.css +0 -47
- package/package/src/message/Message.tsx +0 -30
- package/package/src/message/Message.view.tsx +0 -22
- package/package/src/message/message.css +0 -29
- package/package/src/modal/Modal.tsx +0 -59
- package/package/src/modal/Modal.view.tsx +0 -26
- package/package/src/modal/modal.css +0 -71
- package/package/src/notFound/NotFound.tsx +0 -3
- package/package/src/overlayPanel/OverlayPanel.tsx +0 -195
- package/package/src/overlayPanel/OverlayPanel.view.tsx +0 -25
- package/package/src/overlayPanel/overlay.context.tsx +0 -28
- package/package/src/overlayPanel/overlayPanel.css +0 -35
- package/package/src/overlayPanel/overlayPanelStyled/OverlayPanelStyled.tsx +0 -18
- package/package/src/pdfViewer/PdfViewer.tsx +0 -73
- package/package/src/pdfViewer/PdfViewer.view.tsx +0 -5
- package/package/src/quantity/Quantity.tsx +0 -103
- package/package/src/quantity/Quantity.view.tsx +0 -0
- package/package/src/quantity/quantity.css +0 -26
- package/package/src/search/Search.tsx +0 -161
- package/package/src/search/Search.view.tsx +0 -14
- package/package/src/search/search.css +0 -59
- package/package/src/select/Select.tsx +0 -103
- package/package/src/select/Select.view.tsx +0 -71
- package/package/src/select/select.css +0 -69
- package/package/src/select/selectOption.interface.ts +0 -4
- package/package/src/sidebar/Sidebar.tsx +0 -208
- package/package/src/sidebar/Sidebar.view.tsx +0 -17
- package/package/src/sidebar/sidebar.css +0 -104
- package/package/src/sidebarData/SidebarData.tsx +0 -19
- package/package/src/sidebarData/SidebarData.view.tsx +0 -19
- package/package/src/sidebarData/sidebarData.css +0 -27
- package/package/src/tabs/Tabs.tsx +0 -90
- package/package/src/tabs/Tabs.view.tsx +0 -20
- package/package/src/tabs/tabs.css +0 -24
- package/package/src/toaster/Toaster.tsx +0 -55
- package/package/src/toaster/Toaster.view.tsx +0 -24
- package/package/src/toaster/store/useToasterStore.tsx +0 -41
- package/package/src/toaster/toaster.css +0 -87
- package/package/tsconfig.json +0 -28
- package/package/vite.config.ts +0 -20
- package/package/vite.config.ts.timestamp-1733262892554-a13dfef6e8a29.mjs +0 -24
- package/package/vite.config.ts.timestamp-1757847121745-e5a5bf54b81b.mjs +0 -28
- package/package/vite.config.ts.timestamp-1759742478362-4ac5c5a7db34b.mjs +0 -28
- package/src/_core/type/generiqueType.tsx +0 -4
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/DataTableColumnFilter.tsx +0 -36
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilter.css +0 -0
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDate/DataTableColumnFilterDate.tsx +0 -39
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDateRange/dataTableColumnFilterDateRange.tsx +0 -80
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterEnum/DataTableColumnFilterEnum.tsx +0 -89
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterString/DataTableColumnFilterString.tsx +0 -37
- package/src/dataTable/dataTableColumn/dataTableColumnSort/DataTableColumnSort.tsx +0 -42
- package/src/dataTable/dataTableFilters/DataTableFilters.tsx +0 -91
- package/src/dataTable/dataTableFilters/dataTableFilters.css +0 -16
- package/src/dataTable/dataTableRow/dataTableRowOverlay/DataTableRowOverlay.tsx +0 -80
- package/src/dataTable/dataTableRow/dataTableRowValue/DataTableRowValue.tsx +0 -123
|
@@ -1,132 +0,0 @@
|
|
|
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";
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
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
|
-
);
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
`;
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
);
|
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
};
|