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,30 @@
1
+ import React from 'react';
2
+ function MainContentHeader({ children }) {
3
+ return (
4
+ <header
5
+ data-main-header
6
+ className="flex h-14 shrink-0 items-center border-b border-border px-4"
7
+ >
8
+ {children}
9
+ </header>
10
+ );
11
+ }
12
+ function MainContentBody({ children }) {
13
+ return (
14
+ <div data-main-body className="flex-1 overflow-y-auto">
15
+ {children}
16
+ </div>
17
+ );
18
+ }
19
+ function MainContentRoot({ children }) {
20
+ return (
21
+ <main data-main className="@container/main flex flex-1 flex-col overflow-hidden bg-background">
22
+ {children}
23
+ </main>
24
+ );
25
+ }
26
+ const MainContent = Object.assign(MainContentRoot, {
27
+ Header: MainContentHeader,
28
+ Body: MainContentBody,
29
+ });
30
+ export { MainContent };
@@ -0,0 +1,189 @@
1
+ import React from 'react';
2
+ import { Menubar as MenubarPrimitive } from 'radix-ui';
3
+ import { cn } from './lib/utils.js';
4
+ import { CheckIcon, ChevronRightIcon } from 'lucide-react';
5
+ function Menubar({ className, ...props }) {
6
+ return (
7
+ <MenubarPrimitive.Root
8
+ data-slot="menubar"
9
+ className={cn('cn-menubar flex items-center', className)}
10
+ {...props}
11
+ />
12
+ );
13
+ }
14
+ function MenubarMenu({ ...props }) {
15
+ return <MenubarPrimitive.Menu data-slot="menubar-menu" {...props} />;
16
+ }
17
+ function MenubarGroup({ ...props }) {
18
+ return <MenubarPrimitive.Group data-slot="menubar-group" {...props} />;
19
+ }
20
+ function MenubarPortal({ ...props }) {
21
+ return <MenubarPrimitive.Portal data-slot="menubar-portal" {...props} />;
22
+ }
23
+ function MenubarRadioGroup({ ...props }) {
24
+ return <MenubarPrimitive.RadioGroup data-slot="menubar-radio-group" {...props} />;
25
+ }
26
+ function MenubarTrigger({ className, ...props }) {
27
+ return (
28
+ <MenubarPrimitive.Trigger
29
+ data-slot="menubar-trigger"
30
+ className={cn('cn-menubar-trigger flex items-center outline-hidden select-none', className)}
31
+ {...props}
32
+ />
33
+ );
34
+ }
35
+ function MenubarContent({
36
+ className,
37
+ align = 'start',
38
+ alignOffset = -4,
39
+ sideOffset = 8,
40
+ ...props
41
+ }) {
42
+ return (
43
+ <MenubarPortal>
44
+ <MenubarPrimitive.Content
45
+ data-slot="menubar-content"
46
+ align={align}
47
+ alignOffset={alignOffset}
48
+ sideOffset={sideOffset}
49
+ className={cn(
50
+ 'cn-menubar-content cn-menu-target z-50 origin-(--radix-menubar-content-transform-origin) overflow-hidden',
51
+ className,
52
+ )}
53
+ {...props}
54
+ />
55
+ </MenubarPortal>
56
+ );
57
+ }
58
+ function MenubarItem({ className, inset, variant = 'default', ...props }) {
59
+ return (
60
+ <MenubarPrimitive.Item
61
+ data-slot="menubar-item"
62
+ data-inset={inset}
63
+ data-variant={variant}
64
+ className={cn(
65
+ 'cn-menubar-item group/menubar-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0',
66
+ className,
67
+ )}
68
+ {...props}
69
+ />
70
+ );
71
+ }
72
+ function MenubarCheckboxItem({ className, children, checked, inset, ...props }) {
73
+ return (
74
+ <MenubarPrimitive.CheckboxItem
75
+ data-slot="menubar-checkbox-item"
76
+ data-inset={inset}
77
+ className={cn(
78
+ 'cn-menubar-checkbox-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0',
79
+ className,
80
+ )}
81
+ checked={checked}
82
+ {...props}
83
+ >
84
+ <span className="cn-menubar-checkbox-item-indicator pointer-events-none absolute flex items-center justify-center">
85
+ <MenubarPrimitive.ItemIndicator>
86
+ <CheckIcon />
87
+ </MenubarPrimitive.ItemIndicator>
88
+ </span>
89
+ {children}
90
+ </MenubarPrimitive.CheckboxItem>
91
+ );
92
+ }
93
+ function MenubarRadioItem({ className, children, inset, ...props }) {
94
+ return (
95
+ <MenubarPrimitive.RadioItem
96
+ data-slot="menubar-radio-item"
97
+ data-inset={inset}
98
+ className={cn(
99
+ 'cn-menubar-radio-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0',
100
+ className,
101
+ )}
102
+ {...props}
103
+ >
104
+ <span className="cn-menubar-radio-item-indicator pointer-events-none absolute flex items-center justify-center">
105
+ <MenubarPrimitive.ItemIndicator>
106
+ <CheckIcon />
107
+ </MenubarPrimitive.ItemIndicator>
108
+ </span>
109
+ {children}
110
+ </MenubarPrimitive.RadioItem>
111
+ );
112
+ }
113
+ function MenubarLabel({ className, inset, ...props }) {
114
+ return (
115
+ <MenubarPrimitive.Label
116
+ data-slot="menubar-label"
117
+ data-inset={inset}
118
+ className={cn('cn-menubar-label', className)}
119
+ {...props}
120
+ />
121
+ );
122
+ }
123
+ function MenubarSeparator({ className, ...props }) {
124
+ return (
125
+ <MenubarPrimitive.Separator
126
+ data-slot="menubar-separator"
127
+ className={cn('cn-menubar-separator -mx-1 my-1 h-px', className)}
128
+ {...props}
129
+ />
130
+ );
131
+ }
132
+ function MenubarShortcut({ className, ...props }) {
133
+ return (
134
+ <span
135
+ data-slot="menubar-shortcut"
136
+ className={cn('cn-menubar-shortcut ml-auto', className)}
137
+ {...props}
138
+ />
139
+ );
140
+ }
141
+ function MenubarSub({ ...props }) {
142
+ return <MenubarPrimitive.Sub data-slot="menubar-sub" {...props} />;
143
+ }
144
+ function MenubarSubTrigger({ className, inset, children, ...props }) {
145
+ return (
146
+ <MenubarPrimitive.SubTrigger
147
+ data-slot="menubar-sub-trigger"
148
+ data-inset={inset}
149
+ className={cn(
150
+ 'cn-menubar-sub-trigger flex cursor-default items-center outline-none select-none',
151
+ className,
152
+ )}
153
+ {...props}
154
+ >
155
+ {children}
156
+ <ChevronRightIcon className="cn-rtl-flip ml-auto size-4" />
157
+ </MenubarPrimitive.SubTrigger>
158
+ );
159
+ }
160
+ function MenubarSubContent({ className, ...props }) {
161
+ return (
162
+ <MenubarPrimitive.SubContent
163
+ data-slot="menubar-sub-content"
164
+ className={cn(
165
+ 'cn-menubar-sub-content cn-menu-target z-50 origin-(--radix-menubar-content-transform-origin) overflow-hidden',
166
+ className,
167
+ )}
168
+ {...props}
169
+ />
170
+ );
171
+ }
172
+ export {
173
+ Menubar,
174
+ MenubarCheckboxItem,
175
+ MenubarContent,
176
+ MenubarGroup,
177
+ MenubarItem,
178
+ MenubarLabel,
179
+ MenubarMenu,
180
+ MenubarPortal,
181
+ MenubarRadioGroup,
182
+ MenubarRadioItem,
183
+ MenubarSeparator,
184
+ MenubarShortcut,
185
+ MenubarSub,
186
+ MenubarSubContent,
187
+ MenubarSubTrigger,
188
+ MenubarTrigger,
189
+ };
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { expect, within } from 'storybook/test';
3
+ import {
4
+ Menubar,
5
+ MenubarMenu,
6
+ MenubarTrigger,
7
+ MenubarContent,
8
+ MenubarItem,
9
+ MenubarSeparator,
10
+ } from './menubar.jsx';
11
+ const meta = {
12
+ title: 'UI/Menubar',
13
+ component: Menubar,
14
+ };
15
+ var stdin_default = meta;
16
+ const Default = {
17
+ render: () => (
18
+ <Menubar>
19
+ <MenubarMenu>
20
+ <MenubarTrigger>File</MenubarTrigger>
21
+ <MenubarContent>
22
+ <MenubarItem>New File</MenubarItem>
23
+ <MenubarItem>Open</MenubarItem>
24
+ <MenubarSeparator />
25
+ <MenubarItem>Exit</MenubarItem>
26
+ </MenubarContent>
27
+ </MenubarMenu>
28
+ <MenubarMenu>
29
+ <MenubarTrigger>Edit</MenubarTrigger>
30
+ <MenubarContent>
31
+ <MenubarItem>Undo</MenubarItem>
32
+ <MenubarItem>Redo</MenubarItem>
33
+ </MenubarContent>
34
+ </MenubarMenu>
35
+ </Menubar>
36
+ ),
37
+ play: async ({ canvasElement }) => {
38
+ const canvas = within(canvasElement);
39
+ await expect(canvas.getByText('File')).toBeInTheDocument();
40
+ await expect(canvas.getByText('Edit')).toBeInTheDocument();
41
+ },
42
+ };
43
+ export { Default, stdin_default as default };
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { cn } from './lib/utils.js';
3
+ import { ChevronDownIcon } from 'lucide-react';
4
+ function NativeSelect({ className, size = 'default', ...props }) {
5
+ return (
6
+ <div
7
+ className={cn(
8
+ 'cn-native-select-wrapper group/native-select relative w-fit has-[select:disabled]:opacity-50',
9
+ className,
10
+ )}
11
+ data-slot="native-select-wrapper"
12
+ data-size={size}
13
+ >
14
+ <select
15
+ data-slot="native-select"
16
+ data-size={size}
17
+ className="cn-native-select outline-none disabled:pointer-events-none disabled:cursor-not-allowed"
18
+ {...props}
19
+ />
20
+ <ChevronDownIcon
21
+ className="cn-native-select-icon pointer-events-none absolute select-none"
22
+ aria-hidden="true"
23
+ data-slot="native-select-icon"
24
+ />
25
+ </div>
26
+ );
27
+ }
28
+ function NativeSelectOption({ ...props }) {
29
+ return <option data-slot="native-select-option" {...props} />;
30
+ }
31
+ function NativeSelectOptGroup({ className, ...props }) {
32
+ return <optgroup data-slot="native-select-optgroup" className={cn(className)} {...props} />;
33
+ }
34
+ export { NativeSelect, NativeSelectOptGroup, NativeSelectOption };
@@ -0,0 +1,67 @@
1
+ import React from 'react';
2
+ import { expect, within } from 'storybook/test';
3
+ import { NativeSelect, NativeSelectOption, NativeSelectOptGroup } from './native-select.jsx';
4
+ const meta = {
5
+ title: 'UI/NativeSelect',
6
+ component: NativeSelect,
7
+ };
8
+ var stdin_default = meta;
9
+ const Default = {
10
+ render: (args) => (
11
+ <NativeSelect {...args}>
12
+ <NativeSelectOption value="">Select...</NativeSelectOption>
13
+ <NativeSelectOption value="apple">Apple</NativeSelectOption>
14
+ <NativeSelectOption value="banana">Banana</NativeSelectOption>
15
+ <NativeSelectOption value="cherry">Cherry</NativeSelectOption>
16
+ </NativeSelect>
17
+ ),
18
+ play: async ({ canvasElement }) => {
19
+ const canvas = within(canvasElement);
20
+ const select = canvas.getByRole('combobox');
21
+ await expect(select).toBeInTheDocument();
22
+ await expect(select.dataset.slot).toBe('native-select');
23
+ },
24
+ };
25
+ const WithOptGroups = {
26
+ render: () => (
27
+ <NativeSelect>
28
+ <NativeSelectOptGroup label="Fruits">
29
+ <NativeSelectOption value="apple">Apple</NativeSelectOption>
30
+ <NativeSelectOption value="banana">Banana</NativeSelectOption>
31
+ </NativeSelectOptGroup>
32
+ <NativeSelectOptGroup label="Vegetables">
33
+ <NativeSelectOption value="carrot">Carrot</NativeSelectOption>
34
+ </NativeSelectOptGroup>
35
+ </NativeSelect>
36
+ ),
37
+ play: async ({ canvasElement }) => {
38
+ const canvas = within(canvasElement);
39
+ const options = canvas.getAllByRole('option');
40
+ await expect(options.length).toBeGreaterThanOrEqual(3);
41
+ },
42
+ };
43
+ const SmallSize = {
44
+ render: () => (
45
+ <NativeSelect size="sm">
46
+ <NativeSelectOption value="a">Small A</NativeSelectOption>
47
+ <NativeSelectOption value="b">Small B</NativeSelectOption>
48
+ </NativeSelect>
49
+ ),
50
+ play: async ({ canvasElement }) => {
51
+ const canvas = within(canvasElement);
52
+ const select = canvas.getByRole('combobox');
53
+ await expect(select.dataset.size).toBe('sm');
54
+ },
55
+ };
56
+ const Disabled = {
57
+ render: () => (
58
+ <NativeSelect disabled>
59
+ <NativeSelectOption value="a">Disabled</NativeSelectOption>
60
+ </NativeSelect>
61
+ ),
62
+ play: async ({ canvasElement }) => {
63
+ const canvas = within(canvasElement);
64
+ await expect(canvas.getByRole('combobox')).toBeDisabled();
65
+ },
66
+ };
67
+ export { Default, Disabled, SmallSize, WithOptGroups, stdin_default as default };
@@ -0,0 +1,120 @@
1
+ import React from 'react';
2
+ import { cva } from 'class-variance-authority';
3
+ import { NavigationMenu as NavigationMenuPrimitive } from 'radix-ui';
4
+ import { cn } from './lib/utils.js';
5
+ import { ChevronDownIcon } from 'lucide-react';
6
+ function NavigationMenu({ className, children, viewport = true, ...props }) {
7
+ return (
8
+ <NavigationMenuPrimitive.Root
9
+ data-slot="navigation-menu"
10
+ data-viewport={viewport}
11
+ className={cn(
12
+ 'cn-navigation-menu group/navigation-menu relative flex max-w-max flex-1 items-center justify-center',
13
+ className,
14
+ )}
15
+ {...props}
16
+ >
17
+ {children}
18
+ {viewport && <NavigationMenuViewport />}
19
+ </NavigationMenuPrimitive.Root>
20
+ );
21
+ }
22
+ function NavigationMenuList({ className, ...props }) {
23
+ return (
24
+ <NavigationMenuPrimitive.List
25
+ data-slot="navigation-menu-list"
26
+ className={cn(
27
+ 'cn-navigation-menu-list group flex flex-1 list-none items-center justify-center',
28
+ className,
29
+ )}
30
+ {...props}
31
+ />
32
+ );
33
+ }
34
+ function NavigationMenuItem({ className, ...props }) {
35
+ return (
36
+ <NavigationMenuPrimitive.Item
37
+ data-slot="navigation-menu-item"
38
+ className={cn('cn-navigation-menu-item relative', className)}
39
+ {...props}
40
+ />
41
+ );
42
+ }
43
+ const navigationMenuTriggerStyle = cva(
44
+ 'cn-navigation-menu-trigger group/navigation-menu-trigger inline-flex h-9 w-max items-center justify-center disabled:pointer-events-none outline-none',
45
+ );
46
+ function NavigationMenuTrigger({ className, children, ...props }) {
47
+ return (
48
+ <NavigationMenuPrimitive.Trigger
49
+ data-slot="navigation-menu-trigger"
50
+ className={cn(navigationMenuTriggerStyle(), 'group', className)}
51
+ {...props}
52
+ >
53
+ {children} <ChevronDownIcon className="cn-navigation-menu-trigger-icon" aria-hidden="true" />
54
+ </NavigationMenuPrimitive.Trigger>
55
+ );
56
+ }
57
+ function NavigationMenuContent({ className, ...props }) {
58
+ return (
59
+ <NavigationMenuPrimitive.Content
60
+ data-slot="navigation-menu-content"
61
+ className={cn(
62
+ 'cn-navigation-menu-content top-0 left-0 w-full group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none md:absolute md:w-auto',
63
+ className,
64
+ )}
65
+ {...props}
66
+ />
67
+ );
68
+ }
69
+ function NavigationMenuViewport({ className, ...props }) {
70
+ return (
71
+ <div
72
+ className={cn(
73
+ 'cn-navigation-menu-viewport-wrapper absolute top-full left-0 isolate z-50 flex justify-center',
74
+ )}
75
+ >
76
+ <NavigationMenuPrimitive.Viewport
77
+ data-slot="navigation-menu-viewport"
78
+ className={cn(
79
+ 'cn-navigation-menu-viewport origin-top-center relative mt-1.5 h-(--radix-navigation-menu-viewport-height) w-full overflow-hidden md:w-(--radix-navigation-menu-viewport-width)',
80
+ className,
81
+ )}
82
+ {...props}
83
+ />
84
+ </div>
85
+ );
86
+ }
87
+ function NavigationMenuLink({ className, ...props }) {
88
+ return (
89
+ <NavigationMenuPrimitive.Link
90
+ data-slot="navigation-menu-link"
91
+ className={cn('cn-navigation-menu-link', className)}
92
+ {...props}
93
+ />
94
+ );
95
+ }
96
+ function NavigationMenuIndicator({ className, ...props }) {
97
+ return (
98
+ <NavigationMenuPrimitive.Indicator
99
+ data-slot="navigation-menu-indicator"
100
+ className={cn(
101
+ 'cn-navigation-menu-indicator top-full z-1 flex h-1.5 items-end justify-center overflow-hidden',
102
+ className,
103
+ )}
104
+ {...props}
105
+ >
106
+ <div className="cn-navigation-menu-indicator-arrow relative top-[60%] h-2 w-2 rotate-45" />
107
+ </NavigationMenuPrimitive.Indicator>
108
+ );
109
+ }
110
+ export {
111
+ NavigationMenu,
112
+ NavigationMenuContent,
113
+ NavigationMenuIndicator,
114
+ NavigationMenuItem,
115
+ NavigationMenuLink,
116
+ NavigationMenuList,
117
+ NavigationMenuTrigger,
118
+ NavigationMenuViewport,
119
+ navigationMenuTriggerStyle,
120
+ };
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import { expect, within } from 'storybook/test';
3
+ import {
4
+ NavigationMenu,
5
+ NavigationMenuList,
6
+ NavigationMenuItem,
7
+ NavigationMenuTrigger,
8
+ NavigationMenuContent,
9
+ NavigationMenuLink,
10
+ } from './navigation-menu.jsx';
11
+ const meta = {
12
+ title: 'UI/NavigationMenu',
13
+ component: NavigationMenu,
14
+ };
15
+ var stdin_default = meta;
16
+ const Default = {
17
+ render: () => (
18
+ <NavigationMenu>
19
+ <NavigationMenuList>
20
+ <NavigationMenuItem>
21
+ <NavigationMenuTrigger>Getting Started</NavigationMenuTrigger>
22
+ <NavigationMenuContent>
23
+ <div style={{ padding: '1rem', width: '200px' }}>
24
+ <NavigationMenuLink href="#">Introduction</NavigationMenuLink>
25
+ </div>
26
+ </NavigationMenuContent>
27
+ </NavigationMenuItem>
28
+ <NavigationMenuItem>
29
+ <NavigationMenuTrigger>Components</NavigationMenuTrigger>
30
+ <NavigationMenuContent>
31
+ <div style={{ padding: '1rem', width: '200px' }}>
32
+ <NavigationMenuLink href="#">Overview</NavigationMenuLink>
33
+ </div>
34
+ </NavigationMenuContent>
35
+ </NavigationMenuItem>
36
+ </NavigationMenuList>
37
+ </NavigationMenu>
38
+ ),
39
+ play: async ({ canvasElement }) => {
40
+ const canvas = within(canvasElement);
41
+ await expect(canvas.getByText('Getting Started')).toBeInTheDocument();
42
+ await expect(canvas.getByText('Components')).toBeInTheDocument();
43
+ },
44
+ };
45
+ export { Default, stdin_default as default };
@@ -0,0 +1,92 @@
1
+ import React from 'react';
2
+ import { cn } from './lib/utils.js';
3
+ import { Button } from './button.jsx';
4
+ import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from 'lucide-react';
5
+ function Pagination({ className, ...props }) {
6
+ return (
7
+ <nav
8
+ role="navigation"
9
+ aria-label="pagination"
10
+ data-slot="pagination"
11
+ className={cn('cn-pagination mx-auto flex w-full justify-center', className)}
12
+ {...props}
13
+ />
14
+ );
15
+ }
16
+ function PaginationContent({ className, ...props }) {
17
+ return (
18
+ <ul
19
+ data-slot="pagination-content"
20
+ className={cn('cn-pagination-content flex items-center', className)}
21
+ {...props}
22
+ />
23
+ );
24
+ }
25
+ function PaginationItem({ ...props }) {
26
+ return <li data-slot="pagination-item" {...props} />;
27
+ }
28
+ function PaginationLink({ className, isActive, size = 'icon', ...props }) {
29
+ return (
30
+ <Button
31
+ asChild
32
+ variant={isActive ? 'outline' : 'ghost'}
33
+ size={size}
34
+ className={cn('cn-pagination-link', className)}
35
+ >
36
+ <a
37
+ aria-current={isActive ? 'page' : void 0}
38
+ data-slot="pagination-link"
39
+ data-active={isActive}
40
+ {...props}
41
+ />
42
+ </Button>
43
+ );
44
+ }
45
+ function PaginationPrevious({ className, text = 'Previous', ...props }) {
46
+ return (
47
+ <PaginationLink
48
+ aria-label="Go to previous page"
49
+ size="default"
50
+ className={cn('cn-pagination-previous', className)}
51
+ {...props}
52
+ >
53
+ <ChevronLeftIcon data-icon="inline-start" className="cn-rtl-flip" />
54
+ <span className="cn-pagination-previous-text hidden sm:block">{text}</span>
55
+ </PaginationLink>
56
+ );
57
+ }
58
+ function PaginationNext({ className, text = 'Next', ...props }) {
59
+ return (
60
+ <PaginationLink
61
+ aria-label="Go to next page"
62
+ size="default"
63
+ className={cn('cn-pagination-next', className)}
64
+ {...props}
65
+ >
66
+ <span className="cn-pagination-next-text hidden sm:block">{text}</span>
67
+ <ChevronRightIcon data-icon="inline-end" className="cn-rtl-flip" />
68
+ </PaginationLink>
69
+ );
70
+ }
71
+ function PaginationEllipsis({ className, ...props }) {
72
+ return (
73
+ <span
74
+ aria-hidden
75
+ data-slot="pagination-ellipsis"
76
+ className={cn('cn-pagination-ellipsis flex items-center justify-center', className)}
77
+ {...props}
78
+ >
79
+ <MoreHorizontalIcon />
80
+ <span className="sr-only">More pages</span>
81
+ </span>
82
+ );
83
+ }
84
+ export {
85
+ Pagination,
86
+ PaginationContent,
87
+ PaginationEllipsis,
88
+ PaginationItem,
89
+ PaginationLink,
90
+ PaginationNext,
91
+ PaginationPrevious,
92
+ };
@@ -0,0 +1,52 @@
1
+ import React from 'react';
2
+ import { expect, within } from 'storybook/test';
3
+ import {
4
+ Pagination,
5
+ PaginationContent,
6
+ PaginationItem,
7
+ PaginationPrevious,
8
+ PaginationNext,
9
+ PaginationLink,
10
+ PaginationEllipsis,
11
+ } from './pagination.jsx';
12
+ const meta = {
13
+ title: 'UI/Pagination',
14
+ component: Pagination,
15
+ };
16
+ var stdin_default = meta;
17
+ const Default = {
18
+ render: () => (
19
+ <Pagination>
20
+ <PaginationContent>
21
+ <PaginationItem>
22
+ <PaginationPrevious href="#" />
23
+ </PaginationItem>
24
+ <PaginationItem>
25
+ <PaginationLink href="#" isActive>
26
+ 1
27
+ </PaginationLink>
28
+ </PaginationItem>
29
+ <PaginationItem>
30
+ <PaginationLink href="#">2</PaginationLink>
31
+ </PaginationItem>
32
+ <PaginationItem>
33
+ <PaginationLink href="#">3</PaginationLink>
34
+ </PaginationItem>
35
+ <PaginationItem>
36
+ <PaginationEllipsis />
37
+ </PaginationItem>
38
+ <PaginationItem>
39
+ <PaginationNext href="#" />
40
+ </PaginationItem>
41
+ </PaginationContent>
42
+ </Pagination>
43
+ ),
44
+ play: async ({ canvasElement }) => {
45
+ const canvas = within(canvasElement);
46
+ const nav = canvas.getByRole('navigation', { name: 'pagination' });
47
+ await expect(nav).toBeInTheDocument();
48
+ await expect(canvas.getByLabelText('Go to previous page')).toBeInTheDocument();
49
+ await expect(canvas.getByLabelText('Go to next page')).toBeInTheDocument();
50
+ },
51
+ };
52
+ export { Default, stdin_default as default };