kelt-ui-kit-react 1.8.5 → 1.9.0

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 (124) hide show
  1. package/dist/App.js +22 -0
  2. package/dist/App.menu.js +251 -0
  3. package/dist/App.routes.js +8 -0
  4. package/dist/_core/hooks/HistoryProvider.js +29 -0
  5. package/dist/_core/hooks/ImageChecker.js +68 -0
  6. package/dist/_core/hooks/imageExist.js +5 -0
  7. package/dist/_core/hooks/isEAN13.js +10 -0
  8. package/dist/_core/hooks/objectToQueryParams.js +28 -0
  9. package/dist/_core/hooks/useCurrency.js +12 -0
  10. package/dist/_core/hooks/useDateutils.js +59 -0
  11. package/dist/_core/hooks/useIsMobile.js +13 -0
  12. package/dist/_core/hooks/useToken.js +17 -0
  13. package/dist/_core/hooks/useValidate.js +15 -0
  14. package/dist/_core/hooks/widgetSupport.js +18 -0
  15. package/dist/action/Action.view.js +22 -0
  16. package/dist/action/ButtonAction.js +25 -0
  17. package/dist/badge/Badge.js +25 -0
  18. package/dist/badge/Badge.view.js +5 -0
  19. package/dist/button/Button.js +25 -0
  20. package/dist/button/Button.view.js +74 -0
  21. package/dist/button/button.interface.js +1 -0
  22. package/dist/button/buttonActions/ButtonActions.js +55 -0
  23. package/dist/button/buttonFile/ButtonFile.js +37 -0
  24. package/dist/button/buttonFile/ButtonFile.view.js +35 -0
  25. package/dist/button/buttonFilters/ButtonFilters.js +47 -0
  26. package/dist/card/Card.js +57 -0
  27. package/dist/card/Card.view.js +60 -0
  28. package/dist/card/card.interface.js +1 -0
  29. package/dist/card/cardAction/CardAction.js +66 -0
  30. package/dist/card/cardAction.interface.js +1 -0
  31. package/dist/card/hook/useCardInteractions.js +25 -0
  32. package/dist/carousel/Carousel.js +67 -0
  33. package/dist/carousel/Carousel.view.js +16 -0
  34. package/dist/damier/Damier.js +48 -0
  35. package/dist/damier/Damier.view.js +22 -0
  36. package/dist/damier/damierCell/DamierCell.js +21 -0
  37. package/dist/damier/damierCell/damierCell.interface.js +1 -0
  38. package/dist/dataTable/DataTable.js +117 -0
  39. package/dist/dataTable/DataTable.view.js +48 -0
  40. package/dist/dataTable/dataTable.interface.d.ts +4 -1
  41. package/dist/dataTable/dataTable.interface.js +1 -0
  42. package/dist/dataTable/dataTableActions/DataTableAction.js +26 -0
  43. package/dist/dataTable/dataTableColumn/DataTableColumn.js +21 -0
  44. package/dist/dataTable/dataTableLoading/DataTableLoading.js +16 -0
  45. package/dist/dataTable/dataTableRow/DataTableRow.js +39 -0
  46. package/dist/datePicker/DatePicker.js +64 -0
  47. package/dist/datePicker/DatePicker.view.js +5 -0
  48. package/dist/expands/Expands.js +28 -0
  49. package/dist/expands/Expands.view.js +67 -0
  50. package/dist/expands/expand/expand.interface.js +1 -0
  51. package/dist/expands/expand/expand.js +40 -0
  52. package/dist/filAriane/FilAriane.js +28 -0
  53. package/dist/filAriane/FilAriane.view.js +28 -0
  54. package/dist/filAriane/filAriane.interface.js +1 -0
  55. package/dist/form/Form.js +135 -0
  56. package/dist/form/Form.view.js +50 -0
  57. package/dist/form/form.enum.js +14 -0
  58. package/dist/form/form.interface.js +1 -0
  59. package/dist/form/input/Input.js +26 -0
  60. package/dist/form/inputNumber/InputNumber.js +57 -0
  61. package/dist/form/inputNumber/InputNumber.view.js +7 -0
  62. package/dist/form/inputPrice/InputPrice.js +36 -0
  63. package/dist/form/inputPrice/InputPrice.view.js +7 -0
  64. package/dist/form/textArea/TextArea.js +18 -0
  65. package/dist/form/textArea/TextArea.view.js +15 -0
  66. package/dist/grid/Grid.js +19 -0
  67. package/dist/grid/Grid.view.js +22 -0
  68. package/dist/grid/col/Col.js +17 -0
  69. package/dist/grid/col/colStyled/ColStyled.js +26 -0
  70. package/dist/grid/container/Container.js +17 -0
  71. package/dist/grid/grid.interface.js +1 -0
  72. package/dist/grid/row/Row.js +17 -0
  73. package/dist/header/Header.js +26 -0
  74. package/dist/header/Header.view.js +5 -0
  75. package/dist/header/header.interface.js +1 -0
  76. package/dist/home/Home.js +4 -0
  77. package/dist/icon/Icon.js +6 -0
  78. package/dist/icon/Icons.view.js +27 -0
  79. package/dist/icon/icon.interface.js +1 -0
  80. package/dist/icon/iconSize.enum.js +8 -0
  81. package/dist/index.js +50 -5356
  82. package/dist/loader/Loader.js +20 -0
  83. package/dist/loader/Loader.view.js +9 -0
  84. package/dist/main.js +7 -0
  85. package/dist/menus/Menus.js +23 -0
  86. package/dist/menus/Menus.view.js +48 -0
  87. package/dist/menus/menu/Menu.js +15 -0
  88. package/dist/menus/menu/menu.interface.js +1 -0
  89. package/dist/message/Message.js +33 -0
  90. package/dist/message/Message.view.js +11 -0
  91. package/dist/modal/Modal.js +27 -0
  92. package/dist/modal/Modal.view.js +22 -0
  93. package/dist/notFound/NotFound.js +4 -0
  94. package/dist/overlayPanel/OverlayPanel.js +132 -0
  95. package/dist/overlayPanel/OverlayPanel.view.js +20 -0
  96. package/dist/overlayPanel/overlay.context.js +26 -0
  97. package/dist/overlayPanel/overlayPanelStyled/OverlayPanelStyled.js +13 -0
  98. package/dist/pdfViewer/PdfViewer.js +71 -0
  99. package/dist/pdfViewer/PdfViewer.view.js +5 -0
  100. package/dist/quantity/Quantity.js +60 -0
  101. package/dist/quantity/Quantity.view.js +1 -0
  102. package/dist/search/Search.js +80 -0
  103. package/dist/search/Search.view.js +8 -0
  104. package/dist/select/Select.d.ts +2 -1
  105. package/dist/select/Select.js +41 -0
  106. package/dist/select/Select.view.js +75 -0
  107. package/dist/select/selectOption.interface.js +1 -0
  108. package/dist/sidebar/Sidebar.js +132 -0
  109. package/dist/sidebar/Sidebar.view.js +11 -0
  110. package/dist/sidebarData/SidebarData.js +17 -0
  111. package/dist/sidebarData/SidebarData.view.js +14 -0
  112. package/dist/style.css +1 -1
  113. package/dist/tabs/Tabs.js +41 -0
  114. package/dist/tabs/Tabs.view.js +26 -0
  115. package/dist/toaster/Toaster.js +37 -0
  116. package/dist/toaster/Toaster.view.js +16 -0
  117. package/dist/toaster/store/useToasterStore.js +22 -0
  118. package/package.json +1 -1
  119. package/src/dataTable/DataTable.tsx +55 -14
  120. package/src/dataTable/dataTable.css +26 -2
  121. package/src/dataTable/dataTable.interface.ts +4 -1
  122. package/src/dataTable/dataTableRow/DataTableRow.tsx +36 -11
  123. package/src/select/Select.tsx +4 -1
  124. package/vite.config.ts.timestamp-1787675603363-8ddae73d076bd.mjs +28 -0
