@jetbrains/ring-ui 5.0.162 → 5.0.163
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/components/select/select.d.ts +4 -2
- package/components/select/select.js +4 -2
- package/components/select/select__popup.d.ts +2 -1
- package/components/select/select__popup.js +3 -1
- package/dist/select/select.d.ts +4 -2
- package/dist/select/select.js +4 -0
- package/dist/select/select__popup.d.ts +2 -1
- package/dist/select/select__popup.js +4 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { ButtonHTMLAttributes, Component, CSSProperties, HTMLAttributes, ReactNode, Ref, RefCallback, SyntheticEvent } from 'react';
|
|
1
|
+
import React, { ButtonHTMLAttributes, Component, ComponentType, CSSProperties, HTMLAttributes, ReactNode, Ref, RefCallback, SyntheticEvent } from 'react';
|
|
2
2
|
import { SelectHandlerParams } from '../list/list';
|
|
3
3
|
import { Size } from '../input/input';
|
|
4
4
|
import { LabelType } from '../control-label/control-label';
|
|
@@ -52,7 +52,8 @@ export type CustomAnchor = ((props: CustomAnchorProps) => ReactNode);
|
|
|
52
52
|
export interface BaseSelectProps<T = unknown> {
|
|
53
53
|
data: readonly SelectItem<T>[];
|
|
54
54
|
filter: boolean | Filter<T>;
|
|
55
|
-
|
|
55
|
+
filterIcon?: string | ComponentType | null | undefined;
|
|
56
|
+
filterRef?: Ref<HTMLInputElement>;
|
|
56
57
|
clear: boolean;
|
|
57
58
|
loading: boolean;
|
|
58
59
|
disabled: boolean;
|
|
@@ -158,6 +159,7 @@ export default class Select<T = unknown> extends Component<SelectProps<T>, Selec
|
|
|
158
159
|
static defaultProps: {
|
|
159
160
|
data: never[];
|
|
160
161
|
filter: boolean;
|
|
162
|
+
filterIcon: null;
|
|
161
163
|
filterRef: typeof noop;
|
|
162
164
|
multiple: boolean;
|
|
163
165
|
clear: boolean;
|
|
@@ -182,6 +182,7 @@ export default class Select extends Component {
|
|
|
182
182
|
static defaultProps = {
|
|
183
183
|
data: [],
|
|
184
184
|
filter: false,
|
|
185
|
+
filterIcon: null,
|
|
185
186
|
filterRef: noop,
|
|
186
187
|
multiple: false,
|
|
187
188
|
clear: false,
|
|
@@ -437,7 +438,7 @@ export default class Select extends Component {
|
|
|
437
438
|
message = this.props.notFoundMessage ?? translate('noOptionsFound');
|
|
438
439
|
}
|
|
439
440
|
return (<SelectPopup data={_shownData} message={message} toolbar={showPopup && this.getToolbar()} topbar={this.getTopbar()} loading={this.props.loading} activeIndex={this.state.selectedIndex} 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} filter={this.isInputMode() ? false : this.props.filter} // disable popup filter in INPUT mode
|
|
440
|
-
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}/>);
|
|
441
|
+
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}/>);
|
|
441
442
|
}}
|
|
442
443
|
</I18nContext.Consumer>);
|
|
443
444
|
}
|
|
@@ -819,7 +820,7 @@ export default class Select extends Component {
|
|
|
819
820
|
...this.getShortcutsMap(),
|
|
820
821
|
...this._popup?.list?.shortcutsMap
|
|
821
822
|
})
|
|
822
|
-
: undefined} afterInput={this.props.type === Type.INPUT && iconsNode}/>
|
|
823
|
+
: undefined} icon={this.props.filterIcon} afterInput={this.props.type === Type.INPUT && iconsNode}/>
|
|
823
824
|
{this._renderPopup()}
|
|
824
825
|
</div>
|
|
825
826
|
{this.props.error && (<div className={classNames(inputStyles.errorText, inputStyles[`size${this.props.size}`])}>
|
|
@@ -891,6 +892,7 @@ Select.propTypes = {
|
|
|
891
892
|
multiple: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
|
|
892
893
|
allowAny: PropTypes.bool,
|
|
893
894
|
filter: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
|
|
895
|
+
filterIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
|
|
894
896
|
filterRef: PropTypes.oneOfType([
|
|
895
897
|
PropTypes.func,
|
|
896
898
|
refObject(PropTypes.instanceOf(HTMLInputElement))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @description Displays a popup with select's options.
|
|
3
3
|
*/
|
|
4
|
-
import React, { CSSProperties, PureComponent, ReactNode, Ref, SyntheticEvent } from 'react';
|
|
4
|
+
import React, { ComponentType, CSSProperties, PureComponent, ReactNode, Ref, SyntheticEvent } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { IconType } from '../icon/icon';
|
|
7
7
|
import Popup from '../popup/popup';
|
|
@@ -43,6 +43,7 @@ export interface SelectPopupProps<T = unknown> {
|
|
|
43
43
|
toolbar: ReactNode;
|
|
44
44
|
topbar: ReactNode;
|
|
45
45
|
filter: boolean | Filter<T>;
|
|
46
|
+
filterIcon?: string | ComponentType | null | undefined;
|
|
46
47
|
filterRef?: Ref<HTMLInputElement>;
|
|
47
48
|
message: string | null;
|
|
48
49
|
anchorElement: HTMLElement | null;
|
|
@@ -38,6 +38,7 @@ export default class SelectPopup extends PureComponent {
|
|
|
38
38
|
toolbar: null,
|
|
39
39
|
topbar: null,
|
|
40
40
|
filter: false,
|
|
41
|
+
filterIcon: null,
|
|
41
42
|
filterRef: noop,
|
|
42
43
|
multiple: false,
|
|
43
44
|
message: null,
|
|
@@ -183,7 +184,7 @@ export default class SelectPopup extends PureComponent {
|
|
|
183
184
|
getFilter() {
|
|
184
185
|
if (this.props.filter || this.props.tags) {
|
|
185
186
|
return (<div className={styles.filterWrapper} data-test="ring-select-popup-filter">
|
|
186
|
-
{!this.props.tags && (<Icon glyph={searchIcon} className={styles.filterIcon} data-test-custom="ring-select-popup-filter-icon"/>)}
|
|
187
|
+
{!this.props.tags && (<Icon glyph={this.props.filterIcon ?? searchIcon} className={styles.filterIcon} data-test-custom="ring-select-popup-filter-icon"/>)}
|
|
187
188
|
<FilterWithShortcuts rgShortcutsOptions={this.state.popupFilterShortcutsOptions} rgShortcutsMap={this.popupFilterShortcutsMap} value={this.props.filterValue} inputRef={composeRefs(this.filterRef, this.props.filterRef)} onBlur={this.popupFilterOnBlur} onFocus={this.onFilterFocus} className="ring-js-shortcuts" inputClassName={classNames({ [styles.filterWithTagsInput]: this.props.tags })} placeholder={typeof this.props.filter === 'object'
|
|
188
189
|
? this.props.filter.placeholder
|
|
189
190
|
: undefined} height={this.props.tags ? ControlsHeight.S : ControlsHeight.L} onChange={this.props.onFilter} onClick={this.onClickHandler} onClear={this.props.tags ? undefined : this.props.onClear} data-test-custom="ring-select-popup-filter-input" listId={this.props.listId} enableShortcuts={Object.keys(this.popupFilterShortcutsMap)}/>
|
|
@@ -367,6 +368,7 @@ SelectPopup.propTypes = {
|
|
|
367
368
|
placeholder: PropTypes.string
|
|
368
369
|
})]),
|
|
369
370
|
filterValue: PropTypes.string,
|
|
371
|
+
filterIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
|
|
370
372
|
filterRef: PropTypes.oneOfType([
|
|
371
373
|
PropTypes.func,
|
|
372
374
|
refObject(PropTypes.instanceOf(HTMLInputElement))
|
package/dist/select/select.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { ButtonHTMLAttributes, Component, CSSProperties, HTMLAttributes, ReactNode, Ref, RefCallback, SyntheticEvent } from 'react';
|
|
1
|
+
import React, { ButtonHTMLAttributes, Component, ComponentType, CSSProperties, HTMLAttributes, ReactNode, Ref, RefCallback, SyntheticEvent } from 'react';
|
|
2
2
|
import { SelectHandlerParams } from '../list/list';
|
|
3
3
|
import { Size } from '../input/input';
|
|
4
4
|
import { LabelType } from '../control-label/control-label';
|
|
@@ -52,7 +52,8 @@ export type CustomAnchor = ((props: CustomAnchorProps) => ReactNode);
|
|
|
52
52
|
export interface BaseSelectProps<T = unknown> {
|
|
53
53
|
data: readonly SelectItem<T>[];
|
|
54
54
|
filter: boolean | Filter<T>;
|
|
55
|
-
|
|
55
|
+
filterIcon?: string | ComponentType | null | undefined;
|
|
56
|
+
filterRef?: Ref<HTMLInputElement>;
|
|
56
57
|
clear: boolean;
|
|
57
58
|
loading: boolean;
|
|
58
59
|
disabled: boolean;
|
|
@@ -158,6 +159,7 @@ export default class Select<T = unknown> extends Component<SelectProps<T>, Selec
|
|
|
158
159
|
static defaultProps: {
|
|
159
160
|
data: never[];
|
|
160
161
|
filter: boolean;
|
|
162
|
+
filterIcon: null;
|
|
161
163
|
filterRef: typeof noop;
|
|
162
164
|
multiple: boolean;
|
|
163
165
|
clear: boolean;
|
package/dist/select/select.js
CHANGED
|
@@ -735,6 +735,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
735
735
|
left: _this3.props.left,
|
|
736
736
|
filter: _this3.isInputMode() ? false : _this3.props.filter // disable popup filter in INPUT mode
|
|
737
737
|
,
|
|
738
|
+
filterIcon: _this3.props.filterIcon,
|
|
738
739
|
filterRef: _this3.props.filterRef,
|
|
739
740
|
multiple: _this3.props.multiple,
|
|
740
741
|
filterValue: _this3.state.filterValue,
|
|
@@ -1028,6 +1029,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1028
1029
|
onKeyDown: this.props.onKeyDown,
|
|
1029
1030
|
"data-test": "ring-select__focus",
|
|
1030
1031
|
enableShortcuts: shortcutsEnabled ? Object.keys(_objectSpread2(_objectSpread2({}, this.getShortcutsMap()), (_this$_popup5 = this._popup) === null || _this$_popup5 === void 0 || (_this$_popup5 = _this$_popup5.list) === null || _this$_popup5 === void 0 ? void 0 : _this$_popup5.shortcutsMap)) : undefined,
|
|
1032
|
+
icon: this.props.filterIcon,
|
|
1031
1033
|
afterInput: this.props.type === Type.INPUT && iconsNode
|
|
1032
1034
|
})), this._renderPopup()), this.props.error && /*#__PURE__*/React.createElement("div", {
|
|
1033
1035
|
className: classNames(modules_88cfaf40.errorText, modules_88cfaf40["size".concat(this.props.size)])
|
|
@@ -1175,6 +1177,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1175
1177
|
_defineProperty(Select, "defaultProps", {
|
|
1176
1178
|
data: [],
|
|
1177
1179
|
filter: false,
|
|
1180
|
+
filterIcon: null,
|
|
1178
1181
|
filterRef: noop,
|
|
1179
1182
|
multiple: false,
|
|
1180
1183
|
clear: false,
|
|
@@ -1224,6 +1227,7 @@ Select.propTypes = {
|
|
|
1224
1227
|
multiple: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
|
|
1225
1228
|
allowAny: PropTypes.bool,
|
|
1226
1229
|
filter: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
|
|
1230
|
+
filterIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
|
|
1227
1231
|
filterRef: PropTypes.oneOfType([PropTypes.func, refObject(PropTypes.instanceOf(HTMLInputElement))]),
|
|
1228
1232
|
getInitial: PropTypes.func,
|
|
1229
1233
|
onClose: PropTypes.func,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @description Displays a popup with select's options.
|
|
3
3
|
*/
|
|
4
|
-
import React, { CSSProperties, PureComponent, ReactNode, Ref, SyntheticEvent } from 'react';
|
|
4
|
+
import React, { ComponentType, CSSProperties, PureComponent, ReactNode, Ref, SyntheticEvent } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { IconType } from '../icon/icon';
|
|
7
7
|
import Popup from '../popup/popup';
|
|
@@ -43,6 +43,7 @@ export interface SelectPopupProps<T = unknown> {
|
|
|
43
43
|
toolbar: ReactNode;
|
|
44
44
|
topbar: ReactNode;
|
|
45
45
|
filter: boolean | Filter<T>;
|
|
46
|
+
filterIcon?: string | ComponentType | null | undefined;
|
|
46
47
|
filterRef?: Ref<HTMLInputElement>;
|
|
47
48
|
message: string | null;
|
|
48
49
|
anchorElement: HTMLElement | null;
|
|
@@ -388,11 +388,12 @@ var SelectPopup = /*#__PURE__*/function (_PureComponent) {
|
|
|
388
388
|
key: "getFilter",
|
|
389
389
|
value: function getFilter() {
|
|
390
390
|
if (this.props.filter || this.props.tags) {
|
|
391
|
+
var _this$props$filterIco;
|
|
391
392
|
return /*#__PURE__*/React.createElement("div", {
|
|
392
393
|
className: modules_b607bec2.filterWrapper,
|
|
393
394
|
"data-test": "ring-select-popup-filter"
|
|
394
395
|
}, !this.props.tags && /*#__PURE__*/React.createElement(Icon, {
|
|
395
|
-
glyph: searchIcon,
|
|
396
|
+
glyph: (_this$props$filterIco = this.props.filterIcon) !== null && _this$props$filterIco !== void 0 ? _this$props$filterIco : searchIcon,
|
|
396
397
|
className: modules_b607bec2.filterIcon,
|
|
397
398
|
"data-test-custom": "ring-select-popup-filter-icon"
|
|
398
399
|
}), /*#__PURE__*/React.createElement(FilterWithShortcuts, {
|
|
@@ -558,6 +559,7 @@ _defineProperty(SelectPopup, "defaultProps", {
|
|
|
558
559
|
toolbar: null,
|
|
559
560
|
topbar: null,
|
|
560
561
|
filter: false,
|
|
562
|
+
filterIcon: null,
|
|
561
563
|
filterRef: noop,
|
|
562
564
|
multiple: false,
|
|
563
565
|
message: null,
|
|
@@ -593,6 +595,7 @@ SelectPopup.propTypes = {
|
|
|
593
595
|
placeholder: PropTypes.string
|
|
594
596
|
})]),
|
|
595
597
|
filterValue: PropTypes.string,
|
|
598
|
+
filterIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
|
|
596
599
|
filterRef: PropTypes.oneOfType([PropTypes.func, refObject(PropTypes.instanceOf(HTMLInputElement))]),
|
|
597
600
|
hidden: PropTypes.bool,
|
|
598
601
|
isInputMode: PropTypes.bool,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetbrains/ring-ui",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.163",
|
|
4
4
|
"description": "JetBrains UI library",
|
|
5
5
|
"author": "JetBrains",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"@types/react-dom": "^18.2.7",
|
|
110
110
|
"@types/sinon": "^10.0.15",
|
|
111
111
|
"@types/sinon-chai": "^3.2.9",
|
|
112
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
112
|
+
"@typescript-eslint/eslint-plugin": "^6.2.0",
|
|
113
113
|
"@typescript-eslint/parser": "^6.2.0",
|
|
114
114
|
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
|
|
115
115
|
"acorn": "^8.10.0",
|