@ngrok/mantle 0.93.1 → 0.93.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/agent.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngrok/mantle",
3
- "version": "0.93.1",
3
+ "version": "0.93.3",
4
4
  "origin": "https://mantle.ngrok.com",
5
5
  "endpoints": {
6
6
  "docs": "https://mantle.ngrok.com/",
@@ -1345,8 +1345,19 @@
1345
1345
  "summary": "Renders one long opaque value on a single line and keeps its tail visible when it overflows.",
1346
1346
  "jsdoc": "Renders one long opaque value (a URL, a resource ID, an image reference, a token) on a single line.",
1347
1347
  "examples": [
1348
- "```tsx\nimport { TruncatedText } from \"@ngrok/mantle/truncated-text\";\n\n// A URL whose last path segment tells it apart from its neighbors.\n<TruncatedText\n className=\"font-mono text-sm\"\n value=\"https://example.ngrok.app/api/items?filter=%7B%22name%22%3A%22x%22%7D&limit=200\"\n/>\n\n// Keep the six characters that tell two IDs apart.\n<TruncatedText className=\"font-mono text-sm\" tail={6} value=\"ep_2abcdEFGhijKL123456\" />\n\n// As a <code> element.\n<TruncatedText asChild tail={12} value=\"ghcr.io/ngrok/ngrok-operator:0.14.0\">\n <code />\n</TruncatedText>\n```"
1349
- ]
1348
+ "```tsx\nimport { TruncatedText } from \"@ngrok/mantle/truncated-text\";\n\n// A URL whose last path segment tells it apart from its neighbors.\n<TruncatedText\n className=\"font-mono text-sm\"\n value=\"https://example.ngrok.app/api/items?filter=%7B%22name%22%3A%22x%22%7D&limit=200\"\n/>\n\n// Keep the six characters that tell two IDs apart.\n<TruncatedText className=\"font-mono text-sm\" tail={6} value=\"ep_2abcdEFGhijKL123456\" />\n\n// Show an ID as its type prefix, an ellipsis, and its last eight characters.\n<TruncatedText className=\"font-mono text-sm\" head={4} value=\"mem_21h80N9qQuAmhSB8nlTA8KImPbQ\" />\n\n// As a <code> element.\n<TruncatedText asChild tail={12} value=\"ghcr.io/ngrok/ngrok-operator:0.14.0\">\n <code />\n</TruncatedText>\n```"
1349
+ ],
1350
+ "siblings": [
1351
+ {
1352
+ "name": "Code",
1353
+ "boundary": "a short fragment of inline code that never overflows."
1354
+ },
1355
+ {
1356
+ "name": "CodeBlock",
1357
+ "boundary": "a value that may wrap over several lines."
1358
+ }
1359
+ ],
1360
+ "useWhen": "Show one long opaque value on one line, and keep its end visible when it clips."
1350
1361
  },
