-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
react-avatar: migration to new DX (#18866)
* DX migration: partial fix of Storybook issues * DX migration: partial fix of Storybook * Fixes for avatar storybook: Avatar Playground story * Change files * Fix for the Avatar Playground stories Co-authored-by: André <[email protected]> * Added fixes for build errors * Added api report file: etc/react-avatar.api.md * Changed description of props in ActiveAnimation story * Deleted @fluentui-react-examples change file Co-authored-by: André <[email protected]>
- Loading branch information
1 parent
33094c2
commit bafb9f1
Showing
19 changed files
with
486 additions
and
123 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-avatar-cfc81652-43b6-45e0-a231-4ae3f52e51f1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "none", | ||
"comment": "react-avatar: migration to new DX", | ||
"packageName": "@fluentui/react-avatar", | ||
"email": "[email protected]", | ||
"dependentChangeType": "none" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const rootMain = require('../../../.storybook/main'); | ||
|
||
module.exports = /** @type {Pick<import('../../../.storybook/main').StorybookConfig,'addons'|'stories'|'webpackFinal'>} */ ({ | ||
stories: [...rootMain.stories, '../src/**/*.stories.mdx', '../src/**/*.stories.@(ts|tsx)'], | ||
addons: [...rootMain.addons], | ||
webpackFinal: (config, options) => { | ||
const localConfig = { ...rootMain.webpackFinal(config, options) }; | ||
|
||
return localConfig; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import * as rootPreview from '../../../.storybook/preview'; | ||
|
||
export const decorators = [...rootPreview.decorators]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"checkJs": true | ||
}, | ||
"exclude": ["../**/*.test.ts", "../**/*.test.js", "../**/*.test.tsx", "../**/*.test.jsx"], | ||
"include": ["../src/**/*", "*.js"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", | ||
"extends": "@fluentui/scripts/api-extractor/api-extractor.common.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": "./api-extractor.json", | ||
"mainEntryPointFilePath": "<projectFolder>/dist/<unscopedPackageName>/src/index.d.ts" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
## API Report File for "@fluentui/react-avatar" | ||
|
||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). | ||
```ts | ||
|
||
import { ComponentPropsCompat } from '@fluentui/react-utilities'; | ||
import { ComponentStateCompat } from '@fluentui/react-utilities'; | ||
import { PresenceBadgeProps } from '@fluentui/react-badge'; | ||
import { PresenceBadgeStatus } from '@fluentui/react-badge'; | ||
import * as React_2 from 'react'; | ||
import { ShorthandPropsCompat } from '@fluentui/react-utilities'; | ||
|
||
// @public (undocumented) | ||
export const Avatar: React_2.ForwardRefExoticComponent<AvatarProps & React_2.RefAttributes<HTMLElement>>; | ||
|
||
// @public | ||
export type AvatarDefaultedProps = 'size' | 'color' | 'activeDisplay' | 'getInitials' | 'label'; | ||
|
||
// @public | ||
export type AvatarNamedColor = 'darkRed' | 'cranberry' | 'red' | 'pumpkin' | 'peach' | 'marigold' | 'gold' | 'brass' | 'brown' | 'forest' | 'seafoam' | 'darkGreen' | 'lightTeal' | 'teal' | 'steel' | 'blue' | 'royalBlue' | 'cornflower' | 'navy' | 'lavender' | 'purple' | 'grape' | 'lilac' | 'pink' | 'magenta' | 'plum' | 'beige' | 'mink' | 'platinum' | 'anchor'; | ||
|
||
// @public (undocumented) | ||
export interface AvatarProps extends ComponentPropsCompat, React_2.HTMLAttributes<HTMLElement> { | ||
active?: 'active' | 'inactive' | 'unset'; | ||
activeDisplay?: 'ring' | 'shadow' | 'glow' | 'ring-shadow' | 'ring-glow'; | ||
badge?: PresenceBadgeStatus | Exclude<ShorthandPropsCompat<PresenceBadgeProps>, string>; | ||
color?: 'neutral' | 'brand' | 'colorful' | AvatarNamedColor; | ||
getInitials?: (name: string, isRtl: boolean) => string; | ||
icon?: ShorthandPropsCompat<React_2.HTMLAttributes<HTMLElement>>; | ||
idForColor?: string; | ||
image?: ShorthandPropsCompat<React_2.ImgHTMLAttributes<HTMLImageElement>>; | ||
label?: ShorthandPropsCompat<React_2.HTMLAttributes<HTMLElement>>; | ||
name?: string; | ||
size?: AvatarSizeValue; | ||
square?: boolean; | ||
} | ||
|
||
// @public | ||
export type AvatarShorthandPropsCompat = 'label' | 'image' | 'badge'; | ||
|
||
// @public | ||
export const avatarShorthandPropsCompat: AvatarShorthandPropsCompat[]; | ||
|
||
// @public | ||
export type AvatarSizeValue = 20 | 24 | 28 | 32 | 36 | 40 | 48 | 56 | 64 | 72 | 96 | 120 | 128; | ||
|
||
// @public (undocumented) | ||
export interface AvatarState extends ComponentStateCompat<AvatarProps, AvatarShorthandPropsCompat, AvatarDefaultedProps> { | ||
ref: React_2.Ref<HTMLElement>; | ||
} | ||
|
||
// @public (undocumented) | ||
export const renderAvatar: (state: AvatarState) => JSX.Element; | ||
|
||
// @public (undocumented) | ||
export const useAvatar: (props: AvatarProps, ref: React_2.Ref<HTMLElement>, defaultProps?: AvatarProps | undefined) => AvatarState; | ||
|
||
// @public (undocumented) | ||
export const useAvatarStyles: (state: AvatarState) => AvatarState; | ||
|
||
|
||
// (No @packageDocumentation comment for this package) | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
const { createConfig } = require('@fluentui/scripts/jest/jest-resources'); | ||
const path = require('path'); | ||
// @ts-check | ||
|
||
const config = createConfig({ | ||
setupFiles: [path.resolve(path.join(__dirname, 'config', 'tests.js'))], | ||
/** | ||
* @type {jest.InitialOptions} | ||
*/ | ||
module.exports = { | ||
displayName: 'react-avatar', | ||
preset: '../../jest.preset.js', | ||
globals: { | ||
'ts-jest': { | ||
tsConfig: '<rootDir>/tsconfig.json', | ||
diagnostics: false, | ||
}, | ||
}, | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest', | ||
}, | ||
coverageDirectory: './coverage', | ||
setupFilesAfterEnv: ['./config/tests.js'], | ||
snapshotSerializers: ['@fluentui/jest-serializer-make-styles'], | ||
}); | ||
|
||
module.exports = config; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.