@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,33 +1,33 @@
1
- import React from 'react';
2
- import './ListContentContainer.css';
3
-
4
- export type ListContentContainerProps = {
5
- className?: string;
6
- style?: React.CSSProperties;
7
- children?: React.ReactNode; // normally SimpleListBox/CounterListBox/TrendListBox
8
- gap?: string;
9
- background?: string;
10
- };
11
-
12
- export const ListContentContainer: React.FC<ListContentContainerProps> = ({
13
- className = '',
14
- style = {},
15
- children,
16
- gap = '1rem',
17
- background = '#D9EEF5',
18
- }) => {
19
- return (
20
- <div
21
- className={`lcc-root ${className}`}
22
- style={{
23
- background,
24
- ...style,
25
- ['--lcc-gap' as any]: gap,
26
- }}
27
- >
28
- {React.Children.map(children, (child) => (
29
- <div className='lcc-cell'>{child}</div>
30
- ))}
31
- </div>
32
- );
33
- };
1
+ import React from 'react';
2
+ import './ListContentContainer.css';
3
+
4
+ export type ListContentContainerProps = {
5
+ className?: string;
6
+ style?: React.CSSProperties;
7
+ children?: React.ReactNode; // normally SimpleListBox/CounterListBox/TrendListBox
8
+ gap?: string;
9
+ background?: string;
10
+ };
11
+
12
+ export const ListContentContainer: React.FC<ListContentContainerProps> = ({
13
+ className = '',
14
+ style = {},
15
+ children,
16
+ gap = '1rem',
17
+ background = '#D9EEF5',
18
+ }) => {
19
+ return (
20
+ <div
21
+ className={`lcc-root ${className}`}
22
+ style={{
23
+ background,
24
+ ...style,
25
+ ['--lcc-gap' as any]: gap,
26
+ }}
27
+ >
28
+ {React.Children.map(children, (child) => (
29
+ <div className='lcc-cell'>{child}</div>
30
+ ))}
31
+ </div>
32
+ );
33
+ };
@@ -1,3 +1,3 @@
1
- export * from './ListBox';
2
- export * from './FlexRowContainer';
3
- export * from './ListContentContainer';
1
+ export * from './ListBox';
2
+ export * from './FlexRowContainer';
3
+ export * from './ListContentContainer';
@@ -1,89 +1,129 @@
1
- import React from 'react';
2
- import Chart from 'react-apexcharts';
3
- import type { ApexOptions } from 'apexcharts';
4
-
5
- export type SeriesItem = { name: string; data: number[] };
6
-
7
- interface ChartProps {
8
- categories: string[];
9
- series: SeriesItem[];
10
- height?: number;
11
- title?: string;
12
- }
13
-
14
- const defaultColors = ['#e24b33', '#e2b23a', '#6feff0', '#2f5be8'];
15
-
16
- const Area: React.FC<ChartProps> = ({ categories, series, height = 350, title = 'Admissions' }) => {
17
- const maxStack = Math.max(
18
- ...categories.map((_, i) => series.reduce((s, ser) => s + (ser.data[i] ?? 0), 0))
19
- );
20
- const yMax = Math.max(100, Math.ceil(maxStack / 50) * 50);
21
-
22
- const apexOptions: ApexOptions = {
23
- chart: {
24
- foreColor: 'var(--color-text)',
25
- type: 'area',
26
- stacked: true,
27
- stackType: 'normal',
28
- toolbar: { show: false },
29
- zoom: { enabled: false },
30
- animations: { enabled: true },
31
- fontFamily: "Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial",
32
- },
33
- title: {
34
- text: title,
35
- align: 'center',
36
- style: { fontSize: '36px', fontWeight: 700, color: '#555' },
37
- },
38
- colors: defaultColors,
39
- dataLabels: { enabled: false },
40
- stroke: { curve: 'smooth', width: 1.5 },
41
- fill: { type: 'solid', opacity: 0.95 },
42
- markers: { size: 0 },
43
- legend: {
44
- show: true,
45
- position: 'top',
46
- horizontalAlign: 'center',
47
- itemMargin: { horizontal: 8, vertical: 0 },
48
- },
49
- xaxis: {
50
- categories,
51
- labels: { rotate: -45, rotateAlways: true, style: { fontSize: '12px' } },
52
- tickPlacement: 'on',
53
- },
54
- yaxis: {
55
- min: 0,
56
- max: yMax,
57
- tickAmount: 7,
58
- labels: { formatter: (val) => String(Math.round(Number(val))) },
59
- },
60
- grid: { borderColor: '#e9e9e9', strokeDashArray: 0 },
61
- tooltip: {
62
- shared: true,
63
- intersect: false,
64
- y: { formatter: (val: number) => String(val) },
65
- },
66
- responsive: [
67
- {
68
- breakpoint: 768,
69
- options: {
70
- chart: { height: Math.max(240, Math.round(height * 0.7)) },
71
- legend: { position: 'top' },
72
- xaxis: { labels: { rotate: -45 } },
73
- },
74
- },
75
- ],
76
- };
77
-
78
- const apexSeries = series.map((s) => ({
79
- name: s.name,
80
- type: 'area' as const,
81
- data: s.data,
82
- }));
83
-
84
- return (
85
- <Chart options={apexOptions} series={apexSeries} type='area' height={height} width='100%' />
86
- );
87
- };
88
-
89
- export default Area;
1
+ import React from 'react';
2
+ import Chart from 'react-apexcharts';
3
+ import type { ApexOptions } from 'apexcharts';
4
+ import { Move } from 'lucide-react';
5
+
6
+ export type SeriesItem = { name: string; data: number[] };
7
+
8
+ interface ChartProps {
9
+ categories: string[];
10
+ series: SeriesItem[];
11
+ height?: number;
12
+ title?: string;
13
+ draggable?: boolean;
14
+ }
15
+
16
+ const defaultColors = ['#e24b33', '#e2b23a', '#6feff0', '#2f5be8'];
17
+
18
+ const Area: React.FC<ChartProps> = ({
19
+ categories,
20
+ series,
21
+ height = 350,
22
+ title = 'Admissions',
23
+ draggable = false,
24
+ }) => {
25
+ const maxStack = Math.max(
26
+ ...categories.map((_, i) => series.reduce((s, ser) => s + (ser.data[i] ?? 0), 0))
27
+ );
28
+ const yMax = Math.max(100, Math.ceil(maxStack / 50) * 50);
29
+
30
+ const apexOptions: ApexOptions = {
31
+ chart: {
32
+ foreColor: 'var(--color-text)',
33
+ type: 'area',
34
+ stacked: true,
35
+ stackType: 'normal',
36
+ toolbar: { show: false },
37
+ zoom: { enabled: false },
38
+ animations: { enabled: true },
39
+ fontFamily: "Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial",
40
+ },
41
+ title: {
42
+ text: title,
43
+ align: 'center',
44
+ style: { fontSize: '36px', fontWeight: 700, color: '#555' },
45
+ },
46
+ colors: defaultColors,
47
+ dataLabels: { enabled: false },
48
+ stroke: { curve: 'smooth', width: 1.5 },
49
+ fill: { type: 'solid', opacity: 0.95 },
50
+ markers: { size: 0 },
51
+ legend: {
52
+ show: true,
53
+ position: 'top',
54
+ horizontalAlign: 'center',
55
+ itemMargin: { horizontal: 8, vertical: 0 },
56
+ },
57
+ xaxis: {
58
+ categories,
59
+ labels: { rotate: -45, rotateAlways: true, style: { fontSize: '12px' } },
60
+ tickPlacement: 'on',
61
+ },
62
+ yaxis: {
63
+ min: 0,
64
+ max: yMax,
65
+ tickAmount: 7,
66
+ labels: { formatter: (val) => String(Math.round(Number(val))) },
67
+ },
68
+ grid: { borderColor: '#e9e9e9', strokeDashArray: 0 },
69
+ tooltip: {
70
+ shared: true,
71
+ intersect: false,
72
+ y: { formatter: (val: number) => String(val) },
73
+ },
74
+ responsive: [
75
+ {
76
+ breakpoint: 768,
77
+ options: {
78
+ chart: { height: Math.max(240, Math.round(height * 0.7)) },
79
+ legend: { position: 'top' },
80
+ xaxis: { labels: { rotate: -45 } },
81
+ },
82
+ },
83
+ ],
84
+ };
85
+
86
+ const apexSeries = series.map((s) => ({
87
+ name: s.name,
88
+ type: 'area' as const,
89
+ data: s.data,
90
+ }));
91
+
92
+ return (
93
+ <div
94
+ style={{
95
+ position: 'relative',
96
+ height,
97
+ width: '100%',
98
+ overflow: 'hidden',
99
+ }}
100
+ >
101
+ {/* Chart visible ou masqué */}
102
+ <div style={{ opacity: draggable ? 0 : 1, transition: 'opacity 0.2s ease-in-out' }}>
103
+ <Chart options={apexOptions} series={apexSeries} type='area' height={height} width='100%' />
104
+ </div>
105
+
106
+ {/* Overlay Move */}
107
+ {draggable && (
108
+ <div
109
+ style={{
110
+ position: 'absolute',
111
+ inset: 0,
112
+ display: 'flex',
113
+ alignItems: 'center',
114
+ justifyContent: 'center',
115
+ background: 'rgba(255, 255, 255, 0.6)',
116
+ borderRadius: 12,
117
+ backdropFilter: 'blur(3px)',
118
+ pointerEvents: 'none',
119
+ transition: 'opacity 0.2s ease-in-out',
120
+ }}
121
+ >
122
+ <Move size={38} strokeWidth={1.5} style={{ opacity: 0.85 }} />
123
+ </div>
124
+ )}
125
+ </div>
126
+ );
127
+ };
128
+
129
+ export default Area;
@@ -1,132 +1,171 @@
1
- import React from 'react';
2
- import Chart from 'react-apexcharts';
3
- import type { ApexOptions } from 'apexcharts';
4
-
5
- export interface HorizontalBarData {
6
- labels: string[];
7
- values: number[];
8
- }
9
-
10
- export interface HorizontalBarConfig {
11
- color?: string;
12
- sort?: 'desc' | 'asc' | null;
13
- height?: number;
14
- showGrid?: boolean;
15
- showLegend?: boolean;
16
- }
17
-
18
- interface Props {
19
- data: HorizontalBarData;
20
- config?: HorizontalBarConfig;
21
- }
22
-
23
- /** Default (local) config */
24
- const defaultConfig: HorizontalBarConfig = {
25
- color: '#4f9db5',
26
- sort: 'desc',
27
- height: 520,
28
- showGrid: true,
29
- showLegend: false,
30
- };
31
-
32
- /** Série locale (évite d'importer ApexAxisChartSeries) */
33
- type HBarSeries = ReadonlyArray<{
34
- name: string;
35
- data: ReadonlyArray<number>;
36
- }>;
37
-
38
- const HorizontalBarChart: React.FC<Props> = ({ data, config = defaultConfig }) => {
39
- const cfg: HorizontalBarConfig = { ...defaultConfig, ...config };
40
-
41
- const labels = data.labels ?? [];
42
- const values = data.values ?? [];
43
-
44
- // normalize lengths
45
- const len = Math.min(labels.length, values.length);
46
- const pairs: { label: string; value: number }[] = [];
47
- for (let i = 0; i < len; i++) pairs.push({ label: labels[i], value: values[i] });
48
-
49
- // optional sorting
50
- if (cfg.sort === 'desc') pairs.sort((a, b) => b.value - a.value);
51
- else if (cfg.sort === 'asc') pairs.sort((a, b) => a.value - b.value);
52
-
53
- const labelsSorted = pairs.map((p) => p.label);
54
- const valuesSorted = pairs.map((p) => p.value);
55
-
56
- const series: HBarSeries = [
57
- {
58
- name: 'Valeur',
59
- data: valuesSorted,
60
- },
61
- ];
62
-
63
- const options: ApexOptions = {
64
- chart: {
65
- foreColor: 'var(--color-text)',
66
- type: 'bar',
67
- toolbar: { show: false },
68
- height: cfg.height,
69
- },
70
- plotOptions: {
71
- bar: {
72
- horizontal: true,
73
- barHeight: '60%',
74
- distributed: false,
75
- borderRadius: 6,
76
- borderRadiusApplication: 'end',
77
- },
78
- },
79
- dataLabels: {
80
- enabled: false,
81
- formatter: (val: number) => String(val),
82
- style: { fontSize: '12px' },
83
- offsetX: 0,
84
- },
85
- yaxis: {
86
- labels: { style: { fontSize: '12px' } },
87
- },
88
- grid: {
89
- show: !!cfg.showGrid,
90
- borderColor: '#e6e6e6',
91
- },
92
- tooltip: {
93
- shared: false,
94
- y: { formatter: (val: number) => String(val) },
95
- },
96
- legend: { show: !!cfg.showLegend },
97
- colors: [cfg.color],
98
- xaxis: {
99
- min: 0,
100
- tickAmount: 5,
101
- categories: labelsSorted,
102
- labels: { formatter: (v: string | number) => String(v) },
103
- },
104
- responsive: [
105
- // {
106
- // breakpoint: 1024,
107
- // options: {
108
- // plotOptions: { bar: { barHeight: '52%' } },
109
- // chart: { height: Math.max(300, Math.round((cfg.height ?? 520) * 0.75)), width: 520 },
110
- // },
111
- // },
112
- // {
113
- // breakpoint: 768,
114
- // options: {
115
- // plotOptions: { bar: { barHeight: '48%' } },
116
- // chart: { height: Math.max(260, Math.round((cfg.height ?? 520) * 0.6)), width: 360 },
117
- // },
118
- // },
119
- ],
120
- };
121
-
122
- return (
123
- <Chart
124
- options={options}
125
- series={series as unknown as ApexOptions['series']}
126
- type='bar'
127
- height={cfg.height}
128
- />
129
- );
130
- };
131
-
132
- export default HorizontalBarChart;
1
+ import React from 'react';
2
+ import Chart from 'react-apexcharts';
3
+ import type { ApexOptions } from 'apexcharts';
4
+ import { Move } from 'lucide-react';
5
+
6
+ export interface HorizontalBarData {
7
+ labels: string[];
8
+ values: number[];
9
+ }
10
+
11
+ export interface HorizontalBarConfig {
12
+ color?: string;
13
+ sort?: 'desc' | 'asc' | null;
14
+ height?: number;
15
+ showGrid?: boolean;
16
+ showLegend?: boolean;
17
+ }
18
+
19
+ interface Props {
20
+ data: HorizontalBarData;
21
+ config?: HorizontalBarConfig;
22
+ draggable?: boolean;
23
+ }
24
+
25
+ /** Default (local) config */
26
+ const defaultConfig: HorizontalBarConfig = {
27
+ color: '#4f9db5',
28
+ sort: 'desc',
29
+ height: 520,
30
+ showGrid: true,
31
+ showLegend: false,
32
+ };
33
+
34
+ /** Série locale (évite d'importer ApexAxisChartSeries) */
35
+ type HBarSeries = ReadonlyArray<{
36
+ name: string;
37
+ data: ReadonlyArray<number>;
38
+ }>;
39
+
40
+ const HorizontalBarChart: React.FC<Props> = ({
41
+ data,
42
+ config = defaultConfig,
43
+ draggable = false,
44
+ }) => {
45
+ const cfg: HorizontalBarConfig = { ...defaultConfig, ...config };
46
+
47
+ const labels = data.labels ?? [];
48
+ const values = data.values ?? [];
49
+
50
+ // normalize lengths
51
+ const len = Math.min(labels.length, values.length);
52
+ const pairs: { label: string; value: number }[] = [];
53
+ for (let i = 0; i < len; i++) pairs.push({ label: labels[i], value: values[i] });
54
+
55
+ // optional sorting
56
+ if (cfg.sort === 'desc') pairs.sort((a, b) => b.value - a.value);
57
+ else if (cfg.sort === 'asc') pairs.sort((a, b) => a.value - b.value);
58
+
59
+ const labelsSorted = pairs.map((p) => p.label);
60
+ const valuesSorted = pairs.map((p) => p.value);
61
+
62
+ const series: HBarSeries = [
63
+ {
64
+ name: 'Valeur',
65
+ data: valuesSorted,
66
+ },
67
+ ];
68
+
69
+ const options: ApexOptions = {
70
+ chart: {
71
+ foreColor: 'var(--color-text)',
72
+ type: 'bar',
73
+ toolbar: { show: false },
74
+ height: cfg.height,
75
+ },
76
+ plotOptions: {
77
+ bar: {
78
+ horizontal: true,
79
+ barHeight: '60%',
80
+ distributed: false,
81
+ borderRadius: 6,
82
+ borderRadiusApplication: 'end',
83
+ },
84
+ },
85
+ dataLabels: {
86
+ enabled: false,
87
+ formatter: (val: number) => String(val),
88
+ style: { fontSize: '12px' },
89
+ offsetX: 0,
90
+ },
91
+ yaxis: {
92
+ labels: { style: { fontSize: '12px' } },
93
+ },
94
+ grid: {
95
+ show: !!cfg.showGrid,
96
+ borderColor: '#e6e6e6',
97
+ },
98
+ tooltip: {
99
+ shared: false,
100
+ y: { formatter: (val: number) => String(val) },
101
+ },
102
+ legend: { show: !!cfg.showLegend },
103
+ colors: [cfg.color],
104
+ xaxis: {
105
+ min: 0,
106
+ tickAmount: 5,
107
+ categories: labelsSorted,
108
+ labels: { formatter: (v: string | number) => String(v) },
109
+ },
110
+ responsive: [
111
+ // {
112
+ // breakpoint: 1024,
113
+ // options: {
114
+ // plotOptions: { bar: { barHeight: '52%' } },
115
+ // chart: { height: Math.max(300, Math.round((cfg.height ?? 520) * 0.75)), width: 520 },
116
+ // },
117
+ // },
118
+ // {
119
+ // breakpoint: 768,
120
+ // options: {
121
+ // plotOptions: { bar: { barHeight: '48%' } },
122
+ // chart: { height: Math.max(260, Math.round((cfg.height ?? 520) * 0.6)), width: 360 },
123
+ // },
124
+ // },
125
+ ],
126
+ };
127
+
128
+ return (
129
+ <div
130
+ style={{
131
+ position: 'relative',
132
+ height: cfg.height,
133
+ width: '100%',
134
+ overflow: 'hidden',
135
+ }}
136
+ >
137
+ {/* Chart affiché normalement */}
138
+ <div style={{ opacity: draggable ? 0 : 1, transition: 'opacity 0.15s ease-in-out' }}>
139
+ <Chart
140
+ options={options}
141
+ series={series as unknown as ApexOptions['series']}
142
+ type='bar'
143
+ height={cfg.height}
144
+ width='100%'
145
+ />
146
+ </div>
147
+
148
+ {/* Overlay Move */}
149
+ {draggable && (
150
+ <div
151
+ style={{
152
+ position: 'absolute',
153
+ inset: 0,
154
+ display: 'flex',
155
+ alignItems: 'center',
156
+ justifyContent: 'center',
157
+ background: 'rgba(255,255,255,0.5)',
158
+ borderRadius: 12,
159
+ backdropFilter: 'blur(3px)',
160
+ pointerEvents: 'none',
161
+ transition: 'opacity 0.15s ease-in-out',
162
+ }}
163
+ >
164
+ <Move size={36} strokeWidth={1.5} style={{ opacity: 0.85 }} />
165
+ </div>
166
+ )}
167
+ </div>
168
+ );
169
+ };
170
+
171
+ export default HorizontalBarChart;