@@ -0,0 +1,135 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { forwardRef, useCallback, useImperativeHandle, useRef, useState, } from "react";
14
+ import { Button } from "../button/Button";
15
+ import { Icon } from "../icon/Icon";
16
+ import { Select } from "../select/Select"; // <--- ton composant
17
+ import "./form.css";
18
+ import { Input } from "./input/Input";
19
+ import { TextArea } from "./textArea/TextArea";
20
+ export var DynamicForm = forwardRef(function (_a, ref) {
21
+ var initialForm = _a.initialForm, title = _a.title, onSubmit = _a.onSubmit, id = _a.id, children = _a.children, autoComplete = _a.autoComplete, onChange = _a.onChange, hideSubmit = _a.hideSubmit, _b = _a.disabledSubmit, disabledSubmit = _b === void 0 ? false : _b, className = _a.className;
22
+ var _c = useState(disabledSubmit), btnDisabledSubmit = _c[0], setBtnDisabledSubmit = _c[1];
23
+ var _d = useState(function () {
24
+ var initialValues = {};
25
+ initialForm.forEach(function (field) {
26
+ var _a;
27
+ initialValues[field.name] = (_a = field.value) !== null && _a !== void 0 ? _a : "";
28
+ });
29
+ return initialValues;
30
+ }), values = _d[0], setValues = _d[1];
31
+ var inputRefs = useRef({});
32
+ /** Gestion des <input> */
33
+ var handleChangeInput = useCallback(function (event, forminterface) {
34
+ var _a = event.target, name = _a.name, type = _a.type, checked = _a.checked, value = _a.value;
35
+ var newValue = type === "checkbox" ? checked : value;
36
+ if (forminterface.onChange) {
37
+ forminterface.onChange(newValue, name);
38
+ }
39
+ setValues(function (prevValues) {
40
+ var _a;
41
+ var updatedValues = __assign(__assign({}, prevValues), (_a = {}, _a[name] = newValue, _a));
42
+ if (onChange) {
43
+ onChange(updatedValues);
44
+ }
45
+ return updatedValues;
46
+ });
47
+ }, [onChange]);
48
+ var handleChangeTextArea = useCallback(function (name, value, forminterface) {
49
+ if (forminterface.onChange) {
50
+ forminterface.onChange(value, name);
51
+ }
52
+ setValues(function (prevValues) {
53
+ var _a;
54
+ var updatedValues = __assign(__assign({}, prevValues), (_a = {}, _a[name] = value, _a));
55
+ if (onChange) {
56
+ onChange(updatedValues);
57
+ }
58
+ return updatedValues;
59
+ });
60
+ }, [onChange]);
61
+ /** Gestion des <select> */
62
+ var handleChangeSelect = useCallback(function (newValue, name, forminterface) {
63
+ if (forminterface.onChange) {
64
+ forminterface.onChange(newValue, name);
65
+ }
66
+ setValues(function (prevValues) {
67
+ var _a;
68
+ var updatedValues = __assign(__assign({}, prevValues), (_a = {}, _a[name] = newValue, _a));
69
+ if (onChange)
70
+ onChange(updatedValues);
71
+ return updatedValues;
72
+ });
73
+ }, [onChange]);
74
+ var handleSubmit = useCallback(function (e) {
75
+ e.preventDefault();
76
+ if (onSubmit) {
77
+ onSubmit(values);
78
+ }
79
+ }, [onSubmit, values]);
80
+ var resetForm = function () {
81
+ setValues(function () {
82
+ var resetValues = {};
83
+ initialForm.forEach(function (field) {
84
+ var _a;
85
+ resetValues[field.name] = (_a = field.value) !== null && _a !== void 0 ? _a : "";
86
+ });
87
+ return resetValues;
88
+ });
89
+ };
90
+ var clearInput = useCallback(function (name) {
91
+ setValues(function (prevValues) {
92
+ var _a;
93
+ return (__assign(__assign({}, prevValues), (_a = {}, _a[name] = "", _a)));
94
+ });
95
+ }, []);
96
+ var focusInitialElement = function () {
97
+ var focusedField = initialForm.find(function (field) { return field.focus; });
98
+ if (focusedField && inputRefs.current[focusedField.name]) {
99
+ setTimeout(function () {
100
+ var _a;
101
+ (_a = inputRefs.current[focusedField.name]) === null || _a === void 0 ? void 0 : _a.select();
102
+ }, 500);
103
+ }
104
+ };
105
+ var getValues = function () { return values; };
106
+ var updateFormValue = function (values) {
107
+ setValues(function (prevValues) { return (__assign(__assign({}, prevValues), values)); });
108
+ };
109
+ useImperativeHandle(ref, function () { return ({
110
+ resetForm: resetForm,
111
+ clearInput: clearInput,
112
+ focusInitialElement: focusInitialElement,
113
+ getValues: getValues,
114
+ updateFormValue: updateFormValue,
115
+ setBtnDisabledSubmit: setBtnDisabledSubmit,
116
+ }); });
117
+ return (_jsxs("form", __assign({ autoComplete: autoComplete !== null && autoComplete !== void 0 ? autoComplete : "off", onSubmit: handleSubmit, className: className !== null && className !== void 0 ? className : "" }, { children: [_jsxs("div", __assign({ className: "form-content" }, { children: [initialForm.map(function (v, key) {
118
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
119
+ var required = v.onRequired
120
+ ? v.onRequired(v.value)
121
+ : (_a = v.required) !== null && _a !== void 0 ? _a : false;
122
+ var disabled = v.onDisabled
123
+ ? v.onDisabled(v.value)
124
+ : (_b = v.disabled) !== null && _b !== void 0 ? _b : false;
125
+ return (_jsxs("div", __assign({ className: "d-flex flex-column ".concat((_c = v.className) !== null && _c !== void 0 ? _c : "", " form-group form-group-").concat(v.type) }, { children: [v.label && _jsx("label", { children: v.label }), v.icon && _jsx(Icon, { classIcon: v.icon }), v.type === "select" ? (_jsx(Select, { id: (_d = v.id) !== null && _d !== void 0 ? _d : v.name, label: undefined, name: v.name, options: (_e = v.options) !== null && _e !== void 0 ? _e : [], disabled: disabled, multiple: v.multiple, value: values[v.name], required: required, defaultValue: v.value, placeholder: v.placeholder, onChangeMultiple: function (newValue) {
126
+ return handleChangeSelect(newValue, v.name, v);
127
+ }, onChange: function (newValue) {
128
+ return handleChangeSelect(newValue, v.name, v);
129
+ } })) : v.type === "textarea" ? (_jsx(TextArea, { id: (_f = v.id) !== null && _f !== void 0 ? _f : v.name, name: v.name, className: "textarea-input", placeholder: (_g = v.placeholder) !== null && _g !== void 0 ? _g : "", disabled: disabled, required: required, value: values[v.name], onChange: function (value, name) {
130
+ return handleChangeTextArea(name, value, v);
131
+ } })) : (_jsx(Input, { id: (_h = v.id) !== null && _h !== void 0 ? _h : v.name, ref: function (el) { return (inputRefs.current[v.name] = el); }, name: v.name, type: v.type, placeholder: (_j = v.placeholder) !== null && _j !== void 0 ? _j : "", autoComplete: v.autoComplete, tabIndex: 0, disabled: disabled, autoFocus: (_k = v.focus) !== null && _k !== void 0 ? _k : false, required: required, step: (_l = v.step) !== null && _l !== void 0 ? _l : "0.01", value: values[v.name], checked: v.type === "checkbox" ? !!values[v.name] : undefined, onChange: function (e) {
132
+ return handleChangeInput(e, v);
133
+ }, onInvalid: v.onInvalid ? v.onInvalid : undefined }))] }), key));
134
+ }), children] })), _jsx("div", __assign({ className: "d-flex justify-content-end form-footer" }, { children: !hideSubmit && (_jsx(Button, { id: "button-".concat(id), disabled: btnDisabledSubmit, title: title || "submit" })) }))] })));
135
+ });
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { DynamicForm } from "./Form";
3
+ import { TypeInputEnum } from "./form.enum";
4
+ export var FormView = function () {
5
+ var initialValues = [
6
+ {
7
+ value: "Alexandre",
8
+ label: "Nom",
9
+ focus: true,
10
+ name: "nom",
11
+ type: TypeInputEnum.PASSWORD,
12
+ required: true,
13
+ },
14
+ {
15
+ value: 30,
16
+ label: "Age",
17
+ name: "age",
18
+ type: TypeInputEnum.NUMBER,
19
+ },
20
+ {
21
+ value: false,
22
+ name: "validate",
23
+ label: "Validate",
24
+ type: TypeInputEnum.CHECKBOX,
25
+ },
26
+ {
27
+ value: "password",
28
+ name: "password",
29
+ label: "Password",
30
+ type: TypeInputEnum.PASSWORD,
31
+ },
32
+ {
33
+ value: "",
34
+ name: "selectOption",
35
+ label: "Select Option",
36
+ placeholder: "Choose an option",
37
+ type: TypeInputEnum.SELECT,
38
+ options: [
39
+ { value: "option1", label: "Option 1" },
40
+ { value: "option2", label: "Option 2" },
41
+ { value: "option3", label: "Option 3" },
42
+ ],
43
+ },
44
+ ];
45
+ // Fonction qui sera appelée lors de la soumission du formulaire
46
+ var handleSubmit = function (values) {
47
+ console.log("Form Submitted: ", values);
48
+ };
49
+ return _jsx(DynamicForm, { onSubmit: handleSubmit, initialForm: initialValues });
50
+ };
@@ -0,0 +1,14 @@
1
+ export var TypeInputEnum;
2
+ (function (TypeInputEnum) {
3
+ TypeInputEnum["TEXT"] = "text";
4
+ TypeInputEnum["BUTTON"] = "button";
5
+ TypeInputEnum["EMAIL"] = "email";
6
+ TypeInputEnum["HIDDEN"] = "hidden";
7
+ TypeInputEnum["PASSWORD"] = "password";
8
+ TypeInputEnum["NUMBER"] = "number";
9
+ TypeInputEnum["CHECKBOX"] = "checkbox";
10
+ TypeInputEnum["RADIO"] = "radio";
11
+ TypeInputEnum["DATE"] = "date";
12
+ TypeInputEnum["SELECT"] = "select";
13
+ TypeInputEnum["TEXTAREA"] = "textarea";
14
+ })(TypeInputEnum || (TypeInputEnum = {}));
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { forwardRef, useState } from "react";
14
+ import { Icon } from "../../icon/Icon";
15
+ import { TypeInputEnum } from "../form.enum";
16
+ import "./input.css";
17
+ export var Input = forwardRef(function (_a, ref) {
18
+ var id = _a.id, name = _a.name, _b = _a.type, type = _b === void 0 ? TypeInputEnum.TEXT : _b, value = _a.value, onInvalid = _a.onInvalid, placeholder = _a.placeholder, className = _a.className, inputMode = _a.inputMode, minLength = _a.minLength, maxLength = _a.maxLength, _c = _a.autoFocus, autoFocus = _c === void 0 ? false : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.required, required = _e === void 0 ? false : _e, autoComplete = _a.autoComplete, _f = _a.tabIndex, tabIndex = _f === void 0 ? 0 : _f, step = _a.step, checked = _a.checked, onChange = _a.onChange, onBlur = _a.onBlur, onClick = _a.onClick, handleKeyDown = _a.handleKeyDown;
19
+ // Si le type est password, on utilise l'input de type password
20
+ var _g = useState(false), showPassword = _g[0], setShowPassword = _g[1];
21
+ return (_jsxs("div", __assign({ className: "input-container ".concat("input-container-".concat(type), " ") }, { children: [_jsx("input", { name: "hide-".concat(name), type: "text", style: { display: "none" } }), _jsx("input", { ref: ref, id: id, name: name, inputMode: inputMode !== null && inputMode !== void 0 ? inputMode : (type === "number" ? "numeric" : "text"), type: showPassword ? TypeInputEnum.TEXT : type, spellCheck: "false", value: value, placeholder: placeholder, disabled: disabled, required: required, autoComplete: autoComplete !== null && autoComplete !== void 0 ? autoComplete : "new-password", step: step, tabIndex: tabIndex, autoFocus: autoFocus, minLength: minLength, maxLength: maxLength, onChange: onChange, checked: checked, onKeyDown: handleKeyDown, onBlur: onBlur, onClick: function (e) {
22
+ e.stopPropagation();
23
+ onClick && onClick(e);
24
+ }, className: "input-field ".concat(className !== null && className !== void 0 ? className : ""), onInvalid: onInvalid }), type === TypeInputEnum.PASSWORD && (_jsx("div", __assign({ onClick: function () { return setShowPassword(!showPassword); }, className: "input-password-icon" }, { children: _jsx(Icon, { classIcon: showPassword ? "bi-eye-slash" : "bi-eye" }) })))] })));
25
+ });
26
+ Input.displayName = "Input";
@@ -0,0 +1,57 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { forwardRef, useCallback } from "react";
14
+ import { TypeInputEnum } from "../form.enum";
15
+ import "../input/input.css";
16
+ export var InputNumber = forwardRef(function (_a, ref) {
17
+ var id = _a.id, name = _a.name, _b = _a.value, value = _b === void 0 ? "" : _b, placeholder = _a.placeholder, className = _a.className, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.required, required = _d === void 0 ? false : _d, _e = _a.autoFocus, autoFocus = _e === void 0 ? false : _e, _f = _a.maxLength, maxLength = _f === void 0 ? 10 : _f, _g = _a.autoComplete, autoComplete = _g === void 0 ? "off" : _g, _h = _a.tabIndex, tabIndex = _h === void 0 ? 0 : _h, _j = _a.inputMode, inputMode = _j === void 0 ? "numeric" : _j, pattern = _a.pattern, onChange = _a.onChange, onBlur = _a.onBlur, onClick = _a.onClick, onKeyDown = _a.onKeyDown, onFocus = _a.onFocus;
18
+ var handleChange = useCallback(function (e) {
19
+ var newValue = e.target.value.replace(",", ".");
20
+ // ✅ Autoriser les chiffres, . , et - (mais - seulement au début)
21
+ if (!/^-?\d*[.,]?\d*$/.test(newValue) && newValue !== "") {
22
+ return; // saisie invalide → on ignore
23
+ }
24
+ // ✅ Empêcher plus de maxLength
25
+ if (maxLength && newValue.length > maxLength) {
26
+ return;
27
+ }
28
+ onChange === null || onChange === void 0 ? void 0 : onChange(e, newValue);
29
+ }, [onChange, maxLength]);
30
+ var handleKeyDown = function (e) {
31
+ var _a;
32
+ if (onKeyDown) {
33
+ onKeyDown(e);
34
+ }
35
+ // ✅ Autoriser chiffres, contrôle, ., , et -
36
+ var allowed = /[0-9]|Backspace|Delete|ArrowLeft|ArrowRight|Tab|Enter|Home|End/.test(e.key) ||
37
+ e.key === "." ||
38
+ e.key === "," ||
39
+ e.key === "-";
40
+ if (!allowed) {
41
+ e.preventDefault();
42
+ return;
43
+ }
44
+ // ❌ Interdire plusieurs "-" ou "-" ailleurs que début
45
+ if (e.key === "-") {
46
+ var cursorPos = (_a = e.target.selectionStart) !== null && _a !== void 0 ? _a : 0;
47
+ if (cursorPos !== 0 || value.includes("-")) {
48
+ e.preventDefault();
49
+ }
50
+ }
51
+ };
52
+ return (_jsx("div", __assign({ className: "input-container input-container-number" }, { children: _jsx("input", { ref: ref, id: id, name: name, type: TypeInputEnum.TEXT, value: value, placeholder: placeholder, disabled: disabled, required: required, autoFocus: autoFocus, autoComplete: autoComplete, pattern: pattern, tabIndex: tabIndex, inputMode: inputMode, spellCheck: "false", className: "input-field ".concat(className !== null && className !== void 0 ? className : ""), onChange: handleChange, onWheel: function (e) { return e.currentTarget.blur(); }, onKeyDown: handleKeyDown, onFocus: onFocus, onBlur: onBlur, onClick: function (e) {
53
+ e.stopPropagation();
54
+ onClick === null || onClick === void 0 ? void 0 : onClick(e);
55
+ } }) })));
56
+ });
57
+ InputNumber.displayName = "InputNumber";
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { InputNumber } from "./InputNumber";
4
+ export var InputNumberView = function () {
5
+ var _a = useState(""), value = _a[0], setValue = _a[1];
6
+ return (_jsx(InputNumber, { id: "input-number-example", name: "inputNumber", placeholder: "Enter a number", value: value, onChange: function (e) { return setValue(e.target.value); } }));
7
+ };
@@ -0,0 +1,36 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ import { forwardRef, useCallback } from "react";
25
+ import { InputNumber } from "../inputNumber/InputNumber";
26
+ export var InputPrice = forwardRef(function (_a, ref) {
27
+ var _b = _a.value, value = _b === void 0 ? "" : _b, _c = _a.locale, locale = _c === void 0 ? "fr-FR" : _c, _d = _a.currency, currency = _d === void 0 ? "EUR" : _d, _e = _a.allowDecimals, allowDecimals = _e === void 0 ? true : _e, onChange = _a.onChange, props = __rest(_a, ["value", "locale", "currency", "allowDecimals", "onChange"]);
28
+ var handleBlur = useCallback(function () {
29
+ if (onChange) {
30
+ var newValue = value.replace(",", ".");
31
+ onChange(parseFloat(newValue || "0").toFixed(2));
32
+ }
33
+ }, [onChange, value]);
34
+ return (_jsx(InputNumber, __assign({}, props, { ref: ref, pattern: "[0-9]*[.,]?[0-9]*", inputMode: "decimal" // mobile keyboard adaptatif
35
+ , value: value !== null && value !== void 0 ? value : "", onChange: function (e) { return onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value); }, onBlur: handleBlur })));
36
+ });
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { InputPrice } from "./InputPrice";
4
+ export var InputPriceView = function () {
5
+ var _a = useState(""), value = _a[0], setValue = _a[1];
6
+ return (_jsx(InputPrice, { id: "input-price-example", name: "inputPrice", placeholder: "Enter a price", value: value, onChange: setValue }));
7
+ };
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useState } from "react";
3
+ import "./textArea.css";
4
+ export var TextArea = function (_a) {
5
+ var name = _a.name, id = _a.id, value = _a.value, disabled = _a.disabled, width = _a.width, className = _a.className, onChange = _a.onChange, placeholder = _a.placeholder, cols = _a.cols, rows = _a.rows, _b = _a.required, required = _b === void 0 ? false : _b;
6
+ var _c = useState(value), textAreaValue = _c[0], setTextAreaValue = _c[1];
7
+ useEffect(function () {
8
+ setTextAreaValue(value);
9
+ }, [value]);
10
+ var handleChange = useCallback(function (e) {
11
+ var newValue = e.target.value;
12
+ setTextAreaValue(newValue);
13
+ if (onChange) {
14
+ onChange(newValue, name);
15
+ }
16
+ }, [onChange, name]);
17
+ return (_jsx("textarea", { id: id, style: { width: width }, className: "form-control-textarea ".concat(className !== null && className !== void 0 ? className : ""), name: name, disabled: disabled, value: textAreaValue, onChange: handleChange, placeholder: placeholder, cols: cols, rows: rows, required: required }));
18
+ };
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { TextArea } from "./TextArea";
4
+ export var TextAreaView = function () {
5
+ var textAreaData = useMemo(function () { return [
6
+ {
7
+ name: "textArea",
8
+ value: "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.",
9
+ placeholder: "Enter text here...",
10
+ rows: 5,
11
+ cols: 50,
12
+ },
13
+ ]; }, []);
14
+ return (_jsxs("div", { children: [_jsx("h1", { children: "TextArea" }), textAreaData.map(function (textArea, index) { return (_jsx("div", { children: _jsx(TextArea, { name: textArea.name, value: textArea.value, placeholder: textArea.placeholder, rows: textArea.rows, cols: textArea.cols }) }, index)); })] }));
15
+ };
@@ -0,0 +1,19 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { Col } from "./col/Col";
14
+ import { Container } from "./container/Container";
15
+ import { Row } from "./row/Row";
16
+ export var Grid = function (_a) {
17
+ var items = _a.items, className = _a.className, scroll = _a.scroll;
18
+ return (_jsx(Container, { children: _jsx(Row, __assign({ scroll: scroll, className: className }, { children: items.map(function (item, id) { return (_jsx(Col, __assign({}, item), id)); }) })) }));
19
+ };
@@ -0,0 +1,22 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Grid } from "./Grid";
3
+ export var GridView = function () {
4
+ var mockItems = [
5
+ {
6
+ md: 6,
7
+ lg: 4,
8
+ children: _jsx(_Fragment, { children: "test" }),
9
+ },
10
+ {
11
+ md: 6,
12
+ lg: 4,
13
+ children: _jsx(_Fragment, { children: "test 2 " }),
14
+ },
15
+ {
16
+ md: 6,
17
+ lg: 4,
18
+ children: _jsx(_Fragment, { children: "test 3 " }),
19
+ },
20
+ ];
21
+ return _jsx(Grid, { items: mockItems });
22
+ };
@@ -0,0 +1,17 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { ColStyled } from "./colStyled/ColStyled";
14
+ export var Col = function (_a) {
15
+ var xs = _a.xs, sm = _a.sm, md = _a.md, lg = _a.lg, children = _a.children;
16
+ return (_jsx(ColStyled, __assign({ "$xs": xs, "$sm": sm, "$md": md, "$lg": lg }, { children: children })));
17
+ };
@@ -0,0 +1,26 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ import styled, { css } from "styled-components";
6
+ var getColWidth = function (size) {
7
+ if (size === void 0) { size = 12; }
8
+ return "".concat((size / 12) * 100, "%");
9
+ };
10
+ export var ColStyled = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding: 0 15px;\n flex: 0 0 ", ";\n max-width: ", ";\n margin-bottom: 0.5rem;\n margin-top: 0.5rem;\n ", "\n\n ", "\n\n ", "\n"], ["\n padding: 0 15px;\n flex: 0 0 ", ";\n max-width: ", ";\n margin-bottom: 0.5rem;\n margin-top: 0.5rem;\n ", "\n\n ", "\n\n ", "\n"])), function (_a) {
11
+ var $xs = _a.$xs;
12
+ return getColWidth($xs);
13
+ }, function (_a) {
14
+ var $xs = _a.$xs;
15
+ return getColWidth($xs);
16
+ }, function (_a) {
17
+ var $sm = _a.$sm;
18
+ return $sm && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n @container (min-width: 576px) {\n flex: 0 0 ", ";\n max-width: ", ";\n }\n "], ["\n @container (min-width: 576px) {\n flex: 0 0 ", ";\n max-width: ", ";\n }\n "])), getColWidth($sm), getColWidth($sm));
19
+ }, function (_a) {
20
+ var $md = _a.$md;
21
+ return $md && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n @container (min-width: 768px) {\n flex: 0 0 ", ";\n max-width: ", ";\n }\n "], ["\n @container (min-width: 768px) {\n flex: 0 0 ", ";\n max-width: ", ";\n }\n "])), getColWidth($md), getColWidth($md));
22
+ }, function (_a) {
23
+ var $lg = _a.$lg;
24
+ return $lg && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n @container (min-width: 992px) {\n flex: 0 0 ", ";\n max-width: ", ";\n }\n "], ["\n @container (min-width: 992px) {\n flex: 0 0 ", ";\n max-width: ", ";\n }\n "])), getColWidth($lg), getColWidth($lg));
25
+ });
26
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
@@ -0,0 +1,17 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import "./container.css";
14
+ export var Container = function (_a) {
15
+ var children = _a.children;
16
+ return (_jsx("div", __assign({ className: "container" }, { children: children })));
17
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import "./row.css";
14
+ export var Row = function (_a) {
15
+ var children = _a.children, className = _a.className, scroll = _a.scroll;
16
+ return (_jsx("div", __assign({ className: "grid-row ".concat(className !== null && className !== void 0 ? className : "", " ").concat(scroll ? "scroll" : "") }, { children: children })));
17
+ };
@@ -0,0 +1,26 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useCallback, useRef, useState } from "react";
14
+ import { Icon } from "../icon/Icon";
15
+ import { IconSizeEnum } from "../icon/iconSize.enum";
16
+ import { OverlayPanel } from "../overlayPanel/OverlayPanel";
17
+ import "./header.css";
18
+ export var Header = function (_a) {
19
+ var children = _a.children, logo = _a.logo, onClickMenu = _a.onClickMenu, userChildren = _a.userChildren, positionFixed = _a.positionFixed, onClickLogo = _a.onClickLogo, showBackNavigation = _a.showBackNavigation, onClickBackNavigation = _a.onClickBackNavigation;
20
+ var refButton = useRef(null);
21
+ var _b = useState(false), openOverlay = _b[0], setOpenOverlay = _b[1];
22
+ var onClickUser = useCallback(function () {
23
+ setOpenOverlay(!openOverlay);
24
+ }, [openOverlay, setOpenOverlay]);
25
+ return (_jsxs("div", __assign({ className: "header ".concat(positionFixed ? "header--fixed" : "") }, { children: [_jsxs("div", __assign({ className: "flex-1 d-flex align-items-center" }, { children: [_jsx("span", __assign({ onClick: onClickMenu }, { children: _jsx(Icon, { size: IconSizeEnum.MEDIUM, classIcon: "bi-list" }) })), showBackNavigation && (_jsx("span", __assign({ className: "chevron-back", onClick: onClickBackNavigation }, { children: _jsx(Icon, { size: IconSizeEnum.EXTRA_SMALL, classIcon: "bi-caret-left-fill" }) }))), _jsx("span", __assign({ className: "header-logo ".concat(onClickLogo && "cursor-pointer", " "), onClick: onClickLogo }, { children: logo && _jsx("img", { src: logo, alt: "logo" }) }))] })), _jsxs("div", __assign({ className: "d-flex align-items-center" }, { children: [children, _jsx("div", __assign({ ref: refButton, onClick: onClickUser }, { children: _jsx(Icon, { size: IconSizeEnum.MEDIUM, classIcon: "bi-person-circle" }) })), openOverlay && refButton.current && (_jsx(OverlayPanel, { position: "bottomRight", show: openOverlay, closeOverlay: setOpenOverlay, referenceElement: refButton.current, children: userChildren }))] }))] })));
26
+ };
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Header } from "./Header";
3
+ export var HeaderView = function () {
4
+ return _jsx(Header, { showBackNavigation: true });
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export var Home = function () {
3
+ return _jsx("h1", { children: "Home" });
4
+ };
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./icon.css";
3
+ export var Icon = function (_a) {
4
+ var classIcon = _a.classIcon, size = _a.size;
5
+ return _jsx("i", { className: "bi ".concat(classIcon, " ").concat(size !== null && size !== void 0 ? size : "sm") });
6
+ };
@@ -0,0 +1,27 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { Icon } from "./Icon";
14
+ export var IconsView = function () {
15
+ var mockItems = [
16
+ {
17
+ classIcon: "bi-list",
18
+ },
19
+ {
20
+ classIcon: "bi-person-circle",
21
+ },
22
+ {
23
+ classIcon: "bi-volume-mute-fill",
24
+ },
25
+ ];
26
+ return (_jsxs(_Fragment, { children: [_jsx("p", { children: _jsx("a", __assign({ href: "https://icons.getbootstrap.com/#usage", target: "_blank" }, { children: "Liste des icons utilisables" })) }), mockItems.map(function (item, idx) { return (_jsx(Icon, { classIcon: item.classIcon }, idx)); })] }));
27
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ export var IconSizeEnum;
2
+ (function (IconSizeEnum) {
3
+ IconSizeEnum["EXTRA_SMALL"] = "xs";
4
+ IconSizeEnum["SMALL"] = "sm";
5
+ IconSizeEnum["MEDIUM"] = "md";
6
+ IconSizeEnum["LARGE"] = "xl";
7
+ IconSizeEnum["EXTRA_LARGE"] = "xxl";
8
+ })(IconSizeEnum || (IconSizeEnum = {}));