@ngrok/mantle 0.84.1 → 0.84.2

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 (217) hide show
  1. package/dist/accordion.d.ts +14 -10
  2. package/dist/accordion.js +1 -1
  3. package/dist/agent.json +1 -1
  4. package/dist/{alert-Blmunr_D.d.ts → alert-DCVfviBx.d.ts} +18 -3
  5. package/dist/alert-DtBQuuuP.js +1 -0
  6. package/dist/alert-center.d.ts +15 -6
  7. package/dist/alert-center.js +1 -1
  8. package/dist/alert-dialog.d.ts +58 -37
  9. package/dist/alert-dialog.js +1 -1
  10. package/dist/alert.d.ts +1 -1
  11. package/dist/alert.js +1 -1
  12. package/dist/alternate-announcement-BkH4bOKp.js +1 -0
  13. package/dist/anchor-Cqu4GPPV.js +1 -0
  14. package/dist/anchor.d.ts +15 -15
  15. package/dist/anchor.js +1 -1
  16. package/dist/app-layout.js +1 -1
  17. package/dist/area-chart.js +1 -1
  18. package/dist/avatar.js +1 -1
  19. package/dist/badge.d.ts +3 -1
  20. package/dist/badge.js +1 -1
  21. package/dist/bar-chart.d.ts +17 -8
  22. package/dist/bar-chart.js +1 -1
  23. package/dist/breadcrumb.js +1 -1
  24. package/dist/button-B52_vczK.js +1 -0
  25. package/dist/{button-DjsmeoJ2.d.ts → button-B5i9n7Qp.d.ts} +19 -7
  26. package/dist/button-CaM-ZAH5.js +1 -0
  27. package/dist/{button-DwFvQWu4.js → button-DGsTE3P2.js} +1 -1
  28. package/dist/{button-CRCNRnk6.d.ts → button-DO53OA70.d.ts} +2 -2
  29. package/dist/{button-YkYZ0ymH.js → button-Wn-yt0c_.js} +1 -1
  30. package/dist/{button-C39M5h4K.d.ts → button-crUf0hbR.d.ts} +19 -2
  31. package/dist/button.d.ts +3 -3
  32. package/dist/button.js +1 -1
  33. package/dist/calendar.d.ts +20 -4
  34. package/dist/calendar.js +1 -1
  35. package/dist/card.d.ts +10 -6
  36. package/dist/card.js +1 -1
  37. package/dist/centered-layout.js +1 -1
  38. package/dist/chart-B_rZqf8a.js +2 -0
  39. package/dist/checkbox-Gg6nGUnR.js +1 -0
  40. package/dist/checkbox.js +1 -1
  41. package/dist/choice-CT_AdesL.js +1 -0
  42. package/dist/{choice-zOjixuj7.d.ts → choice-PESu-9s8.d.ts} +36 -12
  43. package/dist/choice.d.ts +1 -1
  44. package/dist/choice.js +1 -1
  45. package/dist/{code-block-Dj9otiLi.js → code-block-BE3Q0iAo.js} +2 -2
  46. package/dist/code-block.d.ts +26 -2
  47. package/dist/code-block.js +6 -6
  48. package/dist/code-block_highlight-utils.js +1 -1
  49. package/dist/code.js +1 -1
  50. package/dist/combobox.d.ts +19 -2
  51. package/dist/combobox.js +1 -1
  52. package/dist/command.d.ts +32 -13
  53. package/dist/command.js +1 -1
  54. package/dist/compose-refs-DdUwopIY.js +1 -0
  55. package/dist/{cx-IiQEAKf5.js → cx-0HCjnNv1.js} +1 -1
  56. package/dist/cx.d.ts +3 -3
  57. package/dist/cx.js +1 -1
  58. package/dist/data-table.d.ts +114 -61
  59. package/dist/data-table.js +1 -1
  60. package/dist/description-list.d.ts +43 -9
  61. package/dist/description-list.js +1 -1
  62. package/dist/{dialog-u8PtHYES.d.ts → dialog-B8YvfyIo.d.ts} +5 -3
  63. package/dist/{dialog-CSUE-jw8.js → dialog-CA-1Z0Np.js} +1 -1
  64. package/dist/{dialog-CEk0L7M7.d.ts → dialog-CtLI_uex.d.ts} +5 -3
  65. package/dist/dialog.d.ts +2 -2
  66. package/dist/dialog.js +1 -1
  67. package/dist/{dropdown-menu-CpsUJGbn.d.ts → dropdown-menu-BYapTV0f.d.ts} +8 -5
  68. package/dist/dropdown-menu-BkPBh_8y.d.ts +1 -0
  69. package/dist/{dropdown-menu-Cy7mLIpJ.js → dropdown-menu-lxHsgLiw.js} +1 -1
  70. package/dist/dropdown-menu.d.ts +2 -2
  71. package/dist/dropdown-menu.js +1 -1
  72. package/dist/empty.d.ts +4 -4
  73. package/dist/empty.js +1 -1
  74. package/dist/field.d.ts +91 -38
  75. package/dist/field.js +1 -1
  76. package/dist/flag.d.ts +9 -1
  77. package/dist/flag.js +1 -1
  78. package/dist/hooks.d.ts +15 -18
  79. package/dist/hooks.js +1 -1
  80. package/dist/hover-card.d.ts +11 -3
  81. package/dist/hover-card.js +1 -1
  82. package/dist/{icon-k4E9yNWD.d.ts → icon-BmJ57Tgh.d.ts} +10 -0
  83. package/dist/icon-CGKaq_tV.js +1 -0
  84. package/dist/icon-U24NfYv7.js +1 -0
  85. package/dist/icon-w0HUe7tr.d.ts +42 -0
  86. package/dist/icon.d.ts +2 -2
  87. package/dist/icon.js +1 -1
  88. package/dist/{icons-DEVx1oP9.js → icons-Cie4gcrm.js} +1 -1
  89. package/dist/icons.d.ts +7 -13
  90. package/dist/icons.js +1 -1
  91. package/dist/{in-view-gxyc9Q1_.d.ts → in-view-Ch5vJtWo.d.ts} +10 -5
  92. package/dist/input-BhykQSvJ.js +1 -0
  93. package/dist/input-DQyN6gN0.js +1 -0
  94. package/dist/input.d.ts +22 -10
  95. package/dist/input.js +1 -1
  96. package/dist/{kbd-B9qmYaW8.js → kbd-4_0Y_8rx.js} +1 -1
  97. package/dist/kbd.d.ts +15 -9
  98. package/dist/kbd.js +1 -1
  99. package/dist/{label-C6YH9skg.d.ts → label-Bnfe9YJ6.d.ts} +3 -1
  100. package/dist/label-BqIp6kFx.js +1 -0
  101. package/dist/label.d.ts +1 -1
  102. package/dist/label.js +1 -1
  103. package/dist/layer-container-BTcQpd4K.js +1 -0
  104. package/dist/layer-container.js +1 -1
  105. package/dist/line-chart.js +1 -1
  106. package/dist/{list-7w5k3HiN.js → list-Bo1mExIg.js} +1 -1
  107. package/dist/list.d.ts +37 -14
  108. package/dist/list.js +1 -1
  109. package/dist/live-region-CV7kykeo.js +1 -0
  110. package/dist/live-region.js +1 -1
  111. package/dist/llms.txt +1 -1
  112. package/dist/main.d.ts +4 -2
  113. package/dist/main.js +1 -1
  114. package/dist/media-object.d.ts +5 -12
  115. package/dist/media-object.js +1 -1
  116. package/dist/multi-select.d.ts +45 -13
  117. package/dist/multi-select.js +1 -1
  118. package/dist/otp-input.d.ts +9 -3
  119. package/dist/otp-input.js +1 -1
  120. package/dist/pagination.d.ts +165 -19
  121. package/dist/pagination.js +1 -1
  122. package/dist/{popover-D6x6Bq-G.js → popover-Bp-9B3GR.js} +1 -1
  123. package/dist/{popover-DDuw1UaJ.d.ts → popover-s2LhmzfQ.d.ts} +8 -4
  124. package/dist/popover.d.ts +1 -1
  125. package/dist/popover.js +1 -1
  126. package/dist/primitive-CejGAoGb.js +1 -0
  127. package/dist/progress.d.ts +65 -31
  128. package/dist/progress.js +1 -1
  129. package/dist/qr-code.d.ts +10 -4
  130. package/dist/qr-code.js +1 -1
  131. package/dist/radio-group-HDVxTNPi.js +1 -0
  132. package/dist/radio-group.d.ts +50 -25
  133. package/dist/radio-group.js +1 -1
  134. package/dist/sandbar.d.ts +1 -1
  135. package/dist/sandbar.js +1 -1
  136. package/dist/sandboxed-on-click-UagMFl_U.js +1 -0
  137. package/dist/sandboxed-on-click.d.ts +8 -0
  138. package/dist/sandboxed-on-click.js +1 -1
  139. package/dist/scatter-plot.js +1 -1
  140. package/dist/select-Dov9H2CX.js +1 -0
  141. package/dist/{select-DkFkSYBP.d.ts → select-ouAW88jx.d.ts} +30 -9
  142. package/dist/select.d.ts +1 -1
  143. package/dist/select.js +1 -1
  144. package/dist/selectable-list.d.ts +64 -20
  145. package/dist/selectable-list.js +1 -1
  146. package/dist/{separator-CNDs98Dv.d.ts → separator-Bo4nY_3M.d.ts} +13 -2
  147. package/dist/{separator-D1K7DSTv.js → separator-Da8lDnio.js} +1 -1
  148. package/dist/separator.d.ts +1 -1
  149. package/dist/separator.js +1 -1
  150. package/dist/{sheet-2AQT0DNu.js → sheet-C6UGAvRk.js} +1 -1
  151. package/dist/sheet.d.ts +5 -5
  152. package/dist/sheet.js +1 -1
  153. package/dist/sidebar.d.ts +7 -6
  154. package/dist/sidebar.js +1 -1
  155. package/dist/skeleton-paJOgf-f.js +1 -0
  156. package/dist/skeleton.d.ts +5 -4
  157. package/dist/skeleton.js +1 -1
  158. package/dist/skip-to-main-link.d.ts +9 -6
  159. package/dist/skip-to-main-link.js +1 -1
  160. package/dist/slider.d.ts +7 -3
  161. package/dist/slider.js +1 -1
  162. package/dist/{slot-CxM7jdFi.js → slot-C3gII_9c.js} +1 -1
  163. package/dist/slot.js +1 -1
  164. package/dist/split-button.d.ts +8 -3
  165. package/dist/split-button.js +1 -1
  166. package/dist/switch.js +1 -1
  167. package/dist/{table-D51ZtV4U.d.ts → table-DEI-qvSC.d.ts} +25 -12
  168. package/dist/table-EZNW3nFk.js +1 -0
  169. package/dist/table.d.ts +1 -1
  170. package/dist/table.js +1 -1
  171. package/dist/tabs.js +1 -1
  172. package/dist/text-area.js +1 -1
  173. package/dist/theme-DN-Et3A_.js +1 -0
  174. package/dist/theme-switcher.d.ts +24 -12
  175. package/dist/theme-switcher.js +1 -1
  176. package/dist/theme.d.ts +18 -4
  177. package/dist/theme.js +1 -1
  178. package/dist/toast.d.ts +8 -3
  179. package/dist/toast.js +1 -1
  180. package/dist/tooltip-CkAibjBb.js +1 -0
  181. package/dist/{tooltip-BKWK5c7_.d.ts → tooltip-DA41fxe5.d.ts} +7 -1
  182. package/dist/tooltip.d.ts +1 -1
  183. package/dist/tooltip.js +1 -1
  184. package/dist/{use-breakpoint-Dqu12Szq.js → use-breakpoint-BhJ_3El2.js} +1 -1
  185. package/dist/use-is-apple-platform-CMPzIYjz.js +1 -0
  186. package/dist/use-matches-media-query-DCBT6iNA.js +1 -0
  187. package/dist/use-prefers-reduced-motion-DHYDQk1h.js +1 -0
  188. package/dist/utils.d.ts +1 -1
  189. package/dist/utils.js +1 -1
  190. package/dist/visually-hidden.js +1 -1
  191. package/dist/well.js +1 -1
  192. package/package.json +3 -3
  193. package/dist/alert-D8StKSjK.js +0 -1
  194. package/dist/anchor-BjyGV6tB.js +0 -1
  195. package/dist/button-BCk0KpWb.js +0 -1
  196. package/dist/button-DiDlvAOp.js +0 -1
  197. package/dist/chart-DVt4hvnu.js +0 -2
  198. package/dist/checkbox-0EoxOyMA.js +0 -1
  199. package/dist/choice-BKkfjjAd.js +0 -1
  200. package/dist/compose-refs-BdBMM9ga.js +0 -1
  201. package/dist/dropdown-menu-CNaaABck.d.ts +0 -1
  202. package/dist/icon-CX_gj6sW.d.ts +0 -25
  203. package/dist/icon-d-nMCfAI.js +0 -1
  204. package/dist/icon-lZ48P8Nn.js +0 -1
  205. package/dist/input-BnlpQF0c.js +0 -1
  206. package/dist/input-CXmS0OFN.js +0 -1
  207. package/dist/label-D-D11mlp.js +0 -1
  208. package/dist/layer-container-CglTh9-6.js +0 -1
  209. package/dist/primitive-BSBmlRyy.js +0 -1
  210. package/dist/select-B52tWHOB.js +0 -1
  211. package/dist/skeleton-D86Gsflk.js +0 -1
  212. package/dist/table-C_Nm_RSV.js +0 -1
  213. package/dist/theme-CVfq037P.js +0 -1
  214. package/dist/tooltip-BZRRJgpm.js +0 -1
  215. package/dist/use-is-apple-platform-Cxwrb86L.js +0 -1
  216. package/dist/use-matches-media-query-Bd_GhhVd.js +0 -1
  217. package/dist/use-prefers-reduced-motion-Bk5zAfHY.js +0 -1
