@inferencesh/ui 0.0.0-stage → 0.1.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.
Files changed (165) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +68 -2
  3. package/components.json +22 -0
  4. package/package.json +231 -4
  5. package/src/components/audio-player.tsx +549 -0
  6. package/src/components/button.tsx +13 -0
  7. package/src/components/chart.tsx +403 -0
  8. package/src/components/circuit.tsx +276 -0
  9. package/src/components/code-block/code-block.tsx +260 -0
  10. package/src/components/code-block/index.ts +18 -0
  11. package/src/components/code-block/languages.ts +311 -0
  12. package/src/components/code-block/styles.ts +39 -0
  13. package/src/components/code-block/tokenizer.ts +290 -0
  14. package/src/components/code-block/types.ts +38 -0
  15. package/src/components/code-block/utils.ts +39 -0
  16. package/src/components/code.tsx +48 -0
  17. package/src/components/cookie-consent.tsx +137 -0
  18. package/src/components/copy-button.tsx +44 -0
  19. package/src/components/country-dropdown.tsx +188 -0
  20. package/src/components/glow-loader-fast.tsx +32 -0
  21. package/src/components/glow-loader-mono.tsx +33 -0
  22. package/src/components/glow-loader-sm-fast.tsx +32 -0
  23. package/src/components/glow-loader-sm-mono.tsx +34 -0
  24. package/src/components/glow-loader-sm.tsx +32 -0
  25. package/src/components/glow-loader.tsx +32 -0
  26. package/src/components/glow-logo.tsx +32 -0
  27. package/src/components/gradient.tsx +80 -0
  28. package/src/components/index.ts +45 -0
  29. package/src/components/inline-sidebar.tsx +351 -0
  30. package/src/components/input-color.tsx +349 -0
  31. package/src/components/logo-base.tsx +213 -0
  32. package/src/components/logo-color.tsx +23 -0
  33. package/src/components/logo-full.tsx +71 -0
  34. package/src/components/logo-svg.tsx +23 -0
  35. package/src/components/menu-navigation.tsx +359 -0
  36. package/src/components/multi-select.tsx +721 -0
  37. package/src/components/pastel-gradient.tsx +25 -0
  38. package/src/components/pixel-symmetry.tsx +151 -0
  39. package/src/components/progress.tsx +28 -0
  40. package/src/components/scroll-more.tsx +131 -0
  41. package/src/components/select.tsx +85 -0
  42. package/src/components/shimmering-text.tsx +108 -0
  43. package/src/components/sidebar-light.tsx +102 -0
  44. package/src/components/sonner.tsx +38 -0
  45. package/src/components/theme-switcher-sidebar.tsx +56 -0
  46. package/src/components/theme-switcher-simple.tsx +110 -0
  47. package/src/components/theme-switcher.tsx +47 -0
  48. package/src/components/toggle-group.tsx +55 -0
  49. package/src/components/tooltip-button.tsx +91 -0
  50. package/src/components/tooltip.tsx +71 -0
  51. package/src/components/tree-view.tsx +499 -0
  52. package/src/components/unglow-loader.tsx +33 -0
  53. package/src/components/waveform.tsx +1632 -0
  54. package/src/components/zoomable-image.tsx +76 -0
  55. package/src/docs/api-docs.tsx +763 -0
  56. package/src/docs/callout.tsx +160 -0
  57. package/src/docs/code-group.tsx +215 -0
  58. package/src/docs/copy-menu.tsx +143 -0
  59. package/src/docs/doc-tabs.tsx +84 -0
  60. package/src/docs/index.ts +16 -0
  61. package/src/docs/steps.tsx +105 -0
  62. package/src/docs/table-of-contents.tsx +174 -0
  63. package/src/examples/guide-markdown.ts +129 -0
  64. package/src/examples/index.ts +1153 -0
  65. package/src/global.d.ts +1 -0
  66. package/src/hooks/use-copy-to-clipboard.ts +36 -0
  67. package/src/hooks/use-mobile.ts +19 -0
  68. package/src/lib/display-name.ts +15 -0
  69. package/src/lib/example-input.ts +130 -0
  70. package/src/lib/plans.ts +44 -0
  71. package/src/lib/safe-content.ts +137 -0
  72. package/src/lib/schema.ts +320 -0
  73. package/src/lib/storage.ts +108 -0
  74. package/src/markdown/docs-markdown-renderer.tsx +518 -0
  75. package/src/markdown/helpers.ts +95 -0
  76. package/src/markdown/index.ts +24 -0
  77. package/src/markdown/markdown-renderer.tsx +232 -0
  78. package/src/markdown/youtube-embed.tsx +43 -0
  79. package/src/og/image.ts +312 -0
  80. package/src/og/index.tsx +430 -0
  81. package/src/og/query.ts +26 -0
  82. package/src/shadcn/accordion.tsx +71 -0
  83. package/src/shadcn/alert-dialog.tsx +187 -0
  84. package/src/shadcn/alert.tsx +75 -0
  85. package/src/shadcn/aspect-ratio.tsx +22 -0
  86. package/src/shadcn/attachment.tsx +207 -0
  87. package/src/shadcn/avatar.tsx +106 -0
  88. package/src/shadcn/badge.tsx +51 -0
  89. package/src/shadcn/breadcrumb.tsx +124 -0
  90. package/src/shadcn/bubble.tsx +127 -0
  91. package/src/shadcn/button-group.tsx +87 -0
  92. package/src/shadcn/button.tsx +57 -0
  93. package/src/shadcn/calendar.tsx +219 -0
  94. package/src/shadcn/card.tsx +102 -0
  95. package/src/shadcn/carousel.tsx +242 -0
  96. package/src/shadcn/chart.tsx +372 -0
  97. package/src/shadcn/checkbox.tsx +28 -0
  98. package/src/shadcn/collapsible.tsx +19 -0
  99. package/src/shadcn/combobox.tsx +297 -0
  100. package/src/shadcn/command.tsx +194 -0
  101. package/src/shadcn/context-menu.tsx +270 -0
  102. package/src/shadcn/dialog.tsx +158 -0
  103. package/src/shadcn/direction.tsx +4 -0
  104. package/src/shadcn/drawer.tsx +227 -0
  105. package/src/shadcn/dropdown-menu.tsx +265 -0
  106. package/src/shadcn/empty.tsx +103 -0
  107. package/src/shadcn/field.tsx +238 -0
  108. package/src/shadcn/form.tsx +173 -0
  109. package/src/shadcn/hover-card.tsx +50 -0
  110. package/src/shadcn/index.ts +53 -0
  111. package/src/shadcn/input-group.tsx +156 -0
  112. package/src/shadcn/input-otp.tsx +84 -0
  113. package/src/shadcn/input.tsx +19 -0
  114. package/src/shadcn/item.tsx +201 -0
  115. package/src/shadcn/kbd.tsx +26 -0
  116. package/src/shadcn/label.tsx +19 -0
  117. package/src/shadcn/marker.tsx +70 -0
  118. package/src/shadcn/menubar.tsx +278 -0
  119. package/src/shadcn/message-scroller.tsx +131 -0
  120. package/src/shadcn/message.tsx +91 -0
  121. package/src/shadcn/native-select.tsx +60 -0
  122. package/src/shadcn/navigation-menu.tsx +167 -0
  123. package/src/shadcn/pagination.tsx +130 -0
  124. package/src/shadcn/popover.tsx +87 -0
  125. package/src/shadcn/progress.tsx +82 -0
  126. package/src/shadcn/radio-group.tsx +35 -0
  127. package/src/shadcn/resizable.tsx +49 -0
  128. package/src/shadcn/scroll-area.tsx +52 -0
  129. package/src/shadcn/select.tsx +200 -0
  130. package/src/shadcn/separator.tsx +22 -0
  131. package/src/shadcn/sheet.tsx +136 -0
  132. package/src/shadcn/sidebar.tsx +721 -0
  133. package/src/shadcn/skeleton.tsx +13 -0
  134. package/src/shadcn/slider.tsx +51 -0
  135. package/src/shadcn/sonner.tsx +49 -0
  136. package/src/shadcn/spinner.tsx +10 -0
  137. package/src/shadcn/switch.tsx +29 -0
  138. package/src/shadcn/table.tsx +115 -0
  139. package/src/shadcn/tabs.tsx +79 -0
  140. package/src/shadcn/textarea.tsx +17 -0
  141. package/src/shadcn/toggle-group.tsx +89 -0
  142. package/src/shadcn/toggle.tsx +44 -0
  143. package/src/shadcn/tooltip.tsx +63 -0
  144. package/src/theme/config.ts +48 -0
  145. package/src/theme/css/base.css +92 -0
  146. package/src/theme/css/bitboy.css +75 -0
  147. package/src/theme/css/dark.css +47 -0
  148. package/src/theme/css/designer.css +122 -0
  149. package/src/theme/css/fonts.css +33 -0
  150. package/src/theme/css/globals.css +14 -0
  151. package/src/theme/css/hackintosh.css +57 -0
  152. package/src/theme/css/llama.css +103 -0
  153. package/src/theme/css/safelist.css +39 -0
  154. package/src/theme/css/shadcn.css +77 -0
  155. package/src/theme/css/theme.css +216 -0
  156. package/src/theme/embed-theme.ts +146 -0
  157. package/src/theme/fonts/FiraCode-VF.woff2 +0 -0
  158. package/src/theme/fonts/Hack-Regular.woff2 +0 -0
  159. package/src/theme/fonts/LICENSE-FiraCode.txt +93 -0
  160. package/src/theme/fonts/LICENSE-Hack.txt +45 -0
  161. package/src/theme/fonts/LICENSE-MonaSans.txt +93 -0
  162. package/src/theme/fonts/Mona-Sans.woff2 +0 -0
  163. package/src/theme/index.ts +15 -0
  164. package/src/utils/cn.ts +3 -0
  165. package/src/utils/index.ts +2 -0
