@skbkontur/react-ui 6.0.8 → 6.1.0
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/CHANGELOG.md +26 -0
- package/components/Autocomplete/Autocomplete.js +15 -4
- package/components/Autocomplete/Autocomplete.js.map +1 -1
- package/components/Button/Button.d.ts +1 -1
- package/components/Button/Button.js +5 -4
- package/components/Button/Button.js.map +1 -1
- package/components/Calendar/CalendarDay.js +3 -0
- package/components/Calendar/CalendarDay.js.map +1 -1
- package/components/Calendar/DayCellView.styles.d.ts +1 -0
- package/components/Calendar/DayCellView.styles.js +6 -3
- package/components/Calendar/DayCellView.styles.js.map +1 -1
- package/components/DatePicker/MobilePicker.js +1 -1
- package/components/DatePicker/MobilePicker.js.map +1 -1
- package/components/DateRangePicker/DateRangePicker.js +1 -1
- package/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/components/FxInput/FxInputRestoreBtn.js +1 -1
- package/components/FxInput/FxInputRestoreBtn.js.map +1 -1
- package/components/Input/Input.d.ts +19 -1
- package/components/Input/Input.js +10 -3
- package/components/Input/Input.js.map +1 -1
- package/components/Input/InputLayout/InputLayout.d.ts +3 -1
- package/components/Input/InputLayout/InputLayout.js +5 -2
- package/components/Input/InputLayout/InputLayout.js.map +1 -1
- package/components/Input/InputLayout/InputLayout.styles.d.ts +6 -0
- package/components/Input/InputLayout/InputLayout.styles.js +19 -1
- package/components/Input/InputLayout/InputLayout.styles.js.map +1 -1
- package/components/Input/InputLayout/InputLayoutAside.d.ts +2 -0
- package/components/Input/InputLayout/InputLayoutAside.js +2 -2
- package/components/Input/InputLayout/InputLayoutAside.js.map +1 -1
- package/components/Input/InputLayout/InputLayoutAsideCounter.d.ts +11 -0
- package/components/Input/InputLayout/InputLayoutAsideCounter.js +74 -0
- package/components/Input/InputLayout/InputLayoutAsideCounter.js.map +1 -0
- package/components/Loader/Loader.d.ts +12 -4
- package/components/Loader/Loader.js +18 -7
- package/components/Loader/Loader.js.map +1 -1
- package/components/MenuItem/MenuItem.d.ts +1 -0
- package/components/MenuItem/MenuItem.js +17 -1
- package/components/MenuItem/MenuItem.js.map +1 -1
- package/components/MenuItem/MenuItem.styles.d.ts +3 -0
- package/components/MenuItem/MenuItem.styles.js +25 -16
- package/components/MenuItem/MenuItem.styles.js.map +1 -1
- package/components/Select/Select.js +11 -1
- package/components/Select/Select.js.map +1 -1
- package/components/SingleToast/SingleToast.d.ts +9 -6
- package/components/SingleToast/SingleToast.js +9 -6
- package/components/SingleToast/SingleToast.js.map +1 -1
- package/components/Spinner/Spinner.d.ts +23 -33
- package/components/Spinner/Spinner.js +23 -19
- package/components/Spinner/Spinner.js.map +1 -1
- package/components/Spinner/Spinner.styles.d.ts +0 -3
- package/components/Spinner/Spinner.styles.js +6 -15
- package/components/Spinner/Spinner.styles.js.map +1 -1
- package/components/Switcher/Switcher.js +1 -0
- package/components/Switcher/Switcher.js.map +1 -1
- package/components/Textarea/Textarea.js +1 -1
- package/components/Textarea/Textarea.js.map +1 -1
- package/components/Textarea/Textarea.styles.d.ts +1 -0
- package/components/Textarea/Textarea.styles.js +7 -4
- package/components/Textarea/Textarea.styles.js.map +1 -1
- package/components/Textarea/TextareaCounter.d.ts +2 -0
- package/components/Textarea/TextareaCounter.js +22 -4
- package/components/Textarea/TextareaCounter.js.map +1 -1
- package/components/Toast/Toast.d.ts +13 -14
- package/components/Toast/Toast.js +3 -3
- package/components/Toast/Toast.js.map +1 -1
- package/components/Toast/ToastView.d.ts +8 -5
- package/components/Toast/ToastView.js +28 -8
- package/components/Toast/ToastView.js.map +1 -1
- package/components/Toast/ToastView.styles.d.ts +7 -0
- package/components/Toast/ToastView.styles.js +30 -8
- package/components/Toast/ToastView.styles.js.map +1 -1
- package/components/TokenInput/TokenInput.d.ts +18 -2
- package/components/TokenInput/TokenInput.js +236 -79
- package/components/TokenInput/TokenInput.js.map +1 -1
- package/components/TokenInput/TokenInput.styles.d.ts +1 -0
- package/components/TokenInput/TokenInput.styles.js +12 -9
- package/components/TokenInput/TokenInput.styles.js.map +1 -1
- package/components/TokenInput/TokenInputMenu.d.ts +2 -1
- package/components/TokenInput/TokenInputMenu.js +1 -1
- package/components/TokenInput/TokenInputMenu.js.map +1 -1
- package/components/TokenInput/TokenInputMobileMenu.d.ts +25 -0
- package/components/TokenInput/TokenInputMobileMenu.js +40 -0
- package/components/TokenInput/TokenInputMobileMenu.js.map +1 -0
- package/components/TokenInput/TokenInputReducer.d.ts +2 -0
- package/components/TokenInput/TokenInputReducer.js +14 -0
- package/components/TokenInput/TokenInputReducer.js.map +1 -1
- package/components/Tooltip/Tooltip.d.ts +4 -0
- package/components/Tooltip/Tooltip.js +50 -11
- package/components/Tooltip/Tooltip.js.map +1 -1
- package/internal/CloseButtonIcon/CloseButtonIcon.js +1 -1
- package/internal/CloseButtonIcon/CloseButtonIcon.js.map +1 -1
- package/internal/CommonWrapper/CommonWrapper.js +5 -0
- package/internal/CommonWrapper/CommonWrapper.js.map +1 -1
- package/internal/CustomComboBox/ComboBoxMenu.js +1 -1
- package/internal/CustomComboBox/ComboBoxMenu.js.map +1 -1
- package/internal/CustomComboBox/ComboBoxView.js +13 -2
- package/internal/CustomComboBox/ComboBoxView.js.map +1 -1
- package/internal/InputLikeText/InputLikeText.d.ts +1 -1
- package/internal/InputLikeText/InputLikeText.js.map +1 -1
- package/internal/Menu/Menu.js +3 -0
- package/internal/Menu/Menu.js.map +1 -1
- package/internal/Menu/Menu.styles.d.ts +1 -0
- package/internal/Menu/Menu.styles.js +13 -10
- package/internal/Menu/Menu.styles.js.map +1 -1
- package/internal/MenuMessage/MenuMessage.js +17 -1
- package/internal/MenuMessage/MenuMessage.js.map +1 -1
- package/internal/MenuMessage/MenuMessage.styles.d.ts +3 -0
- package/internal/MenuMessage/MenuMessage.styles.js +13 -4
- package/internal/MenuMessage/MenuMessage.styles.js.map +1 -1
- package/internal/MobilePopup/MobilePopup.d.ts +8 -0
- package/internal/MobilePopup/MobilePopup.js +34 -11
- package/internal/MobilePopup/MobilePopup.js.map +1 -1
- package/internal/MobilePopup/MobilePopup.styles.d.ts +7 -0
- package/internal/MobilePopup/MobilePopup.styles.js +34 -10
- package/internal/MobilePopup/MobilePopup.styles.js.map +1 -1
- package/internal/MobilePopup/MobilePopupFooter/MobilePopupFooter.d.ts +8 -1
- package/internal/MobilePopup/MobilePopupFooter/MobilePopupFooter.js +18 -1
- package/internal/MobilePopup/MobilePopupFooter/MobilePopupFooter.js.map +1 -1
- package/internal/MobilePopup/MobilePopupFooter/MobilePopupFooter.styles.d.ts +3 -0
- package/internal/MobilePopup/MobilePopupFooter/MobilePopupFooter.styles.js +14 -4
- package/internal/MobilePopup/MobilePopupFooter/MobilePopupFooter.styles.js.map +1 -1
- package/internal/MobilePopup/MobilePopupHeader/MobilePopupHeader.d.ts +4 -0
- package/internal/MobilePopup/MobilePopupHeader/MobilePopupHeader.js +48 -11
- package/internal/MobilePopup/MobilePopupHeader/MobilePopupHeader.js.map +1 -1
- package/internal/MobilePopup/MobilePopupHeader/MobilePopupHeader.styles.d.ts +6 -0
- package/internal/MobilePopup/MobilePopupHeader/MobilePopupHeader.styles.js +28 -8
- package/internal/MobilePopup/MobilePopupHeader/MobilePopupHeader.styles.js.map +1 -1
- package/internal/Popup/Popup.d.ts +9 -3
- package/internal/Popup/Popup.js +117 -15
- package/internal/Popup/Popup.js.map +1 -1
- package/internal/Popup/Popup.styles.js +1 -1
- package/internal/Popup/Popup.styles.js.map +1 -1
- package/internal/Popup/PopupHelper.d.ts +4 -0
- package/internal/Popup/PopupHelper.js +8 -0
- package/internal/Popup/PopupHelper.js.map +1 -1
- package/internal/Popup/PopupPin.d.ts +19 -4
- package/internal/Popup/PopupPin.js +109 -8
- package/internal/Popup/PopupPin.js.map +1 -1
- package/internal/Popup/PopupPin.styles.d.ts +2 -0
- package/internal/Popup/PopupPin.styles.js +11 -5
- package/internal/Popup/PopupPin.styles.js.map +1 -1
- package/internal/SpinnerIcon/SpinnerIcon.d.ts +3 -3
- package/internal/SpinnerIcon/SpinnerIcon.js +4 -4
- package/internal/SpinnerIcon/SpinnerIcon.js.map +1 -1
- package/internal/icons2022/LoadingIcon.js +1 -1
- package/internal/icons2022/LoadingIcon.js.map +1 -1
- package/internal/icons2022/QuestionCircleIcon/QuestionCircleIcon16Light.d.ts +2 -0
- package/internal/icons2022/QuestionCircleIcon/QuestionCircleIcon16Light.js +21 -0
- package/internal/icons2022/QuestionCircleIcon/QuestionCircleIcon16Light.js.map +1 -0
- package/internal/icons2022/QuestionCircleIcon/QuestionCircleIcon20Regular.d.ts +2 -0
- package/internal/icons2022/QuestionCircleIcon/QuestionCircleIcon20Regular.js +21 -0
- package/internal/icons2022/QuestionCircleIcon/QuestionCircleIcon20Regular.js.map +1 -0
- package/internal/icons2022/QuestionCircleIcon/QuestionCircleIcon24Regular.d.ts +2 -0
- package/internal/icons2022/QuestionCircleIcon/QuestionCircleIcon24Regular.js +21 -0
- package/internal/icons2022/QuestionCircleIcon/QuestionCircleIcon24Regular.js.map +1 -0
- package/internal/themes/BasicTheme.d.ts +83 -4
- package/internal/themes/BasicTheme.js +186 -5
- package/internal/themes/BasicTheme.js.map +1 -1
- package/internal/themes/DarkTheme6_1.d.ts +1 -0
- package/internal/themes/DarkTheme6_1.js +41 -0
- package/internal/themes/DarkTheme6_1.js.map +1 -0
- package/internal/themes/LightTheme6_1.d.ts +1 -0
- package/internal/themes/LightTheme6_1.js +39 -0
- package/internal/themes/LightTheme6_1.js.map +1 -0
- package/lib/theming/themes/DarkTheme.d.ts +1 -0
- package/lib/theming/themes/DarkTheme.js +3 -1
- package/lib/theming/themes/DarkTheme.js.map +1 -1
- package/lib/theming/themes/LightTheme.d.ts +1 -0
- package/lib/theming/themes/LightTheme.js +3 -1
- package/lib/theming/themes/LightTheme.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,11 +5,21 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
5
5
|
import { memoizeGetStyles } from '../../../lib/theming/Emotion.js';
|
|
6
6
|
export var getJsStyles = memoizeGetStyles(function (_a) {
|
|
7
7
|
var css = _a.css;
|
|
8
|
-
return (
|
|
8
|
+
var rootBase6_1 = function (t) { return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n display: flex;\n flex-direction: column;\n background: ", ";\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n "], ["\n position: relative;\n display: flex;\n flex-direction: column;\n background: ", ";\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n "])), t.menuBgDefault, t.mobilePopupContainerBorderRadius, t.mobilePopupContainerBorderRadius); };
|
|
9
|
+
return {
|
|
9
10
|
root: function (t) {
|
|
10
|
-
return css(
|
|
11
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n display: flex;\n flex-direction: column;\n background: ", ";\n padding: ", ";\n "], ["\n position: relative;\n display: flex;\n flex-direction: column;\n background: ", ";\n padding: ", ";\n "])), t.menuBgDefault, t.mobilePopupFooterPadding);
|
|
11
12
|
},
|
|
12
|
-
|
|
13
|
+
rootSmall6_1: function (t) {
|
|
14
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", ";\n padding: ", ";\n "], ["\n ", ";\n padding: ", ";\n "])), rootBase6_1(t), t.mobilePopupFooterPaddingSmall);
|
|
15
|
+
},
|
|
16
|
+
rootMedium6_1: function (t) {
|
|
17
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", ";\n padding: ", ";\n "], ["\n ", ";\n padding: ", ";\n "])), rootBase6_1(t), t.mobilePopupFooterPaddingMedium);
|
|
18
|
+
},
|
|
19
|
+
rootLarge6_1: function (t) {
|
|
20
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", ";\n padding: ", ";\n "], ["\n ", ";\n padding: ", ";\n "])), rootBase6_1(t), t.mobilePopupFooterPaddingLarge);
|
|
21
|
+
},
|
|
22
|
+
};
|
|
13
23
|
});
|
|
14
|
-
var templateObject_1;
|
|
24
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
15
25
|
//# sourceMappingURL=MobilePopupFooter.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobilePopupFooter.styles.js","sourceRoot":"","sources":["../../../../internal/MobilePopup/MobilePopupFooter/MobilePopupFooter.styles.ts"],"names":[],"mappings":";;;;AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGnE,MAAM,CAAC,IAAM,WAAW,GAAG,gBAAgB,CAAC,UAAC,EAAgB;QAAd,GAAG,SAAA;
|
|
1
|
+
{"version":3,"file":"MobilePopupFooter.styles.js","sourceRoot":"","sources":["../../../../internal/MobilePopup/MobilePopupFooter/MobilePopupFooter.styles.ts"],"names":[],"mappings":";;;;AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGnE,MAAM,CAAC,IAAM,WAAW,GAAG,gBAAgB,CAAC,UAAC,EAAgB;QAAd,GAAG,SAAA;IAChD,IAAM,WAAW,GAAG,UAAC,CAAQ,IAAK,OAAA,GAAG,uPAAA,8FAIrB,EAAe,oCACA,EAAkC,qCACjC,EAAkC,OACjE,KAHe,CAAC,CAAC,aAAa,EACA,CAAC,CAAC,gCAAgC,EACjC,CAAC,CAAC,gCAAgC,GANhC,CAOjC,CAAC;IAEF,OAAO;QACL,IAAI,YAAC,CAAQ;YACX,OAAO,GAAG,sNAAA,8GAIM,EAAe,sBAClB,EAA0B,WACtC,KAFe,CAAC,CAAC,aAAa,EAClB,CAAC,CAAC,wBAAwB,EACrC;QACJ,CAAC;QAED,YAAY,YAAC,CAAQ;YACnB,OAAO,GAAG,oHAAA,YACN,EAAc,sBACL,EAA+B,WAC3C,KAFG,WAAW,CAAC,CAAC,CAAC,EACL,CAAC,CAAC,6BAA6B,EAC1C;QACJ,CAAC;QACD,aAAa,YAAC,CAAQ;YACpB,OAAO,GAAG,oHAAA,YACN,EAAc,sBACL,EAAgC,WAC5C,KAFG,WAAW,CAAC,CAAC,CAAC,EACL,CAAC,CAAC,8BAA8B,EAC3C;QACJ,CAAC;QACD,YAAY,YAAC,CAAQ;YACnB,OAAO,GAAG,oHAAA,YACN,EAAc,sBACL,EAA+B,WAC3C,KAFG,WAAW,CAAC,CAAC,CAAC,EACL,CAAC,CAAC,6BAA6B,EAC1C;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import type { Emotion } from '@emotion/css/create-instance';\n\nimport { memoizeGetStyles } from '../../../lib/theming/Emotion.js';\nimport type { Theme } from '../../../lib/theming/Theme.js';\n\nexport const getJsStyles = memoizeGetStyles(({ css }: Emotion) => {\n const rootBase6_1 = (t: Theme) => css`\n position: relative;\n display: flex;\n flex-direction: column;\n background: ${t.menuBgDefault};\n border-bottom-left-radius: ${t.mobilePopupContainerBorderRadius};\n border-bottom-right-radius: ${t.mobilePopupContainerBorderRadius};\n `;\n\n return {\n root(t: Theme) {\n return css`\n position: relative;\n display: flex;\n flex-direction: column;\n background: ${t.menuBgDefault};\n padding: ${t.mobilePopupFooterPadding};\n `;\n },\n\n rootSmall6_1(t: Theme) {\n return css`\n ${rootBase6_1(t)};\n padding: ${t.mobilePopupFooterPaddingSmall};\n `;\n },\n rootMedium6_1(t: Theme) {\n return css`\n ${rootBase6_1(t)};\n padding: ${t.mobilePopupFooterPaddingMedium};\n `;\n },\n rootLarge6_1(t: Theme) {\n return css`\n ${rootBase6_1(t)};\n padding: ${t.mobilePopupFooterPaddingLarge};\n `;\n },\n };\n});\n"]}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { SizeProp } from '../../../lib/types/props.js';
|
|
2
3
|
interface MobilePopupHeaderProps {
|
|
3
4
|
/**
|
|
4
5
|
* Заголовок шапки
|
|
5
6
|
*/
|
|
6
7
|
caption?: string;
|
|
8
|
+
size?: SizeProp;
|
|
7
9
|
}
|
|
8
10
|
export declare class MobilePopupHeader extends React.Component<React.PropsWithChildren<MobilePopupHeaderProps>> {
|
|
9
11
|
static __KONTUR_REACT_UI__: string;
|
|
@@ -14,5 +16,7 @@ export declare class MobilePopupHeader extends React.Component<React.PropsWithCh
|
|
|
14
16
|
private theme;
|
|
15
17
|
render(): React.JSX.Element;
|
|
16
18
|
private renderMain;
|
|
19
|
+
private getContainerClassName6_1;
|
|
20
|
+
private getRootSizeClassName6_1;
|
|
17
21
|
}
|
|
18
22
|
export {};
|
|
@@ -22,12 +22,36 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
22
22
|
import React from 'react';
|
|
23
23
|
import { withRenderEnvironment } from '../../../lib/renderEnvironment/index.js';
|
|
24
24
|
import { ThemeContext } from '../../../lib/theming/ThemeContext.js';
|
|
25
|
+
import { isThemeGTE } from '../../../lib/theming/ThemeHelpers.js';
|
|
25
26
|
import { isNonNullable } from '../../../lib/utils.js';
|
|
26
27
|
import { getJsStyles } from './MobilePopupHeader.styles.js';
|
|
27
28
|
var MobilePopupHeader = /** @class */ (function (_super) {
|
|
28
29
|
__extends(MobilePopupHeader, _super);
|
|
29
30
|
function MobilePopupHeader() {
|
|
30
|
-
|
|
31
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
32
|
+
_this.getContainerClassName6_1 = function () {
|
|
33
|
+
switch (_this.props.size) {
|
|
34
|
+
case 'large':
|
|
35
|
+
return _this.jsStyles.containerLarge6_1(_this.theme);
|
|
36
|
+
case 'medium':
|
|
37
|
+
return _this.jsStyles.containerMedium6_1(_this.theme);
|
|
38
|
+
case 'small':
|
|
39
|
+
default:
|
|
40
|
+
return _this.jsStyles.containerSmall6_1(_this.theme);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
_this.getRootSizeClassName6_1 = function () {
|
|
44
|
+
switch (_this.props.size) {
|
|
45
|
+
case 'large':
|
|
46
|
+
return _this.jsStyles.rootLarge6_1(_this.theme);
|
|
47
|
+
case 'medium':
|
|
48
|
+
return _this.jsStyles.rootMedium6_1(_this.theme);
|
|
49
|
+
case 'small':
|
|
50
|
+
default:
|
|
51
|
+
return _this.jsStyles.rootSmall6_1(_this.theme);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
return _this;
|
|
31
55
|
}
|
|
32
56
|
MobilePopupHeader.prototype.render = function () {
|
|
33
57
|
var _this = this;
|
|
@@ -38,17 +62,30 @@ var MobilePopupHeader = /** @class */ (function (_super) {
|
|
|
38
62
|
}));
|
|
39
63
|
};
|
|
40
64
|
MobilePopupHeader.prototype.renderMain = function () {
|
|
41
|
-
var _a, _b;
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
65
|
+
var _a, _b, _c;
|
|
66
|
+
var themeGTE6_1 = isThemeGTE(this.theme, '6.1');
|
|
67
|
+
var _d = this.props, caption = _d.caption, children = _d.children;
|
|
68
|
+
if (themeGTE6_1) {
|
|
69
|
+
if (!caption && (!children || !React.isValidElement(children))) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
return (React.createElement("div", { className: this.getRootSizeClassName6_1() },
|
|
73
|
+
React.createElement("div", { className: this.getContainerClassName6_1() },
|
|
74
|
+
caption && (React.createElement("div", { className: this.cx((_a = {},
|
|
75
|
+
_a[this.jsStyles.caption(this.theme)] = true,
|
|
76
|
+
_a[this.jsStyles.captionWithChildren()] = isNonNullable(children),
|
|
77
|
+
_a)) }, caption)),
|
|
78
|
+
React.isValidElement(children) && React.createElement("div", null, children))));
|
|
79
|
+
}
|
|
80
|
+
return (React.createElement("div", { className: this.cx((_b = {},
|
|
81
|
+
_b[this.jsStyles.root(this.theme)] = true,
|
|
82
|
+
_b[this.jsStyles.rootWithoutContent()] = !caption && !children,
|
|
83
|
+
_b)) },
|
|
47
84
|
React.createElement("div", { className: this.jsStyles.container() },
|
|
48
|
-
caption && (React.createElement("div", { className: this.cx((
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
85
|
+
caption && (React.createElement("div", { className: this.cx((_c = {},
|
|
86
|
+
_c[this.jsStyles.caption(this.theme)] = true,
|
|
87
|
+
_c[this.jsStyles.captionWithChildren()] = isNonNullable(children),
|
|
88
|
+
_c)) }, caption)),
|
|
52
89
|
React.isValidElement(children) && React.createElement("div", null, children))));
|
|
53
90
|
};
|
|
54
91
|
MobilePopupHeader.__KONTUR_REACT_UI__ = 'MobileMenuHeader';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobilePopupHeader.js","sourceRoot":"","sources":["../../../../internal/MobilePopup/MobilePopupHeader/MobilePopupHeader.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MobilePopupHeader.js","sourceRoot":"","sources":["../../../../internal/MobilePopup/MobilePopupHeader/MobilePopupHeader.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAW5D;IAAuC,qCAAgE;IAAvG;;QA0EU,8BAAwB,GAAG;YACjC,QAAQ,KAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;gBACxB,KAAK,OAAO;oBACV,OAAO,KAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,KAAI,CAAC,KAAK,CAAC,CAAC;gBACrD,KAAK,QAAQ;oBACX,OAAO,KAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,KAAI,CAAC,KAAK,CAAC,CAAC;gBACtD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iBAAiB;QAD7B,qBAAqB;OACT,iBAAiB,CAiG7B;IAAD,wBAAC;CAAA,AAjGD,CAAuC,KAAK,CAAC,SAAS,GAiGrD;SAjGY,iBAAiB","sourcesContent":["import type { Emotion } from '@emotion/css/create-instance';\nimport React from 'react';\nimport type { ReactElement } from 'react';\n\nimport { withRenderEnvironment } from '../../../lib/renderEnvironment/index.js';\nimport type { Theme } from '../../../lib/theming/Theme.js';\nimport { ThemeContext } from '../../../lib/theming/ThemeContext.js';\nimport { isThemeGTE } from '../../../lib/theming/ThemeHelpers.js';\nimport type { SizeProp } from '../../../lib/types/props.js';\nimport { isNonNullable } from '../../../lib/utils.js';\nimport { getJsStyles } from './MobilePopupHeader.styles.js';\n\ninterface MobilePopupHeaderProps {\n /**\n * Заголовок шапки\n */\n caption?: string;\n size?: SizeProp;\n}\n\n@withRenderEnvironment\nexport class MobilePopupHeader extends React.Component<React.PropsWithChildren<MobilePopupHeaderProps>> {\n public static __KONTUR_REACT_UI__ = 'MobileMenuHeader';\n public static displayName = 'MobileMenuHeader';\n\n private emotion!: Emotion;\n private cx!: Emotion['cx'];\n private jsStyles!: ReturnType<typeof getJsStyles>;\n private theme!: Theme;\n\n public render() {\n this.jsStyles = getJsStyles(this.emotion);\n\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n private renderMain(): ReactElement | null {\n const themeGTE6_1 = isThemeGTE(this.theme, '6.1');\n const { caption, children } = this.props;\n\n if (themeGTE6_1) {\n if (!caption && (!children || !React.isValidElement(children))) {\n return null;\n }\n\n return (\n <div className={this.getRootSizeClassName6_1()}>\n <div className={this.getContainerClassName6_1()}>\n {caption && (\n <div\n className={this.cx({\n [this.jsStyles.caption(this.theme)]: true,\n [this.jsStyles.captionWithChildren()]: isNonNullable(children),\n })}\n >\n {caption}\n </div>\n )}\n {React.isValidElement(children) && <div>{children}</div>}\n </div>\n </div>\n );\n }\n\n return (\n <div\n className={this.cx({\n [this.jsStyles.root(this.theme)]: true,\n [this.jsStyles.rootWithoutContent()]: !caption && !children,\n })}\n >\n <div className={this.jsStyles.container()}>\n {caption && (\n <div\n className={this.cx({\n [this.jsStyles.caption(this.theme)]: true,\n [this.jsStyles.captionWithChildren()]: isNonNullable(children),\n })}\n >\n {caption}\n </div>\n )}\n {React.isValidElement(children) && <div>{children}</div>}\n </div>\n </div>\n );\n }\n\n private getContainerClassName6_1 = (): string => {\n switch (this.props.size) {\n case 'large':\n return this.jsStyles.containerLarge6_1(this.theme);\n case 'medium':\n return this.jsStyles.containerMedium6_1(this.theme);\n case 'small':\n default:\n return this.jsStyles.containerSmall6_1(this.theme);\n }\n };\n\n private getRootSizeClassName6_1 = (): string => {\n switch (this.props.size) {\n case 'large':\n return this.jsStyles.rootLarge6_1(this.theme);\n case 'medium':\n return this.jsStyles.rootMedium6_1(this.theme);\n case 'small':\n default:\n return this.jsStyles.rootSmall6_1(this.theme);\n }\n };\n}\n"]}
|
|
@@ -3,6 +3,12 @@ export declare const getJsStyles: import("../../../lib/theming/Emotion.js").Styl
|
|
|
3
3
|
root(t: Theme): string;
|
|
4
4
|
rootWithoutContent(): string;
|
|
5
5
|
container(): string;
|
|
6
|
+
rootSmall6_1(t: Theme): string;
|
|
7
|
+
rootMedium6_1(t: Theme): string;
|
|
8
|
+
rootLarge6_1(t: Theme): string;
|
|
9
|
+
containerSmall6_1(t: Theme): string;
|
|
10
|
+
containerMedium6_1(t: Theme): string;
|
|
11
|
+
containerLarge6_1(t: Theme): string;
|
|
6
12
|
caption(t: Theme): string;
|
|
7
13
|
captionWithChildren(): string;
|
|
8
14
|
}>;
|
|
@@ -5,23 +5,43 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
5
5
|
import { memoizeGetStyles } from '../../../lib/theming/Emotion.js';
|
|
6
6
|
export var getJsStyles = memoizeGetStyles(function (_a) {
|
|
7
7
|
var css = _a.css;
|
|
8
|
-
return (
|
|
8
|
+
var rootBase6_1 = function (t) { return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n background: ", ";\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n "], ["\n position: relative;\n background: ", ";\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n "])), t.menuBgDefault, t.mobilePopupContainerBorderRadius, t.mobilePopupContainerBorderRadius); };
|
|
9
|
+
var containerBase6_1 = function () { return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n "], ["\n display: flex;\n flex-direction: column;\n "]))); };
|
|
10
|
+
return {
|
|
9
11
|
root: function (t) {
|
|
10
|
-
return css(
|
|
12
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n padding: ", ";\n "], ["\n position: relative;\n padding: ", ";\n "])), t.mobilePopupHeaderPadding);
|
|
11
13
|
},
|
|
12
14
|
rootWithoutContent: function () {
|
|
13
|
-
return css(
|
|
15
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding: 8px 0 0 0;\n "], ["\n padding: 8px 0 0 0;\n "])));
|
|
14
16
|
},
|
|
15
17
|
container: function () {
|
|
16
|
-
return css(
|
|
18
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n "], ["\n display: flex;\n flex-direction: column;\n "])));
|
|
19
|
+
},
|
|
20
|
+
rootSmall6_1: function (t) {
|
|
21
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", ";\n padding-top: ", ";\n "], ["\n ", ";\n padding-top: ", ";\n "])), rootBase6_1(t), t.mobilePopupPaddingSmall);
|
|
22
|
+
},
|
|
23
|
+
rootMedium6_1: function (t) {
|
|
24
|
+
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n ", ";\n padding-top: ", ";\n "], ["\n ", ";\n padding-top: ", ";\n "])), rootBase6_1(t), t.mobilePopupPaddingMedium);
|
|
25
|
+
},
|
|
26
|
+
rootLarge6_1: function (t) {
|
|
27
|
+
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n ", ";\n padding-top: ", ";\n "], ["\n ", ";\n padding-top: ", ";\n "])), rootBase6_1(t), t.mobilePopupPaddingLarge);
|
|
28
|
+
},
|
|
29
|
+
containerSmall6_1: function (t) {
|
|
30
|
+
return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n ", ";\n padding: ", ";\n "], ["\n ", ";\n padding: ", ";\n "])), containerBase6_1(), t.mobilePopupHeaderPaddingSmall);
|
|
31
|
+
},
|
|
32
|
+
containerMedium6_1: function (t) {
|
|
33
|
+
return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n ", ";\n padding: ", ";\n "], ["\n ", ";\n padding: ", ";\n "])), containerBase6_1(), t.mobilePopupHeaderPaddingMedium);
|
|
34
|
+
},
|
|
35
|
+
containerLarge6_1: function (t) {
|
|
36
|
+
return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n ", ";\n padding: ", ";\n "], ["\n ", ";\n padding: ", ";\n "])), containerBase6_1(), t.mobilePopupHeaderPaddingLarge);
|
|
17
37
|
},
|
|
18
38
|
caption: function (t) {
|
|
19
|
-
return css(
|
|
39
|
+
return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n "], ["\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n "])), t.mobilePopupHeaderFontSize, t.mobilePopupHeaderLineHeight, t.mobilePopupHeaderFontWeight, t.textColorDefault);
|
|
20
40
|
},
|
|
21
41
|
captionWithChildren: function () {
|
|
22
|
-
return css(
|
|
42
|
+
return css(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n padding-bottom: 8px;\n "], ["\n padding-bottom: 8px;\n "])));
|
|
23
43
|
},
|
|
24
|
-
}
|
|
44
|
+
};
|
|
25
45
|
});
|
|
26
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
46
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13;
|
|
27
47
|
//# sourceMappingURL=MobilePopupHeader.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobilePopupHeader.styles.js","sourceRoot":"","sources":["../../../../internal/MobilePopup/MobilePopupHeader/MobilePopupHeader.styles.ts"],"names":[],"mappings":";;;;AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGnE,MAAM,CAAC,IAAM,WAAW,GAAG,gBAAgB,CAAC,UAAC,EAAgB;QAAd,GAAG,SAAA;
|
|
1
|
+
{"version":3,"file":"MobilePopupHeader.styles.js","sourceRoot":"","sources":["../../../../internal/MobilePopup/MobilePopupHeader/MobilePopupHeader.styles.ts"],"names":[],"mappings":";;;;AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGnE,MAAM,CAAC,IAAM,WAAW,GAAG,gBAAgB,CAAC,UAAC,EAAgB;QAAd,GAAG,SAAA;IAChD,IAAM,WAAW,GAAG,UAAC,CAAQ,IAAK,OAAA,GAAG,gMAAA,6CAErB,EAAe,iCACH,EAAkC,kCACjC,EAAkC,OAC9D,KAHe,CAAC,CAAC,aAAa,EACH,CAAC,CAAC,gCAAgC,EACjC,CAAC,CAAC,gCAAgC,GAJ7B,CAKjC,CAAC;IAEF,IAAM,gBAAgB,GAAG,cAAM,OAAA,GAAG,0HAAA,uDAGjC,MAH8B,CAG9B,CAAC;IAEF,OAAO;QACL,IAAI,YAAC,CAAQ;YACX,OAAO,GAAG,kIAAA,kDAEG,EAA0B,WACtC,KADY,CAAC,CAAC,wBAAwB,EACrC;QACJ,CAAC;QAED,kBAAkB;YAChB,OAAO,GAAG,0GAAA,uCAET,KAAC;QACJ,CAAC;QAED,SAAS;YACP,OAAO,GA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;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import type { Emotion } from '@emotion/css/create-instance';\n\nimport { memoizeGetStyles } from '../../../lib/theming/Emotion.js';\nimport type { Theme } from '../../../lib/theming/Theme.js';\n\nexport const getJsStyles = memoizeGetStyles(({ css }: Emotion) => {\n const rootBase6_1 = (t: Theme) => css`\n position: relative;\n background: ${t.menuBgDefault};\n border-top-left-radius: ${t.mobilePopupContainerBorderRadius};\n border-top-right-radius: ${t.mobilePopupContainerBorderRadius};\n `;\n\n const containerBase6_1 = () => css`\n display: flex;\n flex-direction: column;\n `;\n\n return {\n root(t: Theme) {\n return css`\n position: relative;\n padding: ${t.mobilePopupHeaderPadding};\n `;\n },\n\n rootWithoutContent() {\n return css`\n padding: 8px 0 0 0;\n `;\n },\n\n container() {\n return css`\n display: flex;\n flex-direction: column;\n `;\n },\n\n rootSmall6_1(t: Theme) {\n return css`\n ${rootBase6_1(t)};\n padding-top: ${t.mobilePopupPaddingSmall};\n `;\n },\n\n rootMedium6_1(t: Theme) {\n return css`\n ${rootBase6_1(t)};\n padding-top: ${t.mobilePopupPaddingMedium};\n `;\n },\n\n rootLarge6_1(t: Theme) {\n return css`\n ${rootBase6_1(t)};\n padding-top: ${t.mobilePopupPaddingLarge};\n `;\n },\n\n containerSmall6_1(t: Theme) {\n return css`\n ${containerBase6_1()};\n padding: ${t.mobilePopupHeaderPaddingSmall};\n `;\n },\n\n containerMedium6_1(t: Theme) {\n return css`\n ${containerBase6_1()};\n padding: ${t.mobilePopupHeaderPaddingMedium};\n `;\n },\n\n containerLarge6_1(t: Theme) {\n return css`\n ${containerBase6_1()};\n padding: ${t.mobilePopupHeaderPaddingLarge};\n `;\n },\n\n caption(t: Theme) {\n return css`\n font-size: ${t.mobilePopupHeaderFontSize};\n line-height: ${t.mobilePopupHeaderLineHeight};\n font-weight: ${t.mobilePopupHeaderFontWeight};\n color: ${t.textColorDefault};\n `;\n },\n\n captionWithChildren() {\n return css`\n padding-bottom: 8px;\n `;\n },\n };\n});\n"]}
|
|
@@ -56,9 +56,8 @@ export interface PopupProps extends Omit<CommonProps, 'children'>, PopupHandlerP
|
|
|
56
56
|
*/
|
|
57
57
|
pinOffset?: number;
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* до "носика" пина будет соответствовать формуле (size* √3)/2
|
|
59
|
+
* Высота пина в px. Ширина основания = 2 × size (для top/bottom).
|
|
60
|
+
* Значения по размерам: small 8, medium 10, large 12.
|
|
62
61
|
*/
|
|
63
62
|
pinSize?: number;
|
|
64
63
|
/**
|
|
@@ -116,6 +115,7 @@ interface PopupLocation {
|
|
|
116
115
|
};
|
|
117
116
|
position: PopupPositionsType;
|
|
118
117
|
isFullyVisible: boolean;
|
|
118
|
+
pinOffset: number;
|
|
119
119
|
}
|
|
120
120
|
export interface PopupState {
|
|
121
121
|
location: Nullable<PopupLocation>;
|
|
@@ -189,6 +189,12 @@ export declare class Popup extends React.Component<PopupProps, PopupState> {
|
|
|
189
189
|
private tryReuseCurrentLocation;
|
|
190
190
|
private tryGetFirstFullyVisibleLocation;
|
|
191
191
|
private getFallbackLocation;
|
|
192
|
+
private getMobileVerticalFallbackLocation;
|
|
193
|
+
private buildLocationForPosition;
|
|
194
|
+
private getViewportSidePadding;
|
|
195
|
+
private getMobileMaxWidth;
|
|
196
|
+
private applyMobileViewportPadding;
|
|
197
|
+
private normalizeCoordinates;
|
|
192
198
|
private pickBestFallbackPosition;
|
|
193
199
|
private evaluateFallbackCandidate;
|
|
194
200
|
private pickBestAreaCandidate;
|
package/internal/Popup/Popup.js
CHANGED
|
@@ -91,6 +91,7 @@ export var DUMMY_LOCATION = {
|
|
|
91
91
|
left: -9999,
|
|
92
92
|
},
|
|
93
93
|
isFullyVisible: false,
|
|
94
|
+
pinOffset: 0,
|
|
94
95
|
};
|
|
95
96
|
export var PopupDataTids = {
|
|
96
97
|
root: 'Popup__root',
|
|
@@ -190,7 +191,9 @@ var Popup = /** @class */ (function (_super) {
|
|
|
190
191
|
_this.state.location !== null && _this.setState({ location: null });
|
|
191
192
|
};
|
|
192
193
|
_this.refPopupContentElement = function (element) {
|
|
193
|
-
|
|
194
|
+
if (element) {
|
|
195
|
+
_this.lastPopupContentElement = element;
|
|
196
|
+
}
|
|
194
197
|
};
|
|
195
198
|
_this.handleLayoutEvent = function () {
|
|
196
199
|
if (!_this.state.location) {
|
|
@@ -208,7 +211,8 @@ var Popup = /** @class */ (function (_super) {
|
|
|
208
211
|
if (location) {
|
|
209
212
|
(_b = (_a = _this.props).onPositionChange) === null || _b === void 0 ? void 0 : _b.call(_a, location.position, location.isFullyVisible);
|
|
210
213
|
}
|
|
211
|
-
|
|
214
|
+
var stateChanged = !_this.locationEquals(_this.state.location, location);
|
|
215
|
+
if (stateChanged) {
|
|
212
216
|
_this.setState({ location: location });
|
|
213
217
|
}
|
|
214
218
|
};
|
|
@@ -358,7 +362,7 @@ var Popup = /** @class */ (function (_super) {
|
|
|
358
362
|
var relativeShift = this.getRelativeShift();
|
|
359
363
|
var direction = PopupHelper.getPositionObject(location.position).direction;
|
|
360
364
|
var rootStyle = {
|
|
361
|
-
maxWidth: maxWidth,
|
|
365
|
+
maxWidth: this.getMobileMaxWidth(maxWidth),
|
|
362
366
|
top: location.coordinates.top + relativeShift.top,
|
|
363
367
|
left: location.coordinates.left + relativeShift.left,
|
|
364
368
|
};
|
|
@@ -375,7 +379,9 @@ var Popup = /** @class */ (function (_super) {
|
|
|
375
379
|
_b[_this.styles.transitionExit()] = state === 'exiting',
|
|
376
380
|
_b)))), style: rootStyle, onMouseEnter: _this.handleMouseEnter, onMouseLeave: _this.handleMouseLeave },
|
|
377
381
|
_this.content(children),
|
|
378
|
-
|
|
382
|
+
location !== DUMMY_LOCATION &&
|
|
383
|
+
(!_this.isMobileLayout || _this.props.withoutMobile) &&
|
|
384
|
+
_this.renderPin(location.position))));
|
|
379
385
|
}));
|
|
380
386
|
};
|
|
381
387
|
Popup.prototype.renderChildren = function () {
|
|
@@ -407,7 +413,10 @@ var Popup = /** @class */ (function (_super) {
|
|
|
407
413
|
if (isNullable(x) || isNullable(y)) {
|
|
408
414
|
return false;
|
|
409
415
|
}
|
|
410
|
-
return (x.coordinates.left === y.coordinates.left &&
|
|
416
|
+
return (x.coordinates.left === y.coordinates.left &&
|
|
417
|
+
x.coordinates.top === y.coordinates.top &&
|
|
418
|
+
x.position === y.position &&
|
|
419
|
+
x.pinOffset === y.pinOffset);
|
|
411
420
|
};
|
|
412
421
|
Popup.prototype.getOrderedPositions = function () {
|
|
413
422
|
var positions = this.props.positions ? this.props.positions : PopupPinnablePositions;
|
|
@@ -452,8 +461,16 @@ var Popup = /** @class */ (function (_super) {
|
|
|
452
461
|
}
|
|
453
462
|
var position = location.position;
|
|
454
463
|
var coordinates = this.getCoordinates(anchorRect, popupRect, position);
|
|
455
|
-
var
|
|
456
|
-
|
|
464
|
+
var locationAfterPadding = this.applyMobileViewportPadding({
|
|
465
|
+
coordinates: coordinates,
|
|
466
|
+
position: position,
|
|
467
|
+
isFullyVisible: PopupHelper.isFullyVisible(coordinates, popupRect, this.globalObject),
|
|
468
|
+
pinOffset: 0,
|
|
469
|
+
}, popupRect);
|
|
470
|
+
var isFullyVisible = locationAfterPadding.isFullyVisible;
|
|
471
|
+
var canBecomeVisible = !this.isMobileLayout &&
|
|
472
|
+
!isFullyVisible &&
|
|
473
|
+
PopupHelper.canBecomeFullyVisible(position, coordinates, this.globalObject);
|
|
457
474
|
var shouldReuseCurrentLocation =
|
|
458
475
|
// если нужно сохранить первоначальную позицию и Попап целиком
|
|
459
476
|
// находится в пределах вьюпорта (или может быть проскроллен в него)
|
|
@@ -464,27 +481,108 @@ var Popup = /** @class */ (function (_super) {
|
|
|
464
481
|
if (!shouldReuseCurrentLocation) {
|
|
465
482
|
return null;
|
|
466
483
|
}
|
|
467
|
-
return {
|
|
484
|
+
return __assign(__assign({}, locationAfterPadding), { isFullyVisible: isFullyVisible || canBecomeVisible });
|
|
468
485
|
};
|
|
469
486
|
Popup.prototype.tryGetFirstFullyVisibleLocation = function (positions, anchorRect, popupRect) {
|
|
470
487
|
for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
|
|
471
488
|
var position = positions_1[_i];
|
|
472
489
|
var coordinates = this.getCoordinates(anchorRect, popupRect, position);
|
|
473
|
-
|
|
474
|
-
|
|
490
|
+
var isFullyVisible = PopupHelper.isFullyVisible(coordinates, popupRect, this.globalObject);
|
|
491
|
+
if (!this.isMobileLayout && isFullyVisible) {
|
|
492
|
+
return { coordinates: coordinates, position: position, isFullyVisible: true, pinOffset: 0 };
|
|
493
|
+
}
|
|
494
|
+
if (this.isMobileLayout) {
|
|
495
|
+
var location_1 = this.buildLocationForPosition(position, anchorRect, popupRect);
|
|
496
|
+
if (location_1.isFullyVisible) {
|
|
497
|
+
return location_1;
|
|
498
|
+
}
|
|
475
499
|
}
|
|
476
500
|
}
|
|
477
501
|
return null;
|
|
478
502
|
};
|
|
479
503
|
Popup.prototype.getFallbackLocation = function (positions, anchorRect, popupRect, tryBestFallbackPosition) {
|
|
504
|
+
if (this.isMobileLayout) {
|
|
505
|
+
var mobileFallback = this.getMobileVerticalFallbackLocation(positions, anchorRect, popupRect);
|
|
506
|
+
if (mobileFallback) {
|
|
507
|
+
return mobileFallback;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
480
510
|
var position = tryBestFallbackPosition
|
|
481
511
|
? this.pickBestFallbackPosition(positions, anchorRect, popupRect)
|
|
482
512
|
: positions[0];
|
|
483
513
|
var coordinates = this.getCoordinates(anchorRect, popupRect, position);
|
|
484
|
-
return {
|
|
514
|
+
return this.applyMobileViewportPadding({
|
|
485
515
|
coordinates: coordinates,
|
|
486
516
|
position: position,
|
|
487
517
|
isFullyVisible: PopupHelper.isFullyVisible(coordinates, popupRect, this.globalObject),
|
|
518
|
+
pinOffset: 0,
|
|
519
|
+
}, popupRect);
|
|
520
|
+
};
|
|
521
|
+
Popup.prototype.getMobileVerticalFallbackLocation = function (positions, anchorRect, popupRect) {
|
|
522
|
+
var _this = this;
|
|
523
|
+
var _a;
|
|
524
|
+
var isFullyVisible = function (position) {
|
|
525
|
+
return _this.buildLocationForPosition(position, anchorRect, popupRect).isFullyVisible;
|
|
526
|
+
};
|
|
527
|
+
var topPosition = positions.find(function (position) { return position.startsWith('top') && isFullyVisible(position); });
|
|
528
|
+
if (topPosition) {
|
|
529
|
+
return this.buildLocationForPosition(topPosition, anchorRect, popupRect);
|
|
530
|
+
}
|
|
531
|
+
var bottomPosition = positions.find(function (position) { return position.startsWith('bottom') && isFullyVisible(position); });
|
|
532
|
+
if (bottomPosition) {
|
|
533
|
+
return this.buildLocationForPosition(bottomPosition, anchorRect, popupRect);
|
|
534
|
+
}
|
|
535
|
+
var fallbackPosition = (_a = positions.find(function (position) { return position.startsWith('bottom'); })) !== null && _a !== void 0 ? _a : positions.find(function (position) { return position.startsWith('top'); });
|
|
536
|
+
if (!fallbackPosition) {
|
|
537
|
+
return null;
|
|
538
|
+
}
|
|
539
|
+
return this.buildLocationForPosition(fallbackPosition, anchorRect, popupRect);
|
|
540
|
+
};
|
|
541
|
+
Popup.prototype.buildLocationForPosition = function (position, anchorRect, popupRect) {
|
|
542
|
+
var coordinates = this.getCoordinates(anchorRect, popupRect, position);
|
|
543
|
+
return this.applyMobileViewportPadding({
|
|
544
|
+
coordinates: coordinates,
|
|
545
|
+
position: position,
|
|
546
|
+
isFullyVisible: false,
|
|
547
|
+
pinOffset: 0,
|
|
548
|
+
}, popupRect);
|
|
549
|
+
};
|
|
550
|
+
Popup.prototype.getViewportSidePadding = function () {
|
|
551
|
+
return PopupHelper.getPopupViewportSidePadding(this.theme, this.isMobileLayout);
|
|
552
|
+
};
|
|
553
|
+
Popup.prototype.getMobileMaxWidth = function (maxWidth) {
|
|
554
|
+
var viewportSidePadding = this.getViewportSidePadding();
|
|
555
|
+
if (this.isMobileLayout && isNullable(maxWidth) && viewportSidePadding > 0) {
|
|
556
|
+
return "calc(100dvw - ".concat(viewportSidePadding * 2, "px)");
|
|
557
|
+
}
|
|
558
|
+
return maxWidth;
|
|
559
|
+
};
|
|
560
|
+
Popup.prototype.applyMobileViewportPadding = function (location, popupRect) {
|
|
561
|
+
if (!this.isMobileLayout || this.getViewportSidePadding() === 0) {
|
|
562
|
+
return location;
|
|
563
|
+
}
|
|
564
|
+
var _a = this.normalizeCoordinates(location.coordinates, popupRect), coordinates = _a.coordinates, pinOffset = _a.pinOffset;
|
|
565
|
+
return __assign(__assign({}, location), { coordinates: coordinates, pinOffset: pinOffset, isFullyVisible: PopupHelper.isFullyVisible(coordinates, popupRect, this.globalObject) });
|
|
566
|
+
};
|
|
567
|
+
Popup.prototype.normalizeCoordinates = function (coordinates, popupRect) {
|
|
568
|
+
var viewportSidePadding = this.getViewportSidePadding();
|
|
569
|
+
var normalizedLeft = coordinates.left;
|
|
570
|
+
var pinOffset = 0;
|
|
571
|
+
var viewport = PopupHelper.getViewportAbsoluteRect(this.globalObject);
|
|
572
|
+
var popupRight = normalizedLeft + popupRect.width;
|
|
573
|
+
var distanceToLeft = normalizedLeft - viewport.left;
|
|
574
|
+
var distanceToRight = viewport.left + viewport.width - popupRight;
|
|
575
|
+
if (distanceToLeft < viewportSidePadding) {
|
|
576
|
+
normalizedLeft = viewport.left + viewportSidePadding;
|
|
577
|
+
pinOffset = normalizedLeft - coordinates.left;
|
|
578
|
+
}
|
|
579
|
+
else if (distanceToRight < viewportSidePadding) {
|
|
580
|
+
normalizedLeft = viewport.left + viewport.width - viewportSidePadding - popupRect.width;
|
|
581
|
+
pinOffset = normalizedLeft - coordinates.left;
|
|
582
|
+
}
|
|
583
|
+
return {
|
|
584
|
+
coordinates: __assign(__assign({}, coordinates), { left: Math.round(normalizedLeft) }),
|
|
585
|
+
pinOffset: pinOffset,
|
|
488
586
|
};
|
|
489
587
|
};
|
|
490
588
|
Popup.prototype.pickBestFallbackPosition = function (positions, anchorRect, popupRect) {
|
|
@@ -578,7 +676,7 @@ var Popup = /** @class */ (function (_super) {
|
|
|
578
676
|
}
|
|
579
677
|
var anchorSize = /top|bottom/.test(position.direction) ? anchorRect.width : anchorRect.height;
|
|
580
678
|
var pinSize = this.props.pinSize;
|
|
581
|
-
return Math.max(0, this.getPinOffset(position.align) + (pinSize || parseInt(this.theme.popupPinSize)) - anchorSize / 2);
|
|
679
|
+
return Math.max(0, this.getPinOffset(position.align, false) + (pinSize || parseInt(this.theme.popupPinSize)) - anchorSize / 2);
|
|
582
680
|
};
|
|
583
681
|
Popup.prototype.getCoordinates = function (anchorRect, popupRect, positionName) {
|
|
584
682
|
var marginFromProps = this.props.margin;
|
|
@@ -619,19 +717,23 @@ var Popup = /** @class */ (function (_super) {
|
|
|
619
717
|
return getDefaultCoordinates();
|
|
620
718
|
}
|
|
621
719
|
};
|
|
622
|
-
Popup.prototype.getPinOffset = function (align) {
|
|
720
|
+
Popup.prototype.getPinOffset = function (align, useLocationPinOffset) {
|
|
721
|
+
var _a, _b;
|
|
722
|
+
if (useLocationPinOffset === void 0) { useLocationPinOffset = true; }
|
|
623
723
|
var pinOffset = this.props.pinOffset;
|
|
624
724
|
var defaultPinOffset = pinOffset || parseInt(this.theme.popupPinOffsetY);
|
|
725
|
+
var pinOffsetFromState = useLocationPinOffset && this.isMobileLayout ? ((_b = (_a = this.state.location) === null || _a === void 0 ? void 0 : _a.pinOffset) !== null && _b !== void 0 ? _b : 0) : 0;
|
|
625
726
|
switch (align) {
|
|
626
727
|
case 'top':
|
|
627
728
|
case 'bottom':
|
|
628
729
|
return defaultPinOffset;
|
|
629
730
|
case 'left':
|
|
731
|
+
return (pinOffset || parseInt(this.theme.popupPinOffsetX)) + pinOffsetFromState;
|
|
630
732
|
case 'right':
|
|
631
|
-
return pinOffset || parseInt(this.theme.popupPinOffsetX);
|
|
733
|
+
return (pinOffset || parseInt(this.theme.popupPinOffsetX)) + pinOffsetFromState;
|
|
632
734
|
case 'center':
|
|
633
735
|
case 'middle':
|
|
634
|
-
return
|
|
736
|
+
return -pinOffsetFromState;
|
|
635
737
|
default:
|
|
636
738
|
warning(false, "Unexpected align '".concat(align, "'. Must be one of - 'top', 'bottom', 'left', 'right', 'center', 'middle'. Returning default value."));
|
|
637
739
|
return defaultPinOffset;
|