Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
213 commits
Select commit Hold shift + click to select a range
9fba299
Adding `portfolio` (Microsoft Project item type) to the list of non-f…
bigbadcapers Sep 23, 2024
63f928c
More filetype support.
bigbadcapers Sep 23, 2024
3ccf0e3
update CDN url and typo
bigbadcapers Sep 25, 2024
fab6a3a
yarn change
bigbadcapers Sep 25, 2024
55294b5
API update (from yarn nx run-many -t build)
bigbadcapers Sep 26, 2024
f025f9e
Merge branch 'master' into caperez/sep-filetype-icon-update
bigbadcapers Sep 26, 2024
bbeb40a
Ran `yarn nx format`
bigbadcapers Sep 26, 2024
0bcee33
Merge branch 'master' into caperez/sep-filetype-icon-update
bigbadcapers Sep 26, 2024
a7180bf
Merge branch 'caperez/sep-filetype-icon-update' of https://github.com…
bigbadcapers Sep 26, 2024
280fe2c
Changing FileIconType-based icon searching to use the same scalable m…
bigbadcapers Sep 29, 2024
d87a2a5
Merge branch 'upstream-master' into caperez/newTypeMethod
bigbadcapers Sep 30, 2024
d9cc656
removing stray outdated yarn change files
bigbadcapers Sep 30, 2024
a7884fb
yarn change
bigbadcapers Sep 30, 2024
b12c050
Ran `yarn nx format`
bigbadcapers Sep 30, 2024
71faacd
post-refactoring cleanup of an unused type
bigbadcapers Sep 30, 2024
d6b0c08
fixing error reported by `lint`: error The body of a for-in should b…
bigbadcapers Sep 30, 2024
60556e3
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 1, 2024
5e51678
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 1, 2024
348dc4d
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 1, 2024
22c8545
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 2, 2024
696661f
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 3, 2024
fa910b5
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 14, 2024
7e42ae8
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 14, 2024
00bbcd6
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 15, 2024
e49f620
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 17, 2024
6640d15
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 21, 2024
765313e
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 22, 2024
0b1cf0b
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 23, 2024
24c626f
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 24, 2024
ae68e6d
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 26, 2024
4b1d12e
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 28, 2024
a41fc17
Merge branch 'upstream-master' into caperez/newTypeMethod
bigbadcapers Nov 1, 2024
b86c403
adding album entry to filetypeicon mapping
bigbadcapers Nov 1, 2024
b5a574c
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Nov 1, 2024
3fc8bc6
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Nov 8, 2024
4da5e8a
Merge remote-tracking branch 'upstream/master' into caperez/newTypeMe…
bigbadcapers Dec 20, 2024
856c284
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Dec 20, 2024
e1019ad
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Dec 23, 2024
d759bf1
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Jan 8, 2025
91b7b95
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Jan 8, 2025
fe0881e
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Jan 9, 2025
17bf0e5
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Jan 20, 2025
ddf6351
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Mar 10, 2025
e54435a
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Mar 13, 2025
54df488
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Mar 14, 2025
9f3c6da
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Mar 15, 2025
ada0165
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Apr 19, 2025
ad8552c
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Apr 30, 2025
d2c9ff6
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers May 2, 2025
0af5721
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers May 7, 2025
e7964db
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers May 10, 2025
1aa9f16
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers May 12, 2025
cbdba53
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers May 14, 2025
19cd862
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Jun 5, 2025
209fd2c
Merge branch 'microsoft:master' into caperez/newTypeMethod
bigbadcapers Jul 29, 2025
aa8ffda
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Aug 22, 2025
f74d77b
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Oct 11, 2025
a19592f
first drop of creating a Fluent v9 version of the react-file-type-ico…
bigbadcapers Nov 23, 2025
0b1c4fb
refreshing filetype icon references in other storybooks to new icon s…
bigbadcapers Nov 23, 2025
ce3262c
more touch-ups in other places that reference the CDN url
bigbadcapers Nov 23, 2025
e08e1ba
verified new file-type-icons-preview package is rendering icons in th…
bigbadcapers Nov 23, 2025
641eb02
simplified documentation.
bigbadcapers Nov 23, 2025
59298fa
simplifying getFileTypeIconAsURL and getFileTypeIconAsHTMLString
bigbadcapers Nov 24, 2025
792e792
updated storybook / tests to evaluate helper functions
bigbadcapers Nov 24, 2025
3c64988
organizing storybook place in nav
bigbadcapers Nov 24, 2025
cbf2f29
Merge branch 'master' into caperez/newTypeMethod
bigbadcapers Nov 24, 2025
27a704e
Merge remote-tracking branch 'origin/caperez/newTypeMethod' into cape…
bigbadcapers Nov 24, 2025
8d379e6
update getFileTypeIconProps to use same mapping file FileTypeIconMap.…
bigbadcapers Nov 24, 2025
e51a9c6
new documentation pass 1 (broken)
bigbadcapers Nov 24, 2025
213d6f0
documentation rendering ok, ready to condense
bigbadcapers Nov 24, 2025
f0a02bf
refining FileIconType and storybook
bigbadcapers Nov 24, 2025
71338bf
story condensation snapshot
bigbadcapers Nov 25, 2025
93a577b
condensation 2
bigbadcapers Nov 25, 2025
3d484ae
improving alt tag generation in the control itself, removing a11y sto…
bigbadcapers Nov 25, 2025
199803c
ran all pre-checks from plan-testingAndPromotionEnhanced. ready to st…
bigbadcapers Nov 25, 2025
325af7b
package move to remove -preview suffix
bigbadcapers Nov 25, 2025
092682f
first test passed after package rename
bigbadcapers Nov 25, 2025
f5b16cc
API update and undoing newFileTypeMethod in v8 package
bigbadcapers Nov 25, 2025
baa3430
package semver cleanup, build pass, documentation simplification
bigbadcapers Nov 25, 2025
1f48612
error checking and optimizations
bigbadcapers Nov 25, 2025
5996d70
initializeFileTypeIcons with alternate CDN URL is now honored by new …
bigbadcapers Nov 25, 2025
e89bd7b
improved icon size checking, removing unnecessary public exports, fix…
bigbadcapers Nov 25, 2025
917c256
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Nov 25, 2025
9af6811
cleanup stray API file
bigbadcapers Nov 25, 2025
fb25605
Merge branch 'caperez/filetype-icons-for-v9' of https://github.com/bi…
bigbadcapers Nov 25, 2025
df430ed
changing v8 package name and adding publishConfig so it emits to the …
bigbadcapers Nov 25, 2025
0204824
updating swc packages and lint tweaks
bigbadcapers Nov 25, 2025
3b2ed13
yarn change
bigbadcapers Nov 25, 2025
c5b3ca1
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Nov 25, 2025
07d1b03
remove private flag from package.json for react-file-type-icons
bigbadcapers Nov 25, 2025
b2a45e8
Merge branch 'caperez/filetype-icons-for-v9' of https://github.com/bi…
bigbadcapers Nov 25, 2025
3794169
deduplicating yarn lock and solving plugin issue in react-utilities .…
bigbadcapers Nov 25, 2025
935f967
yarn change for react-utilities
bigbadcapers Nov 25, 2025
237b828
npx yarn-deduplicate --strategy fewer
bigbadcapers Nov 25, 2025
cb42047
Add path mapping for react-file-type-icons-v8 in tsconfig.base.all.json
bigbadcapers Nov 25, 2025
cfa9fba
re-running yarn nx format:write
bigbadcapers Nov 25, 2025
ef929f1
undoing removal of indent rule
bigbadcapers Nov 25, 2025
9824a02
plugin swc-plugin-de-indent-template-literal is crashing, removing
bigbadcapers Nov 25, 2025
9b0917c
yarn change for experimental swc.rs indentation plugin removal
bigbadcapers Nov 25, 2025
2d73b85
fix missing param in documentation for getFileTypeIcon
bigbadcapers Nov 25, 2025
13974b7
Add missing dependency and update styles in file type icon stories
bigbadcapers Nov 26, 2025
d949974
lint and yarn change again
bigbadcapers Nov 26, 2025
2d6e940
undoing overeager deletion of a file i had no business touching
bigbadcapers Nov 26, 2025
ba6015c
fixing compilation config issues - no change
bigbadcapers Nov 26, 2025
c2ad25a
Refactor UrlAndHtml component export and update story parameters
bigbadcapers Nov 26, 2025
c31ef7e
Add device pixel ratio state and effect to UrlAndHtml component to pa…
bigbadcapers Nov 26, 2025
6c94223
yarn nx format:write prettier
bigbadcapers Nov 26, 2025
917f878
dead end ci/cd solving ci/main no dice
bigbadcapers Nov 26, 2025
ae682cc
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Nov 26, 2025
f1984d1
first late undo
bigbadcapers Nov 26, 2025
cb3066c
Merge branch 'caperez/filetype-icons-for-v9' of https://github.com/bi…
bigbadcapers Nov 26, 2025
f55e035
attempted reset
bigbadcapers Nov 26, 2025
15c87a6
yarn change in shared-contexts
bigbadcapers Nov 26, 2025
6bfae2c
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Nov 26, 2025
a0f11fd
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Nov 26, 2025
921aeff
chore: update package dependencies for react and charting components
bigbadcapers Nov 26, 2025
32e1197
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Nov 26, 2025
91ed548
feat: add public docsite setup for v8 version of file-type-icons package
bigbadcapers Nov 26, 2025
47aec0f
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Dec 1, 2025
17569a9
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Dec 2, 2025
e740fbf
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Dec 2, 2025
dee9653
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Dec 15, 2025
c7a1388
missing comma after merge
bigbadcapers Dec 15, 2025
5b170c8
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Dec 17, 2025
741d4b3
fixing overwritten package name differentiation, retaining publishCon…
bigbadcapers Dec 17, 2025
e41a839
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Dec 17, 2025
f06399e
added correct config in syncpack semvergroups to support sim-shipping
bigbadcapers Dec 17, 2025
2812aee
Merge branch 'caperez/filetype-icons-for-v9' of https://github.com/bi…
bigbadcapers Dec 17, 2025
f98c7f1
fixing syncpack config
bigbadcapers Dec 18, 2025
85c4d99
update package name for file type icons to v8 version
bigbadcapers Dec 18, 2025
2b58691
fixing name error - undoing
bigbadcapers Dec 18, 2025
1b1abc6
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Jan 14, 2026
983c8be
Merge remote-tracking branch 'upstream/master' into caperez/filetype-…
bigbadcapers Feb 3, 2026
18780ad
fix: correct JSON formatting in package.json by adding missing comma
bigbadcapers Feb 3, 2026
0965187
chore: update yarn.lock
bigbadcapers Feb 3, 2026
43a15f5
chore: update API file for react-file-type-icons
bigbadcapers Feb 3, 2026
fb56561
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Feb 4, 2026
41940e8
feat: add targets configuration for generate-api in project.json
bigbadcapers Feb 4, 2026
ab8d637
Merge branches 'caperez/filetype-icons-for-v9' and 'caperez/filetype-…
bigbadcapers Feb 4, 2026
6d7057b
initial ship of v9 in v8
bigbadcapers Feb 26, 2026
4a6db74
feat: enhance FileTypeIcon documentation and add migration/playground…
bigbadcapers Feb 26, 2026
38bf864
feat: add Storybook support for react-file-type-icons and mock set-ve…
bigbadcapers Feb 26, 2026
557cfd5
Merge remote-tracking branch 'upstream/master' into caperez/filetype-…
bigbadcapers Feb 26, 2026
b95cdd5
feat(nx): add skills for generating code, managing plugins, running t…
bigbadcapers Feb 26, 2026
cbfc4a1
feat: optimize file type icon mapping by introducing FileIconTypeToIc…
bigbadcapers Feb 26, 2026
edb869a
Merge remote-tracking branch 'upstream/master' into user/caperez/v9-f…
bigbadcapers Feb 26, 2026
6adc099
in progress of creating v9-in-v8 version of file type icons package
bigbadcapers Mar 3, 2026
4f4a7f5
chore: update TypeScript configuration to include ignoreDeprecations …
bigbadcapers Mar 3, 2026
919c50f
Merge remote-tracking branch 'upstream/master' into user/caperez/v9-f…
bigbadcapers Mar 3, 2026
73e4c30
v1 of storybook integration, but at the wrong spot
bigbadcapers Mar 3, 2026
6ba104e
feat: update Storybook integration for v9 and remove deprecated FileT…
bigbadcapers Mar 3, 2026
61674ff
Merge remote-tracking branch 'upstream/master' into user/caperez/v9-f…
bigbadcapers Mar 3, 2026
7f2e8d7
Merge branch 'user/caperez/v9-fit-in-8' into caperez/filetype-icons-f…
bigbadcapers Mar 3, 2026
090ec88
yarn change
bigbadcapers Mar 3, 2026
b19ef42
fix(Fluent v9 Storybook and FileTypeIcon.Basic.Example): update filet…
bigbadcapers Mar 3, 2026
f3fafdf
fix: update package dependencies and clean up tsconfig files
bigbadcapers Mar 3, 2026
cedc96c
storybook build artiface cleanup
bigbadcapers Mar 3, 2026
acc722b
testing and CI fixups
bigbadcapers Mar 4, 2026
09ae4eb
fix: improve window handling and type annotations in file type icon f…
bigbadcapers Mar 4, 2026
cfb64b7
fix: add path for react-file-type-icons stories in tsconfig
bigbadcapers Mar 4, 2026
1b0d3af
fix: correct indentation in JSDoc parameter comment in webpackFinal f…
bigbadcapers Mar 4, 2026
abb6f54
fix: enhance window resolution handling in getFileTypeIconSuffix func…
bigbadcapers Mar 4, 2026
0a121a8
adding line required to properly do liniting in the CI. should this m…
bigbadcapers Mar 4, 2026
1d3e054
trying to solve CI failure: nx run react-file-type-icons-stories:lint
bigbadcapers Mar 4, 2026
829bcbd
fix: add path for react-file-type-icons to package.json workspaces
bigbadcapers Mar 4, 2026
d2cae7a
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Mar 10, 2026
3add5b0
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers Mar 11, 2026
5171370
Merge remote-tracking branch 'upstream/master' into caperez/filetype-…
bigbadcapers May 12, 2026
69c792f
feat: add file type icon stories for default, custom base URL, size a…
bigbadcapers May 12, 2026
22206f3
feat(react-file-type-icons): move package under react-components
bigbadcapers May 12, 2026
2962441
chore(react-file-type-icons): finish validation fixes
bigbadcapers May 12, 2026
ad693a8
chore(react-file-type-icons): align story file names
bigbadcapers May 12, 2026
a3a693e
fix(storybook): support Windows sandbox source generation
bigbadcapers May 12, 2026
e0d9d4a
fix(react-file-type-icons): avoid JSX runtime in legacy utility builds
bigbadcapers May 12, 2026
dc528ba
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers May 12, 2026
eac8cfb
refactor: clean up VSCode settings and remove unused tasks; update St…
bigbadcapers May 13, 2026
9ead6de
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers May 13, 2026
6ed82ba
refactor: simplify import initialization in modifyImportsPlugin
bigbadcapers May 13, 2026
d598cea
fix: register file type icons without style-utilities
bigbadcapers May 13, 2026
b07fd74
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers May 13, 2026
a7e417f
Merge remote-tracking branch 'upstream/master' into caperez/filetype-…
bigbadcapers May 15, 2026
279217f
feat(react-file-type-icons): refactor stories to use new file structu…
bigbadcapers May 15, 2026
acdc7c1
STORY feat(react-file-type-icons): enhance stories with descriptions …
bigbadcapers May 15, 2026
6235bda
STORY 2 feat(react-file-type-icons): update story descriptions and or…
bigbadcapers May 15, 2026
a4c3c20
STORY 3 feat(react-file-type-icons): update story descriptions and na…
bigbadcapers May 15, 2026
1ee2f60
STORY 4
bigbadcapers May 15, 2026
3baf58d
STORY tidying 5
bigbadcapers May 15, 2026
a07c04b
story tidied
bigbadcapers May 15, 2026
d4bf96f
params tidied
bigbadcapers May 15, 2026
b65c792
Merge remote-tracking branch 'upstream/master' into caperez/filetype-…
bigbadcapers May 15, 2026
400ff84
story and PR tweaks
bigbadcapers May 15, 2026
49fb607
Merge remote-tracking branch 'upstream/master' into caperez/filetype-…
bigbadcapers May 15, 2026
e89d027
API update
bigbadcapers May 15, 2026
c334994
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers May 15, 2026
836aaef
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers May 20, 2026
e326ec5
This branch showed lint problems when merged an unrelated commit, sub…
bigbadcapers May 20, 2026
f401478
chore: add linter fix configuration for @fluentui/react-headless-comp…
bigbadcapers May 20, 2026
7ab7926
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers May 21, 2026
9aea845
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers May 21, 2026
4a43cb7
Merge remote-tracking branch 'upstream/master' into caperez/filetype-…
bigbadcapers May 26, 2026
aa06bf2
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers May 26, 2026
7f6692e
Merge branch 'caperez/filetype-icons-for-v9' of https://github.com/bi…
bigbadcapers May 27, 2026
8331a7e
Merge branch 'master' into caperez/filetype-icons-for-v9
bigbadcapers May 27, 2026
b428b4c
Merge branch 'caperez/filetype-icons-for-v9' of https://github.com/bi…
bigbadcapers May 27, 2026
75f2355
Merge remote-tracking branch 'upstream/master' into caperez/filetype-…
bigbadcapers May 28, 2026
21fe266
Merge remote-tracking branch 'upstream/master' into caperez/filetype-…
bigbadcapers Jun 1, 2026
ff795c7
Merge remote-tracking branch 'upstream/master' into caperez/filetype-…
bigbadcapers Jun 2, 2026
0af7858
fix(modifyImports): ensure importMappings is defined with a fallback
bigbadcapers Jun 2, 2026
a1133e1
Address PR review feedback for react-file-type-icons v9
bigbadcapers Jun 2, 2026
a370fdb
chore: add change file for babel-preset-storybook-full-source
bigbadcapers Jun 2, 2026
52f54bf
chore: revert react-file-type-icons change-type to minor (major is di…
bigbadcapers Jun 2, 2026
de3b833
Merge remote-tracking branch 'upstream/master' into caperez/filetype-…
bigbadcapers Jun 2, 2026
24f9427
fix: use globalThis for window reference in getDevicePixelRatioVariant
bigbadcapers Jun 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/public-docsite-v9/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@fluentui/react-northstar": "*",
"@fluentui/react-icons-northstar": "*",
"@fluentui/react-components": "*",
"@fluentui/react-file-type-icons": "*",
"@fluentui/react-storybook-addon": "*",
"@fluentui/react-storybook-addon-export-to-sandbox": "*",
"@fluentui/theme-designer": "*",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The most durable and future-proof way to get the right icon for a file or item is to use the [react-file-type-icons package](https://github.com/microsoft/fluentui/tree/master/packages/react-file-type-icons) from Fluent UI (`@fluentui/react-file-type-icons` on npm).
The most durable and future-proof way to get the right icon for a file or item is to use the [react-file-type-icons package](https://github.com/microsoft/fluentui/tree/master/packages/react-components/react-file-type-icons/library) from Fluent UI (`@fluentui/react-file-type-icons` on npm).

The following code shows you how to specify a file type icon by extension, item type, icon size, and image type using the `@fluentui/react-file-type-icons` package along with Fluent UI's `<Icon>` component:

Expand All @@ -19,8 +19,8 @@ When specifying `size`, stick to these default sizes so the images appear as int

#### References

Here's a [simple demo](https://github.com/microsoft/fluentui/blob/master/packages/react-examples/src/react-experiments/FileTypeIcon/FileTypeIcon.Basic.Example.tsx) of how to use the [`@fluentui/react-file-type-icons` package](https://github.com/microsoft/fluentui/tree/master/packages/react-file-type-icons).  The code for the main method you'll use ([`getFileTypeIconProps`](https://github.com/microsoft/fluentui/blob/master/packages/react-file-type-icons/src/getFileTypeIconProps.ts)) is also well-commented. The icons are kept up-to-date on Fluent UI's CDN, so we recommend not copying or referencing these assets directly.
Here's a [simple demo](https://github.com/microsoft/fluentui/blob/master/packages/react-examples/src/react-experiments/FileTypeIcon/FileTypeIcon.Basic.Example.tsx) of how to use the [`@fluentui/react-file-type-icons` package](https://github.com/microsoft/fluentui/tree/master/packages/react-components/react-file-type-icons/library).  The code for the main method you'll use ([`getFileTypeIconProps`](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-file-type-icons/library/src/getFileTypeIconProps.ts)) is also well-commented. The icons are kept up-to-date on Fluent UI's CDN, so we recommend not copying or referencing these assets directly.

#### Map icons to extensions - [TypeScript mapping file](https://github.com/microsoft/fluentui/blob/master/packages/react-file-type-icons/src/FileTypeIconMap.ts)
#### Map icons to extensions - [TypeScript mapping file](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-file-type-icons/library/src/FileTypeIconMap.ts)

This file maps file extensions to the right PNG or SVG icon. The mapping minimizes the number of required icons while maximizing the number of files that get a non-generic icon. Support for non-file system objects which may not have file extensions can be added in [getFileTypeIconProps.ts](https://github.com/microsoft/fluentui/blob/master/packages/react-file-type-icons/src/getFileTypeIconProps.ts) and [FileIconType.ts](https://github.com/microsoft/fluentui/blob/master/packages/react-file-type-icons/src/FileIconType.ts).
This file maps file extensions to the right PNG or SVG icon. The mapping minimizes the number of required icons while maximizing the number of files that get a non-generic icon. Support for non-file system objects which may not have file extensions can be added in [getFileTypeIconProps.ts](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-file-type-icons/library/src/getFileTypeIconProps.ts) and [FileIconType.ts](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-file-type-icons/library/src/FileIconType.ts).
1 change: 1 addition & 0 deletions apps/vr-tests-react-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"@fluentui/react-teaching-popover": "*",
"@fluentui/react-tag-picker": "*",
"@fluentui/react-carousel": "*",
"@fluentui/react-file-type-icons": "*",
"@fluentui/react-list": "*",
"@fluentui/react-color-picker": "*",
"@fluentui/react-nav": "*"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import * as React from 'react';
import type { Meta } from '@storybook/react-webpack5';
import { Steps } from 'storywright';
import type { StoryParameters } from 'storywright';
import { FileIconType, FileTypeIcon } from '@fluentui/react-file-type-icons';
import { DARK_MODE, getStoryVariant, HIGH_CONTRAST, TestWrapperDecorator } from '../../utilities';

export default {
title: 'FileTypeIcon',
component: FileTypeIcon,
decorators: [TestWrapperDecorator],
parameters: {
storyWright: {
steps: new Steps().snapshot('default', { cropTo: '.testWrapper' }).end(),
},
} satisfies StoryParameters,
} satisfies Meta<typeof FileTypeIcon>;

export const Default = () => (
<div>
<FileTypeIcon extension="docx" />
<FileTypeIcon extension="xlsx" size={20} />
<FileTypeIcon extension="pptx" size={24} />
<FileTypeIcon type={FileIconType.folder} size={32} imageFileType="png" />
<FileTypeIcon extension="unknown" size={40} />
</div>
);
Default.storyName = 'default';

export const DefaultHighContrast = getStoryVariant(Default, HIGH_CONTRAST);

export const DefaultDarkMode = getStoryVariant(Default, DARK_MODE);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Minor refactor of modifyImports/fullsource helpers carried on this branch from an earlier dev session; no published runtime changes.",
"packageName": "@fluentui/babel-preset-storybook-full-source",
"email": "caperez@microsoft.com",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Move @fluentui/react-file-type-icons under react-components and ship as 9.0.0 (same npm name, major bump - v8 consumers must opt in). Adds the FileTypeIcon v9 component while preserving the v8 utility surface (initializeFileTypeIcons, getFileTypeIconProps, getFileTypeIconAsHTMLString, getFileTypeIconAsUrl, FileIconType, FileTypeIconMap). Behavior notes: initializeFileTypeIcons now honors its options.disableWarnings flag (warns on duplicate icon registration unless suppressed) but overwrites existing entries rather than skipping them; getFileTypeIconSuffix is SSR-safe and falls back to a 1x device pixel ratio when window is absent instead of throwing; icons are still written to globalThis.__globalSettings__.icons with the same record shape, preserving interop with v8 @fluentui/react <Icon>; src/version.ts is removed (no setVersion call), so the v8 duplicate-package warning will not fire if 8.x and 9.x copies are bundled together.",
"packageName": "@fluentui/react-file-type-icons",
"email": "caperez@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "This branch showed lint problems when merged an unrelated commit, submitting with linter fix to ensure the GH Actions pass.",
"packageName": "@fluentui/react-headless-components-preview",
"email": "caperez@microsoft.com",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Add FileTypeIcon custom style hook key",
"packageName": "@fluentui/react-shared-contexts",
"email": "caperez@microsoft.com",
"dependentChangeType": "patch"
}
3 changes: 1 addition & 2 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@
"packages/utilities/**",
"packages/react-icons-mdl2/**",
"packages/react-monaco-editor/**",
"packages/react-docsite-components/**",
"packages/react-file-type-icons/**"
"packages/react-docsite-components/**"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const PLUGIN_NAME = 'storybook-stories-modifyImports';
*/
export function modifyImportsPlugin(babel: typeof Babel, options: BabelPluginOptions): Babel.PluginObj<PluginState> {
const { types: t } = babel;
const { importMappings } = options;
const importMappings = options.importMappings ?? {};
const cssModulesEnabled = Boolean(options.cssModules);

return {
Expand Down
30 changes: 30 additions & 0 deletions packages/react-components/react-file-type-icons/library/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"exclude": [
"/testing",
"/**/*.cy.ts",
"/**/*.cy.tsx",
"/**/*.spec.ts",
"/**/*.spec.tsx",
"/**/*.test.ts",
"/**/*.test.tsx"
],
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true,
"decorators": false,
"dynamicImport": false
},
"externalHelpers": true,
"transform": {
"react": {
"runtime": "classic",
"useSpread": true
}
},
"target": "es2019"
},
"minify": false,
"sourceMaps": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# @fluentui/react-file-type-icons

**File type icons for [Fluent UI React](https://react.fluentui.dev/)**

This package includes a collection of icons to represent file types.

## Getting started

If you are using the v8 `Icon` component or composing with icon-name utilities, you can make all file type icons available by calling the `initializeFileTypeIcons` function from the `@fluentui/react-file-type-icons` package:

```tsx
import { initializeFileTypeIcons } from '@fluentui/react-file-type-icons';

// Register icons and load assets from the default Microsoft Fluent CDN:
initializeFileTypeIcons();

// Or register icons and load assets from a different CDN or folder path:
initializeFileTypeIcons('https://my.cdn.com/path/to/icons/');
```

**NOTE:** Proceed carefully if you override the default CDN location, whose contents may not match the registered file type icons and supported extensions. Do not use the `item-types-fluent` icon set that was previously uploaded to the Fluent CDN; it's deprecated.

## Usage in code

If you are using Fluent UI React, you can use the `Icon` component and pass in the corresponding icon properties to render a given icon.

```tsx
import { Icon } from '@fluentui/react/lib/Icon';
import { getFileTypeIconProps } from '@fluentui/react-file-type-icons';

<Icon {...getFileTypeIconProps({ extension: 'docx', size: 16 })} />;
```

## FileTypeIcon component

`@fluentui/react-file-type-icons` is a Fluent UI React v9 package under the `react-components` package model. It also keeps the existing utility APIs for scenarios that still compose file icons manually.

This package also exports a `FileTypeIcon` React component that can be used directly without separately composing icon props or calling `initializeFileTypeIcons`.

```tsx
import { FileTypeIcon, FileIconType } from '@fluentui/react-file-type-icons';

<FileTypeIcon extension="docx" size={20} />;
<FileTypeIcon type={FileIconType.folder} imageFileType="png" size={32} />;
```

`FileTypeIcon` resolves icons through the same shared extension/type logic as `getFileTypeIconProps` to keep utility and component-based usage in sync.

## Notes

See [GitHub](https://github.com/microsoft/fluentui) for more details on the Fluent UI React project and packages within.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "@fluentui/scripts-api-extractor/api-extractor.common.v-next.json",
"mainEntryPointFilePath": "<projectRoot>/../../../../../../dist/out-tsc/types/packages/react-components/<unscopedPackageName>/library/src/index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/** Jest test setup file. */
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
## API Report File for "@fluentui/react-file-type-icons"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

import type { ComponentProps } from '@fluentui/react-utilities';
import type { ComponentState } from '@fluentui/react-utilities';
import type { ForwardRefComponent } from '@fluentui/react-utilities';
import type { JSXElement } from '@fluentui/react-utilities';
import * as React_2 from 'react';
import type { Slot } from '@fluentui/react-utilities';
import type { SlotClassNames } from '@fluentui/react-utilities';

// @public
export enum FileIconType {
// (undocumented)
album = 21,// Start at 1 so it will evaluate as "truthy"
// (undocumented)
campaign = 23,
// (undocumented)
desktopFolder = 9,
// (undocumented)
docset = 1,
// (undocumented)
documentsFolder = 10,
// (undocumented)
folder = 2,
// (undocumented)
form = 14,
// (undocumented)
genericFile = 3,
// (undocumented)
linkedFolder = 12,
// (undocumented)
list = 13,
// (undocumented)
listForm = 22,
// (undocumented)
listItem = 4,
// (undocumented)
loopworkspace = 17,
// (undocumented)
multiple = 6,
// (undocumented)
news = 8,
// (undocumented)
picturesFolder = 11,
// (undocumented)
planner = 18,
// (undocumented)
playlist = 16,
// (undocumented)
portfolio = 20,
// (undocumented)
sharedFolder = 5,
// (undocumented)
shortcutsdefaultfolder = 24,
// (undocumented)
stream = 7,
// (undocumented)
sway = 15,
// (undocumented)
todoItem = 19
}

// @public
export const FileTypeIcon: ForwardRefComponent<FileTypeIconProps>;

// @public (undocumented)
export const fileTypeIconClassNames: SlotClassNames<FileTypeIconSlots>;

// @public
export const FileTypeIconMap: {
[key: string]: {
extensions?: string[];
types?: FileIconType[];
};
};

// @public (undocumented)
export type FileTypeIconProps = Omit<ComponentProps<FileTypeIconSlots>, 'src'> & IFileTypeIconOptions & {
baseUrl?: string;
};

// @public (undocumented)
export type FileTypeIconSize = 16 | 20 | 24 | 32 | 40 | 48 | 64 | 96;

// @public (undocumented)
export type FileTypeIconSlots = {
root: Slot<'img'>;
};

// @public (undocumented)
export type FileTypeIconState = ComponentState<FileTypeIconSlots> & Required<Pick<IFileTypeIconOptions, 'size' | 'imageFileType'>> & {
baseUrl?: string;
iconName: string;
src?: string;
extension?: string;
type?: IFileTypeIconOptions['type'];
};

// @public
export function getFileTypeIconAsHTMLString(options: IFileTypeIconOptions, baseUrl?: string): string | undefined;

// @public
export function getFileTypeIconAsUrl(options: IFileTypeIconOptions, baseUrl?: string): string | undefined;

// @public
export function getFileTypeIconProps(options: IFileTypeIconOptions): {
iconName: string;
'aria-label'?: string;
};

// @public (undocumented)
export interface IFileTypeIconOptions {
extension?: string;
imageFileType?: ImageFileType;
size?: FileTypeIconSize;
type?: FileIconTypeInput;
}

// @public (undocumented)
export interface IIconOptions {
// (undocumented)
disableWarnings: boolean;
// (undocumented)
warnOnMissingIcons?: boolean;
}

// @public (undocumented)
export type ImageFileType = 'svg' | 'png';

// @public (undocumented)
export function initializeFileTypeIcons(baseUrl?: string, options?: Partial<IIconOptions>): void;

// @public
export const renderFileTypeIcon_unstable: (state: FileTypeIconState) => JSXElement;

// @public
export const useFileTypeIcon_unstable: (props: FileTypeIconProps, ref: React_2.Ref<HTMLImageElement>) => FileTypeIconState;

// @public (undocumented)
export const useFileTypeIconStyles_unstable: (state: FileTypeIconState) => FileTypeIconState;

// (No @packageDocumentation comment for this package)

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// @ts-check
/* eslint-disable */

const { readFileSync } = require('node:fs');
const { join } = require('node:path');

const { exclude: _, ...swcJestConfig } = JSON.parse(readFileSync(join(__dirname, '.swcrc'), 'utf-8'));

if (swcJestConfig.swcrc === undefined) {
swcJestConfig.swcrc = false;
}

/**
* @type {import('@jest/types').Config.InitialOptions}
*/
module.exports = {
displayName: 'react-file-type-icons',
preset: '../../../../jest.preset.js',
transform: {
'^.+\\.tsx?$': ['@swc/jest', swcJestConfig],
},
coverageDirectory: './coverage',
setupFilesAfterEnv: ['./config/tests.js'],
snapshotSerializers: ['@griffel/jest-serializer'],
};
Loading
Loading