@slipstream-ui/core 0.7.0 → 0.9.0
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/index.d.mts +317 -21
- package/dist/index.d.ts +317 -21
- package/dist/index.js +2004 -1069
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1998 -1068
- package/dist/index.mjs.map +1 -1
- package/dist/manifests/accordion.manifest.json +8 -2
- package/dist/manifests/alert.manifest.json +1 -1
- package/dist/manifests/announcement-bar.manifest.json +1 -1
- package/dist/manifests/app-shell.manifest.json +1 -1
- package/dist/manifests/applied-filters.manifest.json +1 -1
- package/dist/manifests/article-card.manifest.json +1 -1
- package/dist/manifests/auth-layout.manifest.json +19 -1
- package/dist/manifests/autocomplete.manifest.json +1 -1
- package/dist/manifests/avatar.manifest.json +1 -1
- package/dist/manifests/badge.manifest.json +13 -1
- package/dist/manifests/block.manifest.json +1 -1
- package/dist/manifests/bottom-nav.manifest.json +130 -0
- package/dist/manifests/breadcrumb.manifest.json +1 -1
- package/dist/manifests/button-group.manifest.json +1 -1
- package/dist/manifests/button.manifest.json +1 -1
- package/dist/manifests/calendar.manifest.json +175 -0
- package/dist/manifests/card.manifest.json +1 -1
- package/dist/manifests/checkbox.manifest.json +1 -1
- package/dist/manifests/comparison-table.manifest.json +1 -1
- package/dist/manifests/confirm-dialog.manifest.json +1 -1
- package/dist/manifests/contact-strip.manifest.json +1 -1
- package/dist/manifests/container.manifest.json +1 -1
- package/dist/manifests/cta-section.manifest.json +1 -1
- package/dist/manifests/data-table.manifest.json +8 -1
- package/dist/manifests/date-picker-popover.manifest.json +202 -0
- package/dist/manifests/date-picker.manifest.json +1 -1
- package/dist/manifests/date-range-picker.manifest.json +1 -1
- package/dist/manifests/deal-card.manifest.json +1 -1
- package/dist/manifests/dialog.manifest.json +1 -1
- package/dist/manifests/document-card.manifest.json +1 -1
- package/dist/manifests/drawer.manifest.json +48 -2
- package/dist/manifests/empty-state.manifest.json +1 -1
- package/dist/manifests/entity-card.manifest.json +1 -1
- package/dist/manifests/feature-grid.manifest.json +1 -1
- package/dist/manifests/feature-row.manifest.json +1 -1
- package/dist/manifests/fieldset.manifest.json +1 -1
- package/dist/manifests/file-upload.manifest.json +1 -1
- package/dist/manifests/filter-bar.manifest.json +1 -1
- package/dist/manifests/filter-chips.manifest.json +1 -1
- package/dist/manifests/filter-panel.manifest.json +1 -1
- package/dist/manifests/flex.manifest.json +1 -1
- package/dist/manifests/form-field.manifest.json +1 -1
- package/dist/manifests/form-layout.manifest.json +1 -1
- package/dist/manifests/form.manifest.json +1 -1
- package/dist/manifests/grid.manifest.json +1 -1
- package/dist/manifests/heading.manifest.json +1 -1
- package/dist/manifests/hero.manifest.json +1 -1
- package/dist/manifests/image.manifest.json +142 -0
- package/dist/manifests/input-group.manifest.json +1 -1
- package/dist/manifests/input.manifest.json +1 -1
- package/dist/manifests/label.manifest.json +1 -1
- package/dist/manifests/link-tabs.manifest.json +1 -1
- package/dist/manifests/link.manifest.json +1 -1
- package/dist/manifests/list.manifest.json +1 -1
- package/dist/manifests/load-more.manifest.json +1 -1
- package/dist/manifests/logo-cloud.manifest.json +1 -1
- package/dist/manifests/menu.manifest.json +1 -1
- package/dist/manifests/metric-card.manifest.json +36 -4
- package/dist/manifests/multi-select.manifest.json +1 -1
- package/dist/manifests/newsletter.manifest.json +1 -1
- package/dist/manifests/page-header.manifest.json +7 -1
- package/dist/manifests/pagination.manifest.json +1 -1
- package/dist/manifests/password-input.manifest.json +1 -1
- package/dist/manifests/popover.manifest.json +86 -4
- package/dist/manifests/process-steps.manifest.json +1 -1
- package/dist/manifests/progress.manifest.json +1 -1
- package/dist/manifests/prose.manifest.json +1 -1
- package/dist/manifests/radio.manifest.json +1 -1
- package/dist/manifests/range-slider.manifest.json +1 -1
- package/dist/manifests/search.manifest.json +1 -1
- package/dist/manifests/section-heading.manifest.json +1 -1
- package/dist/manifests/section.manifest.json +1 -1
- package/dist/manifests/segmented-control.manifest.json +1 -1
- package/dist/manifests/select-menu.manifest.json +1 -1
- package/dist/manifests/select.manifest.json +1 -1
- package/dist/manifests/separator.manifest.json +1 -1
- package/dist/manifests/site-footer.manifest.json +1 -1
- package/dist/manifests/site-header.manifest.json +13 -3
- package/dist/manifests/skeleton.manifest.json +1 -1
- package/dist/manifests/spinner.manifest.json +1 -1
- package/dist/manifests/stat-band.manifest.json +1 -1
- package/dist/manifests/stepper.manifest.json +7 -1
- package/dist/manifests/switch.manifest.json +1 -1
- package/dist/manifests/table-card.manifest.json +1 -1
- package/dist/manifests/table-of-contents.manifest.json +1 -1
- package/dist/manifests/table.manifest.json +1 -1
- package/dist/manifests/tabs.manifest.json +1 -1
- package/dist/manifests/testimonial.manifest.json +1 -1
- package/dist/manifests/text.manifest.json +1 -1
- package/dist/manifests/textarea.manifest.json +1 -1
- package/dist/manifests/theme-toggle.manifest.json +1 -1
- package/dist/manifests/time-picker.manifest.json +1 -1
- package/dist/manifests/timeline.manifest.json +1 -1
- package/dist/manifests/toast.manifest.json +1 -1
- package/dist/manifests/tombstone-card.manifest.json +1 -1
- package/dist/manifests/tooltip.manifest.json +1 -1
- package/dist/src/components/accordion/Accordion.d.ts +17 -1
- package/dist/src/components/accordion/Accordion.js +5 -1
- package/dist/src/components/accordion/Accordion.js.map +1 -1
- package/dist/src/components/accordion/Accordion.mjs +5 -1
- package/dist/src/components/accordion/Accordion.mjs.map +1 -1
- package/dist/src/components/alert/Alert.js +1 -1
- package/dist/src/components/alert/Alert.js.map +1 -1
- package/dist/src/components/alert/Alert.mjs +1 -1
- package/dist/src/components/alert/Alert.mjs.map +1 -1
- package/dist/src/components/app-shell/AppShell.js +1 -1
- package/dist/src/components/app-shell/AppShell.js.map +1 -1
- package/dist/src/components/app-shell/AppShell.mjs +1 -1
- package/dist/src/components/app-shell/AppShell.mjs.map +1 -1
- package/dist/src/components/article-card/ArticleCard.js +2 -2
- package/dist/src/components/article-card/ArticleCard.js.map +1 -1
- package/dist/src/components/article-card/ArticleCard.mjs +2 -2
- package/dist/src/components/article-card/ArticleCard.mjs.map +1 -1
- package/dist/src/components/auth-layout/AuthLayout.d.ts +14 -2
- package/dist/src/components/auth-layout/AuthLayout.js +10 -2
- package/dist/src/components/auth-layout/AuthLayout.js.map +1 -1
- package/dist/src/components/auth-layout/AuthLayout.mjs +10 -2
- package/dist/src/components/auth-layout/AuthLayout.mjs.map +1 -1
- package/dist/src/components/badge/Badge.d.ts +2 -0
- package/dist/src/components/badge/Badge.js +9 -3
- package/dist/src/components/badge/Badge.js.map +1 -1
- package/dist/src/components/badge/Badge.mjs +9 -3
- package/dist/src/components/badge/Badge.mjs.map +1 -1
- package/dist/src/components/bottom-nav/BottomNav.d.ts +36 -0
- package/dist/src/components/bottom-nav/BottomNav.js +90 -0
- package/dist/src/components/bottom-nav/BottomNav.js.map +1 -0
- package/dist/src/components/bottom-nav/BottomNav.mjs +66 -0
- package/dist/src/components/bottom-nav/BottomNav.mjs.map +1 -0
- package/dist/src/components/bottom-nav/index.d.ts +1 -0
- package/dist/src/components/bottom-nav/index.js +23 -0
- package/dist/src/components/bottom-nav/index.js.map +1 -0
- package/dist/src/components/bottom-nav/index.mjs +2 -0
- package/dist/src/components/bottom-nav/index.mjs.map +1 -0
- package/dist/src/components/calendar/Calendar.d.ts +34 -0
- package/dist/src/components/calendar/Calendar.js +233 -0
- package/dist/src/components/calendar/Calendar.js.map +1 -0
- package/dist/src/components/calendar/Calendar.mjs +208 -0
- package/dist/src/components/calendar/Calendar.mjs.map +1 -0
- package/dist/src/components/calendar/index.d.ts +1 -0
- package/dist/src/components/calendar/index.js +23 -0
- package/dist/src/components/calendar/index.js.map +1 -0
- package/dist/src/components/calendar/index.mjs +2 -0
- package/dist/src/components/calendar/index.mjs.map +1 -0
- package/dist/src/components/comparison-table/ComparisonTable.js +1 -1
- package/dist/src/components/comparison-table/ComparisonTable.js.map +1 -1
- package/dist/src/components/comparison-table/ComparisonTable.mjs +1 -1
- package/dist/src/components/comparison-table/ComparisonTable.mjs.map +1 -1
- package/dist/src/components/cta-section/CTASection.js +1 -1
- package/dist/src/components/cta-section/CTASection.js.map +1 -1
- package/dist/src/components/cta-section/CTASection.mjs +1 -1
- package/dist/src/components/cta-section/CTASection.mjs.map +1 -1
- package/dist/src/components/data-table/DataTable.d.ts +3 -1
- package/dist/src/components/data-table/DataTable.js +2 -4
- package/dist/src/components/data-table/DataTable.js.map +1 -1
- package/dist/src/components/data-table/DataTable.mjs +2 -4
- package/dist/src/components/data-table/DataTable.mjs.map +1 -1
- package/dist/src/components/date-picker-popover/DatePickerPopover.d.ts +33 -0
- package/dist/src/components/date-picker-popover/DatePickerPopover.js +117 -0
- package/dist/src/components/date-picker-popover/DatePickerPopover.js.map +1 -0
- package/dist/src/components/date-picker-popover/DatePickerPopover.mjs +83 -0
- package/dist/src/components/date-picker-popover/DatePickerPopover.mjs.map +1 -0
- package/dist/src/components/date-picker-popover/index.d.ts +1 -0
- package/dist/src/components/date-picker-popover/index.js +23 -0
- package/dist/src/components/date-picker-popover/index.js.map +1 -0
- package/dist/src/components/date-picker-popover/index.mjs +2 -0
- package/dist/src/components/date-picker-popover/index.mjs.map +1 -0
- package/dist/src/components/drawer/Drawer.d.ts +25 -2
- package/dist/src/components/drawer/Drawer.js +97 -6
- package/dist/src/components/drawer/Drawer.js.map +1 -1
- package/dist/src/components/drawer/Drawer.mjs +97 -6
- package/dist/src/components/drawer/Drawer.mjs.map +1 -1
- package/dist/src/components/empty-state/EmptyState.d.ts +13 -4
- package/dist/src/components/empty-state/EmptyState.js +13 -1
- package/dist/src/components/empty-state/EmptyState.js.map +1 -1
- package/dist/src/components/empty-state/EmptyState.mjs +13 -1
- package/dist/src/components/empty-state/EmptyState.mjs.map +1 -1
- package/dist/src/components/image/Image.d.ts +34 -0
- package/dist/src/components/image/Image.js +75 -0
- package/dist/src/components/image/Image.js.map +1 -0
- package/dist/src/components/image/Image.mjs +41 -0
- package/dist/src/components/image/Image.mjs.map +1 -0
- package/dist/src/components/image/index.d.ts +1 -0
- package/dist/src/components/image/index.js +29 -0
- package/dist/src/components/image/index.js.map +1 -0
- package/dist/src/components/image/index.mjs +5 -0
- package/dist/src/components/image/index.mjs.map +1 -0
- package/dist/src/components/link/Link.js +4 -4
- package/dist/src/components/link/Link.js.map +1 -1
- package/dist/src/components/link/Link.mjs +4 -4
- package/dist/src/components/link/Link.mjs.map +1 -1
- package/dist/src/components/metric-card/MetricCard.d.ts +23 -4
- package/dist/src/components/metric-card/MetricCard.js +32 -5
- package/dist/src/components/metric-card/MetricCard.js.map +1 -1
- package/dist/src/components/metric-card/MetricCard.mjs +32 -5
- package/dist/src/components/metric-card/MetricCard.mjs.map +1 -1
- package/dist/src/components/page-header/PageHeader.d.ts +4 -0
- package/dist/src/components/page-header/PageHeader.js +4 -3
- package/dist/src/components/page-header/PageHeader.js.map +1 -1
- package/dist/src/components/page-header/PageHeader.mjs +4 -3
- package/dist/src/components/page-header/PageHeader.mjs.map +1 -1
- package/dist/src/components/popover/Popover.d.ts +36 -3
- package/dist/src/components/popover/Popover.js +118 -22
- package/dist/src/components/popover/Popover.js.map +1 -1
- package/dist/src/components/popover/Popover.mjs +117 -22
- package/dist/src/components/popover/Popover.mjs.map +1 -1
- package/dist/src/components/section-heading/SectionHeading.js +1 -1
- package/dist/src/components/section-heading/SectionHeading.js.map +1 -1
- package/dist/src/components/section-heading/SectionHeading.mjs +1 -1
- package/dist/src/components/section-heading/SectionHeading.mjs.map +1 -1
- package/dist/src/components/separator/Separator.d.ts +3 -3
- package/dist/src/components/site-header/SiteHeader.d.ts +25 -3
- package/dist/src/components/site-header/SiteHeader.js +141 -6
- package/dist/src/components/site-header/SiteHeader.js.map +1 -1
- package/dist/src/components/site-header/SiteHeader.mjs +141 -6
- package/dist/src/components/site-header/SiteHeader.mjs.map +1 -1
- package/dist/src/components/stepper/Stepper.d.ts +18 -0
- package/dist/src/components/stepper/Stepper.js +2 -1
- package/dist/src/components/stepper/Stepper.js.map +1 -1
- package/dist/src/components/stepper/Stepper.mjs +2 -1
- package/dist/src/components/stepper/Stepper.mjs.map +1 -1
- package/dist/src/index.d.ts +4 -0
- package/dist/src/utils/date.d.ts +32 -0
- package/dist/src/utils/date.js +171 -0
- package/dist/src/utils/date.js.map +1 -0
- package/dist/src/utils/date.mjs +134 -0
- package/dist/src/utils/date.mjs.map +1 -0
- package/dist/src/utils/position.d.ts +42 -0
- package/dist/src/utils/position.js +91 -0
- package/dist/src/utils/position.js.map +1 -0
- package/dist/src/utils/position.mjs +67 -0
- package/dist/src/utils/position.mjs.map +1 -0
- package/dist/styles-full.css +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/src/components/accordion/Accordion.test.tsx +31 -0
- package/src/components/accordion/Accordion.tsx +27 -2
- package/src/components/alert/Alert.tsx +1 -1
- package/src/components/app-shell/AppShell.tsx +1 -1
- package/src/components/article-card/ArticleCard.tsx +2 -2
- package/src/components/auth-layout/AuthLayout.test.tsx +36 -0
- package/src/components/auth-layout/AuthLayout.tsx +20 -3
- package/src/components/badge/Badge.test.tsx +7 -0
- package/src/components/badge/Badge.tsx +8 -2
- package/src/components/bottom-nav/BottomNav.test.tsx +48 -0
- package/src/components/bottom-nav/BottomNav.tsx +117 -0
- package/src/components/bottom-nav/index.ts +1 -0
- package/src/components/calendar/Calendar.test.tsx +277 -0
- package/src/components/calendar/Calendar.tsx +273 -0
- package/src/components/calendar/index.ts +1 -0
- package/src/components/comparison-table/ComparisonTable.tsx +1 -1
- package/src/components/cta-section/CTASection.tsx +1 -1
- package/src/components/data-table/DataTable.test.tsx +21 -0
- package/src/components/data-table/DataTable.tsx +4 -1
- package/src/components/date-picker-popover/DatePickerPopover.test.tsx +223 -0
- package/src/components/date-picker-popover/DatePickerPopover.tsx +117 -0
- package/src/components/date-picker-popover/index.ts +1 -0
- package/src/components/drawer/Drawer.test.tsx +86 -1
- package/src/components/drawer/Drawer.tsx +135 -7
- package/src/components/empty-state/EmptyState.test.tsx +26 -1
- package/src/components/empty-state/EmptyState.tsx +40 -3
- package/src/components/image/Image.test.tsx +94 -0
- package/src/components/image/Image.tsx +71 -0
- package/src/components/image/index.ts +1 -0
- package/src/components/link/Link.test.tsx +2 -1
- package/src/components/link/Link.tsx +4 -4
- package/src/components/metric-card/MetricCard.test.tsx +32 -0
- package/src/components/metric-card/MetricCard.tsx +45 -7
- package/src/components/page-header/PageHeader.test.tsx +13 -0
- package/src/components/page-header/PageHeader.tsx +6 -3
- package/src/components/popover/Popover.test.tsx +307 -3
- package/src/components/popover/Popover.tsx +228 -91
- package/src/components/section-heading/SectionHeading.tsx +1 -1
- package/src/components/site-header/SiteHeader.test.tsx +103 -1
- package/src/components/site-header/SiteHeader.tsx +220 -16
- package/src/components/stepper/Stepper.test.tsx +12 -0
- package/src/components/stepper/Stepper.tsx +15 -1
- package/src/index.ts +4 -0
- package/src/manifests/accordion.manifest.json +8 -2
- package/src/manifests/alert.manifest.json +1 -1
- package/src/manifests/announcement-bar.manifest.json +1 -1
- package/src/manifests/app-shell.manifest.json +1 -1
- package/src/manifests/applied-filters.manifest.json +1 -1
- package/src/manifests/article-card.manifest.json +1 -1
- package/src/manifests/auth-layout.manifest.json +19 -1
- package/src/manifests/autocomplete.manifest.json +1 -1
- package/src/manifests/avatar.manifest.json +1 -1
- package/src/manifests/badge.manifest.json +13 -1
- package/src/manifests/block.manifest.json +1 -1
- package/src/manifests/bottom-nav.manifest.json +130 -0
- package/src/manifests/breadcrumb.manifest.json +1 -1
- package/src/manifests/button-group.manifest.json +1 -1
- package/src/manifests/button.manifest.json +1 -1
- package/src/manifests/calendar.manifest.json +175 -0
- package/src/manifests/card.manifest.json +1 -1
- package/src/manifests/checkbox.manifest.json +1 -1
- package/src/manifests/comparison-table.manifest.json +1 -1
- package/src/manifests/confirm-dialog.manifest.json +1 -1
- package/src/manifests/contact-strip.manifest.json +1 -1
- package/src/manifests/container.manifest.json +1 -1
- package/src/manifests/cta-section.manifest.json +1 -1
- package/src/manifests/data-table.manifest.json +8 -1
- package/src/manifests/date-picker-popover.manifest.json +202 -0
- package/src/manifests/date-picker.manifest.json +1 -1
- package/src/manifests/date-range-picker.manifest.json +1 -1
- package/src/manifests/deal-card.manifest.json +1 -1
- package/src/manifests/dialog.manifest.json +1 -1
- package/src/manifests/document-card.manifest.json +1 -1
- package/src/manifests/drawer.manifest.json +48 -2
- package/src/manifests/empty-state.manifest.json +1 -1
- package/src/manifests/entity-card.manifest.json +1 -1
- package/src/manifests/feature-grid.manifest.json +1 -1
- package/src/manifests/feature-row.manifest.json +1 -1
- package/src/manifests/fieldset.manifest.json +1 -1
- package/src/manifests/file-upload.manifest.json +1 -1
- package/src/manifests/filter-bar.manifest.json +1 -1
- package/src/manifests/filter-chips.manifest.json +1 -1
- package/src/manifests/filter-panel.manifest.json +1 -1
- package/src/manifests/flex.manifest.json +1 -1
- package/src/manifests/form-field.manifest.json +1 -1
- package/src/manifests/form-layout.manifest.json +1 -1
- package/src/manifests/form.manifest.json +1 -1
- package/src/manifests/grid.manifest.json +1 -1
- package/src/manifests/heading.manifest.json +1 -1
- package/src/manifests/hero.manifest.json +1 -1
- package/src/manifests/image.manifest.json +142 -0
- package/src/manifests/input-group.manifest.json +1 -1
- package/src/manifests/input.manifest.json +1 -1
- package/src/manifests/label.manifest.json +1 -1
- package/src/manifests/link-tabs.manifest.json +1 -1
- package/src/manifests/link.manifest.json +1 -1
- package/src/manifests/list.manifest.json +1 -1
- package/src/manifests/load-more.manifest.json +1 -1
- package/src/manifests/logo-cloud.manifest.json +1 -1
- package/src/manifests/menu.manifest.json +1 -1
- package/src/manifests/metric-card.manifest.json +36 -4
- package/src/manifests/multi-select.manifest.json +1 -1
- package/src/manifests/newsletter.manifest.json +1 -1
- package/src/manifests/page-header.manifest.json +7 -1
- package/src/manifests/pagination.manifest.json +1 -1
- package/src/manifests/password-input.manifest.json +1 -1
- package/src/manifests/popover.manifest.json +86 -4
- package/src/manifests/process-steps.manifest.json +1 -1
- package/src/manifests/progress.manifest.json +1 -1
- package/src/manifests/prose.manifest.json +1 -1
- package/src/manifests/radio.manifest.json +1 -1
- package/src/manifests/range-slider.manifest.json +1 -1
- package/src/manifests/search.manifest.json +1 -1
- package/src/manifests/section-heading.manifest.json +1 -1
- package/src/manifests/section.manifest.json +1 -1
- package/src/manifests/segmented-control.manifest.json +1 -1
- package/src/manifests/select-menu.manifest.json +1 -1
- package/src/manifests/select.manifest.json +1 -1
- package/src/manifests/separator.manifest.json +1 -1
- package/src/manifests/site-footer.manifest.json +1 -1
- package/src/manifests/site-header.manifest.json +13 -3
- package/src/manifests/skeleton.manifest.json +1 -1
- package/src/manifests/spinner.manifest.json +1 -1
- package/src/manifests/stat-band.manifest.json +1 -1
- package/src/manifests/stepper.manifest.json +7 -1
- package/src/manifests/switch.manifest.json +1 -1
- package/src/manifests/table-card.manifest.json +1 -1
- package/src/manifests/table-of-contents.manifest.json +1 -1
- package/src/manifests/table.manifest.json +1 -1
- package/src/manifests/tabs.manifest.json +1 -1
- package/src/manifests/testimonial.manifest.json +1 -1
- package/src/manifests/text.manifest.json +1 -1
- package/src/manifests/textarea.manifest.json +1 -1
- package/src/manifests/theme-toggle.manifest.json +1 -1
- package/src/manifests/time-picker.manifest.json +1 -1
- package/src/manifests/timeline.manifest.json +1 -1
- package/src/manifests/toast.manifest.json +1 -1
- package/src/manifests/tombstone-card.manifest.json +1 -1
- package/src/manifests/tooltip.manifest.json +1 -1
- package/src/utils/date.test.ts +190 -0
- package/src/utils/date.ts +162 -0
- package/src/utils/position.test.ts +227 -0
- package/src/utils/position.ts +129 -0
|
@@ -3,14 +3,19 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
5
|
import { cn } from '../../utils/cn';
|
|
6
|
+
import { computePosition, type Align, type PositionResult, type Side } from '../../utils/position';
|
|
6
7
|
|
|
7
8
|
type PopoverContextValue = {
|
|
8
9
|
open: boolean;
|
|
9
10
|
setOpen: (open: boolean) => void;
|
|
10
11
|
triggerId: string;
|
|
11
12
|
contentId: string;
|
|
12
|
-
/** The relative wrapper the popover is anchored to
|
|
13
|
+
/** The relative wrapper the popover is anchored to by default. */
|
|
13
14
|
wrapperRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
15
|
+
/** Optional explicit anchor, rendered by PopoverAnchor. */
|
|
16
|
+
anchorRef: React.MutableRefObject<HTMLElement | null>;
|
|
17
|
+
/** The rendered trigger, so Escape can restore focus and labels stay valid. */
|
|
18
|
+
triggerRef: React.MutableRefObject<HTMLButtonElement | null>;
|
|
14
19
|
};
|
|
15
20
|
|
|
16
21
|
const PopoverContext = React.createContext<PopoverContextValue>({
|
|
@@ -19,6 +24,8 @@ const PopoverContext = React.createContext<PopoverContextValue>({
|
|
|
19
24
|
triggerId: '',
|
|
20
25
|
contentId: '',
|
|
21
26
|
wrapperRef: { current: null },
|
|
27
|
+
anchorRef: { current: null },
|
|
28
|
+
triggerRef: { current: null },
|
|
22
29
|
});
|
|
23
30
|
|
|
24
31
|
export type PopoverProps = {
|
|
@@ -42,6 +49,8 @@ const Popover = React.forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
42
49
|
const triggerId = React.useId();
|
|
43
50
|
const contentId = React.useId();
|
|
44
51
|
const wrapperRef = React.useRef<HTMLDivElement | null>(null);
|
|
52
|
+
const anchorRef = React.useRef<HTMLElement | null>(null);
|
|
53
|
+
const triggerRef = React.useRef<HTMLButtonElement | null>(null);
|
|
45
54
|
const setRefs = React.useCallback(
|
|
46
55
|
(node: HTMLDivElement | null) => {
|
|
47
56
|
wrapperRef.current = node;
|
|
@@ -62,7 +71,7 @@ const Popover = React.forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
62
71
|
return (
|
|
63
72
|
<div ref={setRefs} className={cn('relative inline-block', className)}>
|
|
64
73
|
<PopoverContext.Provider
|
|
65
|
-
value={{ open: current, setOpen, triggerId, contentId, wrapperRef }}
|
|
74
|
+
value={{ open: current, setOpen, triggerId, contentId, wrapperRef, anchorRef, triggerRef }}
|
|
66
75
|
>
|
|
67
76
|
{children}
|
|
68
77
|
</PopoverContext.Provider>
|
|
@@ -76,12 +85,20 @@ export type PopoverTriggerProps = React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
|
76
85
|
|
|
77
86
|
/** The button that toggles the popover. */
|
|
78
87
|
const PopoverTrigger = React.forwardRef<HTMLButtonElement, PopoverTriggerProps>(
|
|
79
|
-
({ className, children, onClick, ...props }, ref) => {
|
|
80
|
-
const { open, setOpen, triggerId, contentId } = React.useContext(PopoverContext);
|
|
88
|
+
({ className, children, onClick, id, ...props }, ref) => {
|
|
89
|
+
const { open, setOpen, triggerId, contentId, triggerRef } = React.useContext(PopoverContext);
|
|
90
|
+
const setRefs = React.useCallback(
|
|
91
|
+
(node: HTMLButtonElement | null) => {
|
|
92
|
+
triggerRef.current = node;
|
|
93
|
+
if (typeof ref === 'function') ref(node);
|
|
94
|
+
else if (ref) ref.current = node;
|
|
95
|
+
},
|
|
96
|
+
[ref, triggerRef]
|
|
97
|
+
);
|
|
81
98
|
return (
|
|
82
99
|
<button
|
|
83
|
-
ref={
|
|
84
|
-
id={triggerId}
|
|
100
|
+
ref={setRefs}
|
|
101
|
+
id={id ?? triggerId}
|
|
85
102
|
type="button"
|
|
86
103
|
aria-haspopup="dialog"
|
|
87
104
|
aria-expanded={open}
|
|
@@ -104,91 +121,211 @@ const PopoverTrigger = React.forwardRef<HTMLButtonElement, PopoverTriggerProps>(
|
|
|
104
121
|
);
|
|
105
122
|
PopoverTrigger.displayName = 'PopoverTrigger';
|
|
106
123
|
|
|
107
|
-
export type
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
124
|
+
export type PopoverAnchorProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Anchors the panel to this element instead of the trigger. Useful when the
|
|
128
|
+
* panel belongs to a field that is not itself the button opening it.
|
|
129
|
+
*/
|
|
130
|
+
const PopoverAnchor = React.forwardRef<HTMLSpanElement, PopoverAnchorProps>(
|
|
131
|
+
({ className, children, ...props }, ref) => {
|
|
132
|
+
const { anchorRef } = React.useContext(PopoverContext);
|
|
133
|
+
const setRefs = React.useCallback(
|
|
134
|
+
(node: HTMLSpanElement | null) => {
|
|
135
|
+
anchorRef.current = node;
|
|
136
|
+
if (typeof ref === 'function') ref(node);
|
|
137
|
+
else if (ref) ref.current = node;
|
|
138
|
+
},
|
|
139
|
+
[anchorRef, ref]
|
|
140
|
+
);
|
|
141
|
+
return (
|
|
142
|
+
<span ref={setRefs} className={cn('inline-block', className)} {...props}>
|
|
143
|
+
{children}
|
|
144
|
+
</span>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
PopoverAnchor.displayName = 'PopoverAnchor';
|
|
149
|
+
|
|
150
|
+
export type PopoverContentProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
151
|
+
/** Preferred side of the anchor. Flips when it cannot fit. */
|
|
152
|
+
side?: Side;
|
|
153
|
+
/** Cross-axis alignment against the anchor. */
|
|
154
|
+
align?: Align;
|
|
155
|
+
/** Gap between anchor and panel. */
|
|
156
|
+
sideOffset?: number;
|
|
157
|
+
/** Nudge along the cross axis. */
|
|
158
|
+
alignOffset?: number;
|
|
159
|
+
/** Minimum distance kept from the viewport edges. */
|
|
160
|
+
collisionPadding?: number;
|
|
161
|
+
/** Match the panel width to the anchor width (select-like panels). */
|
|
162
|
+
matchTriggerWidth?: boolean;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
function rectOf(element: Element) {
|
|
166
|
+
const rect = element.getBoundingClientRect();
|
|
167
|
+
return {
|
|
168
|
+
top: rect.top,
|
|
169
|
+
left: rect.left,
|
|
170
|
+
width: rect.width || (element as HTMLElement).offsetWidth || 0,
|
|
171
|
+
height: rect.height || (element as HTMLElement).offsetHeight || 0,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** The floating panel with interactive content. */
|
|
176
|
+
const PopoverContent = React.forwardRef<HTMLDivElement, PopoverContentProps>(
|
|
177
|
+
(
|
|
178
|
+
{
|
|
179
|
+
className,
|
|
180
|
+
children,
|
|
181
|
+
onKeyDown,
|
|
182
|
+
style,
|
|
183
|
+
side = 'bottom',
|
|
184
|
+
align = 'start',
|
|
185
|
+
sideOffset = 8,
|
|
186
|
+
alignOffset = 0,
|
|
187
|
+
collisionPadding = 8,
|
|
188
|
+
matchTriggerWidth = false,
|
|
189
|
+
...props
|
|
190
|
+
},
|
|
191
|
+
ref
|
|
192
|
+
) => {
|
|
193
|
+
const { open, setOpen, contentId, wrapperRef, anchorRef, triggerRef } =
|
|
194
|
+
React.useContext(PopoverContext);
|
|
195
|
+
// The trigger may carry a consumer `id`; read the rendered element so the
|
|
196
|
+
// dialog's label always points at something that exists.
|
|
197
|
+
const labelledBy = triggerRef.current?.id || undefined;
|
|
198
|
+
const contentRef = React.useRef<HTMLDivElement | null>(null);
|
|
199
|
+
// Viewport coordinates measured from the anchor; the panel portals to
|
|
200
|
+
// document.body with position:fixed so ancestor overflow can never clip it.
|
|
201
|
+
const [pos, setPos] = React.useState<PositionResult | null>(null);
|
|
202
|
+
const [width, setWidth] = React.useState<number | undefined>(undefined);
|
|
203
|
+
|
|
204
|
+
const updatePosition = React.useCallback(() => {
|
|
205
|
+
const anchorEl = anchorRef.current ?? wrapperRef.current;
|
|
206
|
+
const panel = contentRef.current;
|
|
207
|
+
if (!anchorEl || !panel) return;
|
|
208
|
+
const anchor = rectOf(anchorEl);
|
|
209
|
+
const measured = rectOf(panel);
|
|
210
|
+
setWidth(matchTriggerWidth ? anchor.width : undefined);
|
|
211
|
+
setPos(
|
|
212
|
+
computePosition({
|
|
213
|
+
anchor,
|
|
214
|
+
content: { width: measured.width, height: measured.height },
|
|
215
|
+
viewport: { width: window.innerWidth, height: window.innerHeight },
|
|
216
|
+
side,
|
|
217
|
+
align,
|
|
218
|
+
sideOffset,
|
|
219
|
+
alignOffset,
|
|
220
|
+
collisionPadding,
|
|
221
|
+
})
|
|
189
222
|
);
|
|
190
|
-
}
|
|
191
|
-
|
|
223
|
+
}, [
|
|
224
|
+
align,
|
|
225
|
+
alignOffset,
|
|
226
|
+
anchorRef,
|
|
227
|
+
collisionPadding,
|
|
228
|
+
matchTriggerWidth,
|
|
229
|
+
side,
|
|
230
|
+
sideOffset,
|
|
231
|
+
wrapperRef,
|
|
232
|
+
]);
|
|
233
|
+
|
|
234
|
+
React.useLayoutEffect(() => {
|
|
235
|
+
if (!open) {
|
|
236
|
+
setPos(null);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
updatePosition();
|
|
240
|
+
}, [open, updatePosition]);
|
|
241
|
+
|
|
242
|
+
// A panel that is already open on first mount measures before the wrapper's
|
|
243
|
+
// ref is attached (child layout effects run first), so measure once more
|
|
244
|
+
// when the refs exist.
|
|
245
|
+
React.useEffect(() => {
|
|
246
|
+
if (open && !pos) updatePosition();
|
|
247
|
+
}, [open, pos, updatePosition]);
|
|
248
|
+
|
|
249
|
+
// Keep the panel anchored while the page moves: reposition on scroll and
|
|
250
|
+
// resize, and re-measure when the content itself changes size.
|
|
251
|
+
React.useEffect(() => {
|
|
252
|
+
if (!open) return;
|
|
253
|
+
const onScroll = () => updatePosition();
|
|
254
|
+
window.addEventListener('scroll', onScroll, true);
|
|
255
|
+
window.addEventListener('resize', onScroll);
|
|
256
|
+
const panel = contentRef.current;
|
|
257
|
+
const observer =
|
|
258
|
+
typeof ResizeObserver === 'undefined' || !panel ? null : new ResizeObserver(onScroll);
|
|
259
|
+
if (panel && observer) observer.observe(panel);
|
|
260
|
+
return () => {
|
|
261
|
+
window.removeEventListener('scroll', onScroll, true);
|
|
262
|
+
window.removeEventListener('resize', onScroll);
|
|
263
|
+
observer?.disconnect();
|
|
264
|
+
};
|
|
265
|
+
}, [open, updatePosition]);
|
|
266
|
+
|
|
267
|
+
// Close on outside click.
|
|
268
|
+
React.useEffect(() => {
|
|
269
|
+
if (!open) return;
|
|
270
|
+
function onPointerDown(event: PointerEvent) {
|
|
271
|
+
if (!contentRef.current?.contains(event.target as Node)) setOpen(false);
|
|
272
|
+
}
|
|
273
|
+
document.addEventListener('pointerdown', onPointerDown);
|
|
274
|
+
return () => document.removeEventListener('pointerdown', onPointerDown);
|
|
275
|
+
}, [open, setOpen]);
|
|
276
|
+
|
|
277
|
+
// Focus the content when it opens so Escape reaches it. Depends on `pos`
|
|
278
|
+
// because the panel only mounts once measured.
|
|
279
|
+
React.useEffect(() => {
|
|
280
|
+
if (open && pos && contentRef.current) {
|
|
281
|
+
contentRef.current.focus();
|
|
282
|
+
}
|
|
283
|
+
}, [open, pos]);
|
|
284
|
+
|
|
285
|
+
if (!open || typeof document === 'undefined') return null;
|
|
286
|
+
|
|
287
|
+
return createPortal(
|
|
288
|
+
<div
|
|
289
|
+
ref={(node) => {
|
|
290
|
+
contentRef.current = node;
|
|
291
|
+
if (typeof ref === 'function') ref(node);
|
|
292
|
+
else if (ref) ref.current = node;
|
|
293
|
+
}}
|
|
294
|
+
id={contentId}
|
|
295
|
+
role="dialog"
|
|
296
|
+
aria-labelledby={labelledBy}
|
|
297
|
+
tabIndex={-1}
|
|
298
|
+
data-side={pos?.side ?? side}
|
|
299
|
+
onKeyDown={(event) => {
|
|
300
|
+
onKeyDown?.(event);
|
|
301
|
+
if (event.key === 'Escape') {
|
|
302
|
+
event.stopPropagation();
|
|
303
|
+
setOpen(false);
|
|
304
|
+
// Escape must hand focus back, or it lands on <body>.
|
|
305
|
+
(triggerRef.current ?? anchorRef.current)?.focus();
|
|
306
|
+
}
|
|
307
|
+
}}
|
|
308
|
+
style={{
|
|
309
|
+
position: 'fixed',
|
|
310
|
+
top: pos?.top ?? 0,
|
|
311
|
+
left: pos?.left ?? 0,
|
|
312
|
+
width,
|
|
313
|
+
visibility: pos ? 'visible' : 'hidden',
|
|
314
|
+
zIndex: 50,
|
|
315
|
+
...style,
|
|
316
|
+
}}
|
|
317
|
+
className={cn(
|
|
318
|
+
'w-72 rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-md outline-none',
|
|
319
|
+
className
|
|
320
|
+
)}
|
|
321
|
+
{...props}
|
|
322
|
+
>
|
|
323
|
+
{children}
|
|
324
|
+
</div>,
|
|
325
|
+
document.body
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
);
|
|
192
329
|
PopoverContent.displayName = 'PopoverContent';
|
|
193
330
|
|
|
194
|
-
export { Popover,
|
|
331
|
+
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger };
|
|
@@ -48,7 +48,7 @@ export const SectionHeading = React.forwardRef<HTMLDivElement, SectionHeadingPro
|
|
|
48
48
|
{...props}
|
|
49
49
|
>
|
|
50
50
|
<div className={cn('min-w-0', align === 'center' && 'flex flex-col items-center')}>
|
|
51
|
-
{eyebrow && <div className={cn('mb-1 text-xs font-medium uppercase tracking-wide text-primary', eyebrowClassName)}>{eyebrow}</div>}
|
|
51
|
+
{eyebrow && <div className={cn('mb-1 text-xs font-medium uppercase tracking-wide text-primary-ink', eyebrowClassName)}>{eyebrow}</div>}
|
|
52
52
|
<Heading className={cn('font-semibold tracking-tight', sizeClasses[size], titleClassName)}>{title}</Heading>
|
|
53
53
|
{description && (
|
|
54
54
|
<p className={cn('mt-2 max-w-2xl text-muted-foreground', align === 'center' ? 'mx-auto' : '', descriptionClassName)}>{description}</p>
|
|
@@ -2,7 +2,7 @@ import { render, screen, within } from '@testing-library/react';
|
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
3
|
import { axe } from 'jest-axe';
|
|
4
4
|
import { describe, expect, it } from 'vitest';
|
|
5
|
-
import { SiteHeader } from './SiteHeader';
|
|
5
|
+
import { SiteHeader, type SiteNavItem } from './SiteHeader';
|
|
6
6
|
|
|
7
7
|
const items = [
|
|
8
8
|
{ href: '/docs', label: 'Docs' },
|
|
@@ -84,3 +84,105 @@ describe('SiteHeader', () => {
|
|
|
84
84
|
expect(await axe(container)).toHaveNoViolations();
|
|
85
85
|
});
|
|
86
86
|
});
|
|
87
|
+
|
|
88
|
+
const megaItems: SiteNavItem[] = [
|
|
89
|
+
{
|
|
90
|
+
label: 'Dancers',
|
|
91
|
+
columns: [
|
|
92
|
+
{
|
|
93
|
+
heading: 'Plan',
|
|
94
|
+
items: [
|
|
95
|
+
{ href: '/events', label: 'All events', description: 'Every genre in Utah' },
|
|
96
|
+
{ href: '/deadlines', label: 'Deadlines' },
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
heading: 'Follow',
|
|
101
|
+
items: [{ href: '/brief', label: 'Deadline Brief' }],
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
{ href: '/directory', label: 'Directory' },
|
|
106
|
+
];
|
|
107
|
+
|
|
108
|
+
describe('SiteHeader mega menu', () => {
|
|
109
|
+
it('renders a disclosure trigger instead of a link for nested items', () => {
|
|
110
|
+
render(<SiteHeader brand={<span>Acme</span>} items={megaItems} />);
|
|
111
|
+
const trigger = screen.getByRole('button', { name: /Dancers/ });
|
|
112
|
+
expect(trigger).toHaveAttribute('aria-expanded', 'false');
|
|
113
|
+
expect(screen.getByRole('link', { name: 'Directory' })).toBeInTheDocument();
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('opens on hover and exposes the panel links', async () => {
|
|
117
|
+
const user = userEvent.setup();
|
|
118
|
+
render(<SiteHeader brand={<span>Acme</span>} items={megaItems} />);
|
|
119
|
+
await user.hover(screen.getByRole('button', { name: /Dancers/ }));
|
|
120
|
+
expect(screen.getByRole('button', { name: /Dancers/ })).toHaveAttribute(
|
|
121
|
+
'aria-expanded',
|
|
122
|
+
'true'
|
|
123
|
+
);
|
|
124
|
+
expect(screen.getByRole('link', { name: /All events/ })).toBeInTheDocument();
|
|
125
|
+
expect(screen.getByText('Plan')).toBeInTheDocument();
|
|
126
|
+
expect(screen.getByText('Every genre in Utah')).toBeInTheDocument();
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('closes on Escape and on an outside pointer', async () => {
|
|
130
|
+
const user = userEvent.setup();
|
|
131
|
+
render(
|
|
132
|
+
<div>
|
|
133
|
+
<SiteHeader brand={<span>Acme</span>} items={megaItems} />
|
|
134
|
+
<button type="button">Outside</button>
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
const trigger = screen.getByRole('button', { name: /Dancers/ });
|
|
138
|
+
await user.click(trigger);
|
|
139
|
+
expect(trigger).toHaveAttribute('aria-expanded', 'true');
|
|
140
|
+
await user.keyboard('{Escape}');
|
|
141
|
+
expect(trigger).toHaveAttribute('aria-expanded', 'false');
|
|
142
|
+
await user.click(trigger);
|
|
143
|
+
expect(trigger).toHaveAttribute('aria-expanded', 'true');
|
|
144
|
+
await user.click(screen.getByRole('button', { name: 'Outside' }));
|
|
145
|
+
expect(screen.getByRole('button', { name: /Dancers/ })).toHaveAttribute(
|
|
146
|
+
'aria-expanded',
|
|
147
|
+
'false'
|
|
148
|
+
);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('moves focus into the panel with ArrowDown', async () => {
|
|
152
|
+
const user = userEvent.setup();
|
|
153
|
+
render(<SiteHeader brand={<span>Acme</span>} items={megaItems} />);
|
|
154
|
+
const trigger = screen.getByRole('button', { name: /Dancers/ });
|
|
155
|
+
trigger.focus();
|
|
156
|
+
await user.keyboard('{ArrowDown}');
|
|
157
|
+
expect(screen.getByRole('link', { name: /All events/ })).toHaveFocus();
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it('keeps the panel open while tabbing through its links', async () => {
|
|
161
|
+
const user = userEvent.setup();
|
|
162
|
+
render(<SiteHeader brand={<span>Acme</span>} items={megaItems} />);
|
|
163
|
+
const trigger = screen.getByRole('button', { name: /Dancers/ });
|
|
164
|
+
trigger.focus();
|
|
165
|
+
await user.keyboard('{ArrowDown}');
|
|
166
|
+
await user.tab();
|
|
167
|
+
expect(screen.getByRole('link', { name: /Deadlines/ })).toHaveFocus();
|
|
168
|
+
expect(trigger).toHaveAttribute('aria-expanded', 'true');
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
it('renders nested groups in the mobile drawer', async () => {
|
|
172
|
+
const user = userEvent.setup();
|
|
173
|
+
render(<SiteHeader brand={<span>Acme</span>} items={megaItems} />);
|
|
174
|
+
await user.click(screen.getByRole('button', { name: 'Open menu' }));
|
|
175
|
+
const drawer = screen.getByRole('dialog', { name: 'Menu' });
|
|
176
|
+
expect(within(drawer).getByText('Dancers')).toBeInTheDocument();
|
|
177
|
+
expect(within(drawer).getByRole('link', { name: /All events/ })).toBeInTheDocument();
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it('has no accessibility violations with a panel open', async () => {
|
|
181
|
+
const user = userEvent.setup();
|
|
182
|
+
const { container } = render(
|
|
183
|
+
<SiteHeader brand={<span>Acme</span>} items={megaItems} activeHref="/events" />
|
|
184
|
+
);
|
|
185
|
+
await user.hover(screen.getByRole('button', { name: /Dancers/ }));
|
|
186
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
187
|
+
});
|
|
188
|
+
});
|