@patternfly/react-core 4.195.0 → 4.195.1

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.195.0",
3
+ "version": "4.195.1",
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,16 +34,16 @@
34
34
  "generate": "node scripts/copyStyles.js"
35
35
  },
36
36
  "dependencies": {
37
- "@patternfly/react-icons": "^4.46.0",
38
- "@patternfly/react-styles": "^4.45.0",
39
- "@patternfly/react-tokens": "^4.47.0",
37
+ "@patternfly/react-icons": "^4.46.1",
38
+ "@patternfly/react-styles": "^4.45.1",
39
+ "@patternfly/react-tokens": "^4.47.1",
40
40
  "focus-trap": "6.2.2",
41
41
  "react-dropzone": "9.0.0",
42
42
  "tippy.js": "5.1.2",
43
43
  "tslib": "^2.0.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@patternfly/patternfly": "4.176.0",
46
+ "@patternfly/patternfly": "4.177.1",
47
47
  "@rollup/plugin-commonjs": "^21.0.0",
48
48
  "@rollup/plugin-node-resolve": "^13.0.0",
49
49
  "@rollup/plugin-replace": "^3.0.0",
@@ -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": "313838eb78479aa8ba62194a6d656b5abd611c3f"
63
+ "gitHead": "b0c6df28b6240ab5f2c306599410be05a888857d"
64
64
  }
@@ -178,7 +178,7 @@ export const Label: React.FunctionComponent<LabelProps> = ({
178
178
  };
179
179
 
180
180
  const LabelComponent = (isOverflowLabel ? 'button' : 'span') as any;
181
- const Component = href ? 'a' : 'span';
181
+
182
182
  const button = closeBtn ? (
183
183
  closeBtn
184
184
  ) : (
@@ -199,7 +199,7 @@ export const Label: React.FunctionComponent<LabelProps> = ({
199
199
  useIsomorphicLayoutEffect(() => {
200
200
  setIsTooltipVisible(textRef.current && textRef.current.offsetWidth < textRef.current.scrollWidth);
201
201
  }, []);
202
- let content = (
202
+ const content = (
203
203
  <React.Fragment>
204
204
  {icon && <span className={css(styles.labelIcon)}>{icon}</span>}
205
205
  {isTruncated && (
@@ -221,28 +221,30 @@ export const Label: React.FunctionComponent<LabelProps> = ({
221
221
  setCurrValue(editableInputRef.current.value);
222
222
  };
223
223
 
224
- if (isEditable) {
225
- content = (
224
+ let labelComponentChild = <span className={css(styles.labelContent)}>{content}</span>;
225
+
226
+ if (href) {
227
+ labelComponentChild = (
228
+ <a className={css(styles.labelContent)} href={href}>
229
+ {content}
230
+ </a>
231
+ );
232
+ } else if (isEditable) {
233
+ labelComponentChild = (
226
234
  <button
227
235
  ref={editableButtonRef}
228
- className={css(styles.labelEditableText)}
229
- onClick={e => {
236
+ className={css(styles.labelContent)}
237
+ onClick={(e: React.MouseEvent) => {
230
238
  setIsEditableActive(true);
231
239
  e.stopPropagation();
232
240
  }}
233
241
  {...editableProps}
234
242
  >
235
- {children}
243
+ {content}
236
244
  </button>
237
245
  );
238
246
  }
239
247
 
240
- let labelComponentChild = (
241
- <Component className={css(styles.labelContent)} {...(href && { href })}>
242
- {content}
243
- </Component>
244
- );
245
-
246
248
  if (render) {
247
249
  labelComponentChild = (
248
250
  <React.Fragment>
@@ -257,9 +259,7 @@ export const Label: React.FunctionComponent<LabelProps> = ({
257
259
  } else if (isTooltipVisible) {
258
260
  labelComponentChild = (
259
261
  <Tooltip content={children} position={tooltipPosition}>
260
- <Component className={css(styles.labelContent)} {...(href && { href })}>
261
- {content}
262
- </Component>
262
+ {labelComponentChild}
263
263
  </Tooltip>
264
264
  );
265
265
  }
@@ -282,7 +282,7 @@ export const Label: React.FunctionComponent<LabelProps> = ({
282
282
  {!isEditableActive && onClose && button}
283
283
  {isEditableActive && (
284
284
  <input
285
- className={css(styles.labelEditableText)}
285
+ className={css(styles.labelContent)}
286
286
  type="text"
287
287
  id="editable-input"
288
288
  ref={editableInputRef}
@@ -72,12 +72,12 @@ test('editable label', () => {
72
72
  onEditCancel={jest.fn()}
73
73
  onEditComplete={jest.fn()}
74
74
  isEditable>Something</Label>);
75
- const button = view.find('button.pf-c-label__editable-text');
75
+ const button = view.find('button.pf-c-label__content');
76
76
  expect(button.length).toBe(1);
77
77
  expect(view).toMatchSnapshot();
78
78
 
79
79
  button.simulate('click');
80
- const clickedButton = view.find('button.pf-c-label__editable-text');
80
+ const clickedButton = view.find('button.pf-c-label__content');
81
81
  expect(clickedButton.length).toBe(0);
82
82
  expect(view).toMatchSnapshot();
83
83
  });
@@ -10,16 +10,12 @@ exports[`editable label 1`] = `
10
10
  <span
11
11
  className="pf-c-label pf-m-editable"
12
12
  >
13
- <span
13
+ <button
14
14
  className="pf-c-label__content"
15
+ onClick={[Function]}
15
16
  >
16
- <button
17
- className="pf-c-label__editable-text"
18
- onClick={[Function]}
19
- >
20
- Something
21
- </button>
22
- </span>
17
+ Something
18
+ </button>
23
19
  <Button
24
20
  aria-label="Close Something"
25
21
  onClick={[MockFunction]}
@@ -87,7 +83,7 @@ exports[`editable label 2`] = `
87
83
  className="pf-c-label pf-m-editable pf-m-editable-active"
88
84
  >
89
85
  <input
90
- className="pf-c-label__editable-text"
86
+ className="pf-c-label__content"
91
87
  id="editable-input"
92
88
  onChange={[Function]}
93
89
  type="text"
@@ -1006,6 +1006,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
1006
1006
  onClick={e => {
1007
1007
  this.clearSelection(e);
1008
1008
  onClear(e);
1009
+ e.stopPropagation();
1009
1010
  }}
1010
1011
  aria-label={clearSelectionsAriaLabel}
1011
1012
  type="button"
@@ -87,7 +87,7 @@ export class SelectToggle extends React.Component<SelectToggleProps> {
87
87
  }
88
88
 
89
89
  componentDidMount() {
90
- document.addEventListener('click', this.onDocClick);
90
+ document.addEventListener('click', this.onDocClick, { capture: true });
91
91
  document.addEventListener('touchstart', this.onDocClick);
92
92
  document.addEventListener('keydown', this.handleGlobalKeys);
93
93
  }