kelt-ui-kit-react 2.0.8 → 2.0.9
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 +40 -31
- package/README.md +124 -72
- package/dist/App.d.ts +2 -3
- package/dist/App.menu.d.ts +10 -10
- package/dist/App.routes.d.ts +1 -1
- package/dist/_core/hooks/HistoryProvider.d.ts +5 -5
- package/dist/_core/hooks/ImageChecker.d.ts +5 -6
- package/dist/_core/hooks/imageExist.d.ts +5 -6
- package/dist/_core/hooks/isEAN13.d.ts +1 -1
- package/dist/_core/hooks/objectToQueryParams.d.ts +1 -1
- package/dist/_core/hooks/useCurrency.d.ts +3 -3
- package/dist/_core/hooks/useDateutils.d.ts +4 -4
- package/dist/_core/hooks/useIsMobile.d.ts +1 -1
- package/dist/_core/hooks/useToken.d.ts +3 -3
- package/dist/_core/hooks/useValidate.d.ts +5 -5
- package/dist/_core/hooks/widgetSupport.d.ts +1 -1
- package/dist/_core/type/generiqueType.d.ts +4 -0
- package/dist/action/Action.view.d.ts +1 -1
- package/dist/action/ButtonAction.d.ts +8 -9
- package/dist/addressSearch/AddressSearch.d.ts +18 -19
- package/dist/addressSearch/AddressSearch.view.d.ts +1 -1
- package/dist/badge/Badge.d.ts +10 -9
- package/dist/badge/Badge.view.d.ts +1 -1
- package/dist/button/Button.d.ts +1 -2
- package/dist/button/Button.view.d.ts +1 -1
- package/dist/button/button.interface.d.ts +19 -20
- package/dist/button/buttonActions/ButtonActions.d.ts +11 -12
- package/dist/button/buttonFile/ButtonFile.d.ts +9 -9
- package/dist/button/buttonFile/ButtonFile.view.d.ts +1 -1
- package/dist/button/buttonFilters/ButtonFilters.d.ts +16 -17
- package/dist/card/Card.d.ts +14 -15
- package/dist/card/Card.view.d.ts +1 -1
- package/dist/card/card.interface.d.ts +10 -10
- package/dist/card/cardAction/CardAction.d.ts +13 -14
- package/dist/card/cardAction.interface.d.ts +8 -9
- package/dist/card/hook/useCardInteractions.d.ts +8 -8
- package/dist/carousel/Carousel.d.ts +14 -15
- package/dist/carousel/Carousel.view.d.ts +1 -1
- package/dist/damier/Damier.d.ts +9 -10
- package/dist/damier/Damier.view.d.ts +1 -1
- package/dist/damier/damierCell/DamierCell.d.ts +6 -7
- package/dist/damier/damierCell/damierCell.interface.d.ts +6 -6
- package/dist/dataTable/DataTable.d.ts +37 -33
- package/dist/dataTable/DataTable.view.d.ts +1 -1
- package/dist/dataTable/dataTable.interface.d.ts +70 -47
- package/dist/dataTable/dataTable.utils.d.ts +17 -0
- package/dist/dataTable/dataTableActions/DataTableAction.d.ts +9 -10
- package/dist/dataTable/dataTableColumn/DataTableColumn.d.ts +14 -8
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/DataTableColumnFilter.d.ts +9 -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 +12 -0
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterString/DataTableColumnFilterString.d.ts +9 -0
- package/dist/dataTable/dataTableColumn/dataTableColumnSort/DataTableColumnSort.d.ts +10 -0
- package/dist/dataTable/dataTableFilters/DataTableFilters.d.ts +6 -0
- package/dist/dataTable/dataTableLoading/DataTableLoading.d.ts +8 -7
- package/dist/dataTable/dataTableRow/DataTableRow.d.ts +12 -11
- package/dist/dataTable/useDataTableState.d.ts +13 -0
- package/dist/datePicker/DatePicker.d.ts +7 -8
- package/dist/datePicker/DatePicker.view.d.ts +1 -1
- package/dist/docs/ComponentDocs.d.ts +6 -0
- package/dist/docs/catalog.d.ts +8 -0
- package/dist/docs/documentation.types.d.ts +21 -0
- package/dist/expands/Expands.d.ts +11 -12
- package/dist/expands/Expands.view.d.ts +1 -1
- package/dist/expands/expand/expand.d.ts +10 -11
- package/dist/expands/expand/expand.interface.d.ts +9 -9
- package/dist/filAriane/FilAriane.d.ts +8 -9
- package/dist/filAriane/FilAriane.view.d.ts +1 -1
- package/dist/filAriane/filAriane.interface.d.ts +6 -6
- package/dist/form/Form.d.ts +35 -36
- package/dist/form/Form.view.d.ts +1 -1
- package/dist/form/form.enum.d.ts +16 -15
- package/dist/form/form.interface.d.ts +53 -54
- package/dist/form/input/Input.d.ts +27 -25
- package/dist/form/inputNumber/InputNumber.d.ts +21 -22
- package/dist/form/inputNumber/InputNumber.view.d.ts +1 -1
- package/dist/form/inputPrice/InputPrice.d.ts +14 -15
- package/dist/form/inputPrice/InputPrice.view.d.ts +1 -1
- package/dist/form/textArea/TextArea.d.ts +14 -15
- package/dist/form/textArea/TextArea.view.d.ts +1 -1
- package/dist/geocoding/GeocodingService.d.ts +11 -12
- package/dist/geocoding/geocoding.interface.d.ts +20 -20
- package/dist/grid/Grid.d.ts +9 -10
- package/dist/grid/Grid.view.d.ts +1 -1
- package/dist/grid/col/Col.d.ts +5 -6
- package/dist/grid/col/colStyled/ColStyled.d.ts +10 -11
- package/dist/grid/container/Container.d.ts +5 -6
- package/dist/grid/grid.interface.d.ts +23 -23
- package/dist/grid/row/Row.d.ts +13 -14
- package/dist/header/Header.d.ts +1 -2
- package/dist/header/Header.view.d.ts +1 -1
- package/dist/header/header.interface.d.ts +12 -12
- package/dist/home/Home.d.ts +1 -1
- package/dist/icon/Icon.d.ts +1 -2
- package/dist/icon/Icons.view.d.ts +1 -1
- package/dist/icon/icon.interface.d.ts +5 -5
- package/dist/icon/iconSize.enum.d.ts +7 -7
- package/dist/index.d.ts +56 -54
- package/dist/index.html +18 -18
- package/dist/index.js +4001 -3510
- package/dist/loader/Loader.d.ts +7 -8
- package/dist/loader/Loader.view.d.ts +1 -1
- package/dist/main.d.ts +0 -1
- package/dist/manifest.json +25 -25
- package/dist/menus/Menus.d.ts +5 -6
- package/dist/menus/Menus.view.d.ts +1 -1
- package/dist/menus/menu/Menu.d.ts +7 -8
- package/dist/menus/menu/menu.interface.d.ts +10 -10
- package/dist/message/Message.d.ts +6 -7
- package/dist/message/Message.view.d.ts +1 -1
- package/dist/modal/Modal.d.ts +13 -14
- package/dist/modal/Modal.view.d.ts +1 -1
- package/dist/notFound/NotFound.d.ts +1 -1
- package/dist/overlayPanel/OverlayPanel.d.ts +22 -23
- package/dist/overlayPanel/OverlayPanel.view.d.ts +1 -1
- package/dist/overlayPanel/overlay.context.d.ts +9 -10
- package/dist/overlayPanel/overlayPanelStyled/OverlayPanelStyled.d.ts +9 -9
- package/dist/pdfViewer/PdfViewer.d.ts +12 -12
- package/dist/pdfViewer/PdfViewer.view.d.ts +1 -1
- package/dist/quantity/Quantity.d.ts +10 -11
- package/dist/robots.txt +3 -3
- package/dist/search/Search.d.ts +21 -22
- package/dist/search/Search.view.d.ts +1 -1
- package/dist/select/Select.d.ts +23 -24
- package/dist/select/Select.view.d.ts +1 -1
- package/dist/select/selectOption.interface.d.ts +5 -5
- package/dist/sidebar/Sidebar.d.ts +12 -13
- package/dist/sidebar/Sidebar.view.d.ts +1 -1
- package/dist/sidebarData/SidebarData.d.ts +6 -7
- package/dist/sidebarData/SidebarData.view.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/tabs/Tabs.d.ts +17 -17
- package/dist/tabs/Tabs.view.d.ts +1 -1
- package/dist/toaster/Toaster.d.ts +1 -2
- package/dist/toaster/Toaster.view.d.ts +1 -1
- package/dist/toaster/store/useToasterStore.d.ts +24 -24
- package/docs.plugin.ts +223 -0
- package/index.html +20 -18
- package/package.json +64 -56
- package/public/index.html +18 -18
- package/public/manifest.json +25 -25
- package/public/robots.txt +3 -3
- package/src/App.css +178 -11
- package/src/App.menu.tsx +277 -257
- package/src/App.routes.tsx +21 -16
- package/src/App.tsx +31 -30
- package/src/_core/hooks/HistoryProvider.tsx +25 -25
- package/src/_core/hooks/ImageChecker.tsx +26 -26
- package/src/_core/hooks/imageExist.tsx +9 -9
- package/src/_core/hooks/isEAN13.tsx +16 -16
- package/src/_core/hooks/objectToQueryParams.tsx +32 -32
- package/src/_core/hooks/useCurrency.tsx +18 -18
- package/src/_core/hooks/useDateutils.ts +64 -64
- package/src/_core/hooks/useIsMobile.ts +18 -18
- package/src/_core/hooks/useToken.tsx +19 -19
- package/src/_core/hooks/useValidate.tsx +18 -18
- package/src/_core/hooks/widgetSupport.tsx +39 -39
- package/src/_core/type/generiqueType.tsx +4 -0
- package/src/action/Action.view.tsx +21 -21
- package/src/action/ButtonAction.tsx +32 -32
- package/src/action/action.css +20 -20
- package/src/addressSearch/AddressSearch.tsx +246 -246
- package/src/addressSearch/AddressSearch.view.tsx +52 -52
- package/src/addressSearch/addressSearch.css +132 -132
- package/src/badge/Badge.tsx +41 -34
- package/src/badge/Badge.view.tsx +15 -15
- package/src/badge/badge.css +63 -55
- package/src/button/Button.tsx +48 -48
- package/src/button/Button.view.tsx +85 -85
- package/src/button/button.css +53 -53
- package/src/button/button.interface.tsx +22 -22
- package/src/button/buttonActions/ButtonActions.tsx +104 -104
- package/src/button/buttonFile/ButtonFile.tsx +59 -59
- package/src/button/buttonFile/ButtonFile.view.tsx +70 -70
- package/src/button/buttonFilters/ButtonFilters.tsx +102 -102
- package/src/button/buttonFilters/buttonFilters.css +22 -22
- package/src/card/Card.tsx +151 -151
- package/src/card/Card.view.tsx +73 -73
- package/src/card/card.css +144 -144
- package/src/card/card.interface.tsx +9 -9
- package/src/card/cardAction/CardAction.tsx +135 -135
- package/src/card/cardAction/cardAction.css +10 -10
- package/src/card/cardAction.interface.tsx +10 -10
- package/src/card/hook/useCardInteractions.tsx +30 -30
- package/src/carousel/Carousel.css +44 -44
- package/src/carousel/Carousel.tsx +115 -115
- package/src/carousel/Carousel.view.tsx +13 -13
- package/src/damier/Damier.tsx +64 -64
- package/src/damier/Damier.view.tsx +31 -31
- package/src/damier/damier.css +50 -50
- package/src/damier/damierCell/DamierCell.tsx +18 -18
- package/src/damier/damierCell/damierCell.interface.tsx +5 -5
- package/src/dataTable/DataTable.tsx +840 -746
- package/src/dataTable/DataTable.view.tsx +105 -71
- package/src/dataTable/dataTable.css +233 -208
- package/src/dataTable/dataTable.interface.ts +66 -45
- package/src/dataTable/dataTable.utils.ts +45 -0
- package/src/dataTable/dataTableActions/DataTableAction.tsx +82 -65
- package/src/dataTable/dataTableColumn/DataTableColumn.tsx +48 -27
- 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 +23 -21
- package/src/dataTable/dataTableRow/DataTableRow.tsx +155 -208
- package/src/dataTable/useDataTableState.tsx +89 -0
- package/src/datePicker/DatePicker.tsx +110 -110
- package/src/datePicker/DatePicker.view.tsx +9 -9
- package/src/datePicker/datePicker.css +77 -77
- package/src/docs/ComponentDocs.tsx +156 -0
- package/src/docs/catalog.ts +40 -0
- package/src/docs/documentation.types.ts +20 -0
- package/src/docs/virtual.d.ts +7 -0
- package/src/expands/Expands.tsx +46 -46
- package/src/expands/Expands.view.tsx +90 -90
- package/src/expands/expand/expand.interface.tsx +8 -8
- package/src/expands/expand/expand.tsx +191 -191
- package/src/expands/expands.css +101 -101
- package/src/filAriane/FilAriane.tsx +57 -57
- package/src/filAriane/FilAriane.view.tsx +28 -28
- package/src/filAriane/filAriane.css +23 -23
- package/src/filAriane/filAriane.interface.tsx +6 -6
- package/src/form/Form.tsx +477 -477
- package/src/form/Form.view.tsx +67 -67
- package/src/form/form.css +135 -135
- package/src/form/form.enum.ts +16 -15
- package/src/form/form.interface.tsx +67 -67
- package/src/form/input/Input.tsx +146 -106
- package/src/form/input/input.css +39 -29
- package/src/form/inputNumber/InputNumber.tsx +132 -132
- package/src/form/inputNumber/InputNumber.view.tsx +15 -15
- package/src/form/inputPrice/InputPrice.tsx +42 -42
- package/src/form/inputPrice/InputPrice.view.tsx +15 -15
- package/src/form/textArea/TextArea.tsx +59 -59
- package/src/form/textArea/TextArea.view.tsx +34 -34
- package/src/form/textArea/textArea.css +9 -9
- package/src/geocoding/GeocodingService.ts +89 -89
- package/src/geocoding/geocoding.interface.ts +25 -25
- package/src/grid/Grid.tsx +34 -34
- package/src/grid/Grid.view.tsx +24 -24
- package/src/grid/col/Col.tsx +24 -24
- package/src/grid/col/col.css +3 -3
- package/src/grid/col/colStyled/ColStyled.tsx +59 -59
- package/src/grid/container/Container.tsx +8 -8
- package/src/grid/container/container.css +4 -4
- package/src/grid/grid.interface.tsx +27 -27
- package/src/grid/row/Row.tsx +49 -49
- package/src/grid/row/row.css +25 -25
- package/src/header/Header.tsx +64 -64
- package/src/header/Header.view.tsx +5 -5
- package/src/header/header.css +43 -43
- package/src/header/header.interface.tsx +11 -11
- package/src/home/Home.tsx +40 -3
- package/src/icon/Icon.tsx +6 -6
- package/src/icon/Icons.view.tsx +29 -29
- package/src/icon/icon.css +20 -20
- package/src/icon/icon.interface.tsx +7 -6
- package/src/icon/iconSize.enum.ts +7 -7
- package/src/index.css +547 -547
- package/src/index.ts +76 -70
- package/src/loader/Loader.tsx +37 -37
- package/src/loader/Loader.view.tsx +20 -20
- package/src/loader/loader.css +30 -30
- package/src/main.tsx +10 -10
- package/src/menus/Menus.tsx +43 -43
- package/src/menus/Menus.view.tsx +39 -39
- package/src/menus/menu/Menu.tsx +18 -18
- package/src/menus/menu/menu.interface.tsx +9 -9
- package/src/menus/menus.css +47 -47
- package/src/message/Message.tsx +30 -30
- package/src/message/Message.view.tsx +22 -22
- package/src/message/message.css +29 -29
- package/src/modal/Modal.tsx +59 -59
- package/src/modal/Modal.view.tsx +26 -26
- package/src/modal/modal.css +71 -71
- package/src/notFound/NotFound.tsx +3 -3
- package/src/overlayPanel/OverlayPanel.tsx +260 -255
- package/src/overlayPanel/OverlayPanel.view.tsx +25 -25
- package/src/overlayPanel/overlay.context.tsx +30 -30
- package/src/overlayPanel/overlayPanel.css +43 -43
- package/src/overlayPanel/overlayPanelStyled/OverlayPanelStyled.tsx +23 -23
- package/src/pdfViewer/PdfViewer.tsx +73 -73
- package/src/pdfViewer/PdfViewer.view.tsx +5 -5
- package/src/quantity/Quantity.tsx +103 -103
- package/src/quantity/quantity.css +26 -26
- package/src/search/Search.tsx +161 -161
- package/src/search/Search.view.tsx +14 -14
- package/src/search/search.css +59 -59
- package/src/select/Select.tsx +245 -245
- package/src/select/Select.view.tsx +71 -71
- package/src/select/select.css +150 -150
- package/src/select/selectOption.interface.ts +5 -5
- package/src/sidebar/Sidebar.tsx +213 -213
- package/src/sidebar/Sidebar.view.tsx +17 -17
- package/src/sidebar/sidebar.css +103 -103
- package/src/sidebarData/SidebarData.tsx +19 -19
- package/src/sidebarData/SidebarData.view.tsx +19 -19
- package/src/sidebarData/sidebarData.css +27 -27
- package/src/tabs/Tabs.tsx +101 -90
- package/src/tabs/Tabs.view.tsx +20 -20
- package/src/tabs/tabs.css +29 -29
- package/src/toaster/Toaster.tsx +61 -61
- package/src/toaster/Toaster.view.tsx +25 -25
- package/src/toaster/store/useToasterStore.tsx +54 -54
- package/src/toaster/toaster.css +105 -105
- package/tests/dataTable.test.mjs +93 -0
- package/tests/documentation.test.mjs +75 -0
- package/tsconfig.docs.json +10 -0
- package/tsconfig.json +28 -28
- package/vite.config.ts +26 -20
- package/vite.config.ts.timestamp-1733262892554-a13dfef6e8a29.mjs +24 -24
- package/vite.config.ts.timestamp-1757847121745-e5a5bf54b81b.mjs +28 -28
- package/vite.config.ts.timestamp-1759742478362-4ac5c5a7db34b.mjs +28 -28
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
-
import Calendar from "react-calendar";
|
|
3
|
-
import { Value } from "react-calendar/dist/cjs/shared/types";
|
|
4
|
-
import { Icon } from "../icon/Icon";
|
|
5
|
-
import { IconSizeEnum } from "../icon/iconSize.enum";
|
|
6
|
-
import "./datePicker.css"; // Assuming you have some styles for the DatePicker
|
|
7
|
-
export type DatePickerProps = {
|
|
8
|
-
value?: Value;
|
|
9
|
-
maxDate?: Date;
|
|
10
|
-
onChange?: (date: Value) => void;
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
};
|
|
13
|
-
export const DatePicker = ({
|
|
14
|
-
value,
|
|
15
|
-
onChange,
|
|
16
|
-
maxDate,
|
|
17
|
-
children,
|
|
18
|
-
}: DatePickerProps) => {
|
|
19
|
-
const [dateCalendar, setDateCalendar] = useState<Value>(value ?? new Date());
|
|
20
|
-
const [showCalendar, setShowCalendar] = useState(false);
|
|
21
|
-
|
|
22
|
-
const calendarRef = useRef<HTMLDivElement>(null);
|
|
23
|
-
|
|
24
|
-
const handleChange = useCallback(
|
|
25
|
-
(val: Value) => {
|
|
26
|
-
setDateCalendar(val);
|
|
27
|
-
if (onChange) {
|
|
28
|
-
onChange(val);
|
|
29
|
-
}
|
|
30
|
-
setShowCalendar(false);
|
|
31
|
-
},
|
|
32
|
-
[onChange]
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
const toggleCalendar = () => setShowCalendar(!showCalendar);
|
|
36
|
-
|
|
37
|
-
const handleClickOutside = useCallback((event: MouseEvent) => {
|
|
38
|
-
if (
|
|
39
|
-
calendarRef.current &&
|
|
40
|
-
!calendarRef.current.contains(event.target as Node)
|
|
41
|
-
) {
|
|
42
|
-
setShowCalendar(false);
|
|
43
|
-
}
|
|
44
|
-
}, []);
|
|
45
|
-
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (showCalendar) {
|
|
48
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
49
|
-
} else {
|
|
50
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Nettoyage
|
|
54
|
-
return () => {
|
|
55
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
56
|
-
};
|
|
57
|
-
}, [showCalendar, handleClickOutside]);
|
|
58
|
-
const [currentMonth, setCurrentMonth] = useState<Value>();
|
|
59
|
-
|
|
60
|
-
const handleActiveStartDateChange = ({
|
|
61
|
-
activeStartDate,
|
|
62
|
-
}: {
|
|
63
|
-
activeStartDate: Value;
|
|
64
|
-
}) => {
|
|
65
|
-
setCurrentMonth(activeStartDate);
|
|
66
|
-
};
|
|
67
|
-
return (
|
|
68
|
-
<div>
|
|
69
|
-
<div className="calendar" ref={calendarRef}>
|
|
70
|
-
{children && <div onClick={toggleCalendar}>{children}</div>}
|
|
71
|
-
{!children && (
|
|
72
|
-
<button className="calendar-button" onClick={toggleCalendar}>
|
|
73
|
-
<Icon
|
|
74
|
-
classIcon=" bi-calendar4-event"
|
|
75
|
-
size={IconSizeEnum.EXTRA_LARGE}
|
|
76
|
-
/>
|
|
77
|
-
</button>
|
|
78
|
-
)}
|
|
79
|
-
{showCalendar && (
|
|
80
|
-
<div className="calendar-popup">
|
|
81
|
-
<div
|
|
82
|
-
onClick={() => setShowCalendar(false)}
|
|
83
|
-
className="calendar-popup-close"
|
|
84
|
-
>
|
|
85
|
-
<Icon
|
|
86
|
-
classIcon="bi-x-lg close-icon"
|
|
87
|
-
size={IconSizeEnum.EXTRA_SMALL}
|
|
88
|
-
/>
|
|
89
|
-
</div>
|
|
90
|
-
<Calendar
|
|
91
|
-
onActiveStartDateChange={handleActiveStartDateChange}
|
|
92
|
-
maxDate={maxDate ?? new Date()}
|
|
93
|
-
onChange={handleChange}
|
|
94
|
-
value={dateCalendar}
|
|
95
|
-
tileClassName={({ date: day, view }) => {
|
|
96
|
-
if (view === "month" && (currentMonth as Date)) {
|
|
97
|
-
const curr = currentMonth as Date;
|
|
98
|
-
return day.getMonth() !== curr?.getMonth()
|
|
99
|
-
? "out-of-month"
|
|
100
|
-
: null;
|
|
101
|
-
}
|
|
102
|
-
return null;
|
|
103
|
-
}}
|
|
104
|
-
/>
|
|
105
|
-
</div>
|
|
106
|
-
)}
|
|
107
|
-
</div>
|
|
108
|
-
</div>
|
|
109
|
-
);
|
|
110
|
-
};
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import Calendar from "react-calendar";
|
|
3
|
+
import { Value } from "react-calendar/dist/cjs/shared/types";
|
|
4
|
+
import { Icon } from "../icon/Icon";
|
|
5
|
+
import { IconSizeEnum } from "../icon/iconSize.enum";
|
|
6
|
+
import "./datePicker.css"; // Assuming you have some styles for the DatePicker
|
|
7
|
+
export type DatePickerProps = {
|
|
8
|
+
value?: Value;
|
|
9
|
+
maxDate?: Date;
|
|
10
|
+
onChange?: (date: Value) => void;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
export const DatePicker = ({
|
|
14
|
+
value,
|
|
15
|
+
onChange,
|
|
16
|
+
maxDate,
|
|
17
|
+
children,
|
|
18
|
+
}: DatePickerProps) => {
|
|
19
|
+
const [dateCalendar, setDateCalendar] = useState<Value>(value ?? new Date());
|
|
20
|
+
const [showCalendar, setShowCalendar] = useState(false);
|
|
21
|
+
|
|
22
|
+
const calendarRef = useRef<HTMLDivElement>(null);
|
|
23
|
+
|
|
24
|
+
const handleChange = useCallback(
|
|
25
|
+
(val: Value) => {
|
|
26
|
+
setDateCalendar(val);
|
|
27
|
+
if (onChange) {
|
|
28
|
+
onChange(val);
|
|
29
|
+
}
|
|
30
|
+
setShowCalendar(false);
|
|
31
|
+
},
|
|
32
|
+
[onChange]
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const toggleCalendar = () => setShowCalendar(!showCalendar);
|
|
36
|
+
|
|
37
|
+
const handleClickOutside = useCallback((event: MouseEvent) => {
|
|
38
|
+
if (
|
|
39
|
+
calendarRef.current &&
|
|
40
|
+
!calendarRef.current.contains(event.target as Node)
|
|
41
|
+
) {
|
|
42
|
+
setShowCalendar(false);
|
|
43
|
+
}
|
|
44
|
+
}, []);
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (showCalendar) {
|
|
48
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
49
|
+
} else {
|
|
50
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Nettoyage
|
|
54
|
+
return () => {
|
|
55
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
56
|
+
};
|
|
57
|
+
}, [showCalendar, handleClickOutside]);
|
|
58
|
+
const [currentMonth, setCurrentMonth] = useState<Value>();
|
|
59
|
+
|
|
60
|
+
const handleActiveStartDateChange = ({
|
|
61
|
+
activeStartDate,
|
|
62
|
+
}: {
|
|
63
|
+
activeStartDate: Value;
|
|
64
|
+
}) => {
|
|
65
|
+
setCurrentMonth(activeStartDate);
|
|
66
|
+
};
|
|
67
|
+
return (
|
|
68
|
+
<div>
|
|
69
|
+
<div className="calendar" ref={calendarRef}>
|
|
70
|
+
{children && <div onClick={toggleCalendar}>{children}</div>}
|
|
71
|
+
{!children && (
|
|
72
|
+
<button className="calendar-button" onClick={toggleCalendar}>
|
|
73
|
+
<Icon
|
|
74
|
+
classIcon=" bi-calendar4-event"
|
|
75
|
+
size={IconSizeEnum.EXTRA_LARGE}
|
|
76
|
+
/>
|
|
77
|
+
</button>
|
|
78
|
+
)}
|
|
79
|
+
{showCalendar && (
|
|
80
|
+
<div className="calendar-popup">
|
|
81
|
+
<div
|
|
82
|
+
onClick={() => setShowCalendar(false)}
|
|
83
|
+
className="calendar-popup-close"
|
|
84
|
+
>
|
|
85
|
+
<Icon
|
|
86
|
+
classIcon="bi-x-lg close-icon"
|
|
87
|
+
size={IconSizeEnum.EXTRA_SMALL}
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
<Calendar
|
|
91
|
+
onActiveStartDateChange={handleActiveStartDateChange}
|
|
92
|
+
maxDate={maxDate ?? new Date()}
|
|
93
|
+
onChange={handleChange}
|
|
94
|
+
value={dateCalendar}
|
|
95
|
+
tileClassName={({ date: day, view }) => {
|
|
96
|
+
if (view === "month" && (currentMonth as Date)) {
|
|
97
|
+
const curr = currentMonth as Date;
|
|
98
|
+
return day.getMonth() !== curr?.getMonth()
|
|
99
|
+
? "out-of-month"
|
|
100
|
+
: null;
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
}}
|
|
104
|
+
/>
|
|
105
|
+
</div>
|
|
106
|
+
)}
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DatePicker } from "./DatePicker";
|
|
2
|
-
|
|
3
|
-
export const DatePickerView = () => {
|
|
4
|
-
return (
|
|
5
|
-
<div>
|
|
6
|
-
<DatePicker />
|
|
7
|
-
</div>
|
|
8
|
-
);
|
|
9
|
-
};
|
|
1
|
+
import { DatePicker } from "./DatePicker";
|
|
2
|
+
|
|
3
|
+
export const DatePickerView = () => {
|
|
4
|
+
return (
|
|
5
|
+
<div>
|
|
6
|
+
<DatePicker />
|
|
7
|
+
</div>
|
|
8
|
+
);
|
|
9
|
+
};
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
.calendar {
|
|
2
|
-
position: relative;
|
|
3
|
-
.calendar-button {
|
|
4
|
-
width: 40px;
|
|
5
|
-
max-width: 40px;
|
|
6
|
-
min-width: 40px;
|
|
7
|
-
background-color: transparent;
|
|
8
|
-
i {
|
|
9
|
-
color: #333;
|
|
10
|
-
font-size: 1.6rem;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
.calendar-popup {
|
|
14
|
-
position: absolute;
|
|
15
|
-
z-index: 5;
|
|
16
|
-
border-color: #cfbdbd;
|
|
17
|
-
border-style: solid;
|
|
18
|
-
border-width: 1px;
|
|
19
|
-
max-width: 300px;
|
|
20
|
-
min-width: 250px;
|
|
21
|
-
background-color: #fff;
|
|
22
|
-
font-size: 0.8rem;
|
|
23
|
-
border-radius: 4px;
|
|
24
|
-
.out-of-month {
|
|
25
|
-
opacity: 0.4;
|
|
26
|
-
}
|
|
27
|
-
.calendar-popup-close {
|
|
28
|
-
display: flex;
|
|
29
|
-
justify-content: flex-end;
|
|
30
|
-
margin-right: 0.25rem;
|
|
31
|
-
margin-top: 0.35rem;
|
|
32
|
-
cursor: pointer;
|
|
33
|
-
i {
|
|
34
|
-
line-height: 0;
|
|
35
|
-
font-size: 0.8rem;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
.react-calendar {
|
|
39
|
-
border: 0px;
|
|
40
|
-
button {
|
|
41
|
-
background-color: #fff;
|
|
42
|
-
color: #333;
|
|
43
|
-
min-width: auto;
|
|
44
|
-
width: auto;
|
|
45
|
-
font-size: 0.8rem;
|
|
46
|
-
padding: 0.5rem;
|
|
47
|
-
}
|
|
48
|
-
.react-calendar__month-view__weekdays__weekday {
|
|
49
|
-
text-align: center;
|
|
50
|
-
}
|
|
51
|
-
.react-calendar__navigation {
|
|
52
|
-
display: flex;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.react-calendar__tile--active {
|
|
56
|
-
background-color: #007bff;
|
|
57
|
-
color: #fff;
|
|
58
|
-
}
|
|
59
|
-
.react-calendar__tile--now {
|
|
60
|
-
background-color: #f0f0f0;
|
|
61
|
-
color: #000;
|
|
62
|
-
}
|
|
63
|
-
.react-calendar__tile--active:hover {
|
|
64
|
-
background-color: #0056b3;
|
|
65
|
-
color: #fff;
|
|
66
|
-
}
|
|
67
|
-
.react-calendar__tile--now:hover {
|
|
68
|
-
background-color: #e0e0e0;
|
|
69
|
-
color: #000;
|
|
70
|
-
}
|
|
71
|
-
.react-calendar__tile--disabled {
|
|
72
|
-
background-color: #f8f9fa;
|
|
73
|
-
color: #6c757d;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
1
|
+
.calendar {
|
|
2
|
+
position: relative;
|
|
3
|
+
.calendar-button {
|
|
4
|
+
width: 40px;
|
|
5
|
+
max-width: 40px;
|
|
6
|
+
min-width: 40px;
|
|
7
|
+
background-color: transparent;
|
|
8
|
+
i {
|
|
9
|
+
color: #333;
|
|
10
|
+
font-size: 1.6rem;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
.calendar-popup {
|
|
14
|
+
position: absolute;
|
|
15
|
+
z-index: 5;
|
|
16
|
+
border-color: #cfbdbd;
|
|
17
|
+
border-style: solid;
|
|
18
|
+
border-width: 1px;
|
|
19
|
+
max-width: 300px;
|
|
20
|
+
min-width: 250px;
|
|
21
|
+
background-color: #fff;
|
|
22
|
+
font-size: 0.8rem;
|
|
23
|
+
border-radius: 4px;
|
|
24
|
+
.out-of-month {
|
|
25
|
+
opacity: 0.4;
|
|
26
|
+
}
|
|
27
|
+
.calendar-popup-close {
|
|
28
|
+
display: flex;
|
|
29
|
+
justify-content: flex-end;
|
|
30
|
+
margin-right: 0.25rem;
|
|
31
|
+
margin-top: 0.35rem;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
i {
|
|
34
|
+
line-height: 0;
|
|
35
|
+
font-size: 0.8rem;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
.react-calendar {
|
|
39
|
+
border: 0px;
|
|
40
|
+
button {
|
|
41
|
+
background-color: #fff;
|
|
42
|
+
color: #333;
|
|
43
|
+
min-width: auto;
|
|
44
|
+
width: auto;
|
|
45
|
+
font-size: 0.8rem;
|
|
46
|
+
padding: 0.5rem;
|
|
47
|
+
}
|
|
48
|
+
.react-calendar__month-view__weekdays__weekday {
|
|
49
|
+
text-align: center;
|
|
50
|
+
}
|
|
51
|
+
.react-calendar__navigation {
|
|
52
|
+
display: flex;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.react-calendar__tile--active {
|
|
56
|
+
background-color: #007bff;
|
|
57
|
+
color: #fff;
|
|
58
|
+
}
|
|
59
|
+
.react-calendar__tile--now {
|
|
60
|
+
background-color: #f0f0f0;
|
|
61
|
+
color: #000;
|
|
62
|
+
}
|
|
63
|
+
.react-calendar__tile--active:hover {
|
|
64
|
+
background-color: #0056b3;
|
|
65
|
+
color: #fff;
|
|
66
|
+
}
|
|
67
|
+
.react-calendar__tile--now:hover {
|
|
68
|
+
background-color: #e0e0e0;
|
|
69
|
+
color: #000;
|
|
70
|
+
}
|
|
71
|
+
.react-calendar__tile--disabled {
|
|
72
|
+
background-color: #f8f9fa;
|
|
73
|
+
color: #6c757d;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { KeyboardEvent, useRef, useState } from "react";
|
|
2
|
+
import documentation from "virtual:ui-docs";
|
|
3
|
+
import { catalog, matchesSearch } from "./catalog";
|
|
4
|
+
import { DocumentedComponent } from "./documentation.types";
|
|
5
|
+
|
|
6
|
+
const tabs = [
|
|
7
|
+
{ name: "Aperçu", icon: "play-circle" },
|
|
8
|
+
{ name: "API & types", icon: "braces" },
|
|
9
|
+
{ name: "Code", icon: "code-slash" },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
function ApiReference({ component, filter }: { component: DocumentedComponent; filter: string }) {
|
|
13
|
+
const props = component.props.filter((prop) => matchesSearch(`${prop.name} ${prop.type} ${prop.description}`, filter));
|
|
14
|
+
return (
|
|
15
|
+
<section className="docs-api-section">
|
|
16
|
+
<div className="docs-section-heading">
|
|
17
|
+
<h2>{component.name}</h2>
|
|
18
|
+
<span className="docs-pill">{component.props.length} paramètres</span>
|
|
19
|
+
</div>
|
|
20
|
+
<p className="docs-source">{component.source}</p>
|
|
21
|
+
<details className="docs-type-detail">
|
|
22
|
+
<summary>Signature TypeScript</summary>
|
|
23
|
+
<pre><code>{component.signature}</code></pre>
|
|
24
|
+
</details>
|
|
25
|
+
{component.name === "showToast" && (
|
|
26
|
+
<p className="docs-note">Le premier argument est le titre (string). Les paramètres ci-dessous constituent le second argument, options. Monter <Toaster /> et un élément #toaster-root dans votre application.</p>
|
|
27
|
+
)}
|
|
28
|
+
{component.props.length === 0 ? (
|
|
29
|
+
<p className="docs-empty">Ce composant ne prend aucune prop. Consultez le code pour son utilisation.</p>
|
|
30
|
+
) : props.length === 0 ? (
|
|
31
|
+
<p className="docs-empty">Aucun paramètre ne correspond à votre recherche.</p>
|
|
32
|
+
) : (
|
|
33
|
+
<div className="docs-table-scroll">
|
|
34
|
+
<table className="docs-props-table">
|
|
35
|
+
<caption className="docs-sr-only">Paramètres de {component.name}</caption>
|
|
36
|
+
<thead><tr><th scope="col">Paramètre</th><th scope="col">Type</th><th scope="col">Requis</th><th scope="col">Défaut</th><th scope="col">Description</th></tr></thead>
|
|
37
|
+
<tbody>{props.map((prop) => (
|
|
38
|
+
<tr key={prop.name}>
|
|
39
|
+
<th scope="row"><code>{prop.name}</code></th>
|
|
40
|
+
<td><code className="docs-prop-type">{prop.type}</code></td>
|
|
41
|
+
<td><span className={`docs-requirement ${prop.required ? "is-required" : ""}`}>{prop.required ? "Oui" : "Non"}</span></td>
|
|
42
|
+
<td><code>{prop.defaultValue ?? "—"}</code></td>
|
|
43
|
+
<td>{prop.description || "—"}</td>
|
|
44
|
+
</tr>
|
|
45
|
+
))}</tbody>
|
|
46
|
+
</table>
|
|
47
|
+
</div>
|
|
48
|
+
)}
|
|
49
|
+
{component.types.length > 0 && (
|
|
50
|
+
<div className="docs-related-types">
|
|
51
|
+
<h3>Structures & types associés</h3>
|
|
52
|
+
<p>Dépliez un type pour consulter ses champs, unions et valeurs possibles.</p>
|
|
53
|
+
{component.types.map((type, index) => (
|
|
54
|
+
<details className="docs-type-detail" key={`${type.name}-${index}`}>
|
|
55
|
+
<summary><i className="bi bi-braces" aria-hidden="true" /> {type.name}</summary>
|
|
56
|
+
<pre><code>{type.declaration}</code></pre>
|
|
57
|
+
</details>
|
|
58
|
+
))}
|
|
59
|
+
</div>
|
|
60
|
+
)}
|
|
61
|
+
</section>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function ComponentDocs({ path, name, children }: { path: string; name: string; children: React.ReactNode }) {
|
|
66
|
+
const [active, setActive] = useState(0);
|
|
67
|
+
const [filter, setFilter] = useState("");
|
|
68
|
+
const [mobile, setMobile] = useState(false);
|
|
69
|
+
const [grid, setGrid] = useState(true);
|
|
70
|
+
const [revision, setRevision] = useState(0);
|
|
71
|
+
const [copyStatus, setCopyStatus] = useState("");
|
|
72
|
+
const tabRefs = useRef<Array<HTMLButtonElement | null>>([]);
|
|
73
|
+
const docs = documentation[path];
|
|
74
|
+
const info = catalog[path];
|
|
75
|
+
const prefix = `docs-${path.slice(1)}`;
|
|
76
|
+
|
|
77
|
+
function onTabKey(event: KeyboardEvent<HTMLButtonElement>, index: number) {
|
|
78
|
+
let next: number;
|
|
79
|
+
switch (event.key) {
|
|
80
|
+
case "ArrowRight": next = (index + 1) % tabs.length; break;
|
|
81
|
+
case "ArrowLeft": next = (index + tabs.length - 1) % tabs.length; break;
|
|
82
|
+
case "Home": next = 0; break;
|
|
83
|
+
case "End": next = tabs.length - 1; break;
|
|
84
|
+
default: return;
|
|
85
|
+
}
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
setActive(next);
|
|
88
|
+
tabRefs.current[next]?.focus();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async function copyExample() {
|
|
92
|
+
try {
|
|
93
|
+
await navigator.clipboard.writeText(docs.example);
|
|
94
|
+
setCopyStatus("Code copié !");
|
|
95
|
+
} catch (error) {
|
|
96
|
+
setCopyStatus(`Copie impossible : ${error instanceof Error ? error.message : String(error)}. Sélectionnez le code pour le copier manuellement.`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<div className="docs-component">
|
|
102
|
+
<div className="docs-breadcrumb">Composants <span>/</span> {info.category} <span>/</span> {name}</div>
|
|
103
|
+
<header className="docs-page-heading">
|
|
104
|
+
<div className="docs-component-icon"><i className={`bi bi-${info.icon}`} aria-hidden="true" /></div>
|
|
105
|
+
<div><span className="docs-eyebrow">{info.category}</span><h1>{name}</h1><p>{info.description}</p></div>
|
|
106
|
+
<span className="docs-pill docs-live"><span /> React + TypeScript</span>
|
|
107
|
+
</header>
|
|
108
|
+
<div className="docs-workbench">
|
|
109
|
+
<div className="docs-tablist" role="tablist" aria-label={`Documentation de ${name}`}>
|
|
110
|
+
{tabs.map((tab, index) => (
|
|
111
|
+
<button type="button" role="tab" key={tab.name}
|
|
112
|
+
ref={(element) => { tabRefs.current[index] = element; }}
|
|
113
|
+
id={`${prefix}-tab-${index}`} aria-controls={`${prefix}-panel-${index}`}
|
|
114
|
+
aria-selected={active === index} tabIndex={active === index ? 0 : -1}
|
|
115
|
+
onKeyDown={(event) => onTabKey(event, index)} onClick={() => setActive(index)}>
|
|
116
|
+
<i className={`bi bi-${tab.icon}`} aria-hidden="true" />{tab.name}
|
|
117
|
+
{index === 1 && <span className="docs-tab-count">{docs.components.reduce((count, component) => count + component.props.length, 0)}</span>}
|
|
118
|
+
</button>
|
|
119
|
+
))}
|
|
120
|
+
</div>
|
|
121
|
+
<section role="tabpanel" id={`${prefix}-panel-0`} aria-labelledby={`${prefix}-tab-0`} hidden={active !== 0} tabIndex={0}>
|
|
122
|
+
<div className="docs-preview-toolbar">
|
|
123
|
+
<span><span className="docs-status-dot" />Démo interactive</span>
|
|
124
|
+
<div className="docs-toolbar-actions">
|
|
125
|
+
<button type="button" aria-pressed={grid} onClick={() => setGrid(!grid)} title="Afficher la grille"><i className="bi bi-grid-3x3" aria-hidden="true" /><span className="docs-sr-only">Grille de fond</span></button>
|
|
126
|
+
<button type="button" aria-pressed={mobile} onClick={() => setMobile(!mobile)}><i className={`bi bi-${mobile ? "phone" : "display"}`} aria-hidden="true" />{mobile ? "Mobile" : "Desktop"}</button>
|
|
127
|
+
<button type="button" onClick={() => setRevision(revision + 1)} title="Réinitialiser la démo"><i className="bi bi-arrow-clockwise" aria-hidden="true" /><span className="docs-sr-only">Réinitialiser</span></button>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
<div className={`docs-preview ${grid ? "docs-preview-grid" : ""}`}>
|
|
131
|
+
<div className={`docs-preview-frame ${mobile ? "is-mobile" : ""}`} key={revision}>{children}</div>
|
|
132
|
+
</div>
|
|
133
|
+
<div className="docs-preview-footer"><i className="bi bi-info-circle" aria-hidden="true" />Les composants ci-dessus sont les vrais composants du kit. Explorez leur API dans l'onglet suivant.</div>
|
|
134
|
+
</section>
|
|
135
|
+
<section role="tabpanel" id={`${prefix}-panel-1`} aria-labelledby={`${prefix}-tab-1`} hidden={active !== 1} tabIndex={0}>
|
|
136
|
+
{active === 1 && <div className="docs-api">
|
|
137
|
+
<div className="docs-api-intro">
|
|
138
|
+
<div><h2>Référence API</h2><p>Types extraits du code TypeScript. « — » indique un défaut non déclaré dans la signature.</p></div>
|
|
139
|
+
<label className="docs-search"><i className="bi bi-search" aria-hidden="true" /><span className="docs-sr-only">Filtrer les paramètres</span><input value={filter} onChange={(event) => setFilter(event.target.value)} placeholder="Chercher un paramètre..." /></label>
|
|
140
|
+
</div>
|
|
141
|
+
{docs.components.map((component) => <ApiReference component={component} filter={filter} key={`${component.source}-${component.name}`} />)}
|
|
142
|
+
</div>}
|
|
143
|
+
</section>
|
|
144
|
+
<section role="tabpanel" id={`${prefix}-panel-2`} aria-labelledby={`${prefix}-tab-2`} hidden={active !== 2} tabIndex={0}>
|
|
145
|
+
{active === 2 && <div className="docs-code-panel">
|
|
146
|
+
<div className="docs-code-toolbar"><span><i className="bi bi-filetype-tsx" aria-hidden="true" /> Exemple complet · TSX</span><button type="button" onClick={copyExample}><i className="bi bi-copy" aria-hidden="true" />Copier le code</button></div>
|
|
147
|
+
<p className="docs-note">Source exacte de la démo. Pour l'intégrer à votre projet, importez les composants publics depuis kelt-ui-kit-react.</p>
|
|
148
|
+
<p role="status" className="docs-copy-status">{copyStatus}</p>
|
|
149
|
+
<pre className="docs-code"><code>{docs.example}</code></pre>
|
|
150
|
+
</div>}
|
|
151
|
+
</section>
|
|
152
|
+
</div>
|
|
153
|
+
<p className="docs-page-footnote"><i className="bi bi-arrow-repeat" aria-hidden="true" />Documentation synchronisée avec les sources du kit.</p>
|
|
154
|
+
</div>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const categories = ["Actions", "Formulaires", "Navigation", "Affichage", "Feedback"] as const;
|
|
2
|
+
export type Category = typeof categories[number];
|
|
3
|
+
|
|
4
|
+
export const catalog: Record<string, { category: Category; description: string; icon: string }> = {
|
|
5
|
+
"/buttons": { category: "Actions", icon: "cursor", description: "Des actions claires, avec icones, badges et menus contextuels." },
|
|
6
|
+
"/action": { category: "Actions", icon: "lightning", description: "Une action compacte et ses interactions." },
|
|
7
|
+
"/button-file": { category: "Actions", icon: "upload", description: "Selectionner un fichier depuis un bouton dedie." },
|
|
8
|
+
"/form": { category: "Formulaires", icon: "ui-checks", description: "Composer des formulaires dynamiques, sections et champs responsives." },
|
|
9
|
+
"/address-search": { category: "Formulaires", icon: "geo-alt", description: "Rechercher une adresse et exploiter ses donnees geographiques." },
|
|
10
|
+
"/select": { category: "Formulaires", icon: "chevron-expand", description: "Choisir une valeur parmi des options." },
|
|
11
|
+
"/text-area": { category: "Formulaires", icon: "textarea-t", description: "Saisir du texte sur plusieurs lignes." },
|
|
12
|
+
"/date-picker": { category: "Formulaires", icon: "calendar3", description: "Selectionner une date avec un calendrier." },
|
|
13
|
+
"/input-number": { category: "Formulaires", icon: "123", description: "Saisir et ajuster une valeur numerique." },
|
|
14
|
+
"/input-price": { category: "Formulaires", icon: "currency-euro", description: "Un champ dedie aux montants et aux prix." },
|
|
15
|
+
"/search": { category: "Formulaires", icon: "search", description: "Rechercher et filtrer des donnees." },
|
|
16
|
+
"/menus": { category: "Navigation", icon: "list", description: "Organiser les destinations de votre application." },
|
|
17
|
+
"/headers": { category: "Navigation", icon: "window", description: "Structurer l'en-tete et la navigation de retour." },
|
|
18
|
+
"/sidebar": { category: "Navigation", icon: "layout-sidebar", description: "Afficher un panneau lateral." },
|
|
19
|
+
"/sidebar-data": { category: "Navigation", icon: "layout-sidebar-inset", description: "Presenter des informations dans un panneau lateral." },
|
|
20
|
+
"/fil-ariane": { category: "Navigation", icon: "signpost", description: "Visualiser le chemin de navigation courant." },
|
|
21
|
+
"/tabs": { category: "Navigation", icon: "segmented-nav", description: "Repartir le contenu dans des onglets controles ou autonomes." },
|
|
22
|
+
"/expands": { category: "Affichage", icon: "arrows-expand", description: "Deplier des sections et organiser des contenus denses." },
|
|
23
|
+
"/grid": { category: "Affichage", icon: "grid-3x3", description: "Construire une mise en page avec des colonnes responsives." },
|
|
24
|
+
"/card": { category: "Affichage", icon: "card-heading", description: "Regrouper contenu, informations et actions dans une carte." },
|
|
25
|
+
"/damier": { category: "Affichage", icon: "grid", description: "Presenter des elements dans une grille de cellules." },
|
|
26
|
+
"/carousel": { category: "Affichage", icon: "images", description: "Parcourir une collection de contenus." },
|
|
27
|
+
"/badge": { category: "Affichage", icon: "patch-check", description: "Mettre en valeur un statut ou une information courte." },
|
|
28
|
+
"/data-table": { category: "Affichage", icon: "table", description: "Afficher des donnees, selections, colonnes et actions." },
|
|
29
|
+
"/icons": { category: "Affichage", icon: "stars", description: "Utiliser les icones Bootstrap et leurs tailles." },
|
|
30
|
+
"/toasters": { category: "Feedback", icon: "bell", description: "Declencher des notifications temporaires depuis le store." },
|
|
31
|
+
"/messages": { category: "Feedback", icon: "chat-square-text", description: "Communiquer un message et son niveau de severite." },
|
|
32
|
+
"/loader": { category: "Feedback", icon: "arrow-repeat", description: "Indiquer une operation en cours." },
|
|
33
|
+
"/modal": { category: "Feedback", icon: "window-stack", description: "Ouvrir un dialogue de confirmation ou de saisie." },
|
|
34
|
+
"/overlay": { category: "Feedback", icon: "layers", description: "Afficher un contenu contextuel avec OverlayProvider." },
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export function matchesSearch(value: string, search: string) {
|
|
38
|
+
const normalize = (text: string) => text.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
|
39
|
+
return normalize(value).includes(normalize(search.trim()));
|
|
40
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type DocumentedProp = {
|
|
2
|
+
name: string;
|
|
3
|
+
type: string;
|
|
4
|
+
required: boolean;
|
|
5
|
+
defaultValue?: string;
|
|
6
|
+
description: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type DocumentedComponent = {
|
|
10
|
+
name: string;
|
|
11
|
+
source: string;
|
|
12
|
+
signature: string;
|
|
13
|
+
props: DocumentedProp[];
|
|
14
|
+
types: { name: string; declaration: string }[];
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type ComponentDocumentation = {
|
|
18
|
+
components: DocumentedComponent[];
|
|
19
|
+
example: string;
|
|
20
|
+
};
|