@oyolincc/create 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +21 -8
- package/templates/hono-fullstack/apps/stack/frontend/routes/__root.tsx +1 -1
- package/templates/hono-fullstack/apps/stack/frontend/routes/index.tsx +35 -12
- package/templates/hono-fullstack/apps/stack/frontend/shared/network/query-hooks.ts +33 -0
- 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 +31 -1
- 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 +31 -1
- 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 +7 -1
- 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,122 @@
|
|
|
1
|
+
import { Alert, Heading } 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: 'Feedback/Alert',
|
|
9
|
+
component: Alert.Root,
|
|
10
|
+
args: { size: 'md', status: 'info', variant: 'subtle' },
|
|
11
|
+
argTypes: {
|
|
12
|
+
size: { control: 'select', options: ['lg', 'md', 'unstyled'] },
|
|
13
|
+
status: { control: 'select', options: ['info', 'success', 'warning', 'error'] },
|
|
14
|
+
variant: { control: 'select', options: ['outline', 'solid', 'subtle', 'surface', 'unstyled'] },
|
|
15
|
+
},
|
|
16
|
+
parameters: {
|
|
17
|
+
controls: { disable: true },
|
|
18
|
+
docs: {
|
|
19
|
+
source: { type: 'code' },
|
|
20
|
+
description: { component: '信息、成功、警告和错误状态及配方对比。' },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
} satisfies Meta<typeof Alert.Root>
|
|
24
|
+
export default meta
|
|
25
|
+
type Story = StoryObj<typeof meta>
|
|
26
|
+
export const Playground: Story = {
|
|
27
|
+
parameters: {
|
|
28
|
+
controls: { disable: false, include: ['size', 'status', 'variant'] },
|
|
29
|
+
docs: { source: { type: 'dynamic' } },
|
|
30
|
+
},
|
|
31
|
+
render: (args) => (
|
|
32
|
+
<div className={css({ maxWidth: '2xl' })}>
|
|
33
|
+
<Alert.Root {...args}>
|
|
34
|
+
<Alert.Indicator />
|
|
35
|
+
<Alert.Content>
|
|
36
|
+
<Alert.Title>状态提示</Alert.Title>
|
|
37
|
+
<Alert.Description>通过 Controls 切换状态与外观。</Alert.Description>
|
|
38
|
+
</Alert.Content>
|
|
39
|
+
</Alert.Root>
|
|
40
|
+
</div>
|
|
41
|
+
),
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const StatusesAndVariants: Story = {
|
|
45
|
+
render: function StatusesAndVariants() {
|
|
46
|
+
return (
|
|
47
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
48
|
+
<div className={css({ display: 'grid', gap: '3', maxWidth: '2xl' })}>
|
|
49
|
+
<Heading as="h3" textStyle="lg">
|
|
50
|
+
提示状态与配方
|
|
51
|
+
</Heading>
|
|
52
|
+
<Alert.Root status="info" variant="subtle">
|
|
53
|
+
<Alert.Indicator aria-hidden="true" />
|
|
54
|
+
<Alert.Content>
|
|
55
|
+
<Alert.Title>信息提示</Alert.Title>
|
|
56
|
+
<Alert.Description>默认图标与柔和背景。</Alert.Description>
|
|
57
|
+
</Alert.Content>
|
|
58
|
+
</Alert.Root>
|
|
59
|
+
<Alert.Root status="success" variant="surface">
|
|
60
|
+
<Alert.Indicator aria-hidden="true">✓</Alert.Indicator>
|
|
61
|
+
<Alert.Content>
|
|
62
|
+
<Alert.Title>操作成功</Alert.Title>
|
|
63
|
+
<Alert.Description>自定义指示图标。</Alert.Description>
|
|
64
|
+
</Alert.Content>
|
|
65
|
+
</Alert.Root>
|
|
66
|
+
<Alert.Root status="warning" variant="outline">
|
|
67
|
+
<Alert.Indicator asChild>
|
|
68
|
+
<span aria-hidden="true">!</span>
|
|
69
|
+
</Alert.Indicator>
|
|
70
|
+
<Alert.Content>
|
|
71
|
+
<Alert.Title>请注意</Alert.Title>
|
|
72
|
+
<Alert.Description>asChild 应复用提供的 span。</Alert.Description>
|
|
73
|
+
</Alert.Content>
|
|
74
|
+
</Alert.Root>
|
|
75
|
+
<Alert.Root status="error" variant="solid" size="lg">
|
|
76
|
+
<Alert.Indicator aria-hidden="true" />
|
|
77
|
+
<Alert.Content>
|
|
78
|
+
<Alert.Title>错误提示</Alert.Title>
|
|
79
|
+
<Alert.Description>通过文字明确状态,不只依赖颜色。</Alert.Description>
|
|
80
|
+
</Alert.Content>
|
|
81
|
+
</Alert.Root>
|
|
82
|
+
<Alert.Root status="success">
|
|
83
|
+
<Alert.Indicator aria-hidden="true" />
|
|
84
|
+
<Alert.Title>成功状态默认使用勾选图标</Alert.Title>
|
|
85
|
+
</Alert.Root>
|
|
86
|
+
<Alert.Root status="warning">
|
|
87
|
+
<Alert.Indicator aria-hidden="true" />
|
|
88
|
+
<Alert.Title>警告状态默认使用警告图标</Alert.Title>
|
|
89
|
+
</Alert.Root>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
)
|
|
93
|
+
},
|
|
94
|
+
}
|
|
95
|
+
export const Customization: Story = {
|
|
96
|
+
render: function Customization() {
|
|
97
|
+
return (
|
|
98
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
99
|
+
<Alert.Root size="unstyled" status="success" p="3" gap="2" textStyle="sm">
|
|
100
|
+
<Alert.Indicator css={{ _icon: { width: '18px', height: '18px' } }} />
|
|
101
|
+
<Alert.Content gap="1">
|
|
102
|
+
<Alert.Title>自定尺寸</Alert.Title>
|
|
103
|
+
<Alert.Description>保留默认外观与成功状态。</Alert.Description>
|
|
104
|
+
</Alert.Content>
|
|
105
|
+
</Alert.Root>
|
|
106
|
+
<Alert.Root
|
|
107
|
+
variant="unstyled"
|
|
108
|
+
status="success"
|
|
109
|
+
bg="gray.3"
|
|
110
|
+
borderRadius="lg"
|
|
111
|
+
borderInlineStart="3px solid"
|
|
112
|
+
borderColor="lime.9">
|
|
113
|
+
<Alert.Indicator color="lime.11" />
|
|
114
|
+
<Alert.Content>
|
|
115
|
+
<Alert.Title fontWeight="bold">自定外观</Alert.Title>
|
|
116
|
+
<Alert.Description>保留 md 尺寸及状态图标。</Alert.Description>
|
|
117
|
+
</Alert.Content>
|
|
118
|
+
</Alert.Root>
|
|
119
|
+
</div>
|
|
120
|
+
)
|
|
121
|
+
},
|
|
122
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { Button, Progress, Text } 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: 'Feedback/Progress',
|
|
9
|
+
component: Progress.Root,
|
|
10
|
+
args: {
|
|
11
|
+
shape: 'rounded',
|
|
12
|
+
size: 'md',
|
|
13
|
+
variant: 'solid',
|
|
14
|
+
value: 40,
|
|
15
|
+
striped: false,
|
|
16
|
+
animated: false,
|
|
17
|
+
},
|
|
18
|
+
argTypes: {
|
|
19
|
+
animated: { control: 'boolean' },
|
|
20
|
+
shape: { control: 'select', options: ['full', 'rounded', 'square', 'unstyled'] },
|
|
21
|
+
size: { control: 'select', options: ['lg', 'md', 'sm', 'unstyled', 'xl', 'xs'] },
|
|
22
|
+
striped: { control: 'boolean' },
|
|
23
|
+
variant: { control: 'select', options: ['solid', 'subtle', 'unstyled'] },
|
|
24
|
+
value: { control: 'number' },
|
|
25
|
+
},
|
|
26
|
+
parameters: {
|
|
27
|
+
controls: { disable: true },
|
|
28
|
+
docs: {
|
|
29
|
+
source: { type: 'code' },
|
|
30
|
+
description: { component: '确定与未定进度、条纹动画和轨道定制。' },
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
} satisfies Meta<typeof Progress.Root>
|
|
34
|
+
export default meta
|
|
35
|
+
type Story = StoryObj<typeof meta>
|
|
36
|
+
export const Playground: Story = {
|
|
37
|
+
parameters: {
|
|
38
|
+
controls: {
|
|
39
|
+
disable: false,
|
|
40
|
+
include: ['animated', 'shape', 'size', 'striped', 'variant', 'value'],
|
|
41
|
+
},
|
|
42
|
+
docs: { source: { type: 'dynamic' } },
|
|
43
|
+
},
|
|
44
|
+
render: (args) => (
|
|
45
|
+
<div className={css({ maxWidth: '2xl' })}>
|
|
46
|
+
<Progress.Root {...args}>
|
|
47
|
+
<Progress.Label>任务进度</Progress.Label>
|
|
48
|
+
<Progress.ValueText />
|
|
49
|
+
<Progress.Track>
|
|
50
|
+
<Progress.Range />
|
|
51
|
+
</Progress.Track>
|
|
52
|
+
</Progress.Root>
|
|
53
|
+
</div>
|
|
54
|
+
),
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const Controlled: Story = {
|
|
58
|
+
render: function Controlled() {
|
|
59
|
+
const [value, setValue] = useState(40)
|
|
60
|
+
const [indeterminate, setIndeterminate] = useState(false)
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
64
|
+
<div className={css({ display: 'flex', flexWrap: 'wrap', gap: '3' })}>
|
|
65
|
+
<Button
|
|
66
|
+
type="button"
|
|
67
|
+
variant="outline"
|
|
68
|
+
disabled={value === 0}
|
|
69
|
+
onClick={() => setValue((current) => Math.max(0, current - 20))}>
|
|
70
|
+
减少
|
|
71
|
+
</Button>
|
|
72
|
+
<Button
|
|
73
|
+
type="button"
|
|
74
|
+
variant="outline"
|
|
75
|
+
disabled={value === 100}
|
|
76
|
+
onClick={() => setValue((current) => Math.min(100, current + 20))}>
|
|
77
|
+
增加
|
|
78
|
+
</Button>
|
|
79
|
+
<Button
|
|
80
|
+
type="button"
|
|
81
|
+
variant="outline"
|
|
82
|
+
onClick={() => setIndeterminate((current) => !current)}>
|
|
83
|
+
{indeterminate ? '使用确定值' : '使用未定进度'}
|
|
84
|
+
</Button>
|
|
85
|
+
</div>
|
|
86
|
+
<Progress.Root value={indeterminate ? null : value} shape="full">
|
|
87
|
+
<div className={css({ display: 'flex', justifyContent: 'space-between', mb: '2' })}>
|
|
88
|
+
<Progress.Label>任务进度</Progress.Label>
|
|
89
|
+
<Progress.ValueText />
|
|
90
|
+
</div>
|
|
91
|
+
<Progress.Track>
|
|
92
|
+
<Progress.Range />
|
|
93
|
+
</Progress.Track>
|
|
94
|
+
</Progress.Root>
|
|
95
|
+
<Progress.Root value={value} variant="subtle" striped animated size="lg">
|
|
96
|
+
<Progress.Label>条纹进度</Progress.Label>
|
|
97
|
+
<Progress.Track>
|
|
98
|
+
<Progress.Range />
|
|
99
|
+
</Progress.Track>
|
|
100
|
+
</Progress.Root>
|
|
101
|
+
<Text role="status">{indeterminate ? '未定进度' : `当前进度 ${value}%`}</Text>
|
|
102
|
+
</div>
|
|
103
|
+
)
|
|
104
|
+
},
|
|
105
|
+
}
|
|
106
|
+
export const Customization: Story = {
|
|
107
|
+
render: function Customization() {
|
|
108
|
+
const [value, setValue] = useState(40)
|
|
109
|
+
const [indeterminate, setIndeterminate] = useState(false)
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
113
|
+
<div className={css({ display: 'flex', flexWrap: 'wrap', gap: '3' })}>
|
|
114
|
+
<Button
|
|
115
|
+
type="button"
|
|
116
|
+
variant="outline"
|
|
117
|
+
disabled={value === 0}
|
|
118
|
+
onClick={() => setValue((current) => Math.max(0, current - 20))}>
|
|
119
|
+
减少
|
|
120
|
+
</Button>
|
|
121
|
+
<Button
|
|
122
|
+
type="button"
|
|
123
|
+
variant="outline"
|
|
124
|
+
disabled={value === 100}
|
|
125
|
+
onClick={() => setValue((current) => Math.min(100, current + 20))}>
|
|
126
|
+
增加
|
|
127
|
+
</Button>
|
|
128
|
+
<Button
|
|
129
|
+
type="button"
|
|
130
|
+
variant="outline"
|
|
131
|
+
onClick={() => setIndeterminate((current) => !current)}>
|
|
132
|
+
{indeterminate ? '使用确定值' : '使用未定进度'}
|
|
133
|
+
</Button>
|
|
134
|
+
</div>
|
|
135
|
+
<Progress.Root size="unstyled" value={indeterminate ? null : value} textStyle="sm">
|
|
136
|
+
<Progress.Label gap="1">自定轨道尺寸</Progress.Label>
|
|
137
|
+
<Progress.ValueText textStyle="xs" lineHeight="1" />
|
|
138
|
+
<Progress.Track height="6px">
|
|
139
|
+
<Progress.Range />
|
|
140
|
+
</Progress.Track>
|
|
141
|
+
</Progress.Root>
|
|
142
|
+
<Progress.Root variant="unstyled" value={indeterminate ? null : value}>
|
|
143
|
+
<Progress.Label>自定配色,保留 md 尺寸与未定动画</Progress.Label>
|
|
144
|
+
<Progress.Track bg="gray.3">
|
|
145
|
+
<Progress.Range bg="lime.9" />
|
|
146
|
+
</Progress.Track>
|
|
147
|
+
</Progress.Root>
|
|
148
|
+
<Progress.Root shape="unstyled" size="sm" value={value}>
|
|
149
|
+
<Progress.Label>自定轨道圆角</Progress.Label>
|
|
150
|
+
<Progress.Track borderRadius="3px">
|
|
151
|
+
<Progress.Range />
|
|
152
|
+
</Progress.Track>
|
|
153
|
+
</Progress.Root>
|
|
154
|
+
<Progress.Root value={indeterminate ? null : value} striped animated>
|
|
155
|
+
<Progress.Label>默认条纹与未定状态组合对照</Progress.Label>
|
|
156
|
+
<Progress.Track>
|
|
157
|
+
<Progress.Range />
|
|
158
|
+
</Progress.Track>
|
|
159
|
+
</Progress.Root>
|
|
160
|
+
</div>
|
|
161
|
+
)
|
|
162
|
+
},
|
|
163
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { Button, ProgressCircle, Text, useProgress } 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: 'Feedback/ProgressCircle',
|
|
9
|
+
component: ProgressCircle.Root,
|
|
10
|
+
args: { size: 'md', variant: 'solid', value: 40 },
|
|
11
|
+
argTypes: {
|
|
12
|
+
size: { control: 'select', options: ['lg', 'md', 'sm', 'unstyled', 'xl', 'xs'] },
|
|
13
|
+
variant: { control: 'select', options: ['solid', 'subtle', 'unstyled'] },
|
|
14
|
+
value: { control: 'number' },
|
|
15
|
+
},
|
|
16
|
+
parameters: {
|
|
17
|
+
controls: { disable: true },
|
|
18
|
+
docs: {
|
|
19
|
+
source: { type: 'code' },
|
|
20
|
+
description: { component: '圆形进度、居中数值、未定状态和外部 store。' },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
} satisfies Meta<typeof ProgressCircle.Root>
|
|
24
|
+
export default meta
|
|
25
|
+
type Story = StoryObj<typeof meta>
|
|
26
|
+
export const Playground: Story = {
|
|
27
|
+
parameters: {
|
|
28
|
+
controls: { disable: false, include: ['size', 'variant', 'value'] },
|
|
29
|
+
docs: { source: { type: 'dynamic' } },
|
|
30
|
+
},
|
|
31
|
+
render: (args) => (
|
|
32
|
+
<div className={css({ maxWidth: '2xl' })}>
|
|
33
|
+
<ProgressCircle.Root {...args}>
|
|
34
|
+
<ProgressCircle.Label>圆形进度</ProgressCircle.Label>
|
|
35
|
+
<ProgressCircle.Circle>
|
|
36
|
+
<ProgressCircle.Track />
|
|
37
|
+
<ProgressCircle.Range />
|
|
38
|
+
</ProgressCircle.Circle>
|
|
39
|
+
<ProgressCircle.ValueText />
|
|
40
|
+
</ProgressCircle.Root>
|
|
41
|
+
</div>
|
|
42
|
+
),
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const Controlled: Story = {
|
|
46
|
+
render: function Controlled() {
|
|
47
|
+
const [value, setValue] = useState(40)
|
|
48
|
+
const [indeterminate, setIndeterminate] = useState(false)
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
52
|
+
<div className={css({ display: 'flex', flexWrap: 'wrap', gap: '3' })}>
|
|
53
|
+
<Button
|
|
54
|
+
type="button"
|
|
55
|
+
variant="outline"
|
|
56
|
+
disabled={value === 0}
|
|
57
|
+
onClick={() => setValue((current) => Math.max(0, current - 20))}>
|
|
58
|
+
减少
|
|
59
|
+
</Button>
|
|
60
|
+
<Button
|
|
61
|
+
type="button"
|
|
62
|
+
variant="outline"
|
|
63
|
+
disabled={value === 100}
|
|
64
|
+
onClick={() => setValue((current) => Math.min(100, current + 20))}>
|
|
65
|
+
增加
|
|
66
|
+
</Button>
|
|
67
|
+
<Button
|
|
68
|
+
type="button"
|
|
69
|
+
variant="outline"
|
|
70
|
+
onClick={() => setIndeterminate((current) => !current)}>
|
|
71
|
+
{indeterminate ? '使用确定值' : '使用未定进度'}
|
|
72
|
+
</Button>
|
|
73
|
+
</div>
|
|
74
|
+
<ProgressCircle.Root value={indeterminate ? null : value} size="xl">
|
|
75
|
+
<ProgressCircle.Label>圆形任务进度</ProgressCircle.Label>
|
|
76
|
+
<div className={css({ display: 'flex', alignItems: 'center', gap: '3', mt: '2' })}>
|
|
77
|
+
<ProgressCircle.Circle>
|
|
78
|
+
<ProgressCircle.Track />
|
|
79
|
+
<ProgressCircle.Range />
|
|
80
|
+
</ProgressCircle.Circle>
|
|
81
|
+
<ProgressCircle.ValueText />
|
|
82
|
+
</div>
|
|
83
|
+
</ProgressCircle.Root>
|
|
84
|
+
<Text role="status">{indeterminate ? '未定进度' : `当前进度 ${value}%`}</Text>
|
|
85
|
+
</div>
|
|
86
|
+
)
|
|
87
|
+
},
|
|
88
|
+
}
|
|
89
|
+
export const Store: Story = {
|
|
90
|
+
render: function Store() {
|
|
91
|
+
const progress = useProgress({ defaultValue: 25 })
|
|
92
|
+
return (
|
|
93
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
94
|
+
<ProgressCircle.RootProvider value={progress} size="xl" variant="subtle">
|
|
95
|
+
<ProgressCircle.Label>独立 store 与居中数值</ProgressCircle.Label>
|
|
96
|
+
<div className={css({ display: 'flex', alignItems: 'center', gap: '3', mt: '2' })}>
|
|
97
|
+
<div className={css({ position: 'relative', display: 'inline-flex' })}>
|
|
98
|
+
<ProgressCircle.Circle css={{ '--thickness': '5px' }}>
|
|
99
|
+
<ProgressCircle.Track />
|
|
100
|
+
<ProgressCircle.Range strokeLinecap="round" />
|
|
101
|
+
</ProgressCircle.Circle>
|
|
102
|
+
<div
|
|
103
|
+
className={css({
|
|
104
|
+
position: 'absolute',
|
|
105
|
+
inset: '0',
|
|
106
|
+
display: 'grid',
|
|
107
|
+
placeItems: 'center',
|
|
108
|
+
})}>
|
|
109
|
+
<ProgressCircle.ValueText />
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
<Button
|
|
113
|
+
type="button"
|
|
114
|
+
variant="outline"
|
|
115
|
+
onClick={() =>
|
|
116
|
+
progress.setValue(progress.value === 100 ? 0 : (progress.value || 0) + 25)
|
|
117
|
+
}>
|
|
118
|
+
{progress.value === 100 ? '重置 store' : 'store 增加 25%'}
|
|
119
|
+
</Button>
|
|
120
|
+
</div>
|
|
121
|
+
</ProgressCircle.RootProvider>
|
|
122
|
+
</div>
|
|
123
|
+
)
|
|
124
|
+
},
|
|
125
|
+
}
|
|
126
|
+
export const Customization: Story = {
|
|
127
|
+
render: function Customization() {
|
|
128
|
+
const [value, setValue] = useState(40)
|
|
129
|
+
const [indeterminate, setIndeterminate] = useState(false)
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
133
|
+
<div className={css({ display: 'flex', flexWrap: 'wrap', gap: '3' })}>
|
|
134
|
+
<Button
|
|
135
|
+
type="button"
|
|
136
|
+
variant="outline"
|
|
137
|
+
disabled={value === 0}
|
|
138
|
+
onClick={() => setValue((current) => Math.max(0, current - 20))}>
|
|
139
|
+
减少
|
|
140
|
+
</Button>
|
|
141
|
+
<Button
|
|
142
|
+
type="button"
|
|
143
|
+
variant="outline"
|
|
144
|
+
disabled={value === 100}
|
|
145
|
+
onClick={() => setValue((current) => Math.min(100, current + 20))}>
|
|
146
|
+
增加
|
|
147
|
+
</Button>
|
|
148
|
+
<Button
|
|
149
|
+
type="button"
|
|
150
|
+
variant="outline"
|
|
151
|
+
onClick={() => setIndeterminate((current) => !current)}>
|
|
152
|
+
{indeterminate ? '使用确定值' : '使用未定进度'}
|
|
153
|
+
</Button>
|
|
154
|
+
</div>
|
|
155
|
+
<div className={css({ display: 'flex', alignItems: 'start', gap: '6', flexWrap: 'wrap' })}>
|
|
156
|
+
<ProgressCircle.Root size="unstyled" value={indeterminate ? null : value} textStyle="sm">
|
|
157
|
+
<ProgressCircle.Label gap="1">自定圆环尺寸</ProgressCircle.Label>
|
|
158
|
+
<ProgressCircle.Circle css={{ '--size': '32px', '--thickness': '3px' }}>
|
|
159
|
+
<ProgressCircle.Track />
|
|
160
|
+
<ProgressCircle.Range />
|
|
161
|
+
</ProgressCircle.Circle>
|
|
162
|
+
<ProgressCircle.ValueText textStyle="xs" lineHeight="1" />
|
|
163
|
+
</ProgressCircle.Root>
|
|
164
|
+
<ProgressCircle.Root variant="unstyled" value={indeterminate ? null : value}>
|
|
165
|
+
<ProgressCircle.Label>自定圆环配色</ProgressCircle.Label>
|
|
166
|
+
<ProgressCircle.Circle>
|
|
167
|
+
<ProgressCircle.Track stroke="gray.4" />
|
|
168
|
+
<ProgressCircle.Range stroke="lime.9" strokeLinecap="round" />
|
|
169
|
+
</ProgressCircle.Circle>
|
|
170
|
+
<ProgressCircle.ValueText />
|
|
171
|
+
</ProgressCircle.Root>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
)
|
|
175
|
+
},
|
|
176
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Button, Skeleton, SkeletonCircle, SkeletonText } 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: 'Feedback/Skeleton',
|
|
9
|
+
component: Skeleton,
|
|
10
|
+
args: { loading: true, variant: 'pulse' },
|
|
11
|
+
argTypes: {
|
|
12
|
+
circle: { control: 'boolean' },
|
|
13
|
+
loading: { control: 'boolean' },
|
|
14
|
+
variant: { control: 'select', options: ['none', 'pulse', 'shine'] },
|
|
15
|
+
},
|
|
16
|
+
parameters: {
|
|
17
|
+
controls: { disable: true },
|
|
18
|
+
docs: {
|
|
19
|
+
source: { type: 'code' },
|
|
20
|
+
description: { component: '占位动画、圆形与多行占位和内容切换。' },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
} satisfies Meta<typeof Skeleton>
|
|
24
|
+
export default meta
|
|
25
|
+
type Story = StoryObj<typeof meta>
|
|
26
|
+
export const Playground: Story = {
|
|
27
|
+
parameters: {
|
|
28
|
+
controls: { disable: false, include: ['circle', 'loading', 'variant'] },
|
|
29
|
+
docs: { source: { type: 'dynamic' } },
|
|
30
|
+
},
|
|
31
|
+
render: (args) => (
|
|
32
|
+
<div className={css({ maxWidth: '2xl' })}>
|
|
33
|
+
<Skeleton {...args} p="4" minHeight="20">
|
|
34
|
+
加载完成后的内容
|
|
35
|
+
</Skeleton>
|
|
36
|
+
</div>
|
|
37
|
+
),
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const LoadingAndContent: Story = {
|
|
41
|
+
render: function LoadingAndContent() {
|
|
42
|
+
const [loading, setLoading] = useState(true)
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
46
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: 'xl' })}>
|
|
47
|
+
<h3 className={css({ textStyle: 'lg', fontWeight: 'semibold' })}>
|
|
48
|
+
Skeleton 占位与内容切换
|
|
49
|
+
</h3>
|
|
50
|
+
<div
|
|
51
|
+
className={css({ display: 'flex', alignItems: 'center', gap: '4' })}
|
|
52
|
+
aria-hidden="true">
|
|
53
|
+
<SkeletonCircle boxSize="12" />
|
|
54
|
+
<SkeletonText noOfLines={3} rootProps={{ flex: '1' }} />
|
|
55
|
+
</div>
|
|
56
|
+
<div className={css({ display: 'grid', gap: '3' })} aria-hidden="true">
|
|
57
|
+
<Skeleton variant="pulse" height="8" />
|
|
58
|
+
<Skeleton variant="shine" height="8" />
|
|
59
|
+
<Skeleton variant="none" height="8" bg="gray.subtle.bg.active" />
|
|
60
|
+
</div>
|
|
61
|
+
<Button type="button" variant="outline" onClick={() => setLoading((value) => !value)}>
|
|
62
|
+
{loading ? '显示内容' : '恢复加载占位'}
|
|
63
|
+
</Button>
|
|
64
|
+
<div aria-busy={loading}>
|
|
65
|
+
<Skeleton loading={loading} aria-hidden={loading} padding="4" minHeight="20">
|
|
66
|
+
<p>加载完成后的真实内容。</p>
|
|
67
|
+
<p>关闭 loading 后应恢复文字可见性,并退出占位动画。</p>
|
|
68
|
+
</Skeleton>
|
|
69
|
+
</div>
|
|
70
|
+
<p role="status">当前状态:{loading ? '加载中' : '内容已显示'}</p>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
)
|
|
74
|
+
},
|
|
75
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Spinner } 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: 'Feedback/Spinner',
|
|
9
|
+
component: Spinner,
|
|
10
|
+
args: { size: 'md' },
|
|
11
|
+
argTypes: {
|
|
12
|
+
size: { control: 'select', options: ['2xl', 'inherit', 'lg', 'md', 'sm', 'xl', 'xs'] },
|
|
13
|
+
},
|
|
14
|
+
parameters: {
|
|
15
|
+
controls: { disable: true },
|
|
16
|
+
docs: {
|
|
17
|
+
source: { type: 'code' },
|
|
18
|
+
description: { component: '加载指示器的尺寸与可访问文本。' },
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
} satisfies Meta<typeof Spinner>
|
|
22
|
+
export default meta
|
|
23
|
+
type Story = StoryObj<typeof meta>
|
|
24
|
+
export const Playground: Story = {
|
|
25
|
+
parameters: {
|
|
26
|
+
controls: { disable: false, include: ['size'] },
|
|
27
|
+
docs: { source: { type: 'dynamic' } },
|
|
28
|
+
},
|
|
29
|
+
render: (args) => (
|
|
30
|
+
<div className={css({ maxWidth: '2xl' })}>
|
|
31
|
+
<Spinner {...args} aria-label="加载中" role="status" />
|
|
32
|
+
</div>
|
|
33
|
+
),
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const Sizes: Story = {
|
|
37
|
+
tags: ['!dev'],
|
|
38
|
+
render: function Sizes() {
|
|
39
|
+
return (
|
|
40
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
41
|
+
<span className={css({ display: 'inline-flex', alignItems: 'center', gap: '2' })}>
|
|
42
|
+
<Spinner size="sm" aria-hidden="true" />
|
|
43
|
+
加载中
|
|
44
|
+
</span>
|
|
45
|
+
<Spinner size="lg" aria-label="加载中" role="status" />
|
|
46
|
+
</div>
|
|
47
|
+
)
|
|
48
|
+
},
|
|
49
|
+
}
|