@livemark/markdown 0.0.0-stage → 0.44.2
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.md +9 -0
- package/README.md +5 -2
- package/build/actions/markdown/compile.d.ts +27 -0
- package/build/actions/markdown/compile.js +48 -0
- package/build/actions/processor/create.d.ts +17 -0
- package/build/actions/processor/create.js +212 -0
- package/build/components/Abbr.d.ts +5 -0
- package/build/components/Abbr.js +7 -0
- package/build/components/AnsiCode.d.ts +4 -0
- package/build/components/AnsiCode.js +7 -0
- package/build/components/Audio.d.ts +4 -0
- package/build/components/Audio.js +9 -0
- package/build/components/Badge.d.ts +5 -0
- package/build/components/Badge.js +7 -0
- package/build/components/Button.d.ts +7 -0
- package/build/components/Button.js +11 -0
- package/build/components/Callout.d.ts +8 -0
- package/build/components/Callout.js +41 -0
- package/build/components/Card.d.ts +7 -0
- package/build/components/Card.js +16 -0
- package/build/components/Cards.d.ts +4 -0
- package/build/components/Cards.js +6 -0
- package/build/components/CodeBlock.d.ts +1 -0
- package/build/components/CodeBlock.js +50 -0
- package/build/components/CodeTabs.d.ts +6 -0
- package/build/components/CodeTabs.js +48 -0
- package/build/components/Column.d.ts +4 -0
- package/build/components/Column.js +6 -0
- package/build/components/Columns.d.ts +5 -0
- package/build/components/Columns.js +8 -0
- package/build/components/DefinitionList.d.ts +7 -0
- package/build/components/DefinitionList.js +14 -0
- package/build/components/Details.d.ts +5 -0
- package/build/components/Details.js +10 -0
- package/build/components/Filetree.d.ts +4 -0
- package/build/components/Filetree.js +22 -0
- package/build/components/FootnoteRef.d.ts +4 -0
- package/build/components/FootnoteRef.js +33 -0
- package/build/components/Heading.d.ts +8 -0
- package/build/components/Heading.js +18 -0
- package/build/components/Icon.d.ts +5 -0
- package/build/components/Icon.js +10 -0
- package/build/components/Markdown.d.ts +13 -0
- package/build/components/Markdown.js +75 -0
- package/build/components/Mermaid.d.ts +4 -0
- package/build/components/Mermaid.js +10 -0
- package/build/components/MermaidRenderer.d.ts +4 -0
- package/build/components/MermaidRenderer.js +44 -0
- package/build/components/PackageTabs.d.ts +9 -0
- package/build/components/PackageTabs.js +26 -0
- package/build/components/SortableTable.d.ts +5 -0
- package/build/components/SortableTable.js +63 -0
- package/build/components/Tab.d.ts +5 -0
- package/build/components/Tab.js +6 -0
- package/build/components/Tabs.d.ts +5 -0
- package/build/components/Tabs.js +46 -0
- package/build/components/Toc.d.ts +4 -0
- package/build/components/Toc.js +14 -0
- package/build/components/Video.d.ts +4 -0
- package/build/components/Video.js +13 -0
- package/build/components/ZoomImage.d.ts +4 -0
- package/build/components/ZoomImage.js +26 -0
- package/build/elements/badge.d.ts +7 -0
- package/build/elements/badge.js +36 -0
- package/build/elements/button.d.ts +8 -0
- package/build/elements/button.js +37 -0
- package/build/elements/card.d.ts +11 -0
- package/build/elements/card.js +25 -0
- package/build/elements/collapsible.d.ts +5 -0
- package/build/elements/collapsible.js +13 -0
- package/build/elements/hover-card.d.ts +5 -0
- package/build/elements/hover-card.js +14 -0
- package/build/elements/separator.d.ts +3 -0
- package/build/elements/separator.js +8 -0
- package/build/elements/table.d.ts +9 -0
- package/build/elements/table.js +28 -0
- package/build/elements/tooltip.d.ts +6 -0
- package/build/elements/tooltip.js +17 -0
- package/build/helpers/ansi.d.ts +3 -0
- package/build/helpers/ansi.js +208 -0
- package/build/helpers/article-link.d.ts +7 -0
- package/build/helpers/article-link.js +8 -0
- package/build/helpers/code-icon.d.ts +2 -0
- package/build/helpers/code-icon.js +57 -0
- package/build/helpers/content-warnings.d.ts +8 -0
- package/build/helpers/content-warnings.js +47 -0
- package/build/helpers/dynamic-icon-resolver.d.ts +5 -0
- package/build/helpers/dynamic-icon-resolver.js +11 -0
- package/build/helpers/dynamic-icon.d.ts +5 -0
- package/build/helpers/dynamic-icon.js +14 -0
- package/build/helpers/frontmatter.d.ts +5 -0
- package/build/helpers/frontmatter.js +16 -0
- package/build/helpers/icon-names.d.ts +11 -0
- package/build/helpers/icon-names.js +35 -0
- package/build/helpers/message-format.d.ts +2 -0
- package/build/helpers/message-format.js +7 -0
- package/build/helpers/node-text.d.ts +9 -0
- package/build/helpers/node-text.js +9 -0
- package/build/helpers/site-messages.d.ts +86 -0
- package/build/helpers/site-messages.js +7 -0
- package/build/helpers/toc-context.d.ts +5 -0
- package/build/helpers/toc-context.js +8 -0
- package/build/helpers/toc-outline.d.ts +3 -0
- package/build/helpers/toc-outline.js +16 -0
- package/build/helpers/youtube-id.d.ts +2 -0
- package/build/helpers/youtube-id.js +25 -0
- package/build/hooks/icons.d.ts +13 -0
- package/build/hooks/icons.js +12 -0
- package/build/hooks/messages.d.ts +95 -0
- package/build/hooks/messages.js +17 -0
- package/build/models/message.d.ts +177 -0
- package/build/models/message.js +88 -0
- package/build/models/plugins.d.ts +10 -0
- package/build/models/plugins.js +6 -0
- package/build/models/theme.d.ts +76 -0
- package/build/models/theme.js +71 -0
- package/build/models/toc.d.ts +5 -0
- package/build/models/toc.js +2 -0
- package/build/plugins/twoslash.d.ts +13 -0
- package/build/plugins/twoslash.js +146 -0
- package/package.json +63 -3
- package/source/actions/markdown/compile.ts +82 -0
- package/source/actions/processor/create.ts +235 -0
- package/source/components/Abbr.tsx +13 -0
- package/source/components/AnsiCode.tsx +17 -0
- package/source/components/Audio.tsx +18 -0
- package/source/components/Badge.tsx +9 -0
- package/source/components/Button.tsx +33 -0
- package/source/components/Callout.tsx +68 -0
- package/source/components/Card.tsx +48 -0
- package/source/components/Cards.tsx +8 -0
- package/source/components/CodeBlock.tsx +144 -0
- package/source/components/CodeTabs.tsx +81 -0
- package/source/components/Column.tsx +4 -0
- package/source/components/Columns.tsx +10 -0
- package/source/components/DefinitionList.tsx +18 -0
- package/source/components/Details.tsx +30 -0
- package/source/components/Filetree.tsx +63 -0
- package/source/components/FootnoteRef.tsx +52 -0
- package/source/components/Heading.tsx +20 -0
- package/source/components/Icon.tsx +10 -0
- package/source/components/Markdown.tsx +89 -0
- package/source/components/Mermaid.tsx +20 -0
- package/source/components/MermaidRenderer.tsx +48 -0
- package/source/components/PackageTabs.tsx +72 -0
- package/source/components/SortableTable.tsx +81 -0
- package/source/components/Tab.tsx +4 -0
- package/source/components/Tabs.tsx +75 -0
- package/source/components/Toc.tsx +30 -0
- package/source/components/Video.tsx +28 -0
- package/source/components/ZoomImage.tsx +25 -0
- package/source/elements/badge.tsx +53 -0
- package/source/elements/button.tsx +61 -0
- package/source/elements/card.tsx +102 -0
- package/source/elements/collapsible.tsx +15 -0
- package/source/elements/hover-card.tsx +47 -0
- package/source/elements/separator.tsx +22 -0
- package/source/elements/table.tsx +103 -0
- package/source/elements/tooltip.tsx +60 -0
- package/source/helpers/ansi.ts +210 -0
- package/source/helpers/article-link.ts +11 -0
- package/source/helpers/code-icon.ts +59 -0
- package/source/helpers/content-warnings.ts +56 -0
- package/source/helpers/dynamic-icon-resolver.tsx +9 -0
- package/source/helpers/dynamic-icon.tsx +19 -0
- package/source/helpers/frontmatter.ts +16 -0
- package/source/helpers/icon-names.ts +37 -0
- package/source/helpers/message-format.ts +5 -0
- package/source/helpers/node-text.ts +14 -0
- package/source/helpers/site-messages.ts +8 -0
- package/source/helpers/toc-context.ts +10 -0
- package/source/helpers/toc-outline.ts +23 -0
- package/source/helpers/youtube-id.ts +23 -0
- package/source/hooks/icons.ts +18 -0
- package/source/hooks/messages.ts +28 -0
- package/source/models/message.ts +96 -0
- package/source/models/plugins.ts +11 -0
- package/source/models/theme.ts +78 -0
- package/source/models/toc.ts +5 -0
- package/source/plugins/twoslash.ts +163 -0
- package/source/standalone.css +7 -0
- package/source/styles/general.css +214 -0
- package/source/styles/markdown.css +231 -0
- package/source/styles/shape.css +14 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useEffect, useState, type ComponentProps } from "react"
|
|
2
|
+
import Zoom from "react-medium-image-zoom"
|
|
3
|
+
import "react-medium-image-zoom/dist/styles.css"
|
|
4
|
+
|
|
5
|
+
/** Image component with click-to-zoom and light/dark theme variant support */
|
|
6
|
+
export function ZoomImage(props: ComponentProps<"img">) {
|
|
7
|
+
const [mounted, setMounted] = useState(false)
|
|
8
|
+
useEffect(() => setMounted(true), [])
|
|
9
|
+
|
|
10
|
+
const src = props.src ?? ""
|
|
11
|
+
let imgProps = props
|
|
12
|
+
if (src.endsWith("#light")) {
|
|
13
|
+
imgProps = { ...props, src: src.slice(0, -6), className: "dark:hidden" }
|
|
14
|
+
} else if (src.endsWith("#dark")) {
|
|
15
|
+
imgProps = {
|
|
16
|
+
...props,
|
|
17
|
+
src: src.slice(0, -5),
|
|
18
|
+
className: "hidden dark:block",
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const img = <img {...imgProps} alt={imgProps.alt ?? ""} />
|
|
23
|
+
if (!mounted) return img
|
|
24
|
+
return <Zoom>{img}</Zoom>
|
|
25
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { mergeProps } from "@base-ui/react/merge-props"
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render"
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
|
+
import { cn } from "cn"
|
|
5
|
+
|
|
6
|
+
const badgeVariants = cva(
|
|
7
|
+
"h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive overflow-hidden group/badge",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
12
|
+
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
13
|
+
destructive:
|
|
14
|
+
"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",
|
|
15
|
+
positive:
|
|
16
|
+
"bg-positive/10 [a]:hover:bg-positive/20 focus-visible:ring-positive/20 dark:focus-visible:ring-positive/40 text-positive-tint-foreground dark:bg-positive/20",
|
|
17
|
+
warning:
|
|
18
|
+
"bg-warning/10 [a]:hover:bg-warning/20 focus-visible:ring-warning/20 dark:focus-visible:ring-warning/40 text-warning-tint-foreground dark:bg-warning/20",
|
|
19
|
+
outline:
|
|
20
|
+
"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
21
|
+
ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
22
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
variant: "default",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
function Badge({
|
|
32
|
+
className,
|
|
33
|
+
variant = "default",
|
|
34
|
+
render,
|
|
35
|
+
...props
|
|
36
|
+
}: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>) {
|
|
37
|
+
return useRender({
|
|
38
|
+
defaultTagName: "span",
|
|
39
|
+
props: mergeProps<"span">(
|
|
40
|
+
{
|
|
41
|
+
className: cn(badgeVariants({ className, variant })),
|
|
42
|
+
},
|
|
43
|
+
props,
|
|
44
|
+
),
|
|
45
|
+
render,
|
|
46
|
+
state: {
|
|
47
|
+
slot: "badge",
|
|
48
|
+
variant,
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { Badge, badgeVariants }
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
import { cn } from "cn"
|
|
4
|
+
|
|
5
|
+
const buttonVariants = cva(
|
|
6
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-control border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
11
|
+
outline:
|
|
12
|
+
"border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground shadow-xs",
|
|
13
|
+
secondary:
|
|
14
|
+
"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
15
|
+
ghost:
|
|
16
|
+
"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",
|
|
17
|
+
destructive:
|
|
18
|
+
"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",
|
|
19
|
+
positive:
|
|
20
|
+
"bg-positive/10 hover:bg-positive/20 focus-visible:ring-positive/20 dark:focus-visible:ring-positive/40 dark:bg-positive/20 text-positive-tint-foreground focus-visible:border-positive/40 dark:hover:bg-positive/30",
|
|
21
|
+
warning:
|
|
22
|
+
"bg-warning/10 hover:bg-warning/20 focus-visible:ring-warning/20 dark:focus-visible:ring-warning/40 dark:bg-warning/20 text-warning-tint-foreground focus-visible:border-warning/40 dark:hover:bg-warning/30",
|
|
23
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
24
|
+
},
|
|
25
|
+
size: {
|
|
26
|
+
default:
|
|
27
|
+
"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-control has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
28
|
+
xs: "h-6 gap-1 rounded-control-xs px-2 text-xs in-data-[slot=button-group]:rounded-control has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
29
|
+
sm: "h-8 gap-1 rounded-control-sm px-2.5 in-data-[slot=button-group]:rounded-control has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
|
|
30
|
+
lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
|
|
31
|
+
icon: "size-9",
|
|
32
|
+
"icon-xs":
|
|
33
|
+
"size-6 rounded-control-xs in-data-[slot=button-group]:rounded-control [&_svg:not([class*='size-'])]:size-3",
|
|
34
|
+
"icon-sm":
|
|
35
|
+
"size-8 rounded-control-sm in-data-[slot=button-group]:rounded-control",
|
|
36
|
+
"icon-lg": "size-10",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
variant: "default",
|
|
41
|
+
size: "default",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
function Button({
|
|
47
|
+
className,
|
|
48
|
+
variant = "default",
|
|
49
|
+
size = "default",
|
|
50
|
+
...props
|
|
51
|
+
}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {
|
|
52
|
+
return (
|
|
53
|
+
<ButtonPrimitive
|
|
54
|
+
data-slot="button"
|
|
55
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
56
|
+
{...props}
|
|
57
|
+
/>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { Button, buttonVariants }
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type * as React from "react"
|
|
2
|
+
import { cn } from "cn"
|
|
3
|
+
|
|
4
|
+
function Card({
|
|
5
|
+
className,
|
|
6
|
+
size = "default",
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentProps<"div"> & { size?: "default" | "sm" }) {
|
|
9
|
+
return (
|
|
10
|
+
<div
|
|
11
|
+
data-slot="card"
|
|
12
|
+
data-size={size}
|
|
13
|
+
className={cn(
|
|
14
|
+
"ring-foreground/10 bg-card text-card-foreground gap-6 overflow-hidden rounded-card py-6 text-sm shadow-xs ring-1 has-[>img:first-child]:pt-0 data-[size=sm]:gap-4 data-[size=sm]:py-4 *:[img:first-child]:rounded-t-card *:[img:last-child]:rounded-b-card group/card flex flex-col",
|
|
15
|
+
className,
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
23
|
+
return (
|
|
24
|
+
<div
|
|
25
|
+
data-slot="card-header"
|
|
26
|
+
className={cn(
|
|
27
|
+
"gap-1 rounded-t-card px-6 group-data-[size=sm]/card:px-4 [.border-b]:pb-6 group-data-[size=sm]/card:[.border-b]:pb-4 group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]",
|
|
28
|
+
className,
|
|
29
|
+
)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
36
|
+
return (
|
|
37
|
+
<div
|
|
38
|
+
data-slot="card-title"
|
|
39
|
+
className={cn(
|
|
40
|
+
"text-base leading-normal font-medium group-data-[size=sm]/card:text-sm",
|
|
41
|
+
className,
|
|
42
|
+
)}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
49
|
+
return (
|
|
50
|
+
<div
|
|
51
|
+
data-slot="card-description"
|
|
52
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
59
|
+
return (
|
|
60
|
+
<div
|
|
61
|
+
data-slot="card-action"
|
|
62
|
+
className={cn(
|
|
63
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
64
|
+
className,
|
|
65
|
+
)}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
72
|
+
return (
|
|
73
|
+
<div
|
|
74
|
+
data-slot="card-content"
|
|
75
|
+
className={cn("px-6 group-data-[size=sm]/card:px-4", className)}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
82
|
+
return (
|
|
83
|
+
<div
|
|
84
|
+
data-slot="card-footer"
|
|
85
|
+
className={cn(
|
|
86
|
+
"rounded-b-card px-6 group-data-[size=sm]/card:px-4 [.border-t]:pt-6 group-data-[size=sm]/card:[.border-t]:pt-4 flex items-center",
|
|
87
|
+
className,
|
|
88
|
+
)}
|
|
89
|
+
{...props}
|
|
90
|
+
/>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export {
|
|
95
|
+
Card,
|
|
96
|
+
CardHeader,
|
|
97
|
+
CardFooter,
|
|
98
|
+
CardTitle,
|
|
99
|
+
CardAction,
|
|
100
|
+
CardDescription,
|
|
101
|
+
CardContent,
|
|
102
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible"
|
|
2
|
+
|
|
3
|
+
function Collapsible({ ...props }: CollapsiblePrimitive.Root.Props) {
|
|
4
|
+
return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function CollapsibleTrigger({ ...props }: CollapsiblePrimitive.Trigger.Props) {
|
|
8
|
+
return <CollapsiblePrimitive.Trigger data-slot="collapsible-trigger" {...props} />
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function CollapsibleContent({ ...props }: CollapsiblePrimitive.Panel.Props) {
|
|
12
|
+
return <CollapsiblePrimitive.Panel data-slot="collapsible-content" {...props} />
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { PreviewCard as PreviewCardPrimitive } from "@base-ui/react/preview-card"
|
|
2
|
+
|
|
3
|
+
import { cn } from "cn"
|
|
4
|
+
|
|
5
|
+
function HoverCard({ ...props }: PreviewCardPrimitive.Root.Props) {
|
|
6
|
+
return <PreviewCardPrimitive.Root data-slot="hover-card" {...props} />
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function HoverCardTrigger({ ...props }: PreviewCardPrimitive.Trigger.Props) {
|
|
10
|
+
return <PreviewCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function HoverCardContent({
|
|
14
|
+
className,
|
|
15
|
+
side = "bottom",
|
|
16
|
+
sideOffset = 4,
|
|
17
|
+
align = "center",
|
|
18
|
+
alignOffset = 4,
|
|
19
|
+
...props
|
|
20
|
+
}: PreviewCardPrimitive.Popup.Props &
|
|
21
|
+
Pick<
|
|
22
|
+
PreviewCardPrimitive.Positioner.Props,
|
|
23
|
+
"align" | "alignOffset" | "side" | "sideOffset"
|
|
24
|
+
>) {
|
|
25
|
+
return (
|
|
26
|
+
<PreviewCardPrimitive.Portal data-slot="hover-card-portal">
|
|
27
|
+
<PreviewCardPrimitive.Positioner
|
|
28
|
+
align={align}
|
|
29
|
+
alignOffset={alignOffset}
|
|
30
|
+
side={side}
|
|
31
|
+
sideOffset={sideOffset}
|
|
32
|
+
className="isolate z-50"
|
|
33
|
+
>
|
|
34
|
+
<PreviewCardPrimitive.Popup
|
|
35
|
+
data-slot="hover-card-content"
|
|
36
|
+
className={cn(
|
|
37
|
+
"z-50 w-64 origin-(--transform-origin) rounded-card bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
38
|
+
className,
|
|
39
|
+
)}
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
</PreviewCardPrimitive.Positioner>
|
|
43
|
+
</PreviewCardPrimitive.Portal>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { HoverCard, HoverCardTrigger, HoverCardContent }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Separator as SeparatorPrimitive } from "@base-ui/react/separator"
|
|
2
|
+
import { cn } from "cn"
|
|
3
|
+
|
|
4
|
+
function Separator({
|
|
5
|
+
className,
|
|
6
|
+
orientation = "horizontal",
|
|
7
|
+
...props
|
|
8
|
+
}: SeparatorPrimitive.Props) {
|
|
9
|
+
return (
|
|
10
|
+
<SeparatorPrimitive
|
|
11
|
+
data-slot="separator"
|
|
12
|
+
orientation={orientation}
|
|
13
|
+
className={cn(
|
|
14
|
+
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",
|
|
15
|
+
className,
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { Separator }
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { cn } from "cn"
|
|
2
|
+
|
|
3
|
+
function Table({ className, ...props }: React.ComponentProps<"table">) {
|
|
4
|
+
return (
|
|
5
|
+
<div data-slot="table-container" className="relative w-full overflow-x-auto">
|
|
6
|
+
<table
|
|
7
|
+
data-slot="table"
|
|
8
|
+
className={cn("w-full caption-bottom text-sm", className)}
|
|
9
|
+
{...props}
|
|
10
|
+
/>
|
|
11
|
+
</div>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
|
|
16
|
+
return (
|
|
17
|
+
<thead
|
|
18
|
+
data-slot="table-header"
|
|
19
|
+
className={cn("[&_tr]:border-b", className)}
|
|
20
|
+
{...props}
|
|
21
|
+
/>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
|
|
26
|
+
return (
|
|
27
|
+
<tbody
|
|
28
|
+
data-slot="table-body"
|
|
29
|
+
className={cn("[&_tr:last-child]:border-0", className)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
|
|
36
|
+
return (
|
|
37
|
+
<tfoot
|
|
38
|
+
data-slot="table-footer"
|
|
39
|
+
className={cn("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0", className)}
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
|
|
46
|
+
return (
|
|
47
|
+
<tr
|
|
48
|
+
data-slot="table-row"
|
|
49
|
+
className={cn(
|
|
50
|
+
"hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
|
|
51
|
+
className,
|
|
52
|
+
)}
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function TableHead({ className, ...props }: React.ComponentProps<"th">) {
|
|
59
|
+
return (
|
|
60
|
+
<th
|
|
61
|
+
data-slot="table-head"
|
|
62
|
+
className={cn(
|
|
63
|
+
"text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0",
|
|
64
|
+
className,
|
|
65
|
+
)}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function TableCell({ className, ...props }: React.ComponentProps<"td">) {
|
|
72
|
+
return (
|
|
73
|
+
<td
|
|
74
|
+
data-slot="table-cell"
|
|
75
|
+
className={cn(
|
|
76
|
+
"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",
|
|
77
|
+
className,
|
|
78
|
+
)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function TableCaption({ className, ...props }: React.ComponentProps<"caption">) {
|
|
85
|
+
return (
|
|
86
|
+
<caption
|
|
87
|
+
data-slot="table-caption"
|
|
88
|
+
className={cn("text-muted-foreground mt-4 text-sm", className)}
|
|
89
|
+
{...props}
|
|
90
|
+
/>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export {
|
|
95
|
+
Table,
|
|
96
|
+
TableHeader,
|
|
97
|
+
TableBody,
|
|
98
|
+
TableFooter,
|
|
99
|
+
TableHead,
|
|
100
|
+
TableRow,
|
|
101
|
+
TableCell,
|
|
102
|
+
TableCaption,
|
|
103
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip"
|
|
2
|
+
import { cn } from "cn"
|
|
3
|
+
|
|
4
|
+
function TooltipProvider({ delay = 0, ...props }: TooltipPrimitive.Provider.Props) {
|
|
5
|
+
return (
|
|
6
|
+
<TooltipPrimitive.Provider data-slot="tooltip-provider" delay={delay} {...props} />
|
|
7
|
+
)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function Tooltip({ ...props }: TooltipPrimitive.Root.Props) {
|
|
11
|
+
return (
|
|
12
|
+
<TooltipProvider>
|
|
13
|
+
<TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
|
14
|
+
</TooltipProvider>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) {
|
|
19
|
+
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function TooltipContent({
|
|
23
|
+
className,
|
|
24
|
+
side = "top",
|
|
25
|
+
sideOffset = 4,
|
|
26
|
+
align = "center",
|
|
27
|
+
alignOffset = 0,
|
|
28
|
+
children,
|
|
29
|
+
...props
|
|
30
|
+
}: TooltipPrimitive.Popup.Props &
|
|
31
|
+
Pick<
|
|
32
|
+
TooltipPrimitive.Positioner.Props,
|
|
33
|
+
"align" | "alignOffset" | "side" | "sideOffset"
|
|
34
|
+
>) {
|
|
35
|
+
return (
|
|
36
|
+
<TooltipPrimitive.Portal>
|
|
37
|
+
<TooltipPrimitive.Positioner
|
|
38
|
+
align={align}
|
|
39
|
+
alignOffset={alignOffset}
|
|
40
|
+
side={side}
|
|
41
|
+
sideOffset={sideOffset}
|
|
42
|
+
className="isolate z-50"
|
|
43
|
+
>
|
|
44
|
+
<TooltipPrimitive.Popup
|
|
45
|
+
data-slot="tooltip-content"
|
|
46
|
+
className={cn(
|
|
47
|
+
"data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 rounded-md px-3 py-1.5 text-xs data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 bg-foreground text-background z-50 w-fit max-w-xs origin-(--transform-origin)",
|
|
48
|
+
className,
|
|
49
|
+
)}
|
|
50
|
+
{...props}
|
|
51
|
+
>
|
|
52
|
+
{children}
|
|
53
|
+
<TooltipPrimitive.Arrow className="size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 bg-foreground fill-foreground z-50 data-[side=bottom]:top-1 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5" />
|
|
54
|
+
</TooltipPrimitive.Popup>
|
|
55
|
+
</TooltipPrimitive.Positioner>
|
|
56
|
+
</TooltipPrimitive.Portal>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|