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,22 @@
|
|
|
1
|
+
import type { InputHTMLAttributes } from 'react';
|
|
2
|
+
import { CoreButton } from '@/components/CoreButton';
|
|
3
|
+
import styles from './DataFiltersToolbar.module.css';
|
|
4
|
+
|
|
5
|
+
export interface DataFiltersToolbarProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
6
|
+
onFilters?: () => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function DataFiltersToolbar({
|
|
10
|
+
placeholder = 'Rechercher par nom, email ou téléphone…',
|
|
11
|
+
onFilters,
|
|
12
|
+
...props
|
|
13
|
+
}: DataFiltersToolbarProps) {
|
|
14
|
+
return (
|
|
15
|
+
<form className={styles.toolbar} role="search">
|
|
16
|
+
<input className={styles.input} type="search" placeholder={placeholder} {...props} />
|
|
17
|
+
<CoreButton variant="filter" onClick={onFilters}>
|
|
18
|
+
Filtres
|
|
19
|
+
</CoreButton>
|
|
20
|
+
</form>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DataFiltersToolbar, type DataFiltersToolbarProps } from './DataFiltersToolbar';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.bar {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
width: 100%;
|
|
5
|
+
max-width: 900px;
|
|
6
|
+
height: 72px;
|
|
7
|
+
padding: 0 17px;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
border: 1px solid #e5e8ed;
|
|
10
|
+
border-radius: 16px;
|
|
11
|
+
background: #fff;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.input {
|
|
15
|
+
width: 100%;
|
|
16
|
+
border: 0;
|
|
17
|
+
background: transparent;
|
|
18
|
+
color: #191d26;
|
|
19
|
+
font: inherit;
|
|
20
|
+
font-size: 12px;
|
|
21
|
+
font-weight: 400;
|
|
22
|
+
line-height: normal;
|
|
23
|
+
outline: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.input::placeholder {
|
|
27
|
+
color: #606978;
|
|
28
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { DataSearchBar } from './DataSearchBar';
|
|
4
|
+
|
|
5
|
+
describe('<DataSearchBar>', () => {
|
|
6
|
+
it('should accept a search query', async () => {
|
|
7
|
+
const user = userEvent.setup();
|
|
8
|
+
render(<DataSearchBar aria-label="Recherche utilisateurs" />);
|
|
9
|
+
|
|
10
|
+
const field = screen.getByRole('searchbox', { name: 'Recherche utilisateurs' });
|
|
11
|
+
await user.type(field, 'Awa');
|
|
12
|
+
|
|
13
|
+
expect(field).toHaveValue('Awa');
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { InputHTMLAttributes } from 'react';
|
|
2
|
+
import styles from './DataSearchBar.module.css';
|
|
3
|
+
|
|
4
|
+
export interface DataSearchBarProps extends InputHTMLAttributes<HTMLInputElement> {}
|
|
5
|
+
|
|
6
|
+
export function DataSearchBar({
|
|
7
|
+
placeholder = 'Rechercher par nom, email ou téléphone…',
|
|
8
|
+
...props
|
|
9
|
+
}: DataSearchBarProps) {
|
|
10
|
+
return (
|
|
11
|
+
<form className={styles.bar} role="search">
|
|
12
|
+
<input className={styles.input} type="search" placeholder={placeholder} {...props} />
|
|
13
|
+
</form>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DataSearchBar, type DataSearchBarProps } from './DataSearchBar';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.card {
|
|
2
|
+
width: 100%;
|
|
3
|
+
max-width: 1098px;
|
|
4
|
+
padding: 19px;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
border: 1px solid #e5e8ed;
|
|
7
|
+
border-radius: 18px;
|
|
8
|
+
background: #fff;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.title {
|
|
12
|
+
margin: 0 0 21px;
|
|
13
|
+
color: #191d26;
|
|
14
|
+
font-size: 17px;
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
line-height: normal;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.table {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
gap: 8px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.header,
|
|
26
|
+
.row {
|
|
27
|
+
display: grid;
|
|
28
|
+
grid-template-columns: repeat(5, minmax(0, 1fr));
|
|
29
|
+
align-items: center;
|
|
30
|
+
padding: 0 10px;
|
|
31
|
+
border-radius: 10px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.header {
|
|
35
|
+
height: 38px;
|
|
36
|
+
background: #f9fafc;
|
|
37
|
+
color: #606978;
|
|
38
|
+
font-size: 10px;
|
|
39
|
+
font-weight: 600;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.row {
|
|
43
|
+
height: 46px;
|
|
44
|
+
background: #fff;
|
|
45
|
+
color: #606978;
|
|
46
|
+
font-size: 10px;
|
|
47
|
+
font-weight: 400;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.striped {
|
|
51
|
+
background: #f9fafc;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.name {
|
|
55
|
+
color: #191d26;
|
|
56
|
+
font-weight: 600;
|
|
57
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { DataTable } from './DataTable';
|
|
3
|
+
|
|
4
|
+
describe('<DataTable>', () => {
|
|
5
|
+
it('should list the users', () => {
|
|
6
|
+
render(<DataTable />);
|
|
7
|
+
|
|
8
|
+
expect(screen.getByRole('heading', { name: 'Utilisateurs' })).toBeInTheDocument();
|
|
9
|
+
expect(screen.getByRole('cell', { name: 'Awa Koné' })).toBeInTheDocument();
|
|
10
|
+
expect(screen.getByRole('cell', { name: 'Suspendu' })).toBeInTheDocument();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { cn } from '@/lib/cn';
|
|
2
|
+
import styles from './DataTable.module.css';
|
|
3
|
+
|
|
4
|
+
export interface DataTableColumn {
|
|
5
|
+
key: string;
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface DataTableRowData {
|
|
10
|
+
id: string;
|
|
11
|
+
cells: Record<string, string>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface DataTableProps {
|
|
15
|
+
title?: string;
|
|
16
|
+
columns?: DataTableColumn[];
|
|
17
|
+
rows?: DataTableRowData[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const DEFAULT_COLUMNS: DataTableColumn[] = [
|
|
21
|
+
{ key: 'user', label: 'Utilisateur' },
|
|
22
|
+
{ key: 'contact', label: 'Contact' },
|
|
23
|
+
{ key: 'city', label: 'Ville' },
|
|
24
|
+
{ key: 'parcels', label: 'Colis' },
|
|
25
|
+
{ key: 'status', label: 'Statut' },
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const DEFAULT_ROWS: DataTableRowData[] = [
|
|
29
|
+
{ id: 'awa', cells: { user: 'Awa Koné', contact: 'awa@exemple.ci', city: 'Cocody', parcels: '18', status: 'Actif' } },
|
|
30
|
+
{ id: 'yann', cells: { user: 'Yann Kouassi', contact: 'yann@exemple.ci', city: 'Yopougon', parcels: '7', status: 'Actif' } },
|
|
31
|
+
{ id: 'marie', cells: { user: 'Marie N’Guessan', contact: 'marie@exemple.ci', city: 'Marcory', parcels: '31', status: 'Vérifié' } },
|
|
32
|
+
{ id: 'serge', cells: { user: 'Serge Koffi', contact: 'serge@exemple.ci', city: 'Abobo', parcels: '2', status: 'À vérifier' } },
|
|
33
|
+
{ id: 'nadia', cells: { user: 'Nadia Touré', contact: 'nadia@exemple.ci', city: 'Bouaké', parcels: '13', status: 'Actif' } },
|
|
34
|
+
{ id: 'kevin', cells: { user: 'Kevin Yao', contact: 'kevin@exemple.ci', city: 'Plateau', parcels: '0', status: 'Suspendu' } },
|
|
35
|
+
{ id: 'fatou', cells: { user: 'Fatou Diarra', contact: 'fatou@exemple.ci', city: 'Treichville', parcels: '22', status: 'Actif' } },
|
|
36
|
+
{ id: 'eric', cells: { user: 'Eric Bamba', contact: 'eric@exemple.ci', city: 'Cocody', parcels: '9', status: 'Actif' } },
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
export function DataTable({
|
|
40
|
+
title = 'Utilisateurs',
|
|
41
|
+
columns = DEFAULT_COLUMNS,
|
|
42
|
+
rows = DEFAULT_ROWS,
|
|
43
|
+
}: DataTableProps) {
|
|
44
|
+
return (
|
|
45
|
+
<section className={styles.card} aria-label={title}>
|
|
46
|
+
<h3 className={styles.title}>{title}</h3>
|
|
47
|
+
<div className={styles.table} role="table">
|
|
48
|
+
<div className={styles.header} role="row">
|
|
49
|
+
{columns.map((column) => (
|
|
50
|
+
<span key={column.key} role="columnheader">
|
|
51
|
+
{column.label}
|
|
52
|
+
</span>
|
|
53
|
+
))}
|
|
54
|
+
</div>
|
|
55
|
+
{rows.map((row, index) => (
|
|
56
|
+
<div key={row.id} className={cn(styles.row, index % 2 === 1 && styles.striped)} role="row">
|
|
57
|
+
{columns.map((column, columnIndex) => (
|
|
58
|
+
<span key={column.key} className={columnIndex === 0 ? styles.name : undefined} role="cell">
|
|
59
|
+
{row.cells[column.key]}
|
|
60
|
+
</span>
|
|
61
|
+
))}
|
|
62
|
+
</div>
|
|
63
|
+
))}
|
|
64
|
+
</div>
|
|
65
|
+
</section>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DataTable, type DataTableColumn, type DataTableProps, type DataTableRowData } from './DataTable';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.wrap {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 8px;
|
|
5
|
+
width: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.caption {
|
|
9
|
+
color: var(--color-text-muted);
|
|
10
|
+
font-size: 11px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.row {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: 12px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.line {
|
|
20
|
+
flex: 1;
|
|
21
|
+
height: 1px;
|
|
22
|
+
background: var(--color-border);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.label {
|
|
26
|
+
color: var(--color-text-muted);
|
|
27
|
+
font-size: 12px;
|
|
28
|
+
font-weight: 500;
|
|
29
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { Divider } from './Divider';
|
|
3
|
+
|
|
4
|
+
describe('<Divider>', () => {
|
|
5
|
+
it('should render a labelled divider', () => {
|
|
6
|
+
render(<Divider label="ou" caption="Avec label central" />);
|
|
7
|
+
expect(screen.getByText('ou')).toBeInTheDocument();
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { cn } from '@/lib/cn';
|
|
2
|
+
import styles from './Divider.module.css';
|
|
3
|
+
|
|
4
|
+
export interface DividerProps {
|
|
5
|
+
label?: string;
|
|
6
|
+
caption?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function Divider({ label, caption, className }: DividerProps) {
|
|
11
|
+
return (
|
|
12
|
+
<div className={cn(styles.wrap, className)}>
|
|
13
|
+
{caption ? <p className={styles.caption}>{caption}</p> : null}
|
|
14
|
+
<div className={styles.row}>
|
|
15
|
+
<span className={styles.line} />
|
|
16
|
+
{label ? <span className={styles.label}>{label}</span> : null}
|
|
17
|
+
{label ? <span className={styles.line} /> : null}
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Divider, type DividerProps } from './Divider';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.menu {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
width: 220px;
|
|
5
|
+
padding: 6px 0;
|
|
6
|
+
border: 1px solid var(--color-border);
|
|
7
|
+
border-radius: var(--radius-control);
|
|
8
|
+
background: #fff;
|
|
9
|
+
box-shadow: var(--shadow-menu);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.slot {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.item {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
gap: 10px;
|
|
21
|
+
width: 100%;
|
|
22
|
+
padding: 10px 14px;
|
|
23
|
+
border: 0;
|
|
24
|
+
background: transparent;
|
|
25
|
+
color: var(--color-text);
|
|
26
|
+
font-size: 14px;
|
|
27
|
+
font-weight: 500;
|
|
28
|
+
line-height: 20px;
|
|
29
|
+
text-align: left;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.item:hover {
|
|
34
|
+
background: var(--color-surface-muted);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.danger {
|
|
38
|
+
color: var(--color-primary);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.separator {
|
|
42
|
+
height: 1px;
|
|
43
|
+
margin: 4px 12px;
|
|
44
|
+
background: var(--color-divider);
|
|
45
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { DropdownMenu } from './DropdownMenu';
|
|
4
|
+
|
|
5
|
+
describe('<DropdownMenu>', () => {
|
|
6
|
+
it('should render the menu items', () => {
|
|
7
|
+
render(<DropdownMenu />);
|
|
8
|
+
expect(screen.getByRole('menuitem', { name: 'Mon profil' })).toBeInTheDocument();
|
|
9
|
+
expect(screen.getByRole('menuitem', { name: 'Déconnexion' })).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('should call onSelect with the item id', async () => {
|
|
13
|
+
const user = userEvent.setup();
|
|
14
|
+
const onSelect = vi.fn();
|
|
15
|
+
render(<DropdownMenu onSelect={onSelect} />);
|
|
16
|
+
|
|
17
|
+
await user.click(screen.getByRole('menuitem', { name: 'Paramètres' }));
|
|
18
|
+
|
|
19
|
+
expect(onSelect).toHaveBeenCalledWith('settings');
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { cn } from '@/lib/cn';
|
|
2
|
+
import { Icon, type IconProps } from '@/components/Icon';
|
|
3
|
+
import styles from './DropdownMenu.module.css';
|
|
4
|
+
|
|
5
|
+
export interface DropdownItem {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
icon: IconProps['name'];
|
|
9
|
+
danger?: boolean;
|
|
10
|
+
separated?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface DropdownMenuProps {
|
|
14
|
+
items?: DropdownItem[];
|
|
15
|
+
onSelect?: (id: string) => void;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const DEFAULT_ITEMS: DropdownItem[] = [
|
|
20
|
+
{ id: 'profile', label: 'Mon profil', icon: 'user' },
|
|
21
|
+
{ id: 'settings', label: 'Paramètres', icon: 'settings' },
|
|
22
|
+
{ id: 'notifications', label: 'Notifications', icon: 'bell' },
|
|
23
|
+
{ id: 'logout', label: 'Déconnexion', icon: 'logout', danger: true, separated: true },
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export function DropdownMenu({ items = DEFAULT_ITEMS, onSelect, className }: DropdownMenuProps) {
|
|
27
|
+
return (
|
|
28
|
+
<div className={cn(styles.menu, className)} role="menu">
|
|
29
|
+
{items.map((item) => (
|
|
30
|
+
<span key={item.id} className={styles.slot}>
|
|
31
|
+
{item.separated ? <span className={styles.separator} /> : null}
|
|
32
|
+
<button
|
|
33
|
+
type="button"
|
|
34
|
+
role="menuitem"
|
|
35
|
+
className={cn(styles.item, item.danger && styles.danger)}
|
|
36
|
+
onClick={() => onSelect?.(item.id)}
|
|
37
|
+
>
|
|
38
|
+
<Icon name={item.icon} size={16} />
|
|
39
|
+
{item.label}
|
|
40
|
+
</button>
|
|
41
|
+
</span>
|
|
42
|
+
))}
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DropdownMenu, type DropdownMenuProps, type DropdownItem } from './DropdownMenu';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
.empty {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: center;
|
|
5
|
+
width: 420px;
|
|
6
|
+
max-width: 100%;
|
|
7
|
+
padding: 40px 40px 36px;
|
|
8
|
+
border: 1px dashed var(--color-border-subtle);
|
|
9
|
+
border-radius: var(--radius-lg);
|
|
10
|
+
background: var(--color-surface-empty);
|
|
11
|
+
text-align: center;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.icon {
|
|
15
|
+
display: inline-flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
width: 72px;
|
|
19
|
+
height: 72px;
|
|
20
|
+
margin-bottom: 20px;
|
|
21
|
+
border-radius: 36px;
|
|
22
|
+
background: var(--color-primary-wash);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.title {
|
|
26
|
+
margin: 0 0 8px;
|
|
27
|
+
font-size: 18px;
|
|
28
|
+
font-weight: 600;
|
|
29
|
+
line-height: 24px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.description {
|
|
33
|
+
margin: 0 0 24px;
|
|
34
|
+
color: var(--color-text-secondary);
|
|
35
|
+
font-size: 14px;
|
|
36
|
+
line-height: 21px;
|
|
37
|
+
white-space: pre-line;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.action {
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
gap: 8px;
|
|
44
|
+
padding: 12px 20px;
|
|
45
|
+
border: 0;
|
|
46
|
+
border-radius: var(--radius-sm);
|
|
47
|
+
background: var(--color-primary);
|
|
48
|
+
color: #fff;
|
|
49
|
+
font-size: 14px;
|
|
50
|
+
font-weight: 600;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { EmptyState } from './EmptyState';
|
|
4
|
+
|
|
5
|
+
describe('<EmptyState>', () => {
|
|
6
|
+
it('should render the empty message', () => {
|
|
7
|
+
render(<EmptyState title="Aucun colis" description="Les nouveaux colis apparaîtront ici." />);
|
|
8
|
+
expect(screen.getByRole('heading', { name: 'Aucun colis' })).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should call onAction when the call to action is activated', async () => {
|
|
12
|
+
const user = userEvent.setup();
|
|
13
|
+
const onAction = vi.fn();
|
|
14
|
+
render(<EmptyState title="Aucun colis" description="Commencez." onAction={onAction} />);
|
|
15
|
+
|
|
16
|
+
await user.click(screen.getByRole('button', { name: 'Envoyer un colis' }));
|
|
17
|
+
|
|
18
|
+
expect(onAction).toHaveBeenCalledOnce();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { cn } from '@/lib/cn';
|
|
2
|
+
import { Icon } from '@/components/Icon';
|
|
3
|
+
import styles from './EmptyState.module.css';
|
|
4
|
+
|
|
5
|
+
export interface EmptyStateProps {
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
actionLabel?: string;
|
|
9
|
+
onAction?: () => void;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function EmptyState({
|
|
14
|
+
title,
|
|
15
|
+
description,
|
|
16
|
+
actionLabel = 'Envoyer un colis',
|
|
17
|
+
onAction,
|
|
18
|
+
className,
|
|
19
|
+
}: EmptyStateProps) {
|
|
20
|
+
return (
|
|
21
|
+
<div className={cn(styles.empty, className)}>
|
|
22
|
+
<span className={styles.icon}>
|
|
23
|
+
<Icon name="package" size={32} />
|
|
24
|
+
</span>
|
|
25
|
+
<h2 className={styles.title}>{title}</h2>
|
|
26
|
+
<p className={styles.description}>{description}</p>
|
|
27
|
+
<button type="button" className={styles.action} onClick={onAction}>
|
|
28
|
+
<Icon name="plus" size={16} />
|
|
29
|
+
{actionLabel}
|
|
30
|
+
</button>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EmptyState, type EmptyStateProps } from './EmptyState';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.item {
|
|
2
|
+
width: 100%;
|
|
3
|
+
max-width: 648px;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
border: 1px solid #e8eaee;
|
|
6
|
+
border-radius: 12px;
|
|
7
|
+
background: #fff;
|
|
8
|
+
box-shadow: 0 4px 12px rgb(0 0 0 / 4%);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.trigger {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
width: 100%;
|
|
16
|
+
padding: 14px 16px;
|
|
17
|
+
border: 0;
|
|
18
|
+
background: transparent;
|
|
19
|
+
color: #191d26;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
font-family: inherit;
|
|
22
|
+
font-size: 14px;
|
|
23
|
+
font-weight: 500;
|
|
24
|
+
line-height: 1.3;
|
|
25
|
+
text-align: left;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.icon {
|
|
29
|
+
display: grid;
|
|
30
|
+
place-items: center;
|
|
31
|
+
width: 28px;
|
|
32
|
+
height: 28px;
|
|
33
|
+
border-radius: 14px;
|
|
34
|
+
background: #fdf4f6;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.open img {
|
|
38
|
+
transform: rotate(180deg);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.answer {
|
|
42
|
+
margin: 0;
|
|
43
|
+
padding: 0 16px 16px;
|
|
44
|
+
color: #606978;
|
|
45
|
+
font-size: 14px;
|
|
46
|
+
line-height: 1.4;
|
|
47
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { FaqItem } from './FaqItem';
|
|
4
|
+
|
|
5
|
+
describe('<FaqItem>', () => {
|
|
6
|
+
it('should reveal the answer', async () => {
|
|
7
|
+
const user = userEvent.setup();
|
|
8
|
+
render(<FaqItem />);
|
|
9
|
+
|
|
10
|
+
expect(screen.queryByText(/Indiquez le destinataire/)).not.toBeInTheDocument();
|
|
11
|
+
await user.click(screen.getByRole('button', { name: 'Comment envoyer un colis ?' }));
|
|
12
|
+
expect(screen.getByText(/Indiquez le destinataire/)).toBeInTheDocument();
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import chevron from '@/assets/icons/core-chevron.svg';
|
|
3
|
+
import { cn } from '@/lib/cn';
|
|
4
|
+
import styles from './FaqItem.module.css';
|
|
5
|
+
|
|
6
|
+
export interface FaqItemProps {
|
|
7
|
+
question?: string;
|
|
8
|
+
answer?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function FaqItem({
|
|
12
|
+
question = 'Comment envoyer un colis ?',
|
|
13
|
+
answer = 'Indiquez le destinataire, le poids et le point relais, puis confirmez l’envoi.',
|
|
14
|
+
}: FaqItemProps) {
|
|
15
|
+
const [open, setOpen] = useState(false);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div className={styles.item}>
|
|
19
|
+
<button type="button" className={styles.trigger} aria-expanded={open} onClick={() => setOpen((value) => !value)}>
|
|
20
|
+
{question}
|
|
21
|
+
<span className={cn(styles.icon, open && styles.open)}>
|
|
22
|
+
<img src={chevron} alt="" width={16} height={16} />
|
|
23
|
+
</span>
|
|
24
|
+
</button>
|
|
25
|
+
{open ? <p className={styles.answer}>{answer}</p> : null}
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FaqItem, type FaqItemProps } from './FaqItem';
|