@jetbrains/ring-ui 7.0.62 → 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 +1 -1
- 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 +6 -6
- package/components/select/select.js +27 -25
- 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 +5 -5
- package/components/tag/tag.d.ts +2 -2
- package/components/tag/tag.js +2 -2
- 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 +2 -2
- 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 +3 -2
- 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 -1
- package/package.json +4 -1
- /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
|
@@ -50,7 +50,7 @@ export default class DatePicker extends PureComponent {
|
|
|
50
50
|
onChange() { },
|
|
51
51
|
applyTimeInput(date, timeString) {
|
|
52
52
|
const [hours, minutes] = timeString?.split(':').map(Number) ?? [];
|
|
53
|
-
return minutes
|
|
53
|
+
return minutes !== null && minutes !== undefined ? set(date, { hours, minutes }) : date;
|
|
54
54
|
},
|
|
55
55
|
parseDateInput(string) {
|
|
56
56
|
if (!string) {
|
|
@@ -69,7 +69,9 @@ export default class DatePicker extends PureComponent {
|
|
|
69
69
|
static contextType = I18nContext;
|
|
70
70
|
handleChange = (change) => {
|
|
71
71
|
const { onChange, withTime, applyTimeInput } = this.props;
|
|
72
|
-
const adjustedChange = withTime && !(change instanceof Date) && change?.date
|
|
72
|
+
const adjustedChange = withTime && !(change instanceof Date) && change?.date !== null && change?.date !== undefined
|
|
73
|
+
? applyTimeInput(change.date, change.time)
|
|
74
|
+
: change;
|
|
73
75
|
onChange(adjustedChange);
|
|
74
76
|
};
|
|
75
77
|
clear = () => {
|
|
@@ -84,6 +86,7 @@ export default class DatePicker extends PureComponent {
|
|
|
84
86
|
this.popup = el;
|
|
85
87
|
};
|
|
86
88
|
closePopup = () => {
|
|
89
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
87
90
|
this.popup?._onCloseAttempt();
|
|
88
91
|
};
|
|
89
92
|
parse = memoize((date) => {
|
|
@@ -99,11 +102,12 @@ export default class DatePicker extends PureComponent {
|
|
|
99
102
|
formatTime() {
|
|
100
103
|
const { displayTimeFormat, locale } = this.props;
|
|
101
104
|
const date = this.parse(this.props.date);
|
|
102
|
-
if (date
|
|
105
|
+
if (date !== null && date !== undefined) {
|
|
103
106
|
return displayTimeFormat(date, locale);
|
|
104
107
|
}
|
|
105
108
|
return null;
|
|
106
109
|
}
|
|
110
|
+
// eslint-disable-next-line complexity
|
|
107
111
|
getAnchorText = () => {
|
|
108
112
|
const { range, datePlaceholder, dateTimePlaceholder, rangePlaceholder, withTime, displayFormat, displayMonthFormat, displayDayFormat, translations, locale, } = this.props;
|
|
109
113
|
const { translate } = this.context;
|
|
@@ -114,37 +118,31 @@ export default class DatePicker extends PureComponent {
|
|
|
114
118
|
if (!range && !withTime) {
|
|
115
119
|
return date ? displayFormat(date, locale) : (datePlaceholder ?? translations?.setDate ?? translate('setDate'));
|
|
116
120
|
}
|
|
117
|
-
|
|
121
|
+
if (!range && withTime) {
|
|
118
122
|
if (!date && !time) {
|
|
119
123
|
return dateTimePlaceholder ?? translations?.setDateTime ?? translate('setDateTime');
|
|
120
124
|
}
|
|
121
|
-
|
|
122
|
-
return `${(date && displayFormat(date, locale)) || '—'}, ${time || '—'}`;
|
|
123
|
-
}
|
|
125
|
+
return `${(date && displayFormat(date, locale)) || '—'}, ${time || '—'}`;
|
|
124
126
|
}
|
|
125
|
-
|
|
127
|
+
if (from && to) {
|
|
126
128
|
if (!isSameYear(from, to)) {
|
|
127
129
|
return `${displayFormat(from, locale)} — ${displayFormat(to, locale)}`;
|
|
128
130
|
}
|
|
129
|
-
|
|
131
|
+
if (!isSameMonth(from, to)) {
|
|
130
132
|
return `${displayMonthFormat(from, locale)} — ${displayFormat(to, locale)}`;
|
|
131
133
|
}
|
|
132
|
-
|
|
134
|
+
if (!isSameDay(from, to)) {
|
|
133
135
|
return `${displayDayFormat(from, locale)} — ${displayFormat(to, locale)}`;
|
|
134
136
|
}
|
|
135
|
-
|
|
136
|
-
return `${displayFormat(to, locale)}`;
|
|
137
|
-
}
|
|
137
|
+
return `${displayFormat(to, locale)}`;
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
if (from) {
|
|
140
140
|
return `${displayFormat(from, locale)} —`;
|
|
141
141
|
}
|
|
142
|
-
|
|
142
|
+
if (to) {
|
|
143
143
|
return `— ${displayFormat(to, locale)}`;
|
|
144
144
|
}
|
|
145
|
-
|
|
146
|
-
return rangePlaceholder ?? translations?.setPeriod ?? translate('setPeriod');
|
|
147
|
-
}
|
|
145
|
+
return rangePlaceholder ?? translations?.setPeriod ?? translate('setPeriod');
|
|
148
146
|
};
|
|
149
147
|
render() {
|
|
150
148
|
const anchorContent = (_jsxs("div", { className: styles.anchorContent, children: [_jsx(Icon, { glyph: calendarIcon, className: styles.calendarIcon }), this.getAnchorText(), _jsx(Icon, { glyph: chevronDownIcon, className: styles.chevronDownIcon })] }));
|
|
@@ -152,7 +150,7 @@ export default class DatePicker extends PureComponent {
|
|
|
152
150
|
const classes = classNames(styles.datePicker, className, styles[`size${this.props.size}`], {
|
|
153
151
|
[styles.inline]: inline,
|
|
154
152
|
});
|
|
155
|
-
return (_jsx(Dropdown, { className: classes, disabled: this.props.disabled, "data-test":
|
|
153
|
+
return (_jsx(Dropdown, { className: classes, disabled: this.props.disabled, "data-test": 'ring-date-picker', anchor: inline ? (_jsx(Link, { "data-test-ring-dropdown-anchor": true, className: styles.anchor, disabled: this.props.disabled ?? false, pseudo: true, children: this.getAnchorText() })) : (_jsx(Button, { "data-test-ring-dropdown-anchor": true, className: styles.anchor, inline: false, disabled: this.props.disabled ?? false, ...this.props.buttonAttributes, children: anchorContent })), ...dropdownProps, children: _jsx(PopupComponent, { className: popupClassName, popupRef: this.popupRef, onClear: clear ? this.clear : null, datePopupProps: {
|
|
156
154
|
...datePopupProps,
|
|
157
155
|
translations,
|
|
158
156
|
onChange: this.handleChange,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { DatePickerChange, DatePopupBaseProps, DateSpecificPopupProps, DatePopupState, RangeSpecificPopupProps, TimeSpecificPopupProps, Field } from './consts';
|
|
3
|
+
import { type DatePickerChange, type DatePopupBaseProps, type DateSpecificPopupProps, type DatePopupState, type RangeSpecificPopupProps, type TimeSpecificPopupProps, type Field } from './consts';
|
|
4
4
|
export type DatePopupProps = DatePopupBaseProps & (DateSpecificPopupProps | TimeSpecificPopupProps | RangeSpecificPopupProps);
|
|
5
5
|
export default class DatePopup extends Component<DatePopupProps, DatePopupState> {
|
|
6
6
|
static sameDay(next: Date | number | null, prev: Date | number | null): boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createElement as _createElement } from "react";
|
|
3
|
+
/* eslint-disable max-lines */
|
|
3
4
|
import { Component } from 'react';
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import { isAfter } from 'date-fns/isAfter';
|
|
@@ -244,6 +245,7 @@ export default class DatePopup extends Component {
|
|
|
244
245
|
this.props.onClear?.(e);
|
|
245
246
|
this.componentRef.current?.querySelector('input')?.focus();
|
|
246
247
|
};
|
|
248
|
+
// eslint-disable-next-line complexity
|
|
247
249
|
render() {
|
|
248
250
|
const { range, withTime, locale } = this.props;
|
|
249
251
|
const { from, to, date, time, ...restProps } = this.props;
|
|
@@ -258,7 +260,7 @@ export default class DatePopup extends Component {
|
|
|
258
260
|
};
|
|
259
261
|
}, {});
|
|
260
262
|
const activeDate = this.state.active !== 'time'
|
|
261
|
-
? this.state.hoverDate || (this.state.text
|
|
263
|
+
? this.state.hoverDate || (this.state.text ? this.parse(this.state.text, 'date') : null)
|
|
262
264
|
: this.state.hoverDate || null;
|
|
263
265
|
const currentRange = (range && dates.from && dates.to && [dates.from, dates.to]) || null;
|
|
264
266
|
let activeRange = null;
|
|
@@ -298,12 +300,12 @@ export default class DatePopup extends Component {
|
|
|
298
300
|
onScrollChange: this.scrollTo,
|
|
299
301
|
};
|
|
300
302
|
const clearable = Boolean(this.props.onClear);
|
|
301
|
-
return (_jsxs("div", { className: styles.datePopup, "data-test":
|
|
303
|
+
return (_jsxs("div", { className: styles.datePopup, "data-test": 'ring-date-popup', ref: this.componentRef, children: [_jsxs("div", { className: styles.filterWrapper, children: [names.map(name => {
|
|
302
304
|
let onClear;
|
|
303
305
|
if (clearable && name !== 'from' && !this.isInTimeMode()) {
|
|
304
306
|
onClear = this.onClear.bind(this);
|
|
305
307
|
}
|
|
306
|
-
return (_createElement(DateInput, { ...this.props, ...this.state, divider: name === 'from' && (dates[name]
|
|
308
|
+
return (_createElement(DateInput, { ...this.props, ...this.state, divider: name === 'from' && (!!dates[name] || !!parsedTo), name: name, key: name, date: dates[name], active: this.state.active === name, onActivate: this.handleActivate(name), onInput: this.handleInput, onConfirm: this.handleConfirm(name), onClear: onClear, locale: locale }));
|
|
307
309
|
}), this.isInTimeMode() ? (_createElement(DateInput, { ...this.props, text: this.state.text, divider: !!parsedDate, hoverDate: null, name: 'time', key: 'time', date: null, time: time, active: this.state.active === 'time', onActivate: this.handleActivate('time'), onInput: this.handleInput, onConfirm: this.handleConfirm('time'), onClear: (clearable && this.onClear) || undefined, locale: locale })) : ('')] }), _jsx(Weekdays, { locale: locale }), _jsxs("div", { className: styles.calendar, children: [_jsx(Months, { ...calendarProps, onHover: this.hoverHandler, onSelect: this.selectHandler, locale: locale }), _jsx(Years, { ...calendarProps })] }), this.props.renderAfterCalendar && this.props.renderAfterCalendar(this.state)] }));
|
|
308
310
|
}
|
|
309
311
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
|
-
import { MonthsProps } from './consts';
|
|
2
|
+
import { type MonthsProps } from './consts';
|
|
3
3
|
export interface DayProps extends MonthsProps {
|
|
4
4
|
day: Date;
|
|
5
5
|
empty: boolean;
|
|
@@ -11,7 +11,7 @@ export default class Day extends Component<DayProps> {
|
|
|
11
11
|
isDay: (date: Date) => boolean;
|
|
12
12
|
is: (name: "date" | "from" | "to" | "activeDate") => boolean;
|
|
13
13
|
inRange: (range: [Date, Date] | null) => boolean | null;
|
|
14
|
-
isDisabled: (date: Date) => boolean;
|
|
14
|
+
isDisabled: (date: Date) => boolean | null;
|
|
15
15
|
parse(text: string | null | undefined): Date | null;
|
|
16
16
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
}
|
|
@@ -28,7 +28,7 @@ export default class Day extends Component {
|
|
|
28
28
|
isDay = (date) => isSameDay(this.props.day, date);
|
|
29
29
|
is = (name) => {
|
|
30
30
|
const value = this.props[name];
|
|
31
|
-
return value
|
|
31
|
+
return !!value && this.isDay(value);
|
|
32
32
|
};
|
|
33
33
|
inRange = (range) => range &&
|
|
34
34
|
isAfter(startOfDay(this.props.day), startOfDay(range[0])) &&
|
|
@@ -36,8 +36,7 @@ export default class Day extends Component {
|
|
|
36
36
|
isDisabled = (date) => {
|
|
37
37
|
const min = this.parse(this.props.minDate);
|
|
38
38
|
const max = this.parse(this.props.maxDate);
|
|
39
|
-
return (
|
|
40
|
-
(max != null && isAfter(startOfDay(date), startOfDay(max))));
|
|
39
|
+
return (min && isBefore(startOfDay(date), startOfDay(min))) || (max && isAfter(startOfDay(date), startOfDay(max)));
|
|
41
40
|
};
|
|
42
41
|
parse(text) {
|
|
43
42
|
return this.props.parseDateInput(text);
|
|
@@ -50,11 +49,11 @@ export default class Day extends Component {
|
|
|
50
49
|
return range && [range[0], addDays(range[1], 1)];
|
|
51
50
|
}
|
|
52
51
|
const spreadRange = makeSpreadRange(currentRange);
|
|
53
|
-
const disabled = this.isDisabled(day);
|
|
52
|
+
const disabled = !!this.isDisabled(day);
|
|
54
53
|
const activeSpreadRange = makeSpreadRange(activeRange);
|
|
55
54
|
return (
|
|
56
55
|
// TODO make keyboard navigation actually work
|
|
57
|
-
_jsx("button", { type:
|
|
56
|
+
_jsx("button", { type: 'button', className: classNames(styles.day, styles[`Day${dayInWeek}`], {
|
|
58
57
|
[styles.current]: ['date', 'from', 'to'].some(this.is),
|
|
59
58
|
[styles.active]: !disabled && this.is('activeDate'),
|
|
60
59
|
[styles.weekend]: [weekdays.SA, weekdays.SU].includes(getDay(day)),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MonthsProps } from './consts';
|
|
1
|
+
import { type MonthsProps } from './consts';
|
|
2
2
|
export default function MonthNames(props: MonthsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -18,7 +18,7 @@ class MonthName extends PureComponent {
|
|
|
18
18
|
};
|
|
19
19
|
render() {
|
|
20
20
|
const { month, locale } = this.props;
|
|
21
|
-
return (_jsx("button", { type:
|
|
21
|
+
return (_jsx("button", { type: 'button', className: classNames(styles.monthName, {
|
|
22
22
|
[styles.today]: isThisMonth(month),
|
|
23
23
|
}), onClick: this.handleClick, children: format(month, 'LLL', { locale }) }));
|
|
24
24
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PureComponent } from 'react';
|
|
2
|
-
import { LinearFunction } from '../global/linear-function';
|
|
3
|
-
import { MonthsProps } from './consts';
|
|
2
|
+
import { type LinearFunction } from '../global/linear-function';
|
|
3
|
+
import { type MonthsProps } from './consts';
|
|
4
4
|
export interface MonthSliderProps extends MonthsProps {
|
|
5
5
|
pxToDate: LinearFunction;
|
|
6
6
|
}
|
|
@@ -39,7 +39,7 @@ export default class MonthSlider extends PureComponent {
|
|
|
39
39
|
years.push(year);
|
|
40
40
|
}
|
|
41
41
|
const classes = classNames(styles.monthSlider, { [styles.dragging]: this.state.dragging });
|
|
42
|
-
return (_jsx("div", { children: years.map(date => (_jsx("button", { type:
|
|
42
|
+
return (_jsx("div", { children: years.map(date => (_jsx("button", { type: 'button', className: classes, style: {
|
|
43
43
|
top: Math.floor(this.props.pxToDate.x(Number(date)) - units.cellSize),
|
|
44
44
|
}, onMouseDown: this.onMouseDown }, +date))) }));
|
|
45
45
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MonthsProps } from './consts';
|
|
1
|
+
import { type MonthsProps } from './consts';
|
|
2
2
|
export default function Months(props: MonthsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -74,11 +74,11 @@ export default function Months(props) {
|
|
|
74
74
|
});
|
|
75
75
|
useEffect(() => {
|
|
76
76
|
const current = componentRef.current;
|
|
77
|
-
if (current
|
|
77
|
+
if (current) {
|
|
78
78
|
current.addEventListener('wheel', handleWheel, { passive: false });
|
|
79
79
|
}
|
|
80
80
|
return () => {
|
|
81
|
-
if (current
|
|
81
|
+
if (current) {
|
|
82
82
|
current.removeEventListener('wheel', handleWheel);
|
|
83
83
|
}
|
|
84
84
|
};
|
|
@@ -24,7 +24,7 @@ export default class Years extends PureComponent {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
componentDidUpdate(prevProps, prevState) {
|
|
27
|
-
this.stoppedScrolling = prevState.scrollDate
|
|
27
|
+
this.stoppedScrolling = !!prevState.scrollDate && !this.state.scrollDate;
|
|
28
28
|
}
|
|
29
29
|
componentWillUnmount() {
|
|
30
30
|
if (this.componentRef.current) {
|
|
@@ -68,7 +68,7 @@ export default class Years extends PureComponent {
|
|
|
68
68
|
return (_jsx("div", { className: styles.years, ref: this.componentRef, style: {
|
|
69
69
|
transition: this.stoppedScrolling ? 'top .2s ease-out 0s' : 'none',
|
|
70
70
|
top: Math.floor(calHeight * HALF - pxToDate.x(Number(date))),
|
|
71
|
-
}, children: years.map(item => (_jsx("button", { type:
|
|
71
|
+
}, children: years.map(item => (_jsx("button", { type: 'button', className: classNames(styles.year, {
|
|
72
72
|
[styles.currentYear]: isSameYear(item, date),
|
|
73
73
|
[styles.today]: isThisYear(item),
|
|
74
74
|
}), onClick: function handleClick() {
|
package/components/dialog/{dialog__body-scroll-preventer.js → dialog-body-scroll-preventer.js}
RENAMED
|
@@ -16,7 +16,11 @@ const prevent = (key) => {
|
|
|
16
16
|
const scrollWidth = scrollbarWidth();
|
|
17
17
|
const { scrollbarGutter } = getComputedStyle(document.documentElement);
|
|
18
18
|
const documentHasScrollbarGutter = scrollbarGutter === 'stable' || scrollbarGutter === 'both-edges';
|
|
19
|
-
if (documentHasScroll &&
|
|
19
|
+
if (documentHasScroll &&
|
|
20
|
+
scrollWidth !== null &&
|
|
21
|
+
scrollWidth !== undefined &&
|
|
22
|
+
scrollWidth > 0 &&
|
|
23
|
+
!documentHasScrollbarGutter) {
|
|
20
24
|
previousDocumentWidth = document.documentElement.style.width;
|
|
21
25
|
document.documentElement.style.width = `calc(100% - ${scrollWidth}px)`;
|
|
22
26
|
}
|
|
@@ -30,7 +34,7 @@ const reset = (key) => {
|
|
|
30
34
|
return;
|
|
31
35
|
}
|
|
32
36
|
document.documentElement.classList.remove(styles.documentWithoutScroll);
|
|
33
|
-
if (previousDocumentWidth !== null) {
|
|
37
|
+
if (previousDocumentWidth !== null && previousDocumentWidth !== undefined) {
|
|
34
38
|
document.documentElement.style.width = previousDocumentWidth;
|
|
35
39
|
previousDocumentWidth = null;
|
|
36
40
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
@import
|
|
1
|
+
@import '../global/variables.css';
|
|
2
2
|
|
|
3
|
-
@value header, scrollableWrapper from
|
|
4
|
-
@value panel from
|
|
3
|
+
@value header, scrollableWrapper from '../island/island.css';
|
|
4
|
+
@value panel from '../panel/panel.css';
|
|
5
5
|
|
|
6
6
|
.container {
|
|
7
7
|
position: fixed;
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
padding: 0;
|
|
26
26
|
|
|
27
|
-
border:
|
|
27
|
+
border: 0;
|
|
28
28
|
background: transparent;
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
margin-top: 0;
|
|
59
59
|
padding: calc(var(--ring-unit) * 2) calc(var(--ring-unit) * 4) calc(var(--ring-unit) * 4);
|
|
60
60
|
|
|
61
|
-
border-top:
|
|
61
|
+
border-top: 0;
|
|
62
62
|
|
|
63
63
|
background-color: transparent;
|
|
64
64
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PureComponent } from 'react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import TabTrap, { TabTrapProps } from '../tab-trap/tab-trap';
|
|
3
|
+
import TabTrap, { type TabTrapProps } from '../tab-trap/tab-trap';
|
|
4
4
|
import type { ShortcutsScopeOptions } from '../shortcuts/core';
|
|
5
5
|
export interface DialogProps extends Partial<TabTrapProps> {
|
|
6
6
|
show: boolean;
|
|
@@ -11,7 +11,7 @@ import TabTrap from '../tab-trap/tab-trap';
|
|
|
11
11
|
import Button from '../button/button';
|
|
12
12
|
import { PopupTarget, PopupTargetContext } from '../popup/popup.target';
|
|
13
13
|
import { getPopupContainer } from '../popup/popup';
|
|
14
|
-
import { preventerFactory as scrollPreventerFactory } from './
|
|
14
|
+
import { preventerFactory as scrollPreventerFactory } from './dialog-body-scroll-preventer';
|
|
15
15
|
import styles from './dialog.css';
|
|
16
16
|
/**
|
|
17
17
|
* @name Dialog
|
|
@@ -58,7 +58,7 @@ export default class Dialog extends PureComponent {
|
|
|
58
58
|
uid = getUID('dialog-');
|
|
59
59
|
toggleNativeDialog() {
|
|
60
60
|
const { show, modal } = this.props;
|
|
61
|
-
if (this.nativeDialog.current
|
|
61
|
+
if (this.nativeDialog.current) {
|
|
62
62
|
if (show) {
|
|
63
63
|
this.nativeDialog.current.removeAttribute('open');
|
|
64
64
|
if (modal) {
|
|
@@ -114,9 +114,9 @@ export default class Dialog extends PureComponent {
|
|
|
114
114
|
const shortcutsMap = this.getShortcutsMap();
|
|
115
115
|
const content = (_jsxs(_Fragment, { children: [_jsx(Shortcuts, { map: shortcutsMap, scope: this.state.shortcutsScope, options: this.props.shortcutOptions }), (onOverlayClick !== noop || onCloseAttempt !== noop) && (_jsx("div", {
|
|
116
116
|
// click handler is duplicated in close button
|
|
117
|
-
role:
|
|
117
|
+
role: 'presentation', className: styles.clickableOverlay, onClick: this.handleClick, "data-test": 'ring-dialog-overlay' })), _jsx("div", { className: styles.innerContainer, children: _jsxs(AdaptiveIsland, { className: classNames(styles.content, contentClassName, {
|
|
118
118
|
[styles.dense]: dense,
|
|
119
|
-
}), "data-test":
|
|
119
|
+
}), "data-test": 'ring-dialog', role: 'dialog', "aria-label": label, children: [children, showCloseButton && (_jsx(Button, { icon: closeIcon, "data-test": 'ring-dialog-close-button', className: classNames(styles.closeButton, {
|
|
120
120
|
[styles.closeButtonOutside]: !closeButtonInside,
|
|
121
121
|
[styles.closeButtonInside]: closeButtonInside,
|
|
122
122
|
}), iconClassName: classNames(styles.closeIcon, {
|
|
@@ -131,13 +131,13 @@ export default class Dialog extends PureComponent {
|
|
|
131
131
|
if (portalTarget instanceof HTMLElement) {
|
|
132
132
|
targetElement = portalTarget;
|
|
133
133
|
}
|
|
134
|
-
else if (contextTarget
|
|
134
|
+
else if (contextTarget) {
|
|
135
135
|
const container = getPopupContainer(contextTarget);
|
|
136
|
-
if (container
|
|
136
|
+
if (container) {
|
|
137
137
|
targetElement = container;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
return createPortal(_jsx(PopupTarget, { id: this.uid, className: styles.popupTarget, children: target => (_jsxs(TabTrap, { trapDisabled: !trapFocus, "data-test": dataTests('ring-dialog-container', dataTest), "data-rg-modal-dialog-container":
|
|
140
|
+
return createPortal(_jsx(PopupTarget, { id: this.uid, className: styles.popupTarget, children: target => (_jsxs(TabTrap, { trapDisabled: !trapFocus, "data-test": dataTests('ring-dialog-container', dataTest), "data-rg-modal-dialog-container": '', ref: this.dialogRef, className: classes, role: 'presentation', ...restProps, children: [content, target] })) }), targetElement);
|
|
141
141
|
} })));
|
|
142
142
|
}
|
|
143
143
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ButtonAttrs } from '../button/button';
|
|
1
|
+
import { type ButtonAttrs } from '../button/button';
|
|
2
2
|
declare const _default: import("react").MemoExoticComponent<({ children, className, ...restProps }: ButtonAttrs) => import("react/jsx-runtime").JSX.Element>;
|
|
3
3
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Component, HTMLAttributes, ReactNode, ReactElement } from 'react';
|
|
1
|
+
import { Component, type HTMLAttributes, type ReactNode, type ReactElement } from 'react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { PopupAttrs } from '../popup/popup';
|
|
3
|
+
import { type PopupAttrs } from '../popup/popup';
|
|
4
4
|
import Anchor from './anchor';
|
|
5
5
|
export interface AnchorProps {
|
|
6
6
|
active: boolean;
|
|
@@ -99,7 +99,7 @@ export default class Dropdown extends Component {
|
|
|
99
99
|
const { show, pinned } = this.state;
|
|
100
100
|
const { initShown, onShow, onHide, hoverShowTimeOut, hoverHideTimeOut, children, anchor, className, activeClassName, hoverMode, clickMode, 'data-test': dataTest, disabled, ...restProps } = this.props;
|
|
101
101
|
const classes = classNames(styles.dropdown, className, {
|
|
102
|
-
[activeClassName ?? '']: activeClassName
|
|
102
|
+
[activeClassName ?? '']: activeClassName && show,
|
|
103
103
|
});
|
|
104
104
|
let anchorElement;
|
|
105
105
|
const active = hoverMode ? pinned : show;
|
|
@@ -127,7 +127,7 @@ export default class Dropdown extends Component {
|
|
|
127
127
|
};
|
|
128
128
|
return (_jsxs("div", { "data-test": dataTests('ring-dropdown', dataTest), ...restProps, onClick: clickMode ? this.onClick : undefined,
|
|
129
129
|
// anchorElement should be a `button` or an `a`
|
|
130
|
-
role:
|
|
130
|
+
role: 'presentation', onMouseEnter: hoverMode ? this.onMouseEnter : undefined, onMouseLeave: hoverMode ? this.onMouseLeave : undefined, className: classes, children: [anchorElement, typeof children === 'function'
|
|
131
131
|
? children(childProps)
|
|
132
132
|
: cloneElement(children, childProps)] }));
|
|
133
133
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ReactElement, HTMLAttributes, SyntheticEvent, Ref, ReactNode } from 'react';
|
|
2
|
-
import { SelectHandlerParams } from '../list/list';
|
|
3
|
-
import { AnchorProps, DropdownAttrs, DropdownChildrenFunction } from '../dropdown/dropdown';
|
|
4
|
-
import PopupMenu, { PopupMenuAttrs } from '../popup-menu/popup-menu';
|
|
5
|
-
import { ListDataItem } from '../list/consts';
|
|
1
|
+
import { type ReactElement, type HTMLAttributes, type SyntheticEvent, type Ref, type ReactNode } from 'react';
|
|
2
|
+
import { type SelectHandlerParams } from '../list/list';
|
|
3
|
+
import { type AnchorProps, type DropdownAttrs, type DropdownChildrenFunction } from '../dropdown/dropdown';
|
|
4
|
+
import PopupMenu, { type PopupMenuAttrs } from '../popup-menu/popup-menu';
|
|
5
|
+
import { type ListDataItem } from '../list/consts';
|
|
6
6
|
export interface DropdownAnchorWrapperProps extends AnchorProps {
|
|
7
7
|
anchor: ReactElement | ReactNode[] | string | ((props: AnchorProps, ariaProps: HTMLAttributes<HTMLElement>) => ReactElement | null);
|
|
8
8
|
activeListItemId?: string | null | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useMemo, cloneElement } from 'react';
|
|
2
|
+
import { forwardRef, useMemo, cloneElement, } from 'react';
|
|
3
3
|
import List, { ActiveItemContext } from '../list/list';
|
|
4
4
|
import Dropdown from '../dropdown/dropdown';
|
|
5
5
|
import PopupMenu from '../popup-menu/popup-menu';
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
color: inherit;
|
|
28
28
|
|
|
29
|
-
border:
|
|
29
|
+
border: 0;
|
|
30
30
|
border-radius: var(--ring-border-radius);
|
|
31
31
|
outline: none;
|
|
32
32
|
background: inherit;
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
color: var(--ring-heading-color);
|
|
96
96
|
caret-color: var(--ring-main-color);
|
|
97
97
|
|
|
98
|
-
border:
|
|
98
|
+
border: 0;
|
|
99
99
|
border-bottom: 1px solid var(--ring-borders-color);
|
|
100
100
|
outline: none;
|
|
101
101
|
background-color: transparent;
|
|
@@ -143,14 +143,12 @@
|
|
|
143
143
|
width: 100%;
|
|
144
144
|
height: 30px;
|
|
145
145
|
|
|
146
|
-
content:
|
|
146
|
+
content: '';
|
|
147
147
|
pointer-events: none;
|
|
148
148
|
|
|
149
|
-
background: linear-gradient(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
rgba(var(--ring-content-background-components), 1)
|
|
153
|
-
);
|
|
149
|
+
background: linear-gradient(to bottom,
|
|
150
|
+
rgba(var(--ring-content-background-components), 0),
|
|
151
|
+
rgba(var(--ring-content-background-components), 1));
|
|
154
152
|
}
|
|
155
153
|
|
|
156
154
|
.textareaWrapper {
|
|
@@ -12,6 +12,7 @@ import styles from './editable-heading.css';
|
|
|
12
12
|
export { Levels };
|
|
13
13
|
export { Size };
|
|
14
14
|
function noop() { }
|
|
15
|
+
// eslint-disable-next-line complexity
|
|
15
16
|
export const EditableHeading = (props) => {
|
|
16
17
|
const { level = Levels.H1, className, headingClassName, inputClassName, children, isEditing = false, isSavingPossible = false, isSaving = false, embedded = false, size = Size.L, onEdit = noop, onSave = noop, onCancel = noop, autoFocus = true, 'data-test': dataTest, error, disabled, multiline = false, renderMenu = () => null, onFocus, onBlur, onChange, onScroll, maxInputRows, translations = {
|
|
17
18
|
save: 'Save',
|
|
@@ -57,7 +58,7 @@ export const EditableHeading = (props) => {
|
|
|
57
58
|
el.style.height = `${el.scrollHeight - parseFloat(paddingTop) - parseFloat(paddingBottom)}px`;
|
|
58
59
|
}, []);
|
|
59
60
|
const checkValue = useCallback((el) => {
|
|
60
|
-
if (multiline && el
|
|
61
|
+
if (multiline && el && el.scrollHeight >= el.clientHeight) {
|
|
61
62
|
stretch(el);
|
|
62
63
|
}
|
|
63
64
|
}, [stretch, multiline]);
|
|
@@ -111,6 +112,6 @@ export const EditableHeading = (props) => {
|
|
|
111
112
|
window.removeEventListener('mouseup', onMouseUp);
|
|
112
113
|
};
|
|
113
114
|
}, [onMouseMove, onMouseUp]);
|
|
114
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: classes, children: [!disabled && isEditing ? (_jsxs(_Fragment, { children: [_jsx(Shortcuts, { map: shortcutsMap, scope: shortcutsScope, disabled: isShortcutsDisabled }), !multiline ? (_jsx("input", { className: inputClasses, value: children, autoFocus: autoFocus, "data-test": dataTest, disabled: isSaving, onChange: onChange, ...restProps, onFocus: onInputFocus, onBlur: onInputBlur })) : (_jsxs("div", { className: classNames(styles.textareaWrapper, inputStyles[`size${size}`]), children: [_jsx("textarea", { ref: textAreaRef, className: inputClasses, value: children, autoFocus: autoFocus, "data-test": dataTest, disabled: isSaving, onChange: onInputChange, ...restProps, onFocus: onInputFocus, onBlur: onInputBlur, onScroll: onInputScroll, style: { maxHeight: maxInputRows ? `${maxInputRows}lh` : '' } }), !isScrolledToBottom && _jsx("div", { className: styles.textareaFade })] }))] })) : (_jsx("button", { type:
|
|
115
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: classes, children: [!disabled && isEditing ? (_jsxs(_Fragment, { children: [_jsx(Shortcuts, { map: shortcutsMap, scope: shortcutsScope, disabled: isShortcutsDisabled }), !multiline ? (_jsx("input", { className: inputClasses, value: children, autoFocus: autoFocus, "data-test": dataTest, disabled: isSaving, onChange: onChange, ...restProps, onFocus: onInputFocus, onBlur: onInputBlur })) : (_jsxs("div", { className: classNames(styles.textareaWrapper, inputStyles[`size${size}`]), children: [_jsx("textarea", { ref: textAreaRef, className: inputClasses, value: children, autoFocus: autoFocus, "data-test": dataTest, disabled: isSaving, onChange: onInputChange, ...restProps, onFocus: onInputFocus, onBlur: onInputBlur, onScroll: onInputScroll, style: { maxHeight: maxInputRows ? `${maxInputRows}lh` : '' } }), !isScrolledToBottom && _jsx("div", { className: styles.textareaFade })] }))] })) : (_jsx("button", { type: 'button', className: styles.headingWrapperButton, onMouseDown: onHeadingMouseDown, children: _jsx(Heading, { className: headingClasses, level: level, "data-test": dataTest, children: children }) })), !isEditing && renderMenu(), isEditing && !embedded && (_jsxs(_Fragment, { children: [_jsx(Button, { className: styles.button, primary: true, disabled: isSaveDisabled, loader: isSaving, onClick: onSave, children: translations.save }), _jsx(Button, { className: styles.button, disabled: isCancelDisabled, onClick: onCancel, children: translations.cancel })] }))] }), isEditing && error && _jsx("div", { className: classNames(styles.errorText, inputStyles[`size${size}`]), children: error })] }));
|
|
115
116
|
};
|
|
116
117
|
export default React.memo(EditableHeading);
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
width: var(--ring-unit);
|
|
45
45
|
height: var(--ring-unit);
|
|
46
46
|
|
|
47
|
-
content:
|
|
47
|
+
content: '';
|
|
48
48
|
transform: rotate(45deg);
|
|
49
49
|
|
|
50
50
|
border: 1px solid var(--ring-popup-border-color);
|
|
51
|
-
border-top:
|
|
52
|
-
border-right:
|
|
51
|
+
border-top: 0;
|
|
52
|
+
border-right: 0;
|
|
53
53
|
|
|
54
54
|
background: var(--ring-error-bubble-background-color);
|
|
55
55
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import
|
|
1
|
+
@import '../global/variables.css';
|
|
2
2
|
|
|
3
3
|
:root,
|
|
4
4
|
:host {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
margin-left: 2px;
|
|
16
16
|
|
|
17
|
-
border:
|
|
17
|
+
border: 0;
|
|
18
18
|
|
|
19
19
|
box-shadow: none;
|
|
20
20
|
}
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
width: var(--ring-unit);
|
|
53
53
|
height: var(--ring-unit);
|
|
54
54
|
|
|
55
|
-
content:
|
|
55
|
+
content: '';
|
|
56
56
|
transform: rotate(45deg);
|
|
57
57
|
|
|
58
58
|
border: 1px solid var(--ring-popup-border-color);
|
|
59
|
-
border-top:
|
|
60
|
-
border-right:
|
|
59
|
+
border-top: 0;
|
|
60
|
+
border-right: 0;
|
|
61
61
|
background: var(--ring-error-bubble-background-color);
|
|
62
62
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// url=https://www.figma.com/design/HY6d4uE1xxaQXCMG9fe6Y2/RingUI-(Internal)?node-id=1228-2869
|
|
2
|
-
|
|
2
|
+
import figma from '@figma/code-connect';
|
|
3
3
|
|
|
4
4
|
const instance = figma.selectedInstance;
|
|
5
5
|
const error = instance.findLayers(() => true)[0].textContent;
|
|
@@ -11,7 +11,7 @@ export default class ErrorBubble extends PureComponent {
|
|
|
11
11
|
render() {
|
|
12
12
|
const { children, className, ...restProps } = this.props;
|
|
13
13
|
const errorBubbleClasses = classNames(styles.errorBubble, className);
|
|
14
|
-
return (_jsxs("div", { className: styles.errorBubbleWrapper, "data-test":
|
|
15
|
-
Children.map(children, (child) => cloneElement(child, { ...child.props, ...restProps })), restProps.error && (_jsx(Popup, { trapFocus: false, className: styles.errorBubblePopup, hidden: false, attached: false, directions: [Directions.RIGHT_CENTER, Directions.RIGHT_BOTTOM, Directions.RIGHT_TOP], children: _jsx("div", { className: errorBubbleClasses, "data-test":
|
|
14
|
+
return (_jsxs("div", { className: styles.errorBubbleWrapper, "data-test": 'ring-error-bubble-wrapper', children: [children &&
|
|
15
|
+
Children.map(children, (child) => cloneElement(child, { ...child.props, ...restProps })), restProps.error && (_jsx(Popup, { trapFocus: false, className: styles.errorBubblePopup, hidden: false, attached: false, directions: [Directions.RIGHT_CENTER, Directions.RIGHT_BOTTOM, Directions.RIGHT_TOP], children: _jsx("div", { className: errorBubbleClasses, "data-test": 'ring-error-bubble', children: restProps.error }) }))] }));
|
|
16
16
|
}
|
|
17
17
|
}
|