@portnet/ui 6.0.2 → 6.0.3
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/CHANGELOG.md +652 -0
- package/dist/esm/index.js +72 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/v2/__tests__/AppMain.test.js +130 -0
- package/dist/esm/v2/__tests__/AppMain.test.js.map +1 -0
- package/dist/esm/v2/__tests__/ChartFigure.test.js +180 -0
- package/dist/esm/v2/__tests__/ChartFigure.test.js.map +1 -0
- package/dist/esm/v2/__tests__/DataGridRowActionsPropagation.test.js +150 -0
- package/dist/esm/v2/__tests__/DataGridRowActionsPropagation.test.js.map +1 -0
- package/dist/esm/v2/__tests__/DrawerTactileTargets.test.js +93 -0
- package/dist/esm/v2/__tests__/DrawerTactileTargets.test.js.map +1 -0
- package/dist/esm/v2/__tests__/FieldError.test.js +71 -38
- package/dist/esm/v2/__tests__/FieldError.test.js.map +1 -1
- package/dist/esm/v2/__tests__/FieldNaming.test.js +160 -0
- package/dist/esm/v2/__tests__/FieldNaming.test.js.map +1 -0
- package/dist/esm/v2/__tests__/FieldWidth.test.js +11 -11
- package/dist/esm/v2/__tests__/FieldWidth.test.js.map +1 -1
- package/dist/esm/v2/__tests__/FileCard.test.js +18 -17
- package/dist/esm/v2/__tests__/FileCard.test.js.map +1 -1
- package/dist/esm/v2/__tests__/FormikCheckbox.test.js +87 -179
- package/dist/esm/v2/__tests__/FormikCheckbox.test.js.map +1 -1
- package/dist/esm/v2/__tests__/FormikDateTimePicker.test.js +32 -44
- package/dist/esm/v2/__tests__/FormikDateTimePicker.test.js.map +1 -1
- package/dist/esm/v2/__tests__/FormikDisplayWidth.test.js +101 -0
- package/dist/esm/v2/__tests__/FormikDisplayWidth.test.js.map +1 -0
- package/dist/esm/v2/__tests__/FormikRadioGroup.test.js +118 -199
- package/dist/esm/v2/__tests__/FormikRadioGroup.test.js.map +1 -1
- package/dist/esm/v2/__tests__/MobileRowCard.test.js +44 -42
- package/dist/esm/v2/__tests__/MobileRowCard.test.js.map +1 -1
- package/dist/esm/v2/__tests__/PreviewDrawer.test.js +165 -0
- package/dist/esm/v2/__tests__/PreviewDrawer.test.js.map +1 -0
- package/dist/esm/v2/__tests__/ReferentielFieldContainer.test.js +156 -0
- package/dist/esm/v2/__tests__/ReferentielFieldContainer.test.js.map +1 -0
- package/dist/esm/v2/__tests__/SectionErrorBoundary.test.js +37 -52
- package/dist/esm/v2/__tests__/SectionErrorBoundary.test.js.map +1 -1
- package/dist/esm/v2/__tests__/apiError.test.js +50 -69
- package/dist/esm/v2/__tests__/apiError.test.js.map +1 -1
- package/dist/esm/v2/__tests__/banned-patterns.test.js +41 -122
- package/dist/esm/v2/__tests__/banned-patterns.test.js.map +1 -1
- package/dist/esm/v2/__tests__/chart-palette.test.js +204 -0
- package/dist/esm/v2/__tests__/chart-palette.test.js.map +1 -0
- package/dist/esm/v2/__tests__/contrast-palette.test.js +42 -74
- package/dist/esm/v2/__tests__/contrast-palette.test.js.map +1 -1
- package/dist/esm/v2/__tests__/cssVariables.test.js +44 -51
- package/dist/esm/v2/__tests__/cssVariables.test.js.map +1 -1
- package/dist/esm/v2/__tests__/fileValidation.test.js +134 -0
- package/dist/esm/v2/__tests__/fileValidation.test.js.map +1 -0
- package/dist/esm/v2/__tests__/filterCriteria.test.js +321 -0
- package/dist/esm/v2/__tests__/filterCriteria.test.js.map +1 -0
- package/dist/esm/v2/__tests__/fmtDate.test.js +68 -0
- package/dist/esm/v2/__tests__/fmtDate.test.js.map +1 -0
- package/dist/esm/v2/__tests__/gap-leakage-refonte.test.js +218 -0
- package/dist/esm/v2/__tests__/gap-leakage-refonte.test.js.map +1 -0
- package/dist/esm/v2/__tests__/labels-merge.test.js +17 -21
- package/dist/esm/v2/__tests__/labels-merge.test.js.map +1 -1
- package/dist/esm/v2/__tests__/locale-fallback.test.js +35 -40
- package/dist/esm/v2/__tests__/locale-fallback.test.js.map +1 -1
- package/dist/esm/v2/__tests__/reviveSavedCriteria.test.js +143 -0
- package/dist/esm/v2/__tests__/reviveSavedCriteria.test.js.map +1 -0
- package/dist/esm/v2/__tests__/rowActions.test.js +182 -0
- package/dist/esm/v2/__tests__/rowActions.test.js.map +1 -0
- package/dist/esm/v2/__tests__/useFocusOnRouteChange.test.js +155 -0
- package/dist/esm/v2/__tests__/useFocusOnRouteChange.test.js.map +1 -0
- package/dist/esm/v2/__tests__/useFocusTrap.test.js +266 -402
- package/dist/esm/v2/__tests__/useFocusTrap.test.js.map +1 -1
- package/dist/esm/v2/__tests__/usePrefersReducedMotion.test.js +120 -0
- package/dist/esm/v2/__tests__/usePrefersReducedMotion.test.js.map +1 -0
- package/dist/esm/v2/components/Accordion.js +48 -70
- package/dist/esm/v2/components/Accordion.js.map +1 -1
- package/dist/esm/v2/components/ActionStrip.js +31 -43
- package/dist/esm/v2/components/ActionStrip.js.map +1 -1
- package/dist/esm/v2/components/Banner.js +25 -22
- package/dist/esm/v2/components/Banner.js.map +1 -1
- package/dist/esm/v2/components/Busy.js +14 -19
- package/dist/esm/v2/components/Busy.js.map +1 -1
- package/dist/esm/v2/components/Button.js +34 -45
- package/dist/esm/v2/components/Button.js.map +1 -1
- package/dist/esm/v2/components/CategoryTag.js +44 -27
- package/dist/esm/v2/components/CategoryTag.js.map +1 -1
- package/dist/esm/v2/components/Checkbox.js +32 -38
- package/dist/esm/v2/components/Checkbox.js.map +1 -1
- package/dist/esm/v2/components/Chip.js +23 -36
- package/dist/esm/v2/components/Chip.js.map +1 -1
- package/dist/esm/v2/components/Combobox.js +112 -136
- package/dist/esm/v2/components/Combobox.js.map +1 -1
- package/dist/esm/v2/components/CommandPalette.js +113 -198
- package/dist/esm/v2/components/CommandPalette.js.map +1 -1
- package/dist/esm/v2/components/ConfirmDialog.js +36 -45
- package/dist/esm/v2/components/ConfirmDialog.js.map +1 -1
- package/dist/esm/v2/components/DatePicker.js +78 -81
- package/dist/esm/v2/components/DatePicker.js.map +1 -1
- package/dist/esm/v2/components/DateRangePicker.js +63 -74
- package/dist/esm/v2/components/DateRangePicker.js.map +1 -1
- package/dist/esm/v2/components/DateTimePicker.js +81 -86
- package/dist/esm/v2/components/DateTimePicker.js.map +1 -1
- package/dist/esm/v2/components/Drawer.js +71 -65
- package/dist/esm/v2/components/Drawer.js.map +1 -1
- package/dist/esm/v2/components/Dropzone.js +130 -177
- package/dist/esm/v2/components/Dropzone.js.map +1 -1
- package/dist/esm/v2/components/EmptyState.js +9 -9
- package/dist/esm/v2/components/EmptyState.js.map +1 -1
- package/dist/esm/v2/components/FavoriteToggle.js +24 -33
- package/dist/esm/v2/components/FavoriteToggle.js.map +1 -1
- package/dist/esm/v2/components/Field.js +155 -59
- package/dist/esm/v2/components/Field.js.map +1 -1
- package/dist/esm/v2/components/FieldError.js +9 -13
- package/dist/esm/v2/components/FieldError.js.map +1 -1
- package/dist/esm/v2/components/FieldHelp.js +28 -49
- package/dist/esm/v2/components/FieldHelp.js.map +1 -1
- package/dist/esm/v2/components/FileCard.js +14 -19
- package/dist/esm/v2/components/FileCard.js.map +1 -1
- package/dist/esm/v2/components/FilterTab.js +22 -31
- package/dist/esm/v2/components/FilterTab.js.map +1 -1
- package/dist/esm/v2/components/ForbiddenPage.js +28 -8
- package/dist/esm/v2/components/ForbiddenPage.js.map +1 -1
- package/dist/esm/v2/components/FormGrid.js +48 -54
- package/dist/esm/v2/components/FormGrid.js.map +1 -1
- package/dist/esm/v2/components/FormikDisplay.js +98 -24
- package/dist/esm/v2/components/FormikDisplay.js.map +1 -1
- package/dist/esm/v2/components/Input.js +75 -34
- package/dist/esm/v2/components/Input.js.map +1 -1
- package/dist/esm/v2/components/KPICard.js +42 -51
- package/dist/esm/v2/components/KPICard.js.map +1 -1
- package/dist/esm/v2/components/KPIStrip.js +9 -15
- package/dist/esm/v2/components/KPIStrip.js.map +1 -1
- package/dist/esm/v2/components/KV.js +16 -23
- package/dist/esm/v2/components/KV.js.map +1 -1
- package/dist/esm/v2/components/KVGrid.js +15 -23
- package/dist/esm/v2/components/KVGrid.js.map +1 -1
- package/dist/esm/v2/components/Layout.js +81 -117
- package/dist/esm/v2/components/Layout.js.map +1 -1
- package/dist/esm/v2/components/MobileRowCard.js +64 -75
- package/dist/esm/v2/components/MobileRowCard.js.map +1 -1
- package/dist/esm/v2/components/Modal.js +44 -53
- package/dist/esm/v2/components/Modal.js.map +1 -1
- package/dist/esm/v2/components/NetworkErrorPage.js +28 -11
- package/dist/esm/v2/components/NetworkErrorPage.js.map +1 -1
- package/dist/esm/v2/components/NotFoundPage.js +28 -9
- package/dist/esm/v2/components/NotFoundPage.js.map +1 -1
- package/dist/esm/v2/components/NumberInput.js +77 -107
- package/dist/esm/v2/components/NumberInput.js.map +1 -1
- package/dist/esm/v2/components/OverflowMenu.js +24 -42
- package/dist/esm/v2/components/OverflowMenu.js.map +1 -1
- package/dist/esm/v2/components/PdfViewer.js +24 -33
- package/dist/esm/v2/components/PdfViewer.js.map +1 -1
- package/dist/esm/v2/components/ProgressBar.js +28 -36
- package/dist/esm/v2/components/ProgressBar.js.map +1 -1
- package/dist/esm/v2/components/Radio.js +49 -57
- package/dist/esm/v2/components/Radio.js.map +1 -1
- package/dist/esm/v2/components/SectionErrorBoundary.js +84 -130
- package/dist/esm/v2/components/SectionErrorBoundary.js.map +1 -1
- package/dist/esm/v2/components/SectionHeader.js +24 -31
- package/dist/esm/v2/components/SectionHeader.js.map +1 -1
- package/dist/esm/v2/components/Segmented.js +59 -84
- package/dist/esm/v2/components/Segmented.js.map +1 -1
- package/dist/esm/v2/components/Select.js +100 -138
- package/dist/esm/v2/components/Select.js.map +1 -1
- package/dist/esm/v2/components/ServerErrorPage.js +27 -10
- package/dist/esm/v2/components/ServerErrorPage.js.map +1 -1
- package/dist/esm/v2/components/Skeleton.js +81 -96
- package/dist/esm/v2/components/Skeleton.js.map +1 -1
- package/dist/esm/v2/components/SkipLink.js +6 -7
- package/dist/esm/v2/components/SkipLink.js.map +1 -1
- package/dist/esm/v2/components/Spinner.js +13 -22
- package/dist/esm/v2/components/Spinner.js.map +1 -1
- package/dist/esm/v2/components/Status.js +14 -25
- package/dist/esm/v2/components/Status.js.map +1 -1
- package/dist/esm/v2/components/Stepper.js +68 -71
- package/dist/esm/v2/components/Stepper.js.map +1 -1
- package/dist/esm/v2/components/Surface.js +25 -44
- package/dist/esm/v2/components/Surface.js.map +1 -1
- package/dist/esm/v2/components/Switch.js +21 -29
- package/dist/esm/v2/components/Switch.js.map +1 -1
- package/dist/esm/v2/components/TabPanel.js +84 -0
- package/dist/esm/v2/components/TabPanel.js.map +1 -0
- package/dist/esm/v2/components/Tabs.js +43 -19
- package/dist/esm/v2/components/Tabs.js.map +1 -1
- package/dist/esm/v2/components/TelInput.js +75 -108
- package/dist/esm/v2/components/TelInput.js.map +1 -1
- package/dist/esm/v2/components/Textarea.js +21 -30
- package/dist/esm/v2/components/Textarea.js.map +1 -1
- package/dist/esm/v2/components/TimePicker.js +59 -69
- package/dist/esm/v2/components/TimePicker.js.map +1 -1
- package/dist/esm/v2/components/Toast.js +109 -163
- package/dist/esm/v2/components/Toast.js.map +1 -1
- package/dist/esm/v2/components/Tooltip.js +18 -31
- package/dist/esm/v2/components/Tooltip.js.map +1 -1
- package/dist/esm/v2/components/_ErrorPageBody.js +6 -5
- package/dist/esm/v2/components/_ErrorPageBody.js.map +1 -1
- package/dist/esm/v2/components/_pickerShared.js +2 -2
- package/dist/esm/v2/components/_pickerShared.js.map +1 -1
- package/dist/esm/v2/components/index.js +37 -0
- package/dist/esm/v2/components/index.js.map +1 -1
- package/dist/esm/v2/hooks/index.js +62 -0
- package/dist/esm/v2/hooks/index.js.map +1 -1
- package/dist/esm/v2/hooks/useAppliedFilters.js +112 -0
- package/dist/esm/v2/hooks/useAppliedFilters.js.map +1 -0
- package/dist/esm/v2/hooks/useDebouncedCallback.js +82 -0
- package/dist/esm/v2/hooks/useDebouncedCallback.js.map +1 -0
- package/dist/esm/v2/hooks/useDelayedFlag.js +5 -19
- package/dist/esm/v2/hooks/useDelayedFlag.js.map +1 -1
- package/dist/esm/v2/hooks/useDensity.js +13 -17
- package/dist/esm/v2/hooks/useDensity.js.map +1 -1
- package/dist/esm/v2/hooks/useFocusFirstError.js +25 -33
- package/dist/esm/v2/hooks/useFocusFirstError.js.map +1 -1
- package/dist/esm/v2/hooks/useFocusOnRouteChange.js +81 -0
- package/dist/esm/v2/hooks/useFocusOnRouteChange.js.map +1 -0
- package/dist/esm/v2/hooks/useFocusTrap.js +19 -23
- package/dist/esm/v2/hooks/useFocusTrap.js.map +1 -1
- package/dist/esm/v2/hooks/useFormAutoSave.js +38 -53
- package/dist/esm/v2/hooks/useFormAutoSave.js.map +1 -1
- package/dist/esm/v2/hooks/useFormCompletionProgress.js +32 -51
- package/dist/esm/v2/hooks/useFormCompletionProgress.js.map +1 -1
- package/dist/esm/v2/hooks/useKeyboardShortcuts.js +125 -0
- package/dist/esm/v2/hooks/useKeyboardShortcuts.js.map +1 -0
- package/dist/esm/v2/hooks/usePrefersReducedMotion.js +99 -0
- package/dist/esm/v2/hooks/usePrefersReducedMotion.js.map +1 -0
- package/dist/esm/v2/hooks/useResolvedDensity.js +2 -10
- package/dist/esm/v2/hooks/useResolvedDensity.js.map +1 -1
- package/dist/esm/v2/hooks/useSortedRows.js +3 -5
- package/dist/esm/v2/hooks/useSortedRows.js.map +1 -1
- package/dist/esm/v2/hooks/useTabLoading.js +6 -21
- package/dist/esm/v2/hooks/useTabLoading.js.map +1 -1
- package/dist/esm/v2/index.js +2 -3
- package/dist/esm/v2/index.js.map +1 -1
- package/dist/esm/v2/modalContext.js +2 -2
- package/dist/esm/v2/modalContext.js.map +1 -1
- package/dist/esm/v2/models/favorite.js.map +1 -1
- package/dist/esm/v2/models/personalization.js.map +1 -1
- package/dist/esm/v2/models/referentiel.js.map +1 -1
- package/dist/esm/v2/models/savedFilter.js.map +1 -1
- package/dist/esm/v2/patterns/ActionBar.js +115 -159
- package/dist/esm/v2/patterns/ActionBar.js.map +1 -1
- package/dist/esm/v2/patterns/AppMain.js +108 -0
- package/dist/esm/v2/patterns/AppMain.js.map +1 -0
- package/dist/esm/v2/patterns/BulkActionBar.js +31 -34
- package/dist/esm/v2/patterns/BulkActionBar.js.map +1 -1
- package/dist/esm/v2/patterns/ChartFigure.js +151 -0
- package/dist/esm/v2/patterns/ChartFigure.js.map +1 -0
- package/dist/esm/v2/patterns/CollapsibleDataGrid.js +111 -152
- package/dist/esm/v2/patterns/CollapsibleDataGrid.js.map +1 -1
- package/dist/esm/v2/patterns/ColumnsToggle.js +43 -77
- package/dist/esm/v2/patterns/ColumnsToggle.js.map +1 -1
- package/dist/esm/v2/patterns/DataGrid.js +221 -255
- package/dist/esm/v2/patterns/DataGrid.js.map +1 -1
- package/dist/esm/v2/patterns/DataGridSettingsMenu.js +76 -94
- package/dist/esm/v2/patterns/DataGridSettingsMenu.js.map +1 -1
- package/dist/esm/v2/patterns/DataGridToolbar.js +85 -89
- package/dist/esm/v2/patterns/DataGridToolbar.js.map +1 -1
- package/dist/esm/v2/patterns/DataGridVirtualized.js +141 -182
- package/dist/esm/v2/patterns/DataGridVirtualized.js.map +1 -1
- package/dist/esm/v2/patterns/DeleteResourceConfirmDialog.js +26 -30
- package/dist/esm/v2/patterns/DeleteResourceConfirmDialog.js.map +1 -1
- package/dist/esm/v2/patterns/DetailSplit.js +108 -0
- package/dist/esm/v2/patterns/DetailSplit.js.map +1 -0
- package/dist/esm/v2/patterns/FavoriteColumn.js +15 -17
- package/dist/esm/v2/patterns/FavoriteColumn.js.map +1 -1
- package/dist/esm/v2/patterns/FavoritesFilter.js +30 -39
- package/dist/esm/v2/patterns/FavoritesFilter.js.map +1 -1
- package/dist/esm/v2/patterns/FilterTabBar.js +112 -0
- package/dist/esm/v2/patterns/FilterTabBar.js.map +1 -0
- package/dist/esm/v2/patterns/FormErrorSummary.js +12 -13
- package/dist/esm/v2/patterns/FormErrorSummary.js.map +1 -1
- package/dist/esm/v2/patterns/FormPageShell.js +43 -41
- package/dist/esm/v2/patterns/FormPageShell.js.map +1 -1
- package/dist/esm/v2/patterns/FormSection.js +30 -38
- package/dist/esm/v2/patterns/FormSection.js.map +1 -1
- package/dist/esm/v2/patterns/FormikCheckbox.js +29 -39
- package/dist/esm/v2/patterns/FormikCheckbox.js.map +1 -1
- package/dist/esm/v2/patterns/FormikCheckboxGroup.js +56 -60
- package/dist/esm/v2/patterns/FormikCheckboxGroup.js.map +1 -1
- package/dist/esm/v2/patterns/FormikCombobox.js +51 -69
- package/dist/esm/v2/patterns/FormikCombobox.js.map +1 -1
- package/dist/esm/v2/patterns/FormikDatePicker.js +44 -58
- package/dist/esm/v2/patterns/FormikDatePicker.js.map +1 -1
- package/dist/esm/v2/patterns/FormikDateTimePicker.js +44 -58
- package/dist/esm/v2/patterns/FormikDateTimePicker.js.map +1 -1
- package/dist/esm/v2/patterns/FormikErrorFocus.js +22 -23
- package/dist/esm/v2/patterns/FormikErrorFocus.js.map +1 -1
- package/dist/esm/v2/patterns/FormikErrorSummary.js +89 -0
- package/dist/esm/v2/patterns/FormikErrorSummary.js.map +1 -0
- package/dist/esm/v2/patterns/FormikFile.js +94 -78
- package/dist/esm/v2/patterns/FormikFile.js.map +1 -1
- package/dist/esm/v2/patterns/FormikInput.js +40 -53
- package/dist/esm/v2/patterns/FormikInput.js.map +1 -1
- package/dist/esm/v2/patterns/FormikRadioGroup.js +39 -51
- package/dist/esm/v2/patterns/FormikRadioGroup.js.map +1 -1
- package/dist/esm/v2/patterns/FormikReferentielField.js +49 -59
- package/dist/esm/v2/patterns/FormikReferentielField.js.map +1 -1
- package/dist/esm/v2/patterns/FormikSelect.js +64 -87
- package/dist/esm/v2/patterns/FormikSelect.js.map +1 -1
- package/dist/esm/v2/patterns/FormikTextarea.js +30 -46
- package/dist/esm/v2/patterns/FormikTextarea.js.map +1 -1
- package/dist/esm/v2/patterns/KeyboardShortcutsHelp.js +53 -71
- package/dist/esm/v2/patterns/KeyboardShortcutsHelp.js.map +1 -1
- package/dist/esm/v2/patterns/NetworkErrorBanner.js +6 -7
- package/dist/esm/v2/patterns/NetworkErrorBanner.js.map +1 -1
- package/dist/esm/v2/patterns/PageContent.js +10 -14
- package/dist/esm/v2/patterns/PageContent.js.map +1 -1
- package/dist/esm/v2/patterns/PreviewDrawer.js +153 -0
- package/dist/esm/v2/patterns/PreviewDrawer.js.map +1 -0
- package/dist/esm/v2/patterns/ReferentielField.js +327 -312
- package/dist/esm/v2/patterns/ReferentielField.js.map +1 -1
- package/dist/esm/v2/patterns/RowFavoriteToggle.js +27 -22
- package/dist/esm/v2/patterns/RowFavoriteToggle.js.map +1 -1
- package/dist/esm/v2/patterns/SaveFilterDialog.js +38 -66
- package/dist/esm/v2/patterns/SaveFilterDialog.js.map +1 -1
- package/dist/esm/v2/patterns/SavedFiltersMenu.js +62 -81
- package/dist/esm/v2/patterns/SavedFiltersMenu.js.map +1 -1
- package/dist/esm/v2/patterns/SkeletonPageShell.js +106 -129
- package/dist/esm/v2/patterns/SkeletonPageShell.js.map +1 -1
- package/dist/esm/v2/patterns/SortableHeader.js +22 -45
- package/dist/esm/v2/patterns/SortableHeader.js.map +1 -1
- package/dist/esm/v2/patterns/Tour.js +94 -120
- package/dist/esm/v2/patterns/Tour.js.map +1 -1
- package/dist/esm/v2/patterns/_dataGridShared.js +107 -128
- package/dist/esm/v2/patterns/_dataGridShared.js.map +1 -1
- package/dist/esm/v2/patterns/_pickerSerialisation.js +6 -8
- package/dist/esm/v2/patterns/_pickerSerialisation.js.map +1 -1
- package/dist/esm/v2/patterns/_sort.js +17 -33
- package/dist/esm/v2/patterns/_sort.js.map +1 -1
- package/dist/esm/v2/patterns/_useColumnReorder.js +122 -160
- package/dist/esm/v2/patterns/_useColumnReorder.js.map +1 -1
- package/dist/esm/v2/patterns/_useColumnResize.js +78 -96
- package/dist/esm/v2/patterns/_useColumnResize.js.map +1 -1
- package/dist/esm/v2/patterns/filterCriteria.js +102 -0
- package/dist/esm/v2/patterns/filterCriteria.js.map +1 -0
- package/dist/esm/v2/patterns/index.js +152 -0
- package/dist/esm/v2/patterns/index.js.map +1 -1
- package/dist/esm/v2/patterns/rowActions.js +223 -0
- package/dist/esm/v2/patterns/rowActions.js.map +1 -0
- package/dist/esm/v2/personalization/PersonalizationProvider.js +50 -47
- package/dist/esm/v2/personalization/PersonalizationProvider.js.map +1 -1
- package/dist/esm/v2/personalization/adapters/_storageKey.js +5 -5
- package/dist/esm/v2/personalization/adapters/_storageKey.js.map +1 -1
- package/dist/esm/v2/personalization/adapters/createLocalStorageAdapter.js +22 -23
- package/dist/esm/v2/personalization/adapters/createLocalStorageAdapter.js.map +1 -1
- package/dist/esm/v2/personalization/adapters/createMemoryAdapter.js +13 -13
- package/dist/esm/v2/personalization/adapters/createMemoryAdapter.js.map +1 -1
- package/dist/esm/v2/personalization/capabilities/favorites.js +36 -60
- package/dist/esm/v2/personalization/capabilities/favorites.js.map +1 -1
- package/dist/esm/v2/personalization/capabilities/favoritesView.js +22 -34
- package/dist/esm/v2/personalization/capabilities/favoritesView.js.map +1 -1
- package/dist/esm/v2/personalization/capabilities/gridPreferences.js +28 -34
- package/dist/esm/v2/personalization/capabilities/gridPreferences.js.map +1 -1
- package/dist/esm/v2/personalization/capabilities/reviveSavedCriteria.js +119 -0
- package/dist/esm/v2/personalization/capabilities/reviveSavedCriteria.js.map +1 -0
- package/dist/esm/v2/personalization/capabilities/savedFilters.js +90 -98
- package/dist/esm/v2/personalization/capabilities/savedFilters.js.map +1 -1
- package/dist/esm/v2/personalization/createPersonalizationStore.js +78 -181
- package/dist/esm/v2/personalization/createPersonalizationStore.js.map +1 -1
- package/dist/esm/v2/personalization/index.js +17 -0
- package/dist/esm/v2/personalization/index.js.map +1 -1
- package/dist/esm/v2/personalization/personalizationContext.js +9 -9
- package/dist/esm/v2/personalization/personalizationContext.js.map +1 -1
- package/dist/esm/v2/personalization/schema.js +8 -9
- package/dist/esm/v2/personalization/schema.js.map +1 -1
- package/dist/esm/v2/referentiel/ReferentielProvider.js +27 -42
- package/dist/esm/v2/referentiel/ReferentielProvider.js.map +1 -1
- package/dist/esm/v2/referentiel/types.js +2 -0
- package/dist/esm/v2/referentiel/types.js.map +1 -0
- package/dist/esm/v2/referentiel/useReferentielClient.js +10 -11
- package/dist/esm/v2/referentiel/useReferentielClient.js.map +1 -1
- package/dist/esm/v2/referentiel/useReferentielOptions.js +60 -117
- package/dist/esm/v2/referentiel/useReferentielOptions.js.map +1 -1
- package/dist/esm/v2/referentiel/useReferentielSearch.js +37 -91
- package/dist/esm/v2/referentiel/useReferentielSearch.js.map +1 -1
- package/dist/esm/v2/theme/_brand.js +8 -24
- package/dist/esm/v2/theme/_brand.js.map +1 -1
- package/dist/esm/v2/theme/_brandSecondary.js +8 -24
- package/dist/esm/v2/theme/_brandSecondary.js.map +1 -1
- package/dist/esm/v2/theme/createPortnetTheme.js +51 -61
- package/dist/esm/v2/theme/createPortnetTheme.js.map +1 -1
- package/dist/esm/v2/theme/cssVariables.js +62 -69
- package/dist/esm/v2/theme/cssVariables.js.map +1 -1
- package/dist/esm/v2/theme/index.js +5 -5
- package/dist/esm/v2/theme/index.js.map +1 -1
- package/dist/esm/v2/tokens/breakpoints.js +14 -14
- package/dist/esm/v2/tokens/breakpoints.js.map +1 -1
- package/dist/esm/v2/tokens/chart.js +261 -0
- package/dist/esm/v2/tokens/chart.js.map +1 -0
- package/dist/esm/v2/tokens/colors.js +22 -22
- package/dist/esm/v2/tokens/colors.js.map +1 -1
- package/dist/esm/v2/tokens/density.js +62 -7
- package/dist/esm/v2/tokens/density.js.map +1 -1
- package/dist/esm/v2/tokens/index.js +49 -34
- package/dist/esm/v2/tokens/index.js.map +1 -1
- package/dist/esm/v2/tokens/motion.js +12 -20
- package/dist/esm/v2/tokens/motion.js.map +1 -1
- package/dist/esm/v2/tokens/radius.js +1 -1
- package/dist/esm/v2/tokens/radius.js.map +1 -1
- package/dist/esm/v2/tokens/shadows.js +6 -6
- package/dist/esm/v2/tokens/shadows.js.map +1 -1
- package/dist/esm/v2/tokens/spacing.js +2 -2
- package/dist/esm/v2/tokens/spacing.js.map +1 -1
- package/dist/esm/v2/tokens/state.js +1 -1
- package/dist/esm/v2/tokens/state.js.map +1 -1
- package/dist/esm/v2/tokens/statusPalette.js +17 -21
- package/dist/esm/v2/tokens/statusPalette.js.map +1 -1
- package/dist/esm/v2/tokens/tokens.json +6 -1
- package/dist/esm/v2/tokens/typography.js +13 -13
- package/dist/esm/v2/tokens/typography.js.map +1 -1
- package/dist/esm/v2/tokens/zIndex.js +1 -1
- package/dist/esm/v2/tokens/zIndex.js.map +1 -1
- package/dist/esm/v2/types/datagrid.js.map +1 -1
- package/dist/esm/v2/utils/apiError.js +16 -37
- package/dist/esm/v2/utils/apiError.js.map +1 -1
- package/dist/esm/v2/utils/contrast.js +31 -32
- package/dist/esm/v2/utils/contrast.js.map +1 -1
- package/dist/esm/v2/utils/cx.js +5 -25
- package/dist/esm/v2/utils/cx.js.map +1 -1
- package/dist/esm/v2/utils/fileDownload.js +23 -26
- package/dist/esm/v2/utils/fileDownload.js.map +1 -1
- package/dist/esm/v2/utils/fileValidation.js +209 -0
- package/dist/esm/v2/utils/fileValidation.js.map +1 -0
- package/dist/esm/v2/utils/fmtDate.js +111 -0
- package/dist/esm/v2/utils/fmtDate.js.map +1 -0
- package/dist/esm/v2/utils/fmtMoney.js +8 -10
- package/dist/esm/v2/utils/fmtMoney.js.map +1 -1
- package/dist/esm/v2/utils/formikErrors.js +78 -0
- package/dist/esm/v2/utils/formikErrors.js.map +1 -0
- package/dist/esm/v2/utils/index.js +35 -2
- package/dist/esm/v2/utils/index.js.map +1 -1
- package/dist/esm/v2/utils/mergeLabels.js +7 -12
- package/dist/esm/v2/utils/mergeLabels.js.map +1 -1
- package/dist/esm/v2/utils/networkStatus.js +12 -12
- package/dist/esm/v2/utils/networkStatus.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +110 -49
- package/dist/index.js.map +1 -1
- package/dist/v2/__tests__/AppMain.test.js +133 -0
- package/dist/v2/__tests__/AppMain.test.js.map +1 -0
- package/dist/v2/__tests__/ChartFigure.test.js +183 -0
- package/dist/v2/__tests__/ChartFigure.test.js.map +1 -0
- package/dist/v2/__tests__/DataGridRowActionsPropagation.test.js +153 -0
- package/dist/v2/__tests__/DataGridRowActionsPropagation.test.js.map +1 -0
- package/dist/v2/__tests__/DrawerTactileTargets.test.js +94 -0
- package/dist/v2/__tests__/DrawerTactileTargets.test.js.map +1 -0
- package/dist/v2/__tests__/FieldError.test.js +82 -49
- package/dist/v2/__tests__/FieldError.test.js.map +1 -1
- package/dist/v2/__tests__/FieldNaming.test.js +161 -0
- package/dist/v2/__tests__/FieldNaming.test.js.map +1 -0
- package/dist/v2/__tests__/FieldWidth.test.js +23 -25
- package/dist/v2/__tests__/FieldWidth.test.js.map +1 -1
- package/dist/v2/__tests__/FileCard.test.js +29 -28
- package/dist/v2/__tests__/FileCard.test.js.map +1 -1
- package/dist/v2/__tests__/FormikCheckbox.test.js +90 -183
- package/dist/v2/__tests__/FormikCheckbox.test.js.map +1 -1
- package/dist/v2/__tests__/FormikDateTimePicker.test.js +38 -48
- package/dist/v2/__tests__/FormikDateTimePicker.test.js.map +1 -1
- package/dist/v2/__tests__/FormikDisplayWidth.test.js +102 -0
- package/dist/v2/__tests__/FormikDisplayWidth.test.js.map +1 -0
- package/dist/v2/__tests__/FormikRadioGroup.test.js +123 -204
- package/dist/v2/__tests__/FormikRadioGroup.test.js.map +1 -1
- package/dist/v2/__tests__/MobileRowCard.test.js +63 -61
- package/dist/v2/__tests__/MobileRowCard.test.js.map +1 -1
- package/dist/v2/__tests__/PreviewDrawer.test.js +169 -0
- package/dist/v2/__tests__/PreviewDrawer.test.js.map +1 -0
- package/dist/v2/__tests__/ReferentielFieldContainer.test.js +159 -0
- package/dist/v2/__tests__/ReferentielFieldContainer.test.js.map +1 -0
- package/dist/v2/__tests__/SectionErrorBoundary.test.js +53 -68
- package/dist/v2/__tests__/SectionErrorBoundary.test.js.map +1 -1
- package/dist/v2/__tests__/apiError.test.js +50 -69
- package/dist/v2/__tests__/apiError.test.js.map +1 -1
- package/dist/v2/__tests__/banned-patterns.test.js +42 -123
- package/dist/v2/__tests__/banned-patterns.test.js.map +1 -1
- package/dist/v2/__tests__/chart-palette.test.js +205 -0
- package/dist/v2/__tests__/chart-palette.test.js.map +1 -0
- package/dist/v2/__tests__/contrast-palette.test.js +42 -74
- package/dist/v2/__tests__/contrast-palette.test.js.map +1 -1
- package/dist/v2/__tests__/cssVariables.test.js +44 -51
- package/dist/v2/__tests__/cssVariables.test.js.map +1 -1
- package/dist/v2/__tests__/fileValidation.test.js +136 -0
- package/dist/v2/__tests__/fileValidation.test.js.map +1 -0
- package/dist/v2/__tests__/filterCriteria.test.js +324 -0
- package/dist/v2/__tests__/filterCriteria.test.js.map +1 -0
- package/dist/v2/__tests__/fmtDate.test.js +69 -0
- package/dist/v2/__tests__/fmtDate.test.js.map +1 -0
- package/dist/v2/__tests__/gap-leakage-refonte.test.js +221 -0
- package/dist/v2/__tests__/gap-leakage-refonte.test.js.map +1 -0
- package/dist/v2/__tests__/labels-merge.test.js +23 -27
- package/dist/v2/__tests__/labels-merge.test.js.map +1 -1
- package/dist/v2/__tests__/locale-fallback.test.js +47 -52
- package/dist/v2/__tests__/locale-fallback.test.js.map +1 -1
- package/dist/v2/__tests__/reviveSavedCriteria.test.js +144 -0
- package/dist/v2/__tests__/reviveSavedCriteria.test.js.map +1 -0
- package/dist/v2/__tests__/rowActions.test.js +186 -0
- package/dist/v2/__tests__/rowActions.test.js.map +1 -0
- package/dist/v2/__tests__/useFocusOnRouteChange.test.js +156 -0
- package/dist/v2/__tests__/useFocusOnRouteChange.test.js.map +1 -0
- package/dist/v2/__tests__/useFocusTrap.test.js +270 -407
- package/dist/v2/__tests__/useFocusTrap.test.js.map +1 -1
- package/dist/v2/__tests__/usePrefersReducedMotion.test.js +123 -0
- package/dist/v2/__tests__/usePrefersReducedMotion.test.js.map +1 -0
- package/dist/v2/components/Accordion.js +60 -82
- package/dist/v2/components/Accordion.js.map +1 -1
- package/dist/v2/components/ActionStrip.js +40 -52
- package/dist/v2/components/ActionStrip.js.map +1 -1
- package/dist/v2/components/Banner.js +42 -41
- package/dist/v2/components/Banner.js.map +1 -1
- package/dist/v2/components/Busy.js +22 -27
- package/dist/v2/components/Busy.js.map +1 -1
- package/dist/v2/components/Button.js +39 -50
- package/dist/v2/components/Button.js.map +1 -1
- package/dist/v2/components/CategoryTag.d.ts.map +1 -1
- package/dist/v2/components/CategoryTag.js +49 -32
- package/dist/v2/components/CategoryTag.js.map +1 -1
- package/dist/v2/components/Checkbox.js +39 -45
- package/dist/v2/components/Checkbox.js.map +1 -1
- package/dist/v2/components/Chip.js +29 -42
- package/dist/v2/components/Chip.js.map +1 -1
- package/dist/v2/components/Combobox.js +122 -144
- package/dist/v2/components/Combobox.js.map +1 -1
- package/dist/v2/components/CommandPalette.js +138 -225
- package/dist/v2/components/CommandPalette.js.map +1 -1
- package/dist/v2/components/ConfirmDialog.js +46 -56
- package/dist/v2/components/ConfirmDialog.js.map +1 -1
- package/dist/v2/components/DatePicker.js +81 -86
- package/dist/v2/components/DatePicker.js.map +1 -1
- package/dist/v2/components/DateRangePicker.js +77 -87
- package/dist/v2/components/DateRangePicker.js.map +1 -1
- package/dist/v2/components/DateTimePicker.js +84 -91
- package/dist/v2/components/DateTimePicker.js.map +1 -1
- package/dist/v2/components/Drawer.d.ts.map +1 -1
- package/dist/v2/components/Drawer.js +93 -88
- package/dist/v2/components/Drawer.js.map +1 -1
- package/dist/v2/components/Dropzone.js +150 -196
- package/dist/v2/components/Dropzone.js.map +1 -1
- package/dist/v2/components/EmptyState.js +18 -20
- package/dist/v2/components/EmptyState.js.map +1 -1
- package/dist/v2/components/FavoriteToggle.js +28 -39
- package/dist/v2/components/FavoriteToggle.js.map +1 -1
- package/dist/v2/components/Field.d.ts +62 -4
- package/dist/v2/components/Field.d.ts.map +1 -1
- package/dist/v2/components/Field.js +169 -70
- package/dist/v2/components/Field.js.map +1 -1
- package/dist/v2/components/FieldError.js +18 -21
- package/dist/v2/components/FieldError.js.map +1 -1
- package/dist/v2/components/FieldHelp.js +40 -60
- package/dist/v2/components/FieldHelp.js.map +1 -1
- package/dist/v2/components/FileCard.js +27 -31
- package/dist/v2/components/FileCard.js.map +1 -1
- package/dist/v2/components/FilterTab.js +30 -38
- package/dist/v2/components/FilterTab.js.map +1 -1
- package/dist/v2/components/ForbiddenPage.d.ts +25 -1
- package/dist/v2/components/ForbiddenPage.d.ts.map +1 -1
- package/dist/v2/components/ForbiddenPage.js +37 -17
- package/dist/v2/components/ForbiddenPage.js.map +1 -1
- package/dist/v2/components/FormGrid.js +53 -59
- package/dist/v2/components/FormGrid.js.map +1 -1
- package/dist/v2/components/FormikDisplay.d.ts +50 -1
- package/dist/v2/components/FormikDisplay.d.ts.map +1 -1
- package/dist/v2/components/FormikDisplay.js +108 -33
- package/dist/v2/components/FormikDisplay.js.map +1 -1
- package/dist/v2/components/Input.d.ts +40 -0
- package/dist/v2/components/Input.d.ts.map +1 -1
- package/dist/v2/components/Input.js +81 -41
- package/dist/v2/components/Input.js.map +1 -1
- package/dist/v2/components/KPICard.js +57 -67
- package/dist/v2/components/KPICard.js.map +1 -1
- package/dist/v2/components/KPIStrip.js +16 -22
- package/dist/v2/components/KPIStrip.js.map +1 -1
- package/dist/v2/components/KV.js +25 -31
- package/dist/v2/components/KV.js.map +1 -1
- package/dist/v2/components/KVGrid.js +19 -26
- package/dist/v2/components/KVGrid.js.map +1 -1
- package/dist/v2/components/Layout.js +91 -120
- package/dist/v2/components/Layout.js.map +1 -1
- package/dist/v2/components/MobileRowCard.js +79 -91
- package/dist/v2/components/MobileRowCard.js.map +1 -1
- package/dist/v2/components/Modal.js +61 -69
- package/dist/v2/components/Modal.js.map +1 -1
- package/dist/v2/components/NetworkErrorPage.d.ts +19 -1
- package/dist/v2/components/NetworkErrorPage.d.ts.map +1 -1
- package/dist/v2/components/NetworkErrorPage.js +38 -21
- package/dist/v2/components/NetworkErrorPage.js.map +1 -1
- package/dist/v2/components/NotFoundPage.d.ts +17 -1
- package/dist/v2/components/NotFoundPage.d.ts.map +1 -1
- package/dist/v2/components/NotFoundPage.js +37 -18
- package/dist/v2/components/NotFoundPage.js.map +1 -1
- package/dist/v2/components/NumberInput.js +88 -118
- package/dist/v2/components/NumberInput.js.map +1 -1
- package/dist/v2/components/OverflowMenu.js +38 -56
- package/dist/v2/components/OverflowMenu.js.map +1 -1
- package/dist/v2/components/PdfViewer.js +34 -45
- package/dist/v2/components/PdfViewer.js.map +1 -1
- package/dist/v2/components/ProgressBar.js +42 -49
- package/dist/v2/components/ProgressBar.js.map +1 -1
- package/dist/v2/components/Radio.js +59 -67
- package/dist/v2/components/Radio.js.map +1 -1
- package/dist/v2/components/SectionErrorBoundary.js +90 -135
- package/dist/v2/components/SectionErrorBoundary.js.map +1 -1
- package/dist/v2/components/SectionHeader.js +34 -41
- package/dist/v2/components/SectionHeader.js.map +1 -1
- package/dist/v2/components/Segmented.js +69 -93
- package/dist/v2/components/Segmented.js.map +1 -1
- package/dist/v2/components/Select.d.ts +26 -2
- package/dist/v2/components/Select.d.ts.map +1 -1
- package/dist/v2/components/Select.js +120 -155
- package/dist/v2/components/Select.js.map +1 -1
- package/dist/v2/components/ServerErrorPage.d.ts +27 -1
- package/dist/v2/components/ServerErrorPage.d.ts.map +1 -1
- package/dist/v2/components/ServerErrorPage.js +37 -20
- package/dist/v2/components/ServerErrorPage.js.map +1 -1
- package/dist/v2/components/Skeleton.js +86 -100
- package/dist/v2/components/Skeleton.js.map +1 -1
- package/dist/v2/components/SkipLink.js +9 -12
- package/dist/v2/components/SkipLink.js.map +1 -1
- package/dist/v2/components/Spinner.js +16 -25
- package/dist/v2/components/Spinner.js.map +1 -1
- package/dist/v2/components/Status.js +18 -29
- package/dist/v2/components/Status.js.map +1 -1
- package/dist/v2/components/Stepper.js +80 -82
- package/dist/v2/components/Stepper.js.map +1 -1
- package/dist/v2/components/Surface.js +34 -49
- package/dist/v2/components/Surface.js.map +1 -1
- package/dist/v2/components/Switch.js +29 -37
- package/dist/v2/components/Switch.js.map +1 -1
- package/dist/v2/components/TabPanel.d.ts +17 -0
- package/dist/v2/components/TabPanel.d.ts.map +1 -0
- package/dist/v2/components/TabPanel.js +90 -0
- package/dist/v2/components/TabPanel.js.map +1 -0
- package/dist/v2/components/Tabs.d.ts +25 -0
- package/dist/v2/components/Tabs.d.ts.map +1 -1
- package/dist/v2/components/Tabs.js +53 -29
- package/dist/v2/components/Tabs.js.map +1 -1
- package/dist/v2/components/TelInput.js +80 -115
- package/dist/v2/components/TelInput.js.map +1 -1
- package/dist/v2/components/Textarea.js +26 -35
- package/dist/v2/components/Textarea.js.map +1 -1
- package/dist/v2/components/TimePicker.js +62 -74
- package/dist/v2/components/TimePicker.js.map +1 -1
- package/dist/v2/components/Toast.js +119 -174
- package/dist/v2/components/Toast.js.map +1 -1
- package/dist/v2/components/Tooltip.js +23 -38
- package/dist/v2/components/Tooltip.js.map +1 -1
- package/dist/v2/components/_ErrorPageBody.js +15 -16
- package/dist/v2/components/_ErrorPageBody.js.map +1 -1
- package/dist/v2/components/_pickerShared.js +5 -5
- package/dist/v2/components/_pickerShared.js.map +1 -1
- package/dist/v2/components/index.d.ts +40 -1
- package/dist/v2/components/index.d.ts.map +1 -1
- package/dist/v2/components/index.js +153 -136
- package/dist/v2/components/index.js.map +1 -1
- package/dist/v2/hooks/index.d.ts +65 -0
- package/dist/v2/hooks/index.d.ts.map +1 -1
- package/dist/v2/hooks/index.js +63 -24
- package/dist/v2/hooks/index.js.map +1 -1
- package/dist/v2/hooks/useAppliedFilters.d.ts +102 -0
- package/dist/v2/hooks/useAppliedFilters.d.ts.map +1 -0
- package/dist/v2/hooks/useAppliedFilters.js +117 -0
- package/dist/v2/hooks/useAppliedFilters.js.map +1 -0
- package/dist/v2/hooks/useDebouncedCallback.d.ts +64 -0
- package/dist/v2/hooks/useDebouncedCallback.d.ts.map +1 -0
- package/dist/v2/hooks/useDebouncedCallback.js +87 -0
- package/dist/v2/hooks/useDebouncedCallback.js.map +1 -0
- package/dist/v2/hooks/useDelayedFlag.js +6 -20
- package/dist/v2/hooks/useDelayedFlag.js.map +1 -1
- package/dist/v2/hooks/useDensity.d.ts.map +1 -1
- package/dist/v2/hooks/useDensity.js +14 -18
- package/dist/v2/hooks/useDensity.js.map +1 -1
- package/dist/v2/hooks/useFocusFirstError.js +26 -34
- package/dist/v2/hooks/useFocusFirstError.js.map +1 -1
- package/dist/v2/hooks/useFocusOnRouteChange.d.ts +65 -0
- package/dist/v2/hooks/useFocusOnRouteChange.d.ts.map +1 -0
- package/dist/v2/hooks/useFocusOnRouteChange.js +88 -0
- package/dist/v2/hooks/useFocusOnRouteChange.js.map +1 -0
- package/dist/v2/hooks/useFocusTrap.js +20 -24
- package/dist/v2/hooks/useFocusTrap.js.map +1 -1
- package/dist/v2/hooks/useFormAutoSave.d.ts +4 -4
- package/dist/v2/hooks/useFormAutoSave.d.ts.map +1 -1
- package/dist/v2/hooks/useFormAutoSave.js +39 -54
- package/dist/v2/hooks/useFormAutoSave.js.map +1 -1
- package/dist/v2/hooks/useFormCompletionProgress.d.ts +1 -1
- package/dist/v2/hooks/useFormCompletionProgress.d.ts.map +1 -1
- package/dist/v2/hooks/useFormCompletionProgress.js +33 -52
- package/dist/v2/hooks/useFormCompletionProgress.js.map +1 -1
- package/dist/v2/hooks/useKeyboardShortcuts.d.ts +25 -0
- package/dist/v2/hooks/useKeyboardShortcuts.d.ts.map +1 -0
- package/dist/v2/hooks/useKeyboardShortcuts.js +132 -0
- package/dist/v2/hooks/useKeyboardShortcuts.js.map +1 -0
- package/dist/v2/hooks/usePrefersReducedMotion.d.ts +56 -0
- package/dist/v2/hooks/usePrefersReducedMotion.d.ts.map +1 -0
- package/dist/v2/hooks/usePrefersReducedMotion.js +105 -0
- package/dist/v2/hooks/usePrefersReducedMotion.js.map +1 -0
- package/dist/v2/hooks/useResolvedDensity.js +5 -13
- package/dist/v2/hooks/useResolvedDensity.js.map +1 -1
- package/dist/v2/hooks/useSortedRows.js +4 -6
- package/dist/v2/hooks/useSortedRows.js.map +1 -1
- package/dist/v2/hooks/useTabLoading.js +7 -22
- package/dist/v2/hooks/useTabLoading.js.map +1 -1
- package/dist/v2/index.js +143 -145
- package/dist/v2/index.js.map +1 -1
- package/dist/v2/modalContext.js +2 -2
- package/dist/v2/modalContext.js.map +1 -1
- package/dist/v2/models/favorite.d.ts +8 -9
- package/dist/v2/models/favorite.d.ts.map +1 -1
- package/dist/v2/models/favorite.js.map +1 -1
- package/dist/v2/models/index.js +4 -4
- package/dist/v2/models/index.js.map +1 -1
- package/dist/v2/models/personalization.d.ts +44 -48
- package/dist/v2/models/personalization.d.ts.map +1 -1
- package/dist/v2/models/personalization.js.map +1 -1
- package/dist/v2/models/referentiel.d.ts +32 -50
- package/dist/v2/models/referentiel.d.ts.map +1 -1
- package/dist/v2/models/referentiel.js.map +1 -1
- package/dist/v2/models/savedFilter.d.ts +8 -17
- package/dist/v2/models/savedFilter.d.ts.map +1 -1
- package/dist/v2/models/savedFilter.js.map +1 -1
- package/dist/v2/patterns/ActionBar.js +152 -187
- package/dist/v2/patterns/ActionBar.js.map +1 -1
- package/dist/v2/patterns/AppMain.d.ts +109 -0
- package/dist/v2/patterns/AppMain.d.ts.map +1 -0
- package/dist/v2/patterns/AppMain.js +115 -0
- package/dist/v2/patterns/AppMain.js.map +1 -0
- package/dist/v2/patterns/BulkActionBar.js +40 -42
- package/dist/v2/patterns/BulkActionBar.js.map +1 -1
- package/dist/v2/patterns/ChartFigure.d.ts +124 -0
- package/dist/v2/patterns/ChartFigure.d.ts.map +1 -0
- package/dist/v2/patterns/ChartFigure.js +159 -0
- package/dist/v2/patterns/ChartFigure.js.map +1 -0
- package/dist/v2/patterns/CollapsibleDataGrid.js +138 -174
- package/dist/v2/patterns/CollapsibleDataGrid.js.map +1 -1
- package/dist/v2/patterns/ColumnsToggle.js +60 -94
- package/dist/v2/patterns/ColumnsToggle.js.map +1 -1
- package/dist/v2/patterns/DataGrid.d.ts.map +1 -1
- package/dist/v2/patterns/DataGrid.js +262 -297
- package/dist/v2/patterns/DataGrid.js.map +1 -1
- package/dist/v2/patterns/DataGridSettingsMenu.d.ts +12 -0
- package/dist/v2/patterns/DataGridSettingsMenu.d.ts.map +1 -1
- package/dist/v2/patterns/DataGridSettingsMenu.js +104 -121
- package/dist/v2/patterns/DataGridSettingsMenu.js.map +1 -1
- package/dist/v2/patterns/DataGridToolbar.js +103 -106
- package/dist/v2/patterns/DataGridToolbar.js.map +1 -1
- package/dist/v2/patterns/DataGridVirtualized.js +179 -217
- package/dist/v2/patterns/DataGridVirtualized.js.map +1 -1
- package/dist/v2/patterns/DeleteResourceConfirmDialog.js +32 -35
- package/dist/v2/patterns/DeleteResourceConfirmDialog.js.map +1 -1
- package/dist/v2/patterns/DetailSplit.d.ts +87 -0
- package/dist/v2/patterns/DetailSplit.d.ts.map +1 -0
- package/dist/v2/patterns/DetailSplit.js +116 -0
- package/dist/v2/patterns/DetailSplit.js.map +1 -0
- package/dist/v2/patterns/FavoriteColumn.js +22 -23
- package/dist/v2/patterns/FavoriteColumn.js.map +1 -1
- package/dist/v2/patterns/FavoritesFilter.js +36 -44
- package/dist/v2/patterns/FavoritesFilter.js.map +1 -1
- package/dist/v2/patterns/FilterTabBar.d.ts +28 -0
- package/dist/v2/patterns/FilterTabBar.d.ts.map +1 -0
- package/dist/v2/patterns/FilterTabBar.js +120 -0
- package/dist/v2/patterns/FilterTabBar.js.map +1 -0
- package/dist/v2/patterns/FormErrorSummary.js +20 -23
- package/dist/v2/patterns/FormErrorSummary.js.map +1 -1
- package/dist/v2/patterns/FormPageShell.js +53 -50
- package/dist/v2/patterns/FormPageShell.js.map +1 -1
- package/dist/v2/patterns/FormSection.d.ts +8 -3
- package/dist/v2/patterns/FormSection.d.ts.map +1 -1
- package/dist/v2/patterns/FormSection.js +44 -51
- package/dist/v2/patterns/FormSection.js.map +1 -1
- package/dist/v2/patterns/FormikCheckbox.js +36 -45
- package/dist/v2/patterns/FormikCheckbox.js.map +1 -1
- package/dist/v2/patterns/FormikCheckboxGroup.d.ts +17 -1
- package/dist/v2/patterns/FormikCheckboxGroup.d.ts.map +1 -1
- package/dist/v2/patterns/FormikCheckboxGroup.js +62 -65
- package/dist/v2/patterns/FormikCheckboxGroup.js.map +1 -1
- package/dist/v2/patterns/FormikCombobox.js +55 -72
- package/dist/v2/patterns/FormikCombobox.js.map +1 -1
- package/dist/v2/patterns/FormikDatePicker.js +50 -64
- package/dist/v2/patterns/FormikDatePicker.js.map +1 -1
- package/dist/v2/patterns/FormikDateTimePicker.js +50 -64
- package/dist/v2/patterns/FormikDateTimePicker.js.map +1 -1
- package/dist/v2/patterns/FormikErrorFocus.js +25 -26
- package/dist/v2/patterns/FormikErrorFocus.js.map +1 -1
- package/dist/v2/patterns/FormikErrorSummary.d.ts +74 -0
- package/dist/v2/patterns/FormikErrorSummary.d.ts.map +1 -0
- package/dist/v2/patterns/FormikErrorSummary.js +97 -0
- package/dist/v2/patterns/FormikErrorSummary.js.map +1 -0
- package/dist/v2/patterns/FormikFile.d.ts +14 -1
- package/dist/v2/patterns/FormikFile.d.ts.map +1 -1
- package/dist/v2/patterns/FormikFile.js +99 -83
- package/dist/v2/patterns/FormikFile.js.map +1 -1
- package/dist/v2/patterns/FormikInput.js +45 -58
- package/dist/v2/patterns/FormikInput.js.map +1 -1
- package/dist/v2/patterns/FormikRadioGroup.js +45 -56
- package/dist/v2/patterns/FormikRadioGroup.js.map +1 -1
- package/dist/v2/patterns/FormikReferentielField.d.ts +12 -1
- package/dist/v2/patterns/FormikReferentielField.d.ts.map +1 -1
- package/dist/v2/patterns/FormikReferentielField.js +54 -64
- package/dist/v2/patterns/FormikReferentielField.js.map +1 -1
- package/dist/v2/patterns/FormikSelect.js +70 -92
- package/dist/v2/patterns/FormikSelect.js.map +1 -1
- package/dist/v2/patterns/FormikTextarea.js +35 -51
- package/dist/v2/patterns/FormikTextarea.js.map +1 -1
- package/dist/v2/patterns/KeyboardShortcutsHelp.js +60 -80
- package/dist/v2/patterns/KeyboardShortcutsHelp.js.map +1 -1
- package/dist/v2/patterns/NetworkErrorBanner.js +13 -16
- package/dist/v2/patterns/NetworkErrorBanner.js.map +1 -1
- package/dist/v2/patterns/PageContent.js +17 -20
- package/dist/v2/patterns/PageContent.js.map +1 -1
- package/dist/v2/patterns/PreviewDrawer.d.ts +49 -0
- package/dist/v2/patterns/PreviewDrawer.d.ts.map +1 -0
- package/dist/v2/patterns/PreviewDrawer.js +159 -0
- package/dist/v2/patterns/PreviewDrawer.js.map +1 -0
- package/dist/v2/patterns/ReferentielField.d.ts +86 -2
- package/dist/v2/patterns/ReferentielField.d.ts.map +1 -1
- package/dist/v2/patterns/ReferentielField.js +347 -327
- package/dist/v2/patterns/ReferentielField.js.map +1 -1
- package/dist/v2/patterns/RowFavoriteToggle.d.ts +6 -0
- package/dist/v2/patterns/RowFavoriteToggle.d.ts.map +1 -1
- package/dist/v2/patterns/RowFavoriteToggle.js +38 -30
- package/dist/v2/patterns/RowFavoriteToggle.js.map +1 -1
- package/dist/v2/patterns/SaveFilterDialog.js +50 -77
- package/dist/v2/patterns/SaveFilterDialog.js.map +1 -1
- package/dist/v2/patterns/SavedFiltersMenu.js +89 -107
- package/dist/v2/patterns/SavedFiltersMenu.js.map +1 -1
- package/dist/v2/patterns/SkeletonPageShell.js +122 -143
- package/dist/v2/patterns/SkeletonPageShell.js.map +1 -1
- package/dist/v2/patterns/SortableHeader.js +35 -57
- package/dist/v2/patterns/SortableHeader.js.map +1 -1
- package/dist/v2/patterns/Tour.js +121 -142
- package/dist/v2/patterns/Tour.js.map +1 -1
- package/dist/v2/patterns/_dataGridShared.d.ts.map +1 -1
- package/dist/v2/patterns/_dataGridShared.js +131 -147
- package/dist/v2/patterns/_dataGridShared.js.map +1 -1
- package/dist/v2/patterns/_pickerSerialisation.js +9 -10
- package/dist/v2/patterns/_pickerSerialisation.js.map +1 -1
- package/dist/v2/patterns/_sort.js +17 -33
- package/dist/v2/patterns/_sort.js.map +1 -1
- package/dist/v2/patterns/_useColumnReorder.js +124 -163
- package/dist/v2/patterns/_useColumnReorder.js.map +1 -1
- package/dist/v2/patterns/_useColumnResize.js +80 -99
- package/dist/v2/patterns/_useColumnResize.js.map +1 -1
- package/dist/v2/patterns/filterCriteria.d.ts +78 -0
- package/dist/v2/patterns/filterCriteria.d.ts.map +1 -0
- package/dist/v2/patterns/filterCriteria.js +110 -0
- package/dist/v2/patterns/filterCriteria.js.map +1 -0
- package/dist/v2/patterns/index.d.ts +160 -0
- package/dist/v2/patterns/index.d.ts.map +1 -1
- package/dist/v2/patterns/index.js +157 -79
- package/dist/v2/patterns/index.js.map +1 -1
- package/dist/v2/patterns/rowActions.d.ts +150 -0
- package/dist/v2/patterns/rowActions.d.ts.map +1 -0
- package/dist/v2/patterns/rowActions.js +232 -0
- package/dist/v2/patterns/rowActions.js.map +1 -0
- package/dist/v2/personalization/PersonalizationProvider.d.ts.map +1 -1
- package/dist/v2/personalization/PersonalizationProvider.js +57 -53
- package/dist/v2/personalization/PersonalizationProvider.js.map +1 -1
- package/dist/v2/personalization/adapters/_storageKey.js +5 -5
- package/dist/v2/personalization/adapters/_storageKey.js.map +1 -1
- package/dist/v2/personalization/adapters/createLocalStorageAdapter.js +25 -24
- package/dist/v2/personalization/adapters/createLocalStorageAdapter.js.map +1 -1
- package/dist/v2/personalization/adapters/createMemoryAdapter.js +14 -14
- package/dist/v2/personalization/adapters/createMemoryAdapter.js.map +1 -1
- package/dist/v2/personalization/adapters/index.js +5 -5
- package/dist/v2/personalization/adapters/index.js.map +1 -1
- package/dist/v2/personalization/capabilities/favorites.js +39 -62
- package/dist/v2/personalization/capabilities/favorites.js.map +1 -1
- package/dist/v2/personalization/capabilities/favoritesView.js +25 -37
- package/dist/v2/personalization/capabilities/favoritesView.js.map +1 -1
- package/dist/v2/personalization/capabilities/gridPreferences.js +31 -36
- package/dist/v2/personalization/capabilities/gridPreferences.js.map +1 -1
- package/dist/v2/personalization/capabilities/index.js +12 -12
- package/dist/v2/personalization/capabilities/reviveSavedCriteria.d.ts +88 -0
- package/dist/v2/personalization/capabilities/reviveSavedCriteria.d.ts.map +1 -0
- package/dist/v2/personalization/capabilities/reviveSavedCriteria.js +126 -0
- package/dist/v2/personalization/capabilities/reviveSavedCriteria.js.map +1 -0
- package/dist/v2/personalization/capabilities/savedFilters.js +93 -100
- package/dist/v2/personalization/capabilities/savedFilters.js.map +1 -1
- package/dist/v2/personalization/createPersonalizationStore.d.ts.map +1 -1
- package/dist/v2/personalization/createPersonalizationStore.js +81 -182
- package/dist/v2/personalization/createPersonalizationStore.js.map +1 -1
- package/dist/v2/personalization/index.d.ts +16 -0
- package/dist/v2/personalization/index.d.ts.map +1 -1
- package/dist/v2/personalization/index.js +30 -23
- package/dist/v2/personalization/index.js.map +1 -1
- package/dist/v2/personalization/personalizationContext.js +10 -12
- package/dist/v2/personalization/personalizationContext.js.map +1 -1
- package/dist/v2/personalization/schema.js +8 -9
- package/dist/v2/personalization/schema.js.map +1 -1
- package/dist/v2/referentiel/ReferentielProvider.js +31 -45
- package/dist/v2/referentiel/ReferentielProvider.js.map +1 -1
- package/dist/v2/referentiel/index.js +11 -13
- package/dist/v2/referentiel/index.js.map +1 -1
- package/dist/v2/referentiel/types.d.ts +105 -0
- package/dist/v2/referentiel/types.d.ts.map +1 -0
- package/dist/v2/referentiel/types.js +6 -0
- package/dist/v2/referentiel/types.js.map +1 -0
- package/dist/v2/referentiel/useReferentielClient.js +13 -16
- package/dist/v2/referentiel/useReferentielClient.js.map +1 -1
- package/dist/v2/referentiel/useReferentielOptions.d.ts +7 -17
- package/dist/v2/referentiel/useReferentielOptions.d.ts.map +1 -1
- package/dist/v2/referentiel/useReferentielOptions.js +63 -120
- package/dist/v2/referentiel/useReferentielOptions.js.map +1 -1
- package/dist/v2/referentiel/useReferentielSearch.d.ts +7 -48
- package/dist/v2/referentiel/useReferentielSearch.d.ts.map +1 -1
- package/dist/v2/referentiel/useReferentielSearch.js +40 -95
- package/dist/v2/referentiel/useReferentielSearch.js.map +1 -1
- package/dist/v2/theme/_brand.js +12 -26
- package/dist/v2/theme/_brand.js.map +1 -1
- package/dist/v2/theme/_brandSecondary.js +12 -26
- package/dist/v2/theme/_brandSecondary.js.map +1 -1
- package/dist/v2/theme/createPortnetTheme.js +41 -49
- package/dist/v2/theme/createPortnetTheme.js.map +1 -1
- package/dist/v2/theme/cssVariables.d.ts +3 -3
- package/dist/v2/theme/cssVariables.d.ts.map +1 -1
- package/dist/v2/theme/cssVariables.js +65 -70
- package/dist/v2/theme/cssVariables.js.map +1 -1
- package/dist/v2/theme/index.js +10 -10
- package/dist/v2/theme/index.js.map +1 -1
- package/dist/v2/tokens/breakpoints.js +16 -16
- package/dist/v2/tokens/breakpoints.js.map +1 -1
- package/dist/v2/tokens/chart.d.ts +103 -0
- package/dist/v2/tokens/chart.d.ts.map +1 -0
- package/dist/v2/tokens/chart.js +270 -0
- package/dist/v2/tokens/chart.js.map +1 -0
- package/dist/v2/tokens/colors.js +24 -24
- package/dist/v2/tokens/colors.js.map +1 -1
- package/dist/v2/tokens/density.d.ts +104 -0
- package/dist/v2/tokens/density.d.ts.map +1 -1
- package/dist/v2/tokens/density.js +67 -12
- package/dist/v2/tokens/density.js.map +1 -1
- package/dist/v2/tokens/index.d.ts +50 -1
- package/dist/v2/tokens/index.d.ts.map +1 -1
- package/dist/v2/tokens/index.js +116 -68
- package/dist/v2/tokens/index.js.map +1 -1
- package/dist/v2/tokens/motion.js +16 -22
- package/dist/v2/tokens/motion.js.map +1 -1
- package/dist/v2/tokens/radius.js +3 -3
- package/dist/v2/tokens/radius.js.map +1 -1
- package/dist/v2/tokens/shadows.js +8 -8
- package/dist/v2/tokens/shadows.js.map +1 -1
- package/dist/v2/tokens/spacing.js +4 -4
- package/dist/v2/tokens/spacing.js.map +1 -1
- package/dist/v2/tokens/state.js +3 -3
- package/dist/v2/tokens/state.js.map +1 -1
- package/dist/v2/tokens/statusPalette.js +21 -23
- package/dist/v2/tokens/statusPalette.js.map +1 -1
- package/dist/v2/tokens/tokens.json +6 -1
- package/dist/v2/tokens/typography.js +15 -15
- package/dist/v2/tokens/typography.js.map +1 -1
- package/dist/v2/tokens/zIndex.js +3 -3
- package/dist/v2/tokens/zIndex.js.map +1 -1
- package/dist/v2/types/datagrid.d.ts +9 -1
- package/dist/v2/types/datagrid.d.ts.map +1 -1
- package/dist/v2/types/datagrid.js.map +1 -1
- package/dist/v2/types/index.js +2 -2
- package/dist/v2/types/index.js.map +1 -1
- package/dist/v2/utils/apiError.js +16 -37
- package/dist/v2/utils/apiError.js.map +1 -1
- package/dist/v2/utils/contrast.js +31 -32
- package/dist/v2/utils/contrast.js.map +1 -1
- package/dist/v2/utils/cx.js +7 -27
- package/dist/v2/utils/cx.js.map +1 -1
- package/dist/v2/utils/fileDownload.js +25 -28
- package/dist/v2/utils/fileDownload.js.map +1 -1
- package/dist/v2/utils/fileValidation.d.ts +116 -0
- package/dist/v2/utils/fileValidation.d.ts.map +1 -0
- package/dist/v2/utils/fileValidation.js +220 -0
- package/dist/v2/utils/fileValidation.js.map +1 -0
- package/dist/v2/utils/fmtDate.d.ts +103 -0
- package/dist/v2/utils/fmtDate.d.ts.map +1 -0
- package/dist/v2/utils/fmtDate.js +119 -0
- package/dist/v2/utils/fmtDate.js.map +1 -0
- package/dist/v2/utils/fmtMoney.d.ts +3 -3
- package/dist/v2/utils/fmtMoney.d.ts.map +1 -1
- package/dist/v2/utils/fmtMoney.js +9 -11
- package/dist/v2/utils/fmtMoney.js.map +1 -1
- package/dist/v2/utils/formikErrors.d.ts +67 -0
- package/dist/v2/utils/formikErrors.d.ts.map +1 -0
- package/dist/v2/utils/formikErrors.js +85 -0
- package/dist/v2/utils/formikErrors.js.map +1 -0
- package/dist/v2/utils/index.d.ts +5 -0
- package/dist/v2/utils/index.d.ts.map +1 -1
- package/dist/v2/utils/index.js +67 -18
- package/dist/v2/utils/index.js.map +1 -1
- package/dist/v2/utils/mergeLabels.js +9 -14
- package/dist/v2/utils/mergeLabels.js.map +1 -1
- package/dist/v2/utils/networkStatus.js +14 -14
- package/dist/v2/utils/networkStatus.js.map +1 -1
- package/package.json +26 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileRowCard.js","names":["React","Box","OverflowMenu","KV","jsx","_jsx","jsxs","_jsxs","CARD_INNER_SX","Object","freeze","display","flexDirection","gap","padding","HEADER_SX","alignItems","justifyContent","HEADER_MAIN_SX","minWidth","flex","LEADING_SX","flexShrink","TITLE_BASE_SX","fontWeight","fontSize","color","overflow","textOverflow","whiteSpace","TITLE_MONO_SX","_objectSpread","fontFamily","SUBTITLE_SX","CHIPS_SX","flexWrap","META_SX","KV_GRID_SX","gridTemplateColumns","HEADER_END_SX","MobileRowCard","_ref","leading","trailing","title","_ref$titleMono","titleMono","subtitle","chips","kv","meta","actions","actionsAriaLabel","visibleActions","useMemo","Array","isArray","filter","a","divider","visibleChips","Boolean","metaParts","p","kvPairs","label","hasActions","length","hasTitle","hasLeading","hasTrailing","hasHeader","hasSubtitle","titleAttr","undefined","subtitleAttr","sx","children","onClick","e","stopPropagation","onKeyDown","ariaLabel","map","c","i","Fragment","pair","value","mono","fallback","join"],"sources":["../../../../src/lib/v2/components/MobileRowCard.tsx"],"sourcesContent":["import * as React from \"react\";\r\nimport Box from \"@mui/material/Box\";\r\nimport type { SxProps, Theme } from \"@mui/material/styles\";\r\nimport OverflowMenu from \"./OverflowMenu\";\r\nimport type { OverflowMenuAction } from \"./OverflowMenu\";\r\nimport KV from \"./KV\";\r\n\r\n/**\r\n * MobileRowCard - Portnet UI v2\r\n *\r\n * Canonical card layout for the DataGrid mobile card view (R1 mobile,\r\n * lib commit \"feat(DataGrid): R1 mobile - opt-in card view\"). Used\r\n * inside DataGrid's renderMobileCard prop to centralise the visual\r\n * rhythm across modules.\r\n *\r\n * <DataGrid\r\n * renderMobileCard={(row) => (\r\n * <MobileRowCard\r\n * title={row.reference}\r\n * titleMono\r\n * subtitle={row.importer?.description}\r\n * chips={[\r\n * <StatutAutorisationChip code={row.statutAutorisation} />,\r\n * <StatutUtilisationChip code={row.statutUtilisation} />,\r\n * ]}\r\n * meta={[\r\n * `Émise ${formatDate(row.dateIssue)}`,\r\n * `Fin ${formatDate(row.dateFinValidite)}`,\r\n * ]}\r\n * actions={buildRowActions(row)}\r\n * actionsAriaLabel={`Actions pour ${row.reference}`}\r\n * />\r\n * )}\r\n * ...\r\n * />\r\n *\r\n * Layout (top to bottom, each line conditional on its prop):\r\n * 1. Header row: [leading] + title (truncate, optional mono) + [trailing] + OverflowMenu kebab\r\n * 2. Subtitle line: muted, single-line truncate\r\n * 3. Chips row: wrapping flexbox for status chips\r\n * 4. KV grid: two-column label/value pairs (see `kv`)\r\n * 5. Meta line: secondary scalars joined with \" · \"\r\n *\r\n * All props are optional; the component renders only the lines\r\n * that have content, with no empty placeholder boxes.\r\n *\r\n * `kv` vs `meta` — pick by whether the reader needs the label.\r\n * meta → self-evident scalars, joined label-less: \"12/05/2026 · 3 pièces\"\r\n * kv → values that are meaningless unaccompanied (\"SOFRANE SA\",\r\n * \"Casablanca\", \"Tissus\") — rendered as a 2-column grid of v2.KV\r\n *\r\n * `kv` exists because every listing in ms-dfd-fe and ms-ti-fe independently\r\n * built header + labelled-KV-grid cards with a local MOBILE_CARD_KV_SX,\r\n * bypassing this component entirely — nine sites across two modules. `meta`\r\n * could not absorb them: joining five labelled pairs into one \" · \" string\r\n * loses the labels, and on a phone those labels are what make the values\r\n * interpretable (Nielsen #6, recognition over recall). Each pair renders\r\n * through v2.KV, so label/value stay paired for screen readers via\r\n * aria-labelledby, and empty values fall back to KV's own \"—\" rather than each\r\n * host writing `?? \"-\"`.\r\n *\r\n * <MobileRowCard\r\n * leading={<FavoriteToggle ... />}\r\n * title={row.num} titleMono\r\n * chips={[<Status kind={...} label={row.etat} />]}\r\n * kv={[\r\n * { label: \"Catégorie\", value: row.categorie },\r\n * { label: \"Importateur\", value: row.importateur },\r\n * { label: \"Référence\", value: row.ref, mono: true },\r\n * ]}\r\n * />\r\n *\r\n * `leading` — a slot BEFORE the title, inside the header row, vertically\r\n * centred against it and never shrinking. Added for the listing favourite\r\n * star, which hosts previously could not place inside the card and therefore\r\n * hand-rolled the whole card layout instead:\r\n *\r\n * <MobileRowCard\r\n * leading={<FavoriteToggle pressed={isFavorite} size=\"sm\" onChange={...} />}\r\n * title={row.reference}\r\n * titleMono\r\n * />\r\n *\r\n * PROPAGATION — deliberate asymmetry with the kebab. The kebab wrapper stops\r\n * click/keydown itself, because opening a menu must never also fire the card's\r\n * onRowClick. `leading` does NOT: a decorative leading node (icon, avatar)\r\n * should still open the row like the rest of the card, and silently swallowing\r\n * that would be the more surprising default. Interactive leading content is\r\n * therefore responsible for stopping propagation in its own handlers — exactly\r\n * as DataGrid's own FavoriteCell does. Get this wrong and a tap both toggles\r\n * the star and opens the drawer.\r\n *\r\n * Charter §02.3 — spacing: --s-2 gap between lines, --s-3 padding.\r\n * Charter §02.2 — typography:\r\n * - title: text-sm semibold (text-mono variant if titleMono)\r\n * - subtitle: text-sm fg-muted\r\n * - meta: text-xs fg-subtle\r\n * Charter §05 — a11y: kebab has its own aria-label; the card-level\r\n * click wiring (role=button, tabIndex, Enter/Space) is owned by\r\n * DataGrid's mobile card wrapper. This component just renders the\r\n * contents.\r\n *\r\n * Why chips are NODES (not objects):\r\n * Hosts have specialised chip components (StatutAutorisationChip\r\n * etc.) and passing nodes lets them keep their existing chip type\r\n * without translating to a generic schema. We just lay them out\r\n * in a wrapping row.\r\n */\r\n\r\nconst CARD_INNER_SX = Object.freeze({\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n gap: \"var(--s-2)\",\r\n padding: \"var(--s-3)\",\r\n} satisfies SxProps<Theme>);\r\n\r\nconst HEADER_SX = Object.freeze({\r\n display: \"flex\",\r\n alignItems: \"flex-start\",\r\n justifyContent: \"space-between\",\r\n gap: \"var(--s-2)\",\r\n} satisfies SxProps<Theme>);\r\n\r\n/* Groups `leading` + title on the left of the header so the kebab keeps its\r\n * space-between position. `minWidth: 0` is what lets the title's ellipsis\r\n * actually engage inside a flex child. */\r\nconst HEADER_MAIN_SX = Object.freeze({\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n gap: \"var(--s-2)\",\r\n minWidth: 0,\r\n flex: 1,\r\n} satisfies SxProps<Theme>);\r\n\r\nconst LEADING_SX = Object.freeze({\r\n display: \"inline-flex\",\r\n alignItems: \"center\",\r\n flexShrink: 0,\r\n} satisfies SxProps<Theme>);\r\n\r\nconst TITLE_BASE_SX = Object.freeze({\r\n fontWeight: \"var(--fw-semibold)\",\r\n fontSize: \"var(--text-sm)\",\r\n color: \"var(--fg)\",\r\n minWidth: 0,\r\n flex: 1,\r\n overflow: \"hidden\",\r\n textOverflow: \"ellipsis\",\r\n whiteSpace: \"nowrap\",\r\n} satisfies SxProps<Theme>);\r\n\r\nconst TITLE_MONO_SX = Object.freeze({\r\n ...TITLE_BASE_SX,\r\n fontFamily: \"var(--font-mono)\",\r\n} satisfies SxProps<Theme>);\r\n\r\nconst SUBTITLE_SX = Object.freeze({\r\n fontSize: \"var(--text-sm)\",\r\n color: \"var(--fg-muted)\",\r\n overflow: \"hidden\",\r\n textOverflow: \"ellipsis\",\r\n whiteSpace: \"nowrap\",\r\n} satisfies SxProps<Theme>);\r\n\r\nconst CHIPS_SX = Object.freeze({\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n gap: \"var(--s-1)\",\r\n flexWrap: \"wrap\",\r\n} satisfies SxProps<Theme>);\r\n\r\nconst META_SX = Object.freeze({\r\n fontSize: \"var(--text-xs)\",\r\n color: \"var(--fg-subtle)\",\r\n});\r\n\r\n/* Two columns at every phone width. Deliberately not responsive: below ~320px\r\n * a single column would be more readable, but 320px is the Charter's narrowest\r\n * supported breakpoint (§07.2 xs) and two columns still fit there. Matches the\r\n * MOBILE_CARD_KV_SX both modules converged on independently. */\r\nconst KV_GRID_SX = Object.freeze({\r\n display: \"grid\",\r\n gridTemplateColumns: \"1fr 1fr\",\r\n gap: \"var(--s-2)\",\r\n} satisfies SxProps<Theme>);\r\n\r\n/* Right cluster of the header row: [trailing] then the kebab. One shared\r\n * wrapper so a card can carry both a visible action and an overflow menu, and\r\n * so propagation is stopped once for the whole interactive cluster. */\r\nconst HEADER_END_SX = Object.freeze({\r\n display: \"inline-flex\",\r\n alignItems: \"center\",\r\n gap: \"var(--s-1)\",\r\n flexShrink: 0,\r\n} satisfies SxProps<Theme>);\r\n\r\n/** One label/value pair in the card's `kv` grid. Mirrors v2.KV's own props. */\r\nexport interface MobileRowCardKV {\r\n label: React.ReactNode;\r\n value?: React.ReactNode | undefined;\r\n /** Tabular-nums monospace — for references, IDs, amounts. */\r\n mono?: boolean | undefined;\r\n /** Overrides KV's default \"—\" when the value is null/undefined/\"\". */\r\n fallback?: React.ReactNode | undefined;\r\n}\r\n\r\nexport interface MobileRowCardProps {\r\n /** Slot before the title (favourite toggle, icon, avatar). Interactive\r\n * content must stop propagation itself — see the propagation note above. */\r\n leading?: React.ReactNode | undefined;\r\n /**\r\n * Slot at the END of the header row — the VISIBLE counterpart of `actions`.\r\n *\r\n * `actions` collapses into a kebab, which is right for a listing's secondary\r\n * verbs and wrong when the action IS the point of the row: a picker modal's\r\n * \"Choisir\" button is the only way to select a row on a phone, and burying it\r\n * behind \"…\" turns one tap into two. Six sites across ms-dfd-fe and ms-ti-fe\r\n * hand-rolled the entire card layout rather than accept that, which is what\r\n * this slot exists to end.\r\n *\r\n * Renders before the kebab; both may be present.\r\n *\r\n * PROPAGATION — unlike `leading`, `trailing` shares the kebab's wrapper and\r\n * therefore DOES stop click/keydown. Its declared purpose is interactive\r\n * actions, and a tap that both fires the action and opens the row is the more\r\n * damaging default. Decorative content belongs in `leading`.\r\n */\r\n trailing?: React.ReactNode | undefined;\r\n title?: React.ReactNode | undefined;\r\n titleMono?: boolean | undefined;\r\n subtitle?: React.ReactNode | undefined;\r\n chips?: React.ReactNode[] | undefined;\r\n /** Labelled pairs rendered as a 2-column v2.KV grid. See `kv` vs `meta`. */\r\n kv?: MobileRowCardKV[] | undefined;\r\n meta?: React.ReactNode[] | undefined;\r\n actions?: OverflowMenuAction[] | undefined;\r\n /**\r\n * Accessible name for the kebab trigger.\r\n *\r\n * NO DEFAULT ON PURPOSE. This used to default to the literal \"Actions\",\r\n * which was then passed to OverflowMenu's `ariaLabel` — and `ariaLabel`\r\n * WINS over `labels.trigger`, so the card silently overrode the design\r\n * system's own canonical trigger name (\"Plus d'actions\", OverflowMenu\r\n * DEFAULT_LABELS). Result: every kebab in the fleet announced « Plus\r\n * d'actions » except the ones inside a mobile row card, which announced the\r\n * vaguer « Actions » — an inter-module naming inconsistency (Charter P2 /\r\n * R-2.4 : « un même concept = un même libellé partout »).\r\n *\r\n * Leaving it undefined lets OverflowMenu apply its own default. Hosts\r\n * SHOULD still pass a contextual name (« Actions pour 2025-IM-0042 »), which\r\n * is strictly better than either default for screen-reader users scanning a\r\n * list of cards.\r\n */\r\n actionsAriaLabel?: string | undefined;\r\n}\r\n\r\nfunction MobileRowCard({\r\n leading,\r\n trailing,\r\n title,\r\n titleMono = false,\r\n subtitle,\r\n chips,\r\n kv,\r\n meta,\r\n actions,\r\n /* No default — see the prop's doc comment. Forwarded only when the host\r\n * supplies one, so OverflowMenu's own default applies otherwise. */\r\n actionsAriaLabel,\r\n}: MobileRowCardProps) {\r\n // Filter out divider entries (OverflowMenu separator marks) and\r\n // null/undefined actions so the kebab only renders when there is\r\n // at least one real action available.\r\n const visibleActions = React.useMemo(() => {\r\n if (!Array.isArray(actions)) return [];\r\n return actions.filter((a) => a && !a.divider);\r\n }, [actions]);\r\n\r\n const visibleChips = React.useMemo(() => {\r\n if (!Array.isArray(chips)) return [];\r\n return chips.filter(Boolean);\r\n }, [chips]);\r\n\r\n const metaParts = React.useMemo(() => {\r\n if (!Array.isArray(meta)) return [];\r\n return meta.filter((p) => p != null && p !== \"\");\r\n }, [meta]);\r\n\r\n /* Only `label` is required — a pair with an empty value is kept on purpose so\r\n * KV renders its \"—\" placeholder and the grid keeps its shape across rows.\r\n * Entries missing a label are dropped: KV would emit an empty eyebrow and an\r\n * aria-labelledby pointing at nothing. */\r\n const kvPairs = React.useMemo(() => {\r\n if (!Array.isArray(kv)) return [];\r\n return kv.filter((p) => p != null && p.label != null && p.label !== \"\");\r\n }, [kv]);\r\n\r\n const hasActions = visibleActions.length > 0;\r\n const hasTitle = title != null && title !== \"\";\r\n const hasLeading = leading != null && leading !== \"\";\r\n const hasTrailing = trailing != null && trailing !== \"\";\r\n const hasHeader = hasTitle || hasActions || hasLeading || hasTrailing;\r\n const hasSubtitle = subtitle != null && subtitle !== \"\";\r\n\r\n // Title attribute (native hover tooltip) is set only when the value\r\n // is a string — wrapping a React node yields a \"[object Object]\"\r\n // tooltip which is worse than no tooltip.\r\n const titleAttr = typeof title === \"string\" ? title : undefined;\r\n const subtitleAttr =\r\n typeof subtitle === \"string\" ? subtitle : undefined;\r\n\r\n return (\r\n <Box sx={CARD_INNER_SX}>\r\n {hasHeader && (\r\n <Box sx={HEADER_SX}>\r\n {(hasLeading || hasTitle) && (\r\n <Box sx={HEADER_MAIN_SX}>\r\n {hasLeading && <Box sx={LEADING_SX}>{leading}</Box>}\r\n {hasTitle && (\r\n <Box\r\n sx={titleMono ? TITLE_MONO_SX : TITLE_BASE_SX}\r\n title={titleAttr}\r\n >\r\n {title}\r\n </Box>\r\n )}\r\n </Box>\r\n )}\r\n {(hasTrailing || hasActions) && (\r\n // The card itself is the click target (wired by DataGrid's\r\n // mobile card wrapper). Stop propagation on the whole\r\n // interactive cluster so firing a visible action, or opening\r\n // the kebab, doesn't also fire onRowClick.\r\n <Box\r\n sx={HEADER_END_SX}\r\n onClick={(e) => e.stopPropagation()}\r\n onKeyDown={(e) => e.stopPropagation()}\r\n >\r\n {hasTrailing && trailing}\r\n {hasActions && (\r\n <OverflowMenu\r\n {...(actionsAriaLabel !== undefined ? { ariaLabel: actionsAriaLabel } : {})}\r\n {...(actions !== undefined ? { actions } : {})}\r\n />\r\n )}\r\n </Box>\r\n )}\r\n </Box>\r\n )}\r\n {hasSubtitle && (\r\n <Box sx={SUBTITLE_SX} title={subtitleAttr}>\r\n {subtitle}\r\n </Box>\r\n )}\r\n {visibleChips.length > 0 && (\r\n <Box sx={CHIPS_SX}>\r\n {visibleChips.map((c, i) => (\r\n <React.Fragment key={i}>{c}</React.Fragment>\r\n ))}\r\n </Box>\r\n )}\r\n {kvPairs.length > 0 && (\r\n <Box sx={KV_GRID_SX}>\r\n {kvPairs.map((pair, i) => (\r\n <KV\r\n key={i}\r\n label={pair.label}\r\n {...(pair.value !== undefined ? { value: pair.value } : {})}\r\n {...(pair.mono !== undefined ? { mono: pair.mono } : {})}\r\n {...(pair.fallback !== undefined ? { fallback: pair.fallback } : {})}\r\n />\r\n ))}\r\n </Box>\r\n )}\r\n {metaParts.length > 0 && (\r\n <Box sx={META_SX}>{metaParts.join(\" · \")}</Box>\r\n )}\r\n </Box>\r\n );\r\n}\r\n\r\nexport default MobileRowCard;\r\n"],"mappings":";;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,GAAG,MAAM,mBAAmB;AAEnC,OAAOC,YAAY,MAAM,gBAAgB;AAEzC,OAAOC,EAAE,MAAM,MAAM;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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AC;QAAA,oBACnBhF,IAAA,CAACF,EAAE,EAAA4B,aAAA,CAAAA,aAAA,CAAAA,aAAA;UAEDkC,KAAK,EAAEsB,IAAI,CAACtB;QAAM,GACbsB,IAAI,CAACC,KAAK,KAAKd,SAAS,GAAG;UAAEc,KAAK,EAAED,IAAI,CAACC;QAAM,CAAC,GAAG,CAAC,CAAC,GACrDD,IAAI,CAACE,IAAI,KAAKf,SAAS,GAAG;UAAEe,IAAI,EAAEF,IAAI,CAACE;QAAK,CAAC,GAAG,CAAC,CAAC,GAClDF,IAAI,CAACG,QAAQ,KAAKhB,SAAS,GAAG;UAAEgB,QAAQ,EAAEH,IAAI,CAACG;QAAS,CAAC,GAAG,CAAC,CAAC,GAJ9DL,CAKN,CAAC;MAAA,CACH;IAAC,CACC,CACN,EACAvB,SAAS,CAACK,MAAM,GAAG,CAAC,iBACnB9D,IAAA,CAACJ,GAAG;MAAC2E,EAAE,EAAExC,OAAQ;MAAAyC,QAAA,EAAEf,SAAS,CAAC6B,IAAI,CAAC,KAAK;IAAC,CAAM,CAC/C;EAAA,CACE,CAAC;AAEV;AAEA,eAAenD,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"MobileRowCard.js","names":["React","Box","OverflowMenu","KV","jsx","_jsx","jsxs","_jsxs","CARD_INNER_SX","Object","freeze","display","flexDirection","gap","padding","HEADER_SX","alignItems","justifyContent","HEADER_MAIN_SX","minWidth","flex","LEADING_SX","flexShrink","TITLE_BASE_SX","fontWeight","fontSize","color","overflow","textOverflow","whiteSpace","TITLE_MONO_SX","fontFamily","SUBTITLE_SX","CHIPS_SX","flexWrap","META_SX","KV_GRID_SX","gridTemplateColumns","HEADER_END_SX","MobileRowCard","leading","trailing","title","titleMono","subtitle","chips","kv","meta","actions","actionsAriaLabel","visibleActions","useMemo","Array","isArray","filter","a","divider","visibleChips","Boolean","metaParts","p","kvPairs","label","hasActions","length","hasTitle","hasLeading","hasTrailing","hasHeader","hasSubtitle","titleAttr","undefined","subtitleAttr","sx","children","onClick","e","stopPropagation","onKeyDown","ariaLabel","map","c","i","Fragment","pair","value","mono","fallback","join"],"sources":["../../../../src/lib/v2/components/MobileRowCard.tsx"],"sourcesContent":["import * as React from \"react\";\r\nimport Box from \"@mui/material/Box\";\r\nimport type { SxProps, Theme } from \"@mui/material/styles\";\r\nimport OverflowMenu from \"./OverflowMenu\";\r\nimport type { OverflowMenuAction } from \"./OverflowMenu\";\r\nimport KV from \"./KV\";\r\n\r\n/**\r\n * MobileRowCard - Portnet UI v2\r\n *\r\n * Canonical card layout for the DataGrid mobile card view (R1 mobile,\r\n * lib commit \"feat(DataGrid): R1 mobile - opt-in card view\"). Used\r\n * inside DataGrid's renderMobileCard prop to centralise the visual\r\n * rhythm across modules.\r\n *\r\n * <DataGrid\r\n * renderMobileCard={(row) => (\r\n * <MobileRowCard\r\n * title={row.reference}\r\n * titleMono\r\n * subtitle={row.importer?.description}\r\n * chips={[\r\n * <StatutAutorisationChip code={row.statutAutorisation} />,\r\n * <StatutUtilisationChip code={row.statutUtilisation} />,\r\n * ]}\r\n * meta={[\r\n * `Émise ${formatDate(row.dateIssue)}`,\r\n * `Fin ${formatDate(row.dateFinValidite)}`,\r\n * ]}\r\n * actions={buildRowActions(row)}\r\n * actionsAriaLabel={`Actions pour ${row.reference}`}\r\n * />\r\n * )}\r\n * ...\r\n * />\r\n *\r\n * Layout (top to bottom, each line conditional on its prop):\r\n * 1. Header row: [leading] + title (truncate, optional mono) + [trailing] + OverflowMenu kebab\r\n * 2. Subtitle line: muted, single-line truncate\r\n * 3. Chips row: wrapping flexbox for status chips\r\n * 4. KV grid: two-column label/value pairs (see `kv`)\r\n * 5. Meta line: secondary scalars joined with \" · \"\r\n *\r\n * All props are optional; the component renders only the lines\r\n * that have content, with no empty placeholder boxes.\r\n *\r\n * `kv` vs `meta` — pick by whether the reader needs the label.\r\n * meta → self-evident scalars, joined label-less: \"12/05/2026 · 3 pièces\"\r\n * kv → values that are meaningless unaccompanied (\"SOFRANE SA\",\r\n * \"Casablanca\", \"Tissus\") — rendered as a 2-column grid of v2.KV\r\n *\r\n * `kv` exists because every listing in ms-dfd-fe and ms-ti-fe independently\r\n * built header + labelled-KV-grid cards with a local MOBILE_CARD_KV_SX,\r\n * bypassing this component entirely — nine sites across two modules. `meta`\r\n * could not absorb them: joining five labelled pairs into one \" · \" string\r\n * loses the labels, and on a phone those labels are what make the values\r\n * interpretable (Nielsen #6, recognition over recall). Each pair renders\r\n * through v2.KV, so label/value stay paired for screen readers via\r\n * aria-labelledby, and empty values fall back to KV's own \"—\" rather than each\r\n * host writing `?? \"-\"`.\r\n *\r\n * <MobileRowCard\r\n * leading={<FavoriteToggle ... />}\r\n * title={row.num} titleMono\r\n * chips={[<Status kind={...} label={row.etat} />]}\r\n * kv={[\r\n * { label: \"Catégorie\", value: row.categorie },\r\n * { label: \"Importateur\", value: row.importateur },\r\n * { label: \"Référence\", value: row.ref, mono: true },\r\n * ]}\r\n * />\r\n *\r\n * `leading` — a slot BEFORE the title, inside the header row, vertically\r\n * centred against it and never shrinking. Added for the listing favourite\r\n * star, which hosts previously could not place inside the card and therefore\r\n * hand-rolled the whole card layout instead:\r\n *\r\n * <MobileRowCard\r\n * leading={<FavoriteToggle pressed={isFavorite} size=\"sm\" onChange={...} />}\r\n * title={row.reference}\r\n * titleMono\r\n * />\r\n *\r\n * PROPAGATION — deliberate asymmetry with the kebab. The kebab wrapper stops\r\n * click/keydown itself, because opening a menu must never also fire the card's\r\n * onRowClick. `leading` does NOT: a decorative leading node (icon, avatar)\r\n * should still open the row like the rest of the card, and silently swallowing\r\n * that would be the more surprising default. Interactive leading content is\r\n * therefore responsible for stopping propagation in its own handlers — exactly\r\n * as DataGrid's own FavoriteCell does. Get this wrong and a tap both toggles\r\n * the star and opens the drawer.\r\n *\r\n * Charter §02.3 — spacing: --s-2 gap between lines, --s-3 padding.\r\n * Charter §02.2 — typography:\r\n * - title: text-sm semibold (text-mono variant if titleMono)\r\n * - subtitle: text-sm fg-muted\r\n * - meta: text-xs fg-subtle\r\n * Charter §05 — a11y: kebab has its own aria-label; the card-level\r\n * click wiring (role=button, tabIndex, Enter/Space) is owned by\r\n * DataGrid's mobile card wrapper. This component just renders the\r\n * contents.\r\n *\r\n * Why chips are NODES (not objects):\r\n * Hosts have specialised chip components (StatutAutorisationChip\r\n * etc.) and passing nodes lets them keep their existing chip type\r\n * without translating to a generic schema. We just lay them out\r\n * in a wrapping row.\r\n */\r\n\r\nconst CARD_INNER_SX = Object.freeze({\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n gap: \"var(--s-2)\",\r\n padding: \"var(--s-3)\",\r\n} satisfies SxProps<Theme>);\r\n\r\nconst HEADER_SX = Object.freeze({\r\n display: \"flex\",\r\n alignItems: \"flex-start\",\r\n justifyContent: \"space-between\",\r\n gap: \"var(--s-2)\",\r\n} satisfies SxProps<Theme>);\r\n\r\n/* Groups `leading` + title on the left of the header so the kebab keeps its\r\n * space-between position. `minWidth: 0` is what lets the title's ellipsis\r\n * actually engage inside a flex child. */\r\nconst HEADER_MAIN_SX = Object.freeze({\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n gap: \"var(--s-2)\",\r\n minWidth: 0,\r\n flex: 1,\r\n} satisfies SxProps<Theme>);\r\n\r\nconst LEADING_SX = Object.freeze({\r\n display: \"inline-flex\",\r\n alignItems: \"center\",\r\n flexShrink: 0,\r\n} satisfies SxProps<Theme>);\r\n\r\nconst TITLE_BASE_SX = Object.freeze({\r\n fontWeight: \"var(--fw-semibold)\",\r\n fontSize: \"var(--text-sm)\",\r\n color: \"var(--fg)\",\r\n minWidth: 0,\r\n flex: 1,\r\n overflow: \"hidden\",\r\n textOverflow: \"ellipsis\",\r\n whiteSpace: \"nowrap\",\r\n} satisfies SxProps<Theme>);\r\n\r\nconst TITLE_MONO_SX = Object.freeze({\r\n ...TITLE_BASE_SX,\r\n fontFamily: \"var(--font-mono)\",\r\n} satisfies SxProps<Theme>);\r\n\r\nconst SUBTITLE_SX = Object.freeze({\r\n fontSize: \"var(--text-sm)\",\r\n color: \"var(--fg-muted)\",\r\n overflow: \"hidden\",\r\n textOverflow: \"ellipsis\",\r\n whiteSpace: \"nowrap\",\r\n} satisfies SxProps<Theme>);\r\n\r\nconst CHIPS_SX = Object.freeze({\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n gap: \"var(--s-1)\",\r\n flexWrap: \"wrap\",\r\n} satisfies SxProps<Theme>);\r\n\r\nconst META_SX = Object.freeze({\r\n fontSize: \"var(--text-xs)\",\r\n color: \"var(--fg-subtle)\",\r\n});\r\n\r\n/* Two columns at every phone width. Deliberately not responsive: below ~320px\r\n * a single column would be more readable, but 320px is the Charter's narrowest\r\n * supported breakpoint (§07.2 xs) and two columns still fit there. Matches the\r\n * MOBILE_CARD_KV_SX both modules converged on independently. */\r\nconst KV_GRID_SX = Object.freeze({\r\n display: \"grid\",\r\n gridTemplateColumns: \"1fr 1fr\",\r\n gap: \"var(--s-2)\",\r\n} satisfies SxProps<Theme>);\r\n\r\n/* Right cluster of the header row: [trailing] then the kebab. One shared\r\n * wrapper so a card can carry both a visible action and an overflow menu, and\r\n * so propagation is stopped once for the whole interactive cluster. */\r\nconst HEADER_END_SX = Object.freeze({\r\n display: \"inline-flex\",\r\n alignItems: \"center\",\r\n gap: \"var(--s-1)\",\r\n flexShrink: 0,\r\n} satisfies SxProps<Theme>);\r\n\r\n/** One label/value pair in the card's `kv` grid. Mirrors v2.KV's own props. */\r\nexport interface MobileRowCardKV {\r\n label: React.ReactNode;\r\n value?: React.ReactNode | undefined;\r\n /** Tabular-nums monospace — for references, IDs, amounts. */\r\n mono?: boolean | undefined;\r\n /** Overrides KV's default \"—\" when the value is null/undefined/\"\". */\r\n fallback?: React.ReactNode | undefined;\r\n}\r\n\r\nexport interface MobileRowCardProps {\r\n /** Slot before the title (favourite toggle, icon, avatar). Interactive\r\n * content must stop propagation itself — see the propagation note above. */\r\n leading?: React.ReactNode | undefined;\r\n /**\r\n * Slot at the END of the header row — the VISIBLE counterpart of `actions`.\r\n *\r\n * `actions` collapses into a kebab, which is right for a listing's secondary\r\n * verbs and wrong when the action IS the point of the row: a picker modal's\r\n * \"Choisir\" button is the only way to select a row on a phone, and burying it\r\n * behind \"…\" turns one tap into two. Six sites across ms-dfd-fe and ms-ti-fe\r\n * hand-rolled the entire card layout rather than accept that, which is what\r\n * this slot exists to end.\r\n *\r\n * Renders before the kebab; both may be present.\r\n *\r\n * PROPAGATION — unlike `leading`, `trailing` shares the kebab's wrapper and\r\n * therefore DOES stop click/keydown. Its declared purpose is interactive\r\n * actions, and a tap that both fires the action and opens the row is the more\r\n * damaging default. Decorative content belongs in `leading`.\r\n */\r\n trailing?: React.ReactNode | undefined;\r\n title?: React.ReactNode | undefined;\r\n titleMono?: boolean | undefined;\r\n subtitle?: React.ReactNode | undefined;\r\n chips?: React.ReactNode[] | undefined;\r\n /** Labelled pairs rendered as a 2-column v2.KV grid. See `kv` vs `meta`. */\r\n kv?: MobileRowCardKV[] | undefined;\r\n meta?: React.ReactNode[] | undefined;\r\n actions?: OverflowMenuAction[] | undefined;\r\n /**\r\n * Accessible name for the kebab trigger.\r\n *\r\n * NO DEFAULT ON PURPOSE. This used to default to the literal \"Actions\",\r\n * which was then passed to OverflowMenu's `ariaLabel` — and `ariaLabel`\r\n * WINS over `labels.trigger`, so the card silently overrode the design\r\n * system's own canonical trigger name (\"Plus d'actions\", OverflowMenu\r\n * DEFAULT_LABELS). Result: every kebab in the fleet announced « Plus\r\n * d'actions » except the ones inside a mobile row card, which announced the\r\n * vaguer « Actions » — an inter-module naming inconsistency (Charter P2 /\r\n * R-2.4 : « un même concept = un même libellé partout »).\r\n *\r\n * Leaving it undefined lets OverflowMenu apply its own default. Hosts\r\n * SHOULD still pass a contextual name (« Actions pour 2025-IM-0042 »), which\r\n * is strictly better than either default for screen-reader users scanning a\r\n * list of cards.\r\n */\r\n actionsAriaLabel?: string | undefined;\r\n}\r\n\r\nfunction MobileRowCard({\r\n leading,\r\n trailing,\r\n title,\r\n titleMono = false,\r\n subtitle,\r\n chips,\r\n kv,\r\n meta,\r\n actions,\r\n /* No default — see the prop's doc comment. Forwarded only when the host\r\n * supplies one, so OverflowMenu's own default applies otherwise. */\r\n actionsAriaLabel,\r\n}: MobileRowCardProps) {\r\n // Filter out divider entries (OverflowMenu separator marks) and\r\n // null/undefined actions so the kebab only renders when there is\r\n // at least one real action available.\r\n const visibleActions = React.useMemo(() => {\r\n if (!Array.isArray(actions)) return [];\r\n return actions.filter((a) => a && !a.divider);\r\n }, [actions]);\r\n\r\n const visibleChips = React.useMemo(() => {\r\n if (!Array.isArray(chips)) return [];\r\n return chips.filter(Boolean);\r\n }, [chips]);\r\n\r\n const metaParts = React.useMemo(() => {\r\n if (!Array.isArray(meta)) return [];\r\n return meta.filter((p) => p != null && p !== \"\");\r\n }, [meta]);\r\n\r\n /* Only `label` is required — a pair with an empty value is kept on purpose so\r\n * KV renders its \"—\" placeholder and the grid keeps its shape across rows.\r\n * Entries missing a label are dropped: KV would emit an empty eyebrow and an\r\n * aria-labelledby pointing at nothing. */\r\n const kvPairs = React.useMemo(() => {\r\n if (!Array.isArray(kv)) return [];\r\n return kv.filter((p) => p != null && p.label != null && p.label !== \"\");\r\n }, [kv]);\r\n\r\n const hasActions = visibleActions.length > 0;\r\n const hasTitle = title != null && title !== \"\";\r\n const hasLeading = leading != null && leading !== \"\";\r\n const hasTrailing = trailing != null && trailing !== \"\";\r\n const hasHeader = hasTitle || hasActions || hasLeading || hasTrailing;\r\n const hasSubtitle = subtitle != null && subtitle !== \"\";\r\n\r\n // Title attribute (native hover tooltip) is set only when the value\r\n // is a string — wrapping a React node yields a \"[object Object]\"\r\n // tooltip which is worse than no tooltip.\r\n const titleAttr = typeof title === \"string\" ? title : undefined;\r\n const subtitleAttr =\r\n typeof subtitle === \"string\" ? subtitle : undefined;\r\n\r\n return (\r\n <Box sx={CARD_INNER_SX}>\r\n {hasHeader && (\r\n <Box sx={HEADER_SX}>\r\n {(hasLeading || hasTitle) && (\r\n <Box sx={HEADER_MAIN_SX}>\r\n {hasLeading && <Box sx={LEADING_SX}>{leading}</Box>}\r\n {hasTitle && (\r\n <Box\r\n sx={titleMono ? TITLE_MONO_SX : TITLE_BASE_SX}\r\n title={titleAttr}\r\n >\r\n {title}\r\n </Box>\r\n )}\r\n </Box>\r\n )}\r\n {(hasTrailing || hasActions) && (\r\n // The card itself is the click target (wired by DataGrid's\r\n // mobile card wrapper). Stop propagation on the whole\r\n // interactive cluster so firing a visible action, or opening\r\n // the kebab, doesn't also fire onRowClick.\r\n <Box\r\n sx={HEADER_END_SX}\r\n onClick={(e) => e.stopPropagation()}\r\n onKeyDown={(e) => e.stopPropagation()}\r\n >\r\n {hasTrailing && trailing}\r\n {hasActions && (\r\n <OverflowMenu\r\n {...(actionsAriaLabel !== undefined ? { ariaLabel: actionsAriaLabel } : {})}\r\n {...(actions !== undefined ? { actions } : {})}\r\n />\r\n )}\r\n </Box>\r\n )}\r\n </Box>\r\n )}\r\n {hasSubtitle && (\r\n <Box sx={SUBTITLE_SX} title={subtitleAttr}>\r\n {subtitle}\r\n </Box>\r\n )}\r\n {visibleChips.length > 0 && (\r\n <Box sx={CHIPS_SX}>\r\n {visibleChips.map((c, i) => (\r\n <React.Fragment key={i}>{c}</React.Fragment>\r\n ))}\r\n </Box>\r\n )}\r\n {kvPairs.length > 0 && (\r\n <Box sx={KV_GRID_SX}>\r\n {kvPairs.map((pair, i) => (\r\n <KV\r\n key={i}\r\n label={pair.label}\r\n {...(pair.value !== undefined ? { value: pair.value } : {})}\r\n {...(pair.mono !== undefined ? { mono: pair.mono } : {})}\r\n {...(pair.fallback !== undefined ? { fallback: pair.fallback } : {})}\r\n />\r\n ))}\r\n </Box>\r\n )}\r\n {metaParts.length > 0 && (\r\n <Box sx={META_SX}>{metaParts.join(\" · \")}</Box>\r\n )}\r\n </Box>\r\n );\r\n}\r\n\r\nexport default MobileRowCard;\r\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,GAAG,MAAM,mBAAmB;AAEnC,OAAOC,YAAY,MAAM,gBAAgB;AAEzC,OAAOC,EAAE,MAAM,MAAM;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApGA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAsGA,MAAMC,aAAa,GAAGC,MAAM,CAACC,MAAM,CAAC;EAClCC,OAAO,EAAE,MAAM;EACfC,aAAa,EAAE,QAAQ;EACvBC,GAAG,EAAE,YAAY;EACjBC,OAAO,EAAE;AACX,CAA0B,CAAC;AAE3B,MAAMC,SAAS,GAAGN,MAAM,CAACC,MAAM,CAAC;EAC9BC,OAAO,EAAE,MAAM;EACfK,UAAU,EAAE,YAAY;EACxBC,cAAc,EAAE,eAAe;EAC/BJ,GAAG,EAAE;AACP,CAA0B,CAAC;;AAE3B;AACA;AACA;AACA,MAAMK,cAAc,GAAGT,MAAM,CAACC,MAAM,CAAC;EACnCC,OAAO,EAAE,MAAM;EACfK,UAAU,EAAE,QAAQ;EACpBH,GAAG,EAAE,YAAY;EACjBM,QAAQ,EAAE,CAAC;EACXC,IAAI,EAAE;AACR,CAA0B,CAAC;AAE3B,MAAMC,UAAU,GAAGZ,MAAM,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,kBACnB7E,IAAA,CAACF,EAAE;QAED2D,KAAK,EAAEsB,IAAI,CAACtB,KAAM;QAAA,IACbsB,IAAI,CAACC,KAAK,KAAKd,SAAS,GAAG;UAAEc,KAAK,EAAED,IAAI,CAACC;QAAM,CAAC,GAAG,CAAC,CAAC;QAAA,IACrDD,IAAI,CAACE,IAAI,KAAKf,SAAS,GAAG;UAAEe,IAAI,EAAEF,IAAI,CAACE;QAAK,CAAC,GAAG,CAAC,CAAC;QAAA,IAClDF,IAAI,CAACG,QAAQ,KAAKhB,SAAS,GAAG;UAAEgB,QAAQ,EAAEH,IAAI,CAACG;QAAS,CAAC,GAAG,CAAC,CAAC;MAAA,GAJ9DL,CAKN,CACF;IAAC,CACC,CACN,EACAvB,SAAS,CAACK,MAAM,GAAG,CAAC,iBACnB3D,IAAA,CAACJ,GAAG;MAACwE,EAAE,EAAEtC,OAAQ;MAAAuC,QAAA,EAAEf,SAAS,CAAC6B,IAAI,CAAC,KAAK;IAAC,CAAM,CAC/C;EAAA,CACE,CAAC;AAEV;AAEA,eAAejD,aAAa","ignoreList":[]}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
1
|
import * as React from "react";
|
|
8
2
|
import Dialog from "@mui/material/Dialog";
|
|
9
3
|
import DialogTitle from "@mui/material/DialogTitle";
|
|
@@ -83,7 +77,7 @@ import useFocusTrap from "../hooks/useFocusTrap";
|
|
|
83
77
|
* additions are layered via useMemo at the call site.
|
|
84
78
|
*/
|
|
85
79
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
86
|
-
|
|
80
|
+
const DIALOG_ROOT_SX = Object.freeze({
|
|
87
81
|
// v2 z-index token (zIndex.js). modal:100 sits ABOVE drawer:80 (so a
|
|
88
82
|
// Modal opened from inside a Drawer stacks correctly) and BELOW
|
|
89
83
|
// snackbar:150 / toast:200 / tooltip:250. In-modal MUI popups
|
|
@@ -98,14 +92,14 @@ var DIALOG_ROOT_SX = Object.freeze({
|
|
|
98
92
|
// at the Dialog top-level in v5/v6/v7, removed in v9). The content
|
|
99
93
|
// `{ sx: {...} }` is unchanged — the backdrop slot receives the same
|
|
100
94
|
// shape.
|
|
101
|
-
|
|
95
|
+
const BACKDROP_SLOT_PROPS = Object.freeze({
|
|
102
96
|
// R-AI.1 - backdrop derived from the live --fg token instead of hard
|
|
103
97
|
// rgba(15,21,37,...). Adapts to any future theme override.
|
|
104
98
|
sx: {
|
|
105
99
|
backgroundColor: "color-mix(in srgb, var(--fg) 45%, transparent)"
|
|
106
100
|
}
|
|
107
101
|
});
|
|
108
|
-
|
|
102
|
+
const PAPER_BASE_SX = Object.freeze({
|
|
109
103
|
width: "100%",
|
|
110
104
|
borderRadius: "var(--r-lg)",
|
|
111
105
|
boxShadow: "var(--shadow-lg)"
|
|
@@ -116,102 +110,99 @@ var PAPER_BASE_SX = Object.freeze({
|
|
|
116
110
|
* paper fill the viewport. maxWidth is forced to 100% so the size-driven
|
|
117
111
|
* token max-width can't re-clamp it. Kept as a frozen module constant so
|
|
118
112
|
* the reference is stable across renders. */
|
|
119
|
-
|
|
113
|
+
const PAPER_FULLSCREEN_SX = Object.freeze({
|
|
120
114
|
width: "100%",
|
|
121
115
|
maxWidth: "100%",
|
|
122
116
|
borderRadius: 0,
|
|
123
117
|
boxShadow: "none"
|
|
124
118
|
});
|
|
125
|
-
|
|
119
|
+
const DIALOG_TITLE_SX = Object.freeze({
|
|
126
120
|
padding: "var(--s-4) var(--s-5) var(--s-2)",
|
|
127
121
|
display: "flex",
|
|
128
122
|
alignItems: "flex-start",
|
|
129
123
|
justifyContent: "space-between",
|
|
130
124
|
gap: "var(--s-2)"
|
|
131
125
|
});
|
|
132
|
-
|
|
126
|
+
const TITLE_TYPOGRAPHY_SX = Object.freeze({
|
|
133
127
|
fontSize: "var(--text-h3)",
|
|
134
128
|
fontWeight: "var(--fw-bold)",
|
|
135
129
|
color: "var(--fg)"
|
|
136
130
|
});
|
|
137
|
-
|
|
131
|
+
const SUBTITLE_TYPOGRAPHY_SX = Object.freeze({
|
|
138
132
|
fontSize: "var(--text-sm)",
|
|
139
133
|
color: "var(--fg-muted)",
|
|
140
134
|
marginTop: "var(--s-1)"
|
|
141
135
|
});
|
|
142
|
-
|
|
136
|
+
const CLOSE_ICON_BUTTON_SX = Object.freeze({
|
|
143
137
|
color: "var(--fg-subtle)",
|
|
144
138
|
marginRight: "calc(-1 * var(--s-1))",
|
|
145
139
|
marginTop: "calc(-1 * var(--s-1))"
|
|
146
140
|
});
|
|
147
|
-
|
|
141
|
+
const DIALOG_CONTENT_SX = Object.freeze({
|
|
148
142
|
padding: "var(--s-4) var(--s-5)",
|
|
149
143
|
borderColor: "var(--border)"
|
|
150
144
|
});
|
|
151
|
-
|
|
145
|
+
const DIALOG_ACTIONS_SX = Object.freeze({
|
|
152
146
|
padding: "var(--s-3) var(--s-5) var(--s-4)",
|
|
153
147
|
gap: "var(--s-2)"
|
|
154
148
|
});
|
|
155
|
-
function Modal(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
fullScreenOnMobile = _ref$fullScreenOnMobi === void 0 ? true : _ref$fullScreenOnMobi,
|
|
170
|
-
ariaLabel = _ref.ariaLabel,
|
|
171
|
-
_ref$ariaLabelClose = _ref.ariaLabelClose,
|
|
172
|
-
ariaLabelClose = _ref$ariaLabelClose === void 0 ? "Fermer la boîte de dialogue" : _ref$ariaLabelClose;
|
|
149
|
+
function Modal({
|
|
150
|
+
open,
|
|
151
|
+
onClose,
|
|
152
|
+
title,
|
|
153
|
+
subtitle,
|
|
154
|
+
children,
|
|
155
|
+
footer,
|
|
156
|
+
size = "md",
|
|
157
|
+
disableBackdropClick = false,
|
|
158
|
+
disableEscape = false,
|
|
159
|
+
fullScreenOnMobile = true,
|
|
160
|
+
ariaLabel,
|
|
161
|
+
ariaLabelClose = "Fermer la boîte de dialogue"
|
|
162
|
+
}) {
|
|
173
163
|
// R-Ar.5 - stable, per-instance, collision-safe ID for aria-labelledby.
|
|
174
|
-
|
|
164
|
+
const titleId = React.useId();
|
|
175
165
|
|
|
176
166
|
// R-F.2 / R-M.2 - the v2 trap is wired on the Dialog Paper element,
|
|
177
167
|
// activated only while the modal is open. MUI's own trap is disabled
|
|
178
168
|
// via the disable*Focus props on Dialog below so the two implementations
|
|
179
169
|
// don't compete for the same DOM event stream.
|
|
180
|
-
|
|
170
|
+
const paperRef = React.useRef(null);
|
|
181
171
|
useFocusTrap(paperRef, !!open);
|
|
182
172
|
|
|
183
173
|
// R-RS.2 — full-screen below the `sm` breakpoint TOKEN (< 481px now
|
|
184
174
|
// that tokens are wired into the theme). Reads the live theme so a host
|
|
185
175
|
// breakpoint override is honoured. Gated behind fullScreenOnMobile so a
|
|
186
176
|
// caller can keep a small confirm dialog centred on phones.
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
177
|
+
const theme = useTheme();
|
|
178
|
+
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
|
179
|
+
const fullScreen = fullScreenOnMobile && isMobile;
|
|
180
|
+
const handleClose = (_e, reason) => {
|
|
191
181
|
if (reason === "backdropClick" && disableBackdropClick) return;
|
|
192
182
|
if (reason === "escapeKeyDown" && disableEscape) return;
|
|
193
|
-
onClose
|
|
183
|
+
onClose?.();
|
|
194
184
|
};
|
|
195
185
|
|
|
196
186
|
// R-AI.1 - modal sizing is owned by the token system (layout.modal),
|
|
197
187
|
// not duplicated here. See src/lib/v2/tokens/density.js.
|
|
198
|
-
|
|
188
|
+
const maxWidth = layout.modal[size] || layout.modal.md;
|
|
199
189
|
|
|
200
190
|
// MUI v9: paper slot is forwarded through slotProps.paper. The slot
|
|
201
191
|
// cannot be fully hoisted — embeds the dynamic maxWidth (size-driven)
|
|
202
192
|
// and the per-instance ref. Memo on [maxWidth, fullScreen] so the
|
|
203
193
|
// reference is stable until either the size or the mobile branch flips.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
|
|
194
|
+
const slotProps = React.useMemo(() => ({
|
|
195
|
+
paper: {
|
|
196
|
+
ref: paperRef,
|
|
197
|
+
sx: fullScreen ? {
|
|
198
|
+
...PAPER_FULLSCREEN_SX
|
|
199
|
+
} : {
|
|
200
|
+
...PAPER_BASE_SX,
|
|
201
|
+
maxWidth
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
backdrop: BACKDROP_SLOT_PROPS
|
|
205
|
+
}), [maxWidth, fullScreen]);
|
|
215
206
|
return /*#__PURE__*/_jsxs(Dialog, {
|
|
216
207
|
open: !!open,
|
|
217
208
|
onClose: handleClose,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","names":["React","Dialog","DialogTitle","DialogContent","DialogActions","IconButton","CloseIcon","Typography","useMediaQuery","useTheme","layout","zIndex","useFocusTrap","jsx","_jsx","jsxs","_jsxs","DIALOG_ROOT_SX","Object","freeze","modal","BACKDROP_SLOT_PROPS","sx","backgroundColor","PAPER_BASE_SX","width","borderRadius","boxShadow","PAPER_FULLSCREEN_SX","maxWidth","DIALOG_TITLE_SX","padding","display","alignItems","justifyContent","gap","TITLE_TYPOGRAPHY_SX","fontSize","fontWeight","color","SUBTITLE_TYPOGRAPHY_SX","marginTop","CLOSE_ICON_BUTTON_SX","marginRight","DIALOG_CONTENT_SX","borderColor","DIALOG_ACTIONS_SX","Modal","_ref","open","onClose","title","subtitle","children","footer","_ref$size","size","_ref$disableBackdropC","disableBackdropClick","_ref$disableEscape","disableEscape","_ref$fullScreenOnMobi","fullScreenOnMobile","ariaLabel","_ref$ariaLabelClose","ariaLabelClose","titleId","useId","paperRef","useRef","theme","isMobile","breakpoints","down","fullScreen","handleClose","_e","reason","md","slotProps","useMemo","paper","ref","_objectSpread","backdrop","role","undefined","disableAutoFocus","disableEnforceFocus","disableRestoreFocus","id","variant","component","onClick","dividers"],"sources":["../../../../src/lib/v2/components/Modal.tsx"],"sourcesContent":["import * as React from \"react\";\r\nimport Dialog from \"@mui/material/Dialog\";\r\nimport DialogTitle from \"@mui/material/DialogTitle\";\r\nimport DialogContent from \"@mui/material/DialogContent\";\r\nimport DialogActions from \"@mui/material/DialogActions\";\r\nimport IconButton from \"@mui/material/IconButton\";\r\nimport CloseIcon from \"@mui/icons-material/Close\";\r\nimport Typography from \"@mui/material/Typography\";\r\nimport useMediaQuery from \"@mui/material/useMediaQuery\";\r\nimport { useTheme } from \"@mui/material/styles\";\r\nimport type { SxProps, Theme } from \"@mui/material/styles\";\r\nimport { layout, zIndex } from \"../tokens\";\r\nimport useFocusTrap from \"../hooks/useFocusTrap\";\r\n\r\n/**\r\n * Modal - Portnet UI v2\r\n *\r\n * Charter §03 · Component \"Modal · Dialog\".\r\n *\r\n * R-M.1 - Closable via Esc + backdrop click + explicit X button.\r\n * R-M.2 - Focus trap when open, focus restored to trigger on close.\r\n * Backed by the v2 useFocusTrap hook (Batch 3) - honours\r\n * [autofocus] and [data-autofocus] markers, coordinates\r\n * with nested traps via a module-level trapStack, and\r\n * filters disabled/hidden/inert subtrees.\r\n * R-M.3 - role=\"dialog\" + aria-modal=\"true\" + aria-labelledby.\r\n * R-M.4 - No modal inside modal - use stepper flow.\r\n * R-M.5 - Use Drawer (not Modal) for ≥ 3 fields or long scroll.\r\n * R-M.6 - Action principale à droite, secondaire à gauche.\r\n * R-RS.2 - Below the `sm` breakpoint token (< 481px) the dialog goes\r\n * FULL-SCREEN by default. A md/lg/xl modal centred with its\r\n * token max-width left only a thin sliver of usable width at\r\n * 320–375px; full-screen restores a usable reading column and\r\n * keeps the footer actions reachable (WCAG 1.4.10 Reflow).\r\n * Opt out with fullScreenOnMobile={false} for genuinely tiny\r\n * confirm dialogs that read better centred.\r\n *\r\n * <Modal open={open} onClose={close} title=\"Confirmation\" size=\"sm\"\r\n * footer={<><Button variant=\"ghost\" onClick={close}>Annuler</Button>\r\n * <Button variant=\"primary\">OK</Button></>}>\r\n * Body content here.\r\n * </Modal>\r\n *\r\n * Accessible name (R-Ar.5 / R-M.3):\r\n * `aria-labelledby` points at the title <Typography> (id=titleId), so the\r\n * dialog's accessible name is the title text ONLY — the close button and\r\n * subtitle are not part of it. When no `title` is provided, pass `ariaLabel`\r\n * to name the dialog; otherwise it would have no accessible name.\r\n *\r\n * Initial focus targeting (R-Ar.4):\r\n * By default the FIRST focusable element of the dialog gets focus on\r\n * open. To opt a specific control in (e.g. the destructive \"Delete\"\r\n * button which intentionally is NOT first), mark it with either:\r\n * - React's <button autoFocus> attribute (standard), or\r\n * - <button data-autofocus> (v2 marker, identical effect).\r\n * Both are matched by useFocusTrap's AUTOFOCUS_SELECTORS.\r\n *\r\n * Stacking:\r\n * The modal's portal layer uses the v2 `zIndex.modal` token (100), so\r\n * it stacks ABOVE a Drawer (zIndex.drawer:80) when opened from inside\r\n * one (e.g. a ReferentielField search launched from the filters Drawer)\r\n * and BELOW snackbar:150 / toast:200 / tooltip:250 so notifications and\r\n * tooltips fired from a modal action stay on top. MUI popups rendered\r\n * inside the modal — Combobox/Autocomplete listboxes and X date-picker\r\n * calendars — also render at theme.zIndex.modal (100) and, opening\r\n * after the dialog, paint above it by DOM order (MUI's own\r\n * Dialog+Autocomplete contract). A previous build hardcoded 1350 here\r\n * (a leftover from MUI's 1100..1500 scale before the v2 remap to\r\n * 0..250); that buried those in-modal popups (at 100) behind the modal\r\n * and pushed the modal above toasts/tooltips.\r\n */\r\n\r\n/* ── Hoisted static sx (D5) ────────────────────────────────────────────\r\n * Frozen at module load. Same emotion / allocation rationale as Tabs +\r\n * DataGrid hoisting. The paper slotProps cannot be fully hoisted because\r\n * it embeds the dynamic `maxWidth` (size-driven) and the `ref` (per\r\n * Modal instance) — its static base is hoisted and the dynamic\r\n * additions are layered via useMemo at the call site.\r\n */\r\n\r\nconst DIALOG_ROOT_SX = Object.freeze({\r\n // v2 z-index token (zIndex.js). modal:100 sits ABOVE drawer:80 (so a\r\n // Modal opened from inside a Drawer stacks correctly) and BELOW\r\n // snackbar:150 / toast:200 / tooltip:250. In-modal MUI popups\r\n // (Combobox listboxes, X date-picker calendars) also use\r\n // theme.zIndex.modal and paint above the dialog by DOM order. The\r\n // previous hardcoded 1350 predated the v2 remap of MUI's 1100..1500\r\n // scale down to 0..250.\r\n zIndex: zIndex.modal,\r\n});\r\n\r\n// MUI v9: backdrop forwarded via slotProps.backdrop (was BackdropProps\r\n// at the Dialog top-level in v5/v6/v7, removed in v9). The content\r\n// `{ sx: {...} }` is unchanged — the backdrop slot receives the same\r\n// shape.\r\nconst BACKDROP_SLOT_PROPS = Object.freeze({\r\n // R-AI.1 - backdrop derived from the live --fg token instead of hard\r\n // rgba(15,21,37,...). Adapts to any future theme override.\r\n sx: { backgroundColor: \"color-mix(in srgb, var(--fg) 45%, transparent)\" },\r\n});\r\n\r\nconst PAPER_BASE_SX = Object.freeze({\r\n width: \"100%\",\r\n borderRadius: \"var(--r-lg)\",\r\n boxShadow: \"var(--shadow-lg)\",\r\n});\r\n\r\n/* R-RS.2 — full-screen paper sx for the mobile (< sm token) branch.\r\n * Drops the rounded corners + shadow (no longer floating) and lets the\r\n * paper fill the viewport. maxWidth is forced to 100% so the size-driven\r\n * token max-width can't re-clamp it. Kept as a frozen module constant so\r\n * the reference is stable across renders. */\r\nconst PAPER_FULLSCREEN_SX = Object.freeze({\r\n width: \"100%\",\r\n maxWidth: \"100%\",\r\n borderRadius: 0,\r\n boxShadow: \"none\",\r\n});\r\n\r\nconst DIALOG_TITLE_SX = Object.freeze({\r\n padding: \"var(--s-4) var(--s-5) var(--s-2)\",\r\n display: \"flex\",\r\n alignItems: \"flex-start\",\r\n justifyContent: \"space-between\",\r\n gap: \"var(--s-2)\",\r\n} satisfies SxProps<Theme>);\r\n\r\nconst TITLE_TYPOGRAPHY_SX = Object.freeze({\r\n fontSize: \"var(--text-h3)\",\r\n fontWeight: \"var(--fw-bold)\",\r\n color: \"var(--fg)\",\r\n});\r\n\r\nconst SUBTITLE_TYPOGRAPHY_SX = Object.freeze({\r\n fontSize: \"var(--text-sm)\",\r\n color: \"var(--fg-muted)\",\r\n marginTop: \"var(--s-1)\",\r\n});\r\n\r\nconst CLOSE_ICON_BUTTON_SX = Object.freeze({\r\n color: \"var(--fg-subtle)\",\r\n marginRight: \"calc(-1 * var(--s-1))\",\r\n marginTop: \"calc(-1 * var(--s-1))\",\r\n});\r\n\r\nconst DIALOG_CONTENT_SX = Object.freeze({\r\n padding: \"var(--s-4) var(--s-5)\",\r\n borderColor: \"var(--border)\",\r\n});\r\n\r\nconst DIALOG_ACTIONS_SX = Object.freeze({\r\n padding: \"var(--s-3) var(--s-5) var(--s-4)\",\r\n gap: \"var(--s-2)\",\r\n});\r\n\r\nexport type ModalSize = \"sm\" | \"md\" | \"lg\" | \"xl\";\r\n\r\nexport interface ModalProps {\r\n open?: boolean | undefined;\r\n onClose?: (() => void) | undefined;\r\n title?: React.ReactNode | undefined;\r\n subtitle?: React.ReactNode | undefined;\r\n children?: React.ReactNode | undefined;\r\n footer?: React.ReactNode | undefined;\r\n size?: ModalSize | undefined;\r\n disableBackdropClick?: boolean | undefined;\r\n disableEscape?: boolean | undefined;\r\n /** R-RS.2 — go full-screen below the `sm` token (< 481px). Default true. */\r\n fullScreenOnMobile?: boolean | undefined;\r\n /** Accessible name for the dialog when no `title` is rendered (R-M.3). */\r\n ariaLabel?: string | undefined;\r\n ariaLabelClose?: string | undefined;\r\n}\r\n\r\nfunction Modal({\r\n open,\r\n onClose,\r\n title,\r\n subtitle,\r\n children,\r\n footer,\r\n size = \"md\",\r\n disableBackdropClick = false,\r\n disableEscape = false,\r\n fullScreenOnMobile = true,\r\n ariaLabel,\r\n ariaLabelClose = \"Fermer la boîte de dialogue\",\r\n}: ModalProps) {\r\n // R-Ar.5 - stable, per-instance, collision-safe ID for aria-labelledby.\r\n const titleId = React.useId();\r\n\r\n // R-F.2 / R-M.2 - the v2 trap is wired on the Dialog Paper element,\r\n // activated only while the modal is open. MUI's own trap is disabled\r\n // via the disable*Focus props on Dialog below so the two implementations\r\n // don't compete for the same DOM event stream.\r\n const paperRef = React.useRef<HTMLDivElement>(null);\r\n useFocusTrap(paperRef, !!open);\r\n\r\n // R-RS.2 — full-screen below the `sm` breakpoint TOKEN (< 481px now\r\n // that tokens are wired into the theme). Reads the live theme so a host\r\n // breakpoint override is honoured. Gated behind fullScreenOnMobile so a\r\n // caller can keep a small confirm dialog centred on phones.\r\n const theme = useTheme();\r\n const isMobile = useMediaQuery(theme.breakpoints.down(\"sm\"));\r\n const fullScreen = fullScreenOnMobile && isMobile;\r\n\r\n const handleClose = (_e: unknown, reason: \"backdropClick\" | \"escapeKeyDown\") => {\r\n if (reason === \"backdropClick\" && disableBackdropClick) return;\r\n if (reason === \"escapeKeyDown\" && disableEscape) return;\r\n onClose?.();\r\n };\r\n\r\n // R-AI.1 - modal sizing is owned by the token system (layout.modal),\r\n // not duplicated here. See src/lib/v2/tokens/density.js.\r\n const maxWidth = layout.modal[size] || layout.modal.md;\r\n\r\n // MUI v9: paper slot is forwarded through slotProps.paper. The slot\r\n // cannot be fully hoisted — embeds the dynamic maxWidth (size-driven)\r\n // and the per-instance ref. Memo on [maxWidth, fullScreen] so the\r\n // reference is stable until either the size or the mobile branch flips.\r\n const slotProps = React.useMemo(\r\n () => ({\r\n paper: {\r\n ref: paperRef,\r\n sx: fullScreen\r\n ? { ...PAPER_FULLSCREEN_SX }\r\n : { ...PAPER_BASE_SX, maxWidth },\r\n },\r\n backdrop: BACKDROP_SLOT_PROPS,\r\n }),\r\n [maxWidth, fullScreen]\r\n );\r\n\r\n return (\r\n <Dialog\r\n open={!!open}\r\n onClose={handleClose}\r\n role=\"dialog\"\r\n aria-modal=\"true\"\r\n // Name = title text only (id is on the title Typography). Falls back\r\n // to ariaLabel when the dialog has no title.\r\n aria-labelledby={title != null ? titleId : undefined}\r\n aria-label={title == null ? ariaLabel : undefined}\r\n maxWidth={false}\r\n // R-RS.2 — hand the full-screen decision to MUI's own prop so it\r\n // applies the correct fullscreen paper geometry (100vw/100vh,\r\n // no margin); our PAPER_FULLSCREEN_SX only relaxes radius/shadow.\r\n fullScreen={fullScreen}\r\n // Hand over focus management to useFocusTrap above. Dialog still\r\n // owns the Portal, Backdrop, scroll lock, transitions, and Esc\r\n // wiring - just not the focus trap itself.\r\n disableAutoFocus\r\n disableEnforceFocus\r\n disableRestoreFocus\r\n // Root sx anchors the portal at the v2 zIndex.modal token — above\r\n // the Drawer, below snackbar/toast/tooltip. See DIALOG_ROOT_SX.\r\n sx={DIALOG_ROOT_SX}\r\n slotProps={slotProps}\r\n >\r\n <DialogTitle sx={DIALOG_TITLE_SX}>\r\n <div>\r\n <Typography id={titleId} variant=\"h3\" component=\"h2\" sx={TITLE_TYPOGRAPHY_SX}>\r\n {title}\r\n </Typography>\r\n {subtitle && (\r\n <Typography sx={SUBTITLE_TYPOGRAPHY_SX}>\r\n {subtitle}\r\n </Typography>\r\n )}\r\n </div>\r\n <IconButton\r\n aria-label={ariaLabelClose}\r\n onClick={onClose}\r\n size=\"small\"\r\n sx={CLOSE_ICON_BUTTON_SX}\r\n >\r\n <CloseIcon fontSize=\"small\" />\r\n </IconButton>\r\n </DialogTitle>\r\n\r\n <DialogContent dividers={!!footer} sx={DIALOG_CONTENT_SX}>\r\n {children}\r\n </DialogContent>\r\n\r\n {footer && (\r\n <DialogActions sx={DIALOG_ACTIONS_SX}>\r\n {footer}\r\n </DialogActions>\r\n )}\r\n </Dialog>\r\n );\r\n}\r\n\r\nexport default Modal;\r\n"],"mappings":";;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,MAAM,MAAM,sBAAsB;AACzC,OAAOC,WAAW,MAAM,2BAA2B;AACnD,OAAOC,aAAa,MAAM,6BAA6B;AACvD,OAAOC,aAAa,MAAM,6BAA6B;AACvD,OAAOC,UAAU,MAAM,0BAA0B;AACjD,OAAOC,SAAS,MAAM,2BAA2B;AACjD,OAAOC,UAAU,MAAM,0BAA0B;AACjD,OAAOC,aAAa,MAAM,6BAA6B;AACvD,SAASC,QAAQ,QAAQ,sBAAsB;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,eAEzBvC,IAAA,CAACR,SAAS;UAAC+B,QAAQ,EAAC;QAAO,CAAE;MAAC,CACpB,CAAC;IAAA,CACF,CAAC,eAEdvB,IAAA,CAACX,aAAa;MAAC2F,QAAQ,EAAE,CAAC,CAACxC,MAAO;MAAChC,EAAE,EAAEsB,iBAAkB;MAAAS,QAAA,EACtDA;IAAQ,CACI,CAAC,EAEfC,MAAM,iBACLxC,IAAA,CAACV,aAAa;MAACkB,EAAE,EAAEwB,iBAAkB;MAAAO,QAAA,EAClCC;IAAM,CACM,CAChB;EAAA,CACK,CAAC;AAEb;AAEA,eAAeP,KAAK","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Modal.js","names":["React","Dialog","DialogTitle","DialogContent","DialogActions","IconButton","CloseIcon","Typography","useMediaQuery","useTheme","layout","zIndex","useFocusTrap","jsx","_jsx","jsxs","_jsxs","DIALOG_ROOT_SX","Object","freeze","modal","BACKDROP_SLOT_PROPS","sx","backgroundColor","PAPER_BASE_SX","width","borderRadius","boxShadow","PAPER_FULLSCREEN_SX","maxWidth","DIALOG_TITLE_SX","padding","display","alignItems","justifyContent","gap","TITLE_TYPOGRAPHY_SX","fontSize","fontWeight","color","SUBTITLE_TYPOGRAPHY_SX","marginTop","CLOSE_ICON_BUTTON_SX","marginRight","DIALOG_CONTENT_SX","borderColor","DIALOG_ACTIONS_SX","Modal","open","onClose","title","subtitle","children","footer","size","disableBackdropClick","disableEscape","fullScreenOnMobile","ariaLabel","ariaLabelClose","titleId","useId","paperRef","useRef","theme","isMobile","breakpoints","down","fullScreen","handleClose","_e","reason","md","slotProps","useMemo","paper","ref","backdrop","role","undefined","disableAutoFocus","disableEnforceFocus","disableRestoreFocus","id","variant","component","onClick","dividers"],"sources":["../../../../src/lib/v2/components/Modal.tsx"],"sourcesContent":["import * as React from \"react\";\r\nimport Dialog from \"@mui/material/Dialog\";\r\nimport DialogTitle from \"@mui/material/DialogTitle\";\r\nimport DialogContent from \"@mui/material/DialogContent\";\r\nimport DialogActions from \"@mui/material/DialogActions\";\r\nimport IconButton from \"@mui/material/IconButton\";\r\nimport CloseIcon from \"@mui/icons-material/Close\";\r\nimport Typography from \"@mui/material/Typography\";\r\nimport useMediaQuery from \"@mui/material/useMediaQuery\";\r\nimport { useTheme } from \"@mui/material/styles\";\r\nimport type { SxProps, Theme } from \"@mui/material/styles\";\r\nimport { layout, zIndex } from \"../tokens\";\r\nimport useFocusTrap from \"../hooks/useFocusTrap\";\r\n\r\n/**\r\n * Modal - Portnet UI v2\r\n *\r\n * Charter §03 · Component \"Modal · Dialog\".\r\n *\r\n * R-M.1 - Closable via Esc + backdrop click + explicit X button.\r\n * R-M.2 - Focus trap when open, focus restored to trigger on close.\r\n * Backed by the v2 useFocusTrap hook (Batch 3) - honours\r\n * [autofocus] and [data-autofocus] markers, coordinates\r\n * with nested traps via a module-level trapStack, and\r\n * filters disabled/hidden/inert subtrees.\r\n * R-M.3 - role=\"dialog\" + aria-modal=\"true\" + aria-labelledby.\r\n * R-M.4 - No modal inside modal - use stepper flow.\r\n * R-M.5 - Use Drawer (not Modal) for ≥ 3 fields or long scroll.\r\n * R-M.6 - Action principale à droite, secondaire à gauche.\r\n * R-RS.2 - Below the `sm` breakpoint token (< 481px) the dialog goes\r\n * FULL-SCREEN by default. A md/lg/xl modal centred with its\r\n * token max-width left only a thin sliver of usable width at\r\n * 320–375px; full-screen restores a usable reading column and\r\n * keeps the footer actions reachable (WCAG 1.4.10 Reflow).\r\n * Opt out with fullScreenOnMobile={false} for genuinely tiny\r\n * confirm dialogs that read better centred.\r\n *\r\n * <Modal open={open} onClose={close} title=\"Confirmation\" size=\"sm\"\r\n * footer={<><Button variant=\"ghost\" onClick={close}>Annuler</Button>\r\n * <Button variant=\"primary\">OK</Button></>}>\r\n * Body content here.\r\n * </Modal>\r\n *\r\n * Accessible name (R-Ar.5 / R-M.3):\r\n * `aria-labelledby` points at the title <Typography> (id=titleId), so the\r\n * dialog's accessible name is the title text ONLY — the close button and\r\n * subtitle are not part of it. When no `title` is provided, pass `ariaLabel`\r\n * to name the dialog; otherwise it would have no accessible name.\r\n *\r\n * Initial focus targeting (R-Ar.4):\r\n * By default the FIRST focusable element of the dialog gets focus on\r\n * open. To opt a specific control in (e.g. the destructive \"Delete\"\r\n * button which intentionally is NOT first), mark it with either:\r\n * - React's <button autoFocus> attribute (standard), or\r\n * - <button data-autofocus> (v2 marker, identical effect).\r\n * Both are matched by useFocusTrap's AUTOFOCUS_SELECTORS.\r\n *\r\n * Stacking:\r\n * The modal's portal layer uses the v2 `zIndex.modal` token (100), so\r\n * it stacks ABOVE a Drawer (zIndex.drawer:80) when opened from inside\r\n * one (e.g. a ReferentielField search launched from the filters Drawer)\r\n * and BELOW snackbar:150 / toast:200 / tooltip:250 so notifications and\r\n * tooltips fired from a modal action stay on top. MUI popups rendered\r\n * inside the modal — Combobox/Autocomplete listboxes and X date-picker\r\n * calendars — also render at theme.zIndex.modal (100) and, opening\r\n * after the dialog, paint above it by DOM order (MUI's own\r\n * Dialog+Autocomplete contract). A previous build hardcoded 1350 here\r\n * (a leftover from MUI's 1100..1500 scale before the v2 remap to\r\n * 0..250); that buried those in-modal popups (at 100) behind the modal\r\n * and pushed the modal above toasts/tooltips.\r\n */\r\n\r\n/* ── Hoisted static sx (D5) ────────────────────────────────────────────\r\n * Frozen at module load. Same emotion / allocation rationale as Tabs +\r\n * DataGrid hoisting. The paper slotProps cannot be fully hoisted because\r\n * it embeds the dynamic `maxWidth` (size-driven) and the `ref` (per\r\n * Modal instance) — its static base is hoisted and the dynamic\r\n * additions are layered via useMemo at the call site.\r\n */\r\n\r\nconst DIALOG_ROOT_SX = Object.freeze({\r\n // v2 z-index token (zIndex.js). modal:100 sits ABOVE drawer:80 (so a\r\n // Modal opened from inside a Drawer stacks correctly) and BELOW\r\n // snackbar:150 / toast:200 / tooltip:250. In-modal MUI popups\r\n // (Combobox listboxes, X date-picker calendars) also use\r\n // theme.zIndex.modal and paint above the dialog by DOM order. The\r\n // previous hardcoded 1350 predated the v2 remap of MUI's 1100..1500\r\n // scale down to 0..250.\r\n zIndex: zIndex.modal,\r\n});\r\n\r\n// MUI v9: backdrop forwarded via slotProps.backdrop (was BackdropProps\r\n// at the Dialog top-level in v5/v6/v7, removed in v9). The content\r\n// `{ sx: {...} }` is unchanged — the backdrop slot receives the same\r\n// shape.\r\nconst BACKDROP_SLOT_PROPS = Object.freeze({\r\n // R-AI.1 - backdrop derived from the live --fg token instead of hard\r\n // rgba(15,21,37,...). Adapts to any future theme override.\r\n sx: { backgroundColor: \"color-mix(in srgb, var(--fg) 45%, transparent)\" },\r\n});\r\n\r\nconst PAPER_BASE_SX = Object.freeze({\r\n width: \"100%\",\r\n borderRadius: \"var(--r-lg)\",\r\n boxShadow: \"var(--shadow-lg)\",\r\n});\r\n\r\n/* R-RS.2 — full-screen paper sx for the mobile (< sm token) branch.\r\n * Drops the rounded corners + shadow (no longer floating) and lets the\r\n * paper fill the viewport. maxWidth is forced to 100% so the size-driven\r\n * token max-width can't re-clamp it. Kept as a frozen module constant so\r\n * the reference is stable across renders. */\r\nconst PAPER_FULLSCREEN_SX = Object.freeze({\r\n width: \"100%\",\r\n maxWidth: \"100%\",\r\n borderRadius: 0,\r\n boxShadow: \"none\",\r\n});\r\n\r\nconst DIALOG_TITLE_SX = Object.freeze({\r\n padding: \"var(--s-4) var(--s-5) var(--s-2)\",\r\n display: \"flex\",\r\n alignItems: \"flex-start\",\r\n justifyContent: \"space-between\",\r\n gap: \"var(--s-2)\",\r\n} satisfies SxProps<Theme>);\r\n\r\nconst TITLE_TYPOGRAPHY_SX = Object.freeze({\r\n fontSize: \"var(--text-h3)\",\r\n fontWeight: \"var(--fw-bold)\",\r\n color: \"var(--fg)\",\r\n});\r\n\r\nconst SUBTITLE_TYPOGRAPHY_SX = Object.freeze({\r\n fontSize: \"var(--text-sm)\",\r\n color: \"var(--fg-muted)\",\r\n marginTop: \"var(--s-1)\",\r\n});\r\n\r\nconst CLOSE_ICON_BUTTON_SX = Object.freeze({\r\n color: \"var(--fg-subtle)\",\r\n marginRight: \"calc(-1 * var(--s-1))\",\r\n marginTop: \"calc(-1 * var(--s-1))\",\r\n});\r\n\r\nconst DIALOG_CONTENT_SX = Object.freeze({\r\n padding: \"var(--s-4) var(--s-5)\",\r\n borderColor: \"var(--border)\",\r\n});\r\n\r\nconst DIALOG_ACTIONS_SX = Object.freeze({\r\n padding: \"var(--s-3) var(--s-5) var(--s-4)\",\r\n gap: \"var(--s-2)\",\r\n});\r\n\r\nexport type ModalSize = \"sm\" | \"md\" | \"lg\" | \"xl\";\r\n\r\nexport interface ModalProps {\r\n open?: boolean | undefined;\r\n onClose?: (() => void) | undefined;\r\n title?: React.ReactNode | undefined;\r\n subtitle?: React.ReactNode | undefined;\r\n children?: React.ReactNode | undefined;\r\n footer?: React.ReactNode | undefined;\r\n size?: ModalSize | undefined;\r\n disableBackdropClick?: boolean | undefined;\r\n disableEscape?: boolean | undefined;\r\n /** R-RS.2 — go full-screen below the `sm` token (< 481px). Default true. */\r\n fullScreenOnMobile?: boolean | undefined;\r\n /** Accessible name for the dialog when no `title` is rendered (R-M.3). */\r\n ariaLabel?: string | undefined;\r\n ariaLabelClose?: string | undefined;\r\n}\r\n\r\nfunction Modal({\r\n open,\r\n onClose,\r\n title,\r\n subtitle,\r\n children,\r\n footer,\r\n size = \"md\",\r\n disableBackdropClick = false,\r\n disableEscape = false,\r\n fullScreenOnMobile = true,\r\n ariaLabel,\r\n ariaLabelClose = \"Fermer la boîte de dialogue\",\r\n}: ModalProps) {\r\n // R-Ar.5 - stable, per-instance, collision-safe ID for aria-labelledby.\r\n const titleId = React.useId();\r\n\r\n // R-F.2 / R-M.2 - the v2 trap is wired on the Dialog Paper element,\r\n // activated only while the modal is open. MUI's own trap is disabled\r\n // via the disable*Focus props on Dialog below so the two implementations\r\n // don't compete for the same DOM event stream.\r\n const paperRef = React.useRef<HTMLDivElement>(null);\r\n useFocusTrap(paperRef, !!open);\r\n\r\n // R-RS.2 — full-screen below the `sm` breakpoint TOKEN (< 481px now\r\n // that tokens are wired into the theme). Reads the live theme so a host\r\n // breakpoint override is honoured. Gated behind fullScreenOnMobile so a\r\n // caller can keep a small confirm dialog centred on phones.\r\n const theme = useTheme();\r\n const isMobile = useMediaQuery(theme.breakpoints.down(\"sm\"));\r\n const fullScreen = fullScreenOnMobile && isMobile;\r\n\r\n const handleClose = (_e: unknown, reason: \"backdropClick\" | \"escapeKeyDown\") => {\r\n if (reason === \"backdropClick\" && disableBackdropClick) return;\r\n if (reason === \"escapeKeyDown\" && disableEscape) return;\r\n onClose?.();\r\n };\r\n\r\n // R-AI.1 - modal sizing is owned by the token system (layout.modal),\r\n // not duplicated here. See src/lib/v2/tokens/density.js.\r\n const maxWidth = layout.modal[size] || layout.modal.md;\r\n\r\n // MUI v9: paper slot is forwarded through slotProps.paper. The slot\r\n // cannot be fully hoisted — embeds the dynamic maxWidth (size-driven)\r\n // and the per-instance ref. Memo on [maxWidth, fullScreen] so the\r\n // reference is stable until either the size or the mobile branch flips.\r\n const slotProps = React.useMemo(\r\n () => ({\r\n paper: {\r\n ref: paperRef,\r\n sx: fullScreen\r\n ? { ...PAPER_FULLSCREEN_SX }\r\n : { ...PAPER_BASE_SX, maxWidth },\r\n },\r\n backdrop: BACKDROP_SLOT_PROPS,\r\n }),\r\n [maxWidth, fullScreen]\r\n );\r\n\r\n return (\r\n <Dialog\r\n open={!!open}\r\n onClose={handleClose}\r\n role=\"dialog\"\r\n aria-modal=\"true\"\r\n // Name = title text only (id is on the title Typography). Falls back\r\n // to ariaLabel when the dialog has no title.\r\n aria-labelledby={title != null ? titleId : undefined}\r\n aria-label={title == null ? ariaLabel : undefined}\r\n maxWidth={false}\r\n // R-RS.2 — hand the full-screen decision to MUI's own prop so it\r\n // applies the correct fullscreen paper geometry (100vw/100vh,\r\n // no margin); our PAPER_FULLSCREEN_SX only relaxes radius/shadow.\r\n fullScreen={fullScreen}\r\n // Hand over focus management to useFocusTrap above. Dialog still\r\n // owns the Portal, Backdrop, scroll lock, transitions, and Esc\r\n // wiring - just not the focus trap itself.\r\n disableAutoFocus\r\n disableEnforceFocus\r\n disableRestoreFocus\r\n // Root sx anchors the portal at the v2 zIndex.modal token — above\r\n // the Drawer, below snackbar/toast/tooltip. See DIALOG_ROOT_SX.\r\n sx={DIALOG_ROOT_SX}\r\n slotProps={slotProps}\r\n >\r\n <DialogTitle sx={DIALOG_TITLE_SX}>\r\n <div>\r\n <Typography id={titleId} variant=\"h3\" component=\"h2\" sx={TITLE_TYPOGRAPHY_SX}>\r\n {title}\r\n </Typography>\r\n {subtitle && (\r\n <Typography sx={SUBTITLE_TYPOGRAPHY_SX}>\r\n {subtitle}\r\n </Typography>\r\n )}\r\n </div>\r\n <IconButton\r\n aria-label={ariaLabelClose}\r\n onClick={onClose}\r\n size=\"small\"\r\n sx={CLOSE_ICON_BUTTON_SX}\r\n >\r\n <CloseIcon fontSize=\"small\" />\r\n </IconButton>\r\n </DialogTitle>\r\n\r\n <DialogContent dividers={!!footer} sx={DIALOG_CONTENT_SX}>\r\n {children}\r\n </DialogContent>\r\n\r\n {footer && (\r\n <DialogActions sx={DIALOG_ACTIONS_SX}>\r\n {footer}\r\n </DialogActions>\r\n )}\r\n </Dialog>\r\n );\r\n}\r\n\r\nexport default Modal;\r\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,MAAM,MAAM,sBAAsB;AACzC,OAAOC,WAAW,MAAM,2BAA2B;AACnD,OAAOC,aAAa,MAAM,6BAA6B;AACvD,OAAOC,aAAa,MAAM,6BAA6B;AACvD,OAAOC,UAAU,MAAM,0BAA0B;AACjD,OAAOC,SAAS,MAAM,2BAA2B;AACjD,OAAOC,UAAU,MAAM,0BAA0B;AACjD,OAAOC,aAAa,MAAM,6BAA6B;AACvD,SAASC,QAAQ,QAAQ,sBAAsB;AAE/C,SAASC,MAAM,EAAEC,MAAM,QAAQ,WAAW;AAC1C,OAAOC,YAAY,MAAM,uBAAuB;;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,WAAW;MAACoB,EAAE,EAAEQ,eAAgB;MAAAsB,QAAA,gBAC/BpC,KAAA;QAAAoC,QAAA,gBACEtC,IAAA,CAACP,UAAU;UAAC4E,EAAE,EAAEvB,OAAQ;UAACwB,OAAO,EAAC,IAAI;UAACC,SAAS,EAAC,IAAI;UAAC/D,EAAE,EAAEc,mBAAoB;UAAAgB,QAAA,EAC1EF;QAAK,CACI,CAAC,EACZC,QAAQ,iBACPrC,IAAA,CAACP,UAAU;UAACe,EAAE,EAAEkB,sBAAuB;UAAAY,QAAA,EACpCD;QAAQ,CACC,CACb;MAAA,CACE,CAAC,eACNrC,IAAA,CAACT,UAAU;QACT,cAAYsD,cAAe;QAC3B2B,OAAO,EAAErC,OAAQ;QACjBK,IAAI,EAAC,OAAO;QACZhC,EAAE,EAAEoB,oBAAqB;QAAAU,QAAA,eAEzBtC,IAAA,CAACR,SAAS;UAAC+B,QAAQ,EAAC;QAAO,CAAE;MAAC,CACpB,CAAC;IAAA,CACF,CAAC,eAEdvB,IAAA,CAACX,aAAa;MAACoF,QAAQ,EAAE,CAAC,CAAClC,MAAO;MAAC/B,EAAE,EAAEsB,iBAAkB;MAAAQ,QAAA,EACtDA;IAAQ,CACI,CAAC,EAEfC,MAAM,iBACLvC,IAAA,CAACV,aAAa;MAACkB,EAAE,EAAEwB,iBAAkB;MAAAM,QAAA,EAClCC;IAAM,CACM,CAChB;EAAA,CACK,CAAC;AAEb;AAEA,eAAeN,KAAK","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Charter §07 · Connexion perdue.
|
|
5
5
|
*
|
|
6
6
|
* Same contract as ServerErrorPage: router-agnostic with required
|
|
7
|
-
* onBack + onHome and an optional onRetry. The code
|
|
7
|
+
* onBack + onHome and an optional onRetry. The code ornament reads
|
|
8
8
|
* "—" since there is no HTTP status to surface.
|
|
9
9
|
*
|
|
10
10
|
* import { NetworkErrorPage } from "@portnet/ui/lib/v2";
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
* );
|
|
22
22
|
* }
|
|
23
23
|
*
|
|
24
|
+
* Localisation (P-4): every visible string is overridable through
|
|
25
|
+
* `labels`, defaulting to French. The shape matches the other three
|
|
26
|
+
* error pages so one translation object can serve all of them.
|
|
27
|
+
*
|
|
24
28
|
* NB: for TRANSIENT connection drops during normal navigation, the
|
|
25
29
|
* v2.NetworkErrorBanner (top of the page, with inline Retry CTA)
|
|
26
30
|
* is the charter-preferred pattern — Charter R-A.3 explicitly
|
|
@@ -34,16 +38,29 @@ import WifiOff from "@mui/icons-material/WifiOff";
|
|
|
34
38
|
import ActionBar from "../patterns/ActionBar";
|
|
35
39
|
import Button from "./Button";
|
|
36
40
|
import ErrorPageBody from "./_ErrorPageBody";
|
|
41
|
+
import { mergeLabels } from "../utils/mergeLabels";
|
|
37
42
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
const DEFAULT_LABELS = Object.freeze({
|
|
44
|
+
breadcrumbRoot: "Erreur",
|
|
45
|
+
breadcrumbCurrent: "Connexion perdue",
|
|
46
|
+
title: "Connexion perdue",
|
|
47
|
+
heading: "Aucune connexion au serveur",
|
|
48
|
+
description: "Vérifiez votre connexion réseau, puis réessayez. Si vous êtes connecté, le service est peut-être momentanément interrompu.",
|
|
49
|
+
retry: "Réessayer",
|
|
50
|
+
home: "Retour à l'accueil"
|
|
51
|
+
});
|
|
52
|
+
function NetworkErrorPage({
|
|
53
|
+
onBack,
|
|
54
|
+
onHome,
|
|
55
|
+
onRetry,
|
|
56
|
+
labels
|
|
57
|
+
}) {
|
|
58
|
+
const L = mergeLabels(DEFAULT_LABELS, labels);
|
|
42
59
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
43
60
|
children: [/*#__PURE__*/_jsx(ActionBar, {
|
|
44
61
|
back: onBack,
|
|
45
|
-
breadcrumb: [
|
|
46
|
-
title:
|
|
62
|
+
breadcrumb: [L.breadcrumbRoot, L.breadcrumbCurrent],
|
|
63
|
+
title: L.title
|
|
47
64
|
}), /*#__PURE__*/_jsx(ErrorPageBody, {
|
|
48
65
|
icon: /*#__PURE__*/_jsx(WifiOff, {
|
|
49
66
|
sx: {
|
|
@@ -52,8 +69,8 @@ function NetworkErrorPage(_ref) {
|
|
|
52
69
|
}
|
|
53
70
|
}),
|
|
54
71
|
code: "\u2014",
|
|
55
|
-
title:
|
|
56
|
-
description:
|
|
72
|
+
title: L.heading,
|
|
73
|
+
description: L.description
|
|
57
74
|
}), /*#__PURE__*/_jsxs(Box, {
|
|
58
75
|
sx: {
|
|
59
76
|
display: "flex",
|
|
@@ -64,12 +81,12 @@ function NetworkErrorPage(_ref) {
|
|
|
64
81
|
children: [onRetry ? /*#__PURE__*/_jsx(Button, {
|
|
65
82
|
variant: "ghost",
|
|
66
83
|
onClick: onRetry,
|
|
67
|
-
children:
|
|
84
|
+
children: L.retry
|
|
68
85
|
}) : null, /*#__PURE__*/_jsx(Button, {
|
|
69
86
|
variant: "primary",
|
|
70
87
|
icon: /*#__PURE__*/_jsx(ArrowBack, {}),
|
|
71
88
|
onClick: onHome,
|
|
72
|
-
children:
|
|
89
|
+
children: L.home
|
|
73
90
|
})]
|
|
74
91
|
})]
|
|
75
92
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkErrorPage.js","names":["Box","ArrowBack","WifiOff","ActionBar","Button","ErrorPageBody","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","
|
|
1
|
+
{"version":3,"file":"NetworkErrorPage.js","names":["Box","ArrowBack","WifiOff","ActionBar","Button","ErrorPageBody","mergeLabels","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","DEFAULT_LABELS","Object","freeze","breadcrumbRoot","breadcrumbCurrent","title","heading","description","retry","home","NetworkErrorPage","onBack","onHome","onRetry","labels","L","children","back","breadcrumb","icon","sx","fontSize","color","code","display","justifyContent","gap","paddingBottom","variant","onClick"],"sources":["../../../../src/lib/v2/components/NetworkErrorPage.tsx"],"sourcesContent":["/**\r\n * NetworkErrorPage — Portnet UI v2 (component)\r\n *\r\n * Charter §07 · Connexion perdue.\r\n *\r\n * Same contract as ServerErrorPage: router-agnostic with required\r\n * onBack + onHome and an optional onRetry. The code ornament reads\r\n * \"—\" since there is no HTTP status to surface.\r\n *\r\n * import { NetworkErrorPage } from \"@portnet/ui/lib/v2\";\r\n * import { useNavigate } from \"react-router-dom\";\r\n *\r\n * function NetworkErrorRoute() {\r\n * const navigate = useNavigate();\r\n * return (\r\n * <NetworkErrorPage\r\n * onBack={() => navigate(-1)}\r\n * onHome={() => navigate(\"/\")}\r\n * onRetry={() => window.location.reload()}\r\n * />\r\n * );\r\n * }\r\n *\r\n * Localisation (P-4): every visible string is overridable through\r\n * `labels`, defaulting to French. The shape matches the other three\r\n * error pages so one translation object can serve all of them.\r\n *\r\n * NB: for TRANSIENT connection drops during normal navigation, the\r\n * v2.NetworkErrorBanner (top of the page, with inline Retry CTA)\r\n * is the charter-preferred pattern — Charter R-A.3 explicitly\r\n * forbids forced navigation to a full error page on transient\r\n * network failure, since it destroys the user's current context.\r\n * This page is for the explicit /network-error route only.\r\n */\r\nimport Box from \"@mui/material/Box\";\r\nimport ArrowBack from \"@mui/icons-material/ArrowBack\";\r\nimport WifiOff from \"@mui/icons-material/WifiOff\";\r\nimport ActionBar from \"../patterns/ActionBar\";\r\nimport Button from \"./Button\";\r\nimport ErrorPageBody from \"./_ErrorPageBody\";\r\nimport { mergeLabels } from \"../utils/mergeLabels\";\r\n\r\nexport interface NetworkErrorPageLabels {\r\n /** First breadcrumb crumb. */\r\n breadcrumbRoot?: string | undefined;\r\n /** Last breadcrumb crumb — aria-current=\"page\". */\r\n breadcrumbCurrent?: string | undefined;\r\n /** ActionBar heading (the page's <h1>). */\r\n title?: string | undefined;\r\n /** Descriptive sentence under the code ornament (the <h2>). */\r\n heading?: string | undefined;\r\n /** Body paragraph — what to check, and that the service may be down. */\r\n description?: string | undefined;\r\n /** Secondary retry label — only rendered when onRetry is supplied. */\r\n retry?: string | undefined;\r\n /** Primary CTA label. */\r\n home?: string | undefined;\r\n}\r\n\r\nconst DEFAULT_LABELS = Object.freeze({\r\n breadcrumbRoot: \"Erreur\",\r\n breadcrumbCurrent: \"Connexion perdue\",\r\n title: \"Connexion perdue\",\r\n heading: \"Aucune connexion au serveur\",\r\n description:\r\n \"Vérifiez votre connexion réseau, puis réessayez. Si vous êtes connecté, le service est peut-être momentanément interrompu.\",\r\n retry: \"Réessayer\",\r\n home: \"Retour à l'accueil\",\r\n});\r\n\r\nexport interface NetworkErrorPageProps {\r\n /** Callback for the back button (top-bar arrow). */\r\n onBack: () => void;\r\n /** Callback for the primary \"Retour à l'accueil\" CTA. */\r\n onHome: () => void;\r\n /** Optional retry callback. When omitted, the Réessayer button is hidden. */\r\n onRetry?: (() => void) | undefined;\r\n /** Overrides for the page's French defaults (P-4). */\r\n labels?: NetworkErrorPageLabels | undefined;\r\n}\r\n\r\nfunction NetworkErrorPage({ onBack, onHome, onRetry, labels }: NetworkErrorPageProps) {\r\n const L = mergeLabels(DEFAULT_LABELS, labels);\r\n\r\n return (\r\n <>\r\n <ActionBar\r\n back={onBack}\r\n breadcrumb={[L.breadcrumbRoot, L.breadcrumbCurrent]}\r\n title={L.title}\r\n />\r\n <ErrorPageBody\r\n icon={<WifiOff sx={{ fontSize: 64, color: \"var(--warning)\" }} />}\r\n code=\"—\"\r\n title={L.heading}\r\n description={L.description}\r\n />\r\n <Box\r\n sx={{\r\n display: \"flex\",\r\n justifyContent: \"center\",\r\n gap: \"var(--s-3)\",\r\n paddingBottom: \"var(--s-7)\",\r\n }}\r\n >\r\n {onRetry ? (\r\n <Button variant=\"ghost\" onClick={onRetry}>\r\n {L.retry}\r\n </Button>\r\n ) : null}\r\n <Button variant=\"primary\" icon={<ArrowBack />} onClick={onHome}>\r\n {L.home}\r\n </Button>\r\n </Box>\r\n </>\r\n );\r\n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AO;QAAC+B,EAAE,EAAE;UAAEC,QAAQ,EAAE,EAAE;UAAEC,KAAK,EAAE;QAAiB;MAAE,CAAE,CAAE;MACjEC,IAAI,EAAC,QAAG;MACRlB,KAAK,EAAEU,CAAC,CAACT,OAAQ;MACjBC,WAAW,EAAEQ,CAAC,CAACR;IAAY,CAC5B,CAAC,eACFV,KAAA,CAACV,GAAG;MACFiC,EAAE,EAAE;QACFI,OAAO,EAAS,MAAM;QACtBC,cAAc,EAAE,QAAQ;QACxBC,GAAG,EAAa,YAAY;QAC5BC,aAAa,EAAG;MAClB,CAAE;MAAAX,QAAA,GAEDH,OAAO,gBACNlB,IAAA,CAACJ,MAAM;QAACqC,OAAO,EAAC,OAAO;QAACC,OAAO,EAAEhB,OAAQ;QAAAG,QAAA,EACtCD,CAAC,CAACP;MAAK,CACF,CAAC,GACP,IAAI,eACRb,IAAA,CAACJ,MAAM;QAACqC,OAAO,EAAC,SAAS;QAACT,IAAI,eAAExB,IAAA,CAACP,SAAS,IAAE,CAAE;QAACyC,OAAO,EAAEjB,MAAO;QAAAI,QAAA,EAC5DD,CAAC,CAACN;MAAI,CACD,CAAC;IAAA,CACN,CAAC;EAAA,CACN,CAAC;AAEP;AAEA,eAAeC,gBAAgB","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Charter §07 · 404 / Page introuvable.
|
|
5
5
|
*
|
|
6
|
-
* Router-agnostic. See ForbiddenPage.
|
|
6
|
+
* Router-agnostic. See ForbiddenPage.tsx for the full contract and
|
|
7
7
|
* design rationale (onBack + onHome callback props).
|
|
8
8
|
*
|
|
9
9
|
* import { NotFoundPage } from "@portnet/ui/lib/v2";
|
|
@@ -13,6 +13,13 @@
|
|
|
13
13
|
* const navigate = useNavigate();
|
|
14
14
|
* return <NotFoundPage onBack={() => navigate(-1)} onHome={() => navigate("/")} />;
|
|
15
15
|
* }
|
|
16
|
+
*
|
|
17
|
+
* Localisation (P-4): every visible string is overridable through
|
|
18
|
+
* `labels`, defaulting to French. The shape matches the other three
|
|
19
|
+
* error pages so one translation object can serve all of them.
|
|
20
|
+
*
|
|
21
|
+
* No retry here, deliberately: a 404 is a statement about an address
|
|
22
|
+
* rather than about a moment, so retrying cannot change the outcome.
|
|
16
23
|
*/
|
|
17
24
|
import Box from "@mui/material/Box";
|
|
18
25
|
import ArrowBack from "@mui/icons-material/ArrowBack";
|
|
@@ -20,15 +27,27 @@ import SearchOff from "@mui/icons-material/SearchOff";
|
|
|
20
27
|
import ActionBar from "../patterns/ActionBar";
|
|
21
28
|
import Button from "./Button";
|
|
22
29
|
import ErrorPageBody from "./_ErrorPageBody";
|
|
30
|
+
import { mergeLabels } from "../utils/mergeLabels";
|
|
23
31
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
const DEFAULT_LABELS = Object.freeze({
|
|
33
|
+
breadcrumbRoot: "Erreur",
|
|
34
|
+
breadcrumbCurrent: "Page introuvable",
|
|
35
|
+
title: "Page introuvable",
|
|
36
|
+
heading: "La page demandée n'existe pas",
|
|
37
|
+
description: "Le lien suivi est peut-être obsolète, ou la page a été déplacée. Vérifiez l'adresse, ou retournez à l'accueil pour reprendre votre navigation.",
|
|
38
|
+
home: "Retour à l'accueil"
|
|
39
|
+
});
|
|
40
|
+
function NotFoundPage({
|
|
41
|
+
onBack,
|
|
42
|
+
onHome,
|
|
43
|
+
labels
|
|
44
|
+
}) {
|
|
45
|
+
const L = mergeLabels(DEFAULT_LABELS, labels);
|
|
27
46
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
28
47
|
children: [/*#__PURE__*/_jsx(ActionBar, {
|
|
29
48
|
back: onBack,
|
|
30
|
-
breadcrumb: [
|
|
31
|
-
title:
|
|
49
|
+
breadcrumb: [L.breadcrumbRoot, L.breadcrumbCurrent],
|
|
50
|
+
title: L.title
|
|
32
51
|
}), /*#__PURE__*/_jsx(ErrorPageBody, {
|
|
33
52
|
icon: /*#__PURE__*/_jsx(SearchOff, {
|
|
34
53
|
sx: {
|
|
@@ -37,8 +56,8 @@ function NotFoundPage(_ref) {
|
|
|
37
56
|
}
|
|
38
57
|
}),
|
|
39
58
|
code: "404",
|
|
40
|
-
title:
|
|
41
|
-
description:
|
|
59
|
+
title: L.heading,
|
|
60
|
+
description: L.description
|
|
42
61
|
}), /*#__PURE__*/_jsx(Box, {
|
|
43
62
|
sx: {
|
|
44
63
|
display: "flex",
|
|
@@ -49,7 +68,7 @@ function NotFoundPage(_ref) {
|
|
|
49
68
|
variant: "primary",
|
|
50
69
|
icon: /*#__PURE__*/_jsx(ArrowBack, {}),
|
|
51
70
|
onClick: onHome,
|
|
52
|
-
children:
|
|
71
|
+
children: L.home
|
|
53
72
|
})
|
|
54
73
|
})]
|
|
55
74
|
});
|