@ngrok/mantle 0.76.11 → 0.77.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/agent.json +4 -1
  2. package/dist/alert-dialog.js +1 -1
  3. package/dist/browser-only-CPH56Xw_.js +1 -0
  4. package/dist/browser-only.js +1 -1
  5. package/dist/checkbox-Apow0ipK.js +1 -0
  6. package/dist/checkbox.d.ts +4 -0
  7. package/dist/checkbox.js +1 -1
  8. package/dist/choice-D6S38dPs.js +1 -0
  9. package/dist/choice.d.ts +251 -0
  10. package/dist/choice.js +1 -0
  11. package/dist/code-block.js +1 -1
  12. package/dist/command.js +1 -1
  13. package/dist/{copy-to-clipboard-Baw30q9O.js → copy-to-clipboard-BsCQ9m6K.js} +1 -1
  14. package/dist/{dialog-Cp0S2jsG.js → dialog-uyJcNks7.js} +1 -1
  15. package/dist/dialog.js +1 -1
  16. package/dist/field.js +1 -1
  17. package/dist/hooks.d.ts +127 -67
  18. package/dist/hooks.js +1 -1
  19. package/dist/icons.js +1 -1
  20. package/dist/{in-view-BC3wmz-a.d.ts → in-view-bItE1fkG.d.ts} +20 -4
  21. package/dist/input-B3TS9yAP.js +1 -0
  22. package/dist/input.d.ts +1 -46
  23. package/dist/input.js +1 -1
  24. package/dist/label-PY0qM0G5.d.ts +69 -0
  25. package/dist/label.d.ts +1 -68
  26. package/dist/list.d.ts +337 -0
  27. package/dist/list.js +1 -0
  28. package/dist/llms.txt +4 -1
  29. package/dist/multi-select.js +1 -1
  30. package/dist/pagination.js +1 -1
  31. package/dist/{primitive-BFUir4UB.js → primitive-BuVqb6zf.js} +1 -1
  32. package/dist/{select-xfyY5Vt1.js → select-Bxq_N-_o.js} +1 -1
  33. package/dist/select.js +1 -1
  34. package/dist/selectable-list.d.ts +711 -0
  35. package/dist/selectable-list.js +1 -0
  36. package/dist/sheet.js +1 -1
  37. package/dist/switch.d.ts +4 -0
  38. package/dist/tabs.js +1 -1
  39. package/dist/{theme-provider-BNFS3Acf.js → theme-provider-C5XYi2-H.js} +1 -1
  40. package/dist/theme.d.ts +3 -3
  41. package/dist/theme.js +1 -1
  42. package/dist/{toast-Bwno5LUs.js → toast-CZBWjXcP.js} +1 -1
  43. package/dist/toast.js +1 -1
  44. package/dist/types-CTam1uIW.d.ts +47 -0
  45. package/dist/use-copy-to-clipboard-DqQ0_N3E.js +1 -0
  46. package/dist/{use-prefers-reduced-motion-CWIoFA6W.js → use-prefers-reduced-motion-DBqNw1wB.js} +1 -1
  47. package/dist/utils.d.ts +1 -1
  48. package/dist/utils.js +1 -1
  49. package/dist/virtual-PBNiHjMK.js +1 -0
  50. package/package.json +64 -332
  51. package/dist/browser-only-BSl_hruR.js +0 -1
  52. package/dist/use-copy-to-clipboard-BLpquU9d.js +0 -1
