@ngrok/mantle 0.77.0 → 0.79.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 +63 -21
- package/dist/accordion.js +1 -1
- package/dist/agent.json +4 -1
- package/dist/alert-dialog.d.ts +102 -70
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +39 -39
- package/dist/alert.js +1 -1
- package/dist/{anchor-BtgEJoPN.js → anchor-C_tjSVy6.js} +1 -1
- package/dist/anchor.d.ts +3 -4
- package/dist/anchor.js +1 -1
- package/dist/{as-child-uN_018tj.d.ts → as-child-CYEVu1WY.d.ts} +0 -7
- package/dist/badge.d.ts +5 -56
- package/dist/badge.js +1 -1
- package/dist/breadcrumb.d.ts +212 -0
- package/dist/breadcrumb.js +1 -0
- package/dist/browser-only.d.ts +2 -6
- package/dist/{button-CERx95KE.js → button-5t6-JS_I.js} +1 -1
- package/dist/button-ClC60Nzg.js +1 -0
- package/dist/button-DcXOWUYo.d.ts +131 -0
- package/dist/button.d.ts +6 -4
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +2 -8
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +8 -8
- package/dist/card.js +1 -1
- package/dist/centered-layout.d.ts +147 -0
- package/dist/centered-layout.js +1 -0
- package/dist/checkbox-DJ2xl7Rc.js +1 -0
- package/dist/checkbox.d.ts +9 -11
- package/dist/checkbox.js +1 -1
- package/dist/{choice-D6S38dPs.js → choice-DOdyNzFC.js} +1 -1
- package/dist/choice.d.ts +16 -14
- package/dist/choice.js +1 -1
- package/dist/code-block.d.ts +5 -17
- package/dist/code-block.js +1 -1
- package/dist/code-block_highlight-utils.d.ts +1 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/code.d.ts +4 -5
- package/dist/code.js +1 -1
- package/dist/combobox.d.ts +40 -19
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +71 -49
- package/dist/command.js +1 -1
- package/dist/cx-IiQEAKf5.js +1 -0
- package/dist/cx.js +1 -1
- package/dist/data-slot-CChfb_cv.d.ts +17 -0
- package/dist/data-table.d.ts +77 -137
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +7 -7
- package/dist/description-list.js +1 -1
- package/dist/{dialog-uyJcNks7.js → dialog-ZCgG41hx.js} +1 -1
- package/dist/dialog.d.ts +213 -88
- package/dist/dialog.js +1 -1
- package/dist/{direction-CcTY0FmA.d.ts → direction-BjU0bPST.d.ts} +1 -1
- package/dist/{dropdown-menu-OEuW4GLp.js → dropdown-menu-ByUQkAvJ.js} +1 -1
- package/dist/{dropdown-menu-CADgs9gz.d.ts → dropdown-menu-DMNw8ItM.d.ts} +26 -27
- package/dist/dropdown-menu.d.ts +2 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +139 -59
- package/dist/empty.js +1 -1
- package/dist/{field-context-4k1kI7Bo.js → field-context-BR01g789.js} +1 -1
- package/dist/field.d.ts +41 -36
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +2 -9
- package/dist/flag.js +1 -1
- package/dist/hooks.d.ts +13 -15
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +42 -20
- package/dist/hover-card.js +1 -1
- package/dist/icon-CDtYjF_H.js +1 -0
- package/dist/{icon-n49kOh4_.d.ts → icon-Cevjo93X.d.ts} +2 -3
- package/dist/{icon-button-D7hs6bX2.d.ts → icon-button-B7uEj1qq.d.ts} +73 -11
- package/dist/icon-button-DV2-GZHf.js +1 -0
- package/dist/icon.d.ts +3 -3
- package/dist/icon.js +1 -1
- package/dist/icons.d.ts +7 -19
- package/dist/icons.js +1 -1
- package/dist/{in-view-bItE1fkG.d.ts → in-view-nkSOdED2.d.ts} +1 -6
- package/dist/{index-CTU6apE6.d.ts → index-BivvYYs-.d.ts} +8 -7
- package/dist/{index-Bed_XLWa.d.ts → index-D47aqlpz.d.ts} +3 -2
- package/dist/index-DZRbVkZa.d.ts +1 -0
- package/dist/index-Rv8RL7xy.d.ts +25 -0
- package/dist/{input-B3TS9yAP.js → input-Ct1YOqSy.js} +1 -1
- package/dist/input.d.ts +10 -11
- package/dist/input.js +1 -1
- package/dist/intents-DdSKSj1c.d.ts +28 -0
- package/dist/{kbd-D6k4Dnrf.js → kbd-K8iaZ-Ti.js} +1 -1
- package/dist/kbd.d.ts +3 -8
- package/dist/kbd.js +1 -1
- package/dist/{label-BLXfnQmn.js → label-BMlHW_2D.js} +1 -1
- package/dist/{label-PY0qM0G5.d.ts → label-v2-bv98k.d.ts} +1 -1
- package/dist/label.d.ts +1 -1
- package/dist/label.js +1 -1
- package/dist/list.d.ts +18 -60
- package/dist/list.js +1 -1
- package/dist/llms.txt +4 -1
- package/dist/main.d.ts +4 -27
- package/dist/main.js +1 -1
- package/dist/mantle.css +6 -6
- package/dist/media-object.d.ts +6 -7
- package/dist/media-object.js +1 -1
- package/dist/multi-select.d.ts +80 -33
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +7 -8
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +11 -22
- package/dist/pagination.js +1 -1
- package/dist/{popover-Bq52EC7X.js → popover-D5WxxnBY.js} +1 -1
- package/dist/popover.d.ts +17 -18
- package/dist/popover.js +1 -1
- package/dist/{primitive-FoWela9a.d.ts → primitive-C64-m48O.d.ts} +0 -1
- package/dist/{primitive-BuVqb6zf.js → primitive-M-kZdNIS.js} +1 -1
- package/dist/progress.d.ts +55 -46
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +10 -9
- package/dist/qr-code.js +1 -1
- package/dist/radio-group.d.ts +71 -60
- package/dist/radio-group.js +1 -1
- package/dist/{resolve-pre-rendered-props-DxJ9-DAl.d.ts → resolve-pre-rendered-props-B6OlZrSI.d.ts} +13 -26
- package/dist/{resolve-pre-rendered-props-DwIF_M_K.js → resolve-pre-rendered-props-C3e5Auo3.js} +1 -1
- package/dist/sandboxed-on-click.d.ts +4 -8
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/{select-BUGOJMER.d.ts → select-Bwt2YduR.d.ts} +11 -12
- package/dist/{select-Bxq_N-_o.js → select-D-5u0Blc.js} +1 -1
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +160 -146
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-CqohKk4z.js → separator-kBnnv3Cw.js} +1 -1
- package/dist/separator.d.ts +6 -37
- package/dist/separator.js +1 -1
- package/dist/sheet.d.ts +302 -89
- package/dist/sheet.js +1 -1
- package/dist/sizes-BCoI4bhP.d.ts +29 -0
- package/dist/skeleton-Bu3tgNcW.js +1 -0
- package/dist/skeleton.d.ts +2 -2
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.d.ts +4 -34
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slider.d.ts +2 -21
- package/dist/slider.js +1 -1
- package/dist/slot-DmPrjM7N.js +1 -0
- package/dist/slot.d.ts +1 -1
- package/dist/slot.js +1 -1
- package/dist/split-button.d.ts +21 -13
- package/dist/split-button.js +1 -1
- package/dist/{svg-only-f6ToFLH0.d.ts → svg-only-BFeFS1aa.d.ts} +2 -3
- package/dist/{svg-only-CSOaF1tL.js → svg-only-DDx6FtJd.js} +1 -1
- package/dist/switch.d.ts +4 -5
- package/dist/switch.js +1 -1
- package/dist/{table-CAitdL78.js → table-CPH2md2-.js} +1 -1
- package/dist/{table-BWD9IlIN.d.ts → table-CwFHXC-G.d.ts} +10 -10
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +29 -15
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +2 -3
- package/dist/text-area.js +1 -1
- package/dist/theme-D8kZCOzM.js +1 -0
- package/dist/theme-provider-Djj_jBo6.js +1 -0
- package/dist/theme-switcher.d.ts +53 -0
- package/dist/theme-switcher.js +1 -0
- package/dist/theme.d.ts +15 -101
- package/dist/theme.js +1 -1
- package/dist/toast-D3ntBmn4.js +1 -0
- package/dist/toast.d.ts +32 -50
- package/dist/toast.js +1 -1
- package/dist/tooltip.d.ts +16 -50
- package/dist/tooltip.js +1 -1
- package/dist/{types-CTam1uIW.d.ts → types-C19IR7jf.d.ts} +1 -0
- package/dist/{types-BvUzforF.d.ts → types-D1RY5Tcj.d.ts} +0 -1
- package/dist/types.d.ts +3 -3
- package/dist/use-prefers-reduced-motion-CagaNRgm.js +1 -0
- package/dist/utils.d.ts +2 -3
- package/dist/{validation-xyX_6kph.d.ts → validation-7QeiTFwl.d.ts} +3 -12
- package/dist/{validation-DCyx-ceH.js → validation-Bpptk_9t.js} +1 -1
- package/dist/{virtual-PBNiHjMK.js → virtual-DZMBu7Ch.js} +1 -1
- package/dist/well.d.ts +3 -3
- package/dist/well.js +1 -1
- package/dist/{with-style-props-CyImx7vd.d.ts → with-style-props-Dq5Vntqy.d.ts} +0 -1
- package/package.json +17 -14
- package/dist/button-C9GW9nAr.js +0 -1
- package/dist/button-mfYak6Rx.d.ts +0 -71
- package/dist/checkbox-Apow0ipK.js +0 -1
- package/dist/cx-C1UYP5We.js +0 -1
- package/dist/icon-SUx16Sl3.js +0 -1
- package/dist/icon-button-DiX9iZ9n.js +0 -1
- package/dist/index-CJbKEKr2.d.ts +0 -20
- package/dist/slot-DT_E5BQx.js +0 -1
- package/dist/theme-provider-C5XYi2-H.js +0 -1
- package/dist/toast-CZBWjXcP.js +0 -1
- package/dist/use-prefers-reduced-motion-DBqNw1wB.js +0 -1
|
@@ -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})}S.displayName=`ThemeProvider`;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});j.displayName=`PreventWrongThemeFlashScript`;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};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { t as WithStyleProps } from "./with-style-props-Dq5Vntqy.js";
|
|
2
|
+
import { n as IconButtonAppearance } from "./icon-button-B7uEj1qq.js";
|
|
3
|
+
import { t as DropdownMenu } from "./dropdown-menu-DMNw8ItM.js";
|
|
4
|
+
import "./index-DZRbVkZa.js";
|
|
5
|
+
import { ComponentProps } from "react";
|
|
6
|
+
//#region src/components/theme-switcher/theme-switcher.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* The props for the `ThemeDropdownMenuRadioGroup` component.
|
|
9
|
+
*/
|
|
10
|
+
type ThemeDropdownMenuRadioGroupProps = WithStyleProps;
|
|
11
|
+
declare function ThemeDropdownMenuRadioGroup({ className, style }: ThemeDropdownMenuRadioGroupProps): import("react").JSX.Element;
|
|
12
|
+
declare namespace ThemeDropdownMenuRadioGroup {
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The props for the `ThemeSwitcher` component.
|
|
17
|
+
*/
|
|
18
|
+
type ThemeSwitcherProps = WithStyleProps & {
|
|
19
|
+
/**
|
|
20
|
+
* The visual style of the trigger `IconButton`. Optional here —
|
|
21
|
+
* `ThemeSwitcher` defaults to `"ghost"` so the trigger sits quietly in
|
|
22
|
+
* headers and toolbars.
|
|
23
|
+
*
|
|
24
|
+
* @default "ghost"
|
|
25
|
+
*/
|
|
26
|
+
appearance?: IconButtonAppearance;
|
|
27
|
+
/**
|
|
28
|
+
* Props forwarded to the menu's `DropdownMenu.Content` — positioning and
|
|
29
|
+
* collision behavior (`align`, `side`, `collisionPadding`, …) plus
|
|
30
|
+
* `className`/`style` for the popover the trigger opens. To own the whole
|
|
31
|
+
* menu instead, compose `ThemeDropdownMenuRadioGroup` in your own
|
|
32
|
+
* `DropdownMenu`.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <ThemeSwitcher contentProps={{ collisionPadding: { right: 16 } }} />
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
contentProps?: Omit<ComponentProps<typeof DropdownMenu.Content>, "children">;
|
|
40
|
+
/**
|
|
41
|
+
* The accessible name for the trigger `IconButton`. Visually hidden but
|
|
42
|
+
* announced to screen readers. Override it for localization.
|
|
43
|
+
*
|
|
44
|
+
* @default "Change Theme"
|
|
45
|
+
*/
|
|
46
|
+
label?: string;
|
|
47
|
+
};
|
|
48
|
+
declare function ThemeSwitcher({ appearance, className, contentProps, label, style }: ThemeSwitcherProps): import("react").JSX.Element;
|
|
49
|
+
declare namespace ThemeSwitcher {
|
|
50
|
+
var displayName: string;
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { ThemeDropdownMenuRadioGroup, type ThemeDropdownMenuRadioGroupProps, ThemeSwitcher, type ThemeSwitcherProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./icon-CDtYjF_H.js";import{t}from"./icon-button-DV2-GZHf.js";import{t as n}from"./browser-only-CPH56Xw_.js";import{d as r,h as i,l as a,p as o}from"./theme-provider-Djj_jBo6.js";import{t as s}from"./dropdown-menu-ByUQkAvJ.js";import{n as c,t as l}from"./theme-D8kZCOzM.js";import{t as u}from"./skeleton-Bu3tgNcW.js";import{jsx as d,jsxs as f}from"react/jsx-runtime";const p={system:`System Preference`,light:`Light Mode`,dark:`Dark Mode`,"light-high-contrast":`Light High Contrast`,"dark-high-contrast":`Dark High Contrast`},m=({className:t,style:n})=>{let[l,u]=a();return d(s.RadioGroup,{"data-slot":`theme-dropdown-menu-radio-group`,className:t,style:n,value:l,onValueChange:e=>{o(e)&&u(e)},children:i.map(t=>f(s.RadioItem,{value:r(t),children:[d(e,{svg:d(c,{theme:t})}),p[t]]},t))})};m.displayName=`ThemeDropdownMenuRadioGroup`;const h=({appearance:e=`ghost`,className:r,contentProps:i,label:a=`Change Theme`,style:o})=>f(s.Root,{children:[d(s.Trigger,{asChild:!0,children:d(t,{type:`button`,appearance:e,className:r,"data-slot":`theme-switcher`,intent:`neutral`,icon:d(n,{fallback:d(u,{className:`rounded-full size-5`}),children:()=>d(l,{className:`size-5`})}),label:a,style:o})}),d(s.Content,{...i,children:d(m,{})})]});h.displayName=`ThemeSwitcher`;export{m as ThemeDropdownMenuRadioGroup,h as ThemeSwitcher};
|
package/dist/theme.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
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 "./themes-CYNpplwN.js";
|
|
2
2
|
import { PropsWithChildren } from "react";
|
|
3
|
-
|
|
4
3
|
//#region src/components/theme/mantle-style-sheets.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Browser-accessible URLs for mantle's three lazy-loaded theme stylesheets.
|
|
@@ -155,14 +154,7 @@ declare function fixMediaScriptContent(forceTheme?: ResolvedTheme): string;
|
|
|
155
154
|
* </head>
|
|
156
155
|
* ```
|
|
157
156
|
*/
|
|
158
|
-
declare function MantleStyleSheets({
|
|
159
|
-
darkCssUrl,
|
|
160
|
-
lightHighContrastCssUrl,
|
|
161
|
-
darkHighContrastCssUrl,
|
|
162
|
-
forceTheme,
|
|
163
|
-
nonce,
|
|
164
|
-
ssrCookie
|
|
165
|
-
}: MantleStyleSheetsProps): import("react").JSX.Element;
|
|
157
|
+
declare function MantleStyleSheets({ darkCssUrl, lightHighContrastCssUrl, darkHighContrastCssUrl, forceTheme, nonce, ssrCookie }: MantleStyleSheetsProps): import("react").JSX.Element;
|
|
166
158
|
declare namespace MantleStyleSheets {
|
|
167
159
|
var displayName: string;
|
|
168
160
|
}
|
|
@@ -176,7 +168,7 @@ type ThemeProviderProps = PropsWithChildren;
|
|
|
176
168
|
/**
|
|
177
169
|
* ThemeProvider is a React Context Provider that provides the current theme and a function to set the theme.
|
|
178
170
|
*
|
|
179
|
-
* @see https://mantle.ngrok.com/components/theme
|
|
171
|
+
* @see https://mantle.ngrok.com/components/primitives/theme#themeprovider
|
|
180
172
|
*
|
|
181
173
|
* @example
|
|
182
174
|
* ```tsx
|
|
@@ -185,9 +177,7 @@ type ThemeProviderProps = PropsWithChildren;
|
|
|
185
177
|
* </ThemeProvider>
|
|
186
178
|
* ```
|
|
187
179
|
*/
|
|
188
|
-
declare function ThemeProvider({
|
|
189
|
-
children
|
|
190
|
-
}: ThemeProviderProps): import("react").JSX.Element;
|
|
180
|
+
declare function ThemeProvider({ children }: ThemeProviderProps): import("react").JSX.Element;
|
|
191
181
|
declare namespace ThemeProvider {
|
|
192
182
|
var displayName: string;
|
|
193
183
|
}
|
|
@@ -201,33 +191,14 @@ declare function useTheme(): ThemeProviderState;
|
|
|
201
191
|
* Read the theme and applied theme from the `<html>` element.
|
|
202
192
|
*/
|
|
203
193
|
declare function readThemeFromHtmlElement(): {
|
|
204
|
-
appliedTheme: "dark" | "
|
|
205
|
-
theme: "dark" | "
|
|
194
|
+
appliedTheme: "dark" | "dark-high-contrast" | "light" | "light-high-contrast" | undefined;
|
|
195
|
+
theme: "dark" | "dark-high-contrast" | "light" | "light-high-contrast" | "system" | undefined;
|
|
206
196
|
};
|
|
207
197
|
/**
|
|
208
198
|
* If the theme is "system", it will resolve the theme based on the user's media query preferences, otherwise it will return the theme as is.
|
|
209
199
|
* This will mirror the result that gets applied to the <html> element.
|
|
210
200
|
*/
|
|
211
|
-
declare function useAppliedTheme(): "dark" | "
|
|
212
|
-
/**
|
|
213
|
-
* determineThemeFromMediaQuery returns the theme that should be used based on the user's media query preferences.
|
|
214
|
-
* @private
|
|
215
|
-
*
|
|
216
|
-
* @example
|
|
217
|
-
* ```tsx
|
|
218
|
-
* const theme = determineThemeFromMediaQuery({
|
|
219
|
-
* prefersDarkMode: true,
|
|
220
|
-
* prefersHighContrast: false
|
|
221
|
-
* });
|
|
222
|
-
* // Returns: "dark"
|
|
223
|
-
*
|
|
224
|
-
* const themeWithContrast = determineThemeFromMediaQuery({
|
|
225
|
-
* prefersDarkMode: false,
|
|
226
|
-
* prefersHighContrast: true
|
|
227
|
-
* });
|
|
228
|
-
* // Returns: "light-high-contrast"
|
|
229
|
-
* ```
|
|
230
|
-
*/
|
|
201
|
+
declare function useAppliedTheme(): "dark" | "dark-high-contrast" | "light" | "light-high-contrast";
|
|
231
202
|
/**
|
|
232
203
|
* preventWrongThemeFlashScriptContent generates a script that prevents the wrong theme from flashing on initial page load.
|
|
233
204
|
* It checks cookies for a stored theme, and if none is found, it sets the default theme.
|
|
@@ -244,44 +215,10 @@ type PreventWrongThemeFlashScriptProps = {
|
|
|
244
215
|
*/
|
|
245
216
|
nonce?: string;
|
|
246
217
|
};
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
* This is the preferred building block for SSR apps. Pair it with
|
|
252
|
-
* {@link preloadFontLink} HTTP `Link` headers in your server entry so font fetches
|
|
253
|
-
* begin before HTML is parsed. For client-only apps without header control, pair
|
|
254
|
-
* it with {@link PreloadFont} elements in `<head>` instead.
|
|
255
|
-
*
|
|
256
|
-
* Place this as early as possible in the `<head>`.
|
|
257
|
-
*
|
|
258
|
-
* @example
|
|
259
|
-
* ```tsx
|
|
260
|
-
* // entry.server.tsx — send font preloads as HTTP headers (preferred for SSR)
|
|
261
|
-
* headers.set("Link", [
|
|
262
|
-
* `<${assetsCdnOrigin}>; rel=preconnect; crossorigin`,
|
|
263
|
-
* preloadFontLink("roobert"),
|
|
264
|
-
* preloadFontLink("jetbrains-mono"),
|
|
265
|
-
* ].join(", "));
|
|
266
|
-
*
|
|
267
|
-
* // root.tsx — only the FOUC script in <head>
|
|
268
|
-
* <head>
|
|
269
|
-
* <PreventWrongThemeFlashScript nonce={nonce} />
|
|
270
|
-
* </head>
|
|
271
|
-
* ```
|
|
272
|
-
*
|
|
273
|
-
* @param nonce - Optional CSP nonce to allowlist the inline script under a strict CSP.
|
|
274
|
-
* @returns {JSX.Element} A script tag injected before first paint.
|
|
275
|
-
* @see preloadFontLink
|
|
276
|
-
* @see PreloadFont
|
|
277
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce
|
|
278
|
-
*/
|
|
279
|
-
declare const PreventWrongThemeFlashScript: {
|
|
280
|
-
({
|
|
281
|
-
nonce
|
|
282
|
-
}: PreventWrongThemeFlashScriptProps): import("react").JSX.Element;
|
|
283
|
-
displayName: string;
|
|
284
|
-
};
|
|
218
|
+
declare function PreventWrongThemeFlashScript({ nonce }: PreventWrongThemeFlashScriptProps): import("react").JSX.Element;
|
|
219
|
+
declare namespace PreventWrongThemeFlashScript {
|
|
220
|
+
var displayName: string;
|
|
221
|
+
}
|
|
285
222
|
type InitialThemeProps = {
|
|
286
223
|
className: string;
|
|
287
224
|
"data-applied-theme": ResolvedTheme;
|
|
@@ -319,9 +256,7 @@ type GetStoredThemeOptions = {
|
|
|
319
256
|
* @example
|
|
320
257
|
* getStoredTheme({ cookie: "" }) // DEFAULT_THEME
|
|
321
258
|
*/
|
|
322
|
-
declare function getStoredTheme({
|
|
323
|
-
cookie
|
|
324
|
-
}: GetStoredThemeOptions): Theme;
|
|
259
|
+
declare function getStoredTheme({ cookie }: GetStoredThemeOptions): Theme;
|
|
325
260
|
/**
|
|
326
261
|
* Extract just the mantle theme cookie from a raw `Cookie` header string.
|
|
327
262
|
*
|
|
@@ -414,30 +349,9 @@ type PreloadFontProps = {
|
|
|
414
349
|
* ```
|
|
415
350
|
*/
|
|
416
351
|
declare function preloadFontLink(name: CoreFontName): string;
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
* fonts. Include it as early as possible in the document `<head>`.
|
|
422
|
-
*
|
|
423
|
-
* @remarks
|
|
424
|
-
* For best performance, pair this with preconnect/dns-prefetch hints to the CDN.
|
|
425
|
-
*
|
|
426
|
-
* @example
|
|
427
|
-
* ```tsx
|
|
428
|
-
* <head>
|
|
429
|
-
* <link rel="preconnect" href={assetsCdnOrigin} crossOrigin="anonymous" />
|
|
430
|
-
* <link rel="dns-prefetch" href={assetsCdnOrigin} />
|
|
431
|
-
* <PreloadFont name="roobert" />
|
|
432
|
-
* <PreloadFont name="jetbrains-mono" />
|
|
433
|
-
* </head>
|
|
434
|
-
* ```
|
|
435
|
-
*/
|
|
436
|
-
declare const PreloadFont: {
|
|
437
|
-
({
|
|
438
|
-
name
|
|
439
|
-
}: PreloadFontProps): import("react").JSX.Element;
|
|
440
|
-
displayName: string;
|
|
441
|
-
};
|
|
352
|
+
declare function PreloadFont({ name }: PreloadFontProps): import("react").JSX.Element;
|
|
353
|
+
declare namespace PreloadFont {
|
|
354
|
+
var displayName: string;
|
|
355
|
+
}
|
|
442
356
|
//#endregion
|
|
443
357
|
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-Djj_jBo6.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})]})}k.displayName=`MantleStyleSheets`;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`});F.displayName=`PreloadFont`;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-CDtYjF_H.js";import{t as n}from"./slot-DmPrjM7N.js";import{s as r}from"./theme-provider-Djj_jBo6.js";import{createContext as i,forwardRef as a,useContext as o,useMemo 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*as m from"sonner";const h=({className:t,containerAriaLabel:n,dir:i,duration_ms:a=4e3,position:o=`top-center`,style:s})=>{let l=r();return c(m.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:s,theme:l,toastOptions:{unstyled:!0}})};h.displayName=`Toaster`;const g=i(``);function _(e,t){let n=t?.duration_ms;return typeof n==`number`&&n<=0&&(n=1/0),m.toast.custom(t=>c(g.Provider,{value:t,children:e}),{duration:n,...t?.id?{id:t.id}:{},unstyled:!0})}const v=i({intent:`info`}),y=a(({asChild:t,children:r,className:i,intent:a,...o},u)=>{let d=t?n:`div`,f=s(()=>({intent:a}),[a]);return c(v.Provider,{value:f,children:l(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:u,...o,children:[c(E,{intent:a}),r]})})});y.displayName=`Toast`;const b=a(({className:n,svg:r,...i},a)=>{let s=o(v);switch(s.intent){case`danger`:return c(t,{"data-slot":`toast-icon`,className:e(`text-danger-600`,n),ref:a,svg:r??c(f,{weight:`fill`}),...i});case`warning`:return c(t,{"data-slot":`toast-icon`,className:e(`text-warning-600`,n),ref:a,svg:r??c(p,{weight:`fill`}),...i});case`success`:return c(t,{"data-slot":`toast-icon`,className:e(`text-success-600`,n),ref:a,svg:r??c(u,{weight:`fill`}),...i});case`info`:return c(t,{"data-slot":`toast-icon`,className:e(`text-accent-600`,n),ref:a,svg:c(d,{weight:`fill`}),...i});default:throw Error(`Unreachable Case: ${s.intent}`)}});b.displayName=`ToastIcon`;const x=a(({asChild:t,className:r,onClick:i,...a},s)=>{let l=o(g);return c(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&&m.toast.dismiss(l)},ref:s,...a})});x.displayName=`ToastAction`;const S=a(({asChild:t,className:r,...i},a)=>c(t?n:`p`,{"data-slot":`toast-message`,className:e(`text-strong flex-1 text-sm font-body`,r),ref:a,...i}));S.displayName=`ToastMessage`;const C={Root:y,Action:x,Icon:b,Message:S};function w(e){e.target instanceof Element&&e.target.closest(`.overlay-prompt`)&&e.preventDefault()}const T={info:`bg-accent-600`,warning:`bg-warning-600`,success:`bg-success-600`,danger:`bg-danger-600`};function E({className:t,intent:n,...r}){return c(`div`,{"aria-hidden":!0,className:e(`z-1 absolute -inset-px right-auto w-1.5 rounded-l`,T[n],t),...r})}export{w as i,h as n,_ as r,C as t};
|
package/dist/toast.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { t as WithAsChild } from "./as-child-
|
|
2
|
-
import { t as WithStyleProps } from "./with-style-props-
|
|
3
|
-
import { n as SvgOnlyProps } from "./svg-only-
|
|
1
|
+
import { t as WithAsChild } from "./as-child-CYEVu1WY.js";
|
|
2
|
+
import { t as WithStyleProps } from "./with-style-props-Dq5Vntqy.js";
|
|
3
|
+
import { n as SvgOnlyProps } from "./svg-only-BFeFS1aa.js";
|
|
4
4
|
import { ComponentProps, ReactNode } from "react";
|
|
5
5
|
import * as ToastPrimitive from "sonner";
|
|
6
|
-
|
|
7
6
|
//#region src/components/toast/toast.d.ts
|
|
8
7
|
type ToasterPrimitiveProps = ComponentProps<typeof ToastPrimitive.Toaster>;
|
|
9
8
|
type ToasterProps = WithStyleProps & Pick<ToasterPrimitiveProps, "containerAriaLabel" | "dir" | "position"> & {
|
|
@@ -14,33 +13,10 @@ type ToasterProps = WithStyleProps & Pick<ToasterPrimitiveProps, "containerAriaL
|
|
|
14
13
|
*/
|
|
15
14
|
duration_ms?: number;
|
|
16
15
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* root level of the app.
|
|
22
|
-
*
|
|
23
|
-
* @see https://mantle.ngrok.com/components/toast#toaster
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```tsx
|
|
27
|
-
* <Toaster
|
|
28
|
-
* position="top-right"
|
|
29
|
-
* duration_ms={5000}
|
|
30
|
-
* />
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
declare const Toaster: {
|
|
34
|
-
({
|
|
35
|
-
className,
|
|
36
|
-
containerAriaLabel,
|
|
37
|
-
dir,
|
|
38
|
-
duration_ms,
|
|
39
|
-
position,
|
|
40
|
-
style
|
|
41
|
-
}: ToasterProps): import("react").JSX.Element;
|
|
42
|
-
displayName: string;
|
|
43
|
-
};
|
|
16
|
+
declare function Toaster({ className, containerAriaLabel, dir, duration_ms, position, style }: ToasterProps): import("react").JSX.Element;
|
|
17
|
+
declare namespace Toaster {
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
44
20
|
type MakeToastOptions = {
|
|
45
21
|
/**
|
|
46
22
|
* Time in milliseconds that should elapse before automatically closing the toast.
|
|
@@ -58,13 +34,13 @@ type MakeToastOptions = {
|
|
|
58
34
|
* Create a toast. Provide a `<Toast.Root>` component as the `children` to be rendered
|
|
59
35
|
* inside the `<Toaster />` section.
|
|
60
36
|
*
|
|
61
|
-
* @see https://mantle.ngrok.com/components/toast#maketoast
|
|
37
|
+
* @see https://mantle.ngrok.com/components/feedback/toast#maketoast
|
|
62
38
|
*
|
|
63
39
|
* @example
|
|
64
40
|
* ```tsx
|
|
65
41
|
* // Basic toast with auto-dismiss (default 4000ms, inherits from `<Toaster>`)
|
|
66
42
|
* makeToast(
|
|
67
|
-
* <Toast.Root
|
|
43
|
+
* <Toast.Root intent="success">
|
|
68
44
|
* <Toast.Icon />
|
|
69
45
|
* <Toast.Message>Operation completed successfully!</Toast.Message>
|
|
70
46
|
* <Toast.Action>Dismiss</Toast.Action>
|
|
@@ -73,7 +49,7 @@ type MakeToastOptions = {
|
|
|
73
49
|
*
|
|
74
50
|
* // Toast that stays open until manually dismissed
|
|
75
51
|
* makeToast(
|
|
76
|
-
* <Toast.Root
|
|
52
|
+
* <Toast.Root intent="warning">
|
|
77
53
|
* <Toast.Icon />
|
|
78
54
|
* <Toast.Message>Action required</Toast.Message>
|
|
79
55
|
* <Toast.Action>Dismiss</Toast.Action>
|
|
@@ -83,10 +59,16 @@ type MakeToastOptions = {
|
|
|
83
59
|
* ```
|
|
84
60
|
*/
|
|
85
61
|
declare function makeToast(children: ReactNode, options?: MakeToastOptions): string | number;
|
|
86
|
-
declare const
|
|
87
|
-
|
|
62
|
+
declare const intents: readonly ["danger", "info", "success", "warning"];
|
|
63
|
+
/**
|
|
64
|
+
* The intent of a toast: the tone or status that the toast's color communicates.
|
|
65
|
+
*/
|
|
66
|
+
type ToastIntent = (typeof intents)[number];
|
|
88
67
|
type ToastProps = ComponentProps<"div"> & WithAsChild & {
|
|
89
|
-
|
|
68
|
+
/**
|
|
69
|
+
* The intent of the toast: the tone or status that the toast's color communicates.
|
|
70
|
+
*/
|
|
71
|
+
intent: ToastIntent;
|
|
90
72
|
};
|
|
91
73
|
type ToastActionProps = ComponentProps<"button"> & WithAsChild;
|
|
92
74
|
type ToastMessageProps = ComponentProps<"p"> & WithAsChild;
|
|
@@ -94,7 +76,7 @@ type ToastMessageProps = ComponentProps<"p"> & WithAsChild;
|
|
|
94
76
|
* A succinct message that is displayed temporarily. Toasts are used to provide
|
|
95
77
|
* feedback to the user without interrupting their workflow.
|
|
96
78
|
*
|
|
97
|
-
* @see https://mantle.ngrok.com/components/toast
|
|
79
|
+
* @see https://mantle.ngrok.com/components/feedback/toast
|
|
98
80
|
*
|
|
99
81
|
* @example
|
|
100
82
|
* Composition:
|
|
@@ -108,7 +90,7 @@ type ToastMessageProps = ComponentProps<"p"> & WithAsChild;
|
|
|
108
90
|
* @example
|
|
109
91
|
* ```tsx
|
|
110
92
|
* makeToast(
|
|
111
|
-
* <Toast.Root
|
|
93
|
+
* <Toast.Root intent="success">
|
|
112
94
|
* <Toast.Icon />
|
|
113
95
|
* <Toast.Message>Operation completed successfully!</Toast.Message>
|
|
114
96
|
* <Toast.Action>Dismiss</Toast.Action>
|
|
@@ -118,13 +100,13 @@ type ToastMessageProps = ComponentProps<"p"> & WithAsChild;
|
|
|
118
100
|
*/
|
|
119
101
|
declare const Toast: {
|
|
120
102
|
/**
|
|
121
|
-
* A succinct message with
|
|
103
|
+
* A succinct message with an intent that is displayed temporarily.
|
|
122
104
|
*
|
|
123
|
-
* @see https://mantle.ngrok.com/components/toast#toastroot
|
|
105
|
+
* @see https://mantle.ngrok.com/components/feedback/toast#toastroot
|
|
124
106
|
*
|
|
125
107
|
* @example
|
|
126
108
|
* ```tsx
|
|
127
|
-
* <Toast.Root
|
|
109
|
+
* <Toast.Root intent="success">
|
|
128
110
|
* <Toast.Icon />
|
|
129
111
|
* <Toast.Message>Changes saved successfully!</Toast.Message>
|
|
130
112
|
* <Toast.Action>Undo</Toast.Action>
|
|
@@ -135,11 +117,11 @@ declare const Toast: {
|
|
|
135
117
|
/**
|
|
136
118
|
* A button that dismisses the toast when clicked.
|
|
137
119
|
*
|
|
138
|
-
* @see https://mantle.ngrok.com/components/toast#toastaction
|
|
120
|
+
* @see https://mantle.ngrok.com/components/feedback/toast#toastaction
|
|
139
121
|
*
|
|
140
122
|
* @example
|
|
141
123
|
* ```tsx
|
|
142
|
-
* <Toast.Root
|
|
124
|
+
* <Toast.Root intent="info">
|
|
143
125
|
* <Toast.Icon />
|
|
144
126
|
* <Toast.Message>File uploaded successfully</Toast.Message>
|
|
145
127
|
* <Toast.Action>View File</Toast.Action>
|
|
@@ -148,13 +130,13 @@ declare const Toast: {
|
|
|
148
130
|
*/
|
|
149
131
|
readonly Action: import("react").ForwardRefExoticComponent<Omit<ToastActionProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
150
132
|
/**
|
|
151
|
-
* An icon that visually represents the
|
|
133
|
+
* An icon that visually represents the intent of the toast.
|
|
152
134
|
*
|
|
153
|
-
* @see https://mantle.ngrok.com/components/toast#toasticon
|
|
135
|
+
* @see https://mantle.ngrok.com/components/feedback/toast#toasticon
|
|
154
136
|
*
|
|
155
137
|
* @example
|
|
156
138
|
* ```tsx
|
|
157
|
-
* <Toast.Root
|
|
139
|
+
* <Toast.Root intent="warning">
|
|
158
140
|
* <Toast.Icon />
|
|
159
141
|
* <Toast.Message>Warning message</Toast.Message>
|
|
160
142
|
* </Toast.Root>
|
|
@@ -164,11 +146,11 @@ declare const Toast: {
|
|
|
164
146
|
/**
|
|
165
147
|
* The message content of the toast.
|
|
166
148
|
*
|
|
167
|
-
* @see https://mantle.ngrok.com/components/toast#toastmessage
|
|
149
|
+
* @see https://mantle.ngrok.com/components/feedback/toast#toastmessage
|
|
168
150
|
*
|
|
169
151
|
* @example
|
|
170
152
|
* ```tsx
|
|
171
|
-
* <Toast.Root
|
|
153
|
+
* <Toast.Root intent="success">
|
|
172
154
|
* <Toast.Icon />
|
|
173
155
|
* <Toast.Message>Your changes have been saved</Toast.Message>
|
|
174
156
|
* </Toast.Root>
|
|
@@ -177,4 +159,4 @@ declare const Toast: {
|
|
|
177
159
|
readonly Message: import("react").ForwardRefExoticComponent<Omit<ToastMessageProps, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
178
160
|
};
|
|
179
161
|
//#endregion
|
|
180
|
-
export { type
|
|
162
|
+
export { Toast, type ToastIntent, Toaster, makeToast };
|
package/dist/toast.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./toast-
|
|
1
|
+
import{n as e,r as t,t as n}from"./toast-D3ntBmn4.js";export{n as Toast,e as Toaster,t as makeToast};
|
package/dist/tooltip.d.ts
CHANGED
|
@@ -1,38 +1,10 @@
|
|
|
1
1
|
import { ComponentProps, ComponentPropsWithoutRef } from "react";
|
|
2
2
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
3
|
-
|
|
4
3
|
//#region src/components/tooltip/tooltip.d.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* `Tooltip.Root` / `Tooltip.Trigger` / `Tooltip.Content` trees as usual.
|
|
10
|
-
*
|
|
11
|
-
* @see https://mantle.ngrok.com/components/tooltip#tooltipprovider
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```tsx
|
|
15
|
-
* <TooltipProvider>
|
|
16
|
-
* <Tooltip.Root>
|
|
17
|
-
* <Tooltip.Trigger asChild>
|
|
18
|
-
* <Button type="button" appearance="outlined">
|
|
19
|
-
* Hover me
|
|
20
|
-
* </Button>
|
|
21
|
-
* </Tooltip.Trigger>
|
|
22
|
-
* <Tooltip.Content>
|
|
23
|
-
* This is a tooltip
|
|
24
|
-
* </Tooltip.Content>
|
|
25
|
-
* </Tooltip.Root>
|
|
26
|
-
* </TooltipProvider>
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
declare const TooltipProvider: {
|
|
30
|
-
({
|
|
31
|
-
delayDuration,
|
|
32
|
-
...props
|
|
33
|
-
}: ComponentPropsWithoutRef<typeof TooltipPrimitive.Provider>): import("react").JSX.Element;
|
|
34
|
-
displayName: string;
|
|
35
|
-
};
|
|
4
|
+
declare function TooltipProvider({ delayDuration, ...props }: ComponentPropsWithoutRef<typeof TooltipPrimitive.Provider>): import("react").JSX.Element;
|
|
5
|
+
declare namespace TooltipProvider {
|
|
6
|
+
var displayName: string;
|
|
7
|
+
}
|
|
36
8
|
/**
|
|
37
9
|
* A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.
|
|
38
10
|
* This is the root, stateful component that manages the open/closed state of
|
|
@@ -43,13 +15,13 @@ declare const TooltipProvider: {
|
|
|
43
15
|
* z-index. When multiple shared layers are open, the most recently mounted
|
|
44
16
|
* layer renders on top.
|
|
45
17
|
*
|
|
46
|
-
* @see https://mantle.ngrok.com/components/tooltip#tooltiproot
|
|
18
|
+
* @see https://mantle.ngrok.com/components/overlays/tooltip#tooltiproot
|
|
47
19
|
*
|
|
48
20
|
* @example
|
|
49
21
|
* ```tsx
|
|
50
22
|
* <Tooltip.Root>
|
|
51
23
|
* <Tooltip.Trigger asChild>
|
|
52
|
-
* <Button type="button" appearance="outlined">
|
|
24
|
+
* <Button type="button" appearance="outlined" intent="neutral">
|
|
53
25
|
* Hover me
|
|
54
26
|
* </Button>
|
|
55
27
|
* </Tooltip.Trigger>
|
|
@@ -60,19 +32,16 @@ declare const TooltipProvider: {
|
|
|
60
32
|
* ```
|
|
61
33
|
*/
|
|
62
34
|
declare function Root(props: ComponentProps<typeof TooltipPrimitive.Root>): import("react").JSX.Element;
|
|
63
|
-
declare namespace Root {
|
|
64
|
-
var displayName: string;
|
|
65
|
-
}
|
|
66
35
|
/**
|
|
67
36
|
* The trigger button that opens the tooltip.
|
|
68
37
|
*
|
|
69
|
-
* @see https://mantle.ngrok.com/components/tooltip#tooltiptrigger
|
|
38
|
+
* @see https://mantle.ngrok.com/components/overlays/tooltip#tooltiptrigger
|
|
70
39
|
*
|
|
71
40
|
* @example
|
|
72
41
|
* ```tsx
|
|
73
42
|
* <Tooltip.Root>
|
|
74
43
|
* <Tooltip.Trigger asChild>
|
|
75
|
-
* <Button type="button" appearance="outlined">
|
|
44
|
+
* <Button type="button" appearance="outlined" intent="neutral">
|
|
76
45
|
* Hover me
|
|
77
46
|
* </Button>
|
|
78
47
|
* </Tooltip.Trigger>
|
|
@@ -83,9 +52,6 @@ declare namespace Root {
|
|
|
83
52
|
* ```
|
|
84
53
|
*/
|
|
85
54
|
declare function Trigger(props: ComponentProps<typeof TooltipPrimitive.Trigger>): import("react").JSX.Element;
|
|
86
|
-
declare namespace Trigger {
|
|
87
|
-
var displayName: string;
|
|
88
|
-
}
|
|
89
55
|
/**
|
|
90
56
|
* A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.
|
|
91
57
|
*
|
|
@@ -105,7 +71,7 @@ declare namespace Trigger {
|
|
|
105
71
|
* z-index. When multiple shared layers are open, the most recently mounted
|
|
106
72
|
* layer renders on top.
|
|
107
73
|
*
|
|
108
|
-
* @see https://mantle.ngrok.com/components/tooltip
|
|
74
|
+
* @see https://mantle.ngrok.com/components/overlays/tooltip
|
|
109
75
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/
|
|
110
76
|
*
|
|
111
77
|
* @example
|
|
@@ -120,7 +86,7 @@ declare namespace Trigger {
|
|
|
120
86
|
* ```tsx
|
|
121
87
|
* <Tooltip.Root>
|
|
122
88
|
* <Tooltip.Trigger asChild>
|
|
123
|
-
* <Button type="button" appearance="outlined">
|
|
89
|
+
* <Button type="button" appearance="outlined" intent="neutral">
|
|
124
90
|
* Hover me
|
|
125
91
|
* </Button>
|
|
126
92
|
* </Tooltip.Trigger>
|
|
@@ -141,13 +107,13 @@ declare const Tooltip: {
|
|
|
141
107
|
* z-index. When multiple shared layers are open, the most recently mounted
|
|
142
108
|
* layer renders on top.
|
|
143
109
|
*
|
|
144
|
-
* @see https://mantle.ngrok.com/components/tooltip#tooltiproot
|
|
110
|
+
* @see https://mantle.ngrok.com/components/overlays/tooltip#tooltiproot
|
|
145
111
|
*
|
|
146
112
|
* @example
|
|
147
113
|
* ```tsx
|
|
148
114
|
* <Tooltip.Root>
|
|
149
115
|
* <Tooltip.Trigger asChild>
|
|
150
|
-
* <Button type="button" appearance="outlined">
|
|
116
|
+
* <Button type="button" appearance="outlined" intent="neutral">
|
|
151
117
|
* Hover me
|
|
152
118
|
* </Button>
|
|
153
119
|
* </Tooltip.Trigger>
|
|
@@ -165,13 +131,13 @@ declare const Tooltip: {
|
|
|
165
131
|
* z-index. When multiple shared layers are open, the most recently mounted
|
|
166
132
|
* layer renders on top.
|
|
167
133
|
*
|
|
168
|
-
* @see https://mantle.ngrok.com/components/tooltip#tooltipcontent
|
|
134
|
+
* @see https://mantle.ngrok.com/components/overlays/tooltip#tooltipcontent
|
|
169
135
|
*
|
|
170
136
|
* @example
|
|
171
137
|
* ```tsx
|
|
172
138
|
* <Tooltip.Root>
|
|
173
139
|
* <Tooltip.Trigger asChild>
|
|
174
|
-
* <Button type="button" appearance="outlined">
|
|
140
|
+
* <Button type="button" appearance="outlined" intent="neutral">
|
|
175
141
|
* Hover me
|
|
176
142
|
* </Button>
|
|
177
143
|
* </Tooltip.Trigger>
|
|
@@ -185,13 +151,13 @@ declare const Tooltip: {
|
|
|
185
151
|
/**
|
|
186
152
|
* The trigger button that opens the tooltip.
|
|
187
153
|
*
|
|
188
|
-
* @see https://mantle.ngrok.com/components/tooltip#tooltiptrigger
|
|
154
|
+
* @see https://mantle.ngrok.com/components/overlays/tooltip#tooltiptrigger
|
|
189
155
|
*
|
|
190
156
|
* @example
|
|
191
157
|
* ```tsx
|
|
192
158
|
* <Tooltip.Root>
|
|
193
159
|
* <Tooltip.Trigger asChild>
|
|
194
|
-
* <Button type="button" appearance="outlined">
|
|
160
|
+
* <Button type="button" appearance="outlined" intent="neutral">
|
|
195
161
|
* Hover me
|
|
196
162
|
* </Button>
|
|
197
163
|
* </Tooltip.Trigger>
|
package/dist/tooltip.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{forwardRef as t}from"react";import{jsx as n,jsxs as r}from"react/jsx-runtime";import*as i from"@radix-ui/react-tooltip";const a=({delayDuration:e=0,...t})=>n(i.Provider,{"data-slot":`tooltip-provider`,delayDuration:e??0,...t});a.displayName=`Tooltip.Provider`;function o(e){return n(i.Root,{"data-slot":`tooltip`,...e})}o.displayName=`Tooltip.Root`;function s(e){return n(i.Trigger,{"data-slot":`tooltip-trigger`,...e})}s.displayName=`Tooltip.Trigger`;const c=t(({children:t,className:a,sideOffset:o=4,...s},c)=>n(i.Portal,{children:r(i.Content,{className:e(`bg-tooltip text-tooltip animate-in fade-in-0 zoom-in-95 data-side-bottom:slide-in-from-top-2 data-side-left:slide-in-from-right-2 data-side-right:slide-in-from-left-2 data-side-top:slide-in-from-bottom-2 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 z-50 max-w-72 overflow-visible wrap-break-word rounded-md px-3 py-1.5 text-sm font-sans shadow`,a),"data-slot":`tooltip-content`,ref:c,sideOffset:o,...s,children:[t,n(i.Arrow,{asChild:!0,children:n(`div`,{className:`bg-tooltip z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-xs`})})]})}));c.displayName=`Tooltip.Content`;const l={Root:o,Content:c,Trigger:s};export{l as Tooltip,a as TooltipProvider};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as WithAsChild } from "./as-child-
|
|
2
|
-
import { a as Booleanish, i as DeepNonNullable, n as CssProperties, o as parseBooleanish, r as VariantProps, t as $cssProperties } from "./index-
|
|
3
|
-
import { t as WithStyleProps } from "./with-style-props-
|
|
1
|
+
import { t as WithAsChild } from "./as-child-CYEVu1WY.js";
|
|
2
|
+
import { a as Booleanish, i as DeepNonNullable, n as CssProperties, o as parseBooleanish, r as VariantProps, t as $cssProperties } from "./index-D47aqlpz.js";
|
|
3
|
+
import { t as WithStyleProps } from "./with-style-props-Dq5Vntqy.js";
|
|
4
4
|
export { $cssProperties, type Booleanish, type CssProperties, type DeepNonNullable, type VariantProps, type WithAsChild, type WithStyleProps, parseBooleanish };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./browser-only-CPH56Xw_.js";import{useEffect as t,useState as n}from"react";const r=`(prefers-reduced-motion: no-preference)`;function i(){return!e()||!window.matchMedia(r).matches}function a(){let[e,a]=n(!0);return t(()=>{let e=window.matchMedia(r);a(i());function t(e){a(!e.matches)}return e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t)}},[]),e}export{a as n,i as t};
|