@jetbrains/ring-ui 7.0.61 → 7.0.63
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.css +1 -1
- package/components/alert/alert.d.ts +1 -1
- package/components/alert/alert.js +3 -3
- package/components/alert/container.css +2 -2
- package/components/alert/container.d.ts +1 -1
- package/components/alert/container.js +1 -1
- package/components/alert-service/alert-service.d.ts +2 -2
- package/components/analytics/{analytics__custom-plugin.d.ts → analytics-custom-plugin.d.ts} +1 -1
- package/components/analytics/{analytics__custom-plugin.js → analytics-custom-plugin.js} +2 -2
- package/components/auth/{auth__core.d.ts → auth-core.d.ts} +9 -8
- package/components/auth/{auth__core.js → auth-core.js} +14 -18
- package/components/auth/auth.d.ts +2 -2
- package/components/auth/auth.js +2 -2
- package/components/auth/background-flow.d.ts +2 -2
- package/components/auth/background-flow.js +0 -1
- package/components/auth/down-notification.css +1 -1
- package/components/auth/down-notification.js +1 -1
- package/components/auth/iframe-flow.d.ts +3 -3
- package/components/auth/iframe-flow.js +3 -5
- package/components/auth/request-builder.d.ts +2 -1
- package/components/auth/request-builder.js +1 -2
- package/components/auth/storage.d.ts +3 -3
- package/components/auth/storage.js +4 -8
- package/components/auth/token-validator.d.ts +2 -1
- package/components/auth/token-validator.js +6 -1
- package/components/auth/window-flow.d.ts +3 -3
- package/components/auth/window-flow.js +7 -7
- package/components/auth-dialog/auth-dialog.css +2 -2
- package/components/auth-dialog/auth-dialog.js +1 -1
- package/components/auth-dialog-service/auth-dialog-service.d.ts +1 -1
- package/components/avatar/avatar-info.d.ts +1 -1
- package/components/avatar/avatar.css +1 -1
- package/components/avatar/avatar.d.ts +1 -1
- package/components/avatar/avatar.figma.js +1 -1
- package/components/avatar/avatar.js +5 -7
- package/components/avatar/fallback-avatar.js +4 -8
- package/components/avatar-stack/avatar-stack.css +1 -1
- package/components/avatar-stack/avatar-stack.d.ts +3 -3
- package/components/avatar-stack/avatar-stack.figma.js +1 -1
- package/components/avatar-stack/avatar-stack.js +1 -1
- package/components/banner/banner.css +2 -2
- package/components/banner/banner.js +1 -1
- package/components/breadcrumbs/breadcrumbs.d.ts +1 -1
- package/components/breadcrumbs/breadcrumbs.figma.js +1 -1
- package/components/button/{button__classes.d.ts → button.classes.d.ts} +1 -1
- package/components/button/button.css +19 -16
- package/components/button/button.d.ts +4 -4
- package/components/button/button.figma.js +1 -1
- package/components/button/button.js +6 -6
- package/components/button-group/button-group.css +6 -6
- package/components/button-group/button-group.d.ts +1 -1
- package/components/button-group/button-group.js +1 -1
- package/components/button-group/caption.d.ts +1 -1
- package/components/button-set/button-set.css +2 -2
- package/components/button-set/button-set.d.ts +1 -1
- package/components/button-toolbar/button-toolbar.css +2 -2
- package/components/button-toolbar/button-toolbar.d.ts +1 -1
- package/components/caret/caret.js +23 -18
- package/components/checkbox/checkbox-group.figma.js +1 -1
- package/components/checkbox/checkbox.css +1 -1
- package/components/checkbox/checkbox.d.ts +1 -1
- package/components/checkbox/checkbox.figma.js +1 -1
- package/components/checkbox/checkbox.js +5 -5
- package/components/clipboard/clipboard.js +2 -2
- package/components/code/code.css +1 -1
- package/components/code/code.d.ts +1 -1
- package/components/code/code.js +5 -3
- package/components/collapse/collapse-content.d.ts +3 -3
- package/components/collapse/collapse-control.d.ts +2 -2
- package/components/collapse/collapse.css +1 -1
- package/components/collapse/collapse.d.ts +3 -3
- package/components/confirm/confirm.d.ts +1 -1
- package/components/confirm/confirm.js +1 -1
- package/components/confirm-service/confirm-service.d.ts +3 -3
- package/components/content-layout/content-layout.css +2 -2
- package/components/content-layout/content-layout.d.ts +1 -1
- package/components/content-layout/content-layout.js +2 -2
- package/components/content-layout/sidebar.d.ts +1 -1
- package/components/contenteditable/contenteditable.d.ts +1 -1
- package/components/contenteditable/contenteditable.js +2 -1
- package/components/control-help/control-help.css +1 -1
- package/components/control-help/control-help.d.ts +1 -1
- package/components/control-label/control-label.d.ts +1 -1
- package/components/data-list/data-list.css +1 -1
- package/components/data-list/data-list.d.ts +5 -5
- package/components/data-list/data-list.js +2 -2
- package/components/data-list/data-list.mock.d.ts +2 -2
- package/components/data-list/data-list.mock.js +20 -20
- package/components/data-list/item.d.ts +3 -3
- package/components/data-list/item.js +2 -2
- package/components/data-list/selection.d.ts +1 -1
- package/components/data-list/selection.js +8 -1
- package/components/data-list/title.d.ts +2 -2
- package/components/date-picker/consts.d.ts +1 -1
- package/components/date-picker/date-input.d.ts +1 -1
- package/components/date-picker/date-input.js +2 -2
- package/components/date-picker/date-picker.css +15 -15
- package/components/date-picker/date-picker.d.ts +5 -5
- package/components/date-picker/date-picker.js +17 -19
- package/components/date-picker/date-popup.d.ts +1 -1
- package/components/date-picker/date-popup.js +5 -3
- package/components/date-picker/day.d.ts +2 -2
- package/components/date-picker/day.js +4 -5
- package/components/date-picker/formats.js +1 -0
- package/components/date-picker/month-names.d.ts +1 -1
- package/components/date-picker/month-names.js +1 -1
- package/components/date-picker/month-slider.d.ts +2 -2
- package/components/date-picker/month-slider.js +1 -1
- package/components/date-picker/month.d.ts +1 -1
- package/components/date-picker/months.d.ts +1 -1
- package/components/date-picker/months.js +2 -2
- package/components/date-picker/years.d.ts +1 -1
- package/components/date-picker/years.js +2 -2
- package/components/dialog/{dialog__body-scroll-preventer.js → dialog-body-scroll-preventer.js} +6 -2
- package/components/dialog/dialog.css +5 -5
- package/components/dialog/dialog.d.ts +1 -1
- package/components/dialog/dialog.js +7 -7
- package/components/dropdown/anchor.d.ts +1 -1
- package/components/dropdown/dropdown.css +1 -1
- package/components/dropdown/dropdown.d.ts +2 -2
- package/components/dropdown/dropdown.js +2 -2
- package/components/dropdown-menu/dropdown-menu.d.ts +5 -5
- package/components/dropdown-menu/dropdown-menu.js +1 -1
- package/components/editable-heading/editable-heading.css +6 -8
- package/components/editable-heading/editable-heading.d.ts +1 -1
- package/components/editable-heading/editable-heading.js +3 -2
- package/components/error-bubble/error-bubble-legacy.css +3 -3
- package/components/error-bubble/error-bubble.css +5 -5
- package/components/error-bubble/error-bubble.d.ts +1 -1
- package/components/error-bubble/error-bubble.figma.js +1 -1
- package/components/error-bubble/error-bubble.js +2 -2
- package/components/error-message/error-message.css +1 -1
- package/components/error-message/error-message.d.ts +2 -2
- package/components/error-message/error-message.js +2 -2
- package/components/error-page/error-page.css +3 -3
- package/components/footer/footer.css +2 -2
- package/components/footer/footer.d.ts +1 -1
- package/components/footer/footer.js +1 -1
- package/components/form/form.css +3 -3
- package/components/global/compose-refs.d.ts +2 -0
- package/components/global/compose-refs.js +14 -0
- package/components/global/composeRefs.d.ts +6 -2
- package/components/global/composeRefs.js +7 -14
- package/components/global/create-stateful-context.d.ts +1 -1
- package/components/global/dom.d.ts +1 -1
- package/components/global/dom.js +2 -4
- package/components/global/focus-sensor-hoc.d.ts +1 -1
- package/components/global/focus-sensor-hoc.js +2 -2
- package/components/global/fuzzy-highlight.d.ts +2 -2
- package/components/global/get-event-key.d.ts +1 -1
- package/components/global/global.css +2 -2
- package/components/global/memoize.js +1 -1
- package/components/global/rerender-hoc.d.ts +1 -1
- package/components/global/rerender-hoc.js +2 -2
- package/components/global/theme.d.ts +1 -1
- package/components/global/theme.js +2 -2
- package/components/global/url.js +3 -3
- package/components/global/use-event-callback.js +1 -1
- package/components/global/variables.css +5 -3
- package/components/global/variables_dark.css +8 -6
- package/components/grid/col.d.ts +1 -1
- package/components/grid/col.js +1 -1
- package/components/grid/grid.css +4 -4
- package/components/grid/grid.d.ts +1 -1
- package/components/grid/grid.js +1 -1
- package/components/grid/row.d.ts +1 -1
- package/components/grid/row.js +1 -1
- package/components/group/group.css +1 -1
- package/components/group/group.d.ts +1 -1
- package/components/group/group.js +1 -1
- package/components/header/header-icon.d.ts +2 -2
- package/components/header/header.css +4 -4
- package/components/header/header.d.ts +1 -1
- package/components/header/links.d.ts +1 -1
- package/components/header/logo.d.ts +1 -1
- package/components/header/profile.d.ts +5 -5
- package/components/header/profile.js +3 -3
- package/components/header/services-link.d.ts +1 -1
- package/components/header/services-link.js +3 -3
- package/components/header/services.css +1 -1
- package/components/header/services.d.ts +2 -2
- package/components/header/services.js +3 -3
- package/components/header/smart-profile.d.ts +3 -3
- package/components/header/smart-profile.js +2 -1
- package/components/header/smart-services.d.ts +3 -3
- package/components/header/tray.d.ts +1 -1
- package/components/heading/heading.css +2 -2
- package/components/heading/heading.d.ts +1 -1
- package/components/http/http.mock.d.ts +1 -1
- package/components/hub-source/{hub-source__user.d.ts → hub-source-user.d.ts} +3 -2
- package/components/hub-source/{hub-source__users-groups.d.ts → hub-source-users-groups.d.ts} +3 -2
- package/components/hub-source/hub-source.d.ts +2 -2
- package/components/icon/{icon__svg.d.ts → icon-svg.d.ts} +1 -1
- package/components/icon/icon.css +5 -5
- package/components/icon/icon.d.ts +2 -2
- package/components/icon/icon.js +3 -3
- package/components/input/input-legacy.css +2 -2
- package/components/input/input.css +5 -5
- package/components/input/input.d.ts +3 -3
- package/components/input/input.figma.js +1 -1
- package/components/input/input.js +8 -8
- package/components/input-size/input-size.css +1 -1
- package/components/island/adaptive-island-hoc.d.ts +1 -1
- package/components/island/content.d.ts +1 -1
- package/components/island/content.js +2 -2
- package/components/island/header.d.ts +1 -1
- package/components/island/header.js +4 -4
- package/components/island/island.css +3 -3
- package/components/island/island.d.ts +1 -1
- package/components/line/line.css +1 -1
- package/components/link/clickable-link.d.ts +12 -0
- package/components/link/clickable-link.js +25 -0
- package/components/link/clickableLink.d.ts +11 -12
- package/components/link/clickableLink.js +4 -25
- package/components/link/link.css +1 -1
- package/components/link/link.d.ts +2 -2
- package/components/link/link.js +4 -4
- package/components/list/consts.d.ts +4 -5
- package/components/list/{list__custom.d.ts → list-custom.d.ts} +1 -1
- package/components/list/{list__custom.js → list-custom.js} +1 -1
- package/components/list/{list__hint.d.ts → list-hint.d.ts} +1 -1
- package/components/list/{list__hint.js → list-hint.js} +1 -1
- package/components/list/{list__item.d.ts → list-item.d.ts} +2 -2
- package/components/list/{list__item.js → list-item.js} +6 -5
- package/components/list/{list__separator.d.ts → list-separator.d.ts} +1 -1
- package/components/list/{list__separator.js → list-separator.js} +1 -1
- package/components/list/{list__title.d.ts → list-title.d.ts} +1 -1
- package/components/list/{list__title.js → list-title.js} +1 -1
- package/components/list/{list__users-groups-source.d.ts → list-users-groups-source.d.ts} +3 -2
- package/components/list/{list__users-groups-source.js → list-users-groups-source.js} +1 -1
- package/components/list/{list__classes.d.ts → list.classes.d.ts} +1 -1
- package/components/list/list.css +5 -5
- package/components/list/list.d.ts +7 -7
- package/components/list/list.js +34 -28
- package/components/loader/{loader__core.js → loader-core.js} +2 -2
- package/components/loader/loader.css +1 -1
- package/components/loader/loader.d.ts +2 -2
- package/components/loader/loader.js +1 -1
- package/components/loader-inline/loader-inline.css +2 -2
- package/components/loader-inline/loader-inline.d.ts +1 -1
- package/components/loader-screen/loader-screen.css +2 -2
- package/components/loader-screen/loader-screen.d.ts +1 -1
- package/components/login-dialog/login-dialog.css +2 -2
- package/components/login-dialog/login-dialog.d.ts +1 -1
- package/components/login-dialog/login-dialog.js +1 -1
- package/components/login-dialog/service.d.ts +1 -1
- package/components/markdown/markdown.css +3 -3
- package/components/markdown/markdown.d.ts +1 -1
- package/components/markdown/markdown.js +1 -1
- package/components/message/message.css +3 -3
- package/components/message/message.d.ts +4 -4
- package/components/message/message.js +3 -3
- package/components/old-browsers-message/old-browsers-message.css +2 -2
- package/components/old-browsers-message/old-browsers-message.js +1 -1
- package/components/pager/pager.css +1 -1
- package/components/pager/pager.d.ts +2 -2
- package/components/pager/pager.js +11 -12
- package/components/panel/panel.css +1 -1
- package/components/panel/panel.d.ts +1 -1
- package/components/panel/panel.js +1 -1
- package/components/permissions/{permissions__cache.js → permissions-cache.js} +4 -5
- package/components/permissions/permissions.d.ts +2 -2
- package/components/permissions/permissions.js +2 -4
- package/components/popup/popup.css +3 -3
- package/components/popup/popup.d.ts +2 -2
- package/components/popup/popup.js +6 -5
- package/components/popup/popup.target.d.ts +1 -1
- package/components/popup/position-css.js +6 -10
- package/components/popup/position.js +10 -10
- package/components/popup-menu/popup-menu.d.ts +4 -4
- package/components/progress-bar/progress-bar.css +6 -8
- package/components/progress-bar/progress-bar.d.ts +1 -1
- package/components/progress-bar/progress-bar.js +1 -1
- package/components/query-assist/{query-assist__suggestions.d.ts → query-assist-suggestions.d.ts} +1 -1
- package/components/query-assist/query-assist.css +11 -11
- package/components/query-assist/query-assist.d.ts +4 -4
- package/components/query-assist/query-assist.js +11 -11
- package/components/radio/{radio__item.d.ts → radio-item.d.ts} +1 -1
- package/components/radio/{radio__item.js → radio-item.js} +2 -2
- package/components/radio/radio.css +2 -2
- package/components/radio/radio.d.ts +2 -2
- package/components/radio/radio.js +1 -1
- package/components/scrollable-section/scrollable-section.d.ts +1 -1
- package/components/scrollable-section/scrollable-section.js +1 -1
- package/components/select/{select__filter.d.ts → select-filter.d.ts} +2 -2
- package/components/select/{select__filter.js → select-filter.js} +1 -1
- package/components/select/select-popup.css +5 -5
- package/components/select/{select__popup.d.ts → select-popup.d.ts} +8 -8
- package/components/select/{select__popup.js → select-popup.js} +11 -7
- package/components/select/select.css +10 -9
- package/components/select/select.d.ts +7 -6
- package/components/select/select.js +32 -27
- package/components/shortcuts/core.js +7 -7
- package/components/shortcuts/shortcuts-hoc.d.ts +2 -2
- package/components/shortcuts/shortcuts.d.ts +1 -1
- package/components/sidebar/sidebar.css +1 -1
- package/components/slider/slider.css +2 -2
- package/components/slider/slider.d.ts +5 -5
- package/components/slider/slider.js +5 -5
- package/components/slider/slider.utils.d.ts +1 -1
- package/components/slider/slider.utils.js +2 -4
- package/components/storage/{storage__local.d.ts → storage-local.d.ts} +1 -1
- package/components/storage/{storage__local.js → storage-local.js} +7 -7
- package/components/storage/storage.d.ts +1 -1
- package/components/storage/storage.js +1 -1
- package/components/tab-trap/tab-trap.css +1 -1
- package/components/tab-trap/tab-trap.d.ts +1 -1
- package/components/tab-trap/tab-trap.js +2 -5
- package/components/table/cell.d.ts +1 -1
- package/components/table/disable-hover-hoc.d.ts +1 -1
- package/components/table/header-cell.d.ts +1 -1
- package/components/table/header-cell.js +1 -1
- package/components/table/header.d.ts +2 -2
- package/components/table/header.js +2 -2
- package/components/table/multitable.d.ts +3 -3
- package/components/table/multitable.js +1 -1
- package/components/table/row-with-focus-sensor.d.ts +3 -3
- package/components/table/row.d.ts +4 -4
- package/components/table/row.js +1 -1
- package/components/table/selection-adapter.d.ts +2 -1
- package/components/table/selection-shortcuts-hoc.d.ts +4 -3
- package/components/table/selection-shortcuts-hoc.js +1 -3
- package/components/table/selection.js +4 -8
- package/components/table/simple-table.d.ts +2 -2
- package/components/table/smart-table.d.ts +2 -2
- package/components/table/table.css +6 -6
- package/components/table/table.d.ts +7 -7
- package/components/table/table.js +3 -3
- package/components/tabs/collapsible-more.d.ts +3 -3
- package/components/tabs/collapsible-more.js +2 -2
- package/components/tabs/collapsible-tab.d.ts +2 -2
- package/components/tabs/collapsible-tab.js +1 -1
- package/components/tabs/collapsible-tabs.d.ts +2 -2
- package/components/tabs/collapsible-tabs.js +6 -8
- package/components/tabs/custom-item.d.ts +2 -2
- package/components/tabs/dumb-tabs.d.ts +3 -3
- package/components/tabs/dumb-tabs.js +3 -3
- package/components/tabs/smart-tabs.d.ts +1 -1
- package/components/tabs/tab-link.d.ts +2 -2
- package/components/tabs/tab.d.ts +2 -2
- package/components/tabs/tabs.css +6 -6
- package/components/tag/tag.css +94 -14
- package/components/tag/tag.d.ts +13 -2
- package/components/tag/tag.js +16 -3
- package/components/tags-input/tags-input.css +3 -3
- package/components/tags-input/tags-input.d.ts +8 -8
- package/components/tags-input/tags-input.js +13 -7
- package/components/tags-list/tags-list.d.ts +2 -2
- package/components/tags-list/tags-list.js +1 -1
- package/components/text/text.css +1 -1
- package/components/text/text.d.ts +1 -1
- package/components/toggle/toggle.css +6 -3
- package/components/toggle/toggle.d.ts +1 -1
- package/components/toggle/toggle.js +1 -1
- package/components/tooltip/tooltip.css +1 -1
- package/components/tooltip/tooltip.d.ts +2 -2
- package/components/tooltip/tooltip.js +1 -1
- package/components/upload/upload.css +1 -1
- package/components/upload/upload.d.ts +3 -3
- package/components/upload/upload.js +2 -2
- package/components/user-agreement/service.d.ts +2 -2
- package/components/user-agreement/service.js +3 -5
- package/components/user-agreement/user-agreement.css +2 -2
- package/components/user-agreement/user-agreement.d.ts +1 -1
- package/components/user-agreement/user-agreement.js +1 -1
- package/components/user-card/card.d.ts +1 -1
- package/components/user-card/card.js +4 -3
- package/components/user-card/smart-user-card-tooltip.d.ts +2 -2
- package/components/user-card/smart-user-card-tooltip.js +1 -1
- package/components/user-card/tooltip.d.ts +3 -3
- package/components/user-card/user-card.css +1 -5
- package/package.json +12 -9
- /package/components/button/{button__classes.js → button.classes.js} +0 -0
- /package/components/dialog/{dialog__body-scroll-preventer.d.ts → dialog-body-scroll-preventer.d.ts} +0 -0
- /package/components/global/{variables.d.ts → variables.interface.d.ts} +0 -0
- /package/components/global/{variables.js → variables.interface.js} +0 -0
- /package/components/hub-source/{hub-source__user.js → hub-source-user.js} +0 -0
- /package/components/hub-source/{hub-source__users-groups.js → hub-source-users-groups.js} +0 -0
- /package/components/icon/{icon__svg.js → icon-svg.js} +0 -0
- /package/components/icon/{icon__constants.d.ts → icon.constants.d.ts} +0 -0
- /package/components/icon/{icon__constants.js → icon.constants.js} +0 -0
- /package/components/list/{list__classes.js → list.classes.js} +0 -0
- /package/components/loader/{loader__core.d.ts → loader-core.d.ts} +0 -0
- /package/components/old-browsers-message/{old-browsers-message__stop.d.ts → old-browsers-message-stop.d.ts} +0 -0
- /package/components/old-browsers-message/{old-browsers-message__stop.js → old-browsers-message-stop.js} +0 -0
- /package/components/permissions/{permissions__cache.d.ts → permissions-cache.d.ts} +0 -0
- /package/components/query-assist/{query-assist__suggestions.js → query-assist-suggestions.js} +0 -0
|
@@ -5,7 +5,7 @@ import styles from './tabs.css';
|
|
|
5
5
|
import TabLink from './tab-link';
|
|
6
6
|
import { CustomItem } from './custom-item';
|
|
7
7
|
const TabTitle = React.memo(function TabTitle({ selected, child, handleSelect, collapsed = false, tabIndex, }) {
|
|
8
|
-
if (child
|
|
8
|
+
if (child === null || typeof child !== 'object' || child.type === CustomItem) {
|
|
9
9
|
return child;
|
|
10
10
|
}
|
|
11
11
|
const { title, titleProps, disabled, href, className, activeClassName, collapsedClassName, collapsedActiveClassName } = child.props;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { TabProps } from './tab';
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import { type TabProps } from './tab';
|
|
3
3
|
export interface CollapsibleTabsProps {
|
|
4
4
|
children: ReactElement<TabProps>[];
|
|
5
5
|
selected?: string | undefined;
|
|
@@ -37,12 +37,10 @@ export const CollapsibleTabs = ({ children, selected, onSelect, onLastVisibleInd
|
|
|
37
37
|
if (preparedElements.ready) {
|
|
38
38
|
return preparedElements.hidden;
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
if (initialVisibleItems) {
|
|
41
41
|
return children.filter(item => !visibleElements.some(visibleItem => visibleItem.props.child === item));
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
return [];
|
|
45
|
-
}
|
|
43
|
+
return [];
|
|
46
44
|
}, [children, preparedElements.hidden, preparedElements.ready, visibleElements, initialVisibleItems]);
|
|
47
45
|
const adjustTabs = useCallback((entry) => {
|
|
48
46
|
const containerWidth = entry.contentRect.width;
|
|
@@ -102,10 +100,10 @@ export const CollapsibleTabs = ({ children, selected, onSelect, onLastVisibleInd
|
|
|
102
100
|
accumulator.hidden.push(tab);
|
|
103
101
|
}
|
|
104
102
|
return accumulator;
|
|
105
|
-
}, { visible: [], hidden: [], ready: elements.lastVisibleIndex
|
|
103
|
+
}, { visible: [], hidden: [], ready: !!elements.lastVisibleIndex });
|
|
106
104
|
if (selectedIndex > (elements.lastVisibleIndex ?? 0)) {
|
|
107
105
|
const selectedItem = children.find(tab => !tab.props.alwaysHidden && tab.props.id === selected);
|
|
108
|
-
if (selectedItem
|
|
106
|
+
if (selectedItem) {
|
|
109
107
|
res.visible.push(selectedItem);
|
|
110
108
|
}
|
|
111
109
|
}
|
|
@@ -128,7 +126,7 @@ export const CollapsibleTabs = ({ children, selected, onSelect, onLastVisibleInd
|
|
|
128
126
|
}, [children]);
|
|
129
127
|
// Initial measure for tabs and more button sizes
|
|
130
128
|
useEffect(() => {
|
|
131
|
-
if (measureRef.current
|
|
129
|
+
if (measureRef.current === null) {
|
|
132
130
|
return undefined;
|
|
133
131
|
}
|
|
134
132
|
const measureTask = fastdom.measure(() => {
|
|
@@ -173,7 +171,7 @@ export const CollapsibleTabs = ({ children, selected, onSelect, onLastVisibleInd
|
|
|
173
171
|
resizeObserver.disconnect();
|
|
174
172
|
};
|
|
175
173
|
}, [adjustTabs]);
|
|
176
|
-
const isAdjusted = (elements.lastVisibleIndex
|
|
174
|
+
const isAdjusted = (!!elements.lastVisibleIndex && preparedElements.ready) || initialVisibleItems;
|
|
177
175
|
const className = classNames(styles.titles, styles.autoCollapse, isAdjusted && styles.adjusted);
|
|
178
176
|
return (_jsxs("div", { className: styles.autoCollapseContainer, children: [_jsxs("div", { className: classNames(className, styles.rendered), children: [visibleElements, _jsx(MoreButton, { moreClassName: moreClassName, moreActiveClassName: moreActiveClassName, morePopupClassName: morePopupClassName, morePopupBeforeEnd: morePopupBeforeEnd, morePopupItemClassName: morePopupItemClassName, items: hiddenElements, selected: selected, onSelect: onSelect })] }), _jsxs("div", { ref: measureRef, className: classNames(className, styles.measure), children: [childrenToMeasure, _jsx(FakeMoreButton, { hasActiveChildren: hiddenElements.some(item => item.props.alwaysHidden && item.props.id === selected), moreClassName: moreClassName, moreActiveClassName: moreActiveClassName })] })] }));
|
|
179
177
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import { TabProps } from './tab';
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import { type TabProps } from './tab';
|
|
3
3
|
export declare const CustomItem: ({ children }: TabProps) => ReactElement;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { PureComponent, ReactElement } from 'react';
|
|
1
|
+
import { PureComponent, type ReactElement } from 'react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { CollapsibleTabsProps } from './collapsible-tabs';
|
|
3
|
+
import { type CollapsibleTabsProps } from './collapsible-tabs';
|
|
4
4
|
import { CustomItem } from './custom-item';
|
|
5
|
-
import { TabProps } from './tab';
|
|
5
|
+
import { type TabProps } from './tab';
|
|
6
6
|
export { CustomItem };
|
|
7
7
|
export type Children = readonly (Children | null | boolean)[] | ReactElement<TabProps> | null | boolean;
|
|
8
8
|
export interface TabsProps extends Omit<CollapsibleTabsProps, 'onSelect' | 'children'> {
|
|
@@ -12,7 +12,7 @@ export { CustomItem };
|
|
|
12
12
|
class Tabs extends PureComponent {
|
|
13
13
|
handleSelect = memoize((key) => () => this.props.onSelect?.(key));
|
|
14
14
|
getTabTitle = (child, i) => {
|
|
15
|
-
if (child
|
|
15
|
+
if (child === null || typeof child !== 'object' || child.type === CustomItem) {
|
|
16
16
|
return child;
|
|
17
17
|
}
|
|
18
18
|
const { selected, onSelect } = this.props;
|
|
@@ -22,13 +22,13 @@ class Tabs extends PureComponent {
|
|
|
22
22
|
const titleClasses = classNames(styles.title, className, isSelected && activeClassName, {
|
|
23
23
|
[styles.selected]: isSelected,
|
|
24
24
|
});
|
|
25
|
-
return (_jsx(TabLink, { title: title, isSelected: isSelected, href: href, className: titleClasses, disabled: disabled, onPlainLeftClick: onSelect
|
|
25
|
+
return (_jsx(TabLink, { title: title, isSelected: isSelected, href: href, className: titleClasses, disabled: disabled, onPlainLeftClick: onSelect ? this.handleSelect(key) : undefined, ...titleProps }, key));
|
|
26
26
|
};
|
|
27
27
|
render() {
|
|
28
28
|
const { className, tabContainerClassName, children, selected, autoCollapse, 'data-test': dataTest, onSelect, ...restProps } = this.props;
|
|
29
29
|
const classes = classNames(styles.tabs, className);
|
|
30
30
|
const childrenArray = React.Children.toArray(children).filter(Boolean);
|
|
31
|
-
return (_jsxs("div", { className: classes, "data-test": dataTests('ring-dumb-tabs', dataTest), children: [autoCollapse === true ? (_jsx(CollapsibleTabs, { ...restProps, onSelect: onSelect
|
|
31
|
+
return (_jsxs("div", { className: classes, "data-test": dataTests('ring-dumb-tabs', dataTest), children: [autoCollapse === true ? (_jsx(CollapsibleTabs, { ...restProps, onSelect: onSelect ? this.handleSelect : undefined, selected: selected, children: childrenArray })) : (_jsx("div", { className: styles.titles, children: childrenArray.map(this.getTabTitle) })), _jsx("div", { className: classNames(tabContainerClassName), children: childrenArray.find(({ props }, i) => (props.id || String(i)) === selected) })] }));
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
export default Tabs;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PureComponent } from 'react';
|
|
2
|
-
import { TabsAttrs, Children } from './dumb-tabs';
|
|
2
|
+
import { type TabsAttrs, type Children } from './dumb-tabs';
|
|
3
3
|
export interface SmartTabsProps extends TabsAttrs {
|
|
4
4
|
children: Children;
|
|
5
5
|
initSelected?: string | null | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { LinkProps } from '../link/link';
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type LinkProps } from '../link/link';
|
|
3
3
|
export interface TabLinkProps extends Omit<LinkProps, 'title' | 'children'> {
|
|
4
4
|
isSelected: boolean;
|
|
5
5
|
collapsed?: boolean;
|
package/components/tabs/tab.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PureComponent, ReactNode } from 'react';
|
|
2
|
-
import { TabLinkProps } from './tab-link';
|
|
1
|
+
import { PureComponent, type ReactNode } from 'react';
|
|
2
|
+
import { type TabLinkProps } from './tab-link';
|
|
3
3
|
export interface TabProps {
|
|
4
4
|
title?: ReactNode | ((isSelected: boolean, collapsed: boolean | undefined) => ReactNode);
|
|
5
5
|
titleProps?: Partial<TabLinkProps>;
|
package/components/tabs/tabs.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
@import
|
|
1
|
+
@import '../global/variables.css';
|
|
2
2
|
|
|
3
3
|
/* ensure styles order */
|
|
4
|
-
@import
|
|
4
|
+
@import '../link/link.css';
|
|
5
5
|
|
|
6
6
|
:root,
|
|
7
7
|
:host {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
--ring-tabs-line-shadow: inset 0 -1px 0 0;
|
|
17
17
|
--ring-tabs-selected-line-shadow: inset 0 -2px 0 0;
|
|
18
18
|
|
|
19
|
-
composes: font from
|
|
19
|
+
composes: font from '../global/global.css';
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
.titles {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
.title {
|
|
37
|
-
composes: font from
|
|
37
|
+
composes: font from '../global/global.css';
|
|
38
38
|
|
|
39
39
|
position: relative;
|
|
40
40
|
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
|
|
47
47
|
color: inherit;
|
|
48
48
|
|
|
49
|
-
border:
|
|
49
|
+
border: 0;
|
|
50
50
|
border-radius: 0;
|
|
51
51
|
background: none;
|
|
52
52
|
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
.collapsed.collapsed {
|
|
192
192
|
width: 100%;
|
|
193
193
|
|
|
194
|
-
border-bottom:
|
|
194
|
+
border-bottom: 0;
|
|
195
195
|
box-shadow: none;
|
|
196
196
|
|
|
197
197
|
line-height: calc(var(--ring-unit) * 3);
|
package/components/tag/tag.css
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
@import
|
|
1
|
+
@import '../global/variables.css';
|
|
2
2
|
|
|
3
3
|
/* ensure styles order */
|
|
4
|
-
@import
|
|
4
|
+
@import '../link/link.css';
|
|
5
|
+
|
|
6
|
+
:root,
|
|
7
|
+
:host {
|
|
8
|
+
--ring-error-tag-text-color: var(--ring-main-error-hover-color);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:global(.ring-ui-theme-dark) {
|
|
12
|
+
--ring-error-tag-text-color: var(--ring-error-color);
|
|
13
|
+
}
|
|
5
14
|
|
|
6
15
|
.tag {
|
|
7
16
|
--ring-tag-max-height: 20px;
|
|
8
17
|
|
|
9
|
-
composes: resetButton from
|
|
18
|
+
composes: resetButton from '../global/global.css';
|
|
10
19
|
|
|
11
20
|
position: relative;
|
|
12
21
|
z-index: 1;
|
|
@@ -23,9 +32,9 @@
|
|
|
23
32
|
|
|
24
33
|
vertical-align: top;
|
|
25
34
|
|
|
26
|
-
color: var(--ring-text-color);
|
|
35
|
+
color: var(--ring-tag-text-color);
|
|
27
36
|
|
|
28
|
-
border:
|
|
37
|
+
border: 0;
|
|
29
38
|
border-radius: var(--ring-border-radius);
|
|
30
39
|
|
|
31
40
|
font-size: 12px;
|
|
@@ -52,8 +61,80 @@
|
|
|
52
61
|
|
|
53
62
|
border-radius: var(--ring-border-radius);
|
|
54
63
|
|
|
55
|
-
background-color: var(--ring-tag-background-color);
|
|
64
|
+
background-color: var(--ring-tag-container-background-color);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.default {
|
|
68
|
+
--ring-tag-container-background-color: var(--ring-tag-background-color);
|
|
69
|
+
--ring-tag-container-hover-background-color: var(--ring-tag-hover-background-color);
|
|
70
|
+
--ring-tag-text-color: var(--ring-text-color);
|
|
71
|
+
--ring-tag-icon-color: var(--ring-secondary-color);
|
|
72
|
+
--ring-tag-container-outline-background-color: var(--ring-grey-container-light-color);
|
|
73
|
+
--ring-tag-container-outline-hover-background-color: var(--ring-tag-background-color);
|
|
74
|
+
--ring-tag-outline-color: var(--ring-line-color);
|
|
75
|
+
--ring-tag-outline-hover-color: var(--ring-borders-color);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.main {
|
|
79
|
+
--ring-tag-container-background-color: var(--ring-hover-background-color);
|
|
80
|
+
--ring-tag-container-hover-background-color: var(--ring-selected-background-color);
|
|
81
|
+
--ring-tag-text-color: var(--ring-link-color);
|
|
82
|
+
--ring-tag-icon-color: var(--ring-link-color);
|
|
83
|
+
--ring-tag-container-outline-background-color: var(--ring-main-container-light-color);
|
|
84
|
+
--ring-tag-container-outline-hover-background-color: var(--ring-hover-background-color);
|
|
85
|
+
--ring-tag-outline-color: var(--ring-border-hover-color);
|
|
86
|
+
--ring-tag-outline-hover-color: var(--ring-border-accent-color);
|
|
87
|
+
}
|
|
56
88
|
|
|
89
|
+
.success {
|
|
90
|
+
--ring-tag-container-background-color: var(--ring-added-subtle-background-color);
|
|
91
|
+
--ring-tag-container-hover-background-color: var(--ring-added-background-color);
|
|
92
|
+
--ring-tag-text-color: var(--ring-success-color);
|
|
93
|
+
--ring-tag-icon-color: var(--ring-icon-success-color);
|
|
94
|
+
--ring-tag-container-outline-background-color: var(--ring-success-container-light-color);
|
|
95
|
+
--ring-tag-container-outline-hover-background-color: var(--ring-added-subtle-background-color);
|
|
96
|
+
--ring-tag-outline-color: var(--ring-success-border-color);
|
|
97
|
+
--ring-tag-outline-hover-color: var(--ring-success-border-hover-color);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.warning {
|
|
101
|
+
--ring-tag-container-background-color: var(--ring-warning-subtle-background-color);
|
|
102
|
+
--ring-tag-container-hover-background-color: var(--ring-warning-background-color);
|
|
103
|
+
--ring-tag-text-color: var(--ring-warning-color);
|
|
104
|
+
--ring-tag-icon-color: var(--ring-icon-warning-color);
|
|
105
|
+
--ring-tag-container-outline-background-color: var(--ring-warning-container-light-color);
|
|
106
|
+
--ring-tag-container-outline-hover-background-color: var(--ring-warning-subtle-background-color);
|
|
107
|
+
--ring-tag-outline-color: var(--ring-warning-border-color);
|
|
108
|
+
--ring-tag-outline-hover-color: var(--ring-warning-border-hover-color);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.error {
|
|
112
|
+
--ring-tag-container-background-color: var(--ring-removed-subtle-background-color);
|
|
113
|
+
--ring-tag-container-hover-background-color: var(--ring-removed-background-color);
|
|
114
|
+
--ring-tag-text-color: var(--ring-error-tag-text-color);
|
|
115
|
+
--ring-tag-icon-color: var(--ring-icon-error-color);
|
|
116
|
+
--ring-tag-container-outline-background-color: var(--ring-error-container-light-color);
|
|
117
|
+
--ring-tag-container-outline-hover-background-color: var(--ring-removed-subtle-background-color);
|
|
118
|
+
--ring-tag-outline-color: var(--ring-error-border-color);
|
|
119
|
+
--ring-tag-outline-hover-color: var(--ring-error-border-hover-color);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.purple {
|
|
123
|
+
--ring-tag-container-background-color: var(--ring-purple-subtle-background-color);
|
|
124
|
+
--ring-tag-container-hover-background-color: var(--ring-purple-background-color);
|
|
125
|
+
--ring-tag-text-color: var(--ring-purple-text-color);
|
|
126
|
+
--ring-tag-icon-color: var(--ring-main-purple-color);
|
|
127
|
+
--ring-tag-container-outline-background-color: var(--ring-purple-container-light-color);
|
|
128
|
+
--ring-tag-container-outline-hover-background-color: var(--ring-purple-subtle-background-color);
|
|
129
|
+
--ring-tag-outline-color: var(--ring-purple-border-color);
|
|
130
|
+
--ring-tag-outline-hover-color: var(--ring-purple-border-hover-color);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.outline {
|
|
134
|
+
--ring-tag-container-background-color: var(--ring-tag-container-outline-background-color);
|
|
135
|
+
--ring-tag-container-hover-background-color: var(--ring-tag-container-outline-hover-background-color);
|
|
136
|
+
|
|
137
|
+
box-shadow: inset 0 0 0 1px var(--ring-tag-outline-color);
|
|
57
138
|
}
|
|
58
139
|
|
|
59
140
|
.focused,
|
|
@@ -67,13 +148,14 @@
|
|
|
67
148
|
.focused,
|
|
68
149
|
.tag:focus-visible,
|
|
69
150
|
.container:hover {
|
|
70
|
-
|
|
151
|
+
--ring-tag-outline-color: var(--ring-tag-outline-hover-color);
|
|
152
|
+
--ring-tag-container-background-color: var(--ring-tag-container-hover-background-color);
|
|
71
153
|
|
|
72
|
-
|
|
154
|
+
transition: none;
|
|
73
155
|
}
|
|
74
156
|
|
|
75
157
|
.content {
|
|
76
|
-
composes: ellipsis from
|
|
158
|
+
composes: ellipsis from '../global/global.css';
|
|
77
159
|
}
|
|
78
160
|
|
|
79
161
|
.disabled.tag {
|
|
@@ -84,6 +166,8 @@
|
|
|
84
166
|
}
|
|
85
167
|
|
|
86
168
|
.remove {
|
|
169
|
+
--ring-button-text-color: var(--ring-secondary-color);
|
|
170
|
+
|
|
87
171
|
position: absolute;
|
|
88
172
|
z-index: 1;
|
|
89
173
|
top: 2px;
|
|
@@ -95,15 +179,11 @@
|
|
|
95
179
|
line-height: calc(var(--ring-unit) * 2);
|
|
96
180
|
}
|
|
97
181
|
|
|
98
|
-
.removeIcon.removeIcon {
|
|
99
|
-
color: var(--ring-secondary-color);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
182
|
.icon {
|
|
103
183
|
margin-right: calc(var(--ring-unit) / 2);
|
|
104
184
|
margin-left: calc(var(--ring-unit) * -0.5);
|
|
105
185
|
|
|
106
|
-
color: var(--ring-
|
|
186
|
+
color: var(--ring-tag-icon-color);
|
|
107
187
|
|
|
108
188
|
&& svg {
|
|
109
189
|
vertical-align: -3.5px;
|
package/components/tag/tag.d.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import { HTMLAttributes, PureComponent, ReactNode, RefCallback } from 'react';
|
|
1
|
+
import { type HTMLAttributes, PureComponent, type ReactNode, type RefCallback } from 'react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { IconType } from '../icon/icon';
|
|
3
|
+
import { type IconType } from '../icon/icon';
|
|
4
4
|
export interface TagRenderProps extends HTMLAttributes<HTMLElement> {
|
|
5
5
|
disabled: boolean;
|
|
6
6
|
ref: RefCallback<HTMLElement>;
|
|
7
7
|
'data-test': string;
|
|
8
8
|
}
|
|
9
|
+
export declare enum TagType {
|
|
10
|
+
DEFAULT = "default",
|
|
11
|
+
MAIN = "main",
|
|
12
|
+
SUCCESS = "success",
|
|
13
|
+
WARNING = "warning",
|
|
14
|
+
ERROR = "error",
|
|
15
|
+
PURPLE = "purple"
|
|
16
|
+
}
|
|
9
17
|
export interface TagProps {
|
|
10
18
|
onRemove?: ((event: React.MouseEvent<HTMLElement>) => void) | null;
|
|
11
19
|
onClick: (event: React.MouseEvent<HTMLElement>) => void;
|
|
@@ -22,6 +30,8 @@ export interface TagProps {
|
|
|
22
30
|
rgTagTitle?: string | undefined;
|
|
23
31
|
textColor?: string | undefined;
|
|
24
32
|
backgroundColor?: string | undefined;
|
|
33
|
+
outline?: boolean;
|
|
34
|
+
tagType?: TagType;
|
|
25
35
|
}
|
|
26
36
|
/**
|
|
27
37
|
* @name Tag
|
|
@@ -33,6 +43,7 @@ export default class Tag extends PureComponent<TagProps> {
|
|
|
33
43
|
};
|
|
34
44
|
componentDidUpdate(prevProps: TagProps): void;
|
|
35
45
|
componentWillUnmount(): void;
|
|
46
|
+
static Type: typeof TagType;
|
|
36
47
|
onDocumentClick: (event: MouseEvent) => void;
|
|
37
48
|
tagNode?: HTMLElement | null;
|
|
38
49
|
tagRef: (el: HTMLElement | null) => void;
|
package/components/tag/tag.js
CHANGED
|
@@ -6,6 +6,15 @@ import Icon from '../icon/icon';
|
|
|
6
6
|
import Button from '../button/button';
|
|
7
7
|
import { ControlsHeight } from '../global/controls-height';
|
|
8
8
|
import styles from './tag.css';
|
|
9
|
+
export var TagType;
|
|
10
|
+
(function (TagType) {
|
|
11
|
+
TagType["DEFAULT"] = "default";
|
|
12
|
+
TagType["MAIN"] = "main";
|
|
13
|
+
TagType["SUCCESS"] = "success";
|
|
14
|
+
TagType["WARNING"] = "warning";
|
|
15
|
+
TagType["ERROR"] = "error";
|
|
16
|
+
TagType["PURPLE"] = "purple";
|
|
17
|
+
})(TagType || (TagType = {}));
|
|
9
18
|
/**
|
|
10
19
|
* @name Tag
|
|
11
20
|
*/
|
|
@@ -15,7 +24,8 @@ export default class Tag extends PureComponent {
|
|
|
15
24
|
readOnly: false,
|
|
16
25
|
disabled: false,
|
|
17
26
|
focused: false,
|
|
18
|
-
render: props => _jsx("button", { type:
|
|
27
|
+
render: props => _jsx("button", { type: 'button', ...props }),
|
|
28
|
+
tagType: TagType.DEFAULT,
|
|
19
29
|
};
|
|
20
30
|
state = {
|
|
21
31
|
focused: false,
|
|
@@ -33,6 +43,7 @@ export default class Tag extends PureComponent {
|
|
|
33
43
|
this.setDocumentClickListener(false);
|
|
34
44
|
this.setState({ focused: false });
|
|
35
45
|
}
|
|
46
|
+
static Type = TagType;
|
|
36
47
|
onDocumentClick = (event) => {
|
|
37
48
|
if (this.tagNode) {
|
|
38
49
|
this.setState({ focused: this.tagNode === event.target });
|
|
@@ -77,7 +88,7 @@ export default class Tag extends PureComponent {
|
|
|
77
88
|
}
|
|
78
89
|
renderRemoveIcon() {
|
|
79
90
|
if (!this.props.readOnly && this.props.onRemove) {
|
|
80
|
-
return (_jsx(Button, { title:
|
|
91
|
+
return (_jsx(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 }));
|
|
81
92
|
}
|
|
82
93
|
return null;
|
|
83
94
|
}
|
|
@@ -88,7 +99,9 @@ export default class Tag extends PureComponent {
|
|
|
88
99
|
[styles.withRemove]: !this.props.readOnly && this.props.onRemove,
|
|
89
100
|
}, this.props.className);
|
|
90
101
|
const { backgroundColor, textColor, render } = this.props;
|
|
91
|
-
return (_jsxs("span", { className: classNames(styles.container, this.props.containerClassName
|
|
102
|
+
return (_jsxs("span", { className: classNames(styles.container, this.props.containerClassName, styles[this.props.tagType], {
|
|
103
|
+
[styles.outline]: this.props.outline,
|
|
104
|
+
}), children: [render({
|
|
92
105
|
'data-test': 'ring-tag',
|
|
93
106
|
className: classes,
|
|
94
107
|
ref: this.tagRef,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
@import
|
|
1
|
+
@import '../global/variables.css';
|
|
2
2
|
|
|
3
|
-
@value outerContainer, container, input from
|
|
3
|
+
@value outerContainer, container, input from '../input/input.css';
|
|
4
4
|
|
|
5
5
|
.tagsInput {
|
|
6
6
|
--ring-input-icon-offset: calc(var(--ring-unit) * 2.5);
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
|
|
61
61
|
caret-color: var(--ring-main-color);
|
|
62
62
|
|
|
63
|
-
[dir=
|
|
63
|
+
[dir='rtl'] & {
|
|
64
64
|
padding-right: var(--ring-input-padding-start);
|
|
65
65
|
padding-left: var(--ring-input-padding-end);
|
|
66
66
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { PureComponent, SyntheticEvent, ReactNode, ComponentType } from 'react';
|
|
1
|
+
import { PureComponent, type SyntheticEvent, type ReactNode, type ComponentType } from 'react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import Select, { SelectItem } from '../select/select';
|
|
4
|
-
import { TagType } from '../tags-list/tags-list';
|
|
3
|
+
import Select, { type SelectItem } from '../select/select';
|
|
4
|
+
import { type TagType } from '../tags-list/tags-list';
|
|
5
5
|
import Caret from '../caret/caret';
|
|
6
6
|
import { Size } from '../input/input';
|
|
7
|
-
import { ControlsHeight, ControlsHeightContext } from '../global/controls-height';
|
|
8
|
-
import { Filter } from '../select/
|
|
9
|
-
import { TagAttrs } from '../tag/tag';
|
|
10
|
-
import { LabelType } from '../control-label/control-label';
|
|
7
|
+
import { type ControlsHeight, ControlsHeightContext } from '../global/controls-height';
|
|
8
|
+
import { type Filter } from '../select/select-popup';
|
|
9
|
+
import { type TagAttrs } from '../tag/tag';
|
|
10
|
+
import { type LabelType } from '../control-label/control-label';
|
|
11
11
|
declare function noop(): void;
|
|
12
12
|
export interface ToggleTagParams {
|
|
13
13
|
tag: TagType;
|
|
@@ -104,7 +104,7 @@ export default class TagsInput extends PureComponent<TagsInputProps, TagsInputSt
|
|
|
104
104
|
handleKeyDown: (event: React.KeyboardEvent) => boolean;
|
|
105
105
|
handleClick: (arg: TagType) => () => void;
|
|
106
106
|
handleRemove: (arg: TagType) => () => Promise<void | TagType[]>;
|
|
107
|
-
handleTagCreation: (label: string) => void;
|
|
107
|
+
handleTagCreation: (label: string | undefined) => void;
|
|
108
108
|
select?: Select | null;
|
|
109
109
|
selectRef: (el: Select | null) => void;
|
|
110
110
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable max-lines */
|
|
2
3
|
import { PureComponent } from 'react';
|
|
3
4
|
import classNames from 'classnames';
|
|
4
5
|
import getEventKey from '../global/get-event-key';
|
|
@@ -50,8 +51,8 @@ export default class TagsInput extends PureComponent {
|
|
|
50
51
|
};
|
|
51
52
|
static getDerivedStateFromProps({ tags }, { prevTags }) {
|
|
52
53
|
const nextState = { prevTags: tags };
|
|
53
|
-
if (tags
|
|
54
|
-
Object.assign(nextState, { tags, activeIndex: tags
|
|
54
|
+
if (tags && tags !== prevTags) {
|
|
55
|
+
Object.assign(nextState, { tags, activeIndex: tags?.length });
|
|
55
56
|
}
|
|
56
57
|
return nextState;
|
|
57
58
|
}
|
|
@@ -59,6 +60,7 @@ export default class TagsInput extends PureComponent {
|
|
|
59
60
|
if (this.props.autoOpen && !this.props.disabled) {
|
|
60
61
|
this.focusInput();
|
|
61
62
|
this.loadSuggestions();
|
|
63
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
62
64
|
this.select?._showPopup();
|
|
63
65
|
}
|
|
64
66
|
}
|
|
@@ -91,7 +93,7 @@ export default class TagsInput extends PureComponent {
|
|
|
91
93
|
this.focusInput();
|
|
92
94
|
};
|
|
93
95
|
addTag = (tag) => {
|
|
94
|
-
if (tag
|
|
96
|
+
if (tag === null) {
|
|
95
97
|
return;
|
|
96
98
|
}
|
|
97
99
|
const isUniqueTag = this.state.tags.filter(item => tag.key === item.key).length === 0;
|
|
@@ -119,6 +121,7 @@ export default class TagsInput extends PureComponent {
|
|
|
119
121
|
if (event.target !== this.node && event.target.parentElement !== this.node) {
|
|
120
122
|
return;
|
|
121
123
|
}
|
|
124
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
122
125
|
this.select?._clickHandler();
|
|
123
126
|
};
|
|
124
127
|
filterExistingTags = (suggestions) => {
|
|
@@ -158,22 +161,24 @@ export default class TagsInput extends PureComponent {
|
|
|
158
161
|
this.setActiveIndex(newActiveIndex);
|
|
159
162
|
}
|
|
160
163
|
};
|
|
164
|
+
// eslint-disable-next-line complexity
|
|
161
165
|
handleKeyDown = (event) => {
|
|
162
166
|
const key = getEventKey(event);
|
|
163
167
|
const isInputFocused = () => event.target instanceof Element && event.target.matches(this.getInputNode()?.tagName ?? '');
|
|
164
168
|
if (key === ' ' && this.props.allowAddNewTags) {
|
|
165
169
|
event.stopPropagation();
|
|
166
170
|
const value = this.getInputNode()?.value;
|
|
167
|
-
if (value
|
|
171
|
+
if (value) {
|
|
168
172
|
this.handleTagCreation(value);
|
|
169
173
|
}
|
|
170
174
|
return true;
|
|
171
175
|
}
|
|
176
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
172
177
|
if (this.select?._popup?.isVisible()) {
|
|
173
178
|
return true;
|
|
174
179
|
}
|
|
175
180
|
if (key === 'ArrowLeft') {
|
|
176
|
-
if (this.getInputNode() && this.caret
|
|
181
|
+
if (this.getInputNode() && this.caret && Number(this.caret?.getPosition()) > 0) {
|
|
177
182
|
return true;
|
|
178
183
|
}
|
|
179
184
|
this.selectTag();
|
|
@@ -195,12 +200,13 @@ export default class TagsInput extends PureComponent {
|
|
|
195
200
|
if (key === 'Backspace' && !this.getInputNode()?.value) {
|
|
196
201
|
event.preventDefault();
|
|
197
202
|
const tagsLength = this.state.tags.length;
|
|
203
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
198
204
|
this.select?._hidePopup(true); // otherwise confirmation may be overlapped by popup
|
|
199
205
|
this.onRemoveTag(this.state.tags[tagsLength - 1]);
|
|
200
206
|
return false;
|
|
201
207
|
}
|
|
202
208
|
if ((key === 'Delete' || key === 'Backspace') &&
|
|
203
|
-
this.state.activeIndex
|
|
209
|
+
this.state.activeIndex &&
|
|
204
210
|
this.state.tags[this.state.activeIndex]) {
|
|
205
211
|
this.onRemoveTag(this.state.tags[this.state.activeIndex]).then(() => this.selectTag(true));
|
|
206
212
|
return false;
|
|
@@ -228,7 +234,7 @@ export default class TagsInput extends PureComponent {
|
|
|
228
234
|
}, this.props.className);
|
|
229
235
|
return (_jsxs("div", {
|
|
230
236
|
// it transfers focus to input
|
|
231
|
-
role:
|
|
237
|
+
role: 'presentation', className: classes, onKeyDown: this.handleKeyDown, onClick: this.clickHandler, ref: this.nodeRef, children: [label && (_jsx(ControlLabel, { htmlFor: this.id, disabled: disabled, type: labelType, children: label })), _jsx(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, children: _jsx(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 }) })] }));
|
|
232
238
|
}
|
|
233
239
|
}
|
|
234
240
|
export const RerenderableTagsInput = rerenderHOC(TagsInput);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Component, ComponentType, HTMLAttributes, ReactNode } from 'react';
|
|
1
|
+
import { Component, type ComponentType, type HTMLAttributes, type ReactNode } from 'react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { TagAttrs } from '../tag/tag';
|
|
3
|
+
import { type TagAttrs } from '../tag/tag';
|
|
4
4
|
declare function noop(): void;
|
|
5
5
|
export interface TagType extends Omit<TagAttrs, 'onClick' | 'children'> {
|
|
6
6
|
label?: ReactNode;
|
|
@@ -25,6 +25,6 @@ export default class TagsList extends Component {
|
|
|
25
25
|
const { children, className, customTagComponent, canNotBeEmpty, handleClick, tagClassName, handleRemove, tags, activeIndex, ...props } = this.props;
|
|
26
26
|
const classes = classNames('ring-js-shortcuts', className);
|
|
27
27
|
const tagsList = (this.props.tags || []).map((tag, index) => this.renderTag(tag, this.props.activeIndex === index));
|
|
28
|
-
return (_jsxs("div", { "data-test":
|
|
28
|
+
return (_jsxs("div", { "data-test": 'ring-tags-list', className: classes, ...props, children: [tagsList, children] }));
|
|
29
29
|
}
|
|
30
30
|
}
|
package/components/text/text.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import
|
|
1
|
+
@import '../global/variables.css';
|
|
2
2
|
|
|
3
3
|
.toggle {
|
|
4
4
|
--ring-toggle-padding: 2px;
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
width: calc(var(--ring-unit) * 1.5);
|
|
95
95
|
height: calc(var(--ring-unit) * 1.5);
|
|
96
96
|
|
|
97
|
-
content:
|
|
97
|
+
content: '';
|
|
98
98
|
|
|
99
99
|
transition: transform var(--ring-toggle-timing-function) var(--ring-toggle-duration);
|
|
100
100
|
|
|
@@ -190,6 +190,10 @@
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
.input[disabled] + .switch {
|
|
194
|
+
--ring-toggle-item-color: var(--ring-content-background-color);
|
|
195
|
+
}
|
|
196
|
+
|
|
193
197
|
/* stylelint-disable-next-line selector-max-specificity */
|
|
194
198
|
.input:checked[disabled] + .switch {
|
|
195
199
|
--ring-toggle-background-color: var(--ring-border-disabled-active-color);
|
|
@@ -197,7 +201,6 @@
|
|
|
197
201
|
|
|
198
202
|
/* stylelint-disable-next-line selector-max-specificity */
|
|
199
203
|
.input[disabled]:not(:checked) + .switch {
|
|
200
|
-
--ring-toggle-item-color: var(--ring-content-background-color);
|
|
201
204
|
--ring-toggle-background-color: var(--ring-disabled-background-color);
|
|
202
205
|
--ring-toggle-border-color: var(--ring-border-disabled-color);
|
|
203
206
|
--ring-switch-border-color: var(--ring-border-disabled-color);
|