@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,275 @@
|
|
|
1
|
+
import { t as SelfClosingWithAsChild } from "./as-child-D23mGo4f.js";
|
|
2
|
+
import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
|
|
3
|
+
import { ComponentProps, ReactNode } from "react";
|
|
4
|
+
//#region src/components/chart/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Shared types for the internal canvas chart engine.
|
|
7
|
+
*
|
|
8
|
+
* This module is internal shared implementation — it is not exported from the
|
|
9
|
+
* package. The public components built on it are `BarChart` (../bar-chart),
|
|
10
|
+
* `LineChart` (../line-chart), `AreaChart` (../area-chart), and
|
|
11
|
+
* `ScatterPlot` (../scatter-plot), mirroring how `dialog/primitive` backs
|
|
12
|
+
* the dialog family.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* The value of the x field in a chart datum: a category label, a number, or a
|
|
16
|
+
* point in time.
|
|
17
|
+
*/
|
|
18
|
+
type XValue = string | number | Date;
|
|
19
|
+
/**
|
|
20
|
+
* A single row of chart data — any object shape. Series read one numeric key
|
|
21
|
+
* per row; the x key identifies the row's position on the x axis. Missing
|
|
22
|
+
* keys and `null` values are rendered as gaps. Typed as `object` (not an
|
|
23
|
+
* index signature) so interface-typed rows compose without ceremony; reads
|
|
24
|
+
* happen through `datumValue` at the data boundary.
|
|
25
|
+
*/
|
|
26
|
+
type ChartDatum = object;
|
|
27
|
+
/**
|
|
28
|
+
* How x values map onto the x axis:
|
|
29
|
+
*
|
|
30
|
+
* - `"band"` — categorical bands with air between them (bar charts).
|
|
31
|
+
* - `"point"` — categorical positions with no band thickness (line/area over categories).
|
|
32
|
+
* - `"linear"` — continuous numeric axis.
|
|
33
|
+
* - `"time"` — continuous time axis with calendar-aware ticks.
|
|
34
|
+
*/
|
|
35
|
+
type XScaleKind = "band" | "point" | "linear" | "time";
|
|
36
|
+
/**
|
|
37
|
+
* The x scale kinds a consumer may request on line/area charts. Bar charts are
|
|
38
|
+
* always `"band"`.
|
|
39
|
+
*/
|
|
40
|
+
type ContinuousXScale = Exclude<XScaleKind, "band">;
|
|
41
|
+
/**
|
|
42
|
+
* The mark a registered series paints.
|
|
43
|
+
*/
|
|
44
|
+
type SeriesMark = "bar" | "line" | "area" | "scatter";
|
|
45
|
+
/**
|
|
46
|
+
* The ordered chart color tokens. Slots are assigned to series in registration
|
|
47
|
+
* order and stick to their `dataKey` for the chart's lifetime; series past the
|
|
48
|
+
* eighth slot use `"chart-other"`.
|
|
49
|
+
*/
|
|
50
|
+
type ChartColorToken = "chart-1" | "chart-2" | "chart-3" | "chart-4" | "chart-5" | "chart-6" | "chart-7" | "chart-8" | "chart-other";
|
|
51
|
+
/**
|
|
52
|
+
* A series color: one of the validated chart tokens (preferred — they adapt to
|
|
53
|
+
* light/dark/high-contrast themes) or any CSS color string as an escape hatch.
|
|
54
|
+
* Static colors (e.g. raw hex) do not adapt across themes; custom palettes
|
|
55
|
+
* must be validated for colorblind-safe adjacency and surface contrast. A
|
|
56
|
+
* series that carries good/bad meaning (error rate, pass/fail) should wear the
|
|
57
|
+
* semantic status colors, never a categorical chart slot.
|
|
58
|
+
*/
|
|
59
|
+
type SeriesColor = ChartColorToken | (string & {});
|
|
60
|
+
/**
|
|
61
|
+
* Line/area interpolation between points.
|
|
62
|
+
*/
|
|
63
|
+
type CurveKind = "linear" | "monotone" | "step";
|
|
64
|
+
/**
|
|
65
|
+
* The glyph a series' points wear: scatter marks, line canvas markers, and
|
|
66
|
+
* the hover dot on line/area charts. Shape is a redundant encoding alongside
|
|
67
|
+
* color, so series stay distinguishable without color vision.
|
|
68
|
+
*/
|
|
69
|
+
type PointShape = "circle" | "square" | "triangle" | "diamond";
|
|
70
|
+
/**
|
|
71
|
+
* The fill texture a bar series wears: solid color (the default), diagonal
|
|
72
|
+
* hatch lines at 45° (`"hatch"`), the 135° mirror (`"hatch-reverse"`), both
|
|
73
|
+
* (`"crosshatch"`), rungs perpendicular to the bar's length
|
|
74
|
+
* (`"perpendicular"` — horizontal lines on vertical bars), or an offset dot
|
|
75
|
+
* grid (`"dots"`). Texture is a redundant identity encoding alongside color —
|
|
76
|
+
* inked tone-on-tone at equal loudness across slots — so grouped and stacked
|
|
77
|
+
* series stay distinguishable without color vision, in grayscale print, and
|
|
78
|
+
* under forced colors.
|
|
79
|
+
*/
|
|
80
|
+
type BarTexture = "solid" | "hatch" | "hatch-reverse" | "crosshatch" | "perpendicular" | "dots";
|
|
81
|
+
/**
|
|
82
|
+
* The direction a bar chart's bars run: vertical columns rising from a bottom
|
|
83
|
+
* baseline (the default), or horizontal bars growing rightward from a left
|
|
84
|
+
* baseline — the layout for long category labels, which move into the left
|
|
85
|
+
* gutter at full width instead of colliding under the plot.
|
|
86
|
+
*/
|
|
87
|
+
type BarOrientation = "vertical" | "horizontal";
|
|
88
|
+
/**
|
|
89
|
+
* A series with its resolved presentation, exposed to the legend, tooltip, and
|
|
90
|
+
* data table.
|
|
91
|
+
*/
|
|
92
|
+
type SeriesMeta = {
|
|
93
|
+
dataKey: string;
|
|
94
|
+
label: string;
|
|
95
|
+
mark: SeriesMark;
|
|
96
|
+
/** The CSS color string the series paints with (token-resolved). */
|
|
97
|
+
color: string;
|
|
98
|
+
/** The color as authored (token name or custom string) before resolution. */
|
|
99
|
+
colorInput: SeriesColor;
|
|
100
|
+
/** The point glyph the series wears (scatter marks, legend keys, hover dots). */
|
|
101
|
+
shape: PointShape;
|
|
102
|
+
/** The fill texture the series wears (bar marks and their legend keys). */
|
|
103
|
+
texture: BarTexture;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Grid line orientation.
|
|
107
|
+
*/
|
|
108
|
+
type GridLines = "horizontal" | "vertical" | "both";
|
|
109
|
+
/**
|
|
110
|
+
* The hover/keyboard snapshot published by the engine. One snapshot describes
|
|
111
|
+
* the active x position and every series' value at it — the tooltip, the
|
|
112
|
+
* aria-live announcement, and `onDatumActivate` all read from it.
|
|
113
|
+
*/
|
|
114
|
+
type HoverSnapshot = {
|
|
115
|
+
/** The active row's index in the consumer's `data` array. */
|
|
116
|
+
index: number;
|
|
117
|
+
/** The x value at the active index. */
|
|
118
|
+
xValue: XValue;
|
|
119
|
+
/** The original consumer datum at the active index. */
|
|
120
|
+
datum: ChartDatum;
|
|
121
|
+
/** Every registered series' value at the active index, in visual order. */
|
|
122
|
+
points: Array<{
|
|
123
|
+
dataKey: string;
|
|
124
|
+
label: string;
|
|
125
|
+
/** `null` renders as a gap (an em dash in the tooltip). */
|
|
126
|
+
value: number | null;
|
|
127
|
+
color: string;
|
|
128
|
+
}>;
|
|
129
|
+
/** The depth value at the active index (3D scatter plots only). */
|
|
130
|
+
zValue?: number | null;
|
|
131
|
+
/** Whether the snapshot came from keyboard stepping (vs pointer hover). */
|
|
132
|
+
viaKeyboard: boolean;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Payload for datum activation (click / Enter / Space).
|
|
136
|
+
*/
|
|
137
|
+
type ChartDatumEvent<TDatum extends ChartDatum = ChartDatum> = {
|
|
138
|
+
/** The activated row's index in the consumer's `data` array. */
|
|
139
|
+
index: number;
|
|
140
|
+
/** The x value of the activated row. */
|
|
141
|
+
xValue: XValue;
|
|
142
|
+
/** The activated row itself. */
|
|
143
|
+
datum: TDatum;
|
|
144
|
+
/** The series nearest the pointer when activated by mouse; `null` for keyboard/whole-band activation. */
|
|
145
|
+
dataKey: string | null;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* The y domain for value axes. Bar and area charts anchor the baseline at
|
|
149
|
+
* zero, so their minimum is fixed at `0`; line charts may override both ends.
|
|
150
|
+
*/
|
|
151
|
+
type YDomain = [number | "auto", number | "auto"];
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/components/chart/primitive.d.ts
|
|
154
|
+
/**
|
|
155
|
+
* The shared React layer of the chart family. `BarChart`, `LineChart`,
|
|
156
|
+
* `AreaChart`, and `ScatterPlot` are thin public wrappers over these
|
|
157
|
+
* primitives, mirroring how `dialog/primitive` backs the dialog family and
|
|
158
|
+
* `list/primitive` backs the list family.
|
|
159
|
+
*
|
|
160
|
+
* Interaction is the Root's UNCONDITIONAL contract: the crosshair/hover band,
|
|
161
|
+
* tooltip, keyboard stepping (arrows / PageUp / PageDown / Home / End /
|
|
162
|
+
* Escape, Enter/Space to activate), aria-live announcements, and the sr-only
|
|
163
|
+
* data table all ship with Root itself. The composed Tooltip part customizes
|
|
164
|
+
* the readout; omitting it never removes the hover layer, and no part removal
|
|
165
|
+
* can strip keyboard access to the data.
|
|
166
|
+
*
|
|
167
|
+
* This module is internal shared implementation — it is not exported from the
|
|
168
|
+
* package.
|
|
169
|
+
*/
|
|
170
|
+
/**
|
|
171
|
+
* Every chart must have an accessible name: either a direct `aria-label` or
|
|
172
|
+
* an `aria-labelledby` reference to a visible title (preferred when the chart
|
|
173
|
+
* sits under a heading — no drift-prone duplicated text). Enforced at the
|
|
174
|
+
* type level; the name lands on the interaction overlay (the chart's single
|
|
175
|
+
* named element — the canvas itself is aria-hidden so AT never announces the
|
|
176
|
+
* chart twice).
|
|
177
|
+
*/
|
|
178
|
+
type ChartAccessibleName = {
|
|
179
|
+
"aria-label": string;
|
|
180
|
+
"aria-labelledby"?: never;
|
|
181
|
+
} | {
|
|
182
|
+
"aria-labelledby": string;
|
|
183
|
+
"aria-label"?: never;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Root props shared by every chart kind, WITHOUT the accessible-name union or
|
|
187
|
+
* the data/x props. Public wrappers `Omit` from this base and re-intersect
|
|
188
|
+
* `ChartAccessibleName` — `Omit` over a union type flattens it, which would
|
|
189
|
+
* silently make the required accessible name optional.
|
|
190
|
+
*/
|
|
191
|
+
type ChartRootBaseProps = Omit<ComponentProps<"div">, "aria-label" | "aria-labelledby"> & WithDataSlot & {
|
|
192
|
+
/** Override the automatic y domain. */
|
|
193
|
+
yDomain?: YDomain;
|
|
194
|
+
/** Stack the composed series (bar/area charts). */
|
|
195
|
+
stacked?: boolean;
|
|
196
|
+
/** Animate enter/update transitions. `prefers-reduced-motion` always wins. */
|
|
197
|
+
animate?: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Hold the previous render at reduced opacity while fresh data loads —
|
|
200
|
+
* never swap a chart that has rendered once for a skeleton.
|
|
201
|
+
*/
|
|
202
|
+
pending?: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* Controlled active datum index — an index into `data` (`null` = none).
|
|
205
|
+
* Omit for uncontrolled hover.
|
|
206
|
+
*/
|
|
207
|
+
activeIndex?: number | null;
|
|
208
|
+
/** Notified when hover/keyboard moves the active index (an index into `data`). */
|
|
209
|
+
onActiveIndexChange?: (index: number | null) => void;
|
|
210
|
+
/** Notified on datum activation: mark click, or Enter/Space on the focused chart. */
|
|
211
|
+
onDatumActivate?: (event: ChartDatumEvent) => void;
|
|
212
|
+
};
|
|
213
|
+
type GridPrimitiveProps = {
|
|
214
|
+
/** Which gridlines to draw. */
|
|
215
|
+
lines?: GridLines;
|
|
216
|
+
};
|
|
217
|
+
type XAxisPrimitiveProps = {
|
|
218
|
+
/**
|
|
219
|
+
* Format a tick label. Receives the chart's x values: the category value on
|
|
220
|
+
* band/point scales, a `Date` on time scales, and a number on linear scales.
|
|
221
|
+
*/
|
|
222
|
+
tickFormat?: (value: XValue) => string;
|
|
223
|
+
/** Target tick count (continuous scales only; a density-derived default otherwise). */
|
|
224
|
+
tickCount?: number;
|
|
225
|
+
};
|
|
226
|
+
type YAxisPrimitiveProps = {
|
|
227
|
+
/** Format a tick label. Defaults to thousands-separated numbers. */
|
|
228
|
+
tickFormat?: (value: number) => string;
|
|
229
|
+
/** Target tick count. */
|
|
230
|
+
tickCount?: number;
|
|
231
|
+
};
|
|
232
|
+
type ReferenceLinePrimitiveProps = {
|
|
233
|
+
/** The y value the line marks (an SLO threshold, a budget, a limit). */
|
|
234
|
+
y: number;
|
|
235
|
+
/** A short label painted above the line's right end. */
|
|
236
|
+
label?: string;
|
|
237
|
+
/** Line color; defaults to the neutral reference color. */
|
|
238
|
+
color?: SeriesColor;
|
|
239
|
+
};
|
|
240
|
+
type TooltipPrimitiveProps = Omit<ComponentProps<"div">, "children"> & {
|
|
241
|
+
/** Format the x/label row of the readout. */
|
|
242
|
+
labelFormat?: (value: XValue) => ReactNode;
|
|
243
|
+
/** Format each series value. */
|
|
244
|
+
valueFormat?: (value: number, dataKey: string) => ReactNode;
|
|
245
|
+
/** The per-series color key: a short stroke (default) or nothing. */
|
|
246
|
+
indicator?: "line" | "none";
|
|
247
|
+
/** Extra content appended below the series rows (e.g. a "view logs" hint). */
|
|
248
|
+
footer?: ReactNode | ((snapshot: HoverSnapshot) => ReactNode);
|
|
249
|
+
/** Replace the entire readout. */
|
|
250
|
+
children?: (snapshot: HoverSnapshot) => ReactNode;
|
|
251
|
+
};
|
|
252
|
+
type LegendPrimitiveProps = Omit<ComponentProps<"div">, "children"> & {
|
|
253
|
+
/** Replace the default legend items; receives the registered series. */
|
|
254
|
+
children?: (series: SeriesMeta[]) => ReactNode;
|
|
255
|
+
};
|
|
256
|
+
type CopyButtonPrimitiveProps = Omit<ComponentProps<"button">, "children" | "type" | "onCopy"> & SelfClosingWithAsChild & {
|
|
257
|
+
/**
|
|
258
|
+
* The accessible label for the copy button. This label will be visually
|
|
259
|
+
* hidden but announced to screen reader users, similar to alt text for
|
|
260
|
+
* img tags.
|
|
261
|
+
*
|
|
262
|
+
* @default "Copy data as Markdown"
|
|
263
|
+
*/
|
|
264
|
+
label?: string;
|
|
265
|
+
/**
|
|
266
|
+
* Callback fired after a successful copy, passes the serialized markdown.
|
|
267
|
+
*/
|
|
268
|
+
onCopy?: (value: string) => void;
|
|
269
|
+
/**
|
|
270
|
+
* Callback fired when an error occurs during copying.
|
|
271
|
+
*/
|
|
272
|
+
onCopyError?: (error: unknown) => void;
|
|
273
|
+
};
|
|
274
|
+
//#endregion
|
|
275
|
+
export { SeriesColor as _, LegendPrimitiveProps as a, XAxisPrimitiveProps as c, BarTexture as d, ChartDatum as f, PointShape as g, CurveKind as h, GridPrimitiveProps as i, YAxisPrimitiveProps as l, ContinuousXScale as m, ChartRootBaseProps as n, ReferenceLinePrimitiveProps as o, ChartDatumEvent as p, CopyButtonPrimitiveProps as r, TooltipPrimitiveProps as s, ChartAccessibleName as t, BarOrientation as u };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./clsx-DUGZgXfJ.js";import{a as n,r}from"./field-Bpptk_9t.js";import{useEffect as i,useRef as a,useState as o}from"react";import{jsx as s}from"react/jsx-runtime";const c=e=>e===`indeterminate`,l=({"aria-invalid":l,className:u,checked:d,defaultChecked:f,defaultValue:p=`on`,onClick:m,readOnly:h,ref:g,validation:_,...v})=>{let y=a(null),[b]=o(f),x=n(),{ariaInvalid:S,validation:C}=r({"aria-invalid":l,validation:_??x}),w=d??b;i(()=>{y.current&&(y.current.indeterminate=c(w))},[w]);let T=d==null?{defaultChecked:c(b)?void 0:b}:{checked:!c(d)&&d};return s(`input`,{"aria-checked":c(d)?`mixed`:d,"aria-invalid":S,"data-slot":`checkbox`,className:t(`border-form bg-form shrink-0 cursor-pointer select-none appearance-none rounded border disabled:cursor-default disabled:opacity-50`,`bg-center bg-no-repeat focus:outline-hidden`,`focus-visible:border-accent-600 focus-visible:ring-focus-accent focus-visible:outline-hidden focus-visible:ring-4`,`checked:border-accent-600 checked:bg-accent-600 checked:bg-checked-icon`,`indeterminate:border-accent-600 indeterminate:bg-accent-600 indeterminate:bg-indeterminate-icon`,`data-validation-success:border-success-600 data-validation-success:checked:bg-success-600 data-validation-success:indeterminate:bg-success-600 focus-visible:data-validation-success:border-success-600 focus-visible:data-validation-success:ring-focus-success`,`data-validation-warning:border-warning-600 data-validation-warning:checked:bg-warning-600 data-validation-warning:indeterminate:bg-warning-600 focus-visible:data-validation-warning:border-warning-600 focus-visible:data-validation-warning:ring-focus-warning`,`data-validation-error:border-danger-600 data-validation-error:checked:bg-danger-600 data-validation-error:indeterminate:bg-danger-600 focus-visible:data-validation-error:border-danger-600 focus-visible:data-validation-error:ring-focus-danger`,`where:block where:size-4 where:p-0`,u),...T,"data-validation":C||void 0,defaultValue:p,onClick:e=>{if(h){e.preventDefault();return}m?.(e)},readOnly:h,ref:e(y,g),type:`checkbox`,...v})};function u({allSelected:e,someSelected:t}){return e?!0:t?`indeterminate`:!1}export{u as n,l as t};
|
package/dist/checkbox.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import { o as WithValidation } from "./
|
|
1
|
+
import { o as WithValidation } from "./field-7QeiTFwl.js";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
//#region src/components/checkbox/checkbox.d.ts
|
|
3
4
|
type CheckedState = boolean | "indeterminate";
|
|
5
|
+
type Props = Omit<ComponentProps<"input">, "type" | "checked" | "defaultChecked"> & WithValidation & {
|
|
6
|
+
/**
|
|
7
|
+
* The controlled checked state of the checkbox. Must be used in conjunction with onChange.
|
|
8
|
+
*/
|
|
9
|
+
checked?: CheckedState;
|
|
10
|
+
/**
|
|
11
|
+
* The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.
|
|
12
|
+
*/
|
|
13
|
+
defaultChecked?: CheckedState;
|
|
14
|
+
};
|
|
4
15
|
/**
|
|
5
16
|
* A form control that allows the user to toggle between checked and not checked.
|
|
6
17
|
* Supports indeterminate state.
|
|
@@ -21,16 +32,7 @@ type CheckedState = boolean | "indeterminate";
|
|
|
21
32
|
* </form>
|
|
22
33
|
* ```
|
|
23
34
|
*/
|
|
24
|
-
declare const Checkbox:
|
|
25
|
-
/**
|
|
26
|
-
* The controlled checked state of the checkbox. Must be used in conjunction with onChange.
|
|
27
|
-
*/
|
|
28
|
-
checked?: CheckedState;
|
|
29
|
-
/**
|
|
30
|
-
* The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.
|
|
31
|
-
*/
|
|
32
|
-
defaultChecked?: CheckedState;
|
|
33
|
-
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
35
|
+
declare const Checkbox: ({ "aria-invalid": _ariaInvalid, className, checked: _checked, defaultChecked: _defaultChecked, defaultValue, onClick, readOnly, ref, validation: _validation, ...props }: Props) => import("react").JSX.Element;
|
|
34
36
|
/**
|
|
35
37
|
* Resolve the tri-state `checked` value for a "select all" checkbox from the
|
|
36
38
|
* current selection counts: `true` when everything is selected,
|
package/dist/checkbox.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./checkbox-
|
|
1
|
+
import{n as e,t}from"./checkbox-0EoxOyMA.js";export{t as Checkbox,e as selectAllChecked};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-CDk0Bb9z.js";import{t as n}from"./field-B1wqeZr4.js";import{t as r}from"./label-D-D11mlp.js";import{cloneElement as i,createContext as a,isValidElement as o,useContext as s,useId as c,useMemo as l}from"react";import u from"tiny-invariant";import{jsx as d}from"react/jsx-runtime";const f=a(null);function p(e){let t=s(f);return u(t,`Choice.${e} must be rendered inside Choice.Root.`),t}const m={Root:({"aria-describedby":t,"aria-errormessage":r,"aria-invalid":i,children:a,className:o,disabled:u=!1,id:p,name:m,ref:h,...g})=>{let _=s(n),v=_?.id,y=_?.name,b=_?.[`aria-describedby`],x=_?.[`aria-invalid`],S=_?.[`aria-errormessage`],C=c(),w=c(),T=v??p??C,E=[b??t,w].filter(Boolean).join(` `)||void 0,D=l(()=>({controlId:T,descriptionId:w,disabled:u,controlProps:{id:T,name:y??m,disabled:u,"aria-describedby":E,"aria-invalid":x??i,"aria-errormessage":S??r}}),[T,w,u,E,y,m,x,i,S,r]);return d(f.Provider,{value:D,children:d(`div`,{ref:h,"data-slot":`choice`,className:e(`flex w-full items-start gap-2`,o),...g,children:a})})},Indicator:({children:t,className:n,ref:r,...a})=>{let{controlProps:s}=p(`Indicator`),c=o(t)?i(t,{...s,disabled:s.disabled||t.props.disabled===!0,name:s.name??t.props.name,"aria-invalid":s[`aria-invalid`]??t.props[`aria-invalid`],"aria-errormessage":s[`aria-errormessage`]??t.props[`aria-errormessage`]}):t;return d(`span`,{ref:r,"data-slot":`choice-indicator`,className:e(`flex h-lh shrink-0 items-center text-sm`,n),...a,children:c})},Content:({asChild:n,className:r,ref:i,...a})=>d(n?t:`div`,{ref:i,"data-slot":`choice-content`,className:e(`flex min-w-0 flex-1 flex-col gap-0.5`,r),...a}),Label:({className:t,ref:n,...i})=>{let{controlId:a,disabled:o}=p(`Label`);return d(r,{ref:n,"data-slot":`choice-label`,className:e(o&&`opacity-50`,t),...i,htmlFor:a,disabled:o})},Title:({asChild:n,className:r,ref:i,...a})=>{let{disabled:o}=p(`Title`);return d(n?t:`p`,{ref:i,"data-slot":`choice-title`,className:e(`text-strong text-sm font-medium font-sans`,o&&`opacity-50`,r),...a})},Description:({asChild:n,className:r,ref:i,...a})=>{let{descriptionId:o,disabled:s}=p(`Description`);return d(n?t:`p`,{ref:i,id:o,"data-slot":`choice-description`,className:e(`text-body text-sm leading-4`,s&&`opacity-50`,r),...a})}};export{m as t};
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { n as WithAsChild } from "./as-child-D23mGo4f.js";
|
|
2
|
+
import { t as Label } from "./label-C6YH9skg.js";
|
|
3
|
+
import { ComponentProps, ReactNode } from "react";
|
|
4
|
+
//#region src/components/choice/choice.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Props for `Choice.Root`. Extends `<div>` props (minus `id`, narrowed below)
|
|
7
|
+
* with the disabled / id / name controls. Inside a `Field.Control`, the field's
|
|
8
|
+
* `id` / `name` / `aria-*` take precedence over these.
|
|
9
|
+
*
|
|
10
|
+
* @see https://mantle.ngrok.com/components/forms/choice
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <Choice.Root name="notify">
|
|
15
|
+
* <Choice.Indicator>
|
|
16
|
+
* <Checkbox />
|
|
17
|
+
* </Choice.Indicator>
|
|
18
|
+
* <Choice.Content>
|
|
19
|
+
* <Choice.Label>Email</Choice.Label>
|
|
20
|
+
* <Choice.Description>Get notified by email.</Choice.Description>
|
|
21
|
+
* </Choice.Content>
|
|
22
|
+
* </Choice.Root>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
type ChoiceRootProps = Omit<ComponentProps<"div">, "id"> & {
|
|
26
|
+
/** Marks the choice disabled — dims the text and is injected onto the control. */
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Explicit control id. Defaults to a generated id, or — when composed inside a
|
|
30
|
+
* `Field.Control` — the field's id, so `Field.Label` and `Choice.Label` resolve
|
|
31
|
+
* to the same control.
|
|
32
|
+
*/
|
|
33
|
+
id?: string;
|
|
34
|
+
/** Form value name for the control. Inherited from `Field` when composed within one. */
|
|
35
|
+
name?: string;
|
|
36
|
+
/** `Choice.Indicator`, a `Choice.Content` (with `Label` / `Title` + `Description`). */
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Root of a `Choice`: the indicator-left / content-right layout for pairing a
|
|
41
|
+
* checkbox or radio with a titled, multi-line label. Owns the control's `id` and the
|
|
42
|
+
* description's `id`, and — when rendered inside a `Field.Control` — reads the
|
|
43
|
+
* field's `id` / `name` / `aria-*` from `FieldControlContext` and merges them
|
|
44
|
+
* into the props `Indicator` injects onto the control (the field's
|
|
45
|
+
* `aria-describedby` is concatenated with this `Choice`'s own description id).
|
|
46
|
+
* Outside a `Field` it falls back to its own generated ids, so the two compose
|
|
47
|
+
* but neither requires the other.
|
|
48
|
+
*
|
|
49
|
+
* @see https://mantle.ngrok.com/components/forms/choice
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```tsx
|
|
53
|
+
* <Choice.Root name="notify">
|
|
54
|
+
* <Choice.Indicator>
|
|
55
|
+
* <Checkbox />
|
|
56
|
+
* </Choice.Indicator>
|
|
57
|
+
* <Choice.Content>
|
|
58
|
+
* <Choice.Label>Email</Choice.Label>
|
|
59
|
+
* <Choice.Description>Get notified by email.</Choice.Description>
|
|
60
|
+
* </Choice.Content>
|
|
61
|
+
* </Choice.Root>
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
declare const Root: ({ "aria-describedby": ariaDescribedBy, "aria-errormessage": ariaErrorMessage, "aria-invalid": ariaInvalid, children, className, disabled, id, name, ref, ...props }: ChoiceRootProps) => import("react").JSX.Element;
|
|
65
|
+
type ChoiceIndicatorProps = ComponentProps<"span">;
|
|
66
|
+
/**
|
|
67
|
+
* The left control slot of a `Choice` — drop the control here (a `Checkbox`, a
|
|
68
|
+
* radio indicator, a `Switch`, …). Its single element child is cloned with the
|
|
69
|
+
* shared `id` / `name` / `aria-*` / `disabled` from `Root`, so a control placed
|
|
70
|
+
* here is wired to `Choice.Label` and the description without the caller
|
|
71
|
+
* threading ids. A non-element child (or none) is rendered untouched.
|
|
72
|
+
*
|
|
73
|
+
* The slot is one line tall (`h-lh`) using the same `text-sm` line box as the
|
|
74
|
+
* title, and centers its child — so the control sits centered on the title's
|
|
75
|
+
* first line and stays put when the title wraps.
|
|
76
|
+
*
|
|
77
|
+
* @see https://mantle.ngrok.com/components/forms/choice
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```tsx
|
|
81
|
+
* <Choice.Root name="notify">
|
|
82
|
+
* <Choice.Indicator>
|
|
83
|
+
* <Checkbox />
|
|
84
|
+
* </Choice.Indicator>
|
|
85
|
+
* <Choice.Content>
|
|
86
|
+
* <Choice.Label>Email</Choice.Label>
|
|
87
|
+
* <Choice.Description>Get notified by email.</Choice.Description>
|
|
88
|
+
* </Choice.Content>
|
|
89
|
+
* </Choice.Root>
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
declare const Indicator: ({ children, className, ref, ...props }: ChoiceIndicatorProps) => import("react").JSX.Element;
|
|
93
|
+
type ChoiceContentProps = ComponentProps<"div"> & WithAsChild;
|
|
94
|
+
/**
|
|
95
|
+
* The right column of a `Choice` — stacks a `Choice.Label` / `Choice.Title` over
|
|
96
|
+
* an optional `Choice.Description`. `min-w-0` so long titles truncate instead of
|
|
97
|
+
* pushing the row wide.
|
|
98
|
+
*
|
|
99
|
+
* @see https://mantle.ngrok.com/components/forms/choice
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```tsx
|
|
103
|
+
* <Choice.Root name="notify">
|
|
104
|
+
* <Choice.Indicator>
|
|
105
|
+
* <Checkbox />
|
|
106
|
+
* </Choice.Indicator>
|
|
107
|
+
* <Choice.Content>
|
|
108
|
+
* <Choice.Label>Email</Choice.Label>
|
|
109
|
+
* <Choice.Description>Get notified by email.</Choice.Description>
|
|
110
|
+
* </Choice.Content>
|
|
111
|
+
* </Choice.Root>
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
declare const Content: ({ asChild, className, ref, ...props }: ChoiceContentProps) => import("react").JSX.Element;
|
|
115
|
+
/**
|
|
116
|
+
* Props for `Choice.Label`. The mantle `Label` props, minus `htmlFor` and
|
|
117
|
+
* `disabled` — those are owned by `Choice.Root` (the control id and the choice's
|
|
118
|
+
* disabled state) and are not part of the public surface, so consumer props can
|
|
119
|
+
* never override the label-to-control wiring.
|
|
120
|
+
*/
|
|
121
|
+
type ChoiceLabelProps = Omit<ComponentProps<typeof Label>, "htmlFor" | "disabled">;
|
|
122
|
+
/**
|
|
123
|
+
* The emphasized title of a `Choice`, rendered as a real `<label>` wired to the
|
|
124
|
+
* control by `htmlFor`, so clicking it toggles the control and it supplies the
|
|
125
|
+
* control's accessible name. Use this when the `Choice` owns the labeling (a
|
|
126
|
+
* standalone checkbox, a raw `<form>`, React-state-only).
|
|
127
|
+
*
|
|
128
|
+
* It is the mantle {@link Label} (not a re-implementation), so it keeps every
|
|
129
|
+
* base-label behavior — cursor, the double-click text-selection guard, and the
|
|
130
|
+
* auto `font-medium` — and mirrors how `Field.Label` reuses `Label`. When an
|
|
131
|
+
* ancestor already owns the labeling and click target (a fully-clickable list
|
|
132
|
+
* row or a Headless radio item), use `Choice.Title` instead — a label-less `<p>`
|
|
133
|
+
* (it accepts `asChild`) — so labels never nest or compete.
|
|
134
|
+
*
|
|
135
|
+
* @see https://mantle.ngrok.com/components/forms/choice
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```tsx
|
|
139
|
+
* <Choice.Root name="notify">
|
|
140
|
+
* <Choice.Indicator>
|
|
141
|
+
* <Checkbox />
|
|
142
|
+
* </Choice.Indicator>
|
|
143
|
+
* <Choice.Content>
|
|
144
|
+
* <Choice.Label>Email</Choice.Label>
|
|
145
|
+
* <Choice.Description>Get notified by email.</Choice.Description>
|
|
146
|
+
* </Choice.Content>
|
|
147
|
+
* </Choice.Root>
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
declare const ChoiceLabel: ({ className, ref, ...props }: ChoiceLabelProps) => import("react").JSX.Element;
|
|
151
|
+
/**
|
|
152
|
+
* The emphasized title of a `Choice`, label-styled but **not** a `<label>` —
|
|
153
|
+
* renders a `<p>`. Mirrors `Field.LabelText`. Use this when something else owns
|
|
154
|
+
* the control's labeling and click target: a fully-clickable list row or a
|
|
155
|
+
* Headless radio item. It avoids nesting two `<label>`s or splitting
|
|
156
|
+
* the click target. Pass `asChild` to supply your own element. For a standalone
|
|
157
|
+
* control — or inside a `Field` — where the title can be the label, use
|
|
158
|
+
* `Choice.Label`.
|
|
159
|
+
*
|
|
160
|
+
* @see https://mantle.ngrok.com/components/forms/choice
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```tsx
|
|
164
|
+
* <Choice.Root id="onboarding-key">
|
|
165
|
+
* <Choice.Indicator>
|
|
166
|
+
* <Checkbox />
|
|
167
|
+
* </Choice.Indicator>
|
|
168
|
+
* <Choice.Content>
|
|
169
|
+
* <Choice.Title>Onboarding Key</Choice.Title>
|
|
170
|
+
* <Choice.Description>ng-3FaThZL***8xiA</Choice.Description>
|
|
171
|
+
* </Choice.Content>
|
|
172
|
+
* </Choice.Root>
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
declare const Title: ({ asChild, className, ref, ...props }: ComponentProps<"p"> & WithAsChild) => import("react").JSX.Element;
|
|
176
|
+
/**
|
|
177
|
+
* The de-emphasized supplementary line of a `Choice`, in the muted body color
|
|
178
|
+
* and wired to the control via `aria-describedby` (never a second label).
|
|
179
|
+
* Renders a `<p>`; pass `asChild` to supply your own element.
|
|
180
|
+
*
|
|
181
|
+
* @see https://mantle.ngrok.com/components/forms/choice
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```tsx
|
|
185
|
+
* <Choice.Root name="notify">
|
|
186
|
+
* <Choice.Indicator>
|
|
187
|
+
* <Checkbox />
|
|
188
|
+
* </Choice.Indicator>
|
|
189
|
+
* <Choice.Content>
|
|
190
|
+
* <Choice.Label>Email</Choice.Label>
|
|
191
|
+
* <Choice.Description>Get notified by email.</Choice.Description>
|
|
192
|
+
* </Choice.Content>
|
|
193
|
+
* </Choice.Root>
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
declare const Description: ({ asChild, className, ref, ...props }: ComponentProps<"p"> & WithAsChild) => import("react").JSX.Element;
|
|
197
|
+
/**
|
|
198
|
+
* A reusable indicator-left / content-right layout for a single choice: a
|
|
199
|
+
* control (checkbox, radio, switch) beside an emphasized title and an optional
|
|
200
|
+
* de-emphasized description. Use it to pair a checkbox or radio with a rich,
|
|
201
|
+
* titled label, or reach for it directly to build your own choice-like rows.
|
|
202
|
+
*
|
|
203
|
+
* It is a pure layout + association primitive: it owns the control's `id` and
|
|
204
|
+
* the description's `id` and wires them together, but does **not** own the
|
|
205
|
+
* control's value — drop your own control into `Choice.Indicator`. Pick
|
|
206
|
+
* `Choice.Label` (a real `<label>`) when the `Choice` owns the labeling, or
|
|
207
|
+
* `Choice.Title` (label-less text) when an ancestor (a clickable row or a
|
|
208
|
+
* Headless radio item) already does.
|
|
209
|
+
*
|
|
210
|
+
* **Use it for choice-like layouts** — a checkbox or radio input that needs an
|
|
211
|
+
* associated label and an optional supplementary description. It is not a
|
|
212
|
+
* general-purpose layout primitive; for laying out non-control content, reach
|
|
213
|
+
* for a plain flex/grid or `MediaObject` instead.
|
|
214
|
+
*
|
|
215
|
+
* **Field interop.** Inside a `Field.Control`, `Choice.Root` reads the field's
|
|
216
|
+
* `id` / `name` / `aria-*` and merges its description into the control's
|
|
217
|
+
* `aria-describedby`. Outside a `Field` it uses its own generated ids — the two
|
|
218
|
+
* are aware of each other but neither is required.
|
|
219
|
+
*
|
|
220
|
+
* @see https://mantle.ngrok.com/components/forms/choice
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* Composition:
|
|
224
|
+
* ```
|
|
225
|
+
* Choice.Root
|
|
226
|
+
* ├── Choice.Indicator
|
|
227
|
+
* └── Choice.Content
|
|
228
|
+
* ├── Choice.Label (or Choice.Title — pick one)
|
|
229
|
+
* └── Choice.Description
|
|
230
|
+
* ```
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* ```tsx
|
|
234
|
+
* <Choice.Root name="notify">
|
|
235
|
+
* <Choice.Indicator>
|
|
236
|
+
* <Checkbox />
|
|
237
|
+
* </Choice.Indicator>
|
|
238
|
+
* <Choice.Content>
|
|
239
|
+
* <Choice.Label>Email</Choice.Label>
|
|
240
|
+
* <Choice.Description>Get notified by email.</Choice.Description>
|
|
241
|
+
* </Choice.Content>
|
|
242
|
+
* </Choice.Root>
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
declare const Choice: {
|
|
246
|
+
Root: typeof Root;
|
|
247
|
+
Indicator: typeof Indicator;
|
|
248
|
+
Content: typeof Content;
|
|
249
|
+
Label: typeof ChoiceLabel;
|
|
250
|
+
Title: typeof Title;
|
|
251
|
+
Description: typeof Description;
|
|
252
|
+
};
|
|
253
|
+
//#endregion
|
|
254
|
+
export { ChoiceRootProps as n, Choice as t };
|