@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.
Files changed (193) hide show
  1. package/dist/accordion.d.ts +13 -1
  2. package/dist/accordion.js +1 -1
  3. package/dist/agent.json +1181 -36
  4. package/dist/alert-CH99Rw-R.js +1 -0
  5. package/dist/{alert-BcSBNR3S.d.ts → alert-HffaioZM.d.ts} +31 -21
  6. package/dist/alert-center.d.ts +15 -3
  7. package/dist/alert-center.js +1 -1
  8. package/dist/alert-dialog.d.ts +15 -2
  9. package/dist/alert-dialog.js +1 -1
  10. package/dist/alert.d.ts +6 -1
  11. package/dist/alert.js +1 -1
  12. package/dist/anchor.d.ts +12 -0
  13. package/dist/app-layout.d.ts +16 -1
  14. package/dist/app-layout.js +1 -1
  15. package/dist/area-chart.d.ts +144 -88
  16. package/dist/area-chart.js +1 -1
  17. package/dist/avatar.d.ts +12 -0
  18. package/dist/badge.d.ts +13 -1
  19. package/dist/bar-chart.d.ts +144 -89
  20. package/dist/bar-chart.js +1 -1
  21. package/dist/breadcrumb.d.ts +11 -0
  22. package/dist/breadcrumb.js +1 -1
  23. package/dist/browser-only.d.ts +8 -0
  24. package/dist/{button-Yxyu1XMd.d.ts → button-BGwOPjGV.d.ts} +7 -1
  25. package/dist/{button-B8k98Pby.js → button-BWGUuWnu.js} +1 -1
  26. package/dist/{button-CPsKGDK0.d.ts → button-Cgf2IcEC.d.ts} +8 -1
  27. package/dist/button-Cu9e3SM7.js +1 -0
  28. package/dist/{button-BX-4lYUn.d.ts → button-K0pKc3GN.d.ts} +3 -3
  29. package/dist/button.d.ts +9 -3
  30. package/dist/button.js +1 -1
  31. package/dist/calendar.d.ts +7 -0
  32. package/dist/calendar.js +1 -1
  33. package/dist/card.d.ts +6 -1
  34. package/dist/centered-layout.d.ts +11 -0
  35. package/dist/chart-BO9EwQ60.js +1 -0
  36. package/dist/chart-CE5Uaqz9.js +1 -0
  37. package/dist/chart-DCTGGlWL.js +1 -0
  38. package/dist/chart-DudCw24t.js +2 -0
  39. package/dist/{chart-BpfbtOUN.d.ts → chart-jitNqimS.d.ts} +99 -103
  40. package/dist/{checkbox-DmSQXs26.js → checkbox-CS504fKk.js} +1 -1
  41. package/dist/checkbox.d.ts +14 -1
  42. package/dist/checkbox.js +1 -1
  43. package/dist/{choice-BLR0_MeB.d.ts → choice-BwfmbepO.d.ts} +7 -1
  44. package/dist/choice-uyYccm0A.js +1 -0
  45. package/dist/choice.d.ts +6 -1
  46. package/dist/choice.js +1 -1
  47. package/dist/code-block.d.ts +13 -2
  48. package/dist/code-block.js +1 -1
  49. package/dist/code-block_highlight-utils.d.ts +5 -0
  50. package/dist/code.d.ts +13 -0
  51. package/dist/color-CHZbU1Ww.js +1 -0
  52. package/dist/color.js +1 -1
  53. package/dist/combobox.d.ts +28 -14
  54. package/dist/combobox.js +1 -1
  55. package/dist/command.d.ts +14 -2
  56. package/dist/command.js +1 -1
  57. package/dist/cx.js +1 -1
  58. package/dist/data-table.d.ts +50 -19
  59. package/dist/data-table.js +1 -1
  60. package/dist/description-list.d.ts +12 -1
  61. package/dist/dialog-B9JAGy_x.d.ts +28 -0
  62. package/dist/{dialog-7TUgiSzX.js → dialog-CsugEt2A.js} +1 -1
  63. package/dist/{dialog-2fRO4ca4.d.ts → dialog-DD5H3EH1.d.ts} +10 -2
  64. package/dist/dialog.d.ts +7 -2
  65. package/dist/dialog.js +1 -1
  66. package/dist/dropdown-menu-DHdgaw4P.js +1 -0
  67. package/dist/{dropdown-menu-CpjRwMWe.d.ts → dropdown-menu-DmDxYPde.d.ts} +34 -26
  68. package/dist/dropdown-menu.d.ts +6 -1
  69. package/dist/dropdown-menu.js +1 -1
  70. package/dist/empty.d.ts +5 -0
  71. package/dist/empty.js +1 -1
  72. package/dist/{field-V_gnkcmN.d.ts → field-BshcNVe_.d.ts} +1 -1
  73. package/dist/field.d.ts +17 -6
  74. package/dist/field.js +1 -1
  75. package/dist/flag.d.ts +8 -0
  76. package/dist/hooks.d.ts +5 -0
  77. package/dist/hooks.js +1 -1
  78. package/dist/hover-card.d.ts +23 -12
  79. package/dist/{icon-ByLVhdYq.d.ts → icon-NYvyyRMG.d.ts} +6 -0
  80. package/dist/icon.d.ts +7 -2
  81. package/dist/icon.js +1 -1
  82. package/dist/{icons-DP3lQw5O.js → icons-4JA-SGfv.js} +1 -1
  83. package/dist/icons.d.ts +13 -1
  84. package/dist/icons.js +1 -1
  85. package/dist/{index-BhfgyurF.d.ts → index-KJ06KK6t.d.ts} +3 -3
  86. package/dist/input-BjCDSOPA.js +1 -0
  87. package/dist/input-DHovzBjS.js +1 -0
  88. package/dist/{input-Dx5owTCc.d.ts → input-q8o5uMhW.d.ts} +11 -1
  89. package/dist/input.d.ts +34 -2
  90. package/dist/input.js +1 -1
  91. package/dist/kbd.d.ts +12 -0
  92. package/dist/{label-nHqqYS7e.js → label-DmDwzPD8.js} +1 -1
  93. package/dist/{label-Dn5CPJUj.d.ts → label-r2sJcSQ4.d.ts} +6 -0
  94. package/dist/label.d.ts +6 -1
  95. package/dist/label.js +1 -1
  96. package/dist/line-chart.d.ts +139 -82
  97. package/dist/line-chart.js +1 -1
  98. package/dist/{list-RFRIQxU2.js → list-CO_yLdln.js} +1 -1
  99. package/dist/list.d.ts +19 -1
  100. package/dist/list.js +1 -1
  101. package/dist/live-region.d.ts +14 -1
  102. package/dist/llms.txt +78 -76
  103. package/dist/main.d.ts +12 -0
  104. package/dist/mantle.css +110 -65
  105. package/dist/media-object.d.ts +12 -0
  106. package/dist/migrations/0014-chart-named-colors.yml +1389 -0
  107. package/dist/migrations/0015-segmented-control.yml +788 -0
  108. package/dist/multi-select.d.ts +15 -2
  109. package/dist/multi-select.js +1 -1
  110. package/dist/otp-input.d.ts +17 -5
  111. package/dist/otp-input.js +1 -1
  112. package/dist/pagination.d.ts +92 -3
  113. package/dist/pagination.js +1 -1
  114. package/dist/popover-BhTFutCz.d.ts +1 -0
  115. package/dist/{popover-BfB2I9G0.d.ts → popover-lwkwWcRW.d.ts} +16 -7
  116. package/dist/popover.d.ts +7 -2
  117. package/dist/progress.d.ts +27 -10
  118. package/dist/progress.js +1 -1
  119. package/dist/qr-code.d.ts +9 -1
  120. package/dist/query.d.ts +2 -2
  121. package/dist/query.js +1 -1
  122. package/dist/radio-group-jj2abc0t.js +1 -0
  123. package/dist/radio-group-sLz5AA9I.d.ts +27 -0
  124. package/dist/radio-group.d.ts +20 -99
  125. package/dist/radio-group.js +1 -1
  126. package/dist/sandbar.d.ts +14 -1
  127. package/dist/sandbar.js +1 -1
  128. package/dist/sandboxed-on-click.d.ts +8 -0
  129. package/dist/scatter-plot.d.ts +126 -64
  130. package/dist/scatter-plot.js +1 -1
  131. package/dist/segmented-control.d.ts +136 -0
  132. package/dist/segmented-control.js +1 -0
  133. package/dist/{select-BkhBxtOT.d.ts → select-BqmpVJJT.d.ts} +29 -21
  134. package/dist/select-C6Su0dU0.js +1 -0
  135. package/dist/select.d.ts +6 -1
  136. package/dist/select.js +1 -1
  137. package/dist/selectable-list.d.ts +13 -2
  138. package/dist/selectable-list.js +1 -1
  139. package/dist/{separator-D9AWEkcJ.d.ts → separator-QfH0ot5K.d.ts} +3 -1
  140. package/dist/separator.d.ts +6 -1
  141. package/dist/{sheet-CSJc_sB4.js → sheet-Bd2LIhzF.js} +1 -1
  142. package/dist/sheet.d.ts +15 -2
  143. package/dist/sheet.js +1 -1
  144. package/dist/sidebar.d.ts +19 -3
  145. package/dist/sidebar.js +1 -1
  146. package/dist/skeleton.d.ts +11 -0
  147. package/dist/skip-to-main-link.d.ts +11 -0
  148. package/dist/skip-to-main-link.js +1 -1
  149. package/dist/slider.d.ts +10 -0
  150. package/dist/{slot-C0OCJjdJ.d.ts → slot-D12N_fZJ.d.ts} +3 -1
  151. package/dist/slot.d.ts +6 -1
  152. package/dist/split-button.d.ts +14 -3
  153. package/dist/split-button.js +1 -1
  154. package/dist/strata.d.ts +13 -0
  155. package/dist/switch.d.ts +13 -1
  156. package/dist/switch.js +1 -1
  157. package/dist/{table-vT6Okwfa.d.ts → table-rWiVWEgB.d.ts} +79 -0
  158. package/dist/table.d.ts +6 -1
  159. package/dist/tabs.d.ts +23 -11
  160. package/dist/tabs.js +1 -1
  161. package/dist/text-area.d.ts +11 -1
  162. package/dist/theme-DdZgLvKH.js +1 -0
  163. package/dist/theme-switcher.d.ts +16 -2
  164. package/dist/theme-switcher.js +1 -1
  165. package/dist/theme.d.ts +12 -0
  166. package/dist/theme.js +1 -1
  167. package/dist/toast.d.ts +14 -1
  168. package/dist/toast.js +1 -1
  169. package/dist/{tooltip-NcLIeBy5.d.ts → tooltip-CpK3XTor.d.ts} +15 -8
  170. package/dist/tooltip.d.ts +6 -1
  171. package/dist/truncated-text.d.ts +27 -13
  172. package/dist/truncated-text.js +1 -1
  173. package/dist/types.d.ts +1 -1
  174. package/dist/types.js +1 -1
  175. package/dist/use-inert-siblings-CNmNuS2h.js +1 -0
  176. package/dist/use-swipe-to-dismiss-i__cTF2v.js +1 -0
  177. package/dist/utils.d.ts +1 -1
  178. package/dist/utils.js +1 -1
  179. package/dist/visually-hidden.d.ts +13 -0
  180. package/dist/well.d.ts +6 -1
  181. package/package.json +6 -6
  182. package/src/components/chart/d3-license.md +25 -0
  183. package/dist/alert-P9lwn25X.js +0 -1
  184. package/dist/button-Dge0D5bl.js +0 -1
  185. package/dist/chart-BpWfQAwf.js +0 -2
  186. package/dist/choice-2Lrv8_nl.js +0 -1
  187. package/dist/dialog-Dp0QGWwo.d.ts +0 -28
  188. package/dist/dropdown-menu-BHBzCDSZ.js +0 -1
  189. package/dist/input-CpQ6jlpI.js +0 -1
  190. package/dist/popover-C96V8SXi.d.ts +0 -1
  191. package/dist/select-CAAYk4Yj.js +0 -1
  192. package/dist/theme-C-glc5Q-.js +0 -1
  193. package/dist/use-swipe-to-dismiss-DceYk1Id.js +0 -1
@@ -1,5 +1,6 @@
1
1
  import { t as SelfClosingWithAsChild } from "./as-child-DFxX3U2i.js";
2
2
  import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
3
+ import { t as Color } from "./index-BZhHLrBi.js";
3
4
  import { ComponentProps, ReactNode } from "react";
4
5
  /**
5
6
  * Shared types for the internal canvas chart engine.
@@ -42,31 +43,21 @@ type ContinuousXScale = Exclude<XScaleKind, "band">;
42
43
  */
43
44
  type SeriesMark = "bar" | "line" | "area" | "scatter";
