@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.
- package/.prettierignore +4 -0
- package/.prettierrc +9 -0
- package/.storybook/main.ts +17 -0
- package/.storybook/preview.ts +21 -0
- package/.storybook/vitest.setup.ts +7 -0
- package/README.md +69 -0
- package/chart.ts +1 -0
- package/eslint.config.js +40 -0
- package/index.html +13 -0
- package/index.ts +33 -0
- package/package.json +63 -0
- package/public/vite.svg +1 -0
- package/src/App.css +42 -0
- package/src/App.tsx +12 -0
- package/src/assets/accessibility.png +0 -0
- package/src/assets/accessibility.svg +1 -0
- package/src/assets/addon-library.png +0 -0
- package/src/assets/assets.png +0 -0
- package/src/assets/avif-test-image.avif +0 -0
- package/src/assets/context.png +0 -0
- package/src/assets/discord.svg +1 -0
- package/src/assets/docs.png +0 -0
- package/src/assets/figma-plugin.png +0 -0
- package/src/assets/github.svg +1 -0
- package/src/assets/react.svg +1 -0
- package/src/assets/share.png +0 -0
- package/src/assets/styling.png +0 -0
- package/src/assets/testing.png +0 -0
- package/src/assets/theming.png +0 -0
- package/src/assets/tutorials.svg +1 -0
- package/src/assets/youtube.svg +1 -0
- package/src/components/AddItemModal/AddItemModal.module.css +72 -0
- package/src/components/AddItemModal/AddItemModal.tsx +82 -0
- package/src/components/AddItemModal/index.ts +1 -0
- package/src/components/Alert/Alert.css +54 -0
- package/src/components/Alert/Alert.stories.tsx +82 -0
- package/src/components/Alert/Alert.tsx +85 -0
- package/src/components/Alert/AlertContext.tsx +200 -0
- package/src/components/Alert/AlertModels.ts +34 -0
- package/src/components/Alert/index.ts +3 -0
- package/src/components/AnnouncementPanel/FlexRowContainer.css +17 -0
- package/src/components/AnnouncementPanel/FlexRowContainer.stories.tsx +329 -0
- package/src/components/AnnouncementPanel/FlexRowContainer.tsx +24 -0
- package/src/components/AnnouncementPanel/ListBox/CounterListBox.css +56 -0
- package/src/components/AnnouncementPanel/ListBox/CounterListBox.stories.tsx +292 -0
- package/src/components/AnnouncementPanel/ListBox/CounterListBox.tsx +106 -0
- package/src/components/AnnouncementPanel/ListBox/SimpleListBox.css +57 -0
- package/src/components/AnnouncementPanel/ListBox/SimpleListBox.stories.tsx +189 -0
- package/src/components/AnnouncementPanel/ListBox/SimpleListBox.tsx +138 -0
- package/src/components/AnnouncementPanel/ListBox/TrendListBox.css +61 -0
- package/src/components/AnnouncementPanel/ListBox/TrendListBox.stories.tsx +257 -0
- package/src/components/AnnouncementPanel/ListBox/TrendListBox.tsx +90 -0
- package/src/components/AnnouncementPanel/ListBox/index.ts +3 -0
- package/src/components/AnnouncementPanel/ListContentContainer.css +23 -0
- package/src/components/AnnouncementPanel/ListContentContainer.stories.tsx +212 -0
- package/src/components/AnnouncementPanel/ListContentContainer.tsx +33 -0
- package/src/components/AnnouncementPanel/index.ts +3 -0
- package/src/components/BandChart/index.tsx +282 -0
- package/src/components/Button/Button.module.css +165 -0
- package/src/components/Button/Button.stories.ts +132 -0
- package/src/components/Button/Button.tsx +55 -0
- package/src/components/Button/button.css +29 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/ChartContainer/ChartContainer.css +116 -0
- package/src/components/ChartContainer/ChartContainer.stories.tsx +159 -0
- package/src/components/ChartContainer/ChartContainer.tsx +155 -0
- package/src/components/ChartContainer/index.ts +1 -0
- package/src/components/Charts/area-chart-admission/AreaChartAdmission.stories.tsx +65 -0
- package/src/components/Charts/area-chart-admission/AreaChartAdmission.tsx +89 -0
- package/src/components/Charts/area-chart-admission/content.json +48 -0
- package/src/components/Charts/area-chart-hospitalisation/AreaChartHospitalisation.stories.tsx +141 -0
- package/src/components/Charts/area-chart-hospitalisation/AreaChartHospitalisation.tsx +262 -0
- package/src/components/Charts/area-chart-hospitalisation/content.json +55 -0
- package/src/components/Charts/bar-chart/BarChart.stories.tsx +50 -0
- package/src/components/Charts/bar-chart/BarChart.tsx +132 -0
- package/src/components/Charts/bar-chart/content.json +15 -0
- package/src/components/Charts/boxplot-chart/BoxPlotChart.stories.tsx +63 -0
- package/src/components/Charts/boxplot-chart/BoxPlotChart.tsx +114 -0
- package/src/components/Charts/boxplot-chart/boxUtils.ts +22 -0
- package/src/components/Charts/boxplot-chart/content.json +11 -0
- package/src/components/Charts/mixed-chart/MixedChart.stories.tsx +83 -0
- package/src/components/Charts/mixed-chart/MixedChart.tsx +625 -0
- package/src/components/Charts/mixed-chart/content.json +34 -0
- package/src/components/Charts/sankey-adaptation/sankey.tsx +70 -0
- package/src/components/Charts/sankey-chart/SankeyChart.stories.tsx +69 -0
- package/src/components/Charts/sankey-chart/SankeyChart.tsx +155 -0
- package/src/components/Charts/sankey-chart/content.json +15 -0
- package/src/components/Charts/stacked-column/StackedColumn.stories.tsx +72 -0
- package/src/components/Charts/stacked-column/StackedColumn.tsx +406 -0
- package/src/components/Charts/stacked-column/content.json +37 -0
- package/src/components/Charts/stacked-column-one-hundred-percent/StackedColumnOneHundredPercent.stories.tsx +43 -0
- package/src/components/Charts/stacked-column-one-hundred-percent/StackedColumnOneHundredPercent.tsx +75 -0
- package/src/components/Charts/stacked-column-one-hundred-percent/content.json +6 -0
- package/src/components/CircularProgress/CircularProgress.css +79 -0
- package/src/components/CircularProgress/CircularProgress.stories.tsx +251 -0
- package/src/components/CircularProgress/CircularProgress.tsx +101 -0
- package/src/components/CircularProgress/index.ts +2 -0
- package/src/components/Configure.mdx +369 -0
- package/src/components/DayStatCard/DayStatCard.css +50 -0
- package/src/components/DayStatCard/DayStatCard.stories.tsx +273 -0
- package/src/components/DayStatCard/DayStatCard.tsx +69 -0
- package/src/components/DayStatCard/index.ts +2 -0
- package/src/components/DraggableSwitcher/DraggableSwitcherButton.tsx +58 -0
- package/src/components/DraggableSwitcher/context/useDraggableSwitcher.tsx +45 -0
- package/src/components/DraggableSwitcher/index.ts +2 -0
- package/src/components/DropdownMenu/DropdownMenu.css +100 -0
- package/src/components/DropdownMenu/DropdownMenu.stories.tsx +174 -0
- package/src/components/DropdownMenu/DropdownMenu.tsx +106 -0
- package/src/components/DropdownMenu/index.ts +1 -0
- package/src/components/DynamicForm/DynamicFom.stories.ts +773 -0
- package/src/components/DynamicForm/DynamicForm.module.css +468 -0
- package/src/components/DynamicForm/DynamicForm.tsx +224 -0
- package/src/components/DynamicForm/index.ts +3 -0
- package/src/components/DynamicForm/tools/form-metadata.ts +82 -0
- package/src/components/DynamicForm/tools/validation.ts +168 -0
- package/src/components/DynamicInput/DynamicInput.module.css +126 -0
- package/src/components/DynamicInput/DynamicInput.stories.ts +350 -0
- package/src/components/DynamicInput/DynamicInput.tsx +144 -0
- package/src/components/DynamicInput/index.ts +2 -0
- package/src/components/DynamicInput/input/CheckboxInput.tsx +41 -0
- package/src/components/DynamicInput/input/ColorInput.tsx +46 -0
- package/src/components/DynamicInput/input/DateInput.tsx +57 -0
- package/src/components/DynamicInput/input/FileInput.tsx +174 -0
- package/src/components/DynamicInput/input/InputWrapper.tsx +26 -0
- package/src/components/DynamicInput/input/RadioInput.tsx +46 -0
- package/src/components/DynamicInput/input/RangeInput.tsx +46 -0
- package/src/components/DynamicInput/input/SelectInput.tsx +75 -0
- package/src/components/DynamicInput/input/TextInput.tsx +101 -0
- package/src/components/DynamicInput/input/TextareaInput.tsx +47 -0
- package/src/components/DynamicInput/input/assets/ColorInput.module.css +48 -0
- package/src/components/DynamicInput/input/assets/DateInput.module.css +83 -0
- package/src/components/DynamicInput/input/assets/FileInput.module.css +133 -0
- package/src/components/DynamicInput/input/assets/RangeInput.module.css +169 -0
- package/src/components/DynamicInput/input/assets/SelectInput.module.css +95 -0
- package/src/components/DynamicInput/input/index.ts +10 -0
- package/src/components/DynamicTable/AdvancedFilters.tsx +196 -0
- package/src/components/DynamicTable/ColumnSorter.tsx +185 -0
- package/src/components/DynamicTable/Pagination.tsx +115 -0
- package/src/components/DynamicTable/TableBody.tsx +42 -0
- package/src/components/DynamicTable/TableCell.tsx +30 -0
- package/src/components/DynamicTable/TableHeader.tsx +34 -0
- package/src/components/DynamicTable/TableRow.tsx +56 -0
- package/src/components/DynamicTable/TableauDynamic.stories.ts +1014 -0
- package/src/components/DynamicTable/TableauDynamique.module.css +1287 -0
- package/src/components/DynamicTable/TableauDynamique.tsx +154 -0
- package/src/components/DynamicTable/filters/BooleanFilter.tsx +30 -0
- package/src/components/DynamicTable/filters/DateFilter.tsx +28 -0
- package/src/components/DynamicTable/filters/DateRangeFilter.tsx +51 -0
- package/src/components/DynamicTable/filters/FilterRenderer.tsx +117 -0
- package/src/components/DynamicTable/filters/MultiSelectFilter.tsx +59 -0
- package/src/components/DynamicTable/filters/NumberFilter.tsx +37 -0
- package/src/components/DynamicTable/filters/OperatorFilter.tsx +64 -0
- package/src/components/DynamicTable/filters/SelectFilter.tsx +69 -0
- package/src/components/DynamicTable/filters/TextFilter.tsx +39 -0
- package/src/components/DynamicTable/filters/index.ts +9 -0
- package/src/components/DynamicTable/hooks/index.ts +2 -0
- package/src/components/DynamicTable/hooks/useAsyncActions.ts +36 -0
- package/src/components/DynamicTable/hooks/useFilters.ts +142 -0
- package/src/components/DynamicTable/hooks/useTableData.ts +216 -0
- package/src/components/DynamicTable/index.ts +11 -0
- package/src/components/DynamicTable/tools/filterTypes.ts +118 -0
- package/src/components/DynamicTable/tools/index.ts +3 -0
- package/src/components/DynamicTable/tools/tableConfig.ts +96 -0
- package/src/components/DynamicTable/tools/tableTypes.ts +63 -0
- package/src/components/EntryControl/EntryControl.module.css +218 -0
- package/src/components/EntryControl/EntryControl.stories.tsx +71 -0
- package/src/components/EntryControl/EntryControl.tsx +117 -0
- package/src/components/EntryControl/index.ts +2 -0
- package/src/components/Grid/Grid.stories.tsx +94 -0
- package/src/components/Grid/Grid.tsx +214 -0
- package/src/components/Grid/grid.css +285 -0
- package/src/components/Grid/index.ts +2 -0
- package/src/components/Header/Header.stories.tsx +164 -0
- package/src/components/Header/Header.tsx +59 -0
- package/src/components/Header/header.css +31 -0
- package/src/components/Header/index.ts +1 -0
- package/src/components/IconText/IconText..stories.tsx +135 -0
- package/src/components/IconText/IconText.css +43 -0
- package/src/components/IconText/IconText.tsx +43 -0
- package/src/components/IconText/index.ts +1 -0
- package/src/components/LanguageSelector/LanguageSelector.css +31 -0
- package/src/components/LanguageSelector/LanguageSelector.stories.tsx +38 -0
- package/src/components/LanguageSelector/LanguageSelector.tsx +37 -0
- package/src/components/LanguageSelector/index.ts +1 -0
- package/src/components/Logo/Logo.css +89 -0
- package/src/components/Logo/Logo.stories.tsx +79 -0
- package/src/components/Logo/Logo.tsx +22 -0
- package/src/components/Logo/index.ts +2 -0
- package/src/components/MetricsPanel/MetricsItem.tsx +128 -0
- package/src/components/MetricsPanel/MetricsPanel.module.css +636 -0
- package/src/components/MetricsPanel/MetricsPanel.stories.tsx +692 -0
- package/src/components/MetricsPanel/MetricsPanel.tsx +282 -0
- package/src/components/MetricsPanel/PanelHeader.tsx +19 -0
- package/src/components/MetricsPanel/SummaryCard.tsx +61 -0
- package/src/components/MetricsPanel/index.ts +4 -0
- package/src/components/MetricsPanel/renderers/CompactRenderer.tsx +125 -0
- package/src/components/MetricsPanel/renderers/ImageCard.tsx +62 -0
- package/src/components/MetricsPanel/renderers/PertinenceCard.tsx +55 -0
- package/src/components/MetricsPanel/tools/MetricsPanelTypes.ts +62 -0
- package/src/components/MetricsPanel/tools/chooseDefaultRender.ts +50 -0
- package/src/components/MetricsPanel/tools/colorUtils.ts +39 -0
- package/src/components/MetricsPanel/tools/index.ts +2 -0
- package/src/components/ModuleHeader/ModuleHeader.css +37 -0
- package/src/components/ModuleHeader/ModuleHeader.stories.tsx +37 -0
- package/src/components/ModuleHeader/ModuleHeader.tsx +42 -0
- package/src/components/ModuleHeader/index.ts +1 -0
- package/src/components/ModuleSideBar/ModuleSideBar.css +227 -0
- package/src/components/ModuleSideBar/ModuleSideBar.stories.tsx +40 -0
- package/src/components/ModuleSideBar/ModuleSideBar.tsx +155 -0
- package/src/components/ModuleSideBar/index.ts +1 -0
- package/src/components/NavBar/NavBar.css +58 -0
- package/src/components/NavBar/NavBar.stories.tsx +169 -0
- package/src/components/NavBar/NavBar.tsx +100 -0
- package/src/components/NavBar/NavContext.tsx +30 -0
- package/src/components/NavBar/index.ts +2 -0
- package/src/components/NavItem/NavItem.css +29 -0
- package/src/components/NavItem/NavItem.tsx +58 -0
- package/src/components/NavItem/index.ts +1 -0
- package/src/components/Page/Dashboard.tsx +93 -0
- package/src/components/Page/Page.stories.ts +33 -0
- package/src/components/Page/Page.tsx +73 -0
- package/src/components/Page/page.css +81 -0
- package/src/components/PerformanceCard/PerformanceCard.module.css +232 -0
- package/src/components/PerformanceCard/PerformanceCard.stories.tsx +441 -0
- package/src/components/PerformanceCard/PerformanceCard.tsx +198 -0
- package/src/components/PerformanceCard/defaultHistogramRenderer.tsx +32 -0
- package/src/components/PerformanceCard/tools/types.ts +50 -0
- package/src/components/PerformanceCard/tools/usePerformanceCard.ts +93 -0
- package/src/components/PeriodRange/PeriodRange.module.css +158 -0
- package/src/components/PeriodRange/PeriodRange.stories.tsx +66 -0
- package/src/components/PeriodRange/PeriodRange.tsx +130 -0
- package/src/components/PeriodSelect/PeriodSelect.module.css +65 -0
- package/src/components/PeriodSelect/PeriodSelect.stories.tsx +40 -0
- package/src/components/PeriodSelect/PeriodSelect.tsx +42 -0
- package/src/components/PeriodSelect/index.ts +1 -0
- package/src/components/ScrollableHorizontale/ScrollableHorizontale.css +40 -0
- package/src/components/ScrollableHorizontale/ScrollableHorizontale.stories.tsx +133 -0
- package/src/components/ScrollableHorizontale/ScrollableHorizontale.tsx +29 -0
- package/src/components/ScrollableHorizontale/index.ts +1 -0
- package/src/components/SearchBar/SearchBar.css +40 -0
- package/src/components/SearchBar/SearchBar.stories.tsx +36 -0
- package/src/components/SearchBar/SearchBar.tsx +30 -0
- package/src/components/SearchBar/index.ts +1 -0
- package/src/components/SectionTitle/SectionTitle.css +21 -0
- package/src/components/SectionTitle/SectionTitle.stories.tsx +39 -0
- package/src/components/SectionTitle/SectionTitle.tsx +18 -0
- package/src/components/SideComponent/PatientEditor.tsx +64 -0
- package/src/components/SideComponent/SideComponent.css +179 -0
- package/src/components/SideComponent/SideComponent.stories.tsx +547 -0
- package/src/components/SideComponent/SideComponent.tsx +243 -0
- package/src/components/SideComponent/hooks/useBodyScrollLock.ts +15 -0
- package/src/components/SideComponent/index.ts +2 -0
- package/src/components/SideComponent/portal.ts +11 -0
- package/src/components/SubNavBar/SubNavBar.tsx +41 -0
- package/src/components/SubNavBar/index.ts +1 -0
- package/src/components/Switcher/Switcher.css +65 -0
- package/src/components/Switcher/Switcher.stories.tsx +153 -0
- package/src/components/Switcher/Switcher.tsx +83 -0
- package/src/components/Switcher/index.ts +1 -0
- package/src/components/Title/Title.stories.tsx +18 -0
- package/src/components/Title/Title.tsx +26 -0
- package/src/components/Title/index.ts +1 -0
- package/src/components/TranslationKey/TranslationKey.css +272 -0
- package/src/components/TranslationKey/TranslationKey.stories.tsx +50 -0
- package/src/components/TranslationKey/TranslationKey.tsx +245 -0
- package/src/components/TranslationKey/index.ts +1 -0
- package/src/components/TrendItem/TrendItem.css +36 -0
- package/src/components/TrendItem/TrendItem.stories.tsx +276 -0
- package/src/components/TrendItem/TrendItem.tsx +46 -0
- package/src/components/TrendItem/index.ts +1 -0
- package/src/components/TrendList/TrendList.css +16 -0
- package/src/components/TrendList/TrendList.stories.tsx +337 -0
- package/src/components/TrendList/TrendList.tsx +45 -0
- package/src/components/TrendList/index.ts +1 -0
- package/src/components/theme/ThemeSwitcherButton.tsx +64 -0
- package/src/components/theme/context/ThemeContext.tsx +61 -0
- package/src/components/theme/context/index.ts +2 -0
- package/src/components/theme/context/useThemeSwitcher.ts +18 -0
- package/src/components/theme/index.ts +1 -0
- package/src/index.css +68 -0
- package/src/main.tsx +10 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.app.json +27 -0
- package/tsconfig.json +4 -0
- package/tsconfig.node.json +25 -0
- package/vite.config.ts +43 -0
- package/vitest.shims.d.ts +1 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
.translation-card {
|
|
2
|
+
background: var(--color-card-background);
|
|
3
|
+
border-radius: 0.5rem;
|
|
4
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
border: 1px solid var(--color-border);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.card-header {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
padding: 1.5rem;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.card-title {
|
|
17
|
+
font-family: var(--font-primary);
|
|
18
|
+
font-weight: var(--font-medium);
|
|
19
|
+
font-size: var(--text-paragraph);
|
|
20
|
+
margin: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.header-actions {
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: 0.5rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.action-button {
|
|
30
|
+
font-family: var(--font-primary);
|
|
31
|
+
font-weight: var(--font-normal);
|
|
32
|
+
font-size: var(--text-small);
|
|
33
|
+
padding: 0.375rem;
|
|
34
|
+
color: #9ca3af;
|
|
35
|
+
background: none;
|
|
36
|
+
border: none;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
transition: color 0.2s;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.action-button:hover {
|
|
42
|
+
color: #6b7280;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.action-button.delete:hover {
|
|
46
|
+
color: #ef4444;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.action-icon {
|
|
50
|
+
width: 1rem;
|
|
51
|
+
height: 1rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.translations-container {
|
|
55
|
+
padding: 1.5rem;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.translation-row {
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
gap: 1rem;
|
|
62
|
+
padding: 0.75rem 1rem;
|
|
63
|
+
background: var(--color-content-background);
|
|
64
|
+
border-radius: 0.5rem;
|
|
65
|
+
margin-bottom: 0.5rem;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.language-code {
|
|
69
|
+
font-family: var(--font-primary);
|
|
70
|
+
font-weight: var(--font-medium);
|
|
71
|
+
font-size: var(--text-small);
|
|
72
|
+
width: 2rem;
|
|
73
|
+
text-transform: uppercase;
|
|
74
|
+
flex-shrink: 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.translation-content {
|
|
78
|
+
flex: 1;
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
gap: 0.5rem;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.translation-text {
|
|
85
|
+
font-family: var(--font-primary);
|
|
86
|
+
font-weight: var(--font-normal);
|
|
87
|
+
font-size: var(--text-small);
|
|
88
|
+
flex: 1;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.edit-input,
|
|
92
|
+
.translation-input,
|
|
93
|
+
.language-select {
|
|
94
|
+
font-family: var(--font-primary);
|
|
95
|
+
font-weight: var(--font-normal);
|
|
96
|
+
font-size: var(--text-small);
|
|
97
|
+
flex: 1;
|
|
98
|
+
padding: 0.5rem 0.75rem;
|
|
99
|
+
border-radius: 0.375rem;
|
|
100
|
+
outline: none;
|
|
101
|
+
background-color: var(--color-content-background);
|
|
102
|
+
color: var(--color-text);
|
|
103
|
+
}
|
|
104
|
+
.save-button,
|
|
105
|
+
.add-button,
|
|
106
|
+
.show-add-button {
|
|
107
|
+
font-family: var(--font-primary);
|
|
108
|
+
font-weight: var(--font-medium);
|
|
109
|
+
font-size: var(--text-xs);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.save-button {
|
|
113
|
+
padding: 0.375rem 0.75rem;
|
|
114
|
+
background-color: var(--color-primary);
|
|
115
|
+
color: var(--color-text-on-primary);
|
|
116
|
+
border: none;
|
|
117
|
+
border-radius: 0.25rem;
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
transition: background-color 0.2s;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.save-button:hover {
|
|
123
|
+
background-color: var(--color-primary);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.cancel-button,
|
|
127
|
+
.edit-button,
|
|
128
|
+
.delete-translation-button {
|
|
129
|
+
font-family: var(--font-primary);
|
|
130
|
+
font-weight: var(--font-normal);
|
|
131
|
+
font-size: var(--text-small);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.cancel-button {
|
|
135
|
+
padding: 0.375rem;
|
|
136
|
+
color: #9ca3af;
|
|
137
|
+
background: none;
|
|
138
|
+
border: none;
|
|
139
|
+
cursor: pointer;
|
|
140
|
+
transition: color 0.2s;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.cancel-button:hover,
|
|
144
|
+
.edit-button:hover {
|
|
145
|
+
color: #6b7280;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.edit-button {
|
|
149
|
+
padding: 0.25rem;
|
|
150
|
+
background: none;
|
|
151
|
+
border: none;
|
|
152
|
+
cursor: pointer;
|
|
153
|
+
transition: color 0.2s;
|
|
154
|
+
opacity: 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.translation-row:hover .edit-button {
|
|
158
|
+
opacity: 1;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.delete-translation-button {
|
|
162
|
+
padding: 0.25rem;
|
|
163
|
+
color: #9ca3af;
|
|
164
|
+
background: none;
|
|
165
|
+
border: none;
|
|
166
|
+
cursor: pointer;
|
|
167
|
+
transition: color 0.2s;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.delete-translation-button:hover {
|
|
171
|
+
color: #ef4444;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.add-language-row {
|
|
175
|
+
display: flex;
|
|
176
|
+
align-items: center;
|
|
177
|
+
gap: 1rem;
|
|
178
|
+
padding: 0.75rem 1rem;
|
|
179
|
+
border-radius: 0.5rem;
|
|
180
|
+
margin-bottom: 0.5rem;
|
|
181
|
+
flex-wrap: wrap;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.add-language-content {
|
|
185
|
+
flex: 1;
|
|
186
|
+
display: flex;
|
|
187
|
+
align-items: center;
|
|
188
|
+
gap: 0.5rem;
|
|
189
|
+
flex-wrap: wrap;
|
|
190
|
+
min-width: 0;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.language-select-container {
|
|
194
|
+
position: relative;
|
|
195
|
+
flex: 1;
|
|
196
|
+
min-width: 150px;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.select-chevron {
|
|
200
|
+
position: absolute;
|
|
201
|
+
right: 0.75rem;
|
|
202
|
+
top: 50%;
|
|
203
|
+
transform: translateY(-50%);
|
|
204
|
+
width: 1rem;
|
|
205
|
+
height: 1rem;
|
|
206
|
+
color: #9ca3af;
|
|
207
|
+
pointer-events: none;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.plus-icon {
|
|
211
|
+
font-family: var(--font-primary);
|
|
212
|
+
font-size: var(--text-lg);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
@media (max-width: 640px) {
|
|
216
|
+
.add-language-content {
|
|
217
|
+
flex-direction: column;
|
|
218
|
+
align-items: stretch;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.language-select-container,
|
|
222
|
+
.translation-input {
|
|
223
|
+
min-width: 100%;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
.show-add-button {
|
|
227
|
+
display: inline-flex;
|
|
228
|
+
align-items: center;
|
|
229
|
+
gap: 6px;
|
|
230
|
+
background: none;
|
|
231
|
+
border: none;
|
|
232
|
+
color: var(--color-primary);
|
|
233
|
+
font-size: 16px;
|
|
234
|
+
font-weight: 500;
|
|
235
|
+
cursor: pointer;
|
|
236
|
+
padding: 0;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.show-add-button:hover {
|
|
240
|
+
border-bottom: 1px solid var(--color-primary);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
input {
|
|
244
|
+
color: var(--color-text);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.collapse-button {
|
|
248
|
+
background: none;
|
|
249
|
+
border: none;
|
|
250
|
+
cursor: pointer;
|
|
251
|
+
padding: 0.25rem;
|
|
252
|
+
margin-right: 0.5rem;
|
|
253
|
+
display: flex;
|
|
254
|
+
align-items: center;
|
|
255
|
+
color: #9ca3af;
|
|
256
|
+
transition: color 0.2s;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.collapse-button:hover {
|
|
260
|
+
color: #6b7280;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.collapse-icon {
|
|
264
|
+
width: 1rem;
|
|
265
|
+
height: 1rem;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.header-left {
|
|
269
|
+
display: flex;
|
|
270
|
+
align-items: center;
|
|
271
|
+
gap: 0.5rem;
|
|
272
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { TranslationKey } from './TranslationKey';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof TranslationKey> = {
|
|
5
|
+
title: 'Components/TranslationKey',
|
|
6
|
+
component: TranslationKey,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof TranslationKey>;
|
|
12
|
+
|
|
13
|
+
const sampleTranslations = [
|
|
14
|
+
{ language: 'en', value: 'Hello' },
|
|
15
|
+
{ language: 'fr', value: 'Bonjour' },
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
const sampleLanguages = [
|
|
19
|
+
{ code: 'en', name: 'English' },
|
|
20
|
+
{ code: 'fr', name: 'Français' },
|
|
21
|
+
{ code: 'es', name: 'Español' },
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
export const Default: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
keyName: 'greeting',
|
|
27
|
+
translations: sampleTranslations,
|
|
28
|
+
availableLanguages: sampleLanguages,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const WithActions: Story = {
|
|
33
|
+
args: {
|
|
34
|
+
keyName: 'welcome_message',
|
|
35
|
+
translations: sampleTranslations,
|
|
36
|
+
availableLanguages: sampleLanguages,
|
|
37
|
+
onDeleteKey: (key) => alert(`Deleted key: ${key}`),
|
|
38
|
+
onEditTranslation: (key, lang, value) => alert(`Edited ${lang} in ${key}: ${value}`),
|
|
39
|
+
onDeleteTranslation: (key, lang) => alert(`Deleted translation ${lang} in ${key}`),
|
|
40
|
+
onAddTranslation: (key, lang, value) => alert(`Added ${lang} in ${key}: ${value}`),
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const EmptyTranslations: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
keyName: 'new_key',
|
|
47
|
+
translations: [],
|
|
48
|
+
availableLanguages: sampleLanguages,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Edit3, Trash2, X, ChevronDown, ChevronRight } from 'lucide-react';
|
|
3
|
+
import './TranslationKey.css';
|
|
4
|
+
import { AddItemModal } from '../AddItemModal/AddItemModal';
|
|
5
|
+
|
|
6
|
+
export interface Translation {
|
|
7
|
+
language: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface TranslationKeyProps {
|
|
12
|
+
keyName: string;
|
|
13
|
+
translations: Translation[];
|
|
14
|
+
availableLanguages: { code: string; name: string }[];
|
|
15
|
+
onDeleteKey?: (keyName: string) => void;
|
|
16
|
+
onEditKey?: (oldKey: string, newKey: string) => void; // <- nouvelle prop
|
|
17
|
+
onEditTranslation?: (keyName: string, language: string, newValue: string) => void;
|
|
18
|
+
onDeleteTranslation?: (keyName: string, language: string) => void;
|
|
19
|
+
onAddTranslation?: (keyName: string, language: string, value: string) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const TranslationKey: React.FC<TranslationKeyProps> = ({
|
|
23
|
+
keyName,
|
|
24
|
+
translations,
|
|
25
|
+
availableLanguages,
|
|
26
|
+
onDeleteKey,
|
|
27
|
+
onEditKey,
|
|
28
|
+
onEditTranslation,
|
|
29
|
+
onDeleteTranslation,
|
|
30
|
+
onAddTranslation,
|
|
31
|
+
}) => {
|
|
32
|
+
const [showAddLanguage, setShowAddLanguage] = useState(false);
|
|
33
|
+
const [selectedLanguage, setSelectedLanguage] = useState('');
|
|
34
|
+
const [editingTranslation, setEditingTranslation] = useState<string | null>(null);
|
|
35
|
+
const [editValue, setEditValue] = useState('');
|
|
36
|
+
const [newTranslationValue, setNewTranslationValue] = useState('');
|
|
37
|
+
|
|
38
|
+
// état pour le modal de renommage de la clé
|
|
39
|
+
const [isRenameModalOpen, setIsRenameModalOpen] = useState(false);
|
|
40
|
+
|
|
41
|
+
// état pour replier/déplier
|
|
42
|
+
const [isCollapsed, setIsCollapsed] = useState(false);
|
|
43
|
+
|
|
44
|
+
const usedLanguages = translations.map((t) => t.language);
|
|
45
|
+
const availableToAdd = availableLanguages.filter((lang) => !usedLanguages.includes(lang.code));
|
|
46
|
+
|
|
47
|
+
const handleAddTranslation = () => {
|
|
48
|
+
if (selectedLanguage && newTranslationValue.trim()) {
|
|
49
|
+
onAddTranslation?.(keyName, selectedLanguage, newTranslationValue.trim());
|
|
50
|
+
setSelectedLanguage('');
|
|
51
|
+
setNewTranslationValue('');
|
|
52
|
+
setShowAddLanguage(false);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const handleEditStart = (language: string, currentValue: string) => {
|
|
57
|
+
setEditingTranslation(language);
|
|
58
|
+
setEditValue(currentValue);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const handleEditSave = (language: string) => {
|
|
62
|
+
onEditTranslation?.(keyName, language, editValue);
|
|
63
|
+
setEditingTranslation(null);
|
|
64
|
+
setEditValue('');
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const handleEditCancel = () => {
|
|
68
|
+
setEditingTranslation(null);
|
|
69
|
+
setEditValue('');
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const handleRenameSave = (values: Record<string, string | number>) => {
|
|
73
|
+
const newName = (values.name as string)?.trim();
|
|
74
|
+
if (!newName) return;
|
|
75
|
+
if (newName === keyName) {
|
|
76
|
+
setIsRenameModalOpen(false);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
onEditKey?.(keyName, newName);
|
|
80
|
+
setIsRenameModalOpen(false);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<div className='translation-card'>
|
|
85
|
+
{/* Header */}
|
|
86
|
+
<div className='card-header'>
|
|
87
|
+
<div className='header-left'>
|
|
88
|
+
{/* Toggle button aligné à gauche */}
|
|
89
|
+
<button
|
|
90
|
+
className='collapse-button'
|
|
91
|
+
onClick={() => setIsCollapsed(!isCollapsed)}
|
|
92
|
+
title={isCollapsed ? 'Déplier' : 'Replier'}
|
|
93
|
+
>
|
|
94
|
+
{isCollapsed ? (
|
|
95
|
+
<ChevronRight className='collapse-icon' />
|
|
96
|
+
) : (
|
|
97
|
+
<ChevronDown className='collapse-icon' />
|
|
98
|
+
)}
|
|
99
|
+
</button>
|
|
100
|
+
|
|
101
|
+
<h3 className='card-title'>{keyName}</h3>
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
<div className='header-actions'>
|
|
105
|
+
<button
|
|
106
|
+
className='action-button'
|
|
107
|
+
onClick={(e) => {
|
|
108
|
+
e.stopPropagation();
|
|
109
|
+
setIsRenameModalOpen(true);
|
|
110
|
+
}}
|
|
111
|
+
title='Renommer la clé'
|
|
112
|
+
>
|
|
113
|
+
<Edit3 className='action-icon' />
|
|
114
|
+
</button>
|
|
115
|
+
<button
|
|
116
|
+
onClick={(e) => {
|
|
117
|
+
e.stopPropagation();
|
|
118
|
+
onDeleteKey?.(keyName);
|
|
119
|
+
}}
|
|
120
|
+
className='action-button delete'
|
|
121
|
+
title='Supprimer la clé'
|
|
122
|
+
>
|
|
123
|
+
<Trash2 className='action-icon' />
|
|
124
|
+
</button>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
{/* Contenu (masqué si replié) */}
|
|
129
|
+
{!isCollapsed && (
|
|
130
|
+
<div className='translations-container'>
|
|
131
|
+
{translations.map((translation) => (
|
|
132
|
+
<div key={translation.language} className='translation-row'>
|
|
133
|
+
<div className='language-code'>{translation.language}</div>
|
|
134
|
+
<div className='translation-content'>
|
|
135
|
+
{editingTranslation === translation.language ? (
|
|
136
|
+
<>
|
|
137
|
+
<input
|
|
138
|
+
type='text'
|
|
139
|
+
value={editValue}
|
|
140
|
+
onChange={(e) => setEditValue(e.target.value)}
|
|
141
|
+
className='edit-input'
|
|
142
|
+
autoFocus
|
|
143
|
+
/>
|
|
144
|
+
<button
|
|
145
|
+
onClick={() => handleEditSave(translation.language)}
|
|
146
|
+
className='save-button'
|
|
147
|
+
>
|
|
148
|
+
Enregistrer
|
|
149
|
+
</button>
|
|
150
|
+
<button onClick={handleEditCancel} className='cancel-button'>
|
|
151
|
+
<X className='action-icon' />
|
|
152
|
+
</button>
|
|
153
|
+
</>
|
|
154
|
+
) : (
|
|
155
|
+
<>
|
|
156
|
+
<span className='translation-text'>{translation.value}</span>
|
|
157
|
+
<button
|
|
158
|
+
onClick={() => handleEditStart(translation.language, translation.value)}
|
|
159
|
+
className='edit-button'
|
|
160
|
+
title='Éditer la traduction'
|
|
161
|
+
>
|
|
162
|
+
<Edit3 className='action-icon' />
|
|
163
|
+
</button>
|
|
164
|
+
<button
|
|
165
|
+
onClick={() => onDeleteTranslation?.(keyName, translation.language)}
|
|
166
|
+
className='delete-translation-button'
|
|
167
|
+
title='Supprimer la traduction'
|
|
168
|
+
>
|
|
169
|
+
<X className='action-icon' />
|
|
170
|
+
</button>
|
|
171
|
+
</>
|
|
172
|
+
)}
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
))}
|
|
176
|
+
|
|
177
|
+
{/* Add language */}
|
|
178
|
+
{showAddLanguage ? (
|
|
179
|
+
<div className='add-language-row'>
|
|
180
|
+
<div className='language-code'></div>
|
|
181
|
+
<div className='add-language-content'>
|
|
182
|
+
<div className='language-select-container'>
|
|
183
|
+
<select
|
|
184
|
+
value={selectedLanguage}
|
|
185
|
+
onChange={(e) => setSelectedLanguage(e.target.value)}
|
|
186
|
+
className='language-select'
|
|
187
|
+
>
|
|
188
|
+
<option value=''>Sélectionnez la langue</option>
|
|
189
|
+
{availableToAdd.map((lang) => (
|
|
190
|
+
<option key={lang.code} value={lang.code}>
|
|
191
|
+
{lang.name}
|
|
192
|
+
</option>
|
|
193
|
+
))}
|
|
194
|
+
</select>
|
|
195
|
+
</div>
|
|
196
|
+
{selectedLanguage && (
|
|
197
|
+
<input
|
|
198
|
+
type='text'
|
|
199
|
+
value={newTranslationValue}
|
|
200
|
+
onChange={(e) => setNewTranslationValue(e.target.value)}
|
|
201
|
+
placeholder='Entrez la traduction...'
|
|
202
|
+
className='translation-input'
|
|
203
|
+
/>
|
|
204
|
+
)}
|
|
205
|
+
<button
|
|
206
|
+
onClick={handleAddTranslation}
|
|
207
|
+
disabled={!selectedLanguage || !newTranslationValue.trim()}
|
|
208
|
+
className='show-add-button'
|
|
209
|
+
>
|
|
210
|
+
<span className='plus-icon'>+</span>
|
|
211
|
+
Ajouter
|
|
212
|
+
</button>
|
|
213
|
+
<button
|
|
214
|
+
onClick={() => {
|
|
215
|
+
setShowAddLanguage(false);
|
|
216
|
+
setSelectedLanguage('');
|
|
217
|
+
setNewTranslationValue('');
|
|
218
|
+
}}
|
|
219
|
+
className='cancel-button'
|
|
220
|
+
>
|
|
221
|
+
<X className='action-icon' />
|
|
222
|
+
</button>
|
|
223
|
+
</div>
|
|
224
|
+
</div>
|
|
225
|
+
) : (
|
|
226
|
+
<button onClick={() => setShowAddLanguage(true)} className='show-add-button'>
|
|
227
|
+
<span className='plus-icon'>+</span>
|
|
228
|
+
Ajouter
|
|
229
|
+
</button>
|
|
230
|
+
)}
|
|
231
|
+
</div>
|
|
232
|
+
)}
|
|
233
|
+
|
|
234
|
+
{/* Modal pour renommer la clé */}
|
|
235
|
+
<AddItemModal
|
|
236
|
+
isOpen={isRenameModalOpen}
|
|
237
|
+
onClose={() => setIsRenameModalOpen(false)}
|
|
238
|
+
onSave={handleRenameSave}
|
|
239
|
+
title='Renommer la clé'
|
|
240
|
+
initialValues={{ name: keyName }}
|
|
241
|
+
fields={[{ name: 'name', label: 'Nom de la clé', placeholder: 'Nom de la clé' }]}
|
|
242
|
+
/>
|
|
243
|
+
</div>
|
|
244
|
+
);
|
|
245
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TranslationKey';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.trend-item {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: space-between;
|
|
4
|
+
align-items: center;
|
|
5
|
+
padding: 6px 12px;
|
|
6
|
+
border-radius: 8px;
|
|
7
|
+
min-height: 40px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.trend-item:last-child {
|
|
11
|
+
border-bottom: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.trend-texts {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.trend-title {
|
|
20
|
+
font-weight: var(--font-medium);
|
|
21
|
+
font-size: var(--text-paragraph);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.trend-subtitle {
|
|
25
|
+
font-weight: var(--font-normal);
|
|
26
|
+
font-size: var(--text-small);
|
|
27
|
+
color: gray;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.trend-right {
|
|
31
|
+
font-weight: var(--font-semibold);
|
|
32
|
+
font-size: var(--text-small);
|
|
33
|
+
}
|
|
34
|
+
.trend-right-right {
|
|
35
|
+
font-weight: var(--font-bold);
|
|
36
|
+
}
|