create-nexst-monorepo 0.1.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/dist/index.js +1727 -0
- package/package.json +37 -0
- package/template/.agents/plugins/marketplace.json +21 -0
- package/template/.claude/settings.json +6 -0
- package/template/.claude/skills/frontend-design/LICENSE.txt +177 -0
- package/template/.claude/skills/frontend-design/SKILL.md +154 -0
- package/template/.claude/skills/theme-factory/SKILL.md +95 -0
- package/template/.claude/skills/theme-factory/references/schema.md +104 -0
- package/template/.claude/skills/theme-factory/scripts/theme.mjs +261 -0
- package/template/.dockerignore +43 -0
- package/template/.editorconfig +10 -0
- package/template/.github/workflows/ci.yaml +289 -0
- package/template/.github/workflows/publish-app.yaml +66 -0
- package/template/.github/workflows/publish.yaml +148 -0
- package/template/.github/workflows/snyk.yaml +34 -0
- package/template/.vscode/settings.json +8 -0
- package/template/AGENTS.md +42 -0
- package/template/Dockerfile.base +9 -0
- package/template/README.md +54 -0
- package/template/_gitignore +10 -0
- package/template/apps/api/.env.example +32 -0
- package/template/apps/api/AGENTS.md +44 -0
- package/template/apps/api/Dockerfile +69 -0
- package/template/apps/api/_gitignore +8 -0
- package/template/apps/api/knip.config.ts +22 -0
- package/template/apps/api/kustomize/base/application.properties +16 -0
- package/template/apps/api/kustomize/base/deployment.yaml +94 -0
- package/template/apps/api/kustomize/base/kustomization.yaml +17 -0
- package/template/apps/api/kustomize/base/service.yaml +10 -0
- package/template/apps/api/kustomize/overlays/prod/kustomization.yaml +17 -0
- package/template/apps/api/kustomize/overlays/staging/application.properties +1 -0
- package/template/apps/api/kustomize/overlays/staging/kustomization.yaml +21 -0
- package/template/apps/api/kustomize/secret.keys +14 -0
- package/template/apps/api/oxfmt.config.ts +8 -0
- package/template/apps/api/oxlint.config.ts +107 -0
- package/template/apps/api/package.json +79 -0
- package/template/apps/api/prisma/migrations/20260927000000_init/migration.sql +113 -0
- package/template/apps/api/prisma/migrations/migration_lock.toml +3 -0
- package/template/apps/api/prisma/schema.prisma +113 -0
- package/template/apps/api/prisma.config.ts +7 -0
- package/template/apps/api/scripts/auth.cli.ts +19 -0
- package/template/apps/api/scripts/seal-secret.sh +171 -0
- package/template/apps/api/sonar-project.properties +9 -0
- package/template/apps/api/src/app-info/app-info.dto.ts +10 -0
- package/template/apps/api/src/app-info/app-info.module.ts +7 -0
- package/template/apps/api/src/app-info/app-info.resolver.spec.ts +14 -0
- package/template/apps/api/src/app-info/app-info.resolver.ts +21 -0
- package/template/apps/api/src/app.module.spec.ts +93 -0
- package/template/apps/api/src/app.module.ts +77 -0
- package/template/apps/api/src/auth/auth.guard.spec.ts +90 -0
- package/template/apps/api/src/auth/auth.guard.ts +97 -0
- package/template/apps/api/src/auth/auth.ts +129 -0
- package/template/apps/api/src/auth/decorator/allow-anonymous.decorator.ts +17 -0
- package/template/apps/api/src/auth/decorator/is-email-verified.decorator.spec.ts +41 -0
- package/template/apps/api/src/auth/decorator/is-email-verified.decorator.ts +20 -0
- package/template/apps/api/src/auth/decorator/roles.decorator.ts +27 -0
- package/template/apps/api/src/auth/testing/make-session.ts +31 -0
- package/template/apps/api/src/auth/types/auth.types.ts +27 -0
- package/template/apps/api/src/bootstrap/register-graphql-enums.ts +12 -0
- package/template/apps/api/src/bootstrap/security.ts +24 -0
- package/template/apps/api/src/bootstrap/swagger.ts +28 -0
- package/template/apps/api/src/config/app.config.spec.ts +22 -0
- package/template/apps/api/src/config/app.config.ts +122 -0
- package/template/apps/api/src/config/graphql-depth-limit.ts +103 -0
- package/template/apps/api/src/config/graphql.config.ts +77 -0
- package/template/apps/api/src/config/resources/app.yaml +29 -0
- package/template/apps/api/src/errors/app-parse-uuid.pipe.ts +27 -0
- package/template/apps/api/src/errors/app.exception.ts +47 -0
- package/template/apps/api/src/errors/error-code.enum.ts +54 -0
- package/template/apps/api/src/errors/http-status-fallback-code.util.ts +27 -0
- package/template/apps/api/src/errors/validation-exception.factory.ts +43 -0
- package/template/apps/api/src/health/health.controller.spec.ts +82 -0
- package/template/apps/api/src/health/health.controller.ts +57 -0
- package/template/apps/api/src/health/health.module.ts +12 -0
- package/template/apps/api/src/logging/context-logger.ts +18 -0
- package/template/apps/api/src/logging/logger.config.ts +23 -0
- package/template/apps/api/src/logging/logging.module.ts +22 -0
- package/template/apps/api/src/mail/mail.module.ts +12 -0
- package/template/apps/api/src/mail/mail.service.spec.ts +47 -0
- package/template/apps/api/src/mail/mail.service.ts +123 -0
- package/template/apps/api/src/main.ts +41 -0
- package/template/apps/api/src/prisma/prisma.module.ts +12 -0
- package/template/apps/api/src/prisma/prisma.service.spec.ts +136 -0
- package/template/apps/api/src/prisma/prisma.service.ts +138 -0
- package/template/apps/api/src/queue/dto/enqueue-example.input.ts +11 -0
- package/template/apps/api/src/queue/example-queue.resolver.ts +14 -0
- package/template/apps/api/src/queue/example-queue.service.spec.ts +21 -0
- package/template/apps/api/src/queue/example-queue.service.ts +32 -0
- package/template/apps/api/src/queue/queue.module.ts +27 -0
- package/template/apps/api/src/r2/r2.module.ts +12 -0
- package/template/apps/api/src/r2/r2.service.spec.ts +117 -0
- package/template/apps/api/src/r2/r2.service.ts +131 -0
- package/template/apps/api/src/user/dto/user.dto.ts +26 -0
- package/template/apps/api/src/user/user.module.ts +10 -0
- package/template/apps/api/src/user/user.resolver.spec.ts +18 -0
- package/template/apps/api/src/user/user.resolver.ts +24 -0
- package/template/apps/api/src/utils/catch-everything-exception.filter.spec.ts +292 -0
- package/template/apps/api/src/utils/catch-everything-exception.filter.ts +70 -0
- package/template/apps/api/src/utils/error-handler.util.spec.ts +20 -0
- package/template/apps/api/src/utils/error-handler.util.ts +12 -0
- package/template/apps/api/src/utils/escape-like-pattern.util.spec.ts +29 -0
- package/template/apps/api/src/utils/escape-like-pattern.util.ts +11 -0
- package/template/apps/api/src/utils/pagination.input.ts +20 -0
- package/template/apps/api/src/utils/prisma-exception.filter.spec.ts +186 -0
- package/template/apps/api/src/utils/prisma-exception.filter.ts +45 -0
- package/template/apps/api/src/utils/prisma-graphql-exception.filter.spec.ts +216 -0
- package/template/apps/api/src/utils/prisma-graphql-exception.filter.ts +43 -0
- package/template/apps/api/tests/app.e2e-spec.ts +35 -0
- package/template/apps/api/tests/auth.e2e-spec.ts +38 -0
- package/template/apps/api/tests/helpers/api.ts +27 -0
- package/template/apps/api/tsconfig.json +11 -0
- package/template/apps/api/vitest.config.e2e.ts +16 -0
- package/template/apps/api/vitest.config.ts +40 -0
- package/template/apps/web/.env.example +7 -0
- package/template/apps/web/.storybook/decorators.tsx +38 -0
- package/template/apps/web/.storybook/main.ts +17 -0
- package/template/apps/web/.storybook/preview.ts +38 -0
- package/template/apps/web/.storybook/vitest.setup.ts +5 -0
- package/template/apps/web/AGENTS.md +29 -0
- package/template/apps/web/Dockerfile +49 -0
- package/template/apps/web/_gitignore +16 -0
- package/template/apps/web/knip.config.ts +15 -0
- package/template/apps/web/kustomize/base/application.properties +5 -0
- package/template/apps/web/kustomize/base/deployment.yaml +60 -0
- package/template/apps/web/kustomize/base/kustomization.yaml +17 -0
- package/template/apps/web/kustomize/base/service.yaml +10 -0
- package/template/apps/web/kustomize/overlays/prod/kustomization.yaml +12 -0
- package/template/apps/web/kustomize/overlays/staging/application.properties +2 -0
- package/template/apps/web/kustomize/overlays/staging/kustomization.yaml +18 -0
- package/template/apps/web/messages/de.json +124 -0
- package/template/apps/web/messages/en.json +124 -0
- package/template/apps/web/next-env.d.ts +7 -0
- package/template/apps/web/next.config.ts +39 -0
- package/template/apps/web/oxfmt.config.ts +9 -0
- package/template/apps/web/oxlint.config.ts +36 -0
- package/template/apps/web/package.json +80 -0
- package/template/apps/web/playwright.config.ts +34 -0
- package/template/apps/web/postcss.config.mjs +7 -0
- package/template/apps/web/sonar-project.properties +9 -0
- package/template/apps/web/src/app/[locale]/(auth)/recovery/page.tsx +22 -0
- package/template/apps/web/src/app/[locale]/(auth)/reset-password/page.tsx +29 -0
- package/template/apps/web/src/app/[locale]/(auth)/sign-in/page.tsx +24 -0
- package/template/apps/web/src/app/[locale]/(auth)/sign-up/page.tsx +24 -0
- package/template/apps/web/src/app/[locale]/(auth)/verify/page.tsx +24 -0
- package/template/apps/web/src/app/[locale]/dashboard/page.tsx +34 -0
- package/template/apps/web/src/app/[locale]/layout.tsx +60 -0
- package/template/apps/web/src/app/[locale]/page.tsx +23 -0
- package/template/apps/web/src/app/api/health/route.ts +3 -0
- package/template/apps/web/src/app/global-error.tsx +19 -0
- package/template/apps/web/src/app/globals.css +98 -0
- package/template/apps/web/src/app/icon.svg +1 -0
- package/template/apps/web/src/app/robots.ts +15 -0
- package/template/apps/web/src/app/sitemap.ts +24 -0
- package/template/apps/web/src/components/alert/alert.stories.tsx +25 -0
- package/template/apps/web/src/components/alert/alert.tsx +50 -0
- package/template/apps/web/src/components/avatar/avatar.stories.tsx +116 -0
- package/template/apps/web/src/components/avatar/avatar.tsx +88 -0
- package/template/apps/web/src/components/button/button-variants.ts +28 -0
- package/template/apps/web/src/components/button/button.stories.tsx +33 -0
- package/template/apps/web/src/components/button/button.tsx +32 -0
- package/template/apps/web/src/components/checkbox/checkbox.stories.tsx +312 -0
- package/template/apps/web/src/components/checkbox/checkbox.tsx +38 -0
- package/template/apps/web/src/components/dialog/danger-panel.stories.tsx +41 -0
- package/template/apps/web/src/components/dialog/danger-panel.tsx +32 -0
- package/template/apps/web/src/components/dialog/dialog.stories.tsx +239 -0
- package/template/apps/web/src/components/dialog/dialog.tsx +136 -0
- package/template/apps/web/src/components/dialog-buttons.stories.tsx +55 -0
- package/template/apps/web/src/components/dialog-buttons.tsx +48 -0
- package/template/apps/web/src/components/drawer/drawer.stories.tsx +251 -0
- package/template/apps/web/src/components/drawer/drawer.tsx +120 -0
- package/template/apps/web/src/components/dropdown-menu/dropdown-menu.stories.tsx +329 -0
- package/template/apps/web/src/components/dropdown-menu/dropdown-menu.tsx +263 -0
- package/template/apps/web/src/components/empty-state.stories.tsx +49 -0
- package/template/apps/web/src/components/empty-state.tsx +33 -0
- package/template/apps/web/src/components/field-group.stories.tsx +47 -0
- package/template/apps/web/src/components/field-group.tsx +20 -0
- package/template/apps/web/src/components/field-label.stories.tsx +34 -0
- package/template/apps/web/src/components/field-label.tsx +28 -0
- package/template/apps/web/src/components/icons.tsx +25 -0
- package/template/apps/web/src/components/input/input-otp.stories.tsx +86 -0
- package/template/apps/web/src/components/input/input-otp.tsx +184 -0
- package/template/apps/web/src/components/input/input.stories.tsx +35 -0
- package/template/apps/web/src/components/input/input.tsx +180 -0
- package/template/apps/web/src/components/popover/popover.stories.tsx +479 -0
- package/template/apps/web/src/components/popover/popover.tsx +45 -0
- package/template/apps/web/src/components/responsive-dialog/responsive-dialog.stories.tsx +307 -0
- package/template/apps/web/src/components/responsive-dialog/responsive-dialog.tsx +96 -0
- package/template/apps/web/src/components/searchbar/searchbar.stories.tsx +59 -0
- package/template/apps/web/src/components/searchbar/searchbar.tsx +64 -0
- package/template/apps/web/src/components/select/select.stories.tsx +293 -0
- package/template/apps/web/src/components/select/select.tsx +445 -0
- package/template/apps/web/src/components/skeleton/skeleton.stories.tsx +76 -0
- package/template/apps/web/src/components/skeleton/skeleton.tsx +13 -0
- package/template/apps/web/src/components/spinner/spinner.tsx +18 -0
- package/template/apps/web/src/components/switch/switch.stories.tsx +71 -0
- package/template/apps/web/src/components/switch/switch.tsx +35 -0
- package/template/apps/web/src/components/tabs/tabs.stories.tsx +209 -0
- package/template/apps/web/src/components/tabs/tabs.tsx +69 -0
- package/template/apps/web/src/components/tabs/url-tabs.stories.tsx +68 -0
- package/template/apps/web/src/components/tabs/url-tabs.tsx +42 -0
- package/template/apps/web/src/components/textarea/textarea.stories.tsx +144 -0
- package/template/apps/web/src/components/textarea/textarea.tsx +115 -0
- package/template/apps/web/src/components/toast/toaster.tsx +38 -0
- package/template/apps/web/src/components/tooltip/tooltip.stories.tsx +237 -0
- package/template/apps/web/src/components/tooltip/tooltip.tsx +49 -0
- package/template/apps/web/src/config/csp.ts +59 -0
- package/template/apps/web/src/config/routes.ts +14 -0
- package/template/apps/web/src/config/site.ts +5 -0
- package/template/apps/web/src/env.ts +15 -0
- package/template/apps/web/src/features/auth/auth-card.tsx +20 -0
- package/template/apps/web/src/features/auth/auth-divider.tsx +14 -0
- package/template/apps/web/src/features/auth/google-auth-button.tsx +49 -0
- package/template/apps/web/src/features/auth/google-one-tap.tsx +23 -0
- package/template/apps/web/src/features/auth/lib/auth-error.test.ts +22 -0
- package/template/apps/web/src/features/auth/lib/auth-error.ts +16 -0
- package/template/apps/web/src/features/auth/lib/return-to.test.ts +41 -0
- package/template/apps/web/src/features/auth/lib/return-to.ts +19 -0
- package/template/apps/web/src/features/auth/lib/validator.test.ts +45 -0
- package/template/apps/web/src/features/auth/lib/validator.ts +49 -0
- package/template/apps/web/src/features/auth/passkey-settings.tsx +106 -0
- package/template/apps/web/src/features/auth/recovery-form.tsx +61 -0
- package/template/apps/web/src/features/auth/resend-verification-button.tsx +36 -0
- package/template/apps/web/src/features/auth/reset-password-form.tsx +62 -0
- package/template/apps/web/src/features/auth/sign-in-form.stories.tsx +22 -0
- package/template/apps/web/src/features/auth/sign-in-form.tsx +116 -0
- package/template/apps/web/src/features/auth/sign-out-button.tsx +26 -0
- package/template/apps/web/src/features/auth/sign-up-form.tsx +107 -0
- package/template/apps/web/src/features/shared/provider.tsx +16 -0
- package/template/apps/web/src/features/shared/site-header.tsx +48 -0
- package/template/apps/web/src/features/shared/theme-toggle.tsx +24 -0
- package/template/apps/web/src/i18n/navigation.ts +5 -0
- package/template/apps/web/src/i18n/request.ts +21 -0
- package/template/apps/web/src/i18n/routing.ts +6 -0
- package/template/apps/web/src/lib/auth-client.ts +19 -0
- package/template/apps/web/src/lib/auth-server.ts +46 -0
- package/template/apps/web/src/lib/auth.ts +8 -0
- package/template/apps/web/src/lib/codegen.ts +30 -0
- package/template/apps/web/src/lib/graphql-client.ts +29 -0
- package/template/apps/web/src/lib/graphql-server.ts +28 -0
- package/template/apps/web/src/lib/graphql-utils.test.ts +32 -0
- package/template/apps/web/src/lib/graphql-utils.ts +76 -0
- package/template/apps/web/src/lib/hooks/use-media-query.ts +21 -0
- package/template/apps/web/src/lib/metadata.ts +17 -0
- package/template/apps/web/src/lib/network-error.test.ts +30 -0
- package/template/apps/web/src/lib/network-error.ts +17 -0
- package/template/apps/web/src/lib/proxy-utils.ts +42 -0
- package/template/apps/web/src/lib/query-client.ts +29 -0
- package/template/apps/web/src/lib/utils.ts +5 -0
- package/template/apps/web/src/proxy.ts +57 -0
- package/template/apps/web/test-results/.last-run.json +4 -0
- package/template/apps/web/tests/auth.spec.ts +17 -0
- package/template/apps/web/tests/csp-theme-script.spec.ts +37 -0
- package/template/apps/web/tests/home.spec.ts +25 -0
- package/template/apps/web/tsconfig.build.json +4 -0
- package/template/apps/web/tsconfig.json +28 -0
- package/template/apps/web/vitest.config.ts +40 -0
- package/template/apps/web/vitest.shims.d.ts +1 -0
- package/template/apps/worker/.env.example +4 -0
- package/template/apps/worker/AGENTS.md +11 -0
- package/template/apps/worker/Dockerfile +35 -0
- package/template/apps/worker/knip.config.ts +3 -0
- package/template/apps/worker/kustomize/base/application.properties +4 -0
- package/template/apps/worker/kustomize/base/deployment.yaml +62 -0
- package/template/apps/worker/kustomize/base/kustomization.yaml +16 -0
- package/template/apps/worker/kustomize/overlays/prod/kustomization.yaml +12 -0
- package/template/apps/worker/kustomize/overlays/staging/application.properties +1 -0
- package/template/apps/worker/kustomize/overlays/staging/kustomization.yaml +18 -0
- package/template/apps/worker/oxfmt.config.ts +8 -0
- package/template/apps/worker/oxlint.config.ts +15 -0
- package/template/apps/worker/package.json +33 -0
- package/template/apps/worker/sonar-project.properties +8 -0
- package/template/apps/worker/src/env.ts +13 -0
- package/template/apps/worker/src/lib/graceful-shutdown.ts +27 -0
- package/template/apps/worker/src/lib/logger.ts +20 -0
- package/template/apps/worker/src/main.ts +17 -0
- package/template/apps/worker/src/processors/example-processor.ts +15 -0
- package/template/apps/worker/src/worker/redis.ts +19 -0
- package/template/apps/worker/src/worker/worker.ts +37 -0
- package/template/apps/worker/tests/example-processor.test.ts +13 -0
- package/template/apps/worker/tests/graceful-shutdown.test.ts +34 -0
- package/template/apps/worker/tsconfig.json +4 -0
- package/template/apps/worker/vitest.config.ts +13 -0
- package/template/bun.lock +3053 -0
- package/template/bunfig.toml +2 -0
- package/template/compose.yaml +53 -0
- package/template/docker-bake.hcl +86 -0
- package/template/package.json +47 -0
- package/template/packages/lint/knip.ts +40 -0
- package/template/packages/lint/oxfmt.ts +8 -0
- package/template/packages/lint/oxlint.ts +136 -0
- package/template/packages/lint/package.json +13 -0
- package/template/packages/queues/oxfmt.config.ts +8 -0
- package/template/packages/queues/oxlint.config.ts +7 -0
- package/template/packages/queues/package.json +15 -0
- package/template/packages/queues/src/example-job.ts +11 -0
- package/template/packages/queues/src/index.ts +3 -0
- package/template/packages/queues/src/queue-names.ts +2 -0
- package/template/packages/queues/src/redis-connection.ts +27 -0
- package/template/packages/queues/tsconfig.json +4 -0
- package/template/packages/tsconfig/base.json +23 -0
- package/template/packages/tsconfig/node.json +11 -0
- package/template/packages/tsconfig/package.json +4 -0
- package/template/turbo.json +50 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/nextjs-vite";
|
|
2
|
+
import { Flag } from "lucide-react";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { expect, userEvent, waitFor, within } from "storybook/test";
|
|
5
|
+
import {
|
|
6
|
+
Select,
|
|
7
|
+
SelectContent,
|
|
8
|
+
SelectGroup,
|
|
9
|
+
SelectItem,
|
|
10
|
+
SelectLabel,
|
|
11
|
+
SelectSeparator,
|
|
12
|
+
SelectTrigger,
|
|
13
|
+
SelectValue,
|
|
14
|
+
SelectWithSearch,
|
|
15
|
+
} from "./select";
|
|
16
|
+
|
|
17
|
+
const meta: Meta<typeof Select> = {
|
|
18
|
+
component: Select,
|
|
19
|
+
parameters: {
|
|
20
|
+
// SelectWithSearch renders its search field inside Radix Select's listbox: axe flags
|
|
21
|
+
// `aria-required-children` and the viewport as a non-focusable scroll region.
|
|
22
|
+
a11y: {
|
|
23
|
+
config: {
|
|
24
|
+
rules: [
|
|
25
|
+
{ enabled: false, id: "aria-required-children" },
|
|
26
|
+
// Radix hides the rest of the page (aria-hidden) while the listbox is open.
|
|
27
|
+
{ enabled: false, id: "aria-hidden-focus" },
|
|
28
|
+
{ enabled: false, id: "scrollable-region-focusable" },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
layout: "centered",
|
|
33
|
+
},
|
|
34
|
+
tags: ["autodocs"],
|
|
35
|
+
} satisfies Meta<typeof Select>;
|
|
36
|
+
|
|
37
|
+
export default meta;
|
|
38
|
+
type Story = StoryObj<typeof meta>;
|
|
39
|
+
|
|
40
|
+
export const Default: Story = {
|
|
41
|
+
render: () => (
|
|
42
|
+
<Select>
|
|
43
|
+
<SelectTrigger aria-label="Select a fruit" className="w-70">
|
|
44
|
+
<SelectValue placeholder="Select a fruit" />
|
|
45
|
+
</SelectTrigger>
|
|
46
|
+
<SelectContent>
|
|
47
|
+
<SelectItem value="apple">Apple</SelectItem>
|
|
48
|
+
<SelectItem value="banana">Banana</SelectItem>
|
|
49
|
+
<SelectItem value="blueberry">Blueberry</SelectItem>
|
|
50
|
+
<SelectItem value="grapes">Grapes</SelectItem>
|
|
51
|
+
<SelectItem value="pineapple">Pineapple</SelectItem>
|
|
52
|
+
</SelectContent>
|
|
53
|
+
</Select>
|
|
54
|
+
),
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const WithGroups: Story = {
|
|
58
|
+
render: () => (
|
|
59
|
+
<Select>
|
|
60
|
+
<SelectTrigger aria-label="Select a timezone" className="w-70">
|
|
61
|
+
<SelectValue placeholder="Select a timezone" />
|
|
62
|
+
</SelectTrigger>
|
|
63
|
+
<SelectContent>
|
|
64
|
+
<SelectGroup>
|
|
65
|
+
<SelectLabel>North America</SelectLabel>
|
|
66
|
+
<SelectItem value="est">Eastern Standard Time (EST)</SelectItem>
|
|
67
|
+
<SelectItem value="cst">Central Standard Time (CST)</SelectItem>
|
|
68
|
+
<SelectItem value="mst">Mountain Standard Time (MST)</SelectItem>
|
|
69
|
+
<SelectItem value="pst">Pacific Standard Time (PST)</SelectItem>
|
|
70
|
+
</SelectGroup>
|
|
71
|
+
<SelectSeparator />
|
|
72
|
+
<SelectGroup>
|
|
73
|
+
<SelectLabel>Europe</SelectLabel>
|
|
74
|
+
<SelectItem value="gmt">Greenwich Mean Time (GMT)</SelectItem>
|
|
75
|
+
<SelectItem value="cet">Central European Time (CET)</SelectItem>
|
|
76
|
+
<SelectItem value="eet">Eastern European Time (EET)</SelectItem>
|
|
77
|
+
</SelectGroup>
|
|
78
|
+
<SelectSeparator />
|
|
79
|
+
<SelectGroup>
|
|
80
|
+
<SelectLabel>Asia</SelectLabel>
|
|
81
|
+
<SelectItem value="jst">Japan Standard Time (JST)</SelectItem>
|
|
82
|
+
<SelectItem value="kst">Korea Standard Time (KST)</SelectItem>
|
|
83
|
+
<SelectItem value="ist">India Standard Time (IST)</SelectItem>
|
|
84
|
+
</SelectGroup>
|
|
85
|
+
</SelectContent>
|
|
86
|
+
</Select>
|
|
87
|
+
),
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const Disabled: Story = {
|
|
91
|
+
render: () => (
|
|
92
|
+
<Select disabled>
|
|
93
|
+
<SelectTrigger aria-label="Select a fruit" className="w-70" disabled>
|
|
94
|
+
<SelectValue placeholder="Select a fruit" />
|
|
95
|
+
</SelectTrigger>
|
|
96
|
+
<SelectContent>
|
|
97
|
+
<SelectItem value="apple">Apple</SelectItem>
|
|
98
|
+
<SelectItem value="banana">Banana</SelectItem>
|
|
99
|
+
<SelectItem value="blueberry">Blueberry</SelectItem>
|
|
100
|
+
</SelectContent>
|
|
101
|
+
</Select>
|
|
102
|
+
),
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const WithDisabledItems: Story = {
|
|
106
|
+
render: () => (
|
|
107
|
+
<Select>
|
|
108
|
+
<SelectTrigger aria-label="Select a plan" className="w-70">
|
|
109
|
+
<SelectValue placeholder="Select a plan" />
|
|
110
|
+
</SelectTrigger>
|
|
111
|
+
<SelectContent>
|
|
112
|
+
<SelectItem value="free">Free Plan</SelectItem>
|
|
113
|
+
<SelectItem value="pro">Pro Plan</SelectItem>
|
|
114
|
+
<SelectItem disabled value="enterprise">
|
|
115
|
+
Enterprise Plan (Coming Soon)
|
|
116
|
+
</SelectItem>
|
|
117
|
+
</SelectContent>
|
|
118
|
+
</Select>
|
|
119
|
+
),
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const LongList: Story = {
|
|
123
|
+
render: () => (
|
|
124
|
+
<Select>
|
|
125
|
+
<SelectTrigger aria-label="Select a country" className="w-70">
|
|
126
|
+
<SelectValue placeholder="Select a country" />
|
|
127
|
+
</SelectTrigger>
|
|
128
|
+
<SelectContent>
|
|
129
|
+
<SelectItem value="us">United States</SelectItem>
|
|
130
|
+
<SelectItem value="uk">United Kingdom</SelectItem>
|
|
131
|
+
<SelectItem value="de">Germany</SelectItem>
|
|
132
|
+
<SelectItem value="fr">France</SelectItem>
|
|
133
|
+
<SelectItem value="es">Spain</SelectItem>
|
|
134
|
+
<SelectItem value="it">Italy</SelectItem>
|
|
135
|
+
<SelectItem value="nl">Netherlands</SelectItem>
|
|
136
|
+
<SelectItem value="be">Belgium</SelectItem>
|
|
137
|
+
<SelectItem value="ch">Switzerland</SelectItem>
|
|
138
|
+
<SelectItem value="at">Austria</SelectItem>
|
|
139
|
+
<SelectItem value="pl">Poland</SelectItem>
|
|
140
|
+
<SelectItem value="se">Sweden</SelectItem>
|
|
141
|
+
<SelectItem value="no">Norway</SelectItem>
|
|
142
|
+
<SelectItem value="dk">Denmark</SelectItem>
|
|
143
|
+
<SelectItem value="fi">Finland</SelectItem>
|
|
144
|
+
<SelectItem value="jp">Japan</SelectItem>
|
|
145
|
+
<SelectItem value="cn">China</SelectItem>
|
|
146
|
+
<SelectItem value="kr">South Korea</SelectItem>
|
|
147
|
+
<SelectItem value="in">India</SelectItem>
|
|
148
|
+
<SelectItem value="au">Australia</SelectItem>
|
|
149
|
+
</SelectContent>
|
|
150
|
+
</Select>
|
|
151
|
+
),
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const InForm: Story = {
|
|
155
|
+
render: () => (
|
|
156
|
+
<div className="w-100 space-y-4">
|
|
157
|
+
<div className="space-y-2">
|
|
158
|
+
<p className="ml-0.5 text-sm font-medium">Language Preference</p>
|
|
159
|
+
<Select defaultValue="en">
|
|
160
|
+
<SelectTrigger aria-label="Select a language">
|
|
161
|
+
<SelectValue placeholder="Select a language" />
|
|
162
|
+
</SelectTrigger>
|
|
163
|
+
<SelectContent>
|
|
164
|
+
<SelectItem value="en">English</SelectItem>
|
|
165
|
+
<SelectItem value="de">Deutsch</SelectItem>
|
|
166
|
+
<SelectItem value="fr">Français</SelectItem>
|
|
167
|
+
<SelectItem value="es">Español</SelectItem>
|
|
168
|
+
<SelectItem value="it">Italiano</SelectItem>
|
|
169
|
+
</SelectContent>
|
|
170
|
+
</Select>
|
|
171
|
+
<p className="text-muted-foreground ml-0.5 text-xs">
|
|
172
|
+
Choose your preferred language for the interface.
|
|
173
|
+
</p>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
),
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const countries = [
|
|
180
|
+
{ label: "United States", value: "us" },
|
|
181
|
+
{ label: "United Kingdom", value: "uk" },
|
|
182
|
+
{ label: "Germany", value: "de" },
|
|
183
|
+
{ label: "France", value: "fr" },
|
|
184
|
+
{ label: "Spain", value: "es" },
|
|
185
|
+
{ label: "Italy", value: "it" },
|
|
186
|
+
{ label: "Netherlands", value: "nl" },
|
|
187
|
+
{ label: "Belgium", value: "be" },
|
|
188
|
+
{ label: "Switzerland", value: "ch" },
|
|
189
|
+
{ label: "Austria", value: "at" },
|
|
190
|
+
{ label: "Poland", value: "pl" },
|
|
191
|
+
{ label: "Sweden", value: "se" },
|
|
192
|
+
{ label: "Norway", value: "no" },
|
|
193
|
+
{ label: "Denmark", value: "dk" },
|
|
194
|
+
{ label: "Finland", value: "fi" },
|
|
195
|
+
{ label: "Japan", value: "jp" },
|
|
196
|
+
{ label: "China", value: "cn" },
|
|
197
|
+
{ label: "South Korea", value: "kr" },
|
|
198
|
+
{ label: "India", value: "in" },
|
|
199
|
+
{ label: "Australia", value: "au" },
|
|
200
|
+
{ label: "Canada", value: "ca" },
|
|
201
|
+
{ label: "Mexico", value: "mx" },
|
|
202
|
+
{ label: "Brazil", value: "br" },
|
|
203
|
+
{ label: "Argentina", value: "ar" },
|
|
204
|
+
];
|
|
205
|
+
|
|
206
|
+
export const WithSearch: Story = {
|
|
207
|
+
render: () => {
|
|
208
|
+
const [selectedCountry, setSelectedCountry] = useState("");
|
|
209
|
+
|
|
210
|
+
return (
|
|
211
|
+
<div className="w-100 space-y-4">
|
|
212
|
+
<div className="space-y-2">
|
|
213
|
+
<p className="ml-0.5 text-sm font-medium">Country</p>
|
|
214
|
+
<SelectWithSearch
|
|
215
|
+
className="w-full"
|
|
216
|
+
noResultsText="No countries found"
|
|
217
|
+
onValueChange={setSelectedCountry}
|
|
218
|
+
options={countries}
|
|
219
|
+
placeholder="Select a country"
|
|
220
|
+
searchPlaceholder="Search for a country..."
|
|
221
|
+
value={selectedCountry}
|
|
222
|
+
/>
|
|
223
|
+
<p className="text-muted-foreground ml-0.5 text-xs">
|
|
224
|
+
Start typing to filter the list of countries.
|
|
225
|
+
</p>
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
);
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
const countriesWithIcons = countries
|
|
233
|
+
.slice(0, 5)
|
|
234
|
+
.map((country) => ({ ...country, icon: <Flag className="size-4 shrink-0" /> }));
|
|
235
|
+
|
|
236
|
+
export const WithIcons: Story = {
|
|
237
|
+
render: () => {
|
|
238
|
+
const [selectedCountry, setSelectedCountry] = useState("");
|
|
239
|
+
|
|
240
|
+
return (
|
|
241
|
+
<div className="w-100 space-y-4">
|
|
242
|
+
<div className="space-y-2">
|
|
243
|
+
<p className="ml-0.5 text-sm font-medium">Country</p>
|
|
244
|
+
<SelectWithSearch
|
|
245
|
+
className="w-full"
|
|
246
|
+
noResultsText="No countries found"
|
|
247
|
+
onValueChange={setSelectedCountry}
|
|
248
|
+
options={countriesWithIcons}
|
|
249
|
+
placeholder="Select a country"
|
|
250
|
+
searchPlaceholder="Search for a country..."
|
|
251
|
+
value={selectedCountry}
|
|
252
|
+
/>
|
|
253
|
+
<p className="text-muted-foreground ml-0.5 text-xs">
|
|
254
|
+
Each option carries an icon (e.g. institution logos) shown both in the dropdown and,
|
|
255
|
+
once selected, in the trigger.
|
|
256
|
+
</p>
|
|
257
|
+
</div>
|
|
258
|
+
</div>
|
|
259
|
+
);
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export const WithControlledSearch: Story = {
|
|
264
|
+
play: async ({ canvasElement }) => {
|
|
265
|
+
const canvas = within(canvasElement);
|
|
266
|
+
await userEvent.click(canvas.getByRole("combobox"));
|
|
267
|
+
|
|
268
|
+
const listbox = await within(document.body).findByRole("listbox");
|
|
269
|
+
await userEvent.type(within(listbox).getByRole("textbox"), "DE");
|
|
270
|
+
await waitFor(() => expect(within(listbox).getAllByRole("option")).toHaveLength(1));
|
|
271
|
+
await expect(within(listbox).getByRole("option")).toHaveTextContent("Germany");
|
|
272
|
+
},
|
|
273
|
+
render: () => {
|
|
274
|
+
const [query, setQuery] = useState("");
|
|
275
|
+
const [value, setValue] = useState("");
|
|
276
|
+
const options = [
|
|
277
|
+
{ label: "Germany", value: "DE" },
|
|
278
|
+
{ label: "France", value: "FR" },
|
|
279
|
+
];
|
|
280
|
+
return (
|
|
281
|
+
<div className="w-full max-w-100">
|
|
282
|
+
<SelectWithSearch
|
|
283
|
+
onSearchChange={setQuery}
|
|
284
|
+
onValueChange={setValue}
|
|
285
|
+
options={options.filter((option) => option.value.includes(query.toUpperCase()))}
|
|
286
|
+
searchQuery={query}
|
|
287
|
+
selectedOption={options.find((option) => option.value === value)}
|
|
288
|
+
value={value}
|
|
289
|
+
/>
|
|
290
|
+
</div>
|
|
291
|
+
);
|
|
292
|
+
},
|
|
293
|
+
};
|