arcway 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.
Files changed (274) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +711 -0
  3. package/client/env.js +55 -0
  4. package/client/fetcher.js +50 -0
  5. package/client/graphql.js +35 -0
  6. package/client/head.js +140 -0
  7. package/client/hooks/use-api.js +80 -0
  8. package/client/hooks/use-debounce.js +12 -0
  9. package/client/hooks/use-form.js +86 -0
  10. package/client/hooks/use-graphql.js +30 -0
  11. package/client/hooks/use-interval.js +12 -0
  12. package/client/hooks/use-mutation.js +27 -0
  13. package/client/hooks/use-query.js +45 -0
  14. package/client/hooks/web/use-click-outside.js +22 -0
  15. package/client/hooks/web/use-local-storage.js +42 -0
  16. package/client/index.js +62 -0
  17. package/client/page-loader.js +155 -0
  18. package/client/provider.js +53 -0
  19. package/client/query.js +13 -0
  20. package/client/router.jsx +303 -0
  21. package/client/ui/accordion.jsx +65 -0
  22. package/client/ui/accordion.stories.jsx +48 -0
  23. package/client/ui/alert-dialog.jsx +122 -0
  24. package/client/ui/alert-dialog.stories.jsx +44 -0
  25. package/client/ui/alert.jsx +52 -0
  26. package/client/ui/alert.stories.jsx +31 -0
  27. package/client/ui/app-shell.jsx +39 -0
  28. package/client/ui/app-shell.stories.jsx +51 -0
  29. package/client/ui/aspect-ratio.jsx +6 -0
  30. package/client/ui/aspect-ratio.stories.jsx +69 -0
  31. package/client/ui/avatar.jsx +78 -0
  32. package/client/ui/avatar.stories.jsx +62 -0
  33. package/client/ui/badge.jsx +34 -0
  34. package/client/ui/badge.stories.js +32 -0
  35. package/client/ui/breadcrumb.jsx +86 -0
  36. package/client/ui/breadcrumb.stories.jsx +43 -0
  37. package/client/ui/button-group.jsx +58 -0
  38. package/client/ui/button-group.stories.jsx +67 -0
  39. package/client/ui/button.jsx +46 -0
  40. package/client/ui/button.stories.js +72 -0
  41. package/client/ui/calendar.jsx +172 -0
  42. package/client/ui/card.jsx +57 -0
  43. package/client/ui/card.stories.jsx +33 -0
  44. package/client/ui/carousel.jsx +167 -0
  45. package/client/ui/chart.jsx +244 -0
  46. package/client/ui/checkbox.jsx +24 -0
  47. package/client/ui/checkbox.stories.js +33 -0
  48. package/client/ui/collapsible.jsx +12 -0
  49. package/client/ui/collapsible.stories.jsx +42 -0
  50. package/client/ui/combobox.jsx +223 -0
  51. package/client/ui/command.jsx +128 -0
  52. package/client/ui/context-menu.jsx +170 -0
  53. package/client/ui/context-menu.stories.jsx +35 -0
  54. package/client/ui/dialog.jsx +109 -0
  55. package/client/ui/dialog.stories.jsx +37 -0
  56. package/client/ui/direction.jsx +9 -0
  57. package/client/ui/drawer.jsx +87 -0
  58. package/client/ui/dropdown-menu.jsx +172 -0
  59. package/client/ui/dropdown-menu.stories.jsx +34 -0
  60. package/client/ui/empty.jsx +76 -0
  61. package/client/ui/empty.stories.jsx +64 -0
  62. package/client/ui/field.jsx +174 -0
  63. package/client/ui/field.stories.jsx +118 -0
  64. package/client/ui/form.jsx +17 -0
  65. package/client/ui/hooks/use-mobile.js +16 -0
  66. package/client/ui/hover-card.jsx +26 -0
  67. package/client/ui/hover-card.stories.jsx +28 -0
  68. package/client/ui/index.js +649 -0
  69. package/client/ui/input-group.jsx +116 -0
  70. package/client/ui/input-group.stories.jsx +65 -0
  71. package/client/ui/input-otp.jsx +62 -0
  72. package/client/ui/input.jsx +16 -0
  73. package/client/ui/input.stories.js +27 -0
  74. package/client/ui/item.jsx +155 -0
  75. package/client/ui/item.stories.jsx +118 -0
  76. package/client/ui/kbd.jsx +24 -0
  77. package/client/ui/kbd.stories.jsx +32 -0
  78. package/client/ui/label.jsx +16 -0
  79. package/client/ui/label.stories.js +25 -0
  80. package/client/ui/lib/utils.js +6 -0
  81. package/client/ui/main-content.jsx +30 -0
  82. package/client/ui/menubar.jsx +189 -0
  83. package/client/ui/menubar.stories.jsx +43 -0
  84. package/client/ui/native-select.jsx +34 -0
  85. package/client/ui/native-select.stories.jsx +67 -0
  86. package/client/ui/navigation-menu.jsx +120 -0
  87. package/client/ui/navigation-menu.stories.jsx +45 -0
  88. package/client/ui/pagination.jsx +92 -0
  89. package/client/ui/pagination.stories.jsx +52 -0
  90. package/client/ui/panel.jsx +66 -0
  91. package/client/ui/popover.jsx +54 -0
  92. package/client/ui/popover.stories.jsx +27 -0
  93. package/client/ui/progress.jsx +19 -0
  94. package/client/ui/progress.stories.js +34 -0
  95. package/client/ui/radio-group.jsx +33 -0
  96. package/client/ui/radio-group.stories.jsx +49 -0
  97. package/client/ui/resizable.jsx +33 -0
  98. package/client/ui/scroll-area.jsx +41 -0
  99. package/client/ui/scroll-area.stories.jsx +43 -0
  100. package/client/ui/select.jsx +145 -0
  101. package/client/ui/select.stories.jsx +80 -0
  102. package/client/ui/separator.jsx +18 -0
  103. package/client/ui/separator.stories.jsx +37 -0
  104. package/client/ui/sheet.jsx +95 -0
  105. package/client/ui/sheet.stories.jsx +56 -0
  106. package/client/ui/sidebar.jsx +544 -0
  107. package/client/ui/skeleton.jsx +8 -0
  108. package/client/ui/skeleton.stories.js +23 -0
  109. package/client/ui/slider.jsx +41 -0
  110. package/client/ui/slider.stories.js +31 -0
  111. package/client/ui/sonner.jsx +37 -0
  112. package/client/ui/spinner.jsx +14 -0
  113. package/client/ui/spinner.stories.js +16 -0
  114. package/client/ui/style-mira.css +1316 -0
  115. package/client/ui/switch.jsx +22 -0
  116. package/client/ui/switch.stories.js +44 -0
  117. package/client/ui/table.jsx +33 -0
  118. package/client/ui/table.stories.jsx +42 -0
  119. package/client/ui/tabs.jsx +63 -0
  120. package/client/ui/tabs.stories.jsx +45 -0
  121. package/client/ui/textarea.jsx +15 -0
  122. package/client/ui/textarea.stories.js +33 -0
  123. package/client/ui/theme.css +459 -0
  124. package/client/ui/toggle-group.jsx +62 -0
  125. package/client/ui/toggle-group.stories.jsx +68 -0
  126. package/client/ui/toggle.jsx +34 -0
  127. package/client/ui/toggle.stories.js +46 -0
  128. package/client/ui/tooltip.jsx +37 -0
  129. package/client/ui/tooltip.stories.jsx +32 -0
  130. package/client/ui/use-transition.js +35 -0
  131. package/client/ws.js +132 -0
  132. package/package.json +134 -0
  133. package/server/bin/cli.js +42 -0
  134. package/server/bin/commands/build.js +23 -0
  135. package/server/bin/commands/dev.js +57 -0
  136. package/server/bin/commands/docs.js +30 -0
  137. package/server/bin/commands/graphql-schema.js +32 -0
  138. package/server/bin/commands/lint.js +35 -0
  139. package/server/bin/commands/mcp.js +26 -0
  140. package/server/bin/commands/migrate.js +82 -0
  141. package/server/bin/commands/schema.js +41 -0
  142. package/server/bin/commands/seed.js +36 -0
  143. package/server/bin/commands/start.js +31 -0
  144. package/server/bin/commands/test.js +20 -0
  145. package/server/bin/solo.js +4 -0
  146. package/server/boot/index.js +150 -0
  147. package/server/boot.js +2 -0
  148. package/server/build.js +23 -0
  149. package/server/cache/drivers/memory.js +23 -0
  150. package/server/cache/drivers/redis.js +28 -0
  151. package/server/cache/index.js +69 -0
  152. package/server/config/loader.js +89 -0
  153. package/server/config/modules/api.js +17 -0
  154. package/server/config/modules/build.js +9 -0
  155. package/server/config/modules/cache.js +10 -0
  156. package/server/config/modules/database.js +29 -0
  157. package/server/config/modules/events.js +15 -0
  158. package/server/config/modules/files.js +15 -0
  159. package/server/config/modules/jobs.js +20 -0
  160. package/server/config/modules/logger.js +9 -0
  161. package/server/config/modules/mail.js +11 -0
  162. package/server/config/modules/mcp.js +9 -0
  163. package/server/config/modules/pages.js +20 -0
  164. package/server/config/modules/queue.js +10 -0
  165. package/server/config/modules/redis.js +9 -0
  166. package/server/config/modules/server.js +30 -0
  167. package/server/config/modules/session.js +9 -0
  168. package/server/config/modules/websocket.js +11 -0
  169. package/server/constants.js +67 -0
  170. package/server/context.js +15 -0
  171. package/server/db/index.js +87 -0
  172. package/server/db/schema/drivers/mysql.js +28 -0
  173. package/server/db/schema/drivers/pg.js +34 -0
  174. package/server/db/schema/drivers/sqlite.js +22 -0
  175. package/server/db/schema/index.js +78 -0
  176. package/server/db/seeds.js +22 -0
  177. package/server/discovery.js +67 -0
  178. package/server/docs/openapi.js +153 -0
  179. package/server/env.js +17 -0
  180. package/server/events/drivers/memory.js +45 -0
  181. package/server/events/drivers/redis.js +64 -0
  182. package/server/events/handler.js +67 -0
  183. package/server/events/index.js +35 -0
  184. package/server/events/pattern.js +5 -0
  185. package/server/files/drivers/local.js +83 -0
  186. package/server/files/drivers/s3.js +113 -0
  187. package/server/files/index.js +57 -0
  188. package/server/filewatcher/index.js +156 -0
  189. package/server/glob.js +6 -0
  190. package/server/graphql/discovery.js +70 -0
  191. package/server/graphql/handler.js +41 -0
  192. package/server/graphql/index.js +13 -0
  193. package/server/graphql/loaders.js +19 -0
  194. package/server/graphql/merge.js +48 -0
  195. package/server/graphql/subscriptions.js +43 -0
  196. package/server/health.js +34 -0
  197. package/server/helpers.js +9 -0
  198. package/server/index.js +55 -0
  199. package/server/internals.js +139 -0
  200. package/server/jobs/cron.js +10 -0
  201. package/server/jobs/drivers/knex-queue.js +207 -0
  202. package/server/jobs/drivers/lease.js +148 -0
  203. package/server/jobs/drivers/memory-queue.js +134 -0
  204. package/server/jobs/queue.js +27 -0
  205. package/server/jobs/runner.js +197 -0
  206. package/server/jobs/throughput.js +63 -0
  207. package/server/lib/vault/encrypt.js +40 -0
  208. package/server/lib/vault/ids.js +9 -0
  209. package/server/lib/vault/index.js +14 -0
  210. package/server/lib/vault/jwt.js +55 -0
  211. package/server/lib/vault/password.js +10 -0
  212. package/server/lint/boundaries.js +77 -0
  213. package/server/logger/index.js +130 -0
  214. package/server/mail/drivers/console.js +31 -0
  215. package/server/mail/drivers/smtp.js +34 -0
  216. package/server/mail/imap.js +105 -0
  217. package/server/mail/inbound-store.js +58 -0
  218. package/server/mail/inbound.js +79 -0
  219. package/server/mail/index.js +112 -0
  220. package/server/mcp/debug-api.js +137 -0
  221. package/server/mcp/helpers.js +30 -0
  222. package/server/mcp/index.js +77 -0
  223. package/server/mcp/runtime.js +7 -0
  224. package/server/mcp/server.js +19 -0
  225. package/server/mcp/tools/debugging.js +133 -0
  226. package/server/mcp/tools/introspection.js +87 -0
  227. package/server/middlewares/cors.js +30 -0
  228. package/server/middlewares/index.js +3 -0
  229. package/server/middlewares/require-session.js +15 -0
  230. package/server/module-loader.js +9 -0
  231. package/server/pages/build-client.js +187 -0
  232. package/server/pages/build-css.js +47 -0
  233. package/server/pages/build-manifest.js +55 -0
  234. package/server/pages/build-plugins.js +75 -0
  235. package/server/pages/build-server.js +115 -0
  236. package/server/pages/build.js +116 -0
  237. package/server/pages/discovery.js +120 -0
  238. package/server/pages/fonts.js +128 -0
  239. package/server/pages/handler.js +276 -0
  240. package/server/pages/hmr.js +176 -0
  241. package/server/pages/pages-router.js +78 -0
  242. package/server/pages/ssr.js +276 -0
  243. package/server/pages/static.js +92 -0
  244. package/server/pages/watcher.js +90 -0
  245. package/server/queue/drivers/knex.js +67 -0
  246. package/server/queue/drivers/redis.js +91 -0
  247. package/server/queue/index.js +61 -0
  248. package/server/rate-limit/consume.js +21 -0
  249. package/server/rate-limit/drivers/memory.js +24 -0
  250. package/server/rate-limit/drivers/redis.js +32 -0
  251. package/server/rate-limit/index.js +33 -0
  252. package/server/redis/index.js +67 -0
  253. package/server/ring-buffer.js +44 -0
  254. package/server/route.js +4 -0
  255. package/server/router/api-router.js +317 -0
  256. package/server/router/cors.js +31 -0
  257. package/server/router/middleware.js +91 -0
  258. package/server/router/routes.js +132 -0
  259. package/server/server.js +35 -0
  260. package/server/session/helpers.js +21 -0
  261. package/server/session/index.js +89 -0
  262. package/server/static/index.js +36 -0
  263. package/server/system-jobs/index.js +50 -0
  264. package/server/system-routes/index.js +84 -0
  265. package/server/testing/index.js +263 -0
  266. package/server/validation.js +41 -0
  267. package/server/watcher.js +34 -0
  268. package/server/web-server.js +231 -0
  269. package/server/ws/discovery.js +54 -0
  270. package/server/ws/index.js +14 -0
  271. package/server/ws/realtime.js +318 -0
  272. package/server/ws/registry.js +17 -0
  273. package/server/ws/server.js +152 -0
  274. package/server/ws/ws-router.js +335 -0
