@patternfly/react-core 4.202.7 → 4.202.10

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.202.7",
3
+ "version": "4.202.10",
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",
@@ -34,9 +34,9 @@
34
34
  "generate": "node scripts/copyStyles.js"
35
35
  },
36
36
  "dependencies": {
37
- "@patternfly/react-icons": "^4.53.7",
38
- "@patternfly/react-styles": "^4.52.7",
39
- "@patternfly/react-tokens": "^4.54.7",
37
+ "@patternfly/react-icons": "^4.53.10",
38
+ "@patternfly/react-styles": "^4.52.10",
39
+ "@patternfly/react-tokens": "^4.54.10",
40
40
  "focus-trap": "6.2.2",
41
41
  "react-dropzone": "9.0.0",
42
42
  "tippy.js": "5.1.2",
@@ -60,5 +60,5 @@
60
60
  "react": "^16.8.0 || ^17.0.0",
61
61
  "react-dom": "^16.8.0 || ^17.0.0"
62
62
  },
63
- "gitHead": "aa38935ea3b57607894dcc53696234838dc712d5"
63
+ "gitHead": "a1d1e3253b278b497301e5c3e967afa54d5cfa7b"
64
64
  }
@@ -2,7 +2,7 @@
2
2
  id: Card
3
3
  section: components
4
4
  cssPrefix: pf-c-card
5
- propComponents: ['Card', 'CardHeader', 'CardHeaderMain', 'CardTitle', 'CardBody', 'CardFooter', 'CardExpandableContent']
5
+ propComponents: ['Card', 'CardActions', 'CardHeader', 'CardHeaderMain', 'CardTitle', 'CardBody', 'CardFooter', 'CardExpandableContent']
6
6
  ouia: true
7
7
  ---
8
8
 
@@ -270,7 +270,9 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
270
270
  this.state.viewMoreNextIndex !== -1 &&
271
271
  this.refCollection.length > this.state.viewMoreNextIndex &&
272
272
  this.props.loadingVariant !== 'spinner' &&
273
- this.refCollection[this.state.viewMoreNextIndex][0]
273
+ this.refCollection[this.state.viewMoreNextIndex][0] &&
274
+ this.props.variant !== 'typeahead' && // do not hard focus newly added items for typeahead variants
275
+ this.props.variant !== 'typeaheadmulti'
274
276
  ) {
275
277
  this.refCollection[this.state.viewMoreNextIndex][0].focus();
276
278
  }
@@ -581,17 +583,16 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
581
583
  }
582
584
  });
583
585
  }
584
-
585
- return typeaheadChildren.map((child: React.ReactNode) => {
586
+ return typeaheadChildren.map((child: React.ReactNode, index) => {
586
587
  const childElement = child as any;
587
588
  return childElement.type.displayName === 'Divider'
588
589
  ? child
589
590
  : React.cloneElement(child as React.ReactElement, {
590
- isFocused:
591
- typeaheadActiveChild &&
592
- (typeaheadActiveChild.innerText === (child as React.ReactElement).props.value.toString() ||
591
+ isFocused: typeaheadActiveChild
592
+ ? typeaheadActiveChild.innerText === (child as React.ReactElement).props.value.toString() ||
593
593
  (this.props.isCreatable &&
594
- typeaheadActiveChild.innerText === `{createText} "${(child as React.ReactElement).props.value}"`))
594
+ typeaheadActiveChild.innerText === `{createText} "${(child as React.ReactElement).props.value}"`)
595
+ : index === typeaheadCurrIndex // fallback for view more + typeahead use cases, when the new expanded list is loaded and refCollection hasn't be updated yet
595
596
  });
596
597
  });
597
598
  }
@@ -621,6 +622,9 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
621
622
  const hasDescriptionElm = Boolean(
622
623
  this.refCollection[nextIndex][0] && this.refCollection[nextIndex][0].classList.contains('pf-m-description')
623
624
  );
625
+ const isLoad = Boolean(
626
+ this.refCollection[nextIndex][0] && this.refCollection[nextIndex][0].classList.contains('pf-m-load')
627
+ );
624
628
  const optionTextElm = hasDescriptionElm
625
629
  ? (this.refCollection[nextIndex][0].firstElementChild as HTMLElement)
626
630
  : this.refCollection[nextIndex][0];
@@ -628,7 +632,8 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
628
632
  let typeaheadInputValue = '';
629
633
  if (isCreatable && optionTextElm.innerText.includes(createText)) {
630
634
  typeaheadInputValue = this.state.creatableValue;
631
- } else if (optionTextElm) {
635
+ } else if (optionTextElm && !isLoad) {
636
+ // !isLoad prevents the view more button text from appearing the typeahead input
632
637
  typeaheadInputValue = optionTextElm.innerText;
633
638
  }
