@ngrok/mantle 0.93.7 → 0.94.1
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/README.md +11 -2
- package/dist/accordion.d.ts +73 -21
- package/dist/accordion.js +1 -1
- package/dist/agent.json +1234 -84
- package/dist/alert-BkJHDx9X.js +1 -0
- package/dist/{alert-BcSBNR3S.d.ts → alert-D0zRRUHV.d.ts} +35 -25
- package/dist/alert-center.d.ts +67 -55
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +35 -10
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +6 -1
- package/dist/alert.js +1 -1
- package/dist/anchor-Dc6IgvXV.js +1 -0
- package/dist/anchor.d.ts +17 -5
- package/dist/anchor.js +1 -1
- package/dist/app-layout.d.ts +33 -18
- package/dist/app-layout.js +1 -1
- package/dist/area-chart.d.ts +153 -97
- package/dist/area-chart.js +1 -1
- package/dist/avatar.d.ts +36 -24
- package/dist/avatar.js +1 -1
- package/dist/badge.d.ts +19 -7
- package/dist/badge.js +1 -1
- package/dist/bar-chart.d.ts +155 -100
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.d.ts +47 -36
- package/dist/breadcrumb.js +1 -1
- package/dist/browser-only-CZfkNw5A.js +1 -0
- package/dist/browser-only-ymFoM3Ya.js +1 -0
- package/dist/browser-only.d.ts +8 -0
- package/dist/browser-only.js +1 -1
- package/dist/{button-BX-4lYUn.d.ts → button-5Pc7Mby_.d.ts} +4 -4
- package/dist/button-B9bChDgl.js +1 -0
- package/dist/button-D8jixIbH.js +1 -0
- package/dist/button-DNLTJ32M.js +1 -0
- package/dist/{button-CPsKGDK0.d.ts → button-Ddj6yr10.d.ts} +34 -27
- package/dist/{button-Yxyu1XMd.d.ts → button-DnYv7IOT.d.ts} +29 -22
- package/dist/button.d.ts +9 -3
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +8 -1
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +7 -2
- package/dist/card.js +1 -1
- package/dist/centered-layout.d.ts +34 -23
- package/dist/centered-layout.js +1 -1
- package/dist/chart-BLCqzt56.js +1 -0
- package/dist/chart-CChZiCrt.js +1 -0
- package/dist/chart-CUmSu9d7.js +1 -0
- package/dist/{chart-BpfbtOUN.d.ts → chart-Dl8gFo_D.d.ts} +117 -121
- package/dist/chart-DtgZBAas.js +2 -0
- package/dist/checkbox-Cu5cgZmk.js +1 -0
- package/dist/checkbox.d.ts +15 -2
- package/dist/checkbox.js +1 -1
- package/dist/choice-CCVG2hb9.js +1 -0
- package/dist/{choice-BLR0_MeB.d.ts → choice-CNiOSzqV.d.ts} +26 -20
- package/dist/choice.d.ts +6 -1
- package/dist/choice.js +1 -1
- package/dist/code-BPKNY1_w.js +1 -0
- package/dist/{code-block-BGdV4Yty.d.ts → code-block-BDw6MEwH.d.ts} +9 -9
- package/dist/{code-block-W3kWPxCJ.js → code-block-CKzsAMzj.js} +3 -3
- package/dist/code-block.d.ts +28 -19
- package/dist/code-block.js +1 -1
- package/dist/code-block_highlight-utils.d.ts +6 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/code.d.ts +16 -3
- package/dist/code.js +1 -1
- package/dist/color-CHZbU1Ww.js +1 -0
- package/dist/color.js +1 -1
- package/dist/combobox.d.ts +42 -28
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +59 -47
- package/dist/command.js +1 -1
- package/dist/compose-refs-BdRUneoc.js +1 -0
- package/dist/{copy-to-clipboard-DInu78k_.js → copy-to-clipboard-Dd83caRw.js} +1 -1
- package/dist/cx.d.ts +4 -4
- package/dist/cx.js +1 -1
- package/dist/{data-slot-B-LqAcBB.d.ts → data-slot-BW8KQ9Xo.d.ts} +2 -2
- package/dist/data-table.d.ts +83 -52
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +13 -2
- package/dist/description-list.js +1 -1
- package/dist/{dialog-2fRO4ca4.d.ts → dialog-CIEuwNys.d.ts} +32 -8
- package/dist/dialog-CbEEA0fl.d.ts +32 -0
- package/dist/dialog-DmzoDfY3.js +1 -0
- package/dist/dialog.d.ts +7 -2
- package/dist/dialog.js +1 -1
- package/dist/{dropdown-menu-CpjRwMWe.d.ts → dropdown-menu-CeY498yk.d.ts} +41 -33
- package/dist/dropdown-menu-uheL0prz.js +1 -0
- package/dist/dropdown-menu.d.ts +6 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +7 -2
- package/dist/empty.js +1 -1
- package/dist/field-Bpvn4tQp.js +1 -0
- package/dist/{field-V_gnkcmN.d.ts → field-BshcNVe_.d.ts} +1 -1
- package/dist/field-Cai_4c1l.js +1 -0
- package/dist/field.d.ts +53 -42
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +11 -3
- package/dist/flag.js +1 -1
- package/dist/hooks.d.ts +35 -10
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +25 -14
- package/dist/hover-card.js +1 -1
- package/dist/{icon-CgNqu-fl.d.ts → icon--purqHRo.d.ts} +1 -1
- package/dist/{icon-ByLVhdYq.d.ts → icon-DuIYoyft.d.ts} +8 -2
- package/dist/{icon-DXDyhy2N.d.ts → icon-QCm1ui29.d.ts} +2 -2
- package/dist/icon-xb7d9M7X.js +1 -0
- package/dist/icon.d.ts +8 -3
- package/dist/icon.js +1 -1
- package/dist/icons-DEDCLZ8B.js +1 -0
- package/dist/icons-DXadFwpo.js +1 -0
- package/dist/icons-DcesO4Ng.js +1 -0
- package/dist/icons.d.ts +13 -1
- package/dist/icons.js +1 -1
- package/dist/{in-view-B3nMAzfE.d.ts → in-view-C_daNafg.d.ts} +4 -23
- package/dist/{index-BhfgyurF.d.ts → index-KJ06KK6t.d.ts} +3 -3
- package/dist/input-BjCDSOPA.js +1 -0
- package/dist/{input-Dx5owTCc.d.ts → input-DC4nW0Sr.d.ts} +12 -2
- package/dist/input-fW8QSZEO.js +1 -0
- package/dist/input.d.ts +37 -5
- package/dist/input.js +1 -1
- package/dist/kbd-P1nQshWo.js +1 -0
- package/dist/kbd.d.ts +17 -5
- package/dist/kbd.js +1 -1
- package/dist/label-DO1RlMKl.js +1 -0
- package/dist/{label-Dn5CPJUj.d.ts → label-epgtywRz.d.ts} +14 -8
- package/dist/label.d.ts +6 -1
- package/dist/label.js +1 -1
- package/dist/layer-container-DL4yclOu.js +1 -0
- package/dist/layer-container.d.ts +2 -2
- package/dist/layer-container.js +1 -1
- package/dist/line-chart.d.ts +147 -90
- package/dist/line-chart.js +1 -1
- package/dist/list-cQZPSjfz.js +1 -0
- package/dist/list.d.ts +34 -16
- package/dist/list.js +1 -1
- package/dist/live-region-Dhapu8a5.js +1 -0
- package/dist/live-region.d.ts +15 -2
- package/dist/live-region.js +1 -1
- package/dist/llms.txt +82 -79
- package/dist/main-CHyWYDak.js +1 -0
- package/dist/main.d.ts +13 -1
- package/dist/main.js +1 -1
- package/dist/mantle.css +133 -88
- package/dist/media-object.d.ts +16 -4
- package/dist/media-object.js +1 -1
- 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 +42 -29
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +20 -8
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +93 -4
- package/dist/pagination.js +1 -1
- package/dist/{popover-BfB2I9G0.d.ts → popover-Bei0jyfH.d.ts} +87 -12
- package/dist/popover-DhgunktK.js +1 -0
- package/dist/popover-T2EyaqGK.d.ts +1 -0
- package/dist/popover.d.ts +7 -2
- package/dist/popover.js +1 -1
- package/dist/primitive-D8CzV_Ft.js +1 -0
- package/dist/progress.d.ts +28 -11
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +11 -3
- package/dist/qr-code.js +1 -1
- package/dist/query-filter.d.ts +6 -6
- package/dist/query.d.ts +9 -4
- package/dist/query.js +1 -1
- package/dist/radio-group-BJQ6EOqh.d.ts +27 -0
- package/dist/radio-group-BliblUqe.js +1 -0
- package/dist/radio-group-ggEkCi0V.js +1 -0
- package/dist/radio-group.d.ts +21 -100
- package/dist/radio-group.js +1 -1
- package/dist/sandbar.d.ts +43 -30
- package/dist/sandbar.js +1 -1
- package/dist/sandboxed-on-click-D4PL5_GR.js +1 -0
- package/dist/sandboxed-on-click.d.ts +8 -0
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/scatter-plot.d.ts +137 -76
- 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-1xuUx_os.js +1 -0
- package/dist/{select-BkhBxtOT.d.ts → select-BpaXHxJm.d.ts} +33 -25
- package/dist/select.d.ts +6 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +29 -18
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-D9AWEkcJ.d.ts → separator-Ck4sPrdN.d.ts} +4 -2
- package/dist/separator-DnvhwY2J.js +1 -0
- package/dist/separator.d.ts +6 -1
- package/dist/separator.js +1 -1
- package/dist/{shake-DL6WhMXM.js → shake-CAUpKBHe.js} +1 -1
- package/dist/sheet-DHy_vlme.js +1 -0
- package/dist/sheet.d.ts +36 -7
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +53 -37
- package/dist/sidebar.js +1 -1
- package/dist/skeleton-DHfyjuQi.js +1 -0
- package/dist/skeleton.d.ts +15 -4
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.d.ts +12 -1
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slider.d.ts +11 -1
- package/dist/slider.js +1 -1
- package/dist/slot-B7rwscwd.js +1 -0
- package/dist/{slot-C0OCJjdJ.d.ts → slot-BEMQMbk3.d.ts} +6 -4
- package/dist/slot.d.ts +6 -1
- package/dist/slot.js +1 -1
- package/dist/source-all.css +5 -1
- package/dist/split-button.d.ts +20 -9
- package/dist/split-button.js +1 -1
- package/dist/strata.d.ts +35 -22
- package/dist/strata.js +1 -1
- package/dist/{suggestions-NkqYTT49.d.ts → suggestions-BJeGvwDa.d.ts} +7 -7
- package/dist/switch.d.ts +14 -2
- package/dist/switch.js +1 -1
- package/dist/table-BnLdXUai.js +1 -0
- package/dist/{table-vT6Okwfa.d.ts → table-Ii9hHUWN.d.ts} +84 -5
- package/dist/table.d.ts +6 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +24 -12
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +12 -2
- package/dist/text-area.js +1 -1
- package/dist/theme-BNdZl352.js +1 -0
- package/dist/theme-switcher.d.ts +18 -4
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +25 -11
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +15 -2
- package/dist/toast.js +1 -1
- package/dist/tokens.dark.json +3261 -0
- package/dist/tokens.json +4933 -0
- package/dist/tokens.resolver.json +37 -0
- package/dist/{tooltip-NcLIeBy5.d.ts → tooltip-CstGDKwy.d.ts} +18 -11
- package/dist/tooltip-DQO40Mrq.js +1 -0
- package/dist/tooltip.d.ts +6 -1
- package/dist/tooltip.js +1 -1
- package/dist/truncated-text.d.ts +28 -14
- package/dist/truncated-text.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/use-breakpoint-B4Kh0xE6.js +1 -0
- package/dist/use-callback-ref-DiOXFQzM.js +1 -0
- package/dist/use-composed-refs-DPYmLDSe.js +1 -0
- package/dist/use-copy-to-clipboard-hBL6_65i.js +1 -0
- package/dist/use-inert-siblings-C4RHXrZc.js +1 -0
- package/dist/use-is-apple-platform-Bq6_KbVX.js +1 -0
- package/dist/use-is-hydrated-BeLOGKwE.js +1 -0
- package/dist/use-is-hydrated-after-paint-CrHt3OHw.js +1 -0
- package/dist/use-isomorphic-layout-effect-CL6iq0Bj.js +1 -0
- package/dist/use-matches-media-query-FfvtNKQe.js +1 -0
- package/dist/use-prefers-reduced-motion-Ck6dnOM9.js +1 -0
- package/dist/use-swipe-to-dismiss-BYdlca8r.js +1 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/visually-hidden.d.ts +14 -1
- package/dist/visually-hidden.js +1 -1
- package/dist/well.d.ts +7 -2
- package/dist/well.js +1 -1
- package/package.json +21 -7
- package/src/components/chart/d3-license.md +25 -0
- package/dist/alert-P9lwn25X.js +0 -1
- package/dist/anchor-CgcbWEUs.js +0 -1
- package/dist/browser-only-BTSrYWLj.js +0 -1
- package/dist/button-69InNC_m.js +0 -1
- package/dist/button-B8k98Pby.js +0 -1
- package/dist/button-Dge0D5bl.js +0 -1
- package/dist/chart-BpWfQAwf.js +0 -2
- package/dist/checkbox-DmSQXs26.js +0 -1
- package/dist/choice-2Lrv8_nl.js +0 -1
- package/dist/code-DUJzSl4K.js +0 -1
- package/dist/compose-refs-sFdxsL7k.js +0 -1
- package/dist/dialog-7TUgiSzX.js +0 -1
- package/dist/dialog-Dp0QGWwo.d.ts +0 -28
- package/dist/dropdown-menu-BHBzCDSZ.js +0 -1
- package/dist/field-Bihblt8U.js +0 -1
- package/dist/field-CPvjazWN.js +0 -1
- package/dist/icon-kK0c-POG.js +0 -1
- package/dist/icons-CDLz5lpI.js +0 -1
- package/dist/icons-CSwTVV2m.js +0 -1
- package/dist/icons-DP3lQw5O.js +0 -1
- package/dist/input-CpQ6jlpI.js +0 -1
- package/dist/kbd-CLHsJ99p.js +0 -1
- package/dist/label-nHqqYS7e.js +0 -1
- package/dist/layer-container-kEQiE4zV.js +0 -1
- package/dist/list-RFRIQxU2.js +0 -1
- package/dist/live-region-DQ1QLv3L.js +0 -1
- package/dist/main-CC1L9IsH.js +0 -1
- package/dist/popover-C96V8SXi.d.ts +0 -1
- package/dist/popover-DxOqLKxy.js +0 -1
- package/dist/primitive-Dz9Al-us.js +0 -1
- package/dist/radio-group-HDVxTNPi.js +0 -1
- package/dist/sandboxed-on-click-C7pPu-2M.js +0 -1
- package/dist/select-CAAYk4Yj.js +0 -1
- package/dist/separator-DfzxVutO.js +0 -1
- package/dist/sheet-CSJc_sB4.js +0 -1
- package/dist/skeleton-DBpI-ko5.js +0 -1
- package/dist/slot-DdYN1L1C.js +0 -1
- package/dist/table-CFHiDBW8.js +0 -1
- package/dist/theme-C-glc5Q-.js +0 -1
- package/dist/tooltip-b6oiTaWq.js +0 -1
- package/dist/use-breakpoint--mo7kr9d.js +0 -1
- package/dist/use-callback-ref-BvVyI5K1.js +0 -1
- package/dist/use-copy-to-clipboard-Dy_0Qzb7.js +0 -1
- package/dist/use-is-apple-platform-D4nifHMx.js +0 -1
- package/dist/use-is-hydrated-after-paint-r9Cl2mGp.js +0 -1
- package/dist/use-isomorphic-layout-effect-CLSmHzo4.js +0 -1
- package/dist/use-matches-media-query-m860lols.js +0 -1
- package/dist/use-prefers-reduced-motion-CU6mWmOe.js +0 -1
- package/dist/use-swipe-to-dismiss-DceYk1Id.js +0 -1
package/dist/code-block.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
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
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
3
|
-
import { t as SvgAttributes } from "./icon
|
|
4
|
-
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, S as normalizeIndentation, T as isIndentation, U as LineRange, V as FoldableRange, _ as MantleCodeBlockValue, a as Mode, c as ResolvedPreRenderedCodeBlockProps, d as parseMetastring, f as resolvePreRenderedCodeBlockProps, g as parseCodeBlockShowLineNumbers, h as parseCodeBlockLineNumberStart, i as MetaInput, j as FoldToken, k as FoldScope, l as defaultMeta, m as parseCodeBlockHighlightLines, n as DefaultMeta, o as ResolvePreRenderedCodeBlockPropsInput, p as tokenizeMetastring, r as Meta, s as ResolvePreRenderedCodeBlockPropsResult, t as CodeBlockPreElementInput, u as normalizeValue, v as MantleCodeOptions, w as inferIndentation, x as mantleCode, y as createMantleCodeBlockValue, z as decorateHighlightedHtml } from "./code-block-
|
|
7
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
8
|
+
import { t as SvgAttributes } from "./icon--purqHRo.js";
|
|
9
|
+
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, S as normalizeIndentation, T as isIndentation, U as LineRange, V as FoldableRange, _ as MantleCodeBlockValue, a as Mode, c as ResolvedPreRenderedCodeBlockProps, d as parseMetastring, f as resolvePreRenderedCodeBlockProps, g as parseCodeBlockShowLineNumbers, h as parseCodeBlockLineNumberStart, i as MetaInput, j as FoldToken, k as FoldScope, l as defaultMeta, m as parseCodeBlockHighlightLines, n as DefaultMeta, o as ResolvePreRenderedCodeBlockPropsInput, p as tokenizeMetastring, r as Meta, s as ResolvePreRenderedCodeBlockPropsResult, t as CodeBlockPreElementInput, u as normalizeValue, v as MantleCodeOptions, w as inferIndentation, x as mantleCode, y as createMantleCodeBlockValue, z as decorateHighlightedHtml } from "./code-block-BDw6MEwH.js";
|
|
5
10
|
import { ComponentProps, ReactNode } from "react";
|
|
6
11
|
import { Content, List, Trigger } from "@radix-ui/react-tabs";
|
|
7
12
|
type CodeBlockRootProps = Omit<ComponentProps<"div">, "align"> & WithAsChild & {
|
|
@@ -45,7 +50,7 @@ type CodeBlockRootProps = Omit<ComponentProps<"div">, "align"> & WithAsChild & {
|
|
|
45
50
|
* </CodeBlock.Root>
|
|
46
51
|
* ```
|
|
47
52
|
*/
|
|
48
|
-
declare const Root
|
|
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.
|
|
@@ -153,10 +158,10 @@ declare const Header: ({ "data-slot": dataSlot, asChild, className, ref, ...prop
|
|
|
153
158
|
* use `asChild` to render a different element.
|
|
154
159
|
*
|
|
155
160
|
* The heading carries `translate="no"` by default, because the title usually names
|
|
156
|
-
* a file
|
|
161
|
+
* a file (`example.ts`), and a translated filename names a file that does not
|
|
157
162
|
* exist. The slot takes arbitrary children though, so pass `translate="yes"` when
|
|
158
163
|
* the title is prose rather than a filename. `CodeBlock.Code` takes no such
|
|
159
|
-
* override
|
|
164
|
+
* override: a block of code is never translatable.
|
|
160
165
|
*
|
|
161
166
|
* @see https://mantle.ngrok.com/components/data-display/code-block#codeblocktitle
|
|
162
167
|
*
|
|
@@ -175,9 +180,7 @@ declare const Header: ({ "data-slot": dataSlot, asChild, className, ref, ...prop
|
|
|
175
180
|
* </CodeBlock.Root>
|
|
176
181
|
* ```
|
|
177
182
|
*/
|
|
178
|
-
declare const Title: ({ "data-slot": dataSlot, asChild, className, ref, ...props }: ComponentProps<"h3"> &
|
|
179
|
-
asChild?: boolean;
|
|
180
|
-
} & WithDataSlot) => import("react").JSX.Element;
|
|
183
|
+
declare const Title: ({ "data-slot": dataSlot, asChild, className, ref, ...props }: ComponentProps<"h3"> & WithAsChild & WithDataSlot) => import("react").JSX.Element;
|
|
181
184
|
type CodeBlockCopyButtonProps = Omit<ComponentProps<"button">, "aria-label" | "children" | "type"> & SelfClosingWithAsChild & {
|
|
182
185
|
/**
|
|
183
186
|
* Not part of the API: `label` is the single way to name the button.
|
|
@@ -203,7 +206,7 @@ type CodeBlockCopyButtonProps = Omit<ComponentProps<"button">, "aria-label" | "c
|
|
|
203
206
|
};
|
|
204
207
|
/**
|
|
205
208
|
* The optional copy button. Copies the raw source of the mounted
|
|
206
|
-
* `CodeBlock.Code` to the clipboard
|
|
209
|
+
* `CodeBlock.Code` to the clipboard (in a tabbed block, the active tab's code).
|
|
207
210
|
* Omit it to render the code block without a copy control.
|
|
208
211
|
*
|
|
209
212
|
* @see https://mantle.ngrok.com/components/data-display/code-block#codeblockcopybutton
|
|
@@ -375,6 +378,12 @@ declare const TabContent: ({ "data-slot": dataSlot, ...props }: CodeBlockTabCont
|
|
|
375
378
|
*
|
|
376
379
|
* Use `mantleCodeBlockPlugins()` to enable pre-rendering at build time.
|
|
377
380
|
*
|
|
381
|
+
* @useWhen Show a block of code with syntax highlighting and a copy button.
|
|
382
|
+
*
|
|
383
|
+
* @siblings
|
|
384
|
+
* - `Code`: the code is a short fragment inside a sentence.
|
|
385
|
+
* - `TruncatedText`: one long opaque value must stay on one line.
|
|
386
|
+
*
|
|
378
387
|
* @see https://mantle.ngrok.com/components/data-display/code-block
|
|
379
388
|
*
|
|
380
389
|
* @example
|
|
@@ -456,7 +465,7 @@ declare const CodeBlock: {
|
|
|
456
465
|
* </CodeBlock.Root>
|
|
457
466
|
* ```
|
|
458
467
|
*/
|
|
459
|
-
readonly Root: typeof Root
|
|
468
|
+
readonly Root: typeof Root;
|
|
460
469
|
/**
|
|
461
470
|
* The body of the `CodeBlock`. Contains `Code` and optional `CopyButton`.
|
|
462
471
|
*
|
|
@@ -504,8 +513,8 @@ declare const CodeBlock: {
|
|
|
504
513
|
readonly Code: typeof Code;
|
|
505
514
|
/**
|
|
506
515
|
* The optional copy button. Copies the raw source of the mounted
|
|
507
|
-
* `CodeBlock.Code` to the clipboard
|
|
508
|
-
* code. Omit it to render the code block without a copy control.
|
|
516
|
+
* `CodeBlock.Code` to the clipboard (in a tabbed block, the active tab's
|
|
517
|
+
* code). Omit it to render the code block without a copy control.
|
|
509
518
|
*
|
|
510
519
|
* @see https://mantle.ngrok.com/components/data-display/code-block#codeblockcopybutton
|
|
511
520
|
*
|
|
@@ -696,11 +705,11 @@ declare const CodeBlock: {
|
|
|
696
705
|
};
|
|
697
706
|
/**
|
|
698
707
|
* Tokenize a JSON string into the same per-line, CSS-variable-colored span markup
|
|
699
|
-
* that Mantle's server/build-time Shiki highlighter produces
|
|
708
|
+
* that Mantle's server/build-time Shiki highlighter produces, without shipping
|
|
700
709
|
* Shiki (or any grammar/theme/WASM) to the browser.
|
|
701
710
|
*
|
|
702
711
|
* Byte-for-byte parity with `extractHighlightedCodeInnerHtml(shiki.codeToHtml(code, …))`
|
|
703
|
-
* is guaranteed for **canonical `JSON.stringify` output
|
|
712
|
+
* is guaranteed for **canonical `JSON.stringify` output**. That is the only shape
|
|
704
713
|
* {@link jsonCodeBlockValue} ever feeds it (2-space indent: an opener is always
|
|
705
714
|
* followed by a newline, never inline whitespace; line endings are `\n`). That
|
|
706
715
|
* exact-parity set is locked by the `json-*.fixtures` golden tests. Other valid
|
|
@@ -724,7 +733,7 @@ declare function jsonToShikiHtml(code: string): string;
|
|
|
724
733
|
/** Options for {@link jsonCodeBlockValue}. */
|
|
725
734
|
type JsonCodeBlockValueOptions = {
|
|
726
735
|
/**
|
|
727
|
-
* Whether to render line numbers. Defaults to `false
|
|
736
|
+
* Whether to render line numbers. Defaults to `false`: detail panels usually
|
|
728
737
|
* read better without a gutter.
|
|
729
738
|
*/
|
|
730
739
|
showLineNumbers?: boolean | undefined;
|
|
@@ -738,15 +747,15 @@ type JsonCodeBlockValueOptions = {
|
|
|
738
747
|
};
|
|
739
748
|
/**
|
|
740
749
|
* Build a `MantleCodeBlockValue` that renders a value as syntax-highlighted JSON
|
|
741
|
-
* entirely on the client
|
|
750
|
+
* entirely on the client, with no Shiki runtime, build-time plugin, or server
|
|
742
751
|
* roundtrip. The value is `JSON.stringify`'d (2-space indent), tokenized to
|
|
743
752
|
* Shiki-identical markup by {@link jsonToShikiHtml}, and decorated with the same
|
|
744
753
|
* `decorateHighlightedHtml` the server pipeline uses, so it looks identical to a
|
|
745
754
|
* server/build-time highlighted block and adapts to light/dark themes for free.
|
|
746
755
|
*
|
|
747
756
|
* By default, multi-line objects and arrays get collapsible fold toggles (opt
|
|
748
|
-
* out with `foldable: false`)
|
|
749
|
-
*
|
|
757
|
+
* out with `foldable: false`). These are also identical to server/build-time
|
|
758
|
+
* blocks, because both compute ranges with the same `computeJsonFoldRanges`.
|
|
750
759
|
*
|
|
751
760
|
* Pass the result straight to `CodeBlock.Code`'s `value` prop. Ideal for
|
|
752
761
|
* inspecting a row's underlying object inside a `DataTable.ExpandedRow`.
|
package/dist/code-block.js
CHANGED
|
@@ -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+=`&`;break;case`<`:n+=`<`;break;case`>`:n+=`>`;break;case`"`:n+=`"`;break;case`'`:n+=`'`;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===`&`?`&`:`<`)}function je(e){return e===` `||e===` `||e===`
|
|
1
|
+
"use client";import{t as e}from"./use-copy-to-clipboard-hBL6_65i.js";import{t}from"./use-isomorphic-layout-effect-CL6iq0Bj.js";import{t as n}from"./alternate-announcement-BkH4bOKp.js";import{t as r}from"./use-composed-refs-DPYmLDSe.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-xb7d9M7X.js";import{r as s}from"./button-DNLTJ32M.js";import{t as c}from"./icons-DXadFwpo.js";import{t as l}from"./button-B9bChDgl.js";import{t as u}from"./live-region-Dhapu8a5.js";import{t as d}from"./slot-B7rwscwd.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-CKzsAMzj.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+=`&`;break;case`<`:n+=`<`;break;case`>`:n+=`>`;break;case`"`:n+=`"`;break;case`'`:n+=`'`;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===`&`?`&`:`<`)}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
|
-
|
|
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
|
+
*/
|
|
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-BDw6MEwH.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 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{h as computeFoldRanges,v as computeJsonFoldRanges,_ as decorateHighlightedHtml,x as defaultShowLineNumbers,y as finalizeFoldRanges,g as foldStrategyFor,p as inferIndentation,m as isIndentation,l as isSupportedLanguage,f as normalizeIndentation,n as normalizeValue,o as parseCodeBlockHighlightLines,s as parseCodeBlockLineNumberStart,c as parseCodeBlockShowLineNumbers,u as parseLanguage,d as supportedLanguages,a as tokenizeMetastring}from"./code-block-
|
|
1
|
+
export{h as computeFoldRanges,v as computeJsonFoldRanges,_ as decorateHighlightedHtml,x as defaultShowLineNumbers,y as finalizeFoldRanges,g as foldStrategyFor,p as inferIndentation,m as isIndentation,l as isSupportedLanguage,f as normalizeIndentation,n as normalizeValue,o as parseCodeBlockHighlightLines,s as parseCodeBlockLineNumberStart,c as parseCodeBlockShowLineNumbers,u as parseLanguage,d as supportedLanguages,a as tokenizeMetastring}from"./code-block-CKzsAMzj.js";
|
package/dist/code.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
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
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
7
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
3
8
|
import { ComponentProps } from "react";
|
|
4
9
|
/**
|
|
5
|
-
* Marks a short fragment of inline computer code
|
|
10
|
+
* Marks a short fragment of inline computer code: a function name, a
|
|
6
11
|
* variable, a CLI flag, a key. Renders a native `<code>` element with
|
|
7
12
|
* mantle's monospace styling.
|
|
8
13
|
*
|
|
@@ -22,9 +27,17 @@ import { ComponentProps } from "react";
|
|
|
22
27
|
* browser translation engine skips the subtree. A translated CLI flag, env var,
|
|
23
28
|
* or YAML key is wrong, and the reader copies it anyway. `Code` also styles terms
|
|
24
29
|
* that are not code, so pass `translate="yes"` when the content is prose.
|
|
25
|
-
* `Kbd` and `CodeBlock.Code` take no such override
|
|
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
|
*
|
package/dist/code.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{t as Code}from"./code-
|
|
1
|
+
export{t as Code}from"./code-BPKNY1_w.js";
|
|
@@ -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
|
-
|
|
1
|
+
export{t as colors,n as functionalColors,r as isColor,i as isFunctionalColor,a as isNamedColor,o as namedColors}from"./color-CHZbU1Ww.js";
|
package/dist/combobox.d.ts
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Combobox component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/forms/combobox
|
|
5
|
+
*/
|
|
1
6
|
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
3
|
-
import { o as WithValidation } from "./field-
|
|
4
|
-
import { n as Separator } from "./separator-
|
|
7
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
8
|
+
import { o as WithValidation } from "./field-BshcNVe_.js";
|
|
9
|
+
import { n as Separator } from "./separator-Ck4sPrdN.js";
|
|
5
10
|
import { ComponentProps } from "react";
|
|
6
|
-
import { ComboboxGroupLabelProps, ComboboxGroupProps, ComboboxItemProps, ComboboxItemValueProps, ComboboxPopoverProps, ComboboxProps, ComboboxProviderProps } from "@ariakit/react/combobox";
|
|
7
|
-
type ComboboxProps
|
|
11
|
+
import { ComboboxGroupLabelProps as ComboboxGroupLabelProps$1, ComboboxGroupProps as ComboboxGroupProps$1, ComboboxItemProps as ComboboxItemProps$1, ComboboxItemValueProps as ComboboxItemValueProps$1, ComboboxPopoverProps, ComboboxProps as ComboboxProps$1, ComboboxProviderProps } from "@ariakit/react/combobox";
|
|
12
|
+
type ComboboxProps = ComboboxProviderProps;
|
|
8
13
|
/**
|
|
9
14
|
* The outermost part of a combobox. It owns the ariakit store that holds the query text, the open state, and the selection.
|
|
10
15
|
*
|
|
11
|
-
* Use Combobox for a list of options where the user types to filter
|
|
16
|
+
* Use Combobox for a list of options where the user types to filter: large static lists,
|
|
12
17
|
* async/server-side data, or any single-select where search is helpful. For very small
|
|
13
18
|
* finite lists with no filtering, prefer Select. For multi-selection, prefer MultiSelect.
|
|
14
19
|
*
|
|
15
|
-
* `Combobox.Content` renders in place at Tailwind `z-50`, Mantle's float tier
|
|
16
|
-
*
|
|
20
|
+
* `Combobox.Content` renders in place at Tailwind `z-50`, Mantle's float tier.
|
|
21
|
+
* It does not portal, so the dialog primitive's Escape guard can see it. Inside
|
|
17
22
|
* an overlay it paints with the overlay's content. Outside one, an open overlay
|
|
18
23
|
* (`z-60`) covers it.
|
|
19
24
|
*
|
|
@@ -34,8 +39,8 @@ type ComboboxProps$1 = ComboboxProviderProps;
|
|
|
34
39
|
* </Combobox.Root>
|
|
35
40
|
* ```
|
|
36
41
|
*/
|
|
37
|
-
declare const Root: ({ children, ...props }: ComboboxProps
|
|
38
|
-
type ComboboxInputProps = Omit<ComboboxProps, "render"> & WithValidation & WithDataSlot;
|
|
42
|
+
declare const Root: ({ children, ...props }: ComboboxProps) => import("react").JSX.Element;
|
|
43
|
+
type ComboboxInputProps = Omit<ComboboxProps$1, "render"> & WithValidation & WithDataSlot;
|
|
39
44
|
/**
|
|
40
45
|
* Renders a combobox input element for filtering a list of items.
|
|
41
46
|
*
|
|
@@ -86,8 +91,8 @@ type ComboboxContentProps = Omit<ComboboxPopoverProps, "render"> & WithAsChild &
|
|
|
86
91
|
/**
|
|
87
92
|
* Renders a popover that contains combobox content, e.g. Combobox.Items, Combobox.Groups, and Combobox.Separators.
|
|
88
93
|
*
|
|
89
|
-
* `Combobox.Content` renders in place at Tailwind `z-50`, Mantle's float tier
|
|
90
|
-
*
|
|
94
|
+
* `Combobox.Content` renders in place at Tailwind `z-50`, Mantle's float tier.
|
|
95
|
+
* It does not portal, so the dialog primitive's Escape guard can see it. Inside
|
|
91
96
|
* an overlay it paints with the overlay's content. Outside one, an open overlay
|
|
92
97
|
* (`z-60`) covers it.
|
|
93
98
|
*
|
|
@@ -111,7 +116,7 @@ type ComboboxContentProps = Omit<ComboboxPopoverProps, "render"> & WithAsChild &
|
|
|
111
116
|
* ```
|
|
112
117
|
*/
|
|
113
118
|
declare const Content: ({ "data-slot": dataSlot, asChild, children, className, ref, sameWidth, unmountOnHide, ...props }: ComboboxContentProps) => import("react").JSX.Element;
|
|
114
|
-
type ComboboxItemProps
|
|
119
|
+
type ComboboxItemProps = Omit<ComboboxItemProps$1, "render"> & WithAsChild & WithDataSlot;
|
|
115
120
|
/**
|
|
116
121
|
* Renders a combobox item inside a Combobox.Content component.
|
|
117
122
|
*
|
|
@@ -129,8 +134,8 @@ type ComboboxItemProps$1 = Omit<ComboboxItemProps, "render"> & WithAsChild & Wit
|
|
|
129
134
|
* </Combobox.Root>
|
|
130
135
|
* ```
|
|
131
136
|
*/
|
|
132
|
-
declare const Item: ({ "data-slot": dataSlot, asChild, children, className, focusOnHover, ref, value, ...props }: ComboboxItemProps
|
|
133
|
-
type ComboboxGroupProps
|
|
137
|
+
declare const Item: ({ "data-slot": dataSlot, asChild, children, className, focusOnHover, ref, value, ...props }: ComboboxItemProps) => import("react").JSX.Element;
|
|
138
|
+
type ComboboxGroupProps = Omit<ComboboxGroupProps$1, "render"> & WithAsChild & WithDataSlot;
|
|
134
139
|
/**
|
|
135
140
|
* Renders a group for Combobox.Item elements.
|
|
136
141
|
*
|
|
@@ -154,8 +159,8 @@ type ComboboxGroupProps$1 = Omit<ComboboxGroupProps, "render"> & WithAsChild & W
|
|
|
154
159
|
* </Combobox.Root>
|
|
155
160
|
* ```
|
|
156
161
|
*/
|
|
157
|
-
declare const Group: ({ "data-slot": dataSlot, asChild, children, className, ref, ...props }: ComboboxGroupProps
|
|
158
|
-
type ComboboxGroupLabelProps
|
|
162
|
+
declare const Group: ({ "data-slot": dataSlot, asChild, children, className, ref, ...props }: ComboboxGroupProps) => import("react").JSX.Element;
|
|
163
|
+
type ComboboxGroupLabelProps = Omit<ComboboxGroupLabelProps$1, "render"> & WithAsChild & WithDataSlot;
|
|
159
164
|
/**
|
|
160
165
|
* Renders a label in a combobox group.
|
|
161
166
|
*
|
|
@@ -179,8 +184,8 @@ type ComboboxGroupLabelProps$1 = Omit<ComboboxGroupLabelProps, "render"> & WithA
|
|
|
179
184
|
* </Combobox.Root>
|
|
180
185
|
* ```
|
|
181
186
|
*/
|
|
182
|
-
declare const GroupLabel: ({ "data-slot": dataSlot, asChild, children, className, ref, ...props }: ComboboxGroupLabelProps
|
|
183
|
-
type ComboboxItemValueProps
|
|
187
|
+
declare const GroupLabel: ({ "data-slot": dataSlot, asChild, children, className, ref, ...props }: ComboboxGroupLabelProps) => import("react").JSX.Element;
|
|
188
|
+
type ComboboxItemValueProps = Omit<ComboboxItemValueProps$1, "render"> & WithAsChild & WithDataSlot;
|
|
184
189
|
/**
|
|
185
190
|
* Highlights the match between the current Combobox.Input value (userValue) and parent Combobox.Item value.
|
|
186
191
|
*
|
|
@@ -212,7 +217,7 @@ type ComboboxItemValueProps$1 = Omit<ComboboxItemValueProps, "render"> & WithAsC
|
|
|
212
217
|
* </Combobox.Root>
|
|
213
218
|
* ```
|
|
214
219
|
*/
|
|
215
|
-
declare const ItemValue: ({ "data-slot": dataSlot, asChild, className, ref, ...props }: ComboboxItemValueProps
|
|
220
|
+
declare const ItemValue: ({ "data-slot": dataSlot, asChild, className, ref, ...props }: ComboboxItemValueProps) => import("react").JSX.Element;
|
|
216
221
|
/**
|
|
217
222
|
* Renders a separator between Combobox.Items or Combobox.Groups.
|
|
218
223
|
*
|
|
@@ -241,15 +246,24 @@ declare const ComboboxSeparatorComponent: ({ "data-slot": dataSlot, className, r
|
|
|
241
246
|
* Choose from a list of suggested values with full keyboard support.
|
|
242
247
|
* It follows the WAI-ARIA Combobox Pattern and builds on the ariakit Combobox.
|
|
243
248
|
*
|
|
244
|
-
* Use Combobox for a list of options where the user types to filter
|
|
249
|
+
* Use Combobox for a list of options where the user types to filter: large static lists,
|
|
245
250
|
* async/server-side data, or any single-select where search is helpful. For very small
|
|
246
251
|
* finite lists with no filtering, prefer Select. For multi-selection, prefer MultiSelect.
|
|
247
252
|
*
|
|
248
|
-
* `Combobox.Content` renders in place at Tailwind `z-50`, Mantle's float tier
|
|
249
|
-
*
|
|
253
|
+
* `Combobox.Content` renders in place at Tailwind `z-50`, Mantle's float tier.
|
|
254
|
+
* It does not portal, so the dialog primitive's Escape guard can see it. Inside
|
|
250
255
|
* an overlay it paints with the overlay's content. Outside one, an open overlay
|
|
251
256
|
* (`z-60`) covers it.
|
|
252
257
|
*
|
|
258
|
+
* @useWhen Pick one value from a long list of options, with a text field that filters the options
|
|
259
|
+
* as the user types.
|
|
260
|
+
*
|
|
261
|
+
* @siblings
|
|
262
|
+
* - `Select`: the list is short and needs no filter.
|
|
263
|
+
* - `MultiSelect`: the user picks several values, shown as tags.
|
|
264
|
+
* - `Command`: the list runs actions or goes to pages, in a palette.
|
|
265
|
+
* - `Query`: the field filters a list with free text and `key:value` qualifiers.
|
|
266
|
+
*
|
|
253
267
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
|
|
254
268
|
* @see https://ariakit.org/components/combobox
|
|
255
269
|
*
|
|
@@ -283,12 +297,12 @@ declare const Combobox: {
|
|
|
283
297
|
/**
|
|
284
298
|
* The outermost part of a combobox. It owns the ariakit store that holds the query text, the open state, and the selection.
|
|
285
299
|
*
|
|
286
|
-
* Use Combobox for a list of options where the user types to filter
|
|
300
|
+
* Use Combobox for a list of options where the user types to filter: large static lists,
|
|
287
301
|
* async/server-side data, or any single-select where search is helpful. For very small
|
|
288
302
|
* finite lists with no filtering, prefer Select. For multi-selection, prefer MultiSelect.
|
|
289
303
|
*
|
|
290
|
-
* `Combobox.Content` renders in place at Tailwind `z-50`, Mantle's float tier
|
|
291
|
-
*
|
|
304
|
+
* `Combobox.Content` renders in place at Tailwind `z-50`, Mantle's float tier.
|
|
305
|
+
* It does not portal, so the dialog primitive's Escape guard can see it.
|
|
292
306
|
* Inside an overlay it paints with the overlay's content. Outside one, an open
|
|
293
307
|
* overlay (`z-60`) covers it.
|
|
294
308
|
*
|
|
@@ -313,8 +327,8 @@ declare const Combobox: {
|
|
|
313
327
|
/**
|
|
314
328
|
* Renders a popover that contains combobox content, e.g. Combobox.Items, Combobox.Groups, and Combobox.Separators.
|
|
315
329
|
*
|
|
316
|
-
* `Combobox.Content` renders in place at Tailwind `z-50`, Mantle's float tier
|
|
317
|
-
*
|
|
330
|
+
* `Combobox.Content` renders in place at Tailwind `z-50`, Mantle's float tier.
|
|
331
|
+
* It does not portal, so the dialog primitive's Escape guard can see it.
|
|
318
332
|
* Inside an overlay it paints with the overlay's content. Outside one, an open
|
|
319
333
|
* overlay (`z-60`) covers it.
|
|
320
334
|
*
|
package/dist/combobox.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{
|
|
1
|
+
"use client";import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{a as n,r}from"./field-Bpvn4tQp.js";import{n as i}from"./separator-DnvhwY2J.js";import{t as a}from"./slot-B7rwscwd.js";import{c as o}from"react/compiler-runtime";import{jsx as s}from"react/jsx-runtime";import{Combobox as c,ComboboxGroup as l,ComboboxGroupLabel as u,ComboboxItem as d,ComboboxItemValue as f,ComboboxPopover as p,ComboboxProvider as m}from"@ariakit/react/combobox";const h={Root:e=>{let t=o(6),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=/* @__PURE__ */ s(m,{...r,children:n}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i},Content:n=>{let r=o(22),i,a,c,l,u,d,f,m;r[0]===n?(i=r[1],a=r[2],c=r[3],l=r[4],u=r[5],d=r[6],f=r[7],m=r[8]):({"data-slot":c,asChild:d,children:i,className:a,ref:u,sameWidth:f,unmountOnHide:m,...l}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=c,r[4]=l,r[5]=u,r[6]=d,r[7]=f,r[8]=m);let h=d!==void 0&&d,_=f===void 0||f,v=m===void 0||m,y;r[9]===c?y=r[10]:(y=t(c,`combobox-content`),r[9]=c,r[10]=y);let b;r[11]===a?b=r[12]:(b=e(`border-popover bg-popover relative z-50 max-h-96 min-w-32 scrollbar overflow-y-scroll overflow-x-hidden rounded-md border shadow-md p-1 my-2 space-y-px font-sans focus:outline-hidden`,a),r[11]=a,r[12]=b);let x=h?g:void 0,S;return r[13]!==i||r[14]!==l||r[15]!==u||r[16]!==_||r[17]!==y||r[18]!==b||r[19]!==x||r[20]!==v?(S=/* @__PURE__ */ s(p,{"data-slot":y,className:b,ref:u,render:x,sameWidth:_,unmountOnHide:v,...l,children:i}),r[13]=i,r[14]=l,r[15]=u,r[16]=_,r[17]=y,r[18]=b,r[19]=x,r[20]=v,r[21]=S):S=r[21],S},Group:n=>{let r=o(18),i,a,c,u,d,f;r[0]===n?(i=r[1],a=r[2],c=r[3],u=r[4],d=r[5],f=r[6]):({"data-slot":c,asChild:f,children:i,className:a,ref:d,...u}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=c,r[4]=u,r[5]=d,r[6]=f);let p=f!==void 0&&f,m;r[7]===c?m=r[8]:(m=t(c,`combobox-group`),r[7]=c,r[8]=m);let h;r[9]===a?h=r[10]:(h=e(`space-y-px`,a),r[9]=a,r[10]=h);let g=p?v:void 0,_;return r[11]!==i||r[12]!==u||r[13]!==d||r[14]!==m||r[15]!==h||r[16]!==g?(_=/* @__PURE__ */ s(l,{"data-slot":m,className:h,ref:d,render:g,...u,children:i}),r[11]=i,r[12]=u,r[13]=d,r[14]=m,r[15]=h,r[16]=g,r[17]=_):_=r[17],_},GroupLabel:n=>{let r=o(18),i,a,c,l,d,f;r[0]===n?(i=r[1],a=r[2],c=r[3],l=r[4],d=r[5],f=r[6]):({"data-slot":c,asChild:f,children:i,className:a,ref:d,...l}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=c,r[4]=l,r[5]=d,r[6]=f);let p=f!==void 0&&f,m;r[7]===c?m=r[8]:(m=t(c,`combobox-group-label`),r[7]=c,r[8]=m);let h;r[9]===a?h=r[10]:(h=e(`text-muted px-2 py-1 text-xs font-medium`,a),r[9]=a,r[10]=h);let g=p?y:void 0,_;return r[11]!==i||r[12]!==l||r[13]!==d||r[14]!==m||r[15]!==h||r[16]!==g?(_=/* @__PURE__ */ s(u,{"data-slot":m,className:h,ref:d,render:g,...l,children:i}),r[11]=i,r[12]=l,r[13]=d,r[14]=m,r[15]=h,r[16]=g,r[17]=_):_=r[17],_},Input:i=>{let a=o(25),l,u,d,f,p,m,h,g;a[0]===i?(l=a[1],u=a[2],d=a[3],f=a[4],p=a[5],m=a[6],h=a[7],g=a[8]):({"data-slot":f,"aria-invalid":l,autoComplete:h,autoSelect:g,className:d,ref:m,validation:u,...p}=i,a[0]=i,a[1]=l,a[2]=u,a[3]=d,a[4]=f,a[5]=p,a[6]=m,a[7]=h,a[8]=g);let _=h===void 0?`list`:h,v=g===void 0?`always`:g,y=n(),b=u??y,x;a[9]!==l||a[10]!==b?(x=r({"aria-invalid":l,validation:b}),a[9]=l,a[10]=b,a[11]=x):x=a[11];let{ariaInvalid:S,validation:C}=x,w;a[12]===f?w=a[13]:(w=t(f,`combobox-input`),a[12]=f,a[13]=w);let T;a[14]===d?T=a[15]:(T=e(`pointer-coarse:text-base h-9 text-sm`,`bg-form relative block w-full rounded-md border px-3 py-2 border-form text-strong font-sans`,`placeholder:text-placeholder`,`aria-disabled:opacity-50`,`hover:border-neutral-400`,`focus:outline-hidden focus:ring-4 aria-expanded:ring-4`,`focus:border-accent-600 focus:ring-focus-accent aria-expanded:border-accent-600 aria-expanded:ring-focus-accent`,`data-validation-success:border-success-600 data-validation-success:focus:border-success-600 data-validation-success:focus:ring-focus-success data-validation-success:aria-expanded:border-success-600 data-validation-success:aria-expanded:ring-focus-success`,`data-validation-warning:border-warning-600 data-validation-warning:focus:border-warning-600 data-validation-warning:focus:ring-focus-warning data-validation-warning:aria-expanded:border-warning-600 data-validation-warning:aria-expanded:ring-focus-warning`,`data-validation-error:border-danger-600 data-validation-error:focus:border-danger-600 data-validation-error:focus:ring-focus-danger data-validation-error:aria-expanded:border-danger-600 data-validation-error:aria-expanded:ring-focus-danger motion-safe:data-validation-error:animate-shake`,`autofill:shadow-(--color-blue-50) autofill:bg-blue-50 autofill:[-webkit-text-fill-color:var(--text-color-strong)]`,d),a[14]=d,a[15]=T);let E=C||void 0,D;return a[16]!==S||a[17]!==_||a[18]!==v||a[19]!==p||a[20]!==m||a[21]!==w||a[22]!==T||a[23]!==E?(D=/* @__PURE__ */ s(c,{"aria-invalid":S,autoComplete:_,autoSelect:v,"data-slot":w,className:T,"data-validation":E,ref:m,...p}),a[16]=S,a[17]=_,a[18]=v,a[19]=p,a[20]=m,a[21]=w,a[22]=T,a[23]=E,a[24]=D):D=a[24],D},Item:n=>{let r=o(22),i,a,c,l,u,f,p,m;r[0]===n?(i=r[1],a=r[2],c=r[3],l=r[4],u=r[5],f=r[6],p=r[7],m=r[8]):({"data-slot":c,asChild:f,children:i,className:a,focusOnHover:p,ref:u,value:m,...l}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=c,r[4]=l,r[5]=u,r[6]=f,r[7]=p,r[8]=m);let h=f!==void 0&&f,g=p===void 0||p,v;r[9]===c?v=r[10]:(v=t(c,`combobox-item`),r[9]=c,r[10]=v);let y;r[11]===a?y=r[12]:(y=e(`cursor-pointer rounded-md px-2 py-1.5 text-strong text-sm flex min-w-0 gap-2 items-center [&>svg]:size-5 [&_svg]:shrink-0`,`data-active-item:bg-active-menu-item`,`aria-disabled:opacity-50`,a),r[11]=a,r[12]=y);let b=h?_:void 0,x;return r[13]!==i||r[14]!==g||r[15]!==l||r[16]!==u||r[17]!==v||r[18]!==y||r[19]!==b||r[20]!==m?(x=/* @__PURE__ */ s(d,{"data-slot":v,className:y,focusOnHover:g,ref:u,render:b,value:m,...l,children:i}),r[13]=i,r[14]=g,r[15]=l,r[16]=u,r[17]=v,r[18]=y,r[19]=b,r[20]=m,r[21]=x):x=r[21],x},ItemValue:n=>{let r=o(16),i,a,c,l,u;r[0]===n?(i=r[1],a=r[2],c=r[3],l=r[4],u=r[5]):({"data-slot":a,asChild:u,className:i,ref:l,...c}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=c,r[4]=l,r[5]=u);let d=u!==void 0&&u,p;r[6]===a?p=r[7]:(p=t(a,`combobox-item-value`),r[6]=a,r[7]=p);let m;r[8]===i?m=r[9]:(m=e(`*:data-user-value:font-medium flex-1 shrink-0 text-strong font-normal`,i),r[8]=i,r[9]=m);let h=d?b:void 0,g;return r[10]!==c||r[11]!==l||r[12]!==p||r[13]!==m||r[14]!==h?(g=/* @__PURE__ */ s(f,{"data-slot":p,className:m,ref:l,render:h,...c}),r[10]=c,r[11]=l,r[12]=p,r[13]=m,r[14]=h,r[15]=g):g=r[15],g},Separator:n=>{let r=o(14),a,c,l,u;r[0]===n?(a=r[1],c=r[2],l=r[3],u=r[4]):({"data-slot":c,className:a,ref:u,...l}=n,r[0]=n,r[1]=a,r[2]=c,r[3]=l,r[4]=u);let d;r[5]===c?d=r[6]:(d=t(c,`combobox-separator`),r[5]=c,r[6]=d);let f;r[7]===a?f=r[8]:(f=e(`-mx-1.25 my-1 w-auto`,a),r[7]=a,r[8]=f);let p;return r[9]!==l||r[10]!==u||r[11]!==d||r[12]!==f?(p=/* @__PURE__ */ s(i,{ref:u,"data-slot":d,className:f,...l}),r[9]=l,r[10]=u,r[11]=d,r[12]=f,r[13]=p):p=r[13],p}};function g(e){let{ref:t,...n}=e;return/* @__PURE__ */ s(a,{ref:t,...n})}function _(e){let{ref:t,...n}=e;return/* @__PURE__ */ s(a,{ref:t,...n})}function v(e){let{ref:t,...n}=e;return/* @__PURE__ */ s(a,{ref:t,...n})}function y(e){let{ref:t,...n}=e;return/* @__PURE__ */ s(a,{ref:t,...n})}function b(e){let{ref:t,...n}=e;return/* @__PURE__ */ s(a,{ref:t,...n})}export{h as Combobox};
|