@patternfly/react-core 4.232.1 → 4.232.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.232.1",
3
+ "version": "4.232.4",
4
4
  "description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -50,16 +50,16 @@
50
50
  "generate": "node scripts/copyStyles.js"
51
51
  },
52
52
  "dependencies": {
53
- "@patternfly/react-icons": "^4.83.1",
54
- "@patternfly/react-styles": "^4.82.1",
55
- "@patternfly/react-tokens": "^4.84.1",
53
+ "@patternfly/react-icons": "^4.83.4",
54
+ "@patternfly/react-styles": "^4.82.4",
55
+ "@patternfly/react-tokens": "^4.84.4",
56
56
  "focus-trap": "6.9.2",
57
57
  "react-dropzone": "9.0.0",
58
58
  "tippy.js": "5.1.2",
59
59
  "tslib": "^2.0.0"
60
60
  },
61
61
  "devDependencies": {
62
- "@patternfly/patternfly": "4.206.3",
62
+ "@patternfly/patternfly": "4.207.0",
63
63
  "@rollup/plugin-commonjs": "^21.0.0",
64
64
  "@rollup/plugin-node-resolve": "^13.0.0",
65
65
  "@rollup/plugin-replace": "^3.0.0",
@@ -76,5 +76,5 @@
76
76
  "react": "^16.8.0 || ^17.0.0",
77
77
  "react-dom": "^16.8.0 || ^17.0.0"
78
78
  },
79
- "gitHead": "6fb07165361827ac63abf470cc14dd1dfe379f91"
79
+ "gitHead": "2703441fedb84ee7d3608adc90d7e4fbecc51f2e"
80
80
  }
@@ -558,7 +558,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
558
558
  };
559
559
 
560
560
  extendTypeaheadChildren(typeaheadCurrIndex: number, favoritesGroup?: React.ReactNode[]) {
561
- const { isGrouped, onFavorite } = this.props;
561
+ const { isGrouped, onFavorite, createText } = this.props;
562
562
  const typeaheadChildren = favoritesGroup
563
563
  ? favoritesGroup.concat(this.state.typeaheadFilteredChildren)
564
564
  : this.state.typeaheadFilteredChildren;
@@ -586,8 +586,8 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
586
586
  activeElement &&
587
587
  (activeElement.id === (child as React.ReactElement).props.id ||
588
588
  (this.props.isCreatable &&
589
- typeaheadActiveChild.innerText ===
590
- `{createText} "${(group as React.ReactElement).props.value}"`))
589
+ typeaheadActiveChild.textContent ===
590
+ `${createText} "${(group as React.ReactElement).props.value}"`))
591
591
  })
592
592
  )
593
593
  });
@@ -600,10 +600,10 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
600
600
  : React.cloneElement(child as React.ReactElement, {
601
601
  isFocused:
602
602
  typeaheadActiveChild &&
603
- (typeaheadActiveChild.innerText === (child as React.ReactElement).props.value.toString() ||
603
+ (typeaheadActiveChild.textContent === (child as React.ReactElement).props.value.toString() ||
604
604
  (this.props.isCreatable &&
605
- typeaheadActiveChild.innerText ===
606
- `{createText} "${(child as React.ReactElement).props.value}"`))
605
+ typeaheadActiveChild.textContent ===
606
+ `${createText} "${(child as React.ReactElement).props.value}"`))
607
607
  })
608
608
  )
609
609
  });
@@ -612,8 +612,8 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
612
612
  return React.cloneElement(group as React.ReactElement, {
613
613
  isFocused:
614
614
  typeaheadActiveChild &&
615
- (typeaheadActiveChild.innerText === group.props.value.toString() ||
616
- (this.props.isCreatable && typeaheadActiveChild.innerText === `{createText} "${group.props.value}"`))
615
+ (typeaheadActiveChild.textContent === group.props.value.toString() ||
616
+ (this.props.isCreatable && typeaheadActiveChild.textContent === `${createText} "${group.props.value}"`))
617
617
  });
618
618
  }
619
619
  });
@@ -624,9 +624,9 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
624
624
  ? child
625
625
  : React.cloneElement(child as React.ReactElement, {
626
626
  isFocused: typeaheadActiveChild
627
- ? typeaheadActiveChild.innerText === (child as React.ReactElement).props.value.toString() ||
627
+ ? typeaheadActiveChild.textContent === (child as React.ReactElement).props.value.toString() ||
628
628
  (this.props.isCreatable &&
629
- typeaheadActiveChild.innerText === `{createText} "${(child as React.ReactElement).props.value}"`)
629
+ typeaheadActiveChild.textContent === `${createText} "${(child as React.ReactElement).props.value}"`)
630
630
  : index === typeaheadCurrIndex // fallback for view more + typeahead use cases, when the new expanded list is loaded and refCollection hasn't be updated yet
631
631
  });
