Skip to content

Commit

Permalink
docs: fix config for import rewrites for Storybook export (microsoft#…
Browse files Browse the repository at this point in the history
  • Loading branch information
layershifter authored Jan 23, 2023
1 parent c075fab commit 86a28f6
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "docs: update imports in DataGrid stories",
"packageName": "@fluentui/react-table",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ import {
VideoRegular,
} from '@fluentui/react-icons';
import { PresenceBadgeStatus, Avatar, Checkbox } from '@fluentui/react-components';
import { TableCellLayout } from '@fluentui/react-components/unstable';
import {
DataGridBody,
DataGridRow,
DataGrid,
DataGridHeader,
DataGridHeaderCell,
DataGridCell,
TableCellLayout,
TableColumnDefinition,
TableRowData,
createTableColumn,
TableRowId,
DataGridProps,
} from '@fluentui/react-table';
} from '@fluentui/react-components/unstable';

type FileCell = {
label: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
>
> ```jsx
>
> import { Table } from '@fluentui/react-components/unstable';
> import { DataGrid } from '@fluentui/react-components/unstable';
>
> ```
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ import {
VideoRegular,
} from '@fluentui/react-icons';
import { PresenceBadgeStatus, Avatar } from '@fluentui/react-components';
import { TableCellLayout } from '@fluentui/react-components/unstable';
import {
DataGridBody,
DataGridRow,
DataGrid,
DataGridHeader,
DataGridHeaderCell,
DataGridCell,
TableCellLayout,
TableColumnDefinition,
createTableColumn,
} from '@fluentui/react-table';
} from '@fluentui/react-components/unstable';

type FileCell = {
label: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ import {
VideoRegular,
} from '@fluentui/react-icons';
import { PresenceBadgeStatus, Avatar } from '@fluentui/react-components';
import { TableCellLayout } from '@fluentui/react-components/unstable';
import {
DataGridBody,
DataGridRow,
DataGrid,
DataGridHeader,
DataGridHeaderCell,
DataGridCell,
TableCellLayout,
TableColumnDefinition,
createTableColumn,
} from '@fluentui/react-table';
} from '@fluentui/react-components/unstable';

type FileCell = {
label: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import {
VideoRegular,
} from '@fluentui/react-icons';
import { PresenceBadgeStatus, Avatar } from '@fluentui/react-components';
import { TableCellLayout } from '@fluentui/react-components/unstable';
import {
DataGridBody,
DataGridRow,
DataGrid,
DataGridHeader,
DataGridHeaderCell,
DataGridCell,
TableCellLayout,
TableColumnDefinition,
createTableColumn,
TableRowId,
DataGridProps,
} from '@fluentui/react-table';
} from '@fluentui/react-components/unstable';

type FileCell = {
label: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ import {
VideoRegular,
} from '@fluentui/react-icons';
import { PresenceBadgeStatus, Avatar } from '@fluentui/react-components';
import { TableCellLayout } from '@fluentui/react-components/unstable';
import {
DataGridBody,
DataGridRow,
DataGrid,
DataGridHeader,
DataGridHeaderCell,
DataGridCell,
TableCellLayout,
TableColumnDefinition,
createTableColumn,
} from '@fluentui/react-table';
} from '@fluentui/react-components/unstable';

type FileCell = {
label: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ import {
VideoRegular,
} from '@fluentui/react-icons';
import { PresenceBadgeStatus, Avatar } from '@fluentui/react-components';
import { TableCellLayout } from '@fluentui/react-components/unstable';
import {
DataGridBody,
DataGridRow,
DataGrid,
DataGridHeader,
DataGridHeaderCell,
DataGridCell,
TableCellLayout,
TableColumnDefinition,
createTableColumn,
} from '@fluentui/react-table';
} from '@fluentui/react-components/unstable';

type FileCell = {
label: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ import {
VideoRegular,
} from '@fluentui/react-icons';
import { PresenceBadgeStatus, Avatar } from '@fluentui/react-components';
import { TableCellLayout } from '@fluentui/react-components/unstable';
import {
DataGridBody,
DataGridRow,
DataGrid,
DataGridHeader,
DataGridHeaderCell,
DataGridCell,
TableCellLayout,
TableColumnDefinition,
createTableColumn,
} from '@fluentui/react-table';
} from '@fluentui/react-components/unstable';

type FileCell = {
label: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import {
VideoRegular,
} from '@fluentui/react-icons';
import { PresenceBadgeStatus, Avatar } from '@fluentui/react-components';
import { TableCellLayout } from '@fluentui/react-components/unstable';
import {
DataGridBody,
DataGridRow,
DataGrid,
DataGridHeader,
DataGridHeaderCell,
DataGridCell,
TableCellLayout,
TableColumnDefinition,
createTableColumn,
TableRowId,
DataGridProps,
} from '@fluentui/react-table';
} from '@fluentui/react-components/unstable';