44
45
  /**
45
- * The ordered chart color tokens. Series use the first eight through automatic
46
- * or fixed identity slots. `"chart-other"` is the shared neutral treatment for
47
- * overflow and folded-tail series.
48
- */
49
- type ChartColorToken = "chart-1" | "chart-2" | "chart-3" | "chart-4" | "chart-5" | "chart-6" | "chart-7" | "chart-8" | "chart-other";
50
- /**
51
- * A series' visual identity slot. Slots `1` through `8` pair one validated
52
- * chart color with one point shape. `"other"` selects the shared neutral
53
- * overflow treatment.
54
- */
55
- type ChartSeriesSlot = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | "other";
56
- /**
57
- * A series color: one of the validated chart tokens (preferred — they adapt to
58
- * the light and dark themes) or any CSS color string as an escape hatch.
46
+ * A series color: a mantle color name, the same `Color` that `Badge` takes, or
47
+ * any CSS color string as an escape hatch.
59
48
  *
60
- * `color` overrides only the color channel. It does not select or reserve a
61
- * series slot. When sibling series can mount or unmount, use `seriesSlot` on a
62
- * series part to keep its visual identity fixed.
49
+ * A name paints that color's chart token, `--color-chart-<name>`: the color's
50
+ * 600 step in light mode and its 500 step in dark mode. Most names reach 3:1
51
+ * contrast on the card surface, and the docs list the names that do not.
52
+ * Mantle does not guarantee that any set of names stays apart for a
53
+ * color-blind reader. Functional names (`success`, `danger`, …) alias the hue
54
+ * their status color uses. `neutral` is the color for an "Other" series.
63
55
  *
64
- * A static color (raw hex) cannot follow the two themes, so prefer a
56
+ * A static CSS color (raw hex) cannot follow the two themes, so prefer a
65
57
  * `var(--your-token)` a consumer declares per theme. A series that carries
66
- * good/bad meaning (error rate, pass/fail) should wear the semantic status
67
- * colors, never a categorical chart slot.
58
+ * good/bad meaning (error rate, pass/fail) should wear a functional color.
68
59
  */
69
- type SeriesColor = ChartColorToken | (string & {});
60
+ type SeriesColor = Color | (string & {});
70
61
  /**
71
62
  * Line/area interpolation between points.
72
63
  */
@@ -76,10 +67,7 @@ type CurveKind = "linear" | "monotone" | "step";
76
67
  * the hover dot on line/area charts. Shape is a redundant encoding alongside
77
68
  * color, so series stay distinguishable without color vision.
78
69
  *
79
- * Eight values match the palette's eight series slots. This union's order is
80
- * the pairing: a series that sets no `shape` wears the glyph of the slot it
81
- * holds — slot 1 the circle, slot 2 the square, on down to slot 8 and the
82
- * star. The shared `"chart-other"` treatment uses the circle.
70
+ * A series that sets no `shape` wears the circle.
83
71
  *
84
72
  * What each added name draws:
85
73
  *
@@ -104,13 +92,13 @@ type PointShape = "circle" | "square" | "triangle" | "diamond" | "triangle-down"
104
92
  *
105
93
  * The two rung textures flip with `orientation`, in opposite senses. Every
106
94
  * other value is direction-free, `"grid"` included — it is the orthogonal
107
- * lattice against `"crosshatch"`'s diagonal one. Eight values match the
108
- * palette's eight series slots.
95
+ * lattice against `"crosshatch"`'s diagonal one.
109
96
  *
110
- * Texture is a redundant identity encoding alongside color — inked tone-on-tone
111
- * at equal loudness across slots — so grouped and stacked series stay
112
- * distinguishable without color vision, in grayscale print, and under forced
113
- * colors.
97
+ * A textured series paints its marks in the full series color over a light
98
+ * tint of it. Texture is a redundant identity encoding alongside color, so
99
+ * grouped and stacked series stay distinguishable without color vision, in
100
+ * grayscale print, and under forced colors. Two series can share one color and
101
+ * stay apart by texture.
114
102
  */
115
103
  type BarTexture = "solid" | "hatch" | "hatch-reverse" | "crosshatch" | "perpendicular" | "parallel" | "grid" | "dots";
116
104
  /**
@@ -128,17 +116,13 @@ type SeriesMeta = {
128
116
  dataKey: string;
129
117
  label: string;
130
118
  mark: SeriesMark;
131
- /** The CSS color string the series paints with (token-resolved). */
119
+ /** The CSS color string the series paints with (a color name resolves to its chart token). */
132
120
  color: string;
133
- /** The color as authored (token name or custom string) before resolution. */
121
+ /** The color as authored (a color name or a CSS string) before resolution. */
134
122
  colorInput: SeriesColor;
135
123
  /**
136
124
  * The point glyph the series wears (scatter marks, legend keys, hover
137
- * dots): the explicit `shape` when it set one, else the glyph paired to its
138
- * series slot.
139
- *
140
- * A bar paints no glyph. Its legend key wears `texture` instead, so nothing
141
- * draws the glyph a bar series is paired with.
125
+ * dots). A bar paints no glyph; its legend key wears `texture` instead.
142
126
  */
143
127
  shape: PointShape;
144
128
  /** The fill texture the series wears (bar marks and their legend keys). */
@@ -192,6 +176,11 @@ type HoverSnapshot = {
192
176
  value: number | null;
193
177
  color: string;
194
178
  }>;
179
+ /**
180
+ * The sum of every series' value at the active index. Set only on a stacked
181
+ * chart with two or more series, where the tooltip leads with it.
182
+ */
183
+ total?: number;
195
184
  /** The depth value at the active index (3D scatter plots only). */
196
185
  zValue?: number | null;
197
186
  /** Whether the snapshot came from keyboard stepping (vs pointer hover). */
@@ -233,11 +222,12 @@ type YDomain = [number | "auto", number | "auto"];
233
222
  * composed Tooltip part customizes the readout; omitting it never removes the
234
223
  * hover layer, and no part removal can strip keyboard access to the data.
235
224
  *
236
- * A Root mounts dormant: it ingests its data and answers the keyboard, but it
237
- * paints and allocates its canvas once it nears the viewport, and it mounts
238
- * the data table once focus lands inside it. A list of 100 charts pays for
239
- * the ones a reader can see, and a table of sparklines holds no hidden
240
- * tables until a reader asks for one.
225
+ * A Root mounts dormant: a shell of the plot, the named overlay, and the
226
+ * sr-only description. It builds its paint surface and its engine once it
227
+ * nears the viewport, takes focus, or prints, and it mounts the data table
228
+ * once focus lands inside it. A list of 100 charts pays for the ones a reader
229
+ * can see, and a table of sparklines holds no hidden tables until a reader
230
+ * asks for one.
241
231
  *
242
232
  * This module is internal shared implementation — it is not exported from the
243
233
  * package.
