@ngrok/mantle 0.82.1 → 0.83.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 +7 -7
- package/dist/agent.json +3 -1
- package/dist/{alert-BWwNPOMI.d.ts → alert-B1HXfkYn.d.ts} +9 -7
- package/dist/{alert-vwFd7qdp.js → alert-BuG2qS5l.js} +1 -1
- package/dist/alert-center.d.ts +3 -3
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +18 -18
- package/dist/alert.d.ts +1 -1
- package/dist/alert.js +1 -1
- package/dist/anchor.d.ts +2 -2
- package/dist/app-layout.js +1 -1
- package/dist/area-chart.d.ts +67 -19
- package/dist/area-chart.js +1 -1
- package/dist/avatar.d.ts +319 -0
- package/dist/avatar.js +1 -0
- package/dist/bar-chart.d.ts +73 -20
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.d.ts +50 -17
- package/dist/breadcrumb.js +1 -1
- package/dist/browser-only.d.ts +3 -3
- package/dist/{button-C-gMbPso.d.ts → button-BIf69CSV.d.ts} +2 -2
- package/dist/button-BLDjW1u9.js +1 -0
- package/dist/{button-IlxHhjPK.js → button-CCkGqE1t.js} +1 -1
- package/dist/{button-C7vAl6lS.d.ts → button-DJ7AAgII.d.ts} +4 -6
- package/dist/{button-DARFK2KJ.d.ts → button-PoIujPMX.d.ts} +2 -2
- package/dist/button.d.ts +3 -3
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +15 -15
- package/dist/{chart-1cVjAcj8.d.ts → chart-0zcFJh4n.d.ts} +75 -22
- package/dist/chart-DBxT9BNl.js +2 -0
- package/dist/{choice-BNRQXszu.d.ts → choice-CVdQrs-m.d.ts} +118 -6
- package/dist/choice.d.ts +1 -1
- package/dist/{code-block-C9uaM9-V.js → code-block-CIE0F2fu.js} +1 -1
- package/dist/{code-block-B6OlZrSI.d.ts → code-block-CZWPrV4k.d.ts} +3 -3
- package/dist/code-block.d.ts +10 -7
- package/dist/code-block.js +2 -2
- package/dist/code-block_highlight-utils.d.ts +1 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/combobox.d.ts +8 -9
- package/dist/command.d.ts +668 -106
- package/dist/command.js +1 -1
- package/dist/data-table.d.ts +6 -6
- package/dist/data-table.js +1 -1
- package/dist/dialog-02mNrAT1.d.ts +806 -0
- package/dist/{dialog-DozL6n-F.js → dialog-BRjTD83p.js} +1 -1
- package/dist/dialog.d.ts +2 -805
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu-BcALUQMp.d.ts +1 -0
- package/dist/{dropdown-menu-D6pMAY7I.d.ts → dropdown-menu-DZOfj6HB.d.ts} +1 -1
- package/dist/dropdown-menu.d.ts +2 -2
- package/dist/field.d.ts +5 -5
- package/dist/field.js +1 -1
- package/dist/flag.js +1 -1
- package/dist/hooks.d.ts +16 -17
- package/dist/hooks.js +1 -1
- package/dist/icons-DEVx1oP9.js +1 -0
- package/dist/icons.d.ts +7 -6
- package/dist/icons.js +1 -1
- package/dist/{in-view-DDEGUKDR.d.ts → in-view-gxyc9Q1_.d.ts} +1 -1
- package/dist/{input-BuYDU6CF.d.ts → input-DpnC3Xgj.d.ts} +2 -2
- package/dist/input.d.ts +1 -1
- package/dist/kbd.d.ts +1 -1
- package/dist/line-chart.d.ts +60 -13
- package/dist/line-chart.js +1 -1
- package/dist/list-CwL23L_B.js +1 -0
- package/dist/list.d.ts +2 -2
- package/dist/list.js +1 -1
- package/dist/llms.txt +3 -1
- package/dist/mantle-dark-high-contrast.css +30 -17
- package/dist/mantle-dark.css +48 -13
- package/dist/mantle-light-high-contrast.css +33 -15
- package/dist/mantle.css +436 -26
- package/dist/media-object.d.ts +5 -1
- package/dist/multi-select.d.ts +7 -7
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +4 -4
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +2 -2
- package/dist/pagination.js +1 -1
- package/dist/progress.d.ts +4 -4
- package/dist/qr-code.d.ts +2 -2
- package/dist/sandbar.d.ts +471 -0
- package/dist/sandbar.js +1 -0
- package/dist/sandboxed-on-click.d.ts +4 -6
- package/dist/scatter-plot.d.ts +69 -24
- package/dist/scatter-plot.js +1 -1
- package/dist/{select-0z7HVS6r.d.ts → select-DVHmgih8.d.ts} +13 -7
- package/dist/select-LK9NX-vV.js +1 -0
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +4 -4
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-B5UmkVRL.d.ts → separator-CNDs98Dv.d.ts} +2 -2
- package/dist/separator.d.ts +1 -1
- package/dist/{sheet-BxvTfPLM.js → sheet-BOSknSN9.js} +1 -1
- package/dist/sheet.d.ts +1 -1
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +347 -366
- package/dist/sidebar.js +1 -1
- package/dist/slider.d.ts +1 -1
- package/dist/split-button.d.ts +12 -12
- package/dist/split-button.js +1 -1
- package/dist/switch.d.ts +2 -1
- package/dist/{table-CGxJwtbL.js → table-C_Nm_RSV.js} +1 -1
- package/dist/{table-CZBYEmyK.d.ts → table-D51ZtV4U.d.ts} +18 -8
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +8 -13
- package/dist/tabs.js +1 -1
- package/dist/{theme-FbfjYiD3.d.ts → theme-6OxNhf6l.d.ts} +6 -6
- package/dist/theme-CVfq037P.js +1 -0
- package/dist/theme-switcher.d.ts +3 -3
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +86 -23
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +9 -9
- package/dist/toast.js +1 -1
- package/dist/{tooltip-mrpLz4DZ.d.ts → tooltip-DuXGxIse.d.ts} +6 -4
- package/dist/tooltip.d.ts +1 -1
- package/dist/use-breakpoint-Dqu12Szq.js +1 -0
- package/dist/use-callback-ref-IYti9y7x.js +1 -0
- package/dist/use-is-apple-platform-Cxwrb86L.js +1 -0
- package/dist/use-matches-media-query-Bd_GhhVd.js +1 -0
- package/dist/utils.d.ts +1 -1
- package/package.json +4 -2
- package/dist/button-DvHMWAPl.js +0 -1
- package/dist/chart-B3pAvmkk.js +0 -2
- package/dist/dropdown-menu-BbbQuae2.d.ts +0 -1
- package/dist/icons-Bb_zF2OV.js +0 -1
- package/dist/list-CJABVHwi.js +0 -1
- package/dist/platform-BVD3gpKD.js +0 -1
- package/dist/select-BReznXaw.js +0 -1
- package/dist/theme-BorfgnNh.js +0 -1
- package/dist/use-breakpoint-Wd7_5-Mu.js +0 -1
- package/dist/use-matches-media-query-CMSxHR9n.js +0 -1
package/dist/sidebar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./slot-DpNWVci8.js";import{t as r}from"./button-IlxHhjPK.js";import{t as i}from"./use-is-hydrated-DDCqXmju.js";import{n as a}from"./separator-D0D6VyyM.js";import{t as o}from"./platform-BVD3gpKD.js";import{n as s}from"./cookie-ca4g5CKp.js";import{t as c}from"./sheet-BxvTfPLM.js";import{i as l,r as u}from"./use-breakpoint-Wd7_5-Mu.js";import{t as d}from"./tooltip-Dnu35cjU.js";import{cloneElement as f,createContext as p,isValidElement as m,useCallback as h,useContext as g,useEffect as _,useId as v,useMemo as y,useRef as b,useState as x}from"react";import S from"tiny-invariant";import{jsx as C,jsxs as w}from"react/jsx-runtime";import{SidebarSimpleIcon as T}from"@phosphor-icons/react/SidebarSimple";const E={sm:`hidden sm:block`,md:`hidden md:block`,lg:`hidden lg:block`},D=p(null);function O(){let e=g(D);return S(e,`useSidebar must be used within Sidebar.Root.`),e}function k(e){let t=g(D);return S(t,`Sidebar.${e} must be rendered inside Sidebar.Root.`),t}const A=[];function ee(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.tagName===`SELECT`:!1}function te(){let e=Symbol(`sidebar-keyboard-shortcut`);return A.push(e),{isOwner:()=>A[0]===e,release:()=>{let t=A.indexOf(e);t!==-1&&A.splice(t,1)}}}const j=({children:e,defaultOpen:t=!0,keyboardShortcut:n=!0,mobileBreakpoint:r=`lg`,onOpenChange:i,onOpenMobileChange:a,open:s,openMobile:c})=>{let d=u(r),f=v(),p=s!=null,[m,g]=x(t),S=p?s:m,w=h(e=>{p||g(e),i?.(e)},[p,i]),T=c!=null,[E,O]=x(!1),k=T?c:E,A=h(e=>{T||O(e),a?.(e)},[T,a]),j=b(d);_(()=>{let e=j.current&&!d;j.current=d,e&&k&&A(!1)},[d,k,A]);let M=h(()=>{d?A(!k):w(!S)},[d,S,k,w,A]),N=l(M);_(()=>{if(!n)return;let e=te(),t=o(),r=n=>{if(!e.isOwner()||ee(n.target))return;let r=t?n.metaKey:n.ctrlKey,i=t?n.ctrlKey:n.metaKey;n.key.toLowerCase()===`b`&&r&&!i&&!n.altKey&&!n.shiftKey&&(n.preventDefault(),N())};return window.addEventListener(`keydown`,r),()=>{window.removeEventListener(`keydown`,r),e.release()}},[n,N]);let P=y(()=>({isMobile:d,mobileBreakpoint:r,navId:f,open:S,openMobile:k,setOpen:w,setOpenMobile:A,toggle:M}),[d,r,f,S,k,w,A,M]);return C(D.Provider,{value:P,children:e})},M=({"aria-label":n,"aria-labelledby":r,children:a,className:o,"data-slot":s,...l})=>{let{isMobile:u,mobileBreakpoint:d,navId:f,open:p,openMobile:m,setOpenMobile:h}=k(`Nav`),g=i(),_=n??(r==null?`Main`:void 0);return u?C(c.Root,{open:m,onOpenChange:h,children:w(c.Content,{side:`left`,preferredWidth:`sm:max-w-[var(--sidebar-width-mobile,18rem)]`,"data-slot":t(s,`sidebar-nav`),"data-mobile":``,...r==null?null:{"aria-labelledby":r},className:e(`bg-base w-[var(--sidebar-width-mobile,18rem)] max-w-full p-0`,o),...l,children:[C(c.Title,{className:`sr-only`,children:_??`Sidebar`}),C(`nav`,{id:f,"aria-label":_,"aria-labelledby":r,className:`flex h-full w-full min-w-0 flex-col text-sm`,children:a})]})}):C(`div`,{"data-slot":t(s,`sidebar-nav`),"data-state":p?`expanded`:`collapsed`,"data-hydrated":g?``:void 0,className:e(`group/sidebar-nav bg-base relative h-full w-[var(--sidebar-width,16rem)] shrink-0 overflow-hidden`,`data-[state=collapsed]:w-[var(--sidebar-width-icon,3.25rem)]`,!g&&E[d],g&&[`transition-[width] duration-200 ease-linear motion-reduce:transition-none`],o),...l,children:C(`nav`,{id:f,"aria-label":_,"aria-labelledby":r,className:`absolute inset-y-0 left-0 flex w-full min-w-0 flex-col text-sm`,children:a})})},N=C(T,{}),P=({appearance:e=`ghost`,"data-slot":n,icon:i=N,intent:a=`neutral`,label:o=`Toggle Sidebar`,onClick:s,...c})=>{let{isMobile:l,navId:u,open:d,openMobile:f,toggle:p}=k(`Trigger`),m=l?f:d;return C(r,{appearance:e,"aria-controls":!l||f?u:void 0,"aria-expanded":m,"data-slot":t(n,`sidebar-trigger`),"data-state":m?`expanded`:`collapsed`,icon:i,intent:a,label:o,onClick:e=>{s?.(e),e.defaultPrevented||p()},...c})},F=({asChild:r,children:i,className:a,"data-slot":o,...s})=>C(r?n:`div`,{"data-slot":t(o,`sidebar-header`),className:e(`flex h-[var(--sidebar-header-height,4.5rem)] shrink-0 flex-col justify-center gap-2 px-3`,`group-data-[state=expanded]/sidebar-nav:pr-1`,a),...s,children:i}),I=({asChild:r,children:i,className:a,"data-slot":o,...s})=>C(r?n:`div`,{"data-slot":t(o,`sidebar-body`),className:e(`scrollbar scrollbar-gutter-stable scroll-fade-y flex-1 scroll-py-6 space-y-2 overflow-y-auto overflow-x-hidden px-3 pt-1.5 pb-4`,`group-data-[state=expanded]/sidebar-nav:pr-1`,`group-data-[state=collapsed]/sidebar-nav:scrollbar-none`,`group-data-[state=collapsed]/sidebar-nav:scrollbar-gutter-auto`,`group-data-[state=collapsed]/sidebar-nav:[&::-webkit-scrollbar]:hidden`,a),...s,children:i}),L=({asChild:r,children:i,className:a,"data-slot":o,...s})=>C(r?n:`div`,{"data-slot":t(o,`sidebar-footer`),className:e(`shrink-0 px-3 pt-3 pb-3.5`,`group-data-[state=expanded]/sidebar-nav:pr-1`,a),...s,children:i}),R=p(null),z=({asChild:r,children:i,className:a,"data-slot":o,...s})=>{let[c,l]=x(null),u=y(()=>({mountedLabelId:c,setMountedLabelId:l}),[c]),d=r?n:`div`;return C(R.Provider,{value:u,children:C(d,{"data-slot":t(o,`sidebar-group`),className:e(`pt-0.5`,a),...s,children:i})})},B=({asChild:r,children:i,className:a,"data-slot":o,id:s,...c})=>{let l=g(R),u=v(),d=s??(l==null?void 0:u),f=l?.setMountedLabelId;return _(()=>{if(f!=null&&d!=null)return f(d),()=>{f(null)}},[f,d]),C(r?n:`div`,{id:d,"data-slot":t(o,`sidebar-group-label`),className:e(`text-muted flex min-w-0 items-center gap-2 truncate px-2 py-1 text-xs font-medium`,`group-data-[state=collapsed]/sidebar-nav:opacity-0`,`group-data-[state=collapsed]/sidebar-nav:pointer-events-none`,`group-data-[hydrated]/sidebar-nav:transition-opacity group-data-[hydrated]/sidebar-nav:duration-200 group-data-[hydrated]/sidebar-nav:ease-linear group-data-[hydrated]/sidebar-nav:motion-reduce:transition-none`,a),...c,children:i})},V=({"aria-labelledby":r,asChild:i,children:a,className:o,"data-slot":s,...c})=>{let l=g(R);return C(i?n:`ul`,{"aria-labelledby":r??l?.mountedLabelId??void 0,"data-slot":t(s,`sidebar-list`),className:e(`mb-2 space-y-px`,o),...c,children:a})},H=({asChild:r,children:i,className:a,"data-slot":o,...s})=>C(r?n:`li`,{"data-slot":t(o,`sidebar-item`),className:e(`list-none`,a),...s,children:i}),U=({asChild:r,children:i,className:a,current:o,"data-slot":s,type:c,...l})=>C(r?n:`button`,{"data-slot":t(s,`sidebar-item-button`),"data-current":o?``:void 0,"aria-current":o?`page`:void 0,type:r?c:c??`button`,className:e(`ring-focus-accent flex w-full min-w-0 items-center gap-2 truncate rounded-md px-2 py-1 text-left font-normal transition-none focus:outline-hidden focus-visible:ring-4`,`text-body hover:text-strong hover:bg-neutral-500/10`,`data-current:bg-neutral-500/15 data-current:text-strong`,`aria-[current=page]:bg-neutral-500/15 aria-[current=page]:text-strong`,`data-state-open:bg-neutral-500/15 data-state-open:text-strong`,`[&>svg]:text-muted hover:[&>svg]:text-strong data-current:[&>svg]:text-strong aria-[current=page]:[&>svg]:text-strong [&>svg:first-child]:size-5 [&>svg]:shrink-0`,`group-data-[state=collapsed]/sidebar-nav:ml-1`,`group-data-[state=collapsed]/sidebar-nav:w-7`,`group-data-[state=collapsed]/sidebar-nav:p-1`,a),...l,children:i}),W=({asChild:r,children:i,className:a,"data-slot":o,type:s,...c})=>C(r?n:`button`,{"data-slot":t(o,`sidebar-switcher-trigger`),type:r?s:s??`button`,className:e(`text-body hover:text-strong hover:bg-neutral-500/10 flex w-full min-w-0 items-center gap-2 [border-radius:0.625rem] py-1 pr-1.5 pl-1 text-left font-medium transition-none`,`data-state-open:bg-neutral-500/15 data-state-open:text-strong`,`ring-focus-accent focus:outline-hidden focus-visible:ring-4`,`[&>:first-child]:size-7`,`group-data-[state=collapsed]/sidebar-nav:w-9`,`group-data-[state=collapsed]/sidebar-nav:p-1`,`group-data-[state=collapsed]/sidebar-nav:[&>:not(:first-child)]:sr-only`,a),...c,children:i}),G=({children:e,"data-slot":n,label:r,side:i=`right`,...a})=>{let{isMobile:o,open:s}=k(`Tooltip`),c=!o&&!s;return w(d.Root,{children:[C(d.Trigger,{asChild:!0,children:e}),c&&C(d.Content,{"data-slot":t(n,`sidebar-tooltip`),side:i,...a,children:r})]})},K=({className:n,"data-slot":r,...i})=>C(a,{"data-slot":t(r,`sidebar-separator`),className:e(`my-3`,`group-data-[state=collapsed]/sidebar-nav:w-9`,n),...i}),q=[`bg-emerald-500`,`bg-gray-500`,`bg-red-500`,`bg-violet-500`,`bg-cyan-500`,`bg-rose-500`,`bg-purple-500`,`bg-fuchsia-500`,`bg-green-500`,`bg-orange-500`,`bg-indigo-500`,`bg-teal-500`,`bg-yellow-500`,`bg-sky-500`,`bg-pink-500`,`bg-blue-500`,`bg-amber-500`];function J(e){let t=5381;for(let n=0;n<e.length;n+=1)t=t*33^e.charCodeAt(n);return t>>>0}function Y(e){let t=J(e??``)%q.length;return q[t]??`bg-neutral-500`}function X(e){return(e??``).replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>{}[\]\\/]/gi,``).trim().split(` `).map(e=>e.trim()).filter(e=>e.length>0).slice(0,2).map(e=>Array.from(e)[0]??``).join(``).toUpperCase()||`?`}const Z=({accountId:r,accountName:i,asChild:a,children:o,className:s,"data-slot":c,...l})=>{let u=a?n:`div`,d=X(i);return a&&S(m(o),"When using `asChild`, Sidebar.AccountAvatar must be passed a single child as a JSX tag."),C(u,{"data-slot":t(c,`sidebar-account-avatar`),className:e(`text-static-white flex size-7 shrink-0 items-center justify-center rounded-md text-xs font-medium`,Y(r),s),"aria-hidden":`true`,...l,children:m(o)?f(o,{},d):d})},ne=({className:t,...n})=>w(`svg`,{className:e(`block size-full`,t),viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,...n,children:[C(`circle`,{cx:`12`,cy:`12`,r:`12`,opacity:.15}),C(`circle`,{cx:`12`,cy:`10`,r:`3.5`}),C(`path`,{d:`M5.25 19.5C6.6 16.7 9.1 15 12 15s5.4 1.7 6.75 4.5A12 12 0 0 1 12 22a12 12 0 0 1-6.75-2.5Z`})]}),re={Root:j,Nav:M,Trigger:P,Header:F,Body:I,Footer:L,Group:z,GroupLabel:B,List:V,Item:H,ItemButton:U,SwitcherTrigger:W,Tooltip:G,Separator:K,AccountAvatar:Z,UserAvatar:({alt:r=`Your account`,asChild:i,children:a,className:o,"data-slot":s,src:c,...l})=>{let u=i?n:`div`,d=c?C(`img`,{src:c,alt:r,className:`size-full object-cover`}):C(ne,{});return i&&S(m(a),"When using `asChild`, Sidebar.UserAvatar must be passed a single child as a JSX tag."),C(u,{"data-slot":t(s,`sidebar-user-avatar`),className:e(`text-muted bg-neutral-500/15 relative flex size-7 shrink-0 items-center justify-center overflow-hidden rounded-full`,o),role:c?void 0:`img`,"aria-label":c?void 0:r,...l,children:m(a)?f(a,{},d):d})}},Q=`mantle-sidebar-state`,$={collapsed:`collapsed`,expanded:`expanded`};function ie(e){let t=s(e,Q);if(t===$.expanded)return!0;if(t===$.collapsed)return!1}function ae(e,t={}){let{domain:n,maxAge:r=31536e3,path:i=`/`,sameSite:a=`Lax`,secure:o=!1}=t,s=e?$.expanded:$.collapsed,c=[`${Q}=${s}`,`Max-Age=${r}`,`Path=${i}`];return n!=null&&c.push(`Domain=${n}`),c.push(`SameSite=${a}`),o&&c.push(`Secure`),c.join(`; `)}export{Q as SIDEBAR_STATE_COOKIE_NAME,re as Sidebar,ie as extractSidebarStateCookie,ae as serializeSidebarStateCookie,O as useSidebar};
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./slot-DpNWVci8.js";import{t as r}from"./button-CCkGqE1t.js";import{t as i}from"./use-is-hydrated-DDCqXmju.js";import{n as a}from"./separator-D0D6VyyM.js";import{n as o,t as s}from"./use-is-apple-platform-Cxwrb86L.js";import{t as c}from"./use-callback-ref-IYti9y7x.js";import{n as l}from"./cookie-ca4g5CKp.js";import{t as u}from"./sheet-BOSknSN9.js";import{r as d}from"./use-breakpoint-Dqu12Szq.js";import{t as f}from"./tooltip-Dnu35cjU.js";import{createContext as p,useCallback as m,useContext as h,useEffect as g,useId as _,useMemo as v,useRef as y,useState as b}from"react";import x from"tiny-invariant";import{Fragment as S,jsx as C,jsxs as w}from"react/jsx-runtime";import{SidebarSimpleIcon as T}from"@phosphor-icons/react/SidebarSimple";const E={sm:`hidden sm:block`,md:`hidden md:block`,lg:`hidden lg:block`},D=p(null);function O(){let e=h(D);return x(e,`useSidebar must be used within Sidebar.Root.`),e}function k(e){let t=h(D);return x(t,`Sidebar.${e} must be rendered inside Sidebar.Root.`),t}const A=[];function j(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.tagName===`SELECT`:!1}function M(){let e=Symbol(`sidebar-keyboard-shortcut`);return A.push(e),{isOwner:()=>A[0]===e,release:()=>{let t=A.indexOf(e);t!==-1&&A.splice(t,1)}}}const N=({children:e,defaultOpen:t=!0,keyboardShortcut:n=!0,mobileBreakpoint:r=`lg`,onOpenChange:i,onOpenMobileChange:a,open:s,openMobile:l})=>{let u=d(r),f=_(),p=s!=null,[h,x]=b(t),S=p?s:h,w=m(e=>{p||x(e),i?.(e)},[p,i]),T=l!=null,[E,O]=b(!1),k=T?l:E,A=m(e=>{T||O(e),a?.(e)},[T,a]),N=y(u);g(()=>{let e=N.current&&!u;N.current=u,e&&k&&A(!1)},[u,k,A]);let P=m(()=>{u?A(!k):w(!S)},[u,S,k,w,A]),F=c(P);g(()=>{if(!n)return;let e=M(),t=o(),r=n=>{if(!e.isOwner()||j(n.target))return;let r=t?n.metaKey:n.ctrlKey,i=t?n.ctrlKey:n.metaKey;n.key.toLowerCase()===`b`&&r&&!i&&!n.altKey&&!n.shiftKey&&(n.preventDefault(),F())};return window.addEventListener(`keydown`,r),()=>{window.removeEventListener(`keydown`,r),e.release()}},[n,F]);let I=v(()=>({isMobile:u,keyboardShortcut:n,mobileBreakpoint:r,navId:f,open:S,openMobile:k,setOpen:w,setOpenMobile:A,toggle:P}),[u,n,r,f,S,k,w,A,P]);return C(D.Provider,{value:I,children:e})},P=({"aria-label":n,"aria-labelledby":r,children:a,className:o,"data-slot":s,...c})=>{let{isMobile:l,mobileBreakpoint:d,navId:f,open:p,openMobile:m,setOpenMobile:h}=k(`Nav`),g=i(),_=n??(r==null?`Main`:void 0);return l?C(u.Root,{open:m,onOpenChange:h,children:w(u.Content,{side:`left`,preferredWidth:`sm:max-w-(--sidebar-width-mobile,18rem)`,"data-slot":t(s,`sidebar-nav`),"data-mobile":``,...r==null?null:{"aria-labelledby":r},className:e(`bg-base w-(--sidebar-width-mobile,18rem) max-w-full p-0`,o),...c,children:[C(u.Title,{className:`sr-only`,children:_??`Sidebar`}),C(`nav`,{id:f,"aria-label":_,"aria-labelledby":r,className:`flex h-full w-full min-w-0 flex-col text-sm`,children:a})]})}):C(`div`,{"data-slot":t(s,`sidebar-nav`),"data-state":p?`expanded`:`collapsed`,"data-hydrated":g?``:void 0,className:e(`group/sidebar-nav bg-base relative h-full w-(--sidebar-width,16rem) shrink-0 overflow-hidden`,`data-[state=collapsed]:w-(--sidebar-width-icon,3.25rem)`,!g&&E[d],g&&[`transition-[width] duration-200 ease-linear motion-reduce:transition-none`],o),...c,children:C(`nav`,{id:f,"aria-label":_,"aria-labelledby":r,className:`absolute inset-y-0 left-0 flex w-full min-w-0 flex-col text-sm`,children:a})})},F=C(T,{}),I=({label:e,shortcut:t})=>t==null?e:w(`span`,{className:`flex items-center gap-1.5`,children:[e,C(`span`,{"aria-hidden":!0,className:`inline-flex shrink-0 items-center gap-0.5 [&_kbd]:h-4 [&_kbd]:min-w-4 [&_kbd]:bg-neutral-500/25 [&_kbd]:px-0.5 [&_kbd]:text-xs`,children:t})]}),L=({appearance:e=`ghost`,"data-slot":n,icon:i=F,intent:a=`neutral`,label:o=`Toggle Sidebar`,onClick:c,shortcut:l,...u})=>{let{isMobile:d,keyboardShortcut:p,navId:m,open:h,openMobile:g,toggle:_}=k(`Trigger`),v=s(),y=d?g:h,b=!d||g,x=p?l:void 0,S=v?`Meta+B`:`Control+B`;return w(f.Root,{children:[C(f.Trigger,{asChild:!0,children:C(r,{appearance:e,"aria-controls":b?m:void 0,"aria-expanded":y,"aria-keyshortcuts":p?S:void 0,"data-slot":t(n,`sidebar-trigger`),"data-state":y?`expanded`:`collapsed`,icon:i,intent:a,label:o,onClick:e=>{c?.(e),e.defaultPrevented||_()},...u})}),C(f.Content,{"data-slot":`sidebar-trigger-tooltip`,children:C(I,{label:o,shortcut:x})})]})},R=({asChild:r,children:i,className:a,"data-slot":o,...s})=>C(r?n:`div`,{"data-slot":t(o,`sidebar-header`),className:e(`flex h-(--sidebar-header-height,4.5rem) shrink-0 flex-col justify-center gap-2 px-3`,`group-data-[state=expanded]/sidebar-nav:pr-1`,a),...s,children:i}),z=({asChild:r,children:i,className:a,"data-slot":o,...s})=>C(r?n:`div`,{"data-slot":t(o,`sidebar-body`),className:e(`scrollbar scrollbar-gutter-stable scroll-fade-y flex-1 scroll-py-6 space-y-2 overflow-y-auto overflow-x-hidden px-3 pt-1.5 pb-4`,`group-data-[state=expanded]/sidebar-nav:pr-1`,`group-data-[state=collapsed]/sidebar-nav:scrollbar-none`,`group-data-[state=collapsed]/sidebar-nav:scrollbar-gutter-auto`,`group-data-[state=collapsed]/sidebar-nav:[&::-webkit-scrollbar]:hidden`,a),...s,children:i}),B=({asChild:r,children:i,className:a,"data-slot":o,...s})=>C(r?n:`div`,{"data-slot":t(o,`sidebar-footer`),className:e(`shrink-0 px-3 pt-3 pb-3.5`,`group-data-[state=expanded]/sidebar-nav:pr-1`,a),...s,children:i}),V=p(null),H=({asChild:r,children:i,className:a,"data-slot":o,...s})=>{let[c,l]=b(null),u=v(()=>({mountedLabelId:c,setMountedLabelId:l}),[c]),d=r?n:`div`;return C(V.Provider,{value:u,children:C(d,{"data-slot":t(o,`sidebar-group`),className:e(`pt-0.5`,a),...s,children:i})})},U=({asChild:r,children:i,className:a,"data-slot":o,id:s,...c})=>{let l=h(V),u=_(),d=s??(l==null?void 0:u),f=l?.setMountedLabelId;return g(()=>{if(f!=null&&d!=null)return f(d),()=>{f(null)}},[f,d]),C(r?n:`div`,{id:d,"data-slot":t(o,`sidebar-group-label`),className:e(`text-muted flex min-w-0 items-center gap-2 truncate px-2 py-1 text-xs font-medium`,`group-data-[state=collapsed]/sidebar-nav:opacity-0`,`group-data-[state=collapsed]/sidebar-nav:pointer-events-none`,`group-data-hydrated/sidebar-nav:transition-opacity group-data-hydrated/sidebar-nav:duration-200 group-data-hydrated/sidebar-nav:ease-linear group-data-hydrated/sidebar-nav:motion-reduce:transition-none`,a),...c,children:i})},W=({"aria-labelledby":r,asChild:i,children:a,className:o,"data-slot":s,...c})=>{let l=h(V);return C(i?n:`ul`,{"aria-labelledby":r??l?.mountedLabelId??void 0,"data-slot":t(s,`sidebar-list`),className:e(`mb-2 space-y-px`,o),...c,children:a})},G=({asChild:r,children:i,className:a,"data-slot":o,...s})=>C(r?n:`li`,{"data-slot":t(o,`sidebar-item`),className:e(`list-none`,a),...s,children:i}),K=[`ring-focus-accent flex w-full min-w-0 items-center gap-2 truncate rounded-md px-2 py-1 text-left font-normal transition-none focus:outline-hidden focus-visible:ring-4`,`text-body hover:text-strong hover:bg-neutral-500/10`,`data-state-open:bg-neutral-500/15 data-state-open:text-strong`,`group-data-[state=collapsed]/sidebar-nav:ml-1`,`group-data-[state=collapsed]/sidebar-nav:w-7`,`group-data-[state=collapsed]/sidebar-nav:p-1`],q={Root:N,Nav:P,Trigger:L,Header:R,Body:z,Footer:B,Group:H,GroupLabel:U,List:W,Item:G,ItemButton:({asChild:r,children:i,className:a,current:o,"data-slot":s,type:c,...l})=>C(r?n:`button`,{"data-slot":t(s,`sidebar-item-button`),"data-current":o?``:void 0,"aria-current":o?`page`:void 0,type:r?c:c??`button`,className:e(K,`data-current:bg-neutral-500/15 data-current:text-strong`,`aria-[current=page]:bg-neutral-500/15 aria-[current=page]:text-strong`,`[&>svg]:text-muted hover:[&>svg]:text-strong data-current:[&>svg]:text-strong aria-[current=page]:[&>svg]:text-strong [&>svg:first-child]:size-5 [&>svg]:shrink-0`,a),...l,children:i}),SearchTrigger:({asChild:r,children:i,className:a,"data-slot":o,shortcut:s,type:c,...l})=>{let u=r?n:`button`,d=s==null?i:w(S,{children:[i,C(`span`,{"aria-hidden":!0,className:e(`pointer-events-none -mr-1 ml-auto inline-flex shrink-0 items-center gap-0.5 opacity-0 select-none`,`group-hover:opacity-100 group-focus-visible:opacity-100`,`group-data-[state=collapsed]/sidebar-nav:hidden`,`[&_kbd]:text-body [&_kbd]:h-5 [&_kbd]:min-w-5 [&_kbd]:bg-neutral-500/20 [&_kbd]:px-1 [&_kbd]:text-xs [&_kbd]:font-normal`),children:s})]});return C(u,{"data-slot":t(o,`sidebar-search-trigger`),type:r?c:c??`button`,className:e(`group`,K,`[&>svg:first-child]:text-muted hover:[&>svg:first-child]:text-strong [&>svg:first-child]:size-5 [&>svg]:shrink-0`,a),...l,children:d})},SwitcherTrigger:({asChild:r,children:i,className:a,"data-slot":o,type:s,...c})=>C(r?n:`button`,{"data-slot":t(o,`sidebar-switcher-trigger`),type:r?s:s??`button`,className:e(`text-body hover:text-strong hover:bg-neutral-500/10 flex w-full min-w-0 items-center gap-2 rounded-[0.625rem] py-1 pr-1.5 pl-1 text-left font-medium transition-none`,`data-state-open:bg-neutral-500/15 data-state-open:text-strong`,`ring-focus-accent focus:outline-hidden focus-visible:ring-4`,`*:first:size-7`,`group-data-[state=collapsed]/sidebar-nav:w-9`,`group-data-[state=collapsed]/sidebar-nav:p-1`,`group-data-[state=collapsed]/sidebar-nav:[&>:not(:first-child)]:sr-only`,a),...c,children:i}),Tooltip:({children:e,"data-slot":n,label:r,shortcut:i,side:a=`right`,...o})=>{let{isMobile:s,open:c}=k(`Tooltip`),l=!s&&!c,[u,d]=b(!1),[p,m]=b(l);return p!==l&&(m(l),d(!1)),w(f.Root,{disableHoverableContent:!0,onOpenChange:e=>{d(e&&l)},open:l&&u,children:[C(f.Trigger,{asChild:!0,children:e}),C(f.Content,{"data-slot":t(n,`sidebar-tooltip`),side:a,...o,children:C(I,{label:r,shortcut:i})})]})},Separator:({className:n,"data-slot":r,...i})=>C(a,{"data-slot":t(r,`sidebar-separator`),className:e(`my-3`,`group-data-[state=collapsed]/sidebar-nav:w-9`,n),...i})},J=`mantle-sidebar-state`,Y={collapsed:`collapsed`,expanded:`expanded`};function X(e){let t=l(e,J);if(t===Y.expanded)return!0;if(t===Y.collapsed)return!1}function Z(e,t={}){let{domain:n,maxAge:r=31536e3,path:i=`/`,sameSite:a=`Lax`,secure:o=!1}=t,s=e?Y.expanded:Y.collapsed,c=[`${J}=${s}`,`Max-Age=${r}`,`Path=${i}`];return n!=null&&c.push(`Domain=${n}`),c.push(`SameSite=${a}`),o&&c.push(`Secure`),c.join(`; `)}export{J as SIDEBAR_STATE_COOKIE_NAME,q as Sidebar,X as extractSidebarStateCookie,Z as serializeSidebarStateCookie,O as useSidebar};
|
package/dist/slider.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ type SliderBaseProps = Omit<ComponentProps<typeof SliderPrimitive.Root>, "defaul
|
|
|
5
5
|
/**
|
|
6
6
|
* Value props for the {@link Slider} component. Either both `defaultValue` and
|
|
7
7
|
* `value` must be the same type (both `number` or both `number[]`), or only one
|
|
8
|
-
* may be
|
|
8
|
+
* may be set.
|
|
9
9
|
*/
|
|
10
10
|
type SliderValueProps = {
|
|
11
11
|
/**
|
package/dist/split-button.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as Button } from "./button-
|
|
2
|
-
import { t as IconButton } from "./button-
|
|
1
|
+
import { t as Button } from "./button-PoIujPMX.js";
|
|
2
|
+
import { t as IconButton } from "./button-DJ7AAgII.js";
|
|
3
3
|
import { t as ButtonSize } from "./button-BCoI4bhP.js";
|
|
4
|
-
import { t as DropdownMenu } from "./dropdown-menu-
|
|
4
|
+
import { t as DropdownMenu } from "./dropdown-menu-DZOfj6HB.js";
|
|
5
5
|
import { ComponentProps, ReactNode } from "react";
|
|
6
6
|
//#region src/components/split-button/split-button.d.ts
|
|
7
7
|
type RootProps = ComponentProps<typeof DropdownMenu.Root> & ComponentProps<"div"> & {
|
|
@@ -14,9 +14,9 @@ type RootProps = ComponentProps<typeof DropdownMenu.Root> & ComponentProps<"div"
|
|
|
14
14
|
size?: ButtonSize;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
* A button group
|
|
18
|
-
* related alternatives
|
|
19
|
-
*
|
|
17
|
+
* A button group that pairs a one-click default action with a dropdown menu
|
|
18
|
+
* of related alternatives. Best for when users typically want one action but
|
|
19
|
+
* occasionally need variants.
|
|
20
20
|
*
|
|
21
21
|
* @see https://mantle.ngrok.com/components/actions/split-button#splitbuttonroot
|
|
22
22
|
*
|
|
@@ -162,9 +162,9 @@ declare const MenuContent: ({ align, ...props }: ComponentProps<typeof DropdownM
|
|
|
162
162
|
*/
|
|
163
163
|
declare const MenuItem: ({ className, ...props }: ComponentProps<typeof DropdownMenu.Item>) => import("react").JSX.Element;
|
|
164
164
|
/**
|
|
165
|
-
* A button group
|
|
166
|
-
* related alternatives
|
|
167
|
-
*
|
|
165
|
+
* A button group that pairs a one-click default action with a dropdown menu
|
|
166
|
+
* of related alternatives. Best for when users typically want one action but
|
|
167
|
+
* occasionally need variants.
|
|
168
168
|
*
|
|
169
169
|
* @see https://mantle.ngrok.com/components/actions/split-button
|
|
170
170
|
*
|
|
@@ -202,9 +202,9 @@ declare const MenuItem: ({ className, ...props }: ComponentProps<typeof Dropdown
|
|
|
202
202
|
*/
|
|
203
203
|
declare const SplitButton: {
|
|
204
204
|
/**
|
|
205
|
-
* A button group
|
|
206
|
-
* related alternatives
|
|
207
|
-
*
|
|
205
|
+
* A button group that pairs a one-click default action with a dropdown menu
|
|
206
|
+
* of related alternatives. Best for when users typically want one action but
|
|
207
|
+
* occasionally need variants.
|
|
208
208
|
*
|
|
209
209
|
* @see https://mantle.ngrok.com/components/actions/split-button#splitbuttonroot
|
|
210
210
|
*
|
package/dist/split-button.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-lZ48P8Nn.js";import{t as n}from"./button-Cnja9Bsr.js";import{t as r}from"./button-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-lZ48P8Nn.js";import{t as n}from"./button-Cnja9Bsr.js";import{t as r}from"./button-CCkGqE1t.js";import{t as i}from"./dropdown-menu-BRH0Wd_z.js";import{CaretDownIcon as a}from"@phosphor-icons/react/CaretDown";import{createContext as o,useContext as s,useMemo as c}from"react";import{jsx as l}from"react/jsx-runtime";const u=o({size:`md`}),d={Root:({className:t,children:n,dir:r,open:a,defaultOpen:o,onOpenChange:s,modal:d,size:f=`md`,ref:p,...m})=>{let h=c(()=>({size:f}),[f]);return l(i.Root,{dir:r,open:a,defaultOpen:o,onOpenChange:s,modal:d,children:l(u.Provider,{value:h,children:l(`div`,{"data-slot":`split-button`,"data-size":f,className:e(`flex flex-row [&>*:first-child]:rounded-r-none [&>*:last-child]:rounded-l-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:not(:first-child)]:-ml-px [&>*:focus]:relative [&>*:focus]:z-10 [&>*:hover]:relative [&>*:hover]:z-10 *:active:scale-100!`,t),ref:p,...m,children:n})})})},PrimaryAction:e=>{let{size:t}=s(u);return l(n,{appearance:`outlined`,intent:`neutral`,size:t,...e})},MenuTrigger:({icon:e,...n})=>{let{size:o}=s(u);return l(i.Trigger,{asChild:!0,className:`group`,children:l(r,{icon:e??l(t,{svg:l(a,{weight:`bold`,className:`size-4 group-data-[state=open]:-rotate-180 transition-transform ease-out duration-150`})}),appearance:`outlined`,intent:`neutral`,size:o,...n})})},MenuContent:({align:e=`end`,...t})=>l(i.Content,{align:e,...t}),MenuItem:({className:t,...n})=>l(i.Item,{className:e(`gap-2`,t),...n})};export{d as SplitButton};
|
package/dist/switch.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ type SwitchProps = ComponentProps<typeof Root> & WithValidation & {
|
|
|
9
9
|
readOnly?: boolean;
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
|
-
* A form control that
|
|
12
|
+
* A form control that toggles one setting on or off. Unlike `Checkbox`, it has no
|
|
13
|
+
* indeterminate state.
|
|
13
14
|
*
|
|
14
15
|
* Pair it with a [`Label`](/components/forms/label) for a single-line caption, or
|
|
15
16
|
* compose it inside [`Choice`](/components/forms/choice) for a titled, multi-line
|
|
@@ -1 +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={Body:({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}),Caption:({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}),Cell:({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}),Element:({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}),Foot:({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}),Head:({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}),Header:({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}),Root:({children:n,className:r,ref:i,...a})=>{let s=c();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})})},Row:({children:e,
|
|
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={Body:({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}),Caption:({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}),Cell:({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}),Element:({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}),Foot:({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}),Head:({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}),Header:({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}),Root:({children:n,className:r,ref:i,...a})=>{let s=c();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})})},Row:({children:e,ref:t,...n})=>o(`tr`,{"data-slot":`table-row`,ref:t,...n,children:e})};function c(){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{s as t};
|
|
@@ -2,8 +2,8 @@ import { ComponentProps } from "react";
|
|
|
2
2
|
//#region src/components/table/table.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* The `<Table.Root>` is the root container element for all `Table`s.
|
|
5
|
-
* It
|
|
6
|
-
*
|
|
5
|
+
* It draws the border and rounded corners, and scrolls wide content
|
|
6
|
+
* horizontally with a fading scroll edge.
|
|
7
7
|
*
|
|
8
8
|
* Must be used as the parent of a `<Table.Element>`.
|
|
9
9
|
*
|
|
@@ -40,6 +40,16 @@ import { ComponentProps } from "react";
|
|
|
40
40
|
* </Table.Root>
|
|
41
41
|
* ```
|
|
42
42
|
*
|
|
43
|
+
* Data attributes it stamps on the outer element, for your own CSS to target:
|
|
44
|
+
*
|
|
45
|
+
* - `data-x-overflow="true" | "false"` — whether the content is wider than the
|
|
46
|
+
* container. Always present, so match the value, not the attribute.
|
|
47
|
+
* - `data-x-scroll-end="true" | "false"` — whether an overflowing container is
|
|
48
|
+
* scrolled to its right edge. Always present.
|
|
49
|
+
* - `data-sticky-active` — present only while the container overflows and is not
|
|
50
|
+
* scrolled to the end. `DataTable`'s pinned action column keys its shadow off
|
|
51
|
+
* this through `group-data-sticky-active/table:`.
|
|
52
|
+
*
|
|
43
53
|
* @see https://mantle.ngrok.com/components/data-display/table#tableroot
|
|
44
54
|
*/
|
|
45
55
|
declare const Root: ({ children, className, ref, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
@@ -295,11 +305,11 @@ declare const Foot: ({ children, className, ref, ...props }: ComponentProps<"tfo
|
|
|
295
305
|
*
|
|
296
306
|
* @see https://mantle.ngrok.com/components/data-display/table#tablerow
|
|
297
307
|
*/
|
|
298
|
-
declare const Row: ({ children,
|
|
308
|
+
declare const Row: ({ children, ref, ...props }: ComponentProps<"tr">) => import("react").JSX.Element;
|
|
299
309
|
/**
|
|
300
310
|
* The `<Table.Header>` defines a cell as the header of a group of table cells
|
|
301
|
-
* and may be used as a child of a `<Table.Row>`. The
|
|
302
|
-
*
|
|
311
|
+
* and may be used as a child of a `<Table.Row>`. The `scope` and `headers`
|
|
312
|
+
* attributes define the exact nature of this group.
|
|
303
313
|
*
|
|
304
314
|
* Must be used as a child of a `<Table.Row>`.
|
|
305
315
|
*
|
|
@@ -390,7 +400,7 @@ declare const Header: ({ children, className, ref, ...props }: ComponentProps<"t
|
|
|
390
400
|
declare const Cell: ({ children, className, ref, ...props }: ComponentProps<"td">) => import("react").JSX.Element;
|
|
391
401
|
/**
|
|
392
402
|
* The optional `<Table.Caption>` specifies the caption (or title) of a table,
|
|
393
|
-
*
|
|
403
|
+
* which gives the table an accessible description.
|
|
394
404
|
*
|
|
395
405
|
* If used, must be the first child of a `<Table.Element>`.
|
|
396
406
|
*
|
|
@@ -532,7 +542,7 @@ declare const Table: {
|
|
|
532
542
|
*/
|
|
533
543
|
readonly Body: typeof Body;
|
|
534
544
|
/**
|
|
535
|
-
* An optional caption
|
|
545
|
+
* An optional caption (or title) for a table, which gives the table an accessible description.
|
|
536
546
|
*
|
|
537
547
|
* @see https://mantle.ngrok.com/components/data-display/table#tablecaption
|
|
538
548
|
*
|
|
@@ -766,7 +776,7 @@ declare const Table: {
|
|
|
766
776
|
*/
|
|
767
777
|
readonly Header: typeof Header;
|
|
768
778
|
/**
|
|
769
|
-
* The root container element for all tables.
|
|
779
|
+
* The root container element for all tables. It draws the border and rounded corners, and scrolls wide content horizontally with a fading scroll edge.
|
|
770
780
|
*
|
|
771
781
|
* @see https://mantle.ngrok.com/components/data-display/table#tableroot
|
|
772
782
|
*
|
package/dist/table.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Table } from "./table-
|
|
1
|
+
import { t as Table } from "./table-D51ZtV4U.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-C_Nm_RSV.js";export{e as Table};
|
package/dist/tabs.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { Content, List, Root, Trigger } from "@radix-ui/react-tabs";
|
|
|
3
3
|
//#region src/components/tabs/tabs.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* A set of layered sections of content—known as tab panels—that are displayed one at a time.
|
|
6
|
-
* The
|
|
6
|
+
* The outermost part; it owns `orientation` and `appearance`. It stamps both as
|
|
7
|
+
* `data-orientation` and `data-appearance` for the parts below to style against.
|
|
7
8
|
*
|
|
8
9
|
* @see https://mantle.ngrok.com/components/navigation/tabs#tabsroot
|
|
9
10
|
*
|
|
@@ -33,7 +34,6 @@ declare const Root$1: ({ className, children, orientation, appearance, ...props
|
|
|
33
34
|
}) => import("react").JSX.Element;
|
|
34
35
|
/**
|
|
35
36
|
* Contains the triggers that are aligned along the edge of the active content.
|
|
36
|
-
* The container for tab triggers that provides the visual layout for tab navigation.
|
|
37
37
|
*
|
|
38
38
|
* By default a horizontal classic tablist draws a 1px bottom border in the
|
|
39
39
|
* `separator` color token, and a vertical classic tablist draws the matching
|
|
@@ -77,7 +77,6 @@ declare const List$1: ({ className, hideBorder, ref, ...props }: ComponentProps<
|
|
|
77
77
|
type TabsTriggerProps = ComponentProps<typeof Trigger>;
|
|
78
78
|
/**
|
|
79
79
|
* The button that activates its associated content.
|
|
80
|
-
* A clickable tab trigger that switches between different tab content panels.
|
|
81
80
|
*
|
|
82
81
|
* @see https://mantle.ngrok.com/components/navigation/tabs#tabstrigger
|
|
83
82
|
*
|
|
@@ -96,8 +95,7 @@ type TabsTriggerProps = ComponentProps<typeof Trigger>;
|
|
|
96
95
|
*/
|
|
97
96
|
declare const Trigger$1: ({ "aria-disabled": _ariaDisabled, asChild, children, className, disabled: _disabled, ref, ...props }: TabsTriggerProps) => import("react").JSX.Element;
|
|
98
97
|
/**
|
|
99
|
-
* A badge
|
|
100
|
-
* Typically used to show counts or status indicators within tab headers.
|
|
98
|
+
* A badge to render inside a tab trigger, typically a count or a status indicator.
|
|
101
99
|
*
|
|
102
100
|
* @see https://mantle.ngrok.com/components/navigation/tabs#tabsbadge
|
|
103
101
|
*
|
|
@@ -116,7 +114,7 @@ declare const Trigger$1: ({ "aria-disabled": _ariaDisabled, asChild, children, c
|
|
|
116
114
|
declare const Badge: ({ className, children, ...props }: HTMLAttributes<HTMLSpanElement>) => import("react").JSX.Element;
|
|
117
115
|
/**
|
|
118
116
|
* Contains the content associated with each trigger.
|
|
119
|
-
*
|
|
117
|
+
* It renders when that trigger is active.
|
|
120
118
|
*
|
|
121
119
|
* @see https://mantle.ngrok.com/components/navigation/tabs#tabscontent
|
|
122
120
|
*
|
|
@@ -139,7 +137,6 @@ declare const Badge: ({ className, children, ...props }: HTMLAttributes<HTMLSpan
|
|
|
139
137
|
declare const Content$1: ({ className, ...props }: ComponentProps<typeof Content>) => import("react").JSX.Element;
|
|
140
138
|
/**
|
|
141
139
|
* A set of layered sections of content—known as tab panels—that are displayed one at a time.
|
|
142
|
-
* The root component that provides context for all tab components.
|
|
143
140
|
*
|
|
144
141
|
* @see https://mantle.ngrok.com/components/navigation/tabs
|
|
145
142
|
*
|
|
@@ -171,8 +168,9 @@ declare const Content$1: ({ className, ...props }: ComponentProps<typeof Content
|
|
|
171
168
|
*/
|
|
172
169
|
declare const Tabs: {
|
|
173
170
|
/**
|
|
174
|
-
* The root container of the tabs component that provides context for all tab components.
|
|
175
171
|
* A set of layered sections of content—known as tab panels—that are displayed one at a time.
|
|
172
|
+
* The outermost part; it owns `orientation` and `appearance`. It stamps both as
|
|
173
|
+
* `data-orientation` and `data-appearance` for the parts below to style against.
|
|
176
174
|
*
|
|
177
175
|
* @see https://mantle.ngrok.com/components/navigation/tabs#tabsroot
|
|
178
176
|
*
|
|
@@ -192,7 +190,7 @@ declare const Tabs: {
|
|
|
192
190
|
readonly Root: typeof Root$1;
|
|
193
191
|
/**
|
|
194
192
|
* Contains the content associated with each trigger.
|
|
195
|
-
*
|
|
193
|
+
* It renders when that trigger is active.
|
|
196
194
|
*
|
|
197
195
|
* @see https://mantle.ngrok.com/components/navigation/tabs#tabscontent
|
|
198
196
|
*
|
|
@@ -211,7 +209,6 @@ declare const Tabs: {
|
|
|
211
209
|
readonly Content: typeof Content$1;
|
|
212
210
|
/**
|
|
213
211
|
* Contains the triggers that are aligned along the edge of the active content.
|
|
214
|
-
* The container for tab triggers that provides the visual layout for tab navigation.
|
|
215
212
|
*
|
|
216
213
|
* By default a classic tablist draws a 1px border in the `separator` color
|
|
217
214
|
* token (bottom border when horizontal, side border when vertical); pass
|
|
@@ -232,7 +229,6 @@ declare const Tabs: {
|
|
|
232
229
|
readonly List: typeof List$1;
|
|
233
230
|
/**
|
|
234
231
|
* The button that activates its associated content.
|
|
235
|
-
* A clickable tab trigger that switches between different tab content panels.
|
|
236
232
|
*
|
|
237
233
|
* @see https://mantle.ngrok.com/components/navigation/tabs#tabstrigger
|
|
238
234
|
*
|
|
@@ -248,8 +244,7 @@ declare const Tabs: {
|
|
|
248
244
|
*/
|
|
249
245
|
readonly Trigger: typeof Trigger$1;
|
|
250
246
|
/**
|
|
251
|
-
* A badge
|
|
252
|
-
* Typically used to show counts or status indicators within tab headers.
|
|
247
|
+
* A badge to render inside a tab trigger, typically a count or a status indicator.
|
|
253
248
|
*
|
|
254
249
|
* @see https://mantle.ngrok.com/components/navigation/tabs#tabsbadge
|
|
255
250
|
*
|
package/dist/tabs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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-Bk5zAfHY.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})})},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:
|
|
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-Bk5zAfHY.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})})},w=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]`),T=_(`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:w},{orientation:`vertical`,appearance:`classic`,hideBorder:!1,className:`border-r border-separator`}],defaultVariants:{hideBorder:!1}}),E=({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(T({orientation:s,appearance:c,hideBorder:r}),n),ref:e(d,a),...o})},D=_(`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`}}}),O=()=>{let{orientation:e,appearance:t}=l(S);return h(`span`,{"aria-hidden":!0,className:r(D({orientation:e,appearance:t}))})},k=_(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`)}}}),A={Root:C,Content:({className:e,...n})=>h(v,{"data-slot":`tabs-content`,className:t(`focus-visible:ring-focus-accent outline-hidden focus-visible:ring-4`,e),...n}),List:E,Trigger:({"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(k({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(O,{}),t]}))})}return g(x,{"data-slot":`tabs-trigger`,ref:d,...b,children:[h(O,{}),i]})},Badge:({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})};export{A as Tabs};
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
//#region src/components/theme/themes.d.ts
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The four concrete themes `"system"` resolves to.
|
|
4
4
|
*
|
|
5
5
|
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
6
6
|
*/
|
|
7
7
|
declare const resolvedThemes: readonly ["light", "dark", "light-high-contrast", "dark-high-contrast"];
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* One concrete theme, never `"system"`.
|
|
10
10
|
*
|
|
11
11
|
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
12
12
|
*/
|
|
13
13
|
type ResolvedTheme = (typeof resolvedThemes)[number];
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Every theme a consumer can set, including `"system"`.
|
|
16
16
|
*
|
|
17
17
|
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
18
18
|
*/
|
|
19
19
|
declare const themes: readonly ["system", "light", "dark", "light-high-contrast", "dark-high-contrast"];
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* One theme a consumer can set, including `"system"`.
|
|
22
22
|
*
|
|
23
23
|
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
24
24
|
*/
|
|
25
25
|
type Theme = (typeof themes)[number];
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* Narrows a theme literal to its own type instead of widening it to `Theme`.
|
|
28
28
|
*
|
|
29
29
|
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
30
30
|
*/
|
|
@@ -36,7 +36,7 @@ declare const $theme: <T extends Theme = Theme>(value: T) => T;
|
|
|
36
36
|
*/
|
|
37
37
|
declare function isTheme(value: unknown): value is Theme;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* Narrows a resolved-theme literal to its own type instead of widening it to `ResolvedTheme`.
|
|
40
40
|
*
|
|
41
41
|
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
42
42
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{n as t}from"./browser-only-CmEEzfU3.js";import{t as n}from"./use-matches-media-query-Bd_GhhVd.js";import{n as r,t as i}from"./cookie-ca4g5CKp.js";import{createContext as a,useContext as o,useEffect as s,useMemo as c,useRef as l,useState as u}from"react";import d from"tiny-invariant";import{jsx as f}from"react/jsx-runtime";const p=[`light`,`dark`,`light-high-contrast`,`dark-high-contrast`],m=[`system`,...p],h=e=>e;function g(e){return typeof e==`string`&&m.includes(e)}const _=e=>e;function v(e){return typeof e==`string`&&p.includes(e)}const y=`(prefers-color-scheme: dark)`,b=`(prefers-contrast: more)`,x=`mantle-ui-theme`,S=`system`,C=a([`system`,()=>null]);function w({children:e,forceTheme:n}){let[r,i]=u(()=>{let e=F({cookie:t()?document.cookie:null});return E(e,{forceTheme:n}),e}),a=l(null);s(()=>{function e(e){let t=e??F({cookie:document.cookie});i(t),E(t,{forceTheme:n})}e();try{`BroadcastChannel`in window&&(a.current=new BroadcastChannel(x),a.current.addEventListener(`message`,t=>{let n=t?.data?.theme;g(n)&&e(n)}))}catch{}function t(t){t.key===`${x}__ping`&&e()}window.addEventListener(`storage`,t);let r=window.matchMedia(y),o=window.matchMedia(b);function s(){e()}function c(){document.visibilityState===`visible`&&e()}return r.addEventListener(`change`,s),o.addEventListener(`change`,s),window.addEventListener(`pageshow`,s),document.addEventListener(`visibilitychange`,c),()=>{window.removeEventListener(`storage`,t),r.removeEventListener(`change`,s),o.removeEventListener(`change`,s),window.removeEventListener(`pageshow`,s),document.removeEventListener(`visibilitychange`,c);try{a.current?.close()}catch{}a.current=null}},[n]);let o=c(()=>[r,e=>{z(e),i(e),E(e,{forceTheme:n}),L(e,{broadcastChannel:a.current,pingKey:`${x}__ping`})}],[n,r]);return f(C.Provider,{value:o,children:e})}function T(){let e=o(C);return d(e,`useTheme must be used within a ThemeProvider`),e}function E(e,{forceTheme:n}={}){if(!t())return;let r=window.document.documentElement,i=window.matchMedia(y).matches,a=window.matchMedia(b).matches,o=n??O(e,{prefersDarkMode:i,prefersHighContrast:a}),s=r.dataset.theme,c=r.dataset.appliedTheme,l=g(s)?s:void 0,u=v(c)?c:void 0;(l!==e||u!==o)&&(r.classList.remove(...p),r.classList.add(o),r.dataset.theme=e,r.dataset.appliedTheme=o)}function D(){if(!t())return{appliedTheme:void 0,theme:void 0};let e=window.document.documentElement,n=g(e.dataset.theme)?e.dataset.theme:void 0;return{appliedTheme:v(e.dataset.appliedTheme)?e.dataset.appliedTheme:void 0,theme:n}}function O(e,{prefersDarkMode:t,prefersHighContrast:n}){return e===`system`?A({prefersDarkMode:t,prefersHighContrast:n}):e}function k(){let e=o(C);return O(e==null?`system`:e[0],{prefersDarkMode:n(y),prefersHighContrast:n(b)})}function A({prefersDarkMode:e,prefersHighContrast:t}){return t?e?`dark-high-contrast`:`light-high-contrast`:e?`dark`:`light`}function j(e){let{storageKey:t,defaultTheme:n,themes:r,resolvedThemes:i,prefersDarkModeMediaQuery:a,prefersHighContrastMediaQuery:o,forceTheme:s}=e;function c(e){return typeof e==`string`&&r.includes(e)}function l(e){let t=document.cookie;if(!t)return null;try{let n=t.split(`;`).find(t=>t.trim().startsWith(`${e}=`))?.trim().slice(e.length+1);return n?decodeURIComponent(n):null}catch{return null}}function u(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 d(e,t){try{document.cookie=u(e,t)}catch{}}function f(e,t,n){return e===`system`?n?t?`dark-high-contrast`:`light-high-contrast`:t?`dark`:`light`:e}let p=null,m=null,h=null;try{p=l(t)}catch{}if(c(p))h=p;else{try{m=window.localStorage?.getItem(t)??null}catch{}c(m)&&(h=m)}let g=c(h)?h:n,_=matchMedia(a).matches,v=matchMedia(o).matches,y=s??f(g,_,v),b=document.documentElement;if(b.dataset.appliedTheme!==y||b.dataset.theme!==g){for(let e of i)b.classList.remove(e);b.classList.add(y),b.dataset.theme=g,b.dataset.appliedTheme=y}let x=c(p);try{if(c(m)&&!x){d(t,m);try{window.localStorage.removeItem(t)}catch{}}else x||d(t,g)}catch{}}function M(e){let t={storageKey:x,defaultTheme:S,themes:m,resolvedThemes:p,prefersDarkModeMediaQuery:y,prefersHighContrastMediaQuery:b,forceTheme:e};return`(${j.toString()})(${JSON.stringify(t)})`}const N=({forceTheme:e,nonce:t})=>f(`script`,{dangerouslySetInnerHTML:{__html:M(e)},nonce:t,suppressHydrationWarning:!0});function P(n={}){let{className:r=``,forceTheme:i,ssrCookie:a}=n??{};return c(()=>{let n,o;if(!t())n=F({cookie:a}),o=O(n,{prefersDarkMode:!1,prefersHighContrast:!1});else{let e=window.matchMedia(y).matches,t=window.matchMedia(b).matches;n=F({cookie:document.cookie}),o=O(n,{prefersDarkMode:e,prefersHighContrast:t})}let s=i??o;return{className:e(r,s),"data-applied-theme":s,"data-theme":n}},[r,i,a])}function F({cookie:e}){if(!e)return S;let t=r(e,x);return g(t)?t:S}function I(e){return i(e,x)}function L(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 R(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`${x}=${encodeURIComponent(e)}; expires=${t.toUTCString()}; path=/${i}; SameSite=Lax${a}`}function z(e){if(t())try{document.cookie=R(e)}catch{}}export{M as a,P as c,h as d,v as f,m as h,F as i,T as l,p as m,w as n,D as o,g as p,I as r,k as s,N as t,_ as u};
|
package/dist/theme-switcher.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
|
|
2
2
|
import { t as WithStyleProps } from "./with-style-props-Dq5Vntqy.js";
|
|
3
|
-
import { n as IconButtonProps, r as IconButtonAppearance } from "./button-
|
|
4
|
-
import { t as DropdownMenu } from "./dropdown-menu-
|
|
5
|
-
import "./dropdown-menu-
|
|
3
|
+
import { n as IconButtonProps, r as IconButtonAppearance } from "./button-DJ7AAgII.js";
|
|
4
|
+
import { t as DropdownMenu } from "./dropdown-menu-DZOfj6HB.js";
|
|
5
|
+
import "./dropdown-menu-BcALUQMp.js";
|
|
6
6
|
import { ComponentProps } from "react";
|
|
7
7
|
//#region src/components/theme-switcher/theme-switcher.d.ts
|
|
8
8
|
/**
|
package/dist/theme-switcher.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./icon-lZ48P8Nn.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./button-
|
|
1
|
+
import{t as e}from"./icon-lZ48P8Nn.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./button-CCkGqE1t.js";import{t as r}from"./browser-only-CmEEzfU3.js";import{t as i}from"./dropdown-menu-BRH0Wd_z.js";import{d as a,h as o,l as s,p as c}from"./theme-CVfq037P.js";import{n as l,t as u}from"./icons-DEVx1oP9.js";import{t as d}from"./skeleton-BhcJMpem.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]=s();return f(i.RadioGroup,{"data-slot":`theme-dropdown-menu-radio-group`,className:t,style:n,value:r,onValueChange:e=>{c(e)&&u(e)},children:o.map(t=>p(i.RadioItem,{value:a(t),children:[f(e,{svg:f(l,{theme:t})}),m[t]]},t))})},g={Root:e=>f(i.Root,{...e}),Trigger:({appearance:e=`ghost`,"data-slot":a,disabled:o,label:s=`Change Theme`,ref:c,...l})=>f(i.Trigger,{asChild:!0,disabled:o,children:f(n,{ref:c,appearance:e,disabled:o,"data-slot":t(a,`theme-switcher-trigger`),intent:`neutral`,icon:f(r,{fallback:f(d,{className:`rounded-full size-5`}),children:()=>f(u,{className:`size-5`})}),label:s,...l})}),Content:({children:e,"data-slot":n,...r})=>f(i.Content,{"data-slot":t(n,`theme-switcher-content`),...r,children:e??f(h,{})})};export{h as ThemeDropdownMenuRadioGroup,g as ThemeSwitcher};
|