@oyolincc/create 0.4.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 (391) 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 +3 -3
  53. package/templates/hono-fullstack/apps/stack/frontend/routes/__root.tsx +1 -1
  54. package/templates/hono-fullstack/apps/stack/frontend/routes/index.tsx +16 -4
  55. package/templates/hono-fullstack/apps/stack/package.json +9 -4
  56. package/templates/hono-fullstack/apps/stack/panda.config.ts +31 -0
  57. package/templates/hono-fullstack/apps/stack/tsconfig.json +1 -0
  58. package/templates/hono-fullstack/apps/stack/turbo.json +20 -0
  59. package/templates/hono-fullstack/apps/stack/vite.config.ts +48 -12
  60. package/templates/hono-fullstack/apps/stack/wrangler.jsonc +1 -1
  61. package/templates/hono-fullstack/envs/.env.example.sqlite-d1 +1 -0
  62. package/templates/hono-fullstack/libs/db/drizzle-kit/sqlite-d1.config.ts +29 -10
  63. package/templates/hono-fullstack/libs/db/package.json +1 -0
  64. package/templates/hono-fullstack/libs/db/src/dialects/sqlite/schema/columns.ts +1 -1
  65. package/templates/hono-fullstack/libs/db/src/dialects/sqlite/schema/modules/examples/examples.ts +6 -3
  66. package/templates/hono-fullstack/libs/db/src/dialects/sqlite/schema/vo.ts +7 -1
  67. package/templates/hono-fullstack/libs/definition/README.md +81 -0
  68. package/templates/hono-fullstack/libs/definition/package.json +3 -1
  69. package/templates/hono-fullstack/libs/definition/src/constants/index.ts +1 -0
  70. package/templates/hono-fullstack/libs/definition/src/constants/pagination.ts +3 -0
  71. package/templates/hono-fullstack/libs/definition/src/modules/common-contracts.ts +24 -0
  72. package/templates/hono-fullstack/libs/definition/src/modules/example/contracts.ts +34 -0
  73. package/templates/hono-fullstack/libs/definition/src/modules/example/index.ts +1 -16
  74. package/templates/hono-fullstack/libs/definition/src/modules/index.ts +2 -0
  75. package/templates/hono-fullstack/libs/definition/src/modules/vo-generated-types.ts +12 -0
  76. package/templates/hono-fullstack/libs/ui/.storybook/main.ts +32 -0
  77. package/templates/hono-fullstack/libs/ui/.storybook/panda.config.ts +22 -0
  78. package/templates/hono-fullstack/libs/ui/.storybook/preview.tsx +79 -0
  79. package/templates/hono-fullstack/libs/ui/.storybook/styles.css +1 -0
  80. package/templates/hono-fullstack/libs/ui/.storybook/vite.config.ts +37 -0
  81. package/templates/hono-fullstack/libs/ui/components.json +15 -0
  82. package/templates/hono-fullstack/libs/ui/package.json +114 -0
  83. package/templates/hono-fullstack/libs/ui/panda.config.ts +41 -0
  84. package/templates/hono-fullstack/libs/ui/src/Tooltip.tsx +47 -0
  85. package/templates/hono-fullstack/libs/ui/src/components/atoms/buttons/Button.tsx +80 -0
  86. package/templates/hono-fullstack/libs/ui/src/components/atoms/buttons/CloseButton.tsx +15 -0
  87. package/templates/hono-fullstack/libs/ui/src/components/atoms/buttons/IconButton.tsx +10 -0
  88. package/templates/hono-fullstack/libs/ui/src/components/atoms/collections/Combobox.tsx +91 -0
  89. package/templates/hono-fullstack/libs/ui/src/components/atoms/collections/Select.tsx +88 -0
  90. package/templates/hono-fullstack/libs/ui/src/components/atoms/collections/TreeView.tsx +142 -0
  91. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Avatar.tsx +64 -0
  92. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Badge.tsx +7 -0
  93. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Card.tsx +23 -0
  94. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Clipboard.tsx +77 -0
  95. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Icon.tsx +9 -0
  96. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Table.tsx +51 -0
  97. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Tag.tsx +23 -0
  98. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Timeline.tsx +33 -0
  99. package/templates/hono-fullstack/libs/ui/src/components/atoms/date-and-time/DatePicker.tsx +255 -0
  100. package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Accordion.tsx +48 -0
  101. package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Breadcrumb.tsx +50 -0
  102. package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Collapsible.tsx +34 -0
  103. package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Pagination.tsx +74 -0
  104. package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Steps.tsx +91 -0
  105. package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Tabs.tsx +37 -0
  106. package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Alert.tsx +52 -0
  107. package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Progress.tsx +41 -0
  108. package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/ProgressCircle.tsx +40 -0
  109. package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Skeleton.tsx +37 -0
  110. package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Spinner.tsx +7 -0
  111. package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Toast.tsx +99 -0
  112. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Checkbox.tsx +95 -0
  113. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/ColorPicker.tsx +148 -0
  114. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Editable.tsx +44 -0
  115. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Field.tsx +36 -0
  116. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Fieldset.tsx +34 -0
  117. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/FileUpload.tsx +143 -0
  118. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Input.tsx +7 -0
  119. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/InputAddon.tsx +7 -0
  120. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/InputGroup.tsx +61 -0
  121. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/NativeSelect.tsx +81 -0
  122. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/NumberInput.tsx +63 -0
  123. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/PasswordInput.tsx +76 -0
  124. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/PinInput.tsx +36 -0
  125. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/RadioCard.tsx +96 -0
  126. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/RadioGroup.tsx +61 -0
  127. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/RatingGroup.tsx +106 -0
  128. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/SegmentGroup.tsx +68 -0
  129. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Slider.tsx +87 -0
  130. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Switch.tsx +74 -0
  131. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/TagsInput.tsx +77 -0
  132. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Textarea.tsx +7 -0
  133. package/templates/hono-fullstack/libs/ui/src/components/atoms/index.ts +98 -0
  134. package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/AbsoluteCenter.tsx +7 -0
  135. package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/Loader.tsx +69 -0
  136. package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/Span.tsx +5 -0
  137. package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/create-layout.ts +18 -0
  138. package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Float.tsx +7 -0
  139. package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Grid.tsx +17 -0
  140. package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Group.tsx +7 -0
  141. package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/ScrollArea.tsx +46 -0
  142. package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Separator.tsx +26 -0
  143. package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Stack.tsx +54 -0
  144. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Dialog.tsx +69 -0
  145. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Drawer.tsx +49 -0
  146. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/HoverCard.tsx +37 -0
  147. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Menu.tsx +74 -0
  148. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/OverlayManager.test.ts +124 -0
  149. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/OverlayManager.tsx +189 -0
  150. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Popover.tsx +57 -0
  151. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Tooltip.tsx +37 -0
  152. package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/Heading.tsx +6 -0
  153. package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/Link.tsx +7 -0
  154. package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/LinkOverlay.tsx +21 -0
  155. package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/Text.tsx +6 -0
  156. package/templates/hono-fullstack/libs/ui/src/components/atoms/utilities/VisuallyHidden.tsx +13 -0
  157. package/templates/hono-fullstack/libs/ui/src/hooks.ts +242 -0
  158. package/templates/hono-fullstack/libs/ui/src/index.ts +19 -0
  159. package/templates/hono-fullstack/libs/ui/src/theme/animation-styles.ts +50 -0
  160. package/templates/hono-fullstack/libs/ui/src/theme/breakpoints.ts +7 -0
  161. package/templates/hono-fullstack/libs/ui/src/theme/conditions.ts +12 -0
  162. package/templates/hono-fullstack/libs/ui/src/theme/containers.ts +16 -0
  163. package/templates/hono-fullstack/libs/ui/src/theme/global-css.ts +12 -0
  164. package/templates/hono-fullstack/libs/ui/src/theme/keyframes.ts +157 -0
  165. package/templates/hono-fullstack/libs/ui/src/theme/layer-styles.ts +11 -0
  166. package/templates/hono-fullstack/libs/ui/src/theme/patterns/grid.ts +51 -0
  167. package/templates/hono-fullstack/libs/ui/src/theme/patterns/index.ts +60 -0
  168. package/templates/hono-fullstack/libs/ui/src/theme/patterns/stack.ts +46 -0
  169. package/templates/hono-fullstack/libs/ui/src/theme/recipes/absolute-center.ts +38 -0
  170. package/templates/hono-fullstack/libs/ui/src/theme/recipes/accordion.ts +68 -0
  171. package/templates/hono-fullstack/libs/ui/src/theme/recipes/alert.ts +83 -0
  172. package/templates/hono-fullstack/libs/ui/src/theme/recipes/avatar.ts +155 -0
  173. package/templates/hono-fullstack/libs/ui/src/theme/recipes/badge.ts +67 -0
  174. package/templates/hono-fullstack/libs/ui/src/theme/recipes/breadcrumb.ts +69 -0
  175. package/templates/hono-fullstack/libs/ui/src/theme/recipes/button.ts +149 -0
  176. package/templates/hono-fullstack/libs/ui/src/theme/recipes/card.ts +36 -0
  177. package/templates/hono-fullstack/libs/ui/src/theme/recipes/checkbox.ts +120 -0
  178. package/templates/hono-fullstack/libs/ui/src/theme/recipes/clipboard.ts +22 -0
  179. package/templates/hono-fullstack/libs/ui/src/theme/recipes/collapsible.ts +26 -0
  180. package/templates/hono-fullstack/libs/ui/src/theme/recipes/color-picker.ts +299 -0
  181. package/templates/hono-fullstack/libs/ui/src/theme/recipes/combobox.ts +141 -0
  182. package/templates/hono-fullstack/libs/ui/src/theme/recipes/date-picker.ts +302 -0
  183. package/templates/hono-fullstack/libs/ui/src/theme/recipes/dialog.ts +191 -0
  184. package/templates/hono-fullstack/libs/ui/src/theme/recipes/drawer.ts +170 -0
  185. package/templates/hono-fullstack/libs/ui/src/theme/recipes/editable.ts +64 -0
  186. package/templates/hono-fullstack/libs/ui/src/theme/recipes/field.ts +41 -0
  187. package/templates/hono-fullstack/libs/ui/src/theme/recipes/fieldset.ts +47 -0
  188. package/templates/hono-fullstack/libs/ui/src/theme/recipes/file-upload.ts +86 -0
  189. package/templates/hono-fullstack/libs/ui/src/theme/recipes/group.ts +78 -0
  190. package/templates/hono-fullstack/libs/ui/src/theme/recipes/heading.ts +24 -0
  191. package/templates/hono-fullstack/libs/ui/src/theme/recipes/hover-card.ts +47 -0
  192. package/templates/hono-fullstack/libs/ui/src/theme/recipes/icon.ts +25 -0
  193. package/templates/hono-fullstack/libs/ui/src/theme/recipes/index.ts +120 -0
  194. package/templates/hono-fullstack/libs/ui/src/theme/recipes/input-addon.ts +51 -0
  195. package/templates/hono-fullstack/libs/ui/src/theme/recipes/input-group.ts +77 -0
  196. package/templates/hono-fullstack/libs/ui/src/theme/recipes/input.ts +99 -0
  197. package/templates/hono-fullstack/libs/ui/src/theme/recipes/link.ts +36 -0
  198. package/templates/hono-fullstack/libs/ui/src/theme/recipes/menu.ts +114 -0
  199. package/templates/hono-fullstack/libs/ui/src/theme/recipes/native-select.ts +92 -0
  200. package/templates/hono-fullstack/libs/ui/src/theme/recipes/number-input.ts +91 -0
  201. package/templates/hono-fullstack/libs/ui/src/theme/recipes/pagination.ts +9 -0
  202. package/templates/hono-fullstack/libs/ui/src/theme/recipes/pin-input.ts +33 -0
  203. package/templates/hono-fullstack/libs/ui/src/theme/recipes/popover.ts +78 -0
  204. package/templates/hono-fullstack/libs/ui/src/theme/recipes/progress-circle.ts +50 -0
  205. package/templates/hono-fullstack/libs/ui/src/theme/recipes/progress.ts +112 -0
  206. package/templates/hono-fullstack/libs/ui/src/theme/recipes/radio-card.ts +223 -0
  207. package/templates/hono-fullstack/libs/ui/src/theme/recipes/radio-group.ts +78 -0
  208. package/templates/hono-fullstack/libs/ui/src/theme/recipes/rating-group.ts +98 -0
  209. package/templates/hono-fullstack/libs/ui/src/theme/recipes/scroll-area.ts +119 -0
  210. package/templates/hono-fullstack/libs/ui/src/theme/recipes/segment-group.ts +162 -0
  211. package/templates/hono-fullstack/libs/ui/src/theme/recipes/select.ts +157 -0
  212. package/templates/hono-fullstack/libs/ui/src/theme/recipes/separator.ts +25 -0
  213. package/templates/hono-fullstack/libs/ui/src/theme/recipes/skeleton.ts +65 -0
  214. package/templates/hono-fullstack/libs/ui/src/theme/recipes/slider.ts +164 -0
  215. package/templates/hono-fullstack/libs/ui/src/theme/recipes/spinner.ts +34 -0
  216. package/templates/hono-fullstack/libs/ui/src/theme/recipes/steps.ts +162 -0
  217. package/templates/hono-fullstack/libs/ui/src/theme/recipes/switch.ts +150 -0
  218. package/templates/hono-fullstack/libs/ui/src/theme/recipes/table.ts +150 -0
  219. package/templates/hono-fullstack/libs/ui/src/theme/recipes/tabs.ts +128 -0
  220. package/templates/hono-fullstack/libs/ui/src/theme/recipes/tag.ts +114 -0
  221. package/templates/hono-fullstack/libs/ui/src/theme/recipes/tags-input.ts +201 -0
  222. package/templates/hono-fullstack/libs/ui/src/theme/recipes/text.ts +7 -0
  223. package/templates/hono-fullstack/libs/ui/src/theme/recipes/textarea.ts +90 -0
  224. package/templates/hono-fullstack/libs/ui/src/theme/recipes/timeline.ts +137 -0
  225. package/templates/hono-fullstack/libs/ui/src/theme/recipes/toast.ts +52 -0
  226. package/templates/hono-fullstack/libs/ui/src/theme/recipes/tooltip.ts +44 -0
  227. package/templates/hono-fullstack/libs/ui/src/theme/recipes/tree-view.ts +200 -0
  228. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/amber.ts +91 -0
  229. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/gray.ts +103 -0
  230. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/green.ts +88 -0
  231. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/index.ts +14 -0
  232. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/lime.ts +91 -0
  233. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/red.ts +88 -0
  234. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/index.ts +8 -0
  235. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/shadows.ts +46 -0
  236. package/templates/hono-fullstack/libs/ui/src/theme/text-styles.ts +82 -0
  237. package/templates/hono-fullstack/libs/ui/src/theme/tokens/animations.ts +8 -0
  238. package/templates/hono-fullstack/libs/ui/src/theme/tokens/aspect-ratio.ts +6 -0
  239. package/templates/hono-fullstack/libs/ui/src/theme/tokens/borders.ts +5 -0
  240. package/templates/hono-fullstack/libs/ui/src/theme/tokens/colors.ts +35 -0
  241. package/templates/hono-fullstack/libs/ui/src/theme/tokens/durations.ts +11 -0
  242. package/templates/hono-fullstack/libs/ui/src/theme/tokens/easings.ts +9 -0
  243. package/templates/hono-fullstack/libs/ui/src/theme/tokens/index.ts +42 -0
  244. package/templates/hono-fullstack/libs/ui/src/theme/tokens/radii.ts +13 -0
  245. package/templates/hono-fullstack/libs/ui/src/theme/tokens/sizes.ts +27 -0
  246. package/templates/hono-fullstack/libs/ui/src/theme/tokens/spacing.ts +41 -0
  247. package/templates/hono-fullstack/libs/ui/src/theme/tokens/typography.ts +86 -0
  248. package/templates/hono-fullstack/libs/ui/src/theme/tokens/z-index.ts +43 -0
  249. package/templates/hono-fullstack/libs/ui/stories/README.md +107 -0
  250. package/templates/hono-fullstack/libs/ui/stories/actions/Button.stories.tsx +260 -0
  251. package/templates/hono-fullstack/libs/ui/stories/actions/Clipboard.stories.tsx +87 -0
  252. package/templates/hono-fullstack/libs/ui/stories/actions/IconButton.stories.tsx +33 -0
  253. package/templates/hono-fullstack/libs/ui/stories/collections/Combobox.stories.tsx +334 -0
  254. package/templates/hono-fullstack/libs/ui/stories/collections/Select.stories.tsx +342 -0
  255. package/templates/hono-fullstack/libs/ui/stories/collections/TreeView.stories.tsx +252 -0
  256. package/templates/hono-fullstack/libs/ui/stories/color/ColorPicker.stories.tsx +217 -0
  257. package/templates/hono-fullstack/libs/ui/stories/date/DatePicker.stories.tsx +302 -0
  258. package/templates/hono-fullstack/libs/ui/stories/disclosure/Accordion.stories.tsx +105 -0
  259. package/templates/hono-fullstack/libs/ui/stories/disclosure/Collapsible.stories.tsx +55 -0
  260. package/templates/hono-fullstack/libs/ui/stories/disclosure/Steps.stories.tsx +208 -0
  261. package/templates/hono-fullstack/libs/ui/stories/disclosure/Tabs.stories.tsx +176 -0
  262. package/templates/hono-fullstack/libs/ui/stories/display/Avatar.stories.tsx +108 -0
  263. package/templates/hono-fullstack/libs/ui/stories/display/Badge.stories.tsx +90 -0
  264. package/templates/hono-fullstack/libs/ui/stories/display/Card.stories.tsx +121 -0
  265. package/templates/hono-fullstack/libs/ui/stories/display/Heading.stories.tsx +62 -0
  266. package/templates/hono-fullstack/libs/ui/stories/display/Icon.stories.tsx +51 -0
  267. package/templates/hono-fullstack/libs/ui/stories/display/Table.stories.tsx +222 -0
  268. package/templates/hono-fullstack/libs/ui/stories/display/Tag.stories.tsx +168 -0
  269. package/templates/hono-fullstack/libs/ui/stories/display/Text.stories.tsx +32 -0
  270. package/templates/hono-fullstack/libs/ui/stories/display/Timeline.stories.tsx +241 -0
  271. package/templates/hono-fullstack/libs/ui/stories/feedback/Alert.stories.tsx +122 -0
  272. package/templates/hono-fullstack/libs/ui/stories/feedback/Progress.stories.tsx +163 -0
  273. package/templates/hono-fullstack/libs/ui/stories/feedback/ProgressCircle.stories.tsx +176 -0
  274. package/templates/hono-fullstack/libs/ui/stories/feedback/Skeleton.stories.tsx +75 -0
  275. package/templates/hono-fullstack/libs/ui/stories/feedback/Spinner.stories.tsx +49 -0
  276. package/templates/hono-fullstack/libs/ui/stories/feedback/Toast.stories.tsx +145 -0
  277. package/templates/hono-fullstack/libs/ui/stories/forms/Checkbox.stories.tsx +281 -0
  278. package/templates/hono-fullstack/libs/ui/stories/forms/Editable.stories.tsx +94 -0
  279. package/templates/hono-fullstack/libs/ui/stories/forms/Field.stories.tsx +72 -0
  280. package/templates/hono-fullstack/libs/ui/stories/forms/Fieldset.stories.tsx +109 -0
  281. package/templates/hono-fullstack/libs/ui/stories/forms/FileUpload.stories.tsx +115 -0
  282. package/templates/hono-fullstack/libs/ui/stories/forms/Form.stories.tsx +120 -0
  283. package/templates/hono-fullstack/libs/ui/stories/forms/Input.stories.tsx +155 -0
  284. package/templates/hono-fullstack/libs/ui/stories/forms/InputGroup.stories.tsx +79 -0
  285. package/templates/hono-fullstack/libs/ui/stories/forms/NativeSelect.stories.tsx +160 -0
  286. package/templates/hono-fullstack/libs/ui/stories/forms/NumberInput.stories.tsx +149 -0
  287. package/templates/hono-fullstack/libs/ui/stories/forms/PasswordInput.stories.tsx +141 -0
  288. package/templates/hono-fullstack/libs/ui/stories/forms/PinInput.stories.tsx +155 -0
  289. package/templates/hono-fullstack/libs/ui/stories/forms/RadioCard.stories.tsx +265 -0
  290. package/templates/hono-fullstack/libs/ui/stories/forms/RadioGroup.stories.tsx +109 -0
  291. package/templates/hono-fullstack/libs/ui/stories/forms/RatingGroup.stories.tsx +123 -0
  292. package/templates/hono-fullstack/libs/ui/stories/forms/SegmentGroup.stories.tsx +130 -0
  293. package/templates/hono-fullstack/libs/ui/stories/forms/Slider.stories.tsx +190 -0
  294. package/templates/hono-fullstack/libs/ui/stories/forms/Switch.stories.tsx +124 -0
  295. package/templates/hono-fullstack/libs/ui/stories/forms/TagsInput.stories.tsx +154 -0
  296. package/templates/hono-fullstack/libs/ui/stories/forms/Textarea.stories.tsx +148 -0
  297. package/templates/hono-fullstack/libs/ui/stories/layout/Grid.stories.tsx +60 -0
  298. package/templates/hono-fullstack/libs/ui/stories/layout/Positioning.stories.tsx +90 -0
  299. package/templates/hono-fullstack/libs/ui/stories/layout/ScrollArea.stories.tsx +68 -0
  300. package/templates/hono-fullstack/libs/ui/stories/layout/Stack.stories.tsx +87 -0
  301. package/templates/hono-fullstack/libs/ui/stories/navigation/Breadcrumb.stories.tsx +104 -0
  302. package/templates/hono-fullstack/libs/ui/stories/navigation/Link.stories.tsx +62 -0
  303. package/templates/hono-fullstack/libs/ui/stories/navigation/LinkBox.stories.tsx +45 -0
  304. package/templates/hono-fullstack/libs/ui/stories/navigation/Pagination.stories.tsx +74 -0
  305. package/templates/hono-fullstack/libs/ui/stories/overlays/Dialog.stories.tsx +255 -0
  306. package/templates/hono-fullstack/libs/ui/stories/overlays/Drawer.stories.tsx +114 -0
  307. package/templates/hono-fullstack/libs/ui/stories/overlays/HoverCard.stories.tsx +47 -0
  308. package/templates/hono-fullstack/libs/ui/stories/overlays/Menu.stories.tsx +133 -0
  309. package/templates/hono-fullstack/libs/ui/stories/overlays/OverlayManager.stories.tsx +206 -0
  310. package/templates/hono-fullstack/libs/ui/stories/overlays/Popover.stories.tsx +73 -0
  311. package/templates/hono-fullstack/libs/ui/stories/overlays/Tooltip.stories.tsx +114 -0
  312. package/templates/hono-fullstack/libs/ui/stories/tsconfig.json +14 -0
  313. package/templates/hono-fullstack/libs/ui/tsconfig.build.json +5 -0
  314. package/templates/hono-fullstack/libs/ui/tsconfig.json +13 -0
  315. package/templates/hono-fullstack/libs/ui/turbo.json +28 -0
  316. package/templates/hono-fullstack/libs/ui/vite.config.ts +33 -0
  317. package/templates/hono-fullstack/oyo.config.json +30 -4
  318. package/templates/hono-fullstack/package.json +1 -0
  319. package/templates/hono-fullstack/pnpm-workspace.yaml +20 -10
  320. package/templates/hono-fullstack/turbo.json +10 -0
  321. package/templates/hono-server/.codegraph/.gitignore +5 -0
  322. package/templates/hono-server/README.md +9 -1
  323. package/templates/hono-server/_gitignore +1 -0
  324. package/templates/hono-server/apps/server/package.json +7 -2
  325. package/templates/hono-server/apps/server/src/adapters/cloudflare/entry.ts +4 -30
  326. package/templates/hono-server/apps/server/src/adapters/nodejs/bootstrap.ts +20 -12
  327. package/templates/hono-server/apps/server/src/adapters/nodejs/entry.ts +7 -57
  328. package/templates/hono-server/apps/server/src/app.ts +37 -21
  329. package/templates/hono-server/apps/server/src/config.ts +1 -1
  330. package/templates/hono-server/apps/server/src/di-container.ts +51 -0
  331. package/templates/hono-server/apps/server/src/infra/logger/getter.ts +1 -1
  332. package/templates/hono-server/apps/server/src/infra/logger/pino.ts +21 -34
  333. package/templates/hono-server/apps/server/src/infra/work-runner/errors.ts +22 -0
  334. package/templates/hono-server/apps/server/src/infra/work-runner/pass-through/runner.ts +28 -22
  335. package/templates/hono-server/apps/server/src/infra/work-runner/piscina/runner.ts +11 -34
  336. package/templates/hono-server/apps/server/src/infra/work-runner/{example → piscina}/worker-entry.ts +6 -2
  337. package/templates/hono-server/apps/server/src/infra/work-runner/types.ts +2 -16
  338. package/templates/hono-server/apps/server/src/infra/work-runner/utils/business-error.ts +10 -5
  339. package/templates/hono-server/apps/server/src/infra/work-runner/utils/message.ts +5 -17
  340. package/templates/hono-server/apps/server/src/middlewares/cors.ts +16 -22
  341. package/templates/hono-server/apps/server/src/middlewares/logger.ts +34 -0
  342. package/templates/hono-server/apps/server/src/modules/example/module.ts +8 -0
  343. package/templates/hono-server/apps/server/src/modules/example/queries.ts +8 -0
  344. package/templates/hono-server/apps/server/src/modules/example/routes.ts +74 -68
  345. package/templates/hono-server/apps/server/src/modules/example/service.test.ts +53 -0
  346. package/templates/hono-server/apps/server/src/modules/example/service.ts +54 -0
  347. package/templates/hono-server/apps/server/src/modules/example/types.ts +12 -0
  348. package/templates/hono-server/apps/server/src/modules/example/work-task/tasks.test.ts +9 -35
  349. package/templates/hono-server/apps/server/src/modules/example/work-task/tasks.ts +15 -46
  350. package/templates/hono-server/apps/server/src/shared/errors/defs/index.ts +6 -1
  351. package/templates/hono-server/apps/server/src/shared/errors/handler.ts +1 -1
  352. package/templates/hono-server/apps/server/src/shared/network/openapi/index.ts +1 -1
  353. package/templates/hono-server/apps/server/src/shared/types/app.ts +51 -0
  354. package/templates/hono-server/apps/server/src/shared/types/db.ts +126 -0
  355. package/templates/hono-server/apps/server/src/shared/utils/data-access/check.ts +19 -0
  356. package/templates/hono-server/apps/server/src/shared/utils/data-access/model.ts +47 -0
  357. package/templates/hono-server/apps/server/src/shared/utils/data-access/params.ts +105 -0
  358. package/templates/hono-server/apps/server/src/shared/utils/data-access/query.test.ts +139 -0
  359. package/templates/hono-server/apps/server/src/shared/utils/data-access/query.ts +236 -0
  360. package/templates/hono-server/apps/server/vite.config.ts +2 -2
  361. package/templates/hono-server/apps/server/wrangler.jsonc +1 -1
  362. package/templates/hono-server/docker/README.md +1 -1
  363. package/templates/hono-server/envs/.env.example.sqlite-d1 +1 -0
  364. package/templates/hono-server/libs/db/drizzle-kit/sqlite-d1.config.ts +29 -10
  365. package/templates/hono-server/libs/db/package.json +1 -0
  366. package/templates/hono-server/libs/db/src/dialects/sqlite/schema/columns.ts +1 -1
  367. package/templates/hono-server/libs/db/src/dialects/sqlite/schema/modules/examples/examples.ts +6 -3
  368. package/templates/hono-server/libs/db/src/dialects/sqlite/schema/vo.ts +7 -1
  369. package/templates/hono-server/libs/definition/README.md +81 -0
  370. package/templates/hono-server/libs/definition/package.json +3 -1
  371. package/templates/hono-server/libs/definition/src/constants/index.ts +1 -0
  372. package/templates/hono-server/libs/definition/src/constants/pagination.ts +3 -0
  373. package/templates/hono-server/libs/definition/src/modules/common-contracts.ts +24 -0
  374. package/templates/hono-server/libs/definition/src/modules/example/contracts.ts +34 -0
  375. package/templates/hono-server/libs/definition/src/modules/example/index.ts +1 -16
  376. package/templates/hono-server/libs/definition/src/modules/index.ts +2 -0
  377. package/templates/hono-server/libs/definition/src/modules/vo-generated-types.ts +12 -0
  378. package/templates/hono-server/oyo.config.json +30 -4
  379. package/templates/hono-server/package.json +1 -0
  380. package/templates/hono-server/pnpm-workspace.yaml +9 -7
  381. package/templates/hono-server/turbo.json +10 -0
  382. package/templates/monorepo/.codegraph/.gitignore +5 -0
  383. package/templates/monorepo/_gitignore +1 -0
  384. package/templates/monorepo/oyo.config.json +6 -4
  385. package/templates/monorepo/pnpm-workspace.yaml +4 -4
  386. package/templates/monorepo/turbo.json +10 -0
  387. package/templates/hono-fullstack/apps/server/src/modules/example/contracts.ts +0 -9
  388. package/templates/hono-fullstack/apps/server/src/shared/app/types.ts +0 -44
  389. package/templates/hono-fullstack/apps/stack/frontend/styles.css +0 -23
  390. package/templates/hono-server/apps/server/src/modules/example/contracts.ts +0 -9
  391. package/templates/hono-server/apps/server/src/shared/app/types.ts +0 -44
