@jetbrains/ring-ui 7.0.11 → 7.0.12
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/alert/alert.d.ts +1 -1
- package/components/alert/alert.js +8 -14
- package/components/alert/container.js +3 -4
- package/components/alert-service/alert-service.d.ts +1 -1
- package/components/alert-service/alert-service.js +5 -8
- package/components/auth/down-notification.js +4 -12
- package/components/auth/iframe-flow.js +2 -3
- package/components/auth-dialog/auth-dialog.d.ts +1 -1
- package/components/auth-dialog/auth-dialog.js +2 -18
- package/components/auth-dialog-service/auth-dialog-service.js +2 -3
- package/components/avatar/avatar.d.ts +1 -1
- package/components/avatar/avatar.js +4 -8
- package/components/avatar/fallback-avatar.d.ts +1 -1
- package/components/avatar/fallback-avatar.js +2 -18
- package/components/breadcrumbs/breadcrumbs.d.ts +1 -1
- package/components/breadcrumbs/breadcrumbs.js +2 -4
- package/components/button/button.css +1 -1
- package/components/button/button.d.ts +1 -1
- package/components/button/button.js +4 -11
- package/components/button-group/button-group.d.ts +1 -1
- package/components/button-group/button-group.js +2 -5
- package/components/button-group/caption.d.ts +1 -1
- package/components/button-group/caption.js +2 -1
- package/components/button-set/button-set.d.ts +1 -1
- package/components/button-set/button-set.js +2 -3
- package/components/button-toolbar/button-toolbar.d.ts +1 -1
- package/components/button-toolbar/button-toolbar.js +2 -1
- package/components/checkbox/checkbox.d.ts +1 -1
- package/components/checkbox/checkbox.js +2 -13
- package/components/code/code.d.ts +1 -1
- package/components/code/code.js +5 -8
- package/components/collapse/collapse-content.js +3 -7
- package/components/collapse/collapse-control.js +3 -5
- package/components/collapse/collapse.js +8 -12
- package/components/confirm/confirm.d.ts +1 -1
- package/components/confirm/confirm.js +2 -15
- package/components/confirm-service/confirm-service.js +2 -3
- package/components/content-layout/content-layout.d.ts +1 -1
- package/components/content-layout/content-layout.js +2 -6
- package/components/content-layout/sidebar.d.ts +1 -1
- package/components/content-layout/sidebar.js +2 -11
- package/components/contenteditable/contenteditable.d.ts +2 -2
- package/components/contenteditable/contenteditable.js +6 -5
- package/components/control-help/control-help.d.ts +1 -1
- package/components/control-help/control-help.js +2 -1
- package/components/control-label/control-label.js +3 -5
- package/components/data-list/data-list.d.ts +3 -3
- package/components/data-list/data-list.js +8 -17
- package/components/data-list/data-list.mock.d.ts +1 -1
- package/components/data-list/data-list.mock.js +27 -72
- package/components/data-list/item.d.ts +2 -2
- package/components/data-list/item.js +7 -23
- package/components/data-list/title.d.ts +1 -1
- package/components/data-list/title.js +2 -11
- package/components/date-picker/date-input.d.ts +1 -1
- package/components/date-picker/date-input.js +2 -1
- package/components/date-picker/date-picker.d.ts +1 -1
- package/components/date-picker/date-picker.js +11 -23
- package/components/date-picker/date-popup.d.ts +1 -1
- package/components/date-picker/date-popup.js +9 -20
- package/components/date-picker/day.d.ts +1 -1
- package/components/date-picker/day.js +3 -4
- package/components/date-picker/month-names.d.ts +1 -1
- package/components/date-picker/month-names.js +7 -12
- package/components/date-picker/month-slider.d.ts +1 -1
- package/components/date-picker/month-slider.js +3 -4
- package/components/date-picker/month.d.ts +1 -1
- package/components/date-picker/month.js +3 -4
- package/components/date-picker/months.d.ts +1 -1
- package/components/date-picker/months.js +5 -8
- package/components/date-picker/weekdays.d.ts +1 -1
- package/components/date-picker/weekdays.js +3 -6
- package/components/date-picker/years.d.ts +1 -1
- package/components/date-picker/years.js +5 -8
- package/components/dialog/dialog.d.ts +1 -1
- package/components/dialog/dialog.js +12 -33
- package/components/dropdown/anchor.d.ts +1 -1
- package/components/dropdown/anchor.js +2 -3
- package/components/dropdown/dropdown.d.ts +1 -1
- package/components/dropdown/dropdown.js +7 -10
- package/components/dropdown-menu/dropdown-menu.js +4 -9
- package/components/editable-heading/editable-heading.d.ts +2 -2
- package/components/editable-heading/editable-heading.js +2 -30
- package/components/error-bubble/error-bubble.d.ts +1 -1
- package/components/error-bubble/error-bubble.js +2 -8
- package/components/error-message/error-message.d.ts +1 -1
- package/components/error-message/error-message.js +2 -10
- package/components/footer/footer.js +7 -14
- package/components/global/create-stateful-context.d.ts +1 -1
- package/components/global/create-stateful-context.js +2 -3
- package/components/global/focus-sensor-hoc.js +2 -1
- package/components/global/react-dom-renderer.d.ts +1 -1
- package/components/global/react-dom-renderer.js +2 -1
- package/components/global/rerender-hoc.js +3 -2
- package/components/global/theme.js +3 -11
- package/components/grid/col.d.ts +1 -1
- package/components/grid/col.js +2 -3
- package/components/grid/grid.d.ts +1 -1
- package/components/grid/grid.js +2 -3
- package/components/grid/row.d.ts +1 -1
- package/components/grid/row.js +2 -3
- package/components/group/group.d.ts +1 -1
- package/components/group/group.js +2 -3
- package/components/header/header-icon.d.ts +1 -1
- package/components/header/header-icon.js +2 -1
- package/components/header/header.d.ts +1 -1
- package/components/header/header.js +3 -4
- package/components/header/links.d.ts +1 -1
- package/components/header/links.js +2 -1
- package/components/header/logo.d.ts +1 -1
- package/components/header/logo.js +2 -3
- package/components/header/profile.d.ts +1 -1
- package/components/header/profile.js +6 -19
- package/components/header/services-link.d.ts +1 -1
- package/components/header/services-link.js +5 -6
- package/components/header/services.d.ts +1 -1
- package/components/header/services.js +10 -15
- package/components/header/smart-profile.d.ts +1 -1
- package/components/header/smart-profile.js +2 -1
- package/components/header/smart-services.d.ts +1 -1
- package/components/header/smart-services.js +2 -1
- package/components/header/tray.d.ts +1 -1
- package/components/header/tray.js +3 -4
- package/components/heading/heading.js +6 -7
- package/components/i18n/i18n-context.js +2 -1
- package/components/icon/icon.d.ts +1 -1
- package/components/icon/icon.js +2 -3
- package/components/icon/icon__svg.d.ts +1 -1
- package/components/icon/icon__svg.js +3 -2
- package/components/input/input.d.ts +1 -1
- package/components/input/input.js +2 -15
- package/components/island/adaptive-island-hoc.d.ts +2 -2
- package/components/island/adaptive-island-hoc.js +2 -5
- package/components/island/content.d.ts +1 -1
- package/components/island/content.js +5 -12
- package/components/island/header.d.ts +1 -1
- package/components/island/header.js +5 -12
- package/components/island/island.d.ts +3 -3
- package/components/island/island.js +2 -3
- package/components/link/clickableLink.d.ts +1 -1
- package/components/link/clickableLink.js +2 -4
- package/components/link/link.d.ts +4 -4
- package/components/link/link.js +3 -6
- package/components/list/list.d.ts +6 -6
- package/components/list/list.js +18 -38
- package/components/list/list__custom.d.ts +1 -1
- package/components/list/list__custom.js +2 -4
- package/components/list/list__hint.d.ts +1 -1
- package/components/list/list__hint.js +2 -3
- package/components/list/list__item.d.ts +1 -1
- package/components/list/list__item.js +3 -31
- package/components/list/list__link.d.ts +1 -1
- package/components/list/list__link.js +2 -3
- package/components/list/list__separator.d.ts +1 -1
- package/components/list/list__separator.js +2 -3
- package/components/list/list__title.d.ts +1 -1
- package/components/list/list__title.js +2 -8
- package/components/loader/loader.d.ts +1 -1
- package/components/loader/loader.js +2 -1
- package/components/loader-inline/loader-inline.d.ts +1 -1
- package/components/loader-inline/loader-inline.js +3 -5
- package/components/loader-screen/loader-screen.d.ts +1 -1
- package/components/loader-screen/loader-screen.js +2 -3
- package/components/login-dialog/login-dialog.d.ts +1 -1
- package/components/login-dialog/login-dialog.js +2 -9
- package/components/login-dialog/service.js +2 -3
- package/components/markdown/markdown.d.ts +1 -1
- package/components/markdown/markdown.js +2 -3
- package/components/message/message.d.ts +1 -1
- package/components/message/message.js +2 -21
- package/components/pager/pager.d.ts +5 -5
- package/components/pager/pager.js +11 -55
- package/components/panel/panel.d.ts +1 -1
- package/components/panel/panel.js +2 -3
- package/components/popup/popup.d.ts +2 -2
- package/components/popup/popup.js +13 -25
- package/components/popup/popup.target.js +3 -6
- package/components/popup-menu/popup-menu.d.ts +1 -1
- package/components/popup-menu/popup-menu.js +2 -3
- package/components/progress-bar/progress-bar.d.ts +1 -1
- package/components/progress-bar/progress-bar.js +2 -3
- package/components/query-assist/query-assist.d.ts +2 -2
- package/components/query-assist/query-assist.js +7 -45
- package/components/query-assist/query-assist__suggestions.d.ts +1 -1
- package/components/query-assist/query-assist__suggestions.js +5 -10
- package/components/radio/radio.d.ts +1 -1
- package/components/radio/radio.js +2 -1
- package/components/radio/radio__item.d.ts +1 -1
- package/components/radio/radio__item.js +3 -11
- package/components/scrollable-section/scrollable-section.d.ts +1 -1
- package/components/scrollable-section/scrollable-section.js +3 -2
- package/components/select/select.d.ts +3 -3
- package/components/select/select.js +43 -91
- package/components/select/select__filter.d.ts +1 -1
- package/components/select/select__filter.js +2 -5
- package/components/select/select__popup.d.ts +7 -7
- package/components/select/select__popup.js +13 -43
- package/components/shortcuts/shortcuts-hoc.d.ts +2 -2
- package/components/shortcuts/shortcuts-hoc.js +2 -3
- package/components/slider/slider.js +31 -49
- package/components/tab-trap/tab-trap.js +9 -15
- package/components/table/cell.d.ts +1 -1
- package/components/table/cell.js +2 -3
- package/components/table/disable-hover-hoc.d.ts +2 -2
- package/components/table/disable-hover-hoc.js +2 -1
- package/components/table/header-cell.d.ts +1 -1
- package/components/table/header-cell.js +2 -12
- package/components/table/header.d.ts +2 -2
- package/components/table/header.js +5 -18
- package/components/table/multitable.d.ts +1 -1
- package/components/table/multitable.js +3 -4
- package/components/table/row-with-focus-sensor.d.ts +1 -1
- package/components/table/row-with-focus-sensor.js +2 -1
- package/components/table/row.d.ts +1 -1
- package/components/table/row.js +5 -24
- package/components/table/selection-shortcuts-hoc.js +2 -1
- package/components/table/simple-table.d.ts +1 -1
- package/components/table/simple-table.js +2 -1
- package/components/table/smart-table.d.ts +1 -1
- package/components/table/smart-table.js +2 -1
- package/components/table/table.d.ts +4 -4
- package/components/table/table.js +8 -29
- package/components/tabs/collapsible-more.d.ts +3 -3
- package/components/tabs/collapsible-more.js +6 -13
- package/components/tabs/collapsible-tab.d.ts +1 -1
- package/components/tabs/collapsible-tab.js +3 -2
- package/components/tabs/collapsible-tabs.d.ts +2 -2
- package/components/tabs/collapsible-tabs.js +2 -10
- package/components/tabs/dumb-tabs.d.ts +2 -3
- package/components/tabs/dumb-tabs.js +3 -9
- package/components/tabs/smart-tabs.d.ts +1 -1
- package/components/tabs/smart-tabs.js +2 -3
- package/components/tabs/tab-link.d.ts +1 -1
- package/components/tabs/tab-link.js +2 -9
- package/components/tabs/tab.d.ts +1 -1
- package/components/tabs/tab.js +2 -3
- package/components/tag/tag.d.ts +5 -5
- package/components/tag/tag.js +15 -23
- package/components/tags-input/tags-input.d.ts +1 -1
- package/components/tags-input/tags-input.js +4 -12
- package/components/tags-list/tags-list.d.ts +2 -2
- package/components/tags-list/tags-list.js +4 -8
- package/components/text/text.d.ts +1 -1
- package/components/text/text.js +2 -3
- package/components/toggle/toggle.d.ts +1 -1
- package/components/toggle/toggle.js +2 -17
- package/components/tooltip/tooltip.d.ts +1 -1
- package/components/tooltip/tooltip.js +2 -11
- package/components/user-agreement/service.js +3 -12
- package/components/user-agreement/user-agreement.d.ts +1 -1
- package/components/user-agreement/user-agreement.js +2 -29
- package/components/user-card/card.d.ts +1 -1
- package/components/user-card/card.js +4 -37
- package/components/user-card/smart-user-card-tooltip.d.ts +2 -2
- package/components/user-card/smart-user-card-tooltip.js +3 -6
- package/components/user-card/tooltip.d.ts +2 -2
- package/components/user-card/tooltip.js +9 -12
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
1
2
|
import { Component, Fragment, } from 'react';
|
|
2
|
-
import * as React from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import chevronDownIcon from '@jetbrains/icons/chevron-down';
|
|
5
5
|
import closeIcon from '@jetbrains/icons/close-12px';
|
|
@@ -411,9 +411,7 @@ export default class Select extends Component {
|
|
|
411
411
|
separator: reset.separator,
|
|
412
412
|
key: reset.label,
|
|
413
413
|
rgItemType: List.ListProps.Type.CUSTOM,
|
|
414
|
-
template: (
|
|
415
|
-
{reset.label}
|
|
416
|
-
</Button>),
|
|
414
|
+
template: (_jsx(Button, { inline: true, className: styles.button, "data-test": "ring-select-reset-tags-button", height: ControlsHeight.S, children: reset.label })),
|
|
417
415
|
glyph: reset.glyph,
|
|
418
416
|
onClick: resetHandler,
|
|
419
417
|
};
|
|
@@ -435,8 +433,7 @@ export default class Select extends Component {
|
|
|
435
433
|
const anchorElement = this.props.targetElement || this.node;
|
|
436
434
|
const { showPopup, shownData } = this.state;
|
|
437
435
|
const _shownData = this._prependResetOption(shownData);
|
|
438
|
-
return (
|
|
439
|
-
{({ translate }) => {
|
|
436
|
+
return (_jsx(I18nContext.Consumer, { children: ({ translate }) => {
|
|
440
437
|
let message;
|
|
441
438
|
if (this.props.loading) {
|
|
442
439
|
message = this.props.loadingMessage ?? translate('loading');
|
|
@@ -444,10 +441,8 @@ export default class Select extends Component {
|
|
|
444
441
|
else if (!shownData.length) {
|
|
445
442
|
message = this.props.notFoundMessage ?? translate('noOptionsFound');
|
|
446
443
|
}
|
|
447
|
-
return (
|
|
448
|
-
|
|
449
|
-
}}
|
|
450
|
-
</I18nContext.Consumer>);
|
|
444
|
+
return (_jsx(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, offset: this.props.offset, filter: this.isInputMode() ? false : this.props.filter, 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 }));
|
|
445
|
+
} }));
|
|
451
446
|
}
|
|
452
447
|
_showPopup = () => {
|
|
453
448
|
if (!this.node) {
|
|
@@ -482,15 +477,9 @@ export default class Select extends Component {
|
|
|
482
477
|
if (!isToolbarHasElements) {
|
|
483
478
|
return null;
|
|
484
479
|
}
|
|
485
|
-
return (
|
|
480
|
+
return (_jsxs("div", { className: classNames({
|
|
486
481
|
[styles.toolbar]: Boolean(this.state.addButton || renderBottomToolbar),
|
|
487
|
-
})} data-test
|
|
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>);
|
|
482
|
+
}), "data-test": "ring-select-toolbar", children: [renderBottomToolbar && renderBottomToolbar(), this.state.addButton && (_jsx(Button, { inline: true, delayed: delayed, className: classNames(styles.button, styles.buttonSpaced), onClick: this.addHandler, "data-test": "ring-select-toolbar-button", children: prefix ? `${prefix} ${label}` : label })), hint && _jsx(List.ListHint, { label: hint, "data-test": "ring-select-toolbar-hint" })] }));
|
|
494
483
|
}
|
|
495
484
|
getTopbar() {
|
|
496
485
|
return this.props.renderTopToolbar?.();
|
|
@@ -756,19 +745,19 @@ export default class Select extends Component {
|
|
|
756
745
|
const icons = [];
|
|
757
746
|
const height = this.props.height || this.context;
|
|
758
747
|
if (!Array.isArray(selected) && selected?.icon) {
|
|
759
|
-
icons.push(
|
|
748
|
+
icons.push(_jsx("button", { title: "Toggle options popup", type: "button", className: styles.selectedIcon, disabled: this.props.disabled, onClick: this._clickHandler, style: { backgroundImage: `url(${selected.icon})` } }, "selected"));
|
|
760
749
|
}
|
|
761
750
|
if (clear && !disabled && !this._selectionIsEmpty()) {
|
|
762
|
-
icons.push(
|
|
751
|
+
icons.push(_jsx(Button, { title: "Clear selection", "data-test": "ring-clear-select", className: styles.clearIcon, disabled: this.props.disabled, onClick: this.clear, height: height, icon: closeIcon }, "close"));
|
|
763
752
|
}
|
|
764
753
|
if (!hideArrow) {
|
|
765
|
-
icons.push(
|
|
754
|
+
icons.push(_jsx(Button, { title: "Toggle options popup", className: styles.chevron, iconClassName: styles.chevronIcon, icon: chevronDownIcon, disabled: this.props.disabled, height: height, onClick: this._clickHandler }, "hide"));
|
|
766
755
|
}
|
|
767
756
|
return icons;
|
|
768
757
|
}
|
|
769
758
|
_getAvatar() {
|
|
770
759
|
return (!Array.isArray(this.state.selected) &&
|
|
771
|
-
(this.state.selected?.avatar || this.state.selected?.showGeneratedAvatar) && (
|
|
760
|
+
(this.state.selected?.avatar || this.state.selected?.showGeneratedAvatar) && (_jsx(Avatar, { className: styles.avatar, url: this.state.selected.avatar, username: this.state.selected.username, size: AvatarSize.Size20 })));
|
|
772
761
|
}
|
|
773
762
|
filter;
|
|
774
763
|
filterRef = (el) => {
|
|
@@ -801,7 +790,7 @@ export default class Select extends Component {
|
|
|
801
790
|
if (this.props.type === Type.INPUT || this.props.type === Type.BUTTON) {
|
|
802
791
|
const icons = this._getIcons();
|
|
803
792
|
style = getStyle(icons.length);
|
|
804
|
-
iconsNode =
|
|
793
|
+
iconsNode = _jsx("div", { className: styles.icons, children: icons });
|
|
805
794
|
}
|
|
806
795
|
const ariaProps = this.state.showPopup
|
|
807
796
|
? {
|
|
@@ -815,82 +804,45 @@ export default class Select extends Component {
|
|
|
815
804
|
switch (this.props.type) {
|
|
816
805
|
case Type.INPUT_WITHOUT_CONTROLS:
|
|
817
806
|
case Type.INPUT:
|
|
818
|
-
return (
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
...this._popup?.list?.shortcutsMap,
|
|
828
|
-
})
|
|
829
|
-
: undefined} icon={this.props.filterIcon} afterInput={iconsNode}/>
|
|
830
|
-
{this._renderPopup()}
|
|
831
|
-
</div>
|
|
832
|
-
{this.props.error && (<div className={classNames(inputStyles.errorText, inputStyles[`size${this.props.size}`])}>
|
|
833
|
-
{this.props.error}
|
|
834
|
-
</div>)}
|
|
835
|
-
</>);
|
|
807
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { ref: this.nodeRef, className: classNames(classes, styles.inputMode), "data-test": dataTests('ring-select', dataTest), role: "presentation" // has interactive elements inside
|
|
808
|
+
, onMouseDown: this.mouseDownHandler, onMouseUp: this.mouseUpHandler, children: [shortcutsEnabled && _jsx(Shortcuts, { map: this.getShortcutsMap(), scope: this.shortcutsScope }), _jsx(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,
|
|
809
|
+
// Input with error style without description
|
|
810
|
+
error: this.props.error != null ? '' : 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
|
|
811
|
+
? Object.keys({
|
|
812
|
+
...this.getShortcutsMap(),
|
|
813
|
+
...this._popup?.list?.shortcutsMap,
|
|
814
|
+
})
|
|
815
|
+
: undefined, icon: this.props.filterIcon, afterInput: iconsNode }), this._renderPopup()] }), this.props.error && (_jsx("div", { className: classNames(inputStyles.errorText, inputStyles[`size${this.props.size}`]), children: this.props.error }))] }));
|
|
836
816
|
case Type.BUTTON:
|
|
837
|
-
return (
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
{shortcutsEnabled && <Shortcuts map={this.getShortcutsMap()} scope={this.shortcutsScope}/>}
|
|
842
|
-
<div className={styles.buttonContainer}>
|
|
843
|
-
<Button {...ariaProps} height={this.props.height} id={this.props.id} onClick={this._clickHandler} className={classNames(this.props.buttonClassName, styles.buttonValue, {
|
|
844
|
-
[styles.buttonValueOpen]: this.state.showPopup,
|
|
845
|
-
[styles.buttonValueEmpty]: this._selectionIsEmpty(),
|
|
846
|
-
})} disabled={this.props.disabled} style={style} data-test="ring-select__button ring-select__focus">
|
|
847
|
-
{this._getAvatar()}
|
|
848
|
-
{this._getPlaceholder()}
|
|
849
|
-
</Button>
|
|
850
|
-
{iconsNode}
|
|
851
|
-
</div>
|
|
852
|
-
{this._renderPopup()}
|
|
853
|
-
</div>);
|
|
817
|
+
return (_jsxs("div", { ref: this.nodeRef, className: classNames(classes, styles.buttonMode), "data-test": dataTests('ring-select', dataTest), children: [selectedLabel && (_jsx(ControlLabel, { type: this.props.labelType, disabled: this.props.disabled, htmlFor: this.props.id, children: selectedLabel })), shortcutsEnabled && _jsx(Shortcuts, { map: this.getShortcutsMap(), scope: this.shortcutsScope }), _jsxs("div", { className: styles.buttonContainer, children: [_jsxs(Button, { ...ariaProps, height: this.props.height, id: this.props.id, onClick: this._clickHandler, className: classNames(this.props.buttonClassName, styles.buttonValue, {
|
|
818
|
+
[styles.buttonValueOpen]: this.state.showPopup,
|
|
819
|
+
[styles.buttonValueEmpty]: this._selectionIsEmpty(),
|
|
820
|
+
}), disabled: this.props.disabled, style: style, "data-test": "ring-select__button ring-select__focus", children: [this._getAvatar(), this._getPlaceholder()] }), iconsNode] }), this._renderPopup()] }));
|
|
854
821
|
case Type.INLINE:
|
|
855
|
-
return (
|
|
856
|
-
{shortcutsEnabled && <Shortcuts map={this.getShortcutsMap()} scope={this.shortcutsScope}/>}
|
|
857
|
-
<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}>
|
|
858
|
-
{this._getPlaceholder()}
|
|
859
|
-
</Anchor>
|
|
860
|
-
{this._renderPopup()}
|
|
861
|
-
</div>);
|
|
822
|
+
return (_jsxs("div", { className: classes, ref: this.nodeRef, "data-test": dataTests('ring-select', dataTest), children: [shortcutsEnabled && _jsx(Shortcuts, { map: this.getShortcutsMap(), scope: this.shortcutsScope }), _jsx(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, children: this._getPlaceholder() }), this._renderPopup()] }));
|
|
862
823
|
default:
|
|
863
824
|
if (this.props.customAnchor) {
|
|
864
|
-
return (
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
}
|
|
879
|
-
popup: this._renderPopup(),
|
|
880
|
-
})}
|
|
881
|
-
</Fragment>);
|
|
825
|
+
return (_jsxs(Fragment, { children: [shortcutsEnabled && _jsx(Shortcuts, { map: this.getShortcutsMap(), scope: this.shortcutsScope }), this.props.customAnchor({
|
|
826
|
+
wrapperProps: {
|
|
827
|
+
ref: this.nodeRef,
|
|
828
|
+
'data-test': dataTests('ring-select', dataTest),
|
|
829
|
+
},
|
|
830
|
+
buttonProps: {
|
|
831
|
+
...ariaProps,
|
|
832
|
+
id: this.props.id,
|
|
833
|
+
onClick: this._clickHandler,
|
|
834
|
+
disabled: this.props.disabled,
|
|
835
|
+
children: this._getPlaceholder(),
|
|
836
|
+
'data-test': 'ring-select__focus',
|
|
837
|
+
},
|
|
838
|
+
popup: this._renderPopup(),
|
|
839
|
+
})] }));
|
|
882
840
|
}
|
|
883
|
-
return (
|
|
884
|
-
{this._renderPopup()}
|
|
885
|
-
</span>);
|
|
841
|
+
return (_jsx("span", { id: this.props.id, ref: this.nodeRef, "data-test": "ring-select", children: this._renderPopup() }));
|
|
886
842
|
}
|
|
887
843
|
}
|
|
888
844
|
render() {
|
|
889
|
-
return (
|
|
890
|
-
<ActiveItemContext.ValueContext.Consumer>
|
|
891
|
-
{activeItemId => this.renderSelect(activeItemId)}
|
|
892
|
-
</ActiveItemContext.ValueContext.Consumer>
|
|
893
|
-
</ActiveItemContext.Provider>);
|
|
845
|
+
return (_jsx(ActiveItemContext.Provider, { children: _jsx(ActiveItemContext.ValueContext.Consumer, { children: activeItemId => this.renderSelect(activeItemId) }) }));
|
|
894
846
|
}
|
|
895
847
|
}
|
|
896
848
|
export const RerenderableSelect = rerenderHOC(Select);
|
|
@@ -14,6 +14,6 @@ export default class SelectFilter extends Component<SelectFilterProps> {
|
|
|
14
14
|
blur(): void;
|
|
15
15
|
input?: HTMLInputElement | HTMLTextAreaElement | null;
|
|
16
16
|
inputRef: (el: HTMLInputElement | HTMLTextAreaElement | null) => void;
|
|
17
|
-
render(): import("react").JSX.Element;
|
|
17
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
}
|
|
19
19
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import { Component } from 'react';
|
|
2
3
|
import classNames from 'classnames';
|
|
3
4
|
import Input from '../input/input';
|
|
@@ -37,10 +38,6 @@ export default class SelectFilter extends Component {
|
|
|
37
38
|
render() {
|
|
38
39
|
const { className, listId, ...restProps } = this.props;
|
|
39
40
|
const classes = classNames(styles.filter, className);
|
|
40
|
-
return (
|
|
41
|
-
{activeItemId => (<I18nContext.Consumer>
|
|
42
|
-
{({ translate }) => (<Input {...restProps} placeholder={restProps.placeholder ?? translate('filterItems')} aria-owns={listId} aria-activedescendant={activeItemId} autoComplete="off" autoFocus borderless inputRef={this.inputRef} className={classes}/>)}
|
|
43
|
-
</I18nContext.Consumer>)}
|
|
44
|
-
</ActiveItemContext.ValueContext.Consumer>);
|
|
41
|
+
return (_jsx(ActiveItemContext.ValueContext.Consumer, { children: activeItemId => (_jsx(I18nContext.Consumer, { children: ({ translate }) => (_jsx(Input, { ...restProps, placeholder: restProps.placeholder ?? translate('filterItems'), "aria-owns": listId, "aria-activedescendant": activeItemId, autoComplete: "off", autoFocus: true, borderless: true, inputRef: this.inputRef, className: classes })) })) }));
|
|
45
42
|
}
|
|
46
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(): import("react/jsx-runtime").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 | import("react/jsx-runtime").JSX.Element;
|
|
118
|
+
getFilterWithTags(): import("react/jsx-runtime").JSX.Element | null;
|
|
119
|
+
getBottomLine(): "" | import("react/jsx-runtime").JSX.Element | null;
|
|
120
120
|
handleListResize: () => void;
|
|
121
|
-
getList(ringPopupTarget: string | Element | undefined):
|
|
121
|
+
getList(ringPopupTarget: string | Element | undefined): import("react/jsx-runtime").JSX.Element | null;
|
|
122
122
|
handleSelectAll: () => void;
|
|
123
|
-
getSelectAll: () => false |
|
|
123
|
+
getSelectAll: () => false | import("react/jsx-runtime").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(): import("react/jsx-runtime").JSX.Element;
|
|
136
136
|
}
|
|
137
137
|
export type SelectPopupAttrs<T = unknown> = JSX.LibraryManagedAttributes<typeof SelectPopup, SelectPopupProps<T>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
/**
|
|
2
3
|
* @description Displays a popup with select's options.
|
|
3
4
|
*/
|
|
4
5
|
import { PureComponent } from 'react';
|
|
5
|
-
import * as React from 'react';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import searchIcon from '@jetbrains/icons/search';
|
|
8
8
|
import memoizeOne from 'memoize-one';
|
|
@@ -179,10 +179,7 @@ export default class SelectPopup extends PureComponent {
|
|
|
179
179
|
onClickHandler = () => this.filter?.focus();
|
|
180
180
|
getFilter() {
|
|
181
181
|
if (this.props.filter || this.props.tags) {
|
|
182
|
-
return (
|
|
183
|
-
{!this.props.tags && (<Icon glyph={this.props.filterIcon ?? searchIcon} className={styles.filterIcon} data-test-custom="ring-select-popup-filter-icon"/>)}
|
|
184
|
-
<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)}/>
|
|
185
|
-
</div>);
|
|
182
|
+
return (_jsxs("div", { className: styles.filterWrapper, "data-test": "ring-select-popup-filter", children: [!this.props.tags && (_jsx(Icon, { glyph: this.props.filterIcon ?? searchIcon, className: styles.filterIcon, "data-test-custom": "ring-select-popup-filter-icon" })), _jsx(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) })] }));
|
|
186
183
|
}
|
|
187
184
|
return null;
|
|
188
185
|
}
|
|
@@ -201,9 +198,7 @@ export default class SelectPopup extends PureComponent {
|
|
|
201
198
|
return undefined;
|
|
202
199
|
}
|
|
203
200
|
getTags() {
|
|
204
|
-
return (Array.isArray(this.props.selected) && (
|
|
205
|
-
<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)}/>
|
|
206
|
-
</div>));
|
|
201
|
+
return (Array.isArray(this.props.selected) && (_jsx("div", { children: _jsx(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) }) })));
|
|
207
202
|
}
|
|
208
203
|
getFilterWithTags() {
|
|
209
204
|
if (this.props.tags) {
|
|
@@ -213,23 +208,16 @@ export default class SelectPopup extends PureComponent {
|
|
|
213
208
|
[styles.filterWithTagsFocused]: !this.state.popupFilterShortcutsOptions.disabled,
|
|
214
209
|
},
|
|
215
210
|
]);
|
|
216
|
-
return (
|
|
217
|
-
{this.getTags()}
|
|
218
|
-
{this.getFilter()}
|
|
219
|
-
</div>);
|
|
211
|
+
return (_jsxs("div", { className: classes, children: [this.getTags(), this.getFilter()] }));
|
|
220
212
|
}
|
|
221
213
|
return this.getFilter();
|
|
222
214
|
}
|
|
223
215
|
getBottomLine() {
|
|
224
216
|
const { loading, message, data } = this.props;
|
|
225
217
|
const hasMoreThanOneItem = data.length > 1;
|
|
226
|
-
return ((loading || message) && (
|
|
218
|
+
return ((loading || message) && (_jsxs("div", { className: classNames(styles.bottomLine, {
|
|
227
219
|
[styles.bottomLineOverItem]: hasMoreThanOneItem,
|
|
228
|
-
})}
|
|
229
|
-
{loading && <LoaderInline />}
|
|
230
|
-
|
|
231
|
-
{message && <div className={styles.message}>{message}</div>}
|
|
232
|
-
</div>));
|
|
220
|
+
}), children: [loading && _jsx(LoaderInline, {}), message && _jsx("div", { className: styles.message, children: message })] })));
|
|
233
221
|
}
|
|
234
222
|
handleListResize = () => {
|
|
235
223
|
this.forceUpdate();
|
|
@@ -246,7 +234,7 @@ export default class SelectPopup extends PureComponent {
|
|
|
246
234
|
if (this.props.toolbar) {
|
|
247
235
|
maxHeight -= TOOLBAR_HEIGHT;
|
|
248
236
|
}
|
|
249
|
-
return (
|
|
237
|
+
return (_jsx(List, { id: this.props.listId, maxHeight: maxHeight, data: this.props.data, activeIndex: this.props.activeIndex, ref: this.listRef, restoreActiveIndex: true, activateFirstItem: true, 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 }));
|
|
250
238
|
}
|
|
251
239
|
return null;
|
|
252
240
|
}
|
|
@@ -258,14 +246,9 @@ export default class SelectPopup extends PureComponent {
|
|
|
258
246
|
getSelectAll = () => {
|
|
259
247
|
const multiple = this.props.multiple;
|
|
260
248
|
const activeFilters = this.props.data.filter(item => !item.disabled);
|
|
261
|
-
return (Array.isArray(this.props.selected) && (
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
? multiple.selectAllLabel || 'Select all'
|
|
265
|
-
: multiple.deselectAllLabel || 'Deselect all'}
|
|
266
|
-
</Button>)}
|
|
267
|
-
{multiple.renderSelectedItemsDescription?.(this.props.selected, activeFilters.length) || (<Text info>{`${this.props.selected.length} selected`}</Text>)}
|
|
268
|
-
</div>));
|
|
249
|
+
return (Array.isArray(this.props.selected) && (_jsxs("div", { className: styles.selectAll, children: [activeFilters.length === 0 ? (_jsx("span", {})) : (_jsx(Button, { inline: true, onClick: this.handleSelectAll, children: activeFilters.length !== this.props.selected.length
|
|
250
|
+
? multiple.selectAllLabel || 'Select all'
|
|
251
|
+
: multiple.deselectAllLabel || 'Deselect all' })), multiple.renderSelectedItemsDescription?.(this.props.selected, activeFilters.length) || (_jsx(Text, { info: true, children: `${this.props.selected.length} selected` }))] })));
|
|
269
252
|
};
|
|
270
253
|
// Cache the value because this method is called
|
|
271
254
|
// inside `render` function which can be called N times
|
|
@@ -321,26 +304,13 @@ export default class SelectPopup extends PureComponent {
|
|
|
321
304
|
render() {
|
|
322
305
|
const { toolbar, topbar, className, multiple, hidden, isInputMode, anchorElement, minWidth, onCloseAttempt, onOutsideClick, directions, top, left, offset, style, dir, filter, } = this.props;
|
|
323
306
|
const classes = classNames(styles.popup, className);
|
|
324
|
-
return (
|
|
325
|
-
{ringPopupTarget => {
|
|
307
|
+
return (_jsx(PopupTargetContext.Consumer, { children: ringPopupTarget => {
|
|
326
308
|
const filterWithTags = this.getFilterWithTags();
|
|
327
309
|
const selectAll = multiple && typeof multiple === 'object' && !multiple.limit && multiple.selectAll && this.getSelectAll();
|
|
328
310
|
const list = this.getList(this.props.ringPopupTarget || ringPopupTarget);
|
|
329
311
|
const bottomLine = this.getBottomLine();
|
|
330
312
|
const hasContent = filterWithTags || selectAll || list || bottomLine || toolbar || topbar;
|
|
331
|
-
return (
|
|
332
|
-
|
|
333
|
-
{!hidden && filter && <Shortcuts map={this.shortcutsMap} scope={this.shortcutsScope}/>}
|
|
334
|
-
{topbar}
|
|
335
|
-
{/* Add empty div to prevent the change of List position in DOM*/}
|
|
336
|
-
{hidden ? <div /> : filterWithTags}
|
|
337
|
-
{selectAll}
|
|
338
|
-
{list}
|
|
339
|
-
{bottomLine}
|
|
340
|
-
{toolbar}
|
|
341
|
-
</div>
|
|
342
|
-
</Popup>);
|
|
343
|
-
}}
|
|
344
|
-
</PopupTargetContext.Consumer>);
|
|
313
|
+
return (_jsx(Popup, { trapFocus: false, ref: this.popupRef, hidden: hidden || !hasContent, attached: isInputMode, className: classes, dontCloseOnAnchorClick: true, 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: true, children: _jsxs("div", { dir: dir, children: [!hidden && filter && _jsx(Shortcuts, { map: this.shortcutsMap, scope: this.shortcutsScope }), topbar, hidden ? _jsx("div", {}) : filterWithTags, selectAll, list, bottomLine, toolbar] }) }));
|
|
314
|
+
} }));
|
|
345
315
|
}
|
|
346
316
|
}
|
|
@@ -10,7 +10,7 @@ export interface ShortcutsHOCProps {
|
|
|
10
10
|
export default function shortcutsHOC<P extends {}>(ComposedComponent: ComponentType<P> | string): {
|
|
11
11
|
new (props: P & ShortcutsHOCProps): {
|
|
12
12
|
_shortcutsScopeUid: string;
|
|
13
|
-
render(): import("react").JSX.Element;
|
|
13
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
context: unknown;
|
|
15
15
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<P & ShortcutsHOCProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
16
16
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
@@ -34,7 +34,7 @@ export default function shortcutsHOC<P extends {}>(ComposedComponent: ComponentT
|
|
|
34
34
|
};
|
|
35
35
|
new (props: P & ShortcutsHOCProps, context: any): {
|
|
36
36
|
_shortcutsScopeUid: string;
|
|
37
|
-
render(): import("react").JSX.Element;
|
|
37
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
38
38
|
context: unknown;
|
|
39
39
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<P & ShortcutsHOCProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
40
40
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import { Component } from 'react';
|
|
2
3
|
import getUID from '../global/get-uid';
|
|
3
4
|
import Shortcuts from './shortcuts';
|
|
@@ -6,9 +7,7 @@ export default function shortcutsHOC(ComposedComponent) {
|
|
|
6
7
|
_shortcutsScopeUid = getUID('rg-shortcuts-');
|
|
7
8
|
render() {
|
|
8
9
|
const { rgShortcutsOptions, rgShortcutsMap, ...props } = this.props;
|
|
9
|
-
return (
|
|
10
|
-
<ComposedComponent {...props}/>
|
|
11
|
-
</Shortcuts>);
|
|
10
|
+
return (_jsx(Shortcuts, { scope: this._shortcutsScopeUid, map: rgShortcutsMap, options: rgShortcutsOptions, disabled: rgShortcutsOptions.disabled, children: _jsx(ComposedComponent, { ...props }) }));
|
|
12
11
|
}
|
|
13
12
|
};
|
|
14
13
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import * as React from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { isArray } from '../global/typescript-utils';
|
|
5
5
|
import Shortcuts from '../shortcuts/shortcuts';
|
|
@@ -123,56 +123,38 @@ export const Slider = ({ defaultValue, value, min = 0, max = HUNDRED, step = 1,
|
|
|
123
123
|
window.removeEventListener('mouseup', handleMouseUp);
|
|
124
124
|
};
|
|
125
125
|
}, [isDragging, handleMouseMove, handleMouseUp, disabled]);
|
|
126
|
-
return (
|
|
127
|
-
|
|
126
|
+
return (_jsxs("div", { ref: ref, role: "presentation" // contains interactive elements
|
|
127
|
+
, className: classNames(styles.slider, className, {
|
|
128
128
|
[styles.disabled]: disabled,
|
|
129
129
|
[styles.marked]: !!marks || showTag,
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
<div className={classNames(styles.rail, {
|
|
133
|
-
[styles.rounded]: !showTicks,
|
|
134
|
-
[styles.disabled]: disabled,
|
|
135
|
-
})}/>
|
|
136
|
-
<div style={{
|
|
137
|
-
left: `${trackStart}%`,
|
|
138
|
-
width: `${trackLength}%`,
|
|
139
|
-
}} className={classNames(styles.track, {
|
|
140
|
-
[styles.rounded]: !showTicks,
|
|
141
|
-
[styles.disabled]: disabled,
|
|
142
|
-
})}/>
|
|
143
|
-
{validValues.map((numValue, index) => {
|
|
144
|
-
const percent = toPercent(numValue, min, max);
|
|
145
|
-
return (
|
|
146
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
147
|
-
<Fragment key={index}>
|
|
148
|
-
<div tabIndex={0} aria-label="Pick value" role="slider" aria-valuemin={min} aria-valuemax={max} aria-valuenow={numValue} data-index={index} style={{ left: `${percent}%` }} className={classNames(styles.thumb, {
|
|
130
|
+
}), tabIndex: -1, onMouseDown: handleMouseDown, children: [_jsx(Shortcuts, { map: shortcutsMap, scope: shortcutsScope }), _jsx("div", { className: classNames(styles.rail, {
|
|
131
|
+
[styles.rounded]: !showTicks,
|
|
149
132
|
[styles.disabled]: disabled,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
</Fragment>);
|
|
156
|
-
})}
|
|
157
|
-
{markValues.map(({ value: markValue, label }, index) => {
|
|
158
|
-
const percent = toPercent(markValue, min, max);
|
|
159
|
-
return (<div
|
|
160
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
161
|
-
key={index} style={{ left: `${percent}%` }} className={classNames(styles.markValue, { [styles.disabled]: disabled })}>
|
|
162
|
-
{label ?? markValue}
|
|
163
|
-
</div>);
|
|
164
|
-
})}
|
|
165
|
-
{tickMarks.map(({ value: tickValue }, index) => {
|
|
166
|
-
const percent = toPercent(tickValue, min, max);
|
|
167
|
-
const isActive = isRange
|
|
168
|
-
? tickValue >= validValues[0] && tickValue <= validValues[validValues.length - 1]
|
|
169
|
-
: tickValue <= validValues[0];
|
|
170
|
-
return (<div
|
|
171
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
172
|
-
key={index} className={classNames(styles.tick, {
|
|
173
|
-
[styles.active]: isActive,
|
|
133
|
+
}) }), _jsx("div", { style: {
|
|
134
|
+
left: `${trackStart}%`,
|
|
135
|
+
width: `${trackLength}%`,
|
|
136
|
+
}, className: classNames(styles.track, {
|
|
137
|
+
[styles.rounded]: !showTicks,
|
|
174
138
|
[styles.disabled]: disabled,
|
|
175
|
-
})}
|
|
176
|
-
|
|
177
|
-
|
|
139
|
+
}) }), validValues.map((numValue, index) => {
|
|
140
|
+
const percent = toPercent(numValue, min, max);
|
|
141
|
+
return (
|
|
142
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
143
|
+
_jsxs(Fragment, { children: [_jsx("div", { tabIndex: 0, "aria-label": "Pick value", role: "slider", "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": numValue, "data-index": index, style: { left: `${percent}%` }, className: classNames(styles.thumb, {
|
|
144
|
+
[styles.disabled]: disabled,
|
|
145
|
+
[styles.dragged]: isDragging && draggedIndex === index,
|
|
146
|
+
}), onMouseDown: handleMouseDown }), showTag && (_jsx("div", { style: { left: `${percent}%` }, className: classNames(styles.tag, { [styles.disabled]: disabled }), role: "tooltip", children: renderTag ? renderTag(numValue) : numValue }))] }, index));
|
|
147
|
+
}), markValues.map(({ value: markValue, label }, index) => {
|
|
148
|
+
const percent = toPercent(markValue, min, max);
|
|
149
|
+
return (_jsx("div", { style: { left: `${percent}%` }, className: classNames(styles.markValue, { [styles.disabled]: disabled }), children: label ?? markValue }, index));
|
|
150
|
+
}), tickMarks.map(({ value: tickValue }, index) => {
|
|
151
|
+
const percent = toPercent(tickValue, min, max);
|
|
152
|
+
const isActive = isRange
|
|
153
|
+
? tickValue >= validValues[0] && tickValue <= validValues[validValues.length - 1]
|
|
154
|
+
: tickValue <= validValues[0];
|
|
155
|
+
return (_jsx("div", { className: classNames(styles.tick, {
|
|
156
|
+
[styles.active]: isActive,
|
|
157
|
+
[styles.disabled]: disabled,
|
|
158
|
+
}), style: { left: `${percent}%` } }, index));
|
|
159
|
+
})] }));
|
|
178
160
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef } from 'react';
|
|
2
|
-
import * as React from 'react';
|
|
3
3
|
import { isNodeInVisiblePartOfPage } from '../global/dom';
|
|
4
4
|
import styles from './tab-trap.css';
|
|
5
5
|
export const FOCUSABLE_ELEMENTS = 'input, button, select, textarea, a[href], *[tabindex]:not([data-trap-button]):not([data-scrollable-container])';
|
|
@@ -101,20 +101,14 @@ const TabTrap = forwardRef(function TabTrap({ children, trapDisabled = false, au
|
|
|
101
101
|
focusLast();
|
|
102
102
|
}
|
|
103
103
|
if (trapDisabled) {
|
|
104
|
-
return (
|
|
105
|
-
{children}
|
|
106
|
-
</div>);
|
|
104
|
+
return (_jsx("div", { ref: nodeRef, ...restProps, children: children }));
|
|
107
105
|
}
|
|
108
|
-
return (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
// It never actually stays focused
|
|
116
|
-
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
117
|
-
tabIndex={0} onFocus={focusBackOnExit ? restoreFocus : focusFirst} data-trap-button/>
|
|
118
|
-
</div>);
|
|
106
|
+
return (_jsxs("div", { ref: nodeRef, ...restProps, children: [_jsx("div", {
|
|
107
|
+
// It never actually stays focused
|
|
108
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
109
|
+
tabIndex: 0, ref: trapButtonNodeRef, className: styles.trapButton, onFocus: focusLastIfEnabled, onBlur: handleBlurIfWithoutFocus, "data-trap-button": true }), children, _jsx("div", {
|
|
110
|
+
// It never actually stays focused
|
|
111
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
112
|
+
tabIndex: 0, onFocus: focusBackOnExit ? restoreFocus : focusFirst, "data-trap-button": true })] }));
|
|
119
113
|
});
|
|
120
114
|
export default TabTrap;
|
|
@@ -3,5 +3,5 @@ export interface CellProps extends TdHTMLAttributes<HTMLTableDataCellElement> {
|
|
|
3
3
|
'data-test'?: string | null | undefined;
|
|
4
4
|
}
|
|
5
5
|
export default class Cell extends PureComponent<CellProps> {
|
|
6
|
-
render(): import("react").JSX.Element;
|
|
6
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
}
|
package/components/table/cell.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import { PureComponent } from 'react';
|
|
2
3
|
import classNames from 'classnames';
|
|
3
4
|
import dataTests from '../global/data-tests';
|
|
@@ -5,8 +6,6 @@ import style from './table.css';
|
|
|
5
6
|
export default class Cell extends PureComponent {
|
|
6
7
|
render() {
|
|
7
8
|
const classes = classNames(style.cell, this.props.className);
|
|
8
|
-
return (
|
|
9
|
-
{this.props.children}
|
|
10
|
-
</td>);
|
|
9
|
+
return (_jsx("td", { ...this.props, className: classes, "data-test": dataTests('ring-table-cell', this.props['data-test']), children: this.props.children }));
|
|
11
10
|
}
|
|
12
11
|
}
|
|
@@ -12,7 +12,7 @@ export default function disableHoverHOC<P extends DisableHoverAddProps>(Composed
|
|
|
12
12
|
componentWillUnmount(): void;
|
|
13
13
|
onMouseMove: () => void;
|
|
14
14
|
onKeyDown: (e: KeyboardEvent) => void;
|
|
15
|
-
render(): import("react").JSX.Element;
|
|
15
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
context: unknown;
|
|
17
17
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<DisableHoverProps<P>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
18
18
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
@@ -39,7 +39,7 @@ export default function disableHoverHOC<P extends DisableHoverAddProps>(Composed
|
|
|
39
39
|
componentWillUnmount(): void;
|
|
40
40
|
onMouseMove: () => void;
|
|
41
41
|
onKeyDown: (e: KeyboardEvent) => void;
|
|
42
|
-
render(): import("react").JSX.Element;
|
|
42
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
43
43
|
context: unknown;
|
|
44
44
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<DisableHoverProps<P>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
45
45
|
forceUpdate(callback?: (() => void) | undefined): void;
|