@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.
- package/package.json +2 -2
- package/templates/hono-fullstack/.codegraph/.gitignore +5 -0
- package/templates/hono-fullstack/README.md +22 -1
- package/templates/hono-fullstack/_gitignore +1 -0
- package/templates/hono-fullstack/apps/server/package.json +7 -2
- package/templates/hono-fullstack/apps/server/src/adapters/cloudflare/entry.ts +4 -30
- package/templates/hono-fullstack/apps/server/src/adapters/nodejs/bootstrap.ts +20 -12
- package/templates/hono-fullstack/apps/server/src/adapters/nodejs/entry.ts +7 -57
- package/templates/hono-fullstack/apps/server/src/app.ts +37 -21
- package/templates/hono-fullstack/apps/server/src/config.ts +1 -1
- package/templates/hono-fullstack/apps/server/src/di-container.ts +51 -0
- package/templates/hono-fullstack/apps/server/src/infra/logger/getter.ts +1 -1
- package/templates/hono-fullstack/apps/server/src/infra/logger/pino.ts +21 -34
- package/templates/hono-fullstack/apps/server/src/infra/work-runner/errors.ts +22 -0
- package/templates/hono-fullstack/apps/server/src/infra/work-runner/pass-through/runner.ts +28 -22
- package/templates/hono-fullstack/apps/server/src/infra/work-runner/piscina/runner.ts +11 -34
- package/templates/hono-fullstack/apps/server/src/infra/work-runner/{example → piscina}/worker-entry.ts +6 -2
- package/templates/hono-fullstack/apps/server/src/infra/work-runner/types.ts +2 -16
- package/templates/hono-fullstack/apps/server/src/infra/work-runner/utils/business-error.ts +10 -5
- package/templates/hono-fullstack/apps/server/src/infra/work-runner/utils/message.ts +5 -17
- package/templates/hono-fullstack/apps/server/src/middlewares/cors.ts +16 -22
- package/templates/hono-fullstack/apps/server/src/middlewares/logger.ts +34 -0
- package/templates/hono-fullstack/apps/server/src/modules/example/module.ts +8 -0
- package/templates/hono-fullstack/apps/server/src/modules/example/queries.ts +8 -0
- package/templates/hono-fullstack/apps/server/src/modules/example/routes.ts +74 -68
- package/templates/hono-fullstack/apps/server/src/modules/example/service.test.ts +53 -0
- package/templates/hono-fullstack/apps/server/src/modules/example/service.ts +54 -0
- package/templates/hono-fullstack/apps/server/src/modules/example/types.ts +12 -0
- package/templates/hono-fullstack/apps/server/src/modules/example/work-task/tasks.test.ts +9 -35
- package/templates/hono-fullstack/apps/server/src/modules/example/work-task/tasks.ts +15 -46
- package/templates/hono-fullstack/apps/server/src/shared/errors/defs/index.ts +6 -1
- package/templates/hono-fullstack/apps/server/src/shared/errors/handler.ts +1 -1
- package/templates/hono-fullstack/apps/server/src/shared/network/openapi/index.ts +1 -1
- package/templates/hono-fullstack/apps/server/src/shared/types/app.ts +51 -0
- package/templates/hono-fullstack/apps/server/src/shared/types/db.ts +126 -0
- package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/check.ts +19 -0
- package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/model.ts +47 -0
- package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/params.ts +105 -0
- package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/query.test.ts +139 -0
- package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/query.ts +236 -0
- package/templates/hono-fullstack/apps/server/vite.config.ts +2 -2
- package/templates/hono-fullstack/apps/server/wrangler.jsonc +1 -1
- package/templates/hono-fullstack/apps/stack/frontend/assets/styles.css +6 -0
- package/templates/hono-fullstack/apps/stack/frontend/components/general/ErrorMessage.tsx +3 -1
- package/templates/hono-fullstack/apps/stack/frontend/components/layouts/AppLayout.tsx +2 -1
- package/templates/hono-fullstack/apps/stack/frontend/components/layouts/Header.tsx +14 -2
- package/templates/hono-fullstack/apps/stack/frontend/components/layouts/Page.tsx +2 -1
- package/templates/hono-fullstack/apps/stack/frontend/components/layouts/PageContainer.tsx +4 -1
- package/templates/hono-fullstack/apps/stack/frontend/modules/example/api.ts +16 -9
- package/templates/hono-fullstack/apps/stack/frontend/modules/example/components/ExampleForm.tsx +25 -12
- package/templates/hono-fullstack/apps/stack/frontend/modules/example/components/ExampleList.tsx +13 -4
- package/templates/hono-fullstack/apps/stack/frontend/modules/example/hooks/api-hooks.ts +3 -3
- package/templates/hono-fullstack/apps/stack/frontend/routes/__root.tsx +1 -1
- package/templates/hono-fullstack/apps/stack/frontend/routes/index.tsx +16 -4
- package/templates/hono-fullstack/apps/stack/package.json +9 -4
- package/templates/hono-fullstack/apps/stack/panda.config.ts +31 -0
- package/templates/hono-fullstack/apps/stack/tsconfig.json +1 -0
- package/templates/hono-fullstack/apps/stack/turbo.json +20 -0
- package/templates/hono-fullstack/apps/stack/vite.config.ts +48 -12
- package/templates/hono-fullstack/apps/stack/wrangler.jsonc +1 -1
- package/templates/hono-fullstack/envs/.env.example.sqlite-d1 +1 -0
- package/templates/hono-fullstack/libs/db/drizzle-kit/sqlite-d1.config.ts +29 -10
- package/templates/hono-fullstack/libs/db/package.json +1 -0
- package/templates/hono-fullstack/libs/db/src/dialects/sqlite/schema/columns.ts +1 -1
- package/templates/hono-fullstack/libs/db/src/dialects/sqlite/schema/modules/examples/examples.ts +6 -3
- package/templates/hono-fullstack/libs/db/src/dialects/sqlite/schema/vo.ts +7 -1
- package/templates/hono-fullstack/libs/definition/README.md +81 -0
- package/templates/hono-fullstack/libs/definition/package.json +3 -1
- package/templates/hono-fullstack/libs/definition/src/constants/index.ts +1 -0
- package/templates/hono-fullstack/libs/definition/src/constants/pagination.ts +3 -0
- package/templates/hono-fullstack/libs/definition/src/modules/common-contracts.ts +24 -0
- package/templates/hono-fullstack/libs/definition/src/modules/example/contracts.ts +34 -0
- package/templates/hono-fullstack/libs/definition/src/modules/example/index.ts +1 -16
- package/templates/hono-fullstack/libs/definition/src/modules/index.ts +2 -0
- package/templates/hono-fullstack/libs/definition/src/modules/vo-generated-types.ts +12 -0
- package/templates/hono-fullstack/libs/ui/.storybook/main.ts +32 -0
- package/templates/hono-fullstack/libs/ui/.storybook/panda.config.ts +22 -0
- package/templates/hono-fullstack/libs/ui/.storybook/preview.tsx +79 -0
- package/templates/hono-fullstack/libs/ui/.storybook/styles.css +1 -0
- package/templates/hono-fullstack/libs/ui/.storybook/vite.config.ts +37 -0
- package/templates/hono-fullstack/libs/ui/components.json +15 -0
- package/templates/hono-fullstack/libs/ui/package.json +114 -0
- package/templates/hono-fullstack/libs/ui/panda.config.ts +41 -0
- package/templates/hono-fullstack/libs/ui/src/Tooltip.tsx +47 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/buttons/Button.tsx +80 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/buttons/CloseButton.tsx +15 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/buttons/IconButton.tsx +10 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/collections/Combobox.tsx +91 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/collections/Select.tsx +88 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/collections/TreeView.tsx +142 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Avatar.tsx +64 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Badge.tsx +7 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Card.tsx +23 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Clipboard.tsx +77 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Icon.tsx +9 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Table.tsx +51 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Tag.tsx +23 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Timeline.tsx +33 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/date-and-time/DatePicker.tsx +255 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Accordion.tsx +48 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Breadcrumb.tsx +50 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Collapsible.tsx +34 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Pagination.tsx +74 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Steps.tsx +91 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Tabs.tsx +37 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Alert.tsx +52 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Progress.tsx +41 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/ProgressCircle.tsx +40 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Skeleton.tsx +37 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Spinner.tsx +7 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Toast.tsx +99 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Checkbox.tsx +95 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/ColorPicker.tsx +148 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Editable.tsx +44 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Field.tsx +36 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Fieldset.tsx +34 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/FileUpload.tsx +143 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Input.tsx +7 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/InputAddon.tsx +7 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/InputGroup.tsx +61 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/NativeSelect.tsx +81 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/NumberInput.tsx +63 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/PasswordInput.tsx +76 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/PinInput.tsx +36 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/RadioCard.tsx +96 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/RadioGroup.tsx +61 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/RatingGroup.tsx +106 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/SegmentGroup.tsx +68 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Slider.tsx +87 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Switch.tsx +74 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/TagsInput.tsx +77 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Textarea.tsx +7 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/index.ts +98 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/AbsoluteCenter.tsx +7 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/Loader.tsx +69 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/Span.tsx +5 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/create-layout.ts +18 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Float.tsx +7 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Grid.tsx +17 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Group.tsx +7 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/ScrollArea.tsx +46 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Separator.tsx +26 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Stack.tsx +54 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Dialog.tsx +69 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Drawer.tsx +49 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/HoverCard.tsx +37 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Menu.tsx +74 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/OverlayManager.test.ts +124 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/OverlayManager.tsx +189 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Popover.tsx +57 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Tooltip.tsx +37 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/Heading.tsx +6 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/Link.tsx +7 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/LinkOverlay.tsx +21 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/Text.tsx +6 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/utilities/VisuallyHidden.tsx +13 -0
- package/templates/hono-fullstack/libs/ui/src/hooks.ts +242 -0
- package/templates/hono-fullstack/libs/ui/src/index.ts +19 -0
- package/templates/hono-fullstack/libs/ui/src/theme/animation-styles.ts +50 -0
- package/templates/hono-fullstack/libs/ui/src/theme/breakpoints.ts +7 -0
- package/templates/hono-fullstack/libs/ui/src/theme/conditions.ts +12 -0
- package/templates/hono-fullstack/libs/ui/src/theme/containers.ts +16 -0
- package/templates/hono-fullstack/libs/ui/src/theme/global-css.ts +12 -0
- package/templates/hono-fullstack/libs/ui/src/theme/keyframes.ts +157 -0
- package/templates/hono-fullstack/libs/ui/src/theme/layer-styles.ts +11 -0
- package/templates/hono-fullstack/libs/ui/src/theme/patterns/grid.ts +51 -0
- package/templates/hono-fullstack/libs/ui/src/theme/patterns/index.ts +60 -0
- package/templates/hono-fullstack/libs/ui/src/theme/patterns/stack.ts +46 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/absolute-center.ts +38 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/accordion.ts +68 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/alert.ts +83 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/avatar.ts +155 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/badge.ts +67 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/breadcrumb.ts +69 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/button.ts +149 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/card.ts +36 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/checkbox.ts +120 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/clipboard.ts +22 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/collapsible.ts +26 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/color-picker.ts +299 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/combobox.ts +141 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/date-picker.ts +302 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/dialog.ts +191 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/drawer.ts +170 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/editable.ts +64 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/field.ts +41 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/fieldset.ts +47 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/file-upload.ts +86 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/group.ts +78 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/heading.ts +24 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/hover-card.ts +47 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/icon.ts +25 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/index.ts +120 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/input-addon.ts +51 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/input-group.ts +77 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/input.ts +99 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/link.ts +36 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/menu.ts +114 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/native-select.ts +92 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/number-input.ts +91 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/pagination.ts +9 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/pin-input.ts +33 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/popover.ts +78 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/progress-circle.ts +50 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/progress.ts +112 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/radio-card.ts +223 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/radio-group.ts +78 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/rating-group.ts +98 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/scroll-area.ts +119 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/segment-group.ts +162 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/select.ts +157 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/separator.ts +25 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/skeleton.ts +65 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/slider.ts +164 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/spinner.ts +34 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/steps.ts +162 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/switch.ts +150 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/table.ts +150 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/tabs.ts +128 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/tag.ts +114 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/tags-input.ts +201 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/text.ts +7 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/textarea.ts +90 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/timeline.ts +137 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/toast.ts +52 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/tooltip.ts +44 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/tree-view.ts +200 -0
- package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/amber.ts +91 -0
- package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/gray.ts +103 -0
- package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/green.ts +88 -0
- package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/index.ts +14 -0
- package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/lime.ts +91 -0
- package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/red.ts +88 -0
- package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/index.ts +8 -0
- package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/shadows.ts +46 -0
- package/templates/hono-fullstack/libs/ui/src/theme/text-styles.ts +82 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/animations.ts +8 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/aspect-ratio.ts +6 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/borders.ts +5 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/colors.ts +35 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/durations.ts +11 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/easings.ts +9 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/index.ts +42 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/radii.ts +13 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/sizes.ts +27 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/spacing.ts +41 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/typography.ts +86 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/z-index.ts +43 -0
- package/templates/hono-fullstack/libs/ui/stories/README.md +107 -0
- package/templates/hono-fullstack/libs/ui/stories/actions/Button.stories.tsx +260 -0
- package/templates/hono-fullstack/libs/ui/stories/actions/Clipboard.stories.tsx +87 -0
- package/templates/hono-fullstack/libs/ui/stories/actions/IconButton.stories.tsx +33 -0
- package/templates/hono-fullstack/libs/ui/stories/collections/Combobox.stories.tsx +334 -0
- package/templates/hono-fullstack/libs/ui/stories/collections/Select.stories.tsx +342 -0
- package/templates/hono-fullstack/libs/ui/stories/collections/TreeView.stories.tsx +252 -0
- package/templates/hono-fullstack/libs/ui/stories/color/ColorPicker.stories.tsx +217 -0
- package/templates/hono-fullstack/libs/ui/stories/date/DatePicker.stories.tsx +302 -0
- package/templates/hono-fullstack/libs/ui/stories/disclosure/Accordion.stories.tsx +105 -0
- package/templates/hono-fullstack/libs/ui/stories/disclosure/Collapsible.stories.tsx +55 -0
- package/templates/hono-fullstack/libs/ui/stories/disclosure/Steps.stories.tsx +208 -0
- package/templates/hono-fullstack/libs/ui/stories/disclosure/Tabs.stories.tsx +176 -0
- package/templates/hono-fullstack/libs/ui/stories/display/Avatar.stories.tsx +108 -0
- package/templates/hono-fullstack/libs/ui/stories/display/Badge.stories.tsx +90 -0
- package/templates/hono-fullstack/libs/ui/stories/display/Card.stories.tsx +121 -0
- package/templates/hono-fullstack/libs/ui/stories/display/Heading.stories.tsx +62 -0
- package/templates/hono-fullstack/libs/ui/stories/display/Icon.stories.tsx +51 -0
- package/templates/hono-fullstack/libs/ui/stories/display/Table.stories.tsx +222 -0
- package/templates/hono-fullstack/libs/ui/stories/display/Tag.stories.tsx +168 -0
- package/templates/hono-fullstack/libs/ui/stories/display/Text.stories.tsx +32 -0
- package/templates/hono-fullstack/libs/ui/stories/display/Timeline.stories.tsx +241 -0
- package/templates/hono-fullstack/libs/ui/stories/feedback/Alert.stories.tsx +122 -0
- package/templates/hono-fullstack/libs/ui/stories/feedback/Progress.stories.tsx +163 -0
- package/templates/hono-fullstack/libs/ui/stories/feedback/ProgressCircle.stories.tsx +176 -0
- package/templates/hono-fullstack/libs/ui/stories/feedback/Skeleton.stories.tsx +75 -0
- package/templates/hono-fullstack/libs/ui/stories/feedback/Spinner.stories.tsx +49 -0
- package/templates/hono-fullstack/libs/ui/stories/feedback/Toast.stories.tsx +145 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/Checkbox.stories.tsx +281 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/Editable.stories.tsx +94 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/Field.stories.tsx +72 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/Fieldset.stories.tsx +109 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/FileUpload.stories.tsx +115 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/Form.stories.tsx +120 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/Input.stories.tsx +155 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/InputGroup.stories.tsx +79 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/NativeSelect.stories.tsx +160 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/NumberInput.stories.tsx +149 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/PasswordInput.stories.tsx +141 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/PinInput.stories.tsx +155 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/RadioCard.stories.tsx +265 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/RadioGroup.stories.tsx +109 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/RatingGroup.stories.tsx +123 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/SegmentGroup.stories.tsx +130 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/Slider.stories.tsx +190 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/Switch.stories.tsx +124 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/TagsInput.stories.tsx +154 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/Textarea.stories.tsx +148 -0
- package/templates/hono-fullstack/libs/ui/stories/layout/Grid.stories.tsx +60 -0
- package/templates/hono-fullstack/libs/ui/stories/layout/Positioning.stories.tsx +90 -0
- package/templates/hono-fullstack/libs/ui/stories/layout/ScrollArea.stories.tsx +68 -0
- package/templates/hono-fullstack/libs/ui/stories/layout/Stack.stories.tsx +87 -0
- package/templates/hono-fullstack/libs/ui/stories/navigation/Breadcrumb.stories.tsx +104 -0
- package/templates/hono-fullstack/libs/ui/stories/navigation/Link.stories.tsx +62 -0
- package/templates/hono-fullstack/libs/ui/stories/navigation/LinkBox.stories.tsx +45 -0
- package/templates/hono-fullstack/libs/ui/stories/navigation/Pagination.stories.tsx +74 -0
- package/templates/hono-fullstack/libs/ui/stories/overlays/Dialog.stories.tsx +255 -0
- package/templates/hono-fullstack/libs/ui/stories/overlays/Drawer.stories.tsx +114 -0
- package/templates/hono-fullstack/libs/ui/stories/overlays/HoverCard.stories.tsx +47 -0
- package/templates/hono-fullstack/libs/ui/stories/overlays/Menu.stories.tsx +133 -0
- package/templates/hono-fullstack/libs/ui/stories/overlays/OverlayManager.stories.tsx +206 -0
- package/templates/hono-fullstack/libs/ui/stories/overlays/Popover.stories.tsx +73 -0
- package/templates/hono-fullstack/libs/ui/stories/overlays/Tooltip.stories.tsx +114 -0
- package/templates/hono-fullstack/libs/ui/stories/tsconfig.json +14 -0
- package/templates/hono-fullstack/libs/ui/tsconfig.build.json +5 -0
- package/templates/hono-fullstack/libs/ui/tsconfig.json +13 -0
- package/templates/hono-fullstack/libs/ui/turbo.json +28 -0
- package/templates/hono-fullstack/libs/ui/vite.config.ts +33 -0
- package/templates/hono-fullstack/oyo.config.json +30 -4
- package/templates/hono-fullstack/package.json +1 -0
- package/templates/hono-fullstack/pnpm-workspace.yaml +20 -10
- package/templates/hono-fullstack/turbo.json +10 -0
- package/templates/hono-server/.codegraph/.gitignore +5 -0
- package/templates/hono-server/README.md +9 -1
- package/templates/hono-server/_gitignore +1 -0
- package/templates/hono-server/apps/server/package.json +7 -2
- package/templates/hono-server/apps/server/src/adapters/cloudflare/entry.ts +4 -30
- package/templates/hono-server/apps/server/src/adapters/nodejs/bootstrap.ts +20 -12
- package/templates/hono-server/apps/server/src/adapters/nodejs/entry.ts +7 -57
- package/templates/hono-server/apps/server/src/app.ts +37 -21
- package/templates/hono-server/apps/server/src/config.ts +1 -1
- package/templates/hono-server/apps/server/src/di-container.ts +51 -0
- package/templates/hono-server/apps/server/src/infra/logger/getter.ts +1 -1
- package/templates/hono-server/apps/server/src/infra/logger/pino.ts +21 -34
- package/templates/hono-server/apps/server/src/infra/work-runner/errors.ts +22 -0
- package/templates/hono-server/apps/server/src/infra/work-runner/pass-through/runner.ts +28 -22
- package/templates/hono-server/apps/server/src/infra/work-runner/piscina/runner.ts +11 -34
- package/templates/hono-server/apps/server/src/infra/work-runner/{example → piscina}/worker-entry.ts +6 -2
- package/templates/hono-server/apps/server/src/infra/work-runner/types.ts +2 -16
- package/templates/hono-server/apps/server/src/infra/work-runner/utils/business-error.ts +10 -5
- package/templates/hono-server/apps/server/src/infra/work-runner/utils/message.ts +5 -17
- package/templates/hono-server/apps/server/src/middlewares/cors.ts +16 -22
- package/templates/hono-server/apps/server/src/middlewares/logger.ts +34 -0
- package/templates/hono-server/apps/server/src/modules/example/module.ts +8 -0
- package/templates/hono-server/apps/server/src/modules/example/queries.ts +8 -0
- package/templates/hono-server/apps/server/src/modules/example/routes.ts +74 -68
- package/templates/hono-server/apps/server/src/modules/example/service.test.ts +53 -0
- package/templates/hono-server/apps/server/src/modules/example/service.ts +54 -0
- package/templates/hono-server/apps/server/src/modules/example/types.ts +12 -0
- package/templates/hono-server/apps/server/src/modules/example/work-task/tasks.test.ts +9 -35
- package/templates/hono-server/apps/server/src/modules/example/work-task/tasks.ts +15 -46
- package/templates/hono-server/apps/server/src/shared/errors/defs/index.ts +6 -1
- package/templates/hono-server/apps/server/src/shared/errors/handler.ts +1 -1
- package/templates/hono-server/apps/server/src/shared/network/openapi/index.ts +1 -1
- package/templates/hono-server/apps/server/src/shared/types/app.ts +51 -0
- package/templates/hono-server/apps/server/src/shared/types/db.ts +126 -0
- package/templates/hono-server/apps/server/src/shared/utils/data-access/check.ts +19 -0
- package/templates/hono-server/apps/server/src/shared/utils/data-access/model.ts +47 -0
- package/templates/hono-server/apps/server/src/shared/utils/data-access/params.ts +105 -0
- package/templates/hono-server/apps/server/src/shared/utils/data-access/query.test.ts +139 -0
- package/templates/hono-server/apps/server/src/shared/utils/data-access/query.ts +236 -0
- package/templates/hono-server/apps/server/vite.config.ts +2 -2
- package/templates/hono-server/apps/server/wrangler.jsonc +1 -1
- package/templates/hono-server/docker/README.md +1 -1
- package/templates/hono-server/envs/.env.example.sqlite-d1 +1 -0
- package/templates/hono-server/libs/db/drizzle-kit/sqlite-d1.config.ts +29 -10
- package/templates/hono-server/libs/db/package.json +1 -0
- package/templates/hono-server/libs/db/src/dialects/sqlite/schema/columns.ts +1 -1
- package/templates/hono-server/libs/db/src/dialects/sqlite/schema/modules/examples/examples.ts +6 -3
- package/templates/hono-server/libs/db/src/dialects/sqlite/schema/vo.ts +7 -1
- package/templates/hono-server/libs/definition/README.md +81 -0
- package/templates/hono-server/libs/definition/package.json +3 -1
- package/templates/hono-server/libs/definition/src/constants/index.ts +1 -0
- package/templates/hono-server/libs/definition/src/constants/pagination.ts +3 -0
- package/templates/hono-server/libs/definition/src/modules/common-contracts.ts +24 -0
- package/templates/hono-server/libs/definition/src/modules/example/contracts.ts +34 -0
- package/templates/hono-server/libs/definition/src/modules/example/index.ts +1 -16
- package/templates/hono-server/libs/definition/src/modules/index.ts +2 -0
- package/templates/hono-server/libs/definition/src/modules/vo-generated-types.ts +12 -0
- package/templates/hono-server/oyo.config.json +30 -4
- package/templates/hono-server/package.json +1 -0
- package/templates/hono-server/pnpm-workspace.yaml +9 -7
- package/templates/hono-server/turbo.json +10 -0
- package/templates/monorepo/.codegraph/.gitignore +5 -0
- package/templates/monorepo/_gitignore +1 -0
- package/templates/monorepo/oyo.config.json +6 -4
- package/templates/monorepo/pnpm-workspace.yaml +4 -4
- package/templates/monorepo/turbo.json +10 -0
- package/templates/hono-fullstack/apps/server/src/modules/example/contracts.ts +0 -9
- package/templates/hono-fullstack/apps/server/src/shared/app/types.ts +0 -44
- package/templates/hono-fullstack/apps/stack/frontend/styles.css +0 -23
- package/templates/hono-server/apps/server/src/modules/example/contracts.ts +0 -9
- package/templates/hono-server/apps/server/src/shared/app/types.ts +0 -44
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Button, Field, Fieldset, Group, Input, InputAddon, InputGroup } 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/Fieldset',
|
|
9
|
+
component: Fieldset.Root,
|
|
10
|
+
parameters: {
|
|
11
|
+
controls: { disable: true },
|
|
12
|
+
docs: {
|
|
13
|
+
source: { type: 'code' },
|
|
14
|
+
description: { component: '字段组的禁用、校验和表单提交。' },
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
} satisfies Meta<typeof Fieldset.Root>
|
|
18
|
+
export default meta
|
|
19
|
+
type Story = StoryObj<typeof meta>
|
|
20
|
+
export const ValidationAndForm: Story = {
|
|
21
|
+
render: function ValidationAndForm() {
|
|
22
|
+
const [disabled, setDisabled] = useState(false)
|
|
23
|
+
const [invalid, setInvalid] = useState(false)
|
|
24
|
+
|
|
25
|
+
const [submittedForm, setSubmittedForm] = useState('尚未提交')
|
|
26
|
+
return (
|
|
27
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
28
|
+
<form
|
|
29
|
+
noValidate
|
|
30
|
+
onSubmit={(event) => {
|
|
31
|
+
event.preventDefault()
|
|
32
|
+
setSubmittedForm(
|
|
33
|
+
JSON.stringify(Array.from(new FormData(event.currentTarget).entries())),
|
|
34
|
+
)
|
|
35
|
+
}}
|
|
36
|
+
className={css({ display: 'grid', gap: '4' })}>
|
|
37
|
+
<div className={css({ display: 'grid', gap: '3' })}>
|
|
38
|
+
<h3 className={css({ textStyle: 'lg', fontWeight: 'semibold' })}>
|
|
39
|
+
Fieldset 与输入组合
|
|
40
|
+
</h3>
|
|
41
|
+
<div className={css({ display: 'flex', flexWrap: 'wrap', gap: '3' })}>
|
|
42
|
+
<Button
|
|
43
|
+
type="button"
|
|
44
|
+
variant="outline"
|
|
45
|
+
onClick={() => setDisabled((value) => !value)}>
|
|
46
|
+
{disabled ? '启用字段组' : '禁用字段组'}
|
|
47
|
+
</Button>
|
|
48
|
+
<Button type="button" variant="outline" onClick={() => setInvalid((value) => !value)}>
|
|
49
|
+
{invalid ? '清除错误' : '显示错误'}
|
|
50
|
+
</Button>
|
|
51
|
+
</div>
|
|
52
|
+
<Fieldset.Root disabled={disabled} invalid={invalid} flexDirection="column" gap="3">
|
|
53
|
+
<Fieldset.Legend>账户信息</Fieldset.Legend>
|
|
54
|
+
<Fieldset.HelperText>
|
|
55
|
+
组合组件继承原生表单语义,禁用字段不参与 FormData。
|
|
56
|
+
</Fieldset.HelperText>
|
|
57
|
+
<Fieldset.Content>
|
|
58
|
+
<Field.Root>
|
|
59
|
+
<Field.Label>账户标识</Field.Label>
|
|
60
|
+
<InputGroup
|
|
61
|
+
startElement={<span aria-hidden="true">@</span>}
|
|
62
|
+
endElement={<span aria-hidden="true">✓</span>}>
|
|
63
|
+
<Input name="account" defaultValue="example" />
|
|
64
|
+
</InputGroup>
|
|
65
|
+
</Field.Root>
|
|
66
|
+
<Field.Root>
|
|
67
|
+
<Field.Label>零值装饰元素</Field.Label>
|
|
68
|
+
<InputGroup startElement={0} size="sm">
|
|
69
|
+
<Input name="sequence" placeholder="左侧的 0 应可见" size="sm" />
|
|
70
|
+
</InputGroup>
|
|
71
|
+
</Field.Root>
|
|
72
|
+
<Field.Root>
|
|
73
|
+
<Field.Label>可调整的装饰元素</Field.Label>
|
|
74
|
+
<InputGroup
|
|
75
|
+
startElement="https://"
|
|
76
|
+
startElementProps={{ minW: '20', pointerEvents: 'none', color: 'fg' }}
|
|
77
|
+
startOffset="-3rem"
|
|
78
|
+
endElement="域名"
|
|
79
|
+
endElementProps={{ minW: '16' }}
|
|
80
|
+
endOffset="-1.5rem">
|
|
81
|
+
<Input placeholder="example.com" />
|
|
82
|
+
</InputGroup>
|
|
83
|
+
</Field.Root>
|
|
84
|
+
<Field.Root>
|
|
85
|
+
<Field.Label>站点域名</Field.Label>
|
|
86
|
+
<Group attached width="full">
|
|
87
|
+
<InputAddon>https://</InputAddon>
|
|
88
|
+
<Input name="domain" defaultValue="example" />
|
|
89
|
+
<InputAddon>.com</InputAddon>
|
|
90
|
+
</Group>
|
|
91
|
+
</Field.Root>
|
|
92
|
+
</Fieldset.Content>
|
|
93
|
+
<Fieldset.ErrorText>这是本地演示错误,字段组需要重新检查。</Fieldset.ErrorText>
|
|
94
|
+
</Fieldset.Root>
|
|
95
|
+
<p role="status">
|
|
96
|
+
字段组:{disabled ? '禁用' : '启用'};错误:{invalid ? '显示' : '无'}
|
|
97
|
+
</p>
|
|
98
|
+
</div>
|
|
99
|
+
<div className={css({ display: 'flex', gap: '3' })}>
|
|
100
|
+
<Button type="submit">读取本地 FormData</Button>
|
|
101
|
+
</div>
|
|
102
|
+
<pre role="status" className={css({ whiteSpace: 'pre-wrap', overflowWrap: 'anywhere' })}>
|
|
103
|
+
{submittedForm}
|
|
104
|
+
</pre>
|
|
105
|
+
</form>
|
|
106
|
+
</div>
|
|
107
|
+
)
|
|
108
|
+
},
|
|
109
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Button, FileUpload } from '@repo/ui'
|
|
2
|
+
import { css } from 'styled-system/css'
|
|
3
|
+
import { useId } from 'react'
|
|
4
|
+
|
|
5
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
6
|
+
const fileErrors: Record<string, string> = {
|
|
7
|
+
TOO_MANY_FILES: '最多选择 3 个文件',
|
|
8
|
+
FILE_INVALID_TYPE: '仅支持 PNG、JPEG 和 TXT 文件',
|
|
9
|
+
FILE_TOO_LARGE: '单个文件不能超过 5 MiB',
|
|
10
|
+
FILE_TOO_SMALL: '文件过小',
|
|
11
|
+
FILE_INVALID: '文件无效',
|
|
12
|
+
FILE_EXISTS: '该文件已在列表中',
|
|
13
|
+
}
|
|
14
|
+
const meta = {
|
|
15
|
+
title: 'Forms/FileUpload',
|
|
16
|
+
component: FileUpload.Root,
|
|
17
|
+
parameters: {
|
|
18
|
+
controls: { disable: true },
|
|
19
|
+
docs: {
|
|
20
|
+
source: { type: 'code' },
|
|
21
|
+
description: { component: '本地文件选择、拖放、预览、移除与拒绝原因。' },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
} satisfies Meta<typeof FileUpload.Root>
|
|
25
|
+
export default meta
|
|
26
|
+
type Story = StoryObj<typeof meta>
|
|
27
|
+
export const LocalFiles: Story = {
|
|
28
|
+
render: function LocalFiles() {
|
|
29
|
+
const storyId = useId()
|
|
30
|
+
return (
|
|
31
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
32
|
+
<p>文件仅保留在当前页面内存中。选择、拖放、预览和移除均不发起上传请求。</p>
|
|
33
|
+
<FileUpload.Root
|
|
34
|
+
accept={['image/png', 'image/jpeg', 'text/plain']}
|
|
35
|
+
maxFiles={3}
|
|
36
|
+
maxFileSize={5 * 1024 * 1024}
|
|
37
|
+
locale="zh-CN"
|
|
38
|
+
translations={{
|
|
39
|
+
dropzone: '拖放文件或点击选择文件',
|
|
40
|
+
deleteFile: (file) => `移除 ${file.name}`,
|
|
41
|
+
itemPreview: (file) => `${file.name} 的预览`,
|
|
42
|
+
}}
|
|
43
|
+
maxWidth="xl">
|
|
44
|
+
<FileUpload.HiddenInput />
|
|
45
|
+
<FileUpload.Label>本地附件</FileUpload.Label>
|
|
46
|
+
<FileUpload.Dropzone aria-describedby={`${storyId}-file-upload-help`} gap="3">
|
|
47
|
+
<p>拖放文件到这里,或点击选择</p>
|
|
48
|
+
<p id={`${storyId}-file-upload-help`}>PNG、JPEG、TXT;最多 3 个,每个不超过 5 MiB。</p>
|
|
49
|
+
</FileUpload.Dropzone>
|
|
50
|
+
<div className={css({ display: 'flex', gap: '3', flexWrap: 'wrap' })}>
|
|
51
|
+
<FileUpload.Trigger asChild>
|
|
52
|
+
<Button type="button">选择文件</Button>
|
|
53
|
+
</FileUpload.Trigger>
|
|
54
|
+
<FileUpload.ClearTrigger asChild>
|
|
55
|
+
<Button type="button" variant="outline">
|
|
56
|
+
清空列表
|
|
57
|
+
</Button>
|
|
58
|
+
</FileUpload.ClearTrigger>
|
|
59
|
+
</div>
|
|
60
|
+
<FileUpload.Context>
|
|
61
|
+
{({ acceptedFiles, rejectedFiles }) => (
|
|
62
|
+
<>
|
|
63
|
+
<p role="status">已选择 {acceptedFiles.length} 个文件</p>
|
|
64
|
+
<FileUpload.ItemGroup>
|
|
65
|
+
{acceptedFiles.map((file, index) => (
|
|
66
|
+
<FileUpload.Item file={file} key={`${file.name}-${file.lastModified}-${index}`}>
|
|
67
|
+
<FileUpload.ItemPreview type="image">
|
|
68
|
+
<FileUpload.ItemPreviewImage />
|
|
69
|
+
</FileUpload.ItemPreview>
|
|
70
|
+
<FileUpload.ItemPreview type="application" />
|
|
71
|
+
<FileUpload.ItemPreview type="text" />
|
|
72
|
+
<div className={css({ display: 'grid', gap: '1', flex: '1', minWidth: '0' })}>
|
|
73
|
+
<FileUpload.ItemName overflowWrap="anywhere" />
|
|
74
|
+
<FileUpload.ItemSizeText />
|
|
75
|
+
</div>
|
|
76
|
+
<FileUpload.ItemDeleteTrigger />
|
|
77
|
+
</FileUpload.Item>
|
|
78
|
+
))}
|
|
79
|
+
</FileUpload.ItemGroup>
|
|
80
|
+
{rejectedFiles.length > 0 && (
|
|
81
|
+
<ul role="alert" className={css({ color: 'error' })}>
|
|
82
|
+
{rejectedFiles.map(({ file, errors }, index) => (
|
|
83
|
+
<li key={`${file.name}-${index}`}>
|
|
84
|
+
{file.name}:
|
|
85
|
+
{errors.map((error) => fileErrors[error] || '文件不符合要求').join(';')}
|
|
86
|
+
</li>
|
|
87
|
+
))}
|
|
88
|
+
</ul>
|
|
89
|
+
)}
|
|
90
|
+
</>
|
|
91
|
+
)}
|
|
92
|
+
</FileUpload.Context>
|
|
93
|
+
</FileUpload.Root>
|
|
94
|
+
</div>
|
|
95
|
+
)
|
|
96
|
+
},
|
|
97
|
+
}
|
|
98
|
+
export const Disabled: Story = {
|
|
99
|
+
render: function Disabled() {
|
|
100
|
+
return (
|
|
101
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
102
|
+
<FileUpload.Root disabled maxWidth="xl">
|
|
103
|
+
<FileUpload.HiddenInput />
|
|
104
|
+
<FileUpload.Label>禁用的文件选择</FileUpload.Label>
|
|
105
|
+
<FileUpload.Trigger asChild>
|
|
106
|
+
<Button type="button" variant="outline">
|
|
107
|
+
不可选择文件
|
|
108
|
+
</Button>
|
|
109
|
+
</FileUpload.Trigger>
|
|
110
|
+
<FileUpload.List />
|
|
111
|
+
</FileUpload.Root>
|
|
112
|
+
</div>
|
|
113
|
+
)
|
|
114
|
+
},
|
|
115
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Button, Field, Input, RadioGroup, Switch, Textarea } 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/Form',
|
|
9
|
+
parameters: {
|
|
10
|
+
controls: { disable: true },
|
|
11
|
+
docs: {
|
|
12
|
+
source: { type: 'code' },
|
|
13
|
+
description: { component: '受控输入、开关和单选共同参与原生表单提交与重置。' },
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
} satisfies Meta
|
|
17
|
+
export default meta
|
|
18
|
+
type Story = StoryObj<typeof meta>
|
|
19
|
+
export const Submission: Story = {
|
|
20
|
+
render: function Submission() {
|
|
21
|
+
const [title, setTitle] = useState('')
|
|
22
|
+
const [note, setNote] = useState('')
|
|
23
|
+
const [enabled, setEnabled] = useState(true)
|
|
24
|
+
const [frequency, setFrequency] = useState<string | null>('daily')
|
|
25
|
+
const [submitted, setSubmitted] = useState('尚未读取')
|
|
26
|
+
return (
|
|
27
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
28
|
+
<p>
|
|
29
|
+
点击标签聚焦输入;Tab + 空格操作开关,方向键切换单选并跳过禁用项。读取表单仅展示本地数据。
|
|
30
|
+
</p>
|
|
31
|
+
<form
|
|
32
|
+
className={css({ display: 'grid', gap: '5', maxWidth: 'xl' })}
|
|
33
|
+
onSubmit={(event) => {
|
|
34
|
+
event.preventDefault()
|
|
35
|
+
setSubmitted(JSON.stringify(Object.fromEntries(new FormData(event.currentTarget))))
|
|
36
|
+
}}
|
|
37
|
+
onReset={() => {
|
|
38
|
+
setTitle('')
|
|
39
|
+
setNote('')
|
|
40
|
+
setEnabled(true)
|
|
41
|
+
setFrequency('daily')
|
|
42
|
+
setSubmitted('已重置')
|
|
43
|
+
}}>
|
|
44
|
+
<Field.Root>
|
|
45
|
+
<Field.Label>标题</Field.Label>
|
|
46
|
+
<Input
|
|
47
|
+
name="title"
|
|
48
|
+
value={title}
|
|
49
|
+
onChange={(event) => setTitle(event.target.value)}
|
|
50
|
+
placeholder="输入标题"
|
|
51
|
+
/>
|
|
52
|
+
<Field.HelperText>独立 Input 也能继承 Field 的标签和描述。</Field.HelperText>
|
|
53
|
+
</Field.Root>
|
|
54
|
+
<Field.Root>
|
|
55
|
+
<Field.Label>备注</Field.Label>
|
|
56
|
+
<Textarea
|
|
57
|
+
name="note"
|
|
58
|
+
value={note}
|
|
59
|
+
onChange={(event) => setNote(event.target.value)}
|
|
60
|
+
placeholder="输入多行备注"
|
|
61
|
+
rows={4}
|
|
62
|
+
maxLength={200}
|
|
63
|
+
resize="vertical"
|
|
64
|
+
/>
|
|
65
|
+
<Field.HelperText>{note.length} / 200 字符,可拖动调整高度。</Field.HelperText>
|
|
66
|
+
</Field.Root>
|
|
67
|
+
<Switch.Root
|
|
68
|
+
name="notifications"
|
|
69
|
+
value="enabled"
|
|
70
|
+
checked={enabled}
|
|
71
|
+
onCheckedChange={(details) => setEnabled(details.checked)}>
|
|
72
|
+
<Switch.HiddenInput />
|
|
73
|
+
<Switch.Control />
|
|
74
|
+
<Switch.Label>启用通知</Switch.Label>
|
|
75
|
+
</Switch.Root>
|
|
76
|
+
<RadioGroup.Root
|
|
77
|
+
name="frequency"
|
|
78
|
+
value={frequency}
|
|
79
|
+
onValueChange={(details) => setFrequency(details.value)}
|
|
80
|
+
size="md">
|
|
81
|
+
<RadioGroup.Label>通知频率</RadioGroup.Label>
|
|
82
|
+
<RadioGroup.Item value="immediate">
|
|
83
|
+
<RadioGroup.ItemHiddenInput />
|
|
84
|
+
<RadioGroup.ItemIndicator />
|
|
85
|
+
<RadioGroup.ItemText>立即通知</RadioGroup.ItemText>
|
|
86
|
+
</RadioGroup.Item>
|
|
87
|
+
<RadioGroup.Item value="disabled" disabled>
|
|
88
|
+
<RadioGroup.ItemHiddenInput />
|
|
89
|
+
<RadioGroup.ItemIndicator />
|
|
90
|
+
<RadioGroup.ItemText>禁用选项</RadioGroup.ItemText>
|
|
91
|
+
</RadioGroup.Item>
|
|
92
|
+
<RadioGroup.Item value="daily">
|
|
93
|
+
<RadioGroup.ItemHiddenInput />
|
|
94
|
+
<RadioGroup.ItemIndicator />
|
|
95
|
+
<RadioGroup.ItemText>每日摘要</RadioGroup.ItemText>
|
|
96
|
+
</RadioGroup.Item>
|
|
97
|
+
</RadioGroup.Root>
|
|
98
|
+
<div className={css({ display: 'flex', gap: '3', flexWrap: 'wrap' })}>
|
|
99
|
+
<Button type="submit">读取表单</Button>
|
|
100
|
+
<Button type="reset" variant="outline">
|
|
101
|
+
重置
|
|
102
|
+
</Button>
|
|
103
|
+
<Button
|
|
104
|
+
type="button"
|
|
105
|
+
variant="outline"
|
|
106
|
+
onClick={() => {
|
|
107
|
+
setEnabled(false)
|
|
108
|
+
setFrequency('immediate')
|
|
109
|
+
}}>
|
|
110
|
+
外部关闭通知并切到立即通知
|
|
111
|
+
</Button>
|
|
112
|
+
</div>
|
|
113
|
+
<p role="status">
|
|
114
|
+
通知:{enabled ? '开启' : '关闭'};频率:{frequency || '未选'};表单:{submitted}
|
|
115
|
+
</p>
|
|
116
|
+
</form>
|
|
117
|
+
</div>
|
|
118
|
+
)
|
|
119
|
+
},
|
|
120
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { action } from 'storybook/actions'
|
|
2
|
+
import type { ChangeEvent } from 'react'
|
|
3
|
+
import { Button, Field, Input } 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/Input',
|
|
11
|
+
component: Input,
|
|
12
|
+
args: {
|
|
13
|
+
size: 'md',
|
|
14
|
+
variant: 'outline',
|
|
15
|
+
placeholder: '输入文字',
|
|
16
|
+
disabled: false,
|
|
17
|
+
readOnly: false,
|
|
18
|
+
onChange: (event: ChangeEvent<HTMLInputElement>) =>
|
|
19
|
+
action('onChange')({ value: event.currentTarget.value }),
|
|
20
|
+
},
|
|
21
|
+
argTypes: {
|
|
22
|
+
size: { control: 'select', options: ['2xl', '2xs', 'lg', 'md', 'sm', 'unstyled', 'xl', 'xs'] },
|
|
23
|
+
variant: {
|
|
24
|
+
control: 'select',
|
|
25
|
+
options: ['flushed', 'outline', 'subtle', 'surface', 'unstyled'],
|
|
26
|
+
},
|
|
27
|
+
placeholder: { control: 'text' },
|
|
28
|
+
disabled: { control: 'boolean' },
|
|
29
|
+
readOnly: { control: 'boolean' },
|
|
30
|
+
onChange: { control: false },
|
|
31
|
+
},
|
|
32
|
+
parameters: {
|
|
33
|
+
controls: { disable: true },
|
|
34
|
+
docs: {
|
|
35
|
+
source: { type: 'code' },
|
|
36
|
+
description: { component: '单行输入、Field 状态继承和外观定制。' },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
} satisfies Meta<typeof Input>
|
|
40
|
+
export default meta
|
|
41
|
+
type Story = StoryObj<typeof meta>
|
|
42
|
+
export const Playground: Story = {
|
|
43
|
+
parameters: {
|
|
44
|
+
controls: {
|
|
45
|
+
disable: false,
|
|
46
|
+
include: ['size', 'variant', 'placeholder', 'disabled', 'readOnly'],
|
|
47
|
+
},
|
|
48
|
+
docs: { source: { type: 'dynamic' } },
|
|
49
|
+
},
|
|
50
|
+
render: (args) => (
|
|
51
|
+
<div className={css({ maxWidth: '2xl' })}>
|
|
52
|
+
<Input {...args} />
|
|
53
|
+
</div>
|
|
54
|
+
),
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const ControlledForm: Story = {
|
|
58
|
+
render: function ControlledForm() {
|
|
59
|
+
const [title, setTitle] = useState('')
|
|
60
|
+
|
|
61
|
+
const [submittedForm, setSubmittedForm] = useState('尚未提交')
|
|
62
|
+
return (
|
|
63
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
64
|
+
<form
|
|
65
|
+
noValidate
|
|
66
|
+
onSubmit={(event) => {
|
|
67
|
+
event.preventDefault()
|
|
68
|
+
setSubmittedForm(
|
|
69
|
+
JSON.stringify(Array.from(new FormData(event.currentTarget).entries())),
|
|
70
|
+
)
|
|
71
|
+
}}
|
|
72
|
+
onReset={() => {
|
|
73
|
+
setTitle('')
|
|
74
|
+
setSubmittedForm('已重置')
|
|
75
|
+
}}
|
|
76
|
+
className={css({ display: 'grid', gap: '4' })}>
|
|
77
|
+
<Field.Root>
|
|
78
|
+
<Field.Label>标题</Field.Label>
|
|
79
|
+
<Input
|
|
80
|
+
name="title"
|
|
81
|
+
value={title}
|
|
82
|
+
onChange={(event) => setTitle(event.target.value)}
|
|
83
|
+
placeholder="输入标题"
|
|
84
|
+
/>
|
|
85
|
+
<Field.HelperText>独立 Input 也能继承 Field 的标签和描述。</Field.HelperText>
|
|
86
|
+
</Field.Root>
|
|
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 Variants: Story = {
|
|
102
|
+
tags: ['!dev'],
|
|
103
|
+
render: function Variants() {
|
|
104
|
+
return (
|
|
105
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
106
|
+
<p>Outline 背景透明,Surface 自带背景;使用对比背景展示两者差异。</p>
|
|
107
|
+
<div
|
|
108
|
+
className={css({
|
|
109
|
+
display: 'grid',
|
|
110
|
+
gap: '3',
|
|
111
|
+
bg: 'gray.3',
|
|
112
|
+
padding: '4',
|
|
113
|
+
borderRadius: 'md',
|
|
114
|
+
})}>
|
|
115
|
+
<Input aria-label="Outline 输入" variant="outline" defaultValue="Outline:透明背景" />
|
|
116
|
+
<Input aria-label="Surface 输入" variant="surface" defaultValue="Surface:填充背景" />
|
|
117
|
+
<Input aria-label="Subtle 输入" variant="subtle" defaultValue="Subtle" />
|
|
118
|
+
<Input aria-label="Flushed 输入" variant="flushed" defaultValue="Flushed" />
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
)
|
|
122
|
+
},
|
|
123
|
+
}
|
|
124
|
+
export const Customization: Story = {
|
|
125
|
+
render: function Customization() {
|
|
126
|
+
return (
|
|
127
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
128
|
+
<Field.Root>
|
|
129
|
+
<Field.Label>Input:仅自定尺寸</Field.Label>
|
|
130
|
+
<Input
|
|
131
|
+
size="unstyled"
|
|
132
|
+
name="custom-title"
|
|
133
|
+
height="60px"
|
|
134
|
+
px="6"
|
|
135
|
+
textStyle="lg"
|
|
136
|
+
placeholder="60px 高度,保留 outline"
|
|
137
|
+
/>
|
|
138
|
+
</Field.Root>
|
|
139
|
+
<Field.Root invalid>
|
|
140
|
+
<Field.Label>Input:仅自定外观,错误状态由页面提供</Field.Label>
|
|
141
|
+
<Input
|
|
142
|
+
variant="unstyled"
|
|
143
|
+
name="custom-appearance"
|
|
144
|
+
defaultValue="保留 md 尺寸"
|
|
145
|
+
bg="gray.3"
|
|
146
|
+
borderRadius="full"
|
|
147
|
+
focusVisibleRing="outside"
|
|
148
|
+
_invalid={{ outline: '2px solid', outlineColor: 'red.9' }}
|
|
149
|
+
/>
|
|
150
|
+
<Field.ErrorText>示例错误:自定外观仍接收 Field 状态。</Field.ErrorText>
|
|
151
|
+
</Field.Root>
|
|
152
|
+
</div>
|
|
153
|
+
)
|
|
154
|
+
},
|
|
155
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Field, Group, Input, InputAddon, InputGroup } from '@repo/ui'
|
|
2
|
+
|
|
3
|
+
import { css } from 'styled-system/css'
|
|
4
|
+
|
|
5
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Forms/InputGroup',
|
|
9
|
+
component: InputGroup,
|
|
10
|
+
args: { children: null },
|
|
11
|
+
parameters: {
|
|
12
|
+
controls: { disable: true },
|
|
13
|
+
docs: {
|
|
14
|
+
source: { type: 'code' },
|
|
15
|
+
description: { component: '输入前后装饰、附加文本及尺寸和外观定制。' },
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
} satisfies Meta<typeof InputGroup>
|
|
19
|
+
export default meta
|
|
20
|
+
type Story = StoryObj<typeof meta>
|
|
21
|
+
export const Customization: Story = {
|
|
22
|
+
render: function Customization() {
|
|
23
|
+
return (
|
|
24
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
25
|
+
<div className={css({ display: 'grid', gap: '4' })}>
|
|
26
|
+
<h3 className={css({ textStyle: 'lg', fontWeight: 'semibold' })}>
|
|
27
|
+
输入组合:自定尺寸与外观
|
|
28
|
+
</h3>
|
|
29
|
+
<Field.Root>
|
|
30
|
+
<Field.Label>InputGroup:组合双方分别退出尺寸</Field.Label>
|
|
31
|
+
<InputGroup
|
|
32
|
+
size="unstyled"
|
|
33
|
+
startElement={<span aria-hidden="true">@</span>}
|
|
34
|
+
startElementProps={{ minWidth: '56px' }}>
|
|
35
|
+
<Input
|
|
36
|
+
size="unstyled"
|
|
37
|
+
name="custom-handle"
|
|
38
|
+
height="60px"
|
|
39
|
+
ps="64px"
|
|
40
|
+
paddingInlineEnd="4"
|
|
41
|
+
textStyle="lg"
|
|
42
|
+
placeholder="前缀宽度由页面定义"
|
|
43
|
+
/>
|
|
44
|
+
</InputGroup>
|
|
45
|
+
</Field.Root>
|
|
46
|
+
<Field.Root>
|
|
47
|
+
<Field.Label>InputAddon:自定尺寸</Field.Label>
|
|
48
|
+
<Group attached width="full">
|
|
49
|
+
<InputAddon size="unstyled" px="6" textStyle="lg">
|
|
50
|
+
https://
|
|
51
|
+
</InputAddon>
|
|
52
|
+
<Input
|
|
53
|
+
size="unstyled"
|
|
54
|
+
height="60px"
|
|
55
|
+
px="4"
|
|
56
|
+
textStyle="lg"
|
|
57
|
+
placeholder="example.com"
|
|
58
|
+
/>
|
|
59
|
+
</Group>
|
|
60
|
+
</Field.Root>
|
|
61
|
+
<Field.Root>
|
|
62
|
+
<Field.Label>InputAddon 与 Input:自定外观,保留 md 尺寸</Field.Label>
|
|
63
|
+
<Group attached width="full">
|
|
64
|
+
<InputAddon variant="unstyled" bg="gray.12" color="gray.1">
|
|
65
|
+
https://
|
|
66
|
+
</InputAddon>
|
|
67
|
+
<Input
|
|
68
|
+
variant="unstyled"
|
|
69
|
+
bg="gray.3"
|
|
70
|
+
focusVisibleRing="inside"
|
|
71
|
+
placeholder="example.com"
|
|
72
|
+
/>
|
|
73
|
+
</Group>
|
|
74
|
+
</Field.Root>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
)
|
|
78
|
+
},
|
|
79
|
+
}
|