@@ -328,8 +318,8 @@ type ChartAccessibilityProps<TMode extends ChartMode = ChartMode> = {
328
318
  * name and a description; only its values live in the text beside it.
329
319
  * One hundred sparklines in a table as one hundred Tab stops is a focus
330
320
  * order no reader wants, and a readout that only a pointer can reach
331
- * fails WCAG 1.4.13, so `"static"` offers neither. A chart that is the
332
- * only source of its values stays `"interactive"`.
321
+ * fails WCAG 2.2 SC 2.1.1 (Keyboard), so `"static"` offers neither. A
322
+ * chart that is the only source of its values stays `"interactive"`.
333
323
  *
334
324
  * **`"static"`** names the plot `role="img"`, with the consumer's
335
325
  * `aria-label` or `aria-labelledby` and an `aria-describedby` to the
@@ -346,7 +336,7 @@ type ChartAccessibilityProps<TMode extends ChartMode = ChartMode> = {
346
336
  * technology (no name, no description, no table, no live region), out of
347
337
  * the tab order, and inert to pointer and keyboard. Every series paints
348
338
  * `--color-chart-decorative`, one neutral fill that outranks a series'
349
- * `color` and `seriesSlot`: a backdrop encodes no series identity, and a
339
+ * `color`: a backdrop encodes no series identity, and a
350
340
  * hue on values that are not information invites a reader to decode it.
351
341
  * The token is the darkest neutral step that keeps `text-muted` over the
352
342
  * WCAG AA floor for 14px text in both themes (4.56:1 in light, 4.93:1
@@ -369,8 +359,8 @@ type ChartAccessibilityProps<TMode extends ChartMode = ChartMode> = {
369
359
  * <LineChart.Grid />
370
360
  * <LineChart.XAxis />
371
361
  * <LineChart.YAxis />
372
- * <LineChart.Line dataKey="p50" label="p50" />
373
- * <LineChart.Line dataKey="p99" label="p99" />
362
+ * <LineChart.Line dataKey="p50" label="p50" color="blue" />
363
+ * <LineChart.Line dataKey="p99" label="p99" color="emerald" />
374
364
  * <LineChart.Tooltip />
375
365
  * <LineChart.Legend />
376
366
  * </LineChart.Root>
@@ -387,7 +377,7 @@ type ChartAccessibilityProps<TMode extends ChartMode = ChartMode> = {
387
377
  * aria-label={`Requests for ${service.name}, last 30 days`}
388
378
  * className="aspect-auto h-6 w-28"
389
379
  * >
390
- * <BarChart.Bar dataKey="count" label="Requests" />
380
+ * <BarChart.Bar dataKey="count" label="Requests" color="blue" />
391
381
  * </BarChart.Root>
392
382
  * <span className="text-muted text-xs tabular-nums">{compact(service.requestTotal)}</span>
393
383
  * </div>
@@ -398,7 +388,7 @@ type ChartAccessibilityProps<TMode extends ChartMode = ChartMode> = {
398
388
  * // Decorative: the message is a sibling of the chart, so AT still announces it.
399
389
  * <div className="relative w-full">
400
390
  * <BarChart.Root data={placeholderUsage} xKey="day" mode="decorative">
401
- * <BarChart.Bar dataKey="value" />
391
+ * <BarChart.Bar dataKey="value" color="blue" />
402
392
  * </BarChart.Root>
403
393
  * <Empty.Root className="absolute inset-0 m-auto h-fit w-fit">
404
394
  * <Empty.Title>No usage yet</Empty.Title>
@@ -418,30 +408,44 @@ type ChartAccessibilityProps<TMode extends ChartMode = ChartMode> = {
418
408
  mode?: "interactive";
419
409
  } & ChartAccessibleName & ChartInteractionProps);
420
410
  /**
421
- * Root props shared by every chart kind, WITHOUT the accessibility/interaction
422
- * union or the data/x props. Public wrappers `Omit` from this base and
423
- * re-intersect `ChartAccessibilityProps` — `Omit` over a union type flattens
424
- * it, which would silently make the required accessible name optional and
425
- * erase the `mode` discriminant.
411
+ * The copy button part: copies the chart's data as a Markdown table.
412
+ *
413
+ * This module is internal shared implementation — not exported from the package.
426
414
  */
427
- type ChartRootBaseProps = Omit<ComponentProps<"div">, "aria-label" | "aria-labelledby"> & WithDataSlot & {
415
+ type CopyButtonPrimitiveProps = Omit<ComponentProps<"button">, "aria-label" | "children" | "type" | "onCopy"> & SelfClosingWithAsChild & WithDataSlot & {
428
416
  /**
429
- * Classes for the Root. The Root is `aspect-video` by default. To size it
430
- * another way, set `aspect-auto` and a height: `className="aspect-auto h-52"`.
417
+ * Not part of the API: `label` is the single way to name the button.
418
+ * Typed `never` rather than only omitted because TypeScript skips
419
+ * excess-attribute checks for hyphenated JSX attributes; the `never`
420
+ * type makes the JSX call site a compile error.
431
421
  */
432
- className?: string;
433
- /** Override the automatic y domain. */
434
- yDomain?: YDomain;
435
- /** Stack the series in registration order, from the baseline out (bar/area charts). */
436
- stacked?: boolean;
437
- /** Animate enter/update transitions. `prefers-reduced-motion` always wins. */
438
- animate?: boolean;
422
+ "aria-label"?: never;
439
423
  /**
440
- * Hold the previous render at reduced opacity while fresh data loads —
441
- * never swap a chart that has rendered once for a skeleton.
424
+ * The accessible name for the copy button, rendered as its `aria-label`
425
+ * (like the `alt` text on an `<img>`).
426
+ *
427
+ * @default "Copy data as Markdown"
442
428
  */
443
- pending?: boolean;
429
+ label?: string;
430
+ /**
431
+ * Callback fired after a successful copy, passes the serialized markdown.
432
+ */
433
+ onCopy?: (value: string) => void;
434
+ /**
435
+ * Callback fired when an error occurs during copying.
436
+ */
437
+ onCopyError?: (error: unknown) => void;
444
438
  };
439
+ type LegendPrimitiveProps = Omit<ComponentProps<"div">, "children"> & {
440
+ /**
441
+ * Classes for the legend. The legend wraps its items and does not shrink.
442
+ * Past `max-h-16` it scrolls; set another `max-h-*` to change the bound.
443
+ */
444
+ className?: string;
445
+ /** Replace the default legend items; receives the registered series. */
446
+ children?: (series: SeriesMeta[]) => ReactNode;
447
+ };
448
+ type ChartListPrimitiveProps = ComponentProps<"div"> & WithDataSlot;
445
449
  type GridPrimitiveProps = {
446
450
  /** Which gridlines to draw. */
447
451
  lines?: GridLines;
@@ -488,10 +492,35 @@ type ReferenceLinePrimitiveProps = {
488
492
  /** Line color; defaults to the neutral reference color. */
489
493
  color?: SeriesColor;
490
494
  };
495
+ /**
496
+ * Root props shared by every chart kind, WITHOUT the accessibility/interaction
497
+ * union or the data/x props. Public wrappers `Omit` from this base and
498
+ * re-intersect `ChartAccessibilityProps` — `Omit` over a union type flattens
499
+ * it, which would silently make the required accessible name optional and
500
+ * erase the `mode` discriminant.
501
+ */
502
+ type ChartRootBaseProps = Omit<ComponentProps<"div">, "aria-label" | "aria-labelledby"> & WithDataSlot & {
503
+ /**
504
+ * Classes for the Root. The Root is `aspect-video` by default. To size it
505
+ * another way, set `aspect-auto` and a height: `className="aspect-auto h-52"`.
506
+ */
507
+ className?: string;
508
+ /** Override the automatic y domain. */
509
+ yDomain?: YDomain;
510
+ /** Stack the series in registration order, from the baseline out (bar/area charts). */
511
+ stacked?: boolean;
512
+ /** Animate enter/update transitions. `prefers-reduced-motion` always wins. */
513
+ animate?: boolean;
514
+ /**
515
+ * Hold the previous render at reduced opacity while fresh data loads —
516
+ * never swap a chart that has rendered once for a skeleton.
517
+ */
518
+ pending?: boolean;
519
+ };
491
520
  type TooltipPrimitiveProps = Omit<ComponentProps<"div">, "children"> & {
492
521
  /** Format the x/label row of the readout. */
493
522
  labelFormat?: (value: XValue) => ReactNode;
494
- /** Format each series value. */
523
+ /** Format each series value. The Total row of a stacked chart passes the `dataKey` `"total"`. */
495
524
  valueFormat?: (value: number, dataKey: string) => ReactNode;
496
525
  /** The per-series color key: a short stroke (default) or nothing. */
497
526
  indicator?: "line" | "none";
@@ -500,37 +529,4 @@ type TooltipPrimitiveProps = Omit<ComponentProps<"div">, "children"> & {
500
529
  /** Replace the entire readout. */
501
530
  children?: (snapshot: HoverSnapshot) => ReactNode;
502
531
  };
503
- type LegendPrimitiveProps = Omit<ComponentProps<"div">, "children"> & {
504
- /**
505
- * Classes for the legend. The legend wraps its items and does not shrink.
506
- * Past `max-h-16` it scrolls; set another `max-h-*` to change the bound.
507
- */
508
- className?: string;
509
- /** Replace the default legend items; receives the registered series. */
510
- children?: (series: SeriesMeta[]) => ReactNode;
511
- };
512
- type CopyButtonPrimitiveProps = Omit<ComponentProps<"button">, "aria-label" | "children" | "type" | "onCopy"> & SelfClosingWithAsChild & {
513
- /**
514
- * Not part of the API: `label` is the single way to name the button.
515
- * Typed `never` rather than only omitted because TypeScript skips
516
- * excess-attribute checks for hyphenated JSX attributes; the `never`
517
- * type makes the JSX call site a compile error.
518
- */
519
- "aria-label"?: never;
520
- /**
521
- * The accessible name for the copy button, rendered as its `aria-label`
522
- * (like the `alt` text on an `<img>`).
523
- *
524
- * @default "Copy data as Markdown"
525
- */
526
- label?: string;
527
- /**
528
- * Callback fired after a successful copy, passes the serialized markdown.
529
- */
530
- onCopy?: (value: string) => void;
531
- /**
532
- * Callback fired when an error occurs during copying.
533
- */
534
- onCopyError?: (error: unknown) => void;
535
- };
536
- export { CurveKind as _, GridPrimitiveProps as a, TooltipPrimitiveProps as c, BarOrientation as d, BarTexture as f, ContinuousXScale as g, ChartSeriesSlot as h, CopyButtonPrimitiveProps as i, XAxisPrimitiveProps as l, ChartDatumEvent as m, ChartMode as n, LegendPrimitiveProps as o, ChartDatum as p, ChartRootBaseProps as r, ReferenceLinePrimitiveProps as s, ChartAccessibilityProps as t, YAxisPrimitiveProps as u, PointShape as v, SeriesColor as y };
532
+ export { CurveKind as _, XAxisPrimitiveProps as a, LegendPrimitiveProps as c, ChartMode as d, BarOrientation as f, ContinuousXScale as g, ChartDatumEvent as h, ReferenceLinePrimitiveProps as i, CopyButtonPrimitiveProps as l, ChartDatum as m, ChartRootBaseProps as n, YAxisPrimitiveProps as o, BarTexture as p, GridPrimitiveProps as r, ChartListPrimitiveProps as s, TooltipPrimitiveProps as t, ChartAccessibilityProps as u, PointShape as v, SeriesColor as y };
@@ -1 +1 @@
1
- import{t as e}from"./use-isomorphic-layout-effect-CLSmHzo4.js";import{n as t}from"./compose-refs-sFdxsL7k.js";import{t as n}from"./data-slot-EM6s2WEU.js";import{t as r}from"./clsx-DUGZgXfJ.js";import{a as i,r as a}from"./field-CPvjazWN.js";import{c as o}from"react/compiler-runtime";import{useRef as s,useState as c}from"react";import{jsx as l}from"react/jsx-runtime";const u=e=>e===`indeterminate`,d=d=>{let f=o(41),p,m,h,g,_,v,y,b,x,S,C;f[0]===d?(p=f[1],m=f[2],h=f[3],g=f[4],_=f[5],v=f[6],y=f[7],b=f[8],x=f[9],S=f[10],C=f[11]):({"data-slot":v,"aria-invalid":p,className:_,checked:m,defaultChecked:h,defaultValue:C,onClick:y,readOnly:x,ref:S,validation:g,...b}=d,f[0]=d,f[1]=p,f[2]=m,f[3]=h,f[4]=g,f[5]=_,f[6]=v,f[7]=y,f[8]=b,f[9]=x,f[10]=S,f[11]=C);let w=C===void 0?`on`:C,T=s(null),E=t(T,S),[D]=c(h),O=i(),k=g??O,A;f[12]!==p||f[13]!==k?(A=a({"aria-invalid":p,validation:k}),f[12]=p,f[13]=k,f[14]=A):A=f[14];let{ariaInvalid:j,validation:M}=A,N=m??D,P,F;f[15]===N?(P=f[16],F=f[17]):(P=()=>{T.current&&(T.current.indeterminate=u(N))},F=[N],f[15]=N,f[16]=P,f[17]=F),e(P,F);let I;f[18]!==m||f[19]!==D?(I=m==null?{defaultChecked:u(D)?void 0:D}:{checked:!u(m)&&m},f[18]=m,f[19]=D,f[20]=I):I=f[20];let L=I,R=u(m)?`mixed`:m,z=x||void 0,B;f[21]===v?B=f[22]:(B=n(v,`checkbox`),f[21]=v,f[22]=B);let V;f[23]===_?V=f[24]:(V=r(`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`,_),f[23]=_,f[24]=V);let H=M||void 0,U;f[25]!==y||f[26]!==x?(U=e=>{x?e.preventDefault():y?.(e)},f[25]=y,f[26]=x,f[27]=U):U=f[27];let W;return f[28]!==j||f[29]!==L||f[30]!==E||f[31]!==w||f[32]!==b||f[33]!==x||f[34]!==V||f[35]!==H||f[36]!==U||f[37]!==R||f[38]!==z||f[39]!==B?(W=/* @__PURE__ */ l(`input`,{"aria-checked":R,"aria-invalid":j,"aria-readonly":z,"data-slot":B,className:V,...L,"data-validation":H,defaultValue:w,onClick:U,readOnly:x,ref:E,type:`checkbox`,...b}),f[28]=j,f[29]=L,f[30]=E,f[31]=w,f[32]=b,f[33]=x,f[34]=V,f[35]=H,f[36]=U,f[37]=R,f[38]=z,f[39]=B,f[40]=W):W=f[40],W};function f({allSelected:e,someSelected:t}){return e?!0:t?`indeterminate`:!1}export{f as n,d as t};
1
+ import{t as e}from"./use-isomorphic-layout-effect-CLSmHzo4.js";import{n as t}from"./compose-refs-sFdxsL7k.js";import{t as n}from"./clsx-DUGZgXfJ.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{a as i,r as a}from"./field-CPvjazWN.js";import{c as o}from"react/compiler-runtime";import{useRef as s,useState as c}from"react";import{jsx as l}from"react/jsx-runtime";const u=e=>e===`indeterminate`,d=d=>{let f=o(41),p,m,h,g,_,v,y,b,x,S,C;f[0]===d?(p=f[1],m=f[2],h=f[3],g=f[4],_=f[5],v=f[6],y=f[7],b=f[8],x=f[9],S=f[10],C=f[11]):({"data-slot":v,"aria-invalid":p,className:_,checked:m,defaultChecked:h,defaultValue:C,onClick:y,readOnly:x,ref:S,validation:g,...b}=d,f[0]=d,f[1]=p,f[2]=m,f[3]=h,f[4]=g,f[5]=_,f[6]=v,f[7]=y,f[8]=b,f[9]=x,f[10]=S,f[11]=C);let w=C===void 0?`on`:C,T=s(null),E=t(T,S),[D]=c(h),O=i(),k=g??O,A;f[12]!==p||f[13]!==k?(A=a({"aria-invalid":p,validation:k}),f[12]=p,f[13]=k,f[14]=A):A=f[14];let{ariaInvalid:j,validation:M}=A,N=m??D,P,F;f[15]===N?(P=f[16],F=f[17]):(P=()=>{T.current&&(T.current.indeterminate=u(N))},F=[N],f[15]=N,f[16]=P,f[17]=F),e(P,F);let I;f[18]!==m||f[19]!==D?(I=m==null?{defaultChecked:u(D)?void 0:D}:{checked:!u(m)&&m},f[18]=m,f[19]=D,f[20]=I):I=f[20];let L=I,R=u(m)?`mixed`:m,z=x||void 0,B;f[21]===v?B=f[22]:(B=r(v,`checkbox`),f[21]=v,f[22]=B);let V;f[23]===_?V=f[24]:(V=n(`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`,_),f[23]=_,f[24]=V);let H=M||void 0,U;f[25]!==y||f[26]!==x?(U=e=>{x?e.preventDefault():y?.(e)},f[25]=y,f[26]=x,f[27]=U):U=f[27];let W;return f[28]!==j||f[29]!==L||f[30]!==E||f[31]!==w||f[32]!==b||f[33]!==x||f[34]!==V||f[35]!==H||f[36]!==U||f[37]!==R||f[38]!==z||f[39]!==B?(W=/* @__PURE__ */ l(`input`,{"aria-checked":R,"aria-invalid":j,"aria-readonly":z,"data-slot":B,className:V,...L,"data-validation":H,defaultValue:w,onClick:U,readOnly:x,ref:E,type:`checkbox`,...b}),f[28]=j,f[29]=L,f[30]=E,f[31]=w,f[32]=b,f[33]=x,f[34]=V,f[35]=H,f[36]=U,f[37]=R,f[38]=z,f[39]=B,f[40]=W):W=f[40],W};function f({allSelected:e,someSelected:t}){return e?!0:t?`indeterminate`:!1}export{f as n,d as t};
@@ -1,5 +1,10 @@
1
+ /**
2
+ * Re-exports for the Checkbox component.
3
+ *
4
+ * @see https://mantle.ngrok.com/components/forms/checkbox
5
+ */
1
6
  import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
2
- import { o as WithValidation } from "./field-V_gnkcmN.js";
7
+ import { o as WithValidation } from "./field-BshcNVe_.js";
3
8
  import { ComponentProps } from "react";
4
9
  /**
5
10
  * The tri-state checked value of a {@link Checkbox}: `true` (checked),
@@ -32,6 +37,14 @@ type Props = Omit<ComponentProps<"input">, "type" | "checked" | "defaultChecked"
32
37
  * compose it inside [`Choice`](/components/forms/choice) for a titled, multi-line
33
38
  * label with a supplementary description.
34
39
  *
40
+ * @useWhen Turn one or more independent options on or off in a form, with an indeterminate state
41
+ * for a partial selection.
42
+ *
43
+ * @siblings
44
+ * - `Switch`: one setting turns on or off and needs no indeterminate state.
45
+ * - `RadioGroup`: the user picks exactly one option from a set.
46
+ * - `Choice`: the checkbox needs a title and a description beside it.
47
+ *
35
48
  * @see https://mantle.ngrok.com/components/forms/checkbox
36
49
  *
37
50
  * @example
package/dist/checkbox.js CHANGED
@@ -1 +1 @@
1
- export{t as Checkbox,n as selectAllChecked}from"./checkbox-DmSQXs26.js";
1
+ export{t as Checkbox,n as selectAllChecked}from"./checkbox-CS504fKk.js";
@@ -1,6 +1,6 @@
1
1
  import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
2
2
  import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
3
- import { t as Label } from "./label-Dn5CPJUj.js";
3
+ import { t as Label } from "./label-r2sJcSQ4.js";
4
4
  import { ComponentProps, ReactNode } from "react";
5
5
  /**
6
6
  * Props for `Choice.Root`. Extends `<div>` props (minus `id`, narrowed below)
@@ -239,6 +239,12 @@ declare const Description: ({ "data-slot": dataSlot, asChild, className, onClick
239
239
  * accessible name is the title alone and the description is its
240
240
  * `aria-describedby`.
241
241
  *
242
+ * @useWhen Put a checkbox, a radio, or a switch beside a title and an optional description.
243
+ *
244
+ * @siblings
245
+ * - `Label`: the control needs only a one-line caption.
246
+ * - `MediaObject`: the thing beside the text is an image or an icon, not a control.
247
+ *
242
248
  * @see https://mantle.ngrok.com/components/forms/choice
243
249
  *
244
250
  * @example
@@ -0,0 +1 @@
1
+ import{t as e}from"./use-isomorphic-layout-effect-CLSmHzo4.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{t as i}from"./interactive-target-BXScNeOr.js";import{t as a}from"./field-Bihblt8U.js";import{t as o}from"./label-DmDwzPD8.js";import{t as s}from"./radio-group-HDVxTNPi.js";import{t as c}from"./slot-DdYN1L1C.js";import{c as l}from"react/compiler-runtime";import{cloneElement as u,createContext as d,isValidElement as f,useContext as p,useId as m,useRef as h}from"react";import g from"tiny-invariant";import{jsx as _}from"react/jsx-runtime";const v=d(null);function y(e){let t=p(v);return g(t,`Choice.${e} must be rendered inside Choice.Root.`),t}const b=e=>{let t=l(40),i,o,s,c,u,d,f,g,y,b,x;t[0]===e?(i=t[1],o=t[2],s=t[3],c=t[4],u=t[5],d=t[6],f=t[7],g=t[8],y=t[9],b=t[10],x=t[11]):({"data-slot":d,"aria-describedby":i,"aria-errormessage":o,"aria-invalid":s,children:c,className:u,disabled:x,id:f,name:g,ref:b,...y}=e,t[0]=e,t[1]=i,t[2]=o,t[3]=s,t[4]=c,t[5]=u,t[6]=d,t[7]=f,t[8]=g,t[9]=y,t[10]=b,t[11]=x);let S=x!==void 0&&x,C=p(a),w=C?.id,T=C?.name,E=C?.[`aria-describedby`],D=C?.[`aria-invalid`],O=C?.[`aria-errormessage`],k=m(),A=m(),j=h(null),M=w??f??k,N=E??i,P;t[12]!==A||t[13]!==N?(P=[N,A].filter(Boolean).join(` `)||void 0,t[12]=A,t[13]=N,t[14]=P):P=t[14];let F=P,I=T??g,L=D??s,R=O??o,z;t[15]!==M||t[16]!==F||t[17]!==S||t[18]!==I||t[19]!==L||t[20]!==R?(z={id:M,name:I,disabled:S,"aria-describedby":F,"aria-invalid":L,"aria-errormessage":R},t[15]=M,t[16]=F,t[17]=S,t[18]=I,t[19]=L,t[20]=R,t[21]=z):z=t[21];let B;t[22]!==M||t[23]!==A||t[24]!==S||t[25]!==z?(B={controlId:M,descriptionId:A,disabled:S,labelRef:j,controlProps:z},t[22]=M,t[23]=A,t[24]=S,t[25]=z,t[26]=B):B=t[26];let V=B,H;t[27]===d?H=t[28]:(H=r(d,`choice`),t[27]=d,t[28]=H);let U;t[29]===u?U=t[30]:(U=n(`flex w-full items-start gap-2`,u),t[29]=u,t[30]=U);let W;t[31]!==c||t[32]!==y||t[33]!==b||t[34]!==H||t[35]!==U?(W=/* @__PURE__ */ _(`div`,{ref:b,"data-slot":H,className:U,...y,children:c}),t[31]=c,t[32]=y,t[33]=b,t[34]=H,t[35]=U,t[36]=W):W=t[36];let G;return t[37]!==V||t[38]!==W?(G=/* @__PURE__ */ _(v.Provider,{value:V,children:W}),t[37]=V,t[38]=W,t[39]=G):G=t[39],G},x=e=>{let t=l(19),i,a,o,s,c;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5]):({"data-slot":o,children:i,className:a,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c);let{controlProps:d}=y(`Indicator`),p;t[6]!==i||t[7]!==d?(p=f(i)?u(i,{...d,disabled:d.disabled||i.props.disabled===!0,name:d.name??i.props.name,"aria-invalid":d[`aria-invalid`]??i.props[`aria-invalid`],"aria-errormessage":d[`aria-errormessage`]??i.props[`aria-errormessage`]}):i,t[6]=i,t[7]=d,t[8]=p):p=t[8];let m=p,h;t[9]===o?h=t[10]:(h=r(o,`choice-indicator`),t[9]=o,t[10]=h);let g;t[11]===a?g=t[12]:(g=n(`flex h-lh shrink-0 items-center text-sm`,a),t[11]=a,t[12]=g);let v;return t[13]!==m||t[14]!==s||t[15]!==c||t[16]!==h||t[17]!==g?(v=/* @__PURE__ */ _(`span`,{ref:c,"data-slot":h,className:g,...s,children:m}),t[13]=m,t[14]=s,t[15]=c,t[16]=h,t[17]=g,t[18]=v):v=t[18],v},S=e=>{let t=l(16),i,a,o,s,u;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],u=t[5]):({"data-slot":o,asChild:i,className:a,ref:u,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=u);let d=i?c:`div`,f;t[6]===o?f=t[7]:(f=r(o,`choice-content`),t[6]=o,t[7]=f);let p;t[8]===a?p=t[9]:(p=n(`flex min-w-0 flex-1 flex-col gap-0.5`,a),t[8]=a,t[9]=p);let m;return t[10]!==d||t[11]!==s||t[12]!==u||t[13]!==f||t[14]!==p?(m=/* @__PURE__ */ _(d,{ref:u,"data-slot":f,className:p,...s}),t[10]=d,t[11]=s,t[12]=u,t[13]=f,t[14]=p,t[15]=m):m=t[15],m},C=e=>{let i=l(17),a,s,c,u;i[0]===e?(a=i[1],s=i[2],c=i[3],u=i[4]):({"data-slot":s,className:a,ref:u,...c}=e,i[0]=e,i[1]=a,i[2]=s,i[3]=c,i[4]=u);let{controlId:d,disabled:f,labelRef:p}=y(`Label`),m=t(p,u),h;i[5]===s?h=i[6]:(h=r(s,`choice-label`),i[5]=s,i[6]=h);let g=f&&`opacity-50`,v;i[7]!==a||i[8]!==g?(v=n(g,a),i[7]=a,i[8]=g,i[9]=v):v=i[9];let b;return i[10]!==m||i[11]!==d||i[12]!==f||i[13]!==c||i[14]!==h||i[15]!==v?(b=/* @__PURE__ */ _(o,{ref:m,"data-slot":h,className:v,...c,htmlFor:d,disabled:f}),i[10]=m,i[11]=d,i[12]=f,i[13]=c,i[14]=h,i[15]=v,i[16]=b):b=i[16],b},w=t=>{let i=l(23),a,o,u,d,f,h;i[0]===t?(a=i[1],o=i[2],u=i[3],d=i[4],f=i[5],h=i[6]):({"data-slot":u,asChild:a,className:o,id:d,ref:h,...f}=t,i[0]=t,i[1]=a,i[2]=o,i[3]=u,i[4]=d,i[5]=f,i[6]=h);let{disabled:g}=y(`Title`),v=p(s),b=m(),x=d??b,S,C;i[7]!==v||i[8]!==x?(S=()=>v?.registerLabelId(x),C=[v,x],i[7]=v,i[8]=x,i[9]=S,i[10]=C):(S=i[9],C=i[10]),e(S,C);let w=a?c:`p`,T;i[11]===u?T=i[12]:(T=r(u,`choice-title`),i[11]=u,i[12]=T);let E=g&&`opacity-50`,D;i[13]!==o||i[14]!==E?(D=n(`text-strong text-sm font-medium font-sans`,E,o),i[13]=o,i[14]=E,i[15]=D):D=i[15];let O;return i[16]!==w||i[17]!==f||i[18]!==h||i[19]!==T||i[20]!==D||i[21]!==x?(O=/* @__PURE__ */ _(w,{ref:h,"data-slot":T,className:D,...f,id:x}),i[16]=w,i[17]=f,i[18]=h,i[19]=T,i[20]=D,i[21]=x,i[22]=O):O=i[22],O};function T(e){return e.defaultPrevented||i(e.target,e.currentTarget)?!1:e.currentTarget.closest(`label`)==null}const E={Root:b,Indicator:x,Content:S,Label:C,Title:w,Description:t=>{let i=l(28),a,o,u,d,f,m;i[0]===t?(a=i[1],o=i[2],u=i[3],d=i[4],f=i[5],m=i[6]):({"data-slot":u,asChild:a,className:o,onClick:d,ref:m,...f}=t,i[0]=t,i[1]=a,i[2]=o,i[3]=u,i[4]=d,i[5]=f,i[6]=m);let{descriptionId:h,disabled:g,labelRef:v}=y(`Description`),b=p(s),x,S;i[7]!==h||i[8]!==b?(x=()=>b?.registerDescriptionId(h),S=[b,h],i[7]=h,i[8]=b,i[9]=x,i[10]=S):(x=i[9],S=i[10]),e(x,S);let C=a?c:`p`,w;i[11]===u?w=i[12]:(w=r(u,`choice-description`),i[11]=u,i[12]=w);let E=!g&&`[[data-slot~=choice-label]~&]:cursor-pointer`,D=g&&`opacity-50`,O;i[13]!==o||i[14]!==E||i[15]!==D?(O=n(`text-body text-sm leading-4`,E,D,o),i[13]=o,i[14]=E,i[15]=D,i[16]=O):O=i[16];let k;i[17]!==v||i[18]!==d?(k=e=>{d?.(e),T(e)&&(v.current?.click(),e.preventDefault())},i[17]=v,i[18]=d,i[19]=k):k=i[19];let A;return i[20]!==C||i[21]!==h||i[22]!==f||i[23]!==m||i[24]!==w||i[25]!==O||i[26]!==k?(A=/* @__PURE__ */ _(C,{ref:m,"data-slot":w,className:O,onClick:k,...f,id:h}),i[20]=C,i[21]=h,i[22]=f,i[23]=m,i[24]=w,i[25]=O,i[26]=k,i[27]=A):A=i[27],A}};export{E as t};
package/dist/choice.d.ts CHANGED
@@ -1,2 +1,7 @@
1
- import { n as ChoiceRootProps, t as Choice } from "./choice-BLR0_MeB.js";
1
+ /**
2
+ * Re-exports for the Choice component.
3
+ *
4
+ * @see https://mantle.ngrok.com/components/forms/choice
5
+ */
6
+ import { n as ChoiceRootProps, t as Choice } from "./choice-BwfmbepO.js";
2
7
  export { Choice, type ChoiceRootProps };
package/dist/choice.js CHANGED
@@ -1 +1 @@
1
- export{t as Choice}from"./choice-2Lrv8_nl.js";
1
+ export{t as Choice}from"./choice-uyYccm0A.js";
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Re-exports for the Code Block component.
3
+ *
4
+ * @see https://mantle.ngrok.com/components/data-display/code-block
5
+ */
1
6
  import { n as WithAsChild, t as SelfClosingWithAsChild } from "./as-child-DFxX3U2i.js";
2
7
  import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
3
8
  import { t as SvgAttributes } from "./icon-CgNqu-fl.js";
@@ -45,7 +50,7 @@ type CodeBlockRootProps = Omit<ComponentProps<"div">, "align"> & WithAsChild & {
45
50
  * </CodeBlock.Root>
46
51
  * ```
47
52
  */
48
- declare const Root$1: ({ "data-slot": dataSlot, asChild, className, defaultTab, activeTab, onActiveTabChange, ref, ...props }: CodeBlockRootProps) => import("react").JSX.Element;
53
+ declare const Root: ({ "data-slot": dataSlot, asChild, className, defaultTab, activeTab, onActiveTabChange, ref, ...props }: CodeBlockRootProps) => import("react").JSX.Element;
49
54
  /**
50
55
  * The body of the `CodeBlock`. This is where `CodeBlock.Code` and
51
56
  * the optional `CodeBlock.CopyButton` are rendered.
@@ -375,6 +380,12 @@ declare const TabContent: ({ "data-slot": dataSlot, ...props }: CodeBlockTabCont
375
380
  *
376
381
  * Use `mantleCodeBlockPlugins()` to enable pre-rendering at build time.
377
382
  *
383
+ * @useWhen Show a block of code with syntax highlighting and a copy button.
384
+ *
385
+ * @siblings
386
+ * - `Code`: the code is a short fragment inside a sentence.
387
+ * - `TruncatedText`: one long opaque value must stay on one line.
388
+ *
378
389
  * @see https://mantle.ngrok.com/components/data-display/code-block
379
390
  *
380
391
  * @example
@@ -456,7 +467,7 @@ declare const CodeBlock: {
456
467
  * </CodeBlock.Root>
457
468
  * ```
458
469
  */
459
- readonly Root: typeof Root$1;
470
+ readonly Root: typeof Root;
460
471
  /**
461
472
  * The body of the `CodeBlock`. Contains `Code` and optional `CopyButton`.
462
473
  *
@@ -1,4 +1,4 @@
1
- import{t as e}from"./use-isomorphic-layout-effect-CLSmHzo4.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{t as i}from"./icon-kK0c-POG.js";import{t as a}from"./slot-DdYN1L1C.js";import{r as o}from"./button-Dge0D5bl.js";import{t as s}from"./button-B8k98Pby.js";import{t as c}from"./use-copy-to-clipboard-Dy_0Qzb7.js";import{t as l}from"./alternate-announcement-BkH4bOKp.js";import{t as u}from"./live-region-DQ1QLv3L.js";import{t as d}from"./icons-CSwTVV2m.js";import{S as f,_ as p,a as m,b as h,c as g,d as _,f as v,g as y,h as b,i as x,l as S,m as C,n as w,o as T,p as E,r as D,s as O,t as k,u as A,v as j,y as M}from"./code-block-W3kWPxCJ.js";import{c as N}from"react/compiler-runtime";import{CaretDownIcon as P}from"@phosphor-icons/react/CaretDown";import{createContext as F,useContext as I,useEffect as ee,useId as L,useLayoutEffect as te,useRef as R,useState as z}from"react";import B from"tiny-invariant";import{jsx as V,jsxs as H}from"react/jsx-runtime";import{CheckIcon as ne}from"@phosphor-icons/react/Check";import{CopyIcon as U}from"@phosphor-icons/react/Copy";import{FileTextIcon as re}from"@phosphor-icons/react/FileText";import{TerminalIcon as ie}from"@phosphor-icons/react/Terminal";import{Content as W,List as G,Root as K,Trigger as ae}from"@radix-ui/react-tabs";function oe(e){let t=-1;for(let n=0;n<e.length;n++){let r=e[n];if(r===`&`||r===`<`||r===`>`||r===`"`||r===`'`){t=n;break}}if(t===-1)return e;let n=e.slice(0,t);for(let r=t;r<e.length;r++){let t=e[r];switch(t){case`&`:n+=`&amp;`;break;case`<`:n+=`&lt;`;break;case`>`:n+=`&gt;`;break;case`"`:n+=`&quot;`;break;case`'`:n+=`&#39;`;break;default:n+=t}}return n}const q=/* @__PURE__ */ new WeakMap;function J(e){let t=/* @__PURE__ */ new Set;if(e==null||e===``)return t;for(let n of e.split(` `))n!==``&&t.add(n);return t}function Y(e){let t=q.get(e);if(t!=null&&le(t))return t;let n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new WeakMap,i=e.querySelectorAll(`[data-fold-regions]`);for(let e=0;e<i.length;e+=1){let t=i[e];if(!(t instanceof HTMLElement))continue;let a=J(t.dataset.foldRegions);if(a.size!==0){r.set(t,a);for(let e of a){let r=n.get(e);r??(r=[],n.set(e,r)),r.push(t)}}}let a={regionToLines:n,lineToRegions:r};return q.set(e,a),a}function se(e){q.delete(e)}function ce(e){se(e),e.removeAttribute(`data-folded-regions`)}function le(e){for(let t of e.regionToLines.values()){if(t.length===0)continue;let e=t[0];if(e!=null)return e.isConnected}return!0}function ue(e,t,n){let r=!1;for(let e of n)if(t.has(e)){r=!0;break}r?e.dataset.foldHidden=`true`:delete e.dataset.foldHidden}function X(e){let t=e.dataset.foldLine;if(t==null||t===``)return!1;let n=e.closest(`[data-slot='code-block-code']`)?.querySelector(`code`);if(n==null)return!1;let r=J(n.getAttribute(`data-folded-regions`)),i=!r.has(t);i?r.add(t):r.delete(t),r.size===0?n.removeAttribute(`data-folded-regions`):n.setAttribute(`data-folded-regions`,[...r].join(` `)),e.setAttribute(`aria-expanded`,i?`false`:`true`);let{regionToLines:a,lineToRegions:o}=Y(n),s=a.get(t);if(s!=null)for(let e of s){let t=o.get(e);t!=null&&ue(e,r,t)}return!0}const Z=e=>{let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`.mantle-code-fold-toggle`);n instanceof HTMLButtonElement&&X(n)};function de(e){return e.addEventListener(`click`,Z),()=>{e.removeEventListener(`click`,Z)}}const Q=F(null);function fe(){let e=I(Q);return B(e!=null,`CodeBlock subcomponents must be rendered within a <CodeBlock.Root>.`),e}const $=e=>{let t=N(34),i,o,s,c,l,u,d,f;t[0]===e?(i=t[1],o=t[2],s=t[3],c=t[4],l=t[5],u=t[6],d=t[7],f=t[8]):({"data-slot":s,asChild:f,className:o,defaultTab:c,activeTab:i,onActiveTabChange:l,ref:d,...u}=e,t[0]=e,t[1]=i,t[2]=o,t[3]=s,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f);let p=f!==void 0&&f,m=R(``),h=L(),g=R(0),[_,v]=z(!1),[y,b]=z(!1),x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{B(g.current===0,`You can only render a single CodeBlock.Code within a CodeBlock.`),g.current+=1},t[9]=x):x=t[9];let S=x,C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{--g.current},t[10]=C):C=t[10];let w=C,T;t[11]!==h||t[12]!==_||t[13]!==y?(T={codeId:h,copyTextRef:m,hasCodeExpander:_,isCodeExpanded:y,registerCode:S,setHasCodeExpander:v,setIsCodeExpanded:b,unregisterCode:w},t[11]=h,t[12]=_,t[13]=y,t[14]=T):T=t[14];let E=T,D=c!=null||i!=null,O=p?a:`div`,k;t[15]===s?k=t[16]:(k=r(s,`code-block`),t[15]=s,t[16]=k);let A;t[17]===o?A=t[18]:(A=n(`text-mono w-full overflow-hidden rounded-md border border-gray-300 bg-base font-mono`,`[&_svg]:shrink-0`,o),t[17]=o,t[18]=A);let j;t[19]!==O||t[20]!==u||t[21]!==d||t[22]!==k||t[23]!==A?(j=/* @__PURE__ */ V(O,{"data-slot":k,className:A,ref:d,...u}),t[19]=O,t[20]=u,t[21]=d,t[22]=k,t[23]=A,t[24]=j):j=t[24];let M=j,P;t[25]!==i||t[26]!==c||t[27]!==D||t[28]!==l||t[29]!==M?(P=D?/* @__PURE__ */ V(K,{asChild:!0,defaultValue:c,value:i,onValueChange:l,children:M}):M,t[25]=i,t[26]=c,t[27]=D,t[28]=l,t[29]=M,t[30]=P):P=t[30];let F;return t[31]!==E||t[32]!==P?(F=/* @__PURE__ */ V(Q.Provider,{value:E,children:P}),t[31]=E,t[32]=P,t[33]=F):F=t[33],F},pe=e=>{let t=N(16),i,o,s,c,l;t[0]===e?(i=t[1],o=t[2],s=t[3],c=t[4],l=t[5]):({"data-slot":o,asChild:l,className:i,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=o,t[3]=s,t[4]=c,t[5]=l);let u=l!==void 0&&l?a:`div`,d;t[6]===o?d=t[7]:(d=r(o,`code-block-body`),t[6]=o,t[7]=d);let f;t[8]===i?f=t[9]:(f=n(`relative`,`[&_.mantle-code-line]:pr-4`,`[&:has([data-slot=code-block-copy-button])_.mantle-code-line:nth-child(-n+2)]:pr-14`,i),t[8]=i,t[9]=f);let p;return t[10]!==u||t[11]!==s||t[12]!==c||t[13]!==d||t[14]!==f?(p=/* @__PURE__ */ V(u,{"data-slot":d,className:f,ref:c,...s}),t[10]=u,t[11]=s,t[12]=c,t[13]=d,t[14]=f,t[15]=p):p=t[15],p},me=/SHIKI_VAL_(\d+)/g;function he(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const ge=/* @__PURE__ */ new Map;function _e(e){if(e==null||e.length===0)return me;let t=ge.get(e);return t??(ge.size>=500&&ge.clear(),t=RegExp(`${he(e)}(\\d+)__`,`g`),ge.set(e,t)),t}function ve({input:e,vals:t,preValToken:n,mapValue:r}){if(n==null){if(!e.includes(`SHIKI_VAL_`))return e}else if(!e.includes(n))return e;return e.replaceAll(_e(n),(e,n)=>{let i=Number.parseInt(n,10);return Number.isNaN(i)||i<0||i>=t.length?e:r(t[i])})}function ye(e,t,n){return ve({input:e,vals:t,preValToken:n,mapValue:e=>oe(String(e))})}function be(e,t,n){return ve({input:e,vals:t,preValToken:n,mapValue:e=>String(e)})}const xe=e=>{let r=N(58),i,a,o,s,c;r[0]===e?(i=r[1],a=r[2],o=r[3],s=r[4],c=r[5]):({className:i,style:s,value:c,ref:o,...a}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=s,r[5]=c);let l=R(null),u=t(l,o),{codeId:d,copyTextRef:f,hasCodeExpander:p,isCodeExpanded:m,registerCode:h,unregisterCode:g}=fe(),{language:_,code:v,"~preValToken":y,"~preVals":b,"~highlightLines":x,"~lineNumberStart":S,"~preHtml":C,"~showLineNumbers":w}=c,T=x,E=S??1,D=w??!1,O;r[6]!==y||r[7]!==b||r[8]!==v?(O=b!=null&&b.length>0?be(v,b,y):v,r[6]=y,r[7]=b,r[8]=v,r[9]=O):O=r[9];let k=O,A,j;r[10]!==k||r[11]!==f?(A=()=>{f.current=k},j=[f,k],r[10]=k,r[11]=f,r[12]=A,r[13]=j):(A=r[12],j=r[13]),te(A,j);let M,P;r[14]!==h||r[15]!==g?(M=()=>(h(),()=>{g()}),P=[h,g],r[14]=h,r[15]=g,r[16]=M,r[17]=P):(M=r[16],P=r[17]),ee(M,P);let F;bb0:{if(C==null){F=void 0;break bb0}let e;r[18]!==C||r[19]!==y||r[20]!==b?(e=b!=null&&b.length>0?ye(C,b,y):C,r[18]=C,r[19]=y,r[20]=b,r[21]=e):e=r[21],F=e}let I=F,L,z;r[22]===I?(L=r[23],z=r[24]):(L=()=>{let e=l.current;if(e==null||I==null)return;let t=e.querySelector(`code`);return t!=null&&ce(t),de(e)},z=[I],r[22]=I,r[23]=L,r[24]=z),ee(L,z);let B=I!=null,H;r[25]!==k||r[26]!==I?(H=I??oe(k),r[25]=k,r[26]=I,r[27]=H):H=r[27];let ne=H,U;r[28]===ne?U=r[29]:(U={__html:ne},r[28]=ne,r[29]=U);let re=U,ie=m?`expanded`:`collapsed`,W;r[30]===s?W=r[31]:(W=s??{},r[30]=s,r[31]=W);let G;if(r[32]!==W){let{MozTabSize:e,...t}=W;G=t,r[32]=W,r[33]=G}else G=r[33];let K=p?ie:void 0,ae=!B&&`pr-14`,q;r[34]!==i||r[35]!==ae?(q=n(`scrollbar overflow-x-auto overscroll-x-none overflow-y-hidden py-4`,ae,`data-[mantle-line-numbers~='false']:pl-4`,`text-mono m-0 font-mono outline-hidden`,`data-[state=collapsed]:max-h-[13.6rem]`,i),r[34]=i,r[35]=ae,r[36]=q):q=r[36];let J=B?`true`:`false`,Y;r[37]!==T||r[38]!==B?(Y=B&&T!=null&&T.length>0?T.join(`,`):void 0,r[37]=T,r[38]=B,r[39]=Y):Y=r[39];let se=B&&D?String(E):`1`,le=B&&D?`true`:`false`,ue=String(E),X;r[40]!==G||r[41]!==ue?(X={...G,"--mantle-line-number-start":ue,tabSize:2},r[40]=G,r[41]=ue,r[42]=X):X=r[42];let Z=X,Q;r[43]===re?Q=r[44]:(Q=/* @__PURE__ */ V(`code`,{className:`text-size-inherit block min-w-full w-max`,dangerouslySetInnerHTML:re}),r[43]=re,r[44]=Q);let $;return r[45]!==d||r[46]!==u||r[47]!==_||r[48]!==a||r[49]!==K||r[50]!==q||r[51]!==J||r[52]!==Y||r[53]!==se||r[54]!==le||r[55]!==Z||r[56]!==Q?($=/* @__PURE__ */ V(`pre`,{"data-slot":`code-block-code`,"data-state":K,className:q,"data-highlighted":J,"data-lang":_,"data-mantle-highlight-lines":Y,"data-mantle-line-number-start":se,"data-mantle-line-numbers":le,id:d,ref:u,style:Z,...a,translate:`no`,children:Q}),r[45]=d,r[46]=u,r[47]=_,r[48]=a,r[49]=K,r[50]=q,r[51]=J,r[52]=Y,r[53]=se,r[54]=le,r[55]=Z,r[56]=Q,r[57]=$):$=r[57],$},Se=e=>{let t=N(16),i,o,s,c,l;t[0]===e?(i=t[1],o=t[2],s=t[3],c=t[4],l=t[5]):({"data-slot":o,asChild:l,className:i,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=o,t[3]=s,t[4]=c,t[5]=l);let u=l!==void 0&&l?a:`div`,d;t[6]===o?d=t[7]:(d=r(o,`code-block-header`),t[6]=o,t[7]=d);let f;t[8]===i?f=t[9]:(f=n(`flex items-center gap-1 border-b border-gray-300 bg-base px-4 py-2 text-gray-700`,i),t[8]=i,t[9]=f);let p;return t[10]!==u||t[11]!==s||t[12]!==c||t[13]!==d||t[14]!==f?(p=/* @__PURE__ */ V(u,{"data-slot":d,className:f,ref:c,...s}),t[10]=u,t[11]=s,t[12]=c,t[13]=d,t[14]=f,t[15]=p):p=t[15],p},Ce=e=>{let t=N(16),i,o,s,c,l;t[0]===e?(i=t[1],o=t[2],s=t[3],c=t[4],l=t[5]):({"data-slot":o,asChild:l,className:i,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=o,t[3]=s,t[4]=c,t[5]=l);let u=l!==void 0&&l?a:`h3`,d;t[6]===o?d=t[7]:(d=r(o,`code-block-title`),t[6]=o,t[7]=d);let f;t[8]===i?f=t[9]:(f=n(`m-0 font-sans text-xs font-medium`,i),t[8]=i,t[9]=f);let p;return t[10]!==u||t[11]!==s||t[12]!==c||t[13]!==d||t[14]!==f?(p=/* @__PURE__ */ V(u,{"data-slot":d,ref:c,className:f,translate:`no`,...s}),t[10]=u,t[11]=s,t[12]=c,t[13]=d,t[14]=f,t[15]=p):p=t[15],p},we=e=>{let t=N(33),r,i,a,d,f,p,m;t[0]===e?(r=t[1],i=t[2],a=t[3],d=t[4],f=t[5],p=t[6],m=t[7]):({className:r,label:m,onCopy:a,onCopyError:d,onClick:i,ref:p,...f}=e,t[0]=e,t[1]=r,t[2]=i,t[3]=a,t[4]=d,t[5]=f,t[6]=p,t[7]=m);let h=m===void 0?`Copy code`:m,{copyTextRef:g}=fe(),_=c(),[v,y]=z(``),b=v!==``,x=R(!1),S=R(void 0),C,w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>()=>{S.current!=null&&clearTimeout(S.current)},w=[],t[8]=C,t[9]=w):(C=t[8],w=t[9]),ee(C,w);let T;t[10]===v?T=t[11]:(T=/* @__PURE__ */ V(u,{children:v}),t[10]=v,t[11]=T);let E=b?`check`:`copy`,D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D={check:/* @__PURE__ */ V(ne,{}),copy:/* @__PURE__ */ V(U,{})},t[12]=D):D=t[12];let O;t[13]===E?O=t[14]:(O=/* @__PURE__ */ V(o,{active:E,icons:D}),t[13]=E,t[14]=O);let k;t[15]===r?k=t[16]:(k=n(`bg-base not-disabled:hover:bg-neutral-500/15`,r),t[15]=r,t[16]=k);let A;t[17]!==g||t[18]!==_||t[19]!==i||t[20]!==a||t[21]!==d?(A=async e=>{try{if(i?.(e),e.defaultPrevented){S.current!=null&&clearTimeout(S.current);return}let t=g.current;await _(t),a?.(t),y(l(`Copied`,x)),S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{y(``)},2e3)}catch(e){d?.(e)}},t[17]=g,t[18]=_,t[19]=i,t[20]=a,t[21]=d,t[22]=A):A=t[22];let j;t[23]!==h||t[24]!==f||t[25]!==p||t[26]!==O||t[27]!==k||t[28]!==A?(j=/* @__PURE__ */ V(s,{type:`button`,appearance:`ghost`,intent:`neutral`,size:`sm`,label:h,icon:O,className:k,ref:p,onClick:A,...f}),t[23]=h,t[24]=f,t[25]=p,t[26]=O,t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;return t[30]!==j||t[31]!==T?(M=/* @__PURE__ */ H(`span`,{"data-slot":`code-block-copy-button`,className:`absolute right-3 top-3 z-10 inline-flex size-7 items-center justify-center rounded-(--icon-button-border-radius,0.375rem) bg-base`,children:[T,j]}),t[30]=j,t[31]=T,t[32]=M):M=t[32],M},Te=t=>{let a=N(31),o,s,c,l,u;a[0]===t?(o=a[1],s=a[2],c=a[3],l=a[4],u=a[5]):({"data-slot":s,className:o,onClick:c,ref:u,...l}=t,a[0]=t,a[1]=o,a[2]=s,a[3]=c,a[4]=l,a[5]=u);let{codeId:d,isCodeExpanded:f,setIsCodeExpanded:p,setHasCodeExpander:m}=fe(),h,g;a[6]===m?(h=a[7],g=a[8]):(h=()=>(m(!0),()=>{m(!1)}),g=[m],a[6]=m,a[7]=h,a[8]=g),e(h,g);let _;a[9]===s?_=a[10]:(_=r(s,`code-block-expander-button`),a[9]=s,a[10]=_);let v;a[11]===o?v=a[12]:(v=n(`flex w-full items-center justify-center gap-0.5 border-t border-gray-300 bg-base px-4 py-2 font-sans text-gray-700 hover:bg-base-hover`,o),a[11]=o,a[12]=v);let y;a[13]!==c||a[14]!==p?(y=e=>{p(Oe),c?.(e)},a[13]=c,a[14]=p,a[15]=y):y=a[15];let b=f?`Show less`:`Show more`,x;a[16]===Symbol.for(`react.memo_cache_sentinel`)?(x=/* @__PURE__ */ V(P,{weight:`bold`}),a[16]=x):x=a[16];let S=f&&`rotate-180`,C;a[17]===S?C=a[18]:(C=n(`size-4`,S,`transition-transform duration-200 ease-out-strong motion-reduce:transition-none`),a[17]=S,a[18]=C);let w;a[19]===C?w=a[20]:(w=/* @__PURE__ */ V(i,{svg:x,className:C}),a[19]=C,a[20]=w);let T;return a[21]!==d||a[22]!==f||a[23]!==l||a[24]!==u||a[25]!==w||a[26]!==_||a[27]!==v||a[28]!==y||a[29]!==b?(T=/* @__PURE__ */ H(`button`,{...l,"data-slot":_,"aria-controls":d,"aria-expanded":f,className:v,ref:u,type:`button`,onClick:y,children:[b,` `,w]}),a[21]=d,a[22]=f,a[23]=l,a[24]=u,a[25]=w,a[26]=_,a[27]=v,a[28]=y,a[29]=b,a[30]=T):T=a[30],T};function Ee(e){let t=N(18),a,o,s,c,l;t[0]===e?(a=t[1],o=t[2],s=t[3],c=t[4],l=t[5]):({"data-slot":s,className:o,preset:c,svg:a,...l}=e,t[0]=e,t[1]=a,t[2]=o,t[3]=s,t[4]=c,t[5]=l);let u=a;if(c!=null)bb0:switch(c){case`file`:{let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=/* @__PURE__ */ V(re,{weight:`fill`}),t[6]=e):e=t[6],u=e;break bb0}case`cli`:{let e;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=/* @__PURE__ */ V(ie,{weight:`fill`}),t[7]=e):e=t[7],u=e;break bb0}case`traffic-policy`:{let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=/* @__PURE__ */ V(d,{}),t[8]=e):e=t[8],u=e}}let f;t[9]===s?f=t[10]:(f=r(s,`code-block-icon`),t[9]=s,t[10]=f);let p;t[11]===o?p=t[12]:(p=n(`size-5`,o),t[11]=o,t[12]=p);let m;return t[13]!==l||t[14]!==u||t[15]!==f||t[16]!==p?(m=/* @__PURE__ */ V(i,{"data-slot":f,className:p,svg:u,...l}),t[13]=l,t[14]=u,t[15]=f,t[16]=p,t[17]=m):m=t[17],m}const De={Root:$,Body:pe,Code:xe,CopyButton:we,ExpanderButton:Te,Header:Se,Icon:Ee,TabContent:e=>{let t=N(8),n,i;t[0]===e?(n=t[1],i=t[2]):({"data-slot":n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let a;t[3]===n?a=t[4]:(a=r(n,`code-block-tab-content`),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=/* @__PURE__ */ V(W,{"data-slot":a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o},TabList:e=>{let t=N(14),i,a,o,s;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4]):({"data-slot":a,className:i,ref:s,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s);let c;t[5]===a?c=t[6]:(c=r(a,`code-block-tab-list`),t[5]=a,t[6]=c);let l;t[7]===i?l=t[8]:(l=n(`scroll-fade-x flex min-w-0 items-center gap-1 overflow-x-auto overscroll-x-none`,`-m-1 p-1`,i),t[7]=i,t[8]=l);let u;return t[9]!==o||t[10]!==s||t[11]!==c||t[12]!==l?(u=/* @__PURE__ */ V(G,{"data-slot":c,className:l,ref:s,...o}),t[9]=o,t[10]=s,t[11]=c,t[12]=l,t[13]=u):u=t[13],u},TabTrigger:e=>{let t=N(14),i,a,o,s;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4]):({"data-slot":a,className:i,ref:s,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s);let c;t[5]===a?c=t[6]:(c=r(a,`code-block-tab-trigger`),t[5]=a,t[6]=c);let l;t[7]===i?l=t[8]:(l=n(`shrink-0 cursor-pointer rounded px-1.5 py-0.5 font-sans text-xs font-medium whitespace-nowrap`,`text-gray-600 outline-hidden`,`hover:text-gray-900`,`data-[state=active]:bg-neutral-500/15 data-[state=active]:text-strong`,`focus-visible:ring-focus-accent focus-visible:ring-4`,i),t[7]=i,t[8]=l);let u;return t[9]!==o||t[10]!==s||t[11]!==c||t[12]!==l?(u=/* @__PURE__ */ V(ae,{"data-slot":c,className:l,ref:s,...o}),t[9]=o,t[10]=s,t[11]=c,t[12]=l,t[13]=u):u=t[13],u},Title:Ce};function Oe(e){return!e}const ke=`var(--shiki-foreground)`;function Ae(e){return e.replace(/[&<]/g,e=>e===`&`?`&#x26;`:`&#x3C;`)}function je(e){return e===` `||e===` `||e===`
1
+ import{t as e}from"./use-copy-to-clipboard-Dy_0Qzb7.js";import{t}from"./use-isomorphic-layout-effect-CLSmHzo4.js";import{t as n}from"./alternate-announcement-BkH4bOKp.js";import{n as r}from"./compose-refs-sFdxsL7k.js";import{t as i}from"./cx-CK7o_rVv.js";import{t as a}from"./data-slot-EM6s2WEU.js";import{t as o}from"./icon-kK0c-POG.js";import{r as s}from"./button-Cu9e3SM7.js";import{t as c}from"./icons-CSwTVV2m.js";import{t as l}from"./button-BWGUuWnu.js";import{t as u}from"./live-region-DQ1QLv3L.js";import{t as d}from"./slot-DdYN1L1C.js";import{S as f,_ as p,a as m,b as h,c as g,d as _,f as v,g as y,h as b,i as x,l as S,m as C,n as w,o as T,p as E,r as D,s as O,t as k,u as A,v as j,y as M}from"./code-block-W3kWPxCJ.js";import{c as N}from"react/compiler-runtime";import{CaretDownIcon as P}from"@phosphor-icons/react/CaretDown";import{createContext as F,useContext as I,useEffect as ee,useId as L,useLayoutEffect as te,useRef as R,useState as z}from"react";import B from"tiny-invariant";import{jsx as V,jsxs as H}from"react/jsx-runtime";import{CheckIcon as ne}from"@phosphor-icons/react/Check";import{CopyIcon as U}from"@phosphor-icons/react/Copy";import{FileTextIcon as re}from"@phosphor-icons/react/FileText";import{TerminalIcon as ie}from"@phosphor-icons/react/Terminal";import{Content as W,List as G,Root as K,Trigger as ae}from"@radix-ui/react-tabs";function oe(e){let t=-1;for(let n=0;n<e.length;n++){let r=e[n];if(r===`&`||r===`<`||r===`>`||r===`"`||r===`'`){t=n;break}}if(t===-1)return e;let n=e.slice(0,t);for(let r=t;r<e.length;r++){let t=e[r];switch(t){case`&`:n+=`&amp;`;break;case`<`:n+=`&lt;`;break;case`>`:n+=`&gt;`;break;case`"`:n+=`&quot;`;break;case`'`:n+=`&#39;`;break;default:n+=t}}return n}const q=/* @__PURE__ */ new WeakMap;function J(e){let t=/* @__PURE__ */ new Set;if(e==null||e===``)return t;for(let n of e.split(` `))n!==``&&t.add(n);return t}function Y(e){let t=q.get(e);if(t!=null&&le(t))return t;let n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new WeakMap,i=e.querySelectorAll(`[data-fold-regions]`);for(let e=0;e<i.length;e+=1){let t=i[e];if(!(t instanceof HTMLElement))continue;let a=J(t.dataset.foldRegions);if(a.size!==0){r.set(t,a);for(let e of a){let r=n.get(e);r??(r=[],n.set(e,r)),r.push(t)}}}let a={regionToLines:n,lineToRegions:r};return q.set(e,a),a}function se(e){q.delete(e)}function ce(e){se(e),e.removeAttribute(`data-folded-regions`)}function le(e){for(let t of e.regionToLines.values()){if(t.length===0)continue;let e=t[0];if(e!=null)return e.isConnected}return!0}function ue(e,t,n){let r=!1;for(let e of n)if(t.has(e)){r=!0;break}r?e.dataset.foldHidden=`true`:delete e.dataset.foldHidden}function X(e){let t=e.dataset.foldLine;if(t==null||t===``)return!1;let n=e.closest(`[data-slot='code-block-code']`)?.querySelector(`code`);if(n==null)return!1;let r=J(n.getAttribute(`data-folded-regions`)),i=!r.has(t);i?r.add(t):r.delete(t),r.size===0?n.removeAttribute(`data-folded-regions`):n.setAttribute(`data-folded-regions`,[...r].join(` `)),e.setAttribute(`aria-expanded`,i?`false`:`true`);let{regionToLines:a,lineToRegions:o}=Y(n),s=a.get(t);if(s!=null)for(let e of s){let t=o.get(e);t!=null&&ue(e,r,t)}return!0}const Z=e=>{let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`.mantle-code-fold-toggle`);n instanceof HTMLButtonElement&&X(n)};function de(e){return e.addEventListener(`click`,Z),()=>{e.removeEventListener(`click`,Z)}}const Q=F(null);function fe(){let e=I(Q);return B(e!=null,`CodeBlock subcomponents must be rendered within a <CodeBlock.Root>.`),e}const $=e=>{let t=N(34),n,r,o,s,c,l,u,f;t[0]===e?(n=t[1],r=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],f=t[8]):({"data-slot":o,asChild:f,className:r,defaultTab:s,activeTab:n,onActiveTabChange:c,ref:u,...l}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=f);let p=f!==void 0&&f,m=R(``),h=L(),g=R(0),[_,v]=z(!1),[y,b]=z(!1),x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{B(g.current===0,`You can only render a single CodeBlock.Code within a CodeBlock.`),g.current+=1},t[9]=x):x=t[9];let S=x,C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{--g.current},t[10]=C):C=t[10];let w=C,T;t[11]!==h||t[12]!==_||t[13]!==y?(T={codeId:h,copyTextRef:m,hasCodeExpander:_,isCodeExpanded:y,registerCode:S,setHasCodeExpander:v,setIsCodeExpanded:b,unregisterCode:w},t[11]=h,t[12]=_,t[13]=y,t[14]=T):T=t[14];let E=T,D=s!=null||n!=null,O=p?d:`div`,k;t[15]===o?k=t[16]:(k=a(o,`code-block`),t[15]=o,t[16]=k);let A;t[17]===r?A=t[18]:(A=i(`text-mono w-full overflow-hidden rounded-md border border-gray-300 bg-base font-mono`,`[&_svg]:shrink-0`,r),t[17]=r,t[18]=A);let j;t[19]!==O||t[20]!==l||t[21]!==u||t[22]!==k||t[23]!==A?(j=/* @__PURE__ */ V(O,{"data-slot":k,className:A,ref:u,...l}),t[19]=O,t[20]=l,t[21]=u,t[22]=k,t[23]=A,t[24]=j):j=t[24];let M=j,P;t[25]!==n||t[26]!==s||t[27]!==D||t[28]!==c||t[29]!==M?(P=D?/* @__PURE__ */ V(K,{asChild:!0,defaultValue:s,value:n,onValueChange:c,children:M}):M,t[25]=n,t[26]=s,t[27]=D,t[28]=c,t[29]=M,t[30]=P):P=t[30];let F;return t[31]!==E||t[32]!==P?(F=/* @__PURE__ */ V(Q.Provider,{value:E,children:P}),t[31]=E,t[32]=P,t[33]=F):F=t[33],F},pe=e=>{let t=N(16),n,r,o,s,c;t[0]===e?(n=t[1],r=t[2],o=t[3],s=t[4],c=t[5]):({"data-slot":r,asChild:c,className:n,ref:s,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=s,t[5]=c);let l=c!==void 0&&c?d:`div`,u;t[6]===r?u=t[7]:(u=a(r,`code-block-body`),t[6]=r,t[7]=u);let f;t[8]===n?f=t[9]:(f=i(`relative`,`[&_.mantle-code-line]:pr-4`,`[&:has([data-slot=code-block-copy-button])_.mantle-code-line:nth-child(-n+2)]:pr-14`,n),t[8]=n,t[9]=f);let p;return t[10]!==l||t[11]!==o||t[12]!==s||t[13]!==u||t[14]!==f?(p=/* @__PURE__ */ V(l,{"data-slot":u,className:f,ref:s,...o}),t[10]=l,t[11]=o,t[12]=s,t[13]=u,t[14]=f,t[15]=p):p=t[15],p},me=/SHIKI_VAL_(\d+)/g;function he(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const ge=/* @__PURE__ */ new Map;function _e(e){if(e==null||e.length===0)return me;let t=ge.get(e);return t??(ge.size>=500&&ge.clear(),t=RegExp(`${he(e)}(\\d+)__`,`g`),ge.set(e,t)),t}function ve({input:e,vals:t,preValToken:n,mapValue:r}){if(n==null){if(!e.includes(`SHIKI_VAL_`))return e}else if(!e.includes(n))return e;return e.replaceAll(_e(n),(e,n)=>{let i=Number.parseInt(n,10);return Number.isNaN(i)||i<0||i>=t.length?e:r(t[i])})}function ye(e,t,n){return ve({input:e,vals:t,preValToken:n,mapValue:e=>oe(String(e))})}function be(e,t,n){return ve({input:e,vals:t,preValToken:n,mapValue:e=>String(e)})}const xe=e=>{let t=N(58),n,a,o,s,c;t[0]===e?(n=t[1],a=t[2],o=t[3],s=t[4],c=t[5]):({className:n,style:s,value:c,ref:o,...a}=e,t[0]=e,t[1]=n,t[2]=a,t[3]=o,t[4]=s,t[5]=c);let l=R(null),u=r(l,o),{codeId:d,copyTextRef:f,hasCodeExpander:p,isCodeExpanded:m,registerCode:h,unregisterCode:g}=fe(),{language:_,code:v,"~preValToken":y,"~preVals":b,"~highlightLines":x,"~lineNumberStart":S,"~preHtml":C,"~showLineNumbers":w}=c,T=x,E=S??1,D=w??!1,O;t[6]!==y||t[7]!==b||t[8]!==v?(O=b!=null&&b.length>0?be(v,b,y):v,t[6]=y,t[7]=b,t[8]=v,t[9]=O):O=t[9];let k=O,A,j;t[10]!==k||t[11]!==f?(A=()=>{f.current=k},j=[f,k],t[10]=k,t[11]=f,t[12]=A,t[13]=j):(A=t[12],j=t[13]),te(A,j);let M,P;t[14]!==h||t[15]!==g?(M=()=>(h(),()=>{g()}),P=[h,g],t[14]=h,t[15]=g,t[16]=M,t[17]=P):(M=t[16],P=t[17]),ee(M,P);let F;bb0:{if(C==null){F=void 0;break bb0}let e;t[18]!==C||t[19]!==y||t[20]!==b?(e=b!=null&&b.length>0?ye(C,b,y):C,t[18]=C,t[19]=y,t[20]=b,t[21]=e):e=t[21],F=e}let I=F,L,z;t[22]===I?(L=t[23],z=t[24]):(L=()=>{let e=l.current;if(e==null||I==null)return;let t=e.querySelector(`code`);return t!=null&&ce(t),de(e)},z=[I],t[22]=I,t[23]=L,t[24]=z),ee(L,z);let B=I!=null,H;t[25]!==k||t[26]!==I?(H=I??oe(k),t[25]=k,t[26]=I,t[27]=H):H=t[27];let ne=H,U;t[28]===ne?U=t[29]:(U={__html:ne},t[28]=ne,t[29]=U);let re=U,ie=m?`expanded`:`collapsed`,W;t[30]===s?W=t[31]:(W=s??{},t[30]=s,t[31]=W);let G;if(t[32]!==W){let{MozTabSize:e,...n}=W;G=n,t[32]=W,t[33]=G}else G=t[33];let K=p?ie:void 0,ae=!B&&`pr-14`,q;t[34]!==n||t[35]!==ae?(q=i(`scrollbar overflow-x-auto overscroll-x-none overflow-y-hidden py-4`,ae,`data-[mantle-line-numbers~='false']:pl-4`,`text-mono m-0 font-mono outline-hidden`,`data-[state=collapsed]:max-h-[13.6rem]`,n),t[34]=n,t[35]=ae,t[36]=q):q=t[36];let J=B?`true`:`false`,Y;t[37]!==T||t[38]!==B?(Y=B&&T!=null&&T.length>0?T.join(`,`):void 0,t[37]=T,t[38]=B,t[39]=Y):Y=t[39];let se=B&&D?String(E):`1`,le=B&&D?`true`:`false`,ue=String(E),X;t[40]!==G||t[41]!==ue?(X={...G,"--mantle-line-number-start":ue,tabSize:2},t[40]=G,t[41]=ue,t[42]=X):X=t[42];let Z=X,Q;t[43]===re?Q=t[44]:(Q=/* @__PURE__ */ V(`code`,{className:`text-size-inherit block min-w-full w-max`,dangerouslySetInnerHTML:re}),t[43]=re,t[44]=Q);let $;return t[45]!==d||t[46]!==u||t[47]!==_||t[48]!==a||t[49]!==K||t[50]!==q||t[51]!==J||t[52]!==Y||t[53]!==se||t[54]!==le||t[55]!==Z||t[56]!==Q?($=/* @__PURE__ */ V(`pre`,{"data-slot":`code-block-code`,"data-state":K,className:q,"data-highlighted":J,"data-lang":_,"data-mantle-highlight-lines":Y,"data-mantle-line-number-start":se,"data-mantle-line-numbers":le,id:d,ref:u,style:Z,...a,translate:`no`,children:Q}),t[45]=d,t[46]=u,t[47]=_,t[48]=a,t[49]=K,t[50]=q,t[51]=J,t[52]=Y,t[53]=se,t[54]=le,t[55]=Z,t[56]=Q,t[57]=$):$=t[57],$},Se=e=>{let t=N(16),n,r,o,s,c;t[0]===e?(n=t[1],r=t[2],o=t[3],s=t[4],c=t[5]):({"data-slot":r,asChild:c,className:n,ref:s,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=s,t[5]=c);let l=c!==void 0&&c?d:`div`,u;t[6]===r?u=t[7]:(u=a(r,`code-block-header`),t[6]=r,t[7]=u);let f;t[8]===n?f=t[9]:(f=i(`flex items-center gap-1 border-b border-gray-300 bg-base px-4 py-2 text-gray-700`,n),t[8]=n,t[9]=f);let p;return t[10]!==l||t[11]!==o||t[12]!==s||t[13]!==u||t[14]!==f?(p=/* @__PURE__ */ V(l,{"data-slot":u,className:f,ref:s,...o}),t[10]=l,t[11]=o,t[12]=s,t[13]=u,t[14]=f,t[15]=p):p=t[15],p},Ce=e=>{let t=N(16),n,r,o,s,c;t[0]===e?(n=t[1],r=t[2],o=t[3],s=t[4],c=t[5]):({"data-slot":r,asChild:c,className:n,ref:s,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=s,t[5]=c);let l=c!==void 0&&c?d:`h3`,u;t[6]===r?u=t[7]:(u=a(r,`code-block-title`),t[6]=r,t[7]=u);let f;t[8]===n?f=t[9]:(f=i(`m-0 font-sans text-xs font-medium`,n),t[8]=n,t[9]=f);let p;return t[10]!==l||t[11]!==o||t[12]!==s||t[13]!==u||t[14]!==f?(p=/* @__PURE__ */ V(l,{"data-slot":u,ref:s,className:f,translate:`no`,...o}),t[10]=l,t[11]=o,t[12]=s,t[13]=u,t[14]=f,t[15]=p):p=t[15],p},we=t=>{let r=N(33),a,o,c,d,f,p,m;r[0]===t?(a=r[1],o=r[2],c=r[3],d=r[4],f=r[5],p=r[6],m=r[7]):({className:a,label:m,onCopy:c,onCopyError:d,onClick:o,ref:p,...f}=t,r[0]=t,r[1]=a,r[2]=o,r[3]=c,r[4]=d,r[5]=f,r[6]=p,r[7]=m);let h=m===void 0?`Copy code`:m,{copyTextRef:g}=fe(),_=e(),[v,y]=z(``),b=v!==``,x=R(!1),S=R(void 0),C,w;r[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>()=>{S.current!=null&&clearTimeout(S.current)},w=[],r[8]=C,r[9]=w):(C=r[8],w=r[9]),ee(C,w);let T;r[10]===v?T=r[11]:(T=/* @__PURE__ */ V(u,{children:v}),r[10]=v,r[11]=T);let E=b?`check`:`copy`,D;r[12]===Symbol.for(`react.memo_cache_sentinel`)?(D={check:/* @__PURE__ */ V(ne,{}),copy:/* @__PURE__ */ V(U,{})},r[12]=D):D=r[12];let O;r[13]===E?O=r[14]:(O=/* @__PURE__ */ V(s,{active:E,icons:D}),r[13]=E,r[14]=O);let k;r[15]===a?k=r[16]:(k=i(`bg-base not-disabled:hover:bg-neutral-500/15`,a),r[15]=a,r[16]=k);let A;r[17]!==g||r[18]!==_||r[19]!==o||r[20]!==c||r[21]!==d?(A=async e=>{try{if(o?.(e),e.defaultPrevented){S.current!=null&&clearTimeout(S.current);return}let t=g.current;await _(t),c?.(t),y(n(`Copied`,x)),S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{y(``)},2e3)}catch(e){d?.(e)}},r[17]=g,r[18]=_,r[19]=o,r[20]=c,r[21]=d,r[22]=A):A=r[22];let j;r[23]!==h||r[24]!==f||r[25]!==p||r[26]!==O||r[27]!==k||r[28]!==A?(j=/* @__PURE__ */ V(l,{type:`button`,appearance:`ghost`,intent:`neutral`,size:`sm`,label:h,icon:O,className:k,ref:p,onClick:A,...f}),r[23]=h,r[24]=f,r[25]=p,r[26]=O,r[27]=k,r[28]=A,r[29]=j):j=r[29];let M;return r[30]!==j||r[31]!==T?(M=/* @__PURE__ */ H(`span`,{"data-slot":`code-block-copy-button`,className:`absolute right-3 top-3 z-10 inline-flex size-7 items-center justify-center rounded-(--icon-button-border-radius,0.375rem) bg-base`,children:[T,j]}),r[30]=j,r[31]=T,r[32]=M):M=r[32],M},Te=e=>{let n=N(31),r,s,c,l,u;n[0]===e?(r=n[1],s=n[2],c=n[3],l=n[4],u=n[5]):({"data-slot":s,className:r,onClick:c,ref:u,...l}=e,n[0]=e,n[1]=r,n[2]=s,n[3]=c,n[4]=l,n[5]=u);let{codeId:d,isCodeExpanded:f,setIsCodeExpanded:p,setHasCodeExpander:m}=fe(),h,g;n[6]===m?(h=n[7],g=n[8]):(h=()=>(m(!0),()=>{m(!1)}),g=[m],n[6]=m,n[7]=h,n[8]=g),t(h,g);let _;n[9]===s?_=n[10]:(_=a(s,`code-block-expander-button`),n[9]=s,n[10]=_);let v;n[11]===r?v=n[12]:(v=i(`flex w-full items-center justify-center gap-0.5 border-t border-gray-300 bg-base px-4 py-2 font-sans text-gray-700 hover:bg-base-hover`,r),n[11]=r,n[12]=v);let y;n[13]!==c||n[14]!==p?(y=e=>{p(Oe),c?.(e)},n[13]=c,n[14]=p,n[15]=y):y=n[15];let b=f?`Show less`:`Show more`,x;n[16]===Symbol.for(`react.memo_cache_sentinel`)?(x=/* @__PURE__ */ V(P,{weight:`bold`}),n[16]=x):x=n[16];let S=f&&`rotate-180`,C;n[17]===S?C=n[18]:(C=i(`size-4`,S,`transition-transform duration-200 ease-out-strong motion-reduce:transition-none`),n[17]=S,n[18]=C);let w;n[19]===C?w=n[20]:(w=/* @__PURE__ */ V(o,{svg:x,className:C}),n[19]=C,n[20]=w);let T;return n[21]!==d||n[22]!==f||n[23]!==l||n[24]!==u||n[25]!==w||n[26]!==_||n[27]!==v||n[28]!==y||n[29]!==b?(T=/* @__PURE__ */ H(`button`,{...l,"data-slot":_,"aria-controls":d,"aria-expanded":f,className:v,ref:u,type:`button`,onClick:y,children:[b,` `,w]}),n[21]=d,n[22]=f,n[23]=l,n[24]=u,n[25]=w,n[26]=_,n[27]=v,n[28]=y,n[29]=b,n[30]=T):T=n[30],T};function Ee(e){let t=N(18),n,r,s,l,u;t[0]===e?(n=t[1],r=t[2],s=t[3],l=t[4],u=t[5]):({"data-slot":s,className:r,preset:l,svg:n,...u}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=s,t[4]=l,t[5]=u);let d=n;if(l!=null)bb0:switch(l){case`file`:{let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=/* @__PURE__ */ V(re,{weight:`fill`}),t[6]=e):e=t[6],d=e;break bb0}case`cli`:{let e;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=/* @__PURE__ */ V(ie,{weight:`fill`}),t[7]=e):e=t[7],d=e;break bb0}case`traffic-policy`:{let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=/* @__PURE__ */ V(c,{}),t[8]=e):e=t[8],d=e}}let f;t[9]===s?f=t[10]:(f=a(s,`code-block-icon`),t[9]=s,t[10]=f);let p;t[11]===r?p=t[12]:(p=i(`size-5`,r),t[11]=r,t[12]=p);let m;return t[13]!==u||t[14]!==d||t[15]!==f||t[16]!==p?(m=/* @__PURE__ */ V(o,{"data-slot":f,className:p,svg:d,...u}),t[13]=u,t[14]=d,t[15]=f,t[16]=p,t[17]=m):m=t[17],m}const De={Root:$,Body:pe,Code:xe,CopyButton:we,ExpanderButton:Te,Header:Se,Icon:Ee,TabContent:e=>{let t=N(8),n,r;t[0]===e?(n=t[1],r=t[2]):({"data-slot":n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=a(n,`code-block-tab-content`),t[3]=n,t[4]=i);let o;return t[5]!==r||t[6]!==i?(o=/* @__PURE__ */ V(W,{"data-slot":i,...r}),t[5]=r,t[6]=i,t[7]=o):o=t[7],o},TabList:e=>{let t=N(14),n,r,o,s;t[0]===e?(n=t[1],r=t[2],o=t[3],s=t[4]):({"data-slot":r,className:n,ref:s,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=s);let c;t[5]===r?c=t[6]:(c=a(r,`code-block-tab-list`),t[5]=r,t[6]=c);let l;t[7]===n?l=t[8]:(l=i(`scroll-fade-x flex min-w-0 items-center gap-1 overflow-x-auto overscroll-x-none`,`-m-1 p-1`,n),t[7]=n,t[8]=l);let u;return t[9]!==o||t[10]!==s||t[11]!==c||t[12]!==l?(u=/* @__PURE__ */ V(G,{"data-slot":c,className:l,ref:s,...o}),t[9]=o,t[10]=s,t[11]=c,t[12]=l,t[13]=u):u=t[13],u},TabTrigger:e=>{let t=N(14),n,r,o,s;t[0]===e?(n=t[1],r=t[2],o=t[3],s=t[4]):({"data-slot":r,className:n,ref:s,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=s);let c;t[5]===r?c=t[6]:(c=a(r,`code-block-tab-trigger`),t[5]=r,t[6]=c);let l;t[7]===n?l=t[8]:(l=i(`shrink-0 cursor-pointer rounded px-1.5 py-0.5 font-sans text-xs font-medium whitespace-nowrap`,`text-gray-600 outline-hidden`,`hover:text-gray-900`,`data-[state=active]:bg-neutral-500/15 data-[state=active]:text-strong`,`focus-visible:ring-focus-accent focus-visible:ring-4`,n),t[7]=n,t[8]=l);let u;return t[9]!==o||t[10]!==s||t[11]!==c||t[12]!==l?(u=/* @__PURE__ */ V(ae,{"data-slot":c,className:l,ref:s,...o}),t[9]=o,t[10]=s,t[11]=c,t[12]=l,t[13]=u):u=t[13],u},Title:Ce};function Oe(e){return!e}const ke=`var(--shiki-foreground)`;function Ae(e){return e.replace(/[&<]/g,e=>e===`&`?`&#x26;`:`&#x3C;`)}function je(e){return e===` `||e===` `||e===`
2
2
  `||e===`\r`||e===`{`||e===`}`||e===`[`||e===`]`||e===`:`||e===`,`||e===`"`}function Me(e,t,n){let r=e.length,i=[],a=`"`,o=t+1;for(;o<r;){let t=e[o];if(t===`\\`){let t=e[o+1]===`u`&&/^[0-9a-fA-F]{4}$/.test(e.slice(o+2,o+6))?6:2;a!==``&&(i.push({text:a,isEscape:!1}),a=``),i.push({text:e.slice(o,o+t),isEscape:!0}),o+=t}else{if(t===`"`){a+=`"`,o+=1;break}a+=t,o+=1}}a!==``&&i.push({text:a,isEscape:!1});let s=o;for(;s<r;){let t=e[s];if(t===` `||t===` `||t===`
3
3
  `||t===`\r`)s+=1;else break}let c=e[s]===`:`?`var(--shiki-token-keyword)`:`var(--shiki-token-string-expression)`;for(let e of i)n(e.text,e.isEscape?`var(--shiki-token-escape, var(--shiki-token-constant))`:c);return o}function Ne(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n!=null&&n.color==null){let r=ke;for(let n=t+1;n<e.length;n+=1){let t=e[n];if(t!=null&&t.color!=null){r=t.color;break}}n.color=r}}let t=``,n=``,r=null,i=()=>{r!=null&&(t+=`<span style="color:${r}">${Ae(n)}</span>`),n=``,r=null};for(let t of e)t!=null&&(t.color===r?n+=t.text:(i(),n=t.text,r=t.color));return i(),`<span class="line">${t}</span>`}function Pe(e){let t=[[]],n=t[0]??[],r=e.length,i=0,a=(e,t)=>{n.push({text:e,color:t})};for(;i<r;){let o=e[i];if(o===`
4
4
  `||o===`\r`){o===`\r`&&e[i+1]===`
@@ -1,2 +1,7 @@
1
+ /**
2
+ * React-free highlighting utilities for use in build tools, server-side
3
+ * rendering, and Web Workers. This module intentionally avoids importing
4
+ * any React or DOM-dependent code so it can run in non-browser contexts.
5
+ */
1
6
  import { A as FoldStrategy, B as computeJsonFoldRanges, C as Indentation, D as FoldExplanation, E as ComputeFoldRangesInput, F as isSupportedLanguage, H as finalizeFoldRanges, I as parseLanguage, L as supportedLanguages, M as computeFoldRanges, N as foldStrategyFor, O as FoldLine, P as SupportedLanguage, R as DecorateHighlightedHtmlInput, S as normalizeIndentation, T as isIndentation, U as LineRange, V as FoldableRange, b as defaultShowLineNumbers, g as parseCodeBlockShowLineNumbers, h as parseCodeBlockLineNumberStart, j as FoldToken, k as FoldScope, m as parseCodeBlockHighlightLines, p as tokenizeMetastring, u as normalizeValue, w as inferIndentation, z as decorateHighlightedHtml } from "./code-block-BGdV4Yty.js";
2
7
  export { type ComputeFoldRangesInput, type DecorateHighlightedHtmlInput, type FoldExplanation, type FoldLine, type FoldScope, type FoldStrategy, type FoldToken, type FoldableRange, type Indentation, type LineRange, type SupportedLanguage, computeFoldRanges, computeJsonFoldRanges, decorateHighlightedHtml, defaultShowLineNumbers, finalizeFoldRanges, foldStrategyFor, inferIndentation, isIndentation, isSupportedLanguage, normalizeIndentation, normalizeValue, parseCodeBlockHighlightLines, parseCodeBlockLineNumberStart, parseCodeBlockShowLineNumbers, parseLanguage, supportedLanguages, tokenizeMetastring };
package/dist/code.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Re-exports for the Code component.
3
+ *
4
+ * @see https://mantle.ngrok.com/components/data-display/code
5
+ */
1
6
  import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
2
7
  import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
3
8
  import { ComponentProps } from "react";
@@ -25,6 +30,14 @@ import { ComponentProps } from "react";
25
30
  * `Kbd` and `CodeBlock.Code` take no such override — a key and a block of code
26
31
  * are never translatable.
27
32
  *
33
+ * @useWhen Mark a short fragment of code inside a sentence, such as a function name, a file path,
34
+ * or a key.
35
+ *
36
+ * @siblings
37
+ * - `CodeBlock`: the code spans several lines or needs syntax highlighting.
38
+ * - `Kbd`: the text is a keyboard key or a shortcut.
39
+ * - `TruncatedText`: the value is long and opaque, such as a URL or an ID, and can overflow its row.
40
+ *
28
41
  * @see https://mantle.ngrok.com/components/data-display/code
29
42
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/translate
30
43
  *
@@ -0,0 +1 @@
1
+ const e=[`amber`,`blue`,`cyan`,`emerald`,`fuchsia`,`gray`,`green`,`indigo`,`lime`,`orange`,`pink`,`purple`,`red`,`rose`,`sky`,`teal`,`violet`,`yellow`],t=t=>typeof t==`string`&&e.some(e=>e===t),n=[`important`,`info`,`accent`,`danger`,`neutral`,`success`,`warning`],r=e=>typeof e==`string`&&n.some(t=>t===e),i=[...e,...n],a=e=>typeof e==`string`&&i.some(t=>t===e);export{t as a,r as i,n,e as o,a as r,i as t};
package/dist/color.js CHANGED
@@ -1 +1 @@
1
- const e=[`amber`,`blue`,`cyan`,`emerald`,`fuchsia`,`gray`,`green`,`indigo`,`lime`,`orange`,`pink`,`purple`,`red`,`rose`,`sky`,`teal`,`violet`,`yellow`],t=t=>typeof t==`string`&&e.some(e=>e===t),n=[`important`,`info`,`accent`,`danger`,`neutral`,`success`,`warning`],r=e=>typeof e==`string`&&n.some(t=>t===e),i=[...e,...n],a=e=>typeof e==`string`&&i.some(t=>t===e);export{i as colors,n as functionalColors,a as isColor,r as isFunctionalColor,t as isNamedColor,e as namedColors};
1
+ export{t as colors,n as functionalColors,r as isColor,i as isFunctionalColor,a as isNamedColor,o as namedColors}from"./color-CHZbU1Ww.js";