@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,334 @@
|
|
|
1
|
+
import { fn } from 'storybook/test'
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Combobox,
|
|
5
|
+
Portal,
|
|
6
|
+
createListCollection,
|
|
7
|
+
useCombobox,
|
|
8
|
+
useListCollection,
|
|
9
|
+
} from '@repo/ui'
|
|
10
|
+
import { useState } from 'react'
|
|
11
|
+
import { css } from 'styled-system/css'
|
|
12
|
+
|
|
13
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
14
|
+
interface Framework {
|
|
15
|
+
value: string
|
|
16
|
+
label: string
|
|
17
|
+
category: string
|
|
18
|
+
}
|
|
19
|
+
const collection = createListCollection<Framework>({
|
|
20
|
+
items: [
|
|
21
|
+
{ value: 'react', label: 'React', category: '组件库' },
|
|
22
|
+
{ value: 'vue', label: 'Vue', category: '渐进式框架' },
|
|
23
|
+
{ value: 'solid', label: 'Solid', category: '细粒度响应式' },
|
|
24
|
+
],
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const items = [
|
|
28
|
+
{ name: 'React', id: 'react', disabled: false },
|
|
29
|
+
{ name: 'Vue', id: 'vue', disabled: false },
|
|
30
|
+
{ name: 'Solid(禁用)', id: 'solid', disabled: true },
|
|
31
|
+
{ name: 'Svelte', id: 'svelte', disabled: false },
|
|
32
|
+
]
|
|
33
|
+
const multipleCollection = createListCollection({
|
|
34
|
+
items,
|
|
35
|
+
itemToString: (item) => item.name,
|
|
36
|
+
itemToValue: (item) => item.id,
|
|
37
|
+
})
|
|
38
|
+
const meta = {
|
|
39
|
+
title: 'Collections/Combobox',
|
|
40
|
+
component: Combobox.Root<(typeof items)[number]>,
|
|
41
|
+
args: {
|
|
42
|
+
collection: multipleCollection,
|
|
43
|
+
size: 'md',
|
|
44
|
+
variant: 'outline',
|
|
45
|
+
disabled: false,
|
|
46
|
+
multiple: false,
|
|
47
|
+
onValueChange: fn(),
|
|
48
|
+
},
|
|
49
|
+
argTypes: {
|
|
50
|
+
size: { control: 'select', options: ['lg', 'md', 'sm', 'unstyled', 'xl', 'xs'] },
|
|
51
|
+
variant: { control: 'select', options: ['outline', 'subtle', 'surface', 'unstyled'] },
|
|
52
|
+
disabled: { control: 'boolean' },
|
|
53
|
+
multiple: { control: 'boolean' },
|
|
54
|
+
onValueChange: { control: false },
|
|
55
|
+
},
|
|
56
|
+
parameters: {
|
|
57
|
+
controls: { disable: true },
|
|
58
|
+
docs: {
|
|
59
|
+
source: { type: 'code' },
|
|
60
|
+
description: { component: '输入过滤、空状态、多选、动态添加和泛型 store。' },
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
} satisfies Meta<typeof Combobox.Root<(typeof items)[number]>>
|
|
64
|
+
export default meta
|
|
65
|
+
type Story = StoryObj<typeof meta>
|
|
66
|
+
export const Playground: Story = {
|
|
67
|
+
parameters: {
|
|
68
|
+
controls: { disable: false, include: ['size', 'variant', 'disabled', 'multiple'] },
|
|
69
|
+
docs: { source: { type: 'dynamic' } },
|
|
70
|
+
},
|
|
71
|
+
render: (args) => (
|
|
72
|
+
<div className={css({ maxWidth: '2xl' })}>
|
|
73
|
+
<Combobox.Root {...args}>
|
|
74
|
+
<Combobox.Label>选择框架</Combobox.Label>
|
|
75
|
+
<Combobox.Control>
|
|
76
|
+
<Combobox.Input placeholder="输入或选择框架" />
|
|
77
|
+
<Combobox.IndicatorGroup>
|
|
78
|
+
<Combobox.ClearTrigger aria-label="清空" />
|
|
79
|
+
<Combobox.Trigger aria-label="打开列表" />
|
|
80
|
+
</Combobox.IndicatorGroup>
|
|
81
|
+
</Combobox.Control>
|
|
82
|
+
<Portal>
|
|
83
|
+
<Combobox.Positioner>
|
|
84
|
+
<Combobox.Content>
|
|
85
|
+
{args.collection.items.map((item) => (
|
|
86
|
+
<Combobox.Item key={item.id} item={item}>
|
|
87
|
+
<Combobox.ItemText>{item.name}</Combobox.ItemText>
|
|
88
|
+
<Combobox.ItemIndicator />
|
|
89
|
+
</Combobox.Item>
|
|
90
|
+
))}
|
|
91
|
+
</Combobox.Content>
|
|
92
|
+
</Combobox.Positioner>
|
|
93
|
+
</Portal>
|
|
94
|
+
</Combobox.Root>
|
|
95
|
+
</div>
|
|
96
|
+
),
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export const Store: Story = {
|
|
100
|
+
render: function Store() {
|
|
101
|
+
const [suggestion, setSuggestion] = useState('尚未选择')
|
|
102
|
+
|
|
103
|
+
const comboboxProps = {
|
|
104
|
+
collection,
|
|
105
|
+
onValueChange: (details: Combobox.ValueChangeDetails<Framework>) => {
|
|
106
|
+
setSuggestion(details.items[0]?.category || '尚未选择')
|
|
107
|
+
},
|
|
108
|
+
} satisfies Combobox.RootProps<Framework>
|
|
109
|
+
const combobox = useCombobox(comboboxProps)
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
113
|
+
<div className={css({ display: 'grid', gap: '3' })}>
|
|
114
|
+
<Combobox.RootProvider value={combobox} size="md" variant="outline">
|
|
115
|
+
<Combobox.Label>Combobox 的泛型 Props 与 RootProvider</Combobox.Label>
|
|
116
|
+
<Combobox.Control>
|
|
117
|
+
<Combobox.Input placeholder="输入或选择框架(此示例不做过滤)" />
|
|
118
|
+
<Combobox.IndicatorGroup>
|
|
119
|
+
<Combobox.ClearTrigger aria-label="清空框架" />
|
|
120
|
+
<Combobox.Trigger aria-label="打开框架列表" />
|
|
121
|
+
</Combobox.IndicatorGroup>
|
|
122
|
+
</Combobox.Control>
|
|
123
|
+
<Portal>
|
|
124
|
+
<Combobox.Positioner>
|
|
125
|
+
<Combobox.Content>
|
|
126
|
+
{collection.items.map((item) => (
|
|
127
|
+
<Combobox.Item key={item.value} item={item}>
|
|
128
|
+
<Combobox.ItemText>{item.label}</Combobox.ItemText>
|
|
129
|
+
<Combobox.ItemIndicator aria-label="已选择">
|
|
130
|
+
<span aria-hidden="true">✓</span>
|
|
131
|
+
</Combobox.ItemIndicator>
|
|
132
|
+
</Combobox.Item>
|
|
133
|
+
))}
|
|
134
|
+
</Combobox.Content>
|
|
135
|
+
</Combobox.Positioner>
|
|
136
|
+
</Portal>
|
|
137
|
+
</Combobox.RootProvider>
|
|
138
|
+
<div className={css({ display: 'flex', gap: '2', flexWrap: 'wrap' })}>
|
|
139
|
+
<Button variant="outline" onClick={() => combobox.setValue(['solid'])}>
|
|
140
|
+
外部设为 Solid
|
|
141
|
+
</Button>
|
|
142
|
+
<Button variant="outline" onClick={() => combobox.setOpen(true)}>
|
|
143
|
+
外部打开
|
|
144
|
+
</Button>
|
|
145
|
+
</div>
|
|
146
|
+
<p role="status">泛型事件中的自定义字段:{suggestion}</p>
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
)
|
|
150
|
+
},
|
|
151
|
+
}
|
|
152
|
+
export const FilteringAndMultiple: Story = {
|
|
153
|
+
render: function FilteringAndMultiple() {
|
|
154
|
+
const { collection, filter, append } = useListCollection({
|
|
155
|
+
initialItems: items,
|
|
156
|
+
itemToString: (item) => item.name,
|
|
157
|
+
itemToValue: (item) => item.id,
|
|
158
|
+
filter: (text, query) => text.toLowerCase().includes(query.toLowerCase()),
|
|
159
|
+
})
|
|
160
|
+
const [value, setValue] = useState<string[]>([])
|
|
161
|
+
const [selected, setSelected] = useState('尚未选择')
|
|
162
|
+
const [multipleValue, setMultipleValue] = useState<string[]>(['react'])
|
|
163
|
+
const [added, setAdded] = useState(false)
|
|
164
|
+
return (
|
|
165
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
166
|
+
<p>输入英文过滤,使用方向键和 Enter 选择,Escape 关闭;输入 zzz 检查空状态。</p>
|
|
167
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: 'md' })}>
|
|
168
|
+
<Combobox.Root
|
|
169
|
+
collection={collection}
|
|
170
|
+
value={value}
|
|
171
|
+
onValueChange={(details) => {
|
|
172
|
+
setValue(details.value)
|
|
173
|
+
setSelected(details.items.map((item) => item.name).join(', ') || '尚未选择')
|
|
174
|
+
}}
|
|
175
|
+
onInputValueChange={(details) => filter(details.inputValue)}
|
|
176
|
+
onOpenChange={(details) => {
|
|
177
|
+
if (details.open) filter('')
|
|
178
|
+
}}
|
|
179
|
+
size="md"
|
|
180
|
+
variant="outline">
|
|
181
|
+
<Combobox.Label>可过滤的受控单选</Combobox.Label>
|
|
182
|
+
<Combobox.Control>
|
|
183
|
+
<Combobox.Input placeholder="输入框架名称" />
|
|
184
|
+
<Combobox.IndicatorGroup>
|
|
185
|
+
<Combobox.ClearTrigger aria-label="清空单选" />
|
|
186
|
+
<Combobox.Trigger aria-label="展开单选列表" />
|
|
187
|
+
</Combobox.IndicatorGroup>
|
|
188
|
+
</Combobox.Control>
|
|
189
|
+
<Portal>
|
|
190
|
+
<Combobox.Positioner>
|
|
191
|
+
<Combobox.Content>
|
|
192
|
+
<Combobox.Empty>没有匹配的框架</Combobox.Empty>
|
|
193
|
+
{collection.items.map((item) => (
|
|
194
|
+
<Combobox.Item key={item.id} item={item}>
|
|
195
|
+
<Combobox.ItemText>{item.name}</Combobox.ItemText>
|
|
196
|
+
<Combobox.ItemIndicator />
|
|
197
|
+
</Combobox.Item>
|
|
198
|
+
))}
|
|
199
|
+
</Combobox.Content>
|
|
200
|
+
</Combobox.Positioner>
|
|
201
|
+
</Portal>
|
|
202
|
+
</Combobox.Root>
|
|
203
|
+
<p role="status">
|
|
204
|
+
单选:{selected}({value.join(', ') || '空'})
|
|
205
|
+
</p>
|
|
206
|
+
<Button
|
|
207
|
+
variant="outline"
|
|
208
|
+
disabled={added}
|
|
209
|
+
onClick={() => {
|
|
210
|
+
append({ name: 'Angular', id: 'angular', disabled: false })
|
|
211
|
+
setAdded(true)
|
|
212
|
+
}}>
|
|
213
|
+
动态添加 Angular
|
|
214
|
+
</Button>
|
|
215
|
+
|
|
216
|
+
<Combobox.Root
|
|
217
|
+
collection={multipleCollection}
|
|
218
|
+
multiple
|
|
219
|
+
value={multipleValue}
|
|
220
|
+
onValueChange={(details) => setMultipleValue(details.value)}
|
|
221
|
+
size="lg"
|
|
222
|
+
variant="surface">
|
|
223
|
+
<Combobox.Label>受控多选</Combobox.Label>
|
|
224
|
+
<Combobox.Control>
|
|
225
|
+
<Combobox.Input placeholder="选择多个框架" />
|
|
226
|
+
<Combobox.IndicatorGroup>
|
|
227
|
+
<Combobox.ClearTrigger aria-label="清空多选" />
|
|
228
|
+
<Combobox.Trigger aria-label="展开多选列表" />
|
|
229
|
+
</Combobox.IndicatorGroup>
|
|
230
|
+
</Combobox.Control>
|
|
231
|
+
<Portal>
|
|
232
|
+
<Combobox.Positioner>
|
|
233
|
+
<Combobox.Content>
|
|
234
|
+
{multipleCollection.items.map((item) => (
|
|
235
|
+
<Combobox.Item key={item.id} item={item}>
|
|
236
|
+
<Combobox.ItemText>{item.name}</Combobox.ItemText>
|
|
237
|
+
<Combobox.ItemIndicator />
|
|
238
|
+
</Combobox.Item>
|
|
239
|
+
))}
|
|
240
|
+
</Combobox.Content>
|
|
241
|
+
</Combobox.Positioner>
|
|
242
|
+
</Portal>
|
|
243
|
+
</Combobox.Root>
|
|
244
|
+
<p role="status">多选:{multipleValue.join(', ') || '空'}</p>
|
|
245
|
+
<Button variant="outline" onClick={() => setMultipleValue(['vue', 'svelte'])}>
|
|
246
|
+
从外部设为 Vue + Svelte
|
|
247
|
+
</Button>
|
|
248
|
+
</div>
|
|
249
|
+
</div>
|
|
250
|
+
)
|
|
251
|
+
},
|
|
252
|
+
}
|
|
253
|
+
export const Customization: Story = {
|
|
254
|
+
render: function Customization() {
|
|
255
|
+
return (
|
|
256
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
|
|
257
|
+
<h3>分维度定制 · 紧凑尺寸</h3>
|
|
258
|
+
<Combobox.Root collection={multipleCollection} size="unstyled" maxWidth="md" gap="1.5">
|
|
259
|
+
<Combobox.Label textStyle="sm">自定尺寸,保留 outline 外观</Combobox.Label>
|
|
260
|
+
<Combobox.Control>
|
|
261
|
+
<Combobox.Input
|
|
262
|
+
height="36px"
|
|
263
|
+
px="3"
|
|
264
|
+
paddingInlineEnd="56px"
|
|
265
|
+
textStyle="sm"
|
|
266
|
+
placeholder="选择框架"
|
|
267
|
+
/>
|
|
268
|
+
<Combobox.IndicatorGroup px="2" gap="1" css={{ _icon: { boxSize: '4' } }}>
|
|
269
|
+
<Combobox.ClearTrigger aria-label="清空自定尺寸选择" />
|
|
270
|
+
<Combobox.Trigger aria-label="展开自定尺寸列表" />
|
|
271
|
+
</Combobox.IndicatorGroup>
|
|
272
|
+
</Combobox.Control>
|
|
273
|
+
<Portal>
|
|
274
|
+
<Combobox.Positioner>
|
|
275
|
+
<Combobox.Content
|
|
276
|
+
p="1"
|
|
277
|
+
gap="1"
|
|
278
|
+
minWidth="var(--reference-width)"
|
|
279
|
+
maxHeight="min(var(--available-height), 240px)"
|
|
280
|
+
textStyle="sm">
|
|
281
|
+
{items.map((item) => (
|
|
282
|
+
<Combobox.Item
|
|
283
|
+
key={item.id}
|
|
284
|
+
item={item}
|
|
285
|
+
minHeight="32px"
|
|
286
|
+
px="2"
|
|
287
|
+
gap="2"
|
|
288
|
+
css={{ _icon: { boxSize: '4' } }}>
|
|
289
|
+
<Combobox.ItemText>{item.name}</Combobox.ItemText>
|
|
290
|
+
<Combobox.ItemIndicator />
|
|
291
|
+
</Combobox.Item>
|
|
292
|
+
))}
|
|
293
|
+
</Combobox.Content>
|
|
294
|
+
</Combobox.Positioner>
|
|
295
|
+
</Portal>
|
|
296
|
+
</Combobox.Root>
|
|
297
|
+
<Combobox.Root
|
|
298
|
+
collection={multipleCollection}
|
|
299
|
+
variant="unstyled"
|
|
300
|
+
maxWidth="md"
|
|
301
|
+
defaultValue={['react']}>
|
|
302
|
+
<Combobox.Label>自定外观,保留 md 尺寸</Combobox.Label>
|
|
303
|
+
<Combobox.Control>
|
|
304
|
+
<Combobox.Input
|
|
305
|
+
bg="gray.3"
|
|
306
|
+
borderRadius="lg"
|
|
307
|
+
focusVisibleRing="inside"
|
|
308
|
+
aria-label="自定外观的框架"
|
|
309
|
+
/>
|
|
310
|
+
<Combobox.IndicatorGroup>
|
|
311
|
+
<Combobox.Trigger aria-label="展开自定外观列表" />
|
|
312
|
+
</Combobox.IndicatorGroup>
|
|
313
|
+
</Combobox.Control>
|
|
314
|
+
<Portal>
|
|
315
|
+
<Combobox.Positioner>
|
|
316
|
+
<Combobox.Content bg="gray.2" borderRadius="lg" boxShadow="md">
|
|
317
|
+
{items.map((item) => (
|
|
318
|
+
<Combobox.Item
|
|
319
|
+
key={item.id}
|
|
320
|
+
item={item}
|
|
321
|
+
borderRadius="md"
|
|
322
|
+
css={{ _highlighted: { bg: 'lime.3' }, _disabled: { opacity: 0.5 } }}>
|
|
323
|
+
<Combobox.ItemText>{item.name}</Combobox.ItemText>
|
|
324
|
+
<Combobox.ItemIndicator color="lime.11" />
|
|
325
|
+
</Combobox.Item>
|
|
326
|
+
))}
|
|
327
|
+
</Combobox.Content>
|
|
328
|
+
</Combobox.Positioner>
|
|
329
|
+
</Portal>
|
|
330
|
+
</Combobox.Root>
|
|
331
|
+
</div>
|
|
332
|
+
)
|
|
333
|
+
},
|
|
334
|
+
}
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { Button, Portal, Select, createListCollection, useSelect } from '@repo/ui'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
import { fn } from 'storybook/test'
|
|
5
|
+
import { css } from 'styled-system/css'
|
|
6
|
+
|
|
7
|
+
interface Framework {
|
|
8
|
+
label: string
|
|
9
|
+
value: string
|
|
10
|
+
category: string
|
|
11
|
+
disabled: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const collection = createListCollection<Framework>({
|
|
15
|
+
items: [
|
|
16
|
+
{ label: 'React', value: 'react', category: '组件库', disabled: false },
|
|
17
|
+
{ label: 'Vue', value: 'vue', category: '渐进式框架', disabled: false },
|
|
18
|
+
{ label: 'Solid(禁用)', value: 'solid', category: '细粒度响应式', disabled: true },
|
|
19
|
+
{ label: 'Svelte', value: 'svelte', category: '编译型框架', disabled: false },
|
|
20
|
+
],
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const meta = {
|
|
24
|
+
title: 'Collections/Select',
|
|
25
|
+
component: Select.Root<Framework>,
|
|
26
|
+
parameters: {
|
|
27
|
+
docs: {
|
|
28
|
+
description: {
|
|
29
|
+
component:
|
|
30
|
+
'支持单选、多选、禁用项、原生表单和外部 store 的选择器。方向键移动,输入英文首字母跳转,Escape 关闭。',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
controls: { include: ['size', 'variant', 'multiple', 'disabled', 'closeOnSelect'] },
|
|
34
|
+
},
|
|
35
|
+
argTypes: {
|
|
36
|
+
size: { control: 'select', options: ['xs', 'sm', 'md', 'lg', 'xl', 'unstyled'] },
|
|
37
|
+
variant: { control: 'inline-radio', options: ['outline', 'surface', 'unstyled'] },
|
|
38
|
+
multiple: { control: 'boolean' },
|
|
39
|
+
disabled: { control: 'boolean' },
|
|
40
|
+
closeOnSelect: { control: 'boolean' },
|
|
41
|
+
collection: { control: false, table: { disable: true } },
|
|
42
|
+
onValueChange: { control: false },
|
|
43
|
+
onOpenChange: { control: false },
|
|
44
|
+
},
|
|
45
|
+
args: {
|
|
46
|
+
collection,
|
|
47
|
+
size: 'md',
|
|
48
|
+
variant: 'outline',
|
|
49
|
+
multiple: false,
|
|
50
|
+
disabled: false,
|
|
51
|
+
onValueChange: fn<(details: Select.ValueChangeDetails<Framework>) => void>(),
|
|
52
|
+
onOpenChange: fn(),
|
|
53
|
+
},
|
|
54
|
+
} satisfies Meta<typeof Select.Root<Framework>>
|
|
55
|
+
|
|
56
|
+
export default meta
|
|
57
|
+
type Story = StoryObj<typeof meta>
|
|
58
|
+
|
|
59
|
+
export const Playground: Story = {
|
|
60
|
+
render: (args) => (
|
|
61
|
+
<div className={css({ maxWidth: 'md' })}>
|
|
62
|
+
<Select.Root {...args}>
|
|
63
|
+
<Select.Label>选择框架</Select.Label>
|
|
64
|
+
<Select.Control>
|
|
65
|
+
<Select.Trigger>
|
|
66
|
+
<Select.ValueText placeholder="选择框架" />
|
|
67
|
+
<Select.Indicator />
|
|
68
|
+
</Select.Trigger>
|
|
69
|
+
</Select.Control>
|
|
70
|
+
<Portal>
|
|
71
|
+
<Select.Positioner>
|
|
72
|
+
<Select.Content>
|
|
73
|
+
{args.collection.items.map((item) => (
|
|
74
|
+
<Select.Item key={item.value} item={item}>
|
|
75
|
+
<Select.ItemText>{item.label}</Select.ItemText>
|
|
76
|
+
<Select.ItemIndicator />
|
|
77
|
+
</Select.Item>
|
|
78
|
+
))}
|
|
79
|
+
</Select.Content>
|
|
80
|
+
</Select.Positioner>
|
|
81
|
+
</Portal>
|
|
82
|
+
<Select.HiddenSelect />
|
|
83
|
+
</Select.Root>
|
|
84
|
+
</div>
|
|
85
|
+
),
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const ControlledForm: Story = {
|
|
89
|
+
parameters: {
|
|
90
|
+
controls: { disable: true },
|
|
91
|
+
docs: {
|
|
92
|
+
source: { type: 'code' },
|
|
93
|
+
description: {
|
|
94
|
+
story: '受控单选与非受控多选通过 HiddenSelect 参与原生表单提交;禁用项无法选择。',
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
render: function ControlledForm(args) {
|
|
99
|
+
const [value, setValue] = useState<string[]>([])
|
|
100
|
+
const [selectedLabel, setSelectedLabel] = useState('尚未选择')
|
|
101
|
+
const [submitted, setSubmitted] = useState('尚未提交')
|
|
102
|
+
return (
|
|
103
|
+
<form
|
|
104
|
+
className={css({ display: 'grid', gap: '4', maxWidth: 'md' })}
|
|
105
|
+
onSubmit={(event) => {
|
|
106
|
+
event.preventDefault()
|
|
107
|
+
const data = new FormData(event.currentTarget)
|
|
108
|
+
setSubmitted(
|
|
109
|
+
JSON.stringify({ framework: data.get('framework'), tools: data.getAll('tools') }),
|
|
110
|
+
)
|
|
111
|
+
}}>
|
|
112
|
+
<Select.Root
|
|
113
|
+
collection={collection}
|
|
114
|
+
name="framework"
|
|
115
|
+
value={value}
|
|
116
|
+
onOpenChange={args.onOpenChange}
|
|
117
|
+
onValueChange={(details) => {
|
|
118
|
+
setValue(details.value)
|
|
119
|
+
args.onValueChange?.(details)
|
|
120
|
+
setSelectedLabel(details.items[0]?.label || '尚未选择')
|
|
121
|
+
}}
|
|
122
|
+
size="md"
|
|
123
|
+
variant="outline">
|
|
124
|
+
<Select.Label>受控单选</Select.Label>
|
|
125
|
+
<Select.Control>
|
|
126
|
+
<Select.Trigger>
|
|
127
|
+
<Select.ValueText placeholder="选择框架" />
|
|
128
|
+
<Select.Indicator />
|
|
129
|
+
</Select.Trigger>
|
|
130
|
+
</Select.Control>
|
|
131
|
+
<Portal>
|
|
132
|
+
<Select.Positioner>
|
|
133
|
+
<Select.Content>
|
|
134
|
+
{collection.items.map((item) => (
|
|
135
|
+
<Select.Item key={item.value} item={item}>
|
|
136
|
+
<Select.ItemText>{item.label}</Select.ItemText>
|
|
137
|
+
<Select.ItemIndicator />
|
|
138
|
+
</Select.Item>
|
|
139
|
+
))}
|
|
140
|
+
</Select.Content>
|
|
141
|
+
</Select.Positioner>
|
|
142
|
+
</Portal>
|
|
143
|
+
<Select.HiddenSelect />
|
|
144
|
+
</Select.Root>
|
|
145
|
+
<p role="status">
|
|
146
|
+
当前单选:{selectedLabel}({value.join(', ') || '空'})
|
|
147
|
+
</p>
|
|
148
|
+
<Button
|
|
149
|
+
type="button"
|
|
150
|
+
variant="outline"
|
|
151
|
+
onClick={() => {
|
|
152
|
+
setValue(['vue'])
|
|
153
|
+
setSelectedLabel('Vue')
|
|
154
|
+
}}>
|
|
155
|
+
从外部设为 Vue
|
|
156
|
+
</Button>
|
|
157
|
+
<Select.Root
|
|
158
|
+
collection={collection}
|
|
159
|
+
name="tools"
|
|
160
|
+
multiple
|
|
161
|
+
defaultValue={['react']}
|
|
162
|
+
onValueChange={args.onValueChange}
|
|
163
|
+
onOpenChange={args.onOpenChange}
|
|
164
|
+
size="lg"
|
|
165
|
+
variant="surface">
|
|
166
|
+
<Select.Label>非受控多选</Select.Label>
|
|
167
|
+
<Select.Control>
|
|
168
|
+
<Select.Trigger>
|
|
169
|
+
<Select.ValueText placeholder="选择多个框架" />
|
|
170
|
+
<Select.Indicator />
|
|
171
|
+
</Select.Trigger>
|
|
172
|
+
</Select.Control>
|
|
173
|
+
<Portal>
|
|
174
|
+
<Select.Positioner>
|
|
175
|
+
<Select.Content>
|
|
176
|
+
{collection.items.map((item) => (
|
|
177
|
+
<Select.Item key={item.value} item={item}>
|
|
178
|
+
<Select.ItemText>{item.label}</Select.ItemText>
|
|
179
|
+
<Select.ItemIndicator />
|
|
180
|
+
</Select.Item>
|
|
181
|
+
))}
|
|
182
|
+
</Select.Content>
|
|
183
|
+
</Select.Positioner>
|
|
184
|
+
</Portal>
|
|
185
|
+
<Select.HiddenSelect />
|
|
186
|
+
</Select.Root>
|
|
187
|
+
<Select.Root collection={collection} disabled size="sm">
|
|
188
|
+
<Select.Label>整体禁用</Select.Label>
|
|
189
|
+
<Select.Control>
|
|
190
|
+
<Select.Trigger>
|
|
191
|
+
<Select.ValueText placeholder="不可操作" />
|
|
192
|
+
<Select.Indicator />
|
|
193
|
+
</Select.Trigger>
|
|
194
|
+
</Select.Control>
|
|
195
|
+
<Select.HiddenSelect />
|
|
196
|
+
</Select.Root>
|
|
197
|
+
<Button type="submit" colorPalette="lime">
|
|
198
|
+
读取原生表单数据
|
|
199
|
+
</Button>
|
|
200
|
+
<p role="status">提交结果:{submitted}</p>
|
|
201
|
+
</form>
|
|
202
|
+
)
|
|
203
|
+
},
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export const Customization: Story = {
|
|
207
|
+
parameters: { controls: { disable: true } },
|
|
208
|
+
render: () => (
|
|
209
|
+
<div className={css({ display: 'grid', gap: '4', maxWidth: 'md' })}>
|
|
210
|
+
<h3>分维度定制 · 紧凑尺寸</h3>
|
|
211
|
+
<Select.Root collection={collection} size="unstyled" name="compact-framework" gap="1.5">
|
|
212
|
+
<Select.Label textStyle="sm">自定尺寸,保留 outline 外观</Select.Label>
|
|
213
|
+
<Select.Control>
|
|
214
|
+
<Select.Trigger
|
|
215
|
+
height="36px"
|
|
216
|
+
px="3"
|
|
217
|
+
gap="2"
|
|
218
|
+
textStyle="sm"
|
|
219
|
+
css={{ _icon: { boxSize: '4' } }}>
|
|
220
|
+
<Select.ValueText placeholder="选择框架" />
|
|
221
|
+
<Select.Indicator />
|
|
222
|
+
</Select.Trigger>
|
|
223
|
+
</Select.Control>
|
|
224
|
+
<Portal>
|
|
225
|
+
<Select.Positioner>
|
|
226
|
+
<Select.Content
|
|
227
|
+
p="1"
|
|
228
|
+
gap="1"
|
|
229
|
+
minWidth="var(--reference-width)"
|
|
230
|
+
maxHeight="min(var(--available-height), 240px)"
|
|
231
|
+
textStyle="sm">
|
|
232
|
+
{collection.items.map((item) => (
|
|
233
|
+
<Select.Item
|
|
234
|
+
key={item.value}
|
|
235
|
+
item={item}
|
|
236
|
+
minHeight="32px"
|
|
237
|
+
px="2"
|
|
238
|
+
gap="2"
|
|
239
|
+
css={{ _icon: { boxSize: '4' } }}>
|
|
240
|
+
<Select.ItemText>{item.label}</Select.ItemText>
|
|
241
|
+
<Select.ItemIndicator />
|
|
242
|
+
</Select.Item>
|
|
243
|
+
))}
|
|
244
|
+
</Select.Content>
|
|
245
|
+
</Select.Positioner>
|
|
246
|
+
</Portal>
|
|
247
|
+
<Select.HiddenSelect />
|
|
248
|
+
</Select.Root>
|
|
249
|
+
<Select.Root collection={collection} variant="unstyled" defaultValue={['vue']}>
|
|
250
|
+
<Select.Label>自定外观,保留 md 尺寸</Select.Label>
|
|
251
|
+
<Select.Control>
|
|
252
|
+
<Select.Trigger bg="gray.3" borderRadius="lg" focusVisibleRing="inside">
|
|
253
|
+
<Select.ValueText />
|
|
254
|
+
<Select.Indicator />
|
|
255
|
+
</Select.Trigger>
|
|
256
|
+
</Select.Control>
|
|
257
|
+
<Portal>
|
|
258
|
+
<Select.Positioner>
|
|
259
|
+
<Select.Content bg="gray.2" borderRadius="lg" boxShadow="md">
|
|
260
|
+
{collection.items.map((item) => (
|
|
261
|
+
<Select.Item
|
|
262
|
+
key={item.value}
|
|
263
|
+
item={item}
|
|
264
|
+
borderRadius="md"
|
|
265
|
+
css={{ _highlighted: { bg: 'lime.3' }, _disabled: { opacity: 0.5 } }}>
|
|
266
|
+
<Select.ItemText>{item.label}</Select.ItemText>
|
|
267
|
+
<Select.ItemIndicator color="lime.11" />
|
|
268
|
+
</Select.Item>
|
|
269
|
+
))}
|
|
270
|
+
</Select.Content>
|
|
271
|
+
</Select.Positioner>
|
|
272
|
+
</Portal>
|
|
273
|
+
<Select.HiddenSelect />
|
|
274
|
+
</Select.Root>
|
|
275
|
+
</div>
|
|
276
|
+
),
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export const Store: Story = {
|
|
280
|
+
parameters: {
|
|
281
|
+
controls: { disable: true },
|
|
282
|
+
docs: {
|
|
283
|
+
source: { type: 'code' },
|
|
284
|
+
description: {
|
|
285
|
+
story:
|
|
286
|
+
'`useSelect<Framework>` 保留泛型事件中的自定义字段,外部按钮通过 store 选择、打开和清空。',
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
render: function Store(args) {
|
|
291
|
+
const [selected, setSelected] = useState('React · 组件库')
|
|
292
|
+
const select = useSelect<Framework>({
|
|
293
|
+
collection,
|
|
294
|
+
defaultValue: ['react'],
|
|
295
|
+
onOpenChange: args.onOpenChange,
|
|
296
|
+
onValueChange: (details: Select.ValueChangeDetails<Framework>) => {
|
|
297
|
+
args.onValueChange?.(details)
|
|
298
|
+
const item = details.items[0]
|
|
299
|
+
setSelected(item ? `${item.label} · ${item.category}` : '尚未选择')
|
|
300
|
+
},
|
|
301
|
+
})
|
|
302
|
+
const triggerProps = { 'aria-label': '选择框架' } satisfies Select.TriggerProps
|
|
303
|
+
return (
|
|
304
|
+
<div className={css({ display: 'grid', gap: '3', maxWidth: 'md' })}>
|
|
305
|
+
<Select.RootProvider value={select} size="md" variant="outline">
|
|
306
|
+
<Select.Label>Select.RootProvider</Select.Label>
|
|
307
|
+
<Select.Control>
|
|
308
|
+
<Select.Trigger {...triggerProps}>
|
|
309
|
+
<Select.ValueText placeholder="选择框架" />
|
|
310
|
+
<Select.Indicator />
|
|
311
|
+
</Select.Trigger>
|
|
312
|
+
</Select.Control>
|
|
313
|
+
<Portal>
|
|
314
|
+
<Select.Positioner>
|
|
315
|
+
<Select.Content>
|
|
316
|
+
{collection.items.map((item) => (
|
|
317
|
+
<Select.Item key={item.value} item={item}>
|
|
318
|
+
<Select.ItemText>{item.label}</Select.ItemText>
|
|
319
|
+
<Select.ItemIndicator />
|
|
320
|
+
</Select.Item>
|
|
321
|
+
))}
|
|
322
|
+
</Select.Content>
|
|
323
|
+
</Select.Positioner>
|
|
324
|
+
</Portal>
|
|
325
|
+
<Select.HiddenSelect />
|
|
326
|
+
</Select.RootProvider>
|
|
327
|
+
<div className={css({ display: 'flex', gap: '2', flexWrap: 'wrap' })}>
|
|
328
|
+
<Button variant="outline" onClick={() => select.setValue(['vue'])}>
|
|
329
|
+
外部设为 Vue
|
|
330
|
+
</Button>
|
|
331
|
+
<Button variant="outline" onClick={() => select.setOpen(true)}>
|
|
332
|
+
外部打开
|
|
333
|
+
</Button>
|
|
334
|
+
<Button variant="outline" onClick={() => select.clearValue()}>
|
|
335
|
+
清空
|
|
336
|
+
</Button>
|
|
337
|
+
</div>
|
|
338
|
+
<p role="status">泛型事件中的自定义字段:{selected}</p>
|
|
339
|
+
</div>
|
|
340
|
+
)
|
|
341
|
+
},
|
|
342
|
+
}
|