@suzumiyaaoba/mdxr 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +56 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +2902 -0
- package/dist/components.d.mts +791 -0
- package/dist/components.mjs +2 -0
- package/dist/config-SI9IyFiC.mjs +184 -0
- package/dist/doc-context-CEqzMYKv.d.mts +568 -0
- package/dist/index.d.mts +20 -0
- package/dist/index.mjs +4 -0
- package/dist/ui-GKFD0mx5.mjs +15986 -0
- package/package.json +131 -0
- package/skill/SKILL.md +49 -0
- package/skill/references/components/charts.md +172 -0
- package/skill/references/components/document.md +98 -0
- package/skill/references/components/forms.md +35 -0
- package/skill/references/components/investigation.md +198 -0
- package/skill/references/components/layout.md +68 -0
- package/skill/references/components/output.md +158 -0
- package/skill/references/components/planning.md +155 -0
- package/skill/references/components/reports.md +252 -0
- package/skill/references/components/shadcn.md +19 -0
- package/skill/references/components.md +186 -0
- package/skill/references/extending.md +48 -0
- package/src/ask-sheet.ts +40 -0
- package/src/assets/css.ts +392 -0
- package/src/assets/scripts.ts +78 -0
- package/src/catalog.ts +287 -0
- package/src/cli.ts +178 -0
- package/src/client/doc-events.ts +1108 -0
- package/src/client/entry.ts +27 -0
- package/src/client-js.ts +47 -0
- package/src/component-map.ts +47 -0
- package/src/components/ui/accordion.tsx +77 -0
- package/src/components/ui/alert-dialog.tsx +185 -0
- package/src/components/ui/alert.tsx +76 -0
- package/src/components/ui/aspect-ratio.tsx +22 -0
- package/src/components/ui/attachment.tsx +208 -0
- package/src/components/ui/avatar.tsx +106 -0
- package/src/components/ui/badge.tsx +52 -0
- package/src/components/ui/breadcrumb.tsx +121 -0
- package/src/components/ui/bubble.tsx +128 -0
- package/src/components/ui/button-group.tsx +88 -0
- package/src/components/ui/button.tsx +58 -0
- package/src/components/ui/calendar.tsx +226 -0
- package/src/components/ui/card.tsx +102 -0
- package/src/components/ui/carousel.tsx +246 -0
- package/src/components/ui/chart.tsx +379 -0
- package/src/components/ui/checkbox.tsx +27 -0
- package/src/components/ui/collapsible.tsx +19 -0
- package/src/components/ui/combobox.tsx +298 -0
- package/src/components/ui/command.tsx +193 -0
- package/src/components/ui/context-menu.tsx +271 -0
- package/src/components/ui/dialog.tsx +159 -0
- package/src/components/ui/direction.tsx +4 -0
- package/src/components/ui/drawer.tsx +227 -0
- package/src/components/ui/dropdown-menu.tsx +269 -0
- package/src/components/ui/empty.tsx +104 -0
- package/src/components/ui/field.tsx +237 -0
- package/src/components/ui/fieldset.tsx +32 -0
- package/src/components/ui/frame.tsx +87 -0
- package/src/components/ui/hover-card.tsx +50 -0
- package/src/components/ui/input-group.tsx +159 -0
- package/src/components/ui/input-otp.tsx +83 -0
- package/src/components/ui/input.tsx +19 -0
- package/src/components/ui/item.tsx +202 -0
- package/src/components/ui/kbd.tsx +26 -0
- package/src/components/ui/label.tsx +19 -0
- package/src/components/ui/marker.tsx +71 -0
- package/src/components/ui/menubar.tsx +284 -0
- package/src/components/ui/message-scroller.tsx +128 -0
- package/src/components/ui/message.tsx +91 -0
- package/src/components/ui/meter.tsx +80 -0
- package/src/components/ui/native-select.tsx +64 -0
- package/src/components/ui/navigation-menu.tsx +170 -0
- package/src/components/ui/pagination.tsx +133 -0
- package/src/components/ui/popover.tsx +87 -0
- package/src/components/ui/progress.tsx +82 -0
- package/src/components/ui/questionnaire.tsx +328 -0
- package/src/components/ui/radio-group.tsx +35 -0
- package/src/components/ui/resizable.tsx +49 -0
- package/src/components/ui/scroll-area.tsx +50 -0
- package/src/components/ui/select.tsx +201 -0
- package/src/components/ui/separator.tsx +22 -0
- package/src/components/ui/sheet.tsx +135 -0
- package/src/components/ui/sidebar.tsx +730 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/slider.tsx +51 -0
- package/src/components/ui/spinner.tsx +16 -0
- package/src/components/ui/switch.tsx +31 -0
- package/src/components/ui/table.tsx +113 -0
- package/src/components/ui/tabs.tsx +82 -0
- package/src/components/ui/textarea.tsx +17 -0
- package/src/components/ui/toast.tsx +229 -0
- package/src/components/ui/toggle-group.tsx +87 -0
- package/src/components/ui/toggle.tsx +43 -0
- package/src/components/ui/tooltip.tsx +65 -0
- package/src/components.ts +78 -0
- package/src/config.ts +56 -0
- package/src/define.ts +122 -0
- package/src/doc-context.ts +20 -0
- package/src/editor.ts +94 -0
- package/src/format-error.ts +78 -0
- package/src/guards.ts +84 -0
- package/src/hooks/use-mobile.ts +21 -0
- package/src/html.ts +91 -0
- package/src/hydrate/export-index.ts +232 -0
- package/src/hydrate/import-scan.ts +169 -0
- package/src/hydrate/plugins.ts +118 -0
- package/src/hydrate/runtime-module.ts +145 -0
- package/src/hydrate-runtime.ts +67 -0
- package/src/hydrate.ts +147 -0
- package/src/index.ts +16 -0
- package/src/init.ts +57 -0
- package/src/langs.ts +148 -0
- package/src/lines.ts +53 -0
- package/src/load-user-module.ts +191 -0
- package/src/mdx.ts +248 -0
- package/src/paths.ts +36 -0
- package/src/rehype/shiki.ts +533 -0
- package/src/remark/alerts.ts +53 -0
- package/src/remark/ast.ts +96 -0
- package/src/remark/callouts.ts +25 -0
- package/src/remark/code-file.ts +85 -0
- package/src/remark/code-meta.ts +21 -0
- package/src/remark/directives.ts +170 -0
- package/src/remark/file-paths.ts +64 -0
- package/src/remark/headings.ts +131 -0
- package/src/remark/no-js.ts +40 -0
- package/src/render.ts +337 -0
- package/src/serve.ts +322 -0
- package/src/styles/globals.css +134 -0
- package/src/styles/shadcn.css +641 -0
- package/src/tailwind.ts +119 -0
- package/src/ui/approvals.tsx +76 -0
- package/src/ui/ask-question.tsx +386 -0
- package/src/ui/ask.tsx +206 -0
- package/src/ui/attrs.ts +51 -0
- package/src/ui/audit.tsx +139 -0
- package/src/ui/bar-chart.tsx +334 -0
- package/src/ui/benchmarks.tsx +143 -0
- package/src/ui/bits.tsx +537 -0
- package/src/ui/board.tsx +173 -0
- package/src/ui/bridge.tsx +207 -0
- package/src/ui/bumps.tsx +178 -0
- package/src/ui/callout.tsx +106 -0
- package/src/ui/changes.tsx +89 -0
- package/src/ui/chart-bits.tsx +52 -0
- package/src/ui/chart.ts +577 -0
- package/src/ui/checks.tsx +203 -0
- package/src/ui/child-index.tsx +44 -0
- package/src/ui/children.ts +43 -0
- package/src/ui/chips.tsx +49 -0
- package/src/ui/cmd.tsx +27 -0
- package/src/ui/columns.tsx +31 -0
- package/src/ui/comments.tsx +544 -0
- package/src/ui/compare.tsx +67 -0
- package/src/ui/decision.tsx +79 -0
- package/src/ui/deps.tsx +78 -0
- package/src/ui/details.tsx +43 -0
- package/src/ui/diff-parse.ts +307 -0
- package/src/ui/diff.tsx +458 -0
- package/src/ui/diffstat.tsx +58 -0
- package/src/ui/due.tsx +65 -0
- package/src/ui/effort.tsx +29 -0
- package/src/ui/endpoints.tsx +118 -0
- package/src/ui/envvars.tsx +96 -0
- package/src/ui/figure.tsx +37 -0
- package/src/ui/file-icon.ts +1020 -0
- package/src/ui/file-link.ts +32 -0
- package/src/ui/file-ref.tsx +39 -0
- package/src/ui/files.tsx +112 -0
- package/src/ui/findings.tsx +85 -0
- package/src/ui/flow.tsx +73 -0
- package/src/ui/funnel.tsx +121 -0
- package/src/ui/gantt.tsx +443 -0
- package/src/ui/gauges.tsx +135 -0
- package/src/ui/glossary.tsx +29 -0
- package/src/ui/graph-layout.ts +149 -0
- package/src/ui/graph-specs.tsx +102 -0
- package/src/ui/graph.tsx +278 -0
- package/src/ui/grid.tsx +119 -0
- package/src/ui/hypothesis.tsx +94 -0
- package/src/ui/icon.tsx +80 -0
- package/src/ui/incident.tsx +130 -0
- package/src/ui/index.ts +342 -0
- package/src/ui/ins-del.tsx +41 -0
- package/src/ui/json.tsx +190 -0
- package/src/ui/layout.ts +9 -0
- package/src/ui/line-chart.tsx +251 -0
- package/src/ui/matrix.tsx +208 -0
- package/src/ui/meta.tsx +73 -0
- package/src/ui/option.tsx +64 -0
- package/src/ui/owner.tsx +40 -0
- package/src/ui/packages.tsx +104 -0
- package/src/ui/pathway.tsx +96 -0
- package/src/ui/phase.tsx +41 -0
- package/src/ui/pie-chart.tsx +170 -0
- package/src/ui/plan.tsx +77 -0
- package/src/ui/pre.tsx +175 -0
- package/src/ui/priority.tsx +51 -0
- package/src/ui/props.tsx +77 -0
- package/src/ui/quadrant.tsx +172 -0
- package/src/ui/radar.tsx +200 -0
- package/src/ui/ref.tsx +160 -0
- package/src/ui/release.tsx +178 -0
- package/src/ui/req.tsx +42 -0
- package/src/ui/review.tsx +133 -0
- package/src/ui/risk.tsx +67 -0
- package/src/ui/sankey.tsx +287 -0
- package/src/ui/scatter.tsx +237 -0
- package/src/ui/schema.tsx +113 -0
- package/src/ui/score.tsx +105 -0
- package/src/ui/search.tsx +120 -0
- package/src/ui/series.tsx +38 -0
- package/src/ui/severity.tsx +69 -0
- package/src/ui/shadcn.tsx +216 -0
- package/src/ui/spark.tsx +86 -0
- package/src/ui/stack.tsx +57 -0
- package/src/ui/stats.tsx +63 -0
- package/src/ui/status-badge.tsx +66 -0
- package/src/ui/statuspage.tsx +238 -0
- package/src/ui/steps.tsx +74 -0
- package/src/ui/summary.tsx +41 -0
- package/src/ui/symbol-ref.tsx +73 -0
- package/src/ui/terminal.tsx +117 -0
- package/src/ui/tests.tsx +218 -0
- package/src/ui/timeline.tsx +63 -0
- package/src/ui/toc.tsx +56 -0
- package/src/ui/tones.ts +187 -0
- package/src/ui/trace.tsx +69 -0
- package/src/ui/tree.tsx +281 -0
- package/src/ui/treemap.tsx +128 -0
- package/src/ui/venn.tsx +258 -0
- package/src/ui/verdict.tsx +78 -0
- package/src/ui/waterfall.tsx +142 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { Combobox as ComboboxPrimitive } from "@base-ui/react";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import { ChevronDownIcon, XIcon, CheckIcon } from "lucide-react";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
|
|
6
|
+
import { Button } from "./button.js";
|
|
7
|
+
import {
|
|
8
|
+
InputGroup,
|
|
9
|
+
InputGroupAddon,
|
|
10
|
+
InputGroupButton,
|
|
11
|
+
InputGroupInput,
|
|
12
|
+
} from "./input-group.js";
|
|
13
|
+
|
|
14
|
+
const Combobox = ComboboxPrimitive.Root;
|
|
15
|
+
|
|
16
|
+
function ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) {
|
|
17
|
+
return <ComboboxPrimitive.Value data-slot="combobox-value" {...props} />;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function ComboboxTrigger({
|
|
21
|
+
className,
|
|
22
|
+
children,
|
|
23
|
+
...props
|
|
24
|
+
}: ComboboxPrimitive.Trigger.Props) {
|
|
25
|
+
return (
|
|
26
|
+
<ComboboxPrimitive.Trigger
|
|
27
|
+
data-slot="combobox-trigger"
|
|
28
|
+
className={cn("[&_svg:not([class*='size-'])]:size-4", className)}
|
|
29
|
+
{...props}
|
|
30
|
+
>
|
|
31
|
+
{children}
|
|
32
|
+
<ChevronDownIcon className="text-muted-foreground pointer-events-none size-4" />
|
|
33
|
+
</ComboboxPrimitive.Trigger>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) {
|
|
38
|
+
return (
|
|
39
|
+
<ComboboxPrimitive.Clear
|
|
40
|
+
data-slot="combobox-clear"
|
|
41
|
+
render={<InputGroupButton variant="ghost" size="icon-xs" />}
|
|
42
|
+
className={cn(className)}
|
|
43
|
+
{...props}
|
|
44
|
+
>
|
|
45
|
+
<XIcon className="pointer-events-none" />
|
|
46
|
+
</ComboboxPrimitive.Clear>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function ComboboxInput({
|
|
51
|
+
className,
|
|
52
|
+
children,
|
|
53
|
+
disabled = false,
|
|
54
|
+
showTrigger = true,
|
|
55
|
+
showClear = false,
|
|
56
|
+
...props
|
|
57
|
+
}: ComboboxPrimitive.Input.Props & {
|
|
58
|
+
showTrigger?: boolean;
|
|
59
|
+
showClear?: boolean;
|
|
60
|
+
}) {
|
|
61
|
+
return (
|
|
62
|
+
<InputGroup className={cn("w-auto", className)}>
|
|
63
|
+
<ComboboxPrimitive.Input
|
|
64
|
+
render={<InputGroupInput disabled={disabled} />}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
<InputGroupAddon align="inline-end">
|
|
68
|
+
{showTrigger && (
|
|
69
|
+
<InputGroupButton
|
|
70
|
+
size="icon-xs"
|
|
71
|
+
variant="ghost"
|
|
72
|
+
render={<ComboboxTrigger />}
|
|
73
|
+
data-slot="input-group-button"
|
|
74
|
+
className="group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent"
|
|
75
|
+
disabled={disabled}
|
|
76
|
+
/>
|
|
77
|
+
)}
|
|
78
|
+
{showClear && <ComboboxClear disabled={disabled} />}
|
|
79
|
+
</InputGroupAddon>
|
|
80
|
+
{children}
|
|
81
|
+
</InputGroup>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function ComboboxContent({
|
|
86
|
+
className,
|
|
87
|
+
side = "bottom",
|
|
88
|
+
sideOffset = 6,
|
|
89
|
+
align = "start",
|
|
90
|
+
alignOffset = 0,
|
|
91
|
+
anchor,
|
|
92
|
+
...props
|
|
93
|
+
}: ComboboxPrimitive.Popup.Props &
|
|
94
|
+
Pick<
|
|
95
|
+
ComboboxPrimitive.Positioner.Props,
|
|
96
|
+
"side" | "align" | "sideOffset" | "alignOffset" | "anchor"
|
|
97
|
+
>) {
|
|
98
|
+
return (
|
|
99
|
+
<ComboboxPrimitive.Portal>
|
|
100
|
+
<ComboboxPrimitive.Positioner
|
|
101
|
+
side={side}
|
|
102
|
+
sideOffset={sideOffset}
|
|
103
|
+
align={align}
|
|
104
|
+
alignOffset={alignOffset}
|
|
105
|
+
anchor={anchor}
|
|
106
|
+
className="isolate z-50"
|
|
107
|
+
>
|
|
108
|
+
<ComboboxPrimitive.Popup
|
|
109
|
+
data-slot="combobox-content"
|
|
110
|
+
data-chips={!!anchor}
|
|
111
|
+
className={cn(
|
|
112
|
+
"group/combobox-content bg-popover text-popover-foreground ring-foreground/10 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-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 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 relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg shadow-md ring-1 duration-100 data-[chips=true]:min-w-(--anchor-width) *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:shadow-none",
|
|
113
|
+
className
|
|
114
|
+
)}
|
|
115
|
+
{...props}
|
|
116
|
+
/>
|
|
117
|
+
</ComboboxPrimitive.Positioner>
|
|
118
|
+
</ComboboxPrimitive.Portal>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {
|
|
123
|
+
return (
|
|
124
|
+
<ComboboxPrimitive.List
|
|
125
|
+
data-slot="combobox-list"
|
|
126
|
+
className={cn(
|
|
127
|
+
"no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0",
|
|
128
|
+
className
|
|
129
|
+
)}
|
|
130
|
+
{...props}
|
|
131
|
+
/>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function ComboboxItem({
|
|
136
|
+
className,
|
|
137
|
+
children,
|
|
138
|
+
...props
|
|
139
|
+
}: ComboboxPrimitive.Item.Props) {
|
|
140
|
+
return (
|
|
141
|
+
<ComboboxPrimitive.Item
|
|
142
|
+
data-slot="combobox-item"
|
|
143
|
+
className={cn(
|
|
144
|
+
"data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
145
|
+
className
|
|
146
|
+
)}
|
|
147
|
+
{...props}
|
|
148
|
+
>
|
|
149
|
+
{children}
|
|
150
|
+
<ComboboxPrimitive.ItemIndicator
|
|
151
|
+
render={
|
|
152
|
+
<span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center" />
|
|
153
|
+
}
|
|
154
|
+
>
|
|
155
|
+
<CheckIcon className="pointer-events-none" />
|
|
156
|
+
</ComboboxPrimitive.ItemIndicator>
|
|
157
|
+
</ComboboxPrimitive.Item>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) {
|
|
162
|
+
return (
|
|
163
|
+
<ComboboxPrimitive.Group
|
|
164
|
+
data-slot="combobox-group"
|
|
165
|
+
className={cn(className)}
|
|
166
|
+
{...props}
|
|
167
|
+
/>
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function ComboboxLabel({
|
|
172
|
+
className,
|
|
173
|
+
...props
|
|
174
|
+
}: ComboboxPrimitive.GroupLabel.Props) {
|
|
175
|
+
return (
|
|
176
|
+
<ComboboxPrimitive.GroupLabel
|
|
177
|
+
data-slot="combobox-label"
|
|
178
|
+
className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
|
|
179
|
+
{...props}
|
|
180
|
+
/>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) {
|
|
185
|
+
return (
|
|
186
|
+
<ComboboxPrimitive.Collection data-slot="combobox-collection" {...props} />
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {
|
|
191
|
+
return (
|
|
192
|
+
<ComboboxPrimitive.Empty
|
|
193
|
+
data-slot="combobox-empty"
|
|
194
|
+
className={cn(
|
|
195
|
+
"text-muted-foreground hidden w-full justify-center py-2 text-center text-sm group-data-empty/combobox-content:flex",
|
|
196
|
+
className
|
|
197
|
+
)}
|
|
198
|
+
{...props}
|
|
199
|
+
/>
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function ComboboxSeparator({
|
|
204
|
+
className,
|
|
205
|
+
...props
|
|
206
|
+
}: ComboboxPrimitive.Separator.Props) {
|
|
207
|
+
return (
|
|
208
|
+
<ComboboxPrimitive.Separator
|
|
209
|
+
data-slot="combobox-separator"
|
|
210
|
+
className={cn("bg-border -mx-1 my-1 h-px", className)}
|
|
211
|
+
{...props}
|
|
212
|
+
/>
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function ComboboxChips({
|
|
217
|
+
className,
|
|
218
|
+
...props
|
|
219
|
+
}: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> &
|
|
220
|
+
ComboboxPrimitive.Chips.Props) {
|
|
221
|
+
return (
|
|
222
|
+
<ComboboxPrimitive.Chips
|
|
223
|
+
data-slot="combobox-chips"
|
|
224
|
+
className={cn(
|
|
225
|
+
"border-input focus-within:border-ring focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-destructive/20 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40 flex min-h-8 flex-wrap items-center gap-1 rounded-lg border bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:ring-3 has-aria-invalid:ring-3 has-data-[slot=combobox-chip]:px-1",
|
|
226
|
+
className
|
|
227
|
+
)}
|
|
228
|
+
{...props}
|
|
229
|
+
/>
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function ComboboxChip({
|
|
234
|
+
className,
|
|
235
|
+
children,
|
|
236
|
+
showRemove = true,
|
|
237
|
+
...props
|
|
238
|
+
}: ComboboxPrimitive.Chip.Props & {
|
|
239
|
+
showRemove?: boolean;
|
|
240
|
+
}) {
|
|
241
|
+
return (
|
|
242
|
+
<ComboboxPrimitive.Chip
|
|
243
|
+
data-slot="combobox-chip"
|
|
244
|
+
className={cn(
|
|
245
|
+
"bg-muted text-foreground flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm px-1.5 text-xs font-medium whitespace-nowrap has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0",
|
|
246
|
+
className
|
|
247
|
+
)}
|
|
248
|
+
{...props}
|
|
249
|
+
>
|
|
250
|
+
{children}
|
|
251
|
+
{showRemove && (
|
|
252
|
+
<ComboboxPrimitive.ChipRemove
|
|
253
|
+
render={<Button variant="ghost" size="icon-xs" />}
|
|
254
|
+
className="-ml-1 opacity-50 hover:opacity-100"
|
|
255
|
+
data-slot="combobox-chip-remove"
|
|
256
|
+
>
|
|
257
|
+
<XIcon className="pointer-events-none" />
|
|
258
|
+
</ComboboxPrimitive.ChipRemove>
|
|
259
|
+
)}
|
|
260
|
+
</ComboboxPrimitive.Chip>
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function ComboboxChipsInput({
|
|
265
|
+
className,
|
|
266
|
+
...props
|
|
267
|
+
}: ComboboxPrimitive.Input.Props) {
|
|
268
|
+
return (
|
|
269
|
+
<ComboboxPrimitive.Input
|
|
270
|
+
data-slot="combobox-chip-input"
|
|
271
|
+
className={cn("min-w-16 flex-1 outline-none", className)}
|
|
272
|
+
{...props}
|
|
273
|
+
/>
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function useComboboxAnchor() {
|
|
278
|
+
return React.useRef<HTMLDivElement | null>(null);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export {
|
|
282
|
+
Combobox,
|
|
283
|
+
ComboboxInput,
|
|
284
|
+
ComboboxContent,
|
|
285
|
+
ComboboxList,
|
|
286
|
+
ComboboxItem,
|
|
287
|
+
ComboboxGroup,
|
|
288
|
+
ComboboxLabel,
|
|
289
|
+
ComboboxCollection,
|
|
290
|
+
ComboboxEmpty,
|
|
291
|
+
ComboboxSeparator,
|
|
292
|
+
ComboboxChips,
|
|
293
|
+
ComboboxChip,
|
|
294
|
+
ComboboxChipsInput,
|
|
295
|
+
ComboboxTrigger,
|
|
296
|
+
ComboboxValue,
|
|
297
|
+
useComboboxAnchor,
|
|
298
|
+
};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
4
|
+
import { cn } from "cn";
|
|
5
|
+
import { SearchIcon, CheckIcon } from "lucide-react";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
Dialog,
|
|
10
|
+
DialogContent,
|
|
11
|
+
DialogDescription,
|
|
12
|
+
DialogHeader,
|
|
13
|
+
DialogTitle,
|
|
14
|
+
} from "./dialog.js";
|
|
15
|
+
import { InputGroup, InputGroupAddon } from "./input-group.js";
|
|
16
|
+
|
|
17
|
+
function Command({
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
}: React.ComponentProps<typeof CommandPrimitive>) {
|
|
21
|
+
return (
|
|
22
|
+
<CommandPrimitive
|
|
23
|
+
data-slot="command"
|
|
24
|
+
className={cn(
|
|
25
|
+
"bg-popover text-popover-foreground flex size-full flex-col overflow-hidden rounded-xl! p-1",
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function CommandDialog({
|
|
34
|
+
title = "Command Palette",
|
|
35
|
+
description = "Search for a command to run...",
|
|
36
|
+
children,
|
|
37
|
+
className,
|
|
38
|
+
showCloseButton = false,
|
|
39
|
+
...props
|
|
40
|
+
}: Omit<React.ComponentProps<typeof Dialog>, "children"> & {
|
|
41
|
+
title?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
className?: string;
|
|
44
|
+
showCloseButton?: boolean;
|
|
45
|
+
children: React.ReactNode;
|
|
46
|
+
}) {
|
|
47
|
+
return (
|
|
48
|
+
<Dialog {...props}>
|
|
49
|
+
<DialogHeader className="sr-only">
|
|
50
|
+
<DialogTitle>{title}</DialogTitle>
|
|
51
|
+
<DialogDescription>{description}</DialogDescription>
|
|
52
|
+
</DialogHeader>
|
|
53
|
+
<DialogContent
|
|
54
|
+
className={cn(
|
|
55
|
+
"top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0",
|
|
56
|
+
className
|
|
57
|
+
)}
|
|
58
|
+
showCloseButton={showCloseButton}
|
|
59
|
+
>
|
|
60
|
+
{children}
|
|
61
|
+
</DialogContent>
|
|
62
|
+
</Dialog>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function CommandInput({
|
|
67
|
+
className,
|
|
68
|
+
...props
|
|
69
|
+
}: React.ComponentProps<typeof CommandPrimitive.Input>) {
|
|
70
|
+
return (
|
|
71
|
+
<div data-slot="command-input-wrapper" className="p-1 pb-0">
|
|
72
|
+
<InputGroup className="border-input/30 bg-input/30 h-8! rounded-lg! shadow-none! *:data-[slot=input-group-addon]:pl-2!">
|
|
73
|
+
<CommandPrimitive.Input
|
|
74
|
+
data-slot="command-input"
|
|
75
|
+
className={cn(
|
|
76
|
+
"w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
|
|
77
|
+
className
|
|
78
|
+
)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
<InputGroupAddon>
|
|
82
|
+
<SearchIcon className="size-4 shrink-0 opacity-50" />
|
|
83
|
+
</InputGroupAddon>
|
|
84
|
+
</InputGroup>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function CommandList({
|
|
90
|
+
className,
|
|
91
|
+
...props
|
|
92
|
+
}: React.ComponentProps<typeof CommandPrimitive.List>) {
|
|
93
|
+
return (
|
|
94
|
+
<CommandPrimitive.List
|
|
95
|
+
data-slot="command-list"
|
|
96
|
+
className={cn(
|
|
97
|
+
"no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",
|
|
98
|
+
className
|
|
99
|
+
)}
|
|
100
|
+
{...props}
|
|
101
|
+
/>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function CommandEmpty({
|
|
106
|
+
className,
|
|
107
|
+
...props
|
|
108
|
+
}: React.ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
109
|
+
return (
|
|
110
|
+
<CommandPrimitive.Empty
|
|
111
|
+
data-slot="command-empty"
|
|
112
|
+
className={cn("py-6 text-center text-sm", className)}
|
|
113
|
+
{...props}
|
|
114
|
+
/>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function CommandGroup({
|
|
119
|
+
className,
|
|
120
|
+
...props
|
|
121
|
+
}: React.ComponentProps<typeof CommandPrimitive.Group>) {
|
|
122
|
+
return (
|
|
123
|
+
<CommandPrimitive.Group
|
|
124
|
+
data-slot="command-group"
|
|
125
|
+
className={cn(
|
|
126
|
+
"text-foreground **:[[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium",
|
|
127
|
+
className
|
|
128
|
+
)}
|
|
129
|
+
{...props}
|
|
130
|
+
/>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function CommandSeparator({
|
|
135
|
+
className,
|
|
136
|
+
...props
|
|
137
|
+
}: React.ComponentProps<typeof CommandPrimitive.Separator>) {
|
|
138
|
+
return (
|
|
139
|
+
<CommandPrimitive.Separator
|
|
140
|
+
data-slot="command-separator"
|
|
141
|
+
className={cn("bg-border -mx-1 h-px", className)}
|
|
142
|
+
{...props}
|
|
143
|
+
/>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function CommandItem({
|
|
148
|
+
className,
|
|
149
|
+
children,
|
|
150
|
+
...props
|
|
151
|
+
}: React.ComponentProps<typeof CommandPrimitive.Item>) {
|
|
152
|
+
return (
|
|
153
|
+
<CommandPrimitive.Item
|
|
154
|
+
data-slot="command-item"
|
|
155
|
+
className={cn(
|
|
156
|
+
"group/command-item data-selected:bg-muted data-selected:text-foreground data-selected:*:[svg]:text-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
157
|
+
className
|
|
158
|
+
)}
|
|
159
|
+
{...props}
|
|
160
|
+
>
|
|
161
|
+
{children}
|
|
162
|
+
<CheckIcon className="ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" />
|
|
163
|
+
</CommandPrimitive.Item>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function CommandShortcut({
|
|
168
|
+
className,
|
|
169
|
+
...props
|
|
170
|
+
}: React.ComponentProps<"span">) {
|
|
171
|
+
return (
|
|
172
|
+
<span
|
|
173
|
+
data-slot="command-shortcut"
|
|
174
|
+
className={cn(
|
|
175
|
+
"text-muted-foreground group-data-selected/command-item:text-foreground ml-auto text-xs tracking-widest",
|
|
176
|
+
className
|
|
177
|
+
)}
|
|
178
|
+
{...props}
|
|
179
|
+
/>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export {
|
|
184
|
+
Command,
|
|
185
|
+
CommandDialog,
|
|
186
|
+
CommandInput,
|
|
187
|
+
CommandList,
|
|
188
|
+
CommandEmpty,
|
|
189
|
+
CommandGroup,
|
|
190
|
+
CommandItem,
|
|
191
|
+
CommandShortcut,
|
|
192
|
+
CommandSeparator,
|
|
193
|
+
};
|