@slipstream-ui/core 0.11.9 → 0.12.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 +254 -148
- package/dist/index.d.ts +254 -148
- package/dist/index.js +1582 -1156
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1577 -1156
- package/dist/index.mjs.map +1 -1
- package/dist/manifests/accordion.manifest.json +1 -1
- package/dist/manifests/alert.manifest.json +1 -1
- package/dist/manifests/announcement-bar.manifest.json +12 -1
- package/dist/manifests/app-shell.manifest.json +12 -1
- package/dist/manifests/applied-filters.manifest.json +1 -1
- package/dist/manifests/article-card.manifest.json +12 -1
- package/dist/manifests/auth-layout.manifest.json +1 -1
- package/dist/manifests/autocomplete.manifest.json +1 -1
- package/dist/manifests/avatar.manifest.json +1 -1
- package/dist/manifests/badge.manifest.json +1 -1
- package/dist/manifests/block.manifest.json +1 -1
- package/dist/manifests/bottom-nav.manifest.json +1 -1
- 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 +1 -1
- 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/consent-banner.manifest.json +130 -0
- package/dist/manifests/contact-strip.manifest.json +12 -1
- package/dist/manifests/container.manifest.json +1 -1
- package/dist/manifests/cover-image.manifest.json +1 -1
- package/dist/manifests/cta-section.manifest.json +1 -1
- package/dist/manifests/data-table.manifest.json +1 -1
- package/dist/manifests/date-picker-popover.manifest.json +1 -1
- 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 +12 -1
- package/dist/manifests/dialog.manifest.json +1 -1
- package/dist/manifests/document-card.manifest.json +1 -1
- package/dist/manifests/drawer.manifest.json +1 -1
- package/dist/manifests/empty-state.manifest.json +1 -1
- package/dist/manifests/entity-card.manifest.json +12 -1
- package/dist/manifests/feature-grid.manifest.json +12 -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 +1 -1
- 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-toolbar.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/media-card.manifest.json +161 -0
- package/dist/manifests/menu.manifest.json +1 -1
- package/dist/manifests/metric-card.manifest.json +1 -1
- package/dist/manifests/month-schedule.manifest.json +217 -0
- package/dist/manifests/multi-select.manifest.json +1 -1
- package/dist/manifests/newsletter.manifest.json +1 -1
- package/dist/manifests/page-header.manifest.json +1 -1
- package/dist/manifests/pagination.manifest.json +1 -1
- package/dist/manifests/password-input.manifest.json +1 -1
- package/dist/manifests/popover.manifest.json +1 -1
- 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 +7 -1
- 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 +1 -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 +12 -1
- package/dist/manifests/tooltip.manifest.json +1 -1
- package/dist/src/components/announcement-bar/AnnouncementBar.d.ts +3 -6
- package/dist/src/components/announcement-bar/AnnouncementBar.js +3 -1
- package/dist/src/components/announcement-bar/AnnouncementBar.js.map +1 -1
- package/dist/src/components/announcement-bar/AnnouncementBar.mjs +3 -1
- package/dist/src/components/announcement-bar/AnnouncementBar.mjs.map +1 -1
- package/dist/src/components/app-shell/AppShell.d.ts +3 -4
- package/dist/src/components/app-shell/AppShell.js +3 -1
- package/dist/src/components/app-shell/AppShell.js.map +1 -1
- package/dist/src/components/app-shell/AppShell.mjs +3 -1
- package/dist/src/components/app-shell/AppShell.mjs.map +1 -1
- package/dist/src/components/article-card/ArticleCard.d.ts +3 -6
- package/dist/src/components/article-card/ArticleCard.js +3 -1
- package/dist/src/components/article-card/ArticleCard.js.map +1 -1
- package/dist/src/components/article-card/ArticleCard.mjs +3 -1
- package/dist/src/components/article-card/ArticleCard.mjs.map +1 -1
- package/dist/src/components/bottom-nav/BottomNav.d.ts +2 -5
- package/dist/src/components/bottom-nav/BottomNav.js +2 -1
- package/dist/src/components/bottom-nav/BottomNav.js.map +1 -1
- package/dist/src/components/bottom-nav/BottomNav.mjs +2 -1
- package/dist/src/components/bottom-nav/BottomNav.mjs.map +1 -1
- package/dist/src/components/breadcrumb/Breadcrumb.d.ts +3 -16
- package/dist/src/components/breadcrumb/Breadcrumb.js +2 -1
- package/dist/src/components/breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/src/components/breadcrumb/Breadcrumb.mjs +2 -1
- package/dist/src/components/breadcrumb/Breadcrumb.mjs.map +1 -1
- package/dist/src/components/consent-banner/ConsentBanner.d.ts +53 -0
- package/dist/src/components/consent-banner/ConsentBanner.js +83 -0
- package/dist/src/components/consent-banner/ConsentBanner.js.map +1 -0
- package/dist/src/components/consent-banner/ConsentBanner.mjs +49 -0
- package/dist/src/components/consent-banner/ConsentBanner.mjs.map +1 -0
- package/dist/src/components/consent-banner/index.d.ts +1 -0
- package/dist/src/components/consent-banner/index.js +23 -0
- package/dist/src/components/consent-banner/index.js.map +1 -0
- package/dist/src/components/consent-banner/index.mjs +2 -0
- package/dist/src/components/consent-banner/index.mjs.map +1 -0
- package/dist/src/components/contact-strip/ContactStrip.d.ts +3 -6
- package/dist/src/components/contact-strip/ContactStrip.js +3 -2
- package/dist/src/components/contact-strip/ContactStrip.js.map +1 -1
- package/dist/src/components/contact-strip/ContactStrip.mjs +3 -2
- package/dist/src/components/contact-strip/ContactStrip.mjs.map +1 -1
- package/dist/src/components/deal-card/DealCard.d.ts +3 -6
- package/dist/src/components/deal-card/DealCard.js +3 -1
- package/dist/src/components/deal-card/DealCard.js.map +1 -1
- package/dist/src/components/deal-card/DealCard.mjs +3 -1
- package/dist/src/components/deal-card/DealCard.mjs.map +1 -1
- package/dist/src/components/empty-state/EmptyState.d.ts +3 -10
- package/dist/src/components/empty-state/EmptyState.js +2 -1
- package/dist/src/components/empty-state/EmptyState.js.map +1 -1
- package/dist/src/components/empty-state/EmptyState.mjs +2 -1
- package/dist/src/components/empty-state/EmptyState.mjs.map +1 -1
- package/dist/src/components/entity-card/EntityCard.d.ts +4 -9
- package/dist/src/components/entity-card/EntityCard.js +4 -2
- package/dist/src/components/entity-card/EntityCard.js.map +1 -1
- package/dist/src/components/entity-card/EntityCard.mjs +4 -2
- package/dist/src/components/entity-card/EntityCard.mjs.map +1 -1
- package/dist/src/components/feature-grid/FeatureGrid.d.ts +3 -6
- package/dist/src/components/feature-grid/FeatureGrid.js +3 -2
- package/dist/src/components/feature-grid/FeatureGrid.js.map +1 -1
- package/dist/src/components/feature-grid/FeatureGrid.mjs +3 -2
- package/dist/src/components/feature-grid/FeatureGrid.mjs.map +1 -1
- package/dist/src/components/link-tabs/LinkTabs.d.ts +3 -16
- package/dist/src/components/link-tabs/LinkTabs.js +2 -1
- package/dist/src/components/link-tabs/LinkTabs.js.map +1 -1
- package/dist/src/components/link-tabs/LinkTabs.mjs +2 -1
- package/dist/src/components/link-tabs/LinkTabs.mjs.map +1 -1
- package/dist/src/components/logo-cloud/LogoCloud.d.ts +3 -10
- package/dist/src/components/logo-cloud/LogoCloud.js +2 -1
- package/dist/src/components/logo-cloud/LogoCloud.js.map +1 -1
- package/dist/src/components/logo-cloud/LogoCloud.mjs +2 -1
- package/dist/src/components/logo-cloud/LogoCloud.mjs.map +1 -1
- package/dist/src/components/media-card/MediaCard.d.ts +54 -0
- package/dist/src/components/media-card/MediaCard.js +89 -0
- package/dist/src/components/media-card/MediaCard.js.map +1 -0
- package/dist/src/components/media-card/MediaCard.mjs +55 -0
- package/dist/src/components/media-card/MediaCard.mjs.map +1 -0
- package/dist/src/components/media-card/index.d.ts +1 -0
- package/dist/src/components/media-card/index.js +23 -0
- package/dist/src/components/media-card/index.js.map +1 -0
- package/dist/src/components/media-card/index.mjs +2 -0
- package/dist/src/components/media-card/index.mjs.map +1 -0
- package/dist/src/components/month-schedule/MonthSchedule.d.ts +53 -0
- package/dist/src/components/month-schedule/MonthSchedule.js +246 -0
- package/dist/src/components/month-schedule/MonthSchedule.js.map +1 -0
- package/dist/src/components/month-schedule/MonthSchedule.mjs +220 -0
- package/dist/src/components/month-schedule/MonthSchedule.mjs.map +1 -0
- package/dist/src/components/month-schedule/index.d.ts +1 -0
- package/dist/src/components/month-schedule/index.js +23 -0
- package/dist/src/components/month-schedule/index.js.map +1 -0
- package/dist/src/components/month-schedule/index.mjs +2 -0
- package/dist/src/components/month-schedule/index.mjs.map +1 -0
- package/dist/src/components/pagination/Pagination.d.ts +3 -10
- package/dist/src/components/pagination/Pagination.js +2 -1
- package/dist/src/components/pagination/Pagination.js.map +1 -1
- package/dist/src/components/pagination/Pagination.mjs +2 -1
- package/dist/src/components/pagination/Pagination.mjs.map +1 -1
- package/dist/src/components/segmented-control/SegmentedControl.d.ts +3 -10
- package/dist/src/components/segmented-control/SegmentedControl.js +2 -1
- package/dist/src/components/segmented-control/SegmentedControl.js.map +1 -1
- package/dist/src/components/segmented-control/SegmentedControl.mjs +2 -1
- package/dist/src/components/segmented-control/SegmentedControl.mjs.map +1 -1
- package/dist/src/components/site-footer/SiteFooter.d.ts +2 -9
- package/dist/src/components/site-footer/SiteFooter.js +2 -1
- package/dist/src/components/site-footer/SiteFooter.js.map +1 -1
- package/dist/src/components/site-footer/SiteFooter.mjs +2 -1
- package/dist/src/components/site-footer/SiteFooter.mjs.map +1 -1
- package/dist/src/components/site-header/SiteHeader.d.ts +9 -10
- package/dist/src/components/site-header/SiteHeader.js +138 -133
- package/dist/src/components/site-header/SiteHeader.js.map +1 -1
- package/dist/src/components/site-header/SiteHeader.mjs +138 -133
- package/dist/src/components/site-header/SiteHeader.mjs.map +1 -1
- package/dist/src/components/tombstone-card/TombstoneCard.d.ts +3 -6
- package/dist/src/components/tombstone-card/TombstoneCard.js +3 -1
- package/dist/src/components/tombstone-card/TombstoneCard.js.map +1 -1
- package/dist/src/components/tombstone-card/TombstoneCard.mjs +3 -1
- package/dist/src/components/tombstone-card/TombstoneCard.mjs.map +1 -1
- package/dist/src/index.d.ts +5 -0
- package/dist/src/utils/consent.d.ts +42 -0
- package/dist/src/utils/consent.js +142 -0
- package/dist/src/utils/consent.js.map +1 -0
- package/dist/src/utils/consent.mjs +107 -0
- package/dist/src/utils/consent.mjs.map +1 -0
- package/dist/src/utils/link.d.ts +21 -0
- package/dist/src/utils/link.js +31 -0
- package/dist/src/utils/link.js.map +1 -0
- package/dist/src/utils/link.mjs +7 -0
- package/dist/src/utils/link.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/announcement-bar/AnnouncementBar.test.tsx +18 -0
- package/src/components/announcement-bar/AnnouncementBar.tsx +4 -4
- package/src/components/app-shell/AppShell.test.tsx +10 -0
- package/src/components/app-shell/AppShell.tsx +4 -4
- package/src/components/article-card/ArticleCard.test.tsx +10 -0
- package/src/components/article-card/ArticleCard.tsx +4 -4
- package/src/components/bottom-nav/BottomNav.tsx +3 -6
- package/src/components/breadcrumb/Breadcrumb.tsx +3 -9
- package/src/components/consent-banner/ConsentBanner.test.tsx +58 -0
- package/src/components/consent-banner/ConsentBanner.tsx +93 -0
- package/src/components/consent-banner/index.ts +1 -0
- package/src/components/contact-strip/ContactStrip.test.tsx +16 -0
- package/src/components/contact-strip/ContactStrip.tsx +4 -5
- package/src/components/deal-card/DealCard.test.tsx +19 -0
- package/src/components/deal-card/DealCard.tsx +4 -4
- package/src/components/empty-state/EmptyState.tsx +3 -6
- package/src/components/entity-card/EntityCard.test.tsx +8 -0
- package/src/components/entity-card/EntityCard.tsx +5 -5
- package/src/components/feature-grid/FeatureGrid.test.tsx +16 -0
- package/src/components/feature-grid/FeatureGrid.tsx +4 -5
- package/src/components/link-tabs/LinkTabs.tsx +3 -9
- package/src/components/logo-cloud/LogoCloud.tsx +3 -6
- package/src/components/media-card/MediaCard.test.tsx +97 -0
- package/src/components/media-card/MediaCard.tsx +113 -0
- package/src/components/media-card/index.ts +1 -0
- package/src/components/month-schedule/MonthSchedule.test.tsx +137 -0
- package/src/components/month-schedule/MonthSchedule.tsx +329 -0
- package/src/components/month-schedule/index.ts +1 -0
- package/src/components/pagination/Pagination.tsx +3 -6
- package/src/components/segmented-control/SegmentedControl.tsx +3 -6
- package/src/components/site-footer/SiteFooter.tsx +3 -11
- package/src/components/site-header/SiteHeader.test.tsx +26 -0
- package/src/components/site-header/SiteHeader.tsx +17 -11
- package/src/components/tombstone-card/TombstoneCard.test.tsx +17 -0
- package/src/components/tombstone-card/TombstoneCard.tsx +4 -4
- package/src/index.ts +5 -0
- package/src/manifests/accordion.manifest.json +1 -1
- package/src/manifests/alert.manifest.json +1 -1
- package/src/manifests/announcement-bar.manifest.json +12 -1
- package/src/manifests/app-shell.manifest.json +12 -1
- package/src/manifests/applied-filters.manifest.json +1 -1
- package/src/manifests/article-card.manifest.json +12 -1
- package/src/manifests/auth-layout.manifest.json +1 -1
- package/src/manifests/autocomplete.manifest.json +1 -1
- package/src/manifests/avatar.manifest.json +1 -1
- package/src/manifests/badge.manifest.json +1 -1
- package/src/manifests/block.manifest.json +1 -1
- package/src/manifests/bottom-nav.manifest.json +1 -1
- 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 +1 -1
- 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/consent-banner.manifest.json +130 -0
- package/src/manifests/contact-strip.manifest.json +12 -1
- package/src/manifests/container.manifest.json +1 -1
- package/src/manifests/cover-image.manifest.json +1 -1
- package/src/manifests/cta-section.manifest.json +1 -1
- package/src/manifests/data-table.manifest.json +1 -1
- package/src/manifests/date-picker-popover.manifest.json +1 -1
- 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 +12 -1
- package/src/manifests/dialog.manifest.json +1 -1
- package/src/manifests/document-card.manifest.json +1 -1
- package/src/manifests/drawer.manifest.json +1 -1
- package/src/manifests/empty-state.manifest.json +1 -1
- package/src/manifests/entity-card.manifest.json +12 -1
- package/src/manifests/feature-grid.manifest.json +12 -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 +1 -1
- 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-toolbar.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/media-card.manifest.json +161 -0
- package/src/manifests/menu.manifest.json +1 -1
- package/src/manifests/metric-card.manifest.json +1 -1
- package/src/manifests/month-schedule.manifest.json +217 -0
- package/src/manifests/multi-select.manifest.json +1 -1
- package/src/manifests/newsletter.manifest.json +1 -1
- package/src/manifests/page-header.manifest.json +1 -1
- package/src/manifests/pagination.manifest.json +1 -1
- package/src/manifests/password-input.manifest.json +1 -1
- package/src/manifests/popover.manifest.json +1 -1
- 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 +7 -1
- 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 +1 -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 +12 -1
- package/src/manifests/tooltip.manifest.json +1 -1
- package/src/utils/consent.test.ts +112 -0
- package/src/utils/consent.ts +169 -0
- package/src/utils/link.ts +19 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { cn } from '../../utils/cn';
|
|
5
|
+
import { Button } from '../button/Button';
|
|
6
|
+
|
|
7
|
+
export type ConsentBannerProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
8
|
+
/** Called when the visitor accepts (all purposes granted). */
|
|
9
|
+
onAccept: () => void;
|
|
10
|
+
/** Called when the visitor declines (all purposes denied). */
|
|
11
|
+
onDecline: () => void;
|
|
12
|
+
/** Optional "manage preferences" action for granular consent dialogs. */
|
|
13
|
+
onManage?: () => void;
|
|
14
|
+
/** Banner heading. Omit for a single-line notice. */
|
|
15
|
+
title?: React.ReactNode;
|
|
16
|
+
/** Body copy; put privacy-policy links here. */
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
/** Accessible name for the banner region. Default 'Cookie consent'. */
|
|
19
|
+
label?: string;
|
|
20
|
+
acceptLabel?: React.ReactNode;
|
|
21
|
+
declineLabel?: React.ReactNode;
|
|
22
|
+
manageLabel?: React.ReactNode;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Styled cookie/consent banner: a fixed bottom bar with accept, decline and
|
|
27
|
+
* an optional manage-preferences action. Presentational only — wire it to
|
|
28
|
+
* `useConsent` (or your own store) and render it conditionally:
|
|
29
|
+
*
|
|
30
|
+
* ```tsx
|
|
31
|
+
* const consent = useConsent({ purposes: ['analytics'] });
|
|
32
|
+
* {!consent.decided && (
|
|
33
|
+
* <ConsentBanner
|
|
34
|
+
* onAccept={() => consent.setAll(true)}
|
|
35
|
+
* onDecline={() => consent.setAll(false)}
|
|
36
|
+
* >
|
|
37
|
+
* We use cookies for analytics.{' '}
|
|
38
|
+
* <a href="/privacy">Privacy policy</a>
|
|
39
|
+
* </ConsentBanner>
|
|
40
|
+
* )}
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const ConsentBanner = React.forwardRef<HTMLDivElement, ConsentBannerProps>(
|
|
44
|
+
function ConsentBanner(
|
|
45
|
+
{
|
|
46
|
+
onAccept,
|
|
47
|
+
onDecline,
|
|
48
|
+
onManage,
|
|
49
|
+
title,
|
|
50
|
+
children,
|
|
51
|
+
label = 'Cookie consent',
|
|
52
|
+
acceptLabel = 'Accept',
|
|
53
|
+
declineLabel = 'Decline',
|
|
54
|
+
manageLabel = 'Manage',
|
|
55
|
+
className,
|
|
56
|
+
...props
|
|
57
|
+
},
|
|
58
|
+
ref
|
|
59
|
+
) {
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
ref={ref}
|
|
63
|
+
role="region"
|
|
64
|
+
aria-label={label}
|
|
65
|
+
className={cn(
|
|
66
|
+
'fixed inset-x-0 bottom-0 z-50 border-t border-border bg-card px-4 py-4 pb-[calc(1rem+env(safe-area-inset-bottom))] shadow-lg sm:px-6',
|
|
67
|
+
className
|
|
68
|
+
)}
|
|
69
|
+
{...props}
|
|
70
|
+
>
|
|
71
|
+
<div className="mx-auto flex max-w-5xl flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
|
72
|
+
<div className="min-w-0">
|
|
73
|
+
{title && <p className="text-sm font-medium text-foreground">{title}</p>}
|
|
74
|
+
{children && <div className="text-sm text-muted-foreground">{children}</div>}
|
|
75
|
+
</div>
|
|
76
|
+
<div className="flex shrink-0 flex-wrap gap-2">
|
|
77
|
+
{onManage && (
|
|
78
|
+
<Button type="button" variant="ghost" size="sm" onClick={onManage}>
|
|
79
|
+
{manageLabel}
|
|
80
|
+
</Button>
|
|
81
|
+
)}
|
|
82
|
+
<Button type="button" variant="outline" size="sm" onClick={onDecline}>
|
|
83
|
+
{declineLabel}
|
|
84
|
+
</Button>
|
|
85
|
+
<Button type="button" size="sm" onClick={onAccept}>
|
|
86
|
+
{acceptLabel}
|
|
87
|
+
</Button>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ConsentBanner';
|
|
@@ -18,6 +18,22 @@ describe('ContactStrip', () => {
|
|
|
18
18
|
expect(screen.getByRole('link', { name: 'info@axial.net' })).toHaveAttribute('href', 'mailto:info@axial.net');
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
+
it('passes destinations via linkHrefProp for routers that use "to"', () => {
|
|
22
|
+
const RouterLink = ({ to, children, ...rest }: { to: string; children: React.ReactNode }) => (
|
|
23
|
+
<a href={to} data-router-to={to} {...rest}>
|
|
24
|
+
{children}
|
|
25
|
+
</a>
|
|
26
|
+
);
|
|
27
|
+
render(
|
|
28
|
+
<ContactStrip
|
|
29
|
+
items={[{ label: 'Site', value: 'Example', href: '/about' }]}
|
|
30
|
+
linkComponent={RouterLink}
|
|
31
|
+
linkHrefProp="to"
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
expect(screen.getByRole('link', { name: 'Example' })).toHaveAttribute('data-router-to', '/about');
|
|
35
|
+
});
|
|
36
|
+
|
|
21
37
|
it('has no accessibility violations', async () => {
|
|
22
38
|
const { container } = render(<ContactStrip items={[{ label: 'Address', value: 'New York, NY' }]} />);
|
|
23
39
|
expect(await axe(container)).toHaveNoViolations();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { cn } from '../../utils/cn';
|
|
3
|
+
import { linkDestination, type LinkLikeProps } from '../../utils/link';
|
|
3
4
|
|
|
4
5
|
export type ContactItem = {
|
|
5
6
|
label: string;
|
|
@@ -8,15 +9,13 @@ export type ContactItem = {
|
|
|
8
9
|
icon?: React.ReactNode;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
|
-
export type ContactStripProps = React.HTMLAttributes<HTMLUListElement> & {
|
|
12
|
+
export type ContactStripProps = React.HTMLAttributes<HTMLUListElement> & LinkLikeProps & {
|
|
12
13
|
/** Contact rows to display. */
|
|
13
14
|
items: ContactItem[];
|
|
14
15
|
/** Desktop column count (2-3). Default 2. */
|
|
15
16
|
columns?: 2 | 3;
|
|
16
17
|
/** Content alignment. Default 'left'. */
|
|
17
18
|
align?: 'left' | 'center';
|
|
18
|
-
/** Custom link element for routers. */
|
|
19
|
-
linkComponent?: React.ElementType;
|
|
20
19
|
};
|
|
21
20
|
|
|
22
21
|
const columnClasses: Record<NonNullable<ContactStripProps['columns']>, string> = {
|
|
@@ -29,7 +28,7 @@ const columnClasses: Record<NonNullable<ContactStripProps['columns']>, string> =
|
|
|
29
28
|
* pairs a short label with a phone, email, address or link.
|
|
30
29
|
*/
|
|
31
30
|
export const ContactStrip = React.forwardRef<HTMLUListElement, ContactStripProps>(function ContactStrip(
|
|
32
|
-
{ items, columns = 2, align = 'left', linkComponent, className, ...props },
|
|
31
|
+
{ items, columns = 2, align = 'left', linkComponent, linkHrefProp = 'href', className, ...props },
|
|
33
32
|
ref
|
|
34
33
|
) {
|
|
35
34
|
const Link = linkComponent ?? 'a';
|
|
@@ -46,7 +45,7 @@ export const ContactStrip = React.forwardRef<HTMLUListElement, ContactStripProps
|
|
|
46
45
|
<div className="min-w-0">
|
|
47
46
|
<p className="text-xs font-semibold uppercase tracking-wider text-muted-foreground">{item.label}</p>
|
|
48
47
|
{item.href ? (
|
|
49
|
-
<Link
|
|
48
|
+
<Link {...linkDestination(item.href, linkHrefProp)} className="mt-0.5 block break-words text-sm font-medium text-primary-ink underline-offset-4 hover:underline">
|
|
50
49
|
{item.value}
|
|
51
50
|
</Link>
|
|
52
51
|
) : (
|
|
@@ -47,6 +47,25 @@ describe('DealCard', () => {
|
|
|
47
47
|
expect(onRequestAccess).toHaveBeenCalled();
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
+
it('passes the destination via linkHrefProp for routers that use "to"', () => {
|
|
51
|
+
const RouterLink = ({ to, children, ...rest }: { to: string; children: React.ReactNode }) => (
|
|
52
|
+
<a href={to} data-router-to={to} {...rest}>
|
|
53
|
+
{children}
|
|
54
|
+
</a>
|
|
55
|
+
);
|
|
56
|
+
render(
|
|
57
|
+
<DealCard
|
|
58
|
+
title="Deal"
|
|
59
|
+
sector="Technology"
|
|
60
|
+
metrics={metrics}
|
|
61
|
+
href="/deals/1"
|
|
62
|
+
linkComponent={RouterLink}
|
|
63
|
+
linkHrefProp="to"
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
66
|
+
expect(screen.getByRole('link', { name: 'Deal' })).toHaveAttribute('data-router-to', '/deals/1');
|
|
67
|
+
});
|
|
68
|
+
|
|
50
69
|
it('has no accessibility violations', async () => {
|
|
51
70
|
const { container } = render(<DealCard title="Deal" sector="Technology" metrics={metrics} />);
|
|
52
71
|
expect(await axe(container)).toHaveNoViolations();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { cn } from '../../utils/cn';
|
|
3
|
+
import { linkDestination, type LinkLikeProps } from '../../utils/link';
|
|
3
4
|
import { Badge } from '../badge/Badge';
|
|
4
5
|
import { Button } from '../button/Button';
|
|
5
6
|
import { Card, CardContent, CardFooter, CardHeader } from '../card/Card';
|
|
@@ -11,7 +12,7 @@ export type DealMetric = {
|
|
|
11
12
|
|
|
12
13
|
export type DealStatus = 'available' | 'under-nda' | 'closed' | 'draft';
|
|
13
14
|
|
|
14
|
-
export type DealCardProps = Omit<React.HTMLAttributes<HTMLElement>, 'title'> & {
|
|
15
|
+
export type DealCardProps = Omit<React.HTMLAttributes<HTMLElement>, 'title'> & LinkLikeProps & {
|
|
15
16
|
/** Deal headline. */
|
|
16
17
|
title: string;
|
|
17
18
|
/** Sector or industry label. */
|
|
@@ -30,8 +31,6 @@ export type DealCardProps = Omit<React.HTMLAttributes<HTMLElement>, 'title'> & {
|
|
|
30
31
|
cimAvailable?: boolean;
|
|
31
32
|
/** Optional deal detail link. */
|
|
32
33
|
href?: string;
|
|
33
|
-
/** Custom link element for routers. */
|
|
34
|
-
linkComponent?: React.ElementType;
|
|
35
34
|
/** Save toggle state. */
|
|
36
35
|
saved?: boolean;
|
|
37
36
|
onSave?: () => void;
|
|
@@ -66,6 +65,7 @@ export const DealCard = React.forwardRef<HTMLElement, DealCardProps>(function De
|
|
|
66
65
|
cimAvailable,
|
|
67
66
|
href,
|
|
68
67
|
linkComponent,
|
|
68
|
+
linkHrefProp = 'href',
|
|
69
69
|
saved = false,
|
|
70
70
|
onSave,
|
|
71
71
|
saveLabel = 'Save',
|
|
@@ -88,7 +88,7 @@ export const DealCard = React.forwardRef<HTMLElement, DealCardProps>(function De
|
|
|
88
88
|
</div>
|
|
89
89
|
<h3 className="text-lg font-semibold leading-snug tracking-tight">
|
|
90
90
|
{href ? (
|
|
91
|
-
<Link
|
|
91
|
+
<Link {...linkDestination(href, linkHrefProp)} className="rounded-sm hover:text-primary-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
|
|
92
92
|
{title}
|
|
93
93
|
</Link>
|
|
94
94
|
) : (
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { cn } from '../../utils/cn';
|
|
3
3
|
import { Button, type ButtonProps } from '../button/Button';
|
|
4
|
+
import { linkDestination, type LinkLikeProps } from '../../utils/link';
|
|
4
5
|
|
|
5
6
|
/** Object form of `action`: EmptyState renders the button/link for you. */
|
|
6
7
|
export type EmptyStateAction = {
|
|
@@ -11,7 +12,7 @@ export type EmptyStateAction = {
|
|
|
11
12
|
variant?: ButtonProps['variant'];
|
|
12
13
|
};
|
|
13
14
|
|
|
14
|
-
export type EmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
15
|
+
export type EmptyStateProps = React.HTMLAttributes<HTMLDivElement> & LinkLikeProps & {
|
|
15
16
|
/** Icon or illustration shown above the title. */
|
|
16
17
|
icon?: React.ReactNode;
|
|
17
18
|
title: string;
|
|
@@ -34,10 +35,6 @@ export type EmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
34
35
|
* default dashed outline. Default 'plain'.
|
|
35
36
|
*/
|
|
36
37
|
tone?: 'plain' | 'panel';
|
|
37
|
-
/** Custom link element for action hrefs (Next Link, react-router Link). */
|
|
38
|
-
linkComponent?: React.ElementType;
|
|
39
|
-
/** Prop used to pass the destination to `linkComponent`. */
|
|
40
|
-
linkHrefProp?: 'href' | 'to';
|
|
41
38
|
};
|
|
42
39
|
|
|
43
40
|
function isActionObject(value: unknown): value is EmptyStateAction {
|
|
@@ -59,7 +56,7 @@ function renderAction(
|
|
|
59
56
|
const { label, onClick, href, variant } = action;
|
|
60
57
|
if (href) {
|
|
61
58
|
const LinkEl = linkComponent ?? 'a';
|
|
62
|
-
const destination =
|
|
59
|
+
const destination = linkDestination(href, linkHrefProp);
|
|
63
60
|
return (
|
|
64
61
|
<Button variant={variant} asChild>
|
|
65
62
|
<LinkEl {...destination}>{label}</LinkEl>
|
|
@@ -53,6 +53,14 @@ describe('EntityCard', () => {
|
|
|
53
53
|
expect(screen.getByRole('link', { name: 'North Park' })).toHaveAttribute('data-router-link');
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
+
it('passes destinations via linkHrefProp for routers that use "to"', () => {
|
|
57
|
+
const RouterLink = ({ to, children, ...rest }: { to: string; children: ReactNode }) => (
|
|
58
|
+
<a href={to} data-router-to={to} {...rest}>{children}</a>
|
|
59
|
+
);
|
|
60
|
+
render(<EntityCard name="North Park" entityType="Private equity" href="/members/north-park" linkComponent={RouterLink} linkHrefProp="to" />);
|
|
61
|
+
expect(screen.getByRole('link', { name: 'North Park' })).toHaveAttribute('data-router-to', '/members/north-park');
|
|
62
|
+
});
|
|
63
|
+
|
|
56
64
|
it('falls back to initials and exposes the ProfileCard alias', () => {
|
|
57
65
|
render(<ProfileCard name="North Park" entityType="Private equity" />);
|
|
58
66
|
expect(screen.getByText('NP')).toBeInTheDocument();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { cn } from '../../utils/cn';
|
|
3
|
+
import { linkDestination, type LinkLikeProps } from '../../utils/link';
|
|
3
4
|
import { Avatar, AvatarFallback } from '../avatar/Avatar';
|
|
4
5
|
import { Badge } from '../badge/Badge';
|
|
5
6
|
import { Card, CardContent, CardFooter, CardHeader } from '../card/Card';
|
|
@@ -9,7 +10,7 @@ export type EntityStat = {
|
|
|
9
10
|
value: string;
|
|
10
11
|
};
|
|
11
12
|
|
|
12
|
-
export type EntityCardProps = React.HTMLAttributes<HTMLElement> & {
|
|
13
|
+
export type EntityCardProps = React.HTMLAttributes<HTMLElement> & LinkLikeProps & {
|
|
13
14
|
/** Firm or member name. */
|
|
14
15
|
name: string;
|
|
15
16
|
/** Firm type, role or member category. */
|
|
@@ -33,8 +34,6 @@ export type EntityCardProps = React.HTMLAttributes<HTMLElement> & {
|
|
|
33
34
|
* the overlay; the redundant footer "View profile" link is suppressed.
|
|
34
35
|
*/
|
|
35
36
|
cardHref?: string;
|
|
36
|
-
/** Custom link element for routers. */
|
|
37
|
-
linkComponent?: React.ElementType;
|
|
38
37
|
/** Extra footer actions. */
|
|
39
38
|
actions?: React.ReactNode;
|
|
40
39
|
};
|
|
@@ -65,6 +64,7 @@ export const EntityCard = React.forwardRef<HTMLElement, EntityCardProps>(functio
|
|
|
65
64
|
href,
|
|
66
65
|
cardHref,
|
|
67
66
|
linkComponent,
|
|
67
|
+
linkHrefProp = 'href',
|
|
68
68
|
actions,
|
|
69
69
|
className,
|
|
70
70
|
...props
|
|
@@ -89,7 +89,7 @@ export const EntityCard = React.forwardRef<HTMLElement, EntityCardProps>(functio
|
|
|
89
89
|
<h3 className="truncate text-base font-semibold tracking-tight">
|
|
90
90
|
{nameHref ? (
|
|
91
91
|
<Link
|
|
92
|
-
|
|
92
|
+
{...linkDestination(nameHref, linkHrefProp)}
|
|
93
93
|
className={cn(
|
|
94
94
|
'rounded-sm hover:text-primary-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',
|
|
95
95
|
stretched && 'after:absolute after:inset-0 after:content-[""]'
|
|
@@ -131,7 +131,7 @@ export const EntityCard = React.forwardRef<HTMLElement, EntityCardProps>(functio
|
|
|
131
131
|
<CardFooter className={cn('flex flex-wrap items-center gap-2 border-t border-border px-5 py-3', stretched && 'relative z-10')}>
|
|
132
132
|
{href && !stretched && (
|
|
133
133
|
<Link
|
|
134
|
-
|
|
134
|
+
{...linkDestination(href, linkHrefProp)}
|
|
135
135
|
className="text-sm font-medium text-primary-ink underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
136
136
|
>
|
|
137
137
|
View profile
|
|
@@ -26,6 +26,22 @@ describe('FeatureGrid', () => {
|
|
|
26
26
|
expect(screen.getByRole('heading', { name: 'One' }).parentElement).toHaveClass('items-center', 'text-center');
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
+
it('passes destinations via linkHrefProp for routers that use "to"', () => {
|
|
30
|
+
const RouterLink = ({ to, children, ...rest }: { to: string; children: React.ReactNode }) => (
|
|
31
|
+
<a href={to} data-router-to={to} {...rest}>
|
|
32
|
+
{children}
|
|
33
|
+
</a>
|
|
34
|
+
);
|
|
35
|
+
render(
|
|
36
|
+
<FeatureGrid
|
|
37
|
+
features={[{ title: 'Feature', href: '/features/1', actionLabel: 'Learn more' }]}
|
|
38
|
+
linkComponent={RouterLink}
|
|
39
|
+
linkHrefProp="to"
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
expect(screen.getByRole('link', { name: /Learn more/ })).toHaveAttribute('data-router-to', '/features/1');
|
|
43
|
+
});
|
|
44
|
+
|
|
29
45
|
it('has no accessibility violations', async () => {
|
|
30
46
|
const { container } = render(<FeatureGrid features={[{ title: 'Feature', description: 'Copy' }]} />);
|
|
31
47
|
expect(await axe(container)).toHaveNoViolations();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { cn } from '../../utils/cn';
|
|
3
|
+
import { linkDestination, type LinkLikeProps } from '../../utils/link';
|
|
3
4
|
|
|
4
5
|
export type FeatureItem = {
|
|
5
6
|
title: string;
|
|
@@ -10,7 +11,7 @@ export type FeatureItem = {
|
|
|
10
11
|
actionLabel?: string;
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
export type FeatureGridProps = React.HTMLAttributes<HTMLUListElement> & {
|
|
14
|
+
export type FeatureGridProps = React.HTMLAttributes<HTMLUListElement> & LinkLikeProps & {
|
|
14
15
|
/** Features to display. */
|
|
15
16
|
features: FeatureItem[];
|
|
16
17
|
/** Desktop column count (2-4). Default 3. */
|
|
@@ -19,8 +20,6 @@ export type FeatureGridProps = React.HTMLAttributes<HTMLUListElement> & {
|
|
|
19
20
|
variant?: 'card' | 'plain';
|
|
20
21
|
/** Content alignment. Default 'left'. */
|
|
21
22
|
align?: 'left' | 'center';
|
|
22
|
-
/** Custom link element for routers. */
|
|
23
|
-
linkComponent?: React.ElementType;
|
|
24
23
|
};
|
|
25
24
|
|
|
26
25
|
const columnClasses: Record<NonNullable<FeatureGridProps['columns']>, string> = {
|
|
@@ -35,7 +34,7 @@ const columnClasses: Record<NonNullable<FeatureGridProps['columns']>, string> =
|
|
|
35
34
|
* marketing pages. Each card is a list item, so the group is announced as a list.
|
|
36
35
|
*/
|
|
37
36
|
export const FeatureGrid = React.forwardRef<HTMLUListElement, FeatureGridProps>(function FeatureGrid(
|
|
38
|
-
{ features, columns = 3, variant = 'card', align = 'left', linkComponent, className, ...props },
|
|
37
|
+
{ features, columns = 3, variant = 'card', align = 'left', linkComponent, linkHrefProp = 'href', className, ...props },
|
|
39
38
|
ref
|
|
40
39
|
) {
|
|
41
40
|
const Link = linkComponent ?? 'a';
|
|
@@ -67,7 +66,7 @@ export const FeatureGrid = React.forwardRef<HTMLUListElement, FeatureGridProps>(
|
|
|
67
66
|
{features.map((feature) => (
|
|
68
67
|
<li key={feature.title} className="min-w-0">
|
|
69
68
|
{feature.href ? (
|
|
70
|
-
<Link
|
|
69
|
+
<Link {...linkDestination(feature.href, linkHrefProp)} className={cn(cardClass, 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background')}>
|
|
71
70
|
{content(feature)}
|
|
72
71
|
</Link>
|
|
73
72
|
) : (
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
5
|
import { cn } from '../../utils/cn';
|
|
6
|
+
import { linkDestination, type LinkLikeProps } from '../../utils/link';
|
|
6
7
|
|
|
7
8
|
type LinkTabsVariant = 'default' | 'underline' | 'rounded';
|
|
8
9
|
type LinkTabsSize = 'sm' | 'md' | 'lg';
|
|
@@ -20,18 +21,11 @@ export type LinkTabsItem = {
|
|
|
20
21
|
disabled?: boolean;
|
|
21
22
|
};
|
|
22
23
|
|
|
23
|
-
export type LinkTabsProps = Omit<React.HTMLAttributes<HTMLElement>, 'children'> & {
|
|
24
|
+
export type LinkTabsProps = Omit<React.HTMLAttributes<HTMLElement>, 'children'> & LinkLikeProps & {
|
|
24
25
|
/** Tabs in display order. */
|
|
25
26
|
items: LinkTabsItem[];
|
|
26
27
|
/** Current pathname, used to mark the active tab. */
|
|
27
28
|
activeHref?: string;
|
|
28
|
-
/** Router link element (Inertia Link, Next Link, react-router Link). Defaults to `<a>`. */
|
|
29
|
-
linkComponent?: React.ElementType;
|
|
30
|
-
/**
|
|
31
|
-
* Prop used to pass the destination to `linkComponent`. `href` covers
|
|
32
|
-
* anchors and Next.js Link; `to` covers react-router and similar routers.
|
|
33
|
-
*/
|
|
34
|
-
linkHrefProp?: 'href' | 'to';
|
|
35
29
|
/** Visual style. */
|
|
36
30
|
variant?: LinkTabsVariant;
|
|
37
31
|
/** Control density. */
|
|
@@ -134,7 +128,7 @@ export const LinkTabs = React.forwardRef<HTMLElement, LinkTabsProps>(function Li
|
|
|
134
128
|
return (
|
|
135
129
|
<Link
|
|
136
130
|
key={item.href}
|
|
137
|
-
{...(
|
|
131
|
+
{...linkDestination(item.href, linkHrefProp)}
|
|
138
132
|
aria-current={active ? 'page' : undefined}
|
|
139
133
|
data-active={active ? 'true' : 'false'}
|
|
140
134
|
className={itemVariants({ variant, size })}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { cn } from '../../utils/cn';
|
|
3
|
+
import { linkDestination, type LinkLikeProps } from '../../utils/link';
|
|
3
4
|
|
|
4
5
|
export type LogoItem = {
|
|
5
6
|
/** Accessible name announced for the logo. */
|
|
@@ -10,7 +11,7 @@ export type LogoItem = {
|
|
|
10
11
|
href?: string;
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
export type LogoCloudProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
14
|
+
export type LogoCloudProps = React.HTMLAttributes<HTMLDivElement> & LinkLikeProps & {
|
|
14
15
|
/** Logos to display. */
|
|
15
16
|
items: LogoItem[];
|
|
16
17
|
/** Caption above the strip. */
|
|
@@ -23,10 +24,6 @@ export type LogoCloudProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
23
24
|
size?: 'sm' | 'md' | 'lg';
|
|
24
25
|
/** Caption and grid alignment. Default 'center'. */
|
|
25
26
|
align?: 'left' | 'center';
|
|
26
|
-
/** Custom link element for routers. */
|
|
27
|
-
linkComponent?: React.ElementType;
|
|
28
|
-
/** Prop used to pass the destination to linkComponent ('to' for react-router). */
|
|
29
|
-
linkHrefProp?: 'href' | 'to';
|
|
30
27
|
};
|
|
31
28
|
|
|
32
29
|
const columnClasses: Record<NonNullable<LogoCloudProps['columns']>, string> = {
|
|
@@ -96,7 +93,7 @@ export const LogoCloud = React.forwardRef<HTMLDivElement, LogoCloudProps>(functi
|
|
|
96
93
|
<li key={item.name} className={cn('min-w-0', align === 'center' ? 'justify-self-center' : 'justify-self-start')}>
|
|
97
94
|
{item.href ? (
|
|
98
95
|
<Link
|
|
99
|
-
{...(
|
|
96
|
+
{...linkDestination(item.href, linkHrefProp)}
|
|
100
97
|
className="rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
|
101
98
|
>
|
|
102
99
|
{content}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { axe } from 'jest-axe';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import { MediaCard } from './MediaCard';
|
|
5
|
+
|
|
6
|
+
describe('MediaCard', () => {
|
|
7
|
+
it('renders title, description, meta, chips and footer', () => {
|
|
8
|
+
render(
|
|
9
|
+
<MediaCard
|
|
10
|
+
title="Fall Classic"
|
|
11
|
+
description="Two days of ballroom."
|
|
12
|
+
meta="Mar 14 · Salt Lake City"
|
|
13
|
+
chips={[{ label: 'Open', variant: 'outline-success', dot: true }]}
|
|
14
|
+
footer="Details →"
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
expect(screen.getByRole('heading', { name: 'Fall Classic' })).toBeInTheDocument();
|
|
18
|
+
expect(screen.getByText('Two days of ballroom.')).toBeInTheDocument();
|
|
19
|
+
expect(screen.getByText('Mar 14 · Salt Lake City')).toBeInTheDocument();
|
|
20
|
+
expect(screen.getByText('Open')).toBeInTheDocument();
|
|
21
|
+
expect(screen.getByText('Details →')).toBeInTheDocument();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('makes the whole card a single link when href is set', () => {
|
|
25
|
+
const { container } = render(
|
|
26
|
+
<MediaCard href="/events/fall-classic" title="Fall Classic" meta="Mar 14" />
|
|
27
|
+
);
|
|
28
|
+
const link = screen.getByRole('link', { name: /Fall Classic/ });
|
|
29
|
+
expect(link).toHaveAttribute('href', '/events/fall-classic');
|
|
30
|
+
expect(container.querySelectorAll('a')).toHaveLength(1);
|
|
31
|
+
expect(link).toHaveClass('group');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('renders a static article when href is absent', () => {
|
|
35
|
+
render(<MediaCard title="No link" />);
|
|
36
|
+
expect(screen.queryByRole('link')).not.toBeInTheDocument();
|
|
37
|
+
expect(screen.getByRole('article')).toBeInTheDocument();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('renders the cover through CoverImage with the seeded fallback', () => {
|
|
41
|
+
const { container } = render(
|
|
42
|
+
<MediaCard
|
|
43
|
+
title="No art"
|
|
44
|
+
cover={{ alt: 'No art cover', seed: 'no-art', aspect: 'square' }}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
expect(container.querySelector('.aspect-square')).toBeInTheDocument();
|
|
48
|
+
expect(container.querySelector('img')).not.toBeInTheDocument();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('renders the cover image when src is provided', () => {
|
|
52
|
+
render(
|
|
53
|
+
<MediaCard
|
|
54
|
+
title="With art"
|
|
55
|
+
cover={{ src: '/cover.jpg', alt: 'Event cover', aspect: 'video' }}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
expect(screen.getByRole('img', { name: 'Event cover' })).toBeInTheDocument();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('supports row layout with a fixed-width cover', () => {
|
|
62
|
+
const { container } = render(
|
|
63
|
+
<MediaCard layout="row" title="Row" cover={{ alt: 'Row cover' }} />
|
|
64
|
+
);
|
|
65
|
+
expect(container.querySelector('.sm\\:w-44')).toBeInTheDocument();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('routes href through a custom linkComponent and linkHrefProp', () => {
|
|
69
|
+
function RouterLink({ to, children, ...rest }: { to: string; children: React.ReactNode }) {
|
|
70
|
+
return <a href={to} data-router-link={to} {...rest}>{children}</a>;
|
|
71
|
+
}
|
|
72
|
+
render(
|
|
73
|
+
<MediaCard
|
|
74
|
+
href="/events/x"
|
|
75
|
+
title="Routed"
|
|
76
|
+
linkComponent={RouterLink}
|
|
77
|
+
linkHrefProp="to"
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
const link = screen.getByRole('link', { name: /Routed/ });
|
|
81
|
+
expect(link).toHaveAttribute('data-router-link', '/events/x');
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('has no axe violations', async () => {
|
|
85
|
+
const { container } = render(
|
|
86
|
+
<MediaCard
|
|
87
|
+
href="/events/fall-classic"
|
|
88
|
+
title="Fall Classic"
|
|
89
|
+
description="Two days of ballroom."
|
|
90
|
+
cover={{ alt: 'Fall Classic cover', seed: 'fall-classic' }}
|
|
91
|
+
chips={[{ label: 'Open', variant: 'outline-success', dot: true }]}
|
|
92
|
+
footer="Details →"
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
96
|
+
});
|
|
97
|
+
});
|