diff --git a/CHANGELOG.md b/CHANGELOG.md index f9cc64ef95..a933e4265e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ - Adjust background color of OuiToolTip in `next` theme ([#1004](https://github.com/opensearch-project/oui/pull/1004)) - Add new `middle-out` order prop option to `OuiPaletteColorBlind` ([#856](https://github.com/opensearch-project/oui/pull/856)) - Add new icons for OpenSearch Dashboards v2.10.0 ([#1014](https://github.com/opensearch-project/oui/pull/1014)) +- Add count prop to OuiTreeView with OuiFacetButton ([[#934](https://github.com/opensearch-project/oui/issues/934)]) - Add `onFullScreenChange` to `OuiDataGrid` ([#1053](https://github.com/opensearch-project/oui/pull/1053)) ### 🐛 Bug Fixes diff --git a/src/components/tree_view/__snapshots__/tree_view.test.tsx.snap b/src/components/tree_view/__snapshots__/tree_view.test.tsx.snap index 498eff8e2b..63c1ffabb9 100644 --- a/src/components/tree_view/__snapshots__/tree_view.test.tsx.snap +++ b/src/components/tree_view/__snapshots__/tree_view.test.tsx.snap @@ -34,10 +34,28 @@ exports[`OuiTreeView is rendered 1`] = ` data-ouiicon-type="folderOpen" /> + +
+ +
+ +
+ +
+
(''); @@ -118,6 +119,8 @@ export type CommonTreeProps = CommonProps & * that contain children */ showExpansionArrows?: boolean; + /** Number of child components within tree view node + */ }; export type OuiTreeViewProps = Omit< @@ -307,7 +310,7 @@ export class OuiTreeView extends Component { {items.map((node, index) => { const buttonId = node.id; const wrappingId = this.treeIdGenerator(buttonId); - + const count = node.children?.length; return ( { {node.useEmptyIcon && !node.icon ? ( ) : null} - - {node.label} - + {count === 0 ? ( + + {node.label} + + ) : ( + + + {node.label} + + + )}