@jetbrains/ring-ui 6.0.66 → 6.0.68

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.
@@ -45,6 +45,7 @@ declare class SimpleTable<T extends SelectionItem> extends PureComponent<SimpleT
45
45
  stickyHeaderOffset?: import("react").Validator<string | null | undefined> | undefined;
46
46
  renderEmpty?: import("react").Validator<(() => import("react").ReactNode) | null | undefined> | undefined;
47
47
  RowComponent?: import("react").Validator<typeof import("./row-with-focus-sensor").default | null | undefined> | undefined;
48
+ customLoader?: import("react").Validator<((loaderClassName?: string) => import("react").ReactNode) | null | undefined> | undefined;
48
49
  shortcuts?: import("react").Validator<import("../shortcuts/core").ShortcutsMap | null | undefined> | undefined;
49
50
  };
50
51
  static defaultProps: {
@@ -49,6 +49,7 @@ declare class SmartTable<T extends SelectionItem> extends PureComponent<SmartTab
49
49
  stickyHeaderOffset?: import("react").Validator<string | null | undefined> | undefined;
50
50
  renderEmpty?: import("react").Validator<(() => import("react").ReactNode) | null | undefined> | undefined;
51
51
  RowComponent?: import("react").Validator<typeof import("./row-with-focus-sensor").default | null | undefined> | undefined;
52
+ customLoader?: import("react").Validator<((loaderClassName?: string) => import("react").ReactNode) | null | undefined> | undefined;
52
53
  selectable?: import("react").Validator<boolean | null | undefined> | undefined;
53
54
  shortcuts?: import("react").Validator<import("../shortcuts/core").ShortcutsMap | null | undefined> | undefined;
54
55
  onSelectionChange: PropTypes.Requireable<(...args: any[]) => any>;
@@ -50,6 +50,7 @@ export interface TableProps<T extends SelectionItem> extends FocusSensorAddProps
50
50
  stickyHeaderOffset?: string | undefined;
51
51
  renderEmpty?: (() => ReactNode) | null | undefined;
52
52
  RowComponent: typeof Row;
53
+ customLoader?: ((loaderClassName?: string) => ReactNode) | null | undefined;
53
54
  }
54
55
  /**
55
56
  * Interactive table with selection and keyboard navigation support.
@@ -111,7 +111,7 @@ export class Table extends PureComponent {
111
111
  window.scrollTo(scrollX, scrollY);
112
112
  };
113
113
  render() {
114
- const { data, selection, columns, caption, getItemKey, selectable, focused, isItemSelectable, getItemLevel, getItemClassName, getMetaColumnClassName, getItemDataTest, draggable, alwaysShowDragHandle, dragHandleTitle, loading, onSort, sortKey, sortOrder, loaderClassName, stickyHeader, stickyHeaderOffset, isItemCollapsible, isParentCollapsible, isItemCollapsed, onItemCollapse, onItemExpand, isDisabledSelectionVisible, getCheckboxTooltip, onItemDoubleClick, onItemClick, renderEmpty, RowComponent } = this.props;
114
+ const { data, selection, columns, caption, getItemKey, selectable, focused, isItemSelectable, getItemLevel, getItemClassName, getMetaColumnClassName, getItemDataTest, draggable, alwaysShowDragHandle, dragHandleTitle, loading, onSort, sortKey, sortOrder, loaderClassName, stickyHeader, stickyHeaderOffset, isItemCollapsible, isParentCollapsible, isItemCollapsed, onItemCollapse, onItemExpand, isDisabledSelectionVisible, getCheckboxTooltip, onItemDoubleClick, onItemClick, renderEmpty, RowComponent, customLoader } = this.props;
115
115
  // NOTE: Do not construct new object per render because it causes all rows rerendering
116
116
  const columnsArray = typeof columns === 'function' ? columns(null) : columns;
117
117
  const headerProps = {
@@ -176,7 +176,7 @@ export class Table extends PureComponent {
176
176
  </div>
177
177
 
178
178
  {loading && (<div className={style.loadingOverlay}>
179
- <Loader className={loaderClassName}/>
179
+ {customLoader ? customLoader(loaderClassName) : <Loader className={loaderClassName}/>}
180
180
  </div>)}
181
181
  </div>);
182
182
  }
@@ -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.66",
3
+ "version": "6.0.68",
4
4
  "description": "JetBrains UI library",
5
5
  "author": "JetBrains",
6
6
  "license": "Apache-2.0",