lerelais-front-library 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/skills/project-structure/SKILL.md +51 -0
- package/.cursor/skills/storybook-react/SKILL.md +60 -0
- package/.cursor/skills/testing-react/SKILL.md +52 -0
- package/README.md +93 -0
- package/index.html +18 -0
- package/package.json +34 -0
- package/src/App.css +49 -0
- package/src/App.tsx +366 -0
- package/src/assets/icons/alert-triangle.svg +7 -0
- package/src/assets/icons/arrow-right.svg +5 -0
- package/src/assets/icons/bell.svg +6 -0
- package/src/assets/icons/chevron-down.svg +5 -0
- package/src/assets/icons/chevron-right.svg +5 -0
- package/src/assets/icons/clock-muted.svg +10 -0
- package/src/assets/icons/clock.svg +11 -0
- package/src/assets/icons/close.svg +5 -0
- package/src/assets/icons/core-camera.svg +5 -0
- package/src/assets/icons/core-check-sm.svg +5 -0
- package/src/assets/icons/core-check-white.svg +5 -0
- package/src/assets/icons/core-check.svg +5 -0
- package/src/assets/icons/core-chevron.svg +5 -0
- package/src/assets/icons/core-dot.svg +3 -0
- package/src/assets/icons/core-lock-form.svg +5 -0
- package/src/assets/icons/core-lock.svg +5 -0
- package/src/assets/icons/core-map-pin.svg +5 -0
- package/src/assets/icons/core-package-lg.svg +5 -0
- package/src/assets/icons/core-package.svg +5 -0
- package/src/assets/icons/core-pin-info.svg +6 -0
- package/src/assets/icons/core-pin-value.svg +5 -0
- package/src/assets/icons/core-pin-white.svg +5 -0
- package/src/assets/icons/core-plus.svg +5 -0
- package/src/assets/icons/core-search-dark.svg +5 -0
- package/src/assets/icons/core-search.svg +5 -0
- package/src/assets/icons/core-store.svg +9 -0
- package/src/assets/icons/core-x.svg +5 -0
- package/src/assets/icons/heart.svg +5 -0
- package/src/assets/icons/logout.svg +7 -0
- package/src/assets/icons/map-pin.svg +5 -0
- package/src/assets/icons/package-read.svg +8 -0
- package/src/assets/icons/package-white.svg +8 -0
- package/src/assets/icons/package.svg +8 -0
- package/src/assets/icons/plus.svg +6 -0
- package/src/assets/icons/settings.svg +6 -0
- package/src/assets/icons/switch-off.svg +19 -0
- package/src/assets/icons/switch-on.svg +19 -0
- package/src/assets/icons/unread-dot.svg +3 -0
- package/src/assets/icons/upload-cloud.svg +5 -0
- package/src/assets/icons/user.svg +6 -0
- package/src/assets/icons.ts +41 -0
- package/src/components/Accordion/Accordion.module.css +34 -0
- package/src/components/Accordion/Accordion.test.tsx +20 -0
- package/src/components/Accordion/Accordion.tsx +38 -0
- package/src/components/Accordion/index.ts +1 -0
- package/src/components/ActionCard/ActionCard.module.css +50 -0
- package/src/components/ActionCard/ActionCard.test.tsx +15 -0
- package/src/components/ActionCard/ActionCard.tsx +33 -0
- package/src/components/ActionCard/index.ts +1 -0
- package/src/components/Alert/Alert.module.css +47 -0
- package/src/components/Alert/Alert.test.tsx +14 -0
- package/src/components/Alert/Alert.tsx +27 -0
- package/src/components/Alert/index.ts +1 -0
- package/src/components/Avatar/Avatar.module.css +37 -0
- package/src/components/Avatar/Avatar.test.tsx +9 -0
- package/src/components/Avatar/Avatar.tsx +18 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Badge/Badge.module.css +37 -0
- package/src/components/Badge/Badge.test.tsx +14 -0
- package/src/components/Badge/Badge.tsx +21 -0
- package/src/components/Badge/index.ts +1 -0
- package/src/components/BarChart/BarChart.module.css +57 -0
- package/src/components/BarChart/BarChart.test.tsx +18 -0
- package/src/components/BarChart/BarChart.tsx +47 -0
- package/src/components/BarChart/index.ts +1 -0
- package/src/components/BenefitsCard/BenefitsCard.module.css +44 -0
- package/src/components/BenefitsCard/BenefitsCard.test.tsx +10 -0
- package/src/components/BenefitsCard/BenefitsCard.tsx +33 -0
- package/src/components/BenefitsCard/index.ts +1 -0
- package/src/components/BottomNavItem/BottomNavItem.module.css +24 -0
- package/src/components/BottomNavItem/BottomNavItem.test.tsx +20 -0
- package/src/components/BottomNavItem/BottomNavItem.tsx +23 -0
- package/src/components/BottomNavItem/index.ts +1 -0
- package/src/components/Breadcrumb/Breadcrumb.module.css +31 -0
- package/src/components/Breadcrumb/Breadcrumb.test.tsx +29 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +36 -0
- package/src/components/Breadcrumb/index.ts +1 -0
- package/src/components/Button/Button.module.css +61 -0
- package/src/components/Button/Button.test.tsx +34 -0
- package/src/components/Button/Button.tsx +24 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.module.css +53 -0
- package/src/components/Checkbox/Checkbox.test.tsx +20 -0
- package/src/components/Checkbox/Checkbox.tsx +20 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/ConfirmModal/ConfirmModal.module.css +69 -0
- package/src/components/ConfirmModal/ConfirmModal.test.tsx +25 -0
- package/src/components/ConfirmModal/ConfirmModal.tsx +50 -0
- package/src/components/ConfirmModal/index.ts +1 -0
- package/src/components/CoreButton/CoreButton.module.css +71 -0
- package/src/components/CoreButton/CoreButton.test.tsx +24 -0
- package/src/components/CoreButton/CoreButton.tsx +27 -0
- package/src/components/CoreButton/index.ts +1 -0
- package/src/components/CoreField/CoreField.module.css +31 -0
- package/src/components/CoreField/CoreField.test.tsx +15 -0
- package/src/components/CoreField/CoreField.tsx +18 -0
- package/src/components/CoreField/index.ts +1 -0
- package/src/components/CoreSelect/CoreSelect.module.css +37 -0
- package/src/components/CoreSelect/CoreSelect.test.tsx +22 -0
- package/src/components/CoreSelect/CoreSelect.tsx +29 -0
- package/src/components/CoreSelect/index.ts +1 -0
- package/src/components/CoreTabs/CoreTabs.module.css +41 -0
- package/src/components/CoreTabs/CoreTabs.test.tsx +18 -0
- package/src/components/CoreTabs/CoreTabs.tsx +67 -0
- package/src/components/CoreTabs/index.ts +1 -0
- package/src/components/DashboardParcelRow/DashboardParcelRow.module.css +61 -0
- package/src/components/DashboardParcelRow/DashboardParcelRow.test.tsx +37 -0
- package/src/components/DashboardParcelRow/DashboardParcelRow.tsx +41 -0
- package/src/components/DashboardParcelRow/index.ts +1 -0
- package/src/components/DataFiltersToolbar/DataFiltersToolbar.module.css +29 -0
- package/src/components/DataFiltersToolbar/DataFiltersToolbar.test.tsx +15 -0
- package/src/components/DataFiltersToolbar/DataFiltersToolbar.tsx +22 -0
- package/src/components/DataFiltersToolbar/index.ts +1 -0
- package/src/components/DataSearchBar/DataSearchBar.module.css +28 -0
- package/src/components/DataSearchBar/DataSearchBar.test.tsx +15 -0
- package/src/components/DataSearchBar/DataSearchBar.tsx +15 -0
- package/src/components/DataSearchBar/index.ts +1 -0
- package/src/components/DataTable/DataTable.module.css +57 -0
- package/src/components/DataTable/DataTable.test.tsx +12 -0
- package/src/components/DataTable/DataTable.tsx +67 -0
- package/src/components/DataTable/index.ts +1 -0
- package/src/components/Divider/Divider.module.css +29 -0
- package/src/components/Divider/Divider.test.tsx +9 -0
- package/src/components/Divider/Divider.tsx +21 -0
- package/src/components/Divider/index.ts +1 -0
- package/src/components/DropdownMenu/DropdownMenu.module.css +45 -0
- package/src/components/DropdownMenu/DropdownMenu.test.tsx +21 -0
- package/src/components/DropdownMenu/DropdownMenu.tsx +45 -0
- package/src/components/DropdownMenu/index.ts +1 -0
- package/src/components/EmptyState/EmptyState.module.css +52 -0
- package/src/components/EmptyState/EmptyState.test.tsx +20 -0
- package/src/components/EmptyState/EmptyState.tsx +33 -0
- package/src/components/EmptyState/index.ts +1 -0
- package/src/components/FaqItem/FaqItem.module.css +47 -0
- package/src/components/FaqItem/FaqItem.test.tsx +14 -0
- package/src/components/FaqItem/FaqItem.tsx +28 -0
- package/src/components/FaqItem/index.ts +1 -0
- package/src/components/FavoriteRelayCard/FavoriteRelayCard.module.css +83 -0
- package/src/components/FavoriteRelayCard/FavoriteRelayCard.test.tsx +37 -0
- package/src/components/FavoriteRelayCard/FavoriteRelayCard.tsx +58 -0
- package/src/components/FavoriteRelayCard/index.ts +1 -0
- package/src/components/FeatureCard/FeatureCard.module.css +62 -0
- package/src/components/FeatureCard/FeatureCard.test.tsx +10 -0
- package/src/components/FeatureCard/FeatureCard.tsx +30 -0
- package/src/components/FeatureCard/index.ts +1 -0
- package/src/components/FileUpload/FileUpload.module.css +41 -0
- package/src/components/FileUpload/FileUpload.test.tsx +22 -0
- package/src/components/FileUpload/FileUpload.tsx +26 -0
- package/src/components/FileUpload/index.ts +1 -0
- package/src/components/FilterPill/FilterPill.module.css +18 -0
- package/src/components/FilterPill/FilterPill.test.tsx +19 -0
- package/src/components/FilterPill/FilterPill.tsx +20 -0
- package/src/components/FilterPill/index.ts +1 -0
- package/src/components/Footer/Footer.module.css +57 -0
- package/src/components/Footer/Footer.test.tsx +10 -0
- package/src/components/Footer/Footer.tsx +63 -0
- package/src/components/Footer/index.ts +1 -0
- package/src/components/Icon/Icon.tsx +20 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/InfoRow/InfoRow.module.css +33 -0
- package/src/components/InfoRow/InfoRow.test.tsx +9 -0
- package/src/components/InfoRow/InfoRow.tsx +21 -0
- package/src/components/InfoRow/index.ts +1 -0
- package/src/components/LinkButton/LinkButton.module.css +22 -0
- package/src/components/LinkButton/LinkButton.test.tsx +9 -0
- package/src/components/LinkButton/LinkButton.tsx +17 -0
- package/src/components/LinkButton/index.ts +1 -0
- package/src/components/LocationCard/LocationCard.module.css +61 -0
- package/src/components/LocationCard/LocationCard.test.tsx +9 -0
- package/src/components/LocationCard/LocationCard.tsx +27 -0
- package/src/components/LocationCard/index.ts +1 -0
- package/src/components/Logo/Logo.module.css +30 -0
- package/src/components/Logo/Logo.tsx +18 -0
- package/src/components/Logo/index.ts +1 -0
- package/src/components/MetricCard/MetricCard.module.css +27 -0
- package/src/components/MetricCard/MetricCard.test.tsx +10 -0
- package/src/components/MetricCard/MetricCard.tsx +19 -0
- package/src/components/MetricCard/index.ts +1 -0
- package/src/components/Navbar/Navbar.module.css +87 -0
- package/src/components/Navbar/Navbar.test.tsx +21 -0
- package/src/components/Navbar/Navbar.tsx +77 -0
- package/src/components/Navbar/index.ts +1 -0
- package/src/components/NotificationItem/NotificationItem.module.css +73 -0
- package/src/components/NotificationItem/NotificationItem.test.tsx +22 -0
- package/src/components/NotificationItem/NotificationItem.tsx +30 -0
- package/src/components/NotificationItem/index.ts +1 -0
- package/src/components/NotificationRow/NotificationRow.module.css +49 -0
- package/src/components/NotificationRow/NotificationRow.test.tsx +15 -0
- package/src/components/NotificationRow/NotificationRow.tsx +26 -0
- package/src/components/NotificationRow/index.ts +1 -0
- package/src/components/OutcomeModal/OutcomeModal.module.css +101 -0
- package/src/components/OutcomeModal/OutcomeModal.test.tsx +15 -0
- package/src/components/OutcomeModal/OutcomeModal.tsx +45 -0
- package/src/components/OutcomeModal/index.ts +1 -0
- package/src/components/Pagination/Pagination.module.css +27 -0
- package/src/components/Pagination/Pagination.test.tsx +25 -0
- package/src/components/Pagination/Pagination.tsx +41 -0
- package/src/components/Pagination/index.ts +1 -0
- package/src/components/ParcelCard/ParcelCard.module.css +34 -0
- package/src/components/ParcelCard/ParcelCard.test.tsx +17 -0
- package/src/components/ParcelCard/ParcelCard.tsx +21 -0
- package/src/components/ParcelCard/index.ts +1 -0
- package/src/components/ParcelRow/ParcelRow.module.css +25 -0
- package/src/components/ParcelRow/ParcelRow.test.tsx +18 -0
- package/src/components/ParcelRow/ParcelRow.tsx +31 -0
- package/src/components/ParcelRow/index.ts +1 -0
- package/src/components/ParcelTimeline/ParcelTimeline.module.css +68 -0
- package/src/components/ParcelTimeline/ParcelTimeline.test.tsx +17 -0
- package/src/components/ParcelTimeline/ParcelTimeline.tsx +33 -0
- package/src/components/ParcelTimeline/index.ts +1 -0
- package/src/components/PhotoUpload/PhotoUpload.module.css +39 -0
- package/src/components/PhotoUpload/PhotoUpload.test.tsx +16 -0
- package/src/components/PhotoUpload/PhotoUpload.tsx +29 -0
- package/src/components/PhotoUpload/index.ts +1 -0
- package/src/components/ProcessBadge/ProcessBadge.module.css +29 -0
- package/src/components/ProcessBadge/ProcessBadge.test.tsx +9 -0
- package/src/components/ProcessBadge/ProcessBadge.tsx +19 -0
- package/src/components/ProcessBadge/index.ts +1 -0
- package/src/components/ProgressBar/ProgressBar.module.css +56 -0
- package/src/components/ProgressBar/ProgressBar.test.tsx +18 -0
- package/src/components/ProgressBar/ProgressBar.tsx +33 -0
- package/src/components/ProgressBar/index.ts +1 -0
- package/src/components/QrScanner/QrScanner.module.css +50 -0
- package/src/components/QrScanner/QrScanner.test.tsx +20 -0
- package/src/components/QrScanner/QrScanner.tsx +27 -0
- package/src/components/QrScanner/index.ts +1 -0
- package/src/components/QuestionSearch/QuestionSearch.module.css +28 -0
- package/src/components/QuestionSearch/QuestionSearch.test.tsx +15 -0
- package/src/components/QuestionSearch/QuestionSearch.tsx +26 -0
- package/src/components/QuestionSearch/index.ts +1 -0
- package/src/components/QuickActionCard/QuickActionCard.module.css +31 -0
- package/src/components/QuickActionCard/QuickActionCard.test.tsx +20 -0
- package/src/components/QuickActionCard/QuickActionCard.tsx +22 -0
- package/src/components/QuickActionCard/index.ts +1 -0
- package/src/components/Radio/Radio.module.css +53 -0
- package/src/components/Radio/Radio.test.tsx +20 -0
- package/src/components/Radio/Radio.tsx +20 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/RelayCard/RelayCard.module.css +38 -0
- package/src/components/RelayCard/RelayCard.test.tsx +22 -0
- package/src/components/RelayCard/RelayCard.tsx +31 -0
- package/src/components/RelayCard/index.ts +1 -0
- package/src/components/RelayResultCard/RelayResultCard.module.css +82 -0
- package/src/components/RelayResultCard/RelayResultCard.test.tsx +10 -0
- package/src/components/RelayResultCard/RelayResultCard.tsx +34 -0
- package/src/components/RelayResultCard/index.ts +1 -0
- package/src/components/ResetPasswordCard/ResetPasswordCard.module.css +102 -0
- package/src/components/ResetPasswordCard/ResetPasswordCard.test.tsx +16 -0
- package/src/components/ResetPasswordCard/ResetPasswordCard.tsx +45 -0
- package/src/components/ResetPasswordCard/index.ts +1 -0
- package/src/components/SearchBar/SearchBar.module.css +33 -0
- package/src/components/SearchBar/SearchBar.test.tsx +19 -0
- package/src/components/SearchBar/SearchBar.tsx +18 -0
- package/src/components/SearchBar/index.ts +1 -0
- package/src/components/Select/Select.module.css +64 -0
- package/src/components/Select/Select.test.tsx +24 -0
- package/src/components/Select/Select.tsx +60 -0
- package/src/components/Select/index.ts +1 -0
- package/src/components/ShipmentStatus/ShipmentStatus.module.css +41 -0
- package/src/components/ShipmentStatus/ShipmentStatus.test.tsx +14 -0
- package/src/components/ShipmentStatus/ShipmentStatus.tsx +52 -0
- package/src/components/ShipmentStatus/index.ts +1 -0
- package/src/components/Sidebar/Sidebar.module.css +79 -0
- package/src/components/Sidebar/Sidebar.test.tsx +21 -0
- package/src/components/Sidebar/Sidebar.tsx +98 -0
- package/src/components/Sidebar/index.ts +1 -0
- package/src/components/SidebarNavItem/SidebarNavItem.module.css +21 -0
- package/src/components/SidebarNavItem/SidebarNavItem.test.tsx +20 -0
- package/src/components/SidebarNavItem/SidebarNavItem.tsx +22 -0
- package/src/components/SidebarNavItem/index.ts +1 -0
- package/src/components/Skeleton/Skeleton.module.css +22 -0
- package/src/components/Skeleton/Skeleton.test.tsx +9 -0
- package/src/components/Skeleton/Skeleton.tsx +13 -0
- package/src/components/Skeleton/index.ts +1 -0
- package/src/components/StatCard/StatCard.module.css +22 -0
- package/src/components/StatCard/StatCard.test.tsx +9 -0
- package/src/components/StatCard/StatCard.tsx +19 -0
- package/src/components/StatCard/index.ts +1 -0
- package/src/components/StatusSummary/StatusSummary.module.css +43 -0
- package/src/components/StatusSummary/StatusSummary.test.tsx +9 -0
- package/src/components/StatusSummary/StatusSummary.tsx +32 -0
- package/src/components/StatusSummary/index.ts +1 -0
- package/src/components/StepCard/StepCard.module.css +48 -0
- package/src/components/StepCard/StepCard.test.tsx +9 -0
- package/src/components/StepCard/StepCard.tsx +27 -0
- package/src/components/StepCard/index.ts +1 -0
- package/src/components/Stepper/Stepper.module.css +66 -0
- package/src/components/Stepper/Stepper.test.tsx +20 -0
- package/src/components/Stepper/Stepper.tsx +39 -0
- package/src/components/Stepper/index.ts +1 -0
- package/src/components/StepsList/StepsList.module.css +35 -0
- package/src/components/StepsList/StepsList.test.tsx +10 -0
- package/src/components/StepsList/StepsList.tsx +24 -0
- package/src/components/StepsList/index.ts +1 -0
- package/src/components/SuccessFeedback/SuccessFeedback.module.css +42 -0
- package/src/components/SuccessFeedback/SuccessFeedback.test.tsx +9 -0
- package/src/components/SuccessFeedback/SuccessFeedback.tsx +21 -0
- package/src/components/SuccessFeedback/index.ts +1 -0
- package/src/components/Switch/Switch.module.css +57 -0
- package/src/components/Switch/Switch.test.tsx +20 -0
- package/src/components/Switch/Switch.tsx +22 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/Tabs/Tabs.module.css +26 -0
- package/src/components/Tabs/Tabs.test.tsx +34 -0
- package/src/components/Tabs/Tabs.tsx +38 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/Tag/Tag.module.css +39 -0
- package/src/components/Tag/Tag.test.tsx +24 -0
- package/src/components/Tag/Tag.tsx +25 -0
- package/src/components/Tag/index.ts +1 -0
- package/src/components/TextField/TextField.module.css +55 -0
- package/src/components/TextField/TextField.test.tsx +24 -0
- package/src/components/TextField/TextField.tsx +37 -0
- package/src/components/TextField/index.ts +1 -0
- package/src/components/Toast/Toast.module.css +72 -0
- package/src/components/Toast/Toast.test.tsx +20 -0
- package/src/components/Toast/Toast.tsx +32 -0
- package/src/components/Toast/index.ts +1 -0
- package/src/components/Tooltip/Tooltip.module.css +37 -0
- package/src/components/Tooltip/Tooltip.test.tsx +22 -0
- package/src/components/Tooltip/Tooltip.tsx +20 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/TrackingBadge/TrackingBadge.module.css +10 -0
- package/src/components/TrackingBadge/TrackingBadge.test.tsx +9 -0
- package/src/components/TrackingBadge/TrackingBadge.tsx +9 -0
- package/src/components/TrackingBadge/index.ts +1 -0
- package/src/components/TrackingCard/TrackingCard.module.css +128 -0
- package/src/components/TrackingCard/TrackingCard.test.tsx +10 -0
- package/src/components/TrackingCard/TrackingCard.tsx +58 -0
- package/src/components/TrackingCard/index.ts +1 -0
- package/src/components/TrackingSearch/TrackingSearch.module.css +35 -0
- package/src/components/TrackingSearch/TrackingSearch.test.tsx +15 -0
- package/src/components/TrackingSearch/TrackingSearch.tsx +24 -0
- package/src/components/TrackingSearch/index.ts +1 -0
- package/src/components/ValueCard/ValueCard.module.css +38 -0
- package/src/components/ValueCard/ValueCard.test.tsx +9 -0
- package/src/components/ValueCard/ValueCard.tsx +24 -0
- package/src/components/ValueCard/index.ts +1 -0
- package/src/lib/cn.ts +3 -0
- package/src/main.tsx +10 -0
- package/src/styles/global.css +36 -0
- package/src/styles/tokens.css +61 -0
- package/src/test/setup.ts +9 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.app.json +25 -0
- package/tsconfig.app.tsbuildinfo +1 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +18 -0
- package/tsconfig.node.tsbuildinfo +1 -0
- package/vite.config.ts +12 -0
- package/vitest.config.ts +22 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.feedback {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: 20px;
|
|
7
|
+
width: 100%;
|
|
8
|
+
max-width: 760px;
|
|
9
|
+
text-align: center;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.mark {
|
|
13
|
+
display: grid;
|
|
14
|
+
place-items: center;
|
|
15
|
+
width: 96px;
|
|
16
|
+
height: 96px;
|
|
17
|
+
border-radius: 999px;
|
|
18
|
+
background: #e8f7ed;
|
|
19
|
+
box-shadow:
|
|
20
|
+
0 2px 4px rgb(43 120 69 / 8%),
|
|
21
|
+
0 10px 12px rgb(43 120 69 / 13%);
|
|
22
|
+
color: #2b7845;
|
|
23
|
+
font-size: 44px;
|
|
24
|
+
font-weight: 700;
|
|
25
|
+
line-height: 1.1;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.feedback h3 {
|
|
29
|
+
margin: 0;
|
|
30
|
+
color: #191d26;
|
|
31
|
+
font-size: 40px;
|
|
32
|
+
font-weight: 700;
|
|
33
|
+
line-height: 1.15;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.feedback p {
|
|
37
|
+
margin: 0;
|
|
38
|
+
color: #606978;
|
|
39
|
+
font-size: 18px;
|
|
40
|
+
font-weight: 600;
|
|
41
|
+
line-height: 1.4;
|
|
42
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { SuccessFeedback } from './SuccessFeedback';
|
|
3
|
+
|
|
4
|
+
describe('<SuccessFeedback>', () => {
|
|
5
|
+
it('should render the tracking confirmation', () => {
|
|
6
|
+
render(<SuccessFeedback />);
|
|
7
|
+
expect(screen.getByRole('heading', { name: 'Votre envoi est créé !' })).toBeInTheDocument();
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import styles from './SuccessFeedback.module.css';
|
|
2
|
+
|
|
3
|
+
export interface SuccessFeedbackProps {
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function SuccessFeedback({
|
|
9
|
+
title = 'Votre envoi est créé !',
|
|
10
|
+
description = 'Votre colis porte le numéro LR-2026-084215.',
|
|
11
|
+
}: SuccessFeedbackProps) {
|
|
12
|
+
return (
|
|
13
|
+
<div className={styles.feedback}>
|
|
14
|
+
<span className={styles.mark} aria-hidden="true">
|
|
15
|
+
✓
|
|
16
|
+
</span>
|
|
17
|
+
<h3>{title}</h3>
|
|
18
|
+
<p>{description}</p>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SuccessFeedback, type SuccessFeedbackProps } from './SuccessFeedback';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.control {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: 8px;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.input {
|
|
9
|
+
position: absolute;
|
|
10
|
+
opacity: 0;
|
|
11
|
+
width: 44px;
|
|
12
|
+
height: 24px;
|
|
13
|
+
margin: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.track {
|
|
17
|
+
position: relative;
|
|
18
|
+
width: 44px;
|
|
19
|
+
height: 24px;
|
|
20
|
+
border-radius: 12px;
|
|
21
|
+
background: #d0d5dd;
|
|
22
|
+
flex-shrink: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.knob {
|
|
26
|
+
position: absolute;
|
|
27
|
+
top: 2px;
|
|
28
|
+
left: 3px;
|
|
29
|
+
width: 20px;
|
|
30
|
+
height: 20px;
|
|
31
|
+
border-radius: 50%;
|
|
32
|
+
background: #fff;
|
|
33
|
+
box-shadow: var(--shadow-knob);
|
|
34
|
+
transition: left 0.15s ease;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.input:checked + .track {
|
|
38
|
+
background: var(--color-primary);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.input:checked + .track .knob {
|
|
42
|
+
left: 21px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.input:focus-visible + .track {
|
|
46
|
+
outline: 2px solid var(--color-primary);
|
|
47
|
+
outline-offset: 2px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.input:disabled + .track {
|
|
51
|
+
opacity: 0.5;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.label {
|
|
55
|
+
font-size: 13px;
|
|
56
|
+
color: var(--color-text);
|
|
57
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { Switch } from './Switch';
|
|
4
|
+
|
|
5
|
+
describe('<Switch>', () => {
|
|
6
|
+
it('should render an off switch', () => {
|
|
7
|
+
render(<Switch label="Notifications" />);
|
|
8
|
+
expect(screen.getByRole('switch', { name: 'Notifications' })).not.toBeChecked();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should toggle when activated', async () => {
|
|
12
|
+
const user = userEvent.setup();
|
|
13
|
+
render(<Switch label="Notifications" />);
|
|
14
|
+
const control = screen.getByRole('switch', { name: 'Notifications' });
|
|
15
|
+
|
|
16
|
+
await user.click(control);
|
|
17
|
+
|
|
18
|
+
expect(control).toBeChecked();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useId, type InputHTMLAttributes } from 'react';
|
|
2
|
+
import { cn } from '@/lib/cn';
|
|
3
|
+
import styles from './Switch.module.css';
|
|
4
|
+
|
|
5
|
+
export interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
6
|
+
label?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function Switch({ label, id, className, ...props }: SwitchProps) {
|
|
10
|
+
const generatedId = useId();
|
|
11
|
+
const fieldId = id ?? generatedId;
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<label className={cn(styles.control, className)} htmlFor={fieldId}>
|
|
15
|
+
<input id={fieldId} className={styles.input} type="checkbox" role="switch" {...props} />
|
|
16
|
+
<span className={styles.track} aria-hidden="true">
|
|
17
|
+
<span className={styles.knob} />
|
|
18
|
+
</span>
|
|
19
|
+
{label ? <span className={styles.label}>{label}</span> : null}
|
|
20
|
+
</label>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Switch, type SwitchProps } from './Switch';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.tabs {
|
|
2
|
+
display: flex;
|
|
3
|
+
background: #fff;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.tab {
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
width: 120px;
|
|
11
|
+
height: 38px;
|
|
12
|
+
border: 0;
|
|
13
|
+
border-bottom: 2px solid transparent;
|
|
14
|
+
background: #fff;
|
|
15
|
+
color: var(--color-text-secondary);
|
|
16
|
+
font-size: 12px;
|
|
17
|
+
font-weight: 500;
|
|
18
|
+
line-height: 1.3;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.active {
|
|
23
|
+
border-bottom-color: var(--color-primary);
|
|
24
|
+
color: var(--color-primary);
|
|
25
|
+
font-weight: 600;
|
|
26
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { Tabs } from './Tabs';
|
|
5
|
+
|
|
6
|
+
function Harness() {
|
|
7
|
+
const [value, setValue] = useState('all');
|
|
8
|
+
return (
|
|
9
|
+
<Tabs
|
|
10
|
+
value={value}
|
|
11
|
+
onChange={setValue}
|
|
12
|
+
items={[
|
|
13
|
+
{ id: 'all', label: 'Tous' },
|
|
14
|
+
{ id: 'transit', label: 'En transit' },
|
|
15
|
+
]}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
describe('<Tabs>', () => {
|
|
21
|
+
it('should mark the current tab as selected', () => {
|
|
22
|
+
render(<Harness />);
|
|
23
|
+
expect(screen.getByRole('tab', { name: 'Tous' })).toHaveAttribute('aria-selected', 'true');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('should select another tab when activated', async () => {
|
|
27
|
+
const user = userEvent.setup();
|
|
28
|
+
render(<Harness />);
|
|
29
|
+
|
|
30
|
+
await user.click(screen.getByRole('tab', { name: 'En transit' }));
|
|
31
|
+
|
|
32
|
+
expect(screen.getByRole('tab', { name: 'En transit' })).toHaveAttribute('aria-selected', 'true');
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { cn } from '@/lib/cn';
|
|
2
|
+
import styles from './Tabs.module.css';
|
|
3
|
+
|
|
4
|
+
export interface TabItem {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface TabsProps {
|
|
10
|
+
items: TabItem[];
|
|
11
|
+
value: string;
|
|
12
|
+
onChange: (id: string) => void;
|
|
13
|
+
className?: string;
|
|
14
|
+
/** Libellé accessible du groupe d’onglets. */
|
|
15
|
+
label?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function Tabs({ items, value, onChange, className, label = 'Sections' }: TabsProps) {
|
|
19
|
+
return (
|
|
20
|
+
<div className={cn(styles.tabs, className)} role="tablist" aria-label={label}>
|
|
21
|
+
{items.map((item) => {
|
|
22
|
+
const selected = item.id === value;
|
|
23
|
+
return (
|
|
24
|
+
<button
|
|
25
|
+
key={item.id}
|
|
26
|
+
type="button"
|
|
27
|
+
role="tab"
|
|
28
|
+
aria-selected={selected}
|
|
29
|
+
className={cn(styles.tab, selected && styles.active)}
|
|
30
|
+
onClick={() => onChange(item.id)}
|
|
31
|
+
>
|
|
32
|
+
{item.label}
|
|
33
|
+
</button>
|
|
34
|
+
);
|
|
35
|
+
})}
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Tabs, type TabsProps, type TabItem } from './Tabs';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.tag {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: 6px;
|
|
5
|
+
padding: 6px 12px;
|
|
6
|
+
border-radius: var(--radius-pill);
|
|
7
|
+
background: var(--color-surface-sunken);
|
|
8
|
+
color: var(--color-text-strong);
|
|
9
|
+
font-size: 13px;
|
|
10
|
+
font-weight: 500;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.active {
|
|
14
|
+
background: var(--color-primary);
|
|
15
|
+
color: #fff;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.success {
|
|
19
|
+
background: var(--color-success-bg);
|
|
20
|
+
color: var(--color-success);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.warning {
|
|
24
|
+
background: var(--color-warning-bg);
|
|
25
|
+
color: var(--color-warning);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.error {
|
|
29
|
+
background: var(--color-error-bg);
|
|
30
|
+
color: var(--color-error);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.remove {
|
|
34
|
+
display: inline-flex;
|
|
35
|
+
padding: 0;
|
|
36
|
+
border: 0;
|
|
37
|
+
background: transparent;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { Tag } from './Tag';
|
|
4
|
+
|
|
5
|
+
describe('<Tag>', () => {
|
|
6
|
+
it('should render its label', () => {
|
|
7
|
+
render(<Tag>Standard</Tag>);
|
|
8
|
+
expect(screen.getByText('Standard')).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should call onRemove when the remove button is activated', async () => {
|
|
12
|
+
const user = userEvent.setup();
|
|
13
|
+
const onRemove = vi.fn();
|
|
14
|
+
render(
|
|
15
|
+
<Tag type="removable" onRemove={onRemove}>
|
|
16
|
+
Filtre
|
|
17
|
+
</Tag>,
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
await user.click(screen.getByRole('button', { name: 'Retirer Filtre' }));
|
|
21
|
+
|
|
22
|
+
expect(onRemove).toHaveBeenCalledOnce();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { cn } from '@/lib/cn';
|
|
2
|
+
import { Icon } from '@/components/Icon';
|
|
3
|
+
import styles from './Tag.module.css';
|
|
4
|
+
|
|
5
|
+
export type TagType = 'default' | 'active' | 'removable' | 'success' | 'warning' | 'error';
|
|
6
|
+
|
|
7
|
+
export interface TagProps {
|
|
8
|
+
type?: TagType;
|
|
9
|
+
children: string;
|
|
10
|
+
onRemove?: () => void;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function Tag({ type = 'default', children, onRemove, className }: TagProps) {
|
|
15
|
+
return (
|
|
16
|
+
<span className={cn(styles.tag, styles[type], className)}>
|
|
17
|
+
{children}
|
|
18
|
+
{type === 'removable' ? (
|
|
19
|
+
<button type="button" className={styles.remove} onClick={onRemove} aria-label={`Retirer ${children}`}>
|
|
20
|
+
<Icon name="close" size={12} />
|
|
21
|
+
</button>
|
|
22
|
+
) : null}
|
|
23
|
+
</span>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Tag, type TagProps, type TagType } from './Tag';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.field {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: flex-start;
|
|
5
|
+
gap: 6px;
|
|
6
|
+
width: 340px;
|
|
7
|
+
max-width: 100%;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.label {
|
|
11
|
+
font-size: 11px;
|
|
12
|
+
font-weight: 600;
|
|
13
|
+
line-height: 1.3;
|
|
14
|
+
color: var(--color-text-secondary);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.labelError {
|
|
18
|
+
color: var(--color-error);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.input {
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 44px;
|
|
24
|
+
padding: 0 14px;
|
|
25
|
+
border: 1px solid var(--color-border);
|
|
26
|
+
border-radius: var(--radius-control);
|
|
27
|
+
background: #fff;
|
|
28
|
+
color: var(--color-text);
|
|
29
|
+
font-size: 13px;
|
|
30
|
+
line-height: 1.3;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.input::placeholder {
|
|
34
|
+
color: var(--color-text-secondary);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.input:focus {
|
|
38
|
+
outline: none;
|
|
39
|
+
border-color: var(--color-primary);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.inputError {
|
|
43
|
+
border-color: var(--color-error);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.input:disabled {
|
|
47
|
+
background: var(--color-surface-muted);
|
|
48
|
+
border-color: var(--color-border);
|
|
49
|
+
color: var(--color-disabled);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.error {
|
|
53
|
+
font-size: 12px;
|
|
54
|
+
color: var(--color-error);
|
|
55
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { TextField } from './TextField';
|
|
4
|
+
|
|
5
|
+
describe('<TextField>', () => {
|
|
6
|
+
it('should render the label and the field', () => {
|
|
7
|
+
render(<TextField label="Libellé" placeholder="Saisir une valeur" />);
|
|
8
|
+
expect(screen.getByLabelText('Libellé')).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should update the value when the user types', async () => {
|
|
12
|
+
const user = userEvent.setup();
|
|
13
|
+
render(<TextField label="Ville" />);
|
|
14
|
+
|
|
15
|
+
await user.type(screen.getByLabelText('Ville'), 'Abidjan');
|
|
16
|
+
|
|
17
|
+
expect(screen.getByLabelText('Ville')).toHaveValue('Abidjan');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should expose the error message', () => {
|
|
21
|
+
render(<TextField label="Libellé" error="Ce champ est requis" />);
|
|
22
|
+
expect(screen.getByRole('alert')).toHaveTextContent('Ce champ est requis');
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useId, type InputHTMLAttributes } from 'react';
|
|
2
|
+
import { cn } from '@/lib/cn';
|
|
3
|
+
import styles from './TextField.module.css';
|
|
4
|
+
|
|
5
|
+
export interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
6
|
+
/** Libellé visible au-dessus du champ. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Message d’erreur. Passe le champ en état invalide. */
|
|
9
|
+
error?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function TextField({ label, error, id, className, disabled, ...props }: TextFieldProps) {
|
|
13
|
+
const generatedId = useId();
|
|
14
|
+
const fieldId = id ?? generatedId;
|
|
15
|
+
const errorId = error ? `${fieldId}-error` : undefined;
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div className={cn(styles.field, className)}>
|
|
19
|
+
<label className={cn(styles.label, error && styles.labelError)} htmlFor={fieldId}>
|
|
20
|
+
{label}
|
|
21
|
+
</label>
|
|
22
|
+
<input
|
|
23
|
+
id={fieldId}
|
|
24
|
+
className={cn(styles.input, error && styles.inputError)}
|
|
25
|
+
disabled={disabled}
|
|
26
|
+
aria-invalid={error ? true : undefined}
|
|
27
|
+
aria-describedby={errorId}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
{error ? (
|
|
31
|
+
<p id={errorId} className={styles.error} role="alert">
|
|
32
|
+
{error}
|
|
33
|
+
</p>
|
|
34
|
+
) : null}
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextField, type TextFieldProps } from './TextField';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
.toast {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: 12px;
|
|
5
|
+
width: 400px;
|
|
6
|
+
max-width: 100%;
|
|
7
|
+
min-height: 72px;
|
|
8
|
+
padding: 14px 16px;
|
|
9
|
+
border: 1px solid transparent;
|
|
10
|
+
border-radius: var(--radius-control);
|
|
11
|
+
background: #fff;
|
|
12
|
+
box-shadow: var(--shadow-toast);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.icon {
|
|
16
|
+
display: inline-flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
width: 24px;
|
|
20
|
+
height: 24px;
|
|
21
|
+
border-radius: 12px;
|
|
22
|
+
font-size: 12px;
|
|
23
|
+
font-weight: 700;
|
|
24
|
+
flex-shrink: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.message {
|
|
28
|
+
flex: 1;
|
|
29
|
+
font-size: 14px;
|
|
30
|
+
color: var(--color-text);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.close {
|
|
34
|
+
border: 0;
|
|
35
|
+
background: transparent;
|
|
36
|
+
color: var(--color-text-muted);
|
|
37
|
+
font-size: 14px;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
padding: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.success {
|
|
43
|
+
border-color: rgba(43, 120, 69, 0.3);
|
|
44
|
+
}
|
|
45
|
+
.success .icon {
|
|
46
|
+
background: rgba(43, 120, 69, 0.12);
|
|
47
|
+
color: var(--color-success);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.error {
|
|
51
|
+
border-color: rgba(184, 50, 74, 0.3);
|
|
52
|
+
}
|
|
53
|
+
.error .icon {
|
|
54
|
+
background: rgba(184, 50, 74, 0.12);
|
|
55
|
+
color: var(--color-error);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.warning {
|
|
59
|
+
border-color: rgba(184, 106, 18, 0.3);
|
|
60
|
+
}
|
|
61
|
+
.warning .icon {
|
|
62
|
+
background: rgba(184, 106, 18, 0.12);
|
|
63
|
+
color: var(--color-warning);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.info {
|
|
67
|
+
border-color: rgba(47, 111, 204, 0.3);
|
|
68
|
+
}
|
|
69
|
+
.info .icon {
|
|
70
|
+
background: rgba(47, 111, 204, 0.12);
|
|
71
|
+
color: var(--color-info);
|
|
72
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { Toast } from './Toast';
|
|
4
|
+
|
|
5
|
+
describe('<Toast>', () => {
|
|
6
|
+
it('should render the message', () => {
|
|
7
|
+
render(<Toast>Colis envoyé avec succès.</Toast>);
|
|
8
|
+
expect(screen.getByText('Colis envoyé avec succès.')).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should call onClose when the close button is activated', async () => {
|
|
12
|
+
const user = userEvent.setup();
|
|
13
|
+
const onClose = vi.fn();
|
|
14
|
+
render(<Toast onClose={onClose}>Colis envoyé avec succès.</Toast>);
|
|
15
|
+
|
|
16
|
+
await user.click(screen.getByRole('button', { name: 'Fermer' }));
|
|
17
|
+
|
|
18
|
+
expect(onClose).toHaveBeenCalledOnce();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { cn } from '@/lib/cn';
|
|
2
|
+
import styles from './Toast.module.css';
|
|
3
|
+
|
|
4
|
+
export type ToastType = 'success' | 'error' | 'warning' | 'info';
|
|
5
|
+
|
|
6
|
+
const ICONS: Record<ToastType, string> = {
|
|
7
|
+
success: '✓',
|
|
8
|
+
error: '!',
|
|
9
|
+
warning: '⚠',
|
|
10
|
+
info: 'i',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export interface ToastProps {
|
|
14
|
+
type?: ToastType;
|
|
15
|
+
children: string;
|
|
16
|
+
onClose?: () => void;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function Toast({ type = 'success', children, onClose, className }: ToastProps) {
|
|
21
|
+
return (
|
|
22
|
+
<div className={cn(styles.toast, styles[type], className)} role="status">
|
|
23
|
+
<span className={styles.icon} aria-hidden="true">
|
|
24
|
+
{ICONS[type]}
|
|
25
|
+
</span>
|
|
26
|
+
<p className={styles.message}>{children}</p>
|
|
27
|
+
<button type="button" className={styles.close} onClick={onClose} aria-label="Fermer">
|
|
28
|
+
✕
|
|
29
|
+
</button>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Toast, type ToastProps, type ToastType } from './Toast';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.wrap {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.tip {
|
|
7
|
+
position: absolute;
|
|
8
|
+
left: 50%;
|
|
9
|
+
bottom: calc(100% + 8px);
|
|
10
|
+
transform: translateX(-50%);
|
|
11
|
+
padding: 6px 10px 10px;
|
|
12
|
+
border-radius: 6px;
|
|
13
|
+
background: var(--color-tooltip);
|
|
14
|
+
color: #fff;
|
|
15
|
+
font-size: 12px;
|
|
16
|
+
font-weight: 500;
|
|
17
|
+
white-space: nowrap;
|
|
18
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
|
|
19
|
+
opacity: 0;
|
|
20
|
+
pointer-events: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.tip::after {
|
|
24
|
+
content: '';
|
|
25
|
+
position: absolute;
|
|
26
|
+
left: 50%;
|
|
27
|
+
bottom: 4px;
|
|
28
|
+
width: 8px;
|
|
29
|
+
height: 8px;
|
|
30
|
+
background: var(--color-tooltip);
|
|
31
|
+
transform: translateX(-50%) rotate(45deg);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.wrap:hover .tip,
|
|
35
|
+
.wrap:focus-within .tip {
|
|
36
|
+
opacity: 1;
|
|
37
|
+
}
|