@terrafirmagreg-team/ui 0.0.0-stage → 1.2.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.
Files changed (225) hide show
  1. package/package.json +93 -3
  2. package/src/components/blocks/button/icon-button.tsx +49 -0
  3. package/src/components/blocks/canvas/chevron-edge.tsx +242 -0
  4. package/src/components/blocks/canvas/flow-canvas.tsx +181 -0
  5. package/src/components/blocks/canvas/flow-toolbar.tsx +33 -0
  6. package/src/components/blocks/canvas/flow-viewport.tsx +244 -0
  7. package/src/components/blocks/fit-box.tsx +26 -0
  8. package/src/components/blocks/git/github-info.tsx +78 -0
  9. package/src/components/blocks/lang/content.tsx +52 -0
  10. package/src/components/blocks/lang/flag.tsx +25 -0
  11. package/src/components/blocks/lang/link.tsx +23 -0
  12. package/src/components/blocks/lang/redirect.tsx +48 -0
  13. package/src/components/blocks/lang/switcher.tsx +54 -0
  14. package/src/components/blocks/lang/untranslated-callout.tsx +29 -0
  15. package/src/components/blocks/lang/untranslated-chip.tsx +53 -0
  16. package/src/components/blocks/link/link-preview.tsx +257 -0
  17. package/src/components/blocks/list/row.tsx +92 -0
  18. package/src/components/blocks/media/glb/model.tsx +244 -0
  19. package/src/components/blocks/media/glb/scene.tsx +373 -0
  20. package/src/components/blocks/media/glb/viewer.tsx +52 -0
  21. package/src/components/blocks/media/image.tsx +136 -0
  22. package/src/components/blocks/media/slideshow.tsx +178 -0
  23. package/src/components/blocks/nav/breadcrumb.tsx +51 -0
  24. package/src/components/blocks/nav/copy-menu.tsx +37 -0
  25. package/src/components/blocks/nav/link.tsx +86 -0
  26. package/src/components/blocks/nav/site-menu.tsx +78 -0
  27. package/src/components/blocks/nav/site-title.tsx +61 -0
  28. package/src/components/blocks/nav/switcher.tsx +206 -0
  29. package/src/components/blocks/page/empty-state.tsx +32 -0
  30. package/src/components/blocks/page/heading.tsx +54 -0
  31. package/src/components/blocks/page/pager.tsx +220 -0
  32. package/src/components/blocks/readability/fields.tsx +250 -0
  33. package/src/components/blocks/readability/menu.tsx +247 -0
  34. package/src/components/blocks/readability/track.tsx +165 -0
  35. package/src/components/blocks/search/command.tsx +80 -0
  36. package/src/components/blocks/search/dialog.tsx +724 -0
  37. package/src/components/blocks/search/provider.tsx +118 -0
  38. package/src/components/blocks/sidebar.tsx +406 -0
  39. package/src/components/blocks/sprite.tsx +231 -0
  40. package/src/components/blocks/text/format-text.tsx +110 -0
  41. package/src/components/blocks/theme/toggle.tsx +75 -0
  42. package/src/components/blocks/tooltip/hint.tsx +28 -0
  43. package/src/components/blocks/tooltip/lazy.tsx +41 -0
  44. package/src/components/blocks/viewer/controls.tsx +284 -0
  45. package/src/components/blocks/viewer/float-bar.tsx +51 -0
  46. package/src/components/layouts/layout.tsx +94 -0
  47. package/src/components/layouts/left-sidebar/content.tsx +63 -0
  48. package/src/components/layouts/left-sidebar/context.tsx +55 -0
  49. package/src/components/layouts/left-sidebar/expand.tsx +23 -0
  50. package/src/components/layouts/left-sidebar/footer.tsx +111 -0
  51. package/src/components/layouts/left-sidebar/index.ts +29 -0
  52. package/src/components/layouts/left-sidebar/items.tsx +103 -0
  53. package/src/components/layouts/left-sidebar/search.tsx +75 -0
  54. package/src/components/layouts/left-sidebar/sidebar.tsx +189 -0
  55. package/src/components/layouts/left-sidebar/tree.tsx +157 -0
  56. package/src/components/layouts/right-sidebar.tsx +96 -0
  57. package/src/components/layouts/tree-context.tsx +42 -0
  58. package/src/components/mdx/accordion.tsx +185 -0
  59. package/src/components/mdx/banner.tsx +157 -0
  60. package/src/components/mdx/callout.tsx +97 -0
  61. package/src/components/mdx/card.tsx +56 -0
  62. package/src/components/mdx/codeblock.tsx +250 -0
  63. package/src/components/mdx/collapsible.tsx +33 -0
  64. package/src/components/mdx/files.tsx +63 -0
  65. package/src/components/mdx/glow-header.tsx +54 -0
  66. package/src/components/mdx/gradient-text.tsx +28 -0
  67. package/src/components/mdx/icon.tsx +35 -0
  68. package/src/components/mdx/image-zoom.tsx +315 -0
  69. package/src/components/mdx/math.tsx +30 -0
  70. package/src/components/mdx/mermaid.tsx +23 -0
  71. package/src/components/mdx/multiblock.tsx +19 -0
  72. package/src/components/mdx/preview.tsx +101 -0
  73. package/src/components/mdx/steps.tsx +10 -0
  74. package/src/components/mdx/table.tsx +14 -0
  75. package/src/components/mdx/tabs.tsx +354 -0
  76. package/src/components/mdx/type-table.tsx +171 -0
  77. package/src/components/provider.tsx +139 -0
  78. package/src/components/ui/accordion.tsx +71 -0
  79. package/src/components/ui/alert-dialog.tsx +187 -0
  80. package/src/components/ui/alert.tsx +75 -0
  81. package/src/components/ui/aspect-ratio.tsx +22 -0
  82. package/src/components/ui/attachment.tsx +207 -0
  83. package/src/components/ui/avatar.tsx +108 -0
  84. package/src/components/ui/badge.tsx +51 -0
  85. package/src/components/ui/breadcrumb.tsx +124 -0
  86. package/src/components/ui/bubble.tsx +127 -0
  87. package/src/components/ui/button-group.tsx +87 -0
  88. package/src/components/ui/button.tsx +57 -0
  89. package/src/components/ui/calendar.tsx +221 -0
  90. package/src/components/ui/card.tsx +102 -0
  91. package/src/components/ui/carousel.tsx +242 -0
  92. package/src/components/ui/chart.tsx +371 -0
  93. package/src/components/ui/checkbox.tsx +28 -0
  94. package/src/components/ui/collapsible.tsx +21 -0
  95. package/src/components/ui/combobox.tsx +297 -0
  96. package/src/components/ui/command.tsx +198 -0
  97. package/src/components/ui/context-menu.tsx +270 -0
  98. package/src/components/ui/dialog.tsx +160 -0
  99. package/src/components/ui/direction.tsx +6 -0
  100. package/src/components/ui/drawer.tsx +227 -0
  101. package/src/components/ui/dropdown-menu.tsx +269 -0
  102. package/src/components/ui/empty.tsx +103 -0
  103. package/src/components/ui/field.tsx +238 -0
  104. package/src/components/ui/hover-card.tsx +50 -0
  105. package/src/components/ui/input-group.tsx +158 -0
  106. package/src/components/ui/input-otp.tsx +86 -0
  107. package/src/components/ui/input.tsx +19 -0
  108. package/src/components/ui/item.tsx +201 -0
  109. package/src/components/ui/kbd.tsx +26 -0
  110. package/src/components/ui/label.tsx +19 -0
  111. package/src/components/ui/marker.tsx +70 -0
  112. package/src/components/ui/menubar.tsx +280 -0
  113. package/src/components/ui/message-scroller.tsx +131 -0
  114. package/src/components/ui/message.tsx +91 -0
  115. package/src/components/ui/native-select.tsx +60 -0
  116. package/src/components/ui/navigation-menu.tsx +167 -0
  117. package/src/components/ui/pagination.tsx +130 -0
  118. package/src/components/ui/popover.tsx +91 -0
  119. package/src/components/ui/progress.tsx +82 -0
  120. package/src/components/ui/questionnaire.tsx +324 -0
  121. package/src/components/ui/radio-group.tsx +37 -0
  122. package/src/components/ui/resizable.tsx +49 -0
  123. package/src/components/ui/scroll-area.tsx +54 -0
  124. package/src/components/ui/select.tsx +200 -0
  125. package/src/components/ui/separator.tsx +24 -0
  126. package/src/components/ui/sheet.tsx +138 -0
  127. package/src/components/ui/sidebar.tsx +730 -0
  128. package/src/components/ui/skeleton.tsx +13 -0
  129. package/src/components/ui/slider.tsx +51 -0
  130. package/src/components/ui/spinner.tsx +10 -0
  131. package/src/components/ui/switch.tsx +31 -0
  132. package/src/components/ui/table.tsx +115 -0
  133. package/src/components/ui/tabs.tsx +81 -0
  134. package/src/components/ui/textarea.tsx +17 -0
  135. package/src/components/ui/toast.tsx +234 -0
  136. package/src/components/ui/toggle-group.tsx +89 -0
  137. package/src/components/ui/toggle.tsx +44 -0
  138. package/src/components/ui/tooltip.tsx +65 -0
  139. package/src/hooks/canvas/use-flow-hover.ts +19 -0
  140. package/src/hooks/canvas/use-flow-viewport-persist.ts +34 -0
  141. package/src/hooks/page/use-fit-pages.ts +92 -0
  142. package/src/hooks/page/use-location-search.ts +31 -0
  143. package/src/hooks/page/use-page-preview.ts +41 -0
  144. package/src/hooks/page/use-paged-list.ts +21 -0
  145. package/src/hooks/readability/use-readability.ts +87 -0
  146. package/src/hooks/search/use-dialog.ts +42 -0
  147. package/src/hooks/search/use-highlight-query.ts +58 -0
  148. package/src/hooks/search/use-provider.ts +26 -0
  149. package/src/hooks/use-async-value.ts +60 -0
  150. package/src/hooks/use-close-on-scroll.ts +24 -0
  151. package/src/hooks/use-copy-button.ts +47 -0
  152. package/src/hooks/use-cycle-index.ts +76 -0
  153. package/src/hooks/use-document-title.ts +10 -0
  154. package/src/hooks/use-element-size.ts +36 -0
  155. package/src/hooks/use-external-meta.ts +133 -0
  156. package/src/hooks/use-hot-key.ts +34 -0
  157. package/src/hooks/use-hover-follow.ts +55 -0
  158. package/src/hooks/use-in-view.ts +31 -0
  159. package/src/hooks/use-lang.ts +9 -0
  160. package/src/hooks/use-last-value.ts +16 -0
  161. package/src/hooks/use-layout.ts +19 -0
  162. package/src/hooks/use-marquee.ts +52 -0
  163. package/src/hooks/use-media-query.ts +15 -0
  164. package/src/hooks/use-mobile.ts +20 -0
  165. package/src/hooks/use-modifier-keys.ts +32 -0
  166. package/src/hooks/use-on-change.ts +36 -0
  167. package/src/hooks/use-pane-keys.ts +29 -0
  168. package/src/hooks/use-sidebar.ts +64 -0
  169. package/src/hooks/use-swipe.ts +27 -0
  170. package/src/hooks/use-tree.ts +100 -0
  171. package/src/hooks/viewer/use-in-float-bar.ts +7 -0
  172. package/src/hooks/viewer/use-viewer-prefs.ts +78 -0
  173. package/src/lib/canvas/edge.ts +202 -0
  174. package/src/lib/canvas/geometry.ts +54 -0
  175. package/src/lib/canvas/state.ts +48 -0
  176. package/src/lib/canvas/viewport.ts +38 -0
  177. package/src/lib/canvas/xyflow.ts +2 -0
  178. package/src/lib/config.ts +106 -0
  179. package/src/lib/mdx/callout.ts +21 -0
  180. package/src/lib/mdx/gradient.ts +16 -0
  181. package/src/lib/mdx/mermaid.ts +15 -0
  182. package/src/lib/media/crop-opaque.ts +77 -0
  183. package/src/lib/media/nearby-indexes.ts +7 -0
  184. package/src/lib/media/trim-transparent.ts +118 -0
  185. package/src/lib/readability/config.ts +11 -0
  186. package/src/lib/readability/spotlight.ts +187 -0
  187. package/src/lib/readability/store.ts +147 -0
  188. package/src/lib/tree.ts +90 -0
  189. package/src/lib/utils/cn.ts +2 -0
  190. package/src/lib/utils/format.ts +22 -0
  191. package/src/lib/utils/highlight-style.ts +10 -0
  192. package/src/lib/utils/history.ts +10 -0
  193. package/src/lib/utils/merge-refs.ts +14 -0
  194. package/src/lib/utils/nav-active.ts +59 -0
  195. package/src/lib/utils/stored-value.ts +137 -0
  196. package/src/lib/utils/urls.ts +18 -0
  197. package/src/locales/en_us.json +110 -0
  198. package/src/locales/pl_pl.json +33 -0
  199. package/src/locales/ru_ru.json +110 -0
  200. package/src/locales/uk_ua.json +33 -0
  201. package/src/locales/zh_cn.json +15 -0
  202. package/src/locales/zh_tw.json +15 -0
  203. package/src/locales.ts +6 -0
  204. package/src/types/canvas.ts +54 -0
  205. package/src/types/glb.ts +26 -0
  206. package/src/types/mdx-directives.ts +106 -0
  207. package/src/types/nav.ts +96 -0
  208. package/src/types/preview.ts +15 -0
  209. package/src/types/readability.ts +29 -0
  210. package/src/types/search.ts +57 -0
  211. package/src/types/tree.ts +19 -0
  212. package/src/types/viewer.ts +54 -0
  213. package/styles/content/base.css +198 -0
  214. package/styles/content/default-colors.css +51 -0
  215. package/styles/content/shiki.css +107 -0
  216. package/styles/content/typography.mjs +3637 -0
  217. package/styles/content.css +5 -0
  218. package/styles/image-zoom.css +83 -0
  219. package/styles/layout.css +28 -0
  220. package/styles/left-sidebar.css +140 -0
  221. package/styles/readability.css +50 -0
  222. package/styles/right-sidebar.css +6 -0
  223. package/styles/workspace.css +26 -0
  224. package/styles.css +430 -0
  225. package/README.md +0 -3