632
632
  });
@@ -665,11 +665,11 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
665
665
  : this.refCollection[nextIndex][0];
666
666
 
667
667
  let typeaheadInputValue = '';
668
- if (isCreatable && optionTextElm.innerText.includes(createText)) {
668
+ if (isCreatable && optionTextElm.textContent.includes(createText)) {
669
669
  typeaheadInputValue = this.state.creatableValue;
670
670
  } else if (optionTextElm && !isLoad) {
671
671
  // !isLoad prevents the view more button text from appearing the typeahead input
672
- typeaheadInputValue = optionTextElm.innerText;
672
+ typeaheadInputValue = optionTextElm.textContent;
673
673
  }
674
674
  this.setState(prevState => ({
675
675
  typeaheadCurrIndex: updateCurrentIndex ? nextIndex : prevState.typeaheadCurrIndex,
@@ -725,15 +725,15 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
725
725
  if (!typeaheadActiveChild.classList.contains('pf-m-load')) {
726
726
  const hasDescriptionElm = typeaheadActiveChild.childElementCount > 1;
727
727
  const typeaheadActiveChildText = hasDescriptionElm
728
- ? (typeaheadActiveChild.firstChild as HTMLElement).innerText
729
- : typeaheadActiveChild.innerText;
728
+ ? (typeaheadActiveChild.firstChild as HTMLElement).textContent
729
+ : typeaheadActiveChild.textContent;
730
730
  this.setState({
731
731
  typeaheadInputValue: typeaheadActiveChildText
732
732
  });
733
733
  }
734
734
  } else if (this.refCollection[0] && this.refCollection[0][0]) {
735
735
  this.setState({
736
- typeaheadInputValue: this.refCollection[0][0].innerText
736
+ typeaheadInputValue: this.refCollection[0][0].textContent
737
737
  });
738
738
  }
739
739
  if (typeaheadActiveChild) {
@@ -1267,7 +1267,6 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
1267
1267
  className
1268
1268
  )}
1269
1269
  {...(width && { style: { width } })}
1270
- {...(ariaDescribedby && { 'aria-describedby': ariaDescribedby })}
1271
1270
  {...(validated !== ValidatedOptions.default && { 'aria-invalid': ariaInvalid })}
1272
1271
  >
1273
1272
  {isOpen && menuContainer}
@@ -1288,7 +1287,6 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
1288
1287
  ref={this.parentRef}
1289
1288
  {...getOUIAProps(Select.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe)}
1290
1289
  {...(width && { style: { width } })}
1291
- {...(ariaDescribedby && { 'aria-describedby': ariaDescribedby })}
1292
1290
  {...(validated !== ValidatedOptions.default && { 'aria-invalid': ariaInvalid })}
1293
1291
  >
1294
1292
  <SelectToggle
@@ -1308,6 +1306,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
1308
1306
  variant={variant}
1309
1307
  aria-labelledby={`${ariaLabelledBy || ''} ${selectToggleId}`}
1310
1308
  aria-label={toggleAriaLabel}
1309
+ {...(ariaDescribedby && { 'aria-describedby': ariaDescribedby })}
1311
1310
  handleTypeaheadKeys={this.handleTypeaheadKeys}
1312
1311
  moveFocusToLastMenuItem={this.moveFocusToLastMenuItem}
1313
1312
  isDisabled={isDisabled}
@@ -516,3 +516,23 @@ describe('select with placeholder', () => {
516
516
  expect(screen.getByRole('button', { name: 'Options menu' })).not.toHaveClass('pf-m-placeholder');
517
517
  });
518
518
  });
519
+
520
+ test('applies focus styling to the create option when reached via keyboard navigation', () => {
521
+ render(
522
+ <Select
523
+ variant={SelectVariant.typeahead}
524
+ onToggle={() => {}}
525
+ isOpen
526
+ isCreatable
527
+ >
528
+ {selectOptions}
529
+ </Select>
530
+ );
531
+
532
+ const input = screen.getByRole('textbox');
533
+ userEvent.type(input, 'a{arrowdown}');
534
+
535
+ const createOption = screen.getByRole('option', { name: 'Create "a"' });
536
+
537
+ expect(createOption.parentElement).toHaveClass('pf-m-focus');
538
+ });