@@ -0,0 +1,223 @@
1
+ import * as React from 'react';
2
+ import { Combobox as ComboboxPrimitive } from '@base-ui/react';
3
+ import { cn } from './lib/utils.js';
4
+ import { Button } from './button.jsx';
5
+ import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from './input-group.jsx';
6
+ import { CheckIcon, ChevronDownIcon, XIcon } from 'lucide-react';
7
+ const Combobox = ComboboxPrimitive.Root;
8
+ function ComboboxValue({ ...props }) {
9
+ return <ComboboxPrimitive.Value data-slot="combobox-value" {...props} />;
10
+ }
11
+ function ComboboxTrigger({ className, children, ...props }) {
12
+ return (
13
+ <ComboboxPrimitive.Trigger
14
+ data-slot="combobox-trigger"
15
+ className={cn('cn-combobox-trigger', className)}
16
+ {...props}
17
+ >
18
+ {children}
19
+ <ChevronDownIcon className="cn-combobox-trigger-icon pointer-events-none" />
20
+ </ComboboxPrimitive.Trigger>
21
+ );
22
+ }
23
+ function ComboboxClear({ className, ...props }) {
24
+ return (
25
+ <ComboboxPrimitive.Clear
26
+ data-slot="combobox-clear"
27
+ render={<InputGroupButton variant="ghost" size="icon-xs" />}
28
+ className={cn('cn-combobox-clear', className)}
29
+ {...props}
30
+ >
31
+ <XIcon className="cn-combobox-clear-icon pointer-events-none" />
32
+ </ComboboxPrimitive.Clear>
33
+ );
34
+ }
35
+ function ComboboxInput({
36
+ className,
37
+ children,
38
+ disabled = false,
39
+ showTrigger = true,
40
+ showClear = false,
41
+ ...props
42
+ }) {
43
+ return (
44
+ <InputGroup className={cn('cn-combobox-input w-auto', className)}>
45
+ <ComboboxPrimitive.Input render={<InputGroupInput disabled={disabled} />} {...props} />
46
+ <InputGroupAddon align="inline-end">
47
+ {showTrigger && (
48
+ <InputGroupButton
49
+ size="icon-xs"
50
+ variant="ghost"
51
+ asChild
52
+ data-slot="input-group-button"
53
+ className="group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent"
54
+ disabled={disabled}
55
+ >
56
+ <ComboboxTrigger />
57
+ </InputGroupButton>
58
+ )}
59
+ {showClear && <ComboboxClear disabled={disabled} />}
60
+ </InputGroupAddon>
61
+ {children}
62
+ </InputGroup>
63
+ );
64
+ }
65
+ function ComboboxContent({
66
+ className,
67
+ side = 'bottom',
68
+ sideOffset = 6,
69
+ align = 'start',
70
+ alignOffset = 0,
71
+ anchor,
72
+ ...props
73
+ }) {
74
+ return (
75
+ <ComboboxPrimitive.Portal>
76
+ <ComboboxPrimitive.Positioner
77
+ side={side}
78
+ sideOffset={sideOffset}
79
+ align={align}
80
+ alignOffset={alignOffset}
81
+ anchor={anchor}
82
+ className="isolate z-50"
83
+ >
84
+ <ComboboxPrimitive.Popup
85
+ data-slot="combobox-content"
86
+ data-chips={!!anchor}
87
+ className={cn(
88
+ 'cn-combobox-content cn-combobox-content-logical cn-menu-target 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) data-[chips=true]:min-w-(--anchor-width)',
89
+ className,
90
+ )}
91
+ {...props}
92
+ />
93
+ </ComboboxPrimitive.Positioner>
94
+ </ComboboxPrimitive.Portal>
95
+ );
96
+ }
97
+ function ComboboxList({ className, ...props }) {
98
+ return (
99
+ <ComboboxPrimitive.List
100
+ data-slot="combobox-list"
101
+ className={cn('cn-combobox-list overflow-y-auto overscroll-contain', className)}
102
+ {...props}
103
+ />
104
+ );
105
+ }
106
+ function ComboboxItem({ className, children, ...props }) {
107
+ return (
108
+ <ComboboxPrimitive.Item
109
+ data-slot="combobox-item"
110
+ className={cn(
111
+ 'cn-combobox-item relative flex w-full cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',
112
+ className,
113
+ )}
114
+ {...props}
115
+ >
116
+ {children}
117
+ <ComboboxPrimitive.ItemIndicator render={<span className="cn-combobox-item-indicator" />}>
118
+ <CheckIcon className="cn-combobox-item-indicator-icon pointer-events-none" />
119
+ </ComboboxPrimitive.ItemIndicator>
120
+ </ComboboxPrimitive.Item>
121
+ );
122
+ }
123
+ function ComboboxGroup({ className, ...props }) {
124
+ return (
125
+ <ComboboxPrimitive.Group
126
+ data-slot="combobox-group"
127
+ className={cn('cn-combobox-group', className)}
128
+ {...props}
129
+ />
130
+ );
131
+ }
132
+ function ComboboxLabel({ className, ...props }) {
133
+ return (
134
+ <ComboboxPrimitive.GroupLabel
135
+ data-slot="combobox-label"
136
+ className={cn('cn-combobox-label', className)}
137
+ {...props}
138
+ />
139
+ );
140
+ }
141
+ function ComboboxCollection({ ...props }) {
142
+ return <ComboboxPrimitive.Collection data-slot="combobox-collection" {...props} />;
143
+ }
144
+ function ComboboxEmpty({ className, ...props }) {
145
+ return (
146
+ <ComboboxPrimitive.Empty
147
+ data-slot="combobox-empty"
148
+ className={cn('cn-combobox-empty', className)}
149
+ {...props}
150
+ />
151
+ );
152
+ }
153
+ function ComboboxSeparator({ className, ...props }) {
154
+ return (
155
+ <ComboboxPrimitive.Separator
156
+ data-slot="combobox-separator"
157
+ className={cn('cn-combobox-separator', className)}
158
+ {...props}
159
+ />
160
+ );
161
+ }
162
+ function ComboboxChips({ className, ...props }) {
163
+ return (
164
+ <ComboboxPrimitive.Chips
165
+ data-slot="combobox-chips"
166
+ className={cn('cn-combobox-chips', className)}
167
+ {...props}
168
+ />
169
+ );
170
+ }
171
+ function ComboboxChip({ className, children, showRemove = true, ...props }) {
172
+ return (
173
+ <ComboboxPrimitive.Chip
174
+ data-slot="combobox-chip"
175
+ className={cn(
176
+ 'cn-combobox-chip has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50',
177
+ className,
178
+ )}
179
+ {...props}
180
+ >
181
+ {children}
182
+ {showRemove && (
183
+ <ComboboxPrimitive.ChipRemove
184
+ render={<Button variant="ghost" size="icon-xs" />}
185
+ className="cn-combobox-chip-remove"
186
+ data-slot="combobox-chip-remove"
187
+ >
188
+ <XIcon className="cn-combobox-chip-indicator-icon pointer-events-none" />
189
+ </ComboboxPrimitive.ChipRemove>
190
+ )}
191
+ </ComboboxPrimitive.Chip>
192
+ );
193
+ }
194
+ function ComboboxChipsInput({ className, ...props }) {
195
+ return (
196
+ <ComboboxPrimitive.Input
197
+ data-slot="combobox-chip-input"
198
+ className={cn('cn-combobox-chip-input min-w-16 flex-1 outline-none', className)}
199
+ {...props}
200
+ />
201
+ );
202
+ }
203
+ function useComboboxAnchor() {
204
+ return React.useRef(null);
205
+ }
206
+ export {
207
+ Combobox,
208
+ ComboboxChip,
209
+ ComboboxChips,
210
+ ComboboxChipsInput,
211
+ ComboboxCollection,
212
+ ComboboxContent,
213
+ ComboboxEmpty,
214
+ ComboboxGroup,
215
+ ComboboxInput,
216
+ ComboboxItem,
217
+ ComboboxLabel,
218
+ ComboboxList,
219
+ ComboboxSeparator,
220
+ ComboboxTrigger,
221
+ ComboboxValue,
222
+ useComboboxAnchor,
223
+ };
@@ -0,0 +1,128 @@
1
+ import React from 'react';
2
+ import { Command as CommandPrimitive } from 'cmdk';
3
+ import { cn } from './lib/utils.js';
4
+ import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from './dialog.jsx';
5
+ import { InputGroup, InputGroupAddon } from './input-group.jsx';
6
+ import { CheckIcon, SearchIcon } from 'lucide-react';
7
+ function Command({ className, ...props }) {
8
+ return (
9
+ <CommandPrimitive
10
+ data-slot="command"
11
+ className={cn('cn-command flex size-full flex-col overflow-hidden', className)}
12
+ {...props}
13
+ />
14
+ );
15
+ }
16
+ function CommandDialog({
17
+ title = 'Command Palette',
18
+ description = 'Search for a command to run...',
19
+ children,
20
+ className,
21
+ showCloseButton = false,
22
+ ...props
23
+ }) {
24
+ return (
25
+ <Dialog {...props}>
26
+ <DialogHeader className="sr-only">
27
+ <DialogTitle>{title}</DialogTitle>
28
+ <DialogDescription>{description}</DialogDescription>
29
+ </DialogHeader>
30
+ <DialogContent
31
+ className={cn('cn-command-dialog top-1/3 translate-y-0 overflow-hidden p-0', className)}
32
+ showCloseButton={showCloseButton}
33
+ >
34
+ {children}
35
+ </DialogContent>
36
+ </Dialog>
37
+ );
38
+ }
39
+ function CommandInput({ className, ...props }) {
40
+ return (
41
+ <div data-slot="command-input-wrapper" className="cn-command-input-wrapper">
42
+ <InputGroup className="cn-command-input-group">
43
+ <CommandPrimitive.Input
44
+ data-slot="command-input"
45
+ className={cn(
46
+ 'cn-command-input outline-hidden disabled:cursor-not-allowed disabled:opacity-50',
47
+ className,
48
+ )}
49
+ {...props}
50
+ />
51
+ <InputGroupAddon>
52
+ <SearchIcon className="cn-command-input-icon" />
53
+ </InputGroupAddon>
54
+ </InputGroup>
55
+ </div>
56
+ );
57
+ }
58
+ function CommandList({ className, ...props }) {
59
+ return (
60
+ <CommandPrimitive.List
61
+ data-slot="command-list"
62
+ className={cn('cn-command-list overflow-x-hidden overflow-y-auto', className)}
63
+ {...props}
64
+ />
65
+ );
66
+ }
67
+ function CommandEmpty({ className, ...props }) {
68
+ return (
69
+ <CommandPrimitive.Empty
70
+ data-slot="command-empty"
71
+ className={cn('cn-command-empty', className)}
72
+ {...props}
73
+ />
74
+ );
75
+ }
76
+ function CommandGroup({ className, ...props }) {
77
+ return (
78
+ <CommandPrimitive.Group
79
+ data-slot="command-group"
80
+ className={cn('cn-command-group', className)}
81
+ {...props}
82
+ />
83
+ );
84
+ }
85
+ function CommandSeparator({ className, ...props }) {
86
+ return (
87
+ <CommandPrimitive.Separator
88
+ data-slot="command-separator"
89
+ className={cn('cn-command-separator', className)}
90
+ {...props}
91
+ />
92
+ );
93
+ }
94
+ function CommandItem({ className, children, ...props }) {
95
+ return (
96
+ <CommandPrimitive.Item
97
+ data-slot="command-item"
98
+ className={cn(
99
+ 'cn-command-item group/command-item data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',
100
+ className,
101
+ )}
102
+ {...props}
103
+ >
104
+ {children}
105
+ <CheckIcon className="cn-command-item-indicator ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" />
106
+ </CommandPrimitive.Item>
107
+ );
108
+ }
109
+ function CommandShortcut({ className, ...props }) {
110
+ return (
111
+ <span
112
+ data-slot="command-shortcut"
113
+ className={cn('cn-command-shortcut', className)}
114
+ {...props}
115
+ />
116
+ );
117
+ }
118
+ export {
119
+ Command,
120
+ CommandDialog,
121
+ CommandEmpty,
122
+ CommandGroup,
123
+ CommandInput,
124
+ CommandItem,
125
+ CommandList,
126
+ CommandSeparator,
127
+ CommandShortcut,
128
+ };
@@ -0,0 +1,170 @@
1
+ import React from 'react';
2
+ import { ContextMenu as ContextMenuPrimitive } from 'radix-ui';
3
+ import { cn } from './lib/utils.js';
4
+ import { CheckIcon, ChevronRightIcon } from 'lucide-react';
5
+ function ContextMenu({ ...props }) {
6
+ return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />;
7
+ }
8
+ function ContextMenuTrigger({ className, ...props }) {
9
+ return (
10
+ <ContextMenuPrimitive.Trigger
11
+ data-slot="context-menu-trigger"
12
+ className={cn('cn-context-menu-trigger select-none', className)}
13
+ {...props}
14
+ />
15
+ );
16
+ }
17
+ function ContextMenuGroup({ ...props }) {
18
+ return <ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />;
19
+ }
20
+ function ContextMenuPortal({ ...props }) {
21
+ return <ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />;
22
+ }
23
+ function ContextMenuSub({ ...props }) {
24
+ return <ContextMenuPrimitive.Sub data-slot="context-menu-sub" {...props} />;
25
+ }
26
+ function ContextMenuRadioGroup({ ...props }) {
27
+ return <ContextMenuPrimitive.RadioGroup data-slot="context-menu-radio-group" {...props} />;
28
+ }
29
+ function ContextMenuContent({ className, ...props }) {
30
+ return (
31
+ <ContextMenuPrimitive.Portal>
32
+ <ContextMenuPrimitive.Content
33
+ data-slot="context-menu-content"
34
+ className={cn(
35
+ 'cn-context-menu-content cn-menu-target z-50 max-h-(--radix-context-menu-content-available-height) origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto',
36
+ className,
37
+ )}
38
+ {...props}
39
+ />
40
+ </ContextMenuPrimitive.Portal>
41
+ );
42
+ }
43
+ function ContextMenuItem({ className, inset, variant = 'default', ...props }) {
44
+ return (
45
+ <ContextMenuPrimitive.Item
46
+ data-slot="context-menu-item"
47
+ data-inset={inset}
48
+ data-variant={variant}
49
+ className={cn(
50
+ 'cn-context-menu-item group/context-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',
51
+ className,
52
+ )}
53
+ {...props}
54
+ />
55
+ );
56
+ }
57
+ function ContextMenuSubTrigger({ className, inset, children, ...props }) {
58
+ return (
59
+ <ContextMenuPrimitive.SubTrigger
60
+ data-slot="context-menu-sub-trigger"
61
+ data-inset={inset}
62
+ className={cn(
63
+ 'cn-context-menu-sub-trigger flex cursor-default items-center outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0',
64
+ className,
65
+ )}
66
+ {...props}
67
+ >
68
+ {children}
69
+ <ChevronRightIcon className="cn-rtl-flip ml-auto" />
70
+ </ContextMenuPrimitive.SubTrigger>
71
+ );
72
+ }
73
+ function ContextMenuSubContent({ className, ...props }) {
74
+ return (
75
+ <ContextMenuPrimitive.SubContent
76
+ data-slot="context-menu-sub-content"
77
+ className={cn(
78
+ 'cn-context-menu-sub-content cn-menu-target z-50 origin-(--radix-context-menu-content-transform-origin) overflow-hidden',
79
+ className,
80
+ )}
81
+ {...props}
82
+ />
83
+ );
84
+ }
85
+ function ContextMenuCheckboxItem({ className, children, checked, inset, ...props }) {
86
+ return (
87
+ <ContextMenuPrimitive.CheckboxItem
88
+ data-slot="context-menu-checkbox-item"
89
+ data-inset={inset}
90
+ className={cn(
91
+ 'cn-context-menu-checkbox-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',
92
+ className,
93
+ )}
94
+ checked={checked}
95
+ {...props}
96
+ >
97
+ <span className="cn-context-menu-item-indicator pointer-events-none">
98
+ <ContextMenuPrimitive.ItemIndicator>
99
+ <CheckIcon />
100
+ </ContextMenuPrimitive.ItemIndicator>
101
+ </span>
102
+ {children}
103
+ </ContextMenuPrimitive.CheckboxItem>
104
+ );
105
+ }
106
+ function ContextMenuRadioItem({ className, children, inset, ...props }) {
107
+ return (
108
+ <ContextMenuPrimitive.RadioItem
109
+ data-slot="context-menu-radio-item"
110
+ data-inset={inset}
111
+ className={cn(
112
+ 'cn-context-menu-radio-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',
113
+ className,
114
+ )}
115
+ {...props}
116
+ >
117
+ <span className="cn-context-menu-item-indicator pointer-events-none">
118
+ <ContextMenuPrimitive.ItemIndicator>
119
+ <CheckIcon />
120
+ </ContextMenuPrimitive.ItemIndicator>
121
+ </span>
122
+ {children}
123
+ </ContextMenuPrimitive.RadioItem>
124
+ );
125
+ }
126
+ function ContextMenuLabel({ className, inset, ...props }) {
127
+ return (
128
+ <ContextMenuPrimitive.Label
129
+ data-slot="context-menu-label"
130
+ data-inset={inset}
131
+ className={cn('cn-context-menu-label', className)}
132
+ {...props}
133
+ />
134
+ );
135
+ }
136
+ function ContextMenuSeparator({ className, ...props }) {
137
+ return (
138
+ <ContextMenuPrimitive.Separator
139
+ data-slot="context-menu-separator"
140
+ className={cn('cn-context-menu-separator', className)}
141
+ {...props}
142
+ />
143
+ );
144
+ }
145
+ function ContextMenuShortcut({ className, ...props }) {
146
+ return (
147
+ <span
148
+ data-slot="context-menu-shortcut"
149
+ className={cn('cn-context-menu-shortcut', className)}
150
+ {...props}
151
+ />
152
+ );
153
+ }
154
+ export {
155
+ ContextMenu,
156
+ ContextMenuCheckboxItem,
157
+ ContextMenuContent,
158
+ ContextMenuGroup,
159
+ ContextMenuItem,
160
+ ContextMenuLabel,
161
+ ContextMenuPortal,
162
+ ContextMenuRadioGroup,
163
+ ContextMenuRadioItem,
164
+ ContextMenuSeparator,
165
+ ContextMenuShortcut,
166
+ ContextMenuSub,
167
+ ContextMenuSubContent,
168
+ ContextMenuSubTrigger,
169
+ ContextMenuTrigger,
170
+ };
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { expect, within } from 'storybook/test';
3
+ import {
4
+ ContextMenu,
5
+ ContextMenuTrigger,
6
+ ContextMenuContent,
7
+ ContextMenuItem,
8
+ } from './context-menu.jsx';
9
+ const meta = {
10
+ title: 'UI/ContextMenu',
11
+ component: ContextMenu,
12
+ };
13
+ var stdin_default = meta;
14
+ const Default = {
15
+ render: () => (
16
+ <ContextMenu>
17
+ <ContextMenuTrigger>
18
+ <div style={{ border: '2px dashed gray', padding: '2rem', textAlign: 'center' }}>
19
+ Right-click here
20
+ </div>
21
+ </ContextMenuTrigger>
22
+ <ContextMenuContent>
23
+ <ContextMenuItem>Copy</ContextMenuItem>
24
+ <ContextMenuItem>Paste</ContextMenuItem>
25
+ <ContextMenuItem>Delete</ContextMenuItem>
26
+ </ContextMenuContent>
27
+ </ContextMenu>
28
+ ),
29
+ play: async ({ canvasElement }) => {
30
+ const canvas = within(canvasElement);
31
+ const trigger = canvas.getByText('Right-click here');
32
+ await expect(trigger).toBeInTheDocument();
33
+ },
34
+ };
35
+ export { Default, stdin_default as default };
@@ -0,0 +1,109 @@
1
+ import React from 'react';
2
+ import { Dialog as DialogPrimitive } from 'radix-ui';
3
+ import { cn } from './lib/utils.js';
4
+ import { Button } from './button.jsx';
5
+ import { XIcon } from 'lucide-react';
6
+ function Dialog({ ...props }) {
7
+ return <DialogPrimitive.Root data-slot="dialog" {...props} />;
8
+ }
9
+ function DialogTrigger({ ...props }) {
10
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
11
+ }
12
+ function DialogPortal({ ...props }) {
13
+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
14
+ }
15
+ function DialogClose({ ...props }) {
16
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
17
+ }
18
+ function DialogOverlay({ className, ...props }) {
19
+ return (
20
+ <DialogPrimitive.Overlay
21
+ data-slot="dialog-overlay"
22
+ className={cn('cn-dialog-overlay fixed inset-0 isolate z-50', className)}
23
+ {...props}
24
+ />
25
+ );
26
+ }
27
+ function DialogContent({ className, children, showCloseButton = true, ...props }) {
28
+ return (
29
+ <DialogPortal>
30
+ <DialogOverlay />
31
+ <DialogPrimitive.Content
32
+ data-slot="dialog-content"
33
+ className={cn(
34
+ 'cn-dialog-content fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none',
35
+ className,
36
+ )}
37
+ {...props}
38
+ >
39
+ {children}
40
+ {showCloseButton && (
41
+ <DialogPrimitive.Close data-slot="dialog-close" asChild>
42
+ <Button variant="ghost" className="cn-dialog-close" size="icon-sm">
43
+ <XIcon />
44
+ <span className="sr-only">Close</span>
45
+ </Button>
46
+ </DialogPrimitive.Close>
47
+ )}
48
+ </DialogPrimitive.Content>
49
+ </DialogPortal>
50
+ );
51
+ }
52
+ function DialogHeader({ className, ...props }) {
53
+ return (
54
+ <div
55
+ data-slot="dialog-header"
56
+ className={cn('cn-dialog-header flex flex-col', className)}
57
+ {...props}
58
+ />
59
+ );
60
+ }
61
+ function DialogFooter({ className, showCloseButton = false, children, ...props }) {
62
+ return (
63
+ <div
64
+ data-slot="dialog-footer"
65
+ className={cn(
66
+ 'cn-dialog-footer flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',
67
+ className,
68
+ )}
69
+ {...props}
70
+ >
71
+ {children}
72
+ {showCloseButton && (
73
+ <DialogPrimitive.Close asChild>
74
+ <Button variant="outline">Close</Button>
75
+ </DialogPrimitive.Close>
76
+ )}
77
+ </div>
78
+ );
79
+ }
80
+ function DialogTitle({ className, ...props }) {
81
+ return (
82
+ <DialogPrimitive.Title
83
+ data-slot="dialog-title"
84
+ className={cn('cn-dialog-title', className)}
85
+ {...props}
86
+ />
87
+ );
88
+ }
89
+ function DialogDescription({ className, ...props }) {
90
+ return (
91
+ <DialogPrimitive.Description
92
+ data-slot="dialog-description"
93
+ className={cn('cn-dialog-description', className)}
94
+ {...props}
95
+ />
96
+ );
97
+ }
98
+ export {
99
+ Dialog,
100
+ DialogClose,
101
+ DialogContent,
102
+ DialogDescription,
103
+ DialogFooter,
104
+ DialogHeader,
105
+ DialogOverlay,
106
+ DialogPortal,
107
+ DialogTitle,
108
+ DialogTrigger,
109
+ };
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import { expect, within } from 'storybook/test';
3
+ import {
4
+ Dialog,
5
+ DialogTrigger,
6
+ DialogContent,
7
+ DialogHeader,
8
+ DialogTitle,
9
+ DialogDescription,
10
+ } from './dialog.jsx';
11
+ import { Button } from './button.jsx';
12
+ const meta = {
13
+ title: 'UI/Dialog',
14
+ component: Dialog,
15
+ };
16
+ var stdin_default = meta;
17
+ const Default = {
18
+ render: () => (
19
+ <Dialog>
20
+ <DialogTrigger asChild>
21
+ <Button>Open Dialog</Button>
22
+ </DialogTrigger>
23
+ <DialogContent>
24
+ <DialogHeader>
25
+ <DialogTitle>Dialog Title</DialogTitle>
26
+ <DialogDescription>This is a dialog description.</DialogDescription>
27
+ </DialogHeader>
28
+ </DialogContent>
29
+ </Dialog>
30
+ ),
31
+ play: async ({ canvasElement }) => {
32
+ const canvas = within(canvasElement);
33
+ const trigger = canvas.getByRole('button', { name: 'Open Dialog' });
34
+ await expect(trigger).toBeInTheDocument();
35
+ },
36
+ };
37
+ export { Default, stdin_default as default };