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,18 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { BarChart } from './BarChart';
|
|
3
|
+
|
|
4
|
+
describe('<BarChart>', () => {
|
|
5
|
+
it('should render the chart title and labels', () => {
|
|
6
|
+
render(
|
|
7
|
+
<BarChart
|
|
8
|
+
title="Colis par jour"
|
|
9
|
+
items={[
|
|
10
|
+
{ label: 'Lun', value: 60 },
|
|
11
|
+
{ label: 'Mar', value: 110 },
|
|
12
|
+
]}
|
|
13
|
+
/>,
|
|
14
|
+
);
|
|
15
|
+
expect(screen.getByText('Colis par jour')).toBeInTheDocument();
|
|
16
|
+
expect(screen.getByText('Lun')).toBeInTheDocument();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { cn } from '@/lib/cn';
|
|
2
|
+
import styles from './BarChart.module.css';
|
|
3
|
+
|
|
4
|
+
export interface BarChartItem {
|
|
5
|
+
label: string;
|
|
6
|
+
value: number;
|
|
7
|
+
color?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface BarChartProps {
|
|
11
|
+
title: string;
|
|
12
|
+
items: BarChartItem[];
|
|
13
|
+
max?: number;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const DEFAULT_COLORS = ['#d34860', '#e06c7e', '#b8324a', '#f5a3b1', '#d34860'];
|
|
18
|
+
|
|
19
|
+
export function BarChart({ title, items, max = 150, className }: BarChartProps) {
|
|
20
|
+
return (
|
|
21
|
+
<figure className={cn(styles.chart, className)}>
|
|
22
|
+
<figcaption className={styles.title}>{title}</figcaption>
|
|
23
|
+
<div className={styles.body}>
|
|
24
|
+
<div className={styles.axis} aria-hidden="true">
|
|
25
|
+
<span>{max}</span>
|
|
26
|
+
<span>{Math.round(max * 0.66)}</span>
|
|
27
|
+
<span>{Math.round(max * 0.33)}</span>
|
|
28
|
+
<span>0</span>
|
|
29
|
+
</div>
|
|
30
|
+
<div className={styles.bars}>
|
|
31
|
+
{items.map((item, index) => (
|
|
32
|
+
<div key={item.label} className={styles.column}>
|
|
33
|
+
<span
|
|
34
|
+
className={styles.bar}
|
|
35
|
+
style={{
|
|
36
|
+
height: `${Math.min(100, (item.value / max) * 100)}%`,
|
|
37
|
+
background: item.color ?? DEFAULT_COLORS[index % DEFAULT_COLORS.length],
|
|
38
|
+
}}
|
|
39
|
+
/>
|
|
40
|
+
<span className={styles.label}>{item.label}</span>
|
|
41
|
+
</div>
|
|
42
|
+
))}
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</figure>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BarChart, type BarChartProps, type BarChartItem } from './BarChart';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
.card {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 24px;
|
|
5
|
+
width: 100%;
|
|
6
|
+
max-width: 340px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.illustration {
|
|
10
|
+
display: grid;
|
|
11
|
+
place-items: center;
|
|
12
|
+
width: 120px;
|
|
13
|
+
height: 120px;
|
|
14
|
+
border-radius: 24px;
|
|
15
|
+
background: #fff1f2;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.list {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
gap: 16px;
|
|
22
|
+
margin: 0;
|
|
23
|
+
padding: 0;
|
|
24
|
+
list-style: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.list li {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
gap: 12px;
|
|
31
|
+
color: #606978;
|
|
32
|
+
font-size: 15px;
|
|
33
|
+
line-height: 1.4;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.list span {
|
|
37
|
+
display: grid;
|
|
38
|
+
place-items: center;
|
|
39
|
+
flex-shrink: 0;
|
|
40
|
+
width: 24px;
|
|
41
|
+
height: 24px;
|
|
42
|
+
border-radius: 12px;
|
|
43
|
+
background: #fff1f2;
|
|
44
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { BenefitsCard } from './BenefitsCard';
|
|
3
|
+
|
|
4
|
+
describe('<BenefitsCard>', () => {
|
|
5
|
+
it('should list the benefits', () => {
|
|
6
|
+
render(<BenefitsCard />);
|
|
7
|
+
expect(screen.getByText('Suivi en temps réel de vos colis')).toBeInTheDocument();
|
|
8
|
+
expect(screen.getAllByRole('listitem')).toHaveLength(3);
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import check from '@/assets/icons/core-check-sm.svg';
|
|
2
|
+
import parcel from '@/assets/icons/core-package-lg.svg';
|
|
3
|
+
import styles from './BenefitsCard.module.css';
|
|
4
|
+
|
|
5
|
+
export interface BenefitsCardProps {
|
|
6
|
+
items?: string[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const DEFAULT_ITEMS = [
|
|
10
|
+
'Suivi en temps réel de vos colis',
|
|
11
|
+
'Historique de tous vos envois',
|
|
12
|
+
'Notifications automatiques',
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
export function BenefitsCard({ items = DEFAULT_ITEMS }: BenefitsCardProps) {
|
|
16
|
+
return (
|
|
17
|
+
<div className={styles.card}>
|
|
18
|
+
<span className={styles.illustration}>
|
|
19
|
+
<img src={parcel} alt="" width={56} height={56} />
|
|
20
|
+
</span>
|
|
21
|
+
<ul className={styles.list}>
|
|
22
|
+
{items.map((item) => (
|
|
23
|
+
<li key={item}>
|
|
24
|
+
<span>
|
|
25
|
+
<img src={check} alt="" width={14} height={14} />
|
|
26
|
+
</span>
|
|
27
|
+
{item}
|
|
28
|
+
</li>
|
|
29
|
+
))}
|
|
30
|
+
</ul>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BenefitsCard, type BenefitsCardProps } from './BenefitsCard';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.item {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
gap: 5px;
|
|
7
|
+
width: 78px;
|
|
8
|
+
height: 64px;
|
|
9
|
+
border: 0;
|
|
10
|
+
background: #fff;
|
|
11
|
+
color: var(--color-text-secondary);
|
|
12
|
+
font-size: 10px;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.item span {
|
|
17
|
+
font-size: 13px;
|
|
18
|
+
font-weight: 700;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.active {
|
|
22
|
+
color: var(--color-primary);
|
|
23
|
+
font-weight: 600;
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { BottomNavItem } from './BottomNavItem';
|
|
4
|
+
|
|
5
|
+
describe('<BottomNavItem>', () => {
|
|
6
|
+
it('should render the label', () => {
|
|
7
|
+
render(<BottomNavItem label="Accueil" />);
|
|
8
|
+
expect(screen.getByRole('button', { name: 'Accueil' })).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should call onClick when activated', async () => {
|
|
12
|
+
const user = userEvent.setup();
|
|
13
|
+
const onClick = vi.fn();
|
|
14
|
+
render(<BottomNavItem label="Accueil" onClick={onClick} />);
|
|
15
|
+
|
|
16
|
+
await user.click(screen.getByRole('button', { name: 'Accueil' }));
|
|
17
|
+
|
|
18
|
+
expect(onClick).toHaveBeenCalledOnce();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { cn } from '@/lib/cn';
|
|
2
|
+
import styles from './BottomNavItem.module.css';
|
|
3
|
+
|
|
4
|
+
export interface BottomNavItemProps {
|
|
5
|
+
label: string;
|
|
6
|
+
active?: boolean;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function BottomNavItem({ label, active = false, onClick, className }: BottomNavItemProps) {
|
|
12
|
+
return (
|
|
13
|
+
<button
|
|
14
|
+
type="button"
|
|
15
|
+
className={cn(styles.item, active && styles.active, className)}
|
|
16
|
+
aria-current={active ? 'page' : undefined}
|
|
17
|
+
onClick={onClick}
|
|
18
|
+
>
|
|
19
|
+
<span aria-hidden="true">●</span>
|
|
20
|
+
{label}
|
|
21
|
+
</button>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BottomNavItem, type BottomNavItemProps } from './BottomNavItem';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.nav {
|
|
2
|
+
font-size: 13px;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.list {
|
|
6
|
+
display: flex;
|
|
7
|
+
gap: 8px;
|
|
8
|
+
margin: 0;
|
|
9
|
+
padding: 0;
|
|
10
|
+
list-style: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.item {
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
gap: 8px;
|
|
16
|
+
color: var(--color-text-muted);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.item a {
|
|
20
|
+
color: var(--color-text-muted);
|
|
21
|
+
text-decoration: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.current {
|
|
25
|
+
font-weight: 600;
|
|
26
|
+
color: var(--color-text);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.item span[aria-hidden] {
|
|
30
|
+
color: var(--color-text-placeholder);
|
|
31
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { Breadcrumb } from './Breadcrumb';
|
|
3
|
+
|
|
4
|
+
describe('<Breadcrumb>', () => {
|
|
5
|
+
it('should render the current page', () => {
|
|
6
|
+
render(
|
|
7
|
+
<Breadcrumb
|
|
8
|
+
items={[
|
|
9
|
+
{ label: 'Accueil', href: '/' },
|
|
10
|
+
{ label: 'Mes colis', href: '/colis' },
|
|
11
|
+
{ label: 'LR-2026-000123' },
|
|
12
|
+
]}
|
|
13
|
+
/>,
|
|
14
|
+
);
|
|
15
|
+
expect(screen.getByText('LR-2026-000123')).toHaveAttribute('aria-current', 'page');
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should link the previous crumbs', () => {
|
|
19
|
+
render(
|
|
20
|
+
<Breadcrumb
|
|
21
|
+
items={[
|
|
22
|
+
{ label: 'Accueil', href: '/' },
|
|
23
|
+
{ label: 'Mes colis' },
|
|
24
|
+
]}
|
|
25
|
+
/>,
|
|
26
|
+
);
|
|
27
|
+
expect(screen.getByRole('link', { name: 'Accueil' })).toHaveAttribute('href', '/');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { cn } from '@/lib/cn';
|
|
2
|
+
import styles from './Breadcrumb.module.css';
|
|
3
|
+
|
|
4
|
+
export interface BreadcrumbItem {
|
|
5
|
+
label: string;
|
|
6
|
+
href?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface BreadcrumbProps {
|
|
10
|
+
items: BreadcrumbItem[];
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function Breadcrumb({ items, className }: BreadcrumbProps) {
|
|
15
|
+
return (
|
|
16
|
+
<nav className={cn(styles.nav, className)} aria-label="Fil d’Ariane">
|
|
17
|
+
<ol className={styles.list}>
|
|
18
|
+
{items.map((item, index) => {
|
|
19
|
+
const current = index === items.length - 1;
|
|
20
|
+
return (
|
|
21
|
+
<li key={item.label} className={styles.item}>
|
|
22
|
+
{index > 0 ? <span aria-hidden="true">/</span> : null}
|
|
23
|
+
{current || !item.href ? (
|
|
24
|
+
<span aria-current={current ? 'page' : undefined} className={current ? styles.current : undefined}>
|
|
25
|
+
{item.label}
|
|
26
|
+
</span>
|
|
27
|
+
) : (
|
|
28
|
+
<a href={item.href}>{item.label}</a>
|
|
29
|
+
)}
|
|
30
|
+
</li>
|
|
31
|
+
);
|
|
32
|
+
})}
|
|
33
|
+
</ol>
|
|
34
|
+
</nav>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Breadcrumb, type BreadcrumbProps, type BreadcrumbItem } from './Breadcrumb';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.button {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
min-width: 160px;
|
|
6
|
+
height: 44px;
|
|
7
|
+
padding: 0 16px;
|
|
8
|
+
border: 1px solid transparent;
|
|
9
|
+
border-radius: var(--radius-button);
|
|
10
|
+
font-size: 13px;
|
|
11
|
+
font-weight: 600;
|
|
12
|
+
line-height: 1.3;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
background: transparent;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.primary {
|
|
18
|
+
background: var(--color-primary);
|
|
19
|
+
color: #fff;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.primary:hover:not(:disabled) {
|
|
23
|
+
background: var(--color-primary-hover);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.primary:disabled {
|
|
27
|
+
background: var(--color-disabled);
|
|
28
|
+
color: #fff;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.secondary {
|
|
32
|
+
background: #fff;
|
|
33
|
+
color: var(--color-primary);
|
|
34
|
+
border-color: var(--color-primary);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.secondary:hover:not(:disabled) {
|
|
38
|
+
background: var(--color-primary-soft);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.secondary:disabled {
|
|
42
|
+
color: var(--color-disabled);
|
|
43
|
+
border-color: var(--color-disabled);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ghost {
|
|
47
|
+
background: #fff;
|
|
48
|
+
color: var(--color-text);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.ghost:hover:not(:disabled) {
|
|
52
|
+
background: var(--color-surface-muted);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.ghost:disabled {
|
|
56
|
+
color: var(--color-disabled);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.button:disabled {
|
|
60
|
+
cursor: not-allowed;
|
|
61
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { Button } from './Button';
|
|
4
|
+
|
|
5
|
+
describe('<Button>', () => {
|
|
6
|
+
it('should render its label', () => {
|
|
7
|
+
render(<Button>Continuer</Button>);
|
|
8
|
+
expect(screen.getByRole('button', { name: 'Continuer' })).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should call onClick when activated', async () => {
|
|
12
|
+
const user = userEvent.setup();
|
|
13
|
+
const onClick = vi.fn();
|
|
14
|
+
render(<Button onClick={onClick}>Continuer</Button>);
|
|
15
|
+
|
|
16
|
+
await user.click(screen.getByRole('button', { name: 'Continuer' }));
|
|
17
|
+
|
|
18
|
+
expect(onClick).toHaveBeenCalledOnce();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should not call onClick when disabled', async () => {
|
|
22
|
+
const user = userEvent.setup();
|
|
23
|
+
const onClick = vi.fn();
|
|
24
|
+
render(
|
|
25
|
+
<Button disabled onClick={onClick}>
|
|
26
|
+
Continuer
|
|
27
|
+
</Button>,
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
await user.click(screen.getByRole('button', { name: 'Continuer' }));
|
|
31
|
+
|
|
32
|
+
expect(onClick).not.toHaveBeenCalled();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { cn } from '@/lib/cn';
|
|
3
|
+
import styles from './Button.module.css';
|
|
4
|
+
|
|
5
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'ghost';
|
|
6
|
+
|
|
7
|
+
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
8
|
+
/** Variante visuelle du bouton. */
|
|
9
|
+
variant?: ButtonVariant;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function Button({
|
|
13
|
+
variant = 'primary',
|
|
14
|
+
className,
|
|
15
|
+
type = 'button',
|
|
16
|
+
children,
|
|
17
|
+
...props
|
|
18
|
+
}: ButtonProps) {
|
|
19
|
+
return (
|
|
20
|
+
<button type={type} className={cn(styles.button, styles[variant], className)} {...props}>
|
|
21
|
+
{children}
|
|
22
|
+
</button>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Button, type ButtonProps, type ButtonVariant } from './Button';
|
|
@@ -0,0 +1,53 @@
|
|
|
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: 24px;
|
|
12
|
+
height: 24px;
|
|
13
|
+
margin: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.box {
|
|
17
|
+
width: 24px;
|
|
18
|
+
height: 24px;
|
|
19
|
+
border: 1px solid var(--color-border);
|
|
20
|
+
border-radius: 6px;
|
|
21
|
+
background: #fff;
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
color: #fff;
|
|
26
|
+
font-size: 13px;
|
|
27
|
+
font-weight: 700;
|
|
28
|
+
line-height: 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.input:checked + .box {
|
|
32
|
+
background: var(--color-primary);
|
|
33
|
+
border-color: var(--color-primary);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.input:checked + .box::after {
|
|
37
|
+
content: '✓';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.input:focus-visible + .box {
|
|
41
|
+
outline: 2px solid var(--color-primary);
|
|
42
|
+
outline-offset: 2px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.input:disabled + .box {
|
|
46
|
+
opacity: 0.5;
|
|
47
|
+
cursor: not-allowed;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.label {
|
|
51
|
+
font-size: 13px;
|
|
52
|
+
color: var(--color-text);
|
|
53
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { Checkbox } from './Checkbox';
|
|
4
|
+
|
|
5
|
+
describe('<Checkbox>', () => {
|
|
6
|
+
it('should render an unchecked checkbox', () => {
|
|
7
|
+
render(<Checkbox label="Accepter" />);
|
|
8
|
+
expect(screen.getByRole('checkbox', { name: 'Accepter' })).not.toBeChecked();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should toggle when activated', async () => {
|
|
12
|
+
const user = userEvent.setup();
|
|
13
|
+
render(<Checkbox label="Accepter" />);
|
|
14
|
+
const checkbox = screen.getByRole('checkbox', { name: 'Accepter' });
|
|
15
|
+
|
|
16
|
+
await user.click(checkbox);
|
|
17
|
+
|
|
18
|
+
expect(checkbox).toBeChecked();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useId, type InputHTMLAttributes } from 'react';
|
|
2
|
+
import { cn } from '@/lib/cn';
|
|
3
|
+
import styles from './Checkbox.module.css';
|
|
4
|
+
|
|
5
|
+
export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
6
|
+
label?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function Checkbox({ label, id, className, ...props }: CheckboxProps) {
|
|
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" {...props} />
|
|
16
|
+
<span className={styles.box} aria-hidden="true" />
|
|
17
|
+
{label ? <span className={styles.label}>{label}</span> : null}
|
|
18
|
+
</label>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Checkbox, type CheckboxProps } from './Checkbox';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
.backdrop {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
padding: 24px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.modal {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
align-items: center;
|
|
12
|
+
width: 480px;
|
|
13
|
+
max-width: 100%;
|
|
14
|
+
padding: 32px 32px 28px;
|
|
15
|
+
border: 1px solid var(--color-border);
|
|
16
|
+
border-radius: var(--radius-lg);
|
|
17
|
+
background: #fff;
|
|
18
|
+
box-shadow: var(--shadow-modal);
|
|
19
|
+
text-align: center;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.icon {
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
width: 56px;
|
|
27
|
+
height: 56px;
|
|
28
|
+
margin-bottom: 20px;
|
|
29
|
+
border-radius: 28px;
|
|
30
|
+
background: var(--color-warning-icon);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.title {
|
|
34
|
+
margin: 0 0 8px;
|
|
35
|
+
font-size: 18px;
|
|
36
|
+
font-weight: 600;
|
|
37
|
+
line-height: 24px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.description {
|
|
41
|
+
margin: 0 0 24px;
|
|
42
|
+
color: var(--color-text-secondary);
|
|
43
|
+
font-size: 14px;
|
|
44
|
+
line-height: 21px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.actions {
|
|
48
|
+
display: flex;
|
|
49
|
+
gap: 12px;
|
|
50
|
+
width: 100%;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.cancel,
|
|
54
|
+
.confirm {
|
|
55
|
+
flex: 1;
|
|
56
|
+
min-width: 0;
|
|
57
|
+
height: auto;
|
|
58
|
+
padding: 12px;
|
|
59
|
+
border-radius: var(--radius-sm);
|
|
60
|
+
font-size: 14px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.cancel {
|
|
64
|
+
border: 1px solid var(--color-border-line);
|
|
65
|
+
background: var(--color-surface-cancel);
|
|
66
|
+
color: var(--color-text);
|
|
67
|
+
font-weight: 600;
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { ConfirmModal } from './ConfirmModal';
|
|
4
|
+
|
|
5
|
+
describe('<ConfirmModal>', () => {
|
|
6
|
+
it('should render the confirmation copy', () => {
|
|
7
|
+
render(
|
|
8
|
+
<ConfirmModal
|
|
9
|
+
title="Confirmer la remise du colis ?"
|
|
10
|
+
description="Cette action marque le colis comme remis au destinataire."
|
|
11
|
+
/>,
|
|
12
|
+
);
|
|
13
|
+
expect(screen.getByRole('dialog', { name: 'Confirmer la remise du colis ?' })).toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('should call onConfirm when the confirm button is activated', async () => {
|
|
17
|
+
const user = userEvent.setup();
|
|
18
|
+
const onConfirm = vi.fn();
|
|
19
|
+
render(<ConfirmModal title="Confirmer ?" description="Action irréversible." onConfirm={onConfirm} />);
|
|
20
|
+
|
|
21
|
+
await user.click(screen.getByRole('button', { name: 'Confirmer' }));
|
|
22
|
+
|
|
23
|
+
expect(onConfirm).toHaveBeenCalledOnce();
|
|
24
|
+
});
|
|
25
|
+
});
|