@@ -1 +1 @@
1
- import{n as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./slot-CxM7jdFi.js";import{t as r}from"./interactive-target-BXScNeOr.js";import{Children as i,createContext 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 _=a(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=a(null),b=a(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({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 D({count:e,enabled:t,isItemDisabled:n,onActivate:i,itemId:a,scrollToIndex:o}){let[s,c]=p(-1),u=f(!1),d=s>=e?e-1:s;if(l(()=>{s>=e&&c(e-1)},[s,e]),!t)return{activeIndex:-1,collectionProps:{}};let m=e=>n?.(e)??!1,h=(t,n)=>S({start:t,step:n,count:e,isItemDisabled:m}),g=e=>{e<0||(c(e),o(e))};return{activeIndex:d,collectionProps:{tabIndex:0,"aria-activedescendant":d>=0?a(d):void 0,onMouseDown:e=>{let t=T(e.target);if(t!=null&&!m(t.index)){c(t.index),u.current=!1;return}u.current=!0},onClick:e=>{if(e.defaultPrevented)return;let t=T(e.target);t==null||m(t.index)||r(e.target,t.item)||(c(t.index),i?.(t.index))},onFocus:t=>{if(t.target!==t.currentTarget){let e=T(t.target);e!=null&&!m(e.index)&&c(e.index),t.target instanceof HTMLElement&&t.target.tabIndex>=0||t.currentTarget.focus({preventScroll:!0}),u.current=!1;return}let n=u.current;u.current=!1,e>0&&!n&&c(e=>e<0?h(0,1):e)},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(c(-1),u.current=!1)},onKeyDown:t=>{if(t.target===t.currentTarget&&!(t.altKey||t.ctrlKey||t.metaKey))switch(u.current=!1,t.key){case`ArrowDown`:t.preventDefault(),g(h(d<0?0:d+1,1));break;case`ArrowUp`:t.preventDefault(),g(d<0?h(0,1):h(d-1,-1));break;case`Home`:t.preventDefault(),g(h(0,1));break;case`End`:t.preventDefault(),g(h(e-1,-1));break;case` `:case`Enter`:!t.repeat&&d>=0&&!m(d)&&(t.preventDefault(),i?.(d))}}}}}function O({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}=D({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`?E({count:e,isItemDisabled:n,focusItemAt:t}):p,gridNav:m,listContext:c}}function k({"aria-label":e,"aria-labelledby":n,"aria-multiselectable":r,children:i,className:a,collectionProps:o,gridNav:s,listContext:c,viewportProps:l,ref: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})})})})}const A=({asChild:r,children:i,className:a,disabled:o=!1,ref:s,selected:l=!1,style: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,w=x?.measureRef??null,T=e(s,w);return h(_,{ref:T,"data-slot":`list-item`,...d,id:g&&S!=null&&m?.stampItemId!=null?m.stampItemId(S):d.id,"data-index":S,"data-state":l?`selected`:`unselected`,"data-disabled":o||void 0,"data-active":C||void 0,role:g?`row`:`listitem`,"aria-selected":g?l:void 0,"aria-disabled":g&&o?!0:d[`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?{...u,...x.style}:u,children:i})};function j({children:e,index:t}){let n=d(()=>({index:t,placement:null}),[t]);return h(y.Provider,{value:n,children:e})}const M=({"aria-label":t,"aria-labelledby":n,"aria-multiselectable":r,children:a,className:c,isItemDisabled:l,onActivate:u,itemId:p,ref:m,semantics:g=`list`,..._})=>{let v=f(null),y=e(v,m),b=d(()=>i.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}=O({count:b.length,focusItemAt:C,isItemDisabled:l??(e=>x(b[e])),onActivate:u,itemId:p,scrollToIndex:S,semantics:g});return h(k,{"aria-label":t,"aria-labelledby":n,"aria-multiselectable":r,className:c,collectionProps:T,gridNav:E,listContext:D,viewportProps:_,ref:y,children:b.map((e,t)=>h(j,{index:t,children:e},e.key??t))})};function N({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 P({children:e,count:t,measureRef:n,virtualItem:r}){let i=d(()=>({index:r.index,placement:N({virtualItem:r,count:t,measureRef:n})}),[r,t,n]);return h(y.Provider,{value:i,children:e})}const F=({"aria-label":t,"aria-labelledby":n,"aria-multiselectable":r,children:a,className:c,estimateItemHeight:u=44,isItemDisabled:p,onActivate:m,overscan:_=8,itemId:v,ref:y,semantics:b=`list`,...S})=>{let C=f(null),T=e(C,y),E=d(()=>i.toArray(a).filter(o),[a]),D=E.length,A=g({count:D,getScrollElement:()=>C.current,estimateSize:()=>u,getItemKey:e=>E[e]?.key??e,overscan:_,gap:1}),j=s(e=>A.scrollToIndex(e,{align:`auto`}),[A]),M=f(null);l(()=>()=>{M.current!=null&&cancelAnimationFrame(M.current)},[]);let{collectionProps:N,gridNav:F,listContext:I}=O({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;A.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,A]),isItemDisabled:p??(e=>x(E[e])),onActivate:m,itemId:v,scrollToIndex:j,semantics:b}),L=A.getVirtualItems(),R=L.some(e=>e.index===F.activeIndex);return h(k,{"aria-label":t,"aria-labelledby":n,"aria-multiselectable":r,className:c,collectionProps:{...N,"aria-activedescendant":R?N[`aria-activedescendant`]:void 0,"aria-rowcount":b===`grid`?D:void 0,style:{height:`${A.getTotalSize()}px`}},gridNav:F,listContext:I,viewportProps:S,ref:T,children:L.map(e=>{let t=E[e.index];return t==null?null:h(P,{virtualItem:e,count:D,measureRef:A.measureElement,children:t},e.key)})})};export{A as n,M as r,F as t};
1
+ import{n as e}from"./compose-refs-DdUwopIY.js";import{t}from"./cx-0HCjnNv1.js";import{t as n}from"./slot-C3gII_9c.js";import{t as r}from"./interactive-target-BXScNeOr.js";import{Children as i,createContext 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 _=a(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=a(null),b=a(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({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 D({count:e,enabled:t,isItemDisabled:n,onActivate:i,itemId:a,scrollToIndex:o}){let[s,c]=p(-1),u=f(!1),d=s>=e?e-1:s;if(l(()=>{s>=e&&c(e-1)},[s,e]),!t)return{activeIndex:-1,collectionProps:{}};let m=e=>n?.(e)??!1,h=(t,n)=>S({start:t,step:n,count:e,isItemDisabled:m}),g=e=>{e<0||(c(e),o(e))};return{activeIndex:d,collectionProps:{tabIndex:0,"aria-activedescendant":d>=0?a(d):void 0,onMouseDown:e=>{let t=T(e.target);if(t!=null&&!m(t.index)){c(t.index),u.current=!1;return}u.current=!0},onClick:e=>{if(e.defaultPrevented)return;let t=T(e.target);t==null||m(t.index)||r(e.target,t.item)||(c(t.index),i?.(t.index))},onFocus:t=>{if(t.target!==t.currentTarget){let e=T(t.target);e!=null&&!m(e.index)&&c(e.index),t.target instanceof HTMLElement&&t.target.tabIndex>=0||t.currentTarget.focus({preventScroll:!0}),u.current=!1;return}let n=u.current;u.current=!1,e>0&&!n&&c(e=>e<0?h(0,1):e)},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(c(-1),u.current=!1)},onKeyDown:t=>{if(t.target===t.currentTarget&&!(t.altKey||t.ctrlKey||t.metaKey))switch(u.current=!1,t.key){case`ArrowDown`:t.preventDefault(),g(h(d<0?0:d+1,1));break;case`ArrowUp`:t.preventDefault(),g(d<0?h(0,1):h(d-1,-1));break;case`Home`:t.preventDefault(),g(h(0,1));break;case`End`:t.preventDefault(),g(h(e-1,-1));break;case` `:case`Enter`:!t.repeat&&d>=0&&!m(d)&&(t.preventDefault(),i?.(d))}}}}}function O({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}=D({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`?E({count:e,isItemDisabled:n,focusItemAt:t}):p,gridNav:m,listContext:c}}function k({"aria-label":e,"aria-labelledby":n,"aria-multiselectable":r,children:i,className:a,collectionProps:o,gridNav:s,listContext:c,viewportProps:l,ref: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})})})})}const A=({asChild:r,children:i,className:a,disabled:o=!1,ref:s,selected:l=!1,style: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,w=x?.measureRef??null,T=e(s,w);return h(_,{ref:T,"data-slot":`list-item`,...d,id:g&&S!=null&&m?.stampItemId!=null?m.stampItemId(S):d.id,"data-index":S,"data-state":l?`selected`:`unselected`,"data-disabled":o||void 0,"data-active":C||void 0,role:g?`row`:`listitem`,"aria-selected":g?l:void 0,"aria-disabled":g&&o?!0:d[`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?{...u,...x.style}:u,children:i})};function j({children:e,index:t}){let n=d(()=>({index:t,placement:null}),[t]);return h(y.Provider,{value:n,children:e})}const M=({"aria-label":t,"aria-labelledby":n,"aria-multiselectable":r,children:a,className:c,isItemDisabled:l,onActivate:u,itemId:p,ref:m,semantics:g=`list`,..._})=>{let v=f(null),y=e(v,m),b=d(()=>i.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}=O({count:b.length,focusItemAt:C,isItemDisabled:l??(e=>x(b[e])),onActivate:u,itemId:p,scrollToIndex:S,semantics:g});return h(k,{"aria-label":t,"aria-labelledby":n,"aria-multiselectable":r,className:c,collectionProps:T,gridNav:E,listContext:D,viewportProps:_,ref:y,children:b.map((e,t)=>h(j,{index:t,children:e},e.key??t))})};function N({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 P({children:e,count:t,measureRef:n,virtualItem:r}){let i=d(()=>({index:r.index,placement:N({virtualItem:r,count:t,measureRef:n})}),[r,t,n]);return h(y.Provider,{value:i,children:e})}const F=({"aria-label":t,"aria-labelledby":n,"aria-multiselectable":r,children:a,className:c,estimateItemHeight:u=44,isItemDisabled:p,onActivate:m,overscan:_=8,itemId:v,ref:y,semantics:b=`list`,...S})=>{"use no memo";let C=f(null),T=e(C,y),E=d(()=>i.toArray(a).filter(o),[a]),D=E.length,A=s(e=>E[e]?.key??e,[E]),j=g({count:D,getScrollElement:()=>C.current,estimateSize:()=>u,getItemKey:A,overscan:_,gap:1,initialRect:{width:0,height:u*(_+1)}}),M=s(e=>j.scrollToIndex(e,{align:`auto`}),[j]),N=f(null);l(()=>()=>{N.current!=null&&cancelAnimationFrame(N.current)},[]);let{collectionProps:F,gridNav:I,listContext:L}=O({count:D,focusItemAt:s((e,t)=>{N.current!=null&&(cancelAnimationFrame(N.current),N.current=null);let n=e,r=0,i=()=>{N.current=null;let e=C.current;if(e==null||n<0||n>=D)return;j.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&&(N.current=requestAnimationFrame(i))};i()},[D,j]),isItemDisabled:p??(e=>x(E[e])),onActivate:m,itemId:v,scrollToIndex:M,semantics:b}),R=j.getVirtualItems(),z=R.some(e=>e.index===I.activeIndex);return h(k,{"aria-label":t,"aria-labelledby":n,"aria-multiselectable":r,className:c,collectionProps:{...F,"aria-activedescendant":z?F[`aria-activedescendant`]:void 0,"aria-rowcount":b===`grid`?D:void 0,style:{height:`${j.getTotalSize()}px`}},gridNav:I,listContext:L,viewportProps:S,ref:T,children:R.map(e=>{let t=E[e.index];return t==null?null:h(P,{virtualItem:e,count:D,measureRef:j.measureElement,children:t},e.key)})})};export{A as n,M as r,F as t};
package/dist/list.d.ts CHANGED
@@ -88,7 +88,7 @@ type ListRootProps$1 = ComponentProps<"div"> & {
88
88
  * ```
89
89
  */
90
90
  type VirtualRootProps = ListRootProps$1 & {
91
- /** Estimated item height in px, used to seed the virtualizer before items are measured. */
91
+ /** Estimated item height in px, used to seed the virtualizer before items are measured. With `overscan`, it also sizes the server-rendered first slice. */
92
92
  estimateItemHeight?: number;
93
93
  /** Rows rendered beyond the visible window on each side. The buffer keeps the active row mounted for `aria-activedescendant`. */
94
94
  overscan?: number;
@@ -98,7 +98,7 @@ type VirtualRootProps = ListRootProps$1 & {
98
98
  /**
99
99
  * Props for `List.Root` — the internal list primitive's `Root` props, minus
100
100
  * `semantics` (a `List` is always a `role="list"`) and the grid-only
101
- * `onActivate` / `itemId` knobs (inert under list semantics).
101
+ * `onActivate` / `itemId` / `isItemDisabled` knobs (inert under list semantics).
102
102
  *
103
103
  * @see https://mantle.ngrok.com/components/data-display/list
104
104
  *
@@ -116,7 +116,7 @@ type ListRootProps = Omit<ListRootProps$1, "semantics" | "onActivate" | "itemId"
116
116
  /**
117
117
  * The scrollable container for a `List`: a `role="list"` of clickable items
118
118
  * inside the bordered, rounded `bg-popover` viewport (styled after the
119
- * `MultiSelect` popover). Renders **every** item the non-virtualized default.
119
+ * `MultiSelect` popover). Renders **every** item, the non-virtualized default.
120
120
  * Compose `List.Item` children directly. **Bound its height**
121
121
  * (`max-h-*`, `h-*`, or `min-h-0 flex-1`) so long lists scroll.
122
122
  *
@@ -125,7 +125,7 @@ type ListRootProps = Omit<ListRootProps$1, "semantics" | "onActivate" | "itemId"
125
125
  * focused item lights up with the hover tint rather than a focus ring.
126
126
  *
127
127
  * For very long lists, swap in `List.VirtualRoot`, which windows the same
128
- * `Item` children the call site is otherwise identical.
128
+ * `Item` children; the call site is otherwise identical.
129
129
  *
130
130
  * @see https://mantle.ngrok.com/components/data-display/list
131
131
  *
@@ -145,7 +145,8 @@ declare const Root: (props: ListRootProps) => import("react").JSX.Element;
145
145
  /**
146
146
  * Props for `List.VirtualRoot` — the internal list primitive's
147
147
  * `VirtualRoot` props (viewport props plus `estimateItemHeight` / `overscan`),
148
- * minus `semantics` and the grid-only `onActivate` / `itemId` knobs.
148
+ * minus `semantics` and the grid-only `onActivate` / `itemId` / `isItemDisabled`
149
+ * knobs.
149
150
  *
150
151
  * @see https://mantle.ngrok.com/components/data-display/list
151
152
  *
@@ -163,10 +164,12 @@ type ListVirtualRootProps = Omit<VirtualRootProps, "semantics" | "onActivate" |
163
164
  /**
164
165
  * The windowed counterpart to `List.Root`: renders only the visible slice
165
166
  * of its `List.Item` children via `@tanstack/react-virtual`. Authored
166
- * identically to `Root` same `Item` children so opting into
167
+ * identically to `Root` (same `Item` children), so opting into
167
168
  * virtualization never changes the call site. Reach for it only when a list is
168
169
  * long enough to need it; **bound its height** so the virtualizer has a
169
- * viewport to measure.
170
+ * viewport to measure. The server renders the first slice of rows, sized by
171
+ * `estimateItemHeight` and `overscan`. The rest mount after hydration
172
+ * measures the viewport.
170
173
  *
171
174
  * @see https://mantle.ngrok.com/components/data-display/list
172
175
  *
@@ -210,7 +213,7 @@ type ListItemProps = Omit<ComponentProps<"button">, "type"> & WithAsChild & {
210
213
  /**
211
214
  * A single clickable item in a `List`. Sits inside a `role="listitem"` pill
212
215
  * from the internal list primitive; renders a `<button>` by default (with
213
- * `onClick`), or your own element via `asChild` e.g. an `<a>` for navigation
216
+ * `onClick`), or your own element via `asChild`, for example an `<a>` for navigation
214
217
  * (account switching, SSO selection). The button/link fills its pill, so
215
218
  * clicking anywhere on the item triggers it, and the enclosing listitem carries
216
219
  * the pill's hover / `current` accent.
@@ -327,8 +330,18 @@ declare const ItemDescription: ({ className, ref, ...props }: ComponentProps<"sp
327
330
  */
328
331
  declare const List: {
329
332
  /**
330
- * The scrollable container (non-virtualized). Give it an `aria-label` and
331
- * bound its height. Compose `Item` children.
333
+ * The scrollable container for a `List`: a `role="list"` of clickable items
334
+ * inside the bordered, rounded `bg-popover` viewport (styled after the
335
+ * `MultiSelect` popover). Renders **every** item, the non-virtualized default.
336
+ * Compose `List.Item` children directly. **Bound its height**
337
+ * (`max-h-*`, `h-*`, or `min-h-0 flex-1`) so long lists scroll.
338
+ *
339
+ * Keyboard: items keep their native tab order, and `ArrowUp` / `ArrowDown` /
340
+ * `Home` / `End` also move focus between items (skipping disabled ones); the
341
+ * focused item lights up with the hover tint rather than a focus ring.
342
+ *
343
+ * For very long lists, swap in `List.VirtualRoot`, which windows the same
344
+ * `Item` children; the call site is otherwise identical.
332
345
  *
333
346
  * @see https://mantle.ngrok.com/components/data-display/list
334
347
  *
@@ -346,8 +359,14 @@ declare const List: {
346
359
  */
347
360
  readonly Root: typeof Root;
348
361
  /**
349
- * The virtualized container windows the same `Item` children. Opt in for
350
- * long lists; authored identically to `Root`.
362
+ * The windowed counterpart to `List.Root`: renders only the visible slice
363
+ * of its `List.Item` children via `@tanstack/react-virtual`. Authored
364
+ * identically to `Root` (same `Item` children), so opting into
365
+ * virtualization never changes the call site. Reach for it only when a list is
366
+ * long enough to need it; **bound its height** so the virtualizer has a
367
+ * viewport to measure. The server renders the first slice of rows, sized by
368
+ * `estimateItemHeight` and `overscan`. The rest mount after hydration
369
+ * measures the viewport.
351
370
  *
352
371
  * @see https://mantle.ngrok.com/components/data-display/list
353
372
  *
@@ -365,8 +384,12 @@ declare const List: {
365
384
  */
366
385
  readonly VirtualRoot: typeof VirtualRoot;
367
386
  /**
368
- * A clickable item a `<button>` by default, or your own element via
369
- * `asChild` (e.g. an `<a>`). Optional `current` gives the accent treatment.
387
+ * A single clickable item in a `List`. Sits inside a `role="listitem"` pill
388
+ * from the internal list primitive; renders a `<button>` by default (with
389
+ * `onClick`), or your own element via `asChild`, for example an `<a>` for navigation
390
+ * (account switching, SSO selection). The button/link fills its pill, so
391
+ * clicking anywhere on the item triggers it, and the enclosing listitem carries
392
+ * the pill's hover / `current` accent.
370
393
  *
371
394
  * @see https://mantle.ngrok.com/components/data-display/list
372
395
  *
package/dist/list.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-CxM7jdFi.js";import{n,r,t as i}from"./list-7w5k3HiN.js";import{jsx as a}from"react/jsx-runtime";const o={Root:e=>a(r,{semantics:`list`,...e}),VirtualRoot:e=>a(i,{semantics:`list`,...e}),Item:({asChild:r,className:i,current:o,disabled:s,onClick:c,ref:l,...u})=>a(n,{selected:o,disabled:s,children:a(r?t:`button`,{ref:l,"data-slot":`list-item-control`,"aria-current":o||void 0,...r?{"aria-disabled":s||void 0,tabIndex:s?-1:void 0}:{type:`button`,disabled:s},onClick:e=>{if(r&&s){e.preventDefault(),e.stopPropagation();return}c?.(e)},className:e(`flex w-full cursor-pointer flex-col gap-0.5 rounded-md bg-transparent px-2 py-1.5 text-left text-sm`,`disabled:cursor-default disabled:opacity-50 aria-disabled:cursor-default aria-disabled:opacity-50 aria-disabled:pointer-events-none`,`focus-visible:outline-hidden`,i),...u,onClickCapture:r&&s?e=>{e.preventDefault(),e.stopPropagation()}:u.onClickCapture})}),ItemTitle:({className:t,ref:n,...r})=>a(`span`,{ref:n,"data-slot":`list-item-title`,className:e(`text-strong font-medium`,t),...r}),ItemDescription:({className:t,ref:n,...r})=>a(`span`,{ref:n,"data-slot":`list-item-description`,className:e(`text-body leading-4`,t),...r})};export{o as List};
1
+ import{t as e}from"./cx-0HCjnNv1.js";import{t}from"./slot-C3gII_9c.js";import{n,r,t as i}from"./list-Bo1mExIg.js";import{jsx as a}from"react/jsx-runtime";const o={Root:e=>a(r,{semantics:`list`,...e}),VirtualRoot:e=>a(i,{semantics:`list`,...e}),Item:({asChild:r,className:i,current:o,disabled:s,onClick:c,ref:l,...u})=>a(n,{selected:o,disabled:s,children:a(r?t:`button`,{ref:l,"data-slot":`list-item-control`,"aria-current":o||void 0,...r?{"aria-disabled":s||void 0,tabIndex:s?-1:void 0}:{type:`button`,disabled:s},onClick:e=>{if(r&&s){e.preventDefault(),e.stopPropagation();return}c?.(e)},className:e(`flex w-full cursor-pointer flex-col gap-0.5 rounded-md bg-transparent px-2 py-1.5 text-left text-sm`,`disabled:cursor-default disabled:opacity-50 aria-disabled:cursor-default aria-disabled:opacity-50 aria-disabled:pointer-events-none`,`focus-visible:outline-hidden`,i),...u,onClickCapture:r&&s?e=>{e.preventDefault(),e.stopPropagation()}:u.onClickCapture})}),ItemTitle:({className:t,ref:n,...r})=>a(`span`,{ref:n,"data-slot":`list-item-title`,className:e(`text-strong font-medium`,t),...r}),ItemDescription:({className:t,ref:n,...r})=>a(`span`,{ref:n,"data-slot":`list-item-description`,className:e(`text-body leading-4`,t),...r})};export{o as List};
@@ -0,0 +1 @@
1
+ import{t as e}from"./cx-0HCjnNv1.js";import{t}from"./slot-C3gII_9c.js";import{jsx as n}from"react/jsx-runtime";const r=({asChild:r,className:i,politeness:a=`polite`,ref:o,...s})=>n(r?t:`span`,{ref:o,"data-slot":`live-region`,role:a===`assertive`?`alert`:`status`,"aria-live":a===`assertive`?void 0:`polite`,"aria-atomic":`true`,className:e(`sr-only`,i),...s});export{r as t};
@@ -1 +1 @@
1
- import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-CxM7jdFi.js";import{jsx as n}from"react/jsx-runtime";const r=({asChild:r,className:i,politeness:a=`polite`,ref:o,...s})=>n(r?t:`span`,{ref:o,"data-slot":`live-region`,role:a===`assertive`?`alert`:`status`,"aria-live":a===`assertive`?void 0:`polite`,"aria-atomic":`true`,className:e(`sr-only`,i),...s});export{r as LiveRegion};
1
+ import{t as e}from"./live-region-CV7kykeo.js";export{e as LiveRegion};
package/dist/llms.txt CHANGED
@@ -1,4 +1,4 @@
1
- # @ngrok/mantle (0.84.1)
1
+ # @ngrok/mantle (0.84.2)
2
2
 
3
3
  > Offline discovery hint shipped inside the @ngrok/mantle npm package. Authoritative metadata lives at https://mantle.ngrok.com/for-ai-agents.
4
4
 
package/dist/main.d.ts CHANGED
@@ -8,7 +8,9 @@ import { ComponentProps } from "react";
8
8
  * a visible focus ring on the region itself (`focus:outline-hidden`).
9
9
  *
10
10
  * Pair with the `<SkipToMainLink>` component at the top of the document.
11
- * `ref` lands on the rendered `<main>`, so it also composes as an `asChild`
11
+ * `id` and `tabIndex` are not props: the skip link's default target is
12
+ * `#main`, and a focusable landmark needs `tabIndex={-1}`, so `Main` stamps
13
+ * both. `ref` lands on the rendered `<main>`, so it also composes as an `asChild`
12
14
  * child of layout parts — in an app shell, compose it onto `AppLayout.Body`
13
15
  * (`<AppLayout.Body asChild>`), never onto the `AppLayout.Content` card around
14
16
  * it. `AppLayout.Body` is the shell's only scroll container, and the skip link
@@ -53,6 +55,6 @@ import { ComponentProps } from "react";
53
55
  * </Sidebar.Root>
54
56
  * ```
55
57
  */
56
- declare const Main: ({ className, "data-slot": dataSlot, ...props }: ComponentProps<"main"> & WithDataSlot) => import("react").JSX.Element;
58
+ declare const Main: ({ className, "data-slot": dataSlot, ...props }: Omit<ComponentProps<"main">, "id" | "tabIndex"> & WithDataSlot) => import("react").JSX.Element;
57
59
  //#endregion
58
60
  export { Main };
package/dist/main.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./data-slot-EM6s2WEU.js";import{jsx as n}from"react/jsx-runtime";const r=({className:r,"data-slot":i,...a})=>n(`main`,{...a,"data-slot":t(i,`main`),id:`main`,tabIndex:-1,className:e(`focus:outline-hidden`,r)});export{r as Main};
1
+ import{t as e}from"./cx-0HCjnNv1.js";import{t}from"./data-slot-EM6s2WEU.js";import{jsx as n}from"react/jsx-runtime";const r=({className:r,"data-slot":i,...a})=>n(`main`,{...a,"data-slot":t(i,`main`),id:`main`,tabIndex:-1,className:e(`focus:outline-hidden`,r)});export{r as Main};
@@ -1,7 +1,8 @@
1
1
  import { n as WithAsChild } from "./as-child-D23mGo4f.js";
2
+ import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
2
3
  import { ComponentProps } from "react";
3
4
  //#region src/components/media-object/media-object.d.ts
4
- type Props = ComponentProps<"div"> & WithAsChild;
5
+ type Props = ComponentProps<"div"> & WithAsChild & WithDataSlot;
5
6
  /**
6
7
  * The media object is an image/icon (media) to the left, with descriptive
7
8
  * content (title and subtitle/description) to the right. This is the root
@@ -21,7 +22,7 @@ type Props = ComponentProps<"div"> & WithAsChild;
21
22
  * </MediaObject.Root>
22
23
  * ```
23
24
  */
24
- declare const Root: ({ asChild, className, children, style, ref }: Props) => import("react").JSX.Element;
25
+ declare const Root: ({ asChild, className, children, "data-slot": dataSlot, ref, ...props }: Props) => import("react").JSX.Element;
25
26
  /**
26
27
  * The container for an image or icon to display in the media slot of the media object.
27
28
  *
@@ -39,7 +40,7 @@ declare const Root: ({ asChild, className, children, style, ref }: Props) => imp
39
40
  * </MediaObject.Root>
40
41
  * ```
41
42
  */
42
- declare const Media: ({ asChild, className, children, style, ref }: Props) => import("react").JSX.Element;
43
+ declare const Media: ({ asChild, className, children, "data-slot": dataSlot, ref, ...props }: Props) => import("react").JSX.Element;
43
44
  /**
44
45
  * The container for the content slot of a media object.
45
46
  *
@@ -57,7 +58,7 @@ declare const Media: ({ asChild, className, children, style, ref }: Props) => im
57
58
  * </MediaObject.Root>
58
59
  * ```
59
60
  */
60
- declare const Content: ({ asChild, className, children, style, ref }: Props) => import("react").JSX.Element;
61
+ declare const Content: ({ asChild, className, children, "data-slot": dataSlot, ref, ...props }: Props) => import("react").JSX.Element;
61
62
  /**
62
63
  * A small, reusable layout primitive for "image/icon on one side,
63
64
  * descriptive content on the other" — the foundational
@@ -119,14 +120,6 @@ declare const MediaObject: {
119
120
  * content (title and subtitle/description) to the right. This is the root
120
121
  * component of the media object.
121
122
  *
122
- * Change the spacing between the media and content by passing a `gap-*` class.
123
- * The default gap is `gap-4`.
124
- *
125
- * Use flexbox utilities to change the alignment of the media and content.
126
- *
127
- * Compose the media object with the `MediaObject.Media` and `MediaObject.Content`
128
- * components as direct children.
129
- *
130
123
  * @see https://mantle.ngrok.com/components/structure/media-object#mediaobjectroot
131
124
  *
132
125
  * @example
@@ -1 +1 @@
1
- import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-CxM7jdFi.js";import{jsx as n}from"react/jsx-runtime";const r={Root:({asChild:r=!1,className:i,children:a,style:o,ref:s})=>n(r?t:`div`,{ref:s,"data-slot":`media-object`,className:e(`flex gap-4`,i),style:o,children:a}),Media:({asChild:r=!1,className:i,children:a,style:o,ref:s})=>n(r?t:`div`,{ref:s,"data-slot":`media-object-media`,className:e(`shrink-0 leading-none`,i),style:o,children:a}),Content:({asChild:r=!1,className:i,children:a,style:o,ref:s})=>n(r?t:`div`,{ref:s,"data-slot":`media-object-content`,className:e(`min-w-0 flex-1`,i),style:o,children:a})};export{r as MediaObject};
1
+ import{t as e}from"./cx-0HCjnNv1.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./slot-C3gII_9c.js";import{jsx as r}from"react/jsx-runtime";const i={Root:({asChild:i=!1,className:a,children:o,"data-slot":s,ref:c,...l})=>r(i?n:`div`,{ref:c,"data-slot":t(s,`media-object`),className:e(`flex gap-4`,a),...l,children:o}),Media:({asChild:i=!1,className:a,children:o,"data-slot":s,ref:c,...l})=>r(i?n:`div`,{ref:c,"data-slot":t(s,`media-object-media`),className:e(`shrink-0 leading-none`,a),...l,children:o}),Content:({asChild:i=!1,className:a,children:o,"data-slot":s,ref:c,...l})=>r(i?n:`div`,{ref:c,"data-slot":t(s,`media-object-content`),className:e(`min-w-0 flex-1`,a),...l,children:o})};export{i as MediaObject};
@@ -1,6 +1,6 @@
1
1
  import { n as WithAsChild } from "./as-child-D23mGo4f.js";
2
2
  import { o as WithValidation } from "./field-7QeiTFwl.js";
3
- import { n as Separator } from "./separator-CNDs98Dv.js";
3
+ import { n as Separator } from "./separator-Bo4nY_3M.js";
4
4
  import { ComponentProps, ReactNode } from "react";
5
5
  import * as Primitive from "@ariakit/react";
6
6
  //#region src/components/multi-select/multi-select.d.ts
@@ -47,7 +47,10 @@ declare const Root: ({ children, defaultSelectedValue, ...props }: MultiSelectPr
47
47
  type MultiSelectTriggerProps = ComponentProps<"div"> & WithValidation;
48
48
  /**
49
49
  * The trigger container for the multi-select. Wraps the input and selected
50
- * value tags in a styled container that looks like a form input.
50
+ * value tags in a styled container that looks like a form input. It is
51
+ * `role="presentation"`: the `MultiSelect.Input` combobox and the
52
+ * `MultiSelect.TagValues` list carry the semantics, and the input's label
53
+ * (`Field.Label` or `aria-label`) names the whole control.
51
54
  *
52
55
  * @see https://mantle.ngrok.com/components/forms/multi-select#multiselecttrigger
53
56
  *
@@ -71,7 +74,8 @@ type TagProps = Omit<ComponentProps<"span">, "children"> & {
71
74
  */
72
75
  value: string;
73
76
  /**
74
- * Called when the remove button is clicked.
77
+ * Called when the remove button is clicked. `MultiSelect.TagValues` passes
78
+ * one through its render props that removes the value from the selection.
75
79
  */
76
80
  onRemove?: () => void;
77
81
  /**
@@ -82,11 +86,22 @@ type TagProps = Omit<ComponentProps<"span">, "children"> & {
82
86
  };
83
87
  /**
84
88
  * The default tag rendered inside `MultiSelect.TagValues` for each selected value.
85
- * Displays the value label with a remove button and full keyboard navigation support.
89
+ * Displays the value label with a remove button. Renders a `role="listitem"`
90
+ * inside the `role="list"` that `MultiSelect.TagValues` renders, and marks
91
+ * itself `data-active` while it has focus.
92
+ *
93
+ * Arrow-key navigation and Backspace/Delete removal come from the
94
+ * `MultiSelect.TagValues` render props; spread them onto the tag to get them.
95
+ * On its own, `Tag` only blocks Backspace and Delete on a locked tag.
86
96
  *
87
97
  * Use this when building a custom `TagValues`-like component and you want the
88
98
  * default tag chrome with consistent styling.
89
99
  *
100
+ * | Data Attribute | Value | Description |
101
+ * | --- | --- | --- |
102
+ * | `data-active` | present while focused | The tag that keyboard navigation is on. |
103
+ * | `data-locked` | present when `locked` | The tag cannot be removed. |
104
+ *
90
105
  * @see https://mantle.ngrok.com/components/forms/multi-select#multiselecttag
91
106
  *
92
107
  * @example
@@ -104,7 +119,7 @@ type TagProps = Omit<ComponentProps<"span">, "children"> & {
104
119
  * </MultiSelect.Root>
105
120
  * ```
106
121
  */
107
- declare const Tag: ({ className, value, onRemove, locked, onKeyDown, ref, ...props }: TagProps) => import("react").JSX.Element;
122
+ declare const Tag: ({ className, value, onRemove, locked, onBlur, onFocus, onKeyDown, ref, ...props }: TagProps) => import("react").JSX.Element;
108
123
  /**
109
124
  * Props passed to the children render function of `MultiSelect.TagValues`.
110
125
  * Spread these onto `MultiSelect.Tag` (or your own tag component) to
@@ -120,6 +135,12 @@ type TagRenderProps = TagProps & {
120
135
  ref: (node: HTMLSpanElement | null) => void;
121
136
  };
122
137
  type MultiSelectTagValuesProps = {
138
+ /**
139
+ * The accessible name of the tag list.
140
+ *
141
+ * @default "Selected values"
142
+ */
143
+ "aria-label"?: string;
123
144
  /**
124
145
  * Values that cannot be removed. Locked tags have their remove button disabled,
125
146
  * respond to Backspace/Delete key presses with a shake animation, and shake when
@@ -130,9 +151,10 @@ type MultiSelectTagValuesProps = {
130
151
  */
131
152
  lockedValues?: string[];
132
153
  /**
133
- * Optional render function for each tag. Receives `{ value, onRemove, locked, ref }` —
134
- * spread these onto `MultiSelect.Tag` (or your own element) for full keyboard-nav support.
154
+ * Optional render function for each tag. Receives `{ value, onRemove, locked, ref, onKeyDown, onClick }`.
155
+ * Spread these onto `MultiSelect.Tag` (or your own element) for full keyboard-nav support.
135
156
  * When omitted, the default `MultiSelect.Tag` is rendered for each selected value.
157
+ * A custom tag must be a `role="listitem"`: the tags render inside a `role="list"`.
136
158
  *
137
159
  * @example
138
160
  * ```tsx
@@ -149,6 +171,10 @@ type MultiSelectTagValuesProps = {
149
171
  * Renders the selected values as removable tags. Place this inside
150
172
  * `MultiSelect.Trigger`, followed by `MultiSelect.Input`.
151
173
  *
174
+ * The tags render inside a `role="list"` named "Selected values" (override it
175
+ * with `aria-label`), and each default tag is a `role="listitem"`. The list
176
+ * uses `display: contents`, so the tags keep the trigger's flex layout.
177
+ *
152
178
  * @see https://mantle.ngrok.com/components/forms/multi-select#multiselecttagvalues
153
179
  *
154
180
  * @example
@@ -164,7 +190,7 @@ type MultiSelectTagValuesProps = {
164
190
  * </MultiSelect.Root>
165
191
  * ```
166
192
  */
167
- declare const TagValues: ({ children, lockedValues }: MultiSelectTagValuesProps) => import("react").JSX.Element;
193
+ declare const TagValues: ({ "aria-label": ariaLabel, children, lockedValues }: MultiSelectTagValuesProps) => import("react").JSX.Element | null;
168
194
  type MultiSelectInputProps = Omit<Primitive.ComboboxProps, "render"> & {
169
195
  /**
170
196
  * Called with the raw string value whenever the input text changes.
@@ -489,8 +515,11 @@ declare const MultiSelect: {
489
515
  */
490
516
  readonly Root: typeof Root;
491
517
  /**
492
- * The trigger container for the multi-select. Wraps the tags and input
493
- * in a styled container.
518
+ * The trigger container for the multi-select. Wraps the input and selected
519
+ * value tags in a styled container that looks like a form input. It is
520
+ * `role="presentation"`: the `MultiSelect.Input` combobox and the
521
+ * `MultiSelect.TagValues` list carry the semantics, and the input's label
522
+ * (`Field.Label` or `aria-label`) names the whole control.
494
523
  *
495
524
  * @see https://mantle.ngrok.com/components/forms/multi-select#multiselecttrigger
496
525
  *
@@ -512,8 +541,9 @@ declare const MultiSelect: {
512
541
  * Renders the selected values as removable tags. Place this inside
513
542
  * `MultiSelect.Trigger`, followed by `MultiSelect.Input`.
514
543
  *
515
- * Use `lockedValues` to prevent specific tags from being removed. Locked tags
516
- * have their remove button disabled and shake when Backspace is pressed.
544
+ * The tags render inside a `role="list"` named "Selected values" (override it
545
+ * with `aria-label`), and each default tag is a `role="listitem"`. The list
546
+ * uses `display: contents`, so the tags keep the trigger's flex layout.
517
547
  *
518
548
  * @see https://mantle.ngrok.com/components/forms/multi-select#multiselecttagvalues
519
549
  *
@@ -569,7 +599,9 @@ declare const MultiSelect: {
569
599
  readonly Input: typeof Input;
570
600
  /**
571
601
  * The default tag rendered inside `MultiSelect.TagValues` for each selected value.
572
- * Displays the value label with a remove button and keyboard navigation support.
602
+ * Displays the value label with a remove button. Renders a `role="listitem"`
603
+ * inside the `role="list"` that `MultiSelect.TagValues` renders, and marks
604
+ * itself `data-active` while it has focus.
573
605
  *
574
606
  * @see https://mantle.ngrok.com/components/forms/multi-select#multiselecttag
575
607
  *
@@ -1 +1 @@
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-CxM7jdFi.js";import{r as i}from"./layer-container-CglTh9-6.js";import{a,r as o}from"./field-Bpptk_9t.js";import{t as s}from"./field-B1wqeZr4.js";import{n as c}from"./separator-D1K7DSTv.js";import{t as l}from"./use-prefers-reduced-motion-Bk5zAfHY.js";import{createContext as u,useCallback as d,useContext as f,useEffect as p,useMemo as m,useRef as h,useState as g}from"react";import{Fragment as _,jsx as v,jsxs as y}from"react/jsx-runtime";import{XIcon as b}from"@phosphor-icons/react/X";import{CheckIcon as x}from"@phosphor-icons/react/Check";import*as S from"@ariakit/react";import{LockIcon as C}from"@phosphor-icons/react/Lock";const w=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),T=[],E=u({current:null}),D=u({current:[]}),O=u({onInputKeyDownRef:{current:void 0},inputRef:{current:null}}),k=({children:e,defaultSelectedValue:t=T,...n})=>{let r=h(null),i=h(void 0),a=h(null),o=h([]),s=m(()=>({onInputKeyDownRef:i,inputRef:a}),[]);return v(E.Provider,{value:r,children:v(O.Provider,{value:s,children:v(D.Provider,{value:o,children:v(S.ComboboxProvider,{defaultSelectedValue:t,...n,children:e})})})})},A=({"aria-invalid":n,className:r,children:i,onKeyDown:s,onMouseDown:c,ref:l,validation:u,...d})=>{let p=f(E),{inputRef:m}=f(O),h=S.useComboboxContext(),g=a(),{validation:_}=o({"aria-invalid":n,validation:u??g});return v(`div`,{role:`group`,"data-slot":`multi-select-trigger`,className:t(`cursor-text select-none font-sans text-sm`,`border-form bg-form text-strong flex min-h-9 w-full flex-wrap items-center gap-1 rounded-md border px-3 py-1 has-[[data-slot=multi-select-tag]]:px-1`,`has-focus:outline-hidden has-focus-within:ring-4 has-aria-expanded:ring-4`,`has-focus-within:border-accent-600 has-focus-within:ring-focus-accent has-aria-expanded:border-accent-600 has-aria-expanded:ring-focus-accent`,`data-validation-success:border-success-600 data-validation-success:has-focus-within:border-success-600 data-validation-success:has-focus-within:ring-focus-success data-validation-success:has-aria-expanded:border-success-600 data-validation-success:has-aria-expanded:ring-focus-success`,`data-validation-warning:border-warning-600 data-validation-warning:has-focus-within:border-warning-600 data-validation-warning:has-focus-within:ring-focus-warning data-validation-warning:has-aria-expanded:border-warning-600 data-validation-warning:has-aria-expanded:ring-focus-warning`,`data-validation-error:border-danger-600 data-validation-error:has-focus-within:border-danger-600 data-validation-error:has-focus-within:ring-focus-danger data-validation-error:has-aria-expanded:border-danger-600 data-validation-error:has-aria-expanded:ring-focus-danger`,r),"data-validation":_||void 0,onKeyDown:e=>{e.key===`Escape`&&h?.getState().open&&(e.preventDefault(),h.hide()),s?.(e)},onMouseDown:e=>{e.target instanceof HTMLElement&&!e.target.closest(`button, input, [role='option']`)&&(e.preventDefault(),m.current?.focus()),c?.(e)},ref:e(p,l),...d,children:i})},j=({className:r,value:i,onRemove:a,locked:o=!1,onKeyDown:s,ref:c,...l})=>{let u=h(null);return y(`span`,{ref:e(u,c),role:`option`,"aria-selected":!0,tabIndex:-1,"data-slot":`multi-select-tag`,"data-locked":o||void 0,className:t(`cursor-default bg-neutral-500/10 border border-neutral-500/20 rounded-xs text-strong inline-flex items-center gap-1 pl-2 pr-0.5 py-0.5 text-sm font-normal`,`focus-visible:outline-hidden focus-visible:border-accent-600/50 focus-visible:ring-3 focus-visible:ring-focus-accent`,r),onKeyDown:e=>{if(o&&(e.key===`Backspace`||e.key===`Delete`)){e.preventDefault(),N(e.currentTarget);return}s?.(e)},...l,children:[i,v(`button`,{type:`button`,"aria-label":`Remove ${i}`,tabIndex:-1,"aria-disabled":o||void 0,className:t(`cursor-pointer text-strong/40 hover:bg-neutral-500/15 hover:text-strong rounded-xs p-0.5`,`aria-disabled:cursor-default aria-disabled:hover:bg-transparent aria-disabled:hover:text-strong/40`),onClick:e=>{if(e.stopPropagation(),o){let e=u.current;e&&N(e);return}a?.()},onMouseDown:e=>{e.preventDefault()},children:v(n,{svg:o?v(C,{}):v(b,{weight:`bold`}),className:`size-4`})})]})},M={Root:k,Trigger:A,TagValues:({children:e,lockedValues:t=T})=>{let n=S.useComboboxContext(),r=S.useStoreState(n,`selectedValue`),i=(w(r)?r:void 0)??T,a=h(i);a.current=i;let o=f(D);o.current=t;let s=m(()=>new Set(t),[t]),c=h(new Map),{onInputKeyDownRef:l,inputRef:u}=f(O),d=h(new Set);p(()=>()=>{d.current.forEach(cancelAnimationFrame)},[]);let g=e=>{let t=requestAnimationFrame(()=>{d.current.delete(t),e()});d.current.add(t)},y=e=>{if(n){let t=n.getState().selectedValue;if(!w(t))return;n.setSelectedValue(t.filter(t=>t!==e))}},b=e=>{let t=a.current[e];if(t==null)return;let r=c.current.get(t);r&&(r.focus(),n?.show())},x=()=>{u.current?.focus()},C=(e,t)=>{let n=i[t];switch(e.key){case`ArrowLeft`:e.preventDefault(),t>0&&b(t-1);break;case`ArrowRight`:e.preventDefault(),t<i.length-1?b(t+1):x();break;case`Backspace`:case`Delete`:if(e.preventDefault(),n!=null){if(s.has(n)){let e=c.current.get(n);e&&N(e);break}if(y(n),e.key===`Backspace`){if(t>0){let e=t-1;g(()=>b(e))}else g(()=>{a.current.length>0?b(0):x()})}else g(()=>{t<a.current.length?b(t):x()})}break;case`ArrowUp`:case`ArrowDown`:e.preventDefault(),x(),u.current?.dispatchEvent(new KeyboardEvent(`keydown`,{key:e.key,bubbles:!0,cancelable:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey}));break;default:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&x()}};return l.current=e=>{if(e.key===`ArrowLeft`&&e.currentTarget.selectionStart===0&&e.currentTarget.selectionEnd===0&&i.length>0){e.preventDefault(),b(i.length-1);return}if(e.key===`Backspace`&&e.currentTarget.value===``&&i.length>0){let e=i[i.length-1];if(e!=null){if(o.current.includes(e)){let t=c.current.get(e);t&&N(t)}else y(e)}}},v(_,{children:i.map((t,n)=>{let r={value:t,locked:s.has(t),onRemove:()=>{if(s.has(t)){let e=c.current.get(t);e&&N(e);return}y(t)},ref:e=>{e?c.current.set(t,e):c.current.delete(t)},onKeyDown:e=>C(e,n),onClick:()=>b(n)};return e?e(r):v(j,{...r},t)})})},Input:({className:n,onBlur:r,onChange:i,onFocus:a,onKeyDown:o,onValueChange:c,placeholder:l,ref:u,...d})=>{let p=S.useComboboxContext(),{onInputKeyDownRef:m,inputRef:h}=f(O),g=f(s),_=S.useStoreState(p,`selectedValue`),y=((w(_)?_:void 0)?.length??0)>0;return v(S.Combobox,{autoSelect:!0,"data-slot":`multi-select-input`,className:t(`pointer-coarse:text-base min-w-20 flex-1 select-text border-0 bg-transparent text-sm outline-hidden`,`placeholder:select-none placeholder:text-placeholder`,n),onChange:e=>{c?.(e.target.value),i?.(e)},onKeyDown:e=>{m.current?.(e),o?.(e)},onBlur:e=>{e.relatedTarget instanceof HTMLElement&&e.relatedTarget.closest(`[data-slot="multi-select-tag"]`)&&p?.show(),r?.(e)},onFocus:e=>{p?.show(),a?.(e)},placeholder:y?void 0:l,ref:e(h,u),...d,...g?{"aria-describedby":g[`aria-describedby`],"aria-errormessage":g[`aria-errormessage`],"aria-invalid":g[`aria-invalid`],id:g.id,name:g.name}:void 0})},Tag:j,Content:({asChild:e=!1,backdrop:n=!1,children:a,className:o,modal:s=!0,portalElement:c,preventBodyScroll:l,ref:u,sameWidth:m=!0,unmountOnHide:h=!0,..._})=>{let y=f(E),b=i(),[x,C]=g(!1);p(()=>{C(y.current?.closest(`[data-mantle-modal-content]`)!=null)},[y]);let w=x||b!=null,T=d(()=>y.current?.getBoundingClientRect()??null,[y]),D=d(e=>typeof c==`function`?c(e):c??y.current?.closest(`[data-mantle-modal-content]`)??(b instanceof HTMLElement?b:null)??e.ownerDocument.body,[b,c,y]),O=d(e=>!(e.target instanceof Node&&y.current?.contains(e.target)),[y]);return v(S.ComboboxPopover,{"data-slot":`multi-select-content`,className:t(`border-popover bg-popover relative z-50 max-h-96 min-w-32 scrollbar overflow-y-scroll overflow-x-hidden overscroll-y-none rounded-md border shadow-md pt-1 pb-1 has-data-content-footer:pb-0 font-sans flex flex-col gap-px focus:outline-hidden`,o),backdrop:n,getAnchorRect:T,gutter:4,hideOnInteractOutside:O,modal:s,portalElement:D,preventBodyScroll:l??!w,ref:u,render:e?({ref:e,...t})=>v(r,{ref:e,...t}):void 0,sameWidth:m,unmountOnHide:h,..._,children:a})},ContentFooter:({className:e,children:n,ref:r,...i})=>v(`div`,{ref:r,"data-slot":`multi-select-content-footer`,"data-content-footer":!0,className:t(`bg-popover sticky bottom-0 border-t border-popover`,e),...i,children:n}),Item:({asChild:e=!1,children:i,className:a,focusOnHover:o=!0,value:s,onClick:c,ref:l,...u})=>{let d=f(D),p=s!=null&&d.current.includes(s);return y(S.ComboboxItem,{"data-slot":`multi-select-item`,className:t(`relative mx-1 cursor-pointer rounded-md pl-2 pr-8 py-1.5 text-strong text-sm font-normal flex min-w-0 items-center gap-2`,`[[role=option]+&]:mt-px`,`data-active-item:bg-active-menu-item`,`aria-disabled:opacity-50`,`aria-selected:bg-selected-menu-item aria-selected:data-active-item:bg-active-selected-menu-item`,a),focusOnHover:o,onClick:e=>{if(p){e.preventDefault();return}c?.(e)},ref:l,render:e?({ref:e,...t})=>v(r,{ref:e,...t}):void 0,resetValueOnSelect:!0,value:s,...u,children:[i,v(S.ComboboxItemCheck,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:v(n,{svg:v(x,{weight:`bold`}),className:`size-4 text-accent-600`})})]})},Group:({asChild:e=!1,children:t,ref:n,...i})=>v(S.ComboboxGroup,{"data-slot":`multi-select-group`,className:`mx-1`,ref:n,render:e?({ref:e,...t})=>v(r,{ref:e,...t}):void 0,...i,children:t}),GroupLabel:({asChild:e=!1,children:n,className:i,ref:a,...o})=>v(S.ComboboxGroupLabel,{"data-slot":`multi-select-group-label`,className:t(`text-muted px-2 py-1 text-xs font-medium`,i),ref:a,render:e?({ref:e,...t})=>v(r,{ref:e,...t}):void 0,...o,children:n}),GroupDescription:({className:e,children:n,ref:r,...i})=>v(`p`,{"data-slot":`multi-select-group-description`,className:t(`text-muted px-2 pb-1 text-xs`,e),ref:r,...i,children:n}),Separator:({className:e,ref:n,...r})=>v(c,{"data-slot":`multi-select-separator`,ref:n,className:t(`my-1 w-auto`,e),...r}),Empty:({className:e,children:n,ref:r,...i})=>v(`div`,{"data-slot":`multi-select-empty`,className:t(`mx-1 text-muted px-2 py-6 text-center text-sm`,e),ref:r,role:`presentation`,...i,children:n})};function N(e){l()||e.animate([{transform:`translateX(0)`},{transform:`translateX(-4px)`},{transform:`translateX(4px)`},{transform:`translateX(-4px)`},{transform:`translateX(4px)`},{transform:`translateX(0)`}],{duration:300,easing:`ease-in-out`})}export{M as MultiSelect};
1
+ import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{t}from"./compose-refs-DdUwopIY.js";import{t as n}from"./cx-0HCjnNv1.js";import{t as r}from"./icon-CGKaq_tV.js";import{t as i}from"./slot-C3gII_9c.js";import{r as a}from"./layer-container-BTcQpd4K.js";import{a as o,r as s}from"./field-Bpptk_9t.js";import{t as c}from"./field-B1wqeZr4.js";import{n as l}from"./separator-Da8lDnio.js";import{t as u}from"./use-prefers-reduced-motion-DHYDQk1h.js";import{createContext as d,useCallback as f,useContext as p,useEffect as m,useMemo as h,useRef as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{XIcon as b}from"@phosphor-icons/react/X";import{CheckIcon as x}from"@phosphor-icons/react/Check";import*as S from"@ariakit/react";import{LockIcon as C}from"@phosphor-icons/react/Lock";const w=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),T=[],E=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),D=d({current:null}),O=d(T),k=d({onInputKeyDownRef:{current:void 0},inputRef:{current:null},setLockedValues:()=>{}}),A=({children:e,defaultSelectedValue:t=T,...n})=>{let r=g(null),i=g(void 0),a=g(null),[o,s]=_(T),c=h(()=>({onInputKeyDownRef:i,inputRef:a,setLockedValues:s}),[]);return v(D.Provider,{value:r,children:v(k.Provider,{value:c,children:v(O.Provider,{value:o,children:v(S.ComboboxProvider,{defaultSelectedValue:t,...n,children:e})})})})},j=({"aria-invalid":e,className:r,children:i,onKeyDown:a,onMouseDown:c,ref:l,validation:u,...d})=>{let f=p(D),{inputRef:m}=p(k),h=S.useComboboxContext(),g=o(),{validation:_}=s({"aria-invalid":e,validation:u??g});return v(`div`,{role:`presentation`,"data-slot":`multi-select-trigger`,className:n(`cursor-text select-none font-sans text-sm`,`border-form bg-form text-strong flex min-h-9 w-full flex-wrap items-center gap-1 rounded-md border px-3 py-1 has-[[data-slot=multi-select-tag]]:px-1`,`has-focus:outline-hidden has-focus-within:ring-4 has-aria-expanded:ring-4`,`has-focus-within:border-accent-600 has-focus-within:ring-focus-accent has-aria-expanded:border-accent-600 has-aria-expanded:ring-focus-accent`,`data-validation-success:border-success-600 data-validation-success:has-focus-within:border-success-600 data-validation-success:has-focus-within:ring-focus-success data-validation-success:has-aria-expanded:border-success-600 data-validation-success:has-aria-expanded:ring-focus-success`,`data-validation-warning:border-warning-600 data-validation-warning:has-focus-within:border-warning-600 data-validation-warning:has-focus-within:ring-focus-warning data-validation-warning:has-aria-expanded:border-warning-600 data-validation-warning:has-aria-expanded:ring-focus-warning`,`data-validation-error:border-danger-600 data-validation-error:has-focus-within:border-danger-600 data-validation-error:has-focus-within:ring-focus-danger data-validation-error:has-aria-expanded:border-danger-600 data-validation-error:has-aria-expanded:ring-focus-danger`,r),"data-validation":_||void 0,onKeyDown:e=>{e.key===`Escape`&&h?.getState().open&&(e.preventDefault(),h.hide()),a?.(e)},onMouseDown:e=>{e.target instanceof HTMLElement&&!e.target.closest(`button, input, [data-slot='multi-select-tag']`)&&(e.preventDefault(),m.current?.focus()),c?.(e)},ref:t(f,l),...d,children:i})},M=({className:e,value:i,onRemove:a,locked:o=!1,onBlur:s,onFocus:c,onKeyDown:l,ref:u,...d})=>{let f=g(null),[p,m]=_(!1);return y(`span`,{ref:t(f,u),role:`listitem`,tabIndex:-1,"data-slot":`multi-select-tag`,"data-active":p||void 0,"data-locked":o||void 0,className:n(`cursor-default bg-neutral-500/10 border border-neutral-500/20 rounded-xs text-strong inline-flex items-center gap-1 pl-2 pr-0.5 py-0.5 text-sm font-normal`,`focus-visible:outline-hidden focus-visible:border-accent-600/50 focus-visible:ring-3 focus-visible:ring-focus-accent`,e),onBlur:e=>{m(!1),s?.(e)},onFocus:e=>{m(!0),c?.(e)},onKeyDown:e=>{if(o&&(e.key===`Backspace`||e.key===`Delete`)){e.preventDefault(),F(e.currentTarget);return}l?.(e)},...d,children:[i,v(`button`,{type:`button`,"aria-label":`Remove ${i}`,tabIndex:-1,"aria-disabled":o||void 0,className:n(`cursor-pointer text-strong/40 hover:bg-neutral-500/15 hover:text-strong rounded-xs p-0.5`,`aria-disabled:cursor-default aria-disabled:hover:bg-transparent aria-disabled:hover:text-strong/40`),onClick:e=>{if(e.stopPropagation(),o){let e=f.current;e&&F(e);return}a?.()},onMouseDown:e=>{e.preventDefault()},children:v(r,{svg:o?v(C,{}):v(b,{weight:`bold`}),className:`size-4`})})]})},N=({render:e,...t})=>e(t),P={Root:A,Trigger:j,TagValues:({"aria-label":t=`Selected values`,children:n,lockedValues:r=T})=>{let i=S.useComboboxContext(),a=S.useStoreState(i,`selectedValue`),o=(w(a)?a:void 0)??T,s=g(o);e(()=>{s.current=o},[o]);let c=h(()=>new Set(r),[r]),l=g(new Map),{onInputKeyDownRef:u,inputRef:d,setLockedValues:f}=p(k);e(()=>{f(e=>E(e,r)?e:r)},[r,f]),e(()=>()=>{f(T)},[f]);let _=g(new Set);m(()=>()=>{_.current.forEach(cancelAnimationFrame)},[]);let y=e=>{let t=requestAnimationFrame(()=>{_.current.delete(t),e()});_.current.add(t)},b=e=>{if(i){let t=i.getState().selectedValue;if(!w(t))return;i.setSelectedValue(t.filter(t=>t!==e))}},x=e=>{let t=s.current[e];if(t==null)return;let n=l.current.get(t);n&&(n.focus(),i?.show())},C=()=>{d.current?.focus()},D=(e,t)=>{let n=o[t];switch(e.key){case`ArrowLeft`:e.preventDefault(),t>0&&x(t-1);break;case`ArrowRight`:e.preventDefault(),t<o.length-1?x(t+1):C();break;case`Backspace`:case`Delete`:if(e.preventDefault(),n!=null){if(c.has(n)){let e=l.current.get(n);e&&F(e);break}if(b(n),e.key===`Backspace`){if(t>0){let e=t-1;y(()=>x(e))}else y(()=>{s.current.length>0?x(0):C()})}else y(()=>{t<s.current.length?x(t):C()})}break;case`ArrowUp`:case`ArrowDown`:e.preventDefault(),C(),d.current?.dispatchEvent(new KeyboardEvent(`keydown`,{key:e.key,bubbles:!0,cancelable:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey}));break;default:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&C()}},O=e=>{if(e.key===`ArrowLeft`&&e.currentTarget.selectionStart===0&&e.currentTarget.selectionEnd===0&&o.length>0){e.preventDefault(),x(o.length-1);return}if(e.key===`Backspace`&&e.currentTarget.value===``&&o.length>0){let e=o[o.length-1];if(e!=null){if(c.has(e)){let t=l.current.get(e);t&&F(t)}else b(e)}}};return e(()=>(u.current=O,()=>{u.current=void 0})),o.length===0?null:v(`span`,{role:`list`,"aria-label":t,"data-slot":`multi-select-tag-list`,className:`contents`,children:o.map((e,t)=>{let r={value:e,locked:c.has(e),onRemove:()=>{if(c.has(e)){let t=l.current.get(e);t&&F(t);return}b(e)},ref:t=>{t?l.current.set(e,t):l.current.delete(e)},onKeyDown:e=>D(e,t),onClick:()=>x(t)};return n?v(N,{render:n,...r},e):v(M,{...r},e)})})},Input:({className:e,onBlur:r,onChange:i,onFocus:a,onKeyDown:o,onValueChange:s,placeholder:l,ref:u,...d})=>{let f=S.useComboboxContext(),{onInputKeyDownRef:m,inputRef:h}=p(k),g=p(c),_=S.useStoreState(f,`selectedValue`),y=((w(_)?_:void 0)?.length??0)>0;return v(S.Combobox,{autoSelect:!0,"data-slot":`multi-select-input`,className:n(`pointer-coarse:text-base min-w-20 flex-1 select-text border-0 bg-transparent text-sm outline-hidden`,`placeholder:select-none placeholder:text-placeholder`,e),onChange:e=>{s?.(e.target.value),i?.(e)},onKeyDown:e=>{m.current?.(e),o?.(e)},onBlur:e=>{e.relatedTarget instanceof HTMLElement&&e.relatedTarget.closest(`[data-slot="multi-select-tag"]`)&&f?.show(),r?.(e)},onFocus:e=>{f?.show(),a?.(e)},placeholder:y?void 0:l,ref:t(h,u),...d,...g?{"aria-describedby":g[`aria-describedby`],"aria-errormessage":g[`aria-errormessage`],"aria-invalid":g[`aria-invalid`],id:g.id,name:g.name}:void 0})},Tag:M,Content:({asChild:e=!1,backdrop:t=!1,children:r,className:o,modal:s=!0,portalElement:c,preventBodyScroll:l,ref:u,sameWidth:d=!0,unmountOnHide:m=!0,...h})=>{let g=p(D),_=a(),y=_!=null,b=f(()=>g.current?.getBoundingClientRect()??null,[g]),x=f(e=>typeof c==`function`?c(e):c??g.current?.closest(`[data-mantle-modal-content]`)??(_ instanceof HTMLElement?_:null)??e.ownerDocument.body,[_,c,g]),C=f(e=>!(e.target instanceof Node&&g.current?.contains(e.target)),[g]);return v(S.ComboboxPopover,{"data-slot":`multi-select-content`,className:n(`border-popover bg-popover relative z-50 max-h-96 min-w-32 scrollbar overflow-y-scroll overflow-x-hidden overscroll-y-none rounded-md border shadow-md pt-1 pb-1 has-data-content-footer:pb-0 font-sans flex flex-col gap-px focus:outline-hidden`,o),backdrop:t,getAnchorRect:b,gutter:4,hideOnInteractOutside:C,modal:s,portalElement:x,preventBodyScroll:l??!y,ref:u,render:e?({ref:e,...t})=>v(i,{ref:e,...t}):void 0,sameWidth:d,unmountOnHide:m,...h,children:r})},ContentFooter:({className:e,children:t,ref:r,...i})=>v(`div`,{ref:r,"data-slot":`multi-select-content-footer`,"data-content-footer":!0,className:n(`bg-popover sticky bottom-0 border-t border-popover`,e),...i,children:t}),Item:({asChild:e=!1,children:t,className:a,focusOnHover:o=!0,value:s,onClick:c,ref:l,...u})=>{let d=p(O),f=s!=null&&d.includes(s);return y(S.ComboboxItem,{"data-slot":`multi-select-item`,className:n(`relative mx-1 cursor-pointer rounded-md pl-2 pr-8 py-1.5 text-strong text-sm font-normal flex min-w-0 items-center gap-2`,`[[role=option]+&]:mt-px`,`data-active-item:bg-active-menu-item`,`aria-disabled:opacity-50`,`aria-selected:bg-selected-menu-item aria-selected:data-active-item:bg-active-selected-menu-item`,a),focusOnHover:o,onClick:e=>{if(f){e.preventDefault();return}c?.(e)},ref:l,render:e?({ref:e,...t})=>v(i,{ref:e,...t}):void 0,resetValueOnSelect:!0,value:s,...u,children:[t,v(S.ComboboxItemCheck,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:v(r,{svg:v(x,{weight:`bold`}),className:`size-4 text-accent-600`})})]})},Group:({asChild:e=!1,children:t,ref:n,...r})=>v(S.ComboboxGroup,{"data-slot":`multi-select-group`,className:`mx-1`,ref:n,render:e?({ref:e,...t})=>v(i,{ref:e,...t}):void 0,...r,children:t}),GroupLabel:({asChild:e=!1,children:t,className:r,ref:a,...o})=>v(S.ComboboxGroupLabel,{"data-slot":`multi-select-group-label`,className:n(`text-muted px-2 py-1 text-xs font-medium`,r),ref:a,render:e?({ref:e,...t})=>v(i,{ref:e,...t}):void 0,...o,children:t}),GroupDescription:({className:e,children:t,ref:r,...i})=>v(`p`,{"data-slot":`multi-select-group-description`,className:n(`text-muted px-2 pb-1 text-xs`,e),ref:r,...i,children:t}),Separator:({className:e,ref:t,...r})=>v(l,{"data-slot":`multi-select-separator`,ref:t,className:n(`my-1 w-auto`,e),...r}),Empty:({className:e,children:t,ref:r,...i})=>v(`div`,{"data-slot":`multi-select-empty`,className:n(`mx-1 text-muted px-2 py-6 text-center text-sm`,e),ref:r,role:`presentation`,...i,children:t})};function F(e){u()||e.animate([{transform:`translateX(0)`},{transform:`translateX(-4px)`},{transform:`translateX(4px)`},{transform:`translateX(-4px)`},{transform:`translateX(4px)`},{transform:`translateX(0)`}],{duration:300,easing:`ease-in-out`})}export{P as MultiSelect};
@@ -23,6 +23,9 @@ type OtpInputRootProps = Omit<ComponentProps<typeof OTPInput>, "render" | "child
23
23
  * and `aria-errormessage` through to the underlying focusable input via
24
24
  * `FieldControlContext`.
25
25
  *
26
+ * **Accessibility.** The hidden input needs an accessible name. Inside a
27
+ * `Field.Item`, `Field.Label` supplies it. On its own, pass `aria-label`.
28
+ *
26
29
  * @see https://mantle.ngrok.com/components/forms/otp-input
27
30
  *
28
31
  * @example
@@ -184,9 +187,12 @@ declare const Separator: ({ asChild, children, className, ref, semantic, ...prop
184
187
  */
185
188
  declare const OtpInput: {
186
189
  /**
187
- * The root of the OTP input. Wraps the hidden input that captures
188
- * keystrokes, paste, and autofill, and exposes per-slot state to
189
- * descendant `OtpInput.Slot` parts.
190
+ * The root of the OTP input. Renders an accessible single hidden input that
191
+ * captures keystrokes, paste events, and autofill, and exposes per-slot state
192
+ * (active, char, fake caret) to descendant `OtpInput.Slot` parts via context.
193
+ *
194
+ * The hidden input needs an accessible name. Inside a `Field.Item`,
195
+ * `Field.Label` supplies it. On its own, pass `aria-label`.
190
196
  *
191
197
  * @see https://mantle.ngrok.com/components/forms/otp-input
192
198
  *
package/dist/otp-input.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-CxM7jdFi.js";import{t as n}from"./types-D85fCNV3.js";import{a as r,r as i}from"./field-Bpptk_9t.js";import{t as a}from"./field-B1wqeZr4.js";import{useContext as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{MinusIcon as l}from"@phosphor-icons/react/Minus";import{OTPInput as u,OTPInputContext as d,REGEXP_ONLY_CHARS as f,REGEXP_ONLY_DIGITS as p,REGEXP_ONLY_DIGITS_AND_CHARS as m}from"input-otp";const h={error:`danger`,success:`success`,warning:`warning`},g=e=>`var(--color-${e}-600)`,_=e=>`var(--ring-color-focus-${e})`,v=({totalActive:e,total:t})=>e===0?`idle`:e===1?`caret`:e===t?`all`:`range`,y=({children:e,validation:t})=>{let r=o(d),i=r.slots.length,a=r.slots.reduce((e,t)=>e+ +!!t.isActive,0),c=v({totalActive:a,total:i}),l=t?h[t]:void 0,u=l?n({"--otp-validation-border":g(l),"--otp-validation-ring":_(l)}):void 0;return s(`div`,{className:`group/otp contents`,"data-otp-state":c,"data-validation":t||void 0,style:u,children:e})},b={Root:({"aria-invalid":t,children:n,className:c,containerClassName:l,ref:d,validation:f,...p})=>{let m=r(),h=o(a),{ariaInvalid:g,validation:_}=i({"aria-invalid":t,defaultAriaInvalid:!1,validation:f??m});return s(u,{ref:d,"aria-invalid":g,"data-slot":`otp-input`,containerClassName:e(`flex items-center gap-2 has-disabled:opacity-50`,l),className:e(`disabled:cursor-not-allowed`,c),...p,...h?{"aria-describedby":h[`aria-describedby`],"aria-errormessage":h[`aria-errormessage`],id:h.id,name:h.name}:void 0,children:s(y,{validation:_,children:n})})},Group:({asChild:n,children:r,className:i,ref:a,...o})=>s(n?t:`div`,{ref:a,"data-slot":`otp-input-group`,className:e(`relative flex items-center rounded-md`,`has-[[data-active]~[data-active]]:ring-focus-accent has-[[data-active]~[data-active]]:ring-4`,`group-data-validation/otp:has-[[data-active]~[data-active]]:ring-(--otp-validation-ring)`,i),...o,children:r}),Slot:({className:t,index:n,ref:r,...i})=>{let a=o(d).slots[n],l=a?.char??null,u=a?.hasFakeCaret??!1,f=a?.isActive??!1;return c(`div`,{ref:r,"data-slot":`otp-input-slot`,"data-active":f?``:void 0,className:e(`border-form bg-form text-strong relative flex h-10 w-10 items-center justify-center border-y border-r text-sm shadow-sm outline-hidden transition-all duration-150 ease-out`,`first:rounded-l-md first:border-l last:rounded-r-md`,`[&:has(+[data-active])]:group-data-[otp-state=caret]/otp:border-r-transparent`,`data-active:group-data-[otp-state=caret]/otp:border-accent-600`,`data-active:group-data-[otp-state=caret]/otp:border-l`,`data-active:group-data-[otp-state=caret]/otp:ring-focus-accent`,`data-active:group-data-[otp-state=caret]/otp:z-20`,`data-active:group-data-[otp-state=caret]/otp:ring-4`,`group-data-[otp-state=all]/otp:border-accent-600`,`group-data-validation/otp:border-y-(--otp-validation-border)`,`group-data-validation/otp:first:border-l-(--otp-validation-border)`,`group-data-validation/otp:last:border-r-(--otp-validation-border)`,`group-data-validation/otp:data-active:group-data-[otp-state=caret]/otp:border-(--otp-validation-border)`,`group-data-validation/otp:data-active:group-data-[otp-state=caret]/otp:ring-(--otp-validation-ring)`,`group-data-validation/otp:group-data-[otp-state=all]/otp:border-(--otp-validation-border)`,t),...i,translate:`no`,children:[l,u&&s(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:s(`div`,{className:`bg-strong h-4 w-px animate-pulse`})})]})},Separator:({asChild:n,children:r,className:i,ref:a,semantic:o=!1,...c})=>{let u=n?t:`div`,d=o?{role:`separator`}:{"aria-hidden":!0,role:`none`};return s(u,{ref:a,"data-slot":`otp-input-separator`,className:e(`text-separator flex items-center`,i),...d,...c,children:r??s(l,{weight:`bold`})})}};export{b as OtpInput,f as REGEXP_ONLY_CHARS,p as REGEXP_ONLY_DIGITS,m as REGEXP_ONLY_DIGITS_AND_CHARS};
1
+ import{t as e}from"./cx-0HCjnNv1.js";import{t}from"./slot-C3gII_9c.js";import{t as n}from"./types-D85fCNV3.js";import{a as r,r as i}from"./field-Bpptk_9t.js";import{t as a}from"./field-B1wqeZr4.js";import{useContext as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{MinusIcon as l}from"@phosphor-icons/react/Minus";import{OTPInput as u,OTPInputContext as d,REGEXP_ONLY_CHARS as f,REGEXP_ONLY_DIGITS as p,REGEXP_ONLY_DIGITS_AND_CHARS as m}from"input-otp";const h={error:`danger`,success:`success`,warning:`warning`},g=e=>`var(--color-${e}-600)`,_=e=>`var(--ring-color-focus-${e})`,v=({totalActive:e,total:t})=>e===0?`idle`:e===1?`caret`:e===t?`all`:`range`,y=({children:e,validation:t})=>{let r=o(d),i=r.slots.length,a=r.slots.reduce((e,t)=>e+ +!!t.isActive,0),c=v({totalActive:a,total:i}),l=t?h[t]:void 0,u=l?n({"--otp-validation-border":g(l),"--otp-validation-ring":_(l)}):void 0;return s(`div`,{className:`group/otp contents`,"data-otp-state":c,"data-validation":t||void 0,style:u,children:e})},b={Root:({"aria-invalid":t,children:n,className:c,containerClassName:l,ref:d,validation:f,...p})=>{let m=r(),h=o(a),{ariaInvalid:g,validation:_}=i({"aria-invalid":t,defaultAriaInvalid:!1,validation:f??m});return s(u,{ref:d,"aria-invalid":g,"data-slot":`otp-input`,containerClassName:e(`flex items-center gap-2 has-disabled:opacity-50`,l),className:e(`disabled:cursor-not-allowed`,c),...p,...h?{"aria-describedby":h[`aria-describedby`],"aria-errormessage":h[`aria-errormessage`],id:h.id,name:h.name}:void 0,children:s(y,{validation:_,children:n})})},Group:({asChild:n,children:r,className:i,ref:a,...o})=>s(n?t:`div`,{ref:a,"data-slot":`otp-input-group`,className:e(`relative flex items-center rounded-md`,`has-[[data-active]~[data-active]]:ring-focus-accent has-[[data-active]~[data-active]]:ring-4`,`group-data-validation/otp:has-[[data-active]~[data-active]]:ring-(--otp-validation-ring)`,i),...o,children:r}),Slot:({className:t,index:n,ref:r,...i})=>{let a=o(d).slots[n],l=a?.char??null,u=a?.hasFakeCaret??!1,f=a?.isActive??!1;return c(`div`,{ref:r,"data-slot":`otp-input-slot`,"data-active":f?``:void 0,className:e(`border-form bg-form text-strong relative flex h-10 w-10 items-center justify-center border-y border-r text-sm shadow-sm outline-hidden transition-all duration-150 ease-out`,`first:rounded-l-md first:border-l last:rounded-r-md`,`[&:has(+[data-active])]:group-data-[otp-state=caret]/otp:border-r-transparent`,`data-active:group-data-[otp-state=caret]/otp:border-accent-600`,`data-active:group-data-[otp-state=caret]/otp:border-l`,`data-active:group-data-[otp-state=caret]/otp:ring-focus-accent`,`data-active:group-data-[otp-state=caret]/otp:z-20`,`data-active:group-data-[otp-state=caret]/otp:ring-4`,`group-data-[otp-state=all]/otp:border-accent-600`,`group-data-validation/otp:border-y-(--otp-validation-border)`,`group-data-validation/otp:first:border-l-(--otp-validation-border)`,`group-data-validation/otp:last:border-r-(--otp-validation-border)`,`group-data-validation/otp:data-active:group-data-[otp-state=caret]/otp:border-(--otp-validation-border)`,`group-data-validation/otp:data-active:group-data-[otp-state=caret]/otp:ring-(--otp-validation-ring)`,`group-data-validation/otp:group-data-[otp-state=all]/otp:border-(--otp-validation-border)`,t),...i,translate:`no`,children:[l,u&&s(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:s(`div`,{className:`bg-strong h-4 w-px animate-pulse`})})]})},Separator:({asChild:n,children:r,className:i,ref:a,semantic:o=!1,...c})=>{let u=n?t:`div`,d=o?{role:`separator`}:{"aria-hidden":!0,role:`none`};return s(u,{ref:a,"data-slot":`otp-input-separator`,className:e(`text-separator flex items-center`,i),...d,...c,children:r??s(l,{weight:`bold`})})}};export{b as OtpInput,f as REGEXP_ONLY_CHARS,p as REGEXP_ONLY_DIGITS,m as REGEXP_ONLY_DIGITS_AND_CHARS};