@tedi-design-system/react 19.2.0-rc.2 → 19.2.0-rc.4
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/bundle-stats.html +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/prop-types/external/react-is/index.cjs.js +1 -1
- package/external/prop-types/external/react-is/index.es.js +1 -1
- package/package.json +1 -1
- package/src/tedi/components/content/carousel/use-carousel.cjs.js +1 -1
- package/src/tedi/components/content/carousel/use-carousel.es.js +108 -106
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-collapsible/table-of-contents-collapsible.cjs.js +1 -1
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-collapsible/table-of-contents-collapsible.es.js +1 -1
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.cjs.js +1 -1
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.es.js +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.development.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.development.cjs2.js");/** @license React v16.13.1
|
|
2
2
|
* react-is.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.production.min.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.production.min.cjs2.js");/** @license React v16.13.1
|
|
2
2
|
* react-is.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../_virtual/index.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../_virtual/index.cjs4.js"),r=require("./cjs/react-is.production.min.cjs.js"),o=require("./cjs/react-is.development.cjs.js");process.env.NODE_ENV==="production"?e.__module.exports=r.__require():e.__module.exports=o.__require();var t=e.__module.exports;exports.reactIsExports=t;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as r } from "../../../../_virtual/index.
|
|
1
|
+
import { __module as r } from "../../../../_virtual/index.es4.js";
|
|
2
2
|
import { __require as e } from "./cjs/react-is.production.min.es.js";
|
|
3
3
|
import { __require as o } from "./cjs/react-is.development.es.js";
|
|
4
4
|
process.env.NODE_ENV === "production" ? r.exports = e() : r.exports = o();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.development.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.development.cjs.js");/** @license React v16.13.1
|
|
2
2
|
* react-is.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.production.min.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.production.min.cjs.js");/** @license React v16.13.1
|
|
2
2
|
* react-is.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../_virtual/index.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../_virtual/index.cjs3.js"),t=require("./cjs/react-is.production.min.cjs.js"),o=require("./cjs/react-is.development.cjs.js");var r;function u(){return r||(r=1,process.env.NODE_ENV==="production"?e.__module.exports=t.__require():e.__module.exports=o.__require()),e.__module.exports}exports.__require=u;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as e } from "../../../../_virtual/index.
|
|
1
|
+
import { __module as e } from "../../../../_virtual/index.es3.js";
|
|
2
2
|
import { __require as o } from "./cjs/react-is.production.min.es.js";
|
|
3
3
|
import { __require as t } from "./cjs/react-is.development.es.js";
|
|
4
4
|
var r;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tedi-design-system/react",
|
|
3
|
-
"version": "19.2.0-rc.
|
|
3
|
+
"version": "19.2.0-rc.4",
|
|
4
4
|
"description": "TEDI Design System React component library — accessible, reusable UI components. Docs & live examples: https://storybook.tedi.ee/react/rc/",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),De=require("../../../helpers/hooks/use-breakpoint.cjs.js"),ne=require("./carousel-utils.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),De=require("../../../helpers/hooks/use-breakpoint.cjs.js"),ne=require("./carousel-utils.cjs.js"),Fe=require("../../../providers/label-provider/use-labels.cjs.js"),Ve={slidesPerView:{xs:1},gap:{xs:1},fade:!1,transitionMs:400,loop:!0,centered:!1},V=(T,p)=>(T%p+p)%p,Ee=T=>{const{getLabel:p}=Fe.useLabels(),E=De.default(),[l,se]=t.useState(Ve),[r,ce]=t.useState(0),[f,b]=t.useState(0),[h,Y]=t.useState(0),[j,R]=t.useState(!1),[x,oe]=t.useState(0),[H,ae]=t.useState(16),[ue,le]=t.useState(""),A=t.useRef(null),J=t.useRef(null),Q=t.useRef([]),P=t.useRef(!1),y=t.useRef(!1),$=t.useRef(!1),O=t.useRef(0),D=t.useRef(0),Z=t.useRef(0),_=t.useRef(0),q=t.useRef(0),G=t.useRef(),L=t.useRef(0),ee=t.useRef(!0),d=t.useRef(f),te=t.useRef(h);t.useEffect(()=>{d.current=f},[f]),t.useEffect(()=>{te.current=h},[h]);const a=t.useMemo(()=>ne.resolveBreakpointValue(l.slidesPerView,E),[l.slidesPerView,E]),C=t.useMemo(()=>ne.resolveBreakpointValue(l.gap,E),[l.gap,E]),S=t.useMemo(()=>C*H,[C,H]),s=l.loop,M=t.useMemo(()=>Math.max(0,r-Math.ceil(a)),[r,a]),k=t.useCallback(e=>s?e:Math.min(Math.max(e,0),M),[s,M]),m=s?r:0,ie=t.useMemo(()=>r===0?0:s?V(Math.floor(f),r):Math.min(Math.max(Math.round(f),0),r-1),[f,r,s]),X=s?f-h+m:f,fe=s||f>.001,de=s||f<M-.001,me=t.useMemo(()=>{if(!r)return[];if(!s)return Array.from({length:r},(c,o)=>o);const e=2*m+Math.ceil(a),n=h-m;return Array.from({length:e},(c,o)=>V(n+o,r))},[r,m,a,h,s]),he=t.useMemo(()=>`0 0 calc((100% - ${(a-1)*C}rem) / ${a})`,[a,C]),Me=t.useMemo(()=>{if(!x)return{gap:`${C}rem`,transform:"translate3d(0,0,0)",transition:"none"};const e=S*(a-1),n=(x-e)/a,c=s?f-h+m:f,o=l.centered?(x-n)/2:0,u=-c*(n+S)+o;return{gap:`${C}rem`,transform:`translate3d(${u}px, 0, 0)`,transition:j?`transform ${l.transitionMs}ms ease`:"none"}},[x,C,S,a,f,h,m,j,l.transitionMs,l.centered,s]),pe=t.useCallback(e=>{const n=Math.ceil(a);return e>=X&&e<X+n},[a,X]),be=t.useCallback((e,n,c)=>{const o=[e];if(l.fade){const u=l.fade==="both"||l.fade!=="right"&&a<=1;o.push(u?c:n)}return o.join(" ")},[l.fade,a]),Re=t.useCallback((e,n)=>{Q.current[e]=n},[]),w=t.useCallback(()=>{setTimeout(()=>{if(!ee.current||!r)return;const e=s?V(Math.floor(d.current),r):Math.min(Math.max(Math.round(d.current),0),r-1);le(p("carousel.slide",e+1,r))},100)},[p,r,s]),N=t.useCallback(()=>{P.current=!0,setTimeout(()=>{P.current=!1},l.transitionMs)},[l.transitionMs]),re=t.useCallback(()=>{setTimeout(()=>{var n;const e=d.current-te.current+m;(n=Q.current[e])==null||n.focus({preventScroll:!0})})},[m]),K=t.useCallback(()=>{!r||P.current||!s&&d.current>=M-.001||(R(!0),b(e=>k(e+1)),N(),w())},[r,s,M,k,N,w]),U=t.useCallback(()=>{!r||P.current||!s&&d.current<=.001||(R(!0),b(e=>k(e-1)),N(),w())},[r,s,k,N,w]),W=t.useCallback((e,n)=>{if(!(!r||P.current)){if(R(!0),s){const c=V(Math.floor(d.current),r),u=V(e,r)-c;b(i=>i+u)}else b(k(e));n!=null&&n.focusSlide?$.current=!0:w()}},[r,s,k,w]),ke=t.useCallback(e=>{e.target!==J.current||e.propertyName!=="transform"||y.current||(R(!1),Y(Math.floor(d.current)),$.current&&($.current=!1,re()))},[re]),Ce=t.useCallback(()=>{const e=A.current;e&&(e.scrollLeft=0,e.scrollTop=0)},[]),I=t.useCallback(()=>(x-S*(a-1))/a+S,[x,S,a]),ge=t.useCallback(e=>{if(!r)return;const n=Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.shiftKey?e.deltaY:0;if(!n)return;const c=I();if(!c)return;const o=n/c;L.current+=o;const u=m*.9,i=s?h-u:0,g=s?h+u:M,v=d.current+o,z=Math.min(Math.max(v,i),g),Te=z!==v;R(!1),b(z),clearTimeout(G.current),G.current=setTimeout(()=>{R(!0);const Pe=Math.sign(L.current),F=d.current;let B=Math.round(F);Math.abs(L.current)>.3&&(B=Pe>0?Math.ceil(F):Math.floor(F)),Te&&(F<=i&&(B=Math.ceil(i)),F>=g&&(B=Math.floor(g)));const ye=Math.min(Math.max(B,i),g);b(ye),L.current=0},120)},[r,I,m,h,s,M]),xe=t.useCallback(e=>{switch(e.key){case"ArrowRight":case"PageDown":e.preventDefault(),K();break;case"ArrowLeft":case"PageUp":e.preventDefault(),U();break;case"Home":e.preventDefault(),W(0);break;case"End":e.preventDefault(),W(r-1);break}},[K,U,W,r]),Se=t.useCallback(e=>{var n;r&&((n=A.current)==null||n.setPointerCapture(e.pointerId),y.current=!0,R(!1),O.current=e.clientX,D.current=d.current,Z.current=e.timeStamp,_.current=e.clientX,q.current=e.timeStamp,s&&Y(Math.floor(d.current)))},[r,s]),we=t.useCallback(e=>{if(!y.current)return;const n=I();if(!n)return;const c=e.clientX-O.current;if(Number.isNaN(c))return;_.current=e.clientX,q.current=e.timeStamp;const o=c/n,u=D.current-o,i=m*.9,g=Math.floor(D.current),v=s?g-i:0,z=s?g+i:M;b(Math.min(Math.max(u,v),z))},[I,m,s,M]),Ie=t.useCallback(()=>{if(!y.current)return;y.current=!1,R(!0);const e=I(),n=Math.round(d.current);let c=n;const o=q.current-Z.current,u=o>0&&e?-(_.current-O.current)/e/o:0;Math.abs(u)>.0015&&n===Math.round(D.current)&&(c=Math.round(D.current)+(u>0?1:-1)),b(k(c))},[I,k]);return t.useEffect(()=>{const e=A.current;if(!e)return;const n=i=>{oe(i),ae(parseFloat(getComputedStyle(document.documentElement).fontSize)||16)},c=getComputedStyle(e),o=(parseFloat(c.paddingLeft)||0)+(parseFloat(c.paddingRight)||0);n(e.clientWidth-o);const u=new ResizeObserver(([i])=>{i&&n(i.contentRect.width)});return u.observe(e),()=>u.disconnect()},[]),t.useEffect(()=>()=>{ee.current=!1,clearTimeout(G.current)},[]),{viewportRef:A,trackRef:J,setSlideRef:Re,setConfig:se,setSlidesCount:ce,slidesCount:r,slideIndex:ie,canPrev:fe,canNext:de,renderedIndices:me,renderedActiveIndex:X,slideFlex:he,trackStyle:Me,contentClassName:be,isSlideVisible:pe,announcement:ue,regionLabel:(T==null?void 0:T.trim())||p("carousel"),slideLabel:e=>p("carousel.slide",e,r),next:K,prev:U,goToIndex:W,onTransitionEnd:ke,onScroll:Ce,onWheel:ge,onKeyDown:xe,onPointerDown:Se,onPointerMove:we,onPointerUp:Ie}};exports.useCarousel=Ee;
|
|
@@ -1,138 +1,138 @@
|
|
|
1
|
-
import { useState as S, useRef as
|
|
1
|
+
import { useState as S, useRef as u, useEffect as K, useMemo as I, useCallback as c } from "react";
|
|
2
2
|
import Xt from "../../../helpers/hooks/use-breakpoint.es.js";
|
|
3
3
|
import { resolveBreakpointValue as at } from "./carousel-utils.es.js";
|
|
4
|
-
import { useLabels as
|
|
5
|
-
const
|
|
4
|
+
import { useLabels as Lt } from "../../../providers/label-provider/use-labels.es.js";
|
|
5
|
+
const Nt = {
|
|
6
6
|
slidesPerView: { xs: 1 },
|
|
7
7
|
gap: { xs: 1 },
|
|
8
8
|
fade: !1,
|
|
9
9
|
transitionMs: 400,
|
|
10
10
|
loop: !0,
|
|
11
11
|
centered: !1
|
|
12
|
-
},
|
|
13
|
-
const { getLabel: x } =
|
|
12
|
+
}, L = (F, x) => (F % x + x) % x, vt = (F) => {
|
|
13
|
+
const { getLabel: x } = Lt(), N = Xt(), [l, it] = S(Nt), [e, ut] = S(0), [d, g] = S(0), [p, Q] = S(0), [Z, w] = S(!1), [C, lt] = S(0), [tt, ft] = S(16), [dt, mt] = S(""), W = u(null), et = u(null), rt = u([]), y = u(!1), V = u(!1), O = u(!1), Y = u(0), A = u(0), nt = u(0), U = u(0), j = u(0), H = u(), z = u(0), ot = u(!0), m = u(d), st = u(p);
|
|
14
14
|
K(() => {
|
|
15
|
-
|
|
16
|
-
}, [
|
|
17
|
-
st.current =
|
|
18
|
-
}, [
|
|
19
|
-
const
|
|
20
|
-
() => at(
|
|
21
|
-
[
|
|
22
|
-
), b = I(() => at(
|
|
23
|
-
() => Math.max(0, e - Math.ceil(
|
|
24
|
-
[e,
|
|
25
|
-
), R =
|
|
15
|
+
m.current = d;
|
|
16
|
+
}, [d]), K(() => {
|
|
17
|
+
st.current = p;
|
|
18
|
+
}, [p]);
|
|
19
|
+
const a = I(
|
|
20
|
+
() => at(l.slidesPerView, N),
|
|
21
|
+
[l.slidesPerView, N]
|
|
22
|
+
), b = I(() => at(l.gap, N), [l.gap, N]), T = I(() => b * tt, [b, tt]), n = l.loop, M = I(
|
|
23
|
+
() => Math.max(0, e - Math.ceil(a)),
|
|
24
|
+
[e, a]
|
|
25
|
+
), R = c(
|
|
26
26
|
(t) => n ? t : Math.min(Math.max(t, 0), M),
|
|
27
27
|
[n, M]
|
|
28
|
-
),
|
|
28
|
+
), h = n ? e : 0, ht = I(() => e === 0 ? 0 : n ? L(Math.floor(d), e) : Math.min(Math.max(Math.round(d), 0), e - 1), [d, e, n]), E = n ? d - p + h : d, pt = n || d > 1e-3, Mt = n || d < M - 1e-3, xt = I(() => {
|
|
29
29
|
if (!e) return [];
|
|
30
|
-
if (!n) return Array.from({ length: e }, (o,
|
|
31
|
-
const t = 2 *
|
|
32
|
-
return Array.from({ length: t }, (o,
|
|
33
|
-
}, [e,
|
|
34
|
-
() => `0 0 calc((100% - ${(
|
|
35
|
-
[
|
|
36
|
-
),
|
|
37
|
-
if (!
|
|
30
|
+
if (!n) return Array.from({ length: e }, (o, s) => s);
|
|
31
|
+
const t = 2 * h + Math.ceil(a), r = p - h;
|
|
32
|
+
return Array.from({ length: t }, (o, s) => L(r + s, e));
|
|
33
|
+
}, [e, h, a, p, n]), gt = I(
|
|
34
|
+
() => `0 0 calc((100% - ${(a - 1) * b}rem) / ${a})`,
|
|
35
|
+
[a, b]
|
|
36
|
+
), wt = I(() => {
|
|
37
|
+
if (!C)
|
|
38
38
|
return { gap: `${b}rem`, transform: "translate3d(0,0,0)", transition: "none" };
|
|
39
|
-
const t =
|
|
39
|
+
const t = T * (a - 1), r = (C - t) / a, o = n ? d - p + h : d, s = l.centered ? (C - r) / 2 : 0, i = -o * (r + T) + s;
|
|
40
40
|
return {
|
|
41
41
|
gap: `${b}rem`,
|
|
42
|
-
transform: `translate3d(${
|
|
43
|
-
transition: Z ? `transform ${
|
|
42
|
+
transform: `translate3d(${i}px, 0, 0)`,
|
|
43
|
+
transition: Z ? `transform ${l.transitionMs}ms ease` : "none"
|
|
44
44
|
};
|
|
45
45
|
}, [
|
|
46
|
-
T,
|
|
47
|
-
b,
|
|
48
46
|
C,
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
b,
|
|
48
|
+
T,
|
|
49
|
+
a,
|
|
50
|
+
d,
|
|
51
|
+
p,
|
|
51
52
|
h,
|
|
52
|
-
m,
|
|
53
53
|
Z,
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
l.transitionMs,
|
|
55
|
+
l.centered,
|
|
56
56
|
n
|
|
57
|
-
]), Rt =
|
|
57
|
+
]), Rt = c(
|
|
58
58
|
(t) => {
|
|
59
|
-
const r = Math.ceil(
|
|
60
|
-
return t >=
|
|
59
|
+
const r = Math.ceil(a);
|
|
60
|
+
return t >= E && t < E + r;
|
|
61
61
|
},
|
|
62
|
-
[
|
|
63
|
-
), St =
|
|
62
|
+
[a, E]
|
|
63
|
+
), St = c(
|
|
64
64
|
(t, r, o) => {
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
const
|
|
68
|
-
|
|
65
|
+
const s = [t];
|
|
66
|
+
if (l.fade) {
|
|
67
|
+
const i = l.fade === "both" || l.fade !== "right" && a <= 1;
|
|
68
|
+
s.push(i ? o : r);
|
|
69
69
|
}
|
|
70
|
-
return
|
|
70
|
+
return s.join(" ");
|
|
71
71
|
},
|
|
72
|
-
[
|
|
73
|
-
), It =
|
|
72
|
+
[l.fade, a]
|
|
73
|
+
), It = c((t, r) => {
|
|
74
74
|
rt.current[t] = r;
|
|
75
|
-
}, []), P =
|
|
75
|
+
}, []), P = c(() => {
|
|
76
76
|
setTimeout(() => {
|
|
77
77
|
if (!ot.current || !e) return;
|
|
78
|
-
const t = n ?
|
|
78
|
+
const t = n ? L(Math.floor(m.current), e) : Math.min(Math.max(Math.round(m.current), 0), e - 1);
|
|
79
79
|
mt(x("carousel.slide", t + 1, e));
|
|
80
80
|
}, 100);
|
|
81
|
-
}, [x, e, n]), $ =
|
|
81
|
+
}, [x, e, n]), $ = c(() => {
|
|
82
82
|
y.current = !0, setTimeout(() => {
|
|
83
83
|
y.current = !1;
|
|
84
|
-
},
|
|
85
|
-
}, [
|
|
84
|
+
}, l.transitionMs);
|
|
85
|
+
}, [l.transitionMs]), ct = c(() => {
|
|
86
86
|
setTimeout(() => {
|
|
87
87
|
var r;
|
|
88
|
-
const t =
|
|
88
|
+
const t = m.current - st.current + h;
|
|
89
89
|
(r = rt.current[t]) == null || r.focus({ preventScroll: !0 });
|
|
90
90
|
});
|
|
91
|
-
}, [
|
|
92
|
-
!e || y.current || !n &&
|
|
93
|
-
}, [e, n, M, R, $, P]), J =
|
|
94
|
-
!e || y.current || !n &&
|
|
95
|
-
}, [e, n, R, $, P]), v =
|
|
91
|
+
}, [h]), q = c(() => {
|
|
92
|
+
!e || y.current || !n && m.current >= M - 1e-3 || (w(!0), g((t) => R(t + 1)), $(), P());
|
|
93
|
+
}, [e, n, M, R, $, P]), J = c(() => {
|
|
94
|
+
!e || y.current || !n && m.current <= 1e-3 || (w(!0), g((t) => R(t - 1)), $(), P());
|
|
95
|
+
}, [e, n, R, $, P]), v = c(
|
|
96
96
|
(t, r) => {
|
|
97
97
|
if (!(!e || y.current)) {
|
|
98
|
-
if (
|
|
99
|
-
const o =
|
|
100
|
-
|
|
98
|
+
if (w(!0), n) {
|
|
99
|
+
const o = L(Math.floor(m.current), e), i = L(t, e) - o;
|
|
100
|
+
g((f) => f + i);
|
|
101
101
|
} else
|
|
102
|
-
|
|
102
|
+
g(R(t));
|
|
103
103
|
r != null && r.focusSlide ? O.current = !0 : P();
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
[e, n, R, P]
|
|
107
|
-
), bt =
|
|
107
|
+
), bt = c(
|
|
108
108
|
(t) => {
|
|
109
|
-
t.target !== et.current || t.propertyName !== "transform" ||
|
|
109
|
+
t.target !== et.current || t.propertyName !== "transform" || V.current || (w(!1), Q(Math.floor(m.current)), O.current && (O.current = !1, ct()));
|
|
110
110
|
},
|
|
111
111
|
[ct]
|
|
112
|
-
), kt =
|
|
113
|
-
const t =
|
|
112
|
+
), kt = c(() => {
|
|
113
|
+
const t = W.current;
|
|
114
114
|
t && (t.scrollLeft = 0, t.scrollTop = 0);
|
|
115
|
-
}, []), D =
|
|
115
|
+
}, []), D = c(() => (C - T * (a - 1)) / a + T, [C, T, a]), Ct = c(
|
|
116
116
|
(t) => {
|
|
117
117
|
if (!e) return;
|
|
118
118
|
const r = Math.abs(t.deltaX) > Math.abs(t.deltaY) ? t.deltaX : t.shiftKey ? t.deltaY : 0;
|
|
119
119
|
if (!r) return;
|
|
120
120
|
const o = D();
|
|
121
121
|
if (!o) return;
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const
|
|
122
|
+
const s = r / o;
|
|
123
|
+
z.current += s;
|
|
124
|
+
const i = h * 0.9, f = n ? p - i : 0, k = n ? p + i : M, B = m.current + s, _ = Math.min(Math.max(B, f), k), yt = _ !== B;
|
|
125
|
+
w(!1), g(_), clearTimeout(H.current), H.current = setTimeout(() => {
|
|
126
|
+
w(!0);
|
|
127
|
+
const Vt = Math.sign(z.current), X = m.current;
|
|
128
128
|
let G = Math.round(X);
|
|
129
|
-
Math.abs(
|
|
130
|
-
const
|
|
131
|
-
|
|
129
|
+
Math.abs(z.current) > 0.3 && (G = Vt > 0 ? Math.ceil(X) : Math.floor(X)), yt && (X <= f && (G = Math.ceil(f)), X >= k && (G = Math.floor(k)));
|
|
130
|
+
const At = Math.min(Math.max(G, f), k);
|
|
131
|
+
g(At), z.current = 0;
|
|
132
132
|
}, 120);
|
|
133
133
|
},
|
|
134
|
-
[e, D,
|
|
135
|
-
),
|
|
134
|
+
[e, D, h, p, n, M]
|
|
135
|
+
), Tt = c(
|
|
136
136
|
(t) => {
|
|
137
137
|
switch (t.key) {
|
|
138
138
|
case "ArrowRight":
|
|
@@ -152,48 +152,50 @@ const Wt = {
|
|
|
152
152
|
}
|
|
153
153
|
},
|
|
154
154
|
[q, J, v, e]
|
|
155
|
-
), Pt =
|
|
155
|
+
), Pt = c(
|
|
156
156
|
(t) => {
|
|
157
157
|
var r;
|
|
158
|
-
e && ((r =
|
|
158
|
+
e && ((r = W.current) == null || r.setPointerCapture(t.pointerId), V.current = !0, w(!1), Y.current = t.clientX, A.current = m.current, nt.current = t.timeStamp, U.current = t.clientX, j.current = t.timeStamp, n && Q(Math.floor(m.current)));
|
|
159
159
|
},
|
|
160
160
|
[e, n]
|
|
161
|
-
), Dt =
|
|
161
|
+
), Dt = c(
|
|
162
162
|
(t) => {
|
|
163
|
-
if (!
|
|
163
|
+
if (!V.current) return;
|
|
164
164
|
const r = D();
|
|
165
165
|
if (!r) return;
|
|
166
166
|
const o = t.clientX - Y.current;
|
|
167
167
|
if (Number.isNaN(o)) return;
|
|
168
168
|
U.current = t.clientX, j.current = t.timeStamp;
|
|
169
|
-
const
|
|
170
|
-
|
|
169
|
+
const s = o / r, i = A.current - s, f = h * 0.9, k = Math.floor(A.current), B = n ? k - f : 0, _ = n ? k + f : M;
|
|
170
|
+
g(Math.min(Math.max(i, B), _));
|
|
171
171
|
},
|
|
172
|
-
[D,
|
|
173
|
-
),
|
|
174
|
-
if (!
|
|
175
|
-
|
|
176
|
-
const t = D(), r = Math.round(
|
|
172
|
+
[D, h, n, M]
|
|
173
|
+
), Ft = c(() => {
|
|
174
|
+
if (!V.current) return;
|
|
175
|
+
V.current = !1, w(!0);
|
|
176
|
+
const t = D(), r = Math.round(m.current);
|
|
177
177
|
let o = r;
|
|
178
|
-
const
|
|
179
|
-
Math.abs(
|
|
178
|
+
const s = j.current - nt.current, i = s > 0 && t ? -(U.current - Y.current) / t / s : 0;
|
|
179
|
+
Math.abs(i) > 15e-4 && r === Math.round(A.current) && (o = Math.round(A.current) + (i > 0 ? 1 : -1)), g(R(o));
|
|
180
180
|
}, [D, R]);
|
|
181
181
|
return K(() => {
|
|
182
|
-
const t =
|
|
182
|
+
const t = W.current;
|
|
183
183
|
if (!t) return;
|
|
184
|
-
const r = () => {
|
|
185
|
-
lt(
|
|
186
|
-
};
|
|
187
|
-
r();
|
|
188
|
-
const
|
|
189
|
-
|
|
184
|
+
const r = (f) => {
|
|
185
|
+
lt(f), ft(parseFloat(getComputedStyle(document.documentElement).fontSize) || 16);
|
|
186
|
+
}, o = getComputedStyle(t), s = (parseFloat(o.paddingLeft) || 0) + (parseFloat(o.paddingRight) || 0);
|
|
187
|
+
r(t.clientWidth - s);
|
|
188
|
+
const i = new ResizeObserver(([f]) => {
|
|
189
|
+
f && r(f.contentRect.width);
|
|
190
|
+
});
|
|
191
|
+
return i.observe(t), () => i.disconnect();
|
|
190
192
|
}, []), K(
|
|
191
193
|
() => () => {
|
|
192
194
|
ot.current = !1, clearTimeout(H.current);
|
|
193
195
|
},
|
|
194
196
|
[]
|
|
195
197
|
), {
|
|
196
|
-
viewportRef:
|
|
198
|
+
viewportRef: W,
|
|
197
199
|
trackRef: et,
|
|
198
200
|
setSlideRef: It,
|
|
199
201
|
setConfig: it,
|
|
@@ -203,24 +205,24 @@ const Wt = {
|
|
|
203
205
|
canPrev: pt,
|
|
204
206
|
canNext: Mt,
|
|
205
207
|
renderedIndices: xt,
|
|
206
|
-
renderedActiveIndex:
|
|
207
|
-
slideFlex:
|
|
208
|
-
trackStyle:
|
|
208
|
+
renderedActiveIndex: E,
|
|
209
|
+
slideFlex: gt,
|
|
210
|
+
trackStyle: wt,
|
|
209
211
|
contentClassName: St,
|
|
210
212
|
isSlideVisible: Rt,
|
|
211
213
|
announcement: dt,
|
|
212
|
-
regionLabel: (
|
|
214
|
+
regionLabel: (F == null ? void 0 : F.trim()) || x("carousel"),
|
|
213
215
|
slideLabel: (t) => x("carousel.slide", t, e),
|
|
214
216
|
next: q,
|
|
215
217
|
prev: J,
|
|
216
218
|
goToIndex: v,
|
|
217
219
|
onTransitionEnd: bt,
|
|
218
220
|
onScroll: kt,
|
|
219
|
-
onWheel:
|
|
220
|
-
onKeyDown:
|
|
221
|
+
onWheel: Ct,
|
|
222
|
+
onKeyDown: Tt,
|
|
221
223
|
onPointerDown: Pt,
|
|
222
224
|
onPointerMove: Dt,
|
|
223
|
-
onPointerUp:
|
|
225
|
+
onPointerUp: Ft
|
|
224
226
|
};
|
|
225
227
|
};
|
|
226
228
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),w=require("../../../../../../../external/classnames/index.cjs.js"),n=require("react"),T=require("../../../../base/typography/text/text.cjs.js"),q=require("../../../../buttons/collapse-button/collapse-button.cjs.js"),H=require("../../../../overlays/sheet/sheet.cjs.js"),b=require("../../table-of-contents.cjs.js"),t=require("../../table-of-contents.module.scss.cjs.js"),Y=require("../table-of-contents-list/table-of-contents-list.cjs.js"),F=require("../../../../../providers/label-provider/use-labels.cjs.js"),N=E=>{const{children:m,heading:h,ariaLabel:S,activeId:o,numbered:v=!1,bordered:y=!1,defaultOpen:p=!0,sticky:c=!0,hideOnScroll:x=!1,className:M}=E,{getLabel:C}=F.useLabels(),[l,i]=n.useState(!1),[k,_]=n.useState(!1),[r,A]=n.useState(null);n.useEffect(()=>{if(!x||!c){_(!1);return}let a=window.scrollY,s=0;const O=()=>{s||(s=window.requestAnimationFrame(()=>{s=0;const f=window.scrollY,j=f-a;Math.abs(j)>4&&(_(j>0&&f>0),a=f)}))};return window.addEventListener("scroll",O,{passive:!0}),()=>{window.removeEventListener("scroll",O),s&&window.cancelAnimationFrame(s)}},[x,c]),n.useEffect(()=>{if(!l||!r)return;const a=s=>{s.target.closest("a, button")&&i(!1)};return r.addEventListener("click",a),()=>r.removeEventListener("click",a)},[l,r]);const d=(h===void 0?C("table-of-contents.title"):h)
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),w=require("../../../../../../../external/classnames/index.cjs.js"),n=require("react"),T=require("../../../../base/typography/text/text.cjs.js"),q=require("../../../../buttons/collapse-button/collapse-button.cjs.js"),H=require("../../../../overlays/sheet/sheet.cjs.js"),b=require("../../table-of-contents.cjs.js"),t=require("../../table-of-contents.module.scss.cjs.js"),Y=require("../table-of-contents-list/table-of-contents-list.cjs.js"),F=require("../../../../../providers/label-provider/use-labels.cjs.js"),N=E=>{const{children:m,heading:h,ariaLabel:S,activeId:o,numbered:v=!1,bordered:y=!1,defaultOpen:p=!0,sticky:c=!0,hideOnScroll:x=!1,className:M}=E,{getLabel:C}=F.useLabels(),[l,i]=n.useState(!1),[k,_]=n.useState(!1),[r,A]=n.useState(null);n.useEffect(()=>{if(!x||!c){_(!1);return}let a=window.scrollY,s=0;const O=()=>{s||(s=window.requestAnimationFrame(()=>{s=0;const f=window.scrollY,j=f-a;Math.abs(j)>4&&(_(j>0&&f>0),a=f)}))};return window.addEventListener("scroll",O,{passive:!0}),()=>{window.removeEventListener("scroll",O),s&&window.cancelAnimationFrame(s)}},[x,c]),n.useEffect(()=>{if(!l||!r)return;const a=s=>{s.target.closest("a, button")&&i(!1)};return r.addEventListener("click",a),()=>r.removeEventListener("click",a)},[l,r]);const d=(h===void 0?C("table-of-contents.title"):h)||C("table-of-contents.title"),g=S||d,u=n.useMemo(()=>b.childrenToNodes(m),[m]),L=n.useMemo(()=>b.buildActiveTrail(u,o),[u,o]),B=n.useMemo(()=>({activeId:o,numbered:v,ariaLabel:g,activeTrail:L,defaultOpen:p}),[o,v,g,L,p]);return e.jsxs(b.TableOfContentsContext.Provider,{value:B,children:[e.jsxs("div",{className:w.default(t.default["tedi-table-of-contents__bar"],{[t.default["tedi-table-of-contents__bar--static"]]:!c,[t.default["tedi-table-of-contents__bar--hidden"]]:k&&!l},M),children:[e.jsx(T.Text,{modifiers:"bold",className:t.default["tedi-table-of-contents__bar-title"],children:d}),e.jsx(q.CollapseButton,{open:l,onOpenChange:i,underline:!1,"aria-haspopup":"dialog"})]}),e.jsx(H.Sheet,{open:l,onToggle:i,ariaLabel:d,className:t.default["tedi-table-of-contents__sheet"],header:e.jsxs("div",{className:t.default["tedi-table-of-contents__sheet-header"],children:[e.jsx(T.Text,{modifiers:"bold",className:t.default["tedi-table-of-contents__bar-title"],children:d}),e.jsx(q.CollapseButton,{open:l,onOpenChange:i,underline:!1})]}),children:e.jsx("div",{ref:A,className:w.default(t.default["tedi-table-of-contents"],{[t.default["tedi-table-of-contents--bordered"]]:y}),children:e.jsx(Y.TableOfContentsList,{nodes:u,heading:null})})})]})};N.displayName="TableOfContentsCollapsible";exports.TableOfContentsCollapsible=N;
|
|
@@ -44,7 +44,7 @@ const D = (k) => {
|
|
|
44
44
|
};
|
|
45
45
|
return i.addEventListener("click", l), () => i.removeEventListener("click", l);
|
|
46
46
|
}, [o, i]);
|
|
47
|
-
const r = (p === void 0 ? w("table-of-contents.title") : p)
|
|
47
|
+
const r = (p === void 0 ? w("table-of-contents.title") : p) || w("table-of-contents.title"), N = A || r, c = u(() => B(h), [h]), C = u(() => I(c, s), [c, s]), M = u(
|
|
48
48
|
() => ({ activeId: s, numbered: v, ariaLabel: N, activeTrail: C, defaultOpen: _ }),
|
|
49
49
|
[s, v, N, C, _]
|
|
50
50
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),_=require("../../../../../../../external/classnames/index.cjs.js"),w=require("react"),R=require("../../../../misc/separator/separator.cjs.js"),$=require("../../table-of-contents.cjs.js"),e=require("../../table-of-contents.module.scss.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),_=require("../../../../../../../external/classnames/index.cjs.js"),w=require("react"),R=require("../../../../misc/separator/separator.cjs.js"),$=require("../../table-of-contents.cjs.js"),e=require("../../table-of-contents.module.scss.cjs.js"),c=({node:m,depth:i,index:r,numberPrefix:a})=>{const{activeId:p,numbered:o,activeTrail:x,defaultOpen:j}=w.useContext($.TableOfContentsContext),{id:n,content:v,children:s,separator:h,slot:d}=m,C=!!(s!=null&&s.length),u=!!n&&n===p,O=C&&(j||!!n&&x.has(n)),N=Math.min(i,2),l=a?`${a}.${r+1}`:`${r+1}`,q=a?l:`${l}.`,T=o?"ol":"ul";return t.jsxs("li",{"aria-current":u?"location":void 0,className:_.default(e.default["tedi-table-of-contents__item"],{[e.default["tedi-table-of-contents__item--selected"]]:u}),children:[t.jsxs("div",{className:_.default(e.default["tedi-table-of-contents__row"],e.default[`tedi-table-of-contents__row--level-${N}`]),children:[o&&t.jsx("span",{className:e.default["tedi-table-of-contents__number"],"aria-hidden":"true",children:q}),t.jsx("span",{className:e.default["tedi-table-of-contents__content"],children:v}),d!==void 0&&t.jsx("div",{className:e.default["tedi-table-of-contents__slot"],children:d})]}),O&&t.jsx(T,{className:e.default["tedi-table-of-contents__group"],children:s.map((f,b)=>t.jsx(c,{node:f,depth:i+1,index:b,numberPrefix:o?l:void 0},f.id??b))}),h&&t.jsx(R.Separator,{className:e.default["tedi-table-of-contents__separator"]})]})};c.displayName="TableOfContentsRow";exports.TableOfContentsRow=c;
|
|
@@ -4,12 +4,12 @@ import { useContext as j } from "react";
|
|
|
4
4
|
import { Separator as y } from "../../../../misc/separator/separator.es.js";
|
|
5
5
|
import { TableOfContentsContext as R } from "../../table-of-contents.es.js";
|
|
6
6
|
import t from "../../table-of-contents.module.scss.es.js";
|
|
7
|
-
const b = ({ node: u, depth:
|
|
8
|
-
const { activeId: h, numbered: a, activeTrail: v, defaultOpen: N } = j(R), { id: o, content: C, children: n, separator: O, slot: c } = u, $ = !!(n != null && n.length), d = !!o && o === h, w = $ && (N || !!o && v.has(o)), T = Math.min(
|
|
7
|
+
const b = ({ node: u, depth: i, index: r, numberPrefix: s }) => {
|
|
8
|
+
const { activeId: h, numbered: a, activeTrail: v, defaultOpen: N } = j(R), { id: o, content: C, children: n, separator: O, slot: c } = u, $ = !!(n != null && n.length), d = !!o && o === h, w = $ && (N || !!o && v.has(o)), T = Math.min(i, 2), l = s ? `${s}.${r + 1}` : `${r + 1}`, x = s ? l : `${l}.`, g = a ? "ol" : "ul";
|
|
9
9
|
return /* @__PURE__ */ p(
|
|
10
10
|
"li",
|
|
11
11
|
{
|
|
12
|
-
"aria-current": d ? "
|
|
12
|
+
"aria-current": d ? "location" : void 0,
|
|
13
13
|
className: _(t["tedi-table-of-contents__item"], {
|
|
14
14
|
[t["tedi-table-of-contents__item--selected"]]: d
|
|
15
15
|
}),
|
|
@@ -23,7 +23,7 @@ const b = ({ node: u, depth: r, index: i, numberPrefix: s }) => {
|
|
|
23
23
|
b,
|
|
24
24
|
{
|
|
25
25
|
node: m,
|
|
26
|
-
depth:
|
|
26
|
+
depth: i + 1,
|
|
27
27
|
index: f,
|
|
28
28
|
numberPrefix: a ? l : void 0
|
|
29
29
|
},
|