@ngrok/mantle 0.79.3 → 0.81.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion.d.ts +158 -19
- package/dist/accordion.js +1 -1
- package/dist/agent.json +5 -1
- package/dist/alert-dialog.d.ts +465 -32
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +116 -14
- package/dist/alert.js +1 -1
- package/dist/anchor-DfeXTpKW.js +1 -0
- package/dist/anchor.d.ts +2 -2
- package/dist/anchor.js +1 -1
- package/dist/area-chart.d.ts +504 -0
- package/dist/area-chart.js +1 -0
- package/dist/as-child-D23mGo4f.d.ts +49 -0
- package/dist/badge.d.ts +44 -5
- package/dist/badge.js +1 -1
- package/dist/bar-chart.d.ts +491 -0
- package/dist/bar-chart.js +1 -0
- package/dist/breadcrumb.d.ts +196 -14
- package/dist/breadcrumb.js +1 -1
- package/dist/button-BAno7KIU.js +1 -0
- package/dist/{index-BSAizFod.d.ts → button-C-gMbPso.d.ts} +5 -5
- package/dist/{icon-button-BvQvT790.d.ts → button-C7vAl6lS.d.ts} +22 -63
- package/dist/button-D9n09xUg.js +1 -0
- package/dist/{button-DcXOWUYo.d.ts → button-DARFK2KJ.d.ts} +4 -4
- package/dist/button-DjpEKt2X.js +1 -0
- package/dist/button-DvHMWAPl.js +1 -0
- package/dist/button.d.ts +5 -5
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +0 -3
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +131 -9
- package/dist/card.js +1 -1
- package/dist/centered-layout.d.ts +209 -8
- package/dist/centered-layout.js +1 -1
- package/dist/chart-BROa2gqt.js +2 -0
- package/dist/chart-BcOC6Qj0.d.ts +275 -0
- package/dist/checkbox-0EoxOyMA.js +1 -0
- package/dist/checkbox.d.ts +13 -11
- package/dist/checkbox.js +1 -1
- package/dist/choice-BHwFSSyv.js +1 -0
- package/dist/choice-BNRQXszu.d.ts +254 -0
- package/dist/choice.d.ts +1 -252
- package/dist/choice.js +1 -1
- package/dist/code-block.d.ts +242 -52
- package/dist/code-block.js +6 -6
- package/dist/code-block_highlight-utils.d.ts +1 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/code.d.ts +3 -2
- package/dist/code.js +1 -1
- package/dist/combobox.d.ts +171 -16
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +279 -81
- package/dist/command.js +1 -1
- package/dist/compose-refs-BdBMM9ga.js +1 -0
- package/dist/data-table.d.ts +28 -6
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +67 -6
- package/dist/description-list.js +1 -1
- package/dist/dialog-BM4wPCft.d.ts +24 -0
- package/dist/dialog-DWZWd5Jt.js +1 -0
- package/dist/dialog.d.ts +226 -35
- package/dist/dialog.js +1 -1
- package/dist/{dropdown-menu-DP_Ne9Mr.d.ts → dropdown-menu-DZg-Cd69.d.ts} +137 -32
- package/dist/dropdown-menu-Dw-OtXPm.d.ts +1 -0
- package/dist/dropdown-menu-RyDWoKHx.js +1 -0
- package/dist/dropdown-menu.d.ts +2 -2
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +7 -22
- package/dist/empty.js +1 -1
- package/dist/field-B1wqeZr4.js +1 -0
- package/dist/field.d.ts +568 -47
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +0 -3
- package/dist/flag.js +1 -1
- package/dist/hooks.d.ts +3 -4
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +48 -7
- package/dist/hover-card.js +1 -1
- package/dist/{svg-only-BFeFS1aa.d.ts → icon-CX_gj6sW.d.ts} +2 -2
- package/dist/icon-d-nMCfAI.js +1 -0
- package/dist/{icon-Cevjo93X.d.ts → icon-k4E9yNWD.d.ts} +2 -2
- package/dist/icon-lZ48P8Nn.js +1 -0
- package/dist/icon.d.ts +3 -3
- package/dist/icon.js +1 -1
- package/dist/{sort-BPX2Fk9t.js → icons-B_DDQcVD.js} +1 -1
- package/dist/{traffic-policy-file-0g5RXFqu.js → icons-CF1lbWtp.js} +1 -1
- package/dist/icons-DLCs1hLP.js +1 -0
- package/dist/icons.d.ts +7 -15
- package/dist/icons.js +1 -1
- package/dist/{in-view-nkSOdED2.d.ts → in-view-DDEGUKDR.d.ts} +17 -9
- package/dist/{index-D47aqlpz.d.ts → index-DA4ig3gj.d.ts} +1 -1
- package/dist/input-BnlpQF0c.js +1 -0
- package/dist/{types-C19IR7jf.d.ts → input-BuYDU6CF.d.ts} +42 -2
- package/dist/input.d.ts +5 -56
- package/dist/input.js +1 -1
- package/dist/{label-v2-bv98k.d.ts → label-C6YH9skg.d.ts} +8 -6
- package/dist/label-D-D11mlp.js +1 -0
- package/dist/label.d.ts +1 -1
- package/dist/label.js +1 -1
- package/dist/line-chart.d.ts +490 -0
- package/dist/line-chart.js +1 -0
- package/dist/list-51KQvENW.js +1 -0
- package/dist/list.d.ts +135 -6
- package/dist/list.js +1 -1
- package/dist/llms.txt +5 -1
- package/dist/main.d.ts +20 -4
- package/dist/main.js +1 -1
- package/dist/mantle-dark-high-contrast.css +17 -0
- package/dist/mantle-dark.css +13 -0
- package/dist/mantle-light-high-contrast.css +15 -0
- package/dist/mantle.css +29 -0
- package/dist/media-object.d.ts +18 -4
- package/dist/media-object.js +1 -1
- package/dist/multi-select.d.ts +282 -24
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +118 -6
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +61 -6
- package/dist/pagination.js +1 -1
- package/dist/popover-CE4OlWkd.d.ts +208 -0
- package/dist/popover-CQ9s7jG5.js +1 -0
- package/dist/popover.d.ts +1 -181
- package/dist/popover.js +1 -1
- package/dist/primitive-trJDqIXJ.js +1 -0
- package/dist/progress.d.ts +2 -8
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +101 -5
- package/dist/qr-code.js +1 -1
- package/dist/radio-group.d.ts +110 -35
- package/dist/radio-group.js +1 -1
- package/dist/sandboxed-on-click.d.ts +2 -2
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/scatter-plot.d.ts +495 -0
- package/dist/scatter-plot.js +1 -0
- package/dist/select-0z7HVS6r.d.ts +579 -0
- package/dist/select-BCHWvmyC.js +1 -0
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +225 -298
- package/dist/selectable-list.js +1 -1
- package/dist/separator-B5UmkVRL.d.ts +75 -0
- package/dist/separator-bpE_kooz.js +1 -0
- package/dist/separator.d.ts +1 -52
- package/dist/separator.js +1 -1
- package/dist/sheet.d.ts +285 -38
- package/dist/sheet.js +1 -1
- package/dist/skeleton-CsbUHbBA.js +1 -0
- package/dist/skeleton.d.ts +4 -7
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.d.ts +24 -4
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slider.js +1 -1
- package/dist/{index-Rv8RL7xy.d.ts → slot-BtwKJTLq.d.ts} +1 -1
- package/dist/slot-CDk0Bb9z.js +1 -0
- package/dist/slot.d.ts +1 -1
- package/dist/slot.js +1 -1
- package/dist/split-button.d.ts +14 -14
- package/dist/split-button.js +1 -1
- package/dist/switch.d.ts +10 -7
- package/dist/switch.js +1 -1
- package/dist/table-Bo0vNxIJ.d.ts +848 -0
- package/dist/table-CGxJwtbL.js +1 -0
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +124 -25
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +2 -2
- package/dist/text-area.js +1 -1
- package/dist/theme-C26-Xolp.js +1 -0
- package/dist/theme-switcher.d.ts +105 -33
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +54 -15
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +86 -10
- package/dist/toast.js +1 -1
- package/dist/tooltip.d.ts +50 -5
- package/dist/tooltip.js +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/well.d.ts +3 -3
- package/dist/well.js +1 -1
- package/package.json +9 -3
- package/dist/anchor-C_tjSVy6.js +0 -1
- package/dist/as-child-CYEVu1WY.d.ts +0 -23
- package/dist/button-5t6-JS_I.js +0 -1
- package/dist/button-ClC60Nzg.js +0 -1
- package/dist/checkbox-DJ2xl7Rc.js +0 -1
- package/dist/choice-DOdyNzFC.js +0 -1
- package/dist/compose-refs-Cjf2gfB8.js +0 -1
- package/dist/dialog-vxLIvB8M.js +0 -1
- package/dist/dropdown-menu-Bt1aKF1g.js +0 -1
- package/dist/field-context-BR01g789.js +0 -1
- package/dist/icon-CDtYjF_H.js +0 -1
- package/dist/icon-button-DV2-GZHf.js +0 -1
- package/dist/index-g2rfwNCH.d.ts +0 -1
- package/dist/input-Ct1YOqSy.js +0 -1
- package/dist/label-BMlHW_2D.js +0 -1
- package/dist/popover-D5WxxnBY.js +0 -1
- package/dist/primitive-C64-m48O.d.ts +0 -13
- package/dist/primitive-IKruV2iB.js +0 -1
- package/dist/select-Bwt2YduR.d.ts +0 -345
- package/dist/select-D-5u0Blc.js +0 -1
- package/dist/separator-kBnnv3Cw.js +0 -1
- package/dist/skeleton-Bu3tgNcW.js +0 -1
- package/dist/slot-DmPrjM7N.js +0 -1
- package/dist/svg-only-DDx6FtJd.js +0 -1
- package/dist/table-CPH2md2-.js +0 -1
- package/dist/table-CwFHXC-G.d.ts +0 -414
- package/dist/theme-D3MDng6U.js +0 -1
- package/dist/theme-provider-C9zpDyJW.js +0 -1
- package/dist/toast-BsCjaMVS.js +0 -1
- package/dist/virtual-DZMBu7Ch.js +0 -1
- /package/dist/{sizes-BCoI4bhP.d.ts → button-BCoI4bhP.d.ts} +0 -0
- /package/dist/{intents-DdSKSj1c.d.ts → button-DdSKSj1c.d.ts} +0 -0
- /package/dist/{resolve-pre-rendered-props-B6OlZrSI.d.ts → code-block-B6OlZrSI.d.ts} +0 -0
- /package/dist/{resolve-pre-rendered-props-C9uaM9-V.js → code-block-C9uaM9-V.js} +0 -0
- /package/dist/{validation-7QeiTFwl.d.ts → field-7QeiTFwl.d.ts} +0 -0
- /package/dist/{validation-Bpptk_9t.js → field-Bpptk_9t.js} +0 -0
- /package/dist/{types-D1RY5Tcj.d.ts → icon-D1RY5Tcj.d.ts} +0 -0
- /package/dist/{is-input-CXmS0OFN.js → input-CXmS0OFN.js} +0 -0
- /package/dist/{themes-CYNpplwN.d.ts → theme-CYNpplwN.d.ts} +0 -0
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
import { _ as SeriesColor, a as LegendPrimitiveProps, c as XAxisPrimitiveProps, f as ChartDatum, g as PointShape, h as CurveKind, i as GridPrimitiveProps, l as YAxisPrimitiveProps, m as ContinuousXScale, n as ChartRootBaseProps, o as ReferenceLinePrimitiveProps, p as ChartDatumEvent, r as CopyButtonPrimitiveProps, s as TooltipPrimitiveProps, t as ChartAccessibleName } from "./chart-BcOC6Qj0.js";
|
|
2
|
+
//#region src/components/area-chart/area-chart.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Props for {@link AreaChart.Root}. Areas fill from a shared zero baseline, so
|
|
5
|
+
* the y domain minimum is fixed at `0` — a truncated-area axis is
|
|
6
|
+
* unrepresentable.
|
|
7
|
+
*/
|
|
8
|
+
type AreaChartRootProps<TDatum extends ChartDatum = ChartDatum> = Omit<ChartRootBaseProps, "yDomain"> & ChartAccessibleName & {
|
|
9
|
+
/** Rows of data; each `AreaChart.Area` reads one numeric key per row. */
|
|
10
|
+
data: readonly TDatum[];
|
|
11
|
+
/** The key of each row's x value. */
|
|
12
|
+
xKey: Extract<keyof TDatum, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Override the auto-detected x scale (`Date` values → `"time"`, numbers →
|
|
15
|
+
* `"linear"`, strings → `"point"`).
|
|
16
|
+
*/
|
|
17
|
+
xScale?: ContinuousXScale;
|
|
18
|
+
/** Override the automatic y maximum. The minimum is always the zero baseline. */
|
|
19
|
+
yDomain?: [0, number | "auto"];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Props for {@link AreaChart.Area}.
|
|
23
|
+
*/
|
|
24
|
+
type AreaChartAreaProps = {
|
|
25
|
+
/** The row key this series reads its numeric values from. */
|
|
26
|
+
dataKey: string;
|
|
27
|
+
/** Display name for the legend, tooltip, and data table. Defaults to `dataKey`. */
|
|
28
|
+
label?: string;
|
|
29
|
+
/**
|
|
30
|
+
* One of the validated chart tokens (`"chart-1"`…`"chart-8"`, `"chart-other"`)
|
|
31
|
+
* or any CSS color as an escape hatch. Defaults to the next sticky slot in
|
|
32
|
+
* mount order. Static colors (raw hex) do not adapt across themes; custom
|
|
33
|
+
* palettes must be validated for colorblind-safe adjacency and surface
|
|
34
|
+
* contrast, and a series that carries good/bad meaning should wear the
|
|
35
|
+
* semantic status colors, never a categorical slot.
|
|
36
|
+
*/
|
|
37
|
+
color?: SeriesColor;
|
|
38
|
+
/**
|
|
39
|
+
* Interpolation between points: `"linear"` (default), `"monotone"`
|
|
40
|
+
* (smoothed), or `"step"`.
|
|
41
|
+
*/
|
|
42
|
+
curve?: CurveKind;
|
|
43
|
+
/**
|
|
44
|
+
* Join across `null`/missing values instead of leaving gaps. Gaps are the
|
|
45
|
+
* default and usually correct.
|
|
46
|
+
*/
|
|
47
|
+
connectNulls?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The glyph the hover dot wears: `"circle"` (default), `"square"`,
|
|
50
|
+
* `"triangle"`, or `"diamond"` — a redundant encoding alongside color that
|
|
51
|
+
* keeps series distinguishable without color vision.
|
|
52
|
+
*/
|
|
53
|
+
shape?: PointShape;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Props for {@link AreaChart.Grid}.
|
|
57
|
+
*/
|
|
58
|
+
type AreaChartGridProps = GridPrimitiveProps;
|
|
59
|
+
/**
|
|
60
|
+
* Props for {@link AreaChart.XAxis}. The tick formatter receives the row's x
|
|
61
|
+
* value — the category value on point scales, a `Date` on time scales, and a
|
|
62
|
+
* number on linear scales.
|
|
63
|
+
*/
|
|
64
|
+
type AreaChartXAxisProps = XAxisPrimitiveProps;
|
|
65
|
+
/**
|
|
66
|
+
* Props for {@link AreaChart.YAxis}.
|
|
67
|
+
*/
|
|
68
|
+
type AreaChartYAxisProps = YAxisPrimitiveProps;
|
|
69
|
+
/**
|
|
70
|
+
* Props for {@link AreaChart.ReferenceLine}.
|
|
71
|
+
*/
|
|
72
|
+
type AreaChartReferenceLineProps = ReferenceLinePrimitiveProps;
|
|
73
|
+
/**
|
|
74
|
+
* Props for {@link AreaChart.Tooltip}.
|
|
75
|
+
*/
|
|
76
|
+
type AreaChartTooltipProps = TooltipPrimitiveProps;
|
|
77
|
+
/**
|
|
78
|
+
* Props for {@link AreaChart.Legend}.
|
|
79
|
+
*/
|
|
80
|
+
type AreaChartLegendProps = LegendPrimitiveProps;
|
|
81
|
+
/**
|
|
82
|
+
* Props for {@link AreaChart.CopyButton}.
|
|
83
|
+
*/
|
|
84
|
+
type AreaChartCopyButtonProps = CopyButtonPrimitiveProps;
|
|
85
|
+
/**
|
|
86
|
+
* The root of an area chart: owns the data, the scales, the canvas renderer,
|
|
87
|
+
* and the entire interaction contract (a crosshair with an every-series
|
|
88
|
+
* tooltip, keyboard stepping with polite announcements, an sr-only data
|
|
89
|
+
* table, Enter/Space + click activation). Areas fill with a 10% wash of the
|
|
90
|
+
* series color plus a 2px band-edge stroke; `stacked` on the Root stacks the
|
|
91
|
+
* composed series, the first series at the baseline. Large datasets decimate
|
|
92
|
+
* before painting on canvas. Compose the chrome and series parts as children.
|
|
93
|
+
*
|
|
94
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart#areachartroot
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```tsx
|
|
98
|
+
* const data = [
|
|
99
|
+
* { date: new Date("2026-07-15"), http: 4200, tcp: 1400 },
|
|
100
|
+
* { date: new Date("2026-07-16"), http: 5100, tcp: 1650 },
|
|
101
|
+
* { date: new Date("2026-07-17"), http: 4700, tcp: 1500 },
|
|
102
|
+
* ];
|
|
103
|
+
*
|
|
104
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
105
|
+
* <AreaChart.Grid />
|
|
106
|
+
* <AreaChart.XAxis />
|
|
107
|
+
* <AreaChart.YAxis />
|
|
108
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
109
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
110
|
+
* <AreaChart.Tooltip />
|
|
111
|
+
* <AreaChart.Legend />
|
|
112
|
+
* </AreaChart.Root>
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
declare const Root: <TDatum extends ChartDatum = ChartDatum>(props: AreaChartRootProps<TDatum>) => import("react").JSX.Element;
|
|
116
|
+
/**
|
|
117
|
+
* One area series. Renders nothing itself — it registers the series with the
|
|
118
|
+
* chart, which paints it on canvas. Compose one `Area` per series; with
|
|
119
|
+
* `stacked` on the Root, areas stack in composition order with the first
|
|
120
|
+
* series at the baseline.
|
|
121
|
+
*
|
|
122
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart#areachartarea
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```tsx
|
|
126
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
127
|
+
* <AreaChart.Grid />
|
|
128
|
+
* <AreaChart.XAxis />
|
|
129
|
+
* <AreaChart.YAxis />
|
|
130
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
131
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
132
|
+
* <AreaChart.Tooltip />
|
|
133
|
+
* <AreaChart.Legend />
|
|
134
|
+
* </AreaChart.Root>
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
declare const Area: (props: AreaChartAreaProps) => null;
|
|
138
|
+
/**
|
|
139
|
+
* Horizontal hairline gridlines behind the areas (renderless; painted on
|
|
140
|
+
* canvas). Omit the part to omit the grid.
|
|
141
|
+
*
|
|
142
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart#areachartgrid
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```tsx
|
|
146
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
147
|
+
* <AreaChart.Grid />
|
|
148
|
+
* <AreaChart.XAxis />
|
|
149
|
+
* <AreaChart.YAxis />
|
|
150
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
151
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
152
|
+
* <AreaChart.Tooltip />
|
|
153
|
+
* <AreaChart.Legend />
|
|
154
|
+
* </AreaChart.Root>
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
declare const Grid: (props: AreaChartGridProps) => null;
|
|
158
|
+
/**
|
|
159
|
+
* Tick labels along the bottom of the plot (renderless; painted on canvas).
|
|
160
|
+
* Labels that would collide are skipped, never rotated.
|
|
161
|
+
*
|
|
162
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart#areachartxaxis
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```tsx
|
|
166
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
167
|
+
* <AreaChart.Grid />
|
|
168
|
+
* <AreaChart.XAxis tickFormat={(date) => new Date(date).toLocaleDateString()} />
|
|
169
|
+
* <AreaChart.YAxis />
|
|
170
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
171
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
172
|
+
* <AreaChart.Tooltip />
|
|
173
|
+
* <AreaChart.Legend />
|
|
174
|
+
* </AreaChart.Root>
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
declare const XAxis: (props: AreaChartXAxisProps) => null;
|
|
178
|
+
/**
|
|
179
|
+
* Value tick labels along the left of the plot (renderless; painted on
|
|
180
|
+
* canvas). Ticks land on clean thousands-separated numbers.
|
|
181
|
+
*
|
|
182
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart#areachartyaxis
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```tsx
|
|
186
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
187
|
+
* <AreaChart.Grid />
|
|
188
|
+
* <AreaChart.XAxis />
|
|
189
|
+
* <AreaChart.YAxis tickFormat={(value) => `${value / 1000}k`} />
|
|
190
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
191
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
192
|
+
* <AreaChart.Tooltip />
|
|
193
|
+
* <AreaChart.Legend />
|
|
194
|
+
* </AreaChart.Root>
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
declare const YAxis: (props: AreaChartYAxisProps) => null;
|
|
198
|
+
/**
|
|
199
|
+
* A dashed horizontal marker at a y value — an SLO threshold, a budget, a
|
|
200
|
+
* limit (renderless; painted on canvas).
|
|
201
|
+
*
|
|
202
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart#areachartreferenceline
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```tsx
|
|
206
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
207
|
+
* <AreaChart.Grid />
|
|
208
|
+
* <AreaChart.XAxis />
|
|
209
|
+
* <AreaChart.YAxis />
|
|
210
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
211
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
212
|
+
* <AreaChart.ReferenceLine y={6000} label="Capacity" />
|
|
213
|
+
* <AreaChart.Tooltip />
|
|
214
|
+
* <AreaChart.Legend />
|
|
215
|
+
* </AreaChart.Root>
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
declare const ReferenceLine: (props: AreaChartReferenceLineProps) => null;
|
|
219
|
+
/**
|
|
220
|
+
* Customizes the hover/keyboard tooltip readout. The tooltip itself is part
|
|
221
|
+
* of `AreaChart.Root`'s interaction contract and renders whether or not this
|
|
222
|
+
* part is composed — compose it to format the label or values, append a
|
|
223
|
+
* footer, or replace the content entirely via the render-prop `children`.
|
|
224
|
+
*
|
|
225
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart#areacharttooltip
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```tsx
|
|
229
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
230
|
+
* <AreaChart.Grid />
|
|
231
|
+
* <AreaChart.XAxis />
|
|
232
|
+
* <AreaChart.YAxis />
|
|
233
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
234
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
235
|
+
* <AreaChart.Tooltip valueFormat={(value) => `${value} requests`} footer="Click to view logs" />
|
|
236
|
+
* <AreaChart.Legend />
|
|
237
|
+
* </AreaChart.Root>
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
declare const Tooltip: (props: AreaChartTooltipProps) => null;
|
|
241
|
+
/**
|
|
242
|
+
* The legend: series names keyed by color swatches, rendered as real DOM in
|
|
243
|
+
* flow below the plot. Always compose it on multi-series charts — identity
|
|
244
|
+
* must never rely on color-matching alone. It renders nothing for a single
|
|
245
|
+
* series (the chart's title already names it).
|
|
246
|
+
*
|
|
247
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart#areachartlegend
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```tsx
|
|
251
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
252
|
+
* <AreaChart.Grid />
|
|
253
|
+
* <AreaChart.XAxis />
|
|
254
|
+
* <AreaChart.YAxis />
|
|
255
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
256
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
257
|
+
* <AreaChart.Tooltip />
|
|
258
|
+
* <AreaChart.Legend />
|
|
259
|
+
* </AreaChart.Root>
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
declare const Legend: (props: AreaChartLegendProps) => import("react").JSX.Element;
|
|
263
|
+
/**
|
|
264
|
+
* A button that copies the chart's current data to the clipboard as a
|
|
265
|
+
* markdown table (ISO dates, plain numbers, one column per series) —
|
|
266
|
+
* pasteable into Slack, issues, docs, spreadsheets, and LLM chats. Renders
|
|
267
|
+
* in flow where composed (alongside `Legend`, below the plot); `Root` is
|
|
268
|
+
* relatively positioned, so `className` can dock it over a corner instead
|
|
269
|
+
* (e.g. `absolute right-0 top-0`).
|
|
270
|
+
*
|
|
271
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart#areachartcopybutton
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* ```tsx
|
|
275
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
276
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
277
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
278
|
+
* <AreaChart.Legend />
|
|
279
|
+
* <AreaChart.CopyButton />
|
|
280
|
+
* </AreaChart.Root>
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
declare const CopyButton: (props: AreaChartCopyButtonProps) => import("react").JSX.Element;
|
|
284
|
+
/**
|
|
285
|
+
* A canvas-rendered area chart for showing how values — and, when stacked, a
|
|
286
|
+
* total and its parts — change over a continuous x axis. Each area fills with
|
|
287
|
+
* a 10% wash of the series color plus a 2px band-edge stroke; the Root-level
|
|
288
|
+
* `stacked` prop stacks the composed series in composition order from the
|
|
289
|
+
* baseline. Series colors come from the theme's validated `--color-chart-*`
|
|
290
|
+
* tokens; areas keep a fixed slot color for the chart's lifetime even as
|
|
291
|
+
* other series are filtered in and out. Interaction — a crosshair with an
|
|
292
|
+
* every-series tooltip, keyboard stepping, aria-live announcements, and an
|
|
293
|
+
* sr-only data table — ships with `Root` unconditionally; large datasets
|
|
294
|
+
* decimate before painting on canvas.
|
|
295
|
+
*
|
|
296
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart
|
|
297
|
+
*
|
|
298
|
+
* @example
|
|
299
|
+
* Composition:
|
|
300
|
+
* ```
|
|
301
|
+
* AreaChart.Root
|
|
302
|
+
* ├── AreaChart.Grid
|
|
303
|
+
* ├── AreaChart.XAxis
|
|
304
|
+
* ├── AreaChart.YAxis
|
|
305
|
+
* ├── AreaChart.Area (one per series)
|
|
306
|
+
* ├── AreaChart.ReferenceLine
|
|
307
|
+
* ├── AreaChart.Tooltip
|
|
308
|
+
* └── AreaChart.Legend
|
|
309
|
+
* ```
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* ```tsx
|
|
313
|
+
* const data = [
|
|
314
|
+
* { date: new Date("2026-07-15"), http: 4200, tcp: 1400 },
|
|
315
|
+
* { date: new Date("2026-07-16"), http: 5100, tcp: 1650 },
|
|
316
|
+
* { date: new Date("2026-07-17"), http: 4700, tcp: 1500 },
|
|
317
|
+
* ];
|
|
318
|
+
*
|
|
319
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
320
|
+
* <AreaChart.Grid />
|
|
321
|
+
* <AreaChart.XAxis />
|
|
322
|
+
* <AreaChart.YAxis />
|
|
323
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
324
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
325
|
+
* <AreaChart.Tooltip />
|
|
326
|
+
* <AreaChart.Legend />
|
|
327
|
+
* </AreaChart.Root>
|
|
328
|
+
* ```
|
|
329
|
+
*/
|
|
330
|
+
declare const AreaChart: {
|
|
331
|
+
/**
|
|
332
|
+
* The root of an area chart: owns the data, the scales, the canvas renderer,
|
|
333
|
+
* and the entire interaction contract.
|
|
334
|
+
*
|
|
335
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart#areachartroot
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* ```tsx
|
|
339
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
340
|
+
* <AreaChart.Grid />
|
|
341
|
+
* <AreaChart.XAxis />
|
|
342
|
+
* <AreaChart.YAxis />
|
|
343
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
344
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
345
|
+
* <AreaChart.Tooltip />
|
|
346
|
+
* <AreaChart.Legend />
|
|
347
|
+
* </AreaChart.Root>
|
|
348
|
+
* ```
|
|
349
|
+
*/
|
|
350
|
+
readonly Root: typeof Root;
|
|
351
|
+
/**
|
|
352
|
+
* One area series; registers with the chart and paints on canvas.
|
|
353
|
+
*
|
|
354
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart#areachartarea
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* ```tsx
|
|
358
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
359
|
+
* <AreaChart.Grid />
|
|
360
|
+
* <AreaChart.XAxis />
|
|
361
|
+
* <AreaChart.YAxis />
|
|
362
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
363
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
364
|
+
* <AreaChart.Tooltip />
|
|
365
|
+
* <AreaChart.Legend />
|
|
366
|
+
* </AreaChart.Root>
|
|
367
|
+
* ```
|
|
368
|
+
*/
|
|
369
|
+
readonly Area: typeof Area;
|
|
370
|
+
/**
|
|
371
|
+
* Hairline gridlines behind the areas.
|
|
372
|
+
*
|
|
373
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart#areachartgrid
|
|
374
|
+
*
|
|
375
|
+
* @example
|
|
376
|
+
* ```tsx
|
|
377
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
378
|
+
* <AreaChart.Grid />
|
|
379
|
+
* <AreaChart.XAxis />
|
|
380
|
+
* <AreaChart.YAxis />
|
|
381
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
382
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
383
|
+
* <AreaChart.Tooltip />
|
|
384
|
+
* <AreaChart.Legend />
|
|
385
|
+
* </AreaChart.Root>
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
readonly Grid: typeof Grid;
|
|
389
|
+
/**
|
|
390
|
+
* Tick labels along the bottom of the plot.
|
|
391
|
+
*
|
|
392
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart#areachartxaxis
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* ```tsx
|
|
396
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
397
|
+
* <AreaChart.Grid />
|
|
398
|
+
* <AreaChart.XAxis tickFormat={(date) => new Date(date).toLocaleDateString()} />
|
|
399
|
+
* <AreaChart.YAxis />
|
|
400
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
401
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
402
|
+
* <AreaChart.Tooltip />
|
|
403
|
+
* <AreaChart.Legend />
|
|
404
|
+
* </AreaChart.Root>
|
|
405
|
+
* ```
|
|
406
|
+
*/
|
|
407
|
+
readonly XAxis: typeof XAxis;
|
|
408
|
+
/**
|
|
409
|
+
* Value tick labels along the left of the plot.
|
|
410
|
+
*
|
|
411
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart#areachartyaxis
|
|
412
|
+
*
|
|
413
|
+
* @example
|
|
414
|
+
* ```tsx
|
|
415
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
416
|
+
* <AreaChart.Grid />
|
|
417
|
+
* <AreaChart.XAxis />
|
|
418
|
+
* <AreaChart.YAxis tickFormat={(value) => `${value / 1000}k`} />
|
|
419
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
420
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
421
|
+
* <AreaChart.Tooltip />
|
|
422
|
+
* <AreaChart.Legend />
|
|
423
|
+
* </AreaChart.Root>
|
|
424
|
+
* ```
|
|
425
|
+
*/
|
|
426
|
+
readonly YAxis: typeof YAxis;
|
|
427
|
+
/**
|
|
428
|
+
* A dashed horizontal marker at a y value (threshold, budget, limit).
|
|
429
|
+
*
|
|
430
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart#areachartreferenceline
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* ```tsx
|
|
434
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
435
|
+
* <AreaChart.Grid />
|
|
436
|
+
* <AreaChart.XAxis />
|
|
437
|
+
* <AreaChart.YAxis />
|
|
438
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
439
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
440
|
+
* <AreaChart.ReferenceLine y={6000} label="Capacity" />
|
|
441
|
+
* <AreaChart.Tooltip />
|
|
442
|
+
* <AreaChart.Legend />
|
|
443
|
+
* </AreaChart.Root>
|
|
444
|
+
* ```
|
|
445
|
+
*/
|
|
446
|
+
readonly ReferenceLine: typeof ReferenceLine;
|
|
447
|
+
/**
|
|
448
|
+
* Customizes the always-on hover/keyboard tooltip readout.
|
|
449
|
+
*
|
|
450
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart#areacharttooltip
|
|
451
|
+
*
|
|
452
|
+
* @example
|
|
453
|
+
* ```tsx
|
|
454
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
455
|
+
* <AreaChart.Grid />
|
|
456
|
+
* <AreaChart.XAxis />
|
|
457
|
+
* <AreaChart.YAxis />
|
|
458
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
459
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
460
|
+
* <AreaChart.Tooltip valueFormat={(value) => `${value} requests`} />
|
|
461
|
+
* <AreaChart.Legend />
|
|
462
|
+
* </AreaChart.Root>
|
|
463
|
+
* ```
|
|
464
|
+
*/
|
|
465
|
+
readonly Tooltip: typeof Tooltip;
|
|
466
|
+
/**
|
|
467
|
+
* The legend; always compose it on multi-series charts. Renders nothing for
|
|
468
|
+
* a single series.
|
|
469
|
+
*
|
|
470
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart#areachartlegend
|
|
471
|
+
*
|
|
472
|
+
* @example
|
|
473
|
+
* ```tsx
|
|
474
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
475
|
+
* <AreaChart.Grid />
|
|
476
|
+
* <AreaChart.XAxis />
|
|
477
|
+
* <AreaChart.YAxis />
|
|
478
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
479
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
480
|
+
* <AreaChart.Tooltip />
|
|
481
|
+
* <AreaChart.Legend />
|
|
482
|
+
* </AreaChart.Root>
|
|
483
|
+
* ```
|
|
484
|
+
*/
|
|
485
|
+
readonly Legend: typeof Legend;
|
|
486
|
+
/**
|
|
487
|
+
* Copies the chart's current data to the clipboard as a markdown table.
|
|
488
|
+
*
|
|
489
|
+
* @see https://mantle.ngrok.com/components/charts/area-chart#areachartcopybutton
|
|
490
|
+
*
|
|
491
|
+
* @example
|
|
492
|
+
* ```tsx
|
|
493
|
+
* <AreaChart.Root data={data} xKey="date" stacked aria-label="Traffic by protocol">
|
|
494
|
+
* <AreaChart.Area dataKey="http" label="HTTP" />
|
|
495
|
+
* <AreaChart.Area dataKey="tcp" label="TCP" />
|
|
496
|
+
* <AreaChart.Legend />
|
|
497
|
+
* <AreaChart.CopyButton />
|
|
498
|
+
* </AreaChart.Root>
|
|
499
|
+
* ```
|
|
500
|
+
*/
|
|
501
|
+
readonly CopyButton: typeof CopyButton;
|
|
502
|
+
};
|
|
503
|
+
//#endregion
|
|
504
|
+
export { AreaChart, type AreaChartAreaProps, type AreaChartCopyButtonProps, type AreaChartGridProps, type AreaChartLegendProps, type AreaChartReferenceLineProps, type AreaChartRootProps, type AreaChartTooltipProps, type AreaChartXAxisProps, type AreaChartYAxisProps, type ChartDatumEvent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"./chart-BROa2gqt.js";import{jsx as l}from"react/jsx-runtime";const u={Root:e=>l(o,{kind:`area`,componentName:`AreaChart`,slotName:`area-chart`,...e}),Area:e=>a(`AreaChart.Area`,`area`,e),Grid:e=>n(`AreaChart.Grid`,e),XAxis:e=>t(`AreaChart.XAxis`,e),YAxis:e=>r(`AreaChart.YAxis`,e),ReferenceLine:t=>e(`AreaChart.ReferenceLine`,t),Tooltip:e=>s(`AreaChart.Tooltip`,e),Legend:e=>l(i,{partName:`AreaChart.Legend`,slotName:`area-chart`,...e}),CopyButton:e=>l(c,{partName:`AreaChart.CopyButton`,slotName:`area-chart`,...e})};export{u as AreaChart};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/types/as-child.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Utility type for adding the optional `asChild` boolean prop to a component.
|
|
5
|
+
*/
|
|
6
|
+
type WithAsChild = {
|
|
7
|
+
/**
|
|
8
|
+
* Use the `asChild` prop to compose component functionality onto alternative
|
|
9
|
+
* element types or your own React components.
|
|
10
|
+
*
|
|
11
|
+
* When `asChild` is set to `true`, mantle will not render a default DOM
|
|
12
|
+
* element, instead cloning the part's child and passing it the props and
|
|
13
|
+
* behavior required to make it functional.
|
|
14
|
+
*
|
|
15
|
+
* `asChild` can be used as deeply as you need to. This means it is a great way
|
|
16
|
+
* to compose multiple primitive's behavior together.
|
|
17
|
+
*
|
|
18
|
+
* @see https://www.radix-ui.com/docs/primitives/guides/composition#composition
|
|
19
|
+
*/
|
|
20
|
+
asChild?: boolean;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Utility type for adding the optional `asChild` boolean prop to a component
|
|
24
|
+
* that is self-closing.
|
|
25
|
+
* This is useful for components that do not have children, but still need to
|
|
26
|
+
* support the `asChild` prop.
|
|
27
|
+
*/
|
|
28
|
+
type SelfClosingWithAsChild = {
|
|
29
|
+
/**
|
|
30
|
+
* Use the `asChild` prop to compose component functionality onto alternative
|
|
31
|
+
* element types or your own React components.
|
|
32
|
+
*
|
|
33
|
+
* When `asChild` is set to `true`, mantle will not render a default DOM
|
|
34
|
+
* element, instead cloning the part's child and passing it the props and
|
|
35
|
+
* behavior required to make it functional.
|
|
36
|
+
*
|
|
37
|
+
* `asChild` can be used as deeply as you need to. This means it is a great way
|
|
38
|
+
* to compose multiple primitive's behavior together.
|
|
39
|
+
*
|
|
40
|
+
* @see https://www.radix-ui.com/docs/primitives/guides/composition#composition
|
|
41
|
+
*/
|
|
42
|
+
asChild: true;
|
|
43
|
+
children: ReactNode;
|
|
44
|
+
} | {
|
|
45
|
+
asChild?: false | undefined;
|
|
46
|
+
children?: undefined;
|
|
47
|
+
};
|
|
48
|
+
//#endregion
|
|
49
|
+
export { WithAsChild as n, SelfClosingWithAsChild as t };
|
package/dist/badge.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as WithAsChild } from "./as-child-D23mGo4f.js";
|
|
2
2
|
import { t as Color } from "./index-DorCusfG.js";
|
|
3
3
|
import { ComponentProps, ReactNode } from "react";
|
|
4
4
|
//#region src/components/badge/badge.d.ts
|
|
@@ -18,9 +18,48 @@ type BadgeProps = ComponentProps<"span"> & WithAsChild & {
|
|
|
18
18
|
*/
|
|
19
19
|
appearance: Appearance;
|
|
20
20
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
/**
|
|
22
|
+
* A non-interactive label used to highlight short, scannable information —
|
|
23
|
+
* a status, a category tag, or a count — in the smallest possible footprint.
|
|
24
|
+
*
|
|
25
|
+
* **When to use**
|
|
26
|
+
* - Status indicators: `Succeeded`, `Failed`, `Pending`, `Beta`.
|
|
27
|
+
* - Category or tag chips alongside list items, table rows, or cards.
|
|
28
|
+
* - Counts (e.g. `12 new`) when paired with brief context.
|
|
29
|
+
*
|
|
30
|
+
* **When not to use**
|
|
31
|
+
* - For interactive UI. Badges are not buttons or links — use {@link https://mantle.ngrok.com/components/actions/button Button}
|
|
32
|
+
* or {@link https://mantle.ngrok.com/components/navigation/anchor Anchor} (optionally with `asChild` styling) instead.
|
|
33
|
+
* - For long-form text. Keep labels to one or two short words.
|
|
34
|
+
* - As the sole signal of meaning. Pair color with a label or icon so the
|
|
35
|
+
* distinction works without color (color blindness, monochrome themes).
|
|
36
|
+
*
|
|
37
|
+
* **Choosing a `color`.** Prefer functional colors (`success`, `warning`,
|
|
38
|
+
* `danger`, `info`, `accent`, `neutral`) for status meaning so theming
|
|
39
|
+
* stays coherent. Reach for named hues only when the badge's semantic role
|
|
40
|
+
* isn't already covered.
|
|
41
|
+
*
|
|
42
|
+
* **Polymorphism.** Pass `asChild` to render the badge as a single child
|
|
43
|
+
* element — useful when the badge wraps a link or other semantic element
|
|
44
|
+
* while keeping the badge styling.
|
|
45
|
+
*
|
|
46
|
+
* @see https://mantle.ngrok.com/components/data-display/badge
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```tsx
|
|
50
|
+
* import { Badge } from "@ngrok/mantle/badge";
|
|
51
|
+
* import { CheckCircleIcon } from "@phosphor-icons/react/CheckCircle";
|
|
52
|
+
*
|
|
53
|
+
* <Badge appearance="muted" color="success" icon={<CheckCircleIcon />}>
|
|
54
|
+
* Succeeded
|
|
55
|
+
* </Badge>
|
|
56
|
+
*
|
|
57
|
+
* // Polymorphic — render the badge as a link, preserving its styling.
|
|
58
|
+
* <Badge appearance="muted" color="info" asChild>
|
|
59
|
+
* <a href="/status">Operational</a>
|
|
60
|
+
* </Badge>
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
declare const Badge: ({ appearance, asChild, children, className, color, icon, ...props }: BadgeProps) => import("react").JSX.Element;
|
|
25
64
|
//#endregion
|
|
26
65
|
export { Badge, type BadgeProps };
|
package/dist/badge.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-d-nMCfAI.js";import{t as n}from"./slot-CDk0Bb9z.js";import{Children as r,cloneElement as i,isValidElement as a}from"react";import o from"tiny-invariant";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";const u=({appearance:u,asChild:d=!1,children:p,className:h,color:g=`neutral`,icon:_,...v})=>{let y=f(g,u),b=m(g,u),x=e(`inline-flex w-fit shrink-0 cursor-default items-center gap-1 rounded px-1.5 py-0.5 font-medium text-xs font-sans`,_&&`ps-1`,y,b,h);if(d){let e=r.only(p);o(a(e),"When using `asChild`, Badge must be passed a single child as a JSX tag.");let u=e.props?.children;return c(n,{"data-slot":`badge`,className:x,...v,children:i(e,{},l(s,{children:[_&&c(t,{className:`size-4`,svg:_}),u]}))})}return l(`span`,{"data-slot":`badge`,className:x,...v,children:[_&&c(t,{className:`size-4`,svg:_}),p]})},d={amber:`bg-amber-500/20`,blue:`bg-blue-500/20`,cyan:`bg-cyan-500/20`,emerald:`bg-emerald-500/20`,fuchsia:`bg-fuchsia-500/20`,gray:`bg-gray-500/20`,green:`bg-green-500/20`,indigo:`bg-indigo-500/20`,lime:`bg-lime-500/20`,orange:`bg-orange-500/20`,pink:`bg-pink-500/20`,purple:`bg-purple-500/20`,red:`bg-red-500/20`,rose:`bg-rose-500/20`,sky:`bg-sky-500/20`,teal:`bg-teal-500/20`,violet:`bg-violet-500/20`,yellow:`bg-yellow-500/20`,accent:`bg-accent-500/20`,danger:`bg-danger-500/20`,important:`bg-important-500/20`,info:`bg-info-500/20`,neutral:`bg-neutral-500/20`,success:`bg-success-500/20`,warning:`bg-warning-500/20`};function f(e,t){switch(t){case`muted`:return d[e];default:o(!1,`Invalid appearance: ${String(t)}`)}}const p={amber:`text-amber-700`,blue:`text-blue-700`,cyan:`text-cyan-700`,emerald:`text-emerald-700`,fuchsia:`text-fuchsia-700`,gray:`text-gray-700`,green:`text-green-700`,indigo:`text-indigo-700`,lime:`text-lime-700`,orange:`text-orange-700`,pink:`text-pink-700`,purple:`text-purple-700`,red:`text-red-700`,rose:`text-rose-700`,sky:`text-sky-700`,teal:`text-teal-700`,violet:`text-violet-700`,yellow:`text-yellow-700`,accent:`text-accent-700`,danger:`text-danger-700`,important:`text-important-700`,info:`text-info-700`,neutral:`text-neutral-700`,success:`text-success-700`,warning:`text-warning-700`};function m(e,t){switch(t){case`muted`:return p[e];default:o(!1,`Invalid appearance: ${String(t)}`)}}export{u as Badge};
|