@slipstream-ui/core 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +470 -30
- package/dist/index.d.ts +470 -30
- package/dist/index.js +1455 -750
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1442 -744
- package/dist/index.mjs.map +1 -1
- package/dist/manifests/accordion.manifest.json +7 -1
- package/dist/manifests/alert.manifest.json +1 -1
- package/dist/manifests/announcement-bar.manifest.json +1 -1
- package/dist/manifests/app-shell.manifest.json +1 -1
- package/dist/manifests/applied-filters.manifest.json +1 -1
- package/dist/manifests/article-card.manifest.json +1 -1
- package/dist/manifests/auth-layout.manifest.json +19 -1
- package/dist/manifests/autocomplete.manifest.json +1 -1
- package/dist/manifests/avatar.manifest.json +1 -1
- package/dist/manifests/badge.manifest.json +13 -1
- package/dist/manifests/block.manifest.json +1 -1
- package/dist/manifests/bottom-nav.manifest.json +130 -0
- package/dist/manifests/breadcrumb.manifest.json +1 -1
- package/dist/manifests/button-group.manifest.json +1 -1
- package/dist/manifests/button.manifest.json +1 -1
- package/dist/manifests/card.manifest.json +1 -1
- package/dist/manifests/checkbox.manifest.json +1 -1
- package/dist/manifests/comparison-table.manifest.json +1 -1
- package/dist/manifests/confirm-dialog.manifest.json +1 -1
- package/dist/manifests/contact-strip.manifest.json +1 -1
- package/dist/manifests/container.manifest.json +1 -1
- package/dist/manifests/cta-section.manifest.json +1 -1
- package/dist/manifests/data-table.manifest.json +1 -1
- package/dist/manifests/date-picker.manifest.json +1 -1
- package/dist/manifests/date-range-picker.manifest.json +1 -1
- package/dist/manifests/deal-card.manifest.json +158 -0
- package/dist/manifests/dialog.manifest.json +1 -1
- package/dist/manifests/document-card.manifest.json +108 -0
- package/dist/manifests/drawer.manifest.json +48 -2
- package/dist/manifests/empty-state.manifest.json +1 -1
- package/dist/manifests/entity-card.manifest.json +114 -0
- package/dist/manifests/feature-grid.manifest.json +1 -1
- package/dist/manifests/feature-row.manifest.json +1 -1
- package/dist/manifests/fieldset.manifest.json +1 -1
- package/dist/manifests/file-upload.manifest.json +1 -1
- package/dist/manifests/filter-bar.manifest.json +1 -1
- package/dist/manifests/filter-chips.manifest.json +1 -1
- package/dist/manifests/filter-panel.manifest.json +1 -1
- package/dist/manifests/flex.manifest.json +1 -1
- package/dist/manifests/form-field.manifest.json +1 -1
- package/dist/manifests/form-layout.manifest.json +1 -1
- package/dist/manifests/form.manifest.json +1 -1
- package/dist/manifests/grid.manifest.json +1 -1
- package/dist/manifests/heading.manifest.json +1 -1
- package/dist/manifests/hero.manifest.json +40 -8
- package/dist/manifests/input-group.manifest.json +1 -1
- package/dist/manifests/input.manifest.json +1 -1
- package/dist/manifests/label.manifest.json +1 -1
- package/dist/manifests/link-tabs.manifest.json +1 -1
- package/dist/manifests/link.manifest.json +1 -1
- package/dist/manifests/list.manifest.json +1 -1
- package/dist/manifests/load-more.manifest.json +88 -0
- package/dist/manifests/logo-cloud.manifest.json +1 -1
- package/dist/manifests/menu.manifest.json +1 -1
- package/dist/manifests/metric-card.manifest.json +36 -4
- package/dist/manifests/multi-select.manifest.json +1 -1
- package/dist/manifests/newsletter.manifest.json +1 -1
- package/dist/manifests/page-header.manifest.json +7 -1
- package/dist/manifests/pagination.manifest.json +1 -1
- package/dist/manifests/password-input.manifest.json +1 -1
- package/dist/manifests/popover.manifest.json +1 -1
- package/dist/manifests/process-steps.manifest.json +1 -1
- package/dist/manifests/progress.manifest.json +1 -1
- package/dist/manifests/prose.manifest.json +1 -1
- package/dist/manifests/radio.manifest.json +1 -1
- package/dist/manifests/range-slider.manifest.json +1 -1
- package/dist/manifests/search.manifest.json +1 -1
- package/dist/manifests/section-heading.manifest.json +1 -1
- package/dist/manifests/section.manifest.json +1 -1
- package/dist/manifests/segmented-control.manifest.json +1 -1
- package/dist/manifests/select-menu.manifest.json +2 -2
- package/dist/manifests/select.manifest.json +1 -1
- package/dist/manifests/separator.manifest.json +1 -1
- package/dist/manifests/site-footer.manifest.json +1 -1
- package/dist/manifests/site-header.manifest.json +1 -1
- package/dist/manifests/skeleton.manifest.json +1 -1
- package/dist/manifests/spinner.manifest.json +1 -1
- package/dist/manifests/stat-band.manifest.json +1 -1
- package/dist/manifests/stepper.manifest.json +69 -5
- package/dist/manifests/switch.manifest.json +1 -1
- package/dist/manifests/table-card.manifest.json +1 -1
- package/dist/manifests/table-of-contents.manifest.json +26 -5
- package/dist/manifests/table.manifest.json +1 -1
- package/dist/manifests/tabs.manifest.json +1 -1
- package/dist/manifests/testimonial.manifest.json +1 -1
- package/dist/manifests/text.manifest.json +1 -1
- package/dist/manifests/textarea.manifest.json +1 -1
- package/dist/manifests/theme-toggle.manifest.json +1 -1
- package/dist/manifests/time-picker.manifest.json +1 -1
- package/dist/manifests/timeline.manifest.json +1 -1
- package/dist/manifests/toast.manifest.json +1 -1
- package/dist/manifests/tombstone-card.manifest.json +97 -0
- package/dist/manifests/tooltip.manifest.json +1 -1
- package/dist/src/components/accordion/Accordion.d.ts +17 -1
- package/dist/src/components/accordion/Accordion.js +5 -1
- package/dist/src/components/accordion/Accordion.js.map +1 -1
- package/dist/src/components/accordion/Accordion.mjs +5 -1
- package/dist/src/components/accordion/Accordion.mjs.map +1 -1
- package/dist/src/components/auth-layout/AuthLayout.d.ts +14 -2
- package/dist/src/components/auth-layout/AuthLayout.js +10 -2
- package/dist/src/components/auth-layout/AuthLayout.js.map +1 -1
- package/dist/src/components/auth-layout/AuthLayout.mjs +10 -2
- package/dist/src/components/auth-layout/AuthLayout.mjs.map +1 -1
- package/dist/src/components/badge/Badge.d.ts +2 -0
- package/dist/src/components/badge/Badge.js +9 -3
- package/dist/src/components/badge/Badge.js.map +1 -1
- package/dist/src/components/badge/Badge.mjs +9 -3
- package/dist/src/components/badge/Badge.mjs.map +1 -1
- package/dist/src/components/bottom-nav/BottomNav.d.ts +36 -0
- package/dist/src/components/bottom-nav/BottomNav.js +90 -0
- package/dist/src/components/bottom-nav/BottomNav.js.map +1 -0
- package/dist/src/components/bottom-nav/BottomNav.mjs +66 -0
- package/dist/src/components/bottom-nav/BottomNav.mjs.map +1 -0
- package/dist/src/components/bottom-nav/index.d.ts +1 -0
- package/dist/src/components/bottom-nav/index.js +23 -0
- package/dist/src/components/bottom-nav/index.js.map +1 -0
- package/dist/src/components/bottom-nav/index.mjs +2 -0
- package/dist/src/components/bottom-nav/index.mjs.map +1 -0
- package/dist/src/components/date-picker/DatePicker.js +1 -1
- package/dist/src/components/date-picker/DatePicker.js.map +1 -1
- package/dist/src/components/date-picker/DatePicker.mjs +1 -1
- package/dist/src/components/date-picker/DatePicker.mjs.map +1 -1
- package/dist/src/components/deal-card/DealCard.d.ts +72 -0
- package/dist/src/components/deal-card/DealCard.js +108 -0
- package/dist/src/components/deal-card/DealCard.js.map +1 -0
- package/dist/src/components/deal-card/DealCard.mjs +74 -0
- package/dist/src/components/deal-card/DealCard.mjs.map +1 -0
- package/dist/src/components/deal-card/index.d.ts +2 -0
- package/dist/src/components/deal-card/index.js +29 -0
- package/dist/src/components/deal-card/index.js.map +1 -0
- package/dist/src/components/deal-card/index.mjs +5 -0
- package/dist/src/components/deal-card/index.mjs.map +1 -0
- package/dist/src/components/document-card/DocumentCard.d.ts +42 -0
- package/dist/src/components/document-card/DocumentCard.js +84 -0
- package/dist/src/components/document-card/DocumentCard.js.map +1 -0
- package/dist/src/components/document-card/DocumentCard.mjs +50 -0
- package/dist/src/components/document-card/DocumentCard.mjs.map +1 -0
- package/dist/src/components/document-card/index.d.ts +2 -0
- package/dist/src/components/document-card/index.js +29 -0
- package/dist/src/components/document-card/index.js.map +1 -0
- package/dist/src/components/document-card/index.mjs +5 -0
- package/dist/src/components/document-card/index.mjs.map +1 -0
- package/dist/src/components/drawer/Drawer.d.ts +25 -2
- package/dist/src/components/drawer/Drawer.js +97 -6
- package/dist/src/components/drawer/Drawer.js.map +1 -1
- package/dist/src/components/drawer/Drawer.mjs +97 -6
- package/dist/src/components/drawer/Drawer.mjs.map +1 -1
- package/dist/src/components/empty-state/EmptyState.d.ts +13 -4
- package/dist/src/components/empty-state/EmptyState.js +13 -1
- package/dist/src/components/empty-state/EmptyState.js.map +1 -1
- package/dist/src/components/empty-state/EmptyState.mjs +13 -1
- package/dist/src/components/empty-state/EmptyState.mjs.map +1 -1
- package/dist/src/components/entity-card/EntityCard.d.ts +78 -0
- package/dist/src/components/entity-card/EntityCard.js +95 -0
- package/dist/src/components/entity-card/EntityCard.js.map +1 -0
- package/dist/src/components/entity-card/EntityCard.mjs +60 -0
- package/dist/src/components/entity-card/EntityCard.mjs.map +1 -0
- package/dist/src/components/entity-card/index.d.ts +2 -0
- package/dist/src/components/entity-card/index.js +31 -0
- package/dist/src/components/entity-card/index.js.map +1 -0
- package/dist/src/components/entity-card/index.mjs +6 -0
- package/dist/src/components/entity-card/index.mjs.map +1 -0
- package/dist/src/components/hero/Hero.d.ts +25 -13
- package/dist/src/components/hero/Hero.js +116 -12
- package/dist/src/components/hero/Hero.js.map +1 -1
- package/dist/src/components/hero/Hero.mjs +116 -12
- package/dist/src/components/hero/Hero.mjs.map +1 -1
- package/dist/src/components/load-more/LoadMore.d.ts +34 -0
- package/dist/src/components/load-more/LoadMore.js +55 -0
- package/dist/src/components/load-more/LoadMore.js.map +1 -0
- package/dist/src/components/load-more/LoadMore.mjs +21 -0
- package/dist/src/components/load-more/LoadMore.mjs.map +1 -0
- package/dist/src/components/load-more/index.d.ts +2 -0
- package/dist/src/components/load-more/index.js +29 -0
- package/dist/src/components/load-more/index.js.map +1 -0
- package/dist/src/components/load-more/index.mjs +5 -0
- package/dist/src/components/load-more/index.mjs.map +1 -0
- package/dist/src/components/metric-card/MetricCard.d.ts +23 -4
- package/dist/src/components/metric-card/MetricCard.js +32 -5
- package/dist/src/components/metric-card/MetricCard.js.map +1 -1
- package/dist/src/components/metric-card/MetricCard.mjs +32 -5
- package/dist/src/components/metric-card/MetricCard.mjs.map +1 -1
- package/dist/src/components/page-header/PageHeader.d.ts +4 -0
- package/dist/src/components/page-header/PageHeader.js +3 -2
- package/dist/src/components/page-header/PageHeader.js.map +1 -1
- package/dist/src/components/page-header/PageHeader.mjs +3 -2
- package/dist/src/components/page-header/PageHeader.mjs.map +1 -1
- package/dist/src/components/range-slider/RangeSlider.js +6 -6
- package/dist/src/components/range-slider/RangeSlider.js.map +1 -1
- package/dist/src/components/range-slider/RangeSlider.mjs +6 -6
- package/dist/src/components/range-slider/RangeSlider.mjs.map +1 -1
- package/dist/src/components/select-menu/SelectMenu.js +2 -0
- package/dist/src/components/select-menu/SelectMenu.js.map +1 -1
- package/dist/src/components/select-menu/SelectMenu.mjs +2 -0
- package/dist/src/components/select-menu/SelectMenu.mjs.map +1 -1
- package/dist/src/components/separator/Separator.d.ts +3 -3
- package/dist/src/components/separator/Separator.js +1 -1
- package/dist/src/components/separator/Separator.js.map +1 -1
- package/dist/src/components/separator/Separator.mjs +1 -1
- package/dist/src/components/separator/Separator.mjs.map +1 -1
- package/dist/src/components/stepper/Stepper.d.ts +35 -0
- package/dist/src/components/stepper/Stepper.js +118 -25
- package/dist/src/components/stepper/Stepper.js.map +1 -1
- package/dist/src/components/stepper/Stepper.mjs +118 -25
- package/dist/src/components/stepper/Stepper.mjs.map +1 -1
- package/dist/src/components/table-of-contents/TableOfContents.d.ts +10 -2
- package/dist/src/components/table-of-contents/TableOfContents.js +13 -0
- package/dist/src/components/table-of-contents/TableOfContents.js.map +1 -1
- package/dist/src/components/table-of-contents/TableOfContents.mjs +13 -0
- package/dist/src/components/table-of-contents/TableOfContents.mjs.map +1 -1
- package/dist/src/components/tabs/Tabs.js +43 -3
- package/dist/src/components/tabs/Tabs.js.map +1 -1
- package/dist/src/components/tabs/Tabs.mjs +43 -3
- package/dist/src/components/tabs/Tabs.mjs.map +1 -1
- package/dist/src/components/time-picker/TimePicker.js +1 -1
- package/dist/src/components/time-picker/TimePicker.js.map +1 -1
- package/dist/src/components/time-picker/TimePicker.mjs +1 -1
- package/dist/src/components/time-picker/TimePicker.mjs.map +1 -1
- package/dist/src/components/timeline/Timeline.js +2 -2
- package/dist/src/components/timeline/Timeline.js.map +1 -1
- package/dist/src/components/timeline/Timeline.mjs +2 -2
- package/dist/src/components/timeline/Timeline.mjs.map +1 -1
- package/dist/src/components/tombstone-card/TombstoneCard.d.ts +39 -0
- package/dist/src/components/tombstone-card/TombstoneCard.js +86 -0
- package/dist/src/components/tombstone-card/TombstoneCard.js.map +1 -0
- package/dist/src/components/tombstone-card/TombstoneCard.mjs +52 -0
- package/dist/src/components/tombstone-card/TombstoneCard.mjs.map +1 -0
- package/dist/src/components/tombstone-card/index.d.ts +2 -0
- package/dist/src/components/tombstone-card/index.js +29 -0
- package/dist/src/components/tombstone-card/index.js.map +1 -0
- package/dist/src/components/tombstone-card/index.mjs +5 -0
- package/dist/src/components/tombstone-card/index.mjs.map +1 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/styles-full.css +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/src/components/accordion/Accordion.test.tsx +31 -0
- package/src/components/accordion/Accordion.tsx +27 -2
- package/src/components/auth-layout/AuthLayout.test.tsx +36 -0
- package/src/components/auth-layout/AuthLayout.tsx +20 -3
- package/src/components/badge/Badge.test.tsx +7 -0
- package/src/components/badge/Badge.tsx +8 -2
- package/src/components/bottom-nav/BottomNav.test.tsx +48 -0
- package/src/components/bottom-nav/BottomNav.tsx +117 -0
- package/src/components/bottom-nav/index.ts +1 -0
- package/src/components/date-picker/DatePicker.tsx +1 -1
- package/src/components/deal-card/DealCard.test.tsx +54 -0
- package/src/components/deal-card/DealCard.tsx +138 -0
- package/src/components/deal-card/index.ts +2 -0
- package/src/components/document-card/DocumentCard.test.tsx +41 -0
- package/src/components/document-card/DocumentCard.tsx +82 -0
- package/src/components/document-card/index.ts +2 -0
- package/src/components/drawer/Drawer.test.tsx +86 -1
- package/src/components/drawer/Drawer.tsx +135 -7
- package/src/components/empty-state/EmptyState.test.tsx +26 -1
- package/src/components/empty-state/EmptyState.tsx +40 -3
- package/src/components/entity-card/EntityCard.test.tsx +38 -0
- package/src/components/entity-card/EntityCard.tsx +133 -0
- package/src/components/entity-card/index.ts +2 -0
- package/src/components/hero/Hero.test.tsx +14 -0
- package/src/components/hero/Hero.tsx +111 -19
- package/src/components/load-more/LoadMore.test.tsx +28 -0
- package/src/components/load-more/LoadMore.tsx +53 -0
- package/src/components/load-more/index.ts +2 -0
- package/src/components/metric-card/MetricCard.test.tsx +32 -0
- package/src/components/metric-card/MetricCard.tsx +45 -7
- package/src/components/page-header/PageHeader.test.tsx +13 -0
- package/src/components/page-header/PageHeader.tsx +5 -2
- package/src/components/range-slider/RangeSlider.test.tsx +8 -0
- package/src/components/range-slider/RangeSlider.tsx +10 -6
- package/src/components/select-menu/SelectMenu.test.tsx +20 -10
- package/src/components/select-menu/SelectMenu.tsx +2 -0
- package/src/components/separator/Separator.test.tsx +9 -1
- package/src/components/separator/Separator.tsx +1 -1
- package/src/components/stepper/Stepper.test.tsx +19 -0
- package/src/components/stepper/Stepper.tsx +169 -37
- package/src/components/table-of-contents/TableOfContents.test.tsx +12 -1
- package/src/components/table-of-contents/TableOfContents.tsx +25 -1
- package/src/components/tabs/Tabs.test.tsx +12 -0
- package/src/components/tabs/Tabs.tsx +48 -4
- package/src/components/time-picker/TimePicker.tsx +1 -1
- package/src/components/timeline/Timeline.tsx +2 -2
- package/src/components/tombstone-card/TombstoneCard.test.tsx +26 -0
- package/src/components/tombstone-card/TombstoneCard.tsx +77 -0
- package/src/components/tombstone-card/index.ts +2 -0
- package/src/index.ts +6 -0
- package/src/manifests/accordion.manifest.json +7 -1
- package/src/manifests/alert.manifest.json +1 -1
- package/src/manifests/announcement-bar.manifest.json +1 -1
- package/src/manifests/app-shell.manifest.json +1 -1
- package/src/manifests/applied-filters.manifest.json +1 -1
- package/src/manifests/article-card.manifest.json +1 -1
- package/src/manifests/auth-layout.manifest.json +19 -1
- package/src/manifests/autocomplete.manifest.json +1 -1
- package/src/manifests/avatar.manifest.json +1 -1
- package/src/manifests/badge.manifest.json +13 -1
- package/src/manifests/block.manifest.json +1 -1
- package/src/manifests/bottom-nav.manifest.json +130 -0
- package/src/manifests/breadcrumb.manifest.json +1 -1
- package/src/manifests/button-group.manifest.json +1 -1
- package/src/manifests/button.manifest.json +1 -1
- package/src/manifests/card.manifest.json +1 -1
- package/src/manifests/checkbox.manifest.json +1 -1
- package/src/manifests/comparison-table.manifest.json +1 -1
- package/src/manifests/confirm-dialog.manifest.json +1 -1
- package/src/manifests/contact-strip.manifest.json +1 -1
- package/src/manifests/container.manifest.json +1 -1
- package/src/manifests/cta-section.manifest.json +1 -1
- package/src/manifests/data-table.manifest.json +1 -1
- package/src/manifests/date-picker.manifest.json +1 -1
- package/src/manifests/date-range-picker.manifest.json +1 -1
- package/src/manifests/deal-card.manifest.json +158 -0
- package/src/manifests/dialog.manifest.json +1 -1
- package/src/manifests/document-card.manifest.json +108 -0
- package/src/manifests/drawer.manifest.json +48 -2
- package/src/manifests/empty-state.manifest.json +1 -1
- package/src/manifests/entity-card.manifest.json +114 -0
- package/src/manifests/feature-grid.manifest.json +1 -1
- package/src/manifests/feature-row.manifest.json +1 -1
- package/src/manifests/fieldset.manifest.json +1 -1
- package/src/manifests/file-upload.manifest.json +1 -1
- package/src/manifests/filter-bar.manifest.json +1 -1
- package/src/manifests/filter-chips.manifest.json +1 -1
- package/src/manifests/filter-panel.manifest.json +1 -1
- package/src/manifests/flex.manifest.json +1 -1
- package/src/manifests/form-field.manifest.json +1 -1
- package/src/manifests/form-layout.manifest.json +1 -1
- package/src/manifests/form.manifest.json +1 -1
- package/src/manifests/grid.manifest.json +1 -1
- package/src/manifests/heading.manifest.json +1 -1
- package/src/manifests/hero.manifest.json +40 -8
- package/src/manifests/input-group.manifest.json +1 -1
- package/src/manifests/input.manifest.json +1 -1
- package/src/manifests/label.manifest.json +1 -1
- package/src/manifests/link-tabs.manifest.json +1 -1
- package/src/manifests/link.manifest.json +1 -1
- package/src/manifests/list.manifest.json +1 -1
- package/src/manifests/load-more.manifest.json +88 -0
- package/src/manifests/logo-cloud.manifest.json +1 -1
- package/src/manifests/menu.manifest.json +1 -1
- package/src/manifests/metric-card.manifest.json +36 -4
- package/src/manifests/multi-select.manifest.json +1 -1
- package/src/manifests/newsletter.manifest.json +1 -1
- package/src/manifests/page-header.manifest.json +7 -1
- package/src/manifests/pagination.manifest.json +1 -1
- package/src/manifests/password-input.manifest.json +1 -1
- package/src/manifests/popover.manifest.json +1 -1
- package/src/manifests/process-steps.manifest.json +1 -1
- package/src/manifests/progress.manifest.json +1 -1
- package/src/manifests/prose.manifest.json +1 -1
- package/src/manifests/radio.manifest.json +1 -1
- package/src/manifests/range-slider.manifest.json +1 -1
- package/src/manifests/search.manifest.json +1 -1
- package/src/manifests/section-heading.manifest.json +1 -1
- package/src/manifests/section.manifest.json +1 -1
- package/src/manifests/segmented-control.manifest.json +1 -1
- package/src/manifests/select-menu.manifest.json +2 -2
- package/src/manifests/select.manifest.json +1 -1
- package/src/manifests/separator.manifest.json +1 -1
- package/src/manifests/site-footer.manifest.json +1 -1
- package/src/manifests/site-header.manifest.json +1 -1
- package/src/manifests/skeleton.manifest.json +1 -1
- package/src/manifests/spinner.manifest.json +1 -1
- package/src/manifests/stat-band.manifest.json +1 -1
- package/src/manifests/stepper.manifest.json +69 -5
- package/src/manifests/switch.manifest.json +1 -1
- package/src/manifests/table-card.manifest.json +1 -1
- package/src/manifests/table-of-contents.manifest.json +26 -5
- package/src/manifests/table.manifest.json +1 -1
- package/src/manifests/tabs.manifest.json +1 -1
- package/src/manifests/testimonial.manifest.json +1 -1
- package/src/manifests/text.manifest.json +1 -1
- package/src/manifests/textarea.manifest.json +1 -1
- package/src/manifests/theme-toggle.manifest.json +1 -1
- package/src/manifests/time-picker.manifest.json +1 -1
- package/src/manifests/timeline.manifest.json +1 -1
- package/src/manifests/toast.manifest.json +1 -1
- package/src/manifests/tombstone-card.manifest.json +97 -0
- package/src/manifests/tooltip.manifest.json +1 -1
- package/src/test/jest-axe.d.ts +6 -1
|
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8NU;AA5NV,YAAuB;AACvB,uBAA6B;AAC7B,gBAAmB;AACnB,sBAA4B;AAC5B,yBAA8B;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,WAA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nC,oBAAkB,cAAc,gBAAgB;AAAA,YAChD,UAAU;AAAA,YACV,eAAW;AAAA,cACT;AAAA,cACA,YAAY,IAAI;AAAA,cAChB,YAAY,IAAI,EAAE,IAAI;AAAA,cACtB;AAAA,YACF;AAAA,YACA,OAAO,eAAe,EAAE,CAAC,iBAAiB,WAAW,OAAO,GAAG,aAAa,IAAI;AAAA,YAEhF;AAAA,2DAAC,SAAI,WAAU,2EACb;AAAA,6DAAC,SACC;AAAA,8DAAC,QAAG,IAAI,SAAS,WAAU,yCACxB,iBACH;AAAA,kBACC,eACC,4CAAC,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,4CAAC,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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA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AAa;AAAA,YACzB,mBAAiB,QAAQ,UAAU;AAAA,YACnC,oBAAkB,cAAc,gBAAgB;AAAA,YAChD,UAAU;AAAA,YACV,eAAW;AAAA,cACT;AAAA,cACA,YAAY,IAAI;AAAA,cAChB,YAAY,IAAI,EAAE,IAAI;AAAA,cACtB;AAAA,YACF;AAAA,YACA,OAAO,eAAe,EAAE,CAAC,iBAAiB,WAAW,OAAO,GAAG,aAAa,IAAI;AAAA,YAE/E;AAAA,2BACC;AAAA,gBAAC;AAAA;AAAA,kBACC,MAAK;AAAA,kBACL,oBAAiB;AAAA,kBACjB,cAAY;AAAA,kBACZ,iBAAe;AAAA,kBACf,iBAAe;AAAA,kBACf,iBAAe;AAAA,kBACf,UAAU;AAAA,kBACV,eAAe;AAAA,kBACf,WAAW;AAAA,kBACX,eAAW;AAAA,oBACT;AAAA,oBACA;AAAA,oBACA,SAAS,UAAU,YAAY;AAAA,kBACjC;AAAA;AAAA,cACF;AAAA,cAEF,6CAAC,SAAI,WAAU,2EACb;AAAA,6DAAC,SACC;AAAA,8DAAC,QAAG,IAAI,SAAS,WAAU,yCACxB,iBACH;AAAA,kBACC,eACC,4CAAC,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,4CAAC,SAAI,WAAU,oCAAoC,UAAS;AAAA;AAAA;AAAA,QAC9D;AAAA;AAAA,IACF;AAAA,IACA,SAAS;AAAA,EACX;AACF;","names":[]}
|
|
@@ -32,6 +32,13 @@ const sizeClasses = {
|
|
|
32
32
|
top: sideHeights,
|
|
33
33
|
bottom: sideHeights
|
|
34
34
|
};
|
|
35
|
+
const sizePx = {
|
|
36
|
+
sm: 288,
|
|
37
|
+
md: 384,
|
|
38
|
+
lg: 512,
|
|
39
|
+
xl: 640,
|
|
40
|
+
"2xl": 768
|
|
41
|
+
};
|
|
35
42
|
function extentStyle(value) {
|
|
36
43
|
if (value === void 0) return void 0;
|
|
37
44
|
return typeof value === "number" ? `${value}px` : value;
|
|
@@ -51,6 +58,7 @@ const slideOut = {
|
|
|
51
58
|
function Drawer({
|
|
52
59
|
open,
|
|
53
60
|
onOpenChange,
|
|
61
|
+
onClose,
|
|
54
62
|
title,
|
|
55
63
|
description,
|
|
56
64
|
children,
|
|
@@ -58,6 +66,12 @@ function Drawer({
|
|
|
58
66
|
size = "md",
|
|
59
67
|
width,
|
|
60
68
|
height,
|
|
69
|
+
resizable = false,
|
|
70
|
+
minWidth = 240,
|
|
71
|
+
maxWidth = 960,
|
|
72
|
+
defaultWidth,
|
|
73
|
+
onWidthChange,
|
|
74
|
+
resizeLabel = "Resize drawer",
|
|
61
75
|
closeOnBackdrop = true,
|
|
62
76
|
showClose = true,
|
|
63
77
|
closeLabel = "Close drawer",
|
|
@@ -71,6 +85,65 @@ function Drawer({
|
|
|
71
85
|
const descriptionId = React.useId();
|
|
72
86
|
const { present, exiting } = usePresence(open, animate);
|
|
73
87
|
const isTopLayer = useModalLayer(open);
|
|
88
|
+
const requestClose = React.useCallback(() => {
|
|
89
|
+
if (onOpenChange) onOpenChange(false);
|
|
90
|
+
else onClose?.();
|
|
91
|
+
}, [onOpenChange, onClose]);
|
|
92
|
+
const isVerticalSide = side === "top" || side === "bottom";
|
|
93
|
+
const canResize = resizable && !isVerticalSide;
|
|
94
|
+
const clampWidth = React.useCallback(
|
|
95
|
+
(next) => Math.min(maxWidth, Math.max(minWidth, Math.round(next))),
|
|
96
|
+
[minWidth, maxWidth]
|
|
97
|
+
);
|
|
98
|
+
const [resizedWidth, setResizedWidth] = React.useState(null);
|
|
99
|
+
const initialWidth = clampWidth(
|
|
100
|
+
defaultWidth ?? (typeof width === "number" ? width : sizePx[size])
|
|
101
|
+
);
|
|
102
|
+
const resizeWidth = resizedWidth ?? initialWidth;
|
|
103
|
+
const widthRef = React.useRef(resizeWidth);
|
|
104
|
+
widthRef.current = resizeWidth;
|
|
105
|
+
const onWidthChangeRef = React.useRef(onWidthChange);
|
|
106
|
+
onWidthChangeRef.current = onWidthChange;
|
|
107
|
+
const commitWidth = (next) => {
|
|
108
|
+
const clamped = clampWidth(next);
|
|
109
|
+
setResizedWidth(clamped);
|
|
110
|
+
onWidthChangeRef.current?.(clamped);
|
|
111
|
+
};
|
|
112
|
+
const onResizePointerDown = (event) => {
|
|
113
|
+
if (event.button !== 0) return;
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
const startX = event.clientX;
|
|
116
|
+
const startWidth = resizeWidth;
|
|
117
|
+
const onMove = (moveEvent) => {
|
|
118
|
+
const delta = side === "right" ? startX - moveEvent.clientX : moveEvent.clientX - startX;
|
|
119
|
+
setResizedWidth(clampWidth(startWidth + delta));
|
|
120
|
+
};
|
|
121
|
+
const onUp = () => {
|
|
122
|
+
window.removeEventListener("pointermove", onMove);
|
|
123
|
+
window.removeEventListener("pointerup", onUp);
|
|
124
|
+
onWidthChangeRef.current?.(widthRef.current);
|
|
125
|
+
};
|
|
126
|
+
window.addEventListener("pointermove", onMove);
|
|
127
|
+
window.addEventListener("pointerup", onUp);
|
|
128
|
+
};
|
|
129
|
+
const onResizeKeyDown = (event) => {
|
|
130
|
+
const step = event.shiftKey ? 64 : 16;
|
|
131
|
+
const grow = side === "right" ? "ArrowLeft" : "ArrowRight";
|
|
132
|
+
const shrink = side === "right" ? "ArrowRight" : "ArrowLeft";
|
|
133
|
+
if (event.key === grow) {
|
|
134
|
+
event.preventDefault();
|
|
135
|
+
commitWidth(resizeWidth + step);
|
|
136
|
+
} else if (event.key === shrink) {
|
|
137
|
+
event.preventDefault();
|
|
138
|
+
commitWidth(resizeWidth - step);
|
|
139
|
+
} else if (event.key === "Home") {
|
|
140
|
+
event.preventDefault();
|
|
141
|
+
commitWidth(minWidth);
|
|
142
|
+
} else if (event.key === "End") {
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
commitWidth(maxWidth);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
74
147
|
React.useEffect(() => {
|
|
75
148
|
if (open) {
|
|
76
149
|
previouslyFocused.current = document.activeElement;
|
|
@@ -91,7 +164,7 @@ function Drawer({
|
|
|
91
164
|
if (event.key === "Escape") {
|
|
92
165
|
if (!isTopLayer()) return;
|
|
93
166
|
event.stopPropagation();
|
|
94
|
-
|
|
167
|
+
requestClose();
|
|
95
168
|
return;
|
|
96
169
|
}
|
|
97
170
|
if (event.key !== "Tab") return;
|
|
@@ -115,10 +188,9 @@ function Drawer({
|
|
|
115
188
|
};
|
|
116
189
|
document.addEventListener("keydown", onKeyDown);
|
|
117
190
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
118
|
-
}, [open,
|
|
191
|
+
}, [open, requestClose, isTopLayer]);
|
|
119
192
|
if (!present || typeof document === "undefined") return null;
|
|
120
|
-
const
|
|
121
|
-
const customExtent = isVerticalSide ? extentStyle(height) : extentStyle(width);
|
|
193
|
+
const customExtent = canResize ? `${resizeWidth}px` : isVerticalSide ? extentStyle(height) : extentStyle(width);
|
|
122
194
|
const motion = animate ? cn(
|
|
123
195
|
"duration-200 motion-reduce:animate-none",
|
|
124
196
|
exiting ? `animate-out ${slideOut[side]}` : `animate-in ${slideIn[side]}`
|
|
@@ -129,7 +201,7 @@ function Drawer({
|
|
|
129
201
|
{
|
|
130
202
|
className: "fixed inset-0 z-50",
|
|
131
203
|
onMouseDown: (event) => {
|
|
132
|
-
if (closeOnBackdrop && event.target === event.currentTarget)
|
|
204
|
+
if (closeOnBackdrop && event.target === event.currentTarget) requestClose();
|
|
133
205
|
},
|
|
134
206
|
children: /* @__PURE__ */ jsxs(
|
|
135
207
|
"div",
|
|
@@ -149,6 +221,25 @@ function Drawer({
|
|
|
149
221
|
),
|
|
150
222
|
style: customExtent ? { [isVerticalSide ? "height" : "width"]: customExtent } : void 0,
|
|
151
223
|
children: [
|
|
224
|
+
canResize && /* @__PURE__ */ jsx(
|
|
225
|
+
"div",
|
|
226
|
+
{
|
|
227
|
+
role: "separator",
|
|
228
|
+
"aria-orientation": "vertical",
|
|
229
|
+
"aria-label": resizeLabel,
|
|
230
|
+
"aria-valuenow": resizeWidth,
|
|
231
|
+
"aria-valuemin": minWidth,
|
|
232
|
+
"aria-valuemax": maxWidth,
|
|
233
|
+
tabIndex: 0,
|
|
234
|
+
onPointerDown: onResizePointerDown,
|
|
235
|
+
onKeyDown: onResizeKeyDown,
|
|
236
|
+
className: cn(
|
|
237
|
+
"absolute inset-y-0 z-10 w-2 cursor-col-resize touch-none rounded-sm bg-transparent",
|
|
238
|
+
"hover:bg-primary/20 focus-visible:bg-primary/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
239
|
+
side === "right" ? "-left-1" : "-right-1"
|
|
240
|
+
)
|
|
241
|
+
}
|
|
242
|
+
),
|
|
152
243
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4 border-b border-border px-5 py-4", children: [
|
|
153
244
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
154
245
|
/* @__PURE__ */ jsx("h2", { id: titleId, className: "text-base font-semibold leading-tight", children: title }),
|
|
@@ -158,7 +249,7 @@ function Drawer({
|
|
|
158
249
|
"button",
|
|
159
250
|
{
|
|
160
251
|
type: "button",
|
|
161
|
-
onClick:
|
|
252
|
+
onClick: requestClose,
|
|
162
253
|
"aria-label": closeLabel,
|
|
163
254
|
className: "-me-1 rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
164
255
|
children: "\u2715"
|
|
@@ -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;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,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,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,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E;AAAA,2BACC;AAAA,gBAAC;AAAA;AAAA,kBACC,MAAK;AAAA,kBACL,oBAAiB;AAAA,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,78 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type EntityStat = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
};
|
|
6
|
+
export type EntityCardProps = React.HTMLAttributes<HTMLElement> & {
|
|
7
|
+
/** Firm or member name. */
|
|
8
|
+
name: string;
|
|
9
|
+
/** Firm type, role or member category. */
|
|
10
|
+
entityType: string;
|
|
11
|
+
/** Region or office location. */
|
|
12
|
+
location?: string;
|
|
13
|
+
/** Short firm description. */
|
|
14
|
+
description?: string;
|
|
15
|
+
/** Logo slot. Falls back to initials when omitted. */
|
|
16
|
+
logo?: React.ReactNode;
|
|
17
|
+
/** Small stats such as closed deals or active mandates. */
|
|
18
|
+
stats?: EntityStat[];
|
|
19
|
+
/** Sector or service tags. */
|
|
20
|
+
tags?: string[];
|
|
21
|
+
/** Profile destination. */
|
|
22
|
+
href?: string;
|
|
23
|
+
/** Custom link element for routers. */
|
|
24
|
+
linkComponent?: React.ElementType;
|
|
25
|
+
/** Extra footer actions. */
|
|
26
|
+
actions?: React.ReactNode;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Firm or member profile card for a directory. Use the logo slot for a brand
|
|
30
|
+
* mark; when absent, initials keep the card identifiable. Stats and tags are
|
|
31
|
+
* optional, so the same card works in compact and detailed directory views.
|
|
32
|
+
*/
|
|
33
|
+
export declare const EntityCard: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
34
|
+
/** Firm or member name. */
|
|
35
|
+
name: string;
|
|
36
|
+
/** Firm type, role or member category. */
|
|
37
|
+
entityType: string;
|
|
38
|
+
/** Region or office location. */
|
|
39
|
+
location?: string;
|
|
40
|
+
/** Short firm description. */
|
|
41
|
+
description?: string;
|
|
42
|
+
/** Logo slot. Falls back to initials when omitted. */
|
|
43
|
+
logo?: React.ReactNode;
|
|
44
|
+
/** Small stats such as closed deals or active mandates. */
|
|
45
|
+
stats?: EntityStat[];
|
|
46
|
+
/** Sector or service tags. */
|
|
47
|
+
tags?: string[];
|
|
48
|
+
/** Profile destination. */
|
|
49
|
+
href?: string;
|
|
50
|
+
/** Custom link element for routers. */
|
|
51
|
+
linkComponent?: React.ElementType;
|
|
52
|
+
/** Extra footer actions. */
|
|
53
|
+
actions?: React.ReactNode;
|
|
54
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
55
|
+
/** Alias for profile-oriented directory surfaces. */
|
|
56
|
+
export declare const ProfileCard: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
57
|
+
/** Firm or member name. */
|
|
58
|
+
name: string;
|
|
59
|
+
/** Firm type, role or member category. */
|
|
60
|
+
entityType: string;
|
|
61
|
+
/** Region or office location. */
|
|
62
|
+
location?: string;
|
|
63
|
+
/** Short firm description. */
|
|
64
|
+
description?: string;
|
|
65
|
+
/** Logo slot. Falls back to initials when omitted. */
|
|
66
|
+
logo?: React.ReactNode;
|
|
67
|
+
/** Small stats such as closed deals or active mandates. */
|
|
68
|
+
stats?: EntityStat[];
|
|
69
|
+
/** Sector or service tags. */
|
|
70
|
+
tags?: string[];
|
|
71
|
+
/** Profile destination. */
|
|
72
|
+
href?: string;
|
|
73
|
+
/** Custom link element for routers. */
|
|
74
|
+
linkComponent?: React.ElementType;
|
|
75
|
+
/** Extra footer actions. */
|
|
76
|
+
actions?: React.ReactNode;
|
|
77
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
78
|
+
export type ProfileCardProps = EntityCardProps;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var EntityCard_exports = {};
|
|
30
|
+
__export(EntityCard_exports, {
|
|
31
|
+
EntityCard: () => EntityCard,
|
|
32
|
+
ProfileCard: () => ProfileCard
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(EntityCard_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
|
+
var import_Avatar = require("../avatar/Avatar.js");
|
|
39
|
+
var import_Badge = require("../badge/Badge.js");
|
|
40
|
+
var import_Card = require("../card/Card.js");
|
|
41
|
+
function initials(name) {
|
|
42
|
+
return name.split(/\s+/).filter(Boolean).slice(0, 2).map((part) => part[0]?.toUpperCase() ?? "").join("");
|
|
43
|
+
}
|
|
44
|
+
const EntityCard = React.forwardRef(function EntityCard2({
|
|
45
|
+
name,
|
|
46
|
+
entityType,
|
|
47
|
+
location,
|
|
48
|
+
description,
|
|
49
|
+
logo,
|
|
50
|
+
stats,
|
|
51
|
+
tags,
|
|
52
|
+
href,
|
|
53
|
+
linkComponent,
|
|
54
|
+
actions,
|
|
55
|
+
className,
|
|
56
|
+
...props
|
|
57
|
+
}, ref) {
|
|
58
|
+
const Link = linkComponent ?? "a";
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Card.Card, { ref, className: (0, import_cn.cn)("flex h-full flex-col", className), ...props, children: [
|
|
60
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Card.CardHeader, { className: "flex-row items-start gap-3 p-5 pb-3", children: [
|
|
61
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "shrink-0", children: logo ?? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Avatar.Avatar, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Avatar.AvatarFallback, { children: initials(name) }) }) }),
|
|
62
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
63
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "truncate text-base font-semibold tracking-tight", children: href ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, { href, className: "rounded-sm hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: name }) : name }),
|
|
64
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mt-0.5 truncate text-xs text-muted-foreground", children: entityType }),
|
|
65
|
+
location && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mt-0.5 truncate text-xs text-muted-foreground", children: location })
|
|
66
|
+
] })
|
|
67
|
+
] }),
|
|
68
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Card.CardContent, { className: "flex-1 px-5 pb-3", children: [
|
|
69
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "line-clamp-3 text-sm leading-relaxed text-muted-foreground", children: description }),
|
|
70
|
+
tags && tags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-3 flex flex-wrap gap-1.5", children: tags.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Badge.Badge, { variant: "secondary", children: tag }, tag)) }),
|
|
71
|
+
stats && stats.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dl", { className: "mt-4 grid grid-cols-2 gap-3", children: stats.map((stat) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "min-w-0", children: [
|
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { className: "text-xs text-muted-foreground", children: stat.label }),
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { className: "mt-0.5 truncate text-sm font-semibold tabular-nums", children: stat.value })
|
|
74
|
+
] }, stat.label)) })
|
|
75
|
+
] }),
|
|
76
|
+
(href || actions) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Card.CardFooter, { className: "flex flex-wrap items-center gap-2 border-t border-border px-5 py-3", children: [
|
|
77
|
+
href && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
78
|
+
Link,
|
|
79
|
+
{
|
|
80
|
+
href,
|
|
81
|
+
className: "text-sm font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
82
|
+
children: "View profile"
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "ml-auto flex items-center gap-2", children: actions })
|
|
86
|
+
] })
|
|
87
|
+
] });
|
|
88
|
+
});
|
|
89
|
+
const ProfileCard = EntityCard;
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
EntityCard,
|
|
93
|
+
ProfileCard
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=EntityCard.js.map
|