@tsiky/components-r19 1.0.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 (61) hide show
  1. package/index.ts +35 -33
  2. package/package.json +1 -1
  3. package/src/components/AnnouncementPanel/FlexRowContainer.css +17 -17
  4. package/src/components/AnnouncementPanel/FlexRowContainer.stories.tsx +329 -329
  5. package/src/components/AnnouncementPanel/FlexRowContainer.tsx +24 -24
  6. package/src/components/AnnouncementPanel/ListBox/CounterListBox.css +56 -56
  7. package/src/components/AnnouncementPanel/ListBox/CounterListBox.stories.tsx +292 -292
  8. package/src/components/AnnouncementPanel/ListBox/CounterListBox.tsx +106 -106
  9. package/src/components/AnnouncementPanel/ListBox/SimpleListBox.css +57 -57
  10. package/src/components/AnnouncementPanel/ListBox/SimpleListBox.stories.tsx +189 -189
  11. package/src/components/AnnouncementPanel/ListBox/SimpleListBox.tsx +138 -138
  12. package/src/components/AnnouncementPanel/ListBox/TrendListBox.css +61 -61
  13. package/src/components/AnnouncementPanel/ListBox/TrendListBox.stories.tsx +257 -257
  14. package/src/components/AnnouncementPanel/ListBox/TrendListBox.tsx +90 -90
  15. package/src/components/AnnouncementPanel/ListBox/index.ts +3 -3
  16. package/src/components/AnnouncementPanel/ListContentContainer.css +23 -23
  17. package/src/components/AnnouncementPanel/ListContentContainer.stories.tsx +212 -212
  18. package/src/components/AnnouncementPanel/ListContentContainer.tsx +33 -33
  19. package/src/components/AnnouncementPanel/index.ts +3 -3
  20. package/src/components/Charts/area-chart-admission/AreaChartAdmission.tsx +129 -89
  21. package/src/components/Charts/bar-chart/BarChart.tsx +171 -132
  22. package/src/components/Charts/boxplot-chart/BoxPlotChart.tsx +114 -114
  23. package/src/components/Charts/mixed-chart/MixedChart.tsx +65 -9
  24. package/src/components/Charts/sankey-adaptation/sankey.tsx +70 -70
  25. package/src/components/Charts/sankey-chart/SankeyChart.tsx +183 -155
  26. package/src/components/Confirmationpopup/ConfirmationPopup.module.css +88 -0
  27. package/src/components/Confirmationpopup/ConfirmationPopup.stories.tsx +94 -0
  28. package/src/components/Confirmationpopup/ConfirmationPopup.tsx +47 -0
  29. package/src/components/Confirmationpopup/index.ts +6 -0
  30. package/src/components/Confirmationpopup/useConfirmationPopup.ts +48 -0
  31. package/src/components/DayStatCard/DayStatCard.tsx +96 -69
  32. package/src/components/DraggableSwitcher/DraggableSwitcherButton.tsx +58 -58
  33. package/src/components/DraggableSwitcher/context/useDraggableSwitcher.tsx +45 -45
  34. package/src/components/DraggableSwitcher/index.ts +2 -2
  35. package/src/components/DynamicInput/input/SelectInput.tsx +75 -75
  36. package/src/components/DynamicInput/input/assets/SelectInput.module.css +95 -95
  37. package/src/components/DynamicTable/TableCell.tsx +38 -30
  38. package/src/components/DynamicTable/TableHeader.tsx +39 -34
  39. package/src/components/DynamicTable/TableauDynamique.module.css +1333 -1287
  40. package/src/components/DynamicTable/TableauDynamique.tsx +154 -154
  41. package/src/components/DynamicTable/tools/tableTypes.ts +63 -63
  42. package/src/components/Grid/Grid.tsx +5 -0
  43. package/src/components/Grid/grid.css +285 -285
  44. package/src/components/Header/Header.tsx +4 -2
  45. package/src/components/Header/header.css +61 -31
  46. package/src/components/MetricsPanel/MetricsPanel.module.css +688 -636
  47. package/src/components/MetricsPanel/MetricsPanel.tsx +220 -282
  48. package/src/components/MetricsPanel/renderers/CompactRenderer.tsx +148 -125
  49. package/src/components/NavBar/NavBar.tsx +1 -1
  50. package/src/components/NavItem/NavItem.tsx +58 -58
  51. package/src/components/PeriodRange/PeriodRange.module.css +158 -158
  52. package/src/components/PeriodRange/PeriodRange.tsx +130 -130
  53. package/src/components/SearchBar/SearchBar.css +40 -40
  54. package/src/components/SelectFilter/SelectFilter.module.css +249 -0
  55. package/src/components/SelectFilter/SelectFilter.stories.tsx +321 -0
  56. package/src/components/SelectFilter/SelectFilter.tsx +219 -0
  57. package/src/components/SelectFilter/index.ts +2 -0
  58. package/src/components/SelectFilter/types.ts +19 -0
  59. package/src/components/TranslationKey/TranslationKey.css +272 -272
  60. package/src/components/TranslationKey/TranslationKey.tsx +266 -245
  61. package/src/components/TrendList/TrendList.tsx +72 -45
