@portnet/ui 6.0.2 → 6.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +652 -0
- package/dist/esm/index.js +72 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/v2/__tests__/AppMain.test.js +130 -0
- package/dist/esm/v2/__tests__/AppMain.test.js.map +1 -0
- package/dist/esm/v2/__tests__/ChartFigure.test.js +180 -0
- package/dist/esm/v2/__tests__/ChartFigure.test.js.map +1 -0
- package/dist/esm/v2/__tests__/DataGridRowActionsPropagation.test.js +150 -0
- package/dist/esm/v2/__tests__/DataGridRowActionsPropagation.test.js.map +1 -0
- package/dist/esm/v2/__tests__/DrawerTactileTargets.test.js +93 -0
- package/dist/esm/v2/__tests__/DrawerTactileTargets.test.js.map +1 -0
- package/dist/esm/v2/__tests__/FieldError.test.js +71 -38
- package/dist/esm/v2/__tests__/FieldError.test.js.map +1 -1
- package/dist/esm/v2/__tests__/FieldNaming.test.js +160 -0
- package/dist/esm/v2/__tests__/FieldNaming.test.js.map +1 -0
- package/dist/esm/v2/__tests__/FieldWidth.test.js +11 -11
- package/dist/esm/v2/__tests__/FieldWidth.test.js.map +1 -1
- package/dist/esm/v2/__tests__/FileCard.test.js +18 -17
- package/dist/esm/v2/__tests__/FileCard.test.js.map +1 -1
- package/dist/esm/v2/__tests__/FormikCheckbox.test.js +87 -179
- package/dist/esm/v2/__tests__/FormikCheckbox.test.js.map +1 -1
- package/dist/esm/v2/__tests__/FormikDateTimePicker.test.js +32 -44
- package/dist/esm/v2/__tests__/FormikDateTimePicker.test.js.map +1 -1
- package/dist/esm/v2/__tests__/FormikDisplayWidth.test.js +101 -0
- package/dist/esm/v2/__tests__/FormikDisplayWidth.test.js.map +1 -0
- package/dist/esm/v2/__tests__/FormikRadioGroup.test.js +118 -199
- package/dist/esm/v2/__tests__/FormikRadioGroup.test.js.map +1 -1
- package/dist/esm/v2/__tests__/MobileRowCard.test.js +44 -42
- package/dist/esm/v2/__tests__/MobileRowCard.test.js.map +1 -1
- package/dist/esm/v2/__tests__/PreviewDrawer.test.js +165 -0
- package/dist/esm/v2/__tests__/PreviewDrawer.test.js.map +1 -0
- package/dist/esm/v2/__tests__/ReferentielFieldContainer.test.js +156 -0
- package/dist/esm/v2/__tests__/ReferentielFieldContainer.test.js.map +1 -0
- package/dist/esm/v2/__tests__/SectionErrorBoundary.test.js +37 -52
- package/dist/esm/v2/__tests__/SectionErrorBoundary.test.js.map +1 -1
- package/dist/esm/v2/__tests__/apiError.test.js +50 -69
- package/dist/esm/v2/__tests__/apiError.test.js.map +1 -1
- package/dist/esm/v2/__tests__/banned-patterns.test.js +41 -122
- package/dist/esm/v2/__tests__/banned-patterns.test.js.map +1 -1
- package/dist/esm/v2/__tests__/chart-palette.test.js +204 -0
- package/dist/esm/v2/__tests__/chart-palette.test.js.map +1 -0
- package/dist/esm/v2/__tests__/contrast-palette.test.js +42 -74
- package/dist/esm/v2/__tests__/contrast-palette.test.js.map +1 -1
- package/dist/esm/v2/__tests__/cssVariables.test.js +44 -51
- package/dist/esm/v2/__tests__/cssVariables.test.js.map +1 -1
- package/dist/esm/v2/__tests__/fileValidation.test.js +134 -0
- package/dist/esm/v2/__tests__/fileValidation.test.js.map +1 -0
- package/dist/esm/v2/__tests__/filterCriteria.test.js +321 -0
- package/dist/esm/v2/__tests__/filterCriteria.test.js.map +1 -0
- package/dist/esm/v2/__tests__/fmtDate.test.js +68 -0
- package/dist/esm/v2/__tests__/fmtDate.test.js.map +1 -0
- package/dist/esm/v2/__tests__/gap-leakage-refonte.test.js +218 -0
- package/dist/esm/v2/__tests__/gap-leakage-refonte.test.js.map +1 -0
- package/dist/esm/v2/__tests__/labels-merge.test.js +17 -21
- package/dist/esm/v2/__tests__/labels-merge.test.js.map +1 -1
- package/dist/esm/v2/__tests__/locale-fallback.test.js +35 -40
- package/dist/esm/v2/__tests__/locale-fallback.test.js.map +1 -1
- package/dist/esm/v2/__tests__/reviveSavedCriteria.test.js +143 -0
- package/dist/esm/v2/__tests__/reviveSavedCriteria.test.js.map +1 -0
- package/dist/esm/v2/__tests__/rowActions.test.js +182 -0
- package/dist/esm/v2/__tests__/rowActions.test.js.map +1 -0
- package/dist/esm/v2/__tests__/useFocusOnRouteChange.test.js +155 -0
- package/dist/esm/v2/__tests__/useFocusOnRouteChange.test.js.map +1 -0
- package/dist/esm/v2/__tests__/useFocusTrap.test.js +266 -402
- package/dist/esm/v2/__tests__/useFocusTrap.test.js.map +1 -1
- package/dist/esm/v2/__tests__/usePrefersReducedMotion.test.js +120 -0
- package/dist/esm/v2/__tests__/usePrefersReducedMotion.test.js.map +1 -0
- package/dist/esm/v2/components/Accordion.js +48 -70
- package/dist/esm/v2/components/Accordion.js.map +1 -1
- package/dist/esm/v2/components/ActionStrip.js +31 -43
- package/dist/esm/v2/components/ActionStrip.js.map +1 -1
- package/dist/esm/v2/components/Banner.js +25 -22
- package/dist/esm/v2/components/Banner.js.map +1 -1
- package/dist/esm/v2/components/Busy.js +14 -19
- package/dist/esm/v2/components/Busy.js.map +1 -1
- package/dist/esm/v2/components/Button.js +34 -45
- package/dist/esm/v2/components/Button.js.map +1 -1
- package/dist/esm/v2/components/CategoryTag.js +44 -27
- package/dist/esm/v2/components/CategoryTag.js.map +1 -1
- package/dist/esm/v2/components/Checkbox.js +32 -38
- package/dist/esm/v2/components/Checkbox.js.map +1 -1
- package/dist/esm/v2/components/Chip.js +23 -36
- package/dist/esm/v2/components/Chip.js.map +1 -1
- package/dist/esm/v2/components/Combobox.js +112 -136
- package/dist/esm/v2/components/Combobox.js.map +1 -1
- package/dist/esm/v2/components/CommandPalette.js +113 -198
- package/dist/esm/v2/components/CommandPalette.js.map +1 -1
- package/dist/esm/v2/components/ConfirmDialog.js +36 -45
- package/dist/esm/v2/components/ConfirmDialog.js.map +1 -1
- package/dist/esm/v2/components/DatePicker.js +78 -81
- package/dist/esm/v2/components/DatePicker.js.map +1 -1
- package/dist/esm/v2/components/DateRangePicker.js +63 -74
- package/dist/esm/v2/components/DateRangePicker.js.map +1 -1
- package/dist/esm/v2/components/DateTimePicker.js +81 -86
- package/dist/esm/v2/components/DateTimePicker.js.map +1 -1
- package/dist/esm/v2/components/Drawer.js +71 -65
- package/dist/esm/v2/components/Drawer.js.map +1 -1
- package/dist/esm/v2/components/Dropzone.js +130 -177
- package/dist/esm/v2/components/Dropzone.js.map +1 -1
- package/dist/esm/v2/components/EmptyState.js +9 -9
- package/dist/esm/v2/components/EmptyState.js.map +1 -1
- package/dist/esm/v2/components/FavoriteToggle.js +24 -33
- package/dist/esm/v2/components/FavoriteToggle.js.map +1 -1
- package/dist/esm/v2/components/Field.js +155 -59
- package/dist/esm/v2/components/Field.js.map +1 -1
- package/dist/esm/v2/components/FieldError.js +9 -13
- package/dist/esm/v2/components/FieldError.js.map +1 -1
- package/dist/esm/v2/components/FieldHelp.js +28 -49
- package/dist/esm/v2/components/FieldHelp.js.map +1 -1
- package/dist/esm/v2/components/FileCard.js +14 -19
- package/dist/esm/v2/components/FileCard.js.map +1 -1
- package/dist/esm/v2/components/FilterTab.js +22 -31
- package/dist/esm/v2/components/FilterTab.js.map +1 -1
- package/dist/esm/v2/components/ForbiddenPage.js +28 -8
- package/dist/esm/v2/components/ForbiddenPage.js.map +1 -1
- package/dist/esm/v2/components/FormGrid.js +48 -54
- package/dist/esm/v2/components/FormGrid.js.map +1 -1
- package/dist/esm/v2/components/FormikDisplay.js +98 -24
- package/dist/esm/v2/components/FormikDisplay.js.map +1 -1
- package/dist/esm/v2/components/Input.js +75 -34
- package/dist/esm/v2/components/Input.js.map +1 -1
- package/dist/esm/v2/components/KPICard.js +42 -51
- package/dist/esm/v2/components/KPICard.js.map +1 -1
- package/dist/esm/v2/components/KPIStrip.js +9 -15
- package/dist/esm/v2/components/KPIStrip.js.map +1 -1
- package/dist/esm/v2/components/KV.js +16 -23
- package/dist/esm/v2/components/KV.js.map +1 -1
- package/dist/esm/v2/components/KVGrid.js +15 -23
- package/dist/esm/v2/components/KVGrid.js.map +1 -1
- package/dist/esm/v2/components/Layout.js +81 -117
- package/dist/esm/v2/components/Layout.js.map +1 -1
- package/dist/esm/v2/components/MobileRowCard.js +64 -75
- package/dist/esm/v2/components/MobileRowCard.js.map +1 -1
- package/dist/esm/v2/components/Modal.js +44 -53
- package/dist/esm/v2/components/Modal.js.map +1 -1
- package/dist/esm/v2/components/NetworkErrorPage.js +28 -11
- package/dist/esm/v2/components/NetworkErrorPage.js.map +1 -1
- package/dist/esm/v2/components/NotFoundPage.js +28 -9
- package/dist/esm/v2/components/NotFoundPage.js.map +1 -1
- package/dist/esm/v2/components/NumberInput.js +77 -107
- package/dist/esm/v2/components/NumberInput.js.map +1 -1
- package/dist/esm/v2/components/OverflowMenu.js +24 -42
- package/dist/esm/v2/components/OverflowMenu.js.map +1 -1
- package/dist/esm/v2/components/PdfViewer.js +24 -33
- package/dist/esm/v2/components/PdfViewer.js.map +1 -1
- package/dist/esm/v2/components/ProgressBar.js +28 -36
- package/dist/esm/v2/components/ProgressBar.js.map +1 -1
- package/dist/esm/v2/components/Radio.js +49 -57
- package/dist/esm/v2/components/Radio.js.map +1 -1
- package/dist/esm/v2/components/SectionErrorBoundary.js +84 -130
- package/dist/esm/v2/components/SectionErrorBoundary.js.map +1 -1
- package/dist/esm/v2/components/SectionHeader.js +24 -31
- package/dist/esm/v2/components/SectionHeader.js.map +1 -1
- package/dist/esm/v2/components/Segmented.js +59 -84
- package/dist/esm/v2/components/Segmented.js.map +1 -1
- package/dist/esm/v2/components/Select.js +100 -138
- package/dist/esm/v2/components/Select.js.map +1 -1
- package/dist/esm/v2/components/ServerErrorPage.js +27 -10
- package/dist/esm/v2/components/ServerErrorPage.js.map +1 -1
- package/dist/esm/v2/components/Skeleton.js +81 -96
- package/dist/esm/v2/components/Skeleton.js.map +1 -1
- package/dist/esm/v2/components/SkipLink.js +6 -7
- package/dist/esm/v2/components/SkipLink.js.map +1 -1
- package/dist/esm/v2/components/Spinner.js +13 -22
- package/dist/esm/v2/components/Spinner.js.map +1 -1
- package/dist/esm/v2/components/Status.js +14 -25
- package/dist/esm/v2/components/Status.js.map +1 -1
- package/dist/esm/v2/components/Stepper.js +68 -71
- package/dist/esm/v2/components/Stepper.js.map +1 -1
- package/dist/esm/v2/components/Surface.js +25 -44
- package/dist/esm/v2/components/Surface.js.map +1 -1
- package/dist/esm/v2/components/Switch.js +21 -29
- package/dist/esm/v2/components/Switch.js.map +1 -1
- package/dist/esm/v2/components/TabPanel.js +84 -0
- package/dist/esm/v2/components/TabPanel.js.map +1 -0
- package/dist/esm/v2/components/Tabs.js +43 -19
- package/dist/esm/v2/components/Tabs.js.map +1 -1
- package/dist/esm/v2/components/TelInput.js +75 -108
- package/dist/esm/v2/components/TelInput.js.map +1 -1
- package/dist/esm/v2/components/Textarea.js +21 -30
- package/dist/esm/v2/components/Textarea.js.map +1 -1
- package/dist/esm/v2/components/TimePicker.js +59 -69
- package/dist/esm/v2/components/TimePicker.js.map +1 -1
- package/dist/esm/v2/components/Toast.js +109 -163
- package/dist/esm/v2/components/Toast.js.map +1 -1
- package/dist/esm/v2/components/Tooltip.js +18 -31
- package/dist/esm/v2/components/Tooltip.js.map +1 -1
- package/dist/esm/v2/components/_ErrorPageBody.js +6 -5
- package/dist/esm/v2/components/_ErrorPageBody.js.map +1 -1
- package/dist/esm/v2/components/_pickerShared.js +2 -2
- package/dist/esm/v2/components/_pickerShared.js.map +1 -1
- package/dist/esm/v2/components/index.js +37 -0
- package/dist/esm/v2/components/index.js.map +1 -1
- package/dist/esm/v2/hooks/index.js +62 -0
- package/dist/esm/v2/hooks/index.js.map +1 -1
- package/dist/esm/v2/hooks/useAppliedFilters.js +112 -0
- package/dist/esm/v2/hooks/useAppliedFilters.js.map +1 -0
- package/dist/esm/v2/hooks/useDebouncedCallback.js +82 -0
- package/dist/esm/v2/hooks/useDebouncedCallback.js.map +1 -0
- package/dist/esm/v2/hooks/useDelayedFlag.js +5 -19
- package/dist/esm/v2/hooks/useDelayedFlag.js.map +1 -1
- package/dist/esm/v2/hooks/useDensity.js +13 -17
- package/dist/esm/v2/hooks/useDensity.js.map +1 -1
- package/dist/esm/v2/hooks/useFocusFirstError.js +25 -33
- package/dist/esm/v2/hooks/useFocusFirstError.js.map +1 -1
- package/dist/esm/v2/hooks/useFocusOnRouteChange.js +81 -0
- package/dist/esm/v2/hooks/useFocusOnRouteChange.js.map +1 -0
- package/dist/esm/v2/hooks/useFocusTrap.js +19 -23
- package/dist/esm/v2/hooks/useFocusTrap.js.map +1 -1
- package/dist/esm/v2/hooks/useFormAutoSave.js +38 -53
- package/dist/esm/v2/hooks/useFormAutoSave.js.map +1 -1
- package/dist/esm/v2/hooks/useFormCompletionProgress.js +32 -51
- package/dist/esm/v2/hooks/useFormCompletionProgress.js.map +1 -1
- package/dist/esm/v2/hooks/useKeyboardShortcuts.js +125 -0
- package/dist/esm/v2/hooks/useKeyboardShortcuts.js.map +1 -0
- package/dist/esm/v2/hooks/usePrefersReducedMotion.js +99 -0
- package/dist/esm/v2/hooks/usePrefersReducedMotion.js.map +1 -0
- package/dist/esm/v2/hooks/useResolvedDensity.js +2 -10
- package/dist/esm/v2/hooks/useResolvedDensity.js.map +1 -1
- package/dist/esm/v2/hooks/useSortedRows.js +3 -5
- package/dist/esm/v2/hooks/useSortedRows.js.map +1 -1
- package/dist/esm/v2/hooks/useTabLoading.js +6 -21
- package/dist/esm/v2/hooks/useTabLoading.js.map +1 -1
- package/dist/esm/v2/index.js +2 -3
- package/dist/esm/v2/index.js.map +1 -1
- package/dist/esm/v2/modalContext.js +2 -2
- package/dist/esm/v2/modalContext.js.map +1 -1
- package/dist/esm/v2/models/favorite.js.map +1 -1
- package/dist/esm/v2/models/personalization.js.map +1 -1
- package/dist/esm/v2/models/referentiel.js.map +1 -1
- package/dist/esm/v2/models/savedFilter.js.map +1 -1
- package/dist/esm/v2/patterns/ActionBar.js +115 -159
- package/dist/esm/v2/patterns/ActionBar.js.map +1 -1
- package/dist/esm/v2/patterns/AppMain.js +108 -0
- package/dist/esm/v2/patterns/AppMain.js.map +1 -0
- package/dist/esm/v2/patterns/BulkActionBar.js +31 -34
- package/dist/esm/v2/patterns/BulkActionBar.js.map +1 -1
- package/dist/esm/v2/patterns/ChartFigure.js +151 -0
- package/dist/esm/v2/patterns/ChartFigure.js.map +1 -0
- package/dist/esm/v2/patterns/CollapsibleDataGrid.js +111 -152
- package/dist/esm/v2/patterns/CollapsibleDataGrid.js.map +1 -1
- package/dist/esm/v2/patterns/ColumnsToggle.js +43 -77
- package/dist/esm/v2/patterns/ColumnsToggle.js.map +1 -1
- package/dist/esm/v2/patterns/DataGrid.js +221 -255
- package/dist/esm/v2/patterns/DataGrid.js.map +1 -1
- package/dist/esm/v2/patterns/DataGridSettingsMenu.js +76 -94
- package/dist/esm/v2/patterns/DataGridSettingsMenu.js.map +1 -1
- package/dist/esm/v2/patterns/DataGridToolbar.js +85 -89
- package/dist/esm/v2/patterns/DataGridToolbar.js.map +1 -1
- package/dist/esm/v2/patterns/DataGridVirtualized.js +141 -182
- package/dist/esm/v2/patterns/DataGridVirtualized.js.map +1 -1
- package/dist/esm/v2/patterns/DeleteResourceConfirmDialog.js +26 -30
- package/dist/esm/v2/patterns/DeleteResourceConfirmDialog.js.map +1 -1
- package/dist/esm/v2/patterns/DetailSplit.js +108 -0
- package/dist/esm/v2/patterns/DetailSplit.js.map +1 -0
- package/dist/esm/v2/patterns/FavoriteColumn.js +15 -17
- package/dist/esm/v2/patterns/FavoriteColumn.js.map +1 -1
- package/dist/esm/v2/patterns/FavoritesFilter.js +30 -39
- package/dist/esm/v2/patterns/FavoritesFilter.js.map +1 -1
- package/dist/esm/v2/patterns/FilterTabBar.js +112 -0
- package/dist/esm/v2/patterns/FilterTabBar.js.map +1 -0
- package/dist/esm/v2/patterns/FormErrorSummary.js +12 -13
- package/dist/esm/v2/patterns/FormErrorSummary.js.map +1 -1
- package/dist/esm/v2/patterns/FormPageShell.js +43 -41
- package/dist/esm/v2/patterns/FormPageShell.js.map +1 -1
- package/dist/esm/v2/patterns/FormSection.js +30 -38
- package/dist/esm/v2/patterns/FormSection.js.map +1 -1
- package/dist/esm/v2/patterns/FormikCheckbox.js +29 -39
- package/dist/esm/v2/patterns/FormikCheckbox.js.map +1 -1
- package/dist/esm/v2/patterns/FormikCheckboxGroup.js +56 -60
- package/dist/esm/v2/patterns/FormikCheckboxGroup.js.map +1 -1
- package/dist/esm/v2/patterns/FormikCombobox.js +51 -69
- package/dist/esm/v2/patterns/FormikCombobox.js.map +1 -1
- package/dist/esm/v2/patterns/FormikDatePicker.js +44 -58
- package/dist/esm/v2/patterns/FormikDatePicker.js.map +1 -1
- package/dist/esm/v2/patterns/FormikDateTimePicker.js +44 -58
- package/dist/esm/v2/patterns/FormikDateTimePicker.js.map +1 -1
- package/dist/esm/v2/patterns/FormikErrorFocus.js +22 -23
- package/dist/esm/v2/patterns/FormikErrorFocus.js.map +1 -1
- package/dist/esm/v2/patterns/FormikErrorSummary.js +89 -0
- package/dist/esm/v2/patterns/FormikErrorSummary.js.map +1 -0
- package/dist/esm/v2/patterns/FormikFile.js +94 -78
- package/dist/esm/v2/patterns/FormikFile.js.map +1 -1
- package/dist/esm/v2/patterns/FormikInput.js +40 -53
- package/dist/esm/v2/patterns/FormikInput.js.map +1 -1
- package/dist/esm/v2/patterns/FormikRadioGroup.js +39 -51
- package/dist/esm/v2/patterns/FormikRadioGroup.js.map +1 -1
- package/dist/esm/v2/patterns/FormikReferentielField.js +49 -59
- package/dist/esm/v2/patterns/FormikReferentielField.js.map +1 -1
- package/dist/esm/v2/patterns/FormikSelect.js +64 -87
- package/dist/esm/v2/patterns/FormikSelect.js.map +1 -1
- package/dist/esm/v2/patterns/FormikTextarea.js +30 -46
- package/dist/esm/v2/patterns/FormikTextarea.js.map +1 -1
- package/dist/esm/v2/patterns/KeyboardShortcutsHelp.js +53 -71
- package/dist/esm/v2/patterns/KeyboardShortcutsHelp.js.map +1 -1
- package/dist/esm/v2/patterns/NetworkErrorBanner.js +6 -7
- package/dist/esm/v2/patterns/NetworkErrorBanner.js.map +1 -1
- package/dist/esm/v2/patterns/PageContent.js +10 -14
- package/dist/esm/v2/patterns/PageContent.js.map +1 -1
- package/dist/esm/v2/patterns/PreviewDrawer.js +153 -0
- package/dist/esm/v2/patterns/PreviewDrawer.js.map +1 -0
- package/dist/esm/v2/patterns/ReferentielField.js +327 -312
- package/dist/esm/v2/patterns/ReferentielField.js.map +1 -1
- package/dist/esm/v2/patterns/RowFavoriteToggle.js +27 -22
- package/dist/esm/v2/patterns/RowFavoriteToggle.js.map +1 -1
- package/dist/esm/v2/patterns/SaveFilterDialog.js +38 -66
- package/dist/esm/v2/patterns/SaveFilterDialog.js.map +1 -1
- package/dist/esm/v2/patterns/SavedFiltersMenu.js +62 -81
- package/dist/esm/v2/patterns/SavedFiltersMenu.js.map +1 -1
- package/dist/esm/v2/patterns/SkeletonPageShell.js +106 -129
- package/dist/esm/v2/patterns/SkeletonPageShell.js.map +1 -1
- package/dist/esm/v2/patterns/SortableHeader.js +22 -45
- package/dist/esm/v2/patterns/SortableHeader.js.map +1 -1
- package/dist/esm/v2/patterns/Tour.js +94 -120
- package/dist/esm/v2/patterns/Tour.js.map +1 -1
- package/dist/esm/v2/patterns/_dataGridShared.js +107 -128
- package/dist/esm/v2/patterns/_dataGridShared.js.map +1 -1
- package/dist/esm/v2/patterns/_pickerSerialisation.js +6 -8
- package/dist/esm/v2/patterns/_pickerSerialisation.js.map +1 -1
- package/dist/esm/v2/patterns/_sort.js +17 -33
- package/dist/esm/v2/patterns/_sort.js.map +1 -1
- package/dist/esm/v2/patterns/_useColumnReorder.js +122 -160
- package/dist/esm/v2/patterns/_useColumnReorder.js.map +1 -1
- package/dist/esm/v2/patterns/_useColumnResize.js +78 -96
- package/dist/esm/v2/patterns/_useColumnResize.js.map +1 -1
- package/dist/esm/v2/patterns/filterCriteria.js +102 -0
- package/dist/esm/v2/patterns/filterCriteria.js.map +1 -0
- package/dist/esm/v2/patterns/index.js +152 -0
- package/dist/esm/v2/patterns/index.js.map +1 -1
- package/dist/esm/v2/patterns/rowActions.js +223 -0
- package/dist/esm/v2/patterns/rowActions.js.map +1 -0
- package/dist/esm/v2/personalization/PersonalizationProvider.js +50 -47
- package/dist/esm/v2/personalization/PersonalizationProvider.js.map +1 -1
- package/dist/esm/v2/personalization/adapters/_storageKey.js +5 -5
- package/dist/esm/v2/personalization/adapters/_storageKey.js.map +1 -1
- package/dist/esm/v2/personalization/adapters/createLocalStorageAdapter.js +22 -23
- package/dist/esm/v2/personalization/adapters/createLocalStorageAdapter.js.map +1 -1
- package/dist/esm/v2/personalization/adapters/createMemoryAdapter.js +13 -13
- package/dist/esm/v2/personalization/adapters/createMemoryAdapter.js.map +1 -1
- package/dist/esm/v2/personalization/capabilities/favorites.js +36 -60
- package/dist/esm/v2/personalization/capabilities/favorites.js.map +1 -1
- package/dist/esm/v2/personalization/capabilities/favoritesView.js +22 -34
- package/dist/esm/v2/personalization/capabilities/favoritesView.js.map +1 -1
- package/dist/esm/v2/personalization/capabilities/gridPreferences.js +28 -34
- package/dist/esm/v2/personalization/capabilities/gridPreferences.js.map +1 -1
- package/dist/esm/v2/personalization/capabilities/reviveSavedCriteria.js +119 -0
- package/dist/esm/v2/personalization/capabilities/reviveSavedCriteria.js.map +1 -0
- package/dist/esm/v2/personalization/capabilities/savedFilters.js +90 -98
- package/dist/esm/v2/personalization/capabilities/savedFilters.js.map +1 -1
- package/dist/esm/v2/personalization/createPersonalizationStore.js +78 -181
- package/dist/esm/v2/personalization/createPersonalizationStore.js.map +1 -1
- package/dist/esm/v2/personalization/index.js +17 -0
- package/dist/esm/v2/personalization/index.js.map +1 -1
- package/dist/esm/v2/personalization/personalizationContext.js +9 -9
- package/dist/esm/v2/personalization/personalizationContext.js.map +1 -1
- package/dist/esm/v2/personalization/schema.js +8 -9
- package/dist/esm/v2/personalization/schema.js.map +1 -1
- package/dist/esm/v2/referentiel/ReferentielProvider.js +27 -42
- package/dist/esm/v2/referentiel/ReferentielProvider.js.map +1 -1
- package/dist/esm/v2/referentiel/types.js +2 -0
- package/dist/esm/v2/referentiel/types.js.map +1 -0
- package/dist/esm/v2/referentiel/useReferentielClient.js +10 -11
- package/dist/esm/v2/referentiel/useReferentielClient.js.map +1 -1
- package/dist/esm/v2/referentiel/useReferentielOptions.js +60 -117
- package/dist/esm/v2/referentiel/useReferentielOptions.js.map +1 -1
- package/dist/esm/v2/referentiel/useReferentielSearch.js +37 -91
- package/dist/esm/v2/referentiel/useReferentielSearch.js.map +1 -1
- package/dist/esm/v2/theme/_brand.js +8 -24
- package/dist/esm/v2/theme/_brand.js.map +1 -1
- package/dist/esm/v2/theme/_brandSecondary.js +8 -24
- package/dist/esm/v2/theme/_brandSecondary.js.map +1 -1
- package/dist/esm/v2/theme/createPortnetTheme.js +51 -61
- package/dist/esm/v2/theme/createPortnetTheme.js.map +1 -1
- package/dist/esm/v2/theme/cssVariables.js +62 -69
- package/dist/esm/v2/theme/cssVariables.js.map +1 -1
- package/dist/esm/v2/theme/index.js +5 -5
- package/dist/esm/v2/theme/index.js.map +1 -1
- package/dist/esm/v2/tokens/breakpoints.js +14 -14
- package/dist/esm/v2/tokens/breakpoints.js.map +1 -1
- package/dist/esm/v2/tokens/chart.js +261 -0
- package/dist/esm/v2/tokens/chart.js.map +1 -0
- package/dist/esm/v2/tokens/colors.js +22 -22
- package/dist/esm/v2/tokens/colors.js.map +1 -1
- package/dist/esm/v2/tokens/density.js +62 -7
- package/dist/esm/v2/tokens/density.js.map +1 -1
- package/dist/esm/v2/tokens/index.js +49 -34
- package/dist/esm/v2/tokens/index.js.map +1 -1
- package/dist/esm/v2/tokens/motion.js +12 -20
- package/dist/esm/v2/tokens/motion.js.map +1 -1
- package/dist/esm/v2/tokens/radius.js +1 -1
- package/dist/esm/v2/tokens/radius.js.map +1 -1
- package/dist/esm/v2/tokens/shadows.js +6 -6
- package/dist/esm/v2/tokens/shadows.js.map +1 -1
- package/dist/esm/v2/tokens/spacing.js +2 -2
- package/dist/esm/v2/tokens/spacing.js.map +1 -1
- package/dist/esm/v2/tokens/state.js +1 -1
- package/dist/esm/v2/tokens/state.js.map +1 -1
- package/dist/esm/v2/tokens/statusPalette.js +17 -21
- package/dist/esm/v2/tokens/statusPalette.js.map +1 -1
- package/dist/esm/v2/tokens/tokens.json +6 -1
- package/dist/esm/v2/tokens/typography.js +13 -13
- package/dist/esm/v2/tokens/typography.js.map +1 -1
- package/dist/esm/v2/tokens/zIndex.js +1 -1
- package/dist/esm/v2/tokens/zIndex.js.map +1 -1
- package/dist/esm/v2/types/datagrid.js.map +1 -1
- package/dist/esm/v2/utils/apiError.js +16 -37
- package/dist/esm/v2/utils/apiError.js.map +1 -1
- package/dist/esm/v2/utils/contrast.js +31 -32
- package/dist/esm/v2/utils/contrast.js.map +1 -1
- package/dist/esm/v2/utils/cx.js +5 -25
- package/dist/esm/v2/utils/cx.js.map +1 -1
- package/dist/esm/v2/utils/fileDownload.js +23 -26
- package/dist/esm/v2/utils/fileDownload.js.map +1 -1
- package/dist/esm/v2/utils/fileValidation.js +209 -0
- package/dist/esm/v2/utils/fileValidation.js.map +1 -0
- package/dist/esm/v2/utils/fmtDate.js +111 -0
- package/dist/esm/v2/utils/fmtDate.js.map +1 -0
- package/dist/esm/v2/utils/fmtMoney.js +8 -10
- package/dist/esm/v2/utils/fmtMoney.js.map +1 -1
- package/dist/esm/v2/utils/formikErrors.js +78 -0
- package/dist/esm/v2/utils/formikErrors.js.map +1 -0
- package/dist/esm/v2/utils/index.js +35 -2
- package/dist/esm/v2/utils/index.js.map +1 -1
- package/dist/esm/v2/utils/mergeLabels.js +7 -12
- package/dist/esm/v2/utils/mergeLabels.js.map +1 -1
- package/dist/esm/v2/utils/networkStatus.js +12 -12
- package/dist/esm/v2/utils/networkStatus.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +110 -49
- package/dist/index.js.map +1 -1
- package/dist/v2/__tests__/AppMain.test.js +133 -0
- package/dist/v2/__tests__/AppMain.test.js.map +1 -0
- package/dist/v2/__tests__/ChartFigure.test.js +183 -0
- package/dist/v2/__tests__/ChartFigure.test.js.map +1 -0
- package/dist/v2/__tests__/DataGridRowActionsPropagation.test.js +153 -0
- package/dist/v2/__tests__/DataGridRowActionsPropagation.test.js.map +1 -0
- package/dist/v2/__tests__/DrawerTactileTargets.test.js +94 -0
- package/dist/v2/__tests__/DrawerTactileTargets.test.js.map +1 -0
- package/dist/v2/__tests__/FieldError.test.js +82 -49
- package/dist/v2/__tests__/FieldError.test.js.map +1 -1
- package/dist/v2/__tests__/FieldNaming.test.js +161 -0
- package/dist/v2/__tests__/FieldNaming.test.js.map +1 -0
- package/dist/v2/__tests__/FieldWidth.test.js +23 -25
- package/dist/v2/__tests__/FieldWidth.test.js.map +1 -1
- package/dist/v2/__tests__/FileCard.test.js +29 -28
- package/dist/v2/__tests__/FileCard.test.js.map +1 -1
- package/dist/v2/__tests__/FormikCheckbox.test.js +90 -183
- package/dist/v2/__tests__/FormikCheckbox.test.js.map +1 -1
- package/dist/v2/__tests__/FormikDateTimePicker.test.js +38 -48
- package/dist/v2/__tests__/FormikDateTimePicker.test.js.map +1 -1
- package/dist/v2/__tests__/FormikDisplayWidth.test.js +102 -0
- package/dist/v2/__tests__/FormikDisplayWidth.test.js.map +1 -0
- package/dist/v2/__tests__/FormikRadioGroup.test.js +123 -204
- package/dist/v2/__tests__/FormikRadioGroup.test.js.map +1 -1
- package/dist/v2/__tests__/MobileRowCard.test.js +63 -61
- package/dist/v2/__tests__/MobileRowCard.test.js.map +1 -1
- package/dist/v2/__tests__/PreviewDrawer.test.js +169 -0
- package/dist/v2/__tests__/PreviewDrawer.test.js.map +1 -0
- package/dist/v2/__tests__/ReferentielFieldContainer.test.js +159 -0
- package/dist/v2/__tests__/ReferentielFieldContainer.test.js.map +1 -0
- package/dist/v2/__tests__/SectionErrorBoundary.test.js +53 -68
- package/dist/v2/__tests__/SectionErrorBoundary.test.js.map +1 -1
- package/dist/v2/__tests__/apiError.test.js +50 -69
- package/dist/v2/__tests__/apiError.test.js.map +1 -1
- package/dist/v2/__tests__/banned-patterns.test.js +42 -123
- package/dist/v2/__tests__/banned-patterns.test.js.map +1 -1
- package/dist/v2/__tests__/chart-palette.test.js +205 -0
- package/dist/v2/__tests__/chart-palette.test.js.map +1 -0
- package/dist/v2/__tests__/contrast-palette.test.js +42 -74
- package/dist/v2/__tests__/contrast-palette.test.js.map +1 -1
- package/dist/v2/__tests__/cssVariables.test.js +44 -51
- package/dist/v2/__tests__/cssVariables.test.js.map +1 -1
- package/dist/v2/__tests__/fileValidation.test.js +136 -0
- package/dist/v2/__tests__/fileValidation.test.js.map +1 -0
- package/dist/v2/__tests__/filterCriteria.test.js +324 -0
- package/dist/v2/__tests__/filterCriteria.test.js.map +1 -0
- package/dist/v2/__tests__/fmtDate.test.js +69 -0
- package/dist/v2/__tests__/fmtDate.test.js.map +1 -0
- package/dist/v2/__tests__/gap-leakage-refonte.test.js +221 -0
- package/dist/v2/__tests__/gap-leakage-refonte.test.js.map +1 -0
- package/dist/v2/__tests__/labels-merge.test.js +23 -27
- package/dist/v2/__tests__/labels-merge.test.js.map +1 -1
- package/dist/v2/__tests__/locale-fallback.test.js +47 -52
- package/dist/v2/__tests__/locale-fallback.test.js.map +1 -1
- package/dist/v2/__tests__/reviveSavedCriteria.test.js +144 -0
- package/dist/v2/__tests__/reviveSavedCriteria.test.js.map +1 -0
- package/dist/v2/__tests__/rowActions.test.js +186 -0
- package/dist/v2/__tests__/rowActions.test.js.map +1 -0
- package/dist/v2/__tests__/useFocusOnRouteChange.test.js +156 -0
- package/dist/v2/__tests__/useFocusOnRouteChange.test.js.map +1 -0
- package/dist/v2/__tests__/useFocusTrap.test.js +270 -407
- package/dist/v2/__tests__/useFocusTrap.test.js.map +1 -1
- package/dist/v2/__tests__/usePrefersReducedMotion.test.js +123 -0
- package/dist/v2/__tests__/usePrefersReducedMotion.test.js.map +1 -0
- package/dist/v2/components/Accordion.js +60 -82
- package/dist/v2/components/Accordion.js.map +1 -1
- package/dist/v2/components/ActionStrip.js +40 -52
- package/dist/v2/components/ActionStrip.js.map +1 -1
- package/dist/v2/components/Banner.js +42 -41
- package/dist/v2/components/Banner.js.map +1 -1
- package/dist/v2/components/Busy.js +22 -27
- package/dist/v2/components/Busy.js.map +1 -1
- package/dist/v2/components/Button.js +39 -50
- package/dist/v2/components/Button.js.map +1 -1
- package/dist/v2/components/CategoryTag.d.ts.map +1 -1
- package/dist/v2/components/CategoryTag.js +49 -32
- package/dist/v2/components/CategoryTag.js.map +1 -1
- package/dist/v2/components/Checkbox.js +39 -45
- package/dist/v2/components/Checkbox.js.map +1 -1
- package/dist/v2/components/Chip.js +29 -42
- package/dist/v2/components/Chip.js.map +1 -1
- package/dist/v2/components/Combobox.js +122 -144
- package/dist/v2/components/Combobox.js.map +1 -1
- package/dist/v2/components/CommandPalette.js +138 -225
- package/dist/v2/components/CommandPalette.js.map +1 -1
- package/dist/v2/components/ConfirmDialog.js +46 -56
- package/dist/v2/components/ConfirmDialog.js.map +1 -1
- package/dist/v2/components/DatePicker.js +81 -86
- package/dist/v2/components/DatePicker.js.map +1 -1
- package/dist/v2/components/DateRangePicker.js +77 -87
- package/dist/v2/components/DateRangePicker.js.map +1 -1
- package/dist/v2/components/DateTimePicker.js +84 -91
- package/dist/v2/components/DateTimePicker.js.map +1 -1
- package/dist/v2/components/Drawer.d.ts.map +1 -1
- package/dist/v2/components/Drawer.js +93 -88
- package/dist/v2/components/Drawer.js.map +1 -1
- package/dist/v2/components/Dropzone.js +150 -196
- package/dist/v2/components/Dropzone.js.map +1 -1
- package/dist/v2/components/EmptyState.js +18 -20
- package/dist/v2/components/EmptyState.js.map +1 -1
- package/dist/v2/components/FavoriteToggle.js +28 -39
- package/dist/v2/components/FavoriteToggle.js.map +1 -1
- package/dist/v2/components/Field.d.ts +62 -4
- package/dist/v2/components/Field.d.ts.map +1 -1
- package/dist/v2/components/Field.js +169 -70
- package/dist/v2/components/Field.js.map +1 -1
- package/dist/v2/components/FieldError.js +18 -21
- package/dist/v2/components/FieldError.js.map +1 -1
- package/dist/v2/components/FieldHelp.js +40 -60
- package/dist/v2/components/FieldHelp.js.map +1 -1
- package/dist/v2/components/FileCard.js +27 -31
- package/dist/v2/components/FileCard.js.map +1 -1
- package/dist/v2/components/FilterTab.js +30 -38
- package/dist/v2/components/FilterTab.js.map +1 -1
- package/dist/v2/components/ForbiddenPage.d.ts +25 -1
- package/dist/v2/components/ForbiddenPage.d.ts.map +1 -1
- package/dist/v2/components/ForbiddenPage.js +37 -17
- package/dist/v2/components/ForbiddenPage.js.map +1 -1
- package/dist/v2/components/FormGrid.js +53 -59
- package/dist/v2/components/FormGrid.js.map +1 -1
- package/dist/v2/components/FormikDisplay.d.ts +50 -1
- package/dist/v2/components/FormikDisplay.d.ts.map +1 -1
- package/dist/v2/components/FormikDisplay.js +108 -33
- package/dist/v2/components/FormikDisplay.js.map +1 -1
- package/dist/v2/components/Input.d.ts +40 -0
- package/dist/v2/components/Input.d.ts.map +1 -1
- package/dist/v2/components/Input.js +81 -41
- package/dist/v2/components/Input.js.map +1 -1
- package/dist/v2/components/KPICard.js +57 -67
- package/dist/v2/components/KPICard.js.map +1 -1
- package/dist/v2/components/KPIStrip.js +16 -22
- package/dist/v2/components/KPIStrip.js.map +1 -1
- package/dist/v2/components/KV.js +25 -31
- package/dist/v2/components/KV.js.map +1 -1
- package/dist/v2/components/KVGrid.js +19 -26
- package/dist/v2/components/KVGrid.js.map +1 -1
- package/dist/v2/components/Layout.js +91 -120
- package/dist/v2/components/Layout.js.map +1 -1
- package/dist/v2/components/MobileRowCard.js +79 -91
- package/dist/v2/components/MobileRowCard.js.map +1 -1
- package/dist/v2/components/Modal.js +61 -69
- package/dist/v2/components/Modal.js.map +1 -1
- package/dist/v2/components/NetworkErrorPage.d.ts +19 -1
- package/dist/v2/components/NetworkErrorPage.d.ts.map +1 -1
- package/dist/v2/components/NetworkErrorPage.js +38 -21
- package/dist/v2/components/NetworkErrorPage.js.map +1 -1
- package/dist/v2/components/NotFoundPage.d.ts +17 -1
- package/dist/v2/components/NotFoundPage.d.ts.map +1 -1
- package/dist/v2/components/NotFoundPage.js +37 -18
- package/dist/v2/components/NotFoundPage.js.map +1 -1
- package/dist/v2/components/NumberInput.js +88 -118
- package/dist/v2/components/NumberInput.js.map +1 -1
- package/dist/v2/components/OverflowMenu.js +38 -56
- package/dist/v2/components/OverflowMenu.js.map +1 -1
- package/dist/v2/components/PdfViewer.js +34 -45
- package/dist/v2/components/PdfViewer.js.map +1 -1
- package/dist/v2/components/ProgressBar.js +42 -49
- package/dist/v2/components/ProgressBar.js.map +1 -1
- package/dist/v2/components/Radio.js +59 -67
- package/dist/v2/components/Radio.js.map +1 -1
- package/dist/v2/components/SectionErrorBoundary.js +90 -135
- package/dist/v2/components/SectionErrorBoundary.js.map +1 -1
- package/dist/v2/components/SectionHeader.js +34 -41
- package/dist/v2/components/SectionHeader.js.map +1 -1
- package/dist/v2/components/Segmented.js +69 -93
- package/dist/v2/components/Segmented.js.map +1 -1
- package/dist/v2/components/Select.d.ts +26 -2
- package/dist/v2/components/Select.d.ts.map +1 -1
- package/dist/v2/components/Select.js +120 -155
- package/dist/v2/components/Select.js.map +1 -1
- package/dist/v2/components/ServerErrorPage.d.ts +27 -1
- package/dist/v2/components/ServerErrorPage.d.ts.map +1 -1
- package/dist/v2/components/ServerErrorPage.js +37 -20
- package/dist/v2/components/ServerErrorPage.js.map +1 -1
- package/dist/v2/components/Skeleton.js +86 -100
- package/dist/v2/components/Skeleton.js.map +1 -1
- package/dist/v2/components/SkipLink.js +9 -12
- package/dist/v2/components/SkipLink.js.map +1 -1
- package/dist/v2/components/Spinner.js +16 -25
- package/dist/v2/components/Spinner.js.map +1 -1
- package/dist/v2/components/Status.js +18 -29
- package/dist/v2/components/Status.js.map +1 -1
- package/dist/v2/components/Stepper.js +80 -82
- package/dist/v2/components/Stepper.js.map +1 -1
- package/dist/v2/components/Surface.js +34 -49
- package/dist/v2/components/Surface.js.map +1 -1
- package/dist/v2/components/Switch.js +29 -37
- package/dist/v2/components/Switch.js.map +1 -1
- package/dist/v2/components/TabPanel.d.ts +17 -0
- package/dist/v2/components/TabPanel.d.ts.map +1 -0
- package/dist/v2/components/TabPanel.js +90 -0
- package/dist/v2/components/TabPanel.js.map +1 -0
- package/dist/v2/components/Tabs.d.ts +25 -0
- package/dist/v2/components/Tabs.d.ts.map +1 -1
- package/dist/v2/components/Tabs.js +53 -29
- package/dist/v2/components/Tabs.js.map +1 -1
- package/dist/v2/components/TelInput.js +80 -115
- package/dist/v2/components/TelInput.js.map +1 -1
- package/dist/v2/components/Textarea.js +26 -35
- package/dist/v2/components/Textarea.js.map +1 -1
- package/dist/v2/components/TimePicker.js +62 -74
- package/dist/v2/components/TimePicker.js.map +1 -1
- package/dist/v2/components/Toast.js +119 -174
- package/dist/v2/components/Toast.js.map +1 -1
- package/dist/v2/components/Tooltip.js +23 -38
- package/dist/v2/components/Tooltip.js.map +1 -1
- package/dist/v2/components/_ErrorPageBody.js +15 -16
- package/dist/v2/components/_ErrorPageBody.js.map +1 -1
- package/dist/v2/components/_pickerShared.js +5 -5
- package/dist/v2/components/_pickerShared.js.map +1 -1
- package/dist/v2/components/index.d.ts +40 -1
- package/dist/v2/components/index.d.ts.map +1 -1
- package/dist/v2/components/index.js +153 -136
- package/dist/v2/components/index.js.map +1 -1
- package/dist/v2/hooks/index.d.ts +65 -0
- package/dist/v2/hooks/index.d.ts.map +1 -1
- package/dist/v2/hooks/index.js +63 -24
- package/dist/v2/hooks/index.js.map +1 -1
- package/dist/v2/hooks/useAppliedFilters.d.ts +102 -0
- package/dist/v2/hooks/useAppliedFilters.d.ts.map +1 -0
- package/dist/v2/hooks/useAppliedFilters.js +117 -0
- package/dist/v2/hooks/useAppliedFilters.js.map +1 -0
- package/dist/v2/hooks/useDebouncedCallback.d.ts +64 -0
- package/dist/v2/hooks/useDebouncedCallback.d.ts.map +1 -0
- package/dist/v2/hooks/useDebouncedCallback.js +87 -0
- package/dist/v2/hooks/useDebouncedCallback.js.map +1 -0
- package/dist/v2/hooks/useDelayedFlag.js +6 -20
- package/dist/v2/hooks/useDelayedFlag.js.map +1 -1
- package/dist/v2/hooks/useDensity.d.ts.map +1 -1
- package/dist/v2/hooks/useDensity.js +14 -18
- package/dist/v2/hooks/useDensity.js.map +1 -1
- package/dist/v2/hooks/useFocusFirstError.js +26 -34
- package/dist/v2/hooks/useFocusFirstError.js.map +1 -1
- package/dist/v2/hooks/useFocusOnRouteChange.d.ts +65 -0
- package/dist/v2/hooks/useFocusOnRouteChange.d.ts.map +1 -0
- package/dist/v2/hooks/useFocusOnRouteChange.js +88 -0
- package/dist/v2/hooks/useFocusOnRouteChange.js.map +1 -0
- package/dist/v2/hooks/useFocusTrap.js +20 -24
- package/dist/v2/hooks/useFocusTrap.js.map +1 -1
- package/dist/v2/hooks/useFormAutoSave.d.ts +4 -4
- package/dist/v2/hooks/useFormAutoSave.d.ts.map +1 -1
- package/dist/v2/hooks/useFormAutoSave.js +39 -54
- package/dist/v2/hooks/useFormAutoSave.js.map +1 -1
- package/dist/v2/hooks/useFormCompletionProgress.d.ts +1 -1
- package/dist/v2/hooks/useFormCompletionProgress.d.ts.map +1 -1
- package/dist/v2/hooks/useFormCompletionProgress.js +33 -52
- package/dist/v2/hooks/useFormCompletionProgress.js.map +1 -1
- package/dist/v2/hooks/useKeyboardShortcuts.d.ts +25 -0
- package/dist/v2/hooks/useKeyboardShortcuts.d.ts.map +1 -0
- package/dist/v2/hooks/useKeyboardShortcuts.js +132 -0
- package/dist/v2/hooks/useKeyboardShortcuts.js.map +1 -0
- package/dist/v2/hooks/usePrefersReducedMotion.d.ts +56 -0
- package/dist/v2/hooks/usePrefersReducedMotion.d.ts.map +1 -0
- package/dist/v2/hooks/usePrefersReducedMotion.js +105 -0
- package/dist/v2/hooks/usePrefersReducedMotion.js.map +1 -0
- package/dist/v2/hooks/useResolvedDensity.js +5 -13
- package/dist/v2/hooks/useResolvedDensity.js.map +1 -1
- package/dist/v2/hooks/useSortedRows.js +4 -6
- package/dist/v2/hooks/useSortedRows.js.map +1 -1
- package/dist/v2/hooks/useTabLoading.js +7 -22
- package/dist/v2/hooks/useTabLoading.js.map +1 -1
- package/dist/v2/index.js +143 -145
- package/dist/v2/index.js.map +1 -1
- package/dist/v2/modalContext.js +2 -2
- package/dist/v2/modalContext.js.map +1 -1
- package/dist/v2/models/favorite.d.ts +8 -9
- package/dist/v2/models/favorite.d.ts.map +1 -1
- package/dist/v2/models/favorite.js.map +1 -1
- package/dist/v2/models/index.js +4 -4
- package/dist/v2/models/index.js.map +1 -1
- package/dist/v2/models/personalization.d.ts +44 -48
- package/dist/v2/models/personalization.d.ts.map +1 -1
- package/dist/v2/models/personalization.js.map +1 -1
- package/dist/v2/models/referentiel.d.ts +32 -50
- package/dist/v2/models/referentiel.d.ts.map +1 -1
- package/dist/v2/models/referentiel.js.map +1 -1
- package/dist/v2/models/savedFilter.d.ts +8 -17
- package/dist/v2/models/savedFilter.d.ts.map +1 -1
- package/dist/v2/models/savedFilter.js.map +1 -1
- package/dist/v2/patterns/ActionBar.js +152 -187
- package/dist/v2/patterns/ActionBar.js.map +1 -1
- package/dist/v2/patterns/AppMain.d.ts +109 -0
- package/dist/v2/patterns/AppMain.d.ts.map +1 -0
- package/dist/v2/patterns/AppMain.js +115 -0
- package/dist/v2/patterns/AppMain.js.map +1 -0
- package/dist/v2/patterns/BulkActionBar.js +40 -42
- package/dist/v2/patterns/BulkActionBar.js.map +1 -1
- package/dist/v2/patterns/ChartFigure.d.ts +124 -0
- package/dist/v2/patterns/ChartFigure.d.ts.map +1 -0
- package/dist/v2/patterns/ChartFigure.js +159 -0
- package/dist/v2/patterns/ChartFigure.js.map +1 -0
- package/dist/v2/patterns/CollapsibleDataGrid.js +138 -174
- package/dist/v2/patterns/CollapsibleDataGrid.js.map +1 -1
- package/dist/v2/patterns/ColumnsToggle.js +60 -94
- package/dist/v2/patterns/ColumnsToggle.js.map +1 -1
- package/dist/v2/patterns/DataGrid.d.ts.map +1 -1
- package/dist/v2/patterns/DataGrid.js +262 -297
- package/dist/v2/patterns/DataGrid.js.map +1 -1
- package/dist/v2/patterns/DataGridSettingsMenu.d.ts +12 -0
- package/dist/v2/patterns/DataGridSettingsMenu.d.ts.map +1 -1
- package/dist/v2/patterns/DataGridSettingsMenu.js +104 -121
- package/dist/v2/patterns/DataGridSettingsMenu.js.map +1 -1
- package/dist/v2/patterns/DataGridToolbar.js +103 -106
- package/dist/v2/patterns/DataGridToolbar.js.map +1 -1
- package/dist/v2/patterns/DataGridVirtualized.js +179 -217
- package/dist/v2/patterns/DataGridVirtualized.js.map +1 -1
- package/dist/v2/patterns/DeleteResourceConfirmDialog.js +32 -35
- package/dist/v2/patterns/DeleteResourceConfirmDialog.js.map +1 -1
- package/dist/v2/patterns/DetailSplit.d.ts +87 -0
- package/dist/v2/patterns/DetailSplit.d.ts.map +1 -0
- package/dist/v2/patterns/DetailSplit.js +116 -0
- package/dist/v2/patterns/DetailSplit.js.map +1 -0
- package/dist/v2/patterns/FavoriteColumn.js +22 -23
- package/dist/v2/patterns/FavoriteColumn.js.map +1 -1
- package/dist/v2/patterns/FavoritesFilter.js +36 -44
- package/dist/v2/patterns/FavoritesFilter.js.map +1 -1
- package/dist/v2/patterns/FilterTabBar.d.ts +28 -0
- package/dist/v2/patterns/FilterTabBar.d.ts.map +1 -0
- package/dist/v2/patterns/FilterTabBar.js +120 -0
- package/dist/v2/patterns/FilterTabBar.js.map +1 -0
- package/dist/v2/patterns/FormErrorSummary.js +20 -23
- package/dist/v2/patterns/FormErrorSummary.js.map +1 -1
- package/dist/v2/patterns/FormPageShell.js +53 -50
- package/dist/v2/patterns/FormPageShell.js.map +1 -1
- package/dist/v2/patterns/FormSection.d.ts +8 -3
- package/dist/v2/patterns/FormSection.d.ts.map +1 -1
- package/dist/v2/patterns/FormSection.js +44 -51
- package/dist/v2/patterns/FormSection.js.map +1 -1
- package/dist/v2/patterns/FormikCheckbox.js +36 -45
- package/dist/v2/patterns/FormikCheckbox.js.map +1 -1
- package/dist/v2/patterns/FormikCheckboxGroup.d.ts +17 -1
- package/dist/v2/patterns/FormikCheckboxGroup.d.ts.map +1 -1
- package/dist/v2/patterns/FormikCheckboxGroup.js +62 -65
- package/dist/v2/patterns/FormikCheckboxGroup.js.map +1 -1
- package/dist/v2/patterns/FormikCombobox.js +55 -72
- package/dist/v2/patterns/FormikCombobox.js.map +1 -1
- package/dist/v2/patterns/FormikDatePicker.js +50 -64
- package/dist/v2/patterns/FormikDatePicker.js.map +1 -1
- package/dist/v2/patterns/FormikDateTimePicker.js +50 -64
- package/dist/v2/patterns/FormikDateTimePicker.js.map +1 -1
- package/dist/v2/patterns/FormikErrorFocus.js +25 -26
- package/dist/v2/patterns/FormikErrorFocus.js.map +1 -1
- package/dist/v2/patterns/FormikErrorSummary.d.ts +74 -0
- package/dist/v2/patterns/FormikErrorSummary.d.ts.map +1 -0
- package/dist/v2/patterns/FormikErrorSummary.js +97 -0
- package/dist/v2/patterns/FormikErrorSummary.js.map +1 -0
- package/dist/v2/patterns/FormikFile.d.ts +14 -1
- package/dist/v2/patterns/FormikFile.d.ts.map +1 -1
- package/dist/v2/patterns/FormikFile.js +99 -83
- package/dist/v2/patterns/FormikFile.js.map +1 -1
- package/dist/v2/patterns/FormikInput.js +45 -58
- package/dist/v2/patterns/FormikInput.js.map +1 -1
- package/dist/v2/patterns/FormikRadioGroup.js +45 -56
- package/dist/v2/patterns/FormikRadioGroup.js.map +1 -1
- package/dist/v2/patterns/FormikReferentielField.d.ts +12 -1
- package/dist/v2/patterns/FormikReferentielField.d.ts.map +1 -1
- package/dist/v2/patterns/FormikReferentielField.js +54 -64
- package/dist/v2/patterns/FormikReferentielField.js.map +1 -1
- package/dist/v2/patterns/FormikSelect.js +70 -92
- package/dist/v2/patterns/FormikSelect.js.map +1 -1
- package/dist/v2/patterns/FormikTextarea.js +35 -51
- package/dist/v2/patterns/FormikTextarea.js.map +1 -1
- package/dist/v2/patterns/KeyboardShortcutsHelp.js +60 -80
- package/dist/v2/patterns/KeyboardShortcutsHelp.js.map +1 -1
- package/dist/v2/patterns/NetworkErrorBanner.js +13 -16
- package/dist/v2/patterns/NetworkErrorBanner.js.map +1 -1
- package/dist/v2/patterns/PageContent.js +17 -20
- package/dist/v2/patterns/PageContent.js.map +1 -1
- package/dist/v2/patterns/PreviewDrawer.d.ts +49 -0
- package/dist/v2/patterns/PreviewDrawer.d.ts.map +1 -0
- package/dist/v2/patterns/PreviewDrawer.js +159 -0
- package/dist/v2/patterns/PreviewDrawer.js.map +1 -0
- package/dist/v2/patterns/ReferentielField.d.ts +86 -2
- package/dist/v2/patterns/ReferentielField.d.ts.map +1 -1
- package/dist/v2/patterns/ReferentielField.js +347 -327
- package/dist/v2/patterns/ReferentielField.js.map +1 -1
- package/dist/v2/patterns/RowFavoriteToggle.d.ts +6 -0
- package/dist/v2/patterns/RowFavoriteToggle.d.ts.map +1 -1
- package/dist/v2/patterns/RowFavoriteToggle.js +38 -30
- package/dist/v2/patterns/RowFavoriteToggle.js.map +1 -1
- package/dist/v2/patterns/SaveFilterDialog.js +50 -77
- package/dist/v2/patterns/SaveFilterDialog.js.map +1 -1
- package/dist/v2/patterns/SavedFiltersMenu.js +89 -107
- package/dist/v2/patterns/SavedFiltersMenu.js.map +1 -1
- package/dist/v2/patterns/SkeletonPageShell.js +122 -143
- package/dist/v2/patterns/SkeletonPageShell.js.map +1 -1
- package/dist/v2/patterns/SortableHeader.js +35 -57
- package/dist/v2/patterns/SortableHeader.js.map +1 -1
- package/dist/v2/patterns/Tour.js +121 -142
- package/dist/v2/patterns/Tour.js.map +1 -1
- package/dist/v2/patterns/_dataGridShared.d.ts.map +1 -1
- package/dist/v2/patterns/_dataGridShared.js +131 -147
- package/dist/v2/patterns/_dataGridShared.js.map +1 -1
- package/dist/v2/patterns/_pickerSerialisation.js +9 -10
- package/dist/v2/patterns/_pickerSerialisation.js.map +1 -1
- package/dist/v2/patterns/_sort.js +17 -33
- package/dist/v2/patterns/_sort.js.map +1 -1
- package/dist/v2/patterns/_useColumnReorder.js +124 -163
- package/dist/v2/patterns/_useColumnReorder.js.map +1 -1
- package/dist/v2/patterns/_useColumnResize.js +80 -99
- package/dist/v2/patterns/_useColumnResize.js.map +1 -1
- package/dist/v2/patterns/filterCriteria.d.ts +78 -0
- package/dist/v2/patterns/filterCriteria.d.ts.map +1 -0
- package/dist/v2/patterns/filterCriteria.js +110 -0
- package/dist/v2/patterns/filterCriteria.js.map +1 -0
- package/dist/v2/patterns/index.d.ts +160 -0
- package/dist/v2/patterns/index.d.ts.map +1 -1
- package/dist/v2/patterns/index.js +157 -79
- package/dist/v2/patterns/index.js.map +1 -1
- package/dist/v2/patterns/rowActions.d.ts +150 -0
- package/dist/v2/patterns/rowActions.d.ts.map +1 -0
- package/dist/v2/patterns/rowActions.js +232 -0
- package/dist/v2/patterns/rowActions.js.map +1 -0
- package/dist/v2/personalization/PersonalizationProvider.d.ts.map +1 -1
- package/dist/v2/personalization/PersonalizationProvider.js +57 -53
- package/dist/v2/personalization/PersonalizationProvider.js.map +1 -1
- package/dist/v2/personalization/adapters/_storageKey.js +5 -5
- package/dist/v2/personalization/adapters/_storageKey.js.map +1 -1
- package/dist/v2/personalization/adapters/createLocalStorageAdapter.js +25 -24
- package/dist/v2/personalization/adapters/createLocalStorageAdapter.js.map +1 -1
- package/dist/v2/personalization/adapters/createMemoryAdapter.js +14 -14
- package/dist/v2/personalization/adapters/createMemoryAdapter.js.map +1 -1
- package/dist/v2/personalization/adapters/index.js +5 -5
- package/dist/v2/personalization/adapters/index.js.map +1 -1
- package/dist/v2/personalization/capabilities/favorites.js +39 -62
- package/dist/v2/personalization/capabilities/favorites.js.map +1 -1
- package/dist/v2/personalization/capabilities/favoritesView.js +25 -37
- package/dist/v2/personalization/capabilities/favoritesView.js.map +1 -1
- package/dist/v2/personalization/capabilities/gridPreferences.js +31 -36
- package/dist/v2/personalization/capabilities/gridPreferences.js.map +1 -1
- package/dist/v2/personalization/capabilities/index.js +12 -12
- package/dist/v2/personalization/capabilities/reviveSavedCriteria.d.ts +88 -0
- package/dist/v2/personalization/capabilities/reviveSavedCriteria.d.ts.map +1 -0
- package/dist/v2/personalization/capabilities/reviveSavedCriteria.js +126 -0
- package/dist/v2/personalization/capabilities/reviveSavedCriteria.js.map +1 -0
- package/dist/v2/personalization/capabilities/savedFilters.js +93 -100
- package/dist/v2/personalization/capabilities/savedFilters.js.map +1 -1
- package/dist/v2/personalization/createPersonalizationStore.d.ts.map +1 -1
- package/dist/v2/personalization/createPersonalizationStore.js +81 -182
- package/dist/v2/personalization/createPersonalizationStore.js.map +1 -1
- package/dist/v2/personalization/index.d.ts +16 -0
- package/dist/v2/personalization/index.d.ts.map +1 -1
- package/dist/v2/personalization/index.js +30 -23
- package/dist/v2/personalization/index.js.map +1 -1
- package/dist/v2/personalization/personalizationContext.js +10 -12
- package/dist/v2/personalization/personalizationContext.js.map +1 -1
- package/dist/v2/personalization/schema.js +8 -9
- package/dist/v2/personalization/schema.js.map +1 -1
- package/dist/v2/referentiel/ReferentielProvider.js +31 -45
- package/dist/v2/referentiel/ReferentielProvider.js.map +1 -1
- package/dist/v2/referentiel/index.js +11 -13
- package/dist/v2/referentiel/index.js.map +1 -1
- package/dist/v2/referentiel/types.d.ts +105 -0
- package/dist/v2/referentiel/types.d.ts.map +1 -0
- package/dist/v2/referentiel/types.js +6 -0
- package/dist/v2/referentiel/types.js.map +1 -0
- package/dist/v2/referentiel/useReferentielClient.js +13 -16
- package/dist/v2/referentiel/useReferentielClient.js.map +1 -1
- package/dist/v2/referentiel/useReferentielOptions.d.ts +7 -17
- package/dist/v2/referentiel/useReferentielOptions.d.ts.map +1 -1
- package/dist/v2/referentiel/useReferentielOptions.js +63 -120
- package/dist/v2/referentiel/useReferentielOptions.js.map +1 -1
- package/dist/v2/referentiel/useReferentielSearch.d.ts +7 -48
- package/dist/v2/referentiel/useReferentielSearch.d.ts.map +1 -1
- package/dist/v2/referentiel/useReferentielSearch.js +40 -95
- package/dist/v2/referentiel/useReferentielSearch.js.map +1 -1
- package/dist/v2/theme/_brand.js +12 -26
- package/dist/v2/theme/_brand.js.map +1 -1
- package/dist/v2/theme/_brandSecondary.js +12 -26
- package/dist/v2/theme/_brandSecondary.js.map +1 -1
- package/dist/v2/theme/createPortnetTheme.js +41 -49
- package/dist/v2/theme/createPortnetTheme.js.map +1 -1
- package/dist/v2/theme/cssVariables.d.ts +3 -3
- package/dist/v2/theme/cssVariables.d.ts.map +1 -1
- package/dist/v2/theme/cssVariables.js +65 -70
- package/dist/v2/theme/cssVariables.js.map +1 -1
- package/dist/v2/theme/index.js +10 -10
- package/dist/v2/theme/index.js.map +1 -1
- package/dist/v2/tokens/breakpoints.js +16 -16
- package/dist/v2/tokens/breakpoints.js.map +1 -1
- package/dist/v2/tokens/chart.d.ts +103 -0
- package/dist/v2/tokens/chart.d.ts.map +1 -0
- package/dist/v2/tokens/chart.js +270 -0
- package/dist/v2/tokens/chart.js.map +1 -0
- package/dist/v2/tokens/colors.js +24 -24
- package/dist/v2/tokens/colors.js.map +1 -1
- package/dist/v2/tokens/density.d.ts +104 -0
- package/dist/v2/tokens/density.d.ts.map +1 -1
- package/dist/v2/tokens/density.js +67 -12
- package/dist/v2/tokens/density.js.map +1 -1
- package/dist/v2/tokens/index.d.ts +50 -1
- package/dist/v2/tokens/index.d.ts.map +1 -1
- package/dist/v2/tokens/index.js +116 -68
- package/dist/v2/tokens/index.js.map +1 -1
- package/dist/v2/tokens/motion.js +16 -22
- package/dist/v2/tokens/motion.js.map +1 -1
- package/dist/v2/tokens/radius.js +3 -3
- package/dist/v2/tokens/radius.js.map +1 -1
- package/dist/v2/tokens/shadows.js +8 -8
- package/dist/v2/tokens/shadows.js.map +1 -1
- package/dist/v2/tokens/spacing.js +4 -4
- package/dist/v2/tokens/spacing.js.map +1 -1
- package/dist/v2/tokens/state.js +3 -3
- package/dist/v2/tokens/state.js.map +1 -1
- package/dist/v2/tokens/statusPalette.js +21 -23
- package/dist/v2/tokens/statusPalette.js.map +1 -1
- package/dist/v2/tokens/tokens.json +6 -1
- package/dist/v2/tokens/typography.js +15 -15
- package/dist/v2/tokens/typography.js.map +1 -1
- package/dist/v2/tokens/zIndex.js +3 -3
- package/dist/v2/tokens/zIndex.js.map +1 -1
- package/dist/v2/types/datagrid.d.ts +9 -1
- package/dist/v2/types/datagrid.d.ts.map +1 -1
- package/dist/v2/types/datagrid.js.map +1 -1
- package/dist/v2/types/index.js +2 -2
- package/dist/v2/types/index.js.map +1 -1
- package/dist/v2/utils/apiError.js +16 -37
- package/dist/v2/utils/apiError.js.map +1 -1
- package/dist/v2/utils/contrast.js +31 -32
- package/dist/v2/utils/contrast.js.map +1 -1
- package/dist/v2/utils/cx.js +7 -27
- package/dist/v2/utils/cx.js.map +1 -1
- package/dist/v2/utils/fileDownload.js +25 -28
- package/dist/v2/utils/fileDownload.js.map +1 -1
- package/dist/v2/utils/fileValidation.d.ts +116 -0
- package/dist/v2/utils/fileValidation.d.ts.map +1 -0
- package/dist/v2/utils/fileValidation.js +220 -0
- package/dist/v2/utils/fileValidation.js.map +1 -0
- package/dist/v2/utils/fmtDate.d.ts +103 -0
- package/dist/v2/utils/fmtDate.d.ts.map +1 -0
- package/dist/v2/utils/fmtDate.js +119 -0
- package/dist/v2/utils/fmtDate.js.map +1 -0
- package/dist/v2/utils/fmtMoney.d.ts +3 -3
- package/dist/v2/utils/fmtMoney.d.ts.map +1 -1
- package/dist/v2/utils/fmtMoney.js +9 -11
- package/dist/v2/utils/fmtMoney.js.map +1 -1
- package/dist/v2/utils/formikErrors.d.ts +67 -0
- package/dist/v2/utils/formikErrors.d.ts.map +1 -0
- package/dist/v2/utils/formikErrors.js +85 -0
- package/dist/v2/utils/formikErrors.js.map +1 -0
- package/dist/v2/utils/index.d.ts +5 -0
- package/dist/v2/utils/index.d.ts.map +1 -1
- package/dist/v2/utils/index.js +67 -18
- package/dist/v2/utils/index.js.map +1 -1
- package/dist/v2/utils/mergeLabels.js +9 -14
- package/dist/v2/utils/mergeLabels.js.map +1 -1
- package/dist/v2/utils/networkStatus.js +14 -14
- package/dist/v2/utils/networkStatus.js.map +1 -1
- package/package.json +26 -9
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports.default = fmtMoney;
|
|
7
7
|
/**
|
|
8
8
|
* fmtMoney — format a number with locale-aware grouping.
|
|
9
9
|
*
|
|
@@ -52,33 +52,31 @@ exports["default"] = fmtMoney;
|
|
|
52
52
|
* an unmatched-but-valid tag negotiates down to fr-FR instead of to the host.
|
|
53
53
|
* The `try/catch` is still required for genuinely malformed input.
|
|
54
54
|
*/
|
|
55
|
-
|
|
56
|
-
function fmtMoney(n) {
|
|
57
|
-
var currency = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
58
|
-
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
55
|
+
const FALLBACK_LOCALE = "fr-FR";
|
|
56
|
+
function fmtMoney(n, currency = "", opts = {}) {
|
|
59
57
|
if (n == null || n === "") return "—";
|
|
60
|
-
|
|
58
|
+
const num = typeof n === "number" ? n : Number(n);
|
|
61
59
|
if (!Number.isFinite(num)) return "—";
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
const locale = opts.locale || FALLBACK_LOCALE;
|
|
61
|
+
const formatOpts = {};
|
|
64
62
|
if (opts.minimumFractionDigits != null) {
|
|
65
63
|
formatOpts.minimumFractionDigits = opts.minimumFractionDigits;
|
|
66
64
|
}
|
|
67
65
|
if (opts.maximumFractionDigits != null) {
|
|
68
66
|
formatOpts.maximumFractionDigits = opts.maximumFractionDigits;
|
|
69
67
|
}
|
|
70
|
-
|
|
68
|
+
let formatted;
|
|
71
69
|
try {
|
|
72
70
|
/* Requested locale first, fr-FR as the declared next preference — see
|
|
73
71
|
* FALLBACK_LOCALE. A resolvable request ("en-US") still wins outright; an
|
|
74
72
|
* unmatched-but-well-formed tag lands on fr-FR rather than on the host's
|
|
75
73
|
* default locale. */
|
|
76
74
|
formatted = new Intl.NumberFormat([locale, FALLBACK_LOCALE], formatOpts).format(num);
|
|
77
|
-
} catch
|
|
75
|
+
} catch {
|
|
78
76
|
/* Reached only for a STRUCTURALLY invalid tag (RangeError) or a non-string
|
|
79
77
|
* value from an untyped host — negotiation cannot help there. */
|
|
80
78
|
formatted = new Intl.NumberFormat(FALLBACK_LOCALE, formatOpts).format(num);
|
|
81
79
|
}
|
|
82
|
-
return currency ?
|
|
80
|
+
return currency ? `${formatted} ${currency}` : formatted;
|
|
83
81
|
}
|
|
84
82
|
//# sourceMappingURL=fmtMoney.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fmtMoney.js","names":["FALLBACK_LOCALE","fmtMoney","n","currency","
|
|
1
|
+
{"version":3,"file":"fmtMoney.js","names":["FALLBACK_LOCALE","fmtMoney","n","currency","opts","num","Number","isFinite","locale","formatOpts","minimumFractionDigits","maximumFractionDigits","formatted","Intl","NumberFormat","format"],"sources":["../../../src/lib/v2/utils/fmtMoney.ts"],"sourcesContent":["/**\r\n * fmtMoney — format a number with locale-aware grouping.\r\n *\r\n * Returns \"—\" for null / empty / non-finite inputs (graceful empty\r\n * cells in tables — never \"NaN\" or \"∞\").\r\n *\r\n * Defaults to \"fr-FR\" for back-compat with v1 callers; pass `locale`\r\n * (BCP-47 tag) to format under any locale supported by the runtime\r\n * Intl.NumberFormat. Currency placement is a trailing suffix in the\r\n * locale-formatted number; future evolution toward `style:\"currency\"`\r\n * (locale-correct symbol position, proper RTL handling) is deliberately\r\n * deferred to avoid breaking consumers that grep on the suffix.\r\n *\r\n * fmtMoney(1234567.5) → \"1 234 567,5\"\r\n * fmtMoney(1234567.5, \"EUR\") → \"1 234 567,5 EUR\"\r\n * fmtMoney(1234567.5, \"EUR\", { locale: \"en-US\" }) → \"1,234,567.5 EUR\"\r\n * fmtMoney(1234.5, \"\", { minimumFractionDigits: 2 })\r\n * → \"1 234,50\"\r\n * fmtMoney(null) / fmtMoney(\"abc\") / fmtMoney(Infinity) → \"—\"\r\n */\r\ntype FmtMoneyOptions = {\r\n locale?: string | undefined;\r\n minimumFractionDigits?: number | undefined;\r\n maximumFractionDigits?: number | undefined;\r\n};\r\n\r\n/**\r\n * The locale every unresolvable request falls back to.\r\n *\r\n * ── WHY THIS IS NEGOTIATED, NOT JUST CAUGHT ─────────────────────────────\r\n *\r\n * The previous implementation relied ONLY on `try/catch`, on the assumption that\r\n * an unusable locale throws `RangeError`. It does not — and the gap was a live\r\n * defect, not a theoretical one:\r\n *\r\n * `Intl.NumberFormat` throws only on a STRUCTURALLY INVALID tag. A tag that is\r\n * well-formed but has no data does NOT throw — it negotiates, and with a single\r\n * unmatched tag the negotiation lands on the RUNTIME DEFAULT LOCALE.\r\n *\r\n * `\"not-a-real-locale\"` is well-formed: `not` parses as a 3-letter language\r\n * subtag and `-a-real-locale` as a singleton `a` extension sequence. So it never\r\n * threw, the `catch` never ran, and the result was formatted in whatever locale\r\n * the host happened to default to. On a German or Spanish host that renders\r\n * `\"1.234,5\"` — dot grouping — inside a French application.\r\n *\r\n * That is a real consistency breach (Charter §09: a French UI formats numbers in\r\n * French), and it is invisible on a French dev machine, which is exactly why it\r\n * survived: the unit test caught it only because CI ran under a non-FR default.\r\n *\r\n * Listing the fallback as the SECOND preference makes the guarantee explicit:\r\n * an unmatched-but-valid tag negotiates down to fr-FR instead of to the host.\r\n * The `try/catch` is still required for genuinely malformed input.\r\n */\r\nconst FALLBACK_LOCALE = \"fr-FR\";\r\n\r\nexport default function fmtMoney(\r\n n: number | string | null | undefined,\r\n currency: string = \"\",\r\n opts: FmtMoneyOptions = {}\r\n): string {\r\n if (n == null || n === \"\") return \"—\";\r\n const num = typeof n === \"number\" ? n : Number(n);\r\n if (!Number.isFinite(num)) return \"—\";\r\n\r\n const locale = opts.locale || FALLBACK_LOCALE;\r\n\r\n const formatOpts: Intl.NumberFormatOptions = {};\r\n if (opts.minimumFractionDigits != null) {\r\n formatOpts.minimumFractionDigits = opts.minimumFractionDigits;\r\n }\r\n if (opts.maximumFractionDigits != null) {\r\n formatOpts.maximumFractionDigits = opts.maximumFractionDigits;\r\n }\r\n\r\n let formatted: string;\r\n try {\r\n /* Requested locale first, fr-FR as the declared next preference — see\r\n * FALLBACK_LOCALE. A resolvable request (\"en-US\") still wins outright; an\r\n * unmatched-but-well-formed tag lands on fr-FR rather than on the host's\r\n * default locale. */\r\n formatted = new Intl.NumberFormat(\r\n [locale, FALLBACK_LOCALE],\r\n formatOpts\r\n ).format(num);\r\n } catch {\r\n /* Reached only for a STRUCTURALLY invalid tag (RangeError) or a non-string\r\n * value from an untyped host — negotiation cannot help there. */\r\n formatted = new Intl.NumberFormat(FALLBACK_LOCALE, formatOpts).format(num);\r\n }\r\n\r\n return currency ? `${formatted} ${currency}` : formatted;\r\n}\r\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;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,MAAMA,eAAe,GAAG,OAAO;AAEhB,SAASC,QAAQA,CAC9BC,CAAqC,EACrCC,QAAgB,GAAG,EAAE,EACrBC,IAAqB,GAAG,CAAC,CAAC,EAClB;EACR,IAAIF,CAAC,IAAI,IAAI,IAAIA,CAAC,KAAK,EAAE,EAAE,OAAO,GAAG;EACrC,MAAMG,GAAG,GAAG,OAAOH,CAAC,KAAK,QAAQ,GAAGA,CAAC,GAAGI,MAAM,CAACJ,CAAC,CAAC;EACjD,IAAI,CAACI,MAAM,CAACC,QAAQ,CAACF,GAAG,CAAC,EAAE,OAAO,GAAG;EAErC,MAAMG,MAAM,GAAGJ,IAAI,CAACI,MAAM,IAAIR,eAAe;EAE7C,MAAMS,UAAoC,GAAG,CAAC,CAAC;EAC/C,IAAIL,IAAI,CAACM,qBAAqB,IAAI,IAAI,EAAE;IACtCD,UAAU,CAACC,qBAAqB,GAAGN,IAAI,CAACM,qBAAqB;EAC/D;EACA,IAAIN,IAAI,CAACO,qBAAqB,IAAI,IAAI,EAAE;IACtCF,UAAU,CAACE,qBAAqB,GAAGP,IAAI,CAACO,qBAAqB;EAC/D;EAEA,IAAIC,SAAiB;EACrB,IAAI;IACF;AACJ;AACA;AACA;IACIA,SAAS,GAAG,IAAIC,IAAI,CAACC,YAAY,CAC/B,CAACN,MAAM,EAAER,eAAe,CAAC,EACzBS,UACF,CAAC,CAACM,MAAM,CAACV,GAAG,CAAC;EACf,CAAC,CAAC,MAAM;IACN;AACJ;IACIO,SAAS,GAAG,IAAIC,IAAI,CAACC,YAAY,CAACd,eAAe,EAAES,UAAU,CAAC,CAACM,MAAM,CAACV,GAAG,CAAC;EAC5E;EAEA,OAAOF,QAAQ,GAAG,GAAGS,SAAS,IAAIT,QAAQ,EAAE,GAAGS,SAAS;AAC1D","ignoreList":[]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { FormErrorSummaryError } from "../patterns/FormErrorSummary";
|
|
2
|
+
/**
|
|
3
|
+
* flattenFormikErrors — Formik's nested `errors` → the flat list
|
|
4
|
+
* `FormErrorSummary` consumes (capability gap G-38).
|
|
5
|
+
*
|
|
6
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
7
|
+
* WHY THIS BELONGS IN THE LIBRARY
|
|
8
|
+
*
|
|
9
|
+
* The library already owns BOTH ends of the failed-submit recipe that R-FV.2
|
|
10
|
+
* and R-FV.3 make mandatory:
|
|
11
|
+
*
|
|
12
|
+
* · `FormErrorSummary` — the banner at the top of the form, whose items are
|
|
13
|
+
* `{ name, message }` and whose `onItemClick` hands
|
|
14
|
+
* back the field NAME;
|
|
15
|
+
* · `FormikErrorFocus` / `focusFieldByName` — the counterpart that moves
|
|
16
|
+
* focus, resolving that same name as `[name="…"]`.
|
|
17
|
+
*
|
|
18
|
+
* What it never shipped is the step between them. Formik's `errors` mirrors the
|
|
19
|
+
* shape of `values` — a nested object whose leaves are message strings — and
|
|
20
|
+
* nothing in the library turned that tree into the flat list both ends speak.
|
|
21
|
+
* So every Formik host wrote the recursion itself, which is a duplication the
|
|
22
|
+
* Platform TypeScript Guidelines forbid outright, and which the library invited
|
|
23
|
+
* by publishing the type (`FormErrorSummaryError`) without the one function
|
|
24
|
+
* that produces it.
|
|
25
|
+
*
|
|
26
|
+
* >>> THE FAILURE MODE IS THE PATH, AND IT IS INVISIBLE TO REVIEW. Every
|
|
27
|
+
* >>> re-implementation gets `{ name, message }` right and the ACCUMULATED PATH
|
|
28
|
+
* >>> subtly wrong — a missing separator, a skipped array index, a `[0]`
|
|
29
|
+
* >>> written where Formik writes `.0`. Nothing throws. The banner renders,
|
|
30
|
+
* >>> lists the right messages, and its jump button targets a field that does
|
|
31
|
+
* >>> not exist: `focusFieldByName` finds no node and the click does nothing.
|
|
32
|
+
* >>> A user staring at a rejected form clicks the one affordance offered to
|
|
33
|
+
* >>> find the offending field, and it silently fails.
|
|
34
|
+
* >>>
|
|
35
|
+
* >>> Promoted from `refonte-frontend` (Area 5), where it had already been
|
|
36
|
+
* >>> extracted once — out of a single page and into module-common — for
|
|
37
|
+
* >>> exactly this reason, when a second form needed it. The next module along
|
|
38
|
+
* >>> would have been the third copy. <<<
|
|
39
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
40
|
+
*
|
|
41
|
+
* ARRAY ERRORS ARE TRAVERSED AS OBJECTS, DELIBERATELY. `Yup.array()` produces
|
|
42
|
+
* errors keyed by index, so the path becomes `beneficiaires.0.nom` — dot,
|
|
43
|
+
* not bracket. That is the form Formik itself produces and therefore the form
|
|
44
|
+
* the corresponding field's `name` attribute carries, which is what makes the
|
|
45
|
+
* path usable by `focusFieldByName` and by `setFieldValue` alike. Rewriting it
|
|
46
|
+
* as `beneficiaires[0].nom` would read more naturally and match nothing.
|
|
47
|
+
*
|
|
48
|
+
* Non-string leaves that are not objects (a `false`, a `null` left by a custom
|
|
49
|
+
* validator) yield nothing rather than an item with an empty message: a summary
|
|
50
|
+
* line with no text is worse than one line fewer, since it is clickable, blank,
|
|
51
|
+
* and lists no reason.
|
|
52
|
+
*
|
|
53
|
+
* Usage:
|
|
54
|
+
*
|
|
55
|
+
* <FormErrorSummary
|
|
56
|
+
* errors={flattenFormikErrors(formik.errors)}
|
|
57
|
+
* onItemClick={focusFieldByName}
|
|
58
|
+
* />
|
|
59
|
+
*
|
|
60
|
+
* The `FormErrorSummaryError` import is TYPE-ONLY and therefore erased at
|
|
61
|
+
* build time: this util does not depend on ./patterns at runtime, and the
|
|
62
|
+
* item shape keeps a single declaration next to the component that renders it
|
|
63
|
+
* rather than being restated here.
|
|
64
|
+
*/
|
|
65
|
+
export declare function flattenFormikErrors(errors: unknown, prefix?: string): FormErrorSummaryError[];
|
|
66
|
+
export default flattenFormikErrors;
|
|
67
|
+
//# sourceMappingURL=formikErrors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formikErrors.d.ts","sourceRoot":"","sources":["../../../src/lib/v2/utils/formikErrors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,OAAO,EACf,MAAM,SAAK,GACV,qBAAqB,EAAE,CAWzB;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
exports.flattenFormikErrors = flattenFormikErrors;
|
|
8
|
+
/**
|
|
9
|
+
* flattenFormikErrors — Formik's nested `errors` → the flat list
|
|
10
|
+
* `FormErrorSummary` consumes (capability gap G-38).
|
|
11
|
+
*
|
|
12
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
13
|
+
* WHY THIS BELONGS IN THE LIBRARY
|
|
14
|
+
*
|
|
15
|
+
* The library already owns BOTH ends of the failed-submit recipe that R-FV.2
|
|
16
|
+
* and R-FV.3 make mandatory:
|
|
17
|
+
*
|
|
18
|
+
* · `FormErrorSummary` — the banner at the top of the form, whose items are
|
|
19
|
+
* `{ name, message }` and whose `onItemClick` hands
|
|
20
|
+
* back the field NAME;
|
|
21
|
+
* · `FormikErrorFocus` / `focusFieldByName` — the counterpart that moves
|
|
22
|
+
* focus, resolving that same name as `[name="…"]`.
|
|
23
|
+
*
|
|
24
|
+
* What it never shipped is the step between them. Formik's `errors` mirrors the
|
|
25
|
+
* shape of `values` — a nested object whose leaves are message strings — and
|
|
26
|
+
* nothing in the library turned that tree into the flat list both ends speak.
|
|
27
|
+
* So every Formik host wrote the recursion itself, which is a duplication the
|
|
28
|
+
* Platform TypeScript Guidelines forbid outright, and which the library invited
|
|
29
|
+
* by publishing the type (`FormErrorSummaryError`) without the one function
|
|
30
|
+
* that produces it.
|
|
31
|
+
*
|
|
32
|
+
* >>> THE FAILURE MODE IS THE PATH, AND IT IS INVISIBLE TO REVIEW. Every
|
|
33
|
+
* >>> re-implementation gets `{ name, message }` right and the ACCUMULATED PATH
|
|
34
|
+
* >>> subtly wrong — a missing separator, a skipped array index, a `[0]`
|
|
35
|
+
* >>> written where Formik writes `.0`. Nothing throws. The banner renders,
|
|
36
|
+
* >>> lists the right messages, and its jump button targets a field that does
|
|
37
|
+
* >>> not exist: `focusFieldByName` finds no node and the click does nothing.
|
|
38
|
+
* >>> A user staring at a rejected form clicks the one affordance offered to
|
|
39
|
+
* >>> find the offending field, and it silently fails.
|
|
40
|
+
* >>>
|
|
41
|
+
* >>> Promoted from `refonte-frontend` (Area 5), where it had already been
|
|
42
|
+
* >>> extracted once — out of a single page and into module-common — for
|
|
43
|
+
* >>> exactly this reason, when a second form needed it. The next module along
|
|
44
|
+
* >>> would have been the third copy. <<<
|
|
45
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
46
|
+
*
|
|
47
|
+
* ARRAY ERRORS ARE TRAVERSED AS OBJECTS, DELIBERATELY. `Yup.array()` produces
|
|
48
|
+
* errors keyed by index, so the path becomes `beneficiaires.0.nom` — dot,
|
|
49
|
+
* not bracket. That is the form Formik itself produces and therefore the form
|
|
50
|
+
* the corresponding field's `name` attribute carries, which is what makes the
|
|
51
|
+
* path usable by `focusFieldByName` and by `setFieldValue` alike. Rewriting it
|
|
52
|
+
* as `beneficiaires[0].nom` would read more naturally and match nothing.
|
|
53
|
+
*
|
|
54
|
+
* Non-string leaves that are not objects (a `false`, a `null` left by a custom
|
|
55
|
+
* validator) yield nothing rather than an item with an empty message: a summary
|
|
56
|
+
* line with no text is worse than one line fewer, since it is clickable, blank,
|
|
57
|
+
* and lists no reason.
|
|
58
|
+
*
|
|
59
|
+
* Usage:
|
|
60
|
+
*
|
|
61
|
+
* <FormErrorSummary
|
|
62
|
+
* errors={flattenFormikErrors(formik.errors)}
|
|
63
|
+
* onItemClick={focusFieldByName}
|
|
64
|
+
* />
|
|
65
|
+
*
|
|
66
|
+
* The `FormErrorSummaryError` import is TYPE-ONLY and therefore erased at
|
|
67
|
+
* build time: this util does not depend on ./patterns at runtime, and the
|
|
68
|
+
* item shape keeps a single declaration next to the component that renders it
|
|
69
|
+
* rather than being restated here.
|
|
70
|
+
*/
|
|
71
|
+
function flattenFormikErrors(errors, prefix = "") {
|
|
72
|
+
if (!errors || typeof errors !== "object") return [];
|
|
73
|
+
return Object.entries(errors).flatMap(([key, value]) => {
|
|
74
|
+
const path = prefix ? `${prefix}.${key}` : key;
|
|
75
|
+
if (typeof value === "string") {
|
|
76
|
+
return value.length > 0 ? [{
|
|
77
|
+
name: path,
|
|
78
|
+
message: value
|
|
79
|
+
}] : [];
|
|
80
|
+
}
|
|
81
|
+
return flattenFormikErrors(value, path);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
var _default = exports.default = flattenFormikErrors;
|
|
85
|
+
//# sourceMappingURL=formikErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formikErrors.js","names":["flattenFormikErrors","errors","prefix","Object","entries","flatMap","key","value","path","length","name","message","_default","exports","default"],"sources":["../../../src/lib/v2/utils/formikErrors.ts"],"sourcesContent":["import type { FormErrorSummaryError } from \"../patterns/FormErrorSummary\";\r\n\r\n/**\r\n * flattenFormikErrors — Formik's nested `errors` → the flat list\r\n * `FormErrorSummary` consumes (capability gap G-38).\r\n *\r\n * ─────────────────────────────────────────────────────────────────────────────\r\n * WHY THIS BELONGS IN THE LIBRARY\r\n *\r\n * The library already owns BOTH ends of the failed-submit recipe that R-FV.2\r\n * and R-FV.3 make mandatory:\r\n *\r\n * · `FormErrorSummary` — the banner at the top of the form, whose items are\r\n * `{ name, message }` and whose `onItemClick` hands\r\n * back the field NAME;\r\n * · `FormikErrorFocus` / `focusFieldByName` — the counterpart that moves\r\n * focus, resolving that same name as `[name=\"…\"]`.\r\n *\r\n * What it never shipped is the step between them. Formik's `errors` mirrors the\r\n * shape of `values` — a nested object whose leaves are message strings — and\r\n * nothing in the library turned that tree into the flat list both ends speak.\r\n * So every Formik host wrote the recursion itself, which is a duplication the\r\n * Platform TypeScript Guidelines forbid outright, and which the library invited\r\n * by publishing the type (`FormErrorSummaryError`) without the one function\r\n * that produces it.\r\n *\r\n * >>> THE FAILURE MODE IS THE PATH, AND IT IS INVISIBLE TO REVIEW. Every\r\n * >>> re-implementation gets `{ name, message }` right and the ACCUMULATED PATH\r\n * >>> subtly wrong — a missing separator, a skipped array index, a `[0]`\r\n * >>> written where Formik writes `.0`. Nothing throws. The banner renders,\r\n * >>> lists the right messages, and its jump button targets a field that does\r\n * >>> not exist: `focusFieldByName` finds no node and the click does nothing.\r\n * >>> A user staring at a rejected form clicks the one affordance offered to\r\n * >>> find the offending field, and it silently fails.\r\n * >>>\r\n * >>> Promoted from `refonte-frontend` (Area 5), where it had already been\r\n * >>> extracted once — out of a single page and into module-common — for\r\n * >>> exactly this reason, when a second form needed it. The next module along\r\n * >>> would have been the third copy. <<<\r\n * ─────────────────────────────────────────────────────────────────────────────\r\n *\r\n * ARRAY ERRORS ARE TRAVERSED AS OBJECTS, DELIBERATELY. `Yup.array()` produces\r\n * errors keyed by index, so the path becomes `beneficiaires.0.nom` — dot,\r\n * not bracket. That is the form Formik itself produces and therefore the form\r\n * the corresponding field's `name` attribute carries, which is what makes the\r\n * path usable by `focusFieldByName` and by `setFieldValue` alike. Rewriting it\r\n * as `beneficiaires[0].nom` would read more naturally and match nothing.\r\n *\r\n * Non-string leaves that are not objects (a `false`, a `null` left by a custom\r\n * validator) yield nothing rather than an item with an empty message: a summary\r\n * line with no text is worse than one line fewer, since it is clickable, blank,\r\n * and lists no reason.\r\n *\r\n * Usage:\r\n *\r\n * <FormErrorSummary\r\n * errors={flattenFormikErrors(formik.errors)}\r\n * onItemClick={focusFieldByName}\r\n * />\r\n *\r\n * The `FormErrorSummaryError` import is TYPE-ONLY and therefore erased at\r\n * build time: this util does not depend on ./patterns at runtime, and the\r\n * item shape keeps a single declaration next to the component that renders it\r\n * rather than being restated here.\r\n */\r\nexport function flattenFormikErrors(\r\n errors: unknown,\r\n prefix = \"\"\r\n): FormErrorSummaryError[] {\r\n if (!errors || typeof errors !== \"object\") return [];\r\n return Object.entries(errors as Record<string, unknown>).flatMap(\r\n ([key, value]) => {\r\n const path = prefix ? `${prefix}.${key}` : key;\r\n if (typeof value === \"string\") {\r\n return value.length > 0 ? [{ name: path, message: value }] : [];\r\n }\r\n return flattenFormikErrors(value, path);\r\n }\r\n );\r\n}\r\n\r\nexport default flattenFormikErrors;\r\n"],"mappings":";;;;;;;AAEA;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;AACO,SAASA,mBAAmBA,CACjCC,MAAe,EACfC,MAAM,GAAG,EAAE,EACc;EACzB,IAAI,CAACD,MAAM,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE,OAAO,EAAE;EACpD,OAAOE,MAAM,CAACC,OAAO,CAACH,MAAiC,CAAC,CAACI,OAAO,CAC9D,CAAC,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK;IAChB,MAAMC,IAAI,GAAGN,MAAM,GAAG,GAAGA,MAAM,IAAII,GAAG,EAAE,GAAGA,GAAG;IAC9C,IAAI,OAAOC,KAAK,KAAK,QAAQ,EAAE;MAC7B,OAAOA,KAAK,CAACE,MAAM,GAAG,CAAC,GAAG,CAAC;QAAEC,IAAI,EAAEF,IAAI;QAAEG,OAAO,EAAEJ;MAAM,CAAC,CAAC,GAAG,EAAE;IACjE;IACA,OAAOP,mBAAmB,CAACO,KAAK,EAAEC,IAAI,CAAC;EACzC,CACF,CAAC;AACH;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcd,mBAAmB","ignoreList":[]}
|
package/dist/v2/utils/index.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
export { cx } from "./cx";
|
|
2
2
|
export { default as fmtMoney } from "./fmtMoney";
|
|
3
|
+
export { fmtDate, fmtDateTime } from "./fmtDate";
|
|
4
|
+
export type { FmtDateInput, FmtDateOptions } from "./fmtDate";
|
|
3
5
|
export { mergeLabels } from "./mergeLabels";
|
|
4
6
|
export { downloadBase64File, getMimeType, openBase64FileInTab, downloadBlobFile, } from "./fileDownload";
|
|
7
|
+
export { isForbiddenExecutable, isAcceptedFile, getFileRejection, describeAcceptedTypes, toAcceptAttribute, } from "./fileValidation";
|
|
8
|
+
export type { FileAcceptPolicy, FileRejection, FileRejectionReason, } from "./fileValidation";
|
|
5
9
|
export * as contrast from "./contrast";
|
|
6
10
|
export { getApiErrorMessage, getApiErrorDetail, getApiErrorStatus, DEFAULT_API_ERROR_MESSAGE, } from "./apiError";
|
|
7
11
|
export { networkStatus, createNetworkStatus } from "./networkStatus";
|
|
8
12
|
export type { NetworkStatus, NetworkStatusListener } from "./networkStatus";
|
|
13
|
+
export { flattenFormikErrors } from "./formikErrors";
|
|
9
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/v2/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAuB,MAAM,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/v2/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAuB,MAAM,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AAcjD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACjD,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAS9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAYxB,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAO1B,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AAavC,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACrE,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAS5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/v2/utils/index.js
CHANGED
|
@@ -1,97 +1,146 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
Object.defineProperty(exports, "DEFAULT_API_ERROR_MESSAGE", {
|
|
8
7
|
enumerable: true,
|
|
9
|
-
get: function
|
|
8
|
+
get: function () {
|
|
10
9
|
return _apiError.DEFAULT_API_ERROR_MESSAGE;
|
|
11
10
|
}
|
|
12
11
|
});
|
|
13
12
|
exports.contrast = void 0;
|
|
14
13
|
Object.defineProperty(exports, "createNetworkStatus", {
|
|
15
14
|
enumerable: true,
|
|
16
|
-
get: function
|
|
15
|
+
get: function () {
|
|
17
16
|
return _networkStatus.createNetworkStatus;
|
|
18
17
|
}
|
|
19
18
|
});
|
|
20
19
|
Object.defineProperty(exports, "cx", {
|
|
21
20
|
enumerable: true,
|
|
22
|
-
get: function
|
|
21
|
+
get: function () {
|
|
23
22
|
return _cx.cx;
|
|
24
23
|
}
|
|
25
24
|
});
|
|
25
|
+
Object.defineProperty(exports, "describeAcceptedTypes", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _fileValidation.describeAcceptedTypes;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
26
31
|
Object.defineProperty(exports, "downloadBase64File", {
|
|
27
32
|
enumerable: true,
|
|
28
|
-
get: function
|
|
33
|
+
get: function () {
|
|
29
34
|
return _fileDownload.downloadBase64File;
|
|
30
35
|
}
|
|
31
36
|
});
|
|
32
37
|
Object.defineProperty(exports, "downloadBlobFile", {
|
|
33
38
|
enumerable: true,
|
|
34
|
-
get: function
|
|
39
|
+
get: function () {
|
|
35
40
|
return _fileDownload.downloadBlobFile;
|
|
36
41
|
}
|
|
37
42
|
});
|
|
43
|
+
Object.defineProperty(exports, "flattenFormikErrors", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _formikErrors.flattenFormikErrors;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "fmtDate", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () {
|
|
52
|
+
return _fmtDate.fmtDate;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "fmtDateTime", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () {
|
|
58
|
+
return _fmtDate.fmtDateTime;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
38
61
|
Object.defineProperty(exports, "fmtMoney", {
|
|
39
62
|
enumerable: true,
|
|
40
|
-
get: function
|
|
41
|
-
return _fmtMoney
|
|
63
|
+
get: function () {
|
|
64
|
+
return _fmtMoney.default;
|
|
42
65
|
}
|
|
43
66
|
});
|
|
44
67
|
Object.defineProperty(exports, "getApiErrorDetail", {
|
|
45
68
|
enumerable: true,
|
|
46
|
-
get: function
|
|
69
|
+
get: function () {
|
|
47
70
|
return _apiError.getApiErrorDetail;
|
|
48
71
|
}
|
|
49
72
|
});
|
|
50
73
|
Object.defineProperty(exports, "getApiErrorMessage", {
|
|
51
74
|
enumerable: true,
|
|
52
|
-
get: function
|
|
75
|
+
get: function () {
|
|
53
76
|
return _apiError.getApiErrorMessage;
|
|
54
77
|
}
|
|
55
78
|
});
|
|
56
79
|
Object.defineProperty(exports, "getApiErrorStatus", {
|
|
57
80
|
enumerable: true,
|
|
58
|
-
get: function
|
|
81
|
+
get: function () {
|
|
59
82
|
return _apiError.getApiErrorStatus;
|
|
60
83
|
}
|
|
61
84
|
});
|
|
85
|
+
Object.defineProperty(exports, "getFileRejection", {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function () {
|
|
88
|
+
return _fileValidation.getFileRejection;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
62
91
|
Object.defineProperty(exports, "getMimeType", {
|
|
63
92
|
enumerable: true,
|
|
64
|
-
get: function
|
|
93
|
+
get: function () {
|
|
65
94
|
return _fileDownload.getMimeType;
|
|
66
95
|
}
|
|
67
96
|
});
|
|
97
|
+
Object.defineProperty(exports, "isAcceptedFile", {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
get: function () {
|
|
100
|
+
return _fileValidation.isAcceptedFile;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
Object.defineProperty(exports, "isForbiddenExecutable", {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function () {
|
|
106
|
+
return _fileValidation.isForbiddenExecutable;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
68
109
|
Object.defineProperty(exports, "mergeLabels", {
|
|
69
110
|
enumerable: true,
|
|
70
|
-
get: function
|
|
111
|
+
get: function () {
|
|
71
112
|
return _mergeLabels.mergeLabels;
|
|
72
113
|
}
|
|
73
114
|
});
|
|
74
115
|
Object.defineProperty(exports, "networkStatus", {
|
|
75
116
|
enumerable: true,
|
|
76
|
-
get: function
|
|
117
|
+
get: function () {
|
|
77
118
|
return _networkStatus.networkStatus;
|
|
78
119
|
}
|
|
79
120
|
});
|
|
80
121
|
Object.defineProperty(exports, "openBase64FileInTab", {
|
|
81
122
|
enumerable: true,
|
|
82
|
-
get: function
|
|
123
|
+
get: function () {
|
|
83
124
|
return _fileDownload.openBase64FileInTab;
|
|
84
125
|
}
|
|
85
126
|
});
|
|
127
|
+
Object.defineProperty(exports, "toAcceptAttribute", {
|
|
128
|
+
enumerable: true,
|
|
129
|
+
get: function () {
|
|
130
|
+
return _fileValidation.toAcceptAttribute;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
86
133
|
var _cx = require("./cx");
|
|
87
134
|
var _fmtMoney = _interopRequireDefault(require("./fmtMoney"));
|
|
135
|
+
var _fmtDate = require("./fmtDate");
|
|
88
136
|
var _mergeLabels = require("./mergeLabels");
|
|
89
137
|
var _fileDownload = require("./fileDownload");
|
|
138
|
+
var _fileValidation = require("./fileValidation");
|
|
90
139
|
var _contrast = _interopRequireWildcard(require("./contrast"));
|
|
91
140
|
exports.contrast = _contrast;
|
|
92
141
|
var _apiError = require("./apiError");
|
|
93
142
|
var _networkStatus = require("./networkStatus");
|
|
94
|
-
|
|
95
|
-
function _interopRequireWildcard(
|
|
96
|
-
function _interopRequireDefault(
|
|
143
|
+
var _formikErrors = require("./formikErrors");
|
|
144
|
+
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); }
|
|
145
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
97
146
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_cx","require","_fmtMoney","_interopRequireDefault","_mergeLabels","_fileDownload","_contrast","_interopRequireWildcard","exports","contrast","_apiError","_networkStatus","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_cx","require","_fmtMoney","_interopRequireDefault","_fmtDate","_mergeLabels","_fileDownload","_fileValidation","_contrast","_interopRequireWildcard","exports","contrast","_apiError","_networkStatus","_formikErrors","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sources":["../../../src/lib/v2/utils/index.ts"],"sourcesContent":["export { cx } from \"./cx\";\r\nexport { default as fmtMoney } from \"./fmtMoney\";\r\n\r\n// Date rendering for DISPLAY (gap G-51) — the counterpart of fmtMoney, which\r\n// this folder has owned all along for the same reason: a cell must never read\r\n// \"NaN\". Nothing existed for dates, which GU screens render far more often than\r\n// amounts, so every module wrote it — and every copy fed `new Date(undefined)`\r\n// straight into `getDate()`, rendering the literal string \"NaN/NaN/NaN NaN:NaN\"\r\n// on any optional date field. One module had added the guard at eight CALL\r\n// SITES across four lots before moving it into its own helper; the formatter is\r\n// the only place it cannot be forgotten.\r\n//\r\n// REMINDER (the G-34 invariant): this barrel is re-exported from lib/index.ts by\r\n// EXPLICIT NAME LIST, so these two must be added there in the SAME commit or\r\n// they never reach a consumer.\r\nexport { fmtDate, fmtDateTime } from \"./fmtDate\";\r\nexport type { FmtDateInput, FmtDateOptions } from \"./fmtDate\";\r\n\r\n// Undefined-safe label merge. Every localisable component used to write\r\n// `labels ? { ...DEFAULTS, ...labels } : DEFAULTS`, and a spread does NOT skip\r\n// explicit `undefined` — so an override of `undefined` DELETED the default and\r\n// the component threw `L.x is not a function` at render. Eleven components\r\n// shipped that hazard; the `?: T` declarations hid it from the compiler by\r\n// asserting the merged value could never be undefined, which was false at\r\n// runtime. Surfaced by the G-14 widening. Latent runtime defect, not cosmetics.\r\nexport { mergeLabels } from \"./mergeLabels\";\r\n\r\n// Base64 → browser download, plus the extension→MIME map it uses.\r\n// Flat named exports (not a namespace like contrast below): two\r\n// independent functions with no shared state, and downloadBase64File\r\n// is the common call site — qualifying it would only add noise.\r\nexport {\r\n downloadBase64File,\r\n getMimeType,\r\n openBase64FileInTab,\r\n downloadBlobFile,\r\n} from \"./fileDownload\";\r\n\r\n// Upload validation (gap G-52). `Dropzone` takes an `accept` attribute and\r\n// reports rejections, but validates NOTHING — `accept` is a file-picker filter\r\n// that drag-and-drop ignores. So every host decided for itself, and each wrote\r\n// the same two non-business parts alongside its own extension allow-list: a\r\n// deny-list of executables and scripts, and an extension/MIME cross-check with\r\n// its browser tolerances. A security decision copied into fifteen modules\r\n// drifts, and drifts SILENTLY. The host keeps its allow-list; the library owns\r\n// the deny-list and the cross-check.\r\n//\r\n// REMINDER (the G-34 invariant): added to lib/index.ts in the same commit.\r\nexport {\r\n isForbiddenExecutable,\r\n isAcceptedFile,\r\n getFileRejection,\r\n describeAcceptedTypes,\r\n toAcceptAttribute,\r\n} from \"./fileValidation\";\r\nexport type {\r\n FileAcceptPolicy,\r\n FileRejection,\r\n FileRejectionReason,\r\n} from \"./fileValidation\";\r\n\r\n// WCAG 2.1 contrast utilities. Re-exported under a namespace at\r\n// the public barrel (v2.contrast.*) so the named API is grouped\r\n// and self-describing for callers — used to validate runtime\r\n// brand overrides against WCAG 1.4.3 and to audit dark-mode\r\n// token pairs (F29).\r\nexport * as contrast from \"./contrast\";\r\n\r\n// `unknown`-rejection narrowing. Mandated by the platform's own\r\n// `useUnknownInCatchVariables` flag, which makes `catch (e)` bind `unknown` in\r\n// every consuming saga while `any` and unsafe assertions stay forbidden — the\r\n// library previously left no sanctioned route between those two rules, and the\r\n// modules that filled the gap filled it with the forbidden construct.\r\n// Raised as capability gap G-04 (procuration-portnet-fe Area 5).\r\n//\r\n// `getApiErrorDetail` is the LOGGING counterpart added with G-07: since\r\n// `getApiErrorMessage` now suppresses axios transport phrasings so they cannot\r\n// reach a user (Charter §09.3), operators still need the unfiltered string for a\r\n// console or an APM breadcrumb. Display one, log the other.\r\nexport {\r\n getApiErrorMessage,\r\n getApiErrorDetail,\r\n getApiErrorStatus,\r\n DEFAULT_API_ERROR_MESSAGE,\r\n} from \"./apiError\";\r\n\r\n// The feed behind NetworkErrorBanner. The banner was exported without the\r\n// plumbing that decides when it shows, so every module rebuilt the same\r\n// subscribe/report/clear channel. Raised as capability gap G-03\r\n// (procuration-portnet-fe Area 5).\r\nexport { networkStatus, createNetworkStatus } from \"./networkStatus\";\r\nexport type { NetworkStatus, NetworkStatusListener } from \"./networkStatus\";\r\n\r\n// Formik's nested `errors` -> the flat `{ name, message }[]` that\r\n// FormErrorSummary consumes and focusFieldByName resolves. The library owned\r\n// both ends of the R-FV.2 / R-FV.3 recipe and not the step between them, so\r\n// every Formik host wrote the recursion — and each copy got the accumulated\r\n// PATH subtly wrong, which fails silently: the summary lists the right\r\n// messages and its jump button targets a field that does not exist.\r\n// Capability gap G-38 (refonte-frontend Area 5).\r\nexport { flattenFormikErrors } from \"./formikErrors\";\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AAcA,IAAAG,QAAA,GAAAH,OAAA;AAUA,IAAAI,YAAA,GAAAJ,OAAA;AAMA,IAAAK,aAAA,GAAAL,OAAA;AAiBA,IAAAM,eAAA,GAAAN,OAAA;AAM0B,IAAAO,SAAA,GAAAC,uBAAA,CAAAR,OAAA;AAAAS,OAAA,CAAAC,QAAA,GAAAH,SAAA;AAyB1B,IAAAI,SAAA,GAAAX,OAAA;AAWA,IAAAY,cAAA,GAAAZ,OAAA;AAUA,IAAAa,aAAA,GAAAb,OAAA;AAAqD,SAAAQ,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAM,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;AAAA,SAAAb,uBAAAY,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAK,UAAA,GAAAL,CAAA,KAAAU,OAAA,EAAAV,CAAA","ignoreList":[]}
|
|
@@ -3,14 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
exports.mergeLabels = mergeLabels;
|
|
8
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
9
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
8
|
/**
|
|
15
9
|
* mergeLabels — Portnet UI v2
|
|
16
10
|
*
|
|
@@ -71,11 +65,10 @@ function mergeLabels(defaults, overrides) {
|
|
|
71
65
|
// Single documented assertion, guarded by the `!overrides` check above: the
|
|
72
66
|
// mapped parameter type deliberately says nothing about value types, so the
|
|
73
67
|
// only way to read them is through an index signature.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
for (
|
|
77
|
-
|
|
78
|
-
var value = source[key];
|
|
68
|
+
const source = overrides;
|
|
69
|
+
let out;
|
|
70
|
+
for (const key of Object.keys(source)) {
|
|
71
|
+
const value = source[key];
|
|
79
72
|
// THE point of this helper. `undefined` means "not specified", never
|
|
80
73
|
// "unset the default".
|
|
81
74
|
if (value === undefined) continue;
|
|
@@ -84,10 +77,12 @@ function mergeLabels(defaults, overrides) {
|
|
|
84
77
|
// LAZILY — only once a real override is found — so the common paths (no
|
|
85
78
|
// overrides at all, or an object whose every value is undefined) return the
|
|
86
79
|
// defaults object itself and stay referentially stable across renders.
|
|
87
|
-
if (!out) out =
|
|
80
|
+
if (!out) out = {
|
|
81
|
+
...defaults
|
|
82
|
+
};
|
|
88
83
|
out[key] = value;
|
|
89
84
|
}
|
|
90
85
|
return out === undefined ? defaults : out;
|
|
91
86
|
}
|
|
92
|
-
var _default = exports
|
|
87
|
+
var _default = exports.default = mergeLabels;
|
|
93
88
|
//# sourceMappingURL=mergeLabels.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeLabels.js","names":["mergeLabels","defaults","overrides","source","out","
|
|
1
|
+
{"version":3,"file":"mergeLabels.js","names":["mergeLabels","defaults","overrides","source","out","key","Object","keys","value","undefined","_default","exports","default"],"sources":["../../../src/lib/v2/utils/mergeLabels.ts"],"sourcesContent":["/**\r\n * mergeLabels — Portnet UI v2\r\n *\r\n * Merges a consumer's partial label overrides onto a component's frozen\r\n * defaults, IGNORING keys whose value is `undefined`.\r\n *\r\n * ─────────────────────────────────────────────────────────────────────────────\r\n * WHY THIS EXISTS (capability gap G-14, latent runtime defect)\r\n *\r\n * Every localisable component in this library merged its labels like this:\r\n *\r\n * const L = labels ? { ...DEFAULT_LABELS, ...labels } : DEFAULT_LABELS;\r\n *\r\n * A spread does NOT skip explicit `undefined`. `{ ...{a: 1}, ...{a: undefined} }`\r\n * is `{ a: undefined }` — so a consumer writing\r\n *\r\n * <FilterTab labels={{ countLabel: maybeFn }} /> // maybeFn possibly undefined\r\n *\r\n * silently DELETED the default and the component then threw\r\n * `L.countLabel is not a function` at render time. Eleven components shipped\r\n * that hazard.\r\n *\r\n * It stayed invisible because the label interfaces declared `?: T` rather than\r\n * `?: T | undefined`: under that declaration TypeScript concluded the merged\r\n * value could never be `undefined`, which is false at runtime. Widening the\r\n * optional props (G-14) removed the blindfold and the compiler reported all\r\n * seventeen call sites at once. The types were wrong; the code was wrong; only\r\n * the combination of the two looked right.\r\n *\r\n * The fix restores what every call site already intended: an override REPLACES a\r\n * default, an absent or `undefined` override LEAVES it alone.\r\n * ─────────────────────────────────────────────────────────────────────────────\r\n *\r\n * const L = mergeLabels(DEFAULT_LABELS, labels);\r\n * // ^ every key guaranteed present, typed from the defaults\r\n *\r\n * The return type is the DEFAULTS' type, deliberately: defaults are the\r\n * exhaustive, all-required shape, so the component can call `L.anything()`\r\n * without a null check. That is the whole point.\r\n *\r\n * `overrides` is a mapped type over `keyof TDefaults` with `unknown` values\r\n * rather than `Partial<TDefaults>`. Two reasons, both load-bearing:\r\n * - a mapped type accepts an INTERFACE argument, whereas `Record<string,\r\n * unknown>` would not (TypeScript grants implicit index signatures to type\r\n * aliases, not to interfaces), and most label contracts here are interfaces;\r\n * - some label interfaces legitimately widen a default's type (`React.ReactNode`\r\n * where the default is a `string`), which `Partial<TDefaults>` would reject.\r\n * Value types are already checked at the component's `labels` prop boundary,\r\n * so nothing is lost by not re-checking them here.\r\n *\r\n * Returns the defaults object ITSELF when there is nothing to override, so the\r\n * common path allocates nothing and stays referentially stable across renders —\r\n * which matters because these results are routinely wrapped in `useMemo`.\r\n */\r\nexport function mergeLabels<TDefaults extends object>(\r\n defaults: TDefaults,\r\n overrides?: { readonly [K in keyof TDefaults]?: unknown } | undefined\r\n): TDefaults {\r\n if (!overrides) return defaults;\r\n\r\n // Single documented assertion, guarded by the `!overrides` check above: the\r\n // mapped parameter type deliberately says nothing about value types, so the\r\n // only way to read them is through an index signature.\r\n const source = overrides as Record<string, unknown>;\r\n\r\n let out: Record<string, unknown> | undefined;\r\n\r\n for (const key of Object.keys(source)) {\r\n const value = source[key];\r\n // THE point of this helper. `undefined` means \"not specified\", never\r\n // \"unset the default\".\r\n if (value === undefined) continue;\r\n // Second assertion, same cause: `TDefaults extends object` carries no index\r\n // signature, so spreading it into a writable record needs one. Allocated\r\n // LAZILY — only once a real override is found — so the common paths (no\r\n // overrides at all, or an object whose every value is undefined) return the\r\n // defaults object itself and stay referentially stable across renders.\r\n if (!out) out = { ...(defaults as Record<string, unknown>) };\r\n out[key] = value;\r\n }\r\n\r\n return out === undefined ? defaults : (out as TDefaults);\r\n}\r\n\r\nexport default mergeLabels;\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;AACO,SAASA,WAAWA,CACzBC,QAAmB,EACnBC,SAAqE,EAC1D;EACX,IAAI,CAACA,SAAS,EAAE,OAAOD,QAAQ;;EAE/B;EACA;EACA;EACA,MAAME,MAAM,GAAGD,SAAoC;EAEnD,IAAIE,GAAwC;EAE5C,KAAK,MAAMC,GAAG,IAAIC,MAAM,CAACC,IAAI,CAACJ,MAAM,CAAC,EAAE;IACrC,MAAMK,KAAK,GAAGL,MAAM,CAACE,GAAG,CAAC;IACzB;IACA;IACA,IAAIG,KAAK,KAAKC,SAAS,EAAE;IACzB;IACA;IACA;IACA;IACA;IACA,IAAI,CAACL,GAAG,EAAEA,GAAG,GAAG;MAAE,GAAIH;IAAqC,CAAC;IAC5DG,GAAG,CAACC,GAAG,CAAC,GAAGG,KAAK;EAClB;EAEA,OAAOJ,GAAG,KAAKK,SAAS,GAAGR,QAAQ,GAAIG,GAAiB;AAC1D;AAAC,IAAAM,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcZ,WAAW","ignoreList":[]}
|