@portnet/ui 6.0.0 → 6.0.1
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/dist/esm/index.js +196 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/v2/__tests__/FieldError.test.js +160 -0
- package/dist/esm/v2/__tests__/FieldError.test.js.map +1 -0
- package/dist/esm/v2/__tests__/FileCard.test.js +144 -0
- package/dist/esm/v2/__tests__/FileCard.test.js.map +1 -0
- package/dist/esm/v2/__tests__/MobileRowCard.test.js +333 -0
- package/dist/esm/v2/__tests__/MobileRowCard.test.js.map +1 -0
- package/dist/esm/v2/__tests__/SectionErrorBoundary.test.js +235 -0
- package/dist/esm/v2/__tests__/SectionErrorBoundary.test.js.map +1 -0
- package/dist/esm/v2/__tests__/apiError.test.js +181 -0
- package/dist/esm/v2/__tests__/apiError.test.js.map +1 -0
- package/dist/esm/v2/__tests__/banned-patterns.test.js +270 -0
- package/dist/esm/v2/__tests__/banned-patterns.test.js.map +1 -0
- package/dist/esm/v2/__tests__/contrast-palette.test.js +224 -0
- package/dist/esm/v2/__tests__/contrast-palette.test.js.map +1 -0
- package/dist/esm/v2/__tests__/cssVariables.test.js +157 -0
- package/dist/esm/v2/__tests__/cssVariables.test.js.map +1 -0
- package/dist/esm/v2/__tests__/labels-merge.test.js +147 -0
- package/dist/esm/v2/__tests__/labels-merge.test.js.map +1 -0
- package/dist/esm/v2/__tests__/locale-fallback.test.js +109 -0
- package/dist/esm/v2/__tests__/locale-fallback.test.js.map +1 -0
- package/dist/esm/v2/__tests__/useFocusTrap.test.js +514 -0
- package/dist/esm/v2/__tests__/useFocusTrap.test.js.map +1 -0
- package/dist/esm/v2/components/Accordion.js +230 -0
- package/dist/esm/v2/components/Accordion.js.map +1 -0
- package/dist/esm/v2/components/ActionStrip.js +146 -0
- package/dist/esm/v2/components/ActionStrip.js.map +1 -0
- package/dist/esm/v2/components/Banner.js +254 -0
- package/dist/esm/v2/components/Banner.js.map +1 -0
- package/dist/esm/v2/components/Busy.js +97 -0
- package/dist/esm/v2/components/Busy.js.map +1 -0
- package/dist/esm/v2/components/Button.js +114 -0
- package/dist/esm/v2/components/Button.js.map +1 -0
- package/dist/esm/v2/components/CategoryTag.js +81 -0
- package/dist/esm/v2/components/CategoryTag.js.map +1 -0
- package/dist/esm/v2/components/Checkbox.js +124 -0
- package/dist/esm/v2/components/Checkbox.js.map +1 -0
- package/dist/esm/v2/components/Chip.js +124 -0
- package/dist/esm/v2/components/Chip.js.map +1 -0
- package/dist/esm/v2/components/Combobox.js +394 -0
- package/dist/esm/v2/components/Combobox.js.map +1 -0
- package/dist/esm/v2/components/CommandPalette.js +660 -0
- package/dist/esm/v2/components/CommandPalette.js.map +1 -0
- package/dist/esm/v2/components/ConfirmDialog.js +144 -0
- package/dist/esm/v2/components/ConfirmDialog.js.map +1 -0
- package/dist/esm/v2/components/DatePicker.js +200 -0
- package/dist/esm/v2/components/DatePicker.js.map +1 -0
- package/dist/esm/v2/components/DateRangePicker.js +289 -0
- package/dist/esm/v2/components/DateRangePicker.js.map +1 -0
- package/dist/esm/v2/components/DateTimePicker.js +182 -0
- package/dist/esm/v2/components/DateTimePicker.js.map +1 -0
- package/dist/esm/v2/components/Drawer.js +333 -0
- package/dist/esm/v2/components/Drawer.js.map +1 -0
- package/dist/esm/v2/components/Dropzone.js +540 -0
- package/dist/esm/v2/components/Dropzone.js.map +1 -0
- package/dist/esm/v2/components/EmptyState.js +102 -0
- package/dist/esm/v2/components/EmptyState.js.map +1 -0
- package/dist/esm/v2/components/FavoriteToggle.js +127 -0
- package/dist/esm/v2/components/FavoriteToggle.js.map +1 -0
- package/dist/esm/v2/components/Field.js +197 -0
- package/dist/esm/v2/components/Field.js.map +1 -0
- package/dist/esm/v2/components/FieldError.js +124 -0
- package/dist/esm/v2/components/FieldError.js.map +1 -0
- package/dist/esm/v2/components/FieldHelp.js +202 -0
- package/dist/esm/v2/components/FieldHelp.js.map +1 -0
- package/dist/esm/v2/components/FileCard.js +162 -0
- package/dist/esm/v2/components/FileCard.js.map +1 -0
- package/dist/esm/v2/components/FilterTab.js +138 -0
- package/dist/esm/v2/components/FilterTab.js.map +1 -0
- package/dist/esm/v2/components/ForbiddenPage.js +74 -0
- package/dist/esm/v2/components/ForbiddenPage.js.map +1 -0
- package/dist/esm/v2/components/FormGrid.js +179 -0
- package/dist/esm/v2/components/FormGrid.js.map +1 -0
- package/dist/esm/v2/components/FormikDisplay.js +118 -0
- package/dist/esm/v2/components/FormikDisplay.js.map +1 -0
- package/dist/esm/v2/components/Input.js +107 -0
- package/dist/esm/v2/components/Input.js.map +1 -0
- package/dist/esm/v2/components/KPICard.js +237 -0
- package/dist/esm/v2/components/KPICard.js.map +1 -0
- package/dist/esm/v2/components/KPIStrip.js +84 -0
- package/dist/esm/v2/components/KPIStrip.js.map +1 -0
- package/dist/esm/v2/components/KV.js +75 -0
- package/dist/esm/v2/components/KV.js.map +1 -0
- package/dist/esm/v2/components/KVGrid.js +74 -0
- package/dist/esm/v2/components/KVGrid.js.map +1 -0
- package/dist/esm/v2/components/Layout.js +284 -0
- package/dist/esm/v2/components/Layout.js.map +1 -0
- package/dist/esm/v2/components/MobileRowCard.js +314 -0
- package/dist/esm/v2/components/MobileRowCard.js.map +1 -0
- package/dist/esm/v2/components/Modal.js +276 -0
- package/dist/esm/v2/components/Modal.js.map +1 -0
- package/dist/esm/v2/components/NetworkErrorPage.js +78 -0
- package/dist/esm/v2/components/NetworkErrorPage.js.map +1 -0
- package/dist/esm/v2/components/NotFoundPage.js +58 -0
- package/dist/esm/v2/components/NotFoundPage.js.map +1 -0
- package/dist/esm/v2/components/NumberInput.js +309 -0
- package/dist/esm/v2/components/NumberInput.js.map +1 -0
- package/dist/esm/v2/components/OverflowMenu.js +184 -0
- package/dist/esm/v2/components/OverflowMenu.js.map +1 -0
- package/dist/esm/v2/components/PdfViewer.js +122 -0
- package/dist/esm/v2/components/PdfViewer.js.map +1 -0
- package/dist/esm/v2/components/ProgressBar.js +202 -0
- package/dist/esm/v2/components/ProgressBar.js.map +1 -0
- package/dist/esm/v2/components/Radio.js +228 -0
- package/dist/esm/v2/components/Radio.js.map +1 -0
- package/dist/esm/v2/components/SectionErrorBoundary.js +214 -0
- package/dist/esm/v2/components/SectionErrorBoundary.js.map +1 -0
- package/dist/esm/v2/components/SectionHeader.js +132 -0
- package/dist/esm/v2/components/SectionHeader.js.map +1 -0
- package/dist/esm/v2/components/Segmented.js +254 -0
- package/dist/esm/v2/components/Segmented.js.map +1 -0
- package/dist/esm/v2/components/Select.js +490 -0
- package/dist/esm/v2/components/Select.js.map +1 -0
- package/dist/esm/v2/components/ServerErrorPage.js +74 -0
- package/dist/esm/v2/components/ServerErrorPage.js.map +1 -0
- package/dist/esm/v2/components/Skeleton.js +269 -0
- package/dist/esm/v2/components/Skeleton.js.map +1 -0
- package/dist/esm/v2/components/SkipLink.js +49 -0
- package/dist/esm/v2/components/SkipLink.js.map +1 -0
- package/dist/esm/v2/components/Spinner.js +69 -0
- package/dist/esm/v2/components/Spinner.js.map +1 -0
- package/dist/esm/v2/components/Status.js +64 -0
- package/dist/esm/v2/components/Status.js.map +1 -0
- package/dist/esm/v2/components/Stepper.js +432 -0
- package/dist/esm/v2/components/Stepper.js.map +1 -0
- package/dist/esm/v2/components/Surface.js +159 -0
- package/dist/esm/v2/components/Surface.js.map +1 -0
- package/dist/esm/v2/components/Switch.js +128 -0
- package/dist/esm/v2/components/Switch.js.map +1 -0
- package/dist/esm/v2/components/Tabs.js +150 -0
- package/dist/esm/v2/components/Tabs.js.map +1 -0
- package/dist/esm/v2/components/TelInput.js +274 -0
- package/dist/esm/v2/components/TelInput.js.map +1 -0
- package/dist/esm/v2/components/Textarea.js +72 -0
- package/dist/esm/v2/components/Textarea.js.map +1 -0
- package/dist/esm/v2/components/TimePicker.js +134 -0
- package/dist/esm/v2/components/TimePicker.js.map +1 -0
- package/dist/esm/v2/components/Toast.js +376 -0
- package/dist/esm/v2/components/Toast.js.map +1 -0
- package/dist/esm/v2/components/Tooltip.js +161 -0
- package/dist/esm/v2/components/Tooltip.js.map +1 -0
- package/dist/esm/v2/components/_ErrorPageBody.js +85 -0
- package/dist/esm/v2/components/_ErrorPageBody.js.map +1 -0
- package/dist/esm/v2/components/_pickerShared.js +60 -0
- package/dist/esm/v2/components/_pickerShared.js.map +1 -0
- package/dist/esm/v2/components/index.js +244 -0
- package/dist/esm/v2/components/index.js.map +1 -0
- package/dist/esm/v2/hooks/index.js +10 -0
- package/dist/esm/v2/hooks/index.js.map +1 -0
- package/dist/esm/v2/hooks/useDelayedFlag.js +55 -0
- package/dist/esm/v2/hooks/useDelayedFlag.js.map +1 -0
- package/dist/esm/v2/hooks/useDensity.js +119 -0
- package/dist/esm/v2/hooks/useDensity.js.map +1 -0
- package/dist/esm/v2/hooks/useFocusFirstError.js +197 -0
- package/dist/esm/v2/hooks/useFocusFirstError.js.map +1 -0
- package/dist/esm/v2/hooks/useFocusTrap.js +202 -0
- package/dist/esm/v2/hooks/useFocusTrap.js.map +1 -0
- package/dist/esm/v2/hooks/useFormAutoSave.js +181 -0
- package/dist/esm/v2/hooks/useFormAutoSave.js.map +1 -0
- package/dist/esm/v2/hooks/useFormCompletionProgress.js +131 -0
- package/dist/esm/v2/hooks/useFormCompletionProgress.js.map +1 -0
- package/dist/esm/v2/hooks/useResolvedDensity.js +44 -0
- package/dist/esm/v2/hooks/useResolvedDensity.js.map +1 -0
- package/dist/esm/v2/hooks/useSortedRows.js +32 -0
- package/dist/esm/v2/hooks/useSortedRows.js.map +1 -0
- package/dist/esm/v2/hooks/useTabLoading.js +79 -0
- package/dist/esm/v2/hooks/useTabLoading.js.map +1 -0
- package/dist/esm/v2/index.js +121 -0
- package/dist/esm/v2/index.js.map +1 -0
- package/dist/esm/v2/modalContext.js +108 -0
- package/dist/esm/v2/modalContext.js.map +1 -0
- package/dist/esm/v2/models/favorite.js +2 -0
- package/dist/esm/v2/models/favorite.js.map +1 -0
- package/dist/esm/v2/models/index.js +12 -0
- package/dist/esm/v2/models/index.js.map +1 -0
- package/dist/esm/v2/models/personalization.js +2 -0
- package/dist/esm/v2/models/personalization.js.map +1 -0
- package/dist/esm/v2/models/referentiel.js +2 -0
- package/dist/esm/v2/models/referentiel.js.map +1 -0
- package/dist/esm/v2/models/savedFilter.js +2 -0
- package/dist/esm/v2/models/savedFilter.js.map +1 -0
- package/dist/esm/v2/patterns/ActionBar.js +603 -0
- package/dist/esm/v2/patterns/ActionBar.js.map +1 -0
- package/dist/esm/v2/patterns/BulkActionBar.js +147 -0
- package/dist/esm/v2/patterns/BulkActionBar.js.map +1 -0
- package/dist/esm/v2/patterns/CollapsibleDataGrid.js +303 -0
- package/dist/esm/v2/patterns/CollapsibleDataGrid.js.map +1 -0
- package/dist/esm/v2/patterns/ColumnsToggle.js +301 -0
- package/dist/esm/v2/patterns/ColumnsToggle.js.map +1 -0
- package/dist/esm/v2/patterns/DataGrid.js +820 -0
- package/dist/esm/v2/patterns/DataGrid.js.map +1 -0
- package/dist/esm/v2/patterns/DataGridSettingsMenu.js +375 -0
- package/dist/esm/v2/patterns/DataGridSettingsMenu.js.map +1 -0
- package/dist/esm/v2/patterns/DataGridToolbar.js +249 -0
- package/dist/esm/v2/patterns/DataGridToolbar.js.map +1 -0
- package/dist/esm/v2/patterns/DataGridVirtualized.js +523 -0
- package/dist/esm/v2/patterns/DataGridVirtualized.js.map +1 -0
- package/dist/esm/v2/patterns/DeleteResourceConfirmDialog.js +70 -0
- package/dist/esm/v2/patterns/DeleteResourceConfirmDialog.js.map +1 -0
- package/dist/esm/v2/patterns/FavoriteColumn.js +164 -0
- package/dist/esm/v2/patterns/FavoriteColumn.js.map +1 -0
- package/dist/esm/v2/patterns/FavoritesFilter.js +91 -0
- package/dist/esm/v2/patterns/FavoritesFilter.js.map +1 -0
- package/dist/esm/v2/patterns/FormErrorSummary.js +101 -0
- package/dist/esm/v2/patterns/FormErrorSummary.js.map +1 -0
- package/dist/esm/v2/patterns/FormPageShell.js +126 -0
- package/dist/esm/v2/patterns/FormPageShell.js.map +1 -0
- package/dist/esm/v2/patterns/FormSection.js +190 -0
- package/dist/esm/v2/patterns/FormSection.js.map +1 -0
- package/dist/esm/v2/patterns/FormikCheckboxGroup.js +110 -0
- package/dist/esm/v2/patterns/FormikCheckboxGroup.js.map +1 -0
- package/dist/esm/v2/patterns/FormikCombobox.js +115 -0
- package/dist/esm/v2/patterns/FormikCombobox.js.map +1 -0
- package/dist/esm/v2/patterns/FormikDatePicker.js +196 -0
- package/dist/esm/v2/patterns/FormikDatePicker.js.map +1 -0
- package/dist/esm/v2/patterns/FormikErrorFocus.js +77 -0
- package/dist/esm/v2/patterns/FormikErrorFocus.js.map +1 -0
- package/dist/esm/v2/patterns/FormikFile.js +148 -0
- package/dist/esm/v2/patterns/FormikFile.js.map +1 -0
- package/dist/esm/v2/patterns/FormikInput.js +127 -0
- package/dist/esm/v2/patterns/FormikInput.js.map +1 -0
- package/dist/esm/v2/patterns/FormikReferentielField.js +116 -0
- package/dist/esm/v2/patterns/FormikReferentielField.js.map +1 -0
- package/dist/esm/v2/patterns/FormikSelect.js +159 -0
- package/dist/esm/v2/patterns/FormikSelect.js.map +1 -0
- package/dist/esm/v2/patterns/FormikTextarea.js +76 -0
- package/dist/esm/v2/patterns/FormikTextarea.js.map +1 -0
- package/dist/esm/v2/patterns/KeyboardShortcutsHelp.js +195 -0
- package/dist/esm/v2/patterns/KeyboardShortcutsHelp.js.map +1 -0
- package/dist/esm/v2/patterns/NetworkErrorBanner.js +72 -0
- package/dist/esm/v2/patterns/NetworkErrorBanner.js.map +1 -0
- package/dist/esm/v2/patterns/PageContent.js +62 -0
- package/dist/esm/v2/patterns/PageContent.js.map +1 -0
- package/dist/esm/v2/patterns/ReferentielField.js +615 -0
- package/dist/esm/v2/patterns/ReferentielField.js.map +1 -0
- package/dist/esm/v2/patterns/SaveFilterDialog.js +197 -0
- package/dist/esm/v2/patterns/SaveFilterDialog.js.map +1 -0
- package/dist/esm/v2/patterns/SavedFiltersMenu.js +406 -0
- package/dist/esm/v2/patterns/SavedFiltersMenu.js.map +1 -0
- package/dist/esm/v2/patterns/SkeletonPageShell.js +342 -0
- package/dist/esm/v2/patterns/SkeletonPageShell.js.map +1 -0
- package/dist/esm/v2/patterns/SortableHeader.js +179 -0
- package/dist/esm/v2/patterns/SortableHeader.js.map +1 -0
- package/dist/esm/v2/patterns/Tour.js +471 -0
- package/dist/esm/v2/patterns/Tour.js.map +1 -0
- package/dist/esm/v2/patterns/_dataGridShared.js +431 -0
- package/dist/esm/v2/patterns/_dataGridShared.js.map +1 -0
- package/dist/esm/v2/patterns/_sort.js +112 -0
- package/dist/esm/v2/patterns/_sort.js.map +1 -0
- package/dist/esm/v2/patterns/_useColumnReorder.js +257 -0
- package/dist/esm/v2/patterns/_useColumnReorder.js.map +1 -0
- package/dist/esm/v2/patterns/_useColumnResize.js +191 -0
- package/dist/esm/v2/patterns/_useColumnResize.js.map +1 -0
- package/dist/esm/v2/patterns/index.js +95 -0
- package/dist/esm/v2/patterns/index.js.map +1 -0
- package/dist/esm/v2/personalization/PersonalizationProvider.js +168 -0
- package/dist/esm/v2/personalization/PersonalizationProvider.js.map +1 -0
- package/dist/esm/v2/personalization/adapters/_storageKey.js +60 -0
- package/dist/esm/v2/personalization/adapters/_storageKey.js.map +1 -0
- package/dist/esm/v2/personalization/adapters/createLocalStorageAdapter.js +124 -0
- package/dist/esm/v2/personalization/adapters/createLocalStorageAdapter.js.map +1 -0
- package/dist/esm/v2/personalization/adapters/createMemoryAdapter.js +70 -0
- package/dist/esm/v2/personalization/adapters/createMemoryAdapter.js.map +1 -0
- package/dist/esm/v2/personalization/adapters/index.js +11 -0
- package/dist/esm/v2/personalization/adapters/index.js.map +1 -0
- package/dist/esm/v2/personalization/capabilities/favorites.js +216 -0
- package/dist/esm/v2/personalization/capabilities/favorites.js.map +1 -0
- package/dist/esm/v2/personalization/capabilities/favoritesView.js +111 -0
- package/dist/esm/v2/personalization/capabilities/favoritesView.js.map +1 -0
- package/dist/esm/v2/personalization/capabilities/index.js +17 -0
- package/dist/esm/v2/personalization/capabilities/index.js.map +1 -0
- package/dist/esm/v2/personalization/capabilities/savedFilters.js +291 -0
- package/dist/esm/v2/personalization/capabilities/savedFilters.js.map +1 -0
- package/dist/esm/v2/personalization/createPersonalizationStore.js +472 -0
- package/dist/esm/v2/personalization/createPersonalizationStore.js.map +1 -0
- package/dist/esm/v2/personalization/index.js +46 -0
- package/dist/esm/v2/personalization/index.js.map +1 -0
- package/dist/esm/v2/personalization/personalizationContext.js +108 -0
- package/dist/esm/v2/personalization/personalizationContext.js.map +1 -0
- package/dist/esm/v2/personalization/schema.js +92 -0
- package/dist/esm/v2/personalization/schema.js.map +1 -0
- package/dist/esm/v2/personalization/types.js +2 -0
- package/dist/esm/v2/personalization/types.js.map +1 -0
- package/dist/esm/v2/referentiel/ReferentielProvider.js +87 -0
- package/dist/esm/v2/referentiel/ReferentielProvider.js.map +1 -0
- package/dist/esm/v2/referentiel/index.js +15 -0
- package/dist/esm/v2/referentiel/index.js.map +1 -0
- package/dist/esm/v2/referentiel/useReferentielClient.js +37 -0
- package/dist/esm/v2/referentiel/useReferentielClient.js.map +1 -0
- package/dist/esm/v2/referentiel/useReferentielOptions.js +169 -0
- package/dist/esm/v2/referentiel/useReferentielOptions.js.map +1 -0
- package/dist/esm/v2/referentiel/useReferentielSearch.js +132 -0
- package/dist/esm/v2/referentiel/useReferentielSearch.js.map +1 -0
- package/dist/esm/v2/styles/base.css +425 -0
- package/dist/esm/v2/styles/css.d.ts +10 -0
- package/dist/esm/v2/styles/index.js +12 -0
- package/dist/esm/v2/styles/index.js.map +1 -0
- package/dist/esm/v2/theme/_brand.js +64 -0
- package/dist/esm/v2/theme/_brand.js.map +1 -0
- package/dist/esm/v2/theme/_brandSecondary.js +60 -0
- package/dist/esm/v2/theme/_brandSecondary.js.map +1 -0
- package/dist/esm/v2/theme/createPortnetTheme.js +548 -0
- package/dist/esm/v2/theme/createPortnetTheme.js.map +1 -0
- package/dist/esm/v2/theme/cssVariables.js +198 -0
- package/dist/esm/v2/theme/cssVariables.js.map +1 -0
- package/dist/esm/v2/theme/index.js +32 -0
- package/dist/esm/v2/theme/index.js.map +1 -0
- package/dist/esm/v2/tokens/breakpoints.js +106 -0
- package/dist/esm/v2/tokens/breakpoints.js.map +1 -0
- package/dist/esm/v2/tokens/colors.js +219 -0
- package/dist/esm/v2/tokens/colors.js.map +1 -0
- package/dist/esm/v2/tokens/density.js +98 -0
- package/dist/esm/v2/tokens/density.js.map +1 -0
- package/dist/esm/v2/tokens/index.js +80 -0
- package/dist/esm/v2/tokens/index.js.map +1 -0
- package/dist/esm/v2/tokens/motion.js +88 -0
- package/dist/esm/v2/tokens/motion.js.map +1 -0
- package/dist/esm/v2/tokens/radius.js +22 -0
- package/dist/esm/v2/tokens/radius.js.map +1 -0
- package/dist/esm/v2/tokens/shadows.js +40 -0
- package/dist/esm/v2/tokens/shadows.js.map +1 -0
- package/dist/esm/v2/tokens/spacing.js +51 -0
- package/dist/esm/v2/tokens/spacing.js.map +1 -0
- package/dist/esm/v2/tokens/state.js +41 -0
- package/dist/esm/v2/tokens/state.js.map +1 -0
- package/dist/esm/v2/tokens/statusPalette.js +66 -0
- package/dist/esm/v2/tokens/statusPalette.js.map +1 -0
- package/dist/esm/v2/tokens/tokens.json +153 -0
- package/dist/esm/v2/tokens/typography.js +149 -0
- package/dist/esm/v2/tokens/typography.js.map +1 -0
- package/dist/esm/v2/tokens/zIndex.js +44 -0
- package/dist/esm/v2/tokens/zIndex.js.map +1 -0
- package/dist/esm/v2/types/common.js +2 -0
- package/dist/esm/v2/types/common.js.map +1 -0
- package/dist/esm/v2/types/datagrid.js +2 -0
- package/dist/esm/v2/types/datagrid.js.map +1 -0
- package/dist/esm/v2/types/index.js +12 -0
- package/dist/esm/v2/types/index.js.map +1 -0
- package/dist/esm/v2/utils/apiError.js +281 -0
- package/dist/esm/v2/utils/apiError.js.map +1 -0
- package/dist/esm/v2/utils/contrast.js +157 -0
- package/dist/esm/v2/utils/contrast.js.map +1 -0
- package/dist/esm/v2/utils/cx.js +38 -0
- package/dist/esm/v2/utils/cx.js.map +1 -0
- package/dist/esm/v2/utils/fileDownload.js +226 -0
- package/dist/esm/v2/utils/fileDownload.js.map +1 -0
- package/dist/esm/v2/utils/fmtMoney.js +78 -0
- package/dist/esm/v2/utils/fmtMoney.js.map +1 -0
- package/dist/esm/v2/utils/index.js +43 -0
- package/dist/esm/v2/utils/index.js.map +1 -0
- package/dist/esm/v2/utils/mergeLabels.js +86 -0
- package/dist/esm/v2/utils/mergeLabels.js.map +1 -0
- package/dist/esm/v2/utils/networkStatus.js +114 -0
- package/dist/esm/v2/utils/networkStatus.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -1
- package/dist/v2/__tests__/FieldError.test.js +164 -0
- package/dist/v2/__tests__/FieldError.test.js.map +1 -0
- package/dist/v2/__tests__/FileCard.test.js +148 -0
- package/dist/v2/__tests__/FileCard.test.js.map +1 -0
- package/dist/v2/__tests__/SectionErrorBoundary.test.js +237 -0
- package/dist/v2/__tests__/SectionErrorBoundary.test.js.map +1 -0
- package/dist/v2/components/Accordion.d.ts +6 -6
- package/dist/v2/components/Accordion.d.ts.map +1 -1
- package/dist/v2/components/Accordion.js.map +1 -1
- package/dist/v2/components/ActionStrip.d.ts +12 -12
- package/dist/v2/components/ActionStrip.d.ts.map +1 -1
- package/dist/v2/components/ActionStrip.js.map +1 -1
- package/dist/v2/components/Banner.d.ts +48 -9
- package/dist/v2/components/Banner.d.ts.map +1 -1
- package/dist/v2/components/Banner.js +116 -35
- package/dist/v2/components/Banner.js.map +1 -1
- package/dist/v2/components/Busy.d.ts +3 -3
- package/dist/v2/components/Busy.d.ts.map +1 -1
- package/dist/v2/components/Busy.js.map +1 -1
- package/dist/v2/components/Button.d.ts +6 -6
- package/dist/v2/components/Button.d.ts.map +1 -1
- package/dist/v2/components/Button.js.map +1 -1
- package/dist/v2/components/CategoryTag.d.ts +3 -3
- package/dist/v2/components/CategoryTag.d.ts.map +1 -1
- package/dist/v2/components/CategoryTag.js.map +1 -1
- package/dist/v2/components/Checkbox.d.ts +11 -11
- package/dist/v2/components/Checkbox.d.ts.map +1 -1
- package/dist/v2/components/Checkbox.js.map +1 -1
- package/dist/v2/components/Chip.d.ts +8 -8
- package/dist/v2/components/Chip.d.ts.map +1 -1
- package/dist/v2/components/Chip.js +2 -1
- package/dist/v2/components/Chip.js.map +1 -1
- package/dist/v2/components/Combobox.d.ts +27 -27
- package/dist/v2/components/Combobox.d.ts.map +1 -1
- package/dist/v2/components/Combobox.js +3 -2
- package/dist/v2/components/Combobox.js.map +1 -1
- package/dist/v2/components/CommandPalette.d.ts +20 -20
- package/dist/v2/components/CommandPalette.d.ts.map +1 -1
- package/dist/v2/components/CommandPalette.js +2 -6
- package/dist/v2/components/CommandPalette.js.map +1 -1
- package/dist/v2/components/ConfirmDialog.d.ts +13 -13
- package/dist/v2/components/ConfirmDialog.d.ts.map +1 -1
- package/dist/v2/components/ConfirmDialog.js +2 -1
- package/dist/v2/components/ConfirmDialog.js.map +1 -1
- package/dist/v2/components/DatePicker.d.ts +11 -11
- package/dist/v2/components/DatePicker.d.ts.map +1 -1
- package/dist/v2/components/DatePicker.js.map +1 -1
- package/dist/v2/components/DateRangePicker.d.ts +16 -16
- package/dist/v2/components/DateRangePicker.d.ts.map +1 -1
- package/dist/v2/components/DateRangePicker.js +2 -1
- package/dist/v2/components/DateRangePicker.js.map +1 -1
- package/dist/v2/components/DateTimePicker.d.ts +11 -11
- package/dist/v2/components/DateTimePicker.d.ts.map +1 -1
- package/dist/v2/components/DateTimePicker.js.map +1 -1
- package/dist/v2/components/Drawer.d.ts +18 -18
- package/dist/v2/components/Drawer.d.ts.map +1 -1
- package/dist/v2/components/Drawer.js +2 -1
- package/dist/v2/components/Drawer.js.map +1 -1
- package/dist/v2/components/Dropzone.d.ts +34 -34
- package/dist/v2/components/Dropzone.d.ts.map +1 -1
- package/dist/v2/components/Dropzone.js +11 -3
- package/dist/v2/components/Dropzone.js.map +1 -1
- package/dist/v2/components/EmptyState.d.ts +7 -7
- package/dist/v2/components/EmptyState.d.ts.map +1 -1
- package/dist/v2/components/EmptyState.js.map +1 -1
- package/dist/v2/components/FavoriteToggle.d.ts +7 -7
- package/dist/v2/components/FavoriteToggle.d.ts.map +1 -1
- package/dist/v2/components/FavoriteToggle.js +2 -1
- package/dist/v2/components/FavoriteToggle.js.map +1 -1
- package/dist/v2/components/Field.d.ts +17 -12
- package/dist/v2/components/Field.d.ts.map +1 -1
- package/dist/v2/components/Field.js +25 -7
- package/dist/v2/components/Field.js.map +1 -1
- package/dist/v2/components/FieldError.d.ts +78 -0
- package/dist/v2/components/FieldError.d.ts.map +1 -0
- package/dist/v2/components/FieldError.js +131 -0
- package/dist/v2/components/FieldError.js.map +1 -0
- package/dist/v2/components/FieldHelp.d.ts +7 -7
- package/dist/v2/components/FieldHelp.d.ts.map +1 -1
- package/dist/v2/components/FieldHelp.js.map +1 -1
- package/dist/v2/components/FileCard.d.ts +75 -0
- package/dist/v2/components/FileCard.d.ts.map +1 -0
- package/dist/v2/components/FileCard.js +169 -0
- package/dist/v2/components/FileCard.js.map +1 -0
- package/dist/v2/components/FilterTab.d.ts +9 -9
- package/dist/v2/components/FilterTab.d.ts.map +1 -1
- package/dist/v2/components/FilterTab.js +2 -1
- package/dist/v2/components/FilterTab.js.map +1 -1
- package/dist/v2/components/FormGrid.d.ts +9 -4
- package/dist/v2/components/FormGrid.d.ts.map +1 -1
- package/dist/v2/components/FormGrid.js +11 -1
- package/dist/v2/components/FormGrid.js.map +1 -1
- package/dist/v2/components/FormikDisplay.d.ts +6 -6
- package/dist/v2/components/FormikDisplay.d.ts.map +1 -1
- package/dist/v2/components/FormikDisplay.js.map +1 -1
- package/dist/v2/components/Input.d.ts +6 -6
- package/dist/v2/components/Input.d.ts.map +1 -1
- package/dist/v2/components/Input.js.map +1 -1
- package/dist/v2/components/KPICard.d.ts +43 -13
- package/dist/v2/components/KPICard.d.ts.map +1 -1
- package/dist/v2/components/KPICard.js +53 -14
- package/dist/v2/components/KPICard.js.map +1 -1
- package/dist/v2/components/KPIStrip.d.ts +68 -0
- package/dist/v2/components/KPIStrip.d.ts.map +1 -0
- package/dist/v2/components/KPIStrip.js +92 -0
- package/dist/v2/components/KPIStrip.js.map +1 -0
- package/dist/v2/components/KV.d.ts +3 -3
- package/dist/v2/components/KV.d.ts.map +1 -1
- package/dist/v2/components/KV.js.map +1 -1
- package/dist/v2/components/KVGrid.d.ts +2 -2
- package/dist/v2/components/KVGrid.d.ts.map +1 -1
- package/dist/v2/components/KVGrid.js +8 -1
- package/dist/v2/components/KVGrid.js.map +1 -1
- package/dist/v2/components/Layout.d.ts +7 -7
- package/dist/v2/components/Layout.d.ts.map +1 -1
- package/dist/v2/components/Layout.js.map +1 -1
- package/dist/v2/components/MobileRowCard.d.ts +13 -13
- package/dist/v2/components/MobileRowCard.d.ts.map +1 -1
- package/dist/v2/components/MobileRowCard.js.map +1 -1
- package/dist/v2/components/Modal.d.ts +12 -12
- package/dist/v2/components/Modal.d.ts.map +1 -1
- package/dist/v2/components/Modal.js.map +1 -1
- package/dist/v2/components/NetworkErrorPage.d.ts +1 -1
- package/dist/v2/components/NetworkErrorPage.d.ts.map +1 -1
- package/dist/v2/components/NetworkErrorPage.js.map +1 -1
- package/dist/v2/components/NumberInput.d.ts +14 -14
- package/dist/v2/components/NumberInput.d.ts.map +1 -1
- package/dist/v2/components/NumberInput.js +7 -6
- package/dist/v2/components/NumberInput.js.map +1 -1
- package/dist/v2/components/OverflowMenu.d.ts +14 -14
- package/dist/v2/components/OverflowMenu.d.ts.map +1 -1
- package/dist/v2/components/OverflowMenu.js +4 -8
- package/dist/v2/components/OverflowMenu.js.map +1 -1
- package/dist/v2/components/PdfViewer.d.ts +9 -9
- package/dist/v2/components/PdfViewer.d.ts.map +1 -1
- package/dist/v2/components/PdfViewer.js.map +1 -1
- package/dist/v2/components/ProgressBar.d.ts +10 -10
- package/dist/v2/components/ProgressBar.d.ts.map +1 -1
- package/dist/v2/components/ProgressBar.js.map +1 -1
- package/dist/v2/components/Radio.d.ts +7 -7
- package/dist/v2/components/Radio.d.ts.map +1 -1
- package/dist/v2/components/Radio.js.map +1 -1
- package/dist/v2/components/SectionErrorBoundary.d.ts +89 -0
- package/dist/v2/components/SectionErrorBoundary.d.ts.map +1 -0
- package/dist/v2/components/SectionErrorBoundary.js +221 -0
- package/dist/v2/components/SectionErrorBoundary.js.map +1 -0
- package/dist/v2/components/SectionHeader.d.ts +5 -5
- package/dist/v2/components/SectionHeader.d.ts.map +1 -1
- package/dist/v2/components/SectionHeader.js.map +1 -1
- package/dist/v2/components/Segmented.d.ts +11 -11
- package/dist/v2/components/Segmented.d.ts.map +1 -1
- package/dist/v2/components/Segmented.js.map +1 -1
- package/dist/v2/components/Select.d.ts +33 -15
- package/dist/v2/components/Select.d.ts.map +1 -1
- package/dist/v2/components/Select.js +147 -30
- package/dist/v2/components/Select.js.map +1 -1
- package/dist/v2/components/ServerErrorPage.d.ts +1 -1
- package/dist/v2/components/ServerErrorPage.d.ts.map +1 -1
- package/dist/v2/components/ServerErrorPage.js.map +1 -1
- package/dist/v2/components/Skeleton.d.ts +15 -15
- package/dist/v2/components/Skeleton.d.ts.map +1 -1
- package/dist/v2/components/Skeleton.js.map +1 -1
- package/dist/v2/components/SkipLink.d.ts +2 -2
- package/dist/v2/components/SkipLink.d.ts.map +1 -1
- package/dist/v2/components/SkipLink.js.map +1 -1
- package/dist/v2/components/Status.d.ts +3 -3
- package/dist/v2/components/Status.d.ts.map +1 -1
- package/dist/v2/components/Status.js.map +1 -1
- package/dist/v2/components/Stepper.d.ts +28 -22
- package/dist/v2/components/Stepper.d.ts.map +1 -1
- package/dist/v2/components/Stepper.js +31 -5
- package/dist/v2/components/Stepper.js.map +1 -1
- package/dist/v2/components/Surface.d.ts +94 -0
- package/dist/v2/components/Surface.d.ts.map +1 -0
- package/dist/v2/components/Surface.js +163 -0
- package/dist/v2/components/Surface.js.map +1 -0
- package/dist/v2/components/Switch.d.ts +4 -4
- package/dist/v2/components/Switch.d.ts.map +1 -1
- package/dist/v2/components/Switch.js.map +1 -1
- package/dist/v2/components/Tabs.d.ts +6 -6
- package/dist/v2/components/Tabs.d.ts.map +1 -1
- package/dist/v2/components/Tabs.js.map +1 -1
- package/dist/v2/components/TelInput.d.ts +8 -8
- package/dist/v2/components/TelInput.d.ts.map +1 -1
- package/dist/v2/components/TelInput.js +18 -18
- package/dist/v2/components/TelInput.js.map +1 -1
- package/dist/v2/components/Textarea.d.ts +1 -1
- package/dist/v2/components/Textarea.d.ts.map +1 -1
- package/dist/v2/components/Textarea.js.map +1 -1
- package/dist/v2/components/TimePicker.d.ts +11 -11
- package/dist/v2/components/TimePicker.d.ts.map +1 -1
- package/dist/v2/components/TimePicker.js.map +1 -1
- package/dist/v2/components/Toast.d.ts +6 -6
- package/dist/v2/components/Toast.d.ts.map +1 -1
- package/dist/v2/components/Toast.js +9 -8
- package/dist/v2/components/Toast.js.map +1 -1
- package/dist/v2/components/Tooltip.d.ts +1 -1
- package/dist/v2/components/Tooltip.d.ts.map +1 -1
- package/dist/v2/components/Tooltip.js.map +1 -1
- package/dist/v2/components/index.d.ts +143 -0
- package/dist/v2/components/index.d.ts.map +1 -1
- package/dist/v2/components/index.js +35 -0
- package/dist/v2/components/index.js.map +1 -1
- package/dist/v2/models/favorite.d.ts +1 -1
- package/dist/v2/models/favorite.d.ts.map +1 -1
- package/dist/v2/models/favorite.js.map +1 -1
- package/dist/v2/models/personalization.d.ts +13 -13
- 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 +11 -11
- 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 -8
- package/dist/v2/models/savedFilter.d.ts.map +1 -1
- package/dist/v2/models/savedFilter.js.map +1 -1
- package/dist/v2/patterns/ActionBar.d.ts +33 -33
- package/dist/v2/patterns/ActionBar.d.ts.map +1 -1
- package/dist/v2/patterns/ActionBar.js +2 -1
- package/dist/v2/patterns/ActionBar.js.map +1 -1
- package/dist/v2/patterns/BulkActionBar.d.ts +12 -12
- package/dist/v2/patterns/BulkActionBar.d.ts.map +1 -1
- package/dist/v2/patterns/BulkActionBar.js +2 -1
- package/dist/v2/patterns/BulkActionBar.js.map +1 -1
- package/dist/v2/patterns/CollapsibleDataGrid.d.ts +15 -15
- package/dist/v2/patterns/CollapsibleDataGrid.d.ts.map +1 -1
- package/dist/v2/patterns/CollapsibleDataGrid.js.map +1 -1
- package/dist/v2/patterns/ColumnsToggle.d.ts +7 -7
- package/dist/v2/patterns/ColumnsToggle.d.ts.map +1 -1
- package/dist/v2/patterns/ColumnsToggle.js +4 -8
- package/dist/v2/patterns/ColumnsToggle.js.map +1 -1
- package/dist/v2/patterns/DataGridSettingsMenu.d.ts +12 -12
- package/dist/v2/patterns/DataGridSettingsMenu.d.ts.map +1 -1
- package/dist/v2/patterns/DataGridSettingsMenu.js +9 -8
- package/dist/v2/patterns/DataGridSettingsMenu.js.map +1 -1
- package/dist/v2/patterns/DataGridToolbar.d.ts +40 -40
- package/dist/v2/patterns/DataGridToolbar.d.ts.map +1 -1
- package/dist/v2/patterns/DataGridToolbar.js +2 -1
- package/dist/v2/patterns/DataGridToolbar.js.map +1 -1
- package/dist/v2/patterns/DataGridVirtualized.d.ts +27 -27
- package/dist/v2/patterns/DataGridVirtualized.d.ts.map +1 -1
- package/dist/v2/patterns/DataGridVirtualized.js.map +1 -1
- package/dist/v2/patterns/DeleteResourceConfirmDialog.d.ts +5 -5
- package/dist/v2/patterns/DeleteResourceConfirmDialog.d.ts.map +1 -1
- package/dist/v2/patterns/DeleteResourceConfirmDialog.js.map +1 -1
- package/dist/v2/patterns/FavoriteColumn.d.ts +6 -6
- package/dist/v2/patterns/FavoriteColumn.d.ts.map +1 -1
- package/dist/v2/patterns/FavoriteColumn.js.map +1 -1
- package/dist/v2/patterns/FavoritesFilter.d.ts +10 -10
- package/dist/v2/patterns/FavoritesFilter.d.ts.map +1 -1
- package/dist/v2/patterns/FavoritesFilter.js +2 -1
- package/dist/v2/patterns/FavoritesFilter.js.map +1 -1
- package/dist/v2/patterns/FormErrorSummary.d.ts +4 -4
- package/dist/v2/patterns/FormErrorSummary.d.ts.map +1 -1
- package/dist/v2/patterns/FormErrorSummary.js.map +1 -1
- package/dist/v2/patterns/FormPageShell.d.ts +4 -4
- package/dist/v2/patterns/FormPageShell.d.ts.map +1 -1
- package/dist/v2/patterns/FormPageShell.js.map +1 -1
- package/dist/v2/patterns/FormSection.d.ts +19 -8
- package/dist/v2/patterns/FormSection.d.ts.map +1 -1
- package/dist/v2/patterns/FormSection.js +106 -71
- package/dist/v2/patterns/FormSection.js.map +1 -1
- package/dist/v2/patterns/FormikCheckboxGroup.d.ts +6 -6
- package/dist/v2/patterns/FormikCheckboxGroup.d.ts.map +1 -1
- package/dist/v2/patterns/FormikCheckboxGroup.js.map +1 -1
- package/dist/v2/patterns/FormikCombobox.d.ts +11 -11
- package/dist/v2/patterns/FormikCombobox.d.ts.map +1 -1
- package/dist/v2/patterns/FormikCombobox.js.map +1 -1
- package/dist/v2/patterns/FormikDatePicker.d.ts +36 -8
- package/dist/v2/patterns/FormikDatePicker.d.ts.map +1 -1
- package/dist/v2/patterns/FormikDatePicker.js +27 -1
- package/dist/v2/patterns/FormikDatePicker.js.map +1 -1
- package/dist/v2/patterns/FormikErrorFocus.d.ts +3 -3
- package/dist/v2/patterns/FormikErrorFocus.d.ts.map +1 -1
- package/dist/v2/patterns/FormikErrorFocus.js.map +1 -1
- package/dist/v2/patterns/FormikFile.d.ts +8 -8
- package/dist/v2/patterns/FormikFile.d.ts.map +1 -1
- package/dist/v2/patterns/FormikFile.js.map +1 -1
- package/dist/v2/patterns/FormikInput.d.ts +41 -6
- package/dist/v2/patterns/FormikInput.d.ts.map +1 -1
- package/dist/v2/patterns/FormikInput.js +49 -1
- package/dist/v2/patterns/FormikInput.js.map +1 -1
- package/dist/v2/patterns/FormikReferentielField.d.ts +8 -8
- package/dist/v2/patterns/FormikReferentielField.d.ts.map +1 -1
- package/dist/v2/patterns/FormikReferentielField.js.map +1 -1
- package/dist/v2/patterns/FormikSelect.d.ts +33 -12
- package/dist/v2/patterns/FormikSelect.d.ts.map +1 -1
- package/dist/v2/patterns/FormikSelect.js +28 -2
- package/dist/v2/patterns/FormikSelect.js.map +1 -1
- package/dist/v2/patterns/FormikTextarea.d.ts +5 -5
- package/dist/v2/patterns/FormikTextarea.d.ts.map +1 -1
- package/dist/v2/patterns/FormikTextarea.js.map +1 -1
- package/dist/v2/patterns/KeyboardShortcutsHelp.d.ts +7 -7
- package/dist/v2/patterns/KeyboardShortcutsHelp.d.ts.map +1 -1
- package/dist/v2/patterns/KeyboardShortcutsHelp.js +2 -6
- package/dist/v2/patterns/KeyboardShortcutsHelp.js.map +1 -1
- package/dist/v2/patterns/NetworkErrorBanner.d.ts +4 -4
- package/dist/v2/patterns/NetworkErrorBanner.d.ts.map +1 -1
- package/dist/v2/patterns/NetworkErrorBanner.js.map +1 -1
- package/dist/v2/patterns/PageContent.d.ts +3 -3
- package/dist/v2/patterns/PageContent.d.ts.map +1 -1
- package/dist/v2/patterns/PageContent.js.map +1 -1
- package/dist/v2/patterns/ReferentielField.d.ts +49 -49
- package/dist/v2/patterns/ReferentielField.d.ts.map +1 -1
- package/dist/v2/patterns/ReferentielField.js +2 -1
- package/dist/v2/patterns/ReferentielField.js.map +1 -1
- package/dist/v2/patterns/SaveFilterDialog.d.ts +10 -10
- package/dist/v2/patterns/SaveFilterDialog.d.ts.map +1 -1
- package/dist/v2/patterns/SaveFilterDialog.js +9 -8
- package/dist/v2/patterns/SaveFilterDialog.js.map +1 -1
- package/dist/v2/patterns/SavedFiltersMenu.d.ts +7 -7
- package/dist/v2/patterns/SavedFiltersMenu.d.ts.map +1 -1
- package/dist/v2/patterns/SavedFiltersMenu.js +9 -8
- package/dist/v2/patterns/SavedFiltersMenu.js.map +1 -1
- package/dist/v2/patterns/SkeletonPageShell.d.ts +7 -7
- package/dist/v2/patterns/SkeletonPageShell.d.ts.map +1 -1
- package/dist/v2/patterns/SkeletonPageShell.js.map +1 -1
- package/dist/v2/patterns/SortableHeader.d.ts +1 -1
- package/dist/v2/patterns/SortableHeader.d.ts.map +1 -1
- package/dist/v2/patterns/SortableHeader.js.map +1 -1
- package/dist/v2/patterns/Tour.d.ts +12 -12
- package/dist/v2/patterns/Tour.d.ts.map +1 -1
- package/dist/v2/patterns/Tour.js +9 -8
- package/dist/v2/patterns/Tour.js.map +1 -1
- package/dist/v2/patterns/_dataGridShared.d.ts +25 -6
- package/dist/v2/patterns/_dataGridShared.d.ts.map +1 -1
- package/dist/v2/patterns/_dataGridShared.js +37 -3
- package/dist/v2/patterns/_dataGridShared.js.map +1 -1
- package/dist/v2/patterns/_useColumnReorder.d.ts +1 -1
- package/dist/v2/patterns/_useColumnReorder.d.ts.map +1 -1
- package/dist/v2/patterns/_useColumnReorder.js.map +1 -1
- package/dist/v2/patterns/_useColumnResize.d.ts +1 -1
- package/dist/v2/patterns/_useColumnResize.d.ts.map +1 -1
- package/dist/v2/patterns/_useColumnResize.js.map +1 -1
- package/dist/v2/patterns/index.d.ts +27 -0
- package/dist/v2/patterns/index.d.ts.map +1 -1
- package/dist/v2/patterns/index.js.map +1 -1
- package/dist/v2/personalization/PersonalizationProvider.d.ts +9 -9
- package/dist/v2/personalization/PersonalizationProvider.d.ts.map +1 -1
- package/dist/v2/personalization/PersonalizationProvider.js.map +1 -1
- package/dist/v2/personalization/adapters/createLocalStorageAdapter.d.ts +1 -1
- package/dist/v2/personalization/adapters/createLocalStorageAdapter.d.ts.map +1 -1
- package/dist/v2/personalization/adapters/createLocalStorageAdapter.js.map +1 -1
- package/dist/v2/personalization/adapters/createMemoryAdapter.d.ts +1 -1
- package/dist/v2/personalization/adapters/createMemoryAdapter.d.ts.map +1 -1
- package/dist/v2/personalization/adapters/createMemoryAdapter.js.map +1 -1
- package/dist/v2/personalization/capabilities/favoritesView.d.ts +3 -3
- package/dist/v2/personalization/capabilities/favoritesView.d.ts.map +1 -1
- package/dist/v2/personalization/capabilities/favoritesView.js.map +1 -1
- package/dist/v2/personalization/capabilities/savedFilters.d.ts +3 -3
- package/dist/v2/personalization/capabilities/savedFilters.d.ts.map +1 -1
- package/dist/v2/personalization/capabilities/savedFilters.js.map +1 -1
- package/dist/v2/personalization/createPersonalizationStore.d.ts +8 -8
- package/dist/v2/personalization/createPersonalizationStore.d.ts.map +1 -1
- package/dist/v2/personalization/createPersonalizationStore.js.map +1 -1
- package/dist/v2/personalization/schema.d.ts +2 -2
- package/dist/v2/personalization/schema.d.ts.map +1 -1
- package/dist/v2/personalization/schema.js.map +1 -1
- package/dist/v2/personalization/types.d.ts +19 -19
- package/dist/v2/personalization/types.d.ts.map +1 -1
- package/dist/v2/personalization/types.js.map +1 -1
- package/dist/v2/referentiel/ReferentielProvider.d.ts +4 -4
- package/dist/v2/referentiel/ReferentielProvider.d.ts.map +1 -1
- package/dist/v2/referentiel/ReferentielProvider.js.map +1 -1
- package/dist/v2/referentiel/useReferentielOptions.d.ts +4 -4
- package/dist/v2/referentiel/useReferentielOptions.d.ts.map +1 -1
- package/dist/v2/referentiel/useReferentielOptions.js.map +1 -1
- package/dist/v2/referentiel/useReferentielSearch.d.ts +3 -3
- package/dist/v2/referentiel/useReferentielSearch.d.ts.map +1 -1
- package/dist/v2/referentiel/useReferentielSearch.js.map +1 -1
- package/dist/v2/theme/createPortnetTheme.d.ts +32 -7
- package/dist/v2/theme/createPortnetTheme.d.ts.map +1 -1
- package/dist/v2/theme/createPortnetTheme.js +25 -1
- package/dist/v2/theme/createPortnetTheme.js.map +1 -1
- package/dist/v2/types/datagrid.d.ts +59 -59
- package/dist/v2/types/datagrid.d.ts.map +1 -1
- package/dist/v2/types/datagrid.js.map +1 -1
- package/dist/v2/utils/apiError.d.ts +65 -4
- package/dist/v2/utils/apiError.d.ts.map +1 -1
- package/dist/v2/utils/apiError.js +69 -6
- package/dist/v2/utils/apiError.js.map +1 -1
- package/dist/v2/utils/index.d.ts +1 -0
- package/dist/v2/utils/index.d.ts.map +1 -1
- package/dist/v2/utils/index.js +7 -0
- package/dist/v2/utils/index.js.map +1 -1
- package/dist/v2/utils/mergeLabels.d.ts +59 -0
- package/dist/v2/utils/mergeLabels.d.ts.map +1 -0
- package/dist/v2/utils/mergeLabels.js +93 -0
- package/dist/v2/utils/mergeLabels.js.map +1 -0
- package/package.json +23 -15
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import fmtMoney from "../utils/fmtMoney";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Contract tests for fmtMoney — the canonical v2 money formatter.
|
|
5
|
+
*
|
|
6
|
+
* The graceful-display contract (returns "—" for bad input, never
|
|
7
|
+
* throws on bad locale) underpins TradeDirect dashboard cells.
|
|
8
|
+
* Removing it would let a malformed amount or a typo'd locale crash
|
|
9
|
+
* an entire row of a DataGrid.
|
|
10
|
+
*/
|
|
11
|
+
describe("fmtMoney — contract", function () {
|
|
12
|
+
describe("graceful empty-cell fallback", function () {
|
|
13
|
+
test("returns '—' for null", function () {
|
|
14
|
+
expect(fmtMoney(null)).toBe("—");
|
|
15
|
+
});
|
|
16
|
+
test("returns '—' for undefined", function () {
|
|
17
|
+
expect(fmtMoney(undefined)).toBe("—");
|
|
18
|
+
});
|
|
19
|
+
test("returns '—' for empty string", function () {
|
|
20
|
+
expect(fmtMoney("")).toBe("—");
|
|
21
|
+
});
|
|
22
|
+
test("returns '—' for NaN", function () {
|
|
23
|
+
expect(fmtMoney(NaN)).toBe("—");
|
|
24
|
+
});
|
|
25
|
+
test("returns '—' for Infinity", function () {
|
|
26
|
+
expect(fmtMoney(Infinity)).toBe("—");
|
|
27
|
+
expect(fmtMoney(-Infinity)).toBe("—");
|
|
28
|
+
});
|
|
29
|
+
test("returns '—' for non-numeric string", function () {
|
|
30
|
+
expect(fmtMoney("abc")).toBe("—");
|
|
31
|
+
});
|
|
32
|
+
test("coerces numeric strings to numbers", function () {
|
|
33
|
+
// "1234.5" should format identically to 1234.5
|
|
34
|
+
expect(fmtMoney("1234.5")).toBe(fmtMoney(1234.5));
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
describe("locale-aware formatting", function () {
|
|
38
|
+
test("formats with the default fr-FR locale", function () {
|
|
39
|
+
var out = fmtMoney(1234.5);
|
|
40
|
+
// FR uses comma as decimal separator. Thousand separator is a
|
|
41
|
+
// non-breaking space (U+00A0) or narrow non-breaking space
|
|
42
|
+
// (U+202F) depending on the runtime — accept either.
|
|
43
|
+
expect(out).toMatch(/1[\u00A0\u202F\s]234,5/);
|
|
44
|
+
});
|
|
45
|
+
test("formats under en-US when explicitly passed", function () {
|
|
46
|
+
var out = fmtMoney(1234.5, "USD", {
|
|
47
|
+
locale: "en-US"
|
|
48
|
+
});
|
|
49
|
+
expect(out).toContain("1,234.5");
|
|
50
|
+
expect(out).toContain("USD");
|
|
51
|
+
});
|
|
52
|
+
test("respects minimumFractionDigits", function () {
|
|
53
|
+
var out = fmtMoney(1234, "EUR", {
|
|
54
|
+
minimumFractionDigits: 2
|
|
55
|
+
});
|
|
56
|
+
// Default fr-FR locale; 2 fraction digits → trailing ",00"
|
|
57
|
+
expect(out).toMatch(/1[\u00A0\u202F\s]234,00/);
|
|
58
|
+
});
|
|
59
|
+
test("respects maximumFractionDigits", function () {
|
|
60
|
+
var out = fmtMoney(1.23456, "", {
|
|
61
|
+
maximumFractionDigits: 2
|
|
62
|
+
});
|
|
63
|
+
// Should round to 2 fraction digits in fr-FR (",23")
|
|
64
|
+
expect(out).toMatch(/1,23\b/);
|
|
65
|
+
});
|
|
66
|
+
test("appends the currency suffix when supplied", function () {
|
|
67
|
+
expect(fmtMoney(100, "EUR")).toContain("EUR");
|
|
68
|
+
expect(fmtMoney(100, "MAD")).toContain("MAD");
|
|
69
|
+
expect(fmtMoney(100, "USD")).toContain("USD");
|
|
70
|
+
});
|
|
71
|
+
test("omits the currency suffix when blank", function () {
|
|
72
|
+
var out = fmtMoney(100, "");
|
|
73
|
+
expect(out).not.toMatch(/[A-Z]{3}/);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
describe("locale fallback (the regression-class guard)", function () {
|
|
77
|
+
test("does not throw on an invalid BCP-47 tag", function () {
|
|
78
|
+
expect(function () {
|
|
79
|
+
return fmtMoney(100, "EUR", {
|
|
80
|
+
locale: "not-a-real-locale"
|
|
81
|
+
});
|
|
82
|
+
}).not.toThrow();
|
|
83
|
+
});
|
|
84
|
+
test("falls back to fr-FR formatting on invalid locale", function () {
|
|
85
|
+
var out = fmtMoney(1234.5, "EUR", {
|
|
86
|
+
locale: "not-a-real-locale"
|
|
87
|
+
});
|
|
88
|
+
// Should produce the FR comma-decimal form, not crash and
|
|
89
|
+
// not return undefined.
|
|
90
|
+
expect(out).toMatch(/1[\u00A0\u202F\s]234,5/);
|
|
91
|
+
expect(out).toContain("EUR");
|
|
92
|
+
});
|
|
93
|
+
test("does not throw on garbage object (defensive)", function () {
|
|
94
|
+
// fmtMoney's opts.locale is typed `string | undefined`, but real hosts
|
|
95
|
+
// occasionally pass a wrong runtime value. The @ts-expect-error documents
|
|
96
|
+
// that this input is intentionally ill-typed and asserts the runtime
|
|
97
|
+
// guard (catch → fr-FR fallback) handles any value, not just RangeError.
|
|
98
|
+
expect(function () {
|
|
99
|
+
return (
|
|
100
|
+
// @ts-expect-error — intentional invalid locale type (runtime robustness)
|
|
101
|
+
fmtMoney(100, "EUR", {
|
|
102
|
+
locale: 12345
|
|
103
|
+
})
|
|
104
|
+
);
|
|
105
|
+
}).not.toThrow();
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=locale-fallback.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale-fallback.test.js","names":["fmtMoney","describe","test","expect","toBe","undefined","NaN","Infinity","out","toMatch","locale","toContain","minimumFractionDigits","maximumFractionDigits","not","toThrow"],"sources":["../../../../src/lib/v2/__tests__/locale-fallback.test.ts"],"sourcesContent":["import fmtMoney from \"../utils/fmtMoney\";\r\n\r\n/**\r\n * Contract tests for fmtMoney — the canonical v2 money formatter.\r\n *\r\n * The graceful-display contract (returns \"—\" for bad input, never\r\n * throws on bad locale) underpins TradeDirect dashboard cells.\r\n * Removing it would let a malformed amount or a typo'd locale crash\r\n * an entire row of a DataGrid.\r\n */\r\ndescribe(\"fmtMoney — contract\", () => {\r\n describe(\"graceful empty-cell fallback\", () => {\r\n test(\"returns '—' for null\", () => {\r\n expect(fmtMoney(null)).toBe(\"—\");\r\n });\r\n\r\n test(\"returns '—' for undefined\", () => {\r\n expect(fmtMoney(undefined)).toBe(\"—\");\r\n });\r\n\r\n test(\"returns '—' for empty string\", () => {\r\n expect(fmtMoney(\"\")).toBe(\"—\");\r\n });\r\n\r\n test(\"returns '—' for NaN\", () => {\r\n expect(fmtMoney(NaN)).toBe(\"—\");\r\n });\r\n\r\n test(\"returns '—' for Infinity\", () => {\r\n expect(fmtMoney(Infinity)).toBe(\"—\");\r\n expect(fmtMoney(-Infinity)).toBe(\"—\");\r\n });\r\n\r\n test(\"returns '—' for non-numeric string\", () => {\r\n expect(fmtMoney(\"abc\")).toBe(\"—\");\r\n });\r\n\r\n test(\"coerces numeric strings to numbers\", () => {\r\n // \"1234.5\" should format identically to 1234.5\r\n expect(fmtMoney(\"1234.5\")).toBe(fmtMoney(1234.5));\r\n });\r\n });\r\n\r\n describe(\"locale-aware formatting\", () => {\r\n test(\"formats with the default fr-FR locale\", () => {\r\n const out = fmtMoney(1234.5);\r\n // FR uses comma as decimal separator. Thousand separator is a\r\n // non-breaking space (U+00A0) or narrow non-breaking space\r\n // (U+202F) depending on the runtime — accept either.\r\n expect(out).toMatch(/1[\\u00A0\\u202F\\s]234,5/);\r\n });\r\n\r\n test(\"formats under en-US when explicitly passed\", () => {\r\n const out = fmtMoney(1234.5, \"USD\", { locale: \"en-US\" });\r\n expect(out).toContain(\"1,234.5\");\r\n expect(out).toContain(\"USD\");\r\n });\r\n\r\n test(\"respects minimumFractionDigits\", () => {\r\n const out = fmtMoney(1234, \"EUR\", { minimumFractionDigits: 2 });\r\n // Default fr-FR locale; 2 fraction digits → trailing \",00\"\r\n expect(out).toMatch(/1[\\u00A0\\u202F\\s]234,00/);\r\n });\r\n\r\n test(\"respects maximumFractionDigits\", () => {\r\n const out = fmtMoney(1.23456, \"\", { maximumFractionDigits: 2 });\r\n // Should round to 2 fraction digits in fr-FR (\",23\")\r\n expect(out).toMatch(/1,23\\b/);\r\n });\r\n\r\n test(\"appends the currency suffix when supplied\", () => {\r\n expect(fmtMoney(100, \"EUR\")).toContain(\"EUR\");\r\n expect(fmtMoney(100, \"MAD\")).toContain(\"MAD\");\r\n expect(fmtMoney(100, \"USD\")).toContain(\"USD\");\r\n });\r\n\r\n test(\"omits the currency suffix when blank\", () => {\r\n const out = fmtMoney(100, \"\");\r\n expect(out).not.toMatch(/[A-Z]{3}/);\r\n });\r\n });\r\n\r\n describe(\"locale fallback (the regression-class guard)\", () => {\r\n test(\"does not throw on an invalid BCP-47 tag\", () => {\r\n expect(() =>\r\n fmtMoney(100, \"EUR\", { locale: \"not-a-real-locale\" })\r\n ).not.toThrow();\r\n });\r\n\r\n test(\"falls back to fr-FR formatting on invalid locale\", () => {\r\n const out = fmtMoney(1234.5, \"EUR\", { locale: \"not-a-real-locale\" });\r\n // Should produce the FR comma-decimal form, not crash and\r\n // not return undefined.\r\n expect(out).toMatch(/1[\\u00A0\\u202F\\s]234,5/);\r\n expect(out).toContain(\"EUR\");\r\n });\r\n\r\n test(\"does not throw on garbage object (defensive)\", () => {\r\n // fmtMoney's opts.locale is typed `string | undefined`, but real hosts\r\n // occasionally pass a wrong runtime value. The @ts-expect-error documents\r\n // that this input is intentionally ill-typed and asserts the runtime\r\n // guard (catch → fr-FR fallback) handles any value, not just RangeError.\r\n expect(() =>\r\n // @ts-expect-error — intentional invalid locale type (runtime robustness)\r\n fmtMoney(100, \"EUR\", { locale: 12345 })\r\n ).not.toThrow();\r\n });\r\n });\r\n});\r\n"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,mBAAmB;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAC,QAAQ,CAAC,qBAAqB,EAAE,YAAM;EACpCA,QAAQ,CAAC,8BAA8B,EAAE,YAAM;IAC7CC,IAAI,CAAC,sBAAsB,EAAE,YAAM;MACjCC,MAAM,CAACH,QAAQ,CAAC,IAAI,CAAC,CAAC,CAACI,IAAI,CAAC,GAAG,CAAC;IAClC,CAAC,CAAC;IAEFF,IAAI,CAAC,2BAA2B,EAAE,YAAM;MACtCC,MAAM,CAACH,QAAQ,CAACK,SAAS,CAAC,CAAC,CAACD,IAAI,CAAC,GAAG,CAAC;IACvC,CAAC,CAAC;IAEFF,IAAI,CAAC,8BAA8B,EAAE,YAAM;MACzCC,MAAM,CAACH,QAAQ,CAAC,EAAE,CAAC,CAAC,CAACI,IAAI,CAAC,GAAG,CAAC;IAChC,CAAC,CAAC;IAEFF,IAAI,CAAC,qBAAqB,EAAE,YAAM;MAChCC,MAAM,CAACH,QAAQ,CAACM,GAAG,CAAC,CAAC,CAACF,IAAI,CAAC,GAAG,CAAC;IACjC,CAAC,CAAC;IAEFF,IAAI,CAAC,0BAA0B,EAAE,YAAM;MACrCC,MAAM,CAACH,QAAQ,CAACO,QAAQ,CAAC,CAAC,CAACH,IAAI,CAAC,GAAG,CAAC;MACpCD,MAAM,CAACH,QAAQ,CAAC,CAACO,QAAQ,CAAC,CAAC,CAACH,IAAI,CAAC,GAAG,CAAC;IACvC,CAAC,CAAC;IAEFF,IAAI,CAAC,oCAAoC,EAAE,YAAM;MAC/CC,MAAM,CAACH,QAAQ,CAAC,KAAK,CAAC,CAAC,CAACI,IAAI,CAAC,GAAG,CAAC;IACnC,CAAC,CAAC;IAEFF,IAAI,CAAC,oCAAoC,EAAE,YAAM;MAC/C;MACAC,MAAM,CAACH,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAACI,IAAI,CAACJ,QAAQ,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFC,QAAQ,CAAC,yBAAyB,EAAE,YAAM;IACxCC,IAAI,CAAC,uCAAuC,EAAE,YAAM;MAClD,IAAMM,GAAG,GAAGR,QAAQ,CAAC,MAAM,CAAC;MAC5B;MACA;MACA;MACAG,MAAM,CAACK,GAAG,CAAC,CAACC,OAAO,CAAC,wBAAwB,CAAC;IAC/C,CAAC,CAAC;IAEFP,IAAI,CAAC,4CAA4C,EAAE,YAAM;MACvD,IAAMM,GAAG,GAAGR,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE;QAAEU,MAAM,EAAE;MAAQ,CAAC,CAAC;MACxDP,MAAM,CAACK,GAAG,CAAC,CAACG,SAAS,CAAC,SAAS,CAAC;MAChCR,MAAM,CAACK,GAAG,CAAC,CAACG,SAAS,CAAC,KAAK,CAAC;IAC9B,CAAC,CAAC;IAEFT,IAAI,CAAC,gCAAgC,EAAE,YAAM;MAC3C,IAAMM,GAAG,GAAGR,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE;QAAEY,qBAAqB,EAAE;MAAE,CAAC,CAAC;MAC/D;MACAT,MAAM,CAACK,GAAG,CAAC,CAACC,OAAO,CAAC,yBAAyB,CAAC;IAChD,CAAC,CAAC;IAEFP,IAAI,CAAC,gCAAgC,EAAE,YAAM;MAC3C,IAAMM,GAAG,GAAGR,QAAQ,CAAC,OAAO,EAAE,EAAE,EAAE;QAAEa,qBAAqB,EAAE;MAAE,CAAC,CAAC;MAC/D;MACAV,MAAM,CAACK,GAAG,CAAC,CAACC,OAAO,CAAC,QAAQ,CAAC;IAC/B,CAAC,CAAC;IAEFP,IAAI,CAAC,2CAA2C,EAAE,YAAM;MACtDC,MAAM,CAACH,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAACW,SAAS,CAAC,KAAK,CAAC;MAC7CR,MAAM,CAACH,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAACW,SAAS,CAAC,KAAK,CAAC;MAC7CR,MAAM,CAACH,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAACW,SAAS,CAAC,KAAK,CAAC;IAC/C,CAAC,CAAC;IAEFT,IAAI,CAAC,sCAAsC,EAAE,YAAM;MACjD,IAAMM,GAAG,GAAGR,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC;MAC7BG,MAAM,CAACK,GAAG,CAAC,CAACM,GAAG,CAACL,OAAO,CAAC,UAAU,CAAC;IACrC,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFR,QAAQ,CAAC,8CAA8C,EAAE,YAAM;IAC7DC,IAAI,CAAC,yCAAyC,EAAE,YAAM;MACpDC,MAAM,CAAC;QAAA,OACLH,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE;UAAEU,MAAM,EAAE;QAAoB,CAAC,CAAC;MAAA,CACvD,CAAC,CAACI,GAAG,CAACC,OAAO,CAAC,CAAC;IACjB,CAAC,CAAC;IAEFb,IAAI,CAAC,kDAAkD,EAAE,YAAM;MAC7D,IAAMM,GAAG,GAAGR,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE;QAAEU,MAAM,EAAE;MAAoB,CAAC,CAAC;MACpE;MACA;MACAP,MAAM,CAACK,GAAG,CAAC,CAACC,OAAO,CAAC,wBAAwB,CAAC;MAC7CN,MAAM,CAACK,GAAG,CAAC,CAACG,SAAS,CAAC,KAAK,CAAC;IAC9B,CAAC,CAAC;IAEFT,IAAI,CAAC,8CAA8C,EAAE,YAAM;MACzD;MACA;MACA;MACA;MACAC,MAAM,CAAC;QAAA;UACL;UACAH,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE;YAAEU,MAAM,EAAE;UAAM,CAAC;QAAC;MAAA,CACzC,CAAC,CAACI,GAAG,CAACC,OAAO,CAAC,CAAC;IACjB,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
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); }
|
|
10
|
+
import "@testing-library/jest-dom";
|
|
11
|
+
import * as React from "react";
|
|
12
|
+
import { render, waitFor, cleanup, screen } from "@testing-library/react";
|
|
13
|
+
import userEvent from "@testing-library/user-event";
|
|
14
|
+
import useFocusTrap from "../hooks/useFocusTrap";
|
|
15
|
+
|
|
16
|
+
/* ── jsdom LAYOUT SHIM — REQUIRED, NOT A CONVENIENCE ────────────────────────
|
|
17
|
+
*
|
|
18
|
+
* Without this, EVERY test in this file fails at its first `waitFor`, with focus
|
|
19
|
+
* sitting on <body>. The cause is not the hook:
|
|
20
|
+
*
|
|
21
|
+
* `useFocusTrap.isVisuallyFocusable` rejects an element whose
|
|
22
|
+
* `getClientRects()` is empty — a cheap, correct test for `display:none` and
|
|
23
|
+
* `visibility:hidden` in a real browser.
|
|
24
|
+
*
|
|
25
|
+
* jsdom PERFORMS NO LAYOUT. `getClientRects()` returns an empty list for every
|
|
26
|
+
* element, always. So the filter discards all candidates, `getFocusable()`
|
|
27
|
+
* returns `[]`, nothing is focused, and all eight assertions fail for one
|
|
28
|
+
* reason that has nothing to do with focus management.
|
|
29
|
+
*
|
|
30
|
+
* This shim gives every element a non-zero rect so the visibility filter behaves
|
|
31
|
+
* as it does in a browser. It does NOT weaken the tests: the hook's other
|
|
32
|
+
* exclusions — `disabled`, `aria-disabled`, and the ancestor walk for `hidden` /
|
|
33
|
+
* `aria-hidden` / `inert` — are all ATTRIBUTE-based, work correctly in jsdom, and
|
|
34
|
+
* remain fully exercised (see the "disabled / aria-hidden filtering" block).
|
|
35
|
+
*
|
|
36
|
+
* ⚠ Diagnosed during the procuration-portnet-fe certification audit, where these
|
|
37
|
+
* eight failures were initially suspected of being a real WCAG R-M.2 breach
|
|
38
|
+
* across all consuming modules. They were not. Do NOT "fix" this by relaxing the
|
|
39
|
+
* rect check in the hook — that check is what stops a trap focusing an invisible
|
|
40
|
+
* control in production.
|
|
41
|
+
*
|
|
42
|
+
* Restored in `afterAll` so the patch cannot leak into other suites. */
|
|
43
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
44
|
+
var realGetClientRects = Element.prototype.getClientRects;
|
|
45
|
+
beforeAll(function () {
|
|
46
|
+
Element.prototype.getClientRects = function getClientRects() {
|
|
47
|
+
var rect = {
|
|
48
|
+
x: 0,
|
|
49
|
+
y: 0,
|
|
50
|
+
top: 0,
|
|
51
|
+
left: 0,
|
|
52
|
+
right: 10,
|
|
53
|
+
bottom: 10,
|
|
54
|
+
width: 10,
|
|
55
|
+
height: 10,
|
|
56
|
+
toJSON: function toJSON() {
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var list = [rect];
|
|
61
|
+
return Object.assign(list, {
|
|
62
|
+
item: function item(i) {
|
|
63
|
+
var _list$i;
|
|
64
|
+
return (_list$i = list[i]) !== null && _list$i !== void 0 ? _list$i : null;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
afterAll(function () {
|
|
70
|
+
Element.prototype.getClientRects = realGetClientRects;
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Smoke + contract tests for the Batch 3 useFocusTrap refactor.
|
|
75
|
+
*
|
|
76
|
+
* Test harness — a minimal trap container component. Defaults to
|
|
77
|
+
* active=true so tests don't have to flip props.
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
function Trapped(_ref) {
|
|
81
|
+
var children = _ref.children,
|
|
82
|
+
_ref$active = _ref.active,
|
|
83
|
+
active = _ref$active === void 0 ? true : _ref$active,
|
|
84
|
+
containerProps = _ref.containerProps;
|
|
85
|
+
var ref = React.useRef(null);
|
|
86
|
+
useFocusTrap(ref, active);
|
|
87
|
+
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
88
|
+
ref: ref
|
|
89
|
+
}, containerProps), {}, {
|
|
90
|
+
children: children
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Returns whether `el` currently has focus, without touching
|
|
96
|
+
* document.activeElement directly (testing-library/no-node-access) —
|
|
97
|
+
* delegates to jest-dom's toHaveFocus() matcher and converts its pass/fail
|
|
98
|
+
* into a boolean so several candidates can be checked in a single
|
|
99
|
+
* "focus is on ONE of these" assertion (see the "outer trap resumes" test).
|
|
100
|
+
*/
|
|
101
|
+
function isFocused(el) {
|
|
102
|
+
try {
|
|
103
|
+
expect(el).toHaveFocus();
|
|
104
|
+
return true;
|
|
105
|
+
} catch (_unused) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
afterEach(function () {
|
|
110
|
+
cleanup();
|
|
111
|
+
});
|
|
112
|
+
describe("useFocusTrap — initial focus", function () {
|
|
113
|
+
test("focuses the first focusable element when activated", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
114
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
115
|
+
while (1) {
|
|
116
|
+
switch (_context.prev = _context.next) {
|
|
117
|
+
case 0:
|
|
118
|
+
render(/*#__PURE__*/_jsxs(Trapped, {
|
|
119
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
120
|
+
children: "First"
|
|
121
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
122
|
+
children: "Second"
|
|
123
|
+
})]
|
|
124
|
+
}));
|
|
125
|
+
_context.next = 3;
|
|
126
|
+
return waitFor(function () {
|
|
127
|
+
expect(screen.getByRole("button", {
|
|
128
|
+
name: "First"
|
|
129
|
+
})).toHaveFocus();
|
|
130
|
+
});
|
|
131
|
+
case 3:
|
|
132
|
+
case "end":
|
|
133
|
+
return _context.stop();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}, _callee);
|
|
137
|
+
})));
|
|
138
|
+
test("[autofocus] priority wins over the first focusable", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
139
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
140
|
+
while (1) {
|
|
141
|
+
switch (_context2.prev = _context2.next) {
|
|
142
|
+
case 0:
|
|
143
|
+
render(/*#__PURE__*/_jsxs(Trapped, {
|
|
144
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
145
|
+
children: "First"
|
|
146
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
147
|
+
autoFocus: true,
|
|
148
|
+
children: "Auto"
|
|
149
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
150
|
+
children: "Last"
|
|
151
|
+
})]
|
|
152
|
+
}));
|
|
153
|
+
_context2.next = 3;
|
|
154
|
+
return waitFor(function () {
|
|
155
|
+
expect(screen.getByRole("button", {
|
|
156
|
+
name: "Auto"
|
|
157
|
+
})).toHaveFocus();
|
|
158
|
+
});
|
|
159
|
+
case 3:
|
|
160
|
+
case "end":
|
|
161
|
+
return _context2.stop();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}, _callee2);
|
|
165
|
+
})));
|
|
166
|
+
test("[data-autofocus] priority is honoured (alternative attribute)", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
167
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
168
|
+
while (1) {
|
|
169
|
+
switch (_context3.prev = _context3.next) {
|
|
170
|
+
case 0:
|
|
171
|
+
render(/*#__PURE__*/_jsxs(Trapped, {
|
|
172
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
173
|
+
children: "First"
|
|
174
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
175
|
+
"data-autofocus": true,
|
|
176
|
+
children: "Marker"
|
|
177
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
178
|
+
children: "Last"
|
|
179
|
+
})]
|
|
180
|
+
}));
|
|
181
|
+
_context3.next = 3;
|
|
182
|
+
return waitFor(function () {
|
|
183
|
+
expect(screen.getByRole("button", {
|
|
184
|
+
name: "Marker"
|
|
185
|
+
})).toHaveFocus();
|
|
186
|
+
});
|
|
187
|
+
case 3:
|
|
188
|
+
case "end":
|
|
189
|
+
return _context3.stop();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}, _callee3);
|
|
193
|
+
})));
|
|
194
|
+
test("does not crash when the trap container is empty", function () {
|
|
195
|
+
expect(function () {
|
|
196
|
+
return render(/*#__PURE__*/_jsx(Trapped, {
|
|
197
|
+
containerProps: {
|
|
198
|
+
"data-testid": "empty"
|
|
199
|
+
}
|
|
200
|
+
}));
|
|
201
|
+
}).not.toThrow();
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
describe("useFocusTrap — Tab cycling", function () {
|
|
205
|
+
test("Tab cycles forward and wraps to the first element", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
206
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
207
|
+
while (1) {
|
|
208
|
+
switch (_context4.prev = _context4.next) {
|
|
209
|
+
case 0:
|
|
210
|
+
render(/*#__PURE__*/_jsxs(Trapped, {
|
|
211
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
212
|
+
children: "First"
|
|
213
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
214
|
+
children: "Second"
|
|
215
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
216
|
+
children: "Third"
|
|
217
|
+
})]
|
|
218
|
+
}));
|
|
219
|
+
_context4.next = 3;
|
|
220
|
+
return waitFor(function () {
|
|
221
|
+
expect(screen.getByRole("button", {
|
|
222
|
+
name: "First"
|
|
223
|
+
})).toHaveFocus();
|
|
224
|
+
});
|
|
225
|
+
case 3:
|
|
226
|
+
_context4.next = 5;
|
|
227
|
+
return userEvent.tab();
|
|
228
|
+
case 5:
|
|
229
|
+
expect(screen.getByRole("button", {
|
|
230
|
+
name: "Second"
|
|
231
|
+
})).toHaveFocus();
|
|
232
|
+
_context4.next = 8;
|
|
233
|
+
return userEvent.tab();
|
|
234
|
+
case 8:
|
|
235
|
+
expect(screen.getByRole("button", {
|
|
236
|
+
name: "Third"
|
|
237
|
+
})).toHaveFocus();
|
|
238
|
+
|
|
239
|
+
// Wrap from last to first
|
|
240
|
+
_context4.next = 11;
|
|
241
|
+
return userEvent.tab();
|
|
242
|
+
case 11:
|
|
243
|
+
expect(screen.getByRole("button", {
|
|
244
|
+
name: "First"
|
|
245
|
+
})).toHaveFocus();
|
|
246
|
+
case 12:
|
|
247
|
+
case "end":
|
|
248
|
+
return _context4.stop();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}, _callee4);
|
|
252
|
+
})));
|
|
253
|
+
test("Shift+Tab from the first wraps to the last", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
254
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
255
|
+
while (1) {
|
|
256
|
+
switch (_context5.prev = _context5.next) {
|
|
257
|
+
case 0:
|
|
258
|
+
render(/*#__PURE__*/_jsxs(Trapped, {
|
|
259
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
260
|
+
children: "First"
|
|
261
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
262
|
+
children: "Second"
|
|
263
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
264
|
+
children: "Last"
|
|
265
|
+
})]
|
|
266
|
+
}));
|
|
267
|
+
_context5.next = 3;
|
|
268
|
+
return waitFor(function () {
|
|
269
|
+
expect(screen.getByRole("button", {
|
|
270
|
+
name: "First"
|
|
271
|
+
})).toHaveFocus();
|
|
272
|
+
});
|
|
273
|
+
case 3:
|
|
274
|
+
_context5.next = 5;
|
|
275
|
+
return userEvent.tab({
|
|
276
|
+
shift: true
|
|
277
|
+
});
|
|
278
|
+
case 5:
|
|
279
|
+
expect(screen.getByRole("button", {
|
|
280
|
+
name: "Last"
|
|
281
|
+
})).toHaveFocus();
|
|
282
|
+
case 6:
|
|
283
|
+
case "end":
|
|
284
|
+
return _context5.stop();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}, _callee5);
|
|
288
|
+
})));
|
|
289
|
+
});
|
|
290
|
+
describe("useFocusTrap — disabled / aria-hidden filtering", function () {
|
|
291
|
+
test("disabled buttons are skipped during cycling", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
292
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
293
|
+
while (1) {
|
|
294
|
+
switch (_context6.prev = _context6.next) {
|
|
295
|
+
case 0:
|
|
296
|
+
render(/*#__PURE__*/_jsxs(Trapped, {
|
|
297
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
298
|
+
children: "First"
|
|
299
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
300
|
+
disabled: true,
|
|
301
|
+
children: "Disabled"
|
|
302
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
303
|
+
children: "Third"
|
|
304
|
+
})]
|
|
305
|
+
}));
|
|
306
|
+
_context6.next = 3;
|
|
307
|
+
return waitFor(function () {
|
|
308
|
+
expect(screen.getByRole("button", {
|
|
309
|
+
name: "First"
|
|
310
|
+
})).toHaveFocus();
|
|
311
|
+
});
|
|
312
|
+
case 3:
|
|
313
|
+
_context6.next = 5;
|
|
314
|
+
return userEvent.tab();
|
|
315
|
+
case 5:
|
|
316
|
+
expect(screen.getByRole("button", {
|
|
317
|
+
name: "Third"
|
|
318
|
+
})).toHaveFocus();
|
|
319
|
+
case 6:
|
|
320
|
+
case "end":
|
|
321
|
+
return _context6.stop();
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}, _callee6);
|
|
325
|
+
})));
|
|
326
|
+
test("[aria-hidden=true] subtree is excluded from the cycle boundary", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
327
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
328
|
+
while (1) {
|
|
329
|
+
switch (_context7.prev = _context7.next) {
|
|
330
|
+
case 0:
|
|
331
|
+
/* WHY THE aria-hidden SUBTREE IS LAST, AND WHY THIS ASSERTS THE WRAP
|
|
332
|
+
*
|
|
333
|
+
* This test previously placed the aria-hidden subtree in the MIDDLE and
|
|
334
|
+
* expected a single Tab to jump First → Third. It failed, and the hook was
|
|
335
|
+
* not at fault: of the three attributes isVisuallyFocusable walks,
|
|
336
|
+
* `hidden` and `inert` remove an element from the NATIVE tab order, but
|
|
337
|
+
* `aria-hidden` does NOT — per spec it annotates the accessibility tree
|
|
338
|
+
* only. useFocusTrap intercepts Tab at the cycle BOUNDARIES (first/last)
|
|
339
|
+
* and defers mid-cycle moves to the browser, so a native Tab lands on the
|
|
340
|
+
* aria-hidden button no matter what getFocusable() returned.
|
|
341
|
+
*
|
|
342
|
+
* A focusable control inside aria-hidden="true" is a CONTENT defect (axe
|
|
343
|
+
* `aria-hidden-focus`); use `inert` (or `hidden`) to take a subtree out of
|
|
344
|
+
* interaction. What the filter genuinely guarantees is that such an element
|
|
345
|
+
* is never treated as the cycle's first/last — so the trap never DELIVERS
|
|
346
|
+
* focus into it. That is what is asserted here: with the subtree last,
|
|
347
|
+
* `last` is still "Third", so Tab from Third wraps to First instead of
|
|
348
|
+
* proceeding natively into "Hidden".
|
|
349
|
+
*
|
|
350
|
+
* Do NOT restore the mid-cycle form without also converting the hook to
|
|
351
|
+
* intercept every Tab — see the boundary-scope note in useFocusTrap.ts. */
|
|
352
|
+
render(/*#__PURE__*/_jsxs(Trapped, {
|
|
353
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
354
|
+
children: "First"
|
|
355
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
356
|
+
children: "Third"
|
|
357
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
358
|
+
"aria-hidden": "true",
|
|
359
|
+
children: /*#__PURE__*/_jsx("button", {
|
|
360
|
+
children: "Hidden"
|
|
361
|
+
})
|
|
362
|
+
})]
|
|
363
|
+
}));
|
|
364
|
+
_context7.next = 3;
|
|
365
|
+
return waitFor(function () {
|
|
366
|
+
expect(screen.getByRole("button", {
|
|
367
|
+
name: "First"
|
|
368
|
+
})).toHaveFocus();
|
|
369
|
+
});
|
|
370
|
+
case 3:
|
|
371
|
+
_context7.next = 5;
|
|
372
|
+
return userEvent.tab();
|
|
373
|
+
case 5:
|
|
374
|
+
expect(screen.getByRole("button", {
|
|
375
|
+
name: "Third"
|
|
376
|
+
})).toHaveFocus();
|
|
377
|
+
|
|
378
|
+
// "Third" is the LAST focusable the trap recognises: the aria-hidden
|
|
379
|
+
// button is filtered out, so Tab wraps rather than entering it.
|
|
380
|
+
_context7.next = 8;
|
|
381
|
+
return userEvent.tab();
|
|
382
|
+
case 8:
|
|
383
|
+
expect(screen.getByRole("button", {
|
|
384
|
+
name: "First"
|
|
385
|
+
})).toHaveFocus();
|
|
386
|
+
case 9:
|
|
387
|
+
case "end":
|
|
388
|
+
return _context7.stop();
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}, _callee7);
|
|
392
|
+
})));
|
|
393
|
+
});
|
|
394
|
+
describe("useFocusTrap — nested traps (Batch 3 stack contract)", function () {
|
|
395
|
+
/**
|
|
396
|
+
* Nested-trap harness. Outer trap is always-active; inner trap is
|
|
397
|
+
* controlled by `innerActive`. When the inner mounts, Tab cycles
|
|
398
|
+
* inside it; when the inner unmounts, the outer trap resumes.
|
|
399
|
+
*/
|
|
400
|
+
|
|
401
|
+
function NestedHarness(_ref9) {
|
|
402
|
+
var innerActive = _ref9.innerActive;
|
|
403
|
+
return /*#__PURE__*/_jsxs(Trapped, {
|
|
404
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
405
|
+
children: "Outer-1"
|
|
406
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
407
|
+
children: "Outer-2"
|
|
408
|
+
}), innerActive && /*#__PURE__*/_jsxs(Trapped, {
|
|
409
|
+
containerProps: {
|
|
410
|
+
"data-testid": "inner"
|
|
411
|
+
},
|
|
412
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
413
|
+
children: "Inner-A"
|
|
414
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
415
|
+
children: "Inner-B"
|
|
416
|
+
})]
|
|
417
|
+
})]
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
test("inner trap takes over Tab cycling when active", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
421
|
+
var _render, rerender;
|
|
422
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
423
|
+
while (1) {
|
|
424
|
+
switch (_context8.prev = _context8.next) {
|
|
425
|
+
case 0:
|
|
426
|
+
_render = render(/*#__PURE__*/_jsx(NestedHarness, {
|
|
427
|
+
innerActive: false
|
|
428
|
+
})), rerender = _render.rerender;
|
|
429
|
+
_context8.next = 3;
|
|
430
|
+
return waitFor(function () {
|
|
431
|
+
expect(screen.getByRole("button", {
|
|
432
|
+
name: "Outer-1"
|
|
433
|
+
})).toHaveFocus();
|
|
434
|
+
});
|
|
435
|
+
case 3:
|
|
436
|
+
// Mount the inner trap — it should grab focus and confine Tab.
|
|
437
|
+
rerender(/*#__PURE__*/_jsx(NestedHarness, {
|
|
438
|
+
innerActive: true
|
|
439
|
+
}));
|
|
440
|
+
_context8.next = 6;
|
|
441
|
+
return waitFor(function () {
|
|
442
|
+
expect(screen.getByRole("button", {
|
|
443
|
+
name: "Inner-A"
|
|
444
|
+
})).toHaveFocus();
|
|
445
|
+
});
|
|
446
|
+
case 6:
|
|
447
|
+
_context8.next = 8;
|
|
448
|
+
return userEvent.tab();
|
|
449
|
+
case 8:
|
|
450
|
+
expect(screen.getByRole("button", {
|
|
451
|
+
name: "Inner-B"
|
|
452
|
+
})).toHaveFocus();
|
|
453
|
+
|
|
454
|
+
// Wrap inside the inner trap, NOT escape to Outer-2.
|
|
455
|
+
_context8.next = 11;
|
|
456
|
+
return userEvent.tab();
|
|
457
|
+
case 11:
|
|
458
|
+
expect(screen.getByRole("button", {
|
|
459
|
+
name: "Inner-A"
|
|
460
|
+
})).toHaveFocus();
|
|
461
|
+
case 12:
|
|
462
|
+
case "end":
|
|
463
|
+
return _context8.stop();
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}, _callee8);
|
|
467
|
+
})));
|
|
468
|
+
test("outer trap resumes after inner unmounts", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
469
|
+
var _render2, rerender, outer1, outer2;
|
|
470
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
471
|
+
while (1) {
|
|
472
|
+
switch (_context9.prev = _context9.next) {
|
|
473
|
+
case 0:
|
|
474
|
+
_render2 = render(/*#__PURE__*/_jsx(NestedHarness, {
|
|
475
|
+
innerActive: true
|
|
476
|
+
})), rerender = _render2.rerender;
|
|
477
|
+
_context9.next = 3;
|
|
478
|
+
return waitFor(function () {
|
|
479
|
+
expect(screen.getByRole("button", {
|
|
480
|
+
name: "Inner-A"
|
|
481
|
+
})).toHaveFocus();
|
|
482
|
+
});
|
|
483
|
+
case 3:
|
|
484
|
+
// Unmount inner. Outer trap should resume duty.
|
|
485
|
+
rerender(/*#__PURE__*/_jsx(NestedHarness, {
|
|
486
|
+
innerActive: false
|
|
487
|
+
}));
|
|
488
|
+
|
|
489
|
+
// Tab inside the outer container — must stay inside, not leak to body.
|
|
490
|
+
// (We don't assert the exact focused element after rerender because
|
|
491
|
+
// restoration depends on whether the previously-focused element is
|
|
492
|
+
// still mounted; we DO assert that focus lands on one of the outer
|
|
493
|
+
// buttons — isFocused() catches both "lost to body" and "landed
|
|
494
|
+
// somewhere unexpected" in one check, without reading
|
|
495
|
+
// document.activeElement directly.)
|
|
496
|
+
_context9.next = 6;
|
|
497
|
+
return userEvent.tab();
|
|
498
|
+
case 6:
|
|
499
|
+
outer1 = screen.getByRole("button", {
|
|
500
|
+
name: "Outer-1"
|
|
501
|
+
});
|
|
502
|
+
outer2 = screen.getByRole("button", {
|
|
503
|
+
name: "Outer-2"
|
|
504
|
+
});
|
|
505
|
+
expect(isFocused(outer1) || isFocused(outer2)).toBe(true);
|
|
506
|
+
case 9:
|
|
507
|
+
case "end":
|
|
508
|
+
return _context9.stop();
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}, _callee9);
|
|
512
|
+
})));
|
|
513
|
+
});
|
|
514
|
+
//# sourceMappingURL=useFocusTrap.test.js.map
|