@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
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/dialog/useDialog.ts","../../src/dialog/useDialog.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { useFocusTrap } from '@primereact/headless/focustrap';\nimport { useControlledState } from '@primereact/hooks/use-controlled-state';\nimport { $dt } from '@primeuix/styled';\nimport { blockBodyScroll, focus, toElement, unblockBodyScroll } from '@primeuix/utils/dom';\nimport { ZIndex } from '@primeuix/utils/zindex';\nimport * as React from 'react';\nimport { defaultProps } from './useDialog.props';\n\nexport const useDialog = withHeadless({\n name: 'useDialog',\n defaultProps,\n setup: ({ props, id, $primereact }) => {\n const [openState, setOpenState] = useControlledState({\n value: props.open,\n defaultValue: props.defaultOpen ?? false,\n onChange: props.onOpenChange\n });\n\n const [maximizedState, setMaximizedState] = React.useState<boolean>(props.fullScreen ?? false);\n const [popupElement, setPopupElement] = React.useState<HTMLElement | null>(null);\n const [positionerElement, setPositionerElement] = React.useState<HTMLElement | null>(null);\n const [backdropElement, setBackdropElement] = React.useState<HTMLElement | null>(null);\n\n const popupRef = React.useRef<HTMLElement | null>(null);\n const positionerRef = React.useRef<HTMLElement | null>(null);\n const backdropRef = React.useRef<HTMLElement | null>(null);\n const closeButtonRef = React.useRef<HTMLElement | null>(null);\n const maximizableButtonRef = React.useRef<HTMLElement | null>(null);\n const previousActiveElement = React.useRef<HTMLElement | null>(null);\n const backdropMouseDownTarget = React.useRef<EventTarget | null>(null);\n\n const focusTrap = useFocusTrap({\n trapped: !!props.trapped,\n autoFocus: false\n });\n\n React.useEffect(() => {\n setMaximizedState(props.fullScreen ?? false);\n }, [props.fullScreen]);\n\n const setPopupRef = React.useCallback((node: HTMLElement | null) => {\n const element = (toElement(node) ?? null) as HTMLElement | null;\n\n if (element === popupRef.current) return;\n\n popupRef.current = element;\n focusTrap.containerRef.current = element;\n setPopupElement(element);\n }, []);\n\n const setPositionerRef = React.useCallback((node: HTMLElement | null) => {\n const element = (toElement(node) ?? null) as HTMLElement | null;\n\n if (element === positionerRef.current) return;\n\n positionerRef.current = element;\n setPositionerElement(element);\n }, []);\n\n const setBackdropRef = React.useCallback((node: HTMLElement | null) => {\n const element = (toElement(node) ?? null) as HTMLElement | null;\n\n if (element === backdropRef.current) return;\n\n backdropRef.current = element;\n setBackdropElement(element);\n }, []);\n\n const setCloseButtonRef = React.useCallback((node: HTMLElement | null) => {\n const element = (toElement(node) ?? null) as HTMLElement | null;\n\n if (element === closeButtonRef.current) return;\n\n closeButtonRef.current = element;\n }, []);\n\n const setMaximizableButtonRef = React.useCallback((node: HTMLElement | null) => {\n const element = (toElement(node) ?? null) as HTMLElement | null;\n\n if (element === maximizableButtonRef.current) return;\n\n maximizableButtonRef.current = element;\n }, []);\n\n function toggle() {\n setOpenState([!openState, { originalEvent: undefined, value: !openState }]);\n }\n\n function open() {\n setOpenState([true, { originalEvent: undefined, value: true }]);\n }\n\n function close() {\n setOpenState([false, { originalEvent: undefined, value: false }]);\n }\n\n function toggleMaximized() {\n setMaximizedState((prev) => !prev);\n }\n\n const onOpenComplete = React.useCallback(() => {\n if (!popupRef.current) return;\n\n const focusTarget = popupRef.current.querySelector('[autoFocus]') as HTMLElement | null;\n\n if (focusTarget) {\n focus(focusTarget);\n } else if (maximizableButtonRef.current) {\n focus(maximizableButtonRef.current);\n } else if (closeButtonRef.current) {\n focus(closeButtonRef.current);\n }\n }, []);\n\n const onCloseComplete = React.useCallback(() => {\n props.onExitComplete?.();\n }, [props.onExitComplete]);\n\n React.useEffect(() => {\n if (openState) {\n previousActiveElement.current = document.activeElement as HTMLElement;\n } else if (previousActiveElement.current) {\n focus(previousActiveElement.current);\n previousActiveElement.current = null;\n }\n }, [openState]);\n\n React.useEffect(() => {\n if (!openState || !props.closeOnEscape) return;\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n close();\n }\n };\n\n document.addEventListener('keydown', onKeyDown);\n\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [openState, props.closeOnEscape]);\n\n const onBackdropPointerDown = React.useCallback((event: React.PointerEvent) => {\n backdropMouseDownTarget.current = event.target;\n }, []);\n\n const onBackdropPointerUp = React.useCallback(() => {\n if (props.dismissable && backdropRef.current === backdropMouseDownTarget.current) {\n close();\n }\n\n backdropMouseDownTarget.current = null;\n }, [props.dismissable]);\n\n const positionerMouseDownTarget = React.useRef<EventTarget | null>(null);\n\n const onPositionerPointerDown = React.useCallback((event: React.PointerEvent) => {\n positionerMouseDownTarget.current = event.target;\n }, []);\n\n const onPositionerPointerUp = React.useCallback(() => {\n if (props.dismissable && positionerRef.current === positionerMouseDownTarget.current) {\n close();\n }\n\n positionerMouseDownTarget.current = null;\n }, [props.dismissable]);\n\n const dragRef = React.useRef({ dragging: false, startX: 0, startY: 0, dx: 0, dy: 0 });\n\n const onDragPointerDown = React.useCallback(\n (event: React.PointerEvent) => {\n if (!props.draggable || maximizedState || props.scrollBehavior === 'outside') return;\n\n const target = event.target as Element;\n\n if (target.closest('[data-part=\"close\"]') || target.closest('[data-part=\"maximizable\"]')) return;\n\n const el = popupRef.current;\n\n if (!el) return;\n\n dragRef.current.dragging = true;\n dragRef.current.startX = event.clientX - dragRef.current.dx;\n dragRef.current.startY = event.clientY - dragRef.current.dy;\n\n el.setPointerCapture(event.pointerId);\n el.setAttribute('data-dragging', '');\n el.style.setProperty('user-select', 'none');\n },\n [props.draggable, maximizedState]\n );\n\n const onDragPointerMove = React.useCallback(\n (event: React.PointerEvent) => {\n if (!dragRef.current.dragging) return;\n\n const el = popupRef.current;\n\n if (!el) return;\n\n let dx = event.clientX - dragRef.current.startX;\n let dy = event.clientY - dragRef.current.startY;\n\n if (props.keepInViewport) {\n const rect = el.getBoundingClientRect();\n const vw = window.innerWidth;\n const vh = window.innerHeight;\n const curDx = dragRef.current.dx;\n const curDy = dragRef.current.dy;\n\n const newLeft = rect.left + (dx - curDx);\n const newTop = rect.top + (dy - curDy);\n\n if (newLeft < (props.minX ?? 0)) dx = curDx - (rect.left - (props.minX ?? 0));\n\n if (newTop < (props.minY ?? 0)) dy = curDy - (rect.top - (props.minY ?? 0));\n\n if (newLeft + rect.width > vw) dx = curDx + (vw - rect.left - rect.width);\n\n if (newTop + rect.height > vh) dy = curDy + (vh - rect.top - rect.height);\n }\n\n dragRef.current.dx = dx;\n dragRef.current.dy = dy;\n\n el.style.setProperty('--px-drag-x', dx + 'px');\n el.style.setProperty('--px-drag-y', dy + 'px');\n },\n [props.keepInViewport, props.minX, props.minY]\n );\n\n const onDragPointerUp = React.useCallback(() => {\n if (!dragRef.current.dragging) return;\n\n dragRef.current.dragging = false;\n popupRef.current?.removeAttribute('data-dragging');\n popupRef.current?.style.removeProperty('user-select');\n }, []);\n\n React.useEffect(() => {\n if (!openState) {\n dragRef.current = { dragging: false, startX: 0, startY: 0, dx: 0, dy: 0 };\n }\n }, [openState]);\n\n React.useEffect(() => {\n if (!openState || !props.blockScroll) return;\n\n blockBodyScroll({ variableName: $dt('scrollbar.width').name });\n\n return () => {\n unblockBodyScroll({ variableName: $dt('scrollbar.width').name });\n };\n }, [openState, props.blockScroll]);\n\n React.useEffect(() => {\n if (!positionerElement) return;\n\n if (props.autoZIndex) {\n const baseZ = (props.baseZIndex ?? 0) + ($primereact.config?.zIndex?.modal ?? 1100);\n\n if (backdropElement) {\n ZIndex.set('modal', backdropElement, baseZ);\n }\n\n ZIndex.set('modal', positionerElement, baseZ);\n }\n\n return () => {\n if (props.autoZIndex) {\n if (backdropElement) ZIndex.clear(backdropElement);\n\n ZIndex.clear(positionerElement);\n }\n };\n }, [positionerElement, backdropElement, props.autoZIndex, props.baseZIndex, $primereact.config?.zIndex?.modal]);\n\n const maximizedAttr = maximizedState ? { 'data-maximized': '' as const } : {};\n\n const rootProps = {\n id,\n 'data-scope': 'dialog',\n 'data-part': 'root',\n ...(openState ? { 'data-open': '' as const } : { 'data-closed': '' as const }),\n ...maximizedAttr\n };\n\n const modalAttr = props.modal !== false ? { 'data-modal': '' as const } : {};\n\n const positionerProps = {\n 'data-scope': 'dialog',\n 'data-part': 'positioner',\n 'data-position': props.position,\n 'data-scroll-behavior': props.scrollBehavior,\n ...(openState ? { 'data-open': '' as const } : { 'data-closed': '' as const }),\n ...maximizedAttr,\n ...modalAttr,\n onPointerDown: onPositionerPointerDown,\n onPointerUp: onPositionerPointerUp,\n ref: setPositionerRef\n };\n\n const triggerProps = {\n type: 'button' as const,\n 'data-scope': 'dialog',\n 'data-part': 'trigger',\n 'aria-haspopup': 'dialog' as const,\n 'aria-expanded': openState,\n 'aria-controls': id,\n ...(openState ? { 'data-popup-open': '' as const } : {}),\n onClick: toggle\n };\n\n const portalProps = {\n 'data-scope': 'dialog',\n 'data-part': 'portal'\n };\n\n const backdropProps = {\n 'data-scope': 'dialog',\n 'data-part': 'backdrop',\n ...(openState ? { 'data-open': '' as const } : { 'data-closed': '' as const }),\n onPointerDown: onBackdropPointerDown,\n onPointerUp: onBackdropPointerUp,\n ref: setBackdropRef\n };\n\n const popupProps = {\n id,\n role: 'dialog' as const,\n 'aria-labelledby': id + '_header',\n 'data-scope': 'dialog',\n 'data-part': 'popup',\n 'data-position': props.position,\n ...(openState ? { 'data-open': '' as const } : { 'data-closed': '' as const }),\n ...maximizedAttr,\n ...(props.draggable ? { 'data-draggable': '' as const } : {}),\n onPointerMove: onDragPointerMove,\n onPointerUp: onDragPointerUp,\n ref: setPopupRef\n };\n\n const headerProps = {\n 'data-scope': 'dialog',\n 'data-part': 'header',\n id: id + '_header',\n ...(props.draggable ? { style: { cursor: 'move' } as React.CSSProperties } : {}),\n onPointerDown: onDragPointerDown\n };\n\n const headerActionsProps = {\n 'data-scope': 'dialog',\n 'data-part': 'header-actions'\n };\n\n const titleProps = {\n 'data-scope': 'dialog',\n 'data-part': 'title'\n };\n\n const maximizableProps = {\n 'data-scope': 'dialog',\n 'data-part': 'maximizable',\n ...(maximizedState ? { 'data-maximized': '' as const } : { 'data-minimized': '' as const }),\n ref: setMaximizableButtonRef,\n onClick: toggleMaximized\n };\n\n const closeProps = {\n 'data-scope': 'dialog',\n 'data-part': 'close',\n ref: setCloseButtonRef,\n onClick: close\n };\n\n const contentProps = {\n 'data-scope': 'dialog',\n 'data-part': 'content',\n ...maximizedAttr\n };\n\n const footerProps = {\n 'data-scope': 'dialog',\n 'data-part': 'footer'\n };\n\n const state = {\n open: openState,\n maximized: maximizedState,\n trapped: !!props.trapped,\n popupElement,\n positionerElement,\n backdropElement\n };\n\n return {\n state,\n focusTrap,\n\n setPopupRef,\n setPositionerRef,\n setBackdropRef,\n\n rootProps,\n positionerProps,\n triggerProps,\n portalProps,\n backdropProps,\n popupProps,\n headerProps,\n headerActionsProps,\n titleProps,\n maximizableProps,\n closeProps,\n contentProps,\n footerProps,\n\n toggle,\n open,\n close,\n toggleMaximized,\n onOpenComplete,\n onCloseComplete\n };\n }\n});\n","import type { UseDialogProps } from '@primereact/types/headless/dialog';\n\nexport const defaultProps: UseDialogProps = {\n open: undefined,\n defaultOpen: undefined,\n draggable: false,\n modal: true,\n dismissable: true,\n closeOnEscape: true,\n blockScroll: true,\n keepInViewport: true,\n minX: 0,\n minY: 0,\n trapped: true,\n baseZIndex: 0,\n autoZIndex: true,\n appendTo: 'body',\n position: 'center',\n fullScreen: false,\n scrollBehavior: 'inside',\n onOpenChange: undefined,\n onExitComplete: undefined\n};\n"],"mappings":"ubAAA,OAAS,gBAAAA,OAAoB,4BAC7B,OAAS,gBAAAC,OAAoB,iCAC7B,OAAS,sBAAAC,OAA0B,yCACnC,OAAS,OAAAC,OAAW,mBACpB,OAAS,mBAAAC,GAAiB,SAAAC,EAAO,aAAAC,EAAW,qBAAAC,OAAyB,sBACrE,OAAS,UAAAC,MAAc,yBACvB,UAAYC,MAAW,QCJhB,IAAMC,EAA+B,CACxC,KAAM,OACN,YAAa,OACb,UAAW,GACX,MAAO,GACP,YAAa,GACb,cAAe,GACf,YAAa,GACb,eAAgB,GAChB,KAAM,EACN,KAAM,EACN,QAAS,GACT,WAAY,EACZ,WAAY,GACZ,SAAU,OACV,SAAU,SACV,WAAY,GACZ,eAAgB,SAChB,aAAc,OACd,eAAgB,MACpB,EDbO,IAAMC,GAAYC,GAAa,CAClC,KAAM,YACN,aAAAC,EACA,MAAO,CAAC,CAAE,MAAAC,EAAO,GAAAC,EAAI,YAAAC,CAAY,IAAM,CAZ3C,IAAAC,EAAAC,EAAAC,EAAAC,EAaQ,GAAM,CAACC,EAAWC,CAAY,EAAIC,GAAmB,CACjD,MAAOT,EAAM,KACb,cAAcG,EAAAH,EAAM,cAAN,KAAAG,EAAqB,GACnC,SAAUH,EAAM,YACpB,CAAC,EAEK,CAACU,EAAgBC,CAAiB,EAAU,YAAkBP,EAAAJ,EAAM,aAAN,KAAAI,EAAoB,EAAK,EACvF,CAACQ,GAAcC,E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,cAAeoD,EACnB,GAEM8B,GAAqB,CACvB,aAAc,SACd,YAAa,gBACjB,EAEMC,GAAa,CACf,aAAc,SACd,YAAa,OACjB,EAEMC,GAAmBR,EAAAH,EAAA,CACrB,aAAc,SACd,YAAa,eACT/D,EAAiB,CAAE,iBAAkB,EAAY,EAAI,CAAE,iBAAkB,EAAY,GAHpE,CAIrB,IAAKwB,GACL,QAASI,CACb,GAEM+C,GAAa,CACf,aAAc,SACd,YAAa,QACb,IAAKpD,GACL,QAASI,CACb,EAEMiD,GAAeb,EAAA,CACjB,aAAc,SACd,YAAa,WACVF,GAGDgB,GAAc,CAChB,aAAc,SACd,YAAa,QACjB,EAWA,MAAO,CACH,MAVU,CACV,KAAMhF,EACN,UAAWG,EACX,QAAS,CAAC,CAACV,EAAM,QACjB,aAAAY,GACA,kBAAAE,EACA,gBAAAE,CACJ,EAII,UAAAS,EAEA,YAAAE,EACA,iBAAAI,EACA,eAAAC,EAEA,UAAAwC,GACA,gBAAAG,GACA,aAAAE,GACA,YAAAC,GACA,cAAAC,GACA,WAAAC,GACA,YAAAC,GACA,mBAAAC,GACA,WAAAC,GACA,iBAAAC,GACA,WAAAC,GACA,aAAAC,GACA,YAAAC,GAEA,OAAApD,EACA,KAAAC,GACA,MAAAC,EACA,gBAAAC,EACA,eAAAE,GACA,gBAAAG,EACJ,CACJ,CACJ,CAAC","names":["withHeadless","useFocusTrap","useControlledState","$dt","blockBodyScroll","focus","toElement","unblockBodyScroll","ZIndex","React","defaultProps","useDialog","withHeadless","defaultProps","props","id","$primereact","_a","_b","_c","_d","openState","setOpenState","useControlledState","maximizedState","setMaximizedState","popupElement","setPopupElement","positionerElement","setPositionerElement","backdropElement","setBackdropElement","popupRef","positionerRef","backdropRef","closeButtonRef","maximizableButtonRef","previousActiveElement","backdropMouseDownTarget","focusTrap","useFocusTrap","setPopupRef","node","element","toElement","setPositionerRef","setBackdropRef","setCloseButtonRef","setMaximizableButtonRef","toggle","open","close","toggleMaximized","prev","onOpenComplete","focusTarget","focus","onCloseComplete","onKeyDown","event","onBackdropPointerDown","onBackdropPointerUp","positionerMouseDownTarget","onPositionerPointerDown","onPositionerPointerUp","dragRef","onDragPointerDown","target","el","onDragPointerMove","dx","dy","rect","vw","vh","curDx","curDy","newLeft","newTop","onDragPointerUp","blockBodyScroll","$dt","unblockBodyScroll","baseZ","ZIndex","maximizedAttr","rootProps","__spreadValues","modalAttr","positionerProps","__spreadProps","triggerProps","portalProps","backdropProps","popupProps","headerProps","headerActionsProps","titleProps","maximizableProps","closeProps","contentProps","footerProps"]}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/divider/useDivider.ts","../../src/divider/useDivider.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { defaultProps } from './useDivider.props';\n\nexport const useDivider = withHeadless({\n name: 'useDivider',\n defaultProps,\n setup({ props }) {\n // prop getters\n const rootProps = {\n 'data-scope': 'divider',\n 'data-part': 'root',\n role: 'separator' as const,\n 'aria-orientation': props.orientation,\n 'data-orientation': props.orientation,\n 'data-align': props.align\n };\n\n const contentProps = {\n 'data-scope': 'divider',\n 'data-part': 'content'\n };\n\n return {\n rootProps,\n contentProps\n };\n }\n});\n","import type { UseDividerProps } from '@primereact/types/headless/divider';\n\nexport const defaultProps: UseDividerProps = {};\n"],"mappings":"AAAA,OAAS,gBAAAA,MAAoB,4BCEtB,IAAMC,EAAgC,CAAC,EDCvC,IAAMC,EAAaC,EAAa,CACnC,KAAM,aACN,aAAAC,EACA,MAAM,CAAE,MAAAC,CAAM,EAAG,CAgBb,MAAO,CACH,UAfc,CACd,aAAc,UACd,YAAa,OACb,KAAM,YACN,mBAAoBA,EAAM,YAC1B,mBAAoBA,EAAM,YAC1B,aAAcA,EAAM,KACxB,EASI,aAPiB,CACjB,aAAc,UACd,YAAa,SACjB,CAKA,CACJ,CACJ,CAAC","names":["withHeadless","defaultProps","useDivider","withHeadless","defaultProps","props"]}
File without changes
package/dnd/index.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/dnd/useDnd.ts","../../src/dnd/useDnd.props.ts","../../src/dnd/useDraggable.ts","../../src/dnd/useDraggable.props.ts","../../src/dnd/useDroppable.ts","../../src/dnd/useDroppable.props.ts","../../src/dnd/useSortable.ts","../../src/dnd/useSortable.props.ts","../../src/dnd/useSortableContainer.ts","../../src/dnd/useSortableContainer.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport * as React from 'react';\nimport { defaultProps } from './useDnd.props';\n\nexport interface DndContainerInfo {\n listRef: React.RefObject<HTMLElement | null>;\n items: unknown[];\n}\n\nexport interface DndCoordinatorState {\n dragging: boolean;\n activeContainerId: unknown | null;\n currentContainerId: unknown | null;\n fromIndex: number;\n projectedIndex: number;\n}\n\nexport interface DndCoordinator {\n uid: string;\n containers: Map<unknown, DndContainerInfo>;\n getState(): DndCoordinatorState;\n subscribe(fn: () => void): () => void;\n setState(update: Partial<DndCoordinatorState>): void;\n onSort?: (event: { containerId: unknown; fromIndex: number; toIndex: number }) => void;\n onTransfer?: (event: { from: { containerId: unknown; index: number }; to: { containerId: unknown; index: number } }) => void;\n}\n\nconst INITIAL_STATE: DndCoordinatorState = {\n dragging: false,\n activeContainerId: null,\n currentContainerId: null,\n fromIndex: -1,\n projectedIndex: -1\n};\n\nfunction createCoordinator(uid: string): DndCoordinator {\n const containers = new Map<unknown, DndContainerInfo>();\n let state: DndCoordinatorState = { ...INITIAL_STATE };\n const subscribers = new Set<() => void>();\n\n const notify = () => {\n for (const fn of subscribers) fn();\n };\n\n return {\n uid,\n containers,\n\n getState() {\n return state;\n },\n\n subscribe(fn: () => void) {\n subscribers.add(fn);\n\n return () => {\n subscribers.delete(fn);\n };\n },\n\n setState(update: Partial<DndCoordinatorState>) {\n state = { ...state, ...update };\n notify();\n },\n\n onSort: undefined,\n onTransfer: undefined\n };\n}\n\nconst NOOP_SUBSCRIBE = () => () => {};\n\nexport const useDnd = withHeadless({\n name: 'useDnd',\n defaultProps,\n setup({ props }) {\n const dndId = React.useId();\n const coordinatorRef = React.useRef<DndCoordinator | null>(null);\n\n if (!coordinatorRef.current) {\n coordinatorRef.current = createCoordinator(dndId);\n }\n\n const dnd = coordinatorRef.current;\n\n dnd.onSort = props.onSort;\n dnd.onTransfer = props.onTransfer;\n\n const subscribe = React.useCallback((fn: () => void) => dnd.subscribe(fn), [dnd]);\n const getSnapshot = React.useCallback(() => dnd.getState(), [dnd]);\n\n const dndState = React.useSyncExternalStore(dnd ? subscribe : NOOP_SUBSCRIBE, dnd ? getSnapshot : () => INITIAL_STATE, () => INITIAL_STATE);\n\n const state = {\n dragging: dndState.dragging\n };\n\n const rootProps = {\n 'data-scope': 'dnd',\n 'data-part': 'root',\n ...(state.dragging ? { 'data-dragging': '' } : undefined)\n };\n\n return {\n state,\n dnd,\n rootProps\n };\n }\n});\n","import type { UseDndProps } from '@primereact/types/headless/dnd';\n\nexport const defaultProps: UseDndProps = {\n onSort: undefined,\n onTransfer: undefined\n};\n","import { withHeadless } from '@primereact/core/headless';\nimport type { DragData } from '@primereact/types/primitive/dnd';\nimport * as React from 'react';\nimport { defaultProps } from './useDraggable.props';\n\nconst NOOP_SUBSCRIBE = () => () => {};\n\nexport const useDraggable = withHeadless({\n name: 'useDraggable',\n defaultProps,\n setup({ props, elementRef }) {\n const dnd = props.dnd;\n const id = props.id;\n\n // ── Store data in ref for getter freshness ───────────────────\n const dataRef = React.useRef<DragData>(props.data ?? {});\n\n React.useEffect(() => {\n dataRef.current = props.data ?? {};\n }, [props.data]);\n\n // ── Register draggable with DndInstance ──────────────────────\n React.useEffect(() => {\n if (!dnd || id == null) return;\n\n const node = elementRef?.current ?? null;\n\n const cleanup = dnd.registerDraggable({\n id,\n node,\n disabled: props.disabled,\n scope: props.scope,\n get data() {\n return dataRef.current;\n }\n });\n\n return cleanup;\n }, [dnd, id, props.disabled, props.scope, elementRef]);\n\n // ── Attach sensors ───────────────────────────────────────────\n React.useEffect(() => {\n if (!dnd || id == null || props.disabled) return;\n\n const node = elementRef?.current;\n\n if (!node) return;\n\n const cleanups: (() => void)[] = [];\n\n if (props.sensor !== 'keyboard') {\n cleanups.push(dnd.attachPointerSensor(node, id, props.pointerOptions));\n }\n\n if (props.sensor !== 'pointer') {\n cleanups.push(dnd.attachKeyboardSensor(node, id, props.keyboardOptions));\n }\n\n return () => {\n for (const cleanup of cleanups) cleanup();\n };\n }, [dnd, id, props.disabled, props.sensor, props.pointerOptions, props.keyboardOptions, elementRef]);\n\n // ── Derive isDragging from DndInstance state ─────────────────\n const subscribe = React.useCallback((listener: () => void) => (dnd ? dnd.subscribe(listener) : () => {}), [dnd]);\n\n const isDragging = React.useSyncExternalStore(\n dnd ? subscribe : NOOP_SUBSCRIBE,\n () => (dnd ? dnd.getState().operation?.activeId === id : false),\n () => false\n );\n\n const state = {\n isDragging\n };\n\n // ── Prop getter ──────────────────────────────────────────────\n const rootProps = React.useMemo(\n () => ({\n 'data-scope': 'dnd',\n 'data-part': 'draggable',\n ...(isDragging ? { 'data-dragging': '' } : undefined),\n ...(props.disabled ? { 'data-disabled': '' } : undefined),\n tabIndex: props.disabled ? -1 : 0,\n role: 'button',\n 'aria-roledescription': 'draggable'\n }),\n [isDragging, props.disabled]\n );\n\n return {\n state,\n rootProps\n };\n }\n});\n","import type { UseDraggableProps } from '@primereact/types/headless/dnd';\n\nexport const defaultProps: UseDraggableProps = {\n dnd: undefined,\n id: undefined,\n disabled: false,\n scope: undefined,\n data: undefined,\n sensor: 'both',\n pointerOptions: undefined,\n keyboardOptions: undefined\n};\n","import { withHeadless } from '@primereact/core/headless';\nimport * as React from 'react';\nimport { defaultProps } from './useDroppable.props';\n\nconst NOOP_SUBSCRIBE = () => () => {};\n\nexport const useDroppable = withHeadless({\n name: 'useDroppable',\n defaultProps,\n setup({ props, elementRef }) {\n const dnd = props.dnd;\n const id = props.id;\n\n // ── Register droppable with DndInstance ──────────────────────\n React.useEffect(() => {\n if (!dnd || id == null) return;\n\n const node = elementRef?.current ?? null;\n\n const cleanup = dnd.registerDroppable({\n id,\n node,\n disabled: props.disabled,\n accept: props.accept,\n data: props.data,\n canDrop: props.canDrop\n });\n\n return cleanup;\n }, [dnd, id, props.disabled, props.accept, props.data, props.canDrop, elementRef]);\n\n // ── Derive isOver from DndInstance state ─────────────────────\n const subscribe = React.useCallback((listener: () => void) => (dnd ? dnd.subscribe(listener) : () => {}), [dnd]);\n\n const isOver = React.useSyncExternalStore(\n dnd ? subscribe : NOOP_SUBSCRIBE,\n () => {\n if (!dnd || id == null) return false;\n\n const collisions = dnd.getState().collisions;\n\n return collisions.length > 0 && collisions[0].id === id;\n },\n () => false\n );\n\n const state = {\n isOver\n };\n\n // ── Prop getter ──────────────────────────────────────────────\n const rootProps = React.useMemo(\n () => ({\n 'data-scope': 'dnd',\n 'data-part': 'droppable',\n ...(isOver ? { 'data-over': '' } : undefined),\n ...(props.disabled ? { 'data-disabled': '' } : undefined)\n }),\n [isOver, props.disabled]\n );\n\n return {\n state,\n rootProps\n };\n }\n});\n","import type { UseDroppableProps } from '@primereact/types/headless/dnd';\n\nexport const defaultProps: UseDroppableProps = {\n dnd: undefined,\n id: undefined,\n disabled: false,\n accept: undefined,\n data: undefined,\n canDrop: undefined\n};\n","import { withHeadless } from '@primereact/core/headless';\nimport * as React from 'react';\nimport type { DndCoordinator } from './useDnd';\nimport { defaultProps } from './useSortable.props';\n\nconst NOOP_SUBSCRIBE = () => () => {};\n\nexport const useSortable = withHeadless({\n name: 'useSortable',\n defaultProps,\n setup({ props }) {\n const dnd = props.dnd as DndCoordinator | undefined;\n const id = props.id;\n\n const subscribe = React.useCallback((listener: () => void) => (dnd ? dnd.subscribe(listener) : () => {}), [dnd]);\n\n const isDragging = React.useSyncExternalStore(\n dnd ? subscribe : NOOP_SUBSCRIBE,\n () => {\n if (!dnd || id == null) return false;\n\n const state = dnd.getState();\n\n return state.dragging && state.fromIndex === props.index;\n },\n () => false\n );\n\n const state = {\n isDragging\n };\n\n const rootProps = React.useMemo(\n () => ({\n 'data-scope': 'dnd',\n 'data-part': 'sortable',\n ...(isDragging ? { 'data-dragging': '' } : undefined),\n ...(props.disabled ? { 'data-disabled': '' } : undefined)\n }),\n [isDragging, props.disabled]\n );\n\n return {\n state,\n rootProps\n };\n }\n});\n","import type { UseSortableProps } from '@primereact/types/headless/dnd';\n\nexport const defaultProps: UseSortableProps = {\n dnd: undefined,\n id: undefined,\n index: undefined,\n disabled: false\n};\n","import { withHeadless } from '@primereact/core/headless';\nimport * as React from 'react';\nimport { flushSync } from 'react-dom';\nimport type { DndCoordinator } from './useDnd';\nimport { defaultProps } from './useSortableContainer.props';\n\nconst getSortableItems = (listEl: HTMLElement): HTMLElement[] => Array.from(listEl.querySelectorAll(':scope > [data-sortable-item]'));\n\nexport const useSortableContainer = withHeadless({\n name: 'useSortableContainer',\n defaultProps,\n setup({ props }) {\n const dnd = props.dnd as DndCoordinator | undefined;\n const id = props.id;\n const items = props.items ?? [];\n const disabled = props.disabled ?? false;\n const placeholderMode = props.placeholder ?? 'clone';\n const onSort = props.onSort;\n const scopedListId = dnd ? `${dnd.uid}_${id}` : String(id);\n\n const listRef = React.useRef<HTMLElement>(null);\n\n React.useEffect(() => {\n if (!dnd || id == null) return;\n\n dnd.containers.set(id, { listRef, items });\n\n return () => {\n dnd.containers.delete(id);\n };\n }, [dnd, id]);\n\n const itemsRef = React.useRef(items);\n\n itemsRef.current = items;\n\n React.useEffect(() => {\n if (dnd && id != null) {\n const c = dnd.containers.get(id);\n\n if (c) c.items = items;\n }\n }, [dnd, id, items]);\n\n const [dragging, setDragging] = React.useState(false);\n\n const scrollRafRef = React.useRef<number>(0);\n\n const dragStateRef = React.useRef<{\n startX: number;\n startY: number;\n startScrollTop: number;\n node: HTMLElement;\n ghost: HTMLElement;\n clone: HTMLElement;\n itemHeight: number;\n gap: number;\n fromIndex: number;\n projectedIndex: number;\n originContainerId: unknown;\n currentContainerId: unknown;\n itemsAtStart: Map<unknown, unknown[]>;\n } | null>(null);\n\n const applyShifts = (listEl: HTMLElement, fromIndex: number, projectedIndex: number, draggedNode: HTMLElement, clone: HTMLElement, itemHeight: number, gap: number) => {\n const shift = itemHeight + gap;\n\n // During drag: node has data-sortable-item removed, clone has no data-sortable-item.\n // So getSortableItems returns only real siblings, in their original DOM order.\n // Items before fromIndex keep their index; items at/after fromIndex are shifted by 1.\n const realItems = getSortableItems(listEl);\n\n for (let i = 0; i < realItems.length; i++) {\n const logicalIndex = i < fromIndex ? i : i + 1;\n let offset = 0;\n\n if (fromIndex < projectedIndex) {\n if (logicalIndex > fromIndex && logicalIndex <= projectedIndex) offset = -shift;\n } else if (fromIndex > projectedIndex) {\n if (logicalIndex >= projectedIndex && logicalIndex < fromIndex) offset = shift;\n }\n\n realItems[i].style.transform = offset ? `translateY(${offset}px)` : '';\n }\n\n // Clone is placeholder at fromIndex slot; shift it to projectedIndex\n clone.style.transform = projectedIndex !== fromIndex ? `translateY(${(projectedIndex - fromIndex) * shift}px)` : '';\n };\n\n const clearShifts = (listEl: HTMLElement | null) => {\n if (!listEl) return;\n\n for (const child of getSortableItems(listEl)) {\n child.style.transform = '';\n }\n };\n\n const getListGap = (listEl: HTMLElement) => {\n const children = getSortableItems(listEl);\n\n return children.length > 1 ? children[1].getBoundingClientRect().top - children[0].getBoundingClientRect().bottom : 4;\n };\n\n const createGhost = (node: HTMLElement, rect: DOMRect): HTMLElement => {\n const ghost = node.cloneNode(true) as HTMLElement;\n\n ghost.setAttribute('inert', 'true');\n ghost.removeAttribute('data-sortable-item');\n ghost.removeAttribute('data-sortable-container');\n ghost.style.position = 'fixed';\n ghost.style.zIndex = '9999';\n ghost.style.pointerEvents = 'none';\n ghost.style.width = `${rect.width}px`;\n ghost.style.height = `${rect.height}px`;\n ghost.style.left = `${rect.left}px`;\n ghost.style.top = `${rect.top}px`;\n ghost.style.margin = '0';\n ghost.style.transform = 'translate(0px, 0px)';\n ghost.style.transition = 'none';\n ghost.style.opacity = '0.9';\n ghost.style.boxShadow = '0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)';\n document.body.appendChild(ghost);\n\n return ghost;\n };\n\n const discoverListRefs = () => {\n if (dnd) {\n for (const [cId, cInfo] of dnd.containers) {\n if (!cInfo.listRef.current || !cInfo.listRef.current.isConnected) {\n const scopedId = `${dnd.uid}_${cId}`;\n const listEl = document.querySelector(`[data-sortable-list=\"${scopedId}\"]`) as HTMLElement | null;\n\n if (listEl) {\n cInfo.listRef.current = listEl;\n }\n }\n }\n }\n };\n\n const getItemDndProps = (index: number) => {\n if (disabled) return { 'data-sortable-item': '', 'data-sortable-container': String(id) };\n\n return {\n 'data-sortable-item': '',\n 'data-sortable-container': String(id),\n onPointerDown: (e: React.PointerEvent<HTMLElement>) => {\n if (e.button !== 0 || disabled) return;\n\n const node = e.currentTarget;\n const listEl = node.parentElement as HTMLElement;\n\n if (listEl) {\n listRef.current = listEl;\n\n if (dnd && id != null) {\n const c = dnd.containers.get(id);\n\n if (c) c.listRef.current = listEl;\n }\n }\n\n discoverListRefs();\n\n const rect = node.getBoundingClientRect();\n const startX = e.clientX;\n const startY = e.clientY;\n let activated = false;\n\n const containerId = id;\n const hasMultipleContainers = dnd ? dnd.containers.size > 1 : false;\n\n const itemsAtStart = new Map<unknown, unknown[]>();\n\n if (dnd) {\n for (const [cId, cInfo] of dnd.containers) {\n itemsAtStart.set(cId, [...cInfo.items]);\n }\n } else {\n itemsAtStart.set(id, [...itemsRef.current]);\n }\n\n let lastPointerX = startX;\n let lastPointerY = startY;\n\n const updateProjection = () => {\n const state = dragStateRef.current;\n\n if (!state) return;\n\n let hoveredContainerId = state.originContainerId;\n\n if (hasMultipleContainers && dnd) {\n for (const [cId, cInfo] of dnd.containers) {\n // Re-discover stale or missing refs on the fly\n if (!cInfo.listRef.current || !cInfo.listRef.current.isConnected) {\n const scopedId = `${dnd.uid}_${cId}`;\n const listEl = document.querySelector(`[data-sortable-list=\"${scopedId}\"]`) as HTMLElement | null;\n\n if (listEl) cInfo.listRef.current = listEl;\n }\n\n const cRect = cInfo.listRef.current?.getBoundingClientRect();\n\n if (cRect && lastPointerX >= cRect.left && lastPointerX <= cRect.right && lastPointerY >= cRect.top && lastPointerY <= cRect.bottom) {\n hoveredContainerId = cId;\n break;\n }\n }\n }\n\n const hoveredList = hasMultipleContainers && dnd ? dnd.containers.get(hoveredContainerId)?.listRef.current : listRef.current;\n\n if (!hoveredList) return;\n\n const oList = hasMultipleContainers && dnd ? dnd.containers.get(state.originContainerId)?.listRef.current : listRef.current;\n const scrollDelta = (oList?.scrollTop ?? 0) - state.startScrollTop;\n const dy = lastPointerY - state.startY;\n const step = state.itemHeight + state.gap;\n const hoveredItems = state.itemsAtStart.get(hoveredContainerId) ?? [];\n\n let projected: number;\n\n if (hoveredContainerId === state.originContainerId) {\n projected = state.fromIndex + Math.round((dy + scrollDelta) / step);\n projected = Math.max(0, Math.min(hoveredItems.length - 1, projected));\n } else {\n const listRect = hoveredList.getBoundingClientRect();\n const listPadding = parseFloat(getComputedStyle(hoveredList).paddingTop) || 0;\n const relY = lastPointerY - listRect.top - listPadding;\n\n projected = Math.round(relY / step);\n projected = Math.max(0, Math.min(hoveredItems.length, projected));\n }\n\n const sideChanged = hoveredContainerId !== state.currentContainerId;\n\n if (sideChanged || projected !== state.projectedIndex) {\n // When switching containers, smooth-clear the old hovered list\n if (sideChanged && dnd) {\n const oldList = dnd.containers.get(state.currentContainerId)?.listRef.current;\n\n if (oldList) clearShifts(oldList);\n }\n\n state.currentContainerId = hoveredContainerId;\n state.projectedIndex = projected;\n\n if (dnd) {\n dnd.setState({ currentContainerId: hoveredContainerId, projectedIndex: projected });\n }\n\n if (hoveredContainerId === state.originContainerId) {\n // Move clone back to origin list (before the dragged node)\n if (sideChanged) {\n state.node.parentElement?.insertBefore(state.clone, state.node);\n }\n\n state.clone.style.height = `${state.itemHeight}px`;\n state.clone.style.overflow = '';\n applyShifts(hoveredList, state.fromIndex, projected, state.node, state.clone, state.itemHeight, state.gap);\n } else {\n // Measure the hovered list's own step — may differ from origin list's step.\n const hoveredItems = getSortableItems(hoveredList);\n const hoveredStep = hoveredItems.length >= 2 ? hoveredItems[1].getBoundingClientRect().top - hoveredItems[0].getBoundingClientRect().top : state.itemHeight + state.gap;\n\n // On container switch: move clone to document.body as position:fixed.\n // This avoids any layout impact on the hovered list (no scroll growth).\n if (sideChanged) {\n document.body.appendChild(state.clone);\n state.clone.style.position = 'fixed';\n state.clone.style.height = `${state.itemHeight}px`;\n state.clone.style.overflow = 'hidden';\n state.clone.style.transform = '';\n state.clone.style.margin = '0';\n state.clone.style.zIndex = '9998';\n state.clone.style.pointerEvents = 'none';\n state.clone.style.boxSizing = 'border-box';\n hoveredList.style.position = '';\n }\n\n // Position clone at the projected slot using fixed viewport coords.\n // Use offsetTop (transform-independent) + list viewport offset for accuracy.\n const listRect = hoveredList.getBoundingClientRect();\n const listScrollTop = hoveredList.scrollTop;\n const listPadding = parseFloat(getComputedStyle(hoveredList).paddingTop) || 0;\n\n let cloneFixedTop: number;\n\n if (hoveredItems.length === 0) {\n cloneFixedTop = listRect.top + listPadding;\n } else if (projected < hoveredItems.length) {\n // Use getBoundingClientRect which accounts for scrollTop correctly.\n // Called before shift transforms are applied, so value is layout-accurate.\n cloneFixedTop = hoveredItems[projected].getBoundingClientRect().top;\n } else {\n const last = hoveredItems[hoveredItems.length - 1];\n\n cloneFixedTop = last.getBoundingClientRect().bottom + (hoveredStep - last.getBoundingClientRect().height);\n }\n\n state.clone.style.top = `${cloneFixedTop}px`;\n state.clone.style.left = `${listRect.left}px`;\n state.clone.style.width = `${listRect.width}px`;\n state.clone.style.transform = '';\n\n // Shift items at and after projected down to make room for clone\n for (let i = 0; i < hoveredItems.length; i++) {\n hoveredItems[i].style.transform = i >= projected ? `translateY(${hoveredStep}px)` : '';\n }\n }\n }\n\n return hoveredList;\n };\n\n const onMove = (ev: PointerEvent) => {\n const dist = Math.sqrt((ev.clientX - startX) ** 2 + (ev.clientY - startY) ** 2);\n\n if (!activated && dist < 5) return;\n\n if (!activated) {\n activated = true;\n\n const list = listRef.current;\n const gap = list ? getListGap(list) : 4;\n\n let clone: HTMLElement;\n\n if (placeholderMode === 'empty') {\n clone = document.createElement(node.tagName) as HTMLElement;\n } else {\n clone = node.cloneNode(true) as HTMLElement;\n }\n\n clone.setAttribute('inert', 'true');\n clone.setAttribute('data-sortable-placeholder', '');\n clone.removeAttribute('data-sortable-item');\n clone.removeAttribute('data-sortable-container');\n clone.style.width = `${rect.width}px`;\n clone.style.height = `${rect.height}px`;\n clone.style.flexShrink = '0';\n clone.style.transition = 'transform 200ms ease, opacity 150ms ease';\n clone.style.opacity = '0';\n node.parentElement?.insertBefore(clone, node);\n // Fade clone in on next frame so the slot opens smoothly\n requestAnimationFrame(() => {\n clone.style.opacity = '1';\n });\n\n // Blur the list so Listbox clears its focusedOptionIndex (removes p-focus class)\n listRef.current?.blur();\n\n // Create ghost BEFORE modifying node (cloneNode copies current inline styles)\n const ghost = createGhost(node, rect);\n\n // Keep node in DOM but out of flow — clone holds the layout slot.\n // Remove data-sortable-item so getSortableItems ignores it during drag.\n node.setAttribute('data-dragging', '');\n node.removeAttribute('data-sortable-item');\n node.style.position = 'absolute';\n node.style.visibility = 'hidden';\n node.style.pointerEvents = 'none';\n\n // Disable pointer events on all sibling items to prevent CSS :hover during drag\n const listEl2 = node.parentElement;\n\n if (listEl2) {\n for (const sibling of getSortableItems(listEl2)) {\n if (sibling !== node) {\n sibling.style.pointerEvents = 'none';\n sibling.style.transition = 'transform 200ms ease';\n }\n }\n }\n\n // For multi-container DnD, also prep the other list's items\n if (dnd) {\n for (const [cId, cInfo] of dnd.containers) {\n if (cId !== containerId && cInfo.listRef.current) {\n for (const sibling of getSortableItems(cInfo.listRef.current)) {\n sibling.style.pointerEvents = 'none';\n sibling.style.transition = 'transform 200ms ease';\n }\n }\n }\n }\n\n dragStateRef.current = {\n startX,\n startY,\n startScrollTop: list?.scrollTop ?? 0,\n node,\n ghost,\n clone,\n itemHeight: rect.height,\n gap,\n fromIndex: index,\n projectedIndex: index,\n originContainerId: containerId,\n currentContainerId: containerId,\n itemsAtStart\n };\n\n setDragging(true);\n\n if (dnd) {\n dnd.setState({\n dragging: true,\n activeContainerId: containerId,\n currentContainerId: containerId,\n fromIndex: index,\n projectedIndex: index\n });\n }\n }\n\n const state = dragStateRef.current;\n\n if (!state) return;\n\n lastPointerX = ev.clientX;\n lastPointerY = ev.clientY;\n\n state.ghost.style.transform = `translate(${ev.clientX - state.startX}px, ${ev.clientY - state.startY}px)`;\n\n const hoveredList = updateProjection();\n\n // Auto-scroll\n cancelAnimationFrame(scrollRafRef.current);\n\n if (hoveredList) {\n const scrollThreshold = 40;\n const scrollSpeed = 8;\n\n const autoScroll = () => {\n const lr = hoveredList.getBoundingClientRect();\n const distTop = lastPointerY - lr.top;\n const distBottom = lr.bottom - lastPointerY;\n\n let scrolled = false;\n\n if (distTop > 0 && distTop < scrollThreshold) {\n hoveredList.scrollTop -= scrollSpeed;\n scrolled = true;\n } else if (distBottom > 0 && distBottom < scrollThreshold) {\n hoveredList.scrollTop += scrollSpeed;\n scrolled = true;\n }\n\n if (scrolled) {\n // Force clone reposition after scroll by invalidating cached projected index\n if (dragStateRef.current) dragStateRef.current.projectedIndex = -1;\n updateProjection();\n scrollRafRef.current = requestAnimationFrame(autoScroll);\n }\n };\n\n autoScroll();\n }\n };\n\n const onUp = () => {\n document.removeEventListener('pointermove', onMove);\n document.removeEventListener('pointerup', onUp);\n cancelAnimationFrame(scrollRafRef.current);\n\n const state = dragStateRef.current;\n\n if (!state) return;\n\n const isCrossList = state.currentContainerId !== state.originContainerId;\n\n let finalized = false;\n\n const finalize = () => {\n if (finalized) return;\n\n finalized = true;\n state.ghost.removeEventListener('transitionend', finalize);\n cancelAnimationFrame(scrollRafRef.current);\n\n // Remove ghost and placeholder\n state.ghost.remove();\n state.clone.remove();\n\n // Collect all relevant lists\n const allLists: HTMLElement[] = [];\n\n if (dnd && dnd.containers.size > 1) {\n for (const [, cInfo] of dnd.containers) {\n if (cInfo.listRef.current) allLists.push(cInfo.listRef.current);\n }\n } else if (listRef.current) {\n allLists.push(listRef.current);\n }\n\n // Keep node in DOM — React will replace or reconcile it during flushSync.\n // Restore position so it participates in layout correctly,\n // but keep visibility:hidden + pointer-events:none until after flushSync.\n state.node.style.position = '';\n state.node.removeAttribute('data-dragging');\n state.node.setAttribute('data-sortable-item', '');\n\n // Freeze transforms and restore pointer-events before React re-render\n for (const list of allLists) {\n for (const child of getSortableItems(list)) {\n child.style.transition = 'none';\n child.style.transform = '';\n child.style.pointerEvents = '';\n }\n }\n\n flushSync(() => {\n if (!isCrossList) {\n if (state.fromIndex !== state.projectedIndex) {\n if (dnd?.onSort) {\n dnd.onSort({ containerId: state.originContainerId, fromIndex: state.fromIndex, toIndex: state.projectedIndex });\n } else if (onSort) {\n onSort({ containerId: state.originContainerId, fromIndex: state.fromIndex, toIndex: state.projectedIndex });\n }\n }\n } else {\n dnd?.onTransfer?.({\n from: { containerId: state.originContainerId, index: state.fromIndex },\n to: { containerId: state.currentContainerId, index: state.projectedIndex }\n });\n }\n });\n\n // Force reflow then restore transitions\n for (const list of allLists) {\n void list.offsetHeight;\n\n for (const child of getSortableItems(list)) {\n child.style.transition = '';\n child.style.visibility = '';\n child.style.pointerEvents = '';\n }\n }\n\n dragStateRef.current = null;\n setDragging(false);\n\n if (dnd) {\n dnd.setState({\n dragging: false,\n activeContainerId: null,\n currentContainerId: null,\n fromIndex: -1,\n projectedIndex: -1\n });\n }\n\n // Restore focus to the drop target list with the correct item focused.\n // data-dnd-focus-index is read by useListbox.onListFocus to set focusedOptionIndex.\n const dropContainerId = isCrossList ? state.currentContainerId : state.originContainerId;\n const dropList = hasMultipleContainers && dnd ? dnd.containers.get(dropContainerId)?.listRef.current : listRef.current;\n\n if (dropList) {\n dropList.dataset.dndFocusIndex = String(state.projectedIndex);\n dropList.focus();\n delete dropList.dataset.dndFocusIndex;\n }\n };\n\n // Fade ghost out in place — no positional animation to avoid jump artifacts\n state.ghost.style.transition = 'opacity 150ms ease-out';\n state.ghost.style.opacity = '0';\n\n state.ghost.addEventListener('transitionend', finalize, { once: true });\n\n setTimeout(() => {\n if (dragStateRef.current === state) {\n finalize();\n }\n }, 200);\n };\n\n document.addEventListener('pointermove', onMove);\n document.addEventListener('pointerup', onUp);\n }\n };\n };\n\n const state = {\n dragging\n };\n\n const rootProps = React.useMemo(\n () => ({\n 'data-scope': 'dnd',\n 'data-part': 'sortable-container',\n ...(dragging ? { 'data-active': '' } : undefined),\n ...(disabled ? { 'data-disabled': '' } : undefined)\n }),\n [dragging, disabled]\n );\n\n const listProps = React.useMemo(\n () => ({\n 'data-sortable-list': scopedListId\n }),\n [scopedListId]\n );\n\n return {\n state,\n getItemDndProps,\n listProps,\n rootProps\n };\n }\n});\n","import type { UseSortableContainerProps } from '@primereact/types/headless/dnd';\n\nexport const defaultProps: UseSortableContainerProps = {\n dnd: undefined,\n id: undefined,\n items: undefined,\n disabled: false,\n placeholder: 'empty',\n onSort: undefined\n};\n"],"mappings":"8bAAA,OAAS,gBAAAA,OAAoB,4BAC7B,UAAYC,MAAW,QCChB,IAAMC,GAA4B,CACrC,OAAQ,OACR,WAAY,MAChB,EDsBA,IAAMC,GAAqC,CACvC,SAAU,GACV,kBAAmB,KACnB,mBAAoB,KACpB,UAAW,GACX,eAAgB,EACpB,EAEA,SAASC,GAAkBC,EAA6B,CACpD,IAAMC,EAAa,IAAI,IACnBC,EAA6BC,EAAA,GAAKL,IAChCM,EAAc,IAAI,IAElBC,EAAS,IAAM,CACjB,QAAWC,KAAMF,EAAaE,EAAG,CACrC,EAEA,MAAO,CACH,IAAAN,EACA,WAAAC,EAEA,UAAW,CACP,OAAOC,CACX,EAEA,UAAUI,EAAgB,CACtB,OAAAF,EAAY,IAAIE,CAAE,EAEX,IAAM,CACTF,EAAY,OAAOE,CAAE,CACzB,CACJ,EAEA,SAASC,EAAsC,CAC3CL,EAAQC,IAAA,GAAKD,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ACA,CAACA,CAAY,CACjB,EAEA,MAAO,CACH,MAAAgD,GACA,gBAAAhB,GACA,UAAAwD,GACA,UAAAF,EACJ,CACJ,CACJ,CAAC","names":["withHeadless","React","defaultProps","INITIAL_STATE","createCoordinator","uid","containers","state","__spreadValues","subscribers","notify","fn","update","NOOP_SUBSCRIBE","useDnd","withHeadless","defaultProps","props","dndId","coordinatorRef","dnd","subscribe","getSnapshot","rootProps","withHeadless","React","defaultProps","NOOP_SUBSCRIBE","useDraggable","withHeadless","defaultProps","props","elementRef","_a","dnd","id","dataRef","node","cleanups","cleanup","subscribe","listener","isDragging","state","rootProps","__spreadProps","__spreadValues","withHeadless","React","defaultProps","NOOP_SUBSCRIBE","useDroppable","withHeadless","defaultProps","props","elementRef","dnd","id","_a","node","subscribe","listener","isOver","collisions","state","rootProps","__spreadValues","withHeadless","React","defaultProps","NOOP_SUBSCRIBE","useSortable","withHeadless","defaultProps","props","dnd","id","subscribe","listener","isDragging","state","rootProps","__spreadValues","withHeadless","React","flushSync","defaultProps","getSortableItems","listEl","useSortableContainer","withHeadless","defaultProps","props","_a","_b","_c","dnd","id","items","disabled","placeholderMode","onSort","scopedListId","listRef","itemsRef","c","dragging","setDragging","scrollRafRef","dragStateRef","applyShifts","fromIndex","projectedIndex","draggedNode","clone","itemHeight","gap","shift","realItems","i","logicalIndex","offset","clearShifts","child","getListGap","children","createGhost","node","rect","ghost","discoverListRefs","cId","cInfo","scopedId","getItemDndProps","index","e","startX","startY","activated","containerId","hasMultipleContainers","itemsAtStart","lastPointerX","lastPointerY","updateProjection","_d","_e","_f","_g","state","hoveredContainerId","cRect","hoveredList","oList","scrollDelta","dy","step","hoveredItems","projected","listRect","listPadding","relY","sideChanged","oldList","hoveredStep","listScrollTop","cloneFixedTop","last","onMove","ev","dist","list","listEl2","sibling","autoScroll","lr","distTop","distBottom","scrolled","onUp","isCrossList","finalized","finalize","allLists","flushSync","dropContainerId","dropList","rootProps","__spreadValues","listProps"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/drawer/useDrawer.ts","../../src/drawer/useDrawer.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { useFocusTrap } from '@primereact/headless/focustrap';\nimport { useEventListener, useUnmountEffect } from '@primereact/hooks';\nimport { useControlledState } from '@primereact/hooks/use-controlled-state';\nimport { $dt } from '@primeuix/styled';\nimport { blockBodyScroll, focus, toElement, unblockBodyScroll, ZIndex } from '@primeuix/utils';\nimport * as React from 'react';\nimport { defaultProps } from './useDrawer.props';\n\nexport const useDrawer = withHeadless({\n name: 'useDrawer',\n defaultProps,\n setup: ({ props, id, elementRef, $primereact }) => {\n const [openState, setOpenState] = useControlledState({\n value: props.open,\n defaultValue: props.defaultOpen,\n onChange: props.onOpenChange\n });\n const [popupElement, setPopupElement] = React.useState<HTMLElement | null>(null);\n const [backdropElement, setBackdropElement] = React.useState<HTMLElement | null>(null);\n const popupRef = React.useRef<HTMLElement | null>(null);\n const backdropRef = React.useRef<HTMLElement | null>(null);\n const closeButtonRef = React.useRef<HTMLElement | null>(null);\n const maskMouseDownTarget = React.useRef<EventTarget | null>(null);\n const target = React.useRef<HTMLElement | null>(null);\n\n const state = {\n open: !!openState,\n trapped: !!props.trapped,\n popupElement,\n backdropElement\n };\n\n const focusTrap = useFocusTrap({\n trapped: !!props.trapped && !!popupElement,\n autoFocus: false\n });\n\n useUnmountEffect(() => {\n if (props.autoZIndex && popupRef.current) {\n ZIndex.clear(popupRef.current as HTMLDivElement);\n }\n });\n\n const setPopupRef = React.useCallback((node: HTMLDivElement | { elementRef: React.RefObject<HTMLDivElement> } | null) => {\n const element = (toElement(node) ?? null) as HTMLDivElement | null;\n\n if (element === popupRef.current) return;\n\n popupRef.current = element;\n focusTrap.containerRef.current = element;\n setPopupElement(element);\n }, []);\n\n const setBackdropRef = React.useCallback((node: HTMLElement | null) => {\n const element = (toElement(node) ?? null) as HTMLElement | null;\n\n if (element === backdropRef.current) return;\n\n backdropRef.current = element;\n setBackdropElement(element);\n }, []);\n\n const setCloseButtonRef = React.useCallback((node: HTMLButtonElement | { elementRef: React.RefObject<HTMLButtonElement> } | null) => {\n const element = (toElement(node) ?? null) as HTMLButtonElement | null;\n\n if (element === closeButtonRef.current) return;\n\n closeButtonRef.current = element;\n }, []);\n\n const close = () => {\n setOpenState([false, { value: false }]);\n };\n\n const onOpenStateChange = () => {\n const newOpenState = !openState;\n\n setOpenState([newOpenState, { value: newOpenState }]);\n };\n\n const onOpenComplete = React.useCallback(() => {\n if (!popupRef.current) return;\n\n const focusTarget = popupRef.current.querySelector('[autoFocus]') as HTMLElement | null;\n\n if (focusTarget) {\n focus(focusTarget);\n } else if (closeButtonRef.current) {\n focus(closeButtonRef.current);\n }\n }, []);\n\n const onCloseComplete = React.useCallback(() => {\n props.onExitComplete?.();\n }, [props.onExitComplete]);\n\n React.useEffect(() => {\n if (openState) {\n target.current = document.activeElement as HTMLElement;\n bindDocumentKeyDownListener();\n\n if (props.dismissable) {\n bindOutsideClickListener();\n }\n\n if (props.blockScroll) {\n blockBodyScroll({ variableName: $dt('scrollbar.width').name });\n }\n } else {\n unbindDocumentKeyDownListener();\n unbindOutsideClickListener();\n\n if (props.blockScroll) {\n unblockBodyScroll({ variableName: $dt('scrollbar.width').name });\n }\n\n if (target.current) {\n focus(target.current);\n target.current = null;\n }\n }\n }, [openState]);\n\n React.useEffect(() => {\n if (!popupElement) return;\n\n if (props.autoZIndex) {\n const baseZ = (props.baseZIndex ?? 0) + ($primereact.config?.zIndex?.modal ?? 1100);\n\n if (backdropElement) {\n ZIndex.set('modal', backdropElement, baseZ);\n }\n\n ZIndex.set('modal', popupElement, baseZ);\n }\n\n return () => {\n if (props.autoZIndex) {\n if (backdropElement) ZIndex.clear(backdropElement);\n\n ZIndex.clear(popupElement);\n }\n };\n }, [popupElement, backdropElement, props.autoZIndex, props.baseZIndex, $primereact.config?.zIndex?.modal]);\n\n const [bindDocumentKeyDownListener, unbindDocumentKeyDownListener] = useEventListener({\n type: 'keydown',\n listener: (event: Event) => onKeyDown(event as unknown as React.KeyboardEvent)\n });\n\n const [bindOutsideClickListener, unbindOutsideClickListener] = useEventListener({\n type: 'click',\n listener: (event) => {\n if (isOutsideClicked(event as unknown as React.MouseEvent)) {\n close();\n }\n }\n });\n\n const isOutsideClicked = (event: React.MouseEvent) => {\n return elementRef.current && !elementRef.current.contains(event.target as Node);\n };\n\n const onKeyDown = (event: React.KeyboardEvent): void => {\n if (event.code === 'Escape') {\n close();\n }\n };\n\n const onMaskMouseDown = (event: React.MouseEvent) => {\n maskMouseDownTarget.current = event.target;\n };\n\n const onMaskMouseUp = () => {\n if (props.dismissable && backdropRef.current === maskMouseDownTarget.current) {\n close();\n }\n };\n\n const rootProps = {\n id,\n 'data-scope': 'drawer',\n 'data-part': 'root',\n ...(openState ? { 'data-open': '' as const } : { 'data-closed': '' as const }),\n 'data-position': props.position\n };\n\n const triggerProps = {\n 'data-scope': 'drawer',\n 'data-part': 'trigger',\n type: 'button' as const,\n 'aria-expanded': openState ?? false,\n 'aria-controls': id ?? '',\n onClick: onOpenStateChange\n };\n\n const backdropProps = {\n ref: setBackdropRef,\n onMouseDown: onMaskMouseDown,\n onMouseUp: onMaskMouseUp\n };\n\n const closeProps = {\n 'data-scope': 'drawer',\n 'data-part': 'close',\n type: 'button' as const,\n ref: setCloseButtonRef,\n onClick: close\n };\n\n const headerProps = {\n id: id + '_header',\n 'data-scope': 'drawer',\n 'data-part': 'header'\n };\n\n const popupProps = {\n id,\n ref: setPopupRef,\n role: 'complementary' as const,\n 'aria-modal': true as const,\n 'data-scope': 'drawer',\n 'data-part': 'root',\n 'data-position': props.position,\n ...(openState && { 'data-open': '' as const })\n };\n\n return {\n state,\n focusTrap,\n // prop getters\n triggerProps,\n rootProps,\n backdropProps,\n closeProps,\n headerProps,\n popupProps,\n // methods\n close,\n onOpenStateChange,\n onMaskMouseDown,\n onMaskMouseUp,\n onOpenComplete,\n onCloseComplete\n };\n }\n});\n","import type { UseDrawerProps } from '@primereact/types/headless/drawer';\n\nexport const defaultProps: UseDrawerProps = {\n open: undefined,\n defaultOpen: undefined,\n trapped: true,\n blockScroll: false,\n dismissable: true,\n baseZIndex: 0,\n autoZIndex: true,\n position: 'left',\n onOpenChange: undefined,\n onExitComplete: undefined\n};\n"],"mappings":"ubAAA,OAAS,gBAAAA,OAAoB,4BAC7B,OAAS,gBAAAC,OAAoB,iCAC7B,OAAS,oBAAAC,EAAkB,oBAAAC,OAAwB,oBACnD,OAAS,sBAAAC,OAA0B,yCACnC,OAAS,OAAAC,MAAW,mBACpB,OAAS,mBAAAC,GAAiB,SAAAC,EAAO,aAAAC,EAAW,qBAAAC,GAAmB,UAAAC,MAAc,kBAC7E,UAAYC,MAAW,QCJhB,IAAMC,EAA+B,CACxC,KAAM,OACN,YAAa,OACb,QAAS,GACT,YAAa,GACb,YAAa,GACb,WAAY,EACZ,WAAY,GACZ,SAAU,OACV,aAAc,OACd,eAAgB,MACpB,EDJO,IAAMC,GAAYC,GAAa,CAClC,KAAM,YACN,aAAAC,EACA,MAAO,CAAC,CAAE,MAAAC,EAAO,GAAAC,EAAI,WAAAC,EAAY,YAAAC,CAAY,IAAM,CAZvD,IAAAC,EAAAC,EAaQ,GAAM,CAACC,EAAWC,CAAY,EAAIC,GAAmB,CACjD,MAAOR,EAAM,KACb,aAAcA,EAAM,YACpB,SAAUA,EAAM,YACpB,CAAC,EACK,CAACS,EAAcC,CAAe,EAAU,WAA6B,IAAI,EACzE,CAACC,EAAiBC,CAAkB,EAAU,WAA6B,IAAI,EAC/EC,EAAiB,SAA2B,IAAI,EAChDC,EAAoB,SAA2B,IAAI,EACnDC,EAAuB,SAA2B,IAAI,EACtDC,EAA4B,SAA2B,IAAI,EAC3DC,EAAe,SAA2B,IAAI,EAE9CC,EAAQ,CACV,KAAM,CAAC,CAACZ,EACR,QAAS,CAAC,CAACN,EAAM,QACjB,aAAAS,EACA,gBAAAE,CACJ,EAEMQ,EAAYC,GAAa,CAC3B,QAAS,CAAC,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GACrDlB,EAAM,CAEd,CACJ,CAAC,EAEKoB,EAAoBF,GACf7C,EAAW,SAAW,CAACA,EAAW,QAAQ,SAAS6C,EAAM,MAAc,EAG5EC,EAAaD,GAAqC,CAChDA,EAAM,OAAS,UACflB,EAAM,CAEd,EAEMqB,EAAmBH,GAA4B,CACjD/B,EAAoB,QAAU+B,EAAM,MACxC,EAEMI,EAAgB,IAAM,CACpBnD,EAAM,aAAec,EAAY,UAAYE,EAAoB,SACjEa,EAAM,CAEd,EAEMuB,EAAYC,EAAAC,EAAA,CACd,GAAArD,EACA,aAAc,SACd,YAAa,QACTK,EAAY,CAAE,YAAa,EAAY,EAAI,CAAE,cAAe,EAAY,GAJ9D,CAKd,gBAAiBN,EAAM,QAC3B,GAEMuD,EAAe,CACjB,aAAc,SACd,YAAa,UACb,KAAM,SACN,gBAAiBjD,GAAA,KAAAA,EAAa,GAC9B,gBAAiBL,GAAA,KAAAA,EAAM,GACvB,QAAS6B,CACb,EAEM0B,EAAgB,CAClB,IAAK7B,EACL,YAAauB,EACb,UAAWC,CACf,EAEMM,EAAa,CACf,aAAc,SACd,YAAa,QACb,KAAM,SACN,IAAK7B,EACL,QAASC,CACb,EAEM6B,GAAc,CAChB,GAAIzD,EAAK,UACT,aAAc,SACd,YAAa,QACjB,EAEM0D,GAAaL,EAAA,CACf,GAAArD,EACA,IAAKsB,EACL,KAAM,gBACN,aAAc,GACd,aAAc,SACd,YAAa,OACb,gBAAiBvB,EAAM,UACnBM,GAAa,CAAE,YAAa,EAAY,GAGhD,MAAO,CACH,MAAAY,EACA,UAAAC,EAEA,aAAAoC,EACA,UAAAH,EACA,cAAAI,EACA,WAAAC,EACA,YAAAC,GACA,WAAAC,GAEA,MAAA9B,EACA,kBAAAC,EACA,gBAAAoB,EACA,cAAAC,EACA,eAAAnB,EACA,gBAAAG,CACJ,CACJ,CACJ,CAAC","names":["withHeadless","useFocusTrap","useEventListener","useUnmountEffect","useControlledState","$dt","blockBodyScroll","focus","toElement","unblockBodyScroll","ZIndex","React","defaultProps","useDrawer","withHeadless","defaultProps","props","id","elementRef","$primereact","_a","_b","openState","setOpenState","useControlledState","popupElement","setPopupElement","backdropElement","setBackdropElement","popupRef","backdropRef","closeButtonRef","maskMouseDownTarget","target","state","focusTrap","useFocusTrap","useUnmountEffect","ZIndex","setPopupRef","node","element","toElement","setBackdropRef","setCloseButtonRef","close","onOpenStateChange","newOpenState","onOpenComplete","focusTarget","focus","onCloseComplete","bindDocumentKeyDownListener","bindOutsideClickListener","blockBodyScroll","$dt","unbindDocumentKeyDownListener","unbindOutsideClickListener","unblockBodyScroll","_c","_d","baseZ","useEventListener","event","onKeyDown","isOutsideClicked","onMaskMouseDown","onMaskMouseUp","rootProps","__spreadProps","__spreadValues","triggerProps","backdropProps","closeProps","headerProps","popupProps"]}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/fieldset/useFieldset.ts","../../src/fieldset/useFieldset.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { useCollapsible } from '@primereact/headless/collapsible';\nimport * as React from 'react';\nimport { defaultProps } from './useFieldset.props';\n\nexport const useFieldset = withHeadless({\n name: 'useFieldset',\n defaultProps,\n setup({ props }) {\n const collapsible = useCollapsible(props);\n\n // methods\n const onTriggerClick = (event?: React.SyntheticEvent) => {\n collapsible?.toggle(event);\n event?.preventDefault();\n };\n\n // prop getters\n const indicatorProps = {\n 'data-scope': 'fieldset',\n 'data-part': 'indicator',\n [collapsible?.state.open ? 'data-open' : 'data-closed']: ''\n };\n\n const triggerProps = {\n ...collapsible?.triggerProps,\n 'data-scope': 'fieldset',\n 'data-part': 'trigger',\n onClick: onTriggerClick\n };\n\n const contentProps = {\n ...collapsible?.contentProps,\n 'data-scope': 'fieldset',\n 'data-part': 'content'\n };\n\n const rootProps = {\n ...collapsible?.rootProps,\n 'data-scope': 'fieldset',\n 'data-part': 'root'\n };\n\n return {\n ...collapsible,\n // prop getters\n rootProps,\n contentProps,\n triggerProps,\n indicatorProps\n };\n }\n});\n","import * as useCollapsible from '@primereact/headless/collapsible';\nimport type { UseFieldsetProps } from '@primereact/types/headless/fieldset';\n\nexport const defaultProps: UseFieldsetProps = {\n ...useCollapsible.defaultProps\n};\n"],"mappings":"6aAAA,OAAS,gBAAAA,MAAoB,4BAC7B,OAAS,kBAAAC,MAAsB,mCCD/B,UAAYC,MAAoB,mCAGzB,IAAMC,EAAiCC,EAAA,GACxB,gBDCf,IAAMC,EAAcC,EAAa,CACpC,KAAM,cACN,aAAAC,EACA,MAAM,CAAE,MAAAC,CAAM,EAAG,CACb,IAAMC,EAAcC,EAAeF,CAAK,EAGlCG,EAAkBC,GAAiC,CACrDH,GAAA,MAAAA,EAAa,OAAOG,GACpBA,GAAA,MAAAA,EAAO,gBACX,EAGMC,EAAiB,CACnB,aAAc,WACd,YAAa,YACb,CAACJ,GAAA,MAAAA,EAAa,MAAM,KAAO,YAAc,aAAa,EAAG,EAC7D,EAEMK,EAAeC,EAAAC,EAAA,GACdP,GAAA,YAAAA,EAAa,cADC,CAEjB,aAAc,WACd,YAAa,UACb,QAASE,CACb,GAEMM,EAAeF,EAAAC,EAAA,GACdP,GAAA,YAAAA,EAAa,cADC,CAEjB,aAAc,WACd,YAAa,SACjB,GAEMS,EAAYH,EAAAC,EAAA,GACXP,GAAA,YAAAA,EAAa,WADF,CAEd,aAAc,WACd,YAAa,MACjB,GAEA,OAAOM,EAAAC,EAAA,GACAP,GADA,CAGH,UAAAS,EACA,aAAAD,EACA,aAAAH,EACA,eAAAD,CACJ,EACJ,CACJ,CAAC","names":["withHeadless","useCollapsible","useCollapsible","defaultProps","__spreadValues","useFieldset","withHeadless","defaultProps","props","collapsible","useCollapsible","onTriggerClick","event","indicatorProps","triggerProps","__spreadProps","__spreadValues","contentProps","rootProps"]}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/fileupload/useFileUpload.ts","../../src/fileupload/useFileUpload.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { addClass, isNotEmpty, removeClass } from '@primeuix/utils';\nimport * as React from 'react';\nimport { defaultProps } from './useFileUpload.props';\n\nexport const useFileUpload = withHeadless({\n name: 'useFileUpload',\n defaultProps,\n setup({ props, $primereact }) {\n const inputRef = React.useRef<HTMLInputElement | null>(null);\n const contentRef = React.useRef<HTMLDivElement | null>(null);\n const uploadedFileCount = React.useRef(0);\n\n const setInputRef = React.useCallback((node: HTMLInputElement | null) => {\n inputRef.current = node;\n }, []);\n\n const setContentRef = React.useCallback((node: HTMLDivElement | null) => {\n contentRef.current = node;\n }, []);\n\n const [filesState, setFilesState] = React.useState<File[]>([]);\n const [uploadedFilesState, setUploadedFilesState] = React.useState<File[]>([]);\n const [progressState, setProgressState] = React.useState(0);\n\n const hasFiles = React.useMemo(() => isNotEmpty(filesState), [filesState]);\n const hasUploadedFiles = React.useMemo(() => isNotEmpty(uploadedFilesState), [uploadedFilesState]);\n\n const state = {\n files: filesState,\n progress: progressState,\n uploadedFiles: uploadedFilesState\n };\n\n const upload = () => {\n if (hasFiles) {\n uploader(filesState);\n }\n };\n\n const onFileSelect = (event: React.ChangeEvent<HTMLInputElement> | DragEvent) => {\n const isDragEvent = (e: React.ChangeEvent<HTMLInputElement> | DragEvent): e is DragEvent => 'dataTransfer' in e && !!(e as DragEvent).dataTransfer;\n\n if (hasFiles) {\n setFilesState([]);\n }\n\n let currentFiles: File[] = [];\n\n if (props.multiple) {\n currentFiles = filesState ? [...filesState] : [];\n }\n\n const filesList = isDragEvent(event) ? event.dataTransfer?.files : (event.target as HTMLInputElement | null)?.files;\n\n if (!filesList) {\n return;\n }\n\n const rejectedFiles: { file?: File; errors: { reason: 'fileType' | 'fileSize' | 'fileLimit'; message: string }[] }[] = [];\n\n for (const file of Array.from(filesList)) {\n if (isFileSelected(file) || isFileLimitExceeded()) {\n continue;\n }\n\n const errors = validate(file);\n\n if (errors.length) {\n rejectedFiles.push({ file, errors });\n continue;\n }\n\n if (isImage(file)) {\n const fileWithUrl = file as File & { objectURL?: string };\n\n fileWithUrl.objectURL = window.URL.createObjectURL(file);\n }\n\n currentFiles.push(file);\n }\n\n setFilesState(currentFiles);\n\n if (props.fileLimit) {\n const limitError = checkFileLimit();\n\n if (limitError) {\n rejectedFiles.push({ errors: [limitError] });\n }\n }\n\n if (rejectedFiles.length && props.onError) {\n props.onError({ type: 'validation', rejectedFiles });\n }\n\n if (props.onChange) {\n props.onChange({ acceptedFiles: currentFiles, rejectedFiles });\n }\n\n if (props.auto && isNotEmpty(currentFiles) && !isFileLimitExceeded()) {\n uploader(currentFiles);\n }\n\n if (props.onSelect) {\n props.onSelect({ originalEvent: event, files: currentFiles });\n }\n\n clearInput();\n };\n\n const choose = () => {\n if (inputRef.current) {\n inputRef.current.click();\n }\n };\n\n const uploader = (uploadFiles = filesState) => {\n const filesToUpload = uploadFiles ?? filesState ?? [];\n\n if (props.customUpload) {\n if (props.fileLimit) {\n uploadedFileCount.current += filesToUpload.length;\n }\n\n if (props.uploadHandler) {\n props.uploadHandler({\n files: filesToUpload,\n options: {\n clear,\n props\n }\n });\n }\n } else {\n const xhr = new XMLHttpRequest();\n const formData = new FormData();\n\n if (props.onBeforeUpload) {\n props.onBeforeUpload({\n xhr,\n files: filesToUpload\n });\n }\n\n for (const file of filesToUpload) {\n formData.append(props.name as string, file, file.name);\n }\n\n xhr.upload.addEventListener('progress', (event) => {\n if (event.lengthComputable) {\n const progress = Math.round((event.loaded * 100) / event.total);\n\n setProgressState(progress);\n }\n\n if (props.onProgress) {\n props.onProgress({\n originalEvent: event,\n progress: progressState\n });\n }\n });\n\n xhr.onreadystatechange = () => {\n if (xhr.readyState === 4) {\n setProgressState(0);\n\n if (xhr.status >= 200 && xhr.status < 300) {\n if (props.fileLimit) {\n uploadedFileCount.current += filesToUpload.length;\n }\n\n if (props.onUpload) {\n props.onUpload({\n xhr,\n files: filesToUpload\n });\n }\n\n setUploadedFilesState((prevUploadedFiles) => [...prevUploadedFiles, ...filesToUpload]);\n } else {\n if (props.onError) {\n props.onError({\n type: 'upload',\n reason: 'upload',\n xhr,\n files: filesToUpload\n });\n }\n }\n\n clear();\n }\n };\n\n if (props.url) {\n xhr.open('POST', props.url, true);\n\n if (props.onBeforeSend) {\n props.onBeforeSend({\n xhr,\n formData\n });\n }\n\n xhr.withCredentials = !!props.withCredentials;\n\n xhr.send(formData);\n }\n }\n };\n\n const clear = () => {\n setFilesState([]);\n\n if (props.onClear) {\n props.onClear();\n }\n\n if (props.onChange) {\n props.onChange({ acceptedFiles: [], rejectedFiles: [] });\n }\n\n clearInput();\n };\n\n const isFileSelected = (file: File) => {\n if (filesState && filesState.length) {\n for (const sFile of filesState) {\n if (sFile.name + sFile.type + sFile.size === file.name + file.type + file.size) return true;\n }\n }\n\n return false;\n };\n\n const validate = (file: File): { reason: 'fileType' | 'fileSize'; message: string }[] => {\n const errors: { reason: 'fileType' | 'fileSize'; message: string }[] = [];\n\n if (props.accept && !isFileTypeValid(file)) {\n errors.push({\n reason: 'fileType',\n message: (props.invalidFileTypeMessage as string).replace('{0}', file.name).replace('{1}', props.accept as string)\n });\n }\n\n if (props.maxFileSize && file.size > props.maxFileSize) {\n errors.push({\n reason: 'fileSize',\n message: (props.invalidFileSizeMessage as string).replace('{0}', file.name).replace('{1}', formatSize(props.maxFileSize as number))\n });\n }\n\n return errors;\n };\n\n const isFileTypeValid = (file: File) => {\n const acceptableTypes = (props.accept as string).split(',').map((type) => type.trim());\n\n for (const type of acceptableTypes) {\n const acceptable = isWildcard(type) ? getTypeClass(file.type) === getTypeClass(type) : file.type == type || getFileExtension(file).toLowerCase() === type.toLowerCase();\n\n if (acceptable) {\n return true;\n }\n }\n\n return false;\n };\n\n const getTypeClass = (fileType: string) => {\n return fileType.substring(0, fileType.indexOf('/'));\n };\n\n const isWildcard = (fileType: string) => {\n return fileType.indexOf('*') !== -1;\n };\n\n const getFileExtension = (file: File) => {\n return '.' + file.name.split('.').pop();\n };\n\n const isImage = (file: File) => {\n return /^image\\//.test(file.type);\n };\n\n const onDragEnter = (event: DragEvent) => {\n if (!props.disabled && (!hasFiles || props.multiple)) {\n event.stopPropagation();\n event.preventDefault();\n }\n };\n\n const onDragOver = (event: DragEvent) => {\n if (!props.disabled && (!hasFiles || props.multiple)) {\n // !isUnstyled &&\n addClass(contentRef.current as HTMLDivElement, 'p-fileupload-highlight');\n (contentRef.current as HTMLDivElement).setAttribute('data-highlight', 'true');\n event.stopPropagation();\n event.preventDefault();\n }\n };\n\n const onDragLeave = () => {\n if (!props.disabled) {\n // !isUnstyled &&\n removeClass(contentRef.current as HTMLDivElement, 'p-fileupload-highlight');\n (contentRef.current as HTMLDivElement).setAttribute('data-highlight', 'false');\n }\n };\n\n const onDrop = (event: DragEvent) => {\n if (!props.disabled) {\n // !isUnstyled &&\n removeClass(contentRef.current as HTMLDivElement, 'p-fileupload-highlight');\n (contentRef.current as HTMLDivElement).setAttribute('data-highlight', 'false');\n event.stopPropagation();\n event.preventDefault();\n\n const files = event.dataTransfer?.files;\n const allowDrop = props.multiple || (files && files.length === 1);\n\n if (allowDrop) {\n onFileSelect(event);\n }\n }\n };\n\n const remove = (index: number) => {\n clearInput();\n const currentFiles = [...filesState];\n const removedFile = filesState[index];\n\n currentFiles.splice(index, 1);\n setFilesState(currentFiles);\n\n if (props.onRemove) {\n props.onRemove({\n file: removedFile\n });\n }\n\n if (props.onChange) {\n props.onChange({ acceptedFiles: currentFiles, rejectedFiles: [] });\n }\n };\n\n const removeUploadedFile = (index: number) => {\n const currentUploadedFiles = [...uploadedFilesState];\n\n currentUploadedFiles.splice(index, 1);\n setUploadedFilesState(currentUploadedFiles);\n\n if (props.onRemove) {\n props.onRemove({\n file: filesState[index]\n });\n }\n };\n\n const clearInput = () => {\n if (inputRef.current) {\n inputRef.current.value = '';\n }\n };\n\n const formatSize = (bytes: number) => {\n const k = 1024;\n const dm = 3;\n // @ts-expect-error TODO:\n const sizes = $primereact?.config?.locale?.fileSizeTypes || ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\n if (bytes === 0) {\n return `0 ${sizes[0]}`;\n }\n\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n const formattedSize = parseFloat((bytes / Math.pow(k, i)).toFixed(dm));\n\n return `${formattedSize} ${sizes[i]}`;\n };\n\n const isFileLimitExceeded = () => {\n return props.fileLimit && props.fileLimit < filesState.length + uploadedFileCount.current;\n };\n\n const checkFileLimit = (): { reason: 'fileLimit'; message: string } | null => {\n if (isFileLimitExceeded()) {\n return {\n reason: 'fileLimit',\n message: (props.invalidFileLimitMessage as string).replace('{0}', (props.fileLimit as number).toString())\n };\n }\n\n return null;\n };\n\n // prop getters\n const rootProps = {\n 'data-scope': 'fileupload' as const,\n 'data-part': 'root' as const,\n ...(props.disabled && { 'data-disabled': '' })\n };\n\n const inputProps = {\n ref: setInputRef,\n 'data-scope': 'fileupload' as const,\n 'data-part': 'text' as const,\n type: 'file' as const,\n accept: props.accept,\n multiple: props.multiple,\n disabled: props.disabled,\n onChange: onFileSelect\n };\n\n const contentProps = {\n ref: setContentRef,\n 'data-scope': 'fileupload' as const,\n 'data-part': 'content' as const,\n onDragEnter: onDragEnter as unknown as React.DragEventHandler<HTMLDivElement>,\n onDragOver: onDragOver as unknown as React.DragEventHandler<HTMLDivElement>,\n onDragLeave: onDragLeave as React.DragEventHandler<HTMLDivElement>,\n onDrop: onDrop as unknown as React.DragEventHandler<HTMLDivElement>\n };\n\n const chooseProps = {\n 'data-scope': 'fileupload' as const,\n 'data-part': 'choose' as const,\n onClick: choose,\n ...(props.disabled && { 'data-disabled': '' })\n };\n\n const uploadProps = {\n 'data-scope': 'fileupload' as const,\n 'data-part': 'upload' as const,\n onClick: upload,\n disabled: !hasFiles,\n ...(props.disabled && { 'data-disabled': '' })\n };\n\n const clearProps = {\n 'data-scope': 'fileupload' as const,\n 'data-part': 'clear' as const,\n onClick: clear,\n disabled: !hasFiles,\n ...(props.disabled && { 'data-disabled': '' })\n };\n\n const fileRemoveProps = {\n 'data-scope': 'fileupload' as const,\n 'data-part': 'fileRemove' as const\n };\n\n const fileProps = {\n 'data-scope': 'fileupload' as const,\n 'data-part': 'file' as const\n };\n\n const fileThumbnailProps = {\n 'data-scope': 'fileupload' as const,\n 'data-part': 'fileThumbnail' as const\n };\n\n const fileInfoProps = {\n 'data-scope': 'fileupload' as const,\n 'data-part': 'fileInfo' as const\n };\n\n const fileNameProps = {\n 'data-scope': 'fileupload' as const,\n 'data-part': 'fileName' as const\n };\n\n const fileSizeProps = {\n 'data-scope': 'fileupload' as const,\n 'data-part': 'fileSize' as const\n };\n\n const fileListProps = {\n 'data-scope': 'fileupload' as const,\n 'data-part': 'fileList' as const\n };\n\n return {\n state,\n uploadedFileCount,\n hasFiles,\n hasUploadedFiles,\n // prop getters\n rootProps,\n chooseProps,\n uploadProps,\n clearProps,\n inputProps,\n contentProps,\n fileRemoveProps,\n fileProps,\n fileThumbnailProps,\n fileInfoProps,\n fileNameProps,\n fileSizeProps,\n fileListProps,\n // methods\n upload,\n onFileSelect,\n choose,\n uploader,\n clear,\n remove,\n removeUploadedFile,\n formatSize,\n onDragEnter,\n onDragOver,\n onDragLeave,\n onDrop\n };\n }\n});\n","import type { UseFileUploadProps } from '@primereact/types/headless/fileupload';\n\nexport const defaultProps: UseFileUploadProps = {\n name: undefined,\n url: undefined,\n multiple: false,\n accept: undefined,\n disabled: false,\n auto: false,\n maxFileSize: undefined,\n fileLimit: undefined,\n withCredentials: false,\n customUpload: false,\n invalidFileLimitMessage: 'Maximum number of files exceeded, limit is {0} at most.',\n invalidFileSizeMessage: '{0}: Invalid file size, file size should be smaller than {1}.',\n invalidFileTypeMessage: '{0}: Invalid file type, allowed file types: {1}.',\n uploadHandler: undefined,\n onSelect: undefined,\n onChange: undefined,\n onBeforeUpload: undefined,\n onUpload: undefined,\n onError: undefined,\n onProgress: undefined,\n onBeforeSend: undefined,\n onClear: undefined,\n onRemove: undefined\n};\n"],"mappings":"+VAAA,OAAS,gBAAAA,OAAoB,4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ACjB,IAAKnE,EACL,aAAc,aACd,YAAa,UACb,YAAaiD,EACb,WAAYC,EACZ,YAAaE,EACb,OAAQE,CACZ,EAEMc,GAAcH,EAAA,CAChB,aAAc,aACd,YAAa,SACb,QAASjC,GACLvC,EAAM,UAAY,CAAE,gBAAiB,EAAG,GAG1C4E,GAAcJ,EAAA,CAChB,aAAc,aACd,YAAa,SACb,QAAStD,EACT,SAAU,CAACJ,GACPd,EAAM,UAAY,CAAE,gBAAiB,EAAG,GAG1C6E,GAAaL,EAAA,CACf,aAAc,aACd,YAAa,QACb,QAAS9B,EACT,SAAU,CAAC5B,GACPd,EAAM,UAAY,CAAE,gBAAiB,EAAG,GAsChD,MAAO,CACH,MAAAiB,EACA,kBAAAb,EACA,SAAAU,EACA,iBAAAE,EAEA,UAAAuD,GACA,YAAAI,GACA,YAAAC,GACA,WAAAC,GACA,WAAAJ,GACA,aAAAC,GACA,gBA/CoB,CACpB,aAAc,aACd,YAAa,YACjB,EA6CI,UA3Cc,CACd,aAAc,aACd,YAAa,MACjB,EAyCI,mBAvCuB,CACvB,aAAc,aACd,YAAa,eACjB,EAqCI,cAnCkB,CAClB,aAAc,aACd,YAAa,UACjB,EAiCI,cA/BkB,CAClB,aAAc,aACd,YAAa,UACjB,EA6BI,cA3BkB,CAClB,aAAc,aACd,YAAa,UACjB,EAyBI,cAvBkB,CAClB,aAAc,aACd,YAAa,UACjB,EAsBI,OAAAxD,EACA,aAAAE,EACA,OAAAmB,EACA,SAAApB,EACA,MAAAuB,EACA,OAAAqB,EACA,mBAAAG,EACA,WAAAjB,EACA,YAAAO,EACA,WAAAC,EACA,YAAAE,EACA,OAAAE,CACJ,CACJ,CACJ,CAAC","names":["withHeadless","addClass","isNotEmpty","removeClass","React","defaultProps","useFileUpload","withHeadless","defaultProps","props","$primereact","inputRef","contentRef","uploadedFileCount","setInputRef","node","setContentRef","filesState","setFilesState","uploadedFilesState","setUploadedFilesState","progressState","setProgressState","hasFiles","isNotEmpty","hasUploadedFiles","state","upload","uploader","onFileSelect","event","_a","_b","isDragEvent","e","currentFiles","filesList","rejectedFiles","file","isFileSelected","isFileLimitExceeded","errors","validate","isImage","fileWithUrl","limitError","checkFileLimit","clearInput","choose","uploadFiles","filesToUpload","clear","xhr","formData","progress","prevUploadedFiles","sFile","isFileTypeValid","formatSize","acceptableTypes","type","isWildcard","getTypeClass","getFileExtension","fileType","onDragEnter","onDragOver","addClass","onDragLeave","removeClass","onDrop","files","remove","index","removedFile","removeUploadedFile","currentUploadedFiles","bytes","sizes","i","rootProps","__spreadValues","inputProps","contentProps","chooseProps","uploadProps","clearProps"]}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/floatlabel/useFloatLabel.ts","../../src/floatlabel/useFloatLabel.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { defaultProps } from './useFloatLabel.props';\n\nexport const useFloatLabel = withHeadless({\n name: 'useFloatLabel',\n defaultProps,\n setup() {\n // prop getters\n const rootProps = {\n 'data-scope': 'floatlabel',\n 'data-part': 'root'\n };\n\n return {\n rootProps\n };\n }\n});\n","import type { UseFloatLabelProps } from '@primereact/types/headless/floatlabel';\n\nexport const defaultProps: UseFloatLabelProps = {};\n"],"mappings":"AAAA,OAAS,gBAAAA,MAAoB,4BCEtB,IAAMC,EAAmC,CAAC,EDC1C,IAAMC,EAAgBC,EAAa,CACtC,KAAM,gBACN,aAAAC,EACA,OAAQ,CAOJ,MAAO,CACH,UANc,CACd,aAAc,aACd,YAAa,MACjB,CAIA,CACJ,CACJ,CAAC","names":["withHeadless","defaultProps","useFloatLabel","withHeadless","defaultProps"]}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/fluid/useFluid.ts","../../src/fluid/useFluid.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { defaultProps } from './useFluid.props';\n\nexport const useFluid = withHeadless({\n name: 'useFluid',\n defaultProps,\n setup() {\n // prop getters\n const rootProps = {\n 'data-scope': 'fluid',\n 'data-part': 'root'\n };\n\n return {\n rootProps\n };\n }\n});\n","import type { UseFluidProps } from '@primereact/types/headless/fluid';\n\nexport const defaultProps: UseFluidProps = {};\n"],"mappings":"AAAA,OAAS,gBAAAA,MAAoB,4BCEtB,IAAMC,EAA8B,CAAC,EDCrC,IAAMC,EAAWC,EAAa,CACjC,KAAM,WACN,aAAAC,EACA,OAAQ,CAOJ,MAAO,CACH,UANc,CACd,aAAc,QACd,YAAa,MACjB,CAIA,CACJ,CACJ,CAAC","names":["withHeadless","defaultProps","useFluid","withHeadless","defaultProps"]}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/focustrap/useFocusTrap.tsx","../../src/focustrap/useFocusTrap.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { focus, getFirstFocusableElement, getLastFocusableElement, isFocusableElement, toElement } from '@primeuix/utils';\nimport { isNotEmpty } from '@primeuix/utils/object';\nimport * as React from 'react';\nimport { defaultProps } from './useFocusTrap.props';\n\nexport const useFocusTrap = withHeadless({\n name: 'useFocusTrap',\n defaultProps,\n setup: ({ props }) => {\n const { trapped, autoFocus, initialFocusRef, onEscape, onTabFirst, onTabLast } = props;\n const firstHiddenElementRef = React.useRef<HTMLSpanElement>(null);\n const lastHiddenElementRef = React.useRef<HTMLSpanElement>(null);\n const observerRef = React.useRef<MutationObserver | null>(null);\n const containerRef = React.useRef<HTMLElement | null>(null);\n const previousActiveElementRef = React.useRef<HTMLElement | null>(null);\n\n // methods\n const getComputedSelector = (selector?: string) => `:not([data-focus-guard])${selector ?? ''}`;\n\n const onFirstHiddenFocus = React.useCallback(\n (event: React.FocusEvent<HTMLSpanElement>) => {\n if (!trapped) return;\n\n if (onTabFirst) {\n onTabFirst(event);\n\n return;\n }\n\n const containerElement = toElement(containerRef);\n const relatedTarget = event.relatedTarget as HTMLElement | null;\n const lastHiddenElement = toElement(lastHiddenElementRef);\n\n if (!containerElement || !lastHiddenElement) return;\n\n const fallback = relatedTarget === lastHiddenElement || !containerElement.contains(relatedTarget) ? getFirstFocusableElement(containerElement, getComputedSelector()) : lastHiddenElement;\n\n if (fallback) {\n focus(fallback as HTMLElement);\n }\n },\n [trapped, onTabFirst]\n );\n\n const onLastHiddenFocus = React.useCallback(\n (event: React.FocusEvent<HTMLSpanElement>) => {\n if (!trapped) return;\n\n if (onTabLast) {\n onTabLast(event);\n\n return;\n }\n\n const containerElement = toElement(containerRef);\n const relatedTarget = event.relatedTarget as HTMLElement | null;\n const firstHiddenElement = toElement(firstHiddenElementRef);\n\n if (!containerElement || !firstHiddenElement) return;\n\n const fallback = relatedTarget === firstHiddenElement || !containerElement.contains(relatedTarget) ? getLastFocusableElement(containerElement, getComputedSelector()) : firstHiddenElement;\n\n if (fallback) {\n focus(fallback as HTMLElement);\n }\n },\n [trapped, onTabLast]\n );\n\n const autoElementFocus = React.useCallback(() => {\n if (!autoFocus) return;\n\n const containerElement = toElement(containerRef);\n\n if (!containerElement) return;\n\n // 1. initialFocusRef takes priority\n if (initialFocusRef?.current) {\n focus(toElement(initialFocusRef)!);\n\n return;\n }\n\n // 2. [autofocus] or [data-autofocus] attribute\n let focusableElement = getFirstFocusableElement(containerElement, `[autofocus]${getComputedSelector()}, [data-autofocus]${getComputedSelector()}`);\n\n // 3. First focusable element\n if (!focusableElement) {\n focusableElement = getFirstFocusableElement(containerElement, getComputedSelector());\n }\n\n if (focusableElement) {\n focus(focusableElement as HTMLElement);\n }\n }, [autoFocus, initialFocusRef]);\n\n const handleKeyDown = React.useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n onEscape?.(event);\n }\n },\n [onEscape]\n );\n\n const bind = React.useCallback(() => {\n const containerElement = toElement(containerRef);\n\n if (!containerElement || !trapped || !(containerElement instanceof Element)) return;\n\n previousActiveElementRef.current = document.activeElement as HTMLElement | null;\n\n containerElement.setAttribute('data-focus-trap', '');\n containerElement.addEventListener('keydown', handleKeyDown);\n\n observerRef.current = new MutationObserver((mutationList) => {\n for (const mutation of mutationList) {\n if (mutation.type === 'childList' && !containerElement.contains(document.activeElement)) {\n let currentNode: Node | null = mutation.nextSibling;\n let nextElement: HTMLElement | null = null;\n\n while (currentNode) {\n if (currentNode instanceof Element) {\n if (isFocusableElement(currentNode)) {\n nextElement = isFocusableElement(currentNode, getComputedSelector('')) ? (currentNode as HTMLElement) : (getFirstFocusableElement(containerElement, getComputedSelector('')) as HTMLElement | null);\n } else {\n nextElement = getFirstFocusableElement(currentNode, `[autofocus]${getComputedSelector()}, [data-autofocus]${getComputedSelector()}`) as HTMLElement | null;\n }\n\n if (isNotEmpty(nextElement)) break;\n }\n\n currentNode = currentNode.nextSibling;\n }\n\n if (nextElement) {\n focus(nextElement);\n }\n }\n }\n });\n\n observerRef.current.observe(containerElement, { childList: true });\n }, [trapped, handleKeyDown]);\n\n const unbind = React.useCallback(() => {\n const containerElement = toElement(containerRef);\n\n if (containerElement) {\n containerElement.removeAttribute('data-focus-trap');\n containerElement.removeEventListener('keydown', handleKeyDown);\n }\n\n if (observerRef.current) {\n observerRef.current.disconnect();\n observerRef.current = null;\n }\n\n const previousElement = previousActiveElementRef.current;\n\n if (previousElement?.isConnected) {\n focus(previousElement, { preventScroll: true });\n }\n\n previousActiveElementRef.current = null;\n }, [handleKeyDown]);\n\n // effects\n React.useEffect(() => {\n if (!trapped) return;\n\n const containerElement = toElement(containerRef);\n\n if (!containerElement) return;\n\n bind();\n autoElementFocus();\n\n return () => unbind();\n }, [trapped, bind, autoElementFocus, unbind]);\n\n // prop getters\n const firstHiddenProps = {\n role: 'presentation' as const,\n 'aria-hidden': true as const,\n 'data-focus-guard': '',\n onFocus: onFirstHiddenFocus\n };\n\n const lastHiddenProps = {\n role: 'presentation' as const,\n 'aria-hidden': true as const,\n 'data-focus-guard': '',\n onFocus: onLastHiddenFocus\n };\n\n return {\n containerRef,\n firstHiddenElementRef,\n lastHiddenElementRef,\n // prop getters\n firstHiddenProps,\n lastHiddenProps\n };\n }\n});\n","import type { UseFocusTrapProps } from '@primereact/types/headless/focustrap';\n\nexport const defaultProps: UseFocusTrapProps = {\n trapped: true,\n autoFocus: true,\n initialFocusRef: undefined,\n onEscape: undefined,\n onTabFirst: undefined,\n onTabLast: undefined\n};\n"],"mappings":"AAAA,OAAS,gBAAAA,MAAoB,4BAC7B,OAAS,SAAAC,EAAO,4BAAAC,EAA0B,2BAAAC,EAAyB,sBAAAC,EAAoB,aAAAC,MAAiB,kBACxG,OAAS,cAAAC,MAAkB,yBAC3B,UAAYC,MAAW,QCDhB,IAAMC,EAAkC,CAC3C,QAAS,GACT,UAAW,GACX,gBAAiB,OACjB,SAAU,OACV,WAAY,OACZ,UAAW,MACf,EDHO,IAAMC,EAAeC,EAAa,CACrC,KAAM,eACN,aAAAC,EACA,MAAO,CAAC,CAAE,MAAAC,CAAM,IAAM,CAClB,GAAM,CAAE,QAAAC,EAAS,UAAAC,EAAW,gBAAAC,EAAiB,SAAAC,EAAU,WAAAC,EAAY,UAAAC,CAAU,EAAIN,EAC3EO,EAA8B,SAAwB,IAAI,EAC1DC,EAA6B,SAAwB,IAAI,EACzDC,EAAoB,SAAgC,IAAI,EACxDC,EAAqB,SAA2B,IAAI,EACpDC,EAAiC,SAA2B,IAAI,EAGhEC,EAAuBC,GAAsB,2BAA2BA,GAAA,KAAAA,EAAY,EAAE,GAEtFC,EAA2B,cAC5BC,GAA6C,CAC1C,GAAI,CAACd,EAAS,OAEd,GAAII,EAAY,CACZA,EAAWU,CAAK,EAEhB,MACJ,CAEA,IAAMC,EAAmBC,EAAUP,CAAY,EACzCQ,EAAgBH,EAAM,cACtBI,EAAoBF,EAAUT,CAAoB,EAExD,GAAI,CAACQ,GAAoB,CAACG,EAAmB,OAE7C,IAAMC,EAAWF,IAAkBC,GAAqB,CAACH,EAAiB,SAASE,CAAa,EAAIG,EAAyBL,EAAkBJ,EAAoB,CAAC,EAAIO,EAEpKC,GACAE,EAAMF,CAAuB,CAErC,EACA,CAACnB,EAASI,CAAU,CACxB,EAEMkB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,QAASS,CACb,CASA,CACJ,CACJ,CAAC","names":["withHeadless","focus","getFirstFocusableElement","getLastFocusableElement","isFocusableElement","toElement","isNotEmpty","React","defaultProps","useFocusTrap","withHeadless","defaultProps","props","trapped","autoFocus","initialFocusRef","onEscape","onTabFirst","onTabLast","firstHiddenElementRef","lastHiddenElementRef","observerRef","containerRef","previousActiveElementRef","getComputedSelector","selector","onFirstHiddenFocus","event","containerElement","toElement","relatedTarget","lastHiddenElement","fallback","getFirstFocusableElement","focus","onLastHiddenFocus","firstHiddenElement","getLastFocusableElement","autoElementFocus","focusableElement","handleKeyDown","bind","mutationList","mutation","currentNode","nextElement","isFocusableElement","isNotEmpty","unbind","previousElement"]}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/gallery/useGallery.ts","../../src/gallery/useGallery.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport type { GalleryPendingAction } from '@primereact/types/headless/gallery';\nimport type { CarouselRootInstance } from '@primereact/types/primitive/carousel';\nimport * as React from 'react';\nimport { defaultProps } from './useGallery.props';\n\nexport const useGallery = withHeadless({\n name: 'useGallery',\n defaultProps,\n setup: ({ props, id, elementRef }) => {\n const { activeIndex: activeIndexProp = 0, fullscreen: fullscreenProp, closeOnEscape = true, onActiveIndexChange = undefined, onFullscreenChange, onZoomChange, onRotateChange, onFlipChange } = props;\n const contentRef = React.useRef<HTMLDivElement>(null);\n const itemCounter = React.useRef(0);\n const thumbnailRef = React.useRef<CarouselRootInstance | null>(null);\n const prevRef = React.useRef<HTMLButtonElement>(null);\n const nextRef = React.useRef<HTMLButtonElement>(null);\n const [activeIndex, setActiveIndex] = React.useState(activeIndexProp);\n const activeIndexRef = React.useRef(activeIndex);\n\n activeIndexRef.current = activeIndex;\n\n const [isFullscreenInternal, setIsFullscreen] = React.useState(false);\n const isFullscreen = fullscreenProp ?? isFullscreenInternal;\n const [activeItemTransform, setActiveItemTransform] = React.useState({ zoomed: false, rotated: false, flipped: false });\n const [pendingAction, setPendingAction] = React.useState<GalleryPendingAction | null>(null);\n\n React.useEffect(() => {\n setActiveIndex(activeIndexProp);\n }, [activeIndexProp]);\n\n React.useEffect(() => {\n return () => {\n itemCounter.current = 0;\n };\n }, []);\n\n const registerItem = React.useCallback((index: number | null): number => {\n if (index !== null) {\n if (index >= itemCounter.current) {\n itemCounter.current = index + 1;\n }\n\n return index;\n }\n\n const newIndex = itemCounter.current;\n\n itemCounter.current += 1;\n\n return newIndex;\n }, []);\n\n const clearPendingAction = React.useCallback(() => setPendingAction(null), []);\n\n const handleNext = () => {\n if (itemCounter.current <= 0) return;\n\n const newIndex = (activeIndexRef.current + 1) % itemCounter.current;\n\n setActiveIndex(newIndex);\n onActiveIndexChange?.({ originalEvent: undefined as unknown as React.SyntheticEvent, value: newIndex });\n };\n\n const handlePrev = () => {\n if (itemCounter.current <= 0) return;\n\n const newIndex = (activeIndexRef.current - 1 + itemCounter.current) % itemCounter.current;\n\n setActiveIndex(newIndex);\n onActiveIndexChange?.({ originalEvent: undefined as unknown as React.SyntheticEvent, value: newIndex });\n };\n\n const selectItem = (index: number) => {\n if (index < 0 || index >= itemCounter.current) return;\n\n setActiveIndex(index);\n onActiveIndexChange?.({ originalEvent: undefined as unknown as React.SyntheticEvent, value: index });\n };\n\n const dispatchAction = (type: GalleryPendingAction['type']) => () => {\n setPendingAction({ type, timestamp: Date.now() });\n };\n\n const toggleFullScreen = () => {\n if (fullscreenProp !== undefined) {\n onFullscreenChange?.(!fullscreenProp);\n\n return;\n }\n\n if (!elementRef.current) return;\n\n if (document.fullscreenElement) {\n document.exitFullscreen?.();\n } else {\n elementRef.current.requestFullscreen?.();\n }\n };\n\n React.useEffect(() => {\n if (fullscreenProp === undefined || !elementRef.current) return;\n\n const isNativeFullscreen = document.fullscreenElement === elementRef.current;\n\n if (fullscreenProp && !isNativeFullscreen) {\n elementRef.current.requestFullscreen?.()?.catch(() => {});\n } else if (!fullscreenProp && document.fullscreenElement) {\n document.exitFullscreen?.()?.catch(() => {});\n }\n }, [fullscreenProp]);\n\n React.useEffect(() => {\n const handleNativeFullscreenChange = () => {\n const active = document.fullscreenElement === elementRef.current;\n\n setIsFullscreen(active);\n\n if (fullscreenProp !== undefined && fullscreenProp !== active) {\n onFullscreenChange?.(active);\n }\n };\n\n document.addEventListener('fullscreenchange', handleNativeFullscreenChange);\n\n return () => document.removeEventListener('fullscreenchange', handleNativeFullscreenChange);\n }, [fullscreenProp, onFullscreenChange]);\n\n const prevReportedRef = React.useRef<{ scale: number; rotation: number; flip: { x: number; y: number } } | null>(null);\n\n const reportItemState = React.useCallback(\n (itemState: { zoomed: boolean; rotated: boolean; flipped: boolean; scale: number; rotation: number; flip: { x: number; y: number } }) => {\n setActiveItemTransform({ zoomed: itemState.zoomed, rotated: itemState.rotated, flipped: itemState.flipped });\n\n const prev = prevReportedRef.current;\n\n if (!prev || prev.scale !== itemState.scale) onZoomChange?.(itemState.scale);\n\n if (!prev || prev.rotation !== itemState.rotation) onRotateChange?.(itemState.rotation);\n\n if (!prev || prev.flip.x !== itemState.flip.x || prev.flip.y !== itemState.flip.y) onFlipChange?.(itemState.flip);\n\n prevReportedRef.current = { scale: itemState.scale, rotation: itemState.rotation, flip: itemState.flip };\n },\n [onZoomChange, onRotateChange, onFlipChange]\n );\n\n const actions = {\n zoomIn: dispatchAction('zoom-in'),\n zoomOut: dispatchAction('zoom-out'),\n rotateLeft: dispatchAction('rotate-left'),\n rotateRight: dispatchAction('rotate-right'),\n flipX: dispatchAction('flip-x'),\n flipY: dispatchAction('flip-y'),\n download: dispatchAction('download'),\n next: handleNext,\n prev: handlePrev,\n toggleFullScreen: toggleFullScreen\n };\n\n const handleClickAction = React.useCallback(\n (action?: string) => {\n if (action && actions[action as keyof typeof actions]) {\n actions[action as keyof typeof actions]();\n }\n },\n [actions]\n );\n\n const state = {\n isFullscreen,\n activeIndex,\n zoomed: activeItemTransform.zoomed,\n rotated: activeItemTransform.rotated,\n flipped: activeItemTransform.flipped,\n pendingAction\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'ArrowRight') {\n e.preventDefault();\n handleNext();\n } else if (e.key === 'ArrowLeft') {\n e.preventDefault();\n handlePrev();\n } else if (e.key === 'Escape' && closeOnEscape && isFullscreen) {\n e.preventDefault();\n toggleFullScreen();\n }\n };\n\n const rootProps = {\n ref: elementRef as React.RefObject<HTMLDivElement>,\n id,\n tabIndex: 0,\n 'data-scope': 'gallery' as const,\n 'data-part': 'root' as const,\n onKeyDown: handleKeyDown,\n ...(isFullscreen && { 'data-fullscreen': '' as const }),\n ...(activeItemTransform.zoomed && { 'data-zoomed': '' as const }),\n ...(activeItemTransform.rotated && { 'data-rotated': '' as const }),\n ...(activeItemTransform.flipped && { 'data-flipped': '' as const })\n };\n\n const nextProps = {\n 'data-scope': 'gallery' as const,\n 'data-part': 'next' as const,\n onClick: handleNext\n };\n\n const prevProps = {\n 'data-scope': 'gallery' as const,\n 'data-part': 'prev' as const,\n onClick: handlePrev\n };\n\n const thumbnailProps = {\n 'data-scope': 'gallery' as const,\n 'data-part': 'thumbnail' as const,\n slide: activeIndex\n };\n\n const thumbnailContentProps = {\n 'data-scope': 'gallery' as const,\n 'data-part': 'thumbnailContent' as const\n };\n\n const thumbnailItemProps = (index: number | undefined) => {\n const handleThumbnailItemClick = () => {\n if (index !== undefined) {\n selectItem(index);\n }\n };\n\n return {\n 'data-scope': 'gallery' as const,\n 'data-part': 'thumbnailItem' as const,\n ...(index !== undefined && activeIndex === index && { 'data-active': '' as const }),\n onClick: handleThumbnailItemClick\n };\n };\n\n const toolbarProps = {\n 'data-scope': 'gallery' as const,\n 'data-part': 'toolbar' as const\n };\n\n const toolbarItemProps = (action: string | undefined) => {\n const handleToolbarItemClick = () => {\n handleClickAction(action);\n };\n\n return {\n 'data-scope': 'gallery' as const,\n 'data-part': 'toolbarItem' as const,\n onClick: handleToolbarItemClick\n };\n };\n\n const headerProps = {\n 'data-scope': 'gallery' as const,\n 'data-part': 'header' as const\n };\n\n const footerProps = {\n 'data-scope': 'gallery' as const,\n 'data-part': 'footer' as const\n };\n\n const backdropProps = {\n 'data-scope': 'gallery' as const,\n 'data-part': 'backdrop' as const\n };\n\n const contentProps = {\n ref: contentRef,\n 'data-scope': 'gallery' as const,\n 'data-part': 'content' as const\n };\n\n const downloadProps = {\n 'data-scope': 'gallery' as const,\n 'data-part': 'download' as const,\n 'data-action': 'download' as const,\n onClick: () => handleClickAction('download')\n };\n\n const flipXProps = {\n 'data-scope': 'gallery' as const,\n 'data-part': 'flipX' as const,\n 'data-action': 'flip-x' as const,\n onClick: () => handleClickAction('flipX')\n };\n\n const flipYProps = {\n 'data-scope': 'gallery' as const,\n 'data-part': 'flipY' as const,\n 'data-action': 'flip-y' as const,\n onClick: () => handleClickAction('flipY')\n };\n\n const rotateLeftProps = {\n 'data-scope': 'gallery' as const,\n 'data-part': 'rotateLeft' as const,\n 'data-action': 'rotate-left' as const,\n onClick: () => handleClickAction('rotateLeft')\n };\n\n const rotateRightProps = {\n 'data-scope': 'gallery' as const,\n 'data-part': 'rotateRight' as const,\n 'data-action': 'rotate-right' as const,\n onClick: () => handleClickAction('rotateRight')\n };\n\n const fullScreenProps = {\n 'data-scope': 'gallery' as const,\n 'data-part': 'fullScreen' as const,\n 'data-action': 'fullscreen' as const,\n ...(isFullscreen && { 'data-fullscreen': '' as const }),\n onClick: () => handleClickAction('toggleFullScreen')\n };\n\n const zoomInProps = {\n 'data-scope': 'gallery' as const,\n 'data-part': 'zoomIn' as const,\n 'data-action': 'zoom-in' as const,\n disabled: activeItemTransform.zoomed || undefined,\n onClick: () => handleClickAction('zoomIn')\n };\n\n const zoomOutProps = {\n 'data-scope': 'gallery' as const,\n 'data-part': 'zoomOut' as const,\n 'data-action': 'zoom-out' as const,\n disabled: !activeItemTransform.zoomed || undefined,\n onClick: () => handleClickAction('zoomOut')\n };\n\n const zoomToggleProps = {\n 'data-scope': 'gallery' as const,\n 'data-part': 'zoomToggle' as const,\n 'data-action': 'zoom-toggle' as const,\n onClick: () => handleClickAction(activeItemTransform.zoomed ? 'zoomOut' : 'zoomIn')\n };\n\n const getItemProps = (index: number) => {\n if (index >= itemCounter.current) {\n itemCounter.current = index + 1;\n }\n\n return {\n 'data-scope': 'gallery' as const,\n 'data-part': 'item' as const,\n ...(activeIndex === index && { 'data-active': '' as const })\n };\n };\n\n return {\n state,\n registerItem,\n handleNext,\n handlePrev,\n selectItem,\n reportItemState,\n clearPendingAction,\n toggleFullScreen,\n handleClickAction,\n actions,\n contentRef,\n thumbnailRef,\n prevRef,\n nextRef,\n // prop objects\n rootProps,\n nextProps,\n prevProps,\n thumbnailProps,\n thumbnailContentProps,\n thumbnailItemProps,\n toolbarProps,\n toolbarItemProps,\n headerProps,\n footerProps,\n backdropProps,\n contentProps,\n downloadProps,\n flipXProps,\n flipYProps,\n rotateLeftProps,\n rotateRightProps,\n fullScreenProps,\n zoomInProps,\n zoomOutProps,\n zoomToggleProps,\n getItemProps\n };\n }\n});\n","import type { UseGalleryProps } from '@primereact/types/headless/gallery';\n\nexport const defaultProps: UseGalleryProps = {\n activeIndex: 0,\n fullscreen: undefined,\n closeOnEscape: true,\n onActiveIndexChange: undefined,\n onFullscreenChange: undefined,\n onZoomChange: undefined,\n onRotateChange: undefined,\n onFlipChange: undefined\n};\n"],"mappings":"ubAAA,OAAS,gBAAAA,OAAoB,4BAG7B,UAAYC,MAAW,QCDhB,IAAMC,EAAgC,CACzC,YAAa,EACb,WAAY,OACZ,cAAe,GACf,oBAAqB,OACrB,mBAAoB,OACpB,aAAc,OACd,eAAgB,OAChB,aAAc,MAClB,EDLO,IAAMC,GAAaC,GAAa,CACnC,KAAM,aACN,aAAAC,EACA,MAAO,CAAC,CAAE,MAAAC,EAAO,GAAAC,EAAI,WAAAC,CAAW,IAAM,CAClC,GAAM,CAAE,YAAaC,EAAkB,EAAG,WAAYC,EAAgB,cAAAC,EAAgB,GAAM,oBAAAC,EAAsB,OAAW,mBAAAC,EAAoB,a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3B,EAAoB,OAAS,UAAY,QAAQ,CACtF,EAmDI,aAjDkBK,IACdA,GAASf,EAAY,UACrBA,EAAY,QAAUe,EAAQ,GAG3B0B,EAAA,CACH,aAAc,UACd,YAAa,QACTrC,IAAgBW,GAAS,CAAE,cAAe,EAAY,GA0ClE,CACJ,CACJ,CAAC","names":["withHeadless","React","defaultProps","useGallery","withHeadless","defaultProps","props","id","elementRef","activeIndexProp","fullscreenProp","closeOnEscape","onActiveIndexChange","onFullscreenChange","onZoomChange","onRotateChange","onFlipChange","contentRef","itemCounter","thumbnailRef","prevRef","nextRef","activeIndex","setActiveIndex","activeIndexRef","isFullscreenInternal","setIsFullscreen","isFullscreen","activeItemTransform","setActiveItemTransform","pendingAction","setPendingAction","registerItem","index","newIndex","clearPendingAction","handleNext","handlePrev","selectItem","dispatchAction","type","toggleFullScreen","_a","_b","_c","_d","_e","isNativeFullscreen","handleNativeFullscreenChange","active","prevReportedRef","reportItemState","itemState","prev","actions","handleClickAction","action","state","rootProps","__spreadValues","e","nextProps","prevProps","thumbnailProps","thumbnailContentProps","thumbnailItemProps","handleThumbnailItemClick","__spreadProps","toolbarProps","toolbarItemProps","headerProps","footerProps","backdropProps","contentProps","downloadProps","flipXProps","flipYProps","rotateLeftProps","rotateRightProps","fullScreenProps","zoomInProps","zoomOutProps"]}