@patternfly/react-core 4.225.6 → 4.225.7

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.
Files changed (28) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/esm/components/Switch/Switch.d.ts.map +1 -1
  3. package/dist/esm/components/Switch/Switch.js +1 -1
  4. package/dist/esm/components/Switch/Switch.js.map +1 -1
  5. package/dist/esm/components/TreeView/TreeView.d.ts +1 -1
  6. package/dist/esm/components/TreeView/TreeView.d.ts.map +1 -1
  7. package/dist/esm/components/TreeView/TreeViewListItem.d.ts +1 -1
  8. package/dist/esm/components/TreeView/TreeViewListItem.d.ts.map +1 -1
  9. package/dist/esm/components/TreeView/TreeViewListItem.js +1 -1
  10. package/dist/esm/components/TreeView/TreeViewListItem.js.map +1 -1
  11. package/dist/js/components/Switch/Switch.d.ts.map +1 -1
  12. package/dist/js/components/Switch/Switch.js +1 -1
  13. package/dist/js/components/Switch/Switch.js.map +1 -1
  14. package/dist/js/components/TreeView/TreeView.d.ts +1 -1
  15. package/dist/js/components/TreeView/TreeView.d.ts.map +1 -1
  16. package/dist/js/components/TreeView/TreeViewListItem.d.ts +1 -1
  17. package/dist/js/components/TreeView/TreeViewListItem.d.ts.map +1 -1
  18. package/dist/js/components/TreeView/TreeViewListItem.js +1 -1
  19. package/dist/js/components/TreeView/TreeViewListItem.js.map +1 -1
  20. package/dist/umd/react-core.css +21086 -21086
  21. package/dist/umd/react-core.js +2 -2
  22. package/dist/umd/react-core.min.js +1 -1
  23. package/package.json +5 -5
  24. package/src/components/Switch/Switch.tsx +2 -3
  25. package/src/components/Switch/__tests__/__snapshots__/Switch.test.tsx.snap +1 -1
  26. package/src/components/Switch/examples/Switch.md +10 -2
  27. package/src/components/TreeView/TreeView.tsx +1 -1
  28. package/src/components/TreeView/TreeViewListItem.tsx +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.225.6",
3
+ "version": "4.225.7",
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.76.6",
38
- "@patternfly/react-styles": "^4.75.6",
39
- "@patternfly/react-tokens": "^4.77.6",
37
+ "@patternfly/react-icons": "^4.76.7",
38
+ "@patternfly/react-styles": "^4.75.7",
39
+ "@patternfly/react-tokens": "^4.77.7",
40
40
  "focus-trap": "6.9.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": "aa02779944d6c295b717d656d9dcea638c35a11c"
63
+ "gitHead": "f819a9821412c2387151f719a8a587ab5bd1b7b7"
64
64
  }
@@ -91,10 +91,9 @@ export class Switch extends React.Component<SwitchProps & OUIAProps, { ouiaState
91
91
  className={css(styles.switchInput)}
92
92
  type="checkbox"
93
93
  onChange={event => onChange(event.target.checked, event)}
94
- {...([true, false].includes(defaultChecked) && { defaultChecked })}
95
- {...(![true, false].includes(defaultChecked) && { checked: isChecked })}
94
+ {...(defaultChecked !== undefined ? { defaultChecked } : { checked: isChecked })}
96
95
  disabled={isDisabled}
97
- aria-labelledby={isAriaLabelledBy ? `${this.id}-on` : null}
96
+ aria-labelledby={!isAriaLabelledBy ? null : `${this.id}-${isChecked !== true ? 'off' : 'on'}`}
98
97
  {...props}
99
98
  />
100
99
  {label !== undefined ? (
@@ -282,7 +282,7 @@ exports[`Switch switch with only label is not checked 1`] = `
282
282
  >
283
283
  <input
284
284
  aria-label=""
285
- aria-labelledby="switch-is-not-checked-on"
285
+ aria-labelledby="switch-is-not-checked-off"
286
286
  class="pf-c-switch__input"
287
287
  id="switch-is-not-checked"
288
288
  type="checkbox"
@@ -171,8 +171,16 @@ import React from 'react';
171
171
  import { Switch } from '@patternfly/react-core';
172
172
 
173
173
  <React.Fragment>
174
- <Switch id="uncontrolled-switch-on" label="Message when on" labelOff="Message when off" defaultChecked={false} />
174
+ <Switch
175
+ id="uncontrolled-switch-no-label"
176
+ aria-label="An uncontrolled switch with no label"
177
+ defaultChecked={false}
178
+ />
175
179
  <br />
176
- <Switch id="uncontrolled-no-label-switch-on" aria-label="Message when on" defaultChecked={true} />
180
+ <Switch
181
+ id="uncontrolled-switch-with-label"
182
+ label="An uncontrolled switch"
183
+ defaultChecked={false}
184
+ />
177
185
  </React.Fragment>;
178
186
  ```
@@ -58,7 +58,7 @@ export interface TreeViewProps {
58
58
  /** Callback for item selection */
59
59
  onSelect?: (event: React.MouseEvent, item: TreeViewDataItem, parentItem: TreeViewDataItem) => void;
60
60
  /** Callback for item checkbox selection */
61
- onCheck?: (event: React.ChangeEvent, item: TreeViewDataItem, parentItem: TreeViewDataItem) => void;
61
+ onCheck?: (event: React.ChangeEvent<HTMLInputElement>, item: TreeViewDataItem, parentItem: TreeViewDataItem) => void;
62
62
  /** Active items of tree view */
63
63
  activeItems?: TreeViewDataItem[];
64
64
  /** Internal. Parent item of a TreeViewListItem */
@@ -26,7 +26,7 @@ export interface TreeViewListItemProps {
26
26
  /** Callback for item selection. Note: calling event.preventDefault() will prevent the node from toggling. */
27
27
  onSelect?: (event: React.MouseEvent, item: TreeViewDataItem, parent: TreeViewDataItem) => void;
28
28
  /** Callback for item checkbox selection */
29
- onCheck?: (event: React.ChangeEvent, item: TreeViewDataItem, parent: TreeViewDataItem) => void;
29
+ onCheck?: (event: React.ChangeEvent<HTMLInputElement>, item: TreeViewDataItem, parent: TreeViewDataItem) => void;
30
30
  /** Flag indicating if a tree view item has a checkbox */
31
31
  hasCheck?: boolean;
32
32
  /** Additional properties of the tree view item checkbox */
@@ -115,8 +115,8 @@ const TreeViewListItemBase: React.FunctionComponent<TreeViewListItemProps> = ({
115
115
  <span className={css(styles.treeViewNodeCheck)}>
116
116
  <input
117
117
  type="checkbox"
118
- onChange={(evt: React.ChangeEvent) => onCheck && onCheck(evt, itemData, parentItem)}
119
- onClick={(evt: React.MouseEvent) => evt.stopPropagation()}
118
+ onChange={evt => onCheck && onCheck(evt, itemData, parentItem)}
119
+ onClick={evt => evt.stopPropagation()}
120
120
  ref={elem => elem && (elem.indeterminate = checkProps.checked === null)}
121
121
  {...checkProps}
122
122
  checked={checkProps.checked === null ? false : checkProps.checked}