@ngrok/mantle 0.83.2 → 0.83.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.json +1 -1
- package/dist/{alert-BuG2qS5l.js → alert-BpXQVXqv.js} +1 -1
- package/dist/{alert-B1HXfkYn.d.ts → alert-C4AFlLXD.d.ts} +1 -1
- package/dist/alert-center.d.ts +1 -1
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +1 -1
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +1 -1
- package/dist/alert.js +1 -1
- package/dist/{anchor-3OGK2UKU.js → anchor-D2So_zuy.js} +1 -1
- package/dist/anchor.d.ts +8 -0
- package/dist/anchor.js +1 -1
- package/dist/badge.d.ts +7 -0
- package/dist/badge.js +1 -1
- package/dist/{button-PoIujPMX.d.ts → button-BH79w6HV.d.ts} +10 -0
- package/dist/{button-BIf69CSV.d.ts → button-Dic5ZH4w.d.ts} +1 -1
- package/dist/{button-Cnja9Bsr.js → button-hEoKi6ZG.js} +1 -1
- package/dist/button.d.ts +2 -2
- package/dist/button.js +1 -1
- package/dist/code-block.d.ts +19 -1
- package/dist/code-block.js +1 -1
- package/dist/code.d.ts +8 -0
- package/dist/code.js +1 -1
- package/dist/command.js +1 -1
- package/dist/data-table.d.ts +1 -1
- package/dist/data-table.js +1 -1
- package/dist/field.d.ts +1 -1
- package/dist/field.js +1 -1
- package/dist/hover-card.d.ts +54 -0
- package/dist/hover-card.js +1 -1
- package/dist/{kbd-K8iaZ-Ti.js → kbd-B9qmYaW8.js} +1 -1
- package/dist/kbd.d.ts +7 -1
- package/dist/kbd.js +1 -1
- package/dist/llms.txt +1 -1
- package/dist/pagination.d.ts +1 -1
- package/dist/popover-B1ZzHCym.js +1 -0
- package/dist/{popover-CE4OlWkd.d.ts → popover-C9fEVWL1.d.ts} +59 -0
- package/dist/popover.d.ts +1 -1
- package/dist/popover.js +1 -1
- package/dist/sandbar.d.ts +1 -1
- package/dist/sandbar.js +1 -1
- package/dist/skip-to-main-link.js +1 -1
- package/dist/split-button.d.ts +1 -1
- package/dist/split-button.js +1 -1
- package/package.json +1 -1
- package/dist/popover-CQ9s7jG5.js +0 -1
package/dist/agent.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-d-nMCfAI.js";import{t as n}from"./slot-DpNWVci8.js";import{t as r}from"./types-D85fCNV3.js";import{t as i}from"./button-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-d-nMCfAI.js";import{t as n}from"./slot-DpNWVci8.js";import{t as r}from"./types-D85fCNV3.js";import{t as i}from"./button-hEoKi6ZG.js";import{t as a}from"./button-CCkGqE1t.js";import{CaretDownIcon as o}from"@phosphor-icons/react/CaretDown";import{createContext as s,useContext as c,useMemo as l}from"react";import u from"tiny-invariant";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{CheckCircleIcon as p}from"@phosphor-icons/react/CheckCircle";import{InfoIcon as m}from"@phosphor-icons/react/Info";import{MegaphoneIcon as h}from"@phosphor-icons/react/Megaphone";import{WarningIcon as g}from"@phosphor-icons/react/Warning";import{WarningDiamondIcon as _}from"@phosphor-icons/react/WarningDiamond";import{XIcon as v}from"@phosphor-icons/react/X";import{cva as y}from"class-variance-authority";const b=s(null),x=d(v,{});function S(){let e=c(b);return u(e,`useAlertContext hook used outside of Alert parent!`),e}const C=({children:e,intent:t})=>{let n=l(()=>({intent:t}),[t]);return d(b.Provider,{value:n,children:e})},w=y(`relative flex w-full gap-1.5 rounded-md border p-2.5 text-sm font-sans`,{variants:{intent:{danger:`border-danger-500/50 bg-danger-500/10 text-danger-700 [&_code]:bg-danger-500/10 [&_code]:border-danger-500/20 [&_code]:text-danger-900 [&_a:not([data-slot=button])]:text-danger-700 [&_a:not([data-slot=button])]:underline`,important:`border-important-500/50 bg-important-500/10 text-important-700 [&_code]:bg-important-500/10 [&_code]:border-important-500/20 [&_code]:text-important-900 [&_a:not([data-slot=button])]:text-important-700 [&_a:not([data-slot=button])]:underline`,info:`border-info-500/50 bg-info-500/10 text-info-700 [&_code]:bg-info-500/10 [&_code]:border-info-500/20 [&_code]:text-info-900 [&_a:not([data-slot=button])]:text-info-700 [&_a:not([data-slot=button])]:underline`,success:`border-success-500/50 bg-success-500/10 text-success-700 [&_code]:bg-success-500/10 [&_code]:border-success-500/20 [&_code]:text-success-900 [&_a:not([data-slot=button])]:text-success-700 [&_a:not([data-slot=button])]:underline`,warning:`border-warning-500/50 bg-warning-500/10 text-warning-700 [&_code]:bg-warning-500/10 [&_code]:border-warning-500/20 [&_code]:text-warning-900 [&_a:not([data-slot=button])]:text-warning-700 [&_a:not([data-slot=button])]:underline`},appearance:{banner:`border-x-0 border-t-0 rounded-none z-50 sticky`,default:``}}}),T=({appearance:t=`default`,className:n,intent:i,ref:a,style:o,...s})=>d(C,{intent:i,children:d(`div`,{ref:a,"data-slot":`alert`,className:e(w({appearance:t,intent:i}),`has-data-alert-dismiss:pr-10`,`has-data-alert-expand:[&_[data-slot=alert-dismiss-icon-button]]:right-16`,`md:has-data-alert-expand:[&_[data-slot=alert-dismiss-icon-button]]:right-24`,`has-data-alert-expand:[&_[data-slot=alert-content]]:pr-12`,`md:has-data-alert-expand:[&_[data-slot=alert-content]]:pr-[5.5rem]`,n),style:r({"--alert-control-color":j(i),"--alert-control-hover-color":M(i),"--alert-control-hover-bg":N(i),...o}),...s})}),E={danger:d(g,{}),important:d(h,{mirrored:!0}),info:d(m,{}),success:d(p,{}),warning:d(_,{})},D=({className:n,ref:r,svg:i,...a})=>{let o=S(),s=E[o.intent];return d(t,{ref:r,"data-slot":`alert-icon`,className:e(`size-5`,n),svg:i??s,...a})},O=({className:t,ref:n,...r})=>d(`div`,{ref:n,"data-slot":`alert-content`,className:e(`min-w-0 flex-1 has-data-alert-dismiss:pr-6`,t),...r}),k=({asChild:t=!1,className:r,ref:i,...a})=>d(t?n:`h5`,{ref:i,"data-slot":`alert-title`,className:e(`font-medium`,r),...a}),A=({asChild:t=!1,className:r,ref:i,...a})=>d(t?n:`div`,{ref:i,"data-slot":`alert-description`,className:e(`text-sm`,r),...a}),j=e=>`var(--color-${e}-700)`,M=e=>`var(--color-${e}-800)`,N=e=>`color-mix(in oklab, var(--color-${e}-500) 10%, transparent)`,P={Root:T,Content:O,ExpandButton:({count:t,expanded:n,className:r,...a})=>f(i,{type:`button`,appearance:`ghost`,intent:`neutral`,size:`sm`,"aria-expanded":n,"aria-label":n?`Collapse additional alerts`:`Show ${t} more ${t===1?`alert`:`alerts`}`,"data-slot":`alert-expand-button`,"data-alert-expand":!0,className:e(`right-1.5 top-1.5 absolute gap-1 px-1.5`,`text-[var(--alert-control-color,currentColor)]`,`not-disabled:hover:bg-[var(--alert-control-hover-bg,transparent)] not-disabled:hover:text-[var(--alert-control-hover-color,currentColor)]`,r),...a,children:[f(`span`,{className:`min-w-[2ch] text-center tabular-nums`,children:[`+`,t]}),d(`span`,{className:`hidden md:inline`,children:`more`}),d(o,{weight:`bold`,className:e(`size-4 transition-transform ease-out duration-150`,n&&`-rotate-180`)})]}),Description:A,DismissIconButton:({size:t=`sm`,type:n=`button`,label:r=`Dismiss Alert`,appearance:i=`ghost`,className:o,icon:s=x,...c})=>d(a,{appearance:i,icon:s,intent:`neutral`,label:r,size:t,"data-slot":`alert-dismiss-icon-button`,"data-alert-dismiss":!0,className:e(`right-1.5 top-1.5 absolute`,`text-[var(--alert-control-color,currentColor)]`,`not-disabled:hover:bg-[var(--alert-control-hover-bg,transparent)] not-disabled:hover:text-[var(--alert-control-hover-color,currentColor)]`,o),type:n,...c}),Icon:D,Title:k};export{C as n,P as t};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as WithAsChild } from "./as-child-D23mGo4f.js";
|
|
2
2
|
import { t as SvgAttributes } from "./icon-D1RY5Tcj.js";
|
|
3
|
-
import { r as ButtonProps } from "./button-
|
|
3
|
+
import { r as ButtonProps } from "./button-BH79w6HV.js";
|
|
4
4
|
import { n as IconButtonProps, r as IconButtonAppearance } from "./button-DJ7AAgII.js";
|
|
5
5
|
import { ComponentProps, ReactNode } from "react";
|
|
6
6
|
//#region src/components/alert/alert.d.ts
|
package/dist/alert-center.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
|
|
2
|
-
import { t as Alert } from "./alert-
|
|
2
|
+
import { t as Alert } from "./alert-C4AFlLXD.js";
|
|
3
3
|
import { ComponentProps, ReactNode } from "react";
|
|
4
4
|
//#region src/components/alert-center/alert-center.d.ts
|
|
5
5
|
/**
|
package/dist/alert-center.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{n as t}from"./compose-refs-BdBMM9ga.js";import{t as n}from"./cx-IiQEAKf5.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{n as i,t as a}from"./alert-BuG2qS5l.js";import{createContext as o,useCallback as s,useContext as c,useEffect as l,useId as u,useMemo as d,useReducer as f,useRef as p,useState as m,useSyncExternalStore as h}from"react";import g from"tiny-invariant";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{createPortal as y}from"react-dom";const b={danger:5,warning:4,important:3,info:2,success:1};function x(e,t){if(t.parentElement===e)return!1;if(typeof e.moveBefore==`function`&&t.isConnected&&e.isConnected)try{return e.moveBefore(t,null),!0}catch{}return e.appendChild(t),!0}function S(e){return e.replace(/\s+/g,` `).trim()}function C(e){let t=e.querySelector(`[data-slot="alert-title"]`);if(t==null)return``;let n=t.cloneNode(!0);if(!(n instanceof Element))return S(t.textContent??``);for(let e of n.querySelectorAll(`button`))e.remove();let r=S(n.textContent??``);for(let e of n.querySelectorAll(`a`))e.remove();let i=S(n.textContent??``);return i===``?r:i}function w(e){return e.toSorted((e,t)=>b[t.intent]-b[e.intent]||e.sequence-t.sequence)}function T(e,t){if(t===0)return``;if(e===``)return`${t} alert${t===1?``:`s`}`;let n=t-1;return n===0?e:`${e}, and ${n} more alert${n===1?``:`s`}`}const E=[];var D=class{#e=new Set;#t=new Map;#n=new Map;#r=new Map;#i=0;#a=E;#o=``;#s=!1;getHost(e){let t=this.#r.get(e);if(t!=null)return t;let n=document.createElement(`div`);return n.style.display=`contents`,n.setAttribute(`data-slot`,`alert-center-item-host`),n.setAttribute(`data-alert-host`,e),this.#r.set(e,n),n}#c=null;captureHostSnapshot(e){if(e!==this.#a[0]?.id)return;let t=this.#r.get(e);t!=null&&t.hasChildNodes()&&(this.#c={id:e,content:t.cloneNode(!0)})}getHostSnapshot=e=>this.#c?.id===e?this.#c.content:null;subscribe=e=>(this.#e.add(e),()=>{this.#e.delete(e)});getSnapshot=()=>this.#a;hasAlert=e=>this.#t.has(e);getTopLabel=()=>this.#o;setTopLabel(e){this.#o!==e&&(this.#o=e,this.#p())}#l=null;requestFocusRestore(e){this.#l=e}flushFocusRestore(){let e=this.#l;e==null||!e.isConnected||(this.#l=null,document.activeElement!==e&&e.focus({preventScroll:!0}))}#u=null;#d=0;getPlacementVersion=()=>this.#d;notifyPlacementChange(){this.#d++,this.#p()}setBarElement(e){this.#u=e}getBarElement=()=>this.#u;getContentMounted=()=>this.#s;setContentMounted(e){this.#s!==e&&(this.#s=e,this.#p())}register(e){g(!this.#t.has(e.id),`AlertCenter.Item id "${e.id}" is already registered by another mounted item — ids must be unique under one <AlertCenter.Root>. Render one item per id, or give each alert its own id.`);let t=this.#n.get(e.id)??this.#i++;this.#n.set(e.id,t);let n={...e,sequence:t};return this.#t.set(e.id,n),this.#f(),()=>{this.#t.get(e.id)===n&&(this.#t.delete(e.id),this.#f())}}#f(){this.#a=w([...this.#t.values()]),this.#p()}#p(){for(let e of this.#e)e()}};const O=o(null),k=o(null);function A(e){let t=c(O);return g(t,`${e} must be rendered inside <AlertCenter.Root>.`),t}function j(e){let t=c(k);return g(t,`${e} must be rendered inside <AlertCenter.Root>.`),t}const M=e=>h(e.subscribe,e.getSnapshot,e.getSnapshot),N=o(!1);function P({store:e}){let t=M(e),n=h(e.subscribe,e.getTopLabel,e.getTopLabel);return _(`div`,{"data-slot":`alert-center-announcer`,className:`sr-only`,role:`status`,"aria-live":`polite`,children:T(n,t.length)})}const F=({children:e,defaultOpen:t,onOpenChange:n,open:r})=>{let[i]=m(()=>new D),a=u(),[o,c]=m(t??!1),l=r??o,f=s(e=>{r??c(e),n?.(e)},[r,n]),p=d(()=>({store:i,contentId:a}),[i,a]),h=d(()=>({isExpanded:l,setExpanded:f}),[l,f]);return v(O.Provider,{value:p,children:[_(k.Provider,{value:h,children:e}),_(P,{store:i})]})},I=({children:t,className:n,id:r,intent:a})=>{let{store:o}=A(`AlertCenter.Item`),s=c(N);g(!s,`AlertCenter.Item cannot be rendered inside another item's children.`);let[l,u]=m(null);return e(()=>{u(o.getHost(r))},[o,r]),e(()=>o.register({id:r,intent:a,className:n}),[o,r,a,n]),e(()=>{o.captureHostSnapshot(r)}),l==null?null:y(_(i,{intent:a,children:_(N.Provider,{value:!0,children:t})}),l)},L=({"data-slot":n,label:i,ref:o,...s})=>{let l=c(N);g(l,`AlertCenter.DismissIconButton must be composed inside an <AlertCenter.Item>'s children.`);let{store:u}=A(`AlertCenter.DismissIconButton`);h(u.subscribe,u.getPlacementVersion,u.getPlacementVersion);let d=p(null),f=t(d,o),[v,y]=m(null);return e(()=>{if(i!=null)return;let e=d.current?.closest(`[data-alert-id]`),t=e==null?``:C(e);y(t===``?null:`Dismiss ${t}`)}),_(a.DismissIconButton,{ref:f,label:i??v??void 0,...s,"data-slot":r(n,`alert-center-dismiss-icon-button`)})};function R(e,t){switch(t){case`show`:return`open`;case`hide`:return e===`closed`?`closed`:`closing`;case`exited`:return e===`closing`?`closed`:e}}function z({present:t}){let[n,r]=f(R,t?`open`:`closed`);e(()=>{r(t?`show`:`hide`)},[t]),l(()=>{if(n!==`closing`)return;let e=window.setTimeout(()=>r(`exited`),200);return()=>window.clearTimeout(e)},[n]);let i=s(e=>{e.target===e.currentTarget&&e.propertyName===`height`&&r(`exited`)},[]);return{isMounted:n!==`closed`,dataState:n===`open`?`open`:`closed`,onExitTransitionEnd:i}}function B({containerRef:t,isAttached:n}){let r=p(null);return e(()=>{let e=t.current;if(!n||e==null)return;let i=e=>{e.target instanceof Element&&(r.current=e.target)},a=t=>{t.relatedTarget instanceof Node&&!e.contains(t.relatedTarget)&&(r.current=null)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[t,n]),{lastFocusedWithinRef:r}}function V(){let e=document.querySelector(`main, [role="main"]`);e!=null&&(e.hasAttribute(`tabindex`)||(e.tabIndex=-1),e.focus({preventScroll:!0}))}function H({isMounted:t,store:n,topId:r}){let i=p(null),{lastFocusedWithinRef:a}=B({containerRef:i,isAttached:t}),o=p(r);return e(()=>{let e=o.current;if(o.current=r,e==null||r===e)return;let t=a.current;if(n.hasAlert(e)){t instanceof HTMLElement&&document.activeElement!==t&&n.requestFocusRestore(t);return}if(t==null||t.isConnected)return;a.current=null;let s=i.current;if(r==null){V();return}s!=null&&(s.querySelector(`[data-alert-dismiss], [data-alert-expand]`)??s).focus()},[n,r]),{wrapperRef:i}}const U=`gap-2 py-2 pr-2 [&_[data-slot=alert-icon]]:shrink-0`,W={Root:F,Bar:({className:t,"data-slot":i,ref:o,...s})=>{let{store:c,contentId:l}=A(`AlertCenter.Bar`),{isExpanded:u,setExpanded:d}=j(`AlertCenter.Bar`),f=M(c),m=h(c.subscribe,c.getContentMounted,c.getContentMounted),g=f[0]??null,y=g!=null,{isMounted:b,dataState:S,onExitTransitionEnd:w}=z({present:y}),T=p(g);e(()=>{g!=null&&(T.current=g)},[g]);let E=g??T.current,D=p(null);e(()=>{let e=D.current;if(e==null)return;if(g!=null){let t=c.getHost(g.id);t.parentElement!==e&&e.childNodes.length>0&&e.replaceChildren(),x(e,t)&&c.notifyPlacementChange(),c.flushFocusRestore();return}let t=E==null?null:c.getHostSnapshot(E.id);t!=null&&t.parentNode!==e&&e.replaceChildren(t)});let{wrapperRef:O}=H({isMounted:b,store:c,topId:g?.id});if(e(()=>{let e=O.current;c.setTopLabel(y&&e!=null?C(e):``)}),e(()=>{let e=O.current;if(e==null)return;let t=new MutationObserver(()=>{c.setTopLabel(y?C(e):``)});return t.observe(e,{subtree:!0,childList:!0,characterData:!0}),()=>{t.disconnect()}},[c,y,b]),e(()=>()=>{c.setTopLabel(``)},[c]),e(()=>{c.setBarElement(O.current)}),e(()=>()=>{c.setBarElement(null)},[c]),!b||E==null)return null;let k=y?f.length-1:0;return _(`div`,{ref:O,"data-slot":`alert-center-bar-wrapper`,tabIndex:-1,inert:!y,className:`shrink-0 overflow-hidden transition-[height,opacity] duration-200 ease-out [interpolate-size:allow-keywords] starting:h-0 starting:opacity-0 data-state-closed:h-0 data-state-closed:opacity-0 data-state-closed:duration-150 motion-reduce:transition-none`,"data-state":S,onTransitionEnd:w,children:v(a.Root,{ref:o,appearance:`banner`,intent:E.intent,className:n(U,`not-has-data-[slot=alert-description]:[&_[data-alert-dismiss],&_[data-alert-expand]]:top-1/2 not-has-data-[slot=alert-description]:[&_[data-alert-dismiss],&_[data-alert-expand]]:-translate-y-1/2`,`has-data-alert-expand:[&_[data-alert-dismiss]]:right-16 md:has-data-alert-expand:[&_[data-alert-dismiss]]:right-24`,t,E.className),...s,"data-slot":r(i,`alert-center-bar`),"data-placement":`bar`,"data-alert-id":E.id,children:[_(`div`,{ref:D,className:`contents`,"data-slot":`alert-center-bar-mount`}),k>0&&m&&_(a.ExpandButton,{count:k,expanded:u,"aria-controls":l,onClick:()=>d(!u)})]})})},Content:({"aria-label":i=`More alerts`,"aria-labelledby":o,className:s,"data-slot":c,ref:l,...u})=>{let{store:d,contentId:f}=A(`AlertCenter.Content`),{isExpanded:m,setExpanded:h}=j(`AlertCenter.Content`),g=M(d).slice(1),v=g.length>0;e(()=>(d.setContentMounted(!0),()=>{d.setContentMounted(!1)}),[d]);let y=p(v);e(()=>{let e=y.current&&!v;y.current=v,e&&m&&h(!1)},[v,m,h]);let b=p(null),S=t(b,l),{lastFocusedWithinRef:C}=B({containerRef:b,isAttached:v}),w=g.map(e=>e.id).join(` `);return e(()=>{let e=b.current;if(e==null)return;let t=!1;for(let n of e.querySelectorAll(`[data-alert-mount]`)){let e=n.getAttribute(`data-alert-mount`);e!=null&&x(n,d.getHost(e))&&(t=!0)}t&&d.notifyPlacementChange(),d.flushFocusRestore()},[d,w]),e(()=>{let e=C.current;if(e==null)return;if(e.isConnected){let t=b.current;e instanceof HTMLElement&&document.activeElement!==e&&(t==null||!t.contains(e))&&(C.current=null,e.focus({preventScroll:!0}));return}C.current=null;let t=b.current?.querySelector(`[data-alert-dismiss]`);if(t!=null){t.focus();return}let n=d.getBarElement()?.querySelector(`[data-alert-dismiss], [data-alert-expand]`);if(n!=null){n.focus();return}V()},[d,w]),g.length===0?null:_(`div`,{...u,ref:S,"data-slot":r(c,`alert-center-content`),id:f,"data-state":m?`open`:`closed`,className:n(`h-0 overflow-hidden invisible [content-visibility:hidden] transition-[height,visibility,content-visibility] transition-discrete duration-200 ease-out [interpolate-size:allow-keywords] data-state-open:h-auto data-state-open:visible data-state-open:[content-visibility:visible] motion-reduce:transition-none`,s),children:_(`ul`,{"aria-label":o==null?i:void 0,"aria-labelledby":o,className:`flex w-full flex-col`,children:g.map(e=>_(`li`,{children:_(a.Root,{appearance:`banner`,intent:e.intent,className:n(U,e.className),"data-slot":`alert-center-item`,"data-placement":`list`,"data-alert-id":e.id,children:_(`div`,{className:`contents`,"data-alert-mount":e.id})})},e.id))})})},Item:I,DismissIconButton:L};export{W as AlertCenter};
|
|
1
|
+
import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{n as t}from"./compose-refs-BdBMM9ga.js";import{t as n}from"./cx-IiQEAKf5.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{n as i,t as a}from"./alert-BpXQVXqv.js";import{createContext as o,useCallback as s,useContext as c,useEffect as l,useId as u,useMemo as d,useReducer as f,useRef as p,useState as m,useSyncExternalStore as h}from"react";import g from"tiny-invariant";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{createPortal as y}from"react-dom";const b={danger:5,warning:4,important:3,info:2,success:1};function x(e,t){if(t.parentElement===e)return!1;if(typeof e.moveBefore==`function`&&t.isConnected&&e.isConnected)try{return e.moveBefore(t,null),!0}catch{}return e.appendChild(t),!0}function S(e){return e.replace(/\s+/g,` `).trim()}function C(e){let t=e.querySelector(`[data-slot="alert-title"]`);if(t==null)return``;let n=t.cloneNode(!0);if(!(n instanceof Element))return S(t.textContent??``);for(let e of n.querySelectorAll(`button`))e.remove();let r=S(n.textContent??``);for(let e of n.querySelectorAll(`a`))e.remove();let i=S(n.textContent??``);return i===``?r:i}function w(e){return e.toSorted((e,t)=>b[t.intent]-b[e.intent]||e.sequence-t.sequence)}function T(e,t){if(t===0)return``;if(e===``)return`${t} alert${t===1?``:`s`}`;let n=t-1;return n===0?e:`${e}, and ${n} more alert${n===1?``:`s`}`}const E=[];var D=class{#e=new Set;#t=new Map;#n=new Map;#r=new Map;#i=0;#a=E;#o=``;#s=!1;getHost(e){let t=this.#r.get(e);if(t!=null)return t;let n=document.createElement(`div`);return n.style.display=`contents`,n.setAttribute(`data-slot`,`alert-center-item-host`),n.setAttribute(`data-alert-host`,e),this.#r.set(e,n),n}#c=null;captureHostSnapshot(e){if(e!==this.#a[0]?.id)return;let t=this.#r.get(e);t!=null&&t.hasChildNodes()&&(this.#c={id:e,content:t.cloneNode(!0)})}getHostSnapshot=e=>this.#c?.id===e?this.#c.content:null;subscribe=e=>(this.#e.add(e),()=>{this.#e.delete(e)});getSnapshot=()=>this.#a;hasAlert=e=>this.#t.has(e);getTopLabel=()=>this.#o;setTopLabel(e){this.#o!==e&&(this.#o=e,this.#p())}#l=null;requestFocusRestore(e){this.#l=e}flushFocusRestore(){let e=this.#l;e==null||!e.isConnected||(this.#l=null,document.activeElement!==e&&e.focus({preventScroll:!0}))}#u=null;#d=0;getPlacementVersion=()=>this.#d;notifyPlacementChange(){this.#d++,this.#p()}setBarElement(e){this.#u=e}getBarElement=()=>this.#u;getContentMounted=()=>this.#s;setContentMounted(e){this.#s!==e&&(this.#s=e,this.#p())}register(e){g(!this.#t.has(e.id),`AlertCenter.Item id "${e.id}" is already registered by another mounted item — ids must be unique under one <AlertCenter.Root>. Render one item per id, or give each alert its own id.`);let t=this.#n.get(e.id)??this.#i++;this.#n.set(e.id,t);let n={...e,sequence:t};return this.#t.set(e.id,n),this.#f(),()=>{this.#t.get(e.id)===n&&(this.#t.delete(e.id),this.#f())}}#f(){this.#a=w([...this.#t.values()]),this.#p()}#p(){for(let e of this.#e)e()}};const O=o(null),k=o(null);function A(e){let t=c(O);return g(t,`${e} must be rendered inside <AlertCenter.Root>.`),t}function j(e){let t=c(k);return g(t,`${e} must be rendered inside <AlertCenter.Root>.`),t}const M=e=>h(e.subscribe,e.getSnapshot,e.getSnapshot),N=o(!1);function P({store:e}){let t=M(e),n=h(e.subscribe,e.getTopLabel,e.getTopLabel);return _(`div`,{"data-slot":`alert-center-announcer`,className:`sr-only`,role:`status`,"aria-live":`polite`,children:T(n,t.length)})}const F=({children:e,defaultOpen:t,onOpenChange:n,open:r})=>{let[i]=m(()=>new D),a=u(),[o,c]=m(t??!1),l=r??o,f=s(e=>{r??c(e),n?.(e)},[r,n]),p=d(()=>({store:i,contentId:a}),[i,a]),h=d(()=>({isExpanded:l,setExpanded:f}),[l,f]);return v(O.Provider,{value:p,children:[_(k.Provider,{value:h,children:e}),_(P,{store:i})]})},I=({children:t,className:n,id:r,intent:a})=>{let{store:o}=A(`AlertCenter.Item`),s=c(N);g(!s,`AlertCenter.Item cannot be rendered inside another item's children.`);let[l,u]=m(null);return e(()=>{u(o.getHost(r))},[o,r]),e(()=>o.register({id:r,intent:a,className:n}),[o,r,a,n]),e(()=>{o.captureHostSnapshot(r)}),l==null?null:y(_(i,{intent:a,children:_(N.Provider,{value:!0,children:t})}),l)},L=({"data-slot":n,label:i,ref:o,...s})=>{let l=c(N);g(l,`AlertCenter.DismissIconButton must be composed inside an <AlertCenter.Item>'s children.`);let{store:u}=A(`AlertCenter.DismissIconButton`);h(u.subscribe,u.getPlacementVersion,u.getPlacementVersion);let d=p(null),f=t(d,o),[v,y]=m(null);return e(()=>{if(i!=null)return;let e=d.current?.closest(`[data-alert-id]`),t=e==null?``:C(e);y(t===``?null:`Dismiss ${t}`)}),_(a.DismissIconButton,{ref:f,label:i??v??void 0,...s,"data-slot":r(n,`alert-center-dismiss-icon-button`)})};function R(e,t){switch(t){case`show`:return`open`;case`hide`:return e===`closed`?`closed`:`closing`;case`exited`:return e===`closing`?`closed`:e}}function z({present:t}){let[n,r]=f(R,t?`open`:`closed`);e(()=>{r(t?`show`:`hide`)},[t]),l(()=>{if(n!==`closing`)return;let e=window.setTimeout(()=>r(`exited`),200);return()=>window.clearTimeout(e)},[n]);let i=s(e=>{e.target===e.currentTarget&&e.propertyName===`height`&&r(`exited`)},[]);return{isMounted:n!==`closed`,dataState:n===`open`?`open`:`closed`,onExitTransitionEnd:i}}function B({containerRef:t,isAttached:n}){let r=p(null);return e(()=>{let e=t.current;if(!n||e==null)return;let i=e=>{e.target instanceof Element&&(r.current=e.target)},a=t=>{t.relatedTarget instanceof Node&&!e.contains(t.relatedTarget)&&(r.current=null)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[t,n]),{lastFocusedWithinRef:r}}function V(){let e=document.querySelector(`main, [role="main"]`);e!=null&&(e.hasAttribute(`tabindex`)||(e.tabIndex=-1),e.focus({preventScroll:!0}))}function H({isMounted:t,store:n,topId:r}){let i=p(null),{lastFocusedWithinRef:a}=B({containerRef:i,isAttached:t}),o=p(r);return e(()=>{let e=o.current;if(o.current=r,e==null||r===e)return;let t=a.current;if(n.hasAlert(e)){t instanceof HTMLElement&&document.activeElement!==t&&n.requestFocusRestore(t);return}if(t==null||t.isConnected)return;a.current=null;let s=i.current;if(r==null){V();return}s!=null&&(s.querySelector(`[data-alert-dismiss], [data-alert-expand]`)??s).focus()},[n,r]),{wrapperRef:i}}const U=`gap-2 py-2 pr-2 [&_[data-slot=alert-icon]]:shrink-0`,W={Root:F,Bar:({className:t,"data-slot":i,ref:o,...s})=>{let{store:c,contentId:l}=A(`AlertCenter.Bar`),{isExpanded:u,setExpanded:d}=j(`AlertCenter.Bar`),f=M(c),m=h(c.subscribe,c.getContentMounted,c.getContentMounted),g=f[0]??null,y=g!=null,{isMounted:b,dataState:S,onExitTransitionEnd:w}=z({present:y}),T=p(g);e(()=>{g!=null&&(T.current=g)},[g]);let E=g??T.current,D=p(null);e(()=>{let e=D.current;if(e==null)return;if(g!=null){let t=c.getHost(g.id);t.parentElement!==e&&e.childNodes.length>0&&e.replaceChildren(),x(e,t)&&c.notifyPlacementChange(),c.flushFocusRestore();return}let t=E==null?null:c.getHostSnapshot(E.id);t!=null&&t.parentNode!==e&&e.replaceChildren(t)});let{wrapperRef:O}=H({isMounted:b,store:c,topId:g?.id});if(e(()=>{let e=O.current;c.setTopLabel(y&&e!=null?C(e):``)}),e(()=>{let e=O.current;if(e==null)return;let t=new MutationObserver(()=>{c.setTopLabel(y?C(e):``)});return t.observe(e,{subtree:!0,childList:!0,characterData:!0}),()=>{t.disconnect()}},[c,y,b]),e(()=>()=>{c.setTopLabel(``)},[c]),e(()=>{c.setBarElement(O.current)}),e(()=>()=>{c.setBarElement(null)},[c]),!b||E==null)return null;let k=y?f.length-1:0;return _(`div`,{ref:O,"data-slot":`alert-center-bar-wrapper`,tabIndex:-1,inert:!y,className:`shrink-0 overflow-hidden transition-[height,opacity] duration-200 ease-out [interpolate-size:allow-keywords] starting:h-0 starting:opacity-0 data-state-closed:h-0 data-state-closed:opacity-0 data-state-closed:duration-150 motion-reduce:transition-none`,"data-state":S,onTransitionEnd:w,children:v(a.Root,{ref:o,appearance:`banner`,intent:E.intent,className:n(U,`not-has-data-[slot=alert-description]:[&_[data-alert-dismiss],&_[data-alert-expand]]:top-1/2 not-has-data-[slot=alert-description]:[&_[data-alert-dismiss],&_[data-alert-expand]]:-translate-y-1/2`,`has-data-alert-expand:[&_[data-alert-dismiss]]:right-16 md:has-data-alert-expand:[&_[data-alert-dismiss]]:right-24`,t,E.className),...s,"data-slot":r(i,`alert-center-bar`),"data-placement":`bar`,"data-alert-id":E.id,children:[_(`div`,{ref:D,className:`contents`,"data-slot":`alert-center-bar-mount`}),k>0&&m&&_(a.ExpandButton,{count:k,expanded:u,"aria-controls":l,onClick:()=>d(!u)})]})})},Content:({"aria-label":i=`More alerts`,"aria-labelledby":o,className:s,"data-slot":c,ref:l,...u})=>{let{store:d,contentId:f}=A(`AlertCenter.Content`),{isExpanded:m,setExpanded:h}=j(`AlertCenter.Content`),g=M(d).slice(1),v=g.length>0;e(()=>(d.setContentMounted(!0),()=>{d.setContentMounted(!1)}),[d]);let y=p(v);e(()=>{let e=y.current&&!v;y.current=v,e&&m&&h(!1)},[v,m,h]);let b=p(null),S=t(b,l),{lastFocusedWithinRef:C}=B({containerRef:b,isAttached:v}),w=g.map(e=>e.id).join(` `);return e(()=>{let e=b.current;if(e==null)return;let t=!1;for(let n of e.querySelectorAll(`[data-alert-mount]`)){let e=n.getAttribute(`data-alert-mount`);e!=null&&x(n,d.getHost(e))&&(t=!0)}t&&d.notifyPlacementChange(),d.flushFocusRestore()},[d,w]),e(()=>{let e=C.current;if(e==null)return;if(e.isConnected){let t=b.current;e instanceof HTMLElement&&document.activeElement!==e&&(t==null||!t.contains(e))&&(C.current=null,e.focus({preventScroll:!0}));return}C.current=null;let t=b.current?.querySelector(`[data-alert-dismiss]`);if(t!=null){t.focus();return}let n=d.getBarElement()?.querySelector(`[data-alert-dismiss], [data-alert-expand]`);if(n!=null){n.focus();return}V()},[d,w]),g.length===0?null:_(`div`,{...u,ref:S,"data-slot":r(c,`alert-center-content`),id:f,"data-state":m?`open`:`closed`,className:n(`h-0 overflow-hidden invisible [content-visibility:hidden] transition-[height,visibility,content-visibility] transition-discrete duration-200 ease-out [interpolate-size:allow-keywords] data-state-open:h-auto data-state-open:visible data-state-open:[content-visibility:visible] motion-reduce:transition-none`,s),children:_(`ul`,{"aria-label":o==null?i:void 0,"aria-labelledby":o,className:`flex w-full flex-col`,children:g.map(e=>_(`li`,{children:_(a.Root,{appearance:`banner`,intent:e.intent,className:n(U,e.className),"data-slot":`alert-center-item`,"data-placement":`list`,"data-alert-id":e.id,children:_(`div`,{className:`contents`,"data-alert-mount":e.id})})},e.id))})})},Item:I,DismissIconButton:L};export{W as AlertCenter};
|
package/dist/alert-dialog.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as WithAsChild } from "./as-child-D23mGo4f.js";
|
|
2
2
|
import { t as SvgAttributes } from "./icon-D1RY5Tcj.js";
|
|
3
3
|
import { t as ButtonIntent } from "./button-DdSKSj1c.js";
|
|
4
|
-
import { n as ButtonAppearance, r as ButtonProps } from "./button-
|
|
4
|
+
import { n as ButtonAppearance, r as ButtonProps } from "./button-BH79w6HV.js";
|
|
5
5
|
import { a as Root$1, n as Content$1, o as Title$1, r as Description$1, s as Trigger$1, t as Close$1 } from "./dialog-BM4wPCft.js";
|
|
6
6
|
import { ComponentProps, ReactNode } from "react";
|
|
7
7
|
//#region src/components/alert-dialog/alert-dialog.d.ts
|
package/dist/alert-dialog.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-d-nMCfAI.js";import{t as n}from"./slot-DpNWVci8.js";import{t as r}from"./button-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-d-nMCfAI.js";import{t as n}from"./slot-DpNWVci8.js";import{t as r}from"./button-hEoKi6ZG.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"./primitive-D-9GIFWb.js";import{createContext as f,useContext as p,useMemo as m}from"react";import h from"tiny-invariant";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{InfoIcon as v}from"@phosphor-icons/react/Info";import{WarningIcon as y}from"@phosphor-icons/react/Warning";const b=f(null);function x(){let e=p(b);return h(e,`AlertDialog child component used outside of AlertDialog parent!`),e}function S({intent:e,...t}){let n=m(()=>({intent:e}),[e]);return g(b.Provider,{value:n,children:g(c,{...t})})}const C=({ref:e,...t})=>g(a,{ref:e,"data-slot":`alert-dialog-trigger`,...t}),w=i,T=({className:t,ref:n,...r})=>g(o,{"data-slot":`alert-dialog-overlay`,className:e(`data-state-open:animate-in data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:fade-in-0 bg-overlay fixed inset-0 z-50 backdrop-blur-xs`,t),...r,ref:n}),E=({className:t,preferredWidth:n=`max-w-md`,ref:r,...i})=>_(w,{children:[g(T,{}),g(`div`,{className:`fixed inset-4 z-50 flex items-center justify-center`,children:g(s,{"data-slot":`alert-dialog-content`,"data-mantle-modal-content":!0,ref:r,className:e(`flex w-full flex-1 flex-col items-center gap-4 sm:flex-row sm:items-start`,`outline-hidden focus-within:outline-hidden`,`p-6`,`border-dialog bg-dialog rounded-xl border shadow-lg transition-transform duration-200`,`data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95`,n,t),...i})})]}),D=({asChild:t=!1,className:r,ref:i,...a})=>g(t?n:`div`,{"data-slot":`alert-dialog-body`,className:e(`flex-1 space-y-4`,r),ref:i,...a}),O=({asChild:t=!1,className:r,ref:i,...a})=>g(t?n:`div`,{"data-slot":`alert-dialog-header`,className:e(`flex flex-col space-y-2 text-center sm:text-start`,r),ref:i,...a}),k=({asChild:t=!1,className:r,ref:i,...a})=>g(t?n:`div`,{"data-slot":`alert-dialog-footer`,className:e(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,r),ref:i,...a}),A=({className:t,ref:n,...r})=>g(u,{ref:n,"data-slot":`alert-dialog-title`,className:e(`text-strong text-center text-lg font-medium sm:text-start`,t),...r}),j=({className:t,ref:n,...r})=>g(l,{ref:n,"data-slot":`alert-dialog-description`,className:e(`text-body text-center text-sm font-normal sm:text-start`,t),...r}),M={danger:`danger`,info:`neutral`},N=({appearance:e=`filled`,intent:t,ref:n,...i})=>{let a=x(),o=M[a.intent];return g(r,{appearance:e,"data-slot":`alert-dialog-action`,intent:t??o,ref:n,...i})},P=({appearance:t=`outlined`,className:n,intent:i=`neutral`,ref:a,...o})=>g(d,{asChild:!0,children:g(r,{appearance:t,"data-slot":`alert-dialog-cancel`,className:e(`mt-2 sm:mt-0`,n),intent:i,ref:a,...o})}),F={danger:g(y,{}),info:g(v,{})},I={danger:`text-danger-600`,info:`text-accent-600`},L={Root:S,Action:N,Body:D,Cancel:P,Close:({ref:e,...t})=>g(d,{ref:e,"data-slot":`alert-dialog-close`,...t}),Content:E,Description:j,Footer:k,Header:O,Icon:({className:n,ref:r,svg:i,...a})=>{let o=x(),s=I[o.intent],c=F[o.intent];return g(t,{ref:r,"data-slot":`alert-dialog-icon`,className:e(`size-12 sm:size-7`,s,n),svg:i??c,...a})},Title:A,Trigger:C};export{L as AlertDialog};
|
package/dist/alert.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Alert } from "./alert-
|
|
1
|
+
import { t as Alert } from "./alert-C4AFlLXD.js";
|
|
2
2
|
export { Alert };
|
package/dist/alert.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./alert-
|
|
1
|
+
import{t as e}from"./alert-BpXQVXqv.js";export{e as Alert};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-lZ48P8Nn.js";import{t as n}from"./slot-DpNWVci8.js";import{Children as r,cloneElement as i,isValidElement as a}from"react";import o from"tiny-invariant";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";const u=t=>e(`cursor-pointer rounded bg-transparent text-accent-600 hover:underline focus:outline-hidden focus-visible:ring-3 focus-visible:ring-focus-accent`,t),d=({asChild:e,children:d,className:p,rel:m,icon:h,iconPlacement:g=`start`,ref:_,...v})=>{let y=f(m),b={"data-slot":`anchor`,className:u(p),ref:_,rel:y,...v};if(e){let e=r.only(d);o(a(e),"When using `asChild`, Anchor must be passed a single child as a JSX tag.");let u=e.props?.children;return c(n,{...b,children:i(e,{},l(s,{children:[h&&g===`start`&&c(t,{className:`inline-block mr-1.5`,svg:h}),u,h&&g===`end`&&c(t,{className:`inline-block ml-1.5`,svg:h})]}))})}return l(`a`,{...b,children:[h&&g===`start`&&c(t,{className:`inline-block mr-1.5`,svg:h}),d,h&&g===`end`&&c(t,{className:`inline-block ml-1.5`,svg:h})]})};function f(e){return Array.isArray(e)?[...new Set(e)].map(e=>e?.trim()).filter(Boolean).toSorted().join(` `)||void 0:e?.trim()||void 0}export{u as n,f as r,d as t};
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-lZ48P8Nn.js";import{t as n}from"./slot-DpNWVci8.js";import{Children as r,cloneElement as i,isValidElement as a}from"react";import o from"tiny-invariant";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";const u=t=>e(`cursor-pointer rounded bg-transparent text-accent-600 hover:underline focus:outline-hidden focus-visible:ring-3 focus-visible:ring-focus-accent`,t),d=({asChild:e,children:d,className:p,rel:m,icon:h,iconPlacement:g=`start`,ref:_,...v})=>{let y=f(m),b={"data-slot":`anchor`,className:u(p),ref:_,rel:y,...v};if(e){let e=r.only(d);o(a(e),"When using `asChild`, Anchor must be passed a single child as a JSX tag.");let u=e.props?.children;return c(n,{...b,children:i(e,{},l(s,{children:[h&&g===`start`&&c(t,{className:`inline-block mr-1.5`,svg:h}),c(`span`,{"data-slot":`anchor-label`,children:u}),h&&g===`end`&&c(t,{className:`inline-block ml-1.5`,svg:h})]}))})}return l(`a`,{...b,children:[h&&g===`start`&&c(t,{className:`inline-block mr-1.5`,svg:h}),c(`span`,{"data-slot":`anchor-label`,children:d}),h&&g===`end`&&c(t,{className:`inline-block ml-1.5`,svg:h})]})};function f(e){return Array.isArray(e)?[...new Set(e)].map(e=>e?.trim()).filter(Boolean).toSorted().join(` `)||void 0:e?.trim()||void 0}export{u as n,f as r,d as t};
|
package/dist/anchor.d.ts
CHANGED
|
@@ -68,6 +68,14 @@ type AnchorProps = Omit<ComponentProps<"a">, "rel"> & WithAsChild & {
|
|
|
68
68
|
* here" / "read more". For purely decorative icons, no extra labeling is
|
|
69
69
|
* needed; for icon-only links, pass an `aria-label`.
|
|
70
70
|
*
|
|
71
|
+
* **Structure.** `children` render inside an inline
|
|
72
|
+
* `<span data-slot="anchor-label">`, between the two `icon` slots. Target that
|
|
73
|
+
* slot to style the link text.
|
|
74
|
+
*
|
|
75
|
+
* | Data Attribute | Value | Description |
|
|
76
|
+
* | -------------- | ---------------- | --------------------------------------------------------------------------- |
|
|
77
|
+
* | `data-slot` | `"anchor-label"` | On the `<span>` wrapping `children`. Stable styling hook for the link text. |
|
|
78
|
+
*
|
|
71
79
|
* @see https://mantle.ngrok.com/components/navigation/anchor
|
|
72
80
|
*
|
|
73
81
|
* @example
|
package/dist/anchor.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./anchor-
|
|
1
|
+
import{n as e,r as t,t as n}from"./anchor-D2So_zuy.js";export{n as Anchor,e as anchorClassNames,t as resolveRel};
|
package/dist/badge.d.ts
CHANGED
|
@@ -43,6 +43,13 @@ type BadgeProps = ComponentProps<"span"> & WithAsChild & {
|
|
|
43
43
|
* element — useful when the badge wraps a link or other semantic element
|
|
44
44
|
* while keeping the badge styling.
|
|
45
45
|
*
|
|
46
|
+
* **Structure.** `children` render inside a `<span data-slot="badge-label">`,
|
|
47
|
+
* beside the `icon` slot. Target that slot to style the label text.
|
|
48
|
+
*
|
|
49
|
+
* | Data Attribute | Value | Description |
|
|
50
|
+
* | -------------- | --------------- | ---------------------------------------------------------------------------- |
|
|
51
|
+
* | `data-slot` | `"badge-label"` | On the `<span>` wrapping `children`. Stable styling hook for the label text. |
|
|
52
|
+
*
|
|
46
53
|
* @see https://mantle.ngrok.com/components/data-display/badge
|
|
47
54
|
*
|
|
48
55
|
* @example
|
package/dist/badge.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-d-nMCfAI.js";import{t as n}from"./slot-DpNWVci8.js";import{Children as r,cloneElement as i,isValidElement as a}from"react";import o from"tiny-invariant";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";const u=({appearance:u,asChild:d=!1,children:p,className:h,color:g=`neutral`,icon:_,...v})=>{let y=f(g,u),b=m(g,u),x=e(`inline-flex w-fit shrink-0 cursor-default items-center gap-1 rounded px-1.5 py-0.5 font-medium text-xs font-sans`,_&&`ps-1`,y,b,h);if(d){let e=r.only(p);o(a(e),"When using `asChild`, Badge must be passed a single child as a JSX tag.");let u=e.props?.children;return c(n,{"data-slot":`badge`,className:x,...v,children:i(e,{},l(s,{children:[_&&c(t,{className:`size-4`,svg:_}),u]}))})}return l(`span`,{"data-slot":`badge`,className:x,...v,children:[_&&c(t,{className:`size-4`,svg:_}),p]})},d={amber:`bg-amber-500/20`,blue:`bg-blue-500/20`,cyan:`bg-cyan-500/20`,emerald:`bg-emerald-500/20`,fuchsia:`bg-fuchsia-500/20`,gray:`bg-gray-500/20`,green:`bg-green-500/20`,indigo:`bg-indigo-500/20`,lime:`bg-lime-500/20`,orange:`bg-orange-500/20`,pink:`bg-pink-500/20`,purple:`bg-purple-500/20`,red:`bg-red-500/20`,rose:`bg-rose-500/20`,sky:`bg-sky-500/20`,teal:`bg-teal-500/20`,violet:`bg-violet-500/20`,yellow:`bg-yellow-500/20`,accent:`bg-accent-500/20`,danger:`bg-danger-500/20`,important:`bg-important-500/20`,info:`bg-info-500/20`,neutral:`bg-neutral-500/20`,success:`bg-success-500/20`,warning:`bg-warning-500/20`};function f(e,t){switch(t){case`muted`:return d[e];default:o(!1,`Invalid appearance: ${String(t)}`)}}const p={amber:`text-amber-700`,blue:`text-blue-700`,cyan:`text-cyan-700`,emerald:`text-emerald-700`,fuchsia:`text-fuchsia-700`,gray:`text-gray-700`,green:`text-green-700`,indigo:`text-indigo-700`,lime:`text-lime-700`,orange:`text-orange-700`,pink:`text-pink-700`,purple:`text-purple-700`,red:`text-red-700`,rose:`text-rose-700`,sky:`text-sky-700`,teal:`text-teal-700`,violet:`text-violet-700`,yellow:`text-yellow-700`,accent:`text-accent-700`,danger:`text-danger-700`,important:`text-important-700`,info:`text-info-700`,neutral:`text-neutral-700`,success:`text-success-700`,warning:`text-warning-700`};function m(e,t){switch(t){case`muted`:return p[e];default:o(!1,`Invalid appearance: ${String(t)}`)}}export{u as Badge};
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-d-nMCfAI.js";import{t as n}from"./slot-DpNWVci8.js";import{Children as r,cloneElement as i,isValidElement as a}from"react";import o from"tiny-invariant";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";const u=({appearance:u,asChild:d=!1,children:p,className:h,color:g=`neutral`,icon:_,...v})=>{let y=f(g,u),b=m(g,u),x=e(`inline-flex w-fit shrink-0 cursor-default items-center gap-1 rounded px-1.5 py-0.5 font-medium text-xs font-sans`,_&&`ps-1`,y,b,h);if(d){let e=r.only(p);o(a(e),"When using `asChild`, Badge must be passed a single child as a JSX tag.");let u=e.props?.children;return c(n,{"data-slot":`badge`,className:x,...v,children:i(e,{},l(s,{children:[_&&c(t,{className:`size-4`,svg:_}),c(`span`,{"data-slot":`badge-label`,children:u})]}))})}return l(`span`,{"data-slot":`badge`,className:x,...v,children:[_&&c(t,{className:`size-4`,svg:_}),c(`span`,{"data-slot":`badge-label`,children:p})]})},d={amber:`bg-amber-500/20`,blue:`bg-blue-500/20`,cyan:`bg-cyan-500/20`,emerald:`bg-emerald-500/20`,fuchsia:`bg-fuchsia-500/20`,gray:`bg-gray-500/20`,green:`bg-green-500/20`,indigo:`bg-indigo-500/20`,lime:`bg-lime-500/20`,orange:`bg-orange-500/20`,pink:`bg-pink-500/20`,purple:`bg-purple-500/20`,red:`bg-red-500/20`,rose:`bg-rose-500/20`,sky:`bg-sky-500/20`,teal:`bg-teal-500/20`,violet:`bg-violet-500/20`,yellow:`bg-yellow-500/20`,accent:`bg-accent-500/20`,danger:`bg-danger-500/20`,important:`bg-important-500/20`,info:`bg-info-500/20`,neutral:`bg-neutral-500/20`,success:`bg-success-500/20`,warning:`bg-warning-500/20`};function f(e,t){switch(t){case`muted`:return d[e];default:o(!1,`Invalid appearance: ${String(t)}`)}}const p={amber:`text-amber-700`,blue:`text-blue-700`,cyan:`text-cyan-700`,emerald:`text-emerald-700`,fuchsia:`text-fuchsia-700`,gray:`text-gray-700`,green:`text-green-700`,indigo:`text-indigo-700`,lime:`text-lime-700`,orange:`text-orange-700`,pink:`text-pink-700`,purple:`text-purple-700`,red:`text-red-700`,rose:`text-rose-700`,sky:`text-sky-700`,teal:`text-teal-700`,violet:`text-violet-700`,yellow:`text-yellow-700`,accent:`text-accent-700`,danger:`text-danger-700`,important:`text-important-700`,info:`text-info-700`,neutral:`text-neutral-700`,success:`text-success-700`,warning:`text-warning-700`};function m(e,t){switch(t){case`muted`:return p[e];default:o(!1,`Invalid appearance: ${String(t)}`)}}export{u as Badge};
|
|
@@ -100,6 +100,16 @@ type ButtonProps = ComponentProps<"button"> & Omit<ButtonVariants, "appearance"
|
|
|
100
100
|
* while `IconButton` requires a screen-reader `label` and renders a square
|
|
101
101
|
* box on the same shared size scale.
|
|
102
102
|
*
|
|
103
|
+
* **Structure.** `children` render inside a `<span data-slot="button-label">`,
|
|
104
|
+
* beside the `icon` slot. Target that slot to style the label — for example, to
|
|
105
|
+
* clamp a long one with `min-w-0 truncate`. The label is one flex item, so the
|
|
106
|
+
* button's `gap` falls between the icon and the label, never between two
|
|
107
|
+
* `children`: pass an icon through `icon`, not as a child.
|
|
108
|
+
*
|
|
109
|
+
* | Data Attribute | Value | Description |
|
|
110
|
+
* | -------------- | ---------------- | ---------------------------------------------------------------------------- |
|
|
111
|
+
* | `data-slot` | `"button-label"` | On the `<span>` wrapping `children`. Stable styling hook for the label text. |
|
|
112
|
+
*
|
|
103
113
|
* @see https://mantle.ngrok.com/components/actions/button
|
|
104
114
|
*
|
|
105
115
|
* @example
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as WithAsChild } from "./as-child-D23mGo4f.js";
|
|
2
2
|
import { r as VariantProps } from "./index-DA4ig3gj.js";
|
|
3
|
-
import "./button-
|
|
3
|
+
import "./button-BH79w6HV.js";
|
|
4
4
|
import "./button-DJ7AAgII.js";
|
|
5
5
|
import { ComponentProps } from "react";
|
|
6
6
|
//#region src/components/button/button-group.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-lZ48P8Nn.js";import{t as n}from"./slot-DpNWVci8.js";import{t as r}from"./booleanish-BfvnW6vy.js";import{t as i}from"./clsx-DUGZgXfJ.js";import{Children as a,cloneElement as o,isValidElement as s}from"react";import c from"tiny-invariant";import{Fragment as l,jsx as u,jsxs as d}from"react/jsx-runtime";import{cva as f}from"class-variance-authority";import{CircleNotchIcon as p}from"@phosphor-icons/react/CircleNotch";const m=f(``,{variants:{appearance:{filled:`bg-filled-accent text-white focus-visible:ring-focus-accent not-disabled:hover:bg-filled-accent-hover border border-transparent text-sm font-medium`,ghost:`text-accent-600 focus-visible:ring-focus-accent not-disabled:hover:bg-accent-500/10 not-disabled:hover:text-accent-700 border border-transparent text-sm font-medium`,outlined:`border-accent-600 bg-form text-accent-600 focus-visible:ring-focus-accent not-disabled:hover:border-accent-700 not-disabled:hover:bg-accent-500/10 not-disabled:hover:text-accent-700 border text-sm font-medium`,link:`text-accent-600 focus-visible:ring-focus-accent not-disabled:hover:underline group/button-link border-transparent`},isLoading:{false:``,true:`opacity-50`},intent:{accent:``,danger:``,neutral:``},size:{xs:``,sm:``,md:``,lg:``,xl:``}},defaultVariants:{isLoading:!1,size:`md`},compoundVariants:[{appearance:[`filled`,`ghost`,`outlined`],size:`xs`,class:`h-6 px-2`},{appearance:[`filled`,`ghost`,`outlined`],size:`sm`,class:`h-7 px-2.5`},{appearance:[`filled`,`ghost`,`outlined`],size:`md`,class:`h-9 px-3`},{appearance:[`filled`,`ghost`,`outlined`],size:`lg`,class:`h-10 px-3.5`},{appearance:[`filled`,`ghost`,`outlined`],size:`xl`,class:`h-12 px-4`},{appearance:`ghost`,intent:`danger`,class:`text-danger-600 focus-visible:ring-focus-danger not-disabled:hover:bg-danger-500/10 not-disabled:hover:text-danger-700 border-transparent`},{appearance:`outlined`,intent:`danger`,class:`border-danger-600 bg-form text-danger-600 focus-visible:ring-focus-danger not-disabled:hover:border-danger-700 not-disabled:hover:bg-danger-500/10 not-disabled:hover:text-danger-700`},{appearance:`filled`,intent:`danger`,class:`bg-filled-danger focus-visible:ring-focus-danger not-disabled:hover:bg-filled-danger-hover border-transparent`},{appearance:`link`,intent:`danger`,class:`text-danger-600 focus-visible:ring-focus-danger`},{appearance:`ghost`,intent:`neutral`,class:`text-strong focus-visible:ring-focus-accent not-disabled:hover:bg-neutral-500/10 not-disabled:hover:text-strong border-transparent`},{appearance:`outlined`,intent:`neutral`,class:`border-form bg-form text-strong focus-visible:border-accent-600 focus-visible:ring-focus-accent not-disabled:hover:border-neutral-400 not-disabled:hover:bg-form-hover not-disabled:hover:text-strong focus-visible:not-disabled:hover:border-accent-600`},{appearance:`filled`,intent:`neutral`,class:`bg-filled-neutral not-disabled:hover:bg-filled-neutral-hover border-transparent focus-visible:border-transparent text-neutral-50`},{appearance:`link`,intent:`neutral`,class:`text-strong focus-visible:ring-focus-accent`}]}),h={xs:`ps-1.5`,sm:`ps-2`,md:`ps-2.5`,lg:`ps-3`,xl:`ps-3.5`},g={xs:`pe-1.5`,sm:`pe-2`,md:`pe-2.5`,lg:`pe-3`,xl:`pe-3.5`},_=({"aria-disabled":f,appearance:_,asChild:v,children:y,className:b,disabled:x,icon:S,iconPlacement:C=`start`,intent:w,isLoading:T=!1,ref:E,size:D=`md`,type:O,...k})=>{let A=r(f??x??T),j=T?u(p,{className:`animate-spin`}):S,M=j&&_!==`link`,N={"aria-disabled":A,"data-slot":`button`,className:e(`inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md`,`focus:outline-hidden focus-visible:ring-4`,`disabled:cursor-default disabled:opacity-50`,`not-disabled:active:scale-97 ease-out transition-transform duration-150`,m({appearance:_,intent:w,isLoading:T,size:D}),_!==`link`&&`font-sans`,M&&C===`start`&&h[D],M&&C===`end`&&g[D],b),"data-appearance":_,"data-disabled":A,"data-intent":w,"data-loading":T,"data-size":_===`link`?void 0:D,disabled:A,ref:E,...k};return v?(c(s(y)&&a.only(y),"When using `asChild`, Button must be passed a single child as a JSX tag."),u(n,{...N,children:o(y,{},d(l,{children:[j&&u(t,{svg:j,className:i(C===`end`&&`order-last`)}),y.props.children]}))})):d(`button`,{...N,type:O??`button`,children:[j&&u(t,{svg:j,className:i(C===`end`&&`order-last`)}),y]})};export{_ as t};
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-lZ48P8Nn.js";import{t as n}from"./slot-DpNWVci8.js";import{t as r}from"./booleanish-BfvnW6vy.js";import{t as i}from"./clsx-DUGZgXfJ.js";import{Children as a,cloneElement as o,isValidElement as s}from"react";import c from"tiny-invariant";import{Fragment as l,jsx as u,jsxs as d}from"react/jsx-runtime";import{cva as f}from"class-variance-authority";import{CircleNotchIcon as p}from"@phosphor-icons/react/CircleNotch";const m=f(``,{variants:{appearance:{filled:`bg-filled-accent text-white focus-visible:ring-focus-accent not-disabled:hover:bg-filled-accent-hover border border-transparent text-sm font-medium`,ghost:`text-accent-600 focus-visible:ring-focus-accent not-disabled:hover:bg-accent-500/10 not-disabled:hover:text-accent-700 border border-transparent text-sm font-medium`,outlined:`border-accent-600 bg-form text-accent-600 focus-visible:ring-focus-accent not-disabled:hover:border-accent-700 not-disabled:hover:bg-accent-500/10 not-disabled:hover:text-accent-700 border text-sm font-medium`,link:`text-accent-600 focus-visible:ring-focus-accent not-disabled:hover:underline group/button-link border-transparent`},isLoading:{false:``,true:`opacity-50`},intent:{accent:``,danger:``,neutral:``},size:{xs:``,sm:``,md:``,lg:``,xl:``}},defaultVariants:{isLoading:!1,size:`md`},compoundVariants:[{appearance:[`filled`,`ghost`,`outlined`],size:`xs`,class:`h-6 px-2`},{appearance:[`filled`,`ghost`,`outlined`],size:`sm`,class:`h-7 px-2.5`},{appearance:[`filled`,`ghost`,`outlined`],size:`md`,class:`h-9 px-3`},{appearance:[`filled`,`ghost`,`outlined`],size:`lg`,class:`h-10 px-3.5`},{appearance:[`filled`,`ghost`,`outlined`],size:`xl`,class:`h-12 px-4`},{appearance:`ghost`,intent:`danger`,class:`text-danger-600 focus-visible:ring-focus-danger not-disabled:hover:bg-danger-500/10 not-disabled:hover:text-danger-700 border-transparent`},{appearance:`outlined`,intent:`danger`,class:`border-danger-600 bg-form text-danger-600 focus-visible:ring-focus-danger not-disabled:hover:border-danger-700 not-disabled:hover:bg-danger-500/10 not-disabled:hover:text-danger-700`},{appearance:`filled`,intent:`danger`,class:`bg-filled-danger focus-visible:ring-focus-danger not-disabled:hover:bg-filled-danger-hover border-transparent`},{appearance:`link`,intent:`danger`,class:`text-danger-600 focus-visible:ring-focus-danger`},{appearance:`ghost`,intent:`neutral`,class:`text-strong focus-visible:ring-focus-accent not-disabled:hover:bg-neutral-500/10 not-disabled:hover:text-strong border-transparent`},{appearance:`outlined`,intent:`neutral`,class:`border-form bg-form text-strong focus-visible:border-accent-600 focus-visible:ring-focus-accent not-disabled:hover:border-neutral-400 not-disabled:hover:bg-form-hover not-disabled:hover:text-strong focus-visible:not-disabled:hover:border-accent-600`},{appearance:`filled`,intent:`neutral`,class:`bg-filled-neutral not-disabled:hover:bg-filled-neutral-hover border-transparent focus-visible:border-transparent text-neutral-50`},{appearance:`link`,intent:`neutral`,class:`text-strong focus-visible:ring-focus-accent`}]}),h={xs:`ps-1.5`,sm:`ps-2`,md:`ps-2.5`,lg:`ps-3`,xl:`ps-3.5`},g={xs:`pe-1.5`,sm:`pe-2`,md:`pe-2.5`,lg:`pe-3`,xl:`pe-3.5`},_=({"aria-disabled":f,appearance:_,asChild:v,children:y,className:b,disabled:x,icon:S,iconPlacement:C=`start`,intent:w,isLoading:T=!1,ref:E,size:D=`md`,type:O,...k})=>{let A=r(f??x??T),j=T?u(p,{className:`animate-spin`}):S,M=j&&_!==`link`,N={"aria-disabled":A,"data-slot":`button`,className:e(`inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md`,`focus:outline-hidden focus-visible:ring-4`,`disabled:cursor-default disabled:opacity-50`,`not-disabled:active:scale-97 ease-out transition-transform duration-150`,m({appearance:_,intent:w,isLoading:T,size:D}),_!==`link`&&`font-sans`,M&&C===`start`&&h[D],M&&C===`end`&&g[D],b),"data-appearance":_,"data-disabled":A,"data-intent":w,"data-loading":T,"data-size":_===`link`?void 0:D,disabled:A,ref:E,...k};return v?(c(s(y)&&a.only(y),"When using `asChild`, Button must be passed a single child as a JSX tag."),u(n,{...N,children:o(y,{},d(l,{children:[j&&u(t,{svg:j,className:i(C===`end`&&`order-last`)}),u(`span`,{"data-slot":`button-label`,children:y.props.children})]}))})):d(`button`,{...N,type:O??`button`,children:[j&&u(t,{svg:j,className:i(C===`end`&&`order-last`)}),u(`span`,{"data-slot":`button-label`,children:y})]})};export{_ as t};
|
package/dist/button.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as ButtonIntent } from "./button-DdSKSj1c.js";
|
|
2
|
-
import { n as ButtonAppearance, r as ButtonProps, t as Button } from "./button-
|
|
2
|
+
import { n as ButtonAppearance, r as ButtonProps, t as Button } from "./button-BH79w6HV.js";
|
|
3
3
|
import { n as IconButtonProps, r as IconButtonAppearance, t as IconButton } from "./button-DJ7AAgII.js";
|
|
4
|
-
import { n as ButtonGroupProps, t as ButtonGroup } from "./button-
|
|
4
|
+
import { n as ButtonGroupProps, t as ButtonGroup } from "./button-Dic5ZH4w.js";
|
|
5
5
|
import { t as ButtonSize } from "./button-BCoI4bhP.js";
|
|
6
6
|
export { Button, type ButtonAppearance, ButtonGroup, type ButtonGroupProps, type ButtonIntent, type ButtonProps, type ButtonSize, IconButton, type IconButtonAppearance, type IconButtonProps };
|
package/dist/button.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./button-
|
|
1
|
+
import{t as e}from"./button-hEoKi6ZG.js";import{t}from"./button-CCkGqE1t.js";import{t as n}from"./button-DmJkYfyl.js";export{e as Button,n as ButtonGroup,t as IconButton};
|
package/dist/code-block.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ declare const Root$1: ({ asChild, className, defaultTab, activeTab, onActiveTabC
|
|
|
68
68
|
* ```
|
|
69
69
|
*/
|
|
70
70
|
declare const Body: ({ asChild, className, ref, ...props }: ComponentProps<"div"> & WithAsChild) => import("react").JSX.Element;
|
|
71
|
-
type CodeBlockCodeProps = Omit<ComponentProps<"pre">, "children"> & {
|
|
71
|
+
type CodeBlockCodeProps = Omit<ComponentProps<"pre">, "children" | "translate"> & {
|
|
72
72
|
/**
|
|
73
73
|
* The code value produced by `mantleCode("lang")` tagged template.
|
|
74
74
|
* Contains pre-rendered Shiki HTML (when the Vite plugin is active) and
|
|
@@ -82,7 +82,13 @@ type CodeBlockCodeProps = Omit<ComponentProps<"pre">, "children"> & {
|
|
|
82
82
|
* Mantle's Vite plugin or server highlighter must set `value["~preHtml"]`.
|
|
83
83
|
* Runtime highlighting and runtime line decoration are intentionally unsupported.
|
|
84
84
|
*
|
|
85
|
+
* The `<pre>` always carries `translate="no"`, so a browser translation engine
|
|
86
|
+
* skips the code. A translated CLI flag, env var, or YAML key is wrong, and the
|
|
87
|
+
* reader copies it anyway. The `translate` prop is omitted from the type, so no
|
|
88
|
+
* call site can turn the guard off.
|
|
89
|
+
*
|
|
85
90
|
* @see https://mantle.ngrok.com/components/data-display/code-block#codeblockcode
|
|
91
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/translate
|
|
86
92
|
*
|
|
87
93
|
* @example
|
|
88
94
|
* ```tsx
|
|
@@ -126,6 +132,12 @@ declare const Header: ({ asChild, className, ref, ...props }: ComponentProps<"di
|
|
|
126
132
|
* The (optional) title of the `CodeBlock`. Renders as `h3` by default;
|
|
127
133
|
* use `asChild` to render a different element.
|
|
128
134
|
*
|
|
135
|
+
* The heading carries `translate="no"` by default, because the title usually names
|
|
136
|
+
* a file — `example.ts` — and a translated filename names a file that does not
|
|
137
|
+
* exist. The slot takes arbitrary children though, so pass `translate="yes"` when
|
|
138
|
+
* the title is prose rather than a filename. `CodeBlock.Code` takes no such
|
|
139
|
+
* override — a block of code is never translatable.
|
|
140
|
+
*
|
|
129
141
|
* @see https://mantle.ngrok.com/components/data-display/code-block#codeblocktitle
|
|
130
142
|
*
|
|
131
143
|
* @example
|
|
@@ -438,6 +450,9 @@ declare const CodeBlock: {
|
|
|
438
450
|
/**
|
|
439
451
|
* The code content. Renders pre-highlighted Shiki HTML when the Vite plugin is active.
|
|
440
452
|
*
|
|
453
|
+
* The `<pre>` always carries `translate="no"`, so a browser translation engine
|
|
454
|
+
* skips the code.
|
|
455
|
+
*
|
|
441
456
|
* @see https://mantle.ngrok.com/components/data-display/code-block#codeblockcode
|
|
442
457
|
*
|
|
443
458
|
* @example
|
|
@@ -626,6 +641,9 @@ declare const CodeBlock: {
|
|
|
626
641
|
/**
|
|
627
642
|
* The optional title rendered in the header.
|
|
628
643
|
*
|
|
644
|
+
* The heading carries `translate="no"` by default, because the title usually
|
|
645
|
+
* names a file. Pass `translate="yes"` when the title is prose instead.
|
|
646
|
+
*
|
|
629
647
|
* @see https://mantle.ngrok.com/components/data-display/code-block#codeblocktitle
|
|
630
648
|
*
|
|
631
649
|
* @example
|
package/dist/code-block.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./icon-lZ48P8Nn.js";import{t as r}from"./slot-DpNWVci8.js";import{t as i}from"./button-CCkGqE1t.js";import{t as a}from"./use-copy-to-clipboard-CSyp4Zk0.js";import{t as o}from"./icons-CF1lbWtp.js";import{S as s,_ as c,a as l,b as u,c as d,d as f,f as p,g as m,h,i as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as w,u as T,v as E,y as D}from"./code-block-CIE0F2fu.js";import{CaretDownIcon as O}from"@phosphor-icons/react/CaretDown";import{createContext as k,useCallback as A,useContext as j,useEffect as M,useId as N,useLayoutEffect as P,useMemo as F,useRef as I,useState as L}from"react";import R from"tiny-invariant";import{jsx as z,jsxs as ee}from"react/jsx-runtime";import{CheckIcon as te}from"@phosphor-icons/react/Check";import{CopyIcon as ne}from"@phosphor-icons/react/Copy";import{FileTextIcon as re}from"@phosphor-icons/react/FileText";import{TerminalIcon as ie}from"@phosphor-icons/react/Terminal";import{Content as ae,List as oe,Root as se,Trigger as B}from"@radix-ui/react-tabs";function V(e){let t=-1;for(let n=0;n<e.length;n++){let r=e[n];if(r===`&`||r===`<`||r===`>`||r===`"`||r===`'`){t=n;break}}if(t===-1)return e;let n=e.slice(0,t);for(let r=t;r<e.length;r++){let t=e[r];switch(t){case`&`:n+=`&`;break;case`<`:n+=`<`;break;case`>`:n+=`>`;break;case`"`:n+=`"`;break;case`'`:n+=`'`;break;default:n+=t}}return n}const H=new WeakMap;function U(e){let t=new Set;if(e==null||e===``)return t;for(let n of e.split(` `))n!==``&&t.add(n);return t}function W(e){let t=H.get(e);if(t!=null&&ce(t))return t;let n=new Map,r=new WeakMap,i=e.querySelectorAll(`[data-fold-regions]`);for(let e=0;e<i.length;e+=1){let t=i[e];if(!(t instanceof HTMLElement))continue;let a=U(t.dataset.foldRegions);if(a.size!==0){r.set(t,a);for(let e of a){let r=n.get(e);r??(r=[],n.set(e,r)),r.push(t)}}}let a={regionToLines:n,lineToRegions:r};return H.set(e,a),a}function G(e){H.delete(e)}function K(e){G(e),e.removeAttribute(`data-folded-regions`)}function ce(e){for(let t of e.regionToLines.values()){if(t.length===0)continue;let e=t[0];if(e!=null)return e.isConnected}return!0}function le(e,t,n){let r=!1;for(let e of n)if(t.has(e)){r=!0;break}r?e.dataset.foldHidden=`true`:delete e.dataset.foldHidden}function ue(e){let t=e.dataset.foldLine;if(t==null||t===``)return!1;let n=e.closest(`[data-slot='code-block-code']`)?.querySelector(`code`);if(n==null)return!1;let r=U(n.getAttribute(`data-folded-regions`)),i=!r.has(t);i?r.add(t):r.delete(t),r.size===0?n.removeAttribute(`data-folded-regions`):n.setAttribute(`data-folded-regions`,[...r].join(` `)),e.setAttribute(`aria-expanded`,i?`false`:`true`);let{regionToLines:a,lineToRegions:o}=W(n),s=a.get(t);if(s!=null)for(let e of s){let t=o.get(e);t!=null&&le(e,r,t)}return!0}function de(e){let t=e=>{let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`.mantle-code-fold-toggle`);n instanceof HTMLButtonElement&&ue(n)};return e.addEventListener(`click`,t),()=>{e.removeEventListener(`click`,t)}}const q=k(null);function J(){let e=j(q);return R(e!=null,`CodeBlock subcomponents must be rendered within a <CodeBlock.Root>.`),e}const fe=({asChild:e=!1,className:n,defaultTab:i,activeTab:a,onActiveTabChange:o,ref:s,...c})=>{let l=I(``),[u,d]=L(!1),[f,p]=L(!1),[m,h]=L(void 0),g=A(e=>{h(t=>(R(t==null,`You can only render a single CodeBlock.Code within a CodeBlock.`),e))},[]),_=A(e=>{h(t=>{R(t===e,`You can only render a single CodeBlock.Code within a CodeBlock.`)})},[]),v=F(()=>({codeId:m,copyTextRef:l,hasCodeExpander:u,isCodeExpanded:f,registerCodeId:g,setHasCodeExpander:d,setIsCodeExpanded:p,unregisterCodeId:_}),[m,u,f,g,_]),y=i!=null||a!=null,b=z(e?r:`div`,{"data-slot":`code-block`,className:t(`text-mono w-full overflow-hidden rounded-md border border-gray-300 bg-base font-mono`,`[&_svg]:shrink-0`,n),ref:s,...c});return z(q.Provider,{value:v,children:y?z(se,{asChild:!0,defaultValue:i,value:a,onValueChange:o,children:b}):b})},pe=({asChild:e=!1,className:n,ref:i,...a})=>z(e?r:`div`,{"data-slot":`code-block-body`,className:t(`relative`,n),ref:i,...a}),me=/SHIKI_VAL_(\d+)/g;function he(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const Y=new Map;function ge(e){if(e==null||e.length===0)return me;let t=Y.get(e);return t??(Y.size>=500&&Y.clear(),t=RegExp(`${he(e)}(\\d+)__`,`g`),Y.set(e,t)),t}function X(e,t,n,r){if(n==null){if(!e.includes(`SHIKI_VAL_`))return e}else if(!e.includes(n))return e;return e.replaceAll(ge(n),(e,n)=>{let i=Number.parseInt(n,10);return Number.isNaN(i)||i<0||i>=t.length?e:r(t[i])})}function _e(e,t,n){return X(e,t,n,e=>V(String(e)))}function ve(e,t,n){return X(e,t,n,e=>String(e))}const ye=({className:n,style:r,value:i,ref:a,...o})=>{let s=N(),c=I(null),{copyTextRef:l,hasCodeExpander:u,isCodeExpanded:d,registerCodeId:f,unregisterCodeId:p}=J(),{language:m,code:h,"~preValToken":g,"~preVals":_,"~highlightLines":v,"~lineNumberStart":y,"~preHtml":b,"~showLineNumbers":x}=i,S=v,C=y??1,w=x??!1,T=F(()=>_!=null&&_.length>0?ve(h,_,g):h,[g,_,h]);P(()=>{l.current=T},[l,T]),M(()=>(f(s),()=>{p(s)}),[s,f,p]);let E=F(()=>{if(b!=null)return _!=null&&_.length>0?_e(b,_,g):b},[b,g,_]);M(()=>{let e=c.current;if(e==null)return;let t=e.querySelector(`code`);return t!=null&&K(t),de(e)},[E]);let D=E!=null,O=E??V(T),k=F(()=>({__html:O}),[O]);return z(`pre`,{"data-slot":`code-block-code`,"aria-expanded":u?d:void 0,className:t(`scrollbar overflow-x-auto overflow-y-hidden py-4`,!D&&`pr-14`,`data-[mantle-line-numbers~='false']:pl-4`,`text-mono m-0 font-mono outline-hidden`,`aria-collapsed:max-h-[13.6rem]`,n),"data-highlighted":D?`true`:`false`,"data-lang":m,"data-mantle-highlight-lines":D&&S!=null&&S.length>0?S.join(`,`):void 0,"data-mantle-line-number-start":D&&w?String(C):`1`,"data-mantle-line-numbers":D&&w?`true`:`false`,id:s,ref:e(c,a),style:{...r,"--mantle-line-number-start":String(C),tabSize:2,MozTabSize:2},...o,children:z(`code`,{className:`text-size-inherit block min-w-full w-max`,dangerouslySetInnerHTML:k})})},be=({asChild:e=!1,className:n,ref:i,...a})=>z(e?r:`div`,{"data-slot":`code-block-header`,className:t(`flex items-center gap-1 border-b border-gray-300 bg-base px-4 py-2 text-gray-700`,n),ref:i,...a}),xe=({asChild:e=!1,className:n,ref:i,...a})=>z(e?r:`h3`,{"data-slot":`code-block-title`,ref:i,className:t(`m-0 font-sans text-xs font-medium`,n)
|
|
1
|
+
import{t as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./icon-lZ48P8Nn.js";import{t as r}from"./slot-DpNWVci8.js";import{t as i}from"./button-CCkGqE1t.js";import{t as a}from"./use-copy-to-clipboard-CSyp4Zk0.js";import{t as o}from"./icons-CF1lbWtp.js";import{S as s,_ as c,a as l,b as u,c as d,d as f,f as p,g as m,h,i as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as w,u as T,v as E,y as D}from"./code-block-CIE0F2fu.js";import{CaretDownIcon as O}from"@phosphor-icons/react/CaretDown";import{createContext as k,useCallback as A,useContext as j,useEffect as M,useId as N,useLayoutEffect as P,useMemo as F,useRef as I,useState as L}from"react";import R from"tiny-invariant";import{jsx as z,jsxs as ee}from"react/jsx-runtime";import{CheckIcon as te}from"@phosphor-icons/react/Check";import{CopyIcon as ne}from"@phosphor-icons/react/Copy";import{FileTextIcon as re}from"@phosphor-icons/react/FileText";import{TerminalIcon as ie}from"@phosphor-icons/react/Terminal";import{Content as ae,List as oe,Root as se,Trigger as B}from"@radix-ui/react-tabs";function V(e){let t=-1;for(let n=0;n<e.length;n++){let r=e[n];if(r===`&`||r===`<`||r===`>`||r===`"`||r===`'`){t=n;break}}if(t===-1)return e;let n=e.slice(0,t);for(let r=t;r<e.length;r++){let t=e[r];switch(t){case`&`:n+=`&`;break;case`<`:n+=`<`;break;case`>`:n+=`>`;break;case`"`:n+=`"`;break;case`'`:n+=`'`;break;default:n+=t}}return n}const H=new WeakMap;function U(e){let t=new Set;if(e==null||e===``)return t;for(let n of e.split(` `))n!==``&&t.add(n);return t}function W(e){let t=H.get(e);if(t!=null&&ce(t))return t;let n=new Map,r=new WeakMap,i=e.querySelectorAll(`[data-fold-regions]`);for(let e=0;e<i.length;e+=1){let t=i[e];if(!(t instanceof HTMLElement))continue;let a=U(t.dataset.foldRegions);if(a.size!==0){r.set(t,a);for(let e of a){let r=n.get(e);r??(r=[],n.set(e,r)),r.push(t)}}}let a={regionToLines:n,lineToRegions:r};return H.set(e,a),a}function G(e){H.delete(e)}function K(e){G(e),e.removeAttribute(`data-folded-regions`)}function ce(e){for(let t of e.regionToLines.values()){if(t.length===0)continue;let e=t[0];if(e!=null)return e.isConnected}return!0}function le(e,t,n){let r=!1;for(let e of n)if(t.has(e)){r=!0;break}r?e.dataset.foldHidden=`true`:delete e.dataset.foldHidden}function ue(e){let t=e.dataset.foldLine;if(t==null||t===``)return!1;let n=e.closest(`[data-slot='code-block-code']`)?.querySelector(`code`);if(n==null)return!1;let r=U(n.getAttribute(`data-folded-regions`)),i=!r.has(t);i?r.add(t):r.delete(t),r.size===0?n.removeAttribute(`data-folded-regions`):n.setAttribute(`data-folded-regions`,[...r].join(` `)),e.setAttribute(`aria-expanded`,i?`false`:`true`);let{regionToLines:a,lineToRegions:o}=W(n),s=a.get(t);if(s!=null)for(let e of s){let t=o.get(e);t!=null&&le(e,r,t)}return!0}function de(e){let t=e=>{let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`.mantle-code-fold-toggle`);n instanceof HTMLButtonElement&&ue(n)};return e.addEventListener(`click`,t),()=>{e.removeEventListener(`click`,t)}}const q=k(null);function J(){let e=j(q);return R(e!=null,`CodeBlock subcomponents must be rendered within a <CodeBlock.Root>.`),e}const fe=({asChild:e=!1,className:n,defaultTab:i,activeTab:a,onActiveTabChange:o,ref:s,...c})=>{let l=I(``),[u,d]=L(!1),[f,p]=L(!1),[m,h]=L(void 0),g=A(e=>{h(t=>(R(t==null,`You can only render a single CodeBlock.Code within a CodeBlock.`),e))},[]),_=A(e=>{h(t=>{R(t===e,`You can only render a single CodeBlock.Code within a CodeBlock.`)})},[]),v=F(()=>({codeId:m,copyTextRef:l,hasCodeExpander:u,isCodeExpanded:f,registerCodeId:g,setHasCodeExpander:d,setIsCodeExpanded:p,unregisterCodeId:_}),[m,u,f,g,_]),y=i!=null||a!=null,b=z(e?r:`div`,{"data-slot":`code-block`,className:t(`text-mono w-full overflow-hidden rounded-md border border-gray-300 bg-base font-mono`,`[&_svg]:shrink-0`,n),ref:s,...c});return z(q.Provider,{value:v,children:y?z(se,{asChild:!0,defaultValue:i,value:a,onValueChange:o,children:b}):b})},pe=({asChild:e=!1,className:n,ref:i,...a})=>z(e?r:`div`,{"data-slot":`code-block-body`,className:t(`relative`,n),ref:i,...a}),me=/SHIKI_VAL_(\d+)/g;function he(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const Y=new Map;function ge(e){if(e==null||e.length===0)return me;let t=Y.get(e);return t??(Y.size>=500&&Y.clear(),t=RegExp(`${he(e)}(\\d+)__`,`g`),Y.set(e,t)),t}function X(e,t,n,r){if(n==null){if(!e.includes(`SHIKI_VAL_`))return e}else if(!e.includes(n))return e;return e.replaceAll(ge(n),(e,n)=>{let i=Number.parseInt(n,10);return Number.isNaN(i)||i<0||i>=t.length?e:r(t[i])})}function _e(e,t,n){return X(e,t,n,e=>V(String(e)))}function ve(e,t,n){return X(e,t,n,e=>String(e))}const ye=({className:n,style:r,value:i,ref:a,...o})=>{let s=N(),c=I(null),{copyTextRef:l,hasCodeExpander:u,isCodeExpanded:d,registerCodeId:f,unregisterCodeId:p}=J(),{language:m,code:h,"~preValToken":g,"~preVals":_,"~highlightLines":v,"~lineNumberStart":y,"~preHtml":b,"~showLineNumbers":x}=i,S=v,C=y??1,w=x??!1,T=F(()=>_!=null&&_.length>0?ve(h,_,g):h,[g,_,h]);P(()=>{l.current=T},[l,T]),M(()=>(f(s),()=>{p(s)}),[s,f,p]);let E=F(()=>{if(b!=null)return _!=null&&_.length>0?_e(b,_,g):b},[b,g,_]);M(()=>{let e=c.current;if(e==null)return;let t=e.querySelector(`code`);return t!=null&&K(t),de(e)},[E]);let D=E!=null,O=E??V(T),k=F(()=>({__html:O}),[O]);return z(`pre`,{"data-slot":`code-block-code`,"aria-expanded":u?d:void 0,className:t(`scrollbar overflow-x-auto overflow-y-hidden py-4`,!D&&`pr-14`,`data-[mantle-line-numbers~='false']:pl-4`,`text-mono m-0 font-mono outline-hidden`,`aria-collapsed:max-h-[13.6rem]`,n),"data-highlighted":D?`true`:`false`,"data-lang":m,"data-mantle-highlight-lines":D&&S!=null&&S.length>0?S.join(`,`):void 0,"data-mantle-line-number-start":D&&w?String(C):`1`,"data-mantle-line-numbers":D&&w?`true`:`false`,id:s,ref:e(c,a),style:{...r,"--mantle-line-number-start":String(C),tabSize:2,MozTabSize:2},...o,translate:`no`,children:z(`code`,{className:`text-size-inherit block min-w-full w-max`,dangerouslySetInnerHTML:k})})},be=({asChild:e=!1,className:n,ref:i,...a})=>z(e?r:`div`,{"data-slot":`code-block-header`,className:t(`flex items-center gap-1 border-b border-gray-300 bg-base px-4 py-2 text-gray-700`,n),ref:i,...a}),xe=({asChild:e=!1,className:n,ref:i,...a})=>z(e?r:`h3`,{"data-slot":`code-block-title`,ref:i,className:t(`m-0 font-sans text-xs font-medium`,n),translate:`no`,...a}),Se=({className:e,label:n=`Copy code`,onCopy:r,onCopyError:o,onClick:s,ref:c,...l})=>{let{copyTextRef:u}=J(),d=a(),[f,p]=L(!1),m=I(void 0);return M(()=>()=>{m.current!=null&&clearTimeout(m.current)},[]),z(`span`,{"data-slot":`code-block-copy-button`,className:`absolute right-3 top-3 z-10 inline-flex size-7 items-center justify-center rounded-[var(--icon-button-border-radius,0.375rem)] bg-base`,children:z(i,{type:`button`,appearance:`ghost`,intent:`neutral`,size:`sm`,label:n,icon:z(f?te:ne,{}),className:t(`bg-base not-disabled:hover:bg-neutral-500/15`,e),ref:c,onClick:async e=>{try{if(s?.(e),e.defaultPrevented){m.current!=null&&clearTimeout(m.current);return}let t=u.current;await d(t),r?.(t),p(!0),m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{p(!1)},2e3)}catch(e){o?.(e)}},...l})})},Z=({asChild:e=!1,className:i,onClick:a,ref:o,...s})=>{let{codeId:c,isCodeExpanded:l,setIsCodeExpanded:u,setHasCodeExpander:d}=J();return M(()=>(d(!0),()=>{d(!1)}),[d]),ee(e?r:`button`,{...s,"data-slot":`code-block-expander-button`,"aria-controls":c,"aria-expanded":l,className:t(`flex w-full items-center justify-center gap-0.5 border-t border-gray-300 bg-base px-4 py-2 font-sans text-gray-700 hover:bg-base-hover`,i),ref:o,type:`button`,onClick:e=>{u(e=>!e),a?.(e)},children:[l?`Show less`:`Show more`,` `,z(n,{svg:z(O,{weight:`bold`}),className:t(`size-4`,l&&`rotate-180`,`transition-all duration-150`)})]})};function Ce({className:e,preset:r,svg:i,...a}){let s=i;if(r!=null)switch(r){case`file`:s=z(re,{weight:`fill`});break;case`cli`:s=z(ie,{weight:`fill`});break;case`traffic-policy`:s=z(o,{})}return z(n,{"data-slot":`code-block-icon`,className:t(`size-5`,e),svg:s,...a})}const we={Root:fe,Body:pe,Code:ye,CopyButton:Se,ExpanderButton:Z,Header:be,Icon:Ce,TabContent:e=>z(ae,{"data-slot":`code-block-tab-content`,...e}),TabList:({className:e,ref:n,...r})=>z(oe,{"data-slot":`code-block-tab-list`,className:t(`scroll-fade-x flex min-w-0 items-center gap-1 overflow-x-auto overscroll-x-none`,`-m-1 p-1`,e),ref:n,...r}),TabTrigger:({className:e,ref:n,...r})=>z(B,{"data-slot":`code-block-tab-trigger`,className:t(`shrink-0 cursor-pointer rounded px-1.5 py-0.5 font-sans text-xs font-medium whitespace-nowrap`,`text-gray-600 outline-hidden`,`hover:text-gray-900`,`data-[state=active]:bg-neutral-500/15 data-[state=active]:text-strong`,`focus-visible:ring-focus-accent focus-visible:ring-4`,e),ref:n,...r}),Title:xe},Q=`var(--shiki-foreground)`;function Te(e){return e.replace(/[&<]/g,e=>e===`&`?`&`:`<`)}function Ee(e){return e===` `||e===` `||e===`
|
|
2
2
|
`||e===`\r`||e===`{`||e===`}`||e===`[`||e===`]`||e===`:`||e===`,`||e===`"`}function De(e,t,n){let r=e.length,i=[],a=`"`,o=t+1;for(;o<r;){let t=e[o];if(t===`\\`){let t=e[o+1]===`u`&&/^[0-9a-fA-F]{4}$/.test(e.slice(o+2,o+6))?6:2;a!==``&&(i.push({text:a,isEscape:!1}),a=``),i.push({text:e.slice(o,o+t),isEscape:!0}),o+=t;continue}if(t===`"`){a+=`"`,o+=1;break}a+=t,o+=1}a!==``&&i.push({text:a,isEscape:!1});let s=o;for(;s<r;){let t=e[s];if(t===` `||t===` `||t===`
|
|
3
3
|
`||t===`\r`){s+=1;continue}break}let c=e[s]===`:`?`var(--shiki-token-keyword)`:`var(--shiki-token-string-expression)`;for(let e of i)n(e.text,e.isEscape?`var(--shiki-token-escape, var(--shiki-token-constant))`:c);return o}function Oe(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n!=null&&n.color==null){let r=Q;for(let n=t+1;n<e.length;n+=1){let t=e[n];if(t!=null&&t.color!=null){r=t.color;break}}n.color=r}}let t=``,n=``,r=null,i=()=>{r!=null&&(t+=`<span style="color:${r}">${Te(n)}</span>`),n=``,r=null};for(let t of e)t!=null&&(t.color===r?n+=t.text:(i(),n=t.text,r=t.color));return i(),`<span class="line">${t}</span>`}function $(e){let t=[[]],n=t[0]??[],r=e.length,i=0,a=(e,t)=>{n.push({text:e,color:t})};for(;i<r;){let o=e[i];if(o===`
|
|
4
4
|
`||o===`\r`){o===`\r`&&e[i+1]===`
|
package/dist/code.d.ts
CHANGED
|
@@ -18,7 +18,15 @@ import { ComponentProps } from "react";
|
|
|
18
18
|
* **Polymorphism.** Pass `asChild` to render `Code` styling on a different
|
|
19
19
|
* element (e.g. a link wrapping a code-styled label).
|
|
20
20
|
*
|
|
21
|
+
* **Translation.** The `<code>` element carries `translate="no"` by default, so a
|
|
22
|
+
* browser translation engine skips the subtree. A translated CLI flag, env var,
|
|
23
|
+
* or YAML key is wrong, and the reader copies it anyway. `Code` also styles terms
|
|
24
|
+
* that are not code, so pass `translate="yes"` when the content is prose.
|
|
25
|
+
* `Kbd` and `CodeBlock.Code` take no such override — a key and a block of code
|
|
26
|
+
* are never translatable.
|
|
27
|
+
*
|
|
21
28
|
* @see https://mantle.ngrok.com/components/data-display/code
|
|
29
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/translate
|
|
22
30
|
*
|
|
23
31
|
* @example
|
|
24
32
|
* ```tsx
|
package/dist/code.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-DpNWVci8.js";import{jsx as n}from"react/jsx-runtime";const r=({asChild:r,className:i,ref:a,...o})=>n(r?t:`code`,{ref:a,"data-slot":`code`,className:e(`border-gray-500/15 rounded-md border bg-gray-500/5 px-1 font-mono text-[0.8em]`,i)
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-DpNWVci8.js";import{jsx as n}from"react/jsx-runtime";const r=({asChild:r,className:i,ref:a,...o})=>n(r?t:`code`,{ref:a,"data-slot":`code`,className:e(`border-gray-500/15 rounded-md border bg-gray-500/5 px-1 font-mono text-[0.8em]`,i),translate:`no`,...o});export{r as Code};
|
package/dist/command.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{n as r}from"./separator-D0D6VyyM.js";import{t as i}from"./dialog-32Hq6w6P.js";import{n as a,t as o}from"./use-is-apple-platform-Cxwrb86L.js";import{t as s}from"./use-callback-ref-IYti9y7x.js";import{t as c}from"./kbd-
|
|
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{n as r}from"./separator-D0D6VyyM.js";import{t as i}from"./dialog-32Hq6w6P.js";import{n as a,t as o}from"./use-is-apple-platform-Cxwrb86L.js";import{t as s}from"./use-callback-ref-IYti9y7x.js";import{t as c}from"./kbd-B9qmYaW8.js";import{createContext as l,useCallback as u,useContext as d,useEffect as f,useMemo as p,useRef as m,useState as h}from"react";import g from"tiny-invariant";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{MagnifyingGlassIcon as y}from"@phosphor-icons/react/MagnifyingGlass";import{Command as b,useCommandState as x}from"cmdk";const S=l(null);function C(){let e=d(S);return g(e,`useCommandDialog must be used within Command.DialogRoot.`),e}function w(){return d(S)}function T(e){let t=d(S);return g(t,`Command.${e} must be rendered inside Command.DialogRoot.`),t}const E=new Set([` `,`Enter`]);function D(e){return e.isComposing||e.key===`Process`||e.keyCode===229?{type:`open`}:e.metaKey||e.ctrlKey||e.altKey||E.has(e.key)?{type:`ignore`}:[...e.key].length===1?{type:`seed`,query:e.key}:{type:`ignore`}}function O(e){let t=(e.clipboardData?.getData(`text/plain`)??``).replace(/\s+/g,` `).trim();return t===``?{type:`open`}:{type:`seed`,query:t}}const k=({"aria-keyshortcuts":e,children:r,"data-slot":a,onKeyDown:s,onPaste:c,...l})=>{let{keyboardShortcut:u,open:d,openWithQuery:f}=T(`SearchTrigger`),p=o(),m=e=>{e.type!==`ignore`&&f(e.type===`seed`?e.query:void 0)},h=p?`Meta+K`:`Control+K`;return _(i.Trigger,{asChild:!0,children:_(n,{...l,"aria-keyshortcuts":e??(u?h:void 0),"data-slot":t(a,`command-search-trigger`),"data-state":d?`open`:`closed`,onKeyDown:e=>{if(s?.(e),e.defaultPrevented)return;let t=D(e.nativeEvent);t.type===`seed`&&e.preventDefault(),m(t)},onPaste:e=>{c?.(e),!e.defaultPrevented&&m(O(e.nativeEvent))},children:r})})},A=[];function j(){let e=Symbol(`command-keyboard-shortcut`);return A.push(e),{isOwner:()=>A[0]===e,release:()=>{let t=A.indexOf(e);t!==-1&&A.splice(t,1)}}}function M(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName===`TEXTAREA`:!1}function N({enabled:e,onTrigger:t}){let n=s(t);f(()=>{if(!e)return;let t=j(),r=a(),i=e=>{if(!t.isOwner()||e.defaultPrevented||e.repeat||M(e.target))return;let i=r?e.metaKey:e.ctrlKey,a=r?e.ctrlKey:e.metaKey;e.key.toLowerCase()===`k`&&i&&!a&&!e.altKey&&!e.shiftKey&&(e.preventDefault(),n())};return window.addEventListener(`keydown`,i),()=>{window.removeEventListener(`keydown`,i),t.release()}},[e,n])}const P=({className:t,...n})=>_(b,{"data-slot":`command`,className:e(`bg-popover flex h-full w-full flex-col overflow-hidden rounded-md`,t),...n}),F={Root:P,DialogRoot:({children:e,defaultOpen:t=!1,keyboardShortcut:n=!0,onOpenChange:r,open:a,...o})=>{let s=a!=null,[c,l]=h(t),d=s?a:c,[f,m]=h(``),g=u((e,t)=>{e&&m(t??``),s||l(e),r?.(e)},[s,r]),v=u(e=>{g(e)},[g]),y=u(e=>{g(!0,e)},[g]),b=u(()=>{g(!d)},[g,d]);N({enabled:n,onTrigger:b});let x=p(()=>({keyboardShortcut:n,open:d,openWithQuery:y,query:f,setOpen:v,setQuery:m,toggle:b}),[n,d,y,f,v,b]);return _(S.Provider,{value:x,children:_(i.Root,{open:d,onOpenChange:v,...o,children:e})})},SearchTrigger:k,DialogTrigger:i.Trigger,DialogContent:({children:t,className:n,description:r=`Search for a command to run...`,filter:a,shouldFilter:o,showCloseButton:s=!0,title:c=`Command Palette`})=>{let l=m(null);return v(i.Content,{ref:l,className:e(`overflow-hidden p-0 relative`,n),onOpenAutoFocus:e=>{let t=l.current?.querySelector(`[data-slot~="command-input"]`);if(!(t instanceof HTMLInputElement)||t.disabled)return;e.preventDefault(),t.focus({preventScroll:!0});let n=t.value.length;t.setSelectionRange(n,n)},children:[v(i.Header,{className:`sr-only absolute`,children:[_(i.Title,{children:c}),_(i.Description,{children:r})]}),_(P,{className:`**:data-[slot=command-input-wrapper]:h-12 **:[[cmdk-input]]:h-12 **:data-[slot=command-group]:px-2 **:data-[slot=command-list]:pb-1`,filter:a,shouldFilter:o,children:t}),s&&_(`div`,{className:`absolute top-1.5 right-1.5`,children:_(i.CloseIconButton,{})})]})},Input:({className:n,"data-slot":r,onValueChange:i,ref:a,value:o,...s})=>{let c=w(),l=o!=null,u=l?o:c?.query;return v(`div`,{ref:a,"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b border-popover px-3`,children:[_(y,{className:`size-5 shrink-0 opacity-50`}),_(b.Input,{className:e(`placeholder:text-muted flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,n),onValueChange:e=>{l||c?.setQuery(e),i?.(e)},value:u,...s,"data-slot":t(r,`command-input`)})]})},List:({className:t,...n})=>_(b.List,{"data-slot":`command-list`,className:e(`max-h-75 scroll-py-1 overflow-x-hidden overflow-y-auto scrollbar`,t),...n}),Empty:({className:t,...n})=>_(b.Empty,{"data-slot":`command-empty`,className:e(`py-6 text-center text-sm`,t),...n}),Group:({className:t,...n})=>_(b.Group,{"data-slot":`command-group`,className:e(`[&>[cmdk-group-heading]]:text-muted overflow-hidden p-1 [&>[cmdk-group-heading]]:px-2 [&>[cmdk-group-heading]]:py-1.5 [&>[cmdk-group-heading]]:text-xs [&>[cmdk-group-heading]]:font-medium`,t),...n}),Item:({className:t,...n})=>_(b.Item,{"data-slot":`command-item`,className:e(`data-[selected=true]:bg-active-menu-item [:where(&_svg)]:text-muted relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [:where(&_svg)]:size-5`,t),...n}),Shortcut:({className:t,...n})=>_(`span`,{"data-slot":`command-shortcut`,className:e(`text-muted ml-auto text-xs tracking-widest`,t),...n}),Separator:({className:t,...n})=>_(b.Separator,{"data-slot":`command-separator`,asChild:!0,...n,children:_(r,{className:e(`-mx-1 my-1 w-auto`,t)})})};function I({className:t,...n}){let r=o(),i=r?`⌘`:`⌃`,a=r?`Command`:`Control`;return v(c,{...n,suppressHydrationWarning:!0,"data-slot":`meta-key`,className:e(i===`⌃`&&`font-medium`,t),children:[_(`span`,{className:`sr-only`,children:a}),i]})}export{F as Command,I as MetaKey,D as searchActionFromKeyDown,O as searchActionFromPaste,C as useCommandDialog,x as useCommandState};
|
package/dist/data-table.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as ButtonIntent } from "./button-DdSKSj1c.js";
|
|
2
|
-
import { n as ButtonAppearance, t as Button } from "./button-
|
|
2
|
+
import { n as ButtonAppearance, t as Button } from "./button-BH79w6HV.js";
|
|
3
3
|
import { r as IconButtonAppearance, t as IconButton } from "./button-DJ7AAgII.js";
|
|
4
4
|
import { s as SortingMode } from "./direction-BjU0bPST.js";
|
|
5
5
|
import { t as Table$1 } from "./table-D51ZtV4U.js";
|
package/dist/data-table.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./button-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./button-hEoKi6ZG.js";import{t as n}from"./button-CCkGqE1t.js";import{i as r}from"./direction-Wa9W2F61.js";import{t as i}from"./icons-B_DDQcVD.js";import{t as a}from"./table-C_Nm_RSV.js";import{Fragment as o,createContext as s,useContext as c,useMemo as l}from"react";import u from"tiny-invariant";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";import{flexRender as m}from"@tanstack/react-table";import{MinusIcon as h}from"@phosphor-icons/react/Minus";import{PlusIcon as g}from"@phosphor-icons/react/Plus";export*from"@tanstack/react-table";const _=[`unsorted`,`asc`,`desc`],v=[`unsorted`,`desc`,`asc`];function y(e,t){return b(t===`alphanumeric`?_:v,e)??`unsorted`}function b(e,t,n){if(e.length===0)return n;let r=e.findIndex(e=>e===t);if(r===-1)return n;let i=(r+1)%e.length;return e.at(i)??n}const x=s(null);function S(){let e=c(x);return u(e,`useDataTableContext should only be used within a DataTable child component`),e}function C({children:e,table:t,...n}){let r=l(()=>({table:t}),[t]);return f(x.Provider,{value:r,children:f(a.Root,{"data-slot":`data-table`,...n,children:f(a.Element,{children:e})})})}function w({canSort:e,sortDirection:t,sortingMode:n}){return!e||t===`unsorted`?``:n===`alphanumeric`?`Column sorted in ${t===`asc`?`ascending`:`descending`} order`:`Column sorted in ${r(t)} order`}function T({appearance:n=`ghost`,children:r,className:i,column:a,disableSorting:o=!1,iconPlacement:s=`end`,intent:c=`neutral`,sortingMode:l,sortIcon:u,onClick:d,...m}){let h=a.getIsSorted(),g=!o&&a.getCanSort(),_=g&&typeof h==`string`?h:`unsorted`,v=u?.(_)??f(V,{mode:l,direction:_});return p(t,{appearance:n,"data-slot":`data-table-header-sort-button`,className:e(`flex justify-start w-full h-full rounded-none not-disabled:active:scale-none`,n===`ghost`&&c===`neutral`&&`text-muted`,i),"data-sort-direction":_,"data-table-header-action":!0,icon:v,iconPlacement:s,onClick:e=>{d?.(e),!e.defaultPrevented&&(!g||o||l===void 0||H(a,l))},intent:c,type:`button`,...m,children:[f(`span`,{className:`sr-only`,children:w({canSort:g,sortDirection:_,sortingMode:l})}),r]})}function E({children:t,className:n,...r}){return f(a.Header,{"data-slot":`data-table-header`,className:e(`has-data-table-header-action:px-0`,n),...r,children:t})}const D=e=>f(a.Body,{"data-slot":`data-table-body`,...e});function O(e){let{table:t}=S();return f(a.Head,{"data-slot":`data-table-head`,...e,children:t.getHeaderGroups().map(e=>f(a.Row,{children:e.headers.map(e=>f(o,{children:e.isPlaceholder?f(a.Header,{},e.id):m(e.column.columnDef.header,e.getContext())},e.id))},e.id))})}function k({className:t,renderExpanded:n,row:r,...i}){let s=f(a.Row,{"data-slot":`data-table-row`,"data-expanded":r.getIsExpanded()||void 0,className:e(i.onClick&&`cursor-pointer`,t),...i,children:r.getVisibleCells().map(e=>f(o,{children:m(e.column.columnDef.cell,e.getContext())},e.id))});return n==null?s:p(d,{children:[s,r.getIsExpanded()&&f(z,{row:r,children:n(r)})]})}function A({children:e,...t}){let{table:n}=S(),r=n.getAllColumns().length;return f(a.Row,{"data-slot":`data-table-empty-row`,...t,children:f(a.Cell,{colSpan:r,children:e})})}function j(){return f(`span`,{"aria-hidden":!0,className:e(`pointer-events-none absolute -inset-y-px -left-1.5 w-1.5`,`opacity-0 transition-opacity group-data-sticky-active/table:opacity-100`,`shadow-[1px_0_0_0_var(--border-color-card-muted)]`,`bg-linear-to-l to-transparent`,`from-[color-mix(in_oklab,var(--shadow-color)_var(--shadow-second-opacity),transparent)]`)})}function M({children:t,className:n,...r}){return p(a.Cell,{"data-mantle-table-sticky-right":!0,"data-slot":`data-table-action-cell`,className:e(`sticky z-10 right-0 text-end align-middle bg-inherit p-2`,n),...r,children:[f(j,{}),t]})}function N({children:t,className:n,...r}){let{table:i}=S(),o=i.getRowModel().rows.length>0;return p(a.Header,{...o?{"data-mantle-table-sticky-right":!0}:{},"data-slot":`data-table-action-header`,className:e(o&&`sticky z-10 right-0 bg-inherit`,n),...r,children:[t,o&&f(j,{})]})}function P(e){return`data-table-expanded-row-${encodeURIComponent(e.id)}`}function F({children:t,className:n,...r}){return f(a.Header,{"data-slot":`data-table-expand-header`,className:e(`w-9 px-0 text-center`,n),...r,children:t??f(`span`,{className:`sr-only`,children:`Row details`})})}const I=f(g,{weight:`bold`,className:`size-3.5`}),L=f(h,{weight:`bold`,className:`size-3.5`});function R({appearance:t=`ghost`,className:r,collapseIcon:i=L,expandIcon:a=I,intent:o=`neutral`,label:s,onClick:c,row:l,size:u=`sm`,...d}){if(!l.getCanExpand())return null;let p=l.getIsExpanded(),m=l.getToggleExpandedHandler();return f(n,{type:`button`,"data-slot":`data-table-row-expand-button`,appearance:t,intent:o,size:u,className:e(`rounded`,r),"aria-expanded":p,"aria-controls":p?P(l):void 0,icon:p?i:a,label:`${p?`Hide`:`Show`} details for ${s}`,onClick:e=>{e.stopPropagation(),c?.(e),!e.defaultPrevented&&m()},...d})}function z({children:t,className:n,colSpan:r,row:i,...o}){return f(a.Row,{"data-slot":`data-table-expanded-row`,"data-expanded-content":!0,className:e(`[&>td]:border-t-0`,n),...o,children:f(a.Cell,{id:P(i),colSpan:r??i.getVisibleCells().length,className:`bg-card font-sans text-body`,children:t})})}const B={Root:C,ActionCell:M,ActionHeader:N,Cell:a.Cell,Body:D,EmptyRow:A,Head:O,Header:E,HeaderSortButton:T,Row:k,ExpandHeader:F,RowExpandButton:R,ExpandedRow:z};function V({direction:e,mode:t,...n}){return e===`unsorted`||!t||!e?f(`svg`,{"aria-hidden":!0,...n}):f(i,{mode:t,direction:e,...n})}function H(e,t){if(!e.getCanSort())return;let n=e.getIsSorted();switch(y(typeof n==`string`?n:`unsorted`,t)){case`unsorted`:e.clearSorting();return;case`asc`:e.toggleSorting(!1);return;case`desc`:e.toggleSorting(!0);return;default:return}}export{B as DataTable,P as expandedRowId};
|
package/dist/field.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { n as IconButtonProps, r as IconButtonAppearance } from "./button-DJ7AAg
|
|
|
4
4
|
import { a as ValidationState, c as parseValidation, i as ValidationProp, l as resolveValidation, n as ParsedValidation, o as WithValidation, r as Validation, s as isAriaInvalid, t as AriaInvalid } from "./field-7QeiTFwl.js";
|
|
5
5
|
import { t as Label } from "./label-C6YH9skg.js";
|
|
6
6
|
import { t as Slot } from "./slot-DdgxmuI5.js";
|
|
7
|
-
import { t as Popover } from "./popover-
|
|
7
|
+
import { t as Popover } from "./popover-C9fEVWL1.js";
|
|
8
8
|
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
9
9
|
//#region src/components/field/field-context.d.ts
|
|
10
10
|
/**
|
package/dist/field.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./slot-DpNWVci8.js";import{t as r}from"./button-CCkGqE1t.js";import{i,n as a,r as o,t as s}from"./field-Bpptk_9t.js";import{n as c,r as l,t as u}from"./field-B1wqeZr4.js";import{t as d}from"./label-D-D11mlp.js";import{t as f}from"./popover-
|
|
1
|
+
import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./slot-DpNWVci8.js";import{t as r}from"./button-CCkGqE1t.js";import{i,n as a,r as o,t as s}from"./field-Bpptk_9t.js";import{n as c,r as l,t as u}from"./field-B1wqeZr4.js";import{t as d}from"./label-D-D11mlp.js";import{t as f}from"./popover-B1ZzHCym.js";import{Children as p,Fragment as m,cloneElement as h,isValidElement as g,useCallback as _,useContext as v,useId as y,useMemo as b,useState as x}from"react";import S from"tiny-invariant";import{jsx as C}from"react/jsx-runtime";import{QuestionIcon as w}from"@phosphor-icons/react/Question";const T=e=>{let t=[],n=new Set;for(let r of e??[]){if(typeof r!=`string`)continue;let e=r.trim();e.length===0||n.has(e)||(n.add(e),t.push(e))}return t},E=e=>!(e==null||typeof e==`boolean`||typeof e==`string`&&e.trim().length===0),D=({children:e,errorItemType:t})=>{let n=!1;return p.forEach(e,e=>{if(!(n||e==null||typeof e==`boolean`)){if(typeof e==`string`){e.trim().length>0&&(n=!0);return}if(!g(e)){n=!0;return}if(e.type===t){n=E(e.props.children);return}if(e.type===m){n=D({children:e.props.children,errorItemType:t});return}n=!0}}),n},O=({className:e,ref:n,...r})=>C(`fieldset`,{ref:n,"data-slot":`field-set`,className:t(`flex w-full min-w-0 flex-col gap-4 border-0 p-0`,e),...r}),k=({className:e,ref:n,...r})=>C(`legend`,{ref:n,"data-slot":`field-legend`,className:t(`text-strong mb-1.5 text-sm font-medium font-sans`,e),...r}),A=({htmlFor:e,ref:t,...n})=>{let r=v(c);return C(d,{ref:t,htmlFor:e??r?.controlId,...n})},j=({asChild:e,className:r,ref:i,...a})=>C(e?n:`p`,{ref:i,"data-slot":`field-label-text`,className:t(`text-strong text-sm font-medium font-sans`,r),...a}),M=({asChild:e,className:r,ref:i,...a})=>C(e?n:`div`,{ref:i,"data-slot":`field-label-row`,className:t(`flex items-center gap-1`,r),...a}),N=f.Root,P=C(w,{}),F=({appearance:e=`ghost`,className:n,icon:i=P,intent:a=`neutral`,label:o,ref:s,size:c=`xs`,type:l=`button`,...u})=>C(f.Trigger,{asChild:!0,children:C(r,{ref:s,appearance:e,className:t(`text-body -my-0.5`,n),icon:i,intent:a,label:o,size:c,type:l,...u})}),I=({ref:e,...t})=>C(f.Content,{ref:e,"data-slot":`field-help-content`,...t}),L=({asChild:e,children:r,className:i,ref:a,...o})=>C(e?n:`span`,{ref:a,"data-slot":`field-optional`,className:t(`text-muted text-sm font-normal font-sans`,i),...o,children:r??`(Optional)`}),R=({asChild:e,className:r,ref:i,...a})=>C(e?n:`div`,{ref:i,"data-slot":`field-group`,className:t(`flex w-full flex-col gap-4`,r),...a}),z=({asChild:e,children:r,className:a,name:o,ref:l,validation:u,...d})=>{let f=e?n:`div`,p=y(),m=y(),h=y(),[g,v]=x(!1),S=i(u??(g?`error`:void 0)),w=_(()=>(v(!0),()=>{v(!1)}),[]),T=b(()=>({controlId:p,descriptionId:m,errorId:h,hasErrors:g,name:o,registerError:w,validation:S}),[p,m,h,g,o,w,S]);return C(c.Provider,{value:T,children:C(s,{validation:S,children:C(f,{ref:l,"data-slot":`field-item`,"data-validation":S,className:t(`flex w-full flex-col gap-1.5`,a),...d,children:r})})})},B=({children:e,ref:t,...r})=>{let i=v(c),a=l({context:i});return typeof e==`function`?C(s,{validation:a.validation,children:C(u.Provider,{value:i?a.ariaProps:null,children:e(a.ariaProps)})}):(S(g(e),`Field.Control expects a single React element child (or a render-prop function). Got a non-element value (string, array, fragment, null, or undefined). Wrap the control in a single element, or use the function child form: <Field.Control>{(props) => <YourControl {...props} />}</Field.Control>.`),C(s,{validation:a.validation,children:C(u.Provider,{value:i?a.ariaProps:null,children:C(n,{ref:t,...r,children:h(e,a.ariaProps)})})}))},V=({asChild:e,className:r,ref:i,...a})=>{let o=e?n:`p`,s=v(c);return C(o,{ref:i,"data-slot":`field-description`,id:s?.descriptionId,className:t(`text-body text-sm leading-4`,`[:where([data-slot=field-error-list]+&)]:-mt-1.5`,r),...a})},H=({children:e,className:n,ref:r,...i})=>E(e)?C(`li`,{ref:r,"data-slot":`field-error`,className:t(`text-danger-600 text-sm leading-4`,n),...i,children:e}):null,U=({messages:e,ref:t,...n})=>C(W,{ref:t,...n,children:T(e).map(e=>C(H,{children:e},e))}),W=({asChild:r,children:i,className:a,ref:o,...s})=>{let l=D({children:i,errorItemType:H}),u=v(c),d=u?.registerError;return e(()=>{if(!(!l||d==null))return d()},[l,d]),l?C(r?n:`ul`,{ref:o,"data-slot":`field-error-list`,id:u?.errorId,role:`list`,className:t(`m-0 flex w-full flex-col list-none p-0`,a),...s,children:i}):null},G={Item:z,Control:B,Group:R,Set:O,Legend:k,Label:A,LabelText:j,LabelRow:M,Help:N,HelpTrigger:F,HelpContent:I,Optional:L,Description:V,Errors:U,ErrorList:W,ErrorItem:H},K=e=>T(e?.map(e=>typeof e==`string`||!e?e:e.message));export{G as Field,a as isAriaInvalid,o as parseValidation,i as resolveValidation,K as toErrorMessages};
|
package/dist/hover-card.d.ts
CHANGED
|
@@ -53,6 +53,10 @@ declare const Trigger: (props: ComponentProps<typeof HoverCardPrimitive.Trigger>
|
|
|
53
53
|
* z-index. When multiple shared layers are open, the most recently mounted
|
|
54
54
|
* layer renders on top.
|
|
55
55
|
*
|
|
56
|
+
* It sets `position: relative`, so `HoverCard.Arrow`'s absolutely-positioned
|
|
57
|
+
* wrapper keeps one containing block through the open animation. An
|
|
58
|
+
* absolutely-positioned child of the content therefore anchors to the content.
|
|
59
|
+
*
|
|
56
60
|
* @see https://mantle.ngrok.com/components/overlays/hover-card#hovercardcontent
|
|
57
61
|
*
|
|
58
62
|
* @example
|
|
@@ -70,6 +74,31 @@ declare const Trigger: (props: ComponentProps<typeof HoverCardPrimitive.Trigger>
|
|
|
70
74
|
* ```
|
|
71
75
|
*/
|
|
72
76
|
declare const Content: ({ className, onClick, align, sideOffset, ...props }: ComponentProps<typeof HoverCardPrimitive.Content>) => import("react").JSX.Element;
|
|
77
|
+
type HoverCardArrowProps = Omit<ComponentProps<typeof HoverCardPrimitive.Arrow>, "asChild" | "children">;
|
|
78
|
+
/**
|
|
79
|
+
* An optional tip that points from `HoverCard.Content` at its trigger. Render it
|
|
80
|
+
* as a child of `HoverCard.Content`. Radix positions it with floating-ui's arrow
|
|
81
|
+
* middleware, so it stays centered on the trigger when collision detection shifts
|
|
82
|
+
* or flips the content. It also repaints `HoverCard.Content`'s fill and border
|
|
83
|
+
* across its base, so the two edges read as one line, and carries its own shadow,
|
|
84
|
+
* clipped at that base so it never darkens the content's interior.
|
|
85
|
+
*
|
|
86
|
+
* @see https://mantle.ngrok.com/components/overlays/hover-card#hovercardarrow
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```tsx
|
|
90
|
+
* <HoverCard.Root>
|
|
91
|
+
* <HoverCard.Trigger asChild>
|
|
92
|
+
* <Button type="button" appearance="link" intent="accent">@username</Button>
|
|
93
|
+
* </HoverCard.Trigger>
|
|
94
|
+
* <HoverCard.Content>
|
|
95
|
+
* <HoverCard.Arrow />
|
|
96
|
+
* <p>This is the hover card content.</p>
|
|
97
|
+
* </HoverCard.Content>
|
|
98
|
+
* </HoverCard.Root>
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
declare const Arrow: ({ className, height, width, ...props }: HoverCardArrowProps) => import("react").JSX.Element;
|
|
73
102
|
/**
|
|
74
103
|
* A floating card that appears when a user hovers over a trigger element.
|
|
75
104
|
*
|
|
@@ -93,6 +122,7 @@ declare const Content: ({ className, onClick, align, sideOffset, ...props }: Com
|
|
|
93
122
|
* HoverCard.Root
|
|
94
123
|
* ├── HoverCard.Trigger
|
|
95
124
|
* └── HoverCard.Content
|
|
125
|
+
* └── HoverCard.Arrow
|
|
96
126
|
* ```
|
|
97
127
|
*
|
|
98
128
|
* @example
|
|
@@ -134,6 +164,30 @@ declare const HoverCard: {
|
|
|
134
164
|
* ```
|
|
135
165
|
*/
|
|
136
166
|
readonly Root: typeof Root;
|
|
167
|
+
/**
|
|
168
|
+
* An optional tip that points from `HoverCard.Content` at its trigger. It stays
|
|
169
|
+
* centered on the trigger when collision detection shifts or flips the content,
|
|
170
|
+
* and its border continues `HoverCard.Content`'s own edge.
|
|
171
|
+
*
|
|
172
|
+
* @see https://mantle.ngrok.com/components/overlays/hover-card#hovercardarrow
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```tsx
|
|
176
|
+
* <HoverCard.Root>
|
|
177
|
+
* <HoverCard.Trigger asChild>
|
|
178
|
+
* <Button type="button" appearance="link" intent="accent">@username</Button>
|
|
179
|
+
* </HoverCard.Trigger>
|
|
180
|
+
* <HoverCard.Content side="top">
|
|
181
|
+
* <HoverCard.Arrow />
|
|
182
|
+
* <div className="space-y-2">
|
|
183
|
+
* <Text weight="strong">User Profile</Text>
|
|
184
|
+
* <Text>Additional information about the user.</Text>
|
|
185
|
+
* </div>
|
|
186
|
+
* </HoverCard.Content>
|
|
187
|
+
* </HoverCard.Root>
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
readonly Arrow: typeof Arrow;
|
|
137
191
|
/**
|
|
138
192
|
* The content to render inside the hover card. Appears in a portal with rich styling and animations.
|
|
139
193
|
*
|
package/dist/hover-card.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{jsx as t}from"react/jsx-runtime";import*as
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import*as r from"@radix-ui/react-hover-card";const i=({closeDelay:e=300,openDelay:n=100,...i})=>t(r.Root,{closeDelay:e,openDelay:n,...i}),a=e=>t(r.Trigger,{"data-slot":`hover-card-trigger`,...e}),o=r.Portal,s={Root:i,Arrow:({className:i,height:a=7,width:o=14,...s})=>t(r.Arrow,{"aria-hidden":`true`,asChild:!0,"data-slot":`hover-card-arrow`,height:a,width:o,...s,children:n(`svg`,{className:e(`fill-[var(--background-color-popover)]`,`[clip-path:inset(0_-200%_-200%_-200%)]`,`[filter:drop-shadow(0_0_4px_color-mix(in_oklab,var(--shadow-color)_var(--shadow-first-opacity),transparent))]`,i),children:[t(`polygon`,{points:`0,0 30,0 15,10`}),t(`polyline`,{className:`stroke-[color:var(--border-color-popover)]`,fill:`none`,points:`0,0 15,10 30,0`,strokeWidth:1.5,vectorEffect:`non-scaling-stroke`})]})}),Content:({className:n,onClick:i,align:a=`center`,sideOffset:s=4,...c})=>t(o,{children:t(r.Content,{"data-slot":`hover-card-content`,align:a,sideOffset:s,className:e(`relative`,`bg-popover border-popover z-50 w-64 rounded-md border p-4 shadow-md outline-hidden`,`data-state-open:animate-in data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:fade-in-0 data-state-closed:zoom-out-95 data-state-open: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`,n),onClick:e=>{e.stopPropagation(),i?.(e)},...c})}),Portal:o,Trigger:a};export{s as HoverCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{jsx as t}from"react/jsx-runtime";function n({children:n,className:r,...i}){return t(`kbd`,{"data-slot":`kbd`,className:e(`[font-kerning:normal] [font-variant-ligatures:common-ligatures_contextual]`,`appearance-none tabular-nums inline-grid place-items-center size-5 bg-neutral-500/15 px-1 rounded text-mono leading-none font-mono`,r),...i,children:n})}export{n as t};
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{jsx as t}from"react/jsx-runtime";function n({children:n,className:r,...i}){return t(`kbd`,{"data-slot":`kbd`,className:e(`[font-kerning:normal] [font-variant-ligatures:common-ligatures_contextual]`,`appearance-none tabular-nums inline-grid place-items-center size-5 bg-neutral-500/15 px-1 rounded text-mono leading-none font-mono`,r),...i,translate:`no`,children:n})}export{n as t};
|
package/dist/kbd.d.ts
CHANGED
|
@@ -21,7 +21,13 @@ import { ComponentProps } from "react";
|
|
|
21
21
|
* `aria-label` on the `<Kbd>` or include a visually-hidden label inside,
|
|
22
22
|
* and mark the visible glyph `aria-hidden`.
|
|
23
23
|
*
|
|
24
|
+
* **Translation.** The `<kbd>` element always carries `translate="no"`, so a
|
|
25
|
+
* browser translation engine skips the subtree. A translated shortcut names a
|
|
26
|
+
* key the reader's keyboard does not have. The `translate` prop is omitted from
|
|
27
|
+
* the type, so no call site can turn the guard off.
|
|
28
|
+
*
|
|
24
29
|
* @see https://mantle.ngrok.com/components/data-display/kbd
|
|
30
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/translate
|
|
25
31
|
*
|
|
26
32
|
* @example
|
|
27
33
|
* ```tsx
|
|
@@ -42,6 +48,6 @@ import { ComponentProps } from "react";
|
|
|
42
48
|
* </Kbd>
|
|
43
49
|
* ```
|
|
44
50
|
*/
|
|
45
|
-
declare function Kbd({ children, className, ...props }: ComponentProps<"kbd">): import("react").JSX.Element;
|
|
51
|
+
declare function Kbd({ children, className, ...props }: Omit<ComponentProps<"kbd">, "translate">): import("react").JSX.Element;
|
|
46
52
|
//#endregion
|
|
47
53
|
export { Kbd };
|
package/dist/kbd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./kbd-
|
|
1
|
+
import{t as e}from"./kbd-B9qmYaW8.js";export{e as Kbd};
|
package/dist/llms.txt
CHANGED
package/dist/pagination.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ButtonGroup } from "./button-
|
|
1
|
+
import { t as ButtonGroup } from "./button-Dic5ZH4w.js";
|
|
2
2
|
import { t as Select } from "./select-DVHmgih8.js";
|
|
3
3
|
import { ComponentProps } from "react";
|
|
4
4
|
//#region src/components/pagination/cursor-pagination.d.ts
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import*as r from"@radix-ui/react-popover";const i=r.Root,a=r.Trigger,o={Root:i,Anchor:r.Anchor,Arrow:({className:i,height:a=7,width:o=14,...s})=>t(r.Arrow,{"aria-hidden":`true`,asChild:!0,"data-slot":`popover-arrow`,height:a,width:o,...s,children:n(`svg`,{className:e(`fill-[var(--background-color-popover)]`,`[clip-path:inset(0_-200%_-200%_-200%)]`,`[filter:drop-shadow(0_0_4px_color-mix(in_oklab,var(--shadow-color)_var(--shadow-first-opacity),transparent))]`,i),children:[t(`polygon`,{points:`0,0 30,0 15,10`}),t(`polyline`,{className:`stroke-[color:var(--border-color-popover)]`,fill:`none`,points:`0,0 15,10 30,0`,strokeWidth:1.5,vectorEffect:`non-scaling-stroke`})]})}),Close:r.Close,Content:({align:n=`center`,className:i,onClick:a,preferredWidth:o=`max-w-72`,ref:s,sideOffset:c=4,...l})=>t(r.Portal,{children:t(r.Content,{align:n,"data-slot":`popover-content`,className:e(`relative`,`text-popover-foreground border-popover bg-popover 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 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95 z-50 rounded-md border p-4 shadow-md outline-hidden`,o,i),onClick:e=>{e.stopPropagation(),a?.(e)},ref:s,sideOffset:c,...l})}),Trigger:a};export{o as t};
|
|
@@ -19,6 +19,10 @@ type PopoverContentProps = ComponentProps<typeof PopoverPrimitive.Content> & {
|
|
|
19
19
|
* z-index. When multiple shared layers are open, the most recently mounted
|
|
20
20
|
* layer renders on top.
|
|
21
21
|
*
|
|
22
|
+
* It sets `position: relative`, so `Popover.Arrow`'s absolutely-positioned
|
|
23
|
+
* wrapper keeps one containing block through the open animation. An
|
|
24
|
+
* absolutely-positioned child of the content therefore anchors to the content.
|
|
25
|
+
*
|
|
22
26
|
* @see https://mantle.ngrok.com/components/overlays/popover#popovercontent
|
|
23
27
|
*
|
|
24
28
|
* @example
|
|
@@ -36,6 +40,33 @@ type PopoverContentProps = ComponentProps<typeof PopoverPrimitive.Content> & {
|
|
|
36
40
|
* ```
|
|
37
41
|
*/
|
|
38
42
|
declare const Content: ({ align, className, onClick, preferredWidth, ref, sideOffset, ...props }: PopoverContentProps) => import("react").JSX.Element;
|
|
43
|
+
type PopoverArrowProps = Omit<ComponentProps<typeof PopoverPrimitive.Arrow>, "asChild" | "children">;
|
|
44
|
+
/**
|
|
45
|
+
* An optional tip that points from `Popover.Content` at its anchor. Render it as
|
|
46
|
+
* a child of `Popover.Content`. Radix positions it with floating-ui's arrow
|
|
47
|
+
* middleware, so it stays centered on the anchor when collision detection shifts
|
|
48
|
+
* or flips the content. It also repaints `Popover.Content`'s fill and border
|
|
49
|
+
* across its base, so the two edges read as one line, and carries its own shadow,
|
|
50
|
+
* clipped at that base so it never darkens the content's interior.
|
|
51
|
+
*
|
|
52
|
+
* @see https://mantle.ngrok.com/components/overlays/popover#popoverarrow
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```tsx
|
|
56
|
+
* <Popover.Root>
|
|
57
|
+
* <Popover.Trigger asChild>
|
|
58
|
+
* <Button type="button" appearance="outlined" intent="neutral">
|
|
59
|
+
* Open Popover
|
|
60
|
+
* </Button>
|
|
61
|
+
* </Popover.Trigger>
|
|
62
|
+
* <Popover.Content side="right">
|
|
63
|
+
* <Popover.Arrow />
|
|
64
|
+
* <p>This is the popover content.</p>
|
|
65
|
+
* </Popover.Content>
|
|
66
|
+
* </Popover.Root>
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
declare const Arrow: ({ className, height, width, ...props }: PopoverArrowProps) => import("react").JSX.Element;
|
|
39
70
|
/**
|
|
40
71
|
* A floating overlay that displays rich content in a portal, triggered by a button.
|
|
41
72
|
*
|
|
@@ -66,6 +97,7 @@ declare const Content: ({ align, className, onClick, preferredWidth, ref, sideOf
|
|
|
66
97
|
* ├── Popover.Trigger
|
|
67
98
|
* ├── Popover.Anchor
|
|
68
99
|
* └── Popover.Content
|
|
100
|
+
* ├── Popover.Arrow
|
|
69
101
|
* └── Popover.Close
|
|
70
102
|
* ```
|
|
71
103
|
*
|
|
@@ -130,6 +162,33 @@ declare const Popover: {
|
|
|
130
162
|
* ```
|
|
131
163
|
*/
|
|
132
164
|
readonly Anchor: import("react").ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
165
|
+
/**
|
|
166
|
+
* An optional tip that points from `Popover.Content` at its anchor. It stays
|
|
167
|
+
* centered on the anchor when collision detection shifts or flips the content,
|
|
168
|
+
* and its border continues `Popover.Content`'s own edge.
|
|
169
|
+
*
|
|
170
|
+
* @see https://mantle.ngrok.com/components/overlays/popover#popoverarrow
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```tsx
|
|
174
|
+
* <Popover.Root>
|
|
175
|
+
* <Popover.Anchor asChild>
|
|
176
|
+
* <button type="button">Anchor</button>
|
|
177
|
+
* </Popover.Anchor>
|
|
178
|
+
* <Popover.Trigger asChild>
|
|
179
|
+
* <Button type="button" appearance="outlined" intent="neutral">Open Popover</Button>
|
|
180
|
+
* </Popover.Trigger>
|
|
181
|
+
* <Popover.Content side="right">
|
|
182
|
+
* <Popover.Arrow />
|
|
183
|
+
* <Text>Products moved up here</Text>
|
|
184
|
+
* <Popover.Close asChild>
|
|
185
|
+
* <Button type="button" appearance="outlined" intent="neutral">Got it</Button>
|
|
186
|
+
* </Popover.Close>
|
|
187
|
+
* </Popover.Content>
|
|
188
|
+
* </Popover.Root>
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
readonly Arrow: typeof Arrow;
|
|
133
192
|
/**
|
|
134
193
|
* A button that closes an open popover. Can be placed anywhere within the popover content.
|
|
135
194
|
*
|
package/dist/popover.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Popover } from "./popover-
|
|
1
|
+
import { t as Popover } from "./popover-C9fEVWL1.js";
|
|
2
2
|
export { Popover };
|
package/dist/popover.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./popover-
|
|
1
|
+
import{t as e}from"./popover-B1ZzHCym.js";export{e as Popover};
|
package/dist/sandbar.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as WithAsChild } from "./as-child-D23mGo4f.js";
|
|
2
2
|
import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
|
|
3
|
-
import { r as ButtonProps } from "./button-
|
|
3
|
+
import { r as ButtonProps } from "./button-BH79w6HV.js";
|
|
4
4
|
import { ComponentProps, ReactNode, Ref } from "react";
|
|
5
5
|
//#region src/components/sandbar/sandbar.d.ts
|
|
6
6
|
/**
|
package/dist/sandbar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{n as t}from"./compose-refs-BdBMM9ga.js";import{t as n}from"./cx-IiQEAKf5.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{t as i}from"./slot-DpNWVci8.js";import{t as a}from"./button-
|
|
1
|
+
import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{n as t}from"./compose-refs-BdBMM9ga.js";import{t as n}from"./cx-IiQEAKf5.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{t as i}from"./slot-DpNWVci8.js";import{t as a}from"./button-hEoKi6ZG.js";import{t as o}from"./use-prefers-reduced-motion-Bk5zAfHY.js";import{createContext as s,useCallback as c,useContext as l,useEffect as u,useId as d,useImperativeHandle as f,useMemo as p,useRef as m,useState as h}from"react";import g from"tiny-invariant";import{jsx as _,jsxs as v}from"react/jsx-runtime";const y=`Unsaved changes`,b=1e3,ee=[{transform:`translateX(0)`},{transform:`translateX(-8px)`},{transform:`translateX(8px)`},{transform:`translateX(-6px)`},{transform:`translateX(6px)`},{transform:`translateX(-3px)`},{transform:`translateX(3px)`},{transform:`translateX(0)`}];function x(e,t){let n=t.current?`${e}\u00A0`:e;return t.current=!t.current,n}const S=s(null);function C(e){let t=l(S);return g(t,`${e} must be rendered as a child of <Sandbar.Root>.`),t}const w={Root:({"aria-label":e,"aria-labelledby":i,children:a,className:s,"data-slot":l,handleRef:d,onTransitionEnd:g,open:C,ref:w,...T})=>{let[E,D]=h(C?`open`:`closed`),[O,k]=h(``),[A,j]=h(``),[M,N]=h(null),P=m(null),F=m(null),I=t(F,w),L=m(null),R=m(void 0),z=m(void 0),B=m(void 0),te=m(!1),ne=m(!1),V=m(!1),H=m(null),U=m(null),W=m(C),G=m(E),K=c(e=>{k(x(e,te)),window.clearTimeout(R.current),R.current=window.setTimeout(()=>{k(``)},b)},[]),q=c(e=>{j(x(e,ne)),window.clearTimeout(z.current),z.current=window.setTimeout(()=>{j(``)},b)},[]),J=c(e=>(N(e),()=>{N(t=>t===e?null:t)}),[]),Y=c(({button:e,isSaving:t})=>{let n=V.current;if(V.current=t,!t||n||(K(`Saving changes…`),e==null||!e.matches(`:disabled`)))return;let r=document.activeElement,i=r===e,a=r===document.body&&U.current===e;(i||a)&&F.current?.focus({preventScroll:!0})},[K]),X=c(e=>{q(e?.announcement??`You have unsaved changes. Save or discard them before leaving.`);let t=F.current;if(t==null||o()||typeof t.animate!=`function`)return;L.current!=null&&(L.current.cancel(),L.current=null);let n=t.animate(ee,{duration:400,easing:`ease-in-out`});n.onfinish=()=>{L.current=null},L.current=n},[q]);f(d,()=>({shake:X}),[X]);let re=p(()=>({announceAssertive:q,registerMessage:J,reportSaving:Y}),[q,J,Y]);u(()=>{D(C?e=>e===`open`||e===`opening`?e:e===`closing`?`open`:`opening`:e=>e===`closed`?e:e===`opening`?`closed`:`closing`)},[C]),u(()=>{if(E!==`opening`)return;let e=window.requestAnimationFrame(()=>{e=window.requestAnimationFrame(()=>{D(e=>e===`opening`?`open`:e)})});return()=>{window.cancelAnimationFrame(e)}},[E]),u(()=>{if(E!==`closing`)return;let e=window.setTimeout(()=>{D(`closed`)},400);return()=>{window.clearTimeout(e)}},[E]),u(()=>{let t=W.current;if(W.current=C,!C){t&&(window.clearTimeout(R.current),k(``));return}if(t)return;let n=(F.current?.querySelector(`[data-slot~="sandbar-message"]`))?.textContent?.trim();K(n||e||y)},[K,e,C]),u(()=>{let e=G.current;if(G.current=E,E!==`closed`||e!==`closing`)return;let t=P.current,n=document.activeElement,r=t!=null&&n instanceof HTMLElement&&t.contains(n),i=n===document.body&&U.current!=null,a=H.current;H.current=null,U.current=null,!(!r&&!i)&&(a==null||!a.isConnected||a.matches(`:disabled`)||typeof a.checkVisibility==`function`&&!a.checkVisibility()||a.focus())},[E]),u(()=>()=>{window.clearTimeout(R.current),window.clearTimeout(z.current),B.current!=null&&window.cancelAnimationFrame(B.current),L.current?.cancel()},[]);let ie=e=>{let t=P.current,n=e.relatedTarget;t!=null&&(n==null||!t.contains(n))&&n instanceof HTMLElement&&(H.current=n),e.target instanceof HTMLElement&&(U.current=e.target)},Z=e=>{if(e.relatedTarget!=null){let t=P.current;(t==null||!t.contains(e.relatedTarget))&&(U.current=null);return}let t=e.target;t instanceof HTMLElement&&(B.current!=null&&window.cancelAnimationFrame(B.current),B.current=window.requestAnimationFrame(()=>{B.current=void 0;let e=F.current;e==null||e.hidden||(!t.isConnected||t.matches(`:disabled`)||t.hidden)&&document.activeElement===document.body&&e.focus({preventScroll:!0})}))},ae=e=>{g?.(e),e.target===e.currentTarget&&(e.propertyName===`opacity`||e.propertyName===`translate`)&&D(e=>e===`closing`?`closed`:e)},Q=i??(e==null&&M!=null?M:void 0),oe=Q==null?e??y:e,$=E===`closed`,se=$||E===`closing`;return _(S.Provider,{value:re,children:v(`div`,{className:`pointer-events-none fixed inset-x-0 bottom-4 z-50 flex justify-center px-4 sm:bottom-10`,onBlur:Z,onFocus:ie,ref:P,children:[_(`div`,{"aria-atomic":`true`,"aria-live":`polite`,className:`sr-only`,role:`status`,children:O}),_(`div`,{className:`sr-only`,role:`alert`,children:A}),_(`div`,{className:n(`invert-theme pointer-events-auto flex w-fit max-w-full flex-wrap items-center justify-center gap-x-4 gap-y-2 rounded-2xl border border-transparent bg-base px-4 py-3 text-strong shadow-lg`,`max-h-[60svh] overflow-y-auto`,`focus:outline-hidden`,`[&[hidden]]:hidden`,`transition-[opacity,translate] ease-out`,`data-state-open:duration-400`,`data-state-closed:pointer-events-none data-state-closed:opacity-0 data-state-closed:duration-200 motion-safe:data-state-closed:translate-y-[calc(100%+2.5rem)]`,`data-state-closed:ease-[cubic-bezier(0.4,0,1,1),cubic-bezier(0,0,0.2,1)]`,s),...T,"aria-label":oe,"aria-labelledby":Q,"data-slot":r(l,`sandbar`),"data-state":E===`open`?`open`:`closed`,hidden:$?!0:void 0,inert:se?!0:void 0,onTransitionEnd:ae,ref:I,role:`group`,tabIndex:-1,children:a})]})})},Message:({asChild:a,className:o,"data-slot":s,id:c,ref:l,...u})=>{let{registerMessage:f}=C(`Sandbar.Message`),p=d(),h=c??p,g=m(null),v=t(g,l);return e(()=>f(g.current?.id||h),[h,f]),_(a?i:`p`,{className:n(`text-sm font-sans`,o),id:h,...u,"data-slot":r(s,`sandbar-message`),ref:v})},Actions:({asChild:e,className:t,"data-slot":a,...o})=>_(e?i:`div`,{className:n(`flex flex-wrap items-center justify-center gap-2`,t),...o,"data-slot":r(a,`sandbar-actions`)}),SaveButton:({appearance:n=`filled`,children:i,"data-slot":o,intent:s=`neutral`,isLoading:c=!1,ref:l,...u})=>{let{reportSaving:d}=C(`Sandbar.SaveButton`),f=m(null),p=t(f,l);return e(()=>{d({button:f.current,isSaving:!!c})},[c,d]),e(()=>()=>{d({button:null,isSaving:!1})},[d]),_(a,{appearance:n,intent:s,isLoading:c,ref:p,...u,"data-slot":r(o,`sandbar-save-button`),children:i})},DiscardButton:({appearance:e=`outlined`,children:t,"data-slot":n,intent:i=`neutral`,...o})=>_(a,{appearance:e,intent:i,...o,"data-slot":r(n,`sandbar-discard-button`),children:t})};export{w as Sandbar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./anchor-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./anchor-D2So_zuy.js";import{jsx as n}from"react/jsx-runtime";const r=({children:r=`Skip to main content`,className:i,onClick:a,targetId:o=`main`,...s})=>n(t,{...s,"data-slot":`skip-to-main-link`,href:`#${o}`,onClick:e=>{e.preventDefault(),window.history.replaceState(null,``,`#${o}`),document.getElementById(o)?.focus({preventScroll:!0}),a?.(e)},className:e(`not-focus:sr-only bg-card fixed top-2 left-2 z-max px-4 py-2 shadow-lg`,i),children:r});export{r as SkipToMainLink};
|
package/dist/split-button.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as Button } from "./button-
|
|
1
|
+
import { t as Button } from "./button-BH79w6HV.js";
|
|
2
2
|
import { t as IconButton } from "./button-DJ7AAgII.js";
|
|
3
3
|
import { t as ButtonSize } from "./button-BCoI4bhP.js";
|
|
4
4
|
import { t as DropdownMenu } from "./dropdown-menu-DZOfj6HB.js";
|
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-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-lZ48P8Nn.js";import{t as n}from"./button-hEoKi6ZG.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/package.json
CHANGED
package/dist/popover-CQ9s7jG5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{jsx as t}from"react/jsx-runtime";import*as n from"@radix-ui/react-popover";const r=n.Root,i=n.Trigger,a={Root:r,Anchor:n.Anchor,Close:n.Close,Content:({align:r=`center`,className:i,onClick:a,preferredWidth:o=`max-w-72`,ref:s,sideOffset:c=4,...l})=>t(n.Portal,{children:t(n.Content,{align:r,"data-slot":`popover-content`,className:e(`text-popover-foreground border-popover bg-popover 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 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95 z-50 rounded-md border p-4 shadow-md outline-hidden`,o,i),onClick:e=>{e.stopPropagation(),a?.(e)},ref:s,sideOffset:c,...l})}),Trigger:i};export{a as t};
|