@tsiky/components-r19 1.1.0 → 1.2.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 (47) hide show
  1. package/package.json +1 -1
  2. package/src/components/AnnouncementPanel/FlexRowContainer.css +17 -17
  3. package/src/components/AnnouncementPanel/FlexRowContainer.stories.tsx +329 -329
  4. package/src/components/AnnouncementPanel/FlexRowContainer.tsx +24 -24
  5. package/src/components/AnnouncementPanel/ListBox/CounterListBox.css +56 -56
  6. package/src/components/AnnouncementPanel/ListBox/CounterListBox.stories.tsx +292 -292
  7. package/src/components/AnnouncementPanel/ListBox/CounterListBox.tsx +106 -106
  8. package/src/components/AnnouncementPanel/ListBox/SimpleListBox.css +57 -57
  9. package/src/components/AnnouncementPanel/ListBox/SimpleListBox.stories.tsx +189 -189
  10. package/src/components/AnnouncementPanel/ListBox/SimpleListBox.tsx +138 -138
  11. package/src/components/AnnouncementPanel/ListBox/TrendListBox.css +61 -61
  12. package/src/components/AnnouncementPanel/ListBox/TrendListBox.stories.tsx +257 -257
  13. package/src/components/AnnouncementPanel/ListBox/TrendListBox.tsx +90 -90
  14. package/src/components/AnnouncementPanel/ListBox/index.ts +3 -3
  15. package/src/components/AnnouncementPanel/ListContentContainer.css +23 -23
  16. package/src/components/AnnouncementPanel/ListContentContainer.stories.tsx +212 -212
  17. package/src/components/AnnouncementPanel/ListContentContainer.tsx +33 -33
  18. package/src/components/AnnouncementPanel/index.ts +3 -3
  19. package/src/components/Charts/area-chart-admission/AreaChartAdmission.tsx +7 -1
  20. package/src/components/Charts/bar-chart/BarChart.tsx +6 -2
  21. package/src/components/Charts/boxplot-chart/BoxPlotChart.tsx +114 -114
  22. package/src/components/Charts/mixed-chart/MixedChart.tsx +1 -1
  23. package/src/components/Charts/sankey-adaptation/sankey.tsx +70 -70
  24. package/src/components/DraggableSwitcher/DraggableSwitcherButton.tsx +58 -58
  25. package/src/components/DraggableSwitcher/context/useDraggableSwitcher.tsx +45 -45
  26. package/src/components/DraggableSwitcher/index.ts +2 -2
  27. package/src/components/DynamicInput/input/SelectInput.tsx +75 -75
  28. package/src/components/DynamicInput/input/assets/SelectInput.module.css +95 -95
  29. package/src/components/DynamicTable/AdvancedFilters.tsx +196 -196
  30. package/src/components/DynamicTable/ColumnSorter.tsx +185 -185
  31. package/src/components/DynamicTable/Pagination.tsx +115 -115
  32. package/src/components/DynamicTable/TableCell.tsx +38 -30
  33. package/src/components/DynamicTable/TableHeader.tsx +39 -34
  34. package/src/components/DynamicTable/TableauDynamique.module.css +79 -33
  35. package/src/components/DynamicTable/TableauDynamique.tsx +154 -154
  36. package/src/components/DynamicTable/filters/SelectFilter.tsx +69 -69
  37. package/src/components/DynamicTable/tools/tableTypes.ts +63 -63
  38. package/src/components/EntryControl/EntryControl.tsx +117 -117
  39. package/src/components/Grid/grid.css +285 -285
  40. package/src/components/MetricsPanel/MetricsPanel.tsx +37 -37
  41. package/src/components/MetricsPanel/renderers/CompactRenderer.tsx +1 -1
  42. package/src/components/NavItem/NavItem.tsx +58 -58
  43. package/src/components/PeriodRange/PeriodRange.module.css +158 -158
  44. package/src/components/PeriodRange/PeriodRange.tsx +130 -130
  45. package/src/components/SearchBar/SearchBar.css +40 -40
  46. package/src/components/TranslationKey/TranslationKey.css +272 -272
  47. package/src/components/TranslationKey/TranslationKey.tsx +8 -7
