symphony-forge 1.2.44__py3-none-any.whl
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.
- forge/__init__.py +4 -0
- forge/app_baseline.py +148 -0
- forge/approval.py +298 -0
- forge/autoreview.py +139 -0
- forge/backfill.py +298 -0
- forge/board.py +1197 -0
- forge/board_app/app.js +276 -0
- forge/board_app/assign.css +91 -0
- forge/board_app/assign.js +157 -0
- forge/board_app/insights.js +80 -0
- forge/board_app/item.css +380 -0
- forge/board_app/item.js +594 -0
- forge/board_app/markdown.js +110 -0
- forge/board_app/now.css +417 -0
- forge/board_app/now.js +248 -0
- forge/board_app/pages.css +178 -0
- forge/board_app/releases.js +203 -0
- forge/board_app/shell.html +31 -0
- forge/board_app/tokens.css +220 -0
- forge/board_facts.py +696 -0
- forge/board_graph.py +38 -0
- forge/board_server.py +431 -0
- forge/board_trends.py +105 -0
- forge/box.py +54 -0
- forge/box_ssh.py +209 -0
- forge/checks.py +743 -0
- forge/citime.py +259 -0
- forge/claude_sdk.py +56 -0
- forge/claude_turn.py +62 -0
- forge/cli.py +185 -0
- forge/close.py +1193 -0
- forge/close_remote.py +85 -0
- forge/codex.py +1200 -0
- forge/codex_turn.py +346 -0
- forge/deny.py +253 -0
- forge/design.py +201 -0
- forge/design_skills.py +16 -0
- forge/docskip.py +175 -0
- forge/doctor.py +578 -0
- forge/event_log.py +128 -0
- forge/fasttest.py +846 -0
- forge/feature.py +318 -0
- forge/feature_api.py +593 -0
- forge/feature_python.py +1107 -0
- forge/feature_python_contracts.py +268 -0
- forge/feature_python_tests.py +1134 -0
- forge/feature_python_tools.py +81 -0
- forge/feature_remove.py +189 -0
- forge/feature_schema.py +156 -0
- forge/feature_tests.py +1062 -0
- forge/fullrun.py +166 -0
- forge/gaps.py +109 -0
- forge/githooks.py +251 -0
- forge/github.py +191 -0
- forge/init.py +494 -0
- forge/intake.py +226 -0
- forge/journey.py +126 -0
- forge/known_issues.py +165 -0
- forge/land.py +882 -0
- forge/machine.py +821 -0
- forge/merge.py +530 -0
- forge/merge_review.py +84 -0
- forge/merge_timings.py +46 -0
- forge/migrate.py +673 -0
- forge/migration_warnings.py +108 -0
- forge/mod/.claude-plugin/plugin.json +20 -0
- forge/mod/hooks/hooks.json +3 -0
- forge/mod/hooks/pane.test.ts +608 -0
- forge/mod/hooks/register.ts +413 -0
- forge/mod/tsconfig.json +18 -0
- forge/native.py +306 -0
- forge/nextstep.py +1184 -0
- forge/node_workers.cjs +26 -0
- forge/noise.py +40 -0
- forge/open_decisions.py +205 -0
- forge/owner_choices.py +167 -0
- forge/payback.py +97 -0
- forge/plain_english.py +20 -0
- forge/plan_scope.py +76 -0
- forge/prcheck.py +640 -0
- forge/quicktest.py +198 -0
- forge/records.py +912 -0
- forge/releases.py +100 -0
- forge/repo.py +1154 -0
- forge/review.py +1199 -0
- forge/review_process.py +86 -0
- forge/review_skip.py +116 -0
- forge/roles.py +141 -0
- forge/round_limits.py +7 -0
- forge/score.py +192 -0
- forge/spotted.py +271 -0
- forge/standards.md +318 -0
- forge/story.py +1200 -0
- forge/sync.py +783 -0
- forge/task.py +1082 -0
- forge/templates/adapters/AGENTS.md +98 -0
- forge/templates/brief.md +834 -0
- forge/templates/cold-read.md +324 -0
- forge/templates/conventions/api.md +144 -0
- forge/templates/conventions/backend.md +171 -0
- forge/templates/conventions/database.md +81 -0
- forge/templates/conventions/demo-data.md +61 -0
- forge/templates/conventions/deploy.md +114 -0
- forge/templates/conventions/frontend.md +187 -0
- forge/templates/conventions/python.md +336 -0
- forge/templates/conventions/security.md +44 -0
- forge/templates/conventions/stack.md +96 -0
- forge/templates/conventions/testing.md +165 -0
- forge/templates/delegation.md +3 -0
- forge/templates/design/render-check.d.mts +25 -0
- forge/templates/design/render-check.mjs +113 -0
- forge/templates/design/support.js +159 -0
- forge/templates/design/ui-checks.js +111 -0
- forge/templates/fde.md +218 -0
- forge/templates/feature/kinds.toml +140 -0
- forge/templates/handover.md +26 -0
- forge/templates/migrate-skill.md +87 -0
- forge/templates/records-only-action.yml +16 -0
- forge/templates/review-light.md +48 -0
- forge/templates/review-tests.py +200 -0
- forge/templates/review.md +661 -0
- forge/templates/run-reference.md +328 -0
- forge/templates/skeleton/.dockerignore +18 -0
- forge/templates/skeleton/Dockerfile +10 -0
- forge/templates/skeleton/docs/decisions/README.md +13 -0
- forge/templates/skeleton/docs/product/BRIEF.md +47 -0
- forge/templates/skeleton/docs/product/DISCOVERY.md +46 -0
- forge/templates/skeleton/docs/specs/README.md +41 -0
- forge/templates/skeleton/services.toml +6 -0
- forge/templates/skill.md +2753 -0
- forge/templates/skills/agents/SKILL.md +446 -0
- forge/templates/skills/agents/assistant-module/python/apps/api/app/assistant/README.md +131 -0
- forge/templates/skills/agents/assistant-module/python/apps/api/app/assistant/__init__.py +5 -0
- forge/templates/skills/agents/assistant-module/python/apps/api/app/assistant/chats.py +60 -0
- forge/templates/skills/agents/assistant-module/python/apps/api/app/assistant/cleanup.py +91 -0
- forge/templates/skills/agents/assistant-module/python/apps/api/app/assistant/models.py +57 -0
- forge/templates/skills/agents/assistant-module/python/apps/api/migrations/versions/20261106_assistant.py +90 -0
- forge/templates/skills/agents/assistant-module/python/apps/api/tests/test_assistant_chats.py +173 -0
- forge/templates/skills/agents/assistant-module/typescript/apps/api/prisma/migrations/20261106000000_assistant/migration.sql +17 -0
- forge/templates/skills/agents/assistant-module/typescript/apps/api/prisma/schema/assistant.prisma +19 -0
- forge/templates/skills/agents/assistant-module/typescript/apps/api/test/assistant-api.e2e-spec.ts +185 -0
- forge/templates/skills/agents/assistant-module/typescript/apps/api/test/assistant-chats.e2e-spec.ts +75 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/README.md +107 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/contracts/package.json +10 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/contracts/src/index.ts +66 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/contracts/tsconfig.json +12 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/server/package.json +23 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/server/src/assistant.chats.controller.ts +54 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/server/src/assistant.chats.service.ts +140 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/server/src/assistant.cleanup.ts +34 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/server/src/assistant.module.ts +20 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/server/src/index.ts +3 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/server/tsconfig.json +15 -0
- forge/templates/skills/app-baseline/SKILL.md +241 -0
- forge/templates/skills/database/SKILL.md +155 -0
- forge/templates/skills/emil-design-eng/FORGE-NOTICE.md +9 -0
- forge/templates/skills/emil-design-eng/LICENSE +21 -0
- forge/templates/skills/emil-design-eng/SKILL.md +674 -0
- forge/templates/skills/impeccable/FORGE-NOTICE.md +10 -0
- forge/templates/skills/impeccable/LICENSE +191 -0
- forge/templates/skills/impeccable/NOTICE.md +11 -0
- forge/templates/skills/impeccable/SKILL.md +88 -0
- forge/templates/skills/impeccable/reference/adapt.md +318 -0
- forge/templates/skills/impeccable/reference/adapt.native.md +58 -0
- forge/templates/skills/impeccable/reference/android.md +46 -0
- forge/templates/skills/impeccable/reference/animate.md +89 -0
- forge/templates/skills/impeccable/reference/audit.md +139 -0
- forge/templates/skills/impeccable/reference/audit.native.md +139 -0
- forge/templates/skills/impeccable/reference/bolder.md +33 -0
- forge/templates/skills/impeccable/reference/clarify.md +94 -0
- forge/templates/skills/impeccable/reference/colorize.md +86 -0
- forge/templates/skills/impeccable/reference/component-review.md +63 -0
- forge/templates/skills/impeccable/reference/craft-floor.md +44 -0
- forge/templates/skills/impeccable/reference/craft.md +5 -0
- forge/templates/skills/impeccable/reference/critique.md +819 -0
- forge/templates/skills/impeccable/reference/degraded/asset-producer.md +42 -0
- forge/templates/skills/impeccable/reference/degraded/documenter.md +24 -0
- forge/templates/skills/impeccable/reference/degraded/finish-reviewer.md +38 -0
- forge/templates/skills/impeccable/reference/degraded/manual-edit-applier.md +92 -0
- forge/templates/skills/impeccable/reference/delight.md +70 -0
- forge/templates/skills/impeccable/reference/distill.md +111 -0
- forge/templates/skills/impeccable/reference/doctor.md +54 -0
- forge/templates/skills/impeccable/reference/document.md +416 -0
- forge/templates/skills/impeccable/reference/extract.md +69 -0
- forge/templates/skills/impeccable/reference/generate.md +101 -0
- forge/templates/skills/impeccable/reference/harden.md +362 -0
- forge/templates/skills/impeccable/reference/hooks.md +114 -0
- forge/templates/skills/impeccable/reference/init.md +131 -0
- forge/templates/skills/impeccable/reference/ios.md +51 -0
- forge/templates/skills/impeccable/reference/layout.md +84 -0
- forge/templates/skills/impeccable/reference/live-setup.md +104 -0
- forge/templates/skills/impeccable/reference/live.md +325 -0
- forge/templates/skills/impeccable/reference/mode-operate.md +21 -0
- forge/templates/skills/impeccable/reference/mode-persuade.md +19 -0
- forge/templates/skills/impeccable/reference/mode-read.md +21 -0
- forge/templates/skills/impeccable/reference/new-work.md +154 -0
- forge/templates/skills/impeccable/reference/onboard.md +234 -0
- forge/templates/skills/impeccable/reference/operate.md +61 -0
- forge/templates/skills/impeccable/reference/optimize.md +257 -0
- forge/templates/skills/impeccable/reference/overdrive.md +127 -0
- forge/templates/skills/impeccable/reference/polish.md +105 -0
- forge/templates/skills/impeccable/reference/quieter.md +99 -0
- forge/templates/skills/impeccable/reference/region-map.md +26 -0
- forge/templates/skills/impeccable/reference/routing.md +24 -0
- forge/templates/skills/impeccable/reference/shape.md +59 -0
- forge/templates/skills/impeccable/reference/typeset.md +90 -0
- forge/templates/skills/impeccable/reference/visualize.md +47 -0
- forge/templates/skills/impeccable/scripts/VERSION +1 -0
- forge/templates/skills/impeccable/scripts/command-metadata.json +98 -0
- forge/templates/skills/impeccable/scripts/data/font-index-failures.json +121 -0
- forge/templates/skills/impeccable/scripts/data/font-index.json +1 -0
- forge/templates/skills/impeccable/scripts/engine-checksums.txt +9 -0
- forge/templates/skills/impeccable/scripts/impeccable +249 -0
- forge/templates/skills/impeccable/scripts/impeccable.cmd +278 -0
- forge/templates/skills/impeccable/scripts/live-browser-dom.js +321 -0
- forge/templates/skills/impeccable/scripts/live-browser-ignores.js +247 -0
- forge/templates/skills/impeccable/scripts/live-browser-session.js +184 -0
- forge/templates/skills/impeccable/scripts/live-browser.js +13646 -0
- forge/templates/skills/impeccable/scripts/modern-screenshot.umd.js +15 -0
- forge/templates/skills/remote-approval/SKILL.md +40 -0
- forge/templates/skills/security-audit/AI-AND-LLM.md +83 -0
- forge/templates/skills/security-audit/ATTACK-CLASSES.md +130 -0
- forge/templates/skills/security-audit/CLIENT-SIDE.md +83 -0
- forge/templates/skills/security-audit/CLOUD-AND-DEPLOYMENT.md +86 -0
- forge/templates/skills/security-audit/DATA-ISOLATION-AND-LIFECYCLE.md +84 -0
- forge/templates/skills/security-audit/DESKTOP-MOBILE-AND-LOCAL-IPC.md +89 -0
- forge/templates/skills/security-audit/HUNTING.md +251 -0
- forge/templates/skills/security-audit/LICENSE +21 -0
- forge/templates/skills/security-audit/MEMORY-SAFETY-AND-BINARY.md +101 -0
- forge/templates/skills/security-audit/NOTICE.md +6 -0
- forge/templates/skills/security-audit/PROTOCOLS-RPC-AND-MESSAGING.md +81 -0
- forge/templates/skills/security-audit/RECONNAISSANCE.md +156 -0
- forge/templates/skills/security-audit/RESOURCE-EXHAUSTION-AND-AVAILABILITY.md +78 -0
- forge/templates/skills/security-audit/SKILL.md +192 -0
- forge/templates/skills/security-audit/SUPPLY-CHAIN-AND-RELEASE.md +73 -0
- forge/templates/skills/security-audit/VALIDATION-AND-REPORTING.md +186 -0
- forge/templates/skills/security-audit/WEB-PROTOCOL-AND-AUTH.md +105 -0
- forge/templates/skills/security-audit/report-schema.json +461 -0
- forge/templates/skills/security-audit/validate-coverage-ledger.cjs +873 -0
- forge/templates/skills/security-audit/validate-findings.cjs +774 -0
- forge/templates/skills/simplified-technical-english/LICENSE +28 -0
- forge/templates/skills/simplified-technical-english/NOTICE.md +33 -0
- forge/templates/skills/simplified-technical-english/SKILL.md +127 -0
- forge/templates/skills/simplified-technical-english/examples/before-after.md +86 -0
- forge/templates/skills/simplified-technical-english/references/substitutions.md +113 -0
- forge/templates/skills/simplified-technical-english/references/writing-rules.md +209 -0
- forge/templates/skills/simplified-technical-english/scripts/ste_check.py +301 -0
- forge/templates/skills/test-audit/NOTICE.md +25 -0
- forge/templates/skills/test-audit/SKILL.md +182 -0
- forge/templates/start.md +27 -0
- forge/templates/starter/.env.example +14 -0
- forge/templates/starter/.gitignore +7 -0
- forge/templates/starter/.npmrc +1 -0
- forge/templates/starter/Dockerfile +23 -0
- forge/templates/starter/README.md +121 -0
- forge/templates/starter/apps/api/package.json +15 -0
- forge/templates/starter/apps/api/prisma/migrations/20261022000000_initial/migration.sql +68 -0
- forge/templates/starter/apps/api/prisma/migrations/20261025000000_organisations/migration.sql +44 -0
- forge/templates/starter/apps/api/prisma/migrations/20261025000100_invites/migration.sql +18 -0
- forge/templates/starter/apps/api/prisma/migrations/20261025000200_history/migration.sql +13 -0
- forge/templates/starter/apps/api/prisma/migrations/20261025000300_soft_delete_only/migration.sql +10 -0
- forge/templates/starter/apps/api/prisma/migrations/20261026000000_extensions/migration.sql +3 -0
- forge/templates/starter/apps/api/prisma/migrations/20261026000100_ids_and_updated_at/migration.sql +31 -0
- forge/templates/starter/apps/api/prisma/migrations/20261026000150_module_schemas/migration.sql +19 -0
- forge/templates/starter/apps/api/prisma/migrations/20261026000200_columns/migration.sql +51 -0
- forge/templates/starter/apps/api/prisma/migrations/20261026000300_history_subjects/migration.sql +11 -0
- forge/templates/starter/apps/api/prisma/migrations/20261027000000_agents/migration.sql +12 -0
- forge/templates/starter/apps/api/prisma/migrations/20261027000100_mcp/migration.sql +20 -0
- forge/templates/starter/apps/api/prisma/migrations/20261028000000_via_agent/migration.sql +7 -0
- forge/templates/starter/apps/api/prisma/migrations/20261102000000_sign_in_attempts/migration.sql +13 -0
- forge/templates/starter/apps/api/prisma/migrations/20261104000000_notifications/migration.sql +23 -0
- forge/templates/starter/apps/api/prisma/migrations/migration_lock.toml +1 -0
- forge/templates/starter/apps/api/prisma/schema/auth.prisma +65 -0
- forge/templates/starter/apps/api/prisma/schema/base.prisma +9 -0
- forge/templates/starter/apps/api/prisma/schema/history.prisma +19 -0
- forge/templates/starter/apps/api/prisma/schema/mcp.prisma +18 -0
- forge/templates/starter/apps/api/prisma/schema/notifications.prisma +20 -0
- forge/templates/starter/apps/api/prisma/schema/organisations.prisma +66 -0
- forge/templates/starter/apps/api/prisma/schema/projects.prisma +23 -0
- forge/templates/starter/apps/api/project.json +35 -0
- forge/templates/starter/apps/api/src/app.module.ts +36 -0
- forge/templates/starter/apps/api/src/health/health.controller.ts +16 -0
- forge/templates/starter/apps/api/src/health/health.module.ts +5 -0
- forge/templates/starter/apps/api/src/main.ts +44 -0
- forge/templates/starter/apps/api/src/setup-company.ts +33 -0
- forge/templates/starter/apps/api/test/agents.e2e-spec.ts +99 -0
- forge/templates/starter/apps/api/test/api.e2e-spec.ts +250 -0
- forge/templates/starter/apps/api/test/auth.e2e-spec.ts +287 -0
- forge/templates/starter/apps/api/test/database.e2e-spec.ts +171 -0
- forge/templates/starter/apps/api/test/environment.e2e-spec.ts +56 -0
- forge/templates/starter/apps/api/test/error-reports.e2e-spec.ts +72 -0
- forge/templates/starter/apps/api/test/exports.e2e-spec.ts +85 -0
- forge/templates/starter/apps/api/test/helpers.ts +103 -0
- forge/templates/starter/apps/api/test/history.e2e-spec.ts +93 -0
- forge/templates/starter/apps/api/test/invites.e2e-spec.ts +262 -0
- forge/templates/starter/apps/api/test/mcp.e2e-spec.ts +269 -0
- forge/templates/starter/apps/api/test/notifications.e2e-spec.ts +117 -0
- forge/templates/starter/apps/api/test/one-company.e2e-spec.ts +154 -0
- forge/templates/starter/apps/api/test/organisations.e2e-spec.ts +210 -0
- forge/templates/starter/apps/api/test/projects.e2e-spec.ts +824 -0
- forge/templates/starter/apps/api/test/soft-delete.e2e-spec.ts +31 -0
- forge/templates/starter/apps/api/tsconfig.json +44 -0
- forge/templates/starter/apps/api/tsconfig.test.json +17 -0
- forge/templates/starter/apps/api/vitest.config.ts +13 -0
- forge/templates/starter/apps/web/e2e/motion.spec.ts +88 -0
- forge/templates/starter/apps/web/e2e/rules/accept-invite.spec.ts +59 -0
- forge/templates/starter/apps/web/e2e/rules/members.spec.ts +212 -0
- forge/templates/starter/apps/web/e2e/rules/reset-password.spec.ts +78 -0
- forge/templates/starter/apps/web/e2e/rules/sign-in.spec.ts +87 -0
- forge/templates/starter/apps/web/e2e/served-app.spec.ts +19 -0
- forge/templates/starter/apps/web/index.html +14 -0
- forge/templates/starter/apps/web/package.json +9 -0
- forge/templates/starter/apps/web/playwright.config.ts +21 -0
- forge/templates/starter/apps/web/project.json +36 -0
- forge/templates/starter/apps/web/src/index.css +166 -0
- forge/templates/starter/apps/web/src/main.tsx +14 -0
- forge/templates/starter/apps/web/src/shared-states.test.tsx +40 -0
- forge/templates/starter/apps/web/tsconfig.json +30 -0
- forge/templates/starter/apps/web/vite.config.ts +19 -0
- forge/templates/starter/apps/web/vitest.config.ts +23 -0
- forge/templates/starter/apps/web/vitest.setup.ts +5 -0
- forge/templates/starter/compose.test.yml +66 -0
- forge/templates/starter/eslint.config.mjs +56 -0
- forge/templates/starter/libs/auth/contracts/package.json +17 -0
- forge/templates/starter/libs/auth/contracts/project.json +15 -0
- forge/templates/starter/libs/auth/contracts/src/index.ts +56 -0
- forge/templates/starter/libs/auth/contracts/tsconfig.json +18 -0
- forge/templates/starter/libs/auth/server/package.json +19 -0
- forge/templates/starter/libs/auth/server/project.json +15 -0
- forge/templates/starter/libs/auth/server/src/agents.controller.ts +24 -0
- forge/templates/starter/libs/auth/server/src/auth.controller.ts +136 -0
- forge/templates/starter/libs/auth/server/src/auth.dto.ts +53 -0
- forge/templates/starter/libs/auth/server/src/auth.module.ts +18 -0
- forge/templates/starter/libs/auth/server/src/auth.service.ts +251 -0
- forge/templates/starter/libs/auth/server/src/index.ts +3 -0
- forge/templates/starter/libs/auth/server/src/invites.controller.ts +37 -0
- forge/templates/starter/libs/auth/server/src/members.controller.ts +47 -0
- forge/templates/starter/libs/auth/server/src/session.guard.ts +52 -0
- forge/templates/starter/libs/auth/server/tsconfig.json +29 -0
- forge/templates/starter/libs/core/server/package.json +17 -0
- forge/templates/starter/libs/core/server/project.json +19 -0
- forge/templates/starter/libs/core/server/src/common/account-principal.ts +8 -0
- forge/templates/starter/libs/core/server/src/common/admin-only.decorator.ts +18 -0
- forge/templates/starter/libs/core/server/src/common/all-exceptions.filter.ts +55 -0
- forge/templates/starter/libs/core/server/src/common/api-envelope.decorator.ts +28 -0
- forge/templates/starter/libs/core/server/src/common/api-response.dto.ts +26 -0
- forge/templates/starter/libs/core/server/src/common/api-zod.decorator.ts +21 -0
- forge/templates/starter/libs/core/server/src/common/authenticated-request.ts +7 -0
- forge/templates/starter/libs/core/server/src/common/common.module.ts +7 -0
- forge/templates/starter/libs/core/server/src/common/correlation.middleware.ts +12 -0
- forge/templates/starter/libs/core/server/src/common/csrf.guard.ts +35 -0
- forge/templates/starter/libs/core/server/src/common/csv.ts +14 -0
- forge/templates/starter/libs/core/server/src/common/current-account.decorator.ts +11 -0
- forge/templates/starter/libs/core/server/src/common/envelope.interceptor.ts +10 -0
- forge/templates/starter/libs/core/server/src/common/error-report.ts +43 -0
- forge/templates/starter/libs/core/server/src/common/json-logger.test.ts +95 -0
- forge/templates/starter/libs/core/server/src/common/json-logger.ts +57 -0
- forge/templates/starter/libs/core/server/src/common/permissions.ts +49 -0
- forge/templates/starter/libs/core/server/src/common/prompts.ts +42 -0
- forge/templates/starter/libs/core/server/src/common/public.decorator.ts +4 -0
- forge/templates/starter/libs/core/server/src/common/request-log.middleware.ts +19 -0
- forge/templates/starter/libs/core/server/src/common/resources.ts +88 -0
- forge/templates/starter/libs/core/server/src/common/retry-keys.ts +31 -0
- forge/templates/starter/libs/core/server/src/common/tools.test.ts +205 -0
- forge/templates/starter/libs/core/server/src/common/tools.ts +266 -0
- forge/templates/starter/libs/core/server/src/common/zod-validation.pipe.ts +22 -0
- forge/templates/starter/libs/core/server/src/config/environment.ts +95 -0
- forge/templates/starter/libs/core/server/src/index.ts +27 -0
- forge/templates/starter/libs/core/server/src/mail/mail.module.ts +19 -0
- forge/templates/starter/libs/core/server/src/mail/mail.provider.ts +22 -0
- forge/templates/starter/libs/core/server/src/prisma/prisma.module.ts +7 -0
- forge/templates/starter/libs/core/server/src/prisma/prisma.service.ts +19 -0
- forge/templates/starter/libs/core/server/tsconfig.json +23 -0
- forge/templates/starter/libs/core/web/package.json +16 -0
- forge/templates/starter/libs/core/web/project.json +15 -0
- forge/templates/starter/libs/core/web/src/api-client.ts +42 -0
- forge/templates/starter/libs/core/web/src/error-report.ts +12 -0
- forge/templates/starter/libs/core/web/src/form-errors.ts +18 -0
- forge/templates/starter/libs/core/web/src/index.ts +4 -0
- forge/templates/starter/libs/core/web/src/permissions.ts +9 -0
- forge/templates/starter/libs/core/web/src/query-client.ts +10 -0
- forge/templates/starter/libs/core/web/tsconfig.json +18 -0
- forge/templates/starter/libs/history/contracts/package.json +14 -0
- forge/templates/starter/libs/history/contracts/project.json +15 -0
- forge/templates/starter/libs/history/contracts/src/index.ts +2 -0
- forge/templates/starter/libs/history/contracts/src/service.ts +21 -0
- forge/templates/starter/libs/history/contracts/tsconfig.json +14 -0
- forge/templates/starter/libs/history/server/package.json +19 -0
- forge/templates/starter/libs/history/server/project.json +19 -0
- forge/templates/starter/libs/history/server/src/history.controller.ts +45 -0
- forge/templates/starter/libs/history/server/src/history.dto.ts +22 -0
- forge/templates/starter/libs/history/server/src/history.module.ts +12 -0
- forge/templates/starter/libs/history/server/src/history.service.test.ts +18 -0
- forge/templates/starter/libs/history/server/src/history.service.ts +42 -0
- forge/templates/starter/libs/history/server/src/index.ts +2 -0
- forge/templates/starter/libs/history/server/tsconfig.json +29 -0
- forge/templates/starter/libs/mcp/server/package.json +18 -0
- forge/templates/starter/libs/mcp/server/project.json +15 -0
- forge/templates/starter/libs/mcp/server/src/index.ts +1 -0
- forge/templates/starter/libs/mcp/server/src/mcp.controller.ts +102 -0
- forge/templates/starter/libs/mcp/server/src/mcp.module.ts +5 -0
- forge/templates/starter/libs/mcp/server/tsconfig.json +26 -0
- forge/templates/starter/libs/notifications/contracts/package.json +14 -0
- forge/templates/starter/libs/notifications/contracts/project.json +12 -0
- forge/templates/starter/libs/notifications/contracts/src/index.ts +1 -0
- forge/templates/starter/libs/notifications/contracts/src/service.ts +19 -0
- forge/templates/starter/libs/notifications/contracts/tsconfig.json +12 -0
- forge/templates/starter/libs/notifications/server/package.json +18 -0
- forge/templates/starter/libs/notifications/server/project.json +12 -0
- forge/templates/starter/libs/notifications/server/src/index.ts +1 -0
- forge/templates/starter/libs/notifications/server/src/notifications.controller.ts +21 -0
- forge/templates/starter/libs/notifications/server/src/notifications.dto.ts +28 -0
- forge/templates/starter/libs/notifications/server/src/notifications.module.ts +12 -0
- forge/templates/starter/libs/notifications/server/src/notifications.service.ts +36 -0
- forge/templates/starter/libs/notifications/server/tsconfig.json +18 -0
- forge/templates/starter/libs/organisations/contracts/package.json +14 -0
- forge/templates/starter/libs/organisations/contracts/project.json +15 -0
- forge/templates/starter/libs/organisations/contracts/src/index.ts +54 -0
- forge/templates/starter/libs/organisations/contracts/src/service.ts +29 -0
- forge/templates/starter/libs/organisations/contracts/tsconfig.json +14 -0
- forge/templates/starter/libs/organisations/server/package.json +20 -0
- forge/templates/starter/libs/organisations/server/project.json +15 -0
- forge/templates/starter/libs/organisations/server/src/index.ts +2 -0
- forge/templates/starter/libs/organisations/server/src/organisations.controller.ts +101 -0
- forge/templates/starter/libs/organisations/server/src/organisations.dto.ts +46 -0
- forge/templates/starter/libs/organisations/server/src/organisations.module.ts +14 -0
- forge/templates/starter/libs/organisations/server/src/organisations.service.ts +221 -0
- forge/templates/starter/libs/organisations/server/tsconfig.json +32 -0
- forge/templates/starter/libs/projects/contracts/package.json +14 -0
- forge/templates/starter/libs/projects/contracts/project.json +15 -0
- forge/templates/starter/libs/projects/contracts/src/index.ts +87 -0
- forge/templates/starter/libs/projects/contracts/tsconfig.json +14 -0
- forge/templates/starter/libs/projects/server/package.json +21 -0
- forge/templates/starter/libs/projects/server/project.json +15 -0
- forge/templates/starter/libs/projects/server/src/index.ts +2 -0
- forge/templates/starter/libs/projects/server/src/projects.controller.ts +165 -0
- forge/templates/starter/libs/projects/server/src/projects.dto.ts +77 -0
- forge/templates/starter/libs/projects/server/src/projects.module.ts +19 -0
- forge/templates/starter/libs/projects/server/src/projects.permissions.ts +7 -0
- forge/templates/starter/libs/projects/server/src/projects.service.ts +314 -0
- forge/templates/starter/libs/projects/server/src/projects.tools.ts +28 -0
- forge/templates/starter/libs/projects/server/tsconfig.json +29 -0
- forge/templates/starter/libs/shared/ui/components.json +21 -0
- forge/templates/starter/libs/shared/ui/package.json +27 -0
- forge/templates/starter/libs/shared/ui/project.json +15 -0
- forge/templates/starter/libs/shared/ui/src/components/states.tsx +73 -0
- forge/templates/starter/libs/shared/ui/src/components/theme-provider.tsx +39 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/LICENSE +21 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/alert-dialog.tsx +196 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/alert.tsx +65 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/avatar.tsx +108 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/badge.tsx +47 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/breadcrumb.tsx +108 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/button.tsx +63 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/card.tsx +91 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/checkbox.tsx +29 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/collapsible.tsx +33 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/command.tsx +184 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/dialog.tsx +158 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/dropdown-menu.tsx +256 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/empty.tsx +103 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/form.tsx +167 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/input.tsx +20 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/label.tsx +23 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/popover.tsx +88 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/select.tsx +189 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/separator.tsx +27 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/sheet.tsx +142 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/sidebar.tsx +726 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/skeleton.tsx +13 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/sonner.tsx +40 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/switch.tsx +32 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/table.tsx +115 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/textarea.tsx +17 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/tooltip.tsx +56 -0
- forge/templates/starter/libs/shared/ui/src/hooks/use-mobile.ts +19 -0
- forge/templates/starter/libs/shared/ui/src/lib/utils.ts +6 -0
- forge/templates/starter/libs/shared/ui/tsconfig.json +23 -0
- forge/templates/starter/libs/shared/util/package.json +14 -0
- forge/templates/starter/libs/shared/util/project.json +19 -0
- forge/templates/starter/libs/shared/util/src/csv-field.ts +6 -0
- forge/templates/starter/libs/shared/util/src/envelope.ts +9 -0
- forge/templates/starter/libs/shared/util/src/format.test.ts +33 -0
- forge/templates/starter/libs/shared/util/src/format.ts +43 -0
- forge/templates/starter/libs/shared/util/src/index.ts +12 -0
- forge/templates/starter/libs/shared/util/tsconfig.json +14 -0
- forge/templates/starter/nx.json +7 -0
- forge/templates/starter/package.json +97 -0
- forge/templates/starter/pnpm-lock.yaml +11587 -0
- forge/templates/starter/pnpm-workspace.yaml +4 -0
- forge/templates/starter/prisma.config.ts +13 -0
- forge/templates/starter/scripts/affected.mjs +27 -0
- forge/templates/starter/scripts/test-build.mjs +29 -0
- forge/templates/starter/scripts/test.mjs +107 -0
- forge/templates/starter/services.toml +7 -0
- forge/templates/starter/tsconfig.base.json +15 -0
- forge/templates/starter-python/.env.example +8 -0
- forge/templates/starter-python/.gitignore +13 -0
- forge/templates/starter-python/Dockerfile +30 -0
- forge/templates/starter-python/README.md +101 -0
- forge/templates/starter-python/apps/api/.python-version +1 -0
- forge/templates/starter-python/apps/api/alembic.ini +38 -0
- forge/templates/starter-python/apps/api/app/__init__.py +1 -0
- forge/templates/starter-python/apps/api/app/auth/__init__.py +27 -0
- forge/templates/starter-python/apps/api/app/auth/models.py +111 -0
- forge/templates/starter-python/apps/api/app/auth/routes.py +398 -0
- forge/templates/starter-python/apps/api/app/auth/schema.py +117 -0
- forge/templates/starter-python/apps/api/app/auth/service.py +453 -0
- forge/templates/starter-python/apps/api/app/core/__init__.py +89 -0
- forge/templates/starter-python/apps/api/app/core/admin.py +23 -0
- forge/templates/starter-python/apps/api/app/core/config.py +83 -0
- forge/templates/starter-python/apps/api/app/core/csv.py +40 -0
- forge/templates/starter-python/apps/api/app/core/database.py +21 -0
- forge/templates/starter-python/apps/api/app/core/envelope.py +40 -0
- forge/templates/starter-python/apps/api/app/core/error_report.py +85 -0
- forge/templates/starter-python/apps/api/app/core/errors.py +153 -0
- forge/templates/starter-python/apps/api/app/core/logging.py +66 -0
- forge/templates/starter-python/apps/api/app/core/mail.py +34 -0
- forge/templates/starter-python/apps/api/app/core/permissions.py +59 -0
- forge/templates/starter-python/apps/api/app/core/principal.py +12 -0
- forge/templates/starter-python/apps/api/app/core/prompts.py +96 -0
- forge/templates/starter-python/apps/api/app/core/resources.py +230 -0
- forge/templates/starter-python/apps/api/app/core/retry_keys.py +101 -0
- forge/templates/starter-python/apps/api/app/core/schema.py +13 -0
- forge/templates/starter-python/apps/api/app/core/security.py +197 -0
- forge/templates/starter-python/apps/api/app/core/tools.py +1117 -0
- forge/templates/starter-python/apps/api/app/history/__init__.py +5 -0
- forge/templates/starter-python/apps/api/app/history/models.py +48 -0
- forge/templates/starter-python/apps/api/app/history/routes.py +65 -0
- forge/templates/starter-python/apps/api/app/history/schema.py +29 -0
- forge/templates/starter-python/apps/api/app/history/service.py +77 -0
- forge/templates/starter-python/apps/api/app/main.py +115 -0
- forge/templates/starter-python/apps/api/app/mcp/__init__.py +3 -0
- forge/templates/starter-python/apps/api/app/mcp/server.py +192 -0
- forge/templates/starter-python/apps/api/app/notifications/__init__.py +5 -0
- forge/templates/starter-python/apps/api/app/notifications/models.py +62 -0
- forge/templates/starter-python/apps/api/app/notifications/routes.py +25 -0
- forge/templates/starter-python/apps/api/app/notifications/schema.py +39 -0
- forge/templates/starter-python/apps/api/app/notifications/service.py +70 -0
- forge/templates/starter-python/apps/api/app/openapi.py +17 -0
- forge/templates/starter-python/apps/api/app/organisations/__init__.py +10 -0
- forge/templates/starter-python/apps/api/app/organisations/models.py +128 -0
- forge/templates/starter-python/apps/api/app/organisations/routes.py +176 -0
- forge/templates/starter-python/apps/api/app/organisations/schema.py +76 -0
- forge/templates/starter-python/apps/api/app/organisations/service.py +403 -0
- forge/templates/starter-python/apps/api/app/projects/__init__.py +14 -0
- forge/templates/starter-python/apps/api/app/projects/models.py +67 -0
- forge/templates/starter-python/apps/api/app/projects/permissions.py +13 -0
- forge/templates/starter-python/apps/api/app/projects/routes.py +246 -0
- forge/templates/starter-python/apps/api/app/projects/schema.py +118 -0
- forge/templates/starter-python/apps/api/app/projects/service.py +359 -0
- forge/templates/starter-python/apps/api/app/projects/tools.py +28 -0
- forge/templates/starter-python/apps/api/app/setup_company.py +56 -0
- forge/templates/starter-python/apps/api/migrations/env.py +51 -0
- forge/templates/starter-python/apps/api/migrations/script.py.mako +25 -0
- forge/templates/starter-python/apps/api/migrations/versions/0001_initial.py +167 -0
- forge/templates/starter-python/apps/api/migrations/versions/0002_soft_delete_only.py +31 -0
- forge/templates/starter-python/apps/api/migrations/versions/0003_organisations.py +115 -0
- forge/templates/starter-python/apps/api/migrations/versions/0004_invites.py +58 -0
- forge/templates/starter-python/apps/api/migrations/versions/0005_history.py +51 -0
- forge/templates/starter-python/apps/api/migrations/versions/0006_extensions.py +22 -0
- forge/templates/starter-python/apps/api/migrations/versions/0007_ids_and_updated_at.py +52 -0
- forge/templates/starter-python/apps/api/migrations/versions/0008_module_schemas.py +42 -0
- forge/templates/starter-python/apps/api/migrations/versions/0009_columns.py +97 -0
- forge/templates/starter-python/apps/api/migrations/versions/0010_history_subjects.py +46 -0
- forge/templates/starter-python/apps/api/migrations/versions/0011_agents.py +44 -0
- forge/templates/starter-python/apps/api/migrations/versions/0012_mcp.py +71 -0
- forge/templates/starter-python/apps/api/migrations/versions/0013_via_agent.py +23 -0
- forge/templates/starter-python/apps/api/migrations/versions/20261103_sign_in_attempts.py +48 -0
- forge/templates/starter-python/apps/api/migrations/versions/20261105_notifications.py +84 -0
- forge/templates/starter-python/apps/api/pyproject.toml +86 -0
- forge/templates/starter-python/apps/api/tests/conftest.py +146 -0
- forge/templates/starter-python/apps/api/tests/test_agents.py +169 -0
- forge/templates/starter-python/apps/api/tests/test_api.py +319 -0
- forge/templates/starter-python/apps/api/tests/test_auth.py +428 -0
- forge/templates/starter-python/apps/api/tests/test_config.py +58 -0
- forge/templates/starter-python/apps/api/tests/test_database.py +204 -0
- forge/templates/starter-python/apps/api/tests/test_error_reports.py +119 -0
- forge/templates/starter-python/apps/api/tests/test_history.py +206 -0
- forge/templates/starter-python/apps/api/tests/test_invites.py +427 -0
- forge/templates/starter-python/apps/api/tests/test_logging.py +56 -0
- forge/templates/starter-python/apps/api/tests/test_mcp.py +556 -0
- forge/templates/starter-python/apps/api/tests/test_module_schemas.py +100 -0
- forge/templates/starter-python/apps/api/tests/test_notifications.py +182 -0
- forge/templates/starter-python/apps/api/tests/test_one_company.py +188 -0
- forge/templates/starter-python/apps/api/tests/test_organisations.py +231 -0
- forge/templates/starter-python/apps/api/tests/test_projects.py +874 -0
- forge/templates/starter-python/apps/api/tests/test_soft_delete.py +80 -0
- forge/templates/starter-python/apps/api/tests/test_tools.py +395 -0
- forge/templates/starter-python/apps/api/uv.lock +1277 -0
- forge/templates/starter-python/compose.test.yml +63 -0
- forge/templates/starter-python/eslint.config.mjs +49 -0
- forge/templates/starter-python/libs/auth/contracts/package.json +17 -0
- forge/templates/starter-python/libs/auth/contracts/src/index.ts +51 -0
- forge/templates/starter-python/libs/auth/contracts/tsconfig.json +16 -0
- forge/templates/starter-python/libs/history/contracts/package.json +17 -0
- forge/templates/starter-python/libs/history/contracts/src/index.ts +3 -0
- forge/templates/starter-python/libs/history/contracts/tsconfig.json +16 -0
- forge/templates/starter-python/libs/organisations/contracts/package.json +17 -0
- forge/templates/starter-python/libs/organisations/contracts/src/index.ts +30 -0
- forge/templates/starter-python/libs/organisations/contracts/tsconfig.json +16 -0
- forge/templates/starter-python/libs/projects/contracts/package.json +17 -0
- forge/templates/starter-python/libs/projects/contracts/src/index.ts +65 -0
- forge/templates/starter-python/libs/projects/contracts/tsconfig.json +16 -0
- forge/templates/starter-python/libs/shared/api-types/package.json +14 -0
- forge/templates/starter-python/libs/shared/api-types/tsconfig.json +14 -0
- forge/templates/starter-python/package.json +71 -0
- forge/templates/starter-python/pnpm-lock.yaml +7574 -0
- forge/templates/starter-python/pnpm-workspace.yaml +4 -0
- forge/templates/starter-python/scripts/affected.mjs +20 -0
- forge/templates/starter-python/scripts/test-browser.mjs +39 -0
- forge/templates/starter-python/scripts/test.mjs +86 -0
- forge/templates/starter-python/services.toml +7 -0
- forge/templates/story.md +89 -0
- forge/time_records.py +1022 -0
- forge/ui_checks.py +97 -0
- forge/upgrade.py +368 -0
- forge/worker.py +876 -0
- symphony_forge-1.2.44.dist-info/METADATA +7 -0
- symphony_forge-1.2.44.dist-info/RECORD +623 -0
- symphony_forge-1.2.44.dist-info/WHEEL +4 -0
- symphony_forge-1.2.44.dist-info/entry_points.txt +2 -0
- symphony_forge-1.2.44.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,726 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
5
|
+
import { cn } from "../../lib/utils"
|
|
6
|
+
import { PanelLeftIcon } from "lucide-react"
|
|
7
|
+
import { Slot } from "radix-ui"
|
|
8
|
+
|
|
9
|
+
import { useIsMobile } from "../../hooks/use-mobile"
|
|
10
|
+
import { Button } from "./button"
|
|
11
|
+
import { Input } from "./input"
|
|
12
|
+
import { Separator } from "./separator"
|
|
13
|
+
import {
|
|
14
|
+
Sheet,
|
|
15
|
+
SheetContent,
|
|
16
|
+
SheetDescription,
|
|
17
|
+
SheetHeader,
|
|
18
|
+
SheetTitle,
|
|
19
|
+
} from "./sheet"
|
|
20
|
+
import { Skeleton } from "./skeleton"
|
|
21
|
+
import {
|
|
22
|
+
Tooltip,
|
|
23
|
+
TooltipContent,
|
|
24
|
+
TooltipProvider,
|
|
25
|
+
TooltipTrigger,
|
|
26
|
+
} from "./tooltip"
|
|
27
|
+
|
|
28
|
+
const SIDEBAR_COOKIE_NAME = "sidebar_state"
|
|
29
|
+
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
|
|
30
|
+
const SIDEBAR_WIDTH = "16rem"
|
|
31
|
+
const SIDEBAR_WIDTH_MOBILE = "18rem"
|
|
32
|
+
const SIDEBAR_WIDTH_ICON = "3rem"
|
|
33
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = "b"
|
|
34
|
+
|
|
35
|
+
type SidebarContextProps = {
|
|
36
|
+
state: "expanded" | "collapsed"
|
|
37
|
+
open: boolean
|
|
38
|
+
setOpen: (open: boolean) => void
|
|
39
|
+
openMobile: boolean
|
|
40
|
+
setOpenMobile: (open: boolean) => void
|
|
41
|
+
isMobile: boolean
|
|
42
|
+
toggleSidebar: () => void
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const SidebarContext = React.createContext<SidebarContextProps | null>(null)
|
|
46
|
+
|
|
47
|
+
function useSidebar() {
|
|
48
|
+
const context = React.useContext(SidebarContext)
|
|
49
|
+
if (!context) {
|
|
50
|
+
throw new Error("useSidebar must be used within a SidebarProvider.")
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return context
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function SidebarProvider({
|
|
57
|
+
defaultOpen = true,
|
|
58
|
+
open: openProp,
|
|
59
|
+
onOpenChange: setOpenProp,
|
|
60
|
+
className,
|
|
61
|
+
style,
|
|
62
|
+
children,
|
|
63
|
+
...props
|
|
64
|
+
}: React.ComponentProps<"div"> & {
|
|
65
|
+
defaultOpen?: boolean
|
|
66
|
+
open?: boolean
|
|
67
|
+
onOpenChange?: (open: boolean) => void
|
|
68
|
+
}) {
|
|
69
|
+
const isMobile = useIsMobile()
|
|
70
|
+
const [openMobile, setOpenMobile] = React.useState(false)
|
|
71
|
+
|
|
72
|
+
// This is the internal state of the sidebar.
|
|
73
|
+
// We use openProp and setOpenProp for control from outside the component.
|
|
74
|
+
const [_open, _setOpen] = React.useState(defaultOpen)
|
|
75
|
+
const open = openProp ?? _open
|
|
76
|
+
const setOpen = React.useCallback(
|
|
77
|
+
(value: boolean | ((value: boolean) => boolean)) => {
|
|
78
|
+
const openState = typeof value === "function" ? value(open) : value
|
|
79
|
+
if (setOpenProp) {
|
|
80
|
+
setOpenProp(openState)
|
|
81
|
+
} else {
|
|
82
|
+
_setOpen(openState)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// This sets the cookie to keep the sidebar state.
|
|
86
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`
|
|
87
|
+
},
|
|
88
|
+
[setOpenProp, open]
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
// Helper to toggle the sidebar.
|
|
92
|
+
const toggleSidebar = React.useCallback(() => {
|
|
93
|
+
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open)
|
|
94
|
+
}, [isMobile, setOpen, setOpenMobile])
|
|
95
|
+
|
|
96
|
+
// Adds a keyboard shortcut to toggle the sidebar.
|
|
97
|
+
React.useEffect(() => {
|
|
98
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
99
|
+
if (
|
|
100
|
+
event.key === SIDEBAR_KEYBOARD_SHORTCUT &&
|
|
101
|
+
(event.metaKey || event.ctrlKey)
|
|
102
|
+
) {
|
|
103
|
+
event.preventDefault()
|
|
104
|
+
toggleSidebar()
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
window.addEventListener("keydown", handleKeyDown)
|
|
109
|
+
return () => window.removeEventListener("keydown", handleKeyDown)
|
|
110
|
+
}, [toggleSidebar])
|
|
111
|
+
|
|
112
|
+
// We add a state so that we can do data-state="expanded" or "collapsed".
|
|
113
|
+
// This makes it easier to style the sidebar with Tailwind classes.
|
|
114
|
+
const state = open ? "expanded" : "collapsed"
|
|
115
|
+
|
|
116
|
+
const contextValue = React.useMemo<SidebarContextProps>(
|
|
117
|
+
() => ({
|
|
118
|
+
state,
|
|
119
|
+
open,
|
|
120
|
+
setOpen,
|
|
121
|
+
isMobile,
|
|
122
|
+
openMobile,
|
|
123
|
+
setOpenMobile,
|
|
124
|
+
toggleSidebar,
|
|
125
|
+
}),
|
|
126
|
+
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<SidebarContext.Provider value={contextValue}>
|
|
131
|
+
<TooltipProvider delayDuration={0}>
|
|
132
|
+
<div
|
|
133
|
+
data-slot="sidebar-wrapper"
|
|
134
|
+
style={
|
|
135
|
+
{
|
|
136
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
137
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
138
|
+
...style,
|
|
139
|
+
} as React.CSSProperties
|
|
140
|
+
}
|
|
141
|
+
className={cn(
|
|
142
|
+
"group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",
|
|
143
|
+
className
|
|
144
|
+
)}
|
|
145
|
+
{...props}
|
|
146
|
+
>
|
|
147
|
+
{children}
|
|
148
|
+
</div>
|
|
149
|
+
</TooltipProvider>
|
|
150
|
+
</SidebarContext.Provider>
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function Sidebar({
|
|
155
|
+
side = "left",
|
|
156
|
+
variant = "sidebar",
|
|
157
|
+
collapsible = "offcanvas",
|
|
158
|
+
className,
|
|
159
|
+
children,
|
|
160
|
+
...props
|
|
161
|
+
}: React.ComponentProps<"div"> & {
|
|
162
|
+
side?: "left" | "right"
|
|
163
|
+
variant?: "sidebar" | "floating" | "inset"
|
|
164
|
+
collapsible?: "offcanvas" | "icon" | "none"
|
|
165
|
+
}) {
|
|
166
|
+
const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
|
|
167
|
+
|
|
168
|
+
if (collapsible === "none") {
|
|
169
|
+
return (
|
|
170
|
+
<div
|
|
171
|
+
data-slot="sidebar"
|
|
172
|
+
className={cn(
|
|
173
|
+
"flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",
|
|
174
|
+
className
|
|
175
|
+
)}
|
|
176
|
+
{...props}
|
|
177
|
+
>
|
|
178
|
+
{children}
|
|
179
|
+
</div>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (isMobile) {
|
|
184
|
+
return (
|
|
185
|
+
<Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
|
|
186
|
+
<SheetContent
|
|
187
|
+
data-sidebar="sidebar"
|
|
188
|
+
data-slot="sidebar"
|
|
189
|
+
data-mobile="true"
|
|
190
|
+
className="w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
|
|
191
|
+
style={
|
|
192
|
+
{
|
|
193
|
+
"--sidebar-width": SIDEBAR_WIDTH_MOBILE,
|
|
194
|
+
} as React.CSSProperties
|
|
195
|
+
}
|
|
196
|
+
side={side}
|
|
197
|
+
>
|
|
198
|
+
<SheetHeader className="sr-only">
|
|
199
|
+
<SheetTitle>Sidebar</SheetTitle>
|
|
200
|
+
<SheetDescription>Displays the mobile sidebar.</SheetDescription>
|
|
201
|
+
</SheetHeader>
|
|
202
|
+
<div className="flex h-full w-full flex-col">{children}</div>
|
|
203
|
+
</SheetContent>
|
|
204
|
+
</Sheet>
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return (
|
|
209
|
+
<div
|
|
210
|
+
className="group peer hidden text-sidebar-foreground md:block"
|
|
211
|
+
data-state={state}
|
|
212
|
+
data-collapsible={state === "collapsed" ? collapsible : ""}
|
|
213
|
+
data-variant={variant}
|
|
214
|
+
data-side={side}
|
|
215
|
+
data-slot="sidebar"
|
|
216
|
+
>
|
|
217
|
+
{/* This is what handles the sidebar gap on desktop */}
|
|
218
|
+
<div
|
|
219
|
+
data-slot="sidebar-gap"
|
|
220
|
+
className={cn(
|
|
221
|
+
"relative w-(--sidebar-width) bg-transparent transition-[width] duration-(--enter-duration) ease-out",
|
|
222
|
+
"group-data-[collapsible=offcanvas]:w-0",
|
|
223
|
+
"group-data-[side=right]:rotate-180",
|
|
224
|
+
variant === "floating" || variant === "inset"
|
|
225
|
+
? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"
|
|
226
|
+
: "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
|
|
227
|
+
)}
|
|
228
|
+
/>
|
|
229
|
+
<div
|
|
230
|
+
data-slot="sidebar-container"
|
|
231
|
+
className={cn(
|
|
232
|
+
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-(--enter-duration) ease-out md:flex",
|
|
233
|
+
side === "left"
|
|
234
|
+
? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
|
|
235
|
+
: "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
236
|
+
// Adjust the padding for floating and inset variants.
|
|
237
|
+
variant === "floating" || variant === "inset"
|
|
238
|
+
? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
|
|
239
|
+
: "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
|
|
240
|
+
className
|
|
241
|
+
)}
|
|
242
|
+
{...props}
|
|
243
|
+
>
|
|
244
|
+
<div
|
|
245
|
+
data-sidebar="sidebar"
|
|
246
|
+
data-slot="sidebar-inner"
|
|
247
|
+
className="flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm"
|
|
248
|
+
>
|
|
249
|
+
{children}
|
|
250
|
+
</div>
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
)
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function SidebarTrigger({
|
|
257
|
+
className,
|
|
258
|
+
onClick,
|
|
259
|
+
...props
|
|
260
|
+
}: React.ComponentProps<typeof Button>) {
|
|
261
|
+
const { toggleSidebar } = useSidebar()
|
|
262
|
+
|
|
263
|
+
return (
|
|
264
|
+
<Button
|
|
265
|
+
data-sidebar="trigger"
|
|
266
|
+
data-slot="sidebar-trigger"
|
|
267
|
+
variant="ghost"
|
|
268
|
+
size="icon"
|
|
269
|
+
className={cn("size-7", className)}
|
|
270
|
+
onClick={(event) => {
|
|
271
|
+
onClick?.(event)
|
|
272
|
+
toggleSidebar()
|
|
273
|
+
}}
|
|
274
|
+
{...props}
|
|
275
|
+
>
|
|
276
|
+
<PanelLeftIcon />
|
|
277
|
+
<span className="sr-only">Toggle Sidebar</span>
|
|
278
|
+
</Button>
|
|
279
|
+
)
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {
|
|
283
|
+
const { toggleSidebar } = useSidebar()
|
|
284
|
+
|
|
285
|
+
return (
|
|
286
|
+
<button
|
|
287
|
+
data-sidebar="rail"
|
|
288
|
+
data-slot="sidebar-rail"
|
|
289
|
+
aria-label="Toggle Sidebar"
|
|
290
|
+
tabIndex={-1}
|
|
291
|
+
onClick={toggleSidebar}
|
|
292
|
+
title="Toggle Sidebar"
|
|
293
|
+
className={cn(
|
|
294
|
+
"absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-[translate,left,right,background-color] ease-out group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex",
|
|
295
|
+
"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
|
|
296
|
+
"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
|
|
297
|
+
"group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar",
|
|
298
|
+
"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
|
|
299
|
+
"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
|
|
300
|
+
className
|
|
301
|
+
)}
|
|
302
|
+
{...props}
|
|
303
|
+
/>
|
|
304
|
+
)
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {
|
|
308
|
+
return (
|
|
309
|
+
<main
|
|
310
|
+
data-slot="sidebar-inset"
|
|
311
|
+
className={cn(
|
|
312
|
+
"relative flex w-full flex-1 flex-col bg-background",
|
|
313
|
+
"md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",
|
|
314
|
+
className
|
|
315
|
+
)}
|
|
316
|
+
{...props}
|
|
317
|
+
/>
|
|
318
|
+
)
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function SidebarInput({
|
|
322
|
+
className,
|
|
323
|
+
...props
|
|
324
|
+
}: React.ComponentProps<typeof Input>) {
|
|
325
|
+
return (
|
|
326
|
+
<Input
|
|
327
|
+
data-slot="sidebar-input"
|
|
328
|
+
data-sidebar="input"
|
|
329
|
+
className={cn("h-8 w-full bg-background shadow-none", className)}
|
|
330
|
+
{...props}
|
|
331
|
+
/>
|
|
332
|
+
)
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function SidebarHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
336
|
+
return (
|
|
337
|
+
<div
|
|
338
|
+
data-slot="sidebar-header"
|
|
339
|
+
data-sidebar="header"
|
|
340
|
+
className={cn("flex flex-col gap-2 p-2", className)}
|
|
341
|
+
{...props}
|
|
342
|
+
/>
|
|
343
|
+
)
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function SidebarFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
347
|
+
return (
|
|
348
|
+
<div
|
|
349
|
+
data-slot="sidebar-footer"
|
|
350
|
+
data-sidebar="footer"
|
|
351
|
+
className={cn("flex flex-col gap-2 p-2", className)}
|
|
352
|
+
{...props}
|
|
353
|
+
/>
|
|
354
|
+
)
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function SidebarSeparator({
|
|
358
|
+
className,
|
|
359
|
+
...props
|
|
360
|
+
}: React.ComponentProps<typeof Separator>) {
|
|
361
|
+
return (
|
|
362
|
+
<Separator
|
|
363
|
+
data-slot="sidebar-separator"
|
|
364
|
+
data-sidebar="separator"
|
|
365
|
+
className={cn("mx-2 w-auto bg-sidebar-border", className)}
|
|
366
|
+
{...props}
|
|
367
|
+
/>
|
|
368
|
+
)
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function SidebarContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
372
|
+
return (
|
|
373
|
+
<div
|
|
374
|
+
data-slot="sidebar-content"
|
|
375
|
+
data-sidebar="content"
|
|
376
|
+
className={cn(
|
|
377
|
+
"flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
|
|
378
|
+
className
|
|
379
|
+
)}
|
|
380
|
+
{...props}
|
|
381
|
+
/>
|
|
382
|
+
)
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
function SidebarGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
386
|
+
return (
|
|
387
|
+
<div
|
|
388
|
+
data-slot="sidebar-group"
|
|
389
|
+
data-sidebar="group"
|
|
390
|
+
className={cn("relative flex w-full min-w-0 flex-col p-2", className)}
|
|
391
|
+
{...props}
|
|
392
|
+
/>
|
|
393
|
+
)
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function SidebarGroupLabel({
|
|
397
|
+
className,
|
|
398
|
+
asChild = false,
|
|
399
|
+
...props
|
|
400
|
+
}: React.ComponentProps<"div"> & { asChild?: boolean }) {
|
|
401
|
+
const Comp = asChild ? Slot.Root : "div"
|
|
402
|
+
|
|
403
|
+
return (
|
|
404
|
+
<Comp
|
|
405
|
+
data-slot="sidebar-group-label"
|
|
406
|
+
data-sidebar="group-label"
|
|
407
|
+
className={cn(
|
|
408
|
+
"flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-(--enter-duration) ease-out focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
409
|
+
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
|
|
410
|
+
className
|
|
411
|
+
)}
|
|
412
|
+
{...props}
|
|
413
|
+
/>
|
|
414
|
+
)
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
function SidebarGroupAction({
|
|
418
|
+
className,
|
|
419
|
+
asChild = false,
|
|
420
|
+
...props
|
|
421
|
+
}: React.ComponentProps<"button"> & { asChild?: boolean }) {
|
|
422
|
+
const Comp = asChild ? Slot.Root : "button"
|
|
423
|
+
|
|
424
|
+
return (
|
|
425
|
+
<Comp
|
|
426
|
+
data-slot="sidebar-group-action"
|
|
427
|
+
data-sidebar="group-action"
|
|
428
|
+
className={cn(
|
|
429
|
+
"absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
430
|
+
// Increases the hit area of the button on mobile.
|
|
431
|
+
"after:absolute after:-inset-2 md:after:hidden",
|
|
432
|
+
"group-data-[collapsible=icon]:hidden",
|
|
433
|
+
className
|
|
434
|
+
)}
|
|
435
|
+
{...props}
|
|
436
|
+
/>
|
|
437
|
+
)
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function SidebarGroupContent({
|
|
441
|
+
className,
|
|
442
|
+
...props
|
|
443
|
+
}: React.ComponentProps<"div">) {
|
|
444
|
+
return (
|
|
445
|
+
<div
|
|
446
|
+
data-slot="sidebar-group-content"
|
|
447
|
+
data-sidebar="group-content"
|
|
448
|
+
className={cn("w-full text-sm", className)}
|
|
449
|
+
{...props}
|
|
450
|
+
/>
|
|
451
|
+
)
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">) {
|
|
455
|
+
return (
|
|
456
|
+
<ul
|
|
457
|
+
data-slot="sidebar-menu"
|
|
458
|
+
data-sidebar="menu"
|
|
459
|
+
className={cn("flex w-full min-w-0 flex-col gap-1", className)}
|
|
460
|
+
{...props}
|
|
461
|
+
/>
|
|
462
|
+
)
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {
|
|
466
|
+
return (
|
|
467
|
+
<li
|
|
468
|
+
data-slot="sidebar-menu-item"
|
|
469
|
+
data-sidebar="menu-item"
|
|
470
|
+
className={cn("group/menu-item relative", className)}
|
|
471
|
+
{...props}
|
|
472
|
+
/>
|
|
473
|
+
)
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
const sidebarMenuButtonVariants = cva(
|
|
477
|
+
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
|
|
478
|
+
{
|
|
479
|
+
variants: {
|
|
480
|
+
variant: {
|
|
481
|
+
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
482
|
+
outline:
|
|
483
|
+
"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]",
|
|
484
|
+
},
|
|
485
|
+
size: {
|
|
486
|
+
default: "h-8 text-sm",
|
|
487
|
+
sm: "h-7 text-xs",
|
|
488
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!",
|
|
489
|
+
},
|
|
490
|
+
},
|
|
491
|
+
defaultVariants: {
|
|
492
|
+
variant: "default",
|
|
493
|
+
size: "default",
|
|
494
|
+
},
|
|
495
|
+
}
|
|
496
|
+
)
|
|
497
|
+
|
|
498
|
+
function SidebarMenuButton({
|
|
499
|
+
asChild = false,
|
|
500
|
+
isActive = false,
|
|
501
|
+
variant = "default",
|
|
502
|
+
size = "default",
|
|
503
|
+
tooltip,
|
|
504
|
+
className,
|
|
505
|
+
...props
|
|
506
|
+
}: React.ComponentProps<"button"> & {
|
|
507
|
+
asChild?: boolean
|
|
508
|
+
isActive?: boolean
|
|
509
|
+
tooltip?: string | React.ComponentProps<typeof TooltipContent>
|
|
510
|
+
} & VariantProps<typeof sidebarMenuButtonVariants>) {
|
|
511
|
+
const Comp = asChild ? Slot.Root : "button"
|
|
512
|
+
const { isMobile, state } = useSidebar()
|
|
513
|
+
|
|
514
|
+
const button = (
|
|
515
|
+
<Comp
|
|
516
|
+
data-slot="sidebar-menu-button"
|
|
517
|
+
data-sidebar="menu-button"
|
|
518
|
+
data-size={size}
|
|
519
|
+
data-active={isActive}
|
|
520
|
+
className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
|
|
521
|
+
{...props}
|
|
522
|
+
/>
|
|
523
|
+
)
|
|
524
|
+
|
|
525
|
+
if (!tooltip) {
|
|
526
|
+
return button
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
if (typeof tooltip === "string") {
|
|
530
|
+
tooltip = {
|
|
531
|
+
children: tooltip,
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
return (
|
|
536
|
+
<Tooltip>
|
|
537
|
+
<TooltipTrigger asChild>{button}</TooltipTrigger>
|
|
538
|
+
<TooltipContent
|
|
539
|
+
side="right"
|
|
540
|
+
align="center"
|
|
541
|
+
hidden={state !== "collapsed" || isMobile}
|
|
542
|
+
{...tooltip}
|
|
543
|
+
/>
|
|
544
|
+
</Tooltip>
|
|
545
|
+
)
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
function SidebarMenuAction({
|
|
549
|
+
className,
|
|
550
|
+
asChild = false,
|
|
551
|
+
showOnHover = false,
|
|
552
|
+
...props
|
|
553
|
+
}: React.ComponentProps<"button"> & {
|
|
554
|
+
asChild?: boolean
|
|
555
|
+
showOnHover?: boolean
|
|
556
|
+
}) {
|
|
557
|
+
const Comp = asChild ? Slot.Root : "button"
|
|
558
|
+
|
|
559
|
+
return (
|
|
560
|
+
<Comp
|
|
561
|
+
data-slot="sidebar-menu-action"
|
|
562
|
+
data-sidebar="menu-action"
|
|
563
|
+
className={cn(
|
|
564
|
+
"absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
565
|
+
// Increases the hit area of the button on mobile.
|
|
566
|
+
"after:absolute after:-inset-2 md:after:hidden",
|
|
567
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
568
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
569
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
570
|
+
"group-data-[collapsible=icon]:hidden",
|
|
571
|
+
showOnHover &&
|
|
572
|
+
"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground data-[state=open]:opacity-100 md:opacity-0",
|
|
573
|
+
className
|
|
574
|
+
)}
|
|
575
|
+
{...props}
|
|
576
|
+
/>
|
|
577
|
+
)
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
function SidebarMenuBadge({
|
|
581
|
+
className,
|
|
582
|
+
...props
|
|
583
|
+
}: React.ComponentProps<"div">) {
|
|
584
|
+
return (
|
|
585
|
+
<div
|
|
586
|
+
data-slot="sidebar-menu-badge"
|
|
587
|
+
data-sidebar="menu-badge"
|
|
588
|
+
className={cn(
|
|
589
|
+
"pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none",
|
|
590
|
+
"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
|
|
591
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
592
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
593
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
594
|
+
"group-data-[collapsible=icon]:hidden",
|
|
595
|
+
className
|
|
596
|
+
)}
|
|
597
|
+
{...props}
|
|
598
|
+
/>
|
|
599
|
+
)
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function SidebarMenuSkeleton({
|
|
603
|
+
className,
|
|
604
|
+
showIcon = false,
|
|
605
|
+
...props
|
|
606
|
+
}: React.ComponentProps<"div"> & {
|
|
607
|
+
showIcon?: boolean
|
|
608
|
+
}) {
|
|
609
|
+
// Random width between 50 to 90%.
|
|
610
|
+
const width = React.useMemo(() => {
|
|
611
|
+
return `${Math.floor(Math.random() * 40) + 50}%`
|
|
612
|
+
}, [])
|
|
613
|
+
|
|
614
|
+
return (
|
|
615
|
+
<div
|
|
616
|
+
data-slot="sidebar-menu-skeleton"
|
|
617
|
+
data-sidebar="menu-skeleton"
|
|
618
|
+
className={cn("flex h-8 items-center gap-2 rounded-md px-2", className)}
|
|
619
|
+
{...props}
|
|
620
|
+
>
|
|
621
|
+
{showIcon && (
|
|
622
|
+
<Skeleton
|
|
623
|
+
className="size-4 rounded-md"
|
|
624
|
+
data-sidebar="menu-skeleton-icon"
|
|
625
|
+
/>
|
|
626
|
+
)}
|
|
627
|
+
<Skeleton
|
|
628
|
+
className="h-4 max-w-(--skeleton-width) flex-1"
|
|
629
|
+
data-sidebar="menu-skeleton-text"
|
|
630
|
+
style={
|
|
631
|
+
{
|
|
632
|
+
"--skeleton-width": width,
|
|
633
|
+
} as React.CSSProperties
|
|
634
|
+
}
|
|
635
|
+
/>
|
|
636
|
+
</div>
|
|
637
|
+
)
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">) {
|
|
641
|
+
return (
|
|
642
|
+
<ul
|
|
643
|
+
data-slot="sidebar-menu-sub"
|
|
644
|
+
data-sidebar="menu-sub"
|
|
645
|
+
className={cn(
|
|
646
|
+
"mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5",
|
|
647
|
+
"group-data-[collapsible=icon]:hidden",
|
|
648
|
+
className
|
|
649
|
+
)}
|
|
650
|
+
{...props}
|
|
651
|
+
/>
|
|
652
|
+
)
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
function SidebarMenuSubItem({
|
|
656
|
+
className,
|
|
657
|
+
...props
|
|
658
|
+
}: React.ComponentProps<"li">) {
|
|
659
|
+
return (
|
|
660
|
+
<li
|
|
661
|
+
data-slot="sidebar-menu-sub-item"
|
|
662
|
+
data-sidebar="menu-sub-item"
|
|
663
|
+
className={cn("group/menu-sub-item relative", className)}
|
|
664
|
+
{...props}
|
|
665
|
+
/>
|
|
666
|
+
)
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
function SidebarMenuSubButton({
|
|
670
|
+
asChild = false,
|
|
671
|
+
size = "md",
|
|
672
|
+
isActive = false,
|
|
673
|
+
className,
|
|
674
|
+
...props
|
|
675
|
+
}: React.ComponentProps<"a"> & {
|
|
676
|
+
asChild?: boolean
|
|
677
|
+
size?: "sm" | "md"
|
|
678
|
+
isActive?: boolean
|
|
679
|
+
}) {
|
|
680
|
+
const Comp = asChild ? Slot.Root : "a"
|
|
681
|
+
|
|
682
|
+
return (
|
|
683
|
+
<Comp
|
|
684
|
+
data-slot="sidebar-menu-sub-button"
|
|
685
|
+
data-sidebar="menu-sub-button"
|
|
686
|
+
data-size={size}
|
|
687
|
+
data-active={isActive}
|
|
688
|
+
className={cn(
|
|
689
|
+
"flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",
|
|
690
|
+
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
|
691
|
+
size === "sm" && "text-xs",
|
|
692
|
+
size === "md" && "text-sm",
|
|
693
|
+
"group-data-[collapsible=icon]:hidden",
|
|
694
|
+
className
|
|
695
|
+
)}
|
|
696
|
+
{...props}
|
|
697
|
+
/>
|
|
698
|
+
)
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
export {
|
|
702
|
+
Sidebar,
|
|
703
|
+
SidebarContent,
|
|
704
|
+
SidebarFooter,
|
|
705
|
+
SidebarGroup,
|
|
706
|
+
SidebarGroupAction,
|
|
707
|
+
SidebarGroupContent,
|
|
708
|
+
SidebarGroupLabel,
|
|
709
|
+
SidebarHeader,
|
|
710
|
+
SidebarInput,
|
|
711
|
+
SidebarInset,
|
|
712
|
+
SidebarMenu,
|
|
713
|
+
SidebarMenuAction,
|
|
714
|
+
SidebarMenuBadge,
|
|
715
|
+
SidebarMenuButton,
|
|
716
|
+
SidebarMenuItem,
|
|
717
|
+
SidebarMenuSkeleton,
|
|
718
|
+
SidebarMenuSub,
|
|
719
|
+
SidebarMenuSubButton,
|
|
720
|
+
SidebarMenuSubItem,
|
|
721
|
+
SidebarProvider,
|
|
722
|
+
SidebarRail,
|
|
723
|
+
SidebarSeparator,
|
|
724
|
+
SidebarTrigger,
|
|
725
|
+
useSidebar,
|
|
726
|
+
}
|