@uibot/cli 0.19.0 → 0.20.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/README.md +42 -0
- package/dist/app-host-template.json +1 -0
- package/dist/app-scaffold.d.ts +15 -0
- package/dist/cli.js +202 -137
- package/dist/commands/agent-skills.d.ts +1 -0
- package/dist/commands/logo.d.ts +1 -0
- package/dist/index.js +467 -50
- package/dist/resources/agent-kit/manifest.json +245 -0
- package/dist/resources/agent-kit/prompt-admin/en.md +17 -0
- package/dist/resources/agent-kit/prompt-admin/zh.md +17 -0
- package/dist/resources/agent-kit/prompt-auth/en.md +17 -0
- package/dist/resources/agent-kit/prompt-auth/zh.md +17 -0
- package/dist/resources/agent-kit/prompt-chat/en.md +17 -0
- package/dist/resources/agent-kit/prompt-chat/zh.md +17 -0
- package/dist/resources/agent-kit/prompt-data/en.md +17 -0
- package/dist/resources/agent-kit/prompt-data/zh.md +17 -0
- package/dist/resources/agent-kit/prompt-documents/en.md +17 -0
- package/dist/resources/agent-kit/prompt-documents/zh.md +17 -0
- package/dist/resources/agent-kit/prompt-industry/en.md +17 -0
- package/dist/resources/agent-kit/prompt-industry/zh.md +17 -0
- package/dist/resources/agent-kit/recipe-admin-workbench/en.md +31 -0
- package/dist/resources/agent-kit/recipe-admin-workbench/zh.md +31 -0
- package/dist/resources/agent-kit/recipe-auth-flow/en.md +56 -0
- package/dist/resources/agent-kit/recipe-auth-flow/zh.md +56 -0
- package/dist/resources/agent-kit/recipe-knowledge-desk/en.md +20 -0
- package/dist/resources/agent-kit/recipe-knowledge-desk/zh.md +20 -0
- package/dist/resources/agent-kit/uibot-data-workbench/en.md +28 -0
- package/dist/resources/agent-kit/uibot-data-workbench/zh.md +28 -0
- package/dist/resources/agent-kit/uibot-knowledge-interface/en.md +26 -0
- package/dist/resources/agent-kit/uibot-knowledge-interface/zh.md +26 -0
- package/dist/resources/agent-kit/uibot-logo/en.md +20 -0
- package/dist/resources/agent-kit/uibot-logo/zh.md +20 -0
- package/dist/resources/agent-kit/uibot-resources/en.md +40 -0
- package/dist/resources/agent-kit/uibot-resources/zh.md +40 -0
- package/dist/resources/bundle.json +1 -1
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-shell.json +173 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/charts.json +238 -0
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/chat-workspace.json +1 -1
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/collection-shared.json +1 -1
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/commerce-workspace.json +1 -1
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/console-page.json +1 -1
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/console-shell.json +1 -1
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/creation-shared.json +2 -2
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/crm-workspace.json +1 -1
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/dashboard-01.json +78 -0
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/dashboard.json +113 -3
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/data-table.json +352 -0
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/data.json +9 -2
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/document-assistant.json +1 -1
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/document-workspace.json +1 -1
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/drilldown-menu.json +1 -1
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/education-workspace.json +1 -1
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/feedback.json +15 -2
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/form.json +1 -1
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/layout.json +27 -8
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/nav.json +285 -0
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/shadcn-admin.json +1 -1
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sidebar-primitives.json +1 -1
- package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/workspace.json +9 -2
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/snapshot.json +1 -0
- package/dist/templates/shadcn-admin.yaml +21 -21
- package/package.json +11 -8
- package/dist/snapshots/b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545/r/admin-shell.json +0 -160
- package/dist/snapshots/b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545/r/charts.json +0 -211
- package/dist/snapshots/b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545/r/data-table.json +0 -242
- package/dist/snapshots/b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545/r/nav.json +0 -257
- package/dist/snapshots/b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545/snapshot.json +0 -1
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/licenses/UIBot-LICENSE +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/licenses/blocks-icons-LICENSE +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/licenses/shadcn-THIRD_PARTY_LICENSE +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-apps.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-chats.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-dashboard.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-error-401.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-error-403.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-error-404.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-error-500.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-error-503.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-forgot-password.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-help.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-otp.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-overview.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-settings-account.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-settings-appearance.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-settings-display.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-settings-notifications.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-settings-profile.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-settings.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-sign-in-2.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-sign-in.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-sign-up.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-tasks.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/admin-users.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/ai-chat.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/analytics-dashboard.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/app-shell-floating.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/app-shell-icon-rail.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/app-shell-inset.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/app-shell-settings.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/app-shell-sidebar.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/app-shell-workspace.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/auth-centered.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/auth-enterprise.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/auth-recovery.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/auth-registration.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/auth-split.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/auth.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/blog.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/chat-artifact.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/chat-focused.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/chat-history.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/chat-knowledge.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/chat-support.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/console-billing.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/content.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/crm.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/data-studio.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/document-library.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/document-reading.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/document-writing.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/ecommerce.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/field.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/grid.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/interactive.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/item-grid.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/kanban.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/lms.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/marketing.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/portfolio.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/presentation.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/pricing.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/primitives.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/saas-landing.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sections.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/settings.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/shadcn-admin-shell.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sidebar-01.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sidebar-02.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sidebar-03.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sidebar-04.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sidebar-05.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sidebar-06.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sidebar-07.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sidebar-08.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sidebar-09.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sidebar-10.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sidebar-11.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sidebar-12.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sidebar-13.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sidebar-14.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sidebar-15.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sidebar-16.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/sidebar-drilldown.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/store.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/support-inbox.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/team-directory.json +0 -0
- /package/dist/snapshots/{b21e710e6bf4850f18adb9af1b9d48aa59852516ad54fa63926aed9b07943545 → 4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f}/r/uibot-base.json +0 -0
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
"type": "registry:ui",
|
|
5
5
|
"description": "Unordered list of child blocks. Use with divided or compact for different visual densities.",
|
|
6
6
|
"dependencies": [
|
|
7
|
-
"react@19.3.0"
|
|
7
|
+
"react@19.3.0",
|
|
8
|
+
"radix-ui@1.4.3"
|
|
8
9
|
],
|
|
9
10
|
"registryDependencies": [
|
|
10
11
|
"@uibot/uibot-base"
|
|
@@ -13,7 +14,13 @@
|
|
|
13
14
|
{
|
|
14
15
|
"path": "components/uibot/data.tsx",
|
|
15
16
|
"target": "components/uibot/data.tsx",
|
|
16
|
-
"content": "import type { CSSProperties, ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport type { RendererComponent } from \"@/lib/uibot-renderer\";\n\n/** Repeated list of items */\nexport const List: RendererComponent = (props, ctx) => {\n const divided = props[\"divided\"] === true;\n const compact = props[\"compact\"] === true;\n\n return (\n <ul\n className={cn(\n \"uibot-list\",\n divided ? \"divide-y divide-border\" : compact ? \"space-y-1\" : \"space-y-2\",\n )}\n data-uibot-type=\"List\"\n aria-label={typeof props[\"label\"] === \"string\" ? props[\"label\"] : undefined}\n >\n {ctx.children as ReactNode[]}\n </ul>\n );\n};\n\n/** Data table with columns and rows */\nexport const Table: RendererComponent = (props) => {\n const columns = Array.isArray(props[\"columns\"])\n ? (props[\"columns\"] as Array<{ key: string; label: string; align?: string }>)\n : [];\n const rows = Array.isArray(props[\"rows\"])\n ? (props[\"rows\"] as Array<Record<string, unknown>>)\n : [];\n const striped = props[\"striped\"] !== false;\n const caption = typeof props[\"caption\"] === \"string\" ? props[\"caption\"] : null;\n\n return (\n <div className=\"uibot-table w-full overflow-auto rounded-lg border\" data-uibot-type=\"Table\">\n <table className=\"w-full text-sm\">\n {caption && (\n <caption className=\"mb-1 py-2 text-sm text-muted-foreground\">{caption}</caption>\n )}\n <thead>\n <tr className=\"border-b bg-muted/50\">\n {columns.map((col) => (\n <th\n key={col.key}\n scope=\"col\"\n className={cn(\n \"px-4 py-3 text-xs font-medium uppercase tracking-wide text-muted-foreground\",\n col.align === \"right\"\n ? \"text-right\"\n : col.align === \"center\"\n ? \"text-center\"\n : \"text-left\",\n )}\n >\n {col.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, i) => (\n <tr\n key={i}\n className={cn(\n \"border-b transition-colors last:border-0 hover:bg-muted/30\",\n striped && i % 2 === 1 ? \"bg-muted/10\" : \"\",\n )}\n >\n {columns.map((col) => (\n <td\n key={col.key}\n className={cn(\n \"px-4 py-3 text-foreground\",\n col.align === \"right\"\n ? \"text-right\"\n : col.align === \"center\"\n ? \"text-center\"\n : \"\",\n )}\n >\n {String(row[col.key] ?? \"\")}\n </td>\n ))}\n </tr>\n ))}\n {rows.length === 0 && (\n <tr>\n <td\n colSpan={columns.length || 1}\n className=\"px-4 py-10 text-center text-sm text-muted-foreground\"\n >\n {typeof props[\"emptyText\"] === \"string\" ? props[\"emptyText\"] : \"No data\"}\n </td>\n </tr>\n )}\n </tbody>\n </table>\n </div>\n );\n};\n\nconst TREND_UP = (\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"2 10 7 4 12 10\" />\n </svg>\n);\nconst TREND_DOWN = (\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"2 4 7 10 12 4\" />\n </svg>\n);\n\n/** Single statistic display (number + label) */\nexport const Stat: RendererComponent = (props) => {\n const trend = props[\"trend\"] as \"up\" | \"down\" | undefined;\n const change =\n typeof props[\"change\"] === \"string\" || typeof props[\"change\"] === \"number\"\n ? String(props[\"change\"])\n : null;\n\n return (\n <div\n className=\"uibot-stat bg-card text-card-foreground rounded-xl border p-5 shadow-sm\"\n data-uibot-type=\"Stat\"\n >\n <p className=\"text-sm font-medium text-muted-foreground\">\n {typeof props[\"label\"] === \"string\" ? props[\"label\"] : \"Stat\"}\n </p>\n <p className=\"mt-1.5 text-3xl font-bold tracking-tight\">\n {props[\"value\"] !== undefined ? String(props[\"value\"]) : \"—\"}\n </p>\n {(change !== null || typeof props[\"description\"] === \"string\") && (\n <div className=\"mt-1.5 flex items-center gap-1.5\">\n {trend && (\n <span\n className={cn(\n \"flex items-center\",\n trend === \"up\" ? \"text-green-600\" : \"text-destructive\",\n )}\n >\n {trend === \"up\" ? TREND_UP : TREND_DOWN}\n </span>\n )}\n {change !== null && (\n <span\n className={cn(\n \"text-xs font-medium\",\n trend === \"up\"\n ? \"text-green-600\"\n : trend === \"down\"\n ? \"text-destructive\"\n : \"text-muted-foreground\",\n )}\n >\n {change}\n </span>\n )}\n {typeof props[\"description\"] === \"string\" && (\n <span className=\"text-xs text-muted-foreground\">{props[\"description\"]}</span>\n )}\n </div>\n )}\n </div>\n );\n};\n\n/** Simple inline Markdown renderer */\nfunction renderMarkdown(text: string): ReactNode[] {\n const lines = text.split(\"\\n\");\n const nodes: ReactNode[] = [];\n let listItems: ReactNode[] = [];\n\n const flushList = () => {\n if (listItems.length > 0) {\n nodes.push(\n <ul key={`ul-${nodes.length}`} className=\"my-2 ml-4 list-disc space-y-1 text-sm\">\n {listItems}\n </ul>,\n );\n listItems = [];\n }\n };\n\n const inlineFormat = (raw: string, key: string): ReactNode => {\n // Very small inline parser: **bold**, *italic*, `code`\n const parts = raw.split(/(\\*\\*[^*]+\\*\\*|\\*[^*]+\\*|`[^`]+`)/g);\n if (parts.length === 1) return raw;\n return (\n <span key={key}>\n {parts.map((p, i) => {\n if (p.startsWith(\"**\") && p.endsWith(\"**\"))\n return (\n <strong key={i} className=\"font-semibold\">\n {p.slice(2, -2)}\n </strong>\n );\n if (p.startsWith(\"*\") && p.endsWith(\"*\")) return <em key={i}>{p.slice(1, -1)}</em>;\n if (p.startsWith(\"`\") && p.endsWith(\"`\"))\n return (\n <code key={i} className=\"rounded bg-muted px-1 py-0.5 font-mono text-[0.8em]\">\n {p.slice(1, -1)}\n </code>\n );\n return p;\n })}\n </span>\n );\n };\n\n lines.forEach((line, i) => {\n const hm = /^(#{1,6})\\s+(.+)$/.exec(line);\n if (hm) {\n flushList();\n const level = hm[1]!.length;\n const sizeMap = [\"text-2xl\", \"text-xl\", \"text-lg\", \"text-base\", \"text-sm\", \"text-xs\"];\n const cls = cn(\"font-semibold leading-tight my-2\", sizeMap[level - 1] ?? \"text-base\");\n const Tag = `h${level}` as \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n nodes.push(\n <Tag key={i} className={cls}>\n {inlineFormat(hm[2]!, `h-${i}`)}\n </Tag>,\n );\n return;\n }\n\n const lm = /^[-*]\\s+(.+)$/.exec(line);\n if (lm) {\n listItems.push(<li key={i}>{inlineFormat(lm[1]!, `li-${i}`)}</li>);\n return;\n }\n\n flushList();\n if (line.trim() === \"\") {\n nodes.push(<br key={i} />);\n } else {\n nodes.push(\n <p key={i} className=\"my-1 text-sm leading-relaxed\">\n {inlineFormat(line, `p-${i}`)}\n </p>,\n );\n }\n });\n\n flushList();\n return nodes;\n}\n\n/** Markdown text content renderer */\nexport const Markdown: RendererComponent = (props) => {\n const content = typeof props[\"content\"] === \"string\" ? props[\"content\"] : \"\";\n return (\n <div className=\"uibot-markdown text-foreground\" data-uibot-type=\"Markdown\">\n {renderMarkdown(content)}\n </div>\n );\n};\n\nconst HEADING_SIZE: Record<number, string> = {\n 1: \"text-4xl\",\n 2: \"text-3xl\",\n 3: \"text-2xl\",\n 4: \"text-xl\",\n 5: \"text-lg\",\n 6: \"text-base\",\n};\n\nfunction fontRoleStyle(value: unknown) {\n return value === \"display\" || value === \"body\" || value === \"mono\"\n ? { fontFamily: `var(--font-${value}, inherit)` }\n : undefined;\n}\n\nconst HEADING_VISUAL_SIZE: Record<string, string> = {\n xs: \"1rem\",\n sm: \"1.25rem\",\n md: \"1.5rem\",\n lg: \"2rem\",\n xl: \"2.5rem\",\n display: \"clamp(2.25rem, calc(1.25rem + 4vw), 4.5rem)\",\n};\n\n/** Declared typography works without the host compiling generated utility classes. */\nfunction typographyStyle(props: Record<string, unknown>, heading = false): CSSProperties {\n const style: CSSProperties = { ...fontRoleStyle(props.font) };\n const size = typeof props.size === \"string\" ? props.size : \"\";\n const headingSize = Object.hasOwn(HEADING_VISUAL_SIZE, size)\n ? HEADING_VISUAL_SIZE[size]\n : undefined;\n if (heading && headingSize) {\n style.fontSize = headingSize;\n style.lineHeight = size === \"display\" ? 1.1 : 1.25;\n style.overflowWrap = \"anywhere\";\n } else if (!heading && size === \"lead\") {\n style.fontSize = \"clamp(1.125rem, calc(1rem + 0.5vw), 1.375rem)\";\n style.lineHeight = 1.6;\n style.overflowWrap = \"anywhere\";\n }\n const widths = heading\n ? { narrow: \"16ch\", normal: \"24ch\", wide: \"36ch\" }\n : { narrow: \"45ch\", normal: \"65ch\", wide: \"80ch\" };\n const measure = props.measure;\n if (measure === \"narrow\" || measure === \"normal\" || measure === \"wide\") {\n style.maxInlineSize = widths[measure];\n style.overflowWrap = \"anywhere\";\n }\n const align = props.align;\n if (align === \"start\" || align === \"center\" || align === \"end\") style.textAlign = align;\n return style;\n}\n\n/** Section heading (h1–h6) */\nexport const Heading: RendererComponent = (props) => {\n const lvl = typeof props[\"level\"] === \"number\" ? Math.min(6, Math.max(1, props[\"level\"])) : 2;\n const size = HEADING_SIZE[lvl] ?? \"text-3xl\";\n const weight = lvl <= 2 ? \"font-bold\" : \"font-semibold\";\n const text = typeof props[\"text\"] === \"string\" ? props[\"text\"] : \"\";\n const muted = props[\"muted\"] === true ? \"text-muted-foreground\" : \"text-foreground\";\n const cls = cn(\n \"uibot-heading tracking-tight leading-tight\",\n size,\n weight,\n muted,\n typeof props.className === \"string\" ? props.className : \"\",\n );\n const Tag = `h${lvl}` as \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n return (\n <Tag className={cls} style={typographyStyle(props, true)} data-uibot-type=\"Heading\">\n {text}\n </Tag>\n );\n};\n\n/** Body paragraph text */\nexport const Paragraph: RendererComponent = (props) => (\n <p\n style={typographyStyle(props)}\n className={cn(\n \"uibot-paragraph leading-relaxed\",\n props[\"size\"] === \"sm\" ? \"text-sm\" : props[\"size\"] === \"lg\" ? \"text-lg\" : \"text-sm\",\n props[\"muted\"] === true ? \"text-muted-foreground\" : \"text-foreground\",\n typeof props.className === \"string\" ? props.className : \"\",\n )}\n data-uibot-type=\"Paragraph\"\n >\n {typeof props[\"text\"] === \"string\" ? props[\"text\"] : \"\"}\n </p>\n);\n",
|
|
17
|
+
"content": "import type { CSSProperties, ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport type { RendererComponent } from \"@/lib/uibot-renderer\";\nimport { ScrollArea } from \"./scroll-area\";\n\n/** Repeated list of items */\nexport const List: RendererComponent = (props, ctx) => {\n const divided = props[\"divided\"] === true;\n const compact = props[\"compact\"] === true;\n\n return (\n <ul\n className={cn(\n \"uibot-list\",\n divided ? \"divide-y divide-border\" : compact ? \"space-y-1\" : \"space-y-2\",\n )}\n data-uibot-type=\"List\"\n aria-label={typeof props[\"label\"] === \"string\" ? props[\"label\"] : undefined}\n >\n {ctx.children as ReactNode[]}\n </ul>\n );\n};\n\n/** Data table with columns and rows */\nexport const Table: RendererComponent = (props) => {\n const columns = Array.isArray(props[\"columns\"])\n ? (props[\"columns\"] as Array<{ key: string; label: string; align?: string }>)\n : [];\n const rows = Array.isArray(props[\"rows\"])\n ? (props[\"rows\"] as Array<Record<string, unknown>>)\n : [];\n const striped = props[\"striped\"] !== false;\n const caption = typeof props[\"caption\"] === \"string\" ? props[\"caption\"] : null;\n\n return (\n <ScrollArea\n className=\"uibot-table w-full rounded-lg border\"\n data-uibot-type=\"Table\"\n scrollbars=\"horizontal\"\n viewportProps={{ \"aria-label\": caption ?? \"Table\" }}\n >\n <table className=\"w-full text-sm\">\n {caption && (\n <caption className=\"mb-1 py-2 text-sm text-muted-foreground\">{caption}</caption>\n )}\n <thead>\n <tr className=\"border-b bg-muted/50\">\n {columns.map((col) => (\n <th\n key={col.key}\n scope=\"col\"\n className={cn(\n \"px-4 py-3 text-xs font-medium uppercase tracking-wide text-muted-foreground\",\n col.align === \"right\"\n ? \"text-right\"\n : col.align === \"center\"\n ? \"text-center\"\n : \"text-left\",\n )}\n >\n {col.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, i) => (\n <tr\n key={i}\n className={cn(\n \"border-b transition-colors last:border-0 hover:bg-muted/30\",\n striped && i % 2 === 1 ? \"bg-muted/10\" : \"\",\n )}\n >\n {columns.map((col) => (\n <td\n key={col.key}\n className={cn(\n \"px-4 py-3 text-foreground\",\n col.align === \"right\"\n ? \"text-right\"\n : col.align === \"center\"\n ? \"text-center\"\n : \"\",\n )}\n >\n {String(row[col.key] ?? \"\")}\n </td>\n ))}\n </tr>\n ))}\n {rows.length === 0 && (\n <tr>\n <td\n colSpan={columns.length || 1}\n className=\"px-4 py-10 text-center text-sm text-muted-foreground\"\n >\n {typeof props[\"emptyText\"] === \"string\" ? props[\"emptyText\"] : \"No data\"}\n </td>\n </tr>\n )}\n </tbody>\n </table>\n </ScrollArea>\n );\n};\n\nconst TREND_UP = (\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"2 10 7 4 12 10\" />\n </svg>\n);\nconst TREND_DOWN = (\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"2 4 7 10 12 4\" />\n </svg>\n);\n\n/** Single statistic display (number + label) */\nexport const Stat: RendererComponent = (props) => {\n const trend = props[\"trend\"] as \"up\" | \"down\" | undefined;\n const change =\n typeof props[\"change\"] === \"string\" || typeof props[\"change\"] === \"number\"\n ? String(props[\"change\"])\n : null;\n\n return (\n <div\n className=\"uibot-stat bg-card text-card-foreground rounded-xl border p-5 shadow-sm\"\n data-uibot-type=\"Stat\"\n >\n <p className=\"text-sm font-medium text-muted-foreground\">\n {typeof props[\"label\"] === \"string\" ? props[\"label\"] : \"Stat\"}\n </p>\n <p className=\"mt-1.5 text-3xl font-bold tracking-tight\">\n {props[\"value\"] !== undefined ? String(props[\"value\"]) : \"—\"}\n </p>\n {(change !== null || typeof props[\"description\"] === \"string\") && (\n <div className=\"mt-1.5 flex items-center gap-1.5\">\n {trend && (\n <span\n className={cn(\n \"flex items-center\",\n trend === \"up\" ? \"text-green-600\" : \"text-destructive\",\n )}\n >\n {trend === \"up\" ? TREND_UP : TREND_DOWN}\n </span>\n )}\n {change !== null && (\n <span\n className={cn(\n \"text-xs font-medium\",\n trend === \"up\"\n ? \"text-green-600\"\n : trend === \"down\"\n ? \"text-destructive\"\n : \"text-muted-foreground\",\n )}\n >\n {change}\n </span>\n )}\n {typeof props[\"description\"] === \"string\" && (\n <span className=\"text-xs text-muted-foreground\">{props[\"description\"]}</span>\n )}\n </div>\n )}\n </div>\n );\n};\n\n/** Simple inline Markdown renderer */\nfunction renderMarkdown(text: string): ReactNode[] {\n const lines = text.split(\"\\n\");\n const nodes: ReactNode[] = [];\n let listItems: ReactNode[] = [];\n\n const flushList = () => {\n if (listItems.length > 0) {\n nodes.push(\n <ul key={`ul-${nodes.length}`} className=\"my-2 ml-4 list-disc space-y-1 text-sm\">\n {listItems}\n </ul>,\n );\n listItems = [];\n }\n };\n\n const inlineFormat = (raw: string, key: string): ReactNode => {\n // Very small inline parser: **bold**, *italic*, `code`\n const parts = raw.split(/(\\*\\*[^*]+\\*\\*|\\*[^*]+\\*|`[^`]+`)/g);\n if (parts.length === 1) return raw;\n return (\n <span key={key}>\n {parts.map((p, i) => {\n if (p.startsWith(\"**\") && p.endsWith(\"**\"))\n return (\n <strong key={i} className=\"font-semibold\">\n {p.slice(2, -2)}\n </strong>\n );\n if (p.startsWith(\"*\") && p.endsWith(\"*\")) return <em key={i}>{p.slice(1, -1)}</em>;\n if (p.startsWith(\"`\") && p.endsWith(\"`\"))\n return (\n <code key={i} className=\"rounded bg-muted px-1 py-0.5 font-mono text-[0.8em]\">\n {p.slice(1, -1)}\n </code>\n );\n return p;\n })}\n </span>\n );\n };\n\n lines.forEach((line, i) => {\n const hm = /^(#{1,6})\\s+(.+)$/.exec(line);\n if (hm) {\n flushList();\n const level = hm[1]!.length;\n const sizeMap = [\"text-2xl\", \"text-xl\", \"text-lg\", \"text-base\", \"text-sm\", \"text-xs\"];\n const cls = cn(\"font-semibold leading-tight my-2\", sizeMap[level - 1] ?? \"text-base\");\n const Tag = `h${level}` as \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n nodes.push(\n <Tag key={i} className={cls}>\n {inlineFormat(hm[2]!, `h-${i}`)}\n </Tag>,\n );\n return;\n }\n\n const lm = /^[-*]\\s+(.+)$/.exec(line);\n if (lm) {\n listItems.push(<li key={i}>{inlineFormat(lm[1]!, `li-${i}`)}</li>);\n return;\n }\n\n flushList();\n if (line.trim() === \"\") {\n nodes.push(<br key={i} />);\n } else {\n nodes.push(\n <p key={i} className=\"my-1 text-sm leading-relaxed\">\n {inlineFormat(line, `p-${i}`)}\n </p>,\n );\n }\n });\n\n flushList();\n return nodes;\n}\n\n/** Markdown text content renderer */\nexport const Markdown: RendererComponent = (props) => {\n const content = typeof props[\"content\"] === \"string\" ? props[\"content\"] : \"\";\n return (\n <div className=\"uibot-markdown text-foreground\" data-uibot-type=\"Markdown\">\n {renderMarkdown(content)}\n </div>\n );\n};\n\nconst HEADING_SIZE: Record<number, string> = {\n 1: \"text-4xl\",\n 2: \"text-3xl\",\n 3: \"text-2xl\",\n 4: \"text-xl\",\n 5: \"text-lg\",\n 6: \"text-base\",\n};\n\nfunction fontRoleStyle(value: unknown) {\n return value === \"display\" || value === \"body\" || value === \"mono\"\n ? { fontFamily: `var(--font-${value}, inherit)` }\n : undefined;\n}\n\nconst HEADING_VISUAL_SIZE: Record<string, string> = {\n xs: \"1rem\",\n sm: \"1.25rem\",\n md: \"1.5rem\",\n lg: \"2rem\",\n xl: \"2.5rem\",\n display: \"clamp(2.25rem, calc(1.25rem + 4vw), 4.5rem)\",\n};\n\n/** Declared typography works without the host compiling generated utility classes. */\nfunction typographyStyle(props: Record<string, unknown>, heading = false): CSSProperties {\n const style: CSSProperties = { ...fontRoleStyle(props.font) };\n const size = typeof props.size === \"string\" ? props.size : \"\";\n const headingSize = Object.hasOwn(HEADING_VISUAL_SIZE, size)\n ? HEADING_VISUAL_SIZE[size]\n : undefined;\n if (heading && headingSize) {\n style.fontSize = headingSize;\n style.lineHeight = size === \"display\" ? 1.1 : 1.25;\n style.overflowWrap = \"anywhere\";\n } else if (!heading && size === \"lead\") {\n style.fontSize = \"clamp(1.125rem, calc(1rem + 0.5vw), 1.375rem)\";\n style.lineHeight = 1.6;\n style.overflowWrap = \"anywhere\";\n }\n const widths = heading\n ? { narrow: \"16ch\", normal: \"24ch\", wide: \"36ch\" }\n : { narrow: \"45ch\", normal: \"65ch\", wide: \"80ch\" };\n const measure = props.measure;\n if (measure === \"narrow\" || measure === \"normal\" || measure === \"wide\") {\n style.maxInlineSize = widths[measure];\n style.overflowWrap = \"anywhere\";\n }\n const align = props.align;\n if (align === \"start\" || align === \"center\" || align === \"end\") style.textAlign = align;\n return style;\n}\n\n/** Section heading (h1–h6) */\nexport const Heading: RendererComponent = (props) => {\n const lvl = typeof props[\"level\"] === \"number\" ? Math.min(6, Math.max(1, props[\"level\"])) : 2;\n const size = HEADING_SIZE[lvl] ?? \"text-3xl\";\n const weight = lvl <= 2 ? \"font-bold\" : \"font-semibold\";\n const text = typeof props[\"text\"] === \"string\" ? props[\"text\"] : \"\";\n const muted = props[\"muted\"] === true ? \"text-muted-foreground\" : \"text-foreground\";\n const cls = cn(\n \"uibot-heading tracking-tight leading-tight\",\n size,\n weight,\n muted,\n typeof props.className === \"string\" ? props.className : \"\",\n );\n const Tag = `h${lvl}` as \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n return (\n <Tag className={cls} style={typographyStyle(props, true)} data-uibot-type=\"Heading\">\n {text}\n </Tag>\n );\n};\n\n/** Body paragraph text */\nexport const Paragraph: RendererComponent = (props) => (\n <p\n style={typographyStyle(props)}\n className={cn(\n \"uibot-paragraph leading-relaxed\",\n props[\"size\"] === \"sm\" ? \"text-sm\" : props[\"size\"] === \"lg\" ? \"text-lg\" : \"text-sm\",\n props[\"muted\"] === true ? \"text-muted-foreground\" : \"text-foreground\",\n typeof props.className === \"string\" ? props.className : \"\",\n )}\n data-uibot-type=\"Paragraph\"\n >\n {typeof props[\"text\"] === \"string\" ? props[\"text\"] : \"\"}\n </p>\n);\n",
|
|
18
|
+
"type": "registry:ui"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"path": "components/uibot/scroll-area.tsx",
|
|
22
|
+
"target": "components/uibot/scroll-area.tsx",
|
|
23
|
+
"content": "// Adapted from shadcn/ui Scroll Area (MIT).\nimport type { ComponentProps } from \"react\";\nimport { ScrollArea as Primitive } from \"radix-ui\";\n\nconst styles = `\n.uibot-scroll-area{position:relative;min-width:0;min-height:0;overflow:hidden}\n.uibot-scroll-viewport{width:100%;height:100%;max-height:inherit;border-radius:inherit;outline:none}\n.uibot-scroll-viewport:focus-visible{outline:2px solid var(--ring,#94a3b8);outline-offset:-2px}\n.uibot-scroll-viewport>div{display:block!important;min-width:100%}\n.uibot-scroll-area[data-fill-content=true]>.uibot-scroll-viewport>div{display:flex!important;flex-direction:column;min-height:100%}\n.uibot-scroll-area[data-scrollbars=horizontal]>.uibot-scroll-viewport{height:auto}\n.uibot-scrollbar{display:flex;touch-action:none;user-select:none;padding:1px;z-index:20}\n.uibot-scrollbar[data-orientation=vertical]{width:10px;border-inline-start:1px solid transparent}\n.uibot-scrollbar[data-orientation=horizontal]{height:10px;flex-direction:column;border-top:1px solid transparent}\n.uibot-scroll-thumb{position:relative;flex:1;border-radius:9999px;background:var(--nui-border,var(--border,#d4d4d8))}\n.uibot-scroll-thumb:hover,.uibot-scrollbar[data-state=visible]:active .uibot-scroll-thumb{background:var(--muted-foreground,#71717a)}\n`;\n\n/** Shared presentation primitive; refs and scroll events belong to the actual viewport. */\nexport function ScrollArea({\n children,\n className,\n scrollbars = \"vertical\",\n viewportProps,\n fillContent = false,\n ...props\n}: ComponentProps<typeof Primitive.Root> & {\n scrollbars?: \"vertical\" | \"horizontal\" | \"both\";\n viewportProps?: ComponentProps<typeof Primitive.Viewport>;\n fillContent?: boolean;\n}) {\n const { className: viewportClassName, ...viewportRest } = viewportProps ?? {};\n return (\n <Primitive.Root\n data-slot=\"scroll-area\"\n data-scrollbars={scrollbars}\n data-fill-content={fillContent}\n className={`uibot-scroll-area ${className ?? \"\"}`}\n type=\"auto\"\n {...props}\n >\n <style>{styles}</style>\n <Primitive.Viewport\n data-slot=\"scroll-area-viewport\"\n className={`uibot-scroll-viewport ${viewportClassName ?? \"\"}`}\n tabIndex={0}\n {...viewportRest}\n >\n {children}\n </Primitive.Viewport>\n {scrollbars !== \"horizontal\" && <ScrollBar />}\n {scrollbars !== \"vertical\" && <ScrollBar orientation=\"horizontal\" />}\n <Primitive.Corner />\n </Primitive.Root>\n );\n}\n\nexport function ScrollBar({\n className,\n orientation = \"vertical\",\n ...props\n}: ComponentProps<typeof Primitive.Scrollbar>) {\n return (\n <Primitive.Scrollbar\n data-slot=\"scroll-area-scrollbar\"\n orientation={orientation}\n className={`uibot-scrollbar ${className ?? \"\"}`}\n {...props}\n >\n <Primitive.Thumb data-slot=\"scroll-area-thumb\" className=\"uibot-scroll-thumb\" />\n </Primitive.Scrollbar>\n );\n}\n",
|
|
17
24
|
"type": "registry:ui"
|
|
18
25
|
},
|
|
19
26
|
{
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
{
|
|
13
13
|
"path": "lib/uibot/templates/document-assistant.uibot.yaml",
|
|
14
14
|
"target": "lib/uibot/templates/document-assistant.uibot.yaml",
|
|
15
|
-
"content": "version: \"2.0\"\npages:\n - id: document-assistant\n path: /document-assistant\n title: Document with an assistant\n blocks:\n - type: Grid\n props:\n cols: 2\n gap: md\n children:\n - id: document-assistant-editor\n type: DocumentWorkspace\n props:\n bindingId: document\n title: Document with an assistant\n markdown: |-\n # Project notes\n\n Capture the decisions behind your next idea.\n\n ## Overview\n\n Write, select text, and explore the formatting controls.\n\n ## Next steps\n\n - Review the draft\n - Connect your document host\n readOnly: false\n autoSaveMs: 1500\n locale: zh-CN\n previewState: ready\n variant: assistant\n - id: document-assistant-chat\n type: ChatWorkspace\n props:\n bindingId: chat\n variant: copilot\n title: Writing assistant / 写作助手\n",
|
|
15
|
+
"content": "version: \"2.0\"\npages:\n - id: document-assistant\n path: /document-assistant\n title: Document with an assistant\n blocks:\n - type: Grid\n props:\n cols: 2\n gap: md\n responsive: true\n children:\n - id: document-assistant-editor\n type: DocumentWorkspace\n props:\n bindingId: document\n title: Document with an assistant\n markdown: |-\n # Project notes\n\n Capture the decisions behind your next idea.\n\n ## Overview\n\n Write, select text, and explore the formatting controls.\n\n ## Next steps\n\n - Review the draft\n - Connect your document host\n readOnly: false\n autoSaveMs: 1500\n locale: zh-CN\n previewState: ready\n variant: assistant\n - id: document-assistant-chat\n type: ChatWorkspace\n props:\n bindingId: chat\n variant: copilot\n title: Writing assistant / 写作助手\n",
|
|
16
16
|
"type": "registry:lib"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
{
|
|
36
36
|
"path": "components/uibot/sidebars/ui-dropdown-menu.tsx",
|
|
37
37
|
"target": "components/uibot/sidebars/ui-dropdown-menu.tsx",
|
|
38
|
-
"content": "// Adapted from shadcn/ui (MIT). See THIRD_PARTY_LICENSE and provenance.json.\n\"use client\";\n\nimport type * as React from \"react\";\nimport type { ComponentProps } from \"react\";\nimport { cn } from \"./utils\";\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from \"lucide-react\";\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\n\nfunction DropdownMenu({ ...props }: ComponentProps<typeof DropdownMenuPrimitive.Root>) {\n return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />;\n}\n\nfunction DropdownMenuPortal({\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.Portal>) {\n return <DropdownMenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />;\n}\n\nfunction DropdownMenuTrigger({\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {\n return <DropdownMenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" {...props} />;\n}\n\nfunction DropdownMenuContent({\n className,\n sideOffset = 4,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.Content>) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n data-slot=\"dropdown-menu-content\"\n sideOffset={sideOffset}\n className={cn(\n \"z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\",\n className,\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n}\n\nfunction DropdownMenuGroup({ ...props }: ComponentProps<typeof DropdownMenuPrimitive.Group>) {\n return <DropdownMenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />;\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = \"default\",\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n variant?: \"default\" | \"destructive\";\n}) {\n return (\n <DropdownMenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n \"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction DropdownMenuCheckboxItem({\n className,\n children,\n checked,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n className={cn(\n \"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n checked={checked}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n}\n\nfunction DropdownMenuRadioGroup({\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {\n return <DropdownMenuPrimitive.RadioGroup data-slot=\"dropdown-menu-radio-group\" {...props} />;\n}\n\nfunction DropdownMenuRadioItem({\n className,\n children,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {\n return (\n <DropdownMenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n className={cn(\n \"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CircleIcon className=\"size-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n );\n}\n\nfunction DropdownMenuLabel({\n className,\n inset,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n}) {\n return (\n <DropdownMenuPrimitive.Label\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n className={cn(\"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8\", className)}\n {...props}\n />\n );\n}\n\nfunction DropdownMenuSeparator({\n className,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.Separator>) {\n return (\n <DropdownMenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\"-mx-1 my-1 h-px bg-border\", className)}\n {...props}\n />\n );\n}\n\nfunction DropdownMenuShortcut({ className, ...props }: ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\"ml-auto text-xs tracking-widest text-muted-foreground\", className)}\n {...props}\n />\n );\n}\n\nfunction DropdownMenuSub({ ...props }: ComponentProps<typeof DropdownMenuPrimitive.Sub>) {\n return <DropdownMenuPrimitive.Sub data-slot=\"dropdown-menu-sub\" {...props} />;\n}\n\nfunction DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n}) {\n return (\n <DropdownMenuPrimitive.SubTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n \"flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground\",\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ml-auto size-4\" />\n </DropdownMenuPrimitive.SubTrigger>\n );\n}\n\nfunction DropdownMenuSubContent({\n className,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {\n return (\n <DropdownMenuPrimitive.SubContent\n data-slot=\"dropdown-menu-sub-content\"\n className={cn(\n \"z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport {\n DropdownMenu,\n DropdownMenuPortal,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n};\n",
|
|
38
|
+
"content": "// Adapted from shadcn/ui (MIT). See THIRD_PARTY_LICENSE and provenance.json.\n\"use client\";\n\nimport type * as React from \"react\";\nimport type { ComponentProps } from \"react\";\nimport { cn } from \"./utils\";\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from \"lucide-react\";\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\n\nfunction DropdownMenu({ ...props }: ComponentProps<typeof DropdownMenuPrimitive.Root>) {\n return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />;\n}\n\nfunction DropdownMenuPortal({\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.Portal>) {\n return <DropdownMenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />;\n}\n\nfunction DropdownMenuTrigger({\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {\n return <DropdownMenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" {...props} />;\n}\n\nfunction DropdownMenuContent({\n className,\n sideOffset = 4,\n container,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.Content> & {\n container?: ComponentProps<typeof DropdownMenuPrimitive.Portal>[\"container\"];\n}) {\n return (\n <DropdownMenuPrimitive.Portal {...(container ? { container } : {})}>\n <DropdownMenuPrimitive.Content\n data-slot=\"dropdown-menu-content\"\n sideOffset={sideOffset}\n className={cn(\n \"z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\",\n className,\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n}\n\nfunction DropdownMenuGroup({ ...props }: ComponentProps<typeof DropdownMenuPrimitive.Group>) {\n return <DropdownMenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />;\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = \"default\",\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n variant?: \"default\" | \"destructive\";\n}) {\n return (\n <DropdownMenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n \"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction DropdownMenuCheckboxItem({\n className,\n children,\n checked,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n className={cn(\n \"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n checked={checked}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n}\n\nfunction DropdownMenuRadioGroup({\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {\n return <DropdownMenuPrimitive.RadioGroup data-slot=\"dropdown-menu-radio-group\" {...props} />;\n}\n\nfunction DropdownMenuRadioItem({\n className,\n children,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {\n return (\n <DropdownMenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n className={cn(\n \"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CircleIcon className=\"size-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n );\n}\n\nfunction DropdownMenuLabel({\n className,\n inset,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n}) {\n return (\n <DropdownMenuPrimitive.Label\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n className={cn(\"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8\", className)}\n {...props}\n />\n );\n}\n\nfunction DropdownMenuSeparator({\n className,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.Separator>) {\n return (\n <DropdownMenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\"-mx-1 my-1 h-px bg-border\", className)}\n {...props}\n />\n );\n}\n\nfunction DropdownMenuShortcut({ className, ...props }: ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\"ml-auto text-xs tracking-widest text-muted-foreground\", className)}\n {...props}\n />\n );\n}\n\nfunction DropdownMenuSub({ ...props }: ComponentProps<typeof DropdownMenuPrimitive.Sub>) {\n return <DropdownMenuPrimitive.Sub data-slot=\"dropdown-menu-sub\" {...props} />;\n}\n\nfunction DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n}) {\n return (\n <DropdownMenuPrimitive.SubTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n \"flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground\",\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ml-auto size-4\" />\n </DropdownMenuPrimitive.SubTrigger>\n );\n}\n\nfunction DropdownMenuSubContent({\n className,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {\n return (\n <DropdownMenuPrimitive.SubContent\n data-slot=\"dropdown-menu-sub-content\"\n className={cn(\n \"z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport {\n DropdownMenu,\n DropdownMenuPortal,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n};\n",
|
|
39
39
|
"type": "registry:ui"
|
|
40
40
|
},
|
|
41
41
|
{
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
{
|
|
20
20
|
"path": "lib/uibot/templates/education-workspace.uibot.yaml",
|
|
21
21
|
"target": "lib/uibot/templates/education-workspace.uibot.yaml",
|
|
22
|
-
"content": "version: \"2.0\"\nmenus:\n items:\n - key: dashboard\n label: Learn — Dashboard\n path: /\n - key: courses\n label: Learn — Courses\n path: /courses\n - key: lessons\n label: Learn — Calculus I\n path: /lessons\n - key: grades\n label: Learn — Grades\n path: /grades\n - key: document-reading\n label: Reading with an outline\n path: /document-reading\n - key: chat-knowledge\n label: Knowledge questions\n path: /chat-knowledge\npages:\n - id: dashboard\n path: /\n title: Learn — Dashboard\n blocks:\n - type: PageLayout\n props:\n title: Lumen LMS\n variant: sidebar\n collapsible: none\n slots:\n headerActions:\n - type: Button\n props:\n label: Resume course\n size: sm\n sidebar:\n - type: PageSiderMenu\n props:\n title: Learn — Dashboard\n children:\n - type: MenuLink\n props:\n label: Dashboard\n href: /\n icon: ▦\n active: true\n - type: MenuLink\n props:\n label: Courses\n href: /courses\n icon: ◫\n - type: MenuLink\n props:\n label: Lessons\n href: /lessons\n icon: ◧\n - type: MenuLink\n props:\n label: Grades\n href: /grades\n icon: ◔\n children:\n - type: Box\n props:\n className: mb-2\n children:\n - type: Heading\n props:\n level: 2\n text: Welcome back, Ada\n - type: Paragraph\n props:\n size: sm\n muted: true\n text: You have 3 lessons due this week. Keep your 14-day streak alive.\n - type: StatGrid\n props:\n cols: \"4\"\n items:\n - label: Courses in progress\n value: \"5\"\n change: \"+1\"\n trend: up\n - label: Overall completion\n value: 68%\n change: +6pt\n trend: up\n - label: Study streak\n value: 14 days\n change: \"+2\"\n trend: up\n - label: Hours this month\n value: 27h\n change: -3h\n trend: down\n - type: Grid\n props:\n cols: \"3\"\n gap: lg\n children:\n - type: Box\n props:\n className: col-span-2\n children:\n - type: Card\n props:\n title: Study time\n description: Minutes per day · last 7 days\n children:\n - type: TrendChart\n props:\n height: 200\n labels:\n - Mon\n - Tue\n - Wed\n - Thu\n - Fri\n - Sat\n - Sun\n series:\n - name: This week\n area: true\n points:\n - 45\n - 60\n - 30\n - 90\n - 75\n - 120\n - 50\n - name: Goal\n points:\n - 60\n - 60\n - 60\n - 60\n - 60\n - 60\n - 60\n - type: Card\n props:\n title: Due soon\n children:\n - type: TimelineList\n props:\n items:\n - time: Today\n title: \"Quiz: Derivatives\"\n desc: Calculus I\n status: warn\n - time: Wed\n title: Essay draft\n desc: Modern History\n status: ok\n - time: Fri\n title: Lab report\n desc: Intro to Chemistry\n status: error\n - time: Sun\n title: \"Reading: Ch. 4\"\n desc: Microeconomics\n status: ok\n - type: Heading\n props:\n level: 3\n text: Continue learning\n - type: Grid\n props:\n cols: \"3\"\n responsive: true\n gap: lg\n children:\n - type: Card\n props:\n title: Calculus I\n description: Limits, derivatives, integrals\n children:\n - type: BadgeGroup\n props:\n items:\n - label: 72% done\n tone: success\n - label: Math\n tone: info\n - type: Button\n props:\n label: Continue · Lesson 9\n full: true\n - type: Card\n props:\n title: Modern History\n description: 1900 to present\n children:\n - type: BadgeGroup\n props:\n items:\n - label: 40% done\n tone: warning\n - label: Humanities\n tone: info\n - type: Button\n props:\n label: Continue · Lesson 5\n full: true\n - type: Card\n props:\n title: Intro to Chemistry\n description: Atoms, bonds, reactions\n children:\n - type: BadgeGroup\n props:\n items:\n - label: 15% done\n tone: error\n - label: Science\n tone: info\n - type: Button\n props:\n label: Continue · Lesson 2\n full: true\n - id: courses\n path: /courses\n title: Learn — Courses\n blocks:\n - type: PageLayout\n props:\n title: Lumen LMS\n variant: sidebar\n collapsible: none\n slots:\n headerActions:\n - type: Button\n props:\n label: Browse catalog\n size: sm\n variant: outline\n sidebar:\n - type: PageSiderMenu\n props:\n title: Learn — Courses\n children:\n - type: MenuLink\n props:\n label: Dashboard\n href: /\n icon: ▦\n - type: MenuLink\n props:\n label: Courses\n href: /courses\n icon: ◫\n active: true\n - type: MenuLink\n props:\n label: Lessons\n href: /lessons\n icon: ◧\n - type: MenuLink\n props:\n label: Grades\n href: /grades\n icon: ◔\n children:\n - type: Box\n props:\n className: mb-2\n children:\n - type: Heading\n props:\n level: 2\n text: My courses\n - type: Paragraph\n props:\n size: sm\n muted: true\n text: 12 enrolled · 5 in progress · 7 completed\n - type: Card\n props:\n title: Enrolled courses\n children:\n - type: SearchableTable\n props:\n searchKey: courseSearch\n placeholder: Search courses…\n columns:\n - key: title\n label: Course\n - key: instructor\n label: Instructor\n - key: category\n label: Category\n - key: progress\n label: Progress\n align: right\n - key: status\n label: Status\n rows:\n - title: Calculus I\n instructor: Dr. Noether\n category: Math\n progress: 72%\n status: In progress\n - title: Modern History\n instructor: Prof. Zinn\n category: Humanities\n progress: 40%\n status: In progress\n - title: Intro to Chemistry\n instructor: Dr. Curie\n category: Science\n progress: 15%\n status: In progress\n - title: Microeconomics\n instructor: Dr. Smith\n category: Economics\n progress: 100%\n status: Completed\n - title: Linear Algebra\n instructor: Dr. Strang\n category: Math\n progress: 100%\n status: Completed\n - title: Creative Writing\n instructor: Prof. Woolf\n category: Humanities\n progress: 0%\n status: Not started\n - id: lessons\n path: /lessons\n title: Learn — Calculus I\n state:\n selectedId: l-9\n blocks:\n - type: PageLayout\n props:\n title: Lumen LMS\n variant: sidebar\n collapsible: none\n slots:\n headerActions:\n - type: Button\n props:\n label: Mark complete\n size: sm\n sidebar:\n - type: PageSiderMenu\n props:\n title: Learn — Calculus I\n children:\n - type: MenuLink\n props:\n label: Dashboard\n href: /\n icon: ▦\n - type: MenuLink\n props:\n label: Courses\n href: /courses\n icon: ◫\n - type: MenuLink\n props:\n label: Lessons\n href: /lessons\n icon: ◧\n active: true\n - type: MenuLink\n props:\n label: Grades\n href: /grades\n icon: ◔\n children:\n - type: Breadcrumb\n props:\n items:\n - label: Courses\n href: /courses\n - label: Calculus I\n href: /lessons\n - label: Lesson 9 — The Chain Rule\n - type: SplitMasterDetail\n props:\n selectKey: selectedId\n items:\n - id: l-7\n title: 7 · The Product Rule\n subtitle: Completed · 12 min\n - id: l-8\n title: 8 · The Quotient Rule\n subtitle: Completed · 10 min\n - id: l-9\n title: 9 · The Chain Rule\n subtitle: In progress · 18 min\n - id: l-10\n title: 10 · Implicit Differentiation\n subtitle: Locked · 15 min\n slots:\n detail:\n - type: Card\n props:\n title: Lesson 9 — The Chain Rule\n description: Calculus I · Module 3 · 18 min\n slots:\n actions:\n - type: BadgeGroup\n props:\n items:\n - label: In progress\n tone: warning\n - label: Video + reading\n tone: info\n children:\n - type: KeyValueGrid\n props:\n cols: \"3\"\n items:\n - key: Duration\n value: 18 min\n - key: Difficulty\n value: Intermediate\n - key: Prerequisite\n value: Product Rule\n - type: Divider\n - type: Markdown\n props:\n content: >\n ## The Chain Rule\n\n\n The **chain rule** lets you differentiate a\n *composition*\n\n of functions. If `y = f(g(x))`, then:\n\n\n - Differentiate the **outer** function, keeping the\n inner intact.\n\n - Multiply by the derivative of the **inner**\n function.\n\n\n Formally, `dy/dx = f'(g(x)) · g'(x)`.\n\n\n ### Worked example\n\n\n For `y = (3x + 1)^5`, the outer is `u^5` and the inner\n is\n\n `3x + 1`, so `dy/dx = 5(3x + 1)^4 · 3 = 15(3x + 1)^4`.\n - type: Toast\n props:\n level: info\n title: Up next\n message: Finish the practice set to unlock Implicit Differentiation.\n - id: grades\n path: /grades\n title: Learn — Grades\n blocks:\n - type: PageLayout\n props:\n title: Lumen LMS\n variant: sidebar\n collapsible: none\n slots:\n headerActions:\n - type: Button\n props:\n label: Export transcript\n size: sm\n variant: outline\n sidebar:\n - type: PageSiderMenu\n props:\n title: Learn — Grades\n children:\n - type: MenuLink\n props:\n label: Dashboard\n href: /\n icon: ▦\n - type: MenuLink\n props:\n label: Courses\n href: /courses\n icon: ◫\n - type: MenuLink\n props:\n label: Lessons\n href: /lessons\n icon: ◧\n - type: MenuLink\n props:\n label: Grades\n href: /grades\n icon: ◔\n active: true\n children:\n - type: Box\n props:\n className: mb-2\n children:\n - type: Heading\n props:\n level: 2\n text: Grades & transcript\n - type: Paragraph\n props:\n size: sm\n muted: true\n text: Spring term · GPA updated nightly\n - type: StatGrid\n props:\n cols: \"4\"\n items:\n - label: GPA\n value: \"3.74\"\n change: \"+0.08\"\n trend: up\n - label: Credits earned\n value: \"48\"\n change: \"+6\"\n trend: up\n - label: Assignments graded\n value: 92%\n - label: Pending review\n value: \"3\"\n change: \"-2\"\n trend: down\n - type: Card\n props:\n title: Course grades\n children:\n - type: Table\n props:\n columns:\n - key: course\n label: Course\n - key: assignments\n label: Assignments\n align: center\n - key: average\n label: Average\n align: right\n - key: grade\n label: Grade\n align: right\n rows:\n - course: Calculus I\n assignments: 9 / 12\n average: 88%\n grade: B+\n - course: Modern History\n assignments: 5 / 10\n average: 91%\n grade: A-\n - course: Intro to Chemistry\n assignments: 2 / 8\n average: 76%\n grade: C+\n - course: Microeconomics\n assignments: 12 / 12\n average: 95%\n grade: A\n - course: Linear Algebra\n assignments: 10 / 10\n average: 93%\n grade: A\n - id: document-reading\n path: /document-reading\n title: Reading with an outline\n blocks:\n - id: document-reading-editor\n type: DocumentWorkspace\n props:\n bindingId: document\n title: Reading with an outline\n markdown: |-\n # Project notes\n\n Capture the decisions behind your next idea.\n\n ## Overview\n\n Write, select text, and explore the formatting controls.\n\n ## Next steps\n\n - Review the draft\n - Connect your document host\n readOnly: true\n autoSaveMs: 1500\n locale: zh-CN\n previewState: ready\n variant: reading\n - id: chat-knowledge\n path: /chat-knowledge\n title: Knowledge questions\n blocks:\n - id: chat-knowledge-surface\n type: ChatWorkspace\n props:\n bindingId: chat\n variant: knowledge\n title: Knowledge questions\n showSuggestions: true\n previewState: ready\ncomposition:\n schema: uibot.solution-composition.v1\n pages:\n - resourceId: template:document-reading\n version: 0.19.0\n sourceHash: 62d69d371c33ec8cc79716059c740dc54ca323b6bb29385bab1a7077a5951d60\n sourcePageId: document-reading\n targetPageId: document-reading\n baseline:\n id: document-reading\n path: /document-reading\n title: Reading with an outline\n blocks:\n - id: document-reading-editor\n type: DocumentWorkspace\n props:\n bindingId: document\n title: Reading with an outline\n markdown: |-\n # Project notes\n\n Capture the decisions behind your next idea.\n\n ## Overview\n\n Write, select text, and explore the formatting controls.\n\n ## Next steps\n\n - Review the draft\n - Connect your document host\n readOnly: true\n autoSaveMs: 1500\n locale: zh-CN\n previewState: ready\n variant: reading\n bindings:\n paths: {}\n connections: {}\n layout: source\n - resourceId: template:chat-knowledge\n version: 0.19.0\n sourceHash: a7567e61839085bdfb2945ac89b3fb721b56b7000c57c45003bf2398e2fdeae4\n sourcePageId: chat-knowledge\n targetPageId: chat-knowledge\n baseline:\n id: chat-knowledge\n path: /chat-knowledge\n title: Knowledge questions\n blocks:\n - id: chat-knowledge-surface\n type: ChatWorkspace\n props:\n bindingId: chat\n variant: knowledge\n title: Knowledge questions\n showSuggestions: true\n previewState: ready\n bindings:\n paths: {}\n connections: {}\n layout: source\n",
|
|
22
|
+
"content": "version: \"2.0\"\nmenus:\n items:\n - key: dashboard\n label: Learn — Dashboard\n path: /\n - key: courses\n label: Learn — Courses\n path: /courses\n - key: lessons\n label: Learn — Calculus I\n path: /lessons\n - key: grades\n label: Learn — Grades\n path: /grades\n - key: document-reading\n label: Reading with an outline\n path: /document-reading\n - key: chat-knowledge\n label: Knowledge questions\n path: /chat-knowledge\npages:\n - id: dashboard\n path: /\n title: Learn — Dashboard\n blocks:\n - type: PageLayout\n props:\n title: Lumen LMS\n variant: sidebar\n collapsible: none\n slots:\n headerActions:\n - type: Button\n props:\n label: Resume course\n size: sm\n sidebar:\n - type: PageSiderMenu\n props:\n title: Learn — Dashboard\n children:\n - type: MenuLink\n props:\n label: Dashboard\n href: /\n icon: ▦\n active: true\n - type: MenuLink\n props:\n label: Courses\n href: /courses\n icon: ◫\n - type: MenuLink\n props:\n label: Lessons\n href: /lessons\n icon: ◧\n - type: MenuLink\n props:\n label: Grades\n href: /grades\n icon: ◔\n children:\n - type: Box\n props:\n className: mb-2\n children:\n - type: Heading\n props:\n level: 2\n text: Welcome back, Ada\n - type: Paragraph\n props:\n size: sm\n muted: true\n text: You have 3 lessons due this week. Keep your 14-day streak alive.\n - type: StatGrid\n props:\n cols: \"4\"\n items:\n - label: Courses in progress\n value: \"5\"\n change: \"+1\"\n trend: up\n - label: Overall completion\n value: 68%\n change: +6pt\n trend: up\n - label: Study streak\n value: 14 days\n change: \"+2\"\n trend: up\n - label: Hours this month\n value: 27h\n change: -3h\n trend: down\n - type: Grid\n props:\n cols: \"3\"\n gap: lg\n children:\n - type: Box\n props:\n className: col-span-2\n children:\n - type: Card\n props:\n title: Study time\n description: Minutes per day · last 7 days\n children:\n - type: TrendChart\n props:\n height: 200\n labels:\n - Mon\n - Tue\n - Wed\n - Thu\n - Fri\n - Sat\n - Sun\n series:\n - name: This week\n area: true\n points:\n - 45\n - 60\n - 30\n - 90\n - 75\n - 120\n - 50\n - name: Goal\n points:\n - 60\n - 60\n - 60\n - 60\n - 60\n - 60\n - 60\n - type: Card\n props:\n title: Due soon\n children:\n - type: TimelineList\n props:\n items:\n - time: Today\n title: \"Quiz: Derivatives\"\n desc: Calculus I\n status: warn\n - time: Wed\n title: Essay draft\n desc: Modern History\n status: ok\n - time: Fri\n title: Lab report\n desc: Intro to Chemistry\n status: error\n - time: Sun\n title: \"Reading: Ch. 4\"\n desc: Microeconomics\n status: ok\n - type: Heading\n props:\n level: 3\n text: Continue learning\n - type: Grid\n props:\n cols: \"3\"\n responsive: true\n gap: lg\n children:\n - type: Card\n props:\n title: Calculus I\n description: Limits, derivatives, integrals\n children:\n - type: BadgeGroup\n props:\n items:\n - label: 72% done\n tone: success\n - label: Math\n tone: info\n - type: Button\n props:\n label: Continue · Lesson 9\n full: true\n - type: Card\n props:\n title: Modern History\n description: 1900 to present\n children:\n - type: BadgeGroup\n props:\n items:\n - label: 40% done\n tone: warning\n - label: Humanities\n tone: info\n - type: Button\n props:\n label: Continue · Lesson 5\n full: true\n - type: Card\n props:\n title: Intro to Chemistry\n description: Atoms, bonds, reactions\n children:\n - type: BadgeGroup\n props:\n items:\n - label: 15% done\n tone: error\n - label: Science\n tone: info\n - type: Button\n props:\n label: Continue · Lesson 2\n full: true\n - id: courses\n path: /courses\n title: Learn — Courses\n blocks:\n - type: PageLayout\n props:\n title: Lumen LMS\n variant: sidebar\n collapsible: none\n slots:\n headerActions:\n - type: Button\n props:\n label: Browse catalog\n size: sm\n variant: outline\n sidebar:\n - type: PageSiderMenu\n props:\n title: Learn — Courses\n children:\n - type: MenuLink\n props:\n label: Dashboard\n href: /\n icon: ▦\n - type: MenuLink\n props:\n label: Courses\n href: /courses\n icon: ◫\n active: true\n - type: MenuLink\n props:\n label: Lessons\n href: /lessons\n icon: ◧\n - type: MenuLink\n props:\n label: Grades\n href: /grades\n icon: ◔\n children:\n - type: Box\n props:\n className: mb-2\n children:\n - type: Heading\n props:\n level: 2\n text: My courses\n - type: Paragraph\n props:\n size: sm\n muted: true\n text: 12 enrolled · 5 in progress · 7 completed\n - type: Card\n props:\n title: Enrolled courses\n children:\n - type: SearchableTable\n props:\n searchKey: courseSearch\n placeholder: Search courses…\n columns:\n - key: title\n label: Course\n - key: instructor\n label: Instructor\n - key: category\n label: Category\n - key: progress\n label: Progress\n align: right\n - key: status\n label: Status\n rows:\n - title: Calculus I\n instructor: Dr. Noether\n category: Math\n progress: 72%\n status: In progress\n - title: Modern History\n instructor: Prof. Zinn\n category: Humanities\n progress: 40%\n status: In progress\n - title: Intro to Chemistry\n instructor: Dr. Curie\n category: Science\n progress: 15%\n status: In progress\n - title: Microeconomics\n instructor: Dr. Smith\n category: Economics\n progress: 100%\n status: Completed\n - title: Linear Algebra\n instructor: Dr. Strang\n category: Math\n progress: 100%\n status: Completed\n - title: Creative Writing\n instructor: Prof. Woolf\n category: Humanities\n progress: 0%\n status: Not started\n - id: lessons\n path: /lessons\n title: Learn — Calculus I\n state:\n selectedId: l-9\n blocks:\n - type: PageLayout\n props:\n title: Lumen LMS\n variant: sidebar\n collapsible: none\n slots:\n headerActions:\n - type: Button\n props:\n label: Mark complete\n size: sm\n sidebar:\n - type: PageSiderMenu\n props:\n title: Learn — Calculus I\n children:\n - type: MenuLink\n props:\n label: Dashboard\n href: /\n icon: ▦\n - type: MenuLink\n props:\n label: Courses\n href: /courses\n icon: ◫\n - type: MenuLink\n props:\n label: Lessons\n href: /lessons\n icon: ◧\n active: true\n - type: MenuLink\n props:\n label: Grades\n href: /grades\n icon: ◔\n children:\n - type: Breadcrumb\n props:\n items:\n - label: Courses\n href: /courses\n - label: Calculus I\n href: /lessons\n - label: Lesson 9 — The Chain Rule\n - type: SplitMasterDetail\n props:\n selectKey: selectedId\n items:\n - id: l-7\n title: 7 · The Product Rule\n subtitle: Completed · 12 min\n - id: l-8\n title: 8 · The Quotient Rule\n subtitle: Completed · 10 min\n - id: l-9\n title: 9 · The Chain Rule\n subtitle: In progress · 18 min\n - id: l-10\n title: 10 · Implicit Differentiation\n subtitle: Locked · 15 min\n slots:\n detail:\n - type: Card\n props:\n title: Lesson 9 — The Chain Rule\n description: Calculus I · Module 3 · 18 min\n slots:\n actions:\n - type: BadgeGroup\n props:\n items:\n - label: In progress\n tone: warning\n - label: Video + reading\n tone: info\n children:\n - type: KeyValueGrid\n props:\n cols: \"3\"\n items:\n - key: Duration\n value: 18 min\n - key: Difficulty\n value: Intermediate\n - key: Prerequisite\n value: Product Rule\n - type: Divider\n - type: Markdown\n props:\n content: >\n ## The Chain Rule\n\n\n The **chain rule** lets you differentiate a\n *composition*\n\n of functions. If `y = f(g(x))`, then:\n\n\n - Differentiate the **outer** function, keeping the\n inner intact.\n\n - Multiply by the derivative of the **inner**\n function.\n\n\n Formally, `dy/dx = f'(g(x)) · g'(x)`.\n\n\n ### Worked example\n\n\n For `y = (3x + 1)^5`, the outer is `u^5` and the inner\n is\n\n `3x + 1`, so `dy/dx = 5(3x + 1)^4 · 3 = 15(3x + 1)^4`.\n - type: Toast\n props:\n level: info\n title: Up next\n message: Finish the practice set to unlock Implicit Differentiation.\n - id: grades\n path: /grades\n title: Learn — Grades\n blocks:\n - type: PageLayout\n props:\n title: Lumen LMS\n variant: sidebar\n collapsible: none\n slots:\n headerActions:\n - type: Button\n props:\n label: Export transcript\n size: sm\n variant: outline\n sidebar:\n - type: PageSiderMenu\n props:\n title: Learn — Grades\n children:\n - type: MenuLink\n props:\n label: Dashboard\n href: /\n icon: ▦\n - type: MenuLink\n props:\n label: Courses\n href: /courses\n icon: ◫\n - type: MenuLink\n props:\n label: Lessons\n href: /lessons\n icon: ◧\n - type: MenuLink\n props:\n label: Grades\n href: /grades\n icon: ◔\n active: true\n children:\n - type: Box\n props:\n className: mb-2\n children:\n - type: Heading\n props:\n level: 2\n text: Grades & transcript\n - type: Paragraph\n props:\n size: sm\n muted: true\n text: Spring term · GPA updated nightly\n - type: StatGrid\n props:\n cols: \"4\"\n items:\n - label: GPA\n value: \"3.74\"\n change: \"+0.08\"\n trend: up\n - label: Credits earned\n value: \"48\"\n change: \"+6\"\n trend: up\n - label: Assignments graded\n value: 92%\n - label: Pending review\n value: \"3\"\n change: \"-2\"\n trend: down\n - type: Card\n props:\n title: Course grades\n children:\n - type: Table\n props:\n columns:\n - key: course\n label: Course\n - key: assignments\n label: Assignments\n align: center\n - key: average\n label: Average\n align: right\n - key: grade\n label: Grade\n align: right\n rows:\n - course: Calculus I\n assignments: 9 / 12\n average: 88%\n grade: B+\n - course: Modern History\n assignments: 5 / 10\n average: 91%\n grade: A-\n - course: Intro to Chemistry\n assignments: 2 / 8\n average: 76%\n grade: C+\n - course: Microeconomics\n assignments: 12 / 12\n average: 95%\n grade: A\n - course: Linear Algebra\n assignments: 10 / 10\n average: 93%\n grade: A\n - id: document-reading\n path: /document-reading\n title: Reading with an outline\n blocks:\n - id: document-reading-editor\n type: DocumentWorkspace\n props:\n bindingId: document\n title: Reading with an outline\n markdown: |-\n # Project notes\n\n Capture the decisions behind your next idea.\n\n ## Overview\n\n Write, select text, and explore the formatting controls.\n\n ## Next steps\n\n - Review the draft\n - Connect your document host\n readOnly: true\n autoSaveMs: 1500\n locale: zh-CN\n previewState: ready\n variant: reading\n - id: chat-knowledge\n path: /chat-knowledge\n title: Knowledge questions\n blocks:\n - id: chat-knowledge-surface\n type: ChatWorkspace\n props:\n bindingId: chat\n variant: knowledge\n title: Knowledge questions\n showSuggestions: true\n previewState: ready\ncomposition:\n schema: uibot.solution-composition.v1\n pages:\n - resourceId: template:document-reading\n version: 0.20.0\n sourceHash: 62d69d371c33ec8cc79716059c740dc54ca323b6bb29385bab1a7077a5951d60\n sourcePageId: document-reading\n targetPageId: document-reading\n baseline:\n id: document-reading\n path: /document-reading\n title: Reading with an outline\n blocks:\n - id: document-reading-editor\n type: DocumentWorkspace\n props:\n bindingId: document\n title: Reading with an outline\n markdown: |-\n # Project notes\n\n Capture the decisions behind your next idea.\n\n ## Overview\n\n Write, select text, and explore the formatting controls.\n\n ## Next steps\n\n - Review the draft\n - Connect your document host\n readOnly: true\n autoSaveMs: 1500\n locale: zh-CN\n previewState: ready\n variant: reading\n bindings:\n paths: {}\n connections: {}\n layout: source\n - resourceId: template:chat-knowledge\n version: 0.20.0\n sourceHash: 76c7dae129f44979baeca7908aebca700d020c23f7798c1aa0be54da95967f61\n sourcePageId: chat-knowledge\n targetPageId: chat-knowledge\n baseline:\n id: chat-knowledge\n path: /chat-knowledge\n title: Knowledge questions\n blocks:\n - id: chat-knowledge-surface\n type: ChatWorkspace\n props:\n bindingId: chat\n variant: knowledge\n title: Knowledge questions\n showSuggestions: true\n previewState: ready\n bindings:\n paths: {}\n connections: {}\n layout: source\n",
|
|
23
23
|
"type": "registry:lib"
|
|
24
24
|
},
|
|
25
25
|
{
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
"type": "registry:ui",
|
|
5
5
|
"description": "Standalone action button. Six visual variants and five sizes. Does not submit forms — use Form.Submit for that.",
|
|
6
6
|
"dependencies": [
|
|
7
|
-
"react@19.3.0"
|
|
7
|
+
"react@19.3.0",
|
|
8
|
+
"radix-ui@1.4.3"
|
|
8
9
|
],
|
|
9
10
|
"registryDependencies": [
|
|
10
11
|
"@uibot/uibot-base"
|
|
@@ -25,7 +26,19 @@
|
|
|
25
26
|
{
|
|
26
27
|
"path": "components/uibot/overlay.tsx",
|
|
27
28
|
"target": "components/uibot/overlay.tsx",
|
|
28
|
-
"content": "import { useEffect, useId, useRef, type ReactNode } from \"react\";\nimport type { RendererComponent } from \"@/lib/uibot-renderer\";\nimport { emit, text, type BlockContext } from \"./interaction\";\n\nfunction useNativeDialogLifecycle(\n ref: { current: HTMLDialogElement | null },\n open: boolean,\n triggerRef?: { current: HTMLElement | null },\n) {\n useEffect(() => {\n const dialog = ref.current;\n if (!dialog || !open) return;\n const trigger = triggerRef\n ? triggerRef.current\n : document.activeElement instanceof HTMLElement\n ? document.activeElement\n : null;\n dialog.showModal();\n return () => {\n if (dialog.open) dialog.close();\n if (trigger?.isConnected) trigger.focus();\n };\n }, [open, ref, triggerRef]);\n}\n\nfunction Overlay({\n props,\n ctx,\n drawer,\n blockType,\n}: {\n props: Record<string, unknown>;\n ctx: BlockContext;\n drawer: boolean;\n blockType?: \"Dialog\";\n}) {\n const ref = useRef<HTMLDialogElement>(null);\n const titleId = useId(),\n descriptionId = useId();\n const open = props.open === true;\n const close = () => emit(ctx, \"onClose\", { open: false }, false);\n useNativeDialogLifecycle(ref, open);\n if (!open) return null;\n return (\n <dialog\n ref={ref}\n aria-labelledby={titleId}\n aria-describedby={props.description ? descriptionId : undefined}\n aria-busy={props.pending === true || undefined}\n data-uibot-type={blockType ?? (drawer ? \"Drawer\" : \"Modal\")}\n className={`uibot-overlay bg-background text-foreground p-0 shadow-xl backdrop:bg-black/50 ${drawer ? \"fixed inset-y-0 start-auto end-0 m-0 h-dvh max-h-dvh w-full max-w-md border-s\" : \"m-auto w-[calc(100%-2rem)] max-w-lg rounded-xl border\"}`}\n onCancel={(e) => {\n e.preventDefault();\n if (props.pending !== true) close();\n }}\n onClick={(e) => {\n if (e.target === e.currentTarget && props.pending !== true) {\n const r = e.currentTarget.getBoundingClientRect();\n if (\n e.clientX < r.left ||\n e.clientX > r.right ||\n e.clientY < r.top ||\n e.clientY > r.bottom\n )\n close();\n }\n }}\n >\n <div className=\"flex h-full max-h-dvh flex-col\">\n <header className=\"flex items-start justify-between gap-4 border-b p-6\">\n <div>\n <h2 id={titleId} className=\"text-lg font-semibold\">\n {text(props.title, drawer ? \"Edit record\" : \"Confirm\")}\n </h2>\n {Boolean(props.description) && (\n <p id={descriptionId} className=\"mt-1 text-sm text-muted-foreground\">\n {text(props.description)}\n </p>\n )}\n </div>\n <button\n type=\"button\"\n disabled={props.pending === true}\n className=\"rounded px-2 py-1 text-sm hover:bg-muted focus-visible:ring-2\"\n aria-label=\"Close dialog\"\n onClick={close}\n >\n Close\n </button>\n </header>\n <
|
|
29
|
+
"content": "import { useEffect, useId, useRef, type ReactNode } from \"react\";\nimport type { RendererComponent } from \"@/lib/uibot-renderer\";\nimport { emit, text, type BlockContext } from \"./interaction\";\nimport { containPreviewNavigationDialog } from \"./preview-scope\";\nimport { ScrollArea } from \"./scroll-area\";\n\nfunction useNativeDialogLifecycle(\n ref: { current: HTMLDialogElement | null },\n open: boolean,\n triggerRef?: { current: HTMLElement | null },\n containNavigation = false,\n) {\n useEffect(() => {\n const dialog = ref.current;\n if (!dialog || !open) return;\n const trigger = triggerRef\n ? triggerRef.current\n : document.activeElement instanceof HTMLElement\n ? document.activeElement\n : null;\n const releaseBounds = containNavigation ? containPreviewNavigationDialog(dialog) : () => {};\n dialog.showModal();\n return () => {\n if (dialog.open) dialog.close();\n releaseBounds();\n if (trigger?.isConnected) trigger.focus();\n };\n }, [open, ref, triggerRef, containNavigation]);\n}\n\nfunction Overlay({\n props,\n ctx,\n drawer,\n blockType,\n}: {\n props: Record<string, unknown>;\n ctx: BlockContext;\n drawer: boolean;\n blockType?: \"Dialog\";\n}) {\n const ref = useRef<HTMLDialogElement>(null);\n const titleId = useId(),\n descriptionId = useId();\n const open = props.open === true;\n const close = () => emit(ctx, \"onClose\", { open: false }, false);\n useNativeDialogLifecycle(ref, open);\n if (!open) return null;\n return (\n <dialog\n ref={ref}\n aria-labelledby={titleId}\n aria-describedby={props.description ? descriptionId : undefined}\n aria-busy={props.pending === true || undefined}\n data-uibot-type={blockType ?? (drawer ? \"Drawer\" : \"Modal\")}\n className={`uibot-overlay overflow-hidden bg-background text-foreground p-0 shadow-xl backdrop:bg-black/50 ${drawer ? (props.placement === \"responsive\" ? \"fixed inset-x-0 top-auto bottom-0 m-0 h-[90dvh] max-h-[90dvh] w-full max-w-none rounded-t-xl border sm:inset-y-0 sm:start-auto sm:end-0 sm:h-dvh sm:max-h-dvh sm:max-w-md sm:rounded-none sm:border-s\" : \"fixed inset-y-0 start-auto end-0 m-0 h-dvh max-h-dvh w-full max-w-md border-s\") : \"m-auto w-[calc(100%-2rem)] max-w-lg rounded-xl border\"}`}\n onCancel={(e) => {\n e.preventDefault();\n if (props.pending !== true) close();\n }}\n onClick={(e) => {\n if (e.target === e.currentTarget && props.pending !== true) {\n const r = e.currentTarget.getBoundingClientRect();\n if (\n e.clientX < r.left ||\n e.clientX > r.right ||\n e.clientY < r.top ||\n e.clientY > r.bottom\n )\n close();\n }\n }}\n >\n <div className=\"flex h-full max-h-dvh flex-col\">\n <header className=\"flex items-start justify-between gap-4 border-b p-6\">\n <div>\n <h2 id={titleId} className=\"text-lg font-semibold\">\n {text(props.title, drawer ? \"Edit record\" : \"Confirm\")}\n </h2>\n {Boolean(props.description) && (\n <p id={descriptionId} className=\"mt-1 text-sm text-muted-foreground\">\n {text(props.description)}\n </p>\n )}\n </div>\n <button\n type=\"button\"\n disabled={props.pending === true}\n className=\"rounded px-2 py-1 text-sm hover:bg-muted focus-visible:ring-2\"\n aria-label=\"Close dialog\"\n onClick={close}\n >\n Close\n </button>\n </header>\n <ScrollArea\n className=\"min-h-0 flex-1\"\n viewportProps={{ className: \"p-6\", \"aria-label\": text(props.title, \"Dialog content\") }}\n >\n {ctx.children as ReactNode[]}\n </ScrollArea>\n {ctx.slots.footer && (\n <footer className=\"flex justify-end gap-2 border-t p-6\">\n {ctx.slots.footer as ReactNode[]}\n </footer>\n )}\n </div>\n </dialog>\n );\n}\nexport const LiveDrawer: RendererComponent = (props, ctx) => (\n <Overlay props={props} ctx={ctx} drawer />\n);\nexport const LiveModal: RendererComponent = (props, ctx) => (\n <Overlay props={props} ctx={ctx} drawer={false} />\n);\nexport const LiveConfirmationDialog: RendererComponent = (props, ctx) => (\n <Overlay props={props} ctx={ctx} drawer={false} blockType=\"Dialog\" />\n);\n\n/** Internal mobile navigation drawer shared by renderer blocks, not a Spec component. */\nexport function SidebarDrawer({\n id,\n open,\n onClose,\n triggerRef,\n children,\n}: {\n id: string;\n open: boolean;\n onClose: () => void;\n triggerRef: { current: HTMLButtonElement | null };\n children: ReactNode;\n}) {\n const ref = useRef<HTMLDialogElement>(null);\n useNativeDialogLifecycle(ref, open, triggerRef, true);\n\n if (!open) return null;\n return (\n <dialog\n id={id}\n ref={ref}\n aria-label=\"Navigation\"\n className=\"fixed inset-y-0 start-0 z-50 m-0 h-dvh max-h-dvh w-72 max-w-[85vw] border-r bg-background p-0 text-foreground shadow-xl backdrop:bg-black/50\"\n onCancel={(event) => {\n event.preventDefault();\n onClose();\n }}\n onClick={(event) => {\n if (event.target === event.currentTarget) {\n const bounds = event.currentTarget.getBoundingClientRect();\n if (\n event.clientX < bounds.left ||\n event.clientX > bounds.right ||\n event.clientY < bounds.top ||\n event.clientY > bounds.bottom\n )\n onClose();\n }\n if (\n event.target instanceof Element &&\n event.target.closest('a, button[data-uibot-type=\"MenuLink\"]') &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.shiftKey &&\n !event.altKey &&\n event.button === 0\n )\n onClose();\n }}\n >\n <button\n type=\"button\"\n className=\"m-3 rounded border px-3 py-2 text-sm focus-visible:ring-2\"\n aria-label=\"Close navigation\"\n onClick={onClose}\n >\n Close\n </button>\n <ScrollArea\n style={{ height: \"calc(100% - 4rem)\" }}\n viewportProps={{ \"aria-label\": \"Navigation links\" }}\n >\n {children}\n </ScrollArea>\n </dialog>\n );\n}\n",
|
|
30
|
+
"type": "registry:ui"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "components/uibot/preview-scope.ts",
|
|
34
|
+
"target": "components/uibot/preview-scope.ts",
|
|
35
|
+
"content": "/**\n * Page frames (`PageLayout`) fill the viewport so only their main area scrolls. Hosts that embed a\n * rendered page in a smaller pane mark the pane with `data-uibot-preview-scope`; inside it the frame\n * fills the pane instead of the viewport: wrappers between the pane and the frame become a flex column\n * chain, so a pane that is a flex column with a definite height hands the frame exactly the space\n * left under any sibling (such as a notice strip). Without such a pane the frame falls back to\n * `height:100%`, and to content height when that is not definite either. The pane also becomes the\n * containing block for fixed-position content such as floating toasts. Native modal navigation\n * escapes that containment and uses containPreviewNavigationDialog for its visible bounds.\n */\nexport const PREVIEW_SCOPE_CSS =\n \"[data-uibot-preview-dialog]::backdrop{clip-path:inset(var(--uibot-preview-backdrop-inset))}[data-uibot-preview-scope]{contain:layout}[data-uibot-preview-scope] .uibot-admin,[data-uibot-preview-scope] .uibot-page-layout{height:100%;min-height:0;flex:1 1 0}[data-uibot-preview-scope] div:has(.uibot-admin),[data-uibot-preview-scope] div:has(.uibot-page-layout){display:flex;flex-direction:column;min-height:0;flex:1 1 0}\";\n\n/**\n * shadcn/ui Scroll Area look for every scroll container inside a page frame (content area, sidebar,\n * table wrappers, dialogs): a slim 10px track with a rounded, theme-aware thumb. This styles the\n * native scrollbar so it matches shadcn's `ScrollArea`; it does not load Radix.\n */\nexport const SCROLLBAR_CSS =\n \".uibot-admin,.uibot-admin *,.uibot-page-layout,.uibot-page-layout *{scrollbar-width:thin;scrollbar-color:color-mix(in srgb,currentColor 28%,transparent) transparent}.uibot-admin ::-webkit-scrollbar,.uibot-page-layout ::-webkit-scrollbar{width:10px;height:10px}.uibot-admin ::-webkit-scrollbar-track,.uibot-page-layout ::-webkit-scrollbar-track{background:transparent}.uibot-admin ::-webkit-scrollbar-thumb,.uibot-page-layout ::-webkit-scrollbar-thumb{border:2px solid transparent;border-radius:9999px;background:color-mix(in srgb,currentColor 28%,transparent);background-clip:padding-box}.uibot-admin ::-webkit-scrollbar-thumb:hover,.uibot-page-layout ::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb,currentColor 45%,transparent);background-clip:padding-box}.uibot-admin ::-webkit-scrollbar-corner,.uibot-page-layout ::-webkit-scrollbar-corner{background:transparent}\";\n\n/** Native modal dialogs escape layout containment; navigation stays in its host preview. */\nexport function containPreviewNavigationDialog(dialog: HTMLDialogElement, inset = 0): () => void {\n const scope = dialog.closest<HTMLElement>(\"[data-uibot-preview-scope]\");\n if (!scope) return () => {};\n const originalStyle = dialog.getAttribute(\"style\");\n const originalVisibility = dialog.style.visibility;\n const originalMarker = dialog.getAttribute(\"data-uibot-preview-dialog\");\n dialog.setAttribute(\"data-uibot-preview-dialog\", \"\");\n let active = true;\n const sync = () => {\n if (!active) return;\n const rect = scope.getBoundingClientRect();\n const left = Math.max(0, rect.left),\n top = Math.max(0, rect.top);\n const right = Math.min(window.innerWidth, rect.right);\n const bottom = Math.min(window.innerHeight, rect.bottom);\n const width = right - left,\n height = bottom - top;\n if (width <= 0 || height <= 0) {\n dialog.style.visibility = \"hidden\";\n dialog.style.setProperty(\"--uibot-preview-backdrop-inset\", \"100% 100% 0px 0px\");\n return;\n }\n dialog.style.visibility = originalVisibility;\n const gap = Math.min(inset, width / 4, height / 4);\n const maxWidth = Math.max(0, Math.min(width * 0.85, width - gap * 2));\n const rtl = getComputedStyle(dialog).direction === \"rtl\";\n Object.assign(dialog.style, {\n position: \"fixed\",\n top: `${top + gap}px`,\n bottom: \"auto\",\n left: rtl ? \"auto\" : `${left + gap}px`,\n right: rtl ? `${window.innerWidth - right + gap}px` : \"auto\",\n height: `${height - gap * 2}px`,\n maxHeight: `${height - gap * 2}px`,\n maxWidth: `${maxWidth}px`,\n margin: \"0px\",\n });\n dialog.style.setProperty(\n \"--uibot-preview-backdrop-inset\",\n `${top}px ${window.innerWidth - right}px ${window.innerHeight - bottom}px ${left}px`,\n );\n };\n sync();\n const observer = typeof ResizeObserver === \"undefined\" ? undefined : new ResizeObserver(sync);\n observer?.observe(scope);\n window.addEventListener(\"resize\", sync);\n window.addEventListener(\"scroll\", sync, true);\n return () => {\n active = false;\n observer?.disconnect();\n window.removeEventListener(\"resize\", sync);\n window.removeEventListener(\"scroll\", sync, true);\n if (originalStyle === null) dialog.removeAttribute(\"style\");\n else dialog.setAttribute(\"style\", originalStyle);\n if (originalMarker === null) dialog.removeAttribute(\"data-uibot-preview-dialog\");\n else dialog.setAttribute(\"data-uibot-preview-dialog\", originalMarker);\n };\n}\n",
|
|
36
|
+
"type": "registry:ui"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "components/uibot/scroll-area.tsx",
|
|
40
|
+
"target": "components/uibot/scroll-area.tsx",
|
|
41
|
+
"content": "// Adapted from shadcn/ui Scroll Area (MIT).\nimport type { ComponentProps } from \"react\";\nimport { ScrollArea as Primitive } from \"radix-ui\";\n\nconst styles = `\n.uibot-scroll-area{position:relative;min-width:0;min-height:0;overflow:hidden}\n.uibot-scroll-viewport{width:100%;height:100%;max-height:inherit;border-radius:inherit;outline:none}\n.uibot-scroll-viewport:focus-visible{outline:2px solid var(--ring,#94a3b8);outline-offset:-2px}\n.uibot-scroll-viewport>div{display:block!important;min-width:100%}\n.uibot-scroll-area[data-fill-content=true]>.uibot-scroll-viewport>div{display:flex!important;flex-direction:column;min-height:100%}\n.uibot-scroll-area[data-scrollbars=horizontal]>.uibot-scroll-viewport{height:auto}\n.uibot-scrollbar{display:flex;touch-action:none;user-select:none;padding:1px;z-index:20}\n.uibot-scrollbar[data-orientation=vertical]{width:10px;border-inline-start:1px solid transparent}\n.uibot-scrollbar[data-orientation=horizontal]{height:10px;flex-direction:column;border-top:1px solid transparent}\n.uibot-scroll-thumb{position:relative;flex:1;border-radius:9999px;background:var(--nui-border,var(--border,#d4d4d8))}\n.uibot-scroll-thumb:hover,.uibot-scrollbar[data-state=visible]:active .uibot-scroll-thumb{background:var(--muted-foreground,#71717a)}\n`;\n\n/** Shared presentation primitive; refs and scroll events belong to the actual viewport. */\nexport function ScrollArea({\n children,\n className,\n scrollbars = \"vertical\",\n viewportProps,\n fillContent = false,\n ...props\n}: ComponentProps<typeof Primitive.Root> & {\n scrollbars?: \"vertical\" | \"horizontal\" | \"both\";\n viewportProps?: ComponentProps<typeof Primitive.Viewport>;\n fillContent?: boolean;\n}) {\n const { className: viewportClassName, ...viewportRest } = viewportProps ?? {};\n return (\n <Primitive.Root\n data-slot=\"scroll-area\"\n data-scrollbars={scrollbars}\n data-fill-content={fillContent}\n className={`uibot-scroll-area ${className ?? \"\"}`}\n type=\"auto\"\n {...props}\n >\n <style>{styles}</style>\n <Primitive.Viewport\n data-slot=\"scroll-area-viewport\"\n className={`uibot-scroll-viewport ${viewportClassName ?? \"\"}`}\n tabIndex={0}\n {...viewportRest}\n >\n {children}\n </Primitive.Viewport>\n {scrollbars !== \"horizontal\" && <ScrollBar />}\n {scrollbars !== \"vertical\" && <ScrollBar orientation=\"horizontal\" />}\n <Primitive.Corner />\n </Primitive.Root>\n );\n}\n\nexport function ScrollBar({\n className,\n orientation = \"vertical\",\n ...props\n}: ComponentProps<typeof Primitive.Scrollbar>) {\n return (\n <Primitive.Scrollbar\n data-slot=\"scroll-area-scrollbar\"\n orientation={orientation}\n className={`uibot-scrollbar ${className ?? \"\"}`}\n {...props}\n >\n <Primitive.Thumb data-slot=\"scroll-area-thumb\" className=\"uibot-scroll-thumb\" />\n </Primitive.Scrollbar>\n );\n}\n",
|
|
29
42
|
"type": "registry:ui"
|
|
30
43
|
},
|
|
31
44
|
{
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
{
|
|
22
22
|
"path": "components/uibot/form-controls.tsx",
|
|
23
23
|
"target": "components/uibot/form-controls.tsx",
|
|
24
|
-
"content": "import { type ReactNode, useCallback, useRef, useState } from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport { Popover as PopoverPrimitive, Select as SelectPrimitive } from \"radix-ui\";\nimport { DayPicker } from \"react-day-picker\";\n\n/** Same field surface as the other Form.* controls (shadcn Input). */\nconst triggerBase =\n \"flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 py-2 text-left text-sm text-foreground shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground\";\n\nconst popoverSurface =\n \"z-50 rounded-md border bg-popover text-popover-foreground shadow-md outline-none\";\n\nfunction Chevron({ className }: { className?: string }) {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n aria-hidden=\"true\"\n >\n <path d=\"m4 6 4 4 4-4\" />\n </svg>\n );\n}\n\n/** Frame that owns the theme (dark class, tokens): portalled content mounts inside it. */\nfunction useThemeContainer() {\n const [container, setContainer] = useState<HTMLElement | undefined>(undefined);\n const ref = useCallback((node: HTMLElement | null) => {\n setContainer(\n (node?.closest(\"[data-uibot-type='PageLayout']\") as HTMLElement | null) ?? undefined,\n );\n }, []);\n return [container, ref] as const;\n}\n\nexport interface SelectOption {\n value: string;\n label: string;\n}\n\nexport interface FormSelectControlProps {\n id: string;\n name: string;\n options: SelectOption[];\n placeholder: string;\n /** Present for controlled use (`_bindState`); omit to let the control hold its own value. */\n value?: string;\n defaultValue?: string;\n required?: boolean;\n disabled?: boolean;\n onValueChange?: ((value: string, element: HTMLElement) => void) | undefined;\n}\n\n/**\n * shadcn/ui Select (Radix). Radix renders a hidden native `<select name>` inside forms, so native\n * form values, `required` validation and the bubbling `change` event the Form block listens to keep\n * working.\n */\nexport function FormSelectControl(props: FormSelectControlProps) {\n const [container, triggerRef] = useThemeContainer();\n const triggerEl = useRef<HTMLButtonElement | null>(null);\n // Radix rejects empty-string items; an empty value means \"no selection\" and is the placeholder.\n const options = props.options.filter((option) => option.value !== \"\");\n return (\n <SelectPrimitive.Root\n name={props.name}\n {...(props.value !== undefined\n ? { value: props.value === \"\" ? undefined : props.value }\n : props.defaultValue\n ? { defaultValue: props.defaultValue }\n : {})}\n {...(props.required ? { required: true } : {})}\n {...(props.disabled ? { disabled: true } : {})}\n onValueChange={(value) => props.onValueChange?.(value, triggerEl.current as HTMLElement)}\n >\n <SelectPrimitive.Trigger\n id={props.id}\n ref={(node) => {\n triggerEl.current = node;\n triggerRef(node);\n }}\n className={triggerBase}\n >\n <SelectPrimitive.Value placeholder={props.placeholder} />\n <SelectPrimitive.Icon asChild>\n <Chevron className=\"size-4 shrink-0 opacity-50\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n <SelectPrimitive.Portal {...(container ? { container } : {})}>\n <SelectPrimitive.Content\n position=\"popper\"\n sideOffset={4}\n className={cn(\n popoverSurface,\n \"max-h-80 min-w-[var(--radix-select-trigger-width)] overflow-hidden\",\n )}\n >\n <SelectPrimitive.Viewport className=\"p-1\">\n {options.map((option) => (\n <SelectPrimitive.Item\n key={option.value}\n value={option.value}\n className=\"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\"\n >\n <SelectPrimitive.ItemText>{option.label}</SelectPrimitive.ItemText>\n <SelectPrimitive.ItemIndicator className=\"absolute right-2 flex size-3.5 items-center justify-center\">\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m3.5 8.5 3 3 6-7\" />\n </svg>\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n ))}\n </SelectPrimitive.Viewport>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n </SelectPrimitive.Root>\n );\n}\n\nconst ISO_DATE = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\n\n/** Parse `yyyy-MM-dd` as a local calendar date (no time zone shift). */\nfunction parseIsoDate(value: string): Date | undefined {\n const match = ISO_DATE.exec(value);\n if (!match) return undefined;\n const date = new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n return Number.isNaN(date.getTime()) ? undefined : date;\n}\n\nfunction toIsoDate(date: Date): string {\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n return `${String(date.getFullYear()).padStart(4, \"0\")}-${month}-${day}`;\n}\n\nexport interface FormDateControlProps {\n id: string;\n name: string;\n placeholder?: string;\n /** Controlled value (`yyyy-MM-dd`); omit to let the control hold its own. */\n value?: string;\n defaultValue?: string;\n required?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n invalid?: boolean;\n describedBy?: string;\n onValueChange?: ((value: string, element: HTMLElement) => void) | undefined;\n}\n\n/**\n * shadcn/ui date picker: a Popover with a Calendar (react-day-picker). The value stays an ISO\n * `yyyy-MM-dd` string. A visually hidden text input carries the name and value so the surrounding\n * Form collects it, runs native `required` validation (focus is handed to the trigger) and sees a\n * bubbling `input` event when the date changes.\n */\nexport function FormDateControl(props: FormDateControlProps) {\n const [container, popoverRef] = useThemeContainer();\n const [internal, setInternal] = useState(props.defaultValue ?? \"\");\n const [open, setOpen] = useState(false);\n const proxy = useRef<HTMLInputElement | null>(null);\n const trigger = useRef<HTMLButtonElement | null>(null);\n const value = props.value !== undefined ? props.value : internal;\n const selected = parseIsoDate(value);\n const interactive = !props.disabled && !props.readOnly;\n\n const commit = (next: string) => {\n setInternal(next);\n const input = proxy.current;\n if (input) {\n // Let the Form block see a native bubbling event, as it does for text inputs.\n const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, \"value\")?.set;\n setter?.call(input, next);\n input.dispatchEvent(new Event(\"input\", { bubbles: true }));\n }\n props.onValueChange?.(next, input ?? (trigger.current as HTMLElement));\n };\n\n let label: ReactNode = props.placeholder ?? \"Pick a date\";\n if (selected) {\n label = new Intl.DateTimeFormat(undefined, { dateStyle: \"medium\" }).format(selected);\n }\n return (\n <PopoverPrimitive.Root open={interactive && open} onOpenChange={setOpen}>\n <div className=\"relative\">\n <PopoverPrimitive.Trigger asChild>\n <button\n id={props.id}\n ref={(node) => {\n trigger.current = node;\n popoverRef(node);\n }}\n type=\"button\"\n disabled={props.disabled}\n aria-invalid={props.invalid ? true : undefined}\n aria-describedby={props.describedBy}\n data-placeholder={selected ? undefined : \"\"}\n className={cn(triggerBase, !interactive && \"cursor-default\")}\n >\n <span className=\"flex items-center gap-2\">\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"size-4 shrink-0 opacity-60\"\n aria-hidden=\"true\"\n >\n <rect x=\"2\" y=\"3\" width=\"12\" height=\"11\" rx=\"2\" />\n <path d=\"M2 6.5h12M5.5 1.5v3M10.5 1.5v3\" />\n </svg>\n {label}\n </span>\n </button>\n </PopoverPrimitive.Trigger>\n <input\n ref={proxy}\n type=\"text\"\n name={props.name}\n value={value}\n onChange={() => undefined}\n required={props.required}\n disabled={props.disabled}\n tabIndex={-1}\n aria-hidden=\"true\"\n onFocus={() => trigger.current?.focus()}\n className=\"pointer-events-none absolute inset-0 h-full w-full opacity-0\"\n />\n </div>\n <PopoverPrimitive.Portal {...(container ? { container } : {})}>\n <PopoverPrimitive.Content\n align=\"start\"\n sideOffset={4}\n className={cn(popoverSurface, \"w-auto p-3\")}\n >\n <DayPicker\n mode=\"single\"\n showOutsideDays\n {...(selected ? { selected, defaultMonth: selected } : {})}\n onSelect={(date) => {\n if (!date) return;\n commit(toIsoDate(date));\n setOpen(false);\n trigger.current?.focus();\n }}\n classNames={{\n root: \"relative text-sm\",\n months: \"relative flex flex-col gap-4\",\n month: \"flex flex-col gap-3\",\n month_caption: \"flex h-8 items-center justify-center px-8 font-medium\",\n nav: \"absolute inset-x-0 top-0 flex items-center justify-between\",\n button_previous:\n \"inline-flex size-8 items-center justify-center rounded-md border border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50\",\n button_next:\n \"inline-flex size-8 items-center justify-center rounded-md border border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50\",\n month_grid: \"w-full border-collapse\",\n weekdays: \"flex\",\n weekday: \"w-9 text-[0.8rem] font-normal text-muted-foreground\",\n week: \"mt-1 flex w-full\",\n day: \"relative size-9 p-0 text-center\",\n day_button:\n \"inline-flex size-9 items-center justify-center rounded-md text-sm font-normal hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50\",\n selected:\n \"[&>button]:bg-primary [&>button]:text-primary-foreground [&>button:hover]:bg-primary [&>button:hover]:text-primary-foreground\",\n today: \"[&>button]:bg-accent [&>button]:text-accent-foreground\",\n outside: \"[&>button]:text-muted-foreground [&>button]:opacity-50\",\n disabled: \"[&>button]:opacity-40\",\n hidden: \"invisible\",\n }}\n />\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n );\n}\n",
|
|
24
|
+
"content": "import { type ReactNode, useCallback, useRef, useState } from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport { Popover as PopoverPrimitive, Select as SelectPrimitive } from \"radix-ui\";\nimport { DayPicker } from \"react-day-picker\";\n\n/** Same field surface as the other Form.* controls (shadcn Input). */\nconst triggerBase =\n \"flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 py-2 text-left text-sm text-foreground shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground\";\n\nconst popoverSurface =\n \"z-50 rounded-md border bg-popover text-popover-foreground shadow-md outline-none\";\n\nfunction Chevron({ className }: { className?: string }) {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n aria-hidden=\"true\"\n >\n <path d=\"m4 6 4 4 4-4\" />\n </svg>\n );\n}\n\n/** Preserve the native modal's top layer, or the owning frame's theme. */\nfunction useThemeContainer() {\n const [container, setContainer] = useState<HTMLElement | undefined>(undefined);\n const ref = useCallback((node: HTMLElement | null) => {\n setContainer(\n (node?.closest(\"dialog, [data-uibot-type='PageLayout']\") as HTMLElement | null) ?? undefined,\n );\n }, []);\n return [container, ref] as const;\n}\n\nexport interface SelectOption {\n value: string;\n label: string;\n}\n\nexport interface FormSelectControlProps {\n id: string;\n name: string;\n options: SelectOption[];\n placeholder: string;\n /** Present for controlled use (`_bindState`); omit to let the control hold its own value. */\n value?: string;\n defaultValue?: string;\n required?: boolean;\n disabled?: boolean;\n onValueChange?: ((value: string, element: HTMLElement) => void) | undefined;\n}\n\n/**\n * shadcn/ui Select (Radix). Radix renders a hidden native `<select name>` inside forms, so native\n * form values, `required` validation and the bubbling `change` event the Form block listens to keep\n * working.\n */\nexport function FormSelectControl(props: FormSelectControlProps) {\n const [container, triggerRef] = useThemeContainer();\n const [internalValue, setInternalValue] = useState(props.defaultValue ?? \"\");\n const triggerEl = useRef<HTMLButtonElement | null>(null);\n // Radix rejects empty-string items; an empty value means \"no selection\" and is the placeholder.\n const options = props.options.filter((option) => option.value !== \"\");\n return (\n <SelectPrimitive.Root\n name={props.name}\n dir={container?.closest(\"[dir]\")?.getAttribute(\"dir\") === \"rtl\" ? \"rtl\" : \"ltr\"}\n {...(props.value !== undefined\n ? { value: props.value }\n : props.defaultValue\n ? { defaultValue: props.defaultValue }\n : {})}\n {...(props.required ? { required: true } : {})}\n {...(props.disabled ? { disabled: true } : {})}\n onValueChange={(value) => {\n setInternalValue(value);\n props.onValueChange?.(value, triggerEl.current as HTMLElement);\n }}\n >\n <SelectPrimitive.Trigger\n id={props.id}\n ref={(node) => {\n triggerEl.current = node;\n triggerRef(node);\n }}\n className={triggerBase}\n >\n <SelectPrimitive.Value placeholder={props.placeholder}>\n {options.find((option) => option.value === (props.value ?? internalValue))?.label}\n </SelectPrimitive.Value>\n <SelectPrimitive.Icon asChild>\n <Chevron className=\"size-4 shrink-0 opacity-50\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n <SelectPrimitive.Portal {...(container ? { container } : {})}>\n <SelectPrimitive.Content\n position=\"popper\"\n sideOffset={4}\n className={cn(\n popoverSurface,\n \"max-h-80 min-w-[var(--radix-select-trigger-width)] overflow-hidden\",\n )}\n >\n <SelectPrimitive.Viewport className=\"p-1\">\n {options.map((option) => (\n <SelectPrimitive.Item\n key={option.value}\n value={option.value}\n className=\"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\"\n >\n <SelectPrimitive.ItemText>{option.label}</SelectPrimitive.ItemText>\n <SelectPrimitive.ItemIndicator className=\"absolute right-2 flex size-3.5 items-center justify-center\">\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m3.5 8.5 3 3 6-7\" />\n </svg>\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n ))}\n </SelectPrimitive.Viewport>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n </SelectPrimitive.Root>\n );\n}\n\nconst ISO_DATE = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\n\n/** Parse `yyyy-MM-dd` as a local calendar date (no time zone shift). */\nfunction parseIsoDate(value: string): Date | undefined {\n const match = ISO_DATE.exec(value);\n if (!match) return undefined;\n const date = new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n return Number.isNaN(date.getTime()) ? undefined : date;\n}\n\nfunction toIsoDate(date: Date): string {\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n return `${String(date.getFullYear()).padStart(4, \"0\")}-${month}-${day}`;\n}\n\nexport interface FormDateControlProps {\n id: string;\n name: string;\n placeholder?: string;\n /** Controlled value (`yyyy-MM-dd`); omit to let the control hold its own. */\n value?: string;\n defaultValue?: string;\n required?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n invalid?: boolean;\n describedBy?: string;\n onValueChange?: ((value: string, element: HTMLElement) => void) | undefined;\n}\n\n/**\n * shadcn/ui date picker: a Popover with a Calendar (react-day-picker). The value stays an ISO\n * `yyyy-MM-dd` string. A visually hidden text input carries the name and value so the surrounding\n * Form collects it, runs native `required` validation (focus is handed to the trigger) and sees a\n * bubbling `input` event when the date changes.\n */\nexport function FormDateControl(props: FormDateControlProps) {\n const [container, popoverRef] = useThemeContainer();\n const [internal, setInternal] = useState(props.defaultValue ?? \"\");\n const [open, setOpen] = useState(false);\n const proxy = useRef<HTMLInputElement | null>(null);\n const trigger = useRef<HTMLButtonElement | null>(null);\n const value = props.value !== undefined ? props.value : internal;\n const selected = parseIsoDate(value);\n const interactive = !props.disabled && !props.readOnly;\n\n const commit = (next: string) => {\n setInternal(next);\n const input = proxy.current;\n if (input) {\n // Let the Form block see a native bubbling event, as it does for text inputs.\n const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, \"value\")?.set;\n setter?.call(input, next);\n input.dispatchEvent(new Event(\"input\", { bubbles: true }));\n }\n props.onValueChange?.(next, input ?? (trigger.current as HTMLElement));\n };\n\n let label: ReactNode = props.placeholder ?? \"Pick a date\";\n if (selected) {\n label = new Intl.DateTimeFormat(undefined, { dateStyle: \"medium\" }).format(selected);\n }\n return (\n <PopoverPrimitive.Root open={interactive && open} onOpenChange={setOpen}>\n <div className=\"relative\">\n <PopoverPrimitive.Trigger asChild>\n <button\n id={props.id}\n ref={(node) => {\n trigger.current = node;\n popoverRef(node);\n }}\n type=\"button\"\n disabled={props.disabled}\n aria-invalid={props.invalid ? true : undefined}\n aria-describedby={props.describedBy}\n data-placeholder={selected ? undefined : \"\"}\n className={cn(triggerBase, !interactive && \"cursor-default\")}\n >\n <span className=\"flex items-center gap-2\">\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"size-4 shrink-0 opacity-60\"\n aria-hidden=\"true\"\n >\n <rect x=\"2\" y=\"3\" width=\"12\" height=\"11\" rx=\"2\" />\n <path d=\"M2 6.5h12M5.5 1.5v3M10.5 1.5v3\" />\n </svg>\n {label}\n </span>\n </button>\n </PopoverPrimitive.Trigger>\n <input\n ref={proxy}\n type=\"text\"\n name={props.name}\n value={value}\n onChange={() => undefined}\n required={props.required}\n disabled={props.disabled}\n tabIndex={-1}\n aria-hidden=\"true\"\n onFocus={() => trigger.current?.focus()}\n className=\"pointer-events-none absolute inset-0 h-full w-full opacity-0\"\n />\n </div>\n <PopoverPrimitive.Portal {...(container ? { container } : {})}>\n <PopoverPrimitive.Content\n align=\"start\"\n sideOffset={4}\n className={cn(popoverSurface, \"w-auto p-3\")}\n >\n <DayPicker\n mode=\"single\"\n showOutsideDays\n {...(selected ? { selected, defaultMonth: selected } : {})}\n onSelect={(date) => {\n if (!date) return;\n commit(toIsoDate(date));\n setOpen(false);\n trigger.current?.focus();\n }}\n classNames={{\n root: \"relative text-sm\",\n months: \"relative flex flex-col gap-4\",\n month: \"flex flex-col gap-3\",\n month_caption: \"flex h-8 items-center justify-center px-8 font-medium\",\n nav: \"absolute inset-x-0 top-0 flex items-center justify-between\",\n button_previous:\n \"inline-flex size-8 items-center justify-center rounded-md border border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50\",\n button_next:\n \"inline-flex size-8 items-center justify-center rounded-md border border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50\",\n month_grid: \"w-full border-collapse\",\n weekdays: \"flex\",\n weekday: \"w-9 text-[0.8rem] font-normal text-muted-foreground\",\n week: \"mt-1 flex w-full\",\n day: \"relative size-9 p-0 text-center\",\n day_button:\n \"inline-flex size-9 items-center justify-center rounded-md text-sm font-normal hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50\",\n selected:\n \"[&>button]:bg-primary [&>button]:text-primary-foreground [&>button:hover]:bg-primary [&>button:hover]:text-primary-foreground\",\n today: \"[&>button]:bg-accent [&>button]:text-accent-foreground\",\n outside: \"[&>button]:text-muted-foreground [&>button]:opacity-50\",\n disabled: \"[&>button]:opacity-40\",\n hidden: \"invisible\",\n }}\n />\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n );\n}\n",
|
|
25
25
|
"type": "registry:ui"
|
|
26
26
|
},
|
|
27
27
|
{
|