@primereact/headless 11.0.0-rc.1 → 11.0.0-rc.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 (279) hide show
  1. package/accordion/index.mjs +1 -2
  2. package/animateonscroll/index.mjs +1 -2
  3. package/autocomplete/index.mjs +1 -2
  4. package/avatar/index.mjs +1 -2
  5. package/avatargroup/index.mjs +0 -1
  6. package/badge/index.mjs +1 -2
  7. package/breadcrumb/index.mjs +0 -1
  8. package/button/index.mjs +0 -1
  9. package/card/index.mjs +0 -1
  10. package/carousel/index.mjs +1 -2
  11. package/carousel/useCarousel.d.ts +28 -15
  12. package/checkbox/index.mjs +1 -2
  13. package/checkboxgroup/index.mjs +1 -2
  14. package/chip/index.mjs +1 -2
  15. package/collapsible/index.mjs +1 -2
  16. package/compare/index.mjs +1 -2
  17. package/contextmenu/index.mjs +1 -2
  18. package/contextmenu/submenu/index.mjs +0 -1
  19. package/datatable/features/index.mjs +8 -9
  20. package/datatable/features/useDataTableExport.d.ts +1 -1
  21. package/datatable/features/useDataTableKeyboard.d.ts +1 -1
  22. package/datatable/features/useDataTableSelection.d.ts +4 -4
  23. package/datatable/index.mjs +8 -9
  24. package/datatable/useDataTable.d.ts +2 -2
  25. package/datatable/utils/index.mjs +0 -1
  26. package/dataview/index.mjs +1 -2
  27. package/datepicker/index.mjs +1 -2
  28. package/dialog/index.mjs +1 -2
  29. package/dialog/useDialog.d.ts +12 -12
  30. package/divider/index.mjs +0 -1
  31. package/divider/useDivider.d.ts +1 -1
  32. package/dnd/index.mjs +1 -2
  33. package/drawer/index.mjs +1 -2
  34. package/fieldset/index.mjs +1 -2
  35. package/fileupload/index.mjs +1 -2
  36. package/fileupload/useFileUpload.d.ts +3 -0
  37. package/floatlabel/index.mjs +0 -1
  38. package/fluid/index.mjs +0 -1
  39. package/focustrap/index.mjs +1 -2
  40. package/gallery/index.mjs +1 -2
  41. package/gallery/item/index.mjs +1 -2
  42. package/gallery/useGallery.d.ts +17 -9
  43. package/iconfield/index.mjs +0 -1
  44. package/iftalabel/index.mjs +0 -1
  45. package/inplace/index.mjs +1 -2
  46. package/inplace/useInplace.d.ts +18 -6
  47. package/inputcolor/colorManager.d.ts +1 -1
  48. package/inputcolor/index.mjs +1 -2
  49. package/inputgroup/index.mjs +0 -1
  50. package/inputnumber/index.mjs +1 -2
  51. package/inputotp/index.mjs +1 -2
  52. package/inputpassword/index.mjs +1 -2
  53. package/inputtags/index.mjs +1 -2
  54. package/inputtext/index.mjs +1 -2
  55. package/knob/index.mjs +1 -2
  56. package/label/index.mjs +0 -1
  57. package/listbox/index.mjs +1 -2
  58. package/menu/checkboxitem/index.mjs +1 -2
  59. package/menu/index.mjs +1 -2
  60. package/menu/radioitem/index.mjs +1 -2
  61. package/menu/submenu/index.mjs +1 -2
  62. package/message/index.mjs +1 -2
  63. package/metergroup/index.mjs +1 -2
  64. package/navigationmenu/index.mjs +1 -2
  65. package/orderlist/index.mjs +1 -2
  66. package/orderlist/useOrderList.d.ts +1 -0
  67. package/organizationchart/index.mjs +1 -2
  68. package/overlaybadge/index.mjs +0 -1
  69. package/package.json +9 -7
  70. package/paginator/index.mjs +1 -2
  71. package/paginator/usePaginator.d.ts +1 -1
  72. package/panel/index.mjs +1 -2
  73. package/picklist/index.mjs +1 -2
  74. package/popover/index.mjs +1 -2
  75. package/portal/index.mjs +0 -1
  76. package/positioner/index.mjs +1 -2
  77. package/positioner/usePositioner.anchor.d.ts +2 -2
  78. package/positioner/usePositioner.fallback.d.ts +2 -2
  79. package/progressbar/index.mjs +1 -2
  80. package/progressspinner/index.mjs +1 -2
  81. package/radiobutton/index.mjs +1 -2
  82. package/radiobuttongroup/index.mjs +1 -2
  83. package/rating/index.mjs +1 -2
  84. package/scrollarea/index.mjs +1 -2
  85. package/scrollarea/useScrollArea.d.ts +1 -1
  86. package/select/index.mjs +1 -2
  87. package/sidebar/index.mjs +1 -2
  88. package/sidebar/useSidebar.d.ts +30 -4
  89. package/sidebar/useSidebarLayout.d.ts +4 -4
  90. package/sidebar/useSidebarMenuItem.d.ts +0 -1
  91. package/skeleton/index.mjs +0 -1
  92. package/slider/index.mjs +1 -2
  93. package/speeddial/index.mjs +1 -2
  94. package/splitter/index.mjs +1 -2
  95. package/stepper/index.mjs +1 -2
  96. package/styleclass/index.mjs +1 -2
  97. package/tabs/index.mjs +1 -2
  98. package/tag/index.mjs +0 -1
  99. package/terminal/index.mjs +1 -2
  100. package/textarea/index.mjs +1 -2
  101. package/timeline/index.mjs +0 -1
  102. package/toast/index.mjs +1 -2
  103. package/toaster/index.mjs +1 -2
  104. package/togglebutton/index.mjs +1 -2
  105. package/togglebuttongroup/index.mjs +1 -2
  106. package/toggleswitch/index.mjs +1 -2
  107. package/toolbar/index.mjs +0 -1
  108. package/tooltip/index.mjs +1 -2
  109. package/tooltipmanager/index.mjs +1 -2
  110. package/tree/index.mjs +1 -2
  111. package/tree/useTree.d.ts +4 -4
  112. package/tree/useTreeDragDrop.d.ts +2 -2
  113. package/tree/useTreeFlatten.d.ts +1 -1
  114. package/tree/useTreeSelection.d.ts +3 -3
  115. package/accordion/index.mjs.map +0 -1
  116. package/accordion/useAccordion.test.d.ts +0 -0
  117. package/animateonscroll/index.mjs.map +0 -1
  118. package/animateonscroll/useAnimateOnScroll.test.d.ts +0 -0
  119. package/autocomplete/index.mjs.map +0 -1
  120. package/autocomplete/useAutoComplete.test.d.ts +0 -0
  121. package/avatar/index.mjs.map +0 -1
  122. package/avatar/useAvatar.test.d.ts +0 -0
  123. package/avatargroup/index.mjs.map +0 -1
  124. package/badge/index.mjs.map +0 -1
  125. package/badge/useBadge.test.d.ts +0 -0
  126. package/breadcrumb/index.mjs.map +0 -1
  127. package/breadcrumb/useBreadcrumb.test.d.ts +0 -0
  128. package/button/index.mjs.map +0 -1
  129. package/button/useButton.test.d.ts +0 -0
  130. package/card/index.mjs.map +0 -1
  131. package/card/useCard.test.d.ts +0 -0
  132. package/carousel/index.mjs.map +0 -1
  133. package/carousel/useCarousel.test.d.ts +0 -0
  134. package/checkbox/index.mjs.map +0 -1
  135. package/checkbox/useCheckbox.test.d.ts +0 -0
  136. package/checkboxgroup/index.mjs.map +0 -1
  137. package/checkboxgroup/useCheckboxGroup.test.d.ts +0 -0
  138. package/chip/index.mjs.map +0 -1
  139. package/chip/useChip.test.d.ts +0 -0
  140. package/collapsible/index.mjs.map +0 -1
  141. package/collapsible/useCollapsible.test.d.ts +0 -0
  142. package/compare/index.mjs.map +0 -1
  143. package/compare/useCompare.test.d.ts +0 -0
  144. package/contextmenu/index.mjs.map +0 -1
  145. package/contextmenu/submenu/index.mjs.map +0 -1
  146. package/contextmenu/useContextMenu.test.d.ts +0 -0
  147. package/datatable/features/index.mjs.map +0 -1
  148. package/datatable/index.mjs.map +0 -1
  149. package/datatable/utils/index.mjs.map +0 -1
  150. package/dataview/index.mjs.map +0 -1
  151. package/dataview/useDataView.test.d.ts +0 -0
  152. package/datepicker/index.mjs.map +0 -1
  153. package/datepicker/useDatePicker.test.d.ts +0 -0
  154. package/dialog/index.mjs.map +0 -1
  155. package/dialog/useDialog.test.d.ts +0 -0
  156. package/divider/index.mjs.map +0 -1
  157. package/divider/useDivider.test.d.ts +0 -0
  158. package/dnd/index.mjs.map +0 -1
  159. package/drawer/index.mjs.map +0 -1
  160. package/drawer/useDrawer.test.d.ts +0 -0
  161. package/fieldset/index.mjs.map +0 -1
  162. package/fieldset/useFieldset.test.d.ts +0 -0
  163. package/fileupload/index.mjs.map +0 -1
  164. package/fileupload/useFileUpload.test.d.ts +0 -0
  165. package/floatlabel/index.mjs.map +0 -1
  166. package/floatlabel/useFloatLabel.test.d.ts +0 -0
  167. package/fluid/index.mjs.map +0 -1
  168. package/fluid/useFluid.test.d.ts +0 -0
  169. package/focustrap/index.mjs.map +0 -1
  170. package/focustrap/useFocusTrap.test.d.ts +0 -0
  171. package/gallery/index.mjs.map +0 -1
  172. package/gallery/item/index.mjs.map +0 -1
  173. package/gallery/useGallery.test.d.ts +0 -0
  174. package/iconfield/index.mjs.map +0 -1
  175. package/iconfield/useIconField.test.d.ts +0 -0
  176. package/iftalabel/index.mjs.map +0 -1
  177. package/iftalabel/useIftaLabel.test.d.ts +0 -0
  178. package/inplace/index.mjs.map +0 -1
  179. package/inplace/useInplace.test.d.ts +0 -0
  180. package/inputcolor/index.mjs.map +0 -1
  181. package/inputcolor/useInputColor.test.d.ts +0 -0
  182. package/inputgroup/index.mjs.map +0 -1
  183. package/inputgroup/useInputGroup.test.d.ts +0 -0
  184. package/inputnumber/index.mjs.map +0 -1
  185. package/inputnumber/useInputNumber.test.d.ts +0 -0
  186. package/inputotp/index.mjs.map +0 -1
  187. package/inputotp/useInputOtp.test.d.ts +0 -0
  188. package/inputpassword/index.mjs.map +0 -1
  189. package/inputpassword/useInputPassword.test.d.ts +0 -0
  190. package/inputtags/index.mjs.map +0 -1
  191. package/inputtags/useInputTags.test.d.ts +0 -0
  192. package/inputtext/index.mjs.map +0 -1
  193. package/inputtext/useInputText.test.d.ts +0 -0
  194. package/knob/index.mjs.map +0 -1
  195. package/knob/useKnob.test.d.ts +0 -0
  196. package/label/index.mjs.map +0 -1
  197. package/label/useLabel.test.d.ts +0 -0
  198. package/listbox/index.mjs.map +0 -1
  199. package/listbox/useListbox.test.d.ts +0 -0
  200. package/menu/checkboxitem/index.mjs.map +0 -1
  201. package/menu/index.mjs.map +0 -1
  202. package/menu/radioitem/index.mjs.map +0 -1
  203. package/menu/submenu/index.mjs.map +0 -1
  204. package/menu/useMenu.test.d.ts +0 -0
  205. package/message/index.mjs.map +0 -1
  206. package/message/useMessage.test.d.ts +0 -0
  207. package/metergroup/index.mjs.map +0 -1
  208. package/metergroup/useMeterGroup.test.d.ts +0 -0
  209. package/navigationmenu/index.mjs.map +0 -1
  210. package/navigationmenu/useNavigationMenu.test.d.ts +0 -0
  211. package/orderlist/index.mjs.map +0 -1
  212. package/organizationchart/index.mjs.map +0 -1
  213. package/organizationchart/useOrganizationChart.test.d.ts +0 -0
  214. package/overlaybadge/index.mjs.map +0 -1
  215. package/overlaybadge/useOverlayBadge.test.d.ts +0 -0
  216. package/paginator/index.mjs.map +0 -1
  217. package/paginator/usePaginator.test.d.ts +0 -0
  218. package/panel/index.mjs.map +0 -1
  219. package/panel/usePanel.test.d.ts +0 -0
  220. package/picklist/index.mjs.map +0 -1
  221. package/popover/index.mjs.map +0 -1
  222. package/popover/usePopover.test.d.ts +0 -0
  223. package/portal/index.mjs.map +0 -1
  224. package/portal/usePortal.test.d.ts +0 -0
  225. package/positioner/index.mjs.map +0 -1
  226. package/positioner/usePositioner.test.d.ts +0 -0
  227. package/progressbar/index.mjs.map +0 -1
  228. package/progressbar/useProgressBar.test.d.ts +0 -0
  229. package/progressspinner/index.mjs.map +0 -1
  230. package/radiobutton/index.mjs.map +0 -1
  231. package/radiobutton/useRadioButton.test.d.ts +0 -0
  232. package/radiobuttongroup/index.mjs.map +0 -1
  233. package/radiobuttongroup/useRadioButtonGroup.test.d.ts +0 -0
  234. package/rating/index.mjs.map +0 -1
  235. package/scrollarea/index.mjs.map +0 -1
  236. package/scrollarea/useScrollArea.test.d.ts +0 -0
  237. package/select/index.mjs.map +0 -1
  238. package/select/useSelect.test.d.ts +0 -1
  239. package/sidebar/index.mjs.map +0 -1
  240. package/skeleton/index.mjs.map +0 -1
  241. package/skeleton/useSkeleton.test.d.ts +0 -0
  242. package/slider/index.mjs.map +0 -1
  243. package/slider/useSlider.test.d.ts +0 -0
  244. package/speeddial/index.mjs.map +0 -1
  245. package/speeddial/useSpeedDial.test.d.ts +0 -0
  246. package/splitter/index.mjs.map +0 -1
  247. package/splitter/useSplitter.test.d.ts +0 -0
  248. package/stepper/index.mjs.map +0 -1
  249. package/stepper/useStepper.test.d.ts +0 -0
  250. package/styleclass/index.mjs.map +0 -1
  251. package/styleclass/useStyleClass.test.d.ts +0 -0
  252. package/tabs/index.mjs.map +0 -1
  253. package/tabs/useTabs.test.d.ts +0 -0
  254. package/tag/index.mjs.map +0 -1
  255. package/tag/useTag.test.d.ts +0 -0
  256. package/terminal/index.mjs.map +0 -1
  257. package/terminal/useTerminal.test.d.ts +0 -0
  258. package/textarea/index.mjs.map +0 -1
  259. package/textarea/useTextarea.test.d.ts +0 -0
  260. package/timeline/index.mjs.map +0 -1
  261. package/timeline/useTimeline.test.d.ts +0 -0
  262. package/toast/index.mjs.map +0 -1
  263. package/toast/useToast.test.d.ts +0 -0
  264. package/toaster/index.mjs.map +0 -1
  265. package/toaster/useToaster.test.d.ts +0 -0
  266. package/togglebutton/index.mjs.map +0 -1
  267. package/togglebutton/useToggle.test.d.ts +0 -0
  268. package/togglebuttongroup/index.mjs.map +0 -1
  269. package/togglebuttongroup/useToggleButtonGroup.test.d.ts +0 -0
  270. package/toggleswitch/index.mjs.map +0 -1
  271. package/toggleswitch/useToggleSwitch.test.d.ts +0 -0
  272. package/toolbar/index.mjs.map +0 -1
  273. package/toolbar/useToolbar.test.d.ts +0 -0
  274. package/tooltip/index.mjs.map +0 -1
  275. package/tooltip/useTooltip.test.d.ts +0 -0
  276. package/tooltipmanager/index.mjs.map +0 -1
  277. package/tooltipmanager/useTooltipManager.test.d.ts +0 -0
  278. package/tree/index.mjs.map +0 -1
  279. package/tree/useTree.test.d.ts +0 -0
