urfu-ui-kit-react 2.1.7-next.3 → 2.1.7-next.5
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/dist/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/components/Accordion/Accordion.js +16 -15
- package/dist/components/BreadCrumbs/BreadCrumbs.d.ts.map +1 -1
- package/dist/components/BreadCrumbs/BreadCrumbs.js +23 -22
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +51 -50
- package/dist/components/Button/ButtonRefreshIcon.d.ts.map +1 -1
- package/dist/components/Button/ButtonRefreshIcon.js +9 -8
- package/dist/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.js +237 -216
- package/dist/components/Calendar/Calendar.types.d.ts +19 -0
- package/dist/components/Calendar/Calendar.types.d.ts.map +1 -1
- package/dist/components/Calendar/CalendarSelect.d.ts.map +1 -1
- package/dist/components/Calendar/CalendarSelect.js +41 -40
- package/dist/components/Card/Card.d.ts.map +1 -1
- package/dist/components/Card/Card.js +59 -58
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.js +20 -19
- package/dist/components/ColumnSettings/ColumnSettings.d.ts.map +1 -1
- package/dist/components/ColumnSettings/ColumnSettings.js +112 -111
- package/dist/components/ConfirmModal/ConfirmModal.d.ts.map +1 -1
- package/dist/components/ConfirmModal/ConfirmModal.js +30 -29
- package/dist/components/Drawer/Drawer.js +57 -57
- package/dist/components/ErrorScreen/ErrorScreen.d.ts.map +1 -1
- package/dist/components/ErrorScreen/ErrorScreen.js +151 -150
- package/dist/components/ErrorScreen/ErrorScreenIllustration.d.ts.map +1 -1
- package/dist/components/ErrorScreen/ErrorScreenIllustration.js +35 -34
- package/dist/components/FormField/FormField.d.ts.map +1 -1
- package/dist/components/FormField/FormField.js +30 -29
- package/dist/components/Icon/Icon.d.ts.map +1 -1
- package/dist/components/Icon/Icon.js +17 -16
- package/dist/components/InfiniteScroll/InfiniteScroll.d.ts.map +1 -1
- package/dist/components/InfiniteScroll/InfiniteScroll.js +23 -22
- package/dist/components/InputExpandTextarea/InputExpandTextarea.d.ts.map +1 -1
- package/dist/components/InputExpandTextarea/InputExpandTextarea.js +88 -87
- package/dist/components/InputFile/InputFile.d.ts.map +1 -1
- package/dist/components/InputFile/InputFile.js +99 -98
- package/dist/components/InputNumber/InputNumber.d.ts.map +1 -1
- package/dist/components/InputNumber/InputNumber.js +112 -111
- package/dist/components/InputText/InputAffix.d.ts.map +1 -1
- package/dist/components/InputText/InputAffix.js +69 -68
- package/dist/components/InputText/InputText.d.ts.map +1 -1
- package/dist/components/InputText/InputText.js +108 -107
- package/dist/components/InputTime/InputTime.d.ts.map +1 -1
- package/dist/components/InputTime/InputTime.js +202 -201
- package/dist/components/InputTime/InputTimeDropdown.d.ts.map +1 -1
- package/dist/components/InputTime/InputTimeDropdown.js +21 -20
- package/dist/components/Menu/Menu.d.ts.map +1 -1
- package/dist/components/Menu/Menu.js +58 -57
- package/dist/components/Message/Message.d.ts.map +1 -1
- package/dist/components/Message/Message.js +19 -18
- package/dist/components/Modal/Modal.js +66 -66
- package/dist/components/Modal/useModalTitleClearance.d.ts.map +1 -1
- package/dist/components/Modal/useModalTitleClearance.js +34 -33
- package/dist/components/Multiselect/Multiselect.js +222 -222
- package/dist/components/Notification/Notification.js +90 -90
- package/dist/components/OfflineBanner/OfflineBanner.d.ts.map +1 -1
- package/dist/components/OfflineBanner/OfflineBanner.js +40 -37
- package/dist/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/components/Pagination/Pagination.js +59 -58
- package/dist/components/Preloader/Preloader.d.ts.map +1 -1
- package/dist/components/Preloader/Preloader.js +28 -27
- package/dist/components/Radio/Radio.d.ts.map +1 -1
- package/dist/components/Radio/Radio.js +21 -20
- package/dist/components/Search/Search.d.ts.map +1 -1
- package/dist/components/Search/Search.js +33 -32
- package/dist/components/SearchSelect/SearchSelect.d.ts.map +1 -1
- package/dist/components/SearchSelect/SearchSelect.js +176 -166
- package/dist/components/SearchSelect/SearchSelectOption.d.ts.map +1 -1
- package/dist/components/SearchSelect/SearchSelectOption.js +21 -20
- package/dist/components/Select/MobileOptionSheet.d.ts.map +1 -1
- package/dist/components/Select/MobileOptionSheet.js +65 -64
- package/dist/components/Select/Select.js +184 -184
- package/dist/components/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/components/Skeleton/Skeleton.js +26 -25
- package/dist/components/Status/Status.d.ts.map +1 -1
- package/dist/components/Status/Status.js +36 -35
- package/dist/components/StickyActionBar/StickyActionBar.d.ts.map +1 -1
- package/dist/components/StickyActionBar/StickyActionBar.js +36 -35
- package/dist/components/Switch/Switch.d.ts.map +1 -1
- package/dist/components/Switch/Switch.js +19 -18
- package/dist/components/Table/Filter/DefaultInput.d.ts.map +1 -1
- package/dist/components/Table/Filter/DefaultInput.js +12 -11
- package/dist/components/Table/Filter/Filter.d.ts.map +1 -1
- package/dist/components/Table/Filter/Filter.js +99 -98
- package/dist/components/Table/Filter/FilterBooleanBox.d.ts.map +1 -1
- package/dist/components/Table/Filter/FilterBooleanBox.js +7 -6
- package/dist/components/Table/Filter/FilterBoxShell.js +48 -48
- package/dist/components/Table/Filter/FilterDateBox.d.ts.map +1 -1
- package/dist/components/Table/Filter/FilterDateBox.js +65 -64
- package/dist/components/Table/Filter/FilterSortIndicator.d.ts.map +1 -1
- package/dist/components/Table/Filter/FilterSortIndicator.js +8 -7
- package/dist/components/Table/Filter/SelectFilter.js +53 -53
- package/dist/components/Table/Filter/TableFilterOptions.d.ts.map +1 -1
- package/dist/components/Table/Filter/TableFilterOptions.js +141 -140
- package/dist/components/Table/Filter/TableFilterSortButton.d.ts.map +1 -1
- package/dist/components/Table/Filter/TableFilterSortButton.js +10 -9
- package/dist/components/Table/Filter/useVirtualOptionWindow.d.ts.map +1 -1
- package/dist/components/Table/Filter/useVirtualOptionWindow.js +9 -8
- package/dist/components/Table/Skeleton/createSkeletonColumns.d.ts.map +1 -1
- package/dist/components/Table/Skeleton/createSkeletonColumns.js +9 -8
- package/dist/components/Table/Table.d.ts.map +1 -1
- package/dist/components/Table/Table.helpers.d.ts.map +1 -1
- package/dist/components/Table/Table.helpers.js +31 -30
- package/dist/components/Table/Table.js +253 -252
- package/dist/components/Table/TableHead.d.ts.map +1 -1
- package/dist/components/Table/TableHead.js +92 -91
- package/dist/components/Table/TableMobileCard.d.ts.map +1 -1
- package/dist/components/Table/TableMobileCard.js +121 -120
- package/dist/components/Table/TableMobileFilters.d.ts.map +1 -1
- package/dist/components/Table/TableMobileFilters.js +28 -27
- package/dist/components/Table/TableMobileView.d.ts.map +1 -1
- package/dist/components/Table/TableMobileView.js +178 -177
- package/dist/components/Table/TableRow.d.ts.map +1 -1
- package/dist/components/Table/TableRow.js +59 -58
- package/dist/components/Table/useTableColumnPinning.d.ts +2 -917
- package/dist/components/Table/useTableColumnPinning.d.ts.map +1 -1
- package/dist/components/Table/useTableColumnPinning.js +21 -20
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.js +101 -99
- package/dist/components/Tabs/distributeTabs.d.ts +7 -3
- package/dist/components/Tabs/distributeTabs.d.ts.map +1 -1
- package/dist/components/Tabs/useTabsOverflow.d.ts +4 -0
- package/dist/components/Tabs/useTabsOverflow.d.ts.map +1 -1
- package/dist/components/Tabs/useTabsOverflow.js +40 -41
- package/dist/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.js +70 -69
- package/dist/components/Tooltip/Tooltip.js +106 -106
- package/dist/components/TreeView/TreeView.js +183 -183
- package/dist/components/VirtualList/VirtualList.d.ts.map +1 -1
- package/dist/components/VirtualList/VirtualList.js +42 -41
- package/dist/dev/index.js +2 -2
- package/dist/hooks/useAutoId.d.ts.map +1 -1
- package/dist/hooks/useAutoId.js +7 -6
- package/dist/hooks/useSelectEngine.d.ts.map +1 -1
- package/dist/hooks/useSelectEngine.js +31 -30
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/responsive/uiKitResponsive.d.ts +6 -0
- package/dist/responsive/uiKitResponsive.d.ts.map +1 -1
- package/dist/responsive/uiKitResponsive.js +27 -26
- package/dist/shared/kitCopy.js +1 -1
- package/dist/shared/optionStateColors.d.ts +3 -2
- package/dist/shared/optionStateColors.d.ts.map +1 -1
- package/dist/shared/optionStateColors.js +9 -4
- package/dist/shared/popupTransition.d.ts.map +1 -1
- package/dist/shared/popupTransition.js +7 -6
- package/dist/shared/sheetTitle.d.ts +2 -1
- package/dist/shared/sheetTitle.d.ts.map +1 -1
- package/dist/shared/size.d.ts.map +1 -1
- package/dist/shared/size.js +3 -2
- package/dist/shared/uiKitDefaults.d.ts +21 -0
- package/dist/shared/uiKitDefaults.d.ts.map +1 -1
- package/dist/shared/uiKitDefaults.js +32 -18
- package/dist/style-no-fonts.css +1 -1
- package/dist/style.css +1 -1
- package/dist/style.layer.css +2 -2
- package/dist/style.shell.css +2 -2
- package/dist/style.shell.lk.css +53 -0
- package/dist/urfu-ui-kit-react.js +29 -27
- package/dist/vanilla/core/dateLimits.js +21 -0
- package/dist/vanilla/core/describeError.js +1 -1
- package/dist/vanilla/core/distributeTabs.js +36 -23
- package/dist/vanilla/core/sheetTitle.js +7 -7
- package/package.json +3 -1
|
@@ -1,101 +1,102 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
1
|
+
import { jsx as r, Fragment as B, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as C, useEffect as b, useState as D } from "react";
|
|
3
3
|
/* empty css */
|
|
4
|
-
import { useAutoId$u as
|
|
4
|
+
import { useAutoId$u as F } from "../../hooks/useAutoId.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
import { kitCls$u as i, kitClasses$u as O, getUiKitPrefix$u as R } from "../../shared/uiKitDefaults.js";
|
|
7
|
+
import { isPlainLeftClick$u as q } from "../../vanilla/core/linkClick.js";
|
|
8
|
+
const S = ({
|
|
9
|
+
onClickSection: o,
|
|
10
|
+
onClickSwitchMenu: s,
|
|
11
|
+
showMenu: a,
|
|
12
|
+
menuData: x,
|
|
13
|
+
activeSection: m,
|
|
14
|
+
type: g = "collapsible",
|
|
15
|
+
paddingUl: w = "32px 16px 32px 14px",
|
|
16
|
+
className: y = "",
|
|
17
|
+
foldedWidth: $ = "1px",
|
|
18
|
+
statisticsCard: v,
|
|
19
|
+
maxWidth: N,
|
|
20
|
+
minWidth: k,
|
|
21
|
+
overlayMaxWidth: l = 1100,
|
|
22
|
+
LinkComponent: d,
|
|
22
23
|
id: E
|
|
23
24
|
}) => {
|
|
24
|
-
const
|
|
25
|
+
const u = C(null), p = F(E, i("collapsible-menu")), L = d, P = (e) => typeof e == "number" ? `${e}px` : String(e), f = (e) => {
|
|
25
26
|
if (e == null) return;
|
|
26
27
|
if (typeof e == "number")
|
|
27
28
|
return `calc(${e} * var(--u-unit, 1px))`;
|
|
28
29
|
const t = String(e).trim(), n = t.match(/^(-?\d+(?:\.\d+)?)px$/i);
|
|
29
30
|
return n ? `calc(${n[1]} * var(--u-unit, 1px))` : t;
|
|
30
31
|
}, I = (e) => e && e.replaceAll(/(-?\d+(?:\.\d+)?)px\b/gi, (t, n) => `calc(${n} * var(--u-unit, 1px))`);
|
|
31
|
-
|
|
32
|
-
if (
|
|
32
|
+
b(() => {
|
|
33
|
+
if (a || typeof s != "function") return;
|
|
33
34
|
const e = (t) => {
|
|
34
35
|
var c;
|
|
35
|
-
if (!window.matchMedia(`(max-width: ${
|
|
36
|
+
if (!window.matchMedia(`(max-width: ${l}px)`).matches) return;
|
|
36
37
|
const n = t.target;
|
|
37
|
-
n && ((c =
|
|
38
|
+
n && ((c = u.current) != null && c.contains(n) || s(!0));
|
|
38
39
|
};
|
|
39
40
|
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
40
|
-
}, [
|
|
41
|
-
const [
|
|
42
|
-
() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia(`(max-width: ${
|
|
41
|
+
}, [s, a, l]);
|
|
42
|
+
const [U, j] = D(
|
|
43
|
+
() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia(`(max-width: ${l}px)`).matches : !1
|
|
43
44
|
);
|
|
44
|
-
|
|
45
|
+
b(() => {
|
|
45
46
|
if (typeof window > "u" || typeof window.matchMedia != "function") return;
|
|
46
|
-
const e = window.matchMedia(`(max-width: ${
|
|
47
|
+
const e = window.matchMedia(`(max-width: ${l}px)`), t = () => j(e.matches);
|
|
47
48
|
return t(), e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
48
|
-
}, [
|
|
49
|
-
const A =
|
|
50
|
-
return /* @__PURE__ */
|
|
49
|
+
}, [l]);
|
|
50
|
+
const A = U ? i("collapsible-menu--overlay") : "";
|
|
51
|
+
return /* @__PURE__ */ r(B, { children: g === "collapsible" && /* @__PURE__ */ h(
|
|
51
52
|
"div",
|
|
52
53
|
{
|
|
53
|
-
ref:
|
|
54
|
+
ref: u,
|
|
54
55
|
style: {
|
|
55
56
|
height: "100%",
|
|
56
|
-
"--max-width":
|
|
57
|
+
"--max-width": P($),
|
|
57
58
|
width: "100%"
|
|
58
59
|
},
|
|
59
|
-
className:
|
|
60
|
+
className: `${R()}-collapsible-menu ${A} ${y}`.trim(),
|
|
60
61
|
children: [
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ r(
|
|
62
63
|
"input",
|
|
63
64
|
{
|
|
64
|
-
className: "
|
|
65
|
+
className: i("collapsible-menu-input"),
|
|
65
66
|
type: "checkbox",
|
|
66
|
-
name: "
|
|
67
|
-
id:
|
|
68
|
-
checked:
|
|
69
|
-
onChange: (e) =>
|
|
67
|
+
name: i("collapsible-menu"),
|
|
68
|
+
id: p,
|
|
69
|
+
checked: a,
|
|
70
|
+
onChange: (e) => s(e.target.checked)
|
|
70
71
|
}
|
|
71
72
|
),
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */ r("label", { className: i("collapsible-menu-toggle"), htmlFor: p }),
|
|
74
|
+
/* @__PURE__ */ h(
|
|
74
75
|
"div",
|
|
75
76
|
{
|
|
76
|
-
className: "
|
|
77
|
+
className: i("collapsible-menu-body"),
|
|
77
78
|
style: {
|
|
78
79
|
height: "100%",
|
|
79
|
-
"--max-width-body":
|
|
80
|
+
"--max-width-body": f(N)
|
|
80
81
|
},
|
|
81
82
|
children: [
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ r(
|
|
83
84
|
"ul",
|
|
84
85
|
{
|
|
85
|
-
className: "
|
|
86
|
-
style: { padding: I(
|
|
87
|
-
children:
|
|
88
|
-
const n =
|
|
89
|
-
return /* @__PURE__ */
|
|
86
|
+
className: i("collapsible-menu-list"),
|
|
87
|
+
style: { padding: I(w), minWidth: f(k) },
|
|
88
|
+
children: x.map((e, t) => {
|
|
89
|
+
const n = m == e.id ? "page" : void 0;
|
|
90
|
+
return /* @__PURE__ */ r(
|
|
90
91
|
"li",
|
|
91
92
|
{
|
|
92
|
-
className:
|
|
93
|
+
className: m == e.id ? O("collapsible-menu-list-item", "menu-active") : i("collapsible-menu-list-item"),
|
|
93
94
|
id: String(e.id),
|
|
94
|
-
onClick: (c) =>
|
|
95
|
-
children:
|
|
95
|
+
onClick: (c) => o && q(c) && o(e),
|
|
96
|
+
children: d ? /* @__PURE__ */ r(L, { to: e.url, className: i("collapsible-menu-list-item-link"), "aria-current": n, children: e.title }) : /* @__PURE__ */ r(
|
|
96
97
|
"a",
|
|
97
98
|
{
|
|
98
|
-
className: "
|
|
99
|
+
className: i("collapsible-menu-list-item-link"),
|
|
99
100
|
href: e.url,
|
|
100
101
|
"aria-current": n,
|
|
101
102
|
children: e.title
|
|
@@ -107,7 +108,7 @@ const H = ({
|
|
|
107
108
|
})
|
|
108
109
|
}
|
|
109
110
|
),
|
|
110
|
-
|
|
111
|
+
v
|
|
111
112
|
]
|
|
112
113
|
}
|
|
113
114
|
)
|
|
@@ -115,4 +116,4 @@ const H = ({
|
|
|
115
116
|
}
|
|
116
117
|
) });
|
|
117
118
|
};
|
|
118
|
-
export {
|
|
119
|
+
export { S as Menu$u };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../src/components/Message/Message.tsx"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../src/components/Message/Message.tsx"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAGnD,eAAO,MAAM,OAAO,GAAI,wCAKrB,iBAAiB,4CA2BnB,CAAA"}
|
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
2
|
/* empty css */
|
|
3
3
|
/* empty css */
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
import { kitCls$u as s } from "../../shared/uiKitDefaults.js";
|
|
5
|
+
const f = ({
|
|
6
|
+
size: a = "medium",
|
|
7
|
+
variant: e = "info",
|
|
8
|
+
children: m,
|
|
9
|
+
className: r = ""
|
|
10
|
+
}) => /* @__PURE__ */ c("div", { className: `${((i, l) => {
|
|
11
|
+
switch (`${i}-${l}`) {
|
|
11
12
|
case "medium-info":
|
|
12
|
-
return "
|
|
13
|
+
return s("message");
|
|
13
14
|
case "medium-fail":
|
|
14
|
-
return "
|
|
15
|
+
return s("message-fail");
|
|
15
16
|
case "medium-success":
|
|
16
|
-
return "
|
|
17
|
+
return s("message-success");
|
|
17
18
|
case "medium-warning":
|
|
18
|
-
return "
|
|
19
|
+
return s("message-warning");
|
|
19
20
|
case "small-info":
|
|
20
|
-
return "
|
|
21
|
+
return s("message-small");
|
|
21
22
|
case "small-fail":
|
|
22
|
-
return "
|
|
23
|
+
return s("message-small-fail");
|
|
23
24
|
case "small-success":
|
|
24
|
-
return "
|
|
25
|
+
return s("message-small-success");
|
|
25
26
|
case "small-warning":
|
|
26
|
-
return "
|
|
27
|
+
return s("message-small-warning");
|
|
27
28
|
}
|
|
28
|
-
})(
|
|
29
|
-
export {
|
|
29
|
+
})(a, e)} ${r}`, role: e === "fail" || e === "warning" ? "alert" : void 0, children: m });
|
|
30
|
+
export { f as Message$u };
|
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { useMountTransition$u as
|
|
1
|
+
import { jsx as a, jsxs as H } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as L, useState as R, useInsertionEffect as U, useLayoutEffect as z, useEffect as c } from "react";
|
|
3
|
+
import { createPortal as O } from "react-dom";
|
|
4
|
+
import { useMountTransition$u as q } from "../../hooks/useMountTransition.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
import { useModalFocus$u as
|
|
7
|
-
import { isEditorPopupTarget$u as
|
|
8
|
-
import { useModalTitleClearance$u as
|
|
6
|
+
import { useModalFocus$u as B, ModalFocusContext$u as G, isTopModal$u as J } from "./useModalFocus.js";
|
|
7
|
+
import { isEditorPopupTarget$u as Q } from "./editorFocus.js";
|
|
8
|
+
import { useModalTitleClearance$u as V } from "./useModalTitleClearance.js";
|
|
9
9
|
/* empty css */
|
|
10
10
|
/* empty css */
|
|
11
11
|
/* empty css */
|
|
12
12
|
/* empty css */
|
|
13
|
-
import { getPortalScopeProps$u as
|
|
14
|
-
import { MOTION_EASE$u as
|
|
15
|
-
import { lockKitScroll$u as
|
|
16
|
-
const
|
|
17
|
-
onCancel:
|
|
18
|
-
active:
|
|
13
|
+
import { kitCls$u as l, getUiKitPrefix$u as d, kitClasses$u as W, getPortalScopeProps$u as X, getUiKitDefaults$u as Y } from "../../shared/uiKitDefaults.js";
|
|
14
|
+
import { MOTION_EASE$u as Z, motionMs$u as ee, MOTION_MS$u as v } from "../../vanilla/core/motion.js";
|
|
15
|
+
import { lockKitScroll$u as oe, ownKitNode$u as te, isKitEventHandled$u as re, markKitEventHandled$u as se } from "../../vanilla/core/kitRegistry.js";
|
|
16
|
+
const Me = ({
|
|
17
|
+
onCancel: i,
|
|
18
|
+
active: o,
|
|
19
19
|
ariaLabel: N,
|
|
20
|
-
ariaLabelledBy:
|
|
21
|
-
children:
|
|
20
|
+
ariaLabelledBy: f,
|
|
21
|
+
children: p,
|
|
22
22
|
maxWidth: _ = "900px",
|
|
23
|
-
maxHeight:
|
|
23
|
+
maxHeight: P,
|
|
24
24
|
className: w = "",
|
|
25
|
-
height:
|
|
26
|
-
notCloseClickOnBack:
|
|
25
|
+
height: K = "",
|
|
26
|
+
notCloseClickOnBack: y,
|
|
27
27
|
closeOnEscape: S,
|
|
28
|
-
closeButtonInside:
|
|
29
|
-
lockScroll:
|
|
28
|
+
closeButtonInside: b = !1,
|
|
29
|
+
lockScroll: g = !1,
|
|
30
30
|
unmountOnClose: T = !1,
|
|
31
31
|
portalOn: s = !0,
|
|
32
|
-
trapFocus:
|
|
33
|
-
initialFocus:
|
|
34
|
-
mobileSheet:
|
|
32
|
+
trapFocus: C = !0,
|
|
33
|
+
initialFocus: A = "first",
|
|
34
|
+
mobileSheet: j
|
|
35
35
|
}) => {
|
|
36
|
-
const
|
|
36
|
+
const E = j ?? Y().mobileSheets, n = L(null), [e] = R(
|
|
37
37
|
() => typeof document > "u" ? null : document.createElement("div")
|
|
38
38
|
);
|
|
39
|
-
|
|
40
|
-
if (!(!s || !
|
|
41
|
-
return
|
|
42
|
-
}, [s,
|
|
43
|
-
if (!s || !
|
|
44
|
-
const t =
|
|
45
|
-
if (t ?
|
|
39
|
+
U(() => {
|
|
40
|
+
if (!(!s || !e))
|
|
41
|
+
return e.className = "u-react-modal-portal", document.body.appendChild(e), () => e.remove();
|
|
42
|
+
}, [s, e]), z(() => {
|
|
43
|
+
if (!s || !e) return;
|
|
44
|
+
const t = X()["data-u-kit"];
|
|
45
|
+
if (t ? e.setAttribute("data-u-kit", t) : e.removeAttribute("data-u-kit"), o) {
|
|
46
46
|
const r = document.activeElement;
|
|
47
|
-
document.body.appendChild(
|
|
47
|
+
document.body.appendChild(e), r instanceof HTMLElement && e.contains(r) && r.focus({ preventScroll: !0 });
|
|
48
48
|
}
|
|
49
|
-
}, [
|
|
50
|
-
const { shouldRender:
|
|
51
|
-
isOpen: !!
|
|
52
|
-
duration:
|
|
53
|
-
}),
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
57
|
-
if (!
|
|
49
|
+
}, [o, s, e]);
|
|
50
|
+
const { shouldRender: h, status: D, isAnimated: I } = q({
|
|
51
|
+
isOpen: !!o,
|
|
52
|
+
duration: E ? v.base : v.fast
|
|
53
|
+
}), u = I && D === "exiting", M = !!o || u, $ = u ? { opacity: 0, transition: `opacity ${ee("fast")}ms ${Z.exit}` } : null, { scope: m, onFocusCapture: F } = B(n, !!o, C, A);
|
|
54
|
+
V(n, M, f, p, b);
|
|
55
|
+
const x = S ?? !y;
|
|
56
|
+
if (c(() => {
|
|
57
|
+
if (!o || !x || typeof i != "function") return;
|
|
58
58
|
const t = (r) => {
|
|
59
|
-
r.key !== "Escape" || r.defaultPrevented ||
|
|
59
|
+
r.key !== "Escape" || r.defaultPrevented || re(r) || !J(m) || Q(n.current, r.target) || (se(r), i(r));
|
|
60
60
|
};
|
|
61
61
|
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
62
|
-
}, [
|
|
63
|
-
if (!(!
|
|
64
|
-
return
|
|
65
|
-
}, [
|
|
66
|
-
const t =
|
|
67
|
-
return t ?
|
|
68
|
-
}, [
|
|
69
|
-
const
|
|
62
|
+
}, [o, x, i, m]), c(() => {
|
|
63
|
+
if (!(!o || !g))
|
|
64
|
+
return oe();
|
|
65
|
+
}, [o, g]), c(() => {
|
|
66
|
+
const t = n.current;
|
|
67
|
+
return t ? te(t) : void 0;
|
|
68
|
+
}, [h, s]), T && !h) return null;
|
|
69
|
+
const k = /* @__PURE__ */ a(G.Provider, { value: m, children: /* @__PURE__ */ a(
|
|
70
70
|
"div",
|
|
71
71
|
{
|
|
72
|
-
className: `${
|
|
72
|
+
className: `${M ? W("modal", "modal-active") : l("modal")}${E ? ` ${d()}-react-modal-sheet` : ""}${u ? ` ${d()}-react-modal-closing` : ""} ${w}`,
|
|
73
73
|
style: { backgroundColor: "unset" },
|
|
74
|
-
onMouseDown:
|
|
75
|
-
} :
|
|
76
|
-
children: /* @__PURE__ */ a("div", { className: "
|
|
74
|
+
onMouseDown: y ? () => {
|
|
75
|
+
} : i,
|
|
76
|
+
children: /* @__PURE__ */ a("div", { className: l("modal__container"), style: Object.assign({ backgroundColor: `var(--${d()}-modal-overlay, #0006)` }, $), children: /* @__PURE__ */ H(
|
|
77
77
|
"div",
|
|
78
78
|
{
|
|
79
|
-
className:
|
|
80
|
-
ref:
|
|
79
|
+
className: `${d()}-modal__body${b ? ` ${d()}-modal__body--close-inside` : ""}`,
|
|
80
|
+
ref: n,
|
|
81
81
|
tabIndex: -1,
|
|
82
|
-
onFocusCapture:
|
|
82
|
+
onFocusCapture: F,
|
|
83
83
|
role: "dialog",
|
|
84
84
|
"aria-label": N,
|
|
85
|
-
"aria-labelledby":
|
|
86
|
-
"aria-modal":
|
|
87
|
-
"aria-hidden": !
|
|
85
|
+
"aria-labelledby": f,
|
|
86
|
+
"aria-modal": o || void 0,
|
|
87
|
+
"aria-hidden": !o || void 0,
|
|
88
88
|
onMouseDown: (t) => {
|
|
89
89
|
t.stopPropagation();
|
|
90
90
|
},
|
|
91
91
|
style: Object.assign(
|
|
92
|
-
{ width: "100%", maxWidth: _, height:
|
|
93
|
-
|
|
92
|
+
{ width: "100%", maxWidth: _, height: K, maxHeight: P, zIndex: 1001 },
|
|
93
|
+
$
|
|
94
94
|
),
|
|
95
95
|
children: [
|
|
96
|
-
|
|
97
|
-
/* @__PURE__ */ a("div", { className: "
|
|
96
|
+
p,
|
|
97
|
+
/* @__PURE__ */ a("div", { className: l("modal__exit"), children: /* @__PURE__ */ a("button", { className: l("button-cross"), onClick: i, "aria-label": "Закрыть" }) })
|
|
98
98
|
]
|
|
99
99
|
}
|
|
100
100
|
) })
|
|
101
101
|
}
|
|
102
102
|
) });
|
|
103
|
-
return !s || !
|
|
103
|
+
return !s || !e ? k : O(k, e);
|
|
104
104
|
};
|
|
105
|
-
export {
|
|
105
|
+
export { Me as Modal$u };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModalTitleClearance.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/useModalTitleClearance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useModalTitleClearance.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/useModalTitleClearance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAiClD,oEAAoE;AACpE,eAAO,MAAM,sBAAsB,GAC/B,SAAS,SAAS,CAAC,cAAc,CAAC,EAClC,QAAQ,OAAO,EACf,YAAY,MAAM,GAAG,SAAS,EAC9B,UAAU,SAAS,EACnB,mBAAmB,OAAO,SAiE7B,CAAC"}
|
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
import { useLayoutEffect as v } from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import { getUiKitPrefix$u as i } from "../../shared/uiKitDefaults.js";
|
|
3
|
+
const F = (c, f, h, $, x) => {
|
|
4
|
+
var o, y, p;
|
|
5
|
+
const t = c.ownerDocument.defaultView, a = t == null ? void 0 : t.getComputedStyle(c), e = f.top + (Number.parseFloat((a == null ? void 0 : a.borderTopWidth) ?? "") || 0) + (Number.parseFloat((a == null ? void 0 : a.paddingTop) ?? "") || 0), r = Math.max(0, h - e + $), l = (y = (o = c.ownerDocument).createRange) == null ? void 0 : y.call(o);
|
|
6
|
+
l == null || l.selectNodeContents(c);
|
|
7
|
+
const m = [...((p = l == null ? void 0 : l.getClientRects) == null ? void 0 : p.call(l)) ?? []].filter((s) => s.width > 0 || s.height > 0).map((s) => (s.top + s.bottom) / 2 + x / 2);
|
|
8
|
+
if (m.length === 0) return r;
|
|
9
|
+
const g = Math.max(...m) - e;
|
|
10
|
+
if (r <= g) return r;
|
|
11
|
+
const d = c.nextElementSibling, n = Math.max(
|
|
11
12
|
0,
|
|
12
13
|
Number.parseFloat((a == null ? void 0 : a.marginBottom) ?? "") || 0,
|
|
13
14
|
d && t && Number.parseFloat(t.getComputedStyle(d).marginTop) || 0
|
|
14
15
|
);
|
|
15
|
-
return Math.min(
|
|
16
|
-
}, A = (
|
|
16
|
+
return Math.min(r, Math.max(g, h - e - n));
|
|
17
|
+
}, A = (c, f, h, $, x) => {
|
|
17
18
|
v(() => {
|
|
18
|
-
const t =
|
|
19
|
-
if (!
|
|
20
|
-
const e = (
|
|
21
|
-
if (!e || !
|
|
22
|
-
t.setAttribute(
|
|
23
|
-
let
|
|
24
|
-
const
|
|
25
|
-
const o = e.getBoundingClientRect(),
|
|
19
|
+
const t = c.current;
|
|
20
|
+
if (!f || !t) return;
|
|
21
|
+
const e = (h ?? "").split(/\s+/).map((o) => t.ownerDocument.getElementById(o)).find((o) => (o == null ? void 0 : o.closest(`.${i()}-modal__body`)) === t) ?? [...t.querySelectorAll("h1, h2, h3, h4, h5, h6")].find((o) => o.closest(`.${i()}-modal__body`) === t), r = t.querySelector(`:scope > .${i()}-modal__exit > button`), l = t.ownerDocument.defaultView;
|
|
22
|
+
if (!e || !r || !l || ["flex", "inline-flex", "grid", "inline-grid"].includes(l.getComputedStyle(e).display)) return;
|
|
23
|
+
t.setAttribute(`data-${i()}-modal-has-title`, "");
|
|
24
|
+
let m = 0;
|
|
25
|
+
const g = () => {
|
|
26
|
+
const o = e.getBoundingClientRect(), y = r.getBoundingClientRect(), p = t.getBoundingClientRect(), s = l.getComputedStyle(e), w = Number.parseFloat(s.lineHeight) || (Number.parseFloat(s.fontSize) || 16) * 1.2, C = t.offsetWidth > 0 && p.width > 0 ? p.width / t.offsetWidth : 1;
|
|
26
27
|
t.style.setProperty(
|
|
27
|
-
|
|
28
|
-
`${(o.top -
|
|
28
|
+
`--${i()}-modal-title-close-top`,
|
|
29
|
+
`${(o.top - p.top - y.height / 2) / C + w / 2}px`
|
|
29
30
|
);
|
|
30
|
-
const u =
|
|
31
|
-
u.left < o.right +
|
|
32
|
-
|
|
33
|
-
`${Math.min(o.width, Math.max(0, o.right - u.left +
|
|
31
|
+
const u = r.getBoundingClientRect(), b = Number.parseFloat(l.getComputedStyle(t).getPropertyValue(`--${i()}-modal-title-gap`)) || 8;
|
|
32
|
+
u.left < o.right + b && u.right > o.left && u.bottom + b > o.top && u.top < o.bottom ? (e.setAttribute(`data-${i()}-modal-title-clearance`, ""), e.style.setProperty(
|
|
33
|
+
`--${i()}-modal-title-clearance-width`,
|
|
34
|
+
`${Math.min(o.width, Math.max(0, o.right - u.left + b))}px`
|
|
34
35
|
), e.style.setProperty(
|
|
35
|
-
|
|
36
|
-
`${F(e, o, u.bottom,
|
|
37
|
-
)) : (e.removeAttribute(
|
|
36
|
+
`--${i()}-modal-title-clearance-height`,
|
|
37
|
+
`${F(e, o, u.bottom, b, w)}px`
|
|
38
|
+
)) : (e.removeAttribute(`data-${i()}-modal-title-clearance`), e.style.removeProperty(`--${i()}-modal-title-clearance-width`), e.style.removeProperty(`--${i()}-modal-title-clearance-height`));
|
|
38
39
|
}, d = () => {
|
|
39
|
-
l.cancelAnimationFrame(
|
|
40
|
+
l.cancelAnimationFrame(m), m = l.requestAnimationFrame(g);
|
|
40
41
|
};
|
|
41
|
-
|
|
42
|
+
g();
|
|
42
43
|
const n = typeof ResizeObserver > "u" ? null : new ResizeObserver(d);
|
|
43
|
-
return n == null || n.observe(t), n == null || n.observe(e), n == null || n.observe(
|
|
44
|
-
n == null || n.disconnect(), l.removeEventListener("resize", d), l.cancelAnimationFrame(
|
|
44
|
+
return n == null || n.observe(t), n == null || n.observe(e), n == null || n.observe(r), l.addEventListener("resize", d), () => {
|
|
45
|
+
n == null || n.disconnect(), l.removeEventListener("resize", d), l.cancelAnimationFrame(m), t.removeAttribute(`data-${i()}-modal-has-title`), t.style.removeProperty(`--${i()}-modal-title-close-top`), e.removeAttribute(`data-${i()}-modal-title-clearance`), e.style.removeProperty(`--${i()}-modal-title-clearance-width`), e.style.removeProperty(`--${i()}-modal-title-clearance-height`);
|
|
45
46
|
};
|
|
46
|
-
}, [
|
|
47
|
+
}, [c, f, h, $, x]);
|
|
47
48
|
};
|
|
48
49
|
export { A as useModalTitleClearance$u };
|