@oyolincc/create 0.3.0 → 0.5.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 (392) hide show
  1. package/package.json +2 -2
  2. package/templates/hono-fullstack/.codegraph/.gitignore +5 -0
  3. package/templates/hono-fullstack/README.md +22 -1
  4. package/templates/hono-fullstack/_gitignore +1 -0
  5. package/templates/hono-fullstack/apps/server/package.json +7 -2
  6. package/templates/hono-fullstack/apps/server/src/adapters/cloudflare/entry.ts +4 -30
  7. package/templates/hono-fullstack/apps/server/src/adapters/nodejs/bootstrap.ts +20 -12
  8. package/templates/hono-fullstack/apps/server/src/adapters/nodejs/entry.ts +7 -57
  9. package/templates/hono-fullstack/apps/server/src/app.ts +37 -21
  10. package/templates/hono-fullstack/apps/server/src/config.ts +1 -1
  11. package/templates/hono-fullstack/apps/server/src/di-container.ts +51 -0
  12. package/templates/hono-fullstack/apps/server/src/infra/logger/getter.ts +1 -1
  13. package/templates/hono-fullstack/apps/server/src/infra/logger/pino.ts +21 -34
  14. package/templates/hono-fullstack/apps/server/src/infra/work-runner/errors.ts +22 -0
  15. package/templates/hono-fullstack/apps/server/src/infra/work-runner/pass-through/runner.ts +28 -22
  16. package/templates/hono-fullstack/apps/server/src/infra/work-runner/piscina/runner.ts +11 -34
  17. package/templates/hono-fullstack/apps/server/src/infra/work-runner/{example → piscina}/worker-entry.ts +6 -2
  18. package/templates/hono-fullstack/apps/server/src/infra/work-runner/types.ts +2 -16
  19. package/templates/hono-fullstack/apps/server/src/infra/work-runner/utils/business-error.ts +10 -5
  20. package/templates/hono-fullstack/apps/server/src/infra/work-runner/utils/message.ts +5 -17
  21. package/templates/hono-fullstack/apps/server/src/middlewares/cors.ts +16 -22
  22. package/templates/hono-fullstack/apps/server/src/middlewares/logger.ts +34 -0
  23. package/templates/hono-fullstack/apps/server/src/modules/example/module.ts +8 -0
  24. package/templates/hono-fullstack/apps/server/src/modules/example/queries.ts +8 -0
  25. package/templates/hono-fullstack/apps/server/src/modules/example/routes.ts +74 -68
  26. package/templates/hono-fullstack/apps/server/src/modules/example/service.test.ts +53 -0
  27. package/templates/hono-fullstack/apps/server/src/modules/example/service.ts +54 -0
  28. package/templates/hono-fullstack/apps/server/src/modules/example/types.ts +12 -0
  29. package/templates/hono-fullstack/apps/server/src/modules/example/work-task/tasks.test.ts +9 -35
  30. package/templates/hono-fullstack/apps/server/src/modules/example/work-task/tasks.ts +15 -46
  31. package/templates/hono-fullstack/apps/server/src/shared/errors/defs/index.ts +6 -1
  32. package/templates/hono-fullstack/apps/server/src/shared/errors/handler.ts +1 -1
  33. package/templates/hono-fullstack/apps/server/src/shared/network/openapi/index.ts +1 -1
  34. package/templates/hono-fullstack/apps/server/src/shared/types/app.ts +51 -0
  35. package/templates/hono-fullstack/apps/server/src/shared/types/db.ts +126 -0
  36. package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/check.ts +19 -0
  37. package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/model.ts +47 -0
  38. package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/params.ts +105 -0
  39. package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/query.test.ts +139 -0
  40. package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/query.ts +236 -0
  41. package/templates/hono-fullstack/apps/server/vite.config.ts +2 -2
  42. package/templates/hono-fullstack/apps/server/wrangler.jsonc +1 -1
  43. package/templates/hono-fullstack/apps/stack/frontend/assets/styles.css +6 -0
  44. package/templates/hono-fullstack/apps/stack/frontend/components/general/ErrorMessage.tsx +3 -1
  45. package/templates/hono-fullstack/apps/stack/frontend/components/layouts/AppLayout.tsx +2 -1
  46. package/templates/hono-fullstack/apps/stack/frontend/components/layouts/Header.tsx +14 -2
  47. package/templates/hono-fullstack/apps/stack/frontend/components/layouts/Page.tsx +2 -1
  48. package/templates/hono-fullstack/apps/stack/frontend/components/layouts/PageContainer.tsx +4 -1
  49. package/templates/hono-fullstack/apps/stack/frontend/modules/example/api.ts +16 -9
  50. package/templates/hono-fullstack/apps/stack/frontend/modules/example/components/ExampleForm.tsx +25 -12
  51. package/templates/hono-fullstack/apps/stack/frontend/modules/example/components/ExampleList.tsx +13 -4
  52. package/templates/hono-fullstack/apps/stack/frontend/modules/example/hooks/api-hooks.ts +21 -8
  53. package/templates/hono-fullstack/apps/stack/frontend/routes/__root.tsx +1 -1
  54. package/templates/hono-fullstack/apps/stack/frontend/routes/index.tsx +35 -12
  55. package/templates/hono-fullstack/apps/stack/frontend/shared/network/query-hooks.ts +33 -0
  56. package/templates/hono-fullstack/apps/stack/package.json +9 -4
  57. package/templates/hono-fullstack/apps/stack/panda.config.ts +31 -0
  58. package/templates/hono-fullstack/apps/stack/tsconfig.json +1 -0
  59. package/templates/hono-fullstack/apps/stack/turbo.json +20 -0
  60. package/templates/hono-fullstack/apps/stack/vite.config.ts +48 -12
  61. package/templates/hono-fullstack/apps/stack/wrangler.jsonc +1 -1
  62. package/templates/hono-fullstack/envs/.env.example.sqlite-d1 +1 -0
  63. package/templates/hono-fullstack/libs/db/drizzle-kit/sqlite-d1.config.ts +29 -10
  64. package/templates/hono-fullstack/libs/db/package.json +1 -0
  65. package/templates/hono-fullstack/libs/db/src/dialects/sqlite/schema/columns.ts +1 -1
  66. package/templates/hono-fullstack/libs/db/src/dialects/sqlite/schema/modules/examples/examples.ts +6 -3
  67. package/templates/hono-fullstack/libs/db/src/dialects/sqlite/schema/vo.ts +7 -1
  68. package/templates/hono-fullstack/libs/definition/README.md +81 -0
  69. package/templates/hono-fullstack/libs/definition/package.json +3 -1
  70. package/templates/hono-fullstack/libs/definition/src/constants/index.ts +1 -0
  71. package/templates/hono-fullstack/libs/definition/src/constants/pagination.ts +3 -0
  72. package/templates/hono-fullstack/libs/definition/src/modules/common-contracts.ts +24 -0
  73. package/templates/hono-fullstack/libs/definition/src/modules/example/contracts.ts +34 -0
  74. package/templates/hono-fullstack/libs/definition/src/modules/example/index.ts +1 -16
  75. package/templates/hono-fullstack/libs/definition/src/modules/index.ts +2 -0
  76. package/templates/hono-fullstack/libs/definition/src/modules/vo-generated-types.ts +12 -0
  77. package/templates/hono-fullstack/libs/ui/.storybook/main.ts +32 -0
  78. package/templates/hono-fullstack/libs/ui/.storybook/panda.config.ts +22 -0
  79. package/templates/hono-fullstack/libs/ui/.storybook/preview.tsx +79 -0
  80. package/templates/hono-fullstack/libs/ui/.storybook/styles.css +1 -0
  81. package/templates/hono-fullstack/libs/ui/.storybook/vite.config.ts +37 -0
  82. package/templates/hono-fullstack/libs/ui/components.json +15 -0
  83. package/templates/hono-fullstack/libs/ui/package.json +114 -0
  84. package/templates/hono-fullstack/libs/ui/panda.config.ts +41 -0
  85. package/templates/hono-fullstack/libs/ui/src/Tooltip.tsx +47 -0
  86. package/templates/hono-fullstack/libs/ui/src/components/atoms/buttons/Button.tsx +80 -0
  87. package/templates/hono-fullstack/libs/ui/src/components/atoms/buttons/CloseButton.tsx +15 -0
  88. package/templates/hono-fullstack/libs/ui/src/components/atoms/buttons/IconButton.tsx +10 -0
  89. package/templates/hono-fullstack/libs/ui/src/components/atoms/collections/Combobox.tsx +91 -0
  90. package/templates/hono-fullstack/libs/ui/src/components/atoms/collections/Select.tsx +88 -0
  91. package/templates/hono-fullstack/libs/ui/src/components/atoms/collections/TreeView.tsx +142 -0
  92. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Avatar.tsx +64 -0
  93. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Badge.tsx +7 -0
  94. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Card.tsx +23 -0
  95. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Clipboard.tsx +77 -0
  96. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Icon.tsx +9 -0
  97. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Table.tsx +51 -0
  98. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Tag.tsx +23 -0
  99. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Timeline.tsx +33 -0
  100. package/templates/hono-fullstack/libs/ui/src/components/atoms/date-and-time/DatePicker.tsx +255 -0
  101. package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Accordion.tsx +48 -0
  102. package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Breadcrumb.tsx +50 -0
  103. package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Collapsible.tsx +34 -0
  104. package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Pagination.tsx +74 -0
  105. package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Steps.tsx +91 -0
  106. package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Tabs.tsx +37 -0
  107. package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Alert.tsx +52 -0
  108. package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Progress.tsx +41 -0
  109. package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/ProgressCircle.tsx +40 -0
  110. package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Skeleton.tsx +37 -0
  111. package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Spinner.tsx +7 -0
  112. package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Toast.tsx +99 -0
  113. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Checkbox.tsx +95 -0
  114. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/ColorPicker.tsx +148 -0
  115. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Editable.tsx +44 -0
  116. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Field.tsx +36 -0
  117. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Fieldset.tsx +34 -0
  118. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/FileUpload.tsx +143 -0
  119. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Input.tsx +7 -0
  120. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/InputAddon.tsx +7 -0
  121. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/InputGroup.tsx +61 -0
  122. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/NativeSelect.tsx +81 -0
  123. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/NumberInput.tsx +63 -0
  124. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/PasswordInput.tsx +76 -0
  125. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/PinInput.tsx +36 -0
  126. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/RadioCard.tsx +96 -0
  127. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/RadioGroup.tsx +61 -0
  128. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/RatingGroup.tsx +106 -0
  129. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/SegmentGroup.tsx +68 -0
  130. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Slider.tsx +87 -0
  131. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Switch.tsx +74 -0
  132. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/TagsInput.tsx +77 -0
  133. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Textarea.tsx +7 -0
  134. package/templates/hono-fullstack/libs/ui/src/components/atoms/index.ts +98 -0
  135. package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/AbsoluteCenter.tsx +7 -0
  136. package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/Loader.tsx +69 -0
  137. package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/Span.tsx +5 -0
  138. package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/create-layout.ts +18 -0
  139. package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Float.tsx +7 -0
  140. package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Grid.tsx +17 -0
  141. package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Group.tsx +7 -0
  142. package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/ScrollArea.tsx +46 -0
  143. package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Separator.tsx +26 -0
  144. package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Stack.tsx +54 -0
  145. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Dialog.tsx +69 -0
  146. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Drawer.tsx +49 -0
  147. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/HoverCard.tsx +37 -0
  148. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Menu.tsx +74 -0
  149. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/OverlayManager.test.ts +124 -0
  150. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/OverlayManager.tsx +189 -0
  151. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Popover.tsx +57 -0
  152. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Tooltip.tsx +37 -0
  153. package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/Heading.tsx +6 -0
  154. package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/Link.tsx +7 -0
  155. package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/LinkOverlay.tsx +21 -0
  156. package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/Text.tsx +6 -0
  157. package/templates/hono-fullstack/libs/ui/src/components/atoms/utilities/VisuallyHidden.tsx +13 -0
  158. package/templates/hono-fullstack/libs/ui/src/hooks.ts +242 -0
  159. package/templates/hono-fullstack/libs/ui/src/index.ts +19 -0
  160. package/templates/hono-fullstack/libs/ui/src/theme/animation-styles.ts +50 -0
  161. package/templates/hono-fullstack/libs/ui/src/theme/breakpoints.ts +7 -0
  162. package/templates/hono-fullstack/libs/ui/src/theme/conditions.ts +12 -0
  163. package/templates/hono-fullstack/libs/ui/src/theme/containers.ts +16 -0
  164. package/templates/hono-fullstack/libs/ui/src/theme/global-css.ts +12 -0
  165. package/templates/hono-fullstack/libs/ui/src/theme/keyframes.ts +157 -0
  166. package/templates/hono-fullstack/libs/ui/src/theme/layer-styles.ts +11 -0
  167. package/templates/hono-fullstack/libs/ui/src/theme/patterns/grid.ts +51 -0
  168. package/templates/hono-fullstack/libs/ui/src/theme/patterns/index.ts +60 -0
  169. package/templates/hono-fullstack/libs/ui/src/theme/patterns/stack.ts +46 -0
  170. package/templates/hono-fullstack/libs/ui/src/theme/recipes/absolute-center.ts +38 -0
  171. package/templates/hono-fullstack/libs/ui/src/theme/recipes/accordion.ts +68 -0
  172. package/templates/hono-fullstack/libs/ui/src/theme/recipes/alert.ts +83 -0
  173. package/templates/hono-fullstack/libs/ui/src/theme/recipes/avatar.ts +155 -0
  174. package/templates/hono-fullstack/libs/ui/src/theme/recipes/badge.ts +67 -0
  175. package/templates/hono-fullstack/libs/ui/src/theme/recipes/breadcrumb.ts +69 -0
  176. package/templates/hono-fullstack/libs/ui/src/theme/recipes/button.ts +149 -0
  177. package/templates/hono-fullstack/libs/ui/src/theme/recipes/card.ts +36 -0
  178. package/templates/hono-fullstack/libs/ui/src/theme/recipes/checkbox.ts +120 -0
  179. package/templates/hono-fullstack/libs/ui/src/theme/recipes/clipboard.ts +22 -0
  180. package/templates/hono-fullstack/libs/ui/src/theme/recipes/collapsible.ts +26 -0
  181. package/templates/hono-fullstack/libs/ui/src/theme/recipes/color-picker.ts +299 -0
  182. package/templates/hono-fullstack/libs/ui/src/theme/recipes/combobox.ts +141 -0
  183. package/templates/hono-fullstack/libs/ui/src/theme/recipes/date-picker.ts +302 -0
  184. package/templates/hono-fullstack/libs/ui/src/theme/recipes/dialog.ts +191 -0
  185. package/templates/hono-fullstack/libs/ui/src/theme/recipes/drawer.ts +170 -0
  186. package/templates/hono-fullstack/libs/ui/src/theme/recipes/editable.ts +64 -0
  187. package/templates/hono-fullstack/libs/ui/src/theme/recipes/field.ts +41 -0
  188. package/templates/hono-fullstack/libs/ui/src/theme/recipes/fieldset.ts +47 -0
  189. package/templates/hono-fullstack/libs/ui/src/theme/recipes/file-upload.ts +86 -0
  190. package/templates/hono-fullstack/libs/ui/src/theme/recipes/group.ts +78 -0
  191. package/templates/hono-fullstack/libs/ui/src/theme/recipes/heading.ts +24 -0
  192. package/templates/hono-fullstack/libs/ui/src/theme/recipes/hover-card.ts +47 -0
  193. package/templates/hono-fullstack/libs/ui/src/theme/recipes/icon.ts +25 -0
  194. package/templates/hono-fullstack/libs/ui/src/theme/recipes/index.ts +120 -0
  195. package/templates/hono-fullstack/libs/ui/src/theme/recipes/input-addon.ts +51 -0
  196. package/templates/hono-fullstack/libs/ui/src/theme/recipes/input-group.ts +77 -0
  197. package/templates/hono-fullstack/libs/ui/src/theme/recipes/input.ts +99 -0
  198. package/templates/hono-fullstack/libs/ui/src/theme/recipes/link.ts +36 -0
  199. package/templates/hono-fullstack/libs/ui/src/theme/recipes/menu.ts +114 -0
  200. package/templates/hono-fullstack/libs/ui/src/theme/recipes/native-select.ts +92 -0
  201. package/templates/hono-fullstack/libs/ui/src/theme/recipes/number-input.ts +91 -0
  202. package/templates/hono-fullstack/libs/ui/src/theme/recipes/pagination.ts +9 -0
  203. package/templates/hono-fullstack/libs/ui/src/theme/recipes/pin-input.ts +33 -0
  204. package/templates/hono-fullstack/libs/ui/src/theme/recipes/popover.ts +78 -0
  205. package/templates/hono-fullstack/libs/ui/src/theme/recipes/progress-circle.ts +50 -0
  206. package/templates/hono-fullstack/libs/ui/src/theme/recipes/progress.ts +112 -0
  207. package/templates/hono-fullstack/libs/ui/src/theme/recipes/radio-card.ts +223 -0
  208. package/templates/hono-fullstack/libs/ui/src/theme/recipes/radio-group.ts +78 -0
  209. package/templates/hono-fullstack/libs/ui/src/theme/recipes/rating-group.ts +98 -0
  210. package/templates/hono-fullstack/libs/ui/src/theme/recipes/scroll-area.ts +119 -0
  211. package/templates/hono-fullstack/libs/ui/src/theme/recipes/segment-group.ts +162 -0
  212. package/templates/hono-fullstack/libs/ui/src/theme/recipes/select.ts +157 -0
  213. package/templates/hono-fullstack/libs/ui/src/theme/recipes/separator.ts +25 -0
  214. package/templates/hono-fullstack/libs/ui/src/theme/recipes/skeleton.ts +65 -0
  215. package/templates/hono-fullstack/libs/ui/src/theme/recipes/slider.ts +164 -0
  216. package/templates/hono-fullstack/libs/ui/src/theme/recipes/spinner.ts +34 -0
  217. package/templates/hono-fullstack/libs/ui/src/theme/recipes/steps.ts +162 -0
  218. package/templates/hono-fullstack/libs/ui/src/theme/recipes/switch.ts +150 -0
  219. package/templates/hono-fullstack/libs/ui/src/theme/recipes/table.ts +150 -0
  220. package/templates/hono-fullstack/libs/ui/src/theme/recipes/tabs.ts +128 -0
  221. package/templates/hono-fullstack/libs/ui/src/theme/recipes/tag.ts +114 -0
  222. package/templates/hono-fullstack/libs/ui/src/theme/recipes/tags-input.ts +201 -0
  223. package/templates/hono-fullstack/libs/ui/src/theme/recipes/text.ts +7 -0
  224. package/templates/hono-fullstack/libs/ui/src/theme/recipes/textarea.ts +90 -0
  225. package/templates/hono-fullstack/libs/ui/src/theme/recipes/timeline.ts +137 -0
  226. package/templates/hono-fullstack/libs/ui/src/theme/recipes/toast.ts +52 -0
  227. package/templates/hono-fullstack/libs/ui/src/theme/recipes/tooltip.ts +44 -0
  228. package/templates/hono-fullstack/libs/ui/src/theme/recipes/tree-view.ts +200 -0
  229. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/amber.ts +91 -0
  230. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/gray.ts +103 -0
  231. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/green.ts +88 -0
  232. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/index.ts +14 -0
  233. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/lime.ts +91 -0
  234. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/red.ts +88 -0
  235. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/index.ts +8 -0
  236. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/shadows.ts +46 -0
  237. package/templates/hono-fullstack/libs/ui/src/theme/text-styles.ts +82 -0
  238. package/templates/hono-fullstack/libs/ui/src/theme/tokens/animations.ts +8 -0
  239. package/templates/hono-fullstack/libs/ui/src/theme/tokens/aspect-ratio.ts +6 -0
  240. package/templates/hono-fullstack/libs/ui/src/theme/tokens/borders.ts +5 -0
  241. package/templates/hono-fullstack/libs/ui/src/theme/tokens/colors.ts +35 -0
  242. package/templates/hono-fullstack/libs/ui/src/theme/tokens/durations.ts +11 -0
  243. package/templates/hono-fullstack/libs/ui/src/theme/tokens/easings.ts +9 -0
  244. package/templates/hono-fullstack/libs/ui/src/theme/tokens/index.ts +42 -0
  245. package/templates/hono-fullstack/libs/ui/src/theme/tokens/radii.ts +13 -0
  246. package/templates/hono-fullstack/libs/ui/src/theme/tokens/sizes.ts +27 -0
  247. package/templates/hono-fullstack/libs/ui/src/theme/tokens/spacing.ts +41 -0
  248. package/templates/hono-fullstack/libs/ui/src/theme/tokens/typography.ts +86 -0
  249. package/templates/hono-fullstack/libs/ui/src/theme/tokens/z-index.ts +43 -0
  250. package/templates/hono-fullstack/libs/ui/stories/README.md +107 -0
  251. package/templates/hono-fullstack/libs/ui/stories/actions/Button.stories.tsx +260 -0
  252. package/templates/hono-fullstack/libs/ui/stories/actions/Clipboard.stories.tsx +87 -0
  253. package/templates/hono-fullstack/libs/ui/stories/actions/IconButton.stories.tsx +33 -0
  254. package/templates/hono-fullstack/libs/ui/stories/collections/Combobox.stories.tsx +334 -0
  255. package/templates/hono-fullstack/libs/ui/stories/collections/Select.stories.tsx +342 -0
  256. package/templates/hono-fullstack/libs/ui/stories/collections/TreeView.stories.tsx +252 -0
  257. package/templates/hono-fullstack/libs/ui/stories/color/ColorPicker.stories.tsx +217 -0
  258. package/templates/hono-fullstack/libs/ui/stories/date/DatePicker.stories.tsx +302 -0
  259. package/templates/hono-fullstack/libs/ui/stories/disclosure/Accordion.stories.tsx +105 -0
  260. package/templates/hono-fullstack/libs/ui/stories/disclosure/Collapsible.stories.tsx +55 -0
  261. package/templates/hono-fullstack/libs/ui/stories/disclosure/Steps.stories.tsx +208 -0
  262. package/templates/hono-fullstack/libs/ui/stories/disclosure/Tabs.stories.tsx +176 -0
  263. package/templates/hono-fullstack/libs/ui/stories/display/Avatar.stories.tsx +108 -0
  264. package/templates/hono-fullstack/libs/ui/stories/display/Badge.stories.tsx +90 -0
  265. package/templates/hono-fullstack/libs/ui/stories/display/Card.stories.tsx +121 -0
  266. package/templates/hono-fullstack/libs/ui/stories/display/Heading.stories.tsx +62 -0
  267. package/templates/hono-fullstack/libs/ui/stories/display/Icon.stories.tsx +51 -0
  268. package/templates/hono-fullstack/libs/ui/stories/display/Table.stories.tsx +222 -0
  269. package/templates/hono-fullstack/libs/ui/stories/display/Tag.stories.tsx +168 -0
  270. package/templates/hono-fullstack/libs/ui/stories/display/Text.stories.tsx +32 -0
  271. package/templates/hono-fullstack/libs/ui/stories/display/Timeline.stories.tsx +241 -0
  272. package/templates/hono-fullstack/libs/ui/stories/feedback/Alert.stories.tsx +122 -0
  273. package/templates/hono-fullstack/libs/ui/stories/feedback/Progress.stories.tsx +163 -0
  274. package/templates/hono-fullstack/libs/ui/stories/feedback/ProgressCircle.stories.tsx +176 -0
  275. package/templates/hono-fullstack/libs/ui/stories/feedback/Skeleton.stories.tsx +75 -0
  276. package/templates/hono-fullstack/libs/ui/stories/feedback/Spinner.stories.tsx +49 -0
  277. package/templates/hono-fullstack/libs/ui/stories/feedback/Toast.stories.tsx +145 -0
  278. package/templates/hono-fullstack/libs/ui/stories/forms/Checkbox.stories.tsx +281 -0
  279. package/templates/hono-fullstack/libs/ui/stories/forms/Editable.stories.tsx +94 -0
  280. package/templates/hono-fullstack/libs/ui/stories/forms/Field.stories.tsx +72 -0
  281. package/templates/hono-fullstack/libs/ui/stories/forms/Fieldset.stories.tsx +109 -0
  282. package/templates/hono-fullstack/libs/ui/stories/forms/FileUpload.stories.tsx +115 -0
  283. package/templates/hono-fullstack/libs/ui/stories/forms/Form.stories.tsx +120 -0
  284. package/templates/hono-fullstack/libs/ui/stories/forms/Input.stories.tsx +155 -0
  285. package/templates/hono-fullstack/libs/ui/stories/forms/InputGroup.stories.tsx +79 -0
  286. package/templates/hono-fullstack/libs/ui/stories/forms/NativeSelect.stories.tsx +160 -0
  287. package/templates/hono-fullstack/libs/ui/stories/forms/NumberInput.stories.tsx +149 -0
  288. package/templates/hono-fullstack/libs/ui/stories/forms/PasswordInput.stories.tsx +141 -0
  289. package/templates/hono-fullstack/libs/ui/stories/forms/PinInput.stories.tsx +155 -0
  290. package/templates/hono-fullstack/libs/ui/stories/forms/RadioCard.stories.tsx +265 -0
  291. package/templates/hono-fullstack/libs/ui/stories/forms/RadioGroup.stories.tsx +109 -0
  292. package/templates/hono-fullstack/libs/ui/stories/forms/RatingGroup.stories.tsx +123 -0
  293. package/templates/hono-fullstack/libs/ui/stories/forms/SegmentGroup.stories.tsx +130 -0
  294. package/templates/hono-fullstack/libs/ui/stories/forms/Slider.stories.tsx +190 -0
  295. package/templates/hono-fullstack/libs/ui/stories/forms/Switch.stories.tsx +124 -0
  296. package/templates/hono-fullstack/libs/ui/stories/forms/TagsInput.stories.tsx +154 -0
  297. package/templates/hono-fullstack/libs/ui/stories/forms/Textarea.stories.tsx +148 -0
  298. package/templates/hono-fullstack/libs/ui/stories/layout/Grid.stories.tsx +60 -0
  299. package/templates/hono-fullstack/libs/ui/stories/layout/Positioning.stories.tsx +90 -0
  300. package/templates/hono-fullstack/libs/ui/stories/layout/ScrollArea.stories.tsx +68 -0
  301. package/templates/hono-fullstack/libs/ui/stories/layout/Stack.stories.tsx +87 -0
  302. package/templates/hono-fullstack/libs/ui/stories/navigation/Breadcrumb.stories.tsx +104 -0
  303. package/templates/hono-fullstack/libs/ui/stories/navigation/Link.stories.tsx +62 -0
  304. package/templates/hono-fullstack/libs/ui/stories/navigation/LinkBox.stories.tsx +45 -0
  305. package/templates/hono-fullstack/libs/ui/stories/navigation/Pagination.stories.tsx +74 -0
  306. package/templates/hono-fullstack/libs/ui/stories/overlays/Dialog.stories.tsx +255 -0
  307. package/templates/hono-fullstack/libs/ui/stories/overlays/Drawer.stories.tsx +114 -0
  308. package/templates/hono-fullstack/libs/ui/stories/overlays/HoverCard.stories.tsx +47 -0
  309. package/templates/hono-fullstack/libs/ui/stories/overlays/Menu.stories.tsx +133 -0
  310. package/templates/hono-fullstack/libs/ui/stories/overlays/OverlayManager.stories.tsx +206 -0
  311. package/templates/hono-fullstack/libs/ui/stories/overlays/Popover.stories.tsx +73 -0
  312. package/templates/hono-fullstack/libs/ui/stories/overlays/Tooltip.stories.tsx +114 -0
  313. package/templates/hono-fullstack/libs/ui/stories/tsconfig.json +14 -0
  314. package/templates/hono-fullstack/libs/ui/tsconfig.build.json +5 -0
  315. package/templates/hono-fullstack/libs/ui/tsconfig.json +13 -0
  316. package/templates/hono-fullstack/libs/ui/turbo.json +28 -0
  317. package/templates/hono-fullstack/libs/ui/vite.config.ts +33 -0
  318. package/templates/hono-fullstack/oyo.config.json +31 -1
  319. package/templates/hono-fullstack/package.json +1 -0
  320. package/templates/hono-fullstack/pnpm-workspace.yaml +20 -10
  321. package/templates/hono-fullstack/turbo.json +10 -0
  322. package/templates/hono-server/.codegraph/.gitignore +5 -0
  323. package/templates/hono-server/README.md +9 -1
  324. package/templates/hono-server/_gitignore +1 -0
  325. package/templates/hono-server/apps/server/package.json +7 -2
  326. package/templates/hono-server/apps/server/src/adapters/cloudflare/entry.ts +4 -30
  327. package/templates/hono-server/apps/server/src/adapters/nodejs/bootstrap.ts +20 -12
  328. package/templates/hono-server/apps/server/src/adapters/nodejs/entry.ts +7 -57
  329. package/templates/hono-server/apps/server/src/app.ts +37 -21
  330. package/templates/hono-server/apps/server/src/config.ts +1 -1
  331. package/templates/hono-server/apps/server/src/di-container.ts +51 -0
  332. package/templates/hono-server/apps/server/src/infra/logger/getter.ts +1 -1
  333. package/templates/hono-server/apps/server/src/infra/logger/pino.ts +21 -34
  334. package/templates/hono-server/apps/server/src/infra/work-runner/errors.ts +22 -0
  335. package/templates/hono-server/apps/server/src/infra/work-runner/pass-through/runner.ts +28 -22
  336. package/templates/hono-server/apps/server/src/infra/work-runner/piscina/runner.ts +11 -34
  337. package/templates/hono-server/apps/server/src/infra/work-runner/{example → piscina}/worker-entry.ts +6 -2
  338. package/templates/hono-server/apps/server/src/infra/work-runner/types.ts +2 -16
  339. package/templates/hono-server/apps/server/src/infra/work-runner/utils/business-error.ts +10 -5
  340. package/templates/hono-server/apps/server/src/infra/work-runner/utils/message.ts +5 -17
  341. package/templates/hono-server/apps/server/src/middlewares/cors.ts +16 -22
  342. package/templates/hono-server/apps/server/src/middlewares/logger.ts +34 -0
  343. package/templates/hono-server/apps/server/src/modules/example/module.ts +8 -0
  344. package/templates/hono-server/apps/server/src/modules/example/queries.ts +8 -0
  345. package/templates/hono-server/apps/server/src/modules/example/routes.ts +74 -68
  346. package/templates/hono-server/apps/server/src/modules/example/service.test.ts +53 -0
  347. package/templates/hono-server/apps/server/src/modules/example/service.ts +54 -0
  348. package/templates/hono-server/apps/server/src/modules/example/types.ts +12 -0
  349. package/templates/hono-server/apps/server/src/modules/example/work-task/tasks.test.ts +9 -35
  350. package/templates/hono-server/apps/server/src/modules/example/work-task/tasks.ts +15 -46
  351. package/templates/hono-server/apps/server/src/shared/errors/defs/index.ts +6 -1
  352. package/templates/hono-server/apps/server/src/shared/errors/handler.ts +1 -1
  353. package/templates/hono-server/apps/server/src/shared/network/openapi/index.ts +1 -1
  354. package/templates/hono-server/apps/server/src/shared/types/app.ts +51 -0
  355. package/templates/hono-server/apps/server/src/shared/types/db.ts +126 -0
  356. package/templates/hono-server/apps/server/src/shared/utils/data-access/check.ts +19 -0
  357. package/templates/hono-server/apps/server/src/shared/utils/data-access/model.ts +47 -0
  358. package/templates/hono-server/apps/server/src/shared/utils/data-access/params.ts +105 -0
  359. package/templates/hono-server/apps/server/src/shared/utils/data-access/query.test.ts +139 -0
  360. package/templates/hono-server/apps/server/src/shared/utils/data-access/query.ts +236 -0
  361. package/templates/hono-server/apps/server/vite.config.ts +2 -2
  362. package/templates/hono-server/apps/server/wrangler.jsonc +1 -1
  363. package/templates/hono-server/docker/README.md +1 -1
  364. package/templates/hono-server/envs/.env.example.sqlite-d1 +1 -0
  365. package/templates/hono-server/libs/db/drizzle-kit/sqlite-d1.config.ts +29 -10
  366. package/templates/hono-server/libs/db/package.json +1 -0
  367. package/templates/hono-server/libs/db/src/dialects/sqlite/schema/columns.ts +1 -1
  368. package/templates/hono-server/libs/db/src/dialects/sqlite/schema/modules/examples/examples.ts +6 -3
  369. package/templates/hono-server/libs/db/src/dialects/sqlite/schema/vo.ts +7 -1
  370. package/templates/hono-server/libs/definition/README.md +81 -0
  371. package/templates/hono-server/libs/definition/package.json +3 -1
  372. package/templates/hono-server/libs/definition/src/constants/index.ts +1 -0
  373. package/templates/hono-server/libs/definition/src/constants/pagination.ts +3 -0
  374. package/templates/hono-server/libs/definition/src/modules/common-contracts.ts +24 -0
  375. package/templates/hono-server/libs/definition/src/modules/example/contracts.ts +34 -0
  376. package/templates/hono-server/libs/definition/src/modules/example/index.ts +1 -16
  377. package/templates/hono-server/libs/definition/src/modules/index.ts +2 -0
  378. package/templates/hono-server/libs/definition/src/modules/vo-generated-types.ts +12 -0
  379. package/templates/hono-server/oyo.config.json +31 -1
  380. package/templates/hono-server/package.json +1 -0
  381. package/templates/hono-server/pnpm-workspace.yaml +9 -7
  382. package/templates/hono-server/turbo.json +10 -0
  383. package/templates/monorepo/.codegraph/.gitignore +5 -0
  384. package/templates/monorepo/_gitignore +1 -0
  385. package/templates/monorepo/oyo.config.json +7 -1
  386. package/templates/monorepo/pnpm-workspace.yaml +4 -4
  387. package/templates/monorepo/turbo.json +10 -0
  388. package/templates/hono-fullstack/apps/server/src/modules/example/contracts.ts +0 -9
  389. package/templates/hono-fullstack/apps/server/src/shared/app/types.ts +0 -44
  390. package/templates/hono-fullstack/apps/stack/frontend/styles.css +0 -23
  391. package/templates/hono-server/apps/server/src/modules/example/contracts.ts +0 -9
  392. package/templates/hono-server/apps/server/src/shared/app/types.ts +0 -44
