@tedi-design-system/react 19.1.0-rc.1 → 19.1.0-rc.2
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/_virtual/index.es13.js +2 -2
- package/_virtual/index.es14.js +2 -2
- package/bundle-stats.html +1 -1
- package/external/react-is/index.cjs.js +1 -1
- package/external/react-is/index.es.js +1 -1
- package/external/toposort/index.cjs.js +1 -1
- package/external/toposort/index.es.js +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/community/components/layout/sidenav/sidenav.cjs.js +1 -1
- package/src/community/components/layout/sidenav/sidenav.es.js +38 -40
- package/src/tedi/components/content/collapse/collapse.cjs.js +1 -1
- package/src/tedi/components/content/collapse/collapse.d.ts +9 -0
- package/src/tedi/components/content/collapse/collapse.es.js +44 -35
- package/src/tedi/components/layout/sidenav/components/sidenav-item/sidenav-item.cjs.js +1 -1
- package/src/tedi/components/layout/sidenav/components/sidenav-item/sidenav-item.es.js +82 -85
- package/src/tedi/components/layout/sidenav/sidenav.cjs.js +1 -1
- package/src/tedi/components/layout/sidenav/sidenav.es.js +16 -16
- package/src/tedi/components/layout/top-nav/components/top-nav-item/top-nav-item.cjs.js +1 -1
- package/src/tedi/components/layout/top-nav/components/top-nav-item/top-nav-item.es.js +6 -7
- package/src/tedi/components/layout/top-nav/components/top-nav-separator/top-nav-separator.cjs.js +1 -1
- package/src/tedi/components/layout/top-nav/components/top-nav-separator/top-nav-separator.es.js +2 -2
- package/src/tedi/components/layout/top-nav/top-nav.cjs.js +1 -1
- package/src/tedi/components/layout/top-nav/top-nav.es.js +9 -8
- package/src/tedi/helpers/hooks/use-safe-id.cjs.js +1 -0
- package/src/tedi/helpers/hooks/use-safe-id.d.ts +16 -0
- package/src/tedi/helpers/hooks/use-safe-id.es.js +5 -0
- package/src/tedi/helpers/index.d.ts +1 -0
- package/tedi.cjs.js +1 -1
- package/tedi.es.js +10 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tedi-design-system/react",
|
|
3
|
-
"version": "19.1.0-rc.
|
|
3
|
+
"version": "19.1.0-rc.2",
|
|
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.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),d=require("react"),S=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),h=require("../../../../../external/classnames/index.cjs.js"),T=require("../../../../tedi/components/base/icon/icon.cjs.js"),L=require("../../../../tedi/components/content/collapse/collapse.cjs.js"),P=require("../../../../tedi/components/misc/print/print.cjs.js"),q=require("../../../helpers/hooks/use-layout.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),d=require("react"),S=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),h=require("../../../../../external/classnames/index.cjs.js"),T=require("../../../../tedi/components/base/icon/icon.cjs.js"),L=require("../../../../tedi/components/content/collapse/collapse.cjs.js"),P=require("../../../../tedi/components/misc/print/print.cjs.js"),q=require("../../../helpers/hooks/use-layout.cjs.js"),A=require("../../anchor/anchor.cjs.js"),C=require("../layout-context.cjs.js"),a=require("./sidenav.module.scss.cjs.js"),B=require("./utility.cjs.js"),F=n=>requestAnimationFrame(n),I=n=>{const{navItems:l,ariaLabel:r,linkAs:i,breakToBottomContent:c,breakToHeader:x,showDividers:u=!0,hideSubItemIcons:m=!1,className:v,..._}=n,p=q.default(["mobile","tablet"]),{menuOpen:g,context:y,getFloatingProps:f,floating:N,headerType:e,y:s}=d.useContext(C.LayoutContext),{hasSidenav:o}=B.useSidenavRendered(e,n);if(!o)return null;const b=h.default(a.default.sidenav,v,{[a.default["sidenav--has-dividers"]]:u,[a.default["sidenav--hide-subitem-icons"]]:m}),j=t.jsx(P.Print,{visibility:"hide",children:t.jsx("nav",{"data-name":"sidenav",..._,className:b,"aria-label":r,children:t.jsx("ul",{className:a.default.sidenav__list,children:l.map((E,M)=>d.createElement(k,{as:i,...E,key:M}))})})});return p?g?t.jsx(S.FloatingOverlay,{lockScroll:!0,className:a.default.sidenav__overlay,children:t.jsx(S.FloatingFocusManager,{context:y,order:["reference","content"],children:t.jsx("div",{...f({style:{paddingTop:s??0},className:a.default.sidenav,"aria-label":r}),ref:N,children:j})})}):null:j},k=n=>{const{icon:l,children:r,isActive:i,onClick:c,subItems:x,as:u,...m}=n,{toggleMenu:v,onHeaderSidenavToggle:_}=d.useContext(C.LayoutContext),p=q.default(["mobile","tablet"]),g=h.default(a.default.sidenav__item,{[a.default["sidenav__item--current"]]:i}),y=d.useId(),f=e=>{const o={className:h.default(a.default.sidenav__icon)},b=typeof e=="string"?{...o,name:e,color:"inherit"}:{...o,...e,className:h.default(o.className,e==null?void 0:e.className),background:void 0};return t.jsx(T.Icon,{...b})},N=e=>{c==null||c(e),e.stopPropagation(),typeof _=="function"||(p?F(()=>v()):v())};return t.jsx("li",{"data-name":"sidenav-item",className:g,children:x?t.jsx(L.Collapse,{id:y,hideCollapseText:!0,contentAsRegion:!1,open:i,title:t.jsxs("span",{...(({_href:e,...s})=>s)(m),className:a.default.sidenav__link,"aria-current":i?"page":void 0,children:[l&&f(l),t.jsx("span",{className:a.default.sidenav__title,children:r})]}),children:t.jsx("ul",{className:a.default.sidenav__list,children:x.map((e,s)=>d.createElement(k,{as:u,...e,key:s}))})}):t.jsxs(A.Anchor,{...m,as:u,onClick:N,className:a.default.sidenav__link,noStyle:!0,"aria-current":i?"page":void 0,children:[l&&f(l),t.jsx("span",{className:a.default.sidenav__title,children:r})]})})};exports.SideNav=I;exports.default=I;
|
|
@@ -1,98 +1,96 @@
|
|
|
1
1
|
import { jsx as t, jsxs as x } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { FloatingOverlay as
|
|
4
|
-
import
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { Collapse as
|
|
7
|
-
import { Print as
|
|
2
|
+
import b, { createElement as C } from "react";
|
|
3
|
+
import { FloatingOverlay as B, FloatingFocusManager as F } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
|
|
4
|
+
import p from "../../../../../external/classnames/index.es.js";
|
|
5
|
+
import { Icon as L } from "../../../../tedi/components/base/icon/icon.es.js";
|
|
6
|
+
import { Collapse as P } from "../../../../tedi/components/content/collapse/collapse.es.js";
|
|
7
|
+
import { Print as R } from "../../../../tedi/components/misc/print/print.es.js";
|
|
8
8
|
import k from "../../../helpers/hooks/use-layout.es.js";
|
|
9
|
-
import { Anchor as
|
|
9
|
+
import { Anchor as j } from "../../anchor/anchor.es.js";
|
|
10
10
|
import { LayoutContext as E } from "../layout-context.es.js";
|
|
11
11
|
import a from "./sidenav.module.scss.es.js";
|
|
12
|
-
import { useSidenavRendered as
|
|
13
|
-
const
|
|
12
|
+
import { useSidenavRendered as H } from "./utility.es.js";
|
|
13
|
+
const O = (n) => requestAnimationFrame(n), Y = (n) => {
|
|
14
14
|
const {
|
|
15
15
|
navItems: i,
|
|
16
|
-
ariaLabel:
|
|
17
|
-
linkAs:
|
|
16
|
+
ariaLabel: r,
|
|
17
|
+
linkAs: o,
|
|
18
18
|
breakToBottomContent: c,
|
|
19
19
|
breakToHeader: f,
|
|
20
20
|
showDividers: d = !0,
|
|
21
21
|
hideSubItemIcons: m = !1,
|
|
22
22
|
className: u,
|
|
23
23
|
...h
|
|
24
|
-
} =
|
|
24
|
+
} = n, _ = k(["mobile", "tablet"]), { menuOpen: N, context: g, getFloatingProps: v, floating: S, headerType: e, y: s } = b.useContext(E), { hasSidenav: l } = H(e, n);
|
|
25
25
|
if (!l)
|
|
26
26
|
return null;
|
|
27
|
-
const
|
|
27
|
+
const y = p(a.sidenav, u, {
|
|
28
28
|
[a["sidenav--has-dividers"]]: d,
|
|
29
29
|
[a["sidenav--hide-subitem-icons"]]: m
|
|
30
|
-
}), I = /* @__PURE__ */ t(
|
|
31
|
-
return _ ? N ? /* @__PURE__ */ t(
|
|
30
|
+
}), I = /* @__PURE__ */ t(R, { visibility: "hide", children: /* @__PURE__ */ t("nav", { "data-name": "sidenav", ...h, className: y, "aria-label": r, children: /* @__PURE__ */ t("ul", { className: a.sidenav__list, children: i.map((T, A) => /* @__PURE__ */ C(M, { as: o, ...T, key: A })) }) }) });
|
|
31
|
+
return _ ? N ? /* @__PURE__ */ t(B, { lockScroll: !0, className: a.sidenav__overlay, children: /* @__PURE__ */ t(F, { context: g, order: ["reference", "content"], children: /* @__PURE__ */ t(
|
|
32
32
|
"div",
|
|
33
33
|
{
|
|
34
|
-
...
|
|
34
|
+
...v({
|
|
35
35
|
style: {
|
|
36
|
-
paddingTop:
|
|
36
|
+
paddingTop: s ?? 0
|
|
37
37
|
},
|
|
38
38
|
className: a.sidenav,
|
|
39
|
-
"aria-label":
|
|
39
|
+
"aria-label": r
|
|
40
40
|
}),
|
|
41
41
|
ref: S,
|
|
42
42
|
children: I
|
|
43
43
|
}
|
|
44
44
|
) }) }) : null : I;
|
|
45
|
-
}, M = (
|
|
46
|
-
const { icon: i, children:
|
|
47
|
-
const l = { className:
|
|
45
|
+
}, M = (n) => {
|
|
46
|
+
const { icon: i, children: r, isActive: o, onClick: c, subItems: f, as: d, ...m } = n, { toggleMenu: u, onHeaderSidenavToggle: h } = b.useContext(E), _ = k(["mobile", "tablet"]), N = p(a.sidenav__item, { [a["sidenav__item--current"]]: o }), g = b.useId(), v = (e) => {
|
|
47
|
+
const l = { className: p(a.sidenav__icon) }, y = typeof e == "string" ? { ...l, name: e, color: "inherit" } : {
|
|
48
48
|
...l,
|
|
49
49
|
...e,
|
|
50
|
-
className:
|
|
50
|
+
className: p(l.className, e == null ? void 0 : e.className),
|
|
51
51
|
background: void 0
|
|
52
52
|
};
|
|
53
|
-
return /* @__PURE__ */ t(
|
|
53
|
+
return /* @__PURE__ */ t(L, { ...y });
|
|
54
54
|
};
|
|
55
|
-
return /* @__PURE__ */ t("li", { "data-name": "sidenav-item", className: N,
|
|
56
|
-
|
|
55
|
+
return /* @__PURE__ */ t("li", { "data-name": "sidenav-item", className: N, children: f ? /* @__PURE__ */ t(
|
|
56
|
+
P,
|
|
57
57
|
{
|
|
58
|
-
id:
|
|
58
|
+
id: g,
|
|
59
59
|
hideCollapseText: !0,
|
|
60
|
-
|
|
60
|
+
contentAsRegion: !1,
|
|
61
|
+
open: o,
|
|
61
62
|
title: /* @__PURE__ */ x(
|
|
62
63
|
"span",
|
|
63
64
|
{
|
|
64
|
-
...(({ _href: e, ...
|
|
65
|
+
...(({ _href: e, ...s }) => s)(m),
|
|
65
66
|
className: a.sidenav__link,
|
|
66
|
-
|
|
67
|
-
role: "menuitem",
|
|
68
|
-
"aria-current": r ? "page" : void 0,
|
|
67
|
+
"aria-current": o ? "page" : void 0,
|
|
69
68
|
children: [
|
|
70
|
-
i &&
|
|
71
|
-
/* @__PURE__ */ t("span", { className: a.sidenav__title, children:
|
|
69
|
+
i && v(i),
|
|
70
|
+
/* @__PURE__ */ t("span", { className: a.sidenav__title, children: r })
|
|
72
71
|
]
|
|
73
72
|
}
|
|
74
73
|
),
|
|
75
|
-
children: /* @__PURE__ */ t("ul", { className: a.sidenav__list,
|
|
74
|
+
children: /* @__PURE__ */ t("ul", { className: a.sidenav__list, children: f.map((e, s) => /* @__PURE__ */ C(M, { as: d, ...e, key: s })) })
|
|
76
75
|
}
|
|
77
76
|
) : (
|
|
78
77
|
// // TODO: Remove ts-ignore
|
|
79
78
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
80
79
|
// @ts-ignore
|
|
81
80
|
/* @__PURE__ */ x(
|
|
82
|
-
|
|
81
|
+
j,
|
|
83
82
|
{
|
|
84
83
|
...m,
|
|
85
84
|
as: d,
|
|
86
85
|
onClick: (e) => {
|
|
87
|
-
c == null || c(e), e.stopPropagation(), typeof h == "function" || (_ ?
|
|
86
|
+
c == null || c(e), e.stopPropagation(), typeof h == "function" || (_ ? O(() => u()) : u());
|
|
88
87
|
},
|
|
89
88
|
className: a.sidenav__link,
|
|
90
89
|
noStyle: !0,
|
|
91
|
-
|
|
92
|
-
"aria-current": r ? "page" : void 0,
|
|
90
|
+
"aria-current": o ? "page" : void 0,
|
|
93
91
|
children: [
|
|
94
|
-
i &&
|
|
95
|
-
/* @__PURE__ */ t("span", { className: a.sidenav__title, children:
|
|
92
|
+
i && v(i),
|
|
93
|
+
/* @__PURE__ */ t("span", { className: a.sidenav__title, children: r })
|
|
96
94
|
]
|
|
97
95
|
}
|
|
98
96
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),b=require("../../../../../external/classnames/index.cjs.js"),n=require("react"),K=require("../../../../../external/react-animate-height/dist/esm/index.cjs.js"),Q=require("../../../providers/printing-provider/printing-provider.cjs.js"),U=require("../../buttons/collapse-button/collapse-button.cjs.js"),V=require("../../misc/print/print.cjs.js"),s=require("./collapse.module.scss.cjs.js"),W=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),X=require("../../layout/grid/row.cjs.js"),q=require("../../layout/grid/col.cjs.js"),w=d=>{const{getCurrentBreakpointProps:O}=W.useBreakpointProps(d.defaultServerBreakpoint),{id:l,children:P,className:k,openText:y,closeText:I,hideCollapseText:T=!1,title:o,titleRowProps:B,defaultOpen:S,open:u,onToggle:i,arrowType:E="default",size:N="default",underline:$=!0,toggleLabel:p,iconOnly:L=!1,controlsId:f,inverted:M=!1,fullRowToggle:a=!1,contentAsRegion:z=!0,...A}=O(d),g=f!==void 0,h=`${l}__trigger`,x=`${l}__content`,D=`${l}__animate`,[F,G]=n.useState(()=>S??!1),v=Q.usePrint(),r=v||(u!==void 0?u:F),H=L===!0&&!o,_=n.useRef(null),c=t=>{G(t),i==null||i(t)},m=n.useRef(c);m.current=c;const j=n.useRef(r);j.current=r,n.useEffect(()=>{const t=_.current;if(!a||!t)return;const R=J=>{J.target.closest("a, button, input, select, textarea, label")||m.current(!j.current)};return t.addEventListener("click",R),()=>t.removeEventListener("click",R)},[a]);const C=e.jsx("div",{id:x,...z?{role:"region","aria-labelledby":h}:{},className:s.default["tedi-collapse__content"],children:P});return e.jsxs("div",{"data-name":"collapse",...A,className:b.default(s.default["tedi-collapse"],k),children:[e.jsx("div",{ref:_,className:b.default(s.default["tedi-collapse__header"],{[s.default["tedi-collapse__header--clickable"]]:a}),children:e.jsxs(X.Row,{justifyContent:"between",alignItems:"center",wrap:"nowrap",...B,children:[o&&e.jsx(q.Col,{children:o}),e.jsx(q.Col,{width:"auto",children:e.jsx(V.Print,{visibility:"hide",children:e.jsx(U.CollapseButton,{id:h,open:r,onOpenChange:c,openText:y,closeText:I,hideText:T||H,arrowType:E,size:N,inverted:M,underline:$,"aria-controls":g?f:x,...p?{"aria-label":p}:{}})})})]})}),!g&&(v?C:e.jsx(K.default,{id:D,duration:300,height:r?"auto":0,"data-testid":"collapse-inner",children:C}))]})};exports.Collapse=w;exports.default=w;
|
|
@@ -116,6 +116,15 @@ export interface CollapseProps extends BreakpointSupport<CollapseBreakpointProps
|
|
|
116
116
|
* built-in `role="region"` panel.
|
|
117
117
|
*/
|
|
118
118
|
controlsId?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Whether the disclosed content panel is exposed as a `region` landmark
|
|
121
|
+
* (`role="region"` + `aria-labelledby`). Turn this **off** for repeated or
|
|
122
|
+
* nested disclosures such as navigation sub-menus, where many labelled regions
|
|
123
|
+
* pollute the landmark map and collide (axe `landmark-unique`); the
|
|
124
|
+
* `aria-expanded` toggle already conveys the relationship.
|
|
125
|
+
* @default true
|
|
126
|
+
*/
|
|
127
|
+
contentAsRegion?: boolean;
|
|
119
128
|
}
|
|
120
129
|
export declare const Collapse: (props: CollapseProps) => JSX.Element;
|
|
121
130
|
export default Collapse;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsxs as x, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import y from "../../../../../external/classnames/index.es.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { usePrint as
|
|
6
|
-
import { CollapseButton as
|
|
7
|
-
import { Print as
|
|
3
|
+
import n from "react";
|
|
4
|
+
import M from "../../../../../external/react-animate-height/dist/esm/index.es.js";
|
|
5
|
+
import { usePrint as Q } from "../../../providers/printing-provider/printing-provider.es.js";
|
|
6
|
+
import { CollapseButton as U } from "../../buttons/collapse-button/collapse-button.es.js";
|
|
7
|
+
import { Print as V } from "../../misc/print/print.es.js";
|
|
8
8
|
import o from "./collapse.module.scss.es.js";
|
|
9
|
-
import { useBreakpointProps as
|
|
10
|
-
import { Row as
|
|
9
|
+
import { useBreakpointProps as W } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
10
|
+
import { Row as X } from "../../layout/grid/row.es.js";
|
|
11
11
|
import { Col as O } from "../../layout/grid/col.es.js";
|
|
12
|
-
const
|
|
13
|
-
const { getCurrentBreakpointProps: k } =
|
|
12
|
+
const ce = (d) => {
|
|
13
|
+
const { getCurrentBreakpointProps: k } = W(d.defaultServerBreakpoint), {
|
|
14
14
|
id: i,
|
|
15
15
|
children: I,
|
|
16
16
|
className: P,
|
|
@@ -25,27 +25,36 @@ const ae = (d) => {
|
|
|
25
25
|
arrowType: L = "default",
|
|
26
26
|
size: S = "default",
|
|
27
27
|
underline: $ = !0,
|
|
28
|
-
toggleLabel:
|
|
29
|
-
iconOnly:
|
|
30
|
-
controlsId:
|
|
31
|
-
inverted:
|
|
28
|
+
toggleLabel: u,
|
|
29
|
+
iconOnly: A = !1,
|
|
30
|
+
controlsId: f,
|
|
31
|
+
inverted: z = !1,
|
|
32
32
|
fullRowToggle: a = !1,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
contentAsRegion: H = !0,
|
|
34
|
+
...q
|
|
35
|
+
} = k(d), m = f !== void 0, h = `${i}__trigger`, g = `${i}__content`, D = `${i}__animate`, [F, G] = n.useState(() => j ?? !1), _ = Q(), r = _ || (p !== void 0 ? p : F), J = A === !0 && !l, v = n.useRef(null), c = (t) => {
|
|
36
|
+
G(t), s == null || s(t);
|
|
37
|
+
}, R = n.useRef(c);
|
|
38
|
+
R.current = c;
|
|
39
|
+
const C = n.useRef(r);
|
|
40
|
+
C.current = r, n.useEffect(() => {
|
|
40
41
|
const t = v.current;
|
|
41
42
|
if (!a || !t) return;
|
|
42
|
-
const w = (
|
|
43
|
-
|
|
43
|
+
const w = (K) => {
|
|
44
|
+
K.target.closest("a, button, input, select, textarea, label") || R.current(!C.current);
|
|
44
45
|
};
|
|
45
46
|
return t.addEventListener("click", w), () => t.removeEventListener("click", w);
|
|
46
47
|
}, [a]);
|
|
47
|
-
const b = /* @__PURE__ */ e(
|
|
48
|
-
|
|
48
|
+
const b = /* @__PURE__ */ e(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
id: g,
|
|
52
|
+
...H ? { role: "region", "aria-labelledby": h } : {},
|
|
53
|
+
className: o["tedi-collapse__content"],
|
|
54
|
+
children: I
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
return /* @__PURE__ */ x("div", { "data-name": "collapse", ...q, className: y(o["tedi-collapse"], P), children: [
|
|
49
58
|
/* @__PURE__ */ e(
|
|
50
59
|
"div",
|
|
51
60
|
{
|
|
@@ -53,32 +62,32 @@ const ae = (d) => {
|
|
|
53
62
|
className: y(o["tedi-collapse__header"], {
|
|
54
63
|
[o["tedi-collapse__header--clickable"]]: a
|
|
55
64
|
}),
|
|
56
|
-
children: /* @__PURE__ */ x(
|
|
65
|
+
children: /* @__PURE__ */ x(X, { justifyContent: "between", alignItems: "center", wrap: "nowrap", ...E, children: [
|
|
57
66
|
l && /* @__PURE__ */ e(O, { children: l }),
|
|
58
|
-
/* @__PURE__ */ e(O, { width: "auto", children: /* @__PURE__ */ e(
|
|
59
|
-
|
|
67
|
+
/* @__PURE__ */ e(O, { width: "auto", children: /* @__PURE__ */ e(V, { visibility: "hide", children: /* @__PURE__ */ e(
|
|
68
|
+
U,
|
|
60
69
|
{
|
|
61
70
|
id: h,
|
|
62
|
-
open:
|
|
71
|
+
open: r,
|
|
63
72
|
onOpenChange: c,
|
|
64
73
|
openText: T,
|
|
65
74
|
closeText: N,
|
|
66
|
-
hideText: B ||
|
|
75
|
+
hideText: B || J,
|
|
67
76
|
arrowType: L,
|
|
68
77
|
size: S,
|
|
69
|
-
inverted:
|
|
78
|
+
inverted: z,
|
|
70
79
|
underline: $,
|
|
71
|
-
"aria-controls": m ?
|
|
72
|
-
...
|
|
80
|
+
"aria-controls": m ? f : g,
|
|
81
|
+
...u ? { "aria-label": u } : {}
|
|
73
82
|
}
|
|
74
83
|
) }) })
|
|
75
84
|
] })
|
|
76
85
|
}
|
|
77
86
|
),
|
|
78
|
-
!m && (_ ? b : /* @__PURE__ */ e(
|
|
87
|
+
!m && (_ ? b : /* @__PURE__ */ e(M, { id: D, duration: 300, height: r ? "auto" : 0, "data-testid": "collapse-inner", children: b }))
|
|
79
88
|
] });
|
|
80
89
|
};
|
|
81
90
|
export {
|
|
82
|
-
|
|
83
|
-
|
|
91
|
+
ce as Collapse,
|
|
92
|
+
ce as default
|
|
84
93
|
};
|
|
@@ -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("react"),n=require("../../../../../../../external/classnames/index.cjs.js"),P=require("../../../../base/icon/icon.cjs.js"),R=require("../../../../content/collapse/collapse.cjs.js"),I=require("../../../../navigation/link/link.cjs.js"),s=require("../../sidenav.module.scss.cjs.js"),J=require("../sidenav-dropdown/sidenav-dropdown.cjs.js"),K=require("../../../../../providers/label-provider/use-labels.cjs.js"),Q=require("../../../../../helpers/hooks/use-safe-id.cjs.js"),p=require("../../../../overlays/tooltip/tooltip.cjs.js"),y=D=>{const{icon:a,children:i,isActive:h,onClick:g,subItems:k,subItemGroups:M,as:x,onItemClick:v,className:O,level:d=1,isCollapsed:r=!1,isDefaultOpen:E=!1,sideNavItemSize:A="default",...c}=D,{getLabel:C}=K.useLabels(),[u,B]=b.useState(E??!1),[S,$]=b.useState(!1),T=Q.useSafeId("sidenav-collapse"),m=M??(k?[{subItems:k}]:null),l=!!m,z=d>1&&l,F=n.default(s.default["tedi-sidenav__item"],s.default[`tedi-sidenav__item--${A}`],{[s.default[`tedi-sidenav__item--level-${d}`]]:d>1,[s.default["tedi-sidenav__item--current"]]:h,[s.default["tedi-sidenav__item--has-children"]]:l,[s.default["tedi-sidenav__item--with-tree"]]:z},O),_=t=>{const o={color:"white",className:n.default(s.default["tedi-sidenav__icon"])},f=typeof t=="string"?{...o,name:t}:{...o,...t,className:n.default(o.className,t==null?void 0:t.className)};return e.jsx(P.Icon,{...f})},H=t=>{g==null||g(t),l||v==null||v()},q=t=>{B(t)},G=l&&(c.href||c.to),j={...c,as:x,onClick:H,className:n.default(s.default["tedi-sidenav__link"],G&&s.default["tedi-sidenav__link--has-children-link"]),noStyle:!0,"aria-current":h?"page":void 0,"aria-label":r&&typeof i=="string"?i:void 0},N=()=>!r&&(m==null?void 0:m.map((t,L)=>{var o;return e.jsxs("div",{children:[(t==null?void 0:t.subHeading)&&e.jsx("div",{className:s.default["tedi-sidenav__subheading"],children:t.subHeading}),e.jsx("ul",{className:s.default["tedi-sidenav__list"],children:(o=t.subItems)==null?void 0:o.map((f,W)=>b.createElement(y,{as:x,...f,key:W,level:d+1,onItemClick:v,isCollapsed:r,className:n.default(s.default["tedi-sidenav__sub-item"],f.className)}))})]},L)})),w=e.jsx("li",{"data-name":"sidenav-item",className:F,children:l&&r?e.jsx(J.SideNavDropdown,{trigger:e.jsx(p.Tooltip.Trigger,{children:e.jsxs("span",{className:n.default(s.default["tedi-sidenav__link"],S&&s.default["tedi-sidenav__link--active"]),children:[a&&_(a),e.jsx(P.Icon,{name:S?"chevron_right":"expand_more",color:"white",className:s.default["tedi-sidenav__toggle-icon"],size:18}),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:i})]})}),as:x,groups:m,onOpenChange:$}):l&&d===1?c.href||c.to?e.jsxs(e.Fragment,{children:[e.jsxs(I.Link,{...j,children:[a&&_(a),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:i})]}),e.jsx("div",{className:s.default["tedi-sidenav__link-collapse-wrapper"],children:e.jsx(R.Collapse,{id:T,hideCollapseText:!0,inverted:!0,contentAsRegion:!1,open:u,onToggle:q,toggleLabel:C("sidenav.toggleSubmenuChildren",{isCollapsedInternal:u,children:i}),className:s.default["tedi-sidenav__collapse"],titleRowProps:{element:"span"},children:N()})})]}):e.jsx(R.Collapse,{id:T,hideCollapseText:!0,inverted:!0,fullRowToggle:!0,contentAsRegion:!1,open:u,onToggle:q,className:s.default["tedi-sidenav__collapse"],titleRowProps:{element:"span"},toggleLabel:C("sidenav.toggleSubmenuChildren",{isCollapsedInternal:u,children:i}),title:e.jsxs("span",{className:n.default(s.default["tedi-sidenav__link"],u&&s.default["tedi-sidenav__link--active"]),"aria-current":h?"page":void 0,children:[a&&_(a),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:i})]}),children:N()}):l?e.jsxs(e.Fragment,{children:[e.jsxs(I.Link,{...j,children:[a&&_(a),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:i}),e.jsx("i",{className:s.default["tedi-sidenav__bullet"]})]}),N()]}):e.jsx(p.Tooltip.Trigger,{children:e.jsxs(I.Link,{...j,children:[a&&_(a),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:i})]})})});return d===1&&r?e.jsxs(p.Tooltip,{placement:"right",focusManager:void 0,children:[e.jsx(p.Tooltip.Content,{maxWidth:"medium",children:i}),w]}):w};exports.SideNavItem=y;
|
|
@@ -1,145 +1,142 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as s, jsxs as n, Fragment as D } from "react/jsx-runtime";
|
|
2
|
+
import { useState as E, createElement as K } from "react";
|
|
3
3
|
import d from "../../../../../../../external/classnames/index.es.js";
|
|
4
4
|
import { Icon as M } from "../../../../base/icon/icon.es.js";
|
|
5
5
|
import { Collapse as O } from "../../../../content/collapse/collapse.es.js";
|
|
6
|
-
import { Link as
|
|
6
|
+
import { Link as k } from "../../../../navigation/link/link.es.js";
|
|
7
7
|
import e from "../../sidenav.module.scss.es.js";
|
|
8
|
-
import { SideNavDropdown as
|
|
9
|
-
import { useLabels as
|
|
10
|
-
import {
|
|
11
|
-
|
|
8
|
+
import { SideNavDropdown as Q } from "../sidenav-dropdown/sidenav-dropdown.es.js";
|
|
9
|
+
import { useLabels as U } from "../../../../../providers/label-provider/use-labels.es.js";
|
|
10
|
+
import { useSafeId as V } from "../../../../../helpers/hooks/use-safe-id.es.js";
|
|
11
|
+
import { Tooltip as u } from "../../../../overlays/tooltip/tooltip.es.js";
|
|
12
|
+
const X = (R) => {
|
|
12
13
|
const {
|
|
13
14
|
icon: a,
|
|
14
15
|
children: t,
|
|
15
|
-
isActive:
|
|
16
|
-
onClick:
|
|
17
|
-
subItems:
|
|
18
|
-
subItemGroups:
|
|
16
|
+
isActive: f,
|
|
17
|
+
onClick: N,
|
|
18
|
+
subItems: w,
|
|
19
|
+
subItemGroups: A,
|
|
19
20
|
as: b,
|
|
20
21
|
onItemClick: h,
|
|
21
|
-
className:
|
|
22
|
-
level:
|
|
23
|
-
isCollapsed:
|
|
24
|
-
isDefaultOpen:
|
|
25
|
-
sideNavItemSize:
|
|
26
|
-
...
|
|
27
|
-
} =
|
|
22
|
+
className: B,
|
|
23
|
+
level: o = 1,
|
|
24
|
+
isCollapsed: c = !1,
|
|
25
|
+
isDefaultOpen: j = !1,
|
|
26
|
+
sideNavItemSize: z = "default",
|
|
27
|
+
...m
|
|
28
|
+
} = R, { getLabel: S } = U(), [_, H] = E(j ?? !1), [T, $] = E(!1), x = V("sidenav-collapse"), p = A ?? (w ? [{ subItems: w }] : null), l = !!p, F = o > 1 && l, G = d(
|
|
28
29
|
e["tedi-sidenav__item"],
|
|
29
|
-
e[`tedi-sidenav__item--${
|
|
30
|
+
e[`tedi-sidenav__item--${z}`],
|
|
30
31
|
{
|
|
31
|
-
[e[`tedi-sidenav__item--level-${
|
|
32
|
-
[e["tedi-sidenav__item--current"]]:
|
|
32
|
+
[e[`tedi-sidenav__item--level-${o}`]]: o > 1,
|
|
33
|
+
[e["tedi-sidenav__item--current"]]: f,
|
|
33
34
|
[e["tedi-sidenav__item--has-children"]]: l,
|
|
34
35
|
[e["tedi-sidenav__item--with-tree"]]: F
|
|
35
36
|
},
|
|
36
|
-
|
|
37
|
-
), v = (
|
|
38
|
-
const
|
|
37
|
+
B
|
|
38
|
+
), v = (i) => {
|
|
39
|
+
const r = {
|
|
39
40
|
color: "white",
|
|
40
41
|
className: d(e["tedi-sidenav__icon"])
|
|
41
|
-
},
|
|
42
|
-
...
|
|
43
|
-
...
|
|
44
|
-
className: d(
|
|
42
|
+
}, g = typeof i == "string" ? { ...r, name: i } : {
|
|
43
|
+
...r,
|
|
44
|
+
...i,
|
|
45
|
+
className: d(r.className, i == null ? void 0 : i.className)
|
|
45
46
|
};
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
}, W = (
|
|
48
|
-
|
|
49
|
-
}, L = (
|
|
50
|
-
|
|
51
|
-
}, q = l && (
|
|
52
|
-
...
|
|
47
|
+
return /* @__PURE__ */ s(M, { ...g });
|
|
48
|
+
}, W = (i) => {
|
|
49
|
+
N == null || N(i), l || h == null || h();
|
|
50
|
+
}, L = (i) => {
|
|
51
|
+
H(i);
|
|
52
|
+
}, q = l && (m.href || m.to), I = {
|
|
53
|
+
...m,
|
|
53
54
|
as: b,
|
|
54
55
|
onClick: W,
|
|
55
56
|
className: d(e["tedi-sidenav__link"], q && e["tedi-sidenav__link--has-children-link"]),
|
|
56
57
|
noStyle: !0,
|
|
57
|
-
|
|
58
|
-
"aria-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"aria-haspopup": "true",
|
|
62
|
-
"aria-expanded": o,
|
|
63
|
-
"aria-controls": I
|
|
64
|
-
} : {}
|
|
65
|
-
}, k = () => !m && (p == null ? void 0 : p.map((s, y) => {
|
|
66
|
-
var c;
|
|
58
|
+
"aria-current": f ? "page" : void 0,
|
|
59
|
+
"aria-label": c && typeof t == "string" ? t : void 0
|
|
60
|
+
}, C = () => !c && (p == null ? void 0 : p.map((i, y) => {
|
|
61
|
+
var r;
|
|
67
62
|
return /* @__PURE__ */ n("div", { children: [
|
|
68
|
-
(
|
|
69
|
-
/* @__PURE__ */
|
|
63
|
+
(i == null ? void 0 : i.subHeading) && /* @__PURE__ */ s("div", { className: e["tedi-sidenav__subheading"], children: i.subHeading }),
|
|
64
|
+
/* @__PURE__ */ s("ul", { className: e["tedi-sidenav__list"], children: (r = i.subItems) == null ? void 0 : r.map((g, J) => /* @__PURE__ */ K(
|
|
70
65
|
X,
|
|
71
66
|
{
|
|
72
67
|
as: b,
|
|
73
|
-
...
|
|
68
|
+
...g,
|
|
74
69
|
key: J,
|
|
75
|
-
level:
|
|
70
|
+
level: o + 1,
|
|
76
71
|
onItemClick: h,
|
|
77
|
-
isCollapsed:
|
|
78
|
-
className: d(e["tedi-sidenav__sub-item"],
|
|
72
|
+
isCollapsed: c,
|
|
73
|
+
className: d(e["tedi-sidenav__sub-item"], g.className)
|
|
79
74
|
}
|
|
80
75
|
)) })
|
|
81
76
|
] }, y);
|
|
82
|
-
})), P = /* @__PURE__ */
|
|
83
|
-
|
|
77
|
+
})), P = /* @__PURE__ */ s("li", { "data-name": "sidenav-item", className: G, children: l && c ? /* @__PURE__ */ s(
|
|
78
|
+
Q,
|
|
84
79
|
{
|
|
85
|
-
trigger: /* @__PURE__ */
|
|
80
|
+
trigger: /* @__PURE__ */ s(u.Trigger, { children: /* @__PURE__ */ n(
|
|
86
81
|
"span",
|
|
87
82
|
{
|
|
88
|
-
className: d(e["tedi-sidenav__link"],
|
|
83
|
+
className: d(e["tedi-sidenav__link"], T && e["tedi-sidenav__link--active"]),
|
|
89
84
|
children: [
|
|
90
85
|
a && v(a),
|
|
91
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ s(
|
|
92
87
|
M,
|
|
93
88
|
{
|
|
94
|
-
name:
|
|
89
|
+
name: T ? "chevron_right" : "expand_more",
|
|
95
90
|
color: "white",
|
|
96
91
|
className: e["tedi-sidenav__toggle-icon"],
|
|
97
92
|
size: 18
|
|
98
93
|
}
|
|
99
94
|
),
|
|
100
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ s("span", { className: e["tedi-sidenav__title"], children: t })
|
|
101
96
|
]
|
|
102
97
|
}
|
|
103
98
|
) }),
|
|
104
99
|
as: b,
|
|
105
100
|
groups: p,
|
|
106
|
-
onOpenChange:
|
|
101
|
+
onOpenChange: $
|
|
107
102
|
}
|
|
108
|
-
) : l &&
|
|
109
|
-
/* @__PURE__ */ n(
|
|
103
|
+
) : l && o === 1 ? m.href || m.to ? /* @__PURE__ */ n(D, { children: [
|
|
104
|
+
/* @__PURE__ */ n(k, { ...I, children: [
|
|
110
105
|
a && v(a),
|
|
111
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ s("span", { className: e["tedi-sidenav__title"], children: t })
|
|
112
107
|
] }),
|
|
113
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ s("div", { className: e["tedi-sidenav__link-collapse-wrapper"], children: /* @__PURE__ */ s(
|
|
114
109
|
O,
|
|
115
110
|
{
|
|
116
|
-
id:
|
|
111
|
+
id: x,
|
|
117
112
|
hideCollapseText: !0,
|
|
118
113
|
inverted: !0,
|
|
119
|
-
|
|
114
|
+
contentAsRegion: !1,
|
|
115
|
+
open: _,
|
|
120
116
|
onToggle: L,
|
|
121
|
-
toggleLabel:
|
|
122
|
-
isCollapsedInternal:
|
|
117
|
+
toggleLabel: S("sidenav.toggleSubmenuChildren", {
|
|
118
|
+
isCollapsedInternal: _,
|
|
123
119
|
children: t
|
|
124
120
|
}),
|
|
125
121
|
className: e["tedi-sidenav__collapse"],
|
|
126
122
|
titleRowProps: { element: "span" },
|
|
127
|
-
children:
|
|
123
|
+
children: C()
|
|
128
124
|
}
|
|
129
125
|
) })
|
|
130
|
-
] }) : /* @__PURE__ */
|
|
126
|
+
] }) : /* @__PURE__ */ s(
|
|
131
127
|
O,
|
|
132
128
|
{
|
|
133
|
-
id:
|
|
129
|
+
id: x,
|
|
134
130
|
hideCollapseText: !0,
|
|
135
131
|
inverted: !0,
|
|
136
132
|
fullRowToggle: !0,
|
|
137
|
-
|
|
133
|
+
contentAsRegion: !1,
|
|
134
|
+
open: _,
|
|
138
135
|
onToggle: L,
|
|
139
136
|
className: e["tedi-sidenav__collapse"],
|
|
140
137
|
titleRowProps: { element: "span" },
|
|
141
|
-
toggleLabel:
|
|
142
|
-
isCollapsedInternal:
|
|
138
|
+
toggleLabel: S("sidenav.toggleSubmenuChildren", {
|
|
139
|
+
isCollapsedInternal: _,
|
|
143
140
|
children: t
|
|
144
141
|
}),
|
|
145
142
|
title: /* @__PURE__ */ n(
|
|
@@ -147,30 +144,30 @@ const X = (B) => {
|
|
|
147
144
|
{
|
|
148
145
|
className: d(
|
|
149
146
|
e["tedi-sidenav__link"],
|
|
150
|
-
|
|
147
|
+
_ && e["tedi-sidenav__link--active"]
|
|
151
148
|
),
|
|
152
|
-
"aria-current":
|
|
149
|
+
"aria-current": f ? "page" : void 0,
|
|
153
150
|
children: [
|
|
154
151
|
a && v(a),
|
|
155
|
-
/* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ s("span", { className: e["tedi-sidenav__title"], children: t })
|
|
156
153
|
]
|
|
157
154
|
}
|
|
158
155
|
),
|
|
159
|
-
children:
|
|
156
|
+
children: C()
|
|
160
157
|
}
|
|
161
158
|
) : l ? /* @__PURE__ */ n(D, { children: [
|
|
162
|
-
/* @__PURE__ */ n(
|
|
159
|
+
/* @__PURE__ */ n(k, { ...I, children: [
|
|
163
160
|
a && v(a),
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ s("span", { className: e["tedi-sidenav__title"], children: t }),
|
|
162
|
+
/* @__PURE__ */ s("i", { className: e["tedi-sidenav__bullet"] })
|
|
166
163
|
] }),
|
|
167
|
-
|
|
168
|
-
] }) : /* @__PURE__ */
|
|
164
|
+
C()
|
|
165
|
+
] }) : /* @__PURE__ */ s(u.Trigger, { children: /* @__PURE__ */ n(k, { ...I, children: [
|
|
169
166
|
a && v(a),
|
|
170
|
-
/* @__PURE__ */
|
|
167
|
+
/* @__PURE__ */ s("span", { className: e["tedi-sidenav__title"], children: t })
|
|
171
168
|
] }) }) });
|
|
172
|
-
return
|
|
173
|
-
/* @__PURE__ */
|
|
169
|
+
return o === 1 && c ? /* @__PURE__ */ n(u, { placement: "right", focusManager: void 0, children: [
|
|
170
|
+
/* @__PURE__ */ s(u.Content, { maxWidth: "medium", children: t }),
|
|
174
171
|
P
|
|
175
172
|
] }) : P;
|
|
176
173
|
};
|