Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"apps/*",
"packages/*",
"packages/react-components/*",
"packages/react-components-migration/*",
"scripts",
"packages/fluentui/*",
"tools",
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@
"packages/*",
"packages/fluentui/*",
"packages/react-components/*",
"packages/react-components-migration/*",
"scripts",
"tools",
"typings"
Expand Down Expand Up @@ -344,6 +345,7 @@
"apps/![react-18-tests-v8][react-18-tests-v9]/package.json",
"packages/!(web-components)/package.json",
"packages/react-components/*/package.json",
"packages/react-components-migration/*/package.json",
"packages/fluentui/*/package.json",
"scripts/package.json"
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const rootMain = require('../../../../.storybook/main');

module.exports = /** @type {Omit<import('../../../../.storybook/main'), 'typescript'|'babel'>} */ ({
...rootMain,
stories: [...rootMain.stories, '../src/**/*.stories.mdx', '../src/**/index.stories.@(ts|tsx)'],
addons: [...rootMain.addons],
webpackFinal: (config, options) => {
const localConfig = { ...rootMain.webpackFinal(config, options) };

// add your own webpack tweaks if needed

return localConfig;
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as rootPreview from '../../../../.storybook/preview';

/** @type {typeof rootPreview.decorators} */
export const decorators = [...rootPreview.decorators];

/** @type {typeof rootPreview.parameters} */
export const parameters = { ...rootPreview.parameters };
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "",
"allowJs": true,
"checkJs": true,
"types": ["static-assets", "environment", "storybook__addons"]
},
"include": ["../src/**/*.stories.ts", "../src/**/*.stories.tsx", "*.js"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"enabled": true,
"untrimmedFilePath": "",
"publicTrimmedFilePath": "<projectFolder>/dist/index.d.ts"
}
},
"mainEntryPointFilePath": "<projectFolder>/../../../dist/out-tsc/types/packages/react-components-migration/<unscopedPackageName>/src/index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## API Report File for "@fluentui/react-button-shim-v8-v9"

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

```ts

import { ButtonProps } from '@fluentui/react-components';
import { IBaseButtonProps } from '@fluentui/react';
import { IButtonProps } from '@fluentui/react';
import * as React_2 from 'react';

// @public
const ActionButtonShim: React_2.ForwardRefExoticComponent<IButtonProps & React_2.RefAttributes<HTMLButtonElement>>;
export { ActionButtonShim }
export { ActionButtonShim as CommandButtonShim }

// @public (undocumented)
export const ButtonShim: React_2.ForwardRefExoticComponent<IBaseButtonProps & React_2.RefAttributes<HTMLButtonElement>>;

// @public
export const CompoundButtonShim: React_2.ForwardRefExoticComponent<IButtonProps & React_2.RefAttributes<HTMLButtonElement>>;

// @public
export const DefaultButtonShim: React_2.ForwardRefExoticComponent<IButtonProps & React_2.RefAttributes<HTMLButtonElement>>;

// @public (undocumented)
export const MenuButtonShim: React_2.ForwardRefExoticComponent<IButtonProps & React_2.RefAttributes<HTMLButtonElement>>;

// @public
export const PrimaryButtonShim: React_2.ForwardRefExoticComponent<IButtonProps & React_2.RefAttributes<HTMLButtonElement>>;

// @public (undocumented)
export const shimButtonProps: (props: IBaseButtonProps & React_2.RefAttributes<HTMLButtonElement>) => ButtonProps;

// @public
export const ToggleButtonShim: React_2.ForwardRefExoticComponent<IButtonProps & React_2.RefAttributes<HTMLButtonElement>>;

// (No @packageDocumentation comment for this package)

```
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"lint": "just-scripts lint",
"test": "jest --passWithNoTests",
"generate-api": "tsc -p ./tsconfig.lib.json --emitDeclarationOnly && just-scripts api-extractor",
"type-check": "tsc -b tsconfig.json"
"type-check": "tsc -b tsconfig.json",
"storybook": "start-storybook",
"start": "yarn storybook"
},
"devDependencies": {
"@fluentui/eslint-plugin": "*",
Expand All @@ -29,6 +31,9 @@
"@fluentui/scripts": "^1.0.0"
},
"dependencies": {
"@fluentui/react": "^8.97.1",
"@fluentui/react-components": "^9.4.0",
"@fluentui/react-menu-shim-v8-v9": "9.0.0-alpha.0",
"@fluentui/react-theme": "^9.1.0",
"@fluentui/react-utilities": "^9.1.0",
"@griffel/react": "^1.3.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './components/ActionButtonShim/index';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './components/ButtonShim/index';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './components/CommandButtonShim/index';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './components/CompoundButtonShim/index';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './components/DefaultButtonShim/index';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './components/MenuButtonShim/index';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './components/PrimaryButtonShim/index';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './components/ToggleButtonShim/index';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { ActionButtonShim } from './ActionButtonShim';

describe('ActionButtonShim', () => {
// TODO add more tests here, and create visual regression tests in /apps/vr-tests

it('renders a default state', () => {
const result = render(<ActionButtonShim>Default ActionButtonShim</ActionButtonShim>);
expect(result.container).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as React from 'react';

import { IButtonProps } from '@fluentui/react';

import { Button } from '@fluentui/react-components';

import { shimButtonProps } from '../../shimButtonProps';

/**
* Shims a v8 ActionButton to render a v9 Button
*/
export const ActionButtonShim: React.ForwardRefExoticComponent<
IButtonProps & React.RefAttributes<HTMLButtonElement>
> = React.forwardRef((props, _ref) => {
const variantProps = {
...props,
variantClassName: 'ms-Button--action ms-Button--command',
};

const shimProps = shimButtonProps(variantProps);

return <Button {...(props as React.RefAttributes<HTMLButtonElement>)} {...shimProps} appearance="transparent" />;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ActionButtonShim renders a default state 1`] = `
<div>
<button
class="fui-Button ms-Button--primary"
type="button"
>
Default ActionButtonShim
</button>
</div>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './ActionButtonShim';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { ButtonShim } from './ButtonShim';

describe('ButtonShim', () => {
// TODO add more tests here, and create visual regression tests in /apps/vr-tests

it('renders a default state', () => {
const result = render(<ButtonShim>Default ButtonShim</ButtonShim>);
expect(result.container).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as React from 'react';

import { IBaseButtonProps } from '@fluentui/react';

import { Button } from '@fluentui/react-components';

import { shimButtonProps } from '../../shimButtonProps';
import { ToggleButtonShim } from '../ToggleButtonShim';
import { CompoundButtonShim } from '../CompoundButtonShim';

export const ButtonShim: React.ForwardRefExoticComponent<
IBaseButtonProps & React.RefAttributes<HTMLButtonElement>
> = React.forwardRef((props, _ref) => {
const shimProps = shimButtonProps(props);

if (props.toggle) {
return <ToggleButtonShim {...props}>{props.children}</ToggleButtonShim>;
}
if (props.secondaryText || props.onRenderDescription?.(props)) {
return <CompoundButtonShim {...props} />;
}

return <Button {...(props as React.RefAttributes<HTMLButtonElement>)} {...shimProps} />;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ButtonShim renders a default state 1`] = `
<div>
<button
class="fui-Button ms-Button--default"
type="button"
>
Default ButtonShim
</button>
</div>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './ButtonShim';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { CommandButtonShim } from './CommandButtonShim';

describe('CommandButtonShim', () => {
// TODO add more tests here, and create visual regression tests in /apps/vr-tests

it('renders a default state', () => {
const result = render(<CommandButtonShim>Default CommandButtonShim</CommandButtonShim>);
expect(result.container).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Shims v8 CommandButtonShim to render a v9 Button
*/
export { ActionButtonShim as CommandButtonShim } from '../ActionButtonShim';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CommandButtonShim renders a default state 1`] = `
<div>
<button
class="fui-Button ms-Button--primary"
type="button"
>
Default CommandButtonShim
</button>
</div>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './CommandButtonShim';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { CompoundButtonShim } from './CompoundButtonShim';

describe('CompoundButtonShim', () => {
// TODO add more tests here, and create visual regression tests in /apps/vr-tests

it('renders a default state', () => {
const result = render(<CompoundButtonShim>Default CompoundButtonShim</CompoundButtonShim>);
expect(result.container).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as React from 'react';

import { IButtonProps } from '@fluentui/react';

import { CompoundButton, CompoundButtonProps } from '@fluentui/react-components';

import { shimButtonProps } from '../../shimButtonProps';

/**
* Shims v8 CompoundButton to render a v9 CompoundButton
*/
export const CompoundButtonShim: React.ForwardRefExoticComponent<
IButtonProps & React.RefAttributes<HTMLButtonElement>
> = React.forwardRef((props, _ref) => {
const variantProps = {
...props,
variantClassName: props.primary ? 'ms-Button--compoundPrimary' : 'ms-Button--compound',
};

const shimProps: CompoundButtonProps = {
...shimButtonProps(variantProps),
secondaryContent: props.secondaryText || props.onRenderDescription?.(props),
};

return <CompoundButton {...(props as React.RefAttributes<HTMLButtonElement>)} {...shimProps} />;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CompoundButtonShim renders a default state 1`] = `
<div>
<button
class="fui-Button fui-CompoundButton ms-Button--primary"
type="button"
>
<span
class="fui-CompoundButton__contentContainer"
>
Default CompoundButtonShim
</span>
</button>
</div>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './CompoundButtonShim';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { DefaultButtonShim } from './DefaultButtonShim';

describe('DefaultButtonShim', () => {
// TODO add more tests here, and create visual regression tests in /apps/vr-tests

it('renders a default state', () => {
const result = render(<DefaultButtonShim>Default DefaultButtonShim</DefaultButtonShim>);
expect(result.container).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as React from 'react';

import { IButtonProps } from '@fluentui/react';

import { ButtonShim } from '../ButtonShim';

/**
* Shims a v8 DefaultButton to render a v9 Button
*/
export const DefaultButtonShim: React.ForwardRefExoticComponent<
IButtonProps & React.RefAttributes<HTMLButtonElement>
> = React.forwardRef((props, _ref) => {
return <ButtonShim {...props} variantClassName={props.primary ? 'ms-Button--primary' : 'ms-Button--default'} />;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`DefaultButtonShim renders a default state 1`] = `
<div>
<button
class="fui-Button ms-Button--primary"
type="button"
>
Default DefaultButtonShim
</button>
</div>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './DefaultButtonShim';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { MenuButtonShim } from './MenuButtonShim';

describe('MenuButtonShim', () => {
// TODO add more tests here, and create visual regression tests in /apps/vr-tests

it('renders a default state', () => {
const result = render(<MenuButtonShim id="test">Default MenuButtonShim</MenuButtonShim>);
expect(result.container).toMatchSnapshot();
});
});
Loading