@@ -0,0 +1,190 @@
1
+ import { fn } from 'storybook/test'
2
+ import { Button, Slider } from '@repo/ui'
3
+ import { useState } from 'react'
4
+ import { css } from 'styled-system/css'
5
+
6
+ import type { Meta, StoryObj } from '@storybook/react-vite'
7
+
8
+ const meta = {
9
+ title: 'Forms/Slider',
10
+ component: Slider.Root,
11
+ args: {
12
+ orientation: 'horizontal',
13
+ size: 'md',
14
+ variant: 'outline',
15
+ min: 0,
16
+ max: 100,
17
+ step: 5,
18
+ disabled: false,
19
+ onValueChange: fn(),
20
+ },
21
+ argTypes: {
22
+ orientation: { control: 'select', options: ['horizontal', 'vertical'] },
23
+ size: { control: 'select', options: ['lg', 'md', 'sm', 'unstyled'] },
24
+ variant: { control: 'select', options: ['outline'] },
25
+ min: { control: 'number' },
26
+ max: { control: 'number' },
27
+ step: { control: 'number' },
28
+ disabled: { control: 'boolean' },
29
+ onValueChange: { control: false },
30
+ },
31
+ parameters: {
32
+ controls: { disable: true },
33
+ docs: {
34
+ source: { type: 'code' },
35
+ description: { component: '范围与垂直滑块、刻度、步长及键盘操作。' },
36
+ },
37
+ },
38
+ } satisfies Meta<typeof Slider.Root>
39
+ export default meta
40
+ type Story = StoryObj<typeof meta>
41
+ export const Playground: Story = {
42
+ parameters: {
43
+ controls: {
44
+ disable: false,
45
+ include: ['orientation', 'size', 'variant', 'min', 'max', 'step', 'disabled'],
46
+ },
47
+ docs: { source: { type: 'dynamic' } },
48
+ },
49
+ render: (args) => (
50
+ <div className={css({ maxWidth: '2xl' })}>
51
+ <Slider.Root {...args} defaultValue={[40]} aria-label={['数值']}>
52
+ <Slider.Label>滑块</Slider.Label>
53
+ <Slider.ValueText />
54
+ <Slider.Control>
55
+ <Slider.Track>
56
+ <Slider.Range />
57
+ </Slider.Track>
58
+ <Slider.Thumbs />
59
+ </Slider.Control>
60
+ </Slider.Root>
61
+ </div>
62
+ ),
63
+ }
64
+
65
+ export const RangeAndVertical: Story = {
66
+ render: function RangeAndVertical() {
67
+ const [range, setRange] = useState([25, 75])
68
+
69
+ const slider = Slider.useSlider({
70
+ name: 'range',
71
+ value: range,
72
+ min: 0,
73
+ max: 100,
74
+ step: 5,
75
+ minStepsBetweenThumbs: 1,
76
+ 'aria-label': ['范围下限', '范围上限'],
77
+ onValueChange: ({ value }) => setRange(value),
78
+ })
79
+ const [submittedForm, setSubmittedForm] = useState('尚未提交')
80
+ return (
81
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
82
+ <form
83
+ noValidate
84
+ onSubmit={(event) => {
85
+ event.preventDefault()
86
+ setSubmittedForm(
87
+ JSON.stringify(Array.from(new FormData(event.currentTarget).entries())),
88
+ )
89
+ }}
90
+ onReset={() => {
91
+ setRange([25, 75])
92
+ setSubmittedForm('已重置')
93
+ }}
94
+ className={css({ display: 'grid', gap: '4' })}>
95
+ <div className={css({ display: 'grid', gap: '3' })}>
96
+ <h3 className={css({ textStyle: 'lg', fontWeight: 'semibold' })}>范围滑块与刻度</h3>
97
+ <Slider.RootProvider value={slider} size="md">
98
+ <Slider.Label>数值范围</Slider.Label>
99
+ <Slider.ValueText />
100
+ <Slider.Control>
101
+ <Slider.Track>
102
+ <Slider.Range />
103
+ </Slider.Track>
104
+ <Slider.Thumbs />
105
+ <Slider.Marks
106
+ marks={[
107
+ { value: 0, label: '0' },
108
+ { value: 50, label: '50' },
109
+ { value: 100, label: '100' },
110
+ ]}
111
+ />
112
+ </Slider.Control>
113
+ </Slider.RootProvider>
114
+ <Slider.Root defaultValue={[40]} disabled aria-label={['禁用的滑块']}>
115
+ <Slider.Label>禁用滑块</Slider.Label>
116
+ <Slider.Control>
117
+ <Slider.Track>
118
+ <Slider.Range />
119
+ </Slider.Track>
120
+ <Slider.Thumbs />
121
+ </Slider.Control>
122
+ </Slider.Root>
123
+ <Slider.Root
124
+ orientation="vertical"
125
+ defaultValue={[60]}
126
+ height="56"
127
+ width="16"
128
+ aria-label={['垂直滑块']}>
129
+ <Slider.Label>垂直</Slider.Label>
130
+ <Slider.Control>
131
+ <Slider.Track>
132
+ <Slider.Range />
133
+ </Slider.Track>
134
+ <Slider.Thumbs />
135
+ </Slider.Control>
136
+ </Slider.Root>
137
+ <p role="status">范围:{range.join(' – ')}</p>
138
+ </div>
139
+ <div className={css({ display: 'flex', gap: '3' })}>
140
+ <Button type="submit">读取本地 FormData</Button>
141
+ <Button type="reset" variant="outline">
142
+ 重置
143
+ </Button>
144
+ </div>
145
+ <pre role="status" className={css({ whiteSpace: 'pre-wrap', overflowWrap: 'anywhere' })}>
146
+ {submittedForm}
147
+ </pre>
148
+ </form>
149
+ </div>
150
+ )
151
+ },
152
+ }
153
+ export const CustomSize: Story = {
154
+ render: function CustomSize() {
155
+ return (
156
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
157
+ <Slider.Root
158
+ size="unstyled"
159
+ name="custom-slider"
160
+ defaultValue={[40]}
161
+ gap="3"
162
+ aria-label={['自定尺寸滑块']}>
163
+ <Slider.Label>28px 滑块与 12px 轨道</Slider.Label>
164
+ <Slider.ValueText />
165
+ <Slider.Control minHeight="28px" mb="8">
166
+ <Slider.Track height="12px">
167
+ <Slider.Range />
168
+ </Slider.Track>
169
+ <Slider.Thumb index={0} width="28px" height="28px">
170
+ <Slider.HiddenInput />
171
+ </Slider.Thumb>
172
+ <Slider.MarkerGroup top="8px" insetInline="0">
173
+ {[0, 50, 100].map((value) => (
174
+ <Slider.Marker
175
+ key={value}
176
+ value={value}
177
+ flexDirection="column"
178
+ gap="4"
179
+ textStyle="sm">
180
+ <Slider.MarkerIndicator boxSize="6px" />
181
+ <span>{value}</span>
182
+ </Slider.Marker>
183
+ ))}
184
+ </Slider.MarkerGroup>
185
+ </Slider.Control>
186
+ </Slider.Root>
187
+ </div>
188
+ )
189
+ },
190
+ }
@@ -0,0 +1,124 @@
1
+ import { fn } from 'storybook/test'
2
+ import { Button, Switch } from '@repo/ui'
3
+ import { useState } from 'react'
4
+ import { css } from 'styled-system/css'
5
+
6
+ import type { Meta, StoryObj } from '@storybook/react-vite'
7
+
8
+ const meta = {
9
+ title: 'Forms/Switch',
10
+ component: Switch.Root,
11
+ args: { size: 'md', variant: 'solid', disabled: false, onCheckedChange: fn() },
12
+ argTypes: {
13
+ size: { control: 'select', options: ['lg', 'md', 'sm', 'unstyled', 'xs'] },
14
+ variant: { control: 'select', options: ['solid'] },
15
+ disabled: { control: 'boolean' },
16
+ onCheckedChange: { control: false },
17
+ },
18
+ parameters: {
19
+ controls: { disable: true },
20
+ docs: {
21
+ source: { type: 'code' },
22
+ description: { component: '受控与非受控开关、禁用状态和尺寸定制。' },
23
+ },
24
+ },
25
+ } satisfies Meta<typeof Switch.Root>
26
+ export default meta
27
+ type Story = StoryObj<typeof meta>
28
+ export const Playground: Story = {
29
+ parameters: {
30
+ controls: { disable: false, include: ['size', 'variant', 'disabled'] },
31
+ docs: { source: { type: 'dynamic' } },
32
+ },
33
+ render: (args) => (
34
+ <div className={css({ maxWidth: '2xl' })}>
35
+ <Switch.Root {...args}>
36
+ <Switch.HiddenInput />
37
+ <Switch.Control />
38
+ <Switch.Label>启用通知</Switch.Label>
39
+ </Switch.Root>
40
+ </div>
41
+ ),
42
+ }
43
+
44
+ export const Controlled: Story = {
45
+ render: function Controlled() {
46
+ const [enabled, setEnabled] = useState(true)
47
+
48
+ const [submittedForm, setSubmittedForm] = useState('尚未提交')
49
+ return (
50
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
51
+ <form
52
+ noValidate
53
+ onSubmit={(event) => {
54
+ event.preventDefault()
55
+ setSubmittedForm(
56
+ JSON.stringify(Array.from(new FormData(event.currentTarget).entries())),
57
+ )
58
+ }}
59
+ onReset={() => {
60
+ setEnabled(true)
61
+ setSubmittedForm('已重置')
62
+ }}
63
+ className={css({ display: 'grid', gap: '4' })}>
64
+ <Switch.Root
65
+ name="notifications"
66
+ value="enabled"
67
+ checked={enabled}
68
+ onCheckedChange={(details) => setEnabled(details.checked)}>
69
+ <Switch.HiddenInput />
70
+ <Switch.Control />
71
+ <Switch.Label>启用通知</Switch.Label>
72
+ </Switch.Root>
73
+ <div className={css({ display: 'flex', gap: '3' })}>
74
+ <Button type="submit">读取本地 FormData</Button>
75
+ <Button type="reset" variant="outline">
76
+ 重置
77
+ </Button>
78
+ </div>
79
+ <pre role="status" className={css({ whiteSpace: 'pre-wrap', overflowWrap: 'anywhere' })}>
80
+ {submittedForm}
81
+ </pre>
82
+ </form>
83
+ </div>
84
+ )
85
+ },
86
+ }
87
+ export const States: Story = {
88
+ render: function States() {
89
+ return (
90
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
91
+ <Switch.Root size="sm" defaultChecked>
92
+ <Switch.HiddenInput />
93
+ <Switch.Control />
94
+ <Switch.Label>小尺寸非受控开关</Switch.Label>
95
+ </Switch.Root>
96
+ <Switch.Root size="lg" disabled defaultChecked>
97
+ <Switch.HiddenInput />
98
+ <Switch.Control />
99
+ <Switch.Label>大尺寸禁用开关</Switch.Label>
100
+ </Switch.Root>
101
+ </div>
102
+ )
103
+ },
104
+ }
105
+ export const CustomSize: Story = {
106
+ render: function CustomSize() {
107
+ return (
108
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
109
+ <Switch.Root size="unstyled" name="custom-switch" gap="4" defaultChecked>
110
+ <Switch.HiddenInput />
111
+ <Switch.Control width="72px" height="36px">
112
+ <Switch.Thumb
113
+ width="36px"
114
+ height="36px"
115
+ scale="0.8"
116
+ _checked={{ translate: '36px 0', _rtl: { translate: '-36px 0' } }}
117
+ />
118
+ </Switch.Control>
119
+ <Switch.Label textStyle="lg">自定开关尺寸和位移,保留 solid</Switch.Label>
120
+ </Switch.Root>
121
+ </div>
122
+ )
123
+ },
124
+ }
@@ -0,0 +1,154 @@
1
+ import { Button, TagsInput } 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: 'Forms/TagsInput',
9
+ component: TagsInput.Root,
10
+ parameters: {
11
+ controls: { disable: true },
12
+ docs: {
13
+ source: { type: 'code' },
14
+ description: { component: '标签增删、编辑、数量限制及错误状态。' },
15
+ },
16
+ },
17
+ } satisfies Meta<typeof TagsInput.Root>
18
+ export default meta
19
+ type Story = StoryObj<typeof meta>
20
+ export const ControlledForm: Story = {
21
+ render: function ControlledForm() {
22
+ const [tags, setTags] = useState(['Ark UI', 'Panda CSS'])
23
+
24
+ const [invalid, setInvalid] = useState(false)
25
+
26
+ const [submittedForm, setSubmittedForm] = useState('尚未提交')
27
+ return (
28
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
29
+ <form
30
+ noValidate
31
+ onSubmit={(event) => {
32
+ event.preventDefault()
33
+ setSubmittedForm(
34
+ JSON.stringify(Array.from(new FormData(event.currentTarget).entries())),
35
+ )
36
+ }}
37
+ onReset={() => {
38
+ setTags(['Ark UI', 'Panda CSS'])
39
+ setInvalid(false)
40
+ setSubmittedForm('已重置')
41
+ }}
42
+ className={css({ display: 'grid', gap: '4' })}>
43
+ <div className={css({ display: 'grid', gap: '3' })}>
44
+ <h3 className={css({ textStyle: 'lg', fontWeight: 'semibold' })}>标签输入</h3>
45
+ <TagsInput.Root
46
+ name="tags"
47
+ value={tags}
48
+ onValueChange={({ value }) => setTags(value)}
49
+ max={5}
50
+ editable
51
+ variant="outline"
52
+ size="md">
53
+ <TagsInput.Label>技术标签(最多五个)</TagsInput.Label>
54
+ <TagsInput.Control>
55
+ <TagsInput.Items />
56
+ <TagsInput.Input placeholder="输入后按 Enter" />
57
+ <TagsInput.ClearTrigger aria-label="清空技术标签" />
58
+ </TagsInput.Control>
59
+ <TagsInput.HiddenInput />
60
+ </TagsInput.Root>
61
+ <TagsInput.Root defaultValue={['只读标签']} readOnly variant="subtle" size="sm">
62
+ <TagsInput.Label>只读状态</TagsInput.Label>
63
+ <TagsInput.Control>
64
+ <TagsInput.Items />
65
+ <TagsInput.Input />
66
+ </TagsInput.Control>
67
+ </TagsInput.Root>
68
+ <TagsInput.Root variant="subtle" invalid={invalid} defaultValue={['Subtle']}>
69
+ <TagsInput.Label>错误状态对照 · subtle</TagsInput.Label>
70
+ <TagsInput.Control>
71
+ <TagsInput.Items />
72
+ <TagsInput.Input placeholder="聚焦检查错误边框" />
73
+ </TagsInput.Control>
74
+ </TagsInput.Root>
75
+ <TagsInput.Root variant="surface" invalid={invalid} defaultValue={['Surface']}>
76
+ <TagsInput.Label>错误状态对照 · surface</TagsInput.Label>
77
+ <TagsInput.Control>
78
+ <TagsInput.Items />
79
+ <TagsInput.Input placeholder="聚焦检查错误边框" />
80
+ </TagsInput.Control>
81
+ </TagsInput.Root>
82
+ <Button variant="outline" onClick={() => setInvalid((current) => !current)}>
83
+ {invalid ? '清除错误' : '显示错误'}
84
+ </Button>
85
+ <p role="status">标签:{tags.join('、') || '无'};支持增删和编辑,不发送网络请求。</p>
86
+ </div>
87
+ <div className={css({ display: 'flex', gap: '3' })}>
88
+ <Button type="submit">读取本地 FormData</Button>
89
+ <Button type="reset" variant="outline">
90
+ 重置
91
+ </Button>
92
+ </div>
93
+ <pre role="status" className={css({ whiteSpace: 'pre-wrap', overflowWrap: 'anywhere' })}>
94
+ {submittedForm}
95
+ </pre>
96
+ </form>
97
+ </div>
98
+ )
99
+ },
100
+ }
101
+ export const Customization: Story = {
102
+ render: function Customization() {
103
+ return (
104
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
105
+ <TagsInput.Root
106
+ size="unstyled"
107
+ name="compact-tags"
108
+ defaultValue={['Panda', 'Ark']}
109
+ editable
110
+ gap="1.5"
111
+ textStyle="sm"
112
+ css={{
113
+ '& [data-part=item-preview], & [data-part=item-input]': {
114
+ height: '24px',
115
+ px: '2',
116
+ gap: '1',
117
+ lineHeight: '1',
118
+ },
119
+ '& [data-part=item-delete-trigger], & [data-part=clear-trigger]': {
120
+ boxSize: '4',
121
+ _icon: { boxSize: '3.5' },
122
+ },
123
+ }}>
124
+ <TagsInput.Label>自定尺寸的标签</TagsInput.Label>
125
+ <TagsInput.Control minHeight="36px" px="2" gap="1.5">
126
+ <TagsInput.Items />
127
+ <TagsInput.Input height="28px" px="1" minWidth="16" placeholder="添加标签" />
128
+ <TagsInput.ClearTrigger aria-label="清空紧凑标签" />
129
+ </TagsInput.Control>
130
+ <TagsInput.HiddenInput />
131
+ </TagsInput.Root>
132
+ <TagsInput.Root
133
+ variant="unstyled"
134
+ defaultValue={['品牌页面']}
135
+ editable
136
+ css={{
137
+ '& [data-part=item-preview]': { bg: 'lime.3', color: 'lime.11', borderRadius: 'md' },
138
+ '& [data-part=input], & [data-part=item-input]': { outline: 'none' },
139
+ }}>
140
+ <TagsInput.Label>自定外观,保留 md 尺寸</TagsInput.Label>
141
+ <TagsInput.Control
142
+ bg="gray.3"
143
+ borderRadius="lg"
144
+ css={{ _focusWithin: { outline: '2px solid', outlineColor: 'lime.8' } }}>
145
+ <TagsInput.Items />
146
+ <TagsInput.Input placeholder="添加标签" />
147
+ <TagsInput.ClearTrigger aria-label="清空自定外观标签" />
148
+ </TagsInput.Control>
149
+ <TagsInput.HiddenInput />
150
+ </TagsInput.Root>
151
+ </div>
152
+ )
153
+ },
154
+ }
@@ -0,0 +1,148 @@
1
+ import { action } from 'storybook/actions'
2
+ import type { ChangeEvent } from 'react'
3
+ import { Button, Field, Textarea } from '@repo/ui'
4
+ import { useState } from 'react'
5
+ import { css } from 'styled-system/css'
6
+
7
+ import type { Meta, StoryObj } from '@storybook/react-vite'
8
+
9
+ const meta = {
10
+ title: 'Forms/Textarea',
11
+ component: Textarea,
12
+ args: {
13
+ size: 'md',
14
+ variant: 'surface',
15
+ placeholder: '输入多行文字',
16
+ rows: 4,
17
+ disabled: false,
18
+ readOnly: false,
19
+ onChange: (event: ChangeEvent<HTMLTextAreaElement>) =>
20
+ action('onChange')({ value: event.currentTarget.value }),
21
+ },
22
+ argTypes: {
23
+ size: { control: 'select', options: ['lg', 'md', 'sm', 'unstyled', 'xl', 'xs'] },
24
+ variant: {
25
+ control: 'select',
26
+ options: ['flushed', 'outline', 'subtle', 'surface', 'unstyled'],
27
+ },
28
+ placeholder: { control: 'text' },
29
+ rows: { control: 'number' },
30
+ disabled: { control: 'boolean' },
31
+ readOnly: { control: 'boolean' },
32
+ onChange: { control: false },
33
+ },
34
+ parameters: {
35
+ controls: { disable: true },
36
+ docs: {
37
+ source: { type: 'code' },
38
+ description: { component: '多行输入、字符限制、调整高度和禁用状态。' },
39
+ },
40
+ },
41
+ } satisfies Meta<typeof Textarea>
42
+ export default meta
43
+ type Story = StoryObj<typeof meta>
44
+ export const Playground: Story = {
45
+ parameters: {
46
+ controls: {
47
+ disable: false,
48
+ include: ['size', 'variant', 'placeholder', 'rows', 'disabled', 'readOnly'],
49
+ },
50
+ docs: { source: { type: 'dynamic' } },
51
+ },
52
+ render: (args) => (
53
+ <div className={css({ maxWidth: '2xl' })}>
54
+ <Textarea {...args} />
55
+ </div>
56
+ ),
57
+ }
58
+
59
+ export const ControlledForm: Story = {
60
+ render: function ControlledForm() {
61
+ const [note, setNote] = useState('')
62
+
63
+ const [submittedForm, setSubmittedForm] = useState('尚未提交')
64
+ return (
65
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
66
+ <form
67
+ noValidate
68
+ onSubmit={(event) => {
69
+ event.preventDefault()
70
+ setSubmittedForm(
71
+ JSON.stringify(Array.from(new FormData(event.currentTarget).entries())),
72
+ )
73
+ }}
74
+ onReset={() => {
75
+ setNote('')
76
+ setSubmittedForm('已重置')
77
+ }}
78
+ className={css({ display: 'grid', gap: '4' })}>
79
+ <Field.Root>
80
+ <Field.Label>备注</Field.Label>
81
+ <Textarea
82
+ name="note"
83
+ value={note}
84
+ onChange={(event) => setNote(event.target.value)}
85
+ placeholder="输入多行备注"
86
+ rows={4}
87
+ maxLength={200}
88
+ resize="vertical"
89
+ />
90
+ <Field.HelperText>{note.length} / 200 字符,可拖动调整高度。</Field.HelperText>
91
+ </Field.Root>
92
+ <div className={css({ display: 'flex', gap: '3' })}>
93
+ <Button type="submit">读取本地 FormData</Button>
94
+ <Button type="reset" variant="outline">
95
+ 重置
96
+ </Button>
97
+ </div>
98
+ <pre role="status" className={css({ whiteSpace: 'pre-wrap', overflowWrap: 'anywhere' })}>
99
+ {submittedForm}
100
+ </pre>
101
+ </form>
102
+ </div>
103
+ )
104
+ },
105
+ }
106
+ export const Disabled: Story = {
107
+ render: function Disabled() {
108
+ return (
109
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
110
+ <Field.Root disabled>
111
+ <Field.Label>禁用备注</Field.Label>
112
+ <Textarea defaultValue="从 Field 继承禁用状态" rows={2} variant="subtle" />
113
+ </Field.Root>
114
+ </div>
115
+ )
116
+ },
117
+ }
118
+ export const Customization: Story = {
119
+ render: function Customization() {
120
+ return (
121
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
122
+ <Field.Root>
123
+ <Field.Label>Textarea:仅自定尺寸</Field.Label>
124
+ <Textarea
125
+ size="unstyled"
126
+ name="custom-note"
127
+ minHeight="120px"
128
+ p="6"
129
+ textStyle="lg"
130
+ rows={3}
131
+ placeholder="自定内边距和字号,保留 surface"
132
+ />
133
+ </Field.Root>
134
+ <Field.Root>
135
+ <Field.Label>Textarea:仅自定外观</Field.Label>
136
+ <Textarea
137
+ variant="unstyled"
138
+ rows={2}
139
+ bg="gray.3"
140
+ borderRadius="xl"
141
+ focusVisibleRing="outside"
142
+ placeholder="保留 md 内边距和字号"
143
+ />
144
+ </Field.Root>
145
+ </div>
146
+ )
147
+ },
148
+ }
@@ -0,0 +1,60 @@
1
+ import { Grid, GridItem, Heading, Stack, Text } from '@repo/ui'
2
+ import { css } from 'styled-system/css'
3
+ import { grid } from 'styled-system/patterns'
4
+
5
+ import type { Meta, StoryObj } from '@storybook/react-vite'
6
+
7
+ const meta = {
8
+ title: 'Layout/Grid',
9
+ component: Grid,
10
+ parameters: {
11
+ controls: { disable: true },
12
+ docs: {
13
+ source: { type: 'code' },
14
+ description: { component: '响应式网格、跨列、自动适应与 asChild。' },
15
+ },
16
+ },
17
+ } satisfies Meta<typeof Grid>
18
+ export default meta
19
+ type Story = StoryObj<typeof meta>
20
+ export const ResponsiveAndAsChild: Story = {
21
+ render: function ResponsiveAndAsChild() {
22
+ return (
23
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
24
+ <Stack gap="4">
25
+ <Heading as="h3" size="lg">
26
+ Grid / GridItem 与 grid pattern
27
+ </Heading>
28
+ <Grid templateColumns={{ base: '1fr', md: 'repeat(3, minmax(0, 1fr))' }} gap="3">
29
+ <GridItem colSpan={{ base: 1, md: 2 }} p="4" bg="gray.surface.bg" borderRadius="sm">
30
+ 跨两列主内容
31
+ </GridItem>
32
+ <GridItem p="4" bg="gray.subtle.bg" borderRadius="sm">
33
+ 侧栏
34
+ </GridItem>
35
+ </Grid>
36
+ <div className={grid({ columns: { base: 1, sm: 2, lg: 3 }, gap: '3' })}>
37
+ {['响应式列 A', '响应式列 B', '响应式列 C'].map((label) => (
38
+ <div key={label} className={css({ p: '4', borderWidth: '1px' })}>
39
+ {label}
40
+ </div>
41
+ ))}
42
+ </div>
43
+ <div className={grid({ minChildWidth: '180px', gap: '3' })}>
44
+ {['自动适应 A', '自动适应 B', '自动适应 C'].map((label) => (
45
+ <div key={label} className={css({ p: '4', bg: 'gray.subtle.bg' })}>
46
+ {label}
47
+ </div>
48
+ ))}
49
+ </div>
50
+ <Grid asChild columns={2} gap="3">
51
+ <article aria-label="asChild 网格示例">
52
+ <Text>asChild 复用 article</Text>
53
+ <Text>无额外容器</Text>
54
+ </article>
55
+ </Grid>
56
+ </Stack>
57
+ </div>
58
+ )
59
+ },
60
+ }