@slipstream-ui/core 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +317 -21
- package/dist/index.d.ts +317 -21
- package/dist/index.js +2004 -1069
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1998 -1068
- package/dist/index.mjs.map +1 -1
- package/dist/manifests/accordion.manifest.json +8 -2
- package/dist/manifests/alert.manifest.json +1 -1
- package/dist/manifests/announcement-bar.manifest.json +1 -1
- package/dist/manifests/app-shell.manifest.json +1 -1
- package/dist/manifests/applied-filters.manifest.json +1 -1
- package/dist/manifests/article-card.manifest.json +1 -1
- package/dist/manifests/auth-layout.manifest.json +19 -1
- package/dist/manifests/autocomplete.manifest.json +1 -1
- package/dist/manifests/avatar.manifest.json +1 -1
- package/dist/manifests/badge.manifest.json +13 -1
- package/dist/manifests/block.manifest.json +1 -1
- package/dist/manifests/bottom-nav.manifest.json +130 -0
- package/dist/manifests/breadcrumb.manifest.json +1 -1
- package/dist/manifests/button-group.manifest.json +1 -1
- package/dist/manifests/button.manifest.json +1 -1
- package/dist/manifests/calendar.manifest.json +175 -0
- package/dist/manifests/card.manifest.json +1 -1
- package/dist/manifests/checkbox.manifest.json +1 -1
- package/dist/manifests/comparison-table.manifest.json +1 -1
- package/dist/manifests/confirm-dialog.manifest.json +1 -1
- package/dist/manifests/contact-strip.manifest.json +1 -1
- package/dist/manifests/container.manifest.json +1 -1
- package/dist/manifests/cta-section.manifest.json +1 -1
- package/dist/manifests/data-table.manifest.json +8 -1
- package/dist/manifests/date-picker-popover.manifest.json +202 -0
- package/dist/manifests/date-picker.manifest.json +1 -1
- package/dist/manifests/date-range-picker.manifest.json +1 -1
- package/dist/manifests/deal-card.manifest.json +1 -1
- package/dist/manifests/dialog.manifest.json +1 -1
- package/dist/manifests/document-card.manifest.json +1 -1
- package/dist/manifests/drawer.manifest.json +48 -2
- package/dist/manifests/empty-state.manifest.json +1 -1
- package/dist/manifests/entity-card.manifest.json +1 -1
- package/dist/manifests/feature-grid.manifest.json +1 -1
- package/dist/manifests/feature-row.manifest.json +1 -1
- package/dist/manifests/fieldset.manifest.json +1 -1
- package/dist/manifests/file-upload.manifest.json +1 -1
- package/dist/manifests/filter-bar.manifest.json +1 -1
- package/dist/manifests/filter-chips.manifest.json +1 -1
- package/dist/manifests/filter-panel.manifest.json +1 -1
- package/dist/manifests/flex.manifest.json +1 -1
- package/dist/manifests/form-field.manifest.json +1 -1
- package/dist/manifests/form-layout.manifest.json +1 -1
- package/dist/manifests/form.manifest.json +1 -1
- package/dist/manifests/grid.manifest.json +1 -1
- package/dist/manifests/heading.manifest.json +1 -1
- package/dist/manifests/hero.manifest.json +1 -1
- package/dist/manifests/image.manifest.json +142 -0
- package/dist/manifests/input-group.manifest.json +1 -1
- package/dist/manifests/input.manifest.json +1 -1
- package/dist/manifests/label.manifest.json +1 -1
- package/dist/manifests/link-tabs.manifest.json +1 -1
- package/dist/manifests/link.manifest.json +1 -1
- package/dist/manifests/list.manifest.json +1 -1
- package/dist/manifests/load-more.manifest.json +1 -1
- package/dist/manifests/logo-cloud.manifest.json +1 -1
- package/dist/manifests/menu.manifest.json +1 -1
- package/dist/manifests/metric-card.manifest.json +36 -4
- package/dist/manifests/multi-select.manifest.json +1 -1
- package/dist/manifests/newsletter.manifest.json +1 -1
- package/dist/manifests/page-header.manifest.json +7 -1
- package/dist/manifests/pagination.manifest.json +1 -1
- package/dist/manifests/password-input.manifest.json +1 -1
- package/dist/manifests/popover.manifest.json +86 -4
- package/dist/manifests/process-steps.manifest.json +1 -1
- package/dist/manifests/progress.manifest.json +1 -1
- package/dist/manifests/prose.manifest.json +1 -1
- package/dist/manifests/radio.manifest.json +1 -1
- package/dist/manifests/range-slider.manifest.json +1 -1
- package/dist/manifests/search.manifest.json +1 -1
- package/dist/manifests/section-heading.manifest.json +1 -1
- package/dist/manifests/section.manifest.json +1 -1
- package/dist/manifests/segmented-control.manifest.json +1 -1
- package/dist/manifests/select-menu.manifest.json +1 -1
- package/dist/manifests/select.manifest.json +1 -1
- package/dist/manifests/separator.manifest.json +1 -1
- package/dist/manifests/site-footer.manifest.json +1 -1
- package/dist/manifests/site-header.manifest.json +13 -3
- package/dist/manifests/skeleton.manifest.json +1 -1
- package/dist/manifests/spinner.manifest.json +1 -1
- package/dist/manifests/stat-band.manifest.json +1 -1
- package/dist/manifests/stepper.manifest.json +7 -1
- package/dist/manifests/switch.manifest.json +1 -1
- package/dist/manifests/table-card.manifest.json +1 -1
- package/dist/manifests/table-of-contents.manifest.json +1 -1
- package/dist/manifests/table.manifest.json +1 -1
- package/dist/manifests/tabs.manifest.json +1 -1
- package/dist/manifests/testimonial.manifest.json +1 -1
- package/dist/manifests/text.manifest.json +1 -1
- package/dist/manifests/textarea.manifest.json +1 -1
- package/dist/manifests/theme-toggle.manifest.json +1 -1
- package/dist/manifests/time-picker.manifest.json +1 -1
- package/dist/manifests/timeline.manifest.json +1 -1
- package/dist/manifests/toast.manifest.json +1 -1
- package/dist/manifests/tombstone-card.manifest.json +1 -1
- package/dist/manifests/tooltip.manifest.json +1 -1
- package/dist/src/components/accordion/Accordion.d.ts +17 -1
- package/dist/src/components/accordion/Accordion.js +5 -1
- package/dist/src/components/accordion/Accordion.js.map +1 -1
- package/dist/src/components/accordion/Accordion.mjs +5 -1
- package/dist/src/components/accordion/Accordion.mjs.map +1 -1
- package/dist/src/components/alert/Alert.js +1 -1
- package/dist/src/components/alert/Alert.js.map +1 -1
- package/dist/src/components/alert/Alert.mjs +1 -1
- package/dist/src/components/alert/Alert.mjs.map +1 -1
- package/dist/src/components/app-shell/AppShell.js +1 -1
- package/dist/src/components/app-shell/AppShell.js.map +1 -1
- package/dist/src/components/app-shell/AppShell.mjs +1 -1
- package/dist/src/components/app-shell/AppShell.mjs.map +1 -1
- package/dist/src/components/article-card/ArticleCard.js +2 -2
- package/dist/src/components/article-card/ArticleCard.js.map +1 -1
- package/dist/src/components/article-card/ArticleCard.mjs +2 -2
- package/dist/src/components/article-card/ArticleCard.mjs.map +1 -1
- package/dist/src/components/auth-layout/AuthLayout.d.ts +14 -2
- package/dist/src/components/auth-layout/AuthLayout.js +10 -2
- package/dist/src/components/auth-layout/AuthLayout.js.map +1 -1
- package/dist/src/components/auth-layout/AuthLayout.mjs +10 -2
- package/dist/src/components/auth-layout/AuthLayout.mjs.map +1 -1
- package/dist/src/components/badge/Badge.d.ts +2 -0
- package/dist/src/components/badge/Badge.js +9 -3
- package/dist/src/components/badge/Badge.js.map +1 -1
- package/dist/src/components/badge/Badge.mjs +9 -3
- package/dist/src/components/badge/Badge.mjs.map +1 -1
- package/dist/src/components/bottom-nav/BottomNav.d.ts +36 -0
- package/dist/src/components/bottom-nav/BottomNav.js +90 -0
- package/dist/src/components/bottom-nav/BottomNav.js.map +1 -0
- package/dist/src/components/bottom-nav/BottomNav.mjs +66 -0
- package/dist/src/components/bottom-nav/BottomNav.mjs.map +1 -0
- package/dist/src/components/bottom-nav/index.d.ts +1 -0
- package/dist/src/components/bottom-nav/index.js +23 -0
- package/dist/src/components/bottom-nav/index.js.map +1 -0
- package/dist/src/components/bottom-nav/index.mjs +2 -0
- package/dist/src/components/bottom-nav/index.mjs.map +1 -0
- package/dist/src/components/calendar/Calendar.d.ts +34 -0
- package/dist/src/components/calendar/Calendar.js +233 -0
- package/dist/src/components/calendar/Calendar.js.map +1 -0
- package/dist/src/components/calendar/Calendar.mjs +208 -0
- package/dist/src/components/calendar/Calendar.mjs.map +1 -0
- package/dist/src/components/calendar/index.d.ts +1 -0
- package/dist/src/components/calendar/index.js +23 -0
- package/dist/src/components/calendar/index.js.map +1 -0
- package/dist/src/components/calendar/index.mjs +2 -0
- package/dist/src/components/calendar/index.mjs.map +1 -0
- package/dist/src/components/comparison-table/ComparisonTable.js +1 -1
- package/dist/src/components/comparison-table/ComparisonTable.js.map +1 -1
- package/dist/src/components/comparison-table/ComparisonTable.mjs +1 -1
- package/dist/src/components/comparison-table/ComparisonTable.mjs.map +1 -1
- package/dist/src/components/cta-section/CTASection.js +1 -1
- package/dist/src/components/cta-section/CTASection.js.map +1 -1
- package/dist/src/components/cta-section/CTASection.mjs +1 -1
- package/dist/src/components/cta-section/CTASection.mjs.map +1 -1
- package/dist/src/components/data-table/DataTable.d.ts +3 -1
- package/dist/src/components/data-table/DataTable.js +2 -4
- package/dist/src/components/data-table/DataTable.js.map +1 -1
- package/dist/src/components/data-table/DataTable.mjs +2 -4
- package/dist/src/components/data-table/DataTable.mjs.map +1 -1
- package/dist/src/components/date-picker-popover/DatePickerPopover.d.ts +33 -0
- package/dist/src/components/date-picker-popover/DatePickerPopover.js +117 -0
- package/dist/src/components/date-picker-popover/DatePickerPopover.js.map +1 -0
- package/dist/src/components/date-picker-popover/DatePickerPopover.mjs +83 -0
- package/dist/src/components/date-picker-popover/DatePickerPopover.mjs.map +1 -0
- package/dist/src/components/date-picker-popover/index.d.ts +1 -0
- package/dist/src/components/date-picker-popover/index.js +23 -0
- package/dist/src/components/date-picker-popover/index.js.map +1 -0
- package/dist/src/components/date-picker-popover/index.mjs +2 -0
- package/dist/src/components/date-picker-popover/index.mjs.map +1 -0
- package/dist/src/components/drawer/Drawer.d.ts +25 -2
- package/dist/src/components/drawer/Drawer.js +97 -6
- package/dist/src/components/drawer/Drawer.js.map +1 -1
- package/dist/src/components/drawer/Drawer.mjs +97 -6
- package/dist/src/components/drawer/Drawer.mjs.map +1 -1
- package/dist/src/components/empty-state/EmptyState.d.ts +13 -4
- package/dist/src/components/empty-state/EmptyState.js +13 -1
- package/dist/src/components/empty-state/EmptyState.js.map +1 -1
- package/dist/src/components/empty-state/EmptyState.mjs +13 -1
- package/dist/src/components/empty-state/EmptyState.mjs.map +1 -1
- package/dist/src/components/image/Image.d.ts +34 -0
- package/dist/src/components/image/Image.js +75 -0
- package/dist/src/components/image/Image.js.map +1 -0
- package/dist/src/components/image/Image.mjs +41 -0
- package/dist/src/components/image/Image.mjs.map +1 -0
- package/dist/src/components/image/index.d.ts +1 -0
- package/dist/src/components/image/index.js +29 -0
- package/dist/src/components/image/index.js.map +1 -0
- package/dist/src/components/image/index.mjs +5 -0
- package/dist/src/components/image/index.mjs.map +1 -0
- package/dist/src/components/link/Link.js +4 -4
- package/dist/src/components/link/Link.js.map +1 -1
- package/dist/src/components/link/Link.mjs +4 -4
- package/dist/src/components/link/Link.mjs.map +1 -1
- package/dist/src/components/metric-card/MetricCard.d.ts +23 -4
- package/dist/src/components/metric-card/MetricCard.js +32 -5
- package/dist/src/components/metric-card/MetricCard.js.map +1 -1
- package/dist/src/components/metric-card/MetricCard.mjs +32 -5
- package/dist/src/components/metric-card/MetricCard.mjs.map +1 -1
- package/dist/src/components/page-header/PageHeader.d.ts +4 -0
- package/dist/src/components/page-header/PageHeader.js +4 -3
- package/dist/src/components/page-header/PageHeader.js.map +1 -1
- package/dist/src/components/page-header/PageHeader.mjs +4 -3
- package/dist/src/components/page-header/PageHeader.mjs.map +1 -1
- package/dist/src/components/popover/Popover.d.ts +36 -3
- package/dist/src/components/popover/Popover.js +118 -22
- package/dist/src/components/popover/Popover.js.map +1 -1
- package/dist/src/components/popover/Popover.mjs +117 -22
- package/dist/src/components/popover/Popover.mjs.map +1 -1
- package/dist/src/components/section-heading/SectionHeading.js +1 -1
- package/dist/src/components/section-heading/SectionHeading.js.map +1 -1
- package/dist/src/components/section-heading/SectionHeading.mjs +1 -1
- package/dist/src/components/section-heading/SectionHeading.mjs.map +1 -1
- package/dist/src/components/separator/Separator.d.ts +3 -3
- package/dist/src/components/site-header/SiteHeader.d.ts +25 -3
- package/dist/src/components/site-header/SiteHeader.js +141 -6
- package/dist/src/components/site-header/SiteHeader.js.map +1 -1
- package/dist/src/components/site-header/SiteHeader.mjs +141 -6
- package/dist/src/components/site-header/SiteHeader.mjs.map +1 -1
- package/dist/src/components/stepper/Stepper.d.ts +18 -0
- package/dist/src/components/stepper/Stepper.js +2 -1
- package/dist/src/components/stepper/Stepper.js.map +1 -1
- package/dist/src/components/stepper/Stepper.mjs +2 -1
- package/dist/src/components/stepper/Stepper.mjs.map +1 -1
- package/dist/src/index.d.ts +4 -0
- package/dist/src/utils/date.d.ts +32 -0
- package/dist/src/utils/date.js +171 -0
- package/dist/src/utils/date.js.map +1 -0
- package/dist/src/utils/date.mjs +134 -0
- package/dist/src/utils/date.mjs.map +1 -0
- package/dist/src/utils/position.d.ts +42 -0
- package/dist/src/utils/position.js +91 -0
- package/dist/src/utils/position.js.map +1 -0
- package/dist/src/utils/position.mjs +67 -0
- package/dist/src/utils/position.mjs.map +1 -0
- package/dist/styles-full.css +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/src/components/accordion/Accordion.test.tsx +31 -0
- package/src/components/accordion/Accordion.tsx +27 -2
- package/src/components/alert/Alert.tsx +1 -1
- package/src/components/app-shell/AppShell.tsx +1 -1
- package/src/components/article-card/ArticleCard.tsx +2 -2
- package/src/components/auth-layout/AuthLayout.test.tsx +36 -0
- package/src/components/auth-layout/AuthLayout.tsx +20 -3
- package/src/components/badge/Badge.test.tsx +7 -0
- package/src/components/badge/Badge.tsx +8 -2
- package/src/components/bottom-nav/BottomNav.test.tsx +48 -0
- package/src/components/bottom-nav/BottomNav.tsx +117 -0
- package/src/components/bottom-nav/index.ts +1 -0
- package/src/components/calendar/Calendar.test.tsx +277 -0
- package/src/components/calendar/Calendar.tsx +273 -0
- package/src/components/calendar/index.ts +1 -0
- package/src/components/comparison-table/ComparisonTable.tsx +1 -1
- package/src/components/cta-section/CTASection.tsx +1 -1
- package/src/components/data-table/DataTable.test.tsx +21 -0
- package/src/components/data-table/DataTable.tsx +4 -1
- package/src/components/date-picker-popover/DatePickerPopover.test.tsx +223 -0
- package/src/components/date-picker-popover/DatePickerPopover.tsx +117 -0
- package/src/components/date-picker-popover/index.ts +1 -0
- package/src/components/drawer/Drawer.test.tsx +86 -1
- package/src/components/drawer/Drawer.tsx +135 -7
- package/src/components/empty-state/EmptyState.test.tsx +26 -1
- package/src/components/empty-state/EmptyState.tsx +40 -3
- package/src/components/image/Image.test.tsx +94 -0
- package/src/components/image/Image.tsx +71 -0
- package/src/components/image/index.ts +1 -0
- package/src/components/link/Link.test.tsx +2 -1
- package/src/components/link/Link.tsx +4 -4
- package/src/components/metric-card/MetricCard.test.tsx +32 -0
- package/src/components/metric-card/MetricCard.tsx +45 -7
- package/src/components/page-header/PageHeader.test.tsx +13 -0
- package/src/components/page-header/PageHeader.tsx +6 -3
- package/src/components/popover/Popover.test.tsx +307 -3
- package/src/components/popover/Popover.tsx +228 -91
- package/src/components/section-heading/SectionHeading.tsx +1 -1
- package/src/components/site-header/SiteHeader.test.tsx +103 -1
- package/src/components/site-header/SiteHeader.tsx +220 -16
- package/src/components/stepper/Stepper.test.tsx +12 -0
- package/src/components/stepper/Stepper.tsx +15 -1
- package/src/index.ts +4 -0
- package/src/manifests/accordion.manifest.json +8 -2
- package/src/manifests/alert.manifest.json +1 -1
- package/src/manifests/announcement-bar.manifest.json +1 -1
- package/src/manifests/app-shell.manifest.json +1 -1
- package/src/manifests/applied-filters.manifest.json +1 -1
- package/src/manifests/article-card.manifest.json +1 -1
- package/src/manifests/auth-layout.manifest.json +19 -1
- package/src/manifests/autocomplete.manifest.json +1 -1
- package/src/manifests/avatar.manifest.json +1 -1
- package/src/manifests/badge.manifest.json +13 -1
- package/src/manifests/block.manifest.json +1 -1
- package/src/manifests/bottom-nav.manifest.json +130 -0
- package/src/manifests/breadcrumb.manifest.json +1 -1
- package/src/manifests/button-group.manifest.json +1 -1
- package/src/manifests/button.manifest.json +1 -1
- package/src/manifests/calendar.manifest.json +175 -0
- package/src/manifests/card.manifest.json +1 -1
- package/src/manifests/checkbox.manifest.json +1 -1
- package/src/manifests/comparison-table.manifest.json +1 -1
- package/src/manifests/confirm-dialog.manifest.json +1 -1
- package/src/manifests/contact-strip.manifest.json +1 -1
- package/src/manifests/container.manifest.json +1 -1
- package/src/manifests/cta-section.manifest.json +1 -1
- package/src/manifests/data-table.manifest.json +8 -1
- package/src/manifests/date-picker-popover.manifest.json +202 -0
- package/src/manifests/date-picker.manifest.json +1 -1
- package/src/manifests/date-range-picker.manifest.json +1 -1
- package/src/manifests/deal-card.manifest.json +1 -1
- package/src/manifests/dialog.manifest.json +1 -1
- package/src/manifests/document-card.manifest.json +1 -1
- package/src/manifests/drawer.manifest.json +48 -2
- package/src/manifests/empty-state.manifest.json +1 -1
- package/src/manifests/entity-card.manifest.json +1 -1
- package/src/manifests/feature-grid.manifest.json +1 -1
- package/src/manifests/feature-row.manifest.json +1 -1
- package/src/manifests/fieldset.manifest.json +1 -1
- package/src/manifests/file-upload.manifest.json +1 -1
- package/src/manifests/filter-bar.manifest.json +1 -1
- package/src/manifests/filter-chips.manifest.json +1 -1
- package/src/manifests/filter-panel.manifest.json +1 -1
- package/src/manifests/flex.manifest.json +1 -1
- package/src/manifests/form-field.manifest.json +1 -1
- package/src/manifests/form-layout.manifest.json +1 -1
- package/src/manifests/form.manifest.json +1 -1
- package/src/manifests/grid.manifest.json +1 -1
- package/src/manifests/heading.manifest.json +1 -1
- package/src/manifests/hero.manifest.json +1 -1
- package/src/manifests/image.manifest.json +142 -0
- package/src/manifests/input-group.manifest.json +1 -1
- package/src/manifests/input.manifest.json +1 -1
- package/src/manifests/label.manifest.json +1 -1
- package/src/manifests/link-tabs.manifest.json +1 -1
- package/src/manifests/link.manifest.json +1 -1
- package/src/manifests/list.manifest.json +1 -1
- package/src/manifests/load-more.manifest.json +1 -1
- package/src/manifests/logo-cloud.manifest.json +1 -1
- package/src/manifests/menu.manifest.json +1 -1
- package/src/manifests/metric-card.manifest.json +36 -4
- package/src/manifests/multi-select.manifest.json +1 -1
- package/src/manifests/newsletter.manifest.json +1 -1
- package/src/manifests/page-header.manifest.json +7 -1
- package/src/manifests/pagination.manifest.json +1 -1
- package/src/manifests/password-input.manifest.json +1 -1
- package/src/manifests/popover.manifest.json +86 -4
- package/src/manifests/process-steps.manifest.json +1 -1
- package/src/manifests/progress.manifest.json +1 -1
- package/src/manifests/prose.manifest.json +1 -1
- package/src/manifests/radio.manifest.json +1 -1
- package/src/manifests/range-slider.manifest.json +1 -1
- package/src/manifests/search.manifest.json +1 -1
- package/src/manifests/section-heading.manifest.json +1 -1
- package/src/manifests/section.manifest.json +1 -1
- package/src/manifests/segmented-control.manifest.json +1 -1
- package/src/manifests/select-menu.manifest.json +1 -1
- package/src/manifests/select.manifest.json +1 -1
- package/src/manifests/separator.manifest.json +1 -1
- package/src/manifests/site-footer.manifest.json +1 -1
- package/src/manifests/site-header.manifest.json +13 -3
- package/src/manifests/skeleton.manifest.json +1 -1
- package/src/manifests/spinner.manifest.json +1 -1
- package/src/manifests/stat-band.manifest.json +1 -1
- package/src/manifests/stepper.manifest.json +7 -1
- package/src/manifests/switch.manifest.json +1 -1
- package/src/manifests/table-card.manifest.json +1 -1
- package/src/manifests/table-of-contents.manifest.json +1 -1
- package/src/manifests/table.manifest.json +1 -1
- package/src/manifests/tabs.manifest.json +1 -1
- package/src/manifests/testimonial.manifest.json +1 -1
- package/src/manifests/text.manifest.json +1 -1
- package/src/manifests/textarea.manifest.json +1 -1
- package/src/manifests/theme-toggle.manifest.json +1 -1
- package/src/manifests/time-picker.manifest.json +1 -1
- package/src/manifests/timeline.manifest.json +1 -1
- package/src/manifests/toast.manifest.json +1 -1
- package/src/manifests/tombstone-card.manifest.json +1 -1
- package/src/manifests/tooltip.manifest.json +1 -1
- package/src/utils/date.test.ts +190 -0
- package/src/utils/date.ts +162 -0
- package/src/utils/position.test.ts +227 -0
- package/src/utils/position.ts +129 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/drawer/Drawer.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport { cn } from '../../utils/cn';\nimport { usePresence } from '../../utils/presence';\nimport { useModalLayer } from '../../utils/modal-layer';\n\nexport type DrawerSide = 'left' | 'right' | 'top' | 'bottom';\nexport type DrawerSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\nexport type DrawerProps = {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title: string;\n description?: string;\n children?: React.ReactNode;\n /** Edge the drawer slides from (default 'right'). */\n side?: DrawerSide;\n /** Preset extent along the side axis (width for left/right, height for top/bottom). */\n size?: DrawerSize;\n /**\n * Custom extent for left/right drawers: pixels (480) or any CSS length\n * (\"70vw\"). Overrides `size`.\n */\n width?: number | string;\n /**\n * Custom extent for top/bottom drawers: pixels (320) or any CSS length\n * (\"60vh\"). Overrides `size`.\n */\n height?: number | string;\n /** Clicking the backdrop closes (default true). */\n closeOnBackdrop?: boolean;\n /** Hide the close (✕) button in the header (default true). */\n showClose?: boolean;\n /** Accessible label for the close button (default \"Close drawer\"). */\n closeLabel?: string;\n /** Focused when the drawer opens; defaults to the first focusable element. */\n initialFocusRef?: React.RefObject<HTMLElement | null>;\n /** Overrides the accessible name (defaults to the title). */\n ariaLabel?: string;\n /**\n * Slide the panel in from its edge and out on close (requires the\n * tailwindcss-animate plugin). Off by default; reduced-motion users\n * get animate-none automatically.\n */\n animate?: boolean;\n};\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nconst sideClasses: Record<DrawerSide, string> = {\n right: 'inset-y-0 right-0 border-l',\n left: 'inset-y-0 left-0 border-r',\n top: 'inset-x-0 top-0 border-b',\n bottom: 'inset-x-0 bottom-0 border-t',\n};\n\nconst sideWidths: Record<DrawerSize, string> = {\n sm: 'w-72',\n md: 'w-96',\n lg: 'w-[32rem]',\n xl: 'w-[40rem]',\n '2xl': 'w-[48rem]',\n};\n\nconst sideHeights: Record<DrawerSize, string> = {\n sm: 'h-48',\n md: 'h-80',\n lg: 'h-[32rem]',\n xl: 'h-[40rem]',\n '2xl': 'h-[48rem]',\n};\n\nconst sizeClasses: Record<DrawerSide, Record<DrawerSize, string>> = {\n right: sideWidths,\n left: sideWidths,\n top: sideHeights,\n bottom: sideHeights,\n};\n\n/** Custom extent wins over the preset; numbers are pixels. */\nfunction extentStyle(value: number | string | undefined): string | undefined {\n if (value === undefined) return undefined;\n return typeof value === 'number' ? `${value}px` : value;\n}\n\n// Literal class maps so Tailwind's scanner keeps every slide utility.\nconst slideIn: Record<DrawerSide, string> = {\n right: 'slide-in-from-right',\n left: 'slide-in-from-left',\n top: 'slide-in-from-top',\n bottom: 'slide-in-from-bottom',\n};\nconst slideOut: Record<DrawerSide, string> = {\n right: 'slide-out-to-right',\n left: 'slide-out-to-left',\n top: 'slide-out-to-top',\n bottom: 'slide-out-to-bottom',\n};\n\n/**\n * Edge sheet for secondary flows (filters, detail panes, mobile nav).\n * Modal semantics identical to Dialog: portal, aria-modal + labelled by\n * title, Escape and backdrop dismissal, focus move + Tab trap + focus\n * restoration on close. Renders fixed to the chosen edge with a border\n * against the backdrop.\n */\nexport function Drawer({\n open,\n onOpenChange,\n title,\n description,\n children,\n side = 'right',\n size = 'md',\n width,\n height,\n closeOnBackdrop = true,\n showClose = true,\n closeLabel = 'Close drawer',\n initialFocusRef,\n ariaLabel,\n animate = false,\n}: DrawerProps) {\n const drawerRef = React.useRef<HTMLDivElement | null>(null);\n const previouslyFocused = React.useRef<HTMLElement | null>(null);\n const titleId = React.useId();\n const descriptionId = React.useId();\n const { present, exiting } = usePresence(open, animate);\n const isTopLayer = useModalLayer(open);\n\n // Capture the opener before the panel takes focus; restore the moment\n // open flips false — even while an exit animation keeps the DOM up.\n React.useEffect(() => {\n if (open) {\n previouslyFocused.current = document.activeElement as HTMLElement | null;\n return;\n }\n previouslyFocused.current?.focus?.();\n previouslyFocused.current = null;\n }, [open]);\n\n // Move focus in once the panel is actually mounted (present can lag\n // open by a render when the presence gate starts closed).\n React.useEffect(() => {\n if (!open || !present) return;\n const node = drawerRef.current;\n const target =\n initialFocusRef?.current ?? node?.querySelector<HTMLElement>(FOCUSABLE) ?? node;\n target?.focus();\n }, [open, present, initialFocusRef]);\n\n React.useEffect(() => {\n if (!open) return;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n if (!isTopLayer()) return;\n event.stopPropagation();\n onOpenChange(false);\n return;\n }\n if (event.key !== 'Tab') return;\n const node = drawerRef.current;\n if (!node) return;\n const focusable = Array.from(node.querySelectorAll<HTMLElement>(FOCUSABLE));\n if (focusable.length === 0) {\n event.preventDefault();\n return;\n }\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n const active = document.activeElement;\n if (event.shiftKey && (active === first || !node.contains(active))) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first.focus();\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [open, onOpenChange, isTopLayer]);\n\n if (!present || typeof document === 'undefined') return null;\n\n const isVerticalSide = side === 'top' || side === 'bottom';\n const customExtent = isVerticalSide ? extentStyle(height) : extentStyle(width);\n\n const motion = animate\n ? cn(\n 'duration-200 motion-reduce:animate-none',\n exiting ? `animate-out ${slideOut[side]}` : `animate-in ${slideIn[side]}`,\n )\n : undefined;\n\n return createPortal(\n <div\n className=\"fixed inset-0 z-50\"\n onMouseDown={(event) => {\n if (closeOnBackdrop && event.target === event.currentTarget) onOpenChange(false);\n }}\n >\n <div\n ref={drawerRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={ariaLabel ?? title}\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={description ? descriptionId : undefined}\n tabIndex={-1}\n className={cn(\n 'fixed flex flex-col bg-background shadow-xl border-border',\n sideClasses[side],\n sizeClasses[side][size],\n motion\n )}\n style={customExtent ? { [isVerticalSide ? 'height' : 'width']: customExtent } : undefined}\n >\n <div className=\"flex items-start justify-between gap-4 border-b border-border px-5 py-4\">\n <div>\n <h2 id={titleId} className=\"text-base font-semibold leading-tight\">\n {title}\n </h2>\n {description && (\n <p id={descriptionId} className=\"mt-1 text-sm text-muted-foreground\">\n {description}\n </p>\n )}\n </div>\n {showClose && (\n <button\n type=\"button\"\n onClick={() => onOpenChange(false)}\n aria-label={closeLabel}\n className=\"-me-1 rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n ✕\n </button>\n )}\n </div>\n <div className=\"flex-1 overflow-y-auto px-5 py-4\">{children}</div>\n </div>\n </div>,\n document.body\n );\n}\n"],"mappings":";AA8NU,SACE,KADF;AA5NV,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AA2C9B,MAAM,YACJ;AAEF,MAAM,cAA0C;AAAA,EAC9C,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AACV;AAEA,MAAM,aAAyC;AAAA,EAC7C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT;AAEA,MAAM,cAA0C;AAAA,EAC9C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT;AAEA,MAAM,cAA8D;AAAA,EAClE,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AACV;AAGA,SAAS,YAAY,OAAwD;AAC3E,MAAI,UAAU,OAAW,QAAO;AAChC,SAAO,OAAO,UAAU,WAAW,GAAG,KAAK,OAAO;AACpD;AAGA,MAAM,UAAsC;AAAA,EAC1C,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AACV;AACA,MAAM,WAAuC;AAAA,EAC3C,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AACV;AASO,SAAS,OAAO;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,OAAO;AAAA,EACP;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BACH;AAAA,kBACC,eACC,oBAAC,OAAE,IAAI,eAAe,WAAU,sCAC7B,uBACH;AAAA,mBAEJ;AAAA,gBACC,aACC;AAAA,kBAAC;AAAA;AAAA,oBACC,MAAK;AAAA,oBACL,SAAS,MAAM,aAAa,KAAK;AAAA,oBACjC,cAAY;AAAA,oBACZ,WAAU;AAAA,oBACX;AAAA;AAAA,gBAED;AAAA,iBAEJ;AAAA,cACA,oBAAC,SAAI,WAAU,oCAAoC,UAAS;AAAA;AAAA;AAAA,QAC9D;AAAA;AAAA,IACF;AAAA,IACA,SAAS;AAAA,EACX;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/drawer/Drawer.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport { cn } from '../../utils/cn';\nimport { usePresence } from '../../utils/presence';\nimport { useModalLayer } from '../../utils/modal-layer';\n\nexport type DrawerSide = 'left' | 'right' | 'top' | 'bottom';\nexport type DrawerSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\nexport type DrawerProps = {\n open: boolean;\n /** Called with the next open state. Alias: onClose (close requests only). */\n onOpenChange?: (open: boolean) => void;\n /**\n * Called when the drawer asks to close: Escape, backdrop click or the close\n * button. Alias for `onOpenChange(false)`, used when only a close handler is\n * passed.\n */\n onClose?: () => void;\n title: string;\n description?: string;\n children?: React.ReactNode;\n /** Edge the drawer slides from (default 'right'). */\n side?: DrawerSide;\n /** Preset extent along the side axis (width for left/right, height for top/bottom). */\n size?: DrawerSize;\n /**\n * Custom extent for left/right drawers: pixels (480) or any CSS length\n * (\"70vw\"). Overrides `size`.\n */\n width?: number | string;\n /**\n * Custom extent for top/bottom drawers: pixels (320) or any CSS length\n * (\"60vh\"). Overrides `size`.\n */\n height?: number | string;\n /**\n * Drag the inner edge to resize a left/right drawer. Keyboard: Arrow keys\n * nudge 16px, Shift+Arrow 64px, Home/End jump to the bounds. Ignored for\n * top/bottom drawers.\n */\n resizable?: boolean;\n /** Lower bound in pixels while resizable (default 240). */\n minWidth?: number;\n /** Upper bound in pixels while resizable (default 960). */\n maxWidth?: number;\n /** Initial width in pixels while resizable; defaults to the `size` preset. */\n defaultWidth?: number;\n /** Fired with the next width in pixels when a resize commits. */\n onWidthChange?: (width: number) => void;\n /** Accessible label for the resize handle (default \"Resize drawer\"). */\n resizeLabel?: string;\n /** Clicking the backdrop closes (default true). */\n closeOnBackdrop?: boolean;\n /** Hide the close (✕) button in the header (default true). */\n showClose?: boolean;\n /** Accessible label for the close button (default \"Close drawer\"). */\n closeLabel?: string;\n /** Focused when the drawer opens; defaults to the first focusable element. */\n initialFocusRef?: React.RefObject<HTMLElement | null>;\n /** Overrides the accessible name (defaults to the title). */\n ariaLabel?: string;\n /**\n * Slide the panel in from its edge and out on close (requires the\n * tailwindcss-animate plugin). Off by default; reduced-motion users\n * get animate-none automatically.\n */\n animate?: boolean;\n};\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nconst sideClasses: Record<DrawerSide, string> = {\n right: 'inset-y-0 right-0 border-l',\n left: 'inset-y-0 left-0 border-r',\n top: 'inset-x-0 top-0 border-b',\n bottom: 'inset-x-0 bottom-0 border-t',\n};\n\nconst sideWidths: Record<DrawerSize, string> = {\n sm: 'w-72',\n md: 'w-96',\n lg: 'w-[32rem]',\n xl: 'w-[40rem]',\n '2xl': 'w-[48rem]',\n};\n\nconst sideHeights: Record<DrawerSize, string> = {\n sm: 'h-48',\n md: 'h-80',\n lg: 'h-[32rem]',\n xl: 'h-[40rem]',\n '2xl': 'h-[48rem]',\n};\n\nconst sizeClasses: Record<DrawerSide, Record<DrawerSize, string>> = {\n right: sideWidths,\n left: sideWidths,\n top: sideHeights,\n bottom: sideHeights,\n};\n\n/** Pixel equivalents of the width presets, used as the resize starting point. */\nconst sizePx: Record<DrawerSize, number> = {\n sm: 288,\n md: 384,\n lg: 512,\n xl: 640,\n '2xl': 768,\n};\n\n/** Custom extent wins over the preset; numbers are pixels. */\nfunction extentStyle(value: number | string | undefined): string | undefined {\n if (value === undefined) return undefined;\n return typeof value === 'number' ? `${value}px` : value;\n}\n\n// Literal class maps so Tailwind's scanner keeps every slide utility.\nconst slideIn: Record<DrawerSide, string> = {\n right: 'slide-in-from-right',\n left: 'slide-in-from-left',\n top: 'slide-in-from-top',\n bottom: 'slide-in-from-bottom',\n};\nconst slideOut: Record<DrawerSide, string> = {\n right: 'slide-out-to-right',\n left: 'slide-out-to-left',\n top: 'slide-out-to-top',\n bottom: 'slide-out-to-bottom',\n};\n\n/**\n * Edge sheet for secondary flows (filters, detail panes, mobile nav).\n * Modal semantics identical to Dialog: portal, aria-modal + labelled by\n * title, Escape and backdrop dismissal, focus move + Tab trap + focus\n * restoration on close. Renders fixed to the chosen edge with a border\n * against the backdrop.\n */\nexport function Drawer({\n open,\n onOpenChange,\n onClose,\n title,\n description,\n children,\n side = 'right',\n size = 'md',\n width,\n height,\n resizable = false,\n minWidth = 240,\n maxWidth = 960,\n defaultWidth,\n onWidthChange,\n resizeLabel = 'Resize drawer',\n closeOnBackdrop = true,\n showClose = true,\n closeLabel = 'Close drawer',\n initialFocusRef,\n ariaLabel,\n animate = false,\n}: DrawerProps) {\n const drawerRef = React.useRef<HTMLDivElement | null>(null);\n const previouslyFocused = React.useRef<HTMLElement | null>(null);\n const titleId = React.useId();\n const descriptionId = React.useId();\n const { present, exiting } = usePresence(open, animate);\n const isTopLayer = useModalLayer(open);\n\n // Prefer onOpenChange; fall back to the onClose alias so a migration code\n // path that only passes onClose still dismisses without double-firing.\n const requestClose = React.useCallback(() => {\n if (onOpenChange) onOpenChange(false);\n else onClose?.();\n }, [onOpenChange, onClose]);\n\n // Resizable left/right drawers. Width is state-local so dragging stays\n // smooth; `onWidthChange` fires once a drag commits or a key is pressed.\n const isVerticalSide = side === 'top' || side === 'bottom';\n const canResize = resizable && !isVerticalSide;\n const clampWidth = React.useCallback(\n (next: number) => Math.min(maxWidth, Math.max(minWidth, Math.round(next))),\n [minWidth, maxWidth]\n );\n const [resizedWidth, setResizedWidth] = React.useState<number | null>(null);\n const initialWidth = clampWidth(\n defaultWidth ?? (typeof width === 'number' ? width : sizePx[size])\n );\n const resizeWidth = resizedWidth ?? initialWidth;\n const widthRef = React.useRef(resizeWidth);\n widthRef.current = resizeWidth;\n const onWidthChangeRef = React.useRef(onWidthChange);\n onWidthChangeRef.current = onWidthChange;\n\n const commitWidth = (next: number) => {\n const clamped = clampWidth(next);\n setResizedWidth(clamped);\n onWidthChangeRef.current?.(clamped);\n };\n\n const onResizePointerDown = (event: React.PointerEvent<HTMLDivElement>) => {\n if (event.button !== 0) return;\n event.preventDefault();\n const startX = event.clientX;\n const startWidth = resizeWidth;\n const onMove = (moveEvent: PointerEvent) => {\n const delta = side === 'right' ? startX - moveEvent.clientX : moveEvent.clientX - startX;\n setResizedWidth(clampWidth(startWidth + delta));\n };\n const onUp = () => {\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n onWidthChangeRef.current?.(widthRef.current);\n };\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', onUp);\n };\n\n const onResizeKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const step = event.shiftKey ? 64 : 16;\n const grow = side === 'right' ? 'ArrowLeft' : 'ArrowRight';\n const shrink = side === 'right' ? 'ArrowRight' : 'ArrowLeft';\n if (event.key === grow) {\n event.preventDefault();\n commitWidth(resizeWidth + step);\n } else if (event.key === shrink) {\n event.preventDefault();\n commitWidth(resizeWidth - step);\n } else if (event.key === 'Home') {\n event.preventDefault();\n commitWidth(minWidth);\n } else if (event.key === 'End') {\n event.preventDefault();\n commitWidth(maxWidth);\n }\n };\n\n // Capture the opener before the panel takes focus; restore the moment\n // open flips false — even while an exit animation keeps the DOM up.\n React.useEffect(() => {\n if (open) {\n previouslyFocused.current = document.activeElement as HTMLElement | null;\n return;\n }\n previouslyFocused.current?.focus?.();\n previouslyFocused.current = null;\n }, [open]);\n\n // Move focus in once the panel is actually mounted (present can lag\n // open by a render when the presence gate starts closed).\n React.useEffect(() => {\n if (!open || !present) return;\n const node = drawerRef.current;\n const target =\n initialFocusRef?.current ?? node?.querySelector<HTMLElement>(FOCUSABLE) ?? node;\n target?.focus();\n }, [open, present, initialFocusRef]);\n\n React.useEffect(() => {\n if (!open) return;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n if (!isTopLayer()) return;\n event.stopPropagation();\n requestClose();\n return;\n }\n if (event.key !== 'Tab') return;\n const node = drawerRef.current;\n if (!node) return;\n const focusable = Array.from(node.querySelectorAll<HTMLElement>(FOCUSABLE));\n if (focusable.length === 0) {\n event.preventDefault();\n return;\n }\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n const active = document.activeElement;\n if (event.shiftKey && (active === first || !node.contains(active))) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first.focus();\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [open, requestClose, isTopLayer]);\n\n if (!present || typeof document === 'undefined') return null;\n\n const customExtent = canResize\n ? `${resizeWidth}px`\n : isVerticalSide\n ? extentStyle(height)\n : extentStyle(width);\n\n const motion = animate\n ? cn(\n 'duration-200 motion-reduce:animate-none',\n exiting ? `animate-out ${slideOut[side]}` : `animate-in ${slideIn[side]}`,\n )\n : undefined;\n\n return createPortal(\n <div\n className=\"fixed inset-0 z-50\"\n onMouseDown={(event) => {\n if (closeOnBackdrop && event.target === event.currentTarget) requestClose();\n }}\n >\n <div\n ref={drawerRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={ariaLabel ?? title}\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={description ? descriptionId : undefined}\n tabIndex={-1}\n className={cn(\n 'fixed flex flex-col bg-background shadow-xl border-border',\n sideClasses[side],\n sizeClasses[side][size],\n motion\n )}\n style={customExtent ? { [isVerticalSide ? 'height' : 'width']: customExtent } : undefined}\n >\n {canResize && (\n <div\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={resizeLabel}\n aria-valuenow={resizeWidth}\n aria-valuemin={minWidth}\n aria-valuemax={maxWidth}\n tabIndex={0}\n onPointerDown={onResizePointerDown}\n onKeyDown={onResizeKeyDown}\n className={cn(\n 'absolute inset-y-0 z-10 w-2 cursor-col-resize touch-none rounded-sm bg-transparent',\n 'hover:bg-primary/20 focus-visible:bg-primary/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n side === 'right' ? '-left-1' : '-right-1'\n )}\n />\n )}\n <div className=\"flex items-start justify-between gap-4 border-b border-border px-5 py-4\">\n <div>\n <h2 id={titleId} className=\"text-base font-semibold leading-tight\">\n {title}\n </h2>\n {description && (\n <p id={descriptionId} className=\"mt-1 text-sm text-muted-foreground\">\n {description}\n </p>\n )}\n </div>\n {showClose && (\n <button\n type=\"button\"\n onClick={requestClose}\n aria-label={closeLabel}\n className=\"-me-1 rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n ✕\n </button>\n )}\n </div>\n <div className=\"flex-1 overflow-y-auto px-5 py-4\">{children}</div>\n </div>\n </div>,\n document.body\n );\n}\n"],"mappings":";AA4UU,cAkBA,YAlBA;AA1UV,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAkE9B,MAAM,YACJ;AAEF,MAAM,cAA0C;AAAA,EAC9C,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AACV;AAEA,MAAM,aAAyC;AAAA,EAC7C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT;AAEA,MAAM,cAA0C;AAAA,EAC9C,IAAI;AAAA,EACJ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,kBACjB,cAAY;AAAA,kBACZ,iBAAe;AAAA,kBACf,iBAAe;AAAA,kBACf,iBAAe;AAAA,kBACf,UAAU;AAAA,kBACV,eAAe;AAAA,kBACf,WAAW;AAAA,kBACX,WAAW;AAAA,oBACT;AAAA,oBACA;AAAA,oBACA,SAAS,UAAU,YAAY;AAAA,kBACjC;AAAA;AAAA,cACF;AAAA,cAEF,qBAAC,SAAI,WAAU,2EACb;AAAA,qCAAC,SACC;AAAA,sCAAC,QAAG,IAAI,SAAS,WAAU,yCACxB,iBACH;AAAA,kBACC,eACC,oBAAC,OAAE,IAAI,eAAe,WAAU,sCAC7B,uBACH;AAAA,mBAEJ;AAAA,gBACC,aACC;AAAA,kBAAC;AAAA;AAAA,oBACC,MAAK;AAAA,oBACL,SAAS;AAAA,oBACT,cAAY;AAAA,oBACZ,WAAU;AAAA,oBACX;AAAA;AAAA,gBAED;AAAA,iBAEJ;AAAA,cACA,oBAAC,SAAI,WAAU,oCAAoC,UAAS;AAAA;AAAA;AAAA,QAC9D;AAAA;AAAA,IACF;AAAA,IACA,SAAS;AAAA,EACX;AACF;","names":[]}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { type ButtonProps } from '../button/Button';
|
|
3
|
+
/** Object form of `action`: EmptyState renders the button/link for you. */
|
|
4
|
+
export type EmptyStateAction = {
|
|
5
|
+
label: React.ReactNode;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
/** Renders an anchor (styled as a button) instead of a button. */
|
|
8
|
+
href?: string;
|
|
9
|
+
variant?: ButtonProps['variant'];
|
|
10
|
+
};
|
|
2
11
|
export type EmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
3
12
|
/** Icon or illustration shown above the title. */
|
|
4
13
|
icon?: React.ReactNode;
|
|
5
14
|
title: string;
|
|
6
15
|
description?: string;
|
|
7
|
-
/** Primary action
|
|
8
|
-
action?: React.ReactNode;
|
|
16
|
+
/** Primary action: a rendered node, or an action object. */
|
|
17
|
+
action?: React.ReactNode | EmptyStateAction;
|
|
9
18
|
/** Alias for `action` for codebases that pass a list of actions. */
|
|
10
19
|
actions?: React.ReactNode;
|
|
11
20
|
/** Secondary action shown beside the primary one. */
|
|
@@ -25,8 +34,8 @@ export declare const EmptyState: React.ForwardRefExoticComponent<React.HTMLAttri
|
|
|
25
34
|
icon?: React.ReactNode;
|
|
26
35
|
title: string;
|
|
27
36
|
description?: string;
|
|
28
|
-
/** Primary action
|
|
29
|
-
action?: React.ReactNode;
|
|
37
|
+
/** Primary action: a rendered node, or an action object. */
|
|
38
|
+
action?: React.ReactNode | EmptyStateAction;
|
|
30
39
|
/** Alias for `action` for codebases that pass a list of actions. */
|
|
31
40
|
actions?: React.ReactNode;
|
|
32
41
|
/** Secondary action shown beside the primary one. */
|
|
@@ -34,6 +34,18 @@ module.exports = __toCommonJS(EmptyState_exports);
|
|
|
34
34
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
35
|
var React = __toESM(require("react"));
|
|
36
36
|
var import_cn = require("../../utils/cn.js");
|
|
37
|
+
var import_Button = require("../button/Button.js");
|
|
38
|
+
function isActionObject(value) {
|
|
39
|
+
return typeof value === "object" && value !== null && !React.isValidElement(value) && "label" in value;
|
|
40
|
+
}
|
|
41
|
+
function renderAction(action) {
|
|
42
|
+
if (!isActionObject(action)) return action;
|
|
43
|
+
const { label, onClick, href, variant } = action;
|
|
44
|
+
if (href) {
|
|
45
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { variant, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href, children: label }) });
|
|
46
|
+
}
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { variant, onClick, children: label });
|
|
48
|
+
}
|
|
37
49
|
const EmptyState = React.forwardRef(function EmptyState2({
|
|
38
50
|
icon,
|
|
39
51
|
title,
|
|
@@ -47,7 +59,7 @@ const EmptyState = React.forwardRef(function EmptyState2({
|
|
|
47
59
|
children,
|
|
48
60
|
...props
|
|
49
61
|
}, ref) {
|
|
50
|
-
const primaryAction = action ?? actions;
|
|
62
|
+
const primaryAction = renderAction(action) ?? actions;
|
|
51
63
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
52
64
|
"div",
|
|
53
65
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/empty-state/EmptyState.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type EmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Icon or illustration shown above the title. */\n icon?: React.ReactNode;\n title: string;\n description?: string;\n /** Primary action
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/empty-state/EmptyState.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { Button, type ButtonProps } from '../button/Button';\n\n/** Object form of `action`: EmptyState renders the button/link for you. */\nexport type EmptyStateAction = {\n label: React.ReactNode;\n onClick?: () => void;\n /** Renders an anchor (styled as a button) instead of a button. */\n href?: string;\n variant?: ButtonProps['variant'];\n};\n\nexport type EmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Icon or illustration shown above the title. */\n icon?: React.ReactNode;\n title: string;\n description?: string;\n /** Primary action: a rendered node, or an action object. */\n action?: React.ReactNode | EmptyStateAction;\n /** Alias for `action` for codebases that pass a list of actions. */\n actions?: React.ReactNode;\n /** Secondary action shown beside the primary one. */\n secondaryAction?: React.ReactNode;\n /** Heading level for the title. Defaults to a paragraph. */\n titleAs?: 'p' | 'h2' | 'h3' | 'h4';\n /** Compact padding for use inside panels and table bodies. */\n size?: 'sm' | 'md';\n};\n\nfunction isActionObject(value: unknown): value is EmptyStateAction {\n return (\n typeof value === 'object' &&\n value !== null &&\n !React.isValidElement(value) &&\n 'label' in value\n );\n}\n\n/** Normalizes the node and object forms into a single element. */\nfunction renderAction(action: React.ReactNode | EmptyStateAction | undefined): React.ReactNode {\n if (!isActionObject(action)) return action;\n const { label, onClick, href, variant } = action;\n if (href) {\n return (\n <Button variant={variant} asChild>\n <a href={href}>{label}</a>\n </Button>\n );\n }\n return (\n <Button variant={variant} onClick={onClick}>\n {label}\n </Button>\n );\n}\n\n/**\n * Placeholder for empty collections, zero-result searches and unconfigured\n * features. Keeps the title/description/action hierarchy consistent across\n * the product.\n */\nexport const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(function EmptyState(\n {\n icon,\n title,\n description,\n action,\n actions,\n secondaryAction,\n titleAs: Title = 'p',\n size = 'md',\n className,\n children,\n ...props\n },\n ref\n) {\n const primaryAction = renderAction(action) ?? actions;\n return (\n <div\n ref={ref}\n className={cn(\n 'flex flex-col items-center justify-center rounded-lg border border-dashed border-border text-center',\n size === 'md' ? 'gap-3 px-6 py-12' : 'gap-2 px-4 py-6',\n className\n )}\n {...props}\n >\n {icon && <div className=\"text-muted-foreground [&_svg]:size-8\">{icon}</div>}\n <Title className={cn('font-semibold', size === 'md' ? 'text-base' : 'text-sm')}>{title}</Title>\n {description && <p className=\"max-w-sm text-sm text-muted-foreground\">{description}</p>}\n {children}\n {(primaryAction || secondaryAction) && (\n <div className=\"mt-1 flex flex-wrap items-center justify-center gap-2\">\n {primaryAction}\n {secondaryAction}\n </div>\n )}\n </div>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8CQ;AA9CR,YAAuB;AACvB,gBAAmB;AACnB,oBAAyC;AA4BzC,SAAS,eAAe,OAA2C;AACjE,SACE,OAAO,UAAU,YACjB,UAAU,QACV,CAAC,MAAM,eAAe,KAAK,KAC3B,WAAW;AAEf;AAGA,SAAS,aAAa,QAAyE;AAC7F,MAAI,CAAC,eAAe,MAAM,EAAG,QAAO;AACpC,QAAM,EAAE,OAAO,SAAS,MAAM,QAAQ,IAAI;AAC1C,MAAI,MAAM;AACR,WACE,4CAAC,wBAAO,SAAkB,SAAO,MAC/B,sDAAC,OAAE,MAAa,iBAAM,GACxB;AAAA,EAEJ;AACA,SACE,4CAAC,wBAAO,SAAkB,SACvB,iBACH;AAEJ;AAOO,MAAM,aAAa,MAAM,WAA4C,SAASA,YACnF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,QAAQ;AAAA,EACjB,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,gBAAgB,aAAa,MAAM,KAAK;AAC9C,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAW;AAAA,QACT;AAAA,QACA,SAAS,OAAO,qBAAqB;AAAA,QACrC;AAAA,MACF;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,gBAAQ,4CAAC,SAAI,WAAU,wCAAwC,gBAAK;AAAA,QACrE,4CAAC,SAAM,eAAW,cAAG,iBAAiB,SAAS,OAAO,cAAc,SAAS,GAAI,iBAAM;AAAA,QACtF,eAAe,4CAAC,OAAE,WAAU,0CAA0C,uBAAY;AAAA,QAClF;AAAA,SACC,iBAAiB,oBACjB,6CAAC,SAAI,WAAU,yDACZ;AAAA;AAAA,UACA;AAAA,WACH;AAAA;AAAA;AAAA,EAEJ;AAEJ,CAAC;","names":["EmptyState"]}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { cn } from "../../utils/cn.mjs";
|
|
4
|
+
import { Button } from "../button/Button.mjs";
|
|
5
|
+
function isActionObject(value) {
|
|
6
|
+
return typeof value === "object" && value !== null && !React.isValidElement(value) && "label" in value;
|
|
7
|
+
}
|
|
8
|
+
function renderAction(action) {
|
|
9
|
+
if (!isActionObject(action)) return action;
|
|
10
|
+
const { label, onClick, href, variant } = action;
|
|
11
|
+
if (href) {
|
|
12
|
+
return /* @__PURE__ */ jsx(Button, { variant, asChild: true, children: /* @__PURE__ */ jsx("a", { href, children: label }) });
|
|
13
|
+
}
|
|
14
|
+
return /* @__PURE__ */ jsx(Button, { variant, onClick, children: label });
|
|
15
|
+
}
|
|
4
16
|
const EmptyState = React.forwardRef(function EmptyState2({
|
|
5
17
|
icon,
|
|
6
18
|
title,
|
|
@@ -14,7 +26,7 @@ const EmptyState = React.forwardRef(function EmptyState2({
|
|
|
14
26
|
children,
|
|
15
27
|
...props
|
|
16
28
|
}, ref) {
|
|
17
|
-
const primaryAction = action ?? actions;
|
|
29
|
+
const primaryAction = renderAction(action) ?? actions;
|
|
18
30
|
return /* @__PURE__ */ jsxs(
|
|
19
31
|
"div",
|
|
20
32
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/empty-state/EmptyState.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type EmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Icon or illustration shown above the title. */\n icon?: React.ReactNode;\n title: string;\n description?: string;\n /** Primary action
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/empty-state/EmptyState.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { Button, type ButtonProps } from '../button/Button';\n\n/** Object form of `action`: EmptyState renders the button/link for you. */\nexport type EmptyStateAction = {\n label: React.ReactNode;\n onClick?: () => void;\n /** Renders an anchor (styled as a button) instead of a button. */\n href?: string;\n variant?: ButtonProps['variant'];\n};\n\nexport type EmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Icon or illustration shown above the title. */\n icon?: React.ReactNode;\n title: string;\n description?: string;\n /** Primary action: a rendered node, or an action object. */\n action?: React.ReactNode | EmptyStateAction;\n /** Alias for `action` for codebases that pass a list of actions. */\n actions?: React.ReactNode;\n /** Secondary action shown beside the primary one. */\n secondaryAction?: React.ReactNode;\n /** Heading level for the title. Defaults to a paragraph. */\n titleAs?: 'p' | 'h2' | 'h3' | 'h4';\n /** Compact padding for use inside panels and table bodies. */\n size?: 'sm' | 'md';\n};\n\nfunction isActionObject(value: unknown): value is EmptyStateAction {\n return (\n typeof value === 'object' &&\n value !== null &&\n !React.isValidElement(value) &&\n 'label' in value\n );\n}\n\n/** Normalizes the node and object forms into a single element. */\nfunction renderAction(action: React.ReactNode | EmptyStateAction | undefined): React.ReactNode {\n if (!isActionObject(action)) return action;\n const { label, onClick, href, variant } = action;\n if (href) {\n return (\n <Button variant={variant} asChild>\n <a href={href}>{label}</a>\n </Button>\n );\n }\n return (\n <Button variant={variant} onClick={onClick}>\n {label}\n </Button>\n );\n}\n\n/**\n * Placeholder for empty collections, zero-result searches and unconfigured\n * features. Keeps the title/description/action hierarchy consistent across\n * the product.\n */\nexport const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(function EmptyState(\n {\n icon,\n title,\n description,\n action,\n actions,\n secondaryAction,\n titleAs: Title = 'p',\n size = 'md',\n className,\n children,\n ...props\n },\n ref\n) {\n const primaryAction = renderAction(action) ?? actions;\n return (\n <div\n ref={ref}\n className={cn(\n 'flex flex-col items-center justify-center rounded-lg border border-dashed border-border text-center',\n size === 'md' ? 'gap-3 px-6 py-12' : 'gap-2 px-4 py-6',\n className\n )}\n {...props}\n >\n {icon && <div className=\"text-muted-foreground [&_svg]:size-8\">{icon}</div>}\n <Title className={cn('font-semibold', size === 'md' ? 'text-base' : 'text-sm')}>{title}</Title>\n {description && <p className=\"max-w-sm text-sm text-muted-foreground\">{description}</p>}\n {children}\n {(primaryAction || secondaryAction) && (\n <div className=\"mt-1 flex flex-wrap items-center justify-center gap-2\">\n {primaryAction}\n {secondaryAction}\n </div>\n )}\n </div>\n );\n});\n"],"mappings":"AA8CQ,cAgDA,YAhDA;AA9CR,YAAY,WAAW;AACvB,SAAS,UAAU;AACnB,SAAS,cAAgC;AA4BzC,SAAS,eAAe,OAA2C;AACjE,SACE,OAAO,UAAU,YACjB,UAAU,QACV,CAAC,MAAM,eAAe,KAAK,KAC3B,WAAW;AAEf;AAGA,SAAS,aAAa,QAAyE;AAC7F,MAAI,CAAC,eAAe,MAAM,EAAG,QAAO;AACpC,QAAM,EAAE,OAAO,SAAS,MAAM,QAAQ,IAAI;AAC1C,MAAI,MAAM;AACR,WACE,oBAAC,UAAO,SAAkB,SAAO,MAC/B,8BAAC,OAAE,MAAa,iBAAM,GACxB;AAAA,EAEJ;AACA,SACE,oBAAC,UAAO,SAAkB,SACvB,iBACH;AAEJ;AAOO,MAAM,aAAa,MAAM,WAA4C,SAASA,YACnF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,QAAQ;AAAA,EACjB,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,gBAAgB,aAAa,MAAM,KAAK;AAC9C,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA,SAAS,OAAO,qBAAqB;AAAA,QACrC;AAAA,MACF;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,gBAAQ,oBAAC,SAAI,WAAU,wCAAwC,gBAAK;AAAA,QACrE,oBAAC,SAAM,WAAW,GAAG,iBAAiB,SAAS,OAAO,cAAc,SAAS,GAAI,iBAAM;AAAA,QACtF,eAAe,oBAAC,OAAE,WAAU,0CAA0C,uBAAY;AAAA,QAClF;AAAA,SACC,iBAAiB,oBACjB,qBAAC,SAAI,WAAU,yDACZ;AAAA;AAAA,UACA;AAAA,WACH;AAAA;AAAA;AAAA,EAEJ;AAEJ,CAAC;","names":["EmptyState"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type ImageProps = {
|
|
3
|
+
/** Primary image URL. Hotlinked sources are expected. */
|
|
4
|
+
src: string;
|
|
5
|
+
/** Required: describes the image, not the component. */
|
|
6
|
+
alt: string;
|
|
7
|
+
/** Second chance before the fallback node (e.g. generated placeholder art). */
|
|
8
|
+
fallbackSrc?: string;
|
|
9
|
+
/** Rendered when every URL has failed (icon, initials, empty panel). */
|
|
10
|
+
fallback?: React.ReactNode;
|
|
11
|
+
/** Load eagerly and fetch at high priority for the LCP image. */
|
|
12
|
+
priority?: boolean;
|
|
13
|
+
/** Intrinsic width; always emitted so the browser reserves space. */
|
|
14
|
+
width?: number;
|
|
15
|
+
/** Intrinsic height; always emitted so the browser reserves space. */
|
|
16
|
+
height?: number;
|
|
17
|
+
/** Classes for the image; merged with imgClassName. */
|
|
18
|
+
className?: string;
|
|
19
|
+
/** Classes for the image when a consumer wants to keep them separate. */
|
|
20
|
+
imgClassName?: string;
|
|
21
|
+
style?: React.CSSProperties;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Resilient image: `src` -> `fallbackSrc` -> `fallback` node.
|
|
25
|
+
*
|
|
26
|
+
* Organizer images are hotlinked and occasionally 403, move, or die. Cards
|
|
27
|
+
* must never show a broken-image box or shift layout when that happens, so
|
|
28
|
+
* intrinsic dimensions are always rendered and only the priority image is
|
|
29
|
+
* eager.
|
|
30
|
+
*/
|
|
31
|
+
export declare function Image({ src, alt, fallbackSrc, fallback, priority, width, height, className, imgClassName, style, }: ImageProps): React.JSX.Element;
|
|
32
|
+
export declare namespace Image {
|
|
33
|
+
var displayName: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var Image_exports = {};
|
|
31
|
+
__export(Image_exports, {
|
|
32
|
+
Image: () => Image
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Image_exports);
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var React = __toESM(require("react"));
|
|
37
|
+
var import_cn = require("../../utils/cn.js");
|
|
38
|
+
function Image({
|
|
39
|
+
src,
|
|
40
|
+
alt,
|
|
41
|
+
fallbackSrc,
|
|
42
|
+
fallback,
|
|
43
|
+
priority = false,
|
|
44
|
+
width = 1200,
|
|
45
|
+
height = 630,
|
|
46
|
+
className,
|
|
47
|
+
imgClassName,
|
|
48
|
+
style
|
|
49
|
+
}) {
|
|
50
|
+
const [stage, setStage] = React.useState(0);
|
|
51
|
+
const onError = () => setStage((current2) => current2 === 0 && fallbackSrc ? 1 : 2);
|
|
52
|
+
const current = stage === 0 ? src : stage === 1 ? fallbackSrc : null;
|
|
53
|
+
if (!current || stage === 2) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: fallback ?? null });
|
|
54
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
55
|
+
"img",
|
|
56
|
+
{
|
|
57
|
+
src: current,
|
|
58
|
+
alt,
|
|
59
|
+
width,
|
|
60
|
+
height,
|
|
61
|
+
loading: priority ? "eager" : "lazy",
|
|
62
|
+
fetchPriority: priority ? "high" : "auto",
|
|
63
|
+
decoding: "async",
|
|
64
|
+
className: (0, import_cn.cn)(className, imgClassName),
|
|
65
|
+
style,
|
|
66
|
+
onError
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
Image.displayName = "Image";
|
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
+
0 && (module.exports = {
|
|
73
|
+
Image
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=Image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/image/Image.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type ImageProps = {\n /** Primary image URL. Hotlinked sources are expected. */\n src: string;\n /** Required: describes the image, not the component. */\n alt: string;\n /** Second chance before the fallback node (e.g. generated placeholder art). */\n fallbackSrc?: string;\n /** Rendered when every URL has failed (icon, initials, empty panel). */\n fallback?: React.ReactNode;\n /** Load eagerly and fetch at high priority for the LCP image. */\n priority?: boolean;\n /** Intrinsic width; always emitted so the browser reserves space. */\n width?: number;\n /** Intrinsic height; always emitted so the browser reserves space. */\n height?: number;\n /** Classes for the image; merged with imgClassName. */\n className?: string;\n /** Classes for the image when a consumer wants to keep them separate. */\n imgClassName?: string;\n style?: React.CSSProperties;\n};\n\n/**\n * Resilient image: `src` -> `fallbackSrc` -> `fallback` node.\n *\n * Organizer images are hotlinked and occasionally 403, move, or die. Cards\n * must never show a broken-image box or shift layout when that happens, so\n * intrinsic dimensions are always rendered and only the priority image is\n * eager.\n */\nexport function Image({\n src,\n alt,\n fallbackSrc,\n fallback,\n priority = false,\n width = 1200,\n height = 630,\n className,\n imgClassName,\n style,\n}: ImageProps) {\n const [stage, setStage] = React.useState<0 | 1 | 2>(0);\n\n const onError = () => setStage((current) => (current === 0 && fallbackSrc ? 1 : 2));\n const current = stage === 0 ? src : stage === 1 ? fallbackSrc : null;\n\n if (!current || stage === 2) return <>{fallback ?? null}</>;\n\n return (\n <img\n src={current}\n alt={alt}\n width={width}\n height={height}\n loading={priority ? 'eager' : 'lazy'}\n fetchPriority={priority ? 'high' : 'auto'}\n decoding=\"async\"\n className={cn(className, imgClassName)}\n style={style}\n onError={onError}\n />\n );\n}\n\nImage.displayName = 'Image';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoDsC;AAlDtC,YAAuB;AACvB,gBAAmB;AAgCZ,SAAS,MAAM;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AACF,GAAe;AACb,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAoB,CAAC;AAErD,QAAM,UAAU,MAAM,SAAS,CAACA,aAAaA,aAAY,KAAK,cAAc,IAAI,CAAE;AAClF,QAAM,UAAU,UAAU,IAAI,MAAM,UAAU,IAAI,cAAc;AAEhE,MAAI,CAAC,WAAW,UAAU,EAAG,QAAO,2EAAG,sBAAY,MAAK;AAExD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,WAAW,UAAU;AAAA,MAC9B,eAAe,WAAW,SAAS;AAAA,MACnC,UAAS;AAAA,MACT,eAAW,cAAG,WAAW,YAAY;AAAA,MACrC;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;AAEA,MAAM,cAAc;","names":["current"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../../utils/cn.mjs";
|
|
5
|
+
function Image({
|
|
6
|
+
src,
|
|
7
|
+
alt,
|
|
8
|
+
fallbackSrc,
|
|
9
|
+
fallback,
|
|
10
|
+
priority = false,
|
|
11
|
+
width = 1200,
|
|
12
|
+
height = 630,
|
|
13
|
+
className,
|
|
14
|
+
imgClassName,
|
|
15
|
+
style
|
|
16
|
+
}) {
|
|
17
|
+
const [stage, setStage] = React.useState(0);
|
|
18
|
+
const onError = () => setStage((current2) => current2 === 0 && fallbackSrc ? 1 : 2);
|
|
19
|
+
const current = stage === 0 ? src : stage === 1 ? fallbackSrc : null;
|
|
20
|
+
if (!current || stage === 2) return /* @__PURE__ */ jsx(Fragment, { children: fallback ?? null });
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
"img",
|
|
23
|
+
{
|
|
24
|
+
src: current,
|
|
25
|
+
alt,
|
|
26
|
+
width,
|
|
27
|
+
height,
|
|
28
|
+
loading: priority ? "eager" : "lazy",
|
|
29
|
+
fetchPriority: priority ? "high" : "auto",
|
|
30
|
+
decoding: "async",
|
|
31
|
+
className: cn(className, imgClassName),
|
|
32
|
+
style,
|
|
33
|
+
onError
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
Image.displayName = "Image";
|
|
38
|
+
export {
|
|
39
|
+
Image
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=Image.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/image/Image.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type ImageProps = {\n /** Primary image URL. Hotlinked sources are expected. */\n src: string;\n /** Required: describes the image, not the component. */\n alt: string;\n /** Second chance before the fallback node (e.g. generated placeholder art). */\n fallbackSrc?: string;\n /** Rendered when every URL has failed (icon, initials, empty panel). */\n fallback?: React.ReactNode;\n /** Load eagerly and fetch at high priority for the LCP image. */\n priority?: boolean;\n /** Intrinsic width; always emitted so the browser reserves space. */\n width?: number;\n /** Intrinsic height; always emitted so the browser reserves space. */\n height?: number;\n /** Classes for the image; merged with imgClassName. */\n className?: string;\n /** Classes for the image when a consumer wants to keep them separate. */\n imgClassName?: string;\n style?: React.CSSProperties;\n};\n\n/**\n * Resilient image: `src` -> `fallbackSrc` -> `fallback` node.\n *\n * Organizer images are hotlinked and occasionally 403, move, or die. Cards\n * must never show a broken-image box or shift layout when that happens, so\n * intrinsic dimensions are always rendered and only the priority image is\n * eager.\n */\nexport function Image({\n src,\n alt,\n fallbackSrc,\n fallback,\n priority = false,\n width = 1200,\n height = 630,\n className,\n imgClassName,\n style,\n}: ImageProps) {\n const [stage, setStage] = React.useState<0 | 1 | 2>(0);\n\n const onError = () => setStage((current) => (current === 0 && fallbackSrc ? 1 : 2));\n const current = stage === 0 ? src : stage === 1 ? fallbackSrc : null;\n\n if (!current || stage === 2) return <>{fallback ?? null}</>;\n\n return (\n <img\n src={current}\n alt={alt}\n width={width}\n height={height}\n loading={priority ? 'eager' : 'lazy'}\n fetchPriority={priority ? 'high' : 'auto'}\n decoding=\"async\"\n className={cn(className, imgClassName)}\n style={style}\n onError={onError}\n />\n );\n}\n\nImage.displayName = 'Image';\n"],"mappings":";AAoDsC;AAlDtC,YAAY,WAAW;AACvB,SAAS,UAAU;AAgCZ,SAAS,MAAM;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AACF,GAAe;AACb,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAoB,CAAC;AAErD,QAAM,UAAU,MAAM,SAAS,CAACA,aAAaA,aAAY,KAAK,cAAc,IAAI,CAAE;AAClF,QAAM,UAAU,UAAU,IAAI,MAAM,UAAU,IAAI,cAAc;AAEhE,MAAI,CAAC,WAAW,UAAU,EAAG,QAAO,gCAAG,sBAAY,MAAK;AAExD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,WAAW,UAAU;AAAA,MAC9B,eAAe,WAAW,SAAS;AAAA,MACnC,UAAS;AAAA,MACT,WAAW,GAAG,WAAW,YAAY;AAAA,MACrC;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;AAEA,MAAM,cAAc;","names":["current"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Image, type ImageProps } from './Image';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var image_exports = {};
|
|
20
|
+
__export(image_exports, {
|
|
21
|
+
Image: () => import_Image.Image
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(image_exports);
|
|
24
|
+
var import_Image = require("./Image.js");
|
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
+
0 && (module.exports = {
|
|
27
|
+
Image
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/image/index.ts"],"sourcesContent":["export { Image, type ImageProps } from './Image';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAuC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/image/index.ts"],"sourcesContent":["export { Image, type ImageProps } from './Image';\n"],"mappings":"AAAA,SAAS,aAA8B;","names":[]}
|
|
@@ -40,11 +40,11 @@ var import_cn = require("../../utils/cn.js");
|
|
|
40
40
|
const linkVariants = (0, import_class_variance_authority.cva)("inline-flex items-center gap-1 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-sm", {
|
|
41
41
|
variants: {
|
|
42
42
|
variant: {
|
|
43
|
-
default: "text-primary hover:underline underline-offset-4",
|
|
43
|
+
default: "text-primary-ink hover:underline underline-offset-4",
|
|
44
44
|
muted: "text-muted-foreground hover:text-foreground",
|
|
45
|
-
underline: "underline underline-offset-4 hover:text-primary",
|
|
46
|
-
arrow: "font-medium text-primary hover:underline underline-offset-4",
|
|
47
|
-
external: "text-primary hover:underline underline-offset-4"
|
|
45
|
+
underline: "underline underline-offset-4 hover:text-primary-ink",
|
|
46
|
+
arrow: "font-medium text-primary-ink hover:underline underline-offset-4",
|
|
47
|
+
external: "text-primary-ink hover:underline underline-offset-4"
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
defaultVariants: { variant: "default" }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/link/Link.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\n\nconst linkVariants = cva('inline-flex items-center gap-1 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-sm', {\n variants: {\n variant: {\n default: 'text-primary hover:underline underline-offset-4',\n muted: 'text-muted-foreground hover:text-foreground',\n underline: 'underline underline-offset-4 hover:text-primary',\n arrow: 'font-medium text-primary hover:underline underline-offset-4',\n external: 'text-primary hover:underline underline-offset-4',\n },\n },\n defaultVariants: { variant: 'default' },\n});\n\nexport type LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> &\n VariantProps<typeof linkVariants> & {\n /** Render the child element (router Link) with link styling. */\n asChild?: boolean;\n /**\n * Force external handling (target=_blank + rel). Absolute http(s) hrefs\n * are detected automatically; mailto:/tel: links never open a new tab.\n */\n external?: boolean;\n };\n\nconst ABSOLUTE = /^https?:\\/\\//i;\n\n/**\n * Inline link primitive with the project's link variants. Keeps a real\n * `<a href>` (SEO, modified clicks, middle-click) and adds safe external\n * handling: absolute URLs get target=\"_blank\" + rel=\"noopener noreferrer\"\n * and a screen-reader note, unless `external={false}`.\n *\n * For client-side routing, wrap your router's link: `<Link asChild><RouterLink …/></Link>`.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(function Link(\n { className, variant, asChild = false, external, target, rel, children, ...props },\n ref\n) {\n const isAbsolute = typeof props.href === 'string' && ABSOLUTE.test(props.href);\n const isExternal = external ?? isAbsolute;\n const Comp = asChild ? Slot : 'a';\n\n if (asChild) {\n return (\n <Comp\n ref={ref}\n className={cn(linkVariants({ variant }), className)}\n target={isExternal ? target ?? '_blank' : target}\n rel={isExternal ? rel ?? 'noopener noreferrer' : rel}\n {...props}\n >\n {children}\n </Comp>\n );\n }\n\n return (\n <Comp\n ref={ref}\n className={cn(linkVariants({ variant }), className)}\n target={isExternal ? target ?? '_blank' : target}\n rel={isExternal ? rel ?? 'noopener noreferrer' : rel}\n {...props}\n >\n {children}\n {isExternal && variant !== 'muted' && (\n <>\n <span aria-hidden=\"true\" className=\"text-[0.75em]\">\n ↗\n </span>\n <span className=\"sr-only\">(opens in a new tab)</span>\n </>\n )}\n </Comp>\n );\n});\n\nexport type LinkVariant = NonNullable<VariantProps<typeof linkVariants>['variant']>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmDM;AAjDN,YAAuB;AACvB,wBAAqB;AACrB,sCAAuC;AACvC,gBAAmB;AAEnB,MAAM,mBAAe,qCAAI,wMAAwM;AAAA,EAC/N,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAAS;AAAA,MACT,OAAO;AAAA,MACP,WAAW;AAAA,MACX,OAAO;AAAA,MACP,UAAU;AAAA,IACZ;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,SAAS,UAAU;AACxC,CAAC;AAaD,MAAM,WAAW;AAUV,MAAM,OAAO,MAAM,WAAyC,SAASA,MAC1E,EAAE,WAAW,SAAS,UAAU,OAAO,UAAU,QAAQ,KAAK,UAAU,GAAG,MAAM,GACjF,KACA;AACA,QAAM,aAAa,OAAO,MAAM,SAAS,YAAY,SAAS,KAAK,MAAM,IAAI;AAC7E,QAAM,aAAa,YAAY;AAC/B,QAAM,OAAO,UAAU,yBAAO;AAE9B,MAAI,SAAS;AACX,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW,cAAG,aAAa,EAAE,QAAQ,CAAC,GAAG,SAAS;AAAA,QAClD,QAAQ,aAAa,UAAU,WAAW;AAAA,QAC1C,KAAK,aAAa,OAAO,wBAAwB;AAAA,QAChD,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAW,cAAG,aAAa,EAAE,QAAQ,CAAC,GAAG,SAAS;AAAA,MAClD,QAAQ,aAAa,UAAU,WAAW;AAAA,MAC1C,KAAK,aAAa,OAAO,wBAAwB;AAAA,MAChD,GAAG;AAAA,MAEH;AAAA;AAAA,QACA,cAAc,YAAY,WACzB,4EACE;AAAA,sDAAC,UAAK,eAAY,QAAO,WAAU,iBAAgB,oBAEnD;AAAA,UACA,4CAAC,UAAK,WAAU,WAAU,kCAAoB;AAAA,WAChD;AAAA;AAAA;AAAA,EAEJ;AAEJ,CAAC;","names":["Link"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/link/Link.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\n\nconst linkVariants = cva('inline-flex items-center gap-1 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-sm', {\n variants: {\n variant: {\n default: 'text-primary-ink hover:underline underline-offset-4',\n muted: 'text-muted-foreground hover:text-foreground',\n underline: 'underline underline-offset-4 hover:text-primary-ink',\n arrow: 'font-medium text-primary-ink hover:underline underline-offset-4',\n external: 'text-primary-ink hover:underline underline-offset-4',\n },\n },\n defaultVariants: { variant: 'default' },\n});\n\nexport type LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> &\n VariantProps<typeof linkVariants> & {\n /** Render the child element (router Link) with link styling. */\n asChild?: boolean;\n /**\n * Force external handling (target=_blank + rel). Absolute http(s) hrefs\n * are detected automatically; mailto:/tel: links never open a new tab.\n */\n external?: boolean;\n };\n\nconst ABSOLUTE = /^https?:\\/\\//i;\n\n/**\n * Inline link primitive with the project's link variants. Keeps a real\n * `<a href>` (SEO, modified clicks, middle-click) and adds safe external\n * handling: absolute URLs get target=\"_blank\" + rel=\"noopener noreferrer\"\n * and a screen-reader note, unless `external={false}`.\n *\n * For client-side routing, wrap your router's link: `<Link asChild><RouterLink …/></Link>`.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(function Link(\n { className, variant, asChild = false, external, target, rel, children, ...props },\n ref\n) {\n const isAbsolute = typeof props.href === 'string' && ABSOLUTE.test(props.href);\n const isExternal = external ?? isAbsolute;\n const Comp = asChild ? Slot : 'a';\n\n if (asChild) {\n return (\n <Comp\n ref={ref}\n className={cn(linkVariants({ variant }), className)}\n target={isExternal ? target ?? '_blank' : target}\n rel={isExternal ? rel ?? 'noopener noreferrer' : rel}\n {...props}\n >\n {children}\n </Comp>\n );\n }\n\n return (\n <Comp\n ref={ref}\n className={cn(linkVariants({ variant }), className)}\n target={isExternal ? target ?? '_blank' : target}\n rel={isExternal ? rel ?? 'noopener noreferrer' : rel}\n {...props}\n >\n {children}\n {isExternal && variant !== 'muted' && (\n <>\n <span aria-hidden=\"true\" className=\"text-[0.75em]\">\n ↗\n </span>\n <span className=\"sr-only\">(opens in a new tab)</span>\n </>\n )}\n </Comp>\n );\n});\n\nexport type LinkVariant = NonNullable<VariantProps<typeof linkVariants>['variant']>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmDM;AAjDN,YAAuB;AACvB,wBAAqB;AACrB,sCAAuC;AACvC,gBAAmB;AAEnB,MAAM,mBAAe,qCAAI,wMAAwM;AAAA,EAC/N,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAAS;AAAA,MACT,OAAO;AAAA,MACP,WAAW;AAAA,MACX,OAAO;AAAA,MACP,UAAU;AAAA,IACZ;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,SAAS,UAAU;AACxC,CAAC;AAaD,MAAM,WAAW;AAUV,MAAM,OAAO,MAAM,WAAyC,SAASA,MAC1E,EAAE,WAAW,SAAS,UAAU,OAAO,UAAU,QAAQ,KAAK,UAAU,GAAG,MAAM,GACjF,KACA;AACA,QAAM,aAAa,OAAO,MAAM,SAAS,YAAY,SAAS,KAAK,MAAM,IAAI;AAC7E,QAAM,aAAa,YAAY;AAC/B,QAAM,OAAO,UAAU,yBAAO;AAE9B,MAAI,SAAS;AACX,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW,cAAG,aAAa,EAAE,QAAQ,CAAC,GAAG,SAAS;AAAA,QAClD,QAAQ,aAAa,UAAU,WAAW;AAAA,QAC1C,KAAK,aAAa,OAAO,wBAAwB;AAAA,QAChD,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAW,cAAG,aAAa,EAAE,QAAQ,CAAC,GAAG,SAAS;AAAA,MAClD,QAAQ,aAAa,UAAU,WAAW;AAAA,MAC1C,KAAK,aAAa,OAAO,wBAAwB;AAAA,MAChD,GAAG;AAAA,MAEH;AAAA;AAAA,QACA,cAAc,YAAY,WACzB,4EACE;AAAA,sDAAC,UAAK,eAAY,QAAO,WAAU,iBAAgB,oBAEnD;AAAA,UACA,4CAAC,UAAK,WAAU,WAAU,kCAAoB;AAAA,WAChD;AAAA;AAAA;AAAA,EAEJ;AAEJ,CAAC;","names":["Link"]}
|
|
@@ -7,11 +7,11 @@ import { cn } from "../../utils/cn.mjs";
|
|
|
7
7
|
const linkVariants = cva("inline-flex items-center gap-1 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-sm", {
|
|
8
8
|
variants: {
|
|
9
9
|
variant: {
|
|
10
|
-
default: "text-primary hover:underline underline-offset-4",
|
|
10
|
+
default: "text-primary-ink hover:underline underline-offset-4",
|
|
11
11
|
muted: "text-muted-foreground hover:text-foreground",
|
|
12
|
-
underline: "underline underline-offset-4 hover:text-primary",
|
|
13
|
-
arrow: "font-medium text-primary hover:underline underline-offset-4",
|
|
14
|
-
external: "text-primary hover:underline underline-offset-4"
|
|
12
|
+
underline: "underline underline-offset-4 hover:text-primary-ink",
|
|
13
|
+
arrow: "font-medium text-primary-ink hover:underline underline-offset-4",
|
|
14
|
+
external: "text-primary-ink hover:underline underline-offset-4"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
defaultVariants: { variant: "default" }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/link/Link.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\n\nconst linkVariants = cva('inline-flex items-center gap-1 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-sm', {\n variants: {\n variant: {\n default: 'text-primary hover:underline underline-offset-4',\n muted: 'text-muted-foreground hover:text-foreground',\n underline: 'underline underline-offset-4 hover:text-primary',\n arrow: 'font-medium text-primary hover:underline underline-offset-4',\n external: 'text-primary hover:underline underline-offset-4',\n },\n },\n defaultVariants: { variant: 'default' },\n});\n\nexport type LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> &\n VariantProps<typeof linkVariants> & {\n /** Render the child element (router Link) with link styling. */\n asChild?: boolean;\n /**\n * Force external handling (target=_blank + rel). Absolute http(s) hrefs\n * are detected automatically; mailto:/tel: links never open a new tab.\n */\n external?: boolean;\n };\n\nconst ABSOLUTE = /^https?:\\/\\//i;\n\n/**\n * Inline link primitive with the project's link variants. Keeps a real\n * `<a href>` (SEO, modified clicks, middle-click) and adds safe external\n * handling: absolute URLs get target=\"_blank\" + rel=\"noopener noreferrer\"\n * and a screen-reader note, unless `external={false}`.\n *\n * For client-side routing, wrap your router's link: `<Link asChild><RouterLink …/></Link>`.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(function Link(\n { className, variant, asChild = false, external, target, rel, children, ...props },\n ref\n) {\n const isAbsolute = typeof props.href === 'string' && ABSOLUTE.test(props.href);\n const isExternal = external ?? isAbsolute;\n const Comp = asChild ? Slot : 'a';\n\n if (asChild) {\n return (\n <Comp\n ref={ref}\n className={cn(linkVariants({ variant }), className)}\n target={isExternal ? target ?? '_blank' : target}\n rel={isExternal ? rel ?? 'noopener noreferrer' : rel}\n {...props}\n >\n {children}\n </Comp>\n );\n }\n\n return (\n <Comp\n ref={ref}\n className={cn(linkVariants({ variant }), className)}\n target={isExternal ? target ?? '_blank' : target}\n rel={isExternal ? rel ?? 'noopener noreferrer' : rel}\n {...props}\n >\n {children}\n {isExternal && variant !== 'muted' && (\n <>\n <span aria-hidden=\"true\" className=\"text-[0.75em]\">\n ↗\n </span>\n <span className=\"sr-only\">(opens in a new tab)</span>\n </>\n )}\n </Comp>\n );\n});\n\nexport type LinkVariant = NonNullable<VariantProps<typeof linkVariants>['variant']>;\n"],"mappings":";AAmDM,SAsBE,UAtBF,KAsBE,YAtBF;AAjDN,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,WAA8B;AACvC,SAAS,UAAU;AAEnB,MAAM,eAAe,IAAI,wMAAwM;AAAA,EAC/N,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAAS;AAAA,MACT,OAAO;AAAA,MACP,WAAW;AAAA,MACX,OAAO;AAAA,MACP,UAAU;AAAA,IACZ;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,SAAS,UAAU;AACxC,CAAC;AAaD,MAAM,WAAW;AAUV,MAAM,OAAO,MAAM,WAAyC,SAASA,MAC1E,EAAE,WAAW,SAAS,UAAU,OAAO,UAAU,QAAQ,KAAK,UAAU,GAAG,MAAM,GACjF,KACA;AACA,QAAM,aAAa,OAAO,MAAM,SAAS,YAAY,SAAS,KAAK,MAAM,IAAI;AAC7E,QAAM,aAAa,YAAY;AAC/B,QAAM,OAAO,UAAU,OAAO;AAE9B,MAAI,SAAS;AACX,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,aAAa,EAAE,QAAQ,CAAC,GAAG,SAAS;AAAA,QAClD,QAAQ,aAAa,UAAU,WAAW;AAAA,QAC1C,KAAK,aAAa,OAAO,wBAAwB;AAAA,QAChD,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW,GAAG,aAAa,EAAE,QAAQ,CAAC,GAAG,SAAS;AAAA,MAClD,QAAQ,aAAa,UAAU,WAAW;AAAA,MAC1C,KAAK,aAAa,OAAO,wBAAwB;AAAA,MAChD,GAAG;AAAA,MAEH;AAAA;AAAA,QACA,cAAc,YAAY,WACzB,iCACE;AAAA,8BAAC,UAAK,eAAY,QAAO,WAAU,iBAAgB,oBAEnD;AAAA,UACA,oBAAC,UAAK,WAAU,WAAU,kCAAoB;AAAA,WAChD;AAAA;AAAA;AAAA,EAEJ;AAEJ,CAAC;","names":["Link"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/link/Link.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\n\nconst linkVariants = cva('inline-flex items-center gap-1 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-sm', {\n variants: {\n variant: {\n default: 'text-primary-ink hover:underline underline-offset-4',\n muted: 'text-muted-foreground hover:text-foreground',\n underline: 'underline underline-offset-4 hover:text-primary-ink',\n arrow: 'font-medium text-primary-ink hover:underline underline-offset-4',\n external: 'text-primary-ink hover:underline underline-offset-4',\n },\n },\n defaultVariants: { variant: 'default' },\n});\n\nexport type LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> &\n VariantProps<typeof linkVariants> & {\n /** Render the child element (router Link) with link styling. */\n asChild?: boolean;\n /**\n * Force external handling (target=_blank + rel). Absolute http(s) hrefs\n * are detected automatically; mailto:/tel: links never open a new tab.\n */\n external?: boolean;\n };\n\nconst ABSOLUTE = /^https?:\\/\\//i;\n\n/**\n * Inline link primitive with the project's link variants. Keeps a real\n * `<a href>` (SEO, modified clicks, middle-click) and adds safe external\n * handling: absolute URLs get target=\"_blank\" + rel=\"noopener noreferrer\"\n * and a screen-reader note, unless `external={false}`.\n *\n * For client-side routing, wrap your router's link: `<Link asChild><RouterLink …/></Link>`.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(function Link(\n { className, variant, asChild = false, external, target, rel, children, ...props },\n ref\n) {\n const isAbsolute = typeof props.href === 'string' && ABSOLUTE.test(props.href);\n const isExternal = external ?? isAbsolute;\n const Comp = asChild ? Slot : 'a';\n\n if (asChild) {\n return (\n <Comp\n ref={ref}\n className={cn(linkVariants({ variant }), className)}\n target={isExternal ? target ?? '_blank' : target}\n rel={isExternal ? rel ?? 'noopener noreferrer' : rel}\n {...props}\n >\n {children}\n </Comp>\n );\n }\n\n return (\n <Comp\n ref={ref}\n className={cn(linkVariants({ variant }), className)}\n target={isExternal ? target ?? '_blank' : target}\n rel={isExternal ? rel ?? 'noopener noreferrer' : rel}\n {...props}\n >\n {children}\n {isExternal && variant !== 'muted' && (\n <>\n <span aria-hidden=\"true\" className=\"text-[0.75em]\">\n ↗\n </span>\n <span className=\"sr-only\">(opens in a new tab)</span>\n </>\n )}\n </Comp>\n );\n});\n\nexport type LinkVariant = NonNullable<VariantProps<typeof linkVariants>['variant']>;\n"],"mappings":";AAmDM,SAsBE,UAtBF,KAsBE,YAtBF;AAjDN,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,WAA8B;AACvC,SAAS,UAAU;AAEnB,MAAM,eAAe,IAAI,wMAAwM;AAAA,EAC/N,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAAS;AAAA,MACT,OAAO;AAAA,MACP,WAAW;AAAA,MACX,OAAO;AAAA,MACP,UAAU;AAAA,IACZ;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,SAAS,UAAU;AACxC,CAAC;AAaD,MAAM,WAAW;AAUV,MAAM,OAAO,MAAM,WAAyC,SAASA,MAC1E,EAAE,WAAW,SAAS,UAAU,OAAO,UAAU,QAAQ,KAAK,UAAU,GAAG,MAAM,GACjF,KACA;AACA,QAAM,aAAa,OAAO,MAAM,SAAS,YAAY,SAAS,KAAK,MAAM,IAAI;AAC7E,QAAM,aAAa,YAAY;AAC/B,QAAM,OAAO,UAAU,OAAO;AAE9B,MAAI,SAAS;AACX,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,aAAa,EAAE,QAAQ,CAAC,GAAG,SAAS;AAAA,QAClD,QAAQ,aAAa,UAAU,WAAW;AAAA,QAC1C,KAAK,aAAa,OAAO,wBAAwB;AAAA,QAChD,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW,GAAG,aAAa,EAAE,QAAQ,CAAC,GAAG,SAAS;AAAA,MAClD,QAAQ,aAAa,UAAU,WAAW;AAAA,MAC1C,KAAK,aAAa,OAAO,wBAAwB;AAAA,MAChD,GAAG;AAAA,MAEH;AAAA;AAAA,QACA,cAAc,YAAY,WACzB,iCACE;AAAA,8BAAC,UAAK,eAAY,QAAO,WAAU,iBAAgB,oBAEnD;AAAA,UACA,oBAAC,UAAK,WAAU,WAAU,kCAAoB;AAAA,WAChD;AAAA;AAAA;AAAA,EAEJ;AAEJ,CAAC;","names":["Link"]}
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export type MetricTrend = 'up' | 'down' | 'flat';
|
|
3
|
+
export type MetricTone = 'default' | 'success' | 'warning' | 'destructive';
|
|
3
4
|
export type MetricCardProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> & {
|
|
4
|
-
|
|
5
|
+
/** Metric name. Alias: title. */
|
|
6
|
+
label?: string;
|
|
5
7
|
value: string | number;
|
|
6
|
-
/** Secondary line under the value. */
|
|
8
|
+
/** Secondary line under the value. Alias: description. */
|
|
7
9
|
hint?: React.ReactNode;
|
|
10
|
+
/** Alias for `label` (migration-friendly). */
|
|
11
|
+
title?: string;
|
|
12
|
+
/** Alias for `hint` (migration-friendly). */
|
|
13
|
+
description?: React.ReactNode;
|
|
8
14
|
/** Signed change, e.g. "+12.4%" or "-3". */
|
|
9
15
|
delta?: string;
|
|
10
16
|
/** Direction colors the delta (green up / red down / muted flat). */
|
|
11
17
|
trend?: MetricTrend;
|
|
18
|
+
/** Semantic color for the value (not the delta). */
|
|
19
|
+
tone?: MetricTone;
|
|
20
|
+
/** Renders a skeleton instead of the value; sets aria-busy while true. */
|
|
21
|
+
loading?: boolean;
|
|
12
22
|
icon?: React.ReactNode;
|
|
13
23
|
};
|
|
14
24
|
/**
|
|
@@ -17,13 +27,22 @@ export type MetricCardProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'title'
|
|
|
17
27
|
* never communicated by color alone.
|
|
18
28
|
*/
|
|
19
29
|
export declare const MetricCard: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "title"> & {
|
|
20
|
-
|
|
30
|
+
/** Metric name. Alias: title. */
|
|
31
|
+
label?: string;
|
|
21
32
|
value: string | number;
|
|
22
|
-
/** Secondary line under the value. */
|
|
33
|
+
/** Secondary line under the value. Alias: description. */
|
|
23
34
|
hint?: React.ReactNode;
|
|
35
|
+
/** Alias for `label` (migration-friendly). */
|
|
36
|
+
title?: string;
|
|
37
|
+
/** Alias for `hint` (migration-friendly). */
|
|
38
|
+
description?: React.ReactNode;
|
|
24
39
|
/** Signed change, e.g. "+12.4%" or "-3". */
|
|
25
40
|
delta?: string;
|
|
26
41
|
/** Direction colors the delta (green up / red down / muted flat). */
|
|
27
42
|
trend?: MetricTrend;
|
|
43
|
+
/** Semantic color for the value (not the delta). */
|
|
44
|
+
tone?: MetricTone;
|
|
45
|
+
/** Renders a skeleton instead of the value; sets aria-busy while true. */
|
|
46
|
+
loading?: boolean;
|
|
28
47
|
icon?: React.ReactNode;
|
|
29
48
|
} & React.RefAttributes<HTMLDivElement>>;
|