@jetbrains/ring-ui 7.0.72 → 7.0.74
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} +17 -12
- 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
|
@@ -6,7 +6,7 @@ export interface FakeMoreButtonProps {
|
|
|
6
6
|
moreClassName?: string | null | undefined;
|
|
7
7
|
moreActiveClassName?: string | null | undefined;
|
|
8
8
|
}
|
|
9
|
-
export declare const AnchorLink: ({ hasActiveChildren, moreClassName, moreActiveClassName, ...restProps }: Omit<ContainerProps<ButtonButtonProps>, "children"> & FakeMoreButtonProps) => import("react
|
|
9
|
+
export declare const AnchorLink: ({ hasActiveChildren, moreClassName, moreActiveClassName, ...restProps }: Omit<ContainerProps<ButtonButtonProps>, "children"> & FakeMoreButtonProps) => import("react").JSX.Element;
|
|
10
10
|
export interface MoreButtonProps {
|
|
11
11
|
items: ReactElement<TabProps>[];
|
|
12
12
|
selected?: string | undefined;
|
|
@@ -17,5 +17,5 @@ export interface MoreButtonProps {
|
|
|
17
17
|
morePopupItemClassName?: string | undefined;
|
|
18
18
|
morePopupBeforeEnd: ReactNode;
|
|
19
19
|
}
|
|
20
|
-
export declare const MoreButton: import("react").MemoExoticComponent<({ items, selected, onSelect, moreClassName, moreActiveClassName, morePopupClassName, morePopupItemClassName, morePopupBeforeEnd, }: MoreButtonProps) => import("react
|
|
21
|
-
export declare const FakeMoreButton: import("react").MemoExoticComponent<({ moreClassName, moreActiveClassName, hasActiveChildren }: FakeMoreButtonProps) => import("react
|
|
20
|
+
export declare const MoreButton: import("react").MemoExoticComponent<({ items, selected, onSelect, moreClassName, moreActiveClassName, morePopupClassName, morePopupItemClassName, morePopupBeforeEnd, }: MoreButtonProps) => import("react").JSX.Element | null>;
|
|
21
|
+
export declare const FakeMoreButton: import("react").MemoExoticComponent<({ moreClassName, moreActiveClassName, hasActiveChildren }: FakeMoreButtonProps) => import("react").JSX.Element>;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { memo, useMemo } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import { Directions } from '../popup/popup.consts';
|
|
5
4
|
import PopupMenu, { ListProps } from '../popup-menu/popup-menu';
|
|
6
5
|
import Dropdown from '../dropdown/dropdown';
|
|
7
6
|
import Anchor from '../dropdown/anchor';
|
|
8
|
-
import styles from './tabs.css';
|
|
9
7
|
import getTabTitles from './collapsible-tab';
|
|
10
8
|
import { CustomItem } from './custom-item';
|
|
9
|
+
import styles from './tabs.css';
|
|
11
10
|
export const AnchorLink = ({ hasActiveChildren, moreClassName, moreActiveClassName, ...restProps }) => {
|
|
12
11
|
const classnames = classNames(styles.title, hasActiveChildren && styles.selected, hasActiveChildren && moreActiveClassName, moreClassName);
|
|
13
|
-
return (
|
|
12
|
+
return (<Anchor title={'More'} className={classnames} {...restProps}>
|
|
13
|
+
{'More'}
|
|
14
|
+
</Anchor>);
|
|
14
15
|
};
|
|
15
16
|
const morePopupDirections = [Directions.BOTTOM_CENTER, Directions.BOTTOM_LEFT, Directions.BOTTOM_RIGHT];
|
|
16
17
|
export const MoreButton = memo(({ items, selected, onSelect, moreClassName, moreActiveClassName, morePopupClassName, morePopupItemClassName, morePopupBeforeEnd, }) => {
|
|
@@ -51,13 +52,19 @@ export const MoreButton = memo(({ items, selected, onSelect, moreClassName, more
|
|
|
51
52
|
}
|
|
52
53
|
return popupItems;
|
|
53
54
|
}, [items, morePopupBeforeEnd, morePopupItemClassName, selected]);
|
|
54
|
-
const popupAnchor = useMemo(() => (
|
|
55
|
-
const popup = useMemo(() => (
|
|
55
|
+
const popupAnchor = useMemo(() => (<AnchorLink moreClassName={moreClassName} moreActiveClassName={moreActiveClassName} hasActiveChildren={hasActiveChild}/>), [hasActiveChild, moreActiveClassName, moreClassName]);
|
|
56
|
+
const popup = useMemo(() => (<PopupMenu directions={morePopupDirections} className={morePopupClassName} onSelect={onSelectHandler} data={data}/>), [data, morePopupClassName, onSelectHandler]);
|
|
56
57
|
if (items.length === 0) {
|
|
57
58
|
return null;
|
|
58
59
|
}
|
|
59
|
-
return (
|
|
60
|
+
return (<div className={classNames(styles.title, moreClassName, hasActiveChild && moreActiveClassName)}>
|
|
61
|
+
<Dropdown hoverMode anchor={popupAnchor}>
|
|
62
|
+
{popup}
|
|
63
|
+
</Dropdown>
|
|
64
|
+
</div>);
|
|
60
65
|
});
|
|
61
66
|
MoreButton.displayName = 'MoreButton';
|
|
62
|
-
export const FakeMoreButton = memo(({ moreClassName, moreActiveClassName, hasActiveChildren }) => (
|
|
67
|
+
export const FakeMoreButton = memo(({ moreClassName, moreActiveClassName, hasActiveChildren }) => (<div className={classNames(styles.moreButton, styles.title)}>
|
|
68
|
+
<AnchorLink moreClassName={moreClassName} moreActiveClassName={moreActiveClassName} hasActiveChildren={hasActiveChildren} tabIndex={-1} disabled/>
|
|
69
|
+
</div>));
|
|
63
70
|
FakeMoreButton.displayName = 'FakeMoreButton';
|
|
@@ -13,5 +13,5 @@ export interface TabTitlesParams extends Omit<Partial<TabTitleProps>, 'selected'
|
|
|
13
13
|
selected?: string | undefined;
|
|
14
14
|
onSelect?: ((key: string) => ((e: React.MouseEvent<HTMLAnchorElement>) => void) | undefined) | undefined;
|
|
15
15
|
}
|
|
16
|
-
declare const getTabTitles: ({ items, selected, collapsed, onSelect, ...props }: TabTitlesParams) =>
|
|
16
|
+
declare const getTabTitles: ({ items, selected, collapsed, onSelect, ...props }: TabTitlesParams) => React.JSX.Element[];
|
|
17
17
|
export default getTabTitles;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
|
-
import styles from './tabs.css';
|
|
5
3
|
import TabLink from './tab-link';
|
|
6
4
|
import { CustomItem } from './custom-item';
|
|
5
|
+
import styles from './tabs.css';
|
|
7
6
|
const TabTitle = React.memo(function TabTitle({ selected, child, handleSelect, collapsed = false, tabIndex, }) {
|
|
8
7
|
if (child === null || typeof child !== 'object' || child.type === CustomItem) {
|
|
9
8
|
return child;
|
|
@@ -16,11 +15,11 @@ const TabTitle = React.memo(function TabTitle({ selected, child, handleSelect, c
|
|
|
16
15
|
[collapsedClassName ?? '']: collapsed,
|
|
17
16
|
[collapsedActiveClassName ?? '']: collapsed && selected,
|
|
18
17
|
});
|
|
19
|
-
return (
|
|
18
|
+
return (<TabLink title={title} isSelected={selected} active href={href} className={titleClasses} disabled={disabled} onPlainLeftClick={handleSelect} tabIndex={tabIndex} collapsed={collapsed} {...titleProps}/>);
|
|
20
19
|
});
|
|
21
20
|
const getTabTitles = ({ items, selected = '0', collapsed, onSelect = () => undefined, ...props }) => items.map((tab, index) => {
|
|
22
21
|
const key = tab.props.id || String(index);
|
|
23
22
|
const isSelected = selected === key;
|
|
24
|
-
return (
|
|
23
|
+
return (<TabTitle key={key} handleSelect={onSelect(key)} selected={isSelected} child={tab} collapsed={collapsed} {...props}/>);
|
|
25
24
|
});
|
|
26
25
|
export default getTabTitles;
|
|
@@ -12,6 +12,6 @@ export interface CollapsibleTabsProps {
|
|
|
12
12
|
initialVisibleItems?: number | null | undefined;
|
|
13
13
|
morePopupBeforeEnd?: ReactNode;
|
|
14
14
|
}
|
|
15
|
-
export declare const CollapsibleTabs: ({ children, selected, onSelect, onLastVisibleIndexChange, moreClassName, moreActiveClassName, morePopupClassName, morePopupBeforeEnd, morePopupItemClassName, initialVisibleItems, }: CollapsibleTabsProps) => import("react
|
|
16
|
-
declare const _default: import("react").MemoExoticComponent<({ children, selected, onSelect, onLastVisibleIndexChange, moreClassName, moreActiveClassName, morePopupClassName, morePopupBeforeEnd, morePopupItemClassName, initialVisibleItems, }: CollapsibleTabsProps) => import("react
|
|
15
|
+
export declare const CollapsibleTabs: ({ children, selected, onSelect, onLastVisibleIndexChange, moreClassName, moreActiveClassName, morePopupClassName, morePopupBeforeEnd, morePopupItemClassName, initialVisibleItems, }: CollapsibleTabsProps) => import("react").JSX.Element;
|
|
16
|
+
declare const _default: import("react").MemoExoticComponent<({ children, selected, onSelect, onLastVisibleIndexChange, moreClassName, moreActiveClassName, morePopupClassName, morePopupBeforeEnd, morePopupItemClassName, initialVisibleItems, }: CollapsibleTabsProps) => import("react").JSX.Element>;
|
|
17
17
|
export default _default;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
import { useState, useRef, useMemo, useCallback, useEffect, memo } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import fastdom from 'fastdom';
|
|
5
|
-
import styles from './tabs.css';
|
|
6
4
|
import { FakeMoreButton, MoreButton } from './collapsible-more';
|
|
7
5
|
import getTabTitles from './collapsible-tab';
|
|
6
|
+
import styles from './tabs.css';
|
|
8
7
|
const DEFAULT_DEBOUNCE_INTERVAL = 100;
|
|
9
8
|
const MEASURE_TOLERANCE = 0.5;
|
|
10
9
|
export const CollapsibleTabs = ({ children, selected, onSelect, onLastVisibleIndexChange, moreClassName, moreActiveClassName, morePopupClassName, morePopupBeforeEnd, morePopupItemClassName, initialVisibleItems, }) => {
|
|
@@ -173,6 +172,15 @@ export const CollapsibleTabs = ({ children, selected, onSelect, onLastVisibleInd
|
|
|
173
172
|
}, [adjustTabs]);
|
|
174
173
|
const isAdjusted = (elements.lastVisibleIndex !== null && preparedElements.ready) || initialVisibleItems;
|
|
175
174
|
const className = classNames(styles.titles, styles.autoCollapse, isAdjusted && styles.adjusted);
|
|
176
|
-
return (
|
|
175
|
+
return (<div className={styles.autoCollapseContainer}>
|
|
176
|
+
<div className={classNames(className, styles.rendered)}>
|
|
177
|
+
{visibleElements}
|
|
178
|
+
<MoreButton moreClassName={moreClassName} moreActiveClassName={moreActiveClassName} morePopupClassName={morePopupClassName} morePopupBeforeEnd={morePopupBeforeEnd} morePopupItemClassName={morePopupItemClassName} items={hiddenElements} selected={selected} onSelect={onSelect}/>
|
|
179
|
+
</div>
|
|
180
|
+
<div ref={measureRef} className={classNames(className, styles.measure)}>
|
|
181
|
+
{childrenToMeasure}
|
|
182
|
+
<FakeMoreButton hasActiveChildren={hiddenElements.some(item => item.props.alwaysHidden && item.props.id === selected)} moreClassName={moreClassName} moreActiveClassName={moreActiveClassName}/>
|
|
183
|
+
</div>
|
|
184
|
+
</div>);
|
|
177
185
|
};
|
|
178
186
|
export default memo(CollapsibleTabs);
|
|
@@ -16,8 +16,8 @@ export interface TabsProps extends Omit<CollapsibleTabsProps, 'onSelect' | 'chil
|
|
|
16
16
|
}
|
|
17
17
|
declare class Tabs extends PureComponent<TabsProps> {
|
|
18
18
|
handleSelect: (arg: string) => () => void | undefined;
|
|
19
|
-
getTabTitle: (child: ReactElement<TabProps>, i: number) =>
|
|
20
|
-
render():
|
|
19
|
+
getTabTitle: (child: ReactElement<TabProps>, i: number) => React.JSX.Element;
|
|
20
|
+
render(): React.JSX.Element;
|
|
21
21
|
}
|
|
22
22
|
export type TabsAttrs = React.JSX.LibraryManagedAttributes<typeof Tabs, TabsProps>;
|
|
23
23
|
export default Tabs;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
import { PureComponent } from 'react';
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
import classNames from 'classnames';
|
|
5
4
|
import memoize from '../global/memoize';
|
|
6
5
|
import dataTests from '../global/data-tests';
|
|
7
|
-
import styles from './tabs.css';
|
|
8
6
|
import TabLink from './tab-link';
|
|
9
7
|
import CollapsibleTabs from './collapsible-tabs';
|
|
10
8
|
import { CustomItem } from './custom-item';
|
|
9
|
+
import styles from './tabs.css';
|
|
11
10
|
export { CustomItem };
|
|
12
11
|
class Tabs extends PureComponent {
|
|
13
12
|
handleSelect = memoize((key) => () => this.props.onSelect?.(key));
|
|
@@ -22,13 +21,20 @@ class Tabs extends PureComponent {
|
|
|
22
21
|
const titleClasses = classNames(styles.title, className, isSelected && activeClassName, {
|
|
23
22
|
[styles.selected]: isSelected,
|
|
24
23
|
});
|
|
25
|
-
return (
|
|
24
|
+
return (<TabLink title={title} isSelected={isSelected} key={key} href={href} className={titleClasses} disabled={disabled} onPlainLeftClick={onSelect ? this.handleSelect(key) : undefined} {...titleProps}/>);
|
|
26
25
|
};
|
|
27
26
|
render() {
|
|
28
27
|
const { className, tabContainerClassName, children, selected, autoCollapse, 'data-test': dataTest, onSelect, ...restProps } = this.props;
|
|
29
28
|
const classes = classNames(styles.tabs, className);
|
|
30
29
|
const childrenArray = React.Children.toArray(children).filter(Boolean);
|
|
31
|
-
return (
|
|
30
|
+
return (<div className={classes} data-test={dataTests('ring-dumb-tabs', dataTest)}>
|
|
31
|
+
{autoCollapse === true ? (<CollapsibleTabs {...restProps} onSelect={onSelect ? this.handleSelect : undefined} selected={selected}>
|
|
32
|
+
{childrenArray}
|
|
33
|
+
</CollapsibleTabs>) : (<div className={styles.titles}>{childrenArray.map(this.getTabTitle)}</div>)}
|
|
34
|
+
<div className={classNames(tabContainerClassName)}>
|
|
35
|
+
{childrenArray.find(({ props }, i) => (props.id || String(i)) === selected)}
|
|
36
|
+
</div>
|
|
37
|
+
</div>);
|
|
32
38
|
}
|
|
33
39
|
}
|
|
34
40
|
export default Tabs;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { PureComponent } from 'react';
|
|
3
2
|
import dataTests from '../global/data-tests';
|
|
4
3
|
import Tabs from './dumb-tabs';
|
|
@@ -13,6 +12,8 @@ export default class SmartTabs extends PureComponent {
|
|
|
13
12
|
handleSelect = (selected) => this.setState({ selected });
|
|
14
13
|
render() {
|
|
15
14
|
const { children, initSelected, 'data-test': dataTest, ...restProps } = this.props;
|
|
16
|
-
return (
|
|
15
|
+
return (<Tabs data-test={dataTests('ring-smart-tabs', dataTest)} selected={this.state.selected} onSelect={this.handleSelect} {...restProps}>
|
|
16
|
+
{children}
|
|
17
|
+
</Tabs>);
|
|
17
18
|
}
|
|
18
19
|
}
|
|
@@ -5,6 +5,6 @@ export interface TabLinkProps extends Omit<LinkProps, 'title' | 'children'> {
|
|
|
5
5
|
collapsed?: boolean;
|
|
6
6
|
title: ReactNode | ((isSelected: boolean, collapsed: boolean | undefined) => ReactNode);
|
|
7
7
|
}
|
|
8
|
-
declare function TabLink({ isSelected, title, collapsed, ...restProps }: TabLinkProps): import("react
|
|
8
|
+
declare function TabLink({ isSelected, title, collapsed, ...restProps }: TabLinkProps): import("react").JSX.Element;
|
|
9
9
|
declare const _default: import("react").MemoExoticComponent<typeof TabLink>;
|
|
10
10
|
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import Link from '../link/link';
|
|
3
|
+
import styles from './tabs.css';
|
|
4
|
+
function TabLink({ isSelected, title, collapsed, ...restProps }) {
|
|
5
|
+
const renderedTitle = typeof title === 'function' ? title(isSelected, collapsed) : title;
|
|
6
|
+
return (<Link {...restProps}>
|
|
7
|
+
<div className={styles.container}>
|
|
8
|
+
<span className={styles.visible}>{renderedTitle}</span>
|
|
9
|
+
{/* hack for preserving constant tab width*/}
|
|
10
|
+
<span className={styles.hidden}>{renderedTitle}</span>
|
|
11
|
+
<span className={styles.hiddenBold}>{renderedTitle}</span>
|
|
12
|
+
<span className={styles.hiddenRegular}>{renderedTitle}</span>
|
|
13
|
+
</div>
|
|
14
|
+
</Link>);
|
|
15
|
+
}
|
|
16
|
+
export default memo(TabLink);
|
package/components/tabs/tab.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { PureComponent } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import dataTests from '../global/data-tests';
|
|
5
4
|
export default class Tab extends PureComponent {
|
|
6
5
|
render() {
|
|
7
6
|
const { className, children, 'data-test': dataTest } = this.props;
|
|
8
|
-
return (
|
|
7
|
+
return (<div data-test={dataTests('ring-tab', dataTest)} className={classNames(className)}>
|
|
8
|
+
{children}
|
|
9
|
+
</div>);
|
|
9
10
|
}
|
|
10
11
|
}
|
package/components/tag/tag.d.ts
CHANGED
|
@@ -50,11 +50,11 @@ export default class Tag extends PureComponent<TagProps> {
|
|
|
50
50
|
tagNode?: HTMLElement | null;
|
|
51
51
|
tagRef: (el: HTMLElement | null) => void;
|
|
52
52
|
setDocumentClickListener(setListener: boolean): void;
|
|
53
|
-
renderCustomIcon():
|
|
53
|
+
renderCustomIcon(): React.JSX.Element | null;
|
|
54
54
|
private _renderImageElement;
|
|
55
|
-
renderImage():
|
|
56
|
-
renderAvatar():
|
|
57
|
-
renderRemoveIcon():
|
|
58
|
-
render():
|
|
55
|
+
renderImage(): React.JSX.Element | null;
|
|
56
|
+
renderAvatar(): React.JSX.Element | null;
|
|
57
|
+
renderRemoveIcon(): React.JSX.Element | null;
|
|
58
|
+
render(): React.JSX.Element;
|
|
59
59
|
}
|
|
60
60
|
export type TagAttrs = React.JSX.LibraryManagedAttributes<typeof Tag, TagProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
import { PureComponent } from 'react';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import closeIcon from '@jetbrains/icons/close-12px';
|
|
5
5
|
import Icon from '../icon/icon';
|
|
@@ -25,7 +25,7 @@ export default class Tag extends PureComponent {
|
|
|
25
25
|
disabled: false,
|
|
26
26
|
focused: false,
|
|
27
27
|
interactive: true,
|
|
28
|
-
render: (props, interactive) => (interactive ?
|
|
28
|
+
render: (props, interactive) => (interactive ? <button type='button' {...props}/> : <span {...props}/>),
|
|
29
29
|
tagType: TagType.DEFAULT,
|
|
30
30
|
};
|
|
31
31
|
state = {
|
|
@@ -64,7 +64,7 @@ export default class Tag extends PureComponent {
|
|
|
64
64
|
}
|
|
65
65
|
renderCustomIcon() {
|
|
66
66
|
if (this.props.rgTagIcon) {
|
|
67
|
-
return
|
|
67
|
+
return <Icon className={styles.icon} title={this.props.rgTagTitle} glyph={this.props.rgTagIcon}/>;
|
|
68
68
|
}
|
|
69
69
|
return null;
|
|
70
70
|
}
|
|
@@ -73,7 +73,7 @@ export default class Tag extends PureComponent {
|
|
|
73
73
|
[styles.customIcon]: this.props.icon,
|
|
74
74
|
[styles.avatarIcon]: avatarSrc,
|
|
75
75
|
});
|
|
76
|
-
return
|
|
76
|
+
return <img alt={avatarSrc ? 'Avatar' : 'Icon'} className={classes} src={avatarSrc || this.props.icon}/>;
|
|
77
77
|
}
|
|
78
78
|
renderImage() {
|
|
79
79
|
if (this.props.icon && !this.props.avatar) {
|
|
@@ -83,13 +83,13 @@ export default class Tag extends PureComponent {
|
|
|
83
83
|
}
|
|
84
84
|
renderAvatar() {
|
|
85
85
|
if (this.props.avatar) {
|
|
86
|
-
return
|
|
86
|
+
return <span className={styles.avatarContainer}>{this._renderImageElement(this.props.avatar)}</span>;
|
|
87
87
|
}
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
90
90
|
renderRemoveIcon() {
|
|
91
91
|
if (!this.props.readOnly && this.props.onRemove) {
|
|
92
|
-
return (
|
|
92
|
+
return (<Button title='Remove' icon={closeIcon} data-test='ring-tag-remove' className={styles.remove} onClick={this.props.onRemove} style={{ '--ring-secondary-color': this.props.textColor }} height={ControlsHeight.M}/>);
|
|
93
93
|
}
|
|
94
94
|
return null;
|
|
95
95
|
}
|
|
@@ -100,17 +100,25 @@ export default class Tag extends PureComponent {
|
|
|
100
100
|
[styles.withRemove]: !this.props.readOnly && this.props.onRemove,
|
|
101
101
|
}, this.props.className);
|
|
102
102
|
const { backgroundColor, textColor, render } = this.props;
|
|
103
|
-
return (
|
|
103
|
+
return (<span className={classNames(styles.container, this.props.containerClassName, styles[this.props.tagType], {
|
|
104
104
|
[styles.outline]: this.props.outline,
|
|
105
105
|
[styles.interactive]: this.props.interactive,
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
106
|
+
})}>
|
|
107
|
+
{render({
|
|
108
|
+
'data-test': 'ring-tag',
|
|
109
|
+
className: classes,
|
|
110
|
+
ref: this.tagRef,
|
|
111
|
+
onClick: this.props.onClick,
|
|
112
|
+
style: { backgroundColor, color: textColor },
|
|
113
|
+
disabled: this.props.disabled,
|
|
114
|
+
children: (<>
|
|
115
|
+
{this.renderAvatar()}
|
|
116
|
+
{this.renderCustomIcon()}
|
|
117
|
+
{this.renderImage()}
|
|
118
|
+
<span className={styles.content}>{this.props.children}</span>
|
|
119
|
+
</>),
|
|
120
|
+
}, this.props.interactive)}
|
|
121
|
+
{this.renderRemoveIcon()}
|
|
122
|
+
</span>);
|
|
115
123
|
}
|
|
116
124
|
}
|
|
@@ -107,7 +107,7 @@ export default class TagsInput extends PureComponent<TagsInputProps, TagsInputSt
|
|
|
107
107
|
handleTagCreation: (label: string | undefined) => void;
|
|
108
108
|
select?: Select | null;
|
|
109
109
|
selectRef: (el: Select | null) => void;
|
|
110
|
-
render():
|
|
110
|
+
render(): React.JSX.Element;
|
|
111
111
|
}
|
|
112
112
|
export declare const RerenderableTagsInput: React.ForwardRefExoticComponent<TagsInputProps & React.RefAttributes<TagsInput>>;
|
|
113
113
|
export type TagsInputAttrs = React.JSX.LibraryManagedAttributes<typeof TagsInput, TagsInputProps>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
/* eslint-disable max-lines */
|
|
3
2
|
import { PureComponent } from 'react';
|
|
3
|
+
import * as React from 'react';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import getEventKey from '../global/get-event-key';
|
|
6
6
|
import Select from '../select/select';
|
|
@@ -11,8 +11,8 @@ import rerenderHOC from '../global/rerender-hoc';
|
|
|
11
11
|
import { Size } from '../input/input';
|
|
12
12
|
import { ControlsHeightContext } from '../global/controls-height';
|
|
13
13
|
import getUID from '../global/get-uid';
|
|
14
|
-
import inputStyles from '../input/input.css';
|
|
15
14
|
import ControlLabel from '../control-label/control-label';
|
|
15
|
+
import inputStyles from '../input/input.css';
|
|
16
16
|
import styles from './tags-input.css';
|
|
17
17
|
function noop() { }
|
|
18
18
|
/**
|
|
@@ -233,9 +233,17 @@ export default class TagsInput extends PureComponent {
|
|
|
233
233
|
[styles.tagsInputDisabled]: disabled,
|
|
234
234
|
[styles.tagsInputFocused]: focused,
|
|
235
235
|
}, this.props.className);
|
|
236
|
-
return (
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
return (<div
|
|
237
|
+
// it transfers focus to input
|
|
238
|
+
role='presentation' className={classes} onKeyDown={this.handleKeyDown} onClick={this.clickHandler} ref={this.nodeRef}>
|
|
239
|
+
{label && (<ControlLabel htmlFor={this.id} disabled={disabled} type={labelType}>
|
|
240
|
+
{label}
|
|
241
|
+
</ControlLabel>)}
|
|
242
|
+
|
|
243
|
+
<TagsList tags={tags} activeIndex={activeIndex} disabled={disabled} canNotBeEmpty={canNotBeEmpty} handleRemove={this.handleRemove} className={styles.tagsList} tagClassName={styles.tag} handleClick={this.handleClick} customTagComponent={this.props.customTagComponent}>
|
|
244
|
+
<Select id={this.id} ref={this.selectRef} size={Select.Size.AUTO} type={Select.Type.INPUT_WITHOUT_CONTROLS} inputPlaceholder={this.props.placeholder} data={this.state.suggestions} className={classNames(styles.tagsSelect)} onSelect={this.addTag} onFocus={this._focusHandler} onBlur={this._blurHandler} renderOptimization={this.props.renderOptimization} add={allowAddNewTags ? { prefix: 'Add new tag' } : undefined} onAdd={allowAddNewTags ? this.handleTagCreation : undefined} filter={filter} maxHeight={this.props.maxPopupHeight} minWidth={this.props.minPopupWidth} top={POPUP_VERTICAL_SHIFT} loading={this.state.loading} onFilter={this.loadSuggestions} onBeforeOpen={this.loadSuggestions} onKeyDown={this.handleKeyDown} disabled={this.props.disabled} loadingMessage={this.props.loadingMessage} notFoundMessage={this.props.notFoundMessage} hint={this.props.hint}/>
|
|
245
|
+
</TagsList>
|
|
246
|
+
</div>);
|
|
239
247
|
}
|
|
240
248
|
}
|
|
241
249
|
export const RerenderableTagsInput = rerenderHOC(TagsInput);
|
|
@@ -27,8 +27,8 @@ export default class TagsList<T extends TagType> extends Component<TagsListProps
|
|
|
27
27
|
handleClick: () => typeof noop;
|
|
28
28
|
handleRemove: () => typeof noop;
|
|
29
29
|
};
|
|
30
|
-
renderTag(tag: T, focusTag: boolean):
|
|
31
|
-
render():
|
|
30
|
+
renderTag(tag: T, focusTag: boolean): React.JSX.Element;
|
|
31
|
+
render(): React.JSX.Element;
|
|
32
32
|
}
|
|
33
33
|
export type TagsListAttrs<T extends TagType = TagType> = React.JSX.LibraryManagedAttributes<typeof TagsList, TagsListProps<T>>;
|
|
34
34
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createElement as _createElement } from "react";
|
|
3
1
|
import { Component } from 'react';
|
|
2
|
+
import * as React from 'react';
|
|
4
3
|
import classNames from 'classnames';
|
|
5
4
|
import Tag from '../tag/tag';
|
|
6
5
|
function noop() { }
|
|
@@ -19,12 +18,17 @@ export default class TagsList extends Component {
|
|
|
19
18
|
const TagComponent = this.props.customTagComponent || Tag;
|
|
20
19
|
const readOnly = this.props.disabled || tag.readOnly || (this.props.canNotBeEmpty && this.props.tags.length === 1);
|
|
21
20
|
const { tagClassName } = this.props;
|
|
22
|
-
return (
|
|
21
|
+
return (<TagComponent {...tag} key={tag.key} readOnly={readOnly} disabled={this.props.disabled || tag.disabled} focused={focusTag} onClick={this.props.handleClick(tag)} onRemove={this.props.handleRemove(tag)} className={tagClassName}>
|
|
22
|
+
{tag.label}
|
|
23
|
+
</TagComponent>);
|
|
23
24
|
}
|
|
24
25
|
render() {
|
|
25
26
|
const { children, className, customTagComponent, canNotBeEmpty, handleClick, tagClassName, handleRemove, tags, activeIndex, ...props } = this.props;
|
|
26
27
|
const classes = classNames('ring-js-shortcuts', className);
|
|
27
28
|
const tagsList = (this.props.tags || []).map((tag, index) => this.renderTag(tag, this.props.activeIndex === index));
|
|
28
|
-
return (
|
|
29
|
+
return (<div data-test='ring-tags-list' className={classes} {...props}>
|
|
30
|
+
{tagsList}
|
|
31
|
+
{children}
|
|
32
|
+
</div>);
|
|
29
33
|
}
|
|
30
34
|
}
|
|
@@ -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 styles from './text.css';
|
|
@@ -24,6 +23,8 @@ export default class Text extends Component {
|
|
|
24
23
|
[styles.sizeM]: size === Text.Size.M,
|
|
25
24
|
[styles.sizeL]: size === Text.Size.L,
|
|
26
25
|
});
|
|
27
|
-
return (
|
|
26
|
+
return (<span className={classes} {...restProps}>
|
|
27
|
+
{children}
|
|
28
|
+
</span>);
|
|
28
29
|
}
|
|
29
30
|
}
|
|
@@ -17,7 +17,7 @@ declare class Toggle extends PureComponent<ToggleProps> {
|
|
|
17
17
|
static defaultProps: {
|
|
18
18
|
size: string;
|
|
19
19
|
};
|
|
20
|
-
render(): import("react
|
|
20
|
+
render(): import("react").JSX.Element;
|
|
21
21
|
}
|
|
22
22
|
export type ToggleAttrs = React.JSX.LibraryManagedAttributes<typeof Toggle, ToggleProps>;
|
|
23
23
|
export default Toggle;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { PureComponent } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import dataTests from '../global/data-tests';
|
|
4
|
+
import ControlHelp from '../control-help/control-help';
|
|
5
|
+
import styles from './toggle.css';
|
|
6
|
+
export const Size = {
|
|
7
|
+
Size14: styles.size14,
|
|
8
|
+
Size16: styles.size16,
|
|
9
|
+
Size20: styles.size20,
|
|
10
|
+
};
|
|
11
|
+
class Toggle extends PureComponent {
|
|
12
|
+
static defaultProps = {
|
|
13
|
+
size: Size.Size16,
|
|
14
|
+
};
|
|
15
|
+
render() {
|
|
16
|
+
const { className, children, disabled, title, leftLabel, size = Size.Size16, 'data-test': dataTest, help, onTransitionEnd, ...restProps } = this.props;
|
|
17
|
+
const classes = classNames(className, size, styles.toggle, disabled && styles.disabled);
|
|
18
|
+
return (<label className={classes} title={title} data-test={dataTests('ring-toggle', dataTest)}>
|
|
19
|
+
{leftLabel && (<span className={styles.leftLabel}>
|
|
20
|
+
{leftLabel}
|
|
21
|
+
{help && <ControlHelp className={styles.help}>{help}</ControlHelp>}
|
|
22
|
+
</span>)}
|
|
23
|
+
|
|
24
|
+
<span className={styles.switchWrapper}>
|
|
25
|
+
<input data-test='ring-toggle-input' {...restProps} type='checkbox' disabled={disabled} className={styles.input}/>
|
|
26
|
+
|
|
27
|
+
<span className={styles.switch} onTransitionEnd={onTransitionEnd}/>
|
|
28
|
+
</span>
|
|
29
|
+
|
|
30
|
+
{children && (<div className={styles.label}>
|
|
31
|
+
{children}
|
|
32
|
+
{help && <ControlHelp className={styles.help}>{help}</ControlHelp>}
|
|
33
|
+
</div>)}
|
|
34
|
+
</label>);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export default Toggle;
|
|
@@ -55,7 +55,7 @@ export default class Tooltip extends Component<TooltipProps> {
|
|
|
55
55
|
popupRef: (el: Popup | null) => void;
|
|
56
56
|
onNestedTooltipShow: () => void;
|
|
57
57
|
onNestedTooltipHide: () => void;
|
|
58
|
-
render():
|
|
58
|
+
render(): React.JSX.Element;
|
|
59
59
|
}
|
|
60
60
|
export type TooltipAttrs = React.JSX.LibraryManagedAttributes<typeof Tooltip, TooltipProps>;
|
|
61
61
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { Component, createContext } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import Popup from '../popup/popup';
|
|
@@ -127,7 +127,16 @@ export default class Tooltip extends Component {
|
|
|
127
127
|
const { children, 'data-test': dataTest, title, delay, theme, selfOverflowOnly, popupProps, long, ...restProps } = this.props;
|
|
128
128
|
const ariaProps = typeof title === 'string' && !!title ? { 'aria-label': title, role: 'tooltip' } : {};
|
|
129
129
|
const { onNestedTooltipShow, onNestedTooltipHide } = this;
|
|
130
|
-
const popup = (
|
|
131
|
-
|
|
130
|
+
const popup = (<Popup trapFocus={false} anchorElement={this.containerNode} hidden={!this.state.showPopup || this.state.showNestedPopup} onCloseAttempt={this.hidePopup} maxHeight={400} attached={false} onMouseOut={this.hideIfMovedOutsidePopup} top={4} dontCloseOnAnchorClick ref={this.popupRef} {...popupProps} className={classNames(styles.tooltip, { [styles.long]: long, [styles.inheritedTheme]: theme === 'inherit' }, popupProps?.className)}>
|
|
131
|
+
{title}
|
|
132
|
+
</Popup>);
|
|
133
|
+
return (<TooltipContext.Provider value={{ onNestedTooltipShow, onNestedTooltipHide }}>
|
|
134
|
+
<span {...ariaProps} {...restProps} ref={this.containerRef} data-test={dataTests('ring-tooltip', dataTest)} data-test-title={typeof title === 'string' ? title : undefined}>
|
|
135
|
+
{children}
|
|
136
|
+
{theme === 'inherit' ? (popup) : (<ThemeProvider theme={theme} passToPopups WrapperComponent={props => <span {...props}/>}>
|
|
137
|
+
{popup}
|
|
138
|
+
</ThemeProvider>)}
|
|
139
|
+
</span>
|
|
140
|
+
</TooltipContext.Provider>);
|
|
132
141
|
}
|
|
133
142
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
import { forwardRef, useCallback, useImperativeHandle, useRef, useState, } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import attachmentIcon from '@jetbrains/icons/attachment';
|
|
5
4
|
import Icon from '../icon';
|
|
6
5
|
import styles from './upload.css';
|
|
7
|
-
export const Upload = forwardRef(function Upload({ children, className, onFilesSelected, onFilesRejected, validate = () => true, variant = 'empty', multiple, renderIcon = () =>
|
|
6
|
+
export const Upload = forwardRef(function Upload({ children, className, onFilesSelected, onFilesRejected, validate = () => true, variant = 'empty', multiple, renderIcon = () => <Icon className={styles.attachmentIcon} glyph={attachmentIcon}/>, accept, disabled, }, ref) {
|
|
8
7
|
const fileInputRef = useRef(null);
|
|
9
8
|
const [dragOver, setDragOver] = useState(false);
|
|
10
9
|
useImperativeHandle(ref, () => ({ openFilePicker: () => fileInputRef.current?.click() }), []);
|
|
@@ -28,11 +27,15 @@ export const Upload = forwardRef(function Upload({ children, className, onFilesS
|
|
|
28
27
|
handleSelectedFiles(Array.from(fileInputRef.current.files));
|
|
29
28
|
}
|
|
30
29
|
}, [handleSelectedFiles]);
|
|
31
|
-
return (
|
|
30
|
+
return (<div className={classNames(className, styles.upload, {
|
|
32
31
|
[styles.disabled]: disabled,
|
|
33
32
|
[styles.dragOver]: dragOver,
|
|
34
33
|
[styles.success]: variant === 'success',
|
|
35
34
|
[styles.error]: variant === 'error',
|
|
36
|
-
})
|
|
35
|
+
})} data-test='ring-upload'>
|
|
36
|
+
<input onDragEnter={onDragEnter} onDragOver={onDragOver} onDragLeave={onDragLeave} disabled={disabled} ref={fileInputRef} data-test='ring-file-input' multiple={multiple} accept={accept} onChange={onInputChange} type='file' autoComplete='off' aria-label='file-picker' className={styles.invisibleFileInput}/>
|
|
37
|
+
{renderIcon()}
|
|
38
|
+
{children}
|
|
39
|
+
</div>);
|
|
37
40
|
});
|
|
38
41
|
export default Upload;
|