From 10bda0c18ea1b14a158fb885c1554a8bd8e12cae Mon Sep 17 00:00:00 2001
From: Melloware <mellowaredev@gmail.com>
Date: Tue, 14 Jan 2025 11:42:42 -0500
Subject: [PATCH] Fix #7599: Tree switch isLeaf to leaf (#7603)

---
 components/lib/passthrough/tailwind/index.js | 2 +-
 components/lib/tree/TreeBase.js              | 4 ++--
 components/lib/tree/UITreeNode.js            | 6 +++---
 components/lib/tree/tree.d.ts                | 5 +++++
 4 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/components/lib/passthrough/tailwind/index.js b/components/lib/passthrough/tailwind/index.js
index 5876568ef5..9aa7a098d0 100644
--- a/components/lib/passthrough/tailwind/index.js
+++ b/components/lib/passthrough/tailwind/index.js
@@ -2517,7 +2517,7 @@ const Tailwind = {
                     'text-blue-600 hover:bg-white/30': context.selected
                 },
                 {
-                    invisible: context.isLeaf
+                    invisible: context.leaf
                 }
             )
         }),
diff --git a/components/lib/tree/TreeBase.js b/components/lib/tree/TreeBase.js
index a717c64656..33c24ee0b1 100644
--- a/components/lib/tree/TreeBase.js
+++ b/components/lib/tree/TreeBase.js
@@ -14,9 +14,9 @@ const classes = {
     input: 'p-tree-filter p-inputtext p-component',
     searchIcon: 'p-tree-filter-icon',
     container: 'p-tree-container',
-    node: ({ isLeaf }) =>
+    node: ({ leaf }) =>
         classNames('p-treenode', {
-            'p-treenode-leaf': isLeaf
+            'p-treenode-leaf': leaf
         }),
     content: ({ nodeProps: props, checked, selected, isCheckboxSelectionMode }) =>
         classNames('p-treenode-content', {
diff --git a/components/lib/tree/UITreeNode.js b/components/lib/tree/UITreeNode.js
index 14c3e50998..b56741c82e 100644
--- a/components/lib/tree/UITreeNode.js
+++ b/components/lib/tree/UITreeNode.js
@@ -1,4 +1,5 @@
 import * as React from 'react';
+import { Checkbox } from '../checkbox/Checkbox';
 import { useMergeProps } from '../hooks/Hooks';
 import { CheckIcon } from '../icons/check';
 import { ChevronDownIcon } from '../icons/chevrondown';
@@ -6,7 +7,6 @@ import { ChevronRightIcon } from '../icons/chevronright';
 import { MinusIcon } from '../icons/minus';
 import { Ripple } from '../ripple/Ripple';
 import { classNames, DomHandler, IconUtils, ObjectUtils } from '../utils/Utils';
-import { Checkbox } from '../checkbox/Checkbox';
 
 export const UITreeNode = React.memo((props) => {
     const contentRef = React.useRef(null);
@@ -25,7 +25,7 @@ export const UITreeNode = React.memo((props) => {
                 selected: !isCheckboxSelectionMode() ? isSelected() : false,
                 expanded: expanded || false,
                 checked: isCheckboxSelectionMode() ? isChecked() : false,
-                isLeaf
+                leaf: isLeaf
             }
         });
     };
@@ -958,7 +958,7 @@ export const UITreeNode = React.memo((props) => {
         const nodeProps = mergeProps(
             {
                 ref: elementRef,
-                className: classNames(props.node.className, cx('node', { isLeaf })),
+                className: classNames(props.node.className, cx('node', { leaf: isLeaf })),
                 style: props.node.style,
                 tabIndex,
                 role: 'treeitem',
diff --git a/components/lib/tree/tree.d.ts b/components/lib/tree/tree.d.ts
index d10372ef7e..203e5d76d9 100644
--- a/components/lib/tree/tree.d.ts
+++ b/components/lib/tree/tree.d.ts
@@ -145,6 +145,11 @@ export interface TreeContext {
      * @defaultValue false
      */
     checked: boolean;
+    /**
+     * Whether the node is a leaf node.
+     * @defaultValue false
+     */
+    leaf: boolean;
 }
 
 /**