@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,302 @@
1
+ import {
2
+ Button,
3
+ DatePicker,
4
+ Heading,
5
+ Portal,
6
+ parseDate,
7
+ useDatePicker,
8
+ type DateValue,
9
+ } from '@repo/ui'
10
+ import { useRef, useState } from 'react'
11
+ import { hstack, vstack } from 'styled-system/patterns'
12
+ import { css } from 'styled-system/css'
13
+
14
+ import type { Meta, StoryObj } from '@storybook/react-vite'
15
+ const referenceDate = parseDate('2026-10-13')
16
+ function CalendarViews({
17
+ months = 1,
18
+ selectors = false,
19
+ }: {
20
+ months?: number
21
+ selectors?: boolean
22
+ }) {
23
+ return (
24
+ <>
25
+ <DatePicker.View view="day">
26
+ <DatePicker.Header />
27
+ {selectors && (
28
+ <div className={hstack({ gap: '2' })}>
29
+ <DatePicker.MonthSelect aria-label="月份" />
30
+ <DatePicker.YearSelect aria-label="年份" />
31
+ </div>
32
+ )}
33
+ <div className={hstack({ alignItems: 'start', gap: '4', flexWrap: 'wrap' })}>
34
+ {Array.from({ length: months }, (_, offset) => (
35
+ <DatePicker.DayTable key={offset} offset={offset} />
36
+ ))}
37
+ </div>
38
+ </DatePicker.View>
39
+ <DatePicker.View view="month">
40
+ <DatePicker.Header />
41
+ <DatePicker.MonthTable />
42
+ </DatePicker.View>
43
+ <DatePicker.View view="year">
44
+ <DatePicker.Header />
45
+ <DatePicker.YearTable />
46
+ </DatePicker.View>
47
+ </>
48
+ )
49
+ }
50
+ const meta = {
51
+ title: 'Date/DatePicker',
52
+ component: DatePicker.Root,
53
+ parameters: {
54
+ controls: { disable: true },
55
+ docs: {
56
+ source: { type: 'code' },
57
+ description: { component: '单日、范围、内联多选、日历视图和表单提交。' },
58
+ },
59
+ },
60
+ } satisfies Meta<typeof DatePicker.Root>
61
+ export default meta
62
+ type Story = StoryObj<typeof meta>
63
+ export const SingleDateForm: Story = {
64
+ render: function SingleDateForm() {
65
+ const [value, setValue] = useState<DateValue[]>([referenceDate])
66
+ const [disabled, setDisabled] = useState(false)
67
+ const [submitted, setSubmitted] = useState('')
68
+ const inputRef = useRef<HTMLInputElement>(null)
69
+ return (
70
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
71
+ <div className={hstack({ gap: '3', flexWrap: 'wrap' })}>
72
+ <Button variant="outline" onClick={() => inputRef.current?.focus()}>
73
+ 通过 ref 聚焦输入
74
+ </Button>
75
+ <Button variant="outline" onClick={() => setDisabled(!disabled)} aria-pressed={disabled}>
76
+ {disabled ? '启用' : '禁用'}
77
+ </Button>
78
+ <Button variant="plain" onClick={() => setValue([referenceDate])}>
79
+ 外部重置日期
80
+ </Button>
81
+ </div>
82
+ <form
83
+ className={vstack({ gap: '3', alignItems: 'start' })}
84
+ onSubmit={(event) => {
85
+ event.preventDefault()
86
+ const date = new FormData(event.currentTarget).get('appointment')
87
+ setSubmitted(typeof date === 'string' ? date : '')
88
+ }}>
89
+ <DatePicker.Root
90
+ lazyMount
91
+ value={value}
92
+ onValueChange={({ value }) => setValue(value)}
93
+ disabled={disabled}
94
+ locale="zh-CN"
95
+ name="appointment"
96
+ defaultFocusedValue={referenceDate}
97
+ width="72"
98
+ min={parseDate('2026-10-01')}
99
+ max={parseDate('2026-12-31')}
100
+ positioning={{ placement: 'bottom-start' }}>
101
+ <DatePicker.Label>受控日期 · 2026 年 10—12 月可选</DatePicker.Label>
102
+ <DatePicker.Control>
103
+ <DatePicker.Input ref={inputRef} aria-label="预约日期" />
104
+ <DatePicker.IndicatorGroup>
105
+ <DatePicker.ClearTrigger aria-label="清空日期" />
106
+ <DatePicker.Trigger aria-label="打开日历" />
107
+ </DatePicker.IndicatorGroup>
108
+ </DatePicker.Control>
109
+ <Portal>
110
+ <DatePicker.Positioner>
111
+ <DatePicker.Content aria-label="日期选择面板">
112
+ <CalendarViews selectors />
113
+ </DatePicker.Content>
114
+ </DatePicker.Positioner>
115
+ </Portal>
116
+ </DatePicker.Root>
117
+ <Button type="submit" disabled={disabled}>
118
+ 读取表单日期(不发送请求)
119
+ </Button>
120
+ </form>
121
+ <p role="status">
122
+ 已选择:{value.map((date) => date.toString()).join('、') || '无'};表单值:
123
+ {submitted || '尚未读取'}
124
+ </p>
125
+ </div>
126
+ )
127
+ },
128
+ }
129
+ export const Range: Story = {
130
+ render: function Range() {
131
+ const [range, setRange] = useState<DateValue[]>([referenceDate, referenceDate.add({ days: 4 })])
132
+ return (
133
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
134
+ <Heading size="md">双月范围 · 预设范围 · 240px 窄容器</Heading>
135
+ <DatePicker.Root
136
+ lazyMount
137
+ selectionMode="range"
138
+ numOfMonths={2}
139
+ value={range}
140
+ onValueChange={({ value }) => setRange(value)}
141
+ locale="zh-CN"
142
+ defaultFocusedValue={referenceDate}
143
+ size="sm"
144
+ variant="subtle"
145
+ width="full"
146
+ maxWidth="240px">
147
+ <DatePicker.Label>日期范围</DatePicker.Label>
148
+ <DatePicker.Control>
149
+ <DatePicker.Input index={0} aria-label="起始日期" />
150
+ <DatePicker.Input index={1} aria-label="结束日期" />
151
+ <DatePicker.Trigger aria-label="打开范围日历" />
152
+ </DatePicker.Control>
153
+ <Portal>
154
+ <DatePicker.Positioner>
155
+ <DatePicker.Content width="auto" aria-label="范围选择面板">
156
+ <CalendarViews months={2} />
157
+ <DatePicker.PresetTrigger value={[referenceDate, referenceDate.add({ days: 6 })]}>
158
+ 选择示例的一周
159
+ </DatePicker.PresetTrigger>
160
+ </DatePicker.Content>
161
+ </DatePicker.Positioner>
162
+ </Portal>
163
+ <DatePicker.ValueText placeholder="尚未选择范围" separator=" → " />
164
+ </DatePicker.Root>
165
+ </div>
166
+ )
167
+ },
168
+ }
169
+ export const InlineStore: Story = {
170
+ render: function InlineStore() {
171
+ const store = useDatePicker({
172
+ inline: true,
173
+ locale: 'zh-CN',
174
+ selectionMode: 'multiple',
175
+ showWeekNumbers: true,
176
+ defaultFocusedValue: referenceDate,
177
+ defaultValue: [referenceDate, referenceDate.add({ days: 2 })],
178
+ })
179
+ return (
180
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
181
+ <Heading size="md">内联多选 · 周数 · RootProvider</Heading>
182
+ <div className={hstack({ gap: '3', flexWrap: 'wrap' })}>
183
+ <Button variant="outline" onClick={() => store.setValue([])}>
184
+ 通过 store 清空
185
+ </Button>
186
+ <Button
187
+ variant="outline"
188
+ onClick={() => {
189
+ store.setFocusedValue(referenceDate)
190
+ store.setView('day')
191
+ }}>
192
+ 通过 store 返回示例月份
193
+ </Button>
194
+ </div>
195
+ <DatePicker.RootProvider value={store} size="xs" hideOutsideDays width="80">
196
+ <DatePicker.Label>多选日历</DatePicker.Label>
197
+ <CalendarViews />
198
+ <DatePicker.ValueText placeholder="选择任意多个日期">
199
+ {({ valueAsString, remove }) => (
200
+ <Button key={valueAsString} variant="outline" size="xs" onClick={remove}>
201
+ {valueAsString} ×
202
+ </Button>
203
+ )}
204
+ </DatePicker.ValueText>
205
+ </DatePicker.RootProvider>
206
+ </div>
207
+ )
208
+ },
209
+ }
210
+ export const ReadOnlyAndValue: Story = {
211
+ render: function ReadOnlyAndValue() {
212
+ return (
213
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
214
+ <Heading size="md">便捷 Value · 只读</Heading>
215
+ <DatePicker.Root
216
+ readOnly
217
+ defaultValue={[referenceDate]}
218
+ locale="zh-CN"
219
+ size="lg"
220
+ width="72">
221
+ <DatePicker.Label>只读日期</DatePicker.Label>
222
+ <DatePicker.Control>
223
+ <DatePicker.Input aria-label="只读日期" />
224
+ <DatePicker.Trigger aria-label="只读日历" />
225
+ </DatePicker.Control>
226
+ </DatePicker.Root>
227
+ <DatePicker.Root lazyMount defaultFocusedValue={referenceDate} locale="zh-CN" width="72">
228
+ <DatePicker.Value placeholder="选择一个日期" />
229
+ <Portal>
230
+ <DatePicker.Positioner>
231
+ <DatePicker.Content aria-label="便捷日期面板">
232
+ <CalendarViews />
233
+ </DatePicker.Content>
234
+ </DatePicker.Positioner>
235
+ </Portal>
236
+ </DatePicker.Root>
237
+ </div>
238
+ )
239
+ },
240
+ }
241
+ export const Customization: Story = {
242
+ render: function Customization() {
243
+ return (
244
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
245
+ <Heading size="md">分维度定制 · 紧凑日历</Heading>
246
+ <DatePicker.Root
247
+ size="unstyled"
248
+ inline
249
+ locale="zh-CN"
250
+ defaultFocusedValue={referenceDate}
251
+ defaultValue={[referenceDate]}
252
+ width="64"
253
+ gap="2"
254
+ css={{
255
+ '& [data-part=view]': { gap: '2' },
256
+ '& [data-part=view-control]': { height: '28px', gap: '2' },
257
+ '& [data-part=prev-trigger], & [data-part=next-trigger], & [data-part=view-trigger]': {
258
+ boxSize: '28px',
259
+ _icon: { boxSize: '3.5' },
260
+ },
261
+ '& [data-part=view-trigger]': { width: 'auto', textStyle: 'sm', px: '2' },
262
+ '& [data-part=table-header]': { width: '32px', py: '1', textStyle: 'xs' },
263
+ '& [data-part=table-cell]': { py: '0.5' },
264
+ '& [data-part=table-cell-trigger]': {
265
+ minWidth: '32px',
266
+ minHeight: '32px',
267
+ textStyle: 'sm',
268
+ },
269
+ }}>
270
+ <DatePicker.Label textStyle="sm">自定尺寸,保留选中与范围外观</DatePicker.Label>
271
+ <CalendarViews />
272
+ </DatePicker.Root>
273
+ <DatePicker.Root
274
+ variant="unstyled"
275
+ inline
276
+ locale="zh-CN"
277
+ defaultFocusedValue={referenceDate}
278
+ defaultValue={[referenceDate]}
279
+ width="72"
280
+ css={{
281
+ '& [data-part=table-cell-trigger]': {
282
+ borderRadius: 'full',
283
+ cursor: 'pointer',
284
+ focusVisibleRing: 'inside',
285
+ _hover: { bg: 'gray.3' },
286
+ '&[data-selected]': { bg: 'lime.9', color: 'gray.1' },
287
+ '&[data-outside-range]': { color: 'gray.8' },
288
+ },
289
+ '& [data-part=prev-trigger], & [data-part=next-trigger], & [data-part=view-trigger]': {
290
+ borderRadius: 'md',
291
+ cursor: 'pointer',
292
+ focusVisibleRing: 'inside',
293
+ _hover: { bg: 'gray.3' },
294
+ },
295
+ }}>
296
+ <DatePicker.Label>自定外观,保留 md 尺寸</DatePicker.Label>
297
+ <CalendarViews />
298
+ </DatePicker.Root>
299
+ </div>
300
+ )
301
+ },
302
+ }
@@ -0,0 +1,105 @@
1
+ import { Accordion, Button } from '@repo/ui'
2
+ import { useState } 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: 'Disclosure/Accordion',
9
+ component: Accordion.Root,
10
+ parameters: {
11
+ controls: { disable: true },
12
+ docs: {
13
+ source: { type: 'code' },
14
+ description: { component: '多项受控展开、禁用项与外观定制。' },
15
+ },
16
+ },
17
+ } satisfies Meta<typeof Accordion.Root>
18
+ export default meta
19
+ type Story = StoryObj<typeof meta>
20
+ export const ControlledMultiple: Story = {
21
+ render: function ControlledMultiple() {
22
+ const [expanded, setExpanded] = useState(['intro'])
23
+
24
+ return (
25
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
26
+ <p>Accordion 支持多项展开;方向键移动焦点并跳过禁用项,Enter/空格切换展开状态。</p>
27
+ <Accordion.Root
28
+ multiple
29
+ collapsible
30
+ value={expanded}
31
+ onValueChange={(details) => setExpanded(details.value)}
32
+ maxWidth="xl">
33
+ <Accordion.Item value="intro">
34
+ <h3>
35
+ <Accordion.ItemTrigger>
36
+ 组件说明
37
+ <Accordion.ItemIndicator />
38
+ </Accordion.ItemTrigger>
39
+ </h3>
40
+ <Accordion.ItemContent>
41
+ <Accordion.ItemBody>
42
+ 默认 outline 配方,内容展开时应有高度动画,箭头随状态旋转。
43
+ </Accordion.ItemBody>
44
+ </Accordion.ItemContent>
45
+ </Accordion.Item>
46
+ <Accordion.Item value="disabled" disabled>
47
+ <h3>
48
+ <Accordion.ItemTrigger>
49
+ 禁用项目
50
+ <Accordion.ItemIndicator />
51
+ </Accordion.ItemTrigger>
52
+ </h3>
53
+ <Accordion.ItemContent>
54
+ <Accordion.ItemBody>该项目不可展开。</Accordion.ItemBody>
55
+ </Accordion.ItemContent>
56
+ </Accordion.Item>
57
+ <Accordion.Item value="details">
58
+ <h3>
59
+ <Accordion.ItemTrigger>
60
+ 更多详情
61
+ <Accordion.ItemIndicator />
62
+ </Accordion.ItemTrigger>
63
+ </h3>
64
+ <Accordion.ItemContent>
65
+ <Accordion.ItemBody>此项可以与第一项同时展开,也可以单独收起。</Accordion.ItemBody>
66
+ </Accordion.ItemContent>
67
+ </Accordion.Item>
68
+ </Accordion.Root>
69
+ <div className={css({ display: 'flex', gap: '3', flexWrap: 'wrap' })}>
70
+ <Button type="button" variant="outline" onClick={() => setExpanded(['intro', 'details'])}>
71
+ 外部展开全部可用项目
72
+ </Button>
73
+ <Button type="button" variant="outline" onClick={() => setExpanded([])}>
74
+ 外部收起全部
75
+ </Button>
76
+ </div>
77
+ <p role="status">展开项目:{expanded.join('、') || '无'}</p>
78
+ </div>
79
+ )
80
+ },
81
+ }
82
+ export const CustomAppearance: Story = {
83
+ render: function CustomAppearance() {
84
+ return (
85
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
86
+ <p>自定外观保留默认尺寸与展开行为;系统开启减少动态效果时,内容直接展开/收起。</p>
87
+ <Accordion.Root variant="unstyled" collapsible maxWidth="xl">
88
+ <Accordion.Item value="custom" borderBottomWidth="1px" borderColor="lime.6">
89
+ <h3>
90
+ <Accordion.ItemTrigger color="lime.11" fontWeight="medium" focusVisibleRing="outside">
91
+ 自定外观
92
+ <Accordion.ItemIndicator color="lime.10" />
93
+ </Accordion.ItemTrigger>
94
+ </h3>
95
+ <Accordion.ItemContent>
96
+ <Accordion.ItemBody color="gray.fg.muted">
97
+ 内容与指示器仍跟随展开状态。
98
+ </Accordion.ItemBody>
99
+ </Accordion.ItemContent>
100
+ </Accordion.Item>
101
+ </Accordion.Root>
102
+ </div>
103
+ )
104
+ },
105
+ }
@@ -0,0 +1,55 @@
1
+ import { Button, Collapsible } from '@repo/ui'
2
+ import { useState } 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: 'Disclosure/Collapsible',
9
+ component: Collapsible.Root,
10
+ parameters: {
11
+ controls: { disable: true },
12
+ docs: {
13
+ source: { type: 'code' },
14
+ description: { component: '按需挂载、退出卸载与内容内关闭。' },
15
+ },
16
+ },
17
+ } satisfies Meta<typeof Collapsible.Root>
18
+ export default meta
19
+ type Story = StoryObj<typeof meta>
20
+ export const LazyMount: Story = {
21
+ render: function LazyMount() {
22
+ const [open, setOpen] = useState(false)
23
+
24
+ return (
25
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
26
+ <Collapsible.Root
27
+ open={open}
28
+ onOpenChange={(details) => setOpen(details.open)}
29
+ lazyMount
30
+ unmountOnExit
31
+ maxWidth="xl">
32
+ <Collapsible.Trigger asChild>
33
+ <Button type="button" variant="outline">
34
+ {open ? '收起详情' : '展开详情'}
35
+ </Button>
36
+ </Collapsible.Trigger>
37
+ <Collapsible.Content>
38
+ <div
39
+ className={css({
40
+ padding: '4',
41
+ borderWidth: '1px',
42
+ borderRadius: 'md',
43
+ marginTop: '3',
44
+ })}>
45
+ <p>首次展开才挂载,关闭动画结束后卸载。</p>
46
+ <Button type="button" variant="plain" onClick={() => setOpen(false)}>
47
+ 从内容内部关闭
48
+ </Button>
49
+ </div>
50
+ </Collapsible.Content>
51
+ </Collapsible.Root>
52
+ </div>
53
+ )
54
+ },
55
+ }
@@ -0,0 +1,208 @@
1
+ import { Button, Heading, Steps, useSteps } from '@repo/ui'
2
+ import { useState } from 'react'
3
+ import { css } from 'styled-system/css'
4
+ import { hstack, vstack } from 'styled-system/patterns'
5
+
6
+ import type { Meta, StoryObj } from '@storybook/react-vite'
7
+ const items = [
8
+ { title: '选择方案', description: '确认配置' },
9
+ { title: '填写信息', description: '完成资料' },
10
+ { title: '提交', description: '确认结果' },
11
+ ]
12
+ function StepList({ custom = false }: { custom?: boolean }) {
13
+ return (
14
+ <Steps.List>
15
+ {items.map((item, index) => (
16
+ <Steps.Item key={item.title} index={index}>
17
+ <Steps.Trigger>
18
+ {custom ? (
19
+ <Steps.Indicator>
20
+ <Steps.Status
21
+ complete={<span>✓</span>}
22
+ current={<span>●</span>}
23
+ incomplete={<span>○</span>}
24
+ />
25
+ </Steps.Indicator>
26
+ ) : (
27
+ <Steps.Indicator />
28
+ )}
29
+ <div>
30
+ <Steps.Title>{item.title}</Steps.Title>
31
+ <Steps.Description>{item.description}</Steps.Description>
32
+ </div>
33
+ </Steps.Trigger>
34
+ <Steps.Separator />
35
+ </Steps.Item>
36
+ ))}
37
+ </Steps.List>
38
+ )
39
+ }
40
+ const meta = {
41
+ title: 'Disclosure/Steps',
42
+ component: Steps.Root,
43
+ parameters: {
44
+ controls: { disable: true },
45
+ docs: {
46
+ source: { type: 'code' },
47
+ description: { component: '线性校验、完成状态、垂直布局与外部 store。' },
48
+ },
49
+ },
50
+ } satisfies Meta<typeof Steps.Root>
51
+ export default meta
52
+ type Story = StoryObj<typeof meta>
53
+ export const LinearValidation: Story = {
54
+ render: function LinearValidation() {
55
+ const [step, setStep] = useState(0)
56
+ const [valid, setValid] = useState(false)
57
+ const [message, setMessage] = useState('')
58
+
59
+ return (
60
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
61
+ <Heading size="md">受控流程 · 线性校验</Heading>
62
+ <Steps.Root
63
+ count={items.length}
64
+ step={step}
65
+ linear
66
+ isStepValid={(index) => index !== 1 || valid}
67
+ onStepChange={({ step: nextStep }) => {
68
+ setStep(nextStep)
69
+ setMessage('')
70
+ }}
71
+ onStepInvalid={() => setMessage('请先确认第二步资料,再继续。')}
72
+ onStepComplete={() => setMessage('已完成所有步骤。')}>
73
+ <StepList />
74
+ {items.map((item, index) => (
75
+ <Steps.Content key={item.title} index={index}>
76
+ <div className={vstack({ gap: '3', alignItems: 'start' })}>
77
+ <p>{item.title}的内容;线性模式请使用前后按钮依次完成。</p>
78
+ {index === 1 && (
79
+ <Button variant="outline" onClick={() => setValid(!valid)} aria-pressed={valid}>
80
+ {valid ? '资料已确认(点击撤销)' : '确认资料'}
81
+ </Button>
82
+ )}
83
+ </div>
84
+ </Steps.Content>
85
+ ))}
86
+ <Steps.CompletedContent>所有步骤已完成。</Steps.CompletedContent>
87
+ <div className={hstack({ gap: '3' })}>
88
+ <Steps.PrevTrigger asChild>
89
+ <Button variant="outline">上一步</Button>
90
+ </Steps.PrevTrigger>
91
+ <Steps.NextTrigger asChild>
92
+ <Button>下一步</Button>
93
+ </Steps.NextTrigger>
94
+ <Button
95
+ variant="plain"
96
+ onClick={() => {
97
+ setStep(0)
98
+ setValid(false)
99
+ setMessage('')
100
+ }}>
101
+ 重置
102
+ </Button>
103
+ </div>
104
+ </Steps.Root>
105
+ <p role="status" aria-live="polite">
106
+ {message || `当前步骤:${Math.min(step + 1, items.length)} / ${items.length}`}
107
+ </p>
108
+ </div>
109
+ )
110
+ },
111
+ }
112
+ export const VerticalStore: Story = {
113
+ render: function VerticalStore() {
114
+ const store = useSteps({ count: items.length, defaultStep: 1, orientation: 'vertical' })
115
+ return (
116
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
117
+ <Heading size="md">竖向 · RootProvider · 自定义状态图标</Heading>
118
+ <div className={hstack({ gap: '3', flexWrap: 'wrap' })}>
119
+ <Button variant="outline" onClick={() => store.resetStep()}>
120
+ 通过 store 重置
121
+ </Button>
122
+ <Button onClick={() => store.setStep(items.length)}>通过 store 完成</Button>
123
+ </div>
124
+ <Steps.RootProvider value={store} variant="subtle" size="sm" minH="64">
125
+ <StepList custom />
126
+ <div className={css({ flex: '1', minWidth: '0' })}>
127
+ {items.map((item, index) => (
128
+ <Steps.Content key={item.title} index={index}>
129
+ {item.description}
130
+ </Steps.Content>
131
+ ))}
132
+ <Steps.CompletedContent>store 流程已完成。</Steps.CompletedContent>
133
+ </div>
134
+ </Steps.RootProvider>
135
+ </div>
136
+ )
137
+ },
138
+ }
139
+ export const Variants: Story = {
140
+ tags: ['!dev'],
141
+ render: function Variants() {
142
+ return (
143
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
144
+ <Heading size="md">尺寸与自由组合</Heading>
145
+ <Steps.Root count={items.length} defaultStep={1} size="xs">
146
+ <StepList />
147
+ </Steps.Root>
148
+ <Steps.Root count={items.length} defaultStep={1} size="lg" variant="subtle">
149
+ <Steps.List>
150
+ {items.map((item, index) => (
151
+ <Steps.Item key={item.title} index={index}>
152
+ <Steps.Trigger aria-label={item.title}>
153
+ <Steps.Indicator>
154
+ <Steps.Status
155
+ complete={<span>✓</span>}
156
+ current={0}
157
+ incomplete={<Steps.Number />}
158
+ />
159
+ </Steps.Indicator>
160
+ </Steps.Trigger>
161
+ <Steps.Separator />
162
+ </Steps.Item>
163
+ ))}
164
+ </Steps.List>
165
+ </Steps.Root>
166
+ </div>
167
+ )
168
+ },
169
+ }
170
+ export const Customization: Story = {
171
+ render: function Customization() {
172
+ return (
173
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
174
+ <Heading size="md">分维度定制</Heading>
175
+ <Steps.Root
176
+ count={items.length}
177
+ defaultStep={1}
178
+ size="unstyled"
179
+ gap="3"
180
+ css={{
181
+ '& [data-part=list]': { textStyle: 'xs' },
182
+ '& [data-part=item], & [data-part=trigger]': { gap: '2' },
183
+ '& [data-part=indicator]': { boxSize: '28px', _icon: { boxSize: '14px' } },
184
+ '& [data-part=separator]': { height: '2px', mx: '2' },
185
+ '& [data-part=title]': { textStyle: 'xs' },
186
+ }}>
187
+ <StepList />
188
+ </Steps.Root>
189
+ <Steps.Root
190
+ count={items.length}
191
+ defaultStep={1}
192
+ variant="unstyled"
193
+ css={{
194
+ '& [data-part=indicator]': {
195
+ bg: 'lime.3',
196
+ color: 'lime.11',
197
+ borderRadius: 'sm',
198
+ '&[data-current]': { bg: 'lime.9', color: 'white' },
199
+ },
200
+ '& [data-part=separator]': { bg: 'lime.5' },
201
+ '& [data-part=trigger]': { focusVisibleRing: 'outside' },
202
+ }}>
203
+ <StepList />
204
+ </Steps.Root>
205
+ </div>
206
+ )
207
+ },
208
+ }