@jetbrains/ring-ui 6.0.65 → 6.0.67

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.
@@ -435,6 +435,9 @@ export default class List extends Component {
435
435
  if (cleanedProps.href) {
436
436
  cleanedProps.rgItemType = Type.LINK;
437
437
  }
438
+ cleanedProps.description = typeof cleanedProps.description === 'string'
439
+ ? cleanedProps.description.trim()
440
+ : cleanedProps.description;
438
441
  const itemProps = Object.assign({ rgItemType: DEFAULT_ITEM_TYPE }, restProps);
439
442
  itemKey = key || itemId;
440
443
  itemProps.hover = (realIndex === this.state.activeIndex);
@@ -56,6 +56,7 @@ export default class Tooltip extends Component<TooltipProps> {
56
56
  showPopup: () => void;
57
57
  hidePopup: () => void;
58
58
  addListeners(): void;
59
+ hideIfMovedOutsidePopup: (ev: React.SyntheticEvent<HTMLElement>) => void;
59
60
  popup?: Popup | null;
60
61
  popupRef: (el: Popup | null) => void;
61
62
  onNestedTooltipShow: () => void;
@@ -106,6 +106,13 @@ export default class Tooltip extends Component {
106
106
  }
107
107
  this.listeners.add(document, 'scroll', () => scheduleScroll(this.hidePopup), { passive: true });
108
108
  }
109
+ hideIfMovedOutsidePopup = (ev) => {
110
+ if (!('relatedTarget' in ev) ||
111
+ this.popup?.container?.contains(ev.relatedTarget)) {
112
+ return;
113
+ }
114
+ this.hidePopup();
115
+ };
109
116
  popup;
110
117
  popupRef = (el) => {
111
118
  this.popup = el;
@@ -125,7 +132,7 @@ export default class Tooltip extends Component {
125
132
  return (<TooltipContext.Provider value={{ onNestedTooltipShow, onNestedTooltipHide }}>
126
133
  <span {...ariaProps} {...restProps} ref={this.containerRef} data-test={dataTests('ring-tooltip', dataTest)} data-test-title={typeof title === 'string' ? title : undefined}>
127
134
  {children}
128
- <Popup trapFocus={false} hidden={!this.state.showPopup || this.state.showNestedPopup} onCloseAttempt={this.hidePopup} maxHeight={400} className={classNames(styles.tooltip, { [styles.long]: long })} attached={false} onMouseOut={this.hidePopup} top={4} dontCloseOnAnchorClick ref={this.popupRef} {...popupProps}>{title}</Popup>
135
+ <Popup trapFocus={false} hidden={!this.state.showPopup || this.state.showNestedPopup} onCloseAttempt={this.hidePopup} maxHeight={400} className={classNames(styles.tooltip, { [styles.long]: long })} attached={false} onMouseOut={this.hideIfMovedOutsidePopup} top={4} dontCloseOnAnchorClick ref={this.popupRef} {...popupProps}>{title}</Popup>
129
136
  </span>
130
137
  </TooltipContext.Provider>);
131
138
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "6.0.65",
3
+ "version": "6.0.67",
4
4
  "description": "JetBrains UI library",
5
5
  "author": "JetBrains",
6
6
  "license": "Apache-2.0",