@agent-native/core-corpus 0.212.1 → 0.213.1
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/corpus/README.md +1 -1
- package/corpus/templates/analytics/.agents/skills/onboarding-journeys/SKILL.md +29 -14
- package/corpus/templates/analytics/CHANGELOG.md +11 -0
- package/corpus/templates/analytics/actions/estimate-onboarding-journey-cost.ts +23 -6
- package/corpus/templates/analytics/actions/get-onboarding-journey.ts +20 -5
- package/corpus/templates/analytics/actions/provider-api-register.ts +2 -7
- package/corpus/templates/analytics/changelog/2026-10-21-analytics-recognizes-questions-about-connected-data-product-.md +6 -0
- package/corpus/templates/analytics/changelog/2026-10-21-onboarding-journeys-now-honor-larger-event-row-budgets.md +6 -0
- package/corpus/templates/analytics/changelog/2026-10-21-preserve-unknown-replay-availability-in-partial-journeys.md +6 -0
- package/corpus/templates/analytics/package.json +6 -0
- package/corpus/templates/analytics/scripts/journey-capture-plan.ts +18 -7
- package/corpus/templates/analytics/scripts/journey-capture.ts +3 -1
- package/corpus/templates/analytics/server/lib/db-admin-connections.ts +19 -12
- package/corpus/templates/analytics/server/lib/journey-tree.ts +24 -9
- package/corpus/templates/analytics/server/lib/onboarding-journey-cost.ts +163 -94
- package/corpus/templates/analytics/server/lib/onboarding-journey.ts +162 -74
- package/corpus/templates/assets/server/lib/org-admin.ts +20 -16
- package/corpus/templates/brain/server/lib/zoom-governance.ts +11 -6
- package/corpus/templates/clips/CHANGELOG.md +1 -0
- package/corpus/templates/clips/changelog/2026-10-16-rewind-status-says-when-it-remembers-audio.md +6 -0
- package/corpus/templates/clips/desktop/src/app.tsx +7 -4
- package/corpus/templates/clips/desktop/src/components/RewindCaptureStatus.tsx +25 -0
- package/corpus/templates/clips/desktop/src/lib/rewind-status.ts +6 -1
- package/corpus/templates/clips/desktop/src/shared/config.ts +3 -0
- package/corpus/templates/clips/desktop/src-tauri/src/screen_memory.rs +2 -0
- package/corpus/templates/clips/server/lib/recordings.ts +4 -19
- package/corpus/templates/community/qr/package.json +1 -1
- package/corpus/templates/content/CHANGELOG.md +8 -0
- package/corpus/templates/content/actions/_content-space-access.ts +95 -6
- package/corpus/templates/content/actions/_database-utils.ts +20 -16
- package/corpus/templates/content/actions/_github-source-freshness.ts +72 -17
- package/corpus/templates/content/actions/_github-source-metadata.ts +63 -17
- package/corpus/templates/content/actions/_github-source.ts +141 -77
- package/corpus/templates/content/actions/check-github-connection.ts +15 -0
- package/corpus/templates/content/actions/create-github-collection.ts +180 -0
- package/corpus/templates/content/actions/disconnect-content-database-source.ts +5 -0
- package/corpus/templates/content/actions/link-github-folder.ts +104 -36
- package/corpus/templates/content/actions/refresh-content-database-source.ts +37 -4
- package/corpus/templates/content/actions/sync-github-folder.ts +23 -5
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +172 -19
- package/corpus/templates/content/app/components/editor/database/GitHubLinkDialog.tsx +938 -0
- package/corpus/templates/content/app/components/editor/database/GitHubSourcePanel.tsx +228 -0
- package/corpus/templates/content/app/components/editor/database/GitHubSourceStatusLine.tsx +561 -0
- package/corpus/templates/content/app/components/editor/database/GitHubUnlinkDialog.tsx +96 -0
- package/corpus/templates/content/app/components/editor/database/github-availability.ts +147 -0
- package/corpus/templates/content/app/components/editor/database/github-source-text.ts +280 -0
- package/corpus/templates/content/app/components/layout/Layout.tsx +2 -0
- package/corpus/templates/content/app/hooks/content-action-refresh.ts +6 -0
- package/corpus/templates/content/app/hooks/use-content-database.ts +3 -1
- package/corpus/templates/content/app/hooks/use-github-folder.ts +199 -0
- package/corpus/templates/content/app/i18n-data.ts +154 -1
- package/corpus/templates/content/app/lib/github-link-dialog.ts +86 -0
- package/corpus/templates/content/changelog/2026-10-18-connected-ai-assistants-can-link-a-new-collection-to-a-github.md +1 -1
- package/corpus/templates/content/changelog/2026-10-18-link-a-new-collection-to-a-github-folder-from-its-sources.md +6 -0
- package/corpus/templates/content/changelog/2026-10-21-organization-favorites-include-documents-shared-with-the-cur.md +6 -0
- package/corpus/templates/content/docs/product/capabilities/content.source.sync-policy.md +32 -7
- package/corpus/templates/content/docs/product/encyclopedia.md +3 -3
- package/corpus/templates/content/docs/product/features/content.feature.trust-your-connected-sources.md +2 -2
- package/corpus/templates/content/docs/product/roadmap.md +1 -1
- package/corpus/templates/content/parity/matrix.md +42 -42
- package/corpus/templates/content/parity/matrix.ts +14 -0
- package/corpus/templates/content/server/lib/github-source-client.ts +50 -1
- package/corpus/templates/content/shared/api.ts +3 -0
- package/corpus/templates/content/shared/github-source.ts +68 -0
- package/corpus/templates/design/CHANGELOG.md +1 -0
- package/corpus/templates/design/actions/connect-assets-mcp.ts +5 -9
- package/corpus/templates/design/changelog/2026-10-21-journey-canvases-accept-partial-analytics-samples-when-repla.md +6 -0
- package/corpus/templates/design/shared/journey-canvas.ts +6 -4
- package/corpus/templates/dispatch/.agents/skills/a2a-protocol/SKILL.md +16 -13
- package/corpus/templates/dispatch/CHANGELOG.md +4 -0
- package/corpus/templates/dispatch/changelog/2026-10-21-customer-ai-credit-questions-route-to-account-health-instead.md +6 -0
- package/corpus/templates/factory/server/lib/require-workspace-member.ts +5 -17
- package/corpus/templates/mail/server/lib/queued-drafts.ts +9 -4
- package/corpus/templates/slides/server/workspace-defaults.ts +12 -15
- package/package.json +1 -1
|
@@ -57,6 +57,7 @@ import {
|
|
|
57
57
|
databaseFrozenColumnIds,
|
|
58
58
|
reorderDatabaseTableColumn,
|
|
59
59
|
} from "@shared/database-table-columns";
|
|
60
|
+
import { GITHUB_SOURCE_TYPE } from "@shared/github-source";
|
|
60
61
|
import {
|
|
61
62
|
type DocumentPropertyOptionColor,
|
|
62
63
|
countWords,
|
|
@@ -75,6 +76,7 @@ import {
|
|
|
75
76
|
IconArrowUp,
|
|
76
77
|
IconAdjustmentsHorizontal,
|
|
77
78
|
IconArrowsDiagonal,
|
|
79
|
+
IconBrandGithub,
|
|
78
80
|
IconArrowsSort,
|
|
79
81
|
IconCalendar,
|
|
80
82
|
IconCalendarDue,
|
|
@@ -114,6 +116,7 @@ import { useQueryClient } from "@tanstack/react-query";
|
|
|
114
116
|
import {
|
|
115
117
|
useEffect,
|
|
116
118
|
useCallback,
|
|
119
|
+
useId,
|
|
117
120
|
useMemo,
|
|
118
121
|
useRef,
|
|
119
122
|
useState,
|
|
@@ -326,6 +329,9 @@ import {
|
|
|
326
329
|
} from "./DatabaseViewSkeleton";
|
|
327
330
|
import { DatabaseFormView } from "./FormView";
|
|
328
331
|
import { DatabaseGalleryView } from "./GalleryView";
|
|
332
|
+
import type { GitHubCollectionPlace } from "./github-availability";
|
|
333
|
+
import { GitHubSourcePanel, useGitHubSourcesRow } from "./GitHubSourcePanel";
|
|
334
|
+
import { GitHubSourceStatusLine } from "./GitHubSourceStatusLine";
|
|
329
335
|
import { DatabaseListView } from "./ListView";
|
|
330
336
|
import {
|
|
331
337
|
DATABASE_NAVIGATION_VISIBLE_ITEM_LIMIT,
|
|
@@ -3493,6 +3499,39 @@ function DatabaseTable({
|
|
|
3493
3499
|
);
|
|
3494
3500
|
})}
|
|
3495
3501
|
|
|
3502
|
+
<GitHubSourceStatusLine
|
|
3503
|
+
source={
|
|
3504
|
+
sources.find(
|
|
3505
|
+
(candidate) => candidate.sourceType === GITHUB_SOURCE_TYPE,
|
|
3506
|
+
) ?? null
|
|
3507
|
+
}
|
|
3508
|
+
documentId={document.id}
|
|
3509
|
+
canEdit={canEdit}
|
|
3510
|
+
pageCount={totalItemCount}
|
|
3511
|
+
/>
|
|
3512
|
+
{canEdit &&
|
|
3513
|
+
databaseId &&
|
|
3514
|
+
data &&
|
|
3515
|
+
!data.database.systemRole &&
|
|
3516
|
+
!source &&
|
|
3517
|
+
sources.length === 0 &&
|
|
3518
|
+
totalItemCount === 0 ? (
|
|
3519
|
+
// One line for every source, so the list of them stays in Sources.
|
|
3520
|
+
<div className="mb-2 text-xs" data-empty-collection-source-hint>
|
|
3521
|
+
<button
|
|
3522
|
+
type="button"
|
|
3523
|
+
className="inline-flex items-center gap-1.5 rounded-sm text-muted-foreground underline-offset-2 hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
3524
|
+
onClick={() => {
|
|
3525
|
+
changeDatabaseSettingsPanel("source");
|
|
3526
|
+
setSettingsOpen(true);
|
|
3527
|
+
}}
|
|
3528
|
+
>
|
|
3529
|
+
<IconPlugConnected className="size-3.5" aria-hidden />
|
|
3530
|
+
{dbText("emptyCollectionSourceHint")}
|
|
3531
|
+
</button>
|
|
3532
|
+
</div>
|
|
3533
|
+
) : null}
|
|
3534
|
+
|
|
3496
3535
|
{database.itemsFailed ? (
|
|
3497
3536
|
<QueryErrorState
|
|
3498
3537
|
compact
|
|
@@ -3850,6 +3889,15 @@ function DatabaseTable({
|
|
|
3850
3889
|
databaseId={databaseId}
|
|
3851
3890
|
documentId={document.id}
|
|
3852
3891
|
isFilesDatabase={document.database?.systemRole === "files"}
|
|
3892
|
+
githubPlace={{
|
|
3893
|
+
databaseId,
|
|
3894
|
+
documentId: document.id,
|
|
3895
|
+
spaceId: document.spaceId ?? undefined,
|
|
3896
|
+
parentId: document.parentId,
|
|
3897
|
+
systemRole: data?.database.systemRole ?? null,
|
|
3898
|
+
pageCount: totalItemCount,
|
|
3899
|
+
canEdit,
|
|
3900
|
+
}}
|
|
3853
3901
|
canEdit={canEdit}
|
|
3854
3902
|
canManage={document.canManage === true}
|
|
3855
3903
|
activeView={activeView}
|
|
@@ -7787,7 +7835,8 @@ type SourceNavStep =
|
|
|
7787
7835
|
| { kind: "addSource" }
|
|
7788
7836
|
| { kind: "secondarySource"; sourceId: string; sourceName: string }
|
|
7789
7837
|
| { kind: "keyConfirm"; candidate: PendingSourceCandidate }
|
|
7790
|
-
| { kind: "fieldPicker"; sourceId: string; sourceName: string }
|
|
7838
|
+
| { kind: "fieldPicker"; sourceId: string; sourceName: string }
|
|
7839
|
+
| { kind: "github" };
|
|
7791
7840
|
|
|
7792
7841
|
function sourceNavTitle(stack: SourceNavStep[]): string {
|
|
7793
7842
|
const top = stack[stack.length - 1];
|
|
@@ -7798,6 +7847,7 @@ function sourceNavTitle(stack: SourceNavStep[]): string {
|
|
|
7798
7847
|
if (top.kind === "secondarySource") return top.sourceName;
|
|
7799
7848
|
if (top.kind === "keyConfirm") return dbText("matchExistingItemsToDetails");
|
|
7800
7849
|
if (top.kind === "fieldPicker") return dbText("chooseFields");
|
|
7850
|
+
if (top.kind === "github") return "GitHub";
|
|
7801
7851
|
return top.model?.displayName ?? top.sourceName ?? "Builder";
|
|
7802
7852
|
}
|
|
7803
7853
|
|
|
@@ -7844,6 +7894,7 @@ function DatabaseSettingsPanelSheet({
|
|
|
7844
7894
|
databaseId,
|
|
7845
7895
|
documentId,
|
|
7846
7896
|
isFilesDatabase,
|
|
7897
|
+
githubPlace,
|
|
7847
7898
|
canEdit,
|
|
7848
7899
|
canManage,
|
|
7849
7900
|
activeView,
|
|
@@ -7883,6 +7934,7 @@ function DatabaseSettingsPanelSheet({
|
|
|
7883
7934
|
databaseId: string;
|
|
7884
7935
|
documentId: string;
|
|
7885
7936
|
isFilesDatabase: boolean;
|
|
7937
|
+
githubPlace: GitHubCollectionPlace;
|
|
7886
7938
|
canEdit: boolean;
|
|
7887
7939
|
canManage: boolean;
|
|
7888
7940
|
activeView: ContentDatabaseView;
|
|
@@ -8053,6 +8105,7 @@ function DatabaseSettingsPanelSheet({
|
|
|
8053
8105
|
databaseId={databaseId}
|
|
8054
8106
|
documentId={documentId}
|
|
8055
8107
|
isFilesDatabase={isFilesDatabase}
|
|
8108
|
+
githubPlace={githubPlace}
|
|
8056
8109
|
itemCount={items.length}
|
|
8057
8110
|
canEdit={canEdit}
|
|
8058
8111
|
canManage={canManage}
|
|
@@ -8461,6 +8514,7 @@ function DatabaseSettingsSourcePanel({
|
|
|
8461
8514
|
databaseId,
|
|
8462
8515
|
documentId,
|
|
8463
8516
|
isFilesDatabase,
|
|
8517
|
+
githubPlace,
|
|
8464
8518
|
itemCount,
|
|
8465
8519
|
canEdit,
|
|
8466
8520
|
canManage,
|
|
@@ -8485,6 +8539,7 @@ function DatabaseSettingsSourcePanel({
|
|
|
8485
8539
|
databaseId: string;
|
|
8486
8540
|
documentId: string;
|
|
8487
8541
|
isFilesDatabase: boolean;
|
|
8542
|
+
githubPlace: GitHubCollectionPlace;
|
|
8488
8543
|
itemCount: number;
|
|
8489
8544
|
canEdit: boolean;
|
|
8490
8545
|
canManage: boolean;
|
|
@@ -8571,6 +8626,8 @@ function DatabaseSettingsSourcePanel({
|
|
|
8571
8626
|
navigate(`/local-files?databaseId=${databaseId}`)
|
|
8572
8627
|
}
|
|
8573
8628
|
showLocalFolder={isFilesDatabase}
|
|
8629
|
+
githubPlace={githubPlace}
|
|
8630
|
+
onOpenGitHubStep={() => onNavPush({ kind: "github" })}
|
|
8574
8631
|
onOpenSecondary={(secondary) =>
|
|
8575
8632
|
onNavPush({
|
|
8576
8633
|
kind: "secondarySource",
|
|
@@ -8583,6 +8640,16 @@ function DatabaseSettingsSourcePanel({
|
|
|
8583
8640
|
);
|
|
8584
8641
|
}
|
|
8585
8642
|
|
|
8643
|
+
if (top.kind === "github") {
|
|
8644
|
+
return (
|
|
8645
|
+
<GitHubSourcePanel
|
|
8646
|
+
place={githubPlace}
|
|
8647
|
+
sources={sources.length > 0 ? sources : source ? [source] : []}
|
|
8648
|
+
onUnlinked={() => onNavReplace([])}
|
|
8649
|
+
/>
|
|
8650
|
+
);
|
|
8651
|
+
}
|
|
8652
|
+
|
|
8586
8653
|
if (top.kind === "addSource") {
|
|
8587
8654
|
return (
|
|
8588
8655
|
<AddSourceView
|
|
@@ -9219,7 +9286,7 @@ function DatabaseSettingsSourcePanel({
|
|
|
9219
9286
|
);
|
|
9220
9287
|
}
|
|
9221
9288
|
|
|
9222
|
-
function SourcesListView({
|
|
9289
|
+
export function SourcesListView({
|
|
9223
9290
|
source,
|
|
9224
9291
|
sources,
|
|
9225
9292
|
builderConfigured,
|
|
@@ -9229,6 +9296,8 @@ function SourcesListView({
|
|
|
9229
9296
|
onOpenNotion,
|
|
9230
9297
|
onOpenLocalFolder,
|
|
9231
9298
|
showLocalFolder,
|
|
9299
|
+
githubPlace,
|
|
9300
|
+
onOpenGitHubStep,
|
|
9232
9301
|
onOpenSecondary,
|
|
9233
9302
|
onAddSource,
|
|
9234
9303
|
}: {
|
|
@@ -9241,6 +9310,9 @@ function SourcesListView({
|
|
|
9241
9310
|
onOpenNotion: () => void;
|
|
9242
9311
|
onOpenLocalFolder: () => void;
|
|
9243
9312
|
showLocalFolder: boolean;
|
|
9313
|
+
githubPlace: GitHubCollectionPlace;
|
|
9314
|
+
/** Opens the GitHub step: the linked folder, or why one can't link here. */
|
|
9315
|
+
onOpenGitHubStep: () => void;
|
|
9244
9316
|
onOpenSecondary: (source: ContentDatabaseSource) => void;
|
|
9245
9317
|
onAddSource: () => void;
|
|
9246
9318
|
}) {
|
|
@@ -9248,6 +9320,20 @@ function SourcesListView({
|
|
|
9248
9320
|
const isBuilderSource = source?.sourceType === "builder-cms";
|
|
9249
9321
|
const connectedSources =
|
|
9250
9322
|
sources.length > 0 ? sources : source ? [source] : [];
|
|
9323
|
+
const github = useGitHubSourcesRow(
|
|
9324
|
+
githubPlace,
|
|
9325
|
+
connectedSources,
|
|
9326
|
+
onOpenGitHubStep,
|
|
9327
|
+
);
|
|
9328
|
+
const githubSource =
|
|
9329
|
+
github.availability.kind === "linked"
|
|
9330
|
+
? github.availability.source
|
|
9331
|
+
: undefined;
|
|
9332
|
+
// A GitHub folder is the collection's whole content, so other apps
|
|
9333
|
+
// explain that instead of leading to a refusal.
|
|
9334
|
+
const lockedByGitHub = githubSource
|
|
9335
|
+
? dbText("githubRowUnavailableWhileLinked")
|
|
9336
|
+
: undefined;
|
|
9251
9337
|
return (
|
|
9252
9338
|
<div className="grid min-w-0 gap-4">
|
|
9253
9339
|
{connectedSources.length === 0 ? (
|
|
@@ -9265,30 +9351,51 @@ function SourcesListView({
|
|
|
9265
9351
|
icon={
|
|
9266
9352
|
connected.sourceType === "builder-cms" ? (
|
|
9267
9353
|
<BuilderLogoMark className="size-4" />
|
|
9354
|
+
) : connected.sourceType === GITHUB_SOURCE_TYPE ? (
|
|
9355
|
+
<IconBrandGithub className="size-4" />
|
|
9268
9356
|
) : (
|
|
9269
9357
|
<IconLayoutGrid className="size-4" />
|
|
9270
9358
|
)
|
|
9271
9359
|
}
|
|
9272
|
-
label={
|
|
9273
|
-
|
|
9360
|
+
label={
|
|
9361
|
+
connected.sourceType === GITHUB_SOURCE_TYPE
|
|
9362
|
+
? "GitHub"
|
|
9363
|
+
: connected.sourceName
|
|
9364
|
+
}
|
|
9365
|
+
value={
|
|
9366
|
+
connected.sourceType === GITHUB_SOURCE_TYPE
|
|
9367
|
+
? undefined
|
|
9368
|
+
: sourceRoleLabel(connected, index)
|
|
9369
|
+
}
|
|
9370
|
+
description={
|
|
9371
|
+
connected.sourceType === GITHUB_SOURCE_TYPE
|
|
9372
|
+
? github.description
|
|
9373
|
+
: undefined
|
|
9374
|
+
}
|
|
9274
9375
|
onClick={
|
|
9275
9376
|
connected.metadata.federation?.role === "secondary"
|
|
9276
9377
|
? () => onOpenSecondary(connected)
|
|
9277
9378
|
: connected.sourceType === "builder-cms"
|
|
9278
9379
|
? () => onOpenBuilder(connected)
|
|
9279
|
-
:
|
|
9380
|
+
: connected.sourceType === GITHUB_SOURCE_TYPE
|
|
9381
|
+
? onOpenGitHubStep
|
|
9382
|
+
: undefined
|
|
9280
9383
|
}
|
|
9281
9384
|
disabled={
|
|
9282
9385
|
connected.metadata.federation?.role !== "secondary" &&
|
|
9283
|
-
connected.sourceType !== "builder-cms"
|
|
9386
|
+
connected.sourceType !== "builder-cms" &&
|
|
9387
|
+
connected.sourceType !== GITHUB_SOURCE_TYPE
|
|
9284
9388
|
}
|
|
9285
9389
|
/>
|
|
9286
9390
|
))}
|
|
9287
|
-
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
|
|
9291
|
-
|
|
9391
|
+
{/* A GitHub folder is the collection's whole content, so nothing joins it. */}
|
|
9392
|
+
{githubSource ? null : (
|
|
9393
|
+
<DatabaseSettingsRow
|
|
9394
|
+
icon={<IconPlus className="size-4" />}
|
|
9395
|
+
label={dbText("addAnotherSource")}
|
|
9396
|
+
onClick={onAddSource}
|
|
9397
|
+
/>
|
|
9398
|
+
)}
|
|
9292
9399
|
</div>
|
|
9293
9400
|
)}
|
|
9294
9401
|
<div className="grid min-w-0 gap-1.5">
|
|
@@ -9306,7 +9413,9 @@ function SourcesListView({
|
|
|
9306
9413
|
: undefined
|
|
9307
9414
|
}
|
|
9308
9415
|
badgeCount={reviewableCount}
|
|
9309
|
-
|
|
9416
|
+
description={lockedByGitHub}
|
|
9417
|
+
muted={!!lockedByGitHub}
|
|
9418
|
+
onClick={lockedByGitHub ? onOpenGitHubStep : () => onOpenBuilder()}
|
|
9310
9419
|
/>
|
|
9311
9420
|
<DatabaseSettingsRow
|
|
9312
9421
|
icon={<NotionLogoMark className="size-4" />}
|
|
@@ -9318,8 +9427,19 @@ function SourcesListView({
|
|
|
9318
9427
|
? dbText("connected")
|
|
9319
9428
|
: undefined
|
|
9320
9429
|
}
|
|
9321
|
-
|
|
9430
|
+
description={lockedByGitHub}
|
|
9431
|
+
muted={!!lockedByGitHub}
|
|
9432
|
+
onClick={lockedByGitHub ? onOpenGitHubStep : onOpenNotion}
|
|
9322
9433
|
/>
|
|
9434
|
+
{githubSource ? null : (
|
|
9435
|
+
<DatabaseSettingsRow
|
|
9436
|
+
icon={<IconBrandGithub className="size-4" />}
|
|
9437
|
+
label="GitHub"
|
|
9438
|
+
description={github.description}
|
|
9439
|
+
muted={github.muted}
|
|
9440
|
+
onClick={github.open}
|
|
9441
|
+
/>
|
|
9442
|
+
)}
|
|
9323
9443
|
{showLocalFolder ? (
|
|
9324
9444
|
<DatabaseSettingsRow
|
|
9325
9445
|
icon={<IconFolder className="size-4" />}
|
|
@@ -11000,37 +11120,70 @@ function DatabaseSettingsRow({
|
|
|
11000
11120
|
icon,
|
|
11001
11121
|
label,
|
|
11002
11122
|
value,
|
|
11123
|
+
description,
|
|
11003
11124
|
badgeCount = 0,
|
|
11004
11125
|
disabled = false,
|
|
11126
|
+
muted = false,
|
|
11005
11127
|
onClick,
|
|
11006
11128
|
}: {
|
|
11007
11129
|
icon: ReactNode;
|
|
11008
11130
|
label: string;
|
|
11009
11131
|
value?: string;
|
|
11132
|
+
/** A second line that's always shown, like why the row can't be used. */
|
|
11133
|
+
description?: string;
|
|
11010
11134
|
badgeCount?: number;
|
|
11011
11135
|
disabled?: boolean;
|
|
11012
|
-
|
|
11136
|
+
/**
|
|
11137
|
+
* Looks unavailable but stays focusable and clickable, so its reason can
|
|
11138
|
+
* still be opened by keyboard, touch and screen readers.
|
|
11139
|
+
*/
|
|
11140
|
+
muted?: boolean;
|
|
11141
|
+
onClick?: (button: HTMLButtonElement) => void;
|
|
11013
11142
|
}) {
|
|
11014
11143
|
const badgeLabel = formatCompactCountBadge(badgeCount);
|
|
11144
|
+
const descriptionId = useId();
|
|
11015
11145
|
return (
|
|
11016
11146
|
<button
|
|
11017
11147
|
type="button"
|
|
11018
11148
|
disabled={disabled || !onClick}
|
|
11149
|
+
aria-disabled={muted || undefined}
|
|
11150
|
+
aria-describedby={description ? descriptionId : undefined}
|
|
11019
11151
|
className={cn(
|
|
11020
|
-
"flex
|
|
11152
|
+
"flex w-full min-w-0 items-center gap-2 rounded-md px-2 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
11153
|
+
description ? "min-h-9 py-1.5" : "h-9",
|
|
11021
11154
|
disabled || !onClick
|
|
11022
11155
|
? "cursor-default text-muted-foreground/60"
|
|
11023
|
-
:
|
|
11156
|
+
: muted
|
|
11157
|
+
? "text-muted-foreground/60 hover:bg-muted"
|
|
11158
|
+
: "text-foreground hover:bg-muted",
|
|
11024
11159
|
)}
|
|
11025
11160
|
onClick={(event: ReactMouseEvent<HTMLButtonElement>) => {
|
|
11026
11161
|
event.stopPropagation();
|
|
11027
|
-
onClick?.();
|
|
11162
|
+
onClick?.(event.currentTarget);
|
|
11028
11163
|
}}
|
|
11029
11164
|
>
|
|
11030
|
-
<span
|
|
11165
|
+
<span
|
|
11166
|
+
className={cn(
|
|
11167
|
+
"flex size-5 shrink-0 items-center justify-center text-muted-foreground",
|
|
11168
|
+
muted && "opacity-60",
|
|
11169
|
+
description && "self-start",
|
|
11170
|
+
)}
|
|
11171
|
+
>
|
|
11031
11172
|
{icon}
|
|
11032
11173
|
</span>
|
|
11033
|
-
|
|
11174
|
+
{description ? (
|
|
11175
|
+
<span className="grid min-w-0 flex-1">
|
|
11176
|
+
<span className="truncate">{label}</span>
|
|
11177
|
+
<span
|
|
11178
|
+
id={descriptionId}
|
|
11179
|
+
className="break-words text-xs text-muted-foreground"
|
|
11180
|
+
>
|
|
11181
|
+
{description}
|
|
11182
|
+
</span>
|
|
11183
|
+
</span>
|
|
11184
|
+
) : (
|
|
11185
|
+
<span className="min-w-0 flex-1 truncate">{label}</span>
|
|
11186
|
+
)}
|
|
11034
11187
|
{value ? (
|
|
11035
11188
|
<span className="max-w-28 shrink-0 truncate text-xs text-muted-foreground">
|
|
11036
11189
|
{value}
|