@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.
- package/accordion/index.mjs +1 -2
- package/animateonscroll/index.mjs +1 -2
- package/autocomplete/index.mjs +1 -2
- package/avatar/index.mjs +1 -2
- package/avatargroup/index.mjs +0 -1
- package/badge/index.mjs +1 -2
- package/breadcrumb/index.mjs +0 -1
- package/button/index.mjs +0 -1
- package/card/index.mjs +0 -1
- package/carousel/index.mjs +1 -2
- package/carousel/useCarousel.d.ts +28 -15
- package/checkbox/index.mjs +1 -2
- package/checkboxgroup/index.mjs +1 -2
- package/chip/index.mjs +1 -2
- package/collapsible/index.mjs +1 -2
- package/compare/index.mjs +1 -2
- package/contextmenu/index.mjs +1 -2
- package/contextmenu/submenu/index.mjs +0 -1
- package/datatable/features/index.mjs +8 -9
- package/datatable/features/useDataTableExport.d.ts +1 -1
- package/datatable/features/useDataTableKeyboard.d.ts +1 -1
- package/datatable/features/useDataTableSelection.d.ts +4 -4
- package/datatable/index.mjs +8 -9
- package/datatable/useDataTable.d.ts +2 -2
- package/datatable/utils/index.mjs +0 -1
- package/dataview/index.mjs +1 -2
- package/datepicker/index.mjs +1 -2
- package/dialog/index.mjs +1 -2
- package/dialog/useDialog.d.ts +12 -12
- package/divider/index.mjs +0 -1
- package/divider/useDivider.d.ts +1 -1
- package/dnd/index.mjs +1 -2
- package/drawer/index.mjs +1 -2
- package/fieldset/index.mjs +1 -2
- package/fileupload/index.mjs +1 -2
- package/fileupload/useFileUpload.d.ts +3 -0
- package/floatlabel/index.mjs +0 -1
- package/fluid/index.mjs +0 -1
- package/focustrap/index.mjs +1 -2
- package/gallery/index.mjs +1 -2
- package/gallery/item/index.mjs +1 -2
- package/gallery/useGallery.d.ts +17 -9
- package/iconfield/index.mjs +0 -1
- package/iftalabel/index.mjs +0 -1
- package/inplace/index.mjs +1 -2
- package/inplace/useInplace.d.ts +18 -6
- package/inputcolor/colorManager.d.ts +1 -1
- package/inputcolor/index.mjs +1 -2
- package/inputgroup/index.mjs +0 -1
- package/inputnumber/index.mjs +1 -2
- package/inputotp/index.mjs +1 -2
- package/inputpassword/index.mjs +1 -2
- package/inputtags/index.mjs +1 -2
- package/inputtext/index.mjs +1 -2
- package/knob/index.mjs +1 -2
- package/label/index.mjs +0 -1
- package/listbox/index.mjs +1 -2
- package/menu/checkboxitem/index.mjs +1 -2
- package/menu/index.mjs +1 -2
- package/menu/radioitem/index.mjs +1 -2
- package/menu/submenu/index.mjs +1 -2
- package/message/index.mjs +1 -2
- package/metergroup/index.mjs +1 -2
- package/navigationmenu/index.mjs +1 -2
- package/orderlist/index.mjs +1 -2
- package/orderlist/useOrderList.d.ts +1 -0
- package/organizationchart/index.mjs +1 -2
- package/overlaybadge/index.mjs +0 -1
- package/package.json +9 -7
- package/paginator/index.mjs +1 -2
- package/paginator/usePaginator.d.ts +1 -1
- package/panel/index.mjs +1 -2
- package/picklist/index.mjs +1 -2
- package/popover/index.mjs +1 -2
- package/portal/index.mjs +0 -1
- package/positioner/index.mjs +1 -2
- package/positioner/usePositioner.anchor.d.ts +2 -2
- package/positioner/usePositioner.fallback.d.ts +2 -2
- package/progressbar/index.mjs +1 -2
- package/progressspinner/index.mjs +1 -2
- package/radiobutton/index.mjs +1 -2
- package/radiobuttongroup/index.mjs +1 -2
- package/rating/index.mjs +1 -2
- package/scrollarea/index.mjs +1 -2
- package/scrollarea/useScrollArea.d.ts +1 -1
- package/select/index.mjs +1 -2
- package/sidebar/index.mjs +1 -2
- package/sidebar/useSidebar.d.ts +30 -4
- package/sidebar/useSidebarLayout.d.ts +4 -4
- package/sidebar/useSidebarMenuItem.d.ts +0 -1
- package/skeleton/index.mjs +0 -1
- package/slider/index.mjs +1 -2
- package/speeddial/index.mjs +1 -2
- package/splitter/index.mjs +1 -2
- package/stepper/index.mjs +1 -2
- package/styleclass/index.mjs +1 -2
- package/tabs/index.mjs +1 -2
- package/tag/index.mjs +0 -1
- package/terminal/index.mjs +1 -2
- package/textarea/index.mjs +1 -2
- package/timeline/index.mjs +0 -1
- package/toast/index.mjs +1 -2
- package/toaster/index.mjs +1 -2
- package/togglebutton/index.mjs +1 -2
- package/togglebuttongroup/index.mjs +1 -2
- package/toggleswitch/index.mjs +1 -2
- package/toolbar/index.mjs +0 -1
- package/tooltip/index.mjs +1 -2
- package/tooltipmanager/index.mjs +1 -2
- package/tree/index.mjs +1 -2
- package/tree/useTree.d.ts +4 -4
- package/tree/useTreeDragDrop.d.ts +2 -2
- package/tree/useTreeFlatten.d.ts +1 -1
- package/tree/useTreeSelection.d.ts +3 -3
- package/accordion/index.mjs.map +0 -1
- package/accordion/useAccordion.test.d.ts +0 -0
- package/animateonscroll/index.mjs.map +0 -1
- package/animateonscroll/useAnimateOnScroll.test.d.ts +0 -0
- package/autocomplete/index.mjs.map +0 -1
- package/autocomplete/useAutoComplete.test.d.ts +0 -0
- package/avatar/index.mjs.map +0 -1
- package/avatar/useAvatar.test.d.ts +0 -0
- package/avatargroup/index.mjs.map +0 -1
- package/badge/index.mjs.map +0 -1
- package/badge/useBadge.test.d.ts +0 -0
- package/breadcrumb/index.mjs.map +0 -1
- package/breadcrumb/useBreadcrumb.test.d.ts +0 -0
- package/button/index.mjs.map +0 -1
- package/button/useButton.test.d.ts +0 -0
- package/card/index.mjs.map +0 -1
- package/card/useCard.test.d.ts +0 -0
- package/carousel/index.mjs.map +0 -1
- package/carousel/useCarousel.test.d.ts +0 -0
- package/checkbox/index.mjs.map +0 -1
- package/checkbox/useCheckbox.test.d.ts +0 -0
- package/checkboxgroup/index.mjs.map +0 -1
- package/checkboxgroup/useCheckboxGroup.test.d.ts +0 -0
- package/chip/index.mjs.map +0 -1
- package/chip/useChip.test.d.ts +0 -0
- package/collapsible/index.mjs.map +0 -1
- package/collapsible/useCollapsible.test.d.ts +0 -0
- package/compare/index.mjs.map +0 -1
- package/compare/useCompare.test.d.ts +0 -0
- package/contextmenu/index.mjs.map +0 -1
- package/contextmenu/submenu/index.mjs.map +0 -1
- package/contextmenu/useContextMenu.test.d.ts +0 -0
- package/datatable/features/index.mjs.map +0 -1
- package/datatable/index.mjs.map +0 -1
- package/datatable/utils/index.mjs.map +0 -1
- package/dataview/index.mjs.map +0 -1
- package/dataview/useDataView.test.d.ts +0 -0
- package/datepicker/index.mjs.map +0 -1
- package/datepicker/useDatePicker.test.d.ts +0 -0
- package/dialog/index.mjs.map +0 -1
- package/dialog/useDialog.test.d.ts +0 -0
- package/divider/index.mjs.map +0 -1
- package/divider/useDivider.test.d.ts +0 -0
- package/dnd/index.mjs.map +0 -1
- package/drawer/index.mjs.map +0 -1
- package/drawer/useDrawer.test.d.ts +0 -0
- package/fieldset/index.mjs.map +0 -1
- package/fieldset/useFieldset.test.d.ts +0 -0
- package/fileupload/index.mjs.map +0 -1
- package/fileupload/useFileUpload.test.d.ts +0 -0
- package/floatlabel/index.mjs.map +0 -1
- package/floatlabel/useFloatLabel.test.d.ts +0 -0
- package/fluid/index.mjs.map +0 -1
- package/fluid/useFluid.test.d.ts +0 -0
- package/focustrap/index.mjs.map +0 -1
- package/focustrap/useFocusTrap.test.d.ts +0 -0
- package/gallery/index.mjs.map +0 -1
- package/gallery/item/index.mjs.map +0 -1
- package/gallery/useGallery.test.d.ts +0 -0
- package/iconfield/index.mjs.map +0 -1
- package/iconfield/useIconField.test.d.ts +0 -0
- package/iftalabel/index.mjs.map +0 -1
- package/iftalabel/useIftaLabel.test.d.ts +0 -0
- package/inplace/index.mjs.map +0 -1
- package/inplace/useInplace.test.d.ts +0 -0
- package/inputcolor/index.mjs.map +0 -1
- package/inputcolor/useInputColor.test.d.ts +0 -0
- package/inputgroup/index.mjs.map +0 -1
- package/inputgroup/useInputGroup.test.d.ts +0 -0
- package/inputnumber/index.mjs.map +0 -1
- package/inputnumber/useInputNumber.test.d.ts +0 -0
- package/inputotp/index.mjs.map +0 -1
- package/inputotp/useInputOtp.test.d.ts +0 -0
- package/inputpassword/index.mjs.map +0 -1
- package/inputpassword/useInputPassword.test.d.ts +0 -0
- package/inputtags/index.mjs.map +0 -1
- package/inputtags/useInputTags.test.d.ts +0 -0
- package/inputtext/index.mjs.map +0 -1
- package/inputtext/useInputText.test.d.ts +0 -0
- package/knob/index.mjs.map +0 -1
- package/knob/useKnob.test.d.ts +0 -0
- package/label/index.mjs.map +0 -1
- package/label/useLabel.test.d.ts +0 -0
- package/listbox/index.mjs.map +0 -1
- package/listbox/useListbox.test.d.ts +0 -0
- package/menu/checkboxitem/index.mjs.map +0 -1
- package/menu/index.mjs.map +0 -1
- package/menu/radioitem/index.mjs.map +0 -1
- package/menu/submenu/index.mjs.map +0 -1
- package/menu/useMenu.test.d.ts +0 -0
- package/message/index.mjs.map +0 -1
- package/message/useMessage.test.d.ts +0 -0
- package/metergroup/index.mjs.map +0 -1
- package/metergroup/useMeterGroup.test.d.ts +0 -0
- package/navigationmenu/index.mjs.map +0 -1
- package/navigationmenu/useNavigationMenu.test.d.ts +0 -0
- package/orderlist/index.mjs.map +0 -1
- package/organizationchart/index.mjs.map +0 -1
- package/organizationchart/useOrganizationChart.test.d.ts +0 -0
- package/overlaybadge/index.mjs.map +0 -1
- package/overlaybadge/useOverlayBadge.test.d.ts +0 -0
- package/paginator/index.mjs.map +0 -1
- package/paginator/usePaginator.test.d.ts +0 -0
- package/panel/index.mjs.map +0 -1
- package/panel/usePanel.test.d.ts +0 -0
- package/picklist/index.mjs.map +0 -1
- package/popover/index.mjs.map +0 -1
- package/popover/usePopover.test.d.ts +0 -0
- package/portal/index.mjs.map +0 -1
- package/portal/usePortal.test.d.ts +0 -0
- package/positioner/index.mjs.map +0 -1
- package/positioner/usePositioner.test.d.ts +0 -0
- package/progressbar/index.mjs.map +0 -1
- package/progressbar/useProgressBar.test.d.ts +0 -0
- package/progressspinner/index.mjs.map +0 -1
- package/radiobutton/index.mjs.map +0 -1
- package/radiobutton/useRadioButton.test.d.ts +0 -0
- package/radiobuttongroup/index.mjs.map +0 -1
- package/radiobuttongroup/useRadioButtonGroup.test.d.ts +0 -0
- package/rating/index.mjs.map +0 -1
- package/scrollarea/index.mjs.map +0 -1
- package/scrollarea/useScrollArea.test.d.ts +0 -0
- package/select/index.mjs.map +0 -1
- package/select/useSelect.test.d.ts +0 -1
- package/sidebar/index.mjs.map +0 -1
- package/skeleton/index.mjs.map +0 -1
- package/skeleton/useSkeleton.test.d.ts +0 -0
- package/slider/index.mjs.map +0 -1
- package/slider/useSlider.test.d.ts +0 -0
- package/speeddial/index.mjs.map +0 -1
- package/speeddial/useSpeedDial.test.d.ts +0 -0
- package/splitter/index.mjs.map +0 -1
- package/splitter/useSplitter.test.d.ts +0 -0
- package/stepper/index.mjs.map +0 -1
- package/stepper/useStepper.test.d.ts +0 -0
- package/styleclass/index.mjs.map +0 -1
- package/styleclass/useStyleClass.test.d.ts +0 -0
- package/tabs/index.mjs.map +0 -1
- package/tabs/useTabs.test.d.ts +0 -0
- package/tag/index.mjs.map +0 -1
- package/tag/useTag.test.d.ts +0 -0
- package/terminal/index.mjs.map +0 -1
- package/terminal/useTerminal.test.d.ts +0 -0
- package/textarea/index.mjs.map +0 -1
- package/textarea/useTextarea.test.d.ts +0 -0
- package/timeline/index.mjs.map +0 -1
- package/timeline/useTimeline.test.d.ts +0 -0
- package/toast/index.mjs.map +0 -1
- package/toast/useToast.test.d.ts +0 -0
- package/toaster/index.mjs.map +0 -1
- package/toaster/useToaster.test.d.ts +0 -0
- package/togglebutton/index.mjs.map +0 -1
- package/togglebutton/useToggle.test.d.ts +0 -0
- package/togglebuttongroup/index.mjs.map +0 -1
- package/togglebuttongroup/useToggleButtonGroup.test.d.ts +0 -0
- package/toggleswitch/index.mjs.map +0 -1
- package/toggleswitch/useToggleSwitch.test.d.ts +0 -0
- package/toolbar/index.mjs.map +0 -1
- package/toolbar/useToolbar.test.d.ts +0 -0
- package/tooltip/index.mjs.map +0 -1
- package/tooltip/useTooltip.test.d.ts +0 -0
- package/tooltipmanager/index.mjs.map +0 -1
- package/tooltipmanager/useTooltipManager.test.d.ts +0 -0
- package/tree/index.mjs.map +0 -1
- package/tree/useTree.test.d.ts +0 -0
package/toast/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/toast/useToast.ts","../../src/toast/useToast.props.ts"],"sourcesContent":["/**\n * This toast system is inspired by Sonner by Emil Kowalski.\n * The architecture and API ideas were adapted for this project.\n * https://github.com/emilkowalski/sonner\n */\n\nimport { withHeadless } from '@primereact/core/headless';\nimport { defaultToaster } from '@primereact/headless/toaster';\nimport { useMountEffect } from '@primereact/hooks/use-mount-effect';\nimport { useVisibilityChange } from '@primereact/hooks/use-visibility-change';\nimport * as React from 'react';\nimport { defaultProps } from './useToast.props';\n\nconst SWIPE_THRESHOLD = 50;\nconst VELOCITY_THRESHOLD = 0.11;\n\nexport const useToast = withHeadless({\n name: 'useToast',\n defaultProps,\n setup: ({ props, elementRef }) => {\n const { toast, toaster } = props;\n\n const index = React.useMemo(() => {\n if (!toaster?.toasts || !Array.isArray(toaster?.toasts)) return 0;\n\n return toaster?.toasts.findIndex((t) => t.id === toast.id) || 0;\n }, [toaster?.toasts, toast.id]);\n\n const isDocumentVisible = useVisibilityChange();\n const [removed, setRemoved] = React.useState(false);\n const [swipeDirection, setSwipeDirection] = React.useState<'x' | 'y' | null>(null);\n const [swipeOutDirection, setSwipeOutDirection] = React.useState<'left' | 'right' | 'up' | 'down' | null>(null);\n const [mounted, setMounted] = React.useState(false);\n const [swiping, setSwiping] = React.useState(false);\n const [swipeOut, setSwipeOut] = React.useState(false);\n const [isSwiped, setIsSwiped] = React.useState(false);\n const [offsetBeforeRemove, setOffsetBeforeRemove] = React.useState(0);\n const [initialHeight, setInitialHeight] = React.useState(0);\n\n const dismissible = toast.dismissible !== false && !toast.loading;\n\n const remainingTimeRef = React.useRef(toast.duration || toaster?.props.timeout || 6000);\n const swipeStartTimeRef = React.useRef<number>(0);\n const pointerStartPositionRef = React.useRef<{ x: number; y: number } | null>(null);\n\n const timeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n const timeoutStartTimeRef = React.useRef<number>(0);\n const lastTimeoutStartTimeRef = React.useRef<number>(0);\n\n const visibleIndex = React.useMemo(() => {\n return toaster?.state.heights?.findIndex((h) => h.toastId === toast.id) ?? 0;\n }, [toaster?.state.heights, toast.id]);\n\n const duration = React.useMemo(() => {\n return toast.duration || toaster?.props.timeout || 6000;\n }, [toast.duration, toaster?.props.timeout]);\n\n const offset = React.useRef(0);\n\n offset.current =\n toaster?.state.heights?.reduce((prev, curr, reducerIndex) => {\n if (reducerIndex >= visibleIndex) return prev;\n\n return prev + curr.height;\n }, 0) ?? 0;\n\n const disabled = toast.loading === true;\n\n React.useEffect(() => {\n remainingTimeRef.current = duration;\n }, [duration]);\n\n useMountEffect(() => {\n setMounted(true);\n });\n\n React.useEffect(() => {\n const toastNode = elementRef.current;\n\n if (!toastNode || !toast.id) return;\n\n const height = toastNode.getBoundingClientRect().height;\n\n setInitialHeight(height);\n\n toaster?.setHeights((prev) => [{ toastId: toast.id!, height }, ...prev]);\n\n return () => toaster?.setHeights((prev) => prev.filter((h) => h.toastId !== toast.id));\n }, [toaster?.setHeights, toast.id]);\n\n React.useLayoutEffect(() => {\n if (!mounted || !toast.id || !toaster?.setHeights) return;\n\n const toastNode = elementRef.current;\n\n if (!toastNode) return;\n\n const originalHeight = toastNode.style.height;\n\n toastNode.style.height = 'auto';\n const newHeight = toastNode?.getBoundingClientRect().height;\n\n toastNode.style.height = originalHeight;\n\n setInitialHeight(newHeight);\n\n toaster?.setHeights((prev) => {\n const isAlreadyExists = prev.find((h) => h.toastId === toast.id);\n\n if (!isAlreadyExists) {\n return [{ toastId: toast.id!, height: newHeight }, ...prev];\n } else {\n return prev.map((h) => (h.toastId === toast.id ? { ...h, height: newHeight } : h));\n }\n });\n }, [mounted, toast.title, toast.description, toast.id, toast.render, toast.action, toast.icon, toaster?.setHeights]);\n\n const deleteToast = React.useCallback(() => {\n toaster?.handleFocusManagement(elementRef.current ?? null);\n\n setRemoved(true);\n setOffsetBeforeRemove(offset.current);\n toaster?.setHeights((prev) => prev.filter((h) => h.toastId !== toast.id));\n\n requestAnimationFrame(() => {\n const toastNode = elementRef.current;\n\n if (!toastNode) return;\n\n const computedStyle = getComputedStyle(toastNode);\n const durationStr = computedStyle.transitionDuration;\n const durationMs = parseFloat(durationStr) * (durationStr.includes('ms') ? 1 : 1000);\n\n setTimeout(() => {\n if (toast.id !== undefined) toaster?.removeFromQueue(toast.id);\n }, durationMs ?? 10);\n });\n }, [toast, toaster?.setHeights]);\n\n React.useEffect(() => {\n return defaultToaster.subscribe((event) => {\n if (event.action !== 'dismiss') return;\n\n const matchesId = event.id !== undefined && event.id === toast.id;\n const matchesAll = event.id === undefined;\n\n if (matchesId || matchesAll) {\n deleteToast();\n toast.onDismiss?.(toast);\n }\n });\n }, [toast, deleteToast]);\n\n const pauseTimer = React.useCallback(() => {\n if (lastTimeoutStartTimeRef.current < timeoutStartTimeRef.current) {\n const elapsedTime = new Date().getTime() - timeoutStartTimeRef.current;\n\n remainingTimeRef.current = remainingTimeRef.current - elapsedTime;\n }\n\n lastTimeoutStartTimeRef.current = new Date().getTime();\n }, []);\n\n const startTimer = React.useCallback(() => {\n if (remainingTimeRef.current === Infinity) return;\n\n timeoutStartTimeRef.current = new Date().getTime();\n\n timeoutRef.current = setTimeout(() => {\n toast.onTimeout?.(toast);\n deleteToast();\n }, remainingTimeRef.current);\n }, [toast, deleteToast]);\n\n React.useEffect(() => {\n if (toast.loading || toast.duration === Infinity) return;\n\n if (toaster?.state.isHovered || toaster?.state.isInteracting || !isDocumentVisible) {\n pauseTimer();\n } else {\n startTimer();\n }\n\n return () => {\n if (timeoutRef.current) clearTimeout(timeoutRef.current);\n };\n }, [toaster?.state.isHovered, toaster?.state.isInteracting, toast, deleteToast, isDocumentVisible]);\n\n const onDragEnd = () => {\n setSwiping(false);\n setSwipeDirection(null);\n pointerStartPositionRef.current = null;\n };\n\n const onPointerDown = (event: React.PointerEvent<HTMLDivElement>) => {\n if (event.button !== 0) return;\n\n if (disabled || !dismissible) return;\n\n swipeStartTimeRef.current = new Date().getTime();\n setOffsetBeforeRemove(offset.current);\n\n (event.target as HTMLElement).setPointerCapture(event.pointerId);\n\n setSwiping(true);\n pointerStartPositionRef.current = { x: event.clientX, y: event.clientY };\n };\n\n const onPointerMove = (event: React.PointerEvent<HTMLDivElement>) => {\n if (!pointerStartPositionRef.current || !dismissible) return;\n\n if ((window.getSelection()?.toString().length ?? 0) > 0) return;\n\n const yDelta = event.clientY - pointerStartPositionRef.current.y;\n const xDelta = event.clientX - pointerStartPositionRef.current.x;\n\n const isRealSwipe = Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1;\n\n const position = (toaster?.props.position ?? 'bottom-right').split('-');\n const side = position[0];\n const align = position[1];\n\n if (!swipeDirection && isRealSwipe) {\n setSwipeDirection(Math.abs(xDelta) > Math.abs(yDelta) ? 'x' : 'y');\n }\n\n const swipeAmount = { x: 0, y: 0 };\n\n const applyDampening = (delta: number) => {\n const dampen = (delta: number) => {\n const factor = Math.abs(delta) / 20;\n\n return 1 / (1.5 + factor);\n };\n\n const dampenedDelta = delta * dampen(delta);\n\n return Math.abs(dampenedDelta) < Math.abs(delta) ? dampenedDelta : delta;\n };\n\n if (swipeDirection === 'x') {\n swipeAmount.x = (align === 'left' && xDelta < 0) || (align === 'right' && xDelta > 0) ? xDelta : applyDampening(xDelta);\n } else if (swipeDirection === 'y') {\n swipeAmount.y = (side === 'top' && yDelta < 0) || (side === 'bottom' && yDelta > 0) ? yDelta : applyDampening(yDelta);\n }\n\n if (Math.abs(swipeAmount.x) > 0 || Math.abs(swipeAmount.y) > 0) {\n setIsSwiped(true);\n }\n\n (elementRef.current as HTMLElement).style.setProperty('--px-swipe-amount-x', `${swipeAmount.x}px`);\n (elementRef.current as HTMLElement).style.setProperty('--px-swipe-amount-y', `${swipeAmount.y}px`);\n };\n\n const onPointerUp = () => {\n if (swipeOut || !dismissible) return;\n\n setSwiping(false);\n pointerStartPositionRef.current = null;\n const swipeAmountX = Number((elementRef.current as HTMLElement).style.getPropertyValue('--px-swipe-amount-x').replace('px', '') || 0);\n const swipeAmountY = Number((elementRef.current as HTMLElement).style.getPropertyValue('--px-swipe-amount-y').replace('px', '') || 0);\n\n const swipeAmount = swipeDirection === 'x' ? swipeAmountX : swipeAmountY;\n const velocity = Math.abs(swipeAmount) / (new Date().getTime() - (swipeStartTimeRef.current ?? 0));\n\n if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > VELOCITY_THRESHOLD) {\n setOffsetBeforeRemove(offset.current);\n\n if (swipeDirection === 'x') {\n setSwipeOutDirection(swipeAmountX > 0 ? 'right' : 'left');\n } else {\n setSwipeOutDirection(swipeAmountY > 0 ? 'down' : 'up');\n }\n\n deleteToast();\n toast.onDismiss?.(toast);\n setSwipeOut(true);\n\n return;\n } else {\n (elementRef.current as HTMLElement).style.setProperty('--px-swipe-amount-x', `0px`);\n (elementRef.current as HTMLElement).style.setProperty('--px-swipe-amount-y', `0px`);\n }\n\n setIsSwiped(false);\n setSwipeDirection(null);\n };\n\n const handleCloseOnClick = () => {\n if (disabled || !dismissible) return;\n\n deleteToast();\n toast.onDismiss?.(toast);\n };\n\n const setRootRef = React.useCallback(\n (node: HTMLElement | null) => {\n elementRef.current = node ?? undefined;\n },\n [elementRef]\n );\n\n const state = {\n mounted,\n swiping,\n swipeOut,\n swipeOutDirection,\n swipeDirection,\n initialHeight,\n isSwiped,\n offsetBeforeRemove,\n removed\n };\n\n const isVisible = visibleIndex + 1 <= (toaster?.props.limit || 3);\n const isFront = index === 0;\n\n const rootProps = {\n ref: setRootRef,\n 'data-scope': 'toast' as const,\n 'data-part': 'root' as const,\n tabIndex: isVisible ? 0 : -1,\n role: 'alert' as const,\n inert: !isVisible,\n 'aria-live': 'assertive' as const,\n 'aria-atomic': 'true' as const,\n 'aria-hidden': !isVisible,\n 'data-id': toast?.id,\n 'data-swipe-direction': swipeOutDirection,\n 'data-index': index,\n ...(mounted && { 'data-mounted': '' as const }),\n ...(removed && { 'data-removed': '' as const }),\n ...(isSwiped && { 'data-swiped': '' as const }),\n ...(isVisible && { 'data-visible': '' as const }),\n ...(swiping && { 'data-swiping': '' as const }),\n ...(toast.dismissible && { 'data-dismissible': '' as const }),\n ...(toaster?.state.isExpanded && { 'data-expanded': '' as const }),\n ...(isFront && { 'data-front': '' as const }),\n ...(swipeOut && { 'data-swipe-out': '' as const }),\n style: {\n '--px-initial-height': initialHeight ? `${initialHeight}px` : undefined,\n '--px-toast-index': removed ? index : visibleIndex,\n '--px-toast-z-index': (toaster?.toasts?.length || 0) - index,\n '--px-toast-offset': (removed ? offsetBeforeRemove : offset.current) + 'px',\n '--px-swipe-amount-x': '0px',\n '--px-swipe-amount-y': '0px'\n } as React.CSSProperties,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n onDragEnd\n };\n\n const actionProps = {\n 'data-scope': 'toast' as const,\n 'data-part': 'action' as const\n };\n\n const contentProps = {\n 'data-scope': 'toast' as const,\n 'data-part': 'content' as const\n };\n\n const messageProps = {\n 'data-scope': 'toast' as const,\n 'data-part': 'message' as const\n };\n\n const closeProps = {\n 'data-scope': 'toast' as const,\n 'data-part': 'close' as const,\n onClick: handleCloseOnClick\n };\n\n const descriptionProps = {\n 'data-scope': 'toast' as const,\n 'data-part': 'description' as const\n };\n\n const iconProps = {\n 'data-scope': 'toast' as const,\n 'data-part': 'icon' as const\n };\n\n const titleProps = {\n 'data-scope': 'toast' as const,\n 'data-part': 'title' as const\n };\n\n return {\n state,\n offset: offset.current,\n offsetBeforeRemove,\n index,\n visibleIndex,\n isVisible,\n isFront,\n toaster,\n // prop getters\n rootProps,\n actionProps,\n contentProps,\n closeProps,\n messageProps,\n descriptionProps,\n iconProps,\n titleProps,\n // handlers\n onPointerDown,\n onPointerMove,\n onPointerUp,\n onDragEnd,\n handleCloseOnClick\n };\n }\n});\n","import type { UseToastProps } from '@primereact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e,CAAE,mBAAoB,EAAY,IACvDC,GAAA,YAAAA,EAAS,MAAM,aAAc,CAAE,gBAAiB,EAAY,GAC5D6E,GAAW,CAAE,aAAc,EAAY,GACvC9D,GAAY,CAAE,iBAAkB,EAAY,GArBlC,CAsBd,MAAO,CACH,sBAAuBM,EAAgB,GAAGA,CAAa,KAAO,OAC9D,mBAAoBhB,EAAUJ,EAAQ6B,EACtC,wBAAuBhC,EAAAE,GAAA,YAAAA,EAAS,SAAT,YAAAF,EAAiB,SAAU,GAAKG,EACvD,qBAAsBI,EAAUc,EAAqBc,EAAO,SAAW,KACvE,sBAAuB,MACvB,sBAAuB,KAC3B,EACA,cAAAuB,EACA,cAAAC,EACA,YAAAW,EACA,UAAAb,CACJ,GAEMwB,GAAc,CAChB,aAAc,QACd,YAAa,QACjB,EAEMC,GAAe,CACjB,aAAc,QACd,YAAa,SACjB,EAEMC,GAAe,CACjB,aAAc,QACd,YAAa,SACjB,EAEMC,GAAa,CACf,aAAc,QACd,YAAa,QACb,QAASV,CACb,EAEMW,GAAmB,CACrB,aAAc,QACd,YAAa,aACjB,EAEMC,GAAY,CACd,aAAc,QACd,YAAa,MACjB,EAEMC,GAAa,CACf,aAAc,QACd,YAAa,OACjB,EAEA,MAAO,CACH,MAAAV,GACA,OAAQ1C,EAAO,QACf,mBAAAd,EACA,MAAAlB,EACA,aAAA6B,EACA,UAAA8C,EACA,QAAAC,EACA,QAAA7E,EAEA,UAAA8E,GACA,YAAAC,GACA,aAAAC,GACA,WAAAE,GACA,aAAAD,GACA,iBAAAE,GACA,UAAAC,GACA,WAAAC,GAEA,cAAA7B,EACA,cAAAC,EACA,YAAAW,EACA,UAAAb,EACA,mBAAAiB,CACJ,CACJ,CACJ,CAAC","names":["withHeadless","defaultToaster","useMountEffect","useVisibilityChange","React","defaultProps","SWIPE_THRESHOLD","VELOCITY_THRESHOLD","useToast","withHeadless","defaultProps","props","elementRef","_a","_b","_c","toast","toaster","index","t","isDocumentVisible","useVisibilityChange","removed","setRemoved","swipeDirection","setSwipeDirection","swipeOutDirection","setSwipeOutDirection","mounted","setMounted","swiping","setSwiping","swipeOut","setSwipeOut","isSwiped","setIsSwiped","offsetBeforeRemove","setOffsetBeforeRemove","initialHeight","setInitialHeight","dismissible","remainingTimeRef","swipeStartTimeRef","pointerStartPositionRef","timeoutRef","timeoutStartTimeRef","lastTimeoutStartTimeRef","visibleIndex","h","duration","offset","prev","curr","reducerIndex","disabled","useMountEffect","toastNode","height","originalHeight","newHeight","__spreadProps","__spreadValues","deleteToast","durationStr","durationMs","defaultToaster","event","matchesId","matchesAll","pauseTimer","elapsedTime","startTimer","onDragEnd","onPointerDown","onPointerMove","yDelta","xDelta","isRealSwipe","position","side","align","swipeAmount","applyDampening","delta","dampenedDelta","onPointerUp","swipeAmountX","swipeAmountY","velocity","handleCloseOnClick","setRootRef","node","state","isVisible","isFront","rootProps","actionProps","contentProps","messageProps","closeProps","descriptionProps","iconProps","titleProps"]}
|
package/toast/useToast.test.d.ts
DELETED
|
File without changes
|
package/toaster/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/toaster/ToastManager.ts","../../src/toaster/useToaster.ts","../../src/toaster/useToaster.props.ts"],"sourcesContent":["import type { ToastEvent, ToastEventListener, ToastId, ToastManager, ToastPromiseType, ToastSeverity, ToastType } from '@primereact/types/primitive/toaster';\n\nlet toastCounter = 0;\nconst generateId = (): string => `toast-${++toastCounter}-${Date.now()}`;\n\nconst ensureId = (id?: ToastId): ToastId => {\n if ((typeof id === 'number' && !Number.isNaN(id)) || (typeof id === 'string' && id.length > 0)) {\n return id;\n }\n\n return generateId();\n};\n\nexport function createToastManager(): ToastManager {\n let toasts: ToastType[] = [];\n const listeners = new Set<ToastEventListener>();\n\n const emit = (event: ToastEvent) => {\n listeners.forEach((listener) => listener(event));\n };\n\n const snapshot = (): ToastType[] => toasts;\n\n const subscribe = (listener: ToastEventListener): (() => void) => {\n listeners.add(listener);\n\n return () => {\n listeners.delete(listener);\n };\n };\n\n const add = (toast: ToastType): ToastId => {\n const id = ensureId(toast.id);\n const dismissible = toast.dismissible ?? true;\n const index = toasts.findIndex((t) => t.id === id);\n\n if (index !== -1) {\n const next = { ...toasts[index], ...toast, id, dismissible };\n\n toasts = [...toasts.slice(0, index), next, ...toasts.slice(index + 1)];\n emit({ action: 'update', toast: next });\n } else {\n const next = { ...toast, id, dismissible };\n\n toasts = [next, ...toasts];\n emit({ action: 'add', toast: next });\n }\n\n return id;\n };\n\n const update = (id: ToastId, updates: Partial<ToastType>): ToastId => add({ ...updates, id });\n\n const dismiss = (id?: ToastId): void => {\n emit({ action: 'dismiss', id });\n };\n\n const promise = async <T>(promise: Promise<T>, options: ToastPromiseType<T>): Promise<T> => {\n const id = ensureId(options.loading.id);\n\n add({\n ...options.loading,\n id,\n loading: true,\n dismissible: options.loading.dismissible ?? false\n });\n\n try {\n const data = await promise;\n const successToast = typeof options.success === 'function' ? options.success(data) : options.success;\n\n if (successToast) {\n add({\n icon: undefined,\n ...successToast,\n id,\n severity: successToast.severity ?? 'success',\n loading: false\n });\n } else {\n dismiss(id);\n }\n\n return data;\n } catch (error) {\n const errorToast = typeof options.error === 'function' ? options.error(error) : options.error;\n\n if (errorToast) {\n add({\n icon: undefined,\n ...errorToast,\n id,\n severity: errorToast.severity ?? 'error',\n loading: false\n });\n } else {\n dismiss(id);\n }\n\n throw error;\n }\n };\n\n const withSeverity =\n (severity: ToastSeverity) =>\n (toast: ToastType): ToastId =>\n add({ ...toast, severity });\n\n return {\n snapshot,\n subscribe,\n add,\n update,\n dismiss,\n promise,\n success: withSeverity('success'),\n info: withSeverity('info'),\n warn: withSeverity('warn'),\n error: withSeverity('error'),\n secondary: withSeverity('secondary'),\n contrast: withSeverity('contrast')\n };\n}\n\nexport const defaultToaster = createToastManager();\n\nconst baseToast = (toast: ToastType) => defaultToaster.add(toast);\n\nexport const toast = Object.assign(baseToast, {\n update: defaultToaster.update,\n dismiss: defaultToaster.dismiss,\n promise: defaultToaster.promise,\n success: defaultToaster.success,\n info: defaultToaster.info,\n warn: defaultToaster.warn,\n error: defaultToaster.error,\n secondary: defaultToaster.secondary,\n contrast: defaultToaster.contrast\n});\n","import { withHeadless } from '@primereact/core/headless';\nimport type { ToastId, ToastType } from '@primereact/types/primitive/toaster';\nimport * as React from 'react';\nimport { defaultToaster } from './ToastManager';\nimport { defaultProps } from './useToaster.props';\n\nexport const useToaster = withHeadless({\n name: 'useToaster',\n defaultProps,\n setup: ({ props }) => {\n const toasts = React.useSyncExternalStore(defaultToaster.subscribe, defaultToaster.snapshot, defaultToaster.snapshot);\n\n const [removedIds, setRemovedIds] = React.useState<Set<ToastId>>(() => new Set());\n\n const removeFromQueue = React.useCallback((id: ToastId) => {\n setRemovedIds((prev) => {\n if (prev.has(id)) return prev;\n\n const next = new Set(prev);\n\n next.add(id);\n\n return next;\n });\n }, []);\n\n const filteredToasts: ToastType[] = React.useMemo(() => {\n const inGroup = props.group ? toasts.filter((t) => t.group === props.group) : toasts.filter((t) => !t.group);\n\n if (!removedIds.size) return inGroup;\n\n return inGroup.filter((t) => t.id === undefined || !removedIds.has(t.id));\n }, [toasts, props.group, removedIds]);\n\n const [heights, setHeights] = React.useState<{ height: number; toastId: ToastId }[]>([]);\n const [isHovered, setIsHovered] = React.useState<boolean>(false);\n const [isInteracting, setIsInteracting] = React.useState<boolean>(false);\n\n const focusWithinRef = React.useRef<boolean>(false);\n\n const isExpanded = props.mode === 'expanded' || isHovered;\n\n const state = {\n isExpanded,\n isHovered,\n isInteracting,\n heights\n };\n\n const onRegionMouseEnter = () => {\n setIsHovered(true);\n };\n\n const onRegionMouseMove = () => {\n setIsHovered(true);\n };\n\n const onRegionMouseLeave = () => {\n if (!isInteracting && !focusWithinRef.current) {\n setIsHovered(false);\n }\n };\n\n const onRegionDragEnd = () => {\n setIsHovered(false);\n };\n\n const onRegionPointerDown = (event: React.PointerEvent) => {\n if (event.target instanceof HTMLElement && event.target.dataset.dismissible === 'false') return;\n\n setIsInteracting(true);\n };\n\n const onRegionPointerUp = () => {\n setIsInteracting(false);\n };\n\n const onRegionFocus = (event: React.FocusEvent<HTMLElement>) => {\n const region = event.currentTarget;\n const activeEl = document.activeElement as HTMLElement;\n\n if (activeEl && activeEl.matches(':focus-visible') && region.contains(activeEl)) {\n focusWithinRef.current = true;\n setIsHovered(true);\n }\n };\n\n const onRegionBlur = (event: React.FocusEvent<HTMLElement>) => {\n const region = event.currentTarget;\n const related = event.relatedTarget as HTMLElement | null;\n\n if (related && region.contains(related)) {\n return;\n }\n\n focusWithinRef.current = false;\n\n if (isInteracting) return;\n\n setIsHovered(false);\n };\n\n const handleFocusManagement = (toastEl: HTMLElement | null) => {\n if (!toastEl) return;\n\n const activeEl = document.activeElement as HTMLElement;\n\n if (!toastEl.contains(activeEl)) {\n return;\n }\n\n const nextToastEl = toastEl.nextElementSibling as HTMLElement | null;\n const prevToastEl = toastEl.previousElementSibling as HTMLElement | null;\n\n requestAnimationFrame(() => {\n if (nextToastEl) nextToastEl.focus({ preventScroll: true });\n else if (prevToastEl) prevToastEl.focus({ preventScroll: true });\n });\n };\n\n React.useEffect(() => {\n if (filteredToasts.length <= 1) {\n setIsHovered(false);\n }\n }, [filteredToasts]);\n\n // prop getters\n const rootProps = {\n 'data-scope': 'toaster' as const,\n 'data-part': 'root' as const,\n 'data-position': props.position\n };\n\n const regionProps = React.useMemo(\n () => ({\n 'data-scope': 'toaster' as const,\n 'data-part': 'region' as const,\n role: 'region' as const,\n tabIndex: 0,\n onMouseEnter: onRegionMouseEnter,\n onMouseLeave: onRegionMouseLeave,\n onMouseMove: onRegionMouseMove,\n onDragEnd: onRegionDragEnd,\n onPointerDown: onRegionPointerDown,\n onPointerUp: onRegionPointerUp,\n onFocus: onRegionFocus,\n onBlur: onRegionBlur,\n 'data-position': props.position,\n ...(isExpanded && { 'data-expanded': '' as const }),\n style: {\n '--px-gap': `${props.gap}px`,\n '--px-front-toast-height': `${heights?.[0]?.height || 0}px`\n } as React.CSSProperties\n }),\n [props.position, props.gap, isExpanded, heights]\n );\n\n return {\n state,\n toasts: filteredToasts,\n setHeights,\n removeFromQueue,\n // prop getters\n rootProps,\n regionProps,\n // handlers\n onRegionMouseEnter,\n onRegionMouseMove,\n onRegionMouseLeave,\n onRegionDragEnd,\n onRegionPointerDown,\n onRegionPointerUp,\n onRegionFocus,\n onRegionBlur,\n handleFocusManagement\n };\n }\n});\n","import type { UseToasterProps } from '@primereact/types/headless/toaster';\n\nexport const defaultProps: UseToasterProps = {\n timeout: 6000,\n gap: 12,\n position: 'top-right',\n mode: 'stacked',\n group: undefined,\n limit: 3\n};\n"],"mappings":"0nBAEA,IAAIA,EAAe,EACbC,EAAa,IAAc,SAAS,EAAED,CAAY,IAAI,KAAK,IAAI,CAAC,GAEhEE,EAAYC,GACT,OAAOA,GAAO,UAAY,CAAC,OAAO,MAAMA,CAAE,GAAO,OAAOA,GAAO,UAAYA,EAAG,OAAS,EACjFA,EAGJF,EAAW,EAGf,SAASG,GAAmC,CAC/C,IAAIC,EAAsB,CAAC,EACrBC,EAAY,IAAI,IAEhBC,EAAQC,GAAsB,CAChCF,EAAU,QAASG,GAAaA,EAASD,CAAK,CAAC,CACnD,EAEME,EAAW,IAAmBL,EAE9BM,EAAaF,IACfH,EAAU,IAAIG,CAAQ,EAEf,IAAM,CACTH,EAAU,OAAOG,CAAQ,CAC7B,GAGEG,EAAOC,GAA8B,CA/B/C,IAAAC,EAgCQ,IAAMX,EAAKD,EAASW,EAAM,EAAE,EACtBE,GAAcD,EAAAD,EAAM,cAAN,KAAAC,EAAqB,GACnCE,EAAQX,EAAO,UAAWY,GAAMA,EAAE,KAAOd,CAAE,EAEjD,GAAIa,IAAU,GAAI,CACd,IAAME,EAAOC,EAAAC,IAAA,GAAKf,EAAOW,CAAK,GAAMH,GAAvB,CAA8B,GAAAV,EAAI,YAAAY,CAAY,GAE3DV,EAAS,CAAC,GAAGA,EAAO,MAAM,EAAGW,CAAK,EAAGE,EA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ACA,oBAAAC,EACA,kBAAAE,EACA,cAAAC,EACA,aAAAG,EACA,sBAAAE,CACJ,CACJ,CACJ,CAAC","names":["toastCounter","generateId","ensureId","id","createToastManager","toasts","listeners","emit","event","listener","snapshot","subscribe","add","toast","_a","dismissible","index","t","next","__spreadProps","__spreadValues","update","updates","dismiss","promise","options","__async","_b","_c","data","successToast","error","errorToast","withSeverity","severity","defaultToaster","baseToast","withHeadless","React","defaultProps","useToaster","withHeadless","defaultProps","props","toasts","defaultToaster","removedIds","setRemovedIds","removeFromQueue","id","prev","next","filteredToasts","inGroup","t","heights","setHeights","isHovered","setIsHovered","isInteracting","setIsInteracting","focusWithinRef","isExpanded","state","onRegionMouseEnter","onRegionMouseMove","onRegionMouseLeave","onRegionDragEnd","onRegionPointerDown","event","onRegionPointerUp","onRegionFocus","region","activeEl","onRegionBlur","related","handleFocusManagement","toastEl","nextToastEl","prevToastEl","rootProps","regionProps","_a","__spreadProps","__spreadValues"]}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/togglebutton/useToggleButton.ts","../../src/togglebutton/useToggleButton.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { useControlledState } from '@primereact/hooks/use-controlled-state';\nimport type { UseToggleButtonChangeEvent, UseToggleButtonIndicatorProps, UseToggleButtonRootProps } from '@primereact/types/headless/togglebutton';\nimport * as React from 'react';\nimport { defaultProps } from './useToggleButton.props';\n\nexport const useToggleButton = withHeadless({\n name: 'useToggleButton',\n defaultProps,\n setup({ props }) {\n const [pressedState, setPressedState] = useControlledState({\n value: props.pressed,\n defaultValue: props.defaultPressed ?? false,\n onChange: props.onPressedChange\n });\n\n const state = {\n pressed: pressedState\n };\n\n // methods\n const onChange = (event: UseToggleButtonChangeEvent) => {\n const computedPressed = !pressedState;\n\n setPressedState([\n computedPressed,\n {\n originalEvent: event,\n pressed: computedPressed\n }\n ]);\n };\n\n // prop getters\n const getRootProps = (disabled: boolean, invalid: boolean): UseToggleButtonRootProps => {\n return {\n disabled,\n 'aria-pressed': pressedState,\n 'aria-disabled': disabled,\n ...(pressedState && { 'data-pressed': '' as const }),\n ...(disabled && { 'data-disabled': '' as const }),\n ...(!!invalid && { 'data-invalid': '' as const }),\n onClick: onChange as unknown as (event: React.SyntheticEvent) => void\n };\n };\n\n const getIndicatorProps = (disabled: boolean, invalid: boolean): UseToggleButtonIndicatorProps => {\n return {\n ...(pressedState && { 'data-pressed': '' as const }),\n ...(disabled && { 'data-disabled': '' as const }),\n ...(!!invalid && { 'data-invalid': '' as const })\n };\n };\n\n return {\n state,\n // prop getters\n getRootProps,\n getIndicatorProps,\n // methods\n onChange\n };\n }\n});\n","import type { UseToggleButtonProps } from '@primereact/types/headless/togglebutton';\n\nexport const defaultProps: UseToggleButtonProps = {\n pressed: undefined,\n defaultPressed: undefined,\n disabled: undefined,\n invalid: undefined,\n onPressedChange: undefined\n};\n"],"mappings":"6aAAA,OAAS,gBAAAA,MAAoB,4BAC7B,OAAS,sBAAAC,MAA0B,yCCC5B,IAAMC,EAAqC,CAC9C,QAAS,OACT,eAAgB,OAChB,SAAU,OACV,QAAS,OACT,gBAAiB,MACrB,EDFO,IAAMC,EAAkBC,EAAa,CACxC,KAAM,kBACN,aAAAC,EACA,MAAM,CAAE,MAAAC,CAAM,EAAG,CATrB,IAAAC,EAUQ,GAAM,CAACC,EAAcC,CAAe,EAAIC,EAAmB,CACvD,MAAOJ,EAAM,QACb,cAAcC,EAAAD,EAAM,iBAAN,KAAAC,EAAwB,GACtC,SAAUD,EAAM,eACpB,CAAC,EAEKK,EAAQ,CACV,QAASH,CACb,EAGMI,EAAYC,GAAsC,CACpD,IAAMC,EAAkB,CAACN,EAEzBC,EAAgB,CACZK,EACA,CACI,cAAeD,EACf,QAASC,CACb,CACJ,CAAC,CACL,EAuBA,MAAO,CACH,MAAAH,EAEA,aAvBiB,CAACI,EAAmBC,IAC9BC,EAAAC,MAAA,CACH,SAAAH,EACA,eAAgBP,EAChB,gBAAiBO,GACbP,GAAgB,CAAE,eAAgB,EAAY,GAC9CO,GAAY,CAAE,gBAAiB,EAAY,GAC3C,CAAC,CAACC,GAAW,CAAE,eAAgB,EAAY,GAN5C,CAOH,QAASJ,CACb,GAeA,kBAZsB,CAACG,EAAmBC,IACnCE,MAAA,GACCV,GAAgB,CAAE,eAAgB,EAAY,GAC9CO,GAAY,CAAE,gBAAiB,EAAY,GAC3C,CAAC,CAACC,GAAW,CAAE,eAAgB,EAAY,GAUnD,SAAAJ,CACJ,CACJ,CACJ,CAAC","names":["withHeadless","useControlledState","defaultProps","useToggleButton","withHeadless","defaultProps","props","_a","pressedState","setPressedState","useControlledState","state","onChange","event","computedPressed","disabled","invalid","__spreadProps","__spreadValues"]}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/togglebuttongroup/useToggleButtonGroup.ts","../../src/togglebuttongroup/useToggleButtonGroup.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { useControlledState } from '@primereact/hooks/use-controlled-state';\nimport type { UseToggleButtonGroupExposes } from '@primereact/types/headless/togglebuttongroup';\nimport * as React from 'react';\nimport { defaultProps } from './useToggleButtonGroup.props';\n\nexport const useToggleButtonGroup = withHeadless({\n name: 'useToggleButtonGroup',\n defaultProps,\n setup({ props }) {\n const [valueState, setValueState] = useControlledState({\n value: props.value,\n defaultValue: props.defaultValue,\n onChange: props.onValueChange\n });\n\n const state = {\n value: valueState\n };\n\n // methods\n const updateChange = React.useCallback(\n (event: Parameters<UseToggleButtonGroupExposes['updateChange']>[0]) => {\n let newValue = null;\n\n if (props.multiple) {\n newValue = event.pressed ? [...((valueState as unknown[]) || []), event.value] : ((valueState as unknown[]) || []).filter((v) => v !== event.value);\n if (!props.allowEmpty && newValue.length === 0) return;\n } else {\n newValue = event.pressed ? event.value : null;\n if (!props.allowEmpty && newValue === null) return;\n }\n\n setValueState?.([newValue, { originalEvent: event.originalEvent, value: newValue }]);\n },\n [valueState, setValueState]\n );\n\n const isPressed = (value: unknown | unknown[] | undefined, toggleButtonValue: unknown) => {\n if (value === undefined) return;\n\n return props.multiple ? (value as unknown[])?.includes(toggleButtonValue) : value === toggleButtonValue;\n };\n\n // prop getters\n const rootProps = {\n role: 'group' as const,\n 'data-scope': 'togglebuttongroup',\n 'data-part': 'root',\n ...(props.disabled && { 'data-disabled': '' as const }),\n ...(props.invalid && { 'data-invalid': '' as const }),\n ...(props.multiple && { 'data-multiple': '' as const }),\n ...(props.allowEmpty && { 'data-allow-empty': '' as const })\n };\n\n return {\n state,\n // prop getters\n rootProps,\n // methods\n updateChange,\n isPressed\n };\n }\n});\n","import type { UseToggleButtonGroupProps } from '@primereact/types/headless/togglebuttongroup';\n\nexport const defaultProps: UseToggleButtonGroupProps = {\n value: undefined,\n defaultValue: undefined,\n onValueChange: undefined,\n multiple: false,\n allowEmpty: true,\n disabled: false,\n invalid: false\n};\n"],"mappings":"yVAAA,OAAS,gBAAAA,MAAoB,4BAC7B,OAAS,sBAAAC,MAA0B,yCAEnC,UAAYC,MAAW,QCDhB,IAAMC,EAA0C,CACnD,MAAO,OACP,aAAc,OACd,cAAe,OACf,SAAU,GACV,WAAY,GACZ,SAAU,GACV,QAAS,EACb,EDJO,IAAMC,EAAuBC,EAAa,CAC7C,KAAM,uBACN,aAAAC,EACA,MAAM,CAAE,MAAAC,CAAM,EAAG,CACb,GAAM,CAACC,EAAYC,CAAa,EAAIC,EAAmB,CACnD,MAAOH,EAAM,MACb,aAAcA,EAAM,aACpB,SAAUA,EAAM,aACpB,CAAC,EAEKI,EAAQ,CACV,MAAOH,CACX,EAGMI,EAAqB,cACtBC,GAAsE,CACnE,IAAIC,EAAW,KAEf,GAAIP,EAAM,UAEN,GADAO,EAAWD,EAAM,QAAU,CAAC,GAAKL,GAA4B,CAAC,EAAIK,EAAM,KAAK,GAAML,GAA4B,CAAC,GAAG,OAAQO,GAAMA,IAAMF,EAAM,KAAK,EAC9I,CAACN,EAAM,YAAcO,EAAS,SAAW,EAAG,eAEhDA,EAAWD,EAAM,QAAUA,EAAM,MAAQ,KACrC,CAACN,EAAM,YAAcO,IAAa,KAAM,OAGhDL,GAAA,MAAAA,EAAgB,CAACK,EAAU,CAAE,cAAeD,EAAM,cAAe,MAAOC,CAAS,CAAC,EACtF,EACA,CAACN,EAAYC,CAAa,CAC9B,EAEMO,EAAY,CAACC,EAAwCC,IAA+B,CACtF,GAAID,IAAU,OAEd,OAAOV,EAAM,SAAYU,GAAA,YAAAA,EAAqB,SAASC,GAAqBD,IAAUC,CAC1F,EAGMC,EAAYC,QAAA,CACd,KAAM,QACN,aAAc,oBACd,YAAa,QACTb,EAAM,UAAY,CAAE,gBAAiB,EAAY,GACjDA,EAAM,SAAW,CAAE,eAAgB,EAAY,GAC/CA,EAAM,UAAY,CAAE,gBAAiB,EAAY,GACjDA,EAAM,YAAc,CAAE,mBAAoB,EAAY,GAG9D,MAAO,CACH,MAAAI,EAEA,UAAAQ,EAEA,aAAAP,EACA,UAAAI,CACJ,CACJ,CACJ,CAAC","names":["withHeadless","useControlledState","React","defaultProps","useToggleButtonGroup","withHeadless","defaultProps","props","valueState","setValueState","useControlledState","state","updateChange","event","newValue","v","isPressed","value","toggleButtonValue","rootProps","__spreadValues"]}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/toggleswitch/useToggleSwitch.ts","../../src/toggleswitch/useToggleSwitch.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { useControlledState } from '@primereact/hooks/use-controlled-state';\nimport type { UseToggleSwitchChangeEvent } from '@primereact/types/headless/toggleswitch';\nimport { defaultProps } from './useToggleSwitch.props';\n\nexport const useToggleSwitch = withHeadless({\n name: 'useToggleSwitch',\n defaultProps,\n setup({ props }) {\n const [checkedState, setCheckedState] = useControlledState({\n value: props.checked,\n defaultValue: props.defaultChecked ?? false,\n onChange: props.onCheckedChange\n });\n\n const state = {\n checked: checkedState\n };\n\n // methods\n const onChange = (event: UseToggleSwitchChangeEvent) => {\n const computedChecked = !checkedState;\n\n setCheckedState([\n computedChecked,\n {\n originalEvent: event,\n checked: computedChecked\n }\n ]);\n };\n\n const rootProps = {\n ...(checkedState ? { 'data-checked': '' as const } : { 'data-unchecked': '' as const }),\n ...(props.disabled && { 'data-disabled': '' as const }),\n ...(props.invalid && { 'data-invalid': '' as const })\n };\n\n const inputProps = {\n type: 'checkbox' as const,\n role: 'switch' as const,\n checked: checkedState,\n disabled: props.disabled,\n 'aria-checked': checkedState,\n ...(props.invalid && { 'aria-invalid': true as const }),\n ...(props.tabIndex !== undefined && { tabIndex: props.tabIndex }),\n ...(props.ariaLabelledby && { 'aria-labelledby': props.ariaLabelledby }),\n ...(props.ariaLabel && { 'aria-label': props.ariaLabel }),\n ...(props.onFocus && { onFocus: props.onFocus }),\n ...(props.onBlur && { onBlur: props.onBlur }),\n onChange\n };\n\n const controlProps = {\n ...(checkedState ? { 'data-checked': '' as const } : { 'data-unchecked': '' as const }),\n ...(props.disabled && { 'data-disabled': '' as const }),\n ...(props.invalid && { 'data-invalid': '' as const })\n };\n\n const handleProps = {\n ...(checkedState ? { 'data-checked': '' as const } : { 'data-unchecked': '' as const }),\n ...(props.disabled && { 'data-disabled': '' as const }),\n ...(props.invalid && { 'data-invalid': '' as const })\n };\n\n return {\n state,\n // methods\n onChange,\n // prop getters\n rootProps,\n inputProps,\n controlProps,\n handleProps\n };\n }\n});\n","import type { UseToggleSwitchProps } from '@primereact/types/headless/toggleswitch';\n\nexport const defaultProps: UseToggleSwitchProps = {\n checked: undefined,\n defaultChecked: undefined,\n disabled: false,\n invalid: false,\n tabIndex: undefined,\n ariaLabel: undefined,\n ariaLabelledby: undefined,\n onFocus: undefined,\n onBlur: undefined,\n onCheckedChange: undefined\n};\n"],"mappings":"6aAAA,OAAS,gBAAAA,MAAoB,4BAC7B,OAAS,sBAAAC,MAA0B,yCCC5B,IAAMC,EAAqC,CAC9C,QAAS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MAAA,GACZR,EAAe,CAAE,eAAgB,EAAY,EAAI,CAAE,iBAAkB,EAAY,GACjFF,EAAM,UAAY,CAAE,gBAAiB,EAAY,GACjDA,EAAM,SAAW,CAAE,eAAgB,EAAY,GAGvD,MAAO,CACH,MAAAK,EAEA,SAAAC,EAEA,UAAAG,EACA,WAAAE,EACA,aAAAE,EACA,YAAAC,CACJ,CACJ,CACJ,CAAC","names":["withHeadless","useControlledState","defaultProps","useToggleSwitch","withHeadless","defaultProps","props","_a","checkedState","setCheckedState","useControlledState","state","onChange","event","computedChecked","rootProps","__spreadValues","inputProps","__spreadProps","controlProps","handleProps"]}
|
|
File without changes
|
package/toolbar/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/toolbar/useToolbar.ts","../../src/toolbar/useToolbar.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { defaultProps } from './useToolbar.props';\n\nexport const useToolbar = withHeadless({\n name: 'useToolbar',\n defaultProps,\n setup() {\n // prop getters\n const rootProps = {\n 'data-scope': 'toolbar' as const,\n 'data-part': 'root' as const,\n role: 'toolbar' as const\n };\n\n return {\n rootProps\n };\n }\n});\n","import type { UseToolbarProps } from '@primereact/types/headless/toolbar';\n\nexport const defaultProps: UseToolbarProps = {};\n"],"mappings":"AAAA,OAAS,gBAAAA,MAAoB,4BCEtB,IAAMC,EAAgC,CAAC,EDCvC,IAAMC,EAAaC,EAAa,CACnC,KAAM,aACN,aAAAC,EACA,OAAQ,CAQJ,MAAO,CACH,UAPc,CACd,aAAc,UACd,YAAa,OACb,KAAM,SACV,CAIA,CACJ,CACJ,CAAC","names":["withHeadless","defaultProps","useToolbar","withHeadless","defaultProps"]}
|
|
File without changes
|
package/tooltip/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/tooltip/useTooltip.ts","../../src/tooltip/useTooltip.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { useControlledState } from '@primereact/hooks/use-controlled-state';\nimport type { InstantType } from '@primereact/types/headless/tooltip';\nimport * as React from 'react';\nimport { defaultProps } from './useTooltip.props';\n\nexport const useTooltip = withHeadless({\n name: 'useTooltip',\n defaultProps,\n setup: ({ props }) => {\n const { tooltipManager, openDelay = 600, closeDelay = 0, interactive = true, disabled } = props;\n\n const [openState, setOpenState] = useControlledState({\n value: props.open,\n defaultValue: props.defaultOpen,\n onChange: props.onOpenChange\n });\n\n const [anchorElement, setAnchorElement] = React.useState<HTMLElement | null>(props.anchor ?? null);\n const [positionerElement, setPositionerElement] = React.useState<HTMLDivElement | null>(null);\n const [popupElement, setPopupElement] = React.useState<HTMLElement | null>(null);\n const [arrowElement, setArrowElement] = React.useState<HTMLDivElement | null>(null);\n const [instantType, setInstantType] = React.useState<InstantType>(undefined);\n const [rendered, setRendered] = React.useState<boolean>(!!openState);\n\n const tooltipId = React.useId();\n\n const anchorRef = React.useRef<HTMLElement>(null);\n const positionerRef = React.useRef<HTMLDivElement>(null);\n const popupRef = React.useRef<HTMLElement | null>(null);\n const arrowRef = React.useRef<HTMLDivElement>(null);\n const openDelayTimerRef = React.useRef<number | null>(null);\n const closeDelayTimerRef = React.useRef<number | null>(null);\n const isOverPositionerRef = React.useRef(false);\n const suppressFocusRef = React.useRef(false);\n\n const openStateRef = React.useRef(openState);\n\n openStateRef.current = openState;\n\n const setAnchorRef = React.useCallback(\n (node: HTMLElement | null) => {\n // If an external anchor is controlling positioning, ignore the Trigger ref.\n if (props.anchor != null) return;\n\n if (node === anchorRef.current) return;\n\n anchorRef.current = node;\n setAnchorElement(node);\n },\n [props.anchor]\n );\n\n React.useEffect(() => {\n if (props.anchor === undefined) return;\n\n anchorRef.current = props.anchor;\n setAnchorElement(props.anchor ?? null);\n }, [props.anchor]);\n\n React.useEffect(() => {\n if (openState) setRendered(true);\n }, [openState]);\n\n const setPositionerRef = React.useCallback((node: HTMLDivElement | null) => {\n if (node === positionerRef.current) return;\n\n positionerRef.current = node;\n setPositionerElement(node);\n }, []);\n\n const setArrowRef = React.useCallback((node: HTMLDivElement | null) => {\n if (node === arrowRef.current) return;\n\n arrowRef.current = node;\n setArrowElement(node);\n }, []);\n\n const setPopupRef = React.useCallback((node: HTMLElement | null) => {\n if (node === popupRef.current) return;\n\n popupRef.current = node;\n setPopupElement(node);\n }, []);\n\n const onOpenComplete = React.useCallback(() => {}, []);\n\n const onCloseComplete = React.useCallback(() => {\n props.onExitComplete?.();\n }, [props.onExitComplete]);\n\n const clearTimers = () => {\n if (openDelayTimerRef.current) {\n clearTimeout(openDelayTimerRef.current);\n openDelayTimerRef.current = null;\n }\n\n if (closeDelayTimerRef.current) {\n clearTimeout(closeDelayTimerRef.current);\n closeDelayTimerRef.current = null;\n }\n };\n\n function setOpen(open: boolean, originalEvent?: Event) {\n setOpenState([\n open,\n {\n originalEvent,\n value: open\n }\n ]);\n }\n\n const forceCloseRef = React.useRef(() => {});\n\n forceCloseRef.current = () => {\n clearTimers();\n setInstantType('delay');\n setOpen(false);\n tooltipManager?.notifyClose?.(tooltipId);\n };\n\n const openTooltip = (delay?: number, instant?: InstantType) => {\n if (disabled) return;\n\n clearTimers();\n\n const isInstantPhase = tooltipManager?.state?.isInstantPhase;\n const lastClosedId = tooltipManager?.state?.lastClosedTooltipId;\n const currentOpenId = tooltipManager?.state?.currentOpenTooltipId;\n const managerOpenDelay = tooltipManager?.state?.openDelay;\n\n const isGroupTransition = currentOpenId !== null && currentOpenId !== tooltipId;\n\n const isSameTooltipReentry = isInstantPhase && lastClosedId === tooltipId;\n const isDifferentTooltipInstant = isInstantPhase && lastClosedId !== null && lastClosedId !== tooltipId;\n\n const shouldBeInstant = isGroupTransition || isDifferentTooltipInstant;\n\n const shouldSkipDelay = shouldBeInstant || isSameTooltipReentry;\n const effectiveDelay = shouldSkipDelay ? 0 : (delay ?? managerOpenDelay ?? openDelay);\n\n if (isGroupTransition) {\n tooltipManager?.closeCurrentTooltip?.();\n }\n\n if (instant) {\n setInstantType(instant);\n } else if (shouldBeInstant) {\n setInstantType('delay');\n } else if (isSameTooltipReentry) {\n setInstantType(undefined);\n } else {\n setInstantType(undefined);\n }\n\n if (effectiveDelay === 0) {\n setOpen(true);\n tooltipManager?.notifyOpen?.(tooltipId, () => forceCloseRef.current());\n } else {\n openDelayTimerRef.current = window.setTimeout(() => {\n setOpen(true);\n tooltipManager?.notifyOpen?.(tooltipId, () => forceCloseRef.current());\n openDelayTimerRef.current = null;\n }, effectiveDelay);\n }\n };\n\n const closeTooltip = (delay?: number, instant?: InstantType) => {\n clearTimers();\n\n const isInstantPhase = tooltipManager?.state?.isInstantPhase;\n const managerCloseDelay = tooltipManager?.state?.closeDelay;\n const effectiveDelay = isInstantPhase ? 0 : (delay ?? managerCloseDelay ?? closeDelay);\n\n if (instant) {\n setInstantType(instant);\n }\n\n if (effectiveDelay === 0) {\n setOpen(false);\n tooltipManager?.notifyClose?.(tooltipId);\n\n if (!instant) {\n setInstantType(undefined);\n }\n } else {\n closeDelayTimerRef.current = window.setTimeout(() => {\n setOpen(false);\n tooltipManager?.notifyClose?.(tooltipId);\n\n if (!instant) {\n setInstantType(undefined);\n }\n\n closeDelayTimerRef.current = null;\n }, effectiveDelay);\n }\n };\n\n const handlersRef = React.useRef({\n onTriggerPointerEnter: () => {},\n onTriggerPointerLeave: () => {},\n onPositionerPointerLeave: () => {},\n onFocus: () => {},\n onBlur: () => {},\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onDocumentPointerDown: (_event: PointerEvent) => {},\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onKeyDown: (event: KeyboardEvent) => {}\n });\n\n handlersRef.current.onTriggerPointerEnter = () => {\n isOverPositionerRef.current = false;\n openTooltip();\n };\n\n handlersRef.current.onTriggerPointerLeave = () => {\n if (!openStateRef.current) {\n clearTimers();\n\n return;\n }\n\n if (tooltipManager) {\n const effectiveCloseDelay = tooltipManager.state?.closeDelay ?? closeDelay;\n\n closeDelayTimerRef.current = window.setTimeout(() => {\n closeDelayTimerRef.current = null;\n closeTooltip(0);\n }, effectiveCloseDelay);\n } else {\n closeTooltip();\n }\n };\n\n handlersRef.current.onPositionerPointerLeave = () => {\n isOverPositionerRef.current = false;\n\n if (tooltipManager) {\n const effectiveCloseDelay = tooltipManager.state?.closeDelay ?? closeDelay;\n\n closeDelayTimerRef.current = window.setTimeout(() => {\n closeDelayTimerRef.current = null;\n closeTooltip(0);\n }, effectiveCloseDelay);\n } else {\n closeTooltip();\n }\n };\n\n handlersRef.current.onFocus = () => {\n if (suppressFocusRef.current) {\n suppressFocusRef.current = false;\n\n return;\n }\n\n if (!anchorRef.current?.matches(':focus-visible')) {\n return;\n }\n\n openTooltip(0, 'focus');\n };\n\n handlersRef.current.onBlur = () => {\n suppressFocusRef.current = false;\n\n if (!document.hasFocus()) {\n return;\n }\n\n closeTooltip(0, 'focus');\n };\n\n handlersRef.current.onDocumentPointerDown = (event: PointerEvent) => {\n if (!openStateRef.current) return;\n\n if (interactive && positionerRef.current?.contains(event.target as Node)) {\n return;\n }\n\n suppressFocusRef.current = true;\n closeTooltip(0, 'dismiss');\n };\n\n handlersRef.current.onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape' && openStateRef.current) {\n closeTooltip(0, 'dismiss');\n }\n };\n\n React.useEffect(() => {\n const trigger = anchorRef.current;\n\n if (!trigger || disabled) return;\n\n const onPointerEnter = () => handlersRef.current.onTriggerPointerEnter();\n const onPointerLeave = () => handlersRef.current.onTriggerPointerLeave();\n const onFocus = () => handlersRef.current.onFocus();\n const onBlur = () => handlersRef.current.onBlur();\n const onKeyDown = (e: KeyboardEvent) => handlersRef.current.onKeyDown(e);\n\n trigger.addEventListener('pointerenter', onPointerEnter);\n trigger.addEventListener('pointerleave', onPointerLeave);\n trigger.addEventListener('focus', onFocus);\n trigger.addEventListener('blur', onBlur);\n trigger.addEventListener('keydown', onKeyDown);\n\n return () => {\n trigger.removeEventListener('pointerenter', onPointerEnter);\n trigger.removeEventListener('pointerleave', onPointerLeave);\n trigger.removeEventListener('focus', onFocus);\n trigger.removeEventListener('blur', onBlur);\n trigger.removeEventListener('keydown', onKeyDown);\n };\n }, [anchorElement, disabled]);\n\n React.useEffect(() => {\n if (!openState) return;\n\n const onPointerDown = (e: PointerEvent) => handlersRef.current.onDocumentPointerDown(e);\n\n document.addEventListener('pointerdown', onPointerDown);\n\n return () => {\n document.removeEventListener('pointerdown', onPointerDown);\n };\n }, [openState]);\n\n React.useEffect(() => {\n const positioner = positionerRef.current;\n\n if (!positioner || !openState || !interactive) return;\n\n const onPointerEnter = () => {\n isOverPositionerRef.current = true;\n\n if (closeDelayTimerRef.current) {\n clearTimeout(closeDelayTimerRef.current);\n closeDelayTimerRef.current = null;\n }\n };\n\n const onPointerLeave = () => handlersRef.current.onPositionerPointerLeave();\n\n positioner.addEventListener('pointerenter', onPointerEnter);\n positioner.addEventListener('pointerleave', onPointerLeave);\n\n return () => {\n positioner.removeEventListener('pointerenter', onPointerEnter);\n positioner.removeEventListener('pointerleave', onPointerLeave);\n isOverPositionerRef.current = false;\n };\n }, [positionerElement, openState, interactive]);\n\n React.useEffect(() => {\n if (openState && tooltipManager) {\n tooltipManager.notifyOpen(tooltipId, () => forceCloseRef.current());\n }\n }, [openState]);\n\n React.useEffect(() => {\n return () => clearTimers();\n }, []);\n\n const state = {\n open: openState,\n rendered,\n anchorElement,\n positionerElement,\n popupElement,\n arrowElement,\n instantType\n };\n\n // prop getters\n const rootProps = {\n ...(instantType && { 'data-instant': instantType })\n };\n\n const triggerProps = {\n 'data-scope': 'tooltip' as const,\n 'data-part': 'trigger' as const,\n ref: setAnchorRef,\n ...(openState && { 'data-popup-open': '' as const })\n };\n\n const positionerProps = {\n 'data-scope': 'tooltip' as const,\n 'data-part': 'positioner' as const,\n ref: setPositionerRef,\n ...(openState && { 'data-open': '' as const })\n };\n\n const popupProps = {\n 'data-scope': 'tooltip' as const,\n 'data-part': 'popup' as const,\n ref: setPopupRef,\n ...(openState && { 'data-open': '' as const }),\n ...(instantType && { 'data-instant': '' as const }),\n 'data-instant-type': instantType\n };\n\n const arrowProps = {\n 'data-scope': 'tooltip' as const,\n 'data-part': 'arrow' as const,\n ref: setArrowRef,\n ...(openState && { 'data-open': '' as const }),\n ...(instantType && { 'data-instant': instantType })\n };\n\n return {\n state,\n popupRef,\n // prop getters\n rootProps,\n triggerProps,\n positionerProps,\n popupProps,\n arrowProps,\n // methods\n setRendered,\n onOpenComplete,\n onCloseComplete\n };\n }\n});\n","import type { UseTooltipProps } from '@primereact/types/headless/tooltip';\n\nexport const defaultProps: UseTooltipProps = {\n anchor: undefined,\n open: undefined,\n defaultOpen: false,\n onOpenChange: undefined,\n onExitComplete: undefined,\n disabled: false,\n openDelay: 600,\n closeDelay: 100,\n interactive: true,\n tooltipManager: undefined\n};\n"],"mappings":"ubAAA,OAAS,gBAAAA,OAAoB,4BAC7B,OAAS,sBAAAC,OAA0B,yCAEnC,UAAYC,MAAW,QCDhB,IAAMC,GAAgC,CACzC,OAAQ,OACR,KAAM,OACN,YAAa,GACb,aAAc,OACd,eAAgB,OAChB,SAAU,GACV,UAAW,IACX,WAAY,IACZ,YAAa,GACb,eAAgB,MACpB,EDPO,IAAMC,GAAaC,GAAa,CACnC,KAAM,aACN,aAAAC,GACA,MAAO,CAAC,CAAE,MAAAC,CAAM,IAAM,CAT1B,IAAAC,EAUQ,GAAM,CAAE,eAAAC,EAAgB,UAAAC,EAAY,IAAK,WAAAC,EAAa,EAAG,YAAAC,EAAc,GAAM,SAAAC,CAAS,EAAIN,EAEpF,CAACO,EAAWC,EAAY,EAAIC,GAAmB,CACjD,MAAOT,EAAM,KACb,aAAcA,EAAM,YACpB,SAAUA,EAAM,YACpB,CAAC,EAEK,CAACU,EAAeC,CAAgB,EAAU,YAA6BV,EAAAD,EAAM,SAAN,KAAAC,EAAgB,IAAI,EAC3F,CAACW,EAAmBC,EAAoB,EAAU,WAAgC,IAAI,EACtF,CAACC,GAAcC,EAAe,EAAU,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1C,IACD7B,GAAa,CAAE,YAAa,EAAY,GACxCW,GAAe,CAAE,eAAgB,EAAY,GALlC,CAMf,oBAAqBA,CACzB,GAEMiE,GAAaL,IAAA,CACf,aAAc,UACd,YAAa,QACb,IAAK3C,IACD5B,GAAa,CAAE,YAAa,EAAY,GACxCW,GAAe,CAAE,eAAgBA,CAAY,GAGrD,MAAO,CACH,MAAA0D,GACA,SAAAnD,EAEA,UAAAoD,GACA,aAAAE,GACA,gBAAAC,GACA,WAAAC,GACA,WAAAE,GAEA,YAAA9D,EACA,eAAAgB,GACA,gBAAAC,EACJ,CACJ,CACJ,CAAC","names":["withHeadless","useControlledState","React","defaultProps","useTooltip","withHeadless","defaultProps","props","_a","tooltipManager","openDelay","closeDelay","interactive","disabled","openState","setOpenState","useControlledState","anchorElement","setAnchorElement","positionerElement","setPositionerElement","popupElement","setPopupElement","arrowElement","setArrowElement","instantType","setInstantType","rendered","setRendered","tooltipId","anchorRef","positionerRef","popupRef","arrowRef","openDelayTimerRef","closeDelayTimerRef","isOverPositionerRef","suppressFocusRef","openStateRef","setAnchorRef","node","setPositionerRef","setArrowRef","setPopupRef","onOpenComplete","onCloseComplete","clearTimers","setOpen","open","originalEvent","forceCloseRef","openTooltip","delay","instant","_b","_c","_d","_e","_f","_g","isInstantPhase","lastClosedId","currentOpenId","managerOpenDelay","isGroupTransition","isSameTooltipReentry","shouldBeInstant","effectiveDelay","closeTooltip","managerCloseDelay","handlersRef","_event","event","effectiveCloseDelay","trigger","onPointerEnter","onPointerLeave","onFocus","onBlur","onKeyDown","e","onPointerDown","positioner","state","rootProps","__spreadValues","triggerProps","positionerProps","popupProps","__spreadProps","arrowProps"]}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/tooltipmanager/useTooltipManager.ts","../../src/tooltipmanager/useTooltipManager.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport * as React from 'react';\nimport { defaultProps } from './useTooltipManager.props';\n\nexport const useTooltipManager = withHeadless({\n name: 'useTooltipManager',\n defaultProps,\n setup: ({ props }) => {\n const { openDelay, closeDelay, timeout = 400 } = props;\n const timeoutRef = React.useRef<number | null>(null);\n const currentCloseRef = React.useRef<(() => void) | null>(null);\n\n // Use a mutable ref object for state so that reads from event handlers\n // always see the latest values without waiting for a React re-render.\n const stateRef = React.useRef({\n isInstantPhase: false,\n lastClosedTooltipId: null as string | null,\n currentOpenTooltipId: null as string | null,\n openDelay,\n closeDelay\n });\n\n // Keep prop-derived values in sync\n stateRef.current.openDelay = openDelay;\n stateRef.current.closeDelay = closeDelay;\n\n const notifyOpen = React.useCallback((tooltipId: string, closeFn: () => void) => {\n stateRef.current.currentOpenTooltipId = tooltipId;\n currentCloseRef.current = closeFn;\n\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n }, []);\n\n const notifyClose = React.useCallback(\n (tooltipId: string) => {\n if (stateRef.current.currentOpenTooltipId === tooltipId) {\n stateRef.current.currentOpenTooltipId = null;\n }\n\n currentCloseRef.current = null;\n stateRef.current.lastClosedTooltipId = tooltipId;\n stateRef.current.isInstantPhase = true;\n\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n\n timeoutRef.current = window.setTimeout(() => {\n stateRef.current.isInstantPhase = false;\n stateRef.current.lastClosedTooltipId = null;\n timeoutRef.current = null;\n }, timeout);\n },\n [timeout]\n );\n\n const closeCurrentTooltip = React.useCallback(() => {\n currentCloseRef.current?.();\n currentCloseRef.current = null;\n }, []);\n\n React.useEffect(() => {\n return () => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n };\n }, []);\n\n return {\n state: stateRef.current,\n notifyOpen,\n notifyClose,\n closeCurrentTooltip\n };\n }\n});\n","import type { UseTooltipManagerProps } from '@primereact/types/headless/tooltip';\n\nexport const defaultProps: UseTooltipManagerProps = {\n openDelay: undefined,\n closeDelay: undefined,\n timeout: 400\n};\n"],"mappings":"AAAA,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,EAAW,OAAO,CAEvC,EACD,CAAC,CAAC,EAEE,CACH,MAAOE,EAAS,QAChB,WAAAC,EACA,YAAAG,EACA,oBAAAC,CACJ,CACJ,CACJ,CAAC","names":["withHeadless","React","defaultProps","useTooltipManager","withHeadless","defaultProps","props","openDelay","closeDelay","timeout","timeoutRef","currentCloseRef","stateRef","notifyOpen","tooltipId","closeFn","notifyClose","closeCurrentTooltip","_a"]}
|
|
File without changes
|
package/tree/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/tree/useTree.ts","../../src/tree/useTree.props.ts","../../src/tree/useTreeDragDrop.ts","../../src/tree/TreeDragDropService.ts","../../src/tree/useTreeFlatten.ts","../../src/tree/useTreeKeyboard.ts","../../src/tree/useTreeSelection.ts","../../src/tree/useTreeNode.ts","../../src/tree/useTreeNode.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { useControlledState } from '@primereact/hooks/use-controlled-state';\nimport type { TreeExpandedKeys, TreeNodeData, UseTreeFocusedKeyChangeEvent } from '@primereact/types/headless/tree';\nimport * as React from 'react';\nimport { defaultProps } from './useTree.props';\nimport { useTreeRootDragDrop } from './useTreeDragDrop';\nimport { useTreeNodeMap, useTreeVisibleKeys } from './useTreeFlatten';\nimport { useTreeKeyboard } from './useTreeKeyboard';\nimport { useTreeSelection } from './useTreeSelection';\n\nexport const useTree = withHeadless({\n name: 'useTree',\n defaultProps,\n setup({ props, elementRef, id }) {\n const defaultExpandedKeyRef = React.useRef(props.defaultExpandedKeys ?? {});\n const [expandedKeyState, setExpandedKeyState] = useControlledState({\n value: props.expandedKeys,\n defaultValue: defaultExpandedKeyRef.current,\n onChange: props.onExpandedChange\n });\n\n const defaultSelectedKeyRef = React.useRef(props.defaultSelectionKeys ?? {});\n const [selectedKeyState, setSelectedKeyState] = useControlledState({\n value: props.selectionKeys,\n defaultValue: defaultSelectedKeyRef.current,\n onChange: props.onSelectionChange\n });\n\n const [focusedKeyState, setFocusedKeyState] = React.useState<string | null>(null);\n const [dragHoverState, setDragHoverState] = React.useState(false);\n\n const { nodeMap, flatOrder } = useTreeNodeMap(props.value);\n const visibleKeys = useTreeVisibleKeys(props.value, expandedKeyState);\n const visibleCount = visibleKeys.length;\n\n const findNodeByKey = React.useCallback(\n (key: string): TreeNodeData | undefined => {\n return nodeMap.get(key)?.node;\n },\n [nodeMap]\n );\n\n const findNodeInfo = React.useCallback(\n (key: string) => {\n const entry = nodeMap.get(key);\n\n if (!entry) return { level: 1, posInSet: 1, setSize: 1, parentKey: null };\n\n return { level: entry.level, posInSet: entry.posInSet, setSize: entry.setSize, parentKey: entry.parentKey };\n },\n [nodeMap]\n );\n\n const getNodes = React.useCallback(() => props.value || [], [props.value]);\n\n React.useEffect(() => {\n if (focusedKeyState === null && visibleKeys.length > 0) {\n setFocusedKeyState(visibleKeys[0]);\n } else if (focusedKeyState && !nodeMap.has(focusedKeyState)) {\n setFocusedKeyState(visibleKeys[0] ?? null);\n }\n }, [visibleKeys, focusedKeyState, nodeMap]);\n\n const setFocusedKey = React.useCallback(\n (key: string | null) => {\n setFocusedKeyState(key);\n props.onFocusedKeyChange?.({ value: key } as UseTreeFocusedKeyChangeEvent);\n },\n [props]\n );\n\n const visibleKeysRef = React.useRef(visibleKeys);\n\n visibleKeysRef.current = visibleKeys;\n\n const getVisibleKeys = React.useCallback(() => visibleKeysRef.current, []);\n\n const selection = useTreeSelection({\n props,\n selectedKeyState,\n setSelectedKeyState,\n getNodes,\n getVisibleKeys\n });\n\n const onNodeToggle = (event: React.SyntheticEvent, node: TreeNodeData) => {\n if (node.disabled === true) return;\n\n const currentKeys = (expandedKeyState || {}) as TreeExpandedKeys;\n const nodeKey = node.key;\n let newValue: TreeExpandedKeys;\n\n if (currentKeys[nodeKey]) {\n newValue = { ...currentKeys };\n delete newValue[nodeKey];\n\n props.onCollapse?.({ originalEvent: event, node });\n props.onToggle?.({ originalEvent: event, node });\n } else {\n newValue = { ...currentKeys, [nodeKey]: true };\n\n props.onExpand?.({ originalEvent: event, node });\n props.onToggle?.({ originalEvent: event, node });\n }\n\n setExpandedKeyState([newValue, { originalEvent: event, value: newValue }]);\n };\n\n const keyboard = useTreeKeyboard({\n props,\n elementRef: elementRef as React.RefObject<HTMLElement | null>,\n visibleKeys,\n findNodeByKey,\n onNodeToggle,\n onClick: selection.onClick,\n setFocusedKey\n });\n\n const dragDrop = useTreeRootDragDrop({ props, setDragHoverState, getNodes });\n\n const state = {\n expandedKey: expandedKeyState,\n selectedKey: selectedKeyState,\n focusedKey: focusedKeyState,\n dragHover: dragHoverState\n };\n\n const rootProps = {\n id,\n 'data-scope': 'tree' as const,\n 'data-part': 'root' as const,\n ...(dragHoverState && { 'data-dragover': '' as const }),\n onDragOver: dragDrop.onDragOver,\n onDragEnter: dragDrop.onDragEnter,\n onDragLeave: dragDrop.onDragLeave,\n onDrop: dragDrop.onDrop\n };\n\n const filterProps = {\n 'data-scope': 'tree' as const,\n 'data-part': 'filter' as const,\n autoComplete: 'off' as const,\n onKeyUp: keyboard.onFilterKeyUp\n };\n\n const loadingProps = {\n 'data-scope': 'tree' as const,\n 'data-part': 'loading' as const,\n role: 'status' as const,\n 'aria-live': 'polite' as const\n };\n\n const getToggleProps = React.useCallback(\n (node: TreeNodeData) => {\n const nodeKey = node?.key;\n const expanded = nodeKey ? ((expandedKeyState || {}) as TreeExpandedKeys)[nodeKey] === true : false;\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n onNodeToggle(event, node);\n };\n\n return {\n 'data-scope': 'tree' as const,\n 'data-part': 'toggle' as const,\n [expanded ? 'data-expanded' : 'data-collapsed']: '',\n type: 'button' as const,\n tabIndex: -1 as const,\n onClick: handleClick\n };\n },\n [expandedKeyState]\n );\n\n const getToggleSpacerProps = React.useCallback(\n () => ({\n 'data-scope': 'tree' as const,\n 'data-part': 'toggle-spacer' as const,\n 'aria-hidden': true as const\n }),\n []\n );\n\n const getToggleIndicatorProps = React.useCallback(\n () => ({\n 'data-scope': 'tree' as const,\n 'data-part': 'toggle-indicator' as const,\n 'aria-hidden': true as const\n }),\n []\n );\n\n const getNodeProps = React.useCallback(\n (node: TreeNodeData, level: number, expanded: boolean, checked: boolean, selected: boolean, leaf: boolean, posInSet: number, setSize: number) => {\n const isFocused = focusedKeyState === node?.key;\n const handleKeyDown = (event: React.KeyboardEvent) => keyboard.onKeyDown(event, node, level, expanded, leaf);\n\n const isCheckbox = props.selectionMode === 'checkbox';\n\n return {\n role: 'treeitem' as const,\n tabIndex: isFocused ? 0 : -1,\n 'aria-level': level,\n 'aria-setsize': setSize,\n 'aria-posinset': posInSet,\n 'aria-expanded': leaf ? undefined : expanded,\n 'aria-selected': props.selectionMode === 'single' || props.selectionMode === 'multiple' ? !!selected : undefined,\n 'aria-checked': isCheckbox ? checked : undefined,\n 'data-scope': 'tree' as const,\n 'data-part': 'node' as const,\n 'data-node-key': node?.key,\n ...(!leaf && { [expanded ? 'data-expanded' : 'data-collapsed']: '' as const }),\n ...((isCheckbox ? checked : selected) && { 'data-selected': '' as const }),\n ...(leaf && { 'data-leaf': '' as const }),\n ...(node?.disabled === true && { 'data-disabled': '' as const }),\n ...(isFocused && { 'data-focused': '' as const }),\n onKeyDown: handleKeyDown\n };\n },\n [keyboard, props.selectionMode, focusedKeyState]\n );\n\n const getNodesProps = React.useCallback(() => {\n return {\n 'data-scope': 'tree' as const,\n 'data-part': 'nodes' as const,\n role: 'tree' as const\n };\n }, []);\n\n return {\n state,\n nodeMap,\n flatOrder,\n visibleKeys,\n visibleCount,\n findNodeByKey,\n findNodeInfo,\n getNodes,\n setFocusedKey,\n setSelectionKeys: selection.setSelectionKeys,\n onKeyDown: keyboard.onKeyDown,\n onNodeToggle,\n onNodeClick: selection.onNodeClick,\n onClick: selection.onClick,\n onCheckboxChange: selection.onCheckboxChange,\n isNodeSelected: selection.isNodeSelected,\n selection: {\n isSelected: selection.isSelected,\n isPartiallySelected: selection.isPartiallySelected,\n isAllSelected: selection.isAllSelected,\n isSomeSelected: selection.isSomeSelected,\n toggleSelection: selection.toggleSelection,\n toggleAll: selection.toggleAll\n },\n onFilterKeyUp: keyboard.onFilterKeyUp,\n onDragOver: dragDrop.onDragOver,\n onDragEnter: dragDrop.onDragEnter,\n onDragLeave: dragDrop.onDragLeave,\n onDrop: dragDrop.onDrop,\n allowDrop: dragDrop.allowDrop,\n rootProps,\n getToggleProps,\n getToggleSpacerProps,\n getToggleIndicatorProps,\n getNodeProps,\n filterProps,\n loadingProps,\n getNodesProps\n };\n }\n});\n","import type { UseTreeProps } from '@primereact/types/headless/tree';\n\nexport const defaultProps: UseTreeProps = {\n value: undefined,\n expandedKeys: undefined,\n defaultExpandedKeys: undefined,\n selectionKeys: undefined,\n defaultSelectionKeys: undefined,\n selectionMode: undefined,\n metaKeySelection: false,\n highlightOnSelect: false,\n draggable: undefined,\n droppable: undefined,\n draggableScope: undefined,\n droppableScope: undefined,\n onExpandedChange: undefined,\n onSelectionChange: undefined,\n onToggle: undefined,\n onExpand: undefined,\n onCollapse: undefined,\n onClick: undefined,\n onSelect: undefined,\n onUnselect: undefined,\n onMove: undefined,\n validateMove: undefined,\n onFocusedKeyChange: undefined,\n loading: false\n};\n","import type { TreeDropPosition, TreeNodeData, UseTreeMoveEvent, UseTreeProps } from '@primereact/types/headless/tree';\nimport * as React from 'react';\nimport { TreeDragDropService } from './TreeDragDropService';\n\nfunction rootContainsKey(node: TreeNodeData, key: string): boolean {\n if (node.key === key) return true;\n if (!node.children || node.children.length === 0) return false;\n\n for (const child of node.children) {\n if (rootContainsKey(child, key)) return true;\n }\n\n return false;\n}\n\nexport interface UseTreeDragDropDeps {\n props: UseTreeProps;\n setDragHoverState: (hover: boolean) => void;\n getNodes: () => TreeNodeData[];\n}\n\n/**\n * Root-level drag/drop handlers. Per-node logic lives in `useTreeNode`.\n * Commits a drop through a single `onMove` event; `validateMove` may return a\n * Promise and the move only fires when it resolves truthy.\n */\nexport function useTreeRootDragDrop({ props, setDragHoverState, getNodes }: UseTreeDragDropDeps) {\n React.useEffect(() => {\n if (!props.droppable) return;\n\n const cleanup = TreeDragDropService.onDragStop(() => {\n setDragHoverState(false);\n });\n\n return () => {\n cleanup();\n };\n }, [props.droppable, setDragHoverState]);\n\n const allowDrop = React.useCallback(\n (dropNode?: TreeNodeData) => {\n const { dragNode, dragScope } = TreeDragDropService.getDragState();\n\n if (!dragNode) return false;\n\n if (!isValidDragScope(dragScope, props.droppableScope)) return false;\n\n if (dropNode && dragNode === dropNode) return false;\n\n return true;\n },\n [props.droppableScope]\n );\n\n const onDragOver = (event: React.DragEvent) => {\n if (props.droppable && allowDrop()) {\n event.dataTransfer.dropEffect = 'copy';\n } else {\n event.dataTransfer.dropEffect = 'none';\n }\n\n event.preventDefault();\n };\n\n const onDragEnter = (_event: React.DragEvent) => {\n if (props.droppable && allowDrop()) {\n setDragHoverState(true);\n }\n };\n\n const onDragLeave = (event: React.DragEvent) => {\n if (!props.droppable) return;\n\n const rect = (event.currentTarget as HTMLElement).getBoundingClientRect();\n if (event.clientX >= rect.right || event.clientX <= rect.left || event.clientY >= rect.bottom || event.clientY <= rect.top) {\n setDragHoverState(false);\n }\n };\n\n const commitRootDrop = (event: React.DragEvent, dragNode: TreeNodeData, _dragNodeIndex: number) => {\n const { sourceCommit } = TreeDragDropService.getDragState();\n const currentNodes = props.value || [];\n const sourceIsThisTree = currentNodes.some((root) => rootContainsKey(root, dragNode.key));\n\n const newValue = [...currentNodes, dragNode];\n\n const moveEvent: UseTreeMoveEvent = {\n originalEvent: event,\n value: newValue,\n dragNode,\n dropNode: null,\n dropIndex: newValue.length - 1,\n dropPosition: 'inside'\n };\n\n const fire = () => {\n props.onMove?.(moveEvent);\n if (sourceCommit && !sourceIsThisTree) sourceCommit(event);\n TreeDragDropService.stopDrag({ node: dragNode });\n };\n\n if (props.validateMove) {\n const result = props.validateMove(moveEvent);\n\n if (result instanceof Promise) {\n result.then((ok) => {\n if (ok) fire();\n else TreeDragDropService.stopDrag({ node: dragNode });\n });\n\n return;\n }\n\n if (!result) {\n TreeDragDropService.stopDrag({ node: dragNode });\n return;\n }\n }\n\n fire();\n };\n\n const onDrop = (event: React.DragEvent) => {\n if (!props.droppable) {\n setDragHoverState(false);\n return;\n }\n\n event.preventDefault();\n const { dragNode, dragScope, dragNodeIndex } = TreeDragDropService.getDragState();\n\n if (dragNode && allowDrop()) {\n if (isSameTreeScope(dragScope, props.draggableScope)) {\n TreeDragDropService.stopDrag({ node: dragNode });\n setDragHoverState(false);\n return;\n }\n\n if (dragNodeIndex !== null) {\n commitRootDrop(event, dragNode, dragNodeIndex);\n }\n }\n\n setDragHoverState(false);\n };\n\n return { allowDrop, onDragOver, onDragEnter, onDragLeave, onDrop };\n}\n\nfunction hasCommonScope(a: string | string[] | null | undefined, b: string | string[] | null | undefined): boolean {\n if (a == null && b == null) return true;\n if (a == null || b == null) return false;\n\n if (typeof b === 'string') {\n if (typeof a === 'string') return a === b;\n if (Array.isArray(a)) return a.indexOf(b) !== -1;\n } else if (Array.isArray(b)) {\n if (typeof a === 'string') return b.indexOf(a) !== -1;\n if (Array.isArray(a)) {\n for (const item of a) {\n if (b.indexOf(item) !== -1) return true;\n }\n\n return false;\n }\n }\n\n return false;\n}\n\nfunction isValidDragScope(dragScope: string | string[] | null | undefined, droppableScope: string | string[] | null | undefined): boolean {\n if (droppableScope == null) return true;\n return hasCommonScope(dragScope, droppableScope);\n}\n\nfunction isSameTreeScope(dragScope: string | string[] | null | undefined, draggableScope: string | string[] | null | undefined): boolean {\n return hasCommonScope(dragScope, draggableScope);\n}\n\n/**\n * Build a `UseTreeMoveEvent` for a node-level drop (with explicit position).\n * Re-used by `useTreeNode` when committing a drop on a non-root target.\n */\nexport function buildMoveEvent(originalEvent: React.DragEvent, value: TreeNodeData[], dragNode: TreeNodeData, dropNode: TreeNodeData, dropIndex: number, dropPosition: TreeDropPosition): UseTreeMoveEvent {\n return { originalEvent, value, dragNode, dropNode, dropIndex, dropPosition };\n}\n","import type { TreeNodeData } from '@primereact/types/headless/tree';\n\n/**\n * Registered by the source tree at `startDrag`; the destination invokes it on a\n * committed drop so the source can drop the node and fire its `onMove`.\n */\nexport type SourceCommitHandler = (originalEvent: React.DragEvent) => void;\n\ntype DragState = {\n isDragging: boolean;\n dragNode: TreeNodeData | null;\n dragScope: string | string[] | null;\n dragNodeSubNodes: TreeNodeData[] | null;\n dragNodeIndex: number | null;\n sourceTreeId: string | null;\n /** Source-tree commit hook. Invoked by the destination tree on a successful drop. */\n sourceCommit: SourceCommitHandler | null;\n};\n\ntype DragEvent = {\n node: TreeNodeData;\n scope?: string | string[] | null;\n subNodes?: TreeNodeData[];\n index?: number;\n sourceTreeId?: string;\n sourceCommit?: SourceCommitHandler;\n};\n\nconst dragState: DragState = {\n isDragging: false,\n dragNode: null,\n dragScope: null,\n dragNodeSubNodes: null,\n dragNodeIndex: null,\n sourceTreeId: null,\n sourceCommit: null\n};\n\nconst dragStartHandlers = new Set<(event: DragEvent) => void>();\nconst dragStopHandlers = new Set<(event: DragEvent) => void>();\n\nexport const TreeDragDropService = {\n getDragState() {\n return dragState;\n },\n\n startDrag(event: DragEvent) {\n dragState.isDragging = true;\n dragState.dragNode = event.node;\n dragState.dragScope = event.scope ?? null;\n dragState.dragNodeSubNodes = event.subNodes ?? null;\n dragState.dragNodeIndex = event.index ?? null;\n dragState.sourceTreeId = event.sourceTreeId ?? null;\n dragState.sourceCommit = event.sourceCommit ?? null;\n\n dragStartHandlers.forEach((handler) => handler(event));\n },\n\n stopDrag(event: DragEvent) {\n dragState.isDragging = false;\n dragState.dragNode = null;\n dragState.dragScope = null;\n dragState.dragNodeSubNodes = null;\n dragState.dragNodeIndex = null;\n dragState.sourceTreeId = null;\n dragState.sourceCommit = null;\n\n dragStopHandlers.forEach((handler) => handler(event));\n },\n\n onDragStart(handler: (event: DragEvent) => void) {\n dragStartHandlers.add(handler);\n\n return () => dragStartHandlers.delete(handler);\n },\n\n onDragStop(handler: (event: DragEvent) => void) {\n dragStopHandlers.add(handler);\n\n return () => dragStopHandlers.delete(handler);\n }\n};\n","import type { TreeExpandedKeys, TreeNodeData, TreeNodeEntry } from '@primereact/types/headless/tree';\nimport * as React from 'react';\n\n/**\n * Builds `nodeMap` (key → entry for O(1) lookup) and `flatOrder` (DFS keys).\n * Memoized on `value` reference.\n */\nexport function useTreeNodeMap(value: TreeNodeData[] | undefined) {\n return React.useMemo(() => {\n const map = new Map<string, TreeNodeEntry>();\n const flat: string[] = [];\n\n const walk = (nodes: TreeNodeData[], parentKey: string | null, level: number) => {\n for (let i = 0; i < nodes.length; i++) {\n const n = nodes[i];\n\n map.set(n.key, { node: n, parentKey, level, posInSet: i + 1, setSize: nodes.length });\n flat.push(n.key);\n\n if (n.children?.length) {\n walk(n.children, n.key, level + 1);\n }\n }\n };\n\n walk(value ?? [], null, 1);\n\n return { nodeMap: map, flatOrder: flat };\n }, [value]);\n}\n\n/**\n * DFS keys of the rows that are currently visible (ancestors all expanded).\n */\nexport function useTreeVisibleKeys(value: TreeNodeData[] | undefined, expandedKey: TreeExpandedKeys | undefined): string[] {\n return React.useMemo(() => {\n const result: string[] = [];\n const expanded = (expandedKey ?? {}) as TreeExpandedKeys;\n\n const walk = (nodes: TreeNodeData[]) => {\n for (const n of nodes) {\n result.push(n.key);\n if (expanded[n.key] === true && n.children?.length) {\n walk(n.children);\n }\n }\n };\n\n walk(value ?? []);\n\n return result;\n }, [value, expandedKey]);\n}\n","import type { TreeNodeData, UseTreeProps } from '@primereact/types/headless/tree';\nimport { focus, isPrintableCharacter } from '@primeuix/utils';\nimport * as React from 'react';\n\nexport interface UseTreeKeyboardDeps {\n props: UseTreeProps;\n elementRef: React.RefObject<HTMLElement | null>;\n visibleKeys: string[];\n findNodeByKey: (key: string) => TreeNodeData | undefined;\n onNodeToggle: (event: React.SyntheticEvent, node: TreeNodeData) => void;\n onClick: (event: React.MouseEvent | React.KeyboardEvent, node: TreeNodeData, nodeTouched?: boolean) => void;\n setFocusedKey: (key: string | null) => void;\n}\n\nconst TYPE_AHEAD_TIMEOUT = 500;\n\n/**\n * Keyboard navigation across `visibleKeys` plus printable-character type-ahead.\n */\nexport function useTreeKeyboard({ props, elementRef, visibleKeys, findNodeByKey, onNodeToggle, onClick, setFocusedKey }: UseTreeKeyboardDeps) {\n const searchTimeout = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n const searchValue = React.useRef<string>('');\n\n React.useEffect(() => {\n return () => {\n if (searchTimeout.current) {\n clearTimeout(searchTimeout.current);\n searchTimeout.current = null;\n }\n };\n }, []);\n\n const focusNodeElement = (key: string) => {\n if (!elementRef.current) return;\n\n const el = elementRef.current.querySelector(`[role=\"treeitem\"][data-node-key=\"${CSS.escape(key)}\"]`) as HTMLElement | null;\n if (!el) return;\n\n const allItems = elementRef.current.querySelectorAll<HTMLElement>('[role=\"treeitem\"]');\n allItems.forEach((item) => {\n item.tabIndex = -1;\n });\n el.tabIndex = 0;\n focus(el);\n };\n\n const navigateToIndex = (idx: number, fallbackKey?: string) => {\n const key = visibleKeys[idx] ?? fallbackKey ?? null;\n if (!key) return;\n\n setFocusedKey(key);\n focusNodeElement(key);\n };\n\n const navigateNext = (currentKey: string) => {\n const idx = visibleKeys.indexOf(currentKey);\n if (idx === -1 || idx >= visibleKeys.length - 1) return;\n navigateToIndex(idx + 1);\n };\n\n const navigatePrev = (currentKey: string) => {\n const idx = visibleKeys.indexOf(currentKey);\n if (idx <= 0) return;\n navigateToIndex(idx - 1);\n };\n\n const navigateFirst = () => {\n if (visibleKeys.length > 0) navigateToIndex(0);\n };\n\n const navigateLast = () => {\n if (visibleKeys.length > 0) navigateToIndex(visibleKeys.length - 1);\n };\n\n const searchNodes = (char: string, currentNode: TreeNodeData) => {\n searchValue.current = (searchValue.current || '') + char;\n\n if (searchTimeout.current) {\n clearTimeout(searchTimeout.current);\n }\n\n if (!elementRef.current) {\n searchTimeout.current = setTimeout(() => {\n searchValue.current = '';\n searchTimeout.current = null;\n }, TYPE_AHEAD_TIMEOUT);\n return;\n }\n\n const allTreeItems = Array.from(elementRef.current.querySelectorAll<HTMLElement>('[role=\"treeitem\"]'));\n const currentElement = allTreeItems.find((item) => item.getAttribute('data-node-key') === currentNode.key);\n\n if (!currentElement) {\n searchTimeout.current = setTimeout(() => {\n searchValue.current = '';\n searchTimeout.current = null;\n }, TYPE_AHEAD_TIMEOUT);\n return;\n }\n\n const currentIndex = allTreeItems.indexOf(currentElement);\n const searchLower = searchValue.current.toLowerCase();\n let matched: HTMLElement | null = null;\n\n for (let i = currentIndex + 1; i < allTreeItems.length; i++) {\n const item = allTreeItems[i];\n const label = item.textContent?.trim().toLowerCase() || '';\n if (label.startsWith(searchLower)) {\n matched = item;\n break;\n }\n }\n\n if (!matched) {\n for (let i = 0; i <= currentIndex; i++) {\n const item = allTreeItems[i];\n const label = item.textContent?.trim().toLowerCase() || '';\n if (label.startsWith(searchLower)) {\n matched = item;\n break;\n }\n }\n }\n\n if (matched && matched !== currentElement) {\n const key = matched.getAttribute('data-node-key');\n if (key) {\n setFocusedKey(key);\n allTreeItems.forEach((item) => {\n item.tabIndex = -1;\n });\n matched.tabIndex = 0;\n focus(matched);\n }\n }\n\n searchTimeout.current = setTimeout(() => {\n searchValue.current = '';\n searchTimeout.current = null;\n }, TYPE_AHEAD_TIMEOUT);\n };\n\n const onKeyDown = (event: React.KeyboardEvent, node: TreeNodeData, _level: number, expanded: boolean, leaf: boolean) => {\n const target = event.target as HTMLElement;\n const currentTarget = event.currentTarget as HTMLElement;\n\n // Only handle when the focused row is this treeitem\n if (!currentTarget || (!currentTarget.isSameNode(target) && !currentTarget.isSameNode(target.closest('[role=\"treeitem\"]') as Node | null))) {\n return;\n }\n\n const metaKey = event.metaKey || event.ctrlKey;\n\n switch (event.code) {\n case 'ArrowDown':\n event.preventDefault();\n navigateNext(node.key);\n break;\n\n case 'ArrowUp':\n event.preventDefault();\n navigatePrev(node.key);\n break;\n\n case 'ArrowRight':\n event.preventDefault();\n if (!leaf && !expanded) {\n onNodeToggle(event, node);\n } else if (!leaf && expanded) {\n // Step into first child (next visible row)\n navigateNext(node.key);\n }\n break;\n\n case 'ArrowLeft':\n event.preventDefault();\n if (!leaf && expanded) {\n onNodeToggle(event, node);\n } else {\n // Step out to parent\n const idx = visibleKeys.indexOf(node.key);\n for (let i = idx - 1; i >= 0; i--) {\n const candidateKey = visibleKeys[i];\n const candidate = findNodeByKey(candidateKey);\n if (candidate?.children?.length) {\n setFocusedKey(candidateKey);\n focusNodeElement(candidateKey);\n break;\n }\n }\n }\n break;\n\n case 'Home':\n event.preventDefault();\n navigateFirst();\n break;\n\n case 'End':\n event.preventDefault();\n navigateLast();\n break;\n\n case 'Enter':\n case 'NumpadEnter':\n case 'Space':\n event.preventDefault();\n onClick(event, node, true);\n break;\n\n default:\n if (!metaKey && isPrintableCharacter(event.key)) {\n searchNodes(event.key, node);\n }\n break;\n }\n };\n\n const onFilterKeyUp = (event: React.KeyboardEvent) => {\n if (event.code === 'Enter' || event.code === 'NumpadEnter') {\n event.preventDefault();\n }\n };\n\n return { onKeyDown, onFilterKeyUp };\n}\n","import type { TreeCheckboxSelectionKeys, TreeNodeData, TreeSelectionKeys, UseTreeProps, UseTreeSelectEvent, UseTreeUnselectEvent } from '@primereact/types/headless/tree';\nimport * as React from 'react';\n\ntype SelectionSetter = (next: [TreeSelectionKeys | TreeCheckboxSelectionKeys, { originalEvent: React.SyntheticEvent; value: TreeSelectionKeys | TreeCheckboxSelectionKeys }]) => void;\n\nexport interface UseTreeSelectionDeps {\n props: UseTreeProps;\n selectedKeyState: TreeSelectionKeys | TreeCheckboxSelectionKeys | undefined;\n setSelectedKeyState: SelectionSetter;\n getNodes: () => TreeNodeData[];\n getVisibleKeys: () => string[];\n}\n\n/**\n * Selection state for single / multiple / checkbox modes, including the\n * up/down cascade used by checkbox tri-state.\n */\nexport function useTreeSelection({ props, selectedKeyState, setSelectedKeyState, getNodes, getVisibleKeys }: UseTreeSelectionDeps) {\n const isSingleSelectionMode = () => props.selectionMode === 'single';\n const isMultipleSelectionMode = () => props.selectionMode === 'multiple';\n const isCheckboxSelectionMode = () => props.selectionMode === 'checkbox';\n\n const isNodeSelected = React.useCallback(\n (node: TreeNodeData) => {\n if (!props.selectionMode || !selectedKeyState) return false;\n\n if (isCheckboxSelectionMode()) {\n const checkboxKeys = selectedKeyState as TreeCheckboxSelectionKeys;\n return checkboxKeys[node.key]?.checked === true;\n }\n\n const keys = selectedKeyState as TreeSelectionKeys;\n return keys[node.key] === true;\n },\n [props.selectionMode, selectedKeyState]\n );\n\n const fireSelect = (event: React.SyntheticEvent, node: TreeNodeData) => {\n props.onSelect?.({ originalEvent: event, node } as UseTreeSelectEvent);\n };\n\n const fireUnselect = (event: React.SyntheticEvent, node: TreeNodeData) => {\n props.onUnselect?.({ originalEvent: event, node } as UseTreeUnselectEvent);\n };\n\n const handleSelectionWithMetaKey = (event: React.MouseEvent | React.KeyboardEvent, node: TreeNodeData): TreeSelectionKeys => {\n const metaKey = (event as React.MouseEvent).metaKey || (event as React.KeyboardEvent).ctrlKey;\n const selected = isNodeSelected(node);\n const currentSelection = (selectedKeyState || {}) as TreeSelectionKeys;\n let _selectionKeys: TreeSelectionKeys = {};\n\n if (selected && metaKey) {\n if (isSingleSelectionMode()) {\n _selectionKeys = {};\n } else {\n _selectionKeys = { ...currentSelection };\n delete _selectionKeys[node.key];\n }\n\n fireUnselect(event, node);\n } else {\n if (isSingleSelectionMode()) {\n _selectionKeys = {};\n } else if (isMultipleSelectionMode()) {\n _selectionKeys = !metaKey ? {} : { ...currentSelection };\n }\n\n _selectionKeys[node.key] = true;\n fireSelect(event, node);\n }\n\n return _selectionKeys;\n };\n\n const handleSelectionWithoutMetaKey = (event: React.MouseEvent | React.KeyboardEvent, node: TreeNodeData): TreeSelectionKeys => {\n const selected = isNodeSelected(node);\n const currentSelection = (selectedKeyState || {}) as TreeSelectionKeys;\n const nodeKey = node.key;\n let _selectionKeys: TreeSelectionKeys = {};\n\n if (isSingleSelectionMode()) {\n if (selected) {\n _selectionKeys = {};\n fireUnselect(event, node);\n } else {\n _selectionKeys = { [nodeKey]: true };\n fireSelect(event, node);\n }\n } else {\n if (selected) {\n _selectionKeys = { ...currentSelection };\n delete _selectionKeys[nodeKey];\n fireUnselect(event, node);\n } else {\n _selectionKeys = { ...currentSelection, [nodeKey]: true };\n fireSelect(event, node);\n }\n }\n\n return _selectionKeys;\n };\n\n const onNodeClick = (event: React.MouseEvent | React.KeyboardEvent, node: TreeNodeData, nodeTouched = false) => {\n if (props.selectionMode == null) return;\n if (node.disabled === true) return;\n\n const metaSelection = nodeTouched ? false : props.metaKeySelection;\n const newValue = metaSelection ? handleSelectionWithMetaKey(event, node) : handleSelectionWithoutMetaKey(event, node);\n\n setSelectedKeyState([newValue, { originalEvent: event, value: newValue }]);\n\n props.onClick?.({ originalEvent: event, node });\n };\n\n const propagateDown = (node: TreeNodeData, check: boolean, selectionKeys: TreeCheckboxSelectionKeys) => {\n if (check && node.disabled !== true) {\n selectionKeys[node.key] = { checked: true, partialChecked: false };\n } else {\n delete selectionKeys[node.key];\n }\n\n if (node.children?.length) {\n for (const child of node.children) {\n propagateDown(child, check, selectionKeys);\n }\n }\n };\n\n const propagateUp = (node: TreeNodeData, selectionKeys: TreeCheckboxSelectionKeys): TreeCheckboxSelectionKeys => {\n if (!node.children || node.children.length === 0) return selectionKeys;\n\n let checkedChildCount = 0;\n let childPartialSelected = false;\n\n for (const child of node.children) {\n if (selectionKeys[child.key]?.checked) {\n checkedChildCount++;\n } else if (selectionKeys[child.key]?.partialChecked) {\n childPartialSelected = true;\n }\n }\n\n if (checkedChildCount === node.children.length) {\n selectionKeys[node.key] = { checked: true, partialChecked: false };\n } else {\n delete selectionKeys[node.key];\n\n if (childPartialSelected || (checkedChildCount > 0 && checkedChildCount !== node.children.length)) {\n selectionKeys[node.key] = { checked: false, partialChecked: true };\n }\n }\n\n return selectionKeys;\n };\n\n const findParentNode = (nodes: TreeNodeData[], childKey: string, parent: TreeNodeData | null = null): TreeNodeData | null => {\n for (const node of nodes) {\n if (node.key === childKey) return parent;\n\n if (node.children) {\n const found = findParentNode(node.children, childKey, node);\n if (found !== null) return found;\n }\n }\n\n return null;\n };\n\n const onCheckboxChange = (event: React.SyntheticEvent, node: TreeNodeData) => {\n if (!node || node.disabled === true) return;\n\n const currentKeys = (selectedKeyState || {}) as TreeCheckboxSelectionKeys;\n const _selectionKeys = { ...currentKeys };\n const nodeKey = node.key;\n\n const isChecked = _selectionKeys[nodeKey]?.checked === true;\n const newCheckState = !isChecked;\n\n if (newCheckState) {\n fireSelect(event, node);\n } else {\n fireUnselect(event, node);\n }\n\n propagateDown(node, newCheckState, _selectionKeys);\n\n let parentNode = findParentNode(getNodes(), nodeKey);\n\n while (parentNode) {\n propagateUp(parentNode, _selectionKeys);\n parentNode = findParentNode(getNodes(), parentNode.key);\n }\n\n setSelectedKeyState([_selectionKeys, { originalEvent: event, value: _selectionKeys }]);\n };\n\n const onClick = (event: React.MouseEvent | React.KeyboardEvent, node: TreeNodeData, nodeTouched = false) => {\n if (isCheckboxSelectionMode()) {\n onCheckboxChange(event, node);\n } else {\n onNodeClick(event, node, nodeTouched);\n }\n };\n\n const setSelectionKeys = (keys: TreeSelectionKeys | TreeCheckboxSelectionKeys, event?: React.SyntheticEvent) => {\n const originalEvent = event ?? ({} as React.SyntheticEvent);\n setSelectedKeyState([keys, { originalEvent, value: keys }]);\n };\n\n const isSelected = React.useCallback(\n (key: string): boolean => {\n if (!selectedKeyState) return false;\n\n if (isCheckboxSelectionMode()) {\n return (selectedKeyState as TreeCheckboxSelectionKeys)[key]?.checked === true;\n }\n\n return (selectedKeyState as TreeSelectionKeys)[key] === true;\n },\n [props.selectionMode, selectedKeyState]\n );\n\n const isPartiallySelected = React.useCallback(\n (key: string): boolean => {\n if (!selectedKeyState || !isCheckboxSelectionMode()) return false;\n\n return (selectedKeyState as TreeCheckboxSelectionKeys)[key]?.partialChecked === true;\n },\n [props.selectionMode, selectedKeyState]\n );\n\n const selectionSummary = React.useMemo(() => {\n const visibleKeys = getVisibleKeys();\n\n if (visibleKeys.length === 0 || !selectedKeyState) {\n return { all: false, some: false };\n }\n\n let selectedCount = 0;\n\n for (const key of visibleKeys) {\n const slice = (selectedKeyState as Record<string, unknown>)[key];\n const sel = isCheckboxSelectionMode() ? (slice as { checked?: boolean } | undefined)?.checked === true : slice === true;\n\n if (sel) selectedCount++;\n }\n\n return {\n all: selectedCount === visibleKeys.length,\n some: selectedCount > 0 && selectedCount < visibleKeys.length\n };\n }, [getVisibleKeys, selectedKeyState, props.selectionMode]);\n\n const isAllSelected = React.useCallback(() => selectionSummary.all, [selectionSummary]);\n const isSomeSelected = React.useCallback(() => selectionSummary.some, [selectionSummary]);\n\n const toggleSelection = React.useCallback(\n (event: React.SyntheticEvent, key: string, mode: 'checkbox' | 'radio' | 'single') => {\n const node = getNodes().length > 0 ? findNodeByKeyInTree(getNodes(), key) : undefined;\n\n if (!node) return;\n\n if (mode === 'checkbox') {\n onCheckboxChange(event, node);\n } else if (mode === 'radio') {\n if (!isSelected(key)) {\n setSelectionKeys({ [key]: true } as TreeSelectionKeys, event);\n }\n } else {\n onNodeClick(event as React.MouseEvent | React.KeyboardEvent, node, true);\n }\n },\n [getNodes, isSelected]\n );\n\n const toggleAll = React.useCallback(\n (event: React.SyntheticEvent) => {\n const visibleKeys = getVisibleKeys();\n const allSelected = isAllSelected();\n const next: Record<string, unknown> = {};\n\n if (!allSelected) {\n for (const key of visibleKeys) {\n next[key] = isCheckboxSelectionMode() ? { checked: true, partialChecked: false } : true;\n }\n }\n\n setSelectionKeys(next as TreeSelectionKeys | TreeCheckboxSelectionKeys, event);\n },\n [getVisibleKeys, isAllSelected, props.selectionMode]\n );\n\n return {\n isNodeSelected,\n onNodeClick,\n onCheckboxChange,\n onClick,\n setSelectionKeys,\n isSelected,\n isPartiallySelected,\n isAllSelected,\n isSomeSelected,\n toggleSelection,\n toggleAll\n };\n}\n\nfunction findNodeByKeyInTree(nodes: TreeNodeData[], key: string): TreeNodeData | undefined {\n for (const node of nodes) {\n if (node.key === key) return node;\n\n if (node.children) {\n const found = findNodeByKeyInTree(node.children, key);\n\n if (found) return found;\n }\n }\n\n return undefined;\n}\n","import { withHeadless } from '@primereact/core/headless';\nimport type { TreeDropPosition, TreeNodeData as TreeNodeType } from '@primereact/types/headless/tree';\nimport { getOuterHeight, getOuterWidth } from '@primeuix/utils';\nimport * as React from 'react';\nimport { TreeDragDropService } from './TreeDragDropService';\nimport { buildMoveEvent } from './useTreeDragDrop';\nimport { defaultTreeNodeProps } from './useTreeNode.props';\n\n/** Returns true when the subtree rooted at `node` contains a node with `key`. */\nfunction containsNodeByKey(node: TreeNodeType, key: string): boolean {\n if (node.key === key) return true;\n if (!node.children || node.children.length === 0) return false;\n\n for (const child of node.children) {\n if (containsNodeByKey(child, key)) return true;\n }\n\n return false;\n}\n\nexport const useTreeNode = withHeadless({\n name: 'useTreeNode',\n defaultProps: defaultTreeNodeProps,\n setup({ props }) {\n const tree = props.context;\n const parentNode = props.parentContext;\n const node = props.node;\n const nodeKey = node?.key;\n\n const expanded = nodeKey ? tree?.state?.expandedKey?.[nodeKey] === true : false;\n const selected = node ? (tree?.isNodeSelected(node) ?? false) : false;\n const leaf = node ? (node.leaf ?? (!node.children || node.children.length === 0)) : true;\n\n let checked = false;\n let partialChecked = false;\n\n if (tree?.props.selectionMode === 'checkbox' && nodeKey && tree?.state?.selectedKey) {\n const checkboxKeys = tree.state.selectedKey as Record<string, { checked: boolean; partialChecked: boolean }>;\n checked = checkboxKeys[nodeKey]?.checked === true;\n partialChecked = checkboxKeys[nodeKey]?.partialChecked === true;\n }\n\n let level = 1;\n let posInSet = 1;\n let setSize = 1;\n\n if (tree && nodeKey) {\n const info = tree.findNodeInfo(nodeKey);\n level = info.level;\n posInSet = info.posInSet;\n setSize = info.setSize;\n } else if (props.index !== undefined) {\n const parentData = (parentNode as { node?: TreeNodeType } | null | undefined)?.node;\n const siblings = parentData ? parentData.children : tree?.getNodes();\n setSize = siblings?.length || 0;\n posInSet = props.index + 1;\n }\n\n const [nodeTouched, setNodeTouched] = React.useState(false);\n const [isPrevDropPointHovered, setIsPrevDropPointHovered] = React.useState(false);\n const [isNextDropPointHovered, setIsNextDropPointHovered] = React.useState(false);\n const [isNodeDropHovered, setIsNodeDropHovered] = React.useState(false);\n\n const parentNodeData = (parentNode as { node?: TreeNodeType } | null | undefined)?.node;\n const subNodes = parentNodeData?.children || tree?.getNodes() || [];\n\n const isDraggable = tree?.props.draggable === true;\n const isNodeDraggable = node?.draggable !== false && isDraggable;\n\n const dragState = TreeDragDropService.getDragState();\n const isDroppable = tree?.props.droppable && tree?.allowDrop?.(node as TreeNodeType);\n const isNodeDroppable = node?.droppable !== false && isDroppable;\n\n const isPrevDropPointActive = isPrevDropPointHovered && isDroppable;\n const isNextDropPointActive = isNextDropPointHovered && isDroppable;\n const isNodeDropActive = isNodeDropHovered && isNodeDroppable;\n\n const dropPosition: TreeDropPosition = isPrevDropPointActive ? 'before' : isNextDropPointActive ? 'after' : 'inside';\n\n const removeNodeFromTree = (nodes: TreeNodeType[], nodeToRemove: TreeNodeType): TreeNodeType[] => {\n return nodes.reduce((acc: TreeNodeType[], n: TreeNodeType) => {\n if (n.key === nodeToRemove.key) return acc;\n\n if (n.children && n.children.length > 0) {\n const updatedChildren = removeNodeFromTree(n.children, nodeToRemove);\n acc.push({ ...n, children: updatedChildren });\n } else {\n acc.push(n);\n }\n\n return acc;\n }, []);\n };\n\n const insertNodeInSiblings = (nodes: TreeNodeType[], targetKey: string, nodeToInsert: TreeNodeType, offset: number): TreeNodeType[] => {\n const targetIndex = nodes.findIndex((n) => n.key === targetKey);\n\n if (targetIndex !== -1) {\n const newNodes = [...nodes];\n newNodes.splice(targetIndex + offset, 0, nodeToInsert);\n return newNodes;\n }\n\n return nodes.map((n) => {\n if (n.children && n.children.length > 0) {\n return { ...n, children: insertNodeInSiblings(n.children, targetKey, nodeToInsert, offset) };\n }\n\n return n;\n });\n };\n\n const addNodeAsChild = (nodes: TreeNodeType[], parentKey: string, nodeToInsert: TreeNodeType): TreeNodeType[] => {\n return nodes.map((n) => {\n if (n.key === parentKey) {\n return { ...n, children: [...(n.children || []), nodeToInsert] };\n }\n\n if (n.children && n.children.length > 0) {\n return { ...n, children: addNodeAsChild(n.children, parentKey, nodeToInsert) };\n }\n\n return n;\n });\n };\n\n const computeMoveResult = (): { updated: TreeNodeType[]; dropIndex: number } | null => {\n const dragNode = dragState.dragNode;\n const rootNodes = tree?.getNodes() || [];\n\n if (!node || !dragNode) return null;\n\n let updated = removeNodeFromTree(rootNodes, dragNode);\n\n if (dropPosition === 'before') {\n updated = insertNodeInSiblings(updated, node.key, dragNode, 0);\n } else if (dropPosition === 'after') {\n updated = insertNodeInSiblings(updated, node.key, dragNode, 1);\n } else {\n updated = addNodeAsChild(updated, node.key, dragNode);\n }\n\n return { updated, dropIndex: props.index ?? 0 };\n };\n\n const onNodeDragStart = (event: React.DragEvent) => {\n if (!isNodeDraggable) {\n event.preventDefault();\n return;\n }\n\n event.stopPropagation();\n event.dataTransfer.effectAllowed = 'all';\n event.dataTransfer.setData('text', 'data');\n\n const target = event.currentTarget as HTMLElement;\n const dragEl = target.cloneNode(true) as HTMLElement;\n const toggler = dragEl.querySelector('[data-part=\"toggle\"]') as HTMLElement | null;\n\n target.setAttribute('data-dragging', 'true');\n dragEl.style.width = getOuterWidth(target) + 'px';\n dragEl.style.height = getOuterHeight(target) + 'px';\n dragEl.setAttribute('data-part', 'drag-image');\n\n if (toggler) {\n toggler.style.visibility = 'hidden';\n }\n\n document.body.appendChild(dragEl);\n event.dataTransfer.setDragImage(dragEl, 0, 0);\n\n setTimeout(() => document.body.removeChild(dragEl), 0);\n\n // Lets the destination tree remove this node from our value on drop.\n const sourceTreeNodes = tree?.getNodes() ?? [];\n const sourceCommit = (originalEvent: React.DragEvent) => {\n if (!node) return;\n\n const updated = removeNodeFromTree(sourceTreeNodes as TreeNodeType[], node as TreeNodeType);\n\n tree?.props.onMove?.({\n originalEvent,\n value: updated,\n dragNode: node as TreeNodeType,\n dropNode: null,\n dropIndex: -1,\n dropPosition: 'inside'\n });\n };\n\n TreeDragDropService.startDrag({\n node: node as TreeNodeType,\n subNodes: subNodes as TreeNodeType[],\n index: props.index,\n scope: tree?.props.draggableScope,\n sourceCommit\n });\n };\n\n const onNodeDragOver = (event: React.DragEvent) => {\n if (isDroppable) {\n event.dataTransfer.dropEffect = 'copy';\n const nodeElement = event.currentTarget as HTMLElement;\n const rect = nodeElement.getBoundingClientRect();\n const y = event.clientY - rect.top;\n\n // dragover fires per mouse move; only set state that actually changed.\n const wantPrev = y < rect.height * 0.25;\n const wantNext = y > rect.height * 0.75;\n const wantInside = !wantPrev && !wantNext && !!isNodeDroppable;\n\n if (wantPrev !== isPrevDropPointHovered) setIsPrevDropPointHovered(wantPrev);\n if (wantNext !== isNextDropPointHovered) setIsNextDropPointHovered(wantNext);\n if (wantInside !== isNodeDropHovered) setIsNodeDropHovered(wantInside);\n } else {\n event.dataTransfer.dropEffect = 'none';\n }\n\n if (tree?.props.droppable) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n\n const onNodeDragEnter = () => {};\n\n const onNodeDragLeave = () => {\n setIsPrevDropPointHovered(false);\n setIsNextDropPointHovered(false);\n setIsNodeDropHovered(false);\n };\n\n const onNodeDragEnd = (event: React.DragEvent) => {\n event.stopPropagation();\n (event.currentTarget as HTMLElement)?.removeAttribute('data-dragging');\n\n TreeDragDropService.stopDrag({ node: node as TreeNodeType });\n };\n\n const fireMove = (event: React.DragEvent, dragNode: TreeNodeType, updated: TreeNodeType[]) => {\n const moveEvent = buildMoveEvent(event, updated, dragNode, node as TreeNodeType, props.index ?? 0, dropPosition);\n const { sourceCommit } = TreeDragDropService.getDragState();\n const sourceIsThisTree = (tree?.getNodes() ?? []).some((root) => containsNodeByKey(root, dragNode.key));\n\n props.onMove?.(moveEvent);\n tree?.props.onMove?.(moveEvent);\n\n // Cross-tree drop — tell the source to remove the node from its value.\n if (sourceCommit && !sourceIsThisTree) sourceCommit(event);\n };\n\n const onNodeDrop = (event: React.DragEvent) => {\n if (!isDroppable) return;\n\n event.preventDefault();\n event.stopPropagation();\n\n const dragNode = dragState.dragNode;\n const isValidDrop = dropPosition !== 'inside' || isNodeDroppable;\n\n if (!isValidDrop || !dragNode) {\n setIsPrevDropPointHovered(false);\n setIsNextDropPointHovered(false);\n setIsNodeDropHovered(false);\n return;\n }\n\n const validate = tree?.props.validateMove;\n const result = computeMoveResult();\n if (!result) {\n TreeDragDropService.stopDrag({ node: dragNode });\n return;\n }\n\n const commit = () => {\n fireMove(event, dragNode, result.updated);\n TreeDragDropService.stopDrag({ node: dragNode });\n };\n\n if (validate) {\n const preview = buildMoveEvent(event, result.updated, dragNode, node as TreeNodeType, props.index ?? 0, dropPosition);\n const validation = validate(preview);\n\n if (validation instanceof Promise) {\n validation.then((ok) => {\n if (ok) commit();\n else TreeDragDropService.stopDrag({ node: dragNode });\n });\n } else if (validation) {\n commit();\n } else {\n TreeDragDropService.stopDrag({ node: dragNode });\n }\n } else {\n commit();\n }\n\n setIsPrevDropPointHovered(false);\n setIsNextDropPointHovered(false);\n setIsNodeDropHovered(false);\n };\n\n const handleContentClick = (event: React.MouseEvent) => {\n if (tree && node && node.disabled !== true) {\n tree.onClick(event, node, nodeTouched);\n\n if (nodeTouched) {\n setNodeTouched(false);\n }\n }\n };\n\n const handleContentTouchEnd = () => {\n setNodeTouched(true);\n };\n\n const state = {\n expanded,\n selected,\n checked,\n partialChecked,\n leaf,\n level,\n posInSet,\n setSize,\n isNodeDropActive: !!isNodeDropActive,\n isPrevDropPointActive: !!isPrevDropPointActive,\n isNextDropPointActive: !!isNextDropPointActive,\n isDraggable: !!isNodeDraggable,\n nodeTouched\n };\n\n const nodeProps = tree?.getNodeProps(node as TreeNodeType, level, expanded, checked, selected, leaf, posInSet, setSize);\n\n const isCheckbox = tree?.props.selectionMode === 'checkbox';\n const isSelected = isCheckbox ? checked : selected;\n const isSelectable = !!(tree?.props.selectionMode && node?.disabled !== true);\n\n const contentProps = {\n 'data-scope': 'tree' as const,\n 'data-part': 'content' as const,\n draggable: !!isNodeDraggable,\n ...(isSelected && { 'data-selected': '' as const }),\n ...(isSelectable && { 'data-selectable': '' as const }),\n ...(!leaf && { [expanded ? 'data-expanded' : 'data-collapsed']: '' as const }),\n ...(leaf && { 'data-leaf': '' as const }),\n ...(checked && { 'data-checked': '' as const }),\n ...(partialChecked && { 'data-partial-checked': '' as const }),\n ...(node?.disabled === true && { 'data-disabled': '' as const }),\n ...(isNodeDropActive && { 'data-dragover': '' as const }),\n onDragStart: onNodeDragStart,\n onDragOver: onNodeDragOver,\n onDragEnter: onNodeDragEnter,\n onDragLeave: onNodeDragLeave,\n onDragEnd: onNodeDragEnd,\n onDrop: onNodeDrop,\n onClick: handleContentClick,\n onTouchEnd: handleContentTouchEnd\n };\n\n const dropPointProps = {\n 'data-scope': 'tree' as const,\n 'data-part': 'drop-point' as const,\n 'aria-hidden': true as const\n };\n\n return {\n state,\n parentNode,\n nodeProps,\n contentProps,\n dropPointProps\n };\n }\n});\n","import type { UseTreeNodeHookProps } from '@primereact/types/headless/tree';\n\nexport const defaultTreeNodeProps: UseTreeNodeHookProps = {\n node: undefined,\n index: undefined,\n context: undefined,\n parentContext: undefined,\n onMove: undefined\n};\n"],"mappings":"6bAAA,OAAS,gBAAAA,OAAoB,4BAC7B,OAAS,sBAAAC,OAA0B,yCAEnC,UAAYC,MAAW,QCDhB,IAAMC,GAA6B,CACtC,MAAO,OACP,aAAc,OACd,oBAAqB,OACrB,cAAe,OACf,qBAAsB,OACtB,cAAe,OACf,iBAAkB,GAClB,kBAAmB,GACnB,UAAW,OACX,UAAW,OACX,eAAgB,OAChB,eAAgB,OAChB,iBAAkB,OAClB,kBAAmB,OACnB,SAAU,OACV,SAAU,OACV,WAAY,OACZ,QAAS,OACT,SAAU,OACV,WAAY,OACZ,OAAQ,OACR,aAAc,OACd,mBAAoB,OACpB,QAAS,EACb,EC1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GACjD,CAACtF,GAAQ,CAAE,CAACF,EAAW,gBAAkB,gBAAgB,EAAG,EAAY,GACxEE,GAAQ,CAAE,YAAa,EAAY,GACnCC,GAAW,CAAE,eAAgB,EAAY,GACzCC,GAAkB,CAAE,uBAAwB,EAAY,IACxDtB,GAAA,YAAAA,EAAM,YAAa,IAAQ,CAAE,gBAAiB,EAAY,GAC1DgD,GAAoB,CAAE,gBAAiB,EAAY,GAXtC,CAYjB,YAAasB,GACb,WAAYU,GACZ,YAAaM,EACb,YAAaC,EACb,UAAWC,EACX,OAAQM,EACR,QAASO,EACT,WAAYC,EAChB,GAQA,MAAO,CACH,MAAAC,GACA,WAAAvF,EACA,UAAAwF,GACA,aAAAG,GACA,eAXmB,CACnB,aAAc,OACd,YAAa,aACb,cAAe,EACnB,CAQA,CACJ,CACJ,CAAC","names":["withHeadless","useControlledState","React","defaultProps","React","dragState","dragStartHandlers","dragStopHandlers","TreeDragDropService","event","_a","_b","_c","_d","_e","handler","rootContainsKey","node","key","child","useTreeRootDragDrop","props","setDragHoverState","getNodes","cleanup","TreeDragDropService","allowDrop","dropNode","dragNode","dragScope","isValidDragScope","onDragOver","event","onDragEnter","_event","onDragLeave","rect","commitRootDrop","_dragNodeIndex","sourceCommit","currentNodes","sourceIsThisTree","root","newValue","moveEvent","fire","_a","result","ok","dragNodeIndex","isSameTreeScope","hasCommonScope","a","b","item","droppableScope","draggableScope","buildMoveEvent","originalEvent","value","dropIndex","dropPosition","React","useTreeNodeMap","value","map","flat","walk","nodes","parentKey","level","_a","i","n","useTreeVisibleKeys","expandedKey","result","expanded","focus","isPrintableCharacter","React","TYPE_AHEAD_TIMEOUT","useTreeKeyboard","props","elementRef","visibleKeys","findNodeByKey","onNodeToggle","onClick","setFocusedKey","searchTimeout","searchValue","focusNodeElement","key","el","item","navigateToIndex","idx","fallbackKey","_a","_b","navigateNext","currentKey","navigatePrev","navigateFirst","navigateLast","searchNodes","char","currentNode","allTreeItems","currentElement","currentIndex","searchLower","matched","i","event","node","_level","expanded","leaf","target","currentTarget","metaKey","candidateKey","candidate","React","useTreeSelection","props","selectedKeyState","setSelectedKeyState","getNodes","getVisibleKeys","isSingleSelectionMode","isMultipleSelectionMode","isCheckboxSelectionMode","isNodeSelected","node","_a","fireSelect","event","fireUnselect","handleSelectionWithMetaKey","metaKey","selected","currentSelection","_selectionKeys","__spreadValues","handleSelectionWithoutMetaKey","nodeKey","__spreadProps","onNodeClick","nodeTouched","newValue","propagateDown","check","selectionKeys","child","propagateUp","_b","checkedChildCount","childPartialSelected","findParentNode","nodes","childKey","parent","found","onCheckboxChange","newCheckState","parentNode","onClick","setSelectionKeys","keys","originalEvent","isSelected","key","isPartiallySelected","selectionSummary","visibleKeys","selectedCount","slice","isAllSelected","isSomeSelected","toggleSelection","mode","findNodeByKeyInTree","toggleAll","allSelected","next","useTree","withHeadless","defaultProps","props","elementRef","id","_a","_b","defaultExpandedKeyRef","expandedKeyState","setExpandedKeyState","useControlledState","defaultSelectedKeyRef","selectedKeyState","setSelectedKeyState","focusedKeyState","setFocusedKeyState","dragHoverState","setDragHoverState","nodeMap","flatOrder","useTreeNodeMap","visibleKeys","useTreeVisibleKeys","visibleCount","findNodeByKey","key","findNodeInfo","entry","getNodes","setFocusedKey","visibleKeysRef","getVisibleKeys","selection","useTreeSelection","onNodeToggle","event","node","_c","_d","currentKeys","nodeKey","newValue","__spreadValues","__spreadProps","keyboard","useTreeKeyboard","dragDrop","useTreeRootDragDrop","state","rootProps","filterProps","loadingProps","getToggleProps","expanded","handleClick","getToggleSpacerProps","getToggleIndicatorProps","getNodeProps","level","checked","selected","leaf","posInSet","setSize","isFocused","handleKeyDown","isCheckbox","getNodesProps","withHeadless","getOuterHeight","getOuterWidth","React","defaultTreeNodeProps","containsNodeByKey","node","key","child","useTreeNode","withHeadless","defaultTreeNodeProps","props","_a","_b","_c","_d","_e","_f","_g","_h","tree","parentNode","nodeKey","expanded","selected","leaf","checked","partialChecked","checkboxKeys","level","posInSet","setSize","info","parentData","siblings","nodeTouched","setNodeTouched","isPrevDropPointHovered","setIsPrevDropPointHovered","isNextDropPointHovered","setIsNextDropPointHovered","isNodeDropHovered","setIsNodeDropHovered","parentNodeData","subNodes","isDraggable","isNodeDraggable","dragState","TreeDragDropService","isDroppable","isNodeDroppable","isPrevDropPointActive","isNextDropPointActive","isNodeDropActive","dropPosition","removeNodeFromTree","nodes","nodeToRemove","acc","n","updatedChildren","__spreadProps","__spreadValues","insertNodeInSiblings","targetKey","nodeToInsert","offset","targetIndex","newNodes","addNodeAsChild","parentKey","computeMoveResult","dragNode","rootNodes","updated","onNodeDragStart","event","target","dragEl","toggler","getOuterWidth","getOuterHeight","sourceTreeNodes","sourceCommit","originalEvent","onNodeDragOver","rect","y","wantPrev","wantNext","wantInside","onNodeDragEnter","onNodeDragLeave","onNodeDragEnd","fireMove","moveEvent","buildMoveEvent","sourceIsThisTree","root","onNodeDrop","validate","result","commit","preview","validation","ok","handleContentClick","handleContentTouchEnd","state","nodeProps","isSelected","isSelectable","contentProps"]}
|
package/tree/useTree.test.d.ts
DELETED
|
File without changes
|