@@ -1,69 +1,69 @@
1
- // components/TableauDynamique/filters/SelectFilter.tsx
2
- import { useState, useEffect } from 'react';
3
- import styles from '../TableauDynamique.module.css';
4
- import type { SelectFilterConfig } from '../tools/filterTypes';
5
-
6
- interface SelectFilterProps {
7
- config: SelectFilterConfig;
8
- value: string | number | boolean;
9
- onChange: (value: string | number | boolean) => void;
10
- disabled?: boolean;
11
- }
12
-
13
- const SelectFilter: React.FC<SelectFilterProps> = ({
14
- config,
15
- value,
16
- onChange,
17
- disabled = false,
18
- }) => {
19
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
- const [options, setOptions] = useState<any[]>([]);
21
- const [isLoading, setIsLoading] = useState(false);
22
-
23
- useEffect(() => {
24
- const loadOptions = async () => {
25
- if (config.asyncOptions) {
26
- setIsLoading(true);
27
- try {
28
- const asyncOptions = await config.asyncOptions();
29
- setOptions(asyncOptions);
30
- } catch (error) {
31
- console.error('Error loading options:', error);
32
- } finally {
33
- setIsLoading(false);
34
- }
35
- } else {
36
- setOptions(config.options || []);
37
- }
38
- };
39
-
40
- loadOptions();
41
- }, [config]);
42
-
43
- const handleChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
44
- const newValue = e.target.value;
45
- onChange(newValue);
46
- };
47
-
48
- if (isLoading) {
49
- return <div>Chargement...</div>;
50
- }
51
-
52
- return (
53
- <select
54
- value={String(value || '')}
55
- onChange={handleChange}
56
- disabled={disabled}
57
- className={styles.filterInput}
58
- >
59
- <option value=''>Select...</option>
60
- {options.map((option) => (
61
- <option key={option.value} value={option.value}>
62
- {option.label}
63
- </option>
64
- ))}
65
- </select>
66
- );
67
- };
68
-
69
- export default SelectFilter;
1
+ // components/TableauDynamique/filters/SelectFilter.tsx
2
+ import { useState, useEffect } from 'react';
3
+ import styles from '../TableauDynamique.module.css';
4
+ import type { SelectFilterConfig } from '../tools/filterTypes';
5
+
6
+ interface SelectFilterProps {
7
+ config: SelectFilterConfig;
8
+ value: string | number | boolean;
9
+ onChange: (value: string | number | boolean) => void;
10
+ disabled?: boolean;
11
+ }
12
+
13
+ const SelectFilter: React.FC<SelectFilterProps> = ({
14
+ config,
15
+ value,
16
+ onChange,
17
+ disabled = false,
18
+ }) => {
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ const [options, setOptions] = useState<any[]>([]);
21
+ const [isLoading, setIsLoading] = useState(false);
22
+
23
+ useEffect(() => {
24
+ const loadOptions = async () => {
25
+ if (config.asyncOptions) {
26
+ setIsLoading(true);
27
+ try {
28
+ const asyncOptions = await config.asyncOptions();
29
+ setOptions(asyncOptions);
30
+ } catch (error) {
31
+ console.error('Error loading options:', error);
32
+ } finally {
33
+ setIsLoading(false);
34
+ }
35
+ } else {
36
+ setOptions(config.options || []);
37
+ }
38
+ };
39
+
40
+ loadOptions();
41
+ }, [config]);
42
+
43
+ const handleChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
44
+ const newValue = e.target.value;
45
+ onChange(newValue);
46
+ };
47
+
48
+ if (isLoading) {
49
+ return <div>Chargement...</div>;
50
+ }
51
+
52
+ return (
53
+ <select
54
+ value={String(value || '')}
55
+ onChange={handleChange}
56
+ disabled={disabled}
57
+ className={styles.filterInput}
58
+ >
59
+ <option value=''>Select...</option>
60
+ {options.map((option) => (
61
+ <option key={option.value} value={option.value}>
62
+ {option.label}
63
+ </option>
64
+ ))}
65
+ </select>
66
+ );
67
+ };
68
+
69
+ export default SelectFilter;
@@ -1,63 +1,63 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import type { ComponentType } from 'react';
3
-
4
- export interface TableColumn<T = any> {
5
- id: string;
6
- label: string;
7
- width?: string | number;
8
- align?: 'left' | 'center' | 'right';
9
- sortable?: boolean; // Rendre optionnel
10
- render?: (value: any, row: T, column: TableColumn<T>) => React.ReactNode;
11
- component?: ComponentType<{ value: any; row: T; column: TableColumn<T> }>;
12
- type?: string;
13
- options?: { value: string; label: string }[];
14
- }
15
-
16
- export interface TableRowData<T = any> {
17
- id: string;
18
- data: T;
19
- }
20
-
21
- export interface RendererProps<T = any> {
22
- value: any;
23
- row: T;
24
- column: TableColumn<T>;
25
- }
26
-
27
- export interface TableConfigType {
28
- renderers: Record<string, ComponentType<RendererProps>>;
29
- icons: {
30
- sortAsc: React.ReactElement;
31
- sortDesc: React.ReactElement;
32
- sortDefault: React.ReactElement;
33
- };
34
- }
35
-
36
- export interface SortConfig {
37
- key: string | null;
38
- direction: 'asc' | 'desc';
39
- }
40
-
41
- export interface TableauDynamiqueProps<T = any> {
42
- columns?: TableColumn<T>[];
43
- data?: TableRowData<T>[];
44
- pagination?: { pageSize: number; currentPage: number };
45
- onSort?: (sortConfig: SortConfig) => void;
46
- onPageChange?: (page: number) => void;
47
- onPageSizeChange?: (size: number) => void;
48
- onRowClick?: (row: T, index: number) => void;
49
- filterable?: boolean;
50
- searchTerm?: string;
51
- onSearch?: (term: string) => void;
52
- className?: string;
53
- onNewPage?: (page: number) => void;
54
- }
55
-
56
- export interface TableBodyProps<T> {
57
- data: TableRowData<T>[];
58
- columns: TableColumn<T>[];
59
- onRowClick?: (row: T, index: number) => void;
60
- startIndex: number;
61
- searchTerm?: string;
62
- getRowStyle?: (row: T) => React.CSSProperties;
63
- }
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import type { ComponentType } from 'react';
3
+
4
+ export interface TableColumn<T = any> {
5
+ id: string;
6
+ label: string;
7
+ width?: string | number;
8
+ align?: 'left' | 'center' | 'right';
9
+ sortable?: boolean; // Rendre optionnel
10
+ render?: (value: any, row: T, column: TableColumn<T>) => React.ReactNode;
11
+ component?: ComponentType<{ value: any; row: T; column: TableColumn<T> }>;
12
+ type?: string;
13
+ options?: { value: string; label: string }[];
14
+ }
15
+
16
+ export interface TableRowData<T = any> {
17
+ id: string;
18
+ data: T;
19
+ }
20
+
21
+ export interface RendererProps<T = any> {
22
+ value: any;
23
+ row: T;
24
+ column: TableColumn<T>;
25
+ }
26
+
27
+ export interface TableConfigType {
28
+ renderers: Record<string, ComponentType<RendererProps>>;
29
+ icons: {
30
+ sortAsc: React.ReactElement;
31
+ sortDesc: React.ReactElement;
32
+ sortDefault: React.ReactElement;
33
+ };
34
+ }
35
+
36
+ export interface SortConfig {
37
+ key: string | null;
38
+ direction: 'asc' | 'desc';
39
+ }
40
+
41
+ export interface TableauDynamiqueProps<T = any> {
42
+ columns?: TableColumn<T>[];
43
+ data?: TableRowData<T>[];
44
+ pagination?: { pageSize: number; currentPage: number };
45
+ onSort?: (sortConfig: SortConfig) => void;
46
+ onPageChange?: (page: number) => void;
47
+ onPageSizeChange?: (size: number) => void;
48
+ onRowClick?: (row: T, index: number) => void;
49
+ filterable?: boolean;
50
+ searchTerm?: string;
51
+ onSearch?: (term: string) => void;
52
+ className?: string;
53
+ onNewPage?: (page: number) => void;
54
+ }
55
+
56
+ export interface TableBodyProps<T> {
57
+ data: TableRowData<T>[];
58
+ columns: TableColumn<T>[];
59
+ onRowClick?: (row: T, index: number) => void;
60
+ startIndex: number;
61
+ searchTerm?: string;
62
+ getRowStyle?: (row: T) => React.CSSProperties;
63
+ }
@@ -1,117 +1,117 @@
1
- 'use client';
2
- import React, { useEffect, useRef, useState } from 'react';
3
- import styles from './EntryControl.module.css';
4
-
5
- export interface EntryControlProps {
6
- onDateChange?: (isoString: string) => void;
7
- onSearch?: (query: string) => void;
8
- initialDate?: string;
9
- }
10
-
11
- export default function EntryControl({ onDateChange, onSearch, initialDate }: EntryControlProps) {
12
- const [showPicker, setShowPicker] = useState<boolean>(false);
13
- const [datetime, setDatetime] = useState<string>(initialDate ?? '');
14
- const containerRef = useRef<HTMLDivElement | null>(null);
15
-
16
- useEffect(() => {
17
- function handleClickOutside(e: MouseEvent) {
18
- const target = e.target as Node | null;
19
- if (containerRef.current && target && !containerRef.current.contains(target)) {
20
- setShowPicker(false);
21
- }
22
- }
23
-
24
- document.addEventListener('mousedown', handleClickOutside);
25
- return () => document.removeEventListener('mousedown', handleClickOutside);
26
- }, []);
27
-
28
- useEffect(() => {
29
- if (initialDate) setDatetime(initialDate);
30
- }, [initialDate]);
31
-
32
- const handleToggle = () => setShowPicker((v) => !v);
33
-
34
- const handleDateChange = (e: React.ChangeEvent<HTMLInputElement>) => {
35
- const v = e.target.value;
36
- setDatetime(v);
37
- onDateChange?.(v);
38
- };
39
-
40
- const handleSearch = (e: React.ChangeEvent<HTMLInputElement>) => {
41
- onSearch?.(e.target.value);
42
- };
43
-
44
- return (
45
- <div className={styles.wrapper} ref={containerRef}>
46
- <div className={styles.leftGroup}>
47
- <button
48
- type='button'
49
- className={`${styles.filterButton} ${showPicker ? styles.open : ''}`}
50
- onClick={handleToggle}
51
- aria-expanded={showPicker}
52
- aria-haspopup='dialog'
53
- aria-controls='entry-datetime'
54
- >
55
- <span>Entry time</span>
56
- <svg
57
- className={styles.filterIcon}
58
- xmlns='http://www.w3.org/2000/svg'
59
- viewBox='0 0 24 24'
60
- width='14'
61
- height='14'
62
- aria-hidden
63
- >
64
- <path fill='currentColor' d='M10 18h4v-2h-4v2zm-7-8v2h18V10H3zm3-6v2h12V4H6z' />
65
- </svg>
66
- </button>
67
-
68
- <div className={styles.infoText}>Confidence interval: step ± 15' / exit ± 30'</div>
69
-
70
- {/* pickerContainer est maintenant inline sur grands écrans, absolute sur petits */}
71
- {showPicker && (
72
- <div
73
- className={styles.pickerContainer}
74
- role='dialog'
75
- aria-label='Choisir la date et l’heure'
76
- >
77
- <label className={styles.pickerLabel} htmlFor='entry-datetime'>
78
- <span className={styles.srOnly}>Choisir la date et l’heure</span>
79
- </label>
80
- <input
81
- id='entry-datetime'
82
- className={styles.datetime}
83
- type='datetime-local'
84
- value={datetime}
85
- onChange={handleDateChange}
86
- aria-label='Date et heure d’entrée'
87
- />
88
- </div>
89
- )}
90
- </div>
91
-
92
- <div className={styles.rightGroup}>
93
- <div className={styles.searchInputWrap}>
94
- <input
95
- className={styles.searchInput}
96
- placeholder='Search...'
97
- onChange={handleSearch}
98
- aria-label='Search'
99
- />
100
- <svg
101
- className={styles.searchIcon}
102
- xmlns='http://www.w3.org/2000/svg'
103
- viewBox='0 0 24 24'
104
- width='16'
105
- height='16'
106
- aria-hidden
107
- >
108
- <path
109
- fill='currentColor'
110
- d='M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 109.5 16a6.471 6.471 0 004.23-1.57l.27.28v.79L20 20.49 21.49 19l-5.99-5zM10 15.5A5.5 5.5 0 1115.5 10 5.5 5.5 0 0110 15.5z'
111
- />
112
- </svg>
113
- </div>
114
- </div>
115
- </div>
116
- );
117
- }
1
+ 'use client';
2
+ import React, { useEffect, useRef, useState } from 'react';
3
+ import styles from './EntryControl.module.css';
4
+
5
+ export interface EntryControlProps {
6
+ onDateChange?: (isoString: string) => void;
7
+ onSearch?: (query: string) => void;
8
+ initialDate?: string;
9
+ }
10
+
11
+ export default function EntryControl({ onDateChange, onSearch, initialDate }: EntryControlProps) {
12
+ const [showPicker, setShowPicker] = useState<boolean>(false);
13
+ const [datetime, setDatetime] = useState<string>(initialDate ?? '');
14
+ const containerRef = useRef<HTMLDivElement | null>(null);
15
+
16
+ useEffect(() => {
17
+ function handleClickOutside(e: MouseEvent) {
18
+ const target = e.target as Node | null;
19
+ if (containerRef.current && target && !containerRef.current.contains(target)) {
20
+ setShowPicker(false);
21
+ }
22
+ }
23
+
24
+ document.addEventListener('mousedown', handleClickOutside);
25
+ return () => document.removeEventListener('mousedown', handleClickOutside);
26
+ }, []);
27
+
28
+ useEffect(() => {
29
+ if (initialDate) setDatetime(initialDate);
30
+ }, [initialDate]);
31
+
32
+ const handleToggle = () => setShowPicker((v) => !v);
33
+
34
+ const handleDateChange = (e: React.ChangeEvent<HTMLInputElement>) => {
35
+ const v = e.target.value;
36
+ setDatetime(v);
37
+ onDateChange?.(v);
38
+ };
39
+
40
+ const handleSearch = (e: React.ChangeEvent<HTMLInputElement>) => {
41
+ onSearch?.(e.target.value);
42
+ };
43
+
44
+ return (
45
+ <div className={styles.wrapper} ref={containerRef}>
46
+ <div className={styles.leftGroup}>
47
+ <button
48
+ type='button'
49
+ className={`${styles.filterButton} ${showPicker ? styles.open : ''}`}
50
+ onClick={handleToggle}
51
+ aria-expanded={showPicker}
52
+ aria-haspopup='dialog'
53
+ aria-controls='entry-datetime'
54
+ >
55
+ <span>Entry time</span>
56
+ <svg
57
+ className={styles.filterIcon}
58
+ xmlns='http://www.w3.org/2000/svg'
59
+ viewBox='0 0 24 24'
60
+ width='14'
61
+ height='14'
62
+ aria-hidden
63
+ >
64
+ <path fill='currentColor' d='M10 18h4v-2h-4v2zm-7-8v2h18V10H3zm3-6v2h12V4H6z' />
65
+ </svg>
66
+ </button>
67
+
68
+ <div className={styles.infoText}>Confidence interval: step ± 15' / exit ± 30'</div>
69
+
70
+ {/* pickerContainer est maintenant inline sur grands écrans, absolute sur petits */}
71
+ {showPicker && (
72
+ <div
73
+ className={styles.pickerContainer}
74
+ role='dialog'
75
+ aria-label='Choisir la date et l’heure'
76
+ >
77
+ <label className={styles.pickerLabel} htmlFor='entry-datetime'>
78
+ <span className={styles.srOnly}>Choisir la date et l’heure</span>
79
+ </label>
80
+ <input
81
+ id='entry-datetime'
82
+ className={styles.datetime}
83
+ type='datetime-local'
84
+ value={datetime}
85
+ onChange={handleDateChange}
86
+ aria-label='Date et heure d’entrée'
87
+ />
88
+ </div>
89
+ )}
90
+ </div>
91
+
92
+ <div className={styles.rightGroup}>
93
+ <div className={styles.searchInputWrap}>
94
+ <input
95
+ className={styles.searchInput}
96
+ placeholder='Search...'
97
+ onChange={handleSearch}
98
+ aria-label='Search'
99
+ />
100
+ <svg
101
+ className={styles.searchIcon}
102
+ xmlns='http://www.w3.org/2000/svg'
103
+ viewBox='0 0 24 24'
104
+ width='16'
105
+ height='16'
106
+ aria-hidden
107
+ >
108
+ <path
109
+ fill='currentColor'
110
+ d='M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 109.5 16a6.471 6.471 0 004.23-1.57l.27.28v.79L20 20.49 21.49 19l-5.99-5zM10 15.5A5.5 5.5 0 1115.5 10 5.5 5.5 0 0110 15.5z'
111
+ />
112
+ </svg>
113
+ </div>
114
+ </div>
115
+ </div>
116
+ );
117
+ }