@tsiky/components-r19 1.0.0 → 1.1.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 (32) hide show
  1. package/index.ts +35 -33
  2. package/package.json +1 -1
  3. package/src/components/Charts/area-chart-admission/AreaChartAdmission.tsx +123 -89
  4. package/src/components/Charts/bar-chart/BarChart.tsx +167 -132
  5. package/src/components/Charts/mixed-chart/MixedChart.tsx +65 -9
  6. package/src/components/Charts/sankey-chart/SankeyChart.tsx +183 -155
  7. package/src/components/Confirmationpopup/ConfirmationPopup.module.css +88 -0
  8. package/src/components/Confirmationpopup/ConfirmationPopup.stories.tsx +94 -0
  9. package/src/components/Confirmationpopup/ConfirmationPopup.tsx +47 -0
  10. package/src/components/Confirmationpopup/index.ts +6 -0
  11. package/src/components/Confirmationpopup/useConfirmationPopup.ts +48 -0
  12. package/src/components/DayStatCard/DayStatCard.tsx +96 -69
  13. package/src/components/DynamicTable/AdvancedFilters.tsx +196 -196
  14. package/src/components/DynamicTable/ColumnSorter.tsx +185 -185
  15. package/src/components/DynamicTable/Pagination.tsx +115 -115
  16. package/src/components/DynamicTable/TableauDynamique.module.css +1287 -1287
  17. package/src/components/DynamicTable/filters/SelectFilter.tsx +69 -69
  18. package/src/components/EntryControl/EntryControl.tsx +117 -117
  19. package/src/components/Grid/Grid.tsx +5 -0
  20. package/src/components/Header/Header.tsx +4 -2
  21. package/src/components/Header/header.css +61 -31
  22. package/src/components/MetricsPanel/MetricsPanel.module.css +688 -636
  23. package/src/components/MetricsPanel/MetricsPanel.tsx +220 -282
  24. package/src/components/MetricsPanel/renderers/CompactRenderer.tsx +148 -125
  25. package/src/components/NavBar/NavBar.tsx +1 -1
  26. package/src/components/SelectFilter/SelectFilter.module.css +249 -0
  27. package/src/components/SelectFilter/SelectFilter.stories.tsx +321 -0
  28. package/src/components/SelectFilter/SelectFilter.tsx +219 -0
  29. package/src/components/SelectFilter/index.ts +2 -0
  30. package/src/components/SelectFilter/types.ts +19 -0
  31. package/src/components/TranslationKey/TranslationKey.tsx +265 -245
  32. 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(22px, 2.5vw, 26px)',
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
 
