urfu-ui-kit-react 2.1.4 → 2.1.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/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.js +77 -71
- package/dist/components/Tabs/tabsIndicator.d.ts +14 -0
- package/dist/components/Tabs/tabsIndicator.d.ts.map +1 -0
- package/dist/components/Tabs/useTabsIndicator.d.ts +6 -0
- package/dist/components/Tabs/useTabsIndicator.d.ts.map +1 -0
- package/dist/components/Tabs/useTabsIndicator.js +14 -0
- package/dist/dev/index.js +1 -1
- package/dist/fonts/icons/urfu-ui-icon-font.eot +0 -0
- package/dist/fonts/icons/urfu-ui-icon-font.svg +2 -2
- package/dist/fonts/icons/urfu-ui-icon-font.ttf +0 -0
- package/dist/fonts/icons/urfu-ui-icon-font.woff +0 -0
- package/dist/fonts/icons/urfu-ui-icon-font.woff2 +0 -0
- package/dist/shared/kitCopy.js +1 -1
- package/dist/style-no-fonts.css +1 -1
- package/dist/style.css +1 -1
- package/dist/style.layer.css +1 -1
- package/dist/style.shell.css +1 -1
- package/dist/vanilla/core/tabsIndicator.js +38 -0
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const c = 200, p = ["transform", "width", "height"].map((e) => `${e} 200ms ease-out`).join(", "), u = () => {
|
|
2
|
+
var e;
|
|
3
|
+
return typeof window < "u" && ((e = window.matchMedia) == null ? void 0 : e.call(window, "(prefers-reduced-motion: reduce)").matches) === !0;
|
|
4
|
+
}, g = () => {
|
|
5
|
+
let e = null, f, l;
|
|
6
|
+
const h = (i, n, s) => {
|
|
7
|
+
if (!i || !n) return;
|
|
8
|
+
const o = i.querySelector('[aria-current="page"]');
|
|
9
|
+
if (!o) {
|
|
10
|
+
n.style.visibility = "hidden", e = null;
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
let d = 0, a = 0;
|
|
14
|
+
for (let r = o; r && r !== i; r = r.offsetParent)
|
|
15
|
+
d += r.offsetLeft, a += r.offsetTop;
|
|
16
|
+
const t = { left: d, top: a, width: o.offsetWidth, height: o.offsetHeight };
|
|
17
|
+
e && e.left === t.left && e.top === t.top && e.width === t.width && e.height === t.height || (Object.assign(n.style, {
|
|
18
|
+
transition: s && e && !u() ? p : "none",
|
|
19
|
+
visibility: "",
|
|
20
|
+
width: `${t.width}px`,
|
|
21
|
+
height: `${t.height}px`,
|
|
22
|
+
transform: `translate(${t.left}px, ${t.top}px)`,
|
|
23
|
+
borderRadius: getComputedStyle(o).borderRadius
|
|
24
|
+
}), e = t);
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
/** После каждой отрисовки. layout — состав и вид вкладок: при его смене подсветка не едет. */
|
|
28
|
+
update(i, n, s, o) {
|
|
29
|
+
const d = s !== f && o === l;
|
|
30
|
+
f = s, l = o, h(i, n, d);
|
|
31
|
+
},
|
|
32
|
+
/** Ряд сменил размер (окно, загрузка шрифтов) — встать на место без переезда. */
|
|
33
|
+
refresh(i, n) {
|
|
34
|
+
h(i, n, !1);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export { c as TABS_INDICATOR_MS$u, g as createTabsIndicator$u };
|