@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,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';
@@ -15,7 +15,13 @@ interface ChartProps {
15
15
 
16
16
  const defaultColors = ['#e24b33', '#e2b23a', '#6feff0', '#2f5be8'];
17
17
 
18
- const Area: React.FC<ChartProps> = ({ categories, series, height = 350, title = 'Admissions', draggable = false }) => {
18
+ const Area: React.FC<ChartProps> = ({
19
+ categories,
20
+ series,
21
+ height = 350,
22
+ title = 'Admissions',
23
+ draggable = false,
24
+ }) => {
19
25
  const maxStack = Math.max(
20
26
  ...categories.map((_, i) => series.reduce((s, ser) => s + (ser.data[i] ?? 0), 0))
21
27
  );
@@ -37,7 +37,11 @@ type HBarSeries = ReadonlyArray<{
37
37
  data: ReadonlyArray<number>;
38
38
  }>;
39
39
 
40
- const HorizontalBarChart: React.FC<Props> = ({ data, config = defaultConfig, draggable = false }) => {
40
+ const HorizontalBarChart: React.FC<Props> = ({
41
+ data,
42
+ config = defaultConfig,
43
+ draggable = false,
44
+ }) => {
41
45
  const cfg: HorizontalBarConfig = { ...defaultConfig, ...config };
42
46
 
43
47
  const labels = data.labels ?? [];
@@ -137,7 +141,7 @@ const HorizontalBarChart: React.FC<Props> = ({ data, config = defaultConfig, dra
137
141
  series={series as unknown as ApexOptions['series']}
138
142
  type='bar'
139
143
  height={cfg.height}
140
- width="100%"
144
+ width='100%'
141
145
  />
142
146
  </div>
143
147
 
@@ -1,114 +1,114 @@
1
- import React from 'react';
2
- import Chart from 'react-apexcharts';
3
- import type { ApexOptions } from 'apexcharts';
4
-
5
- export interface BoxPoint {
6
- x: string | number;
7
- y: [number, number, number, number, number]; // [min, q1, median, q3, max]
8
- }
9
-
10
- export interface BoxPlotData {
11
- series: BoxPoint[];
12
- }
13
-
14
- export interface BoxPlotConfig {
15
- colorUpper?: string;
16
- colorLower?: string;
17
- color?: string;
18
- showOutliers?: boolean;
19
- tooltipFormatter?: (val: number) => string;
20
- height?: number;
21
- responsive?: boolean;
22
- }
23
-
24
- interface Props {
25
- data: BoxPlotData;
26
- config?: BoxPlotConfig;
27
- }
28
-
29
- const defaultConfig: BoxPlotConfig = {
30
- colorUpper: '#2db85bff',
31
- colorLower: '#b3761bff',
32
- color: '#5f9ec4',
33
- showOutliers: true,
34
- tooltipFormatter: (v) => String(v),
35
- height: 420,
36
- responsive: true,
37
- };
38
-
39
- /** Série locale pour boxPlot */
40
- type BoxPlotSeries = ReadonlyArray<{
41
- name: string;
42
- data: ReadonlyArray<{ x: string | number; y: [number, number, number, number, number] }>;
43
- }>;
44
-
45
- const BoxPlotChart: React.FC<Props> = ({ data, config = defaultConfig }) => {
46
- const cfg: BoxPlotConfig = { ...defaultConfig, ...config };
47
-
48
- const seriesPoints = Array.isArray(data?.series) ? data.series : [];
49
- const apexSeries: BoxPlotSeries = [
50
- {
51
- name: 'Distribution',
52
- data: seriesPoints.map((p) => ({ x: p.x, y: p.y })),
53
- },
54
- ];
55
- const options: ApexOptions = {
56
- chart: {
57
- foreColor: 'var(--color-text)',
58
- type: 'boxPlot',
59
- toolbar: { show: false },
60
- height: cfg.height,
61
- },
62
- yaxis: {
63
- tickAmount: 10,
64
- labels: {
65
- formatter: function (val: number) {
66
- return val.toFixed(0);
67
- },
68
- },
69
- },
70
- plotOptions: {
71
- boxPlot: {
72
- colors: {
73
- upper: cfg.colorUpper,
74
- lower: cfg.colorLower,
75
- },
76
- },
77
- },
78
- stroke: { show: true, width: 1, colors: ['var(--color-secondary)'] },
79
- markers: { size: 0 },
80
- tooltip: {
81
- shared: false,
82
- y: {
83
- formatter: (val: number | string | unknown) => {
84
- if (typeof val === 'number') return cfg.tooltipFormatter!(val);
85
- return String(val);
86
- },
87
- },
88
- },
89
- grid: { borderColor: '#e6e6e6' },
90
- dataLabels: { enabled: false },
91
- legend: { show: false },
92
- responsive: cfg.responsive
93
- ? [
94
- // {
95
- // breakpoint: 768,
96
- // options: {
97
- // chart: { height: Math.max(220, Math.round((cfg.height ?? 380) * 0.6)) },
98
- // },
99
- // },
100
- ]
101
- : undefined,
102
- };
103
-
104
- return (
105
- <Chart
106
- options={options}
107
- series={apexSeries as unknown as ApexOptions['series']}
108
- type='boxPlot'
109
- height={cfg.height}
110
- />
111
- );
112
- };
113
-
114
- export default BoxPlotChart;
1
+ import React from 'react';
2
+ import Chart from 'react-apexcharts';
3
+ import type { ApexOptions } from 'apexcharts';
4
+
5
+ export interface BoxPoint {
6
+ x: string | number;
7
+ y: [number, number, number, number, number]; // [min, q1, median, q3, max]
8
+ }
9
+
10
+ export interface BoxPlotData {
11
+ series: BoxPoint[];
12
+ }
13
+
14
+ export interface BoxPlotConfig {
15
+ colorUpper?: string;
16
+ colorLower?: string;
17
+ color?: string;
18
+ showOutliers?: boolean;
19
+ tooltipFormatter?: (val: number) => string;
20
+ height?: number;
21
+ responsive?: boolean;
22
+ }
23
+
24
+ interface Props {
25
+ data: BoxPlotData;
26
+ config?: BoxPlotConfig;
27
+ }
28
+
29
+ const defaultConfig: BoxPlotConfig = {
30
+ colorUpper: '#2db85bff',
31
+ colorLower: '#b3761bff',
32
+ color: '#5f9ec4',
33
+ showOutliers: true,
34
+ tooltipFormatter: (v) => String(v),
35
+ height: 420,
36
+ responsive: true,
37
+ };
38
+
39
+ /** Série locale pour boxPlot */
40
+ type BoxPlotSeries = ReadonlyArray<{
41
+ name: string;
42
+ data: ReadonlyArray<{ x: string | number; y: [number, number, number, number, number] }>;
43
+ }>;
44
+
45
+ const BoxPlotChart: React.FC<Props> = ({ data, config = defaultConfig }) => {
46
+ const cfg: BoxPlotConfig = { ...defaultConfig, ...config };
47
+
48
+ const seriesPoints = Array.isArray(data?.series) ? data.series : [];
49
+ const apexSeries: BoxPlotSeries = [
50
+ {
51
+ name: 'Distribution',
52
+ data: seriesPoints.map((p) => ({ x: p.x, y: p.y })),
53
+ },
54
+ ];
55
+ const options: ApexOptions = {
56
+ chart: {
57
+ foreColor: 'var(--color-text)',
58
+ type: 'boxPlot',
59
+ toolbar: { show: false },
60
+ height: cfg.height,
61
+ },
62
+ yaxis: {
63
+ tickAmount: 10,
64
+ labels: {
65
+ formatter: function (val: number) {
66
+ return val.toFixed(0);
67
+ },
68
+ },
69
+ },
70
+ plotOptions: {
71
+ boxPlot: {
72
+ colors: {
73
+ upper: cfg.colorUpper,
74
+ lower: cfg.colorLower,
75
+ },
76
+ },
77
+ },
78
+ stroke: { show: true, width: 1, colors: ['var(--color-secondary)'] },
79
+ markers: { size: 0 },
80
+ tooltip: {
81
+ shared: false,
82
+ y: {
83
+ formatter: (val: number | string | unknown) => {
84
+ if (typeof val === 'number') return cfg.tooltipFormatter!(val);
85
+ return String(val);
86
+ },
87
+ },
88
+ },
89
+ grid: { borderColor: '#e6e6e6' },
90
+ dataLabels: { enabled: false },
91
+ legend: { show: false },
92
+ responsive: cfg.responsive
93
+ ? [
94
+ // {
95
+ // breakpoint: 768,
96
+ // options: {
97
+ // chart: { height: Math.max(220, Math.round((cfg.height ?? 380) * 0.6)) },
98
+ // },
99
+ // },
100
+ ]
101
+ : undefined,
102
+ };
103
+
104
+ return (
105
+ <Chart
106
+ options={options}
107
+ series={apexSeries as unknown as ApexOptions['series']}
108
+ type='boxPlot'
109
+ height={cfg.height}
110
+ />
111
+ );
112
+ };
113
+
114
+ export default BoxPlotChart;
@@ -670,7 +670,7 @@ const MixedChart: React.FC<Props> = ({
670
670
  key={renderKey} // force remount si besoin
671
671
  options={options}
672
672
  series={series as unknown as ApexOptions['series']}
673
- type="line"
673
+ type='line'
674
674
  height={height}
675
675
  />
676
676
  )}
@@ -1,70 +1,70 @@
1
- // MySankeyChart.tsx
2
-
3
- import React from 'react';
4
- import { ResponsiveSankey } from '@nivo/sankey';
5
- import type { SankeyDataProps } from '@nivo/sankey';
6
- // Définissez vos données avec le type approprié pour une meilleure intégrité
7
- const data: SankeyDataProps = {
8
- nodes: [
9
- { id: 'start', color: '#61cdbb' },
10
- { id: 'process_a', color: '#97e6a6' },
11
- { id: 'process_b', color: '#e8c1a0' },
12
- { id: 'end_result', color: '#f1e15b' },
13
- ],
14
- links: [
15
- { source: 'start', target: 'process_a', value: 100 },
16
- { source: 'start', target: 'process_b', value: 50 },
17
- { source: 'process_a', target: 'end_result', value: 75 },
18
- { source: 'process_a', target: 'process_b', value: 25 },
19
- { source: 'process_b', target: 'end_result', value: 75 },
20
- ],
21
- };
22
-
23
- const MySankeyChart: React.FC = () => {
24
- return (
25
- <div style={{ height: '500px', width: '100%' }}>
26
- <ResponsiveSankey
27
- data={data}
28
- margin={{ top: 10, right: 10, bottom: 10, left: 10 }}
29
- align='justify'
30
- colors={{ scheme: 'category10' }}
31
- nodeOpacity={1}
32
- nodeThickness={18}
33
- nodeInnerPadding={8}
34
- nodeSpacing={24}
35
- linkOpacity={0.5}
36
- nodeBorderWidth={0}
37
- nodeBorderColor={{
38
- from: 'color',
39
- modifiers: [['darker', 0.8]],
40
- }}
41
- // Active l'affichage des étiquettes
42
- enableLabels={true}
43
- // Positionne les étiquettes à l'extérieur des nœuds
44
- labelPosition='outside'
45
- // Oriente les étiquettes horizontalement
46
- labelOrientation='horizontal'
47
- // Ajoute un espacement entre les nœuds et les étiquettes
48
- labelPadding={16}
49
- // Personnalise la couleur du texte des étiquettes
50
- labelTextColor={{
51
- from: 'color',
52
- modifiers: [['darker', 1.5]],
53
- }}
54
- animate={true}
55
- motionConfig='stiff'
56
- // Personnalise les styles via le thème
57
- theme={{
58
- labels: {
59
- text: {
60
- fontSize: 14,
61
- fontWeight: 'bold',
62
- },
63
- },
64
- }}
65
- />
66
- </div>
67
- );
68
- };
69
-
70
- export default MySankeyChart;
1
+ // MySankeyChart.tsx
2
+
3
+ import React from 'react';
4
+ import { ResponsiveSankey } from '@nivo/sankey';
5
+ import type { SankeyDataProps } from '@nivo/sankey';
6
+ // Définissez vos données avec le type approprié pour une meilleure intégrité
7
+ const data: SankeyDataProps = {
8
+ nodes: [
9
+ { id: 'start', color: '#61cdbb' },
10
+ { id: 'process_a', color: '#97e6a6' },
11
+ { id: 'process_b', color: '#e8c1a0' },
12
+ { id: 'end_result', color: '#f1e15b' },
13
+ ],
14
+ links: [
15
+ { source: 'start', target: 'process_a', value: 100 },
16
+ { source: 'start', target: 'process_b', value: 50 },
17
+ { source: 'process_a', target: 'end_result', value: 75 },
18
+ { source: 'process_a', target: 'process_b', value: 25 },
19
+ { source: 'process_b', target: 'end_result', value: 75 },
20
+ ],
21
+ };
22
+
23
+ const MySankeyChart: React.FC = () => {
24
+ return (
25
+ <div style={{ height: '500px', width: '100%' }}>
26
+ <ResponsiveSankey
27
+ data={data}
28
+ margin={{ top: 10, right: 10, bottom: 10, left: 10 }}
29
+ align='justify'
30
+ colors={{ scheme: 'category10' }}
31
+ nodeOpacity={1}
32
+ nodeThickness={18}
33
+ nodeInnerPadding={8}
34
+ nodeSpacing={24}
35
+ linkOpacity={0.5}
36
+ nodeBorderWidth={0}
37
+ nodeBorderColor={{
38
+ from: 'color',
39
+ modifiers: [['darker', 0.8]],
40
+ }}
41
+ // Active l'affichage des étiquettes
42
+ enableLabels={true}
43
+ // Positionne les étiquettes à l'extérieur des nœuds
44
+ labelPosition='outside'
45
+ // Oriente les étiquettes horizontalement
46
+ labelOrientation='horizontal'
47
+ // Ajoute un espacement entre les nœuds et les étiquettes
48
+ labelPadding={16}
49
+ // Personnalise la couleur du texte des étiquettes
50
+ labelTextColor={{
51
+ from: 'color',
52
+ modifiers: [['darker', 1.5]],
53
+ }}
54
+ animate={true}
55
+ motionConfig='stiff'
56
+ // Personnalise les styles via le thème
57
+ theme={{
58
+ labels: {
59
+ text: {
60
+ fontSize: 14,
61
+ fontWeight: 'bold',
62
+ },
63
+ },
64
+ }}
65
+ />
66
+ </div>
67
+ );
68
+ };
69
+
70
+ export default MySankeyChart;
@@ -1,58 +1,58 @@
1
- 'use client';
2
- import { useEffect, useState } from 'react';
3
- import { useDraggableSwitcher } from './context/useDraggableSwitcher';
4
- import { Switcher } from '../Switcher/Switcher';
5
-
6
- export interface DraggableSwitcherButtonProps {
7
- leftIcon?: string;
8
- rightIcon?: string;
9
- colors?: {
10
- bg?: string;
11
- activeBg?: string;
12
- border?: string;
13
- circle?: string;
14
- icon?: string;
15
- icon2?: string;
16
- };
17
- size?: number;
18
- }
19
-
20
- export const DraggableSwitcherButton = ({
21
- leftIcon = 'Move',
22
- rightIcon = 'MoveDiagonal',
23
- colors = {
24
- bg: '#e5e7eb',
25
- activeBg: '#10b981',
26
- border: '#ffffff',
27
- circle: '#ffffff',
28
- icon: '#10b981',
29
- icon2: '#ffffff',
30
- },
31
- size = 24,
32
- }: DraggableSwitcherButtonProps) => {
33
- const { isDraggable, switchDraggable } = useDraggableSwitcher();
34
- const [mounted, setMounted] = useState(false);
35
-
36
- useEffect(() => {
37
- setMounted(true);
38
- }, []);
39
-
40
- if (!mounted) return null;
41
-
42
- const handleToggle = (checked: boolean) => {
43
- switchDraggable(checked);
44
- };
45
-
46
- return (
47
- <Switcher
48
- leftIcon={leftIcon}
49
- rightIcon={rightIcon}
50
- checked={isDraggable}
51
- onToggle={handleToggle}
52
- colors={colors}
53
- size={size}
54
- />
55
- );
56
- };
57
-
58
- export default DraggableSwitcherButton;
1
+ 'use client';
2
+ import { useEffect, useState } from 'react';
3
+ import { useDraggableSwitcher } from './context/useDraggableSwitcher';
4
+ import { Switcher } from '../Switcher/Switcher';
5
+
6
+ export interface DraggableSwitcherButtonProps {
7
+ leftIcon?: string;
8
+ rightIcon?: string;
9
+ colors?: {
10
+ bg?: string;
11
+ activeBg?: string;
12
+ border?: string;
13
+ circle?: string;
14
+ icon?: string;
15
+ icon2?: string;
16
+ };
17
+ size?: number;
18
+ }
19
+
20
+ export const DraggableSwitcherButton = ({
21
+ leftIcon = 'Move',
22
+ rightIcon = 'MoveDiagonal',
23
+ colors = {
24
+ bg: '#e5e7eb',
25
+ activeBg: '#10b981',
26
+ border: '#ffffff',
27
+ circle: '#ffffff',
28
+ icon: '#10b981',
29
+ icon2: '#ffffff',
30
+ },
31
+ size = 24,
32
+ }: DraggableSwitcherButtonProps) => {
33
+ const { isDraggable, switchDraggable } = useDraggableSwitcher();
34
+ const [mounted, setMounted] = useState(false);
35
+
36
+ useEffect(() => {
37
+ setMounted(true);
38
+ }, []);
39
+
40
+ if (!mounted) return null;
41
+
42
+ const handleToggle = (checked: boolean) => {
43
+ switchDraggable(checked);
44
+ };
45
+
46
+ return (
47
+ <Switcher
48
+ leftIcon={leftIcon}
49
+ rightIcon={rightIcon}
50
+ checked={isDraggable}
51
+ onToggle={handleToggle}
52
+ colors={colors}
53
+ size={size}
54
+ />
55
+ );
56
+ };
57
+
58
+ export default DraggableSwitcherButton;