@@ -0,0 +1,280 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { Menu as MenuPrimitive } from "@base-ui/react/menu"
5
+ import { Menubar as MenubarPrimitive } from "@base-ui/react/menubar"
6
+ import { cn } from "cn"
7
+
8
+ import {
9
+ DropdownMenu,
10
+ DropdownMenuContent,
11
+ DropdownMenuGroup,
12
+ DropdownMenuItem,
13
+ DropdownMenuLabel,
14
+ DropdownMenuPortal,
15
+ DropdownMenuRadioGroup,
16
+ DropdownMenuSeparator,
17
+ DropdownMenuShortcut,
18
+ DropdownMenuSub,
19
+ DropdownMenuSubContent,
20
+ DropdownMenuSubTrigger,
21
+ DropdownMenuTrigger,
22
+ } from "./dropdown-menu"
23
+ import { CheckIcon } from "lucide-react"
24
+
25
+ function Menubar({ className, ...props }: MenubarPrimitive.Props) {
26
+ return (
27
+ <MenubarPrimitive
28
+ data-slot="menubar"
29
+ className={cn(
30
+ "flex h-8 items-center gap-0.5 rounded-lg border p-[3px]",
31
+ className
32
+ )}
33
+ {...props}
34
+ />
35
+ )
36
+ }
37
+
38
+ function MenubarMenu({ ...props }: React.ComponentProps<typeof DropdownMenu>) {
39
+ return <DropdownMenu data-slot="menubar-menu" {...props} />
40
+ }
41
+
42
+ function MenubarGroup({
43
+ ...props
44
+ }: React.ComponentProps<typeof DropdownMenuGroup>) {
45
+ return <DropdownMenuGroup data-slot="menubar-group" {...props} />
46
+ }
47
+
48
+ function MenubarPortal({
49
+ ...props
50
+ }: React.ComponentProps<typeof DropdownMenuPortal>) {
51
+ return <DropdownMenuPortal data-slot="menubar-portal" {...props} />
52
+ }
53
+
54
+ function MenubarTrigger({
55
+ className,
56
+ ...props
57
+ }: React.ComponentProps<typeof DropdownMenuTrigger>) {
58
+ return (
59
+ <DropdownMenuTrigger
60
+ data-slot="menubar-trigger"
61
+ className={cn(
62
+ "flex items-center rounded-sm px-1.5 py-[2px] text-sm font-medium outline-hidden select-none hover:bg-muted aria-expanded:bg-muted",
63
+ className
64
+ )}
65
+ {...props}
66
+ />
67
+ )
68
+ }
69
+
70
+ function MenubarContent({
71
+ className,
72
+ align = "start",
73
+ alignOffset = -4,
74
+ sideOffset = 8,
75
+ ...props
76
+ }: React.ComponentProps<typeof DropdownMenuContent>) {
77
+ return (
78
+ <DropdownMenuContent
79
+ data-slot="menubar-content"
80
+ align={align}
81
+ alignOffset={alignOffset}
82
+ sideOffset={sideOffset}
83
+ className={cn("min-w-36 rounded-lg 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", className )}
84
+ {...props}
85
+ />
86
+ )
87
+ }
88
+
89
+ function MenubarItem({
90
+ className,
91
+ inset,
92
+ variant = "default",
93
+ ...props
94
+ }: React.ComponentProps<typeof DropdownMenuItem>) {
95
+ return (
96
+ <DropdownMenuItem
97
+ data-slot="menubar-item"
98
+ data-inset={inset}
99
+ data-variant={variant}
100
+ className={cn(
101
+ "group/menubar-item gap-1.5 rounded-md px-1.5 py-1 text-sm focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 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!",
102
+ className
103
+ )}
104
+ {...props}
105
+ />
106
+ )
107
+ }
108
+
109
+ function MenubarCheckboxItem({
110
+ className,
111
+ children,
112
+ checked,
113
+ inset,
114
+ ...props
115
+ }: MenuPrimitive.CheckboxItem.Props & {
116
+ inset?: boolean
117
+ }) {
118
+ return (
119
+ <MenuPrimitive.CheckboxItem
120
+ data-slot="menubar-checkbox-item"
121
+ data-inset={inset}
122
+ className={cn(
123
+ "relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-1.5 pl-7 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
124
+ className
125
+ )}
126
+ checked={checked}
127
+ {...props}
128
+ >
129
+ <span className="pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
130
+ <MenuPrimitive.CheckboxItemIndicator>
131
+ <CheckIcon
132
+ />
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-1.5 rounded-md py-1 pr-1.5 pl-7 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 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-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
165
+ <MenuPrimitive.RadioItemIndicator>
166
+ <CheckIcon
167
+ />
168
+ </MenuPrimitive.RadioItemIndicator>
169
+ </span>
170
+ {children}
171
+ </MenuPrimitive.RadioItem>
172
+ )
173
+ }
174
+
175
+ function MenubarLabel({
176
+ className,
177
+ inset,
178
+ ...props
179
+ }: React.ComponentProps<typeof DropdownMenuLabel> & {
180
+ inset?: boolean
181
+ }) {
182
+ return (
183
+ <DropdownMenuLabel
184
+ data-slot="menubar-label"
185
+ data-inset={inset}
186
+ className={cn(
187
+ "px-1.5 py-1 text-sm font-medium data-inset:pl-7",
188
+ className
189
+ )}
190
+ {...props}
191
+ />
192
+ )
193
+ }
194
+
195
+ function MenubarSeparator({
196
+ className,
197
+ ...props
198
+ }: React.ComponentProps<typeof DropdownMenuSeparator>) {
199
+ return (
200
+ <DropdownMenuSeparator
201
+ data-slot="menubar-separator"
202
+ className={cn("-mx-1 my-1 h-px bg-border", className)}
203
+ {...props}
204
+ />
205
+ )
206
+ }
207
+
208
+ function MenubarShortcut({
209
+ className,
210
+ ...props
211
+ }: React.ComponentProps<typeof DropdownMenuShortcut>) {
212
+ return (
213
+ <DropdownMenuShortcut
214
+ data-slot="menubar-shortcut"
215
+ className={cn(
216
+ "ml-auto text-xs tracking-widest text-muted-foreground group-focus/menubar-item:text-accent-foreground",
217
+ className
218
+ )}
219
+ {...props}
220
+ />
221
+ )
222
+ }
223
+
224
+ function MenubarSub({
225
+ ...props
226
+ }: React.ComponentProps<typeof DropdownMenuSub>) {
227
+ return <DropdownMenuSub data-slot="menubar-sub" {...props} />
228
+ }
229
+
230
+ function MenubarSubTrigger({
231
+ className,
232
+ inset,
233
+ ...props
234
+ }: React.ComponentProps<typeof DropdownMenuSubTrigger> & {
235
+ inset?: boolean
236
+ }) {
237
+ return (
238
+ <DropdownMenuSubTrigger
239
+ data-slot="menubar-sub-trigger"
240
+ data-inset={inset}
241
+ className={cn(
242
+ "gap-1.5 rounded-md px-1.5 py-1 text-sm focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg:not([class*='size-'])]:size-4",
243
+ className
244
+ )}
245
+ {...props}
246
+ />
247
+ )
248
+ }
249
+
250
+ function MenubarSubContent({
251
+ className,
252
+ ...props
253
+ }: React.ComponentProps<typeof DropdownMenuSubContent>) {
254
+ return (
255
+ <DropdownMenuSubContent
256
+ data-slot="menubar-sub-content"
257
+ className={cn("min-w-32 rounded-lg 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", className )}
258
+ {...props}
259
+ />
260
+ )
261
+ }
262
+
263
+ export {
264
+ Menubar,
265
+ MenubarPortal,
266
+ MenubarMenu,
267
+ MenubarTrigger,
268
+ MenubarContent,
269
+ MenubarGroup,
270
+ MenubarSeparator,
271
+ MenubarLabel,
272
+ MenubarItem,
273
+ MenubarShortcut,
274
+ MenubarCheckboxItem,
275
+ MenubarRadioGroup,
276
+ MenubarRadioItem,
277
+ MenubarSub,
278
+ MenubarSubTrigger,
279
+ MenubarSubContent,
280
+ }
@@ -0,0 +1,131 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import {
5
+ MessageScroller as MessageScrollerPrimitive,
6
+ useMessageScroller,
7
+ useMessageScrollerScrollable,
8
+ useMessageScrollerVisibility,
9
+ } from "@shadcn/react/message-scroller"
10
+ import { cn } from "cn"
11
+
12
+ import { Button } from "./button"
13
+ import { ArrowDownIcon } from "lucide-react"
14
+
15
+ function MessageScrollerProvider(
16
+ props: React.ComponentProps<typeof MessageScrollerPrimitive.Provider>
17
+ ) {
18
+ return <MessageScrollerPrimitive.Provider {...props} />
19
+ }
20
+
21
+ function MessageScroller({
22
+ className,
23
+ ...props
24
+ }: React.ComponentProps<typeof MessageScrollerPrimitive.Root>) {
25
+ return (
26
+ <MessageScrollerPrimitive.Root
27
+ data-slot="message-scroller"
28
+ className={cn(
29
+ "group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden",
30
+ className
31
+ )}
32
+ {...props}
33
+ />
34
+ )
35
+ }
36
+
37
+ function MessageScrollerViewport({
38
+ className,
39
+ ...props
40
+ }: React.ComponentProps<typeof MessageScrollerPrimitive.Viewport>) {
41
+ return (
42
+ <MessageScrollerPrimitive.Viewport
43
+ data-slot="message-scroller-viewport"
44
+ className={cn(
45
+ "size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent data-pending-scroll:invisible",
46
+ className
47
+ )}
48
+ {...props}
49
+ />
50
+ )
51
+ }
52
+
53
+ function MessageScrollerContent({
54
+ className,
55
+ ...props
56
+ }: React.ComponentProps<typeof MessageScrollerPrimitive.Content>) {
57
+ return (
58
+ <MessageScrollerPrimitive.Content
59
+ data-slot="message-scroller-content"
60
+ className={cn("flex h-max min-h-full flex-col gap-6", className)}
61
+ {...props}
62
+ />
63
+ )
64
+ }
65
+
66
+ function MessageScrollerItem({
67
+ className,
68
+ scrollAnchor = false,
69
+ ...props
70
+ }: React.ComponentProps<typeof MessageScrollerPrimitive.Item>) {
71
+ return (
72
+ <MessageScrollerPrimitive.Item
73
+ data-slot="message-scroller-item"
74
+ scrollAnchor={scrollAnchor}
75
+ className={cn(
76
+ "min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]",
77
+ className
78
+ )}
79
+ {...props}
80
+ />
81
+ )
82
+ }
83
+
84
+ function MessageScrollerButton({
85
+ direction = "end",
86
+ className,
87
+ children,
88
+ render,
89
+ variant = "secondary",
90
+ size = "icon-sm",
91
+ ...props
92
+ }: React.ComponentProps<typeof MessageScrollerPrimitive.Button> &
93
+ Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
94
+ return (
95
+ <MessageScrollerPrimitive.Button
96
+ data-slot="message-scroller-button"
97
+ data-direction={direction}
98
+ data-variant={variant}
99
+ data-size={size}
100
+ direction={direction}
101
+ className={cn(
102
+ "absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180",
103
+ className
104
+ )}
105
+ render={render ?? <Button variant={variant} size={size} />}
106
+ {...props}
107
+ >
108
+ {children ?? (
109
+ <>
110
+ <ArrowDownIcon
111
+ />
112
+ <span className="sr-only">
113
+ {direction === "end" ? "Scroll to end" : "Scroll to start"}
114
+ </span>
115
+ </>
116
+ )}
117
+ </MessageScrollerPrimitive.Button>
118
+ )
119
+ }
120
+
121
+ export {
122
+ MessageScrollerProvider,
123
+ MessageScroller,
124
+ MessageScrollerViewport,
125
+ MessageScrollerContent,
126
+ MessageScrollerItem,
127
+ MessageScrollerButton,
128
+ useMessageScroller,
129
+ useMessageScrollerScrollable,
130
+ useMessageScrollerVisibility,
131
+ }
@@ -0,0 +1,91 @@
1
+ import * as React from "react"
2
+ import { cn } from "cn"
3
+
4
+ function MessageGroup({ className, ...props }: React.ComponentProps<"div">) {
5
+ return (
6
+ <div
7
+ data-slot="message-group"
8
+ className={cn("flex min-w-0 flex-col gap-2", className)}
9
+ {...props}
10
+ />
11
+ )
12
+ }
13
+
14
+ function Message({
15
+ className,
16
+ align = "start",
17
+ ...props
18
+ }: React.ComponentProps<"div"> & { align?: "start" | "end" }) {
19
+ return (
20
+ <div
21
+ data-slot="message"
22
+ data-align={align}
23
+ className={cn(
24
+ "group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse",
25
+ className
26
+ )}
27
+ {...props}
28
+ />
29
+ )
30
+ }
31
+
32
+ function MessageAvatar({ className, ...props }: React.ComponentProps<"div">) {
33
+ return (
34
+ <div
35
+ data-slot="message-avatar"
36
+ className={cn(
37
+ "flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-data-[slot=message-footer]/message:-translate-y-8",
38
+ className
39
+ )}
40
+ {...props}
41
+ />
42
+ )
43
+ }
44
+
45
+ function MessageContent({ className, ...props }: React.ComponentProps<"div">) {
46
+ return (
47
+ <div
48
+ data-slot="message-content"
49
+ className={cn(
50
+ "flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end",
51
+ className
52
+ )}
53
+ {...props}
54
+ />
55
+ )
56
+ }
57
+
58
+ function MessageHeader({ className, ...props }: React.ComponentProps<"div">) {
59
+ return (
60
+ <div
61
+ data-slot="message-header"
62
+ className={cn(
63
+ "flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0",
64
+ className
65
+ )}
66
+ {...props}
67
+ />
68
+ )
69
+ }
70
+
71
+ function MessageFooter({ className, ...props }: React.ComponentProps<"div">) {
72
+ return (
73
+ <div
74
+ data-slot="message-footer"
75
+ className={cn(
76
+ "flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end",
77
+ className
78
+ )}
79
+ {...props}
80
+ />
81
+ )
82
+ }
83
+
84
+ export {
85
+ MessageGroup,
86
+ Message,
87
+ MessageAvatar,
88
+ MessageContent,
89
+ MessageFooter,
90
+ MessageHeader,
91
+ }
@@ -0,0 +1,60 @@
1
+ import * as React from "react"
2
+ import { cn } from "cn"
3
+ import { ChevronDownIcon } from "lucide-react"
4
+
5
+ type NativeSelectProps = Omit<React.ComponentProps<"select">, "size"> & {
6
+ size?: "sm" | "default"
7
+ }
8
+
9
+ function NativeSelect({
10
+ className,
11
+ size = "default",
12
+ ...props
13
+ }: NativeSelectProps) {
14
+ return (
15
+ <div
16
+ className={cn(
17
+ "group/native-select relative w-fit has-[select:disabled]:opacity-50",
18
+ className
19
+ )}
20
+ data-slot="native-select-wrapper"
21
+ data-size={size}
22
+ >
23
+ <select
24
+ data-slot="native-select"
25
+ data-size={size}
26
+ className="h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors 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-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40"
27
+ {...props}
28
+ />
29
+ <ChevronDownIcon className="pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none" aria-hidden="true" data-slot="native-select-icon" />
30
+ </div>
31
+ )
32
+ }
33
+
34
+ function NativeSelectOption({
35
+ className,
36
+ ...props
37
+ }: React.ComponentProps<"option">) {
38
+ return (
39
+ <option
40
+ data-slot="native-select-option"
41
+ className={cn("bg-[Canvas] text-[CanvasText]", className)}
42
+ {...props}
43
+ />
44
+ )
45
+ }
46
+
47
+ function NativeSelectOptGroup({
48
+ className,
49
+ ...props
50
+ }: React.ComponentProps<"optgroup">) {
51
+ return (
52
+ <optgroup
53
+ data-slot="native-select-optgroup"
54
+ className={cn("bg-[Canvas] text-[CanvasText]", className)}
55
+ {...props}
56
+ />
57
+ )
58
+ }
59
+
60
+ export { NativeSelect, NativeSelectOptGroup, NativeSelectOption }