@tsiky/components-r19 1.0.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 (287) hide show
  1. package/.prettierignore +4 -0
  2. package/.prettierrc +9 -0
  3. package/.storybook/main.ts +17 -0
  4. package/.storybook/preview.ts +21 -0
  5. package/.storybook/vitest.setup.ts +7 -0
  6. package/README.md +69 -0
  7. package/chart.ts +1 -0
  8. package/eslint.config.js +40 -0
  9. package/index.html +13 -0
  10. package/index.ts +33 -0
  11. package/package.json +63 -0
  12. package/public/vite.svg +1 -0
  13. package/src/App.css +42 -0
  14. package/src/App.tsx +12 -0
  15. package/src/assets/accessibility.png +0 -0
  16. package/src/assets/accessibility.svg +1 -0
  17. package/src/assets/addon-library.png +0 -0
  18. package/src/assets/assets.png +0 -0
  19. package/src/assets/avif-test-image.avif +0 -0
  20. package/src/assets/context.png +0 -0
  21. package/src/assets/discord.svg +1 -0
  22. package/src/assets/docs.png +0 -0
  23. package/src/assets/figma-plugin.png +0 -0
  24. package/src/assets/github.svg +1 -0
  25. package/src/assets/react.svg +1 -0
  26. package/src/assets/share.png +0 -0
  27. package/src/assets/styling.png +0 -0
  28. package/src/assets/testing.png +0 -0
  29. package/src/assets/theming.png +0 -0
  30. package/src/assets/tutorials.svg +1 -0
  31. package/src/assets/youtube.svg +1 -0
  32. package/src/components/AddItemModal/AddItemModal.module.css +72 -0
  33. package/src/components/AddItemModal/AddItemModal.tsx +82 -0
  34. package/src/components/AddItemModal/index.ts +1 -0
  35. package/src/components/Alert/Alert.css +54 -0
  36. package/src/components/Alert/Alert.stories.tsx +82 -0
  37. package/src/components/Alert/Alert.tsx +85 -0
  38. package/src/components/Alert/AlertContext.tsx +200 -0
  39. package/src/components/Alert/AlertModels.ts +34 -0
  40. package/src/components/Alert/index.ts +3 -0
  41. package/src/components/AnnouncementPanel/FlexRowContainer.css +17 -0
  42. package/src/components/AnnouncementPanel/FlexRowContainer.stories.tsx +329 -0
  43. package/src/components/AnnouncementPanel/FlexRowContainer.tsx +24 -0
  44. package/src/components/AnnouncementPanel/ListBox/CounterListBox.css +56 -0
  45. package/src/components/AnnouncementPanel/ListBox/CounterListBox.stories.tsx +292 -0
  46. package/src/components/AnnouncementPanel/ListBox/CounterListBox.tsx +106 -0
  47. package/src/components/AnnouncementPanel/ListBox/SimpleListBox.css +57 -0
  48. package/src/components/AnnouncementPanel/ListBox/SimpleListBox.stories.tsx +189 -0
  49. package/src/components/AnnouncementPanel/ListBox/SimpleListBox.tsx +138 -0
  50. package/src/components/AnnouncementPanel/ListBox/TrendListBox.css +61 -0
  51. package/src/components/AnnouncementPanel/ListBox/TrendListBox.stories.tsx +257 -0
  52. package/src/components/AnnouncementPanel/ListBox/TrendListBox.tsx +90 -0
  53. package/src/components/AnnouncementPanel/ListBox/index.ts +3 -0
  54. package/src/components/AnnouncementPanel/ListContentContainer.css +23 -0
  55. package/src/components/AnnouncementPanel/ListContentContainer.stories.tsx +212 -0
  56. package/src/components/AnnouncementPanel/ListContentContainer.tsx +33 -0
  57. package/src/components/AnnouncementPanel/index.ts +3 -0
  58. package/src/components/BandChart/index.tsx +282 -0
  59. package/src/components/Button/Button.module.css +165 -0
  60. package/src/components/Button/Button.stories.ts +132 -0
  61. package/src/components/Button/Button.tsx +55 -0
  62. package/src/components/Button/button.css +29 -0
  63. package/src/components/Button/index.ts +2 -0
  64. package/src/components/ChartContainer/ChartContainer.css +116 -0
  65. package/src/components/ChartContainer/ChartContainer.stories.tsx +159 -0
  66. package/src/components/ChartContainer/ChartContainer.tsx +155 -0
  67. package/src/components/ChartContainer/index.ts +1 -0
  68. package/src/components/Charts/area-chart-admission/AreaChartAdmission.stories.tsx +65 -0
  69. package/src/components/Charts/area-chart-admission/AreaChartAdmission.tsx +89 -0
  70. package/src/components/Charts/area-chart-admission/content.json +48 -0
  71. package/src/components/Charts/area-chart-hospitalisation/AreaChartHospitalisation.stories.tsx +141 -0
  72. package/src/components/Charts/area-chart-hospitalisation/AreaChartHospitalisation.tsx +262 -0
  73. package/src/components/Charts/area-chart-hospitalisation/content.json +55 -0
  74. package/src/components/Charts/bar-chart/BarChart.stories.tsx +50 -0
  75. package/src/components/Charts/bar-chart/BarChart.tsx +132 -0
  76. package/src/components/Charts/bar-chart/content.json +15 -0
  77. package/src/components/Charts/boxplot-chart/BoxPlotChart.stories.tsx +63 -0
  78. package/src/components/Charts/boxplot-chart/BoxPlotChart.tsx +114 -0
  79. package/src/components/Charts/boxplot-chart/boxUtils.ts +22 -0
  80. package/src/components/Charts/boxplot-chart/content.json +11 -0
  81. package/src/components/Charts/mixed-chart/MixedChart.stories.tsx +83 -0
  82. package/src/components/Charts/mixed-chart/MixedChart.tsx +625 -0
  83. package/src/components/Charts/mixed-chart/content.json +34 -0
  84. package/src/components/Charts/sankey-adaptation/sankey.tsx +70 -0
  85. package/src/components/Charts/sankey-chart/SankeyChart.stories.tsx +69 -0
  86. package/src/components/Charts/sankey-chart/SankeyChart.tsx +155 -0
  87. package/src/components/Charts/sankey-chart/content.json +15 -0
  88. package/src/components/Charts/stacked-column/StackedColumn.stories.tsx +72 -0
  89. package/src/components/Charts/stacked-column/StackedColumn.tsx +406 -0
  90. package/src/components/Charts/stacked-column/content.json +37 -0
  91. package/src/components/Charts/stacked-column-one-hundred-percent/StackedColumnOneHundredPercent.stories.tsx +43 -0
  92. package/src/components/Charts/stacked-column-one-hundred-percent/StackedColumnOneHundredPercent.tsx +75 -0
  93. package/src/components/Charts/stacked-column-one-hundred-percent/content.json +6 -0
  94. package/src/components/CircularProgress/CircularProgress.css +79 -0
  95. package/src/components/CircularProgress/CircularProgress.stories.tsx +251 -0
  96. package/src/components/CircularProgress/CircularProgress.tsx +101 -0
  97. package/src/components/CircularProgress/index.ts +2 -0
  98. package/src/components/Configure.mdx +369 -0
  99. package/src/components/DayStatCard/DayStatCard.css +50 -0
  100. package/src/components/DayStatCard/DayStatCard.stories.tsx +273 -0
  101. package/src/components/DayStatCard/DayStatCard.tsx +69 -0
  102. package/src/components/DayStatCard/index.ts +2 -0
  103. package/src/components/DraggableSwitcher/DraggableSwitcherButton.tsx +58 -0
  104. package/src/components/DraggableSwitcher/context/useDraggableSwitcher.tsx +45 -0
  105. package/src/components/DraggableSwitcher/index.ts +2 -0
  106. package/src/components/DropdownMenu/DropdownMenu.css +100 -0
  107. package/src/components/DropdownMenu/DropdownMenu.stories.tsx +174 -0
  108. package/src/components/DropdownMenu/DropdownMenu.tsx +106 -0
  109. package/src/components/DropdownMenu/index.ts +1 -0
  110. package/src/components/DynamicForm/DynamicFom.stories.ts +773 -0
  111. package/src/components/DynamicForm/DynamicForm.module.css +468 -0
  112. package/src/components/DynamicForm/DynamicForm.tsx +224 -0
  113. package/src/components/DynamicForm/index.ts +3 -0
  114. package/src/components/DynamicForm/tools/form-metadata.ts +82 -0
  115. package/src/components/DynamicForm/tools/validation.ts +168 -0
  116. package/src/components/DynamicInput/DynamicInput.module.css +126 -0
  117. package/src/components/DynamicInput/DynamicInput.stories.ts +350 -0
  118. package/src/components/DynamicInput/DynamicInput.tsx +144 -0
  119. package/src/components/DynamicInput/index.ts +2 -0
  120. package/src/components/DynamicInput/input/CheckboxInput.tsx +41 -0
  121. package/src/components/DynamicInput/input/ColorInput.tsx +46 -0
  122. package/src/components/DynamicInput/input/DateInput.tsx +57 -0
  123. package/src/components/DynamicInput/input/FileInput.tsx +174 -0
  124. package/src/components/DynamicInput/input/InputWrapper.tsx +26 -0
  125. package/src/components/DynamicInput/input/RadioInput.tsx +46 -0
  126. package/src/components/DynamicInput/input/RangeInput.tsx +46 -0
  127. package/src/components/DynamicInput/input/SelectInput.tsx +75 -0
  128. package/src/components/DynamicInput/input/TextInput.tsx +101 -0
  129. package/src/components/DynamicInput/input/TextareaInput.tsx +47 -0
  130. package/src/components/DynamicInput/input/assets/ColorInput.module.css +48 -0
  131. package/src/components/DynamicInput/input/assets/DateInput.module.css +83 -0
  132. package/src/components/DynamicInput/input/assets/FileInput.module.css +133 -0
  133. package/src/components/DynamicInput/input/assets/RangeInput.module.css +169 -0
  134. package/src/components/DynamicInput/input/assets/SelectInput.module.css +95 -0
  135. package/src/components/DynamicInput/input/index.ts +10 -0
  136. package/src/components/DynamicTable/AdvancedFilters.tsx +196 -0
  137. package/src/components/DynamicTable/ColumnSorter.tsx +185 -0
  138. package/src/components/DynamicTable/Pagination.tsx +115 -0
  139. package/src/components/DynamicTable/TableBody.tsx +42 -0
  140. package/src/components/DynamicTable/TableCell.tsx +30 -0
  141. package/src/components/DynamicTable/TableHeader.tsx +34 -0
  142. package/src/components/DynamicTable/TableRow.tsx +56 -0
  143. package/src/components/DynamicTable/TableauDynamic.stories.ts +1014 -0
  144. package/src/components/DynamicTable/TableauDynamique.module.css +1287 -0
  145. package/src/components/DynamicTable/TableauDynamique.tsx +154 -0
  146. package/src/components/DynamicTable/filters/BooleanFilter.tsx +30 -0
  147. package/src/components/DynamicTable/filters/DateFilter.tsx +28 -0
  148. package/src/components/DynamicTable/filters/DateRangeFilter.tsx +51 -0
  149. package/src/components/DynamicTable/filters/FilterRenderer.tsx +117 -0
  150. package/src/components/DynamicTable/filters/MultiSelectFilter.tsx +59 -0
  151. package/src/components/DynamicTable/filters/NumberFilter.tsx +37 -0
  152. package/src/components/DynamicTable/filters/OperatorFilter.tsx +64 -0
  153. package/src/components/DynamicTable/filters/SelectFilter.tsx +69 -0
  154. package/src/components/DynamicTable/filters/TextFilter.tsx +39 -0
  155. package/src/components/DynamicTable/filters/index.ts +9 -0
  156. package/src/components/DynamicTable/hooks/index.ts +2 -0
  157. package/src/components/DynamicTable/hooks/useAsyncActions.ts +36 -0
  158. package/src/components/DynamicTable/hooks/useFilters.ts +142 -0
  159. package/src/components/DynamicTable/hooks/useTableData.ts +216 -0
  160. package/src/components/DynamicTable/index.ts +11 -0
  161. package/src/components/DynamicTable/tools/filterTypes.ts +118 -0
  162. package/src/components/DynamicTable/tools/index.ts +3 -0
  163. package/src/components/DynamicTable/tools/tableConfig.ts +96 -0
  164. package/src/components/DynamicTable/tools/tableTypes.ts +63 -0
  165. package/src/components/EntryControl/EntryControl.module.css +218 -0
  166. package/src/components/EntryControl/EntryControl.stories.tsx +71 -0
  167. package/src/components/EntryControl/EntryControl.tsx +117 -0
  168. package/src/components/EntryControl/index.ts +2 -0
  169. package/src/components/Grid/Grid.stories.tsx +94 -0
  170. package/src/components/Grid/Grid.tsx +214 -0
  171. package/src/components/Grid/grid.css +285 -0
  172. package/src/components/Grid/index.ts +2 -0
  173. package/src/components/Header/Header.stories.tsx +164 -0
  174. package/src/components/Header/Header.tsx +59 -0
  175. package/src/components/Header/header.css +31 -0
  176. package/src/components/Header/index.ts +1 -0
  177. package/src/components/IconText/IconText..stories.tsx +135 -0
  178. package/src/components/IconText/IconText.css +43 -0
  179. package/src/components/IconText/IconText.tsx +43 -0
  180. package/src/components/IconText/index.ts +1 -0
  181. package/src/components/LanguageSelector/LanguageSelector.css +31 -0
  182. package/src/components/LanguageSelector/LanguageSelector.stories.tsx +38 -0
  183. package/src/components/LanguageSelector/LanguageSelector.tsx +37 -0
  184. package/src/components/LanguageSelector/index.ts +1 -0
  185. package/src/components/Logo/Logo.css +89 -0
  186. package/src/components/Logo/Logo.stories.tsx +79 -0
  187. package/src/components/Logo/Logo.tsx +22 -0
  188. package/src/components/Logo/index.ts +2 -0
  189. package/src/components/MetricsPanel/MetricsItem.tsx +128 -0
  190. package/src/components/MetricsPanel/MetricsPanel.module.css +636 -0
  191. package/src/components/MetricsPanel/MetricsPanel.stories.tsx +692 -0
  192. package/src/components/MetricsPanel/MetricsPanel.tsx +282 -0
  193. package/src/components/MetricsPanel/PanelHeader.tsx +19 -0
  194. package/src/components/MetricsPanel/SummaryCard.tsx +61 -0
  195. package/src/components/MetricsPanel/index.ts +4 -0
  196. package/src/components/MetricsPanel/renderers/CompactRenderer.tsx +125 -0
  197. package/src/components/MetricsPanel/renderers/ImageCard.tsx +62 -0
  198. package/src/components/MetricsPanel/renderers/PertinenceCard.tsx +55 -0
  199. package/src/components/MetricsPanel/tools/MetricsPanelTypes.ts +62 -0
  200. package/src/components/MetricsPanel/tools/chooseDefaultRender.ts +50 -0
  201. package/src/components/MetricsPanel/tools/colorUtils.ts +39 -0
  202. package/src/components/MetricsPanel/tools/index.ts +2 -0
  203. package/src/components/ModuleHeader/ModuleHeader.css +37 -0
  204. package/src/components/ModuleHeader/ModuleHeader.stories.tsx +37 -0
  205. package/src/components/ModuleHeader/ModuleHeader.tsx +42 -0
  206. package/src/components/ModuleHeader/index.ts +1 -0
  207. package/src/components/ModuleSideBar/ModuleSideBar.css +227 -0
  208. package/src/components/ModuleSideBar/ModuleSideBar.stories.tsx +40 -0
  209. package/src/components/ModuleSideBar/ModuleSideBar.tsx +155 -0
  210. package/src/components/ModuleSideBar/index.ts +1 -0
  211. package/src/components/NavBar/NavBar.css +58 -0
  212. package/src/components/NavBar/NavBar.stories.tsx +169 -0
  213. package/src/components/NavBar/NavBar.tsx +100 -0
  214. package/src/components/NavBar/NavContext.tsx +30 -0
  215. package/src/components/NavBar/index.ts +2 -0
  216. package/src/components/NavItem/NavItem.css +29 -0
  217. package/src/components/NavItem/NavItem.tsx +58 -0
  218. package/src/components/NavItem/index.ts +1 -0
  219. package/src/components/Page/Dashboard.tsx +93 -0
  220. package/src/components/Page/Page.stories.ts +33 -0
  221. package/src/components/Page/Page.tsx +73 -0
  222. package/src/components/Page/page.css +81 -0
  223. package/src/components/PerformanceCard/PerformanceCard.module.css +232 -0
  224. package/src/components/PerformanceCard/PerformanceCard.stories.tsx +441 -0
  225. package/src/components/PerformanceCard/PerformanceCard.tsx +198 -0
  226. package/src/components/PerformanceCard/defaultHistogramRenderer.tsx +32 -0
  227. package/src/components/PerformanceCard/tools/types.ts +50 -0
  228. package/src/components/PerformanceCard/tools/usePerformanceCard.ts +93 -0
  229. package/src/components/PeriodRange/PeriodRange.module.css +158 -0
  230. package/src/components/PeriodRange/PeriodRange.stories.tsx +66 -0
  231. package/src/components/PeriodRange/PeriodRange.tsx +130 -0
  232. package/src/components/PeriodSelect/PeriodSelect.module.css +65 -0
  233. package/src/components/PeriodSelect/PeriodSelect.stories.tsx +40 -0
  234. package/src/components/PeriodSelect/PeriodSelect.tsx +42 -0
  235. package/src/components/PeriodSelect/index.ts +1 -0
  236. package/src/components/ScrollableHorizontale/ScrollableHorizontale.css +40 -0
  237. package/src/components/ScrollableHorizontale/ScrollableHorizontale.stories.tsx +133 -0
  238. package/src/components/ScrollableHorizontale/ScrollableHorizontale.tsx +29 -0
  239. package/src/components/ScrollableHorizontale/index.ts +1 -0
  240. package/src/components/SearchBar/SearchBar.css +40 -0
  241. package/src/components/SearchBar/SearchBar.stories.tsx +36 -0
  242. package/src/components/SearchBar/SearchBar.tsx +30 -0
  243. package/src/components/SearchBar/index.ts +1 -0
  244. package/src/components/SectionTitle/SectionTitle.css +21 -0
  245. package/src/components/SectionTitle/SectionTitle.stories.tsx +39 -0
  246. package/src/components/SectionTitle/SectionTitle.tsx +18 -0
  247. package/src/components/SideComponent/PatientEditor.tsx +64 -0
  248. package/src/components/SideComponent/SideComponent.css +179 -0
  249. package/src/components/SideComponent/SideComponent.stories.tsx +547 -0
  250. package/src/components/SideComponent/SideComponent.tsx +243 -0
  251. package/src/components/SideComponent/hooks/useBodyScrollLock.ts +15 -0
  252. package/src/components/SideComponent/index.ts +2 -0
  253. package/src/components/SideComponent/portal.ts +11 -0
  254. package/src/components/SubNavBar/SubNavBar.tsx +41 -0
  255. package/src/components/SubNavBar/index.ts +1 -0
  256. package/src/components/Switcher/Switcher.css +65 -0
  257. package/src/components/Switcher/Switcher.stories.tsx +153 -0
  258. package/src/components/Switcher/Switcher.tsx +83 -0
  259. package/src/components/Switcher/index.ts +1 -0
  260. package/src/components/Title/Title.stories.tsx +18 -0
  261. package/src/components/Title/Title.tsx +26 -0
  262. package/src/components/Title/index.ts +1 -0
  263. package/src/components/TranslationKey/TranslationKey.css +272 -0
  264. package/src/components/TranslationKey/TranslationKey.stories.tsx +50 -0
  265. package/src/components/TranslationKey/TranslationKey.tsx +245 -0
  266. package/src/components/TranslationKey/index.ts +1 -0
  267. package/src/components/TrendItem/TrendItem.css +36 -0
  268. package/src/components/TrendItem/TrendItem.stories.tsx +276 -0
  269. package/src/components/TrendItem/TrendItem.tsx +46 -0
  270. package/src/components/TrendItem/index.ts +1 -0
  271. package/src/components/TrendList/TrendList.css +16 -0
  272. package/src/components/TrendList/TrendList.stories.tsx +337 -0
  273. package/src/components/TrendList/TrendList.tsx +45 -0
  274. package/src/components/TrendList/index.ts +1 -0
  275. package/src/components/theme/ThemeSwitcherButton.tsx +64 -0
  276. package/src/components/theme/context/ThemeContext.tsx +61 -0
  277. package/src/components/theme/context/index.ts +2 -0
  278. package/src/components/theme/context/useThemeSwitcher.ts +18 -0
  279. package/src/components/theme/index.ts +1 -0
  280. package/src/index.css +68 -0
  281. package/src/main.tsx +10 -0
  282. package/src/vite-env.d.ts +1 -0
  283. package/tsconfig.app.json +27 -0
  284. package/tsconfig.json +4 -0
  285. package/tsconfig.node.json +25 -0
  286. package/vite.config.ts +43 -0
  287. package/vitest.shims.d.ts +1 -0
