@blips/ui 0.0.1 → 1.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/dist/index.cjs +1347 -146
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +185 -6
- package/dist/index.d.ts +185 -6
- package/dist/index.js +1295 -148
- package/dist/index.js.map +1 -1
- package/package.json +25 -13
- package/src/components/accordion.tsx +12 -12
- package/src/components/alert-dialog.tsx +25 -24
- package/src/components/alert.tsx +11 -11
- package/src/components/aspect-ratio.tsx +3 -3
- package/src/components/avatar.tsx +11 -11
- package/src/components/badge.tsx +6 -6
- package/src/components/breadcrumb.tsx +23 -23
- package/src/components/button-group.tsx +83 -0
- package/src/components/button.tsx +11 -11
- package/src/components/calendar.tsx +21 -24
- package/src/components/card.tsx +15 -22
- package/src/components/carousel.tsx +72 -71
- package/src/components/chart.tsx +368 -0
- package/src/components/checkbox.tsx +7 -7
- package/src/components/collapsible.tsx +6 -6
- package/src/components/command.tsx +27 -26
- package/src/components/context-menu.tsx +33 -33
- package/src/components/dialog.tsx +22 -22
- package/src/components/drawer.tsx +21 -21
- package/src/components/dropdown-menu.tsx +34 -34
- package/src/components/form.tsx +178 -0
- package/src/components/hover-card.tsx +8 -8
- package/src/components/input-group.tsx +175 -0
- package/src/components/input-otp.tsx +16 -16
- package/src/components/input.tsx +6 -6
- package/src/components/kbd.tsx +28 -0
- package/src/components/label.tsx +9 -9
- package/src/components/menubar.tsx +36 -36
- package/src/components/navigation-menu.tsx +21 -21
- package/src/components/pagination.tsx +22 -21
- package/src/components/popover.tsx +8 -8
- package/src/components/progress.tsx +7 -7
- package/src/components/radio-group.tsx +11 -11
- package/src/components/resizable.tsx +14 -14
- package/src/components/scroll-area.tsx +8 -8
- package/src/components/select.tsx +23 -23
- package/src/components/separator.tsx +6 -6
- package/src/components/sheet.tsx +24 -24
- package/src/components/sidebar.tsx +774 -0
- package/src/components/skeleton.tsx +3 -3
- package/src/components/slider.tsx +6 -6
- package/src/components/sonner.tsx +9 -9
- package/src/components/spinner.tsx +16 -0
- package/src/components/switch.tsx +6 -6
- package/src/components/table.tsx +19 -19
- package/src/components/tabs.tsx +11 -11
- package/src/components/textarea.tsx +6 -6
- package/src/components/toggle-group.tsx +15 -14
- package/src/components/toggle.tsx +8 -8
- package/src/components/tooltip.tsx +10 -10
- package/src/globals.css +45 -0
- package/src/hooks/use-mobile.tsx +19 -0
- package/src/index.ts +78 -0
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as RechartsPrimitive from "recharts"
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
|
|
6
|
+
// Format: { THEME_NAME: CSS_SELECTOR }
|
|
7
|
+
const THEMES = { light: "", dark: ".dark" } as const
|
|
8
|
+
|
|
9
|
+
export type ChartConfig = {
|
|
10
|
+
[k in string]: {
|
|
11
|
+
label?: React.ReactNode
|
|
12
|
+
icon?: React.ComponentType
|
|
13
|
+
} & (
|
|
14
|
+
| { color?: string; theme?: never }
|
|
15
|
+
| { color?: never; theme: Record<keyof typeof THEMES, string> }
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type ChartContextProps = {
|
|
20
|
+
config: ChartConfig
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const ChartContext = React.createContext<ChartContextProps | null>(null)
|
|
24
|
+
|
|
25
|
+
function useChart() {
|
|
26
|
+
const context = React.useContext(ChartContext)
|
|
27
|
+
|
|
28
|
+
if (!context) {
|
|
29
|
+
throw new Error("useChart must be used within a <ChartContainer />")
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return context
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const ChartContainer = React.forwardRef<
|
|
36
|
+
HTMLDivElement,
|
|
37
|
+
React.ComponentProps<"div"> & {
|
|
38
|
+
config: ChartConfig
|
|
39
|
+
children: React.ComponentProps<
|
|
40
|
+
typeof RechartsPrimitive.ResponsiveContainer
|
|
41
|
+
>["children"]
|
|
42
|
+
}
|
|
43
|
+
>(({ id, className, children, config, ...props }, ref) => {
|
|
44
|
+
const uniqueId = React.useId()
|
|
45
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<ChartContext.Provider value={{ config }}>
|
|
49
|
+
<div
|
|
50
|
+
data-chart={chartId}
|
|
51
|
+
ref={ref}
|
|
52
|
+
className={cn(
|
|
53
|
+
"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
|
|
54
|
+
className
|
|
55
|
+
)}
|
|
56
|
+
{...props}
|
|
57
|
+
>
|
|
58
|
+
<ChartStyle id={chartId} config={config} />
|
|
59
|
+
<RechartsPrimitive.ResponsiveContainer>
|
|
60
|
+
{children}
|
|
61
|
+
</RechartsPrimitive.ResponsiveContainer>
|
|
62
|
+
</div>
|
|
63
|
+
</ChartContext.Provider>
|
|
64
|
+
)
|
|
65
|
+
})
|
|
66
|
+
ChartContainer.displayName = "Chart"
|
|
67
|
+
|
|
68
|
+
const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
|
|
69
|
+
const colorConfig = Object.entries(config).filter(
|
|
70
|
+
([, config]) => config.theme || config.color
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
if (!colorConfig.length) {
|
|
74
|
+
return null
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<style
|
|
79
|
+
// biome-ignore lint/security/noDangerouslySetInnerHtml: Required for dynamic CSS variables injection in charts
|
|
80
|
+
dangerouslySetInnerHTML={{
|
|
81
|
+
__html: Object.entries(THEMES)
|
|
82
|
+
.map(
|
|
83
|
+
([theme, prefix]) => `
|
|
84
|
+
${prefix} [data-chart=${id}] {
|
|
85
|
+
${colorConfig
|
|
86
|
+
.map(([key, itemConfig]) => {
|
|
87
|
+
const color =
|
|
88
|
+
itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
|
|
89
|
+
itemConfig.color
|
|
90
|
+
return color ? ` --color-${key}: ${color};` : null
|
|
91
|
+
})
|
|
92
|
+
.join("\n")}
|
|
93
|
+
}
|
|
94
|
+
`
|
|
95
|
+
)
|
|
96
|
+
.join("\n"),
|
|
97
|
+
}}
|
|
98
|
+
/>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const ChartTooltip = RechartsPrimitive.Tooltip
|
|
103
|
+
|
|
104
|
+
const ChartTooltipContent = React.forwardRef<
|
|
105
|
+
HTMLDivElement,
|
|
106
|
+
React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
|
|
107
|
+
React.ComponentProps<"div"> & {
|
|
108
|
+
hideLabel?: boolean
|
|
109
|
+
hideIndicator?: boolean
|
|
110
|
+
indicator?: "line" | "dot" | "dashed"
|
|
111
|
+
nameKey?: string
|
|
112
|
+
labelKey?: string
|
|
113
|
+
}
|
|
114
|
+
>(
|
|
115
|
+
(
|
|
116
|
+
{
|
|
117
|
+
active,
|
|
118
|
+
payload,
|
|
119
|
+
className,
|
|
120
|
+
indicator = "dot",
|
|
121
|
+
hideLabel = false,
|
|
122
|
+
hideIndicator = false,
|
|
123
|
+
label,
|
|
124
|
+
labelFormatter,
|
|
125
|
+
labelClassName,
|
|
126
|
+
formatter,
|
|
127
|
+
color,
|
|
128
|
+
nameKey,
|
|
129
|
+
labelKey,
|
|
130
|
+
},
|
|
131
|
+
ref
|
|
132
|
+
) => {
|
|
133
|
+
const { config } = useChart()
|
|
134
|
+
|
|
135
|
+
const tooltipLabel = React.useMemo(() => {
|
|
136
|
+
if (hideLabel || !payload?.length) {
|
|
137
|
+
return null
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const [item] = payload
|
|
141
|
+
const key = `${labelKey || item?.dataKey || item?.name || "value"}`
|
|
142
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
|
143
|
+
const value =
|
|
144
|
+
!labelKey && typeof label === "string"
|
|
145
|
+
? config[label as keyof typeof config]?.label || label
|
|
146
|
+
: itemConfig?.label
|
|
147
|
+
|
|
148
|
+
if (labelFormatter) {
|
|
149
|
+
return (
|
|
150
|
+
<div className={cn("font-medium", labelClassName)}>
|
|
151
|
+
{labelFormatter(value, payload)}
|
|
152
|
+
</div>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (!value) {
|
|
157
|
+
return null
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return <div className={cn("font-medium", labelClassName)}>{value}</div>
|
|
161
|
+
}, [
|
|
162
|
+
label,
|
|
163
|
+
labelFormatter,
|
|
164
|
+
payload,
|
|
165
|
+
hideLabel,
|
|
166
|
+
labelClassName,
|
|
167
|
+
config,
|
|
168
|
+
labelKey,
|
|
169
|
+
])
|
|
170
|
+
|
|
171
|
+
if (!active || !payload?.length) {
|
|
172
|
+
return null
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const nestLabel = payload.length === 1 && indicator !== "dot"
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
<div
|
|
179
|
+
ref={ref}
|
|
180
|
+
className={cn(
|
|
181
|
+
"grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
|
|
182
|
+
className
|
|
183
|
+
)}
|
|
184
|
+
>
|
|
185
|
+
{!nestLabel ? tooltipLabel : null}
|
|
186
|
+
<div className="grid gap-1.5">
|
|
187
|
+
{payload
|
|
188
|
+
.filter((item) => item.type !== "none")
|
|
189
|
+
.map((item, index) => {
|
|
190
|
+
const key = `${nameKey || item.name || item.dataKey || "value"}`
|
|
191
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
|
192
|
+
const indicatorColor = color || item.payload.fill || item.color
|
|
193
|
+
|
|
194
|
+
return (
|
|
195
|
+
<div
|
|
196
|
+
key={item.dataKey}
|
|
197
|
+
className={cn(
|
|
198
|
+
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
|
|
199
|
+
indicator === "dot" && "items-center"
|
|
200
|
+
)}
|
|
201
|
+
>
|
|
202
|
+
{formatter && item?.value !== undefined && item.name ? (
|
|
203
|
+
formatter(item.value, item.name, item, index, item.payload)
|
|
204
|
+
) : (
|
|
205
|
+
<>
|
|
206
|
+
{itemConfig?.icon ? (
|
|
207
|
+
<itemConfig.icon />
|
|
208
|
+
) : (
|
|
209
|
+
!hideIndicator && (
|
|
210
|
+
<div
|
|
211
|
+
className={cn(
|
|
212
|
+
"shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",
|
|
213
|
+
{
|
|
214
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
215
|
+
"w-1": indicator === "line",
|
|
216
|
+
"w-0 border-[1.5px] border-dashed bg-transparent":
|
|
217
|
+
indicator === "dashed",
|
|
218
|
+
"my-0.5": nestLabel && indicator === "dashed",
|
|
219
|
+
}
|
|
220
|
+
)}
|
|
221
|
+
style={
|
|
222
|
+
{
|
|
223
|
+
"--color-bg": indicatorColor,
|
|
224
|
+
"--color-border": indicatorColor,
|
|
225
|
+
} as React.CSSProperties
|
|
226
|
+
}
|
|
227
|
+
/>
|
|
228
|
+
)
|
|
229
|
+
)}
|
|
230
|
+
<div
|
|
231
|
+
className={cn(
|
|
232
|
+
"flex flex-1 justify-between leading-none",
|
|
233
|
+
nestLabel ? "items-end" : "items-center"
|
|
234
|
+
)}
|
|
235
|
+
>
|
|
236
|
+
<div className="grid gap-1.5">
|
|
237
|
+
{nestLabel ? tooltipLabel : null}
|
|
238
|
+
<span className="text-muted-foreground">
|
|
239
|
+
{itemConfig?.label || item.name}
|
|
240
|
+
</span>
|
|
241
|
+
</div>
|
|
242
|
+
{item.value && (
|
|
243
|
+
<span className="font-mono font-medium tabular-nums text-foreground">
|
|
244
|
+
{item.value.toLocaleString()}
|
|
245
|
+
</span>
|
|
246
|
+
)}
|
|
247
|
+
</div>
|
|
248
|
+
</>
|
|
249
|
+
)}
|
|
250
|
+
</div>
|
|
251
|
+
)
|
|
252
|
+
})}
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
ChartTooltipContent.displayName = "ChartTooltip"
|
|
259
|
+
|
|
260
|
+
const ChartLegend = RechartsPrimitive.Legend
|
|
261
|
+
|
|
262
|
+
const ChartLegendContent = React.forwardRef<
|
|
263
|
+
HTMLDivElement,
|
|
264
|
+
React.ComponentProps<"div"> &
|
|
265
|
+
Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
|
266
|
+
hideIcon?: boolean
|
|
267
|
+
nameKey?: string
|
|
268
|
+
}
|
|
269
|
+
>(
|
|
270
|
+
(
|
|
271
|
+
{ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey },
|
|
272
|
+
ref
|
|
273
|
+
) => {
|
|
274
|
+
const { config } = useChart()
|
|
275
|
+
|
|
276
|
+
if (!payload?.length) {
|
|
277
|
+
return null
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return (
|
|
281
|
+
<div
|
|
282
|
+
ref={ref}
|
|
283
|
+
className={cn(
|
|
284
|
+
"flex items-center justify-center gap-4",
|
|
285
|
+
verticalAlign === "top" ? "pb-3" : "pt-3",
|
|
286
|
+
className
|
|
287
|
+
)}
|
|
288
|
+
>
|
|
289
|
+
{payload
|
|
290
|
+
.filter((item) => item.type !== "none")
|
|
291
|
+
.map((item) => {
|
|
292
|
+
const key = `${nameKey || item.dataKey || "value"}`
|
|
293
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
|
294
|
+
|
|
295
|
+
return (
|
|
296
|
+
<div
|
|
297
|
+
key={item.value}
|
|
298
|
+
className={cn(
|
|
299
|
+
"flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
|
|
300
|
+
)}
|
|
301
|
+
>
|
|
302
|
+
{itemConfig?.icon && !hideIcon ? (
|
|
303
|
+
<itemConfig.icon />
|
|
304
|
+
) : (
|
|
305
|
+
<div
|
|
306
|
+
className="h-2 w-2 shrink-0 rounded-[2px]"
|
|
307
|
+
style={{
|
|
308
|
+
backgroundColor: item.color,
|
|
309
|
+
}}
|
|
310
|
+
/>
|
|
311
|
+
)}
|
|
312
|
+
{itemConfig?.label}
|
|
313
|
+
</div>
|
|
314
|
+
)
|
|
315
|
+
})}
|
|
316
|
+
</div>
|
|
317
|
+
)
|
|
318
|
+
}
|
|
319
|
+
)
|
|
320
|
+
ChartLegendContent.displayName = "ChartLegend"
|
|
321
|
+
|
|
322
|
+
// Helper to extract item config from a payload.
|
|
323
|
+
function getPayloadConfigFromPayload(
|
|
324
|
+
config: ChartConfig,
|
|
325
|
+
payload: unknown,
|
|
326
|
+
key: string
|
|
327
|
+
) {
|
|
328
|
+
if (typeof payload !== "object" || payload === null) {
|
|
329
|
+
return undefined
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
const payloadPayload =
|
|
333
|
+
"payload" in payload &&
|
|
334
|
+
typeof payload.payload === "object" &&
|
|
335
|
+
payload.payload !== null
|
|
336
|
+
? payload.payload
|
|
337
|
+
: undefined
|
|
338
|
+
|
|
339
|
+
let configLabelKey: string = key
|
|
340
|
+
|
|
341
|
+
if (
|
|
342
|
+
key in payload &&
|
|
343
|
+
typeof payload[key as keyof typeof payload] === "string"
|
|
344
|
+
) {
|
|
345
|
+
configLabelKey = payload[key as keyof typeof payload] as string
|
|
346
|
+
} else if (
|
|
347
|
+
payloadPayload &&
|
|
348
|
+
key in payloadPayload &&
|
|
349
|
+
typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
|
|
350
|
+
) {
|
|
351
|
+
configLabelKey = payloadPayload[
|
|
352
|
+
key as keyof typeof payloadPayload
|
|
353
|
+
] as string
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
return configLabelKey in config
|
|
357
|
+
? config[configLabelKey]
|
|
358
|
+
: config[key as keyof typeof config]
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export {
|
|
362
|
+
ChartContainer,
|
|
363
|
+
ChartTooltip,
|
|
364
|
+
ChartTooltipContent,
|
|
365
|
+
ChartLegend,
|
|
366
|
+
ChartLegendContent,
|
|
367
|
+
ChartStyle,
|
|
368
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
|
|
3
|
+
import { Check } from "lucide-react"
|
|
4
4
|
|
|
5
|
-
import { cn } from "
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
6
|
|
|
7
7
|
const Checkbox = React.forwardRef<
|
|
8
8
|
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
|
@@ -22,7 +22,7 @@ const Checkbox = React.forwardRef<
|
|
|
22
22
|
<Check className="h-4 w-4" />
|
|
23
23
|
</CheckboxPrimitive.Indicator>
|
|
24
24
|
</CheckboxPrimitive.Root>
|
|
25
|
-
))
|
|
26
|
-
Checkbox.displayName = CheckboxPrimitive.Root.displayName
|
|
25
|
+
))
|
|
26
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName
|
|
27
27
|
|
|
28
|
-
export { Checkbox }
|
|
28
|
+
export { Checkbox }
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use client"
|
|
1
|
+
"use client"
|
|
2
2
|
|
|
3
|
-
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
|
|
3
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
|
|
4
4
|
|
|
5
|
-
const Collapsible = CollapsiblePrimitive.Root
|
|
5
|
+
const Collapsible = CollapsiblePrimitive.Root
|
|
6
6
|
|
|
7
|
-
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger
|
|
7
|
+
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger
|
|
8
8
|
|
|
9
|
-
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent
|
|
9
|
+
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent
|
|
10
10
|
|
|
11
|
-
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|
|
11
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import { cn } from "
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import type { DialogProps } from "@radix-ui/react-dialog"
|
|
3
|
+
import { Command as CommandPrimitive } from "cmdk"
|
|
4
|
+
import { Search } from "lucide-react"
|
|
5
|
+
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
import { Dialog, DialogContent } from "@/components/dialog"
|
|
7
8
|
|
|
8
9
|
const Command = React.forwardRef<
|
|
9
10
|
React.ElementRef<typeof CommandPrimitive>,
|
|
@@ -17,8 +18,8 @@ const Command = React.forwardRef<
|
|
|
17
18
|
)}
|
|
18
19
|
{...props}
|
|
19
20
|
/>
|
|
20
|
-
))
|
|
21
|
-
Command.displayName = CommandPrimitive.displayName
|
|
21
|
+
))
|
|
22
|
+
Command.displayName = CommandPrimitive.displayName
|
|
22
23
|
|
|
23
24
|
const CommandDialog = ({ children, ...props }: DialogProps) => {
|
|
24
25
|
return (
|
|
@@ -29,8 +30,8 @@ const CommandDialog = ({ children, ...props }: DialogProps) => {
|
|
|
29
30
|
</Command>
|
|
30
31
|
</DialogContent>
|
|
31
32
|
</Dialog>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
33
|
+
)
|
|
34
|
+
}
|
|
34
35
|
|
|
35
36
|
const CommandInput = React.forwardRef<
|
|
36
37
|
React.ElementRef<typeof CommandPrimitive.Input>,
|
|
@@ -47,9 +48,9 @@ const CommandInput = React.forwardRef<
|
|
|
47
48
|
{...props}
|
|
48
49
|
/>
|
|
49
50
|
</div>
|
|
50
|
-
))
|
|
51
|
+
))
|
|
51
52
|
|
|
52
|
-
CommandInput.displayName = CommandPrimitive.Input.displayName
|
|
53
|
+
CommandInput.displayName = CommandPrimitive.Input.displayName
|
|
53
54
|
|
|
54
55
|
const CommandList = React.forwardRef<
|
|
55
56
|
React.ElementRef<typeof CommandPrimitive.List>,
|
|
@@ -60,9 +61,9 @@ const CommandList = React.forwardRef<
|
|
|
60
61
|
className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
|
|
61
62
|
{...props}
|
|
62
63
|
/>
|
|
63
|
-
))
|
|
64
|
+
))
|
|
64
65
|
|
|
65
|
-
CommandList.displayName = CommandPrimitive.List.displayName
|
|
66
|
+
CommandList.displayName = CommandPrimitive.List.displayName
|
|
66
67
|
|
|
67
68
|
const CommandEmpty = React.forwardRef<
|
|
68
69
|
React.ElementRef<typeof CommandPrimitive.Empty>,
|
|
@@ -73,9 +74,9 @@ const CommandEmpty = React.forwardRef<
|
|
|
73
74
|
className="py-6 text-center text-sm"
|
|
74
75
|
{...props}
|
|
75
76
|
/>
|
|
76
|
-
))
|
|
77
|
+
))
|
|
77
78
|
|
|
78
|
-
CommandEmpty.displayName = CommandPrimitive.Empty.displayName
|
|
79
|
+
CommandEmpty.displayName = CommandPrimitive.Empty.displayName
|
|
79
80
|
|
|
80
81
|
const CommandGroup = React.forwardRef<
|
|
81
82
|
React.ElementRef<typeof CommandPrimitive.Group>,
|
|
@@ -89,9 +90,9 @@ const CommandGroup = React.forwardRef<
|
|
|
89
90
|
)}
|
|
90
91
|
{...props}
|
|
91
92
|
/>
|
|
92
|
-
))
|
|
93
|
+
))
|
|
93
94
|
|
|
94
|
-
CommandGroup.displayName = CommandPrimitive.Group.displayName
|
|
95
|
+
CommandGroup.displayName = CommandPrimitive.Group.displayName
|
|
95
96
|
|
|
96
97
|
const CommandSeparator = React.forwardRef<
|
|
97
98
|
React.ElementRef<typeof CommandPrimitive.Separator>,
|
|
@@ -102,8 +103,8 @@ const CommandSeparator = React.forwardRef<
|
|
|
102
103
|
className={cn("-mx-1 h-px bg-border", className)}
|
|
103
104
|
{...props}
|
|
104
105
|
/>
|
|
105
|
-
))
|
|
106
|
-
CommandSeparator.displayName = CommandPrimitive.Separator.displayName
|
|
106
|
+
))
|
|
107
|
+
CommandSeparator.displayName = CommandPrimitive.Separator.displayName
|
|
107
108
|
|
|
108
109
|
const CommandItem = React.forwardRef<
|
|
109
110
|
React.ElementRef<typeof CommandPrimitive.Item>,
|
|
@@ -117,9 +118,9 @@ const CommandItem = React.forwardRef<
|
|
|
117
118
|
)}
|
|
118
119
|
{...props}
|
|
119
120
|
/>
|
|
120
|
-
))
|
|
121
|
+
))
|
|
121
122
|
|
|
122
|
-
CommandItem.displayName = CommandPrimitive.Item.displayName
|
|
123
|
+
CommandItem.displayName = CommandPrimitive.Item.displayName
|
|
123
124
|
|
|
124
125
|
const CommandShortcut = ({
|
|
125
126
|
className,
|
|
@@ -133,9 +134,9 @@ const CommandShortcut = ({
|
|
|
133
134
|
)}
|
|
134
135
|
{...props}
|
|
135
136
|
/>
|
|
136
|
-
)
|
|
137
|
-
}
|
|
138
|
-
CommandShortcut.displayName = "CommandShortcut"
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
CommandShortcut.displayName = "CommandShortcut"
|
|
139
140
|
|
|
140
141
|
export {
|
|
141
142
|
Command,
|
|
@@ -147,4 +148,4 @@ export {
|
|
|
147
148
|
CommandItem,
|
|
148
149
|
CommandShortcut,
|
|
149
150
|
CommandSeparator,
|
|
150
|
-
}
|
|
151
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
|
|
3
|
+
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
4
4
|
|
|
5
|
-
import { cn } from "
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
6
|
|
|
7
|
-
const ContextMenu = ContextMenuPrimitive.Root
|
|
7
|
+
const ContextMenu = ContextMenuPrimitive.Root
|
|
8
8
|
|
|
9
|
-
const ContextMenuTrigger = ContextMenuPrimitive.Trigger
|
|
9
|
+
const ContextMenuTrigger = ContextMenuPrimitive.Trigger
|
|
10
10
|
|
|
11
|
-
const ContextMenuGroup = ContextMenuPrimitive.Group
|
|
11
|
+
const ContextMenuGroup = ContextMenuPrimitive.Group
|
|
12
12
|
|
|
13
|
-
const ContextMenuPortal = ContextMenuPrimitive.Portal
|
|
13
|
+
const ContextMenuPortal = ContextMenuPrimitive.Portal
|
|
14
14
|
|
|
15
|
-
const ContextMenuSub = ContextMenuPrimitive.Sub
|
|
15
|
+
const ContextMenuSub = ContextMenuPrimitive.Sub
|
|
16
16
|
|
|
17
|
-
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
|
|
17
|
+
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
|
|
18
18
|
|
|
19
19
|
const ContextMenuSubTrigger = React.forwardRef<
|
|
20
20
|
React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
|
|
21
21
|
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
|
|
22
|
-
inset?: boolean
|
|
22
|
+
inset?: boolean
|
|
23
23
|
}
|
|
24
24
|
>(({ className, inset, children, ...props }, ref) => (
|
|
25
25
|
<ContextMenuPrimitive.SubTrigger
|
|
@@ -34,8 +34,8 @@ const ContextMenuSubTrigger = React.forwardRef<
|
|
|
34
34
|
{children}
|
|
35
35
|
<ChevronRight className="ml-auto h-4 w-4" />
|
|
36
36
|
</ContextMenuPrimitive.SubTrigger>
|
|
37
|
-
))
|
|
38
|
-
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName
|
|
37
|
+
))
|
|
38
|
+
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName
|
|
39
39
|
|
|
40
40
|
const ContextMenuSubContent = React.forwardRef<
|
|
41
41
|
React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
|
|
@@ -49,8 +49,8 @@ const ContextMenuSubContent = React.forwardRef<
|
|
|
49
49
|
)}
|
|
50
50
|
{...props}
|
|
51
51
|
/>
|
|
52
|
-
))
|
|
53
|
-
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName
|
|
52
|
+
))
|
|
53
|
+
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName
|
|
54
54
|
|
|
55
55
|
const ContextMenuContent = React.forwardRef<
|
|
56
56
|
React.ElementRef<typeof ContextMenuPrimitive.Content>,
|
|
@@ -66,13 +66,13 @@ const ContextMenuContent = React.forwardRef<
|
|
|
66
66
|
{...props}
|
|
67
67
|
/>
|
|
68
68
|
</ContextMenuPrimitive.Portal>
|
|
69
|
-
))
|
|
70
|
-
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName
|
|
69
|
+
))
|
|
70
|
+
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName
|
|
71
71
|
|
|
72
72
|
const ContextMenuItem = React.forwardRef<
|
|
73
73
|
React.ElementRef<typeof ContextMenuPrimitive.Item>,
|
|
74
74
|
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
|
|
75
|
-
inset?: boolean
|
|
75
|
+
inset?: boolean
|
|
76
76
|
}
|
|
77
77
|
>(({ className, inset, ...props }, ref) => (
|
|
78
78
|
<ContextMenuPrimitive.Item
|
|
@@ -84,8 +84,8 @@ const ContextMenuItem = React.forwardRef<
|
|
|
84
84
|
)}
|
|
85
85
|
{...props}
|
|
86
86
|
/>
|
|
87
|
-
))
|
|
88
|
-
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName
|
|
87
|
+
))
|
|
88
|
+
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName
|
|
89
89
|
|
|
90
90
|
const ContextMenuCheckboxItem = React.forwardRef<
|
|
91
91
|
React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
|
|
@@ -107,9 +107,9 @@ const ContextMenuCheckboxItem = React.forwardRef<
|
|
|
107
107
|
</span>
|
|
108
108
|
{children}
|
|
109
109
|
</ContextMenuPrimitive.CheckboxItem>
|
|
110
|
-
))
|
|
110
|
+
))
|
|
111
111
|
ContextMenuCheckboxItem.displayName =
|
|
112
|
-
ContextMenuPrimitive.CheckboxItem.displayName
|
|
112
|
+
ContextMenuPrimitive.CheckboxItem.displayName
|
|
113
113
|
|
|
114
114
|
const ContextMenuRadioItem = React.forwardRef<
|
|
115
115
|
React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
|
|
@@ -130,13 +130,13 @@ const ContextMenuRadioItem = React.forwardRef<
|
|
|
130
130
|
</span>
|
|
131
131
|
{children}
|
|
132
132
|
</ContextMenuPrimitive.RadioItem>
|
|
133
|
-
))
|
|
134
|
-
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName
|
|
133
|
+
))
|
|
134
|
+
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName
|
|
135
135
|
|
|
136
136
|
const ContextMenuLabel = React.forwardRef<
|
|
137
137
|
React.ElementRef<typeof ContextMenuPrimitive.Label>,
|
|
138
138
|
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
|
|
139
|
-
inset?: boolean
|
|
139
|
+
inset?: boolean
|
|
140
140
|
}
|
|
141
141
|
>(({ className, inset, ...props }, ref) => (
|
|
142
142
|
<ContextMenuPrimitive.Label
|
|
@@ -148,8 +148,8 @@ const ContextMenuLabel = React.forwardRef<
|
|
|
148
148
|
)}
|
|
149
149
|
{...props}
|
|
150
150
|
/>
|
|
151
|
-
))
|
|
152
|
-
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName
|
|
151
|
+
))
|
|
152
|
+
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName
|
|
153
153
|
|
|
154
154
|
const ContextMenuSeparator = React.forwardRef<
|
|
155
155
|
React.ElementRef<typeof ContextMenuPrimitive.Separator>,
|
|
@@ -160,8 +160,8 @@ const ContextMenuSeparator = React.forwardRef<
|
|
|
160
160
|
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
161
161
|
{...props}
|
|
162
162
|
/>
|
|
163
|
-
))
|
|
164
|
-
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName
|
|
163
|
+
))
|
|
164
|
+
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName
|
|
165
165
|
|
|
166
166
|
const ContextMenuShortcut = ({
|
|
167
167
|
className,
|
|
@@ -175,9 +175,9 @@ const ContextMenuShortcut = ({
|
|
|
175
175
|
)}
|
|
176
176
|
{...props}
|
|
177
177
|
/>
|
|
178
|
-
)
|
|
179
|
-
}
|
|
180
|
-
ContextMenuShortcut.displayName = "ContextMenuShortcut"
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
ContextMenuShortcut.displayName = "ContextMenuShortcut"
|
|
181
181
|
|
|
182
182
|
export {
|
|
183
183
|
ContextMenu,
|
|
@@ -195,4 +195,4 @@ export {
|
|
|
195
195
|
ContextMenuSubContent,
|
|
196
196
|
ContextMenuSubTrigger,
|
|
197
197
|
ContextMenuRadioGroup,
|
|
198
|
-
}
|
|
198
|
+
}
|