@@ -1,125 +1,148 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* CompactRenderer.tsx */
3
- import React from 'react';
4
- import { hexToRgba as utilHexToRgba } from '../tools/colorUtils';
5
- import type { MetricsItem as ItemType } from '../tools/MetricsPanelTypes';
6
-
7
- const hexToRgba = (c: string | undefined | null, a = 1) => {
8
- try {
9
- return utilHexToRgba(c as any, a);
10
- } catch {
11
- return `rgba(124, 58, 237, ${a})`;
12
- }
13
- };
14
-
15
- const CompactRenderer = (item: ItemType) => (
16
- <div
17
- style={{
18
- display: 'grid',
19
- gridTemplateRows: 'auto 1fr',
20
- width: '100%',
21
- gap: 6,
22
- alignItems: 'center',
23
- boxSizing: 'border-box',
24
- // allow the content to shrink nicely
25
- minWidth: 0,
26
- }}
27
- >
28
- <div
29
- style={{
30
- display: 'flex',
31
- justifyContent: 'space-between-left',
32
- alignItems: 'baseline',
33
- gap: 8,
34
- width: '100%',
35
- }}
36
- >
37
- <div
38
- style={{
39
- fontWeight: 700,
40
- fontSize: 'clamp(12px, 1.05vw, 13px)',
41
- overflow: 'hidden',
42
- textOverflow: 'ellipsis',
43
- whiteSpace: 'nowrap',
44
- minWidth: 0,
45
- }}
46
- >
47
- {item.label}
48
- </div>
49
- {item.subLabel ? (
50
- <div
51
- style={{
52
- fontSize: 'clamp(11px, 0.9vw, 12px)',
53
- fontWeight: 600,
54
- whiteSpace: 'nowrap',
55
- }}
56
- >
57
- {item.subLabel}
58
- </div>
59
- ) : null}
60
- </div>
61
-
62
- <div
63
- style={{
64
- display: 'flex',
65
- justifyContent: 'space-between',
66
- alignItems: 'center',
67
- gap: 12,
68
- width: '100%',
69
- }}
70
- >
71
- <div
72
- style={{
73
- fontWeight: 900,
74
- fontSize: 'clamp(18px, 2.0vw, 20px)',
75
- color: (item as any).valueColor,
76
- lineHeight: 1,
77
- minWidth: 0,
78
- overflow: 'hidden',
79
- textOverflow: 'ellipsis',
80
- whiteSpace: 'nowrap',
81
- }}
82
- >
83
- {item.value}
84
- </div>
85
-
86
- {item.badge ? (
87
- <div
88
- style={{
89
- display: 'flex',
90
- flexDirection: 'column',
91
- alignItems: 'center',
92
- justifyContent: 'center',
93
- padding: '4px 6px',
94
- borderRadius: 8,
95
- backgroundColor: (item as any).badge.bg
96
- ? (item as any).badge.bg
97
- : hexToRgba('#7c3aed', 0.08),
98
- border: `1px solid ${
99
- (item as any).badge.bg ? (item as any).badge.bg : hexToRgba('#7c3aed', 0.12)
100
- }`,
101
- color: (item as any).badge.textColor || '#0f172a',
102
- fontWeight: 700,
103
- fontSize: 'clamp(10px, 1vw, 11px)',
104
- maxWidth: '40%',
105
- minWidth: 48,
106
- textAlign: 'center',
107
- boxSizing: 'border-box',
108
- overflow: 'hidden',
109
- }}
110
- >
111
- <div style={{ fontSize: 'clamp(10px, 0.9vw, 11px)', fontWeight: 800, lineHeight: 1 }}>
112
- {(item as any).badge.text}
113
- </div>
114
- {(item as any).badge.subText ? (
115
- <div style={{ fontSize: 'clamp(9px, 0.8vw, 10px)', marginTop: 2, fontWeight: 600 }}>
116
- {(item as any).badge.subText}
117
- </div>
118
- ) : null}
119
- </div>
120
- ) : null}
121
- </div>
122
- </div>
123
- );
124
-
125
- export default CompactRenderer;
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import React from 'react';
3
+ import { hexToRgba as utilHexToRgba } from '../tools/colorUtils';
4
+ import type { MetricsItem as ItemType } from '../tools/MetricsPanelTypes';
5
+
6
+ const hexToRgba = (c: string | undefined | null, a = 1) => {
7
+ try {
8
+ return utilHexToRgba(c as any, a);
9
+ } catch {
10
+ return `rgba(124, 58, 237, ${a})`;
11
+ }
12
+ };
13
+
14
+ const CompactRenderer = (item: ItemType) => (
15
+ <div
16
+ style={{
17
+ display: 'grid',
18
+ gridTemplateRows: 'auto 1fr',
19
+ width: '100%',
20
+ gap: 8,
21
+ alignItems: 'center',
22
+ boxSizing: 'border-box',
23
+ minWidth: 0,
24
+ }}
25
+ >
26
+ <div
27
+ style={{
28
+ display: 'flex',
29
+ justifyContent: 'space-between-left',
30
+ alignItems: 'baseline',
31
+ gap: 10,
32
+ width: '100%',
33
+ }}
34
+ >
35
+ <div
36
+ style={{
37
+ fontWeight: 700,
38
+ fontSize: 'clamp(14px, 1.2vw, 16px)',
39
+ overflow: 'hidden',
40
+ textOverflow: 'ellipsis',
41
+ whiteSpace: 'nowrap',
42
+ minWidth: 0,
43
+ }}
44
+ >
45
+ {item.label}
46
+ </div>
47
+ {item.subLabel ? (
48
+ <div
49
+ style={{
50
+ fontSize: 'clamp(13px, 1.1vw, 15px)',
51
+ fontWeight: 600,
52
+ whiteSpace: 'nowrap',
53
+ }}
54
+ >
55
+ {item.subLabel}
56
+ </div>
57
+ ) : null}
58
+ </div>
59
+
60
+ <div
61
+ style={{
62
+ display: 'flex',
63
+ justifyContent: 'space-between',
64
+ alignItems: 'center',
65
+ gap: 15,
66
+ width: '100%',
67
+ }}
68
+ >
69
+ <div
70
+ style={{
71
+ fontWeight: 900,
72
+ fontSize: 'clamp(16px, 1.6vw, 20px)',
73
+ color: (item as any).valueColor,
74
+ lineHeight: 1,
75
+ minWidth: 0,
76
+ overflow: 'hidden',
77
+ textOverflow: 'ellipsis',
78
+ whiteSpace: 'nowrap',
79
+ }}
80
+ >
81
+ {item.value}
82
+ </div>
83
+
84
+ {item.badge ? (
85
+ <div
86
+ style={{
87
+ display: 'flex',
88
+ flexDirection: 'column',
89
+ alignItems: 'center',
90
+ justifyContent: 'center',
91
+ padding: '8px 12px',
92
+ borderRadius: 10,
93
+ backgroundColor: (item as any).badge.bg
94
+ ? (item as any).badge.bg
95
+ : hexToRgba('#7c3aed', 0.08),
96
+ border: `1px solid ${
97
+ (item as any).badge.bg ? (item as any).badge.bg : hexToRgba('#7c3aed', 0.12)
98
+ }`,
99
+ color: (item as any).badge.textColor || '#0f172a',
100
+ fontWeight: 700,
101
+ fontSize: 'clamp(12px, 1.2vw, 14px)',
102
+ width: '120px',
103
+ height: '52px',
104
+ textAlign: 'center',
105
+ boxSizing: 'border-box',
106
+ overflow: 'hidden',
107
+ boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
108
+ lineHeight: 1.2,
109
+ flexShrink: 0,
110
+ }}
111
+ >
112
+ <div
113
+ style={{
114
+ fontSize: 14,
115
+ fontWeight: 800,
116
+ lineHeight: 1.2,
117
+ letterSpacing: '0.02em',
118
+ width: '100%',
119
+ overflow: 'hidden',
120
+ textOverflow: 'ellipsis',
121
+ whiteSpace: 'nowrap',
122
+ }}
123
+ >
124
+ {(item as any).badge.text}
125
+ </div>
126
+ {(item as any).badge.subText ? (
127
+ <div
128
+ style={{
129
+ fontSize: 13,
130
+ marginTop: 4,
131
+ fontWeight: 700,
132
+ letterSpacing: '0.01em',
133
+ width: '100%',
134
+ overflow: 'hidden',
135
+ textOverflow: 'ellipsis',
136
+ whiteSpace: 'nowrap',
137
+ }}
138
+ >
139
+ {(item as any).badge.subText}
140
+ </div>
141
+ ) : null}
142
+ </div>
143
+ ) : null}
144
+ </div>
145
+ </div>
146
+ );
147
+
148
+ export default CompactRenderer;
@@ -26,7 +26,7 @@ export const NavBar: React.FC<NavBarProps> = ({
26
26
  const checkNavSize = () => {
27
27
  if (navRef.current && navRef.current.parentElement) {
28
28
  const parentWidth = navRef.current.parentNode?.parentElement?.offsetWidth || 0;
29
- setIsMobile(parentWidth * 0.6 < navRef.current.offsetWidth);
29
+ setIsMobile(parentWidth * 0.2 < navRef.current.offsetWidth);
30
30
  }
31
31
  };
32
32
 
@@ -1,58 +1,58 @@
1
- import React from 'react';
2
- import './NavItem.css';
3
- import { useNavigation } from '../NavBar';
4
-
5
- export type NavItemType = {
6
- id: string;
7
- label: string;
8
- isActive?: boolean;
9
- onClick?: (id: string) => void;
10
- href?: string;
11
- highlightColor?: string;
12
- moduleKey?: string;
13
- };
14
-
15
- export const NavItem: React.FC<NavItemType> = ({
16
- id,
17
- label,
18
- isActive = false,
19
- onClick,
20
- href,
21
- highlightColor = '#008CBA',
22
- moduleKey = '',
23
- ...props
24
- }) => {
25
- // Determine which element to render
26
- const { setActiveNav } = useNavigation();
27
- const handleClick = () => {
28
- setActiveNav(id); // ✅ met à jour la nav active
29
- onClick?.(id); // ✅ appelle le callback externe si défini
30
- };
31
- if (href) {
32
- // Render as anchor tag if href is provided and no onClick handler
33
- return (
34
- <a
35
- href={href}
36
- className={`nav-item ${isActive ? 'active' : ''}`}
37
- style={isActive ? { backgroundColor: highlightColor, color: '#fff' } : {}}
38
- onClick={handleClick}
39
- {...props}
40
- >
41
- {label}
42
- </a>
43
- );
44
- } else {
45
- return (
46
- <div
47
- className={`nav-item ${isActive ? 'active' : ''}`}
48
- style={isActive ? { backgroundColor: highlightColor, color: '#fff' } : {}}
49
- onClick={handleClick}
50
- role={onClick ? 'button' : 'presentation'}
51
- tabIndex={onClick ? 0 : -1}
52
- {...props}
53
- >
54
- {label}
55
- </div>
56
- );
57
- }
58
- };
1
+ import React from 'react';
2
+ import './NavItem.css';
3
+ import { useNavigation } from '../NavBar';
4
+
5
+ export type NavItemType = {
6
+ id: string;
7
+ label: string;
8
+ isActive?: boolean;
9
+ onClick?: (id: string) => void;
10
+ href?: string;
11
+ highlightColor?: string;
12
+ moduleKey?: string;
13
+ };
14
+
15
+ export const NavItem: React.FC<NavItemType> = ({
16
+ id,
17
+ label,
18
+ isActive = false,
19
+ onClick,
20
+ href,
21
+ highlightColor = '#008CBA',
22
+ moduleKey = '',
23
+ ...props
24
+ }) => {
25
+ // Determine which element to render
26
+ const { setActiveNav } = useNavigation();
27
+ const handleClick = () => {
28
+ setActiveNav(id); // ✅ met à jour la nav active
29
+ onClick?.(id); // ✅ appelle le callback externe si défini
30
+ };
31
+ if (href) {
32
+ // Render as anchor tag if href is provided and no onClick handler
33
+ return (
34
+ <a
35
+ href={href}
36
+ className={`nav-item ${isActive ? 'active' : ''}`}
37
+ style={isActive ? { backgroundColor: highlightColor, color: '#fff' } : {}}
38
+ onClick={handleClick}
39
+ {...props}
40
+ >
41
+ {label}
42
+ </a>
43
+ );
44
+ } else {
45
+ return (
46
+ <div
47
+ className={`nav-item ${isActive ? 'active' : ''}`}
48
+ style={isActive ? { backgroundColor: highlightColor, color: '#fff' } : {}}
49
+ onClick={handleClick}
50
+ role={onClick ? 'button' : 'presentation'}
51
+ tabIndex={onClick ? 0 : -1}
52
+ {...props}
53
+ >
54
+ {label}
55
+ </div>
56
+ );
57
+ }
58
+ };