livemark 0.0.0-dev
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 +3 -0
- package/build/actions/config/define.d.ts +6 -0
- package/build/actions/config/define.js +8 -0
- package/build/actions/config/define.unit.d.ts +1 -0
- package/build/actions/config/define.unit.js +34 -0
- package/build/actions/config/load.d.ts +5 -0
- package/build/actions/config/load.js +22 -0
- package/build/actions/config/load.unit.d.ts +1 -0
- package/build/actions/config/load.unit.js +23 -0
- package/build/commands/build.d.ts +5 -0
- package/build/commands/build.js +13 -0
- package/build/commands/preview.d.ts +5 -0
- package/build/commands/preview.js +18 -0
- package/build/commands/start.d.ts +5 -0
- package/build/commands/start.js +19 -0
- package/build/docs/markdown/includes/example.d.ts +9 -0
- package/build/docs/markdown/includes/example.js +5 -0
- package/build/entrypoints/main.d.ts +2 -0
- package/build/entrypoints/main.js +12 -0
- package/build/helpers/program.d.ts +2 -0
- package/build/helpers/program.js +5 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +2 -0
- package/build/livemark.config.d.ts +9 -0
- package/build/livemark.config.js +5 -0
- package/build/models/config.d.ts +33 -0
- package/build/models/config.js +14 -0
- package/build/program.d.ts +2 -0
- package/build/program.js +14 -0
- package/build/vite.config.d.ts +2 -0
- package/build/vite.config.js +48 -0
- package/build/website/client.tsx +10 -0
- package/build/website/components/Abbr.tsx +17 -0
- package/build/website/components/AnsiCode.tsx +15 -0
- package/build/website/components/Banner.tsx +32 -0
- package/build/website/components/Breadcrumbs.tsx +19 -0
- package/build/website/components/Callout.tsx +72 -0
- package/build/website/components/Cards.tsx +66 -0
- package/build/website/components/CodeBlock.tsx +118 -0
- package/build/website/components/CodeTabs.tsx +83 -0
- package/build/website/components/Columns.tsx +17 -0
- package/build/website/components/Content.tsx +7 -0
- package/build/website/components/ContentTab.tsx +7 -0
- package/build/website/components/ContentTabs.tsx +82 -0
- package/build/website/components/DefaultCatchBoundary.tsx +54 -0
- package/build/website/components/DefinitionList.tsx +21 -0
- package/build/website/components/Details.tsx +30 -0
- package/build/website/components/FileTree.tsx +52 -0
- package/build/website/components/Footer.tsx +9 -0
- package/build/website/components/FootnoteRef.tsx +52 -0
- package/build/website/components/Heading.tsx +20 -0
- package/build/website/components/InlineBadge.tsx +9 -0
- package/build/website/components/InlineIcon.tsx +21 -0
- package/build/website/components/InlineToc.tsx +31 -0
- package/build/website/components/Layout.tsx +220 -0
- package/build/website/components/LinkButton.tsx +31 -0
- package/build/website/components/Mermaid.tsx +37 -0
- package/build/website/components/NotFound.tsx +27 -0
- package/build/website/components/PackageTabs.tsx +74 -0
- package/build/website/components/PageToolbar.tsx +65 -0
- package/build/website/components/PrevNext.tsx +52 -0
- package/build/website/components/SearchDialog.tsx +245 -0
- package/build/website/components/Section.tsx +24 -0
- package/build/website/components/SectionHeader.tsx +35 -0
- package/build/website/components/SiteTitle.tsx +16 -0
- package/build/website/components/SortableTable.tsx +81 -0
- package/build/website/components/SoundCloud.tsx +16 -0
- package/build/website/components/Theme.tsx +40 -0
- package/build/website/components/Toc.tsx +99 -0
- package/build/website/components/YouTube.tsx +16 -0
- package/build/website/components/ZoomImage.tsx +30 -0
- package/build/website/content-collections.ts +181 -0
- package/build/website/elements/accordion.tsx +78 -0
- package/build/website/elements/alert-dialog.tsx +185 -0
- package/build/website/elements/alert.tsx +74 -0
- package/build/website/elements/aspect-ratio.tsx +22 -0
- package/build/website/elements/avatar.tsx +107 -0
- package/build/website/elements/badge.tsx +51 -0
- package/build/website/elements/breadcrumb.tsx +120 -0
- package/build/website/elements/button-group.tsx +87 -0
- package/build/website/elements/button.tsx +57 -0
- package/build/website/elements/calendar.tsx +229 -0
- package/build/website/elements/card.tsx +102 -0
- package/build/website/elements/carousel.tsx +240 -0
- package/build/website/elements/chart.tsx +372 -0
- package/build/website/elements/checkbox.tsx +26 -0
- package/build/website/elements/collapsible.tsx +19 -0
- package/build/website/elements/command.tsx +210 -0
- package/build/website/elements/context-menu.tsx +270 -0
- package/build/website/elements/dialog.tsx +152 -0
- package/build/website/elements/direction.tsx +4 -0
- package/build/website/elements/drawer.tsx +127 -0
- package/build/website/elements/dropdown-menu.tsx +260 -0
- package/build/website/elements/empty.tsx +104 -0
- package/build/website/elements/field.tsx +235 -0
- package/build/website/elements/hover-card.tsx +49 -0
- package/build/website/elements/input-group.tsx +171 -0
- package/build/website/elements/input-otp.tsx +84 -0
- package/build/website/elements/input.tsx +18 -0
- package/build/website/elements/item.tsx +199 -0
- package/build/website/elements/kbd.tsx +26 -0
- package/build/website/elements/label.tsx +17 -0
- package/build/website/elements/menubar.tsx +282 -0
- package/build/website/elements/native-select.tsx +56 -0
- package/build/website/elements/navigation-menu.tsx +171 -0
- package/build/website/elements/pagination.tsx +133 -0
- package/build/website/elements/popover.tsx +88 -0
- package/build/website/elements/progress.tsx +81 -0
- package/build/website/elements/radio-group.tsx +36 -0
- package/build/website/elements/resizable.tsx +48 -0
- package/build/website/elements/scroll-area.tsx +51 -0
- package/build/website/elements/select.tsx +200 -0
- package/build/website/elements/separator.tsx +22 -0
- package/build/website/elements/sheet.tsx +130 -0
- package/build/website/elements/sidebar.tsx +717 -0
- package/build/website/elements/skeleton.tsx +13 -0
- package/build/website/elements/slider.tsx +57 -0
- package/build/website/elements/sonner.tsx +40 -0
- package/build/website/elements/spinner.tsx +16 -0
- package/build/website/elements/switch.tsx +30 -0
- package/build/website/elements/table.tsx +112 -0
- package/build/website/elements/tabs.tsx +79 -0
- package/build/website/elements/textarea.tsx +16 -0
- package/build/website/elements/toggle-group.tsx +87 -0
- package/build/website/elements/toggle.tsx +43 -0
- package/build/website/elements/tooltip.tsx +67 -0
- package/build/website/env.d.ts +10 -0
- package/build/website/globals.d.ts +8 -0
- package/build/website/helpers/article-icon.ts +59 -0
- package/build/website/helpers/articles.ts +24 -0
- package/build/website/helpers/resolve-includes.ts +131 -0
- package/build/website/helpers/resolve-includes.unit.ts +126 -0
- package/build/website/helpers/search-text.ts +15 -0
- package/build/website/helpers/style.ts +6 -0
- package/build/website/helpers/theme.ts +27 -0
- package/build/website/helpers/toc-context.ts +10 -0
- package/build/website/helpers/toc.ts +51 -0
- package/build/website/helpers/toc.unit.ts +74 -0
- package/build/website/hooks/in-view.ts +30 -0
- package/build/website/hooks/media.ts +19 -0
- package/build/website/models/article.ts +40 -0
- package/build/website/plugins/rehype-inline-code.ts +107 -0
- package/build/website/plugins/remark-abbr.ts +46 -0
- package/build/website/plugins/remark-abbr.unit.ts +99 -0
- package/build/website/plugins/remark-ansi.ts +247 -0
- package/build/website/plugins/remark-ansi.unit.ts +197 -0
- package/build/website/plugins/remark-badge.ts +50 -0
- package/build/website/plugins/remark-badge.unit.ts +96 -0
- package/build/website/plugins/remark-button.ts +60 -0
- package/build/website/plugins/remark-button.unit.ts +147 -0
- package/build/website/plugins/remark-callout.ts +57 -0
- package/build/website/plugins/remark-card.ts +80 -0
- package/build/website/plugins/remark-code-tabs.ts +87 -0
- package/build/website/plugins/remark-columns.ts +66 -0
- package/build/website/plugins/remark-custom-heading-id.ts +70 -0
- package/build/website/plugins/remark-custom-heading-id.unit.ts +131 -0
- package/build/website/plugins/remark-deflist.ts +36 -0
- package/build/website/plugins/remark-details.ts +49 -0
- package/build/website/plugins/remark-filetree.ts +89 -0
- package/build/website/plugins/remark-filetree.unit.ts +137 -0
- package/build/website/plugins/remark-github-callout.ts +71 -0
- package/build/website/plugins/remark-icon.ts +42 -0
- package/build/website/plugins/remark-image.ts +25 -0
- package/build/website/plugins/remark-media.ts +62 -0
- package/build/website/plugins/remark-media.unit.ts +74 -0
- package/build/website/plugins/remark-mermaid.ts +23 -0
- package/build/website/plugins/remark-npm.ts +52 -0
- package/build/website/plugins/remark-steps.ts +36 -0
- package/build/website/plugins/remark-steps.unit.ts +97 -0
- package/build/website/plugins/remark-tab.ts +100 -0
- package/build/website/plugins/remark-tab.unit.ts +181 -0
- package/build/website/plugins/remark-toc.ts +39 -0
- package/build/website/plugins/remark-toc.unit.ts +82 -0
- package/build/website/plugins/shiki-icon.ts +82 -0
- package/build/website/plugins/shiki-line-highlight.ts +174 -0
- package/build/website/public/logo.svg +72 -0
- package/build/website/routeTree.gen.ts +86 -0
- package/build/website/router.tsx +34 -0
- package/build/website/routes/$.tsx +149 -0
- package/build/website/routes/__root.tsx +84 -0
- package/build/website/routes/index.tsx +13 -0
- package/build/website/server.ts +7 -0
- package/build/website/styles/general.css +347 -0
- package/build/website/vite.config.ts +36 -0
- package/entrypoints/main.ts +12 -0
- package/package.json +120 -0
|
@@ -0,0 +1,199 @@
|
|
|
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 "../helpers/style.ts"
|
|
5
|
+
import { Separator } from "./separator.tsx"
|
|
6
|
+
|
|
7
|
+
function ItemGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
8
|
+
return (
|
|
9
|
+
<div
|
|
10
|
+
role="list"
|
|
11
|
+
data-slot="item-group"
|
|
12
|
+
className={cn(
|
|
13
|
+
"gap-4 has-[[data-size=sm]]:gap-2.5 has-[[data-size=xs]]:gap-2 group/item-group flex w-full flex-col",
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function ItemSeparator({
|
|
22
|
+
className,
|
|
23
|
+
...props
|
|
24
|
+
}: React.ComponentProps<typeof Separator>) {
|
|
25
|
+
return (
|
|
26
|
+
<Separator
|
|
27
|
+
data-slot="item-separator"
|
|
28
|
+
orientation="horizontal"
|
|
29
|
+
className={cn("my-2", className)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const itemVariants = cva(
|
|
36
|
+
"[a]:hover:bg-muted rounded-md border text-sm w-full group/item focus-visible:border-ring focus-visible:ring-ring/50 flex items-center flex-wrap outline-none transition-colors duration-100 focus-visible:ring-[3px] [a]:transition-colors",
|
|
37
|
+
{
|
|
38
|
+
variants: {
|
|
39
|
+
variant: {
|
|
40
|
+
default: "border-transparent",
|
|
41
|
+
outline: "border-border",
|
|
42
|
+
muted: "bg-muted/50 border-transparent",
|
|
43
|
+
},
|
|
44
|
+
size: {
|
|
45
|
+
default: "gap-3.5 px-4 py-3.5",
|
|
46
|
+
sm: "gap-2.5 px-3 py-2.5",
|
|
47
|
+
xs: "gap-2 px-2.5 py-2 [[data-slot=dropdown-menu-content]_&]:p-0",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
defaultVariants: {
|
|
51
|
+
variant: "default",
|
|
52
|
+
size: "default",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
function Item({
|
|
58
|
+
className,
|
|
59
|
+
variant = "default",
|
|
60
|
+
size = "default",
|
|
61
|
+
render,
|
|
62
|
+
...props
|
|
63
|
+
}: useRender.ComponentProps<"div"> & VariantProps<typeof itemVariants>) {
|
|
64
|
+
return useRender({
|
|
65
|
+
defaultTagName: "div",
|
|
66
|
+
props: mergeProps<"div">(
|
|
67
|
+
{
|
|
68
|
+
className: cn(itemVariants({ variant, size, className })),
|
|
69
|
+
},
|
|
70
|
+
props,
|
|
71
|
+
),
|
|
72
|
+
render,
|
|
73
|
+
state: {
|
|
74
|
+
slot: "item",
|
|
75
|
+
variant,
|
|
76
|
+
size,
|
|
77
|
+
},
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const itemMediaVariants = cva(
|
|
82
|
+
"gap-2 group-has-[[data-slot=item-description]]/item:translate-y-0.5 group-has-[[data-slot=item-description]]/item:self-start flex shrink-0 items-center justify-center [&_svg]:pointer-events-none",
|
|
83
|
+
{
|
|
84
|
+
variants: {
|
|
85
|
+
variant: {
|
|
86
|
+
default: "bg-transparent",
|
|
87
|
+
icon: "[&_svg:not([class*='size-'])]:size-4",
|
|
88
|
+
image:
|
|
89
|
+
"size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover",
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
defaultVariants: {
|
|
93
|
+
variant: "default",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
function ItemMedia({
|
|
99
|
+
className,
|
|
100
|
+
variant = "default",
|
|
101
|
+
...props
|
|
102
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>) {
|
|
103
|
+
return (
|
|
104
|
+
<div
|
|
105
|
+
data-slot="item-media"
|
|
106
|
+
data-variant={variant}
|
|
107
|
+
className={cn(itemMediaVariants({ variant, className }))}
|
|
108
|
+
{...props}
|
|
109
|
+
/>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function ItemContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
114
|
+
return (
|
|
115
|
+
<div
|
|
116
|
+
data-slot="item-content"
|
|
117
|
+
className={cn(
|
|
118
|
+
"gap-1 group-data-[size=xs]/item:gap-0 flex flex-1 flex-col [&+[data-slot=item-content]]:flex-none",
|
|
119
|
+
className,
|
|
120
|
+
)}
|
|
121
|
+
{...props}
|
|
122
|
+
/>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function ItemTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
127
|
+
return (
|
|
128
|
+
<div
|
|
129
|
+
data-slot="item-title"
|
|
130
|
+
className={cn(
|
|
131
|
+
"gap-2 text-sm leading-snug font-medium underline-offset-4 line-clamp-1 flex w-fit items-center",
|
|
132
|
+
className,
|
|
133
|
+
)}
|
|
134
|
+
{...props}
|
|
135
|
+
/>
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function ItemDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
140
|
+
return (
|
|
141
|
+
<p
|
|
142
|
+
data-slot="item-description"
|
|
143
|
+
className={cn(
|
|
144
|
+
"text-muted-foreground text-left text-sm leading-normal group-data-[size=xs]/item:text-xs [&>a:hover]:text-primary line-clamp-2 font-normal [&>a]:underline [&>a]:underline-offset-4",
|
|
145
|
+
className,
|
|
146
|
+
)}
|
|
147
|
+
{...props}
|
|
148
|
+
/>
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function ItemActions({ className, ...props }: React.ComponentProps<"div">) {
|
|
153
|
+
return (
|
|
154
|
+
<div
|
|
155
|
+
data-slot="item-actions"
|
|
156
|
+
className={cn("gap-2 flex items-center", className)}
|
|
157
|
+
{...props}
|
|
158
|
+
/>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function ItemHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
163
|
+
return (
|
|
164
|
+
<div
|
|
165
|
+
data-slot="item-header"
|
|
166
|
+
className={cn(
|
|
167
|
+
"gap-2 flex basis-full items-center justify-between",
|
|
168
|
+
className,
|
|
169
|
+
)}
|
|
170
|
+
{...props}
|
|
171
|
+
/>
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function ItemFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
176
|
+
return (
|
|
177
|
+
<div
|
|
178
|
+
data-slot="item-footer"
|
|
179
|
+
className={cn(
|
|
180
|
+
"gap-2 flex basis-full items-center justify-between",
|
|
181
|
+
className,
|
|
182
|
+
)}
|
|
183
|
+
{...props}
|
|
184
|
+
/>
|
|
185
|
+
)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export {
|
|
189
|
+
Item,
|
|
190
|
+
ItemMedia,
|
|
191
|
+
ItemContent,
|
|
192
|
+
ItemActions,
|
|
193
|
+
ItemGroup,
|
|
194
|
+
ItemSeparator,
|
|
195
|
+
ItemTitle,
|
|
196
|
+
ItemDescription,
|
|
197
|
+
ItemHeader,
|
|
198
|
+
ItemFooter,
|
|
199
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { cn } from "../helpers/style.ts"
|
|
2
|
+
|
|
3
|
+
function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
|
|
4
|
+
return (
|
|
5
|
+
<kbd
|
|
6
|
+
data-slot="kbd"
|
|
7
|
+
className={cn(
|
|
8
|
+
"bg-muted text-muted-foreground [[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10 h-5 w-fit min-w-5 gap-1 rounded-sm px-1 font-sans text-xs font-medium [&_svg:not([class*='size-'])]:size-3 pointer-events-none inline-flex items-center justify-center select-none",
|
|
9
|
+
className,
|
|
10
|
+
)}
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function KbdGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
17
|
+
return (
|
|
18
|
+
<kbd
|
|
19
|
+
data-slot="kbd-group"
|
|
20
|
+
className={cn("gap-1 inline-flex items-center", className)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { Kbd, KbdGroup }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// biome-ignore-all lint: shadcn
|
|
2
|
+
import { cn } from "../helpers/style.ts"
|
|
3
|
+
|
|
4
|
+
function Label({ className, ...props }: React.ComponentProps<"label">) {
|
|
5
|
+
return (
|
|
6
|
+
<label
|
|
7
|
+
data-slot="label"
|
|
8
|
+
className={cn(
|
|
9
|
+
"gap-2 text-sm leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed",
|
|
10
|
+
className,
|
|
11
|
+
)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { Label }
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Menu as MenuPrimitive } from "@base-ui/react/menu"
|
|
3
|
+
import { Menubar as MenubarPrimitive } from "@base-ui/react/menubar"
|
|
4
|
+
import { CheckIcon } from "lucide-react"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../helpers/style.ts"
|
|
7
|
+
import {
|
|
8
|
+
DropdownMenu,
|
|
9
|
+
DropdownMenuContent,
|
|
10
|
+
DropdownMenuGroup,
|
|
11
|
+
DropdownMenuItem,
|
|
12
|
+
DropdownMenuLabel,
|
|
13
|
+
DropdownMenuPortal,
|
|
14
|
+
DropdownMenuRadioGroup,
|
|
15
|
+
DropdownMenuSeparator,
|
|
16
|
+
DropdownMenuShortcut,
|
|
17
|
+
DropdownMenuSub,
|
|
18
|
+
DropdownMenuSubContent,
|
|
19
|
+
DropdownMenuSubTrigger,
|
|
20
|
+
DropdownMenuTrigger,
|
|
21
|
+
} from "./dropdown-menu.tsx"
|
|
22
|
+
|
|
23
|
+
function Menubar({ className, ...props }: MenubarPrimitive.Props) {
|
|
24
|
+
return (
|
|
25
|
+
<MenubarPrimitive
|
|
26
|
+
data-slot="menubar"
|
|
27
|
+
className={cn(
|
|
28
|
+
"flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs",
|
|
29
|
+
className,
|
|
30
|
+
)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function MenubarMenu({ ...props }: React.ComponentProps<typeof DropdownMenu>) {
|
|
37
|
+
return <DropdownMenu data-slot="menubar-menu" {...props} />
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function MenubarGroup({
|
|
41
|
+
...props
|
|
42
|
+
}: React.ComponentProps<typeof DropdownMenuGroup>) {
|
|
43
|
+
return <DropdownMenuGroup data-slot="menubar-group" {...props} />
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function MenubarPortal({
|
|
47
|
+
...props
|
|
48
|
+
}: React.ComponentProps<typeof DropdownMenuPortal>) {
|
|
49
|
+
return <DropdownMenuPortal data-slot="menubar-portal" {...props} />
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function MenubarTrigger({
|
|
53
|
+
className,
|
|
54
|
+
...props
|
|
55
|
+
}: React.ComponentProps<typeof DropdownMenuTrigger>) {
|
|
56
|
+
return (
|
|
57
|
+
<DropdownMenuTrigger
|
|
58
|
+
data-slot="menubar-trigger"
|
|
59
|
+
className={cn(
|
|
60
|
+
"flex items-center rounded-sm px-2 py-1 text-sm font-medium outline-hidden select-none hover:bg-muted aria-expanded:bg-muted",
|
|
61
|
+
className,
|
|
62
|
+
)}
|
|
63
|
+
{...props}
|
|
64
|
+
/>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function MenubarContent({
|
|
69
|
+
className,
|
|
70
|
+
align = "start",
|
|
71
|
+
alignOffset = -4,
|
|
72
|
+
sideOffset = 8,
|
|
73
|
+
...props
|
|
74
|
+
}: React.ComponentProps<typeof DropdownMenuContent>) {
|
|
75
|
+
return (
|
|
76
|
+
<DropdownMenuContent
|
|
77
|
+
data-slot="menubar-content"
|
|
78
|
+
align={align}
|
|
79
|
+
alignOffset={alignOffset}
|
|
80
|
+
sideOffset={sideOffset}
|
|
81
|
+
className={cn(
|
|
82
|
+
"cn-menu-target cn-menu-translucent min-w-36 rounded-md bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 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",
|
|
83
|
+
className,
|
|
84
|
+
)}
|
|
85
|
+
{...props}
|
|
86
|
+
/>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function MenubarItem({
|
|
91
|
+
className,
|
|
92
|
+
inset,
|
|
93
|
+
variant = "default",
|
|
94
|
+
...props
|
|
95
|
+
}: React.ComponentProps<typeof DropdownMenuItem>) {
|
|
96
|
+
return (
|
|
97
|
+
<DropdownMenuItem
|
|
98
|
+
data-slot="menubar-item"
|
|
99
|
+
data-inset={inset}
|
|
100
|
+
data-variant={variant}
|
|
101
|
+
className={cn(
|
|
102
|
+
"group/menubar-item gap-2 rounded-sm px-2 py-1.5 text-sm focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive!",
|
|
103
|
+
className,
|
|
104
|
+
)}
|
|
105
|
+
{...props}
|
|
106
|
+
/>
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function MenubarCheckboxItem({
|
|
111
|
+
className,
|
|
112
|
+
children,
|
|
113
|
+
checked,
|
|
114
|
+
inset,
|
|
115
|
+
...props
|
|
116
|
+
}: MenuPrimitive.CheckboxItem.Props & {
|
|
117
|
+
inset?: boolean
|
|
118
|
+
}) {
|
|
119
|
+
return (
|
|
120
|
+
<MenuPrimitive.CheckboxItem
|
|
121
|
+
data-slot="menubar-checkbox-item"
|
|
122
|
+
data-inset={inset}
|
|
123
|
+
className={cn(
|
|
124
|
+
"relative flex cursor-default items-center gap-2 rounded-md py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
125
|
+
className,
|
|
126
|
+
)}
|
|
127
|
+
checked={checked}
|
|
128
|
+
{...props}
|
|
129
|
+
>
|
|
130
|
+
<span className="pointer-events-none absolute left-2 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
|
|
131
|
+
<MenuPrimitive.CheckboxItemIndicator>
|
|
132
|
+
<CheckIcon />
|
|
133
|
+
</MenuPrimitive.CheckboxItemIndicator>
|
|
134
|
+
</span>
|
|
135
|
+
{children}
|
|
136
|
+
</MenuPrimitive.CheckboxItem>
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function MenubarRadioGroup({
|
|
141
|
+
...props
|
|
142
|
+
}: React.ComponentProps<typeof DropdownMenuRadioGroup>) {
|
|
143
|
+
return <DropdownMenuRadioGroup data-slot="menubar-radio-group" {...props} />
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function MenubarRadioItem({
|
|
147
|
+
className,
|
|
148
|
+
children,
|
|
149
|
+
inset,
|
|
150
|
+
...props
|
|
151
|
+
}: MenuPrimitive.RadioItem.Props & {
|
|
152
|
+
inset?: boolean
|
|
153
|
+
}) {
|
|
154
|
+
return (
|
|
155
|
+
<MenuPrimitive.RadioItem
|
|
156
|
+
data-slot="menubar-radio-item"
|
|
157
|
+
data-inset={inset}
|
|
158
|
+
className={cn(
|
|
159
|
+
"relative flex cursor-default items-center gap-2 rounded-md py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
160
|
+
className,
|
|
161
|
+
)}
|
|
162
|
+
{...props}
|
|
163
|
+
>
|
|
164
|
+
<span className="pointer-events-none absolute left-2 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
|
|
165
|
+
<MenuPrimitive.RadioItemIndicator>
|
|
166
|
+
<CheckIcon />
|
|
167
|
+
</MenuPrimitive.RadioItemIndicator>
|
|
168
|
+
</span>
|
|
169
|
+
{children}
|
|
170
|
+
</MenuPrimitive.RadioItem>
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function MenubarLabel({
|
|
175
|
+
className,
|
|
176
|
+
inset,
|
|
177
|
+
...props
|
|
178
|
+
}: React.ComponentProps<typeof DropdownMenuLabel> & {
|
|
179
|
+
inset?: boolean
|
|
180
|
+
}) {
|
|
181
|
+
return (
|
|
182
|
+
<DropdownMenuLabel
|
|
183
|
+
data-slot="menubar-label"
|
|
184
|
+
data-inset={inset}
|
|
185
|
+
className={cn(
|
|
186
|
+
"px-2 py-1.5 text-sm font-medium data-inset:pl-8",
|
|
187
|
+
className,
|
|
188
|
+
)}
|
|
189
|
+
{...props}
|
|
190
|
+
/>
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function MenubarSeparator({
|
|
195
|
+
className,
|
|
196
|
+
...props
|
|
197
|
+
}: React.ComponentProps<typeof DropdownMenuSeparator>) {
|
|
198
|
+
return (
|
|
199
|
+
<DropdownMenuSeparator
|
|
200
|
+
data-slot="menubar-separator"
|
|
201
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
202
|
+
{...props}
|
|
203
|
+
/>
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function MenubarShortcut({
|
|
208
|
+
className,
|
|
209
|
+
...props
|
|
210
|
+
}: React.ComponentProps<typeof DropdownMenuShortcut>) {
|
|
211
|
+
return (
|
|
212
|
+
<DropdownMenuShortcut
|
|
213
|
+
data-slot="menubar-shortcut"
|
|
214
|
+
className={cn(
|
|
215
|
+
"ml-auto text-xs tracking-widest text-muted-foreground group-focus/menubar-item:text-accent-foreground",
|
|
216
|
+
className,
|
|
217
|
+
)}
|
|
218
|
+
{...props}
|
|
219
|
+
/>
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function MenubarSub({
|
|
224
|
+
...props
|
|
225
|
+
}: React.ComponentProps<typeof DropdownMenuSub>) {
|
|
226
|
+
return <DropdownMenuSub data-slot="menubar-sub" {...props} />
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function MenubarSubTrigger({
|
|
230
|
+
className,
|
|
231
|
+
inset,
|
|
232
|
+
...props
|
|
233
|
+
}: React.ComponentProps<typeof DropdownMenuSubTrigger> & {
|
|
234
|
+
inset?: boolean
|
|
235
|
+
}) {
|
|
236
|
+
return (
|
|
237
|
+
<DropdownMenuSubTrigger
|
|
238
|
+
data-slot="menubar-sub-trigger"
|
|
239
|
+
data-inset={inset}
|
|
240
|
+
className={cn(
|
|
241
|
+
"gap-2 rounded-sm px-2 py-1.5 text-sm focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-open:bg-accent data-open:text-accent-foreground [&_svg:not([class*='size-'])]:size-4",
|
|
242
|
+
className,
|
|
243
|
+
)}
|
|
244
|
+
{...props}
|
|
245
|
+
/>
|
|
246
|
+
)
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function MenubarSubContent({
|
|
250
|
+
className,
|
|
251
|
+
...props
|
|
252
|
+
}: React.ComponentProps<typeof DropdownMenuSubContent>) {
|
|
253
|
+
return (
|
|
254
|
+
<DropdownMenuSubContent
|
|
255
|
+
data-slot="menubar-sub-content"
|
|
256
|
+
className={cn(
|
|
257
|
+
"cn-menu-target cn-menu-translucent min-w-32 rounded-md bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 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 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",
|
|
258
|
+
className,
|
|
259
|
+
)}
|
|
260
|
+
{...props}
|
|
261
|
+
/>
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export {
|
|
266
|
+
Menubar,
|
|
267
|
+
MenubarPortal,
|
|
268
|
+
MenubarMenu,
|
|
269
|
+
MenubarTrigger,
|
|
270
|
+
MenubarContent,
|
|
271
|
+
MenubarGroup,
|
|
272
|
+
MenubarSeparator,
|
|
273
|
+
MenubarLabel,
|
|
274
|
+
MenubarItem,
|
|
275
|
+
MenubarShortcut,
|
|
276
|
+
MenubarCheckboxItem,
|
|
277
|
+
MenubarRadioGroup,
|
|
278
|
+
MenubarRadioItem,
|
|
279
|
+
MenubarSub,
|
|
280
|
+
MenubarSubTrigger,
|
|
281
|
+
MenubarSubContent,
|
|
282
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { ChevronDownIcon } from "lucide-react"
|
|
3
|
+
|
|
4
|
+
import { cn } from "../helpers/style.ts"
|
|
5
|
+
|
|
6
|
+
type NativeSelectProps = Omit<React.ComponentProps<"select">, "size"> & {
|
|
7
|
+
size?: "sm" | "default"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function NativeSelect({
|
|
11
|
+
className,
|
|
12
|
+
size = "default",
|
|
13
|
+
...props
|
|
14
|
+
}: NativeSelectProps) {
|
|
15
|
+
return (
|
|
16
|
+
<div
|
|
17
|
+
className={cn(
|
|
18
|
+
"group/native-select relative w-fit has-[select:disabled]:opacity-50",
|
|
19
|
+
className,
|
|
20
|
+
)}
|
|
21
|
+
data-slot="native-select-wrapper"
|
|
22
|
+
data-size={size}
|
|
23
|
+
>
|
|
24
|
+
<select
|
|
25
|
+
data-slot="native-select"
|
|
26
|
+
data-size={size}
|
|
27
|
+
className="h-9 w-full min-w-0 appearance-none rounded-md border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm shadow-xs transition-[color,box-shadow] outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-8 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40"
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
<ChevronDownIcon
|
|
31
|
+
className="pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none"
|
|
32
|
+
aria-hidden="true"
|
|
33
|
+
data-slot="native-select-icon"
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function NativeSelectOption({ ...props }: React.ComponentProps<"option">) {
|
|
40
|
+
return <option data-slot="native-select-option" {...props} />
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function NativeSelectOptGroup({
|
|
44
|
+
className,
|
|
45
|
+
...props
|
|
46
|
+
}: React.ComponentProps<"optgroup">) {
|
|
47
|
+
return (
|
|
48
|
+
<optgroup
|
|
49
|
+
data-slot="native-select-optgroup"
|
|
50
|
+
className={cn(className)}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { NativeSelect, NativeSelectOptGroup, NativeSelectOption }
|