package/tooltip/index.mjs CHANGED
@@ -1,2 +1 @@
1
- var Pe=Object.defineProperty,De=Object.defineProperties;var Le=Object.getOwnPropertyDescriptors;var $=Object.getOwnPropertySymbols;var he=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable;var g=(s,t,i)=>t in s?Pe(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,p=(s,t)=>{for(var i in t||(t={}))he.call(t,i)&&g(s,i,t[i]);if($)for(var i of $(t))we.call(t,i)&&g(s,i,t[i]);return s},M=(s,t)=>De(s,Le(t));import{withHeadless as Ce}from"@primereact/core/headless";import{useControlledState as be}from"@primereact/hooks/use-controlled-state";import*as n from"react";var ee={anchor:void 0,open:void 0,defaultOpen:!1,onOpenChange:void 0,onExitComplete:void 0,disabled:!1,openDelay:600,closeDelay:100,interactive:!0,tooltipManager:void 0};var Ke=Ce({name:"useTooltip",defaultProps:ee,setup:({props:s})=>{var _;let{tooltipManager:t,openDelay:i=600,closeDelay:S=0,interactive:k=!0,disabled:x}=s,[o,te]=be({value:s.open,defaultValue:s.defaultOpen,onChange:s.onOpenChange}),[B,A]=n.useState((_=s.anchor)!=null?_:null),[U,ne]=n.useState(null),[re,se]=n.useState(null),[oe,ce]=n.useState(null),[v,f]=n.useState(void 0),[ue,G]=n.useState(!!o),a=n.useId(),y=n.useRef(null),C=n.useRef(null),K=n.useRef(null),N=n.useRef(null),P=n.useRef(null),l=n.useRef(null),b=n.useRef(!1),I=n.useRef(!1),O=n.useRef(o);O.current=o;let ie=n.useCallback(e=>{s.anchor==null&&e!==y.current&&(y.current=e,A(e))},[s.anchor]);n.useEffect(()=>{var e;s.anchor!==void 0&&(y.current=s.anchor,A((e=s.anchor)!=null?e:null))},[s.anchor]),n.useEffect(()=>{o&&G(!0)},[o]);let le=n.useCallback(e=>{e!==C.current&&(C.current=e,ne(e))},[]),ae=n.useCallback(e=>{e!==N.current&&(N.current=e,ce(e))},[]),fe=n.useCallback(e=>{e!==K.current&&(K.current=e,se(e))},[]),de=n.useCallback(()=>{},[]),me=n.useCallback(()=>{var e;(e=s.onExitComplete)==null||e.call(s)},[s.onExitComplete]),D=()=>{P.current&&(clearTimeout(P.current),P.current=null),l.current&&(clearTimeout(l.current),l.current=null)};function L(e,r){te([e,{originalEvent:r,value:e}])}let H=n.useRef(()=>{});H.current=()=>{var e;D(),f("delay"),L(!1),(e=t==null?void 0:t.notifyClose)==null||e.call(t,a)};let V=(e,r)=>{var q,z,J,Q,W,X,Y;if(x)return;D();let u=(q=t==null?void 0:t.state)==null?void 0:q.isInstantPhase,d=(z=t==null?void 0:t.state)==null?void 0:z.lastClosedTooltipId,m=(J=t==null?void 0:t.state)==null?void 0:J.currentOpenTooltipId,E=(Q=t==null?void 0:t.state)==null?void 0:Q.openDelay,T=m!==null&&m!==a,h=u&&d===a,w=T||u&&d!==null&&d!==a,j=w||h?0:(W=e!=null?e:E)!=null?W:i;T&&((X=t==null?void 0:t.closeCurrentTooltip)==null||X.call(t)),f(r||(w?"delay":void 0)),j===0?(L(!0),(Y=t==null?void 0:t.notifyOpen)==null||Y.call(t,a,()=>H.current())):P.current=window.setTimeout(()=>{var Z;L(!0),(Z=t==null?void 0:t.notifyOpen)==null||Z.call(t,a,()=>H.current()),P.current=null},j)},R=(e,r)=>{var E,T,h,F;D();let u=(E=t==null?void 0:t.state)==null?void 0:E.isInstantPhase,d=(T=t==null?void 0:t.state)==null?void 0:T.closeDelay,m=u?0:(h=e!=null?e:d)!=null?h:S;r&&f(r),m===0?(L(!1),(F=t==null?void 0:t.notifyClose)==null||F.call(t,a),r||f(void 0)):l.current=window.setTimeout(()=>{var w;L(!1),(w=t==null?void 0:t.notifyClose)==null||w.call(t,a),r||f(void 0),l.current=null},m)},c=n.useRef({onTriggerPointerEnter:()=>{},onTriggerPointerLeave:()=>{},onPositionerPointerLeave:()=>{},onFocus:()=>{},onBlur:()=>{},onDocumentPointerDown:e=>{},onKeyDown:e=>{}});c.current.onTriggerPointerEnter=()=>{b.current=!1,V()},c.current.onTriggerPointerLeave=()=>{var e,r;if(!O.current){D();return}if(t){let u=(r=(e=t.state)==null?void 0:e.closeDelay)!=null?r:S;l.current=window.setTimeout(()=>{l.current=null,R(0)},u)}else R()},c.current.onPositionerPointerLeave=()=>{var e,r;if(b.current=!1,t){let u=(r=(e=t.state)==null?void 0:e.closeDelay)!=null?r:S;l.current=window.setTimeout(()=>{l.current=null,R(0)},u)}else R()},c.current.onFocus=()=>{var e;if(I.current){I.current=!1;return}(e=y.current)!=null&&e.matches(":focus-visible")&&V(0,"focus")},c.current.onBlur=()=>{I.current=!1,document.hasFocus()&&R(0,"focus")},c.current.onDocumentPointerDown=e=>{var r;O.current&&(k&&((r=C.current)!=null&&r.contains(e.target))||(I.current=!0,R(0,"dismiss")))},c.current.onKeyDown=e=>{e.key==="Escape"&&O.current&&R(0,"dismiss")},n.useEffect(()=>{let e=y.current;if(!e||x)return;let r=()=>c.current.onTriggerPointerEnter(),u=()=>c.current.onTriggerPointerLeave(),d=()=>c.current.onFocus(),m=()=>c.current.onBlur(),E=T=>c.current.onKeyDown(T);return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",u),e.addEventListener("focus",d),e.addEventListener("blur",m),e.addEventListener("keydown",E),()=>{e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",u),e.removeEventListener("focus",d),e.removeEventListener("blur",m),e.removeEventListener("keydown",E)}},[B,x]),n.useEffect(()=>{if(!o)return;let e=r=>c.current.onDocumentPointerDown(r);return document.addEventListener("pointerdown",e),()=>{document.removeEventListener("pointerdown",e)}},[o]),n.useEffect(()=>{let e=C.current;if(!e||!o||!k)return;let r=()=>{b.current=!0,l.current&&(clearTimeout(l.current),l.current=null)},u=()=>c.current.onPositionerPointerLeave();return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",u),()=>{e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",u),b.current=!1}},[U,o,k]),n.useEffect(()=>{o&&t&&t.notifyOpen(a,()=>H.current())},[o]),n.useEffect(()=>()=>D(),[]);let pe={open:o,rendered:ue,anchorElement:B,positionerElement:U,popupElement:re,arrowElement:oe,instantType:v},ve=p({},v&&{"data-instant":v}),Re=p({"data-scope":"tooltip","data-part":"trigger",ref:ie},o&&{"data-popup-open":""}),Ee=p({"data-scope":"tooltip","data-part":"positioner",ref:le},o&&{"data-open":""}),Te=M(p(p({"data-scope":"tooltip","data-part":"popup",ref:fe},o&&{"data-open":""}),v&&{"data-instant":""}),{"data-instant-type":v}),ye=p(p({"data-scope":"tooltip","data-part":"arrow",ref:ae},o&&{"data-open":""}),v&&{"data-instant":v});return{state:pe,popupRef:K,rootProps:ve,triggerProps:Re,positionerProps:Ee,popupProps:Te,arrowProps:ye,setRendered:G,onOpenComplete:de,onCloseComplete:me}}});export{ee as defaultProps,Ke as useTooltip};
2
- //# sourceMappingURL=index.mjs.map
1
+ import{withHeadless as ae}from"@primereact/core/headless";import{useControlledState as ce}from"@primereact/hooks/use-controlled-state";import*as t from"react";var U={anchor:void 0,open:void 0,defaultOpen:!1,onOpenChange:void 0,onExitComplete:void 0,disabled:!1,openDelay:600,closeDelay:100,interactive:!0,tooltipManager:void 0};var me=ae({name:"useTooltip",defaultProps:U,setup:({props:a})=>{let{tooltipManager:n,openDelay:G=600,closeDelay:C=0,interactive:b=!0,disabled:I}=a,[o,N]=ce({value:a.open,defaultValue:a.defaultOpen,onChange:a.onOpenChange}),[O,H]=t.useState(a.anchor??null),[S,V]=t.useState(null),[_,j]=t.useState(null),[q,z]=t.useState(null),[d,i]=t.useState(void 0),[J,k]=t.useState(!!o),l=t.useId(),v=t.useRef(null),T=t.useRef(null),M=t.useRef(null),x=t.useRef(null),R=t.useRef(null),c=t.useRef(null),P=t.useRef(!1),D=t.useRef(!1),L=t.useRef(o);L.current=o;let Q=t.useCallback(e=>{a.anchor==null&&e!==v.current&&(v.current=e,H(e))},[a.anchor]);t.useEffect(()=>{a.anchor!==void 0&&(v.current=a.anchor,H(a.anchor??null))},[a.anchor]),t.useEffect(()=>{o&&k(!0)},[o]);let W=t.useCallback(e=>{e!==T.current&&(T.current=e,V(e))},[]),X=t.useCallback(e=>{e!==x.current&&(x.current=e,z(e))},[]),Y=t.useCallback(e=>{e!==M.current&&(M.current=e,j(e))},[]),Z=t.useCallback(()=>{},[]),$=t.useCallback(()=>{a.onExitComplete?.()},[a.onExitComplete]),E=()=>{R.current&&(clearTimeout(R.current),R.current=null),c.current&&(clearTimeout(c.current),c.current=null)};function y(e,r){N([e,{originalEvent:r,value:e}])}let h=t.useRef(()=>{});h.current=()=>{E(),i("delay"),y(!1),n?.notifyClose?.(l)};let K=(e,r)=>{if(I)return;E();let u=n?.state?.isInstantPhase,f=n?.state?.lastClosedTooltipId,p=n?.state?.currentOpenTooltipId,w=n?.state?.openDelay,g=p!==null&&p!==l,F=u&&f===l,B=g||u&&f!==null&&f!==l,A=B||F?0:e??w??G;g&&n?.closeCurrentTooltip?.(),i(r||(B?"delay":void 0)),A===0?(y(!0),n?.notifyOpen?.(l,()=>h.current())):R.current=window.setTimeout(()=>{y(!0),n?.notifyOpen?.(l,()=>h.current()),R.current=null},A)},m=(e,r)=>{E();let u=n?.state?.isInstantPhase,f=n?.state?.closeDelay,p=u?0:e??f??C;r&&i(r),p===0?(y(!1),n?.notifyClose?.(l),r||i(void 0)):c.current=window.setTimeout(()=>{y(!1),n?.notifyClose?.(l),r||i(void 0),c.current=null},p)},s=t.useRef({onTriggerPointerEnter:()=>{},onTriggerPointerLeave:()=>{},onPositionerPointerLeave:()=>{},onFocus:()=>{},onBlur:()=>{},onDocumentPointerDown:e=>{},onKeyDown:e=>{}});s.current.onTriggerPointerEnter=()=>{P.current=!1,K()},s.current.onTriggerPointerLeave=()=>{if(!L.current){E();return}if(n){let e=n.state?.closeDelay??C;c.current=window.setTimeout(()=>{c.current=null,m(0)},e)}else m()},s.current.onPositionerPointerLeave=()=>{if(P.current=!1,n){let e=n.state?.closeDelay??C;c.current=window.setTimeout(()=>{c.current=null,m(0)},e)}else m()},s.current.onFocus=()=>{if(D.current){D.current=!1;return}v.current?.matches(":focus-visible")&&K(0,"focus")},s.current.onBlur=()=>{D.current=!1,document.hasFocus()&&m(0,"focus")},s.current.onDocumentPointerDown=e=>{L.current&&(b&&T.current?.contains(e.target)||(D.current=!0,m(0,"dismiss")))},s.current.onKeyDown=e=>{e.key==="Escape"&&L.current&&m(0,"dismiss")},t.useEffect(()=>{let e=v.current;if(!e||I)return;let r=()=>s.current.onTriggerPointerEnter(),u=()=>s.current.onTriggerPointerLeave(),f=()=>s.current.onFocus(),p=()=>s.current.onBlur(),w=g=>s.current.onKeyDown(g);return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",u),e.addEventListener("focus",f),e.addEventListener("blur",p),e.addEventListener("keydown",w),()=>{e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",u),e.removeEventListener("focus",f),e.removeEventListener("blur",p),e.removeEventListener("keydown",w)}},[O,I]),t.useEffect(()=>{if(!o)return;let e=r=>s.current.onDocumentPointerDown(r);return document.addEventListener("pointerdown",e),()=>{document.removeEventListener("pointerdown",e)}},[o]),t.useEffect(()=>{let e=T.current;if(!e||!o||!b)return;let r=()=>{P.current=!0,c.current&&(clearTimeout(c.current),c.current=null)},u=()=>s.current.onPositionerPointerLeave();return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",u),()=>{e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",u),P.current=!1}},[S,o,b]),t.useEffect(()=>{o&&n&&n.notifyOpen(l,()=>h.current())},[o]),t.useEffect(()=>()=>E(),[]);let ee={open:o,rendered:J,anchorElement:O,positionerElement:S,popupElement:_,arrowElement:q,instantType:d},te={...d&&{"data-instant":d}},ne={"data-scope":"tooltip","data-part":"trigger",ref:Q,...o&&{"data-popup-open":""}},re={"data-scope":"tooltip","data-part":"positioner",ref:W,...o&&{"data-open":""}},oe={"data-scope":"tooltip","data-part":"popup",ref:Y,...o&&{"data-open":""},...d&&{"data-instant":""},"data-instant-type":d},se={"data-scope":"tooltip","data-part":"arrow",ref:X,...o&&{"data-open":""},...d&&{"data-instant":d}};return{state:ee,popupRef:M,rootProps:te,triggerProps:ne,positionerProps:re,popupProps:oe,arrowProps:se,setRendered:k,onOpenComplete:Z,onCloseComplete:$}}});export{U as defaultProps,me as useTooltip};
@@ -1,2 +1 @@
1
- import{withHeadless as m}from"@primereact/core/headless";import*as t from"react";var c={openDelay:void 0,closeDelay:void 0,timeout:400};var I=m({name:"useTooltipManager",defaultProps:c,setup:({props:a})=>{let{openDelay:l,closeDelay:u,timeout:s=400}=a,r=t.useRef(null),o=t.useRef(null),e=t.useRef({isInstantPhase:!1,lastClosedTooltipId:null,currentOpenTooltipId:null,openDelay:l,closeDelay:u});e.current.openDelay=l,e.current.closeDelay=u;let i=t.useCallback((n,d)=>{e.current.currentOpenTooltipId=n,o.current=d,r.current&&(clearTimeout(r.current),r.current=null)},[]),p=t.useCallback(n=>{e.current.currentOpenTooltipId===n&&(e.current.currentOpenTooltipId=null),o.current=null,e.current.lastClosedTooltipId=n,e.current.isInstantPhase=!0,r.current&&clearTimeout(r.current),r.current=window.setTimeout(()=>{e.current.isInstantPhase=!1,e.current.lastClosedTooltipId=null,r.current=null},s)},[s]),f=t.useCallback(()=>{var n;(n=o.current)==null||n.call(o),o.current=null},[]);return t.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),{state:e.current,notifyOpen:i,notifyClose:p,closeCurrentTooltip:f}}});export{c as defaultProps,I as useTooltipManager};
2
- //# sourceMappingURL=index.mjs.map
1
+ import{withHeadless as m}from"@primereact/core/headless";import*as t from"react";var c={openDelay:void 0,closeDelay:void 0,timeout:400};var C=m({name:"useTooltipManager",defaultProps:c,setup:({props:a})=>{let{openDelay:l,closeDelay:u,timeout:s=400}=a,r=t.useRef(null),n=t.useRef(null),e=t.useRef({isInstantPhase:!1,lastClosedTooltipId:null,currentOpenTooltipId:null,openDelay:l,closeDelay:u});e.current.openDelay=l,e.current.closeDelay=u;let i=t.useCallback((o,d)=>{e.current.currentOpenTooltipId=o,n.current=d,r.current&&(clearTimeout(r.current),r.current=null)},[]),p=t.useCallback(o=>{e.current.currentOpenTooltipId===o&&(e.current.currentOpenTooltipId=null),n.current=null,e.current.lastClosedTooltipId=o,e.current.isInstantPhase=!0,r.current&&clearTimeout(r.current),r.current=window.setTimeout(()=>{e.current.isInstantPhase=!1,e.current.lastClosedTooltipId=null,r.current=null},s)},[s]),f=t.useCallback(()=>{n.current?.(),n.current=null},[]);return t.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),{state:e.current,notifyOpen:i,notifyClose:p,closeCurrentTooltip:f}}});export{c as defaultProps,C as useTooltipManager};
package/tree/index.mjs CHANGED
@@ -1,2 +1 @@
1
- var Ye=Object.defineProperty,je=Object.defineProperties;var Xe=Object.getOwnPropertyDescriptors;var Ke=Object.getOwnPropertySymbols;var $e=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable;var Me=(t,e,a)=>e in t?Ye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,b=(t,e)=>{for(var a in e||(e={}))$e.call(e,a)&&Me(t,a,e[a]);if(Ke)for(var a of Ke(e))Ge.call(e,a)&&Me(t,a,e[a]);return t},q=(t,e)=>je(t,Xe(e));import{withHeadless as et}from"@primereact/core/headless";import{useControlledState as _e}from"@primereact/hooks/use-controlled-state";import*as w from"react";var Pe={value:void 0,expandedKeys:void 0,defaultExpandedKeys:void 0,selectionKeys:void 0,defaultSelectionKeys:void 0,selectionMode:void 0,metaKeySelection:!1,highlightOnSelect:!1,draggable:void 0,droppable:void 0,draggableScope:void 0,droppableScope:void 0,onExpandedChange:void 0,onSelectionChange:void 0,onToggle:void 0,onExpand:void 0,onCollapse:void 0,onClick:void 0,onSelect:void 0,onUnselect:void 0,onMove:void 0,validateMove:void 0,onFocusedKeyChange:void 0,loading:!1};import*as ge from"react";var _={isDragging:!1,dragNode:null,dragScope:null,dragNodeSubNodes:null,dragNodeIndex:null,sourceTreeId:null,sourceCommit:null},pe=new Set,ye=new Set,H={getDragState(){return _},startDrag(t){var e,a,r,T,v;_.isDragging=!0,_.dragNode=t.node,_.dragScope=(e=t.scope)!=null?e:null,_.dragNodeSubNodes=(a=t.subNodes)!=null?a:null,_.dragNodeIndex=(r=t.index)!=null?r:null,_.sourceTreeId=(T=t.sourceTreeId)!=null?T:null,_.sourceCommit=(v=t.sourceCommit)!=null?v:null,pe.forEach(M=>M(t))},stopDrag(t){_.isDragging=!1,_.dragNode=null,_.dragScope=null,_.dragNodeSubNodes=null,_.dragNodeIndex=null,_.sourceTreeId=null,_.sourceCommit=null,ye.forEach(e=>e(t))},onDragStart(t){return pe.add(t),()=>pe.delete(t)},onDragStop(t){return ye.add(t),()=>ye.delete(t)}};function Ie(t,e){if(t.key===e)return!0;if(!t.children||t.children.length===0)return!1;for(let a of t.children)if(Ie(a,e))return!0;return!1}function we({props:t,setDragHoverState:e,getNodes:a}){ge.useEffect(()=>{if(!t.droppable)return;let i=H.onDragStop(()=>{e(!1)});return()=>{i()}},[t.droppable,e]);let r=ge.useCallback(i=>{let{dragNode:f,dragScope:L}=H.getDragState();return!(!f||!Je(L,t.droppableScope)||i&&f===i)},[t.droppableScope]),T=i=>{t.droppable&&r()?i.dataTransfer.dropEffect="copy":i.dataTransfer.dropEffect="none",i.preventDefault()},v=i=>{t.droppable&&r()&&e(!0)},M=i=>{if(!t.droppable)return;let f=i.currentTarget.getBoundingClientRect();(i.clientX>=f.right||i.clientX<=f.left||i.clientY>=f.bottom||i.clientY<=f.top)&&e(!1)},u=(i,f,L)=>{let{sourceCommit:F}=H.getDragState(),I=t.value||[],Y=I.some(l=>Ie(l,f.key)),U=[...I,f],z={originalEvent:i,value:U,dragNode:f,dropNode:null,dropIndex:U.length-1,dropPosition:"inside"},B=()=>{var l;(l=t.onMove)==null||l.call(t,z),F&&!Y&&F(i),H.stopDrag({node:f})};if(t.validateMove){let l=t.validateMove(z);if(l instanceof Promise){l.then(g=>{g?B():H.stopDrag({node:f})});return}if(!l){H.stopDrag({node:f});return}}B()};return{allowDrop:r,onDragOver:T,onDragEnter:v,onDragLeave:M,onDrop:i=>{if(!t.droppable){e(!1);return}i.preventDefault();let{dragNode:f,dragScope:L,dragNodeIndex:F}=H.getDragState();if(f&&r()){if(Qe(L,t.draggableScope)){H.stopDrag({node:f}),e(!1);return}F!==null&&u(i,f,F)}e(!1)}}}function Ue(t,e){if(t==null&&e==null)return!0;if(t==null||e==null)return!1;if(typeof e=="string"){if(typeof t=="string")return t===e;if(Array.isArray(t))return t.indexOf(e)!==-1}else if(Array.isArray(e)){if(typeof t=="string")return e.indexOf(t)!==-1;if(Array.isArray(t)){for(let a of t)if(e.indexOf(a)!==-1)return!0;return!1}}return!1}function Je(t,e){return e==null?!0:Ue(t,e)}function Qe(t,e){return Ue(t,e)}function he(t,e,a,r,T,v){return{originalEvent:t,value:e,dragNode:a,dropNode:r,dropIndex:T,dropPosition:v}}import*as me from"react";function Ae(t){return me.useMemo(()=>{let e=new Map,a=[],r=(T,v,M)=>{var u;for(let k=0;k<T.length;k++){let i=T[k];e.set(i.key,{node:i,parentKey:v,level:M,posInSet:k+1,setSize:T.length}),a.push(i.key),(u=i.children)!=null&&u.length&&r(i.children,i.key,M+1)}};return r(t!=null?t:[],null,1),{nodeMap:e,flatOrder:a}},[t])}function He(t,e){return me.useMemo(()=>{let a=[],r=e!=null?e:{},T=v=>{var M;for(let u of v)a.push(u.key),r[u.key]===!0&&((M=u.children)!=null&&M.length)&&T(u.children)};return T(t!=null?t:[]),a},[t,e])}import{focus as Le,isPrintableCharacter as Ze}from"@primeuix/utils";import*as le from"react";var De=500;function Oe({props:t,elementRef:e,visibleKeys:a,findNodeByKey:r,onNodeToggle:T,onClick:v,setFocusedKey:M}){let u=le.useRef(null),k=le.useRef("");le.useEffect(()=>()=>{u.current&&(clearTimeout(u.current),u.current=null)},[]);let i=l=>{if(!e.current)return;let g=e.current.querySelector(`[role="treeitem"][data-node-key="${CSS.escape(l)}"]`);if(!g)return;e.current.querySelectorAll('[role="treeitem"]').forEach(P=>{P.tabIndex=-1}),g.tabIndex=0,Le(g)},f=(l,g)=>{var P,A;let E=(A=(P=a[l])!=null?P:g)!=null?A:null;E&&(M(E),i(E))},L=l=>{let g=a.indexOf(l);g===-1||g>=a.length-1||f(g+1)},F=l=>{let g=a.indexOf(l);g<=0||f(g-1)},I=()=>{a.length>0&&f(0)},Y=()=>{a.length>0&&f(a.length-1)},U=(l,g)=>{var V,C;if(k.current=(k.current||"")+l,u.current&&clearTimeout(u.current),!e.current){u.current=setTimeout(()=>{k.current="",u.current=null},De);return}let E=Array.from(e.current.querySelectorAll('[role="treeitem"]')),P=E.find(n=>n.getAttribute("data-node-key")===g.key);if(!P){u.current=setTimeout(()=>{k.current="",u.current=null},De);return}let A=E.indexOf(P),x=k.current.toLowerCase(),R=null;for(let n=A+1;n<E.length;n++){let o=E[n];if((((V=o.textContent)==null?void 0:V.trim().toLowerCase())||"").startsWith(x)){R=o;break}}if(!R)for(let n=0;n<=A;n++){let o=E[n];if((((C=o.textContent)==null?void 0:C.trim().toLowerCase())||"").startsWith(x)){R=o;break}}if(R&&R!==P){let n=R.getAttribute("data-node-key");n&&(M(n),E.forEach(o=>{o.tabIndex=-1}),R.tabIndex=0,Le(R))}u.current=setTimeout(()=>{k.current="",u.current=null},De)};return{onKeyDown:(l,g,E,P,A)=>{var C;let x=l.target,R=l.currentTarget;if(!R||!R.isSameNode(x)&&!R.isSameNode(x.closest('[role="treeitem"]')))return;let V=l.metaKey||l.ctrlKey;switch(l.code){case"ArrowDown":l.preventDefault(),L(g.key);break;case"ArrowUp":l.preventDefault(),F(g.key);break;case"ArrowRight":l.preventDefault(),!A&&!P?T(l,g):!A&&P&&L(g.key);break;case"ArrowLeft":if(l.preventDefault(),!A&&P)T(l,g);else{let n=a.indexOf(g.key);for(let o=n-1;o>=0;o--){let s=a[o],d=r(s);if((C=d==null?void 0:d.children)!=null&&C.length){M(s),i(s);break}}}break;case"Home":l.preventDefault(),I();break;case"End":l.preventDefault(),Y();break;case"Enter":case"NumpadEnter":case"Space":l.preventDefault(),v(l,g,!0);break;default:!V&&Ze(l.key)&&U(l.key,g);break}},onFilterKeyUp:l=>{(l.code==="Enter"||l.code==="NumpadEnter")&&l.preventDefault()}}}import*as J from"react";function Fe({props:t,selectedKeyState:e,setSelectedKeyState:a,getNodes:r,getVisibleKeys:T}){let v=()=>t.selectionMode==="single",M=()=>t.selectionMode==="multiple",u=()=>t.selectionMode==="checkbox",k=J.useCallback(n=>{var s;return!t.selectionMode||!e?!1:u()?((s=e[n.key])==null?void 0:s.checked)===!0:e[n.key]===!0},[t.selectionMode,e]),i=(n,o)=>{var s;(s=t.onSelect)==null||s.call(t,{originalEvent:n,node:o})},f=(n,o)=>{var s;(s=t.onUnselect)==null||s.call(t,{originalEvent:n,node:o})},L=(n,o)=>{let s=n.metaKey||n.ctrlKey,d=k(o),D=e||{},N={};return d&&s?(v()?N={}:(N=b({},D),delete N[o.key]),f(n,o)):(v()?N={}:M()&&(N=s?b({},D):{}),N[o.key]=!0,i(n,o)),N},F=(n,o)=>{let s=k(o),d=e||{},D=o.key,N={};return v()?s?(N={},f(n,o)):(N={[D]:!0},i(n,o)):s?(N=b({},d),delete N[D],f(n,o)):(N=q(b({},d),{[D]:!0}),i(n,o)),N},I=(n,o,s=!1)=>{var N;if(t.selectionMode==null||o.disabled===!0)return;let D=(s?!1:t.metaKeySelection)?L(n,o):F(n,o);a([D,{originalEvent:n,value:D}]),(N=t.onClick)==null||N.call(t,{originalEvent:n,node:o})},Y=(n,o,s)=>{var d;if(o&&n.disabled!==!0?s[n.key]={checked:!0,partialChecked:!1}:delete s[n.key],(d=n.children)!=null&&d.length)for(let D of n.children)Y(D,o,s)},U=(n,o)=>{var D,N;if(!n.children||n.children.length===0)return o;let s=0,d=!1;for(let j of n.children)(D=o[j.key])!=null&&D.checked?s++:(N=o[j.key])!=null&&N.partialChecked&&(d=!0);return s===n.children.length?o[n.key]={checked:!0,partialChecked:!1}:(delete o[n.key],(d||s>0&&s!==n.children.length)&&(o[n.key]={checked:!1,partialChecked:!0})),o},z=(n,o,s=null)=>{for(let d of n){if(d.key===o)return s;if(d.children){let D=z(d.children,o,d);if(D!==null)return D}}return null},B=(n,o)=>{var oe;if(!o||o.disabled===!0)return;let d=b({},e||{}),D=o.key,j=!(((oe=d[D])==null?void 0:oe.checked)===!0);j?i(n,o):f(n,o),Y(o,j,d);let Q=z(r(),D);for(;Q;)U(Q,d),Q=z(r(),Q.key);a([d,{originalEvent:n,value:d}])},l=(n,o,s=!1)=>{u()?B(n,o):I(n,o,s)},g=(n,o)=>{let s=o!=null?o:{};a([n,{originalEvent:s,value:n}])},E=J.useCallback(n=>{var o;return e?u()?((o=e[n])==null?void 0:o.checked)===!0:e[n]===!0:!1},[t.selectionMode,e]),P=J.useCallback(n=>{var o;return!e||!u()?!1:((o=e[n])==null?void 0:o.partialChecked)===!0},[t.selectionMode,e]),A=J.useMemo(()=>{let n=T();if(n.length===0||!e)return{all:!1,some:!1};let o=0;for(let s of n){let d=e[s];(u()?(d==null?void 0:d.checked)===!0:d===!0)&&o++}return{all:o===n.length,some:o>0&&o<n.length}},[T,e,t.selectionMode]),x=J.useCallback(()=>A.all,[A]),R=J.useCallback(()=>A.some,[A]),V=J.useCallback((n,o,s)=>{let d=r().length>0?Ve(r(),o):void 0;d&&(s==="checkbox"?B(n,d):s==="radio"?E(o)||g({[o]:!0},n):I(n,d,!0))},[r,E]),C=J.useCallback(n=>{let o=T(),s=x(),d={};if(!s)for(let D of o)d[D]=u()?{checked:!0,partialChecked:!1}:!0;g(d,n)},[T,x,t.selectionMode]);return{isNodeSelected:k,onNodeClick:I,onCheckboxChange:B,onClick:l,setSelectionKeys:g,isSelected:E,isPartiallySelected:P,isAllSelected:x,isSomeSelected:R,toggleSelection:V,toggleAll:C}}function Ve(t,e){for(let a of t){if(a.key===e)return a;if(a.children){let r=Ve(a.children,e);if(r)return r}}}var St=et({name:"useTree",defaultProps:Pe,setup({props:t,elementRef:e,id:a}){var de,ue;let r=w.useRef((de=t.defaultExpandedKeys)!=null?de:{}),[T,v]=_e({value:t.expandedKeys,defaultValue:r.current,onChange:t.onExpandedChange}),M=w.useRef((ue=t.defaultSelectionKeys)!=null?ue:{}),[u,k]=_e({value:t.selectionKeys,defaultValue:M.current,onChange:t.onSelectionChange}),[i,f]=w.useState(null),[L,F]=w.useState(!1),{nodeMap:I,flatOrder:Y}=Ae(t.value),U=He(t.value,T),z=U.length,B=w.useCallback(y=>{var S;return(S=I.get(y))==null?void 0:S.node},[I]),l=w.useCallback(y=>{let S=I.get(y);return S?{level:S.level,posInSet:S.posInSet,setSize:S.setSize,parentKey:S.parentKey}:{level:1,posInSet:1,setSize:1,parentKey:null}},[I]),g=w.useCallback(()=>t.value||[],[t.value]);w.useEffect(()=>{var y;i===null&&U.length>0?f(U[0]):i&&!I.has(i)&&f((y=U[0])!=null?y:null)},[U,i,I]);let E=w.useCallback(y=>{var S;f(y),(S=t.onFocusedKeyChange)==null||S.call(t,{value:y})},[t]),P=w.useRef(U);P.current=U;let A=w.useCallback(()=>P.current,[]),x=Fe({props:t,selectedKeyState:u,setSelectedKeyState:k,getNodes:g,getVisibleKeys:A}),R=(y,S)=>{var Z,re,ae,te;if(S.disabled===!0)return;let X=T||{},G=S.key,W;X[G]?(W=b({},X),delete W[G],(Z=t.onCollapse)==null||Z.call(t,{originalEvent:y,node:S}),(re=t.onToggle)==null||re.call(t,{originalEvent:y,node:S})):(W=q(b({},X),{[G]:!0}),(ae=t.onExpand)==null||ae.call(t,{originalEvent:y,node:S}),(te=t.onToggle)==null||te.call(t,{originalEvent:y,node:S})),v([W,{originalEvent:y,value:W}])},V=Oe({props:t,elementRef:e,visibleKeys:U,findNodeByKey:B,onNodeToggle:R,onClick:x.onClick,setFocusedKey:E}),C=we({props:t,setDragHoverState:F,getNodes:g}),n={expandedKey:T,selectedKey:u,focusedKey:i,dragHover:L},o=q(b({id:a,"data-scope":"tree","data-part":"root"},L&&{"data-dragover":""}),{onDragOver:C.onDragOver,onDragEnter:C.onDragEnter,onDragLeave:C.onDragLeave,onDrop:C.onDrop}),s={"data-scope":"tree","data-part":"filter",autoComplete:"off",onKeyUp:V.onFilterKeyUp},d={"data-scope":"tree","data-part":"loading",role:"status","aria-live":"polite"},D=w.useCallback(y=>{let S=y==null?void 0:y.key,X=S?(T||{})[S]===!0:!1,G=W=>{W.stopPropagation(),R(W,y)};return{"data-scope":"tree","data-part":"toggle",[X?"data-expanded":"data-collapsed"]:"",type:"button",tabIndex:-1,onClick:G}},[T]),N=w.useCallback(()=>({"data-scope":"tree","data-part":"toggle-spacer","aria-hidden":!0}),[]),j=w.useCallback(()=>({"data-scope":"tree","data-part":"toggle-indicator","aria-hidden":!0}),[]),Q=w.useCallback((y,S,X,G,W,Z,re,ae)=>{let te=i===(y==null?void 0:y.key),be=Te=>V.onKeyDown(Te,y,S,X,Z),fe=t.selectionMode==="checkbox";return q(b(b(b(b(b({role:"treeitem",tabIndex:te?0:-1,"aria-level":S,"aria-setsize":ae,"aria-posinset":re,"aria-expanded":Z?void 0:X,"aria-selected":t.selectionMode==="single"||t.selectionMode==="multiple"?!!W:void 0,"aria-checked":fe?G:void 0,"data-scope":"tree","data-part":"node","data-node-key":y==null?void 0:y.key},!Z&&{[X?"data-expanded":"data-collapsed"]:""}),(fe?G:W)&&{"data-selected":""}),Z&&{"data-leaf":""}),(y==null?void 0:y.disabled)===!0&&{"data-disabled":""}),te&&{"data-focused":""}),{onKeyDown:be})},[V,t.selectionMode,i]),oe=w.useCallback(()=>({"data-scope":"tree","data-part":"nodes",role:"tree"}),[]);return{state:n,nodeMap:I,flatOrder:Y,visibleKeys:U,visibleCount:z,findNodeByKey:B,findNodeInfo:l,getNodes:g,setFocusedKey:E,setSelectionKeys:x.setSelectionKeys,onKeyDown:V.onKeyDown,onNodeToggle:R,onNodeClick:x.onNodeClick,onClick:x.onClick,onCheckboxChange:x.onCheckboxChange,isNodeSelected:x.isNodeSelected,selection:{isSelected:x.isSelected,isPartiallySelected:x.isPartiallySelected,isAllSelected:x.isAllSelected,isSomeSelected:x.isSomeSelected,toggleSelection:x.toggleSelection,toggleAll:x.toggleAll},onFilterKeyUp:V.onFilterKeyUp,onDragOver:C.onDragOver,onDragEnter:C.onDragEnter,onDragLeave:C.onDragLeave,onDrop:C.onDrop,allowDrop:C.allowDrop,rootProps:o,getToggleProps:D,getToggleSpacerProps:N,getToggleIndicatorProps:j,getNodeProps:Q,filterProps:s,loadingProps:d,getNodesProps:oe}}});import{withHeadless as tt}from"@primereact/core/headless";import{getOuterHeight as nt,getOuterWidth as ot}from"@primeuix/utils";import*as ie from"react";var ze={node:void 0,index:void 0,context:void 0,parentContext:void 0,onMove:void 0};function Be(t,e){if(t.key===e)return!0;if(!t.children||t.children.length===0)return!1;for(let a of t.children)if(Be(a,e))return!0;return!1}var Pt=tt({name:"useTreeNode",defaultProps:ze,setup({props:t}){var Ne,Se,ke,Ee,xe,Ce,ve,Re;let e=t.context,a=t.parentContext,r=t.node,T=r==null?void 0:r.key,v=T?((Se=(Ne=e==null?void 0:e.state)==null?void 0:Ne.expandedKey)==null?void 0:Se[T])===!0:!1,M=r&&(ke=e==null?void 0:e.isNodeSelected(r))!=null?ke:!1,u=r?(Ee=r.leaf)!=null?Ee:!r.children||r.children.length===0:!0,k=!1,i=!1;if((e==null?void 0:e.props.selectionMode)==="checkbox"&&T&&((xe=e==null?void 0:e.state)!=null&&xe.selectedKey)){let c=e.state.selectedKey;k=((Ce=c[T])==null?void 0:Ce.checked)===!0,i=((ve=c[T])==null?void 0:ve.partialChecked)===!0}let f=1,L=1,F=1;if(e&&T){let c=e.findNodeInfo(T);f=c.level,L=c.posInSet,F=c.setSize}else if(t.index!==void 0){let c=a==null?void 0:a.node,p=c?c.children:e==null?void 0:e.getNodes();F=(p==null?void 0:p.length)||0,L=t.index+1}let[I,Y]=ie.useState(!1),[U,z]=ie.useState(!1),[B,l]=ie.useState(!1),[g,E]=ie.useState(!1),P=a==null?void 0:a.node,A=(P==null?void 0:P.children)||(e==null?void 0:e.getNodes())||[],x=(e==null?void 0:e.props.draggable)===!0,R=(r==null?void 0:r.draggable)!==!1&&x,V=H.getDragState(),C=(e==null?void 0:e.props.droppable)&&((Re=e==null?void 0:e.allowDrop)==null?void 0:Re.call(e,r)),n=(r==null?void 0:r.droppable)!==!1&&C,o=U&&C,s=B&&C,d=g&&n,D=o?"before":s?"after":"inside",N=(c,p)=>c.reduce((h,m)=>{if(m.key===p.key)return h;if(m.children&&m.children.length>0){let O=N(m.children,p);h.push(q(b({},m),{children:O}))}else h.push(m);return h},[]),j=(c,p,h,m)=>{let O=c.findIndex(K=>K.key===p);if(O!==-1){let K=[...c];return K.splice(O+m,0,h),K}return c.map(K=>K.children&&K.children.length>0?q(b({},K),{children:j(K.children,p,h,m)}):K)},Q=(c,p,h)=>c.map(m=>m.key===p?q(b({},m),{children:[...m.children||[],h]}):m.children&&m.children.length>0?q(b({},m),{children:Q(m.children,p,h)}):m),oe=()=>{var m;let c=V.dragNode,p=(e==null?void 0:e.getNodes())||[];if(!r||!c)return null;let h=N(p,c);return D==="before"?h=j(h,r.key,c,0):D==="after"?h=j(h,r.key,c,1):h=Q(h,r.key,c),{updated:h,dropIndex:(m=t.index)!=null?m:0}},de=c=>{var $;if(!R){c.preventDefault();return}c.stopPropagation(),c.dataTransfer.effectAllowed="all",c.dataTransfer.setData("text","data");let p=c.currentTarget,h=p.cloneNode(!0),m=h.querySelector('[data-part="toggle"]');p.setAttribute("data-dragging","true"),h.style.width=ot(p)+"px",h.style.height=nt(p)+"px",h.setAttribute("data-part","drag-image"),m&&(m.style.visibility="hidden"),document.body.appendChild(h),c.dataTransfer.setDragImage(h,0,0),setTimeout(()=>document.body.removeChild(h),0);let O=($=e==null?void 0:e.getNodes())!=null?$:[],K=se=>{var ne,ce;if(!r)return;let ee=N(O,r);(ce=e==null?void 0:(ne=e.props).onMove)==null||ce.call(ne,{originalEvent:se,value:ee,dragNode:r,dropNode:null,dropIndex:-1,dropPosition:"inside"})};H.startDrag({node:r,subNodes:A,index:t.index,scope:e==null?void 0:e.props.draggableScope,sourceCommit:K})},ue=c=>{if(C){c.dataTransfer.dropEffect="copy";let h=c.currentTarget.getBoundingClientRect(),m=c.clientY-h.top,O=m<h.height*.25,K=m>h.height*.75,$=!O&&!K&&!!n;O!==U&&z(O),K!==B&&l(K),$!==g&&E($)}else c.dataTransfer.dropEffect="none";e!=null&&e.props.droppable&&(c.preventDefault(),c.stopPropagation())},y=()=>{},S=()=>{z(!1),l(!1),E(!1)},X=c=>{var p;c.stopPropagation(),(p=c.currentTarget)==null||p.removeAttribute("data-dragging"),H.stopDrag({node:r})},G=(c,p,h)=>{var $,se,ee,ne,ce;let m=he(c,h,p,r,($=t.index)!=null?$:0,D),{sourceCommit:O}=H.getDragState(),K=((se=e==null?void 0:e.getNodes())!=null?se:[]).some(qe=>Be(qe,p.key));(ee=t.onMove)==null||ee.call(t,m),(ce=e==null?void 0:(ne=e.props).onMove)==null||ce.call(ne,m),O&&!K&&O(c)},W=c=>{var $;if(!C)return;c.preventDefault(),c.stopPropagation();let p=V.dragNode;if(!(D!=="inside"||n)||!p){z(!1),l(!1),E(!1);return}let m=e==null?void 0:e.props.validateMove,O=oe();if(!O){H.stopDrag({node:p});return}let K=()=>{G(c,p,O.updated),H.stopDrag({node:p})};if(m){let se=he(c,O.updated,p,r,($=t.index)!=null?$:0,D),ee=m(se);ee instanceof Promise?ee.then(ne=>{ne?K():H.stopDrag({node:p})}):ee?K():H.stopDrag({node:p})}else K();z(!1),l(!1),E(!1)},Z=c=>{e&&r&&r.disabled!==!0&&(e.onClick(c,r,I),I&&Y(!1))},re=()=>{Y(!0)},ae={expanded:v,selected:M,checked:k,partialChecked:i,leaf:u,level:f,posInSet:L,setSize:F,isNodeDropActive:!!d,isPrevDropPointActive:!!o,isNextDropPointActive:!!s,isDraggable:!!R,nodeTouched:I},te=e==null?void 0:e.getNodeProps(r,f,v,k,M,u,L,F),fe=(e==null?void 0:e.props.selectionMode)==="checkbox"?k:M,Te=!!(e!=null&&e.props.selectionMode&&(r==null?void 0:r.disabled)!==!0),We=q(b(b(b(b(b(b(b(b({"data-scope":"tree","data-part":"content",draggable:!!R},fe&&{"data-selected":""}),Te&&{"data-selectable":""}),!u&&{[v?"data-expanded":"data-collapsed"]:""}),u&&{"data-leaf":""}),k&&{"data-checked":""}),i&&{"data-partial-checked":""}),(r==null?void 0:r.disabled)===!0&&{"data-disabled":""}),d&&{"data-dragover":""}),{onDragStart:de,onDragOver:ue,onDragEnter:y,onDragLeave:S,onDragEnd:X,onDrop:W,onClick:Z,onTouchEnd:re});return{state:ae,parentNode:a,nodeProps:te,contentProps:We,dropPointProps:{"data-scope":"tree","data-part":"drop-point","aria-hidden":!0}}}});export{H as TreeDragDropService,he as buildMoveEvent,Pe as defaultProps,ze as defaultTreeNodeProps,St as useTree,Oe as useTreeKeyboard,Pt as useTreeNode,Ae as useTreeNodeMap,we as useTreeRootDragDrop,Fe as useTreeSelection,He as useTreeVisibleKeys};
2
- //# sourceMappingURL=index.mjs.map
1
+ import{withHeadless as Ue}from"@primereact/core/headless";import{useControlledState as Ee}from"@primereact/hooks/use-controlled-state";import*as M from"react";var pe={value:void 0,expandedKeys:void 0,defaultExpandedKeys:void 0,selectionKeys:void 0,defaultSelectionKeys:void 0,selectionMode:void 0,metaKeySelection:!1,highlightOnSelect:!1,draggable:void 0,droppable:void 0,draggableScope:void 0,droppableScope:void 0,onExpandedChange:void 0,onSelectionChange:void 0,onToggle:void 0,onExpand:void 0,onCollapse:void 0,onClick:void 0,onSelect:void 0,onUnselect:void 0,onMove:void 0,validateMove:void 0,onFocusedKeyChange:void 0,loading:!1};import*as ne from"react";var V={isDragging:!1,dragNode:null,dragScope:null,dragNodeSubNodes:null,dragNodeIndex:null,sourceTreeId:null,sourceCommit:null},le=new Set,ie=new Set,A={getDragState(){return V},startDrag(e){V.isDragging=!0,V.dragNode=e.node,V.dragScope=e.scope??null,V.dragNodeSubNodes=e.subNodes??null,V.dragNodeIndex=e.index??null,V.sourceTreeId=e.sourceTreeId??null,V.sourceCommit=e.sourceCommit??null,le.forEach(t=>t(e))},stopDrag(e){V.isDragging=!1,V.dragNode=null,V.dragScope=null,V.dragNodeSubNodes=null,V.dragNodeIndex=null,V.sourceTreeId=null,V.sourceCommit=null,ie.forEach(t=>t(e))},onDragStart(e){return le.add(e),()=>le.delete(e)},onDragStop(e){return ie.add(e),()=>ie.delete(e)}};function Te(e,t){if(e.key===t)return!0;if(!e.children||e.children.length===0)return!1;for(let c of e.children)if(Te(c,t))return!0;return!1}function ye({props:e,setDragHoverState:t}){ne.useEffect(()=>{if(!e.droppable)return;let s=A.onDragStop(()=>{t(!1)});return()=>{s()}},[e.droppable,t]);let c=ne.useCallback(s=>{let{dragNode:i,dragScope:k}=A.getDragState();return!(!i||!Pe(k,e.droppableScope)||s&&i===s)},[e.droppableScope]),a=s=>{e.droppable&&c()?s.dataTransfer.dropEffect="copy":s.dataTransfer.dropEffect="none",s.preventDefault()},p=()=>{e.droppable&&c()&&t(!0)},P=s=>{if(!e.droppable)return;let i=s.currentTarget.getBoundingClientRect();(s.clientX>=i.right||s.clientX<=i.left||s.clientY>=i.bottom||s.clientY<=i.top)&&t(!1)},C=(s,i,k)=>{let{sourceCommit:U}=A.getDragState(),B=e.value||[],I=B.some(L=>Te(L,i.key)),W=[...B,i],w={originalEvent:s,value:W,dragNode:i,dropNode:null,dropIndex:W.length-1,dropPosition:"inside"},z=()=>{e.onMove?.(w),U&&!I&&U(s),A.stopDrag({node:i})};if(e.validateMove){let L=e.validateMove(w);if(L instanceof Promise){L.then(l=>{l?z():A.stopDrag({node:i})});return}if(!L){A.stopDrag({node:i});return}}z()};return{allowDrop:c,onDragOver:a,onDragEnter:p,onDragLeave:P,onDrop:s=>{if(!e.droppable){t(!1);return}s.preventDefault();let{dragNode:i,dragScope:k,dragNodeIndex:U}=A.getDragState();if(i&&c()){if(Ie(k,e.draggableScope)){A.stopDrag({node:i}),t(!1);return}U!==null&&C(s,i,U)}t(!1)}}}function he(e,t){if(e==null&&t==null)return!0;if(e==null||t==null)return!1;if(typeof t=="string"){if(typeof e=="string")return e===t;if(Array.isArray(e))return e.indexOf(t)!==-1}else if(Array.isArray(t)){if(typeof e=="string")return t.indexOf(e)!==-1;if(Array.isArray(e)){for(let c of e)if(t.indexOf(c)!==-1)return!0;return!1}}return!1}function Pe(e,t){return t==null?!0:he(e,t)}function Ie(e,t){return he(e,t)}function de(e,t,c,a,p,P){return{originalEvent:e,value:t,dragNode:c,dropNode:a,dropIndex:p,dropPosition:P}}import*as ue from"react";function me(e){return ue.useMemo(()=>{let t=new Map,c=[],a=(p,P,C)=>{for(let T=0;T<p.length;T++){let s=p[T];t.set(s.key,{node:s,parentKey:P,level:C,posInSet:T+1,setSize:p.length}),c.push(s.key),s.children?.length&&a(s.children,s.key,C+1)}};return a(e??[],null,1),{nodeMap:t,flatOrder:c}},[e])}function De(e,t){return ue.useMemo(()=>{let c=[],a=t??{},p=P=>{for(let C of P)c.push(C.key),a[C.key]===!0&&C.children?.length&&p(C.children)};return p(e??[]),c},[e,t])}import{focus as be,isPrintableCharacter as we}from"@primeuix/utils";import*as Z from"react";var fe=500;function Ne({props:e,elementRef:t,visibleKeys:c,findNodeByKey:a,onNodeToggle:p,onClick:P,setFocusedKey:C}){let T=Z.useRef(null),s=Z.useRef("");Z.useEffect(()=>()=>{T.current&&(clearTimeout(T.current),T.current=null)},[]);let i=l=>{if(!t.current)return;let f=t.current.querySelector(`[role="treeitem"][data-node-key="${CSS.escape(l)}"]`);if(!f)return;t.current.querySelectorAll('[role="treeitem"]').forEach(O=>{O.tabIndex=-1}),f.tabIndex=0,be(f)},k=(l,f)=>{let N=c[l]??f??null;N&&(C(N),i(N))},U=l=>{let f=c.indexOf(l);f===-1||f>=c.length-1||k(f+1)},B=l=>{let f=c.indexOf(l);f<=0||k(f-1)},I=()=>{c.length>0&&k(0)},W=()=>{c.length>0&&k(c.length-1)},w=(l,f)=>{if(s.current=(s.current||"")+l,T.current&&clearTimeout(T.current),!t.current){T.current=setTimeout(()=>{s.current="",T.current=null},fe);return}let N=Array.from(t.current.querySelectorAll('[role="treeitem"]')),O=N.find(b=>b.getAttribute("data-node-key")===f.key);if(!O){T.current=setTimeout(()=>{s.current="",T.current=null},fe);return}let F=N.indexOf(O),S=s.current.toLowerCase(),E=null;for(let b=F+1;b<N.length;b++){let D=N[b];if((D.textContent?.trim().toLowerCase()||"").startsWith(S)){E=D;break}}if(!E)for(let b=0;b<=F;b++){let D=N[b];if((D.textContent?.trim().toLowerCase()||"").startsWith(S)){E=D;break}}if(E&&E!==O){let b=E.getAttribute("data-node-key");b&&(C(b),N.forEach(D=>{D.tabIndex=-1}),E.tabIndex=0,be(E))}T.current=setTimeout(()=>{s.current="",T.current=null},fe)};return{onKeyDown:(l,f,N,O,F)=>{let S=l.target,E=l.currentTarget;if(!E||!E.isSameNode(S)&&!E.isSameNode(S.closest('[role="treeitem"]')))return;let b=l.metaKey||l.ctrlKey;switch(l.code){case"ArrowDown":l.preventDefault(),U(f.key);break;case"ArrowUp":l.preventDefault(),B(f.key);break;case"ArrowRight":l.preventDefault(),!F&&!O?p(l,f):!F&&O&&U(f.key);break;case"ArrowLeft":if(l.preventDefault(),!F&&O)p(l,f);else{let D=c.indexOf(f.key);for(let r=D-1;r>=0;r--){let n=c[r];if(a(n)?.children?.length){C(n),i(n);break}}}break;case"Home":l.preventDefault(),I();break;case"End":l.preventDefault(),W();break;case"Enter":case"NumpadEnter":case"Space":l.preventDefault(),P(l,f,!0);break;default:!b&&we(l.key)&&w(l.key,f);break}},onFilterKeyUp:l=>{(l.code==="Enter"||l.code==="NumpadEnter")&&l.preventDefault()}}}import*as j from"react";function Se({props:e,selectionKeysState:t,setSelectionKeysState:c,getNodes:a,getVisibleKeys:p}){let P=()=>e.selectionMode==="single",C=()=>e.selectionMode==="multiple",T=()=>e.selectionMode==="checkbox",s=j.useCallback(r=>!e.selectionMode||!t?!1:T()?t[r.key]?.checked===!0:t[r.key]===!0,[e.selectionMode,t]),i=(r,n)=>{e.onSelect?.({originalEvent:r,node:n})},k=(r,n)=>{e.onUnselect?.({originalEvent:r,node:n})},U=(r,n)=>{let d=r.metaKey||r.ctrlKey,u=s(n),h=t||{},R={};return u&&d?(P()?R={}:(R={...h},delete R[n.key]),k(r,n)):(P()?R={}:C()&&(R=d?{...h}:{}),R[n.key]=!0,i(r,n)),R},B=(r,n)=>{let d=s(n),u=t||{},h=n.key,R={};return P()?d?(R={},k(r,n)):(R={[h]:!0},i(r,n)):d?(R={...u},delete R[h],k(r,n)):(R={...u,[h]:!0},i(r,n)),R},I=(r,n,d=!1)=>{if(e.selectionMode==null||n.disabled===!0)return;let h=(d?!1:e.metaKeySelection)?U(r,n):B(r,n);c([h,{originalEvent:r,value:h}]),e.onClick?.({originalEvent:r,node:n})},W=(r,n,d)=>{if(n&&r.disabled!==!0?d[r.key]={checked:!0,partialChecked:!1}:delete d[r.key],r.children?.length)for(let u of r.children)W(u,n,d)},w=(r,n)=>{if(!r.children||r.children.length===0)return n;let d=0,u=!1;for(let h of r.children)n[h.key]?.checked?d++:n[h.key]?.partialChecked&&(u=!0);return d===r.children.length?n[r.key]={checked:!0,partialChecked:!1}:(delete n[r.key],(u||d>0&&d!==r.children.length)&&(n[r.key]={checked:!1,partialChecked:!0})),n},z=(r,n,d=null)=>{for(let u of r){if(u.key===n)return d;if(u.children){let h=z(u.children,n,u);if(h!==null)return h}}return null},L=(r,n)=>{if(!n||n.disabled===!0)return;let u={...t||{}},h=n.key,$=!(u[h]?.checked===!0);$?i(r,n):k(r,n),W(n,$,u);let X=z(a(),h);for(;X;)w(X,u),X=z(a(),X.key);c([u,{originalEvent:r,value:u}])},l=(r,n,d=!1)=>{T()?L(r,n):I(r,n,d)},f=(r,n)=>{c([r,{originalEvent:n??{},value:r}])},N=j.useCallback(r=>t?T()?t[r]?.checked===!0:t[r]===!0:!1,[e.selectionMode,t]),O=j.useCallback(r=>!t||!T()?!1:t[r]?.partialChecked===!0,[e.selectionMode,t]),F=j.useMemo(()=>{let r=p();if(r.length===0||!t)return{all:!1,some:!1};let n=0;for(let d of r){let u=t[d];(T()?u?.checked===!0:u===!0)&&n++}return{all:n===r.length,some:n>0&&n<r.length}},[p,t,e.selectionMode]),S=j.useCallback(()=>F.all,[F]),E=j.useCallback(()=>F.some,[F]),b=j.useCallback((r,n,d)=>{let u=a().length>0?ke(a(),n):void 0;u&&(d==="checkbox"?L(r,u):d==="radio"?N(n)||f({[n]:!0},r):I(r,u,!0))},[a,N]),D=j.useCallback(r=>{let n=p(),d=S(),u={};if(!d)for(let h of n)u[h]=T()?{checked:!0,partialChecked:!1}:!0;f(u,r)},[p,S,e.selectionMode]);return{isNodeSelected:s,onNodeClick:I,onCheckboxChange:L,onClick:l,setSelectionKeys:f,isSelected:N,isPartiallySelected:O,isAllSelected:S,isSomeSelected:E,toggleSelection:b,toggleAll:D}}function ke(e,t){for(let c of e){if(c.key===t)return c;if(c.children){let a=ke(c.children,t);if(a)return a}}}var et=Ue({name:"useTree",defaultProps:pe,setup({props:e,elementRef:t,id:c}){let a=M.useRef(e.defaultExpandedKeys??{}),[p,P]=Ee({value:e.expandedKeys,defaultValue:a.current,onChange:e.onExpandedChange}),C=M.useRef(e.defaultSelectionKeys??{}),[T,s]=Ee({value:e.selectionKeys,defaultValue:C.current,onChange:e.onSelectionChange}),[i,k]=M.useState(null),[U,B]=M.useState(!1),{nodeMap:I,flatOrder:W}=me(e.value),w=De(e.value,p),z=w.length,L=M.useCallback(x=>I.get(x)?.node,[I]),l=M.useCallback(x=>{let K=I.get(x);return K?{level:K.level,posInSet:K.posInSet,setSize:K.setSize,parentKey:K.parentKey}:{level:1,posInSet:1,setSize:1,parentKey:null}},[I]),f=M.useCallback(()=>e.value||[],[e.value]);M.useEffect(()=>{i===null&&w.length>0?k(w[0]):i&&!I.has(i)&&k(w[0]??null)},[w,i,I]);let N=M.useCallback(x=>{k(x),e.onFocusedKeyChange?.({value:x})},[e]),O=M.useRef(w);O.current=w;let F=M.useCallback(()=>O.current,[]),S=Se({props:e,selectionKeysState:T,setSelectionKeysState:s,getNodes:f,getVisibleKeys:F}),E=(x,K)=>{if(K.disabled===!0)return;let q=p||{},Y=K.key,_;q[Y]?(_={...q},delete _[Y],e.onCollapse?.({originalEvent:x,node:K}),e.onToggle?.({originalEvent:x,node:K})):(_={...q,[Y]:!0},e.onExpand?.({originalEvent:x,node:K}),e.onToggle?.({originalEvent:x,node:K})),P([_,{originalEvent:x,value:_}])},b=Ne({props:e,elementRef:t,visibleKeys:w,findNodeByKey:L,onNodeToggle:E,onClick:S.onClick,setFocusedKey:N}),D=ye({props:e,setDragHoverState:B,getNodes:f}),r={expandedKeys:p,selectionKeys:T,focusedKey:i,dragHover:U},n={id:c,"data-scope":"tree","data-part":"root",...U&&{"data-dragover":""},onDragOver:D.onDragOver,onDragEnter:D.onDragEnter,onDragLeave:D.onDragLeave,onDrop:D.onDrop},d={"data-scope":"tree","data-part":"filter",autoComplete:"off",onKeyUp:b.onFilterKeyUp},u={"data-scope":"tree","data-part":"loading",role:"status","aria-live":"polite"},h=M.useCallback(x=>{let K=x?.key,q=K?(p||{})[K]===!0:!1,Y=_=>{_.stopPropagation(),E(_,x)};return{"data-scope":"tree","data-part":"toggle",[q?"data-expanded":"data-collapsed"]:"",type:"button",tabIndex:-1,onClick:Y}},[p]),R=M.useCallback(()=>({"data-scope":"tree","data-part":"toggle-spacer","aria-hidden":!0}),[]),$=M.useCallback(()=>({"data-scope":"tree","data-part":"toggle-indicator","aria-hidden":!0}),[]),X=M.useCallback((x,K,q,Y,_,J,ae,se)=>{let te=i===x?.key,ce=ge=>b.onKeyDown(ge,x,K,q,J),re=e.selectionMode==="checkbox";return{role:"treeitem",tabIndex:te?0:-1,"aria-level":K,"aria-setsize":se,"aria-posinset":ae,"aria-expanded":J?void 0:q,"aria-selected":e.selectionMode==="single"||e.selectionMode==="multiple"?!!_:void 0,"aria-checked":re?Y:void 0,"data-scope":"tree","data-part":"node","data-node-key":x?.key,...!J&&{[q?"data-expanded":"data-collapsed"]:""},...(re?Y:_)&&{"data-selected":""},...J&&{"data-leaf":""},...x?.disabled===!0&&{"data-disabled":""},...te&&{"data-focused":""},onKeyDown:ce}},[b,e.selectionMode,i]),oe=M.useCallback(()=>({"data-scope":"tree","data-part":"nodes",role:"tree"}),[]);return{state:r,nodeMap:I,flatOrder:W,visibleKeys:w,visibleCount:z,findNodeByKey:L,findNodeInfo:l,getNodes:f,setFocusedKey:N,setSelectionKeys:S.setSelectionKeys,onKeyDown:b.onKeyDown,onNodeToggle:E,onNodeClick:S.onNodeClick,onClick:S.onClick,onCheckboxChange:S.onCheckboxChange,isNodeSelected:S.isNodeSelected,selection:{isSelected:S.isSelected,isPartiallySelected:S.isPartiallySelected,isAllSelected:S.isAllSelected,isSomeSelected:S.isSomeSelected,toggleSelection:S.toggleSelection,toggleAll:S.toggleAll},onFilterKeyUp:b.onFilterKeyUp,onDragOver:D.onDragOver,onDragEnter:D.onDragEnter,onDragLeave:D.onDragLeave,onDrop:D.onDrop,allowDrop:D.allowDrop,rootProps:n,getToggleProps:h,getToggleSpacerProps:R,getToggleIndicatorProps:$,getNodeProps:X,filterProps:d,loadingProps:u,getNodesProps:oe}}});import{withHeadless as Ae}from"@primereact/core/headless";import{getOuterHeight as He,getOuterWidth as Le}from"@primeuix/utils";import*as ee from"react";var xe={node:void 0,index:void 0,context:void 0,parentContext:void 0,onMove:void 0};function ve(e,t){if(e.key===t)return!0;if(!e.children||e.children.length===0)return!1;for(let c of e.children)if(ve(c,t))return!0;return!1}var lt=Ae({name:"useTreeNode",defaultProps:xe,setup({props:e}){let t=e.context,c=e.parentContext,a=e.node,p=a?.key,P=p?t?.state?.expandedKeys?.[p]===!0:!1,C=a?t?.isNodeSelected(a)??!1:!1,T=a?a.leaf??(!a.children||a.children.length===0):!0,s=!1,i=!1;if(t?.props.selectionMode==="checkbox"&&p&&t?.state?.selectionKeys){let o=t.state.selectionKeys;s=o[p]?.checked===!0,i=o[p]?.partialChecked===!0}let k=1,U=1,B=1;if(t&&p){let o=t.findNodeInfo(p);k=o.level,U=o.posInSet,B=o.setSize}else if(e.index!==void 0){let o=c?.node;B=(o?o.children:t?.getNodes())?.length||0,U=e.index+1}let[I,W]=ee.useState(!1),[w,z]=ee.useState(!1),[L,l]=ee.useState(!1),[f,N]=ee.useState(!1),F=c?.node?.children||t?.getNodes()||[],S=t?.props.draggable===!0,E=a?.draggable!==!1&&S,b=A.getDragState(),D=t?.props.droppable&&t?.allowDrop?.(a),r=a?.droppable!==!1&&D,n=w&&D,d=L&&D,u=f&&r,h=n?"before":d?"after":"inside",R=(o,m)=>o.reduce((g,y)=>{if(y.key===m.key)return g;if(y.children&&y.children.length>0){let H=R(y.children,m);g.push({...y,children:H})}else g.push(y);return g},[]),$=(o,m,g,y)=>{let H=o.findIndex(v=>v.key===m);if(H!==-1){let v=[...o];return v.splice(H+y,0,g),v}return o.map(v=>v.children&&v.children.length>0?{...v,children:$(v.children,m,g,y)}:v)},X=(o,m,g)=>o.map(y=>y.key===m?{...y,children:[...y.children||[],g]}:y.children&&y.children.length>0?{...y,children:X(y.children,m,g)}:y),oe=()=>{let o=b.dragNode,m=t?.getNodes()||[];if(!a||!o)return null;let g=R(m,o);return h==="before"?g=$(g,a.key,o,0):h==="after"?g=$(g,a.key,o,1):g=X(g,a.key,o),{updated:g,dropIndex:e.index??0}},x=o=>{if(!E){o.preventDefault();return}o.stopPropagation(),o.dataTransfer.effectAllowed="all",o.dataTransfer.setData("text","data");let m=o.currentTarget,g=m.cloneNode(!0),y=g.querySelector('[data-part="toggle"]');m.setAttribute("data-dragging","true"),g.style.width=Le(m)+"px",g.style.height=He(m)+"px",g.setAttribute("data-part","drag-image"),y&&(y.style.visibility="hidden"),document.body.appendChild(g),o.dataTransfer.setDragImage(g,0,0),setTimeout(()=>document.body.removeChild(g),0);let H=t?.getNodes()??[],v=G=>{if(!a)return;let Q=R(H,a);t?.props.onMove?.({originalEvent:G,value:Q,dragNode:a,dropNode:null,dropIndex:-1,dropPosition:"inside"})};A.startDrag({node:a,subNodes:F,index:e.index,scope:t?.props.draggableScope,sourceCommit:v})},K=o=>{if(D){o.dataTransfer.dropEffect="copy";let g=o.currentTarget.getBoundingClientRect(),y=o.clientY-g.top,H=y<g.height*.25,v=y>g.height*.75,G=!H&&!v&&!!r;H!==w&&z(H),v!==L&&l(v),G!==f&&N(G)}else o.dataTransfer.dropEffect="none";t?.props.droppable&&(o.preventDefault(),o.stopPropagation())},q=()=>{},Y=()=>{z(!1),l(!1),N(!1)},_=o=>{o.stopPropagation(),o.currentTarget?.removeAttribute("data-dragging"),A.stopDrag({node:a})},J=(o,m,g)=>{let y=de(o,g,m,a,e.index??0,h),{sourceCommit:H}=A.getDragState(),v=(t?.getNodes()??[]).some(G=>ve(G,m.key));e.onMove?.(y),t?.props.onMove?.(y),H&&!v&&H(o)},ae=o=>{if(!D)return;o.preventDefault(),o.stopPropagation();let m=b.dragNode;if(!(h!=="inside"||r)||!m){z(!1),l(!1),N(!1);return}let y=t?.props.validateMove,H=oe();if(!H){A.stopDrag({node:m});return}let v=()=>{J(o,m,H.updated),A.stopDrag({node:m})};if(y){let G=de(o,H.updated,m,a,e.index??0,h),Q=y(G);Q instanceof Promise?Q.then(Me=>{Me?v():A.stopDrag({node:m})}):Q?v():A.stopDrag({node:m})}else v();z(!1),l(!1),N(!1)},se=o=>{t&&a&&a.disabled!==!0&&(t.onClick(o,a,I),I&&W(!1))},te=()=>{W(!0)},ce={expanded:P,selected:C,checked:s,partialChecked:i,leaf:T,level:k,posInSet:U,setSize:B,isNodeDropActive:!!u,isPrevDropPointActive:!!n,isNextDropPointActive:!!d,isDraggable:!!E,nodeTouched:I},re=t?.getNodeProps(a,k,P,s,C,T,U,B),Ce=t?.props.selectionMode==="checkbox"?s:C,Re=!!(t?.props.selectionMode&&a?.disabled!==!0),Ke={"data-scope":"tree","data-part":"content",draggable:!!E,...Ce&&{"data-selected":""},...Re&&{"data-selectable":""},...!T&&{[P?"data-expanded":"data-collapsed"]:""},...T&&{"data-leaf":""},...s&&{"data-checked":""},...i&&{"data-partial-checked":""},...a?.disabled===!0&&{"data-disabled":""},...u&&{"data-dragover":""},onDragStart:x,onDragOver:K,onDragEnter:q,onDragLeave:Y,onDragEnd:_,onDrop:ae,onClick:se,onTouchEnd:te};return{state:ce,parentNode:c,nodeProps:re,contentProps:Ke,dropPointProps:{"data-scope":"tree","data-part":"drop-point","aria-hidden":!0}}}});export{A as TreeDragDropService,de as buildMoveEvent,pe as defaultProps,xe as defaultTreeNodeProps,et as useTree,Ne as useTreeKeyboard,lt as useTreeNode,me as useTreeNodeMap,ye as useTreeRootDragDrop,Se as useTreeSelection,De as useTreeVisibleKeys};
package/tree/useTree.d.ts CHANGED
@@ -2,8 +2,8 @@ import type { TreeExpandedKeys, TreeNodeData } from '@primereact/types/headless/
2
2
  import * as React from 'react';
