@tedi-design-system/react 18.0.0-rc.29 → 18.0.0-rc.30

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.
Files changed (29) hide show
  1. package/bundle-stats.html +1 -1
  2. package/index.css +1 -1
  3. package/package.json +1 -1
  4. package/src/community/components/table-of-contents/table-of-contents-item.d.ts +6 -0
  5. package/src/community/components/table-of-contents/table-of-contents.d.ts +5 -0
  6. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-collapsible/table-of-contents-collapsible.cjs.js +1 -0
  7. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-collapsible/table-of-contents-collapsible.d.ts +17 -0
  8. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-collapsible/table-of-contents-collapsible.es.js +80 -0
  9. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-item/table-of-contents-item.cjs.js +1 -0
  10. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-item/table-of-contents-item.d.ts +33 -0
  11. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-item/table-of-contents-item.es.js +5 -0
  12. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-list/table-of-contents-list.cjs.js +1 -0
  13. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-list/table-of-contents-list.d.ts +9 -0
  14. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-list/table-of-contents-list.es.js +34 -0
  15. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.cjs.js +1 -0
  16. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.d.ts +13 -0
  17. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.es.js +59 -0
  18. package/src/tedi/components/navigation/table-of-contents/index.d.ts +3 -0
  19. package/src/tedi/components/navigation/table-of-contents/table-of-contents.cjs.js +1 -0
  20. package/src/tedi/components/navigation/table-of-contents/table-of-contents.d.ts +88 -0
  21. package/src/tedi/components/navigation/table-of-contents/table-of-contents.es.js +71 -0
  22. package/src/tedi/components/navigation/table-of-contents/table-of-contents.module.scss.cjs.js +1 -0
  23. package/src/tedi/components/navigation/table-of-contents/table-of-contents.module.scss.es.js +24 -0
  24. package/src/tedi/index.d.ts +1 -0
  25. package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
  26. package/src/tedi/providers/label-provider/labels-map.d.ts +21 -0
  27. package/src/tedi/providers/label-provider/labels-map.es.js +21 -0
  28. package/tedi.cjs.js +1 -1
  29. package/tedi.es.js +110 -101
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tedi-design-system/react",
3
- "version": "18.0.0-rc.29",
3
+ "version": "18.0.0-rc.30",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -18,6 +18,9 @@ export type TableOfContentsItemConditionalTypes = {
18
18
  */
19
19
  children: TableOfContentsItemProps[];
20
20
  };
21
+ /**
22
+ * @deprecated Use TableOfContents from `@tedi-design-system/react/tedi` instead.
23
+ */
21
24
  export type TableOfContentsItemProps = TableOfContentsItemConditionalTypes & {
22
25
  /**
23
26
  * Content should generally use the anchor or button element
@@ -42,6 +45,9 @@ export type TableOfContentsItemProps = TableOfContentsItemConditionalTypes & {
42
45
  */
43
46
  hideIcon?: boolean;
44
47
  };
48
+ /**
49
+ * @deprecated Use TableOfContents from `@tedi-design-system/react/tedi` instead.
50
+ */
45
51
  export declare function TableOfContentsItem(props: TableOfContentsItemProps & {
46
52
  handleCloseModal: () => void;
47
53
  }): import("react/jsx-runtime").JSX.Element;
@@ -2,6 +2,9 @@ import { default as React } from 'react';
2
2
  import { Layouts } from '../../helpers';
3
3
  import { ModalProps, ModalProviderProps } from '../modal';
4
4
  import { TableOfContentsItemProps } from './table-of-contents-item';
