@slipstream-ui/core 0.6.1 → 0.8.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 +470 -30
- package/dist/index.d.ts +470 -30
- package/dist/index.js +1455 -750
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1442 -744
- package/dist/index.mjs.map +1 -1
- package/dist/manifests/accordion.manifest.json +7 -1
- 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/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 +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 +158 -0
- package/dist/manifests/dialog.manifest.json +1 -1
- package/dist/manifests/document-card.manifest.json +108 -0
- package/dist/manifests/drawer.manifest.json +48 -2
- package/dist/manifests/empty-state.manifest.json +1 -1
- package/dist/manifests/entity-card.manifest.json +114 -0
- 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 +40 -8
- 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 +88 -0
- 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 +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 +2 -2
- 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 +1 -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 +69 -5
- 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 +26 -5
- 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 +97 -0
- 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/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/date-picker/DatePicker.js +1 -1
- package/dist/src/components/date-picker/DatePicker.js.map +1 -1
- package/dist/src/components/date-picker/DatePicker.mjs +1 -1
- package/dist/src/components/date-picker/DatePicker.mjs.map +1 -1
- package/dist/src/components/deal-card/DealCard.d.ts +72 -0
- package/dist/src/components/deal-card/DealCard.js +108 -0
- package/dist/src/components/deal-card/DealCard.js.map +1 -0
- package/dist/src/components/deal-card/DealCard.mjs +74 -0
- package/dist/src/components/deal-card/DealCard.mjs.map +1 -0
- package/dist/src/components/deal-card/index.d.ts +2 -0
- package/dist/src/components/deal-card/index.js +29 -0
- package/dist/src/components/deal-card/index.js.map +1 -0
- package/dist/src/components/deal-card/index.mjs +5 -0
- package/dist/src/components/deal-card/index.mjs.map +1 -0
- package/dist/src/components/document-card/DocumentCard.d.ts +42 -0
- package/dist/src/components/document-card/DocumentCard.js +84 -0
- package/dist/src/components/document-card/DocumentCard.js.map +1 -0
- package/dist/src/components/document-card/DocumentCard.mjs +50 -0
- package/dist/src/components/document-card/DocumentCard.mjs.map +1 -0
- package/dist/src/components/document-card/index.d.ts +2 -0
- package/dist/src/components/document-card/index.js +29 -0
- package/dist/src/components/document-card/index.js.map +1 -0
- package/dist/src/components/document-card/index.mjs +5 -0
- package/dist/src/components/document-card/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/entity-card/EntityCard.d.ts +78 -0
- package/dist/src/components/entity-card/EntityCard.js +95 -0
- package/dist/src/components/entity-card/EntityCard.js.map +1 -0
- package/dist/src/components/entity-card/EntityCard.mjs +60 -0
- package/dist/src/components/entity-card/EntityCard.mjs.map +1 -0
- package/dist/src/components/entity-card/index.d.ts +2 -0
- package/dist/src/components/entity-card/index.js +31 -0
- package/dist/src/components/entity-card/index.js.map +1 -0
- package/dist/src/components/entity-card/index.mjs +6 -0
- package/dist/src/components/entity-card/index.mjs.map +1 -0
- package/dist/src/components/hero/Hero.d.ts +25 -13
- package/dist/src/components/hero/Hero.js +116 -12
- package/dist/src/components/hero/Hero.js.map +1 -1
- package/dist/src/components/hero/Hero.mjs +116 -12
- package/dist/src/components/hero/Hero.mjs.map +1 -1
- package/dist/src/components/load-more/LoadMore.d.ts +34 -0
- package/dist/src/components/load-more/LoadMore.js +55 -0
- package/dist/src/components/load-more/LoadMore.js.map +1 -0
- package/dist/src/components/load-more/LoadMore.mjs +21 -0
- package/dist/src/components/load-more/LoadMore.mjs.map +1 -0
- package/dist/src/components/load-more/index.d.ts +2 -0
- package/dist/src/components/load-more/index.js +29 -0
- package/dist/src/components/load-more/index.js.map +1 -0
- package/dist/src/components/load-more/index.mjs +5 -0
- package/dist/src/components/load-more/index.mjs.map +1 -0
- 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 +3 -2
- package/dist/src/components/page-header/PageHeader.js.map +1 -1
- package/dist/src/components/page-header/PageHeader.mjs +3 -2
- package/dist/src/components/page-header/PageHeader.mjs.map +1 -1
- package/dist/src/components/range-slider/RangeSlider.js +6 -6
- package/dist/src/components/range-slider/RangeSlider.js.map +1 -1
- package/dist/src/components/range-slider/RangeSlider.mjs +6 -6
- package/dist/src/components/range-slider/RangeSlider.mjs.map +1 -1
- package/dist/src/components/select-menu/SelectMenu.js +2 -0
- package/dist/src/components/select-menu/SelectMenu.js.map +1 -1
- package/dist/src/components/select-menu/SelectMenu.mjs +2 -0
- package/dist/src/components/select-menu/SelectMenu.mjs.map +1 -1
- package/dist/src/components/separator/Separator.d.ts +3 -3
- package/dist/src/components/separator/Separator.js +1 -1
- package/dist/src/components/separator/Separator.js.map +1 -1
- package/dist/src/components/separator/Separator.mjs +1 -1
- package/dist/src/components/separator/Separator.mjs.map +1 -1
- package/dist/src/components/stepper/Stepper.d.ts +35 -0
- package/dist/src/components/stepper/Stepper.js +118 -25
- package/dist/src/components/stepper/Stepper.js.map +1 -1
- package/dist/src/components/stepper/Stepper.mjs +118 -25
- package/dist/src/components/stepper/Stepper.mjs.map +1 -1
- package/dist/src/components/table-of-contents/TableOfContents.d.ts +10 -2
- package/dist/src/components/table-of-contents/TableOfContents.js +13 -0
- package/dist/src/components/table-of-contents/TableOfContents.js.map +1 -1
- package/dist/src/components/table-of-contents/TableOfContents.mjs +13 -0
- package/dist/src/components/table-of-contents/TableOfContents.mjs.map +1 -1
- package/dist/src/components/tabs/Tabs.js +43 -3
- package/dist/src/components/tabs/Tabs.js.map +1 -1
- package/dist/src/components/tabs/Tabs.mjs +43 -3
- package/dist/src/components/tabs/Tabs.mjs.map +1 -1
- package/dist/src/components/time-picker/TimePicker.js +1 -1
- package/dist/src/components/time-picker/TimePicker.js.map +1 -1
- package/dist/src/components/time-picker/TimePicker.mjs +1 -1
- package/dist/src/components/time-picker/TimePicker.mjs.map +1 -1
- package/dist/src/components/timeline/Timeline.js +2 -2
- package/dist/src/components/timeline/Timeline.js.map +1 -1
- package/dist/src/components/timeline/Timeline.mjs +2 -2
- package/dist/src/components/timeline/Timeline.mjs.map +1 -1
- package/dist/src/components/tombstone-card/TombstoneCard.d.ts +39 -0
- package/dist/src/components/tombstone-card/TombstoneCard.js +86 -0
- package/dist/src/components/tombstone-card/TombstoneCard.js.map +1 -0
- package/dist/src/components/tombstone-card/TombstoneCard.mjs +52 -0
- package/dist/src/components/tombstone-card/TombstoneCard.mjs.map +1 -0
- package/dist/src/components/tombstone-card/index.d.ts +2 -0
- package/dist/src/components/tombstone-card/index.js +29 -0
- package/dist/src/components/tombstone-card/index.js.map +1 -0
- package/dist/src/components/tombstone-card/index.mjs +5 -0
- package/dist/src/components/tombstone-card/index.mjs.map +1 -0
- package/dist/src/index.d.ts +6 -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/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/date-picker/DatePicker.tsx +1 -1
- package/src/components/deal-card/DealCard.test.tsx +54 -0
- package/src/components/deal-card/DealCard.tsx +138 -0
- package/src/components/deal-card/index.ts +2 -0
- package/src/components/document-card/DocumentCard.test.tsx +41 -0
- package/src/components/document-card/DocumentCard.tsx +82 -0
- package/src/components/document-card/index.ts +2 -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/entity-card/EntityCard.test.tsx +38 -0
- package/src/components/entity-card/EntityCard.tsx +133 -0
- package/src/components/entity-card/index.ts +2 -0
- package/src/components/hero/Hero.test.tsx +14 -0
- package/src/components/hero/Hero.tsx +111 -19
- package/src/components/load-more/LoadMore.test.tsx +28 -0
- package/src/components/load-more/LoadMore.tsx +53 -0
- package/src/components/load-more/index.ts +2 -0
- 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 +5 -2
- package/src/components/range-slider/RangeSlider.test.tsx +8 -0
- package/src/components/range-slider/RangeSlider.tsx +10 -6
- package/src/components/select-menu/SelectMenu.test.tsx +20 -10
- package/src/components/select-menu/SelectMenu.tsx +2 -0
- package/src/components/separator/Separator.test.tsx +9 -1
- package/src/components/separator/Separator.tsx +1 -1
- package/src/components/stepper/Stepper.test.tsx +19 -0
- package/src/components/stepper/Stepper.tsx +169 -37
- package/src/components/table-of-contents/TableOfContents.test.tsx +12 -1
- package/src/components/table-of-contents/TableOfContents.tsx +25 -1
- package/src/components/tabs/Tabs.test.tsx +12 -0
- package/src/components/tabs/Tabs.tsx +48 -4
- package/src/components/time-picker/TimePicker.tsx +1 -1
- package/src/components/timeline/Timeline.tsx +2 -2
- package/src/components/tombstone-card/TombstoneCard.test.tsx +26 -0
- package/src/components/tombstone-card/TombstoneCard.tsx +77 -0
- package/src/components/tombstone-card/index.ts +2 -0
- package/src/index.ts +6 -0
- package/src/manifests/accordion.manifest.json +7 -1
- 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/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 +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 +158 -0
- package/src/manifests/dialog.manifest.json +1 -1
- package/src/manifests/document-card.manifest.json +108 -0
- package/src/manifests/drawer.manifest.json +48 -2
- package/src/manifests/empty-state.manifest.json +1 -1
- package/src/manifests/entity-card.manifest.json +114 -0
- 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 +40 -8
- 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 +88 -0
- 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 +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 +2 -2
- 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 +1 -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 +69 -5
- 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 +26 -5
- 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 +97 -0
- package/src/manifests/tooltip.manifest.json +1 -1
- package/src/test/jest-axe.d.ts +6 -1
|
@@ -127,3 +127,34 @@ describe('Accordion variant and gap', () => {
|
|
|
127
127
|
expect(root).toHaveStyle({ gap: '10px' });
|
|
128
128
|
});
|
|
129
129
|
});
|
|
130
|
+
|
|
131
|
+
describe('declarative items', () => {
|
|
132
|
+
it('renders a trigger and panel per item', async () => {
|
|
133
|
+
const user = userEvent.setup();
|
|
134
|
+
render(
|
|
135
|
+
<Accordion items={[
|
|
136
|
+
{ id: 'one', title: 'First', content: 'First body' },
|
|
137
|
+
{ id: 'two', title: 'Second', content: 'Second body' },
|
|
138
|
+
]} />
|
|
139
|
+
);
|
|
140
|
+
expect(screen.getAllByRole('button')).toHaveLength(2);
|
|
141
|
+
expect(screen.getByText('First body')).toBeInTheDocument();
|
|
142
|
+
await user.click(screen.getByRole('button', { name: 'First' }));
|
|
143
|
+
expect(screen.getByRole('button', { name: 'First' })).toHaveAttribute('aria-expanded', 'true');
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('disables an item without dropping its panel', () => {
|
|
147
|
+
render(
|
|
148
|
+
<Accordion items={[{ id: 'locked', title: 'Locked', content: 'Body', disabled: true }]} />
|
|
149
|
+
);
|
|
150
|
+
expect(screen.getByRole('button', { name: 'Locked' })).toBeDisabled();
|
|
151
|
+
expect(screen.getByText('Body')).toBeInTheDocument();
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it('has no accessibility violations', async () => {
|
|
155
|
+
const { container } = render(
|
|
156
|
+
<Accordion items={[{ id: 'one', title: 'First', content: 'First body' }]} />
|
|
157
|
+
);
|
|
158
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
159
|
+
});
|
|
160
|
+
});
|
|
@@ -17,6 +17,17 @@ const AccordionContext = React.createContext<AccordionContextValue>({
|
|
|
17
17
|
collapsible: true,
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
+
export type AccordionSection = {
|
|
21
|
+
/** Unique id linking the trigger to its panel. */
|
|
22
|
+
id: string;
|
|
23
|
+
/** Trigger label. */
|
|
24
|
+
title: React.ReactNode;
|
|
25
|
+
/** Panel content. */
|
|
26
|
+
content: React.ReactNode;
|
|
27
|
+
/** Disables the trigger for this section. */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
};
|
|
30
|
+
|
|
20
31
|
export type AccordionProps = {
|
|
21
32
|
/** Controlled open item ids. */
|
|
22
33
|
value?: string[];
|
|
@@ -30,9 +41,15 @@ export type AccordionProps = {
|
|
|
30
41
|
variant?: 'default' | 'borderless';
|
|
31
42
|
/** Token gap ('lg') or exact pixels (16) between items. */
|
|
32
43
|
gap?: GapValue;
|
|
44
|
+
/**
|
|
45
|
+
* Declarative sections. When provided, Accordion renders an
|
|
46
|
+
* AccordionItem/AccordionTrigger/AccordionContent per entry instead of
|
|
47
|
+
* reading `children`.
|
|
48
|
+
*/
|
|
49
|
+
items?: AccordionSection[];
|
|
33
50
|
className?: string;
|
|
34
51
|
style?: React.CSSProperties;
|
|
35
|
-
children
|
|
52
|
+
children?: React.ReactNode;
|
|
36
53
|
};
|
|
37
54
|
|
|
38
55
|
/**
|
|
@@ -48,6 +65,7 @@ const Accordion = React.forwardRef<HTMLDivElement, AccordionProps>(
|
|
|
48
65
|
collapsible = true,
|
|
49
66
|
variant = 'default',
|
|
50
67
|
gap,
|
|
68
|
+
items,
|
|
51
69
|
className,
|
|
52
70
|
style,
|
|
53
71
|
children,
|
|
@@ -86,7 +104,14 @@ const Accordion = React.forwardRef<HTMLDivElement, AccordionProps>(
|
|
|
86
104
|
style={{ ...gapResolved.style, ...style }}
|
|
87
105
|
>
|
|
88
106
|
<AccordionContext.Provider value={{ openItems: new Set(current), toggle, collapsible }}>
|
|
89
|
-
{
|
|
107
|
+
{items
|
|
108
|
+
? items.map((item) => (
|
|
109
|
+
<AccordionItem key={item.id} id={item.id}>
|
|
110
|
+
<AccordionTrigger disabled={item.disabled}>{item.title}</AccordionTrigger>
|
|
111
|
+
<AccordionContent>{item.content}</AccordionContent>
|
|
112
|
+
</AccordionItem>
|
|
113
|
+
))
|
|
114
|
+
: children}
|
|
90
115
|
</AccordionContext.Provider>
|
|
91
116
|
</div>
|
|
92
117
|
);
|
|
@@ -33,6 +33,42 @@ describe('AuthLayout', () => {
|
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
+
describe('AuthLayout migration aliases', () => {
|
|
37
|
+
it('reads subtitle and logo when description and brand are absent', () => {
|
|
38
|
+
render(<AuthLayout title="Sign in" subtitle="Welcome back." logo={<span>Acme</span>} />);
|
|
39
|
+
expect(screen.getByText('Welcome back.')).toBeInTheDocument();
|
|
40
|
+
expect(screen.getByText('Acme')).toBeInTheDocument();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('prefers description and brand when both forms are passed', () => {
|
|
44
|
+
render(
|
|
45
|
+
<AuthLayout
|
|
46
|
+
title="Sign in"
|
|
47
|
+
description="Canonical line"
|
|
48
|
+
subtitle="Alias line"
|
|
49
|
+
brand={<span>Canonical mark</span>}
|
|
50
|
+
logo={<span>Alias mark</span>}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
expect(screen.getByText('Canonical line')).toBeInTheDocument();
|
|
54
|
+
expect(screen.queryByText('Alias line')).not.toBeInTheDocument();
|
|
55
|
+
expect(screen.getByText('Canonical mark')).toBeInTheDocument();
|
|
56
|
+
expect(screen.queryByText('Alias mark')).not.toBeInTheDocument();
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
describe('AuthLayout maxWidth', () => {
|
|
61
|
+
it('overrides the size preset with a pixel width', () => {
|
|
62
|
+
const { container } = render(<AuthLayout title="Sign in" maxWidth={420} />);
|
|
63
|
+
expect(container.querySelector('[style*="max-width: 420px"]')).not.toBeNull();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('accepts any CSS width', () => {
|
|
67
|
+
const { container } = render(<AuthLayout title="Sign in" maxWidth="26rem" />);
|
|
68
|
+
expect(container.querySelector('[style*="max-width: 26rem"]')).not.toBeNull();
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
36
72
|
describe('split variant', () => {
|
|
37
73
|
it('renders the aside after the form', () => {
|
|
38
74
|
const { container } = render(
|
|
@@ -4,8 +4,12 @@ import { cn } from '../../utils/cn';
|
|
|
4
4
|
export type AuthLayoutProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
5
5
|
title: string;
|
|
6
6
|
description?: string;
|
|
7
|
-
/**
|
|
7
|
+
/** Alias for `description` (migration-friendly). */
|
|
8
|
+
subtitle?: string;
|
|
9
|
+
/** Brand/mark above the card. Alias: logo. */
|
|
8
10
|
brand?: React.ReactNode;
|
|
11
|
+
/** Alias for `brand` (migration-friendly). */
|
|
12
|
+
logo?: React.ReactNode;
|
|
9
13
|
/** Links or legal copy under the card. */
|
|
10
14
|
footer?: React.ReactNode;
|
|
11
15
|
/** Rendered inside the card under the heading. */
|
|
@@ -19,6 +23,8 @@ export type AuthLayoutProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
19
23
|
* the centered variant; omitting it makes the split variant fall back.
|
|
20
24
|
*/
|
|
21
25
|
aside?: React.ReactNode;
|
|
26
|
+
/** Overrides the card width: pixels (420) or any CSS width ("26rem"). */
|
|
27
|
+
maxWidth?: number | string;
|
|
22
28
|
};
|
|
23
29
|
|
|
24
30
|
const sizeClasses: Record<NonNullable<AuthLayoutProps['size']>, string> = {
|
|
@@ -38,18 +44,27 @@ export const AuthLayout = React.forwardRef<HTMLDivElement, AuthLayoutProps>(func
|
|
|
38
44
|
{
|
|
39
45
|
title,
|
|
40
46
|
description,
|
|
47
|
+
subtitle,
|
|
41
48
|
brand,
|
|
49
|
+
logo,
|
|
42
50
|
footer,
|
|
43
51
|
children,
|
|
44
52
|
size = 'md',
|
|
45
53
|
variant = 'centered',
|
|
46
54
|
aside,
|
|
55
|
+
maxWidth,
|
|
47
56
|
className,
|
|
48
57
|
...props
|
|
49
58
|
},
|
|
50
59
|
ref
|
|
51
60
|
) {
|
|
52
61
|
const split = variant === 'split' && aside != null;
|
|
62
|
+
const supporting = description ?? subtitle;
|
|
63
|
+
const mark = brand ?? logo;
|
|
64
|
+
const widthStyle =
|
|
65
|
+
maxWidth === undefined
|
|
66
|
+
? undefined
|
|
67
|
+
: { maxWidth: typeof maxWidth === 'number' ? `${maxWidth}px` : maxWidth };
|
|
53
68
|
|
|
54
69
|
const form = (
|
|
55
70
|
<div
|
|
@@ -57,16 +72,18 @@ export const AuthLayout = React.forwardRef<HTMLDivElement, AuthLayoutProps>(func
|
|
|
57
72
|
'flex w-full flex-col',
|
|
58
73
|
split ? sizeClasses[size] : 'items-center'
|
|
59
74
|
)}
|
|
75
|
+
style={widthStyle}
|
|
60
76
|
>
|
|
61
|
-
{
|
|
77
|
+
{mark && <div className="mb-6">{mark}</div>}
|
|
62
78
|
<div
|
|
63
79
|
className={cn(
|
|
64
80
|
'w-full rounded-xl border border-border bg-card p-6 shadow-sm sm:p-8',
|
|
65
81
|
!split && sizeClasses[size]
|
|
66
82
|
)}
|
|
83
|
+
style={widthStyle}
|
|
67
84
|
>
|
|
68
85
|
<h1 className="text-xl font-semibold tracking-tight">{title}</h1>
|
|
69
|
-
{
|
|
86
|
+
{supporting && <p className="mt-1 text-sm text-muted-foreground">{supporting}</p>}
|
|
70
87
|
<div className="mt-6">{children}</div>
|
|
71
88
|
</div>
|
|
72
89
|
{footer && <div className="mt-6 text-center text-sm text-muted-foreground">{footer}</div>}
|
|
@@ -99,4 +99,11 @@ describe('Badge semantic and alias variants', () => {
|
|
|
99
99
|
expect(screen.getByText('accent')).toHaveClass('bg-accent');
|
|
100
100
|
expect(container.querySelectorAll('span')).toHaveLength(7);
|
|
101
101
|
});
|
|
102
|
+
|
|
103
|
+
it('applies size presets', () => {
|
|
104
|
+
const { rerender } = render(<Badge size="sm">small</Badge>);
|
|
105
|
+
expect(screen.getByText('small')).toHaveClass('text-[11px]');
|
|
106
|
+
rerender(<Badge size="lg">large</Badge>);
|
|
107
|
+
expect(screen.getByText('large')).toHaveClass('text-sm', 'px-3');
|
|
108
|
+
});
|
|
102
109
|
});
|
|
@@ -23,9 +23,15 @@ const badgeVariants = cva(
|
|
|
23
23
|
destructive: 'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',
|
|
24
24
|
outline: 'text-foreground',
|
|
25
25
|
},
|
|
26
|
+
size: {
|
|
27
|
+
sm: 'px-2 py-0 text-[11px]',
|
|
28
|
+
md: 'px-2.5 py-0.5 text-xs',
|
|
29
|
+
lg: 'px-3 py-1 text-sm',
|
|
30
|
+
},
|
|
26
31
|
},
|
|
27
32
|
defaultVariants: {
|
|
28
33
|
variant: 'default',
|
|
34
|
+
size: 'md',
|
|
29
35
|
},
|
|
30
36
|
}
|
|
31
37
|
);
|
|
@@ -37,9 +43,9 @@ export type BadgeProps = React.HTMLAttributes<HTMLSpanElement> &
|
|
|
37
43
|
};
|
|
38
44
|
|
|
39
45
|
const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(
|
|
40
|
-
({ className, variant, asChild = false, ...props }, ref) => {
|
|
46
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
41
47
|
const Comp = asChild ? Slot : 'span';
|
|
42
|
-
return <Comp ref={ref} className={cn(badgeVariants({ variant }), className)} {...props} />;
|
|
48
|
+
return <Comp ref={ref} className={cn(badgeVariants({ variant, size }), className)} {...props} />;
|
|
43
49
|
}
|
|
44
50
|
);
|
|
45
51
|
Badge.displayName = 'Badge';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { axe } from 'jest-axe';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import { BottomNav, type BottomNavItem } from './BottomNav';
|
|
5
|
+
|
|
6
|
+
const ITEMS: BottomNavItem[] = [
|
|
7
|
+
{ href: '/', label: 'Home', active: true },
|
|
8
|
+
{ href: '/search', label: 'Search', badge: 3 },
|
|
9
|
+
{ href: '/alerts', label: 'Alerts', disabled: true },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
describe('BottomNav', () => {
|
|
13
|
+
it('renders a labelled nav landmark with one tab per item', () => {
|
|
14
|
+
render(<BottomNav items={ITEMS} />);
|
|
15
|
+
const nav = screen.getByRole('navigation', { name: 'Primary' });
|
|
16
|
+
expect(nav).toBeInTheDocument();
|
|
17
|
+
expect(screen.getAllByRole('link')).toHaveLength(2);
|
|
18
|
+
expect(screen.getByRole('link', { name: 'Home' })).toHaveAttribute('href', '/');
|
|
19
|
+
expect(screen.getByText('Search')).toBeInTheDocument();
|
|
20
|
+
expect(screen.getByText('3')).toBeInTheDocument();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('marks only the active tab with aria-current', () => {
|
|
24
|
+
render(<BottomNav items={ITEMS} />);
|
|
25
|
+
expect(screen.getByRole('link', { name: 'Home' })).toHaveAttribute('aria-current', 'page');
|
|
26
|
+
expect(screen.getByRole('link', { name: /Search/ })).not.toHaveAttribute('aria-current');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('renders a disabled tab without a link', () => {
|
|
30
|
+
render(<BottomNav items={ITEMS} />);
|
|
31
|
+
expect(screen.queryByRole('link', { name: 'Alerts' })).not.toBeInTheDocument();
|
|
32
|
+
expect(screen.getByText('Alerts').closest('[aria-disabled="true"]')).not.toBeNull();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('passes the destination through a router link component', () => {
|
|
36
|
+
function RouterLink({ to, ...rest }: { to: string } & React.AnchorHTMLAttributes<HTMLAnchorElement>) {
|
|
37
|
+
return <a href={to} data-router="" {...rest} />;
|
|
38
|
+
}
|
|
39
|
+
render(<BottomNav items={ITEMS} linkComponent={RouterLink} linkHrefProp="to" />);
|
|
40
|
+
expect(screen.getByRole('link', { name: 'Home' })).toHaveAttribute('href', '/');
|
|
41
|
+
expect(screen.getByRole('link', { name: 'Home' })).toHaveAttribute('data-router', '');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('has no accessibility violations', async () => {
|
|
45
|
+
const { container } = render(<BottomNav items={ITEMS} />);
|
|
46
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
|
|
4
|
+
export type BottomNavItem = {
|
|
5
|
+
/** Destination URL for the tab. */
|
|
6
|
+
href: string;
|
|
7
|
+
/** Visible tab label. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Icon shown above the label; always rendered aria-hidden. */
|
|
10
|
+
icon?: React.ReactNode;
|
|
11
|
+
/** Marks the current tab and sets aria-current="page". */
|
|
12
|
+
active?: boolean;
|
|
13
|
+
/** Small count or dot shown in the tab's top corner. */
|
|
14
|
+
badge?: React.ReactNode;
|
|
15
|
+
/** Renders the tab as non-interactive. */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type BottomNavProps = React.HTMLAttributes<HTMLElement> & {
|
|
20
|
+
/** Tabs in order. Keep to 3-5 so every target stays thumb-reachable. */
|
|
21
|
+
items: BottomNavItem[];
|
|
22
|
+
/** Router link component (Next Link, react-router Link). */
|
|
23
|
+
linkComponent?: React.ElementType;
|
|
24
|
+
/** Prop used to pass the destination to `linkComponent`. */
|
|
25
|
+
linkHrefProp?: 'href' | 'to';
|
|
26
|
+
/** Landmark label. Default "Primary". */
|
|
27
|
+
label?: string;
|
|
28
|
+
/** Pin the bar to the bottom edge with safe-area padding (default true). */
|
|
29
|
+
fixed?: boolean;
|
|
30
|
+
/** Hide the bar from the md breakpoint up (default true). */
|
|
31
|
+
mobileOnly?: boolean;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const tabClass =
|
|
35
|
+
'relative flex min-h-14 w-full flex-col items-center justify-center gap-0.5 px-2 py-2 text-[11px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Mobile bottom tab bar for the 3-5 primary destinations of an app shell.
|
|
39
|
+
* A nav landmark with aria-current="page" on the active tab, 44px minimum
|
|
40
|
+
* targets, an optional count badge and safe-area padding so the bar clears
|
|
41
|
+
* the iOS home indicator.
|
|
42
|
+
*/
|
|
43
|
+
export function BottomNav({
|
|
44
|
+
items,
|
|
45
|
+
linkComponent,
|
|
46
|
+
linkHrefProp = 'href',
|
|
47
|
+
label = 'Primary',
|
|
48
|
+
fixed = true,
|
|
49
|
+
mobileOnly = true,
|
|
50
|
+
className,
|
|
51
|
+
...props
|
|
52
|
+
}: BottomNavProps) {
|
|
53
|
+
const LinkEl = linkComponent ?? 'a';
|
|
54
|
+
const destination = (href: string) => (linkHrefProp === 'to' ? { to: href } : { href });
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<nav
|
|
58
|
+
aria-label={label}
|
|
59
|
+
className={cn(
|
|
60
|
+
'w-full border-t border-border bg-background pb-[env(safe-area-inset-bottom)]',
|
|
61
|
+
fixed && 'fixed inset-x-0 bottom-0 z-40',
|
|
62
|
+
mobileOnly && 'md:hidden',
|
|
63
|
+
className
|
|
64
|
+
)}
|
|
65
|
+
{...props}
|
|
66
|
+
>
|
|
67
|
+
<ul
|
|
68
|
+
className="mx-auto grid w-full max-w-lg"
|
|
69
|
+
style={{ gridTemplateColumns: `repeat(${Math.max(items.length, 1)}, minmax(0, 1fr))` }}
|
|
70
|
+
>
|
|
71
|
+
{items.map((item) => {
|
|
72
|
+
const content = (
|
|
73
|
+
<>
|
|
74
|
+
{item.icon && (
|
|
75
|
+
<span aria-hidden="true" className="[&_svg]:size-5">
|
|
76
|
+
{item.icon}
|
|
77
|
+
</span>
|
|
78
|
+
)}
|
|
79
|
+
<span>{item.label}</span>
|
|
80
|
+
{item.badge != null && (
|
|
81
|
+
<span className="absolute right-1/4 top-1 rounded-full bg-primary px-1.5 text-[10px] font-semibold leading-4 text-primary-foreground">
|
|
82
|
+
{item.badge}
|
|
83
|
+
</span>
|
|
84
|
+
)}
|
|
85
|
+
</>
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<li key={item.href}>
|
|
90
|
+
{item.disabled ? (
|
|
91
|
+
<span
|
|
92
|
+
aria-disabled="true"
|
|
93
|
+
className={cn(tabClass, 'text-muted-foreground opacity-50')}
|
|
94
|
+
>
|
|
95
|
+
{content}
|
|
96
|
+
</span>
|
|
97
|
+
) : (
|
|
98
|
+
<LinkEl
|
|
99
|
+
{...destination(item.href)}
|
|
100
|
+
aria-current={item.active ? 'page' : undefined}
|
|
101
|
+
className={cn(
|
|
102
|
+
tabClass,
|
|
103
|
+
item.active
|
|
104
|
+
? 'text-primary'
|
|
105
|
+
: 'text-muted-foreground hover:text-foreground'
|
|
106
|
+
)}
|
|
107
|
+
>
|
|
108
|
+
{content}
|
|
109
|
+
</LinkEl>
|
|
110
|
+
)}
|
|
111
|
+
</li>
|
|
112
|
+
);
|
|
113
|
+
})}
|
|
114
|
+
</ul>
|
|
115
|
+
</nav>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BottomNav';
|
|
@@ -52,7 +52,7 @@ export const DatePicker = React.forwardRef<HTMLInputElement, DatePickerProps>(fu
|
|
|
52
52
|
type="button"
|
|
53
53
|
onClick={() => commit('')}
|
|
54
54
|
aria-label={clearLabel}
|
|
55
|
-
className="absolute right-
|
|
55
|
+
className="absolute right-1.5 inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
56
56
|
>
|
|
57
57
|
✕
|
|
58
58
|
</button>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
2
|
+
import { axe } from 'jest-axe';
|
|
3
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
4
|
+
import { DealCard } from './DealCard';
|
|
5
|
+
|
|
6
|
+
const metrics = [
|
|
7
|
+
{ label: 'Revenue', value: '$20.4M' },
|
|
8
|
+
{ label: 'EBITDA', value: '$4.2M' },
|
|
9
|
+
{ label: 'Margin', value: '21%' },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
describe('DealCard', () => {
|
|
13
|
+
it('renders the deal, metrics and access badges', () => {
|
|
14
|
+
render(
|
|
15
|
+
<DealCard
|
|
16
|
+
title="Fleet services platform"
|
|
17
|
+
sector="Transportation"
|
|
18
|
+
location="South Atlantic"
|
|
19
|
+
description="Multi-regional platform opportunity."
|
|
20
|
+
metrics={metrics}
|
|
21
|
+
ndaAvailable
|
|
22
|
+
cimAvailable
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
expect(screen.getByRole('heading', { level: 3, name: 'Fleet services platform' })).toBeInTheDocument();
|
|
26
|
+
expect(screen.getByText('Transportation')).toBeInTheDocument();
|
|
27
|
+
expect(screen.getByText('$20.4M')).toBeInTheDocument();
|
|
28
|
+
expect(screen.getByText('NDA available')).toBeInTheDocument();
|
|
29
|
+
expect(screen.getByText('CIM available')).toBeInTheDocument();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('exposes save state and request access', () => {
|
|
33
|
+
const onSave = vi.fn();
|
|
34
|
+
const onRequestAccess = vi.fn();
|
|
35
|
+
render(
|
|
36
|
+
<DealCard
|
|
37
|
+
title="Deal"
|
|
38
|
+
sector="Technology"
|
|
39
|
+
metrics={metrics}
|
|
40
|
+
saved
|
|
41
|
+
onSave={onSave}
|
|
42
|
+
onRequestAccess={onRequestAccess}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
expect(screen.getByRole('button', { name: 'Saved' })).toHaveAttribute('aria-pressed', 'true');
|
|
46
|
+
fireEvent.click(screen.getByRole('button', { name: 'Request access' }));
|
|
47
|
+
expect(onRequestAccess).toHaveBeenCalled();
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('has no accessibility violations', async () => {
|
|
51
|
+
const { container } = render(<DealCard title="Deal" sector="Technology" metrics={metrics} />);
|
|
52
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import { Badge } from '../badge/Badge';
|
|
4
|
+
import { Button } from '../button/Button';
|
|
5
|
+
import { Card, CardContent, CardFooter, CardHeader } from '../card/Card';
|
|
6
|
+
|
|
7
|
+
export type DealMetric = {
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type DealStatus = 'available' | 'under-nda' | 'closed' | 'draft';
|
|
13
|
+
|
|
14
|
+
export type DealCardProps = Omit<React.HTMLAttributes<HTMLElement>, 'title'> & {
|
|
15
|
+
/** Deal headline. */
|
|
16
|
+
title: string;
|
|
17
|
+
/** Sector or industry label. */
|
|
18
|
+
sector: string;
|
|
19
|
+
/** Region or location. */
|
|
20
|
+
location?: string;
|
|
21
|
+
/** Optional short summary. */
|
|
22
|
+
description?: string;
|
|
23
|
+
/** Three headline metrics such as revenue, EBITDA and margin. */
|
|
24
|
+
metrics: DealMetric[];
|
|
25
|
+
/** Availability state. Default 'available'. */
|
|
26
|
+
status?: DealStatus;
|
|
27
|
+
/** Show the NDA badge. */
|
|
28
|
+
ndaAvailable?: boolean;
|
|
29
|
+
/** Show the CIM badge. */
|
|
30
|
+
cimAvailable?: boolean;
|
|
31
|
+
/** Optional deal detail link. */
|
|
32
|
+
href?: string;
|
|
33
|
+
/** Custom link element for routers. */
|
|
34
|
+
linkComponent?: React.ElementType;
|
|
35
|
+
/** Save toggle state. */
|
|
36
|
+
saved?: boolean;
|
|
37
|
+
onSave?: () => void;
|
|
38
|
+
/** Save button label. Default "Save". */
|
|
39
|
+
saveLabel?: string;
|
|
40
|
+
/** Request access handler. */
|
|
41
|
+
onRequestAccess?: () => void;
|
|
42
|
+
/** Request access label. Default "Request access". */
|
|
43
|
+
requestLabel?: string;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const statusConfig: Record<DealStatus, { label: string; variant: 'success' | 'info' | 'secondary' | 'outline' }> = {
|
|
47
|
+
available: { label: 'Available', variant: 'success' },
|
|
48
|
+
'under-nda': { label: 'Under NDA', variant: 'info' },
|
|
49
|
+
closed: { label: 'Closed', variant: 'secondary' },
|
|
50
|
+
draft: { label: 'Draft', variant: 'outline' },
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Deal opportunity card for trend, search and saved-deal surfaces. Metrics use
|
|
55
|
+
* tabular numerals; NDA and CIM access are stated as text badges, not implied.
|
|
56
|
+
*/
|
|
57
|
+
export const DealCard = React.forwardRef<HTMLElement, DealCardProps>(function DealCard(
|
|
58
|
+
{
|
|
59
|
+
title,
|
|
60
|
+
sector,
|
|
61
|
+
location,
|
|
62
|
+
description,
|
|
63
|
+
metrics,
|
|
64
|
+
status = 'available',
|
|
65
|
+
ndaAvailable,
|
|
66
|
+
cimAvailable,
|
|
67
|
+
href,
|
|
68
|
+
linkComponent,
|
|
69
|
+
saved = false,
|
|
70
|
+
onSave,
|
|
71
|
+
saveLabel = 'Save',
|
|
72
|
+
onRequestAccess,
|
|
73
|
+
requestLabel = 'Request access',
|
|
74
|
+
className,
|
|
75
|
+
...props
|
|
76
|
+
},
|
|
77
|
+
ref
|
|
78
|
+
) {
|
|
79
|
+
const Link = linkComponent ?? 'a';
|
|
80
|
+
const statusInfo = statusConfig[status];
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<Card ref={ref as never} className={cn('flex h-full flex-col overflow-hidden', className)} {...props}>
|
|
84
|
+
<CardHeader className="gap-2 p-5 pb-3">
|
|
85
|
+
<div className="flex items-start justify-between gap-2">
|
|
86
|
+
<p className="text-xs font-semibold uppercase tracking-widest text-primary">{sector}</p>
|
|
87
|
+
<Badge variant={statusInfo.variant}>{statusInfo.label}</Badge>
|
|
88
|
+
</div>
|
|
89
|
+
<h3 className="text-lg font-semibold leading-snug tracking-tight">
|
|
90
|
+
{href ? (
|
|
91
|
+
<Link href={href} className="rounded-sm hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
|
|
92
|
+
{title}
|
|
93
|
+
</Link>
|
|
94
|
+
) : (
|
|
95
|
+
title
|
|
96
|
+
)}
|
|
97
|
+
</h3>
|
|
98
|
+
{location && <p className="text-xs text-muted-foreground">{location}</p>}
|
|
99
|
+
</CardHeader>
|
|
100
|
+
<CardContent className="flex-1 px-5 pb-3">
|
|
101
|
+
{description && <p className="line-clamp-2 text-sm leading-relaxed text-muted-foreground">{description}</p>}
|
|
102
|
+
<dl className="mt-4 grid grid-cols-3 gap-3">
|
|
103
|
+
{metrics.map((metric) => (
|
|
104
|
+
<div key={metric.label} className="min-w-0">
|
|
105
|
+
<dt className="text-xs text-muted-foreground">{metric.label}</dt>
|
|
106
|
+
<dd className="mt-0.5 truncate text-sm font-semibold tabular-nums">{metric.value}</dd>
|
|
107
|
+
</div>
|
|
108
|
+
))}
|
|
109
|
+
</dl>
|
|
110
|
+
{(ndaAvailable || cimAvailable) && (
|
|
111
|
+
<div className="mt-4 flex flex-wrap gap-1.5">
|
|
112
|
+
{ndaAvailable && <Badge variant="info">NDA available</Badge>}
|
|
113
|
+
{cimAvailable && <Badge variant="secondary">CIM available</Badge>}
|
|
114
|
+
</div>
|
|
115
|
+
)}
|
|
116
|
+
</CardContent>
|
|
117
|
+
<CardFooter className="flex flex-wrap items-center gap-2 border-t border-border px-5 py-3">
|
|
118
|
+
{onRequestAccess && (
|
|
119
|
+
<Button type="button" size="sm" onClick={onRequestAccess}>
|
|
120
|
+
{requestLabel}
|
|
121
|
+
</Button>
|
|
122
|
+
)}
|
|
123
|
+
{onSave && (
|
|
124
|
+
<Button
|
|
125
|
+
type="button"
|
|
126
|
+
size="sm"
|
|
127
|
+
variant="ghost"
|
|
128
|
+
aria-pressed={saved}
|
|
129
|
+
onClick={onSave}
|
|
130
|
+
className="ml-auto"
|
|
131
|
+
>
|
|
132
|
+
{saved ? 'Saved' : saveLabel}
|
|
133
|
+
</Button>
|
|
134
|
+
)}
|
|
135
|
+
</CardFooter>
|
|
136
|
+
</Card>
|
|
137
|
+
);
|
|
138
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
2
|
+
import { axe } from 'jest-axe';
|
|
3
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
4
|
+
import { DocumentCard } from './DocumentCard';
|
|
5
|
+
|
|
6
|
+
describe('DocumentCard', () => {
|
|
7
|
+
it('renders file metadata and a download action', () => {
|
|
8
|
+
const onDownload = vi.fn();
|
|
9
|
+
render(
|
|
10
|
+
<DocumentCard
|
|
11
|
+
name="Q3-financials.pdf"
|
|
12
|
+
fileType="PDF"
|
|
13
|
+
size="2.4 MB"
|
|
14
|
+
updatedAt="Nov 1, 2026"
|
|
15
|
+
onDownload={onDownload}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
expect(screen.getByText('Q3-financials.pdf')).toBeInTheDocument();
|
|
19
|
+
expect(screen.getByText('PDF · 2.4 MB · Nov 1, 2026')).toBeInTheDocument();
|
|
20
|
+
fireEvent.click(screen.getByRole('button', { name: 'Download Q3-financials.pdf' }));
|
|
21
|
+
expect(onDownload).toHaveBeenCalled();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('disables download when the document is restricted', () => {
|
|
25
|
+
render(
|
|
26
|
+
<DocumentCard
|
|
27
|
+
name="CIM.pdf"
|
|
28
|
+
fileType="PDF"
|
|
29
|
+
status="restricted"
|
|
30
|
+
onDownload={() => {}}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
expect(screen.getByRole('button', { name: 'Download CIM.pdf' })).toBeDisabled();
|
|
34
|
+
expect(screen.getByText('Restricted')).toBeInTheDocument();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('has no accessibility violations', async () => {
|
|
38
|
+
const { container } = render(<DocumentCard name="File" fileType="PDF" />);
|
|
39
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
40
|
+
});
|
|
41
|
+
});
|