diff --git a/packages/react-code-editor/src/components/CodeEditor/examples/CodeEditor.md b/packages/react-code-editor/src/components/CodeEditor/examples/CodeEditor.md index 54a7cc6f7b3..62c95d96cd1 100644 --- a/packages/react-code-editor/src/components/CodeEditor/examples/CodeEditor.md +++ b/packages/react-code-editor/src/components/CodeEditor/examples/CodeEditor.md @@ -15,11 +15,13 @@ import PlayIcon from '@patternfly/react-icons/dist/esm/icons/play-icon'; ### Basic ```ts file="./CodeEditorBasic.tsx" + ``` ### With sizeToFit height, height will grow/shrink with content ```ts file="./CodeEditorSizeToFit.tsx" + ``` ### With shortcut menu and main header content @@ -27,14 +29,17 @@ import PlayIcon from '@patternfly/react-icons/dist/esm/icons/play-icon'; These examples below are the shortcuts that we recommend describing in the popover since they are monaco features. ```ts file="./CodeEditorShortcutMainHeader.tsx" + ``` ### With actions ```ts file="./CodeEditorWithActions.tsx" + ``` ### With custom control ```ts file="CodeEditorCustomControl.tsx" + ``` diff --git a/packages/react-code-editor/src/components/CodeEditor/examples/CodeEditorShortcutMainHeader.tsx b/packages/react-code-editor/src/components/CodeEditor/examples/CodeEditorShortcutMainHeader.tsx index d2dd1f5b466..9b2832c6a10 100644 --- a/packages/react-code-editor/src/components/CodeEditor/examples/CodeEditorShortcutMainHeader.tsx +++ b/packages/react-code-editor/src/components/CodeEditor/examples/CodeEditorShortcutMainHeader.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { CodeEditor, Language } from '@patternfly/react-code-editor'; -import { Grid, GridItem, Chip } from '@patternfly/react-core'; +import { Grid, GridItem, Label } from '@patternfly/react-core'; export const CodeEditorShortcutMainHeader: React.FunctionComponent = () => { const onEditorDidMount = (editor, monaco) => { @@ -40,9 +40,9 @@ export const CodeEditorShortcutMainHeader: React.FunctionComponent = () => { {shortcut.keys .map((key) => ( - + + )) .reduce((prev, curr) => ( <>{[prev, ' + ', curr]} diff --git a/packages/react-core/src/components/Chip/Chip.tsx b/packages/react-core/src/components/Chip/Chip.tsx deleted file mode 100644 index fd7a17cbc5d..00000000000 --- a/packages/react-core/src/components/Chip/Chip.tsx +++ /dev/null @@ -1,216 +0,0 @@ -import * as React from 'react'; -import { css } from '@patternfly/react-styles'; -import { Button } from '../Button'; -import { Tooltip, TooltipPosition } from '../Tooltip'; -import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon'; -import styles from '@patternfly/react-styles/css/components/Chip/chip'; -import { GenerateId } from '../../helpers/GenerateId/GenerateId'; -import { getOUIAProps, OUIAProps, getDefaultOUIAId } from '../../helpers'; -import cssChipTextMaxWidth from '@patternfly/react-tokens/dist/esm/c_chip__text_MaxWidth'; - -export interface ChipProps extends React.HTMLProps, OUIAProps { - /** Badge to add to the chip. The badge will be rendered after the chip text. */ - badge?: React.ReactNode; - /** Content rendered inside the chip text */ - children?: React.ReactNode; - /** Aria Label for close button */ - closeBtnAriaLabel?: string; - /** Additional classes added to the chip item */ - className?: string; - /** Flag indicating if the chip is an overflow chip */ - isOverflowChip?: boolean; - /** Flag indicating if chip is read only */ - isReadOnly?: boolean; - /** Function that is called when clicking on the chip close button */ - onClick?: (event: React.MouseEvent) => void; - /** Component that will be used for chip. It is recommended that - - )} - - ); - } - - renderChip = (randomId: string) => { - const { children, tooltipPosition } = this.props; - if (this.state.isTooltipVisible) { - return ( - - {this.renderInnerChip(randomId)} - - ); - } - return this.renderInnerChip(randomId); - }; - - render() { - const { isOverflowChip } = this.props; - return ( - - {(randomId) => (isOverflowChip ? this.renderOverflowChip() : this.renderChip(this.props.id || randomId))} - - ); - } -} - -export { Chip }; diff --git a/packages/react-core/src/components/Chip/ChipGroup.tsx b/packages/react-core/src/components/Chip/ChipGroup.tsx deleted file mode 100644 index 4c60657be1c..00000000000 --- a/packages/react-core/src/components/Chip/ChipGroup.tsx +++ /dev/null @@ -1,214 +0,0 @@ -import * as React from 'react'; -import styles from '@patternfly/react-styles/css/components/Chip/chip-group'; -import { css } from '@patternfly/react-styles'; -import { Button } from '../Button'; -import { Chip } from './Chip'; -import { Tooltip, TooltipPosition } from '../Tooltip'; -import TimesCircleIcon from '@patternfly/react-icons/dist/esm/icons/times-circle-icon'; -import { fillTemplate } from '../../helpers'; -import { GenerateId } from '../../helpers/GenerateId/GenerateId'; -import { getOUIAProps, OUIAProps } from '../../helpers'; - -export interface ChipGroupProps extends React.HTMLProps, OUIAProps { - /** Content rendered inside the chip group. Should be elements. */ - children?: React.ReactNode; - /** Additional classes added to the chip item */ - className?: string; - /** Flag for having the chip group default to expanded */ - defaultIsOpen?: boolean; - /** Customizable "Show Less" text string */ - expandedText?: string; - /** Customizeable template string. Use variable "${remaining}" for the overflow chip count. */ - collapsedText?: string; - /** Category name text for the chip group category. If this prop is supplied the chip group with have a label and category styling applied */ - categoryName?: string; - /** Aria label for chip group that does not have a category name */ - 'aria-label'?: string; - /** Set number of chips to show before overflow */ - numChips?: number; - /** Flag if chip group can be closed*/ - isClosable?: boolean; - /** Aria label for close button */ - closeBtnAriaLabel?: string; - /** Function that is called when clicking on the chip group close button */ - onClick?: (event: React.MouseEvent) => void; - /** Function that is called when clicking on the overflow (expand/collapse) chip button */ - onOverflowChipClick?: (event: React.MouseEvent) => void; - /** Position of the tooltip which is displayed if the category name text is longer */ - tooltipPosition?: - | TooltipPosition - | 'auto' - | 'top' - | 'bottom' - | 'left' - | 'right' - | 'top-start' - | 'top-end' - | 'bottom-start' - | 'bottom-end' - | 'left-start' - | 'left-end' - | 'right-start' - | 'right-end'; - /** Value to overwrite the randomly generated data-ouia-component-id.*/ - ouiaId?: number | string; -} - -interface ChipGroupState { - isOpen: boolean; - isTooltipVisible: boolean; -} - -class ChipGroup extends React.Component { - static displayName = 'ChipGroup'; - constructor(props: ChipGroupProps) { - super(props); - this.state = { - isOpen: this.props.defaultIsOpen, - isTooltipVisible: false - }; - } - private headingRef = React.createRef(); - - static defaultProps: ChipGroupProps = { - expandedText: 'Show Less', - collapsedText: '${remaining} more', - categoryName: '', - defaultIsOpen: false, - numChips: 3, - isClosable: false, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - onClick: (_e: React.MouseEvent) => undefined as any, - onOverflowChipClick: (_e: React.MouseEvent) => undefined as any, - closeBtnAriaLabel: 'Close chip group', - tooltipPosition: 'top', - 'aria-label': 'Chip group category' - }; - - componentDidMount() { - this.setState({ - isTooltipVisible: Boolean( - this.headingRef.current && this.headingRef.current.offsetWidth < this.headingRef.current.scrollWidth - ) - }); - } - - toggleCollapse = () => { - this.setState((prevState) => ({ - isOpen: !prevState.isOpen, - isTooltipVisible: Boolean( - this.headingRef.current && this.headingRef.current.offsetWidth < this.headingRef.current.scrollWidth - ) - })); - }; - - renderLabel(id: string) { - const { categoryName, tooltipPosition } = this.props; - const { isTooltipVisible } = this.state; - return isTooltipVisible ? ( - - - {categoryName} - - - ) : ( - - {categoryName} - - ); - } - - render() { - const { - categoryName, - children, - className, - isClosable, - closeBtnAriaLabel, - 'aria-label': ariaLabel, - onClick, - onOverflowChipClick, - numChips, - expandedText, - collapsedText, - ouiaId, - /* eslint-disable @typescript-eslint/no-unused-vars */ - defaultIsOpen, - tooltipPosition, - /* eslint-enable @typescript-eslint/no-unused-vars */ - ...rest - } = this.props; - const { isOpen } = this.state; - const numChildren = React.Children.count(children); - const collapsedTextResult = fillTemplate(collapsedText as string, { - remaining: React.Children.count(children) - numChips - }); - - const renderChipGroup = (id: string) => { - const chipArray = !isOpen - ? React.Children.toArray(children).slice(0, numChips) - : React.Children.toArray(children); - - return ( -
-
- {categoryName && this.renderLabel(id)} -
    - {chipArray.map((child, i) => ( -
  • - {child} -
  • - ))} - {numChildren > numChips && ( -
  • - { - this.toggleCollapse(); - onOverflowChipClick(event); - }} - component="button" - > - {isOpen ? expandedText : collapsedTextResult} - -
  • - )} -
