@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,163 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { Button, buttonVariants } from "./button.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
8
|
+
//#region src/components/ui/calendar.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Calendar — inline calendar grid for date selection.
|
|
11
|
+
*
|
|
12
|
+
* MMDS supplies classNames, a custom day button (CalendarDayButton), and
|
|
13
|
+
* chevron icons over the react-day-picker date-grid engine.
|
|
14
|
+
*/
|
|
15
|
+
function Calendar({ className, classNames, showOutsideDays = true, captionLayout = "label", buttonVariant = "ghost", locale, formatters, components, ...props }) {
|
|
16
|
+
const defaultClassNames = getDefaultClassNames();
|
|
17
|
+
return /* @__PURE__ */ jsx(DayPicker, {
|
|
18
|
+
showOutsideDays,
|
|
19
|
+
className: cn("group/calendar bg-card p-2 [--cell-radius:var(--radius-md,0.375rem)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent", String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className),
|
|
20
|
+
captionLayout,
|
|
21
|
+
locale,
|
|
22
|
+
formatters: {
|
|
23
|
+
formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: "short" }),
|
|
24
|
+
...formatters
|
|
25
|
+
},
|
|
26
|
+
classNames: {
|
|
27
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
28
|
+
months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
|
|
29
|
+
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
30
|
+
nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
|
|
31
|
+
button_previous: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_previous),
|
|
32
|
+
button_next: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_next),
|
|
33
|
+
month_caption: cn("flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)", defaultClassNames.month_caption),
|
|
34
|
+
dropdowns: cn("flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium", defaultClassNames.dropdowns),
|
|
35
|
+
dropdown_root: cn("relative rounded-(--cell-radius)", defaultClassNames.dropdown_root),
|
|
36
|
+
dropdown: cn("absolute inset-0 bg-popover opacity-0", defaultClassNames.dropdown),
|
|
37
|
+
caption_label: cn("font-medium select-none", captionLayout === "label" ? "text-sm" : "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground", defaultClassNames.caption_label),
|
|
38
|
+
month_grid: cn("w-full border-collapse", defaultClassNames.month_grid),
|
|
39
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
40
|
+
weekday: cn("flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none", defaultClassNames.weekday),
|
|
41
|
+
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
42
|
+
week_number_header: cn("w-(--cell-size) select-none", defaultClassNames.week_number_header),
|
|
43
|
+
week_number: cn("text-[0.8rem] text-muted-foreground select-none", defaultClassNames.week_number),
|
|
44
|
+
day: cn("group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)", props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)" : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)", defaultClassNames.day),
|
|
45
|
+
range_start: cn("relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted", defaultClassNames.range_start),
|
|
46
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
47
|
+
range_end: cn("relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted", defaultClassNames.range_end),
|
|
48
|
+
today: cn("rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none", defaultClassNames.today),
|
|
49
|
+
outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
|
|
50
|
+
disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
|
|
51
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
52
|
+
...classNames
|
|
53
|
+
},
|
|
54
|
+
components: {
|
|
55
|
+
Root: ({ className, rootRef, ...props }) => {
|
|
56
|
+
return /* @__PURE__ */ jsx("div", {
|
|
57
|
+
"data-slot": "calendar",
|
|
58
|
+
ref: rootRef,
|
|
59
|
+
className: cn(className),
|
|
60
|
+
...props
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
Chevron: ({ className, orientation, ...props }) => {
|
|
64
|
+
if (orientation === "left") return /* @__PURE__ */ jsx(ChevronLeftIcon, {
|
|
65
|
+
className: cn("size-4", className),
|
|
66
|
+
...props
|
|
67
|
+
});
|
|
68
|
+
if (orientation === "right") return /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
69
|
+
className: cn("size-4", className),
|
|
70
|
+
...props
|
|
71
|
+
});
|
|
72
|
+
return /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
73
|
+
className: cn("size-4", className),
|
|
74
|
+
...props
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
DayButton: ({ ...props }) => /* @__PURE__ */ jsx(CalendarDayButton, {
|
|
78
|
+
locale,
|
|
79
|
+
...props
|
|
80
|
+
}),
|
|
81
|
+
WeekNumber: ({ children, ...props }) => {
|
|
82
|
+
return /* @__PURE__ */ jsx("td", {
|
|
83
|
+
...props,
|
|
84
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
85
|
+
className: "flex size-(--cell-size) items-center justify-center text-center",
|
|
86
|
+
children
|
|
87
|
+
})
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
...components
|
|
91
|
+
},
|
|
92
|
+
...props
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function CalendarDayButton({ className, day, modifiers, locale, ...props }) {
|
|
96
|
+
const defaultClassNames = getDefaultClassNames();
|
|
97
|
+
const ref = React.useRef(null);
|
|
98
|
+
React.useEffect(() => {
|
|
99
|
+
if (modifiers.focused) ref.current?.focus();
|
|
100
|
+
}, [modifiers.focused]);
|
|
101
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
102
|
+
ref,
|
|
103
|
+
variant: "ghost",
|
|
104
|
+
iconOnly: true,
|
|
105
|
+
"aria-label": day.date.toLocaleDateString(locale?.code, {
|
|
106
|
+
weekday: "long",
|
|
107
|
+
year: "numeric",
|
|
108
|
+
month: "long",
|
|
109
|
+
day: "numeric"
|
|
110
|
+
}),
|
|
111
|
+
"data-day": day.date.toLocaleDateString(locale?.code),
|
|
112
|
+
"data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
|
|
113
|
+
"data-range-start": modifiers.range_start,
|
|
114
|
+
"data-range-end": modifiers.range_end,
|
|
115
|
+
"data-range-middle": modifiers.range_middle,
|
|
116
|
+
className: cn("relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className),
|
|
117
|
+
...props
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* WHEN TO USE
|
|
122
|
+
* - A persistent, always-visible calendar view for picking dates.
|
|
123
|
+
* - Inside a Popover behind a trigger button, to form a date-picker field.
|
|
124
|
+
*
|
|
125
|
+
* NOT WHEN
|
|
126
|
+
* - Displaying a fixed, non-editable date — just render text.
|
|
127
|
+
* - Only month/year granularity is needed, not full day selection.
|
|
128
|
+
*
|
|
129
|
+
* KEY RULES
|
|
130
|
+
* - `mode` is a required discriminator: "single" | "multiple" | "range" — it determines the type of `selected`/`onSelect` (Date, Date[], or DateRange).
|
|
131
|
+
* - `numberOfMonths` renders more than one month side by side, commonly paired with mode="range".
|
|
132
|
+
* - `disabled` accepts matchers, e.g. `{ dayOfWeek: [0, 6] }` to block weekends.
|
|
133
|
+
* - `defaultMonth` sets the initially visible month without controlling selection.
|
|
134
|
+
* - `captionLayout="dropdown"` swaps the month/year label for jump-to dropdowns (defaults to a
|
|
135
|
+
* 100-year range with no extra props) — the fast-navigation pattern for something like a date
|
|
136
|
+
* of birth; override the range via `startMonth`/`endMonth` (plain `Date`s) if a form needs one.
|
|
137
|
+
* - There is no dedicated DatePicker component — it's always this Calendar composed inside a
|
|
138
|
+
* Popover, with the trigger's label built from whatever's selected, per the USAGE example below.
|
|
139
|
+
*
|
|
140
|
+
* USAGE
|
|
141
|
+
* // Single date
|
|
142
|
+
* <Calendar mode="single" selected={date} onSelect={setDate} className="rounded-xl border" />
|
|
143
|
+
*
|
|
144
|
+
* // Range across two months
|
|
145
|
+
* <Calendar mode="range" selected={range} onSelect={setRange} numberOfMonths={2} className="rounded-xl border" />
|
|
146
|
+
*
|
|
147
|
+
* // Month/year dropdown captions instead of a plain label — fast navigation to a far month
|
|
148
|
+
* <Calendar mode="single" selected={date} onSelect={setDate} captionLayout="dropdown" className="rounded-xl border" />
|
|
149
|
+
*
|
|
150
|
+
* // Inside a Popover, as a date-picker field
|
|
151
|
+
* <Popover>
|
|
152
|
+
* <PopoverTrigger asChild>
|
|
153
|
+
* <Button variant="outline">{date ? date.toLocaleDateString() : "Pick a date"}</Button>
|
|
154
|
+
* </PopoverTrigger>
|
|
155
|
+
* <PopoverContent className="w-auto p-0">
|
|
156
|
+
* <Calendar mode="single" selected={date} onSelect={setDate} />
|
|
157
|
+
* </PopoverContent>
|
|
158
|
+
* </Popover>
|
|
159
|
+
*/
|
|
160
|
+
//#endregion
|
|
161
|
+
export { Calendar, CalendarDayButton };
|
|
162
|
+
|
|
163
|
+
//# sourceMappingURL=calendar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.js","names":[],"sources":["../../../src/components/ui/calendar.tsx"],"sourcesContent":["\"use client\"\n\n/**\n * Calendar — inline calendar grid for date selection.\n *\n * MMDS supplies classNames, a custom day button (CalendarDayButton), and\n * chevron icons over the react-day-picker date-grid engine.\n */\n\nimport * as React from \"react\"\nimport {\n DayPicker,\n getDefaultClassNames,\n type DayButton,\n type Locale,\n} from \"react-day-picker\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button, buttonVariants } from \"@/components/ui/button\"\nimport {\n ChevronLeftIcon,\n ChevronRightIcon,\n ChevronDownIcon,\n} from \"lucide-react\"\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = \"label\",\n buttonVariant = \"ghost\",\n locale,\n formatters,\n components,\n ...props\n}: React.ComponentProps<typeof DayPicker> & {\n buttonVariant?: React.ComponentProps<typeof Button>[\"variant\"]\n}) {\n const defaultClassNames = getDefaultClassNames()\n\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn(\n \"group/calendar bg-card p-2 [--cell-radius:var(--radius-md,0.375rem)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent\",\n String.raw`rtl:**:[.rdp-button\\_next>svg]:rotate-180`,\n String.raw`rtl:**:[.rdp-button\\_previous>svg]:rotate-180`,\n className\n )}\n captionLayout={captionLayout}\n locale={locale}\n formatters={{\n formatMonthDropdown: (date) =>\n date.toLocaleString(locale?.code, { month: \"short\" }),\n ...formatters,\n }}\n classNames={{\n root: cn(\"w-fit\", defaultClassNames.root),\n months: cn(\n \"relative flex flex-col gap-4 md:flex-row\",\n defaultClassNames.months\n ),\n month: cn(\"flex w-full flex-col gap-4\", defaultClassNames.month),\n nav: cn(\n \"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1\",\n defaultClassNames.nav\n ),\n button_previous: cn(\n buttonVariants({ variant: buttonVariant }),\n \"size-(--cell-size) p-0 select-none aria-disabled:opacity-50\",\n defaultClassNames.button_previous\n ),\n button_next: cn(\n buttonVariants({ variant: buttonVariant }),\n \"size-(--cell-size) p-0 select-none aria-disabled:opacity-50\",\n defaultClassNames.button_next\n ),\n month_caption: cn(\n \"flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)\",\n defaultClassNames.month_caption\n ),\n dropdowns: cn(\n \"flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium\",\n defaultClassNames.dropdowns\n ),\n dropdown_root: cn(\n \"relative rounded-(--cell-radius)\",\n defaultClassNames.dropdown_root\n ),\n dropdown: cn(\n \"absolute inset-0 bg-popover opacity-0\",\n defaultClassNames.dropdown\n ),\n caption_label: cn(\n \"font-medium select-none\",\n captionLayout === \"label\"\n ? \"text-sm\"\n : \"flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground\",\n defaultClassNames.caption_label\n ),\n month_grid: cn(\"w-full border-collapse\", defaultClassNames.month_grid),\n weekdays: cn(\"flex\", defaultClassNames.weekdays),\n weekday: cn(\n \"flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none\",\n defaultClassNames.weekday\n ),\n week: cn(\"mt-2 flex w-full\", defaultClassNames.week),\n week_number_header: cn(\n \"w-(--cell-size) select-none\",\n defaultClassNames.week_number_header\n ),\n week_number: cn(\n \"text-[0.8rem] text-muted-foreground select-none\",\n defaultClassNames.week_number\n ),\n day: cn(\n \"group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)\",\n props.showWeekNumber\n ? \"[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)\"\n : \"[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)\",\n defaultClassNames.day\n ),\n range_start: cn(\n \"relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted\",\n defaultClassNames.range_start\n ),\n range_middle: cn(\"rounded-none\", defaultClassNames.range_middle),\n range_end: cn(\n \"relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted\",\n defaultClassNames.range_end\n ),\n today: cn(\n \"rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none\",\n defaultClassNames.today\n ),\n outside: cn(\n \"text-muted-foreground aria-selected:text-muted-foreground\",\n defaultClassNames.outside\n ),\n disabled: cn(\n \"text-muted-foreground opacity-50\",\n defaultClassNames.disabled\n ),\n hidden: cn(\"invisible\", defaultClassNames.hidden),\n ...classNames,\n }}\n components={{\n Root: ({ className, rootRef, ...props }) => {\n return (\n <div\n data-slot=\"calendar\"\n ref={rootRef}\n className={cn(className)}\n {...props}\n />\n )\n },\n Chevron: ({ className, orientation, ...props }) => {\n if (orientation === \"left\") {\n return (\n <ChevronLeftIcon className={cn(\"size-4\", className)} {...props} />\n )\n }\n\n if (orientation === \"right\") {\n return (\n <ChevronRightIcon\n className={cn(\"size-4\", className)}\n {...props}\n />\n )\n }\n\n return (\n <ChevronDownIcon className={cn(\"size-4\", className)} {...props} />\n )\n },\n DayButton: ({ ...props }) => (\n <CalendarDayButton locale={locale} {...props} />\n ),\n WeekNumber: ({ children, ...props }) => {\n return (\n <td {...props}>\n <div className=\"flex size-(--cell-size) items-center justify-center text-center\">\n {children}\n </div>\n </td>\n )\n },\n ...components,\n }}\n {...props}\n />\n )\n}\n\nfunction CalendarDayButton({\n className,\n day,\n modifiers,\n locale,\n ...props\n}: React.ComponentProps<typeof DayButton> & { locale?: Partial<Locale> }) {\n const defaultClassNames = getDefaultClassNames()\n\n const ref = React.useRef<HTMLButtonElement>(null)\n React.useEffect(() => {\n if (modifiers.focused) ref.current?.focus()\n }, [modifiers.focused])\n\n return (\n <Button\n ref={ref}\n variant=\"ghost\"\n iconOnly\n aria-label={day.date.toLocaleDateString(locale?.code, {\n weekday: \"long\",\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n })}\n data-day={day.date.toLocaleDateString(locale?.code)}\n data-selected-single={\n modifiers.selected &&\n !modifiers.range_start &&\n !modifiers.range_end &&\n !modifiers.range_middle\n }\n data-range-start={modifiers.range_start}\n data-range-end={modifiers.range_end}\n data-range-middle={modifiers.range_middle}\n className={cn(\n \"relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70\",\n defaultClassNames.day,\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Calendar, CalendarDayButton }\n\n/**\n * WHEN TO USE\n * - A persistent, always-visible calendar view for picking dates.\n * - Inside a Popover behind a trigger button, to form a date-picker field.\n *\n * NOT WHEN\n * - Displaying a fixed, non-editable date — just render text.\n * - Only month/year granularity is needed, not full day selection.\n *\n * KEY RULES\n * - `mode` is a required discriminator: \"single\" | \"multiple\" | \"range\" — it determines the type of `selected`/`onSelect` (Date, Date[], or DateRange).\n * - `numberOfMonths` renders more than one month side by side, commonly paired with mode=\"range\".\n * - `disabled` accepts matchers, e.g. `{ dayOfWeek: [0, 6] }` to block weekends.\n * - `defaultMonth` sets the initially visible month without controlling selection.\n * - `captionLayout=\"dropdown\"` swaps the month/year label for jump-to dropdowns (defaults to a\n * 100-year range with no extra props) — the fast-navigation pattern for something like a date\n * of birth; override the range via `startMonth`/`endMonth` (plain `Date`s) if a form needs one.\n * - There is no dedicated DatePicker component — it's always this Calendar composed inside a\n * Popover, with the trigger's label built from whatever's selected, per the USAGE example below.\n *\n * USAGE\n * // Single date\n * <Calendar mode=\"single\" selected={date} onSelect={setDate} className=\"rounded-xl border\" />\n *\n * // Range across two months\n * <Calendar mode=\"range\" selected={range} onSelect={setRange} numberOfMonths={2} className=\"rounded-xl border\" />\n *\n * // Month/year dropdown captions instead of a plain label — fast navigation to a far month\n * <Calendar mode=\"single\" selected={date} onSelect={setDate} captionLayout=\"dropdown\" className=\"rounded-xl border\" />\n *\n * // Inside a Popover, as a date-picker field\n * <Popover>\n * <PopoverTrigger asChild>\n * <Button variant=\"outline\">{date ? date.toLocaleDateString() : \"Pick a date\"}</Button>\n * </PopoverTrigger>\n * <PopoverContent className=\"w-auto p-0\">\n * <Calendar mode=\"single\" selected={date} onSelect={setDate} />\n * </PopoverContent>\n * </Popover>\n */\n"],"mappings":";;;;;;;;;;;;;;AAyBA,SAAS,SAAS,EAChB,WACA,YACA,kBAAkB,MAClB,gBAAgB,SAChB,gBAAgB,SAChB,QACA,YACA,YACA,GAAG,SAGF;CACD,MAAM,oBAAoB,qBAAqB;CAE/C,OACE,oBAAC,WAAD;EACmB;EACjB,WAAW,GACT,4LACA,OAAO,GAAG,6CACV,OAAO,GAAG,iDACV,SACF;EACe;EACP;EACR,YAAY;GACV,sBAAsB,SACpB,KAAK,eAAe,QAAQ,MAAM,EAAE,OAAO,QAAQ,CAAC;GACtD,GAAG;EACL;EACA,YAAY;GACV,MAAM,GAAG,SAAS,kBAAkB,IAAI;GACxC,QAAQ,GACN,4CACA,kBAAkB,MACpB;GACA,OAAO,GAAG,8BAA8B,kBAAkB,KAAK;GAC/D,KAAK,GACH,2EACA,kBAAkB,GACpB;GACA,iBAAiB,GACf,eA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E,oBAAC,kBAAD;KACE,WAAW,GAAG,UAAU,SAAS;KACjC,GAAI;IACL,CAAA;IAIL,OACE,oBAAC,iBAAD;KAAiB,WAAW,GAAG,UAAU,SAAS;KAAG,GAAI;IAAQ,CAAA;GAErE;GACA,YAAY,EAAE,GAAG,YACf,oBAAC,mBAAD;IAA2B;IAAQ,GAAI;GAAQ,CAAA;GAEjD,aAAa,EAAE,UAAU,GAAG,YAAY;IACtC,OACE,oBAAC,MAAD;KAAI,GAAI;KACN,UAAA,oBAAC,OAAD;MAAK,WAAU;MACZ;KACE,CAAA;IACH,CAAA;GAER;GACA,GAAG;EACL;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,KACA,WACA,QACA,GAAG,SACqE;CACxE,MAAM,oBAAoB,qBAAqB;CAE/C,MAAM,MAAM,MAAM,OAA0B,IAAI;CAChD,MAAM,gBAAgB;EACpB,IAAI,UAAU,SAAS,IAAI,SAAS,MAAM;CAC5C,GAAG,CAAC,UAAU,OAAO,CAAC;CAEtB,OACE,oBAAC,QAAD;EACO;EACL,SAAQ;EACR,UAAA;EACA,cAAY,IAAI,KAAK,mBAAmB,QAAQ,MAAM;GACpD,SAAS;GACT,MAAM;GACN,OAAO;GACP,KAAK;EACP,CAAC;EACD,YAAU,IAAI,KAAK,mBAAmB,QAAQ,IAAI;EAClD,wBACE,UAAU,YACV,CAAC,UAAU,eACX,CAAC,UAAU,aACX,CAAC,UAAU;EAEb,oBAAkB,UAAU;EAC5B,kBAAgB,UAAU;EAC1B,qBAAmB,UAAU;EAC7B,WAAW,GACT,w7BACA,kBAAkB,KAClB,SACF;EACA,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Card — bounded surface for grouping related content.
|
|
3
|
+
*
|
|
4
|
+
* Plain `div`s with layout classes (grid header, flex footer) — no external
|
|
5
|
+
* primitive. A `size` prop ("default" | "sm" | "xs") scales the internal
|
|
6
|
+
* spacing token instead of
|
|
7
|
+
* requiring className overrides, plus a `variant="dashed"` placeholder look
|
|
8
|
+
* (transparent fill, dashed border instead of the default ring) for an
|
|
9
|
+
* empty/add-new slot — the same dashed-border convention Attachment's
|
|
10
|
+
* `idle` state and Empty already use.
|
|
11
|
+
*/
|
|
12
|
+
import * as React from "react";
|
|
13
|
+
declare function Card({ className, size, variant, ...props }: React.ComponentProps<"div"> & {
|
|
14
|
+
size?: "default" | "sm" | "xs";
|
|
15
|
+
variant?: "default" | "dashed";
|
|
16
|
+
}): React.JSX.Element;
|
|
17
|
+
declare function CardHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
18
|
+
declare function CardTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
19
|
+
declare function CardDescription({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
20
|
+
declare function CardAction({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
21
|
+
declare function CardContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
22
|
+
declare function CardFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
23
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
|
|
24
|
+
/**
|
|
25
|
+
* WHEN TO USE
|
|
26
|
+
* - Grouping related content behind one visual boundary — dashboard panels,
|
|
27
|
+
* settings sections, forms, pricing/summary blocks.
|
|
28
|
+
* - CardAction for a single header-aligned action (e.g. a "Manage" link) —
|
|
29
|
+
* it sits in the header grid's second column, aligned to the inline end.
|
|
30
|
+
*
|
|
31
|
+
* NOT WHEN
|
|
32
|
+
* - A row inside a dense list — use Item instead.
|
|
33
|
+
* - The page background itself — use `bg-background` directly, not a Card.
|
|
34
|
+
*
|
|
35
|
+
* KEY RULES
|
|
36
|
+
* - size: default | sm | xs — every one of CardHeader/CardTitle/
|
|
37
|
+
* CardDescription/CardContent/CardFooter reacts. CardHeader/CardContent/
|
|
38
|
+
* CardFooter's own padding/gap track the shared `--card-spacing` custom
|
|
39
|
+
* property directly (no per-component variant needed — it inherits
|
|
40
|
+
* down); CardTitle drops to text-sm at sm and xs alike, CardDescription
|
|
41
|
+
* only at xs (already text-sm by default, same as sm). Not a separate
|
|
42
|
+
* visual style, just tighter padding and, at xs, smaller text. Reach for
|
|
43
|
+
* xs on a narrower surface — a Sidecar panel, a nested card — where even
|
|
44
|
+
* sm's padding is more than the available width can spare.
|
|
45
|
+
* - CardFooter automatically gets a top border and a muted background — no
|
|
46
|
+
* className needed for the visual separation from CardContent.
|
|
47
|
+
* - An `<img>` as the first or last child gets its corners auto-rounded to
|
|
48
|
+
* match the card — no manual `rounded-t-xl`/`rounded-b-xl` needed on it.
|
|
49
|
+
* - `variant="dashed"` swaps the filled `bg-card`/ring look for a transparent,
|
|
50
|
+
* dashed-border placeholder — an empty slot or "add new" tile in a grid of
|
|
51
|
+
* real Cards, not a second visual style for real content.
|
|
52
|
+
* - An "AI Card" (an AI-generated summary) wraps a plain `Card` in a
|
|
53
|
+
* gradient div (`bg-gradient-to-r from-ai-wash to-ai-grad-from p-px`,
|
|
54
|
+
* the AI Identity gradient as a token-driven outline instead of an
|
|
55
|
+
* arbitrary `border-image` value) and puts `AILabel` in `CardAction` as
|
|
56
|
+
* the AI marker — no `AISparkle` next to `CardTitle`'s text, that would
|
|
57
|
+
* be redundant with `AILabel`'s own visible "AI" text. A `CardFooter`
|
|
58
|
+
* below the body/`CardContent` can optionally carry an AI Chip follow-up
|
|
59
|
+
* action (`variant="ai" size="xs" rounded-full`, `AISparkle` +
|
|
60
|
+
* `data-icon="inline-start"`) alongside a plain pill secondary action
|
|
61
|
+
* (`variant="ghost" size="xs" rounded-full` — same pill shape/size, no
|
|
62
|
+
* AI accent) — one AI-styled action per row, same logic as the AI Icon
|
|
63
|
+
* Button recipe. Add
|
|
64
|
+
* `border-t-0 bg-transparent` to drop CardFooter's default
|
|
65
|
+
* gray strip (plain className overrides, no dedicated prop) so the
|
|
66
|
+
* actions sit on the card's own surface instead, plus `pt-0` since the
|
|
67
|
+
* strip's own top padding otherwise doubles up with Card's own
|
|
68
|
+
* `gap-(--card-spacing)` between CardContent and CardFooter once that
|
|
69
|
+
* strip's background/border stop visually justifying the extra room.
|
|
70
|
+
* See AI/Card's "BoundaryTreatments" story for all three side by side. `shadow-ai-glow` (a
|
|
71
|
+
* real registered token, not an arbitrary value) is a soft alternative
|
|
72
|
+
* to the hard gradient outline — just a plain Card className, no wrapper
|
|
73
|
+
* div — a lighter treatment where a crisp outline would compete with
|
|
74
|
+
* neighbouring cards (the middle card in "BoundaryTreatments"). A third option keeps the gradient outline and puts
|
|
75
|
+
* the glow INSIDE instead: `bg-ai-glow-bottom` as a plain Card className
|
|
76
|
+
* (a background-image, layering over Card's own `bg-card` — `cn`
|
|
77
|
+
* registers the glow classes as background-image utilities so
|
|
78
|
+
* tailwind-merge keeps both), a soft glow rising from the Card's own
|
|
79
|
+
* bottom edge — the same recipe an AI-marked DataTable's wrapping Card
|
|
80
|
+
* uses, so both read alike (the third card in "BoundaryTreatments").
|
|
81
|
+
*
|
|
82
|
+
* USAGE
|
|
83
|
+
* <Card>
|
|
84
|
+
* <CardHeader>
|
|
85
|
+
* <CardTitle>Create project</CardTitle>
|
|
86
|
+
* <CardDescription>Deploy your new project in one click.</CardDescription>
|
|
87
|
+
* <CardAction><Button variant="ghost" size="sm">Manage</Button></CardAction>
|
|
88
|
+
* </CardHeader>
|
|
89
|
+
* <CardContent>...</CardContent>
|
|
90
|
+
* <CardFooter className="gap-2">
|
|
91
|
+
* <Button variant="outline" className="flex-1">Cancel</Button>
|
|
92
|
+
* <Button className="flex-1">Deploy</Button>
|
|
93
|
+
* </CardFooter>
|
|
94
|
+
* </Card>
|
|
95
|
+
*/
|
|
96
|
+
//# sourceMappingURL=card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/components/ui/card.tsx"],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|
1
|
+
import { cn } from "../../lib/utils.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/ui/card.tsx
|
|
5
|
+
function Card({ className, size = "default", variant = "default", ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
"data-slot": "card",
|
|
8
|
+
"data-size": size,
|
|
9
|
+
"data-variant": variant,
|
|
10
|
+
className: cn("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl py-(--card-spacing) text-sm text-card-foreground [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=xs]:[--card-spacing:--spacing(2)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl", variant === "dashed" ? "border border-dashed border-border bg-transparent" : "bg-card ring-1 ring-foreground/10", className),
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function CardHeader({ className, ...props }) {
|
|
15
|
+
return /* @__PURE__ */ jsx("div", {
|
|
16
|
+
"data-slot": "card-header",
|
|
17
|
+
className: cn("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) group-data-[size=xs]/card:gap-0.5 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)", className),
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function CardTitle({ className, ...props }) {
|
|
22
|
+
return /* @__PURE__ */ jsx("div", {
|
|
23
|
+
"data-slot": "card-title",
|
|
24
|
+
className: cn("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm group-data-[size=xs]/card:text-sm", className),
|
|
25
|
+
...props
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function CardDescription({ className, ...props }) {
|
|
29
|
+
return /* @__PURE__ */ jsx("div", {
|
|
30
|
+
"data-slot": "card-description",
|
|
31
|
+
className: cn("text-sm text-muted-foreground group-data-[size=xs]/card:text-xs", className),
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function CardAction({ className, ...props }) {
|
|
36
|
+
return /* @__PURE__ */ jsx("div", {
|
|
37
|
+
"data-slot": "card-action",
|
|
38
|
+
className: cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className),
|
|
39
|
+
...props
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function CardContent({ className, ...props }) {
|
|
43
|
+
return /* @__PURE__ */ jsx("div", {
|
|
44
|
+
"data-slot": "card-content",
|
|
45
|
+
className: cn("flex-1 px-(--card-spacing)", className),
|
|
46
|
+
...props
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function CardFooter({ className, ...props }) {
|
|
50
|
+
return /* @__PURE__ */ jsx("div", {
|
|
51
|
+
"data-slot": "card-footer",
|
|
52
|
+
className: cn("flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)", className),
|
|
53
|
+
...props
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* WHEN TO USE
|
|
58
|
+
* - Grouping related content behind one visual boundary — dashboard panels,
|
|
59
|
+
* settings sections, forms, pricing/summary blocks.
|
|
60
|
+
* - CardAction for a single header-aligned action (e.g. a "Manage" link) —
|
|
61
|
+
* it sits in the header grid's second column, aligned to the inline end.
|
|
62
|
+
*
|
|
63
|
+
* NOT WHEN
|
|
64
|
+
* - A row inside a dense list — use Item instead.
|
|
65
|
+
* - The page background itself — use `bg-background` directly, not a Card.
|
|
66
|
+
*
|
|
67
|
+
* KEY RULES
|
|
68
|
+
* - size: default | sm | xs — every one of CardHeader/CardTitle/
|
|
69
|
+
* CardDescription/CardContent/CardFooter reacts. CardHeader/CardContent/
|
|
70
|
+
* CardFooter's own padding/gap track the shared `--card-spacing` custom
|
|
71
|
+
* property directly (no per-component variant needed — it inherits
|
|
72
|
+
* down); CardTitle drops to text-sm at sm and xs alike, CardDescription
|
|
73
|
+
* only at xs (already text-sm by default, same as sm). Not a separate
|
|
74
|
+
* visual style, just tighter padding and, at xs, smaller text. Reach for
|
|
75
|
+
* xs on a narrower surface — a Sidecar panel, a nested card — where even
|
|
76
|
+
* sm's padding is more than the available width can spare.
|
|
77
|
+
* - CardFooter automatically gets a top border and a muted background — no
|
|
78
|
+
* className needed for the visual separation from CardContent.
|
|
79
|
+
* - An `<img>` as the first or last child gets its corners auto-rounded to
|
|
80
|
+
* match the card — no manual `rounded-t-xl`/`rounded-b-xl` needed on it.
|
|
81
|
+
* - `variant="dashed"` swaps the filled `bg-card`/ring look for a transparent,
|
|
82
|
+
* dashed-border placeholder — an empty slot or "add new" tile in a grid of
|
|
83
|
+
* real Cards, not a second visual style for real content.
|
|
84
|
+
* - An "AI Card" (an AI-generated summary) wraps a plain `Card` in a
|
|
85
|
+
* gradient div (`bg-gradient-to-r from-ai-wash to-ai-grad-from p-px`,
|
|
86
|
+
* the AI Identity gradient as a token-driven outline instead of an
|
|
87
|
+
* arbitrary `border-image` value) and puts `AILabel` in `CardAction` as
|
|
88
|
+
* the AI marker — no `AISparkle` next to `CardTitle`'s text, that would
|
|
89
|
+
* be redundant with `AILabel`'s own visible "AI" text. A `CardFooter`
|
|
90
|
+
* below the body/`CardContent` can optionally carry an AI Chip follow-up
|
|
91
|
+
* action (`variant="ai" size="xs" rounded-full`, `AISparkle` +
|
|
92
|
+
* `data-icon="inline-start"`) alongside a plain pill secondary action
|
|
93
|
+
* (`variant="ghost" size="xs" rounded-full` — same pill shape/size, no
|
|
94
|
+
* AI accent) — one AI-styled action per row, same logic as the AI Icon
|
|
95
|
+
* Button recipe. Add
|
|
96
|
+
* `border-t-0 bg-transparent` to drop CardFooter's default
|
|
97
|
+
* gray strip (plain className overrides, no dedicated prop) so the
|
|
98
|
+
* actions sit on the card's own surface instead, plus `pt-0` since the
|
|
99
|
+
* strip's own top padding otherwise doubles up with Card's own
|
|
100
|
+
* `gap-(--card-spacing)` between CardContent and CardFooter once that
|
|
101
|
+
* strip's background/border stop visually justifying the extra room.
|
|
102
|
+
* See AI/Card's "BoundaryTreatments" story for all three side by side. `shadow-ai-glow` (a
|
|
103
|
+
* real registered token, not an arbitrary value) is a soft alternative
|
|
104
|
+
* to the hard gradient outline — just a plain Card className, no wrapper
|
|
105
|
+
* div — a lighter treatment where a crisp outline would compete with
|
|
106
|
+
* neighbouring cards (the middle card in "BoundaryTreatments"). A third option keeps the gradient outline and puts
|
|
107
|
+
* the glow INSIDE instead: `bg-ai-glow-bottom` as a plain Card className
|
|
108
|
+
* (a background-image, layering over Card's own `bg-card` — `cn`
|
|
109
|
+
* registers the glow classes as background-image utilities so
|
|
110
|
+
* tailwind-merge keeps both), a soft glow rising from the Card's own
|
|
111
|
+
* bottom edge — the same recipe an AI-marked DataTable's wrapping Card
|
|
112
|
+
* uses, so both read alike (the third card in "BoundaryTreatments").
|
|
113
|
+
*
|
|
114
|
+
* USAGE
|
|
115
|
+
* <Card>
|
|
116
|
+
* <CardHeader>
|
|
117
|
+
* <CardTitle>Create project</CardTitle>
|
|
118
|
+
* <CardDescription>Deploy your new project in one click.</CardDescription>
|
|
119
|
+
* <CardAction><Button variant="ghost" size="sm">Manage</Button></CardAction>
|
|
120
|
+
* </CardHeader>
|
|
121
|
+
* <CardContent>...</CardContent>
|
|
122
|
+
* <CardFooter className="gap-2">
|
|
123
|
+
* <Button variant="outline" className="flex-1">Cancel</Button>
|
|
124
|
+
* <Button className="flex-1">Deploy</Button>
|
|
125
|
+
* </CardFooter>
|
|
126
|
+
* </Card>
|
|
127
|
+
*/
|
|
128
|
+
//#endregion
|
|
129
|
+
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
130
|
+
|
|
131
|
+
//# sourceMappingURL=card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.js","names":[],"sources":["../../../src/components/ui/card.tsx"],"sourcesContent":["/**\n * Card — bounded surface for grouping related content.\n *\n * Plain `div`s with layout classes (grid header, flex footer) — no external\n * primitive. A `size` prop (\"default\" | \"sm\" | \"xs\") scales the internal\n * spacing token instead of\n * requiring className overrides, plus a `variant=\"dashed\"` placeholder look\n * (transparent fill, dashed border instead of the default ring) for an\n * empty/add-new slot — the same dashed-border convention Attachment's\n * `idle` state and Empty already use.\n */\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Card({\n className,\n size = \"default\",\n variant = \"default\",\n ...props\n}: React.ComponentProps<\"div\"> & {\n size?: \"default\" | \"sm\" | \"xs\"\n variant?: \"default\" | \"dashed\"\n}) {\n return (\n <div\n data-slot=\"card\"\n data-size={size}\n data-variant={variant}\n className={cn(\n // Same default/sm/xs vocabulary as Item/Table/Button/KeyValuePair —\n // xs is the extra step for a narrower surface like Sidecar, where\n // even sm's padding is more than the available width can spare.\n \"group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl py-(--card-spacing) text-sm text-card-foreground [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=xs]:[--card-spacing:--spacing(2)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl\",\n variant === \"dashed\"\n ? \"border border-dashed border-border bg-transparent\"\n : \"bg-card ring-1 ring-foreground/10\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n \"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) group-data-[size=xs]/card:gap-0.5 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn(\n \"text-base leading-snug font-medium group-data-[size=sm]/card:text-sm group-data-[size=xs]/card:text-sm\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-description\"\n className={cn(\n \"text-sm text-muted-foreground group-data-[size=xs]/card:text-xs\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardAction({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn(\n \"col-start-2 row-span-2 row-start-1 self-start justify-self-end\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-content\"\n // flex-1: a no-op while Card sizes to its own content (no free space\n // to distribute), but when something outside stretches Card taller\n // than its content (a grid row, an explicit height), this is what\n // claims the leftover space instead of leaving it as dead air below\n // the content — e.g. what lets DataTable's footer sit flush at the\n // card's true bottom edge instead of floating above blank space.\n // px-(--card-spacing) already tracks Card's own size on its own —\n // no size variant needed here, the custom property inherits down.\n className={cn(\"flex-1 px-(--card-spacing)\", className)}\n {...props}\n />\n )\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-footer\"\n // p-(--card-spacing) already tracks Card's own size on its own — no\n // size variant needed here, the custom property inherits down.\n className={cn(\n \"flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n}\n\n/**\n * WHEN TO USE\n * - Grouping related content behind one visual boundary — dashboard panels,\n * settings sections, forms, pricing/summary blocks.\n * - CardAction for a single header-aligned action (e.g. a \"Manage\" link) —\n * it sits in the header grid's second column, aligned to the inline end.\n *\n * NOT WHEN\n * - A row inside a dense list — use Item instead.\n * - The page background itself — use `bg-background` directly, not a Card.\n *\n * KEY RULES\n * - size: default | sm | xs — every one of CardHeader/CardTitle/\n * CardDescription/CardContent/CardFooter reacts. CardHeader/CardContent/\n * CardFooter's own padding/gap track the shared `--card-spacing` custom\n * property directly (no per-component variant needed — it inherits\n * down); CardTitle drops to text-sm at sm and xs alike, CardDescription\n * only at xs (already text-sm by default, same as sm). Not a separate\n * visual style, just tighter padding and, at xs, smaller text. Reach for\n * xs on a narrower surface — a Sidecar panel, a nested card — where even\n * sm's padding is more than the available width can spare.\n * - CardFooter automatically gets a top border and a muted background — no\n * className needed for the visual separation from CardContent.\n * - An `<img>` as the first or last child gets its corners auto-rounded to\n * match the card — no manual `rounded-t-xl`/`rounded-b-xl` needed on it.\n * - `variant=\"dashed\"` swaps the filled `bg-card`/ring look for a transparent,\n * dashed-border placeholder — an empty slot or \"add new\" tile in a grid of\n * real Cards, not a second visual style for real content.\n * - An \"AI Card\" (an AI-generated summary) wraps a plain `Card` in a\n * gradient div (`bg-gradient-to-r from-ai-wash to-ai-grad-from p-px`,\n * the AI Identity gradient as a token-driven outline instead of an\n * arbitrary `border-image` value) and puts `AILabel` in `CardAction` as\n * the AI marker — no `AISparkle` next to `CardTitle`'s text, that would\n * be redundant with `AILabel`'s own visible \"AI\" text. A `CardFooter`\n * below the body/`CardContent` can optionally carry an AI Chip follow-up\n * action (`variant=\"ai\" size=\"xs\" rounded-full`, `AISparkle` +\n * `data-icon=\"inline-start\"`) alongside a plain pill secondary action\n * (`variant=\"ghost\" size=\"xs\" rounded-full` — same pill shape/size, no\n * AI accent) — one AI-styled action per row, same logic as the AI Icon\n * Button recipe. Add\n * `border-t-0 bg-transparent` to drop CardFooter's default\n * gray strip (plain className overrides, no dedicated prop) so the\n * actions sit on the card's own surface instead, plus `pt-0` since the\n * strip's own top padding otherwise doubles up with Card's own\n * `gap-(--card-spacing)` between CardContent and CardFooter once that\n * strip's background/border stop visually justifying the extra room.\n * See AI/Card's \"BoundaryTreatments\" story for all three side by side. `shadow-ai-glow` (a\n * real registered token, not an arbitrary value) is a soft alternative\n * to the hard gradient outline — just a plain Card className, no wrapper\n * div — a lighter treatment where a crisp outline would compete with\n * neighbouring cards (the middle card in \"BoundaryTreatments\"). A third option keeps the gradient outline and puts\n * the glow INSIDE instead: `bg-ai-glow-bottom` as a plain Card className\n * (a background-image, layering over Card's own `bg-card` — `cn`\n * registers the glow classes as background-image utilities so\n * tailwind-merge keeps both), a soft glow rising from the Card's own\n * bottom edge — the same recipe an AI-marked DataTable's wrapping Card\n * uses, so both read alike (the third card in \"BoundaryTreatments\").\n *\n * USAGE\n * <Card>\n * <CardHeader>\n * <CardTitle>Create project</CardTitle>\n * <CardDescription>Deploy your new project in one click.</CardDescription>\n * <CardAction><Button variant=\"ghost\" size=\"sm\">Manage</Button></CardAction>\n * </CardHeader>\n * <CardContent>...</CardContent>\n * <CardFooter className=\"gap-2\">\n * <Button variant=\"outline\" className=\"flex-1\">Cancel</Button>\n * <Button className=\"flex-1\">Deploy</Button>\n * </CardFooter>\n * </Card>\n */\n"],"mappings":";;;;AAgBA,SAAS,KAAK,EACZ,WACA,OAAO,WACP,UAAU,WACV,GAAG,SAIF;CACD,OACE,oBAAC,OAAD;EACE,aAAU;EACV,aAAW;EACX,gBAAc;EACd,WAAW,GAIT,mXACA,YAAY,WACR,sDACA,qCACJ,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,4RACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,UAAU,EAAE,WAAW,GAAG,SAAsC;CACvE,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,0GACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,gBAAgB,EAAE,WAAW,GAAG,SAAsC;CAC7E,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,mEACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,kEACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAsC;CACzE,OACE,oBAAC,OAAD;EACE,aAAU;EASV,WAAW,GAAG,8BAA8B,SAAS;EACrD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,oBAAC,OAAD;EACE,aAAU;EAGV,WAAW,GACT,0EACA,SACF;EACA,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Carousel — slide container with prev/next controls.
|
|
3
|
+
*
|
|
4
|
+
* Built on embla-carousel; opts/plugins/setApi pass straight through to the
|
|
5
|
+
* underlying embla instance.
|
|
6
|
+
* Arrow-key navigation is wired in via `onKeyDownCapture` on the root, on
|
|
7
|
+
* top of embla's own drag/swipe handling.
|
|
8
|
+
*/
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import useEmblaCarousel, { type UseEmblaCarouselType } from "embla-carousel-react";
|
|
11
|
+
import { Button, type TextButtonSize } from "../../components/ui/button";
|
|
12
|
+
type CarouselApi = UseEmblaCarouselType[1];
|
|
13
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
14
|
+
type CarouselOptions = UseCarouselParameters[0];
|
|
15
|
+
type CarouselPlugin = UseCarouselParameters[1];
|
|
16
|
+
type CarouselProps = {
|
|
17
|
+
opts?: CarouselOptions;
|
|
18
|
+
plugins?: CarouselPlugin;
|
|
19
|
+
orientation?: "horizontal" | "vertical";
|
|
20
|
+
setApi?: (api: CarouselApi) => void;
|
|
21
|
+
};
|
|
22
|
+
type CarouselContextProps = {
|
|
23
|
+
carouselRef: ReturnType<typeof useEmblaCarousel>[0];
|
|
24
|
+
api: ReturnType<typeof useEmblaCarousel>[1];
|
|
25
|
+
scrollPrev: () => void;
|
|
26
|
+
scrollNext: () => void;
|
|
27
|
+
canScrollPrev: boolean;
|
|
28
|
+
canScrollNext: boolean;
|
|
29
|
+
/** Indices embla currently considers in view — CarouselItem uses this to `inert` itself while scrolled off-screen, since embla only ever transforms slide position, never removes/hides one from the tab order or accessibility tree on its own. */
|
|
30
|
+
slidesInView: number[];
|
|
31
|
+
} & CarouselProps;
|
|
32
|
+
declare function useCarousel(): CarouselContextProps;
|
|
33
|
+
declare function Carousel({ orientation, opts, setApi, plugins, className, children, ...props }: React.ComponentProps<"div"> & CarouselProps): React.JSX.Element;
|
|
34
|
+
declare function CarouselContent({ className, children, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
35
|
+
declare function CarouselItem({ className, "data-slide-index": slideIndex, ...props }: React.ComponentProps<"div"> & {
|
|
36
|
+
"data-slide-index"?: number;
|
|
37
|
+
}): React.JSX.Element;
|
|
38
|
+
declare function CarouselPrevious({ className, variant, size, ...props }: Omit<React.ComponentProps<typeof Button>, "size" | "iconOnly" | "asChild" | "aria-label"> & {
|
|
39
|
+
/** Height step of the round icon-only control; it is always square (`iconOnly`). */
|
|
40
|
+
size?: TextButtonSize;
|
|
41
|
+
"aria-label"?: string;
|
|
42
|
+
}): React.JSX.Element;
|
|
43
|
+
declare function CarouselNext({ className, variant, size, ...props }: Omit<React.ComponentProps<typeof Button>, "size" | "iconOnly" | "asChild" | "aria-label"> & {
|
|
44
|
+
/** Height step of the round icon-only control; it is always square (`iconOnly`). */
|
|
45
|
+
size?: TextButtonSize;
|
|
46
|
+
"aria-label"?: string;
|
|
47
|
+
}): React.JSX.Element;
|
|
48
|
+
export { type CarouselApi, Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, useCarousel, };
|
|
49
|
+
/**
|
|
50
|
+
* WHEN TO USE
|
|
51
|
+
* - Paging horizontally (or vertically) through cards or media where
|
|
52
|
+
* showing everything at once is impractical — featured items, testimonials,
|
|
53
|
+
* image galleries.
|
|
54
|
+
*
|
|
55
|
+
* NOT WHEN
|
|
56
|
+
* - Content users need to scan or compare side by side — use a grid; a
|
|
57
|
+
* carousel hides everything but the current slide(s).
|
|
58
|
+
* - Essential content that must never be missed — carousels are easy to
|
|
59
|
+
* stop paging through.
|
|
60
|
+
* - Paged tabular/list data — use Pagination, not slide-based paging.
|
|
61
|
+
*
|
|
62
|
+
* KEY RULES
|
|
63
|
+
* - `orientation="vertical"` flips both the embla axis and the previous/next
|
|
64
|
+
* button placement (rotated 90°, stacked above/below instead of beside).
|
|
65
|
+
* - Number of visible slides is controlled entirely by `basis-*` on
|
|
66
|
+
* CarouselItem (e.g. `basis-1/3` shows three) — there's no `slidesToShow` prop.
|
|
67
|
+
* - `useCarousel()` throws outside a `<Carousel>` — only call it from a
|
|
68
|
+
* descendant of Carousel (as CarouselContent/Item/Previous/Next do).
|
|
69
|
+
* - `setApi` is how you get imperative control (`api.scrollTo(i)`, listen to
|
|
70
|
+
* `"select"`) — pass a state setter and read the api once it's set.
|
|
71
|
+
*
|
|
72
|
+
* USAGE
|
|
73
|
+
* <Carousel className="w-64">
|
|
74
|
+
* <CarouselContent>
|
|
75
|
+
* {slides.map((s) => (
|
|
76
|
+
* <CarouselItem key={s}><Card>...</Card></CarouselItem>
|
|
77
|
+
* ))}
|
|
78
|
+
* </CarouselContent>
|
|
79
|
+
* <CarouselPrevious />
|
|
80
|
+
* <CarouselNext />
|
|
81
|
+
* </Carousel>
|
|
82
|
+
*
|
|
83
|
+
* // Three slides visible at once
|
|
84
|
+
* <CarouselItem className="basis-1/3">...</CarouselItem>
|
|
85
|
+
*/
|
|
86
|
+
//# sourceMappingURL=carousel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../src/components/ui/carousel.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,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