Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(icons): add @fluentui/react-icons package #12608

Merged
merged 22 commits into from Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,8 @@
{
"type": "none",
"comment": "Minor prettier changes.",
"packageName": "@uifabric/experiments",
"email": "dzearing@microsoft.com",
"dependentChangeType": "none",
"date": "2020-04-13T16:18:43.499Z"
}
@@ -0,0 +1,8 @@
{
"type": "patch",
"comment": "Adding SVG icon examples",
"packageName": "office-ui-fabric-react",
"email": "dzearing@microsoft.com",
"dependentChangeType": "patch",
"date": "2020-04-13T16:19:23.983Z"
}
Expand Up @@ -23,7 +23,7 @@ export class UnifiedPeoplePickerPage extends React.Component<IComponentDemoPageP
require<
string
// tslint:disable-next-line:max-line-length
>('!raw-loader!@uifabric/experiments/src/components/UnifiedPicker/UnifiedPeoplePicker/UnifiedPeoplePicker.types.ts')
>('!raw-loader!@uifabric/experiments/src/components/UnifiedPicker/UnifiedPeoplePicker/UnifiedPeoplePicker.types.ts'),
]}
/>
}
Expand Down
Expand Up @@ -9,7 +9,7 @@ export interface IUnifiedPickerStyles {

const GlobalClassNames = {
pickerText: 'ms-UnifiedPicker-text',
pickerInput: 'ms-UnifiedPicker-input'
pickerInput: 'ms-UnifiedPicker-input',
};

export const getStyles = (props: IUnifiedPickerStyleProps): IUnifiedPickerStyles => {
Expand Down Expand Up @@ -37,10 +37,10 @@ export const getStyles = (props: IUnifiedPickerStyleProps): IUnifiedPickerStyles
minHeight: '32px',
selectors: {
'&:hover': {
borderColor: themeLight
}
}
}
borderColor: themeLight,
},
},
},
],
pickerInput: [
classNames.pickerInput,
Expand All @@ -53,10 +53,10 @@ export const getStyles = (props: IUnifiedPickerStyleProps): IUnifiedPickerStyles
margin: '1px',
selectors: {
'&::-ms-clear': {
display: 'none'
}
}
}
]
display: 'none',
},
},
},
],
};
};
1 change: 1 addition & 0 deletions packages/office-ui-fabric-react/package.json
Expand Up @@ -72,6 +72,7 @@
},
"dependencies": {
"@fluentui/react-focus": "^7.1.13",
"@fluentui/react-icons": "^0.1.0",
"@microsoft/load-themed-styles": "^1.10.26",
"@uifabric/foundation": "^7.5.25",
"@uifabric/icons": "^7.3.24",
Expand Down
Expand Up @@ -5,11 +5,13 @@ import { IDocPageProps } from '../../common/DocPage.types';
import { IconSvgExample } from './examples/Icon.Svg.Example';
import { IconColorExample } from './examples/Icon.Color.Example';
import { IconImageSheetExample } from './examples/Icon.ImageSheet.Example';
import { IconSvgFactoryExample } from './examples/Icon.SvgFactory.Example';

const IconBasicExampleCode = require('!raw-loader!office-ui-fabric-react/src/components/Icon/examples/Icon.Basic.Example.tsx') as string;
const IconSvgExampleCode = require('!raw-loader!office-ui-fabric-react/src/components/Icon/examples/Icon.Svg.Example.tsx') as string;
const IconColorExampleCode = require('!raw-loader!office-ui-fabric-react/src/components/Icon/examples/Icon.Color.Example.tsx') as string;
const IconImageSheetExampleCode = require('!raw-loader!office-ui-fabric-react/src/components/Icon/examples/Icon.ImageSheet.Example.tsx') as string;
const IconSvgFactoryExampleCode = require('!raw-loader!office-ui-fabric-react/src/components/Icon/examples/Icon.SvgFactory.Example.tsx') as string;

export const IconPageProps: IDocPageProps = {
title: 'Icon',
Expand All @@ -36,6 +38,11 @@ export const IconPageProps: IDocPageProps = {
code: IconImageSheetExampleCode,
view: <IconImageSheetExample />,
},
{
title: 'Icon using svg factory',
code: IconSvgFactoryExampleCode,
view: <IconSvgFactoryExample />,
},
],
overview: require<string>('!raw-loader!office-ui-fabric-react/src/components/Icon/docs/IconOverview.md'),
bestPractices: '',
Expand Down
@@ -0,0 +1,24 @@
import * as React from 'react';
import { OneDriveIcon, YammerIcon, BorderBlindsIcon } from '@fluentui/react-icons';
import { mergeStyles } from 'office-ui-fabric-react/lib/Styling';

const rootClass = mergeStyles({
display: 'flex',
selectors: {
'> *': {
height: 50,
width: 50,
marginRight: 25,
},
},
});

export const IconSvgFactoryExample: React.FunctionComponent = () => {
return (
<div className={rootClass}>
<OneDriveIcon />
<YammerIcon />
<BorderBlindsIcon color3="pink" />
</div>
);
};
@@ -0,0 +1,104 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Component Examples renders Icon.SvgFactory.Example.tsx correctly 1`] = `
<div
className=

{
display: flex;
}
& > * {
height: 50px;
margin-right: 25px;
width: 50px;
}
>
<span
aria-hidden={true}
className=


role="presentation"
style={Object {}}
>
<svg
className=

{
height: 100%;
width: 100%;
}
viewBox="0,0,2048,2048"
xmlns="http://www.w3.org/2000/svg"
>
<g
fill="#1B559B"
>
<path
d="M 1860 1196 q 53 10 94 37 q 18 12 35 29 q 16 16 30 40 q 13 23 21 53 q 8 30 8 68 q 0 37 -10 75 q -11 38 -34 69 q -23 31 -58 51 q -36 20 -86 20 h -1079 q -78 0 -131 -24 q -54 -25 -87 -65 q -34 -40 -49 -91 q -15 -52 -15 -107 q 0 -46 12 -81 q 11 -35 31 -61 q 19 -27 43 -45 q 24 -19 50 -31 q 60 -29 136 -35 q 0 -1 4 -26 q 3 -25 16 -61 q 12 -37 36 -80 q 24 -43 64 -79 q 39 -37 98 -61 q 59 -25 141 -25 q 57 0 103 15 q 45 15 81 38 q 35 23 62 52 q 26 28 44 55 q 18 -10 42 -18 q 20 -7 48 -12 q 27 -6 60 -6 q 40 0 91 15 q 50 14 94 48 q 44 33 75 88 q 30 55 30 136 m -1463 174 q 0 53 10 99 q 10 46 29 86 h -170 q -52 0 -100 -23 q -48 -23 -85 -61 q -37 -38 -59 -87 q -22 -50 -22 -104 q 0 -49 11 -87 q 10 -38 27 -66 q 17 -29 39 -49 q 21 -21 44 -35 q 53 -33 121 -41 q -1 -9 -1 -18 q -1 -9 -1 -17 q 0 -72 27 -134 q 27 -63 73 -110 q 45 -47 106 -74 q 60 -27 127 -27 q 36 0 66 7 q 29 6 51 14 q 25 10 45 21 q 27 -48 65 -89 q 37 -41 84 -71 q 46 -30 101 -47 q 55 -17 115 -17 q 39 0 80 8 q 41 7 83 24 q 72 28 121 71 q 49 42 81 90 q 32 47 49 94 q 16 46 22 82 q -23 2 -43 5 q -21 3 -40 8 q -66 -69 -148 -104 q -82 -36 -177 -36 q -76 0 -136 17 q -60 17 -106 45 q -47 28 -81 64 q -34 36 -58 75 q -24 38 -39 76 q -15 37 -23 67 q -51 12 -102 38 q -52 26 -93 68 q -42 42 -67 101 q -26 59 -26 137"
/>
</g>
</svg>
</span>
<span
aria-hidden={true}
className=


role="presentation"
style={Object {}}
>
<svg
className=

{
height: 100%;
width: 100%;
}
viewBox="0,0,2048,2048"
xmlns="http://www.w3.org/2000/svg"
>
<g>
<path
d="M 1887 888 q 33 8 54 34 q 21 26 21 61 q 0 35 -22 62 q -23 26 -57 31 q -57 0 -121 -2 q -64 -3 -128 -7 q -64 -5 -122 -11 q -59 -7 -104 -16 q -45 -9 -72 -20 q -27 -12 -27 -26 q 0 -13 37 -26 q 37 -13 94 -24 q 57 -12 126 -22 q 68 -11 131 -18 q 63 -8 112 -12 q 48 -4 66 -4 m -163 549 q 17 14 26 34 q 9 20 9 41 q 0 21 -8 39 q -8 17 -21 30 q -14 13 -31 20 q -17 7 -36 7 q -10 0 -18 -2 q -8 -2 -19 -8 q -15 -8 -54 -34 q -39 -26 -88 -61 q -50 -35 -104 -76 q -54 -41 -98 -78 q -45 -37 -74 -67 q -29 -30 -29 -44 q 0 -8 9 -10 q 8 -3 19 -3 q 22 0 57 9 q 34 9 77 25 q 42 15 91 36 q 48 20 98 44 q 50 23 100 49 q 49 25 94 49 m 0 -901 q -67 37 -144 75 q -77 38 -149 69 q -73 30 -132 50 q -60 19 -93 19 q -11 0 -19 -2 q -8 -3 -8 -10 q 0 -14 29 -44 q 29 -30 74 -67 q 44 -38 98 -78 q 54 -41 104 -76 q 49 -36 88 -62 q 39 -26 54 -34 q 11 -6 20 -8 q 8 -2 18 -2 q 18 0 36 8 q 17 7 30 20 q 13 12 21 30 q 8 17 8 38 q 0 21 -9 41 q -9 19 -26 33 m -1191 823 l -430 -1051 q -6 -16 -6 -33 q 0 -20 8 -38 q 7 -19 21 -33 q 13 -15 33 -24 q 19 -9 42 -9 q 30 0 56 16 q 26 16 40 44 l 343 866 h 4 l 326 -860 q 11 -29 37 -46 q 25 -18 56 -18 q 22 0 40 9 q 18 8 31 22 q 13 13 21 31 q 7 17 7 36 q 0 14 -5 31 l -462 1154 q -30 74 -62 136 q -32 62 -76 107 q -44 44 -105 69 q -62 24 -151 24 q -28 0 -57 -2 q -30 -3 -54 -12 q -24 -10 -39 -28 q -16 -19 -16 -52 q 0 -21 8 -38 q 8 -17 21 -29 q 13 -12 30 -18 q 17 -6 35 -6 q 1 0 9 1 q 7 0 17 1 q 10 0 19 1 q 9 0 14 0 q 48 0 84 -15 q 36 -15 65 -46 q 28 -31 51 -78 q 22 -48 45 -112"
/>
</g>
</svg>
</span>
<span
aria-hidden={true}
className=


role="presentation"
style={Object {}}
>
<svg
className=

{
height: 100%;
width: 100%;
}
viewBox="0 0 40 40"
>
<g
transform="scale(0.03125 0.03125)"
>
<path
d="M0 192l320-128v768l-320 128z"
fill="red"
/>
<path
d="M384 32l320 192v736l-320-160z"
fill="green"
/>
<path
d="M768 224l256-192v768l-256 192z"
fill="pink"
/>
</g>
</svg>
</span>
</div>
`;
Expand Up @@ -12,6 +12,6 @@ export function updateT(color: IColor, t: number): IColor {
...color,
t,
a,
str: _rgbaOrHexString(color.r, color.g, color.b, a, color.hex)
str: _rgbaOrHexString(color.r, color.g, color.b, a, color.hex),
};
}
32 changes: 32 additions & 0 deletions packages/react-icons/.npmignore
@@ -0,0 +1,32 @@
*.api.json
*.config.js
*.log
*.nuspec
*.test.*
*.yml
.editorconfig
.gitattributes
.gitignore
.vscode
coverage
dist-storybook
dist/*.stats.html
dist/*.stats.json
dist/demo*.*
fabric-test*
gulpfile.js
images
index.html
jsconfig.json
node_modules
results
src/**/*
!src/**/examples/*.tsx
!src/**/docs/**/*.md
!src/**/*.types.ts
temp
tsconfig.json
tsd.json
tslint.json
typings
visualtests
2 changes: 2 additions & 0 deletions packages/react-icons/.npmrc
@@ -0,0 +1,2 @@
registry=https://registry.npmjs.org/

8 changes: 8 additions & 0 deletions packages/react-icons/.storybook/main.js
@@ -0,0 +1,8 @@
const custom = require('@uifabric/build/storybook/webpack.config');

module.exports = {
webpackFinal: config => {
return custom({ config });
},
addons: ['@storybook/addon-a11y/register'],
};
6 changes: 6 additions & 0 deletions packages/react-icons/.storybook/manager.js
@@ -0,0 +1,6 @@
import { addons } from '@storybook/addons';

addons.setConfig({
showPanel: true,
panelPosition: 'right',
});
25 changes: 25 additions & 0 deletions packages/react-icons/.storybook/preview.js
@@ -0,0 +1,25 @@
import generateStoriesFromExamples from '@uifabric/build/storybook/generateStoriesFromExamples';
import { configure, addParameters, addDecorator } from '@storybook/react';
import { withA11y } from '@storybook/addon-a11y';

addDecorator(withA11y());
addParameters({
a11y: {
manual: true,
},
});

const req = require.context('../src/components', true, /\.stories\.tsx$/);

function loadStories() {
const stories = new Map();

req.keys().forEach(key => {
generateStoriesFromExamples({ key, req, stories });
});

// convert stories Set to array
return [...stories.values()];
}

configure(loadStories, module);
15 changes: 15 additions & 0 deletions packages/react-icons/LICENSE
@@ -0,0 +1,15 @@
@fluentui/react-icons

Copyright (c) Microsoft Corporation

All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note: Usage of the fonts and icons referenced in Fluent UI React is subject to the terms listed at https://aka.ms/fluentui-assets-license
11 changes: 11 additions & 0 deletions packages/react-icons/README.md
@@ -0,0 +1,11 @@
# @fluentui/react-icons

**Icon components for [Fluent UI React](https://developer.microsoft.com/en-us/fluentui)**

This package provides utilities for creating svg icons, as well as set of customizable Icons.

To import ReactIcons components:

```js
import { ComponentName } from '@fluentui/react-icons';
```
12 changes: 12 additions & 0 deletions packages/react-icons/config/tests.js
@@ -0,0 +1,12 @@
/** Jest test setup file. */

const { configure } = require('enzyme');
const Adapter = require('enzyme-adapter-react-16');

// Mock requestAnimationFrame for React 16+.
global.requestAnimationFrame = callback => {
setTimeout(callback, 0);
};

// Configure enzyme.
configure({ adapter: new Adapter() });
12 changes: 12 additions & 0 deletions packages/react-icons/jest.config.js
@@ -0,0 +1,12 @@
let { createConfig, resolveMergeStylesSerializer } = require('@uifabric/build/jest/jest-resources');
let path = require('path');

const config = createConfig({
setupFiles: [path.resolve(path.join(__dirname, 'config', 'tests.js'))],

moduleNameMapper: {},

snapshotSerializers: [resolveMergeStylesSerializer()],
});

module.exports = config;
3 changes: 3 additions & 0 deletions packages/react-icons/just.config.ts
@@ -0,0 +1,3 @@
const { preset } = require('@uifabric/build');

preset();