Skip to content

Commit

Permalink
Merge branch 'main' into issue-6324
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmenendez committed Nov 15, 2024
2 parents bb6614b + 27fc332 commit 8dbe589
Show file tree
Hide file tree
Showing 29 changed files with 399 additions and 37 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,28 @@ jobs:
name: playwright-avt-report
path: .playwright

vrt-runner:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20.x'
cache: yarn
- name: Install
run: yarn
- name: Install browsers
run: yarn playwright install --with-deps
- name: Build project
run: yarn build
- name: Run VRT
working-directory: packages/core
env:
PERCY_TOKEN: web_d04495b0b413d61c2ea6b9118d1748b43f4fdd58d17ebe453ef8e0016b5766e4
run: yarn percy storybook storybook-static

avt:
if: ${{ always() }}
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ logs
pids
*.pid
*.seed
.env

# Certificates
*.crt
Expand Down
17 changes: 17 additions & 0 deletions .percy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Percy config
version: 2
snapshot:
widths:
- 360
- 1366
minHeight: 1024
storybook:
include: ['/IBM Products/']
exclude: [
'/Datagrid/*',
'/DataSpreadsheet/',
'/MultiAddSelect: With Avatars/', # avoid dynamic avatar color generation
'/Tag set/TagSet: Hundreds Of Tags', # avoid dynamic tag color generation
'/Page header/PageHeader: Page header with all items, pre-collapsed', # takes random time, to collapse on initial load
'/Tag set/TagSet: Many Tags', # takes time to calculate the overflow, causing random layout shift
]
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"nonlinearreading",
"nonselectablerows",
"noreply",
"Overflowmenu",
"overridable",
"overscan",
"overscroll",
Expand Down
4 changes: 2 additions & 2 deletions e2e/components/Datagrid/Datagrid-test.avt.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test.describe('Datagrid @avt', () => {
test('@avt-basic-usage', async ({ page }) => {
await visitStory(page, {
component: 'Datagrid',
id: 'ibm-products-components-datagrid--basic-usage',
id: 'deprecated-datagrid-datagrid--basic-usage',
globals: {
carbonTheme: 'white',
},
Expand All @@ -27,7 +27,7 @@ test.describe('Datagrid @avt', () => {
test('@avt-open-and-dismiss-sidepanel-onRowClick', async ({ page }) => {
await visitStory(page, {
component: 'Datagrid',
id: 'ibm-products-components-datagrid-clickablerow--clickable-row-story',
id: 'deprecated-datagrid-datagrid-clickablerow--clickable-row-story',
globals: {
carbonTheme: 'white',
},
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
"upgrade:dependencies:examples": "npm-check-updates -u --dep dev,peer,prod --color --target minor --packageFile 'scripts/example-gallery-builder/update-example/**/package.json'",
"upgrade:automatic": "run-s -s 'upgrade:dependencies:*'",
"upgrade:carbon": "npm-check-updates -u --dep dev,peer,prod --packageFile '{package.json,{config/**,packages/**}/package.json}' --filter '/carbon/' --target minor",
"upgrade:manual": "sh ./scripts/monorepo-npm-upgrade.sh"
"upgrade:manual": "sh ./scripts/monorepo-npm-upgrade.sh",
"visual-snapshot": "cd packages/core && yarn percy storybook storybook-static"
},
"devDependencies": {
"@babel/core": "^7.23.9",
Expand Down
2 changes: 2 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"@carbon/react": "^1.69.0",
"@carbon/themes": "^11.43.0",
"@carbon/type": "^11.33.0",
"@percy/cli": "^1.30.1",
"@percy/storybook": "^6.0.0",
"@storybook/addon-a11y": "^8.1.10",
"@storybook/addon-actions": "^8.0.9",
"@storybook/addon-controls": "^8.0.9",
Expand Down
29 changes: 16 additions & 13 deletions packages/ibm-products/src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import {
Button,
IconButton,
OverflowMenu,
OverflowMenuItem,
MenuItem,
Layer,
unstable_FeatureFlags as FeatureFlags,
} from '@carbon/react';
import { CheckmarkOutline, Incomplete } from '@carbon/react/icons';
import PropTypes from 'prop-types';
Expand Down Expand Up @@ -169,21 +170,23 @@ export const Card = forwardRef(
// actions can either be an overflow menu or series of icons
const getActions = () => {
if (overflowActions.length > 0) {
const pos = actionsPlacement === 'top' ? 'bottom' : 'top';
const pos = actionsPlacement === 'top' ? 'bottom-end' : 'top-end';
const size = actionsPlacement === 'top' ? 'sm' : 'md';
return (
<Layer level={2}>
<OverflowMenu
size={size}
direction={pos}
flipped
aria-label={overflowAriaLabel}
iconDescription={iconDescription}
>
{overflowActions.map(({ id, ...rest }) => (
<OverflowMenuItem key={id} {...rest} />
))}
</OverflowMenu>
<FeatureFlags enableV12Overflowmenu>
<OverflowMenu
autoAlign
menuAlignment={pos}
size={size}
aria-label={overflowAriaLabel}
label={iconDescription}
>
{overflowActions.map(({ id, itemText, ...rest }) => (
<MenuItem key={id} label={itemText} {...rest} />
))}
</OverflowMenu>
</FeatureFlags>
</Layer>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ export default {
layout: 'fullscreen',
docs: { page: DocsPage },
controls: { sort: 'requiredFirst' },
percy: {
waitForSelector: [
`button.${blockClass}__create-button`,
`.${blockClass}__influencer`,
],
},
},
decorators: [
(story) => <div className={`${storyClass}__viewport`}>{story()}</div>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import toolbarScreenshot from './storybook-assets/datagrid-actions-example.png';

const DocsPage = () => (
<StoryDocsPage
deprecationNotice={`\`Datagrid\` is deprecated and will be moving to an example-based approach. For more information, please refer to the [migration docs](https://github.com/carbon-design-system/tanstack-carbon).`}
blocks={[
{
title: 'Getting started',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ import { Wrapper } from './utils/Wrapper';
import DocsPage from './Datagrid.docs-page';
import { getBatchActions } from './utils/getBatchActions';
import { StatusIcon } from '../StatusIcon';
import { Annotation } from '../../../../core/.storybook/Annotation';

export default {
title: 'IBM Products/Components/Datagrid',
title: 'Deprecated/Datagrid/Datagrid',
component: Datagrid,
tags: ['autodocs'],
parameters: {
Expand All @@ -56,6 +57,27 @@ export default {
},
},
excludeStories: ['getBatchActions'],
decorators: [
(story) => (
<div>
<Annotation
type="deprecation-notice"
text={
<div>
This component is deprecated and will be moving to an
example-based approach. For more information, please refer to the{' '}
<a href="https://github.com/carbon-design-system/tanstack-carbon">
migration documentation
</a>
.
</div>
}
>
{story()}
</Annotation>
</div>
),
],
};

const getColumns = (rows) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,10 @@ const ActionsColumnExample = ({

beforeAll(() => {
jest.spyOn(global.console, 'warn').mockImplementation((message) => {
if (!message.includes('componentWillReceiveProps')) {
if (
!message.includes('componentWillReceiveProps') &&
!message.includes('deprecated')
) {
global.console.warn(message);
}
});
Expand Down Expand Up @@ -1171,7 +1174,8 @@ describe(componentName, () => {
);
expect(container.children.length).toEqual(0);
jest.spyOn(console, 'error').mockRestore();
}
},
2
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface DatagridProps {

/**
* The `Datagrid` component is an extension of Carbon's DataTable component. At the most basic level, the `Datagrid` component takes in columns and rows and renders a data table. There is a set of data table extensions which this component provides support for, these can be found [here](https://pages.github.ibm.com/carbon/ibm-products/components/datagrid/overview/). This component is data driven and allows you to choose what pieces will be included based on the hooks/plugins that are provided.
* @deprecated
*/
export let Datagrid = React.forwardRef(
(
Expand Down Expand Up @@ -104,6 +105,12 @@ export let Datagrid = React.forwardRef(
}
);

/**@ts-ignore*/
Datagrid.deprecated = {
level: 'warn',
details: `For more information, please refer to the migration docs https://github.com/carbon-design-system/tanstack-carbon`,
};

// Return a placeholder if not released and not enabled by feature flag
Datagrid = pkg.checkComponentEnabled(Datagrid, componentName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { StoryDocsPage } from '../../../../global/js/utils/StoryDocsPage';
import { ExampleAILabel } from '../../utils/ExampleAILabel';

export default {
title: 'IBM Products/Components/Datagrid/AILabel',
title: 'Deprecated/Datagrid/Datagrid/AILabel',
component: Datagrid,
tags: ['autodocs'],
parameters: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { SidePanel } from '../../../SidePanel';
import { StoryDocsPage } from '../../../../global/js/utils/StoryDocsPage';

export default {
title: 'IBM Products/Components/Datagrid/ClickableRow',
title: 'Deprecated/Datagrid/Datagrid/ClickableRow',
component: Datagrid,
tags: ['autodocs'],
parameters: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { FeatureFlags } from '../../../FeatureFlags';
import { WithFeatureFlags } from '../../../../../../core/.storybook/WithFeatureFlags';

export default {
title: 'IBM Products/Components/Datagrid/ColumnCustomization',
title: 'Deprecated/Datagrid/Datagrid/ColumnCustomization',
component: Datagrid,
tags: ['autodocs'],
parameters: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const blockClass = `${pkg.prefix}--datagrid`;
const storybookBlockClass = `storybook-${blockClass}__validation-code-snippet`;

export default {
title: 'IBM Products/Components/Datagrid/EditableCell',
title: 'Deprecated/Datagrid/Datagrid/EditableCell',
component: Datagrid,
tags: ['autodocs'],
parameters: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { DocsPage } from './ExpandableRow.docs-page';
import { usePrefix } from '../../../../global/js/hooks';

export default {
title: 'IBM Products/Components/Datagrid/ExpandableRow',
title: 'Deprecated/Datagrid/Datagrid/ExpandableRow',
component: Datagrid,
tags: ['autodocs'],
parameters: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { getDateFormat } from '../../utils/getDateFormat';
import { getFilterProps } from './Panel.stories';

export default {
title: 'IBM Products/Components/Datagrid/Filtering/Flyout',
title: 'Deprecated/Datagrid/Datagrid/Filtering/Flyout',
component: Datagrid,
tags: ['autodocs'],
parameters: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { FilteringUsage } from '../../utils/FilteringUsage';
import { getDateFormat } from '../../utils/getDateFormat';

export default {
title: 'IBM Products/Components/Datagrid/Filtering/Panel',
title: 'Deprecated/Datagrid/Datagrid/Filtering/Panel',
component: Datagrid,
tags: ['autodocs'],
parameters: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const sharedArgTypes = {
};

export default {
title: 'IBM Products/Components/Datagrid/NestedRows',
title: 'Deprecated/Datagrid/Datagrid/NestedRows',
component: Datagrid,
tags: ['autodocs'],
parameters: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { makeData } from '../../utils/makeData';
import { ARG_TYPES } from '../../utils/getArgTypes';

export default {
title: 'IBM Products/Components/Datagrid/RowActionButtons',
title: 'Deprecated/Datagrid/Datagrid/RowActionButtons',
component: Datagrid,
tags: ['autodocs'],
parameters: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { ARG_TYPES } from '../../utils/getArgTypes';
import { StoryDocsPage } from '../../../../global/js/utils/StoryDocsPage';

export default {
title: 'IBM Products/Components/Datagrid/RowHeightSettings',
title: 'Deprecated/Datagrid/Datagrid/RowHeightSettings',
component: Datagrid,
tags: ['autodocs'],
parameters: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export default {
docs: {
page: mdx,
},
percy: {
waitForTimeout: 1000,
},
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,14 @@ export default {
title: 'IBM Products/Components/Page header/PageHeader',
component: PageHeader,
tags: ['autodocs'],
parameters: { styles, layout: 'fullscreen' /* docs: { page: mdx } */ },
parameters: {
styles,
layout: 'fullscreen',
/* docs: { page: mdx } */
percy: {
waitForTimeout: 1000,
},
},
decorators: [
(story, { args }) => (
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ export default {
parameters: {
// docs: { page: mdx },
styles,
percy: {
waitForTimeout: 1000,
},
},
argTypes: {
containerWidth: {
Expand Down
Loading

0 comments on commit 8dbe589

Please sign in to comment.