type FileCell = {
label: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ import {
VideoRegular,
} from '@fluentui/react-icons';
import { PresenceBadgeStatus, Avatar } from '@fluentui/react-components';
import { TableCellLayout } from '@fluentui/react-components/unstable';
import {
DataGridBody,
DataGridRow,
DataGrid,
DataGridProps,
DataGridHeader,
DataGridHeaderCell,
DataGridCell,
TableCellLayout,
TableColumnDefinition,
createTableColumn,
} from '@fluentui/react-table';
import { SortState } from '../../src/hooks/types';
} from '@fluentui/react-components/unstable';

type FileCell = {
label: string;
Expand Down Expand Up @@ -149,7 +149,10 @@ const columns: TableColumnDefinition<Item>[] = [
];

export const Sort = () => {
const defaultSortState = React.useMemo<SortState>(() => ({ sortColumn: 'file', sortDirection: 'ascending' }), []);
const defaultSortState = React.useMemo<Parameters<NonNullable<DataGridProps['onSortChange']>>[1]>(
() => ({ sortColumn: 'file', sortDirection: 'ascending' }),
[],
);

return (
<DataGrid items={items} columns={columns} sortable defaultSortState={defaultSortState}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ import {
VideoRegular,
} from '@fluentui/react-icons';
import { PresenceBadgeStatus, Avatar } from '@fluentui/react-components';
import { TableCellLayout } from '@fluentui/react-components/unstable';
import {
DataGridBody,
DataGridRow,
DataGrid,
DataGridHeader,
DataGridHeaderCell,
DataGridCell,
TableCellLayout,
TableColumnDefinition,
createTableColumn,
DataGridProps,
} from '@fluentui/react-table';
import { SortState } from '../../src/hooks/types';
} from '@fluentui/react-components/unstable';

type FileCell = {
label: string;
Expand Down Expand Up @@ -150,7 +149,10 @@ const columns: TableColumnDefinition<Item>[] = [
];

export const SortControlled = () => {
const [sortState, setSortState] = React.useState<SortState>({ sortColumn: 'file', sortDirection: 'ascending' });
const [sortState, setSortState] = React.useState<Parameters<NonNullable<DataGridProps['onSortChange']>>[1]>({
sortColumn: 'file',
sortDirection: 'ascending',
});
const onSortChange: DataGridProps['onSortChange'] = (e, nextSortState) => {
setSortState(nextSortState);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ import {
VideoRegular,
} from '@fluentui/react-icons';
import { PresenceBadgeStatus, Avatar } from '@fluentui/react-components';
import { TableCellLayout } from '@fluentui/react-components/unstable';
import {
DataGridBody,
DataGridRow,
DataGrid,
DataGridHeader,
DataGridHeaderCell,
DataGridCell,
TableCellLayout,
TableColumnDefinition,
createTableColumn,
} from '@fluentui/react-table';
} from '@fluentui/react-components/unstable';

type FileCell = {
label: string;
Expand Down
12 changes: 6 additions & 6 deletions scripts/storybook/src/utils.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const fs = require('fs');
const path = require('path');
const semver = require('semver');
const { stripIndents, offsetFromRoot } = require('@nrwl/devkit');
const { workspaceRoot } = require('nx/src/utils/app-root');

const { isConvergedPackage, getAllPackageInfo, getProjectMetadata } = require('@fluentui/scripts-monorepo');
const { stripIndents, offsetFromRoot } = require('@nrwl/devkit');
const { workspaceRoot } = require('nx/src/utils/app-root');
const semver = require('semver');

const loadWorkspaceAddonDefaultOptions = { workspaceRoot };
/**
Expand Down Expand Up @@ -123,9 +123,9 @@ function getCodesandboxBabelOptions() {

return Object.values(allPackageInfo).reduce((acc, cur) => {
if (isConvergedPackage({ packagePathOrJson: cur.packageJson, projectType: 'library' })) {
const prereleaseTags = semver.prerelease(cur.packageJson.version);
const isNonRcPrerelease = prereleaseTags && !prereleaseTags[0].includes('rc');
acc[cur.packageJson.name] = isNonRcPrerelease
const isPrerelease = semver.prerelease(cur.packageJson.version) !== null;

acc[cur.packageJson.name] = isPrerelease
? { replace: '@fluentui/react-components/unstable' }
: { replace: '@fluentui/react-components' };
}
Expand Down

0 comments on commit 86a28f6

Please sign in to comment.