@@ -0,0 +1,28 @@
1
+ "use client"
2
+
3
+ import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox"
4
+ import { cn } from "cn"
5
+ import { CheckIcon } from "lucide-react"
6
+
7
+ function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
8
+ return (
9
+ <CheckboxPrimitive.Root
10
+ data-slot="checkbox"
11
+ className={cn(
12
+ "peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",
13
+ className
14
+ )}
15
+ {...props}
16
+ >
17
+ <CheckboxPrimitive.Indicator
18
+ data-slot="checkbox-indicator"
19
+ className="grid place-content-center text-current transition-none [&>svg]:size-3.5"
20
+ >
21
+ <CheckIcon
22
+ />
23
+ </CheckboxPrimitive.Indicator>
24
+ </CheckboxPrimitive.Root>
25
+ )
26
+ }
27
+
28
+ export { Checkbox }
@@ -0,0 +1,19 @@
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 (
9
+ <CollapsiblePrimitive.Trigger data-slot="collapsible-trigger" {...props} />
10
+ )
11
+ }
12
+
13
+ function CollapsibleContent({ ...props }: CollapsiblePrimitive.Panel.Props) {
14
+ return (
15
+ <CollapsiblePrimitive.Panel data-slot="collapsible-content" {...props} />
16
+ )
17
+ }
18
+
19
+ export { Collapsible, CollapsibleTrigger, CollapsibleContent }
@@ -0,0 +1,297 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { Combobox as ComboboxPrimitive } from "@base-ui/react"
5
+ import { cn } from "cn"
6
+
7
+ import { Button } from "@inferencesh/ui/shadcn/button"
8
+ import {
9
+ InputGroup,
10
+ InputGroupAddon,
11
+ InputGroupButton,
12
+ InputGroupInput,
13
+ } from "@inferencesh/ui/shadcn/input-group"
14
+ import { ChevronDownIcon, XIcon, CheckIcon } from "lucide-react"
15
+
16
+ const Combobox = ComboboxPrimitive.Root
17
+
18
+ function ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) {
19
+ return <ComboboxPrimitive.Value data-slot="combobox-value" {...props} />
20
+ }
21
+
22
+ function ComboboxTrigger({
23
+ className,
24
+ children,
25
+ ...props
26
+ }: ComboboxPrimitive.Trigger.Props) {
27
+ return (
28
+ <ComboboxPrimitive.Trigger
29
+ data-slot="combobox-trigger"
30
+ className={cn("[&_svg:not([class*='size-'])]:size-4", className)}
31
+ {...props}
32
+ >
33
+ {children}
34
+ <ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
35
+ </ComboboxPrimitive.Trigger>
36
+ )
37
+ }
38
+
39
+ function ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) {
40
+ return (
41
+ <ComboboxPrimitive.Clear
42
+ data-slot="combobox-clear"
43
+ render={<InputGroupButton variant="ghost" size="icon-xs" />}
44
+ className={cn(className)}
45
+ {...props}
46
+ >
47
+ <XIcon className="pointer-events-none" />
48
+ </ComboboxPrimitive.Clear>
49
+ )
50
+ }
51
+
52
+ function ComboboxInput({
53
+ className,
54
+ children,
55
+ disabled = false,
56
+ showTrigger = true,
57
+ showClear = false,
58
+ ...props
59
+ }: ComboboxPrimitive.Input.Props & {
60
+ showTrigger?: boolean
61
+ showClear?: boolean
62
+ }) {
63
+ return (
64
+ <InputGroup className={cn("w-auto", className)}>
65
+ <ComboboxPrimitive.Input
66
+ render={<InputGroupInput disabled={disabled} />}
67
+ {...props}
68
+ />
69
+ <InputGroupAddon align="inline-end">
70
+ {showTrigger && (
71
+ <InputGroupButton
72
+ size="icon-xs"
73
+ variant="ghost"
74
+ render={<ComboboxTrigger />}
75
+ data-slot="input-group-button"
76
+ className="group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent"
77
+ disabled={disabled}
78
+ />
79
+ )}
80
+ {showClear && <ComboboxClear disabled={disabled} />}
81
+ </InputGroupAddon>
82
+ {children}
83
+ </InputGroup>
84
+ )
85
+ }
86
+
87
+ function ComboboxContent({
88
+ className,
89
+ side = "bottom",
90
+ sideOffset = 6,
91
+ align = "start",
92
+ alignOffset = 0,
93
+ anchor,
94
+ ...props
95
+ }: ComboboxPrimitive.Popup.Props &
96
+ Pick<
97
+ ComboboxPrimitive.Positioner.Props,
98
+ "side" | "align" | "sideOffset" | "alignOffset" | "anchor"
99
+ >) {
100
+ return (
101
+ <ComboboxPrimitive.Portal>
102
+ <ComboboxPrimitive.Positioner
103
+ side={side}
104
+ sideOffset={sideOffset}
105
+ align={align}
106
+ alignOffset={alignOffset}
107
+ anchor={anchor}
108
+ className="isolate z-50"
109
+ >
110
+ <ComboboxPrimitive.Popup
111
+ data-slot="combobox-content"
112
+ data-chips={!!anchor}
113
+ className={cn("group/combobox-content 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 bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) 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]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none 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", className )}
114
+ {...props}
115
+ />
116
+ </ComboboxPrimitive.Positioner>
117
+ </ComboboxPrimitive.Portal>
118
+ )
119
+ }
120
+
121
+ function ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {
122
+ return (
123
+ <ComboboxPrimitive.List
124
+ data-slot="combobox-list"
125
+ className={cn(
126
+ "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",
127
+ className
128
+ )}
129
+ {...props}
130
+ />
131
+ )
132
+ }
133
+
134
+ function ComboboxItem({
135
+ className,
136
+ children,
137
+ ...props
138
+ }: ComboboxPrimitive.Item.Props) {
139
+ return (
140
+ <ComboboxPrimitive.Item
141
+ data-slot="combobox-item"
142
+ className={cn(
143
+ "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-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
144
+ className
145
+ )}
146
+ {...props}
147
+ >
148
+ {children}
149
+ <ComboboxPrimitive.ItemIndicator
150
+ render={
151
+ <span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center" />
152
+ }
153
+ >
154
+ <CheckIcon className="pointer-events-none" />
155
+ </ComboboxPrimitive.ItemIndicator>
156
+ </ComboboxPrimitive.Item>
157
+ )
158
+ }
159
+
160
+ function ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) {
161
+ return (
162
+ <ComboboxPrimitive.Group
163
+ data-slot="combobox-group"
164
+ className={cn(className)}
165
+ {...props}
166
+ />
167
+ )
168
+ }
169
+
170
+ function ComboboxLabel({
171
+ className,
172
+ ...props
173
+ }: ComboboxPrimitive.GroupLabel.Props) {
174
+ return (
175
+ <ComboboxPrimitive.GroupLabel
176
+ data-slot="combobox-label"
177
+ className={cn("px-2 py-1.5 text-xs text-muted-foreground", className)}
178
+ {...props}
179
+ />
180
+ )
181
+ }
182
+
183
+ function ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) {
184
+ return (
185
+ <ComboboxPrimitive.Collection data-slot="combobox-collection" {...props} />
186
+ )
187
+ }
188
+
189
+ function ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {
190
+ return (
191
+ <ComboboxPrimitive.Empty
192
+ data-slot="combobox-empty"
193
+ className={cn(
194
+ "hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex",
195
+ className
196
+ )}
197
+ {...props}
198
+ />
199
+ )
200
+ }
201
+
202
+ function ComboboxSeparator({
203
+ className,
204
+ ...props
205
+ }: ComboboxPrimitive.Separator.Props) {
206
+ return (
207
+ <ComboboxPrimitive.Separator
208
+ data-slot="combobox-separator"
209
+ className={cn("-mx-1 my-1 h-px bg-border", className)}
210
+ {...props}
211
+ />
212
+ )
213
+ }
214
+
215
+ function ComboboxChips({
216
+ className,
217
+ ...props
218
+ }: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> &
219
+ ComboboxPrimitive.Chips.Props) {
220
+ return (
221
+ <ComboboxPrimitive.Chips
222
+ data-slot="combobox-chips"
223
+ className={cn(
224
+ "flex min-h-8 flex-wrap items-center gap-1 rounded-lg border border-input bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40",
225
+ className
226
+ )}
227
+ {...props}
228
+ />
229
+ )
230
+ }
231
+
232
+ function ComboboxChip({
233
+ className,
234
+ children,
235
+ showRemove = true,
236
+ ...props
237
+ }: ComboboxPrimitive.Chip.Props & {
238
+ showRemove?: boolean
239
+ }) {
240
+ return (
241
+ <ComboboxPrimitive.Chip
242
+ data-slot="combobox-chip"
243
+ className={cn(
244
+ "flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0",
245
+ className
246
+ )}
247
+ {...props}
248
+ >
249
+ {children}
250
+ {showRemove && (
251
+ <ComboboxPrimitive.ChipRemove
252
+ render={<Button variant="ghost" size="icon-xs" />}
253
+ className="-ml-1 opacity-50 hover:opacity-100"
254
+ data-slot="combobox-chip-remove"
255
+ >
256
+ <XIcon className="pointer-events-none" />
257
+ </ComboboxPrimitive.ChipRemove>
258
+ )}
259
+ </ComboboxPrimitive.Chip>
260
+ )
261
+ }
262
+
263
+ function ComboboxChipsInput({
264
+ className,
265
+ ...props
266
+ }: ComboboxPrimitive.Input.Props) {
267
+ return (
268
+ <ComboboxPrimitive.Input
269
+ data-slot="combobox-chip-input"
270
+ className={cn("min-w-16 flex-1 outline-none", className)}
271
+ {...props}
272
+ />
273
+ )
274
+ }
275
+
276
+ function useComboboxAnchor() {
277
+ return React.useRef<HTMLDivElement | null>(null)
278
+ }
279
+
280
+ export {
281
+ Combobox,
282
+ ComboboxInput,
283
+ ComboboxContent,
284
+ ComboboxList,
285
+ ComboboxItem,
286
+ ComboboxGroup,
287
+ ComboboxLabel,
288
+ ComboboxCollection,
289
+ ComboboxEmpty,
290
+ ComboboxSeparator,
291
+ ComboboxChips,
292
+ ComboboxChip,
293
+ ComboboxChipsInput,
294
+ ComboboxTrigger,
295
+ ComboboxValue,
296
+ useComboboxAnchor,
297
+ }
@@ -0,0 +1,194 @@
1
+ import * as React from "react"
2
+ import { Command as CommandPrimitive } from "cmdk"
3
+ import { cn } from "cn"
4
+
5
+ import {
6
+ Dialog,
7
+ DialogContent,
8
+ DialogDescription,
9
+ DialogHeader,
10
+ DialogTitle,
11
+ } from "@inferencesh/ui/shadcn/dialog"
12
+ import {
13
+ InputGroup,
14
+ InputGroupAddon,
15
+ } from "@inferencesh/ui/shadcn/input-group"
16
+ import { SearchIcon, CheckIcon } from "lucide-react"
17
+
18
+ function Command({
19
+ className,
20
+ ...props
21
+ }: React.ComponentProps<typeof CommandPrimitive>) {
22
+ return (
23
+ <CommandPrimitive
24
+ data-slot="command"
25
+ className={cn(
26
+ "flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",
27
+ className
28
+ )}
29
+ {...props}
30
+ />
31
+ )
32
+ }
33
+
34
+ function CommandDialog({
35
+ title = "Command Palette",
36
+ description = "Search for a command to run...",
37
+ children,
38
+ className,
39
+ showCloseButton = false,
40
+ ...props
41
+ }: Omit<React.ComponentProps<typeof Dialog>, "children"> & {
42
+ title?: string
43
+ description?: string
44
+ className?: string
45
+ showCloseButton?: boolean
46
+ children: React.ReactNode
47
+ }) {
48
+ return (
49
+ <Dialog {...props}>
50
+ <DialogHeader className="sr-only">
51
+ <DialogTitle>{title}</DialogTitle>
52
+ <DialogDescription>{description}</DialogDescription>
53
+ </DialogHeader>
54
+ <DialogContent
55
+ className={cn(
56
+ "top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0",
57
+ className
58
+ )}
59
+ showCloseButton={showCloseButton}
60
+ >
61
+ {children}
62
+ </DialogContent>
63
+ </Dialog>
64
+ )
65
+ }
66
+
67
+ function CommandInput({
68
+ className,
69
+ ...props
70
+ }: React.ComponentProps<typeof CommandPrimitive.Input>) {
71
+ return (
72
+ <div data-slot="command-input-wrapper" className="p-1 pb-0">
73
+ <InputGroup className="h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!">
74
+ <CommandPrimitive.Input
75
+ data-slot="command-input"
76
+ className={cn(
77
+ "w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
78
+ className
79
+ )}
80
+ {...props}
81
+ />
82
+ <InputGroupAddon>
83
+ <SearchIcon className="size-4 shrink-0 opacity-50" />
84
+ </InputGroupAddon>
85
+ </InputGroup>
86
+ </div>
87
+ )
88
+ }
89
+
90
+ function CommandList({
91
+ className,
92
+ ...props
93
+ }: React.ComponentProps<typeof CommandPrimitive.List>) {
94
+ return (
95
+ <CommandPrimitive.List
96
+ data-slot="command-list"
97
+ className={cn(
98
+ "no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",
99
+ className
100
+ )}
101
+ {...props}
102
+ />
103
+ )
104
+ }
105
+
106
+ function CommandEmpty({
107
+ className,
108
+ ...props
109
+ }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
110
+ return (
111
+ <CommandPrimitive.Empty
112
+ data-slot="command-empty"
113
+ className={cn("py-6 text-center text-sm", className)}
114
+ {...props}
115
+ />
116
+ )
117
+ }
118
+
119
+ function CommandGroup({
120
+ className,
121
+ ...props
122
+ }: React.ComponentProps<typeof CommandPrimitive.Group>) {
123
+ return (
124
+ <CommandPrimitive.Group
125
+ data-slot="command-group"
126
+ className={cn(
127
+ "overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",
128
+ className
129
+ )}
130
+ {...props}
131
+ />
132
+ )
133
+ }
134
+
135
+ function CommandSeparator({
136
+ className,
137
+ ...props
138
+ }: React.ComponentProps<typeof CommandPrimitive.Separator>) {
139
+ return (
140
+ <CommandPrimitive.Separator
141
+ data-slot="command-separator"
142
+ className={cn("-mx-1 h-px bg-border", className)}
143
+ {...props}
144
+ />
145
+ )
146
+ }
147
+
148
+ function CommandItem({
149
+ className,
150
+ children,
151
+ ...props
152
+ }: React.ComponentProps<typeof CommandPrimitive.Item>) {
153
+ return (
154
+ <CommandPrimitive.Item
155
+ data-slot="command-item"
156
+ className={cn(
157
+ "group/command-item 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 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground",
158
+ className
159
+ )}
160
+ {...props}
161
+ >
162
+ {children}
163
+ <CheckIcon className="ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" />
164
+ </CommandPrimitive.Item>
165
+ )
166
+ }
167
+
168
+ function CommandShortcut({
169
+ className,
170
+ ...props
171
+ }: React.ComponentProps<"span">) {
172
+ return (
173
+ <span
174
+ data-slot="command-shortcut"
175
+ className={cn(
176
+ "ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground",
177
+ className
178
+ )}
179
+ {...props}
180
+ />
181
+ )
182
+ }
183
+
184
+ export {
185
+ Command,
186
+ CommandDialog,
187
+ CommandInput,
188
+ CommandList,
189
+ CommandEmpty,
190
+ CommandGroup,
191
+ CommandItem,
192
+ CommandShortcut,
193
+ CommandSeparator,
194
+ }