@@ -0,0 +1 @@
1
+ import{t as e}from"./cx-C1UYP5We.js";import{n as t,t as n}from"./checkbox-Apow0ipK.js";import{t as r}from"./choice-D6S38dPs.js";import{n as i,t as a}from"./input-B3TS9yAP.js";import{n as o,r as s,t as c}from"./virtual-PBNiHjMK.js";import{cloneElement as l,createContext as u,forwardRef as d,isValidElement as f,useCallback as p,useContext as m,useId as h,useMemo as g,useState as _}from"react";import v from"tiny-invariant";import{jsx as y,jsxs as b}from"react/jsx-runtime";import{MagnifyingGlassIcon as x}from"@phosphor-icons/react/MagnifyingGlass";function S(e){return e.labelText==null?typeof e.label==`string`?e.label:``:e.labelText}function C(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>S(e).toLowerCase().includes(n))}function w(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function T(e,t){let n=0,r=0;for(let i of e)i.disabled||(n+=1,t.has(i.value)&&(r+=1));return n===0?{allSelected:!1,someSelected:!1}:{allSelected:r===n,someSelected:r>0}}const E=u(null);function D(e){let t=m(E);return v(t,`SelectableList.${e} must be rendered inside SelectableList.Root.`),t}const O=[],k=d(({className:t,defaultQuery:n,defaultValue:r,filter:i,onQueryChange:a,onValueChange:o,options:s,query:c,value:l,...u},d)=>{let f=h(),m=l!=null,[v,b]=_(r??O),x=m?l:v,S=c!=null,[T,D]=_(n??``),k=S?c:T,A=p(e=>{m||b(e),o?.(e)},[m,o]),j=p(e=>{S||D(e),a?.(e)},[S,a]),M=g(()=>new Set(x),[x]),N=g(()=>new Set(s.filter(e=>e.disabled).map(e=>e.value)),[s]),P=g(()=>i==null?C(s,k):s.filter(e=>i(e,k)),[s,k,i]),F=g(()=>({listId:f,filteredOptions:P,query:k,setQuery:j,selectedValues:x,selectedSet:M,disabledSet:N,toggle:e=>{N.has(e)||A(w(x,e))},setSelection:A}),[f,P,k,j,x,M,N,A]);return y(E.Provider,{value:F,children:y(`div`,{ref:d,"data-slot":`selectable-list`,className:e(`flex w-full flex-col gap-3`,t),...u})})});k.displayName=`SelectableListRoot`;const A=d(({"aria-label":e=`Filter`,...t},n)=>{let{query:r,setQuery:o}=D(`Filter`);return b(a,{ref:n,type:`text`,"data-slot":`selectable-list-filter`,"aria-label":e,value:r,onChange:e=>o(e.target.value),...t,children:[y(x,{}),y(i,{})]})});A.displayName=`SelectableListFilter`;const j=d(({children:r,className:i,...a},o)=>{let{filteredOptions:s,selectedValues:c,selectedSet:l,setSelection:u}=D(`SelectAll`),d=h(),{allSelected:f,someSelected:p}=T(s,l),m=t({allSelected:f,someSelected:p}),g=s.some(e=>!e.disabled),_=()=>{let e=s.filter(e=>!e.disabled).map(e=>e.value);if(f){let t=new Set(e);u(c.filter(e=>!t.has(e)));return}u([...new Set([...c,...e])])};return b(`label`,{ref:o,htmlFor:d,"data-slot":`selectable-list-select-all`,className:e(`text-strong flex cursor-pointer items-center gap-2 text-sm font-medium font-sans`,i),...a,children:[y(n,{id:d,checked:m,onChange:_,disabled:!g}),r]})});j.displayName=`SelectableListSelectAll`;function M(e,t){return`${e}-control-${encodeURIComponent(t)}`}const N=d(({children:t,className:i,value:a,...s},c)=>{let{listId:l,selectedSet:u,disabledSet:d,toggle:f}=D(`Item`),p=M(l,a),m=u.has(a),h=d.has(a);return y(o,{ref:c,asChild:!0,selected:m,disabled:h,className:e(`px-2 py-1.5 text-sm`,`cursor-pointer aria-disabled:cursor-default`,i),...s,"data-slot":`selectable-list-item`,"data-value":a,children:b(r.Root,{id:p,disabled:h,children:[y(r.Indicator,{role:`gridcell`,children:y(n,{checked:m,onChange:()=>f(a),tabIndex:-1})}),y(r.Content,{role:`gridcell`,children:t})]})})});N.displayName=`SelectableListItem`;const P=d((e,t)=>y(r.Label,{ref:t,"data-slot":`selectable-list-item-title`,...e}));P.displayName=`SelectableListItemTitle`;const F=d((e,t)=>y(r.Description,{ref:t,"data-slot":`selectable-list-item-description`,...e}));F.displayName=`SelectableListItemDescription`;function I(e){return b(N,{value:e.value,children:[y(P,{children:e.label}),e.description!=null&&y(F,{children:e.description})]})}function L(e,t){let n=[],r=[];for(let i of e){let e=t(i);f(e)&&(n.push(l(e,{key:i.value})),r.push(i))}return{items:n,options:r}}function R(e,t){let{filteredOptions:n,listId:r,toggle:i}=D(e),a=t??I,{items:o,options:s}=g(()=>L(n,a),[n,a]),c=p(e=>{let t=s[e];t!=null&&i(t.value)},[s,i]),l=p(e=>{let t=s[e];return t==null?``:M(r,t.value)},[s,r]),u=p(e=>s[e]?.disabled===!0,[s]);return{isEmpty:o.length===0,isItemDisabled:u,onActivate:c,itemId:l,items:o}}const z=d(({children:e,...t},n)=>{let{isEmpty:r,isItemDisabled:i,onActivate:a,itemId:o,items:c}=R(`Viewport`,e);return r?null:y(s,{ref:n,"data-slot":`selectable-list-viewport`,semantics:`grid`,...t,"aria-multiselectable":!0,isItemDisabled:i,onActivate:a,itemId:o,children:c})});z.displayName=`SelectableListViewport`;const B=d(({children:e,...t},n)=>{let{isEmpty:r,isItemDisabled:i,onActivate:a,itemId:o,items:s}=R(`VirtualViewport`,e);return r?null:y(c,{ref:n,"data-slot":`selectable-list-viewport`,semantics:`grid`,...t,"aria-multiselectable":!0,isItemDisabled:i,onActivate:a,itemId:o,children:s})});B.displayName=`SelectableListVirtualViewport`;const V=d(({children:t,className:n,...r},i)=>{let{filteredOptions:a}=D(`Empty`),o=a.length===0;return y(`div`,{ref:i,"data-slot":`selectable-list-empty`,role:`status`,className:e(!o&&`sr-only`,o&&`text-muted border-popover bg-popover flex items-center justify-center rounded-md border px-3 py-8 text-center text-sm`,n),...r,children:o?t:null})});V.displayName=`SelectableListEmpty`;const H={Root:k,Filter:A,SelectAll:j,Viewport:z,VirtualViewport:B,Item:N,ItemTitle:P,ItemDescription:F,Empty:V};export{H as SelectableList,C as filterSelectableOptions,S as optionLabelText,T as summarizeSelection,w as toggleSelectionValue};
package/dist/sheet.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./cx-C1UYP5We.js";import{t}from"./icon-button-DiX9iZ9n.js";import{a as n,c as r,i,n as a,o,r as s,s as c,t as l}from"./primitive-BFUir4UB.js";import{forwardRef as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{XIcon as p}from"@phosphor-icons/react/X";import{cva as m}from"class-variance-authority";const h=o;h.displayName=`Sheet`;const g=r;g.displayName=`SheetTrigger`;const _=l;_.displayName=`SheetClose`;const v=n;v.displayName=`SheetPortal`;const y=u(({className:t,...n},r)=>d(i,{"data-slot":`sheet-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-50 backdrop-blur-xs`,t),...n,ref:r}));y.displayName=i.displayName;const b=m(`bg-dialog border-dialog inset-y-0 h-full w-full fixed z-50 flex flex-col shadow-lg outline-hidden transition ease-in-out focus-within:outline-hidden data-state-closed:duration-100 data-state-closed:animate-out data-state-open:duration-100 data-state-open:animate-in`,{variants:{side:{left:`data-state-closed:slide-out-to-left data-state-open:slide-in-from-left left-0 border-r`,right:`data-state-closed:slide-out-to-right data-state-open:slide-in-from-right right-0 border-l`}},defaultVariants:{side:`right`}}),x=u(({children:t,className:n,preferredWidth:r=`sm:max-w-[30rem]`,side:i=`right`,...o},s)=>f(v,{children:[d(y,{}),d(a,{"data-slot":`sheet-content`,"data-mantle-modal-content":!0,className:e(b({side:i}),r,n),ref:s,...o,children:t})]}));x.displayName=a.displayName;const S=({size:e=`md`,type:n=`button`,label:r=`Close Sheet`,appearance:i=`ghost`,...a})=>d(l,{asChild:!0,children:d(t,{"data-slot":`sheet-close-icon-button`,appearance:i,icon:d(p,{}),label:r,size:e,type:n,...a})});S.displayName=`SheetCloseIconButton`;const C=({className:t,...n})=>d(`div`,{"data-slot":`sheet-body`,className:e(`scrollbar scrollbar-gutter-stable text-body flex-1 overflow-y-auto p-6`,t),...n});C.displayName=`SheetBody`;const w=({className:t,...n})=>d(`div`,{"data-slot":`sheet-header`,className:e(`border-dialog-muted flex shrink-0 flex-col gap-2 border-b py-4 pl-6 pr-4`,`has-[.icon-button]:pr-4`,t),...n});w.displayName=`SheetHeader`;const T=({className:t,...n})=>d(`div`,{"data-slot":`sheet-footer`,className:e(`border-dialog-muted flex shrink-0 justify-end gap-2 border-t px-6 py-2.5`,t),...n});T.displayName=`SheetFooter`;const E=u(({className:t,...n},r)=>d(c,{"data-slot":`sheet-title`,ref:r,className:e(`text-strong flex-1 truncate text-lg font-medium`,t),...n}));E.displayName=c.displayName;const D=u(({children:t,className:n,...r},i)=>d(`div`,{"data-slot":`sheet-title-group`,className:e(`flex items-center justify-between gap-2`,n),...r,ref:i,children:t}));D.displayName=`SheetTitleGroup`;const O=u(({className:t,...n},r)=>d(s,{"data-slot":`sheet-description`,ref:r,className:e(`text-body text-sm`,t),...n}));O.displayName=s.displayName;const k=u(({children:t,className:n,...r},i)=>d(`div`,{"data-slot":`sheet-actions`,className:e(`flex h-full items-center gap-2`,n),...r,ref:i,children:t}));k.displayName=`SheetActions`;const A={Root:h,Actions:k,Body:C,Close:_,CloseIconButton:S,Content:x,Description:O,Footer:T,Header:w,Title:E,TitleGroup:D,Trigger:g};export{A as Sheet};
1
+ import{t as e}from"./cx-C1UYP5We.js";import{t}from"./icon-button-DiX9iZ9n.js";import{a as n,c as r,i,n as a,o,r as s,s as c,t as l}from"./primitive-BuVqb6zf.js";import{forwardRef as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{XIcon as p}from"@phosphor-icons/react/X";import{cva as m}from"class-variance-authority";const h=o;h.displayName=`Sheet`;const g=r;g.displayName=`SheetTrigger`;const _=l;_.displayName=`SheetClose`;const v=n;v.displayName=`SheetPortal`;const y=u(({className:t,...n},r)=>d(i,{"data-slot":`sheet-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-50 backdrop-blur-xs`,t),...n,ref:r}));y.displayName=i.displayName;const b=m(`bg-dialog border-dialog inset-y-0 h-full w-full fixed z-50 flex flex-col shadow-lg outline-hidden transition ease-in-out focus-within:outline-hidden data-state-closed:duration-100 data-state-closed:animate-out data-state-open:duration-100 data-state-open:animate-in`,{variants:{side:{left:`data-state-closed:slide-out-to-left data-state-open:slide-in-from-left left-0 border-r`,right:`data-state-closed:slide-out-to-right data-state-open:slide-in-from-right right-0 border-l`}},defaultVariants:{side:`right`}}),x=u(({children:t,className:n,preferredWidth:r=`sm:max-w-[30rem]`,side:i=`right`,...o},s)=>f(v,{children:[d(y,{}),d(a,{"data-slot":`sheet-content`,"data-mantle-modal-content":!0,className:e(b({side:i}),r,n),ref:s,...o,children:t})]}));x.displayName=a.displayName;const S=({size:e=`md`,type:n=`button`,label:r=`Close Sheet`,appearance:i=`ghost`,...a})=>d(l,{asChild:!0,children:d(t,{"data-slot":`sheet-close-icon-button`,appearance:i,icon:d(p,{}),label:r,size:e,type:n,...a})});S.displayName=`SheetCloseIconButton`;const C=({className:t,...n})=>d(`div`,{"data-slot":`sheet-body`,className:e(`scrollbar scrollbar-gutter-stable text-body flex-1 overflow-y-auto p-6`,t),...n});C.displayName=`SheetBody`;const w=({className:t,...n})=>d(`div`,{"data-slot":`sheet-header`,className:e(`border-dialog-muted flex shrink-0 flex-col gap-2 border-b py-4 pl-6 pr-4`,`has-[.icon-button]:pr-4`,t),...n});w.displayName=`SheetHeader`;const T=({className:t,...n})=>d(`div`,{"data-slot":`sheet-footer`,className:e(`border-dialog-muted flex shrink-0 justify-end gap-2 border-t px-6 py-2.5`,t),...n});T.displayName=`SheetFooter`;const E=u(({className:t,...n},r)=>d(c,{"data-slot":`sheet-title`,ref:r,className:e(`text-strong flex-1 truncate text-lg font-medium`,t),...n}));E.displayName=c.displayName;const D=u(({children:t,className:n,...r},i)=>d(`div`,{"data-slot":`sheet-title-group`,className:e(`flex items-center justify-between gap-2`,n),...r,ref:i,children:t}));D.displayName=`SheetTitleGroup`;const O=u(({className:t,...n},r)=>d(s,{"data-slot":`sheet-description`,ref:r,className:e(`text-body text-sm`,t),...n}));O.displayName=s.displayName;const k=u(({children:t,className:n,...r},i)=>d(`div`,{"data-slot":`sheet-actions`,className:e(`flex h-full items-center gap-2`,n),...r,ref:i,children:t}));k.displayName=`SheetActions`;const A={Root:h,Actions:k,Body:C,Close:_,CloseIconButton:S,Content:x,Description:O,Footer:T,Header:w,Title:E,TitleGroup:D,Trigger:g};export{A as Sheet};
package/dist/switch.d.ts CHANGED
@@ -4,6 +4,10 @@ import { o as WithValidation } from "./validation-xyX_6kph.js";
4
4
  /**
5
5
  * A form control that allows the user to toggle between checked and not checked.
6
6
  *
7
+ * Pair it with a [`Label`](/components/label) for a single-line caption, or
8
+ * compose it inside [`Choice`](/components/choice) for a titled, multi-line
9
+ * label with a supplementary description.
10
+ *
7
11
  * @see https://mantle.ngrok.com/components/switch
8
12
  *
9
13
  * @example
package/dist/tabs.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./compose-refs-Cjf2gfB8.js";import{t}from"./cx-C1UYP5We.js";import{t as n}from"./booleanish-BfvnW6vy.js";import{t as r}from"./clsx-DUGZgXfJ.js";import{t as i}from"./use-prefers-reduced-motion-CWIoFA6W.js";import{Children as a,cloneElement as o,createContext as s,forwardRef as c,isValidElement as l,useContext as u,useEffect as d,useMemo as f,useRef as p}from"react";import m from"tiny-invariant";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";import{cva as v}from"class-variance-authority";import{Content as y,List as b,Root as x,Trigger as S}from"@radix-ui/react-tabs";const C=s({orientation:`horizontal`,appearance:`classic`}),w=c(({className:e,children:n,orientation:r=`horizontal`,appearance:i=`classic`,...a},o)=>{let s=f(()=>({orientation:r,appearance:i}),[r,i]);return g(x,{"data-slot":`tabs`,className:t(`flex gap-4`,r===`horizontal`?`flex-col`:`flex-row`,e),orientation:r,ref:o,...a,children:g(C.Provider,{value:s,children:n})})});w.displayName=`Tabs`;const T=v(`flex`,{variants:{orientation:{horizontal:`scroll-fade-x flex-row items-center overflow-x-auto overscroll-x-none w-full min-w-0 pt-1 -mt-1 px-1 -mx-1`,vertical:`flex-col items-end gap-3.5 self-stretch`},appearance:{classic:``,pill:``}},compoundVariants:[{orientation:`horizontal`,appearance:`pill`,className:`gap-1 pb-1 -mb-1`},{orientation:`horizontal`,appearance:`classic`,className:`gap-6`},{orientation:`vertical`,appearance:`classic`,className:`border-r border-gray-200`}]}),E=c(({className:n,...r},a)=>{let{orientation:o,appearance:s}=u(C),c=p(null);return d(()=>{let e=c.current;if(!e||o!==`horizontal`)return;let t=new AbortController;return e.addEventListener(`focusin`,t=>{if(t.target instanceof Element&&t.target!==e){let e=i()?`auto`:`smooth`;t.target.scrollIntoView({behavior:e,inline:`center`,block:`nearest`})}},{signal:t.signal}),()=>{t.abort()}},[o]),g(b,{"aria-orientation":o,"data-slot":`tabs-list`,className:t(T({orientation:o,appearance:s}),n),ref:e(c,a),...r})});E.displayName=`TabsList`;const D=v(`absolute z-0`,{variants:{orientation:{horizontal:`bottom-0 left-0 right-0 h-0.75`,vertical:`-right-px bottom-0 top-0 w-0.75`},appearance:{classic:`group-data-state-active/tab-trigger:bg-neutral-950`,pill:`hidden`}}}),O=()=>{let{orientation:e,appearance:t}=u(C);return g(`span`,{"aria-hidden":!0,className:r(D({orientation:e,appearance:t}))})};O.displayName=`TabsTriggerDecoration`;const k=v(t(`group/tab-trigger relative flex cursor-pointer items-center gap-1 whitespace-nowrap py-3 text-sm font-medium text-gray-600`,`ring-focus-accent outline-hidden`,`aria-disabled:cursor-default aria-disabled:opacity-50`,`focus-visible:ring-4`,`[&>svg]:shrink-0 [&>svg]:size-5`,`not-aria-disabled:hover:text-gray-900`),{variants:{orientation:{horizontal:`rounded-tl-md rounded-tr-md`,vertical:`rounded-bl-md rounded-tl-md pr-3`},appearance:{classic:t(`not-aria-disabled:hover:data-state-active:text-strong`,`data-state-active:text-strong`),pill:t(`not-aria-disabled:hover:data-state-active:text-strong`,`not-aria-disabled:hover:data-state-active:bg-neutral-500/15`,`data-state-active:text-strong`,`data-state-active:bg-neutral-500/15`,`rounded-full py-2 px-3`)}}}),A=c(({"aria-disabled":e,asChild:r=!1,children:i,className:s,disabled:c,...d},f)=>{let{orientation:p,appearance:v}=u(C),y=n(e??c),b={"aria-disabled":e??c,className:t(k({orientation:p,appearance:v}),s),disabled:y,...d};if(r){let e=a.only(i);m(l(e),"When using `asChild`, TabsTrigger must be passed a single child as a JSX tag.");let t=e.props?.children,n=y?{href:void 0,to:void 0}:{tabIndex:0};return g(S,{asChild:!0,"data-slot":`tabs-trigger`,...b,ref:f,children:o(y?g(`button`,{type:`button`}):e,n,_(h,{children:[g(O,{}),t]}))})}return _(S,{"data-slot":`tabs-trigger`,ref:f,...b,children:[g(O,{}),i]})});A.displayName=`TabsTrigger`;const j=({className:e,children:n,...r})=>g(`span`,{"data-slot":`tabs-badge`,className:t(`rounded-full bg-neutral-500/20 px-1.5 text-xs font-medium text-gray-600`,`group-data-state-active/tab-trigger:bg-neutral-950/10 group-data-state-active/tab-trigger:text-strong group-hover/tab-trigger:group-enabled/tab-trigger:group-data-state-active/tab-trigger:text-strong`,`group-hover/tab-trigger:group-enabled/tab-trigger:text-gray-700`,e),...r,children:n});j.displayName=`TabBadge`;const M=c(({className:e,...n},r)=>g(y,{ref:r,"data-slot":`tabs-content`,className:t(`focus-visible:ring-focus-accent outline-hidden focus-visible:ring-4`,e),...n}));M.displayName=`TabsContent`;const N={Root:w,Content:M,List:E,Trigger:A,Badge:j};export{N as Tabs};
1
+ import{t as e}from"./compose-refs-Cjf2gfB8.js";import{t}from"./cx-C1UYP5We.js";import{t as n}from"./booleanish-BfvnW6vy.js";import{t as r}from"./clsx-DUGZgXfJ.js";import{t as i}from"./use-prefers-reduced-motion-DBqNw1wB.js";import{Children as a,cloneElement as o,createContext as s,forwardRef as c,isValidElement as l,useContext as u,useEffect as d,useMemo as f,useRef as p}from"react";import m from"tiny-invariant";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";import{cva as v}from"class-variance-authority";import{Content as y,List as b,Root as x,Trigger as S}from"@radix-ui/react-tabs";const C=s({orientation:`horizontal`,appearance:`classic`}),w=c(({className:e,children:n,orientation:r=`horizontal`,appearance:i=`classic`,...a},o)=>{let s=f(()=>({orientation:r,appearance:i}),[r,i]);return g(x,{"data-slot":`tabs`,className:t(`flex gap-4`,r===`horizontal`?`flex-col`:`flex-row`,e),orientation:r,ref:o,...a,children:g(C.Provider,{value:s,children:n})})});w.displayName=`Tabs`;const T=v(`flex`,{variants:{orientation:{horizontal:`scroll-fade-x flex-row items-center overflow-x-auto overscroll-x-none w-full min-w-0 pt-1 -mt-1 px-1 -mx-1`,vertical:`flex-col items-end gap-3.5 self-stretch`},appearance:{classic:``,pill:``}},compoundVariants:[{orientation:`horizontal`,appearance:`pill`,className:`gap-1 pb-1 -mb-1`},{orientation:`horizontal`,appearance:`classic`,className:`gap-6`},{orientation:`vertical`,appearance:`classic`,className:`border-r border-gray-200`}]}),E=c(({className:n,...r},a)=>{let{orientation:o,appearance:s}=u(C),c=p(null);return d(()=>{let e=c.current;if(!e||o!==`horizontal`)return;let t=new AbortController;return e.addEventListener(`focusin`,t=>{if(t.target instanceof Element&&t.target!==e){let e=i()?`auto`:`smooth`;t.target.scrollIntoView({behavior:e,inline:`center`,block:`nearest`})}},{signal:t.signal}),()=>{t.abort()}},[o]),g(b,{"aria-orientation":o,"data-slot":`tabs-list`,className:t(T({orientation:o,appearance:s}),n),ref:e(c,a),...r})});E.displayName=`TabsList`;const D=v(`absolute z-0`,{variants:{orientation:{horizontal:`bottom-0 left-0 right-0 h-0.75`,vertical:`-right-px bottom-0 top-0 w-0.75`},appearance:{classic:`group-data-state-active/tab-trigger:bg-neutral-950`,pill:`hidden`}}}),O=()=>{let{orientation:e,appearance:t}=u(C);return g(`span`,{"aria-hidden":!0,className:r(D({orientation:e,appearance:t}))})};O.displayName=`TabsTriggerDecoration`;const k=v(t(`group/tab-trigger relative flex cursor-pointer items-center gap-1 whitespace-nowrap py-3 text-sm font-medium text-gray-600`,`ring-focus-accent outline-hidden`,`aria-disabled:cursor-default aria-disabled:opacity-50`,`focus-visible:ring-4`,`[&>svg]:shrink-0 [&>svg]:size-5`,`not-aria-disabled:hover:text-gray-900`),{variants:{orientation:{horizontal:`rounded-tl-md rounded-tr-md`,vertical:`rounded-bl-md rounded-tl-md pr-3`},appearance:{classic:t(`not-aria-disabled:hover:data-state-active:text-strong`,`data-state-active:text-strong`),pill:t(`not-aria-disabled:hover:data-state-active:text-strong`,`not-aria-disabled:hover:data-state-active:bg-neutral-500/15`,`data-state-active:text-strong`,`data-state-active:bg-neutral-500/15`,`rounded-full py-2 px-3`)}}}),A=c(({"aria-disabled":e,asChild:r=!1,children:i,className:s,disabled:c,...d},f)=>{let{orientation:p,appearance:v}=u(C),y=n(e??c),b={"aria-disabled":e??c,className:t(k({orientation:p,appearance:v}),s),disabled:y,...d};if(r){let e=a.only(i);m(l(e),"When using `asChild`, TabsTrigger must be passed a single child as a JSX tag.");let t=e.props?.children,n=y?{href:void 0,to:void 0}:{tabIndex:0};return g(S,{asChild:!0,"data-slot":`tabs-trigger`,...b,ref:f,children:o(y?g(`button`,{type:`button`}):e,n,_(h,{children:[g(O,{}),t]}))})}return _(S,{"data-slot":`tabs-trigger`,ref:f,...b,children:[g(O,{}),i]})});A.displayName=`TabsTrigger`;const j=({className:e,children:n,...r})=>g(`span`,{"data-slot":`tabs-badge`,className:t(`rounded-full bg-neutral-500/20 px-1.5 text-xs font-medium text-gray-600`,`group-data-state-active/tab-trigger:bg-neutral-950/10 group-data-state-active/tab-trigger:text-strong group-hover/tab-trigger:group-enabled/tab-trigger:group-data-state-active/tab-trigger:text-strong`,`group-hover/tab-trigger:group-enabled/tab-trigger:text-gray-700`,e),...r,children:n});j.displayName=`TabBadge`;const M=c(({className:e,...n},r)=>g(y,{ref:r,"data-slot":`tabs-content`,className:t(`focus-visible:ring-focus-accent outline-hidden focus-visible:ring-4`,e),...n}));M.displayName=`TabsContent`;const N={Root:w,Content:M,List:E,Trigger:A,Badge:j};export{N as Tabs};
@@ -1 +1 @@
1
- import{t as e}from"./cx-C1UYP5We.js";import{t}from"./use-matches-media-query-CMSxHR9n.js";import{n}from"./browser-only-BSl_hruR.js";import{createContext as r,useContext as i,useEffect as a,useMemo as o,useRef as s,useState as c}from"react";import l from"tiny-invariant";import{jsx as u}from"react/jsx-runtime";const d=[`light`,`dark`,`light-high-contrast`,`dark-high-contrast`],f=[`system`,...d],p=e=>e;function m(e){return typeof e==`string`?f.includes(e):!1}const h=e=>e;function g(e){return typeof e==`string`?d.includes(e):!1}const _=`(prefers-color-scheme: dark)`,v=`(prefers-contrast: more)`,y=`mantle-ui-theme`,b=`system`,x=r([`system`,()=>null]);function S({children:e}){let[t,r]=c(()=>{let e=N({cookie:n()?document.cookie:null});return w(e),e}),i=s(null);a(()=>{function e(e){let t=e??N({cookie:document.cookie});r(t),w(t)}e();try{`BroadcastChannel`in window&&(i.current=new BroadcastChannel(y),i.current.addEventListener(`message`,t=>{let n=t?.data?.theme;m(n)&&e(n)}))}catch{}function t(t){t.key===`${y}__ping`&&e()}window.addEventListener(`storage`,t);let n=window.matchMedia(_),a=window.matchMedia(v);function o(){e()}function s(){document.visibilityState===`visible`&&e()}return n.addEventListener(`change`,o),a.addEventListener(`change`,o),window.addEventListener(`pageshow`,o),document.addEventListener(`visibilitychange`,s),()=>{window.removeEventListener(`storage`,t),n.removeEventListener(`change`,o),a.removeEventListener(`change`,o),window.removeEventListener(`pageshow`,o),document.removeEventListener(`visibilitychange`,s);try{i.current?.close()}catch{}i.current=null}},[]);let l=o(()=>[t,e=>{L(e),r(e),w(e),F(e,{broadcastChannel:i.current,pingKey:`${y}__ping`})}],[t]);return u(x.Provider,{value:l,children:e})}S.displayName=`ThemeProvider`;function C(){let e=i(x);return l(e,`useTheme must be used within a ThemeProvider`),e}function w(e){if(!n())return;let t=window.document.documentElement,r=window.matchMedia(_).matches,i=window.matchMedia(v).matches,a=E(e,{prefersDarkMode:r,prefersHighContrast:i}),o=t.dataset.theme,s=t.dataset.appliedTheme,c=m(o)?o:void 0,l=g(s)?s:void 0;c===e&&l===a||(t.classList.remove(...d),t.classList.add(a),t.dataset.theme=e,t.dataset.appliedTheme=a)}function T(){if(!n())return{appliedTheme:void 0,theme:void 0};let e=window.document.documentElement,t=m(e.dataset.theme)?e.dataset.theme:void 0;return{appliedTheme:g(e.dataset.appliedTheme)?e.dataset.appliedTheme:void 0,theme:t}}function E(e,{prefersDarkMode:t,prefersHighContrast:n}){return e===`system`?O({prefersDarkMode:t,prefersHighContrast:n}):e}function D(){let e=i(x);return E(e==null?`system`:e[0],{prefersDarkMode:t(_),prefersHighContrast:t(v)})}function O({prefersDarkMode:e,prefersHighContrast:t}){return t?e?`dark-high-contrast`:`light-high-contrast`:e?`dark`:`light`}function k(e){let{storageKey:t,defaultTheme:n,themes:r,resolvedThemes:i,prefersDarkModeMediaQuery:a,prefersHighContrastMediaQuery:o}=e;function s(e){return typeof e==`string`&&r.includes(e)}function c(e){let t=document.cookie;if(!t)return null;try{let n=t.split(`;`).find(t=>t.trim().startsWith(`${e}=`))?.split(`=`)[1];return n?decodeURIComponent(n):null}catch{return null}}function l(e,t){let n=new Date;n.setFullYear(n.getFullYear()+1);let r=window.location.hostname,i=window.location.protocol,a=r===`ngrok.com`||r.endsWith(`.ngrok.com`)?`; domain=.ngrok.com`:``,o=i===`https:`?`; Secure`:``;return`${e}=${encodeURIComponent(t)}; expires=${n.toUTCString()}; path=/${a}; SameSite=Lax${o}`}function u(e,t){try{document.cookie=l(e,t)}catch{}}function d(e,t,n){return e===`system`?n?t?`dark-high-contrast`:`light-high-contrast`:t?`dark`:`light`:e}let f=null,p=null,m=null;try{f=c(t)}catch{}if(s(f))m=f;else{try{p=window.localStorage?.getItem(t)??null}catch{}s(p)&&(m=p)}let h=s(m)?m:n,g=matchMedia(a).matches,_=matchMedia(o).matches,v=d(h,g,_),y=document.documentElement;if(y.dataset.appliedTheme!==v||y.dataset.theme!==h){for(let e of i)y.classList.remove(e);y.classList.add(v),y.dataset.theme=h,y.dataset.appliedTheme=v}let b=s(f);try{if(s(p)&&!b){u(t,p);try{window.localStorage.removeItem(t)}catch{}}else b||u(t,h)}catch{}}function A(){let e={storageKey:y,defaultTheme:b,themes:f,resolvedThemes:d,prefersDarkModeMediaQuery:_,prefersHighContrastMediaQuery:v};return`(${k.toString()})(${JSON.stringify(e)})`}const j=({nonce:e})=>u(`script`,{dangerouslySetInnerHTML:{__html:A()},nonce:e,suppressHydrationWarning:!0});j.displayName=`PreventWrongThemeFlashScript`;function M(t={}){let{className:r=``,ssrCookie:i}=t??{};return o(()=>{let t,a;if(!n())t=N({cookie:i}),a=E(t,{prefersDarkMode:!1,prefersHighContrast:!1});else{let e=window.matchMedia(_).matches,n=window.matchMedia(v).matches;t=N({cookie:document.cookie}),a=E(t,{prefersDarkMode:e,prefersHighContrast:n})}return{className:e(r,a),"data-applied-theme":a,"data-theme":t}},[r,i])}function N({cookie:e}){if(!e)return b;try{let t=e.split(`;`).find(e=>e.trim().startsWith(`${y}=`))?.split(`=`)[1],n=t?globalThis.decodeURIComponent(t):null;return m(n)?n:b}catch{return b}}function P(e){if(e)return e.split(`;`).map(e=>e.trim()).find(e=>e.startsWith(`${y}=`))}function F(e,t){let{broadcastChannel:n,pingKey:r}=t;try{if(n){n.postMessage({theme:e,timestamp:Date.now()});return}}catch{}try{localStorage.setItem(r,JSON.stringify({theme:e,timestamp:Date.now()}))}catch{}}function I(e){let t=new Date;t.setFullYear(t.getFullYear()+1);let{hostname:n,protocol:r}=window.location,i=n===`ngrok.com`||n.endsWith(`.ngrok.com`)?`; domain=.ngrok.com`:``,a=r===`https:`?`; Secure`:``;return`${y}=${encodeURIComponent(e)}; expires=${t.toUTCString()}; path=/${i}; SameSite=Lax${a}`}function L(e){if(n())try{document.cookie=I(e)}catch{}}export{A as a,M as c,p as d,g as f,f as h,N as i,C as l,d as m,S as n,T as o,m as p,P as r,D as s,j as t,h as u};
1
+ import{t as e}from"./cx-C1UYP5We.js";import{t}from"./use-matches-media-query-CMSxHR9n.js";import{n}from"./browser-only-CPH56Xw_.js";import{createContext as r,useContext as i,useEffect as a,useMemo as o,useRef as s,useState as c}from"react";import l from"tiny-invariant";import{jsx as u}from"react/jsx-runtime";const d=[`light`,`dark`,`light-high-contrast`,`dark-high-contrast`],f=[`system`,...d],p=e=>e;function m(e){return typeof e==`string`?f.includes(e):!1}const h=e=>e;function g(e){return typeof e==`string`?d.includes(e):!1}const _=`(prefers-color-scheme: dark)`,v=`(prefers-contrast: more)`,y=`mantle-ui-theme`,b=`system`,x=r([`system`,()=>null]);function S({children:e}){let[t,r]=c(()=>{let e=N({cookie:n()?document.cookie:null});return w(e),e}),i=s(null);a(()=>{function e(e){let t=e??N({cookie:document.cookie});r(t),w(t)}e();try{`BroadcastChannel`in window&&(i.current=new BroadcastChannel(y),i.current.addEventListener(`message`,t=>{let n=t?.data?.theme;m(n)&&e(n)}))}catch{}function t(t){t.key===`${y}__ping`&&e()}window.addEventListener(`storage`,t);let n=window.matchMedia(_),a=window.matchMedia(v);function o(){e()}function s(){document.visibilityState===`visible`&&e()}return n.addEventListener(`change`,o),a.addEventListener(`change`,o),window.addEventListener(`pageshow`,o),document.addEventListener(`visibilitychange`,s),()=>{window.removeEventListener(`storage`,t),n.removeEventListener(`change`,o),a.removeEventListener(`change`,o),window.removeEventListener(`pageshow`,o),document.removeEventListener(`visibilitychange`,s);try{i.current?.close()}catch{}i.current=null}},[]);let l=o(()=>[t,e=>{L(e),r(e),w(e),F(e,{broadcastChannel:i.current,pingKey:`${y}__ping`})}],[t]);return u(x.Provider,{value:l,children:e})}S.displayName=`ThemeProvider`;function C(){let e=i(x);return l(e,`useTheme must be used within a ThemeProvider`),e}function w(e){if(!n())return;let t=window.document.documentElement,r=window.matchMedia(_).matches,i=window.matchMedia(v).matches,a=E(e,{prefersDarkMode:r,prefersHighContrast:i}),o=t.dataset.theme,s=t.dataset.appliedTheme,c=m(o)?o:void 0,l=g(s)?s:void 0;c===e&&l===a||(t.classList.remove(...d),t.classList.add(a),t.dataset.theme=e,t.dataset.appliedTheme=a)}function T(){if(!n())return{appliedTheme:void 0,theme:void 0};let e=window.document.documentElement,t=m(e.dataset.theme)?e.dataset.theme:void 0;return{appliedTheme:g(e.dataset.appliedTheme)?e.dataset.appliedTheme:void 0,theme:t}}function E(e,{prefersDarkMode:t,prefersHighContrast:n}){return e===`system`?O({prefersDarkMode:t,prefersHighContrast:n}):e}function D(){let e=i(x);return E(e==null?`system`:e[0],{prefersDarkMode:t(_),prefersHighContrast:t(v)})}function O({prefersDarkMode:e,prefersHighContrast:t}){return t?e?`dark-high-contrast`:`light-high-contrast`:e?`dark`:`light`}function k(e){let{storageKey:t,defaultTheme:n,themes:r,resolvedThemes:i,prefersDarkModeMediaQuery:a,prefersHighContrastMediaQuery:o}=e;function s(e){return typeof e==`string`&&r.includes(e)}function c(e){let t=document.cookie;if(!t)return null;try{let n=t.split(`;`).find(t=>t.trim().startsWith(`${e}=`))?.split(`=`)[1];return n?decodeURIComponent(n):null}catch{return null}}function l(e,t){let n=new Date;n.setFullYear(n.getFullYear()+1);let r=window.location.hostname,i=window.location.protocol,a=r===`ngrok.com`||r.endsWith(`.ngrok.com`)?`; domain=.ngrok.com`:``,o=i===`https:`?`; Secure`:``;return`${e}=${encodeURIComponent(t)}; expires=${n.toUTCString()}; path=/${a}; SameSite=Lax${o}`}function u(e,t){try{document.cookie=l(e,t)}catch{}}function d(e,t,n){return e===`system`?n?t?`dark-high-contrast`:`light-high-contrast`:t?`dark`:`light`:e}let f=null,p=null,m=null;try{f=c(t)}catch{}if(s(f))m=f;else{try{p=window.localStorage?.getItem(t)??null}catch{}s(p)&&(m=p)}let h=s(m)?m:n,g=matchMedia(a).matches,_=matchMedia(o).matches,v=d(h,g,_),y=document.documentElement;if(y.dataset.appliedTheme!==v||y.dataset.theme!==h){for(let e of i)y.classList.remove(e);y.classList.add(v),y.dataset.theme=h,y.dataset.appliedTheme=v}let b=s(f);try{if(s(p)&&!b){u(t,p);try{window.localStorage.removeItem(t)}catch{}}else b||u(t,h)}catch{}}function A(){let e={storageKey:y,defaultTheme:b,themes:f,resolvedThemes:d,prefersDarkModeMediaQuery:_,prefersHighContrastMediaQuery:v};return`(${k.toString()})(${JSON.stringify(e)})`}const j=({nonce:e})=>u(`script`,{dangerouslySetInnerHTML:{__html:A()},nonce:e,suppressHydrationWarning:!0});j.displayName=`PreventWrongThemeFlashScript`;function M(t={}){let{className:r=``,ssrCookie:i}=t??{};return o(()=>{let t,a;if(!n())t=N({cookie:i}),a=E(t,{prefersDarkMode:!1,prefersHighContrast:!1});else{let e=window.matchMedia(_).matches,n=window.matchMedia(v).matches;t=N({cookie:document.cookie}),a=E(t,{prefersDarkMode:e,prefersHighContrast:n})}return{className:e(r,a),"data-applied-theme":a,"data-theme":t}},[r,i])}function N({cookie:e}){if(!e)return b;try{let t=e.split(`;`).find(e=>e.trim().startsWith(`${y}=`))?.split(`=`)[1],n=t?globalThis.decodeURIComponent(t):null;return m(n)?n:b}catch{return b}}function P(e){if(e)return e.split(`;`).map(e=>e.trim()).find(e=>e.startsWith(`${y}=`))}function F(e,t){let{broadcastChannel:n,pingKey:r}=t;try{if(n){n.postMessage({theme:e,timestamp:Date.now()});return}}catch{}try{localStorage.setItem(r,JSON.stringify({theme:e,timestamp:Date.now()}))}catch{}}function I(e){let t=new Date;t.setFullYear(t.getFullYear()+1);let{hostname:n,protocol:r}=window.location,i=n===`ngrok.com`||n.endsWith(`.ngrok.com`)?`; domain=.ngrok.com`:``,a=r===`https:`?`; Secure`:``;return`${y}=${encodeURIComponent(e)}; expires=${t.toUTCString()}; path=/${i}; SameSite=Lax${a}`}function L(e){if(n())try{document.cookie=I(e)}catch{}}export{A as a,M as c,p as d,g as f,f as h,N as i,C as l,d as m,S as n,T as o,m as p,P as r,D as s,j as t,h as u};
package/dist/theme.d.ts CHANGED
@@ -201,14 +201,14 @@ declare function useTheme(): ThemeProviderState;
201
201
  * Read the theme and applied theme from the `<html>` element.
202
202
  */
203
203
  declare function readThemeFromHtmlElement(): {
204
- appliedTheme: "light" | "dark" | "light-high-contrast" | "dark-high-contrast" | undefined;
205
- theme: "system" | "light" | "dark" | "light-high-contrast" | "dark-high-contrast" | undefined;
204
+ appliedTheme: "dark" | "light" | "light-high-contrast" | "dark-high-contrast" | undefined;
205
+ theme: "dark" | "light" | "system" | "light-high-contrast" | "dark-high-contrast" | undefined;
206
206
  };
207
207
  /**
208
208
  * If the theme is "system", it will resolve the theme based on the user's media query preferences, otherwise it will return the theme as is.
209
209
  * This will mirror the result that gets applied to the <html> element.
210
210
  */
211
- declare function useAppliedTheme(): "light" | "dark" | "light-high-contrast" | "dark-high-contrast";
211
+ declare function useAppliedTheme(): "dark" | "light" | "light-high-contrast" | "dark-high-contrast";
212
212
  /**
213
213
  * determineThemeFromMediaQuery returns the theme that should be used based on the user's media query preferences.
214
214
  * @private
package/dist/theme.js CHANGED
@@ -1 +1 @@
1
- import{a as e,c as t,d as n,f as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./theme-provider-BNFS3Acf.js";import{useEffect as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";const y=`mantle-dark-styles`,b=`mantle-light-high-contrast-styles`,x=`mantle-dark-high-contrast-styles`,S=`(prefers-color-scheme: dark)`,C=`(prefers-contrast: more) and (prefers-color-scheme: light)`,w=`(prefers-contrast: more) and (prefers-color-scheme: dark)`;function T(e,t){let n=t??e;return{dark:n===`dark`?`all`:S,lightHighContrast:n===`light-high-contrast`?`all`:C,darkHighContrast:n===`dark-high-contrast`?`all`:w}}function E(e){return e}function D(e){let{darkLinkId:t,lightHcLinkId:n,darkHcLinkId:r,mediaDark:i,mediaLightHc:a,mediaDarkHc:o,forceTheme:s}=e,c=document.documentElement.dataset.appliedTheme,l=s??c,u=document.getElementById(t),d=document.getElementById(n),f=document.getElementById(r);u&&(u.media=l===`dark`?`all`:i),d&&(d.media=l===`light-high-contrast`?`all`:a),f&&(f.media=l===`dark-high-contrast`?`all`:o)}function O(e){let t={darkLinkId:y,lightHcLinkId:b,darkHcLinkId:x,mediaDark:S,mediaLightHc:C,mediaDarkHc:w,forceTheme:e};return`(${D.toString()})(${JSON.stringify(t)})`}function k({darkCssUrl:e,lightHighContrastCssUrl:t,darkHighContrastCssUrl:n,forceTheme:i,nonce:o,ssrCookie:s}){h(()=>{function e(){let e=document.documentElement.dataset.appliedTheme;return r(e)?e:void 0}function t(){let{dark:t,lightHighContrast:n,darkHighContrast:r}=T(e(),i),a=document.getElementById(y),o=document.getElementById(b),s=document.getElementById(x);a&&(a.media=t),o&&(o.media=n),s&&(s.media=r)}t();let n=new MutationObserver(t);return n.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-applied-theme`]}),()=>{n.disconnect()}},[i]);let c=s==null?void 0:a({cookie:s}),l=c===`system`?void 0:c,{dark:u,lightHighContrast:d,darkHighContrast:f}=T(l,i);return v(g,{children:[(!i||i===`dark`)&&_(`link`,{rel:`stylesheet`,id:y,href:e,media:u,suppressHydrationWarning:!0}),(!i||i===`light-high-contrast`)&&_(`link`,{rel:`stylesheet`,id:b,href:t,media:d,suppressHydrationWarning:!0}),(!i||i===`dark-high-contrast`)&&_(`link`,{rel:`stylesheet`,id:x,href:n,media:f,suppressHydrationWarning:!0}),!i&&l==null&&_(`script`,{dangerouslySetInnerHTML:{__html:O(i)},nonce:o,suppressHydrationWarning:!0})]})}k.displayName=`MantleStyleSheets`;const A=`https://assets.ngrok.com`,j=`${A}/fonts`,M={roobert:`/roobert/roobert-proportional-vf.woff2`,"jetbrains-mono":`/jetbrains/jetbrainsmono-wght.woff2`,"jetbrains-mono-italic":`/jetbrains/jetbrainsmono-italic-wght.woff2`,"family-regular":`/family/family-regular.woff2`,"family-italic":`/family/family-italic.woff2`};function N(e){return`${j}${e.startsWith(`/`)?e:`/${e}`}`}function P(e){return`<${N(M[e])}>; rel=preload; as=font; type="font/woff2"; crossorigin`}const F=({name:e})=>_(`link`,{rel:`preload`,href:N(M[e]),as:`font`,type:`font/woff2`,crossOrigin:`anonymous`});F.displayName=`PreloadFont`;export{m as $resolvedTheme,n as $theme,k as MantleStyleSheets,F as PreloadFont,p as PreventWrongThemeFlashScript,c as ThemeProvider,A as assetsCdnOrigin,d as extractThemeCookie,O as fixMediaScriptContent,N as fontHref,a as getStoredTheme,r as isResolvedTheme,u as isTheme,E as mantleStyleSheetUrls,P as preloadFontLink,e as preventWrongThemeFlashScriptContent,l as readThemeFromHtmlElement,s as resolvedThemes,i as themes,f as useAppliedTheme,t as useInitialHtmlThemeProps,o as useTheme};
1
+ import{a as e,c as t,d as n,f as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./theme-provider-C5XYi2-H.js";import{useEffect as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";const y=`mantle-dark-styles`,b=`mantle-light-high-contrast-styles`,x=`mantle-dark-high-contrast-styles`,S=`(prefers-color-scheme: dark)`,C=`(prefers-contrast: more) and (prefers-color-scheme: light)`,w=`(prefers-contrast: more) and (prefers-color-scheme: dark)`;function T(e,t){let n=t??e;return{dark:n===`dark`?`all`:S,lightHighContrast:n===`light-high-contrast`?`all`:C,darkHighContrast:n===`dark-high-contrast`?`all`:w}}function E(e){return e}function D(e){let{darkLinkId:t,lightHcLinkId:n,darkHcLinkId:r,mediaDark:i,mediaLightHc:a,mediaDarkHc:o,forceTheme:s}=e,c=document.documentElement.dataset.appliedTheme,l=s??c,u=document.getElementById(t),d=document.getElementById(n),f=document.getElementById(r);u&&(u.media=l===`dark`?`all`:i),d&&(d.media=l===`light-high-contrast`?`all`:a),f&&(f.media=l===`dark-high-contrast`?`all`:o)}function O(e){let t={darkLinkId:y,lightHcLinkId:b,darkHcLinkId:x,mediaDark:S,mediaLightHc:C,mediaDarkHc:w,forceTheme:e};return`(${D.toString()})(${JSON.stringify(t)})`}function k({darkCssUrl:e,lightHighContrastCssUrl:t,darkHighContrastCssUrl:n,forceTheme:i,nonce:o,ssrCookie:s}){h(()=>{function e(){let e=document.documentElement.dataset.appliedTheme;return r(e)?e:void 0}function t(){let{dark:t,lightHighContrast:n,darkHighContrast:r}=T(e(),i),a=document.getElementById(y),o=document.getElementById(b),s=document.getElementById(x);a&&(a.media=t),o&&(o.media=n),s&&(s.media=r)}t();let n=new MutationObserver(t);return n.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-applied-theme`]}),()=>{n.disconnect()}},[i]);let c=s==null?void 0:a({cookie:s}),l=c===`system`?void 0:c,{dark:u,lightHighContrast:d,darkHighContrast:f}=T(l,i);return v(g,{children:[(!i||i===`dark`)&&_(`link`,{rel:`stylesheet`,id:y,href:e,media:u,suppressHydrationWarning:!0}),(!i||i===`light-high-contrast`)&&_(`link`,{rel:`stylesheet`,id:b,href:t,media:d,suppressHydrationWarning:!0}),(!i||i===`dark-high-contrast`)&&_(`link`,{rel:`stylesheet`,id:x,href:n,media:f,suppressHydrationWarning:!0}),!i&&l==null&&_(`script`,{dangerouslySetInnerHTML:{__html:O(i)},nonce:o,suppressHydrationWarning:!0})]})}k.displayName=`MantleStyleSheets`;const A=`https://assets.ngrok.com`,j=`${A}/fonts`,M={roobert:`/roobert/roobert-proportional-vf.woff2`,"jetbrains-mono":`/jetbrains/jetbrainsmono-wght.woff2`,"jetbrains-mono-italic":`/jetbrains/jetbrainsmono-italic-wght.woff2`,"family-regular":`/family/family-regular.woff2`,"family-italic":`/family/family-italic.woff2`};function N(e){return`${j}${e.startsWith(`/`)?e:`/${e}`}`}function P(e){return`<${N(M[e])}>; rel=preload; as=font; type="font/woff2"; crossorigin`}const F=({name:e})=>_(`link`,{rel:`preload`,href:N(M[e]),as:`font`,type:`font/woff2`,crossOrigin:`anonymous`});F.displayName=`PreloadFont`;export{m as $resolvedTheme,n as $theme,k as MantleStyleSheets,F as PreloadFont,p as PreventWrongThemeFlashScript,c as ThemeProvider,A as assetsCdnOrigin,d as extractThemeCookie,O as fixMediaScriptContent,N as fontHref,a as getStoredTheme,r as isResolvedTheme,u as isTheme,E as mantleStyleSheetUrls,P as preloadFontLink,e as preventWrongThemeFlashScriptContent,l as readThemeFromHtmlElement,s as resolvedThemes,i as themes,f as useAppliedTheme,t as useInitialHtmlThemeProps,o as useTheme};
@@ -1 +1 @@
1
- import{t as e}from"./cx-C1UYP5We.js";import{t}from"./icon-SUx16Sl3.js";import{t as n}from"./slot-DT_E5BQx.js";import{s as r}from"./theme-provider-BNFS3Acf.js";import{createContext as i,forwardRef as a,useContext as o,useMemo as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{CheckCircleIcon as u}from"@phosphor-icons/react/CheckCircle";import{InfoIcon as d}from"@phosphor-icons/react/Info";import{WarningIcon as f}from"@phosphor-icons/react/Warning";import{WarningDiamondIcon as p}from"@phosphor-icons/react/WarningDiamond";import*as m from"sonner";const h=({className:t,containerAriaLabel:n,dir:i,duration_ms:a=4e3,position:o=`top-center`,style:s})=>{let l=r();return c(m.Toaster,{"data-slot":`toaster`,className:e(`toaster overlay-prompt pointer-events-auto *:duration-200`,t),containerAriaLabel:n,dir:i,duration:a,gap:12,position:o??`top-center`,style:s,theme:l,toastOptions:{unstyled:!0}})};h.displayName=`Toaster`;const g=i(``);function _(e,t){let n=t?.duration_ms;return typeof n==`number`&&n<=0&&(n=1/0),m.toast.custom(t=>c(g.Provider,{value:t,children:e}),{duration:n,...t?.id?{id:t.id}:{},unstyled:!0})}const v=i({priority:`info`}),y=a(({asChild:t,children:r,className:i,priority:a,...o},u)=>{let d=t?n:`div`,f=s(()=>({priority:a}),[a]);return c(v.Provider,{value:f,children:l(d,{"data-slot":`toast`,className:e(`relative flex items-start gap-2 text-sm font-sans`,`p-3 pl-3.75`,`bg-popover high-contrast:border-popover rounded rounded-r-[0.3125rem] border border-gray-500/35 shadow-lg`,i),ref:u,...o,children:[c(E,{priority:a}),r]})})});y.displayName=`Toast`;const b=a(({className:n,svg:r,...i},a)=>{let s=o(v);switch(s.priority){case`danger`:return c(t,{"data-slot":`toast-icon`,className:e(`text-danger-600`,n),ref:a,svg:r??c(f,{weight:`fill`}),...i});case`warning`:return c(t,{"data-slot":`toast-icon`,className:e(`text-warning-600`,n),ref:a,svg:r??c(p,{weight:`fill`}),...i});case`success`:return c(t,{"data-slot":`toast-icon`,className:e(`text-success-600`,n),ref:a,svg:r??c(u,{weight:`fill`}),...i});case`info`:return c(t,{"data-slot":`toast-icon`,className:e(`text-accent-600`,n),ref:a,svg:c(d,{weight:`fill`}),...i});default:throw Error(`Unreachable Case: ${s.priority}`)}});b.displayName=`ToastIcon`;const x=a(({asChild:t,className:r,onClick:i,...a},s)=>{let l=o(g);return c(t?n:`button`,{"data-slot":`toast-action`,className:e(`shrink-0`,`data-icon-button:-mr-0.5 data-icon-button:-mt-0.5 data-icon-button:rounded-xs`,r),onClick:e=>{i?.(e),!e.defaultPrevented&&m.toast.dismiss(l)},ref:s,...a})});x.displayName=`ToastAction`;const S=a(({asChild:t,className:r,...i},a)=>c(t?n:`p`,{"data-slot":`toast-message`,className:e(`text-strong flex-1 text-sm font-body`,r),ref:a,...i}));S.displayName=`ToastMessage`;const C={Root:y,Action:x,Icon:b,Message:S};function w(e){e.target instanceof Element&&e.target.closest(`.overlay-prompt`)&&e.preventDefault()}const T={info:`bg-accent-600`,warning:`bg-warning-600`,success:`bg-success-600`,danger:`bg-danger-600`};function E({className:t,priority:n,...r}){return c(`div`,{"aria-hidden":!0,className:e(`z-1 absolute -inset-px right-auto w-1.5 rounded-l`,T[n],t),...r})}export{w as i,h as n,_ as r,C as t};
1
+ import{t as e}from"./cx-C1UYP5We.js";import{t}from"./icon-SUx16Sl3.js";import{t as n}from"./slot-DT_E5BQx.js";import{s as r}from"./theme-provider-C5XYi2-H.js";import{createContext as i,forwardRef as a,useContext as o,useMemo as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{CheckCircleIcon as u}from"@phosphor-icons/react/CheckCircle";import{InfoIcon as d}from"@phosphor-icons/react/Info";import{WarningIcon as f}from"@phosphor-icons/react/Warning";import{WarningDiamondIcon as p}from"@phosphor-icons/react/WarningDiamond";import*as m from"sonner";const h=({className:t,containerAriaLabel:n,dir:i,duration_ms:a=4e3,position:o=`top-center`,style:s})=>{let l=r();return c(m.Toaster,{"data-slot":`toaster`,className:e(`toaster overlay-prompt pointer-events-auto *:duration-200`,t),containerAriaLabel:n,dir:i,duration:a,gap:12,position:o??`top-center`,style:s,theme:l,toastOptions:{unstyled:!0}})};h.displayName=`Toaster`;const g=i(``);function _(e,t){let n=t?.duration_ms;return typeof n==`number`&&n<=0&&(n=1/0),m.toast.custom(t=>c(g.Provider,{value:t,children:e}),{duration:n,...t?.id?{id:t.id}:{},unstyled:!0})}const v=i({priority:`info`}),y=a(({asChild:t,children:r,className:i,priority:a,...o},u)=>{let d=t?n:`div`,f=s(()=>({priority:a}),[a]);return c(v.Provider,{value:f,children:l(d,{"data-slot":`toast`,className:e(`relative flex items-start gap-2 text-sm font-sans`,`p-3 pl-3.75`,`bg-popover high-contrast:border-popover rounded rounded-r-[0.3125rem] border border-gray-500/35 shadow-lg`,i),ref:u,...o,children:[c(E,{priority:a}),r]})})});y.displayName=`Toast`;const b=a(({className:n,svg:r,...i},a)=>{let s=o(v);switch(s.priority){case`danger`:return c(t,{"data-slot":`toast-icon`,className:e(`text-danger-600`,n),ref:a,svg:r??c(f,{weight:`fill`}),...i});case`warning`:return c(t,{"data-slot":`toast-icon`,className:e(`text-warning-600`,n),ref:a,svg:r??c(p,{weight:`fill`}),...i});case`success`:return c(t,{"data-slot":`toast-icon`,className:e(`text-success-600`,n),ref:a,svg:r??c(u,{weight:`fill`}),...i});case`info`:return c(t,{"data-slot":`toast-icon`,className:e(`text-accent-600`,n),ref:a,svg:c(d,{weight:`fill`}),...i});default:throw Error(`Unreachable Case: ${s.priority}`)}});b.displayName=`ToastIcon`;const x=a(({asChild:t,className:r,onClick:i,...a},s)=>{let l=o(g);return c(t?n:`button`,{"data-slot":`toast-action`,className:e(`shrink-0`,`data-icon-button:-mr-0.5 data-icon-button:-mt-0.5 data-icon-button:rounded-xs`,r),onClick:e=>{i?.(e),!e.defaultPrevented&&m.toast.dismiss(l)},ref:s,...a})});x.displayName=`ToastAction`;const S=a(({asChild:t,className:r,...i},a)=>c(t?n:`p`,{"data-slot":`toast-message`,className:e(`text-strong flex-1 text-sm font-body`,r),ref:a,...i}));S.displayName=`ToastMessage`;const C={Root:y,Action:x,Icon:b,Message:S};function w(e){e.target instanceof Element&&e.target.closest(`.overlay-prompt`)&&e.preventDefault()}const T={info:`bg-accent-600`,warning:`bg-warning-600`,success:`bg-success-600`,danger:`bg-danger-600`};function E({className:t,priority:n,...r}){return c(`div`,{"aria-hidden":!0,className:e(`z-1 absolute -inset-px right-auto w-1.5 rounded-l`,T[n],t),...r})}export{w as i,h as n,_ as r,C as t};
package/dist/toast.js CHANGED
@@ -1 +1 @@
1
- import{n as e,r as t,t as n}from"./toast-Bwno5LUs.js";export{n as Toast,e as Toaster,t as makeToast};
1
+ import{n as e,r as t,t as n}from"./toast-CZBWjXcP.js";export{n as Toast,e as Toaster,t as makeToast};
@@ -0,0 +1,47 @@
1
+ //#region src/components/input/types.d.ts
2
+ /**
3
+ * (Not a Boolean attribute!) The autocomplete attribute takes as its value a space-separated string that describes what,
4
+ * if any, type of autocomplete functionality the input should provide. A typical implementation of autocomplete recalls
5
+ * previous values entered in the same input field, but more complex forms of autocomplete can exist. For instance, a
6
+ * browser could integrate with a device's contacts list to autocomplete email addresses in an email input field.
7
+ *
8
+ * The autocomplete attribute is valid on hidden, text, search, url, tel, email, date, month, week, time, datetime-local,
9
+ * number, range, color, and password. This attribute has no effect on input types that do not return numeric or text
10
+ * data, being valid for all input types except checkbox, radio, file, or any of the button types.
11
+ *
12
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values
13
+ */
14
+ type AutoComplete = "off" | "on" | "name" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "email" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "language" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "url" | "photo";
15
+ type WithAutoComplete = {
16
+ /**
17
+ * (Not a Boolean attribute!) The autocomplete attribute takes as its value a space-separated string that describes what,
18
+ * if any, type of autocomplete functionality the input should provide. A typical implementation of autocomplete recalls
19
+ * previous values entered in the same input field, but more complex forms of autocomplete can exist. For instance, a
20
+ * browser could integrate with a device's contacts list to autocomplete email addresses in an email input field.
21
+ *
22
+ * The autocomplete attribute is valid on hidden, text, search, url, tel, email, date, month, week, time, datetime-local,
23
+ * number, range, color, and password. This attribute has no effect on input types that do not return numeric or text
24
+ * data, being valid for all input types except checkbox, radio, file, or any of the button types.
25
+ *
26
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values
27
+ */
28
+ autoComplete?: AutoComplete;
29
+ };
30
+ /**
31
+ * A string specifying the type of control to render. For example, to create a checkbox, a value of `"checkbox"` is used.
32
+ * If omitted (or an unknown value is specified), the input type `"text"` is used, creating a plaintext input field.
33
+ *
34
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types
35
+ */
36
+ type InputType = "button" | "checkbox" | "color" | "date" | "datetime-local" | "email" | "file" | "hidden" | "image" | "month" | "number" | "password" | "radio" | "range" | "reset" | "search" | "submit" | "tel" | "text" | "time" | "url" | "week";
37
+ type WithInputType = {
38
+ /**
39
+ * A string specifying the type of control to render. For example, to create a checkbox, a value of `"checkbox"` is used.
40
+ * If omitted (or an unknown value is specified), the input type `"text"` is used, creating a plaintext input field.
41
+ *
42
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types
43
+ */
44
+ type?: InputType;
45
+ };
46
+ //#endregion
47
+ export { WithInputType as i, InputType as n, WithAutoComplete as r, AutoComplete as t };
@@ -0,0 +1 @@
1
+ import{t as e}from"./copy-to-clipboard-BsCQ9m6K.js";function t(){return e}export{t};
@@ -1 +1 @@
1
- import{n as e}from"./browser-only-BSl_hruR.js";import{useEffect as t,useState as n}from"react";const r=`(prefers-reduced-motion: no-preference)`;function i(){return e()?!window.matchMedia(r).matches:!0}function a(){let[e,a]=n(!0);return t(()=>{let e=window.matchMedia(r);a(i());function t(e){a(!e.matches)}return e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t)}},[]),e}export{a as n,i as t};
1
+ import{n as e}from"./browser-only-CPH56Xw_.js";import{useEffect as t,useState as n}from"react";const r=`(prefers-reduced-motion: no-preference)`;function i(){return e()?!window.matchMedia(r).matches:!0}function a(){let[e,a]=n(!0);return t(()=>{let e=window.matchMedia(r);a(i());function t(e){a(!e.matches)}return e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t)}},[]),e}export{a as n,i as t};
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { _ as timeSortingDirections, a as AlphanumericSortingDirection, c as TimeSortingDirection, d as isSortingDirection, f as isSortingMode, g as timeSortingByDirection, h as sortingModes, i as $timeSortingDirection, l as alphanumericSortingDirections, m as sortingDirections, n as $sortingDirection, o as SortingDirection, p as isTimeSortingDirection, r as $sortingMode, s as SortingMode, t as $alphanumericSortingDirection, u as isAlphanumericSortingDirection } from "./direction-CcTY0FmA.js";
2
- import { a as composeRefs, i as inView, n as MarginType, r as ViewChangeHandler, s as copyToClipboard, t as InViewOptions } from "./in-view-BC3wmz-a.js";
2
+ import { a as composeRefs, i as inView, n as MarginType, r as ViewChangeHandler, s as copyToClipboard, t as InViewOptions } from "./in-view-bItE1fkG.js";
3
3
 