634
639
  this.setState(prevState => ({
@@ -682,19 +687,20 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
682
687
  (typeaheadActiveChild || (this.refCollection[0] && this.refCollection[0][0]))
683
688
  ) {
684
689
  if (typeaheadActiveChild) {
685
- const hasDescriptionElm = typeaheadActiveChild.childElementCount > 1;
686
- const typeaheadActiveChildText = hasDescriptionElm
687
- ? (typeaheadActiveChild.firstChild as HTMLElement).innerText
688
- : typeaheadActiveChild.innerText;
689
- this.setState({
690
- typeaheadInputValue: typeaheadActiveChildText
691
- });
692
- } else {
690
+ if (!typeaheadActiveChild.classList.contains('pf-m-load')) {
691
+ const hasDescriptionElm = typeaheadActiveChild.childElementCount > 1;
692
+ const typeaheadActiveChildText = hasDescriptionElm
693
+ ? (typeaheadActiveChild.firstChild as HTMLElement).innerText
694
+ : typeaheadActiveChild.innerText;
695
+ this.setState({
696
+ typeaheadInputValue: typeaheadActiveChildText
697
+ });
698
+ }
699
+ } else if (this.refCollection[0] && this.refCollection[0][0]) {
693
700
  this.setState({
694
701
  typeaheadInputValue: this.refCollection[0][0].innerText
695
702
  });
696
703
  }
697
-
698
704
  if (typeaheadActiveChild) {
699
705
  typeaheadActiveChild.click();
700
706
  } else {
@@ -135,8 +135,16 @@ class SelectMenuWithRef extends React.Component<SelectMenuProps> {
135
135
  let index = hasInlineFilter ? 1 : 0;
136
136
  if (isGrouped) {
137
137
  return React.Children.map(children, (group: React.ReactElement) => {
138
- if (group.type === SelectOption || group.type === Divider) {
138
+ if (group.type === Divider) {
139
139
  return group;
140
+ } else if (group.type === SelectOption) {
141
+ return React.cloneElement(group, {
142
+ isChecked: this.checkForValue(group.props.value, checked),
143
+ sendRef,
144
+ keyHandler,
145
+ index: index++,
146
+ isLastOptionBeforeFooter
147
+ });
140
148
  }
141
149
  return React.cloneElement(group, {
142
150
  titleId: group.props.label && group.props.label.replace(/\W/g, '-'),
@@ -282,7 +282,7 @@ export class SelectOption extends React.Component<SelectOptionProps> {
282
282
  role="presentation"
283
283
  className={css(
284
284
  isLoading && styles.selectListItem,
285
- !isLoad && !isLoading && styles.selectMenuWrapper,
285
+ !isLoading && styles.selectMenuWrapper,
286
286
  isFavorite && styles.modifiers.favorite,
287
287
  isFocused && styles.modifiers.focus,
288
288
  isLoading && styles.modifiers.loading
@@ -1533,7 +1533,7 @@ exports[`select custom select filter filters properly 1`] = `
1533
1533
  isChecked={false}
1534
1534
  isDisabled={false}
1535
1535
  isFavorite={null}
1536
- isFocused={null}
1536
+ isFocused={false}
1537
1537
  isLastOptionBeforeFooter={[Function]}
1538
1538
  isLoad={false}
1539
1539
  isLoading={false}
@@ -1573,7 +1573,7 @@ exports[`select custom select filter filters properly 1`] = `
1573
1573
  isChecked={false}
1574
1574
  isDisabled={false}
1575
1575
  isFavorite={null}
1576
- isFocused={null}
1576
+ isFocused={false}
1577
1577
  isLastOptionBeforeFooter={[Function]}
1578
1578
  isLoad={false}
1579
1579
  isLoading={false}
@@ -1613,7 +1613,7 @@ exports[`select custom select filter filters properly 1`] = `
1613
1613
  isChecked={false}
1614
1614
  isDisabled={false}
1615
1615
  isFavorite={null}
1616
- isFocused={null}
1616
+ isFocused={false}
1617
1617
  isLastOptionBeforeFooter={[Function]}
1618
1618
  isLoad={false}
1619
1619
  isLoading={false}
@@ -3395,7 +3395,7 @@ exports[`typeahead select test select existing option on a non-creatable select
3395
3395
  isChecked={false}
3396
3396
  isDisabled={false}
3397
3397
  isFavorite={null}
3398
- isFocused={null}
3398
+ isFocused={false}
3399
3399
  isLastOptionBeforeFooter={[Function]}
3400
3400
  isLoad={false}
3401
3401
  isLoading={false}