@ngrok/mantle 0.79.3 → 0.80.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 +169 -12
- package/dist/accordion.js +1 -1
- package/dist/agent.json +1 -1
- package/dist/alert-dialog.d.ts +496 -30
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +129 -9
- package/dist/alert.js +1 -1
- package/dist/anchor-_2meGDfj.js +1 -0
- package/dist/anchor.d.ts +2 -2
- package/dist/anchor.js +1 -1
- package/dist/as-child-D23mGo4f.d.ts +49 -0
- package/dist/badge.d.ts +44 -5
- package/dist/badge.js +1 -1
- package/dist/breadcrumb.d.ts +214 -14
- package/dist/breadcrumb.js +1 -1
- package/dist/button-5WsvzIQ6.js +1 -0
- package/dist/{button-DcXOWUYo.d.ts → button-BPMwa2jN.d.ts} +3 -3
- package/dist/button-D9n09xUg.js +1 -0
- package/dist/button.d.ts +3 -3
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +0 -3
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +146 -9
- package/dist/card.js +1 -1
- package/dist/centered-layout.d.ts +224 -8
- package/dist/centered-layout.js +1 -1
- package/dist/checkbox-Cq17y0-R.js +1 -0
- package/dist/checkbox.d.ts +12 -10
- package/dist/checkbox.js +1 -1
- package/dist/choice-Cc8dA5r8.js +1 -0
- package/dist/choice-Ct0KK8jw.d.ts +269 -0
- package/dist/choice.d.ts +1 -252
- package/dist/choice.js +1 -1
- package/dist/code-block.d.ts +270 -50
- package/dist/code-block.js +6 -6
- package/dist/code.d.ts +3 -2
- package/dist/code.js +1 -1
- package/dist/combobox.d.ts +190 -11
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +285 -81
- package/dist/command.js +1 -1
- package/dist/compose-refs-BdBMM9ga.js +1 -0
- package/dist/data-table.d.ts +33 -5
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +79 -6
- package/dist/description-list.js +1 -1
- package/dist/dialog-CQ2C6vkE.js +1 -0
- package/dist/dialog.d.ts +239 -18
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu-CSCDdA3K.js +1 -0
- package/dist/{dropdown-menu-DP_Ne9Mr.d.ts → dropdown-menu-CoyozLzy.d.ts} +170 -29
- package/dist/dropdown-menu.d.ts +2 -2
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +1 -1
- package/dist/empty.js +1 -1
- package/dist/field.d.ts +596 -45
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +0 -3
- package/dist/flag.js +1 -1
- package/dist/hooks.d.ts +3 -4
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +54 -4
- package/dist/hover-card.js +1 -1
- package/dist/{icon-Cevjo93X.d.ts → icon-BDqpcZ-n.d.ts} +1 -1
- package/dist/icon-CGgMKpJg.js +1 -0
- package/dist/{icon-button-BvQvT790.d.ts → icon-button-C1AfGnQx.d.ts} +6 -60
- package/dist/icon-button-DiOhreJD.js +1 -0
- package/dist/icon.d.ts +2 -2
- package/dist/icon.js +1 -1
- package/dist/icons.d.ts +5 -13
- package/dist/icons.js +1 -1
- package/dist/{in-view-nkSOdED2.d.ts → in-view-DDEGUKDR.d.ts} +17 -9
- package/dist/index-B8mIWKIU.d.ts +211 -0
- package/dist/{index-Rv8RL7xy.d.ts → index-BtwKJTLq.d.ts} +1 -1
- package/dist/{index-BSAizFod.d.ts → index-C2jj8U4a.d.ts} +5 -5
- package/dist/index-CdPXa9h1.d.ts +1 -0
- package/dist/{index-D47aqlpz.d.ts → index-DA4ig3gj.d.ts} +1 -1
- package/dist/input-CVyAVbim.js +1 -0
- package/dist/{types-C19IR7jf.d.ts → input-DV9M6K4v.d.ts} +42 -2
- package/dist/input.d.ts +4 -55
- package/dist/input.js +1 -1
- package/dist/{label-v2-bv98k.d.ts → label-C6YH9skg.d.ts} +8 -6
- package/dist/label-D-D11mlp.js +1 -0
- package/dist/label.d.ts +1 -1
- package/dist/label.js +1 -1
- package/dist/list.d.ts +150 -6
- package/dist/list.js +1 -1
- package/dist/llms.txt +1 -1
- package/dist/main.d.ts +20 -4
- package/dist/main.js +1 -1
- package/dist/media-object.d.ts +27 -4
- package/dist/media-object.js +1 -1
- package/dist/multi-select.d.ts +312 -15
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +129 -5
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +70 -6
- package/dist/pagination.js +1 -1
- package/dist/popover-CBMADtjV.js +1 -0
- package/dist/popover.d.ts +1 -181
- package/dist/popover.js +1 -1
- package/dist/primitive-CJRIlrLz.d.ts +31 -0
- package/dist/primitive-DCPHJsRs.js +1 -0
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +113 -5
- package/dist/qr-code.js +1 -1
- package/dist/radio-group.d.ts +128 -23
- package/dist/radio-group.js +1 -1
- package/dist/sandboxed-on-click.d.ts +2 -2
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/select-SR_9-bxA.js +1 -0
- package/dist/select-idm1jy7y.d.ts +600 -0
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +252 -298
- package/dist/selectable-list.js +1 -1
- package/dist/separator-B5UmkVRL.d.ts +75 -0
- package/dist/separator-bpE_kooz.js +1 -0
- package/dist/separator.d.ts +1 -52
- package/dist/separator.js +1 -1
- package/dist/sheet.d.ts +295 -21
- package/dist/sheet.js +1 -1
- package/dist/skeleton-CsbUHbBA.js +1 -0
- package/dist/skeleton.d.ts +4 -7
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.d.ts +24 -4
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slot-CDk0Bb9z.js +1 -0
- package/dist/slot.d.ts +1 -1
- package/dist/slot.js +1 -1
- package/dist/{sort-BPX2Fk9t.js → sort-B_DDQcVD.js} +1 -1
- package/dist/split-button.d.ts +28 -13
- package/dist/split-button.js +1 -1
- package/dist/{svg-only-BFeFS1aa.d.ts → svg-only-CdI_v82i.d.ts} +1 -1
- package/dist/svg-only-d-nMCfAI.js +1 -0
- package/dist/switch.d.ts +9 -6
- package/dist/switch.js +1 -1
- package/dist/table-DUSvU_Jw.d.ts +875 -0
- package/dist/table-GDkapNFi.js +1 -0
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +135 -21
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +1 -1
- package/dist/text-area.js +1 -1
- package/dist/theme-provider-BftkIiZn.js +1 -0
- package/dist/theme-switcher.d.ts +110 -29
- package/dist/theme-switcher.js +1 -1
- package/dist/theme-wVnzzx2F.js +1 -0
- package/dist/theme.d.ts +53 -14
- package/dist/theme.js +1 -1
- package/dist/toast-DKgMRv4F.js +1 -0
- package/dist/toast.d.ts +98 -10
- package/dist/toast.js +1 -1
- package/dist/tooltip.d.ts +28 -1
- package/dist/tooltip.js +1 -1
- package/dist/{traffic-policy-file-0g5RXFqu.js → traffic-policy-file-CF1lbWtp.js} +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/virtual-UrzmaSQm.js +1 -0
- package/dist/well.d.ts +3 -3
- package/dist/well.js +1 -1
- package/package.json +3 -3
- package/dist/anchor-C_tjSVy6.js +0 -1
- package/dist/as-child-CYEVu1WY.d.ts +0 -23
- package/dist/button-5t6-JS_I.js +0 -1
- package/dist/button-ClC60Nzg.js +0 -1
- package/dist/checkbox-DJ2xl7Rc.js +0 -1
- package/dist/choice-DOdyNzFC.js +0 -1
- package/dist/compose-refs-Cjf2gfB8.js +0 -1
- package/dist/dialog-vxLIvB8M.js +0 -1
- package/dist/dropdown-menu-Bt1aKF1g.js +0 -1
- package/dist/icon-CDtYjF_H.js +0 -1
- package/dist/icon-button-DV2-GZHf.js +0 -1
- package/dist/index-g2rfwNCH.d.ts +0 -1
- package/dist/input-Ct1YOqSy.js +0 -1
- package/dist/label-BMlHW_2D.js +0 -1
- package/dist/popover-D5WxxnBY.js +0 -1
- package/dist/primitive-C64-m48O.d.ts +0 -13
- package/dist/primitive-IKruV2iB.js +0 -1
- package/dist/select-Bwt2YduR.d.ts +0 -345
- package/dist/select-D-5u0Blc.js +0 -1
- package/dist/separator-kBnnv3Cw.js +0 -1
- package/dist/skeleton-Bu3tgNcW.js +0 -1
- package/dist/slot-DmPrjM7N.js +0 -1
- package/dist/svg-only-DDx6FtJd.js +0 -1
- package/dist/table-CPH2md2-.js +0 -1
- package/dist/table-CwFHXC-G.d.ts +0 -414
- package/dist/theme-D3MDng6U.js +0 -1
- package/dist/theme-provider-C9zpDyJW.js +0 -1
- package/dist/toast-BsCjaMVS.js +0 -1
- package/dist/virtual-DZMBu7Ch.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./cx-IiQEAKf5.js";import{useLayoutEffect as n,useMemo as r,useRef as i,useState as a}from"react";import{jsx as o}from"react/jsx-runtime";const s=({children:n,className:r,ref:i,...a})=>{let s=_();return o(`div`,{"data-slot":`table`,className:t(`group/table relative w-full overflow-hidden rounded-lg border border-card bg-white dark:bg-gray-100`,r),"data-sticky-active":s.state.hasOverflow&&!s.state.scrolledToEnd||void 0,"data-x-overflow":s.state.hasOverflow,"data-x-scroll-end":s.state.hasOverflow&&s.state.scrolledToEnd,...a,children:o(`div`,{className:t(`scrollbar scroll-fade-x overflow-x-auto overflow-y-clip overscroll-x-none`,`has-data-mantle-table-sticky-right:[--_fade-right:black]`),ref:e(s.ref,i),children:n})})};s.displayName=`TableRoot`;const c=({children:e,className:n,ref:r,...i})=>o(`table`,{"data-slot":`table-element`,ref:r,className:t(`table-auto border-separate border-spacing-0 caption-bottom w-full min-w-full text-left`,n),...i,children:e});c.displayName=`TableElement`;const l=({children:e,className:n,ref:r,...i})=>o(`thead`,{"data-slot":`table-head`,ref:r,className:t(`[&>tr:last-child>*]:border-b [&>tr:last-child>*]:border-card-muted`,`[&>tr+tr>*]:border-t [&>tr+tr>*]:border-card-muted`,`text-muted bg-base`,`[&>tr]:bg-base`,n),...i,children:e});l.displayName=`TableHead`;const u=({children:e,className:n,ref:r,...i})=>o(`tbody`,{"data-slot":`table-body`,className:t(`[&>tr+tr>*]:border-t [&>tr+tr>*]:border-card-muted`,`text-body`,`[&>tr]:bg-card [&>tr]:not-only:hover:bg-card-hover`,n),ref:r,...i,children:e});u.displayName=`TableBody`;const d=({children:e,className:n,ref:r,...i})=>o(`tfoot`,{"data-slot":`table-foot`,ref:r,className:t(`font-medium text-body`,`[&>tr:first-child>*]:border-t [&>tr:first-child>*]:border-card-muted`,`[&>tr+tr>*]:border-t [&>tr+tr>*]:border-card-muted`,`[&>tr]:bg-gray-50/50 [&>tr]:hover:bg-card-hover`,n),...i,children:e});d.displayName=`TableFoot`;const f=({children:e,className:n,ref:r,...i})=>o(`tr`,{"data-slot":`table-row`,ref:r,className:t(n),...i,children:e});f.displayName=`TableRow`;const p=({children:e,className:n,ref:r,...i})=>o(`th`,{"data-slot":`table-header`,ref:r,className:t(`h-11 px-4 text-left align-middle text-sm font-medium [&:has([role=checkbox])]:pr-0`,n),...i,children:e});p.displayName=`TableHeader`;const m=({children:e,className:n,ref:r,...i})=>o(`td`,{"data-slot":`table-cell`,ref:r,className:t(`p-3 align-middle [&:has([role=checkbox])]:pr-0 font-mono text-mono`,n),...i,children:e});m.displayName=`TableCell`;const h=({children:e,className:n,ref:r,...i})=>o(`caption`,{"data-slot":`table-caption`,ref:r,className:t(`py-4 text-sm text-gray-500`,`border-t border-card-muted`,n),...i,children:e});h.displayName=`TableCaption`;const g={Body:u,Caption:h,Cell:m,Element:c,Foot:d,Head:l,Header:p,Root:s,Row:f};function _(){let e=i(null),[t,o]=a({hasOverflow:!1,scrolledToStart:!0,scrolledToEnd:!1});return n(()=>{let t=e.current;if(!t)return;let n=0,r=()=>{let e=t.scrollWidth>t.clientWidth,n=t.scrollLeft<1,r=Math.abs(t.scrollWidth-t.scrollLeft-t.clientWidth)<1;o(t=>t.hasOverflow!==e||t.scrolledToStart!==n||t.scrolledToEnd!==r?{hasOverflow:e,scrolledToStart:n,scrolledToEnd:r}:t)},i=()=>{n===0&&(n=requestAnimationFrame(()=>{n=0,r()}))},a=new ResizeObserver(i);a.observe(t);let s=new MutationObserver(i);return s.observe(t,{childList:!0,subtree:!0}),t.addEventListener(`scroll`,i,{passive:!0}),r(),()=>{cancelAnimationFrame(n),a.disconnect(),s.disconnect(),t.removeEventListener(`scroll`,i)}},[]),r(()=>({ref:e,state:t}),[t])}export{g as t};
|
package/dist/table.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Table } from "./table-
|
|
1
|
+
import { t as Table } from "./table-DUSvU_Jw.js";
|
|
2
2
|
export { Table };
|
package/dist/table.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./table-
|
|
1
|
+
import{t as e}from"./table-GDkapNFi.js";export{e as Table};
|
package/dist/tabs.d.ts
CHANGED
|
@@ -1,5 +1,109 @@
|
|
|
1
|
-
import { HTMLAttributes } from "react";
|
|
1
|
+
import { ComponentProps, HTMLAttributes } from "react";
|
|
2
|
+
import { Content, List, Root, Trigger } from "@radix-ui/react-tabs";
|
|
2
3
|
//#region src/components/tabs/tabs.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A set of layered sections of content—known as tab panels—that are displayed one at a time.
|
|
6
|
+
* The root component that provides context for all tab components.
|
|
7
|
+
*
|
|
8
|
+
* @see https://mantle.ngrok.com/components/navigation/tabs#tabsroot
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <Tabs.Root defaultValue="account">
|
|
13
|
+
* <Tabs.List>
|
|
14
|
+
* <Tabs.Trigger value="account">Account</Tabs.Trigger>
|
|
15
|
+
* <Tabs.Trigger value="password">Password</Tabs.Trigger>
|
|
16
|
+
* </Tabs.List>
|
|
17
|
+
* <Tabs.Content value="account">
|
|
18
|
+
* <p>Make changes to your account here.</p>
|
|
19
|
+
* </Tabs.Content>
|
|
20
|
+
* <Tabs.Content value="password">
|
|
21
|
+
* <p>Change your password here.</p>
|
|
22
|
+
* </Tabs.Content>
|
|
23
|
+
* </Tabs.Root>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare const Root$1: {
|
|
27
|
+
({ className, children, orientation, appearance, ...props }: ComponentProps<typeof Root> & {
|
|
28
|
+
/**
|
|
29
|
+
* The appearance of the tabs. Classic appearance shows the tab
|
|
30
|
+
* list with an underline; pill appearance shows each tab as a pill.
|
|
31
|
+
* @default "classic"
|
|
32
|
+
*/
|
|
33
|
+
appearance?: "classic" | "pill";
|
|
34
|
+
}): import("react").JSX.Element;
|
|
35
|
+
displayName: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Contains the triggers that are aligned along the edge of the active content.
|
|
39
|
+
* The container for tab triggers that provides the visual layout for tab navigation.
|
|
40
|
+
*
|
|
41
|
+
* By default a horizontal classic tablist draws a 1px bottom border in the
|
|
42
|
+
* `separator` color token, and a vertical classic tablist draws the matching
|
|
43
|
+
* side border. Pass `hideBorder` to remove it; the pill appearance never
|
|
44
|
+
* draws a border.
|
|
45
|
+
*
|
|
46
|
+
* @see https://mantle.ngrok.com/components/navigation/tabs#tabslist
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <Tabs.Root defaultValue="account">
|
|
51
|
+
* <Tabs.List>
|
|
52
|
+
* <Tabs.Trigger value="account">Account</Tabs.Trigger>
|
|
53
|
+
* <Tabs.Trigger value="password">Password</Tabs.Trigger>
|
|
54
|
+
* </Tabs.List>
|
|
55
|
+
* <Tabs.Content value="account">
|
|
56
|
+
* <p>Make changes to your account here.</p>
|
|
57
|
+
* </Tabs.Content>
|
|
58
|
+
* </Tabs.Root>
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```tsx
|
|
63
|
+
* // render the tablist without its border
|
|
64
|
+
* <Tabs.List hideBorder>
|
|
65
|
+
* <Tabs.Trigger value="account">Account</Tabs.Trigger>
|
|
66
|
+
* <Tabs.Trigger value="password">Password</Tabs.Trigger>
|
|
67
|
+
* </Tabs.List>
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
declare const List$1: {
|
|
71
|
+
({ className, hideBorder, ref, ...props }: ComponentProps<typeof List> & {
|
|
72
|
+
/**
|
|
73
|
+
* Hide the tablist's border — the bottom border of a horizontal classic
|
|
74
|
+
* tablist, or the side border of a vertical one. Also rendered as a
|
|
75
|
+
* `data-hide-border` attribute on the tablist element. Has no effect on
|
|
76
|
+
* the pill appearance, which never draws a border.
|
|
77
|
+
* @default false
|
|
78
|
+
*/
|
|
79
|
+
hideBorder?: boolean;
|
|
80
|
+
}): import("react").JSX.Element;
|
|
81
|
+
displayName: string;
|
|
82
|
+
};
|
|
83
|
+
type TabsTriggerProps = ComponentProps<typeof Trigger>;
|
|
84
|
+
/**
|
|
85
|
+
* The button that activates its associated content.
|
|
86
|
+
* A clickable tab trigger that switches between different tab content panels.
|
|
87
|
+
*
|
|
88
|
+
* @see https://mantle.ngrok.com/components/navigation/tabs#tabstrigger
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```tsx
|
|
92
|
+
* <Tabs.Root defaultValue="account">
|
|
93
|
+
* <Tabs.List>
|
|
94
|
+
* <Tabs.Trigger value="account">Account</Tabs.Trigger>
|
|
95
|
+
* <Tabs.Trigger value="password">Password</Tabs.Trigger>
|
|
96
|
+
* </Tabs.List>
|
|
97
|
+
* <Tabs.Content value="account">
|
|
98
|
+
* <p>Make changes to your account here.</p>
|
|
99
|
+
* </Tabs.Content>
|
|
100
|
+
* </Tabs.Root>
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
declare const Trigger$1: {
|
|
104
|
+
({ "aria-disabled": _ariaDisabled, asChild, children, className, disabled: _disabled, ref, ...props }: TabsTriggerProps): import("react").JSX.Element;
|
|
105
|
+
displayName: string;
|
|
106
|
+
};
|
|
3
107
|
/**
|
|
4
108
|
* A badge component that can be used inside tab triggers to display additional information.
|
|
5
109
|
* Typically used to show counts or status indicators within tab headers.
|
|
@@ -22,6 +126,32 @@ declare const Badge: {
|
|
|
22
126
|
({ className, children, ...props }: HTMLAttributes<HTMLSpanElement>): import("react").JSX.Element;
|
|
23
127
|
displayName: string;
|
|
24
128
|
};
|
|
129
|
+
/**
|
|
130
|
+
* Contains the content associated with each trigger.
|
|
131
|
+
* The content panel that displays when its corresponding tab trigger is active.
|
|
132
|
+
*
|
|
133
|
+
* @see https://mantle.ngrok.com/components/navigation/tabs#tabscontent
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```tsx
|
|
137
|
+
* <Tabs.Root defaultValue="account">
|
|
138
|
+
* <Tabs.List>
|
|
139
|
+
* <Tabs.Trigger value="account">Account</Tabs.Trigger>
|
|
140
|
+
* <Tabs.Trigger value="password">Password</Tabs.Trigger>
|
|
141
|
+
* </Tabs.List>
|
|
142
|
+
* <Tabs.Content value="account">
|
|
143
|
+
* <p>Make changes to your account here.</p>
|
|
144
|
+
* </Tabs.Content>
|
|
145
|
+
* <Tabs.Content value="password">
|
|
146
|
+
* <p>Change your password here.</p>
|
|
147
|
+
* </Tabs.Content>
|
|
148
|
+
* </Tabs.Root>
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
declare const Content$1: {
|
|
152
|
+
({ className, ...props }: ComponentProps<typeof Content>): import("react").JSX.Element;
|
|
153
|
+
displayName: string;
|
|
154
|
+
};
|
|
25
155
|
/**
|
|
26
156
|
* A set of layered sections of content—known as tab panels—that are displayed one at a time.
|
|
27
157
|
* The root component that provides context for all tab components.
|
|
@@ -74,14 +204,7 @@ declare const Tabs: {
|
|
|
74
204
|
* </Tabs.Root>
|
|
75
205
|
* ```
|
|
76
206
|
*/
|
|
77
|
-
readonly Root:
|
|
78
|
-
/**
|
|
79
|
-
* The appearance of the tabs. Classic appearance shows the tab
|
|
80
|
-
* list with an underline; pill appearance shows each tab as a pill.
|
|
81
|
-
* @default "classic"
|
|
82
|
-
*/
|
|
83
|
-
appearance?: "classic" | "pill";
|
|
84
|
-
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
207
|
+
readonly Root: typeof Root$1;
|
|
85
208
|
/**
|
|
86
209
|
* Contains the content associated with each trigger.
|
|
87
210
|
* The content panel that displays when its corresponding tab trigger is active.
|
|
@@ -100,7 +223,7 @@ declare const Tabs: {
|
|
|
100
223
|
* </Tabs.Root>
|
|
101
224
|
* ```
|
|
102
225
|
*/
|
|
103
|
-
readonly Content:
|
|
226
|
+
readonly Content: typeof Content$1;
|
|
104
227
|
/**
|
|
105
228
|
* Contains the triggers that are aligned along the edge of the active content.
|
|
106
229
|
* The container for tab triggers that provides the visual layout for tab navigation.
|
|
@@ -121,16 +244,7 @@ declare const Tabs: {
|
|
|
121
244
|
* </Tabs.Root>
|
|
122
245
|
* ```
|
|
123
246
|
*/
|
|
124
|
-
readonly List:
|
|
125
|
-
/**
|
|
126
|
-
* Hide the tablist's border — the bottom border of a horizontal classic
|
|
127
|
-
* tablist, or the side border of a vertical one. Also rendered as a
|
|
128
|
-
* `data-hide-border` attribute on the tablist element. Has no effect on
|
|
129
|
-
* the pill appearance, which never draws a border.
|
|
130
|
-
* @default false
|
|
131
|
-
*/
|
|
132
|
-
hideBorder?: boolean;
|
|
133
|
-
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
247
|
+
readonly List: typeof List$1;
|
|
134
248
|
/**
|
|
135
249
|
* The button that activates its associated content.
|
|
136
250
|
* A clickable tab trigger that switches between different tab content panels.
|
|
@@ -147,7 +261,7 @@ declare const Tabs: {
|
|
|
147
261
|
* </Tabs.Root>
|
|
148
262
|
* ```
|
|
149
263
|
*/
|
|
150
|
-
readonly Trigger:
|
|
264
|
+
readonly Trigger: typeof Trigger$1;
|
|
151
265
|
/**
|
|
152
266
|
* A badge component that can be used inside tab triggers to display additional information.
|
|
153
267
|
* Typically used to show counts or status indicators within tab headers.
|
package/dist/tabs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./compose-refs-
|
|
1
|
+
import{t as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./booleanish-BfvnW6vy.js";import{t as r}from"./clsx-DUGZgXfJ.js";import{t as i}from"./use-prefers-reduced-motion-CagaNRgm.js";import{Children as a,cloneElement as o,createContext as s,isValidElement as c,useContext as l,useEffect as u,useMemo as d,useRef as f}from"react";import p from"tiny-invariant";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";import{cva as _}from"class-variance-authority";import{Content as v,List as y,Root as b,Trigger as x}from"@radix-ui/react-tabs";const S=s({orientation:`horizontal`,appearance:`classic`}),C=({className:e,children:n,orientation:r=`horizontal`,appearance:i=`classic`,...a})=>{let o=d(()=>({orientation:r,appearance:i}),[r,i]);return h(b,{"data-slot":`tabs`,"data-appearance":i,className:t(`flex gap-4`,r===`horizontal`?`flex-col`:`flex-row`,e),orientation:r,...a,children:h(S.Provider,{value:o,children:n})})};C.displayName=`Tabs`;const w=_(`flex`,{variants:{orientation:{horizontal:`scroll-fade-x flex-row items-center overflow-x-auto overscroll-x-none w-full min-w-0 pt-1 -mt-1 px-1 -mx-1`,vertical:`flex-col items-end gap-3.5 self-stretch`},appearance:{classic:``,pill:``},hideBorder:{true:``,false:``}},compoundVariants:[{orientation:`horizontal`,appearance:`pill`,className:`gap-1 pb-1 -mb-1`},{orientation:`horizontal`,appearance:`classic`,className:`gap-6`},{orientation:`horizontal`,appearance:`classic`,hideBorder:!1,className:t(`pb-px bg-origin-content bg-no-repeat bg-size-[100%_1px] bg-position-[0_calc(100%+1px)]`,`bg-[image:linear-gradient(var(--color-separator),var(--color-separator))]`,`[--_fade-bottom-border:black]`)},{orientation:`vertical`,appearance:`classic`,hideBorder:!1,className:`border-r border-separator`}],defaultVariants:{hideBorder:!1}}),T=({className:n,hideBorder:r=!1,ref:a,...o})=>{let{orientation:s,appearance:c}=l(S),d=f(null);return u(()=>{let e=d.current;if(!e||s!==`horizontal`)return;let t=new AbortController;return e.addEventListener(`focusin`,t=>{if(t.target instanceof Element&&t.target!==e){let e=i()?`auto`:`smooth`;t.target.scrollIntoView({behavior:e,inline:`center`,block:`nearest`})}},{signal:t.signal}),()=>{t.abort()}},[s]),h(y,{"aria-orientation":s,"data-slot":`tabs-list`,"data-hide-border":r?``:void 0,className:t(w({orientation:s,appearance:c,hideBorder:r}),n),ref:e(d,a),...o})};T.displayName=`TabsList`;const E=_(`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`}}}),D=()=>{let{orientation:e,appearance:t}=l(S);return h(`span`,{"aria-hidden":!0,className:r(E({orientation:e,appearance:t}))})},O=_(t(`group/tab-trigger relative flex cursor-pointer 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`,`[&>svg]:shrink-0 [&>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:t(`not-aria-disabled:hover:data-state-active:text-strong`,`data-state-active:text-strong`),pill:t(`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`)}}}),k=({"aria-disabled":e,asChild:r=!1,children:i,className:s,disabled:u,ref:d,...f})=>{let{orientation:_,appearance:v}=l(S),y=n(e??u),b={"aria-disabled":e??u,className:t(O({orientation:_,appearance:v}),s),disabled:y,...f};if(r){let e=a.only(i);p(c(e),"When using `asChild`, TabsTrigger must be passed a single child as a JSX tag.");let t=e.props?.children,n=y?{href:void 0,to:void 0}:{tabIndex:0};return h(x,{asChild:!0,"data-slot":`tabs-trigger`,...b,ref:d,children:o(y?h(`button`,{type:`button`}):e,n,g(m,{children:[h(D,{}),t]}))})}return g(x,{"data-slot":`tabs-trigger`,ref:d,...b,children:[h(D,{}),i]})};k.displayName=`TabsTrigger`;const A=({className:e,children:n,...r})=>h(`span`,{"data-slot":`tabs-badge`,className:t(`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`,e),...r,children:n});A.displayName=`TabBadge`;const j=({className:e,...n})=>h(v,{"data-slot":`tabs-content`,className:t(`focus-visible:ring-focus-accent outline-hidden focus-visible:ring-4`,e),...n});j.displayName=`TabsContent`;const M={Root:C,Content:j,List:T,Trigger:k,Badge:A};export{M as Tabs};
|
package/dist/text-area.d.ts
CHANGED
|
@@ -28,6 +28,6 @@ type Props = ComponentProps<"textarea"> & WithValidation & {
|
|
|
28
28
|
* </form>
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
declare const TextArea:
|
|
31
|
+
declare const TextArea: ({ appearance, "aria-invalid": _ariaInvalid, className, onDragEnter, onDragLeave, onDropCapture, ref, validation: _validation, ...props }: Props) => import("react").JSX.Element;
|
|
32
32
|
//#endregion
|
|
33
33
|
export { TextArea };
|
package/dist/text-area.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./compose-refs-
|
|
1
|
+
import{t as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./cx-IiQEAKf5.js";import{a as n,r}from"./validation-Bpptk_9t.js";import{useRef as i,useState as a}from"react";import{jsx as o}from"react/jsx-runtime";const s=({appearance:s,"aria-invalid":c,className:l,onDragEnter:u,onDragLeave:d,onDropCapture:f,ref:p,validation:m,...h})=>{let g=n(),{ariaInvalid:_,validation:v}=r({"aria-invalid":c,validation:m??g}),[y,b]=a(!1),x=i(null);return o(`textarea`,{"aria-invalid":_,"data-validation":v||void 0,"data-slot":`text-area`,className:t(s===`monospaced`&&`pointer-coarse:text-[0.9375rem] font-mono text-[0.8125rem]`,`border-input bg-form data-drag-over:border-dashed data-drag-over:ring-4 pointer-coarse:py-[calc(theme(spacing[2.5])-1px)] pointer-coarse:text-base flex min-h-24 w-full rounded-md border px-3 py-[calc(theme(spacing[2])-1px)] focus-visible:outline-hidden focus-visible:ring-4 disabled:pointer-events-none disabled:opacity-50`,`placeholder:text-placeholder data-drag-over:border-dashed`,`border-form text-strong ring-focus-accent focus:border-accent-600 data-drag-over:border-accent-600`,`data-validation-error:border-danger-600 data-validation-error:ring-focus-danger data-validation-error:focus-visible:border-danger-600 data-validation-error:data-drag-over:border-danger-600`,`data-validation-success:border-success-600 data-validation-success:ring-focus-success data-validation-success:focus-visible:border-success-600 data-validation-success:data-drag-over:border-success-600`,`data-validation-warning:border-warning-600 data-validation-warning:ring-focus-warning data-validation-warning:focus-visible:border-warning-600 data-validation-warning:data-drag-over:border-warning-600`,l),"data-drag-over":y,onDragEnter:e=>{b(!0),u?.(e)},onDragLeave:e=>{b(!1),d?.(e)},onDropCapture:e=>{b(!1),x.current?.focus(),f?.(e)},ref:e(x,p),...h})};export{s as TextArea};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./use-matches-media-query-CMSxHR9n.js";import{n}from"./browser-only-CPH56Xw_.js";import{createContext as r,useContext as i,useEffect as a,useMemo as o,useRef as s,useState as c}from"react";import l from"tiny-invariant";import{jsx as u}from"react/jsx-runtime";const d=[`light`,`dark`,`light-high-contrast`,`dark-high-contrast`],f=[`system`,...d],p=e=>e;function m(e){return typeof e==`string`&&f.includes(e)}const h=e=>e;function g(e){return typeof e==`string`&&d.includes(e)}const _=`(prefers-color-scheme: dark)`,v=`(prefers-contrast: more)`,y=`mantle-ui-theme`,b=`system`,x=r([`system`,()=>null]);function S({children:e}){let[t,r]=c(()=>{let e=N({cookie:n()?document.cookie:null});return w(e),e}),i=s(null);a(()=>{function e(e){let t=e??N({cookie:document.cookie});r(t),w(t)}e();try{`BroadcastChannel`in window&&(i.current=new BroadcastChannel(y),i.current.addEventListener(`message`,t=>{let n=t?.data?.theme;m(n)&&e(n)}))}catch{}function t(t){t.key===`${y}__ping`&&e()}window.addEventListener(`storage`,t);let n=window.matchMedia(_),a=window.matchMedia(v);function o(){e()}function s(){document.visibilityState===`visible`&&e()}return n.addEventListener(`change`,o),a.addEventListener(`change`,o),window.addEventListener(`pageshow`,o),document.addEventListener(`visibilitychange`,s),()=>{window.removeEventListener(`storage`,t),n.removeEventListener(`change`,o),a.removeEventListener(`change`,o),window.removeEventListener(`pageshow`,o),document.removeEventListener(`visibilitychange`,s);try{i.current?.close()}catch{}i.current=null}},[]);let l=o(()=>[t,e=>{L(e),r(e),w(e),F(e,{broadcastChannel:i.current,pingKey:`${y}__ping`})}],[t]);return u(x.Provider,{value:l,children:e})}function C(){let e=i(x);return l(e,`useTheme must be used within a ThemeProvider`),e}function w(e){if(!n())return;let t=window.document.documentElement,r=window.matchMedia(_).matches,i=window.matchMedia(v).matches,a=E(e,{prefersDarkMode:r,prefersHighContrast:i}),o=t.dataset.theme,s=t.dataset.appliedTheme,c=m(o)?o:void 0,l=g(s)?s:void 0;(c!==e||l!==a)&&(t.classList.remove(...d),t.classList.add(a),t.dataset.theme=e,t.dataset.appliedTheme=a)}function T(){if(!n())return{appliedTheme:void 0,theme:void 0};let e=window.document.documentElement,t=m(e.dataset.theme)?e.dataset.theme:void 0;return{appliedTheme:g(e.dataset.appliedTheme)?e.dataset.appliedTheme:void 0,theme:t}}function E(e,{prefersDarkMode:t,prefersHighContrast:n}){return e===`system`?O({prefersDarkMode:t,prefersHighContrast:n}):e}function D(){let e=i(x);return E(e==null?`system`:e[0],{prefersDarkMode:t(_),prefersHighContrast:t(v)})}function O({prefersDarkMode:e,prefersHighContrast:t}){return t?e?`dark-high-contrast`:`light-high-contrast`:e?`dark`:`light`}function k(e){let{storageKey:t,defaultTheme:n,themes:r,resolvedThemes:i,prefersDarkModeMediaQuery:a,prefersHighContrastMediaQuery:o}=e;function s(e){return typeof e==`string`&&r.includes(e)}function c(e){let t=document.cookie;if(!t)return null;try{let n=t.split(`;`).find(t=>t.trim().startsWith(`${e}=`))?.split(`=`)[1];return n?decodeURIComponent(n):null}catch{return null}}function l(e,t){let n=new Date;n.setFullYear(n.getFullYear()+1);let r=window.location.hostname,i=window.location.protocol,a=r===`ngrok.com`||r.endsWith(`.ngrok.com`)?`; domain=.ngrok.com`:``,o=i===`https:`?`; Secure`:``;return`${e}=${encodeURIComponent(t)}; expires=${n.toUTCString()}; path=/${a}; SameSite=Lax${o}`}function u(e,t){try{document.cookie=l(e,t)}catch{}}function d(e,t,n){return e===`system`?n?t?`dark-high-contrast`:`light-high-contrast`:t?`dark`:`light`:e}let f=null,p=null,m=null;try{f=c(t)}catch{}if(s(f))m=f;else{try{p=window.localStorage?.getItem(t)??null}catch{}s(p)&&(m=p)}let h=s(m)?m:n,g=matchMedia(a).matches,_=matchMedia(o).matches,v=d(h,g,_),y=document.documentElement;if(y.dataset.appliedTheme!==v||y.dataset.theme!==h){for(let e of i)y.classList.remove(e);y.classList.add(v),y.dataset.theme=h,y.dataset.appliedTheme=v}let b=s(f);try{if(s(p)&&!b){u(t,p);try{window.localStorage.removeItem(t)}catch{}}else b||u(t,h)}catch{}}function A(){let e={storageKey:y,defaultTheme:b,themes:f,resolvedThemes:d,prefersDarkModeMediaQuery:_,prefersHighContrastMediaQuery:v};return`(${k.toString()})(${JSON.stringify(e)})`}const j=({nonce:e})=>u(`script`,{dangerouslySetInnerHTML:{__html:A()},nonce:e,suppressHydrationWarning:!0});function M(t={}){let{className:r=``,ssrCookie:i}=t??{};return o(()=>{let t,a;if(!n())t=N({cookie:i}),a=E(t,{prefersDarkMode:!1,prefersHighContrast:!1});else{let e=window.matchMedia(_).matches,n=window.matchMedia(v).matches;t=N({cookie:document.cookie}),a=E(t,{prefersDarkMode:e,prefersHighContrast:n})}return{className:e(r,a),"data-applied-theme":a,"data-theme":t}},[r,i])}function N({cookie:e}){if(!e)return b;try{let t=e.split(`;`).find(e=>e.trim().startsWith(`${y}=`))?.split(`=`)[1],n=t?globalThis.decodeURIComponent(t):null;return m(n)?n:b}catch{return b}}function P(e){if(e)return e.split(`;`).map(e=>e.trim()).find(e=>e.startsWith(`${y}=`))}function F(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{}}function I(e){let t=new Date;t.setFullYear(t.getFullYear()+1);let{hostname:n,protocol:r}=window.location,i=n===`ngrok.com`||n.endsWith(`.ngrok.com`)?`; domain=.ngrok.com`:``,a=r===`https:`?`; Secure`:``;return`${y}=${encodeURIComponent(e)}; expires=${t.toUTCString()}; path=/${i}; SameSite=Lax${a}`}function L(e){if(n())try{document.cookie=I(e)}catch{}}export{A as a,M as c,p as d,g as f,f as h,N as i,C as l,d as m,S as n,T as o,m as p,P as r,D as s,j as t,h as u};
|
package/dist/theme-switcher.d.ts
CHANGED
|
@@ -1,18 +1,61 @@
|
|
|
1
1
|
import { t as WithStyleProps } from "./with-style-props-Dq5Vntqy.js";
|
|
2
|
-
import { n as IconButtonAppearance, r as IconButtonProps } from "./icon-button-
|
|
2
|
+
import { n as IconButtonAppearance, r as IconButtonProps } from "./icon-button-C1AfGnQx.js";
|
|
3
3
|
import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
|
|
4
|
-
import { t as DropdownMenu } from "./dropdown-menu-
|
|
5
|
-
import "./index-
|
|
6
|
-
import { ComponentProps
|
|
4
|
+
import { t as DropdownMenu } from "./dropdown-menu-CoyozLzy.js";
|
|
5
|
+
import "./index-CdPXa9h1.js";
|
|
6
|
+
import { ComponentProps } from "react";
|
|
7
7
|
//#region src/components/theme-switcher/theme-switcher.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* The props for the `ThemeDropdownMenuRadioGroup` component.
|
|
10
10
|
*/
|
|
11
11
|
type ThemeDropdownMenuRadioGroupProps = WithStyleProps;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Must render inside a `DropdownMenu.Content` or `DropdownMenu.SubContent` —
|
|
14
|
+
* the type system cannot express this constraint, so it is on you to uphold it.
|
|
15
|
+
*
|
|
16
|
+
* The theme-selection radio group for mantle's theme system. Renders one
|
|
17
|
+
* `role="menuitemradio"` item per mantle theme via `DropdownMenu.RadioGroup`;
|
|
18
|
+
* the active theme is `aria-checked` and choosing an item persists the new
|
|
19
|
+
* theme through `useTheme`, so a `ThemeProvider` ancestor is required
|
|
20
|
+
* (`useTheme` throws outside of one). Use it to embed theme selection in an
|
|
21
|
+
* existing menu (e.g. an account menu submenu); for a standalone picker,
|
|
22
|
+
* reach for `ThemeSwitcher` instead.
|
|
23
|
+
*
|
|
24
|
+
* @see https://mantle.ngrok.com/components/forms/theme-switcher
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* Standalone inside a `DropdownMenu.Content`:
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <DropdownMenu.Root>
|
|
30
|
+
* <DropdownMenu.Trigger asChild>
|
|
31
|
+
* <Button type="button" appearance="outlined" intent="neutral">Theme</Button>
|
|
32
|
+
* </DropdownMenu.Trigger>
|
|
33
|
+
* <DropdownMenu.Content>
|
|
34
|
+
* <ThemeDropdownMenuRadioGroup />
|
|
35
|
+
* </DropdownMenu.Content>
|
|
36
|
+
* </DropdownMenu.Root>
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* Embedded in a submenu of an existing menu (e.g. an account menu):
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <DropdownMenu.Root>
|
|
43
|
+
* <DropdownMenu.Trigger asChild>
|
|
44
|
+
* <Button type="button" appearance="outlined" intent="neutral">Account</Button>
|
|
45
|
+
* </DropdownMenu.Trigger>
|
|
46
|
+
* <DropdownMenu.Content>
|
|
47
|
+
* <DropdownMenu.Item>Profile</DropdownMenu.Item>
|
|
48
|
+
* <DropdownMenu.Sub>
|
|
49
|
+
* <DropdownMenu.SubTrigger>Theme</DropdownMenu.SubTrigger>
|
|
50
|
+
* <DropdownMenu.SubContent>
|
|
51
|
+
* <ThemeDropdownMenuRadioGroup />
|
|
52
|
+
* </DropdownMenu.SubContent>
|
|
53
|
+
* </DropdownMenu.Sub>
|
|
54
|
+
* </DropdownMenu.Content>
|
|
55
|
+
* </DropdownMenu.Root>
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
declare const ThemeDropdownMenuRadioGroup: ({ className, style }: ThemeDropdownMenuRadioGroupProps) => import("react").JSX.Element;
|
|
16
59
|
/**
|
|
17
60
|
* The props for the `ThemeSwitcher.Root` component. Identical to
|
|
18
61
|
* `DropdownMenu.Root`'s props — `Root` forwards everything through.
|
|
@@ -63,13 +106,69 @@ type ThemeSwitcherTriggerProps = Omit<IconButtonProps, "appearance" | "asChild"
|
|
|
63
106
|
*/
|
|
64
107
|
label?: string;
|
|
65
108
|
};
|
|
109
|
+
/**
|
|
110
|
+
* The button that opens the theme menu: an `IconButton` (ghost by default)
|
|
111
|
+
* wired up as the menu trigger. The trigger icon is SSR-safe: the applied
|
|
112
|
+
* theme is unknowable server-side, so a `Skeleton` renders until hydration,
|
|
113
|
+
* then the icon matching the applied theme. The icon is owned by the trigger;
|
|
114
|
+
* to render a completely custom trigger, compose `DropdownMenu` +
|
|
115
|
+
* `ThemeDropdownMenuRadioGroup` directly instead.
|
|
116
|
+
*
|
|
117
|
+
* @see https://mantle.ngrok.com/components/forms/theme-switcher
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```tsx
|
|
121
|
+
* <ThemeSwitcher.Root>
|
|
122
|
+
* <ThemeSwitcher.Trigger appearance="outlined" label="Choose a theme" />
|
|
123
|
+
* <ThemeSwitcher.Content />
|
|
124
|
+
* </ThemeSwitcher.Root>
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
declare const Trigger: {
|
|
128
|
+
({ appearance, "data-slot": dataSlot, disabled, label, ref, ...props }: ThemeSwitcherTriggerProps): import("react").JSX.Element;
|
|
129
|
+
displayName: string;
|
|
130
|
+
};
|
|
66
131
|
/**
|
|
67
132
|
* The props for the `ThemeSwitcher.Content` component. Identical to
|
|
68
133
|
* `DropdownMenu.Content`'s props — positioning and collision behavior
|
|
69
134
|
* (`align`, `side`, `collisionPadding`, …) plus `className`/`style` all
|
|
70
135
|
* forward through.
|
|
71
136
|
*/
|
|
72
|
-
type ThemeSwitcherContentProps =
|
|
137
|
+
type ThemeSwitcherContentProps = ComponentProps<typeof DropdownMenu.Content> & WithDataSlot;
|
|
138
|
+
/**
|
|
139
|
+
* The popover the trigger opens: a thin forwarding wrapper over
|
|
140
|
+
* `DropdownMenu.Content`. When `children` are omitted (or `null`/`undefined`)
|
|
141
|
+
* it renders `ThemeDropdownMenuRadioGroup`, the five-theme radio group — pass
|
|
142
|
+
* `children` to own the menu contents instead (compose
|
|
143
|
+
* `ThemeDropdownMenuRadioGroup` yourself alongside extra items). Any
|
|
144
|
+
* non-nullish children replace the default entirely, including render-nothing
|
|
145
|
+
* values like `false` — a lone `{condition && <Item />}` child suppresses the
|
|
146
|
+
* radio group when the condition is false.
|
|
147
|
+
*
|
|
148
|
+
* @see https://mantle.ngrok.com/components/forms/theme-switcher
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```tsx
|
|
152
|
+
* <ThemeSwitcher.Root>
|
|
153
|
+
* <ThemeSwitcher.Trigger />
|
|
154
|
+
* <ThemeSwitcher.Content align="end" collisionPadding={{ right: 16 }} />
|
|
155
|
+
* </ThemeSwitcher.Root>
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* Extending the menu beyond theme selection:
|
|
160
|
+
* ```tsx
|
|
161
|
+
* <ThemeSwitcher.Content>
|
|
162
|
+
* <ThemeDropdownMenuRadioGroup />
|
|
163
|
+
* <DropdownMenu.Separator />
|
|
164
|
+
* <DropdownMenu.Item>Appearance settings…</DropdownMenu.Item>
|
|
165
|
+
* </ThemeSwitcher.Content>
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
declare const Content: {
|
|
169
|
+
({ children, "data-slot": dataSlot, ...props }: ThemeSwitcherContentProps): import("react").JSX.Element;
|
|
170
|
+
displayName: string;
|
|
171
|
+
};
|
|
73
172
|
/**
|
|
74
173
|
* The canonical picker for mantle's theme system: a compact `IconButton`
|
|
75
174
|
* trigger (ghost by default) that opens a `DropdownMenu` hosting
|
|
@@ -134,23 +233,7 @@ declare const ThemeSwitcher: {
|
|
|
134
233
|
* </ThemeSwitcher.Root>
|
|
135
234
|
* ```
|
|
136
235
|
*/
|
|
137
|
-
readonly Trigger:
|
|
138
|
-
/**
|
|
139
|
-
* The visual style of the trigger `IconButton`. Optional here —
|
|
140
|
-
* `ThemeSwitcher.Trigger` defaults to `"ghost"` so the trigger sits
|
|
141
|
-
* quietly in headers and toolbars.
|
|
142
|
-
*
|
|
143
|
-
* @default "ghost"
|
|
144
|
-
*/
|
|
145
|
-
appearance?: IconButtonAppearance;
|
|
146
|
-
/**
|
|
147
|
-
* The accessible name for the trigger `IconButton`. Visually hidden but
|
|
148
|
-
* announced to screen readers. Override it for localization.
|
|
149
|
-
*
|
|
150
|
-
* @default "Change Theme"
|
|
151
|
-
*/
|
|
152
|
-
label?: string;
|
|
153
|
-
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
236
|
+
readonly Trigger: typeof Trigger;
|
|
154
237
|
/**
|
|
155
238
|
* The popover the trigger opens: forwards `DropdownMenu.Content` props
|
|
156
239
|
* (`align`, `side`, `collisionPadding`, `className`, …) and renders the
|
|
@@ -166,9 +249,7 @@ declare const ThemeSwitcher: {
|
|
|
166
249
|
* </ThemeSwitcher.Root>
|
|
167
250
|
* ```
|
|
168
251
|
*/
|
|
169
|
-
readonly Content:
|
|
170
|
-
width?: "trigger" | "content";
|
|
171
|
-
} & import("react").RefAttributes<HTMLDivElement>, "ref"> & WithDataSlot & import("react").RefAttributes<HTMLDivElement>>;
|
|
252
|
+
readonly Content: typeof Content;
|
|
172
253
|
};
|
|
173
254
|
//#endregion
|
|
174
255
|
export { ThemeDropdownMenuRadioGroup, type ThemeDropdownMenuRadioGroupProps, ThemeSwitcher, type ThemeSwitcherContentProps, type ThemeSwitcherRootProps, type ThemeSwitcherTriggerProps };
|
package/dist/theme-switcher.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./icon-
|
|
1
|
+
import{t as e}from"./icon-CGgMKpJg.js";import{n as t}from"./slot-CDk0Bb9z.js";import{t as n}from"./icon-button-DiOhreJD.js";import{t as r}from"./browser-only-CPH56Xw_.js";import{d as i,h as a,l as o,p as s}from"./theme-provider-BftkIiZn.js";import{t as c}from"./dropdown-menu-CSCDdA3K.js";import{n as l,t as u}from"./theme-wVnzzx2F.js";import{t as d}from"./skeleton-CsbUHbBA.js";import{jsx as f,jsxs as p}from"react/jsx-runtime";const m={system:`System Preference`,light:`Light Mode`,dark:`Dark Mode`,"light-high-contrast":`Light High Contrast`,"dark-high-contrast":`Dark High Contrast`},h=({className:t,style:n})=>{let[r,u]=o();return f(c.RadioGroup,{"data-slot":`theme-dropdown-menu-radio-group`,className:t,style:n,value:r,onValueChange:e=>{s(e)&&u(e)},children:a.map(t=>p(c.RadioItem,{value:i(t),children:[f(e,{svg:f(l,{theme:t})}),m[t]]},t))})},g=e=>f(c.Root,{...e});g.displayName=`ThemeSwitcher`;const _=({appearance:e=`ghost`,"data-slot":i,disabled:a,label:o=`Change Theme`,ref:s,...l})=>f(c.Trigger,{asChild:!0,disabled:a,children:f(n,{ref:s,appearance:e,disabled:a,"data-slot":t(i,`theme-switcher-trigger`),intent:`neutral`,icon:f(r,{fallback:f(d,{className:`rounded-full size-5`}),children:()=>f(u,{className:`size-5`})}),label:o,...l})});_.displayName=`ThemeSwitcherTrigger`;const v=({children:e,"data-slot":n,...r})=>f(c.Content,{"data-slot":t(n,`theme-switcher-content`),...r,children:e??f(h,{})});v.displayName=`ThemeSwitcherContent`;const y={Root:g,Trigger:_,Content:v};export{h as ThemeDropdownMenuRadioGroup,y as ThemeSwitcher};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e}from"./theme-provider-BftkIiZn.js";import{jsx as t}from"react/jsx-runtime";import{DesktopIcon as n}from"@phosphor-icons/react/Desktop";import{MoonIcon as r}from"@phosphor-icons/react/Moon";import{SunIcon as i}from"@phosphor-icons/react/Sun";function a(n){return t(o,{theme:e(),...n})}function o({theme:e,...a}){switch(e){case`system`:return t(n,{...a});case`light`:return t(i,{...a});case`dark`:return t(r,{...a});case`light-high-contrast`:return t(i,{...a,weight:`fill`});case`dark-high-contrast`:return t(r,{...a,weight:`fill`})}}export{o as n,a as t};
|
package/dist/theme.d.ts
CHANGED
|
@@ -155,9 +155,6 @@ declare function fixMediaScriptContent(forceTheme?: ResolvedTheme): string;
|
|
|
155
155
|
* ```
|
|
156
156
|
*/
|
|
157
157
|
declare function MantleStyleSheets({ darkCssUrl, lightHighContrastCssUrl, darkHighContrastCssUrl, forceTheme, nonce, ssrCookie }: MantleStyleSheetsProps): import("react").JSX.Element;
|
|
158
|
-
declare namespace MantleStyleSheets {
|
|
159
|
-
var displayName: string;
|
|
160
|
-
}
|
|
161
158
|
//#endregion
|
|
162
159
|
//#region src/components/theme/theme-provider.d.ts
|
|
163
160
|
/**
|
|
@@ -178,9 +175,6 @@ type ThemeProviderProps = PropsWithChildren;
|
|
|
178
175
|
* ```
|
|
179
176
|
*/
|
|
180
177
|
declare function ThemeProvider({ children }: ThemeProviderProps): import("react").JSX.Element;
|
|
181
|
-
declare namespace ThemeProvider {
|
|
182
|
-
var displayName: string;
|
|
183
|
-
}
|
|
184
178
|
/**
|
|
185
179
|
* useTheme returns the current theme and a function to set the theme.
|
|
186
180
|
*
|
|
@@ -215,10 +209,39 @@ type PreventWrongThemeFlashScriptProps = {
|
|
|
215
209
|
*/
|
|
216
210
|
nonce?: string;
|
|
217
211
|
};
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
212
|
+
/**
|
|
213
|
+
* Renders an inline script that prevents Flash of Unstyled Content (FOUC) or the
|
|
214
|
+
* wrong theme flashing on first paint.
|
|
215
|
+
*
|
|
216
|
+
* This is the preferred building block for SSR apps. Pair it with
|
|
217
|
+
* {@link preloadFontLink} HTTP `Link` headers in your server entry so font fetches
|
|
218
|
+
* begin before HTML is parsed. For client-only apps without header control, pair
|
|
219
|
+
* it with {@link PreloadFont} elements in `<head>` instead.
|
|
220
|
+
*
|
|
221
|
+
* Place this as early as possible in the `<head>`.
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```tsx
|
|
225
|
+
* // entry.server.tsx — send font preloads as HTTP headers (preferred for SSR)
|
|
226
|
+
* headers.set("Link", [
|
|
227
|
+
* `<${assetsCdnOrigin}>; rel=preconnect; crossorigin`,
|
|
228
|
+
* preloadFontLink("roobert"),
|
|
229
|
+
* preloadFontLink("jetbrains-mono"),
|
|
230
|
+
* ].join(", "));
|
|
231
|
+
*
|
|
232
|
+
* // root.tsx — only the FOUC script in <head>
|
|
233
|
+
* <head>
|
|
234
|
+
* <PreventWrongThemeFlashScript nonce={nonce} />
|
|
235
|
+
* </head>
|
|
236
|
+
* ```
|
|
237
|
+
*
|
|
238
|
+
* @param nonce - Optional CSP nonce to allowlist the inline script under a strict CSP.
|
|
239
|
+
* @returns {JSX.Element} A script tag injected before first paint.
|
|
240
|
+
* @see preloadFontLink
|
|
241
|
+
* @see PreloadFont
|
|
242
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce
|
|
243
|
+
*/
|
|
244
|
+
declare const PreventWrongThemeFlashScript: ({ nonce }: PreventWrongThemeFlashScriptProps) => import("react").JSX.Element;
|
|
222
245
|
type InitialThemeProps = {
|
|
223
246
|
className: string;
|
|
224
247
|
"data-applied-theme": ResolvedTheme;
|
|
@@ -349,9 +372,25 @@ type PreloadFontProps = {
|
|
|
349
372
|
* ```
|
|
350
373
|
*/
|
|
351
374
|
declare function preloadFontLink(name: CoreFontName): string;
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
375
|
+
/**
|
|
376
|
+
* Preloads a single core font by name.
|
|
377
|
+
*
|
|
378
|
+
* Use this when you only need one or two specific fonts rather than all core
|
|
379
|
+
* fonts. Include it as early as possible in the document `<head>`.
|
|
380
|
+
*
|
|
381
|
+
* @remarks
|
|
382
|
+
* For best performance, pair this with preconnect/dns-prefetch hints to the CDN.
|
|
383
|
+
*
|
|
384
|
+
* @example
|
|
385
|
+
* ```tsx
|
|
386
|
+
* <head>
|
|
387
|
+
* <link rel="preconnect" href={assetsCdnOrigin} crossOrigin="anonymous" />
|
|
388
|
+
* <link rel="dns-prefetch" href={assetsCdnOrigin} />
|
|
389
|
+
* <PreloadFont name="roobert" />
|
|
390
|
+
* <PreloadFont name="jetbrains-mono" />
|
|
391
|
+
* </head>
|
|
392
|
+
* ```
|
|
393
|
+
*/
|
|
394
|
+
declare const PreloadFont: ({ name }: PreloadFontProps) => import("react").JSX.Element;
|
|
356
395
|
//#endregion
|
|
357
396
|
export { $resolvedTheme, $theme, type CoreFontName, MantleStyleSheets, type MantleStyleSheetsProps, type MantleThemeCssUrls, PreloadFont, PreventWrongThemeFlashScript, type ResolvedTheme, type Theme, ThemeProvider, assetsCdnOrigin, extractThemeCookie, fixMediaScriptContent, fontHref, getStoredTheme, isResolvedTheme, isTheme, mantleStyleSheetUrls, preloadFontLink, preventWrongThemeFlashScriptContent, readThemeFromHtmlElement, resolvedThemes, themes, useAppliedTheme, useInitialHtmlThemeProps, useTheme };
|
package/dist/theme.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,d as n,f as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./theme-provider-
|
|
1
|
+
import{a as e,c as t,d as n,f as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./theme-provider-BftkIiZn.js";import{useEffect as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";const y=`mantle-dark-styles`,b=`mantle-light-high-contrast-styles`,x=`mantle-dark-high-contrast-styles`,S=`(prefers-color-scheme: dark)`,C=`(prefers-contrast: more) and (prefers-color-scheme: light)`,w=`(prefers-contrast: more) and (prefers-color-scheme: dark)`;function T(e,t){let n=t??e;return{dark:n===`dark`?`all`:S,lightHighContrast:n===`light-high-contrast`?`all`:C,darkHighContrast:n===`dark-high-contrast`?`all`:w}}function E(e){return e}function D(e){let{darkLinkId:t,lightHcLinkId:n,darkHcLinkId:r,mediaDark:i,mediaLightHc:a,mediaDarkHc:o,forceTheme:s}=e,c=document.documentElement.dataset.appliedTheme,l=s??c,u=document.getElementById(t),d=document.getElementById(n),f=document.getElementById(r);u&&(u.media=l===`dark`?`all`:i),d&&(d.media=l===`light-high-contrast`?`all`:a),f&&(f.media=l===`dark-high-contrast`?`all`:o)}function O(e){let t={darkLinkId:y,lightHcLinkId:b,darkHcLinkId:x,mediaDark:S,mediaLightHc:C,mediaDarkHc:w,forceTheme:e};return`(${D.toString()})(${JSON.stringify(t)})`}function k({darkCssUrl:e,lightHighContrastCssUrl:t,darkHighContrastCssUrl:n,forceTheme:i,nonce:o,ssrCookie:s}){h(()=>{function e(){let e=document.documentElement.dataset.appliedTheme;return r(e)?e:void 0}function t(){let{dark:t,lightHighContrast:n,darkHighContrast:r}=T(e(),i),a=document.getElementById(y),o=document.getElementById(b),s=document.getElementById(x);a&&(a.media=t),o&&(o.media=n),s&&(s.media=r)}t();let n=new MutationObserver(t);return n.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-applied-theme`]}),()=>{n.disconnect()}},[i]);let c=s==null?void 0:a({cookie:s}),l=c===`system`?void 0:c,{dark:u,lightHighContrast:d,darkHighContrast:f}=T(l,i);return v(g,{children:[(!i||i===`dark`)&&_(`link`,{rel:`stylesheet`,id:y,href:e,media:u,suppressHydrationWarning:!0}),(!i||i===`light-high-contrast`)&&_(`link`,{rel:`stylesheet`,id:b,href:t,media:d,suppressHydrationWarning:!0}),(!i||i===`dark-high-contrast`)&&_(`link`,{rel:`stylesheet`,id:x,href:n,media:f,suppressHydrationWarning:!0}),!i&&l==null&&_(`script`,{dangerouslySetInnerHTML:{__html:O(i)},nonce:o,suppressHydrationWarning:!0})]})}const A=`https://assets.ngrok.com`,j=`${A}/fonts`,M={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 N(e){let t=e.startsWith(`/`)?e:`/${e}`;return`${j}${t}`}function P(e){return`<${N(M[e])}>; rel=preload; as=font; type="font/woff2"; crossorigin`}const F=({name:e})=>_(`link`,{rel:`preload`,href:N(M[e]),as:`font`,type:`font/woff2`,crossOrigin:`anonymous`});export{m as $resolvedTheme,n as $theme,k as MantleStyleSheets,F as PreloadFont,p as PreventWrongThemeFlashScript,c as ThemeProvider,A as assetsCdnOrigin,d as extractThemeCookie,O as fixMediaScriptContent,N as fontHref,a as getStoredTheme,r as isResolvedTheme,u as isTheme,E as mantleStyleSheetUrls,P as preloadFontLink,e as preventWrongThemeFlashScriptContent,l as readThemeFromHtmlElement,s as resolvedThemes,i as themes,f as useAppliedTheme,t as useInitialHtmlThemeProps,o as useTheme};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-CGgMKpJg.js";import{t as n}from"./slot-CDk0Bb9z.js";import{s as r}from"./theme-provider-BftkIiZn.js";import{createContext as i,useContext as a,useMemo as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{CheckCircleIcon as l}from"@phosphor-icons/react/CheckCircle";import{InfoIcon as u}from"@phosphor-icons/react/Info";import{WarningIcon as d}from"@phosphor-icons/react/Warning";import{WarningDiamondIcon as f}from"@phosphor-icons/react/WarningDiamond";import*as p from"sonner";const m=({className:t,containerAriaLabel:n,dir:i,duration_ms:a=4e3,position:o=`top-center`,style:c})=>{let l=r();return s(p.Toaster,{"data-slot":`toaster`,className:e(`toaster overlay-prompt pointer-events-auto *:duration-200`,t),containerAriaLabel:n,dir:i,duration:a,gap:12,position:o??`top-center`,style:c,theme:l,toastOptions:{unstyled:!0}})},h=i(``);function g(e,t){let n=t?.duration_ms;return typeof n==`number`&&n<=0&&(n=1/0),p.toast.custom(t=>s(h.Provider,{value:t,children:e}),{duration:n,...t?.id?{id:t.id}:{},unstyled:!0})}const _=i({intent:`info`}),v=({asChild:t,children:r,className:i,intent:a,ref:l,...u})=>{let d=t?n:`div`,f=o(()=>({intent:a}),[a]);return s(_.Provider,{value:f,children:c(d,{"data-slot":`toast`,className:e(`relative flex items-start gap-2 text-sm font-sans`,`p-3 pl-3.75`,`bg-popover high-contrast:border-popover rounded rounded-r-[0.3125rem] border border-gray-500/35 shadow-lg`,i),ref:l,...u,children:[s(T,{intent:a}),r]})})};v.displayName=`Toast`;const y=({className:n,svg:r,ref:i,...o})=>{let c=a(_);switch(c.intent){case`danger`:return s(t,{"data-slot":`toast-icon`,className:e(`text-danger-600`,n),ref:i,svg:r??s(d,{weight:`fill`}),...o});case`warning`:return s(t,{"data-slot":`toast-icon`,className:e(`text-warning-600`,n),ref:i,svg:r??s(f,{weight:`fill`}),...o});case`success`:return s(t,{"data-slot":`toast-icon`,className:e(`text-success-600`,n),ref:i,svg:r??s(l,{weight:`fill`}),...o});case`info`:return s(t,{"data-slot":`toast-icon`,className:e(`text-accent-600`,n),ref:i,svg:s(u,{weight:`fill`}),...o});default:throw Error(`Unreachable Case: ${c.intent}`)}};y.displayName=`ToastIcon`;const b=({asChild:t,className:r,onClick:i,ref:o,...c})=>{let l=a(h);return s(t?n:`button`,{"data-slot":`toast-action`,className:e(`shrink-0`,`data-icon-button:-mr-0.5 data-icon-button:-mt-0.5 data-icon-button:rounded-xs`,r),onClick:e=>{i?.(e),!e.defaultPrevented&&p.toast.dismiss(l)},ref:o,...c})};b.displayName=`ToastAction`;const x=({asChild:t,className:r,ref:i,...a})=>s(t?n:`p`,{"data-slot":`toast-message`,className:e(`text-strong flex-1 text-sm font-body`,r),ref:i,...a});x.displayName=`ToastMessage`;const S={Root:v,Action:b,Icon:y,Message:x};function C(e){e.target instanceof Element&&e.target.closest(`.overlay-prompt`)&&e.preventDefault()}const w={info:`bg-accent-600`,warning:`bg-warning-600`,success:`bg-success-600`,danger:`bg-danger-600`};function T({className:t,intent:n,...r}){return s(`div`,{"aria-hidden":!0,className:e(`z-1 absolute -inset-px right-auto w-1.5 rounded-l`,w[n],t),...r})}export{C as i,m as n,g as r,S as t};
|