@badnpm/ui 0.0.0-stage → 0.0.1
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/LICENSE +21 -0
- package/README.md +193 -2
- package/dist/cjs/components/accordion.cjs +24 -0
- package/dist/cjs/components/alert-dialog.cjs +56 -0
- package/dist/cjs/components/alert.cjs +34 -0
- package/dist/cjs/components/aspect-ratio.cjs +12 -0
- package/dist/cjs/components/attachment.cjs +80 -0
- package/dist/cjs/components/avatar.cjs +31 -0
- package/dist/cjs/components/badge.cjs +38 -0
- package/dist/cjs/components/breadcrumb.cjs +46 -0
- package/dist/cjs/components/bubble.cjs +66 -0
- package/dist/cjs/components/button-group.cjs +43 -0
- package/dist/cjs/components/button.cjs +41 -0
- package/dist/cjs/components/calendar.cjs +100 -0
- package/dist/cjs/components/card.cjs +34 -0
- package/dist/cjs/components/carousel.cjs +113 -0
- package/dist/cjs/components/chart.cjs +160 -0
- package/dist/cjs/components/checkbox.cjs +13 -0
- package/dist/cjs/components/code-block.cjs +110 -0
- package/dist/cjs/components/collapsible.cjs +18 -0
- package/dist/cjs/components/combobox.cjs +96 -0
- package/dist/cjs/components/command.cjs +46 -0
- package/dist/cjs/components/context-menu.cjs +69 -0
- package/dist/cjs/components/dialog.cjs +50 -0
- package/dist/cjs/components/drawer.cjs +108 -0
- package/dist/cjs/components/dropdown-menu.cjs +68 -0
- package/dist/cjs/components/empty.cjs +42 -0
- package/dist/cjs/components/field.cjs +80 -0
- package/dist/cjs/components/hover-card.cjs +20 -0
- package/dist/cjs/components/input-group.cjs +66 -0
- package/dist/cjs/components/input-otp.cjs +46 -0
- package/dist/cjs/components/input.cjs +11 -0
- package/dist/cjs/components/item.cjs +91 -0
- package/dist/cjs/components/kbd.cjs +14 -0
- package/dist/cjs/components/label.cjs +11 -0
- package/dist/cjs/components/marker.cjs +41 -0
- package/dist/cjs/components/menubar.cjs +75 -0
- package/dist/cjs/components/message-scroller.cjs +45 -0
- package/dist/cjs/components/message.cjs +30 -0
- package/dist/cjs/components/native-select.cjs +19 -0
- package/dist/cjs/components/navigation-menu.cjs +43 -0
- package/dist/cjs/components/pagination.cjs +36 -0
- package/dist/cjs/components/popover.cjs +31 -0
- package/dist/cjs/components/progress.cjs +28 -0
- package/dist/cjs/components/questionnaire.cjs +70 -0
- package/dist/cjs/components/radio-group.cjs +16 -0
- package/dist/cjs/components/resizable.cjs +39 -0
- package/dist/cjs/components/scroll-area.cjs +15 -0
- package/dist/cjs/components/select.cjs +47 -0
- package/dist/cjs/components/separator.cjs +11 -0
- package/dist/cjs/components/sheet.cjs +47 -0
- package/dist/cjs/components/sidebar.cjs +301 -0
- package/dist/cjs/components/skeleton.cjs +10 -0
- package/dist/cjs/components/slider.cjs +16 -0
- package/dist/cjs/components/spinner.cjs +11 -0
- package/dist/cjs/components/switch.cjs +12 -0
- package/dist/cjs/components/table.cjs +38 -0
- package/dist/cjs/components/tabs.cjs +37 -0
- package/dist/cjs/components/textarea.cjs +10 -0
- package/dist/cjs/components/theme-toggle.cjs +19 -0
- package/dist/cjs/components/toast.cjs +82 -0
- package/dist/cjs/components/toggle-group.cjs +47 -0
- package/dist/cjs/components/toggle.cjs +30 -0
- package/dist/cjs/components/tooltip.cjs +24 -0
- package/dist/cjs/components/trace.cjs +40 -0
- package/dist/cjs/hooks/use-highlighted-code.cjs +73 -0
- package/dist/cjs/hooks/use-hydrated.cjs +15 -0
- package/dist/cjs/hooks/use-mobile.cjs +36 -0
- package/dist/cjs/index.cjs +497 -0
- package/dist/cjs/lib/highlighter.cjs +96 -0
- package/dist/cjs/lib/preference.cjs +40 -0
- package/dist/cjs/providers/preference-provider.cjs +127 -0
- package/dist/cjs/providers/theme-provider.cjs +181 -0
- package/dist/cjs/types/components/accordion.d.ts +9 -0
- package/dist/cjs/types/components/alert-dialog.d.ts +20 -0
- package/dist/cjs/types/components/alert.d.ts +13 -0
- package/dist/cjs/types/components/aspect-ratio.d.ts +7 -0
- package/dist/cjs/types/components/attachment.d.ts +26 -0
- package/dist/cjs/types/components/avatar.d.ts +13 -0
- package/dist/cjs/types/components/badge.d.ts +11 -0
- package/dist/cjs/types/components/breadcrumb.d.ts +12 -0
- package/dist/cjs/types/components/bubble.d.ts +19 -0
- package/dist/cjs/types/components/button-group.d.ts +14 -0
- package/dist/cjs/types/components/button.d.ts +12 -0
- package/dist/cjs/types/components/calendar.d.ts +12 -0
- package/dist/cjs/types/components/card.d.ts +13 -0
- package/dist/cjs/types/components/carousel.d.ts +31 -0
- package/dist/cjs/types/components/chart.d.ts +47 -0
- package/dist/cjs/types/components/checkbox.d.ts +6 -0
- package/dist/cjs/types/components/code-block.d.ts +29 -0
- package/dist/cjs/types/components/collapsible.d.ts +8 -0
- package/dist/cjs/types/components/combobox.d.ts +26 -0
- package/dist/cjs/types/components/command.d.ts +21 -0
- package/dist/cjs/types/components/context-menu.d.ts +31 -0
- package/dist/cjs/types/components/dialog.d.ts +19 -0
- package/dist/cjs/types/components/direction.d.ts +1 -0
- package/dist/cjs/types/components/drawer.d.ts +18 -0
- package/dist/cjs/types/components/dropdown-menu.d.ts +31 -0
- package/dist/cjs/types/components/empty.d.ts +15 -0
- package/dist/cjs/types/components/field.d.ts +28 -0
- package/dist/cjs/types/components/hover-card.d.ts +8 -0
- package/dist/cjs/types/components/index.d.ts +65 -0
- package/dist/cjs/types/components/input-group.d.ts +21 -0
- package/dist/cjs/types/components/input-otp.d.ts +13 -0
- package/dist/cjs/types/components/input.d.ts +5 -0
- package/dist/cjs/types/components/item.d.ts +25 -0
- package/dist/cjs/types/components/kbd.d.ts +6 -0
- package/dist/cjs/types/components/label.d.ts +5 -0
- package/dist/cjs/types/components/marker.d.ts +13 -0
- package/dist/cjs/types/components/menubar.d.ts +31 -0
- package/dist/cjs/types/components/message-scroller.d.ts +13 -0
- package/dist/cjs/types/components/message.d.ts +12 -0
- package/dist/cjs/types/components/native-select.d.ts +10 -0
- package/dist/cjs/types/components/navigation-menu.d.ts +15 -0
- package/dist/cjs/types/components/pagination.d.ts +19 -0
- package/dist/cjs/types/components/popover.d.ts +11 -0
- package/dist/cjs/types/components/progress.d.ts +10 -0
- package/dist/cjs/types/components/questionnaire.d.ts +21 -0
- package/dist/cjs/types/components/radio-group.d.ts +8 -0
- package/dist/cjs/types/components/resizable.d.ts +10 -0
- package/dist/cjs/types/components/scroll-area.d.ts +7 -0
- package/dist/cjs/types/components/select.d.ts +17 -0
- package/dist/cjs/types/components/separator.d.ts +6 -0
- package/dist/cjs/types/components/sheet.d.ts +16 -0
- package/dist/cjs/types/components/sidebar.d.ts +66 -0
- package/dist/cjs/types/components/skeleton.d.ts +5 -0
- package/dist/cjs/types/components/slider.d.ts +6 -0
- package/dist/cjs/types/components/spinner.d.ts +5 -0
- package/dist/cjs/types/components/switch.d.ts +8 -0
- package/dist/cjs/types/components/table.d.ts +12 -0
- package/dist/cjs/types/components/tabs.d.ts +14 -0
- package/dist/cjs/types/components/textarea.d.ts +5 -0
- package/dist/cjs/types/components/theme-toggle.d.ts +14 -0
- package/dist/cjs/types/components/toast.d.ts +19 -0
- package/dist/cjs/types/components/toggle-group.d.ts +13 -0
- package/dist/cjs/types/components/toggle.d.ts +12 -0
- package/dist/cjs/types/components/tooltip.d.ts +9 -0
- package/dist/cjs/types/components/trace.d.ts +20 -0
- package/dist/cjs/types/hooks/index.d.ts +3 -0
- package/dist/cjs/types/hooks/use-highlighted-code.d.ts +3 -0
- package/dist/cjs/types/hooks/use-hydrated.d.ts +4 -0
- package/dist/cjs/types/hooks/use-mobile.d.ts +3 -0
- package/dist/cjs/types/index.d.ts +73 -0
- package/dist/cjs/types/lib/highlighter.d.ts +11 -0
- package/dist/cjs/types/lib/index.d.ts +3 -0
- package/dist/cjs/types/lib/preference.d.ts +85 -0
- package/dist/cjs/types/lib/utils.d.ts +1 -0
- package/dist/cjs/types/package.json +1 -0
- package/dist/cjs/types/providers/index.d.ts +2 -0
- package/dist/cjs/types/providers/preference-provider.d.ts +20 -0
- package/dist/cjs/types/providers/theme-provider.d.ts +25 -0
- package/dist/esm/components/accordion.js +19 -0
- package/dist/esm/components/alert-dialog.js +43 -0
- package/dist/esm/components/alert.js +29 -0
- package/dist/esm/components/aspect-ratio.js +10 -0
- package/dist/esm/components/attachment.js +70 -0
- package/dist/esm/components/avatar.js +24 -0
- package/dist/esm/components/badge.js +35 -0
- package/dist/esm/components/breadcrumb.js +38 -0
- package/dist/esm/components/bubble.js +61 -0
- package/dist/esm/components/button-group.js +38 -0
- package/dist/esm/components/button.js +38 -0
- package/dist/esm/components/calendar.js +78 -0
- package/dist/esm/components/card.js +26 -0
- package/dist/esm/components/carousel.js +87 -0
- package/dist/esm/components/chart.js +133 -0
- package/dist/esm/components/checkbox.js +11 -0
- package/dist/esm/components/code-block.js +82 -0
- package/dist/esm/components/collapsible.js +14 -0
- package/dist/esm/components/combobox.js +60 -0
- package/dist/esm/components/command.js +36 -0
- package/dist/esm/components/context-menu.js +53 -0
- package/dist/esm/components/dialog.js +39 -0
- package/dist/esm/components/drawer.js +77 -0
- package/dist/esm/components/dropdown-menu.js +52 -0
- package/dist/esm/components/empty.js +35 -0
- package/dist/esm/components/field.js +69 -0
- package/dist/esm/components/hover-card.js +16 -0
- package/dist/esm/components/input-group.js +59 -0
- package/dist/esm/components/input-otp.js +22 -0
- package/dist/esm/components/input.js +9 -0
- package/dist/esm/components/item.js +80 -0
- package/dist/esm/components/kbd.js +11 -0
- package/dist/esm/components/label.js +9 -0
- package/dist/esm/components/marker.js +36 -0
- package/dist/esm/components/menubar.js +58 -0
- package/dist/esm/components/message-scroller.js +27 -0
- package/dist/esm/components/message.js +23 -0
- package/dist/esm/components/native-select.js +15 -0
- package/dist/esm/components/navigation-menu.js +33 -0
- package/dist/esm/components/pagination.js +28 -0
- package/dist/esm/components/popover.js +24 -0
- package/dist/esm/components/progress.js +22 -0
- package/dist/esm/components/questionnaire.js +54 -0
- package/dist/esm/components/radio-group.js +13 -0
- package/dist/esm/components/resizable.js +16 -0
- package/dist/esm/components/scroll-area.js +12 -0
- package/dist/esm/components/select.js +36 -0
- package/dist/esm/components/separator.js +9 -0
- package/dist/esm/components/sheet.js +38 -0
- package/dist/esm/components/sidebar.js +257 -0
- package/dist/esm/components/skeleton.js +8 -0
- package/dist/esm/components/slider.js +14 -0
- package/dist/esm/components/spinner.js +9 -0
- package/dist/esm/components/switch.js +10 -0
- package/dist/esm/components/table.js +29 -0
- package/dist/esm/components/tabs.js +31 -0
- package/dist/esm/components/textarea.js +8 -0
- package/dist/esm/components/theme-toggle.js +17 -0
- package/dist/esm/components/toast.js +68 -0
- package/dist/esm/components/toggle-group.js +25 -0
- package/dist/esm/components/toggle.js +27 -0
- package/dist/esm/components/tooltip.js +19 -0
- package/dist/esm/components/trace.js +31 -0
- package/dist/esm/hooks/use-highlighted-code.js +52 -0
- package/dist/esm/hooks/use-hydrated.js +13 -0
- package/dist/esm/hooks/use-mobile.js +15 -0
- package/dist/esm/index.js +73 -0
- package/dist/esm/lib/highlighter.js +93 -0
- package/dist/esm/lib/preference.js +35 -0
- package/dist/esm/providers/preference-provider.js +124 -0
- package/dist/esm/providers/theme-provider.js +178 -0
- package/dist/styles/custom.css +2 -0
- package/dist/styles/font/LICENSE +93 -0
- package/dist/styles/font/files/11944884.woff2 +0 -0
- package/dist/styles/font/files/3f081d19.woff2 +0 -0
- package/dist/styles/font/files/aa4aa22f.woff2 +0 -0
- package/dist/styles/font/files/ba1a9b92.woff2 +0 -0
- package/dist/styles/font/files/eadd8e6c.woff2 +0 -0
- package/dist/styles/font/geist.css +2 -0
- package/dist/styles/index.css +2 -0
- package/dist/types/components/accordion.d.ts +9 -0
- package/dist/types/components/alert-dialog.d.ts +20 -0
- package/dist/types/components/alert.d.ts +13 -0
- package/dist/types/components/aspect-ratio.d.ts +7 -0
- package/dist/types/components/attachment.d.ts +26 -0
- package/dist/types/components/avatar.d.ts +13 -0
- package/dist/types/components/badge.d.ts +11 -0
- package/dist/types/components/breadcrumb.d.ts +12 -0
- package/dist/types/components/bubble.d.ts +19 -0
- package/dist/types/components/button-group.d.ts +14 -0
- package/dist/types/components/button.d.ts +12 -0
- package/dist/types/components/calendar.d.ts +12 -0
- package/dist/types/components/card.d.ts +13 -0
- package/dist/types/components/carousel.d.ts +31 -0
- package/dist/types/components/chart.d.ts +47 -0
- package/dist/types/components/checkbox.d.ts +6 -0
- package/dist/types/components/code-block.d.ts +29 -0
- package/dist/types/components/collapsible.d.ts +8 -0
- package/dist/types/components/combobox.d.ts +26 -0
- package/dist/types/components/command.d.ts +21 -0
- package/dist/types/components/context-menu.d.ts +31 -0
- package/dist/types/components/dialog.d.ts +19 -0
- package/dist/types/components/direction.d.ts +1 -0
- package/dist/types/components/drawer.d.ts +18 -0
- package/dist/types/components/dropdown-menu.d.ts +31 -0
- package/dist/types/components/empty.d.ts +15 -0
- package/dist/types/components/field.d.ts +28 -0
- package/dist/types/components/hover-card.d.ts +8 -0
- package/dist/types/components/index.d.ts +65 -0
- package/dist/types/components/input-group.d.ts +21 -0
- package/dist/types/components/input-otp.d.ts +13 -0
- package/dist/types/components/input.d.ts +5 -0
- package/dist/types/components/item.d.ts +25 -0
- package/dist/types/components/kbd.d.ts +6 -0
- package/dist/types/components/label.d.ts +5 -0
- package/dist/types/components/marker.d.ts +13 -0
- package/dist/types/components/menubar.d.ts +31 -0
- package/dist/types/components/message-scroller.d.ts +13 -0
- package/dist/types/components/message.d.ts +12 -0
- package/dist/types/components/native-select.d.ts +10 -0
- package/dist/types/components/navigation-menu.d.ts +15 -0
- package/dist/types/components/pagination.d.ts +19 -0
- package/dist/types/components/popover.d.ts +11 -0
- package/dist/types/components/progress.d.ts +10 -0
- package/dist/types/components/questionnaire.d.ts +21 -0
- package/dist/types/components/radio-group.d.ts +8 -0
- package/dist/types/components/resizable.d.ts +10 -0
- package/dist/types/components/scroll-area.d.ts +7 -0
- package/dist/types/components/select.d.ts +17 -0
- package/dist/types/components/separator.d.ts +6 -0
- package/dist/types/components/sheet.d.ts +16 -0
- package/dist/types/components/sidebar.d.ts +66 -0
- package/dist/types/components/skeleton.d.ts +5 -0
- package/dist/types/components/slider.d.ts +6 -0
- package/dist/types/components/spinner.d.ts +5 -0
- package/dist/types/components/switch.d.ts +8 -0
- package/dist/types/components/table.d.ts +12 -0
- package/dist/types/components/tabs.d.ts +14 -0
- package/dist/types/components/textarea.d.ts +5 -0
- package/dist/types/components/theme-toggle.d.ts +14 -0
- package/dist/types/components/toast.d.ts +19 -0
- package/dist/types/components/toggle-group.d.ts +13 -0
- package/dist/types/components/toggle.d.ts +12 -0
- package/dist/types/components/tooltip.d.ts +9 -0
- package/dist/types/components/trace.d.ts +20 -0
- package/dist/types/hooks/index.d.ts +3 -0
- package/dist/types/hooks/use-highlighted-code.d.ts +3 -0
- package/dist/types/hooks/use-hydrated.d.ts +4 -0
- package/dist/types/hooks/use-mobile.d.ts +3 -0
- package/dist/types/index.d.ts +73 -0
- package/dist/types/lib/highlighter.d.ts +11 -0
- package/dist/types/lib/index.d.ts +3 -0
- package/dist/types/lib/preference.d.ts +85 -0
- package/dist/types/lib/utils.d.ts +1 -0
- package/dist/types/providers/index.d.ts +2 -0
- package/dist/types/providers/preference-provider.d.ts +20 -0
- package/dist/types/providers/theme-provider.d.ts +25 -0
- package/dist/umd/index.js +86818 -0
- package/package.json +116 -4
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from 'cn';
|
|
3
|
+
|
|
4
|
+
function AspectRatio({ ratio, className, ...props }) {
|
|
5
|
+
return (jsx("div", { "data-slot": "aspect-ratio", style: {
|
|
6
|
+
"--ratio": ratio,
|
|
7
|
+
}, className: cn("relative aspect-(--ratio)", className), ...props }));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { AspectRatio };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { cn } from 'cn';
|
|
6
|
+
import { Button } from './button.js';
|
|
7
|
+
|
|
8
|
+
const attachmentVariants = cva("group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed", {
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
default: "gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2",
|
|
12
|
+
sm: "gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5",
|
|
13
|
+
xs: "gap-1.5 rounded-lg text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1",
|
|
14
|
+
},
|
|
15
|
+
orientation: {
|
|
16
|
+
horizontal: "min-w-40 items-center",
|
|
17
|
+
vertical: "w-24 flex-col has-data-[slot=attachment-content]:w-30",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
function Attachment({ className, state = "done", size = "default", orientation = "horizontal", ...props }) {
|
|
22
|
+
return (jsx("div", { "data-slot": "attachment", "data-state": state, "data-size": size, "data-orientation": orientation, className: cn(attachmentVariants({ size, orientation }), className), ...props }));
|
|
23
|
+
}
|
|
24
|
+
const attachmentMediaVariants = cva("relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5", {
|
|
25
|
+
variants: {
|
|
26
|
+
variant: {
|
|
27
|
+
icon: "",
|
|
28
|
+
image: "opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
variant: "icon",
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
function AttachmentMedia({ className, variant = "icon", ...props }) {
|
|
36
|
+
return (jsx("div", { "data-slot": "attachment-media", "data-variant": variant, className: cn(attachmentMediaVariants({ variant }), className), ...props }));
|
|
37
|
+
}
|
|
38
|
+
function AttachmentContent({ className, ...props }) {
|
|
39
|
+
return (jsx("div", { "data-slot": "attachment-content", className: cn("max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1", className), ...props }));
|
|
40
|
+
}
|
|
41
|
+
function AttachmentTitle({ className, ...props }) {
|
|
42
|
+
return (jsx("span", { "data-slot": "attachment-title", className: cn("block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer", className), ...props }));
|
|
43
|
+
}
|
|
44
|
+
function AttachmentDescription({ className, ...props }) {
|
|
45
|
+
return (jsx("span", { "data-slot": "attachment-description", className: cn("mt-0.5 block min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive", "max-w-full", className), ...props }));
|
|
46
|
+
}
|
|
47
|
+
function AttachmentActions({ className, ...props }) {
|
|
48
|
+
return (jsx("div", { "data-slot": "attachment-actions", className: cn("relative z-20 flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1", className), ...props }));
|
|
49
|
+
}
|
|
50
|
+
function AttachmentAction({ className, variant, size = "icon-xs", ...props }) {
|
|
51
|
+
return (jsx(Button, { "data-slot": "attachment-action", variant: variant ?? "ghost", size: size, className: cn(className), ...props }));
|
|
52
|
+
}
|
|
53
|
+
function AttachmentTrigger({ className, render, type, ...props }) {
|
|
54
|
+
return useRender({
|
|
55
|
+
defaultTagName: "button",
|
|
56
|
+
props: mergeProps({
|
|
57
|
+
type: render ? type : (type ?? "button"),
|
|
58
|
+
className: cn("absolute inset-0 z-10 outline-none", className),
|
|
59
|
+
}, props),
|
|
60
|
+
render,
|
|
61
|
+
state: {
|
|
62
|
+
slot: "attachment-trigger",
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function AttachmentGroup({ className, ...props }) {
|
|
67
|
+
return (jsx("div", { "data-slot": "attachment-group", className: cn("flex min-w-0 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none gap-3 overflow-x-auto overscroll-x-contain py-1 *:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start", className), ...props }));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { Attachment, AttachmentAction, AttachmentActions, AttachmentContent, AttachmentDescription, AttachmentGroup, AttachmentMedia, AttachmentTitle, AttachmentTrigger };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Avatar as Avatar$1 } from '@base-ui/react/avatar';
|
|
3
|
+
import { cn } from 'cn';
|
|
4
|
+
|
|
5
|
+
function Avatar({ className, size = "default", ...props }) {
|
|
6
|
+
return (jsx(Avatar$1.Root, { "data-slot": "avatar", "data-size": size, className: cn("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten", className), ...props }));
|
|
7
|
+
}
|
|
8
|
+
function AvatarImage({ className, ...props }) {
|
|
9
|
+
return (jsx(Avatar$1.Image, { "data-slot": "avatar-image", className: cn("aspect-square size-full rounded-full object-cover", className), ...props }));
|
|
10
|
+
}
|
|
11
|
+
function AvatarFallback({ className, ...props }) {
|
|
12
|
+
return (jsx(Avatar$1.Fallback, { "data-slot": "avatar-fallback", className: cn("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs", className), ...props }));
|
|
13
|
+
}
|
|
14
|
+
function AvatarBadge({ className, ...props }) {
|
|
15
|
+
return (jsx("span", { "data-slot": "avatar-badge", className: cn("absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none", "group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden", "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2", "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2", className), ...props }));
|
|
16
|
+
}
|
|
17
|
+
function AvatarGroup({ className, ...props }) {
|
|
18
|
+
return (jsx("div", { "data-slot": "avatar-group", className: cn("group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background", className), ...props }));
|
|
19
|
+
}
|
|
20
|
+
function AvatarGroupCount({ className, ...props }) {
|
|
21
|
+
return (jsx("div", { "data-slot": "avatar-group-count", className: cn("relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3", className), ...props }));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { cn } from 'cn';
|
|
5
|
+
|
|
6
|
+
const badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
10
|
+
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
11
|
+
destructive: "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
|
|
12
|
+
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
13
|
+
ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
14
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
variant: "default",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
function Badge({ className, variant = "default", render, ...props }) {
|
|
22
|
+
return useRender({
|
|
23
|
+
defaultTagName: "span",
|
|
24
|
+
props: mergeProps({
|
|
25
|
+
className: cn(badgeVariants({ variant }), className),
|
|
26
|
+
}, props),
|
|
27
|
+
render,
|
|
28
|
+
state: {
|
|
29
|
+
slot: "badge",
|
|
30
|
+
variant,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import { cn } from 'cn';
|
|
5
|
+
import { MoreHorizontalIcon, ChevronRightIcon } from 'lucide-react';
|
|
6
|
+
|
|
7
|
+
function Breadcrumb({ className, ...props }) {
|
|
8
|
+
return (jsx("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", className: cn(className), ...props }));
|
|
9
|
+
}
|
|
10
|
+
function BreadcrumbList({ className, ...props }) {
|
|
11
|
+
return (jsx("ol", { "data-slot": "breadcrumb-list", className: cn("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground", className), ...props }));
|
|
12
|
+
}
|
|
13
|
+
function BreadcrumbItem({ className, ...props }) {
|
|
14
|
+
return (jsx("li", { "data-slot": "breadcrumb-item", className: cn("inline-flex items-center gap-1", className), ...props }));
|
|
15
|
+
}
|
|
16
|
+
function BreadcrumbLink({ className, render, ...props }) {
|
|
17
|
+
return useRender({
|
|
18
|
+
defaultTagName: "a",
|
|
19
|
+
props: mergeProps({
|
|
20
|
+
className: cn("transition-colors hover:text-foreground", className),
|
|
21
|
+
}, props),
|
|
22
|
+
render,
|
|
23
|
+
state: {
|
|
24
|
+
slot: "breadcrumb-link",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function BreadcrumbPage({ className, ...props }) {
|
|
29
|
+
return (jsx("span", { "data-slot": "breadcrumb-page", role: "link", "aria-disabled": "true", "aria-current": "page", className: cn("font-normal text-foreground", className), ...props }));
|
|
30
|
+
}
|
|
31
|
+
function BreadcrumbSeparator({ children, className, ...props }) {
|
|
32
|
+
return (jsx("li", { "data-slot": "breadcrumb-separator", role: "presentation", "aria-hidden": "true", className: cn("[&>svg]:size-3.5", className), ...props, children: children ?? (jsx(ChevronRightIcon, {})) }));
|
|
33
|
+
}
|
|
34
|
+
function BreadcrumbEllipsis({ className, ...props }) {
|
|
35
|
+
return (jsxs("span", { "data-slot": "breadcrumb-ellipsis", role: "presentation", "aria-hidden": "true", className: cn("flex size-5 items-center justify-center [&>svg]:size-4", className), ...props, children: [jsx(MoreHorizontalIcon, {}), jsx("span", { className: "sr-only", children: "More" })] }));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { cn } from 'cn';
|
|
6
|
+
|
|
7
|
+
function BubbleGroup({ className, ...props }) {
|
|
8
|
+
return (jsx("div", { "data-slot": "bubble-group", className: cn("flex min-w-0 flex-col gap-2", className), ...props }));
|
|
9
|
+
}
|
|
10
|
+
const bubbleVariants = cva("group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full", {
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
default: "*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80",
|
|
14
|
+
secondary: "*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",
|
|
15
|
+
muted: "*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]",
|
|
16
|
+
tinted: "*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]",
|
|
17
|
+
outline: "*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30",
|
|
18
|
+
ghost: "border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50",
|
|
19
|
+
destructive: "*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
variant: "default",
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
function Bubble({ variant = "default", align = "start", className, ...props }) {
|
|
27
|
+
return (jsx("div", { "data-slot": "bubble", "data-variant": variant, "data-align": align, className: cn(bubbleVariants({ variant }), className), ...props }));
|
|
28
|
+
}
|
|
29
|
+
function BubbleContent({ className, render, ...props }) {
|
|
30
|
+
return useRender({
|
|
31
|
+
defaultTagName: "div",
|
|
32
|
+
props: mergeProps({
|
|
33
|
+
className: cn("w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50", className),
|
|
34
|
+
}, props),
|
|
35
|
+
render,
|
|
36
|
+
state: {
|
|
37
|
+
slot: "bubble-content",
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const bubbleReactionsVariants = cva("absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0", {
|
|
42
|
+
variants: {
|
|
43
|
+
side: {
|
|
44
|
+
top: "top-0 -translate-y-3/4",
|
|
45
|
+
bottom: "bottom-0 translate-y-3/4",
|
|
46
|
+
},
|
|
47
|
+
align: {
|
|
48
|
+
start: "left-3",
|
|
49
|
+
end: "right-3",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
defaultVariants: {
|
|
53
|
+
side: "bottom",
|
|
54
|
+
align: "end",
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
function BubbleReactions({ side = "bottom", align = "end", className, ...props }) {
|
|
58
|
+
return (jsx("div", { "data-slot": "bubble-reactions", "data-align": align, "data-side": side, className: cn(bubbleReactionsVariants({ side, align }), className), ...props }));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { Bubble, BubbleContent, BubbleGroup, BubbleReactions };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { cn } from 'cn';
|
|
6
|
+
import { Separator } from './separator.js';
|
|
7
|
+
|
|
8
|
+
const buttonGroupVariants = cva("flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", {
|
|
9
|
+
variants: {
|
|
10
|
+
orientation: {
|
|
11
|
+
horizontal: "*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0",
|
|
12
|
+
vertical: "flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
orientation: "horizontal",
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
function ButtonGroup({ className, orientation, ...props }) {
|
|
20
|
+
return (jsx("div", { role: "group", "data-slot": "button-group", "data-orientation": orientation, className: cn(buttonGroupVariants({ orientation }), className), ...props }));
|
|
21
|
+
}
|
|
22
|
+
function ButtonGroupText({ className, render, ...props }) {
|
|
23
|
+
return useRender({
|
|
24
|
+
defaultTagName: "div",
|
|
25
|
+
props: mergeProps({
|
|
26
|
+
className: cn("flex items-center gap-2 rounded-lg border bg-muted px-2.5 text-sm font-medium [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", className),
|
|
27
|
+
}, props),
|
|
28
|
+
render,
|
|
29
|
+
state: {
|
|
30
|
+
slot: "button-group-text",
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function ButtonGroupSeparator({ className, orientation = "vertical", ...props }) {
|
|
35
|
+
return (jsx(Separator, { "data-slot": "button-group-separator", orientation: orientation, className: cn("relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto", className), ...props }));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Button as Button$1 } from '@base-ui/react/button';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { cn } from 'cn';
|
|
5
|
+
|
|
6
|
+
const buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: 'bg-primary text-primary-foreground hover:bg-primary/80',
|
|
10
|
+
outline: 'border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50',
|
|
11
|
+
secondary: 'bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground',
|
|
12
|
+
ghost: 'hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50',
|
|
13
|
+
destructive: 'bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40',
|
|
14
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
15
|
+
},
|
|
16
|
+
size: {
|
|
17
|
+
default: 'h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
|
|
18
|
+
xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
19
|
+
sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
|
20
|
+
lg: 'h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
|
|
21
|
+
icon: 'size-8',
|
|
22
|
+
'icon-xs': "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
|
|
23
|
+
'icon-sm': 'size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg',
|
|
24
|
+
'icon-lg': 'size-9',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
variant: 'default',
|
|
29
|
+
size: 'default',
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
function Button({ className, variant = 'default', size = 'default', ...props }) {
|
|
33
|
+
return (jsx(Button$1, { "data-slot": "button", className: typeof className === 'function'
|
|
34
|
+
? (state) => cn(buttonVariants({ variant, size }), className(state))
|
|
35
|
+
: cn(buttonVariants({ variant, size }), className), ...props }));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { cn } from 'cn';
|
|
5
|
+
import { getDefaultClassNames, DayPicker } from 'react-day-picker';
|
|
6
|
+
import { buttonVariants, Button } from './button.js';
|
|
7
|
+
import { ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon } from 'lucide-react';
|
|
8
|
+
|
|
9
|
+
function Calendar({ className, classNames, showOutsideDays = true, captionLayout = "label", buttonVariant = "ghost", locale, formatters, components, ...props }) {
|
|
10
|
+
const defaultClassNames = getDefaultClassNames();
|
|
11
|
+
return (jsx(DayPicker, { showOutsideDays: showOutsideDays, className: cn("group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--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), captionLayout: captionLayout, locale: locale, formatters: {
|
|
12
|
+
formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: "short" }),
|
|
13
|
+
...formatters,
|
|
14
|
+
}, classNames: {
|
|
15
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
16
|
+
months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
|
|
17
|
+
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
18
|
+
nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
|
|
19
|
+
button_previous: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_previous),
|
|
20
|
+
button_next: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_next),
|
|
21
|
+
month_caption: cn("flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)", defaultClassNames.month_caption),
|
|
22
|
+
dropdowns: cn("flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium", defaultClassNames.dropdowns),
|
|
23
|
+
dropdown_root: cn("relative rounded-(--cell-radius)", defaultClassNames.dropdown_root),
|
|
24
|
+
dropdown: cn("absolute inset-0 bg-popover opacity-0", defaultClassNames.dropdown),
|
|
25
|
+
caption_label: cn("font-medium select-none", captionLayout === "label"
|
|
26
|
+
? "text-sm"
|
|
27
|
+
: "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground", defaultClassNames.caption_label),
|
|
28
|
+
month_grid: cn("w-full border-collapse", defaultClassNames.month_grid),
|
|
29
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
30
|
+
weekday: cn("flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none", defaultClassNames.weekday),
|
|
31
|
+
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
32
|
+
week_number_header: cn("w-(--cell-size) select-none", defaultClassNames.week_number_header),
|
|
33
|
+
week_number: cn("text-[0.8rem] text-muted-foreground select-none", defaultClassNames.week_number),
|
|
34
|
+
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
|
|
35
|
+
? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)"
|
|
36
|
+
: "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)", defaultClassNames.day),
|
|
37
|
+
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),
|
|
38
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
39
|
+
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),
|
|
40
|
+
today: cn("rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none", defaultClassNames.today),
|
|
41
|
+
outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
|
|
42
|
+
disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
|
|
43
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
44
|
+
...classNames,
|
|
45
|
+
}, components: {
|
|
46
|
+
Root: ({ className, rootRef, ...props }) => {
|
|
47
|
+
return (jsx("div", { "data-slot": "calendar", ref: rootRef, className: cn(className), ...props }));
|
|
48
|
+
},
|
|
49
|
+
Chevron: ({ className, orientation, ...props }) => {
|
|
50
|
+
if (orientation === "left") {
|
|
51
|
+
return (jsx(ChevronLeftIcon, { className: cn("size-4", className), ...props }));
|
|
52
|
+
}
|
|
53
|
+
if (orientation === "right") {
|
|
54
|
+
return (jsx(ChevronRightIcon, { className: cn("size-4", className), ...props }));
|
|
55
|
+
}
|
|
56
|
+
return (jsx(ChevronDownIcon, { className: cn("size-4", className), ...props }));
|
|
57
|
+
},
|
|
58
|
+
DayButton: ({ ...props }) => (jsx(CalendarDayButton, { locale: locale, ...props })),
|
|
59
|
+
WeekNumber: ({ children, week, ...props }) => {
|
|
60
|
+
return (jsx("th", { ...props, "data-week-number": week.weekNumber, children: jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children: children }) }));
|
|
61
|
+
},
|
|
62
|
+
...components,
|
|
63
|
+
}, ...props }));
|
|
64
|
+
}
|
|
65
|
+
function CalendarDayButton({ className, day, modifiers, locale, ...props }) {
|
|
66
|
+
const defaultClassNames = getDefaultClassNames();
|
|
67
|
+
const ref = React.useRef(null);
|
|
68
|
+
React.useEffect(() => {
|
|
69
|
+
if (modifiers.focused)
|
|
70
|
+
ref.current?.focus();
|
|
71
|
+
}, [modifiers.focused]);
|
|
72
|
+
return (jsx(Button, { variant: "ghost", size: "icon", "data-day": day.date.toLocaleDateString(locale?.code), "data-selected-single": modifiers.selected &&
|
|
73
|
+
!modifiers.range_start &&
|
|
74
|
+
!modifiers.range_end &&
|
|
75
|
+
!modifiers.range_middle, "data-range-start": modifiers.range_start, "data-range-end": modifiers.range_end, "data-range-middle": modifiers.range_middle, 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), ...props }));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export { Calendar, CalendarDayButton };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from 'cn';
|
|
3
|
+
|
|
4
|
+
function Card({ className, size = "default", ...props }) {
|
|
5
|
+
return (jsx("div", { "data-slot": "card", "data-size": size, className: cn("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--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=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl", className), ...props }));
|
|
6
|
+
}
|
|
7
|
+
function CardHeader({ className, ...props }) {
|
|
8
|
+
return (jsx("div", { "data-slot": "card-header", className: cn("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)", className), ...props }));
|
|
9
|
+
}
|
|
10
|
+
function CardTitle({ className, ...props }) {
|
|
11
|
+
return (jsx("div", { "data-slot": "card-title", className: cn("font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm", className), ...props }));
|
|
12
|
+
}
|
|
13
|
+
function CardDescription({ className, ...props }) {
|
|
14
|
+
return (jsx("div", { "data-slot": "card-description", className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
15
|
+
}
|
|
16
|
+
function CardAction({ className, ...props }) {
|
|
17
|
+
return (jsx("div", { "data-slot": "card-action", className: cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className), ...props }));
|
|
18
|
+
}
|
|
19
|
+
function CardContent({ className, ...props }) {
|
|
20
|
+
return (jsx("div", { "data-slot": "card-content", className: cn("px-(--card-spacing)", className), ...props }));
|
|
21
|
+
}
|
|
22
|
+
function CardFooter({ className, ...props }) {
|
|
23
|
+
return (jsx("div", { "data-slot": "card-footer", className: cn("flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)", className), ...props }));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cn } from 'cn';
|
|
4
|
+
import useEmblaCarousel from 'embla-carousel-react';
|
|
5
|
+
import { Button } from './button.js';
|
|
6
|
+
import { ChevronRightIcon, ChevronLeftIcon } from 'lucide-react';
|
|
7
|
+
|
|
8
|
+
const CarouselContext = React.createContext(null);
|
|
9
|
+
function useCarousel() {
|
|
10
|
+
const context = React.useContext(CarouselContext);
|
|
11
|
+
if (!context) {
|
|
12
|
+
throw new Error("useCarousel must be used within a <Carousel />");
|
|
13
|
+
}
|
|
14
|
+
return context;
|
|
15
|
+
}
|
|
16
|
+
function Carousel({ orientation = "horizontal", opts, setApi, plugins, className, children, ...props }) {
|
|
17
|
+
const [carouselRef, api] = useEmblaCarousel({
|
|
18
|
+
...opts,
|
|
19
|
+
axis: orientation === "horizontal" ? "x" : "y",
|
|
20
|
+
}, plugins);
|
|
21
|
+
// Embla 是外部状态源,订阅选择和重置事件并直接读取快照。
|
|
22
|
+
const subscribe = React.useCallback((onChange) => {
|
|
23
|
+
if (!api)
|
|
24
|
+
return () => { };
|
|
25
|
+
api.on("reInit", onChange);
|
|
26
|
+
api.on("select", onChange);
|
|
27
|
+
return () => {
|
|
28
|
+
api.off("reInit", onChange);
|
|
29
|
+
api.off("select", onChange);
|
|
30
|
+
};
|
|
31
|
+
}, [api]);
|
|
32
|
+
const canScrollPrev = React.useSyncExternalStore(subscribe, () => api?.canScrollPrev() ?? false, () => false);
|
|
33
|
+
const canScrollNext = React.useSyncExternalStore(subscribe, () => api?.canScrollNext() ?? false, () => false);
|
|
34
|
+
const scrollPrev = React.useCallback(() => {
|
|
35
|
+
api?.scrollPrev();
|
|
36
|
+
}, [api]);
|
|
37
|
+
const scrollNext = React.useCallback(() => {
|
|
38
|
+
api?.scrollNext();
|
|
39
|
+
}, [api]);
|
|
40
|
+
const handleKeyDown = React.useCallback((event) => {
|
|
41
|
+
if (event.key === "ArrowLeft") {
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
scrollPrev();
|
|
44
|
+
}
|
|
45
|
+
else if (event.key === "ArrowRight") {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
scrollNext();
|
|
48
|
+
}
|
|
49
|
+
}, [scrollPrev, scrollNext]);
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
if (!api || !setApi)
|
|
52
|
+
return;
|
|
53
|
+
setApi(api);
|
|
54
|
+
}, [api, setApi]);
|
|
55
|
+
return (jsx(CarouselContext.Provider, { value: {
|
|
56
|
+
carouselRef,
|
|
57
|
+
api: api,
|
|
58
|
+
opts,
|
|
59
|
+
orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
|
|
60
|
+
scrollPrev,
|
|
61
|
+
scrollNext,
|
|
62
|
+
canScrollPrev,
|
|
63
|
+
canScrollNext,
|
|
64
|
+
}, children: jsx("div", { onKeyDownCapture: handleKeyDown, className: cn("relative", className), role: "region", "aria-roledescription": "carousel", "data-slot": "carousel", ...props, children: children }) }));
|
|
65
|
+
}
|
|
66
|
+
function CarouselContent({ className, ...props }) {
|
|
67
|
+
const { carouselRef, orientation } = useCarousel();
|
|
68
|
+
return (jsx("div", { ref: carouselRef, className: "overflow-hidden", "data-slot": "carousel-content", children: jsx("div", { className: cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className), ...props }) }));
|
|
69
|
+
}
|
|
70
|
+
function CarouselItem({ className, ...props }) {
|
|
71
|
+
const { orientation } = useCarousel();
|
|
72
|
+
return (jsx("div", { role: "group", "aria-roledescription": "slide", "data-slot": "carousel-item", className: cn("min-w-0 shrink-0 grow-0 basis-full", orientation === "horizontal" ? "pl-4" : "pt-4", className), ...props }));
|
|
73
|
+
}
|
|
74
|
+
function CarouselPrevious({ className, variant = "outline", size = "icon-sm", ...props }) {
|
|
75
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
76
|
+
return (jsxs(Button, { "data-slot": "carousel-previous", variant: variant, size: size, className: cn("absolute touch-manipulation rounded-full", orientation === "horizontal"
|
|
77
|
+
? "inset-y-0 -left-12 my-auto"
|
|
78
|
+
: "-top-12 left-1/2 -translate-x-1/2 rotate-90", className), disabled: !canScrollPrev, onClick: scrollPrev, ...props, children: [jsx(ChevronLeftIcon, {}), jsx("span", { className: "sr-only", children: "Previous slide" })] }));
|
|
79
|
+
}
|
|
80
|
+
function CarouselNext({ className, variant = "outline", size = "icon-sm", ...props }) {
|
|
81
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
82
|
+
return (jsxs(Button, { "data-slot": "carousel-next", variant: variant, size: size, className: cn("absolute touch-manipulation rounded-full", orientation === "horizontal"
|
|
83
|
+
? "inset-y-0 -right-12 my-auto"
|
|
84
|
+
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", className), disabled: !canScrollNext, onClick: scrollNext, ...props, children: [jsx(ChevronRightIcon, {}), jsx("span", { className: "sr-only", children: "Next slide" })] }));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel };
|