4
4
  //#region src/utils/sorting/compare.d.ts
5
5
  /**
package/dist/utils.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./compose-refs-Cjf2gfB8.js";import{t}from"./copy-to-clipboard-Baw30q9O.js";import{a as n,c as r,d as i,f as a,i as o,l as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./direction-Wa9W2F61.js";import{t as h}from"./in-view-C2DpZ6s0.js";function g(e,t){return Math.sign(t.getTime()-e.getTime())}function _(e,t){return Math.sign(e.getTime()-t.getTime())}export{p as $alphanumericSortingDirection,c as $sortingDirection,d as $sortingMode,o as $timeSortingDirection,n as alphanumericSortingDirections,g as compareDatesNewestToOldest,_ as compareDatesOldestToNewest,e as composeRefs,t as copyToClipboard,h as inView,l as isAlphanumericSortingDirection,f as isSortingDirection,r as isSortingMode,s as isTimeSortingDirection,m as sortingDirections,i as sortingModes,a as timeSortingByDirection,u as timeSortingDirections};
1
+ import{t as e}from"./compose-refs-Cjf2gfB8.js";import{t}from"./copy-to-clipboard-BsCQ9m6K.js";import{a as n,c as r,d as i,f as a,i as o,l as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./direction-Wa9W2F61.js";import{t as h}from"./in-view-C2DpZ6s0.js";function g(e,t){return Math.sign(t.getTime()-e.getTime())}function _(e,t){return Math.sign(e.getTime()-t.getTime())}export{p as $alphanumericSortingDirection,c as $sortingDirection,d as $sortingMode,o as $timeSortingDirection,n as alphanumericSortingDirections,g as compareDatesNewestToOldest,_ as compareDatesOldestToNewest,e as composeRefs,t as copyToClipboard,h as inView,l as isAlphanumericSortingDirection,f as isSortingDirection,r as isSortingMode,s as isTimeSortingDirection,m as sortingDirections,i as sortingModes,a as timeSortingByDirection,u as timeSortingDirections};
@@ -0,0 +1 @@
1
+ import{n as e}from"./compose-refs-Cjf2gfB8.js";import{t}from"./cx-C1UYP5We.js";import{t as n}from"./slot-DT_E5BQx.js";import{Children as r,createContext as i,forwardRef as a,isValidElement as o,useCallback as s,useContext as c,useEffect as l,useId as u,useMemo as d,useRef as f,useState as p}from"react";import m from"tiny-invariant";import{jsx as h}from"react/jsx-runtime";import{useVirtualizer as g}from"@tanstack/react-virtual";const _=i(null);function v(e){let t=c(_);return m(t,`List.${e} must be composed inside List.Root / List.VirtualRoot (or a SelectableList viewport).`),t}const y=i(null),b=i(null);function x(e){return o(e)?e.props.disabled===!0:!1}function S({start:e,step:t,count:n,isItemDisabled:r}){for(let i=e;i>=0&&i<n;i+=t)if(!r(i))return i;return-1}const C=`a[href]:not([tabindex="-1"]), button:not(:disabled):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])`;function w(e){let t=e.matches(C)?e:e.querySelector(C);return t instanceof HTMLElement?t:null}function T(e){let t=e instanceof Element?e.closest(`[data-index]`):null;if(t==null)return null;let n=Number(t.getAttribute(`data-index`));return!Number.isInteger(n)||n<0?null:{item:t,index:n}}function E(e,t){if(!(e instanceof Element))return!1;let n=e.closest(`a[href], button, input, select, textarea, label, [role="button"], [role="link"], [role="menuitem"], [contenteditable="true"]`);return n!=null&&t.contains(n)}function D({count:e,isItemDisabled:t,focusItemAt:n}){return{onKeyDown:r=>{if(r.target instanceof HTMLElement&&(r.target.isContentEditable||r.target.tagName===`INPUT`||r.target.tagName===`TEXTAREA`||r.target.tagName===`SELECT`)||r.altKey||r.ctrlKey||r.metaKey)return;let i=T(r.target);if(i==null)return;let a=-1,o=1;switch(r.key){case`ArrowDown`:o=1,a=S({start:i.index+1,step:o,count:e,isItemDisabled:t});break;case`ArrowUp`:o=-1,a=S({start:i.index-1,step:o,count:e,isItemDisabled:t});break;case`Home`:o=1,a=S({start:0,step:o,count:e,isItemDisabled:t});break;case`End`:o=-1,a=S({start:e-1,step:o,count:e,isItemDisabled:t});break;default:return}r.preventDefault(),a>=0&&a!==i.index&&n(a,o)}}}function O({count:e,enabled:t,isItemDisabled:n,onActivate:r,itemId:i,scrollToIndex:a}){let[o,s]=p(-1),c=f(!1),u=o>=e?e-1:o;if(l(()=>{o>=e&&s(e-1)},[o,e]),!t)return{activeIndex:-1,collectionProps:{}};let d=e=>n?.(e)??!1,m=(t,n)=>S({start:t,step:n,count:e,isItemDisabled:d}),h=e=>{e<0||(s(e),a(e))};return{activeIndex:u,collectionProps:{tabIndex:0,"aria-activedescendant":u>=0?i(u):void 0,onMouseDown:e=>{let t=T(e.target);if(t!=null&&!d(t.index)){s(t.index),c.current=!1;return}c.current=!0},onClick:e=>{if(e.defaultPrevented)return;let t=T(e.target);t==null||d(t.index)||E(e.target,t.item)||(s(t.index),r?.(t.index))},onFocus:t=>{if(t.target!==t.currentTarget){let e=T(t.target);e!=null&&!d(e.index)&&s(e.index),t.target instanceof HTMLElement&&t.target.tabIndex>=0||t.currentTarget.focus({preventScroll:!0}),c.current=!1;return}let n=c.current;c.current=!1,e>0&&!n&&s(e=>e<0?m(0,1):e)},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(s(-1),c.current=!1)},onKeyDown:t=>{if(t.target===t.currentTarget&&!(t.altKey||t.ctrlKey||t.metaKey))switch(c.current=!1,t.key){case`ArrowDown`:t.preventDefault(),h(m(u<0?0:u+1,1));break;case`ArrowUp`:t.preventDefault(),h(u<0?m(0,1):m(u-1,-1));break;case`Home`:t.preventDefault(),h(m(0,1));break;case`End`:t.preventDefault(),h(m(e-1,-1));break;case` `:case`Enter`:!t.repeat&&u>=0&&!d(u)&&(t.preventDefault(),r?.(u));break;default:break}}}}}function k({count:e,focusItemAt:t,isItemDisabled:n,onActivate:r,itemId:i,scrollToIndex:a,semantics:o}){let s=u(),c=d(()=>({semantics:o}),[o]),l=d(()=>i??(e=>`${s}-item-${e}`),[i,s]),{activeIndex:f,collectionProps:p}=O({count:e,enabled:o===`grid`,isItemDisabled:n,onActivate:r,itemId:l,scrollToIndex:a}),m=d(()=>({activeIndex:f,stampItemId:i==null?l:null}),[f,l,i]);return{collectionProps:o===`list`?D({count:e,isItemDisabled:n,focusItemAt:t}):p,gridNav:m,listContext:c}}function A({"aria-label":e,"aria-labelledby":n,"aria-multiselectable":r,children:i,className:a,collectionProps:o,gridNav:s,listContext:c,viewportProps:l,viewportRef:u}){return h(_.Provider,{value:c,children:h(b.Provider,{value:s,children:h(`div`,{ref:u,"data-slot":`list`,className:t(`border-popover bg-popover scrollbar overscroll-none overflow-x-hidden overflow-y-auto rounded-md border p-1`,a),...l,children:h(`div`,{"data-slot":`list-collection`,role:c.semantics===`grid`?`grid`:`list`,"aria-label":e,"aria-labelledby":n,"aria-multiselectable":r,className:`relative flex w-full flex-col gap-px outline-hidden`,...o,children:i})})})})}A.displayName=`ListPrimitiveShell`;const j=a(({asChild:r,children:i,className:a,disabled:o=!1,selected:s=!1,style:l,...u},d)=>{let{semantics:f}=v(`Item`),p=c(y),m=c(b),g=f===`grid`,_=r?n:`div`,x=p?.placement??null,S=p?.index,C=g&&m!=null&&S!=null&&m.activeIndex===S;return h(_,{ref:e(d,x?.measureRef??null),"data-slot":`list-item`,...u,id:g&&S!=null&&m?.stampItemId!=null?m.stampItemId(S):u.id,"data-index":S,"data-state":s?`selected`:`unselected`,"data-disabled":o||void 0,"data-active":C||void 0,role:g?`row`:`listitem`,"aria-selected":g?s:void 0,"aria-disabled":g&&o?!0:u[`aria-disabled`],"aria-rowindex":g?x?.posInSet:void 0,"aria-posinset":g?void 0:x?.posInSet,"aria-setsize":g?void 0:x?.setSize,className:t(`rounded-md data-[state=selected]:bg-selected-menu-item data-[active]:bg-active-menu-item data-[active]:data-[state=selected]:bg-active-selected-menu-item`,!o&&`hover:bg-active-menu-item hover:data-[state=selected]:bg-active-selected-menu-item`,!g&&!o&&`has-[:focus-visible]:bg-active-menu-item has-[:focus-visible]:data-[state=selected]:bg-active-selected-menu-item`,a),style:x?{...l,...x.style}:l,children:i})});j.displayName=`ListPrimitiveItem`;function M({children:e,index:t}){let n=d(()=>({index:t,placement:null}),[t]);return h(y.Provider,{value:n,children:e})}M.displayName=`ListPrimitivePlainItem`;const N=a(({"aria-label":t,"aria-labelledby":n,"aria-multiselectable":i,children:a,className:c,isItemDisabled:l,onActivate:u,itemId:p,semantics:m=`list`,...g},_)=>{let v=f(null),y=e(v,_),b=d(()=>r.toArray(a).filter(o),[a]),S=s(e=>{v.current?.querySelector(`[data-index="${e}"]`)?.scrollIntoView({block:`nearest`})},[]),C=s((e,t)=>{let n=v.current;if(n!=null)for(let r=e;r>=0&&r<b.length;r+=t){let e=n.querySelector(`[data-index="${r}"]`);if(e==null)continue;let t=w(e);if(t!=null){t.focus({preventScroll:!0}),e.scrollIntoView({block:`nearest`});return}}},[b.length]),{collectionProps:T,gridNav:E,listContext:D}=k({count:b.length,focusItemAt:C,isItemDisabled:l??(e=>x(b[e])),onActivate:u,itemId:p,scrollToIndex:S,semantics:m});return h(A,{"aria-label":t,"aria-labelledby":n,"aria-multiselectable":i,className:c,collectionProps:T,gridNav:E,listContext:D,viewportProps:g,viewportRef:y,children:b.map((e,t)=>h(M,{index:t,children:e},e.key??t))})});N.displayName=`ListPrimitiveRoot`;function P({virtualItem:e,count:t,measureRef:n}){return{posInSet:e.index+1,setSize:t,measureRef:n,style:{position:`absolute`,left:0,top:0,width:`100%`,transform:`translateY(${e.start}px)`}}}function F({children:e,count:t,measureRef:n,virtualItem:r}){let i=d(()=>({index:r.index,placement:P({virtualItem:r,count:t,measureRef:n})}),[r,t,n]);return h(y.Provider,{value:i,children:e})}F.displayName=`ListPrimitiveWindowedItem`;const I=a(({"aria-label":t,"aria-labelledby":n,"aria-multiselectable":i,children:a,className:c,estimateItemHeight:u=44,isItemDisabled:p,onActivate:m,overscan:_=8,itemId:v,semantics:y=`list`,...b},S)=>{let C=f(null),T=e(C,S),E=d(()=>r.toArray(a).filter(o),[a]),D=E.length,O=g({count:D,getScrollElement:()=>C.current,estimateSize:()=>u,getItemKey:e=>E[e]?.key??e,overscan:_,gap:1}),j=s(e=>O.scrollToIndex(e,{align:`auto`}),[O]),M=f(null);l(()=>()=>{M.current!=null&&cancelAnimationFrame(M.current)},[]);let{collectionProps:N,gridNav:P,listContext:I}=k({count:D,focusItemAt:s((e,t)=>{M.current!=null&&(cancelAnimationFrame(M.current),M.current=null);let n=e,r=0,i=()=>{M.current=null;let e=C.current;if(e==null||n<0||n>=D)return;O.scrollToIndex(n,{align:`auto`});let a=e.querySelector(`[data-index="${n}"]`);if(a!=null){let e=w(a);if(e!=null){e.focus({preventScroll:!0});return}n+=t,r=0}r+=1,r<10&&(M.current=requestAnimationFrame(i))};i()},[D,O]),isItemDisabled:p??(e=>x(E[e])),onActivate:m,itemId:v,scrollToIndex:j,semantics:y}),L=O.getVirtualItems(),R=L.some(e=>e.index===P.activeIndex);return h(A,{"aria-label":t,"aria-labelledby":n,"aria-multiselectable":i,className:c,collectionProps:{...N,"aria-activedescendant":R?N[`aria-activedescendant`]:void 0,"aria-rowcount":y===`grid`?D:void 0,style:{height:`${O.getTotalSize()}px`}},gridNav:P,listContext:I,viewportProps:b,viewportRef:T,children:L.map(e=>{let t=E[e.index];return t==null?null:h(F,{virtualItem:e,count:D,measureRef:O.measureElement,children:t},e.key)})})});I.displayName=`ListPrimitiveVirtualRoot`;export{j as n,N as r,I as t};