3
3
  export declare const useTree: (inProps?: unknown) => import("@primereact/types/core").HeadlessInstance<import("@primereact/types/headless/tree").UseTreeProps, unknown, {
4
4
  state: {
5
- expandedKey: TreeExpandedKeys | undefined;
6
- selectedKey: import("@primereact/types/headless/tree").TreeSelectionKeys | import("@primereact/types/headless/tree").TreeCheckboxSelectionKeys | undefined;
5
+ expandedKeys: TreeExpandedKeys | undefined;
6
+ selectionKeys: import("@primereact/types/headless/tree").TreeSelectionKeys | import("@primereact/types/headless/tree").TreeCheckboxSelectionKeys | undefined;
7
7
  focusedKey: string | null;
8
8
  dragHover: boolean;
9
9
  };
@@ -37,13 +37,13 @@ export declare const useTree: (inProps?: unknown) => import("@primereact/types/c
37
37
  };
38
38
  onFilterKeyUp: (event: React.KeyboardEvent) => void;
39
39
  onDragOver: (event: React.DragEvent) => void;
40
- onDragEnter: (_event: React.DragEvent) => void;
40
+ onDragEnter: () => void;
41
41
  onDragLeave: (event: React.DragEvent) => void;
42
42
  onDrop: (event: React.DragEvent) => void;
43
43
  allowDrop: (dropNode?: TreeNodeData) => boolean;
44
44
  rootProps: {
45
45
  onDragOver: (event: React.DragEvent) => void;
46
- onDragEnter: (_event: React.DragEvent) => void;
46
+ onDragEnter: () => void;
47
47
  onDragLeave: (event: React.DragEvent) => void;
48
48
  onDrop: (event: React.DragEvent) => void;
49
49
  'data-dragover'?: "" | undefined;
@@ -10,10 +10,10 @@ export interface UseTreeDragDropDeps {
10
10
  * Commits a drop through a single `onMove` event; `validateMove` may return a
11
11
  * Promise and the move only fires when it resolves truthy.
12
12
  */
13
- export declare function useTreeRootDragDrop({ props, setDragHoverState, getNodes }: UseTreeDragDropDeps): {
13
+ export declare function useTreeRootDragDrop({ props, setDragHoverState }: UseTreeDragDropDeps): {
14
14
  allowDrop: (dropNode?: TreeNodeData) => boolean;
15
15
  onDragOver: (event: React.DragEvent) => void;
16
- onDragEnter: (_event: React.DragEvent) => void;
16
+ onDragEnter: () => void;
17
17
  onDragLeave: (event: React.DragEvent) => void;
18
18
  onDrop: (event: React.DragEvent) => void;
19
19
  };
@@ -10,4 +10,4 @@ export declare function useTreeNodeMap(value: TreeNodeData[] | undefined): {
10
10
  /**
11
11
  * DFS keys of the rows that are currently visible (ancestors all expanded).
12
12
  */
13
- export declare function useTreeVisibleKeys(value: TreeNodeData[] | undefined, expandedKey: TreeExpandedKeys | undefined): string[];
13
+ export declare function useTreeVisibleKeys(value: TreeNodeData[] | undefined, expandedKeys: TreeExpandedKeys | undefined): string[];
@@ -6,8 +6,8 @@ type SelectionSetter = (next: [TreeSelectionKeys | TreeCheckboxSelectionKeys, {
6
6
  }]) => void;
7
7
  export interface UseTreeSelectionDeps {
8
8
  props: UseTreeProps;
9
- selectedKeyState: TreeSelectionKeys | TreeCheckboxSelectionKeys | undefined;
10
- setSelectedKeyState: SelectionSetter;
9
+ selectionKeysState: TreeSelectionKeys | TreeCheckboxSelectionKeys | undefined;
10
+ setSelectionKeysState: SelectionSetter;
11
11
  getNodes: () => TreeNodeData[];
12
12
  getVisibleKeys: () => string[];
13
13
  }
@@ -15,7 +15,7 @@ export interface UseTreeSelectionDeps {
15
15
  * Selection state for single / multiple / checkbox modes, including the
16
16
  * up/down cascade used by checkbox tri-state.
17
17
  */
18
- export declare function useTreeSelection({ props, selectedKeyState, setSelectedKeyState, getNodes, getVisibleKeys }: UseTreeSelectionDeps): {
18
+ export declare function useTreeSelection({ props, selectionKeysState, setSelectionKeysState, getNodes, getVisibleKeys }: UseTreeSelectionDeps): {
19
19
  isNodeSelected: (node: TreeNodeData) => boolean;
20
20
  onNodeClick: (event: React.MouseEvent | React.KeyboardEvent, node: TreeNodeData, nodeTouched?: boolean) => void;
21
21
  onCheckboxChange: (event: React.SyntheticEvent, node: TreeNodeData) => void;
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/accordion/useAccordion.ts","../../src/accordion/useAccordion.props.ts","../../src/accordion/useAccordionPanel.ts","../../src/accordion/useAccordionPanel.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { useControlledState } from '@primereact/hooks/use-controlled-state';\nimport * as React from 'react';\nimport { defaultProps } from './useAccordion.props';\n\nexport const useAccordion = withHeadless({\n name: 'useAccordion',\n defaultProps,\n setup({ props }) {\n const [activeValueState, setActiveValueState] = useControlledState({\n value: props.value,\n defaultValue: props.defaultValue ?? null,\n onChange: props.onValueChange\n });\n\n const state = {\n value: activeValueState\n };\n\n // methods\n const updateValue = (event: React.SyntheticEvent, key: null | undefined | string | number) => {\n if (key === undefined) return;\n\n let activeValue = activeValueState;\n const isActive = isItemActive(key);\n\n if (props.multiple) {\n const arrayValue = Array.isArray(activeValue) ? activeValue : [];\n\n activeValue = isActive ? arrayValue.filter((k) => k !== key) : key !== null && key !== undefined ? [...arrayValue, key] : arrayValue;\n } else {\n activeValue = isActive ? null : key;\n }\n\n setActiveValueState([\n activeValue,\n {\n originalEvent: event,\n value: activeValue\n }\n ]);\n };\n\n const isItemActive = (key: null | undefined | string | number): boolean => {\n if (key === null || key === undefined) return false;\n\n if (props.multiple) {\n const arrayValue = activeValueState as (string | number)[] | null | undefined;\n\n return Array.isArray(arrayValue) && arrayValue.includes(key as string | number);\n } else {\n return activeValueState === key;\n }\n };\n\n // prop getters\n const rootProps = {\n 'data-scope': 'accordion',\n 'data-part': 'root',\n ...(props.disabled ? { 'data-disabled': '' } : undefined)\n };\n\n return {\n state,\n // prop getters\n rootProps,\n // methods\n updateValue,\n isItemActive\n };\n }\n});\n","import type { UseAccordionProps } from '@primereact/types/headless/accordion';\n\nexport const defaultProps: UseAccordionProps = {\n defaultValue: undefined,\n value: undefined,\n multiple: false,\n disabled: false,\n tabIndex: 0,\n onValueChange: undefined,\n openOnFocus: false\n};\n","import { withHeadless } from '@primereact/core/headless';\nimport { findSingle, focus, getAttribute } from '@primeuix/utils/dom';\nimport * as React from 'react';\nimport { defaultPanelProps } from './useAccordionPanel.props';\n\ntype NavigationDirection = 'next' | 'previous' | 'first' | 'last';\n\nexport const useAccordionPanel = withHeadless({\n name: 'useAccordionPanel',\n defaultProps: defaultPanelProps,\n setup({ props, id }) {\n const context = props.context;\n const open = context?.isItemActive(props.value) ?? false;\n const disabled = props.disabled || context?.props?.disabled;\n\n const state = {\n open,\n disabled\n };\n\n // methods\n const onClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n context?.updateValue(event, props.value);\n };\n\n const onFocus = (event: React.FocusEvent<HTMLButtonElement>) => {\n if (context?.props?.openOnFocus) {\n context?.updateValue(event, props.value);\n }\n };\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n switch (event.code) {\n case 'ArrowDown':\n focusPanel(event.currentTarget, 'next');\n break;\n\n case 'ArrowUp':\n focusPanel(event.currentTarget, 'previous');\n break;\n\n case 'Home':\n focusPanel(event.currentTarget, 'first');\n break;\n\n case 'End':\n focusPanel(event.currentTarget, 'last');\n break;\n\n case 'Enter':\n case 'NumpadEnter':\n case 'Space':\n context?.updateValue(event, props.value);\n break;\n\n case 'Tab':\n return;\n\n default:\n break;\n }\n\n event.preventDefault();\n };\n\n const focusPanel = (accordionHeader: HTMLElement | null, direction: NavigationDirection): void => {\n const findHeader = (panelElement: HTMLElement): HTMLElement | null => {\n return findSingle(panelElement, '[data-scope=\"accordion\"][data-part=\"trigger\"]') as HTMLElement | null;\n };\n\n const findAdjacentPanel = (panelElement: HTMLElement, dir: 'next' | 'previous', selfCheck = false): HTMLElement | null => {\n const siblingProperty = dir === 'next' ? 'nextElementSibling' : 'previousElementSibling';\n const element = selfCheck ? panelElement : (panelElement[siblingProperty] as HTMLElement | null);\n\n if (!element) {\n return null;\n }\n\n if (getAttribute(element, 'data-disabled')) {\n return findAdjacentPanel(element, dir);\n }\n\n return findHeader(element);\n };\n\n const findBoundaryPanel = (boundary: 'first' | 'last'): HTMLElement | null => {\n const accordionElement = context?.elementRef?.current;\n\n if (!accordionElement) return null;\n\n const targetChild = boundary === 'first' ? accordionElement.firstElementChild : accordionElement.lastElementChild;\n\n if (!targetChild) return null;\n\n const dir = boundary === 'first' ? 'next' : 'previous';\n\n return findAdjacentPanel(targetChild as HTMLElement, dir, true);\n };\n\n const currentPanel = accordionHeader?.closest('[data-scope=\"accordion\"][data-part=\"panel\"]') as HTMLElement | null;\n\n if (!currentPanel) return;\n\n let targetPanel: HTMLElement | null = null;\n\n switch (direction) {\n case 'next':\n targetPanel = findAdjacentPanel(currentPanel, 'next');\n\n if (!targetPanel) {\n targetPanel = findBoundaryPanel('first');\n }\n\n break;\n\n case 'previous':\n targetPanel = findAdjacentPanel(currentPanel, 'previous');\n\n if (!targetPanel) {\n targetPanel = findBoundaryPanel('last');\n }\n\n break;\n\n case 'first':\n targetPanel = findBoundaryPanel('first');\n break;\n\n case 'last':\n targetPanel = findBoundaryPanel('last');\n break;\n }\n\n if (targetPanel) {\n focus(targetPanel);\n }\n };\n\n // prop getters\n const contentId = id ? `${id}_content` : undefined;\n\n const contentProps = {\n id: contentId,\n 'data-scope': 'accordion',\n 'data-part': 'content',\n role: 'region' as const,\n 'aria-hidden': !open,\n [open ? 'data-open' : 'data-closed']: '',\n 'data-disabled': props.disabled || undefined\n };\n\n const triggerProps = {\n 'data-scope': 'accordion',\n 'data-part': 'trigger',\n type: 'button' as const,\n tabIndex: disabled ? -1 : context?.props?.tabIndex,\n disabled: disabled || undefined,\n 'aria-expanded': open,\n 'aria-disabled': disabled || undefined,\n 'aria-controls': contentId,\n [open ? 'data-content-open' : 'data-content-closed']: '',\n 'data-disabled': disabled || undefined,\n onClick,\n onFocus,\n onKeyDown\n };\n\n const indicatorProps = {\n 'data-scope': 'accordion',\n 'data-part': 'indicator',\n [open ? 'data-open' : 'data-closed']: ''\n };\n\n const headerProps = {\n 'data-scope': 'accordion',\n 'data-part': 'header',\n [open ? 'data-open' : 'data-closed']: ''\n };\n\n const panelProps = {\n 'data-scope': 'accordion',\n 'data-part': 'panel',\n ...(disabled ? { 'data-disabled': '' } : undefined),\n [open ? 'data-open' : 'data-closed']: ''\n };\n\n return {\n state,\n // prop getters\n panelProps,\n headerProps,\n triggerProps,\n contentProps,\n indicatorProps\n };\n }\n});\n","import type { UseAccordionPanelProps } from '@primereact/types/headless/accordion';\n\nexport const defaultPanelProps: UseAccordionPanelProps = {\n value: undefined,\n disabled: false,\n context: undefined\n};\n"],"mappings":"6aAAA,OAAS,gBAAAA,MAAoB,4BAC7B,OAAS,sBAAAC,MAA0B,yCCC5B,IAAMC,EAAkC,CAC3C,aAAc,OACd,MAAO,OACP,SAAU,GACV,SAAU,GACV,SAAU,EACV,cAAe,OACf,YAAa,EACjB,EDLO,IAAMC,EAAeC,EAAa,CACrC,KAAM,eACN,aAAAC,EACA,MAAM,CAAE,MAAAC,CAAM,EAAG,CARrB,IAAAC,EASQ,GAAM,CAACC,EAAkBC,CAAmB,EAAIC,EAAmB,CAC/D,MAAOJ,EAAM,MACb,cAAcC,EAAAD,EAAM,eAAN,KAAAC,EAAsB,KACpC,SAAUD,EAAM,aACpB,CAAC,EAEKK,EAAQ,CACV,MAAOH,CACX,EAGMI,EAAc,CAACC,EAA6BC,IAA4C,CAC1F,GAAIA,IAAQ,OAAW,OAEvB,IAAIC,EAAcP,EACZQ,EAAWC,EAAaH,CAAG,EAEjC,GAAIR,EAAM,SAAU,CAChB,IAAMY,EAAa,MAAM,QAAQH,CAAW,EAAIA,EAAc,CAAC,EAE/DA,EAAcC,EAAWE,EAAW,OAAQC,GAAMA,IAAML,CAAG,EAAIA,GAAQ,KAA4B,CAAC,GAAGI,EAAYJ,CAAG,EAAII,CAC9H,MACIH,EAAcC,EAAW,KAAOF,EAGpCL,EAAoB,CAChBM,EACA,CACI,cAAeF,EACf,MAAOE,CACX,CACJ,CAAC,CACL,EAEME,EAAgBH,GAAqD,CACvE,GAAIA,GAAQ,KAA2B,MAAO,GAE9C,GAAIR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A,CAAE,WAAa,OAEnC+B,EAAe,CACjB,GAAID,EACJ,aAAc,YACd,YAAa,UACb,KAAM,SACN,cAAe,CAACzB,EAChB,CAACA,EAAO,YAAc,aAAa,EAAG,GACtC,gBAAiBN,EAAM,UAAY,MACvC,EAEMiC,EAAe,CACjB,aAAc,YACd,YAAa,UACb,KAAM,SACN,SAAU1B,EAAW,IAAKH,EAAAC,GAAA,YAAAA,EAAS,QAAT,YAAAD,EAAgB,SAC1C,SAAUG,GAAY,OACtB,gBAAiBD,EACjB,gBAAiBC,GAAY,OAC7B,gBAAiBwB,EACjB,CAACzB,EAAO,oBAAsB,qBAAqB,EAAG,GACtD,gBAAiBC,GAAY,OAC7B,QAAAE,EACA,QAAAE,EACA,UAAAC,CACJ,EAEMsB,EAAiB,CACnB,aAAc,YACd,YAAa,YACb,CAAC5B,EAAO,YAAc,aAAa,EAAG,EAC1C,EAEM6B,EAAc,CAChB,aAAc,YACd,YAAa,SACb,CAAC7B,EAAO,YAAc,aAAa,EAAG,EAC1C,EAEM8B,EAAaC,EAAAC,EAAA,CACf,aAAc,YACd,YAAa,SACT/B,EAAW,CAAE,gBAAiB,EAAG,EAAI,QAH1B,CAIf,CAACD,EAAO,YAAc,aAAa,EAAG,EAC1C,GAEA,MAAO,CACH,MAAAE,EAEA,WAAA4B,EACA,YAAAD,EACA,aAAAF,EACA,aAAAD,EACA,eAAAE,CACJ,CACJ,CACJ,CAAC","names":["withHeadless","useControlledState","defaultProps","useAccordion","withHeadless","defaultProps","props","_a","activeValueState","setActiveValueState","useControlledState","state","updateValue","event","key","activeValue","isActive","isItemActive","arrayValue","k","rootProps","__spreadValues","withHeadless","findSingle","focus","getAttribute","defaultPanelProps","useAccordionPanel","withHeadless","defaultPanelProps","props","id","_a","_b","_c","context","open","disabled","state","onClick","event","onFocus","onKeyDown","focusPanel","accordionHeader","direction","findHeader","panelElement","findSingle","findAdjacentPanel","dir","selfCheck","element","getAttribute","findBoundaryPanel","boundary","accordionElement","targetChild","currentPanel","targetPanel","focus","contentId","contentProps","triggerProps","indicatorProps","headerProps","panelProps","__spreadProps","__spreadValues"]}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/animateonscroll/useAnimateOnScroll.ts","../../src/animateonscroll/useAnimateOnScroll.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { useIntersectionObserver } from '@primereact/hooks/use-intersection-observer';\nimport { useMountEffect } from '@primereact/hooks/use-mount-effect';\nimport { useUnmountEffect } from '@primereact/hooks/use-unmount-effect';\nimport { addClass, removeClass } from '@primeuix/utils/dom';\nimport * as React from 'react';\nimport { defaultProps } from './useAnimateOnScroll.props';\n\nexport const useAnimateOnScroll = withHeadless({\n name: 'useAnimateOnScroll',\n defaultProps,\n setup({ props }) {\n const { enterClassName, leaveClassName, once, ...rest } = props;\n const rootRef = React.useRef<HTMLElement | null>(null);\n const isObserverActiveRef = React.useRef(false);\n const animationEndListener = React.useRef<(() => void) | null>(null);\n const animationState = React.useRef<'enter' | 'leave' | undefined>(undefined);\n\n const setRootRef = React.useCallback((node: HTMLElement | null) => {\n rootRef.current = node;\n }, []);\n\n const { observe, unobserve } = useIntersectionObserver({\n ...rest,\n onIntersect: ([entry]) => {\n if (entry.isIntersecting) {\n enter();\n } else {\n leave();\n }\n\n isObserverActiveRef.current = true;\n }\n });\n\n const { observe: observeReset, unobserve: unobserveReset } = useIntersectionObserver({\n threshold: 0,\n onIntersect: ([entry]) => {\n const el = rootRef.current;\n\n if (!el) return;\n\n if (entry?.boundingClientRect.top > 0 && !entry.isIntersecting) {\n el.style.opacity = enterClassName ? '0' : '';\n\n if (enterClassName) {\n removeClass(el, enterClassName);\n }\n\n if (leaveClassName) {\n removeClass(el, leaveClassName);\n }\n\n unobserveReset(el);\n el.removeAttribute('data-enter');\n el.removeAttribute('data-leave');\n animationState.current = undefined;\n }\n }\n });\n\n const unbindIntersectionObserver = React.useCallback(() => {\n const el = rootRef.current;\n\n if (el) {\n unobserve(el);\n unobserveReset(el);\n isObserverActiveRef.current = false;\n }\n }, [unobserve, unobserveReset]);\n\n const enter = React.useCallback(() => {\n const el = rootRef.current;\n\n if (!el || animationState.current !== undefined) return;\n\n if (animationState.current === 'enter') return;\n\n el.style.opacity = '';\n\n if (enterClassName) {\n if (leaveClassName) {\n removeClass(el, leaveClassName);\n }\n\n addClass(el, enterClassName ?? '');\n el.setAttribute('data-enter', '');\n animationState.current = 'enter';\n\n bindAnimationEvents();\n\n if (once) {\n setTimeout(() => {\n unbindIntersectionObserver();\n }, 0);\n }\n }\n }, [animationState, enterClassName, leaveClassName, once, unbindIntersectionObserver]);\n\n const leave = React.useCallback(() => {\n const el = rootRef.current;\n\n if (!el || animationState.current !== undefined) return;\n\n if (animationState.current === 'leave') return;\n\n if (leaveClassName) {\n if (enterClassName) {\n removeClass(el, enterClassName);\n }\n\n addClass(el, leaveClassName ?? '');\n bindAnimationEvents();\n animationState.current = 'leave';\n el.setAttribute('data-leave', '');\n } else {\n el.style.opacity = '0';\n }\n }, [animationState, enterClassName, leaveClassName]);\n\n const bindAnimationEvents = React.useCallback(() => {\n const el = rootRef.current;\n\n if (!el) return;\n\n if (!animationEndListener.current) {\n animationEndListener.current = () => {\n if (el) {\n if (enterClassName) {\n removeClass(el, enterClassName);\n }\n\n if (leaveClassName) {\n removeClass(el, leaveClassName);\n }\n\n if (!once) {\n observeReset(el);\n }\n\n unbindAnimationEvents();\n\n if (animationState.current === 'leave') {\n el.style.opacity = '0';\n }\n\n if (animationState.current === 'enter') {\n el.style.opacity = '';\n }\n\n el.removeAttribute('data-enter');\n el.removeAttribute('data-leave');\n animationState.current = undefined;\n }\n };\n\n el.addEventListener('animationend', animationEndListener.current);\n el.addEventListener('transitionend', animationEndListener.current);\n }\n }, [enterClassName, leaveClassName, once, observeReset]);\n\n const unbindAnimationEvents = React.useCallback(() => {\n const el = rootRef.current;\n\n if (!el) return;\n\n if (animationEndListener.current) {\n el.removeEventListener('animationend', animationEndListener.current);\n el.removeEventListener('transitionend', animationEndListener.current);\n animationEndListener.current = null;\n }\n }, []);\n\n // Effects\n React.useLayoutEffect(() => {\n if (rootRef.current && enterClassName) {\n rootRef.current.style.opacity = '0';\n }\n }, [enterClassName]);\n\n useMountEffect(() => {\n if (rootRef.current) {\n setTimeout(() => rootRef.current && observe(rootRef.current), 0);\n }\n });\n\n useUnmountEffect(() => {\n if (rootRef.current) {\n rootRef.current.removeAttribute('data-enter');\n rootRef.current.removeAttribute('data-leave');\n unobserve(rootRef.current);\n unobserveReset(rootRef.current);\n unbindAnimationEvents();\n }\n });\n\n const state = {};\n\n // prop getters\n const rootProps = {\n ref: setRootRef,\n 'data-scope': 'animateonscroll',\n 'data-part': 'root'\n };\n\n return {\n state,\n // prop getters\n rootProps\n };\n }\n});\n","import type { UseAnimateOnScrollProps } from '@primereact/types/headless/animateonscroll';\n\nexport const defaultProps: UseAnimateOnScrollProps = {\n enterClassName: '',\n leaveClassName: '',\n once: false,\n root: undefined,\n rootMargin: undefined,\n threshold: 0.5\n};\n"],"mappings":"+kBAAA,OAAS,gBAAAA,MAAoB,4BAC7B,OAAS,2BAAAC,MAA+B,8CACxC,OAAS,kBAAAC,MAAsB,qCAC/B,OAAS,oBAAAC,MAAwB,uCACjC,OAAS,YAAAC,EAAU,eAAAC,MAAmB,sBACtC,UAAYC,MAAW,QCHhB,IAAMC,EAAwC,CACjD,eAAgB,GAChB,eAAgB,GAChB,KAAM,GACN,KAAM,OACN,WAAY,OACZ,UAAW,EACf,EDDO,IAAMC,EAAqBC,EAAa,CAC3C,KAAM,qBACN,aAAAC,EACA,MAAM,CAAE,MAAAC,CAAM,EAAG,CACb,IAA0DC,EAAAD,EAAlD,gBAAAE,EAAgB,eAAAC,EAAgB,KAAAC,CAZhD,EAYkEH,EAATI,EAAAC,EAASL,EAAT,CAAzC,iBAAgB,iBAAgB,SAClCM,EAAgB,SAA2B,IAAI,EAC/CC,EAA4B,SAAO,EAAK,EACxCC,EAA6B,SAA4B,IAAI,EAC7DC,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AQ,SAAWL,IACnBK,EAAQ,QAAQ,MAAM,QAAU,IAExC,EAAG,CAACL,CAAc,CAAC,EAEnB2B,EAAe,IAAM,CACbtB,EAAQ,SACR,WAAW,IAAMA,EAAQ,SAAWM,EAAQN,EAAQ,OAAO,EAAG,CAAC,CAEvE,CAAC,EAEDuB,EAAiB,IAAM,CACfvB,EAAQ,UACRA,EAAQ,QAAQ,gBAAgB,YAAY,EAC5CA,EAAQ,QAAQ,gBAAgB,YAAY,EAC5CO,EAAUP,EAAQ,OAAO,EACzBe,EAAef,EAAQ,OAAO,EAC9BqB,EAAsB,EAE9B,CAAC,EAWM,CACH,MAVU,CAAC,EAYX,UATc,CACd,IAAKjB,EACL,aAAc,kBACd,YAAa,MACjB,CAMA,CACJ,CACJ,CAAC","names":["withHeadless","useIntersectionObserver","useMountEffect","useUnmountEffect","addClass","removeClass","React","defaultProps","useAnimateOnScroll","withHeadless","defaultProps","props","_a","enterClassName","leaveClassName","once","rest","__objRest","rootRef","isObserverActiveRef","animationEndListener","animationState","setRootRef","node","observe","unobserve","useIntersectionObserver","__spreadProps","__spreadValues","entry","enter","leave","observeReset","unobserveReset","el","removeClass","unbindIntersectionObserver","addClass","bindAnimationEvents","unbindAnimationEvents","useMountEffect","useUnmountEffect"]}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/autocomplete/useAutoComplete.ts","../../src/autocomplete/useAutoComplete.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { useListbox } from '@primereact/headless/listbox';\nimport { usePopover } from '@primereact/headless/popover';\nimport { useControlledState } from '@primereact/hooks/use-controlled-state';\nimport { useEventListener } from '@primereact/hooks/use-event-listener';\nimport type { UseListboxValueChangeEvent } from '@primereact/types/headless/listbox';\nimport type { UsePopoverOpenChangeEvent } from '@primereact/types/headless/popover';\nimport { getOuterWidth, isNotEmpty, focus as primeuix_focus, toElement } from '@primeuix/utils';\nimport * as React from 'react';\nimport { defaultProps } from './useAutoComplete.props';\n\nexport const useAutoComplete = withHeadless({\n name: 'useAutoComplete',\n defaultProps,\n setup({ props, id }) {\n const onListboxValueChange = React.useRef<((event: UseListboxValueChangeEvent) => void) | null>(null);\n\n const handleListboxValueChange = (event: UseListboxValueChangeEvent) => {\n onListboxValueChange.current?.(event);\n };\n\n const handleOpenChange = (event: UsePopoverOpenChangeEvent) => {\n props.onOpenChange?.({ value: !!event.value });\n };\n\n const listbox = useListbox({\n value: props.value,\n defaultValue: props.defaultValue,\n options: props.options,\n optionKey: props.optionKey,\n optionLabel: props.optionLabel,\n optionValue: props.optionValue,\n optionDisabled: props.optionDisabled,\n optionGroupLabel: props.optionGroupLabel,\n optionGroupChildren: props.optionGroupChildren,\n disabled: props.disabled,\n locale: props.locale,\n autoOptionFocus: props.autoOptionFocus,\n selectOnFocus: props.selectOnFocus,\n focusOnHover: props.focusOnHover,\n multiple: false,\n metaKeySelection: props.metaKeySelection,\n onValueChange: handleListboxValueChange\n });\n\n const popover = usePopover({\n open: props.open,\n defaultOpen: props.defaultOpen ?? false,\n closeOnEscape: props.closeOnEscape,\n autoFocus: props.autoFocus,\n trapped: props.trapped,\n onOpenChange: handleOpenChange\n });\n\n const [valueState, setValueState] = useControlledState({\n value: props.value,\n defaultValue: props.defaultValue,\n onChange: props.onValueChange\n });\n\n const [inputValueState, setInputValueState] = useControlledState({\n value: props.inputValue,\n defaultValue: props.defaultInputValue ?? '',\n onChange: props.onInputValueChange\n });\n\n const [focusedState, setFocusedState] = React.useState(false);\n const [searchingState, setSearchingState] = React.useState<boolean>(false);\n const searchTimeout = React.useRef<NodeJS.Timeout | null>(null);\n const focusOnShow = React.useRef<boolean>(false);\n const justSelectedRef = React.useRef<boolean>(false);\n\n const state = {\n value: valueState,\n inputValue: inputValueState,\n opened: popover.state.open,\n focused: focusedState,\n focusedOptionIndex: listbox.state.focusedOptionIndex,\n searching: searchingState,\n anchorElement: popover.state.anchorElement,\n positionerElement: popover.state.positionerElement,\n popupElement: popover.state.popupElement,\n arrowElement: popover.state.arrowElement,\n rendered: popover.state.rendered\n };\n\n const search = (event: React.SyntheticEvent, query: string) => {\n if (query === undefined || query === null) {\n return;\n }\n\n if (props.onComplete) {\n props.onComplete({\n originalEvent: event,\n query\n });\n }\n };\n\n const show = () => {\n popover.setOpen(true);\n };\n\n const hide = () => {\n popover.setOpen(false);\n setSearchingState(false);\n listbox.changeFocusedOptionIndex(new Event('blur') as unknown as React.KeyboardEvent, listbox.findFirstFocusedOptionIndex());\n };\n\n const onChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (searchTimeout.current) {\n clearTimeout(searchTimeout.current);\n }\n\n const inputValue = event.target.value;\n\n if (hasValue()) {\n const selectedOptionIndex = listbox.findSelectedOptionIndex();\n const selectedOption = selectedOptionIndex !== -1 ? listbox.getOptions()[selectedOptionIndex] : null;\n const selectedLabel = selectedOption ? listbox.getOptionLabel(selectedOption) : '';\n\n if (inputValue !== selectedLabel) {\n setValueState([\n null,\n {\n originalEvent: event,\n value: null,\n option: null\n }\n ]);\n\n listbox.updateModel(event, null);\n }\n }\n\n if (inputValue.length === 0) {\n search(event, '');\n hide();\n } else {\n if (inputValue.length >= (props.minLength ?? 1)) {\n setSearchingState(true);\n\n searchTimeout.current = setTimeout(() => {\n search(event, inputValue);\n show();\n\n listbox.changeFocusedOptionIndex(new Event('input') as unknown as React.KeyboardEvent, -1);\n }, props.delay);\n } else {\n hide();\n }\n }\n\n setInputValueState([\n inputValue,\n {\n originalEvent: event,\n query: inputValue\n }\n ]);\n };\n\n const onFocus = (event: React.FocusEvent) => {\n if (props.disabled) {\n return;\n }\n\n if (justSelectedRef.current) {\n justSelectedRef.current = false;\n } else if (props.autoOptionFocus) {\n search(event, (event.target as HTMLInputElement).value);\n }\n\n listbox.listProps.onFocus?.();\n setFocusedState(true);\n };\n\n const onBlur = (event: React.FocusEvent) => {\n listbox.listProps.onBlur?.();\n setFocusedState(false);\n\n if (props.forceSelection) {\n applyForceSelection(event);\n }\n };\n\n const onOptionSelect = (event: { originalEvent: React.SyntheticEvent; value: unknown }) => {\n const selectedValue = event.value;\n\n const option = listbox.getOptions().find((opt: unknown) => {\n const optValue = listbox.getOptionValue(opt);\n\n return listbox.isEquals(optValue, selectedValue);\n });\n\n const optionLabel = option ? listbox.getOptionLabel(option) : '';\n\n setValueState([\n selectedValue,\n {\n originalEvent: event.originalEvent,\n value: selectedValue,\n option\n }\n ]);\n\n setInputValueState([\n optionLabel,\n {\n originalEvent: event.originalEvent,\n query: optionLabel\n }\n ]);\n\n hide();\n justSelectedRef.current = true;\n focus();\n };\n\n onListboxValueChange.current = onOptionSelect;\n\n const onClearClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n event.stopPropagation();\n\n setValueState([\n null,\n {\n originalEvent: event,\n value: null,\n option: null\n }\n ]);\n\n setInputValueState([\n '',\n {\n originalEvent: event,\n query: ''\n }\n ]);\n\n listbox.updateModel(event, null);\n\n if (popover.state.open) {\n hide();\n }\n\n focus();\n };\n\n const onClearKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (event.code === 'Enter' || event.code === 'Space') {\n onClearClick(event as unknown as React.MouseEvent<HTMLButtonElement>);\n }\n };\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n switch (event.code) {\n case 'ArrowDown':\n onArrowDownKey(event);\n break;\n\n case 'ArrowUp':\n onArrowUpKey(event);\n break;\n\n case 'ArrowLeft':\n case 'ArrowRight':\n listbox.changeFocusedOptionIndex(event, -1);\n break;\n\n case 'Enter':\n case 'NumpadEnter':\n onEnterKey(event);\n break;\n\n case 'Space':\n if (!props.autoOptionFocus && listbox.state.focusedOptionIndex !== -1) {\n listbox.onOptionSelect(event, listbox.getOptions()[listbox.state.focusedOptionIndex]);\n }\n\n break;\n\n case 'Home':\n case 'End':\n case 'PageUp':\n case 'PageDown':\n if (popover.state.open) {\n listbox.listProps.onKeyDown(event);\n }\n\n break;\n\n case 'Escape':\n if (popover.state.open) {\n hide();\n focus();\n\n event.stopPropagation();\n }\n\n break;\n\n case 'Tab':\n if (popover.state.open) {\n hide();\n }\n\n break;\n\n default:\n break;\n }\n };\n\n const onArrowDownKey = (event: React.KeyboardEvent<HTMLElement>) => {\n if (!popover.state.open && inputValueState && inputValueState?.length >= (props.minLength ?? 1)) {\n focusOnShow.current = true;\n search(event, inputValueState ?? '');\n show();\n }\n\n listbox.listProps.onKeyDown(event);\n\n event.preventDefault();\n };\n\n const onArrowUpKey = (event: React.KeyboardEvent<HTMLElement>) => {\n if (!popover.state.open && inputValueState && inputValueState?.length >= (props.minLength ?? 1)) {\n focusOnShow.current = true;\n search(event, inputValueState ?? '');\n show();\n }\n\n if (event.altKey) {\n const focusedOptionIndex = listbox.state.focusedOptionIndex;\n\n if (focusedOptionIndex !== -1) {\n const focusedOption = listbox.getOptions()[focusedOptionIndex];\n\n if (focusedOption) {\n onOptionSelect({\n originalEvent: event,\n value: listbox.getOptionValue(focusedOption)\n });\n }\n }\n\n if (popover.state.open) {\n hide();\n }\n } else {\n listbox.listProps.onKeyDown(event);\n }\n\n event.preventDefault();\n };\n\n const onEnterKey = (event: React.KeyboardEvent<HTMLElement>) => {\n const focusedOptionIndex = listbox.state.focusedOptionIndex;\n\n if (popover.state.open && focusedOptionIndex !== -1) {\n const focusedOption = listbox.getOptions()[focusedOptionIndex];\n\n if (focusedOption && !listbox.isOptionDisabled(focusedOption)) {\n listbox.onOptionSelect(event, focusedOption);\n\n event.preventDefault();\n }\n }\n };\n\n const isOptionMatched = (option: unknown, value: string) => {\n return listbox.isValidOption(option) && listbox.getOptionLabel(option)?.toLocaleLowerCase(props.locale) === value.toLocaleLowerCase(props.locale);\n };\n\n const applyForceSelection = (event: React.FocusEvent) => {\n if (props.options && props.options.length > 0) {\n const matchedValue = listbox.getOptions().find((option) => isOptionMatched(option, inputValueState || ''));\n\n if (matchedValue !== undefined) {\n const matchedOption = listbox.getOptions().find((opt: unknown) => listbox.getOptionValue(opt) === matchedValue);\n const matchedLabel = matchedOption ? listbox.getOptionLabel(matchedOption) : '';\n\n setValueState([\n matchedValue,\n {\n originalEvent: event,\n value: matchedValue,\n option: matchedOption\n }\n ]);\n\n setInputValueState([\n matchedLabel,\n {\n originalEvent: event as unknown as React.ChangeEvent<HTMLInputElement>,\n query: matchedLabel\n }\n ]);\n } else {\n setInputValueState([\n '',\n {\n originalEvent: event as unknown as React.ChangeEvent<HTMLInputElement>,\n query: ''\n }\n ]);\n\n setValueState([\n null,\n {\n originalEvent: event,\n value: null,\n option: null\n }\n ]);\n }\n }\n };\n\n const hasValue = () => {\n return isNotEmpty(valueState);\n };\n\n const toggle = () => {\n if (popover.state.open) {\n hide();\n } else {\n show();\n }\n };\n\n const focus = () => {\n const target = toElement(popover.state.anchorElement);\n\n if (target) {\n primeuix_focus(target);\n }\n };\n\n const onClick = () => {\n if (!props.disabled) {\n toggle();\n }\n };\n\n const getSelectedOptionLabel = () => {\n if (!hasValue()) {\n return null;\n }\n\n const selectedOption = listbox.getOptions().find((opt: unknown) => {\n const optValue = listbox.getOptionValue(opt);\n\n return listbox.isEquals(optValue, valueState);\n });\n\n return selectedOption ? listbox.getOptionLabel(selectedOption) : null;\n };\n\n const [bindLabelClick] = useEventListener({\n target: () => document.querySelector(`label[for=\"${id}\"]`) as HTMLElement,\n type: 'click',\n listener: () => {\n focus();\n }\n });\n\n const [bindResizeListener, unbindResizeListener] = useEventListener({\n target: 'window',\n type: 'resize',\n listener: () => {\n if (popover.state.open) {\n hide();\n }\n }\n });\n\n React.useEffect(() => {\n bindLabelClick();\n }, [id]);\n\n React.useEffect(() => {\n if (searchTimeout.current) {\n clearTimeout(searchTimeout.current);\n searchTimeout.current = null;\n }\n }, []);\n\n React.useEffect(() => {\n setSearchingState(false);\n }, [props.options]);\n\n React.useEffect(() => {\n if (popover.state.open) {\n bindResizeListener();\n } else {\n unbindResizeListener();\n }\n }, [popover.state.open, bindResizeListener, unbindResizeListener]);\n\n React.useEffect(() => {\n if (popover.state.open && popover.state.positionerElement) {\n if (popover.state.anchorElement) {\n popover.state.positionerElement.style.minWidth = getOuterWidth(popover.state.anchorElement) + 'px';\n }\n\n if (focusOnShow.current || props.autoOptionFocus) {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n const focusedOptionIndex = listbox.state.focusedOptionIndex;\n const indexToFocus = focusedOptionIndex !== -1 ? focusedOptionIndex : listbox.findFirstFocusedOptionIndex();\n\n listbox.changeFocusedOptionIndex(new Event('focus') as unknown as React.KeyboardEvent, indexToFocus);\n focusOnShow.current = false;\n });\n });\n }\n }\n }, [popover.state.open, popover.state.positionerElement]);\n\n const rootProps = {\n id,\n 'data-scope': 'autocomplete' as const,\n 'data-part': 'root' as const,\n ...(props.disabled && { 'data-disabled': '' as const }),\n ...(props.invalid && { 'data-invalid': '' as const })\n };\n\n const inputProps = {\n 'data-scope': 'autocomplete',\n 'data-part': 'input',\n ref: popover.setAnchorRef,\n tabIndex: props.disabled ? -1 : props.tabIndex,\n value: inputValueState ?? '',\n autoComplete: 'off' as const,\n role: 'combobox' as const,\n name: props.name,\n disabled: props.disabled,\n 'aria-autocomplete': 'list' as const,\n 'aria-haspopup': 'listbox' as const,\n 'aria-expanded': !!popover.state.open,\n 'aria-controls': popover.state.open ? `${id}_list` : undefined,\n 'aria-activedescendant': popover.state.open ? listbox?.getFocusedOptionId() : undefined,\n ...(props.invalid && { 'data-invalid': '', 'aria-invalid': true }),\n onChange,\n onFocus,\n onBlur,\n onKeyDown\n };\n\n const indicatorProps = {\n 'data-scope': 'autocomplete',\n 'data-part': 'indicator',\n 'aria-hidden': true as const,\n ...(popover.state.open ? { 'data-open': '' } : { 'data-closed': '' })\n };\n\n const clearProps = {\n 'data-scope': 'autocomplete',\n 'data-part': 'clear',\n 'aria-label': 'Clear',\n tabIndex: props.disabled ? -1 : 0,\n onClick: onClearClick,\n onKeyDown: onClearKeyDown\n };\n\n const listProps = {\n ...listbox?.listProps,\n id: `${id}_list`,\n tabIndex: -1,\n 'data-scope': 'autocomplete' as const,\n 'data-part': 'list' as const\n };\n\n const positionerProps = {\n 'data-scope': 'autocomplete' as const,\n 'data-part': 'positioner' as const,\n ref: popover.setPositionerRef\n };\n\n const popupProps = {\n 'data-scope': 'autocomplete' as const,\n 'data-part': 'popup' as const,\n ref: popover.setPopupRef,\n ...(popover.state.open && { 'data-open': '' })\n };\n\n const arrowProps = {\n 'data-scope': 'autocomplete',\n 'data-part': 'arrow',\n ref: popover.setArrowRef\n };\n\n const triggerProps = {\n 'data-scope': 'autocomplete',\n 'data-part': 'trigger',\n type: 'button' as const,\n tabIndex: props.disabled ? -1 : props.tabIndex,\n disabled: props.disabled,\n 'aria-label': 'Show suggestions',\n 'aria-haspopup': 'listbox' as const,\n 'aria-expanded': !!popover.state.open,\n 'aria-controls': popover.state.open ? `${id}_list` : undefined,\n ...(popover.state.open && { 'data-positioner-open': '' }),\n onClick\n };\n\n return {\n state,\n listbox,\n // prop getters\n rootProps,\n triggerProps,\n inputProps,\n listProps,\n indicatorProps,\n clearProps,\n positionerProps,\n popupProps,\n arrowProps,\n // ref setters\n setAnchorRef: popover.setAnchorRef,\n setPositionerRef: popover.setPositionerRef,\n setPopupRef: popover.setPopupRef,\n setArrowRef: popover.setArrowRef,\n // methods\n setRendered: popover.setRendered,\n getSelectedOptionLabel,\n hasValue,\n show,\n hide,\n toggle,\n focus\n };\n }\n});\n","import type { UseAutoCompleteProps } from '@primereact/types/headless/autocomplete';\n\nexport const defaultProps: UseAutoCompleteProps = {\n open: undefined,\n defaultOpen: undefined,\n value: undefined,\n defaultValue: undefined,\n inputValue: undefined,\n defaultInputValue: '',\n options: [],\n optionKey: undefined,\n optionLabel: undefined,\n optionValue: undefined,\n optionDisabled: undefined,\n optionGroupLabel: undefined,\n optionGroupChildren: undefined,\n disabled: false,\n invalid: false,\n locale: undefined,\n metaKeySelection: false,\n multiple: false,\n autoOptionFocus: false,\n selectOnFocus: false,\n focusOnHover: true,\n closeOnEscape: false,\n autoFocus: false,\n trapped: false,\n minLength: 1,\n delay: 0,\n forceSelection: false,\n onOpenChange: undefined,\n onValueChange: undefined,\n onInputValueChange: undefined,\n onComplete: undefined\n};\n"],"mappings":"ubAAA,OAAS,gBAAAA,OAAoB,4BAC7B,OAAS,cAAAC,OAAkB,+BAC3B,OAAS,cAAAC,OAAkB,+BAC3B,OAAS,sBAAAC,MAA0B,yCACnC,OAAS,oBAAAC,MAAwB,uCAGjC,OAAS,iBAAAC,GAAe,cAAAC,GAAY,SAASC,GAAgB,aAAAC,OAAiB,kBAC9E,UAAYC,MAAW,QCNhB,IAAMC,EAAqC,CAC9C,KAAM,OACN,YAAa,OACb,MAAO,OACP,aAAc,OACd,WAAY,OACZ,kBAAmB,GACnB,QAAS,CAAC,EACV,UAAW,OACX,YAAa,OACb,YAAa,OACb,eAAgB,OAChB,iBAAkB,OAClB,oBAAqB,OACrB,SAAU,GACV,QAAS,GACT,OAAQ,OACR,iBAAkB,GAClB,SAAU,GACV,gBAAiB,GACjB,cAAe,GACf,aAAc,GACd,cAAe,GACf,UAAW,GACX,QAAS,GACT,UAAW,EACX,MAAO,EACP,eAAgB,GAChB,aAAc,OACd,cAAe,OACf,mBAAoB,OACpB,WAAY,MAChB,EDvBO,IAAMC,GAAkBC,GAAa,CACxC,KAAM,kBACN,aAAAC,EACA,MAAM,CAAE,MAAAC,EAAO,GAAAC,CAAG,EAAG,CAdzB,IAAAC,EAAAC,EAeQ,IAAMC,EAA6B,SAA6D,IAAI,EAE9FC,EAA4BC,GAAsC,CAjBhF,IAAAJ,GAkBYA,EAAAE,EAAqB,UAArB,MAAAF,EAAA,KAAAE,EAA+BE,EACnC,EAEMC,EAAoBD,GAAqC,CArBvE,IAAAJ,GAsBYA,EAAAF,EAAM,eAAN,MAAAE,EAAA,KAAAF,EAAqB,CAAE,MAAO,CAAC,CAACM,EAAM,KAAM,EAChD,EAEME,EAAUC,GAAW,CACvB,MAAOT,EAAM,MACb,aAAcA,EAAM,aACpB,QAASA,EAAM,QACf,UAAWA,EAAM,UACjB,YAA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adless","useListbox","usePopover","useControlledState","useEventListener","getOuterWidth","isNotEmpty","primeuix_focus","toElement","React","defaultProps","useAutoComplete","withHeadless","defaultProps","props","id","_a","_b","onListboxValueChange","handleListboxValueChange","event","handleOpenChange","listbox","useListbox","popover","usePopover","valueState","setValueState","useControlledState","inputValueState","setInputValueState","focusedState","setFocusedState","searchingState","setSearchingState","searchTimeout","focusOnShow","justSelectedRef","state","search","query","show","hide","onChange","inputValue","hasValue","selectedOptionIndex","selectedOption","selectedLabel","onFocus","onBlur","applyForceSelection","onOptionSelect","selectedValue","option","opt","optValue","optionLabel","focus","onClearClick","onClearKeyDown","onKeyDown","onArrowDownKey","onArrowUpKey","onEnterKey","focusedOptionIndex","focusedOption","isOptionMatched","value","matchedValue","matchedOption","matchedLabel","isNotEmpty","toggle","target","toElement","primeuix_focus","onClick","getSelectedOptionLabel","bindLabelClick","useEventListener","bindResizeListener","unbindResizeListener","getOuterWidth","indexToFocus","rootProps","__spreadValues","inputProps","__spreadProps","indicatorProps","clearProps","listProps","positionerProps","popupProps","arrowProps","triggerProps"]}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/avatar/useAvatar.props.ts","../../src/avatar/useAvatar.ts"],"sourcesContent":["import type { UseAvatarProps } from '@primereact/types/headless/avatar';\n\nexport const defaultProps: UseAvatarProps = {\n delayDuration: 0\n};\n","import { withHeadless } from '@primereact/core/headless';\nimport * as React from 'react';\nimport { defaultProps } from './useAvatar.props';\n\nexport const useAvatar = withHeadless({\n name: 'useAvatar',\n defaultProps,\n setup({ props }) {\n const [loadState, setLoadState] = React.useState<boolean>(false);\n const imageRef = React.useRef<HTMLImageElement | null>(null);\n\n const state = {\n load: loadState\n };\n\n // methods\n const onImageLoad = React.useCallback(() => {\n setTimeout(() => {\n setLoadState(true);\n }, props.delayDuration ?? 0);\n }, [props.delayDuration]);\n\n const onImageError = React.useCallback(() => {\n setLoadState(false);\n }, []);\n\n const handleImageLoad = React.useCallback(\n (src?: string) => {\n if (!src) {\n setLoadState(false);\n\n return;\n }\n\n imageRef.current = new window.Image();\n imageRef.current.src = src;\n imageRef.current.addEventListener('load', onImageLoad);\n imageRef.current.addEventListener('error', onImageError);\n },\n [imageRef, onImageLoad, onImageError]\n );\n\n const handleImageUnload = React.useCallback(() => {\n setLoadState(false);\n imageRef.current?.removeEventListener('load', onImageLoad);\n imageRef.current?.removeEventListener('error', onImageError);\n imageRef.current = null;\n }, [onImageLoad, onImageError]);\n\n // effects\n React.useEffect(() => {\n return () => {\n handleImageUnload();\n };\n }, []);\n\n // prop getters\n const rootProps = {\n 'data-scope': 'avatar',\n 'data-part': 'root'\n };\n\n return {\n state,\n // prop getters\n rootProps,\n // methods\n handleImageLoad,\n handleImageUnload\n };\n }\n});\n"],"mappings":"AAEO,IAAMA,EAA+B,CACxC,cAAe,CACnB,ECJA,OAAS,gBAAAC,MAAoB,4BAC7B,UAAYC,MAAW,QAGhB,IAAMC,EAAYC,EAAa,CAClC,KAAM,YACN,aAAAC,EACA,MAAM,CAAE,MAAAC,CAAM,EAAG,CACb,GAAM,CAACC,EAAWC,CAAY,EAAU,WAAkB,EAAK,EACzDC,EAAiB,SAAgC,IAAI,EAErDC,EAAQ,CACV,KAAMH,CACV,EAGMI,EAAoB,cAAY,IAAM,CAhBpD,IAAAC,EAiBY,WAAW,IAAM,CACbJ,EAAa,EAAI,CACrB,GAAGI,EAAAN,EAAM,gBAAN,KAAAM,EAAuB,CAAC,CAC/B,EAAG,CAACN,EAAM,aAAa,CAAC,EAElBO,EAAqB,cAAY,IAAM,CACzCL,EAAa,EAAK,CACtB,EAAG,CAAC,CAAC,EAECM,EAAwB,cACzBC,GAAiB,CACd,GAAI,CAACA,EAAK,CACNP,EAAa,EAAK,EAElB,MACJ,CAEAC,EAAS,QAAU,IAAI,OAAO,MAC9BA,EAAS,QAAQ,IAAMM,EACvBN,EAAS,QAAQ,iBAAiB,OAAQE,CAAW,EACrDF,EAAS,QAAQ,iBAAiB,QAASI,CAAY,CAC3D,EACA,CAACJ,EAAUE,EAAaE,CAAY,CACxC,EAEMG,EAA0B,cAAY,IAAM,CA1C1D,IAAAJ,EAAAK,EA2CYT,EAAa,EAAK,GAClBI,EAAAH,EAAS,UAAT,MAAAG,EAAkB,oBAAoB,OAAQD,IAC9CM,EAAAR,EAAS,UAAT,MAAAQ,EAAkB,oBAAoB,QAASJ,GAC/CJ,EAAS,QAAU,IACvB,EAAG,CAACE,EAAaE,CAAY,CAAC,EAG9B,OAAM,YAAU,IACL,IAAM,CACTG,EAAkB,CACtB,EACD,CAAC,CAAC,EAQE,CACH,MAAAN,EAEA,UARc,CACd,aAAc,SACd,YAAa,MACjB,EAOI,gBAAAI,EACA,kBAAAE,CACJ,CACJ,CACJ,CAAC","names":["defaultProps","withHeadless","React","useAvatar","withHeadless","defaultProps","props","loadState","setLoadState","imageRef","state","onImageLoad","_a","onImageError","handleImageLoad","src","handleImageUnload","_b"]}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/avatargroup/useAvatarGroup.ts","../../src/avatargroup/useAvatarGroup.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { defaultProps } from './useAvatarGroup.props';\n\nexport const useAvatarGroup = withHeadless({\n name: 'useAvatarGroup',\n defaultProps,\n setup() {\n // prop getters\n const rootProps = {\n 'data-scope': 'avatargroup',\n 'data-part': 'root'\n };\n\n return {\n rootProps\n };\n }\n});\n","import type { UseAvatarGroupProps } from '@primereact/types/headless/avatargroup';\n\nexport const defaultProps: UseAvatarGroupProps = {};\n"],"mappings":"AAAA,OAAS,gBAAAA,MAAoB,4BCEtB,IAAMC,EAAoC,CAAC,EDC3C,IAAMC,EAAiBC,EAAa,CACvC,KAAM,iBACN,aAAAC,EACA,OAAQ,CAOJ,MAAO,CACH,UANc,CACd,aAAc,cACd,YAAa,MACjB,CAIA,CACJ,CACJ,CAAC","names":["withHeadless","defaultProps","useAvatarGroup","withHeadless","defaultProps"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/badge/useBadge.ts","../../src/badge/useBadge.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { defaultProps } from './useBadge.props';\n\nexport const useBadge = withHeadless({\n name: 'useBadge',\n defaultProps,\n setup({ inProps }) {\n // prop getters\n const rootProps = {\n 'data-scope': 'badge' as const,\n 'data-part': 'root' as const,\n ...(!inProps?.children && { 'data-empty': '' as const })\n };\n\n return {\n rootProps\n };\n }\n});\n","import type { UseBadgeProps } from '@primereact/types/headless/badge';\n\nexport const defaultProps: UseBadgeProps = {};\n"],"mappings":"yVAAA,OAAS,gBAAAA,MAAoB,4BCEtB,IAAMC,EAA8B,CAAC,EDCrC,IAAMC,EAAWC,EAAa,CACjC,KAAM,WACN,aAAAC,EACA,MAAM,CAAE,QAAAC,CAAQ,EAAG,CAQf,MAAO,CACH,UAPcC,EAAA,CACd,aAAc,QACd,YAAa,QACT,EAACD,GAAA,MAAAA,EAAS,WAAY,CAAE,aAAc,EAAY,EAK1D,CACJ,CACJ,CAAC","names":["withHeadless","defaultProps","useBadge","withHeadless","defaultProps","inProps","__spreadValues"]}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/breadcrumb/useBreadcrumb.ts","../../src/breadcrumb/useBreadcrumb.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { defaultProps } from './useBreadcrumb.props';\n\nexport const useBreadcrumb = withHeadless({\n name: 'useBreadcrumb',\n defaultProps,\n setup() {\n // prop getters\n const rootProps = {\n 'data-scope': 'breadcrumb' as const,\n 'data-part': 'root' as const,\n 'aria-label': 'Breadcrumb'\n };\n\n const ellipsisProps = {\n 'data-scope': 'breadcrumb' as const,\n 'data-part': 'ellipsis' as const,\n role: 'presentation' as const,\n 'aria-hidden': true as const\n };\n\n const separatorProps = {\n 'data-scope': 'breadcrumb' as const,\n 'data-part': 'separator' as const,\n role: 'presentation' as const,\n 'aria-hidden': true as const\n };\n\n return {\n rootProps,\n ellipsisProps,\n separatorProps\n };\n }\n});\n","import type { UseBreadcrumbProps } from '@primereact/types/headless/breadcrumb';\n\nexport const defaultProps: UseBreadcrumbProps = {};\n"],"mappings":"AAAA,OAAS,gBAAAA,MAAoB,4BCEtB,IAAMC,EAAmC,CAAC,EDC1C,IAAMC,EAAgBC,EAAa,CACtC,KAAM,gBACN,aAAAC,EACA,OAAQ,CAsBJ,MAAO,CACH,UArBc,CACd,aAAc,aACd,YAAa,OACb,aAAc,YAClB,EAkBI,cAhBkB,CAClB,aAAc,aACd,YAAa,WACb,KAAM,eACN,cAAe,EACnB,EAYI,eAVmB,CACnB,aAAc,aACd,YAAa,YACb,KAAM,eACN,cAAe,EACnB,CAMA,CACJ,CACJ,CAAC","names":["withHeadless","defaultProps","useBreadcrumb","withHeadless","defaultProps"]}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/button/useButton.ts","../../src/button/useButton.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { defaultProps } from './useButton.props';\n\nexport const useButton = withHeadless({\n name: 'useButton',\n defaultProps,\n setup() {\n // prop getters\n const rootProps = {\n 'data-scope': 'button',\n 'data-part': 'root'\n };\n\n return {\n rootProps\n };\n }\n});\n","import type { UseButtonProps } from '@primereact/types/headless/button';\n\nexport const defaultProps: UseButtonProps = {};\n"],"mappings":"AAAA,OAAS,gBAAAA,MAAoB,4BCEtB,IAAMC,EAA+B,CAAC,EDCtC,IAAMC,EAAYC,EAAa,CAClC,KAAM,YACN,aAAAC,EACA,OAAQ,CAOJ,MAAO,CACH,UANc,CACd,aAAc,SACd,YAAa,MACjB,CAIA,CACJ,CACJ,CAAC","names":["withHeadless","defaultProps","useButton","withHeadless","defaultProps"]}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/card/useCard.ts","../../src/card/useCard.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { defaultProps } from './useCard.props';\n\nexport const useCard = withHeadless({\n name: 'useCard',\n defaultProps,\n setup() {\n // prop getters\n const rootProps = {\n 'data-scope': 'card',\n 'data-part': 'root'\n };\n\n return {\n rootProps\n };\n }\n});\n","import type { UseCardProps } from '@primereact/types/headless/card';\n\nexport const defaultProps: UseCardProps = {};\n"],"mappings":"AAAA,OAAS,gBAAAA,MAAoB,4BCEtB,IAAMC,EAA6B,CAAC,EDCpC,IAAMC,EAAUC,EAAa,CAChC,KAAM,UACN,aAAAC,EACA,OAAQ,CAOJ,MAAO,CACH,UANc,CACd,aAAc,OACd,YAAa,MACjB,CAIA,CACJ,CACJ,CAAC","names":["withHeadless","defaultProps","useCard","withHeadless","defaultProps"]}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/carousel/useCarousel.ts","../../src/carousel/useCarousel.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport * as React from 'react';\nimport { defaultProps } from './useCarousel.props';\n\nconst ITEM_SELECTOR = '[data-item]';\n\nfunction areSetsEqual<T>(a: Set<T>, b: Set<T>) {\n if (a.size !== b.size) return false;\n\n for (const value of a) {\n if (!b.has(value)) return false;\n }\n\n return true;\n}\n\nexport const useCarousel = withHeadless({\n name: 'useCarousel',\n defaultProps,\n setup({ props }) {\n const [swiping, setSwiping] = React.useState(false);\n const [isNextDisabled, setIsNextDisabled] = React.useState(false);\n const [isPrevDisabled, setIsPrevDisabled] = React.useState(false);\n const [snapPoints, setSnapPoints] = React.useState<Set<number>>(new Set());\n const [pageState, setPageState] = React.useState(props.page ?? props.defaultPage ?? 0);\n\n const contentRef = React.useRef<HTMLDivElement>(null);\n const snapPointsRef = React.useRef<Set<number>>(new Set());\n const scrollSnapsRef = React.useRef<number[]>([]);\n const initialPageAppliedRef = React.useRef(false);\n const initialControlledScrollRef = React.useRef(false);\n\n const mutationObserverRef = React.useRef<MutationObserver>(null);\n const intersectionObserverRef = React.useRef<IntersectionObserver>(null);\n const resizeObserverRef = React.useRef<ResizeObserver>(null);\n const scrollTimeoutRef = React.useRef<NodeJS.Timeout | null>(null);\n const wheelTimeoutRef = React.useRef<NodeJS.Timeout | null>(null);\n\n const swipeStartPointRef = React.useRef<{ x: number; y: number }>({ x: 0, y: 0 });\n const isRealSwipeRef = React.useRef(false);\n\n function observeResizeItems(content: HTMLDivElement) {\n const observer = resizeObserverRef.current;\n\n if (!observer) return;\n\n content.querySelectorAll<HTMLElement>(ITEM_SELECTOR).forEach((item) => observer.observe(item));\n }\n\n function observeIntersectionItems(content: HTMLDivElement) {\n const observer = intersectionObserverRef.current;\n\n if (!observer) return;\n\n content.querySelectorAll<HTMLElement>(ITEM_SELECTOR).forEach((item) => observer.observe(item));\n }\n\n function computeSnapPoints() {\n const content = contentRef.current;\n\n if (!content) return [];\n\n const isHorizontal = props.orientation !== 'vertical';\n const trackSize = isHorizontal ? content.clientWidth : content.clientHeight;\n const maxOffset = Math.max(0, isHorizontal ? content.scrollWidth - trackSize : content.scrollHeight - trackSize);\n const snaps: number[] = [];\n\n scrollSnapsRef.current = [];\n\n content.querySelectorAll<HTMLElement>(ITEM_SELECTOR).forEach((item) => {\n const offset = isHorizontal ? item.offsetLeft : item.offsetTop;\n const size = isHorizontal ? item.clientWidth : item.clientHeight;\n\n let snapPoint = offset;\n\n if (props.align === 'center') {\n snapPoint = offset - (trackSize - size) / 2;\n } else if (props.align === 'end') {\n snapPoint = offset - (trackSize - size);\n }\n\n const clamped = Math.max(0, Math.min(snapPoint, maxOffset));\n\n scrollSnapsRef.current.push(clamped);\n\n snaps.push(clamped);\n });\n\n const newSnapPoints = new Set(snaps.map(Number));\n\n if (areSetsEqual(snapPoints, newSnapPoints)) return;\n\n snapPointsRef.current = newSnapPoints;\n setSnapPoints(newSnapPoints);\n }\n\n function setPage(page: number) {\n if (!props.loop) {\n const size = snapPointsRef.current.size || snapPoints.size;\n let isNextDisabled = false;\n let isPrevDisabled = false;\n\n if (page === 0) {\n isPrevDisabled = true;\n }\n\n if (page === size - 1) {\n isNextDisabled = true;\n }\n\n setIsNextDisabled(isNextDisabled);\n setIsPrevDisabled(isPrevDisabled);\n }\n\n setPageState(page);\n\n props.onPageChange?.({ value: page });\n props.onSlideChange?.({ value: page });\n }\n\n function setToClosest() {\n const content = contentRef.current;\n\n const points = snapPointsRef.current;\n\n if (!content || points.size === 0) return;\n\n const scrollPos = props.orientation === 'horizontal' ? content.scrollLeft : content.scrollTop;\n\n const closestSnapPoint = Array.from(points).reduce((closest, point) => {\n return Math.abs(point - scrollPos) < Math.abs(closest - scrollPos) ? point : closest;\n }, Infinity);\n\n const index = Array.from(points).indexOf(closestSnapPoint);\n\n setPage(index);\n\n return index;\n }\n\n function scrollToPage(page?: number, instant = false) {\n const points = snapPointsRef.current;\n\n if (points.size === 0) return;\n\n const target = page ?? pageState;\n const clampedPage = props.loop ? (target + points.size) % points.size : Math.max(0, Math.min(target, points.size - 1));\n\n setPage(clampedPage);\n scrollTo(Array.from(points)[clampedPage], instant);\n }\n\n function next() {\n scrollToPage(pageState + 1);\n }\n\n function prev() {\n scrollToPage(pageState - 1);\n }\n\n function scrollTo(snapPoint: number, instant = false) {\n const content = contentRef.current;\n\n if (!content) return;\n\n content.scrollTo({\n [props.orientation === 'horizontal' ? 'left' : 'top']: snapPoint,\n behavior: instant ? 'instant' : 'smooth'\n });\n }\n\n function scrollToSlide(slide: number, instant = false) {\n const points = snapPointsRef.current;\n const snaps = scrollSnapsRef.current;\n\n if (points.size === 0 || snaps.length === 0) return;\n\n const clampedSlide = Math.max(0, Math.min(slide, snaps.length - 1));\n\n const snap = snaps[clampedSlide];\n\n scrollTo(snap, instant);\n\n const page = Array.from(points).indexOf(snap);\n\n setPage(page);\n }\n\n React.useLayoutEffect(() => {\n const content = contentRef.current;\n\n if (!content) return;\n\n resizeObserverRef.current = new ResizeObserver(() => {\n computeSnapPoints();\n const closest = setToClosest();\n\n scrollToPage(closest ?? pageState, true);\n });\n\n resizeObserverRef.current.observe(content);\n observeResizeItems(content);\n\n computeSnapPoints();\n\n return () => {\n resizeObserverRef.current?.disconnect();\n resizeObserverRef.current = null;\n };\n }, []);\n\n React.useLayoutEffect(() => {\n if (initialPageAppliedRef.current) return;\n\n if (props.page !== undefined && props.page !== null) return;\n\n if (props.slide !== undefined && props.slide !== null) return;\n\n const size = snapPointsRef.current.size || snapPoints.size;\n\n if (size === 0) return;\n\n initialPageAppliedRef.current = true;\n scrollToPage(props.defaultPage ?? 0, true);\n }, [snapPoints, props.page, props.defaultPage]);\n\n React.useLayoutEffect(() => {\n if (props.page === undefined || props.page === null) return;\n\n if (props.slide !== undefined && props.slide !== null) return;\n\n if (snapPointsRef.current.size === 0 && snapPoints.size === 0) return;\n\n const instant = !initialControlledScrollRef.current;\n\n initialControlledScrollRef.current = true;\n scrollToPage(props.page, instant);\n }, [props.page, props.slide, snapPoints]);\n\n React.useLayoutEffect(() => {\n if (props.slide === undefined || props.slide === null) return;\n\n if (snapPointsRef.current.size === 0 && snapPoints.size === 0) return;\n\n const instant = !initialControlledScrollRef.current;\n\n initialControlledScrollRef.current = true;\n scrollToSlide(props.slide, instant);\n }, [props.slide, snapPoints]);\n\n React.useEffect(() => {\n const content = contentRef.current;\n\n if (!content) return;\n\n mutationObserverRef.current = new MutationObserver((mutations) => {\n mutations.forEach(() => {\n computeSnapPoints();\n observeResizeItems(content);\n observeIntersectionItems(content);\n requestAnimationFrame(() => {\n const closest = setToClosest();\n\n scrollToPage(closest ?? pageState, true);\n });\n });\n });\n\n mutationObserverRef.current.observe(content, { childList: true, subtree: true });\n\n return () => {\n mutationObserverRef.current?.disconnect();\n mutationObserverRef.current = null;\n };\n }, []);\n\n React.useEffect(() => {\n const content = contentRef.current;\n\n if (!content) return;\n\n intersectionObserverRef.current = new IntersectionObserver(\n (entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) entry.target.setAttribute('data-inview', '');\n else entry.target.removeAttribute('data-inview');\n });\n },\n {\n root: contentRef.current,\n threshold: 0.6\n }\n );\n\n observeIntersectionItems(content);\n\n return () => {\n intersectionObserverRef.current?.disconnect();\n intersectionObserverRef.current = null;\n };\n }, []);\n\n React.useEffect(() => {\n const content = contentRef.current;\n\n if (!content) return;\n\n const onScroll = () => {\n if (scrollTimeoutRef.current) clearTimeout(scrollTimeoutRef.current);\n\n scrollTimeoutRef.current = setTimeout(() => {\n setToClosest();\n }, 80);\n };\n\n onScroll();\n\n content.addEventListener('scroll', onScroll, { passive: true });\n\n return () => {\n if (scrollTimeoutRef.current) clearTimeout(scrollTimeoutRef.current);\n\n scrollTimeoutRef.current = null;\n\n content.removeEventListener('scroll', onScroll);\n };\n }, []);\n\n React.useEffect(() => {\n return () => {\n if (wheelTimeoutRef.current) clearTimeout(wheelTimeoutRef.current);\n\n wheelTimeoutRef.current = null;\n };\n }, []);\n\n function onContentPointerDown(e: React.PointerEvent<HTMLDivElement>) {\n if (e.button !== 0) return;\n\n if (e.pointerType === 'touch') return;\n\n setSwiping(true);\n swipeStartPointRef.current = { x: e.clientX, y: e.clientY };\n isRealSwipeRef.current = false;\n }\n\n function onContentPointerMove(e: React.PointerEvent<HTMLDivElement>) {\n const content = contentRef.current;\n\n if (!swiping || !content || e.pointerType === 'touch') return;\n\n const deltaX = e.clientX - swipeStartPointRef.current.x;\n const deltaY = e.clientY - swipeStartPointRef.current.y;\n const distance = Math.abs(deltaX) + Math.abs(deltaY);\n\n if (distance < 6) return;\n\n if ((window.getSelection()?.toString().length ?? 0) > 0) return;\n\n e.currentTarget.setPointerCapture(e.pointerId);\n\n content.style.userSelect = 'none';\n isRealSwipeRef.current = true;\n content.style.scrollSnapType = 'none';\n content.scrollBy({\n left: -e.movementX,\n top: -e.movementY,\n behavior: 'instant'\n });\n\n e.preventDefault();\n }\n\n function onContentPointerUp(e: React.PointerEvent<HTMLDivElement>) {\n setSwiping(false);\n e.currentTarget.releasePointerCapture(e.pointerId);\n\n if (!isRealSwipeRef.current) return;\n\n const content = contentRef.current;\n\n if (!content) return;\n\n content.style.userSelect = '';\n\n const scrollPos = props.orientation === 'horizontal' ? content.scrollLeft : content.scrollTop;\n const snapPoints = snapPointsRef.current;\n\n const closestSnapPoint = Array.from(snapPoints).reduce((closest, point) => {\n return Math.abs(point - scrollPos) < Math.abs(closest - scrollPos) ? point : closest;\n }, Infinity);\n\n const index = Array.from(snapPoints).indexOf(closestSnapPoint);\n\n requestAnimationFrame(() => {\n if (closestSnapPoint !== undefined) scrollToPage(index);\n\n requestAnimationFrame(() => {\n content.style.scrollSnapType = resolveSnapType();\n });\n });\n }\n\n function onContentWheel(e: React.WheelEvent<HTMLDivElement>) {\n if (wheelTimeoutRef.current) clearTimeout(wheelTimeoutRef.current);\n\n wheelTimeoutRef.current = setTimeout(() => {\n const primaryDelta = props.orientation === 'horizontal' ? e.deltaX || e.deltaY : e.deltaY || e.deltaX;\n\n if (primaryDelta > 0 && isNextDisabled) {\n return;\n }\n\n if (primaryDelta < 0 && isPrevDisabled) {\n return;\n }\n\n setToClosest();\n }, 80);\n }\n\n const resolveSnapType = () => {\n const axis = props.orientation === 'vertical' ? 'y' : 'x';\n\n return `${axis} ${props.snapType ?? 'mandatory'}`;\n };\n\n const slidesPerPage = props.slidesPerPage && props.slidesPerPage > 0 ? props.slidesPerPage : 1;\n\n const state = {\n swiping,\n isNextDisabled,\n isPrevDisabled,\n snapPoints,\n page: pageState\n };\n\n // prop getters\n const rootProps = {\n 'data-scope': 'carousel' as const,\n 'data-part': 'root' as const,\n 'data-orientation': props.orientation,\n 'data-align': props.align,\n 'data-page': pageState,\n ...(swiping ? { 'data-swiping': '' as const } : {}),\n ...(props.autoSize ? { 'data-autosize': '' as const } : {})\n };\n\n const contentProps = {\n ref: contentRef,\n 'data-scope': 'carousel' as const,\n 'data-part': 'content' as const,\n 'data-orientation': props.orientation,\n 'data-align': props.align,\n 'data-page': pageState,\n ...(props.autoSize ? { 'data-autosize': '' as const } : {}),\n ...(swiping ? { 'data-swiping': '' as const } : {}),\n onPointerDown: onContentPointerDown,\n onPointerMove: onContentPointerMove,\n onPointerUp: onContentPointerUp,\n onWheel: onContentWheel,\n style: {\n '--px-slides-per-page': slidesPerPage,\n '--px-spacing-items': props.spacing + 'px',\n '--px-scroll-snap-type': resolveSnapType(),\n position: 'relative' as const,\n scrollbarWidth: 'none' as const,\n display: 'flex' as const,\n flexDirection: (props.orientation === 'vertical' ? 'column' : 'row') as React.CSSProperties['flexDirection'],\n overflowX: props.orientation === 'horizontal' ? ('scroll' as const) : undefined,\n overflowY: props.orientation === 'vertical' ? ('scroll' as const) : undefined,\n overscrollBehaviorX: props.orientation === 'horizontal' ? ('contain' as const) : undefined,\n overscrollBehaviorY: props.orientation === 'vertical' ? ('contain' as const) : undefined,\n gap: 'var(--px-spacing-items)',\n scrollSnapType: 'var(--px-scroll-snap-type)'\n }\n };\n\n const indicatorsProps = {\n 'data-scope': 'carousel' as const,\n 'data-part': 'indicators' as const,\n 'data-orientation': props.orientation,\n 'data-align': props.align,\n 'data-page': pageState,\n ...(swiping ? { 'data-swiping': '' as const } : {})\n };\n\n const getItemProps = (value: unknown) => ({\n 'data-scope': 'carousel' as const,\n 'data-part': 'item' as const,\n 'data-value': value,\n 'data-item': '' as const,\n 'data-inview': 'false' as const,\n 'data-orientation': props.orientation,\n 'data-align': props.align,\n 'data-page': pageState,\n ...(swiping ? { 'data-swiping': '' as const } : {}),\n ...(props.autoSize ? { 'data-autosize': '' as const } : {}),\n style: {\n flexGrow: 0,\n flexShrink: 0,\n minWidth: 0,\n flexBasis: props.autoSize ? 'auto' : `calc(100% / var(--px-slides-per-page) - var(--px-spacing-items) * (var(--px-slides-per-page) - 1) / var(--px-slides-per-page))`,\n scrollSnapAlign: props.align\n }\n });\n\n const getNextProps = (disabled: boolean) => ({\n 'data-scope': 'carousel' as const,\n 'data-part': 'next' as const,\n disabled,\n 'data-orientation': props.orientation,\n 'data-align': props.align,\n 'data-page': pageState,\n 'data-disabled': disabled,\n ...(swiping ? { 'data-swiping': '' as const } : {}),\n onClick: next\n });\n\n const getPrevProps = (disabled: boolean) => ({\n 'data-scope': 'carousel' as const,\n 'data-part': 'prev' as const,\n disabled,\n 'data-orientation': props.orientation,\n 'data-align': props.align,\n 'data-page': pageState,\n 'data-disabled': disabled,\n ...(swiping ? { 'data-swiping': '' as const } : {}),\n onClick: prev\n });\n\n const getIndicatorProps = (page: number) => {\n const isActive = pageState === page;\n const handleClick = () => scrollToPage(page);\n\n return {\n 'data-scope': 'carousel' as const,\n 'data-part': 'indicator' as const,\n 'data-orientation': props.orientation,\n 'data-align': props.align,\n 'data-page': pageState,\n ...(isActive ? { 'data-active': '' as const } : {}),\n ...(swiping ? { 'data-swiping': '' as const } : {}),\n onClick: handleClick\n };\n };\n\n return {\n state,\n slidesPerPage,\n // prop getters\n rootProps,\n contentProps,\n indicatorsProps,\n getItemProps,\n getNextProps,\n getPrevProps,\n getIndicatorProps,\n // methods\n onContentPointerDown,\n onContentPointerMove,\n onContentPointerUp,\n onContentWheel,\n next,\n prev,\n scrollToPage,\n scrollTo,\n scrollToSlide,\n setToClosest,\n resolveSnapType\n };\n }\n});\n","import type { UseCarouselProps } from '@primereact/types/headless/carousel';\n\nexport const defaultProps: UseCarouselProps = {\n orientation: 'horizontal',\n align: 'start',\n loop: false,\n snapType: 'mandatory',\n spacing: 16,\n autoSize: false,\n slidesPerPage: 1,\n slide: undefined,\n onSlideChange: undefined,\n defaultPage: 0,\n page: undefined,\n onPageChange: undefined\n};\n"],"mappings":"ubAAA,OAAS,gBAAAA,OAAoB,4BAC7B,UAAYC,MAAW,QCChB,IAAMC,GAAiC,CAC1C,YAAa,aACb,MAAO,QACP,KAAM,GACN,SAAU,YACV,QAAS,GACT,SAAU,GACV,cAAe,EACf,MAAO,OACP,cAAe,OACf,YAAa,EACb,KAAM,OACN,aAAc,MAClB,EDXA,IAAMC,EAAgB,cAEtB,SAASC,GAAgBC,EAAWC,EAAW,CAC3C,GAAID,EAAE,OAASC,EAAE,KAAM,MAAO,GAE9B,QAAWC,KAASF,EAChB,GAAI,CAACC,EAAE,IAAIC,CAAK,EAAG,MAAO,GAG9B,MAAO,EAC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,YAAaW,GACTR,EAAU,CAAE,eAAgB,EAAY,EAAI,CAAC,GAC7CH,EAAM,SAAW,CAAE,gBAAiB,EAAY,EAAI,CAAC,GAVnB,CAWtC,MAAO,CACH,SAAU,EACV,WAAY,EACZ,SAAU,EACV,UAAWA,EAAM,SAAW,OAAS,iIACrC,gBAAiBA,EAAM,KAC3B,CACJ,GAkDI,aAhDkB+E,GAAuBF,EAAAF,EAAA,CACzC,aAAc,WACd,YAAa,OACb,SAAAI,EACA,mBAAoB/E,EAAM,YAC1B,aAAcA,EAAM,MACpB,YAAaW,EACb,gBAAiBoE,GACb5E,EAAU,CAAE,eAAgB,EAAY,EAAI,CAAC,GARR,CASzC,QAASmD,CACb,GAuCI,aArCkByB,GAAuBF,EAAAF,EAAA,CACzC,aAAc,WACd,YAAa,OACb,SAAAI,EACA,mBAAoB/E,EAAM,YAC1B,aAAcA,EAAM,MACpB,YAAaW,EACb,gBAAiBoE,GACb5E,EAAU,CAAE,eAAgB,EAAY,EAAI,CAAC,GARR,CASzC,QAASoD,CACb,GA4BI,kBA1BuBd,GAAiB,CACxC,IAAMuC,EAAWrE,IAAc8B,EACzBwC,EAAc,IAAMhC,EAAaR,CAAI,EAE3C,OAAOoC,EAAAF,IAAA,CACH,aAAc,WACd,YAAa,YACb,mBAAoB3E,EAAM,YAC1B,aAAcA,EAAM,MACpB,YAAaW,GACTqE,EAAW,CAAE,cAAe,EAAY,EAAI,CAAC,GAC7C7E,EAAU,CAAE,eAAgB,EAAY,EAAI,CAAC,GAP9C,CAQH,QAAS8E,CACb,EACJ,EAcI,qBAAAjB,EACA,qBAAAC,EACA,mBAAAG,EACA,eAAAE,EACA,KAAAhB,EACA,KAAAC,EACA,aAAAN,EACA,SAAAI,EACA,cAAAG,EACA,aAAAd,EACA,gBAAA2B,CACJ,CACJ,CACJ,CAAC","names":["withHeadless","React","defaultProps","ITEM_SELECTOR","areSetsEqual","a","b","value","useCarousel","withHeadless","defaultProps","props","_a","_b","swiping","setSwiping","isNextDisabled","setIsNextDisabled","isPrevDisabled","setIsPrevDisabled","snapPoints","setSnapPoints","pageState","setPageState","contentRef","snapPointsRef","scrollSnapsRef","initialPageAppliedRef","initialControlledScrollRef","mutationObserverRef","intersectionObserverRef","resizeObserverRef","scrollTimeoutRef","wheelTimeoutRef","swipeStartPointRef","isRealSwipeRef","observeResizeItems","content","observer","item","observeIntersectionItems","computeSnapPoints","isHorizontal","trackSize","maxOffset","snaps","offset","size","snapPoint","clamped","newSnapPoints","setPage","page","setToClosest","points","scrollPos","closestSnapPoint","closest","point","index","scrollToPage","instant","target","clampedPage","scrollTo","next","prev","scrollToSlide","slide","clampedSlide","snap","mutations","entries","entry","onScroll","onContentPointerDown","onContentPointerMove","deltaX","deltaY","onContentPointerUp","resolveSnapType","onContentWheel","primaryDelta","slidesPerPage","state","rootProps","__spreadValues","contentProps","__spreadProps","indicatorsProps","disabled","isActive","handleClick"]}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/checkbox/useCheckbox.ts","../../src/checkbox/useCheckbox.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { useControlledState } from '@primereact/hooks/use-controlled-state';\nimport * as React from 'react';\nimport { defaultProps } from './useCheckbox.props';\n\nexport const useCheckbox = withHeadless({\n name: 'useCheckbox',\n defaultProps,\n setup({ props }) {\n const [indeterminateState, setIndeterminateState] = React.useState<boolean | undefined>(props.indeterminate);\n const [checkedState, setCheckedState] = useControlledState({\n value: props.checked,\n defaultValue: props.defaultChecked ?? false,\n onChange: props.onCheckedChange\n });\n\n const checked = indeterminateState ? false : checkedState === props.trueValue;\n\n const state = {\n checked,\n indeterminate: indeterminateState\n };\n\n // methods\n const onChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const computedChecked = indeterminateState ? props.trueValue : checked ? props.falseValue : props.trueValue;\n const checkedState = computedChecked === props.trueValue;\n\n if (indeterminateState) {\n setIndeterminateState(false);\n }\n\n setCheckedState([\n computedChecked,\n {\n originalEvent: event,\n checked: checkedState\n }\n ]);\n };\n\n React.useEffect(() => {\n if (props.indeterminate !== undefined) {\n setIndeterminateState(props.indeterminate);\n }\n }, [props.indeterminate]);\n\n // prop getters\n const inputProps = {\n 'data-scope': 'checkbox',\n 'data-part': 'input',\n id: props.inputId,\n type: 'checkbox' as const,\n value: props.value,\n name: props.name,\n checked,\n tabIndex: props.tabIndex,\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n 'aria-labelledby': props.ariaLabelledby,\n 'aria-label': props.ariaLabel,\n 'aria-invalid': props.invalid || undefined,\n 'aria-checked': indeterminateState ? ('mixed' as const) : undefined,\n onFocus: props.onFocus,\n onBlur: props.onBlur,\n onChange: !props.readOnly ? onChange : undefined\n };\n\n const boxProps = {\n 'data-scope': 'checkbox',\n 'data-part': 'box',\n [checked ? 'data-checked' : 'data-unchecked']: '',\n ...(props.disabled && { 'data-disabled': '' }),\n ...(props.invalid && { 'data-invalid': '' }),\n ...(props.indeterminate && { 'data-indeterminate': '' })\n };\n\n const indicatorProps = {\n 'data-scope': 'checkbox',\n 'data-part': 'indicator',\n [checked ? 'data-checked' : 'data-unchecked']: '',\n ...(indeterminateState && { 'data-indeterminate': '' }),\n ...(props.disabled && { 'data-disabled': '' }),\n ...(props.invalid && { 'data-invalid': '' })\n };\n\n const rootProps = {\n 'data-scope': 'checkbox',\n 'data-part': 'root',\n [checked ? 'data-checked' : 'data-unchecked']: '',\n ...(props.disabled && { 'data-disabled': '' }),\n ...(props.invalid && { 'data-invalid': '' }),\n ...(props.indeterminate && { 'data-indeterminate': '' })\n };\n\n return {\n state,\n // prop getters\n rootProps,\n inputProps,\n boxProps,\n indicatorProps,\n // methods\n onChange\n };\n }\n});\n","import type { UseCheckboxProps } from '@primereact/types/headless/checkbox';\n\nexport const defaultProps: UseCheckboxProps = {\n checked: undefined,\n defaultChecked: undefined,\n inputId: undefined,\n indeterminate: false,\n trueValue: true,\n falseValue: false,\n value: undefined,\n name: undefined,\n disabled: undefined,\n readOnly: undefined,\n required: undefined,\n tabIndex: undefined,\n invalid: undefined,\n ariaLabelledby: undefined,\n ariaLabel: undefined,\n onFocus: undefined,\n onBlur: undefined,\n onCheckedChange: undefined\n};\n"],"mappings":"yVAAA,OAAS,gBAAAA,MAAoB,4BAC7B,OAAS,sBAAAC,MAA0B,yCACnC,UAAYC,MAAW,QCAhB,IAAMC,EAAiC,CAC1C,QAAS,OACT,eAAgB,OAChB,QAAS,OACT,cAAe,GACf,UAAW,GACX,WAAY,GACZ,MAAO,OACP,KAAM,OACN,SAAU,OACV,SAAU,OACV,SAAU,OACV,SAAU,OACV,QAAS,OACT,eAAgB,OAChB,UAAW,OACX,QAAS,OACT,OAAQ,OACR,gBAAiB,MACrB,EDhBO,IAAMC,EAAcC,EAAa,CACpC,KAAM,cACN,aAAAC,EACA,MAAM,CAAE,MAAAC,CAAM,EAAG,CARrB,IAAAC,EASQ,GAAM,CAACC,EAAoBC,CAAqB,EAAU,WAA8BH,EAAM,aAAa,EACrG,CAACI,EAAcC,CAAe,EAAIC,EAAmB,CACvD,MAAON,EAAM,QACb,cAAcC,EAAAD,EAAM,iBAAN,KAAAC,EAAwB,GACtC,SAAUD,EAAM,eACpB,CAAC,EAEKO,EAAUL,EAAqB,GAAQE,IAAiBJ,EAAM,UAE9DQ,EAAQ,CACV,QAAAD,EACA,cAAeL,CACnB,EAGMO,EAAYC,GAA+C,CAC7D,IAAMC,EAAkBT,EAAqBF,EAAM,UAAYO,EAAUP,EAAM,WAAaA,EAAM,UAC5FI,EAAeO,IAAoBX,EAAM,UAE3CE,GACAC,EAAsB,EAAK,EAG/BE,EAAgB,CACZM,EACA,CACI,cAAeD,EACf,QAASN,CACb,CACJ,CAAC,CACL,EAEM,YAAU,IAAM,CACdJ,EAAM,gBAAkB,QACxBG,EAAsBH,EAAM,aAAa,CAEjD,EAAG,CAACA,EAAM,aAAa,CAAC,EAGxB,IAAMY,EAAa,CACf,aAAc,WACd,YAAa,QACb,GAAIZ,EAAM,QACV,KAAM,WACN,MAAOA,EAAM,MACb,KAAMA,EAAM,KACZ,QAAAO,EACA,SAAUP,EAAM,SAChB,SAAUA,EAAM,SAChB,SAAUA,EAAM,SAChB,SAAUA,EAAM,SAChB,kBAAmBA,EAAM,eACzB,aAAcA,EAAM,UACpB,eAAgBA,EAAM,SAAW,OACjC,eAAgBE,EAAsB,QAAoB,OAC1D,QAASF,EAAM,QACf,OAAQA,EAAM,OACd,SAAWA,EAAM,SAAsB,OAAXS,CAChC,EAEMI,EAAWC,MAAA,CACb,aAAc,WACd,YAAa,MACb,CAACP,EAAU,eAAiB,gBAAgB,EAAG,IAC3CP,EAAM,UAAY,CAAE,gBAAiB,EAAG,GACxCA,EAAM,SAAW,CAAE,eAAgB,EAAG,GACtCA,EAAM,eAAiB,CAAE,qBAAsB,EAAG,GAGpDe,EAAiBD,MAAA,CACnB,aAAc,WACd,YAAa,YACb,CAACP,EAAU,eAAiB,gBAAgB,EAAG,IAC3CL,GAAsB,CAAE,qBAAsB,EAAG,GACjDF,EAAM,UAAY,CAAE,gBAAiB,EAAG,GACxCA,EAAM,SAAW,CAAE,eAAgB,EAAG,GAGxCgB,EAAYF,MAAA,CACd,aAAc,WACd,YAAa,OACb,CAACP,EAAU,eAAiB,gBAAgB,EAAG,IAC3CP,EAAM,UAAY,CAAE,gBAAiB,EAAG,GACxCA,EAAM,SAAW,CAAE,eAAgB,EAAG,GACtCA,EAAM,eAAiB,CAAE,qBAAsB,EAAG,GAG1D,MAAO,CACH,MAAAQ,EAEA,UAAAQ,EACA,WAAAJ,EACA,SAAAC,EACA,eAAAE,EAEA,SAAAN,CACJ,CACJ,CACJ,CAAC","names":["withHeadless","useControlledState","React","defaultProps","useCheckbox","withHeadless","defaultProps","props","_a","indeterminateState","setIndeterminateState","checkedState","setCheckedState","useControlledState","checked","state","onChange","event","computedChecked","inputProps","boxProps","__spreadValues","indicatorProps","rootProps"]}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/checkboxgroup/useCheckboxGroup.ts","../../src/checkboxgroup/useCheckboxGroup.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { useControlledState } from '@primereact/hooks/use-controlled-state';\nimport { UseCheckboxGroupExposes } from '@primereact/types/headless/checkboxgroup';\nimport * as React from 'react';\nimport { defaultProps } from './useCheckboxGroup.props';\n\nexport const useCheckboxGroup = withHeadless({\n name: 'useCheckboxGroup',\n defaultProps,\n setup({ props }) {\n const [valueState, setValueState] = useControlledState({\n value: props.value,\n defaultValue: props.defaultValue,\n onChange: props.onValueChange\n });\n\n const state = {\n value: valueState\n };\n\n const updateChange = React.useCallback(\n (event: Parameters<UseCheckboxGroupExposes['updateChange']>[0]) => {\n const newValue = event.checked ? [...(valueState || []), event.value] : (valueState || []).filter((v) => v !== event.value);\n\n setValueState?.([newValue, { originalEvent: event.originalEvent, value: newValue }]);\n },\n [valueState, setValueState]\n );\n\n // prop getters\n const rootProps = {\n 'data-scope': 'checkboxgroup',\n 'data-part': 'root'\n };\n\n return {\n state,\n // prop getters\n rootProps,\n // methods\n updateChange\n };\n }\n});\n","import type { UseCheckboxGroupProps } from '@primereact/types/headless/checkboxgroup';\n\nexport const defaultProps: UseCheckboxGroupProps = {\n value: undefined,\n defaultValue: undefined,\n onValueChange: undefined\n};\n"],"mappings":"AAAA,OAAS,gBAAAA,MAAoB,4BAC7B,OAAS,sBAAAC,MAA0B,yCAEnC,UAAYC,MAAW,QCDhB,IAAMC,EAAsC,CAC/C,MAAO,OACP,aAAc,OACd,cAAe,MACnB,EDAO,IAAMC,EAAmBC,EAAa,CACzC,KAAM,mBACN,aAAAC,EACA,MAAM,CAAE,MAAAC,CAAM,EAAG,CACb,GAAM,CAACC,EAAYC,CAAa,EAAIC,EAAmB,CACnD,MAAOH,EAAM,MACb,aAAcA,EAAM,aACpB,SAAUA,EAAM,aACpB,CAAC,EAEKI,EAAQ,CACV,MAAOH,CACX,EAEMI,EAAqB,cACtBC,GAAkE,CAC/D,IAAMC,EAAWD,EAAM,QAAU,CAAC,GAAIL,GAAc,CAAC,EAAIK,EAAM,KAAK,GAAKL,GAAc,CAAC,GAAG,OAAQO,GAAMA,IAAMF,EAAM,KAAK,EAE1HJ,GAAA,MAAAA,EAAgB,CAACK,EAAU,CAAE,cAAeD,EAAM,cAAe,MAAOC,CAAS,CAAC,EACtF,EACA,CAACN,EAAYC,CAAa,CAC9B,EAQA,MAAO,CACH,MAAAE,EAEA,UARc,CACd,aAAc,gBACd,YAAa,MACjB,EAOI,aAAAC,CACJ,CACJ,CACJ,CAAC","names":["withHeadless","useControlledState","React","defaultProps","useCheckboxGroup","withHeadless","defaultProps","props","valueState","setValueState","useControlledState","state","updateChange","event","newValue","v"]}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/chip/useChip.ts","../../src/chip/useChip.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport * as React from 'react';\nimport { defaultProps } from './useChip.props';\n\nexport const useChip = withHeadless({\n name: 'useChip',\n defaultProps,\n setup({ props }) {\n const [visibleState, setVisibleState] = React.useState<boolean>(true);\n\n const state = {\n visible: visibleState\n };\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (event.code === 'Enter' || event.code === 'NumpadEnter' || event.code === 'Backspace') {\n close(event);\n }\n };\n\n const close = (event: React.SyntheticEvent<HTMLElement>) => {\n setVisibleState(false);\n\n props.onRemove?.({\n originalEvent: event\n });\n };\n\n // prop getters\n const rootProps = {\n 'data-scope': 'chip',\n 'data-part': 'root'\n };\n\n return {\n state,\n // prop getters\n rootProps,\n removeProps: {\n tabIndex: 0 as const,\n onClick: close,\n onKeyDown\n },\n // methods\n close\n };\n }\n});\n","import type { UseChipProps } from '@primereact/types/headless/chip';\n\nexport const defaultProps: UseChipProps = {\n onRemove: undefined\n};\n"],"mappings":"AAAA,OAAS,gBAAAA,MAAoB,4BAC7B,UAAYC,MAAW,QCChB,IAAMC,EAA6B,CACtC,SAAU,MACd,EDAO,IAAMC,EAAUC,EAAa,CAChC,KAAM,UACN,aAAAC,EACA,MAAM,CAAE,MAAAC,CAAM,EAAG,CACb,GAAM,CAACC,EAAcC,CAAe,EAAU,WAAkB,EAAI,EAE9DC,EAAQ,CACV,QAASF,CACb,EAEMG,EAAaC,GAA4C,EACvDA,EAAM,OAAS,SAAWA,EAAM,OAAS,eAAiBA,EAAM,OAAS,cACzEC,EAAMD,CAAK,CAEnB,EAEMC,EAASD,GAA6C,CApBpE,IAAAE,EAqBYL,EAAgB,EAAK,GAErBK,EAAAP,EAAM,WAAN,MAAAO,EAAA,KAAAP,EAAiB,CACb,cAAeK,CACnB,EACJ,EAQA,MAAO,CACH,MAAAF,EAEA,UARc,CACd,aAAc,OACd,YAAa,MACjB,EAMI,YAAa,CACT,SAAU,EACV,QAASG,EACT,UAAAF,CACJ,EAEA,MAAAE,CACJ,CACJ,CACJ,CAAC","names":["withHeadless","React","defaultProps","useChip","withHeadless","defaultProps","props","visibleState","setVisibleState","state","onKeyDown","event","close","_a"]}
File without changes