@@ -0,0 +1,249 @@
1
+ .container {
2
+ position: relative;
3
+ width: 100%;
4
+ }
5
+
6
+ .selectButton {
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: space-between;
10
+ width: 100%;
11
+ text-align: left;
12
+ border-radius: 0.5rem;
13
+ border: 1px solid #d1d5db;
14
+ background-color: white;
15
+ box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
16
+ transition: all 0.2s ease-in-out;
17
+ cursor: pointer;
18
+ outline: none;
19
+ }
20
+
21
+ .selectButton:focus {
22
+ border-color: #3b82f6;
23
+ box-shadow: 0 0 0 2px rgb(59 130 246 / 0.5);
24
+ }
25
+
26
+ .selectButton:hover:not(.disabled) {
27
+ border-color: #9ca3af;
28
+ }
29
+
30
+ .disabled {
31
+ opacity: 0.5;
32
+ background-color: #f9fafb;
33
+ cursor: not-allowed;
34
+ }
35
+
36
+ .error {
37
+ border-color: #ef4444;
38
+ }
39
+
40
+ .error:focus {
41
+ border-color: #ef4444;
42
+ box-shadow: 0 0 0 2px rgb(239 68 68 / 0.5);
43
+ }
44
+
45
+ .default {
46
+ border-color: #d1d5db;
47
+ background-color: white;
48
+ }
49
+
50
+ .outline {
51
+ border-width: 2px;
52
+ border-color: #9ca3af;
53
+ background-color: transparent;
54
+ }
55
+
56
+ .outline:focus {
57
+ border-color: #2563eb;
58
+ }
59
+
60
+ .filled {
61
+ border: none;
62
+ background-color: #f3f4f6;
63
+ }
64
+
65
+ .filled:focus {
66
+ background-color: white;
67
+ box-shadow: 0 0 0 2px rgb(59 130 246 / 0.5);
68
+ }
69
+
70
+ .sm {
71
+ padding: 0.25rem 0.5rem;
72
+ font-size: 0.875rem;
73
+ }
74
+
75
+ .md {
76
+ padding: 0.5rem 0.75rem;
77
+ font-size: 1rem;
78
+ }
79
+
80
+ .lg {
81
+ padding: 0.75rem 1rem;
82
+ font-size: 1.125rem;
83
+ }
84
+
85
+ .buttonContent {
86
+ display: flex;
87
+ align-items: center;
88
+ justify-content: space-between;
89
+ width: 100%;
90
+ }
91
+
92
+ .label {
93
+ overflow: hidden;
94
+ text-overflow: ellipsis;
95
+ white-space: nowrap;
96
+ display: block;
97
+ }
98
+
99
+ .placeholder {
100
+ color: #6b7280;
101
+ }
102
+
103
+ .iconsContainer {
104
+ display: flex;
105
+ align-items: center;
106
+ gap: 0.5rem;
107
+ flex-shrink: 0;
108
+ margin-left: 0.5rem;
109
+ }
110
+
111
+ .loadingSpinner {
112
+ width: 1rem;
113
+ height: 1rem;
114
+ border: 2px solid #3b82f6;
115
+ border-top: 2px solid transparent;
116
+ border-radius: 50%;
117
+ animation: spin 1s linear infinite;
118
+ flex-shrink: 0;
119
+ }
120
+
121
+ @keyframes spin {
122
+ from {
123
+ transform: rotate(0deg);
124
+ }
125
+ to {
126
+ transform: rotate(360deg);
127
+ }
128
+ }
129
+
130
+ .arrowIcon {
131
+ width: 1rem;
132
+ height: 1rem;
133
+ color: #6b7280;
134
+ transition: transform 0.2s ease-in-out;
135
+ flex-shrink: 0;
136
+ }
137
+
138
+ .arrowIconOpen {
139
+ transform: rotate(180deg);
140
+ }
141
+
142
+ .dropdown {
143
+ position: absolute;
144
+ z-index: 50;
145
+ width: 100%;
146
+ margin-top: 0.25rem;
147
+ background-color: white;
148
+ border: 1px solid #d1d5db;
149
+ border-radius: 0.5rem;
150
+ box-shadow:
151
+ 0 10px 15px -3px rgb(0 0 0 / 0.1),
152
+ 0 4px 6px -4px rgb(0 0 0 / 0.1);
153
+ max-height: 15rem;
154
+ overflow: hidden;
155
+ }
156
+
157
+ .searchContainer {
158
+ padding: 0.5rem;
159
+ border-bottom: 1px solid #e5e7eb;
160
+ }
161
+
162
+ .searchInput {
163
+ width: 90%;
164
+ padding: 0.5rem 0.75rem;
165
+ font-size: 0.875rem;
166
+ border: 1px solid #d1d5db;
167
+ border-radius: 0.375rem;
168
+ outline: none;
169
+ }
170
+
171
+ .searchInput:focus {
172
+ border-color: transparent;
173
+ box-shadow: 0 0 0 2px rgb(59 130 246 / 0.5);
174
+ }
175
+
176
+ .optionsList {
177
+ overflow-y: auto;
178
+ max-height: 12rem;
179
+ padding: 0.25rem 0;
180
+ }
181
+
182
+ .noResults {
183
+ padding: 0.75rem 1rem;
184
+ font-size: 0.875rem;
185
+ color: #6b7280;
186
+ text-align: center;
187
+ }
188
+
189
+ .option {
190
+ padding: 0.5rem 1rem;
191
+ cursor: pointer;
192
+ transition:
193
+ background-color 0.15s ease-in-out,
194
+ color 0.15s ease-in-out;
195
+ display: flex;
196
+ align-items: center;
197
+ justify-content: space-between;
198
+ }
199
+
200
+ .option:hover {
201
+ background-color: #f9fafb;
202
+ }
203
+
204
+ .optionHighlighted {
205
+ background-color: #eff6ff;
206
+ color: #1d4ed8;
207
+ }
208
+
209
+ .optionSelected {
210
+ background-color: #dbeafe;
211
+ color: #1e40af;
212
+ font-weight: 500;
213
+ }
214
+
215
+ .optionDisabled {
216
+ opacity: 0.5;
217
+ cursor: not-allowed;
218
+ }
219
+
220
+ .optionLabel {
221
+ overflow: hidden;
222
+ text-overflow: ellipsis;
223
+ white-space: nowrap;
224
+ display: block;
225
+ }
226
+
227
+ .checkIcon {
228
+ width: 1rem;
229
+ height: 1rem;
230
+ color: #2563eb;
231
+ flex-shrink: 0;
232
+ margin-left: 0.5rem;
233
+ }
234
+
235
+ .widthFull {
236
+ width: 100%;
237
+ }
238
+
239
+ .width64 {
240
+ width: 16rem;
241
+ }
242
+
243
+ .width80 {
244
+ width: 20rem;
245
+ }
246
+
247
+ .width96 {
248
+ width: 24rem;
249
+ }