@ngrok/mantle 0.93.7 → 0.94.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 +13 -1
- package/dist/accordion.js +1 -1
- package/dist/agent.json +1181 -36
- package/dist/alert-CH99Rw-R.js +1 -0
- package/dist/{alert-BcSBNR3S.d.ts → alert-HffaioZM.d.ts} +31 -21
- package/dist/alert-center.d.ts +15 -3
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +15 -2
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +6 -1
- package/dist/alert.js +1 -1
- package/dist/anchor.d.ts +12 -0
- package/dist/app-layout.d.ts +16 -1
- package/dist/app-layout.js +1 -1
- package/dist/area-chart.d.ts +144 -88
- package/dist/area-chart.js +1 -1
- package/dist/avatar.d.ts +12 -0
- package/dist/badge.d.ts +13 -1
- package/dist/bar-chart.d.ts +144 -89
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.d.ts +11 -0
- package/dist/breadcrumb.js +1 -1
- package/dist/browser-only.d.ts +8 -0
- package/dist/{button-Yxyu1XMd.d.ts → button-BGwOPjGV.d.ts} +7 -1
- package/dist/{button-B8k98Pby.js → button-BWGUuWnu.js} +1 -1
- package/dist/{button-CPsKGDK0.d.ts → button-Cgf2IcEC.d.ts} +8 -1
- package/dist/button-Cu9e3SM7.js +1 -0
- package/dist/{button-BX-4lYUn.d.ts → button-K0pKc3GN.d.ts} +3 -3
- package/dist/button.d.ts +9 -3
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +7 -0
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +6 -1
- package/dist/centered-layout.d.ts +11 -0
- package/dist/chart-BO9EwQ60.js +1 -0
- package/dist/chart-CE5Uaqz9.js +1 -0
- package/dist/chart-DCTGGlWL.js +1 -0
- package/dist/chart-DudCw24t.js +2 -0
- package/dist/{chart-BpfbtOUN.d.ts → chart-jitNqimS.d.ts} +99 -103
- package/dist/{checkbox-DmSQXs26.js → checkbox-CS504fKk.js} +1 -1
- package/dist/checkbox.d.ts +14 -1
- package/dist/checkbox.js +1 -1
- package/dist/{choice-BLR0_MeB.d.ts → choice-BwfmbepO.d.ts} +7 -1
- package/dist/choice-uyYccm0A.js +1 -0
- package/dist/choice.d.ts +6 -1
- package/dist/choice.js +1 -1
- package/dist/code-block.d.ts +13 -2
- package/dist/code-block.js +1 -1
- package/dist/code-block_highlight-utils.d.ts +5 -0
- package/dist/code.d.ts +13 -0
- package/dist/color-CHZbU1Ww.js +1 -0
- package/dist/color.js +1 -1
- package/dist/combobox.d.ts +28 -14
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +14 -2
- package/dist/command.js +1 -1
- package/dist/cx.js +1 -1
- package/dist/data-table.d.ts +50 -19
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +12 -1
- package/dist/dialog-B9JAGy_x.d.ts +28 -0
- package/dist/{dialog-7TUgiSzX.js → dialog-CsugEt2A.js} +1 -1
- package/dist/{dialog-2fRO4ca4.d.ts → dialog-DD5H3EH1.d.ts} +10 -2
- package/dist/dialog.d.ts +7 -2
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu-DHdgaw4P.js +1 -0
- package/dist/{dropdown-menu-CpjRwMWe.d.ts → dropdown-menu-DmDxYPde.d.ts} +34 -26
- package/dist/dropdown-menu.d.ts +6 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +5 -0
- package/dist/empty.js +1 -1
- package/dist/{field-V_gnkcmN.d.ts → field-BshcNVe_.d.ts} +1 -1
- package/dist/field.d.ts +17 -6
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +8 -0
- package/dist/hooks.d.ts +5 -0
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +23 -12
- package/dist/{icon-ByLVhdYq.d.ts → icon-NYvyyRMG.d.ts} +6 -0
- package/dist/icon.d.ts +7 -2
- package/dist/icon.js +1 -1
- package/dist/{icons-DP3lQw5O.js → icons-4JA-SGfv.js} +1 -1
- package/dist/icons.d.ts +13 -1
- package/dist/icons.js +1 -1
- package/dist/{index-BhfgyurF.d.ts → index-KJ06KK6t.d.ts} +3 -3
- package/dist/input-BjCDSOPA.js +1 -0
- package/dist/input-DHovzBjS.js +1 -0
- package/dist/{input-Dx5owTCc.d.ts → input-q8o5uMhW.d.ts} +11 -1
- package/dist/input.d.ts +34 -2
- package/dist/input.js +1 -1
- package/dist/kbd.d.ts +12 -0
- package/dist/{label-nHqqYS7e.js → label-DmDwzPD8.js} +1 -1
- package/dist/{label-Dn5CPJUj.d.ts → label-r2sJcSQ4.d.ts} +6 -0
- package/dist/label.d.ts +6 -1
- package/dist/label.js +1 -1
- package/dist/line-chart.d.ts +139 -82
- package/dist/line-chart.js +1 -1
- package/dist/{list-RFRIQxU2.js → list-CO_yLdln.js} +1 -1
- package/dist/list.d.ts +19 -1
- package/dist/list.js +1 -1
- package/dist/live-region.d.ts +14 -1
- package/dist/llms.txt +78 -76
- package/dist/main.d.ts +12 -0
- package/dist/mantle.css +110 -65
- package/dist/media-object.d.ts +12 -0
- package/dist/migrations/0014-chart-named-colors.yml +1389 -0
- package/dist/migrations/0015-segmented-control.yml +788 -0
- package/dist/multi-select.d.ts +15 -2
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +17 -5
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +92 -3
- package/dist/pagination.js +1 -1
- package/dist/popover-BhTFutCz.d.ts +1 -0
- package/dist/{popover-BfB2I9G0.d.ts → popover-lwkwWcRW.d.ts} +16 -7
- package/dist/popover.d.ts +7 -2
- package/dist/progress.d.ts +27 -10
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +9 -1
- package/dist/query.d.ts +2 -2
- package/dist/query.js +1 -1
- package/dist/radio-group-jj2abc0t.js +1 -0
- package/dist/radio-group-sLz5AA9I.d.ts +27 -0
- package/dist/radio-group.d.ts +20 -99
- package/dist/radio-group.js +1 -1
- package/dist/sandbar.d.ts +14 -1
- package/dist/sandbar.js +1 -1
- package/dist/sandboxed-on-click.d.ts +8 -0
- package/dist/scatter-plot.d.ts +126 -64
- package/dist/scatter-plot.js +1 -1
- package/dist/segmented-control.d.ts +136 -0
- package/dist/segmented-control.js +1 -0
- package/dist/{select-BkhBxtOT.d.ts → select-BqmpVJJT.d.ts} +29 -21
- package/dist/select-C6Su0dU0.js +1 -0
- package/dist/select.d.ts +6 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +13 -2
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-D9AWEkcJ.d.ts → separator-QfH0ot5K.d.ts} +3 -1
- package/dist/separator.d.ts +6 -1
- package/dist/{sheet-CSJc_sB4.js → sheet-Bd2LIhzF.js} +1 -1
- package/dist/sheet.d.ts +15 -2
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +19 -3
- package/dist/sidebar.js +1 -1
- package/dist/skeleton.d.ts +11 -0
- package/dist/skip-to-main-link.d.ts +11 -0
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slider.d.ts +10 -0
- package/dist/{slot-C0OCJjdJ.d.ts → slot-D12N_fZJ.d.ts} +3 -1
- package/dist/slot.d.ts +6 -1
- package/dist/split-button.d.ts +14 -3
- package/dist/split-button.js +1 -1
- package/dist/strata.d.ts +13 -0
- package/dist/switch.d.ts +13 -1
- package/dist/switch.js +1 -1
- package/dist/{table-vT6Okwfa.d.ts → table-rWiVWEgB.d.ts} +79 -0
- package/dist/table.d.ts +6 -1
- package/dist/tabs.d.ts +23 -11
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +11 -1
- package/dist/theme-DdZgLvKH.js +1 -0
- package/dist/theme-switcher.d.ts +16 -2
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +12 -0
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +14 -1
- package/dist/toast.js +1 -1
- package/dist/{tooltip-NcLIeBy5.d.ts → tooltip-CpK3XTor.d.ts} +15 -8
- package/dist/tooltip.d.ts +6 -1
- package/dist/truncated-text.d.ts +27 -13
- package/dist/truncated-text.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/use-inert-siblings-CNmNuS2h.js +1 -0
- package/dist/use-swipe-to-dismiss-i__cTF2v.js +1 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/visually-hidden.d.ts +13 -0
- package/dist/well.d.ts +6 -1
- package/package.json +6 -6
- package/src/components/chart/d3-license.md +25 -0
- package/dist/alert-P9lwn25X.js +0 -1
- package/dist/button-Dge0D5bl.js +0 -1
- package/dist/chart-BpWfQAwf.js +0 -2
- package/dist/choice-2Lrv8_nl.js +0 -1
- package/dist/dialog-Dp0QGWwo.d.ts +0 -28
- package/dist/dropdown-menu-BHBzCDSZ.js +0 -1
- package/dist/input-CpQ6jlpI.js +0 -1
- package/dist/popover-C96V8SXi.d.ts +0 -1
- package/dist/select-CAAYk4Yj.js +0 -1
- package/dist/theme-C-glc5Q-.js +0 -1
- package/dist/use-swipe-to-dismiss-DceYk1Id.js +0 -1
package/dist/scatter-plot.d.ts
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Scatter Plot component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/charts/scatter-plot
|
|
5
|
+
*/
|
|
6
|
+
import { a as XAxisPrimitiveProps, c as LegendPrimitiveProps, d as ChartMode, h as ChartDatumEvent, i as ReferenceLinePrimitiveProps, l as CopyButtonPrimitiveProps, m as ChartDatum, n as ChartRootBaseProps, o as YAxisPrimitiveProps, r as GridPrimitiveProps, s as ChartListPrimitiveProps, t as TooltipPrimitiveProps, u as ChartAccessibilityProps, v as PointShape, y as SeriesColor } from "./chart-jitNqimS.js";
|
|
7
|
+
/**
|
|
8
|
+
* Props for {@link ScatterPlot.List}.
|
|
9
|
+
*/
|
|
10
|
+
type ScatterPlotListProps = ChartListPrimitiveProps;
|
|
2
11
|
/**
|
|
3
12
|
* Props for {@link ScatterPlot.Root}. Scatter x values must be continuous
|
|
4
13
|
* (numbers or `Date`s — there is no categorical scatter axis). Set `zKey` to
|
|
5
14
|
* switch the chart into the 3D projection: points render inside a rotatable
|
|
6
15
|
* cube (drag to orbit), depth-sorted with gentle perspective.
|
|
7
16
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
17
|
+
* Keep it to eight series or fewer: the top seven, plus an "Other" series in
|
|
18
|
+
* `"neutral"`. Scatter is an all-pairs chart form: any point can land next to a
|
|
19
|
+
* point from any other series, so every pair of series colors must stay apart.
|
|
20
|
+
* Mantle does not guarantee that any set of colors stays apart. To show more
|
|
21
|
+
* series, facet into small multiples.
|
|
11
22
|
*/
|
|
12
23
|
type ScatterPlotRootProps<TDatum extends ChartDatum = ChartDatum, TMode extends ChartMode = "interactive"> = Omit<ChartRootBaseProps, "stacked"> & ChartAccessibilityProps<TMode> & {
|
|
13
24
|
/** Rows of data; each row is one point per composed `ScatterPlot.Point` series. */
|
|
@@ -29,7 +40,9 @@ type ScatterPlotDepthProps<TDatum extends ChartDatum = ChartDatum> = {
|
|
|
29
40
|
* The key of each row's depth value. When set, the scatter renders in
|
|
30
41
|
* 3D: drag the plot to rotate the cube. Axis parts and reference lines
|
|
31
42
|
* apply to the 2D projection only and are ignored in 3D (the cube frame
|
|
32
|
-
* carries orientation). If no row has the key, the Root throws.
|
|
43
|
+
* carries orientation). If no row has the key, the Root throws. The 3D
|
|
44
|
+
* code loads when a Root with a `zKey` mounts, so a 2D scatter plot
|
|
45
|
+
* never downloads it.
|
|
33
46
|
*/
|
|
34
47
|
zKey: Extract<keyof TDatum, string>;
|
|
35
48
|
/**
|
|
@@ -57,35 +70,26 @@ type ScatterPlotPointProps = {
|
|
|
57
70
|
/** Display name for the legend, tooltip, and data table. Defaults to `dataKey`. */
|
|
58
71
|
label?: string;
|
|
59
72
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
73
|
+
* The color the series paints: a mantle color name, the same `Color` that
|
|
74
|
+
* `Badge` takes, or any CSS color. Required: name every series' color on
|
|
75
|
+
* purpose. Give an "Other" series `"neutral"`, and a series that means good
|
|
76
|
+
* or bad a functional color such as `"danger"`.
|
|
62
77
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
78
|
+
* A static CSS color (raw hex) cannot follow the two themes, so prefer a
|
|
79
|
+
* `var(--your-token)` declared per theme.
|
|
65
80
|
*
|
|
66
81
|
* @example
|
|
67
82
|
* ```tsx
|
|
68
|
-
* <ScatterPlot.Point dataKey="
|
|
83
|
+
* <ScatterPlot.Point dataKey="latency" label="Latency" color="blue" />
|
|
69
84
|
* ```
|
|
70
85
|
*/
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Override the color channel with a chart token or any CSS color. This does
|
|
74
|
-
* not change the series slot or its paired point shape. When omitted, the
|
|
75
|
-
* series paints the color from its slot.
|
|
76
|
-
*
|
|
77
|
-
* A static color (raw hex) cannot follow the two themes, so prefer a
|
|
78
|
-
* `var(--your-token)` declared per theme. A series that carries good/bad
|
|
79
|
-
* meaning should wear the semantic status colors, never a categorical slot.
|
|
80
|
-
*/
|
|
81
|
-
color?: SeriesColor;
|
|
86
|
+
color: SeriesColor;
|
|
82
87
|
/**
|
|
83
88
|
* The glyph this series' points wear, mirrored by the legend key and the
|
|
84
89
|
* hover dot: `"circle"`, `"square"`, `"triangle"`, `"diamond"`,
|
|
85
90
|
* `"triangle-down"`, `"plus"`, `"cross"`, or `"star"`. Shape is the
|
|
86
91
|
* redundant encoding that keeps overlapping clouds distinguishable without
|
|
87
|
-
* color vision.
|
|
88
|
-
* series slot, so both channels name one slot.
|
|
92
|
+
* color vision. Defaults to `"circle"`.
|
|
89
93
|
*/
|
|
90
94
|
shape?: PointShape;
|
|
91
95
|
};
|
|
@@ -127,7 +131,7 @@ type ScatterPlotCopyButtonProps = CopyButtonPrimitiveProps;
|
|
|
127
131
|
* 3D cube: drag to orbit, with points depth-sorted under gentle perspective.
|
|
128
132
|
*
|
|
129
133
|
* A Root mounts dormant: a shell of the plot, the named overlay, and its
|
|
130
|
-
* sr-only description. It builds its canvas
|
|
134
|
+
* sr-only description. It builds its canvas and its engine
|
|
131
135
|
* once it comes within one viewport of the visible area, takes focus, or
|
|
132
136
|
* prints (on-screen charts first, a few milliseconds at a time), and it mounts
|
|
133
137
|
* the sr-only data table once focus lands inside it. A list of charts pays
|
|
@@ -140,8 +144,9 @@ type ScatterPlotCopyButtonProps = CopyButtonPrimitiveProps;
|
|
|
140
144
|
* `scatter-plot-description`, and, once focus lands inside the chart,
|
|
141
145
|
* `scatter-plot-data-table`. A scatter plot shows one marker dot on the hit
|
|
142
146
|
* point, and never the crosshair or the band. The canvas and the three
|
|
143
|
-
* layers are engine-owned: absent from server HTML and from a dormant chart,
|
|
144
|
-
*
|
|
147
|
+
* layers are engine-owned: absent from server HTML and from a dormant chart. The canvas arrives at activation (near the viewport, on
|
|
148
|
+
* focus, or before print), and the layers arrive on the first hover or
|
|
149
|
+
* keyboard step. A
|
|
145
150
|
* static or decorative chart inserts the canvas alone. The
|
|
146
151
|
* tooltip surface mounts on the first hover or keyboard step and stays. That dot carries `chart-active-point` plus a `data-shape` of
|
|
147
152
|
* `"circle"`, `"square"`, `"triangle"`, `"diamond"`, `"triangle-down"`,
|
|
@@ -169,8 +174,8 @@ type ScatterPlotCopyButtonProps = CopyButtonPrimitiveProps;
|
|
|
169
174
|
* <ScatterPlot.Grid />
|
|
170
175
|
* <ScatterPlot.XAxis />
|
|
171
176
|
* <ScatterPlot.YAxis />
|
|
172
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
173
|
-
* <ScatterPlot.Point dataKey="throughputB" label="Region B" />
|
|
177
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
178
|
+
* <ScatterPlot.Point dataKey="throughputB" label="Region B" color="emerald" />
|
|
174
179
|
* <ScatterPlot.Tooltip />
|
|
175
180
|
* <ScatterPlot.Legend />
|
|
176
181
|
* </ScatterPlot.Root>
|
|
@@ -190,8 +195,8 @@ declare const Root: <TDatum extends ChartDatum = ChartDatum, TMode extends Chart
|
|
|
190
195
|
* <ScatterPlot.Grid />
|
|
191
196
|
* <ScatterPlot.XAxis />
|
|
192
197
|
* <ScatterPlot.YAxis />
|
|
193
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
194
|
-
* <ScatterPlot.Point dataKey="throughputB" label="Region B" />
|
|
198
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
199
|
+
* <ScatterPlot.Point dataKey="throughputB" label="Region B" color="emerald" />
|
|
195
200
|
* <ScatterPlot.Tooltip />
|
|
196
201
|
* <ScatterPlot.Legend />
|
|
197
202
|
* </ScatterPlot.Root>
|
|
@@ -211,7 +216,7 @@ declare const Point: (props: ScatterPlotPointProps) => null;
|
|
|
211
216
|
* <ScatterPlot.Grid lines="both" />
|
|
212
217
|
* <ScatterPlot.XAxis />
|
|
213
218
|
* <ScatterPlot.YAxis />
|
|
214
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
219
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
215
220
|
* <ScatterPlot.Legend />
|
|
216
221
|
* </ScatterPlot.Root>
|
|
217
222
|
* ```
|
|
@@ -229,7 +234,7 @@ declare const Grid: (props: ScatterPlotGridProps) => null;
|
|
|
229
234
|
* <ScatterPlot.Grid />
|
|
230
235
|
* <ScatterPlot.XAxis tickFormat={(value) => `${value}ms`} />
|
|
231
236
|
* <ScatterPlot.YAxis />
|
|
232
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
237
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
233
238
|
* <ScatterPlot.Legend />
|
|
234
239
|
* </ScatterPlot.Root>
|
|
235
240
|
* ```
|
|
@@ -247,7 +252,7 @@ declare const XAxis: (props: ScatterPlotXAxisProps) => null;
|
|
|
247
252
|
* <ScatterPlot.Grid />
|
|
248
253
|
* <ScatterPlot.XAxis />
|
|
249
254
|
* <ScatterPlot.YAxis tickFormat={(value) => `${value / 1000}k`} />
|
|
250
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
255
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
251
256
|
* <ScatterPlot.Legend />
|
|
252
257
|
* </ScatterPlot.Root>
|
|
253
258
|
* ```
|
|
@@ -265,7 +270,7 @@ declare const YAxis: (props: ScatterPlotYAxisProps) => null;
|
|
|
265
270
|
* <ScatterPlot.Grid />
|
|
266
271
|
* <ScatterPlot.XAxis />
|
|
267
272
|
* <ScatterPlot.YAxis />
|
|
268
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
273
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
269
274
|
* <ScatterPlot.ReferenceLine y={500} label="Target" />
|
|
270
275
|
* <ScatterPlot.Legend />
|
|
271
276
|
* </ScatterPlot.Root>
|
|
@@ -297,7 +302,7 @@ declare const ReferenceLine: (props: ScatterPlotReferenceLineProps) => null;
|
|
|
297
302
|
* @example
|
|
298
303
|
* ```tsx
|
|
299
304
|
* <ScatterPlot.Root data={data} xKey="latency" aria-label="Latency vs throughput">
|
|
300
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
305
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
301
306
|
* <ScatterPlot.Tooltip valueFormat={(value) => `${value} rps`} />
|
|
302
307
|
* <ScatterPlot.Legend />
|
|
303
308
|
* </ScatterPlot.Root>
|
|
@@ -323,15 +328,15 @@ declare const Tooltip: (props: ScatterPlotTooltipProps) => null;
|
|
|
323
328
|
* | --- | --- | --- |
|
|
324
329
|
* | `data-slot` | `"scatter-plot-legend"` | The legend list. `ScatterPlot.Legend` renders it in flow below the plot. |
|
|
325
330
|
* | `data-slot` | `"scatter-plot-legend-label"` | On the `<div>` wrapping a `children` render prop. The default legend has none. |
|
|
326
|
-
* | `data-shape` | `"circle"` \| `"square"` \| `"triangle"` \| `"diamond"` \| `"triangle-down"` \| `"plus"` \| `"cross"` \| `"star"` | On each series' swatch, naming the glyph its `ScatterPlot.Point` wears — the `shape` it set, else the
|
|
331
|
+
* | `data-shape` | `"circle"` \| `"square"` \| `"triangle"` \| `"diamond"` \| `"triangle-down"` \| `"plus"` \| `"cross"` \| `"star"` | On each series' swatch, naming the glyph its `ScatterPlot.Point` wears — the `shape` it set, else the circle. The swatch clips itself to that glyph, so target this only to restyle a key. |
|
|
327
332
|
*
|
|
328
333
|
* @see https://mantle.ngrok.com/components/charts/scatter-plot#scatterplotlegend
|
|
329
334
|
*
|
|
330
335
|
* @example
|
|
331
336
|
* ```tsx
|
|
332
337
|
* <ScatterPlot.Root data={data} xKey="latency" aria-label="Latency vs throughput">
|
|
333
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
334
|
-
* <ScatterPlot.Point dataKey="throughputB" label="Region B" />
|
|
338
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
339
|
+
* <ScatterPlot.Point dataKey="throughputB" label="Region B" color="emerald" />
|
|
335
340
|
* <ScatterPlot.Tooltip />
|
|
336
341
|
* <ScatterPlot.Legend />
|
|
337
342
|
* </ScatterPlot.Root>
|
|
@@ -351,14 +356,40 @@ declare const Legend: (props: ScatterPlotLegendProps) => import("react").JSX.Ele
|
|
|
351
356
|
* @example
|
|
352
357
|
* ```tsx
|
|
353
358
|
* <ScatterPlot.Root data={data} xKey="latency" aria-label="Latency vs throughput">
|
|
354
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
355
|
-
* <ScatterPlot.Point dataKey="throughputB" label="Region B" />
|
|
359
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
360
|
+
* <ScatterPlot.Point dataKey="throughputB" label="Region B" color="emerald" />
|
|
356
361
|
* <ScatterPlot.Legend />
|
|
357
362
|
* <ScatterPlot.CopyButton />
|
|
358
363
|
* </ScatterPlot.Root>
|
|
359
364
|
* ```
|
|
360
365
|
*/
|
|
361
366
|
declare const CopyButton: (props: ScatterPlotCopyButtonProps) => import("react").JSX.Element;
|
|
367
|
+
/**
|
|
368
|
+
* Groups a list of charts, such as one chart per card, so they share one
|
|
369
|
+
* `role="status"` live region. A page of 100 charts mounts one region instead
|
|
370
|
+
* of one per chart, plus one for each `ScatterPlot.CopyButton`. Each chart
|
|
371
|
+
* keeps its own tooltip, description, and data table.
|
|
372
|
+
*
|
|
373
|
+
* Renders a `div` (`scatter-plot-list`) that holds the charts in a `display: contents`
|
|
374
|
+
* wrapper (`scatter-plot-list-items`), so a grid or flex layout on the List reaches
|
|
375
|
+
* the cards, and the live region as its last child. No `asChild`: a list
|
|
376
|
+
* element such as `ul` cannot hold the live region as a child.
|
|
377
|
+
*
|
|
378
|
+
* @see https://mantle.ngrok.com/components/charts/scatter-plot#scatterplotlist
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
* ```tsx
|
|
382
|
+
* <ScatterPlot.List>
|
|
383
|
+
* {agents.map((agent) => (
|
|
384
|
+
* <ScatterPlot.Root key={agent.id} data={agent.rows} xKey="latency" aria-label={agent.name}>
|
|
385
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
386
|
+
* <ScatterPlot.Tooltip />
|
|
387
|
+
* </ScatterPlot.Root>
|
|
388
|
+
* ))}
|
|
389
|
+
* </ScatterPlot.List>
|
|
390
|
+
* ```
|
|
391
|
+
*/
|
|
392
|
+
declare const List: (props: ScatterPlotListProps) => import("react").JSX.Element;
|
|
362
393
|
/**
|
|
363
394
|
* A canvas-rendered scatter plot for correlating two measures — three with
|
|
364
395
|
* the 3D projection (`zKey`), which renders a rotatable, depth-sorted point
|
|
@@ -366,24 +397,31 @@ declare const CopyButton: (props: ScatterPlotCopyButtonProps) => import("react")
|
|
|
366
397
|
* stepping, polite announcements, and the sr-only description ship with
|
|
367
398
|
* `Root` unconditionally. A Root builds and paints its canvas once it comes
|
|
368
399
|
* within one viewport of the visible area, takes focus, or prints, and it mounts
|
|
369
|
-
* its sr-only data table once focus lands inside it.
|
|
370
|
-
*
|
|
371
|
-
*
|
|
400
|
+
* its sr-only data table once focus lands inside it. Keep it to eight series
|
|
401
|
+
* or fewer: the top seven, plus an "Other" series in `"neutral"`. Scatter is
|
|
402
|
+
* an all-pairs chart form, and mantle does not guarantee that any set of
|
|
403
|
+
* colors stays apart.
|
|
372
404
|
*
|
|
373
405
|
* **CSS variables (public API):**
|
|
374
406
|
*
|
|
375
407
|
* | CSS Variable | Default | Description |
|
|
376
408
|
* | --- | --- | --- |
|
|
377
|
-
* | `--color-chart
|
|
378
|
-
* | `--color-chart-other` | `--color-neutral-500` | The neutral overflow slot a series wears once every slot is held. |
|
|
409
|
+
* | `--color-chart-<name>` | per theme | The color a series with `color="<name>"` paints. Every mantle color name has one: the 600 step of its hue in light mode, and the 500 step in dark mode. Most names reach 3:1 contrast on the card surface, and the docs page lists the names that do not. |
|
|
379
410
|
*
|
|
380
411
|
* Two ways to change a series color, both public API. The `color` prop on
|
|
381
|
-
* `ScatterPlot.Point`
|
|
382
|
-
* redeclare its token on `Root
|
|
383
|
-
* `className="[--color-chart-
|
|
412
|
+
* `ScatterPlot.Point` takes a color name or any CSS color. To restyle a color name for one chart,
|
|
413
|
+
* redeclare its token on `Root`:
|
|
414
|
+
* `className="[--color-chart-blue:var(--color-brand)]"`. The engine resolves every
|
|
384
415
|
* token from `Root`'s computed style, so a declaration scoped there wins for
|
|
385
416
|
* that chart and leaves every other chart on the page alone.
|
|
386
417
|
*
|
|
418
|
+
* @useWhen Show how two measures correlate across many points, or three measures in a rotatable 3D
|
|
419
|
+
* view.
|
|
420
|
+
*
|
|
421
|
+
* @siblings
|
|
422
|
+
* - `LineChart`: one measure trends across an ordered x axis, such as time.
|
|
423
|
+
* - `BarChart`: values compare across categories.
|
|
424
|
+
*
|
|
387
425
|
* @see https://mantle.ngrok.com/components/charts/scatter-plot
|
|
388
426
|
*
|
|
389
427
|
* @example
|
|
@@ -400,6 +438,12 @@ declare const CopyButton: (props: ScatterPlotCopyButtonProps) => import("react")
|
|
|
400
438
|
* └── ScatterPlot.CopyButton
|
|
401
439
|
* ```
|
|
402
440
|
*
|
|
441
|
+
* A List groups Roots:
|
|
442
|
+
* ```
|
|
443
|
+
* ScatterPlot.List
|
|
444
|
+
* └── ScatterPlot.Root (one per chart)
|
|
445
|
+
* ```
|
|
446
|
+
*
|
|
403
447
|
* @example
|
|
404
448
|
* ```tsx
|
|
405
449
|
* const data = [
|
|
@@ -412,8 +456,8 @@ declare const CopyButton: (props: ScatterPlotCopyButtonProps) => import("react")
|
|
|
412
456
|
* <ScatterPlot.Grid />
|
|
413
457
|
* <ScatterPlot.XAxis />
|
|
414
458
|
* <ScatterPlot.YAxis />
|
|
415
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
416
|
-
* <ScatterPlot.Point dataKey="throughputB" label="Region B" />
|
|
459
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
460
|
+
* <ScatterPlot.Point dataKey="throughputB" label="Region B" color="emerald" />
|
|
417
461
|
* <ScatterPlot.Tooltip />
|
|
418
462
|
* <ScatterPlot.Legend />
|
|
419
463
|
* </ScatterPlot.Root>
|
|
@@ -433,8 +477,8 @@ declare const ScatterPlot: {
|
|
|
433
477
|
* <ScatterPlot.Grid />
|
|
434
478
|
* <ScatterPlot.XAxis />
|
|
435
479
|
* <ScatterPlot.YAxis />
|
|
436
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
437
|
-
* <ScatterPlot.Point dataKey="throughputB" label="Region B" />
|
|
480
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
481
|
+
* <ScatterPlot.Point dataKey="throughputB" label="Region B" color="emerald" />
|
|
438
482
|
* <ScatterPlot.Tooltip />
|
|
439
483
|
* <ScatterPlot.Legend />
|
|
440
484
|
* </ScatterPlot.Root>
|
|
@@ -452,8 +496,8 @@ declare const ScatterPlot: {
|
|
|
452
496
|
* <ScatterPlot.Grid />
|
|
453
497
|
* <ScatterPlot.XAxis />
|
|
454
498
|
* <ScatterPlot.YAxis />
|
|
455
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
456
|
-
* <ScatterPlot.Point dataKey="throughputB" label="Region B" />
|
|
499
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
500
|
+
* <ScatterPlot.Point dataKey="throughputB" label="Region B" color="emerald" />
|
|
457
501
|
* <ScatterPlot.Tooltip />
|
|
458
502
|
* <ScatterPlot.Legend />
|
|
459
503
|
* </ScatterPlot.Root>
|
|
@@ -471,7 +515,7 @@ declare const ScatterPlot: {
|
|
|
471
515
|
* <ScatterPlot.Grid lines="both" />
|
|
472
516
|
* <ScatterPlot.XAxis />
|
|
473
517
|
* <ScatterPlot.YAxis />
|
|
474
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
518
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
475
519
|
* <ScatterPlot.Tooltip />
|
|
476
520
|
* <ScatterPlot.Legend />
|
|
477
521
|
* </ScatterPlot.Root>
|
|
@@ -489,7 +533,7 @@ declare const ScatterPlot: {
|
|
|
489
533
|
* <ScatterPlot.Grid />
|
|
490
534
|
* <ScatterPlot.XAxis tickFormat={(value) => `${value}ms`} />
|
|
491
535
|
* <ScatterPlot.YAxis />
|
|
492
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
536
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
493
537
|
* <ScatterPlot.Tooltip />
|
|
494
538
|
* <ScatterPlot.Legend />
|
|
495
539
|
* </ScatterPlot.Root>
|
|
@@ -507,7 +551,7 @@ declare const ScatterPlot: {
|
|
|
507
551
|
* <ScatterPlot.Grid />
|
|
508
552
|
* <ScatterPlot.XAxis />
|
|
509
553
|
* <ScatterPlot.YAxis tickFormat={(value) => `${value / 1000}k`} />
|
|
510
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
554
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
511
555
|
* <ScatterPlot.Tooltip />
|
|
512
556
|
* <ScatterPlot.Legend />
|
|
513
557
|
* </ScatterPlot.Root>
|
|
@@ -525,7 +569,7 @@ declare const ScatterPlot: {
|
|
|
525
569
|
* <ScatterPlot.Grid />
|
|
526
570
|
* <ScatterPlot.XAxis />
|
|
527
571
|
* <ScatterPlot.YAxis />
|
|
528
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
572
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
529
573
|
* <ScatterPlot.ReferenceLine y={500} label="Target" />
|
|
530
574
|
* <ScatterPlot.Tooltip />
|
|
531
575
|
* <ScatterPlot.Legend />
|
|
@@ -544,7 +588,7 @@ declare const ScatterPlot: {
|
|
|
544
588
|
* <ScatterPlot.Grid />
|
|
545
589
|
* <ScatterPlot.XAxis />
|
|
546
590
|
* <ScatterPlot.YAxis />
|
|
547
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
591
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
548
592
|
* <ScatterPlot.Tooltip valueFormat={(value) => `${value} rps`} />
|
|
549
593
|
* <ScatterPlot.Legend />
|
|
550
594
|
* </ScatterPlot.Root>
|
|
@@ -563,8 +607,8 @@ declare const ScatterPlot: {
|
|
|
563
607
|
* <ScatterPlot.Grid />
|
|
564
608
|
* <ScatterPlot.XAxis />
|
|
565
609
|
* <ScatterPlot.YAxis />
|
|
566
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
567
|
-
* <ScatterPlot.Point dataKey="throughputB" label="Region B" />
|
|
610
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
611
|
+
* <ScatterPlot.Point dataKey="throughputB" label="Region B" color="emerald" />
|
|
568
612
|
* <ScatterPlot.Tooltip />
|
|
569
613
|
* <ScatterPlot.Legend />
|
|
570
614
|
* </ScatterPlot.Root>
|
|
@@ -579,13 +623,31 @@ declare const ScatterPlot: {
|
|
|
579
623
|
* @example
|
|
580
624
|
* ```tsx
|
|
581
625
|
* <ScatterPlot.Root data={data} xKey="latency" aria-label="Latency vs throughput">
|
|
582
|
-
* <ScatterPlot.Point dataKey="throughputA" label="Region A" />
|
|
583
|
-
* <ScatterPlot.Point dataKey="throughputB" label="Region B" />
|
|
626
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
627
|
+
* <ScatterPlot.Point dataKey="throughputB" label="Region B" color="emerald" />
|
|
584
628
|
* <ScatterPlot.Legend />
|
|
585
629
|
* <ScatterPlot.CopyButton />
|
|
586
630
|
* </ScatterPlot.Root>
|
|
587
631
|
* ```
|
|
588
632
|
*/
|
|
589
633
|
readonly CopyButton: typeof CopyButton;
|
|
634
|
+
/**
|
|
635
|
+
* Groups a list of charts so they share one live region.
|
|
636
|
+
*
|
|
637
|
+
* @see https://mantle.ngrok.com/components/charts/scatter-plot#scatterplotlist
|
|
638
|
+
*
|
|
639
|
+
* @example
|
|
640
|
+
* ```tsx
|
|
641
|
+
* <ScatterPlot.List>
|
|
642
|
+
* {agents.map((agent) => (
|
|
643
|
+
* <ScatterPlot.Root key={agent.id} data={agent.rows} xKey="latency" aria-label={agent.name}>
|
|
644
|
+
* <ScatterPlot.Point dataKey="throughputA" label="Region A" color="blue" />
|
|
645
|
+
* <ScatterPlot.Tooltip />
|
|
646
|
+
* </ScatterPlot.Root>
|
|
647
|
+
* ))}
|
|
648
|
+
* </ScatterPlot.List>
|
|
649
|
+
* ```
|
|
650
|
+
*/
|
|
651
|
+
readonly List: typeof List;
|
|
590
652
|
};
|
|
591
|
-
export { type ChartDatumEvent, type ChartMode, ScatterPlot, type ScatterPlotCopyButtonProps, type ScatterPlotGridProps, type ScatterPlotLegendProps, type ScatterPlotPointProps, type ScatterPlotReferenceLineProps, type ScatterPlotRootProps, type ScatterPlotTooltipProps, type ScatterPlotXAxisProps, type ScatterPlotYAxisProps };
|
|
653
|
+
export { type ChartDatumEvent, type ChartMode, ScatterPlot, type ScatterPlotCopyButtonProps, type ScatterPlotGridProps, type ScatterPlotLegendProps, type ScatterPlotListProps, type ScatterPlotPointProps, type ScatterPlotReferenceLineProps, type ScatterPlotRootProps, type ScatterPlotTooltipProps, type ScatterPlotXAxisProps, type ScatterPlotYAxisProps };
|
package/dist/scatter-plot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{_ as e,a as t,c as n,d as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"./chart-DudCw24t.js";import{n as f,r as p}from"./chart-CE5Uaqz9.js";import{c as m}from"react/compiler-runtime";import{useEffect as h}from"react";import{jsx as g}from"react/jsx-runtime";const _=/* @__PURE__ */ new WeakMap,v=e=>{let t=_.get(e);return(t==null||t.parentNode!==e)&&(t=e.ownerDocument.createElement(`span`),t.style.display=`none`,t.setAttribute(`aria-hidden`,`true`),e.appendChild(t),_.set(e,t)),t},y=(e,t)=>{let n=v(e);return n.style.color=t,e.ownerDocument.defaultView?.getComputedStyle(n).color??``},b=/* @__PURE__ */ new WeakMap,x=e=>{let t=b.get(e);if(t!==void 0)return t;let n=e.createElement(`canvas`);n.width=1,n.height=1;let r=n.getContext(`2d`);return b.set(e,r),r},S=[`#010203`,`#030201`],C=/* @__PURE__ */ new WeakMap,w=(e,t)=>{let n=C.get(e);n??(n=/* @__PURE__ */ new Map,C.set(e,n));let r=n.get(t);if(r!=null)return r;let i=!1;for(let n of S)if(e.fillStyle=n,e.fillStyle=t,e.fillStyle!==n){i=!0;break}return n.set(t,i),i},T=/^var\(\s*(--[\w-]+)\s*\)$/i,E=/var\(|currentcolor|light-dark\(/i,D=(e,t)=>{let{computed:n,parseContext:r}=t,i=/* @__PURE__ */ new Map;return{resolve:t=>{let a=i.get(t);if(a!=null)return a;let o=t.trim(),s=T.exec(o),c;c=s?.[1]==null?o.toLowerCase()===`currentcolor`?n.color:o:n.getPropertyValue(s[1]).trim();let l;return l=c===``||E.test(c)?y(e,o):r==null||w(r,c)?c:y(e,o),i.set(t,l),l},fontFamily:n.fontFamily||`sans-serif`}},O=(e,t)=>e.resolve(i(t)),k=e=>({grid:e.resolve(c.grid),baseline:e.resolve(c.baseline),tickText:e.resolve(c.tickText),reference:e.resolve(c.reference),surface:e.resolve(c.surface)}),A=e=>`${e.className}|${e.getAttribute(`data-applied-theme`)??``}|${e.getAttribute(`data-theme`)??``}`,j=/* @__PURE__ */ new WeakMap,M=(e,t)=>{let n=j.get(e);if(n==null){let t=/* @__PURE__ */ new Set,r={observer:new MutationObserver(()=>{let n=A(e);if(n!==r.signature){r.signature=n;for(let e of t)e()}}),listeners:t,signature:A(e)};r.observer.observe(e,{attributes:!0,attributeFilter:[`class`,`data-applied-theme`,`data-theme`]}),j.set(e,r),n=r}return n.listeners.add(t),()=>{n.listeners.delete(t),n.listeners.size===0&&(n.observer.disconnect(),j.delete(e))}};var N=class{kind=`canvas`;element;#e;#t;#n=null;#r=!1;#i;constructor({root:e,plot:t,slotName:n,onColorsChange:r}){this.#e=e,this.#t=t;let i=e.ownerDocument.createElement(`canvas`);i.setAttribute(`data-slot`,`${n}-canvas`),i.setAttribute(`aria-hidden`,`true`),i.style.position=`absolute`,i.style.inset=`0`,i.style.width=`100%`,i.style.height=`100%`,this.element=i,this.#i=M(e.ownerDocument.documentElement,r)}#a(){return this.#r||(this.#r=!0,this.#n=this.element.getContext(`2d`)),this.#n}paintSignature(){return A(this.#e.ownerDocument.documentElement)}resolvePaint({series:e,signature:t}){let n=this.#e.ownerDocument.defaultView;if(n==null)return null;let r=D(this.#t,{computed:n.getComputedStyle(this.#e),parseContext:x(this.#e.ownerDocument)}),i=/* @__PURE__ */ new Map,a=/* @__PURE__ */ new Map;for(let t of e)i.set(t.dataKey,O(r,t.colorInput)),a.set(t.dataKey,`${t.colorInput}|${t.texture}`);return{signature:t,series:i,inputs:a,barFills:/* @__PURE__ */ new Map,chrome:k(r),fontFamily:()=>r.fontFamily,resolve:e=>O(r,e)}}measureContext(){return this.#a()}begin({cssWidth:e,cssHeight:t,devicePixelRatio:n}){let r=this.#a();if(r==null)return null;let i=this.element,a=Math.round(e*n),o=Math.round(t*n);return(i.width!==a||i.height!==o)&&(i.width=a,i.height=o),r.setTransform(n,0,0,n,0,0),r.clearRect(0,0,e,t),r}composite(e,t){let{underlay:n,marks:r,fade:i}=t,a=this.#n;if(i==null||a==null){n(),r();return}r(),a.save(),a.globalCompositeOperation=`destination-out`;let o=a.createLinearGradient(i.left,0,i.left+i.width,0);o.addColorStop(0,`rgba(0, 0, 0, ${i.alpha})`),o.addColorStop(1,`rgba(0, 0, 0, 0)`),a.fillStyle=o,a.fillRect(i.left,i.top,i.width,i.height),a.globalCompositeOperation=`destination-over`,n(),a.restore()}end(){}release(){let e=this.element;(e.width!==0||e.height!==0)&&(e.width=0,e.height=0)}destroy(){this.#i()}};const P=Object.assign(e=>new N(e),{kind:`canvas`}),F={Root:e=>{let t=m(5),n=e.zKey!=null,r,i;t[0]===n?(r=t[1],i=t[2]):(r=()=>{n&&p().catch(I)},i=[n],t[0]=n,t[1]=r,t[2]=i),h(r,i);let a;return t[3]===e?a=t[4]:(a=/* @__PURE__ */ g(u,{kind:`scatter`,componentName:`ScatterPlot`,slotName:`scatter-plot`,paintBackend:P,scatterView:f,...e}),t[3]=e,t[4]=a),a},Point:e=>l(`ScatterPlot.Point`,`scatter`,e),Grid:e=>t(`ScatterPlot.Grid`,e),XAxis:e=>n(`ScatterPlot.XAxis`,e),YAxis:e=>a(`ScatterPlot.YAxis`,e),ReferenceLine:e=>s(`ScatterPlot.ReferenceLine`,e),Tooltip:e=>o(`ScatterPlot.Tooltip`,e),Legend:e=>{let t=m(2),n;return t[0]===e?n=t[1]:(n=/* @__PURE__ */ g(r,{partName:`ScatterPlot.Legend`,slotName:`scatter-plot`,...e}),t[0]=e,t[1]=n),n},CopyButton:t=>{let n=m(2),r;return n[0]===t?r=n[1]:(r=/* @__PURE__ */ g(e,{partName:`ScatterPlot.CopyButton`,slotName:`scatter-plot`,...t}),n[0]=t,n[1]=r),r},List:e=>{let t=m(2),n;return t[0]===e?n=t[1]:(n=/* @__PURE__ */ g(d,{slotName:`scatter-plot-list`,...e}),t[0]=e,t[1]=n),n}};function I(){}export{F as ScatterPlot};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Segmented Control component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/forms/segmented-control
|
|
5
|
+
*/
|
|
6
|
+
import { r as RootProps, t as ItemProps } from "./radio-group-sLz5AA9I.js";
|
|
7
|
+
/**
|
|
8
|
+
* The props of `SegmentedControl.Root`: the same props as `RadioGroup.Root`,
|
|
9
|
+
* including `value`, `defaultValue`, `onChange`, `name`, `form`, and
|
|
10
|
+
* `disabled`.
|
|
11
|
+
*/
|
|
12
|
+
type SegmentedControlRootProps = RootProps;
|
|
13
|
+
/**
|
|
14
|
+
* The props of `SegmentedControl.Item`: the same props as `RadioGroup.Item`,
|
|
15
|
+
* including `value` and `disabled`.
|
|
16
|
+
*/
|
|
17
|
+
type SegmentedControlItemProps = ItemProps;
|
|
18
|
+
/**
|
|
19
|
+
* A row of segments, one checked at a time, on a dim track. A raised thumb
|
|
20
|
+
* slides to the checked `SegmentedControl.Item`. It is a radio group: it
|
|
21
|
+
* renders `role="radiogroup"`, arrow keys move the checked item, and with a
|
|
22
|
+
* `name` it submits its value in a form.
|
|
23
|
+
*
|
|
24
|
+
* Name it with `aria-label`, or with `aria-labelledby` that points at a
|
|
25
|
+
* visible label. A mouse or a finger can drag the thumb. A sideways drag on
|
|
26
|
+
* the checked item moves the thumb with the pointer. On release, the thumb
|
|
27
|
+
* slides to the nearest enabled item, and that item becomes checked. A flick
|
|
28
|
+
* carries the thumb further.
|
|
29
|
+
*
|
|
30
|
+
* | Data Attribute | Value | Description |
|
|
31
|
+
* | --------------- | --------------------- | --------------------------------------------------- |
|
|
32
|
+
* | `data-dragging` | present during a drag | The thumb follows the pointer. Presence-only. |
|
|
33
|
+
*
|
|
34
|
+
* @see https://mantle.ngrok.com/components/forms/segmented-control#segmentedcontrolroot
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <SegmentedControl.Root aria-label="Environment" defaultValue="production">
|
|
39
|
+
* <SegmentedControl.Item value="development">Dev</SegmentedControl.Item>
|
|
40
|
+
* <SegmentedControl.Item value="staging">Staging</SegmentedControl.Item>
|
|
41
|
+
* <SegmentedControl.Item value="production">Prod</SegmentedControl.Item>
|
|
42
|
+
* </SegmentedControl.Root>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare const Root: ({ "data-slot": dataSlot, className, ref, style, ...props }: SegmentedControlRootProps) => import("react").JSX.Element;
|
|
46
|
+
/**
|
|
47
|
+
* One segment of a `SegmentedControl.Root`: a `role="radio"` item that grows
|
|
48
|
+
* to share the row and keeps its label on one line. Keep the label to one or
|
|
49
|
+
* two words. An icon-only item needs its name in `sr-only` text or
|
|
50
|
+
* `aria-label`.
|
|
51
|
+
*
|
|
52
|
+
* Inside `Field.Control`, the item picks up `aria-invalid`,
|
|
53
|
+
* `aria-errormessage`, and `aria-describedby`.
|
|
54
|
+
*
|
|
55
|
+
* | Data Attribute | Value | Description |
|
|
56
|
+
* | ----------------- | --------------------- | ------------------------------------------- |
|
|
57
|
+
* | `data-thumb-over` | present during a drag | The thumb is over this item. Presence-only. |
|
|
58
|
+
*
|
|
59
|
+
* @see https://mantle.ngrok.com/components/forms/segmented-control#segmentedcontrolitem
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```tsx
|
|
63
|
+
* <SegmentedControl.Root aria-label="Environment" defaultValue="production">
|
|
64
|
+
* <SegmentedControl.Item value="development">Dev</SegmentedControl.Item>
|
|
65
|
+
* <SegmentedControl.Item value="staging">Staging</SegmentedControl.Item>
|
|
66
|
+
* <SegmentedControl.Item value="production">Prod</SegmentedControl.Item>
|
|
67
|
+
* </SegmentedControl.Root>
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
declare const Item: ({ "data-slot": dataSlot, className, ref, ...props }: SegmentedControlItemProps) => import("react").JSX.Element;
|
|
71
|
+
/**
|
|
72
|
+
* A row of segments that switches between a few short options, like a view
|
|
73
|
+
* or an environment. A raised thumb slides to the checked item,
|
|
74
|
+
* and a mouse or a finger can drag it. It is a radio group underneath, with
|
|
75
|
+
* the same keyboard, ARIA, and form contract as `RadioGroup`.
|
|
76
|
+
*
|
|
77
|
+
* @useWhen Switch between a few short options, like a view or an environment, in one row.
|
|
78
|
+
*
|
|
79
|
+
* @siblings
|
|
80
|
+
* - `RadioGroup`: a form field whose options need a description, or stack in a column.
|
|
81
|
+
* - `Tabs`: each option shows its own panel of content.
|
|
82
|
+
* - `Select`: the set is long, or the row has little space.
|
|
83
|
+
*
|
|
84
|
+
* @see https://mantle.ngrok.com/components/forms/segmented-control
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* Composition:
|
|
88
|
+
* ```
|
|
89
|
+
* SegmentedControl.Root
|
|
90
|
+
* └── SegmentedControl.Item
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```tsx
|
|
95
|
+
* <SegmentedControl.Root aria-label="Environment" defaultValue="production">
|
|
96
|
+
* <SegmentedControl.Item value="development">Dev</SegmentedControl.Item>
|
|
97
|
+
* <SegmentedControl.Item value="staging">Staging</SegmentedControl.Item>
|
|
98
|
+
* <SegmentedControl.Item value="production">Prod</SegmentedControl.Item>
|
|
99
|
+
* </SegmentedControl.Root>
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
declare const SegmentedControl: {
|
|
103
|
+
/**
|
|
104
|
+
* One segment of a `SegmentedControl.Root`: a `role="radio"` item that grows
|
|
105
|
+
* to share the row and keeps its label on one line.
|
|
106
|
+
*
|
|
107
|
+
* @see https://mantle.ngrok.com/components/forms/segmented-control#segmentedcontrolitem
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```tsx
|
|
111
|
+
* <SegmentedControl.Root aria-label="Environment" defaultValue="production">
|
|
112
|
+
* <SegmentedControl.Item value="development">Dev</SegmentedControl.Item>
|
|
113
|
+
* <SegmentedControl.Item value="staging">Staging</SegmentedControl.Item>
|
|
114
|
+
* <SegmentedControl.Item value="production">Prod</SegmentedControl.Item>
|
|
115
|
+
* </SegmentedControl.Root>
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
readonly Item: typeof Item;
|
|
119
|
+
/**
|
|
120
|
+
* A row of segments, one checked at a time, on a dim track. A raised thumb
|
|
121
|
+
* slides to the checked `SegmentedControl.Item`.
|
|
122
|
+
*
|
|
123
|
+
* @see https://mantle.ngrok.com/components/forms/segmented-control#segmentedcontrolroot
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```tsx
|
|
127
|
+
* <SegmentedControl.Root aria-label="Environment" defaultValue="production">
|
|
128
|
+
* <SegmentedControl.Item value="development">Dev</SegmentedControl.Item>
|
|
129
|
+
* <SegmentedControl.Item value="staging">Staging</SegmentedControl.Item>
|
|
130
|
+
* <SegmentedControl.Item value="production">Prod</SegmentedControl.Item>
|
|
131
|
+
* </SegmentedControl.Root>
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
readonly Root: typeof Root;
|
|
135
|
+
};
|
|
136
|
+
export { SegmentedControl };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./css-properties-D85fCNV3.js";import{n as t}from"./compose-refs-sFdxsL7k.js";import{t as n}from"./cx-CK7o_rVv.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{r as i,t as a}from"./radio-group-jj2abc0t.js";import{t as o}from"./use-swipe-to-dismiss-i__cTF2v.js";import{t as s}from"./use-prefers-reduced-motion-CU6mWmOe.js";import{c}from"react/compiler-runtime";import{createContext as l,useContext as u,useEffect as d,useId as f,useRef as p}from"react";import m from"tiny-invariant";import{jsx as h}from"react/jsx-runtime";const g=`--_segmented-control-thumb-offset`;function _(e,t){let n=-1,r=1/0;for(let[i,a]of e.entries()){let e=Math.abs((a.left+a.right)/2-t);!a.disabled&&e<r&&(n=i,r=e)}return n}function v({travel:e,min:t,max:n,give:r}){return e<t?t-o(t-e,r):e>n?n+o(e-n,r):e}function y(e){let t=c(3),n,r;t[0]===e?(n=t[1],r=t[2]):(n=()=>{let t=e.current;if(t==null)return;let n=null,r=!1,i=null,a=()=>t.querySelector(`:scope > [role='radio'][aria-checked='true']`),o=()=>Number.parseFloat(getComputedStyle(t,`::before`).translate)||0,c=e=>{i?.cancel(),i=null;let n=a();if(n==null||s())return;let r=e-n.getBoundingClientRect().left;Math.abs(r)<.5||(i=t.animate([{translate:`${r}px 0`},{translate:`0 0`}],{duration:200,easing:`cubic-bezier(0.23, 1, 0.32, 1)`,pseudoElement:`::before`}))},l=(e,n)=>{let r=n.getBoundingClientRect(),i=e.checkedLeft-r.left;e.checked=n,e.checkedLeft=r.left,e.checkedRight=r.right,e.base+=i,e.offset+=i,t.style.setProperty(g,`${e.offset}px`)},u=a(),d=new MutationObserver(()=>{let e=a();if(e===u)return;let t=u;u=e,n?.dragging?e!=null&&l(n,e):(n!=null&&p(),t?.isConnected&&c(t.getBoundingClientRect().left+o()))});d.observe(t,{attributeFilter:[`aria-checked`],subtree:!0});let f=e=>{t.removeAttribute(`data-dragging`),t.style.removeProperty(g);for(let t of e.segments)t.removeAttribute(`data-thumb-over`)},p=()=>{document.removeEventListener(`pointermove`,h),document.removeEventListener(`pointerup`,y),document.removeEventListener(`pointercancel`,y),n=null},m=e=>{if(!e.isPrimary||e.button!==0||n!=null)return;let r=e.target instanceof Element?e.target.closest(`[role='radio']`):null;if(!(r instanceof HTMLElement)||r.parentElement!==t||r.getAttribute(`aria-checked`)!==`true`||r.getAttribute(`aria-disabled`)===`true`)return;let i=Array.from(t.querySelectorAll(`:scope > [role='radio']`)),a=i.map(S),o=Math.min(...a.map(x)),s=Math.max(...a.map(b)),c=r.getBoundingClientRect();n={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,checked:r,checkedLeft:c.left,checkedRight:c.right,segments:i,boxes:a,trackLeft:o,trackRight:s,give:o-t.getBoundingClientRect().left-t.clientLeft,dragging:!1,base:0,offset:0,lastX:e.clientX,lastTime:e.timeStamp,velocity:0},document.addEventListener(`pointermove`,h),document.addEventListener(`pointerup`,y),document.addEventListener(`pointercancel`,y)},h=e=>{if(n==null||e.pointerId!==n.pointerId)return;if(!(e.buttons&1)){y(e);return}let r=e.clientX-n.startX;if(!n.dragging){let a=Math.abs(e.clientY-n.startY);if(a>=4&&a>Math.abs(r)){p();return}if(Math.abs(r)<4)return;n.dragging=!0,n.base=o(),i?.cancel(),i=null,t.setPointerCapture(e.pointerId),t.setAttribute(`data-dragging`,``)}let a=e.timeStamp-n.lastTime;a>0&&(n.velocity=(e.clientX-n.lastX)/a),n.lastX=e.clientX,n.lastTime=e.timeStamp,n.offset=v({travel:n.base+r,min:n.trackLeft-n.checkedLeft,max:n.trackRight-n.checkedRight,give:n.give}),t.style.setProperty(g,`${n.offset}px`);let s=(n.checkedLeft+n.checkedRight)/2,c=_(n.boxes,s+n.offset);for(let[e,t]of n.segments.entries())t.toggleAttribute(`data-thumb-over`,e===c)},y=e=>{if(n==null||e.pointerId!==n.pointerId)return;let t=n;if(p(),!t.dragging||(f(t),c(t.checkedLeft+t.offset),e.type===`pointercancel`))return;let i=e.timeStamp-t.lastTime>100?0:t.velocity,a=(t.checkedLeft+t.checkedRight)/2+t.offset+i*150,o=t.segments[_(t.boxes,a)];o!=null&&o!==t.checked&&o.click(),r=!0,window.setTimeout(()=>{r=!1},0)},C=e=>{r&&(r=!1,e.preventDefault(),e.stopPropagation())};return t.addEventListener(`pointerdown`,m),t.addEventListener(`click`,C,!0),()=>{d.disconnect(),i?.cancel(),n?.dragging&&f(n),p(),t.removeEventListener(`pointerdown`,m),t.removeEventListener(`click`,C,!0)}},r=[e],t[0]=e,t[1]=n,t[2]=r),d(n,r)}function b(e){return e.right}function x(e){return e.left}function S(e){let t=e.getBoundingClientRect();return{left:t.left,right:t.right,disabled:e.getAttribute(`aria-disabled`)===`true`}}const C=l(!1),w={Item:e=>{let t=c(14),i,o,s,l;t[0]===e?(i=t[1],o=t[2],s=t[3],l=t[4]):({"data-slot":o,className:i,ref:l,...s}=e,t[0]=e,t[1]=i,t[2]=o,t[3]=s,t[4]=l),m(u(C),`SegmentedControl.Item must be rendered inside SegmentedControl.Root.`);let d;t[5]===o?d=t[6]:(d=r(o,`segmented-control-item`),t[5]=o,t[6]=d);let f;t[7]===i?f=t[8]:(f=n(`group/radio [&_label]:cursor-inherit relative flex flex-1 select-none items-center justify-center gap-2 rounded-md px-3 text-sm`,`whitespace-nowrap`,`focus-visible:ring-focus-accent focus-visible:z-1 focus-visible:ring-4`,`cursor-pointer aria-disabled:cursor-default focus:outline-hidden`,`text-muted not-aria-disabled:hover:text-strong aria-disabled:opacity-50`,`not-aria-disabled:hover:bg-white/60 dark:not-aria-disabled:hover:bg-neutral-500/10`,`aria-checked:not-in-data-dragging:text-strong aria-checked:[anchor-name:var(--_segmented-control-thumb)]`,`data-thumb-over:text-strong`,`aria-checked:touch-pan-y`,`not-supports-[anchor-name:--a]:aria-checked:bg-card not-supports-[anchor-name:--a]:aria-checked:shadow-sm dark:not-supports-[anchor-name:--a]:aria-checked:bg-neutral-300`,i),t[7]=i,t[8]=f);let p;return t[9]!==s||t[10]!==l||t[11]!==d||t[12]!==f?(p=/* @__PURE__ */ h(a,{"data-slot":d,className:f,...s,ref:l}),t[9]=s,t[10]=l,t[11]=d,t[12]=f,t[13]=p):p=t[13],p},Root:a=>{let o=c(24),s,l,u,d,m;o[0]===a?(s=o[1],l=o[2],u=o[3],d=o[4],m=o[5]):({"data-slot":l,className:s,ref:d,style:m,...u}=a,o[0]=a,o[1]=s,o[2]=l,o[3]=u,o[4]=d,o[5]=m);let g=f(),_;if(o[6]!==g){let e;o[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=/[^\w-]/g,o[8]=e):e=o[8],_=g.replaceAll(e,``),o[6]=g,o[7]=_}else _=o[7];let v=`--segmented-control-thumb${_}`,b=p(null),x=t(d,b);y(b);let S;o[9]===l?S=o[10]:(S=r(l,`segmented-control`),o[9]=l,o[10]=S);let w;o[11]===s?w=o[12]:(w=n(`bg-neutral-500/10 relative flex h-9 flex-row flex-nowrap gap-px rounded-[0.625rem] p-1`,`before:absolute before:rounded-md before:bg-card before:shadow-sm dark:before:bg-neutral-300`,`before:[position-anchor:var(--_segmented-control-thumb)] before:top-[anchor(top)] before:left-[anchor(left)] before:w-[anchor-size(width)] before:h-[anchor-size(height)]`,`motion-safe:before:transition-[width] motion-safe:before:duration-200 motion-safe:before:ease-out-strong`,`before:translate-x-(--_segmented-control-thumb-offset,0px) data-dragging:cursor-grabbing`,`has-[[aria-checked=true]:not([aria-disabled]):hover]:before:shadow`,s),o[11]=s,o[12]=w);let T;o[13]===v?T=o[14]:(T=e({"--_segmented-control-thumb":v}),o[13]=v,o[14]=T);let E;o[15]!==m||o[16]!==T?(E={...T,...m},o[15]=m,o[16]=T,o[17]=E):E=o[17];let D;return o[18]!==x||o[19]!==u||o[20]!==S||o[21]!==w||o[22]!==E?(D=/* @__PURE__ */ h(C.Provider,{value:!0,children:/* @__PURE__ */ h(i,{"data-slot":S,className:w,style:E,...u,ref:x})}),o[18]=x,o[19]=u,o[20]=S,o[21]=w,o[22]=E,o[23]=D):D=o[23],D}};export{w as SegmentedControl};
|