1351
1362
  {
1352
1363
  "name": "Visually Hidden",
package/dist/llms.txt CHANGED
@@ -1,4 +1,4 @@
1
- # @ngrok/mantle (0.93.1)
1
+ # @ngrok/mantle (0.93.3)
2
2
 
3
3
  > Offline index shipped inside the @ngrok/mantle npm package. The full records, with examples and sibling boundaries, are in agent.json beside this file. Neither file lists props: read the bundled type declarations (`<subpath>.d.ts` beside this file) for every prop and its JSDoc. Live docs: https://mantle.ngrok.com/for-ai-agents.
4
4
 
package/dist/mantle.css CHANGED
@@ -1878,14 +1878,14 @@ pre[data-slot="code-block-code"]:has(.mantle-code-fold-toggle)
1878
1878
  /*
1879
1879
  * The new snapshot is live, so a color transition would fade inside the circle
1880
1880
  * while the rest of the page shows the new theme. Stop transitions during the
1881
- * swap. The icon of the switcher and of the menu item keeps its own swap.
1881
+ * swap. The icon of the switcher and each `ThemeSwitcherIcon` keep their own swap.
1882
1882
  */
1883
1883
  :root[data-theme-transition]
1884
- :not([data-slot~="theme-switcher"] *, [data-slot~="theme-dropdown-menu-item"] *),
1884
+ :not([data-slot~="theme-switcher"] *, [data-slot~="theme-switcher-icon"] *),
1885
1885
  :root[data-theme-transition]
1886
- :not([data-slot~="theme-switcher"] *, [data-slot~="theme-dropdown-menu-item"] *)::before,
1886
+ :not([data-slot~="theme-switcher"] *, [data-slot~="theme-switcher-icon"] *)::before,
1887
1887
  :root[data-theme-transition]
1888
- :not([data-slot~="theme-switcher"] *, [data-slot~="theme-dropdown-menu-item"] *)::after {
1888
+ :not([data-slot~="theme-switcher"] *, [data-slot~="theme-switcher-icon"] *)::after {
1889
1889
  transition: none !important;
1890
1890
  }
1891
1891
 
@@ -1,18 +1,110 @@
1
1
  import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
2
2
  import { t as WithStyleProps } from "./with-style-props-CuT30s0W.js";
3
3
  import { n as IconButtonProps, r as IconButtonAppearance } from "./button-Yxyu1XMd.js";
4
+ import { ReactNode } from "react";
4
5
  /**
5
- * The props for the `ThemeDropdownMenuItem` component.
6
+ * The props for the `ThemeSwitcherIcon` component.
6
7
  */
7
- type ThemeDropdownMenuItemProps = WithStyleProps & {
8
+ type ThemeSwitcherIconProps = WithStyleProps;
9
+ /**
10
+ * The `ThemeSwitcher` icon on its own: a sun or a moon for the applied theme,
11
+ * which swaps with a transition when the theme changes. Put it anywhere in the
12
+ * `children` of a `ThemeDropdownMenuItem`, or of a `DropdownMenu.Item` that
13
+ * uses `useThemeToggle`, and the new theme grows in a circle from it.
14
+ *
15
+ * Reads the applied theme via `useAppliedTheme`, so it must render inside a
16
+ * `ThemeProvider`. It is decorative (`aria-hidden`). Its box is the size of an
17
+ * `Icon`, so it lines up with the icons of other menu rows. It is SSR-safe: a
18
+ * `Skeleton` renders until hydration, then the icon of the applied theme.
19
+ *
20
+ * **Data attributes:**
21
+ *
22
+ * | Data Attribute | Value | Description |
23
+ * | --- | --- | --- |
24
+ * | `data-slot` | `"theme-switcher-icon"` | On the `<span>` that holds the icon. |
25
+ *
26
+ * @see https://mantle.ngrok.com/components/forms/theme-switcher#themeswitchericon
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * <ThemeDropdownMenuItem>
31
+ * <ThemeSwitcherIcon />
32
+ * Theme
33
+ * </ThemeDropdownMenuItem>
34
+ * ```
35
+ */
36
+ declare function ThemeSwitcherIcon({ className, style }: ThemeSwitcherIconProps): import("react").JSX.Element;
37
+ /**
38
+ * The value `useThemeToggle` returns.
39
+ */
40
+ type ThemeToggle = {
8
41
  /**
9
- * The visible label of the item. When set, it is also the accessible
10
- * name. When omitted, the label is "Theme", and the accessible name also
11
- * says which theme the next press shows, such as "Theme: Switch to dark
12
- * theme". Set it for localization.
42
+ * Whether a press cannot change the theme: `true` under a `ThemeProvider`
43
+ * with `forceTheme`. Pass it to the item as `disabled`.
13
44
  */
14
- label?: string;
45
+ disabled: boolean;
46
+ /**
47
+ * The accessible name of the next press, such as "Switch to dark theme" or
48
+ * "Switch to light theme (system default)".
49
+ */
50
+ label: string;
51
+ /**
52
+ * The `onSelect` handler for a `DropdownMenu.Item`. It flips the theme and
53
+ * keeps the menu open. The new theme grows in a circle from the
54
+ * `ThemeSwitcherIcon` in the item, else from the item.
55
+ */
56
+ onSelect: (event: Event) => void;
15
57
  };
58
+ /**
59
+ * The light/dark toggle of `ThemeDropdownMenuItem` for a `DropdownMenu.Item`
60
+ * that you compose yourself. A press flips the theme the same way a
61
+ * `ThemeSwitcher` click does.
62
+ *
63
+ * Reads and writes the theme via `useTheme`, so it must run inside a
64
+ * `ThemeProvider`. Call it in a component that menu content renders: menu
65
+ * content mounts only on the client, so the OS preference in `label` is
66
+ * always known.
67
+ *
68
+ * @see https://mantle.ngrok.com/components/forms/theme-switcher#usethemetoggle
69
+ *
70
+ * @example
71
+ * ```tsx
72
+ * function ThemeItem() {
73
+ * const toggle = useThemeToggle();
74
+ *
75
+ * return (
76
+ * <DropdownMenu.Item disabled={toggle.disabled} onSelect={toggle.onSelect}>
77
+ * <ThemeSwitcherIcon />
78
+ * Theme
79
+ * </DropdownMenu.Item>
80
+ * );
81
+ * }
82
+ * ```
83
+ */
84
+ declare function useThemeToggle(): ThemeToggle;
85
+ /**
86
+ * The props for the `ThemeDropdownMenuItem` component. Set `label` or
87
+ * `children`, not both.
88
+ */
89
+ type ThemeDropdownMenuItemProps = WithStyleProps & ({
90
+ /**
91
+ * The visible label of the default row. When set, it is also the
92
+ * accessible name. When omitted, the label is "Theme", and the
93
+ * accessible name also says which theme the next press shows, such as
94
+ * "Theme: Switch to dark theme". Set it for localization.
95
+ */
96
+ label?: string;
97
+ children?: never;
98
+ } | {
99
+ /**
100
+ * The content of the item, in place of the default row. Put a
101
+ * `ThemeSwitcherIcon` where the icon goes. The content is also the
102
+ * accessible name. Children that render nothing (`false`, `true`,
103
+ * or `""`) keep the default row.
104
+ */
105
+ children: ReactNode;
106
+ label?: never;
107
+ });
16
108
  /**
17
109
  * Must render inside a `DropdownMenu.Content` or `DropdownMenu.SubContent` —
18
110
  * the type system cannot express this constraint, so it is on you to uphold it.
@@ -23,6 +115,10 @@ type ThemeDropdownMenuItemProps = WithStyleProps & {
23
115
  * click does, and the icon swaps between the sun and the moon. The menu stays
24
116
  * open, and the new theme grows in a circle from the icon.
25
117
  *
118
+ * To lay out the row yourself, such as with the icon first, pass `children`
119
+ * and put a `ThemeSwitcherIcon` in them. To wire a `DropdownMenu.Item` of your
120
+ * own, call `useThemeToggle`.
121
+ *
26
122
  * Reads and writes the theme via `useTheme`, so it must render inside a
27
123
  * `ThemeProvider`. Under a provider with `forceTheme`, it shows the forced
28
124
  * theme and is disabled. For a control in a header or toolbar, use
@@ -33,7 +129,7 @@ type ThemeDropdownMenuItemProps = WithStyleProps & {
33
129
  * | Data Attribute | Value | Description |
34
130
  * | --- | --- | --- |
35
131
  * | `data-slot` | `"theme-dropdown-menu-item"` | On the item element. |
36
- * | `data-slot` | `"theme-dropdown-menu-item-label"` | On the `<span>` that holds the `label`. |
132
+ * | `data-slot` | `"theme-dropdown-menu-item-label"` | On the `<span>` that holds the `label`. The item renders it only when `children` is omitted. |
37
133
  *
38
134
  * @see https://mantle.ngrok.com/components/forms/theme-switcher#themedropdownmenuitem
39
135
  *
@@ -49,8 +145,24 @@ type ThemeDropdownMenuItemProps = WithStyleProps & {
49
145
  * </DropdownMenu.Content>
50
146
  * </DropdownMenu.Root>
51
147
  * ```
148
+ *
149
+ * @example
150
+ * ```tsx
151
+ * <DropdownMenu.Root>
152
+ * <DropdownMenu.Trigger asChild>
153
+ * <Button type="button" appearance="outlined" intent="neutral">Account</Button>
154
+ * </DropdownMenu.Trigger>
155
+ * <DropdownMenu.Content>
156
+ * <DropdownMenu.Item>Profile</DropdownMenu.Item>
157
+ * <ThemeDropdownMenuItem>
158
+ * <ThemeSwitcherIcon />
159
+ * Theme
160
+ * </ThemeDropdownMenuItem>
161
+ * </DropdownMenu.Content>
162
+ * </DropdownMenu.Root>
163
+ * ```
52
164
  */
53
- declare function ThemeDropdownMenuItem({ className, label, style }: ThemeDropdownMenuItemProps): import("react").JSX.Element;
165
+ declare function ThemeDropdownMenuItem({ children, className, label, style }: ThemeDropdownMenuItemProps): import("react").JSX.Element;
54
166
  /**
55
167
  * The props for the `ThemeSwitcher` component. Forwards `IconButton`'s props,
56
168
  * except the parts the switcher owns: `icon` (the SSR-safe themed icon) and
@@ -109,4 +221,4 @@ type ThemeSwitcherProps = Omit<IconButtonProps, "appearance" | "asChild" | "chil
109
221
  * ```
110
222
  */
111
223
  declare function ThemeSwitcher({ appearance, "data-slot": dataSlot, disabled, label, onClick, ...props }: ThemeSwitcherProps): import("react").JSX.Element;
112
- export { ThemeDropdownMenuItem, type ThemeDropdownMenuItemProps, ThemeSwitcher, type ThemeSwitcherProps };
224
+ export { ThemeDropdownMenuItem, type ThemeDropdownMenuItemProps, ThemeSwitcher, ThemeSwitcherIcon, type ThemeSwitcherIconProps, type ThemeSwitcherProps, type ThemeToggle, useThemeToggle };
@@ -1 +1 @@
1
- import{r as e,t}from"./browser-only-BTSrYWLj.js";import{t as n}from"./cx-CK7o_rVv.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{r as i}from"./button-Dge0D5bl.js";import{t as a}from"./button-B8k98Pby.js";import{t as o}from"./use-matches-media-query-m860lols.js";import{t as s}from"./skeleton-DBpI-ko5.js";import{t as c}from"./dropdown-menu-BHBzCDSZ.js";import{c as l,p as u,s as d,u as f}from"./theme-C-glc5Q-.js";import{n as p}from"./icons-DP3lQw5O.js";import{c as m}from"react/compiler-runtime";import{useRef as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";const v={light:/* @__PURE__ */ g(p,{theme:`light`}),dark:/* @__PURE__ */ g(p,{theme:`dark`})};function y(e){let t=m(23),{className:r,label:a,style:s}=e,[p,y]=f(),b=d(),S=l(),C=o(`(prefers-color-scheme: dark)`),w=h(null),T,E;if(t[0]!==a||t[1]!==C||t[2]!==p){let e=u({theme:p,prefersDarkMode:C});T=c.Item,E=a==null?`Theme: ${x(e,{prefersDarkMode:C})}`:void 0,t[0]=a,t[1]=C,t[2]=p,t[3]=T,t[4]=E}else T=t[3],E=t[4];let D;t[5]===r?D=t[6]:(D=n(`gap-2`,r),t[5]=r,t[6]=D);let O=S!=null,k;t[7]!==C||t[8]!==y?(k=e=>{e.preventDefault(),y(e=>u({theme:e,prefersDarkMode:C}),{origin:w.current})},t[7]=C,t[8]=y,t[9]=k):k=t[9];let A=a??`Theme`,j;t[10]===A?j=t[11]:(j=/* @__PURE__ */ g(`span`,{"data-slot":`theme-dropdown-menu-item-label`,className:`flex-1`,children:A}),t[10]=A,t[11]=j);let M;t[12]===b?M=t[13]:(M=/* @__PURE__ */ g(`span`,{ref:w,"aria-hidden":!0,className:`flex size-7 shrink-0 items-center justify-center text-muted [&_svg]:size-5`,children:/* @__PURE__ */ g(i,{active:b,icons:v})}),t[12]=b,t[13]=M);let N;return t[14]!==T||t[15]!==s||t[16]!==E||t[17]!==D||t[18]!==O||t[19]!==k||t[20]!==j||t[21]!==M?(N=/* @__PURE__ */ _(T,{"aria-label":E,"data-slot":`theme-dropdown-menu-item`,className:D,disabled:O,style:s,onSelect:k,children:[j,M]}),t[14]=T,t[15]=s,t[16]=E,t[17]=D,t[18]=O,t[19]=k,t[20]=j,t[21]=M,t[22]=N):N=t[22],N}function b(n){let c=m(28),p,h,_,y,b,S;c[0]===n?(p=c[1],h=c[2],_=c[3],y=c[4],b=c[5],S=c[6]):({appearance:S,"data-slot":p,disabled:h,label:_,onClick:y,...b}=n,c[0]=n,c[1]=p,c[2]=h,c[3]=_,c[4]=y,c[5]=b,c[6]=S);let C=S===void 0?`ghost`:S,[w,T]=f(),E=d(),D=l(),O=o(`(prefers-color-scheme: dark)`),k=e(),A;if(c[7]!==k||c[8]!==O||c[9]!==w){let e=u({theme:w,prefersDarkMode:O});A=k?x(e,{prefersDarkMode:O}):`Toggle theme`,c[7]=k,c[8]=O,c[9]=w,c[10]=A}else A=c[10];let j=A,M;c[11]===p?M=c[12]:(M=r(p,`theme-switcher`),c[11]=p,c[12]=M);let N=D!=null||h,P;c[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=/* @__PURE__ */ g(s,{asChild:!0,className:`rounded-full size-5`,children:/* @__PURE__ */ g(`span`,{})}),c[13]=P):P=c[13];let F;c[14]===E?F=c[15]:(F=/* @__PURE__ */ g(t,{fallback:P,children:()=>/* @__PURE__ */ g(i,{active:E,icons:v})}),c[14]=E,c[15]=F);let I=_??(D==null?j:`Theme set by this page`),L;c[16]!==y||c[17]!==O||c[18]!==T?(L=e=>{y?.(e),e.defaultPrevented||T(e=>u({theme:e,prefersDarkMode:O}),{origin:e.currentTarget})},c[16]=y,c[17]=O,c[18]=T,c[19]=L):L=c[19];let R;return c[20]!==C||c[21]!==b||c[22]!==M||c[23]!==N||c[24]!==F||c[25]!==I||c[26]!==L?(R=/* @__PURE__ */ g(a,{appearance:C,"data-slot":M,disabled:N,intent:`neutral`,icon:F,label:I,onClick:L,...b}),c[20]=C,c[21]=b,c[22]=M,c[23]=N,c[24]=F,c[25]=I,c[26]=L,c[27]=R):R=c[27],R}function x(e,{prefersDarkMode:t}){return e===`system`?t?`Switch to dark theme (system default)`:`Switch to light theme (system default)`:`Switch to ${e} theme`}export{y as ThemeDropdownMenuItem,b as ThemeSwitcher};
1
+ import{r as e,t}from"./browser-only-BTSrYWLj.js";import{t as n}from"./cx-CK7o_rVv.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{r as i}from"./button-Dge0D5bl.js";import{t as a}from"./button-B8k98Pby.js";import{t as o}from"./use-matches-media-query-m860lols.js";import{t as s}from"./skeleton-DBpI-ko5.js";import{t as c}from"./dropdown-menu-BHBzCDSZ.js";import{c as l,p as u,s as d,u as f}from"./theme-C-glc5Q-.js";import{n as p}from"./icons-DP3lQw5O.js";import{c as m}from"react/compiler-runtime";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";const v={light:/* @__PURE__ */ g(p,{theme:`light`}),dark:/* @__PURE__ */ g(p,{theme:`dark`})};function y(e){let r=m(9),{className:a,style:o}=e,c=d(),l;r[0]===a?l=r[1]:(l=n(`flex shrink-0 items-center justify-center text-muted`,a),r[0]=a,r[1]=l);let u;r[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=/* @__PURE__ */ g(s,{asChild:!0,className:`rounded-full size-5`,children:/* @__PURE__ */ g(`span`,{})}),r[2]=u):u=r[2];let f;r[3]===c?f=r[4]:(f=/* @__PURE__ */ g(t,{fallback:u,children:()=>/* @__PURE__ */ g(i,{active:c,icons:v})}),r[3]=c,r[4]=f);let p;return r[5]!==o||r[6]!==l||r[7]!==f?(p=/* @__PURE__ */ g(`span`,{"aria-hidden":!0,"data-slot":`theme-switcher-icon`,className:l,style:o,children:f}),r[5]=o,r[6]=l,r[7]=f,r[8]=p):p=r[8],p}function b(){let e=m(10),[t,n]=f(),r=l(),i=o(`(prefers-color-scheme: dark)`),a=r!=null,s;e[0]!==i||e[1]!==t?(s=C(u({theme:t,prefersDarkMode:i}),{prefersDarkMode:i}),e[0]=i,e[1]=t,e[2]=s):s=e[2];let c;e[3]!==i||e[4]!==n?(c=e=>{e.preventDefault();let t=e.currentTarget instanceof Element?e.currentTarget:null;n(e=>u({theme:e,prefersDarkMode:i}),{origin:t?.querySelector(`[data-slot~="theme-switcher-icon"]`)??t})},e[3]=i,e[4]=n,e[5]=c):c=e[5];let d;return e[6]!==a||e[7]!==s||e[8]!==c?(d={disabled:a,label:s,onSelect:c},e[6]=a,e[7]=s,e[8]=c,e[9]=d):d=e[9],d}function x(e){let t=m(13),{children:r,className:i,label:a,style:o}=e,s=b(),l=r!=null&&typeof r!=`boolean`&&r!==``,u=a==null&&!l?`Theme: ${s.label}`:void 0,d;t[0]===i?d=t[1]:(d=n(`gap-2`,i),t[0]=i,t[1]=d);let f;t[2]!==r||t[3]!==l||t[4]!==a?(f=l?r:/* @__PURE__ */ _(h,{children:[/* @__PURE__ */ g(`span`,{"data-slot":`theme-dropdown-menu-item-label`,className:`flex-1`,children:a??`Theme`}),/* @__PURE__ */ g(y,{className:`size-7`})]}),t[2]=r,t[3]=l,t[4]=a,t[5]=f):f=t[5];let p;return t[6]!==o||t[7]!==u||t[8]!==d||t[9]!==f||t[10]!==s.disabled||t[11]!==s.onSelect?(p=/* @__PURE__ */ g(c.Item,{"aria-label":u,"data-slot":`theme-dropdown-menu-item`,className:d,disabled:s.disabled,style:o,onSelect:s.onSelect,children:f}),t[6]=o,t[7]=u,t[8]=d,t[9]=f,t[10]=s.disabled,t[11]=s.onSelect,t[12]=p):p=t[12],p}function S(n){let c=m(28),p,h,_,y,b,x;c[0]===n?(p=c[1],h=c[2],_=c[3],y=c[4],b=c[5],x=c[6]):({appearance:x,"data-slot":p,disabled:h,label:_,onClick:y,...b}=n,c[0]=n,c[1]=p,c[2]=h,c[3]=_,c[4]=y,c[5]=b,c[6]=x);let S=x===void 0?`ghost`:x,[w,T]=f(),E=d(),D=l(),O=o(`(prefers-color-scheme: dark)`),k=e(),A;if(c[7]!==k||c[8]!==O||c[9]!==w){let e=u({theme:w,prefersDarkMode:O});A=k?C(e,{prefersDarkMode:O}):`Toggle theme`,c[7]=k,c[8]=O,c[9]=w,c[10]=A}else A=c[10];let j=A,M;c[11]===p?M=c[12]:(M=r(p,`theme-switcher`),c[11]=p,c[12]=M);let N=D!=null||h,P;c[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=/* @__PURE__ */ g(s,{asChild:!0,className:`rounded-full size-5`,children:/* @__PURE__ */ g(`span`,{})}),c[13]=P):P=c[13];let F;c[14]===E?F=c[15]:(F=/* @__PURE__ */ g(t,{fallback:P,children:()=>/* @__PURE__ */ g(i,{active:E,icons:v})}),c[14]=E,c[15]=F);let I=_??(D==null?j:`Theme set by this page`),L;c[16]!==y||c[17]!==O||c[18]!==T?(L=e=>{y?.(e),e.defaultPrevented||T(e=>u({theme:e,prefersDarkMode:O}),{origin:e.currentTarget})},c[16]=y,c[17]=O,c[18]=T,c[19]=L):L=c[19];let R;return c[20]!==S||c[21]!==b||c[22]!==M||c[23]!==N||c[24]!==F||c[25]!==I||c[26]!==L?(R=/* @__PURE__ */ g(a,{appearance:S,"data-slot":M,disabled:N,intent:`neutral`,icon:F,label:I,onClick:L,...b}),c[20]=S,c[21]=b,c[22]=M,c[23]=N,c[24]=F,c[25]=I,c[26]=L,c[27]=R):R=c[27],R}function C(e,{prefersDarkMode:t}){return e===`system`?t?`Switch to dark theme (system default)`:`Switch to light theme (system default)`:`Switch to ${e} theme`}export{x as ThemeDropdownMenuItem,S as ThemeSwitcher,y as ThemeSwitcherIcon,b as useThemeToggle};
@@ -6,6 +6,14 @@ import { ComponentProps } from "react";
6
6
  * and `asChild` takes the single element to render it in.
7
7
  */
8
8
  type TruncatedTextProps = Omit<ComponentProps<"span">, "children" | "translate"> & SelfClosingWithAsChild & WithDataSlot & {
9
+ /**
10
+ * The most graphemes the head shows before the ellipsis. When set, a value
11
+ * longer than `head + tail` graphemes always clips to that shape, such as
12
+ * `ep_…KL123456`, even when its container holds more. A narrower container
13
+ * clips the head further. Counts grapheme clusters, like `tail`. Must be a
14
+ * non-negative integer. When omitted, the head fills its container.
15
+ */
16
+ head?: number;
9
17
  /**
10
18
  * How many graphemes stay visible at the end of the value. Counts grapheme
11
19
  * clusters, so an emoji or a letter with a combining mark counts once. Must
@@ -73,13 +81,23 @@ type TruncatedTextProps = Omit<ComponentProps<"span">, "children" | "translate">
73
81
  * over-reserve of narrow glyphs can clip. The layout effect after mount
74
82
  * replaces the estimate with the measured width.
75
83
  *
84
+ * **Head length.** Pass `head` to show at most that many graphemes before the
85
+ * ellipsis. A value longer than `head + tail` graphemes then always clips to
86
+ * that shape, even when its container holds more, and the root shrinks to it.
87
+ * For an ngrok resource ID, `head={id.indexOf("_") + 1}` keeps the type prefix:
88
+ * `mem_…A8KImPbQ`. The head rounds up to whole `ch`, so a proportional font can
89
+ * show one more narrow glyph before the ellipsis.
90
+ *
76
91
  * **Selection.** The root carries `user-select: all`, so one click selects the
77
92
  * whole value across both segments, and a copy yields the full string. Pass
78
93
  * `className="select-text"` to opt out.
79
94
  *
80
95
  * **Tooltip.** The tooltip shows the full value and opens only while the value
81
- * overflows. It needs a `TooltipProvider` ancestor, like every mantle tooltip,
82
- * and throws without one. The server render and the first client render assume
96
+ * overflows. The tooltip is up to 24rem wide, so a resource ID fits on one
97
+ * line. A longer value breaks into lines of near-equal length, and the tooltip
98
+ * narrows to the longest line. It
99
+ * needs a `TooltipProvider` ancestor, like every mantle tooltip, and throws
100
+ * without one. The server render and the first client render assume
83
101
  * no overflow; the measurement after mount adds the tooltip and `data-truncated`.
84
102
  * While the value overflows, the root is focusable, so Tab reaches it, a screen
85
103
  * reader announces the whole value, and the tooltip opens. A value that fits is
@@ -119,6 +137,12 @@ type TruncatedTextProps = Omit<ComponentProps<"span">, "children" | "translate">
119
137
  * | `data-truncated` | present while the value overflows | Presence-only. Style with `data-truncated:`. Absent on the server render. |
120
138
  * | `data-state` | `"closed"` \| `"delayed-open"` \| `"instant-open"` | The tooltip state Radix stamps on the root. Absent inside a control. |
121
139
  *
140
+ * @useWhen Show one long opaque value on one line, and keep its end visible when it clips.
141
+ *
142
+ * @siblings
143
+ * - `Code`: a short fragment of inline code that never overflows.
144
+ * - `CodeBlock`: a value that may wrap over several lines.
145
+ *
122
146
  * @see https://mantle.ngrok.com/components/data-display/truncated-text
123
147
  *
124
148
  * @example
@@ -134,11 +158,14 @@ type TruncatedTextProps = Omit<ComponentProps<"span">, "children" | "translate">
134
158
  * // Keep the six characters that tell two IDs apart.
135
159
  * <TruncatedText className="font-mono text-sm" tail={6} value="ep_2abcdEFGhijKL123456" />
136
160
  *
161
+ * // Show an ID as its type prefix, an ellipsis, and its last eight characters.
162
+ * <TruncatedText className="font-mono text-sm" head={4} value="mem_21h80N9qQuAmhSB8nlTA8KImPbQ" />
163
+ *
137
164
  * // As a <code> element.
138
165
  * <TruncatedText asChild tail={12} value="ghcr.io/ngrok/ngrok-operator:0.14.0">
139
166
  * <code />
140
167
  * </TruncatedText>
141
168
  * ```
142
169
  */
143
- declare const TruncatedText: ({ "aria-describedby": describedBy, asChild, children, className, "data-slot": dataSlot, onFocus, onPointerMove, ref, style, tabIndex, tail, translate, value, ...props }: TruncatedTextProps) => import("react").JSX.Element;
170
+ declare const TruncatedText: ({ "aria-describedby": describedBy, asChild, children, className, "data-slot": dataSlot, onFocus, onPointerMove, ref, head, style, tabIndex, tail, translate, value, ...props }: TruncatedTextProps) => import("react").JSX.Element;
144
171
  export { TruncatedText, type TruncatedTextProps };
@@ -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"./cx-CK7o_rVv.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{t as i}from"./slot-DdYN1L1C.js";import{t as a}from"./css-properties-D85fCNV3.js";import{t as o}from"./tooltip-b6oiTaWq.js";import{c as ee}from"react/compiler-runtime";import{Children as s,cloneElement as te,isValidElement as ne,useRef as re,useState as c}from"react";import ie from"tiny-invariant";import{Fragment as ae,jsx as l,jsxs as oe}from"react/jsx-runtime";import{Root as se,Trigger as ce}from"@radix-ui/react-tooltip";let u;function le(e,t){ie(Number.isInteger(t)&&t>=0,`TruncatedText: \`tail\` must be a non-negative integer, received ${String(t)}.`),u??=new Intl.Segmenter(void 0,{granularity:`grapheme`});let n=Array.from(u.segment(e),e=>e.segment);if(n.length<=t)return{head:``,tail:e,tailGraphemes:n.length};let r=n.length-t;return{head:n.slice(0,r).join(``),tail:n.slice(r).join(``),tailGraphemes:t}}function d(e){let t=document.createRange();return t.selectNodeContents(e),t.getBoundingClientRect().width}function f(e){let t=getComputedStyle(e),n=[t.paddingLeft,t.paddingRight,t.borderLeftWidth,t.borderRightWidth].reduce((e,t)=>e+(Number.parseFloat(t)||0),0);return e.getBoundingClientRect().width-n}function ue(e,t,n){let r=d(n);return{tailWidth:r,truncated:d(t)+r>f(e)+.5}}function de(e){return e.parentElement?.closest(`a[href], button, input, select, textarea, summary, [contenteditable=""], [contenteditable="true"], [role="button"], [role="checkbox"], [role="link"], [role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"], [role="radio"], [role="switch"], [role="tab"], [role="treeitem"]`)!=null}const fe=String.raw`inline-block overflow-hidden text-ellipsis whitespace-nowrap align-bottom before:content-['\200B'] max-w-[calc(100%_-_var(--_tail-width)_+_0.5px)] [[data-truncated]>&]:max-w-[max(1ch_+_0.5px,calc(round(down,100%_-_var(--_tail-width),1ch)_+_0.5px))]`,pe=e=>{let t=ee(8),n,r,a;if(t[0]!==e){let{"aria-describedby":i,asChild:o,describedBy:ee,...s}=e;a=o,n=ee,r=s,t[0]=e,t[1]=n,t[2]=r,t[3]=a}else n=t[1],r=t[2],a=t[3];let o=a!==void 0&&a?i:`span`,s;return t[4]!==o||t[5]!==n||t[6]!==r?(s=/* @__PURE__ */ l(o,{"aria-describedby":n,...r}),t[4]=o,t[5]=n,t[6]=r,t[7]=s):s=t[7],s},p=i=>{let u=ee(83),d,f,p,m,h,g,_,v,y,b,x,S,C,w;u[0]===i?(d=u[1],f=u[2],p=u[3],m=u[4],h=u[5],g=u[6],_=u[7],v=u[8],y=u[9],b=u[10],x=u[11],S=u[12],C=u[13],w=u[14]):({"aria-describedby":m,asChild:b,children:d,className:f,"data-slot":p,onFocus:h,onPointerMove:g,ref:v,style:y,tabIndex:C,tail:x,translate:S,value:w,..._}=i,u[0]=i,u[1]=d,u[2]=f,u[3]=p,u[4]=m,u[5]=h,u[6]=g,u[7]=_,u[8]=v,u[9]=y,u[10]=b,u[11]=x,u[12]=S,u[13]=C,u[14]=w);let me=b!==void 0&&b,T=x===void 0?8:x,E=S===void 0?`no`:S,D;u[15]!==T||u[16]!==w?(D=le(w,T),u[15]=T,u[16]=w,u[17]=D):D=u[17];let{head:O,tail:k,tailGraphemes:he}=D,[A,ge]=c(null),_e=re(null),ve=re(null),ye=t(v,ge),[be,xe]=c(null),[Se,Ce]=c(!1),[j,we]=c(!1),M=be?.truncated===!0,N;u[18]===A?N=u[19]:(N=()=>{A?.isConnected&&we(de(A))},u[18]=A,u[19]=N),e(N);let P;u[20]===A?P=u[21]:(P=()=>{let e=_e.current,t=ve.current;if(A==null||e==null||t==null)return;let n=()=>{let n=ue(A,e,t);xe(e=>e!=null&&e.tailWidth===n.tailWidth&&e.truncated===n.truncated?e:n),n.truncated||Ce(!1)};n();let r=new ResizeObserver(n);return r.observe(A),r.observe(t),()=>{r.disconnect()}},u[20]=A,u[21]=P);let F;u[22]!==A||u[23]!==T||u[24]!==w?(F=[A,w,T],u[22]=A,u[23]=T,u[24]=w,u[25]=F):F=u[25],e(P,F);let Te=be==null?`${he}ch`:`${be.tailWidth}px`,I;u[26]===w?I=u[27]:(I=/* @__PURE__ */ l(`span`,{"data-slot":`truncated-text-value`,className:`sr-only select-none`,children:w}),u[26]=w,u[27]=I);let L;u[28]===O?L=u[29]:(L=/* @__PURE__ */ l(`span`,{ref:_e,"aria-hidden":!0,"data-slot":`truncated-text-head`,className:fe,children:O}),u[28]=O,u[29]=L);let R;u[30]===k?R=u[31]:(R=/* @__PURE__ */ l(`span`,{ref:ve,"aria-hidden":!0,"data-slot":`truncated-text-tail`,dir:`rtl`,className:`inline-block overflow-hidden whitespace-nowrap text-left align-bottom min-w-(--_tail-width) [[data-truncated]>&]:min-w-0 [[data-truncated]>&]:max-w-[calc(round(down,100%_-_1ch_-_var(--_tail-width),1ch)_+_var(--_tail-width))] [[data-truncated]>:empty+&]:max-w-[calc(round(down,100%_-_var(--_tail-width),1ch)_+_var(--_tail-width)_+_0.5px)] [[data-truncated]>:empty+&]:text-ellipsis`,children:/* @__PURE__ */ l(`span`,{dir:`ltr`,children:k})}),u[30]=k,u[31]=R);let z;u[32]!==R||u[33]!==I||u[34]!==L?(z=/* @__PURE__ */ oe(ae,{children:[I,L,R]}),u[32]=R,u[33]=I,u[34]=L,u[35]=z):z=u[35];let B=z,V;u[36]===p?V=u[37]:(V=r(p,`truncated-text`),u[36]=p,u[37]=V);let Ee=M?``:void 0,H;u[38]===f?H=u[39]:(H=n(`inline-block min-w-0 max-w-full rounded whitespace-nowrap select-all [font-variant-ligatures:none] focus:outline-hidden focus-visible:ring-3 focus-visible:ring-focus-accent data-truncated:cursor-help`,f),u[38]=f,u[39]=H);let U;u[40]!==y||u[41]!==Te?(U=a({"--_tail-width":Te,...y}),u[40]=y,u[41]=Te,u[42]=U):U=u[42];let De=M&&!j?C??0:C,W;u[43]!==j||u[44]!==M||u[45]!==g?(W=e=>{g?.(e),!M&&!j&&e.preventDefault()},u[43]=j,u[44]=M,u[45]=g,u[46]=W):W=u[46];let G;u[47]!==j||u[48]!==M||u[49]!==h?(G=e=>{h?.(e),!M&&!j&&e.preventDefault()},u[47]=j,u[48]=M,u[49]=h,u[50]=G):G=u[50];let K;u[51]!==ye||u[52]!==_||u[53]!==V||u[54]!==Ee||u[55]!==H||u[56]!==U||u[57]!==De||u[58]!==W||u[59]!==G||u[60]!==E?(K={ref:ye,"data-slot":V,"data-truncated":Ee,dir:`ltr`,className:H,style:U,tabIndex:De,onPointerMove:W,onFocus:G,translate:E,..._},u[51]=ye,u[52]=_,u[53]=V,u[54]=Ee,u[55]=H,u[56]=U,u[57]=De,u[58]=W,u[59]=G,u[60]=E,u[61]=K):K=u[61];let q=K,J;if(me){let e;if(u[62]!==d||u[63]!==m||u[64]!==q||u[65]!==B){let t=s.only(d);ie(ne(t),"When using `asChild`, TruncatedText must be passed a single child as a JSX tag."),ie(t.props.children==null,"When using `asChild`, the child of TruncatedText must have no children of its own. `value` is the content."),e=/* @__PURE__ */ l(pe,{asChild:!0,describedBy:m,...q,children:te(t,{},B)}),u[62]=d,u[63]=m,u[64]=q,u[65]=B,u[66]=e}else e=u[66];J=e}else{let e;u[67]!==m||u[68]!==q||u[69]!==B?(e=/* @__PURE__ */ l(pe,{describedBy:m,...q,children:B}),u[67]=m,u[68]=q,u[69]=B,u[70]=e):e=u[70],J=e}if(j)return J;let Y=M&&Se,X;u[71]===M?X=u[72]:(X=e=>Ce(M&&e),u[71]=M,u[72]=X);let Z;u[73]===J?Z=u[74]:(Z=/* @__PURE__ */ l(ce,{asChild:!0,children:J}),u[73]=J,u[74]=Z);let Q;u[75]!==E||u[76]!==w?(Q=/* @__PURE__ */ l(o.Content,{className:`break-all`,translate:E,children:w}),u[75]=E,u[76]=w,u[77]=Q):Q=u[77];let $;return u[78]!==Y||u[79]!==X||u[80]!==Z||u[81]!==Q?($=/* @__PURE__ */ oe(se,{open:Y,onOpenChange:X,children:[Z,Q]}),u[78]=Y,u[79]=X,u[80]=Z,u[81]=Q,u[82]=$):$=u[82],$};export{p as TruncatedText};
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"./slot-DdYN1L1C.js";import{t as a}from"./css-properties-D85fCNV3.js";import{t as o}from"./tooltip-b6oiTaWq.js";import{c as s}from"react/compiler-runtime";import{Children as c,cloneElement as ee,isValidElement as te,useRef as ne,useState as l}from"react";import u from"tiny-invariant";import{Fragment as re,jsx as d,jsxs as ie}from"react/jsx-runtime";import{Root as ae,Trigger as oe}from"@radix-ui/react-tooltip";let f;function se(e,{head:t,tail:n}){u(Number.isInteger(n)&&n>=0,`TruncatedText: \`tail\` must be a non-negative integer, received ${String(n)}.`),u(t==null||Number.isInteger(t)&&t>=0,`TruncatedText: \`head\` must be a non-negative integer, received ${String(t)}.`),f??=new Intl.Segmenter(void 0,{granularity:`grapheme`});let r=Array.from(f.segment(e),e=>e.segment);if(r.length<=n)return{head:``,lead:null,tail:e,tailGraphemes:r.length};let i=r.length-n,a=t!=null&&r.length>t+n;return{head:r.slice(0,i).join(``),lead:a?r.slice(0,t).join(``):null,tail:r.slice(i).join(``),tailGraphemes:n}}function p(e){let t=document.createRange();return t.selectNodeContents(e),t.getBoundingClientRect().width}function m(e){let t=getComputedStyle(e),n=[t.paddingLeft,t.paddingRight,t.borderLeftWidth,t.borderRightWidth].reduce((e,t)=>e+(Number.parseFloat(t)||0),0);return e.getBoundingClientRect().width-n}function ce({root:e,head:t,tail:n,lead:r}){let i=p(t),a=p(n),o=i+a>m(e)+.5,s=t.firstChild;if(r==null||!(s instanceof Text))return{headCap:null,tailWidth:a,truncated:o};let c=document.createRange();return c.setStart(s,0),c.setEnd(s,Math.min(r.length,s.length)),{headCap:Math.min(c.getBoundingClientRect().width+p(r.ellipsis),i),tailWidth:a,truncated:o}}function le(e){if(e==null)return;e.style.width=``;let t=document.createRange();t.selectNodeContents(e);let n=Math.max(...Array.from(t.getClientRects(),e=>e.width)),r=e.getBoundingClientRect().width/Number.parseFloat(getComputedStyle(e).width);Number.isFinite(n)&&r>0&&(e.style.width=`${Math.ceil(n/r)}px`)}function ue(e){return e.parentElement?.closest(`a[href], button, input, select, textarea, summary, [contenteditable=""], [contenteditable="true"], [role="button"], [role="checkbox"], [role="link"], [role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"], [role="radio"], [role="switch"], [role="tab"], [role="treeitem"]`)!=null}const de=String.raw`inline-block overflow-hidden text-ellipsis whitespace-nowrap align-bottom before:content-['\200B'] max-w-[calc(100%_-_var(--_tail-width)_+_0.5px)] [[data-truncated]>&]:max-w-[max(1ch_+_0.5px,calc(round(down,100%_-_var(--_tail-width),1ch)_+_0.5px))]`,fe=e=>{let t=s(8),n,r,a;if(t[0]!==e){let{"aria-describedby":i,asChild:o,describedBy:s,...c}=e;a=o,n=s,r=c,t[0]=e,t[1]=n,t[2]=r,t[3]=a}else n=t[1],r=t[2],a=t[3];let o=a!==void 0&&a?i:`span`,c;return t[4]!==o||t[5]!==n||t[6]!==r?(c=/* @__PURE__ */ d(o,{"aria-describedby":n,...r}),t[4]=o,t[5]=n,t[6]=r,t[7]=c):c=t[7],c},h=i=>{let f=s(97),p,m,h,g,_,v,y,b,x,S,C,w,T,E,D;f[0]===i?(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],w=f[12],T=f[13],E=f[14],D=f[15]):({"aria-describedby":g,asChild:C,children:p,className:m,"data-slot":h,onFocus:v,onPointerMove:y,ref:x,head:_,style:S,tabIndex:E,tail:w,translate:T,value:D,...b}=i,f[0]=i,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,f[12]=w,f[13]=T,f[14]=E,f[15]=D);let pe=C!==void 0&&C,O=w===void 0?8:w,k=T===void 0?`no`:T,me;f[16]!==_||f[17]!==O||f[18]!==D?(me=se(D,{head:_,tail:O}),f[16]=_,f[17]=O,f[18]=D,f[19]=me):me=f[19];let{head:he,lead:A,tail:ge,tailGraphemes:_e}=me,[j,ve]=l(null),ye=ne(null),be=ne(null),xe=ne(null),Se=t(x,ve),[M,Ce]=l(null),[we,Te]=l(!1),[N,Ee]=l(!1),P=M?.truncated===!0,De;f[20]===j?De=f[21]:(De=()=>{j?.isConnected&&Ee(ue(j))},f[20]=j,f[21]=De),e(De);let F;f[22]!==A||f[23]!==j?(F=()=>{let e=ye.current,t=be.current;if(j==null||e==null||t==null)return;let n=xe.current,r=()=>{let r=ce({root:j,head:e,tail:t,lead:A==null||n==null?null:{ellipsis:n,length:A.length}});Ce(e=>e!=null&&e.headCap===r.headCap&&e.tailWidth===r.tailWidth&&e.truncated===r.truncated?e:r),r.truncated||Te(!1)};r();let i=new ResizeObserver(r);return i.observe(j),i.observe(t),()=>{i.disconnect()}},f[22]=A,f[23]=j,f[24]=F):F=f[24];let Oe;f[25]!==A||f[26]!==j||f[27]!==O||f[28]!==D?(Oe=[j,A,D,O],f[25]=A,f[26]=j,f[27]=O,f[28]=D,f[29]=Oe):Oe=f[29],e(F,Oe);let ke=M==null?`${_e}ch`:`${M.tailWidth}px`,Ae=M?.headCap==null?`${(_??0)+1}ch`:`${M.headCap}px`,I;f[30]===D?I=f[31]:(I=/* @__PURE__ */ d(`span`,{"data-slot":`truncated-text-value`,className:`sr-only select-none`,children:D}),f[30]=D,f[31]=I);let L;f[32]===A?L=f[33]:(L=A!=null&&/* @__PURE__ */ d(`span`,{ref:xe,"aria-hidden":!0,className:`invisible absolute select-none`,children:`…`}),f[32]=A,f[33]=L);let je=A!=null&&`w-[calc(round(up,var(--_head-cap)-0.5px,1ch)+0.5px)]`,R;f[34]===je?R=f[35]:(R=n(de,je),f[34]=je,f[35]=R);let z;f[36]!==he||f[37]!==R?(z=/* @__PURE__ */ d(`span`,{ref:ye,"aria-hidden":!0,"data-slot":`truncated-text-head`,className:R,children:he}),f[36]=he,f[37]=R,f[38]=z):z=f[38];let B;f[39]===ge?B=f[40]:(B=/* @__PURE__ */ d(`span`,{ref:be,"aria-hidden":!0,"data-slot":`truncated-text-tail`,dir:`rtl`,className:`inline-block overflow-hidden whitespace-nowrap text-left align-bottom min-w-(--_tail-width) [[data-truncated]>&]:min-w-0 [[data-truncated]>&]:max-w-[calc(round(down,100%_-_1ch_-_var(--_tail-width),1ch)_+_var(--_tail-width))] [[data-truncated]>:empty+&]:max-w-[calc(round(down,100%_-_var(--_tail-width),1ch)_+_var(--_tail-width)_+_0.5px)] [[data-truncated]>:empty+&]:text-ellipsis`,children:/* @__PURE__ */ d(`span`,{dir:`ltr`,children:ge})}),f[39]=ge,f[40]=B);let V;f[41]!==z||f[42]!==B||f[43]!==I||f[44]!==L?(V=/* @__PURE__ */ ie(re,{children:[I,L,z,B]}),f[41]=z,f[42]=B,f[43]=I,f[44]=L,f[45]=V):V=f[45];let H=V,U;f[46]===h?U=f[47]:(U=r(h,`truncated-text`),f[46]=h,f[47]=U);let Me=P?``:void 0,W;f[48]===m?W=f[49]:(W=n(`inline-block min-w-0 max-w-full rounded whitespace-nowrap select-all [font-variant-ligatures:none] focus:outline-hidden focus-visible:ring-3 focus-visible:ring-focus-accent`,m),f[48]=m,f[49]=W);let G;f[50]!==Ae||f[51]!==A||f[52]!==S||f[53]!==ke?(G=a({"--_tail-width":ke,...A!=null&&{"--_head-cap":Ae},...S}),f[50]=Ae,f[51]=A,f[52]=S,f[53]=ke,f[54]=G):G=f[54];let Ne=P&&!N?E??0:E,K;f[55]!==N||f[56]!==P||f[57]!==y?(K=e=>{y?.(e),!P&&!N&&e.preventDefault()},f[55]=N,f[56]=P,f[57]=y,f[58]=K):K=f[58];let q;f[59]!==N||f[60]!==P||f[61]!==v?(q=e=>{v?.(e),!P&&!N&&e.preventDefault()},f[59]=N,f[60]=P,f[61]=v,f[62]=q):q=f[62];let Pe;f[63]!==Se||f[64]!==b||f[65]!==U||f[66]!==Me||f[67]!==W||f[68]!==G||f[69]!==Ne||f[70]!==K||f[71]!==q||f[72]!==k?(Pe={ref:Se,"data-slot":U,"data-truncated":Me,dir:`ltr`,className:W,style:G,tabIndex:Ne,onPointerMove:K,onFocus:q,translate:k,...b},f[63]=Se,f[64]=b,f[65]=U,f[66]=Me,f[67]=W,f[68]=G,f[69]=Ne,f[70]=K,f[71]=q,f[72]=k,f[73]=Pe):Pe=f[73];let J=Pe,Y;if(pe){let e;if(f[74]!==p||f[75]!==g||f[76]!==J||f[77]!==H){let t=c.only(p);u(te(t),"When using `asChild`, TruncatedText must be passed a single child as a JSX tag."),u(t.props.children==null,"When using `asChild`, the child of TruncatedText must have no children of its own. `value` is the content."),e=/* @__PURE__ */ d(fe,{asChild:!0,describedBy:g,...J,children:ee(t,{},H)}),f[74]=p,f[75]=g,f[76]=J,f[77]=H,f[78]=e}else e=f[78];Y=e}else{let e;f[79]!==g||f[80]!==J||f[81]!==H?(e=/* @__PURE__ */ d(fe,{describedBy:g,...J,children:H}),f[79]=g,f[80]=J,f[81]=H,f[82]=e):e=f[82],Y=e}if(N)return Y;let Fe=P&&we,X;f[83]===P?X=f[84]:(X=e=>Te(P&&e),f[83]=P,f[84]=X);let Z;f[85]===Y?Z=f[86]:(Z=/* @__PURE__ */ d(oe,{asChild:!0,children:Y}),f[85]=Y,f[86]=Z);let Q;f[87]===D?Q=f[88]:(Q=/* @__PURE__ */ d(`span`,{ref:le,className:`block`,children:D},D),f[87]=D,f[88]=Q);let $;f[89]!==Q||f[90]!==k?($=/* @__PURE__ */ d(o.Content,{className:`max-w-[min(24rem,calc(100vw-2rem))] break-all text-balance`,translate:k,children:Q}),f[89]=Q,f[90]=k,f[91]=$):$=f[91];let Ie;return f[92]!==Fe||f[93]!==X||f[94]!==Z||f[95]!==$?(Ie=/* @__PURE__ */ ie(ae,{open:Fe,onOpenChange:X,children:[Z,$]}),f[92]=Fe,f[93]=X,f[94]=Z,f[95]=$,f[96]=Ie):Ie=f[96],Ie};export{h as TruncatedText};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngrok/mantle",
3
- "version": "0.93.1",
3
+ "version": "0.93.3",
4
4
  "description": "mantle is ngrok's UI library and design system.",
5
5
  "homepage": "https://mantle.ngrok.com",
6
6
  "license": "MIT",