@slipstream-ui/core 0.6.1 → 0.7.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 +337 -17
- package/dist/index.d.ts +337 -17
- package/dist/index.js +716 -224
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +710 -224
- package/dist/index.mjs.map +1 -1
- package/dist/manifests/accordion.manifest.json +1 -1
- package/dist/manifests/alert.manifest.json +1 -1
- package/dist/manifests/announcement-bar.manifest.json +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 +1 -1
- package/dist/manifests/autocomplete.manifest.json +1 -1
- package/dist/manifests/avatar.manifest.json +1 -1
- package/dist/manifests/badge.manifest.json +1 -1
- package/dist/manifests/block.manifest.json +1 -1
- package/dist/manifests/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 +1 -1
- 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 +1 -1
- package/dist/manifests/multi-select.manifest.json +1 -1
- package/dist/manifests/newsletter.manifest.json +1 -1
- package/dist/manifests/page-header.manifest.json +1 -1
- package/dist/manifests/pagination.manifest.json +1 -1
- package/dist/manifests/password-input.manifest.json +1 -1
- package/dist/manifests/popover.manifest.json +1 -1
- package/dist/manifests/process-steps.manifest.json +1 -1
- package/dist/manifests/progress.manifest.json +1 -1
- package/dist/manifests/prose.manifest.json +1 -1
- package/dist/manifests/radio.manifest.json +1 -1
- package/dist/manifests/range-slider.manifest.json +1 -1
- package/dist/manifests/search.manifest.json +1 -1
- package/dist/manifests/section-heading.manifest.json +1 -1
- package/dist/manifests/section.manifest.json +1 -1
- package/dist/manifests/segmented-control.manifest.json +1 -1
- package/dist/manifests/select-menu.manifest.json +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/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/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/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.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 +5 -0
- package/dist/styles-full.css +1 -1
- package/dist/styles.css +1 -1
- package/package.json +5 -5
- 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/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/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 +5 -0
- package/src/manifests/accordion.manifest.json +1 -1
- package/src/manifests/alert.manifest.json +1 -1
- package/src/manifests/announcement-bar.manifest.json +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 +1 -1
- package/src/manifests/autocomplete.manifest.json +1 -1
- package/src/manifests/avatar.manifest.json +1 -1
- package/src/manifests/badge.manifest.json +1 -1
- package/src/manifests/block.manifest.json +1 -1
- package/src/manifests/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 +1 -1
- 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 +1 -1
- package/src/manifests/multi-select.manifest.json +1 -1
- package/src/manifests/newsletter.manifest.json +1 -1
- package/src/manifests/page-header.manifest.json +1 -1
- package/src/manifests/pagination.manifest.json +1 -1
- package/src/manifests/password-input.manifest.json +1 -1
- package/src/manifests/popover.manifest.json +1 -1
- package/src/manifests/process-steps.manifest.json +1 -1
- package/src/manifests/progress.manifest.json +1 -1
- package/src/manifests/prose.manifest.json +1 -1
- package/src/manifests/radio.manifest.json +1 -1
- package/src/manifests/range-slider.manifest.json +1 -1
- package/src/manifests/search.manifest.json +1 -1
- package/src/manifests/section-heading.manifest.json +1 -1
- package/src/manifests/section.manifest.json +1 -1
- package/src/manifests/segmented-control.manifest.json +1 -1
- package/src/manifests/select-menu.manifest.json +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
|
@@ -10,7 +10,22 @@ export type StepperProps = Omit<React.OlHTMLAttributes<HTMLOListElement>, 'onCli
|
|
|
10
10
|
steps: StepperStep[];
|
|
11
11
|
/** Zero-based index of the active step. */
|
|
12
12
|
current: number;
|
|
13
|
+
/** Layout direction. Default 'horizontal'. */
|
|
13
14
|
orientation?: 'horizontal' | 'vertical';
|
|
15
|
+
/**
|
|
16
|
+
* Marker style. `numbered` shows the step number and a check when complete;
|
|
17
|
+
* `dots` is the compact progress variant with no numbers.
|
|
18
|
+
*/
|
|
19
|
+
variant?: 'numbered' | 'dots';
|
|
20
|
+
/** Marker and label scale. Default 'md'. */
|
|
21
|
+
size?: 'sm' | 'md';
|
|
22
|
+
/** Horizontal only: place the label beside the marker or beneath it. Default 'inline'. */
|
|
23
|
+
labelPlacement?: 'inline' | 'below';
|
|
24
|
+
/**
|
|
25
|
+
* Center a title vertically against its marker when that step has no
|
|
26
|
+
* description. Titles with a description stay top aligned. Default 'center'.
|
|
27
|
+
*/
|
|
28
|
+
alignTitles?: 'start' | 'center';
|
|
14
29
|
/** Makes completed/upcoming steps clickable. */
|
|
15
30
|
onStepClick?: (index: number) => void;
|
|
16
31
|
};
|
|
@@ -19,69 +34,186 @@ export type StepperProps = Omit<React.OlHTMLAttributes<HTMLOListElement>, 'onCli
|
|
|
19
34
|
* Progress through a multi-step flow with proper semantics: an ordered list
|
|
20
35
|
* where the active step carries aria-current="step" and each marker states
|
|
21
36
|
* complete/current/upcoming in text, not only color.
|
|
37
|
+
*
|
|
38
|
+
* Four practical shapes: horizontal inline labels, horizontal labels below
|
|
39
|
+
* the markers, a vertical timeline, and a compact dots variant for tight
|
|
40
|
+
* spaces. All four are responsive and keyboard operable when `onStepClick`
|
|
41
|
+
* is provided.
|
|
22
42
|
*/
|
|
23
43
|
export const Stepper = React.forwardRef<HTMLOListElement, StepperProps>(function Stepper(
|
|
24
|
-
{
|
|
44
|
+
{
|
|
45
|
+
steps,
|
|
46
|
+
current,
|
|
47
|
+
orientation = 'horizontal',
|
|
48
|
+
variant = 'numbered',
|
|
49
|
+
size = 'md',
|
|
50
|
+
labelPlacement = 'inline',
|
|
51
|
+
alignTitles = 'center',
|
|
52
|
+
onStepClick,
|
|
53
|
+
className,
|
|
54
|
+
...props
|
|
55
|
+
},
|
|
25
56
|
ref
|
|
26
57
|
) {
|
|
58
|
+
const vertical = orientation === 'vertical';
|
|
59
|
+
const interactive = Boolean(onStepClick);
|
|
60
|
+
|
|
61
|
+
const markerSizeClass = size === 'sm' ? 'h-6 w-6 text-[11px]' : 'h-7 w-7 text-xs';
|
|
62
|
+
const dotSizeClass = size === 'sm' ? 'h-2 w-2' : 'h-2.5 w-2.5';
|
|
63
|
+
const labelSizeClass = size === 'sm' ? 'text-xs' : 'text-sm';
|
|
64
|
+
const descriptionSizeClass = size === 'sm' ? 'text-[11px]' : 'text-xs';
|
|
65
|
+
const gapClass = size === 'sm' ? 'gap-1.5' : 'gap-2';
|
|
66
|
+
const verticalTitlePad = size === 'sm' ? 'pt-0.5' : 'pt-1';
|
|
67
|
+
const connectorTop =
|
|
68
|
+
variant === 'dots'
|
|
69
|
+
? size === 'sm'
|
|
70
|
+
? 'mt-1'
|
|
71
|
+
: 'mt-[5px]'
|
|
72
|
+
: size === 'sm'
|
|
73
|
+
? 'mt-3'
|
|
74
|
+
: 'mt-3.5';
|
|
75
|
+
|
|
76
|
+
const focusClass =
|
|
77
|
+
'rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background';
|
|
78
|
+
|
|
27
79
|
return (
|
|
28
80
|
<ol
|
|
29
81
|
ref={ref}
|
|
30
82
|
className={cn(
|
|
31
|
-
'flex gap-4',
|
|
32
|
-
orientation === 'vertical' ? 'flex-col' : 'flex-wrap items-start',
|
|
83
|
+
vertical ? 'flex flex-col' : 'flex flex-wrap items-start gap-4',
|
|
33
84
|
className
|
|
34
85
|
)}
|
|
35
86
|
{...props}
|
|
36
87
|
>
|
|
37
88
|
{steps.map((step, index) => {
|
|
38
89
|
const state = index < current ? 'complete' : index === current ? 'current' : 'upcoming';
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
|
|
90
|
+
const isLast = index === steps.length - 1;
|
|
91
|
+
const titleCentered = alignTitles === 'center' && !step.description;
|
|
92
|
+
const below = !vertical && labelPlacement === 'below';
|
|
93
|
+
|
|
94
|
+
const marker = (
|
|
95
|
+
<span
|
|
96
|
+
aria-hidden="true"
|
|
97
|
+
className={cn(
|
|
98
|
+
'flex shrink-0 items-center justify-center',
|
|
99
|
+
variant === 'dots'
|
|
100
|
+
? cn(
|
|
101
|
+
'rounded-full',
|
|
102
|
+
dotSizeClass,
|
|
103
|
+
state === 'upcoming' ? 'bg-border' : 'bg-primary',
|
|
104
|
+
state === 'current' && 'ring-2 ring-primary/30 ring-offset-2 ring-offset-background'
|
|
105
|
+
)
|
|
106
|
+
: cn(
|
|
107
|
+
'rounded-full border font-medium',
|
|
108
|
+
markerSizeClass,
|
|
109
|
+
state === 'complete' && 'border-primary bg-primary text-primary-foreground',
|
|
110
|
+
state === 'current' && 'border-primary text-primary',
|
|
111
|
+
state === 'upcoming' && 'border-border text-muted-foreground'
|
|
112
|
+
)
|
|
113
|
+
)}
|
|
114
|
+
>
|
|
115
|
+
{variant === 'numbered' ? (state === 'complete' ? '✓' : index + 1) : null}
|
|
116
|
+
</span>
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const label = (
|
|
120
|
+
<span className="min-w-0">
|
|
42
121
|
<span
|
|
43
|
-
aria-hidden="true"
|
|
44
122
|
className={cn(
|
|
45
|
-
'
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
state === 'upcoming'
|
|
123
|
+
'block leading-5',
|
|
124
|
+
labelSizeClass,
|
|
125
|
+
below && 'text-center',
|
|
126
|
+
state === 'upcoming' ? 'text-muted-foreground' : 'font-medium'
|
|
49
127
|
)}
|
|
50
128
|
>
|
|
51
|
-
{
|
|
129
|
+
{step.label}
|
|
52
130
|
</span>
|
|
53
|
-
|
|
54
|
-
<span
|
|
55
|
-
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{
|
|
131
|
+
{step.description && (
|
|
132
|
+
<span
|
|
133
|
+
className={cn(
|
|
134
|
+
'mt-0.5 block leading-4 text-muted-foreground',
|
|
135
|
+
descriptionSizeClass,
|
|
136
|
+
below && 'text-center'
|
|
137
|
+
)}
|
|
138
|
+
>
|
|
139
|
+
{step.description}
|
|
62
140
|
</span>
|
|
141
|
+
)}
|
|
142
|
+
<span className="sr-only">
|
|
143
|
+
{state === 'complete' ? ' (completed)' : state === 'current' ? ' (current step)' : ' (upcoming)'}
|
|
63
144
|
</span>
|
|
64
|
-
|
|
145
|
+
</span>
|
|
65
146
|
);
|
|
66
147
|
|
|
148
|
+
const renderRow = (children: React.ReactNode, rowClassName: string) =>
|
|
149
|
+
interactive ? (
|
|
150
|
+
<button
|
|
151
|
+
type="button"
|
|
152
|
+
onClick={() => onStepClick?.(index)}
|
|
153
|
+
aria-current={state === 'current' ? 'step' : undefined}
|
|
154
|
+
className={cn(rowClassName, focusClass)}
|
|
155
|
+
>
|
|
156
|
+
{children}
|
|
157
|
+
</button>
|
|
158
|
+
) : (
|
|
159
|
+
<div aria-current={state === 'current' ? 'step' : undefined} className={rowClassName}>
|
|
160
|
+
{children}
|
|
161
|
+
</div>
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
if (vertical) {
|
|
165
|
+
return (
|
|
166
|
+
<li key={step.label} className="flex">
|
|
167
|
+
{renderRow(
|
|
168
|
+
<>
|
|
169
|
+
<div className="flex flex-col items-center">
|
|
170
|
+
{marker}
|
|
171
|
+
{!isLast && (
|
|
172
|
+
<span aria-hidden="true" className="my-1 w-px flex-1 rounded-full bg-border" />
|
|
173
|
+
)}
|
|
174
|
+
</div>
|
|
175
|
+
<div className={cn('min-w-0 pb-6', titleCentered && verticalTitlePad)}>{label}</div>
|
|
176
|
+
</>,
|
|
177
|
+
'flex w-full items-stretch gap-3 text-left'
|
|
178
|
+
)}
|
|
179
|
+
</li>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (below) {
|
|
184
|
+
return (
|
|
185
|
+
<li key={step.label} className="flex min-w-0 flex-1 items-start gap-2">
|
|
186
|
+
{renderRow(
|
|
187
|
+
<>
|
|
188
|
+
{marker}
|
|
189
|
+
{label}
|
|
190
|
+
</>,
|
|
191
|
+
'flex min-w-0 flex-1 flex-col items-center gap-2 text-center'
|
|
192
|
+
)}
|
|
193
|
+
{!isLast && (
|
|
194
|
+
<span
|
|
195
|
+
aria-hidden="true"
|
|
196
|
+
className={cn('h-px min-w-4 flex-1 bg-border', connectorTop)}
|
|
197
|
+
/>
|
|
198
|
+
)}
|
|
199
|
+
</li>
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
67
203
|
return (
|
|
68
204
|
<li key={step.label} className="flex min-w-0 items-start gap-2">
|
|
69
|
-
{
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
>
|
|
76
|
-
{content}
|
|
77
|
-
</button>
|
|
78
|
-
) : (
|
|
79
|
-
<div aria-current={state === 'current' ? 'step' : undefined} className="flex items-start gap-2">
|
|
80
|
-
{content}
|
|
81
|
-
</div>
|
|
205
|
+
{renderRow(
|
|
206
|
+
<>
|
|
207
|
+
{marker}
|
|
208
|
+
{label}
|
|
209
|
+
</>,
|
|
210
|
+
cn('flex min-w-0 text-left', gapClass, titleCentered ? 'items-center' : 'items-start')
|
|
82
211
|
)}
|
|
83
|
-
{
|
|
84
|
-
<span
|
|
212
|
+
{!isLast && (
|
|
213
|
+
<span
|
|
214
|
+
aria-hidden="true"
|
|
215
|
+
className={cn('h-px w-6 shrink-0 bg-border sm:w-8', connectorTop)}
|
|
216
|
+
/>
|
|
85
217
|
)}
|
|
86
218
|
</li>
|
|
87
219
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
2
3
|
import { axe } from 'jest-axe';
|
|
3
|
-
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
4
5
|
import { TableOfContents } from './TableOfContents';
|
|
5
6
|
|
|
6
7
|
const headings = [
|
|
@@ -24,6 +25,16 @@ describe('TableOfContents', () => {
|
|
|
24
25
|
expect(setupItem.style.paddingLeft).toBe('0.75rem');
|
|
25
26
|
});
|
|
26
27
|
|
|
28
|
+
it('reports navigation while keeping the native anchor behavior', async () => {
|
|
29
|
+
const user = userEvent.setup();
|
|
30
|
+
const onNavigate = vi.fn();
|
|
31
|
+
render(<TableOfContents headings={headings} onNavigate={onNavigate} />);
|
|
32
|
+
const link = screen.getByRole('link', { name: 'API' });
|
|
33
|
+
expect(link).toHaveAttribute('href', '#api');
|
|
34
|
+
await user.click(link);
|
|
35
|
+
expect(onNavigate).toHaveBeenCalledWith('api');
|
|
36
|
+
});
|
|
37
|
+
|
|
27
38
|
it('has no accessibility violations', async () => {
|
|
28
39
|
const { container } = render(<TableOfContents headings={headings} activeId="intro" />);
|
|
29
40
|
expect(await axe(container)).toHaveNoViolations();
|
|
@@ -21,12 +21,20 @@ export type TableOfContentsProps = React.HTMLAttributes<HTMLElement> & {
|
|
|
21
21
|
labelClassName?: string;
|
|
22
22
|
/** Stick to the viewport while the article scrolls (default true). */
|
|
23
23
|
sticky?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Called with the heading id when a link is activated. The browser still
|
|
26
|
+
* performs the native anchor jump, so this is for syncing a controlled
|
|
27
|
+
* `activeId`, analytics, or closing a mobile TOC.
|
|
28
|
+
*/
|
|
29
|
+
onNavigate?: (id: string) => void;
|
|
24
30
|
};
|
|
25
31
|
|
|
26
32
|
/**
|
|
27
33
|
* "On this page" navigation for long-form content. Renders a nested list
|
|
28
34
|
* with indentation per heading level and aria-current on the active item.
|
|
29
|
-
*
|
|
35
|
+
* Links are real anchors, so they scroll and update the URL with no JavaScript.
|
|
36
|
+
* Pair with `useScrollSpy` (or your own scroll tracking) for the active id,
|
|
37
|
+
* and give the target headings `scroll-mt-*` when a sticky header overlaps.
|
|
30
38
|
*/
|
|
31
39
|
export function TableOfContents({
|
|
32
40
|
headings,
|
|
@@ -35,6 +43,7 @@ export function TableOfContents({
|
|
|
35
43
|
ariaLabel,
|
|
36
44
|
labelClassName,
|
|
37
45
|
sticky = true,
|
|
46
|
+
onNavigate,
|
|
38
47
|
className,
|
|
39
48
|
...props
|
|
40
49
|
}: TableOfContentsProps) {
|
|
@@ -53,6 +62,7 @@ export function TableOfContents({
|
|
|
53
62
|
<a
|
|
54
63
|
href={`#${heading.id}`}
|
|
55
64
|
aria-current={active ? 'location' : undefined}
|
|
65
|
+
onClick={() => onNavigate?.(heading.id)}
|
|
56
66
|
className={cn(
|
|
57
67
|
'-ml-px block border-l py-1 pl-3 no-underline transition-colors',
|
|
58
68
|
active
|
|
@@ -102,5 +112,19 @@ export function useScrollSpy(ids: string[], options?: { rootMargin?: string }):
|
|
|
102
112
|
return () => observer.disconnect();
|
|
103
113
|
}, [idKey, rootMargin]);
|
|
104
114
|
|
|
115
|
+
// Clicking a TOC anchor changes the hash before the observer reports a new
|
|
116
|
+
// intersection. Mirror the hash so the highlight follows immediately.
|
|
117
|
+
React.useEffect(() => {
|
|
118
|
+
if (typeof window === 'undefined') return;
|
|
119
|
+
const ids = idKey.split('|').filter(Boolean);
|
|
120
|
+
const syncFromHash = () => {
|
|
121
|
+
const id = window.location.hash.replace(/^#/, '');
|
|
122
|
+
if (id && ids.includes(id)) setActiveId(id);
|
|
123
|
+
};
|
|
124
|
+
syncFromHash();
|
|
125
|
+
window.addEventListener('hashchange', syncFromHash);
|
|
126
|
+
return () => window.removeEventListener('hashchange', syncFromHash);
|
|
127
|
+
}, [idKey]);
|
|
128
|
+
|
|
105
129
|
return activeId;
|
|
106
130
|
}
|
|
@@ -59,6 +59,18 @@ describe('Tabs', () => {
|
|
|
59
59
|
expect(panel).toHaveAttribute('aria-labelledby', tab.id);
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
+
it('omits aria-controls when a trigger has no matching panel', () => {
|
|
63
|
+
render(
|
|
64
|
+
<Tabs defaultValue="a">
|
|
65
|
+
<TabsList>
|
|
66
|
+
<TabsTrigger value="a">Only trigger</TabsTrigger>
|
|
67
|
+
</TabsList>
|
|
68
|
+
</Tabs>
|
|
69
|
+
);
|
|
70
|
+
expect(screen.getByRole('tab')).not.toHaveAttribute('aria-controls');
|
|
71
|
+
expect(screen.getByRole('tab')).toHaveAttribute('aria-selected', 'true');
|
|
72
|
+
});
|
|
73
|
+
|
|
62
74
|
it('activates with Enter key', async () => {
|
|
63
75
|
const user = userEvent.setup();
|
|
64
76
|
render(<BasicTabs defaultValue="a" />);
|
|
@@ -13,6 +13,10 @@ type TabsContextValue = {
|
|
|
13
13
|
baseId: string;
|
|
14
14
|
variant: TabsVariant;
|
|
15
15
|
size: TabsSize;
|
|
16
|
+
/** Values of the panels actually rendered, so triggers only reference real targets. */
|
|
17
|
+
panels: Set<string>;
|
|
18
|
+
registerPanel: (value: string) => void;
|
|
19
|
+
unregisterPanel: (value: string) => void;
|
|
16
20
|
};
|
|
17
21
|
|
|
18
22
|
const TabsContext = React.createContext<TabsContextValue>({
|
|
@@ -21,6 +25,9 @@ const TabsContext = React.createContext<TabsContextValue>({
|
|
|
21
25
|
baseId: '',
|
|
22
26
|
variant: 'default',
|
|
23
27
|
size: 'md',
|
|
28
|
+
panels: new Set(),
|
|
29
|
+
registerPanel: () => {},
|
|
30
|
+
unregisterPanel: () => {},
|
|
24
31
|
});
|
|
25
32
|
|
|
26
33
|
export type TabsProps = {
|
|
@@ -51,6 +58,25 @@ const Tabs = React.forwardRef<HTMLDivElement, TabsProps>(
|
|
|
51
58
|
const [internalValue, setInternalValue] = React.useState(defaultValue ?? '');
|
|
52
59
|
const current = value ?? internalValue;
|
|
53
60
|
const baseId = React.useId();
|
|
61
|
+
const [panels, setPanels] = React.useState<Set<string>>(() => new Set());
|
|
62
|
+
|
|
63
|
+
const registerPanel = React.useCallback((panelValue: string) => {
|
|
64
|
+
setPanels((previous) => {
|
|
65
|
+
if (previous.has(panelValue)) return previous;
|
|
66
|
+
const next = new Set(previous);
|
|
67
|
+
next.add(panelValue);
|
|
68
|
+
return next;
|
|
69
|
+
});
|
|
70
|
+
}, []);
|
|
71
|
+
|
|
72
|
+
const unregisterPanel = React.useCallback((panelValue: string) => {
|
|
73
|
+
setPanels((previous) => {
|
|
74
|
+
if (!previous.has(panelValue)) return previous;
|
|
75
|
+
const next = new Set(previous);
|
|
76
|
+
next.delete(panelValue);
|
|
77
|
+
return next;
|
|
78
|
+
});
|
|
79
|
+
}, []);
|
|
54
80
|
|
|
55
81
|
const setValue = React.useCallback(
|
|
56
82
|
(next: string) => {
|
|
@@ -60,11 +86,23 @@ const Tabs = React.forwardRef<HTMLDivElement, TabsProps>(
|
|
|
60
86
|
[value, onValueChange]
|
|
61
87
|
);
|
|
62
88
|
|
|
89
|
+
const contextValue = React.useMemo(
|
|
90
|
+
() => ({
|
|
91
|
+
value: current,
|
|
92
|
+
setValue,
|
|
93
|
+
baseId,
|
|
94
|
+
variant,
|
|
95
|
+
size,
|
|
96
|
+
panels,
|
|
97
|
+
registerPanel,
|
|
98
|
+
unregisterPanel,
|
|
99
|
+
}),
|
|
100
|
+
[current, setValue, baseId, variant, size, panels, registerPanel, unregisterPanel]
|
|
101
|
+
);
|
|
102
|
+
|
|
63
103
|
return (
|
|
64
104
|
<div ref={ref} className={className} data-value={current} data-variant={variant}>
|
|
65
|
-
<TabsContext.Provider value={{
|
|
66
|
-
{children}
|
|
67
|
-
</TabsContext.Provider>
|
|
105
|
+
<TabsContext.Provider value={contextValue}>{children}</TabsContext.Provider>
|
|
68
106
|
</div>
|
|
69
107
|
);
|
|
70
108
|
}
|
|
@@ -169,7 +207,7 @@ const TabsTrigger = React.forwardRef<HTMLButtonElement, TabsTriggerProps>(
|
|
|
169
207
|
role="tab"
|
|
170
208
|
id={`${ctx.baseId}-tab-${value}`}
|
|
171
209
|
aria-selected={active}
|
|
172
|
-
aria-controls={`${ctx.baseId}-panel-${value}`}
|
|
210
|
+
aria-controls={ctx.panels.has(value) ? `${ctx.baseId}-panel-${value}` : undefined}
|
|
173
211
|
// Radix-compatible hook so consumers can style active state from
|
|
174
212
|
// outside: data-[state=active]:border-primary etc.
|
|
175
213
|
data-state={active ? 'active' : 'inactive'}
|
|
@@ -219,8 +257,14 @@ export type TabsContentProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
219
257
|
const TabsContent = React.forwardRef<HTMLDivElement, TabsContentProps>(
|
|
220
258
|
({ value, className, ...props }, ref) => {
|
|
221
259
|
const ctx = React.useContext(TabsContext);
|
|
260
|
+
const { registerPanel, unregisterPanel } = ctx;
|
|
222
261
|
const active = ctx.value === value;
|
|
223
262
|
|
|
263
|
+
React.useEffect(() => {
|
|
264
|
+
registerPanel(value);
|
|
265
|
+
return () => unregisterPanel(value);
|
|
266
|
+
}, [registerPanel, unregisterPanel, value]);
|
|
267
|
+
|
|
224
268
|
return (
|
|
225
269
|
<div
|
|
226
270
|
ref={ref}
|
|
@@ -51,7 +51,7 @@ export const TimePicker = React.forwardRef<HTMLInputElement, TimePickerProps>(fu
|
|
|
51
51
|
type="button"
|
|
52
52
|
onClick={() => commit('')}
|
|
53
53
|
aria-label={clearLabel}
|
|
54
|
-
className="absolute right-
|
|
54
|
+
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"
|
|
55
55
|
>
|
|
56
56
|
✕
|
|
57
57
|
</button>
|
|
@@ -38,11 +38,11 @@ export const Timeline = React.forwardRef<HTMLOListElement, TimelineProps>(functi
|
|
|
38
38
|
/>
|
|
39
39
|
{index < items.length - 1 && <span aria-hidden="true" className="mt-1 w-px flex-1 bg-border" />}
|
|
40
40
|
</div>
|
|
41
|
-
<div className=
|
|
41
|
+
<div className="min-w-0 pb-1">
|
|
42
42
|
{item.period && (
|
|
43
43
|
<p className="text-xs font-medium uppercase tracking-wide text-muted-foreground">{item.period}</p>
|
|
44
44
|
)}
|
|
45
|
-
<p className=
|
|
45
|
+
<p className={cn('text-sm font-semibold', item.muted && 'text-muted-foreground')}>{item.title}</p>
|
|
46
46
|
{item.description && <p className="mt-1 text-sm text-muted-foreground">{item.description}</p>}
|
|
47
47
|
{item.icon && <div className="mt-1 text-muted-foreground [&_svg]:size-4">{item.icon}</div>}
|
|
48
48
|
</div>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { axe } from 'jest-axe';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import { TombstoneCard } from './TombstoneCard';
|
|
5
|
+
|
|
6
|
+
describe('TombstoneCard', () => {
|
|
7
|
+
it('renders the unavailable state and reason', () => {
|
|
8
|
+
render(
|
|
9
|
+
<TombstoneCard
|
|
10
|
+
title="Archived listing"
|
|
11
|
+
reason="This listing closed in 2025."
|
|
12
|
+
status="archived"
|
|
13
|
+
href="/deals/archived"
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
expect(screen.getByRole('heading', { level: 3, name: 'Archived listing' })).toBeInTheDocument();
|
|
17
|
+
expect(screen.getByText('Archived')).toBeInTheDocument();
|
|
18
|
+
expect(screen.getByText('This listing closed in 2025.')).toBeInTheDocument();
|
|
19
|
+
expect(screen.getByRole('link', { name: 'View details' })).toHaveAttribute('href', '/deals/archived');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('has no accessibility violations', async () => {
|
|
23
|
+
const { container } = render(<TombstoneCard title="Unavailable" reason="No longer available." />);
|
|
24
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import { Badge } from '../badge/Badge';
|
|
4
|
+
import { Card, CardContent } from '../card/Card';
|
|
5
|
+
|
|
6
|
+
export type TombstoneStatus = 'archived' | 'unavailable' | 'closed';
|
|
7
|
+
|
|
8
|
+
export type TombstoneCardProps = Omit<React.HTMLAttributes<HTMLElement>, 'title'> & {
|
|
9
|
+
/** Listing, deal or document name. */
|
|
10
|
+
title: string;
|
|
11
|
+
/** Why the item is unavailable. */
|
|
12
|
+
reason?: string;
|
|
13
|
+
/** Unavailable state. Default 'unavailable'. */
|
|
14
|
+
status?: TombstoneStatus;
|
|
15
|
+
/** Logo or document icon slot. */
|
|
16
|
+
logo?: React.ReactNode;
|
|
17
|
+
/** Optional detail destination. */
|
|
18
|
+
href?: string;
|
|
19
|
+
/** Link label. Default "View details". */
|
|
20
|
+
actionLabel?: string;
|
|
21
|
+
/** Custom link element for routers. */
|
|
22
|
+
linkComponent?: React.ElementType;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const statusConfig: Record<TombstoneStatus, { label: string; variant: 'secondary' | 'warning' | 'outline' }> = {
|
|
26
|
+
archived: { label: 'Archived', variant: 'secondary' },
|
|
27
|
+
unavailable: { label: 'Unavailable', variant: 'warning' },
|
|
28
|
+
closed: { label: 'Closed', variant: 'outline' },
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Placeholder card for archived, closed or unavailable marketplace items. It
|
|
33
|
+
* explains why the item is unavailable instead of silently removing it from a
|
|
34
|
+
* list or leaving a broken detail link.
|
|
35
|
+
*/
|
|
36
|
+
export const TombstoneCard = React.forwardRef<HTMLElement, TombstoneCardProps>(function TombstoneCard(
|
|
37
|
+
{
|
|
38
|
+
title,
|
|
39
|
+
reason,
|
|
40
|
+
status = 'unavailable',
|
|
41
|
+
logo,
|
|
42
|
+
href,
|
|
43
|
+
actionLabel = 'View details',
|
|
44
|
+
linkComponent,
|
|
45
|
+
className,
|
|
46
|
+
...props
|
|
47
|
+
},
|
|
48
|
+
ref
|
|
49
|
+
) {
|
|
50
|
+
const Link = linkComponent ?? 'a';
|
|
51
|
+
const statusInfo = statusConfig[status];
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<Card
|
|
55
|
+
ref={ref as never}
|
|
56
|
+
className={cn('flex h-full flex-col border-dashed bg-muted/30 shadow-none', className)}
|
|
57
|
+
{...props}
|
|
58
|
+
>
|
|
59
|
+
<CardContent className="flex flex-1 flex-col gap-3 p-5">
|
|
60
|
+
<div className="flex items-start justify-between gap-2">
|
|
61
|
+
{logo && <div className="min-w-0 opacity-70">{logo}</div>}
|
|
62
|
+
<Badge variant={statusInfo.variant}>{statusInfo.label}</Badge>
|
|
63
|
+
</div>
|
|
64
|
+
<h3 className="text-base font-semibold tracking-tight text-foreground/80">{title}</h3>
|
|
65
|
+
{reason && <p className="text-sm leading-relaxed text-muted-foreground">{reason}</p>}
|
|
66
|
+
{href && (
|
|
67
|
+
<Link
|
|
68
|
+
href={href}
|
|
69
|
+
className="mt-auto text-sm font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
70
|
+
>
|
|
71
|
+
{actionLabel}
|
|
72
|
+
</Link>
|
|
73
|
+
)}
|
|
74
|
+
</CardContent>
|
|
75
|
+
</Card>
|
|
76
|
+
);
|
|
77
|
+
});
|
package/src/index.ts
CHANGED
|
@@ -77,6 +77,11 @@ export * from './components/article-card';
|
|
|
77
77
|
export * from './components/newsletter';
|
|
78
78
|
export * from './components/contact-strip';
|
|
79
79
|
export * from './components/announcement-bar';
|
|
80
|
+
export * from './components/deal-card';
|
|
81
|
+
export * from './components/entity-card';
|
|
82
|
+
export * from './components/tombstone-card';
|
|
83
|
+
export * from './components/document-card';
|
|
84
|
+
export * from './components/load-more';
|
|
80
85
|
export * from './components/segmented-control';
|
|
81
86
|
export * from './components/range-slider';
|
|
82
87
|
export * from './components/filter-chips';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"tier": "molecule",
|
|
5
5
|
"package": "@slipstream-ui/core",
|
|
6
6
|
"importPath": "@slipstream-ui/core",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.7.0",
|
|
8
8
|
"sourceDir": "announcement-bar",
|
|
9
9
|
"exportName": "AnnouncementBar",
|
|
10
10
|
"description": "Dismissible announcement bar with optional action, tone and sticky positioning.",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"tier": "molecule",
|
|
5
5
|
"package": "@slipstream-ui/core",
|
|
6
6
|
"importPath": "@slipstream-ui/core",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.7.0",
|
|
8
8
|
"sourceDir": "applied-filters",
|
|
9
9
|
"exportName": "AppliedFilters",
|
|
10
10
|
"description": "Applied-filter summary with a live count, removable chips and an edit action.",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"tier": "molecule",
|
|
5
5
|
"package": "@slipstream-ui/core",
|
|
6
6
|
"importPath": "@slipstream-ui/core",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.7.0",
|
|
8
8
|
"sourceDir": "article-card",
|
|
9
9
|
"exportName": "ArticleCard",
|
|
10
10
|
"description": "Linked article or resource card with media, eyebrow, title, summary and metadata.",
|