@@ -0,0 +1,255 @@
1
+ import { Button, Dialog, Portal, useDialog } from '@repo/ui'
2
+ import type { Meta, StoryObj } from '@storybook/react-vite'
3
+ import { useId, useRef, useState } from 'react'
4
+ import { fn } from 'storybook/test'
5
+ import { css } from 'styled-system/css'
6
+
7
+ const meta = {
8
+ title: 'Overlays/Dialog',
9
+ component: Dialog.Root,
10
+ parameters: {
11
+ docs: {
12
+ description: { component: '通过 Portal 展示弹窗,支持受控状态、焦点管理和外部 store。' },
13
+ },
14
+ controls: {
15
+ include: [
16
+ 'size',
17
+ 'placement',
18
+ 'scrollBehavior',
19
+ 'motionPreset',
20
+ 'closeOnEscape',
21
+ 'closeOnInteractOutside',
22
+ ],
23
+ },
24
+ },
25
+ argTypes: {
26
+ size: {
27
+ control: 'select',
28
+ options: ['xs', 'sm', 'md', 'lg', 'xl', 'cover', 'full', 'unstyled'],
29
+ },
30
+ placement: { control: 'inline-radio', options: ['top', 'center', 'bottom'] },
31
+ scrollBehavior: { control: 'inline-radio', options: ['inside', 'outside'] },
32
+ motionPreset: {
33
+ control: 'select',
34
+ options: [
35
+ 'scale',
36
+ 'slide-in-bottom',
37
+ 'slide-in-top',
38
+ 'slide-in-left',
39
+ 'slide-in-right',
40
+ 'none',
41
+ ],
42
+ },
43
+ closeOnEscape: { control: 'boolean' },
44
+ closeOnInteractOutside: { control: 'boolean' },
45
+ onOpenChange: { control: false },
46
+ },
47
+ args: {
48
+ size: 'md',
49
+ placement: 'center',
50
+ scrollBehavior: 'outside',
51
+ motionPreset: 'scale',
52
+ closeOnEscape: true,
53
+ closeOnInteractOutside: true,
54
+ onOpenChange: fn(),
55
+ },
56
+ } satisfies Meta<typeof Dialog.Root>
57
+
58
+ export default meta
59
+ type Story = StoryObj<typeof meta>
60
+
61
+ export const Playground: Story = {
62
+ args: { size: 'sm', placement: 'top', motionPreset: 'none' },
63
+ render: (args) => (
64
+ <Dialog.Root {...args}>
65
+ <Dialog.Trigger asChild>
66
+ <Button variant="outline">打开非受控 Dialog</Button>
67
+ </Dialog.Trigger>
68
+ <Portal>
69
+ <Dialog.Backdrop />
70
+ <Dialog.Positioner>
71
+ <Dialog.Content>
72
+ <Dialog.Header>
73
+ <Dialog.Title>非受控 Dialog</Dialog.Title>
74
+ <Dialog.Description>检查小尺寸、顶部定位,以及无动画关闭。</Dialog.Description>
75
+ </Dialog.Header>
76
+ <Dialog.Body>此示例由 Ark 自己管理打开状态。</Dialog.Body>
77
+ <Dialog.Footer>
78
+ <Dialog.CloseTrigger asChild>
79
+ <Button>关闭</Button>
80
+ </Dialog.CloseTrigger>
81
+ </Dialog.Footer>
82
+ </Dialog.Content>
83
+ </Dialog.Positioner>
84
+ </Portal>
85
+ </Dialog.Root>
86
+ ),
87
+ }
88
+
89
+ export const Controlled: Story = {
90
+ args: {
91
+ size: 'lg',
92
+ placement: 'center',
93
+ scrollBehavior: 'inside',
94
+ motionPreset: 'slide-in-bottom',
95
+ },
96
+ parameters: {
97
+ docs: {
98
+ source: { type: 'code' },
99
+ description: {
100
+ story:
101
+ '打开后聚焦输入框;Tab 循环、Escape 和遮罩关闭;关闭后焦点返回触发按钮。确认动作关闭弹窗,preventDefault 可阻止关闭。',
102
+ },
103
+ },
104
+ },
105
+ render: function Controlled(args) {
106
+ const [open, setOpen] = useState(false)
107
+ const [actions, setActions] = useState(0)
108
+ const [blocked, setBlocked] = useState(0)
109
+ const [lastEvent, setLastEvent] = useState('尚未操作')
110
+ const inputRef = useRef<HTMLInputElement>(null)
111
+ const inputId = useId()
112
+ return (
113
+ <div className={css({ display: 'grid', gap: '4' })}>
114
+ <Dialog.Root
115
+ {...args}
116
+ open={open}
117
+ onOpenChange={(details) => {
118
+ setOpen(details.open)
119
+ args.onOpenChange?.(details)
120
+ setLastEvent(details.open ? '已打开' : '已关闭')
121
+ }}
122
+ initialFocusEl={() => inputRef.current}>
123
+ <Dialog.Trigger asChild>
124
+ <Button colorPalette="lime">打开受控 Dialog</Button>
125
+ </Dialog.Trigger>
126
+ <Portal>
127
+ <Dialog.Backdrop />
128
+ <Dialog.Positioner>
129
+ <Dialog.Content>
130
+ <Dialog.Header>
131
+ <Dialog.Title>Dialog 验收</Dialog.Title>
132
+ <Dialog.Description>这个弹窗通过 Portal 渲染到页面根部。</Dialog.Description>
133
+ </Dialog.Header>
134
+ <Dialog.Body gap="4">
135
+ <label htmlFor={inputId}>打开后应自动聚焦这里</label>
136
+ <input
137
+ id={inputId}
138
+ ref={inputRef}
139
+ className={css({
140
+ borderWidth: '1px',
141
+ borderColor: 'border',
142
+ p: '2',
143
+ rounded: 'sm',
144
+ })}
145
+ placeholder="输入内容测试焦点"
146
+ />
147
+ <p>使用 Tab 和 Shift+Tab,焦点应始终停留在弹窗内部。</p>
148
+ <Dialog.ActionTrigger
149
+ asChild
150
+ onClick={(event) => {
151
+ event.preventDefault()
152
+ setBlocked((count) => count + 1)
153
+ }}>
154
+ <Button variant="outline">阻止关闭</Button>
155
+ </Dialog.ActionTrigger>
156
+ <p role="status">已阻止关闭 {blocked} 次</p>
157
+ {Array.from({ length: 12 }, (_, index) => (
158
+ <p key={index}>
159
+ 滚动内容 {index + 1}:长内容应在弹窗内部滚动,背景页面保持锁定。
160
+ </p>
161
+ ))}
162
+ </Dialog.Body>
163
+ <Dialog.Footer>
164
+ <Dialog.CloseTrigger asChild>
165
+ <Button variant="outline">取消</Button>
166
+ </Dialog.CloseTrigger>
167
+ <Dialog.ActionTrigger asChild onClick={() => setActions((count) => count + 1)}>
168
+ <Button colorPalette="lime">确认并关闭</Button>
169
+ </Dialog.ActionTrigger>
170
+ </Dialog.Footer>
171
+ </Dialog.Content>
172
+ </Dialog.Positioner>
173
+ </Portal>
174
+ </Dialog.Root>
175
+
176
+ <p role="status">
177
+ {lastEvent};确认动作执行 {actions} 次。
178
+ </p>
179
+ </div>
180
+ )
181
+ },
182
+ }
183
+
184
+ export const CustomSize: Story = {
185
+ parameters: { controls: { disable: true } },
186
+ render: () => (
187
+ <Dialog.Root size="unstyled">
188
+ <Dialog.Trigger asChild>
189
+ <Button variant="outline">打开自定尺寸 Dialog</Button>
190
+ </Dialog.Trigger>
191
+ <Portal>
192
+ <Dialog.Backdrop />
193
+ <Dialog.Positioner>
194
+ <Dialog.Content maxWidth="360px" p="4" gap="3" textStyle="sm">
195
+ <Dialog.Header gap="1">
196
+ <Dialog.Title textStyle="lg">紧凑弹窗</Dialog.Title>
197
+ <Dialog.Description textStyle="sm">
198
+ 自定尺寸,保留默认外观和焦点行为。
199
+ </Dialog.Description>
200
+ </Dialog.Header>
201
+ <Dialog.Body>宽度 360px,窄屏仍适应可用空间。</Dialog.Body>
202
+ <Dialog.Footer gap="2">
203
+ <Dialog.CloseTrigger asChild>
204
+ <Button size="sm">关闭</Button>
205
+ </Dialog.CloseTrigger>
206
+ </Dialog.Footer>
207
+ </Dialog.Content>
208
+ </Dialog.Positioner>
209
+ </Portal>
210
+ </Dialog.Root>
211
+ ),
212
+ }
213
+
214
+ export const Store: Story = {
215
+ parameters: {
216
+ controls: { disable: true },
217
+ docs: {
218
+ source: { type: 'code' },
219
+ description: { story: 'useDialog 与 RootProvider 共用 store,外部按钮打开弹窗并恢复焦点。' },
220
+ },
221
+ },
222
+ render: function Store(args) {
223
+ const triggerRef = useRef<HTMLButtonElement>(null)
224
+ const dialog = useDialog({
225
+ onOpenChange: args.onOpenChange,
226
+ finalFocusEl: () => triggerRef.current,
227
+ })
228
+ return (
229
+ <>
230
+ <Button ref={triggerRef} onClick={() => dialog.setOpen(true)}>
231
+ 通过 useDialog 打开
232
+ </Button>
233
+ <Dialog.RootProvider value={dialog}>
234
+ <Portal>
235
+ <Dialog.Backdrop />
236
+ <Dialog.Positioner>
237
+ <Dialog.Content>
238
+ <Dialog.Header>
239
+ <Dialog.Title>包级 hook 与 RootProvider</Dialog.Title>
240
+ <Dialog.Description>在组件外访问 store,无需额外导入 Ark。</Dialog.Description>
241
+ </Dialog.Header>
242
+ <Dialog.Body>外部按钮通过 dialog.setOpen(true) 打开此弹窗。</Dialog.Body>
243
+ <Dialog.Footer>
244
+ <Dialog.CloseTrigger asChild>
245
+ <Button variant="outline">关闭</Button>
246
+ </Dialog.CloseTrigger>
247
+ </Dialog.Footer>
248
+ </Dialog.Content>
249
+ </Dialog.Positioner>
250
+ </Portal>
251
+ </Dialog.RootProvider>
252
+ </>
253
+ )
254
+ },
255
+ }
@@ -0,0 +1,114 @@
1
+ import { Button, Drawer, Input, Portal } from '@repo/ui'
2
+ import { useId } from 'react'
3
+ import { css } from 'styled-system/css'
4
+
5
+ import type { Meta, StoryObj } from '@storybook/react-vite'
6
+
7
+ const meta = {
8
+ title: 'Overlays/Drawer',
9
+ component: Drawer.Root,
10
+ parameters: {
11
+ controls: { disable: true },
12
+ docs: {
13
+ source: { type: 'code' },
14
+ description: { component: '侧边、底部抽屉与尺寸定制。' },
15
+ },
16
+ },
17
+ } satisfies Meta<typeof Drawer.Root>
18
+ export default meta
19
+ type Story = StoryObj<typeof meta>
20
+ export const SideAndBottom: Story = {
21
+ render: function SideAndBottom() {
22
+ const drawer = Drawer.useDrawer()
23
+ const storyId = useId()
24
+ return (
25
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
26
+ <div className={css({ display: 'grid', gap: '3' })}>
27
+ <h3 className={css({ textStyle: 'lg', fontWeight: 'semibold' })}>侧边与底部 Drawer</h3>
28
+ <div className={css({ display: 'flex', flexWrap: 'wrap', gap: '3' })}>
29
+ <Drawer.RootProvider value={drawer} placement="end" size="md">
30
+ <Drawer.Trigger asChild>
31
+ <Button variant="outline">打开侧边抽屉</Button>
32
+ </Drawer.Trigger>
33
+ <Portal>
34
+ <Drawer.Backdrop />
35
+ <Drawer.Positioner>
36
+ <Drawer.Content>
37
+ <Drawer.Header>
38
+ <Drawer.Title>侧边抽屉</Drawer.Title>
39
+ <Drawer.Description>通过 useDrawer 与 RootProvider 组合。</Drawer.Description>
40
+ </Drawer.Header>
41
+ <Drawer.Body gap="3">
42
+ <label htmlFor={`${storyId}-drawer-note`}>输入内容</label>
43
+ <Input id={`${storyId}-drawer-note`} placeholder="测试焦点循环" />
44
+ {Array.from({ length: 20 }, (_, index) => (
45
+ <p key={index}>滚动内容 {index + 1}:长内容应在抽屉内部滚动。</p>
46
+ ))}
47
+ </Drawer.Body>
48
+ <Drawer.Footer>
49
+ <Drawer.CloseTrigger asChild>
50
+ <Button variant="outline">关闭</Button>
51
+ </Drawer.CloseTrigger>
52
+ </Drawer.Footer>
53
+ </Drawer.Content>
54
+ </Drawer.Positioner>
55
+ </Portal>
56
+ </Drawer.RootProvider>
57
+ <Drawer.Root placement="bottom" size="lg">
58
+ <Drawer.Trigger asChild>
59
+ <Button variant="outline">打开底部抽屉</Button>
60
+ </Drawer.Trigger>
61
+ <Portal>
62
+ <Drawer.Backdrop />
63
+ <Drawer.Positioner>
64
+ <Drawer.Content>
65
+ <Drawer.Header>
66
+ <Drawer.Title>底部抽屉</Drawer.Title>
67
+ <Drawer.Description>底部定位使用全宽布局。</Drawer.Description>
68
+ </Drawer.Header>
69
+ <Drawer.Body>支持遮罩、Escape 关闭,以及关闭后的焦点恢复。</Drawer.Body>
70
+ <Drawer.Footer>
71
+ <Drawer.CloseTrigger asChild>
72
+ <Button>完成</Button>
73
+ </Drawer.CloseTrigger>
74
+ </Drawer.Footer>
75
+ </Drawer.Content>
76
+ </Drawer.Positioner>
77
+ </Portal>
78
+ </Drawer.Root>
79
+ </div>
80
+ </div>
81
+ </div>
82
+ )
83
+ },
84
+ }
85
+ export const CustomSize: Story = {
86
+ render: function CustomSize() {
87
+ return (
88
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
89
+ <Drawer.Root size="unstyled" placement="end">
90
+ <Drawer.Trigger asChild>
91
+ <Button variant="outline">打开紧凑抽屉</Button>
92
+ </Drawer.Trigger>
93
+ <Portal>
94
+ <Drawer.Backdrop />
95
+ <Drawer.Positioner>
96
+ <Drawer.Content maxWidth="320px" p="4" gap="3">
97
+ <Drawer.Header gap="1">
98
+ <Drawer.Title textStyle="lg">紧凑抽屉</Drawer.Title>
99
+ <Drawer.Description textStyle="sm">自定宽度与内部间距。</Drawer.Description>
100
+ </Drawer.Header>
101
+ <Drawer.Body>默认滑入方向仍由 placement 决定。</Drawer.Body>
102
+ <Drawer.Footer gap="2">
103
+ <Drawer.CloseTrigger asChild>
104
+ <Button size="sm">关闭</Button>
105
+ </Drawer.CloseTrigger>
106
+ </Drawer.Footer>
107
+ </Drawer.Content>
108
+ </Drawer.Positioner>
109
+ </Portal>
110
+ </Drawer.Root>
111
+ </div>
112
+ )
113
+ },
114
+ }
@@ -0,0 +1,47 @@
1
+ import { HoverCard, Link, Portal } from '@repo/ui'
2
+
3
+ import { css } from 'styled-system/css'
4
+
5
+ import type { Meta, StoryObj } from '@storybook/react-vite'
6
+
7
+ const meta = {
8
+ title: 'Overlays/HoverCard',
9
+ component: HoverCard.Root,
10
+ parameters: {
11
+ controls: { disable: true },
12
+ docs: {
13
+ source: { type: 'code' },
14
+ description: { component: '悬停与聚焦时显示补充信息。' },
15
+ },
16
+ },
17
+ } satisfies Meta<typeof HoverCard.Root>
18
+ export default meta
19
+ type Story = StoryObj<typeof meta>
20
+ export const HoverAndFocus: Story = {
21
+ render: function HoverAndFocus() {
22
+ return (
23
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
24
+ <div className={css({ display: 'grid', gap: '3' })}>
25
+ <h3 className={css({ textStyle: 'lg', fontWeight: 'semibold' })}>HoverCard 补充信息</h3>
26
+ <HoverCard.Root openDelay={200} closeDelay={200} positioning={{ placement: 'top-start' }}>
27
+ <HoverCard.Trigger asChild>
28
+ <Link href="#overlay-heading">查看 UI 库信息</Link>
29
+ </HoverCard.Trigger>
30
+ <Portal>
31
+ <HoverCard.Positioner>
32
+ <HoverCard.Content>
33
+ <HoverCard.Arrow>
34
+ <HoverCard.ArrowTip />
35
+ </HoverCard.Arrow>
36
+ <strong>@repo/ui</strong>
37
+ <p>Ark 处理行为,Panda 生成样式,组件源码在仓库内维护。</p>
38
+ </HoverCard.Content>
39
+ </HoverCard.Positioner>
40
+ </Portal>
41
+ </HoverCard.Root>
42
+ <p>悬停或聚焦链接展示补充信息,移动到卡片时保持显示。</p>
43
+ </div>
44
+ </div>
45
+ )
46
+ },
47
+ }
@@ -0,0 +1,133 @@
1
+ import { Button, Menu, Portal } from '@repo/ui'
2
+ import { useState, useId } from 'react'
3
+ import { css } from 'styled-system/css'
4
+
5
+ import type { Meta, StoryObj } from '@storybook/react-vite'
6
+
7
+ const meta = {
8
+ title: 'Overlays/Menu',
9
+ component: Menu.Root,
10
+ parameters: {
11
+ controls: { disable: true },
12
+ docs: {
13
+ source: { type: 'code' },
14
+ description: { component: '菜单选择、复选与单选项以及右键菜单。' },
15
+ },
16
+ },
17
+ } satisfies Meta<typeof Menu.Root>
18
+ export default meta
19
+ type Story = StoryObj<typeof meta>
20
+ export const SelectionAndContextMenu: Story = {
21
+ render: function SelectionAndContextMenu() {
22
+ const [selection, setSelection] = useState('尚未选择')
23
+ const [notifications, setNotifications] = useState(true)
24
+ const [density, setDensity] = useState('comfortable')
25
+
26
+ const menu = Menu.useMenu({ onSelect: ({ value }) => setSelection(value) })
27
+
28
+ const storyId = useId()
29
+ return (
30
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
31
+ <div className={css({ display: 'grid', gap: '3' })}>
32
+ <h3 className={css({ textStyle: 'lg', fontWeight: 'semibold' })}>菜单选择与右键菜单</h3>
33
+ <Menu.RootProvider value={menu} size="md">
34
+ <Menu.Trigger asChild>
35
+ <Button variant="outline">
36
+ 打开菜单
37
+ <Menu.Indicator />
38
+ </Button>
39
+ </Menu.Trigger>
40
+ <Portal>
41
+ <Menu.Positioner>
42
+ <Menu.Content>
43
+ <Menu.ItemGroup id={`${storyId}-overlay-actions`}>
44
+ <Menu.ItemGroupLabel>操作</Menu.ItemGroupLabel>
45
+ <Menu.Item value="copy">复制</Menu.Item>
46
+ <Menu.Item value="disabled" disabled>
47
+ 禁用操作
48
+ </Menu.Item>
49
+ </Menu.ItemGroup>
50
+ <Menu.Separator />
51
+ <Menu.CheckboxItem
52
+ value="notifications"
53
+ checked={notifications}
54
+ onCheckedChange={setNotifications}
55
+ closeOnSelect={false}>
56
+ <Menu.ItemText>开启通知</Menu.ItemText>
57
+ <Menu.ItemIndicator />
58
+ </Menu.CheckboxItem>
59
+ <Menu.RadioItemGroup
60
+ id={`${storyId}-overlay-density`}
61
+ value={density}
62
+ onValueChange={({ value }) => setDensity(value)}>
63
+ <Menu.ItemGroupLabel>密度</Menu.ItemGroupLabel>
64
+ <Menu.RadioItem value="comfortable" closeOnSelect={false}>
65
+ <Menu.ItemText>舒适</Menu.ItemText>
66
+ <Menu.ItemIndicator />
67
+ </Menu.RadioItem>
68
+ <Menu.RadioItem value="compact" closeOnSelect={false}>
69
+ <Menu.ItemText>紧凑</Menu.ItemText>
70
+ <Menu.ItemIndicator asChild>
71
+ <span>✓</span>
72
+ </Menu.ItemIndicator>
73
+ </Menu.RadioItem>
74
+ </Menu.RadioItemGroup>
75
+ </Menu.Content>
76
+ </Menu.Positioner>
77
+ </Portal>
78
+ </Menu.RootProvider>
79
+ <Menu.Root onSelect={({ value }) => setSelection(value)}>
80
+ <Menu.ContextTrigger
81
+ className={css({
82
+ borderWidth: '1px',
83
+ borderStyle: 'dashed',
84
+ borderColor: 'border',
85
+ borderRadius: 'sm',
86
+ p: '4',
87
+ })}>
88
+ 在此区域右键,或长按触屏打开上下文菜单。
89
+ </Menu.ContextTrigger>
90
+ <Portal>
91
+ <Menu.Positioner>
92
+ <Menu.Content>
93
+ <Menu.Item value="refresh">刷新示例</Menu.Item>
94
+ <Menu.Item value="inspect">查看信息</Menu.Item>
95
+ </Menu.Content>
96
+ </Menu.Positioner>
97
+ </Portal>
98
+ </Menu.Root>
99
+ <p role="status">
100
+ 选择:{selection};通知:{notifications ? '开启' : '关闭'};密度:{density}
101
+ </p>
102
+ </div>
103
+ </div>
104
+ )
105
+ },
106
+ }
107
+ export const CustomSize: Story = {
108
+ render: function CustomSize() {
109
+ const [, setSelection] = useState('尚未选择')
110
+
111
+ return (
112
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
113
+ <Menu.Root size="unstyled" onSelect={({ value }) => setSelection(value)}>
114
+ <Menu.Trigger asChild>
115
+ <Button variant="outline">打开紧凑菜单</Button>
116
+ </Menu.Trigger>
117
+ <Portal>
118
+ <Menu.Positioner>
119
+ <Menu.Content minWidth="160px" maxHeight="240px" p="1" gap="1" textStyle="sm">
120
+ <Menu.Item value="compact-copy" px="2" minHeight="32px" gap="2">
121
+ 复制
122
+ </Menu.Item>
123
+ <Menu.Item value="compact-save" px="2" minHeight="32px" gap="2">
124
+ 保存
125
+ </Menu.Item>
126
+ </Menu.Content>
127
+ </Menu.Positioner>
128
+ </Portal>
129
+ </Menu.Root>
130
+ </div>
131
+ )
132
+ },
133
+ }