@ngrok/mantle 0.93.6 → 0.94.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion.d.ts +13 -1
- package/dist/accordion.js +1 -1
- package/dist/agent.json +1181 -36
- package/dist/alert-CH99Rw-R.js +1 -0
- package/dist/{alert-BcSBNR3S.d.ts → alert-HffaioZM.d.ts} +31 -21
- package/dist/alert-center.d.ts +15 -3
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +15 -2
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +6 -1
- package/dist/alert.js +1 -1
- package/dist/anchor.d.ts +12 -0
- package/dist/app-layout.d.ts +16 -1
- package/dist/app-layout.js +1 -1
- package/dist/area-chart.d.ts +144 -88
- package/dist/area-chart.js +1 -1
- package/dist/avatar.d.ts +12 -0
- package/dist/badge.d.ts +13 -1
- package/dist/bar-chart.d.ts +144 -89
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.d.ts +11 -0
- package/dist/breadcrumb.js +1 -1
- package/dist/browser-only.d.ts +8 -0
- package/dist/{button-Yxyu1XMd.d.ts → button-BGwOPjGV.d.ts} +7 -1
- package/dist/{button-B8k98Pby.js → button-BWGUuWnu.js} +1 -1
- package/dist/{button-CPsKGDK0.d.ts → button-Cgf2IcEC.d.ts} +8 -1
- package/dist/button-Cu9e3SM7.js +1 -0
- package/dist/{button-BX-4lYUn.d.ts → button-K0pKc3GN.d.ts} +3 -3
- package/dist/button.d.ts +9 -3
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +7 -0
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +6 -1
- package/dist/centered-layout.d.ts +11 -0
- package/dist/chart-BO9EwQ60.js +1 -0
- package/dist/chart-CE5Uaqz9.js +1 -0
- package/dist/chart-DCTGGlWL.js +1 -0
- package/dist/chart-DudCw24t.js +2 -0
- package/dist/{chart-BpfbtOUN.d.ts → chart-jitNqimS.d.ts} +99 -103
- package/dist/{checkbox-DmSQXs26.js → checkbox-CS504fKk.js} +1 -1
- package/dist/checkbox.d.ts +14 -1
- package/dist/checkbox.js +1 -1
- package/dist/{choice-BLR0_MeB.d.ts → choice-BwfmbepO.d.ts} +7 -1
- package/dist/choice-uyYccm0A.js +1 -0
- package/dist/choice.d.ts +6 -1
- package/dist/choice.js +1 -1
- package/dist/code-block.d.ts +13 -2
- package/dist/code-block.js +1 -1
- package/dist/code-block_highlight-utils.d.ts +5 -0
- package/dist/code.d.ts +13 -0
- package/dist/color-CHZbU1Ww.js +1 -0
- package/dist/color.js +1 -1
- package/dist/combobox.d.ts +28 -14
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +14 -2
- package/dist/command.js +1 -1
- package/dist/cx.js +1 -1
- package/dist/data-table.d.ts +50 -19
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +12 -1
- package/dist/dialog-B9JAGy_x.d.ts +28 -0
- package/dist/{dialog-7TUgiSzX.js → dialog-CsugEt2A.js} +1 -1
- package/dist/{dialog-2fRO4ca4.d.ts → dialog-DD5H3EH1.d.ts} +10 -2
- package/dist/dialog.d.ts +7 -2
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu-DHdgaw4P.js +1 -0
- package/dist/{dropdown-menu-CpjRwMWe.d.ts → dropdown-menu-DmDxYPde.d.ts} +34 -26
- package/dist/dropdown-menu.d.ts +6 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +5 -0
- package/dist/empty.js +1 -1
- package/dist/{field-V_gnkcmN.d.ts → field-BshcNVe_.d.ts} +1 -1
- package/dist/field.d.ts +17 -6
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +8 -0
- package/dist/hooks.d.ts +5 -0
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +23 -12
- package/dist/{icon-ByLVhdYq.d.ts → icon-NYvyyRMG.d.ts} +6 -0
- package/dist/icon.d.ts +7 -2
- package/dist/icon.js +1 -1
- package/dist/{icons-DP3lQw5O.js → icons-4JA-SGfv.js} +1 -1
- package/dist/icons.d.ts +13 -1
- package/dist/icons.js +1 -1
- package/dist/{index-BhfgyurF.d.ts → index-KJ06KK6t.d.ts} +3 -3
- package/dist/input-BjCDSOPA.js +1 -0
- package/dist/input-DHovzBjS.js +1 -0
- package/dist/{input-Dx5owTCc.d.ts → input-q8o5uMhW.d.ts} +11 -1
- package/dist/input.d.ts +34 -2
- package/dist/input.js +1 -1
- package/dist/kbd.d.ts +12 -0
- package/dist/{label-nHqqYS7e.js → label-DmDwzPD8.js} +1 -1
- package/dist/{label-Dn5CPJUj.d.ts → label-r2sJcSQ4.d.ts} +6 -0
- package/dist/label.d.ts +6 -1
- package/dist/label.js +1 -1
- package/dist/line-chart.d.ts +139 -82
- package/dist/line-chart.js +1 -1
- package/dist/{list-RFRIQxU2.js → list-CO_yLdln.js} +1 -1
- package/dist/list.d.ts +19 -1
- package/dist/list.js +1 -1
- package/dist/live-region.d.ts +14 -1
- package/dist/llms.txt +78 -76
- package/dist/main.d.ts +12 -0
- package/dist/mantle.css +110 -65
- package/dist/media-object.d.ts +12 -0
- package/dist/migrations/0014-chart-named-colors.yml +1389 -0
- package/dist/migrations/0015-segmented-control.yml +788 -0
- package/dist/multi-select.d.ts +15 -2
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +17 -5
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +92 -3
- package/dist/pagination.js +1 -1
- package/dist/popover-BhTFutCz.d.ts +1 -0
- package/dist/{popover-BfB2I9G0.d.ts → popover-lwkwWcRW.d.ts} +16 -7
- package/dist/popover.d.ts +7 -2
- package/dist/progress.d.ts +27 -10
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +9 -1
- package/dist/query.d.ts +2 -2
- package/dist/query.js +1 -1
- package/dist/radio-group-jj2abc0t.js +1 -0
- package/dist/radio-group-sLz5AA9I.d.ts +27 -0
- package/dist/radio-group.d.ts +20 -99
- package/dist/radio-group.js +1 -1
- package/dist/sandbar.d.ts +14 -1
- package/dist/sandbar.js +1 -1
- package/dist/sandboxed-on-click.d.ts +8 -0
- package/dist/scatter-plot.d.ts +126 -64
- package/dist/scatter-plot.js +1 -1
- package/dist/segmented-control.d.ts +136 -0
- package/dist/segmented-control.js +1 -0
- package/dist/{select-BkhBxtOT.d.ts → select-BqmpVJJT.d.ts} +29 -21
- package/dist/select-C6Su0dU0.js +1 -0
- package/dist/select.d.ts +6 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +13 -2
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-D9AWEkcJ.d.ts → separator-QfH0ot5K.d.ts} +3 -1
- package/dist/separator.d.ts +6 -1
- package/dist/{sheet-CSJc_sB4.js → sheet-Bd2LIhzF.js} +1 -1
- package/dist/sheet.d.ts +15 -2
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +19 -3
- package/dist/sidebar.js +1 -1
- package/dist/skeleton.d.ts +11 -0
- package/dist/skip-to-main-link.d.ts +11 -0
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slider.d.ts +10 -0
- package/dist/{slot-C0OCJjdJ.d.ts → slot-D12N_fZJ.d.ts} +3 -1
- package/dist/slot.d.ts +6 -1
- package/dist/split-button.d.ts +14 -3
- package/dist/split-button.js +1 -1
- package/dist/strata.d.ts +13 -0
- package/dist/switch.d.ts +13 -1
- package/dist/switch.js +1 -1
- package/dist/{table-vT6Okwfa.d.ts → table-rWiVWEgB.d.ts} +79 -0
- package/dist/table.d.ts +6 -1
- package/dist/tabs.d.ts +23 -11
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +11 -1
- package/dist/theme-DdZgLvKH.js +1 -0
- package/dist/theme-switcher.d.ts +16 -2
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +12 -0
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +14 -1
- package/dist/toast.js +1 -1
- package/dist/{tooltip-NcLIeBy5.d.ts → tooltip-CpK3XTor.d.ts} +15 -8
- package/dist/tooltip.d.ts +6 -1
- package/dist/truncated-text.d.ts +27 -13
- package/dist/truncated-text.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/use-inert-siblings-CNmNuS2h.js +1 -0
- package/dist/use-swipe-to-dismiss-i__cTF2v.js +1 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/visually-hidden.d.ts +13 -0
- package/dist/well.d.ts +6 -1
- package/package.json +7 -7
- package/src/components/chart/d3-license.md +25 -0
- package/dist/alert-P9lwn25X.js +0 -1
- package/dist/button-Dge0D5bl.js +0 -1
- package/dist/chart-BpWfQAwf.js +0 -2
- package/dist/choice-2Lrv8_nl.js +0 -1
- package/dist/dialog-Dp0QGWwo.d.ts +0 -28
- package/dist/dropdown-menu-BHBzCDSZ.js +0 -1
- package/dist/input-CpQ6jlpI.js +0 -1
- package/dist/popover-C96V8SXi.d.ts +0 -1
- package/dist/select-CAAYk4Yj.js +0 -1
- package/dist/theme-C-glc5Q-.js +0 -1
- package/dist/use-swipe-to-dismiss-DceYk1Id.js +0 -1
package/dist/slot.d.ts
CHANGED
package/dist/split-button.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Split Button component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/actions/split-button
|
|
5
|
+
*/
|
|
1
6
|
import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
|
|
2
|
-
import { t as Button } from "./button-
|
|
3
|
-
import { t as IconButton } from "./button-
|
|
7
|
+
import { t as Button } from "./button-Cgf2IcEC.js";
|
|
8
|
+
import { t as IconButton } from "./button-BGwOPjGV.js";
|
|
4
9
|
import { t as ButtonSize } from "./button-L4exxu_L.js";
|
|
5
|
-
import { t as DropdownMenu } from "./dropdown-menu-
|
|
10
|
+
import { t as DropdownMenu } from "./dropdown-menu-DmDxYPde.js";
|
|
6
11
|
import { ComponentProps, ReactNode } from "react";
|
|
7
12
|
type RootProps = ComponentProps<typeof DropdownMenu.Root> & ComponentProps<"div"> & {
|
|
8
13
|
/**
|
|
@@ -171,6 +176,12 @@ declare const MenuItem: ({ className, ...props }: ComponentProps<typeof Dropdown
|
|
|
171
176
|
* of related alternatives. Best for when users typically want one action but
|
|
172
177
|
* occasionally need variants.
|
|
173
178
|
*
|
|
179
|
+
* @useWhen Run a default action on one click, and offer related alternatives in an attached menu.
|
|
180
|
+
*
|
|
181
|
+
* @siblings
|
|
182
|
+
* - `Button`: the control runs one action, with no alternatives.
|
|
183
|
+
* - `DropdownMenu`: the button only opens a menu and runs no default action.
|
|
184
|
+
*
|
|
174
185
|
* @see https://mantle.ngrok.com/components/actions/split-button
|
|
175
186
|
*
|
|
176
187
|
* @example
|
package/dist/split-button.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./
|
|
1
|
+
import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./button-Cu9e3SM7.js";import{t as r}from"./button-BWGUuWnu.js";import{t as i}from"./dropdown-menu-DHdgaw4P.js";import{t as a}from"./icon-kK0c-POG.js";import{c as o}from"react/compiler-runtime";import{CaretDownIcon as s}from"@phosphor-icons/react/CaretDown";import{createContext as c,useContext as l}from"react";import{jsx as u}from"react/jsx-runtime";const d=c({size:`md`}),f={Root:n=>{let r=o(35),a,s,c,l,f,p,m,h,g,_,v;r[0]===n?(a=r[1],s=r[2],c=r[3],l=r[4],f=r[5],p=r[6],m=r[7],h=r[8],g=r[9],_=r[10],v=r[11]):({"data-slot":c,className:s,children:a,dir:f,open:h,defaultOpen:l,onOpenChange:m,modal:p,size:v,ref:_,...g}=n,r[0]=n,r[1]=a,r[2]=s,r[3]=c,r[4]=l,r[5]=f,r[6]=p,r[7]=m,r[8]=h,r[9]=g,r[10]=_,r[11]=v);let y=v===void 0?`md`:v,b;r[12]===y?b=r[13]:(b={size:y},r[12]=y,r[13]=b);let x=b,S;r[14]===c?S=r[15]:(S=t(c,`split-button`),r[14]=c,r[15]=S);let C;r[16]===s?C=r[17]:(C=e(`flex flex-row [&>*:first-child]:rounded-r-none [&>*:last-child]:rounded-l-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:not(:first-child)]:-ml-px [&>*:focus]:relative [&>*:focus]:z-10 [&>*:hover]:relative [&>*:hover]:z-10 *:active:scale-100!`,s),r[16]=s,r[17]=C);let w;r[18]!==a||r[19]!==g||r[20]!==_||r[21]!==y||r[22]!==S||r[23]!==C?(w=/* @__PURE__ */ u(`div`,{"data-slot":S,"data-size":y,className:C,ref:_,...g,children:a}),r[18]=a,r[19]=g,r[20]=_,r[21]=y,r[22]=S,r[23]=C,r[24]=w):w=r[24];let T;r[25]!==x||r[26]!==w?(T=/* @__PURE__ */ u(d.Provider,{value:x,children:w}),r[25]=x,r[26]=w,r[27]=T):T=r[27];let E;return r[28]!==l||r[29]!==f||r[30]!==p||r[31]!==m||r[32]!==h||r[33]!==T?(E=/* @__PURE__ */ u(i.Root,{dir:f,open:h,defaultOpen:l,onOpenChange:m,modal:p,children:T}),r[28]=l,r[29]=f,r[30]=p,r[31]=m,r[32]=h,r[33]=T,r[34]=E):E=r[34],E},PrimaryAction:e=>{let t=o(3),{size:r}=l(d),i;return t[0]!==e||t[1]!==r?(i=/* @__PURE__ */ u(n,{appearance:`outlined`,intent:`neutral`,size:r,...e}),t[0]=e,t[1]=r,t[2]=i):i=t[2],i},MenuTrigger:e=>{let t=o(9),n,c;t[0]===e?(n=t[1],c=t[2]):({icon:n,...c}=e,t[0]=e,t[1]=n,t[2]=c);let{size:f}=l(d),p;t[3]===n?p=t[4]:(p=n??/* @__PURE__ */ u(a,{svg:/* @__PURE__ */ u(s,{weight:`bold`,className:`size-4 group-data-[state=open]:-rotate-180 transition-transform duration-200 ease-out-strong motion-reduce:transition-none`})}),t[3]=n,t[4]=p);let m;return t[5]!==c||t[6]!==f||t[7]!==p?(m=/* @__PURE__ */ u(i.Trigger,{asChild:!0,className:`group`,children:/* @__PURE__ */ u(r,{icon:p,appearance:`outlined`,intent:`neutral`,size:f,...c})}),t[5]=c,t[6]=f,t[7]=p,t[8]=m):m=t[8],m},MenuContent:e=>{let t=o(6),n,r;t[0]===e?(n=t[1],r=t[2]):({align:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let a=r===void 0?`end`:r,s;return t[3]!==a||t[4]!==n?(s=/* @__PURE__ */ u(i.Content,{align:a,...n}),t[3]=a,t[4]=n,t[5]=s):s=t[5],s},MenuItem:t=>{let n=o(8),r,a;n[0]===t?(r=n[1],a=n[2]):({className:r,...a}=t,n[0]=t,n[1]=r,n[2]=a);let s;n[3]===r?s=n[4]:(s=e(`gap-2`,r),n[3]=r,n[4]=s);let c;return n[5]!==a||n[6]!==s?(c=/* @__PURE__ */ u(i.Item,{className:s,...a}),n[5]=a,n[6]=s,n[7]=c):c=n[7],c}};export{f as SplitButton};
|
package/dist/strata.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Strata component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/structure/strata
|
|
5
|
+
*/
|
|
1
6
|
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
7
|
import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
|
|
3
8
|
import { ComponentProps } from "react";
|
|
@@ -266,6 +271,14 @@ declare const Body: ({ asChild, children, className, "data-slot": dataSlot, ...p
|
|
|
266
271
|
* [DescriptionList](https://mantle.ngrok.com/components/data-display/description-list)
|
|
267
272
|
* when the pairs are read-only term/value data rather than headed sections.
|
|
268
273
|
*
|
|
274
|
+
* @useWhen Lay out a settings page or a configuration editor as titled sections, each one explained
|
|
275
|
+
* beside its controls.
|
|
276
|
+
*
|
|
277
|
+
* @siblings
|
|
278
|
+
* - `Card`: a group needs a raised surface of its own.
|
|
279
|
+
* - `MediaObject`: the thing beside the text is an image or an icon.
|
|
280
|
+
* - `DescriptionList`: the pairs are read-only label and value data, not headed sections.
|
|
281
|
+
*
|
|
269
282
|
* @see https://mantle.ngrok.com/components/structure/strata
|
|
270
283
|
*
|
|
271
284
|
* @example
|
package/dist/switch.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Switch component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/forms/switch
|
|
5
|
+
*/
|
|
1
6
|
import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
|
|
2
|
-
import { o as WithValidation } from "./field-
|
|
7
|
+
import { o as WithValidation } from "./field-BshcNVe_.js";
|
|
3
8
|
import { ComponentProps } from "react";
|
|
4
9
|
import { Root } from "@radix-ui/react-switch";
|
|
5
10
|
type SwitchProps = ComponentProps<typeof Root> & WithValidation & {
|
|
@@ -16,6 +21,13 @@ type SwitchProps = ComponentProps<typeof Root> & WithValidation & {
|
|
|
16
21
|
* compose it inside [`Choice`](/components/forms/choice) for a titled, multi-line
|
|
17
22
|
* label with a supplementary description.
|
|
18
23
|
*
|
|
24
|
+
* @useWhen Turn one setting on or off, such as a feature toggle in a settings list.
|
|
25
|
+
*
|
|
26
|
+
* @siblings
|
|
27
|
+
* - `Checkbox`: the option needs an indeterminate state.
|
|
28
|
+
* - `Choice`: the switch needs a title and a description beside it.
|
|
29
|
+
* - `ThemeSwitcher`: the setting is the light or dark theme.
|
|
30
|
+
*
|
|
19
31
|
* @see https://mantle.ngrok.com/components/forms/switch
|
|
20
32
|
*
|
|
21
33
|
* @example
|
package/dist/switch.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./
|
|
1
|
+
import{t as e}from"./booleanish-BfvnW6vy.js";import{t}from"./clsx-DUGZgXfJ.js";import{t as n}from"./cx-CK7o_rVv.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{a as i,r as a}from"./field-CPvjazWN.js";import{c as o}from"react/compiler-runtime";import{jsx as s}from"react/jsx-runtime";import{Root as c,Thumb as l}from"@radix-ui/react-switch";const u=u=>{let d=o(32),f,p,m,h,g,_,v,y,b;d[0]===u?(f=d[1],p=d[2],m=d[3],h=d[4],g=d[5],_=d[6],v=d[7],y=d[8],b=d[9]):({"data-slot":_,"aria-invalid":f,"aria-readonly":p,className:g,readOnly:m,onClick:v,ref:b,validation:h,...y}=u,d[0]=u,d[1]=f,d[2]=p,d[3]=m,d[4]=h,d[5]=g,d[6]=_,d[7]=v,d[8]=y,d[9]=b);let x=m??p,S;d[10]===x?S=d[11]:(S=e(x),d[10]=x,d[11]=S);let C=S,w=i(),T=h??w,E;d[12]!==f||d[13]!==T?(E=a({"aria-invalid":f,validation:T}),d[12]=f,d[13]=T,d[14]=E):E=d[14];let{ariaInvalid:D,validation:O}=E,k;d[15]===_?k=d[16]:(k=r(_,`switch`),d[15]=_,d[16]=k);let A=O||void 0,j;d[17]===g?j=d[18]:(j=n(`peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full outline-hidden`,`disabled:cursor-default disabled:opacity-50`,`focus-visible:border-accent-600 focus-visible:ring-focus-accent focus-visible:outline-hidden focus-visible:ring-4`,`data-state-checked:bg-accent-600 data-state-unchecked:bg-gray-400`,`data-validation-success:data-state-checked:bg-success-600 focus-visible:data-validation-success:ring-focus-success`,`data-validation-warning:data-state-checked:bg-warning-600 focus-visible:data-validation-warning:ring-focus-warning`,`data-validation-error:data-state-checked:bg-danger-600 focus-visible:data-validation-error:ring-focus-danger`,g),d[17]=g,d[18]=j);let M;d[19]!==v||d[20]!==C?(M=e=>{C?e.preventDefault():v?.(e)},d[19]=v,d[20]=C,d[21]=M):M=d[21];let N;d[22]===Symbol.for(`react.memo_cache_sentinel`)?(N=/* @__PURE__ */ s(l,{className:t(`pointer-events-none block size-4 rounded-full bg-[#fff] shadow-md ring-0 transition-transform duration-200 ease-out-strong motion-reduce:transition-none`,`data-state-checked:translate-x-4.5 data-state-unchecked:translate-x-0.5`)}),d[22]=N):N=d[22];let P;return d[23]!==D||d[24]!==y||d[25]!==C||d[26]!==b||d[27]!==k||d[28]!==A||d[29]!==j||d[30]!==M?(P=/* @__PURE__ */ s(c,{"aria-invalid":D,"aria-readonly":C,"data-slot":k,"data-validation":A,className:j,onClick:M,ref:b,...y,children:N}),d[23]=D,d[24]=y,d[25]=C,d[26]=b,d[27]=k,d[28]=A,d[29]=j,d[30]=M,d[31]=P):P=d[31],P};export{u as Switch};
|
|
@@ -40,6 +40,67 @@ import { ComponentProps } from "react";
|
|
|
40
40
|
* </Table.Root>
|
|
41
41
|
* ```
|
|
42
42
|
*
|
|
43
|
+
* @example
|
|
44
|
+
* Paginated, with the count line and a page-size select:
|
|
45
|
+
* ```tsx
|
|
46
|
+
* import {
|
|
47
|
+
* CursorPagination,
|
|
48
|
+
* PaginationRange,
|
|
49
|
+
* getOffsetPaginatedSlice,
|
|
50
|
+
* useOffsetPagination,
|
|
51
|
+
* } from "@ngrok/mantle/pagination";
|
|
52
|
+
* import { Table } from "@ngrok/mantle/table";
|
|
53
|
+
*
|
|
54
|
+
* function InvoicesTable({ invoices }: { invoices: Invoice[] }) {
|
|
55
|
+
* const pagination = useOffsetPagination({ listSize: invoices.length, pageSize: 20 });
|
|
56
|
+
* const pageInvoices = getOffsetPaginatedSlice(invoices, pagination);
|
|
57
|
+
*
|
|
58
|
+
* return (
|
|
59
|
+
* <div className="flex flex-col gap-4">
|
|
60
|
+
* <Table.Root>
|
|
61
|
+
* <Table.Element>
|
|
62
|
+
* <Table.Head>
|
|
63
|
+
* <Table.Row>
|
|
64
|
+
* <Table.Header>Invoice</Table.Header>
|
|
65
|
+
* <Table.Header className="text-right">Amount</Table.Header>
|
|
66
|
+
* </Table.Row>
|
|
67
|
+
* </Table.Head>
|
|
68
|
+
* <Table.Body>
|
|
69
|
+
* {pageInvoices.map((invoice) => (
|
|
70
|
+
* <Table.Row key={invoice.invoice}>
|
|
71
|
+
* <Table.Cell>{invoice.invoice}</Table.Cell>
|
|
72
|
+
* <Table.Cell className="text-right">{invoice.totalAmount}</Table.Cell>
|
|
73
|
+
* </Table.Row>
|
|
74
|
+
* ))}
|
|
75
|
+
* </Table.Body>
|
|
76
|
+
* </Table.Element>
|
|
77
|
+
* </Table.Root>
|
|
78
|
+
* <CursorPagination.Root
|
|
79
|
+
* className="flex flex-wrap justify-between"
|
|
80
|
+
* pageSize={pagination.pageSize}
|
|
81
|
+
* onChangePageSize={pagination.setPageSize}
|
|
82
|
+
* >
|
|
83
|
+
* <PaginationRange
|
|
84
|
+
* offset={pagination.offset}
|
|
85
|
+
* pageSize={pagination.pageSize}
|
|
86
|
+
* total={invoices.length}
|
|
87
|
+
* noun={{ singular: "invoice", plural: "invoices" }}
|
|
88
|
+
* />
|
|
89
|
+
* <div className="flex items-center gap-2">
|
|
90
|
+
* <CursorPagination.PageSizeSelect />
|
|
91
|
+
* <CursorPagination.Buttons
|
|
92
|
+
* hasPreviousPage={pagination.hasPreviousPage}
|
|
93
|
+
* hasNextPage={pagination.hasNextPage}
|
|
94
|
+
* onPreviousPage={pagination.previousPage}
|
|
95
|
+
* onNextPage={pagination.nextPage}
|
|
96
|
+
* />
|
|
97
|
+
* </div>
|
|
98
|
+
* </CursorPagination.Root>
|
|
99
|
+
* </div>
|
|
100
|
+
* );
|
|
101
|
+
* }
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
43
104
|
* `ref` lands on the inner scroll container, so a consumer can read or set its
|
|
44
105
|
* scroll position. Every other prop lands on the outer element.
|
|
45
106
|
*
|
|
@@ -455,6 +516,24 @@ declare const Caption: ({ "data-slot": dataSlot, children, className, ref, ...pr
|
|
|
455
516
|
* For INTERACTIVE tabular data with sorting / filtering / pagination / row
|
|
456
517
|
* selection, use `DataTable` (built on TanStack Table) instead.
|
|
457
518
|
*
|
|
519
|
+
* **Large lists.** Each rendered row costs mount and layout time, so a table
|
|
520
|
+
* that renders every row of a large list blocks input while it mounts:
|
|
521
|
+
* - Paginate a list that can grow past 100 rows, and show 100 rows or fewer on
|
|
522
|
+
* a page. Slice the rows with `useOffsetPagination` and
|
|
523
|
+
* `getOffsetPaginatedSlice`, and compose `CursorPagination` with
|
|
524
|
+
* `PaginationRange` under the table, as the paginated example below shows.
|
|
525
|
+
* - Search and filter the whole list, then paginate the result. Pass the
|
|
526
|
+
* filtered length as `listSize`, so a new filter returns to the first page.
|
|
527
|
+
* - Paginate before you virtualize. A page of 100 rows mounts fast, and the
|
|
528
|
+
* browser's find in page still sees every row on it.
|
|
529
|
+
*
|
|
530
|
+
* @useWhen Show static rows and columns of data, such as a read-only data dump, with no sorting,
|
|
531
|
+
* filtering, or pagination.
|
|
532
|
+
*
|
|
533
|
+
* @siblings
|
|
534
|
+
* - `DataTable`: the user sorts, filters, pages through, or selects the rows.
|
|
535
|
+
* - `DescriptionList`: one record shows as label and value pairs.
|
|
536
|
+
*
|
|
458
537
|
* @see https://mantle.ngrok.com/components/data-display/table
|
|
459
538
|
*
|
|
460
539
|
* @example
|
package/dist/table.d.ts
CHANGED
package/dist/tabs.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Tabs component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/navigation/tabs
|
|
5
|
+
*/
|
|
1
6
|
import { t as SelfClosingWithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
7
|
import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
|
|
3
|
-
import { n as Separator } from "./separator-
|
|
8
|
+
import { n as Separator } from "./separator-QfH0ot5K.js";
|
|
4
9
|
import { ComponentProps } from "react";
|
|
5
|
-
import { Content, List, Root, Trigger } from "@radix-ui/react-tabs";
|
|
10
|
+
import { Content as Content$1, List as List$1, Root as Root$1, Trigger as Trigger$1 } from "@radix-ui/react-tabs";
|
|
6
11
|
/**
|
|
7
12
|
* Layered sections of content, called tab panels, that show one at a time.
|
|
8
13
|
* The outermost part; it owns `orientation` and `appearance`. It stamps both as
|
|
@@ -46,7 +51,7 @@ import { Content, List, Root, Trigger } from "@radix-ui/react-tabs";
|
|
|
46
51
|
* </Tabs.Root>
|
|
47
52
|
* ```
|
|
48
53
|
*/
|
|
49
|
-
declare const Root
|
|
54
|
+
declare const Root: ({ className, children, "data-slot": dataSlot, onValueChange, orientation, appearance, ...props }: ComponentProps<typeof Root$1> & WithDataSlot & {
|
|
50
55
|
/**
|
|
51
56
|
* The appearance of the tabs. Classic appearance shows the tab
|
|
52
57
|
* list with an underline; pill appearance shows each tab as a pill.
|
|
@@ -82,7 +87,7 @@ declare const Root$1: ({ className, children, "data-slot": dataSlot, onValueChan
|
|
|
82
87
|
* </Tabs.Root>
|
|
83
88
|
* ```
|
|
84
89
|
*/
|
|
85
|
-
declare const List
|
|
90
|
+
declare const List: ({ className, "data-slot": dataSlot, ref, ...props }: ComponentProps<typeof List$1> & WithDataSlot) => import("react").JSX.Element;
|
|
86
91
|
type TabsSeparatorProps = Omit<ComponentProps<typeof Separator>, "asChild" | "children" | "orientation"> & SelfClosingWithAsChild & WithDataSlot;
|
|
87
92
|
/**
|
|
88
93
|
* The hairline between the list and the content, in the `separator` color
|
|
@@ -129,7 +134,7 @@ type TabsSeparatorProps = Omit<ComponentProps<typeof Separator>, "asChild" | "ch
|
|
|
129
134
|
* ```
|
|
130
135
|
*/
|
|
131
136
|
declare const TabsSeparator: ({ className, "data-slot": dataSlot, ...props }: TabsSeparatorProps) => import("react").JSX.Element;
|
|
132
|
-
type TabsTriggerProps = ComponentProps<typeof Trigger> & WithDataSlot;
|
|
137
|
+
type TabsTriggerProps = ComponentProps<typeof Trigger$1> & WithDataSlot;
|
|
133
138
|
/**
|
|
134
139
|
* The button that activates its associated content.
|
|
135
140
|
*
|
|
@@ -176,7 +181,7 @@ type TabsTriggerProps = ComponentProps<typeof Trigger> & WithDataSlot;
|
|
|
176
181
|
* </Tabs.Root>
|
|
177
182
|
* ```
|
|
178
183
|
*/
|
|
179
|
-
declare const Trigger
|
|
184
|
+
declare const Trigger: ({ "aria-disabled": _ariaDisabled, asChild, children, className, "data-slot": dataSlot, disabled: _disabled, onClick, onMouseDown, ref, ...props }: TabsTriggerProps) => import("react").JSX.Element;
|
|
180
185
|
/**
|
|
181
186
|
* A badge to render inside a tab trigger, typically a count or a status indicator.
|
|
182
187
|
*
|
|
@@ -233,10 +238,17 @@ declare const Badge: ({ className, children, "data-slot": dataSlot, ...props }:
|
|
|
233
238
|
* </Tabs.Root>
|
|
234
239
|
* ```
|
|
235
240
|
*/
|
|
236
|
-
declare const Content
|
|
241
|
+
declare const Content: ({ className, "data-slot": dataSlot, ...props }: ComponentProps<typeof Content$1> & WithDataSlot) => import("react").JSX.Element;
|
|
237
242
|
/**
|
|
238
243
|
* Layered sections of content, called tab panels, that show one at a time.
|
|
239
244
|
*
|
|
245
|
+
* @useWhen Switch between peer views of related content in one place, with one view visible at a
|
|
246
|
+
* time.
|
|
247
|
+
*
|
|
248
|
+
* @siblings
|
|
249
|
+
* - `Accordion`: several sections stack, and each one expands in place.
|
|
250
|
+
* - `RadioGroup`: the user picks a form value, not a view.
|
|
251
|
+
*
|
|
240
252
|
* @see https://mantle.ngrok.com/components/navigation/tabs
|
|
241
253
|
*
|
|
242
254
|
* @example
|
|
@@ -302,7 +314,7 @@ declare const Tabs: {
|
|
|
302
314
|
* </Tabs.Root>
|
|
303
315
|
* ```
|
|
304
316
|
*/
|
|
305
|
-
readonly Root: typeof Root
|
|
317
|
+
readonly Root: typeof Root;
|
|
306
318
|
/**
|
|
307
319
|
* Contains the content associated with each trigger.
|
|
308
320
|
* It renders when that trigger is active.
|
|
@@ -330,7 +342,7 @@ declare const Tabs: {
|
|
|
330
342
|
* </Tabs.Root>
|
|
331
343
|
* ```
|
|
332
344
|
*/
|
|
333
|
-
readonly Content: typeof Content
|
|
345
|
+
readonly Content: typeof Content;
|
|
334
346
|
/**
|
|
335
347
|
* Contains the triggers that are aligned along the edge of the active content.
|
|
336
348
|
* The list draws no border of its own: compose `Tabs.Separator` after it for
|
|
@@ -356,7 +368,7 @@ declare const Tabs: {
|
|
|
356
368
|
* </Tabs.Root>
|
|
357
369
|
* ```
|
|
358
370
|
*/
|
|
359
|
-
readonly List: typeof List
|
|
371
|
+
readonly List: typeof List;
|
|
360
372
|
/**
|
|
361
373
|
* The hairline between the list and the content, in the `separator` color
|
|
362
374
|
* token. Compose it directly after `Tabs.List`. It follows the root's
|
|
@@ -426,7 +438,7 @@ declare const Tabs: {
|
|
|
426
438
|
* </Tabs.Root>
|
|
427
439
|
* ```
|
|
428
440
|
*/
|
|
429
|
-
readonly Trigger: typeof Trigger
|
|
441
|
+
readonly Trigger: typeof Trigger;
|
|
430
442
|
/**
|
|
431
443
|
* A badge to render inside a tab trigger, typically a count or a status indicator.
|
|
432
444
|
*
|
package/dist/tabs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{t as e}from"./booleanish-BfvnW6vy.js";import{n as t}from"./compose-refs-sFdxsL7k.js";import{t as n}from"./data-slot-EM6s2WEU.js";import{t as r}from"./clsx-DUGZgXfJ.js";import{t as i}from"./cx-CK7o_rVv.js";import{t as a}from"./use-prefers-reduced-motion-CU6mWmOe.js";import{n as o}from"./separator-DfzxVutO.js";import{c as s}from"react/compiler-runtime";import{Children as c,cloneElement as l,createContext as u,isValidElement as d,useContext as f,useEffect as p,useRef as m}from"react";import h from"tiny-invariant";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{cva as y}from"class-variance-authority";import{Content as b,List as x,Root as S,Trigger as C}from"@radix-ui/react-tabs";const w=u(null);function T(e){let t=f(w);return h(t!=null,`${e} must be rendered inside Tabs.Root.`),t}const E=e=>{let t=s(29),r,a,o,c,l,u,d;t[0]===e?(r=t[1],a=t[2],o=t[3],c=t[4],l=t[5],u=t[6],d=t[7]):({className:a,children:r,"data-slot":o,onValueChange:c,orientation:u,appearance:d,...l}=e,t[0]=e,t[1]=r,t[2]=a,t[3]=o,t[4]=c,t[5]=l,t[6]=u,t[7]=d);let f=u===void 0?`horizontal`:u,p=d===void 0?`classic`:d,h;t[8]!==p||t[9]!==f?(h={orientation:f,appearance:p},t[8]=p,t[9]=f,t[10]=h):h=t[10];let g=h,v=m(null),y;t[11]===c?y=t[12]:(y=e=>{e!==v.current&&(v.current=e,queueMicrotask(()=>{v.current=null}),c?.(e))},t[11]=c,t[12]=y);let b=y,x;t[13]===o?x=t[14]:(x=n(o,`tabs`),t[13]=o,t[14]=x);let C=f===`horizontal`?`flex-col`:`flex-row`,T;t[15]!==a||t[16]!==C?(T=i(`flex [--tabs-gap:--spacing(4)] gap-(--tabs-gap)`,C,a),t[15]=a,t[16]=C,t[17]=T):T=t[17];let E;t[18]!==p||t[19]!==r||t[20]!==b||t[21]!==f||t[22]!==l||t[23]!==x||t[24]!==T?(E=/* @__PURE__ */ _(S,{"data-slot":x,"data-appearance":p,className:T,orientation:f,onValueChange:b,...l,children:r}),t[18]=p,t[19]=r,t[20]=b,t[21]=f,t[22]=l,t[23]=x,t[24]=T,t[25]=E):E=t[25];let D;return t[26]!==g||t[27]!==E?(D=/* @__PURE__ */ _(w.Provider,{value:g,children:E}),t[26]=g,t[27]=E,t[28]=D):D=t[28],D},D=y(`flex`,{variants:{orientation:{horizontal:`scroll-fade-x flex-row items-center overflow-x-auto overscroll-x-none self-stretch min-w-0 pt-1 -mt-1 px-1 -mx-1`,vertical:`flex-col items-end gap-3.5 self-stretch`},appearance:{classic:``,pill:``}},compoundVariants:[{orientation:`horizontal`,appearance:`pill`,className:`gap-1 pb-1 -mb-1`},{orientation:`horizontal`,appearance:`classic`,className:`gap-6`}]}),O=e=>{let r=s(20),o,c,l,u;r[0]===e?(o=r[1],c=r[2],l=r[3],u=r[4]):({className:o,"data-slot":c,ref:u,...l}=e,r[0]=e,r[1]=o,r[2]=c,r[3]=l,r[4]=u);let{orientation:d,appearance:f}=T(`Tabs.List`),h=m(null),g=t(h,u),v,y;r[5]===d?(v=r[6],y=r[7]):(v=()=>{let e=h.current;if(!e||d!==`horizontal`)return;let t=new AbortController,{signal:n}=t,r=!1;e.addEventListener(`pointerdown`,()=>{r=!0},{signal:n});let i=()=>{r=!1};return e.addEventListener(`pointerup`,()=>setTimeout(i),{signal:n}),e.addEventListener(`pointercancel`,i,{signal:n}),e.addEventListener(`keydown`,i,{signal:n}),e.addEventListener(`focusin`,t=>{if(!r&&t.target instanceof Element&&t.target!==e){let e=a()?`auto`:`smooth`;t.target.scrollIntoView({behavior:e,inline:`center`,block:`nearest`})}},{signal:n}),()=>{t.abort()}},y=[d],r[5]=d,r[6]=v,r[7]=y),p(v,y);let b;r[8]===c?b=r[9]:(b=n(c,`tabs-list`),r[8]=c,r[9]=b);let S;r[10]!==f||r[11]!==o||r[12]!==d?(S=i(D({orientation:d,appearance:f}),o),r[10]=f,r[11]=o,r[12]=d,r[13]=S):S=r[13];let C;return r[14]!==g||r[15]!==d||r[16]!==l||r[17]!==b||r[18]!==S?(C=/* @__PURE__ */ _(x,{"aria-orientation":d,"data-slot":b,className:S,ref:g,...l}),r[14]=g,r[15]=d,r[16]=l,r[17]=b,r[18]=S,r[19]=C):C=r[19],C},k=e=>{let t=s(14),r,a,c;t[0]===e?(r=t[1],a=t[2],c=t[3]):({className:r,"data-slot":a,...c}=e,t[0]=e,t[1]=r,t[2]=a,t[3]=c);let{orientation:l}=T(`Tabs.Separator`),u=l===`horizontal`?`[[data-slot~=tabs]>&]:-mt-(--tabs-gap)`:`h-auto self-stretch [[data-slot~=tabs]>&]:-ml-(--tabs-gap)`,d;t[4]===a?d=t[5]:(d=n(a,`tabs-separator`),t[4]=a,t[5]=d);let f;t[6]!==r||t[7]!==u?(f=i(u,r),t[6]=r,t[7]=u,t[8]=f):f=t[8];let p;return t[9]!==l||t[10]!==c||t[11]!==d||t[12]!==f?(p=/* @__PURE__ */ _(o,{"data-slot":d,orientation:l,className:f,...c}),t[9]=l,t[10]=c,t[11]=d,t[12]=f,t[13]=p):p=t[13],p},A=y(`absolute z-0`,{variants:{orientation:{horizontal:`bottom-0 left-0 right-0 h-0.75`,vertical:`-right-px bottom-0 top-0 w-0.75`},appearance:{classic:`group-data-state-active/tab-trigger:bg-neutral-950`,pill:`hidden`}}}),j=()=>{let e=s(5),{orientation:t,appearance:n}=T(`Tabs.Trigger`),i;e[0]!==n||e[1]!==t?(i=r(A({orientation:t,appearance:n})),e[0]=n,e[1]=t,e[2]=i):i=e[2];let a;return e[3]===i?a=e[4]:(a=/* @__PURE__ */ _(`span`,{"aria-hidden":!0,className:i}),e[3]=i,e[4]=a),a},M=y(i(`group/tab-trigger relative flex cursor-pointer select-none items-center gap-1 whitespace-nowrap py-3 text-sm font-medium text-gray-600`,`ring-focus-accent outline-hidden`,`aria-disabled:cursor-default aria-disabled:opacity-50`,`focus-visible:ring-4`,`[&>[data-slot=tabs-trigger-label]>svg]:shrink-0 [&>[data-slot=tabs-trigger-label]>svg]:size-5`,`not-aria-disabled:hover:text-gray-900`),{variants:{orientation:{horizontal:`rounded-tl-md rounded-tr-md`,vertical:`rounded-bl-md rounded-tl-md pr-3`},appearance:{classic:i(`not-aria-disabled:hover:data-state-active:text-strong`,`data-state-active:text-strong`),pill:i(`not-aria-disabled:hover:data-state-active:text-strong`,`not-aria-disabled:hover:data-state-active:bg-neutral-500/15`,`data-state-active:text-strong`,`data-state-active:bg-neutral-500/15`,`rounded-full py-2 px-3`)}}}),N={Root:E,Content:e=>{let t=s(12),r,a,o;t[0]===e?(r=t[1],a=t[2],o=t[3]):({className:r,"data-slot":a,...o}=e,t[0]=e,t[1]=r,t[2]=a,t[3]=o);let c;t[4]===a?c=t[5]:(c=n(a,`tabs-content`),t[4]=a,t[5]=c);let l;t[6]===r?l=t[7]:(l=i(`focus-visible:ring-focus-accent outline-hidden focus-visible:ring-4`,r),t[6]=r,t[7]=l);let u;return t[8]!==o||t[9]!==c||t[10]!==l?(u=/* @__PURE__ */ _(b,{"data-slot":c,className:l,...o}),t[8]=o,t[9]=c,t[10]=l,t[11]=u):u=t[11],u},List:O,Separator:k,Trigger:t=>{let r=s(54),a,o,u,f,p,y,b,x,S,w;r[0]===t?(a=r[1],o=r[2],u=r[3],f=r[4],p=r[5],y=r[6],b=r[7],x=r[8],S=r[9],w=r[10]):({"aria-disabled":a,asChild:w,children:u,className:f,"data-slot":p,disabled:o,onClick:y,onMouseDown:b,ref:S,...x}=t,r[0]=t,r[1]=a,r[2]=o,r[3]=u,r[4]=f,r[5]=p,r[6]=y,r[7]=b,r[8]=x,r[9]=S,r[10]=w);let E=w!==void 0&&w,{orientation:D,appearance:O}=T(`Tabs.Trigger`),k=a??o,A;r[11]===k?A=r[12]:(A=e(k),r[11]=k,r[12]=A);let N=A,P=m(!1),F=a??o,I;r[13]!==O||r[14]!==f||r[15]!==D?(I=i(M({orientation:D,appearance:O}),f),r[13]=O,r[14]=f,r[15]=D,r[16]=I):I=r[16];let L;r[17]===p?L=r[18]:(L=n(p,`tabs-trigger`),r[17]=p,r[18]=L);let R;r[19]!==N||r[20]!==y?(R=e=>{if(y?.(e),e.defaultPrevented||N||!e.currentTarget.matches(`a[href]`)||e.button!==0||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let t=e.currentTarget;t.focus({focusVisible:!1}),P.current=!0,t.dispatchEvent(new MouseEvent(`mousedown`,{bubbles:!0,button:0})),P.current=!1},r[19]=N,r[20]=y,r[21]=R):R=r[21];let z;r[22]!==N||r[23]!==b?(z=e=>{P.current||(b?.(e),e.defaultPrevented||N||(e.currentTarget.matches(`a[href]`)?e.preventDefault():e.button===0&&!e.ctrlKey&&e.currentTarget.focus({focusVisible:!1})))},r[22]=N,r[23]=b,r[24]=z):z=r[24];let B;r[25]!==N||r[26]!==x||r[27]!==F||r[28]!==I||r[29]!==L||r[30]!==R||r[31]!==z?(B={"aria-disabled":F,className:I,"data-slot":L,disabled:N,onClick:R,onMouseDown:z,...x},r[25]=N,r[26]=x,r[27]=F,r[28]=I,r[29]=L,r[30]=R,r[31]=z,r[32]=B):B=r[32];let V=B;if(E){let e;r[33]===u?e=r[34]:(e=c.only(u),h(d(e),"When using `asChild`, TabsTrigger must be passed a single child as a JSX tag."),r[33]=u,r[34]=e);let t=e.props?.children,n;if(r[35]!==N||r[36]!==t||r[37]!==S||r[38]!==e||r[39]!==V){let i=N?{href:void 0,to:void 0}:{},a;r[41]!==N||r[42]!==e?(a=N?/* @__PURE__ */ _(`button`,{type:`button`}):e,r[41]=N,r[42]=e,r[43]=a):a=r[43];let o;r[44]===Symbol.for(`react.memo_cache_sentinel`)?(o=/* @__PURE__ */ _(j,{}),r[44]=o):o=r[44];let s;r[45]===t?s=r[46]:(s=/* @__PURE__ */ v(g,{children:[o,/* @__PURE__ */ _(`span`,{"data-slot":`tabs-trigger-label`,className:`contents`,children:t})]}),r[45]=t,r[46]=s),n=/* @__PURE__ */ _(C,{asChild:!0,...V,ref:S,children:l(a,i,s)}),r[35]=N,r[36]=t,r[37]=S,r[38]=e,r[39]=V,r[40]=n}else n=r[40];return n}let H;r[47]===Symbol.for(`react.memo_cache_sentinel`)?(H=/* @__PURE__ */ _(j,{}),r[47]=H):H=r[47];let U;r[48]===u?U=r[49]:(U=/* @__PURE__ */ _(`span`,{"data-slot":`tabs-trigger-label`,className:`contents`,children:u}),r[48]=u,r[49]=U);let W;return r[50]!==S||r[51]!==U||r[52]!==V?(W=/* @__PURE__ */ v(C,{ref:S,...V,children:[H,U]}),r[50]=S,r[51]=U,r[52]=V,r[53]=W):W=r[53],W},Badge:e=>{let t=s(14),r,a,o,c;t[0]===e?(r=t[1],a=t[2],o=t[3],c=t[4]):({className:a,children:r,"data-slot":o,...c}=e,t[0]=e,t[1]=r,t[2]=a,t[3]=o,t[4]=c);let l;t[5]===o?l=t[6]:(l=n(o,`tabs-badge`),t[5]=o,t[6]=l);let u;t[7]===a?u=t[8]:(u=i(`rounded-full bg-neutral-500/20 px-1.5 text-xs font-medium text-gray-600`,`group-data-state-active/tab-trigger:bg-neutral-950/10 group-data-state-active/tab-trigger:text-strong group-hover/tab-trigger:group-enabled/tab-trigger:group-data-state-active/tab-trigger:text-strong`,`group-hover/tab-trigger:group-enabled/tab-trigger:text-gray-700`,a),t[7]=a,t[8]=u);let d;return t[9]!==r||t[10]!==c||t[11]!==l||t[12]!==u?(d=/* @__PURE__ */ _(`span`,{"data-slot":l,className:u,...c,children:r}),t[9]=r,t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}};export{N as Tabs};
|
package/dist/text-area.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Text Area component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/forms/text-area
|
|
5
|
+
*/
|
|
1
6
|
import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
|
|
2
|
-
import { o as WithValidation } from "./field-
|
|
7
|
+
import { o as WithValidation } from "./field-BshcNVe_.js";
|
|
3
8
|
import { ComponentProps } from "react";
|
|
4
9
|
type Props = ComponentProps<"textarea"> & WithValidation & {
|
|
5
10
|
/**
|
|
@@ -12,6 +17,11 @@ type Props = ComponentProps<"textarea"> & WithValidation & {
|
|
|
12
17
|
* to enter a sizeable amount of free-form text, for example a comment on a
|
|
13
18
|
* review or feedback form.
|
|
14
19
|
*
|
|
20
|
+
* @useWhen Accept several lines of free-form text, such as a comment or a description.
|
|
21
|
+
*
|
|
22
|
+
* @siblings
|
|
23
|
+
* - `Input`: the text fits on one line.
|
|
24
|
+
*
|
|
15
25
|
* @see https://mantle.ngrok.com/components/forms/text-area
|
|
16
26
|
*
|
|
17
27
|
* @example
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./use-matches-media-query-m860lols.js";import{n as t,t as n}from"./cookie-ca4g5CKp.js";import{t as r}from"./cx-CK7o_rVv.js";import{n as i}from"./browser-only-BTSrYWLj.js";import{t as a}from"./use-prefers-reduced-motion-CU6mWmOe.js";import{c as o}from"react/compiler-runtime";import{createContext as s,useContext as c,useEffect as l,useRef as u,useState as d}from"react";import f from"tiny-invariant";import{jsx as p}from"react/jsx-runtime";import{flushSync as m}from"react-dom";let h=null;function g(e,{origin:t}={}){if(typeof document.startViewTransition!=`function`||a()||document.visibilityState!==`visible`){e();return}if(h!=null){h.skipTransition(),h.updateCallbackDone.finally(()=>_(e));return}let n=document.documentElement,r={width:window.innerWidth,height:window.innerHeight},i=S(x(t,r),r),o=y(),s=[n,...document.querySelectorAll(`[data-slot~="dialog-overlay"], [data-slot~="dialog-content"], [data-slot~="dialog-positioner"], [data-slot~="dropdown-menu-content"], [data-slot~="dropdown-menu-sub-content"]`)];for(let e of s)e.dataset.themeTransition=``;let c=document.startViewTransition(()=>{o&&(n.dataset.themeTransitionMany=``),_(e)});h=c;function l(e){if(e.target!==n)return;c.skipTransition();let t=document.elementFromPoint(e.clientX,e.clientY);t!=null&&t!==n&&t.dispatchEvent(new MouseEvent(`click`,e))}document.addEventListener(`click`,l,{capture:!0});let u=c.ready.then(()=>n.animate({clipPath:[i.from,i.to]},{duration:400,easing:`ease-out`,pseudoElement:`::view-transition-new(root)`}),()=>void 0),d=async()=>{(await u)?.cancel(),document.removeEventListener(`click`,l,{capture:!0}),h=null,delete n.dataset.themeTransitionMany;for(let e of s)delete e.dataset.themeTransition};c.finished.finally(()=>{d()})}function _(e){if(m(e),!document.documentElement.hasAttribute(`data-theme-transition-many`))for(let e of document.getAnimations())e instanceof CSSTransition&&!v(e)&&e.cancel()}function v(e){return(e.effect instanceof KeyframeEffect?e.effect.target:null)?.parentElement?.closest(`[data-slot~="theme-switcher"], [data-slot~="theme-switcher-icon"]`)!=null}function y(){let e=document.getElementsByTagName(`*`),t=Math.max(1,Math.floor(e.length/256)),n=0;for(let r=0;r<e.length;r+=t){let i=e[r+Math.floor(Math.random()*t)];i!=null&&b(i)&&(n+=1)}return n*t>2e3}function b(e){return getComputedStyle(e).transitionDuration.split(`,`).some(e=>Number.parseFloat(e)>0)}function x(e,t){let n=document.activeElement,r=e??(n!=null&&n!==document.body?n:void 0);return r==null?{left:t.width/2,top:t.height/2,width:0,height:0}:r.getBoundingClientRect()}function S(e,t){let n=e.left+e.width/2,r=e.top+e.height/2,i=Math.hypot(Math.max(n,t.width-n),Math.max(r,t.height-r)),a=`at ${n}px ${r}px`;return{from:`circle(0px ${a})`,to:`circle(${Math.round(i*100)/100}px ${a})`}}const C=[`light`,`dark`],w=[`system`,...C],T=e=>e;function E(e){return typeof e==`string`&&w.some(t=>t===e)}const ee=e=>e;function D(e){return typeof e==`string`&&C.some(t=>t===e)}function O({theme:e,prefersDarkMode:t}){let n=t?`dark`:`light`,r=(e===`system`?n:e)===`dark`?`light`:`dark`;return r===n?`system`:r}const k=`(prefers-color-scheme: dark)`,A=`mantle-ui-theme`,j=`system`,M={system:`system`,light:`light`,dark:`dark`,"light-high-contrast":`light`,"dark-high-contrast":`dark`},N=s(null),P=s(void 0);function F(e){let n=o(19),{children:r,forceTheme:a,ssrCookie:s}=e,c;n[0]!==a||n[1]!==s?(c=()=>{let e=K({cookie:i()?Q()??s:s});return L(e,{forceTheme:a}),e},n[0]=a,n[1]=s,n[2]=c):c=n[2];let[f,m]=d(c),h=u(null),_,v;n[3]!==a||n[4]!==s?(_=()=>{let e=function(){let e=K({cookie:Q()??s});m(e),L(e,{forceTheme:a})};e();let n=t(Q(),A);n!=null&&!E(n)&&Object.hasOwn(M,n)&&$(K({cookie:Q()}));try{`BroadcastChannel`in window&&(h.current=new BroadcastChannel(A),h.current.addEventListener(`message`,e))}catch{}let r=function(t){t.key===`${A}__ping`&&e()};window.addEventListener(`storage`,r);let i=window.matchMedia(k),o=function(){e()},c=function(){document.visibilityState===`visible`&&e()};return i.addEventListener(`change`,o),window.addEventListener(`pageshow`,o),document.addEventListener(`visibilitychange`,c),()=>{window.removeEventListener(`storage`,r),i.removeEventListener(`change`,o),window.removeEventListener(`pageshow`,o),document.removeEventListener(`visibilitychange`,c),te(h.current),h.current=null}},v=[a,s],n[3]=a,n[4]=s,n[5]=_,n[6]=v):(_=n[5],v=n[6]),l(_,v);let y;n[7]!==a||n[8]!==f?(y=(e,t)=>{let{origin:n}=t===void 0?{}:t,r=()=>{if(typeof e!=`function`)return e;let t=document.documentElement.dataset.theme;return e(E(t)?t:f)},i=()=>{let e=r();$(e),m(e),L(e,{forceTheme:a}),J(e,{broadcastChannel:h.current,pingKey:`${A}__ping`})},o=window.matchMedia(k).matches;(a??z(r(),{prefersDarkMode:o}))===document.documentElement.dataset.appliedTheme?i():g(i,{origin:n})},n[7]=a,n[8]=f,n[9]=y):y=n[9];let b;n[10]!==y||n[11]!==f?(b=[f,y],n[10]=y,n[11]=f,n[12]=b):b=n[12];let x=b,S;n[13]!==r||n[14]!==x?(S=/* @__PURE__ */ p(N.Provider,{value:x,children:r}),n[13]=r,n[14]=x,n[15]=S):S=n[15];let C;return n[16]!==a||n[17]!==S?(C=/* @__PURE__ */ p(P.Provider,{value:a,children:S}),n[16]=a,n[17]=S,n[18]=C):C=n[18],C}function I(){let e=c(N);return f(e,`useTheme must be used within a ThemeProvider`),e}function L(e,{forceTheme:t}={}){if(!i())return;let n=window.document.documentElement,r=window.matchMedia(k).matches,a=t??z(e,{prefersDarkMode:r}),o=n.dataset.theme,s=n.dataset.appliedTheme,c=E(o)?o:void 0,l=D(s)?s:void 0;(c!==e||l!==a)&&(n.classList.remove(...C),n.classList.add(a),n.dataset.theme=e,n.dataset.appliedTheme=a)}function R(){if(!i())return{appliedTheme:void 0,theme:void 0};let e=window.document.documentElement,t=E(e.dataset.theme)?e.dataset.theme:void 0;return{appliedTheme:D(e.dataset.appliedTheme)?e.dataset.appliedTheme:void 0,theme:t}}function z(e,{prefersDarkMode:t}){return e===`system`?t?`dark`:`light`:e}function B(){let t=o(4),n=c(N),r=V(),i=n==null?`system`:n[0],a=e(k),s;return t[0]!==r||t[1]!==a||t[2]!==i?(s=r??z(i,{prefersDarkMode:a}),t[0]=r,t[1]=a,t[2]=i,t[3]=s):s=t[3],s}function V(){return c(P)}function H({storageKey:e,themeByCookieValue:t,forceTheme:n}){let r=`system`;try{let n=document.cookie.split(`;`).map(e=>e.trim()).find(t=>t.startsWith(`${e}=`)),i=decodeURIComponent(n?.slice(e.length+1)??``);Object.hasOwn(t,i)&&(r=t[i]??`system`)}catch{}let i=matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;n==null?r!==`system`&&(i=r):i=n;let a=document.documentElement;a.classList.remove(`light`,`dark`),a.classList.add(i),a.dataset.theme=r,a.dataset.appliedTheme=i}function U(e){let t={storageKey:A,themeByCookieValue:M,forceTheme:e};return`(${H.toString()})(${JSON.stringify(t)})`}const W=e=>{let t=o(7),{forceTheme:n,nonce:r}=e,i;t[0]===n?i=t[1]:(i=U(n),t[0]=n,t[1]=i);let a;t[2]===i?a=t[3]:(a={__html:i},t[2]=i,t[3]=a);let s;return t[4]!==r||t[5]!==a?(s=/* @__PURE__ */ p(`script`,{dangerouslySetInnerHTML:a,nonce:r,suppressHydrationWarning:!0}),t[4]=r,t[5]=a,t[6]=s):s=t[6],s};function G(e){let t=o(17),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let a=n,s;t[2]===a?s=t[3]:(s=a??{},t[2]=a,t[3]=s);let{className:c,forceTheme:l,ssrCookie:u}=s,d=c===void 0?``:c,f,p;if(i()){let e;if(t[7]!==u){let n=window.matchMedia(k).matches;f=K({cookie:Q()??u}),e=z(f,{prefersDarkMode:n}),t[7]=u,t[8]=e,t[9]=f}else e=t[8],f=t[9];p=e}else{let e;t[4]===u?(e=t[5],f=t[6]):(f=K({cookie:u}),e=z(f,{prefersDarkMode:!1}),t[4]=u,t[5]=e,t[6]=f),p=e}let m=l??p,h;t[10]!==m||t[11]!==d?(h=r(d,m),t[10]=m,t[11]=d,t[12]=h):h=t[12];let g;return t[13]!==m||t[14]!==f||t[15]!==h?(g={className:h,"data-applied-theme":m,"data-theme":f},t[13]=m,t[14]=f,t[15]=h,t[16]=g):g=t[16],g}function K({cookie:e}){if(!e)return j;let n=t(e,A);return n==null||!Object.hasOwn(M,n)?j:M[n]??j}function q(e){return n(e,A)}function J(e,t){let{broadcastChannel:n,pingKey:r}=t;try{if(n){n.postMessage({theme:e,timestamp:Date.now()});return}}catch{}try{localStorage.setItem(r,JSON.stringify({theme:e,timestamp:Date.now()}))}catch{}}const Y=[`ngrok.com`,`ngrok.ai`];function X(e){let t=Y.find(t=>e===t||e.endsWith(`.${t}`));return t==null?void 0:`.${t}`}function Z(e){let t=/* @__PURE__ */ new Date;t.setFullYear(t.getFullYear()+1);let{hostname:n,protocol:r}=window.location,i=X(n),a=i==null?``:`; domain=${i}`,o=r===`https:`?`; Secure`:``;return`${A}=${encodeURIComponent(e)}; expires=${t.toUTCString()}; path=/${a}; SameSite=Lax${o}`}function Q(){try{return document.cookie}catch{return}}function $(e){if(i())try{document.cookie=Z(e)}catch{}}function te(e){if(e!=null)try{e.close()}catch{}}export{w as _,U as a,V as c,ee as d,T as f,C as g,E as h,K as i,G as l,D as m,F as n,R as o,O as p,q as r,B as s,W as t,I as u};
|
package/dist/theme-switcher.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for ThemeSwitcher, the canonical light/dark toggle for headers
|
|
3
|
+
* and toolbars, and ThemeDropdownMenuItem, the same toggle as one item for
|
|
4
|
+
* any `DropdownMenu.Content` or `DropdownMenu.SubContent`. ThemeSwitcherIcon
|
|
5
|
+
* and useThemeToggle compose the same toggle into a menu item you lay out.
|
|
6
|
+
*
|
|
7
|
+
* @see https://mantle.ngrok.com/components/forms/theme-switcher
|
|
8
|
+
*/
|
|
2
9
|
import { t as WithStyleProps } from "./with-style-props-CuT30s0W.js";
|
|
3
|
-
import {
|
|
10
|
+
import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
|
|
11
|
+
import { n as IconButtonProps, r as IconButtonAppearance } from "./button-BGwOPjGV.js";
|
|
4
12
|
import { ReactNode } from "react";
|
|
5
13
|
/**
|
|
6
14
|
* The props for the `ThemeSwitcherIcon` component.
|
|
@@ -203,6 +211,12 @@ type ThemeSwitcherProps = Omit<IconButtonProps, "appearance" | "asChild" | "chil
|
|
|
203
211
|
* hydration, then the icon of the applied theme. To put the same control in
|
|
204
212
|
* an existing menu, use `ThemeDropdownMenuItem`.
|
|
205
213
|
*
|
|
214
|
+
* @useWhen Let the user switch between light and dark mode from a header, a toolbar, or an account
|
|
215
|
+
* menu.
|
|
216
|
+
*
|
|
217
|
+
* @siblings
|
|
218
|
+
* - `Switch`: the toggle controls a setting other than the theme.
|
|
219
|
+
*
|
|
206
220
|
* @see https://mantle.ngrok.com/components/forms/theme-switcher
|
|
207
221
|
* @see https://lea.verou.me/blog/2026/dark-mode-toggles/
|
|
208
222
|
*
|
package/dist/theme-switcher.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./browser-only-BTSrYWLj.js";import{t as n}from"./
|
|
1
|
+
import{r as e,t}from"./browser-only-BTSrYWLj.js";import{t as n}from"./use-matches-media-query-m860lols.js";import{t as r}from"./cx-CK7o_rVv.js";import{t as i}from"./data-slot-EM6s2WEU.js";import{t as a}from"./button-BWGUuWnu.js";import{t as o}from"./dropdown-menu-DHdgaw4P.js";import{r as s}from"./button-Cu9e3SM7.js";import{n as c}from"./icons-4JA-SGfv.js";import{t as l}from"./skeleton-DBpI-ko5.js";import{c as u,p as d,s as f,u as p}from"./theme-DdZgLvKH.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(c,{theme:`light`}),dark:/* @__PURE__ */ g(c,{theme:`dark`})};function y(e){let n=m(9),{className:i,style:a}=e,o=f(),c;n[0]===i?c=n[1]:(c=r(`flex shrink-0 items-center justify-center text-muted`,i),n[0]=i,n[1]=c);let u;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=/* @__PURE__ */ g(l,{asChild:!0,className:`rounded-full size-5`,children:/* @__PURE__ */ g(`span`,{})}),n[2]=u):u=n[2];let d;n[3]===o?d=n[4]:(d=/* @__PURE__ */ g(t,{fallback:u,children:()=>/* @__PURE__ */ g(s,{active:o,icons:v})}),n[3]=o,n[4]=d);let p;return n[5]!==a||n[6]!==c||n[7]!==d?(p=/* @__PURE__ */ g(`span`,{"aria-hidden":!0,"data-slot":`theme-switcher-icon`,className:c,style:a,children:d}),n[5]=a,n[6]=c,n[7]=d,n[8]=p):p=n[8],p}function b(){let e=m(10),[t,r]=p(),i=u(),a=n(`(prefers-color-scheme: dark)`),o=i!=null,s;e[0]!==a||e[1]!==t?(s=C(d({theme:t,prefersDarkMode:a}),{prefersDarkMode:a}),e[0]=a,e[1]=t,e[2]=s):s=e[2];let c;e[3]!==a||e[4]!==r?(c=e=>{e.preventDefault();let t=e.currentTarget instanceof Element?e.currentTarget:null;r(e=>d({theme:e,prefersDarkMode:a}),{origin:t?.querySelector(`[data-slot~="theme-switcher-icon"]`)??t})},e[3]=a,e[4]=r,e[5]=c):c=e[5];let l;return e[6]!==o||e[7]!==s||e[8]!==c?(l={disabled:o,label:s,onSelect:c},e[6]=o,e[7]=s,e[8]=c,e[9]=l):l=e[9],l}function x(e){let t=m(13),{children:n,className:i,label:a,style:s}=e,c=b(),l=n!=null&&typeof n!=`boolean`&&n!==``,u=a==null&&!l?`Theme: ${c.label}`:void 0,d;t[0]===i?d=t[1]:(d=r(`gap-2`,i),t[0]=i,t[1]=d);let f;t[2]!==n||t[3]!==l||t[4]!==a?(f=l?n:/* @__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]=n,t[3]=l,t[4]=a,t[5]=f):f=t[5];let p;return t[6]!==s||t[7]!==u||t[8]!==d||t[9]!==f||t[10]!==c.disabled||t[11]!==c.onSelect?(p=/* @__PURE__ */ g(o.Item,{"aria-label":u,"data-slot":`theme-dropdown-menu-item`,className:d,disabled:c.disabled,style:s,onSelect:c.onSelect,children:f}),t[6]=s,t[7]=u,t[8]=d,t[9]=f,t[10]=c.disabled,t[11]=c.onSelect,t[12]=p):p=t[12],p}function S(r){let o=m(28),c,h,_,y,b,x;o[0]===r?(c=o[1],h=o[2],_=o[3],y=o[4],b=o[5],x=o[6]):({appearance:x,"data-slot":c,disabled:h,label:_,onClick:y,...b}=r,o[0]=r,o[1]=c,o[2]=h,o[3]=_,o[4]=y,o[5]=b,o[6]=x);let S=x===void 0?`ghost`:x,[w,T]=p(),E=f(),D=u(),O=n(`(prefers-color-scheme: dark)`),k=e(),A;if(o[7]!==k||o[8]!==O||o[9]!==w){let e=d({theme:w,prefersDarkMode:O});A=k?C(e,{prefersDarkMode:O}):`Toggle theme`,o[7]=k,o[8]=O,o[9]=w,o[10]=A}else A=o[10];let j=A,M;o[11]===c?M=o[12]:(M=i(c,`theme-switcher`),o[11]=c,o[12]=M);let N=D!=null||h,P;o[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=/* @__PURE__ */ g(l,{asChild:!0,className:`rounded-full size-5`,children:/* @__PURE__ */ g(`span`,{})}),o[13]=P):P=o[13];let F;o[14]===E?F=o[15]:(F=/* @__PURE__ */ g(t,{fallback:P,children:()=>/* @__PURE__ */ g(s,{active:E,icons:v})}),o[14]=E,o[15]=F);let I=_??(D==null?j:`Theme set by this page`),L;o[16]!==y||o[17]!==O||o[18]!==T?(L=e=>{y?.(e),e.defaultPrevented||T(e=>d({theme:e,prefersDarkMode:O}),{origin:e.currentTarget})},o[16]=y,o[17]=O,o[18]=T,o[19]=L):L=o[19];let R;return o[20]!==S||o[21]!==b||o[22]!==M||o[23]!==N||o[24]!==F||o[25]!==I||o[26]!==L?(R=/* @__PURE__ */ g(a,{appearance:S,"data-slot":M,disabled:N,intent:`neutral`,icon:F,label:I,onClick:L,...b}),o[20]=S,o[21]=b,o[22]=M,o[23]=N,o[24]=F,o[25]=I,o[26]=L,o[27]=R):R=o[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};
|
package/dist/theme.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Theme component — the provider and hooks that carry the
|
|
3
|
+
* applied theme, plus the document tags that stop a wrong-theme flash.
|
|
4
|
+
*
|
|
5
|
+
* @useWhen Apply the light or dark theme to an app, follow the operating system by default, and
|
|
6
|
+
* stop a wrong-theme flash on load.
|
|
7
|
+
*
|
|
8
|
+
* @siblings
|
|
9
|
+
* - `ThemeSwitcher`: the user changes the theme from a control in the UI.
|
|
10
|
+
*
|
|
11
|
+
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
12
|
+
*/
|
|
1
13
|
import { a as isResolvedTheme, c as themes, i as Theme, n as $theme, o as isTheme, r as ResolvedTheme, s as resolvedThemes, t as $resolvedTheme } from "./theme-w1CrMM-x.js";
|
|
2
14
|
import { PropsWithChildren } from "react";
|
|
3
15
|
/**
|
package/dist/theme.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o as u,r as d,s as f,t as p,u as m}from"./theme-
|
|
1
|
+
import{_ as e,a as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o as u,r as d,s as f,t as p,u as m}from"./theme-DdZgLvKH.js";import{c as h}from"react/compiler-runtime";import{jsx as g}from"react/jsx-runtime";const _=`https://assets.ngrok.com`,v=`${_}/fonts`,y={roobert:`/roobert/roobert-proportional-vf.woff2`,"jetbrains-mono":`/jetbrains/jetbrainsmono-wght.woff2`,"jetbrains-mono-italic":`/jetbrains/jetbrainsmono-italic-wght.woff2`,"family-regular":`/family/family-regular.woff2`,"family-italic":`/family/family-italic.woff2`};function b(e){let t=e.startsWith(`/`)?e:`/${e}`;return`${v}${t}`}function x(e){return`<${b(y[e])}>; rel=preload; as=font; type="font/woff2"; crossorigin`}const S=e=>{let t=h(4),{name:n}=e,r=y[n],i;t[0]===r?i=t[1]:(i=b(r),t[0]=r,t[1]=i);let a;return t[2]===i?a=t[3]:(a=/* @__PURE__ */ g(`link`,{rel:`preload`,href:i,as:`font`,type:`font/woff2`,crossOrigin:`anonymous`}),t[2]=i,t[3]=a),a};export{n as $resolvedTheme,r as $theme,S as PreloadFont,p as PreventWrongThemeFlashScript,l as ThemeProvider,_ as assetsCdnOrigin,d as extractThemeCookie,b as fontHref,o as getStoredTheme,c as isResolvedTheme,a as isTheme,x as preloadFontLink,t as preventWrongThemeFlashScriptContent,u as readThemeFromHtmlElement,i as resolvedThemes,e as themes,f as useAppliedTheme,s as useInitialHtmlThemeProps,m as useTheme};
|
package/dist/toast.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Toast component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/feedback/toast
|
|
5
|
+
*/
|
|
1
6
|
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
|
-
import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
|
|
3
7
|
import { t as WithStyleProps } from "./with-style-props-CuT30s0W.js";
|
|
8
|
+
import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
|
|
4
9
|
import { n as SvgOnlyProps } from "./icon-DXDyhy2N.js";
|
|
5
10
|
import { ComponentProps, ReactNode } from "react";
|
|
6
11
|
import { Toaster as Toaster$1 } from "sonner";
|
|
@@ -176,6 +181,14 @@ declare const Message: ({ "data-slot": dataSlot, asChild, className, ref, ...pro
|
|
|
176
181
|
* A succinct message that appears temporarily. Toasts give the user feedback
|
|
177
182
|
* without interrupting their workflow.
|
|
178
183
|
*
|
|
184
|
+
* @useWhen Report the result of an action, such as a save or a copy, in a brief message that goes
|
|
185
|
+
* away on its own.
|
|
186
|
+
*
|
|
187
|
+
* @siblings
|
|
188
|
+
* - `Alert`: the message stays in the page next to the content it describes.
|
|
189
|
+
* - `AlertDialog`: the user must respond before they continue.
|
|
190
|
+
* - `Sandbar`: the message waits for the user to save or discard pending changes.
|
|
191
|
+
*
|
|
179
192
|
* @see https://mantle.ngrok.com/components/feedback/toast
|
|
180
193
|
*
|
|
181
194
|
* @example
|
package/dist/toast.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./icon-kK0c-POG.js";import{t as r}from"./slot-DdYN1L1C.js";import{s as i}from"./theme-
|
|
1
|
+
import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./icon-kK0c-POG.js";import{t as r}from"./slot-DdYN1L1C.js";import{s as i}from"./theme-DdZgLvKH.js";import{c as a}from"react/compiler-runtime";import{createContext as o,useContext as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{CheckCircleIcon as u}from"@phosphor-icons/react/CheckCircle";import{InfoIcon as d}from"@phosphor-icons/react/Info";import{WarningIcon as f}from"@phosphor-icons/react/Warning";import{WarningDiamondIcon as p}from"@phosphor-icons/react/WarningDiamond";import{Toaster as m,toast as h}from"sonner";function g(e){return typeof e==`number`&&e<=0?1/0:e}const _=t=>{let n=a(13),{className:r,containerAriaLabel:o,dir:s,duration_ms:l,position:u,style:d}=t,f=l===void 0?4e3:l,p=u===void 0?`top-center`:u,h=i(),_;n[0]===r?_=n[1]:(_=e(`toaster overlay-prompt pointer-events-auto *:duration-200`,r),n[0]=r,n[1]=_);let v;n[2]===f?v=n[3]:(v=g(f),n[2]=f,n[3]=v);let y=p??`top-center`,b;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(b={unstyled:!0},n[4]=b):b=n[4];let x;return n[5]!==o||n[6]!==s||n[7]!==d||n[8]!==_||n[9]!==v||n[10]!==y||n[11]!==h?(x=/* @__PURE__ */ c(m,{"data-slot":`toaster`,className:_,containerAriaLabel:o,dir:s,duration:v,gap:12,position:y,style:d,theme:h,toastOptions:b}),n[5]=o,n[6]=s,n[7]=d,n[8]=_,n[9]=v,n[10]=y,n[11]=h,n[12]=x):x=n[12],x},v=o(``);function y(e,t){let n=g(t?.duration_ms);return h.custom(t=>/* @__PURE__ */ c(v.Provider,{value:t,children:e}),{duration:n,...t?.id?{id:t.id}:{},unstyled:!0})}const b=o({intent:`info`}),x={Root:n=>{let r=a(27),i,o,s,u,d,f;r[0]===n?(i=r[1],o=r[2],s=r[3],u=r[4],d=r[5],f=r[6]):({"data-slot":s,children:i,className:o,intent:u,ref:f,...d}=n,r[0]=n,r[1]=i,r[2]=o,r[3]=s,r[4]=u,r[5]=d,r[6]=f);let p;r[7]===u?p=r[8]:(p={intent:u},r[7]=u,r[8]=p);let m=p,h;r[9]===s?h=r[10]:(h=t(s,`toast`),r[9]=s,r[10]=h);let g;r[11]===o?g=r[12]:(g=e(`relative flex items-start gap-2 text-sm font-sans`,`p-3 pl-3.75`,`bg-popover rounded rounded-r-[0.3125rem] border border-gray-500/35 shadow-lg`,o),r[11]=o,r[12]=g);let _;r[13]===u?_=r[14]:(_=/* @__PURE__ */ c(C,{intent:u}),r[13]=u,r[14]=_);let v;r[15]===i?v=r[16]:(v=/* @__PURE__ */ c(`div`,{"data-slot":`toast-label`,className:`contents`,children:i}),r[15]=i,r[16]=v);let y;r[17]!==d||r[18]!==f||r[19]!==h||r[20]!==g||r[21]!==_||r[22]!==v?(y=/* @__PURE__ */ l(`div`,{"data-slot":h,className:g,ref:f,...d,children:[_,v]}),r[17]=d,r[18]=f,r[19]=h,r[20]=g,r[21]=_,r[22]=v,r[23]=y):y=r[23];let x;return r[24]!==m||r[25]!==y?(x=/* @__PURE__ */ c(b.Provider,{value:m,children:y}),r[24]=m,r[25]=y,r[26]=x):x=r[26],x},Action:n=>{let i=a(21),o,l,u,d,f,p;i[0]===n?(o=i[1],l=i[2],u=i[3],d=i[4],f=i[5],p=i[6]):({"data-slot":u,asChild:o,className:l,onClick:d,ref:p,...f}=n,i[0]=n,i[1]=o,i[2]=l,i[3]=u,i[4]=d,i[5]=f,i[6]=p);let m=s(v),g=o?r:`button`,_;i[7]===u?_=i[8]:(_=t(u,`toast-action`),i[7]=u,i[8]=_);let y;i[9]===l?y=i[10]:(y=e(`shrink-0`,`data-icon-button:-mr-0.5 data-icon-button:-mt-0.5 data-icon-button:rounded-xs`,l),i[9]=l,i[10]=y);let b;i[11]!==m||i[12]!==d?(b=e=>{d?.(e),e.defaultPrevented||h.dismiss(m)},i[11]=m,i[12]=d,i[13]=b):b=i[13];let x;return i[14]!==g||i[15]!==f||i[16]!==p||i[17]!==_||i[18]!==y||i[19]!==b?(x=/* @__PURE__ */ c(g,{"data-slot":_,className:y,onClick:b,ref:p,...f}),i[14]=g,i[15]=f,i[16]=p,i[17]=_,i[18]=y,i[19]=b,i[20]=x):x=i[20],x},Icon:r=>{let i=a(54),o,l,m,h,g;i[0]===r?(o=i[1],l=i[2],m=i[3],h=i[4],g=i[5]):({"data-slot":l,className:o,svg:g,ref:h,...m}=r,i[0]=r,i[1]=o,i[2]=l,i[3]=m,i[4]=h,i[5]=g);let _=s(b);switch(_.intent){case`danger`:{let r;i[6]===l?r=i[7]:(r=t(l,`toast-icon`),i[6]=l,i[7]=r);let a;i[8]===o?a=i[9]:(a=e(`text-danger-600`,o),i[8]=o,i[9]=a);let s;i[10]===g?s=i[11]:(s=g??/* @__PURE__ */ c(f,{weight:`fill`}),i[10]=g,i[11]=s);let u;return i[12]!==m||i[13]!==h||i[14]!==r||i[15]!==a||i[16]!==s?(u=/* @__PURE__ */ c(n,{"data-slot":r,className:a,ref:h,svg:s,...m}),i[12]=m,i[13]=h,i[14]=r,i[15]=a,i[16]=s,i[17]=u):u=i[17],u}case`warning`:{let r;i[18]===l?r=i[19]:(r=t(l,`toast-icon`),i[18]=l,i[19]=r);let a;i[20]===o?a=i[21]:(a=e(`text-warning-600`,o),i[20]=o,i[21]=a);let s;i[22]===g?s=i[23]:(s=g??/* @__PURE__ */ c(p,{weight:`fill`}),i[22]=g,i[23]=s);let u;return i[24]!==m||i[25]!==h||i[26]!==r||i[27]!==a||i[28]!==s?(u=/* @__PURE__ */ c(n,{"data-slot":r,className:a,ref:h,svg:s,...m}),i[24]=m,i[25]=h,i[26]=r,i[27]=a,i[28]=s,i[29]=u):u=i[29],u}case`success`:{let r;i[30]===l?r=i[31]:(r=t(l,`toast-icon`),i[30]=l,i[31]=r);let a;i[32]===o?a=i[33]:(a=e(`text-success-600`,o),i[32]=o,i[33]=a);let s;i[34]===g?s=i[35]:(s=g??/* @__PURE__ */ c(u,{weight:`fill`}),i[34]=g,i[35]=s);let d;return i[36]!==m||i[37]!==h||i[38]!==r||i[39]!==a||i[40]!==s?(d=/* @__PURE__ */ c(n,{"data-slot":r,className:a,ref:h,svg:s,...m}),i[36]=m,i[37]=h,i[38]=r,i[39]=a,i[40]=s,i[41]=d):d=i[41],d}case`info`:{let r;i[42]===l?r=i[43]:(r=t(l,`toast-icon`),i[42]=l,i[43]=r);let a;i[44]===o?a=i[45]:(a=e(`text-accent-600`,o),i[44]=o,i[45]=a);let s;i[46]===g?s=i[47]:(s=g??/* @__PURE__ */ c(d,{weight:`fill`}),i[46]=g,i[47]=s);let u;return i[48]!==m||i[49]!==h||i[50]!==r||i[51]!==a||i[52]!==s?(u=/* @__PURE__ */ c(n,{"data-slot":r,className:a,ref:h,svg:s,...m}),i[48]=m,i[49]=h,i[50]=r,i[51]=a,i[52]=s,i[53]=u):u=i[53],u}default:throw Error(`Unreachable Case: ${String(_.intent)}`)}},Message:n=>{let i=a(16),o,s,l,u,d;i[0]===n?(o=i[1],s=i[2],l=i[3],u=i[4],d=i[5]):({"data-slot":l,asChild:o,className:s,ref:d,...u}=n,i[0]=n,i[1]=o,i[2]=s,i[3]=l,i[4]=u,i[5]=d);let f=o?r:`p`,p;i[6]===l?p=i[7]:(p=t(l,`toast-message`),i[6]=l,i[7]=p);let m;i[8]===s?m=i[9]:(m=e(`text-strong flex-1 text-sm font-body`,s),i[8]=s,i[9]=m);let h;return i[10]!==f||i[11]!==u||i[12]!==d||i[13]!==p||i[14]!==m?(h=/* @__PURE__ */ c(f,{"data-slot":p,className:m,ref:d,...u}),i[10]=f,i[11]=u,i[12]=d,i[13]=p,i[14]=m,i[15]=h):h=i[15],h}},S={info:`bg-accent-600`,warning:`bg-warning-600`,success:`bg-success-600`,danger:`bg-danger-600`};function C(t){let n=a(10),r,i,o;n[0]===t?(r=n[1],i=n[2],o=n[3]):({className:r,intent:i,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o);let s=S[i],l;n[4]!==r||n[5]!==s?(l=e(`z-1 absolute -inset-px right-auto w-1.5 rounded-l`,s,r),n[4]=r,n[5]=s,n[6]=l):l=n[6];let u;return n[7]!==o||n[8]!==l?(u=/* @__PURE__ */ c(`div`,{"aria-hidden":!0,className:l,...o}),n[7]=o,n[8]=l,n[9]=u):u=n[9],u}export{x as Toast,_ as Toaster,y as makeToast};
|