@@ -0,0 +1,116 @@
1
+ .chart-container {
2
+ border-radius: 12px;
3
+ overflow: hidden;
4
+ display: flex;
5
+ flex-direction: column;
6
+ }
7
+
8
+ /* shadows */
9
+ .shadow-soft {
10
+ box-shadow: 0 6px 18px rgba(11, 20, 34, 0.06);
11
+ }
12
+ .shadow-strong {
13
+ box-shadow: 0 10px 30px rgba(11, 20, 34, 0.12);
14
+ }
15
+
16
+ .with-border {
17
+ border: 1px solid rgba(11, 20, 34, 0.04);
18
+ }
19
+
20
+ /* Header */
21
+ .chart-header {
22
+ display: flex;
23
+ justify-content: space-between;
24
+ align-items: center;
25
+ }
26
+ .chart-title-left {
27
+ font-weight: var(--font-bold, 500);
28
+ font-size: var(--text-paragraph, 1rem); /* 16px */
29
+ color: inherit;
30
+ }
31
+ .chart-title-right {
32
+ font-size: var(--text-small, 0.875rem); /* 14px */
33
+ }
34
+
35
+ /* Chart content area (inner card) */
36
+ .chart-content {
37
+ min-height: 0;
38
+ box-sizing: border-box;
39
+ display: flex;
40
+ align-items: center;
41
+ justify-content: center;
42
+ border-radius: 10px;
43
+ }
44
+
45
+ /* Variant: soft blue card */
46
+ .variant-softBlueCard .chart-content {
47
+ background: linear-gradient(180deg, rgba(99, 102, 241, 0.06), rgba(99, 102, 241, 0.02));
48
+ border-radius: 10px;
49
+ display: flex;
50
+ align-items: center;
51
+ justify-content: center;
52
+ }
53
+ .variant-softBlueCard .placeholder,
54
+ .variant-softBlueCard .placeholder-node {
55
+ text-align: center;
56
+ }
57
+ .variant-softBlueCard .placeholder-icon svg {
58
+ stroke: rgba(59, 130, 246, 0.9);
59
+ }
60
+ .variant-softBlueCard .placeholder-text {
61
+ font-weight: var(--font-medium, 500);
62
+ margin-top: 8px;
63
+ font-size: var(--text-paragraph, 1rem); /* 16px */
64
+ }
65
+ .variant-softBlueCard .placeholder-subtext {
66
+ margin-top: 6px;
67
+ font-size: var(--text-small, 0.875rem); /* 14px */
68
+ }
69
+
70
+ /* Variant: large gray card */
71
+ .variant-largeGrayCard .chart-content {
72
+ background: #f7f8fa;
73
+ border-radius: 10px;
74
+ display: flex;
75
+ align-items: center;
76
+ justify-content: center;
77
+ }
78
+ .variant-largeGrayCard .placeholder,
79
+ .variant-largeGrayCard .placeholder-node {
80
+ text-align: center;
81
+ }
82
+ .variant-largeGrayCard .placeholder-text {
83
+ font-weight: var(--font-medium, 500);
84
+ font-size: var(--text-paragraph, 1rem); /* 16px */
85
+ }
86
+ .variant-largeGrayCard .placeholder-subtext {
87
+ margin-top: 8px;
88
+ font-size: var(--text-small, 0.875rem); /* 14px */
89
+ }
90
+
91
+ /* Generic placeholder */
92
+ .placeholder {
93
+ display: flex;
94
+ flex-direction: column;
95
+ align-items: center;
96
+ gap: 6px;
97
+ }
98
+ .placeholder-icon {
99
+ display: flex;
100
+ align-items: center;
101
+ justify-content: center;
102
+ }
103
+ .placeholder-text {
104
+ line-height: 1.1;
105
+ }
106
+ .placeholder-subtext {
107
+ opacity: 0.8;
108
+ }
109
+
110
+ .placeholder-node {
111
+ width: 100%;
112
+ height: 100%;
113
+ display: flex;
114
+ align-items: center;
115
+ justify-content: center;
116
+ }
@@ -0,0 +1,159 @@
1
+ import React from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import ChartContainer from './ChartContainer';
4
+ import { ArrowUp, Activity } from 'lucide-react';
5
+
6
+ const meta: Meta<typeof ChartContainer> = {
7
+ title: 'Components/ChartContainer',
8
+ component: ChartContainer,
9
+ tags: ['autodocs'],
10
+ argTypes: {
11
+ width: { control: 'text', description: 'Width (string or number). Ex: 400 or "100%"' },
12
+ height: { control: 'text', description: 'Height (string or number). Ex: 300 or "50vh"' },
13
+ colors: {
14
+ control: 'object',
15
+ description: 'Colors for text, background, and content background',
16
+ },
17
+ titles: { control: 'object' },
18
+ placeholder: { control: 'object' },
19
+ padding: { control: 'text' },
20
+ variant: { control: { type: 'select', options: ['default', 'softBlueCard', 'largeGrayCard'] } },
21
+ shadow: { control: { type: 'select', options: ['none', 'soft', 'strong'] } },
22
+ showBorder: { control: 'boolean' },
23
+ },
24
+ };
25
+
26
+ export default meta;
27
+ type Story = StoryObj<typeof ChartContainer>;
28
+
29
+ export const Default: Story = {
30
+ args: {
31
+ width: 420,
32
+ height: 300,
33
+ colors: { text: '#0b1220', background: '#ffffff', contentBackground: '#efeff0' },
34
+ titles: { left: 'Sales', right: 'Today' },
35
+ placeholder: { text: 'Loading chart', subtext: 'No data yet', icon: 'ArrowUp', iconSize: 28 },
36
+ padding: '1rem',
37
+ variant: 'default',
38
+ shadow: 'soft',
39
+ showBorder: false,
40
+ },
41
+ };
42
+
43
+ export const SoftBlueImageLike: Story = {
44
+ args: {
45
+ width: 360,
46
+ height: 360,
47
+ colors: { text: '#0b1220', background: '#ffffff', contentBackground: undefined },
48
+ titles: { left: 'Tension 03.08', right: 'Mis à jour: 17:24' },
49
+ // structured placeholder that produces the blue-card look
50
+ placeholder: {
51
+ icon: 'ArrowUp',
52
+ text: 'Données historiques',
53
+ subtext: null,
54
+ iconSize: 32,
55
+ },
56
+ padding: 16,
57
+ variant: 'softBlueCard',
58
+ shadow: 'soft',
59
+ showBorder: false,
60
+ },
61
+ };
62
+
63
+ export const LargeGrayImageLike: Story = {
64
+ args: {
65
+ width: '100%',
66
+ height: 520,
67
+ colors: { text: '#0b1220', background: '#ffffff', contentBackground: undefined },
68
+ titles: { left: 'Admissions 18.07', right: '' },
69
+ placeholder: {
70
+ icon: 'Activity',
71
+ text: 'Graphique temporel',
72
+ subtext: 'Visualisation des données sur 24h',
73
+ iconSize: 32,
74
+ },
75
+ padding: '1.5rem',
76
+ variant: 'largeGrayCard',
77
+ shadow: 'strong',
78
+ showBorder: true,
79
+ },
80
+ };
81
+
82
+ export const NodePlaceholder: Story = {
83
+ args: {
84
+ width: 380,
85
+ height: 300,
86
+ colors: { text: '#0b1220', background: '#fff', contentBackground: undefined },
87
+ titles: { left: 'Custom', right: '' },
88
+ // pure React node as placeholder (full control)
89
+ placeholder: (
90
+ <div style={{ padding: 18, display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
91
+ <ArrowUp size={28} />
92
+ <div style={{ marginTop: 8, fontWeight: 600 }}>Custom placeholder</div>
93
+ <div style={{ marginTop: 6, fontSize: 13, color: 'rgba(11,20,34,0.6)' }}>
94
+ Spinner, buttons, or anything
95
+ </div>
96
+ </div>
97
+ ),
98
+ padding: 16,
99
+ variant: 'default',
100
+ shadow: 'soft',
101
+ showBorder: false,
102
+ },
103
+ };
104
+
105
+ export const WithChildren: Story = {
106
+ args: {
107
+ width: 420,
108
+ height: 300,
109
+ colors: { text: '#041022', background: '#ffffff', contentBackground: undefined },
110
+ titles: { left: 'Embedded', right: 'Sample' },
111
+ padding: 12,
112
+ variant: 'default',
113
+ shadow: 'soft',
114
+ showBorder: false,
115
+ },
116
+ render: (args) => (
117
+ <ChartContainer {...args}>
118
+ {/* Remplace par ton vrai composant chart (Apex/Chart.js) */}
119
+ <div
120
+ style={{
121
+ width: '100%',
122
+ height: '100%',
123
+ display: 'flex',
124
+ alignItems: 'center',
125
+ justifyContent: 'center',
126
+ }}
127
+ >
128
+ <div style={{ textAlign: 'center' }}>
129
+ <div style={{ fontSize: 14, fontWeight: 600 }}>Mock Chart</div>
130
+ <div style={{ marginTop: 8 }}>Replace with Apex/Chart.js/other</div>
131
+ </div>
132
+ </div>
133
+ </ChartContainer>
134
+ ),
135
+ };
136
+
137
+ export const ProgrammaticIconExample: Story = {
138
+ args: {
139
+ width: 360,
140
+ height: 300,
141
+ colors: { text: '#111827', background: '#fff', contentBackground: undefined },
142
+ titles: { left: 'Prog Icon', right: '' },
143
+ placeholder: {
144
+ // here we show that you can compose the text + icon as structured text (or pass node)
145
+ text: (
146
+ <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
147
+ <ArrowUp size={18} />
148
+ <span>Programmatic icon</span>
149
+ </div>
150
+ ),
151
+ subtext: 'Composed placeholder text with icon',
152
+ iconSize: 18,
153
+ },
154
+ padding: 14,
155
+ variant: 'default',
156
+ shadow: 'soft',
157
+ showBorder: false,
158
+ },
159
+ };
@@ -0,0 +1,155 @@
1
+ // ChartContainer.tsx
2
+ import React, { type CSSProperties, type ReactNode } from 'react';
3
+ import * as Icons from 'lucide-react';
4
+ import type { LucideProps } from 'lucide-react';
5
+ import './ChartContainer.css';
6
+
7
+ export interface StructuredPlaceholder {
8
+ text?: ReactNode;
9
+ subtext?: ReactNode;
10
+ icon?: string;
11
+ iconSize?: number | string;
12
+ iconColor?: string;
13
+ }
14
+
15
+ export type Placeholder = ReactNode | StructuredPlaceholder;
16
+
17
+ export interface ChartContainerProps {
18
+ width?: number | string;
19
+ height?: number | string;
20
+ colors?: { text?: string; background?: string; contentBackground?: string };
21
+ titles?: { left?: ReactNode; right?: ReactNode };
22
+ placeholder?: Placeholder;
23
+ style?: CSSProperties;
24
+ className?: string;
25
+ children?: ReactNode;
26
+ padding?: number | string;
27
+
28
+ variant?: 'default' | 'softBlueCard' | 'largeGrayCard';
29
+ shadow?: 'none' | 'soft' | 'strong';
30
+ showBorder?: boolean;
31
+ }
32
+
33
+ export const ChartContainer: React.FC<ChartContainerProps> = ({
34
+ width,
35
+ height,
36
+ colors = { text: '#0b1220', background: '#fff', contentBackground: '#efeff0' },
37
+ titles = {},
38
+ placeholder = 'Loading Chart',
39
+ style,
40
+ className = '',
41
+ children,
42
+ padding = '1rem',
43
+ variant = 'default',
44
+ shadow = 'soft',
45
+ showBorder = false,
46
+ }) => {
47
+ const widthDimension = width ? (typeof width === 'number' ? `${width}px` : width) : undefined;
48
+ const heightDimension = height
49
+ ? typeof height === 'number'
50
+ ? `${height}px`
51
+ : height
52
+ : undefined;
53
+
54
+ // Detect structured placeholder
55
+ const isStructuredPlaceholder =
56
+ placeholder &&
57
+ typeof placeholder === 'object' &&
58
+ !React.isValidElement(placeholder) &&
59
+ ('text' in (placeholder as any) ||
60
+ 'subtext' in (placeholder as any) ||
61
+ 'icon' in (placeholder as any) ||
62
+ 'background' in (placeholder as any) ||
63
+ 'iconSize' in (placeholder as any));
64
+
65
+ const structured = isStructuredPlaceholder ? (placeholder as StructuredPlaceholder) : undefined;
66
+
67
+ const LucideIcon = structured?.icon
68
+ ? (Icons[structured.icon as keyof typeof Icons] as React.ComponentType<LucideProps> | undefined)
69
+ : undefined;
70
+
71
+ const defaultIconSize = 28;
72
+ const resolvedIconSize = structured?.iconSize ?? defaultIconSize;
73
+
74
+ const containerClass = [
75
+ 'chart-container',
76
+ `variant-${variant}`,
77
+ shadow !== 'none' ? `shadow-${shadow}` : '',
78
+ showBorder ? 'with-border' : '',
79
+ className,
80
+ ]
81
+ .filter(Boolean)
82
+ .join(' ');
83
+
84
+ const contentBg = colors.contentBackground ?? undefined;
85
+
86
+ // build padding value for root
87
+ const resolvedPadding = typeof padding === 'number' ? `${padding}px` : padding;
88
+
89
+ return (
90
+ <div
91
+ className={containerClass}
92
+ style={{
93
+ width: widthDimension,
94
+ height: heightDimension,
95
+ color: colors.text,
96
+ background: colors.background,
97
+ display: 'flex',
98
+ flexDirection: 'column',
99
+ boxSizing: 'border-box',
100
+ padding: resolvedPadding,
101
+ ...style,
102
+ }}
103
+ >
104
+ {/* header n'a plus besoin d'appliquer la prop padding */}
105
+ <div className='chart-header'>
106
+ <div className='chart-title-left'>{titles.left}</div>
107
+ <div className='chart-title-right'>{titles.right}</div>
108
+ </div>
109
+ <br />
110
+ <div
111
+ className='chart-content'
112
+ style={{
113
+ flex: 1,
114
+ display: 'flex',
115
+ flexDirection: 'column',
116
+ alignItems: 'center',
117
+ justifyContent: 'center',
118
+ background: contentBg,
119
+ // pas de padding spécifique ici — le padding global de la racine gère l'espace
120
+ }}
121
+ >
122
+ {children ? (
123
+ children
124
+ ) : isStructuredPlaceholder && structured ? (
125
+ <div className='placeholder' role='status' aria-live='polite'>
126
+ {LucideIcon && (
127
+ <div
128
+ className='placeholder-icon'
129
+ style={{ width: resolvedIconSize, height: resolvedIconSize }}
130
+ >
131
+ <LucideIcon
132
+ color={structured.iconColor ?? 'currentColor'}
133
+ size={
134
+ typeof resolvedIconSize === 'number'
135
+ ? resolvedIconSize
136
+ : parseInt(String(resolvedIconSize), 10) || defaultIconSize
137
+ }
138
+ />
139
+ </div>
140
+ )}
141
+
142
+ {structured.text && <div className='placeholder-text'>{structured.text}</div>}
143
+ {structured.subtext && <div className='placeholder-subtext'>{structured.subtext}</div>}
144
+ </div>
145
+ ) : (
146
+ <div className='placeholder-node' role='status' aria-live='polite'>
147
+ {placeholder as ReactNode}
148
+ </div>
149
+ )}
150
+ </div>
151
+ </div>
152
+ );
153
+ };
154
+
155
+ export default ChartContainer;
@@ -0,0 +1 @@
1
+ export * from './ChartContainer';
@@ -0,0 +1,65 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import Area from './AreaChartAdmission';
3
+ import rawAdmissionData from './AreaChartAdmission.json';
4
+
5
+ // Typage du JSON
6
+ type AdmissionData = {
7
+ categories: string[];
8
+ series: { name: string; data: number[] }[];
9
+ };
10
+
11
+ const admissionData = rawAdmissionData as AdmissionData;
12
+
13
+ const meta: Meta<typeof Area> = {
14
+ title: 'Charts/AreaChartAdmission',
15
+ component: Area,
16
+ args: {
17
+ categories: admissionData.categories,
18
+ series: admissionData.series,
19
+ height: 360,
20
+ title: 'Admissions',
21
+ },
22
+ };
23
+
24
+ export default meta;
25
+
26
+ type Story = StoryObj<typeof Area>;
27
+
28
+ // Version par défaut (grand écran / desktop)
29
+ export const Desktop: Story = {
30
+ parameters: {
31
+ viewport: {
32
+ defaultViewport: 'responsive', // Storybook ajuste automatiquement
33
+ },
34
+ },
35
+ };
36
+
37
+ // Version tablette
38
+ export const Tablet: Story = {
39
+ args: { height: 300 },
40
+ parameters: {
41
+ viewport: {
42
+ defaultViewport: 'ipad',
43
+ },
44
+ },
45
+ };
46
+
47
+ // Version mobile portrait
48
+ export const MobilePortrait: Story = {
49
+ args: { height: 250 },
50
+ parameters: {
51
+ viewport: {
52
+ defaultViewport: 'iphone6',
53
+ },
54
+ },
55
+ };
56
+
57
+ // Version mobile paysage
58
+ export const MobileLandscape: Story = {
59
+ args: { height: 200 },
60
+ parameters: {
61
+ viewport: {
62
+ defaultViewport: 'iphone6p', // iPhone 6 Plus (paysage)
63
+ },
64
+ },
65
+ };
@@ -0,0 +1,89 @@
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;
@@ -0,0 +1,48 @@
1
+ {
2
+ "categories": [
3
+ "feb. 21",
4
+ "mr. 2",
5
+ "mr. 11",
6
+ "mr. 20",
7
+ "mr. 29",
8
+ "apr. 7",
9
+ "apr. 16",
10
+ "apr. 25",
11
+ "mai. 4",
12
+ "mai. 13",
13
+ "mai. 22",
14
+ "mai. 31",
15
+ "jun. 9",
16
+ "jun. 18",
17
+ "jun. 27",
18
+ "jul. 6",
19
+ "jul. 15",
20
+ "jul. 24",
21
+ "aug. 2",
22
+ "aug. 11"
23
+ ],
24
+ "series": [
25
+ {
26
+ "name": "0h-6h",
27
+ "data": [12, 14, 13, 11, 10, 12, 14, 16, 15, 17, 16, 15, 17, 18, 20, 22, 20, 19, 21, 23]
28
+ },
29
+ {
30
+ "name": "6h-12h",
31
+ "data": [60, 58, 55, 52, 50, 56, 58, 60, 62, 63, 64, 62, 66, 68, 67, 64, 66, 65, 63, 61]
32
+ },
33
+ {
34
+ "name": "12h-18h",
35
+ "data": [
36
+ 120, 135, 130, 125, 131, 140, 135, 138, 132, 130, 133, 132, 135, 140, 142, 130, 135, 140,
37
+ 138, 144
38
+ ]
39
+ },
40
+ {
41
+ "name": "18h-0h",
42
+ "data": [
43
+ 110, 120, 118, 115, 120, 125, 121, 128, 135, 140, 138, 140, 145, 150, 155, 152, 148, 142,
44
+ 138, 136
45
+ ]
46
+ }
47
+ ]
48
+ }