@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
|
@@ -27,6 +27,20 @@ describe('Hero', () => {
|
|
|
27
27
|
expect(screen.getByRole('heading', { level: 2, name: 'Section hero' })).toBeInTheDocument();
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
+
it('supports stacked and overlay layouts', () => {
|
|
31
|
+
const { rerender, container } = render(
|
|
32
|
+
<Hero title="Stacked" media={<img src="/shot.png" alt="Product shot" />} variant="stacked" />
|
|
33
|
+
);
|
|
34
|
+
expect(container.firstChild).toHaveClass('flex-col');
|
|
35
|
+
expect(screen.getByAltText('Product shot')).toBeInTheDocument();
|
|
36
|
+
|
|
37
|
+
rerender(
|
|
38
|
+
<Hero title="Overlay" media={<img src="/shot.png" alt="Product shot" />} variant="overlay" />
|
|
39
|
+
);
|
|
40
|
+
expect(container.firstChild).toHaveClass('relative', 'isolate');
|
|
41
|
+
expect(screen.getByRole('heading', { level: 1, name: 'Overlay' })).toHaveClass('text-background');
|
|
42
|
+
});
|
|
43
|
+
|
|
30
44
|
it('has no accessibility violations', async () => {
|
|
31
45
|
const { container } = render(<Hero title="Headline" description="Supporting copy" />);
|
|
32
46
|
expect(await axe(container)).toHaveNoViolations();
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { cn } from '../../utils/cn';
|
|
3
3
|
|
|
4
|
+
export type HeroVariant = 'split' | 'centered' | 'stacked' | 'overlay';
|
|
5
|
+
|
|
4
6
|
export type HeroProps = Omit<React.HTMLAttributes<HTMLElement>, 'title'> & {
|
|
5
7
|
/** Main headline. Accepts inline markup for a highlighted phrase. */
|
|
6
8
|
title: React.ReactNode;
|
|
@@ -12,9 +14,9 @@ export type HeroProps = Omit<React.HTMLAttributes<HTMLElement>, 'title'> & {
|
|
|
12
14
|
badge?: React.ReactNode;
|
|
13
15
|
/** Primary and secondary calls to action. */
|
|
14
16
|
actions?: React.ReactNode;
|
|
15
|
-
/** Product shot, illustration, video or form shown beside the copy. */
|
|
17
|
+
/** Product shot, illustration, video or form shown beside or behind the copy. */
|
|
16
18
|
media?: React.ReactNode;
|
|
17
|
-
/** Which side the media sits on at lg and up. Default 'right'. */
|
|
19
|
+
/** Which side the media sits on at lg and up in the split layout. Default 'right'. */
|
|
18
20
|
mediaPosition?: 'left' | 'right';
|
|
19
21
|
/** Copy alignment. Centered is typically used without media. */
|
|
20
22
|
align?: 'left' | 'center';
|
|
@@ -23,10 +25,13 @@ export type HeroProps = Omit<React.HTMLAttributes<HTMLElement>, 'title'> & {
|
|
|
23
25
|
/** Heading level. Default 1; use 2 when the hero is nested under a page h1. */
|
|
24
26
|
level?: 1 | 2;
|
|
25
27
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
+
* Layout:
|
|
29
|
+
* - `split` places copy and media side by side at lg and up (default with media).
|
|
30
|
+
* - `centered` stacks copy in a narrow centered column (default without media).
|
|
31
|
+
* - `stacked` puts copy above full-width media, left aligned unless `align` says otherwise.
|
|
32
|
+
* - `overlay` places media behind the copy with a scrim; copy stays readable in both themes.
|
|
28
33
|
*/
|
|
29
|
-
variant?:
|
|
34
|
+
variant?: HeroVariant;
|
|
30
35
|
/** Semantic element (default 'div'). */
|
|
31
36
|
as?: 'div' | 'section' | 'header';
|
|
32
37
|
/** Extra classes for the headline, for host display typography. */
|
|
@@ -37,18 +42,21 @@ export type HeroProps = Omit<React.HTMLAttributes<HTMLElement>, 'title'> & {
|
|
|
37
42
|
eyebrowClassName?: string;
|
|
38
43
|
/** Extra classes for the badge wrapper. */
|
|
39
44
|
badgeClassName?: string;
|
|
45
|
+
/** Extra classes for the media wrapper. */
|
|
46
|
+
mediaClassName?: string;
|
|
40
47
|
};
|
|
41
48
|
|
|
42
49
|
const titleSizes = {
|
|
43
|
-
md: 'text-
|
|
44
|
-
lg: 'text-4xl sm:text-5xl
|
|
50
|
+
md: 'text-3xl sm:text-4xl md:text-5xl',
|
|
51
|
+
lg: 'text-4xl sm:text-5xl md:text-6xl lg:leading-[1.05]',
|
|
45
52
|
} as const;
|
|
46
53
|
|
|
47
54
|
/**
|
|
48
55
|
* Marketing hero: optional badge/eyebrow, a large headline, supporting copy,
|
|
49
|
-
* calls to action and an optional media slot.
|
|
50
|
-
*
|
|
51
|
-
*
|
|
56
|
+
* calls to action and an optional media slot. Four responsive layouts cover
|
|
57
|
+
* the common landing-page shapes: split, centered, stacked and overlay. Use it
|
|
58
|
+
* inside Section so the band owns its tone and vertical padding. For a
|
|
59
|
+
* documentation page title without media, use PageHeader instead.
|
|
52
60
|
*/
|
|
53
61
|
export const Hero = React.forwardRef<HTMLElement, HeroProps>(function Hero(
|
|
54
62
|
{
|
|
@@ -68,6 +76,7 @@ export const Hero = React.forwardRef<HTMLElement, HeroProps>(function Hero(
|
|
|
68
76
|
descriptionClassName,
|
|
69
77
|
eyebrowClassName,
|
|
70
78
|
badgeClassName,
|
|
79
|
+
mediaClassName,
|
|
71
80
|
className,
|
|
72
81
|
...props
|
|
73
82
|
},
|
|
@@ -77,38 +86,119 @@ export const Hero = React.forwardRef<HTMLElement, HeroProps>(function Hero(
|
|
|
77
86
|
const layout = variant ?? (media ? 'split' : 'centered');
|
|
78
87
|
const Heading = `h${level}` as 'h1' | 'h2';
|
|
79
88
|
const centered = layout === 'centered' || align === 'center';
|
|
89
|
+
const overlay = layout === 'overlay';
|
|
80
90
|
|
|
81
91
|
const copy = (
|
|
82
|
-
<div
|
|
92
|
+
<div
|
|
93
|
+
className={cn(
|
|
94
|
+
'min-w-0',
|
|
95
|
+
centered && 'mx-auto flex max-w-3xl flex-col items-center text-center',
|
|
96
|
+
overlay && 'max-w-2xl'
|
|
97
|
+
)}
|
|
98
|
+
>
|
|
83
99
|
{badge && (
|
|
84
|
-
<div
|
|
100
|
+
<div
|
|
101
|
+
className={cn(
|
|
102
|
+
'mb-5 inline-flex rounded-full border px-3 py-1 text-xs font-medium',
|
|
103
|
+
overlay
|
|
104
|
+
? 'border-background/30 bg-background/10 text-background'
|
|
105
|
+
: 'border-primary/30 bg-primary/10 text-primary',
|
|
106
|
+
badgeClassName
|
|
107
|
+
)}
|
|
108
|
+
>
|
|
85
109
|
{badge}
|
|
86
110
|
</div>
|
|
87
111
|
)}
|
|
88
112
|
{eyebrow && (
|
|
89
|
-
<p
|
|
113
|
+
<p
|
|
114
|
+
className={cn(
|
|
115
|
+
'mb-3 text-xs font-semibold uppercase tracking-widest',
|
|
116
|
+
overlay ? 'text-background/90' : 'text-primary',
|
|
117
|
+
eyebrowClassName
|
|
118
|
+
)}
|
|
119
|
+
>
|
|
120
|
+
{eyebrow}
|
|
121
|
+
</p>
|
|
90
122
|
)}
|
|
91
|
-
<Heading
|
|
123
|
+
<Heading
|
|
124
|
+
className={cn(
|
|
125
|
+
'font-semibold tracking-tight text-balance',
|
|
126
|
+
titleSizes[size],
|
|
127
|
+
overlay && 'text-background',
|
|
128
|
+
titleClassName
|
|
129
|
+
)}
|
|
130
|
+
>
|
|
92
131
|
{title}
|
|
93
132
|
</Heading>
|
|
94
133
|
{description && (
|
|
95
|
-
<p
|
|
134
|
+
<p
|
|
135
|
+
className={cn(
|
|
136
|
+
'mt-5 text-base leading-relaxed sm:text-lg',
|
|
137
|
+
overlay ? 'text-background/80' : 'text-muted-foreground',
|
|
138
|
+
centered ? 'max-w-2xl' : 'max-w-xl',
|
|
139
|
+
descriptionClassName
|
|
140
|
+
)}
|
|
141
|
+
>
|
|
96
142
|
{description}
|
|
97
143
|
</p>
|
|
98
144
|
)}
|
|
99
145
|
{actions && (
|
|
100
|
-
<div
|
|
146
|
+
<div
|
|
147
|
+
className={cn(
|
|
148
|
+
'mt-8 flex flex-wrap items-center gap-3',
|
|
149
|
+
centered && 'justify-center'
|
|
150
|
+
)}
|
|
151
|
+
>
|
|
101
152
|
{actions}
|
|
102
153
|
</div>
|
|
103
154
|
)}
|
|
104
155
|
</div>
|
|
105
156
|
);
|
|
106
157
|
|
|
158
|
+
if (overlay) {
|
|
159
|
+
return (
|
|
160
|
+
<Tag
|
|
161
|
+
ref={ref as never}
|
|
162
|
+
className={cn(
|
|
163
|
+
'relative isolate flex min-h-[22rem] w-full items-center overflow-hidden rounded-lg py-12 sm:min-h-[26rem] sm:py-16 lg:min-h-[32rem] lg:py-20',
|
|
164
|
+
className
|
|
165
|
+
)}
|
|
166
|
+
{...props}
|
|
167
|
+
>
|
|
168
|
+
{media && (
|
|
169
|
+
<div
|
|
170
|
+
className={cn(
|
|
171
|
+
'absolute inset-0 -z-20 [&>*]:h-full [&>*]:w-full [&>*]:object-cover',
|
|
172
|
+
mediaClassName
|
|
173
|
+
)}
|
|
174
|
+
>
|
|
175
|
+
{media}
|
|
176
|
+
</div>
|
|
177
|
+
)}
|
|
178
|
+
<div aria-hidden="true" className="absolute inset-0 -z-10 bg-foreground/60" />
|
|
179
|
+
<div className="relative w-full px-4 sm:px-6 lg:px-10">{copy}</div>
|
|
180
|
+
</Tag>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
107
184
|
if (layout === 'centered') {
|
|
108
185
|
return (
|
|
109
186
|
<Tag ref={ref as never} className={cn('w-full', className)} {...props}>
|
|
110
187
|
{copy}
|
|
111
|
-
{media && <div className=
|
|
188
|
+
{media && <div className={cn('mt-12 min-w-0', mediaClassName)}>{media}</div>}
|
|
189
|
+
</Tag>
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (layout === 'stacked') {
|
|
194
|
+
return (
|
|
195
|
+
<Tag
|
|
196
|
+
ref={ref as never}
|
|
197
|
+
className={cn('flex w-full flex-col gap-10 lg:gap-14', className)}
|
|
198
|
+
{...props}
|
|
199
|
+
>
|
|
200
|
+
{copy}
|
|
201
|
+
{media && <div className={cn('min-w-0 w-full', mediaClassName)}>{media}</div>}
|
|
112
202
|
</Tag>
|
|
113
203
|
);
|
|
114
204
|
}
|
|
@@ -116,12 +206,14 @@ export const Hero = React.forwardRef<HTMLElement, HeroProps>(function Hero(
|
|
|
116
206
|
return (
|
|
117
207
|
<Tag
|
|
118
208
|
ref={ref as never}
|
|
119
|
-
className={cn('grid w-full items-center gap-10 lg:grid-cols-2 lg:gap-16', className)}
|
|
209
|
+
className={cn('grid w-full items-center gap-10 lg:grid-cols-2 lg:gap-16 xl:gap-20', className)}
|
|
120
210
|
{...props}
|
|
121
211
|
>
|
|
122
212
|
<div className={cn(mediaPosition === 'left' && 'lg:order-2')}>{copy}</div>
|
|
123
213
|
{media && (
|
|
124
|
-
<div className={cn('min-w-0', mediaPosition === 'left' && 'lg:order-1')}>
|
|
214
|
+
<div className={cn('min-w-0', mediaPosition === 'left' && 'lg:order-1', mediaClassName)}>
|
|
215
|
+
{media}
|
|
216
|
+
</div>
|
|
125
217
|
)}
|
|
126
218
|
</Tag>
|
|
127
219
|
);
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { LoadMore } from './LoadMore';
|
|
5
|
+
|
|
6
|
+
describe('LoadMore', () => {
|
|
7
|
+
it('requests the next page', () => {
|
|
8
|
+
const onLoadMore = vi.fn();
|
|
9
|
+
render(<LoadMore hasMore onLoadMore={onLoadMore} />);
|
|
10
|
+
fireEvent.click(screen.getByRole('button', { name: 'Load more' }));
|
|
11
|
+
expect(onLoadMore).toHaveBeenCalled();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('shows a loading state', () => {
|
|
15
|
+
render(<LoadMore hasMore loading onLoadMore={() => {}} />);
|
|
16
|
+
expect(screen.getByRole('button', { name: /Loading/ })).toBeDisabled();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('announces the end of the list', () => {
|
|
20
|
+
render(<LoadMore hasMore={false} onLoadMore={() => {}} />);
|
|
21
|
+
expect(screen.getByRole('status')).toHaveTextContent("You're all caught up.");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('has no accessibility violations', async () => {
|
|
25
|
+
const { container } = render(<LoadMore hasMore onLoadMore={() => {}} />);
|
|
26
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
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 LoadMoreProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
8
|
+
/** Whether another page is available. */
|
|
9
|
+
hasMore: boolean;
|
|
10
|
+
/** Request the next page. */
|
|
11
|
+
onLoadMore: () => void;
|
|
12
|
+
/** Loading state. */
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
/** Button label. Default "Load more". */
|
|
15
|
+
loadLabel?: string;
|
|
16
|
+
/** Loading label. Default "Loading...". */
|
|
17
|
+
loadingLabel?: string;
|
|
18
|
+
/** End-of-list message. Default "You're all caught up." */
|
|
19
|
+
endLabel?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Load-more control for paginated lists without page numbers. While loading it
|
|
24
|
+
* disables the button and sets aria-busy; at the end it replaces the button
|
|
25
|
+
* with a polite status message.
|
|
26
|
+
*/
|
|
27
|
+
export const LoadMore = React.forwardRef<HTMLDivElement, LoadMoreProps>(function LoadMore(
|
|
28
|
+
{
|
|
29
|
+
hasMore,
|
|
30
|
+
onLoadMore,
|
|
31
|
+
loading = false,
|
|
32
|
+
loadLabel = 'Load more',
|
|
33
|
+
loadingLabel = 'Loading...',
|
|
34
|
+
endLabel = "You're all caught up.",
|
|
35
|
+
className,
|
|
36
|
+
...props
|
|
37
|
+
},
|
|
38
|
+
ref
|
|
39
|
+
) {
|
|
40
|
+
return (
|
|
41
|
+
<div ref={ref} aria-live="polite" className={cn('flex w-full justify-center py-4', className)} {...props}>
|
|
42
|
+
{hasMore ? (
|
|
43
|
+
<Button type="button" variant="outline" onClick={onLoadMore} loading={loading}>
|
|
44
|
+
{loading ? loadingLabel : loadLabel}
|
|
45
|
+
</Button>
|
|
46
|
+
) : (
|
|
47
|
+
<p role="status" className="text-sm text-muted-foreground">
|
|
48
|
+
{endLabel}
|
|
49
|
+
</p>
|
|
50
|
+
)}
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
});
|
|
@@ -26,3 +26,35 @@ describe('MetricCard', () => {
|
|
|
26
26
|
expect(await axe(container)).toHaveNoViolations();
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
|
+
|
|
30
|
+
describe('MetricCard migration aliases', () => {
|
|
31
|
+
it('reads title and description when label and hint are absent', () => {
|
|
32
|
+
render(<MetricCard title="Revenue" value="$1" description="vs last month" />);
|
|
33
|
+
expect(screen.getByText('Revenue')).toBeInTheDocument();
|
|
34
|
+
expect(screen.getByText('vs last month')).toBeInTheDocument();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('prefers label and hint when both forms are passed', () => {
|
|
38
|
+
render(<MetricCard label="Canonical" title="Alias" value="1" hint="Hint line" description="Alt line" />);
|
|
39
|
+
expect(screen.getByText('Canonical')).toBeInTheDocument();
|
|
40
|
+
expect(screen.queryByText('Alias')).not.toBeInTheDocument();
|
|
41
|
+
expect(screen.getByText('Hint line')).toBeInTheDocument();
|
|
42
|
+
expect(screen.queryByText('Alt line')).not.toBeInTheDocument();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe('MetricCard tone and loading', () => {
|
|
47
|
+
it('colors the value by tone', () => {
|
|
48
|
+
const { rerender } = render(<MetricCard label="Revenue" value="$1" tone="success" />);
|
|
49
|
+
expect(screen.getByText('$1')).toHaveClass('text-success');
|
|
50
|
+
rerender(<MetricCard label="Revenue" value="$1" tone="destructive" />);
|
|
51
|
+
expect(screen.getByText('$1')).toHaveClass('text-destructive');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('renders a skeleton with aria-busy while loading', () => {
|
|
55
|
+
const { container } = render(<MetricCard label="Revenue" value="$1" loading />);
|
|
56
|
+
expect(container.firstChild).toHaveAttribute('aria-busy', 'true');
|
|
57
|
+
expect(screen.queryByText('$1')).not.toBeInTheDocument();
|
|
58
|
+
expect(screen.getByText('Loading')).toBeInTheDocument();
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -2,16 +2,26 @@ import * as React from 'react';
|
|
|
2
2
|
import { cn } from '../../utils/cn';
|
|
3
3
|
|
|
4
4
|
export type MetricTrend = 'up' | 'down' | 'flat';
|
|
5
|
+
export type MetricTone = 'default' | 'success' | 'warning' | 'destructive';
|
|
5
6
|
|
|
6
7
|
export type MetricCardProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> & {
|
|
7
|
-
|
|
8
|
+
/** Metric name. Alias: title. */
|
|
9
|
+
label?: string;
|
|
8
10
|
value: string | number;
|
|
9
|
-
/** Secondary line under the value. */
|
|
11
|
+
/** Secondary line under the value. Alias: description. */
|
|
10
12
|
hint?: React.ReactNode;
|
|
13
|
+
/** Alias for `label` (migration-friendly). */
|
|
14
|
+
title?: string;
|
|
15
|
+
/** Alias for `hint` (migration-friendly). */
|
|
16
|
+
description?: React.ReactNode;
|
|
11
17
|
/** Signed change, e.g. "+12.4%" or "-3". */
|
|
12
18
|
delta?: string;
|
|
13
19
|
/** Direction colors the delta (green up / red down / muted flat). */
|
|
14
20
|
trend?: MetricTrend;
|
|
21
|
+
/** Semantic color for the value (not the delta). */
|
|
22
|
+
tone?: MetricTone;
|
|
23
|
+
/** Renders a skeleton instead of the value; sets aria-busy while true. */
|
|
24
|
+
loading?: boolean;
|
|
15
25
|
icon?: React.ReactNode;
|
|
16
26
|
};
|
|
17
27
|
|
|
@@ -21,6 +31,13 @@ const trendClasses: Record<MetricTrend, string> = {
|
|
|
21
31
|
flat: 'text-muted-foreground',
|
|
22
32
|
};
|
|
23
33
|
|
|
34
|
+
const toneClasses: Record<MetricTone, string> = {
|
|
35
|
+
default: '',
|
|
36
|
+
success: 'text-success',
|
|
37
|
+
warning: 'text-warning-ink',
|
|
38
|
+
destructive: 'text-destructive',
|
|
39
|
+
};
|
|
40
|
+
|
|
24
41
|
const trendGlyph: Record<MetricTrend, string> = { up: '↑', down: '↓', flat: '→' };
|
|
25
42
|
|
|
26
43
|
/**
|
|
@@ -29,24 +46,45 @@ const trendGlyph: Record<MetricTrend, string> = { up: '↑', down: '↓', flat:
|
|
|
29
46
|
* never communicated by color alone.
|
|
30
47
|
*/
|
|
31
48
|
export const MetricCard = React.forwardRef<HTMLDivElement, MetricCardProps>(function MetricCard(
|
|
32
|
-
{ label, value, hint, delta, trend = 'flat', icon, className, ...props },
|
|
49
|
+
{ label, value, hint, title, description, delta, trend = 'flat', tone = 'default', loading = false, icon, className, ...props },
|
|
33
50
|
ref
|
|
34
51
|
) {
|
|
52
|
+
const heading = label ?? title;
|
|
53
|
+
const supporting = hint ?? description;
|
|
54
|
+
|
|
55
|
+
if (loading) {
|
|
56
|
+
return (
|
|
57
|
+
<div
|
|
58
|
+
ref={ref}
|
|
59
|
+
aria-busy="true"
|
|
60
|
+
className={cn('rounded-xl border border-border bg-card p-5', className)}
|
|
61
|
+
{...props}
|
|
62
|
+
>
|
|
63
|
+
<div className="flex items-start justify-between gap-3">
|
|
64
|
+
{heading && <p className="text-sm text-muted-foreground">{heading}</p>}
|
|
65
|
+
{icon && <span className="text-muted-foreground [&_svg]:size-4">{icon}</span>}
|
|
66
|
+
</div>
|
|
67
|
+
<span aria-hidden="true" className="mt-3 block h-7 w-24 animate-pulse rounded-md bg-muted" />
|
|
68
|
+
<span className="sr-only">Loading</span>
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
35
73
|
return (
|
|
36
74
|
<div ref={ref} className={cn('rounded-xl border border-border bg-card p-5', className)} {...props}>
|
|
37
75
|
<div className="flex items-start justify-between gap-3">
|
|
38
|
-
<p className="text-sm text-muted-foreground">{
|
|
76
|
+
{heading && <p className="text-sm text-muted-foreground">{heading}</p>}
|
|
39
77
|
{icon && <span className="text-muted-foreground [&_svg]:size-4">{icon}</span>}
|
|
40
78
|
</div>
|
|
41
|
-
<p className=
|
|
42
|
-
{(delta ||
|
|
79
|
+
<p className={cn('mt-2 text-2xl font-semibold tabular-nums', toneClasses[tone])}>{value}</p>
|
|
80
|
+
{(delta || supporting) && (
|
|
43
81
|
<p className="mt-1 flex items-center gap-2 text-sm">
|
|
44
82
|
{delta && (
|
|
45
83
|
<span className={cn('font-medium tabular-nums', trendClasses[trend])}>
|
|
46
84
|
<span aria-hidden="true">{trendGlyph[trend]}</span> {delta}
|
|
47
85
|
</span>
|
|
48
86
|
)}
|
|
49
|
-
{
|
|
87
|
+
{supporting && <span className="text-muted-foreground">{supporting}</span>}
|
|
50
88
|
</p>
|
|
51
89
|
)}
|
|
52
90
|
</div>
|
|
@@ -46,3 +46,16 @@ describe('PageHeader hero options', () => {
|
|
|
46
46
|
expect(screen.getByRole('heading', { level: 1 })).toHaveClass('text-4xl');
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
|
+
|
|
50
|
+
describe('PageHeader migration aliases', () => {
|
|
51
|
+
it('renders subtitle when description is absent', () => {
|
|
52
|
+
render(<PageHeader title="Billing" subtitle="Manage invoices." />);
|
|
53
|
+
expect(screen.getByText('Manage invoices.')).toBeInTheDocument();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('prefers description when both description and subtitle are passed', () => {
|
|
57
|
+
render(<PageHeader title="Billing" description="Canonical" subtitle="Alias" />);
|
|
58
|
+
expect(screen.getByText('Canonical')).toBeInTheDocument();
|
|
59
|
+
expect(screen.queryByText('Alias')).not.toBeInTheDocument();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -4,6 +4,8 @@ import { cn } from '../../utils/cn';
|
|
|
4
4
|
export type PageHeaderProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
5
5
|
title: string;
|
|
6
6
|
description?: string;
|
|
7
|
+
/** Alias for `description` (migration-friendly). */
|
|
8
|
+
subtitle?: string;
|
|
7
9
|
/** Breadcrumbs/eyebrow above the title. */
|
|
8
10
|
breadcrumbs?: React.ReactNode;
|
|
9
11
|
/** Right-aligned actions (buttons, menus). */
|
|
@@ -37,9 +39,10 @@ const sizeClasses: Record<NonNullable<PageHeaderProps['size']>, string> = {
|
|
|
37
39
|
* and heading hierarchy.
|
|
38
40
|
*/
|
|
39
41
|
export const PageHeader = React.forwardRef<HTMLDivElement, PageHeaderProps>(function PageHeader(
|
|
40
|
-
{ title, description, breadcrumbs, actions, eyebrow, size = 'md', align = 'left', titleClassName, descriptionClassName, eyebrowClassName, className, children, ...props },
|
|
42
|
+
{ title, description, subtitle, breadcrumbs, actions, eyebrow, size = 'md', align = 'left', titleClassName, descriptionClassName, eyebrowClassName, className, children, ...props },
|
|
41
43
|
ref
|
|
42
44
|
) {
|
|
45
|
+
const supporting = description ?? subtitle;
|
|
43
46
|
return (
|
|
44
47
|
<div ref={ref} className={cn('flex flex-col gap-2', align === 'center' && 'items-center text-center', className)} {...props}>
|
|
45
48
|
{breadcrumbs && <div className="text-sm text-muted-foreground">{breadcrumbs}</div>}
|
|
@@ -49,7 +52,7 @@ export const PageHeader = React.forwardRef<HTMLDivElement, PageHeaderProps>(func
|
|
|
49
52
|
<div className={cn('flex w-full flex-wrap items-start justify-between gap-3', align === 'center' && 'justify-center')}>
|
|
50
53
|
<div className={cn('min-w-0', align === 'center' && 'flex flex-col items-center')}>
|
|
51
54
|
<h1 className={cn('font-semibold tracking-tight', sizeClasses[size], titleClassName)}>{title}</h1>
|
|
52
|
-
{
|
|
55
|
+
{supporting && <p className={cn('mt-2 max-w-2xl text-base text-muted-foreground', descriptionClassName)}>{supporting}</p>}
|
|
53
56
|
</div>
|
|
54
57
|
{actions && <div className="flex shrink-0 items-center gap-2">{actions}</div>}
|
|
55
58
|
</div>
|
|
@@ -33,6 +33,14 @@ describe('RangeSlider', () => {
|
|
|
33
33
|
expect(onValueChange).toHaveBeenLastCalledWith([80, 80]);
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
+
it('centres the WebKit thumb on the track', () => {
|
|
37
|
+
const { container } = render(<RangeSlider defaultValue={[25, 75]} />);
|
|
38
|
+
const inputs = container.querySelectorAll<HTMLInputElement>('input[type="range"]');
|
|
39
|
+
// Track is 4px tall, thumb 16px: -6px keeps the thumb centred instead of
|
|
40
|
+
// flush with the track's top edge.
|
|
41
|
+
expect(inputs[0]?.className).toContain('[&::-webkit-slider-thumb]:mt-[-6px]');
|
|
42
|
+
});
|
|
43
|
+
|
|
36
44
|
it('has no accessibility violations', async () => {
|
|
37
45
|
const { container } = render(<RangeSlider defaultValue={[25, 75]} />);
|
|
38
46
|
expect(await axe(container)).toHaveNoViolations();
|
|
@@ -27,12 +27,16 @@ export type RangeSliderProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onCha
|
|
|
27
27
|
disabled?: boolean;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
// The track is 4px (h-1) and the thumb is 16px (h-4). WebKit positions the
|
|
31
|
+
// thumb from the top of the track, so it needs a -6px margin to share the
|
|
32
|
+
// track's centre line instead of sitting flush against its top edge. Firefox
|
|
33
|
+
// centres the thumb on the track by itself.
|
|
30
34
|
const rangeInputClass = cn(
|
|
31
|
-
'pointer-events-none absolute inset-x-0 top-1/2 h-
|
|
32
|
-
'[&::-webkit-slider-runnable-track]:h-1 [&::-webkit-slider-runnable-track]:bg-transparent',
|
|
33
|
-
'[&::-webkit-slider-thumb]:pointer-events-auto [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-primary [&::-webkit-slider-thumb]:bg-background [&::-webkit-slider-thumb]:shadow',
|
|
34
|
-
'[&::-moz-range-track]:h-1 [&::-moz-range-track]:bg-transparent',
|
|
35
|
-
'[&::-moz-range-thumb]:pointer-events-auto [&::-moz-range-thumb]:h-4 [&::-moz-range-thumb]:w-4 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-primary [&::-moz-range-thumb]:bg-background [&::-moz-range-thumb]:shadow',
|
|
35
|
+
'pointer-events-none absolute inset-x-0 top-1/2 h-6 w-full -translate-y-1/2 appearance-none bg-transparent',
|
|
36
|
+
'[&::-webkit-slider-runnable-track]:h-1 [&::-webkit-slider-runnable-track]:rounded-full [&::-webkit-slider-runnable-track]:bg-transparent',
|
|
37
|
+
'[&::-webkit-slider-thumb]:pointer-events-auto [&::-webkit-slider-thumb]:mt-[-6px] [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:cursor-grab [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-primary [&::-webkit-slider-thumb]:bg-background [&::-webkit-slider-thumb]:shadow',
|
|
38
|
+
'[&::-moz-range-track]:h-1 [&::-moz-range-track]:rounded-full [&::-moz-range-track]:bg-transparent',
|
|
39
|
+
'[&::-moz-range-thumb]:pointer-events-auto [&::-moz-range-thumb]:h-4 [&::-moz-range-thumb]:w-4 [&::-moz-range-thumb]:cursor-grab [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-primary [&::-moz-range-thumb]:bg-background [&::-moz-range-thumb]:shadow',
|
|
36
40
|
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',
|
|
37
41
|
'disabled:cursor-not-allowed disabled:opacity-50'
|
|
38
42
|
);
|
|
@@ -87,7 +91,7 @@ export const RangeSlider = React.forwardRef<HTMLDivElement, RangeSliderProps>(fu
|
|
|
87
91
|
<span>{formatValue(high)}</span>
|
|
88
92
|
</div>
|
|
89
93
|
)}
|
|
90
|
-
<div className="relative h-
|
|
94
|
+
<div className="relative h-6 w-full">
|
|
91
95
|
<div className="absolute inset-x-0 top-1/2 h-1 -translate-y-1/2 rounded-full bg-muted" />
|
|
92
96
|
<div
|
|
93
97
|
className="absolute top-1/2 h-1 -translate-y-1/2 rounded-full bg-primary"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react';
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
|
-
import { axe } from 'jest-axe';
|
|
3
|
+
import { axe, configureAxe } from 'jest-axe';
|
|
4
4
|
import { describe, expect, it, vi } from 'vitest';
|
|
5
5
|
import { SelectMenu, type SelectMenuItem } from './SelectMenu';
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ describe('SelectMenu', () => {
|
|
|
15
15
|
it('opens a listbox with rich rows and groups', async () => {
|
|
16
16
|
const user = userEvent.setup();
|
|
17
17
|
render(<SelectMenu aria-label="Plan" items={items} placeholder="Choose a plan" />);
|
|
18
|
-
const trigger = screen.getByRole('
|
|
18
|
+
const trigger = screen.getByRole('combobox', { name: 'Plan' });
|
|
19
19
|
expect(trigger).toHaveAttribute('aria-haspopup', 'listbox');
|
|
20
20
|
expect(trigger).toHaveAttribute('aria-expanded', 'false');
|
|
21
21
|
await user.click(trigger);
|
|
@@ -29,18 +29,18 @@ describe('SelectMenu', () => {
|
|
|
29
29
|
const user = userEvent.setup();
|
|
30
30
|
const onValueChange = vi.fn();
|
|
31
31
|
render(<SelectMenu aria-label="Plan" items={items} onValueChange={onValueChange} />);
|
|
32
|
-
await user.click(screen.getByRole('
|
|
32
|
+
await user.click(screen.getByRole('combobox'));
|
|
33
33
|
await user.click(screen.getByRole('option', { name: /Pro/ }));
|
|
34
34
|
expect(onValueChange).toHaveBeenCalledWith('pro');
|
|
35
35
|
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
|
36
|
-
expect(screen.getByRole('
|
|
36
|
+
expect(screen.getByRole('combobox')).toHaveTextContent('Pro');
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
it('supports keyboard navigation and selection', async () => {
|
|
40
40
|
const user = userEvent.setup();
|
|
41
41
|
const onValueChange = vi.fn();
|
|
42
42
|
render(<SelectMenu aria-label="Plan" items={items} onValueChange={onValueChange} />);
|
|
43
|
-
const trigger = screen.getByRole('
|
|
43
|
+
const trigger = screen.getByRole('combobox');
|
|
44
44
|
trigger.focus();
|
|
45
45
|
await user.keyboard('{ArrowDown}'); // open
|
|
46
46
|
expect(screen.getByRole('listbox')).toBeInTheDocument();
|
|
@@ -54,20 +54,20 @@ describe('SelectMenu', () => {
|
|
|
54
54
|
const user = userEvent.setup();
|
|
55
55
|
const onValueChange = vi.fn();
|
|
56
56
|
render(<SelectMenu aria-label="Tags" multiple items={items} defaultValue={['free']} onValueChange={onValueChange} />);
|
|
57
|
-
const trigger = screen.getByRole('
|
|
57
|
+
const trigger = screen.getByRole('combobox');
|
|
58
58
|
expect(trigger).toHaveTextContent('Free');
|
|
59
59
|
await user.click(trigger);
|
|
60
60
|
await user.click(screen.getByRole('option', { name: /Pro/ }));
|
|
61
61
|
expect(onValueChange).toHaveBeenLastCalledWith(['free', 'pro']);
|
|
62
62
|
expect(screen.getByRole('listbox')).toBeInTheDocument();
|
|
63
|
-
expect(screen.getByRole('
|
|
63
|
+
expect(screen.getByRole('combobox')).toHaveTextContent('2 selected');
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
it('skips disabled options and exposes aria-disabled', async () => {
|
|
67
67
|
const user = userEvent.setup();
|
|
68
68
|
const onValueChange = vi.fn();
|
|
69
69
|
render(<SelectMenu aria-label="Plan" items={items} onValueChange={onValueChange} />);
|
|
70
|
-
await user.click(screen.getByRole('
|
|
70
|
+
await user.click(screen.getByRole('combobox'));
|
|
71
71
|
const disabled = screen.getByRole('option', { name: /Enterprise/ });
|
|
72
72
|
expect(disabled).toHaveAttribute('aria-disabled', 'true');
|
|
73
73
|
await user.click(disabled);
|
|
@@ -84,8 +84,8 @@ describe('SelectMenu', () => {
|
|
|
84
84
|
renderValue={(selected) => <em>{selected.length ? selected[0].label : 'Pick'}</em>}
|
|
85
85
|
/>
|
|
86
86
|
);
|
|
87
|
-
expect(screen.getByRole('
|
|
88
|
-
await user.click(screen.getByRole('
|
|
87
|
+
expect(screen.getByRole('combobox')).toHaveTextContent('Pick');
|
|
88
|
+
await user.click(screen.getByRole('combobox'));
|
|
89
89
|
expect(screen.getByText('★ Free')).toBeInTheDocument();
|
|
90
90
|
});
|
|
91
91
|
|
|
@@ -102,4 +102,14 @@ describe('SelectMenu', () => {
|
|
|
102
102
|
const { container } = render(<SelectMenu aria-label="Plan" items={items} />);
|
|
103
103
|
expect(await axe(container)).toHaveNoViolations();
|
|
104
104
|
});
|
|
105
|
+
|
|
106
|
+
it('has no accessibility violations while the listbox is open', async () => {
|
|
107
|
+
const user = userEvent.setup();
|
|
108
|
+
render(<SelectMenu aria-label="Plan" items={items} />);
|
|
109
|
+
await user.click(screen.getByRole('combobox'));
|
|
110
|
+
// The open listbox is portalled outside the render container, so check the
|
|
111
|
+
// body. The region rule is disabled because this is a fragment, not a page.
|
|
112
|
+
const check = configureAxe({ rules: { region: { enabled: false } } });
|
|
113
|
+
expect(await check(document.body)).toHaveNoViolations();
|
|
114
|
+
});
|
|
105
115
|
});
|
|
@@ -265,6 +265,7 @@ export const SelectMenu = React.forwardRef<HTMLButtonElement, SelectMenuProps>(f
|
|
|
265
265
|
<button
|
|
266
266
|
ref={setTriggerRef}
|
|
267
267
|
type="button"
|
|
268
|
+
role="combobox"
|
|
268
269
|
aria-haspopup="listbox"
|
|
269
270
|
aria-expanded={open}
|
|
270
271
|
aria-controls={open ? listboxId : undefined}
|
|
@@ -292,6 +293,7 @@ export const SelectMenu = React.forwardRef<HTMLButtonElement, SelectMenuProps>(f
|
|
|
292
293
|
ref={listRef}
|
|
293
294
|
id={listboxId}
|
|
294
295
|
role="listbox"
|
|
296
|
+
tabIndex={-1}
|
|
295
297
|
aria-labelledby={labelId}
|
|
296
298
|
aria-multiselectable={multiple || undefined}
|
|
297
299
|
style={{
|