@portnet/ui 6.0.1 → 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 +737 -0
- package/dist/esm/index.js +90 -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 -39
- 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 +146 -0
- package/dist/esm/v2/__tests__/FieldWidth.test.js.map +1 -0
- package/dist/esm/v2/__tests__/FileCard.test.js +18 -18
- package/dist/esm/v2/__tests__/FileCard.test.js.map +1 -1
- package/dist/esm/v2/__tests__/FormikCheckbox.test.js +173 -0
- package/dist/esm/v2/__tests__/FormikCheckbox.test.js.map +1 -0
- package/dist/esm/v2/__tests__/FormikDateTimePicker.test.js +236 -0
- package/dist/esm/v2/__tests__/FormikDateTimePicker.test.js.map +1 -0
- 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 +299 -0
- package/dist/esm/v2/__tests__/FormikRadioGroup.test.js.map +1 -0
- package/dist/esm/v2/__tests__/MobileRowCard.test.js +44 -43
- 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 -22
- 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 +118 -90
- 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 +210 -52
- 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 +64 -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 +14 -4
- 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 +26 -75
- 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 +130 -0
- package/dist/esm/v2/patterns/FormikCheckbox.js.map +1 -0
- 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 -66
- package/dist/esm/v2/patterns/FormikCombobox.js.map +1 -1
- package/dist/esm/v2/patterns/FormikDatePicker.js +51 -99
- package/dist/esm/v2/patterns/FormikDatePicker.js.map +1 -1
- package/dist/esm/v2/patterns/FormikDateTimePicker.js +136 -0
- package/dist/esm/v2/patterns/FormikDateTimePicker.js.map +1 -0
- 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 -50
- package/dist/esm/v2/patterns/FormikInput.js.map +1 -1
- package/dist/esm/v2/patterns/FormikRadioGroup.js +129 -0
- package/dist/esm/v2/patterns/FormikRadioGroup.js.map +1 -0
- 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 -84
- package/dist/esm/v2/patterns/FormikSelect.js.map +1 -1
- package/dist/esm/v2/patterns/FormikTextarea.js +30 -43
- package/dist/esm/v2/patterns/FormikTextarea.js.map +1 -1
- package/dist/esm/v2/patterns/KeyboardShortcutsHelp.js +64 -65
- 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 +127 -0
- package/dist/esm/v2/patterns/RowFavoriteToggle.js.map +1 -0
- 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 +72 -0
- package/dist/esm/v2/patterns/_pickerSerialisation.js.map +1 -0
- 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 +235 -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 +203 -0
- package/dist/esm/v2/personalization/capabilities/gridPreferences.js.map +1 -0
- package/dist/esm/v2/personalization/capabilities/index.js +5 -0
- package/dist/esm/v2/personalization/capabilities/index.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 +35 -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 +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +122 -47
- 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 +98 -69
- 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 +148 -0
- package/dist/v2/__tests__/FieldWidth.test.js.map +1 -0
- package/dist/v2/__tests__/FileCard.test.js +45 -48
- package/dist/v2/__tests__/FileCard.test.js.map +1 -1
- package/dist/v2/__tests__/FormikCheckbox.test.js +175 -0
- package/dist/v2/__tests__/FormikCheckbox.test.js.map +1 -0
- package/dist/v2/__tests__/FormikDateTimePicker.test.js +237 -0
- package/dist/v2/__tests__/FormikDateTimePicker.test.js.map +1 -0
- 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 +300 -0
- package/dist/v2/__tests__/FormikRadioGroup.test.js.map +1 -0
- package/dist/v2/__tests__/MobileRowCard.test.js +100 -102
- 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 +38 -46
- 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.d.ts.map +1 -1
- package/dist/v2/components/DateTimePicker.js +121 -95
- 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 +121 -5
- package/dist/v2/components/Field.d.ts.map +1 -1
- package/dist/v2/components/Field.js +221 -62
- 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 +67 -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.d.ts.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.d.ts +9 -9
- package/dist/v2/patterns/FavoriteColumn.d.ts.map +1 -1
- package/dist/v2/patterns/FavoriteColumn.js +32 -80
- 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.d.ts +77 -0
- package/dist/v2/patterns/FormikCheckbox.d.ts.map +1 -0
- package/dist/v2/patterns/FormikCheckbox.js +138 -0
- package/dist/v2/patterns/FormikCheckbox.js.map +1 -0
- 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.d.ts +7 -1
- package/dist/v2/patterns/FormikCombobox.d.ts.map +1 -1
- package/dist/v2/patterns/FormikCombobox.js +55 -69
- package/dist/v2/patterns/FormikCombobox.js.map +1 -1
- package/dist/v2/patterns/FormikDatePicker.d.ts +13 -1
- package/dist/v2/patterns/FormikDatePicker.d.ts.map +1 -1
- package/dist/v2/patterns/FormikDatePicker.js +59 -106
- package/dist/v2/patterns/FormikDatePicker.js.map +1 -1
- package/dist/v2/patterns/FormikDateTimePicker.d.ts +111 -0
- package/dist/v2/patterns/FormikDateTimePicker.d.ts.map +1 -0
- package/dist/v2/patterns/FormikDateTimePicker.js +144 -0
- package/dist/v2/patterns/FormikDateTimePicker.js.map +1 -0
- 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.d.ts +11 -1
- package/dist/v2/patterns/FormikInput.d.ts.map +1 -1
- package/dist/v2/patterns/FormikInput.js +45 -55
- package/dist/v2/patterns/FormikInput.js.map +1 -1
- package/dist/v2/patterns/FormikRadioGroup.d.ts +80 -0
- package/dist/v2/patterns/FormikRadioGroup.d.ts.map +1 -0
- package/dist/v2/patterns/FormikRadioGroup.js +137 -0
- package/dist/v2/patterns/FormikRadioGroup.js.map +1 -0
- 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.d.ts +9 -1
- package/dist/v2/patterns/FormikSelect.d.ts.map +1 -1
- package/dist/v2/patterns/FormikSelect.js +70 -89
- package/dist/v2/patterns/FormikSelect.js.map +1 -1
- package/dist/v2/patterns/FormikTextarea.d.ts +9 -1
- package/dist/v2/patterns/FormikTextarea.d.ts.map +1 -1
- package/dist/v2/patterns/FormikTextarea.js +35 -48
- package/dist/v2/patterns/FormikTextarea.js.map +1 -1
- package/dist/v2/patterns/KeyboardShortcutsHelp.d.ts +14 -1
- package/dist/v2/patterns/KeyboardShortcutsHelp.d.ts.map +1 -1
- package/dist/v2/patterns/KeyboardShortcutsHelp.js +71 -74
- 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 +98 -0
- package/dist/v2/patterns/RowFavoriteToggle.d.ts.map +1 -0
- package/dist/v2/patterns/RowFavoriteToggle.js +135 -0
- package/dist/v2/patterns/RowFavoriteToggle.js.map +1 -0
- 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.d.ts +44 -0
- package/dist/v2/patterns/_pickerSerialisation.d.ts.map +1 -0
- package/dist/v2/patterns/_pickerSerialisation.js +80 -0
- package/dist/v2/patterns/_pickerSerialisation.js.map +1 -0
- 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 +247 -0
- package/dist/v2/patterns/index.d.ts.map +1 -1
- package/dist/v2/patterns/index.js +182 -70
- 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.d.ts +100 -0
- package/dist/v2/personalization/capabilities/gridPreferences.d.ts.map +1 -0
- package/dist/v2/personalization/capabilities/gridPreferences.js +210 -0
- package/dist/v2/personalization/capabilities/gridPreferences.js.map +1 -0
- package/dist/v2/personalization/capabilities/index.d.ts +6 -0
- package/dist/v2/personalization/capabilities/index.d.ts.map +1 -1
- package/dist/v2/personalization/capabilities/index.js +23 -10
- package/dist/v2/personalization/capabilities/index.js.map +1 -1
- 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 +34 -0
- package/dist/v2/personalization/index.d.ts.map +1 -1
- package/dist/v2/personalization/index.js +41 -21
- 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
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { OverflowMenuAction } from "../components/OverflowMenu";
|
|
3
|
+
/**
|
|
4
|
+
* rowActions — business action descriptors → the row's kebab menu
|
|
5
|
+
* (capability gap G-41).
|
|
6
|
+
*
|
|
7
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
8
|
+
* WHY THIS BELONGS IN THE LIBRARY
|
|
9
|
+
*
|
|
10
|
+
* The library ships both halves already: `OverflowMenu` renders a flat list of
|
|
11
|
+
* actions, and `DataGrid.rowActions` takes a `(row) => ReactNode` renderer. The
|
|
12
|
+
* step between them is what every listing writes for itself — turning the
|
|
13
|
+
* BUSINESS description of an action ("visible only on a draft", "greyed out
|
|
14
|
+
* while the request is in flight") into a menu for ONE row.
|
|
15
|
+
*
|
|
16
|
+
* That step is not glue. It carries three rules the Charter imposes, and each
|
|
17
|
+
* one is a rule a host can only get right by re-deriving it:
|
|
18
|
+
*
|
|
19
|
+
* R-3.3 ≤ 1 primary + ≤ 3 secondary actions per screen, hence the kebab.
|
|
20
|
+
* R-B.6 a destructive action is separated and marked, not merely last.
|
|
21
|
+
* R-K.1 every mouse-reachable action is keyboard-reachable — which is what
|
|
22
|
+
* `OverflowMenu` gives and what hover-revealed icon rows never did.
|
|
23
|
+
*
|
|
24
|
+
* Promoted from `refonte-frontend` (Area 5), where it served TWELVE screens and
|
|
25
|
+
* had already replaced a local `TableActions` that revealed its actions on
|
|
26
|
+
* hover, via a `mouseup` listener on `document`, with no keyboard equivalent
|
|
27
|
+
* and no `role` / `aria-*`. On those screens, consulting, editing or deleting a
|
|
28
|
+
* file was unreachable without a mouse — the Charter lists "hover-only
|
|
29
|
+
* interactions" among its Forbidden Practices for exactly this reason.
|
|
30
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
31
|
+
*
|
|
32
|
+
* PREDICATES, NOT BOOLEANS, AND THAT IS THE WHOLE POINT. `hidden` and
|
|
33
|
+
* `disabled` take the ROW: an action's availability depends on the state of
|
|
34
|
+
* that row, so it must be evaluated per row, at render. A boolean would force
|
|
35
|
+
* the host to rebuild the descriptor array per row — which is how a card and a
|
|
36
|
+
* table row end up offering different actions for the same record.
|
|
37
|
+
*
|
|
38
|
+
* >>> THE TWO SURFACES ARE WHY `buildRowActionMenu` IS EXPORTED SEPARATELY.
|
|
39
|
+
* >>> A row appears twice: as a table row and, below the mobile breakpoint, as
|
|
40
|
+
* >>> a `MobileRowCard` whose `actions` prop takes `OverflowMenuAction[]` —
|
|
41
|
+
* >>> not a node. With only the renderer exported, a host had to rebuild the
|
|
42
|
+
* >>> menu by hand for the card, and the two copies drifted on the danger
|
|
43
|
+
* >>> separator, the overflow warning and the evaluation of the predicates.
|
|
44
|
+
* >>> The library documents that exact failure for `RowFavoriteToggle`
|
|
45
|
+
* >>> (gap G-36): the local twin announced "Ajouter aux favoris" while the
|
|
46
|
+
* >>> grid column on the same page said "Suivre". Same shape, one level up. <
|
|
47
|
+
*
|
|
48
|
+
* Usage:
|
|
49
|
+
*
|
|
50
|
+
* const descriptors: RowActionDescriptor<Dossier>[] = [
|
|
51
|
+
* { id: "open", label: "Consulter le dossier", icon: <Visibility />, onClick: open },
|
|
52
|
+
* { id: "del", label: "Supprimer définitivement", icon: <Delete />,
|
|
53
|
+
* onClick: remove, danger: true, hidden: (row) => row.status !== "DRAFT" },
|
|
54
|
+
* ];
|
|
55
|
+
*
|
|
56
|
+
* <DataGrid rowActions={buildRowActions(descriptors, `Actions sur ${row.reference}`)} />
|
|
57
|
+
* <MobileRowCard actions={buildRowActionMenu(descriptors, row)} />
|
|
58
|
+
*/
|
|
59
|
+
/** Charter contract of `OverflowMenu`: ancillary row actions, ≤ 7 items. */
|
|
60
|
+
export declare const MAX_ROW_ACTIONS = 7;
|
|
61
|
+
/**
|
|
62
|
+
* One row action, described by the business.
|
|
63
|
+
*
|
|
64
|
+
* `hidden` and `disabled` are PREDICATES on the row, not booleans — see the
|
|
65
|
+
* note above.
|
|
66
|
+
*/
|
|
67
|
+
export interface RowActionDescriptor<T> {
|
|
68
|
+
/** Stable identifier — render key and test anchor. */
|
|
69
|
+
id: string;
|
|
70
|
+
/** Menu label. Verb + object (R-B.3, §9.2). */
|
|
71
|
+
label: React.ReactNode;
|
|
72
|
+
icon?: React.ReactNode | undefined;
|
|
73
|
+
onClick: (row: T) => void;
|
|
74
|
+
/** Hides the action for this row. */
|
|
75
|
+
hidden?: ((row: T) => boolean) | undefined;
|
|
76
|
+
/** Shows the action but disables it for this row. */
|
|
77
|
+
disabled?: ((row: T) => boolean) | undefined;
|
|
78
|
+
/** Destructive: separator before, danger styling (R-B.6). */
|
|
79
|
+
danger?: boolean | undefined;
|
|
80
|
+
/** Keyboard shortcut rendered at the end of the item. */
|
|
81
|
+
shortcut?: React.ReactNode | undefined;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Menu items for ONE row. Predicates are evaluated here, per call.
|
|
85
|
+
*
|
|
86
|
+
* Returns an empty array when nothing is visible, so a caller can decide to
|
|
87
|
+
* render no trigger at all rather than an empty menu.
|
|
88
|
+
*/
|
|
89
|
+
export declare function buildRowActionMenu<T>(descriptors: readonly RowActionDescriptor<T>[], row: T): OverflowMenuAction[];
|
|
90
|
+
/**
|
|
91
|
+
* Options of {@link buildRowActions}.
|
|
92
|
+
*/
|
|
93
|
+
export interface BuildRowActionsOptions {
|
|
94
|
+
/**
|
|
95
|
+
* Render the row's VISIBLE actions as icon buttons while their count is
|
|
96
|
+
* at most this value; fall back to the kebab menu above it.
|
|
97
|
+
*
|
|
98
|
+
* Omitted — the default — always renders the kebab, so existing callers
|
|
99
|
+
* are untouched.
|
|
100
|
+
*
|
|
101
|
+
* The threshold counts actions visible FOR THAT ROW, never the number
|
|
102
|
+
* declared: five descriptors whose `hidden` predicates are mutually
|
|
103
|
+
* exclusive by status typically leave two or three per row.
|
|
104
|
+
*/
|
|
105
|
+
iconsUpTo?: number | undefined;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Renderer for `DataGrid.rowActions`.
|
|
109
|
+
*
|
|
110
|
+
* Predicates are evaluated per row, at each cell render. Renders nothing when
|
|
111
|
+
* no action is visible for that row, rather than a trigger that opens an empty
|
|
112
|
+
* menu.
|
|
113
|
+
*
|
|
114
|
+
* NO DEFAULT `ariaLabel` (defect D-12). It used to default to the literal
|
|
115
|
+
* "Actions", which was forwarded to `OverflowMenu`'s `ariaLabel` — and that
|
|
116
|
+
* prop WINS over `labels.trigger`. So a row kebab built here announced
|
|
117
|
+
* "Actions" while every other kebab in the fleet announced OverflowMenu's
|
|
118
|
+
* canonical "Plus d'actions": one concept, two names, which R-2.4 forbids.
|
|
119
|
+
* `MobileRowCard` had the identical defect and was fixed by removing its
|
|
120
|
+
* default; this is the same repair, applied one level up. Omit the argument
|
|
121
|
+
* and OverflowMenu now names itself.
|
|
122
|
+
*
|
|
123
|
+
* PASS A CONTEXTUAL NAME ANYWAY. Neither default is good in a list: twenty
|
|
124
|
+
* identically-named kebabs give a screen-reader user no way to tell which row
|
|
125
|
+
* they are on. `Actions sur le dossier 2025-IM-00042` does.
|
|
126
|
+
*
|
|
127
|
+
* TWO SHAPES, ONE CONTRACT (`iconsUpTo` — promoted from `refonte-frontend`,
|
|
128
|
+
* Area 5). The kebab is the right shape for many or ancillary actions; a row
|
|
129
|
+
* with two or three primary ones reads better as icon buttons, and
|
|
130
|
+
* §Row Interaction treats those as COMPLEMENTARY to the row click. Hosts were
|
|
131
|
+
* writing that second shape themselves — this module served twelve screens
|
|
132
|
+
* with a local copy — which put the R-B.5 `aria-label`, the danger variant and
|
|
133
|
+
* the fallback rule outside the library.
|
|
134
|
+
*
|
|
135
|
+
* NOT hover-only, and that distinction is what makes it admissible: `DataGrid`
|
|
136
|
+
* reveals this renderer's output through `ROW_ACTIONS_OVERLAY_SX`, which keys
|
|
137
|
+
* on `tr:hover`, `tr:focus-within` AND `@media (pointer: coarse)` — so the
|
|
138
|
+
* buttons are reachable by keyboard and on touch (R-K.1). A host that renders
|
|
139
|
+
* an icon row elsewhere, without that overlay, owns that requirement itself.
|
|
140
|
+
*
|
|
141
|
+
* Above the threshold the menu is built by {@link buildRowActionMenu}, so the
|
|
142
|
+
* danger separator and the R-3.3 overflow warning are not re-derived here.
|
|
143
|
+
*
|
|
144
|
+
* @param descriptors actions in display order
|
|
145
|
+
* @param ariaLabel accessible name of the trigger. Omit to inherit
|
|
146
|
+
* OverflowMenu's canonical name; prefer a row-specific one.
|
|
147
|
+
* @param options `{ iconsUpTo }` — see {@link BuildRowActionsOptions}
|
|
148
|
+
*/
|
|
149
|
+
export declare function buildRowActions<T>(descriptors: readonly RowActionDescriptor<T>[], ariaLabel?: string, options?: BuildRowActionsOptions): (row: T) => React.ReactNode;
|
|
150
|
+
//# sourceMappingURL=rowActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rowActions.d.ts","sourceRoot":"","sources":["../../../src/lib/v2/patterns/rowActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,4EAA4E;AAC5E,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,sDAAsD;IACtD,EAAE,EAAE,MAAM,CAAC;IACX,+CAA+C;IAC/C,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;IACnC,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAC1B,qCAAqC;IACrC,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;IAC3C,qDAAqD;IACrD,QAAQ,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;IAC7C,6DAA6D;IAC7D,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,yDAAyD;IACzD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,WAAW,EAAE,SAAS,mBAAmB,CAAC,CAAC,CAAC,EAAE,EAC9C,GAAG,EAAE,CAAC,GACL,kBAAkB,EAAE,CA4CtB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC/B,WAAW,EAAE,SAAS,mBAAmB,CAAC,CAAC,CAAC,EAAE,EAC9C,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,CAAC,GAAG,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CA2D7B"}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MAX_ROW_ACTIONS = void 0;
|
|
7
|
+
exports.buildRowActionMenu = buildRowActionMenu;
|
|
8
|
+
exports.buildRowActions = buildRowActions;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _OverflowMenu = _interopRequireDefault(require("../components/OverflowMenu"));
|
|
11
|
+
var _Button = _interopRequireDefault(require("../components/Button"));
|
|
12
|
+
var _Tooltip = _interopRequireDefault(require("../components/Tooltip"));
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
+
/**
|
|
17
|
+
* rowActions — business action descriptors → the row's kebab menu
|
|
18
|
+
* (capability gap G-41).
|
|
19
|
+
*
|
|
20
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
21
|
+
* WHY THIS BELONGS IN THE LIBRARY
|
|
22
|
+
*
|
|
23
|
+
* The library ships both halves already: `OverflowMenu` renders a flat list of
|
|
24
|
+
* actions, and `DataGrid.rowActions` takes a `(row) => ReactNode` renderer. The
|
|
25
|
+
* step between them is what every listing writes for itself — turning the
|
|
26
|
+
* BUSINESS description of an action ("visible only on a draft", "greyed out
|
|
27
|
+
* while the request is in flight") into a menu for ONE row.
|
|
28
|
+
*
|
|
29
|
+
* That step is not glue. It carries three rules the Charter imposes, and each
|
|
30
|
+
* one is a rule a host can only get right by re-deriving it:
|
|
31
|
+
*
|
|
32
|
+
* R-3.3 ≤ 1 primary + ≤ 3 secondary actions per screen, hence the kebab.
|
|
33
|
+
* R-B.6 a destructive action is separated and marked, not merely last.
|
|
34
|
+
* R-K.1 every mouse-reachable action is keyboard-reachable — which is what
|
|
35
|
+
* `OverflowMenu` gives and what hover-revealed icon rows never did.
|
|
36
|
+
*
|
|
37
|
+
* Promoted from `refonte-frontend` (Area 5), where it served TWELVE screens and
|
|
38
|
+
* had already replaced a local `TableActions` that revealed its actions on
|
|
39
|
+
* hover, via a `mouseup` listener on `document`, with no keyboard equivalent
|
|
40
|
+
* and no `role` / `aria-*`. On those screens, consulting, editing or deleting a
|
|
41
|
+
* file was unreachable without a mouse — the Charter lists "hover-only
|
|
42
|
+
* interactions" among its Forbidden Practices for exactly this reason.
|
|
43
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
44
|
+
*
|
|
45
|
+
* PREDICATES, NOT BOOLEANS, AND THAT IS THE WHOLE POINT. `hidden` and
|
|
46
|
+
* `disabled` take the ROW: an action's availability depends on the state of
|
|
47
|
+
* that row, so it must be evaluated per row, at render. A boolean would force
|
|
48
|
+
* the host to rebuild the descriptor array per row — which is how a card and a
|
|
49
|
+
* table row end up offering different actions for the same record.
|
|
50
|
+
*
|
|
51
|
+
* >>> THE TWO SURFACES ARE WHY `buildRowActionMenu` IS EXPORTED SEPARATELY.
|
|
52
|
+
* >>> A row appears twice: as a table row and, below the mobile breakpoint, as
|
|
53
|
+
* >>> a `MobileRowCard` whose `actions` prop takes `OverflowMenuAction[]` —
|
|
54
|
+
* >>> not a node. With only the renderer exported, a host had to rebuild the
|
|
55
|
+
* >>> menu by hand for the card, and the two copies drifted on the danger
|
|
56
|
+
* >>> separator, the overflow warning and the evaluation of the predicates.
|
|
57
|
+
* >>> The library documents that exact failure for `RowFavoriteToggle`
|
|
58
|
+
* >>> (gap G-36): the local twin announced "Ajouter aux favoris" while the
|
|
59
|
+
* >>> grid column on the same page said "Suivre". Same shape, one level up. <
|
|
60
|
+
*
|
|
61
|
+
* Usage:
|
|
62
|
+
*
|
|
63
|
+
* const descriptors: RowActionDescriptor<Dossier>[] = [
|
|
64
|
+
* { id: "open", label: "Consulter le dossier", icon: <Visibility />, onClick: open },
|
|
65
|
+
* { id: "del", label: "Supprimer définitivement", icon: <Delete />,
|
|
66
|
+
* onClick: remove, danger: true, hidden: (row) => row.status !== "DRAFT" },
|
|
67
|
+
* ];
|
|
68
|
+
*
|
|
69
|
+
* <DataGrid rowActions={buildRowActions(descriptors, `Actions sur ${row.reference}`)} />
|
|
70
|
+
* <MobileRowCard actions={buildRowActionMenu(descriptors, row)} />
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
/** Charter contract of `OverflowMenu`: ancillary row actions, ≤ 7 items. */
|
|
74
|
+
const MAX_ROW_ACTIONS = exports.MAX_ROW_ACTIONS = 7;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* One row action, described by the business.
|
|
78
|
+
*
|
|
79
|
+
* `hidden` and `disabled` are PREDICATES on the row, not booleans — see the
|
|
80
|
+
* note above.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Menu items for ONE row. Predicates are evaluated here, per call.
|
|
85
|
+
*
|
|
86
|
+
* Returns an empty array when nothing is visible, so a caller can decide to
|
|
87
|
+
* render no trigger at all rather than an empty menu.
|
|
88
|
+
*/
|
|
89
|
+
function buildRowActionMenu(descriptors, row) {
|
|
90
|
+
const visible = descriptors.filter(d => !d.hidden?.(row));
|
|
91
|
+
if (visible.length === 0) return [];
|
|
92
|
+
|
|
93
|
+
/* `process.env["NODE_ENV"]` and not `.NODE_ENV`:
|
|
94
|
+
* `noPropertyAccessFromIndexSignature` is mandatory platform-wide, precisely
|
|
95
|
+
* so a missing key cannot read as a guaranteed field. */
|
|
96
|
+
if (process.env["NODE_ENV"] !== "production" && visible.length > MAX_ROW_ACTIONS) {
|
|
97
|
+
// eslint-disable-next-line no-console
|
|
98
|
+
console.warn(`[@portnet/ui] buildRowActionMenu: ${visible.length} actions visible on ` + `one row; OverflowMenu's contract recommends at most ${MAX_ROW_ACTIONS} ` + `(R-3.3). Group them, or move some to the detail page.`);
|
|
99
|
+
}
|
|
100
|
+
const items = [];
|
|
101
|
+
let separatorPlaced = false;
|
|
102
|
+
visible.forEach(d => {
|
|
103
|
+
/* Separator before the FIRST destructive action, and only if something
|
|
104
|
+
* precedes it — a menu does not open on a rule. */
|
|
105
|
+
if (d.danger && !separatorPlaced && items.length > 0) {
|
|
106
|
+
items.push({
|
|
107
|
+
divider: true
|
|
108
|
+
});
|
|
109
|
+
separatorPlaced = true;
|
|
110
|
+
}
|
|
111
|
+
/* Conditional spreads, not `undefined` values: `exactOptionalPropertyTypes`
|
|
112
|
+
* is mandatory platform-wide, so an explicit `undefined` is not the same as
|
|
113
|
+
* an absent key — and `mergeLabels` exists in this library because a spread
|
|
114
|
+
* of `undefined` had silently deleted defaults elsewhere. */
|
|
115
|
+
items.push({
|
|
116
|
+
label: d.label,
|
|
117
|
+
...(d.icon !== undefined ? {
|
|
118
|
+
icon: d.icon
|
|
119
|
+
} : {}),
|
|
120
|
+
onClick: () => d.onClick(row),
|
|
121
|
+
...(d.danger !== undefined ? {
|
|
122
|
+
danger: d.danger
|
|
123
|
+
} : {}),
|
|
124
|
+
...(d.disabled ? {
|
|
125
|
+
disabled: d.disabled(row)
|
|
126
|
+
} : {}),
|
|
127
|
+
...(d.shortcut !== undefined ? {
|
|
128
|
+
shortcut: d.shortcut
|
|
129
|
+
} : {})
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
return items;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Options of {@link buildRowActions}.
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Renderer for `DataGrid.rowActions`.
|
|
141
|
+
*
|
|
142
|
+
* Predicates are evaluated per row, at each cell render. Renders nothing when
|
|
143
|
+
* no action is visible for that row, rather than a trigger that opens an empty
|
|
144
|
+
* menu.
|
|
145
|
+
*
|
|
146
|
+
* NO DEFAULT `ariaLabel` (defect D-12). It used to default to the literal
|
|
147
|
+
* "Actions", which was forwarded to `OverflowMenu`'s `ariaLabel` — and that
|
|
148
|
+
* prop WINS over `labels.trigger`. So a row kebab built here announced
|
|
149
|
+
* "Actions" while every other kebab in the fleet announced OverflowMenu's
|
|
150
|
+
* canonical "Plus d'actions": one concept, two names, which R-2.4 forbids.
|
|
151
|
+
* `MobileRowCard` had the identical defect and was fixed by removing its
|
|
152
|
+
* default; this is the same repair, applied one level up. Omit the argument
|
|
153
|
+
* and OverflowMenu now names itself.
|
|
154
|
+
*
|
|
155
|
+
* PASS A CONTEXTUAL NAME ANYWAY. Neither default is good in a list: twenty
|
|
156
|
+
* identically-named kebabs give a screen-reader user no way to tell which row
|
|
157
|
+
* they are on. `Actions sur le dossier 2025-IM-00042` does.
|
|
158
|
+
*
|
|
159
|
+
* TWO SHAPES, ONE CONTRACT (`iconsUpTo` — promoted from `refonte-frontend`,
|
|
160
|
+
* Area 5). The kebab is the right shape for many or ancillary actions; a row
|
|
161
|
+
* with two or three primary ones reads better as icon buttons, and
|
|
162
|
+
* §Row Interaction treats those as COMPLEMENTARY to the row click. Hosts were
|
|
163
|
+
* writing that second shape themselves — this module served twelve screens
|
|
164
|
+
* with a local copy — which put the R-B.5 `aria-label`, the danger variant and
|
|
165
|
+
* the fallback rule outside the library.
|
|
166
|
+
*
|
|
167
|
+
* NOT hover-only, and that distinction is what makes it admissible: `DataGrid`
|
|
168
|
+
* reveals this renderer's output through `ROW_ACTIONS_OVERLAY_SX`, which keys
|
|
169
|
+
* on `tr:hover`, `tr:focus-within` AND `@media (pointer: coarse)` — so the
|
|
170
|
+
* buttons are reachable by keyboard and on touch (R-K.1). A host that renders
|
|
171
|
+
* an icon row elsewhere, without that overlay, owns that requirement itself.
|
|
172
|
+
*
|
|
173
|
+
* Above the threshold the menu is built by {@link buildRowActionMenu}, so the
|
|
174
|
+
* danger separator and the R-3.3 overflow warning are not re-derived here.
|
|
175
|
+
*
|
|
176
|
+
* @param descriptors actions in display order
|
|
177
|
+
* @param ariaLabel accessible name of the trigger. Omit to inherit
|
|
178
|
+
* OverflowMenu's canonical name; prefer a row-specific one.
|
|
179
|
+
* @param options `{ iconsUpTo }` — see {@link BuildRowActionsOptions}
|
|
180
|
+
*/
|
|
181
|
+
function buildRowActions(descriptors, ariaLabel, options) {
|
|
182
|
+
const iconsUpTo = options?.iconsUpTo;
|
|
183
|
+
return row => {
|
|
184
|
+
/* SAME predicate as `buildRowActionMenu`: how many actions this row
|
|
185
|
+
* actually shows decides the shape, so it must be known before the menu
|
|
186
|
+
* is built. */
|
|
187
|
+
const visible = descriptors.filter(d => !d.hidden?.(row));
|
|
188
|
+
if (visible.length === 0) return null;
|
|
189
|
+
if (iconsUpTo !== undefined && visible.length <= iconsUpTo) {
|
|
190
|
+
/* No spacing container here: `ROW_ACTIONS_OVERLAY_SX` (DataGrid) is
|
|
191
|
+
* already a flex row with `gap: var(--s-1)`. Re-posing one would
|
|
192
|
+
* duplicate the same token one level lower. */
|
|
193
|
+
return visible.map(d => {
|
|
194
|
+
const textLabel = typeof d.label === "string" ? d.label : undefined;
|
|
195
|
+
if (process.env["NODE_ENV"] !== "production" && textLabel === undefined) {
|
|
196
|
+
// eslint-disable-next-line no-console
|
|
197
|
+
console.warn(`[@portnet/ui] buildRowActions: action "${d.id}" has a non-textual ` + "label, so its icon button gets no explicit aria-label (R-B.5). " + "Give the descriptor a string label, or drop `iconsUpTo` for this grid.");
|
|
198
|
+
}
|
|
199
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
200
|
+
title: d.label,
|
|
201
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
202
|
+
iconOnly: true,
|
|
203
|
+
variant: d.danger ? "danger" : "ghost",
|
|
204
|
+
size: "sm",
|
|
205
|
+
...(d.icon !== undefined ? {
|
|
206
|
+
icon: d.icon
|
|
207
|
+
} : {}),
|
|
208
|
+
onClick: () => d.onClick(row),
|
|
209
|
+
...(d.disabled ? {
|
|
210
|
+
disabled: d.disabled(row)
|
|
211
|
+
} : {}),
|
|
212
|
+
...(textLabel !== undefined ? {
|
|
213
|
+
"aria-label": textLabel
|
|
214
|
+
} : {})
|
|
215
|
+
})
|
|
216
|
+
}, d.id);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
const items = buildRowActionMenu(descriptors, row);
|
|
220
|
+
if (items.length === 0) return null;
|
|
221
|
+
/* Conditional spread rather than ariaLabel={ariaLabel}: passing an
|
|
222
|
+
* explicit undefined would still override OverflowMenu's own label
|
|
223
|
+
* under exactOptionalPropertyTypes semantics (defect D-12). */
|
|
224
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_OverflowMenu.default, {
|
|
225
|
+
actions: items,
|
|
226
|
+
...(ariaLabel !== undefined ? {
|
|
227
|
+
ariaLabel
|
|
228
|
+
} : {})
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=rowActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rowActions.js","names":["React","_interopRequireWildcard","require","_OverflowMenu","_interopRequireDefault","_Button","_Tooltip","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","MAX_ROW_ACTIONS","exports","buildRowActionMenu","descriptors","row","visible","filter","d","hidden","length","process","env","console","warn","items","separatorPlaced","forEach","danger","push","divider","label","icon","undefined","onClick","disabled","shortcut","buildRowActions","ariaLabel","options","iconsUpTo","map","textLabel","id","jsx","title","children","iconOnly","variant","size","actions"],"sources":["../../../src/lib/v2/patterns/rowActions.tsx"],"sourcesContent":["import * as React from \"react\";\r\nimport OverflowMenu from \"../components/OverflowMenu\";\r\nimport type { OverflowMenuAction } from \"../components/OverflowMenu\";\r\nimport Button from \"../components/Button\";\r\nimport Tooltip from \"../components/Tooltip\";\r\n\r\n/**\r\n * rowActions — business action descriptors → the row's kebab menu\r\n * (capability gap G-41).\r\n *\r\n * ─────────────────────────────────────────────────────────────────────────────\r\n * WHY THIS BELONGS IN THE LIBRARY\r\n *\r\n * The library ships both halves already: `OverflowMenu` renders a flat list of\r\n * actions, and `DataGrid.rowActions` takes a `(row) => ReactNode` renderer. The\r\n * step between them is what every listing writes for itself — turning the\r\n * BUSINESS description of an action (\"visible only on a draft\", \"greyed out\r\n * while the request is in flight\") into a menu for ONE row.\r\n *\r\n * That step is not glue. It carries three rules the Charter imposes, and each\r\n * one is a rule a host can only get right by re-deriving it:\r\n *\r\n * R-3.3 ≤ 1 primary + ≤ 3 secondary actions per screen, hence the kebab.\r\n * R-B.6 a destructive action is separated and marked, not merely last.\r\n * R-K.1 every mouse-reachable action is keyboard-reachable — which is what\r\n * `OverflowMenu` gives and what hover-revealed icon rows never did.\r\n *\r\n * Promoted from `refonte-frontend` (Area 5), where it served TWELVE screens and\r\n * had already replaced a local `TableActions` that revealed its actions on\r\n * hover, via a `mouseup` listener on `document`, with no keyboard equivalent\r\n * and no `role` / `aria-*`. On those screens, consulting, editing or deleting a\r\n * file was unreachable without a mouse — the Charter lists \"hover-only\r\n * interactions\" among its Forbidden Practices for exactly this reason.\r\n * ─────────────────────────────────────────────────────────────────────────────\r\n *\r\n * PREDICATES, NOT BOOLEANS, AND THAT IS THE WHOLE POINT. `hidden` and\r\n * `disabled` take the ROW: an action's availability depends on the state of\r\n * that row, so it must be evaluated per row, at render. A boolean would force\r\n * the host to rebuild the descriptor array per row — which is how a card and a\r\n * table row end up offering different actions for the same record.\r\n *\r\n * >>> THE TWO SURFACES ARE WHY `buildRowActionMenu` IS EXPORTED SEPARATELY.\r\n * >>> A row appears twice: as a table row and, below the mobile breakpoint, as\r\n * >>> a `MobileRowCard` whose `actions` prop takes `OverflowMenuAction[]` —\r\n * >>> not a node. With only the renderer exported, a host had to rebuild the\r\n * >>> menu by hand for the card, and the two copies drifted on the danger\r\n * >>> separator, the overflow warning and the evaluation of the predicates.\r\n * >>> The library documents that exact failure for `RowFavoriteToggle`\r\n * >>> (gap G-36): the local twin announced \"Ajouter aux favoris\" while the\r\n * >>> grid column on the same page said \"Suivre\". Same shape, one level up. <\r\n *\r\n * Usage:\r\n *\r\n * const descriptors: RowActionDescriptor<Dossier>[] = [\r\n * { id: \"open\", label: \"Consulter le dossier\", icon: <Visibility />, onClick: open },\r\n * { id: \"del\", label: \"Supprimer définitivement\", icon: <Delete />,\r\n * onClick: remove, danger: true, hidden: (row) => row.status !== \"DRAFT\" },\r\n * ];\r\n *\r\n * <DataGrid rowActions={buildRowActions(descriptors, `Actions sur ${row.reference}`)} />\r\n * <MobileRowCard actions={buildRowActionMenu(descriptors, row)} />\r\n */\r\n\r\n/** Charter contract of `OverflowMenu`: ancillary row actions, ≤ 7 items. */\r\nexport const MAX_ROW_ACTIONS = 7;\r\n\r\n/**\r\n * One row action, described by the business.\r\n *\r\n * `hidden` and `disabled` are PREDICATES on the row, not booleans — see the\r\n * note above.\r\n */\r\nexport interface RowActionDescriptor<T> {\r\n /** Stable identifier — render key and test anchor. */\r\n id: string;\r\n /** Menu label. Verb + object (R-B.3, §9.2). */\r\n label: React.ReactNode;\r\n icon?: React.ReactNode | undefined;\r\n onClick: (row: T) => void;\r\n /** Hides the action for this row. */\r\n hidden?: ((row: T) => boolean) | undefined;\r\n /** Shows the action but disables it for this row. */\r\n disabled?: ((row: T) => boolean) | undefined;\r\n /** Destructive: separator before, danger styling (R-B.6). */\r\n danger?: boolean | undefined;\r\n /** Keyboard shortcut rendered at the end of the item. */\r\n shortcut?: React.ReactNode | undefined;\r\n}\r\n\r\n/**\r\n * Menu items for ONE row. Predicates are evaluated here, per call.\r\n *\r\n * Returns an empty array when nothing is visible, so a caller can decide to\r\n * render no trigger at all rather than an empty menu.\r\n */\r\nexport function buildRowActionMenu<T>(\r\n descriptors: readonly RowActionDescriptor<T>[],\r\n row: T\r\n): OverflowMenuAction[] {\r\n const visible = descriptors.filter((d) => !d.hidden?.(row));\r\n if (visible.length === 0) return [];\r\n\r\n /* `process.env[\"NODE_ENV\"]` and not `.NODE_ENV`:\r\n * `noPropertyAccessFromIndexSignature` is mandatory platform-wide, precisely\r\n * so a missing key cannot read as a guaranteed field. */\r\n if (\r\n process.env[\"NODE_ENV\"] !== \"production\" &&\r\n visible.length > MAX_ROW_ACTIONS\r\n ) {\r\n // eslint-disable-next-line no-console\r\n console.warn(\r\n `[@portnet/ui] buildRowActionMenu: ${visible.length} actions visible on ` +\r\n `one row; OverflowMenu's contract recommends at most ${MAX_ROW_ACTIONS} ` +\r\n `(R-3.3). Group them, or move some to the detail page.`\r\n );\r\n }\r\n\r\n const items: OverflowMenuAction[] = [];\r\n let separatorPlaced = false;\r\n\r\n visible.forEach((d) => {\r\n /* Separator before the FIRST destructive action, and only if something\r\n * precedes it — a menu does not open on a rule. */\r\n if (d.danger && !separatorPlaced && items.length > 0) {\r\n items.push({ divider: true });\r\n separatorPlaced = true;\r\n }\r\n /* Conditional spreads, not `undefined` values: `exactOptionalPropertyTypes`\r\n * is mandatory platform-wide, so an explicit `undefined` is not the same as\r\n * an absent key — and `mergeLabels` exists in this library because a spread\r\n * of `undefined` had silently deleted defaults elsewhere. */\r\n items.push({\r\n label: d.label,\r\n ...(d.icon !== undefined ? { icon: d.icon } : {}),\r\n onClick: () => d.onClick(row),\r\n ...(d.danger !== undefined ? { danger: d.danger } : {}),\r\n ...(d.disabled ? { disabled: d.disabled(row) } : {}),\r\n ...(d.shortcut !== undefined ? { shortcut: d.shortcut } : {}),\r\n });\r\n });\r\n\r\n return items;\r\n}\r\n\r\n/**\r\n * Options of {@link buildRowActions}.\r\n */\r\nexport interface BuildRowActionsOptions {\r\n /**\r\n * Render the row's VISIBLE actions as icon buttons while their count is\r\n * at most this value; fall back to the kebab menu above it.\r\n *\r\n * Omitted — the default — always renders the kebab, so existing callers\r\n * are untouched.\r\n *\r\n * The threshold counts actions visible FOR THAT ROW, never the number\r\n * declared: five descriptors whose `hidden` predicates are mutually\r\n * exclusive by status typically leave two or three per row.\r\n */\r\n iconsUpTo?: number | undefined;\r\n}\r\n\r\n/**\r\n * Renderer for `DataGrid.rowActions`.\r\n *\r\n * Predicates are evaluated per row, at each cell render. Renders nothing when\r\n * no action is visible for that row, rather than a trigger that opens an empty\r\n * menu.\r\n *\r\n * NO DEFAULT `ariaLabel` (defect D-12). It used to default to the literal\r\n * \"Actions\", which was forwarded to `OverflowMenu`'s `ariaLabel` — and that\r\n * prop WINS over `labels.trigger`. So a row kebab built here announced\r\n * \"Actions\" while every other kebab in the fleet announced OverflowMenu's\r\n * canonical \"Plus d'actions\": one concept, two names, which R-2.4 forbids.\r\n * `MobileRowCard` had the identical defect and was fixed by removing its\r\n * default; this is the same repair, applied one level up. Omit the argument\r\n * and OverflowMenu now names itself.\r\n *\r\n * PASS A CONTEXTUAL NAME ANYWAY. Neither default is good in a list: twenty\r\n * identically-named kebabs give a screen-reader user no way to tell which row\r\n * they are on. `Actions sur le dossier 2025-IM-00042` does.\r\n *\r\n * TWO SHAPES, ONE CONTRACT (`iconsUpTo` — promoted from `refonte-frontend`,\r\n * Area 5). The kebab is the right shape for many or ancillary actions; a row\r\n * with two or three primary ones reads better as icon buttons, and\r\n * §Row Interaction treats those as COMPLEMENTARY to the row click. Hosts were\r\n * writing that second shape themselves — this module served twelve screens\r\n * with a local copy — which put the R-B.5 `aria-label`, the danger variant and\r\n * the fallback rule outside the library.\r\n *\r\n * NOT hover-only, and that distinction is what makes it admissible: `DataGrid`\r\n * reveals this renderer's output through `ROW_ACTIONS_OVERLAY_SX`, which keys\r\n * on `tr:hover`, `tr:focus-within` AND `@media (pointer: coarse)` — so the\r\n * buttons are reachable by keyboard and on touch (R-K.1). A host that renders\r\n * an icon row elsewhere, without that overlay, owns that requirement itself.\r\n *\r\n * Above the threshold the menu is built by {@link buildRowActionMenu}, so the\r\n * danger separator and the R-3.3 overflow warning are not re-derived here.\r\n *\r\n * @param descriptors actions in display order\r\n * @param ariaLabel accessible name of the trigger. Omit to inherit\r\n * OverflowMenu's canonical name; prefer a row-specific one.\r\n * @param options `{ iconsUpTo }` — see {@link BuildRowActionsOptions}\r\n */\r\nexport function buildRowActions<T>(\r\n descriptors: readonly RowActionDescriptor<T>[],\r\n ariaLabel?: string,\r\n options?: BuildRowActionsOptions\r\n): (row: T) => React.ReactNode {\r\n const iconsUpTo = options?.iconsUpTo;\r\n\r\n return (row: T) => {\r\n /* SAME predicate as `buildRowActionMenu`: how many actions this row\r\n * actually shows decides the shape, so it must be known before the menu\r\n * is built. */\r\n const visible = descriptors.filter((d) => !d.hidden?.(row));\r\n if (visible.length === 0) return null;\r\n\r\n if (iconsUpTo !== undefined && visible.length <= iconsUpTo) {\r\n /* No spacing container here: `ROW_ACTIONS_OVERLAY_SX` (DataGrid) is\r\n * already a flex row with `gap: var(--s-1)`. Re-posing one would\r\n * duplicate the same token one level lower. */\r\n return visible.map((d) => {\r\n const textLabel = typeof d.label === \"string\" ? d.label : undefined;\r\n\r\n if (\r\n process.env[\"NODE_ENV\"] !== \"production\" &&\r\n textLabel === undefined\r\n ) {\r\n // eslint-disable-next-line no-console\r\n console.warn(\r\n `[@portnet/ui] buildRowActions: action \"${d.id}\" has a non-textual ` +\r\n \"label, so its icon button gets no explicit aria-label (R-B.5). \" +\r\n \"Give the descriptor a string label, or drop `iconsUpTo` for this grid.\"\r\n );\r\n }\r\n\r\n return (\r\n <Tooltip key={d.id} title={d.label}>\r\n <Button\r\n iconOnly\r\n variant={d.danger ? \"danger\" : \"ghost\"}\r\n size=\"sm\"\r\n {...(d.icon !== undefined ? { icon: d.icon } : {})}\r\n onClick={() => d.onClick(row)}\r\n {...(d.disabled ? { disabled: d.disabled(row) } : {})}\r\n {...(textLabel !== undefined\r\n ? { \"aria-label\": textLabel }\r\n : {})}\r\n />\r\n </Tooltip>\r\n );\r\n });\r\n }\r\n\r\n const items = buildRowActionMenu(descriptors, row);\r\n if (items.length === 0) return null;\r\n /* Conditional spread rather than ariaLabel={ariaLabel}: passing an\r\n * explicit undefined would still override OverflowMenu's own label\r\n * under exactOptionalPropertyTypes semantics (defect D-12). */\r\n return (\r\n <OverflowMenu\r\n actions={items}\r\n {...(ariaLabel !== undefined ? { ariaLabel } : {})}\r\n />\r\n );\r\n };\r\n}"],"mappings":"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","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersonalizationProvider.d.ts","sourceRoot":"","sources":["../../../src/lib/v2/personalization/PersonalizationProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAEV,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAEhF,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAS,MAAM,SAAS,CAAC;AAO/D;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;EAqBT,CAAC;AAEnC,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;IACvC,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,qFAAqF;IACrF,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC/C,qDAAqD;IACrD,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,SAAS,CAAC;IACpD,gFAAgF;IAChF,OAAO,CAAC,EAAE,2BAA2B,GAAG,SAAS,CAAC;IAClD,qGAAqG;IACrG,eAAe,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;CAC/C;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,gCAAgC,GACtC,KAAK,CAAC,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"PersonalizationProvider.d.ts","sourceRoot":"","sources":["../../../src/lib/v2/personalization/PersonalizationProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAEV,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAEhF,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAS,MAAM,SAAS,CAAC;AAO/D;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;EAqBT,CAAC;AAEnC,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;IACvC,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,qFAAqF;IACrF,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC/C,qDAAqD;IACrD,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,SAAS,CAAC;IACpD,gFAAgF;IAChF,OAAO,CAAC,EAAE,2BAA2B,GAAG,SAAS,CAAC;IAClD,qGAAqG;IACrG,eAAe,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;CAC/C;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,gCAAgC,GACtC,KAAK,CAAC,GAAG,CAAC,OAAO,CA+HnB;AAED,eAAe,2BAA2B,CAAC"}
|
|
@@ -5,21 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.DEFAULT_PERSONALIZATION_LABELS = void 0;
|
|
7
7
|
exports.UserPersonalizationProvider = UserPersonalizationProvider;
|
|
8
|
-
exports
|
|
8
|
+
exports.default = void 0;
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _personalizationContext = require("./personalizationContext");
|
|
11
11
|
var _createPersonalizationStore = _interopRequireDefault(require("./createPersonalizationStore"));
|
|
12
12
|
var _createLocalStorageAdapter = _interopRequireDefault(require("./adapters/createLocalStorageAdapter"));
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
function _interopRequireDefault(
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
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); }
|
|
18
|
-
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; }
|
|
19
|
-
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; }
|
|
20
|
-
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; }
|
|
21
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
22
|
-
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); } /**
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
+
/**
|
|
23
17
|
* UserPersonalizationProvider — Portnet UI v2 · personalization
|
|
24
18
|
*
|
|
25
19
|
* The single configuration point for per-user personalization. Mount it
|
|
@@ -47,7 +41,8 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
47
41
|
*
|
|
48
42
|
* React 18/19 compatible: no 19-only API is required.
|
|
49
43
|
*/
|
|
50
|
-
|
|
44
|
+
|
|
45
|
+
const isDev = typeof process !== "undefined" && process.env && process.env["NODE_ENV"] !== "production";
|
|
51
46
|
|
|
52
47
|
/**
|
|
53
48
|
* Default labels for the whole foundation (FR — charter default). Hosts
|
|
@@ -55,7 +50,7 @@ var isDev = typeof process !== "undefined" && process.env && process.env["NODE_E
|
|
|
55
50
|
* Front-loaded here so the favorites (Batch 3) and saved-filters (Batch 4)
|
|
56
51
|
* components read consistent copy from one place.
|
|
57
52
|
*/
|
|
58
|
-
|
|
53
|
+
const DEFAULT_PERSONALIZATION_LABELS = exports.DEFAULT_PERSONALIZATION_LABELS = Object.freeze({
|
|
59
54
|
// Follow / "suivis" (Batch 3)
|
|
60
55
|
addFavorite: "Suivre",
|
|
61
56
|
removeFavorite: "Ne plus suivre",
|
|
@@ -78,51 +73,57 @@ var DEFAULT_PERSONALIZATION_LABELS = exports.DEFAULT_PERSONALIZATION_LABELS = Ob
|
|
|
78
73
|
cancel: "Annuler"
|
|
79
74
|
});
|
|
80
75
|
function UserPersonalizationProvider(props) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
hydrateStrategy =
|
|
76
|
+
const {
|
|
77
|
+
children,
|
|
78
|
+
userId,
|
|
79
|
+
tenantId,
|
|
80
|
+
appId,
|
|
81
|
+
adapter,
|
|
82
|
+
defaults,
|
|
83
|
+
labels,
|
|
84
|
+
onError,
|
|
85
|
+
hydrateStrategy = "remote-wins"
|
|
86
|
+
} = props;
|
|
87
|
+
|
|
88
|
+
// eslint-disable-next-line no-console
|
|
91
89
|
if (isDev && !userId && typeof console !== "undefined" && console.warn) {
|
|
92
90
|
// eslint-disable-next-line no-console
|
|
93
91
|
console.warn("[@portnet/ui v2] UserPersonalizationProvider: `userId` is required to scope personalization. " + "Falling back to 'anonymous' — persisted preferences will be shared across unauthenticated sessions.");
|
|
94
92
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return
|
|
98
|
-
userId: resolvedUserId
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
appId
|
|
103
|
-
|
|
93
|
+
const resolvedUserId = userId || "anonymous";
|
|
94
|
+
const scope = React.useMemo(function buildScope() {
|
|
95
|
+
return {
|
|
96
|
+
userId: resolvedUserId,
|
|
97
|
+
...(tenantId !== undefined ? {
|
|
98
|
+
tenantId
|
|
99
|
+
} : {}),
|
|
100
|
+
...(appId !== undefined ? {
|
|
101
|
+
appId
|
|
102
|
+
} : {})
|
|
103
|
+
};
|
|
104
104
|
}, [resolvedUserId, tenantId, appId]);
|
|
105
105
|
|
|
106
106
|
// Default adapter created once; a provided adapter is trusted to be stable.
|
|
107
|
-
|
|
107
|
+
const defaultAdapterRef = React.useRef(null);
|
|
108
108
|
if (!adapter && !defaultAdapterRef.current) {
|
|
109
|
-
defaultAdapterRef.current = (0, _createLocalStorageAdapter
|
|
109
|
+
defaultAdapterRef.current = (0, _createLocalStorageAdapter.default)();
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
const resolvedAdapter = adapter || defaultAdapterRef.current;
|
|
112
112
|
|
|
113
113
|
// One store per (scope, adapter). Intentionally NOT keyed on
|
|
114
114
|
// defaults/onError/hydrateStrategy: those are fed live below.
|
|
115
|
-
|
|
116
|
-
return (0, _createPersonalizationStore
|
|
115
|
+
const store = React.useMemo(function buildStore() {
|
|
116
|
+
return (0, _createPersonalizationStore.default)({
|
|
117
117
|
scope: scope,
|
|
118
|
-
adapter: resolvedAdapter
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
onError
|
|
123
|
-
|
|
118
|
+
adapter: resolvedAdapter,
|
|
119
|
+
...(defaults !== undefined ? {
|
|
120
|
+
defaults
|
|
121
|
+
} : {}),
|
|
122
|
+
...(onError !== undefined ? {
|
|
123
|
+
onError
|
|
124
|
+
} : {}),
|
|
124
125
|
hydrateStrategy: hydrateStrategy
|
|
125
|
-
})
|
|
126
|
+
});
|
|
126
127
|
},
|
|
127
128
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
128
129
|
[scope, resolvedAdapter]);
|
|
@@ -130,7 +131,7 @@ function UserPersonalizationProvider(props) {
|
|
|
130
131
|
// Hydrate + cross-tab connect; dispose on store change / unmount.
|
|
131
132
|
React.useEffect(function lifecycle() {
|
|
132
133
|
store.hydrate();
|
|
133
|
-
|
|
134
|
+
const off = store.connect();
|
|
134
135
|
return function teardown() {
|
|
135
136
|
if (typeof off === "function") off();
|
|
136
137
|
store.dispose();
|
|
@@ -139,27 +140,30 @@ function UserPersonalizationProvider(props) {
|
|
|
139
140
|
|
|
140
141
|
// Push live runtime options without recreating the store.
|
|
141
142
|
React.useEffect(function syncRuntime() {
|
|
142
|
-
store.setRuntime(
|
|
143
|
-
onError
|
|
144
|
-
|
|
143
|
+
store.setRuntime({
|
|
144
|
+
...(onError !== undefined ? {
|
|
145
|
+
onError
|
|
146
|
+
} : {}),
|
|
145
147
|
hydrateStrategy: hydrateStrategy
|
|
146
|
-
})
|
|
148
|
+
});
|
|
147
149
|
}, [store, onError, hydrateStrategy]);
|
|
148
150
|
|
|
149
151
|
// Dev guard: a non-memoised adapter prop would recreate the store each
|
|
150
152
|
// render and wipe in-memory state. Warn so it's caught early.
|
|
151
|
-
|
|
153
|
+
const prevAdapterRef = React.useRef(resolvedAdapter);
|
|
152
154
|
React.useEffect(function guardAdapterIdentity() {
|
|
153
|
-
if (isDev && prevAdapterRef.current !== resolvedAdapter && typeof console !== "undefined" &&
|
|
155
|
+
if (isDev && prevAdapterRef.current !== resolvedAdapter && typeof console !== "undefined" &&
|
|
156
|
+
// eslint-disable-next-line no-console
|
|
157
|
+
console.warn) {
|
|
154
158
|
// eslint-disable-next-line no-console
|
|
155
159
|
console.warn("[@portnet/ui v2] UserPersonalizationProvider: the `adapter` prop changed identity between " + "renders. Memoise it (useMemo or a module singleton) to avoid re-creating the personalization store.");
|
|
156
160
|
}
|
|
157
161
|
prevAdapterRef.current = resolvedAdapter;
|
|
158
162
|
}, [resolvedAdapter]);
|
|
159
|
-
|
|
163
|
+
const mergedLabels = React.useMemo(function mergeLabels() {
|
|
160
164
|
return labels ? Object.assign({}, DEFAULT_PERSONALIZATION_LABELS, labels) : DEFAULT_PERSONALIZATION_LABELS;
|
|
161
165
|
}, [labels]);
|
|
162
|
-
|
|
166
|
+
const configValue = React.useMemo(function buildConfig() {
|
|
163
167
|
return {
|
|
164
168
|
scope: scope,
|
|
165
169
|
labels: mergedLabels
|
|
@@ -173,5 +177,5 @@ function UserPersonalizationProvider(props) {
|
|
|
173
177
|
})
|
|
174
178
|
});
|
|
175
179
|
}
|
|
176
|
-
var _default = exports
|
|
180
|
+
var _default = exports.default = UserPersonalizationProvider;
|
|
177
181
|
//# sourceMappingURL=PersonalizationProvider.js.map
|