@inui/design-system 0.0.0-stage → 1.22.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/README.md +360 -2
- package/dist/components/ui/accordion.d.ts +44 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion.js +86 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/ai-avatar.d.ts +46 -0
- package/dist/components/ui/ai-avatar.d.ts.map +1 -0
- package/dist/components/ui/ai-avatar.js +43 -0
- package/dist/components/ui/ai-avatar.js.map +1 -0
- package/dist/components/ui/ai-label.d.ts +118 -0
- package/dist/components/ui/ai-label.d.ts.map +1 -0
- package/dist/components/ui/ai-label.js +184 -0
- package/dist/components/ui/ai-label.js.map +1 -0
- package/dist/components/ui/ai-sparkle.d.ts +91 -0
- package/dist/components/ui/ai-sparkle.d.ts.map +1 -0
- package/dist/components/ui/ai-sparkle.js +200 -0
- package/dist/components/ui/ai-sparkle.js.map +1 -0
- package/dist/components/ui/alert-dialog.d.ts +79 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +147 -0
- package/dist/components/ui/alert-dialog.js.map +1 -0
- package/dist/components/ui/alert.d.ts +71 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/alert.js +108 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/aspect-ratio.d.ts +30 -0
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -0
- package/dist/components/ui/aspect-ratio.js +40 -0
- package/dist/components/ui/aspect-ratio.js.map +1 -0
- package/dist/components/ui/attachment.d.ts +74 -0
- package/dist/components/ui/attachment.d.ts.map +1 -0
- package/dist/components/ui/attachment.js +142 -0
- package/dist/components/ui/attachment.js.map +1 -0
- package/dist/components/ui/avatar.d.ts +82 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +123 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.d.ts +130 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +226 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/breadcrumb.d.ts +43 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb.js +98 -0
- package/dist/components/ui/breadcrumb.js.map +1 -0
- package/dist/components/ui/browser-tabs.d.ts +218 -0
- package/dist/components/ui/browser-tabs.d.ts.map +1 -0
- package/dist/components/ui/browser-tabs.js +528 -0
- package/dist/components/ui/browser-tabs.js.map +1 -0
- package/dist/components/ui/bubble.d.ts +80 -0
- package/dist/components/ui/bubble.d.ts.map +1 -0
- package/dist/components/ui/bubble.js +235 -0
- package/dist/components/ui/bubble.js.map +1 -0
- package/dist/components/ui/button-group.d.ts +60 -0
- package/dist/components/ui/button-group.d.ts.map +1 -0
- package/dist/components/ui/button-group.js +89 -0
- package/dist/components/ui/button-group.js.map +1 -0
- package/dist/components/ui/button.d.ts +157 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +144 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/calendar.d.ts +57 -0
- package/dist/components/ui/calendar.d.ts.map +1 -0
- package/dist/components/ui/calendar.js +163 -0
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/card.d.ts +96 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +131 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/carousel.d.ts +86 -0
- package/dist/components/ui/carousel.d.ts.map +1 -0
- package/dist/components/ui/carousel.js +207 -0
- package/dist/components/ui/carousel.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +54 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +78 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +45 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +65 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/combobox.d.ts +111 -0
- package/dist/components/ui/combobox.d.ts.map +1 -0
- package/dist/components/ui/combobox.js +264 -0
- package/dist/components/ui/combobox.js.map +1 -0
- package/dist/components/ui/command.d.ts +71 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/command.js +133 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/context-menu.d.ts +70 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/context-menu.js +163 -0
- package/dist/components/ui/context-menu.js.map +1 -0
- package/dist/components/ui/count-badge.d.ts +40 -0
- package/dist/components/ui/count-badge.d.ts.map +1 -0
- package/dist/components/ui/count-badge.js +43 -0
- package/dist/components/ui/count-badge.js.map +1 -0
- package/dist/components/ui/data-table.d.ts +1026 -0
- package/dist/components/ui/data-table.d.ts.map +1 -0
- package/dist/components/ui/data-table.js +3423 -0
- package/dist/components/ui/data-table.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +73 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +145 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/direction.d.ts +35 -0
- package/dist/components/ui/direction.d.ts.map +1 -0
- package/dist/components/ui/direction.js +35 -0
- package/dist/components/ui/direction.js.map +1 -0
- package/dist/components/ui/drawer.d.ts +53 -0
- package/dist/components/ui/drawer.d.ts.map +1 -0
- package/dist/components/ui/drawer.js +115 -0
- package/dist/components/ui/drawer.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +75 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +173 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/dropzone.d.ts +141 -0
- package/dist/components/ui/dropzone.d.ts.map +1 -0
- package/dist/components/ui/dropzone.js +257 -0
- package/dist/components/ui/dropzone.js.map +1 -0
- package/dist/components/ui/empty.d.ts +94 -0
- package/dist/components/ui/empty.d.ts.map +1 -0
- package/dist/components/ui/empty.js +149 -0
- package/dist/components/ui/empty.js.map +1 -0
- package/dist/components/ui/field.d.ts +122 -0
- package/dist/components/ui/field.d.ts.map +1 -0
- package/dist/components/ui/field.js +254 -0
- package/dist/components/ui/field.js.map +1 -0
- package/dist/components/ui/hover-card.d.ts +51 -0
- package/dist/components/ui/hover-card.d.ts.map +1 -0
- package/dist/components/ui/hover-card.js +101 -0
- package/dist/components/ui/hover-card.js.map +1 -0
- package/dist/components/ui/input-group.d.ts +62 -0
- package/dist/components/ui/input-group.d.ts.map +1 -0
- package/dist/components/ui/input-group.js +115 -0
- package/dist/components/ui/input-group.js.map +1 -0
- package/dist/components/ui/input-otp.d.ts +52 -0
- package/dist/components/ui/input-otp.d.ts.map +1 -0
- package/dist/components/ui/input-otp.js +89 -0
- package/dist/components/ui/input-otp.js.map +1 -0
- package/dist/components/ui/input.d.ts +47 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +47 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/item.d.ts +74 -0
- package/dist/components/ui/item.d.ts.map +1 -0
- package/dist/components/ui/item.js +176 -0
- package/dist/components/ui/item.js.map +1 -0
- package/dist/components/ui/kbd.d.ts +41 -0
- package/dist/components/ui/kbd.d.ts.map +1 -0
- package/dist/components/ui/kbd.js +58 -0
- package/dist/components/ui/kbd.js.map +1 -0
- package/dist/components/ui/key-value-pair.d.ts +56 -0
- package/dist/components/ui/key-value-pair.d.ts.map +1 -0
- package/dist/components/ui/key-value-pair.js +110 -0
- package/dist/components/ui/key-value-pair.js.map +1 -0
- package/dist/components/ui/label.d.ts +83 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +85 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/marker.d.ts +54 -0
- package/dist/components/ui/marker.d.ts.map +1 -0
- package/dist/components/ui/marker.js +79 -0
- package/dist/components/ui/marker.js.map +1 -0
- package/dist/components/ui/menubar.d.ts +72 -0
- package/dist/components/ui/menubar.d.ts.map +1 -0
- package/dist/components/ui/menubar.js +174 -0
- package/dist/components/ui/menubar.js.map +1 -0
- package/dist/components/ui/message-scroller.d.ts +53 -0
- package/dist/components/ui/message-scroller.d.ts.map +1 -0
- package/dist/components/ui/message-scroller.js +95 -0
- package/dist/components/ui/message-scroller.js.map +1 -0
- package/dist/components/ui/message.d.ts +63 -0
- package/dist/components/ui/message.d.ts.map +1 -0
- package/dist/components/ui/message.js +92 -0
- package/dist/components/ui/message.js.map +1 -0
- package/dist/components/ui/meta-list.d.ts +55 -0
- package/dist/components/ui/meta-list.d.ts.map +1 -0
- package/dist/components/ui/meta-list.js +75 -0
- package/dist/components/ui/meta-list.js.map +1 -0
- package/dist/components/ui/native-select.d.ts +51 -0
- package/dist/components/ui/native-select.d.ts.map +1 -0
- package/dist/components/ui/native-select.js +75 -0
- package/dist/components/ui/native-select.js.map +1 -0
- package/dist/components/ui/navigation-menu.d.ts +56 -0
- package/dist/components/ui/navigation-menu.d.ts.map +1 -0
- package/dist/components/ui/navigation-menu.js +116 -0
- package/dist/components/ui/navigation-menu.js.map +1 -0
- package/dist/components/ui/page-header.d.ts +223 -0
- package/dist/components/ui/page-header.d.ts.map +1 -0
- package/dist/components/ui/page-header.js +233 -0
- package/dist/components/ui/page-header.js.map +1 -0
- package/dist/components/ui/pagination.d.ts +68 -0
- package/dist/components/ui/pagination.d.ts.map +1 -0
- package/dist/components/ui/pagination.js +145 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/popover.d.ts +61 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +144 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/progress.d.ts +35 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +46 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/questionnaire.d.ts +92 -0
- package/dist/components/ui/questionnaire.d.ts.map +1 -0
- package/dist/components/ui/questionnaire.js +277 -0
- package/dist/components/ui/questionnaire.js.map +1 -0
- package/dist/components/ui/radio-group.d.ts +50 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/radio-group.js +65 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/resizable.d.ts +44 -0
- package/dist/components/ui/resizable.d.ts.map +1 -0
- package/dist/components/ui/resizable.js +73 -0
- package/dist/components/ui/resizable.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +55 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +72 -0
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/select.d.ts +274 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +609 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/separator.d.ts +31 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +38 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/sheet.d.ts +59 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +128 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/sidebar.d.ts +166 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.js +512 -0
- package/dist/components/ui/sidebar.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +35 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +46 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/slider.d.ts +39 -0
- package/dist/components/ui/slider.d.ts.map +1 -0
- package/dist/components/ui/slider.js +75 -0
- package/dist/components/ui/slider.js.map +1 -0
- package/dist/components/ui/sonner.d.ts +56 -0
- package/dist/components/ui/sonner.d.ts.map +1 -0
- package/dist/components/ui/sonner.js +96 -0
- package/dist/components/ui/sonner.js.map +1 -0
- package/dist/components/ui/spinner.d.ts +37 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/spinner.js +51 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/stepper.d.ts +84 -0
- package/dist/components/ui/stepper.d.ts.map +1 -0
- package/dist/components/ui/stepper.js +145 -0
- package/dist/components/ui/stepper.js.map +1 -0
- package/dist/components/ui/switch.d.ts +36 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +44 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/table.d.ts +80 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +130 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +87 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +128 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +35 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea.js +38 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/time-picker.d.ts +58 -0
- package/dist/components/ui/time-picker.d.ts.map +1 -0
- package/dist/components/ui/time-picker.js +188 -0
- package/dist/components/ui/time-picker.js.map +1 -0
- package/dist/components/ui/toggle-group.d.ts +52 -0
- package/dist/components/ui/toggle-group.d.ts.map +1 -0
- package/dist/components/ui/toggle-group.js +94 -0
- package/dist/components/ui/toggle-group.js.map +1 -0
- package/dist/components/ui/toggle.d.ts +50 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/toggle.js +70 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +51 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +78 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/hooks/use-dark-mode.d.ts +2 -0
- package/dist/hooks/use-dark-mode.d.ts.map +1 -0
- package/dist/hooks/use-dark-mode.js +36 -0
- package/dist/hooks/use-dark-mode.js.map +1 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +20 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +77 -0
- package/dist/lib/scope.d.ts +64 -0
- package/dist/lib/scope.d.ts.map +1 -0
- package/dist/lib/scope.js +74 -0
- package/dist/lib/scope.js.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +11 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/theme-tokens.css +537 -0
- package/dist/theme.css +417 -0
- package/package.json +103 -3
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/ui/page-header.tsx
|
|
5
|
+
function PageHeader({ className, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
"data-slot": "page-header",
|
|
8
|
+
className: cn("@container/page-header flex w-full flex-wrap items-center justify-between gap-4 border-b border-border px-4 py-4 @max-md/page-header:gap-3 @max-md/page-header:py-3 @max-sm/page-header:flex-nowrap @max-sm/page-header:gap-2 @max-sm/page-header:px-3", className),
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function PageHeaderContent({ className, ...props }) {
|
|
13
|
+
return /* @__PURE__ */ jsx("div", {
|
|
14
|
+
"data-slot": "page-header-content",
|
|
15
|
+
className: cn("flex min-w-0 flex-1 flex-col gap-1", className),
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function PageHeaderTitle({ className, ...props }) {
|
|
20
|
+
return /* @__PURE__ */ jsx("h1", {
|
|
21
|
+
"data-slot": "page-header-title",
|
|
22
|
+
className: cn("flex min-w-0 items-center gap-2 text-xl leading-tight font-medium text-foreground @max-sm/page-header:flex-nowrap @max-sm/page-header:truncate", className),
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function PageHeaderDescription({ className, ...props }) {
|
|
27
|
+
return /* @__PURE__ */ jsx("p", {
|
|
28
|
+
"data-slot": "page-header-description",
|
|
29
|
+
className: cn("line-clamp-1 text-sm leading-snug text-muted-foreground", className),
|
|
30
|
+
...props
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function PageHeaderActions({ className, ...props }) {
|
|
34
|
+
return /* @__PURE__ */ jsx("div", {
|
|
35
|
+
"data-slot": "page-header-actions",
|
|
36
|
+
className: cn("flex shrink-0 items-center gap-2", className),
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* WHEN TO USE
|
|
42
|
+
* - Top of a detail view, list page, or full-page flow — the one heading
|
|
43
|
+
* the whole page is known by
|
|
44
|
+
* - Compose a Breadcrumb above PageHeaderTitle for pages nested more than
|
|
45
|
+
* one level deep, or a status Badge inline inside PageHeaderTitle
|
|
46
|
+
*
|
|
47
|
+
* NOT WHEN
|
|
48
|
+
* - A row inside a list — use Item
|
|
49
|
+
* - A card's own heading — use CardHeader/CardTitle
|
|
50
|
+
* - A section label inside a page — use a plain heading or Item
|
|
51
|
+
*
|
|
52
|
+
* KEY RULES
|
|
53
|
+
* - PageHeaderTitle is always text-xl/font-medium — the one page-identity
|
|
54
|
+
* heading size; don't resize or reweight it per page. Size alone (not
|
|
55
|
+
* weight) is what separates it from CardTitle/DialogTitle/SheetTitle,
|
|
56
|
+
* which are all text-base/font-medium — stacking heavier weight on top
|
|
57
|
+
* of the larger size would double up the emphasis
|
|
58
|
+
* - PageHeaderActions is optional — omit it for a title-only header
|
|
59
|
+
* - Only one PageHeader per page
|
|
60
|
+
* - No background of its own — don't add bg-* here; let the page canvas or
|
|
61
|
+
* card it sits on show through
|
|
62
|
+
* - Padding is px-4 py-4 — the same standard surface padding as
|
|
63
|
+
* Card/Dialog/AlertDialog/Sheet/Drawer's `p-4`, not a wider page-edge
|
|
64
|
+
* gutter. Was px-6 previously; that was an outlier matching no other
|
|
65
|
+
* surface in the system
|
|
66
|
+
* - PageHeaderContent is flex-1 so it fills the row instead of shrinking to
|
|
67
|
+
* the title's own width — needed for anything wider than the title placed
|
|
68
|
+
* below it (e.g. a composed description row) to have room instead of
|
|
69
|
+
* wrapping inside a title-sized column
|
|
70
|
+
* - Responsive collapsing is automatic and gradual, via `@container/page-header`
|
|
71
|
+
* on the root — no prop, no `isNarrow` boolean to thread through. It tracks
|
|
72
|
+
* the header's own rendered width live, so it degrades (and recovers) in
|
|
73
|
+
* step with wherever it's actually placed — a resizable split pane, a
|
|
74
|
+
* collapsing sidebar, a sidecar panel vs. a full page — not just a small
|
|
75
|
+
* viewport. Below `md` (28rem) gap/padding tighten but Actions can still
|
|
76
|
+
* wrap to a second line; below `sm` (24rem) the row stays on one line and
|
|
77
|
+
* the title truncates instead. A title composed with an inline Badge (see
|
|
78
|
+
* Level 1's "Default" story) will clip the badge abruptly rather than
|
|
79
|
+
* ellipsis it in that collapsed state — a real trade-off of forcing one
|
|
80
|
+
* line, not a bug; avoid that composition if the header will commonly
|
|
81
|
+
* render in a narrow container.
|
|
82
|
+
* - Headers come in two buckets: Level 0 (top-level: resource lists/tables —
|
|
83
|
+
* no breadcrumb or back button, nowhere higher to go) and Level 1+
|
|
84
|
+
* (nested/detail pages — always has a Breadcrumb or back button on the
|
|
85
|
+
* left). Both are composition, not a "level" prop.
|
|
86
|
+
* - Level 1's right side is meta text + collaborator avatars + action
|
|
87
|
+
* buttons — not just a bare Edit button like Level 0. Don't wrap those
|
|
88
|
+
* buttons in a ButtonGroup: an overflow trigger, a deferral action, and a
|
|
89
|
+
* primary CTA are unrelated actions, exactly what ButtonGroup's own docs
|
|
90
|
+
* say not to use it for — and mixing an outline button's visible border
|
|
91
|
+
* against a borderless primary button inside one leaves a stray
|
|
92
|
+
* half-border at the seam. A back button is just an icon-only Button
|
|
93
|
+
* placed before PageHeaderContent.
|
|
94
|
+
* - Those three sections (meta, avatars, actions) are spaced apart by
|
|
95
|
+
* PageHeaderActions' own `gap-2` alone — no `•` divider between them; text
|
|
96
|
+
* vs. avatars vs. buttons already read as separate groups by shape, so a
|
|
97
|
+
* glyph between them would be redundant. The action buttons themselves
|
|
98
|
+
* sit inside one `gap-1` wrapper div, tighter than the `gap-2` between
|
|
99
|
+
* sections, since they're one related cluster — that div is just a plain
|
|
100
|
+
* flex container, not a ButtonGroup (still ruled out for the reason
|
|
101
|
+
* above). Level 0's actions are nothing but buttons, so that same
|
|
102
|
+
* `gap-1` goes directly on PageHeaderActions itself
|
|
103
|
+
* (`className="gap-1"`) instead of needing an inner wrapper — there's
|
|
104
|
+
* nothing else in there for it to be scoped apart from.
|
|
105
|
+
* - Level 1 supports the same two tab treatments as Level 0: a centered nav
|
|
106
|
+
* slot in the header row ("With Centered Navigation"), or a below-header
|
|
107
|
+
* `line`-variant Tabs row with the border-b moved to an outer wrapper
|
|
108
|
+
* ("With Tabs") — see Level 1's own stories for both, composed with
|
|
109
|
+
* Breadcrumb/back-button and PageHeaderActions exactly as any other
|
|
110
|
+
* Level 1 header.
|
|
111
|
+
* - Collaborator AvatarGroup in that same right side uses the default Avatar
|
|
112
|
+
* size, not "sm" — default is size-8 (32px), matching Button's own default
|
|
113
|
+
* height and iconOnly, so avatars and buttons line up in the row.
|
|
114
|
+
* "sm" (24px) sits visibly shorter than every button beside it.
|
|
115
|
+
* - "With Tabs" is NOT Tabs as a sibling below PageHeader — that puts
|
|
116
|
+
* PageHeader's own border-b between the title and the tabs. The
|
|
117
|
+
* divider belongs at the bottom of the whole block (title row + tabs
|
|
118
|
+
* together read as one header, and the border-b sits flush against the
|
|
119
|
+
* tabs' own bottom edge — no pb on Tabs). Strip PageHeader's own border
|
|
120
|
+
* with border-b-0 and move border-b onto an outer wrapper around both
|
|
121
|
+
* rows instead
|
|
122
|
+
* - The gap between the title and the tabs is PageHeader's own bottom
|
|
123
|
+
* padding, overridden down to pb-2 — not an addition on top of it. Adding
|
|
124
|
+
* Tabs its own pt-* stacks two independent paddings and reads as a visible
|
|
125
|
+
* gap between two blocks, not "one header"
|
|
126
|
+
*
|
|
127
|
+
* USAGE
|
|
128
|
+
*
|
|
129
|
+
* // Level 0 — top-level entry point, plain actions
|
|
130
|
+
* <PageHeader>
|
|
131
|
+
* <PageHeaderContent>
|
|
132
|
+
* <PageHeaderTitle>Care Gaps</PageHeaderTitle>
|
|
133
|
+
* <PageHeaderDescription>142 open gaps across your panel</PageHeaderDescription>
|
|
134
|
+
* </PageHeaderContent>
|
|
135
|
+
* <PageHeaderActions className="gap-1">
|
|
136
|
+
* <Button variant="outline">Export</Button>
|
|
137
|
+
* <Button>Add Gap</Button>
|
|
138
|
+
* </PageHeaderActions>
|
|
139
|
+
* </PageHeader>
|
|
140
|
+
*
|
|
141
|
+
* // Level 0, "With Tabs" — pb-2 replaces PageHeader's own pb-4 rather than
|
|
142
|
+
* // stacking Tabs' own top padding on top of it; two independent paddings
|
|
143
|
+
* // between the title and the tabs read as a gap, not "one header"
|
|
144
|
+
* <div className="border-b border-border">
|
|
145
|
+
* <PageHeader className="border-b-0 pb-2">
|
|
146
|
+
* <PageHeaderContent>
|
|
147
|
+
* <PageHeaderTitle>Care Gaps</PageHeaderTitle>
|
|
148
|
+
* </PageHeaderContent>
|
|
149
|
+
* </PageHeader>
|
|
150
|
+
* <Tabs defaultValue="open">
|
|
151
|
+
* <TabsList variant="line" className="px-4">
|
|
152
|
+
* <TabsTrigger value="open">Open</TabsTrigger>
|
|
153
|
+
* <TabsTrigger value="closed">Closed</TabsTrigger>
|
|
154
|
+
* </TabsList>
|
|
155
|
+
* </Tabs>
|
|
156
|
+
* </div>
|
|
157
|
+
*
|
|
158
|
+
* // Level 0, "With Navigation" — a centered nav slot. justify-between alone
|
|
159
|
+
* // won't truly center a middle child against asymmetric siblings, so
|
|
160
|
+
* // override to a grid
|
|
161
|
+
* <PageHeader className="grid grid-cols-[1fr_auto_1fr] justify-normal">
|
|
162
|
+
* <PageHeaderContent>
|
|
163
|
+
* <PageHeaderTitle>Dashboard</PageHeaderTitle>
|
|
164
|
+
* </PageHeaderContent>
|
|
165
|
+
* <ToggleGroup type="single" defaultValue="visits" spacing={0}>
|
|
166
|
+
* <ToggleGroupItem value="visits">Virtual Visits</ToggleGroupItem>
|
|
167
|
+
* <ToggleGroupItem value="assessments">Assessments</ToggleGroupItem>
|
|
168
|
+
* </ToggleGroup>
|
|
169
|
+
* <PageHeaderActions className="justify-self-end gap-1">
|
|
170
|
+
* <Button variant="outline">Export</Button>
|
|
171
|
+
* </PageHeaderActions>
|
|
172
|
+
* </PageHeader>
|
|
173
|
+
*
|
|
174
|
+
* // Level 1 — Breadcrumb, and the meta+avatars+actions right side
|
|
175
|
+
* <PageHeader>
|
|
176
|
+
* <PageHeaderContent>
|
|
177
|
+
* <Breadcrumb>...</Breadcrumb>
|
|
178
|
+
* <PageHeaderTitle>James Wilson</PageHeaderTitle>
|
|
179
|
+
* </PageHeaderContent>
|
|
180
|
+
* <PageHeaderActions>
|
|
181
|
+
* <MetaList size="sm">
|
|
182
|
+
* <MetaListItem>Few minutes ago</MetaListItem>
|
|
183
|
+
* </MetaList>
|
|
184
|
+
* <AvatarGroup>
|
|
185
|
+
* <Avatar><AvatarFallback>JD</AvatarFallback></Avatar>
|
|
186
|
+
* <Avatar><AvatarFallback>SP</AvatarFallback></Avatar>
|
|
187
|
+
* <AvatarGroupCount>+2</AvatarGroupCount>
|
|
188
|
+
* </AvatarGroup>
|
|
189
|
+
* <div className="flex items-center gap-1">
|
|
190
|
+
* <Button variant="outline" iconOnly aria-label="More options">
|
|
191
|
+
* <EllipsisIcon />
|
|
192
|
+
* </Button>
|
|
193
|
+
* <Button variant="outline">Finish later</Button>
|
|
194
|
+
* <Button>Next</Button>
|
|
195
|
+
* </div>
|
|
196
|
+
* </PageHeaderActions>
|
|
197
|
+
* </PageHeader>
|
|
198
|
+
*
|
|
199
|
+
* // Level 1 — back button instead of a Breadcrumb, for hierarchies under 3
|
|
200
|
+
* // levels deep. Same meta+avatars+actions right side as above
|
|
201
|
+
* <PageHeader>
|
|
202
|
+
* <PageHeaderContent className="flex-row items-center gap-3">
|
|
203
|
+
* <Button variant="ghost" iconOnly aria-label="Back">
|
|
204
|
+
* <ArrowLeftIcon />
|
|
205
|
+
* </Button>
|
|
206
|
+
* <PageHeaderTitle>James Wilson</PageHeaderTitle>
|
|
207
|
+
* </PageHeaderContent>
|
|
208
|
+
* </PageHeader>
|
|
209
|
+
*
|
|
210
|
+
* // Level 1 — a richer description row: an outlined Badge with a colored icon
|
|
211
|
+
* // for status, plus a dot-separated MetaList for channels, instead of plain
|
|
212
|
+
* // text. PageHeaderDescription is a <p>, so block-level children replace it
|
|
213
|
+
* // here rather than nesting inside it
|
|
214
|
+
* <PageHeader>
|
|
215
|
+
* <PageHeaderContent>
|
|
216
|
+
* <PageHeaderTitle>Covid-19</PageHeaderTitle>
|
|
217
|
+
* <div className="flex items-center gap-3">
|
|
218
|
+
* <Badge emphasis="outline">
|
|
219
|
+
* <CheckIcon className="text-success" data-icon="inline-start" />
|
|
220
|
+
* Ongoing
|
|
221
|
+
* </Badge>
|
|
222
|
+
* <MetaList size="sm">
|
|
223
|
+
* <MetaListItem>Text</MetaListItem>
|
|
224
|
+
* <MetaListItem>Email</MetaListItem>
|
|
225
|
+
* </MetaList>
|
|
226
|
+
* </div>
|
|
227
|
+
* </PageHeaderContent>
|
|
228
|
+
* </PageHeader>
|
|
229
|
+
*/
|
|
230
|
+
//#endregion
|
|
231
|
+
export { PageHeader, PageHeaderActions, PageHeaderContent, PageHeaderDescription, PageHeaderTitle };
|
|
232
|
+
|
|
233
|
+
//# sourceMappingURL=page-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-header.js","names":[],"sources":["../../../src/components/ui/page-header.tsx"],"sourcesContent":["/**\n * PageHeader — the single top-of-page banner a page is known by.\n *\n * A composite: PageHeaderContent\n * (title + description) on the left, PageHeaderActions on the right, with a\n * border-b beneath the whole row. Deliberately has no background color of\n * its own — it sits on whatever canvas/surface it's placed on, rather than\n * painting its own tint.\n *\n * Responsive via `@container/page-header`, not a prop or a single narrow/wide\n * switch: it tracks the header's own rendered width continuously, so it\n * degrades in steps as room shrinks and recovers live if the host regrows it\n * (a resizable split pane, a sidebar that collapses/expands, a sidecar panel\n * vs. a full page) — there's no `isNarrow` boolean to compute or thread\n * through, and no fixed viewport breakpoint that misses \"narrow because of\n * placement, not because of screen size\":\n * - below `md` (28rem): gap/padding tighten (gap-3, py-3), but the row can\n * still wrap Actions to a second line if it doesn't fit\n * - below `sm` (24rem): the row stops wrapping altogether and stays on one\n * line (gap-2, px-3 — the same compact density Card uses at `size=\"sm\"`),\n * with the title truncating instead\n * This stays a plain layout container the whole way down — safe for the\n * scoped-CSS build (see Field's `orientation=\"responsive\"` for the same\n * `@container` idiom).\n */\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction PageHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"page-header\"\n className={cn(\n \"@container/page-header flex w-full flex-wrap items-center justify-between gap-4 border-b border-border px-4 py-4 @max-md/page-header:gap-3 @max-md/page-header:py-3 @max-sm/page-header:flex-nowrap @max-sm/page-header:gap-2 @max-sm/page-header:px-3\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction PageHeaderContent({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"page-header-content\"\n className={cn(\"flex min-w-0 flex-1 flex-col gap-1\", className)}\n {...props}\n />\n )\n}\n\nfunction PageHeaderTitle({ className, ...props }: React.ComponentProps<\"h1\">) {\n return (\n <h1\n data-slot=\"page-header-title\"\n className={cn(\n \"flex min-w-0 items-center gap-2 text-xl leading-tight font-medium text-foreground @max-sm/page-header:flex-nowrap @max-sm/page-header:truncate\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction PageHeaderDescription({\n className,\n ...props\n}: React.ComponentProps<\"p\">) {\n return (\n <p\n data-slot=\"page-header-description\"\n className={cn(\n \"line-clamp-1 text-sm leading-snug text-muted-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction PageHeaderActions({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"page-header-actions\"\n className={cn(\"flex shrink-0 items-center gap-2\", className)}\n {...props}\n />\n )\n}\n\nexport {\n PageHeader,\n PageHeaderContent,\n PageHeaderTitle,\n PageHeaderDescription,\n PageHeaderActions,\n}\n\n/**\n * WHEN TO USE\n * - Top of a detail view, list page, or full-page flow — the one heading\n * the whole page is known by\n * - Compose a Breadcrumb above PageHeaderTitle for pages nested more than\n * one level deep, or a status Badge inline inside PageHeaderTitle\n *\n * NOT WHEN\n * - A row inside a list — use Item\n * - A card's own heading — use CardHeader/CardTitle\n * - A section label inside a page — use a plain heading or Item\n *\n * KEY RULES\n * - PageHeaderTitle is always text-xl/font-medium — the one page-identity\n * heading size; don't resize or reweight it per page. Size alone (not\n * weight) is what separates it from CardTitle/DialogTitle/SheetTitle,\n * which are all text-base/font-medium — stacking heavier weight on top\n * of the larger size would double up the emphasis\n * - PageHeaderActions is optional — omit it for a title-only header\n * - Only one PageHeader per page\n * - No background of its own — don't add bg-* here; let the page canvas or\n * card it sits on show through\n * - Padding is px-4 py-4 — the same standard surface padding as\n * Card/Dialog/AlertDialog/Sheet/Drawer's `p-4`, not a wider page-edge\n * gutter. Was px-6 previously; that was an outlier matching no other\n * surface in the system\n * - PageHeaderContent is flex-1 so it fills the row instead of shrinking to\n * the title's own width — needed for anything wider than the title placed\n * below it (e.g. a composed description row) to have room instead of\n * wrapping inside a title-sized column\n * - Responsive collapsing is automatic and gradual, via `@container/page-header`\n * on the root — no prop, no `isNarrow` boolean to thread through. It tracks\n * the header's own rendered width live, so it degrades (and recovers) in\n * step with wherever it's actually placed — a resizable split pane, a\n * collapsing sidebar, a sidecar panel vs. a full page — not just a small\n * viewport. Below `md` (28rem) gap/padding tighten but Actions can still\n * wrap to a second line; below `sm` (24rem) the row stays on one line and\n * the title truncates instead. A title composed with an inline Badge (see\n * Level 1's \"Default\" story) will clip the badge abruptly rather than\n * ellipsis it in that collapsed state — a real trade-off of forcing one\n * line, not a bug; avoid that composition if the header will commonly\n * render in a narrow container.\n * - Headers come in two buckets: Level 0 (top-level: resource lists/tables —\n * no breadcrumb or back button, nowhere higher to go) and Level 1+\n * (nested/detail pages — always has a Breadcrumb or back button on the\n * left). Both are composition, not a \"level\" prop.\n * - Level 1's right side is meta text + collaborator avatars + action\n * buttons — not just a bare Edit button like Level 0. Don't wrap those\n * buttons in a ButtonGroup: an overflow trigger, a deferral action, and a\n * primary CTA are unrelated actions, exactly what ButtonGroup's own docs\n * say not to use it for — and mixing an outline button's visible border\n * against a borderless primary button inside one leaves a stray\n * half-border at the seam. A back button is just an icon-only Button\n * placed before PageHeaderContent.\n * - Those three sections (meta, avatars, actions) are spaced apart by\n * PageHeaderActions' own `gap-2` alone — no `•` divider between them; text\n * vs. avatars vs. buttons already read as separate groups by shape, so a\n * glyph between them would be redundant. The action buttons themselves\n * sit inside one `gap-1` wrapper div, tighter than the `gap-2` between\n * sections, since they're one related cluster — that div is just a plain\n * flex container, not a ButtonGroup (still ruled out for the reason\n * above). Level 0's actions are nothing but buttons, so that same\n * `gap-1` goes directly on PageHeaderActions itself\n * (`className=\"gap-1\"`) instead of needing an inner wrapper — there's\n * nothing else in there for it to be scoped apart from.\n * - Level 1 supports the same two tab treatments as Level 0: a centered nav\n * slot in the header row (\"With Centered Navigation\"), or a below-header\n * `line`-variant Tabs row with the border-b moved to an outer wrapper\n * (\"With Tabs\") — see Level 1's own stories for both, composed with\n * Breadcrumb/back-button and PageHeaderActions exactly as any other\n * Level 1 header.\n * - Collaborator AvatarGroup in that same right side uses the default Avatar\n * size, not \"sm\" — default is size-8 (32px), matching Button's own default\n * height and iconOnly, so avatars and buttons line up in the row.\n * \"sm\" (24px) sits visibly shorter than every button beside it.\n * - \"With Tabs\" is NOT Tabs as a sibling below PageHeader — that puts\n * PageHeader's own border-b between the title and the tabs. The\n * divider belongs at the bottom of the whole block (title row + tabs\n * together read as one header, and the border-b sits flush against the\n * tabs' own bottom edge — no pb on Tabs). Strip PageHeader's own border\n * with border-b-0 and move border-b onto an outer wrapper around both\n * rows instead\n * - The gap between the title and the tabs is PageHeader's own bottom\n * padding, overridden down to pb-2 — not an addition on top of it. Adding\n * Tabs its own pt-* stacks two independent paddings and reads as a visible\n * gap between two blocks, not \"one header\"\n *\n * USAGE\n *\n * // Level 0 — top-level entry point, plain actions\n * <PageHeader>\n * <PageHeaderContent>\n * <PageHeaderTitle>Care Gaps</PageHeaderTitle>\n * <PageHeaderDescription>142 open gaps across your panel</PageHeaderDescription>\n * </PageHeaderContent>\n * <PageHeaderActions className=\"gap-1\">\n * <Button variant=\"outline\">Export</Button>\n * <Button>Add Gap</Button>\n * </PageHeaderActions>\n * </PageHeader>\n *\n * // Level 0, \"With Tabs\" — pb-2 replaces PageHeader's own pb-4 rather than\n * // stacking Tabs' own top padding on top of it; two independent paddings\n * // between the title and the tabs read as a gap, not \"one header\"\n * <div className=\"border-b border-border\">\n * <PageHeader className=\"border-b-0 pb-2\">\n * <PageHeaderContent>\n * <PageHeaderTitle>Care Gaps</PageHeaderTitle>\n * </PageHeaderContent>\n * </PageHeader>\n * <Tabs defaultValue=\"open\">\n * <TabsList variant=\"line\" className=\"px-4\">\n * <TabsTrigger value=\"open\">Open</TabsTrigger>\n * <TabsTrigger value=\"closed\">Closed</TabsTrigger>\n * </TabsList>\n * </Tabs>\n * </div>\n *\n * // Level 0, \"With Navigation\" — a centered nav slot. justify-between alone\n * // won't truly center a middle child against asymmetric siblings, so\n * // override to a grid\n * <PageHeader className=\"grid grid-cols-[1fr_auto_1fr] justify-normal\">\n * <PageHeaderContent>\n * <PageHeaderTitle>Dashboard</PageHeaderTitle>\n * </PageHeaderContent>\n * <ToggleGroup type=\"single\" defaultValue=\"visits\" spacing={0}>\n * <ToggleGroupItem value=\"visits\">Virtual Visits</ToggleGroupItem>\n * <ToggleGroupItem value=\"assessments\">Assessments</ToggleGroupItem>\n * </ToggleGroup>\n * <PageHeaderActions className=\"justify-self-end gap-1\">\n * <Button variant=\"outline\">Export</Button>\n * </PageHeaderActions>\n * </PageHeader>\n *\n * // Level 1 — Breadcrumb, and the meta+avatars+actions right side\n * <PageHeader>\n * <PageHeaderContent>\n * <Breadcrumb>...</Breadcrumb>\n * <PageHeaderTitle>James Wilson</PageHeaderTitle>\n * </PageHeaderContent>\n * <PageHeaderActions>\n * <MetaList size=\"sm\">\n * <MetaListItem>Few minutes ago</MetaListItem>\n * </MetaList>\n * <AvatarGroup>\n * <Avatar><AvatarFallback>JD</AvatarFallback></Avatar>\n * <Avatar><AvatarFallback>SP</AvatarFallback></Avatar>\n * <AvatarGroupCount>+2</AvatarGroupCount>\n * </AvatarGroup>\n * <div className=\"flex items-center gap-1\">\n * <Button variant=\"outline\" iconOnly aria-label=\"More options\">\n * <EllipsisIcon />\n * </Button>\n * <Button variant=\"outline\">Finish later</Button>\n * <Button>Next</Button>\n * </div>\n * </PageHeaderActions>\n * </PageHeader>\n *\n * // Level 1 — back button instead of a Breadcrumb, for hierarchies under 3\n * // levels deep. Same meta+avatars+actions right side as above\n * <PageHeader>\n * <PageHeaderContent className=\"flex-row items-center gap-3\">\n * <Button variant=\"ghost\" iconOnly aria-label=\"Back\">\n * <ArrowLeftIcon />\n * </Button>\n * <PageHeaderTitle>James Wilson</PageHeaderTitle>\n * </PageHeaderContent>\n * </PageHeader>\n *\n * // Level 1 — a richer description row: an outlined Badge with a colored icon\n * // for status, plus a dot-separated MetaList for channels, instead of plain\n * // text. PageHeaderDescription is a <p>, so block-level children replace it\n * // here rather than nesting inside it\n * <PageHeader>\n * <PageHeaderContent>\n * <PageHeaderTitle>Covid-19</PageHeaderTitle>\n * <div className=\"flex items-center gap-3\">\n * <Badge emphasis=\"outline\">\n * <CheckIcon className=\"text-success\" data-icon=\"inline-start\" />\n * Ongoing\n * </Badge>\n * <MetaList size=\"sm\">\n * <MetaListItem>Text</MetaListItem>\n * <MetaListItem>Email</MetaListItem>\n * </MetaList>\n * </div>\n * </PageHeaderContent>\n * </PageHeader>\n */\n"],"mappings":";;;;AA8BA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,0PACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SAC2B;CAC9B,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,sCAAsC,SAAS;EAC7D,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,gBAAgB,EAAE,WAAW,GAAG,SAAqC;CAC5E,OACE,oBAAC,MAAD;EACE,aAAU;EACV,WAAW,GACT,kJACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,sBAAsB,EAC7B,WACA,GAAG,SACyB;CAC5B,OACE,oBAAC,KAAD;EACE,aAAU;EACV,WAAW,GACT,2DACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SAC2B;CAC9B,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,oCAAoC,SAAS;EAC3D,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pagination — page-number navigation.
|
|
3
|
+
*
|
|
4
|
+
* Plain markup that composes Button under the hood for each link, so
|
|
5
|
+
* link styling (ghost / outline for the active page) comes from Button, not
|
|
6
|
+
* a separate pagination style.
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { Button } from "../../components/ui/button";
|
|
10
|
+
declare function Pagination({ className, ...props }: React.ComponentProps<"nav">): React.JSX.Element;
|
|
11
|
+
declare function PaginationContent({ className, ...props }: React.ComponentProps<"ul">): React.JSX.Element;
|
|
12
|
+
declare function PaginationItem({ ...props }: React.ComponentProps<"li">): React.JSX.Element;
|
|
13
|
+
type PaginationLinkProps = {
|
|
14
|
+
isActive?: boolean;
|
|
15
|
+
/** Boundary state (e.g. Previous on page 1, Next on the last page) — `disabled` on an `<a>` is otherwise a no-op (HTML `disabled` only applies to form controls, so Button's own `disabled:` styling never fires here). Sets `aria-disabled`, drops `href` so it's no longer a real link, and removes it from the tab order. */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
} & Pick<React.ComponentProps<typeof Button>, "size"> & React.ComponentProps<"a">;
|
|
18
|
+
/**
|
|
19
|
+
* Renders an `<a>` when `href` is given — real per-page URLs, the
|
|
20
|
+
* component's original and still-primary shape. Omit `href` entirely (not
|
|
21
|
+
* just falsy) for in-memory pagination with no URL of its own (e.g.
|
|
22
|
+
* DataTable's own client-side page state) and this renders a real
|
|
23
|
+
* `<button type="button">` instead: an `<a>` with no `href` isn't a link at
|
|
24
|
+
* all, semantically or for keyboard reach — it doesn't get a default
|
|
25
|
+
* action, and support for still focusing it varies by browser — so this
|
|
26
|
+
* isn't a style choice, it's what makes the *href-less* case actually
|
|
27
|
+
* behave like the control it looks like.
|
|
28
|
+
*/
|
|
29
|
+
declare function PaginationLink({ className, isActive, disabled, size, href, onClick, ...props }: PaginationLinkProps): React.JSX.Element;
|
|
30
|
+
declare function PaginationPrevious({ className, text, ...props }: React.ComponentProps<typeof PaginationLink> & {
|
|
31
|
+
text?: string;
|
|
32
|
+
}): React.JSX.Element;
|
|
33
|
+
declare function PaginationNext({ className, text, ...props }: React.ComponentProps<typeof PaginationLink> & {
|
|
34
|
+
text?: string;
|
|
35
|
+
}): React.JSX.Element;
|
|
36
|
+
declare function PaginationEllipsis({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
37
|
+
export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, };
|
|
38
|
+
/**
|
|
39
|
+
* WHEN TO USE
|
|
40
|
+
* - Paging through a table or list that spans more than one page, where
|
|
41
|
+
* each page has its own URL/href
|
|
42
|
+
*
|
|
43
|
+
* NOT WHEN
|
|
44
|
+
* - Infinite or virtual scrolling
|
|
45
|
+
* - Data that always fits on one page
|
|
46
|
+
*
|
|
47
|
+
* KEY RULES
|
|
48
|
+
* - Mark the current page with `isActive` on PaginationLink — renders
|
|
49
|
+
* variant="outline" instead of "ghost" and sets aria-current="page"
|
|
50
|
+
* - PaginationEllipsis stands in for skipped page ranges, not a real control
|
|
51
|
+
* - PaginationPrevious/Next hide their text label below the sm breakpoint,
|
|
52
|
+
* showing only the icon
|
|
53
|
+
* - Pass `disabled` on PaginationPrevious/Next at a boundary (page 1 has no previous, the last
|
|
54
|
+
* page has no next) — a plain `disabled` attribute is a no-op on an `<a>`, so this prop instead
|
|
55
|
+
* sets `aria-disabled`, drops `href`, and removes it from the tab order
|
|
56
|
+
*
|
|
57
|
+
* USAGE
|
|
58
|
+
* <Pagination>
|
|
59
|
+
* <PaginationContent>
|
|
60
|
+
* <PaginationItem><PaginationPrevious href="?page=1" /></PaginationItem>
|
|
61
|
+
* <PaginationItem><PaginationLink href="?page=1">1</PaginationLink></PaginationItem>
|
|
62
|
+
* <PaginationItem><PaginationLink href="?page=2" isActive>2</PaginationLink></PaginationItem>
|
|
63
|
+
* <PaginationItem><PaginationEllipsis /></PaginationItem>
|
|
64
|
+
* <PaginationItem><PaginationNext href="?page=3" /></PaginationItem>
|
|
65
|
+
* </PaginationContent>
|
|
66
|
+
* </Pagination>
|
|
67
|
+
*/
|
|
68
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../src/components/ui/pagination.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAO/C,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAUvE;AAED,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,qBAQ5B;AAED,iBAAS,cAAc,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,qBAE/D;AAED,KAAK,mBAAmB,GAAG;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gUAAgU;IAChU,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,EAAE,MAAM,CAAC,GACnD,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAA;AAE3B;;;;;;;;;;GAUG;AACH,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,IAAa,EACb,IAAI,EACJ,OAAO,EACP,GAAG,KAAK,EACT,EAAE,mBAAmB,qBAiDrB;AAED,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,IAAiB,EACjB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,qBAYjE;AAED,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,IAAa,EACb,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,qBAYjE;AAED,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,qBAe9B;AAED,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils.js";
|
|
2
|
+
import { Button } from "./button.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from "lucide-react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/ui/pagination.tsx
|
|
7
|
+
function Pagination({ className, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
9
|
+
role: "navigation",
|
|
10
|
+
"aria-label": "pagination",
|
|
11
|
+
"data-slot": "pagination",
|
|
12
|
+
className: cn("mx-auto flex w-full justify-center", className),
|
|
13
|
+
...props
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function PaginationContent({ className, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
18
|
+
"data-slot": "pagination-content",
|
|
19
|
+
className: cn("flex items-center gap-0.5", className),
|
|
20
|
+
...props
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function PaginationItem({ ...props }) {
|
|
24
|
+
return /* @__PURE__ */ jsx("li", {
|
|
25
|
+
"data-slot": "pagination-item",
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Renders an `<a>` when `href` is given — real per-page URLs, the
|
|
31
|
+
* component's original and still-primary shape. Omit `href` entirely (not
|
|
32
|
+
* just falsy) for in-memory pagination with no URL of its own (e.g.
|
|
33
|
+
* DataTable's own client-side page state) and this renders a real
|
|
34
|
+
* `<button type="button">` instead: an `<a>` with no `href` isn't a link at
|
|
35
|
+
* all, semantically or for keyboard reach — it doesn't get a default
|
|
36
|
+
* action, and support for still focusing it varies by browser — so this
|
|
37
|
+
* isn't a style choice, it's what makes the *href-less* case actually
|
|
38
|
+
* behave like the control it looks like.
|
|
39
|
+
*/
|
|
40
|
+
function PaginationLink({ className, isActive, disabled, size = "icon", href, onClick, ...props }) {
|
|
41
|
+
if (href === void 0) {
|
|
42
|
+
const { id, style, children, "aria-label": ariaLabel } = props;
|
|
43
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
44
|
+
id,
|
|
45
|
+
style,
|
|
46
|
+
children,
|
|
47
|
+
"aria-label": ariaLabel,
|
|
48
|
+
type: "button",
|
|
49
|
+
variant: isActive ? "outline" : "ghost",
|
|
50
|
+
size,
|
|
51
|
+
disabled,
|
|
52
|
+
"aria-current": isActive ? "page" : void 0,
|
|
53
|
+
"data-slot": "pagination-link",
|
|
54
|
+
"data-active": isActive,
|
|
55
|
+
onClick,
|
|
56
|
+
className
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
60
|
+
asChild: true,
|
|
61
|
+
variant: isActive ? "outline" : "ghost",
|
|
62
|
+
size,
|
|
63
|
+
className: cn(disabled && "pointer-events-none opacity-50", className),
|
|
64
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
65
|
+
"aria-current": isActive ? "page" : void 0,
|
|
66
|
+
"aria-disabled": disabled || void 0,
|
|
67
|
+
"data-slot": "pagination-link",
|
|
68
|
+
"data-active": isActive,
|
|
69
|
+
href: disabled ? void 0 : href,
|
|
70
|
+
tabIndex: disabled ? -1 : void 0,
|
|
71
|
+
onClick: disabled ? void 0 : onClick,
|
|
72
|
+
...props
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function PaginationPrevious({ className, text = "Previous", ...props }) {
|
|
77
|
+
return /* @__PURE__ */ jsxs(PaginationLink, {
|
|
78
|
+
"aria-label": "Go to previous page",
|
|
79
|
+
size: "default",
|
|
80
|
+
className: cn("pl-1.5!", className),
|
|
81
|
+
...props,
|
|
82
|
+
children: [/* @__PURE__ */ jsx(ChevronLeftIcon, { "data-icon": "inline-start" }), /* @__PURE__ */ jsx("span", {
|
|
83
|
+
className: "hidden sm:block",
|
|
84
|
+
children: text
|
|
85
|
+
})]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function PaginationNext({ className, text = "Next", ...props }) {
|
|
89
|
+
return /* @__PURE__ */ jsxs(PaginationLink, {
|
|
90
|
+
"aria-label": "Go to next page",
|
|
91
|
+
size: "default",
|
|
92
|
+
className: cn("pr-1.5!", className),
|
|
93
|
+
...props,
|
|
94
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
95
|
+
className: "hidden sm:block",
|
|
96
|
+
children: text
|
|
97
|
+
}), /* @__PURE__ */ jsx(ChevronRightIcon, { "data-icon": "inline-end" })]
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function PaginationEllipsis({ className, ...props }) {
|
|
101
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
102
|
+
"aria-hidden": true,
|
|
103
|
+
"data-slot": "pagination-ellipsis",
|
|
104
|
+
className: cn("flex size-8 items-center justify-center [&_svg:not([class*='size-'])]:size-4", className),
|
|
105
|
+
...props,
|
|
106
|
+
children: [/* @__PURE__ */ jsx(MoreHorizontalIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
107
|
+
className: "sr-only",
|
|
108
|
+
children: "More pages"
|
|
109
|
+
})]
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* WHEN TO USE
|
|
114
|
+
* - Paging through a table or list that spans more than one page, where
|
|
115
|
+
* each page has its own URL/href
|
|
116
|
+
*
|
|
117
|
+
* NOT WHEN
|
|
118
|
+
* - Infinite or virtual scrolling
|
|
119
|
+
* - Data that always fits on one page
|
|
120
|
+
*
|
|
121
|
+
* KEY RULES
|
|
122
|
+
* - Mark the current page with `isActive` on PaginationLink — renders
|
|
123
|
+
* variant="outline" instead of "ghost" and sets aria-current="page"
|
|
124
|
+
* - PaginationEllipsis stands in for skipped page ranges, not a real control
|
|
125
|
+
* - PaginationPrevious/Next hide their text label below the sm breakpoint,
|
|
126
|
+
* showing only the icon
|
|
127
|
+
* - Pass `disabled` on PaginationPrevious/Next at a boundary (page 1 has no previous, the last
|
|
128
|
+
* page has no next) — a plain `disabled` attribute is a no-op on an `<a>`, so this prop instead
|
|
129
|
+
* sets `aria-disabled`, drops `href`, and removes it from the tab order
|
|
130
|
+
*
|
|
131
|
+
* USAGE
|
|
132
|
+
* <Pagination>
|
|
133
|
+
* <PaginationContent>
|
|
134
|
+
* <PaginationItem><PaginationPrevious href="?page=1" /></PaginationItem>
|
|
135
|
+
* <PaginationItem><PaginationLink href="?page=1">1</PaginationLink></PaginationItem>
|
|
136
|
+
* <PaginationItem><PaginationLink href="?page=2" isActive>2</PaginationLink></PaginationItem>
|
|
137
|
+
* <PaginationItem><PaginationEllipsis /></PaginationItem>
|
|
138
|
+
* <PaginationItem><PaginationNext href="?page=3" /></PaginationItem>
|
|
139
|
+
* </PaginationContent>
|
|
140
|
+
* </Pagination>
|
|
141
|
+
*/
|
|
142
|
+
//#endregion
|
|
143
|
+
export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious };
|
|
144
|
+
|
|
145
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","names":[],"sources":["../../../src/components/ui/pagination.tsx"],"sourcesContent":["/**\n * Pagination — page-number navigation.\n *\n * Plain markup that composes Button under the hood for each link, so\n * link styling (ghost / outline for the active page) comes from Button, not\n * a separate pagination style.\n */\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n ChevronLeftIcon,\n ChevronRightIcon,\n MoreHorizontalIcon,\n} from \"lucide-react\"\n\nfunction Pagination({ className, ...props }: React.ComponentProps<\"nav\">) {\n return (\n <nav\n role=\"navigation\"\n aria-label=\"pagination\"\n data-slot=\"pagination\"\n className={cn(\"mx-auto flex w-full justify-center\", className)}\n {...props}\n />\n )\n}\n\nfunction PaginationContent({\n className,\n ...props\n}: React.ComponentProps<\"ul\">) {\n return (\n <ul\n data-slot=\"pagination-content\"\n className={cn(\"flex items-center gap-0.5\", className)}\n {...props}\n />\n )\n}\n\nfunction PaginationItem({ ...props }: React.ComponentProps<\"li\">) {\n return <li data-slot=\"pagination-item\" {...props} />\n}\n\ntype PaginationLinkProps = {\n isActive?: boolean\n /** Boundary state (e.g. Previous on page 1, Next on the last page) — `disabled` on an `<a>` is otherwise a no-op (HTML `disabled` only applies to form controls, so Button's own `disabled:` styling never fires here). Sets `aria-disabled`, drops `href` so it's no longer a real link, and removes it from the tab order. */\n disabled?: boolean\n} & Pick<React.ComponentProps<typeof Button>, \"size\"> &\n React.ComponentProps<\"a\">\n\n/**\n * Renders an `<a>` when `href` is given — real per-page URLs, the\n * component's original and still-primary shape. Omit `href` entirely (not\n * just falsy) for in-memory pagination with no URL of its own (e.g.\n * DataTable's own client-side page state) and this renders a real\n * `<button type=\"button\">` instead: an `<a>` with no `href` isn't a link at\n * all, semantically or for keyboard reach — it doesn't get a default\n * action, and support for still focusing it varies by browser — so this\n * isn't a style choice, it's what makes the *href-less* case actually\n * behave like the control it looks like.\n */\nfunction PaginationLink({\n className,\n isActive,\n disabled,\n size = \"icon\",\n href,\n onClick,\n ...props\n}: PaginationLinkProps) {\n if (href === undefined) {\n // Only the handful of plain attributes this component's own callers\n // (PaginationPrevious/Next, or a direct PaginationLink) actually pass\n // — an allowlist rather than dropping anchor-only ones (`target`/\n // `rel`/`download`/a `ref` typed for the wrong element/`<a>`'s own\n // `type`, a MIME-type hint, not a `<button>`'s) out of `...props`,\n // since Button's own props are a discriminated union keyed off\n // `iconOnly`/`size` (see button.tsx) that a wider, untyped bag would\n // fail to satisfy. `any` on the element below is that union giving up\n // gracefully on a dynamic value, not a loosened contract on\n // `PaginationLink`'s own typed props above.\n const { id, style, children, \"aria-label\": ariaLabel } = props\n const buttonElementProps: Record<string, unknown> = {\n id,\n style,\n children,\n \"aria-label\": ariaLabel,\n type: \"button\",\n variant: isActive ? \"outline\" : \"ghost\",\n size,\n disabled,\n \"aria-current\": isActive ? \"page\" : undefined,\n \"data-slot\": \"pagination-link\",\n \"data-active\": isActive,\n onClick,\n className,\n }\n return <Button {...(buttonElementProps as any)} />\n }\n return (\n <Button\n asChild\n variant={isActive ? \"outline\" : \"ghost\"}\n size={size}\n className={cn(disabled && \"pointer-events-none opacity-50\", className)}\n >\n <a\n aria-current={isActive ? \"page\" : undefined}\n aria-disabled={disabled || undefined}\n data-slot=\"pagination-link\"\n data-active={isActive}\n href={disabled ? undefined : href}\n tabIndex={disabled ? -1 : undefined}\n onClick={disabled ? undefined : onClick}\n {...props}\n />\n </Button>\n )\n}\n\nfunction PaginationPrevious({\n className,\n text = \"Previous\",\n ...props\n}: React.ComponentProps<typeof PaginationLink> & { text?: string }) {\n return (\n <PaginationLink\n aria-label=\"Go to previous page\"\n size=\"default\"\n className={cn(\"pl-1.5!\", className)}\n {...props}\n >\n <ChevronLeftIcon data-icon=\"inline-start\" />\n <span className=\"hidden sm:block\">{text}</span>\n </PaginationLink>\n )\n}\n\nfunction PaginationNext({\n className,\n text = \"Next\",\n ...props\n}: React.ComponentProps<typeof PaginationLink> & { text?: string }) {\n return (\n <PaginationLink\n aria-label=\"Go to next page\"\n size=\"default\"\n className={cn(\"pr-1.5!\", className)}\n {...props}\n >\n <span className=\"hidden sm:block\">{text}</span>\n <ChevronRightIcon data-icon=\"inline-end\" />\n </PaginationLink>\n )\n}\n\nfunction PaginationEllipsis({\n className,\n ...props\n}: React.ComponentProps<\"span\">) {\n return (\n <span\n aria-hidden\n data-slot=\"pagination-ellipsis\"\n className={cn(\n \"flex size-8 items-center justify-center [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n <MoreHorizontalIcon />\n <span className=\"sr-only\">More pages</span>\n </span>\n )\n}\n\nexport {\n Pagination,\n PaginationContent,\n PaginationEllipsis,\n PaginationItem,\n PaginationLink,\n PaginationNext,\n PaginationPrevious,\n}\n\n/**\n * WHEN TO USE\n * - Paging through a table or list that spans more than one page, where\n * each page has its own URL/href\n *\n * NOT WHEN\n * - Infinite or virtual scrolling\n * - Data that always fits on one page\n *\n * KEY RULES\n * - Mark the current page with `isActive` on PaginationLink — renders\n * variant=\"outline\" instead of \"ghost\" and sets aria-current=\"page\"\n * - PaginationEllipsis stands in for skipped page ranges, not a real control\n * - PaginationPrevious/Next hide their text label below the sm breakpoint,\n * showing only the icon\n * - Pass `disabled` on PaginationPrevious/Next at a boundary (page 1 has no previous, the last\n * page has no next) — a plain `disabled` attribute is a no-op on an `<a>`, so this prop instead\n * sets `aria-disabled`, drops `href`, and removes it from the tab order\n *\n * USAGE\n * <Pagination>\n * <PaginationContent>\n * <PaginationItem><PaginationPrevious href=\"?page=1\" /></PaginationItem>\n * <PaginationItem><PaginationLink href=\"?page=1\">1</PaginationLink></PaginationItem>\n * <PaginationItem><PaginationLink href=\"?page=2\" isActive>2</PaginationLink></PaginationItem>\n * <PaginationItem><PaginationEllipsis /></PaginationItem>\n * <PaginationItem><PaginationNext href=\"?page=3\" /></PaginationItem>\n * </PaginationContent>\n * </Pagination>\n */\n"],"mappings":";;;;;;AAkBA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,oBAAC,OAAD;EACE,MAAK;EACL,cAAW;EACX,aAAU;EACV,WAAW,GAAG,sCAAsC,SAAS;EAC7D,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SAC0B;CAC7B,OACE,oBAAC,MAAD;EACE,aAAU;EACV,WAAW,GAAG,6BAA6B,SAAS;EACpD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,eAAe,EAAE,GAAG,SAAqC;CAChE,OAAO,oBAAC,MAAD;EAAI,aAAU;EAAkB,GAAI;CAAQ,CAAA;AACrD;;;;;;;;;;;;AAoBA,SAAS,eAAe,EACtB,WACA,UACA,UACA,OAAO,QACP,MACA,SACA,GAAG,SACmB;CACtB,IAAI,SAAS,KAAA,GAAW;EAWtB,MAAM,EAAE,IAAI,OAAO,UAAU,cAAc,cAAc;EAgBzD,OAAO,oBAAC,QAAD;GAdL;GACA;GACA;GACA,cAAc;GACd,MAAM;GACN,SAAS,WAAW,YAAY;GAChC;GACA;GACA,gBAAgB,WAAW,SAAS,KAAA;GACpC,aAAa;GACb,eAAe;GACf;GACA;EAE+C,CAAA;CACnD;CACA,OACE,oBAAC,QAAD;EACE,SAAA;EACA,SAAS,WAAW,YAAY;EAC1B;EACN,WAAW,GAAG,YAAY,kCAAkC,SAAS;EAErE,UAAA,oBAAC,KAAD;GACE,gBAAc,WAAW,SAAS,KAAA;GAClC,iBAAe,YAAY,KAAA;GAC3B,aAAU;GACV,eAAa;GACb,MAAM,WAAW,KAAA,IAAY;GAC7B,UAAU,WAAW,KAAK,KAAA;GAC1B,SAAS,WAAW,KAAA,IAAY;GAChC,GAAI;EACL,CAAA;CACK,CAAA;AAEZ;AAEA,SAAS,mBAAmB,EAC1B,WACA,OAAO,YACP,GAAG,SAC+D;CAClE,OACE,qBAAC,gBAAD;EACE,cAAW;EACX,MAAK;EACL,WAAW,GAAG,WAAW,SAAS;EAClC,GAAI;EAJN,UAAA,CAME,oBAAC,iBAAD,EAAiB,aAAU,eAAgB,CAAA,GAC3C,oBAAC,QAAD;GAAM,WAAU;GAAmB,UAAA;EAAW,CAAA,CAChC;;AAEpB;AAEA,SAAS,eAAe,EACtB,WACA,OAAO,QACP,GAAG,SAC+D;CAClE,OACE,qBAAC,gBAAD;EACE,cAAW;EACX,MAAK;EACL,WAAW,GAAG,WAAW,SAAS;EAClC,GAAI;EAJN,UAAA,CAME,oBAAC,QAAD;GAAM,WAAU;GAAmB,UAAA;EAAW,CAAA,GAC9C,oBAAC,kBAAD,EAAkB,aAAU,aAAc,CAAA,CAC5B;;AAEpB;AAEA,SAAS,mBAAmB,EAC1B,WACA,GAAG,SAC4B;CAC/B,OACE,qBAAC,QAAD;EACE,eAAA;EACA,aAAU;EACV,WAAW,GACT,gFACA,SACF;EACA,GAAI;EAPN,UAAA,CASE,oBAAC,oBAAD,CAAqB,CAAA,GACrB,oBAAC,QAAD;GAAM,WAAU;GAAU,UAAA;EAAgB,CAAA,CACtC;;AAEV"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Popover — floating panel anchored to a trigger, opened by click.
|
|
3
|
+
*
|
|
4
|
+
* Built on the Radix Popover primitive. Adds PopoverHeader/PopoverTitle/
|
|
5
|
+
* PopoverDescription slots, matching the Header/Title/Description pattern
|
|
6
|
+
* used across this overlay family (Sheet, AlertDialog, Drawer).
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
10
|
+
declare function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>): React.JSX.Element;
|
|
11
|
+
declare function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>): React.JSX.Element;
|
|
12
|
+
declare function PopoverContent({ className, align, sideOffset, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): React.JSX.Element;
|
|
13
|
+
declare function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>): React.JSX.Element;
|
|
14
|
+
declare function PopoverHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
15
|
+
declare function PopoverTitle({ className, id, ...props }: React.ComponentProps<"h2">): React.JSX.Element;
|
|
16
|
+
declare function PopoverDescription({ className, id, ...props }: React.ComponentProps<"p">): React.JSX.Element;
|
|
17
|
+
export { Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, };
|
|
18
|
+
/**
|
|
19
|
+
* WHEN TO USE
|
|
20
|
+
* - Controls or detail anchored to an element that the user opts into by
|
|
21
|
+
* clicking — date pickers, filter forms, quick-edit panels
|
|
22
|
+
* - Content that's interactive (inputs, buttons) but doesn't need full
|
|
23
|
+
* modal focus-trapping
|
|
24
|
+
*
|
|
25
|
+
* NOT WHEN
|
|
26
|
+
* - A plain, non-interactive hover label — use Tooltip
|
|
27
|
+
* - A richer hover-triggered preview with no click required — use HoverCard
|
|
28
|
+
* - The interaction must interrupt the page and trap focus — use Dialog
|
|
29
|
+
*
|
|
30
|
+
* KEY RULES
|
|
31
|
+
* - Opens on click via PopoverTrigger, not hover — this is the trigger
|
|
32
|
+
* mechanism that separates it from Tooltip/HoverCard
|
|
33
|
+
* - `align` defaults to "center", `sideOffset` defaults to 4
|
|
34
|
+
* - PopoverContent is 18rem (w-72) wide by default; override via className
|
|
35
|
+
* - PopoverAnchor lets you anchor the content to a different element than
|
|
36
|
+
* the trigger (e.g. anchor to an input while triggering from a button)
|
|
37
|
+
* - PopoverContent's `role="dialog"` picks up `aria-labelledby`/`aria-describedby` automatically
|
|
38
|
+
* from PopoverTitle/PopoverDescription rendered anywhere inside the same Popover — pass an
|
|
39
|
+
* explicit `aria-label`/`aria-labelledby` yourself only to override that default
|
|
40
|
+
*
|
|
41
|
+
* USAGE
|
|
42
|
+
* <Popover>
|
|
43
|
+
* <PopoverTrigger asChild><Button variant="outline">Open popover</Button></PopoverTrigger>
|
|
44
|
+
* <PopoverContent className="w-72">
|
|
45
|
+
* <PopoverHeader>
|
|
46
|
+
* <PopoverTitle>Dimensions</PopoverTitle>
|
|
47
|
+
* <PopoverDescription>Set the layout dimensions.</PopoverDescription>
|
|
48
|
+
* </PopoverHeader>
|
|
49
|
+
* <div className="grid gap-3">
|
|
50
|
+
* <div className="grid gap-2">
|
|
51
|
+
* <Label htmlFor="width">Width</Label>
|
|
52
|
+
* <Input id="width" defaultValue="100%" />
|
|
53
|
+
* </div>
|
|
54
|
+
* </div>
|
|
55
|
+
* </PopoverContent>
|
|
56
|
+
* </Popover>
|
|
57
|
+
*
|
|
58
|
+
* // Placement
|
|
59
|
+
* <PopoverContent side="right">Anchored right.</PopoverContent>
|
|
60
|
+
*/
|
|
61
|
+
//# sourceMappingURL=popover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../../src/components/ui/popover.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAiBtD,iBAAS,OAAO,CAAC,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,qBAepD;AAED,iBAAS,cAAc,CAAC,EACtB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,OAAO,CAAC,qBAEvD;AAED,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,KAAgB,EAChB,UAAc,EACd,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,EACnC,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,OAAO,CAAC,qBAuBvD;AAED,iBAAS,aAAa,CAAC,EACrB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,MAAM,CAAC,qBAEtD;AAED,iBAAS,aAAa,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAQ1E;AAED,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,EAAE,EACF,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,qBAmB5B;AAED,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,EAAE,EACF,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,qBAmB3B;AAED,OAAO,EACL,OAAO,EACP,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,cAAc,GACf,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG"}
|