@nextclaw/ui 0.12.9 → 0.12.11
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/CHANGELOG.md +102 -0
- package/dist/assets/ChannelsList-SQ7Oxotv.js +8 -0
- package/dist/assets/DocBrowser-BCO2k6XD.js +1 -0
- package/dist/assets/{DocBrowser-6ReNjvzF.js → DocBrowser-rDOjI3ga.js} +1 -1
- package/dist/assets/{DocBrowserContext-B6SpA7Qs.js → DocBrowserContext-BUq3Wo8O.js} +1 -1
- package/dist/assets/{LogoBadge-ByNLYg65.js → LogoBadge-DP8Ye7wJ.js} +1 -1
- package/dist/assets/ModelConfig-C77Ae9ru.js +1 -0
- package/dist/assets/ProviderScopedModelInput-CEnK61uo.js +1 -0
- package/dist/assets/ProvidersList-BCupBayq.js +1 -0
- package/dist/assets/RuntimeConfig-Ad-CAcmy.js +1 -0
- package/dist/assets/SearchConfig-BfCz4wJ4.js +1 -0
- package/dist/assets/SecretsConfig-DjmBIhyy.js +3 -0
- package/dist/assets/{SessionsConfig-ChHQ7M5c.js → SessionsConfig-CvjxU40H.js} +2 -2
- package/dist/assets/{book-open-BdcxxoQu.js → book-open-BE8M56IM.js} +1 -1
- package/dist/assets/chat-page-JKC6ln-y.js +58 -0
- package/dist/assets/chat-session-display-YcRMrAMa.js +1 -0
- package/dist/assets/{chunk-JZWAC4HX-DK5HPmIK.js → chunk-JZWAC4HX-erTUn3b8.js} +1 -1
- package/dist/assets/client-CszWMVKi.js +7 -0
- package/dist/assets/config-split-page-BAGSzUR3.js +1 -0
- package/dist/assets/{createLucideIcon-BSeTgkZW.js → createLucideIcon-CCiTGX8L.js} +1 -1
- package/dist/assets/desktop-DfkLlkG2.js +1 -0
- package/dist/assets/desktop-update-config-BXeGlqHD.js +1 -0
- package/dist/assets/dialog-BghZFPch.js +5 -0
- package/dist/assets/{dist-6TrrnPCR.js → dist-Dd9cr-kz.js} +1 -1
- package/dist/assets/dist-ZwoAXs46.js +9 -0
- package/dist/assets/{download-BhDxnyvU.js → download-D7LOizcW.js} +1 -1
- package/dist/assets/es2015-CEAreese.js +41 -0
- package/dist/assets/{external-link-BgErLCNT.js → external-link-qsnCMhw1.js} +1 -1
- package/dist/assets/{hash-Bl7dr_UG.js → hash-0zjWsNl-.js} +1 -1
- package/dist/assets/{i18n-eDHeDY0n.js → i18n-DvzXOGQX.js} +1 -1
- package/dist/assets/index-DvVTC9FF.css +1 -0
- package/dist/assets/index-lr6rQUSd.js +2 -0
- package/dist/assets/key-round-BLe9D8ND.js +1 -0
- package/dist/assets/loader-circle-wj7kARHv.js +1 -0
- package/dist/assets/{logos-x89HbrZ4.js → logos-_v5b2SdG.js} +1 -1
- package/dist/assets/marketplace-page-CAAk1Khc.js +1 -0
- package/dist/assets/marketplace-page-CfCiq90S.js +49 -0
- package/dist/assets/mcp-marketplace-page-D0Pp9Hs-.js +40 -0
- package/dist/assets/play-o6NmwGTi.js +1 -0
- package/dist/assets/plus-I9pBS4Fl.js +1 -0
- package/dist/assets/{refresh-cw-C47QSEwg.js → refresh-cw-MNqgR3LZ.js} +1 -1
- package/dist/assets/remote-C9fXm4V5.js +1 -0
- package/dist/assets/{save-3S6-H3Xw.js → save-D4bObrmH.js} +1 -1
- package/dist/assets/search-DxmL3IWE.js +1 -0
- package/dist/assets/security-config-BUm6FFfl.js +1 -0
- package/dist/assets/select-BILPf7zs.js +1 -0
- package/dist/assets/setting-row-BATDgg4r.js +1 -0
- package/dist/assets/skeleton-COKMAnJy.js +1 -0
- package/dist/assets/{switch-BsLtHOH-.js → switch-CBOzecWS.js} +1 -1
- package/dist/assets/{tabs-custom-D3HYMt6k.js → tabs-custom-Bx3cNhD-.js} +1 -1
- package/dist/assets/tag-chip-zUaDE2-H.js +1 -0
- package/dist/assets/{trash-2-G48scll7.js → trash-2-CQUgYyRn.js} +1 -1
- package/dist/assets/use-infinite-scroll-loader-B5V2Klve.js +1 -0
- package/dist/assets/useConfirmDialog-patAnl1g.js +1 -0
- package/dist/assets/{useMutation-CBWjE2uj.js → useMutation-__AYv-Pz.js} +1 -1
- package/dist/assets/x-BHUGQIUv.js +1 -0
- package/dist/index.html +22 -22
- package/dist/runtime-icons/claude.ico +0 -0
- package/dist/runtime-icons/codex-openai.svg +6 -0
- package/dist/runtime-icons/hermes-agent.png +0 -0
- package/module-structure.config.json +7 -0
- package/package.json +6 -6
- package/public/runtime-icons/claude.ico +0 -0
- package/public/runtime-icons/codex-openai.svg +6 -0
- package/public/runtime-icons/hermes-agent.png +0 -0
- package/src/api/chat-session-type.types.ts +7 -0
- package/src/api/config.ts +10 -0
- package/src/api/raw-client.test.ts +1 -1
- package/src/api/{raw-client.ts → raw-client.utils.ts} +2 -0
- package/src/api/runtime-control.types.ts +8 -0
- package/src/api/types.ts +48 -0
- package/src/app/components/app-manager-provider.tsx +20 -0
- package/src/app/managers/app.manager.ts +12 -0
- package/src/app.tsx +223 -59
- package/src/components/agents/agent-dialogs.tsx +499 -0
- package/src/components/agents/agents-page.test.tsx +238 -0
- package/src/components/agents/agents-page.tsx +435 -0
- package/src/components/chat/chat-conversation-panel.test.tsx +30 -0
- package/src/components/chat/chat-conversation-panel.tsx +83 -13
- package/src/components/chat/chat-input/ncp-chat-input-availability.utils.test.ts +92 -0
- package/src/components/chat/chat-input/ncp-chat-input-availability.utils.ts +45 -0
- package/src/components/chat/chat-page-shell.tsx +19 -13
- package/src/components/chat/chat-session-type-option-item.test.tsx +46 -0
- package/src/components/chat/chat-session-type-option-item.tsx +68 -0
- package/src/components/chat/chat-session-workspace-file-preview.test.tsx +87 -0
- package/src/components/chat/chat-session-workspace-file-preview.tsx +14 -43
- package/src/components/chat/chat-session-workspace-panel-nav.tsx +8 -2
- package/src/components/chat/chat-sidebar-project-groups.tsx +11 -36
- package/src/components/chat/containers/chat-input-bar.container.tsx +24 -12
- package/src/components/chat/{ChatSidebar.test.tsx → containers/chat-sidebar.test.tsx} +5 -4
- package/src/components/chat/{ChatSidebar.tsx → containers/chat-sidebar.tsx} +24 -72
- package/src/components/chat/hooks/use-chat-sidebar-session-label-editor.ts +49 -0
- package/src/components/chat/ncp/__tests__/ncp-session-adapter.cancelled-tool.test.ts +77 -0
- package/src/components/chat/ncp/ncp-app-client-fetch.ts +3 -0
- package/src/components/chat/ncp/ncp-chat-input.manager.ts +13 -5
- package/src/components/chat/ncp/ncp-chat-page.tsx +23 -2
- package/src/components/chat/ncp/ncp-session-adapter.test.ts +1 -0
- package/src/components/chat/ncp/ncp-session-adapter.ts +3 -0
- package/src/components/chat/ncp/page/ncp-chat-derived-state.ts +10 -4
- package/src/components/chat/ncp/session-conversation/use-ncp-session-conversation.test.tsx +48 -4
- package/src/components/chat/ncp/session-conversation/use-ncp-session-conversation.ts +43 -5
- package/src/components/chat/ncp/tests/ncp-chat-input.manager.test.ts +51 -1
- package/src/components/chat/stores/chat-input.store.ts +2 -1
- package/src/components/chat/stores/chat-thread.store.ts +3 -1
- package/src/components/chat/useChatSessionTypeState.ts +10 -1
- package/src/components/chat/workspace/chat-session-workspace-file-breadcrumbs.tsx +86 -0
- package/src/components/common/BrandHeader.tsx +3 -1
- package/src/components/common/session-context-icon.tsx +15 -2
- package/src/components/common/{TagInput.tsx → tag-input.tsx} +25 -17
- package/src/components/config/ChannelForm.test.tsx +89 -3
- package/src/components/config/ChannelForm.tsx +157 -188
- package/src/components/config/ChannelsList.test.tsx +163 -119
- package/src/components/config/ChannelsList.tsx +90 -101
- package/src/components/config/ProviderForm.tsx +108 -146
- package/src/components/config/ProvidersList.tsx +100 -123
- package/src/components/config/SearchConfig.tsx +423 -393
- package/src/components/config/channel-form-fields-section.tsx +70 -37
- package/src/components/config/config-split-page.tsx +109 -0
- package/src/components/config/desktop-update-config.test.tsx +10 -4
- package/src/components/config/desktop-update-config.tsx +5 -3
- package/src/components/config/provider-enabled-field.tsx +17 -10
- package/src/components/config/runtime-control-card.test.tsx +136 -158
- package/src/components/config/runtime-control-card.tsx +43 -68
- package/src/components/config/runtime-presence-card.test.tsx +10 -14
- package/src/components/config/runtime-presence-card.tsx +97 -81
- package/src/components/layout/AppLayout.tsx +25 -37
- package/src/components/layout/Sidebar.tsx +4 -4
- package/src/components/layout/app-layout.test.tsx +46 -14
- package/src/components/layout/runtime-status-entry.test.tsx +101 -0
- package/src/components/layout/runtime-status-entry.tsx +95 -0
- package/src/components/layout/sidebar.layout.test.tsx +11 -5
- package/src/components/marketplace/marketplace-detail-doc.ts +93 -0
- package/src/components/marketplace/marketplace-list-card.tsx +288 -0
- package/src/components/marketplace/marketplace-page-data.ts +129 -0
- package/src/components/marketplace/marketplace-page.test.tsx +339 -0
- package/src/components/marketplace/marketplace-page.tsx +596 -0
- package/src/components/marketplace/mcp/mcp-marketplace-card.tsx +128 -0
- package/src/components/marketplace/mcp/mcp-marketplace-dialogs.tsx +191 -0
- package/src/components/marketplace/mcp/mcp-marketplace-doc.ts +152 -0
- package/src/components/marketplace/mcp/mcp-marketplace-page.test.tsx +223 -0
- package/src/components/marketplace/mcp/mcp-marketplace-page.tsx +414 -0
- package/src/components/ui/notice-card.tsx +129 -0
- package/src/components/ui/setting-row.tsx +51 -0
- package/src/components/ui/tag-chip.tsx +39 -0
- package/src/components/ui/textarea.tsx +19 -0
- package/src/features/account/components/account-panel.tsx +255 -0
- package/src/features/account/index.ts +6 -0
- package/src/{account → features/account}/managers/account.manager.ts +6 -5
- package/src/features/remote/components/remote-access-page.test.tsx +104 -0
- package/src/features/remote/components/remote-access-page.tsx +250 -0
- package/src/{hooks/useRemoteAccess.ts → features/remote/hooks/use-remote-access.ts} +1 -1
- package/src/features/remote/index.ts +27 -0
- package/src/{remote → features/remote}/managers/remote-access.manager.ts +3 -4
- package/src/{remote → features/remote/services}/remote-access-feedback.service.test.ts +1 -1
- package/src/features/system-status/hooks/use-system-status.ts +104 -0
- package/src/features/system-status/index.ts +12 -0
- package/src/features/system-status/managers/system-status.manager.bootstrap-polling.test.ts +126 -0
- package/src/features/system-status/managers/system-status.manager.test.ts +142 -0
- package/src/features/system-status/managers/system-status.manager.ts +511 -0
- package/src/features/system-status/stores/system-status.store.ts +32 -0
- package/src/features/system-status/types/system-status.types.ts +73 -0
- package/src/features/system-status/utils/system-status.utils.test.ts +132 -0
- package/src/features/system-status/utils/system-status.utils.ts +202 -0
- package/src/hooks/use-realtime-query-bridge.ts +34 -18
- package/src/hooks/useConfig.ts +2 -1
- package/src/index.css +24 -0
- package/src/lib/app-resource-uri.test.ts +20 -0
- package/src/lib/app-resource-uri.ts +29 -0
- package/src/lib/i18n.chat.ts +8 -0
- package/src/lib/i18n.remote.ts +1 -1
- package/src/lib/i18n.runtime-control.ts +31 -0
- package/src/lib/i18n.ts +5 -8
- package/src/lib/session-context.utils.test.ts +71 -0
- package/src/lib/session-context.utils.ts +28 -3
- package/src/lib/session-project/workspace-file-breadcrumb.test.ts +83 -0
- package/src/lib/session-project/workspace-file-breadcrumb.ts +188 -0
- package/src/platforms/desktop/index.ts +20 -0
- package/src/{desktop → platforms/desktop}/managers/desktop-presence.manager.ts +2 -2
- package/src/{desktop → platforms/desktop}/managers/desktop-update.manager.ts +2 -2
- package/src/{desktop → platforms/desktop}/stores/desktop-presence.store.ts +1 -1
- package/src/{desktop → platforms/desktop}/stores/desktop-update.store.ts +1 -1
- package/src/stores/ui.store.ts +0 -9
- package/src/transport/{app-client.ts → app-client.service.ts} +9 -9
- package/src/transport/app-client.test.ts +9 -5
- package/src/transport/index.ts +1 -1
- package/src/transport/{local.transport.ts → local-transport.service.ts} +14 -12
- package/dist/assets/ChannelsList-Ita2Zm1_.js +0 -8
- package/dist/assets/DocBrowser-BNwbPHf4.js +0 -1
- package/dist/assets/MarketplacePage-CjX2MWww.js +0 -1
- package/dist/assets/MarketplacePage-D0sDlYX4.js +0 -49
- package/dist/assets/McpMarketplacePage-BGKJm1sJ.js +0 -40
- package/dist/assets/ModelConfig-BzZenCH-.js +0 -1
- package/dist/assets/ProviderScopedModelInput-Da7khnBA.js +0 -1
- package/dist/assets/ProvidersList-BbVzRxjY.js +0 -1
- package/dist/assets/RemoteAccessPage-BaDH_X1Q.js +0 -1
- package/dist/assets/RuntimeConfig-F_XKGgLm.js +0 -1
- package/dist/assets/SearchConfig-BGkzXQP-.js +0 -1
- package/dist/assets/SecretsConfig-D281Rotl.js +0 -3
- package/dist/assets/app-query-client-VnFElj4E.js +0 -1
- package/dist/assets/chat-page-Doe0yTtB.js +0 -58
- package/dist/assets/chat-session-display-cw78aiI_.js +0 -1
- package/dist/assets/client-_i4MU2bB.js +0 -7
- package/dist/assets/config-DtIQwrHF.js +0 -1
- package/dist/assets/config-layout-CHs0mAaR.js +0 -1
- package/dist/assets/desktop-update-config-Dpcf4BKG.js +0 -1
- package/dist/assets/dist-ccBFUi-o.js +0 -9
- package/dist/assets/index-CF9xve0E.js +0 -6
- package/dist/assets/index-FgA52VBt.css +0 -1
- package/dist/assets/infiniteQueryBehavior-ZDS92Qpp.js +0 -1
- package/dist/assets/loader-circle-ACM1s51e.js +0 -1
- package/dist/assets/page-layout-vZnghcFy.js +0 -1
- package/dist/assets/play-CFUwCA2E.js +0 -1
- package/dist/assets/plus-rYsv72JG.js +0 -1
- package/dist/assets/popover-Bg1VoTZ6.js +0 -1
- package/dist/assets/refresh-ccw-DT98i__E.js +0 -1
- package/dist/assets/rotate-cw-JtFzpNn6.js +0 -1
- package/dist/assets/search-3kFR_zh9.js +0 -1
- package/dist/assets/security-config-BWaiARNk.js +0 -1
- package/dist/assets/select-DJ2MUjBB.js +0 -41
- package/dist/assets/skeleton-ByQepn0M.js +0 -1
- package/dist/assets/status-dot-vbanNPFU.js +0 -1
- package/dist/assets/use-infinite-scroll-loader-DkNhD-42.js +0 -1
- package/dist/assets/useConfirmDialog-BkvTN-vd.js +0 -1
- package/dist/assets/x-ByDbItbq.js +0 -1
- package/src/account/components/account-panel.tsx +0 -135
- package/src/components/agents/AgentDialogs.tsx +0 -400
- package/src/components/agents/AgentsPage.test.tsx +0 -217
- package/src/components/agents/AgentsPage.tsx +0 -352
- package/src/components/config/config-layout.ts +0 -10
- package/src/components/marketplace/MarketplacePage.test.tsx +0 -322
- package/src/components/marketplace/MarketplacePage.tsx +0 -827
- package/src/components/marketplace/mcp/McpMarketplacePage.test.tsx +0 -208
- package/src/components/marketplace/mcp/McpMarketplacePage.tsx +0 -580
- package/src/components/remote/RemoteAccessPage.test.tsx +0 -103
- package/src/components/remote/RemoteAccessPage.tsx +0 -144
- package/src/hooks/use-runtime-control.ts +0 -24
- package/src/presenter/app-presenter-context.tsx +0 -20
- package/src/presenter/app.presenter.ts +0 -12
- package/src/runtime-control/runtime-control.manager.ts +0 -118
- /package/dist/assets/{config-hints-BhTmc9P1.js → config-hints-DSQQbeOA.js} +0 -0
- /package/src/{account → features/account}/stores/account.store.ts +0 -0
- /package/src/{remote → features/remote/services}/remote-access-feedback.service.ts +0 -0
- /package/src/{remote/remote-access.query.ts → features/remote/services/remote-access-query.service.ts} +0 -0
- /package/src/{remote → features/remote}/stores/remote-access.store.ts +0 -0
- /package/src/{desktop → platforms/desktop/types}/desktop-update.types.ts +0 -0
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
/* eslint-disable max-lines-per-function */
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { useMutation } from "@tanstack/react-query";
|
|
4
|
+
import type {
|
|
5
|
+
MarketplaceInstalledRecord,
|
|
6
|
+
MarketplaceItemSummary,
|
|
7
|
+
MarketplaceMcpDoctorResult,
|
|
8
|
+
MarketplaceSort,
|
|
9
|
+
} from "@/api/types";
|
|
10
|
+
import {
|
|
11
|
+
fetchMcpMarketplaceContent,
|
|
12
|
+
doctorMcpMarketplaceItem,
|
|
13
|
+
} from "@/api/mcp-marketplace";
|
|
14
|
+
import { PageHeader, PageLayout } from "@/components/layout/page-layout";
|
|
15
|
+
import {
|
|
16
|
+
MarketplaceInfiniteScrollStatus,
|
|
17
|
+
MarketplaceListSkeleton,
|
|
18
|
+
} from "@/components/marketplace/marketplace-page-parts";
|
|
19
|
+
import { buildLocaleFallbacks } from "@/components/marketplace/marketplace-localization";
|
|
20
|
+
import { McpMarketplaceCard } from "@/components/marketplace/mcp/mcp-marketplace-card";
|
|
21
|
+
import {
|
|
22
|
+
buildDocDataUrl,
|
|
23
|
+
buildInstalledRecordLookup,
|
|
24
|
+
findInstalledRecordForItem,
|
|
25
|
+
readSummary,
|
|
26
|
+
} from "@/components/marketplace/mcp/mcp-marketplace-doc";
|
|
27
|
+
import {
|
|
28
|
+
DoctorDialog,
|
|
29
|
+
InstallDialog,
|
|
30
|
+
} from "@/components/marketplace/mcp/mcp-marketplace-dialogs";
|
|
31
|
+
import { Tabs } from "@/components/ui/tabs-custom";
|
|
32
|
+
import { Input } from "@/components/ui/input";
|
|
33
|
+
import { NoticeCard } from "@/components/ui/notice-card";
|
|
34
|
+
import {
|
|
35
|
+
Select,
|
|
36
|
+
SelectContent,
|
|
37
|
+
SelectItem,
|
|
38
|
+
SelectTrigger,
|
|
39
|
+
SelectValue,
|
|
40
|
+
} from "@/components/ui/select";
|
|
41
|
+
import { useConfirmDialog } from "@/hooks/useConfirmDialog";
|
|
42
|
+
import {
|
|
43
|
+
useInstallMcpMarketplaceItem,
|
|
44
|
+
useManageMcpMarketplaceItem,
|
|
45
|
+
useMcpMarketplaceInstalled,
|
|
46
|
+
useMcpMarketplaceItems,
|
|
47
|
+
} from "@/hooks/useMcpMarketplace";
|
|
48
|
+
import { useDocBrowser } from "@/components/doc-browser";
|
|
49
|
+
import { useI18n } from "@/components/providers/I18nProvider";
|
|
50
|
+
import { t } from "@/lib/i18n";
|
|
51
|
+
import { useInfiniteScrollLoader } from "@/hooks/use-infinite-scroll-loader";
|
|
52
|
+
|
|
53
|
+
type ScopeType = "catalog" | "installed";
|
|
54
|
+
|
|
55
|
+
const PAGE_SIZE = 12;
|
|
56
|
+
|
|
57
|
+
export function McpMarketplacePage() {
|
|
58
|
+
const [scope, setScope] = useState<ScopeType>("catalog");
|
|
59
|
+
const [searchText, setSearchText] = useState("");
|
|
60
|
+
const [query, setQuery] = useState("");
|
|
61
|
+
const [sort, setSort] = useState<MarketplaceSort>("relevance");
|
|
62
|
+
const [installingItem, setInstallingItem] =
|
|
63
|
+
useState<MarketplaceItemSummary | null>(null);
|
|
64
|
+
const [doctorTarget, setDoctorTarget] = useState<string | null>(null);
|
|
65
|
+
const [doctorResult, setDoctorResult] =
|
|
66
|
+
useState<MarketplaceMcpDoctorResult | null>(null);
|
|
67
|
+
const { language } = useI18n();
|
|
68
|
+
const docBrowser = useDocBrowser();
|
|
69
|
+
const { confirm, ConfirmDialog } = useConfirmDialog();
|
|
70
|
+
const localeFallbacks = useMemo(
|
|
71
|
+
() => buildLocaleFallbacks(language),
|
|
72
|
+
[language],
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
const timer = window.setTimeout(() => {
|
|
77
|
+
setQuery(searchText.trim());
|
|
78
|
+
}, 250);
|
|
79
|
+
return () => window.clearTimeout(timer);
|
|
80
|
+
}, [searchText]);
|
|
81
|
+
|
|
82
|
+
const itemsQuery = useMcpMarketplaceItems({
|
|
83
|
+
q: query || undefined,
|
|
84
|
+
sort,
|
|
85
|
+
pageSize: PAGE_SIZE,
|
|
86
|
+
});
|
|
87
|
+
const installedQuery = useMcpMarketplaceInstalled();
|
|
88
|
+
|
|
89
|
+
const infiniteScroll = useInfiniteScrollLoader({
|
|
90
|
+
disabled:
|
|
91
|
+
scope !== "catalog" ||
|
|
92
|
+
itemsQuery.isError ||
|
|
93
|
+
!itemsQuery.hasNextPage ||
|
|
94
|
+
itemsQuery.isFetchingNextPage,
|
|
95
|
+
onLoadMore: () => itemsQuery.fetchNextPage(),
|
|
96
|
+
watchValue: `${scope}:${query}:${sort}:${itemsQuery.data?.loadedItems ?? 0}:${itemsQuery.data?.loadedPages ?? 0}`,
|
|
97
|
+
});
|
|
98
|
+
const { containerRef, sentinelRef } = infiniteScroll;
|
|
99
|
+
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
const container = containerRef.current;
|
|
102
|
+
if (container && typeof container.scrollTo === "function") {
|
|
103
|
+
container.scrollTo({ top: 0 });
|
|
104
|
+
}
|
|
105
|
+
}, [containerRef, query, scope, sort]);
|
|
106
|
+
|
|
107
|
+
const installMutation = useInstallMcpMarketplaceItem();
|
|
108
|
+
const manageMutation = useManageMcpMarketplaceItem();
|
|
109
|
+
const doctorMutation = useMutation({
|
|
110
|
+
mutationFn: doctorMcpMarketplaceItem,
|
|
111
|
+
onSuccess: (result, name) => {
|
|
112
|
+
setDoctorTarget(name);
|
|
113
|
+
setDoctorResult(result);
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const installedRecordLookup = useMemo(() => {
|
|
118
|
+
return buildInstalledRecordLookup(installedQuery.data?.records ?? []);
|
|
119
|
+
}, [installedQuery.data?.records]);
|
|
120
|
+
|
|
121
|
+
const installedRecords = useMemo(() => {
|
|
122
|
+
const entries = installedQuery.data?.records ?? [];
|
|
123
|
+
return entries.filter((record) => {
|
|
124
|
+
const text = [
|
|
125
|
+
record.id ?? "",
|
|
126
|
+
record.label ?? "",
|
|
127
|
+
record.catalogSlug ?? "",
|
|
128
|
+
record.description ?? "",
|
|
129
|
+
record.descriptionZh ?? "",
|
|
130
|
+
]
|
|
131
|
+
.join(" ")
|
|
132
|
+
.toLowerCase();
|
|
133
|
+
return query ? text.includes(query.toLowerCase()) : true;
|
|
134
|
+
});
|
|
135
|
+
}, [installedQuery.data?.records, query]);
|
|
136
|
+
|
|
137
|
+
const openDoc = async (
|
|
138
|
+
item?: MarketplaceItemSummary,
|
|
139
|
+
record?: MarketplaceInstalledRecord,
|
|
140
|
+
) => {
|
|
141
|
+
const title = item?.name ?? record?.label ?? record?.id ?? "MCP";
|
|
142
|
+
const summary = readSummary(localeFallbacks, item, record);
|
|
143
|
+
if (!item) {
|
|
144
|
+
const url = buildDocDataUrl(
|
|
145
|
+
title,
|
|
146
|
+
JSON.stringify(record ?? {}, null, 2),
|
|
147
|
+
t("marketplaceInstalledLocalSummary"),
|
|
148
|
+
record?.docsUrl,
|
|
149
|
+
summary,
|
|
150
|
+
);
|
|
151
|
+
docBrowser.open(url, { newTab: true, title, kind: "content" });
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
const content = await fetchMcpMarketplaceContent(item.slug);
|
|
156
|
+
const url = buildDocDataUrl(
|
|
157
|
+
title,
|
|
158
|
+
content.metadataRaw || JSON.stringify(item, null, 2),
|
|
159
|
+
content.bodyRaw || content.raw,
|
|
160
|
+
content.sourceUrl,
|
|
161
|
+
summary,
|
|
162
|
+
);
|
|
163
|
+
docBrowser.open(url, { newTab: true, title, kind: "content" });
|
|
164
|
+
} catch (error) {
|
|
165
|
+
const url = buildDocDataUrl(
|
|
166
|
+
title,
|
|
167
|
+
JSON.stringify(
|
|
168
|
+
{ error: error instanceof Error ? error.message : String(error) },
|
|
169
|
+
null,
|
|
170
|
+
2,
|
|
171
|
+
),
|
|
172
|
+
summary,
|
|
173
|
+
undefined,
|
|
174
|
+
summary,
|
|
175
|
+
);
|
|
176
|
+
docBrowser.open(url, { newTab: true, title, kind: "content" });
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const handleInstall = async (payload: {
|
|
181
|
+
name: string;
|
|
182
|
+
allAgents: boolean;
|
|
183
|
+
inputs: Record<string, string>;
|
|
184
|
+
}) => {
|
|
185
|
+
if (!installingItem) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
await installMutation.mutateAsync({
|
|
189
|
+
spec: installingItem.slug,
|
|
190
|
+
name: payload.name.trim(),
|
|
191
|
+
allAgents: payload.allAgents,
|
|
192
|
+
inputs: payload.inputs,
|
|
193
|
+
});
|
|
194
|
+
setInstallingItem(null);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const handleManage = async (
|
|
198
|
+
action: "enable" | "disable" | "remove",
|
|
199
|
+
record: MarketplaceInstalledRecord,
|
|
200
|
+
) => {
|
|
201
|
+
const target = record.id || record.spec;
|
|
202
|
+
if (!target) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (action === "remove") {
|
|
206
|
+
const confirmed = await confirm({
|
|
207
|
+
title: `${t("marketplaceMcpRemoveTitle")} ${target}?`,
|
|
208
|
+
description: t("marketplaceMcpRemoveDescription"),
|
|
209
|
+
confirmLabel: t("marketplaceMcpRemove"),
|
|
210
|
+
variant: "destructive",
|
|
211
|
+
});
|
|
212
|
+
if (!confirmed) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
await manageMutation.mutateAsync({
|
|
217
|
+
action,
|
|
218
|
+
id: target,
|
|
219
|
+
spec: record.spec,
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
return (
|
|
224
|
+
<PageLayout className="flex h-full min-h-0 flex-col pb-0">
|
|
225
|
+
<PageHeader
|
|
226
|
+
title={t("marketplaceMcpPageTitle")}
|
|
227
|
+
description={t("marketplaceMcpPageDescription")}
|
|
228
|
+
/>
|
|
229
|
+
|
|
230
|
+
<Tabs
|
|
231
|
+
tabs={[
|
|
232
|
+
{ id: "catalog", label: t("marketplaceMcpTabCatalog") },
|
|
233
|
+
{
|
|
234
|
+
id: "installed",
|
|
235
|
+
label: t("marketplaceMcpTabInstalled"),
|
|
236
|
+
count: installedQuery.data?.total ?? 0,
|
|
237
|
+
},
|
|
238
|
+
]}
|
|
239
|
+
activeTab={scope}
|
|
240
|
+
onChange={(value) => setScope(value as ScopeType)}
|
|
241
|
+
className="mb-4"
|
|
242
|
+
/>
|
|
243
|
+
|
|
244
|
+
<div className="mb-4 flex flex-col gap-3 md:flex-row md:items-center md:justify-between">
|
|
245
|
+
<Input
|
|
246
|
+
value={searchText}
|
|
247
|
+
onChange={(event) => setSearchText(event.target.value)}
|
|
248
|
+
placeholder={t("marketplaceMcpSearchPlaceholder")}
|
|
249
|
+
className="md:max-w-sm"
|
|
250
|
+
/>
|
|
251
|
+
|
|
252
|
+
<Select
|
|
253
|
+
value={sort}
|
|
254
|
+
onValueChange={(value) => setSort(value as MarketplaceSort)}
|
|
255
|
+
>
|
|
256
|
+
<SelectTrigger className="h-9 w-[180px] rounded-lg">
|
|
257
|
+
<SelectValue />
|
|
258
|
+
</SelectTrigger>
|
|
259
|
+
<SelectContent>
|
|
260
|
+
<SelectItem value="relevance">
|
|
261
|
+
{t("marketplaceSortRelevance")}
|
|
262
|
+
</SelectItem>
|
|
263
|
+
<SelectItem value="updated">
|
|
264
|
+
{t("marketplaceSortUpdated")}
|
|
265
|
+
</SelectItem>
|
|
266
|
+
</SelectContent>
|
|
267
|
+
</Select>
|
|
268
|
+
</div>
|
|
269
|
+
|
|
270
|
+
<section className="flex min-h-0 flex-1 flex-col">
|
|
271
|
+
<div className="mb-3 flex items-center justify-between">
|
|
272
|
+
<h3 className="text-sm font-semibold text-gray-900">
|
|
273
|
+
{scope === "catalog"
|
|
274
|
+
? t("marketplaceMcpSectionCatalog")
|
|
275
|
+
: t("marketplaceMcpSectionInstalled")}
|
|
276
|
+
</h3>
|
|
277
|
+
<span className="text-xs text-gray-500">
|
|
278
|
+
{scope === "catalog"
|
|
279
|
+
? (itemsQuery.data?.total ?? 0)
|
|
280
|
+
: (installedQuery.data?.total ?? 0)}
|
|
281
|
+
</span>
|
|
282
|
+
</div>
|
|
283
|
+
|
|
284
|
+
<div
|
|
285
|
+
ref={containerRef}
|
|
286
|
+
className="min-h-0 flex-1 overflow-y-auto pr-1"
|
|
287
|
+
aria-busy={itemsQuery.isLoading || itemsQuery.isFetchingNextPage}
|
|
288
|
+
>
|
|
289
|
+
<div className="grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3">
|
|
290
|
+
{scope === "catalog" && itemsQuery.isLoading && (
|
|
291
|
+
<MarketplaceListSkeleton count={6} />
|
|
292
|
+
)}
|
|
293
|
+
|
|
294
|
+
{scope === "catalog" &&
|
|
295
|
+
!itemsQuery.isLoading &&
|
|
296
|
+
(itemsQuery.data?.items ?? []).map((item) => {
|
|
297
|
+
const installed = findInstalledRecordForItem(
|
|
298
|
+
item,
|
|
299
|
+
installedRecordLookup,
|
|
300
|
+
);
|
|
301
|
+
return (
|
|
302
|
+
<McpMarketplaceCard
|
|
303
|
+
key={item.id}
|
|
304
|
+
item={item}
|
|
305
|
+
record={installed}
|
|
306
|
+
localeFallbacks={localeFallbacks}
|
|
307
|
+
onOpen={() => void openDoc(item, installed)}
|
|
308
|
+
onInstall={() => setInstallingItem(item)}
|
|
309
|
+
onToggle={
|
|
310
|
+
installed
|
|
311
|
+
? () =>
|
|
312
|
+
void handleManage(
|
|
313
|
+
installed.enabled === false
|
|
314
|
+
? "enable"
|
|
315
|
+
: "disable",
|
|
316
|
+
installed,
|
|
317
|
+
)
|
|
318
|
+
: undefined
|
|
319
|
+
}
|
|
320
|
+
onDoctor={
|
|
321
|
+
installed
|
|
322
|
+
? () => {
|
|
323
|
+
setDoctorTarget(installed.id ?? null);
|
|
324
|
+
setDoctorResult(null);
|
|
325
|
+
void doctorMutation.mutateAsync(installed.id ?? "");
|
|
326
|
+
}
|
|
327
|
+
: undefined
|
|
328
|
+
}
|
|
329
|
+
onRemove={
|
|
330
|
+
installed
|
|
331
|
+
? () => void handleManage("remove", installed)
|
|
332
|
+
: undefined
|
|
333
|
+
}
|
|
334
|
+
/>
|
|
335
|
+
);
|
|
336
|
+
})}
|
|
337
|
+
{scope === "installed" &&
|
|
338
|
+
installedRecords.map((record) => (
|
|
339
|
+
<McpMarketplaceCard
|
|
340
|
+
key={record.id ?? record.spec}
|
|
341
|
+
record={record}
|
|
342
|
+
localeFallbacks={localeFallbacks}
|
|
343
|
+
onOpen={() => void openDoc(undefined, record)}
|
|
344
|
+
onToggle={() =>
|
|
345
|
+
void handleManage(
|
|
346
|
+
record.enabled === false ? "enable" : "disable",
|
|
347
|
+
record,
|
|
348
|
+
)
|
|
349
|
+
}
|
|
350
|
+
onDoctor={() => {
|
|
351
|
+
setDoctorTarget(record.id ?? null);
|
|
352
|
+
setDoctorResult(null);
|
|
353
|
+
void doctorMutation.mutateAsync(record.id ?? "");
|
|
354
|
+
}}
|
|
355
|
+
onRemove={() => void handleManage("remove", record)}
|
|
356
|
+
/>
|
|
357
|
+
))}
|
|
358
|
+
</div>
|
|
359
|
+
|
|
360
|
+
{scope === "catalog" && itemsQuery.isError && (
|
|
361
|
+
<NoticeCard
|
|
362
|
+
tone="danger"
|
|
363
|
+
title={t("marketplaceMcpSectionCatalog")}
|
|
364
|
+
description={itemsQuery.error.message}
|
|
365
|
+
/>
|
|
366
|
+
)}
|
|
367
|
+
{scope === "installed" && installedQuery.isError && (
|
|
368
|
+
<NoticeCard
|
|
369
|
+
tone="danger"
|
|
370
|
+
title={t("marketplaceMcpSectionInstalled")}
|
|
371
|
+
description={installedQuery.error.message}
|
|
372
|
+
/>
|
|
373
|
+
)}
|
|
374
|
+
{scope === "catalog" &&
|
|
375
|
+
!itemsQuery.isLoading &&
|
|
376
|
+
(itemsQuery.data?.items?.length ?? 0) === 0 && (
|
|
377
|
+
<div className="py-8 text-center text-sm text-gray-500">
|
|
378
|
+
{t("marketplaceNoMcp")}
|
|
379
|
+
</div>
|
|
380
|
+
)}
|
|
381
|
+
{scope === "installed" && installedRecords.length === 0 && (
|
|
382
|
+
<div className="py-8 text-center text-sm text-gray-500">
|
|
383
|
+
{t("marketplaceNoInstalledMcp")}
|
|
384
|
+
</div>
|
|
385
|
+
)}
|
|
386
|
+
|
|
387
|
+
{scope === "catalog" && !itemsQuery.isError && (
|
|
388
|
+
<MarketplaceInfiniteScrollStatus
|
|
389
|
+
hasMore={Boolean(itemsQuery.hasNextPage)}
|
|
390
|
+
loading={itemsQuery.isFetchingNextPage}
|
|
391
|
+
sentinelRef={sentinelRef}
|
|
392
|
+
/>
|
|
393
|
+
)}
|
|
394
|
+
</div>
|
|
395
|
+
</section>
|
|
396
|
+
|
|
397
|
+
<InstallDialog
|
|
398
|
+
item={installingItem}
|
|
399
|
+
open={Boolean(installingItem)}
|
|
400
|
+
pending={installMutation.isPending}
|
|
401
|
+
onOpenChange={(open) => !open && setInstallingItem(null)}
|
|
402
|
+
onSubmit={handleInstall}
|
|
403
|
+
/>
|
|
404
|
+
<DoctorDialog
|
|
405
|
+
open={Boolean(doctorTarget)}
|
|
406
|
+
targetName={doctorTarget}
|
|
407
|
+
result={doctorResult}
|
|
408
|
+
pending={doctorMutation.isPending}
|
|
409
|
+
onOpenChange={(open) => !open && setDoctorTarget(null)}
|
|
410
|
+
/>
|
|
411
|
+
<ConfirmDialog />
|
|
412
|
+
</PageLayout>
|
|
413
|
+
);
|
|
414
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { cn } from "@/lib/utils";
|
|
4
|
+
|
|
5
|
+
const noticeCardVariants = cva("rounded-2xl border px-4 py-3", {
|
|
6
|
+
variants: {
|
|
7
|
+
tone: {
|
|
8
|
+
neutral: "border-gray-200 bg-gray-50 text-gray-900",
|
|
9
|
+
success: "border-emerald-200 bg-emerald-50 text-emerald-900",
|
|
10
|
+
warning: "border-amber-200 bg-amber-50 text-amber-900",
|
|
11
|
+
danger: "border-rose-200 bg-rose-50 text-rose-700",
|
|
12
|
+
info: "border-primary/20 bg-primary/10 text-primary",
|
|
13
|
+
},
|
|
14
|
+
borderStyle: {
|
|
15
|
+
solid: "",
|
|
16
|
+
dashed: "border-dashed",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {
|
|
20
|
+
tone: "neutral",
|
|
21
|
+
borderStyle: "solid",
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const titleClassMap: Record<
|
|
26
|
+
NonNullable<VariantProps<typeof noticeCardVariants>["tone"]>,
|
|
27
|
+
string
|
|
28
|
+
> = {
|
|
29
|
+
neutral: "text-gray-900",
|
|
30
|
+
success: "text-emerald-800",
|
|
31
|
+
warning: "text-amber-900",
|
|
32
|
+
danger: "text-rose-700",
|
|
33
|
+
info: "text-primary",
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const descriptionClassMap: Record<
|
|
37
|
+
NonNullable<VariantProps<typeof noticeCardVariants>["tone"]>,
|
|
38
|
+
string
|
|
39
|
+
> = {
|
|
40
|
+
neutral: "text-gray-600",
|
|
41
|
+
success: "text-emerald-700",
|
|
42
|
+
warning: "text-amber-800",
|
|
43
|
+
danger: "text-rose-700",
|
|
44
|
+
info: "text-primary/90",
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export interface NoticeCardProps
|
|
48
|
+
extends
|
|
49
|
+
Omit<React.HTMLAttributes<HTMLDivElement>, "title">,
|
|
50
|
+
VariantProps<typeof noticeCardVariants> {
|
|
51
|
+
title?: React.ReactNode;
|
|
52
|
+
description?: React.ReactNode;
|
|
53
|
+
icon?: React.ReactNode;
|
|
54
|
+
actions?: React.ReactNode;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const NoticeCard = React.forwardRef<HTMLDivElement, NoticeCardProps>(
|
|
58
|
+
(
|
|
59
|
+
{
|
|
60
|
+
className,
|
|
61
|
+
tone = "neutral",
|
|
62
|
+
borderStyle = "solid",
|
|
63
|
+
title,
|
|
64
|
+
description,
|
|
65
|
+
icon,
|
|
66
|
+
actions,
|
|
67
|
+
children,
|
|
68
|
+
...props
|
|
69
|
+
},
|
|
70
|
+
ref,
|
|
71
|
+
) => {
|
|
72
|
+
const resolvedTone = tone ?? "neutral";
|
|
73
|
+
const hasHeader =
|
|
74
|
+
Boolean(title) ||
|
|
75
|
+
Boolean(description) ||
|
|
76
|
+
Boolean(icon) ||
|
|
77
|
+
Boolean(actions);
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<div
|
|
81
|
+
ref={ref}
|
|
82
|
+
className={cn(
|
|
83
|
+
noticeCardVariants({ tone: resolvedTone, borderStyle }),
|
|
84
|
+
className,
|
|
85
|
+
)}
|
|
86
|
+
{...props}
|
|
87
|
+
>
|
|
88
|
+
{hasHeader ? (
|
|
89
|
+
<div className="flex items-start justify-between gap-3">
|
|
90
|
+
<div className="min-w-0 flex-1">
|
|
91
|
+
<div className="flex items-start gap-2">
|
|
92
|
+
{icon ? <div className="mt-0.5 shrink-0">{icon}</div> : null}
|
|
93
|
+
<div className="min-w-0 flex-1">
|
|
94
|
+
{title ? (
|
|
95
|
+
<p
|
|
96
|
+
className={cn(
|
|
97
|
+
"text-sm font-medium",
|
|
98
|
+
titleClassMap[resolvedTone],
|
|
99
|
+
)}
|
|
100
|
+
>
|
|
101
|
+
{title}
|
|
102
|
+
</p>
|
|
103
|
+
) : null}
|
|
104
|
+
{description ? (
|
|
105
|
+
<p
|
|
106
|
+
className={cn(
|
|
107
|
+
title ? "mt-1" : "",
|
|
108
|
+
"text-sm leading-6",
|
|
109
|
+
descriptionClassMap[resolvedTone],
|
|
110
|
+
)}
|
|
111
|
+
>
|
|
112
|
+
{description}
|
|
113
|
+
</p>
|
|
114
|
+
) : null}
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
{actions ? <div className="shrink-0">{actions}</div> : null}
|
|
119
|
+
</div>
|
|
120
|
+
) : null}
|
|
121
|
+
{children ? (
|
|
122
|
+
<div className={cn(hasHeader ? "mt-3" : "")}>{children}</div>
|
|
123
|
+
) : null}
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
},
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
NoticeCard.displayName = "NoticeCard";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { cn } from "@/lib/utils";
|
|
4
|
+
|
|
5
|
+
const settingRowVariants = cva(
|
|
6
|
+
"flex items-start justify-between gap-4 rounded-xl border p-4",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
tone: {
|
|
10
|
+
default: "border-gray-200 bg-white",
|
|
11
|
+
muted: "border-gray-200 bg-gray-50",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
tone: "default",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export interface SettingRowProps
|
|
21
|
+
extends
|
|
22
|
+
Omit<React.HTMLAttributes<HTMLDivElement>, "title">,
|
|
23
|
+
VariantProps<typeof settingRowVariants> {
|
|
24
|
+
title: React.ReactNode;
|
|
25
|
+
description?: React.ReactNode;
|
|
26
|
+
control?: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const SettingRow = React.forwardRef<HTMLDivElement, SettingRowProps>(
|
|
30
|
+
(
|
|
31
|
+
{ className, tone, title, description, control, children, ...props },
|
|
32
|
+
ref,
|
|
33
|
+
) => (
|
|
34
|
+
<div
|
|
35
|
+
ref={ref}
|
|
36
|
+
className={cn(settingRowVariants({ tone }), className)}
|
|
37
|
+
{...props}
|
|
38
|
+
>
|
|
39
|
+
<div className="min-w-0 flex-1 space-y-2">
|
|
40
|
+
<div className="text-sm font-medium text-gray-900">{title}</div>
|
|
41
|
+
{description ? (
|
|
42
|
+
<p className="text-sm leading-6 text-gray-500">{description}</p>
|
|
43
|
+
) : null}
|
|
44
|
+
{children}
|
|
45
|
+
</div>
|
|
46
|
+
{control ? <div className="shrink-0">{control}</div> : null}
|
|
47
|
+
</div>
|
|
48
|
+
),
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
SettingRow.displayName = "SettingRow";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { cn } from "@/lib/utils";
|
|
4
|
+
|
|
5
|
+
const tagChipVariants = cva(
|
|
6
|
+
"inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
tone: {
|
|
10
|
+
subtle: "border-gray-200 bg-gray-50 text-gray-600",
|
|
11
|
+
neutral: "border-gray-200 bg-white text-gray-600",
|
|
12
|
+
success: "border-emerald-200 bg-emerald-50 text-emerald-700",
|
|
13
|
+
warning: "border-amber-200 bg-amber-50 text-amber-800",
|
|
14
|
+
danger: "border-rose-200 bg-rose-50 text-rose-600",
|
|
15
|
+
info: "border-primary/20 bg-primary/10 text-primary",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
tone: "subtle",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export interface TagChipProps
|
|
25
|
+
extends
|
|
26
|
+
React.HTMLAttributes<HTMLSpanElement>,
|
|
27
|
+
VariantProps<typeof tagChipVariants> {}
|
|
28
|
+
|
|
29
|
+
export const TagChip = React.forwardRef<HTMLSpanElement, TagChipProps>(
|
|
30
|
+
({ className, tone, ...props }, ref) => (
|
|
31
|
+
<span
|
|
32
|
+
ref={ref}
|
|
33
|
+
className={cn(tagChipVariants({ tone }), className)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
),
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
TagChip.displayName = "TagChip";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "@/lib/utils";
|
|
3
|
+
|
|
4
|
+
export type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
5
|
+
|
|
6
|
+
export const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
7
|
+
({ className, ...props }, ref) => (
|
|
8
|
+
<textarea
|
|
9
|
+
className={cn(
|
|
10
|
+
"flex min-h-28 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2.5 text-sm text-gray-900 placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50",
|
|
11
|
+
className,
|
|
12
|
+
)}
|
|
13
|
+
ref={ref}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
Textarea.displayName = "Textarea";
|