5
+ /**
6
+ * @deprecated Use TableOfContents from `@tedi-design-system/react/tedi` instead.
7
+ */
5
8
  export interface TableOfContentsProps {
6
9
  /**
7
10
  * List of items to be shown in the table of contents
@@ -70,6 +73,8 @@ export declare const TableOfContentsContext: React.Context<TableOfContentsContex
70
73
  * More info <a href="https://github.com/gettalong/kramdown/issues/215" target="_blank">here</a> and <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=262171" target="_blank">here</a>.<br /><br />
71
74
  * When used to keep track of multistep form progress, usage on `showIcons={true}` is recommended. Keep in mind that `isValid` property is optional and can be undefined to show not validated steps. <br />
72
75
  * Also it is possible to use disabled-text as item content, to show that user can't skip to next step. <br /><br />
76
+ *
77
+ * @deprecated Use TableOfContents from `@tedi-design-system/react/tedi` instead.
73
78
  */
74
79
  export declare const TableOfContents: (props: TableOfContentsProps) => import("react/jsx-runtime").JSX.Element;
75
80
  export default TableOfContents;
@@ -0,0 +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"),L=require("../table-of-contents-list/table-of-contents-list.cjs.js"),y=require("../../../../../providers/label-provider/use-labels.cjs.js"),i=require("../../../../overlays/modal/modal.cjs.js"),g=j=>{const{children:f,heading:b,activeId:o,showIcons:x=!1,numbered:h=!1,sticky:_=!0,className:O}=j,{getLabel:s}=y.useLabels(),[l,a]=n.useState(!1),m=n.useRef(null);n.useEffect(()=>{const d=m.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 c=n.useMemo(()=>u.childrenToNodes(f),[f]),p=n.useMemo(()=>u.buildActiveTrail(c,o),[c,o]),q=n.useMemo(()=>({activeId:o,showIcons:x,numbered:h,activeTrail:p}),[o,x,h,p]),r=(b===void 0?s("table-of-contents.title"):b)??s("table-of-contents.title");return e.jsxs(u.TableOfContentsContext.Provider,{value:q,children:[e.jsxs("div",{className:M.default(t.default["tedi-table-of-contents__bar"],{[t.default["tedi-table-of-contents__bar--static"]]:!_},O),children:[e.jsx(C.Text,{modifiers:"bold",className:t.default["tedi-table-of-contents__bar-title"],children:r}),e.jsx(T.CollapseButton,{open:l,onOpenChange:a,openText:s("open"),closeText:s("close"),underline:!1,"aria-haspopup":"dialog"})]}),e.jsx(i.Modal,{open:l,onToggle:a,children:e.jsxs(i.Modal.Content,{position:"bottom",fullscreen:"edge","aria-label":r,className:t.default["tedi-table-of-contents__sheet"],children:[e.jsx(i.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:r}),e.jsx(T.CollapseButton,{open:l,onOpenChange:a,openText:s("open"),closeText:s("close"),underline:!1})]})}),e.jsx(i.Modal.Body,{children:e.jsx("div",{ref:m,className:t.default["tedi-table-of-contents"],children:e.jsx(L.TableOfContentsList,{nodes:c,heading:null})})})]})})]})};g.displayName="TableOfContentsCollapsible";exports.TableOfContentsCollapsible=g;
@@ -0,0 +1,17 @@
1
+ import { TableOfContentsProps } from '../../table-of-contents';
2
+ export interface TableOfContentsCollapsibleProps extends Pick<TableOfContentsProps, 'children' | 'heading' | 'activeId' | 'showIcons' | 'numbered' | 'className'> {
3
+ /**
4
+ * Pin the bar to the bottom of the viewport. Set `false` to render it inline.
5
+ * @default true
6
+ */
7
+ sticky?: boolean;
8
+ }
9
+ /**
10
+ * Mobile variant of `TableOfContents`: a bottom bar that opens the list in a bottom-sheet overlay.
11
+ * Same `TableOfContents.Item` children as the desktop card; render it on small viewports.
12
+ */
13
+ export declare const TableOfContentsCollapsible: {
14
+ (props: TableOfContentsCollapsibleProps): JSX.Element;
15
+ displayName: string;
16
+ };
17
+ export default TableOfContentsCollapsible;
@@ -0,0 +1,80 @@
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import y from "../../../../../../../external/classnames/index.es.js";
3
+ import { useState as k, useRef as B, useEffect as E, useMemo as f } from "react";
4
+ import { Text as T } from "../../../../base/typography/text/text.es.js";
5
+ import { CollapseButton as _ } from "../../../../buttons/collapse-button/collapse-button.es.js";
6
+ import { childrenToNodes as H, buildActiveTrail as j, TableOfContentsContext as I } from "../../table-of-contents.es.js";
7
+ import t from "../../table-of-contents.module.scss.es.js";
8
+ import { TableOfContentsList as M } from "../table-of-contents-list/table-of-contents-list.es.js";
9
+ import { useLabels as R } from "../../../../../providers/label-provider/use-labels.es.js";
10
+ import { Modal as i } from "../../../../overlays/modal/modal.es.js";
11
+ const w = (C) => {
12
+ const { children: m, heading: b, activeId: s, showIcons: p = !1, numbered: u = !1, sticky: N = !0, className: x } = C, { getLabel: o } = R(), [n, l] = k(!1), h = B(null);
13
+ E(() => {
14
+ const d = h.current;
15
+ if (!n || !d) return;
16
+ const g = (L) => {
17
+ L.target.closest("a, button") && l(!1);
18
+ };
19
+ return d.addEventListener("click", g), () => d.removeEventListener("click", g);
20
+ }, [n]);
21
+ const r = f(() => H(m), [m]), v = f(() => j(r, s), [r, s]), O = f(
22
+ () => ({ activeId: s, showIcons: p, numbered: u, activeTrail: v }),
23
+ [s, p, u, v]
24
+ ), c = (b === void 0 ? o("table-of-contents.title") : b) ?? o("table-of-contents.title");
25
+ return /* @__PURE__ */ a(I.Provider, { value: O, children: [
26
+ /* @__PURE__ */ a(
27
+ "div",
28
+ {
29
+ className: y(
30
+ t["tedi-table-of-contents__bar"],
31
+ { [t["tedi-table-of-contents__bar--static"]]: !N },
32
+ x
33
+ ),
34
+ children: [
35
+ /* @__PURE__ */ e(T, { modifiers: "bold", className: t["tedi-table-of-contents__bar-title"], children: c }),
36
+ /* @__PURE__ */ e(
37
+ _,
38
+ {
39
+ open: n,
40
+ onOpenChange: l,
41
+ openText: o("open"),
42
+ closeText: o("close"),
43
+ underline: !1,
44
+ "aria-haspopup": "dialog"
45
+ }
46
+ )
47
+ ]
48
+ }
49
+ ),
50
+ /* @__PURE__ */ e(i, { open: n, onToggle: l, children: /* @__PURE__ */ a(
51
+ i.Content,
52
+ {
53
+ position: "bottom",
54
+ fullscreen: "edge",
55
+ "aria-label": c,
56
+ className: t["tedi-table-of-contents__sheet"],
57
+ children: [
58
+ /* @__PURE__ */ e(i.Header, { closeButton: !1, children: /* @__PURE__ */ a("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: c }),
60
+ /* @__PURE__ */ e(
61
+ _,
62
+ {
63
+ open: n,
64
+ onOpenChange: l,
65
+ openText: o("open"),
66
+ closeText: o("close"),
67
+ underline: !1
68
+ }
69
+ )
70
+ ] }) }),
71
+ /* @__PURE__ */ e(i.Body, { children: /* @__PURE__ */ e("div", { ref: h, className: t["tedi-table-of-contents"], children: /* @__PURE__ */ e(M, { nodes: r, heading: null }) }) })
72
+ ]
73
+ }
74
+ ) })
75
+ ] });
76
+ };
77
+ w.displayName = "TableOfContentsCollapsible";
78
+ export {
79
+ w as TableOfContentsCollapsible
80
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=t=>null;e.displayName="TableOfContentsItem";exports.TableOfContentsItem=e;
@@ -0,0 +1,33 @@
1
+ import { default as React } from 'react';
2
+ export interface TableOfContentsItemProps {
3
+ /**
4
+ * Unique id. Required to mark the item active (via the parent's `activeId`)
5
+ * and to be the parent of nested items.
6
+ */
7
+ id?: string;
8
+ /**
9
+ * The item's link / label (a `Link`, `Anchor`, `Button`, etc. — pass
10
+ * `underline={false}` on a `Link` to match the design) plus any nested
11
+ * `TableOfContents.Item` children, which become this item's sub-items.
12
+ */
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
+ /**
21
+ * Render a separator below the item.
22
+ */
23
+ separator?: boolean;
24
+ /**
25
+ * Hide the validation glyph for this item even when `showIcons` is on.
26
+ */
27
+ hideIcon?: boolean;
28
+ }
29
+ export declare const TableOfContentsItem: {
30
+ (_props: TableOfContentsItemProps): JSX.Element | null;
31
+ displayName: string;
32
+ };
33
+ export default TableOfContentsItem;
@@ -0,0 +1,5 @@
1
+ const e = (t) => null;
2
+ e.displayName = "TableOfContentsItem";
3
+ export {
4
+ e as TableOfContentsItem
5
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("../../../../../../../external/classnames/index.cjs.js"),a=require("react"),f=require("../../../../base/typography/heading/heading.cjs.js"),m=require("../../table-of-contents.cjs.js"),s=require("../../table-of-contents.module.scss.cjs.js"),C=require("../table-of-contents-row/table-of-contents-row.cjs.js"),O=require("../../../../../providers/label-provider/use-labels.cjs.js"),i=({nodes:r,heading:t})=>{const{numbered:c}=a.useContext(m.TableOfContentsContext),{getLabel:d}=O.useLabels(),n=a.useId(),u=c?"ol":"ul";return e.jsxs(e.Fragment,{children:[t&&e.jsx(f.Heading,{element:"h3",modifiers:"h4",id:n,className:s.default["tedi-table-of-contents__heading"],children:t}),e.jsx("nav",{"aria-labelledby":t?n:void 0,"aria-label":t?void 0:d("table-of-contents.title"),children:e.jsx(u,{className:b.default(s.default["tedi-table-of-contents__list"],{[s.default["tedi-table-of-contents__list--headless"]]:!t}),children:r.map((l,o)=>e.jsx(C.TableOfContentsRow,{node:l,depth:1,index:o},l.id??o))})})]})};i.displayName="TableOfContentsList";exports.TableOfContentsList=i;
@@ -0,0 +1,9 @@
1
+ import { TableOfContentsNode } from '../../table-of-contents';
2
+ export interface TableOfContentsListProps {
3
+ nodes: TableOfContentsNode[];
4
+ heading?: string | null;
5
+ }
6
+ export declare const TableOfContentsList: {
7
+ ({ nodes, heading }: TableOfContentsListProps): JSX.Element;
8
+ displayName: string;
9
+ };
@@ -0,0 +1,34 @@
1
+ import { jsxs as f, Fragment as c, jsx as e } from "react/jsx-runtime";
2
+ import d from "../../../../../../../external/classnames/index.es.js";
3
+ import { useContext as b, useId as p } from "react";
4
+ import { Heading as h } from "../../../../base/typography/heading/heading.es.js";
5
+ import { TableOfContentsContext as u } from "../../table-of-contents.es.js";
6
+ import o from "../../table-of-contents.module.scss.es.js";
7
+ import { TableOfContentsRow as C } from "../table-of-contents-row/table-of-contents-row.es.js";
8
+ import { useLabels as _ } from "../../../../../providers/label-provider/use-labels.es.js";
9
+ const L = ({ nodes: i, heading: t }) => {
10
+ const { numbered: r } = b(u), { getLabel: a } = _(), s = p(), m = r ? "ol" : "ul";
11
+ return /* @__PURE__ */ f(c, { children: [
12
+ t && /* @__PURE__ */ e(h, { element: "h3", modifiers: "h4", id: s, className: o["tedi-table-of-contents__heading"], children: t }),
13
+ /* @__PURE__ */ e(
14
+ "nav",
15
+ {
16
+ "aria-labelledby": t ? s : void 0,
17
+ "aria-label": t ? void 0 : a("table-of-contents.title"),
18
+ children: /* @__PURE__ */ e(
19
+ m,
20
+ {
21
+ className: d(o["tedi-table-of-contents__list"], {
22
+ [o["tedi-table-of-contents__list--headless"]]: !t
23
+ }),
24
+ children: i.map((l, n) => /* @__PURE__ */ e(C, { node: l, depth: 1, index: n }, l.id ?? n))
25
+ }
26
+ )
27
+ }
28
+ )
29
+ ] });
30
+ };
31
+ L.displayName = "TableOfContentsList";
32
+ export {
33
+ L as TableOfContentsList
34
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("../../../../../../../external/classnames/index.cjs.js"),R=require("react"),$=require("../../../../base/icon/icon.cjs.js"),y=require("../../../../misc/separator/separator.cjs.js"),S=require("../../table-of-contents.cjs.js"),t=require("../../table-of-contents.module.scss.cjs.js"),I=require("../../../../../providers/label-provider/use-labels.cjs.js"),r=({node:p,depth:i,index:d,numberPrefix:o})=>{const{activeId:_,showIcons:h,numbered:l,activeTrail:x}=R.useContext(S.TableOfContentsContext),{getLabel:j}=I.useLabels(),{id:s,content:v,children:a,isValid:n,separator:C,hideIcon:q}=p,O=!!(a!=null&&a.length),u=!!s&&s===_,g=O&&!!s&&x.has(s),w=Math.min(i,2),c=o?`${o}.${d+1}`:`${d+1}`,N=o?c:`${c}.`,T=l?"ol":"ul";return e.jsxs("li",{"aria-current":u?"true":void 0,className:m.default(t.default["tedi-table-of-contents__item"],{[t.default["tedi-table-of-contents__item--selected"]]:u}),children:[e.jsxs("span",{className:m.default(t.default["tedi-table-of-contents__row"],t.default[`tedi-table-of-contents__row--level-${w}`]),children:[h&&!q&&e.jsx($.Icon,{className:t.default["tedi-table-of-contents__icon"],name:n===!1?"warning":n===!0?"check":"circle",color:n===!1?"danger":n===!0?"success":"tertiary",label:j(n===!1?"table-of-contents.step-invalid":n===!0?"table-of-contents.step-valid":"table-of-contents.step-incomplete"),size:18}),l&&e.jsx("span",{className:t.default["tedi-table-of-contents__number"],"aria-hidden":"true",children:N}),e.jsx("span",{className:t.default["tedi-table-of-contents__content"],children:v})]}),g&&e.jsx(T,{className:t.default["tedi-table-of-contents__group"],children:a.map((f,b)=>e.jsx(r,{node:f,depth:i+1,index:b,numberPrefix:l?c:void 0},f.id??b))}),C&&e.jsx(y.Separator,{})]})};r.displayName="TableOfContentsRow";exports.TableOfContentsRow=r;
@@ -0,0 +1,13 @@
1
+ import { TableOfContentsNode } from '../../table-of-contents';
2
+ interface TableOfContentsRowProps {
3
+ node: TableOfContentsNode;
4
+ depth: number;
5
+ index: number;
6
+ /** Parent's number (e.g. `'2'`) for building hierarchical ordinals like `2.1`. */
7
+ numberPrefix?: string;
8
+ }
9
+ export declare const TableOfContentsRow: {
10
+ ({ node, depth, index, numberPrefix }: TableOfContentsRowProps): JSX.Element;
11
+ displayName: string;
12
+ };
13
+ export {};
@@ -0,0 +1,59 @@
1
+ import { jsxs as p, jsx as o } from "react/jsx-runtime";
2
+ import b from "../../../../../../../external/classnames/index.es.js";
3
+ import { useContext as j } from "react";
4
+ import { Icon as L } from "../../../../base/icon/icon.es.js";
5
+ import { Separator as R } from "../../../../misc/separator/separator.es.js";
6
+ import { TableOfContentsContext as S } from "../../table-of-contents.es.js";
7
+ import e from "../../table-of-contents.module.scss.es.js";
8
+ import { useLabels as k } from "../../../../../providers/label-provider/use-labels.es.js";
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";
11
+ return /* @__PURE__ */ p(
12
+ "li",
13
+ {
14
+ "aria-current": m ? "true" : void 0,
15
+ className: b(e["tedi-table-of-contents__item"], {
16
+ [e["tedi-table-of-contents__item--selected"]]: m
17
+ }),
18
+ children: [
19
+ /* @__PURE__ */ p(
20
+ "span",
21
+ {
22
+ className: b(e["tedi-table-of-contents__row"], e[`tedi-table-of-contents__row--level-${x}`]),
23
+ children: [
24
+ v && !$ && /* @__PURE__ */ o(
25
+ L,
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 })
38
+ ]
39
+ }
40
+ ),
41
+ T && /* @__PURE__ */ o(I, { className: e["tedi-table-of-contents__group"], children: s.map((d, f) => /* @__PURE__ */ o(
42
+ _,
43
+ {
44
+ node: d,
45
+ depth: r + 1,
46
+ index: f,
47
+ numberPrefix: l ? c : void 0
48
+ },
49
+ d.id ?? f
50
+ )) }),
51
+ g && /* @__PURE__ */ o(R, {})
52
+ ]
53
+ }
54
+ );
55
+ };
56
+ _.displayName = "TableOfContentsRow";
57
+ export {
58
+ _ as TableOfContentsRow
59
+ };
@@ -0,0 +1,3 @@
1
+ export * from './table-of-contents';
2
+ export * from './components/table-of-contents-item/table-of-contents-item';
3
+ export * from './components/table-of-contents-collapsible/table-of-contents-collapsible';
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),y=require("../../../../../external/classnames/index.cjs.js"),l=require("react"),L=require("../../misc/affix/affix.cjs.js"),S=require("./components/table-of-contents-collapsible/table-of-contents-collapsible.cjs.js"),g=require("./components/table-of-contents-item/table-of-contents-item.cjs.js"),k=require("./components/table-of-contents-list/table-of-contents-list.cjs.js"),m=require("./table-of-contents.module.scss.cjs.js"),w=require("../../../providers/label-provider/use-labels.cjs.js"),M=require("../../cards/card/card.cjs.js"),E=require("../../cards/card/card-content/card-content.cjs.js"),q=l.createContext({activeTrail:new Set}),h=n=>l.isValidElement(n)&&n.type===g.TableOfContentsItem,p=n=>l.Children.toArray(n).filter(h).map(c=>{const{id:s,isValid:i,separator:o,hideIcon:a,children:e}=c.props,r=l.Children.toArray(e),d=r.filter(h),u=r.filter(b=>!h(b));return{id:s,isValid:i,separator:o,hideIcon:a,content:t.jsx(t.Fragment,{children:u}),children:d.length?p(e):void 0}}),j=(n,c)=>{const s=new Set;if(!c)return s;const i=(o,a)=>{for(const e of o){const r=e.id?[...a,e.id]:a;if(e.id===c||e.children&&i(e.children,r))return r.forEach(d=>s.add(d)),!0}return!1};return i(n,[]),s};function f(n){const{getLabel:c}=w.useLabels(),{children:s,heading:i,activeId:o,showIcons:a=!1,numbered:e=!1,sticky:r=!0,variant:d="default",padding:u,className:b}=n,I=i===void 0?c("table-of-contents.title"):i,C=l.useMemo(()=>p(s),[s]),x=l.useMemo(()=>j(C,o),[C,o]),N=l.useMemo(()=>({activeId:o,showIcons:a,numbered:e,activeTrail:x}),[o,a,e,x]),A=u!==void 0?{"--tedi-table-of-contents-padding":`${u}rem`}:void 0,T=t.jsx("div",{className:y.default(m.default["tedi-table-of-contents"],{[m.default["tedi-table-of-contents--transparent"]]:d==="transparent"}),style:A,children:t.jsx(k.TableOfContentsList,{nodes:C,heading:I})}),v=y.default({[m.default["tedi-table-of-contents--sticky"]]:r},b),O=d==="transparent"?t.jsx("div",{className:v,children:T}):t.jsx(M.Card,{className:v,children:t.jsx(E.CardContent,{padding:0,children:T})});return t.jsx(q.Provider,{value:N,children:r?t.jsx(L.Affix,{position:"sticky",top:1.5,bottom:1.5,children:O}):O})}f.displayName="TableOfContents";f.Item=g.TableOfContentsItem;f.Collapsible=S.TableOfContentsCollapsible;exports.TableOfContents=f;exports.TableOfContentsContext=q;exports.buildActiveTrail=j;exports.childrenToNodes=p;
@@ -0,0 +1,88 @@
1
+ import { ReactNode } from 'react';
2
+ import { TableOfContentsItemProps } from './components/table-of-contents-item/table-of-contents-item';
3
+ export interface TableOfContentsProps {
4
+ /**
5
+ * `TableOfContents.Item` elements. An item's non-`Item` children are its
6
+ * link / label; nested `TableOfContents.Item` children become its sub-items.
7
+ */
8
+ children: ReactNode;
9
+ /**
10
+ * Heading rendered above the list. Defaults to the localised "Table of
11
+ * contents" label; pass `null` to render it headless (no visible heading —
12
+ * the navigation keeps an accessible name via `aria-label`).
13
+ */
14
+ heading?: string | null;
15
+ /**
16
+ * Visual variant:
17
+ * - `default` — rendered inside a bordered `Card`.
18
+ * - `transparent` — no card chrome (border / background); the list sits
19
+ * directly on the page, with a continuous grey left rail (the active item's
20
+ * segment turns blue).
21
+ * @default default
22
+ */
23
+ variant?: 'default' | 'transparent';
24
+ /**
25
+ * Inner padding of the container, in rem — the spacing between the card edge and the
26
+ * heading / items. Defaults to the card's medium padding token.
27
+ */
28
+ padding?: number;
29
+ /**
30
+ * Id of the currently active item. The active item gets the left accent bar
31
+ * and active link colour; the branch leading to it auto-expands its nested
32
+ * children.
33
+ */
34
+ 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
+ /**
43
+ * Render the list as an ordered list with auto-generated hierarchical numbers
44
+ * (`1.`, `2.`, `2.1`, …) shown before each item.
45
+ * @default false
46
+ */
47
+ numbered?: boolean;
48
+ /**
49
+ * Stick the card to the viewport while scrolling.
50
+ * @default true
51
+ */
52
+ sticky?: boolean;
53
+ /**
54
+ * Additional class name on the root element.
55
+ */
56
+ className?: string;
57
+ }
58
+ /** Internal data shape derived from the `TableOfContents.Item` element tree. */
59
+ export interface TableOfContentsNode {
60
+ id?: string;
61
+ content: ReactNode;
62
+ children?: TableOfContentsNode[];
63
+ isValid?: boolean;
64
+ separator?: boolean;
65
+ hideIcon?: boolean;
66
+ }
67
+ interface TableOfContentsContextValue {
68
+ activeId?: string;
69
+ showIcons?: boolean;
70
+ numbered?: boolean;
71
+ activeTrail: Set<string>;
72
+ }
73
+ export declare const TableOfContentsContext: import('react').Context<TableOfContentsContextValue>;
74
+ export declare const childrenToNodes: (children: ReactNode) => TableOfContentsNode[];
75
+ export declare const buildActiveTrail: (nodes: TableOfContentsNode[], activeId?: string) => Set<string>;
76
+ export declare function TableOfContents(props: TableOfContentsProps): JSX.Element;
77
+ export declare namespace TableOfContents {
78
+ var displayName: string;
79
+ var Item: {
80
+ (_props: TableOfContentsItemProps): JSX.Element | null;
81
+ displayName: string;
82
+ };
83
+ var Collapsible: {
84
+ (props: import(".").TableOfContentsCollapsibleProps): JSX.Element;
85
+ displayName: string;
86
+ };
87
+ }
88
+ export default TableOfContents;
@@ -0,0 +1,71 @@
1
+ import { jsx as i, Fragment as w } from "react/jsx-runtime";
2
+ import g from "../../../../../external/classnames/index.es.js";
3
+ import { useMemo as p, createContext as E, Children as N, isValidElement as L } from "react";
4
+ import { Affix as S } from "../../misc/affix/affix.es.js";
5
+ import { TableOfContentsCollapsible as V } from "./components/table-of-contents-collapsible/table-of-contents-collapsible.es.js";
6
+ import { TableOfContentsItem as x } from "./components/table-of-contents-item/table-of-contents-item.es.js";
7
+ import { TableOfContentsList as j } from "./components/table-of-contents-list/table-of-contents-list.es.js";
8
+ import h from "./table-of-contents.module.scss.es.js";
9
+ import { useLabels as F } from "../../../providers/label-provider/use-labels.es.js";
10
+ import { Card as H } from "../../cards/card/card.es.js";
11
+ import { CardContent as M } from "../../cards/card/card-content/card-content.es.js";
12
+ const P = E({
13
+ activeTrail: /* @__PURE__ */ new Set()
14
+ }), b = (e) => L(e) && e.type === x, I = (e) => N.toArray(e).filter(b).map((l) => {
15
+ const { id: n, isValid: s, separator: o, hideIcon: a, children: t } = l.props, r = N.toArray(t), c = r.filter(b), d = r.filter((m) => !b(m));
16
+ return {
17
+ id: n,
18
+ isValid: s,
19
+ separator: o,
20
+ hideIcon: a,
21
+ content: /* @__PURE__ */ i(w, { children: d }),
22
+ children: c.length ? I(t) : void 0
23
+ };
24
+ }), $ = (e, l) => {
25
+ const n = /* @__PURE__ */ new Set();
26
+ if (!l) return n;
27
+ const s = (o, a) => {
28
+ for (const t of o) {
29
+ const r = t.id ? [...a, t.id] : a;
30
+ if (t.id === l || t.children && s(t.children, r))
31
+ return r.forEach((c) => n.add(c)), !0;
32
+ }
33
+ return !1;
34
+ };
35
+ return s(e, []), n;
36
+ };
37
+ function u(e) {
38
+ const { getLabel: l } = F(), {
39
+ children: n,
40
+ heading: s,
41
+ activeId: o,
42
+ showIcons: a = !1,
43
+ numbered: t = !1,
44
+ sticky: r = !0,
45
+ variant: c = "default",
46
+ padding: d,
47
+ className: m
48
+ } = e, O = s === void 0 ? l("table-of-contents.title") : s, f = p(() => I(n), [n]), C = p(() => $(f, o), [f, o]), A = p(
49
+ () => ({ activeId: o, showIcons: a, numbered: t, activeTrail: C }),
50
+ [o, a, t, C]
51
+ ), k = d !== void 0 ? { "--tedi-table-of-contents-padding": `${d}rem` } : void 0, v = /* @__PURE__ */ i(
52
+ "div",
53
+ {
54
+ className: g(h["tedi-table-of-contents"], {
55
+ [h["tedi-table-of-contents--transparent"]]: c === "transparent"
56
+ }),
57
+ style: k,
58
+ children: /* @__PURE__ */ i(j, { nodes: f, heading: O })
59
+ }
60
+ ), y = g({ [h["tedi-table-of-contents--sticky"]]: r }, m), T = c === "transparent" ? /* @__PURE__ */ i("div", { className: y, children: v }) : /* @__PURE__ */ i(H, { className: y, children: /* @__PURE__ */ i(M, { padding: 0, children: v }) });
61
+ return /* @__PURE__ */ i(P.Provider, { value: A, children: r ? /* @__PURE__ */ i(S, { position: "sticky", top: 1.5, bottom: 1.5, children: T }) : T });
62
+ }
63
+ u.displayName = "TableOfContents";
64
+ u.Item = x;
65
+ u.Collapsible = V;
66
+ export {
67
+ u as TableOfContents,
68
+ P as TableOfContentsContext,
69
+ $ as buildActiveTrail,
70
+ I as childrenToNodes
71
+ };
@@ -0,0 +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-contents__icon":"tedi-table-of-contents__icon-5bb71193","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;
@@ -0,0 +1,24 @@
1
+ const t = {
2
+ "tedi-table-of-contents": "tedi-table-of-contents-ce55e86d",
3
+ "tedi-table-of-contents--transparent": "tedi-table-of-contents--transparent-067ea2c2",
4
+ "tedi-table-of-contents__list": "tedi-table-of-contents__list-94025876",
5
+ "tedi-table-of-contents--sticky": "tedi-table-of-contents--sticky-1ee87047",
6
+ "tedi-table-of-contents__heading": "tedi-table-of-contents__heading-c6b7a6df",
7
+ "tedi-table-of-contents__group": "tedi-table-of-contents__group-590e4963",
8
+ "tedi-table-of-contents__list--headless": "tedi-table-of-contents__list--headless-99c1bab5",
9
+ "tedi-table-of-contents__item": "tedi-table-of-contents__item-29f072b5",
10
+ "tedi-table-of-contents__row": "tedi-table-of-contents__row-fb686650",
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
+ "tedi-table-of-contents__number": "tedi-table-of-contents__number-693b03b7",
14
+ "tedi-table-of-contents__content": "tedi-table-of-contents__content-8a05ad59",
15
+ "tedi-table-of-contents__item--selected": "tedi-table-of-contents__item--selected-632958d1",
16
+ "tedi-table-of-contents__bar": "tedi-table-of-contents__bar-f4daef0b",
17
+ "tedi-table-of-contents__bar--static": "tedi-table-of-contents__bar--static-f919cf73",
18
+ "tedi-table-of-contents__bar-title": "tedi-table-of-contents__bar-title-b82ab4ed",
19
+ "tedi-table-of-contents__sheet": "tedi-table-of-contents__sheet-16e41b54",
20
+ "tedi-table-of-contents__sheet-header": "tedi-table-of-contents__sheet-header-ec904c54"
21
+ };
22
+ export {
23
+ t as default
24
+ };
@@ -38,6 +38,7 @@ export * from './components/navigation/hash-trigger/hash-trigger';
38
38
  export * from './components/navigation/horizontal-stepper';
39
39
  export * from './components/navigation/link/link';
40
40
  export * from './components/navigation/pagination';
41
+ export * from './components/navigation/table-of-contents';
41
42
  export * from './components/navigation/tabs';
42
43
  export * from './components/form/textfield/textfield';
43
44
  export * from './components/form/textarea/textarea';