@ngrok/mantle 0.83.7 → 0.83.8
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-dialog.d.ts +27 -16
- package/dist/alert-dialog.js +1 -1
- package/dist/code-block.js +1 -1
- package/dist/combobox.d.ts +20 -15
- package/dist/command.d.ts +1 -1
- package/dist/command.js +1 -1
- package/dist/{dialog-DJ6jSRyj.d.ts → dialog-C_K3dflm.d.ts} +22 -14
- package/dist/dialog-DqdAq5ts.js +1 -0
- package/dist/{dialog-BM4wPCft.d.ts → dialog-u8PtHYES.d.ts} +7 -1
- package/dist/dialog.d.ts +2 -2
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu-CNaaABck.d.ts +1 -0
- package/dist/{dropdown-menu-DZOfj6HB.d.ts → dropdown-menu-CpsUJGbn.d.ts} +34 -16
- package/dist/dropdown-menu-DJDrRzDU.js +1 -0
- package/dist/dropdown-menu.d.ts +2 -2
- package/dist/dropdown-menu.js +1 -1
- package/dist/field.d.ts +1 -1
- package/dist/field.js +1 -1
- package/dist/hover-card.d.ts +60 -16
- package/dist/hover-card.js +1 -1
- package/dist/layer-container-CglTh9-6.js +1 -0
- package/dist/layer-container.d.ts +57 -0
- package/dist/layer-container.js +1 -0
- package/dist/llms.txt +1 -1
- package/dist/mantle.css +54 -1
- package/dist/multi-select.d.ts +25 -15
- package/dist/multi-select.js +1 -1
- package/dist/pagination.d.ts +1 -1
- package/dist/pagination.js +1 -1
- package/dist/popover-D6x6Bq-G.js +1 -0
- package/dist/{popover-C9fEVWL1.d.ts → popover-DDuw1UaJ.d.ts} +24 -12
- package/dist/popover.d.ts +1 -1
- package/dist/popover.js +1 -1
- package/dist/primitive-BWyxJnXn.js +1 -0
- package/dist/select-BK6n6OIK.js +1 -0
- package/dist/{select-DVHmgih8.d.ts → select-DkFkSYBP.d.ts} +30 -15
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/sheet-BxYeOYAb.js +1 -0
- package/dist/sheet.d.ts +21 -13
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +1 -1
- package/dist/sidebar.js +1 -1
- package/dist/split-button.d.ts +1 -1
- package/dist/split-button.js +1 -1
- package/dist/theme-switcher.d.ts +2 -2
- package/dist/theme-switcher.js +1 -1
- package/dist/{tooltip-DuXGxIse.d.ts → tooltip-BKWK5c7_.d.ts} +30 -15
- package/dist/tooltip-BZRRJgpm.js +1 -0
- package/dist/tooltip.d.ts +1 -1
- package/dist/tooltip.js +1 -1
- package/package.json +1 -1
- package/dist/dialog-BYILOABg.js +0 -1
- package/dist/dropdown-menu-BRH0Wd_z.js +0 -1
- package/dist/dropdown-menu-BcALUQMp.d.ts +0 -1
- package/dist/popover-B1ZzHCym.js +0 -1
- package/dist/primitive-D-9GIFWb.js +0 -1
- package/dist/select-LK9NX-vV.js +0 -1
- package/dist/sheet-CfFXVAzz.js +0 -1
- package/dist/tooltip-Dnu35cjU.js +0 -1
package/dist/agent.json
CHANGED
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 { i as ButtonIntent, n as ButtonAppearance, r as ButtonProps } from "./button-DjsmeoJ2.js";
|
|
4
|
-
import {
|
|
4
|
+
import { c as Trigger$1, n as Content$1, o as Root$1, r as Description$1, s as Title$1, t as Close$1 } from "./dialog-u8PtHYES.js";
|
|
5
5
|
import { ComponentProps, ReactNode } from "react";
|
|
6
6
|
//#region src/components/alert-dialog/alert-dialog.d.ts
|
|
7
7
|
declare const intents: readonly ["info", "danger"];
|
|
@@ -19,9 +19,11 @@ type AlertDialogProps = ComponentProps<typeof Root$1> & {
|
|
|
19
19
|
* response. Holds the open state and the `intent` that `AlertDialog.Icon` and
|
|
20
20
|
* `AlertDialog.Action` read.
|
|
21
21
|
*
|
|
22
|
-
* `AlertDialog` renders its floating layer at Tailwind `z-
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* `AlertDialog` renders its floating layer at Tailwind `z-60`, Mantle's overlay
|
|
23
|
+
* tier, above every float (`z-50`). Floats composed inside the content portal
|
|
24
|
+
* into the positioner (`data-slot="alert-dialog-positioner"`) and paint above
|
|
25
|
+
* the content. When multiple overlays are open, the most recently mounted
|
|
26
|
+
* overlay renders on top.
|
|
25
27
|
*
|
|
26
28
|
* @see https://mantle.ngrok.com/components/overlays/alert-dialog#alertdialogroot
|
|
27
29
|
*
|
|
@@ -108,9 +110,11 @@ type AlertDialogContentProps = ComponentProps<typeof Content$1> & {
|
|
|
108
110
|
*
|
|
109
111
|
* Renders on top of the overlay and is centered in the viewport.
|
|
110
112
|
*
|
|
111
|
-
* `AlertDialog.Content` renders its floating layer at Tailwind `z-
|
|
112
|
-
*
|
|
113
|
-
*
|
|
113
|
+
* `AlertDialog.Content` renders its floating layer at Tailwind `z-60`, Mantle's
|
|
114
|
+
* overlay tier, above every float (`z-50`). Floats composed inside the content
|
|
115
|
+
* portal into the positioner (`data-slot="alert-dialog-positioner"`) and paint
|
|
116
|
+
* above the content. When multiple overlays are open, the most recently mounted
|
|
117
|
+
* overlay renders on top.
|
|
114
118
|
*
|
|
115
119
|
* @see https://mantle.ngrok.com/components/overlays/alert-dialog#alertdialogcontent
|
|
116
120
|
*
|
|
@@ -548,9 +552,11 @@ declare const Close: ({ ref, ...props }: ComponentProps<typeof Close$1>) => impo
|
|
|
548
552
|
* `Dialog` instead. For side-panel content (filter panels, detail views,
|
|
549
553
|
* navigation drawers), use `Sheet`.
|
|
550
554
|
*
|
|
551
|
-
* `AlertDialog` renders its floating layer at Tailwind `z-
|
|
552
|
-
*
|
|
553
|
-
*
|
|
555
|
+
* `AlertDialog` renders its floating layer at Tailwind `z-60`, Mantle's overlay
|
|
556
|
+
* tier, above every float (`z-50`). Floats composed inside the content portal
|
|
557
|
+
* into the positioner (`data-slot="alert-dialog-positioner"`) and paint above
|
|
558
|
+
* the content. When multiple overlays are open, the most recently mounted
|
|
559
|
+
* overlay renders on top.
|
|
554
560
|
*
|
|
555
561
|
* @see https://mantle.ngrok.com/components/overlays/alert-dialog
|
|
556
562
|
*
|
|
@@ -607,9 +613,11 @@ declare const AlertDialog: {
|
|
|
607
613
|
* informational confirmations. `AlertDialog.Icon` and `AlertDialog.Action`
|
|
608
614
|
* read that intent for their color.
|
|
609
615
|
*
|
|
610
|
-
* `AlertDialog` renders its floating layer at Tailwind `z-
|
|
611
|
-
*
|
|
612
|
-
*
|
|
616
|
+
* `AlertDialog` renders its floating layer at Tailwind `z-60`, Mantle's
|
|
617
|
+
* overlay tier, above every float (`z-50`). Floats composed inside the content
|
|
618
|
+
* portal into the positioner (`data-slot="alert-dialog-positioner"`) and paint
|
|
619
|
+
* above the content. When multiple overlays are open, the most recently
|
|
620
|
+
* mounted overlay renders on top.
|
|
613
621
|
*
|
|
614
622
|
* @see https://mantle.ngrok.com/components/overlays/alert-dialog#alertdialogroot
|
|
615
623
|
*
|
|
@@ -803,9 +811,12 @@ declare const AlertDialog: {
|
|
|
803
811
|
* The popover alert dialog container. Renders on top of the overlay,
|
|
804
812
|
* centered in the viewport.
|
|
805
813
|
*
|
|
806
|
-
* `AlertDialog.Content` renders its floating layer at Tailwind `z-
|
|
807
|
-
* Mantle's
|
|
808
|
-
* the
|
|
814
|
+
* `AlertDialog.Content` renders its floating layer at Tailwind `z-60`,
|
|
815
|
+
* Mantle's overlay tier, above every float (`z-50`). Floats composed inside
|
|
816
|
+
* the content portal into the positioner
|
|
817
|
+
* (`data-slot="alert-dialog-positioner"`) and paint above the content. When
|
|
818
|
+
* multiple overlays are open, the most recently mounted overlay renders on
|
|
819
|
+
* top.
|
|
809
820
|
*
|
|
810
821
|
* @see https://mantle.ngrok.com/components/overlays/alert-dialog#alertdialogcontent
|
|
811
822
|
*
|
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-Bc0lEOJ2.js";import{
|
|
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-Bc0lEOJ2.js";import{t as i}from"./layer-container-CglTh9-6.js";import{a,c as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./primitive-BWyxJnXn.js";import{createContext as p,useContext as m,useMemo as h}from"react";import g from"tiny-invariant";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{InfoIcon as y}from"@phosphor-icons/react/Info";import{WarningIcon as b}from"@phosphor-icons/react/Warning";const x=p(null);function S(){let e=m(x);return g(e,`AlertDialog child component used outside of AlertDialog parent!`),e}function C({intent:e,...t}){let n=h(()=>({intent:e}),[e]);return _(x.Provider,{value:n,children:_(l,{...t})})}const w=({ref:e,...t})=>_(o,{ref:e,"data-slot":`alert-dialog-trigger`,...t}),T=a,E=({className:t,ref:n,...r})=>_(s,{"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-60 backdrop-blur-xs`,t),...r,ref:n}),D=({className:t,preferredWidth:n=`max-w-md`,ref:r,...a})=>v(T,{children:[_(E,{}),_(i,{"data-slot":`alert-dialog-positioner`,className:`fixed inset-4 z-60 flex items-center justify-center`,children:_(c,{"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),...a})})]}),O=({asChild:t=!1,className:r,ref:i,...a})=>_(t?n:`div`,{"data-slot":`alert-dialog-body`,className:e(`flex-1 space-y-4`,r),ref:i,...a}),k=({asChild:t=!1,className:r,ref:i,...a})=>_(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}),A=({asChild:t=!1,className:r,ref:i,...a})=>_(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}),j=({className:t,ref:n,...r})=>_(d,{ref:n,"data-slot":`alert-dialog-title`,className:e(`text-strong text-center text-lg font-medium sm:text-start`,t),...r}),M=({className:t,ref:n,...r})=>_(u,{ref:n,"data-slot":`alert-dialog-description`,className:e(`text-body text-center text-sm font-normal sm:text-start`,t),...r}),N={danger:`danger`,info:`neutral`},P=({appearance:e=`filled`,intent:t,ref:n,...i})=>{let a=S(),o=N[a.intent];return _(r,{appearance:e,"data-slot":`alert-dialog-action`,intent:t??o,ref:n,...i})},F=({appearance:t=`outlined`,className:n,intent:i=`neutral`,ref:a,...o})=>_(f,{asChild:!0,children:_(r,{appearance:t,"data-slot":`alert-dialog-cancel`,className:e(`mt-2 sm:mt-0`,n),intent:i,ref:a,...o})}),I={danger:_(b,{}),info:_(y,{})},L={danger:`text-danger-600`,info:`text-accent-600`},R={Root:C,Action:P,Body:O,Cancel:F,Close:({ref:e,...t})=>_(f,{ref:e,"data-slot":`alert-dialog-close`,...t}),Content:D,Description:M,Footer:A,Header:k,Icon:({className:n,ref:r,svg:i,...a})=>{let o=S(),s=L[o.intent],c=I[o.intent];return _(t,{ref:r,"data-slot":`alert-dialog-icon`,className:e(`size-12 sm:size-7`,s,n),svg:i??c,...a})},Title:j,Trigger:w};export{R as AlertDialog};
|
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-CNg69RsV.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-Dj9otiLi.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===`
|
|
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-CNg69RsV.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-Dj9otiLi.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`,`[&_.mantle-code-line]:pr-4`,`[&:has([data-slot=code-block-copy-button])_.mantle-code-line:nth-child(-n+2)]:pr-14`,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 overscroll-x-none 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/combobox.d.ts
CHANGED
|
@@ -12,9 +12,10 @@ type ComboboxProps = Primitive.ComboboxProviderProps;
|
|
|
12
12
|
* async/server-side data, or any single-select where search is helpful. For very small
|
|
13
13
|
* finite lists with no filtering, prefer Select. For multi-selection, prefer MultiSelect.
|
|
14
14
|
*
|
|
15
|
-
* `Combobox.Content` renders at Tailwind `z-50`, Mantle's
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* `Combobox.Content` renders in place at Tailwind `z-50`, Mantle's float tier —
|
|
16
|
+
* it does not portal, so the dialog primitive's Escape guard can see it. Inside
|
|
17
|
+
* an overlay it paints with the overlay's content. Outside one, an open overlay
|
|
18
|
+
* (`z-60`) covers it.
|
|
18
19
|
*
|
|
19
20
|
* @see https://mantle.ngrok.com/components/forms/combobox#comboboxroot
|
|
20
21
|
*
|
|
@@ -52,9 +53,10 @@ type ComboboxContentProps = Omit<Primitive.ComboboxPopoverProps, "render"> & Wit
|
|
|
52
53
|
/**
|
|
53
54
|
* Renders a popover that contains combobox content, e.g. Combobox.Items, Combobox.Groups, and Combobox.Separators.
|
|
54
55
|
*
|
|
55
|
-
* `Combobox.Content` renders at Tailwind `z-50`, Mantle's
|
|
56
|
-
*
|
|
57
|
-
*
|
|
56
|
+
* `Combobox.Content` renders in place at Tailwind `z-50`, Mantle's float tier —
|
|
57
|
+
* it does not portal, so the dialog primitive's Escape guard can see it. Inside
|
|
58
|
+
* an overlay it paints with the overlay's content. Outside one, an open overlay
|
|
59
|
+
* (`z-60`) covers it.
|
|
58
60
|
*
|
|
59
61
|
* @see https://mantle.ngrok.com/components/forms/combobox#comboboxcontent
|
|
60
62
|
*
|
|
@@ -204,9 +206,10 @@ declare const ComboboxSeparatorComponent: ({ className, ref, ...props }: Compone
|
|
|
204
206
|
* async/server-side data, or any single-select where search is helpful. For very small
|
|
205
207
|
* finite lists with no filtering, prefer Select. For multi-selection, prefer MultiSelect.
|
|
206
208
|
*
|
|
207
|
-
* `Combobox.Content` renders at Tailwind `z-50`, Mantle's
|
|
208
|
-
*
|
|
209
|
-
*
|
|
209
|
+
* `Combobox.Content` renders in place at Tailwind `z-50`, Mantle's float tier —
|
|
210
|
+
* it does not portal, so the dialog primitive's Escape guard can see it. Inside
|
|
211
|
+
* an overlay it paints with the overlay's content. Outside one, an open overlay
|
|
212
|
+
* (`z-60`) covers it.
|
|
210
213
|
*
|
|
211
214
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
|
|
212
215
|
* @see https://ariakit.org/components/combobox
|
|
@@ -245,9 +248,10 @@ declare const Combobox: {
|
|
|
245
248
|
* async/server-side data, or any single-select where search is helpful. For very small
|
|
246
249
|
* finite lists with no filtering, prefer Select. For multi-selection, prefer MultiSelect.
|
|
247
250
|
*
|
|
248
|
-
* `Combobox.Content` renders at Tailwind `z-50`, Mantle's
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
+
* `Combobox.Content` renders in place at Tailwind `z-50`, Mantle's float tier
|
|
252
|
+
* — it does not portal, so the dialog primitive's Escape guard can see it.
|
|
253
|
+
* Inside an overlay it paints with the overlay's content. Outside one, an open
|
|
254
|
+
* overlay (`z-60`) covers it.
|
|
251
255
|
*
|
|
252
256
|
* @see https://mantle.ngrok.com/components/forms/combobox#comboboxroot
|
|
253
257
|
*
|
|
@@ -266,9 +270,10 @@ declare const Combobox: {
|
|
|
266
270
|
/**
|
|
267
271
|
* Renders a popover that contains combobox content, e.g. Combobox.Items, Combobox.Groups, and Combobox.Separators.
|
|
268
272
|
*
|
|
269
|
-
* `Combobox.Content` renders at Tailwind `z-50`, Mantle's
|
|
270
|
-
*
|
|
271
|
-
*
|
|
273
|
+
* `Combobox.Content` renders in place at Tailwind `z-50`, Mantle's float tier
|
|
274
|
+
* — it does not portal, so the dialog primitive's Escape guard can see it.
|
|
275
|
+
* Inside an overlay it paints with the overlay's content. Outside one, an open
|
|
276
|
+
* overlay (`z-60`) covers it.
|
|
272
277
|
*
|
|
273
278
|
* @see https://mantle.ngrok.com/components/forms/combobox#comboboxcontent
|
|
274
279
|
*
|
package/dist/command.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
|
|
2
|
-
import { t as Dialog } from "./dialog-
|
|
2
|
+
import { t as Dialog } from "./dialog-C_K3dflm.js";
|
|
3
3
|
import { t as Slot } from "./slot-DdgxmuI5.js";
|
|
4
4
|
import { ComponentProps, ComponentPropsWithoutRef, ReactElement, ReactNode, Ref } from "react";
|
|
5
5
|
import { Command as Command$1, useCommandState } from "cmdk";
|
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-
|
|
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-DqdAq5ts.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};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as IconButtonIntent, n as IconButtonProps, r as IconButtonAppearance } from "./button-DkUUma3k.js";
|
|
2
|
-
import { a as
|
|
2
|
+
import { a as Portal, c as Trigger$1, i as Overlay$1, n as Content$1, o as Root, r as Description$1, s as Title$1, t as Close$1 } from "./dialog-u8PtHYES.js";
|
|
3
3
|
import { ComponentProps } from "react";
|
|
4
4
|
//#region src/components/dialog/dialog.d.ts
|
|
5
5
|
/**
|
|
@@ -142,9 +142,11 @@ type ContentProps = ComponentProps<typeof Content$1> & ({
|
|
|
142
142
|
* The container for the dialog content.
|
|
143
143
|
* Renders on top of the overlay and is centered in the viewport.
|
|
144
144
|
*
|
|
145
|
-
* `Dialog.Content` renders its floating layer at Tailwind `z-
|
|
146
|
-
*
|
|
147
|
-
*
|
|
145
|
+
* `Dialog.Content` renders its floating layer at Tailwind `z-60`, Mantle's
|
|
146
|
+
* overlay tier, above every float (`z-50`). Floats composed inside the content
|
|
147
|
+
* portal into the positioner (`data-slot="dialog-positioner"`) and paint above
|
|
148
|
+
* the content. When multiple overlays are open, the most recently mounted
|
|
149
|
+
* overlay renders on top.
|
|
148
150
|
*
|
|
149
151
|
* `appearance` decides how much of the viewport the dialog claims. `"centered"`
|
|
150
152
|
* caps it at `preferredWidth`, `"full-page"` fills the 16px-inset box, and
|
|
@@ -422,9 +424,11 @@ declare const Description: ({ className, ref, ...props }: ComponentProps<typeof
|
|
|
422
424
|
* For side-panel content that slides in from an edge (filter panels, detail
|
|
423
425
|
* views, navigation drawers), prefer `Sheet`.
|
|
424
426
|
*
|
|
425
|
-
* `Dialog` renders its floating layer at Tailwind `z-
|
|
426
|
-
*
|
|
427
|
-
*
|
|
427
|
+
* `Dialog` renders its floating layer at Tailwind `z-60`, Mantle's overlay
|
|
428
|
+
* tier, above every float (`z-50`). Floats composed inside the content portal
|
|
429
|
+
* into the positioner (`data-slot="dialog-positioner"`) and paint above the
|
|
430
|
+
* content. When multiple overlays are open, the most recently mounted overlay
|
|
431
|
+
* renders on top.
|
|
428
432
|
*
|
|
429
433
|
* @see https://mantle.ngrok.com/components/overlays/dialog
|
|
430
434
|
*
|
|
@@ -473,9 +477,11 @@ declare const Dialog: {
|
|
|
473
477
|
* A window overlaid on either the primary window or another dialog window.
|
|
474
478
|
* The root stateful component for the Dialog.
|
|
475
479
|
*
|
|
476
|
-
* `Dialog` renders its floating layer at Tailwind `z-
|
|
477
|
-
*
|
|
478
|
-
*
|
|
480
|
+
* `Dialog` renders its floating layer at Tailwind `z-60`, Mantle's overlay
|
|
481
|
+
* tier, above every float (`z-50`). Floats composed inside the content portal
|
|
482
|
+
* into the positioner (`data-slot="dialog-positioner"`) and paint above the
|
|
483
|
+
* content. When multiple overlays are open, the most recently mounted overlay
|
|
484
|
+
* renders on top.
|
|
479
485
|
*
|
|
480
486
|
* @see https://mantle.ngrok.com/components/overlays/dialog#dialogroot
|
|
481
487
|
*
|
|
@@ -602,9 +608,11 @@ declare const Dialog: {
|
|
|
602
608
|
* The container for the dialog content.
|
|
603
609
|
* Renders on top of the overlay and is centered in the viewport.
|
|
604
610
|
*
|
|
605
|
-
* `Dialog.Content` renders its floating layer at Tailwind `z-
|
|
606
|
-
*
|
|
607
|
-
*
|
|
611
|
+
* `Dialog.Content` renders its floating layer at Tailwind `z-60`, Mantle's
|
|
612
|
+
* overlay tier, above every float (`z-50`). Floats composed inside the content
|
|
613
|
+
* portal into the positioner (`data-slot="dialog-positioner"`) and paint above
|
|
614
|
+
* the content. When multiple overlays are open, the most recently mounted
|
|
615
|
+
* overlay renders on top.
|
|
608
616
|
*
|
|
609
617
|
* `appearance` decides how much of the viewport the dialog claims. `"centered"`
|
|
610
618
|
* caps it at `preferredWidth`, `"full-page"` fills the 16px-inset box, and
|
|
@@ -827,7 +835,7 @@ declare const Dialog: {
|
|
|
827
835
|
* </Dialog.Root>
|
|
828
836
|
* ```
|
|
829
837
|
*/
|
|
830
|
-
readonly Portal:
|
|
838
|
+
readonly Portal: typeof Portal;
|
|
831
839
|
/**
|
|
832
840
|
* An accessible name to be announced when the dialog is opened.
|
|
833
841
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./button-CNg69RsV.js";import{t as n}from"./layer-container-CglTh9-6.js";import{a as r,c as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./primitive-BWyxJnXn.js";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{XIcon as p}from"@phosphor-icons/react/X";const m=s,h=e=>d(i,{"data-slot":`dialog-trigger`,...e}),g=r,_=e=>d(u,{"data-slot":`dialog-close`,...e}),v=({className:t,ref:n,...r})=>d(a,{ref:n,"data-slot":`dialog-overlay`,className:e(`bg-overlay data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:animate-in data-state-open:fade-in-0 fixed inset-0 z-60 backdrop-blur-xs`,t),...r}),y={centered:`inset-4`,"full-page":`inset-4`,"full-bleed":`inset-0`},b={centered:`border-dialog rounded-xl border`,"full-page":`border-dialog h-full max-w-none rounded-xl border`,"full-bleed":`h-full max-w-none`},x={Root:m,Body:({className:t,...n})=>d(`div`,{"data-slot":`dialog-body`,className:e(`scrollbar scrollbar-gutter-stable text-body flex-1 overflow-y-auto p-6`,t),...n}),Close:_,CloseIconButton:({size:e=`md`,type:n=`button`,label:r=`Close Dialog`,appearance:i=`ghost`,intent:a=`neutral`,...o})=>d(u,{asChild:!0,children:d(t,{appearance:i,"data-slot":`dialog-close-icon-button`,icon:d(p,{}),intent:a,label:r,size:e,type:n,...o})}),Content:({appearance:t=`centered`,children:r,className:i,preferredWidth:a,ref:s,...c})=>f(g,{children:[d(v,{}),d(n,{"data-slot":`dialog-positioner`,className:e(`fixed z-60 flex items-center justify-center`,y[t]),children:d(o,{"data-appearance":t,"data-mantle-modal-content":!0,"data-slot":`dialog-content`,className:e(`flex max-h-full w-full flex-1 flex-col`,`outline-hidden focus-within:outline-hidden`,`bg-dialog 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`,b[t],t===`centered`&&(a??`max-w-lg`),i),ref:s,...c,children:r})})]}),Description:({className:t,ref:n,...r})=>d(c,{ref:n,"data-slot":`dialog-description`,className:e(`text-muted`,t),...r}),Footer:({className:t,...n})=>d(`div`,{"data-slot":`dialog-footer`,className:e(`border-dialog-muted flex shrink-0 justify-end gap-2 border-t px-6 py-4`,t),...n}),Header:({className:t,children:n,...r})=>d(`div`,{"data-slot":`dialog-header`,className:e(`border-dialog-muted text-strong relative flex shrink-0 items-center justify-between gap-2 border-b px-6 py-4`,`has-[.icon-button]:pr-4`,t),...r,children:n}),Overlay:v,Portal:g,Title:({className:t,ref:n,...r})=>d(l,{ref:n,"data-slot":`dialog-title`,className:e(`text-strong truncate text-lg font-medium`,t),...r}),Trigger:h};export{x as t};
|
|
@@ -4,6 +4,12 @@ import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
|
4
4
|
type DialogPrimitiveContentProps = ComponentProps<typeof DialogPrimitive.Content>;
|
|
5
5
|
declare function Root(props: ComponentPropsWithoutRef<typeof DialogPrimitive.Root>): import("react").JSX.Element;
|
|
6
6
|
declare const Trigger: import("react").ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
/**
|
|
8
|
+
* Mounts dialog layers into the nearest layer container — an enclosing
|
|
9
|
+
* overlay's positioner when one is open, else `document.body`. An explicit
|
|
10
|
+
* `container` prop wins over both.
|
|
11
|
+
*/
|
|
12
|
+
declare const Portal: ({ container, ...props }: ComponentProps<typeof DialogPrimitive.Portal>) => import("react").JSX.Element;
|
|
7
13
|
declare const Close: import("react").ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
8
14
|
declare const Overlay: (props: ComponentProps<typeof DialogPrimitive.Overlay>) => import("react").JSX.Element;
|
|
9
15
|
declare const Content: ({ onEscapeKeyDown, onInteractOutside, onPointerDownOutside, ref, ...props }: DialogPrimitiveContentProps) => import("react").JSX.Element;
|
|
@@ -21,4 +27,4 @@ declare const Description: ({ asChild, children, ref, ...props }: ComponentProps
|
|
|
21
27
|
*/
|
|
22
28
|
declare function isDialogOverlayTarget(target: EventTarget | null): boolean;
|
|
23
29
|
//#endregion
|
|
24
|
-
export {
|
|
30
|
+
export { Portal as a, Trigger as c, Overlay as i, isDialogOverlayTarget as l, Content as n, Root as o, Description as r, Title as s, Close as t };
|
package/dist/dialog.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as Dialog } from "./dialog-
|
|
1
|
+
import { l as isDialogOverlayTarget } from "./dialog-u8PtHYES.js";
|
|
2
|
+
import { t as Dialog } from "./dialog-C_K3dflm.js";
|
|
3
3
|
export { Dialog, isDialogOverlayTarget };
|
package/dist/dialog.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as e}from"./primitive-
|
|
1
|
+
import{l as e}from"./primitive-BWyxJnXn.js";import{t}from"./dialog-DqdAq5ts.js";export{t as Dialog,e as isDialogOverlayTarget};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./dropdown-menu-CpsUJGbn.js";
|
|
@@ -89,9 +89,12 @@ declare const SubTrigger: ({ className, inset, children, ...props }: ComponentPr
|
|
|
89
89
|
/**
|
|
90
90
|
* The content container for a dropdown menu sub-menu.
|
|
91
91
|
*
|
|
92
|
-
* `DropdownMenu.SubContent`
|
|
93
|
-
*
|
|
94
|
-
*
|
|
92
|
+
* `DropdownMenu.Content` and `DropdownMenu.SubContent` render at Tailwind
|
|
93
|
+
* `z-50`, Mantle's float tier. When composed inside an open `Dialog`,
|
|
94
|
+
* `AlertDialog`, or `Sheet`, they portal into that overlay's positioner and
|
|
95
|
+
* paint above the overlay that owns them. Outside every overlay, they portal to
|
|
96
|
+
* `document.body`, below the overlay tier (`z-60`). When sibling floats share a
|
|
97
|
+
* container, the most recently mounted float paints on top.
|
|
95
98
|
*
|
|
96
99
|
* @see https://mantle.ngrok.com/components/overlays/dropdown-menu#dropdownmenusubcontent
|
|
97
100
|
*
|
|
@@ -121,9 +124,12 @@ type DropdownMenuContentProps = ComponentProps<typeof DropdownMenuPrimitive.Cont
|
|
|
121
124
|
/**
|
|
122
125
|
* The container for the dropdown menu content.
|
|
123
126
|
*
|
|
124
|
-
* `DropdownMenu.Content`
|
|
125
|
-
* z-
|
|
126
|
-
*
|
|
127
|
+
* `DropdownMenu.Content` and `DropdownMenu.SubContent` render at Tailwind
|
|
128
|
+
* `z-50`, Mantle's float tier. When composed inside an open `Dialog`,
|
|
129
|
+
* `AlertDialog`, or `Sheet`, they portal into that overlay's positioner and
|
|
130
|
+
* paint above the overlay that owns them. Outside every overlay, they portal to
|
|
131
|
+
* `document.body`, below the overlay tier (`z-60`). When sibling floats share a
|
|
132
|
+
* container, the most recently mounted float paints on top.
|
|
127
133
|
*
|
|
128
134
|
* @see https://mantle.ngrok.com/components/overlays/dropdown-menu#dropdownmenucontent
|
|
129
135
|
*
|
|
@@ -271,8 +277,11 @@ declare const Shortcut: ({ className, ...props }: ComponentProps<"span">) => imp
|
|
|
271
277
|
* A menu of options or actions, triggered by a button.
|
|
272
278
|
*
|
|
273
279
|
* `DropdownMenu.Content` and `DropdownMenu.SubContent` render at Tailwind
|
|
274
|
-
* `z-50`, Mantle's
|
|
275
|
-
*
|
|
280
|
+
* `z-50`, Mantle's float tier. When composed inside an open `Dialog`,
|
|
281
|
+
* `AlertDialog`, or `Sheet`, they portal into that overlay's positioner and
|
|
282
|
+
* paint above the overlay that owns them. Outside every overlay, they portal to
|
|
283
|
+
* `document.body`, below the overlay tier (`z-60`). When sibling floats share a
|
|
284
|
+
* container, the most recently mounted float paints on top.
|
|
276
285
|
*
|
|
277
286
|
* @see https://mantle.ngrok.com/components/overlays/dropdown-menu
|
|
278
287
|
*
|
|
@@ -315,8 +324,11 @@ declare const DropdownMenu: {
|
|
|
315
324
|
* The root, stateful component that manages the open/closed state of the dropdown menu.
|
|
316
325
|
*
|
|
317
326
|
* `DropdownMenu.Content` and `DropdownMenu.SubContent` render at Tailwind
|
|
318
|
-
* `z-50`, Mantle's
|
|
319
|
-
*
|
|
327
|
+
* `z-50`, Mantle's float tier. When composed inside an open `Dialog`,
|
|
328
|
+
* `AlertDialog`, or `Sheet`, they portal into that overlay's positioner and
|
|
329
|
+
* paint above the overlay that owns them. Outside every overlay, they portal
|
|
330
|
+
* to `document.body`, below the overlay tier (`z-60`). When sibling floats
|
|
331
|
+
* share a container, the most recently mounted float paints on top.
|
|
320
332
|
*
|
|
321
333
|
* @see https://mantle.ngrok.com/components/overlays/dropdown-menu#dropdownmenuroot
|
|
322
334
|
*
|
|
@@ -356,9 +368,12 @@ declare const DropdownMenu: {
|
|
|
356
368
|
/**
|
|
357
369
|
* The container for the dropdown menu content. Appears in a portal with scrolling and animations.
|
|
358
370
|
*
|
|
359
|
-
* `DropdownMenu.Content`
|
|
360
|
-
*
|
|
361
|
-
*
|
|
371
|
+
* `DropdownMenu.Content` and `DropdownMenu.SubContent` render at Tailwind
|
|
372
|
+
* `z-50`, Mantle's float tier. When composed inside an open `Dialog`,
|
|
373
|
+
* `AlertDialog`, or `Sheet`, they portal into that overlay's positioner and
|
|
374
|
+
* paint above the overlay that owns them. Outside every overlay, they portal
|
|
375
|
+
* to `document.body`, below the overlay tier (`z-60`). When sibling floats
|
|
376
|
+
* share a container, the most recently mounted float paints on top.
|
|
362
377
|
*
|
|
363
378
|
* @see https://mantle.ngrok.com/components/overlays/dropdown-menu#dropdownmenucontent
|
|
364
379
|
*
|
|
@@ -535,9 +550,12 @@ declare const DropdownMenu: {
|
|
|
535
550
|
/**
|
|
536
551
|
* The content container for submenu items.
|
|
537
552
|
*
|
|
538
|
-
* `DropdownMenu.SubContent`
|
|
539
|
-
*
|
|
540
|
-
*
|
|
553
|
+
* `DropdownMenu.Content` and `DropdownMenu.SubContent` render at Tailwind
|
|
554
|
+
* `z-50`, Mantle's float tier. When composed inside an open `Dialog`,
|
|
555
|
+
* `AlertDialog`, or `Sheet`, they portal into that overlay's positioner and
|
|
556
|
+
* paint above the overlay that owns them. Outside every overlay, they portal
|
|
557
|
+
* to `document.body`, below the overlay tier (`z-60`). When sibling floats
|
|
558
|
+
* share a container, the most recently mounted float paints on top.
|
|
541
559
|
*
|
|
542
560
|
* @see https://mantle.ngrok.com/components/overlays/dropdown-menu#dropdownmenusubcontent
|
|
543
561
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-lZ48P8Nn.js";import{t as n}from"./data-slot-EM6s2WEU.js";import{r}from"./layer-container-CglTh9-6.js";import{n as i}from"./separator-D0D6VyyM.js";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{CheckIcon as s}from"@phosphor-icons/react/Check";import{CaretRightIcon as c}from"@phosphor-icons/react/CaretRight";import*as l from"@radix-ui/react-dropdown-menu";const u=l.Root,d=e=>a(l.Trigger,{"data-slot":`dropdown-menu-trigger`,...e}),f=({className:t,...n})=>a(l.Group,{"data-slot":`dropdown-menu-group`,className:e(`space-y-px`,t),...n}),p=({container:e,...t})=>{let n=r();return a(l.Portal,{container:e??n,...t})},m={Root:u,CheckboxItem:({className:n,children:r,checked:i,...c})=>o(l.CheckboxItem,{"data-slot":`dropdown-menu-checkbox-item`,className:e(`text-strong data-disabled:pointer-events-none data-disabled:opacity-50 relative flex cursor-pointer select-none items-center gap-2 rounded-md py-1.5 pl-2 pr-9 text-sm font-normal outline-hidden`,`data-highlighted:bg-active-menu-item`,`aria-checked:bg-selected-menu-item`,`data-highlighted:aria-checked:bg-active-selected-menu-item!`,`[&>svg]:size-5 [&_svg]:shrink-0`,n),checked:i,...c,children:[a(`span`,{className:`absolute right-2 flex items-center`,children:a(l.ItemIndicator,{children:a(t,{svg:a(s,{weight:`bold`}),className:`size-4 text-accent-600`})})}),r]}),Content:({className:t,"data-slot":r,onClick:i,loop:o=!0,width:s,...c})=>a(p,{children:a(l.Content,{"data-slot":n(r,`dropdown-menu-content`),className:e(`scrollbar`,`text-popover-foreground border-popover bg-popover p-1.25 z-50 min-w-32 overflow-hidden rounded-md border shadow-xl outline-hidden space-y-px font-sans`,`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`,`my-2 max-h-[calc(var(--radix-dropdown-menu-content-available-height)-16px)] overflow-auto`,s===`trigger`&&`w-(--radix-dropdown-menu-trigger-width)`,t),loop:o,onClick:e=>{e.stopPropagation(),i?.(e)},...c})}),Group:f,Item:({className:t,inset:n,...r})=>a(l.Item,{"data-slot":`dropdown-menu-item`,className:e(`relative flex cursor-pointer select-none items-center rounded-md px-2 py-1.5 text-strong text-sm font-normal outline-hidden transition-colors`,`data-highlighted:bg-active-menu-item`,`focus:bg-accent focus:text-accent-foreground`,`data-disabled:cursor-default data-disabled:opacity-50`,`[&>svg]:size-5 [&_svg]:shrink-0`,n&&`pl-8`,t),...r}),Label:({className:t,inset:n,...r})=>a(l.Label,{"data-slot":`dropdown-menu-label`,className:e(`px-2 py-1.5 text-sm font-medium`,n&&`pl-8`,t),...r}),RadioGroup:({className:t,...n})=>a(l.RadioGroup,{"data-slot":`dropdown-menu-radio-group`,className:e(`space-y-px`,t),...n}),RadioItem:({className:n,children:r,...i})=>o(l.RadioItem,{"data-slot":`dropdown-menu-radio-item`,className:e(`group/dropdown-menu-radio-item`,`text-strong data-disabled:pointer-events-none data-disabled:opacity-50 relative flex cursor-pointer select-none items-center gap-2 rounded-md py-1.5 px-2 text-sm font-normal outline-none`,`data-highlighted:bg-active-menu-item`,`aria-checked:bg-selected-menu-item aria-checked:pr-9`,`data-highlighted:aria-checked:bg-active-selected-menu-item!`,`[&>svg]:size-5 [&_svg]:shrink-0`,n),...i,children:[a(`span`,{className:`absolute right-2 items-center hidden group-aria-checked/dropdown-menu-radio-item:flex`,children:a(l.ItemIndicator,{children:a(t,{svg:a(s,{weight:`bold`}),className:`size-4 text-accent-600`})})}),r]}),Separator:({className:t,...n})=>a(i,{"data-slot":`dropdown-menu-separator`,className:e(`-mx-1.25 my-1 w-auto`,t),...n}),Shortcut:({className:t,...n})=>a(`span`,{"data-slot":`dropdown-menu-shortcut`,className:e(`ml-auto text-xs tracking-widest opacity-60`,t),...n}),Sub:l.Sub,SubContent:({className:t,loop:n=!0,...r})=>a(p,{children:a(l.SubContent,{"data-slot":`dropdown-menu-sub-content`,className:e(`scrollbar`,`text-popover-foreground border-popover bg-popover p-1.25 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 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 z-50 min-w-32 overflow-hidden rounded-md border shadow-xl space-y-px font-sans`,`my-2 max-h-[calc(var(--radix-dropdown-menu-content-available-height)-16px)] overflow-auto`,t),loop:n,...r})}),SubTrigger:({className:n,inset:r,children:i,...s})=>o(l.SubTrigger,{"data-slot":`dropdown-menu-sub-trigger`,className:e(`focus:bg-accent data-state-open:bg-accent relative flex select-none items-center rounded-md py-1.5 pl-2 pr-9 text-sm outline-hidden`,`data-highlighted:bg-active-menu-item data-state-open:bg-active-menu-item`,`[&>svg]:size-5 [&_svg]:shrink-0`,r&&`pl-8`,n),...s,children:[i,a(`span`,{className:`absolute right-2 flex items-center`,children:a(t,{svg:a(c,{weight:`bold`}),className:`size-4`})})]}),Trigger:d};export{m as t};
|
package/dist/dropdown-menu.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as DropdownMenu } from "./dropdown-menu-
|
|
2
|
-
import "./dropdown-menu-
|
|
1
|
+
import { t as DropdownMenu } from "./dropdown-menu-CpsUJGbn.js";
|
|
2
|
+
import "./dropdown-menu-CNaaABck.js";
|
|
3
3
|
export { DropdownMenu };
|
package/dist/dropdown-menu.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./dropdown-menu-
|
|
1
|
+
import{t as e}from"./dropdown-menu-DJDrRzDU.js";export{e as DropdownMenu};
|
package/dist/field.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { i as IconButtonIntent, n as IconButtonProps, r as IconButtonAppearance
|
|
|
3
3
|
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";
|
|
4
4
|
import { t as Label } from "./label-C6YH9skg.js";
|
|
5
5
|
import { t as Slot } from "./slot-DdgxmuI5.js";
|
|
6
|
-
import { t as Popover } from "./popover-
|
|
6
|
+
import { t as Popover } from "./popover-DDuw1UaJ.js";
|
|
7
7
|
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
8
8
|
//#region src/components/field/field-context.d.ts
|
|
9
9
|
/**
|
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-CNg69RsV.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-CNg69RsV.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-D6x6Bq-G.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};
|