@mastra/playground-ui 70.1.0-alpha.1 → 70.1.0-alpha.3

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.
Files changed (78) hide show
  1. package/dist/{MetricsLineChart-CFKyRZ0t.cjs → MetricsLineChart-DupSN9YT.cjs} +5 -2
  2. package/dist/MetricsLineChart-DupSN9YT.cjs.map +1 -0
  3. package/dist/{MetricsLineChart-CwQ7c3nK.js → MetricsLineChart-vgZTYICl.js} +5 -2
  4. package/dist/MetricsLineChart-vgZTYICl.js.map +1 -0
  5. package/dist/{MetricsStackedBarChart-e4_hVNX6.cjs → MetricsStackedBarChart-CYX6HW01.cjs} +2 -2
  6. package/dist/{MetricsStackedBarChart-e4_hVNX6.cjs.map → MetricsStackedBarChart-CYX6HW01.cjs.map} +1 -1
  7. package/dist/{MetricsStackedBarChart-BYnCiXfI.js → MetricsStackedBarChart-CqsIfBK7.js} +2 -2
  8. package/dist/{MetricsStackedBarChart-BYnCiXfI.js.map → MetricsStackedBarChart-CqsIfBK7.js.map} +1 -1
  9. package/dist/{Section-DV2aLnkc.js → Section-BdaqU_k5.js} +2 -2
  10. package/dist/{Section-DV2aLnkc.js.map → Section-BdaqU_k5.js.map} +1 -1
  11. package/dist/{Section-BdO9TFjY.cjs → Section-Co1kxY3S.cjs} +2 -2
  12. package/dist/{Section-BdO9TFjY.cjs.map → Section-Co1kxY3S.cjs.map} +1 -1
  13. package/dist/components/FormLayout.cjs.js +11 -7
  14. package/dist/components/FormLayout.cjs.js.map +1 -1
  15. package/dist/components/FormLayout.es.js +11 -7
  16. package/dist/components/FormLayout.es.js.map +1 -1
  17. package/dist/components/HoverCard.cjs.js +3 -0
  18. package/dist/components/HoverCard.cjs.js.map +1 -1
  19. package/dist/components/HoverCard.es.js +3 -1
  20. package/dist/components/HoverCard.es.js.map +1 -1
  21. package/dist/components/MetricsLineChart.cjs.js +1 -1
  22. package/dist/components/MetricsLineChart.es.js +1 -1
  23. package/dist/components/MetricsStackedBarChart.cjs.js +1 -1
  24. package/dist/components/MetricsStackedBarChart.es.js +1 -1
  25. package/dist/components/Section.cjs.js +1 -1
  26. package/dist/components/Section.es.js +1 -1
  27. package/dist/components/SideDialog.cjs.js +1 -1
  28. package/dist/components/SideDialog.es.js +1 -1
  29. package/dist/domains/chat/tools/badges/resolve-child-messages.cjs.js.map +1 -1
  30. package/dist/domains/chat/tools/badges/resolve-child-messages.es.js.map +1 -1
  31. package/dist/domains/dashboards/kinds/scores/scores-widget.cjs.js +1 -1
  32. package/dist/domains/dashboards/kinds/scores/scores-widget.es.js +1 -1
  33. package/dist/domains/dashboards/kinds/timeseries/timeseries-widget.cjs.js +2 -2
  34. package/dist/domains/dashboards/kinds/timeseries/timeseries-widget.es.js +2 -2
  35. package/dist/domains/datasets/components/add-dataset-item-dialog/add-dataset-item-dialog.cjs.js +1 -1
  36. package/dist/domains/datasets/components/add-dataset-item-dialog/add-dataset-item-dialog.es.js +1 -1
  37. package/dist/domains/datasets/components/add-dataset-item-dialog/collapsible-settings-row.cjs.js +1 -1
  38. package/dist/domains/datasets/components/add-dataset-item-dialog/collapsible-settings-row.es.js +1 -1
  39. package/dist/domains/metrics/components/agent-runs-card.cjs.js +2 -2
  40. package/dist/domains/metrics/components/agent-runs-card.es.js +2 -2
  41. package/dist/domains/metrics/components/distinct-ids/distinct-ids-chart.cjs.js +1 -1
  42. package/dist/domains/metrics/components/distinct-ids/distinct-ids-chart.es.js +1 -1
  43. package/dist/domains/metrics/components/failure-rate-card.cjs.js +1 -1
  44. package/dist/domains/metrics/components/failure-rate-card.es.js +1 -1
  45. package/dist/domains/metrics/components/latency-card.cjs.js +1 -1
  46. package/dist/domains/metrics/components/latency-card.es.js +1 -1
  47. package/dist/domains/metrics/components/scores-card.cjs.js +1 -1
  48. package/dist/domains/metrics/components/scores-card.es.js +1 -1
  49. package/dist/domains/metrics/components/token-usage-card.cjs.js +2 -2
  50. package/dist/domains/metrics/components/token-usage-card.es.js +2 -2
  51. package/dist/domains/observability/components/observability-histogram.cjs.js +1 -1
  52. package/dist/domains/observability/components/observability-histogram.es.js +1 -1
  53. package/dist/new/settings.cjs.js +3 -4
  54. package/dist/new/settings.es.js +2 -3
  55. package/dist/{settings-B7RMGKgf.js → settings-9ei5ML-D.js} +39 -3
  56. package/dist/settings-9ei5ML-D.js.map +1 -0
  57. package/dist/{settings-row-BnlFZSQL.js → settings-row-BeVVZ7Bs.js} +15 -8
  58. package/dist/settings-row-BeVVZ7Bs.js.map +1 -0
  59. package/dist/{settings-row-Da1HHyBg.cjs → settings-row-SN-YS0LA.cjs} +15 -8
  60. package/dist/settings-row-SN-YS0LA.cjs.map +1 -0
  61. package/dist/{settings-CYKWxfrJ.cjs → settings-u4KjAKPi.cjs} +44 -2
  62. package/dist/settings-u4KjAKPi.cjs.map +1 -0
  63. package/dist/src/domains/workflows/context/use-persisted-workflow-run.d.ts +7 -0
  64. package/dist/src/ds/components/FormLayout/form-layout.d.ts +2 -2
  65. package/dist/src/ds/components/HoverCard/create-hover-card-handle.d.ts +2 -0
  66. package/dist/src/ds/components/HoverCard/index.d.ts +1 -0
  67. package/dist/style.css +22 -6
  68. package/package.json +6 -6
  69. package/dist/MetricsLineChart-CFKyRZ0t.cjs.map +0 -1
  70. package/dist/MetricsLineChart-CwQ7c3nK.js.map +0 -1
  71. package/dist/settings-B7RMGKgf.js.map +0 -1
  72. package/dist/settings-CYKWxfrJ.cjs.map +0 -1
  73. package/dist/settings-layout-BxtShpY6.cjs +0 -46
  74. package/dist/settings-layout-BxtShpY6.cjs.map +0 -1
  75. package/dist/settings-layout-UPnWI3FZ.js +0 -41
  76. package/dist/settings-layout-UPnWI3FZ.js.map +0 -1
  77. package/dist/settings-row-BnlFZSQL.js.map +0 -1
  78. package/dist/settings-row-Da1HHyBg.cjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"MetricsLineChart-CFKyRZ0t.cjs","names":["cn","Txt","ChartTooltip","Txt","CHART_CURSOR_PROPS","cn","ChartSkeleton","useChartDefsId","useChartSize","compactNumber","useContext","ChartHideYAxis","ChartPlot","ComposedChart","CHART_MARGIN","CartesianGrid","CHART_GRID_PROPS","timeXAxis","valueYAxis","dataMax","isWholeData","ReferenceLine","Tooltip","CHART_TOOLTIP_PROPS","ChartTooltipPosition","Line","Area"],"sources":["../src/ds/components/MetricsLineChart/metrics-line-chart-legend.tsx","../src/ds/components/MetricsLineChart/metrics-line-chart-tooltip.tsx","../src/ds/components/MetricsLineChart/metrics-line-chart.tsx"],"sourcesContent":["import type { MetricsLineChartSeries } from './metrics-line-chart';\nimport { Txt } from '@/ds/components/Txt';\nimport { cn } from '@/lib/utils';\n\n/** A marker and a label per series. Totals belong in the card's header, not here. */\nexport function MetricsLineChartLegend({\n series,\n className,\n}: {\n series: Pick<MetricsLineChartSeries, 'dataKey' | 'label' | 'color' | 'dashed'>[];\n className?: string;\n}) {\n return (\n <div data-slot=\"chart-legend\" className={cn('flex flex-wrap items-center gap-x-4 gap-y-1', className)}>\n {series.map(s => (\n <div key={s.dataKey} className=\"inline-flex items-center gap-1.5\">\n {s.dashed ? (\n <span className=\"h-0 w-3 shrink-0 border-t-2 border-dashed\" style={{ borderColor: s.color }} />\n ) : (\n <div className=\"size-2 shrink-0 rounded-[2px]\" style={{ backgroundColor: s.color }} />\n )}\n <Txt as=\"span\" variant=\"body-sm\" tone=\"muted\" className=\"max-w-48 truncate\">\n {s.label}\n </Txt>\n </div>\n ))}\n </div>\n );\n}\n","import { ChartTooltip } from '@/ds/components/ChartTooltip';\nimport { Txt } from '@/ds/components/Txt';\n\nexport function MetricsLineChartTooltip({\n active,\n payload,\n label,\n suffix,\n formatValue = value => value.toLocaleString('en-US'),\n showTotal = false,\n labelKey,\n formatByKey,\n}: {\n active?: boolean;\n payload?: Array<{\n name: string;\n value: number;\n color: string;\n dataKey?: string | number;\n payload?: Record<string, unknown>;\n }>;\n label?: string;\n suffix?: string;\n formatValue?: (value: number) => string;\n /** Adds a \"Total\" row under a hairline: the sum of every row, e.g. a stacked column's height. */\n showTotal?: boolean;\n /** Read the heading from this field of the hovered row instead of the x-axis label. */\n labelKey?: string;\n /** Per-series formatters, by data key, for charts that mix units (counts and durations). */\n formatByKey?: Record<string, (value: number) => string>;\n}) {\n if (!active || !payload?.length) return null;\n // A missing reading (NaN, Infinity) shows as a dash and stays out of the total.\n const finite = (value: unknown): value is number => typeof value === 'number' && Number.isFinite(value);\n const total = payload.reduce((sum, entry) => sum + (finite(entry.value) ? entry.value : 0), 0);\n // A bucket with no readings at all totals to a dash, not 0.\n const hasReading = payload.some(entry => finite(entry.value));\n const heading = labelKey ? String(payload[0]?.payload?.[labelKey] ?? label ?? '') : label;\n const format = (entry: { dataKey?: string | number }) => formatByKey?.[String(entry.dataKey)] ?? formatValue;\n // A number through its formatter; a missing or non-finite one as a dash; text as it is.\n const reading = (entry: (typeof payload)[number]) => {\n if (finite(entry.value)) return format(entry)(entry.value);\n if (typeof entry.value === 'number' || entry.value == null) return '—';\n return entry.value;\n };\n return (\n // A floor like shadcn's chart tooltip, so short readouts don't size it to their own label.\n <ChartTooltip className=\"min-w-32\">\n <Txt variant=\"column\" tone=\"ink\" className=\"mb-1\">\n {heading}\n </Txt>\n <div className=\"grid grid-cols-[auto_1fr_auto] items-center gap-x-2 gap-y-1\">\n {payload.map(entry => (\n <div key={entry.name} className=\"contents\">\n <span className=\"size-2 rounded-[2px]\" style={{ backgroundColor: entry.color }} />\n <Txt as=\"span\" variant=\"caption\" tone=\"muted\" className=\"max-w-40 truncate\">\n {entry.name}\n </Txt>\n <span className=\"text-right font-mono text-foreground tabular-nums\">\n {reading(entry)}\n {finite(entry.value) && suffix}\n </span>\n </div>\n ))}\n {showTotal && (\n <div className=\"col-span-3 grid grid-cols-subgrid items-center border-t border-border pt-1\">\n <Txt as=\"span\" variant=\"caption\" tone=\"muted\" className=\"col-span-2\">\n Total\n </Txt>\n <span className=\"text-right font-mono text-foreground tabular-nums\">\n {hasReading ? formatValue(total) : '—'}\n {hasReading && suffix}\n </span>\n </div>\n )}\n </div>\n </ChartTooltip>\n );\n}\n","import { useContext } from 'react';\nimport { Area, CartesianGrid, ComposedChart, Line, ReferenceLine, Tooltip } from 'recharts';\nimport { MetricsLineChartLegend } from './metrics-line-chart-legend';\nimport { MetricsLineChartTooltip } from './metrics-line-chart-tooltip';\nimport { ChartSkeleton } from '@/ds/components/ChartSkeleton';\nimport { CHART_CURSOR_PROPS, CHART_GRID_PROPS, CHART_TOOLTIP_PROPS, useChartSize } from '@/ds/primitives/chart-axes';\nimport type { ChartXLabels } from '@/ds/primitives/chart-axes';\nimport { Y_AXIS_WIDTH, compactNumber, dataMax, isWholeData, timeXAxis, valueYAxis } from '@/ds/primitives/chart-frame';\nimport type { ChartHeight } from '@/ds/primitives/chart-frame';\nimport { CHART_MARGIN, ChartHideYAxis } from '@/ds/primitives/chart-layout';\nimport { ChartPlot } from '@/ds/primitives/chart-plot';\nimport { ChartTooltipPosition } from '@/ds/primitives/chart-tooltip-position';\nimport { useChartDefsId } from '@/ds/primitives/use-chart-defs-id';\nimport { cn } from '@/lib/utils';\n\nexport type MetricsLineChartSeries = {\n dataKey: string;\n label: string;\n color: string;\n /** A secondary reading (e.g. an average next to counts): dashed, no fill under it. */\n dashed?: boolean;\n /** The series to read first (e.g. P95 among percentiles): a slightly heavier line. */\n emphasis?: boolean;\n};\n\n/** Line weight; an emphasised series adds half a pixel. */\nconst LINE_WIDTH = 1.75;\n/** Opacity at the top of the fill under a line (it fades to nothing at the base). */\nconst AREA_OPACITY = 0.12;\n\n/**\n * How the series draw.\n * - `default`: 1.75px lines over a fill.\n * - `thin`: 1.5px lines (emphasis included) over a fainter fill (40% of the default), for small\n * cards in a grid.\n */\nexport type MetricsLineChartLineStyle = 'default' | 'thin';\n\nconst LINE_STYLES: Record<MetricsLineChartLineStyle, { width: number; emphasis: number; areaOpacity: number }> = {\n default: { width: LINE_WIDTH, emphasis: LINE_WIDTH + 0.5, areaOpacity: AREA_OPACITY },\n thin: { width: 1.5, emphasis: 1.5, areaOpacity: AREA_OPACITY * 0.4 },\n};\n\n/**\n * Fills fade out sideways over their first and last 24px, so they don't end in a hard vertical\n * edge where the line starts and stops. A mask sized to each fill's own box.\n */\nconst THIN_FILL_FADE = '[&_.recharts-area-area]:mask-x-from-[calc(100%-24px)]';\n/** A lone point draws no line at all, so it gets a dot; lines already bridge gaps (`connectNulls`). */\nconst SPARSE_POINTS = 1;\n\n// Jumps straight to the hovered point, with the dots and the tooltip.\nfunction HoverLine({ points }: { points?: { x: number; y: number }[] }) {\n const [top, bottom] = points ?? [];\n if (!top || !bottom) return null;\n return (\n <line x1={top.x} x2={top.x} y1={top.y} y2={bottom.y} {...CHART_CURSOR_PROPS} className=\"pointer-events-none\" />\n );\n}\n\nexport type MetricsLineChartPointClickHandler = (point: Record<string, unknown>, seriesKey: string) => void;\n\nexport type MetricsLineChartProps = {\n data: Record<string, unknown>[];\n series: MetricsLineChartSeries[];\n /** Pixels, or `fill` to grow with the parent (a flex column, e.g. a card's content). */\n height?: ChartHeight;\n yDomain?: [number, number];\n /** Click on a series' active dot. */\n onPointClick?: MetricsLineChartPointClickHandler;\n /** Click anywhere on a bucket (e.g. to open its traces); the plot shows a pointer cursor. */\n onBucketClick?: (row: Record<string, unknown>, index: number) => void;\n /** Row field printed under the x-axis. */\n xKey?: string;\n /** Row field with the bucket's start time (ms), which places labels on round clock times. */\n timestampKey?: string;\n /** `auto` fits as many labels as the width allows; `edges` prints only the first and last. */\n xLabels?: ChartXLabels;\n /** Row field for the tooltip heading (e.g. a longer date); defaults to the x-axis label. */\n tooltipLabelKey?: string;\n /** Render a visible dot on every point. A series with a single point gets one anyway. */\n showDots?: boolean;\n /**\n * Point markers. `auto`: on a series' lone point (or every point with `showDots`). `hover`:\n * none at rest, only the hovered point's.\n */\n dots?: 'auto' | 'hover';\n /** Line weight and fill. `thin` suits small cards in a grid. */\n lineStyle?: MetricsLineChartLineStyle;\n /** Set to `false` to render `MetricsLineChartLegend` elsewhere, e.g. next to tabs. */\n showLegend?: boolean;\n /** Formats tooltip values (e.g. `ms`, `%`), and y-axis ticks unless `axisFormatter` is set. */\n valueFormatter?: (value: number) => string;\n /** Formats y-axis ticks, when they need a shorter form than the tooltip. */\n axisFormatter?: (value: number) => string;\n /**\n * Set to `false` to drop the y-axis labels and let the plot span the card. The gridlines stay\n * for relative scale; exact values come from the tooltip and the card's summary.\n */\n showYAxis?: boolean;\n /** Show a ghost of the chart while data loads, in the chart's own footprint. */\n isLoading?: boolean;\n /**\n * Vertical lines at buckets, e.g. where a billing period starts. `x` must be one of the data's\n * `xKey` values: the axis is categorical, so any other value draws nothing.\n */\n markers?: { x: string; label?: string }[];\n className?: string;\n};\n\nexport function MetricsLineChart(props: MetricsLineChartProps) {\n const { data, series, height = 210, showLegend = true, isLoading = false, className } = props;\n const root = cn(height === 'fill' && 'flex min-h-0 flex-1 flex-col', className);\n // The legend stays while loading: it comes from the series, not the data.\n return (\n <div className={root}>\n {showLegend && <MetricsLineChartLegend series={series} className=\"mb-4\" />}\n {isLoading ? <ChartSkeleton kind=\"line\" height={height} /> : <LinePlot {...props} />}\n </div>\n );\n}\n\n/** The plot itself, once the data is in. */\nfunction LinePlot({\n data,\n series,\n height = 210,\n yDomain,\n onPointClick,\n onBucketClick,\n xKey = 'time',\n timestampKey = 'tsMs',\n xLabels = 'auto',\n tooltipLabelKey,\n showDots = false,\n dots = 'auto',\n lineStyle = 'default',\n valueFormatter,\n axisFormatter,\n showYAxis = true,\n markers = [],\n}: MetricsLineChartProps) {\n const id = useChartDefsId();\n const { size, onResize, ref } = useChartSize();\n\n const format = valueFormatter ?? compactNumber.format;\n const isSparse = (key: string) => data.filter(row => typeof row[key] === 'number').length <= SPARSE_POINTS;\n const hideYAxis = useContext(ChartHideYAxis);\n const withYAxis = showYAxis && !hideYAxis;\n const plotWidth = size.width - (withYAxis ? Y_AXIS_WIDTH : 0);\n const line = LINE_STYLES[lineStyle];\n const restDot = (s: MetricsLineChartSeries) =>\n dots === 'auto' && (showDots || isSparse(s.dataKey)) ? { r: 3, fill: s.color, strokeWidth: 0 } : false;\n const activeDot = (s: MetricsLineChartSeries) => ({\n r: 3.5,\n fill: s.color,\n stroke: 'var(--background)',\n strokeWidth: 2,\n ...(onPointClick && {\n style: { cursor: 'pointer' },\n onClick: (_: unknown, payload: unknown) => {\n // Recharts passes the dot's props; the hovered row is under `payload`.\n if (isRecord(payload) && isRecord(payload.payload)) onPointClick(payload.payload, s.dataKey);\n },\n }),\n });\n\n return (\n <ChartPlot\n height={height}\n plotRef={ref}\n onResize={onResize}\n clickable={!!onBucketClick}\n className={cn(lineStyle === 'thin' && THIN_FILL_FADE)}\n >\n <ComposedChart\n data={data}\n margin={CHART_MARGIN}\n onClick={state => {\n const i = state?.activeTooltipIndex;\n const row = i === undefined || i === null ? undefined : data[Number(i)];\n if (onBucketClick && row) onBucketClick(row, Number(i));\n }}\n >\n <defs>\n {series.map((s, i) => (\n <linearGradient key={s.dataKey} id={`${id}-area-${i}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={s.color} stopOpacity={line.areaOpacity} />\n <stop offset=\"95%\" stopColor={s.color} stopOpacity={0} />\n </linearGradient>\n ))}\n </defs>\n <CartesianGrid {...CHART_GRID_PROPS} />\n {timeXAxis({ data, xKey, timestampKey, xLabels, plotWidth })}\n {valueYAxis({\n show: withYAxis,\n size,\n formatter: axisFormatter ?? format,\n domain: yDomain,\n max: dataMax(\n data,\n series.map(s => s.dataKey),\n ),\n integer: isWholeData(\n data,\n series.map(s => s.dataKey),\n ),\n })}\n {markers.map(m => (\n <ReferenceLine\n key={m.x}\n x={m.x}\n stroke=\"var(--border-strong)\"\n strokeDasharray=\"3 3\"\n label={\n m.label\n ? { value: m.label, position: 'insideTopLeft', fill: 'var(--muted-foreground)', fontSize: 11 }\n : undefined\n }\n />\n ))}\n <Tooltip\n {...CHART_TOOLTIP_PROPS}\n content={\n <ChartTooltipPosition>\n <MetricsLineChartTooltip formatValue={format} labelKey={tooltipLabelKey} />\n </ChartTooltipPosition>\n }\n cursor={<HoverLine />}\n />\n {series.map((s, i) => {\n const common = {\n type: 'monotone' as const,\n dataKey: s.dataKey,\n name: s.label,\n stroke: s.color,\n strokeWidth: s.emphasis ? line.emphasis : line.width,\n strokeDasharray: s.dashed ? '4 3' : undefined,\n dot: restDot(s),\n activeDot: activeDot(s),\n isAnimationActive: false,\n connectNulls: true,\n };\n return s.dashed ? (\n <Line key={s.dataKey} {...common} />\n ) : (\n <Area key={s.dataKey} {...common} fill={`url(#${id}-area-${i})`} fillOpacity={1} />\n );\n })}\n </ComposedChart>\n </ChartPlot>\n );\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAKA,SAAgB,uBAAuB,EACrC,QACA,aAIC;CACD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,aAAU;EAAe,WAAWA,cAAAA,GAAG,+CAA+C,SAAS;EACjG,UAAA,OAAO,KAAI,MACV,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAqB,WAAU;GAA/B,UAAA,CACG,EAAE,SACD,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAAM,WAAU;IAA4C,OAAO,EAAE,aAAa,EAAE,MAAM;GAAI,CAAA,IAE9F,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAAK,WAAU;IAAgC,OAAO,EAAE,iBAAiB,EAAE,MAAM;GAAI,CAAA,GAEvF,iBAAA,GAAA,kBAAA,IAAA,CAACC,YAAAA,KAAD;IAAK,IAAG;IAAO,SAAQ;IAAU,MAAK;IAAQ,WAAU;IACrD,UAAA,EAAE;GACA,CAAA,CACF;EATK,GAAA,EAAE,OASP,CACN;CACE,CAAA;AAET;;ACzBA,SAAgB,wBAAwB,EACtC,QACA,SACA,OACA,QACA,eAAc,UAAS,MAAM,eAAe,OAA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ineChart-CwQ7c3nK.js","names":[],"sources":["../src/ds/components/MetricsLineChart/metrics-line-chart-legend.tsx","../src/ds/components/MetricsLineChart/metrics-line-chart-tooltip.tsx","../src/ds/components/MetricsLineChart/metrics-line-chart.tsx"],"sourcesContent":["import type { MetricsLineChartSeries } from './metrics-line-chart';\nimport { Txt } from '@/ds/components/Txt';\nimport { cn } from '@/lib/utils';\n\n/** A marker and a label per series. Totals belong in the card's header, not here. */\nexport function MetricsLineChartLegend({\n series,\n className,\n}: {\n series: Pick<MetricsLineChartSeries, 'dataKey' | 'label' | 'color' | 'dashed'>[];\n className?: string;\n}) {\n return (\n <div data-slot=\"chart-legend\" className={cn('flex flex-wrap items-center gap-x-4 gap-y-1', className)}>\n {series.map(s => (\n <div key={s.dataKey} className=\"inline-flex items-center gap-1.5\">\n {s.dashed ? (\n <span className=\"h-0 w-3 shrink-0 border-t-2 border-dashed\" style={{ borderColor: s.color }} />\n ) : (\n <div className=\"size-2 shrink-0 rounded-[2px]\" style={{ backgroundColor: s.color }} />\n )}\n <Txt as=\"span\" variant=\"body-sm\" tone=\"muted\" className=\"max-w-48 truncate\">\n {s.label}\n </Txt>\n </div>\n ))}\n </div>\n );\n}\n","import { ChartTooltip } from '@/ds/components/ChartTooltip';\nimport { Txt } from '@/ds/components/Txt';\n\nexport function MetricsLineChartTooltip({\n active,\n payload,\n label,\n suffix,\n formatValue = value => value.toLocaleString('en-US'),\n showTotal = false,\n labelKey,\n formatByKey,\n}: {\n active?: boolean;\n payload?: Array<{\n name: string;\n value: number;\n color: string;\n dataKey?: string | number;\n payload?: Record<string, unknown>;\n }>;\n label?: string;\n suffix?: string;\n formatValue?: (value: number) => string;\n /** Adds a \"Total\" row under a hairline: the sum of every row, e.g. a stacked column's height. */\n showTotal?: boolean;\n /** Read the heading from this field of the hovered row instead of the x-axis label. */\n labelKey?: string;\n /** Per-series formatters, by data key, for charts that mix units (counts and durations). */\n formatByKey?: Record<string, (value: number) => string>;\n}) {\n if (!active || !payload?.length) return null;\n // A missing reading (NaN, Infinity) shows as a dash and stays out of the total.\n const finite = (value: unknown): value is number => typeof value === 'number' && Number.isFinite(value);\n const total = payload.reduce((sum, entry) => sum + (finite(entry.value) ? entry.value : 0), 0);\n // A bucket with no readings at all totals to a dash, not 0.\n const hasReading = payload.some(entry => finite(entry.value));\n const heading = labelKey ? String(payload[0]?.payload?.[labelKey] ?? label ?? '') : label;\n const format = (entry: { dataKey?: string | number }) => formatByKey?.[String(entry.dataKey)] ?? formatValue;\n // A number through its formatter; a missing or non-finite one as a dash; text as it is.\n const reading = (entry: (typeof payload)[number]) => {\n if (finite(entry.value)) return format(entry)(entry.value);\n if (typeof entry.value === 'number' || entry.value == null) return '—';\n return entry.value;\n };\n return (\n // A floor like shadcn's chart tooltip, so short readouts don't size it to their own label.\n <ChartTooltip className=\"min-w-32\">\n <Txt variant=\"column\" tone=\"ink\" className=\"mb-1\">\n {heading}\n </Txt>\n <div className=\"grid grid-cols-[auto_1fr_auto] items-center gap-x-2 gap-y-1\">\n {payload.map(entry => (\n <div key={entry.name} className=\"contents\">\n <span className=\"size-2 rounded-[2px]\" style={{ backgroundColor: entry.color }} />\n <Txt as=\"span\" variant=\"caption\" tone=\"muted\" className=\"max-w-40 truncate\">\n {entry.name}\n </Txt>\n <span className=\"text-right font-mono text-foreground tabular-nums\">\n {reading(entry)}\n {finite(entry.value) && suffix}\n </span>\n </div>\n ))}\n {showTotal && (\n <div className=\"col-span-3 grid grid-cols-subgrid items-center border-t border-border pt-1\">\n <Txt as=\"span\" variant=\"caption\" tone=\"muted\" className=\"col-span-2\">\n Total\n </Txt>\n <span className=\"text-right font-mono text-foreground tabular-nums\">\n {hasReading ? formatValue(total) : '—'}\n {hasReading && suffix}\n </span>\n </div>\n )}\n </div>\n </ChartTooltip>\n );\n}\n","import { useContext } from 'react';\nimport { Area, CartesianGrid, ComposedChart, Line, ReferenceLine, Tooltip } from 'recharts';\nimport { MetricsLineChartLegend } from './metrics-line-chart-legend';\nimport { MetricsLineChartTooltip } from './metrics-line-chart-tooltip';\nimport { ChartSkeleton } from '@/ds/components/ChartSkeleton';\nimport { CHART_CURSOR_PROPS, CHART_GRID_PROPS, CHART_TOOLTIP_PROPS, useChartSize } from '@/ds/primitives/chart-axes';\nimport type { ChartXLabels } from '@/ds/primitives/chart-axes';\nimport { Y_AXIS_WIDTH, compactNumber, dataMax, isWholeData, timeXAxis, valueYAxis } from '@/ds/primitives/chart-frame';\nimport type { ChartHeight } from '@/ds/primitives/chart-frame';\nimport { CHART_MARGIN, ChartHideYAxis } from '@/ds/primitives/chart-layout';\nimport { ChartPlot } from '@/ds/primitives/chart-plot';\nimport { ChartTooltipPosition } from '@/ds/primitives/chart-tooltip-position';\nimport { useChartDefsId } from '@/ds/primitives/use-chart-defs-id';\nimport { cn } from '@/lib/utils';\n\nexport type MetricsLineChartSeries = {\n dataKey: string;\n label: string;\n color: string;\n /** A secondary reading (e.g. an average next to counts): dashed, no fill under it. */\n dashed?: boolean;\n /** The series to read first (e.g. P95 among percentiles): a slightly heavier line. */\n emphasis?: boolean;\n};\n\n/** Line weight; an emphasised series adds half a pixel. */\nconst LINE_WIDTH = 1.75;\n/** Opacity at the top of the fill under a line (it fades to nothing at the base). */\nconst AREA_OPACITY = 0.12;\n\n/**\n * How the series draw.\n * - `default`: 1.75px lines over a fill.\n * - `thin`: 1.5px lines (emphasis included) over a fainter fill (40% of the default), for small\n * cards in a grid.\n */\nexport type MetricsLineChartLineStyle = 'default' | 'thin';\n\nconst LINE_STYLES: Record<MetricsLineChartLineStyle, { width: number; emphasis: number; areaOpacity: number }> = {\n default: { width: LINE_WIDTH, emphasis: LINE_WIDTH + 0.5, areaOpacity: AREA_OPACITY },\n thin: { width: 1.5, emphasis: 1.5, areaOpacity: AREA_OPACITY * 0.4 },\n};\n\n/**\n * Fills fade out sideways over their first and last 24px, so they don't end in a hard vertical\n * edge where the line starts and stops. A mask sized to each fill's own box.\n */\nconst THIN_FILL_FADE = '[&_.recharts-area-area]:mask-x-from-[calc(100%-24px)]';\n/** A lone point draws no line at all, so it gets a dot; lines already bridge gaps (`connectNulls`). */\nconst SPARSE_POINTS = 1;\n\n// Jumps straight to the hovered point, with the dots and the tooltip.\nfunction HoverLine({ points }: { points?: { x: number; y: number }[] }) {\n const [top, bottom] = points ?? [];\n if (!top || !bottom) return null;\n return (\n <line x1={top.x} x2={top.x} y1={top.y} y2={bottom.y} {...CHART_CURSOR_PROPS} className=\"pointer-events-none\" />\n );\n}\n\nexport type MetricsLineChartPointClickHandler = (point: Record<string, unknown>, seriesKey: string) => void;\n\nexport type MetricsLineChartProps = {\n data: Record<string, unknown>[];\n series: MetricsLineChartSeries[];\n /** Pixels, or `fill` to grow with the parent (a flex column, e.g. a card's content). */\n height?: ChartHeight;\n yDomain?: [number, number];\n /** Click on a series' active dot. */\n onPointClick?: MetricsLineChartPointClickHandler;\n /** Click anywhere on a bucket (e.g. to open its traces); the plot shows a pointer cursor. */\n onBucketClick?: (row: Record<string, unknown>, index: number) => void;\n /** Row field printed under the x-axis. */\n xKey?: string;\n /** Row field with the bucket's start time (ms), which places labels on round clock times. */\n timestampKey?: string;\n /** `auto` fits as many labels as the width allows; `edges` prints only the first and last. */\n xLabels?: ChartXLabels;\n /** Row field for the tooltip heading (e.g. a longer date); defaults to the x-axis label. */\n tooltipLabelKey?: string;\n /** Render a visible dot on every point. A series with a single point gets one anyway. */\n showDots?: boolean;\n /**\n * Point markers. `auto`: on a series' lone point (or every point with `showDots`). `hover`:\n * none at rest, only the hovered point's.\n */\n dots?: 'auto' | 'hover';\n /** Line weight and fill. `thin` suits small cards in a grid. */\n lineStyle?: MetricsLineChartLineStyle;\n /** Set to `false` to render `MetricsLineChartLegend` elsewhere, e.g. next to tabs. */\n showLegend?: boolean;\n /** Formats tooltip values (e.g. `ms`, `%`), and y-axis ticks unless `axisFormatter` is set. */\n valueFormatter?: (value: number) => string;\n /** Formats y-axis ticks, when they need a shorter form than the tooltip. */\n axisFormatter?: (value: number) => string;\n /**\n * Set to `false` to drop the y-axis labels and let the plot span the card. The gridlines stay\n * for relative scale; exact values come from the tooltip and the card's summary.\n */\n showYAxis?: boolean;\n /** Show a ghost of the chart while data loads, in the chart's own footprint. */\n isLoading?: boolean;\n /**\n * Vertical lines at buckets, e.g. where a billing period starts. `x` must be one of the data's\n * `xKey` values: the axis is categorical, so any other value draws nothing.\n */\n markers?: { x: string; label?: string }[];\n className?: string;\n};\n\nexport function MetricsLineChart(props: MetricsLineChartProps) {\n const { data, series, height = 210, showLegend = true, isLoading = false, className } = props;\n const root = cn(height === 'fill' && 'flex min-h-0 flex-1 flex-col', className);\n // The legend stays while loading: it comes from the series, not the data.\n return (\n <div className={root}>\n {showLegend && <MetricsLineChartLegend series={series} className=\"mb-4\" />}\n {isLoading ? <ChartSkeleton kind=\"line\" height={height} /> : <LinePlot {...props} />}\n </div>\n );\n}\n\n/** The plot itself, once the data is in. */\nfunction LinePlot({\n data,\n series,\n height = 210,\n yDomain,\n onPointClick,\n onBucketClick,\n xKey = 'time',\n timestampKey = 'tsMs',\n xLabels = 'auto',\n tooltipLabelKey,\n showDots = false,\n dots = 'auto',\n lineStyle = 'default',\n valueFormatter,\n axisFormatter,\n showYAxis = true,\n markers = [],\n}: MetricsLineChartProps) {\n const id = useChartDefsId();\n const { size, onResize, ref } = useChartSize();\n\n const format = valueFormatter ?? compactNumber.format;\n const isSparse = (key: string) => data.filter(row => typeof row[key] === 'number').length <= SPARSE_POINTS;\n const hideYAxis = useContext(ChartHideYAxis);\n const withYAxis = showYAxis && !hideYAxis;\n const plotWidth = size.width - (withYAxis ? Y_AXIS_WIDTH : 0);\n const line = LINE_STYLES[lineStyle];\n const restDot = (s: MetricsLineChartSeries) =>\n dots === 'auto' && (showDots || isSparse(s.dataKey)) ? { r: 3, fill: s.color, strokeWidth: 0 } : false;\n const activeDot = (s: MetricsLineChartSeries) => ({\n r: 3.5,\n fill: s.color,\n stroke: 'var(--background)',\n strokeWidth: 2,\n ...(onPointClick && {\n style: { cursor: 'pointer' },\n onClick: (_: unknown, payload: unknown) => {\n // Recharts passes the dot's props; the hovered row is under `payload`.\n if (isRecord(payload) && isRecord(payload.payload)) onPointClick(payload.payload, s.dataKey);\n },\n }),\n });\n\n return (\n <ChartPlot\n height={height}\n plotRef={ref}\n onResize={onResize}\n clickable={!!onBucketClick}\n className={cn(lineStyle === 'thin' && THIN_FILL_FADE)}\n >\n <ComposedChart\n data={data}\n margin={CHART_MARGIN}\n onClick={state => {\n const i = state?.activeTooltipIndex;\n const row = i === undefined || i === null ? undefined : data[Number(i)];\n if (onBucketClick && row) onBucketClick(row, Number(i));\n }}\n >\n <defs>\n {series.map((s, i) => (\n <linearGradient key={s.dataKey} id={`${id}-area-${i}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={s.color} stopOpacity={line.areaOpacity} />\n <stop offset=\"95%\" stopColor={s.color} stopOpacity={0} />\n </linearGradient>\n ))}\n </defs>\n <CartesianGrid {...CHART_GRID_PROPS} />\n {timeXAxis({ data, xKey, timestampKey, xLabels, plotWidth })}\n {valueYAxis({\n show: withYAxis,\n size,\n formatter: axisFormatter ?? format,\n domain: yDomain,\n max: dataMax(\n data,\n series.map(s => s.dataKey),\n ),\n integer: isWholeData(\n data,\n series.map(s => s.dataKey),\n ),\n })}\n {markers.map(m => (\n <ReferenceLine\n key={m.x}\n x={m.x}\n stroke=\"var(--border-strong)\"\n strokeDasharray=\"3 3\"\n label={\n m.label\n ? { value: m.label, position: 'insideTopLeft', fill: 'var(--muted-foreground)', fontSize: 11 }\n : undefined\n }\n />\n ))}\n <Tooltip\n {...CHART_TOOLTIP_PROPS}\n content={\n <ChartTooltipPosition>\n <MetricsLineChartTooltip formatValue={format} labelKey={tooltipLabelKey} />\n </ChartTooltipPosition>\n }\n cursor={<HoverLine />}\n />\n {series.map((s, i) => {\n const common = {\n type: 'monotone' as const,\n dataKey: s.dataKey,\n name: s.label,\n stroke: s.color,\n strokeWidth: s.emphasis ? line.emphasis : line.width,\n strokeDasharray: s.dashed ? '4 3' : undefined,\n dot: restDot(s),\n activeDot: activeDot(s),\n isAnimationActive: false,\n connectNulls: true,\n };\n return s.dashed ? (\n <Line key={s.dataKey} {...common} />\n ) : (\n <Area key={s.dataKey} {...common} fill={`url(#${id}-area-${i})`} fillOpacity={1} />\n );\n })}\n </ComposedChart>\n </ChartPlot>\n );\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAKA,SAAgB,uBAAuB,EACrC,QACA,aAIC;CACD,OACE,oBAAC,OAAD;EAAK,aAAU;EAAe,WAAW,GAAG,+CAA+C,SAAS;EACjG,UAAA,OAAO,KAAI,MACV,qBAAC,OAAD;GAAqB,WAAU;GAA/B,UAAA,CACG,EAAE,SACD,oBAAC,QAAD;IAAM,WAAU;IAA4C,OAAO,EAAE,aAAa,EAAE,MAAM;GAAI,CAAA,IAE9F,oBAAC,OAAD;IAAK,WAAU;IAAgC,OAAO,EAAE,iBAAiB,EAAE,MAAM;GAAI,CAAA,GAEvF,oBAAC,KAAD;IAAK,IAAG;IAAO,SAAQ;IAAU,MAAK;IAAQ,WAAU;IACrD,UAAA,EAAE;GACA,CAAA,CACF;EATK,GAAA,EAAE,OASP,CACN;CACE,CAAA;AAET;;ACzBA,SAAgB,wBAAwB,EACtC,QACA,SACA,OACA,QACA,eAAc,UAAS,MAAM,eAAe,OAAO,GACnD,YAAY,OACZ,UACA,eAmBC;CACD,IAAI,CAAC,UAAU,CAAC,SAAS,QAAQ,OAAO;CAExC,MAAM,UAAU,UAAoC,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK;CACtG,MAAM,QAAQ,QAAQ,QAAQ,KAAK,UAAU,OAAO,OAAO,MAAM,KAAK,IAAI,MAAM,QAAQ,IAAI,CAAC;CAE7F,MAAM,aAAa,QAAQ,MAAK,UAAS,OAAO,MAAM,KAAK,CAAC;CAC5D,MAAM,UAAU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MAAM;KACN;KACA,WAAW,iBAAiB;KAC5B,QAAQ;KACR,KAAK,QACH,MACA,OAAO,KAAI,MAAK,EAAE,OAAO,CAC3B;KACA,SAAS,YACP,MACA,OAAO,KAAI,MAAK,EAAE,OAAO,CAC3B;IACF,CAAC;IACA,QAAQ,KAAI,MACX,oBAAC,eAAD;KAEE,GAAG,EAAE;KACL,QAAO;KACP,iBAAgB;KAChB,OACE,EAAE,QACE;MAAE,OAAO,EAAE;MAAO,UAAU;MAAiB,MAAM;MAA2B,UAAU;KAAG,IAC3F,KAAA;IAEP,GATM,EAAE,CASR,CACF;IACD,oBAAC,SAAD;KACE,GAAI;KACJ,SACE,oBAAC,sBAAD,EAAA,UACE,oBAAC,yBAAD;MAAyB,aAAa;MAAQ,UAAU;KAAkB,CAAA,EACtD,CAAA;KAExB,QAAQ,oBAAC,WAAD,CAAY,CAAA;IACrB,CAAA;IACA,OAAO,KAAK,GAAG,MAAM;KACpB,MAAM,SAAS;MACb,MAAM;MACN,SAAS,EAAE;MACX,MAAM,EAAE;MACR,QAAQ,EAAE;MACV,aAAa,EAAE,WAAW,KAAK,WAAW,KAAK;MAC/C,iBAAiB,EAAE,SAAS,QAAQ,KAAA;MACpC,KAAK,QAAQ,CAAC;MACd,WAAW,UAAU,CAAC;MACtB,mBAAmB;MACnB,cAAc;KAChB;KACA,OAAO,EAAE,SACP,oBAAC,MAAD,EAAsB,GAAI,OAAS,GAAxB,EAAE,OAAsB,IAEnC,oBAAC,MAAD;MAAsB,GAAI;MAAQ,MAAM,QAAQ,GAAG,QAAQ,EAAE;MAAI,aAAa;KAAI,GAAvE,EAAE,OAAqE;IAEtF,CAAC;GACY;;CACN,CAAA;AAEf;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU;AAChD"}
@@ -1 +0,0 @@
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,GAAI;CAAQ,CAAA;AACtG;;ACbA,IAAM,gBACJ;AAEF,IAAM,yBAAyB,cAAkC,KAAA,CAAS;;AAG1E,SAAgB,cAAc,EAAE,WAAW,GAAG,SAAoC;CAChF,MAAM,UAAU,MAAM;CAEtB,OACE,oBAAC,uBAAuB,UAAxB;EAAiC,OAAO;EACtC,UAAA,oBAAC,WAAD;GACE,mBAAiB;GACjB,WAAW,GAAG,2CAA2C,SAAS;GAClE,GAAI;EACL,CAAA;CAC8B,CAAA;AAErC;;AAGA,SAAgB,eAAe,EAC7B,QACA,UACA,WACA,GAAG,SACiD;CACpD,OACE,qBAAC,UAAD;EACE,WAAW,GAAG,+EAA+E,SAAS;EACtG,GAAI;EAFN,UAAA,CAIE,oBAAC,OAAD;GAAK,WAAU;GAA+B;EAAc,CAAA,GAC3D,UAAU,QAAQ,oBAAC,OAAD;GAAK,WAAU;GAAY,UAAA;EAAY,CAAA,CACpD;;AAEZ;AAEA,SAAgB,cAAc,EAC5B,WACA,MACA,WACA,UACA,GAAG,SAKF;CACD,MAAM,UAAU,WAAW,sBAAsB;CAEjD,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,6CAA6C,aAAa;EAA7E,UAAA,CACE,oBAAC,KAAD;GAAK,IAAG;GAAK,IAAI;GAAS,SAAQ;GAAa,MAAK;GAAiB;GAAW,GAAI;GACjF,UAAA,QAAQ,OAAO,WAAW,oBAAC,mBAAD;IAAyB;IAAO;GAA4B,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E,oBAAC,aAAD;EACE,eAAA;EACA,OAAO,oBAAC,cAAD;GAAc,MAAK;GAAa,WAAW,GAAG,QAAQ,GAAG;EAAI,CAAA;EACpE,aAAa,oBAAC,cAAD;GAAc,MAAK;GAAe,WAAW,GAAG,mBAAmB,GAAG;EAAI,CAAA;EAEvF,UAAA,oBAAC,UAAD,EAAU,WAAW,GAAG,6CAA6C,GAAG,EAAI,CAAA;CACjE,CAAA;AAEjB"}
@@ -1 +0,0 @@
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,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD;GACE,mBAAiB;GACjB,WAAWC,cAAA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AAU,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"}
@@ -1,46 +0,0 @@
1
- const require_page_header = require("./page-header-pZCts_WC.cjs");
2
- const require_utils = require("./utils-uDc1ofX1.cjs");
3
- let react_jsx_runtime = require("react/jsx-runtime");
4
- // src/ds/new/settings/settings-layout.tsx
5
- /**
6
- * A settings page: a centered 640px column with the title, inset like the section titles, above its sections.
7
- * The app's page around it gives the side gutter (`PageLayout`, Factory's settings panel, Platform's page).
8
- */
9
- function SettingsLayout({ title, titleAccessory, action, header, children }) {
10
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11
- "data-slot": "settings-layout",
12
- className: require_utils.cn("mx-auto grid min-h-full w-full max-w-160 min-w-0 gap-8 py-6", header != null || title != null ? "grid-rows-[auto_1fr]" : "grid-rows-[1fr]"),
13
- children: [
14
- header != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
15
- "data-slot": "settings-page-header",
16
- className: "ps-2.5",
17
- children: header
18
- }),
19
- header == null && title != null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_page_header.PageHeader, {
20
- "data-slot": "settings-page-header",
21
- className: "ps-2.5",
22
- children: [
23
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_page_header.PageHeader.Title, { children: title }),
24
- titleAccessory != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_page_header.PageHeader.Meta, {
25
- beside: true,
26
- children: titleAccessory
27
- }),
28
- action != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_page_header.PageHeader.Action, { children: action })
29
- ]
30
- }),
31
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
32
- "data-slot": "settings-layout-content",
33
- className: "grid min-w-0 content-start gap-7 has-[>[data-slot=empty-state-fill]:only-child]:content-stretch",
34
- children
35
- })
36
- ]
37
- });
38
- }
39
- Object.defineProperty(exports, "SettingsLayout", {
40
- enumerable: true,
41
- get: function() {
42
- return SettingsLayout;
43
- }
44
- });
45
-
46
- //# sourceMappingURL=settings-layout-BxtShpY6.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"settings-layout-BxtShpY6.cjs","names":["cn","PageHeader"],"sources":["../src/ds/new/settings/settings-layout.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { PageHeader } from '@/ds/new/layout/page-header';\nimport { cn } from '@/lib/utils';\n\nexport interface SettingsLayoutProps {\n /** The page title. Leave it out when the app's own header already names the page. */\n title?: ReactNode;\n titleAccessory?: ReactNode;\n action?: ReactNode;\n /** A header of the app's own in place of `title` (a `PageHeader` whose title takes focus), with the same inset. */\n header?: ReactNode;\n /** `SettingsGroup`s, 28px apart. */\n children: ReactNode;\n}\n\n/**\n * A settings page: a centered 640px column with the title, inset like the section titles, above its sections.\n * The app's page around it gives the side gutter (`PageLayout`, Factory's settings panel, Platform's page).\n */\nexport function SettingsLayout({ title, titleAccessory, action, header, children }: SettingsLayoutProps) {\n return (\n // The content row takes the rest of the page's height, so a lone `EmptyState variant=\"fill\"` centers in it.\n <div\n data-slot=\"settings-layout\"\n className={cn(\n 'mx-auto grid min-h-full w-full max-w-160 min-w-0 gap-8 py-6',\n header != null || title != null ? 'grid-rows-[auto_1fr]' : 'grid-rows-[1fr]',\n )}\n >\n {header != null && (\n <div data-slot=\"settings-page-header\" className=\"ps-2.5\">\n {header}\n </div>\n )}\n {header == null && title != null && (\n <PageHeader data-slot=\"settings-page-header\" className=\"ps-2.5\">\n <PageHeader.Title>{title}</PageHeader.Title>\n {titleAccessory != null && <PageHeader.Meta beside>{titleAccessory}</PageHeader.Meta>}\n {action != null && <PageHeader.Action>{action}</PageHeader.Action>}\n </PageHeader>\n )}\n <div\n data-slot=\"settings-layout-content\"\n className=\"grid min-w-0 content-start gap-7 has-[>[data-slot=empty-state-fill]:only-child]:content-stretch\"\n >\n {children}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAmBA,SAAgB,eAAe,EAAE,OAAO,gBAAgB,QAAQ,QAAQ,YAAiC;CACvG,OAEE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EACE,aAAU;EACV,WAAWA,cAAAA,GACT,+DACA,UAAU,QAAQ,SAAS,OAAO,yBAAyB,iBAC7D;EALF,UAAA;GAOG,UAAU,QACT,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAAK,aAAU;IAAuB,WAAU;IAC7C,UAAA;GACE,CAAA;GAEN,UAAU,QAAQ,SAAS,QAC1B,iBAAA,GAAA,kBAAA,KAAA,CAACC,oBAAAA,YAAD;IAAY,aAAU;IAAuB,WAAU;IAAvD,UAAA;KACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,oBAAAA,WAAW,OAAZ,EAAA,UAAmB,MAAwB,CAAA;KAC1C,kBAAkB,QAAQ,iBAAA,GAAA,kBAAA,IAAA,CAACA,oBAAAA,WAAW,MAAZ;MAAiB,QAAA;MAAQ,UAAA;KAAgC,CAAA;KACnF,UAAU,QAAQ,iBAAA,GAAA,kBAAA,IAAA,CAACA,oBAAAA,WAAW,QAAZ,EAAA,UAAoB,OAA0B,CAAA;IACvD;;GAEd,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IACE,aAAU;IACV,WAAU;IAET;GACE,CAAA;EACF;;AAET"}
@@ -1,41 +0,0 @@
1
- import { t as PageHeader } from "./page-header-Maytcmgh.js";
2
- import { t as cn } from "./utils-DQx8TpNT.js";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
- // src/ds/new/settings/settings-layout.tsx
5
- /**
6
- * A settings page: a centered 640px column with the title, inset like the section titles, above its sections.
7
- * The app's page around it gives the side gutter (`PageLayout`, Factory's settings panel, Platform's page).
8
- */
9
- function SettingsLayout({ title, titleAccessory, action, header, children }) {
10
- return /* @__PURE__ */ jsxs("div", {
11
- "data-slot": "settings-layout",
12
- className: cn("mx-auto grid min-h-full w-full max-w-160 min-w-0 gap-8 py-6", header != null || title != null ? "grid-rows-[auto_1fr]" : "grid-rows-[1fr]"),
13
- children: [
14
- header != null && /* @__PURE__ */ jsx("div", {
15
- "data-slot": "settings-page-header",
16
- className: "ps-2.5",
17
- children: header
18
- }),
19
- header == null && title != null && /* @__PURE__ */ jsxs(PageHeader, {
20
- "data-slot": "settings-page-header",
21
- className: "ps-2.5",
22
- children: [
23
- /* @__PURE__ */ jsx(PageHeader.Title, { children: title }),
24
- titleAccessory != null && /* @__PURE__ */ jsx(PageHeader.Meta, {
25
- beside: true,
26
- children: titleAccessory
27
- }),
28
- action != null && /* @__PURE__ */ jsx(PageHeader.Action, { children: action })
29
- ]
30
- }),
31
- /* @__PURE__ */ jsx("div", {
32
- "data-slot": "settings-layout-content",
33
- className: "grid min-w-0 content-start gap-7 has-[>[data-slot=empty-state-fill]:only-child]:content-stretch",
34
- children
35
- })
36
- ]
37
- });
38
- }
39
- export { SettingsLayout as t };
40
-
41
- //# sourceMappingURL=settings-layout-UPnWI3FZ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"settings-layout-UPnWI3FZ.js","names":[],"sources":["../src/ds/new/settings/settings-layout.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { PageHeader } from '@/ds/new/layout/page-header';\nimport { cn } from '@/lib/utils';\n\nexport interface SettingsLayoutProps {\n /** The page title. Leave it out when the app's own header already names the page. */\n title?: ReactNode;\n titleAccessory?: ReactNode;\n action?: ReactNode;\n /** A header of the app's own in place of `title` (a `PageHeader` whose title takes focus), with the same inset. */\n header?: ReactNode;\n /** `SettingsGroup`s, 28px apart. */\n children: ReactNode;\n}\n\n/**\n * A settings page: a centered 640px column with the title, inset like the section titles, above its sections.\n * The app's page around it gives the side gutter (`PageLayout`, Factory's settings panel, Platform's page).\n */\nexport function SettingsLayout({ title, titleAccessory, action, header, children }: SettingsLayoutProps) {\n return (\n // The content row takes the rest of the page's height, so a lone `EmptyState variant=\"fill\"` centers in it.\n <div\n data-slot=\"settings-layout\"\n className={cn(\n 'mx-auto grid min-h-full w-full max-w-160 min-w-0 gap-8 py-6',\n header != null || title != null ? 'grid-rows-[auto_1fr]' : 'grid-rows-[1fr]',\n )}\n >\n {header != null && (\n <div data-slot=\"settings-page-header\" className=\"ps-2.5\">\n {header}\n </div>\n )}\n {header == null && title != null && (\n <PageHeader data-slot=\"settings-page-header\" className=\"ps-2.5\">\n <PageHeader.Title>{title}</PageHeader.Title>\n {titleAccessory != null && <PageHeader.Meta beside>{titleAccessory}</PageHeader.Meta>}\n {action != null && <PageHeader.Action>{action}</PageHeader.Action>}\n </PageHeader>\n )}\n <div\n data-slot=\"settings-layout-content\"\n className=\"grid min-w-0 content-start gap-7 has-[>[data-slot=empty-state-fill]:only-child]:content-stretch\"\n >\n {children}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAmBA,SAAgB,eAAe,EAAE,OAAO,gBAAgB,QAAQ,QAAQ,YAAiC;CACvG,OAEE,qBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,+DACA,UAAU,QAAQ,SAAS,OAAO,yBAAyB,iBAC7D;EALF,UAAA;GAOG,UAAU,QACT,oBAAC,OAAD;IAAK,aAAU;IAAuB,WAAU;IAC7C,UAAA;GACE,CAAA;GAEN,UAAU,QAAQ,SAAS,QAC1B,qBAAC,YAAD;IAAY,aAAU;IAAuB,WAAU;IAAvD,UAAA;KACE,oBAAC,WAAW,OAAZ,EAAA,UAAmB,MAAwB,CAAA;KAC1C,kBAAkB,QAAQ,oBAAC,WAAW,MAAZ;MAAiB,QAAA;MAAQ,UAAA;KAAgC,CAAA;KACnF,UAAU,QAAQ,oBAAC,WAAW,QAAZ,EAAA,UAAoB,OAA0B,CAAA;IACvD;;GAEd,oBAAC,OAAD;IACE,aAAU;IACV,WAAU;IAET;GACE,CAAA;EACF;;AAET"}
@@ -1 +0,0 @@
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;EACV,WAAW,GAAG,cAAc,CAAC,gBAAgB,kBAAkB,SAAS;EACxE,GAAI;EANN,UAAA,CAQE,qBAAC,OAAD;GAAK,WAAW,GAAG,kBAAkB,CAAC,gBAAgB,oBAAoB;GAA1E,UAAA;IACE,oBAAC,YAAD;KACE,GAAK,UAAU,EAAE,QAAQ,IAAI,CAAC;KACpB;KACV,WAAW,GAAG,SAAS,iBAAiB,6BAA6B;KAEpE,UAAA;IACS,CAAA;IACX,eAAe,QACd,oBAAC,kBAAD;KAAkB,QAAQ,oBAAC,OAAD,CAAM,CAAA;KAAG,WAAU;KAC1C,UAAA;IACe,CAAA;IAEpB,oBAAC,YAAD;KAAY,WAAU;KAAQ,UAAA;IAAqB,CAAA;GAChD;EACJ,CAAA,GAAA,YAAY,QACX,oBAAC,OAAD;GACE,aAAU;GACV,WAAW,GACT,WACA,CAAC,gBAAgB,sBACjB,YAAY,4DACd;GAEA,UAAA,oBAAC,oBAAD;IAA8B;IAAW;GAA6B,CAAA;EACnE,CAAA,CAEF;;AAEX;;;;;;;;;;AAmBA,SAAgB,oBAAoB,EAClC,OACA,aACA,UACA,WACA,mBAAmB,QACnB,GAAG,SACwB;CAC3B,MAAM,gBAAgB,MAAM;CAC5B,MAAM,eAAe,qBAAqB;CAE1C,OACE,qBAAC,UAAD;EACE,aAAU;EACV,oBAAkB,eAAe,OAAO,KAAA,IAAY;EACpD,WAAW,GACT,iBACA,cACA,CAAC,gBAAgB,CAAC,+BAA+B,gBAAgB,GACjE,SACF;EACA,GAAI;EATN,UAAA,CAWE,qBAAC,OAAD;GAAK,WAAW,GAAG,kBAAkB,CAAC,gBAAgB,oBAAoB;GAA1E,UAAA,CACE,oBAAC,gBAAD,EAAA,UAAiB,MAAsB,CAAA,GACtC,eAAe,QACd,oBAAC,OAAD;IAAK,IAAI;IAAe,WAAU;IAC/B,UAAA;GACE,CAAA,CAEJ;EACJ,CAAA,GAAA,YAAY,QACX,oBAAC,OAAD;GAAK,aAAU;GAAuB,WAAW,GAAG,WAAW,CAAC,gBAAgB,oBAAoB;GACjG;EACE,CAAA,CAEC;;AAEd"}
@@ -1 +0,0 @@
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,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,iBAAA,GAAA,kBAAA,KAAA,CAAAA,kBAAAA,UAAA,EAAA,UAAA;EACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,+BAAAA,UAAD;GAAU,WAAU;GAAwB,eAAA;EAAa,CAAA;EACzD,iBAAA,GAAA,kBAAA,IAAA,CAAC,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,iBAAA,GAAA,kBAAA,KAAA,CAACC,yBAAAA,OAAD;EACE,aAAa,eAAe,aAAa;EACzC,SAAS,QAAQ,QAAQ;EACzB,UAAU,YAA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