@jetbrains/ring-ui-built 7.0.125 → 8.0.0-beta.11
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/_helpers/anchor.js +1 -1
- package/components/_helpers/avatar-info.js +3 -5
- package/components/_helpers/caption.js +1 -1
- package/components/_helpers/dialog.js +3 -0
- package/components/_helpers/icon-svg.js +37 -52
- package/components/_helpers/legacy-table.js +3 -0
- package/components/_helpers/tab-link.js +1 -1
- package/components/_helpers/table.js +2 -2
- package/components/_helpers/theme.js +49 -37
- package/components/alert/alert-actions.js +1 -1
- package/components/alert/alert-heading.js +1 -1
- package/components/alert/alert.js +2 -2
- package/components/alert-service/alert-service.js +2 -2
- package/components/auth/auth-core.js +2 -2
- package/components/auth/auth.js +2 -2
- package/components/auth/down-notification.js +2 -2
- package/components/auth/iframe-flow.js +15 -10
- package/components/auth/storage.js +2 -2
- package/components/auth-dialog/auth-dialog.js +11 -6
- package/components/auth-dialog-service/auth-dialog-service.js +19 -11
- package/components/avatar/avatar-info.js +1 -1
- package/components/avatar/avatar-size.d.ts +0 -4
- package/components/avatar/avatar-size.js +0 -4
- package/components/avatar/avatar.js +1 -8
- package/components/avatar/fallback-avatar.js +3 -48
- package/components/avatar-stack/avatar-stack.js +5 -5
- package/components/banner/banner.js +5 -6
- package/components/button/button.d.ts +0 -4
- package/components/button/button.js +4 -10
- package/components/button-group/button-group.js +1 -1
- package/components/button-toolbar/button-toolbar.js +1 -1
- package/components/checkbox/checkbox.d.ts +1 -1
- package/components/checkbox/checkbox.js +1 -2
- package/components/clipboard/clipboard.js +2 -2
- package/components/code/code.js +1 -2
- package/components/collapse/collapse-content.js +35 -43
- package/components/collapse/collapse-context.d.ts +1 -0
- package/components/collapse/collapse-context.js +1 -0
- package/components/collapse/collapse-control.js +5 -5
- package/components/collapse/collapse.js +34 -25
- package/components/collapsible-group/collapsible-group.d.ts +5 -1
- package/components/collapsible-group/collapsible-group.js +80 -98
- package/components/components/util-stories.js +63 -1
- package/components/confirm/confirm.js +30 -21
- package/components/confirm-service/confirm-service.js +21 -13
- package/components/contenteditable/contenteditable.js +4 -5
- package/components/control-help/control-help.js +1 -1
- package/components/control-label/control-label.js +1 -1
- package/components/data-list/data-list.d.ts +4 -4
- package/components/data-list/data-list.js +5 -5
- package/components/data-list/data-list.mock.d.ts +1 -1
- package/components/data-list/data-list.mock.js +2 -2
- package/components/data-list/item.d.ts +1 -1
- package/components/data-list/item.js +3 -3
- package/components/data-list/selection.d.ts +1 -1
- package/components/data-list/selection.js +2 -2
- package/components/data-list/title.js +1 -2
- package/components/date-picker/date-input.js +2 -2
- package/components/date-picker/date-picker.js +2 -3
- package/components/date-picker/date-popup.js +4 -5
- package/components/date-picker/month-names.js +1 -1
- package/components/date-picker/month-slider.js +1 -1
- package/components/date-picker/month.d.ts +0 -2
- package/components/date-picker/month.js +17 -18
- package/components/date-picker/months.js +43 -36
- package/components/date-picker/use-scroll-behavior.js +45 -45
- package/components/date-picker/weekdays.js +1 -1
- package/components/date-picker/years.js +61 -55
- package/components/dialog/dialog-body-scroll-preventer.js +49 -2
- package/components/dialog/dialog-controls.d.ts +13 -0
- package/components/dialog/dialog-controls.js +113 -0
- package/components/dialog/dialog-geometry.d.ts +31 -0
- package/components/dialog/dialog-geometry.js +63 -0
- package/components/dialog/dialog.d.ts +15 -7
- package/components/dialog/dialog.js +185 -37
- package/components/dropdown/anchor.js +3 -3
- package/components/dropdown/dropdown.js +3 -3
- package/components/dropdown-menu/dropdown-menu.d.ts +4 -4
- package/components/dropdown-menu/dropdown-menu.js +63 -58
- package/components/editable-heading/editable-heading.d.ts +1 -2
- package/components/editable-heading/editable-heading.js +14 -13
- package/components/error-bubble/error-bubble.js +1 -1
- package/components/error-message/error-message.js +1 -2
- package/components/footer/footer.js +1 -1
- package/components/global/compose-refs.d.ts +2 -1
- package/components/global/compose-refs.js +44 -8
- package/components/global/configuration.d.ts +0 -5
- package/components/global/configuration.js +2 -10
- package/components/global/controls-height.js +1 -1
- package/components/global/create-stateful-context.js +11 -11
- package/components/global/focus-sensor-hoc.js +1 -0
- package/components/global/focus-with-temporary-tabindex.d.ts +11 -0
- package/components/global/focus-with-temporary-tabindex.js +23 -0
- package/components/global/get-viewport-size.d.ts +5 -0
- package/components/global/get-viewport-size.js +6 -0
- package/components/global/intersection-observer-context.d.ts +46 -0
- package/components/global/intersection-observer-context.js +138 -0
- package/components/global/is-within-interactive-element.d.ts +6 -0
- package/components/global/is-within-interactive-element.js +11 -0
- package/components/global/is-within-navigable-element.d.ts +6 -0
- package/components/global/is-within-navigable-element.js +11 -0
- package/components/global/parse-css-duration.d.ts +5 -0
- package/components/global/parse-css-duration.js +14 -0
- package/components/global/rerender-hoc.d.ts +4 -2
- package/components/global/rerender-hoc.js +11 -24
- package/components/global/schedule-with-cleanup.d.ts +12 -0
- package/components/global/schedule-with-cleanup.js +36 -0
- package/components/{table/selection.d.ts → global/table-selection.d.ts} +15 -15
- package/components/{table/selection.js → global/table-selection.js} +5 -5
- package/components/global/theme.d.ts +4 -3
- package/components/global/theme.js +1 -1
- package/components/global/variables.interface.d.ts +0 -4
- package/components/header/header-icon.js +3 -3
- package/components/header/header.js +3 -3
- package/components/header/links.js +1 -1
- package/components/header/logo.js +1 -2
- package/components/header/profile.js +5 -5
- package/components/header/services.js +3 -3
- package/components/header/smart-profile.js +3 -3
- package/components/header/smart-services.js +3 -3
- package/components/heading/heading.js +1 -1
- package/components/http/http.js +6 -23
- package/components/i18n/i18n-context.js +4 -4
- package/components/icon/icon-svg.js +1 -2
- package/components/icon/icon.d.ts +0 -1
- package/components/icon/icon.js +2 -6
- package/components/icon/index.js +1 -2
- package/components/input/input.d.ts +1 -1
- package/components/input/input.js +3 -3
- package/components/internal/reorder-animation-context.js +159 -0
- package/components/internal/reorder-handle.js +750 -0
- package/components/internal/reorder-layout-context.js +141 -0
- package/components/internal/table-header.js +685 -0
- package/components/internal/virtualization.js +368 -0
- package/components/island/adaptive-island-hoc.js +3 -3
- package/components/island/content.d.ts +7 -2
- package/components/island/content.js +27 -18
- package/components/island/header.js +4 -3
- package/components/island/island.js +1 -1
- package/components/{table → legacy-table}/cell.js +1 -1
- package/components/{table → legacy-table}/header-cell.js +2 -3
- package/components/{table → legacy-table}/header.js +2 -3
- package/components/{table → legacy-table}/multitable.d.ts +1 -1
- package/components/{table → legacy-table}/row-with-focus-sensor.js +3 -3
- package/components/{table → legacy-table}/row.d.ts +1 -1
- package/components/{table → legacy-table}/row.js +5 -5
- package/components/legacy-table/selection-adapter.d.ts +6 -0
- package/components/{table → legacy-table}/selection-shortcuts-hoc.d.ts +5 -5
- package/components/{table → legacy-table}/simple-table.d.ts +2 -2
- package/components/{table → legacy-table}/simple-table.js +5 -5
- package/components/{table → legacy-table}/smart-table.d.ts +5 -5
- package/components/{table → legacy-table}/smart-table.js +6 -6
- package/components/legacy-table/table.d.ts +109 -0
- package/components/legacy-table/table.js +369 -0
- package/components/list/consts.d.ts +0 -1
- package/components/list/consts.js +0 -1
- package/components/list/list-item.js +3 -5
- package/components/list/list-users-groups-source.js +1 -2
- package/components/list/list.d.ts +0 -4
- package/components/list/list.js +1 -2
- package/components/login-dialog/login-dialog.js +17 -12
- package/components/login-dialog/service.js +19 -11
- package/components/message/message.js +1 -1
- package/components/pager/pager.js +3 -3
- package/components/popup/popup.js +1 -1
- package/components/popup/popup.target.d.ts +3 -2
- package/components/popup/popup.target.js +32 -28
- package/components/popup-menu/popup-menu.js +1 -1
- package/components/query-assist/query-assist-suggestions.js +1 -2
- package/components/query-assist/query-assist.d.ts +3 -1
- package/components/query-assist/query-assist.js +2 -2
- package/components/radio/radio-item.d.ts +3 -3
- package/components/radio/radio-item.js +33 -19
- package/components/radio/radio.d.ts +2 -2
- package/components/radio/radio.js +2 -2
- package/components/scrollable-section/scrollable-section.js +1 -1
- package/components/select/chevron-button.js +3 -3
- package/components/select/select-filter.js +3 -3
- package/components/select/select-popup.d.ts +3 -2
- package/components/select/select-popup.js +9 -4
- package/components/select/select.d.ts +6 -2
- package/components/select/select.js +5 -4
- package/components/selection-toolbar/selection-toolbar.d.ts +11 -0
- package/components/selection-toolbar/selection-toolbar.js +200 -0
- package/components/slider/slider.js +100 -97
- package/components/storage/storage-local.js +2 -2
- package/components/storage/storage.js +2 -2
- package/components/style.css +1 -1
- package/components/tab-trap/tab-trap.d.ts +3 -3
- package/components/tab-trap/tab-trap.js +83 -80
- package/components/table/default-item-renderer.d.ts +55 -0
- package/components/table/default-item-renderer.js +240 -0
- package/components/table/internal/reorder-animation-context.d.ts +21 -0
- package/components/table/internal/reorder-handle.d.ts +9 -0
- package/components/table/internal/reorder-layout-context.d.ts +16 -0
- package/components/table/internal/table-header.d.ts +1 -0
- package/components/table/internal/virtualization.d.ts +41 -0
- package/components/table/item-virtualization.d.ts +37 -0
- package/components/table/item-virtualization.js +73 -0
- package/components/table/reorder-animation.d.ts +37 -0
- package/components/table/reorder-animation.js +18 -0
- package/components/table/reorder-item-layout.d.ts +32 -0
- package/components/table/reorder-item-layout.js +57 -0
- package/components/table/table-const.d.ts +10 -0
- package/components/table/table-const.js +13 -0
- package/components/table/table-primitives.d.ts +64 -0
- package/components/table/table-primitives.js +180 -0
- package/components/table/table-props.d.ts +304 -0
- package/components/table/table-props.js +1 -0
- package/components/table/table.d.ts +231 -107
- package/components/table/table.js +351 -346
- package/components/tabs/collapsible-more.js +1 -1
- package/components/tabs/collapsible-tab.js +1 -1
- package/components/tabs/collapsible-tabs.js +1 -1
- package/components/tabs/dumb-tabs.js +1 -1
- package/components/tabs/smart-tabs.js +1 -1
- package/components/tabs/tab-link.js +1 -1
- package/components/tabs/tabs.js +1 -1
- package/components/tag/tag.js +1 -1
- package/components/tags-input/tags-input.d.ts +3 -1
- package/components/tags-input/tags-input.js +4 -4
- package/components/tags-list/tags-list.js +2 -2
- package/components/toggle/toggle.js +1 -1
- package/components/tooltip/tooltip.d.ts +2 -1
- package/components/tooltip/tooltip.js +5 -3
- package/components/upload/upload.d.ts +4 -3
- package/components/upload/upload.js +7 -30
- package/components/user-agreement/service.js +12 -4
- package/components/user-agreement/user-agreement.js +24 -20
- package/components/user-card/card.js +4 -4
- package/components/user-card/smart-user-card-tooltip.js +3 -3
- package/components/user-card/tooltip.js +3 -3
- package/components/user-card/user-card.js +5 -5
- package/components/util-stories.d.ts +26 -0
- package/package.json +11 -12
- package/components/__mocks__/old-browsers-message.js +0 -3
- package/components/_helpers/dialog-body-scroll-preventer.js +0 -50
- package/components/_helpers/grid.js +0 -3
- package/components/_helpers/sidebar.js +0 -110
- package/components/content-layout/content-layout.d.ts +0 -20
- package/components/content-layout/content-layout.js +0 -50
- package/components/content-layout/sidebar.d.ts +0 -26
- package/components/content-layout/sidebar.js +0 -5
- package/components/date-picker/use-intersection-observer.d.ts +0 -6
- package/components/date-picker/use-intersection-observer.js +0 -93
- package/components/expand/collapsible-group.d.ts +0 -8
- package/components/expand/collapsible-group.js +0 -52
- package/components/global/composeRefs.d.ts +0 -6
- package/components/global/composeRefs.js +0 -9
- package/components/global/use-event-callback.d.ts +0 -4
- package/components/global/use-event-callback.js +0 -49
- package/components/grid/col.d.ts +0 -16
- package/components/grid/col.js +0 -63
- package/components/grid/grid.d.ts +0 -13
- package/components/grid/grid.js +0 -27
- package/components/grid/row.d.ts +0 -21
- package/components/grid/row.js +0 -72
- package/components/old-browsers-message/old-browsers-message-stop.d.ts +0 -1
- package/components/old-browsers-message/old-browsers-message-stop.js +0 -5
- package/components/old-browsers-message/old-browsers-message.d.ts +0 -5
- package/components/old-browsers-message/old-browsers-message.js +0 -89
- package/components/old-browsers-message/white-list.d.ts +0 -2
- package/components/old-browsers-message/white-list.js +0 -30
- package/components/table/selection-adapter.d.ts +0 -6
- /package/components/{table → legacy-table}/cell.d.ts +0 -0
- /package/components/{table → legacy-table}/disable-hover-hoc.d.ts +0 -0
- /package/components/{table → legacy-table}/disable-hover-hoc.js +0 -0
- /package/components/{table → legacy-table}/header-cell.d.ts +0 -0
- /package/components/{table → legacy-table}/header.d.ts +0 -0
- /package/components/{table → legacy-table}/multitable.js +0 -0
- /package/components/{table → legacy-table}/row-with-focus-sensor.d.ts +0 -0
- /package/components/{table → legacy-table}/selection-adapter.js +0 -0
- /package/components/{table → legacy-table}/selection-shortcuts-hoc.js +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PureComponent } from 'react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import
|
|
3
|
+
import { type TabTrapObject, type TabTrapProps } from '../tab-trap/tab-trap';
|
|
4
|
+
import { type DialogState, type Interaction, type InteractionDirection } from './dialog-geometry';
|
|
4
5
|
import type { ShortcutsScopeOptions } from '../shortcuts/core';
|
|
5
6
|
export interface DialogProps extends Partial<TabTrapProps> {
|
|
6
7
|
show: boolean;
|
|
@@ -11,8 +12,9 @@ export interface DialogProps extends Partial<TabTrapProps> {
|
|
|
11
12
|
onCloseAttempt: (event: React.MouseEvent<HTMLElement> | KeyboardEvent) => void;
|
|
12
13
|
showCloseButton: boolean;
|
|
13
14
|
shortcutOptions: ShortcutsScopeOptions;
|
|
14
|
-
closeButtonInside: boolean;
|
|
15
15
|
closeButtonTitle?: string;
|
|
16
|
+
movable?: boolean;
|
|
17
|
+
resizable?: boolean;
|
|
16
18
|
trapFocus: boolean;
|
|
17
19
|
contentClassName?: string | null | undefined;
|
|
18
20
|
portalTarget?: Element | null | undefined;
|
|
@@ -22,11 +24,9 @@ export interface DialogProps extends Partial<TabTrapProps> {
|
|
|
22
24
|
modal?: boolean;
|
|
23
25
|
preventBodyScroll?: boolean;
|
|
24
26
|
}
|
|
25
|
-
export default class Dialog extends PureComponent<DialogProps> {
|
|
27
|
+
export default class Dialog extends PureComponent<DialogProps, DialogState> {
|
|
26
28
|
static defaultProps: Partial<DialogProps>;
|
|
27
|
-
state:
|
|
28
|
-
shortcutsScope: string;
|
|
29
|
-
};
|
|
29
|
+
state: DialogState;
|
|
30
30
|
componentDidMount(): void;
|
|
31
31
|
componentDidUpdate(prevProps: DialogProps): void;
|
|
32
32
|
componentWillUnmount(): void;
|
|
@@ -43,8 +43,16 @@ export default class Dialog extends PureComponent<DialogProps> {
|
|
|
43
43
|
esc: (event: KeyboardEvent) => void;
|
|
44
44
|
};
|
|
45
45
|
dialog?: HTMLElement | null;
|
|
46
|
-
dialogRef: (
|
|
46
|
+
dialogRef: (tabTrapObj: TabTrapObject | null) => void;
|
|
47
47
|
nativeDialog: React.RefObject<HTMLDialogElement | null>;
|
|
48
|
+
innerContainer: React.RefObject<HTMLDivElement | null>;
|
|
49
|
+
interaction: Interaction | null;
|
|
50
|
+
resizeMinimum: Pick<Interaction, 'minWidth' | 'minHeight'> | null;
|
|
51
|
+
fitGeometryToViewport: () => void;
|
|
52
|
+
startInteraction: (event: React.PointerEvent<HTMLElement>, direction: InteractionDirection) => void;
|
|
53
|
+
continueInteraction: (event: React.PointerEvent<HTMLElement>) => void;
|
|
54
|
+
stopInteraction: (event: React.PointerEvent<HTMLElement>) => void;
|
|
55
|
+
startMove: (event: React.PointerEvent<HTMLElement>) => void;
|
|
48
56
|
render(): false | React.JSX.Element;
|
|
49
57
|
}
|
|
50
58
|
export type DialogAttrs = React.JSX.LibraryManagedAttributes<typeof Dialog, DialogProps>;
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { PureComponent, createRef } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import closeIcon from '@jetbrains/icons/close';
|
|
5
4
|
import { AdaptiveIsland } from '../island/island.js';
|
|
6
5
|
import getUID from '../global/get-uid.js';
|
|
7
6
|
import joinDataTestAttributes from '../global/data-tests.js';
|
|
8
7
|
import Shortcuts from '../shortcuts/shortcuts.js';
|
|
9
8
|
import TabTrap from '../tab-trap/tab-trap.js';
|
|
10
|
-
import { Button } from '../button/button.js';
|
|
11
9
|
import { PopupTarget, PopupTargetContext, normalizePopupTarget } from '../popup/popup.target.js';
|
|
12
10
|
import { getPopupContainer } from '../popup/popup.js';
|
|
13
|
-
import
|
|
11
|
+
import getViewportSize from '../global/get-viewport-size.js';
|
|
12
|
+
import { preventerFactory } from './dialog-body-scroll-preventer.js';
|
|
13
|
+
import DialogControls from './dialog-controls.js';
|
|
14
|
+
import { fitGeometry, getResizeMinimum, moveGeometry, resizeGeometry, getNativeTabIndex, getTrapDisabled } from './dialog-geometry.js';
|
|
15
|
+
import { s as styles } from '../_helpers/dialog.js';
|
|
14
16
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
15
17
|
import '../island/adaptive-island-hoc.js';
|
|
16
18
|
import '../global/linear-function.js';
|
|
17
19
|
import '../_helpers/island.js';
|
|
18
20
|
import '../island/header.js';
|
|
19
|
-
import 'react
|
|
21
|
+
import 'react/compiler-runtime';
|
|
20
22
|
import '../island/content.js';
|
|
21
23
|
import 'element-resize-detector';
|
|
22
24
|
import '../global/schedule-raf.js';
|
|
@@ -26,22 +28,25 @@ import 'combokeys';
|
|
|
26
28
|
import '../global/sniffer.js';
|
|
27
29
|
import 'sniffr';
|
|
28
30
|
import '../global/dom.js';
|
|
31
|
+
import '../global/configuration.js';
|
|
32
|
+
import '../popup/position.js';
|
|
33
|
+
import '../popup/popup.consts.js';
|
|
34
|
+
import '../popup/position-css.js';
|
|
35
|
+
import '../_helpers/theme.js';
|
|
36
|
+
import 'scrollbar-width';
|
|
37
|
+
import '@jetbrains/icons/close';
|
|
38
|
+
import '@jetbrains/icons/resize-corner-12px';
|
|
39
|
+
import '../button/button.js';
|
|
29
40
|
import '@jetbrains/icons/chevron-down';
|
|
30
41
|
import '@jetbrains/icons/chevron-12px-down';
|
|
31
|
-
import 'util-deprecate';
|
|
32
42
|
import '../icon/icon.js';
|
|
43
|
+
import 'util-deprecate';
|
|
33
44
|
import '../icon/icon.constants.js';
|
|
34
45
|
import '../_helpers/icon-svg.js';
|
|
35
|
-
import '../global/configuration.js';
|
|
36
46
|
import '../global/memoize.js';
|
|
37
47
|
import '../link/clickable-link.js';
|
|
38
48
|
import '../global/controls-height.js';
|
|
39
49
|
import '../_helpers/button.classes.js';
|
|
40
|
-
import '../popup/position.js';
|
|
41
|
-
import '../popup/popup.consts.js';
|
|
42
|
-
import '../popup/position-css.js';
|
|
43
|
-
import '../_helpers/theme.js';
|
|
44
|
-
import 'scrollbar-width';
|
|
45
50
|
|
|
46
51
|
function noop() {}
|
|
47
52
|
class Dialog extends PureComponent {
|
|
@@ -52,17 +57,21 @@ class Dialog extends PureComponent {
|
|
|
52
57
|
onCloseClick: noop,
|
|
53
58
|
onCloseAttempt: noop,
|
|
54
59
|
showCloseButton: false,
|
|
55
|
-
|
|
60
|
+
movable: true,
|
|
61
|
+
resizable: true,
|
|
56
62
|
shortcutOptions: {
|
|
57
63
|
modal: false
|
|
58
64
|
},
|
|
59
65
|
trapFocus: false,
|
|
60
66
|
autoFocusFirst: true,
|
|
67
|
+
native: true,
|
|
61
68
|
modal: true,
|
|
62
69
|
preventBodyScroll: true
|
|
63
70
|
};
|
|
64
71
|
state = {
|
|
65
|
-
shortcutsScope: getUID('ring-dialog-')
|
|
72
|
+
shortcutsScope: getUID('ring-dialog-'),
|
|
73
|
+
geometry: null,
|
|
74
|
+
resized: false
|
|
66
75
|
};
|
|
67
76
|
componentDidMount() {
|
|
68
77
|
const {
|
|
@@ -72,6 +81,7 @@ class Dialog extends PureComponent {
|
|
|
72
81
|
if (native && show) {
|
|
73
82
|
this.toggleNativeDialog();
|
|
74
83
|
}
|
|
84
|
+
window.addEventListener('resize', this.fitGeometryToViewport);
|
|
75
85
|
this.toggleScrollPreventer();
|
|
76
86
|
}
|
|
77
87
|
componentDidUpdate(prevProps) {
|
|
@@ -84,9 +94,16 @@ class Dialog extends PureComponent {
|
|
|
84
94
|
}
|
|
85
95
|
if (prevProps.show !== this.props.show) {
|
|
86
96
|
this.toggleScrollPreventer();
|
|
97
|
+
if (show) {
|
|
98
|
+
this.fitGeometryToViewport();
|
|
99
|
+
} else {
|
|
100
|
+
this.interaction = null;
|
|
101
|
+
}
|
|
87
102
|
}
|
|
88
103
|
}
|
|
89
104
|
componentWillUnmount() {
|
|
105
|
+
window.removeEventListener('resize', this.fitGeometryToViewport);
|
|
106
|
+
this.interaction = null;
|
|
90
107
|
this.scrollPreventer.reset();
|
|
91
108
|
}
|
|
92
109
|
scrollPreventer = preventerFactory(getUID('preventer-'));
|
|
@@ -94,7 +111,8 @@ class Dialog extends PureComponent {
|
|
|
94
111
|
toggleNativeDialog() {
|
|
95
112
|
const {
|
|
96
113
|
show,
|
|
97
|
-
modal
|
|
114
|
+
modal,
|
|
115
|
+
autoFocusFirst
|
|
98
116
|
} = this.props;
|
|
99
117
|
if (this.nativeDialog.current) {
|
|
100
118
|
if (show) {
|
|
@@ -104,6 +122,9 @@ class Dialog extends PureComponent {
|
|
|
104
122
|
} else {
|
|
105
123
|
this.nativeDialog.current.show();
|
|
106
124
|
}
|
|
125
|
+
if (!autoFocusFirst && !this.nativeDialog.current.querySelector('[autofocus]')) {
|
|
126
|
+
this.nativeDialog.current.focus();
|
|
127
|
+
}
|
|
107
128
|
} else {
|
|
108
129
|
this.nativeDialog.current.close();
|
|
109
130
|
}
|
|
@@ -139,10 +160,113 @@ class Dialog extends PureComponent {
|
|
|
139
160
|
};
|
|
140
161
|
};
|
|
141
162
|
dialog;
|
|
142
|
-
dialogRef =
|
|
143
|
-
this.dialog =
|
|
163
|
+
dialogRef = tabTrapObj => {
|
|
164
|
+
this.dialog = tabTrapObj && tabTrapObj.node;
|
|
144
165
|
};
|
|
145
166
|
nativeDialog = /*#__PURE__*/createRef();
|
|
167
|
+
innerContainer = /*#__PURE__*/createRef();
|
|
168
|
+
interaction = null;
|
|
169
|
+
resizeMinimum = null;
|
|
170
|
+
fitGeometryToViewport = () => {
|
|
171
|
+
this.setState(({
|
|
172
|
+
geometry
|
|
173
|
+
}) => {
|
|
174
|
+
if (!geometry) {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
const {
|
|
178
|
+
width,
|
|
179
|
+
height
|
|
180
|
+
} = getViewportSize();
|
|
181
|
+
return {
|
|
182
|
+
geometry: fitGeometry(geometry, width, height)
|
|
183
|
+
};
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
startInteraction = (event, direction) => {
|
|
187
|
+
var _event$button, _this$resizeMinimum;
|
|
188
|
+
if (((_event$button = event.button) !== null && _event$button !== void 0 ? _event$button : 0) !== 0 || !this.innerContainer.current) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const {
|
|
192
|
+
left,
|
|
193
|
+
top,
|
|
194
|
+
width,
|
|
195
|
+
height
|
|
196
|
+
} = this.innerContainer.current.getBoundingClientRect();
|
|
197
|
+
const resizeMinimum = (_this$resizeMinimum = this.resizeMinimum) !== null && _this$resizeMinimum !== void 0 ? _this$resizeMinimum : getResizeMinimum(this.innerContainer.current.firstElementChild);
|
|
198
|
+
if (direction !== 'move') {
|
|
199
|
+
this.resizeMinimum = resizeMinimum;
|
|
200
|
+
}
|
|
201
|
+
this.interaction = {
|
|
202
|
+
pointerId: event.pointerId,
|
|
203
|
+
direction,
|
|
204
|
+
startX: event.clientX,
|
|
205
|
+
startY: event.clientY,
|
|
206
|
+
...resizeMinimum,
|
|
207
|
+
geometry: {
|
|
208
|
+
left,
|
|
209
|
+
top,
|
|
210
|
+
width,
|
|
211
|
+
height
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
this.setState(({
|
|
215
|
+
resized
|
|
216
|
+
}) => ({
|
|
217
|
+
geometry: {
|
|
218
|
+
left,
|
|
219
|
+
top,
|
|
220
|
+
width,
|
|
221
|
+
height
|
|
222
|
+
},
|
|
223
|
+
resized: resized || direction !== 'move'
|
|
224
|
+
}));
|
|
225
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
226
|
+
event.preventDefault();
|
|
227
|
+
};
|
|
228
|
+
continueInteraction = event => {
|
|
229
|
+
const interaction = this.interaction;
|
|
230
|
+
if (!interaction || interaction.pointerId !== event.pointerId) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
const dx = event.clientX - interaction.startX;
|
|
234
|
+
const dy = event.clientY - interaction.startY;
|
|
235
|
+
const {
|
|
236
|
+
width: viewportWidth,
|
|
237
|
+
height: viewportHeight
|
|
238
|
+
} = getViewportSize();
|
|
239
|
+
const start = interaction.geometry;
|
|
240
|
+
if (interaction.direction === 'move') {
|
|
241
|
+
this.setState({
|
|
242
|
+
geometry: moveGeometry(start, dx, dy, viewportWidth, viewportHeight)
|
|
243
|
+
});
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
this.setState({
|
|
247
|
+
geometry: resizeGeometry(interaction, dx, dy, viewportWidth, viewportHeight),
|
|
248
|
+
resized: true
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
stopInteraction = event => {
|
|
252
|
+
if (this.interaction?.pointerId !== event.pointerId) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
this.interaction = null;
|
|
256
|
+
if (event.currentTarget.hasPointerCapture?.(event.pointerId)) {
|
|
257
|
+
event.currentTarget.releasePointerCapture?.(event.pointerId);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
startMove = event => {
|
|
261
|
+
const target = event.target;
|
|
262
|
+
if (!this.props.movable || !(target instanceof Element)) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const handle = target.closest('[data-ring-dialog-move-handle], [data-ring-island-header]');
|
|
266
|
+
if (handle?.parentElement === event.currentTarget) {
|
|
267
|
+
this.startInteraction(event, 'move');
|
|
268
|
+
}
|
|
269
|
+
};
|
|
146
270
|
render() {
|
|
147
271
|
const {
|
|
148
272
|
show,
|
|
@@ -156,7 +280,6 @@ class Dialog extends PureComponent {
|
|
|
156
280
|
contentClassName,
|
|
157
281
|
trapFocus,
|
|
158
282
|
'data-test': dataTest,
|
|
159
|
-
closeButtonInside,
|
|
160
283
|
portalTarget,
|
|
161
284
|
label,
|
|
162
285
|
closeButtonTitle,
|
|
@@ -165,15 +288,22 @@ class Dialog extends PureComponent {
|
|
|
165
288
|
native,
|
|
166
289
|
modal,
|
|
167
290
|
preventBodyScroll,
|
|
291
|
+
movable,
|
|
292
|
+
resizable,
|
|
293
|
+
autoFocusFirst,
|
|
294
|
+
focusBackOnClose,
|
|
295
|
+
focusBackOnExit,
|
|
296
|
+
trapDisabled,
|
|
168
297
|
...restProps
|
|
169
298
|
} = this.props;
|
|
170
299
|
const classes = classNames(styles.container, className);
|
|
171
300
|
const shortcutsMap = this.getShortcutsMap();
|
|
172
301
|
const content = /*#__PURE__*/jsxs(Fragment, {
|
|
173
302
|
children: [/*#__PURE__*/jsx(Shortcuts, {
|
|
303
|
+
disabled: !show,
|
|
174
304
|
map: shortcutsMap,
|
|
175
305
|
scope: this.state.shortcutsScope,
|
|
176
|
-
options:
|
|
306
|
+
options: shortcutOptions
|
|
177
307
|
}), (onOverlayClick !== noop || onCloseAttempt !== noop) && /*#__PURE__*/jsx("div", {
|
|
178
308
|
// click handler is duplicated in close button
|
|
179
309
|
role: "presentation",
|
|
@@ -181,37 +311,52 @@ class Dialog extends PureComponent {
|
|
|
181
311
|
onClick: this.handleClick,
|
|
182
312
|
"data-test": "ring-dialog-overlay"
|
|
183
313
|
}), /*#__PURE__*/jsx("div", {
|
|
184
|
-
|
|
314
|
+
ref: this.innerContainer,
|
|
315
|
+
"data-test": "ring-dialog-inner-container",
|
|
316
|
+
className: classNames(styles.innerContainer, {
|
|
317
|
+
[styles.resized]: this.state.resized
|
|
318
|
+
}),
|
|
319
|
+
style: this.state.geometry ? {
|
|
320
|
+
position: 'fixed',
|
|
321
|
+
left: this.state.geometry.left,
|
|
322
|
+
top: this.state.geometry.top,
|
|
323
|
+
width: this.state.resized ? this.state.geometry.width : undefined,
|
|
324
|
+
height: this.state.resized ? this.state.geometry.height : undefined
|
|
325
|
+
} : undefined,
|
|
185
326
|
children: /*#__PURE__*/jsxs(AdaptiveIsland, {
|
|
186
327
|
className: classNames(styles.content, contentClassName, {
|
|
187
328
|
[styles.dense]: dense,
|
|
188
|
-
[styles.
|
|
189
|
-
[styles.contentCloseButtonInside]: closeButtonInside
|
|
329
|
+
[styles.movable]: movable
|
|
190
330
|
}),
|
|
191
331
|
"data-test": "ring-dialog",
|
|
192
|
-
role:
|
|
193
|
-
"aria-label": label,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
332
|
+
role: native ? undefined : 'dialog',
|
|
333
|
+
"aria-label": native ? undefined : label,
|
|
334
|
+
onPointerDown: this.startMove,
|
|
335
|
+
onPointerMove: this.continueInteraction,
|
|
336
|
+
onPointerUp: this.stopInteraction,
|
|
337
|
+
onPointerCancel: this.stopInteraction,
|
|
338
|
+
onLostPointerCapture: this.stopInteraction,
|
|
339
|
+
children: [children, /*#__PURE__*/jsx(DialogControls, {
|
|
340
|
+
movable: movable,
|
|
341
|
+
resizable: resizable,
|
|
342
|
+
showCloseButton: showCloseButton,
|
|
343
|
+
closeButtonTitle: closeButtonTitle,
|
|
344
|
+
onCloseClick: this.onCloseClick,
|
|
345
|
+
onStartInteraction: this.startInteraction,
|
|
346
|
+
onStopInteraction: this.stopInteraction
|
|
207
347
|
})]
|
|
208
348
|
})
|
|
209
349
|
})]
|
|
210
350
|
});
|
|
211
351
|
if (native) {
|
|
212
352
|
return /*#__PURE__*/jsx("dialog", {
|
|
353
|
+
...restProps,
|
|
354
|
+
"aria-label": label,
|
|
213
355
|
className: classNames(styles.nativeDialog, className),
|
|
356
|
+
"data-test": joinDataTestAttributes('ring-dialog-container', dataTest),
|
|
214
357
|
ref: this.nativeDialog,
|
|
358
|
+
tabIndex: getNativeTabIndex(autoFocusFirst),
|
|
359
|
+
onCancel: event => event.preventDefault(),
|
|
215
360
|
"data-rg-modal-dialog-container": modal ? '' : undefined,
|
|
216
361
|
children: /*#__PURE__*/jsx(PopupTarget, {
|
|
217
362
|
id: this.uid,
|
|
@@ -238,7 +383,10 @@ class Dialog extends PureComponent {
|
|
|
238
383
|
id: this.uid,
|
|
239
384
|
className: styles.popupTarget,
|
|
240
385
|
children: target => /*#__PURE__*/jsxs(TabTrap, {
|
|
241
|
-
trapDisabled:
|
|
386
|
+
trapDisabled: getTrapDisabled(trapFocus, trapDisabled),
|
|
387
|
+
autoFocusFirst: autoFocusFirst,
|
|
388
|
+
focusBackOnClose: focusBackOnClose,
|
|
389
|
+
focusBackOnExit: focusBackOnExit,
|
|
242
390
|
"data-test": joinDataTestAttributes('ring-dialog-container', dataTest),
|
|
243
391
|
"data-rg-modal-dialog-container": "",
|
|
244
392
|
ref: this.dialogRef,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import 'react
|
|
1
|
+
import 'react/compiler-runtime';
|
|
2
2
|
import 'react';
|
|
3
3
|
import 'classnames';
|
|
4
4
|
import '../button/button.js';
|
|
@@ -6,12 +6,12 @@ export { A as default } from '../_helpers/anchor.js';
|
|
|
6
6
|
import 'react/jsx-runtime';
|
|
7
7
|
import '@jetbrains/icons/chevron-down';
|
|
8
8
|
import '@jetbrains/icons/chevron-12px-down';
|
|
9
|
-
import 'util-deprecate';
|
|
10
9
|
import '../icon/icon.js';
|
|
10
|
+
import 'util-deprecate';
|
|
11
11
|
import '../icon/icon.constants.js';
|
|
12
12
|
import '../_helpers/icon-svg.js';
|
|
13
|
-
import '../global/configuration.js';
|
|
14
13
|
import '../global/memoize.js';
|
|
15
14
|
import '../link/clickable-link.js';
|
|
16
15
|
import '../global/controls-height.js';
|
|
16
|
+
import '../global/configuration.js';
|
|
17
17
|
import '../_helpers/button.classes.js';
|
|
@@ -4,18 +4,18 @@ import joinDataTestAttributes from '../global/data-tests.js';
|
|
|
4
4
|
import { isArray } from '../global/typescript-utils.js';
|
|
5
5
|
import { s as styles, A as Anchor } from '../_helpers/anchor.js';
|
|
6
6
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
-
import 'react
|
|
7
|
+
import 'react/compiler-runtime';
|
|
8
8
|
import '../button/button.js';
|
|
9
9
|
import '@jetbrains/icons/chevron-down';
|
|
10
10
|
import '@jetbrains/icons/chevron-12px-down';
|
|
11
|
-
import 'util-deprecate';
|
|
12
11
|
import '../icon/icon.js';
|
|
12
|
+
import 'util-deprecate';
|
|
13
13
|
import '../icon/icon.constants.js';
|
|
14
14
|
import '../_helpers/icon-svg.js';
|
|
15
|
-
import '../global/configuration.js';
|
|
16
15
|
import '../global/memoize.js';
|
|
17
16
|
import '../link/clickable-link.js';
|
|
18
17
|
import '../global/controls-height.js';
|
|
18
|
+
import '../global/configuration.js';
|
|
19
19
|
import '../_helpers/button.classes.js';
|
|
20
20
|
|
|
21
21
|
class Dropdown extends Component {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactElement, type HTMLAttributes, type SyntheticEvent, type
|
|
1
|
+
import { type ReactElement, type HTMLAttributes, type SyntheticEvent, type ReactNode } from 'react';
|
|
2
2
|
import { type SelectHandlerParams } from '../list/list';
|
|
3
3
|
import { type AnchorProps, type DropdownAttrs, type DropdownChildrenFunction } from '../dropdown/dropdown';
|
|
4
4
|
import PopupMenu, { type PopupMenuAttrs } from '../popup-menu/popup-menu';
|
|
@@ -10,6 +10,7 @@ export interface DropdownAnchorWrapperProps extends AnchorProps {
|
|
|
10
10
|
}
|
|
11
11
|
type OnSelectHandler<T> = ((item: ListDataItem<T>, event: Event | SyntheticEvent, params?: SelectHandlerParams) => void) | undefined;
|
|
12
12
|
export interface DropdownMenuProps<T = unknown> extends Omit<DropdownAttrs, 'anchor' | 'onSelect' | 'children'> {
|
|
13
|
+
ref?: React.Ref<PopupMenu<T> | null>;
|
|
13
14
|
anchor: ReactElement | ReactNode[] | string | ((props: AnchorProps, ariaProps: HTMLAttributes<HTMLElement>) => ReactElement | null);
|
|
14
15
|
data?: readonly ListDataItem<T>[] | undefined;
|
|
15
16
|
ariaLabel?: string | null | undefined;
|
|
@@ -17,9 +18,8 @@ export interface DropdownMenuProps<T = unknown> extends Omit<DropdownAttrs, 'anc
|
|
|
17
18
|
menuProps?: PopupMenuAttrs<T> | null | undefined;
|
|
18
19
|
children?: DropdownChildrenFunction;
|
|
19
20
|
}
|
|
20
|
-
declare
|
|
21
|
-
|
|
22
|
-
}) => ReactElement | null) & {
|
|
21
|
+
declare function DropdownMenu<T = unknown>({ ref, id, anchor, ariaLabel, data, onSelect, menuProps, children, ...restDropdownProps }: DropdownMenuProps<T>): import("react").JSX.Element;
|
|
22
|
+
declare const _default: typeof DropdownMenu & {
|
|
23
23
|
ListProps: {
|
|
24
24
|
Type: typeof import("../list/consts").Type;
|
|
25
25
|
Dimension: {
|