-
- {isClosable && ( -
- -
- )} -
- ); - }; - - return numChildren === 0 ? null : ( - {(randomId) => renderChipGroup(this.props.id || randomId)} - ); - } -} - -export { ChipGroup }; diff --git a/packages/react-core/src/components/Label/Label.tsx b/packages/react-core/src/components/Label/Label.tsx index 80c9079ffec..ef6aad79bd6 100644 --- a/packages/react-core/src/components/Label/Label.tsx +++ b/packages/react-core/src/components/Label/Label.tsx @@ -202,13 +202,20 @@ export const Label: React.FunctionComponent = ({ const LabelComponent = (isOverflowLabel || isAddLabel ? 'button' : 'span') as any; + let _closeBtnAriaLabel = 'Close label'; + if (closeBtnAriaLabel) { + _closeBtnAriaLabel = closeBtnAriaLabel; + } else if (typeof children === 'string') { + _closeBtnAriaLabel = `Close ${children}`; + } + const defaultButton = ( - +
  • -
    Pending -
    +
  • -
    + `; diff --git a/packages/react-core/src/components/Chip/__tests__/__snapshots__/ChipGroup.test.tsx.snap b/packages/react-core/src/deprecated/components/Chip/__tests__/__snapshots__/ChipGroup.test.tsx.snap similarity index 53% rename from packages/react-core/src/components/Chip/__tests__/__snapshots__/ChipGroup.test.tsx.snap rename to packages/react-core/src/deprecated/components/Chip/__tests__/__snapshots__/ChipGroup.test.tsx.snap index e54bd1962a6..10fad202508 100644 --- a/packages/react-core/src/components/Chip/__tests__/__snapshots__/ChipGroup.test.tsx.snap +++ b/packages/react-core/src/deprecated/components/Chip/__tests__/__snapshots__/ChipGroup.test.tsx.snap @@ -3,22 +3,20 @@ exports[`chip group renders to match snapshot 1`] = `
    • chips
    • diff --git a/packages/react-core/src/components/Chip/examples/Chip.md b/packages/react-core/src/deprecated/components/Chip/examples/Chip.md similarity index 97% rename from packages/react-core/src/components/Chip/examples/Chip.md rename to packages/react-core/src/deprecated/components/Chip/examples/Chip.md index 074a61e8cd3..6e3bca13de1 100644 --- a/packages/react-core/src/components/Chip/examples/Chip.md +++ b/packages/react-core/src/deprecated/components/Chip/examples/Chip.md @@ -4,14 +4,17 @@ section: components cssPrefix: ['pf-v5-c-chip', 'pf-v5-c-chip-group'] propComponents: ['Chip', 'ChipGroup'] ouia: true +deprecated: true --- ## Examples ### Chip variants + Chips can be removable or read-only. The Overflow chip is a special chip that is used to expand or collapse the content of a chip group. ```ts file='./ChipDefault.tsx' + ``` ### Chip groups @@ -19,14 +22,17 @@ Chips can be removable or read-only. The Overflow chip is a special chip that is A chip group is a collection of chips that can be grouped by category and used to represent one or more values assigned to a single attribute. When the value of `numChips` is exceeded, additional chips will be hidden using an overflow chip. ```ts file='./ChipGroupInline.tsx' + ``` ### Chip groups with categories ```ts file='./ChipGroupWithCategories.tsx' + ``` ### Chip groups with removable categories ```ts file='./ChipGroupRemovableCategories.tsx' + ``` diff --git a/packages/react-core/src/components/Chip/examples/ChipDefault.tsx b/packages/react-core/src/deprecated/components/Chip/examples/ChipDefault.tsx similarity index 94% rename from packages/react-core/src/components/Chip/examples/ChipDefault.tsx rename to packages/react-core/src/deprecated/components/Chip/examples/ChipDefault.tsx index 1ea1ac5b9ef..66023f9ce35 100644 --- a/packages/react-core/src/components/Chip/examples/ChipDefault.tsx +++ b/packages/react-core/src/deprecated/components/Chip/examples/ChipDefault.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import { Badge, Chip } from '@patternfly/react-core'; +import { Badge } from '@patternfly/react-core'; +import { Chip } from '@patternfly/react-core/deprecated'; export const ChipDefault: React.FunctionComponent = () => { const [chips, setChips] = React.useState({ diff --git a/packages/react-core/src/components/Chip/examples/ChipGroupInline.tsx b/packages/react-core/src/deprecated/components/Chip/examples/ChipGroupInline.tsx similarity index 90% rename from packages/react-core/src/components/Chip/examples/ChipGroupInline.tsx rename to packages/react-core/src/deprecated/components/Chip/examples/ChipGroupInline.tsx index 33a971c74c9..145b4a3d082 100644 --- a/packages/react-core/src/components/Chip/examples/ChipGroupInline.tsx +++ b/packages/react-core/src/deprecated/components/Chip/examples/ChipGroupInline.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Chip, ChipGroup } from '@patternfly/react-core'; +import { Chip, ChipGroup } from '@patternfly/react-core/deprecated'; export const ChipGroupInline: React.FunctionComponent = () => { const [chips, setChips] = React.useState([ diff --git a/packages/react-core/src/components/Chip/examples/ChipGroupRemovableCategories.tsx b/packages/react-core/src/deprecated/components/Chip/examples/ChipGroupRemovableCategories.tsx similarity index 95% rename from packages/react-core/src/components/Chip/examples/ChipGroupRemovableCategories.tsx rename to packages/react-core/src/deprecated/components/Chip/examples/ChipGroupRemovableCategories.tsx index 7574dfa2b16..46d599783f8 100644 --- a/packages/react-core/src/components/Chip/examples/ChipGroupRemovableCategories.tsx +++ b/packages/react-core/src/deprecated/components/Chip/examples/ChipGroupRemovableCategories.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Chip, ChipGroup } from '@patternfly/react-core'; +import { Chip, ChipGroup } from '@patternfly/react-core/deprecated'; export const ChipGroupRemovableCategories: React.FunctionComponent = () => { const [chipGroup1, setChipGroup1] = React.useState(['Chip one', 'Chip two', 'Chip three']); diff --git a/packages/react-core/src/components/Chip/examples/ChipGroupWithCategories.tsx b/packages/react-core/src/deprecated/components/Chip/examples/ChipGroupWithCategories.tsx similarity index 90% rename from packages/react-core/src/components/Chip/examples/ChipGroupWithCategories.tsx rename to packages/react-core/src/deprecated/components/Chip/examples/ChipGroupWithCategories.tsx index 2067c1390db..d3171593eea 100644 --- a/packages/react-core/src/components/Chip/examples/ChipGroupWithCategories.tsx +++ b/packages/react-core/src/deprecated/components/Chip/examples/ChipGroupWithCategories.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Chip, ChipGroup } from '@patternfly/react-core'; +import { Chip, ChipGroup } from '@patternfly/react-core/deprecated'; export const ChipGroupWithCategories: React.FunctionComponent = () => { const [chips, setChips] = React.useState([ diff --git a/packages/react-core/src/components/Chip/index.ts b/packages/react-core/src/deprecated/components/Chip/index.ts similarity index 100% rename from packages/react-core/src/components/Chip/index.ts rename to packages/react-core/src/deprecated/components/Chip/index.ts diff --git a/packages/react-core/src/deprecated/components/Select/Select.tsx b/packages/react-core/src/deprecated/components/Select/Select.tsx index 4dbc6a6d469..bf7c1e9aa1a 100644 --- a/packages/react-core/src/deprecated/components/Select/Select.tsx +++ b/packages/react-core/src/deprecated/components/Select/Select.tsx @@ -19,8 +19,8 @@ import { SelectDirection, SelectFooterTabbableItems } from './selectConstants'; -import { ChipGroup, ChipGroupProps } from '../../../components/Chip'; -import { Chip } from '../../../components/Chip'; +import { ChipGroup, ChipGroupProps } from '../Chip'; +import { Chip } from '../Chip'; import { Spinner } from '../../../components/Spinner'; import { keyHandler, diff --git a/packages/react-core/src/deprecated/components/Select/__tests__/__snapshots__/Select.test.tsx.snap b/packages/react-core/src/deprecated/components/Select/__tests__/__snapshots__/Select.test.tsx.snap index 5f29634ec82..808a781f31b 100644 --- a/packages/react-core/src/deprecated/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +++ b/packages/react-core/src/deprecated/components/Select/__tests__/__snapshots__/Select.test.tsx.snap @@ -1849,51 +1849,47 @@ exports[`typeahead multi select renders selected successfully 1`] = ` class="pf-v5-c-select__toggle-wrapper" >
      • -
        Mr -
        +
      • -
        Mrs -
        +
      diff --git a/packages/react-core/src/deprecated/components/Select/examples/Select.md b/packages/react-core/src/deprecated/components/Select/examples/Select.md index e54c2b9aa00..dc92458f05b 100644 --- a/packages/react-core/src/deprecated/components/Select/examples/Select.md +++ b/packages/react-core/src/deprecated/components/Select/examples/Select.md @@ -2443,7 +2443,7 @@ To customize chips even more, render a [``](/components/chip-group) c ```js import React from 'react'; -import { ChipGroup, Chip } from '@patternfly/react-core'; +import { ChipGroup, Chip } from '@patternfly/react-core/deprecated'; import { Select, SelectOption, SelectVariant } from '@patternfly/react-core/deprecated'; class MultiTypeaheadSelectInputWithChipGroupProps extends React.Component { diff --git a/packages/react-core/src/deprecated/components/index.ts b/packages/react-core/src/deprecated/components/index.ts index b32add8bc6e..df78ee4c490 100644 --- a/packages/react-core/src/deprecated/components/index.ts +++ b/packages/react-core/src/deprecated/components/index.ts @@ -1,4 +1,5 @@ export * from './ApplicationLauncher'; +export * from './Chip'; export * from './ContextSelector'; export * from './Dropdown'; export * from './OptionsMenu'; diff --git a/packages/react-integration/cypress/integration/chip.spec.ts b/packages/react-integration/cypress/integration/chip.spec.ts index 7cbf5cdd4ad..13f49f54bf4 100644 --- a/packages/react-integration/cypress/integration/chip.spec.ts +++ b/packages/react-integration/cypress/integration/chip.spec.ts @@ -4,7 +4,7 @@ describe('Chip Group Demo Test', () => { }); it('Verify tooltipPosition is passed to Tooltip', () => { - cy.get('.pf-v5-c-chip').focus(); + cy.get('.pf-v5-c-label__content').focus(); cy.get('.pf-v5-c-tooltip').should('have.class', 'pf-m-bottom'); }); }); diff --git a/packages/react-integration/cypress/integration/chipgroup.spec.ts b/packages/react-integration/cypress/integration/chipgroup.spec.ts index 75229045118..43ce1882786 100644 --- a/packages/react-integration/cypress/integration/chipgroup.spec.ts +++ b/packages/react-integration/cypress/integration/chipgroup.spec.ts @@ -4,23 +4,17 @@ describe('Chip Group Demo Test', () => { }); it('Verify chip default text', () => { - cy.get('.pf-v5-c-chip__text') - .first() - .contains('Lemons'); + cy.get('.pf-v5-c-label__text').first().contains('Lemons'); }); it('Verify chip has badge', () => { - cy.get('span') - .children('.pf-v5-c-badge') - .should('not.be.undefined'); - cy.get('span') - .children('.pf-v5-c-badge') - .should('not.equal', null); + cy.get('span').children('.pf-v5-c-badge').should('not.be.undefined'); + cy.get('span').children('.pf-v5-c-badge').should('not.equal', null); }); it('Verify delete button on first chip', () => { - const chip = cy.get('.pf-v5-c-chip__content').children('#chip-Lemons'); - cy.get('#remove_chip-Lemons').click(); + const chip = cy.get('#chip-Lemons'); + cy.get('#chip-Lemons button').click(); chip.should('not.exist'); }); }); diff --git a/packages/react-integration/cypress/integration/chipgroupdefaultisopen.spec.ts b/packages/react-integration/cypress/integration/chipgroupdefaultisopen.spec.ts index da524d83816..cb808f45d73 100644 --- a/packages/react-integration/cypress/integration/chipgroupdefaultisopen.spec.ts +++ b/packages/react-integration/cypress/integration/chipgroupdefaultisopen.spec.ts @@ -4,39 +4,31 @@ describe('Chip Group Demo Test', () => { }); it('Verify chip default text', () => { - cy.get('.pf-v5-c-chip__text') - .first() - .contains('Lemons'); + cy.get('.pf-v5-c-label__text').first().contains('Lemons'); }); it('Verify chip is open on default', () => { - cy.get('.pf-v5-c-chip__text') - .eq(1) - .contains('Limes'); + cy.get('.pf-v5-c-label__text').eq(1).contains('Limes'); }); it('Verify chip has badge', () => { - cy.get('span') - .children('.pf-v5-c-badge') - .should('not.be.undefined'); - cy.get('span') - .children('.pf-v5-c-badge') - .should('not.equal', null); + cy.get('span').children('.pf-v5-c-badge').should('not.be.undefined'); + cy.get('span').children('.pf-v5-c-badge').should('not.equal', null); }); it('Verify show less button works', () => { cy.get('.pf-m-overflow').click(); - cy.get('.pf-v5-c-chip__text').contains('more'); + cy.get('.pf-v5-c-label__text').contains('more'); }); it('Verify more button works', () => { cy.get('.pf-m-overflow').click(); - cy.get('.pf-v5-c-chip__text').contains('Show Less'); + cy.get('.pf-v5-c-label__text').contains('Show Less'); }); it('Verify delete button on first chip', () => { - const chip = cy.get('.pf-v5-c-chip__content').children('#chip-Lemons'); - cy.get('#remove_chip-Lemons').click(); + const chip = cy.get('#chip-Lemons'); + cy.get('#chip-Lemons button').click(); chip.should('not.exist'); }); }); diff --git a/packages/react-integration/cypress/integration/chipgroupwithcategory.spec.ts b/packages/react-integration/cypress/integration/chipgroupwithcategory.spec.ts index 203ecc12a0d..9974e360318 100644 --- a/packages/react-integration/cypress/integration/chipgroupwithcategory.spec.ts +++ b/packages/react-integration/cypress/integration/chipgroupwithcategory.spec.ts @@ -4,7 +4,7 @@ describe('Chip Group with Category Demo Test', () => { }); it('Verify delete button on first chip group', () => { - const chipGroup = cy.get('.pf-v5-c-chip-group').first(); + const chipGroup = cy.get('.pf-v5-c-label-group').first(); const chipGroupButton = chipGroup.get('#remove_group_category-1'); chipGroupButton.should('be.visible'); chipGroupButton.click(); @@ -12,7 +12,7 @@ describe('Chip Group with Category Demo Test', () => { }); it('Displays Tooltip', () => { - cy.get('.pf-v5-c-chip-group__label') + cy.get('.pf-v5-c-label-group__label') .last() .then((tooltipLink: JQuery) => { cy.get('.pf-v5-c-tooltip').should('not.exist'); diff --git a/packages/react-integration/cypress/integration/chipgroupwithoverflowchipeventhandler.spec.ts b/packages/react-integration/cypress/integration/chipgroupwithoverflowchipeventhandler.spec.ts index 9e8d7baa311..d107d72e3b0 100644 --- a/packages/react-integration/cypress/integration/chipgroupwithoverflowchipeventhandler.spec.ts +++ b/packages/react-integration/cypress/integration/chipgroupwithoverflowchipeventhandler.spec.ts @@ -4,8 +4,8 @@ describe('Chip Group with Custom Overflow Chip Event Handler', () => { }); it('Verify additional text is shown from custom event handler when overflow chip is clicked', () => { - cy.get('.pf-v5-c-title').should('not.exist'); + cy.get('#Pears').should('not.exist'); cy.get('.pf-m-overflow').click(); - cy.get('.pf-v5-c-title').should('exist'); + cy.get('#Pears').should('exist'); }); }); diff --git a/packages/react-integration/cypress/integration/form.spec.ts b/packages/react-integration/cypress/integration/form.spec.ts index 2f5bd1cf0a0..6f3001d8c7b 100644 --- a/packages/react-integration/cypress/integration/form.spec.ts +++ b/packages/react-integration/cypress/integration/form.spec.ts @@ -71,12 +71,9 @@ describe('Form Demo Test', () => { it('Verify keypress can control the multi-select-typeahead', () => { cy.get('[id*="pf-select-toggle-id"][id*="select-multi-typeahead-typeahead"]').type('{downarrow}{downarrow}{enter}'); - cy.get('.pf-v5-c-chip__text').should('exist').and('have.text', 'Florida'); + cy.get('.pf-v5-c-label__text').should('exist').and('have.text', 'Florida'); - cy.get('.pf-v5-c-chip__text').then(($chipText) => { - const idAttrValue = $chipText.attr('id'); - cy.get(`#remove_${idAttrValue}`).click(); - }); + cy.get('.pf-v5-c-label button').click(); cy.get('[id*="pf-select-toggle-id"][id*="select-multi-typeahead-typeahead"]').type('New J'); diff --git a/packages/react-integration/cypress/integration/select.spec.ts b/packages/react-integration/cypress/integration/select.spec.ts index 6c01d88ce4a..292af1ba3b2 100644 --- a/packages/react-integration/cypress/integration/select.spec.ts +++ b/packages/react-integration/cypress/integration/select.spec.ts @@ -130,23 +130,23 @@ describe('Select Test', () => { xit('Verify Typeahead Multi Select', () => { cy.get('#typeahead-multi-select').click(); cy.get('#Florida-2').click(); - cy.get('.pf-v5-c-chip').contains('Florida').should('exist'); + cy.get('.pf-v5-c-label').contains('Florida').should('exist'); cy.get('#Alabama-0').click(); cy.get('#Boston-1').click(); cy.get('#Texas-4').click(); cy.get('.pf-m-overflow > .pf-v5-c-button').should('exist'); cy.get('#Florida-2').click(); - cy.get('.pf-v5-c-chip').contains('Alabama').should('exist'); + cy.get('.pf-v5-c-label').contains('Alabama').should('exist'); cy.get('.pf-m-overflow > .pf-v5-c-button').should('not.exist'); cy.get('#Florida-2').click(); cy.get('.pf-m-overflow > .pf-v5-c-button').should('exist'); cy.get('.pf-m-overflow > .pf-v5-c-button').click(); - cy.get('.pf-v5-c-chip').contains('Florida').should('exist'); - cy.get('.pf-v5-c-chip').contains('Alabama').should('exist'); - cy.get('.pf-v5-c-chip').contains('.pf-v5-c-chip', 'Florida').children('button').click(); - cy.get('.pf-v5-c-chip').contains('Florida').should('not.exist'); + cy.get('.pf-v5-c-label').contains('Florida').should('exist'); + cy.get('.pf-v5-c-label').contains('Alabama').should('exist'); + cy.get('.pf-v5-c-label').contains('.pf-v5-c-label', 'Florida').children('button').click(); + cy.get('.pf-v5-c-label').contains('Florida').should('not.exist'); cy.get('button.pf-v5-c-select__toggle-clear').click(); - cy.get('.pf-v5-c-chip').should('not.exist'); + cy.get('.pf-v5-c-label').should('not.exist'); }); it('Verify false value of shouldResetOnSelect will not clear typeahead input after selection', () => { @@ -154,20 +154,20 @@ describe('Select Test', () => { cy.get('#typeahead-multi-select-select-multi-typeahead-typeahead').should('contain.value', ''); cy.get('#typeahead-multi-select-select-multi-typeahead-typeahead').type('Florida'); cy.get('#Florida').click(); - cy.get('.pf-v5-c-chip').contains('Florida').should('exist'); + cy.get('.pf-v5-c-label').contains('Florida').should('exist'); cy.get('#typeahead-multi-select-select-multi-typeahead-typeahead').should('contain.value', 'Florida'); }); xit('Verify Custom Typeahead Multi Select', () => { cy.get('#custom-typeahead-multi-select').click(); cy.get('#Florida-2').click(); - cy.get('.pf-v5-c-chip').contains('div-Florida-test_span').should('exist'); + cy.get('.pf-v5-c-label').contains('div-Florida-test_span').should('exist'); cy.get('#Alabama-0').click(); cy.get('#Boston-1').click(); cy.get('#Texas-4').click(); cy.get('button.pf-v5-c-select__toggle-clear').should('exist'); cy.get('#Florida-2').click(); - cy.get('.pf-v5-c-chip').contains('div-Alabama-test_span').should('exist'); + cy.get('.pf-v5-c-label').contains('div-Alabama-test_span').should('exist'); cy.get('.pf-m-overflow > .pf-v5-c-button').should('not.exist'); cy.get('button.pf-v5-c-select__toggle-clear').click(); }); @@ -175,13 +175,13 @@ describe('Select Test', () => { xit('Verify Custom Typeahead Plain Multi Select', () => { cy.get('#custom-typeahead-plain-multi-select').click(); cy.get('#Florida-2').click(); - cy.get('.pf-v5-c-chip').contains('div-Florida-test_span').should('exist'); + cy.get('.pf-v5-c-label').contains('div-Florida-test_span').should('exist'); cy.get('#Alabama-0').click(); cy.get('#Boston-1').click(); cy.get('#Texas-4').click(); cy.get('button.pf-v5-c-select__toggle-clear').should('exist'); cy.get('#Florida-2').click(); - cy.get('.pf-v5-c-chip').contains('div-Alabama-test_span').should('exist'); + cy.get('.pf-v5-c-label').contains('div-Alabama-test_span').should('exist'); cy.get('.pf-m-overflow > .pf-v5-c-button').should('not.exist'); }); diff --git a/packages/react-integration/cypress/integration/selectfavorites.spec.ts b/packages/react-integration/cypress/integration/selectfavorites.spec.ts index 0dd61e1d0ca..3d813ade1a2 100644 --- a/packages/react-integration/cypress/integration/selectfavorites.spec.ts +++ b/packages/react-integration/cypress/integration/selectfavorites.spec.ts @@ -58,9 +58,9 @@ describe('Select Test', () => { cy.get('#typeahead-multi-select-select-multi-typeahead-typeahead').should('have.value', ''); // Verify selections work cy.get('#grapes-option').click(); - cy.get('.pf-v5-c-chip').contains('grapes').should('exist'); + cy.get('.pf-v5-c-label').contains('grapes').should('exist'); cy.get('#pears-option').click(); - cy.get('.pf-v5-c-chip').contains('pears').should('exist'); + cy.get('.pf-v5-c-label').contains('pears').should('exist'); // click on apples so it is added to favorites cy.get('#apples-option > .pf-m-action').click(); cy.get('.pf-v5-c-select__menu-group-title').should('exist'); diff --git a/packages/react-integration/cypress/integration/toolbar.spec.ts b/packages/react-integration/cypress/integration/toolbar.spec.ts index d79214eb8d3..78675f26f32 100644 --- a/packages/react-integration/cypress/integration/toolbar.spec.ts +++ b/packages/react-integration/cypress/integration/toolbar.spec.ts @@ -41,10 +41,10 @@ describe('Data Toolbar Demo Test', () => { }); it('displays filter chips', () => { - cy.get('.pf-m-chip-group').should('be.visible'); + cy.get('.pf-v5-c-label-group').should('be.visible'); cy.get('.pf-m-filters-applied-message').should('not.exist'); cy.get('.pf-v5-c-toolbar__item .pf-v5-c-button').should('be.visible'); - cy.get('.pf-v5-c-toolbar__item .pf-v5-c-chip-group__close').should('be.visible'); + cy.get('.pf-v5-c-toolbar__item .pf-v5-c-label-group__close').should('be.visible'); cy.get('.pf-v5-c-toolbar__item .pf-v5-c-button').contains('Clear filters'); }); }); @@ -62,11 +62,11 @@ describe('Data Toolbar Demo Test', () => { }); it('displays X filters applied message', () => { - cy.get('.pf-m-chip-container .pf-m-chip-group').should('not.exist'); + cy.get('.pf-m-chip-container .pf-m-label-group').should('not.exist'); cy.get('.pf-v5-c-toolbar__item').should('contain.text', 'filters applied'); cy.get('.pf-v5-c-toolbar__item').should('contain.text', 'Applied filters: '); cy.get('.pf-v5-c-toolbar__item .pf-v5-c-button').should('be.visible'); - cy.get('.pf-v5-c-toolbar__item .pf-v5-c-chip-group__close').should('not.be.visible'); + cy.get('.pf-v5-c-toolbar__item .pf-v5-c-label-group__close').should('not.be.visible'); cy.get('.pf-v5-c-toolbar__item .pf-v5-c-button').contains('Clear filters'); }); }); @@ -87,14 +87,14 @@ describe('Data Toolbar Demo Test', () => { cy.get('.pf-v5-c-toolbar__expandable-content').should('be.visible'); cy.get('.pf-m-chip-container').should('be.visible'); cy.get('.pf-v5-c-toolbar__item .pf-v5-c-button').should('be.visible'); - cy.get('.pf-v5-c-toolbar__item .pf-v5-c-chip-group__close').should('be.visible'); + cy.get('.pf-v5-c-toolbar__item .pf-v5-c-label-group__close').should('be.visible'); cy.get('.pf-v5-c-toolbar__item .pf-v5-c-button').contains('Clear filters'); cy.get('#demo-toggle-group .pf-v5-c-toolbar__toggle button').last().click(); cy.get('.pf-v5-c-toolbar__expandable-content').should('not.have.class', 'pf-m-expanded'); cy.get('.pf-v5-c-toolbar__expandable-content').should('not.be.visible'); cy.get('.pf-m-chip-container').should('not.be.visible'); cy.get('.pf-v5-c-toolbar__item .pf-v5-c-button').should('be.visible'); - cy.get('.pf-v5-c-toolbar__item .pf-v5-c-chip-group__close').should('not.be.visible'); + cy.get('.pf-v5-c-toolbar__item .pf-v5-c-label-group__close').should('not.be.visible'); cy.get('.pf-v5-c-toolbar__item .pf-v5-c-button').contains('Clear filters'); }); }); diff --git a/packages/react-integration/demo-app-ts/src/components/demos/ChipDemo/ChipDemo.tsx b/packages/react-integration/demo-app-ts/src/components/demos/ChipDemo/ChipDemo.tsx index a8e6c0e9578..306a011a92c 100644 --- a/packages/react-integration/demo-app-ts/src/components/demos/ChipDemo/ChipDemo.tsx +++ b/packages/react-integration/demo-app-ts/src/components/demos/ChipDemo/ChipDemo.tsx @@ -1,4 +1,4 @@ -import { Chip } from '@patternfly/react-core'; +import { Chip } from '@patternfly/react-core/deprecated'; import React from 'react'; export const ChipDemo: React.FunctionComponent = () => ( diff --git a/packages/react-integration/demo-app-ts/src/components/demos/ChipGroupDemo/ChipGroupDefaultIsOpenDemo.tsx b/packages/react-integration/demo-app-ts/src/components/demos/ChipGroupDemo/ChipGroupDefaultIsOpenDemo.tsx index fb4f40d555f..3daccde9ecb 100644 --- a/packages/react-integration/demo-app-ts/src/components/demos/ChipGroupDemo/ChipGroupDefaultIsOpenDemo.tsx +++ b/packages/react-integration/demo-app-ts/src/components/demos/ChipGroupDemo/ChipGroupDefaultIsOpenDemo.tsx @@ -1,4 +1,5 @@ -import { Badge, Chip, ChipGroup } from '@patternfly/react-core'; +import { Chip, ChipGroup } from '@patternfly/react-core/deprecated'; +import { Badge } from '@patternfly/react-core'; import React, { Component } from 'react'; interface BadgeChipState { diff --git a/packages/react-integration/demo-app-ts/src/components/demos/ChipGroupDemo/ChipGroupDemo.tsx b/packages/react-integration/demo-app-ts/src/components/demos/ChipGroupDemo/ChipGroupDemo.tsx index 6a4ead7ffd3..0a2cc31b405 100644 --- a/packages/react-integration/demo-app-ts/src/components/demos/ChipGroupDemo/ChipGroupDemo.tsx +++ b/packages/react-integration/demo-app-ts/src/components/demos/ChipGroupDemo/ChipGroupDemo.tsx @@ -1,4 +1,5 @@ -import { Badge, Chip, ChipGroup } from '@patternfly/react-core'; +import { Chip, ChipGroup } from '@patternfly/react-core/deprecated'; +import { Badge } from '@patternfly/react-core'; import React, { Component } from 'react'; interface BadgeChipState { diff --git a/packages/react-integration/demo-app-ts/src/components/demos/ChipGroupDemo/ChipGroupWithCategoryDemo.tsx b/packages/react-integration/demo-app-ts/src/components/demos/ChipGroupDemo/ChipGroupWithCategoryDemo.tsx index d9c6737989a..bc47b14b276 100644 --- a/packages/react-integration/demo-app-ts/src/components/demos/ChipGroupDemo/ChipGroupWithCategoryDemo.tsx +++ b/packages/react-integration/demo-app-ts/src/components/demos/ChipGroupDemo/ChipGroupWithCategoryDemo.tsx @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import { Chip, ChipGroup } from '@patternfly/react-core'; +import { Chip, ChipGroup } from '@patternfly/react-core/deprecated'; interface ChipWithCategoryGroupState { chipGroups: { @@ -65,7 +65,7 @@ export class ChipWithCategoryGroupDemo extends Component<{}, ChipWithCategoryGro render() { const { chipGroups } = this.state; - return chipGroups.map(currentGroup => ( + return chipGroups.map((currentGroup) => ( - {currentGroup.chips.map(chip => ( + {currentGroup.chips.map((chip) => ( this.deleteItem(chip)}> {chip} diff --git a/packages/react-integration/demo-app-ts/src/components/demos/ChipGroupDemo/ChipGroupWithOverflowChipEventHandler.tsx b/packages/react-integration/demo-app-ts/src/components/demos/ChipGroupDemo/ChipGroupWithOverflowChipEventHandler.tsx index 8f3bcb3d1b8..2ba3e493656 100644 --- a/packages/react-integration/demo-app-ts/src/components/demos/ChipGroupDemo/ChipGroupWithOverflowChipEventHandler.tsx +++ b/packages/react-integration/demo-app-ts/src/components/demos/ChipGroupDemo/ChipGroupWithOverflowChipEventHandler.tsx @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import { Chip, ChipGroup } from '@patternfly/react-core'; +import { Chip, ChipGroup } from '@patternfly/react-core/deprecated'; import { css } from '@patternfly/react-styles'; import titleStyles from '@patternfly/react-styles/css/components/Title/title'; import spacing from '@patternfly/react-styles/css/utilities/Spacing/spacing'; @@ -62,9 +62,9 @@ export class ChipGroupWithOverflowChipEventHandler extends Component<{}, ChipGro const { chipArray } = this.state; return ( <> - this.handleOverflowChipClick()}> + this.handleOverflowChipClick()}> {chipArray.map((chip) => ( - this.deleteItem(chip.name)}> + this.deleteItem(chip.name)}> {chip.name} ))}