@jetbrains/ring-ui 8.0.0-beta.7 → 8.0.0-beta.8
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.
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { type ComponentType, type CSSProperties, PureComponent, type ReactNode, type Ref, type SyntheticEvent } from 'react';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { type IconType } from '../icon/icon';
|
|
7
|
-
import Popup from '../popup/popup';
|
|
7
|
+
import Popup, { type PopupAttrs } from '../popup/popup';
|
|
8
8
|
import { type Directions } from '../popup/position';
|
|
9
9
|
import List, { type SelectHandlerParams } from '../list/list';
|
|
10
10
|
import Caret from '../caret/caret';
|
|
@@ -60,6 +60,7 @@ export interface SelectPopupProps<T = unknown> {
|
|
|
60
60
|
ringPopupTarget: string | null;
|
|
61
61
|
onSelectAll: (isSelectAll: boolean) => void;
|
|
62
62
|
onEmptyPopupEnter: (e: KeyboardEvent) => void;
|
|
63
|
+
popupProps?: Partial<PopupAttrs> | undefined;
|
|
63
64
|
className?: string | null | undefined;
|
|
64
65
|
compact?: boolean | null | undefined;
|
|
65
66
|
dir?: 'ltr' | 'rtl' | undefined;
|
|
@@ -323,8 +323,8 @@ export default class SelectPopup extends PureComponent {
|
|
|
323
323
|
right: event => this.handleNavigation(event),
|
|
324
324
|
};
|
|
325
325
|
render() {
|
|
326
|
-
const { toolbar, topbar, className, multiple, hidden, isInputMode, anchorElement, minWidth, onCloseAttempt, onOutsideClick, directions, top, left, offset, style, dir, filter, } = this.props;
|
|
327
|
-
const classes = classNames(styles.popup, className);
|
|
326
|
+
const { toolbar, topbar, className, multiple, hidden, isInputMode, anchorElement, minWidth, onCloseAttempt, onOutsideClick, directions, top, left, offset, style, dir, filter, popupProps, } = this.props;
|
|
327
|
+
const classes = classNames(styles.popup, className, popupProps?.className);
|
|
328
328
|
return (<PopupTargetContext.Consumer>
|
|
329
329
|
{ringPopupTarget => {
|
|
330
330
|
const filterWithTags = this.getFilterWithTags();
|
|
@@ -332,7 +332,7 @@ export default class SelectPopup extends PureComponent {
|
|
|
332
332
|
const list = this.getList(this.props.ringPopupTarget || normalizePopupTarget(ringPopupTarget));
|
|
333
333
|
const bottomLine = this.getBottomLine();
|
|
334
334
|
const hasContent = filterWithTags || selectAll || list || bottomLine || toolbar || topbar;
|
|
335
|
-
return (<Popup trapFocus={false} ref={this.popupRef} hidden={hidden || !hasContent} attached={isInputMode} className={classes} dontCloseOnAnchorClick anchorElement={anchorElement} minWidth={minWidth} onCloseAttempt={onCloseAttempt} onOutsideClick={onOutsideClick} directions={directions} top={top} left={left} offset={offset} onMouseDown={this.mouseDownHandler} target={this.props.ringPopupTarget} autoCorrectTopOverflow={false} style={style} largeBorderRadius>
|
|
335
|
+
return (<Popup {...popupProps} trapFocus={false} ref={this.popupRef} hidden={hidden || !hasContent} attached={isInputMode} className={classes} dontCloseOnAnchorClick anchorElement={anchorElement} minWidth={minWidth} onCloseAttempt={onCloseAttempt} onOutsideClick={onOutsideClick} directions={directions} top={top} left={left} offset={offset} onMouseDown={this.mouseDownHandler} target={this.props.ringPopupTarget} autoCorrectTopOverflow={false} style={{ ...popupProps?.style, ...style }} largeBorderRadius>
|
|
336
336
|
<div dir={dir}>
|
|
337
337
|
{!hidden && filter && <Shortcuts map={this.shortcutsMap} scope={this.shortcutsScope}/>}
|
|
338
338
|
{topbar}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ButtonHTMLAttributes, Component, type ComponentType, type CSSProperties, type HTMLAttributes, type ReactNode, type Ref, type RefCallback, type SyntheticEvent } from 'react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { type PopupAttrs } from '../popup/popup';
|
|
3
4
|
import { type SelectHandlerParams } from '../list/list';
|
|
4
5
|
import { Size } from '../input/input';
|
|
5
6
|
import { type LabelType } from '../control-label/control-label';
|
|
@@ -99,6 +100,7 @@ export interface BaseSelectProps<T = unknown> {
|
|
|
99
100
|
getInitial?: (() => string) | null | undefined;
|
|
100
101
|
minWidth?: number | undefined;
|
|
101
102
|
popupClassName?: string | null | undefined;
|
|
103
|
+
popupProps?: Partial<PopupAttrs> | undefined;
|
|
102
104
|
popupStyle?: CSSProperties | undefined;
|
|
103
105
|
top?: number | undefined;
|
|
104
106
|
left?: number | undefined;
|
|
@@ -454,7 +454,7 @@ export default class Select extends Component {
|
|
|
454
454
|
else if (!shownData.length) {
|
|
455
455
|
message = this.props.notFoundMessage ?? translate('noOptionsFound');
|
|
456
456
|
}
|
|
457
|
-
return (<SelectPopup data={_shownData} message={message} toolbar={showPopup && this.getToolbar()} topbar={this.getTopbar()} loading={this.props.loading} activeIndex={activeIndex} hidden={!showPopup} ref={this.popupRef} maxHeight={this.props.maxHeight} minWidth={this.props.minWidth} directions={this.props.directions} className={this.props.popupClassName} style={this.props.popupStyle} top={this.props.top} left={this.props.left} offset={this.props.offset} filter={this.isInputMode() ? false : this.props.filter} // disable popup filter in INPUT mode
|
|
457
|
+
return (<SelectPopup data={_shownData} message={message} toolbar={showPopup && this.getToolbar()} topbar={this.getTopbar()} loading={this.props.loading} activeIndex={activeIndex} hidden={!showPopup} ref={this.popupRef} maxHeight={this.props.maxHeight} minWidth={this.props.minWidth} directions={this.props.directions} popupProps={this.props.popupProps} className={this.props.popupClassName} style={this.props.popupStyle} top={this.props.top} left={this.props.left} offset={this.props.offset} filter={this.isInputMode() ? false : this.props.filter} // disable popup filter in INPUT mode
|
|
458
458
|
filterIcon={this.props.filterIcon} filterRef={this.props.filterRef} multiple={this.props.multiple} filterValue={this.state.filterValue} anchorElement={anchorElement} onCloseAttempt={this._onCloseAttempt} onOutsideClick={this.props.onOutsideClick} onSelect={this._listSelectHandler} onSelectAll={this._listSelectAllHandler} onFilter={this._filterChangeHandler} onClear={this.clearFilter} onLoadMore={this.props.onLoadMore} isInputMode={this.isInputMode()} selected={this.state.selected} tags={this.props.tags} compact={this.props.compact} renderOptimization={this.props.renderOptimization} ringPopupTarget={this.props.ringPopupTarget} disableMoveOverflow={this.props.disableMoveOverflow} disableScrollToActive={this.props.disableScrollToActive} dir={this.props.dir} onEmptyPopupEnter={this.onEmptyPopupEnter} listId={this.listId} preventListOverscroll={this.props.preventListOverscroll}/>);
|
|
459
459
|
}}
|
|
460
460
|
</I18nContext.Consumer>);
|