@patternfly/react-core 5.0.0-alpha.34 → 5.0.0-alpha.36

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": "5.0.0-alpha.34",
3
+ "version": "5.0.0-alpha.36",
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",
@@ -70,5 +70,5 @@
70
70
  "react": "^16.8 || ^17 || ^18",
71
71
  "react-dom": "^16.8 || ^17 || ^18"
72
72
  },
73
- "gitHead": "9a3ab7a6248885619173e33a938ce22749be6c2b"
73
+ "gitHead": "150dae762baafab2bdcdbc8c9860204e9b35d3cc"
74
74
  }
@@ -42,16 +42,15 @@ export const Brand: React.FunctionComponent<BrandProps> = ({
42
42
  style,
43
43
  ...props
44
44
  }: BrandProps) => {
45
+ let responsiveStyles;
45
46
  if (children !== undefined && widths !== undefined) {
46
- style = {
47
- ...style,
47
+ responsiveStyles = {
48
48
  ...setBreakpointCssVars(widths, '--pf-c-brand--Width')
49
49
  };
50
50
  }
51
51
 
52
52
  if (children !== undefined && heights !== undefined) {
53
- style = {
54
- ...style,
53
+ responsiveStyles = {
55
54
  ...setBreakpointCssVars(heights, '--pf-c-brand--Height')
56
55
  };
57
56
  }
@@ -59,12 +58,12 @@ export const Brand: React.FunctionComponent<BrandProps> = ({
59
58
  return (
60
59
  /** the brand component currently contains no styling the 'pf-c-brand' string will be used for the className */
61
60
  children !== undefined ? (
62
- <picture className={css(styles.brand, styles.modifiers.picture, className)} style={style} {...props}>
61
+ <picture className={css(styles.brand, styles.modifiers.picture, className)} style={{...style, ...responsiveStyles}} {...props}>
63
62
  {children}
64
- <img src={src} alt={alt} />
63
+ <img src={src} alt={alt}/>
65
64
  </picture>
66
65
  ) : (
67
- <img {...props} className={css(styles.brand, className)} src={src} alt={alt} />
66
+ <img {...props} className={css(styles.brand, className)} style={style} src={src} alt={alt} />
68
67
  )
69
68
  );
70
69
  };
@@ -17,4 +17,20 @@ describe('Brand', () => {
17
17
  );
18
18
  expect(screen.getByText('test')).toBeInTheDocument();
19
19
  });
20
+
21
+ test('styles get spread when there are children', () => {
22
+ render(
23
+ <Brand alt="brand" data-testid="brand" style={{color: "blue"}}>
24
+ <div>test width</div>
25
+ </Brand>
26
+ );
27
+ expect(screen.getByTestId('brand')).toHaveStyle(`color: blue`);
28
+ });
29
+
30
+ test('styles get spread when there are no children', () => {
31
+ render(
32
+ <Brand alt="brand no children" style={{width: "30px"}} />
33
+ );
34
+ expect(screen.getByAltText('brand no children')).toHaveStyle(`width: 30px`);
35
+ });
20
36
  });
@@ -560,36 +560,6 @@ class CardViewBasic extends React.Component {
560
560
  swaggerIcon
561
561
  };
562
562
 
563
- const headerActions = (
564
- <>
565
- <Dropdown
566
- isPlain
567
- position="right"
568
- onSelect={(e) => this.onCardKebabDropdownSelect(key, e)}
569
- toggle={
570
- <KebabToggle
571
- onToggle={(_event, isCardKebabDropdownOpen) =>
572
- this.onCardKebabDropdownToggle(key, isCardKebabDropdownOpen)
573
- }
574
- />
575
- }
576
- isOpen={this.state[key]}
577
- dropdownItems={[
578
- <DropdownItem key="trash" onClick={this.deleteItem(product)} position="right">
579
- <TrashIcon />
580
- Delete
581
- </DropdownItem>
582
- ]}
583
- />
584
- <Checkbox
585
- checked={isChecked}
586
- value={product.id}
587
- isChecked={selectedItems.includes(product.id)}
588
- aria-label="card checkbox example"
589
- id={`check-${product.id}`}
590
- />
591
- </>
592
- );
593
563
  return (
594
564
  <React.Fragment>
595
565
  <DashboardWrapper mainContainerId="main-content-card-view-default-nav" breadcrumb={null}>
@@ -631,7 +601,40 @@ class CardViewBasic extends React.Component {
631
601
  onSelectableInputChange={() => this.onClick(product.id)}
632
602
  isSelected={selectedItems.includes(product.id)}
633
603
  >
634
- <CardHeader actions={{ actions: headerActions }}>
604
+ <CardHeader
605
+ actions={{
606
+ actions: (
607
+ <>
608
+ <Dropdown
609
+ isPlain
610
+ position="right"
611
+ onSelect={(e) => this.onCardKebabDropdownSelect(key, e)}
612
+ toggle={
613
+ <KebabToggle
614
+ onToggle={(_event, isCardKebabDropdownOpen) =>
615
+ this.onCardKebabDropdownToggle(key, isCardKebabDropdownOpen)
616
+ }
617
+ />
618
+ }
619
+ isOpen={this.state[key]}
620
+ dropdownItems={[
621
+ <DropdownItem key="trash" onClick={this.deleteItem(product)} position="right">
622
+ <TrashIcon />
623
+ Delete
624
+ </DropdownItem>
625
+ ]}
626
+ />
627
+ <Checkbox
628
+ checked={isChecked}
629
+ value={product.id}
630
+ isChecked={selectedItems.includes(product.id)}
631
+ aria-label="card checkbox example"
632
+ id={`check-${product.id}`}
633
+ />
634
+ </>
635
+ )
636
+ }}
637
+ >
635
638
  <img src={icons[product.icon]} alt={`${product.name} icon`} style={{ maxWidth: '60px' }} />
636
639
  </CardHeader>
637
640
  <CardTitle>{product.name}</CardTitle>