@jetbrains/ring-ui 7.0.72 → 7.0.73
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/babel.config.js +14 -8
- package/components/alert/alert.d.ts +1 -1
- package/components/alert/{alert.js → alert.jsx} +14 -8
- package/components/alert/{container.js → container.jsx} +4 -3
- package/components/alert-service/alert-service.d.ts +1 -1
- package/components/alert-service/{alert-service.js → alert-service.jsx} +8 -5
- package/components/auth/auth-core.js +6 -7
- package/components/auth/{down-notification.js → down-notification.jsx} +12 -4
- package/components/auth/{iframe-flow.js → iframe-flow.jsx} +6 -5
- package/components/auth/storage.js +1 -1
- package/components/auth/token-validator.js +1 -1
- package/components/auth/window-flow.js +2 -2
- package/components/auth-dialog/auth-dialog.d.ts +1 -1
- package/components/auth-dialog/{auth-dialog.js → auth-dialog.jsx} +18 -2
- package/components/auth-dialog-service/{auth-dialog-service.js → auth-dialog-service.jsx} +3 -2
- package/components/avatar/avatar-info.d.ts +1 -1
- package/components/avatar/{avatar-info.js → avatar-info.jsx} +4 -3
- package/components/avatar/avatar.d.ts +1 -1
- package/components/avatar/{avatar.js → avatar.jsx} +11 -6
- package/components/avatar/fallback-avatar.d.ts +1 -1
- package/components/avatar/{fallback-avatar.js → fallback-avatar.jsx} +16 -2
- package/components/avatar-stack/avatar-stack.d.ts +1 -1
- package/components/avatar-stack/avatar-stack.jsx +24 -0
- package/components/banner/banner.d.ts +1 -1
- package/components/banner/{banner.js → banner.jsx} +15 -3
- package/components/breadcrumbs/breadcrumbs.d.ts +1 -1
- package/components/breadcrumbs/{breadcrumbs.js → breadcrumbs.jsx} +4 -2
- package/components/button/button.d.ts +1 -1
- package/components/button/{button.js → button.jsx} +13 -5
- package/components/button-group/button-group.d.ts +1 -1
- package/components/button-group/{button-group.js → button-group.jsx} +5 -2
- package/components/button-group/caption.d.ts +1 -1
- package/components/button-group/{caption.js → caption.jsx} +1 -2
- package/components/button-set/button-set.d.ts +1 -1
- package/components/button-set/{button-set.js → button-set.jsx} +3 -2
- package/components/button-toolbar/button-toolbar.d.ts +1 -1
- package/components/button-toolbar/{button-toolbar.js → button-toolbar.jsx} +1 -2
- package/components/checkbox/checkbox.d.ts +1 -1
- package/components/checkbox/{checkbox.js → checkbox.jsx} +13 -2
- package/components/code/code.d.ts +1 -1
- package/components/code/{code.js → code.jsx} +8 -5
- package/components/collapse/collapse-content.jsx +65 -0
- package/components/collapse/{collapse-control.js → collapse-control.jsx} +6 -3
- package/components/collapse/{collapse.js → collapse.jsx} +12 -8
- package/components/confirm/confirm.d.ts +1 -1
- package/components/confirm/{confirm.js → confirm.jsx} +13 -2
- package/components/confirm-service/{confirm-service.js → confirm-service.jsx} +3 -2
- package/components/content-layout/content-layout.d.ts +1 -1
- package/components/content-layout/{content-layout.js → content-layout.jsx} +6 -2
- package/components/content-layout/sidebar.d.ts +1 -1
- package/components/content-layout/{sidebar.js → sidebar.jsx} +11 -2
- package/components/contenteditable/contenteditable.d.ts +2 -2
- package/components/contenteditable/{contenteditable.js → contenteditable.jsx} +5 -6
- package/components/control-help/control-help.d.ts +1 -1
- package/components/control-help/{control-help.js → control-help.jsx} +1 -2
- package/components/control-label/{control-label.js → control-label.jsx} +5 -3
- package/components/data-list/data-list.d.ts +1 -1
- package/components/data-list/{data-list.js → data-list.jsx} +17 -8
- package/components/data-list/data-list.mock.d.ts +1 -1
- package/components/data-list/data-list.mock.jsx +215 -0
- package/components/data-list/item.d.ts +2 -2
- package/components/data-list/{item.js → item.jsx} +23 -7
- package/components/data-list/title.d.ts +1 -1
- package/components/data-list/{title.js → title.jsx} +11 -2
- package/components/date-picker/consts.js +1 -1
- package/components/date-picker/date-input.d.ts +1 -1
- package/components/date-picker/{date-input.js → date-input.jsx} +1 -2
- package/components/date-picker/date-picker.d.ts +1 -1
- package/components/date-picker/{date-picker.js → date-picker.jsx} +24 -12
- package/components/date-picker/date-popup.d.ts +1 -1
- package/components/date-picker/{date-popup.js → date-popup.jsx} +20 -9
- package/components/date-picker/day.d.ts +1 -1
- package/components/date-picker/{day.js → day.jsx} +4 -3
- package/components/date-picker/month-names.d.ts +1 -1
- package/components/date-picker/{month-names.js → month-names.jsx} +12 -7
- package/components/date-picker/month-slider.d.ts +1 -1
- package/components/date-picker/{month-slider.js → month-slider.jsx} +4 -3
- package/components/date-picker/month.d.ts +1 -1
- package/components/date-picker/{month.js → month.jsx} +4 -3
- package/components/date-picker/months.d.ts +1 -1
- package/components/date-picker/{months.js → months.jsx} +9 -6
- package/components/date-picker/weekdays.d.ts +1 -1
- package/components/date-picker/{weekdays.js → weekdays.jsx} +6 -3
- package/components/date-picker/years.d.ts +1 -1
- package/components/date-picker/{years.js → years.jsx} +9 -6
- package/components/dialog/dialog.d.ts +1 -1
- package/components/dialog/{dialog.js → dialog.jsx} +39 -16
- package/components/dropdown/anchor.d.ts +1 -1
- package/components/dropdown/anchor.jsx +8 -0
- package/components/dropdown/dropdown.d.ts +1 -1
- package/components/dropdown/{dropdown.js → dropdown.jsx} +10 -7
- package/components/dropdown-menu/{dropdown-menu.js → dropdown-menu.jsx} +10 -5
- package/components/editable-heading/editable-heading.d.ts +2 -2
- package/components/editable-heading/{editable-heading.js → editable-heading.jsx} +31 -3
- package/components/error-bubble/error-bubble.d.ts +1 -1
- package/components/error-bubble/error-bubble.jsx +23 -0
- package/components/error-message/error-message.d.ts +1 -1
- package/components/error-message/error-message.jsx +25 -0
- package/components/footer/{footer.js → footer.jsx} +14 -7
- package/components/global/create-stateful-context.d.ts +1 -1
- package/components/global/{create-stateful-context.js → create-stateful-context.jsx} +3 -2
- package/components/global/{focus-sensor-hoc.js → focus-sensor-hoc.jsx} +1 -2
- package/components/global/get-uid.js +1 -1
- package/components/global/react-dom-renderer.d.ts +1 -1
- package/components/global/{react-dom-renderer.js → react-dom-renderer.jsx} +1 -2
- package/components/global/{rerender-hoc.js → rerender-hoc.jsx} +2 -3
- package/components/global/{theme.js → theme.jsx} +12 -4
- package/components/grid/col.d.ts +1 -1
- package/components/grid/{col.js → col.jsx} +3 -2
- package/components/grid/grid.d.ts +1 -1
- package/components/grid/{grid.js → grid.jsx} +3 -2
- package/components/grid/row.d.ts +1 -1
- package/components/grid/{row.js → row.jsx} +3 -2
- package/components/group/group.d.ts +1 -1
- package/components/group/{group.js → group.jsx} +3 -2
- package/components/header/header-icon.d.ts +1 -1
- package/components/header/{header-icon.js → header-icon.jsx} +1 -2
- package/components/header/header.d.ts +1 -1
- package/components/header/{header.js → header.jsx} +4 -3
- package/components/header/links.d.ts +1 -1
- package/components/header/{links.js → links.jsx} +1 -2
- package/components/header/logo.d.ts +1 -1
- package/components/header/{logo.js → logo.jsx} +3 -2
- package/components/header/{profile.js → profile.jsx} +19 -6
- package/components/header/services-link.d.ts +1 -1
- package/components/header/services-link.jsx +16 -0
- package/components/header/services.d.ts +1 -1
- package/components/header/{services.js → services.jsx} +16 -11
- package/components/header/smart-profile.d.ts +1 -1
- package/components/header/{smart-profile.js → smart-profile.jsx} +1 -2
- package/components/header/smart-services.d.ts +1 -1
- package/components/header/{smart-services.js → smart-services.jsx} +1 -2
- package/components/header/tray.d.ts +1 -1
- package/components/header/{tray.js → tray.jsx} +4 -3
- package/components/heading/{heading.js → heading.jsx} +16 -9
- package/components/i18n/{i18n-context.js → i18n-context.jsx} +1 -2
- package/components/icon/icon-svg.d.ts +1 -1
- package/components/icon/{icon-svg.js → icon-svg.jsx} +2 -3
- package/components/icon/icon.d.ts +1 -1
- package/components/icon/{icon.js → icon.jsx} +4 -3
- package/components/input/input.d.ts +1 -1
- package/components/input/{input.js → input.jsx} +16 -2
- package/components/island/{adaptive-island-hoc.js → adaptive-island-hoc.jsx} +5 -2
- package/components/island/content.d.ts +1 -1
- package/components/island/{content.js → content.jsx} +13 -6
- package/components/island/header.d.ts +1 -1
- package/components/island/{header.js → header.jsx} +13 -6
- package/components/island/island.d.ts +1 -1
- package/components/island/{island.js → island.jsx} +3 -2
- package/components/link/clickable-link.d.ts +1 -1
- package/components/link/{clickable-link.js → clickable-link.jsx} +4 -2
- package/components/link/{link.js → link.jsx} +6 -3
- package/components/list/list-custom.d.ts +1 -1
- package/components/list/{list-custom.js → list-custom.jsx} +4 -2
- package/components/list/list-hint.d.ts +1 -1
- package/components/list/{list-hint.js → list-hint.jsx} +3 -2
- package/components/list/list-item.d.ts +1 -1
- package/components/list/{list-item.js → list-item.jsx} +33 -5
- package/components/list/list-separator.d.ts +1 -1
- package/components/list/{list-separator.js → list-separator.jsx} +3 -2
- package/components/list/list-title.d.ts +1 -1
- package/components/list/list-title.jsx +19 -0
- package/components/list/list-users-groups-source.js +1 -1
- package/components/list/list.classes.js +1 -1
- package/components/list/list.d.ts +6 -6
- package/components/list/{list.js → list.jsx} +45 -23
- package/components/loader/loader.d.ts +1 -1
- package/components/loader/{loader.js → loader.jsx} +12 -6
- package/components/loader-inline/loader-inline.d.ts +1 -1
- package/components/loader-inline/{loader-inline.js → loader-inline.jsx} +5 -3
- package/components/loader-screen/loader-screen.d.ts +1 -1
- package/components/loader-screen/{loader-screen.js → loader-screen.jsx} +3 -2
- package/components/login-dialog/login-dialog.d.ts +1 -1
- package/components/login-dialog/{login-dialog.js → login-dialog.jsx} +9 -2
- package/components/login-dialog/{service.js → service.jsx} +3 -2
- package/components/markdown/markdown.d.ts +1 -1
- package/components/markdown/{markdown.js → markdown.jsx} +3 -2
- package/components/message/message.d.ts +1 -1
- package/components/message/{message.js → message.jsx} +21 -2
- package/components/pager/pager.d.ts +5 -5
- package/components/pager/{pager.js → pager.jsx} +56 -12
- package/components/panel/panel.d.ts +1 -1
- package/components/panel/{panel.js → panel.jsx} +3 -2
- package/components/popup/popup.d.ts +2 -2
- package/components/popup/{popup.js → popup.jsx} +26 -14
- package/components/popup/popup.target.jsx +10 -0
- package/components/popup-menu/popup-menu.d.ts +1 -1
- package/components/popup-menu/{popup-menu.js → popup-menu.jsx} +3 -2
- package/components/progress-bar/progress-bar.d.ts +1 -1
- package/components/progress-bar/{progress-bar.js → progress-bar.jsx} +3 -2
- package/components/query-assist/query-assist-suggestions.d.ts +1 -1
- package/components/query-assist/{query-assist-suggestions.js → query-assist-suggestions.jsx} +10 -5
- package/components/query-assist/query-assist.d.ts +2 -2
- package/components/query-assist/{query-assist.js → query-assist.jsx} +46 -8
- package/components/radio/radio-item.d.ts +1 -1
- package/components/radio/{radio-item.js → radio-item.jsx} +11 -3
- package/components/radio/radio.d.ts +1 -1
- package/components/radio/{radio.js → radio.jsx} +1 -2
- package/components/scrollable-section/scrollable-section.d.ts +1 -1
- package/components/scrollable-section/{scrollable-section.js → scrollable-section.jsx} +2 -3
- package/components/select/select-filter.d.ts +1 -1
- package/components/select/{select-filter.js → select-filter.jsx} +5 -2
- package/components/select/select-popup.d.ts +7 -7
- package/components/select/{select-popup.js → select-popup.jsx} +43 -13
- package/components/select/select.d.ts +3 -3
- package/components/select/{select.js → select.jsx} +92 -44
- package/components/shortcuts/{shortcuts-hoc.js → shortcuts-hoc.jsx} +3 -2
- package/components/slider/{slider.js → slider.jsx} +50 -32
- package/components/tab-trap/{tab-trap.js → tab-trap.jsx} +39 -33
- package/components/table/cell.d.ts +1 -1
- package/components/table/{cell.js → cell.jsx} +3 -2
- package/components/table/{disable-hover-hoc.js → disable-hover-hoc.jsx} +2 -3
- package/components/table/header-cell.d.ts +1 -1
- package/components/table/{header-cell.js → header-cell.jsx} +12 -2
- package/components/table/header.d.ts +2 -2
- package/components/table/{header.js → header.jsx} +19 -6
- package/components/table/multitable.d.ts +1 -1
- package/components/table/{multitable.js → multitable.jsx} +4 -3
- package/components/table/row-with-focus-sensor.d.ts +1 -1
- package/components/table/{row-with-focus-sensor.js → row-with-focus-sensor.jsx} +1 -2
- package/components/table/row.d.ts +1 -1
- package/components/table/{row.js → row.jsx} +24 -5
- package/components/table/{selection-shortcuts-hoc.js → selection-shortcuts-hoc.jsx} +1 -2
- package/components/table/simple-table.d.ts +1 -1
- package/components/table/{simple-table.js → simple-table.jsx} +2 -3
- package/components/table/smart-table.d.ts +1 -1
- package/components/table/{smart-table.js → smart-table.jsx} +1 -2
- package/components/table/table.d.ts +2 -2
- package/components/table/{table.js → table.jsx} +30 -9
- package/components/tabs/collapsible-more.d.ts +3 -3
- package/components/tabs/{collapsible-more.js → collapsible-more.jsx} +14 -7
- package/components/tabs/collapsible-tab.d.ts +1 -1
- package/components/tabs/{collapsible-tab.js → collapsible-tab.jsx} +3 -4
- package/components/tabs/collapsible-tabs.d.ts +2 -2
- package/components/tabs/{collapsible-tabs.js → collapsible-tabs.jsx} +11 -3
- package/components/tabs/dumb-tabs.d.ts +2 -2
- package/components/tabs/{dumb-tabs.js → dumb-tabs.jsx} +10 -4
- package/components/tabs/smart-tabs.d.ts +1 -1
- package/components/tabs/{smart-tabs.js → smart-tabs.jsx} +3 -2
- package/components/tabs/tab-link.d.ts +1 -1
- package/components/tabs/tab-link.jsx +16 -0
- package/components/tabs/tab.d.ts +1 -1
- package/components/tabs/{tab.js → tab.jsx} +3 -2
- package/components/tag/tag.d.ts +5 -5
- package/components/tag/{tag.js → tag.jsx} +24 -16
- package/components/tags-input/tags-input.d.ts +1 -1
- package/components/tags-input/{tags-input.js → tags-input.jsx} +13 -5
- package/components/tags-list/tags-list.d.ts +2 -2
- package/components/tags-list/{tags-list.js → tags-list.jsx} +8 -4
- package/components/text/text.d.ts +1 -1
- package/components/text/{text.js → text.jsx} +3 -2
- package/components/toggle/toggle.d.ts +1 -1
- package/components/toggle/toggle.jsx +37 -0
- package/components/tooltip/tooltip.d.ts +1 -1
- package/components/tooltip/{tooltip.js → tooltip.jsx} +12 -3
- package/components/upload/{upload.js → upload.jsx} +7 -4
- package/components/user-agreement/{service.js → service.jsx} +13 -4
- package/components/user-agreement/user-agreement.d.ts +1 -1
- package/components/user-agreement/user-agreement.jsx +61 -0
- package/components/user-card/card.d.ts +1 -1
- package/components/user-card/card.jsx +64 -0
- package/components/user-card/smart-user-card-tooltip.d.ts +2 -2
- package/components/user-card/{smart-user-card-tooltip.js → smart-user-card-tooltip.jsx} +6 -3
- package/components/user-card/tooltip.d.ts +2 -2
- package/components/user-card/{tooltip.js → tooltip.jsx} +12 -9
- package/package.json +28 -33
- package/components/avatar-stack/avatar-stack.js +0 -18
- package/components/collapse/collapse-content.js +0 -76
- package/components/data-list/data-list.mock.js +0 -170
- package/components/dropdown/anchor.js +0 -7
- package/components/error-bubble/error-bubble.js +0 -17
- package/components/error-message/error-message.js +0 -17
- package/components/header/services-link.js +0 -15
- package/components/list/list-title.js +0 -13
- package/components/popup/popup.target.js +0 -7
- package/components/tabs/tab-link.js +0 -9
- package/components/toggle/toggle.js +0 -22
- package/components/user-agreement/user-agreement.js +0 -33
- package/components/user-card/card.js +0 -31
- /package/components/global/{controls-height.js → controls-height.jsx} +0 -0
- /package/components/link/{clickableLink.js → clickableLink.jsx} +0 -0
- /package/components/tabs/{custom-item.js → custom-item.jsx} +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
import { Component, createContext, forwardRef } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import getUID from '../global/get-uid';
|
|
@@ -18,10 +17,19 @@ export class RadioItemInner extends Component {
|
|
|
18
17
|
render() {
|
|
19
18
|
const { className, children, help, ...restProps } = this.props;
|
|
20
19
|
const classes = classNames(styles.radio, className);
|
|
21
|
-
return (
|
|
20
|
+
return (<label ref={this.labelRef} className={classes} htmlFor={this.uid}>
|
|
21
|
+
<input id={this.uid} {...restProps} ref={this.inputRef} className={styles.input} type='radio'/>
|
|
22
|
+
<span className={styles.circle}/>
|
|
23
|
+
<span className={styles.label}>
|
|
24
|
+
{children}
|
|
25
|
+
{help && <ControlHelp>{help}</ControlHelp>}
|
|
26
|
+
</span>
|
|
27
|
+
</label>);
|
|
22
28
|
}
|
|
23
29
|
}
|
|
24
30
|
const RadioItem = forwardRef(function RadioItem(props, ref) {
|
|
25
|
-
return (
|
|
31
|
+
return (<RadioContext.Consumer>
|
|
32
|
+
{({ value, onChange, ...restContext }) => (<RadioItemInner ref={ref} {...restContext} checked={value !== undefined ? value === props.value : undefined} onChange={onChange ? () => onChange(props.value) : undefined} {...props}/>)}
|
|
33
|
+
</RadioContext.Consumer>);
|
|
26
34
|
});
|
|
27
35
|
export default RadioItem;
|
|
@@ -6,5 +6,5 @@ import { type RadioProps } from './radio-item';
|
|
|
6
6
|
export default class Radio extends Component<RadioProps> {
|
|
7
7
|
static Item: import("react").ForwardRefExoticComponent<import("./radio-item").RadioItemProps & import("react").RefAttributes<import("./radio-item").RadioItemInner>>;
|
|
8
8
|
uid: string;
|
|
9
|
-
render(): import("react
|
|
9
|
+
render(): import("react").JSX.Element;
|
|
10
10
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { Component } from 'react';
|
|
3
2
|
import getUID from '../global/get-uid';
|
|
4
3
|
import RadioItem, { RadioContext } from './radio-item';
|
|
@@ -9,6 +8,6 @@ export default class Radio extends Component {
|
|
|
9
8
|
static Item = RadioItem;
|
|
10
9
|
uid = getUID('ring-radio-');
|
|
11
10
|
render() {
|
|
12
|
-
return
|
|
11
|
+
return <RadioContext.Provider value={{ name: this.uid, ...this.props }}>{this.props.children}</RadioContext.Provider>;
|
|
13
12
|
}
|
|
14
13
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type HTMLAttributes } from 'react';
|
|
2
|
-
export default function ScrollableSection({ className, ...restProps }: HTMLAttributes<HTMLDivElement>): import("react
|
|
2
|
+
export default function ScrollableSection({ className, ...restProps }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import styles from './scrollable-section.css';
|
|
@@ -22,10 +21,10 @@ export default function ScrollableSection({ className, ...restProps }) {
|
|
|
22
21
|
window.addEventListener('resize', calculateScrollPosition);
|
|
23
22
|
return () => window.removeEventListener('resize', calculateScrollPosition);
|
|
24
23
|
}, [calculateScrollPosition]);
|
|
25
|
-
return (
|
|
24
|
+
return (<div {...restProps} className={classNames(styles.scrollableSection, className, {
|
|
26
25
|
[styles.withTopBorder]: !scrolledToTop,
|
|
27
26
|
[styles.withRightBorder]: !scrolledToRight,
|
|
28
27
|
[styles.withBottomBorder]: !scrolledToBottom,
|
|
29
28
|
[styles.withLeftBorder]: !scrolledToLeft,
|
|
30
|
-
})
|
|
29
|
+
})} ref={ref} onScroll={calculateScrollPosition}/>);
|
|
31
30
|
}
|
|
@@ -13,6 +13,6 @@ export default class SelectFilter extends Component<SelectFilterProps> {
|
|
|
13
13
|
blur(): void;
|
|
14
14
|
input?: HTMLInputElement | HTMLTextAreaElement | null;
|
|
15
15
|
inputRef: (el: HTMLInputElement | HTMLTextAreaElement | null) => void;
|
|
16
|
-
render(): import("react
|
|
16
|
+
render(): import("react").JSX.Element;
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { Component } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import Input from '../input/input';
|
|
@@ -35,6 +34,10 @@ export default class SelectFilter extends Component {
|
|
|
35
34
|
render() {
|
|
36
35
|
const { className, listId, ...restProps } = this.props;
|
|
37
36
|
const classes = classNames(styles.filter, className);
|
|
38
|
-
return (
|
|
37
|
+
return (<ActiveItemContext.ValueContext.Consumer>
|
|
38
|
+
{activeItemId => (<I18nContext.Consumer>
|
|
39
|
+
{({ translate }) => (<Input {...restProps} placeholder={restProps.placeholder ?? translate('filterItems')} aria-owns={listId} aria-activedescendant={activeItemId} autoComplete='off' autoFocus borderless inputRef={this.inputRef} className={classes}/>)}
|
|
40
|
+
</I18nContext.Consumer>)}
|
|
41
|
+
</ActiveItemContext.ValueContext.Consumer>);
|
|
39
42
|
}
|
|
40
43
|
}
|
|
@@ -110,17 +110,17 @@ export default class SelectPopup<T = unknown> extends PureComponent<SelectPopupP
|
|
|
110
110
|
onListSelect: (selected: ListDataItem<T>, event?: Event | SyntheticEvent, opts?: SelectHandlerParams) => void;
|
|
111
111
|
tabPress: (event: Event) => void;
|
|
112
112
|
onClickHandler: () => void | undefined;
|
|
113
|
-
getFilter():
|
|
113
|
+
getFilter(): React.JSX.Element | null;
|
|
114
114
|
handleRemoveTag: (arg: ListDataItem<T>) => (event: SyntheticEvent) => void;
|
|
115
115
|
handleTagClick: (arg: ListDataItem<T>) => () => void;
|
|
116
116
|
getCustomTag(tags: Tags | boolean | null): ((tag: TagAttrs) => ReactNode) | undefined;
|
|
117
|
-
getTags(): false |
|
|
118
|
-
getFilterWithTags():
|
|
119
|
-
getBottomLine(): "" |
|
|
117
|
+
getTags(): false | React.JSX.Element;
|
|
118
|
+
getFilterWithTags(): React.JSX.Element | null;
|
|
119
|
+
getBottomLine(): "" | React.JSX.Element | null;
|
|
120
120
|
handleListResize: () => void;
|
|
121
|
-
getList(ringPopupTarget: string | Element | undefined):
|
|
121
|
+
getList(ringPopupTarget: string | Element | undefined): React.JSX.Element | null;
|
|
122
122
|
handleSelectAll: () => void;
|
|
123
|
-
getSelectAll: () => false |
|
|
123
|
+
getSelectAll: () => false | React.JSX.Element;
|
|
124
124
|
private _adjustListMaxHeight;
|
|
125
125
|
popupRef: (el: Popup | null) => void;
|
|
126
126
|
list?: List<T> | null;
|
|
@@ -132,6 +132,6 @@ export default class SelectPopup<T = unknown> extends PureComponent<SelectPopupP
|
|
|
132
132
|
tab: (event: Event) => void;
|
|
133
133
|
};
|
|
134
134
|
popupFilterShortcutsMap: ShortcutsMap;
|
|
135
|
-
render():
|
|
135
|
+
render(): React.JSX.Element;
|
|
136
136
|
}
|
|
137
137
|
export type SelectPopupAttrs<T = unknown> = React.JSX.LibraryManagedAttributes<typeof SelectPopup, SelectPopupProps<T>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
/* eslint-disable max-lines */
|
|
3
2
|
/**
|
|
4
3
|
* @description Displays a popup with select's options.
|
|
5
4
|
*/
|
|
6
5
|
import { PureComponent, } from 'react';
|
|
6
|
+
import * as React from 'react';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import searchIcon from '@jetbrains/icons/search';
|
|
9
9
|
import memoizeOne from 'memoize-one';
|
|
@@ -183,7 +183,10 @@ export default class SelectPopup extends PureComponent {
|
|
|
183
183
|
onClickHandler = () => this.filter?.focus();
|
|
184
184
|
getFilter() {
|
|
185
185
|
if (this.props.filter || this.props.tags) {
|
|
186
|
-
return (
|
|
186
|
+
return (<div className={styles.filterWrapper} data-test='ring-select-popup-filter'>
|
|
187
|
+
{!this.props.tags && (<Icon glyph={this.props.filterIcon ?? searchIcon} className={styles.filterIcon} data-test-custom='ring-select-popup-filter-icon'/>)}
|
|
188
|
+
<FilterWithShortcuts rgShortcutsOptions={this.state.popupFilterShortcutsOptions} rgShortcutsMap={this.popupFilterShortcutsMap} value={this.props.filterValue} inputRef={this.composedFilterRef(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' ? this.props.filter.placeholder : 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)}/>
|
|
189
|
+
</div>);
|
|
187
190
|
}
|
|
188
191
|
return null;
|
|
189
192
|
}
|
|
@@ -202,7 +205,9 @@ export default class SelectPopup extends PureComponent {
|
|
|
202
205
|
return undefined;
|
|
203
206
|
}
|
|
204
207
|
getTags() {
|
|
205
|
-
return (Array.isArray(this.props.selected) && (
|
|
208
|
+
return (Array.isArray(this.props.selected) && (<div>
|
|
209
|
+
<TagsList tags={this.props.selected} activeIndex={this.state.tagsActiveIndex} handleRemove={this.handleRemoveTag} handleClick={this.handleTagClick} disabled={this.props.disabled} customTagComponent={this.getCustomTag(this.props.tags)}/>
|
|
210
|
+
</div>));
|
|
206
211
|
}
|
|
207
212
|
getFilterWithTags() {
|
|
208
213
|
if (this.props.tags) {
|
|
@@ -212,16 +217,23 @@ export default class SelectPopup extends PureComponent {
|
|
|
212
217
|
[styles.filterWithTagsFocused]: !this.state.popupFilterShortcutsOptions.disabled,
|
|
213
218
|
},
|
|
214
219
|
]);
|
|
215
|
-
return (
|
|
220
|
+
return (<div className={classes}>
|
|
221
|
+
{this.getTags()}
|
|
222
|
+
{this.getFilter()}
|
|
223
|
+
</div>);
|
|
216
224
|
}
|
|
217
225
|
return this.getFilter();
|
|
218
226
|
}
|
|
219
227
|
getBottomLine() {
|
|
220
228
|
const { loading, message, data } = this.props;
|
|
221
229
|
const hasMoreThanOneItem = data.length > 1;
|
|
222
|
-
return ((loading || message) && (
|
|
230
|
+
return ((loading || message) && (<div className={classNames(styles.bottomLine, {
|
|
223
231
|
[styles.bottomLineOverItem]: hasMoreThanOneItem,
|
|
224
|
-
})
|
|
232
|
+
})}>
|
|
233
|
+
{loading && <LoaderInline />}
|
|
234
|
+
|
|
235
|
+
{message && <div className={styles.message}>{message}</div>}
|
|
236
|
+
</div>));
|
|
225
237
|
}
|
|
226
238
|
handleListResize = () => {
|
|
227
239
|
this.forceUpdate();
|
|
@@ -238,7 +250,7 @@ export default class SelectPopup extends PureComponent {
|
|
|
238
250
|
if (this.props.toolbar) {
|
|
239
251
|
maxHeight -= TOOLBAR_HEIGHT;
|
|
240
252
|
}
|
|
241
|
-
return (
|
|
253
|
+
return (<List id={this.props.listId} maxHeight={maxHeight} data={this.props.data} activeIndex={this.props.activeIndex} ref={this.listRef} restoreActiveIndex activateFirstItem onSelect={this.onListSelect} onResize={this.handleListResize} onScrollToBottom={this.props.onLoadMore} hidden={this.props.hidden} shortcuts={!this.props.hidden} disableMoveOverflow={this.props.disableMoveOverflow} disableMoveDownOverflow={this.props.loading} disableScrollToActive={this.props.disableScrollToActive} compact={this.props.compact} preventListOverscroll={this.props.preventListOverscroll} renderOptimization={this.props.renderOptimization}/>);
|
|
242
254
|
}
|
|
243
255
|
return null;
|
|
244
256
|
}
|
|
@@ -250,9 +262,14 @@ export default class SelectPopup extends PureComponent {
|
|
|
250
262
|
getSelectAll = () => {
|
|
251
263
|
const multiple = this.props.multiple;
|
|
252
264
|
const activeFilters = this.props.data.filter(item => !item.disabled);
|
|
253
|
-
return (Array.isArray(this.props.selected) && (
|
|
254
|
-
|
|
255
|
-
|
|
265
|
+
return (Array.isArray(this.props.selected) && (<div className={styles.selectAll}>
|
|
266
|
+
{activeFilters.length === 0 ? (<span />) : (<Button inline onClick={this.handleSelectAll}>
|
|
267
|
+
{activeFilters.length !== this.props.selected.length
|
|
268
|
+
? multiple.selectAllLabel || 'Select all'
|
|
269
|
+
: multiple.deselectAllLabel || 'Deselect all'}
|
|
270
|
+
</Button>)}
|
|
271
|
+
{multiple.renderSelectedItemsDescription?.(this.props.selected, activeFilters.length) || (<Text info>{`${this.props.selected.length} selected`}</Text>)}
|
|
272
|
+
</div>));
|
|
256
273
|
};
|
|
257
274
|
// Cache the value because this method is called
|
|
258
275
|
// inside `render` function which can be called N times
|
|
@@ -308,13 +325,26 @@ export default class SelectPopup extends PureComponent {
|
|
|
308
325
|
render() {
|
|
309
326
|
const { toolbar, topbar, className, multiple, hidden, isInputMode, anchorElement, minWidth, onCloseAttempt, onOutsideClick, directions, top, left, offset, style, dir, filter, } = this.props;
|
|
310
327
|
const classes = classNames(styles.popup, className);
|
|
311
|
-
return (
|
|
328
|
+
return (<PopupTargetContext.Consumer>
|
|
329
|
+
{ringPopupTarget => {
|
|
312
330
|
const filterWithTags = this.getFilterWithTags();
|
|
313
331
|
const selectAll = multiple && typeof multiple === 'object' && !multiple.limit && multiple.selectAll && this.getSelectAll();
|
|
314
332
|
const list = this.getList(this.props.ringPopupTarget || ringPopupTarget);
|
|
315
333
|
const bottomLine = this.getBottomLine();
|
|
316
334
|
const hasContent = filterWithTags || selectAll || list || bottomLine || toolbar || topbar;
|
|
317
|
-
return (
|
|
318
|
-
|
|
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>
|
|
336
|
+
<div dir={dir}>
|
|
337
|
+
{!hidden && filter && <Shortcuts map={this.shortcutsMap} scope={this.shortcutsScope}/>}
|
|
338
|
+
{topbar}
|
|
339
|
+
{/* Add empty div to prevent the change of List position in DOM*/}
|
|
340
|
+
{hidden ? <div /> : filterWithTags}
|
|
341
|
+
{selectAll}
|
|
342
|
+
{list}
|
|
343
|
+
{bottomLine}
|
|
344
|
+
{toolbar}
|
|
345
|
+
</div>
|
|
346
|
+
</Popup>);
|
|
347
|
+
}}
|
|
348
|
+
</PopupTargetContext.Consumer>);
|
|
319
349
|
}
|
|
320
350
|
}
|
|
@@ -235,7 +235,7 @@ export default class Select<T = unknown> extends Component<SelectProps<T>, Selec
|
|
|
235
235
|
_showPopup: () => void;
|
|
236
236
|
_hidePopup: (tryFocusAnchor?: boolean) => void;
|
|
237
237
|
addHandler: () => void;
|
|
238
|
-
getToolbar():
|
|
238
|
+
getToolbar(): React.JSX.Element | null;
|
|
239
239
|
getTopbar(): ReactNode;
|
|
240
240
|
getLowerCaseLabel: typeof getLowerCaseLabel;
|
|
241
241
|
doesLabelMatch: typeof doesLabelMatch;
|
|
@@ -276,8 +276,8 @@ export default class Select<T = unknown> extends Component<SelectProps<T>, Selec
|
|
|
276
276
|
'shift+down': typeof noop;
|
|
277
277
|
space: typeof noop;
|
|
278
278
|
};
|
|
279
|
-
renderSelect(activeItemId: string | undefined):
|
|
280
|
-
render():
|
|
279
|
+
renderSelect(activeItemId: string | undefined): React.JSX.Element;
|
|
280
|
+
render(): React.JSX.Element;
|
|
281
281
|
}
|
|
282
282
|
export type SingleSelectAttrs<T = unknown> = React.JSX.LibraryManagedAttributes<typeof Select, SingleSelectProps<T>>;
|
|
283
283
|
export type MultipleSelectAttrs<T = unknown> = React.JSX.LibraryManagedAttributes<typeof Select, MultipleSelectProps<T>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
1
|
/* eslint-disable max-lines */
|
|
3
2
|
import { Component, Fragment, } from 'react';
|
|
3
|
+
import * as React from 'react';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import chevronDownIcon from '@jetbrains/icons/chevron-down';
|
|
6
6
|
import closeIcon from '@jetbrains/icons/close-12px';
|
|
@@ -22,8 +22,8 @@ import { I18nContext } from '../i18n/i18n-context';
|
|
|
22
22
|
import { createComposedRef } from '../global/compose-refs';
|
|
23
23
|
import { isArray } from '../global/typescript-utils';
|
|
24
24
|
import { ControlsHeight, ControlsHeightContext } from '../global/controls-height';
|
|
25
|
-
import inputStyles from '../input/input.css';
|
|
26
25
|
import SelectPopup from './select-popup';
|
|
26
|
+
import inputStyles from '../input/input.css';
|
|
27
27
|
import styles from './select.css';
|
|
28
28
|
/**
|
|
29
29
|
* @name Select
|
|
@@ -408,7 +408,9 @@ export default class Select extends Component {
|
|
|
408
408
|
separator: reset.separator,
|
|
409
409
|
key: reset.label,
|
|
410
410
|
rgItemType: List.ListProps.Type.CUSTOM,
|
|
411
|
-
template: (
|
|
411
|
+
template: (<Button inline className={styles.button} data-test='ring-select-reset-tags-button' height={ControlsHeight.S}>
|
|
412
|
+
{reset.label}
|
|
413
|
+
</Button>),
|
|
412
414
|
glyph: reset.glyph,
|
|
413
415
|
onClick: resetHandler,
|
|
414
416
|
};
|
|
@@ -432,7 +434,8 @@ export default class Select extends Component {
|
|
|
432
434
|
// eslint-disable-next-line no-underscore-dangle
|
|
433
435
|
const _shownData = this._prependResetOption(shownData);
|
|
434
436
|
const activeIndex = this._getActiveIndex(_shownData);
|
|
435
|
-
return (
|
|
437
|
+
return (<I18nContext.Consumer>
|
|
438
|
+
{({ translate }) => {
|
|
436
439
|
let message;
|
|
437
440
|
if (this.props.loading) {
|
|
438
441
|
message = this.props.loadingMessage ?? translate('loading');
|
|
@@ -440,8 +443,10 @@ export default class Select extends Component {
|
|
|
440
443
|
else if (!shownData.length) {
|
|
441
444
|
message = this.props.notFoundMessage ?? translate('noOptionsFound');
|
|
442
445
|
}
|
|
443
|
-
return (
|
|
444
|
-
|
|
446
|
+
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
|
|
447
|
+
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}/>);
|
|
448
|
+
}}
|
|
449
|
+
</I18nContext.Consumer>);
|
|
445
450
|
}
|
|
446
451
|
_showPopup = () => {
|
|
447
452
|
if (!this.node) {
|
|
@@ -477,9 +482,15 @@ export default class Select extends Component {
|
|
|
477
482
|
if (!isToolbarHasElements) {
|
|
478
483
|
return null;
|
|
479
484
|
}
|
|
480
|
-
return (
|
|
485
|
+
return (<div className={classNames({
|
|
481
486
|
[styles.toolbar]: Boolean(this.state.addButton || renderBottomToolbar),
|
|
482
|
-
})
|
|
487
|
+
})} data-test='ring-select-toolbar'>
|
|
488
|
+
{renderBottomToolbar && renderBottomToolbar()}
|
|
489
|
+
{this.state.addButton && (<Button inline delayed={delayed} className={classNames(styles.button, styles.buttonSpaced)} onClick={this.addHandler} data-test='ring-select-toolbar-button'>
|
|
490
|
+
{prefix ? `${prefix} ${label}` : label}
|
|
491
|
+
</Button>)}
|
|
492
|
+
{hint && <List.ListHint label={hint} data-test='ring-select-toolbar-hint'/>}
|
|
493
|
+
</div>);
|
|
483
494
|
}
|
|
484
495
|
getTopbar() {
|
|
485
496
|
return this.props.renderTopToolbar?.();
|
|
@@ -743,19 +754,19 @@ export default class Select extends Component {
|
|
|
743
754
|
const icons = [];
|
|
744
755
|
const height = this.getHeight();
|
|
745
756
|
if (!Array.isArray(selected) && selected?.icon) {
|
|
746
|
-
icons.push(
|
|
757
|
+
icons.push(<button title='Toggle options popup' type='button' className={styles.selectedIcon} key='selected' disabled={this.props.disabled} onClick={this._clickHandler} style={{ backgroundImage: `url(${selected.icon})` }}/>);
|
|
747
758
|
}
|
|
748
759
|
if (clear && !disabled && !this._selectionIsEmpty()) {
|
|
749
|
-
icons.push(
|
|
760
|
+
icons.push(<Button title='Clear selection' data-test='ring-clear-select' className={styles.clearIcon} key='close' disabled={this.props.disabled} onClick={this.clear} height={height} icon={closeIcon}/>);
|
|
750
761
|
}
|
|
751
762
|
if (!hideArrow) {
|
|
752
|
-
icons.push(
|
|
763
|
+
icons.push(<Button title='Toggle options popup' className={styles.chevron} iconClassName={styles.chevronIcon} icon={chevronDownIcon} key='hide' disabled={this.props.disabled} height={height} onClick={this._clickHandler}/>);
|
|
753
764
|
}
|
|
754
765
|
return icons;
|
|
755
766
|
}
|
|
756
767
|
_getAvatar() {
|
|
757
768
|
return (!Array.isArray(this.state.selected) &&
|
|
758
|
-
(this.state.selected?.avatar || this.state.selected?.showGeneratedAvatar) && (
|
|
769
|
+
(this.state.selected?.avatar || this.state.selected?.showGeneratedAvatar) && (<Avatar className={styles.avatar} url={this.state.selected.avatar} username={this.state.selected.username} size={AvatarSize.Size20}/>));
|
|
759
770
|
}
|
|
760
771
|
filter;
|
|
761
772
|
filterRef = (el) => {
|
|
@@ -789,7 +800,7 @@ export default class Select extends Component {
|
|
|
789
800
|
if (this.props.type === Type.INPUT || this.props.type === Type.BUTTON) {
|
|
790
801
|
const icons = this._getIcons();
|
|
791
802
|
style = getStyle(icons.length);
|
|
792
|
-
iconsNode =
|
|
803
|
+
iconsNode = <div className={styles.icons}>{icons}</div>;
|
|
793
804
|
}
|
|
794
805
|
const ariaProps = {
|
|
795
806
|
role: 'combobox',
|
|
@@ -801,45 +812,82 @@ export default class Select extends Component {
|
|
|
801
812
|
switch (this.props.type) {
|
|
802
813
|
case Type.INPUT_WITHOUT_CONTROLS:
|
|
803
814
|
case Type.INPUT:
|
|
804
|
-
return (
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
815
|
+
return (<>
|
|
816
|
+
<div ref={this.nodeRef} className={classNames(classes, styles.inputMode)} data-test={dataTests('ring-select', dataTest)} role='presentation' // has interactive elements inside
|
|
817
|
+
onMouseDown={this.mouseDownHandler} onMouseUp={this.mouseUpHandler}>
|
|
818
|
+
{shortcutsEnabled && <Shortcuts map={this.getShortcutsMap()} scope={this.shortcutsScope}/>}
|
|
819
|
+
<Input {...ariaProps} height={this.props.height} autoComplete='off' id={this.props.id} onClick={this._clickHandler} inputRef={this.composedFilterRef(this.filterRef, this.props.filterRef)} disabled={this.props.disabled} value={this.state.filterValue} borderless={this.props.type === Type.INPUT_WITHOUT_CONTROLS} style={style} size={Size.FULL} onChange={this._filterChangeHandler} onFocus={this._focusHandler} onBlur={this._blurHandler}
|
|
820
|
+
// Input with error style without description
|
|
821
|
+
error={this.props.error ? '' : null} label={this.props.type === Type.INPUT ? this._getLabel() : null} placeholder={this.props.inputPlaceholder} onKeyDown={this.props.onKeyDown} data-test='ring-select__focus' enableShortcuts={shortcutsEnabled
|
|
822
|
+
? Object.keys({
|
|
823
|
+
...this.getShortcutsMap(),
|
|
824
|
+
...this._popup?.list?.shortcutsMap,
|
|
825
|
+
})
|
|
826
|
+
: undefined} icon={this.props.filterIcon} afterInput={iconsNode}/>
|
|
827
|
+
{this._renderPopup()}
|
|
828
|
+
</div>
|
|
829
|
+
{this.props.error && (<div className={classNames(inputStyles.errorText, inputStyles[`size${this.props.size}`])}>
|
|
830
|
+
{this.props.error}
|
|
831
|
+
</div>)}
|
|
832
|
+
</>);
|
|
813
833
|
case Type.BUTTON:
|
|
814
|
-
return (
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
834
|
+
return (<div ref={this.nodeRef} className={classNames(classes, styles.buttonMode)} data-test={dataTests('ring-select', dataTest)}>
|
|
835
|
+
{selectedLabel && (<ControlLabel type={this.props.labelType} disabled={this.props.disabled} htmlFor={this.props.id}>
|
|
836
|
+
{selectedLabel}
|
|
837
|
+
</ControlLabel>)}
|
|
838
|
+
{shortcutsEnabled && <Shortcuts map={this.getShortcutsMap()} scope={this.shortcutsScope}/>}
|
|
839
|
+
<div className={styles.buttonContainer}>
|
|
840
|
+
<Button {...ariaProps} height={this.props.height} id={this.props.id} onClick={this._clickHandler} className={classNames(this.props.buttonClassName, styles.buttonValue, {
|
|
841
|
+
[styles.buttonValueOpen]: this.state.showPopup,
|
|
842
|
+
[styles.buttonValueEmpty]: this._selectionIsEmpty(),
|
|
843
|
+
})} disabled={this.props.disabled} style={style} data-test='ring-select__button ring-select__focus'>
|
|
844
|
+
{this._getAvatar()}
|
|
845
|
+
{this._getPlaceholder()}
|
|
846
|
+
</Button>
|
|
847
|
+
{iconsNode}
|
|
848
|
+
</div>
|
|
849
|
+
{this._renderPopup()}
|
|
850
|
+
</div>);
|
|
818
851
|
case Type.INLINE:
|
|
819
|
-
return (
|
|
852
|
+
return (<div className={classes} ref={this.nodeRef} data-test={dataTests('ring-select', dataTest)}>
|
|
853
|
+
{shortcutsEnabled && <Shortcuts map={this.getShortcutsMap()} scope={this.shortcutsScope}/>}
|
|
854
|
+
<Anchor {...ariaProps} className={this.props.buttonClassName ?? undefined} id={this.props.id} onClick={this._clickHandler} data-test='ring-select__focus' disabled={this.props.disabled} active={this.state.showPopup}>
|
|
855
|
+
{this._getPlaceholder()}
|
|
856
|
+
</Anchor>
|
|
857
|
+
{this._renderPopup()}
|
|
858
|
+
</div>);
|
|
820
859
|
default:
|
|
821
860
|
if (this.props.customAnchor) {
|
|
822
|
-
return (
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
}
|
|
861
|
+
return (<Fragment>
|
|
862
|
+
{shortcutsEnabled && <Shortcuts map={this.getShortcutsMap()} scope={this.shortcutsScope}/>}
|
|
863
|
+
{this.props.customAnchor({
|
|
864
|
+
wrapperProps: {
|
|
865
|
+
ref: this.nodeRef,
|
|
866
|
+
'data-test': dataTests('ring-select', dataTest),
|
|
867
|
+
},
|
|
868
|
+
buttonProps: {
|
|
869
|
+
...ariaProps,
|
|
870
|
+
id: this.props.id,
|
|
871
|
+
onClick: this._clickHandler,
|
|
872
|
+
disabled: this.props.disabled,
|
|
873
|
+
children: this._getPlaceholder(),
|
|
874
|
+
'data-test': 'ring-select__focus',
|
|
875
|
+
},
|
|
876
|
+
popup: this._renderPopup(),
|
|
877
|
+
})}
|
|
878
|
+
</Fragment>);
|
|
837
879
|
}
|
|
838
|
-
return (
|
|
880
|
+
return (<span id={this.props.id} ref={this.nodeRef} data-test='ring-select'>
|
|
881
|
+
{this._renderPopup()}
|
|
882
|
+
</span>);
|
|
839
883
|
}
|
|
840
884
|
}
|
|
841
885
|
render() {
|
|
842
|
-
return (
|
|
886
|
+
return (<ActiveItemContext.Provider>
|
|
887
|
+
<ActiveItemContext.ValueContext.Consumer>
|
|
888
|
+
{activeItemId => this.renderSelect(activeItemId)}
|
|
889
|
+
</ActiveItemContext.ValueContext.Consumer>
|
|
890
|
+
</ActiveItemContext.Provider>);
|
|
843
891
|
}
|
|
844
892
|
}
|
|
845
893
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { Component } from 'react';
|
|
3
2
|
import getUID from '../global/get-uid';
|
|
4
3
|
import Shortcuts from './shortcuts';
|
|
@@ -7,7 +6,9 @@ export default function shortcutsHOC(ComposedComponent) {
|
|
|
7
6
|
_shortcutsScopeUid = getUID('rg-shortcuts-');
|
|
8
7
|
render() {
|
|
9
8
|
const { rgShortcutsOptions, rgShortcutsMap, ...props } = this.props;
|
|
10
|
-
return (
|
|
9
|
+
return (<Shortcuts scope={this._shortcutsScopeUid} map={rgShortcutsMap} options={rgShortcutsOptions} disabled={rgShortcutsOptions.disabled}>
|
|
10
|
+
<ComposedComponent {...props}/>
|
|
11
|
+
</Shortcuts>);
|
|
11
12
|
}
|
|
12
13
|
};
|
|
13
14
|
}
|