@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
package/index.ts CHANGED
@@ -1,33 +1,35 @@
1
- export * from './src/components/Button';
2
- export * from './src/components/CircularProgress';
3
- export * from './src/components/DayStatCard';
4
- export * from './src/components/DropdownMenu';
5
- export * from './src/components/Grid';
6
- export * from './src/components/Header';
7
- export * from './src/components/IconText';
8
- export * from './src/components/Logo';
9
- export * from './src/components/NavBar';
10
- export * from './src/components/NavItem';
11
- export * from './src/components/ScrollableHorizontale';
12
- export * from './src/components/SubNavBar';
13
- export * from './src/components/TrendItem';
14
- export * from './src/components/TrendList';
15
- export * from './src/components/theme';
16
- export * from './src/components/DynamicForm';
17
- export * from './src/components/DynamicInput';
18
- export * from './src/components/DynamicTable';
19
- export * from './src/components/MetricsPanel';
20
- export * from './src/components/ChartContainer';
21
- export * from './src/components/Switcher';
22
- export * from './src/components/Alert';
23
- export * from './src/components/PeriodSelect';
24
- export * from './src/components/SideComponent';
25
- export * from './src/components/Title';
26
- export * from './src/components/ModuleHeader';
27
- export * from './src/components/ModuleSideBar';
28
- export * from './src/components/SearchBar';
29
- export * from './src/components/TranslationKey';
30
- export * from './src/components/EntryControl';
31
- export * from './src/components/AddItemModal';
32
- export * from './src/components/DraggableSwitcher';
33
- export * from './src/components/AnnouncementPanel';
1
+ export * from './src/components/Button';
2
+ export * from './src/components/CircularProgress';
3
+ export * from './src/components/DayStatCard';
4
+ export * from './src/components/DropdownMenu';
5
+ export * from './src/components/Grid';
6
+ export * from './src/components/Header';
7
+ export * from './src/components/IconText';
8
+ export * from './src/components/Logo';
9
+ export * from './src/components/NavBar';
10
+ export * from './src/components/NavItem';
11
+ export * from './src/components/ScrollableHorizontale';
12
+ export * from './src/components/SubNavBar';
13
+ export * from './src/components/TrendItem';
14
+ export * from './src/components/TrendList';
15
+ export * from './src/components/theme';
16
+ export * from './src/components/DynamicForm';
17
+ export * from './src/components/DynamicInput';
18
+ export * from './src/components/DynamicTable';
19
+ export * from './src/components/MetricsPanel';
20
+ export * from './src/components/ChartContainer';
21
+ export * from './src/components/Switcher';
22
+ export * from './src/components/Alert';
23
+ export * from './src/components/PeriodSelect';
24
+ export * from './src/components/SideComponent';
25
+ export * from './src/components/Title';
26
+ export * from './src/components/ModuleHeader';
27
+ export * from './src/components/ModuleSideBar';
28
+ export * from './src/components/SearchBar';
29
+ export * from './src/components/TranslationKey';
30
+ export * from './src/components/EntryControl';
31
+ export * from './src/components/AddItemModal';
32
+ export * from './src/components/DraggableSwitcher';
33
+ export * from './src/components/AnnouncementPanel';
34
+ export * from './src/components/Confirmationpopup';
35
+ export * from './src/components/SelectFilter';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsiky/components-r19",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -1,89 +1,123 @@
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> = ({ categories, series, height = 350, title = 'Admissions', draggable = false }) => {
19
+ const maxStack = Math.max(
20
+ ...categories.map((_, i) => series.reduce((s, ser) => s + (ser.data[i] ?? 0), 0))
21
+ );
22
+ const yMax = Math.max(100, Math.ceil(maxStack / 50) * 50);
23
+
24
+ const apexOptions: ApexOptions = {
25
+ chart: {
26
+ foreColor: 'var(--color-text)',
27
+ type: 'area',
28
+ stacked: true,
29
+ stackType: 'normal',
30
+ toolbar: { show: false },
31
+ zoom: { enabled: false },
32
+ animations: { enabled: true },
33
+ fontFamily: "Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial",
34
+ },
35
+ title: {
36
+ text: title,
37
+ align: 'center',
38
+ style: { fontSize: '36px', fontWeight: 700, color: '#555' },
39
+ },
40
+ colors: defaultColors,
41
+ dataLabels: { enabled: false },
42
+ stroke: { curve: 'smooth', width: 1.5 },
43
+ fill: { type: 'solid', opacity: 0.95 },
44
+ markers: { size: 0 },
45
+ legend: {
46
+ show: true,
47
+ position: 'top',
48
+ horizontalAlign: 'center',
49
+ itemMargin: { horizontal: 8, vertical: 0 },
50
+ },
51
+ xaxis: {
52
+ categories,
53
+ labels: { rotate: -45, rotateAlways: true, style: { fontSize: '12px' } },
54
+ tickPlacement: 'on',
55
+ },
56
+ yaxis: {
57
+ min: 0,
58
+ max: yMax,
59
+ tickAmount: 7,
60
+ labels: { formatter: (val) => String(Math.round(Number(val))) },
61
+ },
62
+ grid: { borderColor: '#e9e9e9', strokeDashArray: 0 },
63
+ tooltip: {
64
+ shared: true,
65
+ intersect: false,
66
+ y: { formatter: (val: number) => String(val) },
67
+ },
68
+ responsive: [
69
+ {
70
+ breakpoint: 768,
71
+ options: {
72
+ chart: { height: Math.max(240, Math.round(height * 0.7)) },
73
+ legend: { position: 'top' },
74
+ xaxis: { labels: { rotate: -45 } },
75
+ },
76
+ },
77
+ ],
78
+ };
79
+
80
+ const apexSeries = series.map((s) => ({
81
+ name: s.name,
82
+ type: 'area' as const,
83
+ data: s.data,
84
+ }));
85
+
86
+ return (
87
+ <div
88
+ style={{
89
+ position: 'relative',
90
+ height,
91
+ width: '100%',
92
+ overflow: 'hidden',
93
+ }}
94
+ >
95
+ {/* Chart visible ou masqué */}
96
+ <div style={{ opacity: draggable ? 0 : 1, transition: 'opacity 0.2s ease-in-out' }}>
97
+ <Chart options={apexOptions} series={apexSeries} type='area' height={height} width='100%' />
98
+ </div>
99
+
100
+ {/* Overlay Move */}
101
+ {draggable && (
102
+ <div
103
+ style={{
104
+ position: 'absolute',
105
+ inset: 0,
106
+ display: 'flex',
107
+ alignItems: 'center',
108
+ justifyContent: 'center',
109
+ background: 'rgba(255, 255, 255, 0.6)',
110
+ borderRadius: 12,
111
+ backdropFilter: 'blur(3px)',
112
+ pointerEvents: 'none',
113
+ transition: 'opacity 0.2s ease-in-out',
114
+ }}
115
+ >
116
+ <Move size={38} strokeWidth={1.5} style={{ opacity: 0.85 }} />
117
+ </div>
118
+ )}
119
+ </div>
120
+ );
121
+ };
122
+
123
+ export default Area;
@@ -1,132 +1,167 @@
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> = ({ data, config = defaultConfig, draggable = false }) => {
41
+ const cfg: HorizontalBarConfig = { ...defaultConfig, ...config };
42
+
43
+ const labels = data.labels ?? [];
44
+ const values = data.values ?? [];
45
+
46
+ // normalize lengths
47
+ const len = Math.min(labels.length, values.length);
48
+ const pairs: { label: string; value: number }[] = [];
49
+ for (let i = 0; i < len; i++) pairs.push({ label: labels[i], value: values[i] });
50
+
51
+ // optional sorting
52
+ if (cfg.sort === 'desc') pairs.sort((a, b) => b.value - a.value);
53
+ else if (cfg.sort === 'asc') pairs.sort((a, b) => a.value - b.value);
54
+
55
+ const labelsSorted = pairs.map((p) => p.label);
56
+ const valuesSorted = pairs.map((p) => p.value);
57
+
58
+ const series: HBarSeries = [
59
+ {
60
+ name: 'Valeur',
61
+ data: valuesSorted,
62
+ },
63
+ ];
64
+
65
+ const options: ApexOptions = {
66
+ chart: {
67
+ foreColor: 'var(--color-text)',
68
+ type: 'bar',
69
+ toolbar: { show: false },
70
+ height: cfg.height,
71
+ },
72
+ plotOptions: {
73
+ bar: {
74
+ horizontal: true,
75
+ barHeight: '60%',
76
+ distributed: false,
77
+ borderRadius: 6,
78
+ borderRadiusApplication: 'end',
79
+ },
80
+ },
81
+ dataLabels: {
82
+ enabled: false,
83
+ formatter: (val: number) => String(val),
84
+ style: { fontSize: '12px' },
85
+ offsetX: 0,
86
+ },
87
+ yaxis: {
88
+ labels: { style: { fontSize: '12px' } },
89
+ },
90
+ grid: {
91
+ show: !!cfg.showGrid,
92
+ borderColor: '#e6e6e6',
93
+ },
94
+ tooltip: {
95
+ shared: false,
96
+ y: { formatter: (val: number) => String(val) },
97
+ },
98
+ legend: { show: !!cfg.showLegend },
99
+ colors: [cfg.color],
100
+ xaxis: {
101
+ min: 0,
102
+ tickAmount: 5,
103
+ categories: labelsSorted,
104
+ labels: { formatter: (v: string | number) => String(v) },
105
+ },
106
+ responsive: [
107
+ // {
108
+ // breakpoint: 1024,
109
+ // options: {
110
+ // plotOptions: { bar: { barHeight: '52%' } },
111
+ // chart: { height: Math.max(300, Math.round((cfg.height ?? 520) * 0.75)), width: 520 },
112
+ // },
113
+ // },
114
+ // {
115
+ // breakpoint: 768,
116
+ // options: {
117
+ // plotOptions: { bar: { barHeight: '48%' } },
118
+ // chart: { height: Math.max(260, Math.round((cfg.height ?? 520) * 0.6)), width: 360 },
119
+ // },
120
+ // },
121
+ ],
122
+ };
123
+
124
+ return (
125
+ <div
126
+ style={{
127
+ position: 'relative',
128
+ height: cfg.height,
129
+ width: '100%',
130
+ overflow: 'hidden',
131
+ }}
132
+ >
133
+ {/* Chart affiché normalement */}
134
+ <div style={{ opacity: draggable ? 0 : 1, transition: 'opacity 0.15s ease-in-out' }}>
135
+ <Chart
136
+ options={options}
137
+ series={series as unknown as ApexOptions['series']}
138
+ type='bar'
139
+ height={cfg.height}
140
+ width="100%"
141
+ />
142
+ </div>
143
+
144
+ {/* Overlay Move */}
145
+ {draggable && (
146
+ <div
147
+ style={{
148
+ position: 'absolute',
149
+ inset: 0,
150
+ display: 'flex',
151
+ alignItems: 'center',
152
+ justifyContent: 'center',
153
+ background: 'rgba(255,255,255,0.5)',
154
+ borderRadius: 12,
155
+ backdropFilter: 'blur(3px)',
156
+ pointerEvents: 'none',
157
+ transition: 'opacity 0.15s ease-in-out',
158
+ }}
159
+ >
160
+ <Move size={36} strokeWidth={1.5} style={{ opacity: 0.85 }} />
161
+ </div>
162
+ )}
163
+ </div>
164
+ );
165
+ };
166
+
167
+ export default HorizontalBarChart;