@mastra/playground-ui 70.0.0 → 70.1.0-alpha.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/dist/{EmptyState-juw2jci2.js → EmptyState-DJaZF543.js} +43 -23
- package/dist/EmptyState-DJaZF543.js.map +1 -0
- package/dist/{EmptyState-C5O9fTEq.cjs → EmptyState-DnW6SNEx.cjs} +43 -23
- package/dist/EmptyState-DnW6SNEx.cjs.map +1 -0
- package/dist/EmptyStateArt.css +12028 -0
- package/dist/{Section-Dk_Vcsi7.cjs → Section-BdO9TFjY.cjs} +2 -2
- package/dist/{Section-Dk_Vcsi7.cjs.map → Section-BdO9TFjY.cjs.map} +1 -1
- package/dist/{Section-D6JJ926q.js → Section-DV2aLnkc.js} +2 -2
- package/dist/{Section-D6JJ926q.js.map → Section-DV2aLnkc.js.map} +1 -1
- package/dist/components/EmptyState.cjs.js +1 -1
- package/dist/components/EmptyState.es.js +1 -1
- package/dist/components/EmptyStateArt.cjs.js +9695 -0
- package/dist/components/EmptyStateArt.cjs.js.map +1 -0
- package/dist/components/EmptyStateArt.d.ts +1 -0
- package/dist/components/EmptyStateArt.es.js +9694 -0
- package/dist/components/EmptyStateArt.es.js.map +1 -0
- package/dist/components/FileDropBackdrop.cjs.js +1 -1
- package/dist/components/FileDropBackdrop.es.js +1 -1
- package/dist/components/Section.cjs.js +1 -1
- package/dist/components/Section.es.js +1 -1
- package/dist/components/SideDialog.cjs.js +1 -1
- package/dist/components/SideDialog.es.js +1 -1
- package/dist/domains/auth/components/permission-denied.cjs.js +1 -1
- package/dist/domains/auth/components/permission-denied.es.js +1 -1
- package/dist/domains/auth/components/session-expired.cjs.js +1 -1
- package/dist/domains/auth/components/session-expired.es.js +1 -1
- package/dist/domains/datasets/components/add-dataset-item-dialog/add-dataset-item-dialog.cjs.js +1 -1
- package/dist/domains/datasets/components/add-dataset-item-dialog/add-dataset-item-dialog.es.js +1 -1
- package/dist/domains/datasets/components/add-dataset-item-dialog/collapsible-settings-row.cjs.js +1 -1
- package/dist/domains/datasets/components/add-dataset-item-dialog/collapsible-settings-row.es.js +1 -1
- package/dist/domains/knowledge/components/KnowledgePageDetail.cjs.js +99 -58
- package/dist/domains/knowledge/components/KnowledgePageDetail.cjs.js.map +1 -1
- package/dist/domains/knowledge/components/KnowledgePageDetail.es.js +99 -58
- package/dist/domains/knowledge/components/KnowledgePageDetail.es.js.map +1 -1
- package/dist/domains/knowledge/components/KnowledgePageExplorer.cjs.js +22 -1
- package/dist/domains/knowledge/components/KnowledgePageExplorer.cjs.js.map +1 -1
- package/dist/domains/knowledge/components/KnowledgePageExplorer.es.js +22 -1
- package/dist/domains/knowledge/components/KnowledgePageExplorer.es.js.map +1 -1
- package/dist/domains/knowledge/components/KnowledgePageTree.cjs.js +1 -1
- package/dist/domains/knowledge/components/KnowledgePageTree.cjs.js.map +1 -1
- package/dist/domains/knowledge/components/KnowledgePageTree.es.js +2 -2
- package/dist/domains/knowledge/components/KnowledgePageTree.es.js.map +1 -1
- package/dist/domains/knowledge/lib/pageAddress.cjs.js +21 -6
- package/dist/domains/knowledge/lib/pageAddress.cjs.js.map +1 -1
- package/dist/domains/knowledge/lib/pageAddress.es.js +21 -6
- package/dist/domains/knowledge/lib/pageAddress.es.js.map +1 -1
- package/dist/domains/logs/components/logs-error-content.cjs.js +1 -1
- package/dist/domains/logs/components/logs-error-content.es.js +1 -1
- package/dist/domains/logs/components/no-logs-info.cjs.js +1 -1
- package/dist/domains/logs/components/no-logs-info.es.js +1 -1
- package/dist/domains/mcps/components/mcp-app-viewer.cjs.js +1 -1
- package/dist/domains/mcps/components/mcp-app-viewer.es.js +1 -1
- package/dist/domains/mcps/hooks/use-mcp-app-tool-call.cjs.js +1 -1
- package/dist/domains/mcps/hooks/use-mcp-app-tool-call.es.js +1 -1
- package/dist/domains/memory/components/observation-detail-view.cjs.js +1 -1
- package/dist/domains/memory/components/observation-detail-view.es.js +1 -1
- package/dist/domains/observability/components/observability-capability-gate.cjs.js +1 -1
- package/dist/domains/observability/components/observability-capability-gate.es.js +1 -1
- package/dist/domains/scores/components/trace-scores-tab.cjs.js +1 -1
- package/dist/domains/scores/components/trace-scores-tab.es.js +1 -1
- package/dist/domains/traces/components/no-traces-info.cjs.js +1 -1
- package/dist/domains/traces/components/no-traces-info.es.js +1 -1
- package/dist/domains/traces/components/traces-error-content.cjs.js +1 -1
- package/dist/domains/traces/components/traces-error-content.es.js +1 -1
- package/dist/domains/workflows/components/workflows-list/no-workflows-info.cjs.js +1 -1
- package/dist/domains/workflows/components/workflows-list/no-workflows-info.es.js +1 -1
- package/dist/domains/workspace/components/workspace-add-skill-dialog.cjs.js +1 -1
- package/dist/domains/workspace/components/workspace-add-skill-dialog.es.js +1 -1
- package/dist/domains/workspace/components/workspace-parts.cjs.js +1 -1
- package/dist/domains/workspace/components/workspace-parts.es.js +1 -1
- package/dist/domains/workspace/components/workspace-search.cjs.js +1 -1
- package/dist/domains/workspace/components/workspace-search.es.js +1 -1
- package/dist/ee/signals/components/trace-intelligence-entity-detail.cjs.js +1 -1
- package/dist/ee/signals/components/trace-intelligence-entity-detail.es.js +1 -1
- package/dist/ee/signals/components/trace-intelligence-entity-index.cjs.js +1 -1
- package/dist/ee/signals/components/trace-intelligence-entity-index.es.js +1 -1
- package/dist/new/settings.cjs.js +2 -2
- package/dist/new/settings.es.js +2 -2
- package/dist/{settings-DIrzLcgE.js → settings-B7RMGKgf.js} +31 -15
- package/dist/settings-B7RMGKgf.js.map +1 -0
- package/dist/{settings-5PdsNlhV.cjs → settings-CYKWxfrJ.cjs} +31 -15
- package/dist/settings-CYKWxfrJ.cjs.map +1 -0
- package/dist/{settings-row-C2HTuwjN.js → settings-row-BnlFZSQL.js} +27 -5
- package/dist/settings-row-BnlFZSQL.js.map +1 -0
- package/dist/{settings-row-Dfi4pLnl.cjs → settings-row-Da1HHyBg.cjs} +27 -5
- package/dist/settings-row-Da1HHyBg.cjs.map +1 -0
- package/dist/src/domains/knowledge/components/KnowledgePageDetail.d.ts +11 -1
- package/dist/src/domains/knowledge/lib/pageAddress.d.ts +4 -2
- package/dist/src/ds/components/EmptyState/EmptyState.d.ts +3 -1
- package/dist/src/ds/components/EmptyStateArt/art/alerts-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/api-keys-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/byok-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/connect-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/databases-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/deploys-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/destinations-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/env-vars-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/environments-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/gateway-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/gateway-threads-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/importers-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/knowledge-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/license-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/logs-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/memory-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/models-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/projects-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/scene-style.d.ts +17 -0
- package/dist/src/ds/components/EmptyStateArt/art/scenes.d.ts +3 -0
- package/dist/src/ds/components/EmptyStateArt/art/traces-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/upgrade-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/widgets-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/workers-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art/workspaces-scene.d.ts +2 -0
- package/dist/src/ds/components/EmptyStateArt/art-motion.d.ts +1 -0
- package/dist/src/ds/components/EmptyStateArt/empty-state-art.d.ts +11 -0
- package/dist/src/ds/components/EmptyStateArt/index.d.ts +3 -0
- package/dist/src/ds/new/settings/settings-list.d.ts +16 -2
- package/dist/src/ds/new/settings/settings-row.d.ts +22 -2
- package/dist/style.css +65 -0
- package/dist/{types-DT1pgDom.cjs → types-CVS7iNs8.cjs} +2 -2
- package/dist/{types-DT1pgDom.cjs.map → types-CVS7iNs8.cjs.map} +1 -1
- package/dist/{types-Dl74jixe.js → types-D64dArGX.js} +2 -2
- package/dist/{types-Dl74jixe.js.map → types-D64dArGX.js.map} +1 -1
- package/package.json +6 -6
- package/dist/EmptyState-C5O9fTEq.cjs.map +0 -1
- package/dist/EmptyState-juw2jci2.js.map +0 -1
- package/dist/settings-5PdsNlhV.cjs.map +0 -1
- package/dist/settings-DIrzLcgE.js.map +0 -1
- package/dist/settings-row-C2HTuwjN.js.map +0 -1
- package/dist/settings-row-Dfi4pLnl.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useWorkspaceContext } from "./use-workspace-context.es.js";
|
|
2
2
|
import { WorkspaceError } from "./workspace-error.es.js";
|
|
3
3
|
import { t as Button } from "../../../Button-BcQ4CsoL.js";
|
|
4
|
-
import { n as EmptyState } from "../../../EmptyState-
|
|
4
|
+
import { n as EmptyState } from "../../../EmptyState-DJaZF543.js";
|
|
5
5
|
import { t as Input } from "../../../input-DqReKX0A.js";
|
|
6
6
|
import { t as Metadata } from "../../../Metadata-DlVgmRTA.js";
|
|
7
7
|
import { n as Skeleton } from "../../../skeleton-text-BPa4Tg4u.js";
|
|
@@ -9,7 +9,7 @@ const require_ee_signals_signals_loading_skeleton = require("../signals-loading-
|
|
|
9
9
|
const require_ee_signals_trace_intelligence_provider = require("../trace-intelligence-provider.cjs.js");
|
|
10
10
|
const require_ee_signals_use_trace_intelligence = require("../use-trace-intelligence.cjs.js");
|
|
11
11
|
const require_ee_signals_components_signals_empty_state = require("./signals-empty-state.cjs.js");
|
|
12
|
-
const require_EmptyState = require("../../../EmptyState-
|
|
12
|
+
const require_EmptyState = require("../../../EmptyState-DnW6SNEx.cjs");
|
|
13
13
|
let react = require("react");
|
|
14
14
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
15
15
|
// src/ee/signals/components/trace-intelligence-entity-detail.tsx
|
|
@@ -8,7 +8,7 @@ import { SignalsLoadingSkeleton } from "../signals-loading-skeleton.es.js";
|
|
|
8
8
|
import { TraceIntelligenceProvider } from "../trace-intelligence-provider.es.js";
|
|
9
9
|
import { useTraceIntelligence } from "../use-trace-intelligence.es.js";
|
|
10
10
|
import { SignalsEmptyState } from "./signals-empty-state.es.js";
|
|
11
|
-
import { n as EmptyState } from "../../../EmptyState-
|
|
11
|
+
import { n as EmptyState } from "../../../EmptyState-DJaZF543.js";
|
|
12
12
|
import { useState } from "react";
|
|
13
13
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
14
14
|
// src/ee/signals/components/trace-intelligence-entity-detail.tsx
|
|
@@ -11,7 +11,7 @@ const require_domains_auth_components_session_expired = require("../../../domain
|
|
|
11
11
|
const require_Button = require("../../../Button-C_tgwxcK.cjs");
|
|
12
12
|
const require_buttons_group = require("../../../buttons-group-DM6_Kohs.cjs");
|
|
13
13
|
const require_DataList = require("../../../DataList-_kJDJLvJ.cjs");
|
|
14
|
-
const require_EmptyState = require("../../../EmptyState-
|
|
14
|
+
const require_EmptyState = require("../../../EmptyState-DnW6SNEx.cjs");
|
|
15
15
|
const require_components_SearchInput = require("../../../components/SearchInput.cjs.js");
|
|
16
16
|
const require_select = require("../../../select-BbK-jRLl.cjs");
|
|
17
17
|
const require_icons_central_IconLayoutColumn = require("../../../icons/central/IconLayoutColumn.cjs.js");
|
|
@@ -10,7 +10,7 @@ import { SessionExpired } from "../../../domains/auth/components/session-expired
|
|
|
10
10
|
import { t as Button } from "../../../Button-BcQ4CsoL.js";
|
|
11
11
|
import { t as ButtonsGroup } from "../../../buttons-group-DA_wORqQ.js";
|
|
12
12
|
import { r as DataListSkeleton } from "../../../DataList-gS_SuRAE.js";
|
|
13
|
-
import { n as EmptyState } from "../../../EmptyState-
|
|
13
|
+
import { n as EmptyState } from "../../../EmptyState-DJaZF543.js";
|
|
14
14
|
import { SearchInput, listSearchProps } from "../../../components/SearchInput.es.js";
|
|
15
15
|
import { i as SelectItem, n as SelectContent, o as SelectTrigger, s as SelectValue, t as Select } from "../../../select-C7Rd205v.js";
|
|
16
16
|
import { IconLayoutColumn } from "../../../icons/central/IconLayoutColumn.es.js";
|
package/dist/new/settings.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_settings = require("../settings-
|
|
2
|
+
const require_settings = require("../settings-CYKWxfrJ.cjs");
|
|
3
3
|
const require_settings_layout = require("../settings-layout-BxtShpY6.cjs");
|
|
4
|
-
const require_settings_row = require("../settings-row-
|
|
4
|
+
const require_settings_row = require("../settings-row-Da1HHyBg.cjs");
|
|
5
5
|
exports.SettingsContainer = require_settings.SettingsContainer;
|
|
6
6
|
exports.SettingsDescription = require_settings.SettingsDescription;
|
|
7
7
|
exports.SettingsEmptyRow = require_settings.SettingsEmptyRow;
|
package/dist/new/settings.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as SettingsListHeader, c as SettingsGroup, d as SettingsContainer, i as SettingsItemIcon, l as SettingsHeader, n as SettingsEmptyRow, o as SettingsNoticeRow, r as SettingsItem, s as SettingsDescription, t as SettingsSkeleton, u as SettingsTitle } from "../settings-
|
|
1
|
+
import { a as SettingsListHeader, c as SettingsGroup, d as SettingsContainer, i as SettingsItemIcon, l as SettingsHeader, n as SettingsEmptyRow, o as SettingsNoticeRow, r as SettingsItem, s as SettingsDescription, t as SettingsSkeleton, u as SettingsTitle } from "../settings-B7RMGKgf.js";
|
|
2
2
|
import { t as SettingsLayout } from "../settings-layout-UPnWI3FZ.js";
|
|
3
|
-
import { n as SettingsRow, t as SettingsFieldsetRow } from "../settings-row-
|
|
3
|
+
import { n as SettingsRow, t as SettingsFieldsetRow } from "../settings-row-BnlFZSQL.js";
|
|
4
4
|
export { SettingsContainer, SettingsDescription, SettingsEmptyRow, SettingsFieldsetRow, SettingsGroup, SettingsHeader, SettingsItem, SettingsItemIcon, SettingsLayout, SettingsListHeader, SettingsNoticeRow, SettingsRow, SettingsSkeleton, SettingsTitle };
|
|
@@ -2,7 +2,7 @@ import { fieldsOnSurface } from "./primitives/raised-surface.es.js";
|
|
|
2
2
|
import { t as cn } from "./utils-DQx8TpNT.js";
|
|
3
3
|
import { i as TooltipTrigger, n as TooltipContent, t as Tooltip } from "./tooltip-DJcze2VZ.js";
|
|
4
4
|
import { t as Txt } from "./Txt-5efBsb2p.js";
|
|
5
|
-
import { n as SettingsRow } from "./settings-row-
|
|
5
|
+
import { n as SettingsRow } from "./settings-row-BnlFZSQL.js";
|
|
6
6
|
import { n as Skeleton, t as SkeletonText } from "./skeleton-text-BPa4Tg4u.js";
|
|
7
7
|
import { createContext, useContext, useId } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -23,6 +23,7 @@ function SettingsContainer({ className, ...props }) {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
// src/ds/new/settings/settings-header.tsx
|
|
26
|
+
var settingsInset = "[--settings-inset:0px] in-data-[slot=settings-layout]:[--settings-inset:--spacing(2.5)] ps-(--settings-inset)";
|
|
26
27
|
var SettingsTitleIdContext = createContext(void 0);
|
|
27
28
|
/** One section of a settings page: a `SettingsTitle` (or `SettingsHeader`) above its `SettingsContainer`. */
|
|
28
29
|
function SettingsGroup({ className, ...props }) {
|
|
@@ -53,12 +54,12 @@ function SettingsHeader({ action, children, className, ...props }) {
|
|
|
53
54
|
function SettingsTitle({ accessory, info, className, children, ...props }) {
|
|
54
55
|
const titleId = useContext(SettingsTitleIdContext);
|
|
55
56
|
return /* @__PURE__ */ jsxs("div", {
|
|
56
|
-
className: "flex min-w-0 flex-wrap items-center gap-2
|
|
57
|
+
className: cn("flex min-w-0 flex-wrap items-center gap-2", settingsInset),
|
|
57
58
|
children: [/* @__PURE__ */ jsx(Txt, {
|
|
58
59
|
as: "h2",
|
|
59
60
|
id: titleId,
|
|
60
61
|
variant: "subheading",
|
|
61
|
-
tone: "
|
|
62
|
+
tone: "ink",
|
|
62
63
|
className,
|
|
63
64
|
...props,
|
|
64
65
|
children: info == null ? children : /* @__PURE__ */ jsx(SettingsTitleInfo, {
|
|
@@ -90,18 +91,21 @@ function SettingsDescription({ className, ...props }) {
|
|
|
90
91
|
as: "p",
|
|
91
92
|
variant: "caption",
|
|
92
93
|
tone: "muted",
|
|
93
|
-
className: cn(
|
|
94
|
+
className: cn(settingsInset, className),
|
|
94
95
|
...props
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
// src/ds/new/settings/settings-list.tsx
|
|
98
|
-
/**
|
|
99
|
-
|
|
99
|
+
/**
|
|
100
|
+
* A list's first row: its count, caption or empty text on the left and its one action ("Add account", "Invite
|
|
101
|
+
* member") on the right. A full list and an empty one share this exact look, so the card reads the same either way.
|
|
102
|
+
*/
|
|
103
|
+
function SettingsListBar({ action, className, children, ...props }) {
|
|
100
104
|
return /* @__PURE__ */ jsxs("div", {
|
|
101
|
-
className: cn("flex min-h-8 items-center justify-between gap-3", className),
|
|
105
|
+
className: cn("flex min-h-8 items-center justify-between gap-3 sm:min-h-[calc(var(--text-label)*1.5+1px+var(--text-caption)*1.5+--spacing(6.5))]", className),
|
|
102
106
|
...props,
|
|
103
107
|
children: [/* @__PURE__ */ jsx("div", {
|
|
104
|
-
className:
|
|
108
|
+
className: "min-w-0 truncate text-label text-foreground",
|
|
105
109
|
children
|
|
106
110
|
}), action != null && /* @__PURE__ */ jsx("div", {
|
|
107
111
|
className: "flex shrink-0 items-center gap-2",
|
|
@@ -113,15 +117,16 @@ function SettingsListBar({ tone, action, className, children, ...props }) {
|
|
|
113
117
|
function SettingsListHeader(props) {
|
|
114
118
|
return /* @__PURE__ */ jsx(SettingsListBar, {
|
|
115
119
|
"data-slot": "settings-list-header",
|
|
116
|
-
tone: "title",
|
|
117
120
|
...props
|
|
118
121
|
});
|
|
119
122
|
}
|
|
120
|
-
/**
|
|
123
|
+
/**
|
|
124
|
+
* An empty list's only row: what's missing on the left ("No join links"), the list's action on the right. Looks
|
|
125
|
+
* exactly like `SettingsListHeader`, so empty and full lists match; use it for every empty list in a card.
|
|
126
|
+
*/
|
|
121
127
|
function SettingsEmptyRow(props) {
|
|
122
128
|
return /* @__PURE__ */ jsx(SettingsListBar, {
|
|
123
129
|
"data-slot": "settings-empty-row",
|
|
124
|
-
tone: "muted",
|
|
125
130
|
...props
|
|
126
131
|
});
|
|
127
132
|
}
|
|
@@ -143,11 +148,22 @@ function SettingsItemIcon({ className, ...props }) {
|
|
|
143
148
|
...props
|
|
144
149
|
});
|
|
145
150
|
}
|
|
146
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* One thing in a settings list (an account, a member, a session, a source, a package version). Its right side holds
|
|
153
|
+
* the item's status or its own actions (Remove, Revoke, Copy), not a control that changes a setting. Goes in a
|
|
154
|
+
* `SettingsContainer`, usually under a `SettingsListHeader`.
|
|
155
|
+
*
|
|
156
|
+
* For a setting the person changes (an input, select or switch with a label), use `SettingsRow` instead.
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* <SettingsItem media={<Avatar size="md" … />} title="Ada Lovelace" description="ada@example.com">
|
|
160
|
+
* <Button size="sm" variant="ghost">Remove</Button>
|
|
161
|
+
* </SettingsItem>
|
|
162
|
+
*/
|
|
147
163
|
function SettingsItem({ media, title, description, children, className, ...props }) {
|
|
148
164
|
return /* @__PURE__ */ jsxs("div", {
|
|
149
165
|
"data-slot": "settings-item",
|
|
150
|
-
className: cn("flex min-w-0 items-center gap-3", className),
|
|
166
|
+
className: cn("flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 sm:flex-nowrap", className),
|
|
151
167
|
...props,
|
|
152
168
|
children: [
|
|
153
169
|
media,
|
|
@@ -163,7 +179,7 @@ function SettingsItem({ media, title, description, children, className, ...props
|
|
|
163
179
|
})]
|
|
164
180
|
}),
|
|
165
181
|
children != null && /* @__PURE__ */ jsx("div", {
|
|
166
|
-
className: "flex
|
|
182
|
+
className: "flex min-w-0 basis-full items-center gap-2 sm:shrink-0 sm:basis-auto",
|
|
167
183
|
children
|
|
168
184
|
})
|
|
169
185
|
]
|
|
@@ -221,4 +237,4 @@ function RowPlaceholder() {
|
|
|
221
237
|
}
|
|
222
238
|
export { SettingsListHeader as a, SettingsGroup as c, SettingsContainer as d, SettingsItemIcon as i, SettingsHeader as l, SettingsEmptyRow as n, SettingsNoticeRow as o, SettingsItem as r, SettingsDescription as s, SettingsSkeleton as t, SettingsTitle as u };
|
|
223
239
|
|
|
224
|
-
//# sourceMappingURL=settings-
|
|
240
|
+
//# sourceMappingURL=settings-B7RMGKgf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-B7RMGKgf.js","names":[],"sources":["../src/ds/new/settings/settings-container.tsx","../src/ds/new/settings/settings-header.tsx","../src/ds/new/settings/settings-list.tsx","../src/ds/new/settings/settings-skeleton.tsx"],"sourcesContent":["import type { ComponentProps } from 'react';\nimport { fieldsOnSurface } from '@/ds/primitives/raised-surface';\nimport { cn } from '@/lib/utils';\n\n/**\n * A settings card: the card fill with no rim, 14px from its edge to the content, and hairlines between rows that\n * stop at that inset. The card owns its rows' spacing: each direct child gets 13px above and below, and the card\n * adds the last 1px at its edges. Children with nothing in them (an empty `SettingsNoticeRow`) take no space and\n * draw no hairline, so a list can always render its notice row.\n */\nconst settingsCardStyle = cn(\n // `!`: the card owns row spacing, so a row's own reset (`Fieldset`'s `p-0`) can't remove it.\n 'flex min-w-0 flex-col rounded-xl bg-card px-3.5 py-px *:py-3.25! *:empty:hidden',\n '[&>:not(:empty)~:not(:empty)]:border-t [&>:not(:empty)~:not(:empty)]:border-border',\n fieldsOnSurface,\n);\n\nexport type SettingsContainerProps = ComponentProps<'div'>;\n\n/** One settings card. Holds `SettingsRow`s, `SettingsItem`s, a `SettingsListHeader` or a `SettingsEmptyRow`. */\nexport function SettingsContainer({ className, ...props }: SettingsContainerProps) {\n return <div data-slot=\"settings-container\" className={cn(settingsCardStyle, className)} {...props} />;\n}\n","import { createContext, useContext, useId } from 'react';\nimport type { ComponentProps, ReactNode } from 'react';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@/ds/components/Tooltip';\nimport { Txt } from '@/ds/components/Txt';\nimport { cn } from '@/lib/utils';\n\n// On a settings page (`SettingsLayout`), section titles and descriptions sit 10px inside the card's edge, in line with\n// the inset page title. Anywhere else (forms, other pages) they line up with the page's left edge and field labels.\n// The inset is a custom property, so a caller's `ps-*` class still wins. Written out in full so Tailwind finds it.\nconst settingsInset =\n '[--settings-inset:0px] in-data-[slot=settings-layout]:[--settings-inset:--spacing(2.5)] ps-(--settings-inset)';\n\nconst SettingsTitleIdContext = createContext<string | undefined>(undefined);\n\n/** One section of a settings page: a `SettingsTitle` (or `SettingsHeader`) above its `SettingsContainer`. */\nexport function SettingsGroup({ className, ...props }: ComponentProps<'section'>) {\n const titleId = useId();\n\n return (\n <SettingsTitleIdContext.Provider value={titleId}>\n <section\n aria-labelledby={titleId}\n className={cn('flex min-w-0 scroll-mt-4 flex-col gap-2', className)}\n {...props}\n />\n </SettingsTitleIdContext.Provider>\n );\n}\n\n/** A section title with something beside it. A list's actions go in its card (`SettingsListHeader`), not here. */\nexport function SettingsHeader({\n action,\n children,\n className,\n ...props\n}: ComponentProps<'header'> & { action?: ReactNode }) {\n return (\n <header\n className={cn('flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4', className)}\n {...props}\n >\n <div className=\"flex min-w-0 flex-col gap-1\">{children}</div>\n {action != null && <div className=\"shrink-0\">{action}</div>}\n </header>\n );\n}\n\nexport function SettingsTitle({\n accessory,\n info,\n className,\n children,\n ...props\n}: Omit<ComponentProps<'h2'>, 'id'> & {\n accessory?: ReactNode;\n /** What the section is for, shown in a tooltip on the title. For sections whose name isn't self-explanatory. */\n info?: ReactNode;\n}) {\n const titleId = useContext(SettingsTitleIdContext);\n\n return (\n <div className={cn('flex min-w-0 flex-wrap items-center gap-2', settingsInset)}>\n <Txt as=\"h2\" id={titleId} variant=\"subheading\" tone=\"ink\" className={className} {...props}>\n {info == null ? children : <SettingsTitleInfo info={info}>{children}</SettingsTitleInfo>}\n </Txt>\n {accessory}\n </div>\n );\n}\n\n/** The title's text as a tooltip trigger, described by `info`. */\nfunction SettingsTitleInfo({ info, children }: { info: ReactNode; children: ReactNode }) {\n const infoId = useId();\n\n return (\n <Tooltip>\n <TooltipTrigger\n render={\n <span\n tabIndex={0}\n aria-describedby={infoId}\n className=\"cursor-help underline decoration-transparent decoration-dotted underline-offset-4 hover:decoration-current focus-visible:decoration-current focus-visible:outline-none\"\n />\n }\n >\n {children}\n </TooltipTrigger>\n <TooltipContent id={infoId} keepMounted className=\"max-w-64\">\n {info}\n </TooltipContent>\n </Tooltip>\n );\n}\n\nexport function SettingsDescription({ className, ...props }: ComponentProps<'p'>) {\n return <Txt as=\"p\" variant=\"caption\" tone=\"muted\" className={cn(settingsInset, className)} {...props} />;\n}\n","import type { ComponentProps, ReactNode } from 'react';\nimport { cn } from '@/lib/utils';\n\n/**\n * A list's first row: its count, caption or empty text on the left and its one action (\"Add account\", \"Invite\n * member\") on the right. A full list and an empty one share this exact look, so the card reads the same either way.\n */\nfunction SettingsListBar({ action, className, children, ...props }: ComponentProps<'div'> & { action?: ReactNode }) {\n return (\n <div\n className={cn(\n // As tall as a `SettingsRow` (label + one-line description) plus the 13px the card puts above and below each\n // row, since this row's own box includes that padding. Keeps a list's first row level with the settings above it.\n 'flex min-h-8 items-center justify-between gap-3 sm:min-h-[calc(var(--text-label)*1.5+1px+var(--text-caption)*1.5+--spacing(6.5))]',\n className,\n )}\n {...props}\n >\n <div className=\"min-w-0 truncate text-label text-foreground\">{children}</div>\n {action != null && <div className=\"flex shrink-0 items-center gap-2\">{action}</div>}\n </div>\n );\n}\n\nexport type SettingsListHeaderProps = ComponentProps<'div'> & {\n /** The list's action, on the right. Refresh and other list controls can sit beside it. */\n action?: ReactNode;\n};\n\n/** The first row of a list's `SettingsContainer`: a count (\"2 accounts\") and the list's action. */\nexport function SettingsListHeader(props: SettingsListHeaderProps) {\n return <SettingsListBar data-slot=\"settings-list-header\" {...props} />;\n}\n\nexport type SettingsEmptyRowProps = ComponentProps<'div'> & {\n /** The same action the list's header would hold, so an empty list still offers it. */\n action?: ReactNode;\n};\n\n/**\n * An empty list's only row: what's missing on the left (\"No join links\"), the list's action on the right. Looks\n * exactly like `SettingsListHeader`, so empty and full lists match; use it for every empty list in a card.\n */\nexport function SettingsEmptyRow(props: SettingsEmptyRowProps) {\n return <SettingsListBar data-slot=\"settings-empty-row\" {...props} />;\n}\n\n/** A list's notices and errors, as a row of its `SettingsContainer`. Takes no space while it has nothing in it. */\nexport function SettingsNoticeRow({ className, ...props }: ComponentProps<'div'>) {\n return <div data-slot=\"settings-notice-row\" className={cn('flex flex-col gap-2', className)} {...props} />;\n}\n\n/** The square on the left of a `SettingsItem` holding an icon or logo. Avatars use `Avatar size=\"md\"`, the\n * same size, so every list's text starts at the same place. */\nexport function SettingsItemIcon({ className, ...props }: ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"settings-item-icon\"\n aria-hidden\n className={cn(\n 'flex size-avatar-md shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground [&>svg]:size-icon-md',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport type SettingsItemProps = Omit<ComponentProps<'div'>, 'title'> & {\n /** A `SettingsItemIcon` or an `Avatar size=\"md\"`. */\n media?: ReactNode;\n title: ReactNode;\n /** One line under the title: \"GitHub · Connected 3 weeks ago\". */\n description?: ReactNode;\n /** The item's status or actions, on the right. */\n children?: ReactNode;\n};\n\n/**\n * One thing in a settings list (an account, a member, a session, a source, a package version). Its right side holds\n * the item's status or its own actions (Remove, Revoke, Copy), not a control that changes a setting. Goes in a\n * `SettingsContainer`, usually under a `SettingsListHeader`.\n *\n * For a setting the person changes (an input, select or switch with a label), use `SettingsRow` instead.\n *\n * @example\n * <SettingsItem media={<Avatar size=\"md\" … />} title=\"Ada Lovelace\" description=\"ada@example.com\">\n * <Button size=\"sm\" variant=\"ghost\">Remove</Button>\n * </SettingsItem>\n */\nexport function SettingsItem({ media, title, description, children, className, ...props }: SettingsItemProps) {\n return (\n <div\n data-slot=\"settings-item\"\n // Below `sm` the item's value or actions wrap onto their own full-width line under the title, as a\n // `SettingsRow`'s control does, so a long value (an email, a type) never squeezes the title out.\n className={cn('flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 sm:flex-nowrap', className)}\n {...props}\n >\n {media}\n <div className=\"flex min-w-0 flex-1 flex-col gap-px\">\n {/* A string title truncates, so it also goes in the hover title to stay readable in full. */}\n <div className=\"truncate text-label text-foreground\" title={typeof title === 'string' ? title : undefined}>\n {title}\n </div>\n {description != null && <div className=\"truncate text-caption text-muted-foreground\">{description}</div>}\n </div>\n {children != null && (\n <div className=\"flex min-w-0 basis-full items-center gap-2 sm:shrink-0 sm:basis-auto\">{children}</div>\n )}\n </div>\n );\n}\n","import { SettingsItem } from './settings-list';\nimport { SettingsRow } from './settings-row';\nimport { Skeleton } from '@/ds/components/Skeleton/skeleton';\nimport { SkeletonText } from '@/ds/components/Skeleton/skeleton-text';\nimport { cn } from '@/lib/utils';\n\nconst bar = 'motion-reduce:before:animate-none';\n\nexport type SettingsSkeletonProps = {\n /** Announced while loading, e.g. \"Loading members\". */\n label: string;\n /** Placeholder rows, matching how many the loaded list usually has. */\n rows?: number;\n /** `row` stands in for `SettingsRow`s (label left, control right); `item` for `SettingsItem`s (icon, title, description). */\n variant?: 'row' | 'item';\n className?: string;\n};\n\n/**\n * The loading state for anything inside a `SettingsContainer`. Placeholders are built from the real `SettingsRow` and\n * `SettingsItem`, so they sit exactly where the loaded rows will.\n *\n * ```tsx\n * <SettingsContainer>\n * {isLoading ? <SettingsSkeleton label=\"Loading members\" variant=\"item\" rows={3} /> : members.map(...)}\n * </SettingsContainer>\n * ```\n */\nexport function SettingsSkeleton({ label, rows = 2, variant = 'row', className }: SettingsSkeletonProps) {\n const Placeholder = variant === 'item' ? ItemPlaceholder : RowPlaceholder;\n\n return (\n // One child of the card, so it takes the card's row padding; inside, rows repeat that rhythm with hairlines.\n <div\n role=\"status\"\n aria-label={label}\n data-slot=\"settings-skeleton\"\n className={cn('grid divide-y divide-border *:py-3.25 *:first:pt-0 *:last:pb-0', className)}\n >\n {Array.from({ length: rows }, (_, index) => (\n <Placeholder key={index} />\n ))}\n </div>\n );\n}\n\nfunction ItemPlaceholder() {\n return (\n <SettingsItem\n aria-hidden\n media={<Skeleton className={cn('size-avatar-md shrink-0 rounded-lg', bar)} />}\n title={<SkeletonText line=\"text-label\" className={cn('w-32', bar)} />}\n description={<SkeletonText line=\"text-caption\" className={cn('w-48 max-w-full', bar)} />}\n />\n );\n}\n\nfunction RowPlaceholder() {\n return (\n <SettingsRow\n aria-hidden\n label={<SkeletonText line=\"text-label\" className={cn('w-28', bar)} />}\n description={<SkeletonText line=\"text-caption\" className={cn('w-48 max-w-full', bar)} />}\n >\n <Skeleton className={cn('h-control-sm w-28 max-w-full rounded-full', bar)} />\n </SettingsRow>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAUA,IAAM,oBAAoB,GAExB,mFACA,sFACA,eACF;;AAKA,SAAgB,kBAAkB,EAAE,WAAW,GAAG,SAAiC;CACjF,OAAO,oBAAC,OAAD;EAAK,aAAU;EAAqB,WAAW,GAAG,mBAAmB,SAAS;EAAG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surface.c
|
|
|
2
2
|
const require_utils = require("./utils-uDc1ofX1.cjs");
|
|
3
3
|
const require_tooltip = require("./tooltip-BsExuMO8.cjs");
|
|
4
4
|
const require_Txt = require("./Txt-_00wWxTd.cjs");
|
|
5
|
-
const require_settings_row = require("./settings-row-
|
|
5
|
+
const require_settings_row = require("./settings-row-Da1HHyBg.cjs");
|
|
6
6
|
const require_skeleton_text = require("./skeleton-text-Bi4d2-D8.cjs");
|
|
7
7
|
let react = require("react");
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -23,6 +23,7 @@ function SettingsContainer({ className, ...props }) {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
// src/ds/new/settings/settings-header.tsx
|
|
26
|
+
var settingsInset = "[--settings-inset:0px] in-data-[slot=settings-layout]:[--settings-inset:--spacing(2.5)] ps-(--settings-inset)";
|
|
26
27
|
var SettingsTitleIdContext = (0, react.createContext)(void 0);
|
|
27
28
|
/** One section of a settings page: a `SettingsTitle` (or `SettingsHeader`) above its `SettingsContainer`. */
|
|
28
29
|
function SettingsGroup({ className, ...props }) {
|
|
@@ -53,12 +54,12 @@ function SettingsHeader({ action, children, className, ...props }) {
|
|
|
53
54
|
function SettingsTitle({ accessory, info, className, children, ...props }) {
|
|
54
55
|
const titleId = (0, react.useContext)(SettingsTitleIdContext);
|
|
55
56
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
56
|
-
className: "flex min-w-0 flex-wrap items-center gap-2
|
|
57
|
+
className: require_utils.cn("flex min-w-0 flex-wrap items-center gap-2", settingsInset),
|
|
57
58
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Txt.Txt, {
|
|
58
59
|
as: "h2",
|
|
59
60
|
id: titleId,
|
|
60
61
|
variant: "subheading",
|
|
61
|
-
tone: "
|
|
62
|
+
tone: "ink",
|
|
62
63
|
className,
|
|
63
64
|
...props,
|
|
64
65
|
children: info == null ? children : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingsTitleInfo, {
|
|
@@ -90,18 +91,21 @@ function SettingsDescription({ className, ...props }) {
|
|
|
90
91
|
as: "p",
|
|
91
92
|
variant: "caption",
|
|
92
93
|
tone: "muted",
|
|
93
|
-
className: require_utils.cn(
|
|
94
|
+
className: require_utils.cn(settingsInset, className),
|
|
94
95
|
...props
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
// src/ds/new/settings/settings-list.tsx
|
|
98
|
-
/**
|
|
99
|
-
|
|
99
|
+
/**
|
|
100
|
+
* A list's first row: its count, caption or empty text on the left and its one action ("Add account", "Invite
|
|
101
|
+
* member") on the right. A full list and an empty one share this exact look, so the card reads the same either way.
|
|
102
|
+
*/
|
|
103
|
+
function SettingsListBar({ action, className, children, ...props }) {
|
|
100
104
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
101
|
-
className: require_utils.cn("flex min-h-8 items-center justify-between gap-3", className),
|
|
105
|
+
className: require_utils.cn("flex min-h-8 items-center justify-between gap-3 sm:min-h-[calc(var(--text-label)*1.5+1px+var(--text-caption)*1.5+--spacing(6.5))]", className),
|
|
102
106
|
...props,
|
|
103
107
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
104
|
-
className:
|
|
108
|
+
className: "min-w-0 truncate text-label text-foreground",
|
|
105
109
|
children
|
|
106
110
|
}), action != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
107
111
|
className: "flex shrink-0 items-center gap-2",
|
|
@@ -113,15 +117,16 @@ function SettingsListBar({ tone, action, className, children, ...props }) {
|
|
|
113
117
|
function SettingsListHeader(props) {
|
|
114
118
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingsListBar, {
|
|
115
119
|
"data-slot": "settings-list-header",
|
|
116
|
-
tone: "title",
|
|
117
120
|
...props
|
|
118
121
|
});
|
|
119
122
|
}
|
|
120
|
-
/**
|
|
123
|
+
/**
|
|
124
|
+
* An empty list's only row: what's missing on the left ("No join links"), the list's action on the right. Looks
|
|
125
|
+
* exactly like `SettingsListHeader`, so empty and full lists match; use it for every empty list in a card.
|
|
126
|
+
*/
|
|
121
127
|
function SettingsEmptyRow(props) {
|
|
122
128
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingsListBar, {
|
|
123
129
|
"data-slot": "settings-empty-row",
|
|
124
|
-
tone: "muted",
|
|
125
130
|
...props
|
|
126
131
|
});
|
|
127
132
|
}
|
|
@@ -143,11 +148,22 @@ function SettingsItemIcon({ className, ...props }) {
|
|
|
143
148
|
...props
|
|
144
149
|
});
|
|
145
150
|
}
|
|
146
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* One thing in a settings list (an account, a member, a session, a source, a package version). Its right side holds
|
|
153
|
+
* the item's status or its own actions (Remove, Revoke, Copy), not a control that changes a setting. Goes in a
|
|
154
|
+
* `SettingsContainer`, usually under a `SettingsListHeader`.
|
|
155
|
+
*
|
|
156
|
+
* For a setting the person changes (an input, select or switch with a label), use `SettingsRow` instead.
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* <SettingsItem media={<Avatar size="md" … />} title="Ada Lovelace" description="ada@example.com">
|
|
160
|
+
* <Button size="sm" variant="ghost">Remove</Button>
|
|
161
|
+
* </SettingsItem>
|
|
162
|
+
*/
|
|
147
163
|
function SettingsItem({ media, title, description, children, className, ...props }) {
|
|
148
164
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
149
165
|
"data-slot": "settings-item",
|
|
150
|
-
className: require_utils.cn("flex min-w-0 items-center gap-3", className),
|
|
166
|
+
className: require_utils.cn("flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 sm:flex-nowrap", className),
|
|
151
167
|
...props,
|
|
152
168
|
children: [
|
|
153
169
|
media,
|
|
@@ -163,7 +179,7 @@ function SettingsItem({ media, title, description, children, className, ...props
|
|
|
163
179
|
})]
|
|
164
180
|
}),
|
|
165
181
|
children != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
166
|
-
className: "flex
|
|
182
|
+
className: "flex min-w-0 basis-full items-center gap-2 sm:shrink-0 sm:basis-auto",
|
|
167
183
|
children
|
|
168
184
|
})
|
|
169
185
|
]
|
|
@@ -286,4 +302,4 @@ Object.defineProperty(exports, "SettingsTitle", {
|
|
|
286
302
|
}
|
|
287
303
|
});
|
|
288
304
|
|
|
289
|
-
//# sourceMappingURL=settings-
|
|
305
|
+
//# sourceMappingURL=settings-CYKWxfrJ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-CYKWxfrJ.cjs","names":["cn","fieldsOnSurface","createContext","useId","cn","useContext","Txt","Tooltip","TooltipTrigger","TooltipContent","cn","cn","Skeleton","SkeletonText","SettingsRow"],"sources":["../src/ds/new/settings/settings-container.tsx","../src/ds/new/settings/settings-header.tsx","../src/ds/new/settings/settings-list.tsx","../src/ds/new/settings/settings-skeleton.tsx"],"sourcesContent":["import type { ComponentProps } from 'react';\nimport { fieldsOnSurface } from '@/ds/primitives/raised-surface';\nimport { cn } from '@/lib/utils';\n\n/**\n * A settings card: the card fill with no rim, 14px from its edge to the content, and hairlines between rows that\n * stop at that inset. The card owns its rows' spacing: each direct child gets 13px above and below, and the card\n * adds the last 1px at its edges. Children with nothing in them (an empty `SettingsNoticeRow`) take no space and\n * draw no hairline, so a list can always render its notice row.\n */\nconst settingsCardStyle = cn(\n // `!`: the card owns row spacing, so a row's own reset (`Fieldset`'s `p-0`) can't remove it.\n 'flex min-w-0 flex-col rounded-xl bg-card px-3.5 py-px *:py-3.25! *:empty:hidden',\n '[&>:not(:empty)~:not(:empty)]:border-t [&>:not(:empty)~:not(:empty)]:border-border',\n fieldsOnSurface,\n);\n\nexport type SettingsContainerProps = ComponentProps<'div'>;\n\n/** One settings card. Holds `SettingsRow`s, `SettingsItem`s, a `SettingsListHeader` or a `SettingsEmptyRow`. */\nexport function SettingsContainer({ className, ...props }: SettingsContainerProps) {\n return <div data-slot=\"settings-container\" className={cn(settingsCardStyle, className)} {...props} />;\n}\n","import { createContext, useContext, useId } from 'react';\nimport type { ComponentProps, ReactNode } from 'react';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@/ds/components/Tooltip';\nimport { Txt } from '@/ds/components/Txt';\nimport { cn } from '@/lib/utils';\n\n// On a settings page (`SettingsLayout`), section titles and descriptions sit 10px inside the card's edge, in line with\n// the inset page title. Anywhere else (forms, other pages) they line up with the page's left edge and field labels.\n// The inset is a custom property, so a caller's `ps-*` class still wins. Written out in full so Tailwind finds it.\nconst settingsInset =\n '[--settings-inset:0px] in-data-[slot=settings-layout]:[--settings-inset:--spacing(2.5)] ps-(--settings-inset)';\n\nconst SettingsTitleIdContext = createContext<string | undefined>(undefined);\n\n/** One section of a settings page: a `SettingsTitle` (or `SettingsHeader`) above its `SettingsContainer`. */\nexport function SettingsGroup({ className, ...props }: ComponentProps<'section'>) {\n const titleId = useId();\n\n return (\n <SettingsTitleIdContext.Provider value={titleId}>\n <section\n aria-labelledby={titleId}\n className={cn('flex min-w-0 scroll-mt-4 flex-col gap-2', className)}\n {...props}\n />\n </SettingsTitleIdContext.Provider>\n );\n}\n\n/** A section title with something beside it. A list's actions go in its card (`SettingsListHeader`), not here. */\nexport function SettingsHeader({\n action,\n children,\n className,\n ...props\n}: ComponentProps<'header'> & { action?: ReactNode }) {\n return (\n <header\n className={cn('flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4', className)}\n {...props}\n >\n <div className=\"flex min-w-0 flex-col gap-1\">{children}</div>\n {action != null && <div className=\"shrink-0\">{action}</div>}\n </header>\n );\n}\n\nexport function SettingsTitle({\n accessory,\n info,\n className,\n children,\n ...props\n}: Omit<ComponentProps<'h2'>, 'id'> & {\n accessory?: ReactNode;\n /** What the section is for, shown in a tooltip on the title. For sections whose name isn't self-explanatory. */\n info?: ReactNode;\n}) {\n const titleId = useContext(SettingsTitleIdContext);\n\n return (\n <div className={cn('flex min-w-0 flex-wrap items-center gap-2', settingsInset)}>\n <Txt as=\"h2\" id={titleId} variant=\"subheading\" tone=\"ink\" className={className} {...props}>\n {info == null ? children : <SettingsTitleInfo info={info}>{children}</SettingsTitleInfo>}\n </Txt>\n {accessory}\n </div>\n );\n}\n\n/** The title's text as a tooltip trigger, described by `info`. */\nfunction SettingsTitleInfo({ info, children }: { info: ReactNode; children: ReactNode }) {\n const infoId = useId();\n\n return (\n <Tooltip>\n <TooltipTrigger\n render={\n <span\n tabIndex={0}\n aria-describedby={infoId}\n className=\"cursor-help underline decoration-transparent decoration-dotted underline-offset-4 hover:decoration-current focus-visible:decoration-current focus-visible:outline-none\"\n />\n }\n >\n {children}\n </TooltipTrigger>\n <TooltipContent id={infoId} keepMounted className=\"max-w-64\">\n {info}\n </TooltipContent>\n </Tooltip>\n );\n}\n\nexport function SettingsDescription({ className, ...props }: ComponentProps<'p'>) {\n return <Txt as=\"p\" variant=\"caption\" tone=\"muted\" className={cn(settingsInset, className)} {...props} />;\n}\n","import type { ComponentProps, ReactNode } from 'react';\nimport { cn } from '@/lib/utils';\n\n/**\n * A list's first row: its count, caption or empty text on the left and its one action (\"Add account\", \"Invite\n * member\") on the right. A full list and an empty one share this exact look, so the card reads the same either way.\n */\nfunction SettingsListBar({ action, className, children, ...props }: ComponentProps<'div'> & { action?: ReactNode }) {\n return (\n <div\n className={cn(\n // As tall as a `SettingsRow` (label + one-line description) plus the 13px the card puts above and below each\n // row, since this row's own box includes that padding. Keeps a list's first row level with the settings above it.\n 'flex min-h-8 items-center justify-between gap-3 sm:min-h-[calc(var(--text-label)*1.5+1px+var(--text-caption)*1.5+--spacing(6.5))]',\n className,\n )}\n {...props}\n >\n <div className=\"min-w-0 truncate text-label text-foreground\">{children}</div>\n {action != null && <div className=\"flex shrink-0 items-center gap-2\">{action}</div>}\n </div>\n );\n}\n\nexport type SettingsListHeaderProps = ComponentProps<'div'> & {\n /** The list's action, on the right. Refresh and other list controls can sit beside it. */\n action?: ReactNode;\n};\n\n/** The first row of a list's `SettingsContainer`: a count (\"2 accounts\") and the list's action. */\nexport function SettingsListHeader(props: SettingsListHeaderProps) {\n return <SettingsListBar data-slot=\"settings-list-header\" {...props} />;\n}\n\nexport type SettingsEmptyRowProps = ComponentProps<'div'> & {\n /** The same action the list's header would hold, so an empty list still offers it. */\n action?: ReactNode;\n};\n\n/**\n * An empty list's only row: what's missing on the left (\"No join links\"), the list's action on the right. Looks\n * exactly like `SettingsListHeader`, so empty and full lists match; use it for every empty list in a card.\n */\nexport function SettingsEmptyRow(props: SettingsEmptyRowProps) {\n return <SettingsListBar data-slot=\"settings-empty-row\" {...props} />;\n}\n\n/** A list's notices and errors, as a row of its `SettingsContainer`. Takes no space while it has nothing in it. */\nexport function SettingsNoticeRow({ className, ...props }: ComponentProps<'div'>) {\n return <div data-slot=\"settings-notice-row\" className={cn('flex flex-col gap-2', className)} {...props} />;\n}\n\n/** The square on the left of a `SettingsItem` holding an icon or logo. Avatars use `Avatar size=\"md\"`, the\n * same size, so every list's text starts at the same place. */\nexport function SettingsItemIcon({ className, ...props }: ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"settings-item-icon\"\n aria-hidden\n className={cn(\n 'flex size-avatar-md shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground [&>svg]:size-icon-md',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport type SettingsItemProps = Omit<ComponentProps<'div'>, 'title'> & {\n /** A `SettingsItemIcon` or an `Avatar size=\"md\"`. */\n media?: ReactNode;\n title: ReactNode;\n /** One line under the title: \"GitHub · Connected 3 weeks ago\". */\n description?: ReactNode;\n /** The item's status or actions, on the right. */\n children?: ReactNode;\n};\n\n/**\n * One thing in a settings list (an account, a member, a session, a source, a package version). Its right side holds\n * the item's status or its own actions (Remove, Revoke, Copy), not a control that changes a setting. Goes in a\n * `SettingsContainer`, usually under a `SettingsListHeader`.\n *\n * For a setting the person changes (an input, select or switch with a label), use `SettingsRow` instead.\n *\n * @example\n * <SettingsItem media={<Avatar size=\"md\" … />} title=\"Ada Lovelace\" description=\"ada@example.com\">\n * <Button size=\"sm\" variant=\"ghost\">Remove</Button>\n * </SettingsItem>\n */\nexport function SettingsItem({ media, title, description, children, className, ...props }: SettingsItemProps) {\n return (\n <div\n data-slot=\"settings-item\"\n // Below `sm` the item's value or actions wrap onto their own full-width line under the title, as a\n // `SettingsRow`'s control does, so a long value (an email, a type) never squeezes the title out.\n className={cn('flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 sm:flex-nowrap', className)}\n {...props}\n >\n {media}\n <div className=\"flex min-w-0 flex-1 flex-col gap-px\">\n {/* A string title truncates, so it also goes in the hover title to stay readable in full. */}\n <div className=\"truncate text-label text-foreground\" title={typeof title === 'string' ? title : undefined}>\n {title}\n </div>\n {description != null && <div className=\"truncate text-caption text-muted-foreground\">{description}</div>}\n </div>\n {children != null && (\n <div className=\"flex min-w-0 basis-full items-center gap-2 sm:shrink-0 sm:basis-auto\">{children}</div>\n )}\n </div>\n );\n}\n","import { SettingsItem } from './settings-list';\nimport { SettingsRow } from './settings-row';\nimport { Skeleton } from '@/ds/components/Skeleton/skeleton';\nimport { SkeletonText } from '@/ds/components/Skeleton/skeleton-text';\nimport { cn } from '@/lib/utils';\n\nconst bar = 'motion-reduce:before:animate-none';\n\nexport type SettingsSkeletonProps = {\n /** Announced while loading, e.g. \"Loading members\". */\n label: string;\n /** Placeholder rows, matching how many the loaded list usually has. */\n rows?: number;\n /** `row` stands in for `SettingsRow`s (label left, control right); `item` for `SettingsItem`s (icon, title, description). */\n variant?: 'row' | 'item';\n className?: string;\n};\n\n/**\n * The loading state for anything inside a `SettingsContainer`. Placeholders are built from the real `SettingsRow` and\n * `SettingsItem`, so they sit exactly where the loaded rows will.\n *\n * ```tsx\n * <SettingsContainer>\n * {isLoading ? <SettingsSkeleton label=\"Loading members\" variant=\"item\" rows={3} /> : members.map(...)}\n * </SettingsContainer>\n * ```\n */\nexport function SettingsSkeleton({ label, rows = 2, variant = 'row', className }: SettingsSkeletonProps) {\n const Placeholder = variant === 'item' ? ItemPlaceholder : RowPlaceholder;\n\n return (\n // One child of the card, so it takes the card's row padding; inside, rows repeat that rhythm with hairlines.\n <div\n role=\"status\"\n aria-label={label}\n data-slot=\"settings-skeleton\"\n className={cn('grid divide-y divide-border *:py-3.25 *:first:pt-0 *:last:pb-0', className)}\n >\n {Array.from({ length: rows }, (_, index) => (\n <Placeholder key={index} />\n ))}\n </div>\n );\n}\n\nfunction ItemPlaceholder() {\n return (\n <SettingsItem\n aria-hidden\n media={<Skeleton className={cn('size-avatar-md shrink-0 rounded-lg', bar)} />}\n title={<SkeletonText line=\"text-label\" className={cn('w-32', bar)} />}\n description={<SkeletonText line=\"text-caption\" className={cn('w-48 max-w-full', bar)} />}\n />\n );\n}\n\nfunction RowPlaceholder() {\n return (\n <SettingsRow\n aria-hidden\n label={<SkeletonText line=\"text-label\" className={cn('w-28', bar)} />}\n description={<SkeletonText line=\"text-caption\" className={cn('w-48 max-w-full', bar)} />}\n >\n <Skeleton className={cn('h-control-sm w-28 max-w-full rounded-full', bar)} />\n </SettingsRow>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAUA,IAAM,oBAAoBA,cAAAA,GAExB,mFACA,sFACAC,kCAAAA,eACF;;AAKA,SAAgB,kBAAkB,EAAE,WAAW,GAAG,SAAiC;CACjF,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,aAAU;EAAqB,WAAWD,cAAAA,GAAG,mBAAmB,SAAS;EAAG,GAAI;CAAQ,CAAA;AACtG;;ACbA,IAAM,gBACJ;AAEF,IAAM,0BAAA,GAAyBE,MAAAA,cAAAA,CAAkC,KAAA,CAAS;;AAG1E,SAAgB,cAAc,EAAE,WAAW,GAAG,SAAoC;CAChF,MAAM,WAAA,GAAUC,MAAAA,MAAAA,CAAM;CAEtB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,uBAAuB,UAAxB;EAAiC,OAAO;EACtC,UAAA,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EACE,eAAA;EACA,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,UAAD,EAAU,WAAWD,cAAAA,GAAG,sCAAsC,GAAG,EAAI,CAAA;EAC5E,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACE,sBAAAA,cAAD;GAAc,MAAK;GAAa,WAAWF,cAAAA,GAAG,QAAQ,GAAG;EAAI,CAAA;EACpE,aAAa,iBAAA,GAAA,kBAAA,IAAA,CAACE,sBAAAA,cAAD;GAAc,MAAK;GAAe,WAAWF,cAAAA,GAAG,mBAAmB,GAAG;EAAI,CAAA;CACxF,CAAA;AAEL;AAEA,SAAS,iBAAiB;CACxB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACG,qBAAAA,aAAD;EACE,eAAA;EACA,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACD,sBAAAA,cAAD;GAAc,MAAK;GAAa,WAAWF,cAAAA,GAAG,QAAQ,GAAG;EAAI,CAAA;EACpE,aAAa,iBAAA,GAAA,kBAAA,IAAA,CAACE,sBAAAA,cAAD;GAAc,MAAK;GAAe,WAAWF,cAAAA,GAAG,mBAAmB,GAAG;EAAI,CAAA;EAEvF,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,UAAD,EAAU,WAAWD,cAAAA,GAAG,6CAA6C,GAAG,EAAI,CAAA;CACjE,CAAA;AAEjB"}
|
|
@@ -9,6 +9,8 @@ var rowClassName = "min-w-0 gap-3";
|
|
|
9
9
|
/** Side by side: label left, control pushed right. A control below its label fills the row instead. */
|
|
10
10
|
var sideRowClassName = "sm:justify-between sm:gap-6";
|
|
11
11
|
var headingClassName = "flex min-w-0 flex-col gap-px";
|
|
12
|
+
/** Beside its control, the label column is as tall as a label with a one-line description, so rows with and without one match. */
|
|
13
|
+
var sideHeadingClassName = "sm:min-h-[calc(var(--text-label)*1.5+1px+var(--text-caption)*1.5)] sm:justify-center";
|
|
12
14
|
/**
|
|
13
15
|
* The control column on the right. Inputs fill it (at least 13.75rem); selects and other field triggers hug
|
|
14
16
|
* their value (`--field-width: auto`, see `fieldTriggerWidthStyle`) up to that same width.
|
|
@@ -28,7 +30,19 @@ function SettingsRowControl({ viewOnly = false, children }) {
|
|
|
28
30
|
children
|
|
29
31
|
] });
|
|
30
32
|
}
|
|
31
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* One setting the person changes: a label, an optional one-line description, and the control that changes it. The
|
|
35
|
+
* row is a form field, so its label names the control. Goes in a `SettingsContainer`.
|
|
36
|
+
*
|
|
37
|
+
* For one thing in a list (an account, a member, an API key, a package version), use `SettingsItem` instead: a row
|
|
38
|
+
* with no control, or one per record in a `.map`, is a list item. A setting someone may not change stays a
|
|
39
|
+
* `SettingsRow` with `viewOnly`.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* <SettingsRow label="Theme" description="Color scheme for the interface.">
|
|
43
|
+
* <ThemeToggle />
|
|
44
|
+
* </SettingsRow>
|
|
45
|
+
*/
|
|
32
46
|
function SettingsRow({ label, description, htmlFor, children, className, tone = "default", viewOnly = false, required = false, errorMsg, disabled, controlPlacement = "side", ...props }) {
|
|
33
47
|
const controlBelow = controlPlacement === "below";
|
|
34
48
|
return /* @__PURE__ */ jsxs(Field, {
|
|
@@ -39,7 +53,7 @@ function SettingsRow({ label, description, htmlFor, children, className, tone =
|
|
|
39
53
|
className: cn(rowClassName, !controlBelow && sideRowClassName, className),
|
|
40
54
|
...props,
|
|
41
55
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
42
|
-
className: headingClassName,
|
|
56
|
+
className: cn(headingClassName, !controlBelow && sideHeadingClassName),
|
|
43
57
|
children: [
|
|
44
58
|
/* @__PURE__ */ jsx(FieldLabel, {
|
|
45
59
|
...htmlFor ? { htmlFor } : {},
|
|
@@ -67,7 +81,15 @@ function SettingsRow({ label, description, htmlFor, children, className, tone =
|
|
|
67
81
|
})]
|
|
68
82
|
});
|
|
69
83
|
}
|
|
70
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* A `SettingsRow` for one setting made of several controls (radios, several switches), labelled by a legend. Same
|
|
86
|
+
* rule as `SettingsRow`: a setting the person changes, never a list entry.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* <SettingsFieldsetRow label="Notify me about" controlPlacement="below">
|
|
90
|
+
* <Checkbox … />
|
|
91
|
+
* </SettingsFieldsetRow>
|
|
92
|
+
*/
|
|
71
93
|
function SettingsFieldsetRow({ label, description, children, className, controlPlacement = "side", ...props }) {
|
|
72
94
|
const descriptionId = useId();
|
|
73
95
|
const controlBelow = controlPlacement === "below";
|
|
@@ -77,7 +99,7 @@ function SettingsFieldsetRow({ label, description, children, className, controlP
|
|
|
77
99
|
className: cn("flex flex-col", rowClassName, !controlBelow && ["sm:flex-row sm:items-center", sideRowClassName], className),
|
|
78
100
|
...props,
|
|
79
101
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
80
|
-
className: headingClassName,
|
|
102
|
+
className: cn(headingClassName, !controlBelow && sideHeadingClassName),
|
|
81
103
|
children: [/* @__PURE__ */ jsx(FieldsetLegend, { children: label }), description != null && /* @__PURE__ */ jsx("div", {
|
|
82
104
|
id: descriptionId,
|
|
83
105
|
className: "flex flex-col gap-0.5 text-caption text-pretty text-muted-foreground",
|
|
@@ -92,4 +114,4 @@ function SettingsFieldsetRow({ label, description, children, className, controlP
|
|
|
92
114
|
}
|
|
93
115
|
export { SettingsRow as n, SettingsRowControl as r, SettingsFieldsetRow as t };
|
|
94
116
|
|
|
95
|
-
//# sourceMappingURL=settings-row-
|
|
117
|
+
//# sourceMappingURL=settings-row-BnlFZSQL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-row-BnlFZSQL.js","names":["_Fragment"],"sources":["../src/ds/new/settings/settings-row.tsx"],"sourcesContent":["import { useId } from 'react';\nimport type { ReactNode } from 'react';\nimport { Field, FieldDescription, FieldError, FieldLabel, Fieldset, FieldsetLegend } from '@/ds/components/Field';\nimport type { FieldProps, FieldsetProps } from '@/ds/components/Field';\nimport { IconLock } from '@/ds/icons/central/IconLock';\nimport { cn } from '@/lib/utils';\n\nexport type SettingsRowProps = Omit<FieldProps, 'children' | 'invalid' | 'orientation'> & {\n label: ReactNode;\n description?: ReactNode;\n /** @deprecated The row's `Field` names the control it holds; drop `htmlFor` and the control's `id`. */\n htmlFor?: string;\n children?: ReactNode;\n tone?: 'default' | 'destructive';\n viewOnly?: boolean;\n required?: boolean;\n errorMsg?: ReactNode;\n /**\n * `side` (default): the control sits on the right. Text fields take one shared width (13.75rem), selects hug\n * their value up to that width, and switches and buttons keep their own size; all end at the right edge.\n * `below`: the control goes under the label at full width, for forms with several controls.\n */\n controlPlacement?: 'side' | 'below';\n};\n\n/** Label left, control right; stacked below `sm`. The card around the row gives it its spacing. */\nconst rowClassName = 'min-w-0 gap-3';\n/** Side by side: label left, control pushed right. A control below its label fills the row instead. */\nconst sideRowClassName = 'sm:justify-between sm:gap-6';\nconst headingClassName = 'flex min-w-0 flex-col gap-px';\n/** Beside its control, the label column is as tall as a label with a one-line description, so rows with and without one match. */\nconst sideHeadingClassName = 'sm:min-h-[calc(var(--text-label)*1.5+1px+var(--text-caption)*1.5)] sm:justify-center';\n/**\n * The control column on the right. Inputs fill it (at least 13.75rem); selects and other field triggers hug\n * their value (`--field-width: auto`, see `fieldTriggerWidthStyle`) up to that same width.\n */\nconst sideControlClassName =\n 'flex min-w-0 items-center justify-end gap-2 [--field-max-width:13.75rem] [--field-width:auto] sm:min-w-55 sm:shrink-0';\n\nexport function SettingsRowControl({ viewOnly = false, children }: { viewOnly?: boolean; children: ReactNode }) {\n if (!viewOnly) return children;\n return (\n <>\n <IconLock className=\"size-icon-md shrink-0\" aria-hidden />\n <span className=\"sr-only\">View only: </span>\n {children}\n </>\n );\n}\n\n/**\n * One setting the person changes: a label, an optional one-line description, and the control that changes it. The\n * row is a form field, so its label names the control. Goes in a `SettingsContainer`.\n *\n * For one thing in a list (an account, a member, an API key, a package version), use `SettingsItem` instead: a row\n * with no control, or one per record in a `.map`, is a list item. A setting someone may not change stays a\n * `SettingsRow` with `viewOnly`.\n *\n * @example\n * <SettingsRow label=\"Theme\" description=\"Color scheme for the interface.\">\n * <ThemeToggle />\n * </SettingsRow>\n */\nexport function SettingsRow({\n label,\n description,\n htmlFor,\n children,\n className,\n tone = 'default',\n viewOnly = false,\n required = false,\n errorMsg,\n disabled,\n controlPlacement = 'side',\n ...props\n}: SettingsRowProps) {\n const controlBelow = controlPlacement === 'below';\n\n return (\n <Field\n orientation={controlBelow ? 'vertical' : 'responsive'}\n invalid={Boolean(errorMsg)}\n disabled={disabled || viewOnly}\n data-slot=\"settings-row\"\n className={cn(rowClassName, !controlBelow && sideRowClassName, className)}\n {...props}\n >\n <div className={cn(headingClassName, !controlBelow && sideHeadingClassName)}>\n <FieldLabel\n {...(htmlFor ? { htmlFor } : {})}\n required={required}\n className={cn(tone === 'destructive' && 'text-destructive-foreground')}\n >\n {label}\n </FieldLabel>\n {description != null && (\n <FieldDescription render={<div />} className=\"mt-0 flex flex-col gap-0.5 text-pretty\">\n {description}\n </FieldDescription>\n )}\n <FieldError className=\"mt-0\">{errorMsg}</FieldError>\n </div>\n {children != null && (\n <div\n data-slot=\"settings-row-control\"\n className={cn(\n 'min-w-0',\n !controlBelow && sideControlClassName,\n viewOnly && 'flex items-center gap-2 text-body-sm text-muted-foreground',\n )}\n >\n <SettingsRowControl viewOnly={viewOnly}>{children}</SettingsRowControl>\n </div>\n )}\n </Field>\n );\n}\n\nexport type SettingsFieldsetRowProps = Omit<FieldsetProps, 'children'> & {\n label: ReactNode;\n description?: ReactNode;\n children?: ReactNode;\n /** Same as `SettingsRow`'s: `below` puts the controls under the label at full width. */\n controlPlacement?: 'side' | 'below';\n};\n\n/**\n * A `SettingsRow` for one setting made of several controls (radios, several switches), labelled by a legend. Same\n * rule as `SettingsRow`: a setting the person changes, never a list entry.\n *\n * @example\n * <SettingsFieldsetRow label=\"Notify me about\" controlPlacement=\"below\">\n * <Checkbox … />\n * </SettingsFieldsetRow>\n */\nexport function SettingsFieldsetRow({\n label,\n description,\n children,\n className,\n controlPlacement = 'side',\n ...props\n}: SettingsFieldsetRowProps) {\n const descriptionId = useId();\n const controlBelow = controlPlacement === 'below';\n\n return (\n <Fieldset\n data-slot=\"settings-row\"\n aria-describedby={description == null ? undefined : descriptionId}\n className={cn(\n 'flex flex-col',\n rowClassName,\n !controlBelow && ['sm:flex-row sm:items-center', sideRowClassName],\n className,\n )}\n {...props}\n >\n <div className={cn(headingClassName, !controlBelow && sideHeadingClassName)}>\n <FieldsetLegend>{label}</FieldsetLegend>\n {description != null && (\n <div id={descriptionId} className=\"flex flex-col gap-0.5 text-caption text-pretty text-muted-foreground\">\n {description}\n </div>\n )}\n </div>\n {children != null && (\n <div data-slot=\"settings-row-control\" className={cn('min-w-0', !controlBelow && sideControlClassName)}>\n {children}\n </div>\n )}\n </Fieldset>\n );\n}\n"],"mappings":";;;;;;;AA0BA,IAAM,eAAe;;AAErB,IAAM,mBAAmB;AACzB,IAAM,mBAAmB;;AAEzB,IAAM,uBAAuB;;;;;AAK7B,IAAM,uBACJ;AAEF,SAAgB,mBAAmB,EAAE,WAAW,OAAO,YAAyD;CAC9G,IAAI,CAAC,UAAU,OAAO;CACtB,OACE,qBAAAA,YAAA,EAAA,UAAA;EACE,oBAAC,UAAD;GAAU,WAAU;GAAwB,eAAA;EAAa,CAAA;EACzD,oBAAC,QAAD;GAAM,WAAU;GAAU,UAAA;EAAiB,CAAA;EAC1C;CACD,EAAA,CAAA;AAEN;;;;;;;;;;;;;;AAeA,SAAgB,YAAY,EAC1B,OACA,aACA,SACA,UACA,WACA,OAAO,WACP,WAAW,OACX,WAAW,OACX,UACA,UACA,mBAAmB,QACnB,GAAG,SACgB;CACnB,MAAM,eAAe,qBAAqB;CAE1C,OACE,qBAAC,OAAD;EACE,aAAa,eAAe,aAAa;EACzC,SAAS,QAAQ,QAAQ;EACzB,UAAU,YAAY;EACtB,aAAU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AW,GAAG,WAAW,CAAC,gBAAgB,oBAAoB;GACjG;EACE,CAAA,CAEC;;AAEd"}
|
|
@@ -9,6 +9,8 @@ var rowClassName = "min-w-0 gap-3";
|
|
|
9
9
|
/** Side by side: label left, control pushed right. A control below its label fills the row instead. */
|
|
10
10
|
var sideRowClassName = "sm:justify-between sm:gap-6";
|
|
11
11
|
var headingClassName = "flex min-w-0 flex-col gap-px";
|
|
12
|
+
/** Beside its control, the label column is as tall as a label with a one-line description, so rows with and without one match. */
|
|
13
|
+
var sideHeadingClassName = "sm:min-h-[calc(var(--text-label)*1.5+1px+var(--text-caption)*1.5)] sm:justify-center";
|
|
12
14
|
/**
|
|
13
15
|
* The control column on the right. Inputs fill it (at least 13.75rem); selects and other field triggers hug
|
|
14
16
|
* their value (`--field-width: auto`, see `fieldTriggerWidthStyle`) up to that same width.
|
|
@@ -28,7 +30,19 @@ function SettingsRowControl({ viewOnly = false, children }) {
|
|
|
28
30
|
children
|
|
29
31
|
] });
|
|
30
32
|
}
|
|
31
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* One setting the person changes: a label, an optional one-line description, and the control that changes it. The
|
|
35
|
+
* row is a form field, so its label names the control. Goes in a `SettingsContainer`.
|
|
36
|
+
*
|
|
37
|
+
* For one thing in a list (an account, a member, an API key, a package version), use `SettingsItem` instead: a row
|
|
38
|
+
* with no control, or one per record in a `.map`, is a list item. A setting someone may not change stays a
|
|
39
|
+
* `SettingsRow` with `viewOnly`.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* <SettingsRow label="Theme" description="Color scheme for the interface.">
|
|
43
|
+
* <ThemeToggle />
|
|
44
|
+
* </SettingsRow>
|
|
45
|
+
*/
|
|
32
46
|
function SettingsRow({ label, description, htmlFor, children, className, tone = "default", viewOnly = false, required = false, errorMsg, disabled, controlPlacement = "side", ...props }) {
|
|
33
47
|
const controlBelow = controlPlacement === "below";
|
|
34
48
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_Field.Field, {
|
|
@@ -39,7 +53,7 @@ function SettingsRow({ label, description, htmlFor, children, className, tone =
|
|
|
39
53
|
className: require_utils.cn(rowClassName, !controlBelow && sideRowClassName, className),
|
|
40
54
|
...props,
|
|
41
55
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
42
|
-
className: headingClassName,
|
|
56
|
+
className: require_utils.cn(headingClassName, !controlBelow && sideHeadingClassName),
|
|
43
57
|
children: [
|
|
44
58
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Field.FieldLabel, {
|
|
45
59
|
...htmlFor ? { htmlFor } : {},
|
|
@@ -67,7 +81,15 @@ function SettingsRow({ label, description, htmlFor, children, className, tone =
|
|
|
67
81
|
})]
|
|
68
82
|
});
|
|
69
83
|
}
|
|
70
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* A `SettingsRow` for one setting made of several controls (radios, several switches), labelled by a legend. Same
|
|
86
|
+
* rule as `SettingsRow`: a setting the person changes, never a list entry.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* <SettingsFieldsetRow label="Notify me about" controlPlacement="below">
|
|
90
|
+
* <Checkbox … />
|
|
91
|
+
* </SettingsFieldsetRow>
|
|
92
|
+
*/
|
|
71
93
|
function SettingsFieldsetRow({ label, description, children, className, controlPlacement = "side", ...props }) {
|
|
72
94
|
const descriptionId = (0, react.useId)();
|
|
73
95
|
const controlBelow = controlPlacement === "below";
|
|
@@ -77,7 +99,7 @@ function SettingsFieldsetRow({ label, description, children, className, controlP
|
|
|
77
99
|
className: require_utils.cn("flex flex-col", rowClassName, !controlBelow && ["sm:flex-row sm:items-center", sideRowClassName], className),
|
|
78
100
|
...props,
|
|
79
101
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
80
|
-
className: headingClassName,
|
|
102
|
+
className: require_utils.cn(headingClassName, !controlBelow && sideHeadingClassName),
|
|
81
103
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Field.FieldsetLegend, { children: label }), description != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
82
104
|
id: descriptionId,
|
|
83
105
|
className: "flex flex-col gap-0.5 text-caption text-pretty text-muted-foreground",
|
|
@@ -109,4 +131,4 @@ Object.defineProperty(exports, "SettingsRowControl", {
|
|
|
109
131
|
}
|
|
110
132
|
});
|
|
111
133
|
|
|
112
|
-
//# sourceMappingURL=settings-row-
|
|
134
|
+
//# sourceMappingURL=settings-row-Da1HHyBg.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-row-Da1HHyBg.cjs","names":["_Fragment","IconLock","Field","cn","FieldLabel","FieldDescription","FieldError","useId","Fieldset","FieldsetLegend"],"sources":["../src/ds/new/settings/settings-row.tsx"],"sourcesContent":["import { useId } from 'react';\nimport type { ReactNode } from 'react';\nimport { Field, FieldDescription, FieldError, FieldLabel, Fieldset, FieldsetLegend } from '@/ds/components/Field';\nimport type { FieldProps, FieldsetProps } from '@/ds/components/Field';\nimport { IconLock } from '@/ds/icons/central/IconLock';\nimport { cn } from '@/lib/utils';\n\nexport type SettingsRowProps = Omit<FieldProps, 'children' | 'invalid' | 'orientation'> & {\n label: ReactNode;\n description?: ReactNode;\n /** @deprecated The row's `Field` names the control it holds; drop `htmlFor` and the control's `id`. */\n htmlFor?: string;\n children?: ReactNode;\n tone?: 'default' | 'destructive';\n viewOnly?: boolean;\n required?: boolean;\n errorMsg?: ReactNode;\n /**\n * `side` (default): the control sits on the right. Text fields take one shared width (13.75rem), selects hug\n * their value up to that width, and switches and buttons keep their own size; all end at the right edge.\n * `below`: the control goes under the label at full width, for forms with several controls.\n */\n controlPlacement?: 'side' | 'below';\n};\n\n/** Label left, control right; stacked below `sm`. The card around the row gives it its spacing. */\nconst rowClassName = 'min-w-0 gap-3';\n/** Side by side: label left, control pushed right. A control below its label fills the row instead. */\nconst sideRowClassName = 'sm:justify-between sm:gap-6';\nconst headingClassName = 'flex min-w-0 flex-col gap-px';\n/** Beside its control, the label column is as tall as a label with a one-line description, so rows with and without one match. */\nconst sideHeadingClassName = 'sm:min-h-[calc(var(--text-label)*1.5+1px+var(--text-caption)*1.5)] sm:justify-center';\n/**\n * The control column on the right. Inputs fill it (at least 13.75rem); selects and other field triggers hug\n * their value (`--field-width: auto`, see `fieldTriggerWidthStyle`) up to that same width.\n */\nconst sideControlClassName =\n 'flex min-w-0 items-center justify-end gap-2 [--field-max-width:13.75rem] [--field-width:auto] sm:min-w-55 sm:shrink-0';\n\nexport function SettingsRowControl({ viewOnly = false, children }: { viewOnly?: boolean; children: ReactNode }) {\n if (!viewOnly) return children;\n return (\n <>\n <IconLock className=\"size-icon-md shrink-0\" aria-hidden />\n <span className=\"sr-only\">View only: </span>\n {children}\n </>\n );\n}\n\n/**\n * One setting the person changes: a label, an optional one-line description, and the control that changes it. The\n * row is a form field, so its label names the control. Goes in a `SettingsContainer`.\n *\n * For one thing in a list (an account, a member, an API key, a package version), use `SettingsItem` instead: a row\n * with no control, or one per record in a `.map`, is a list item. A setting someone may not change stays a\n * `SettingsRow` with `viewOnly`.\n *\n * @example\n * <SettingsRow label=\"Theme\" description=\"Color scheme for the interface.\">\n * <ThemeToggle />\n * </SettingsRow>\n */\nexport function SettingsRow({\n label,\n description,\n htmlFor,\n children,\n className,\n tone = 'default',\n viewOnly = false,\n required = false,\n errorMsg,\n disabled,\n controlPlacement = 'side',\n ...props\n}: SettingsRowProps) {\n const controlBelow = controlPlacement === 'below';\n\n return (\n <Field\n orientation={controlBelow ? 'vertical' : 'responsive'}\n invalid={Boolean(errorMsg)}\n disabled={disabled || viewOnly}\n data-slot=\"settings-row\"\n className={cn(rowClassName, !controlBelow && sideRowClassName, className)}\n {...props}\n >\n <div className={cn(headingClassName, !controlBelow && sideHeadingClassName)}>\n <FieldLabel\n {...(htmlFor ? { htmlFor } : {})}\n required={required}\n className={cn(tone === 'destructive' && 'text-destructive-foreground')}\n >\n {label}\n </FieldLabel>\n {description != null && (\n <FieldDescription render={<div />} className=\"mt-0 flex flex-col gap-0.5 text-pretty\">\n {description}\n </FieldDescription>\n )}\n <FieldError className=\"mt-0\">{errorMsg}</FieldError>\n </div>\n {children != null && (\n <div\n data-slot=\"settings-row-control\"\n className={cn(\n 'min-w-0',\n !controlBelow && sideControlClassName,\n viewOnly && 'flex items-center gap-2 text-body-sm text-muted-foreground',\n )}\n >\n <SettingsRowControl viewOnly={viewOnly}>{children}</SettingsRowControl>\n </div>\n )}\n </Field>\n );\n}\n\nexport type SettingsFieldsetRowProps = Omit<FieldsetProps, 'children'> & {\n label: ReactNode;\n description?: ReactNode;\n children?: ReactNode;\n /** Same as `SettingsRow`'s: `below` puts the controls under the label at full width. */\n controlPlacement?: 'side' | 'below';\n};\n\n/**\n * A `SettingsRow` for one setting made of several controls (radios, several switches), labelled by a legend. Same\n * rule as `SettingsRow`: a setting the person changes, never a list entry.\n *\n * @example\n * <SettingsFieldsetRow label=\"Notify me about\" controlPlacement=\"below\">\n * <Checkbox … />\n * </SettingsFieldsetRow>\n */\nexport function SettingsFieldsetRow({\n label,\n description,\n children,\n className,\n controlPlacement = 'side',\n ...props\n}: SettingsFieldsetRowProps) {\n const descriptionId = useId();\n const controlBelow = controlPlacement === 'below';\n\n return (\n <Fieldset\n data-slot=\"settings-row\"\n aria-describedby={description == null ? undefined : descriptionId}\n className={cn(\n 'flex flex-col',\n rowClassName,\n !controlBelow && ['sm:flex-row sm:items-center', sideRowClassName],\n className,\n )}\n {...props}\n >\n <div className={cn(headingClassName, !controlBelow && sideHeadingClassName)}>\n <FieldsetLegend>{label}</FieldsetLegend>\n {description != null && (\n <div id={descriptionId} className=\"flex flex-col gap-0.5 text-caption text-pretty text-muted-foreground\">\n {description}\n </div>\n )}\n </div>\n {children != null && (\n <div data-slot=\"settings-row-control\" className={cn('min-w-0', !controlBelow && sideControlClassName)}>\n {children}\n </div>\n )}\n </Fieldset>\n );\n}\n"],"mappings":";;;;;;;AA0BA,IA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EC;;AAEd"}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { KnowledgePageActivityPayload, KnowledgeNotePayload, KnowledgePagePayload, KnowledgePinPayload } from '../pageTypes';
|
|
3
|
+
type LinkedPage = {
|
|
4
|
+
page: KnowledgePagePayload;
|
|
5
|
+
count: number;
|
|
6
|
+
};
|
|
7
|
+
export type PageLinkLists = {
|
|
8
|
+
in: LinkedPage[];
|
|
9
|
+
out: LinkedPage[];
|
|
10
|
+
};
|
|
3
11
|
export declare function KnowledgeDetailSection({ label, count, children, }: {
|
|
4
12
|
label: string;
|
|
5
13
|
count?: number;
|
|
@@ -26,9 +34,10 @@ export declare function KnowledgeNoteItem({ note, pagesById, onPageClick, highli
|
|
|
26
34
|
*
|
|
27
35
|
* Paged lists take a `…More` slot the host fills with the next page's loader.
|
|
28
36
|
*/
|
|
29
|
-
export declare function KnowledgePageDetail({ page, notes, pin, pagesById, onPageClick, highlightMentionOf, ancestors, mentionedBy, notesMore, childPages, activity, onOpenPage, compact, }: {
|
|
37
|
+
export declare function KnowledgePageDetail({ page, notes, pin, pagesById, onPageClick, highlightMentionOf, ancestors, mentionedBy, notesMore, childPages, activity, links, onOpenPage, compact, }: {
|
|
30
38
|
compact?: boolean;
|
|
31
39
|
onOpenPage?: () => void;
|
|
40
|
+
links?: PageLinkLists;
|
|
32
41
|
page: KnowledgePagePayload;
|
|
33
42
|
notes: KnowledgeNotePayload[];
|
|
34
43
|
pin?: KnowledgePinPayload;
|
|
@@ -47,3 +56,4 @@ export declare function KnowledgePageDetail({ page, notes, pin, pagesById, onPag
|
|
|
47
56
|
childPages?: ReactNode;
|
|
48
57
|
activity?: KnowledgePageActivityPayload[];
|
|
49
58
|
}): import("react").JSX.Element;
|
|
59
|
+
export {};
|