@tedi-design-system/react 19.0.0-rc.2 → 19.0.0-rc.3
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/index.css +1 -1
- package/package.json +1 -1
- 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.d.ts +1 -1
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-collapsible/table-of-contents-collapsible.es.js +33 -33
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-item/table-of-contents-item.d.ts +0 -10
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-list/table-of-contents-list.cjs.js +1 -1
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-list/table-of-contents-list.es.js +27 -18
- 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 +21 -35
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.cjs.js +1 -1
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.d.ts +17 -10
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.es.js +51 -52
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.module.scss.cjs.js +1 -1
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.module.scss.es.js +0 -1
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +0 -21
- package/src/tedi/providers/label-provider/labels-map.es.js +2 -23
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),M=require("../../../../../../../external/classnames/index.cjs.js"),n=require("react"),C=require("../../../../base/typography/text/text.cjs.js"),T=require("../../../../buttons/collapse-button/collapse-button.cjs.js"),u=require("../../table-of-contents.cjs.js"),t=require("../../table-of-contents.module.scss.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),M=require("../../../../../../../external/classnames/index.cjs.js"),n=require("react"),C=require("../../../../base/typography/text/text.cjs.js"),T=require("../../../../buttons/collapse-button/collapse-button.cjs.js"),u=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"),B=require("../../../../../providers/label-provider/use-labels.cjs.js"),c=require("../../../../overlays/modal/modal.cjs.js"),g=j=>{const{children:f,heading:b,ariaLabel:_,activeId:o,numbered:x=!1,sticky:O=!0,className:q}=j,{getLabel:s}=B.useLabels(),[l,a]=n.useState(!1),h=n.useRef(null);n.useEffect(()=>{const d=h.current;if(!l||!d)return;const v=N=>{N.target.closest("a, button")&&a(!1)};return d.addEventListener("click",v),()=>d.removeEventListener("click",v)},[l]);const i=(b===void 0?s("table-of-contents.title"):b)??s("table-of-contents.title"),m=_||i,r=n.useMemo(()=>u.childrenToNodes(f),[f]),p=n.useMemo(()=>u.buildActiveTrail(r,o),[r,o]),L=n.useMemo(()=>({activeId:o,numbered:x,ariaLabel:m,activeTrail:p}),[o,x,m,p]);return e.jsxs(u.TableOfContentsContext.Provider,{value:L,children:[e.jsxs("div",{className:M.default(t.default["tedi-table-of-contents__bar"],{[t.default["tedi-table-of-contents__bar--static"]]:!O},q),children:[e.jsx(C.Text,{modifiers:"bold",className:t.default["tedi-table-of-contents__bar-title"],children:i}),e.jsx(T.CollapseButton,{open:l,onOpenChange:a,openText:s("open"),closeText:s("close"),underline:!1,"aria-haspopup":"dialog"})]}),e.jsx(c.Modal,{open:l,onToggle:a,children:e.jsxs(c.Modal.Content,{position:"bottom",fullscreen:"edge","aria-label":i,className:t.default["tedi-table-of-contents__sheet"],children:[e.jsx(c.Modal.Header,{closeButton:!1,children:e.jsxs("div",{className:t.default["tedi-table-of-contents__sheet-header"],children:[e.jsx(C.Text,{modifiers:"bold",className:t.default["tedi-table-of-contents__bar-title"],children:i}),e.jsx(T.CollapseButton,{open:l,onOpenChange:a,openText:s("open"),closeText:s("close"),underline:!1})]})}),e.jsx(c.Modal.Body,{children:e.jsx("div",{ref:h,className:t.default["tedi-table-of-contents"],children:e.jsx(y.TableOfContentsList,{nodes:r,heading:null})})})]})})]})};g.displayName="TableOfContentsCollapsible";exports.TableOfContentsCollapsible=g;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TableOfContentsProps } from '../../table-of-contents';
|
|
2
|
-
export interface TableOfContentsCollapsibleProps extends Pick<TableOfContentsProps, 'children' | 'heading' | '
|
|
2
|
+
export interface TableOfContentsCollapsibleProps extends Pick<TableOfContentsProps, 'children' | 'heading' | 'ariaLabel' | 'activeId' | 'numbered' | 'className'> {
|
|
3
3
|
/**
|
|
4
4
|
* Pin the bar to the bottom of the viewport. Set `false` to render it inline.
|
|
5
5
|
* @default true
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useState as
|
|
1
|
+
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import k from "../../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useState as B, useRef as E, useEffect as H, useMemo as f } from "react";
|
|
4
4
|
import { Text as T } from "../../../../base/typography/text/text.es.js";
|
|
5
5
|
import { CollapseButton as _ } from "../../../../buttons/collapse-button/collapse-button.es.js";
|
|
6
|
-
import { childrenToNodes as
|
|
6
|
+
import { childrenToNodes as j, buildActiveTrail as M, TableOfContentsContext as R } from "../../table-of-contents.es.js";
|
|
7
7
|
import t from "../../table-of-contents.module.scss.es.js";
|
|
8
|
-
import { TableOfContentsList as
|
|
9
|
-
import { useLabels as
|
|
10
|
-
import { Modal as
|
|
11
|
-
const
|
|
12
|
-
const { children: m, heading: b,
|
|
13
|
-
|
|
14
|
-
const d =
|
|
8
|
+
import { TableOfContentsList as A } from "../table-of-contents-list/table-of-contents-list.es.js";
|
|
9
|
+
import { useLabels as I } from "../../../../../providers/label-provider/use-labels.es.js";
|
|
10
|
+
import { Modal as r } from "../../../../overlays/modal/modal.es.js";
|
|
11
|
+
const P = (C) => {
|
|
12
|
+
const { children: m, heading: b, ariaLabel: N, activeId: l, numbered: p = !1, sticky: x = !0, className: L } = C, { getLabel: o } = I(), [n, s] = B(!1), u = E(null);
|
|
13
|
+
H(() => {
|
|
14
|
+
const d = u.current;
|
|
15
15
|
if (!n || !d) return;
|
|
16
|
-
const g = (
|
|
17
|
-
|
|
16
|
+
const g = (y) => {
|
|
17
|
+
y.target.closest("a, button") && s(!1);
|
|
18
18
|
};
|
|
19
19
|
return d.addEventListener("click", g), () => d.removeEventListener("click", g);
|
|
20
20
|
}, [n]);
|
|
21
|
-
const
|
|
22
|
-
() => ({ activeId:
|
|
23
|
-
[
|
|
24
|
-
)
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */
|
|
21
|
+
const a = (b === void 0 ? o("table-of-contents.title") : b) ?? o("table-of-contents.title"), h = N || a, c = f(() => j(m), [m]), v = f(() => M(c, l), [c, l]), O = f(
|
|
22
|
+
() => ({ activeId: l, numbered: p, ariaLabel: h, activeTrail: v }),
|
|
23
|
+
[l, p, h, v]
|
|
24
|
+
);
|
|
25
|
+
return /* @__PURE__ */ i(R.Provider, { value: O, children: [
|
|
26
|
+
/* @__PURE__ */ i(
|
|
27
27
|
"div",
|
|
28
28
|
{
|
|
29
|
-
className:
|
|
29
|
+
className: k(
|
|
30
30
|
t["tedi-table-of-contents__bar"],
|
|
31
|
-
{ [t["tedi-table-of-contents__bar--static"]]: !
|
|
32
|
-
|
|
31
|
+
{ [t["tedi-table-of-contents__bar--static"]]: !x },
|
|
32
|
+
L
|
|
33
33
|
),
|
|
34
34
|
children: [
|
|
35
|
-
/* @__PURE__ */ e(T, { modifiers: "bold", className: t["tedi-table-of-contents__bar-title"], children:
|
|
35
|
+
/* @__PURE__ */ e(T, { modifiers: "bold", className: t["tedi-table-of-contents__bar-title"], children: a }),
|
|
36
36
|
/* @__PURE__ */ e(
|
|
37
37
|
_,
|
|
38
38
|
{
|
|
39
39
|
open: n,
|
|
40
|
-
onOpenChange:
|
|
40
|
+
onOpenChange: s,
|
|
41
41
|
openText: o("open"),
|
|
42
42
|
closeText: o("close"),
|
|
43
43
|
underline: !1,
|
|
@@ -47,34 +47,34 @@ const w = (C) => {
|
|
|
47
47
|
]
|
|
48
48
|
}
|
|
49
49
|
),
|
|
50
|
-
/* @__PURE__ */ e(
|
|
51
|
-
|
|
50
|
+
/* @__PURE__ */ e(r, { open: n, onToggle: s, children: /* @__PURE__ */ i(
|
|
51
|
+
r.Content,
|
|
52
52
|
{
|
|
53
53
|
position: "bottom",
|
|
54
54
|
fullscreen: "edge",
|
|
55
|
-
"aria-label":
|
|
55
|
+
"aria-label": a,
|
|
56
56
|
className: t["tedi-table-of-contents__sheet"],
|
|
57
57
|
children: [
|
|
58
|
-
/* @__PURE__ */ e(
|
|
59
|
-
/* @__PURE__ */ e(T, { modifiers: "bold", className: t["tedi-table-of-contents__bar-title"], children:
|
|
58
|
+
/* @__PURE__ */ e(r.Header, { closeButton: !1, children: /* @__PURE__ */ i("div", { className: t["tedi-table-of-contents__sheet-header"], children: [
|
|
59
|
+
/* @__PURE__ */ e(T, { modifiers: "bold", className: t["tedi-table-of-contents__bar-title"], children: a }),
|
|
60
60
|
/* @__PURE__ */ e(
|
|
61
61
|
_,
|
|
62
62
|
{
|
|
63
63
|
open: n,
|
|
64
|
-
onOpenChange:
|
|
64
|
+
onOpenChange: s,
|
|
65
65
|
openText: o("open"),
|
|
66
66
|
closeText: o("close"),
|
|
67
67
|
underline: !1
|
|
68
68
|
}
|
|
69
69
|
)
|
|
70
70
|
] }) }),
|
|
71
|
-
/* @__PURE__ */ e(
|
|
71
|
+
/* @__PURE__ */ e(r.Body, { children: /* @__PURE__ */ e("div", { ref: u, className: t["tedi-table-of-contents"], children: /* @__PURE__ */ e(A, { nodes: c, heading: null }) }) })
|
|
72
72
|
]
|
|
73
73
|
}
|
|
74
74
|
) })
|
|
75
75
|
] });
|
|
76
76
|
};
|
|
77
|
-
|
|
77
|
+
P.displayName = "TableOfContentsCollapsible";
|
|
78
78
|
export {
|
|
79
|
-
|
|
79
|
+
P as TableOfContentsCollapsible
|
|
80
80
|
};
|
|
@@ -11,20 +11,10 @@ export interface TableOfContentsItemProps {
|
|
|
11
11
|
* `TableOfContents.Item` children, which become this item's sub-items.
|
|
12
12
|
*/
|
|
13
13
|
children?: React.ReactNode;
|
|
14
|
-
/**
|
|
15
|
-
* Validation state for multistep-form usage (only rendered with `showIcons`
|
|
16
|
-
* on the parent): `true` = valid, `false` = invalid, `undefined` = not yet
|
|
17
|
-
* validated.
|
|
18
|
-
*/
|
|
19
|
-
isValid?: boolean;
|
|
20
14
|
/**
|
|
21
15
|
* Render a separator below the item.
|
|
22
16
|
*/
|
|
23
17
|
separator?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Hide the validation glyph for this item even when `showIcons` is on.
|
|
26
|
-
*/
|
|
27
|
-
hideIcon?: boolean;
|
|
28
18
|
}
|
|
29
19
|
export declare const TableOfContentsItem: {
|
|
30
20
|
(_props: TableOfContentsItemProps): JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("../../../../../../../external/classnames/index.cjs.js"),i=require("react"),C=require("../../../../base/typography/heading/heading.cjs.js"),h=require("../../table-of-contents.cjs.js"),s=require("../../table-of-contents.module.scss.cjs.js"),L=require("../table-of-contents-row/table-of-contents-row.cjs.js"),O=require("../../../../../providers/label-provider/use-labels.cjs.js"),r=({nodes:d,heading:t})=>{const{numbered:c,headingLevel:u="h3",ariaLabel:n}=i.useContext(h.TableOfContentsContext),{getLabel:b}=O.useLabels(),l=i.useId(),f=c?"ol":"ul";return e.jsxs(e.Fragment,{children:[t&&e.jsx(C.Heading,{element:u,modifiers:"h4",id:l,className:s.default["tedi-table-of-contents__heading"],children:t}),e.jsx("nav",{"aria-labelledby":!n&&t?l:void 0,"aria-label":n||(t?void 0:b("table-of-contents.title")),children:e.jsx(f,{className:m.default(s.default["tedi-table-of-contents__list"],{[s.default["tedi-table-of-contents__list--headless"]]:!t}),children:d.map((a,o)=>e.jsx(L.TableOfContentsRow,{node:a,depth:1,index:o},a.id??o))})})]})};r.displayName="TableOfContentsList";exports.TableOfContentsList=r;
|
|
@@ -1,34 +1,43 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useContext as
|
|
4
|
-
import { Heading as
|
|
5
|
-
import { TableOfContentsContext as
|
|
1
|
+
import { jsxs as c, Fragment as b, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import p from "../../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useContext as h, useId as L } from "react";
|
|
4
|
+
import { Heading as u } from "../../../../base/typography/heading/heading.es.js";
|
|
5
|
+
import { TableOfContentsContext as C } from "../../table-of-contents.es.js";
|
|
6
6
|
import o from "../../table-of-contents.module.scss.es.js";
|
|
7
|
-
import { TableOfContentsRow as
|
|
8
|
-
import { useLabels as
|
|
9
|
-
const
|
|
10
|
-
const { numbered: r } =
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
t && /* @__PURE__ */ e(
|
|
7
|
+
import { TableOfContentsRow as _ } from "../table-of-contents-row/table-of-contents-row.es.js";
|
|
8
|
+
import { useLabels as v } from "../../../../../providers/label-provider/use-labels.es.js";
|
|
9
|
+
const x = ({ nodes: n, heading: t }) => {
|
|
10
|
+
const { numbered: r, headingLevel: m = "h3", ariaLabel: s } = h(C), { getLabel: d } = v(), l = L(), f = r ? "ol" : "ul";
|
|
11
|
+
return /* @__PURE__ */ c(b, { children: [
|
|
12
|
+
t && /* @__PURE__ */ e(
|
|
13
|
+
u,
|
|
14
|
+
{
|
|
15
|
+
element: m,
|
|
16
|
+
modifiers: "h4",
|
|
17
|
+
id: l,
|
|
18
|
+
className: o["tedi-table-of-contents__heading"],
|
|
19
|
+
children: t
|
|
20
|
+
}
|
|
21
|
+
),
|
|
13
22
|
/* @__PURE__ */ e(
|
|
14
23
|
"nav",
|
|
15
24
|
{
|
|
16
|
-
"aria-labelledby": t ?
|
|
17
|
-
"aria-label": t ? void 0 :
|
|
25
|
+
"aria-labelledby": !s && t ? l : void 0,
|
|
26
|
+
"aria-label": s || (t ? void 0 : d("table-of-contents.title")),
|
|
18
27
|
children: /* @__PURE__ */ e(
|
|
19
|
-
|
|
28
|
+
f,
|
|
20
29
|
{
|
|
21
|
-
className:
|
|
30
|
+
className: p(o["tedi-table-of-contents__list"], {
|
|
22
31
|
[o["tedi-table-of-contents__list--headless"]]: !t
|
|
23
32
|
}),
|
|
24
|
-
children:
|
|
33
|
+
children: n.map((a, i) => /* @__PURE__ */ e(_, { node: a, depth: 1, index: i }, a.id ?? i))
|
|
25
34
|
}
|
|
26
35
|
)
|
|
27
36
|
}
|
|
28
37
|
)
|
|
29
38
|
] });
|
|
30
39
|
};
|
|
31
|
-
|
|
40
|
+
x.displayName = "TableOfContentsList";
|
|
32
41
|
export {
|
|
33
|
-
|
|
42
|
+
x as TableOfContentsList
|
|
34
43
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("../../../../../../../external/classnames/index.cjs.js"),N=require("react"),T=require("../../../../misc/separator/separator.cjs.js"),w=require("../../table-of-contents.cjs.js"),t=require("../../table-of-contents.module.scss.cjs.js"),r=({node:m,depth:c,index:i,numberPrefix:a})=>{const{activeId:_,numbered:o,activeTrail:p}=N.useContext(w.TableOfContentsContext),{id:n,content:x,children:s,separator:j}=m,C=!!(s!=null&&s.length),d=!!n&&n===_,h=C&&!!n&&p.has(n),O=Math.min(c,2),l=a?`${a}.${i+1}`:`${i+1}`,v=a?l:`${l}.`,q=o?"ol":"ul";return e.jsxs("li",{"aria-current":d?"true":void 0,className:b.default(t.default["tedi-table-of-contents__item"],{[t.default["tedi-table-of-contents__item--selected"]]:d}),children:[e.jsxs("span",{className:b.default(t.default["tedi-table-of-contents__row"],t.default[`tedi-table-of-contents__row--level-${O}`]),children:[o&&e.jsx("span",{className:t.default["tedi-table-of-contents__number"],"aria-hidden":"true",children:v}),e.jsx("span",{className:t.default["tedi-table-of-contents__content"],children:x})]}),h&&e.jsx(q,{className:t.default["tedi-table-of-contents__group"],children:s.map((u,f)=>e.jsx(r,{node:u,depth:c+1,index:f,numberPrefix:o?l:void 0},u.id??f))}),j&&e.jsx(T.Separator,{})]})};r.displayName="TableOfContentsRow";exports.TableOfContentsRow=r;
|
|
@@ -1,54 +1,40 @@
|
|
|
1
|
-
import { jsxs as p, jsx as
|
|
2
|
-
import
|
|
3
|
-
import { useContext as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const _ = ({ node: u, depth: r, index: i, numberPrefix: a }) => {
|
|
10
|
-
const { activeId: h, showIcons: v, numbered: l, activeTrail: N } = j(S), { getLabel: w } = k(), { id: n, content: C, children: s, isValid: t, separator: g, hideIcon: $ } = u, O = !!(s != null && s.length), m = !!n && n === h, T = O && !!n && N.has(n), x = Math.min(r, 2), c = a ? `${a}.${i + 1}` : `${i + 1}`, y = a ? c : `${c}.`, I = l ? "ol" : "ul";
|
|
1
|
+
import { jsxs as p, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import f from "../../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useContext as x } from "react";
|
|
4
|
+
import { Separator as g } from "../../../../misc/separator/separator.es.js";
|
|
5
|
+
import { TableOfContentsContext as j } from "../../table-of-contents.es.js";
|
|
6
|
+
import t from "../../table-of-contents.module.scss.es.js";
|
|
7
|
+
const _ = ({ node: b, depth: i, index: l, numberPrefix: s }) => {
|
|
8
|
+
const { activeId: u, numbered: a, activeTrail: h } = x(j), { id: o, content: N, children: n, separator: v } = b, C = !!(n != null && n.length), c = !!o && o === u, $ = C && !!o && h.has(o), w = Math.min(i, 2), r = s ? `${s}.${l + 1}` : `${l + 1}`, O = s ? r : `${r}.`, T = a ? "ol" : "ul";
|
|
11
9
|
return /* @__PURE__ */ p(
|
|
12
10
|
"li",
|
|
13
11
|
{
|
|
14
|
-
"aria-current":
|
|
15
|
-
className:
|
|
16
|
-
[
|
|
12
|
+
"aria-current": c ? "true" : void 0,
|
|
13
|
+
className: f(t["tedi-table-of-contents__item"], {
|
|
14
|
+
[t["tedi-table-of-contents__item--selected"]]: c
|
|
17
15
|
}),
|
|
18
16
|
children: [
|
|
19
17
|
/* @__PURE__ */ p(
|
|
20
18
|
"span",
|
|
21
19
|
{
|
|
22
|
-
className:
|
|
20
|
+
className: f(t["tedi-table-of-contents__row"], t[`tedi-table-of-contents__row--level-${w}`]),
|
|
23
21
|
children: [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
className: e["tedi-table-of-contents__icon"],
|
|
28
|
-
name: t === !1 ? "warning" : t === !0 ? "check" : "circle",
|
|
29
|
-
color: t === !1 ? "danger" : t === !0 ? "success" : "tertiary",
|
|
30
|
-
label: w(
|
|
31
|
-
t === !1 ? "table-of-contents.step-invalid" : t === !0 ? "table-of-contents.step-valid" : "table-of-contents.step-incomplete"
|
|
32
|
-
),
|
|
33
|
-
size: 18
|
|
34
|
-
}
|
|
35
|
-
),
|
|
36
|
-
l && /* @__PURE__ */ o("span", { className: e["tedi-table-of-contents__number"], "aria-hidden": "true", children: y }),
|
|
37
|
-
/* @__PURE__ */ o("span", { className: e["tedi-table-of-contents__content"], children: C })
|
|
22
|
+
a && /* @__PURE__ */ e("span", { className: t["tedi-table-of-contents__number"], "aria-hidden": "true", children: O }),
|
|
23
|
+
/* @__PURE__ */ e("span", { className: t["tedi-table-of-contents__content"], children: N })
|
|
38
24
|
]
|
|
39
25
|
}
|
|
40
26
|
),
|
|
41
|
-
|
|
27
|
+
$ && /* @__PURE__ */ e(T, { className: t["tedi-table-of-contents__group"], children: n.map((m, d) => /* @__PURE__ */ e(
|
|
42
28
|
_,
|
|
43
29
|
{
|
|
44
|
-
node:
|
|
45
|
-
depth:
|
|
46
|
-
index:
|
|
47
|
-
numberPrefix:
|
|
30
|
+
node: m,
|
|
31
|
+
depth: i + 1,
|
|
32
|
+
index: d,
|
|
33
|
+
numberPrefix: a ? r : void 0
|
|
48
34
|
},
|
|
49
|
-
|
|
35
|
+
m.id ?? d
|
|
50
36
|
)) }),
|
|
51
|
-
|
|
37
|
+
v && /* @__PURE__ */ e(g, {})
|
|
52
38
|
]
|
|
53
39
|
}
|
|
54
40
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),g=require("../../../../../external/classnames/index.cjs.js"),l=require("react"),S=require("../../misc/affix/affix.cjs.js"),k=require("./components/table-of-contents-collapsible/table-of-contents-collapsible.cjs.js"),y=require("./components/table-of-contents-item/table-of-contents-item.cjs.js"),M=require("./components/table-of-contents-list/table-of-contents-list.cjs.js"),b=require("./table-of-contents.module.scss.cjs.js"),w=require("../../../providers/label-provider/use-labels.cjs.js"),E=require("../../content/card/card.cjs.js"),P=require("../../content/card/card-content/card-content.cjs.js"),q=l.createContext({activeTrail:new Set}),C=n=>l.isValidElement(n)&&n.type===y.TableOfContentsItem,m=n=>l.Children.toArray(n).filter(C).map(c=>{const{id:s,separator:r,children:a}=c.props,o=l.Children.toArray(a),e=o.filter(C),i=o.filter(d=>!C(d));return{id:s,separator:r,content:t.jsx(t.Fragment,{children:i}),children:e.length?m(a):void 0}}),j=(n,c)=>{const s=new Set;if(!c)return s;const r=(a,o)=>{for(const e of a){const i=e.id?[...o,e.id]:o;if(e.id===c||e.children&&r(e.children,i))return i.forEach(d=>s.add(d)),!0}return!1};return r(n,[]),s};function u(n){const{getLabel:c}=w.useLabels(),{children:s,heading:r,headingLevel:a="h3",ariaLabel:o,activeId:e,numbered:i=!1,sticky:d=!0,variant:h="default",padding:p,className:N}=n,L=r===void 0?c("table-of-contents.title"):r,f=l.useMemo(()=>m(s),[s]),v=l.useMemo(()=>j(f,e),[f,e]),A=l.useMemo(()=>({activeId:e,numbered:i,headingLevel:a,ariaLabel:o,activeTrail:v}),[e,i,a,o,v]),I=p!==void 0?{"--tedi-table-of-contents-padding":`${p}rem`}:void 0,x=t.jsx("div",{className:g.default(b.default["tedi-table-of-contents"],{[b.default["tedi-table-of-contents--transparent"]]:h==="transparent"}),style:I,children:t.jsx(M.TableOfContentsList,{nodes:f,heading:L})}),T=g.default({[b.default["tedi-table-of-contents--sticky"]]:d},N),O=h==="transparent"?t.jsx("div",{className:T,children:x}):t.jsx(E.Card,{className:T,children:t.jsx(P.CardContent,{padding:0,children:x})});return t.jsx(q.Provider,{value:A,children:d?t.jsx(S.Affix,{position:"sticky",top:1.5,bottom:1.5,children:O}):O})}u.displayName="TableOfContents";u.Item=y.TableOfContentsItem;u.Collapsible=k.TableOfContentsCollapsible;exports.TableOfContents=u;exports.TableOfContentsContext=q;exports.buildActiveTrail=j;exports.childrenToNodes=m;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { TableOfContentsItemProps } from './components/table-of-contents-item/table-of-contents-item';
|
|
3
|
+
/** Semantic level of the `TableOfContents` heading element. */
|
|
4
|
+
export type TableOfContentsHeadingLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
3
5
|
export interface TableOfContentsProps {
|
|
4
6
|
/**
|
|
5
7
|
* `TableOfContents.Item` elements. An item's non-`Item` children are its
|
|
@@ -12,6 +14,19 @@ export interface TableOfContentsProps {
|
|
|
12
14
|
* the navigation keeps an accessible name via `aria-label`).
|
|
13
15
|
*/
|
|
14
16
|
heading?: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Configurable semantic heading level (`h1`–`h6`); the visual style stays H4 regardless. Set it
|
|
19
|
+
* to match the surrounding page's heading outline and avoid skipped heading levels (WCAG 1.3.1).
|
|
20
|
+
* Ignored when the list is headless.
|
|
21
|
+
* @default h3
|
|
22
|
+
*/
|
|
23
|
+
headingLevel?: TableOfContentsHeadingLevel;
|
|
24
|
+
/**
|
|
25
|
+
* Override the navigation landmark's accessible name. When empty, the `<nav>` falls back to the
|
|
26
|
+
* heading (via `aria-labelledby`), or the localised title when headless. Use it to disambiguate
|
|
27
|
+
* multiple tables of contents on the same page.
|
|
28
|
+
*/
|
|
29
|
+
ariaLabel?: string;
|
|
15
30
|
/**
|
|
16
31
|
* Visual variant:
|
|
17
32
|
* - `default` — rendered inside a bordered `Card`.
|
|
@@ -32,13 +47,6 @@ export interface TableOfContentsProps {
|
|
|
32
47
|
* children.
|
|
33
48
|
*/
|
|
34
49
|
activeId?: string;
|
|
35
|
-
/**
|
|
36
|
-
* Show a validation glyph before each item (multistep-form usage). Each state uses a distinct
|
|
37
|
-
* icon shape (not colour alone) with a localised text alternative: a check for `isValid === true`,
|
|
38
|
-
* an empty circle for `undefined` (not completed), and a warning for `isValid === false`.
|
|
39
|
-
* @default false
|
|
40
|
-
*/
|
|
41
|
-
showIcons?: boolean;
|
|
42
50
|
/**
|
|
43
51
|
* Render the list as an ordered list with auto-generated hierarchical numbers
|
|
44
52
|
* (`1.`, `2.`, `2.1`, …) shown before each item.
|
|
@@ -60,14 +68,13 @@ export interface TableOfContentsNode {
|
|
|
60
68
|
id?: string;
|
|
61
69
|
content: ReactNode;
|
|
62
70
|
children?: TableOfContentsNode[];
|
|
63
|
-
isValid?: boolean;
|
|
64
71
|
separator?: boolean;
|
|
65
|
-
hideIcon?: boolean;
|
|
66
72
|
}
|
|
67
73
|
interface TableOfContentsContextValue {
|
|
68
74
|
activeId?: string;
|
|
69
|
-
showIcons?: boolean;
|
|
70
75
|
numbered?: boolean;
|
|
76
|
+
headingLevel?: TableOfContentsHeadingLevel;
|
|
77
|
+
ariaLabel?: string;
|
|
71
78
|
activeTrail: Set<string>;
|
|
72
79
|
}
|
|
73
80
|
export declare const TableOfContentsContext: import('react').Context<TableOfContentsContextValue>;
|
|
@@ -1,71 +1,70 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { Affix as
|
|
5
|
-
import { TableOfContentsCollapsible as
|
|
1
|
+
import { jsx as r, Fragment as w } from "react/jsx-runtime";
|
|
2
|
+
import T from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useMemo as m, createContext as E, Children as N, isValidElement as S } from "react";
|
|
4
|
+
import { Affix as V } from "../../misc/affix/affix.es.js";
|
|
5
|
+
import { TableOfContentsCollapsible as j } from "./components/table-of-contents-collapsible/table-of-contents-collapsible.es.js";
|
|
6
6
|
import { TableOfContentsItem as x } from "./components/table-of-contents-item/table-of-contents-item.es.js";
|
|
7
|
-
import { TableOfContentsList as
|
|
8
|
-
import
|
|
9
|
-
import { useLabels as
|
|
10
|
-
import { Card as
|
|
11
|
-
import { CardContent as
|
|
12
|
-
const
|
|
7
|
+
import { TableOfContentsList as F } from "./components/table-of-contents-list/table-of-contents-list.es.js";
|
|
8
|
+
import f from "./table-of-contents.module.scss.es.js";
|
|
9
|
+
import { useLabels as H } from "../../../providers/label-provider/use-labels.es.js";
|
|
10
|
+
import { Card as M } from "../../content/card/card.es.js";
|
|
11
|
+
import { CardContent as P } from "../../content/card/card-content/card-content.es.js";
|
|
12
|
+
const $ = E({
|
|
13
13
|
activeTrail: /* @__PURE__ */ new Set()
|
|
14
|
-
}),
|
|
15
|
-
const { id: n,
|
|
14
|
+
}), p = (e) => S(e) && e.type === x, O = (e) => N.toArray(e).filter(p).map((l) => {
|
|
15
|
+
const { id: n, separator: i, children: s } = l.props, o = N.toArray(s), t = o.filter(p), a = o.filter((c) => !p(c));
|
|
16
16
|
return {
|
|
17
17
|
id: n,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
content: /* @__PURE__ */ i(w, { children: d }),
|
|
22
|
-
children: c.length ? I(t) : void 0
|
|
18
|
+
separator: i,
|
|
19
|
+
content: /* @__PURE__ */ r(w, { children: a }),
|
|
20
|
+
children: t.length ? O(s) : void 0
|
|
23
21
|
};
|
|
24
|
-
}),
|
|
22
|
+
}), q = (e, l) => {
|
|
25
23
|
const n = /* @__PURE__ */ new Set();
|
|
26
24
|
if (!l) return n;
|
|
27
|
-
const
|
|
28
|
-
for (const t of
|
|
29
|
-
const
|
|
30
|
-
if (t.id === l || t.children &&
|
|
31
|
-
return
|
|
25
|
+
const i = (s, o) => {
|
|
26
|
+
for (const t of s) {
|
|
27
|
+
const a = t.id ? [...o, t.id] : o;
|
|
28
|
+
if (t.id === l || t.children && i(t.children, a))
|
|
29
|
+
return a.forEach((c) => n.add(c)), !0;
|
|
32
30
|
}
|
|
33
31
|
return !1;
|
|
34
32
|
};
|
|
35
|
-
return
|
|
33
|
+
return i(e, []), n;
|
|
36
34
|
};
|
|
37
|
-
function
|
|
38
|
-
const { getLabel: l } =
|
|
35
|
+
function h(e) {
|
|
36
|
+
const { getLabel: l } = H(), {
|
|
39
37
|
children: n,
|
|
40
|
-
heading:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
heading: i,
|
|
39
|
+
headingLevel: s = "h3",
|
|
40
|
+
ariaLabel: o,
|
|
41
|
+
activeId: t,
|
|
42
|
+
numbered: a = !1,
|
|
43
|
+
sticky: c = !0,
|
|
44
|
+
variant: b = "default",
|
|
45
|
+
padding: u,
|
|
46
|
+
className: A
|
|
47
|
+
} = e, L = i === void 0 ? l("table-of-contents.title") : i, d = m(() => O(n), [n]), C = m(() => q(d, t), [d, t]), k = m(
|
|
48
|
+
() => ({ activeId: t, numbered: a, headingLevel: s, ariaLabel: o, activeTrail: C }),
|
|
49
|
+
[t, a, s, o, C]
|
|
50
|
+
), I = u !== void 0 ? { "--tedi-table-of-contents-padding": `${u}rem` } : void 0, v = /* @__PURE__ */ r(
|
|
52
51
|
"div",
|
|
53
52
|
{
|
|
54
|
-
className:
|
|
55
|
-
[
|
|
53
|
+
className: T(f["tedi-table-of-contents"], {
|
|
54
|
+
[f["tedi-table-of-contents--transparent"]]: b === "transparent"
|
|
56
55
|
}),
|
|
57
|
-
style:
|
|
58
|
-
children: /* @__PURE__ */
|
|
56
|
+
style: I,
|
|
57
|
+
children: /* @__PURE__ */ r(F, { nodes: d, heading: L })
|
|
59
58
|
}
|
|
60
|
-
), y =
|
|
61
|
-
return /* @__PURE__ */
|
|
59
|
+
), y = T({ [f["tedi-table-of-contents--sticky"]]: c }, A), g = b === "transparent" ? /* @__PURE__ */ r("div", { className: y, children: v }) : /* @__PURE__ */ r(M, { className: y, children: /* @__PURE__ */ r(P, { padding: 0, children: v }) });
|
|
60
|
+
return /* @__PURE__ */ r($.Provider, { value: k, children: c ? /* @__PURE__ */ r(V, { position: "sticky", top: 1.5, bottom: 1.5, children: g }) : g });
|
|
62
61
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
h.displayName = "TableOfContents";
|
|
63
|
+
h.Item = x;
|
|
64
|
+
h.Collapsible = j;
|
|
66
65
|
export {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
h as TableOfContents,
|
|
67
|
+
$ as TableOfContentsContext,
|
|
68
|
+
q as buildActiveTrail,
|
|
69
|
+
O as childrenToNodes
|
|
71
70
|
};
|
package/src/tedi/components/navigation/table-of-contents/table-of-contents.module.scss.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={"tedi-table-of-contents":"tedi-table-of-contents-ce55e86d","tedi-table-of-contents--transparent":"tedi-table-of-contents--transparent-067ea2c2","tedi-table-of-contents__list":"tedi-table-of-contents__list-94025876","tedi-table-of-contents--sticky":"tedi-table-of-contents--sticky-1ee87047","tedi-table-of-contents__heading":"tedi-table-of-contents__heading-c6b7a6df","tedi-table-of-contents__group":"tedi-table-of-contents__group-590e4963","tedi-table-of-contents__list--headless":"tedi-table-of-contents__list--headless-99c1bab5","tedi-table-of-contents__item":"tedi-table-of-contents__item-29f072b5","tedi-table-of-contents__row":"tedi-table-of-contents__row-fb686650","tedi-table-of-contents__row--level-2":"tedi-table-of-contents__row--level-2-4fec675b","tedi-table-of-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={"tedi-table-of-contents":"tedi-table-of-contents-ce55e86d","tedi-table-of-contents--transparent":"tedi-table-of-contents--transparent-067ea2c2","tedi-table-of-contents__list":"tedi-table-of-contents__list-94025876","tedi-table-of-contents--sticky":"tedi-table-of-contents--sticky-1ee87047","tedi-table-of-contents__heading":"tedi-table-of-contents__heading-c6b7a6df","tedi-table-of-contents__group":"tedi-table-of-contents__group-590e4963","tedi-table-of-contents__list--headless":"tedi-table-of-contents__list--headless-99c1bab5","tedi-table-of-contents__item":"tedi-table-of-contents__item-29f072b5","tedi-table-of-contents__row":"tedi-table-of-contents__row-fb686650","tedi-table-of-contents__row--level-2":"tedi-table-of-contents__row--level-2-4fec675b","tedi-table-of-contents__number":"tedi-table-of-contents__number-693b03b7","tedi-table-of-contents__content":"tedi-table-of-contents__content-8a05ad59","tedi-table-of-contents__item--selected":"tedi-table-of-contents__item--selected-632958d1","tedi-table-of-contents__bar":"tedi-table-of-contents__bar-f4daef0b","tedi-table-of-contents__bar--static":"tedi-table-of-contents__bar--static-f919cf73","tedi-table-of-contents__bar-title":"tedi-table-of-contents__bar-title-b82ab4ed","tedi-table-of-contents__sheet":"tedi-table-of-contents__sheet-16e41b54","tedi-table-of-contents__sheet-header":"tedi-table-of-contents__sheet-header-ec904c54"};exports.default=t;
|
package/src/tedi/components/navigation/table-of-contents/table-of-contents.module.scss.es.js
CHANGED
|
@@ -9,7 +9,6 @@ const t = {
|
|
|
9
9
|
"tedi-table-of-contents__item": "tedi-table-of-contents__item-29f072b5",
|
|
10
10
|
"tedi-table-of-contents__row": "tedi-table-of-contents__row-fb686650",
|
|
11
11
|
"tedi-table-of-contents__row--level-2": "tedi-table-of-contents__row--level-2-4fec675b",
|
|
12
|
-
"tedi-table-of-contents__icon": "tedi-table-of-contents__icon-5bb71193",
|
|
13
12
|
"tedi-table-of-contents__number": "tedi-table-of-contents__number-693b03b7",
|
|
14
13
|
"tedi-table-of-contents__content": "tedi-table-of-contents__content-8a05ad59",
|
|
15
14
|
"tedi-table-of-contents__item--selected": "tedi-table-of-contents__item--selected-632958d1",
|