@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,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.GRID_PREFERENCES_CAPABILITY_ID = void 0;
|
|
7
|
+
exports.useGridPreferences = useGridPreferences;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _schema = require("../schema");
|
|
10
|
+
var _personalizationContext = require("../personalizationContext");
|
|
11
|
+
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); }
|
|
12
|
+
/**
|
|
13
|
+
* gridPreferences — Portnet UI v2 · personalization capability
|
|
14
|
+
*
|
|
15
|
+
* Per-user, per-resource DataGrid preferences. Self-registers the
|
|
16
|
+
* "gridPreferences" capability with the schema registry at import time, so the
|
|
17
|
+
* capability-agnostic foundation discovers its schemaVersion / defaultState /
|
|
18
|
+
* migrate without any hardcoding.
|
|
19
|
+
*
|
|
20
|
+
* State model (the capability payload):
|
|
21
|
+
* { [resourceKey]: { hiddenColumns: string[] } }
|
|
22
|
+
*
|
|
23
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
24
|
+
* WHY THIS BELONGS IN THE LIBRARY (capability gap G-35)
|
|
25
|
+
*
|
|
26
|
+
* `DataGridToolbar` owns the column-visibility UI (`hiddenColumns` +
|
|
27
|
+
* `onHiddenColumnsChange`) but deliberately holds no state, so PERSISTING the
|
|
28
|
+
* choice is left to the host. Every listing screen therefore reached for raw
|
|
29
|
+
* `localStorage` — observed in onssa-export-fe as
|
|
30
|
+
* `"onssaCertificates:listing:hiddenColumns"`, hand-written JSON.parse
|
|
31
|
+
* included.
|
|
32
|
+
*
|
|
33
|
+
* That is not merely duplication. A bare `localStorage` key is NOT USER-SCOPED,
|
|
34
|
+
* while this foundation's own key scheme is:
|
|
35
|
+
*
|
|
36
|
+
* portnet-ui:perso:v1:{tenantId?}:{userId}:{capabilityId}
|
|
37
|
+
*
|
|
38
|
+
* So on a shared workstation — the norm at a port — user B inherited user A's
|
|
39
|
+
* hidden columns, and a column A had hidden stayed invisible to B with no
|
|
40
|
+
* affordance explaining why. Favorites and saved filters were already immune
|
|
41
|
+
* because they route through this foundation; column visibility was the one
|
|
42
|
+
* grid preference that did not.
|
|
43
|
+
*
|
|
44
|
+
* It could not be fixed in a host, either. `registerCapability` is exported as
|
|
45
|
+
* a "capability registration seam — for custom/host-defined capabilities", but
|
|
46
|
+
* the two primitives every capability hook needs — `usePersonalizationStore`
|
|
47
|
+
* and `useStoreSelector` — are deliberately private ("architecture doc §2.8 —
|
|
48
|
+
* minimum API surface"). A host could register a descriptor and then had no way
|
|
49
|
+
* to read or write its payload. The seam was advertised but not complete, so
|
|
50
|
+
* the slice has to live here, exactly like favorites and savedFilters.
|
|
51
|
+
*
|
|
52
|
+
* DENSITY IS DELIBERATELY NOT PART OF THIS. `useDensity` (v2/hooks) owns the
|
|
53
|
+
* density preference as a GLOBAL, non-resource-scoped value on its own
|
|
54
|
+
* `portnet-ui-density` key, and it applies `data-density` to <html>. Folding it
|
|
55
|
+
* in here would give one preference two owners. Note however that it is
|
|
56
|
+
* unscoped for the same reason this capability exists — tracked separately,
|
|
57
|
+
* since moving it into the foundation changes its storage key and would make it
|
|
58
|
+
* require a provider (a breaking change for current callers).
|
|
59
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
60
|
+
*
|
|
61
|
+
* Usage:
|
|
62
|
+
*
|
|
63
|
+
* const { hiddenColumns, setHiddenColumns } = useGridPreferences("ti:list");
|
|
64
|
+
*
|
|
65
|
+
* <DataGridToolbar
|
|
66
|
+
* columns={columns}
|
|
67
|
+
* hiddenColumns={hiddenColumns}
|
|
68
|
+
* onHiddenColumnsChange={setHiddenColumns}
|
|
69
|
+
* … />
|
|
70
|
+
* <DataGrid columns={columns} hiddenColumns={hiddenColumns} … />
|
|
71
|
+
*
|
|
72
|
+
* `resourceKey` namespaces preferences per list (e.g. "ti:list",
|
|
73
|
+
* "declarations:list") so two grids in one app never collide. Requires a
|
|
74
|
+
* <UserPersonalizationProvider> ancestor.
|
|
75
|
+
*
|
|
76
|
+
* Performance: the pure helpers rebuild only the touched resourceKey's entry
|
|
77
|
+
* and shallow-copy the map, so the store's structural sharing keeps every OTHER
|
|
78
|
+
* resource's preferences referentially stable — and the exposed `Set` is
|
|
79
|
+
* memoised on the stored array, so its identity survives re-renders and does
|
|
80
|
+
* not defeat DataGrid's memoisation.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
/** One resource's grid preferences. Optional members so the shape can grow
|
|
84
|
+
* (column order, widths) without a schemaVersion bump. */
|
|
85
|
+
|
|
86
|
+
/** The gridPreferences capability payload: entries keyed by resourceKey. */
|
|
87
|
+
|
|
88
|
+
const GRID_PREFERENCES_CAPABILITY_ID = exports.GRID_PREFERENCES_CAPABILITY_ID = "gridPreferences";
|
|
89
|
+
const SCHEMA_VERSION = 1;
|
|
90
|
+
const EMPTY_LIST = Object.freeze([]);
|
|
91
|
+
const EMPTY_MAP = Object.freeze({});
|
|
92
|
+
function isString(value) {
|
|
93
|
+
return typeof value === "string";
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* Register at import time — the foundation reads this at hydration. */
|
|
97
|
+
(0, _schema.registerCapability)({
|
|
98
|
+
id: GRID_PREFERENCES_CAPABILITY_ID,
|
|
99
|
+
schemaVersion: SCHEMA_VERSION,
|
|
100
|
+
defaultState: EMPTY_MAP,
|
|
101
|
+
// { [resourceKey]: { hiddenColumns: string[] } }
|
|
102
|
+
migrate: function migrateGridPreferences(_fromVersion, payload) {
|
|
103
|
+
/* v1 is the initial schema, so there is no version to upgrade FROM — but
|
|
104
|
+
* this is the load-time trust boundary for a payload that came back from
|
|
105
|
+
* storage, and it is the right place to normalise it. A column key is used
|
|
106
|
+
* to hide grid columns; a number or an object arriving from an older build
|
|
107
|
+
* (or from hand-edited devtools storage) must not reach the DataGrid as if
|
|
108
|
+
* it were one. Anything unrecognised is dropped rather than repaired. */
|
|
109
|
+
if (!payload || typeof payload !== "object") return {};
|
|
110
|
+
const source = payload;
|
|
111
|
+
const next = {};
|
|
112
|
+
for (const resourceKey of Object.keys(source)) {
|
|
113
|
+
const entry = source[resourceKey];
|
|
114
|
+
if (!entry || typeof entry !== "object") continue;
|
|
115
|
+
const raw = entry["hiddenColumns"];
|
|
116
|
+
if (!Array.isArray(raw)) continue;
|
|
117
|
+
const keys = raw.filter(isString);
|
|
118
|
+
if (keys.length > 0) next[resourceKey] = {
|
|
119
|
+
hiddenColumns: keys
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
return next;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
/* ── pure, resourceKey-scoped state helpers (structural sharing) ────── */
|
|
127
|
+
|
|
128
|
+
function listFor(map, resourceKey) {
|
|
129
|
+
const entry = map ? map[resourceKey] : undefined;
|
|
130
|
+
const list = entry ? entry.hiddenColumns : undefined;
|
|
131
|
+
return Array.isArray(list) ? list : EMPTY_LIST;
|
|
132
|
+
}
|
|
133
|
+
function sameMembers(a, b) {
|
|
134
|
+
if (a.length !== b.length) return false;
|
|
135
|
+
for (let i = 0; i < a.length; i++) {
|
|
136
|
+
if (a[i] !== b[i]) return false;
|
|
137
|
+
}
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
function setList(map, resourceKey, keys) {
|
|
141
|
+
const base = map || EMPTY_MAP;
|
|
142
|
+
// No-op when unchanged → the store short-circuits and nothing re-renders.
|
|
143
|
+
if (sameMembers(listFor(base, resourceKey), keys)) return base;
|
|
144
|
+
const next = Object.assign({}, base);
|
|
145
|
+
if (keys.length === 0) {
|
|
146
|
+
// Nothing hidden is the default; drop the entry rather than persist an
|
|
147
|
+
// empty array, so the payload stays tidy and a reset leaves no residue.
|
|
148
|
+
delete next[resourceKey];
|
|
149
|
+
} else {
|
|
150
|
+
// Spread, not Object.assign: `base[resourceKey]` is
|
|
151
|
+
// `GridPreferencesEntry | undefined` under noUncheckedIndexedAccess, and
|
|
152
|
+
// passing undefined as an Object.assign source yields an intersection
|
|
153
|
+
// containing undefined. Spreading undefined is well-defined ({}), and it
|
|
154
|
+
// preserves any sibling preference a future schema adds alongside
|
|
155
|
+
// hiddenColumns.
|
|
156
|
+
next[resourceKey] = {
|
|
157
|
+
...base[resourceKey],
|
|
158
|
+
hiddenColumns: keys.slice()
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
return next;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/* ── hook ───────────────────────────────────────────────────────────── */
|
|
165
|
+
|
|
166
|
+
function useEnsureGridPreferences(store) {
|
|
167
|
+
React.useEffect(function ensure() {
|
|
168
|
+
store.ensureCapability(GRID_PREFERENCES_CAPABILITY_ID);
|
|
169
|
+
}, [store]);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* useGridPreferences(resourceKey) — persisted, per-user grid preferences for
|
|
173
|
+
* one resource.
|
|
174
|
+
*/
|
|
175
|
+
function useGridPreferences(resourceKey) {
|
|
176
|
+
const store = (0, _personalizationContext.usePersonalizationStore)();
|
|
177
|
+
useEnsureGridPreferences(store);
|
|
178
|
+
const selectList = React.useCallback(function selectList(snapshot) {
|
|
179
|
+
const slice = snapshot[GRID_PREFERENCES_CAPABILITY_ID];
|
|
180
|
+
return slice ? listFor(slice, resourceKey) : EMPTY_LIST;
|
|
181
|
+
}, [resourceKey]);
|
|
182
|
+
const keys = (0, _personalizationContext.useStoreSelector)(selectList);
|
|
183
|
+
|
|
184
|
+
// Stable while `keys` is stable (structural sharing), so the Set identity
|
|
185
|
+
// does not churn on every render and DataGrid's memoisation still holds.
|
|
186
|
+
const hiddenColumns = React.useMemo(function buildSet() {
|
|
187
|
+
return new Set(keys);
|
|
188
|
+
}, [keys]);
|
|
189
|
+
const setHiddenColumns = React.useCallback(function setHiddenColumns(hidden) {
|
|
190
|
+
// Normalise at the write boundary too: the caller is UI code, but the
|
|
191
|
+
// value is about to be persisted and re-read by a later session.
|
|
192
|
+
const nextKeys = Array.from(hidden).filter(isString);
|
|
193
|
+
store.write(GRID_PREFERENCES_CAPABILITY_ID, function (prev) {
|
|
194
|
+
return setList(prev, resourceKey, nextKeys);
|
|
195
|
+
});
|
|
196
|
+
}, [store, resourceKey]);
|
|
197
|
+
const resetHiddenColumns = React.useCallback(function resetHiddenColumns() {
|
|
198
|
+
store.write(GRID_PREFERENCES_CAPABILITY_ID, function (prev) {
|
|
199
|
+
return setList(prev, resourceKey, EMPTY_LIST);
|
|
200
|
+
});
|
|
201
|
+
}, [store, resourceKey]);
|
|
202
|
+
return React.useMemo(function value() {
|
|
203
|
+
return {
|
|
204
|
+
hiddenColumns: hiddenColumns,
|
|
205
|
+
setHiddenColumns: setHiddenColumns,
|
|
206
|
+
resetHiddenColumns: resetHiddenColumns
|
|
207
|
+
};
|
|
208
|
+
}, [hiddenColumns, setHiddenColumns, resetHiddenColumns]);
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=gridPreferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gridPreferences.js","names":["React","_interopRequireWildcard","require","_schema","_personalizationContext","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GRID_PREFERENCES_CAPABILITY_ID","exports","SCHEMA_VERSION","EMPTY_LIST","freeze","EMPTY_MAP","isString","value","registerCapability","id","schemaVersion","defaultState","migrate","migrateGridPreferences","_fromVersion","payload","source","next","resourceKey","keys","entry","raw","Array","isArray","filter","length","hiddenColumns","listFor","map","undefined","list","sameMembers","a","b","setList","base","assign","slice","useEnsureGridPreferences","store","useEffect","ensure","ensureCapability","useGridPreferences","usePersonalizationStore","selectList","useCallback","snapshot","useStoreSelector","useMemo","buildSet","Set","setHiddenColumns","hidden","nextKeys","from","write","prev","resetHiddenColumns"],"sources":["../../../../src/lib/v2/personalization/capabilities/gridPreferences.ts"],"sourcesContent":["/**\r\n * gridPreferences — Portnet UI v2 · personalization capability\r\n *\r\n * Per-user, per-resource DataGrid preferences. Self-registers the\r\n * \"gridPreferences\" capability with the schema registry at import time, so the\r\n * capability-agnostic foundation discovers its schemaVersion / defaultState /\r\n * migrate without any hardcoding.\r\n *\r\n * State model (the capability payload):\r\n * { [resourceKey]: { hiddenColumns: string[] } }\r\n *\r\n * ─────────────────────────────────────────────────────────────────────────────\r\n * WHY THIS BELONGS IN THE LIBRARY (capability gap G-35)\r\n *\r\n * `DataGridToolbar` owns the column-visibility UI (`hiddenColumns` +\r\n * `onHiddenColumnsChange`) but deliberately holds no state, so PERSISTING the\r\n * choice is left to the host. Every listing screen therefore reached for raw\r\n * `localStorage` — observed in onssa-export-fe as\r\n * `\"onssaCertificates:listing:hiddenColumns\"`, hand-written JSON.parse\r\n * included.\r\n *\r\n * That is not merely duplication. A bare `localStorage` key is NOT USER-SCOPED,\r\n * while this foundation's own key scheme is:\r\n *\r\n * portnet-ui:perso:v1:{tenantId?}:{userId}:{capabilityId}\r\n *\r\n * So on a shared workstation — the norm at a port — user B inherited user A's\r\n * hidden columns, and a column A had hidden stayed invisible to B with no\r\n * affordance explaining why. Favorites and saved filters were already immune\r\n * because they route through this foundation; column visibility was the one\r\n * grid preference that did not.\r\n *\r\n * It could not be fixed in a host, either. `registerCapability` is exported as\r\n * a \"capability registration seam — for custom/host-defined capabilities\", but\r\n * the two primitives every capability hook needs — `usePersonalizationStore`\r\n * and `useStoreSelector` — are deliberately private (\"architecture doc §2.8 —\r\n * minimum API surface\"). A host could register a descriptor and then had no way\r\n * to read or write its payload. The seam was advertised but not complete, so\r\n * the slice has to live here, exactly like favorites and savedFilters.\r\n *\r\n * DENSITY IS DELIBERATELY NOT PART OF THIS. `useDensity` (v2/hooks) owns the\r\n * density preference as a GLOBAL, non-resource-scoped value on its own\r\n * `portnet-ui-density` key, and it applies `data-density` to <html>. Folding it\r\n * in here would give one preference two owners. Note however that it is\r\n * unscoped for the same reason this capability exists — tracked separately,\r\n * since moving it into the foundation changes its storage key and would make it\r\n * require a provider (a breaking change for current callers).\r\n * ─────────────────────────────────────────────────────────────────────────────\r\n *\r\n * Usage:\r\n *\r\n * const { hiddenColumns, setHiddenColumns } = useGridPreferences(\"ti:list\");\r\n *\r\n * <DataGridToolbar\r\n * columns={columns}\r\n * hiddenColumns={hiddenColumns}\r\n * onHiddenColumnsChange={setHiddenColumns}\r\n * … />\r\n * <DataGrid columns={columns} hiddenColumns={hiddenColumns} … />\r\n *\r\n * `resourceKey` namespaces preferences per list (e.g. \"ti:list\",\r\n * \"declarations:list\") so two grids in one app never collide. Requires a\r\n * <UserPersonalizationProvider> ancestor.\r\n *\r\n * Performance: the pure helpers rebuild only the touched resourceKey's entry\r\n * and shallow-copy the map, so the store's structural sharing keeps every OTHER\r\n * resource's preferences referentially stable — and the exposed `Set` is\r\n * memoised on the stored array, so its identity survives re-renders and does\r\n * not defeat DataGrid's memoisation.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { registerCapability } from \"../schema\";\r\nimport {\r\n usePersonalizationStore,\r\n useStoreSelector,\r\n} from \"../personalizationContext\";\r\nimport type {\r\n PersonalizationSnapshot,\r\n PersonalizationStore,\r\n} from \"../createPersonalizationStore\";\r\n\r\n/** One resource's grid preferences. Optional members so the shape can grow\r\n * (column order, widths) without a schemaVersion bump. */\r\nexport interface GridPreferencesEntry {\r\n hiddenColumns?: string[] | undefined;\r\n}\r\n\r\n/** The gridPreferences capability payload: entries keyed by resourceKey. */\r\ntype GridPreferencesState = Record<string, GridPreferencesEntry>;\r\n\r\nexport const GRID_PREFERENCES_CAPABILITY_ID = \"gridPreferences\";\r\nconst SCHEMA_VERSION = 1;\r\n\r\nconst EMPTY_LIST: readonly string[] = Object.freeze([]);\r\nconst EMPTY_MAP: GridPreferencesState = Object.freeze({});\r\n\r\nfunction isString(value: unknown): value is string {\r\n return typeof value === \"string\";\r\n}\r\n\r\n/* Register at import time — the foundation reads this at hydration. */\r\nregisterCapability({\r\n id: GRID_PREFERENCES_CAPABILITY_ID,\r\n schemaVersion: SCHEMA_VERSION,\r\n defaultState: EMPTY_MAP, // { [resourceKey]: { hiddenColumns: string[] } }\r\n migrate: function migrateGridPreferences(\r\n _fromVersion: number,\r\n payload: unknown\r\n ): unknown {\r\n /* v1 is the initial schema, so there is no version to upgrade FROM — but\r\n * this is the load-time trust boundary for a payload that came back from\r\n * storage, and it is the right place to normalise it. A column key is used\r\n * to hide grid columns; a number or an object arriving from an older build\r\n * (or from hand-edited devtools storage) must not reach the DataGrid as if\r\n * it were one. Anything unrecognised is dropped rather than repaired. */\r\n if (!payload || typeof payload !== \"object\") return {};\r\n const source = payload as Record<string, unknown>;\r\n const next: GridPreferencesState = {};\r\n for (const resourceKey of Object.keys(source)) {\r\n const entry = source[resourceKey];\r\n if (!entry || typeof entry !== \"object\") continue;\r\n const raw = (entry as Record<string, unknown>)[\"hiddenColumns\"];\r\n if (!Array.isArray(raw)) continue;\r\n const keys = raw.filter(isString);\r\n if (keys.length > 0) next[resourceKey] = { hiddenColumns: keys };\r\n }\r\n return next;\r\n },\r\n});\r\n\r\n/* ── pure, resourceKey-scoped state helpers (structural sharing) ────── */\r\n\r\nfunction listFor(\r\n map: GridPreferencesState | null | undefined,\r\n resourceKey: string\r\n): readonly string[] {\r\n const entry = map ? map[resourceKey] : undefined;\r\n const list = entry ? entry.hiddenColumns : undefined;\r\n return Array.isArray(list) ? list : EMPTY_LIST;\r\n}\r\n\r\nfunction sameMembers(a: readonly string[], b: readonly string[]): boolean {\r\n if (a.length !== b.length) return false;\r\n for (let i = 0; i < a.length; i++) {\r\n if (a[i] !== b[i]) return false;\r\n }\r\n return true;\r\n}\r\n\r\nfunction setList(\r\n map: GridPreferencesState | null | undefined,\r\n resourceKey: string,\r\n keys: readonly string[]\r\n): GridPreferencesState {\r\n const base = map || EMPTY_MAP;\r\n // No-op when unchanged → the store short-circuits and nothing re-renders.\r\n if (sameMembers(listFor(base, resourceKey), keys)) return base;\r\n\r\n const next: GridPreferencesState = Object.assign({}, base);\r\n if (keys.length === 0) {\r\n // Nothing hidden is the default; drop the entry rather than persist an\r\n // empty array, so the payload stays tidy and a reset leaves no residue.\r\n delete next[resourceKey];\r\n } else {\r\n // Spread, not Object.assign: `base[resourceKey]` is\r\n // `GridPreferencesEntry | undefined` under noUncheckedIndexedAccess, and\r\n // passing undefined as an Object.assign source yields an intersection\r\n // containing undefined. Spreading undefined is well-defined ({}), and it\r\n // preserves any sibling preference a future schema adds alongside\r\n // hiddenColumns.\r\n next[resourceKey] = {\r\n ...base[resourceKey],\r\n hiddenColumns: keys.slice(),\r\n };\r\n }\r\n return next;\r\n}\r\n\r\n/* ── hook ───────────────────────────────────────────────────────────── */\r\n\r\nfunction useEnsureGridPreferences(store: PersonalizationStore): void {\r\n React.useEffect(\r\n function ensure() {\r\n store.ensureCapability(GRID_PREFERENCES_CAPABILITY_ID);\r\n },\r\n [store]\r\n );\r\n}\r\n\r\nexport interface UseGridPreferencesResult {\r\n /**\r\n * Hidden column keys, ready to hand straight to DataGrid /\r\n * DataGridToolbar.\r\n *\r\n * A mutable `Set`, not a `ReadonlySet`, on purpose: both components declare\r\n * `hiddenColumns?: Set<string> | string[]`, and `ReadonlySet` is not\r\n * assignable to `Set` (no add/delete/clear), so a readonly type would force\r\n * every call site into a cast. This mirrors `useFavorites().ids`. Treat it\r\n * as read-only regardless — it is memoised and shared, so mutating it in\r\n * place would desynchronise the store without persisting anything.\r\n */\r\n hiddenColumns: Set<string>;\r\n /** Replace the hidden-column set. Accepts a Set or an array. */\r\n setHiddenColumns: (hidden: Iterable<string>) => void;\r\n /** Show every column again (drops this resource's entry). */\r\n resetHiddenColumns: () => void;\r\n}\r\n\r\n/**\r\n * useGridPreferences(resourceKey) — persisted, per-user grid preferences for\r\n * one resource.\r\n */\r\nexport function useGridPreferences(\r\n resourceKey: string\r\n): UseGridPreferencesResult {\r\n const store = usePersonalizationStore();\r\n useEnsureGridPreferences(store);\r\n\r\n const selectList = React.useCallback(\r\n function selectList(snapshot: PersonalizationSnapshot): readonly string[] {\r\n const slice = snapshot[GRID_PREFERENCES_CAPABILITY_ID] as\r\n | GridPreferencesState\r\n | undefined;\r\n return slice ? listFor(slice, resourceKey) : EMPTY_LIST;\r\n },\r\n [resourceKey]\r\n );\r\n const keys = useStoreSelector(selectList);\r\n\r\n // Stable while `keys` is stable (structural sharing), so the Set identity\r\n // does not churn on every render and DataGrid's memoisation still holds.\r\n const hiddenColumns = React.useMemo(\r\n function buildSet(): Set<string> {\r\n return new Set<string>(keys);\r\n },\r\n [keys]\r\n );\r\n\r\n const setHiddenColumns = React.useCallback(\r\n function setHiddenColumns(hidden: Iterable<string>): void {\r\n // Normalise at the write boundary too: the caller is UI code, but the\r\n // value is about to be persisted and re-read by a later session.\r\n const nextKeys = Array.from(hidden).filter(isString);\r\n store.write<GridPreferencesState>(\r\n GRID_PREFERENCES_CAPABILITY_ID,\r\n function (prev) {\r\n return setList(prev, resourceKey, nextKeys);\r\n }\r\n );\r\n },\r\n [store, resourceKey]\r\n );\r\n\r\n const resetHiddenColumns = React.useCallback(\r\n function resetHiddenColumns(): void {\r\n store.write<GridPreferencesState>(\r\n GRID_PREFERENCES_CAPABILITY_ID,\r\n function (prev) {\r\n return setList(prev, resourceKey, EMPTY_LIST);\r\n }\r\n );\r\n },\r\n [store, resourceKey]\r\n );\r\n\r\n return React.useMemo(\r\n function value(): UseGridPreferencesResult {\r\n return {\r\n hiddenColumns: hiddenColumns,\r\n setHiddenColumns: setHiddenColumns,\r\n resetHiddenColumns: resetHiddenColumns,\r\n };\r\n },\r\n [hiddenColumns, setHiddenColumns, resetHiddenColumns]\r\n );\r\n}\r\n"],"mappings":";;;;;;;AAuEA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,uBAAA,GAAAF,OAAA;AAGmC,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AA7EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA;AACA;;AAKA;;AAGO,MAAMkB,8BAA8B,GAAAC,OAAA,CAAAD,8BAAA,GAAG,iBAAiB;AAC/D,MAAME,cAAc,GAAG,CAAC;AAExB,MAAMC,UAA6B,GAAGN,MAAM,CAACO,MAAM,CAAC,EAAE,CAAC;AACvD,MAAMC,SAA+B,GAAGR,MAAM,CAACO,MAAM,CAAC,CAAC,CAAC,CAAC;AAEzD,SAASE,QAAQA,CAACC,KAAc,EAAmB;EACjD,OAAO,OAAOA,KAAK,KAAK,QAAQ;AAClC;;AAEA;AACA,IAAAC,0BAAkB,EAAC;EACjBC,EAAE,EAAET,8BAA8B;EAClCU,aAAa,EAAER,cAAc;EAC7BS,YAAY,EAAEN,SAAS;EAAE;EACzBO,OAAO,EAAE,SAASC,sBAAsBA,CACtCC,YAAoB,EACpBC,OAAgB,EACP;IACT;AACJ;AACA;AACA;AACA;AACA;IACI,IAAI,CAACA,OAAO,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtD,MAAMC,MAAM,GAAGD,OAAkC;IACjD,MAAME,IAA0B,GAAG,CAAC,CAAC;IACrC,KAAK,MAAMC,WAAW,IAAIrB,MAAM,CAACsB,IAAI,CAACH,MAAM,CAAC,EAAE;MAC7C,MAAMI,KAAK,GAAGJ,MAAM,CAACE,WAAW,CAAC;MACjC,IAAI,CAACE,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MACzC,MAAMC,GAAG,GAAID,KAAK,CAA6B,eAAe,CAAC;MAC/D,IAAI,CAACE,KAAK,CAACC,OAAO,CAACF,GAAG,CAAC,EAAE;MACzB,MAAMF,IAAI,GAAGE,GAAG,CAACG,MAAM,CAAClB,QAAQ,CAAC;MACjC,IAAIa,IAAI,CAACM,MAAM,GAAG,CAAC,EAAER,IAAI,CAACC,WAAW,CAAC,GAAG;QAAEQ,aAAa,EAAEP;MAAK,CAAC;IAClE;IACA,OAAOF,IAAI;EACb;AACF,CAAC,CAAC;;AAEF;;AAEA,SAASU,OAAOA,CACdC,GAA4C,EAC5CV,WAAmB,EACA;EACnB,MAAME,KAAK,GAAGQ,GAAG,GAAGA,GAAG,CAACV,WAAW,CAAC,GAAGW,SAAS;EAChD,MAAMC,IAAI,GAAGV,KAAK,GAAGA,KAAK,CAACM,aAAa,GAAGG,SAAS;EACpD,OAAOP,KAAK,CAACC,OAAO,CAACO,IAAI,CAAC,GAAGA,IAAI,GAAG3B,UAAU;AAChD;AAEA,SAAS4B,WAAWA,CAACC,CAAoB,EAAEC,CAAoB,EAAW;EACxE,IAAID,CAAC,CAACP,MAAM,KAAKQ,CAAC,CAACR,MAAM,EAAE,OAAO,KAAK;EACvC,KAAK,IAAIrC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG4C,CAAC,CAACP,MAAM,EAAErC,CAAC,EAAE,EAAE;IACjC,IAAI4C,CAAC,CAAC5C,CAAC,CAAC,KAAK6C,CAAC,CAAC7C,CAAC,CAAC,EAAE,OAAO,KAAK;EACjC;EACA,OAAO,IAAI;AACb;AAEA,SAAS8C,OAAOA,CACdN,GAA4C,EAC5CV,WAAmB,EACnBC,IAAuB,EACD;EACtB,MAAMgB,IAAI,GAAGP,GAAG,IAAIvB,SAAS;EAC7B;EACA,IAAI0B,WAAW,CAACJ,OAAO,CAACQ,IAAI,EAAEjB,WAAW,CAAC,EAAEC,IAAI,CAAC,EAAE,OAAOgB,IAAI;EAE9D,MAAMlB,IAA0B,GAAGpB,MAAM,CAACuC,MAAM,CAAC,CAAC,CAAC,EAAED,IAAI,CAAC;EAC1D,IAAIhB,IAAI,CAACM,MAAM,KAAK,CAAC,EAAE;IACrB;IACA;IACA,OAAOR,IAAI,CAACC,WAAW,CAAC;EAC1B,CAAC,MAAM;IACL;IACA;IACA;IACA;IACA;IACA;IACAD,IAAI,CAACC,WAAW,CAAC,GAAG;MAClB,GAAGiB,IAAI,CAACjB,WAAW,CAAC;MACpBQ,aAAa,EAAEP,IAAI,CAACkB,KAAK,CAAC;IAC5B,CAAC;EACH;EACA,OAAOpB,IAAI;AACb;;AAEA;;AAEA,SAASqB,wBAAwBA,CAACC,KAA2B,EAAQ;EACnE/D,KAAK,CAACgE,SAAS,CACb,SAASC,MAAMA,CAAA,EAAG;IAChBF,KAAK,CAACG,gBAAgB,CAAC1C,8BAA8B,CAAC;EACxD,CAAC,EACD,CAACuC,KAAK,CACR,CAAC;AACH;AAqBA;AACA;AACA;AACA;AACO,SAASI,kBAAkBA,CAChCzB,WAAmB,EACO;EAC1B,MAAMqB,KAAK,GAAG,IAAAK,+CAAuB,EAAC,CAAC;EACvCN,wBAAwB,CAACC,KAAK,CAAC;EAE/B,MAAMM,UAAU,GAAGrE,KAAK,CAACsE,WAAW,CAClC,SAASD,UAAUA,CAACE,QAAiC,EAAqB;IACxE,MAAMV,KAAK,GAAGU,QAAQ,CAAC/C,8BAA8B,CAExC;IACb,OAAOqC,KAAK,GAAGV,OAAO,CAACU,KAAK,EAAEnB,WAAW,CAAC,GAAGf,UAAU;EACzD,CAAC,EACD,CAACe,WAAW,CACd,CAAC;EACD,MAAMC,IAAI,GAAG,IAAA6B,wCAAgB,EAACH,UAAU,CAAC;;EAEzC;EACA;EACA,MAAMnB,aAAa,GAAGlD,KAAK,CAACyE,OAAO,CACjC,SAASC,QAAQA,CAAA,EAAgB;IAC/B,OAAO,IAAIC,GAAG,CAAShC,IAAI,CAAC;EAC9B,CAAC,EACD,CAACA,IAAI,CACP,CAAC;EAED,MAAMiC,gBAAgB,GAAG5E,KAAK,CAACsE,WAAW,CACxC,SAASM,gBAAgBA,CAACC,MAAwB,EAAQ;IACxD;IACA;IACA,MAAMC,QAAQ,GAAGhC,KAAK,CAACiC,IAAI,CAACF,MAAM,CAAC,CAAC7B,MAAM,CAAClB,QAAQ,CAAC;IACpDiC,KAAK,CAACiB,KAAK,CACTxD,8BAA8B,EAC9B,UAAUyD,IAAI,EAAE;MACd,OAAOvB,OAAO,CAACuB,IAAI,EAAEvC,WAAW,EAAEoC,QAAQ,CAAC;IAC7C,CACF,CAAC;EACH,CAAC,EACD,CAACf,KAAK,EAAErB,WAAW,CACrB,CAAC;EAED,MAAMwC,kBAAkB,GAAGlF,KAAK,CAACsE,WAAW,CAC1C,SAASY,kBAAkBA,CAAA,EAAS;IAClCnB,KAAK,CAACiB,KAAK,CACTxD,8BAA8B,EAC9B,UAAUyD,IAAI,EAAE;MACd,OAAOvB,OAAO,CAACuB,IAAI,EAAEvC,WAAW,EAAEf,UAAU,CAAC;IAC/C,CACF,CAAC;EACH,CAAC,EACD,CAACoC,KAAK,EAAErB,WAAW,CACrB,CAAC;EAED,OAAO1C,KAAK,CAACyE,OAAO,CAClB,SAAS1C,KAAKA,CAAA,EAA6B;IACzC,OAAO;MACLmB,aAAa,EAAEA,aAAa;MAC5B0B,gBAAgB,EAAEA,gBAAgB;MAClCM,kBAAkB,EAAEA;IACtB,CAAC;EACH,CAAC,EACD,CAAChC,aAAa,EAAE0B,gBAAgB,EAAEM,kBAAkB,CACtD,CAAC;AACH","ignoreList":[]}
|
|
@@ -9,8 +9,14 @@
|
|
|
9
9
|
* (Batch 5) — useFavoritesView + filter/sort helpers
|
|
10
10
|
* - savedFilters (Batch 4) — useSavedFilters (+ SaveFilterDialog,
|
|
11
11
|
* SavedFiltersMenu in patterns/)
|
|
12
|
+
* - gridPreferences — useGridPreferences (hidden columns; the
|
|
13
|
+
* DataGridToolbar column-visibility UI holds
|
|
14
|
+
* no state, so hosts were persisting it in
|
|
15
|
+
* unscoped localStorage — gap G-35)
|
|
12
16
|
*/
|
|
13
17
|
export { useFavorites, useIsFavorite, FAVORITES_CAPABILITY_ID, } from "./favorites";
|
|
14
18
|
export { useSavedFilters, SAVED_FILTERS_CAPABILITY_ID } from "./savedFilters";
|
|
19
|
+
export { useGridPreferences, GRID_PREFERENCES_CAPABILITY_ID, } from "./gridPreferences";
|
|
20
|
+
export type { UseGridPreferencesResult, GridPreferencesEntry, } from "./gridPreferences";
|
|
15
21
|
export { useFavoritesView, filterRowsByFavorites, sortRowsByFavorites, FAVORITES_FILTER, FAVORITES_SORT, } from "./favoritesView";
|
|
16
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/v2/personalization/capabilities/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/v2/personalization/capabilities/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,YAAY,EACZ,aAAa,EACb,uBAAuB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EACL,kBAAkB,EAClB,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,GACf,MAAM,iBAAiB,CAAC"}
|
|
@@ -5,65 +5,78 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
Object.defineProperty(exports, "FAVORITES_CAPABILITY_ID", {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: function
|
|
8
|
+
get: function () {
|
|
9
9
|
return _favorites.FAVORITES_CAPABILITY_ID;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "FAVORITES_FILTER", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function
|
|
14
|
+
get: function () {
|
|
15
15
|
return _favoritesView.FAVORITES_FILTER;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "FAVORITES_SORT", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function
|
|
20
|
+
get: function () {
|
|
21
21
|
return _favoritesView.FAVORITES_SORT;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "GRID_PREFERENCES_CAPABILITY_ID", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _gridPreferences.GRID_PREFERENCES_CAPABILITY_ID;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
24
30
|
Object.defineProperty(exports, "SAVED_FILTERS_CAPABILITY_ID", {
|
|
25
31
|
enumerable: true,
|
|
26
|
-
get: function
|
|
32
|
+
get: function () {
|
|
27
33
|
return _savedFilters.SAVED_FILTERS_CAPABILITY_ID;
|
|
28
34
|
}
|
|
29
35
|
});
|
|
30
36
|
Object.defineProperty(exports, "filterRowsByFavorites", {
|
|
31
37
|
enumerable: true,
|
|
32
|
-
get: function
|
|
38
|
+
get: function () {
|
|
33
39
|
return _favoritesView.filterRowsByFavorites;
|
|
34
40
|
}
|
|
35
41
|
});
|
|
36
42
|
Object.defineProperty(exports, "sortRowsByFavorites", {
|
|
37
43
|
enumerable: true,
|
|
38
|
-
get: function
|
|
44
|
+
get: function () {
|
|
39
45
|
return _favoritesView.sortRowsByFavorites;
|
|
40
46
|
}
|
|
41
47
|
});
|
|
42
48
|
Object.defineProperty(exports, "useFavorites", {
|
|
43
49
|
enumerable: true,
|
|
44
|
-
get: function
|
|
50
|
+
get: function () {
|
|
45
51
|
return _favorites.useFavorites;
|
|
46
52
|
}
|
|
47
53
|
});
|
|
48
54
|
Object.defineProperty(exports, "useFavoritesView", {
|
|
49
55
|
enumerable: true,
|
|
50
|
-
get: function
|
|
56
|
+
get: function () {
|
|
51
57
|
return _favoritesView.useFavoritesView;
|
|
52
58
|
}
|
|
53
59
|
});
|
|
60
|
+
Object.defineProperty(exports, "useGridPreferences", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _gridPreferences.useGridPreferences;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
54
66
|
Object.defineProperty(exports, "useIsFavorite", {
|
|
55
67
|
enumerable: true,
|
|
56
|
-
get: function
|
|
68
|
+
get: function () {
|
|
57
69
|
return _favorites.useIsFavorite;
|
|
58
70
|
}
|
|
59
71
|
});
|
|
60
72
|
Object.defineProperty(exports, "useSavedFilters", {
|
|
61
73
|
enumerable: true,
|
|
62
|
-
get: function
|
|
74
|
+
get: function () {
|
|
63
75
|
return _savedFilters.useSavedFilters;
|
|
64
76
|
}
|
|
65
77
|
});
|
|
66
78
|
var _favorites = require("./favorites");
|
|
67
79
|
var _savedFilters = require("./savedFilters");
|
|
80
|
+
var _gridPreferences = require("./gridPreferences");
|
|
68
81
|
var _favoritesView = require("./favoritesView");
|
|
69
82
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_favorites","require","_savedFilters","_favoritesView"],"sources":["../../../../src/lib/v2/personalization/capabilities/index.ts"],"sourcesContent":["/**\r\n * capabilities — Portnet UI v2 · personalization\r\n *\r\n * Capability slices. Each slice self-registers with the schema registry\r\n * at import time, so importing a slice's hook is enough to activate its\r\n * capability — no manual wiring on the host.\r\n *\r\n * - favorites (Batch 3) — useFavorites, useIsFavorite\r\n * (Batch 5) — useFavoritesView + filter/sort helpers\r\n * - savedFilters (Batch 4) — useSavedFilters (+ SaveFilterDialog,\r\n * SavedFiltersMenu in patterns/)\r\n */\r\n\r\nexport {\r\n useFavorites,\r\n useIsFavorite,\r\n FAVORITES_CAPABILITY_ID,\r\n} from \"./favorites\";\r\nexport { useSavedFilters, SAVED_FILTERS_CAPABILITY_ID } from \"./savedFilters\";\r\nexport {\r\n useFavoritesView,\r\n filterRowsByFavorites,\r\n sortRowsByFavorites,\r\n FAVORITES_FILTER,\r\n FAVORITES_SORT,\r\n} from \"./favoritesView\";\r\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_favorites","require","_savedFilters","_gridPreferences","_favoritesView"],"sources":["../../../../src/lib/v2/personalization/capabilities/index.ts"],"sourcesContent":["/**\r\n * capabilities — Portnet UI v2 · personalization\r\n *\r\n * Capability slices. Each slice self-registers with the schema registry\r\n * at import time, so importing a slice's hook is enough to activate its\r\n * capability — no manual wiring on the host.\r\n *\r\n * - favorites (Batch 3) — useFavorites, useIsFavorite\r\n * (Batch 5) — useFavoritesView + filter/sort helpers\r\n * - savedFilters (Batch 4) — useSavedFilters (+ SaveFilterDialog,\r\n * SavedFiltersMenu in patterns/)\r\n * - gridPreferences — useGridPreferences (hidden columns; the\r\n * DataGridToolbar column-visibility UI holds\r\n * no state, so hosts were persisting it in\r\n * unscoped localStorage — gap G-35)\r\n */\r\n\r\nexport {\r\n useFavorites,\r\n useIsFavorite,\r\n FAVORITES_CAPABILITY_ID,\r\n} from \"./favorites\";\r\nexport { useSavedFilters, SAVED_FILTERS_CAPABILITY_ID } from \"./savedFilters\";\r\nexport {\r\n useGridPreferences,\r\n GRID_PREFERENCES_CAPABILITY_ID,\r\n} from \"./gridPreferences\";\r\nexport type {\r\n UseGridPreferencesResult,\r\n GridPreferencesEntry,\r\n} from \"./gridPreferences\";\r\nexport {\r\n useFavoritesView,\r\n filterRowsByFavorites,\r\n sortRowsByFavorites,\r\n FAVORITES_FILTER,\r\n FAVORITES_SORT,\r\n} from \"./favoritesView\";\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,IAAAA,UAAA,GAAAC,OAAA;AAKA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AAQA,IAAAG,cAAA,GAAAH,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* reviveSavedCriteria — Portnet UI v2 · personalization capability
|
|
3
|
+
*
|
|
4
|
+
* Restores a persisted `SavedFilter.criteria` payload into the shape of a
|
|
5
|
+
* search form's values.
|
|
6
|
+
*
|
|
7
|
+
* const [filters, setFilters] = React.useState(EMPTY_FILTERS);
|
|
8
|
+
*
|
|
9
|
+
* <SavedFiltersMenu
|
|
10
|
+
* onApply={(filter) =>
|
|
11
|
+
* setFilters(reviveSavedCriteria(EMPTY_FILTERS, filter.criteria))
|
|
12
|
+
* }
|
|
13
|
+
* />
|
|
14
|
+
*
|
|
15
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
16
|
+
* WHY THIS BELONGS IN THE LIBRARY (capability gap G-50)
|
|
17
|
+
*
|
|
18
|
+
* `criteria` is OPAQUE by design, and that design is right: `savedFilters`
|
|
19
|
+
* stores and re-emits it verbatim — "criteria is never interpreted here" — which
|
|
20
|
+
* is what keeps one saved-filters framework usable by every list regardless of
|
|
21
|
+
* its filter schema. The host owns `apply()`.
|
|
22
|
+
*
|
|
23
|
+
* But the round trip is NOT symmetrical, and the asymmetry is the library's,
|
|
24
|
+
* not the host's:
|
|
25
|
+
*
|
|
26
|
+
* - search forms type their date fields `Date | null`;
|
|
27
|
+
* - `createLocalStorageAdapter` serialises with `JSON.stringify`, which calls
|
|
28
|
+
* `Date.prototype.toJSON` — so a `Date` is written as an ISO STRING;
|
|
29
|
+
* - the same adapter reads back with a plain `JSON.parse`, WITH NO REVIVER.
|
|
30
|
+
*
|
|
31
|
+
* So every host that persists a date gets a string back, in a field its own
|
|
32
|
+
* types declare as a `Date`. Two consequences, both silent: the string goes
|
|
33
|
+
* straight into `<DatePicker value={…}>`, and it goes into the search payload
|
|
34
|
+
* sent to the back-end. The type system does not catch it, because the only way
|
|
35
|
+
* to assign the parsed payload into a typed form state is an assertion — and an
|
|
36
|
+
* assertion is exactly what a host writes when the library hands it
|
|
37
|
+
* `Record<string, unknown>` and asks it to produce `TValues`.
|
|
38
|
+
*
|
|
39
|
+
* Observed in `autorisation-admis-pour-conforme-fe` (Area 5): NINE list screens
|
|
40
|
+
* converted the payload TWICE inside their own `onApply` — a single conversion
|
|
41
|
+
* would not compile — which is the shape a missing library capability takes when
|
|
42
|
+
* a host has to work around it under a strict typecheck.
|
|
43
|
+
*
|
|
44
|
+
* A second, quieter effect this closes: a filter saved under an OLDER form shape
|
|
45
|
+
* (renamed key, dropped field) was spread into the form state as-is, unknown
|
|
46
|
+
* keys included. Keying off the caller's defaults bounds that.
|
|
47
|
+
*
|
|
48
|
+
* WHY NOT FIX THE ADAPTER INSTEAD. A reviver inside
|
|
49
|
+
* `createLocalStorageAdapter` would apply to EVERY capability payload — grid
|
|
50
|
+
* preferences, favorites — and would have to guess which strings are dates for
|
|
51
|
+
* data it knows nothing about. Reviving belongs where the shape is known, i.e.
|
|
52
|
+
* at the point where the host hands in its own defaults. That also keeps the
|
|
53
|
+
* remote adapter, when it arrives, free of the same guesswork.
|
|
54
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
55
|
+
*
|
|
56
|
+
* WHAT IT GUARANTEES, EXACTLY: the KEYS are the caller's, and the DATES are
|
|
57
|
+
* dates. It deliberately does NOT validate referentiel shapes (`{ id, code,
|
|
58
|
+
* description }`): those round-trip as flat JSON objects with every field
|
|
59
|
+
* optional, and inventing a shape check here would reject valid saved filters
|
|
60
|
+
* without protecting anything. A persisted value of some other kind still lands
|
|
61
|
+
* in its field — but in a field the screen reads with optional access, rather
|
|
62
|
+
* than behind an assertion that claimed to have checked it.
|
|
63
|
+
*/
|
|
64
|
+
/**
|
|
65
|
+
* Read a persisted `criteria` payload back into a search form's shape.
|
|
66
|
+
*
|
|
67
|
+
* @param defaults - The form's empty values. They define BOTH the accepted keys
|
|
68
|
+
* and the value kept when a key is absent from the payload.
|
|
69
|
+
* @param criteria - The opaque payload, as `SavedFilter.criteria` re-emits it.
|
|
70
|
+
* @returns A complete value set, shaped like `defaults`.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* The constraint is written `Record<keyof TValues, unknown>` and NOT
|
|
74
|
+
* `Record<string, unknown>`: the latter is satisfied only by type ALIASES, to
|
|
75
|
+
* which TypeScript grants an implicit index signature, so any caller declaring
|
|
76
|
+
* its form shape with an `interface` would be rejected — five of the nine forms
|
|
77
|
+
* in the module this came from do exactly that. The mapped constraint accepts
|
|
78
|
+
* both, which is the point: no assertion is pushed back to the call site.
|
|
79
|
+
*
|
|
80
|
+
* The only two assertions on this path are here, on the way in and on the way
|
|
81
|
+
* out: TypeScript cannot follow a copy built key by key against a type
|
|
82
|
+
* parameter. They are isolated in twenty reviewed lines instead of being
|
|
83
|
+
* repeated per screen, and they PRESERVE the caller's type instead of erasing
|
|
84
|
+
* it.
|
|
85
|
+
*/
|
|
86
|
+
export declare function reviveSavedCriteria<TValues extends Record<keyof TValues, unknown>>(defaults: TValues, criteria: Record<string, unknown> | null | undefined): TValues;
|
|
87
|
+
export default reviveSavedCriteria;
|
|
88
|
+
//# sourceMappingURL=reviveSavedCriteria.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviveSavedCriteria.d.ts","sourceRoot":"","sources":["../../../../src/lib/v2/personalization/capabilities/reviveSavedCriteria.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAmBH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,SAAS,MAAM,CAAC,MAAM,OAAO,EAAE,OAAO,CAAC,EAE9C,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GACnD,OAAO,CAiBT;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
exports.reviveSavedCriteria = reviveSavedCriteria;
|
|
8
|
+
/**
|
|
9
|
+
* reviveSavedCriteria — Portnet UI v2 · personalization capability
|
|
10
|
+
*
|
|
11
|
+
* Restores a persisted `SavedFilter.criteria` payload into the shape of a
|
|
12
|
+
* search form's values.
|
|
13
|
+
*
|
|
14
|
+
* const [filters, setFilters] = React.useState(EMPTY_FILTERS);
|
|
15
|
+
*
|
|
16
|
+
* <SavedFiltersMenu
|
|
17
|
+
* onApply={(filter) =>
|
|
18
|
+
* setFilters(reviveSavedCriteria(EMPTY_FILTERS, filter.criteria))
|
|
19
|
+
* }
|
|
20
|
+
* />
|
|
21
|
+
*
|
|
22
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
23
|
+
* WHY THIS BELONGS IN THE LIBRARY (capability gap G-50)
|
|
24
|
+
*
|
|
25
|
+
* `criteria` is OPAQUE by design, and that design is right: `savedFilters`
|
|
26
|
+
* stores and re-emits it verbatim — "criteria is never interpreted here" — which
|
|
27
|
+
* is what keeps one saved-filters framework usable by every list regardless of
|
|
28
|
+
* its filter schema. The host owns `apply()`.
|
|
29
|
+
*
|
|
30
|
+
* But the round trip is NOT symmetrical, and the asymmetry is the library's,
|
|
31
|
+
* not the host's:
|
|
32
|
+
*
|
|
33
|
+
* - search forms type their date fields `Date | null`;
|
|
34
|
+
* - `createLocalStorageAdapter` serialises with `JSON.stringify`, which calls
|
|
35
|
+
* `Date.prototype.toJSON` — so a `Date` is written as an ISO STRING;
|
|
36
|
+
* - the same adapter reads back with a plain `JSON.parse`, WITH NO REVIVER.
|
|
37
|
+
*
|
|
38
|
+
* So every host that persists a date gets a string back, in a field its own
|
|
39
|
+
* types declare as a `Date`. Two consequences, both silent: the string goes
|
|
40
|
+
* straight into `<DatePicker value={…}>`, and it goes into the search payload
|
|
41
|
+
* sent to the back-end. The type system does not catch it, because the only way
|
|
42
|
+
* to assign the parsed payload into a typed form state is an assertion — and an
|
|
43
|
+
* assertion is exactly what a host writes when the library hands it
|
|
44
|
+
* `Record<string, unknown>` and asks it to produce `TValues`.
|
|
45
|
+
*
|
|
46
|
+
* Observed in `autorisation-admis-pour-conforme-fe` (Area 5): NINE list screens
|
|
47
|
+
* converted the payload TWICE inside their own `onApply` — a single conversion
|
|
48
|
+
* would not compile — which is the shape a missing library capability takes when
|
|
49
|
+
* a host has to work around it under a strict typecheck.
|
|
50
|
+
*
|
|
51
|
+
* A second, quieter effect this closes: a filter saved under an OLDER form shape
|
|
52
|
+
* (renamed key, dropped field) was spread into the form state as-is, unknown
|
|
53
|
+
* keys included. Keying off the caller's defaults bounds that.
|
|
54
|
+
*
|
|
55
|
+
* WHY NOT FIX THE ADAPTER INSTEAD. A reviver inside
|
|
56
|
+
* `createLocalStorageAdapter` would apply to EVERY capability payload — grid
|
|
57
|
+
* preferences, favorites — and would have to guess which strings are dates for
|
|
58
|
+
* data it knows nothing about. Reviving belongs where the shape is known, i.e.
|
|
59
|
+
* at the point where the host hands in its own defaults. That also keeps the
|
|
60
|
+
* remote adapter, when it arrives, free of the same guesswork.
|
|
61
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
62
|
+
*
|
|
63
|
+
* WHAT IT GUARANTEES, EXACTLY: the KEYS are the caller's, and the DATES are
|
|
64
|
+
* dates. It deliberately does NOT validate referentiel shapes (`{ id, code,
|
|
65
|
+
* description }`): those round-trip as flat JSON objects with every field
|
|
66
|
+
* optional, and inventing a shape check here would reject valid saved filters
|
|
67
|
+
* without protecting anything. A persisted value of some other kind still lands
|
|
68
|
+
* in its field — but in a field the screen reads with optional access, rather
|
|
69
|
+
* than behind an assertion that claimed to have checked it.
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The format `Date.prototype.toJSON` produces (hence `JSON.stringify`).
|
|
74
|
+
*
|
|
75
|
+
* Deliberately STRICT: only the exact shape the save wrote is read back as a
|
|
76
|
+
* date, so a business string — a reference, a code, a customs nomenclature —
|
|
77
|
+
* cannot be mistaken for one by accident.
|
|
78
|
+
*/
|
|
79
|
+
const ISO_INSTANT = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
80
|
+
|
|
81
|
+
/** Give one value read back from storage its original type. */
|
|
82
|
+
const revive = value => {
|
|
83
|
+
if (typeof value !== "string" || !ISO_INSTANT.test(value)) return value;
|
|
84
|
+
const date = new Date(value);
|
|
85
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Read a persisted `criteria` payload back into a search form's shape.
|
|
90
|
+
*
|
|
91
|
+
* @param defaults - The form's empty values. They define BOTH the accepted keys
|
|
92
|
+
* and the value kept when a key is absent from the payload.
|
|
93
|
+
* @param criteria - The opaque payload, as `SavedFilter.criteria` re-emits it.
|
|
94
|
+
* @returns A complete value set, shaped like `defaults`.
|
|
95
|
+
*
|
|
96
|
+
* @remarks
|
|
97
|
+
* The constraint is written `Record<keyof TValues, unknown>` and NOT
|
|
98
|
+
* `Record<string, unknown>`: the latter is satisfied only by type ALIASES, to
|
|
99
|
+
* which TypeScript grants an implicit index signature, so any caller declaring
|
|
100
|
+
* its form shape with an `interface` would be rejected — five of the nine forms
|
|
101
|
+
* in the module this came from do exactly that. The mapped constraint accepts
|
|
102
|
+
* both, which is the point: no assertion is pushed back to the call site.
|
|
103
|
+
*
|
|
104
|
+
* The only two assertions on this path are here, on the way in and on the way
|
|
105
|
+
* out: TypeScript cannot follow a copy built key by key against a type
|
|
106
|
+
* parameter. They are isolated in twenty reviewed lines instead of being
|
|
107
|
+
* repeated per screen, and they PRESERVE the caller's type instead of erasing
|
|
108
|
+
* it.
|
|
109
|
+
*/
|
|
110
|
+
function reviveSavedCriteria(defaults, criteria) {
|
|
111
|
+
if (!criteria) return defaults;
|
|
112
|
+
const restored = {
|
|
113
|
+
...defaults
|
|
114
|
+
};
|
|
115
|
+
for (const key of Object.keys(restored)) {
|
|
116
|
+
if (!Object.prototype.hasOwnProperty.call(criteria, key)) continue;
|
|
117
|
+
const value = revive(criteria[key]);
|
|
118
|
+
/* `undefined` must not overwrite the default: under
|
|
119
|
+
`exactOptionalPropertyTypes`, a present key holding `undefined` is not
|
|
120
|
+
the same thing as an absent key. */
|
|
121
|
+
if (value !== undefined) restored[key] = value;
|
|
122
|
+
}
|
|
123
|
+
return restored;
|
|
124
|
+
}
|
|
125
|
+
var _default = exports.default = reviveSavedCriteria;
|
|
126
|
+
//# sourceMappingURL=reviveSavedCriteria.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviveSavedCriteria.js","names":["ISO_INSTANT","revive","value","test","date","Date","Number","isNaN","getTime","reviveSavedCriteria","defaults","criteria","restored","key","Object","keys","prototype","hasOwnProperty","call","undefined","_default","exports","default"],"sources":["../../../../src/lib/v2/personalization/capabilities/reviveSavedCriteria.ts"],"sourcesContent":["/**\r\n * reviveSavedCriteria — Portnet UI v2 · personalization capability\r\n *\r\n * Restores a persisted `SavedFilter.criteria` payload into the shape of a\r\n * search form's values.\r\n *\r\n * const [filters, setFilters] = React.useState(EMPTY_FILTERS);\r\n *\r\n * <SavedFiltersMenu\r\n * onApply={(filter) =>\r\n * setFilters(reviveSavedCriteria(EMPTY_FILTERS, filter.criteria))\r\n * }\r\n * />\r\n *\r\n * ─────────────────────────────────────────────────────────────────────────────\r\n * WHY THIS BELONGS IN THE LIBRARY (capability gap G-50)\r\n *\r\n * `criteria` is OPAQUE by design, and that design is right: `savedFilters`\r\n * stores and re-emits it verbatim — \"criteria is never interpreted here\" — which\r\n * is what keeps one saved-filters framework usable by every list regardless of\r\n * its filter schema. The host owns `apply()`.\r\n *\r\n * But the round trip is NOT symmetrical, and the asymmetry is the library's,\r\n * not the host's:\r\n *\r\n * - search forms type their date fields `Date | null`;\r\n * - `createLocalStorageAdapter` serialises with `JSON.stringify`, which calls\r\n * `Date.prototype.toJSON` — so a `Date` is written as an ISO STRING;\r\n * - the same adapter reads back with a plain `JSON.parse`, WITH NO REVIVER.\r\n *\r\n * So every host that persists a date gets a string back, in a field its own\r\n * types declare as a `Date`. Two consequences, both silent: the string goes\r\n * straight into `<DatePicker value={…}>`, and it goes into the search payload\r\n * sent to the back-end. The type system does not catch it, because the only way\r\n * to assign the parsed payload into a typed form state is an assertion — and an\r\n * assertion is exactly what a host writes when the library hands it\r\n * `Record<string, unknown>` and asks it to produce `TValues`.\r\n *\r\n * Observed in `autorisation-admis-pour-conforme-fe` (Area 5): NINE list screens\r\n * converted the payload TWICE inside their own `onApply` — a single conversion\r\n * would not compile — which is the shape a missing library capability takes when\r\n * a host has to work around it under a strict typecheck.\r\n *\r\n * A second, quieter effect this closes: a filter saved under an OLDER form shape\r\n * (renamed key, dropped field) was spread into the form state as-is, unknown\r\n * keys included. Keying off the caller's defaults bounds that.\r\n *\r\n * WHY NOT FIX THE ADAPTER INSTEAD. A reviver inside\r\n * `createLocalStorageAdapter` would apply to EVERY capability payload — grid\r\n * preferences, favorites — and would have to guess which strings are dates for\r\n * data it knows nothing about. Reviving belongs where the shape is known, i.e.\r\n * at the point where the host hands in its own defaults. That also keeps the\r\n * remote adapter, when it arrives, free of the same guesswork.\r\n * ─────────────────────────────────────────────────────────────────────────────\r\n *\r\n * WHAT IT GUARANTEES, EXACTLY: the KEYS are the caller's, and the DATES are\r\n * dates. It deliberately does NOT validate referentiel shapes (`{ id, code,\r\n * description }`): those round-trip as flat JSON objects with every field\r\n * optional, and inventing a shape check here would reject valid saved filters\r\n * without protecting anything. A persisted value of some other kind still lands\r\n * in its field — but in a field the screen reads with optional access, rather\r\n * than behind an assertion that claimed to have checked it.\r\n */\r\n\r\n/**\r\n * The format `Date.prototype.toJSON` produces (hence `JSON.stringify`).\r\n *\r\n * Deliberately STRICT: only the exact shape the save wrote is read back as a\r\n * date, so a business string — a reference, a code, a customs nomenclature —\r\n * cannot be mistaken for one by accident.\r\n */\r\nconst ISO_INSTANT =\r\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,3})?(?:Z|[+-]\\d{2}:\\d{2})$/;\r\n\r\n/** Give one value read back from storage its original type. */\r\nconst revive = (value: unknown): unknown => {\r\n if (typeof value !== \"string\" || !ISO_INSTANT.test(value)) return value;\r\n const date = new Date(value);\r\n return Number.isNaN(date.getTime()) ? null : date;\r\n};\r\n\r\n/**\r\n * Read a persisted `criteria` payload back into a search form's shape.\r\n *\r\n * @param defaults - The form's empty values. They define BOTH the accepted keys\r\n * and the value kept when a key is absent from the payload.\r\n * @param criteria - The opaque payload, as `SavedFilter.criteria` re-emits it.\r\n * @returns A complete value set, shaped like `defaults`.\r\n *\r\n * @remarks\r\n * The constraint is written `Record<keyof TValues, unknown>` and NOT\r\n * `Record<string, unknown>`: the latter is satisfied only by type ALIASES, to\r\n * which TypeScript grants an implicit index signature, so any caller declaring\r\n * its form shape with an `interface` would be rejected — five of the nine forms\r\n * in the module this came from do exactly that. The mapped constraint accepts\r\n * both, which is the point: no assertion is pushed back to the call site.\r\n *\r\n * The only two assertions on this path are here, on the way in and on the way\r\n * out: TypeScript cannot follow a copy built key by key against a type\r\n * parameter. They are isolated in twenty reviewed lines instead of being\r\n * repeated per screen, and they PRESERVE the caller's type instead of erasing\r\n * it.\r\n */\r\nexport function reviveSavedCriteria<\r\n TValues extends Record<keyof TValues, unknown>,\r\n>(\r\n defaults: TValues,\r\n criteria: Record<string, unknown> | null | undefined,\r\n): TValues {\r\n if (!criteria) return defaults;\r\n\r\n const restored: Record<string, unknown> = {\r\n ...(defaults as Record<string, unknown>),\r\n };\r\n\r\n for (const key of Object.keys(restored)) {\r\n if (!Object.prototype.hasOwnProperty.call(criteria, key)) continue;\r\n const value = revive(criteria[key]);\r\n /* `undefined` must not overwrite the default: under\r\n `exactOptionalPropertyTypes`, a present key holding `undefined` is not\r\n the same thing as an absent key. */\r\n if (value !== undefined) restored[key] = value;\r\n }\r\n\r\n return restored as TValues;\r\n}\r\n\r\nexport default reviveSavedCriteria;\r\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,WAAW,GACf,0EAA0E;;AAE5E;AACA,MAAMC,MAAM,GAAIC,KAAc,IAAc;EAC1C,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,CAACF,WAAW,CAACG,IAAI,CAACD,KAAK,CAAC,EAAE,OAAOA,KAAK;EACvE,MAAME,IAAI,GAAG,IAAIC,IAAI,CAACH,KAAK,CAAC;EAC5B,OAAOI,MAAM,CAACC,KAAK,CAACH,IAAI,CAACI,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,GAAGJ,IAAI;AACnD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,mBAAmBA,CAGjCC,QAAiB,EACjBC,QAAoD,EAC3C;EACT,IAAI,CAACA,QAAQ,EAAE,OAAOD,QAAQ;EAE9B,MAAME,QAAiC,GAAG;IACxC,GAAIF;EACN,CAAC;EAED,KAAK,MAAMG,GAAG,IAAIC,MAAM,CAACC,IAAI,CAACH,QAAQ,CAAC,EAAE;IACvC,IAAI,CAACE,MAAM,CAACE,SAAS,CAACC,cAAc,CAACC,IAAI,CAACP,QAAQ,EAAEE,GAAG,CAAC,EAAE;IAC1D,MAAMX,KAAK,GAAGD,MAAM,CAACU,QAAQ,CAACE,GAAG,CAAC,CAAC;IACnC;AACJ;AACA;IACI,IAAIX,KAAK,KAAKiB,SAAS,EAAEP,QAAQ,CAACC,GAAG,CAAC,GAAGX,KAAK;EAChD;EAEA,OAAOU,QAAQ;AACjB;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcb,mBAAmB","ignoreList":[]}
|