diff --git a/.changeset/slow-shoes-wait.md b/.changeset/slow-shoes-wait.md new file mode 100644 index 00000000000..05c1f11c030 --- /dev/null +++ b/.changeset/slow-shoes-wait.md @@ -0,0 +1,5 @@ +--- +'@primer/react': minor +--- + +TreeView: Adds prop `truncate`, keeps default behavior of truncation but allows for text to wrap when turned off. diff --git a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-colorblind-linux.png b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-colorblind-linux.png index 0ddff78f691..02fcf1668a1 100644 Binary files a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-colorblind-linux.png and b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-dimmed-linux.png b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-dimmed-linux.png index 894a7f69c06..f9cabc94740 100644 Binary files a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-dimmed-linux.png and b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-dimmed-linux.png differ diff --git a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-high-contrast-linux.png b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-high-contrast-linux.png index a79d7111fc7..de83cf8f11b 100644 Binary files a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-high-contrast-linux.png and b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-linux.png b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-linux.png index cb584be7e9f..17e7213615f 100644 Binary files a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-linux.png and b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-linux.png differ diff --git a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-tritanopia-linux.png b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-tritanopia-linux.png index b93a601acdc..021b399aa17 100644 Binary files a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-tritanopia-linux.png and b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-tritanopia-linux.png differ diff --git a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-colorblind-linux.png b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-colorblind-linux.png index bbc93d13a8b..3b1dafdef7f 100644 Binary files a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-colorblind-linux.png and b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-high-contrast-linux.png b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-high-contrast-linux.png index 5d89ddfa693..51d8856c85e 100644 Binary files a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-high-contrast-linux.png and b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-linux.png b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-linux.png index 0946c66e7e2..a9e6f0b14a0 100644 Binary files a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-linux.png and b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-linux.png differ diff --git a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-tritanopia-linux.png b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-tritanopia-linux.png index b806f4525c7..9c4c0558f7f 100644 Binary files a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-tritanopia-linux.png and b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-tritanopia-linux.png differ diff --git a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-colorblind-linux.png b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-colorblind-linux.png index 6a7610277a2..3fd400a3e78 100644 Binary files a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-colorblind-linux.png and b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-dimmed-linux.png b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-dimmed-linux.png index 274c0dabde8..7422369cf32 100644 Binary files a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-dimmed-linux.png and b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-dimmed-linux.png differ diff --git a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-high-contrast-linux.png b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-high-contrast-linux.png index da0caffb7a7..78d0c95b3c6 100644 Binary files a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-high-contrast-linux.png and b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-linux.png b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-linux.png index 0b3c5d491ce..33fee37e4d1 100644 Binary files a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-linux.png and b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-linux.png differ diff --git a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-tritanopia-linux.png b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-tritanopia-linux.png index 6a7610277a2..3fd400a3e78 100644 Binary files a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-tritanopia-linux.png and b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-tritanopia-linux.png differ diff --git a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-light-colorblind-linux.png b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-light-colorblind-linux.png index 9c680127141..8c5d9b0db6c 100644 Binary files a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-light-colorblind-linux.png and b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-light-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-light-high-contrast-linux.png b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-light-high-contrast-linux.png index dd5cf3fcaf9..7fa7e85a0d8 100644 Binary files a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-light-high-contrast-linux.png and b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-light-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-light-linux.png b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-light-linux.png index 9c680127141..8c5d9b0db6c 100644 Binary files a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-light-linux.png and b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-light-linux.png differ diff --git a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-light-tritanopia-linux.png b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-light-tritanopia-linux.png index 9c680127141..8c5d9b0db6c 100644 Binary files a/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-light-tritanopia-linux.png and b/.playwright/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-light-tritanopia-linux.png differ diff --git a/packages/react/src/TreeView/TreeView.docs.json b/packages/react/src/TreeView/TreeView.docs.json index fb8d83893ef..3fa064219a2 100644 --- a/packages/react/src/TreeView/TreeView.docs.json +++ b/packages/react/src/TreeView/TreeView.docs.json @@ -69,6 +69,12 @@ "name": "onSelect", "type": "(event: React.MouseEvent | React.KeyboardEvent) => void" }, + { + "name": "truncate", + "type": "boolean", + "defaultValue": "true", + "description": "Truncate the item's text content with an ellipsis." + }, { "name": "ref", "type": "React.Ref" diff --git a/packages/react/src/TreeView/TreeView.features.stories.tsx b/packages/react/src/TreeView/TreeView.features.stories.tsx index b4d9a8181b4..5af82653326 100644 --- a/packages/react/src/TreeView/TreeView.features.stories.tsx +++ b/packages/react/src/TreeView/TreeView.features.stories.tsx @@ -34,7 +34,7 @@ const meta: Meta = { export const Files: StoryFn = () => (