@tedi-design-system/react 14.4.0-rc.8 → 15.0.0-rc.1
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/community.cjs.js +1 -1
- package/community.es.js +221 -223
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/community/components/layout/footer/footer.cjs.js +1 -1
- package/src/community/components/layout/footer/footer.es.js +9 -9
- package/src/community/components/layout/header/components/header-role/header-role.cjs.js +1 -1
- package/src/community/components/layout/header/components/header-role/header-role.es.js +1 -1
- package/src/community/components/layout/sidenav/sidenav.cjs.js +1 -1
- package/src/community/components/layout/sidenav/sidenav.es.js +6 -6
- package/src/community/index.d.ts +0 -1
- package/src/tedi/components/buttons/collapse/collapse.cjs.js +1 -1
- package/src/tedi/components/buttons/collapse/collapse.d.ts +5 -0
- package/src/tedi/components/buttons/collapse/collapse.es.js +60 -60
- package/src/tedi/components/form/file-upload/file-upload.cjs.js +1 -1
- package/src/tedi/components/form/file-upload/file-upload.es.js +109 -90
- package/src/tedi/components/form/file-upload/file-upload.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/file-upload/file-upload.module.scss.es.js +3 -1
- package/src/tedi/components/form/radio/radio.cjs.js +1 -1
- package/src/tedi/components/form/radio/radio.es.js +42 -41
- package/src/tedi/components/form/search/search.cjs.js +1 -1
- package/src/tedi/components/form/search/search.d.ts +5 -0
- package/src/tedi/components/form/search/search.es.js +30 -28
- package/src/tedi/components/layout/sidenav/components/sidenav-dropdown/sidenav-dropdown.cjs.js +1 -1
- package/src/tedi/components/layout/sidenav/components/sidenav-dropdown/sidenav-dropdown.es.js +58 -45
- 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 +126 -104
- package/src/tedi/components/layout/sidenav/components/sidenav-toggle/sidenav-toggle.cjs.js +1 -1
- package/src/tedi/components/layout/sidenav/components/sidenav-toggle/sidenav-toggle.d.ts +1 -1
- package/src/tedi/components/layout/sidenav/components/sidenav-toggle/sidenav-toggle.es.js +20 -17
- package/src/tedi/components/layout/sidenav/sidenav.d.ts +1 -9
- package/src/tedi/helpers/hooks/use-file-upload.cjs.js +1 -1
- package/src/tedi/helpers/hooks/use-file-upload.d.ts +6 -0
- package/src/tedi/helpers/hooks/use-file-upload.es.js +67 -50
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +44 -0
- package/src/tedi/providers/label-provider/labels-map.es.js +37 -2
- package/src/community/components/collapse/collapse.cjs.js +0 -1
- package/src/community/components/collapse/collapse.d.ts +0 -56
- package/src/community/components/collapse/collapse.es.js +0 -67
- package/src/community/components/collapse/collapse.module.scss.cjs.js +0 -1
- package/src/community/components/collapse/collapse.module.scss.es.js +0 -12
package/src/tedi/components/layout/sidenav/components/sidenav-dropdown/sidenav-dropdown.es.js
CHANGED
|
@@ -1,97 +1,110 @@
|
|
|
1
|
-
import { jsxs as d, Fragment as
|
|
2
|
-
import { useFloating as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { Link as
|
|
1
|
+
import { jsxs as d, Fragment as N, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useFloating as k, useInteractions as F, useClick as x, useDismiss as D, FloatingOverlay as S, FloatingPortal as H, FloatingFocusManager as R } from "../../../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
|
|
3
|
+
import A from "../../../../../../../external/classnames/index.es.js";
|
|
4
|
+
import E, { useState as L } from "react";
|
|
5
|
+
import { Link as P } from "../../../../navigation/link/link.es.js";
|
|
6
6
|
import n from "./sidenav-dropdown.module.scss.es.js";
|
|
7
7
|
import { autoUpdate as j } from "../../../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
|
|
8
|
-
import { offset as
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import { offset as G, flip as K } from "../../../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
|
|
9
|
+
import { useLabels as M } from "../../../../../providers/label-provider/use-labels.es.js";
|
|
10
|
+
const V = ({
|
|
11
|
+
trigger: v,
|
|
11
12
|
groups: h,
|
|
12
|
-
onOpenChange:
|
|
13
|
+
onOpenChange: l
|
|
13
14
|
}) => {
|
|
14
|
-
const [
|
|
15
|
-
open:
|
|
16
|
-
middleware: [
|
|
15
|
+
const { getLabel: b } = M(), [c, o] = L(!1), { refs: u, floatingStyles: _, context: m } = k({
|
|
16
|
+
open: c,
|
|
17
|
+
middleware: [G({ mainAxis: 8 }), K()],
|
|
17
18
|
whileElementsMounted: j,
|
|
18
19
|
placement: "right-start",
|
|
19
20
|
onOpenChange: (e) => {
|
|
20
|
-
|
|
21
|
+
o(e), l == null || l(e);
|
|
21
22
|
},
|
|
22
23
|
strategy: "fixed"
|
|
23
|
-
}), { getReferenceProps:
|
|
24
|
-
var
|
|
25
|
-
const
|
|
24
|
+
}), { getReferenceProps: g, getFloatingProps: w } = F([x(m), D(m)]), p = (e) => {
|
|
25
|
+
var f;
|
|
26
|
+
const s = e.subItemGroups || e.subItems, r = e.key || e.href || ((f = e.children) == null ? void 0 : f.toString());
|
|
26
27
|
return /* @__PURE__ */ d(
|
|
27
28
|
"li",
|
|
28
29
|
{
|
|
29
30
|
role: "none",
|
|
30
|
-
className:
|
|
31
|
+
className: A(
|
|
31
32
|
n["tedi-sidenav-dropdown__item"],
|
|
32
|
-
|
|
33
|
+
s && n["tedi-sidenav-dropdown__item--has-children"]
|
|
33
34
|
),
|
|
34
35
|
children: [
|
|
35
36
|
/* @__PURE__ */ d(
|
|
36
|
-
|
|
37
|
+
P,
|
|
37
38
|
{
|
|
38
39
|
...e,
|
|
39
40
|
role: "menuitem",
|
|
41
|
+
"aria-haspopup": s ? "true" : void 0,
|
|
42
|
+
"aria-expanded": s ? !1 : void 0,
|
|
43
|
+
"aria-controls": s ? `${r}-submenu` : void 0,
|
|
40
44
|
className: n["tedi-sidenav-dropdown__link"],
|
|
41
45
|
"data-active": e.isActive,
|
|
42
46
|
"aria-current": e.isActive ? "page" : void 0,
|
|
43
47
|
noStyle: !0,
|
|
44
|
-
onClick: (
|
|
48
|
+
onClick: (i) => {
|
|
45
49
|
var t;
|
|
46
|
-
(t = e.onClick) == null || t.call(e,
|
|
50
|
+
(t = e.onClick) == null || t.call(e, i), o(!1);
|
|
47
51
|
},
|
|
48
52
|
children: [
|
|
49
53
|
e.children,
|
|
50
|
-
|
|
54
|
+
s && /* @__PURE__ */ a("span", { className: n["tedi-sidenav__bullet"] })
|
|
51
55
|
]
|
|
52
56
|
}
|
|
53
57
|
),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
s && /* @__PURE__ */ a(
|
|
59
|
+
"ul",
|
|
60
|
+
{
|
|
61
|
+
id: `${r}-submenu`,
|
|
62
|
+
className: n["tedi-sidenav-dropdown__list"],
|
|
63
|
+
role: "menu",
|
|
64
|
+
"aria-label": b("sidenav.submenu"),
|
|
65
|
+
children: (e.subItemGroups ?? (e.subItems ? [{ subItems: e.subItems }] : [])).map((i, t) => /* @__PURE__ */ d(E.Fragment, { children: [
|
|
66
|
+
i.subHeading && /* @__PURE__ */ a("div", { className: n["tedi-sidenav-dropdown__heading"], role: "presentation", children: i.subHeading }),
|
|
67
|
+
i.subItems.map((I) => p(I))
|
|
68
|
+
] }, t))
|
|
69
|
+
}
|
|
70
|
+
)
|
|
58
71
|
]
|
|
59
72
|
},
|
|
60
|
-
|
|
73
|
+
r
|
|
61
74
|
);
|
|
62
|
-
},
|
|
63
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
75
|
+
}, y = (e) => {
|
|
76
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), o((s) => !s)), e.key === "Escape" && (e.preventDefault(), o(!1), u.setReference(null));
|
|
64
77
|
};
|
|
65
|
-
return /* @__PURE__ */ d(
|
|
66
|
-
/* @__PURE__ */
|
|
78
|
+
return /* @__PURE__ */ d(N, { children: [
|
|
79
|
+
/* @__PURE__ */ a(
|
|
67
80
|
"div",
|
|
68
81
|
{
|
|
69
|
-
ref:
|
|
70
|
-
...
|
|
82
|
+
ref: u.setReference,
|
|
83
|
+
...g(),
|
|
71
84
|
role: "button",
|
|
72
85
|
tabIndex: -1,
|
|
73
86
|
"aria-haspopup": "menu",
|
|
74
|
-
"aria-expanded":
|
|
75
|
-
onKeyDown:
|
|
76
|
-
children:
|
|
87
|
+
"aria-expanded": c,
|
|
88
|
+
onKeyDown: y,
|
|
89
|
+
children: v
|
|
77
90
|
}
|
|
78
91
|
),
|
|
79
|
-
|
|
92
|
+
c && /* @__PURE__ */ a(S, { children: /* @__PURE__ */ a(H, { children: /* @__PURE__ */ a(R, { context: m, modal: !1, children: /* @__PURE__ */ a(
|
|
80
93
|
"div",
|
|
81
94
|
{
|
|
82
|
-
ref:
|
|
83
|
-
style:
|
|
95
|
+
ref: u.setFloating,
|
|
96
|
+
style: _,
|
|
84
97
|
className: n["tedi-sidenav-dropdown"],
|
|
85
98
|
role: "menu",
|
|
86
|
-
...
|
|
87
|
-
children: h.map((e,
|
|
88
|
-
e.subHeading && /* @__PURE__ */
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
] },
|
|
99
|
+
...w(),
|
|
100
|
+
children: h.map((e, s) => /* @__PURE__ */ d("div", { className: n["tedi-sidenav-dropdown__group"], children: [
|
|
101
|
+
e.subHeading && /* @__PURE__ */ a("div", { className: n["tedi-sidenav-dropdown__heading"], role: "presentation", children: e.subHeading }),
|
|
102
|
+
/* @__PURE__ */ a("ul", { className: n["tedi-sidenav-dropdown__list"], role: "menu", children: e.subItems.map((r) => p(r)) })
|
|
103
|
+
] }, s))
|
|
91
104
|
}
|
|
92
105
|
) }) }) })
|
|
93
106
|
] });
|
|
94
107
|
};
|
|
95
108
|
export {
|
|
96
|
-
|
|
109
|
+
V as SideNavDropdown
|
|
97
110
|
};
|
|
@@ -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"),x=require("react"),o=require("../../../../../../../external/classnames/index.cjs.js"),D=require("../../../../base/icon/icon.cjs.js"),E=require("../../../../buttons/collapse/collapse.cjs.js"),C=require("../../../../navigation/link/link.cjs.js"),s=require("../../sidenav.module.scss.cjs.js"),W=require("../sidenav-dropdown/sidenav-dropdown.cjs.js"),g=require("../../../../overlays/tooltip/tooltip.cjs.js"),J=require("../../../../../providers/label-provider/use-labels.cjs.js"),M=O=>{const{icon:t,children:l,isActive:j,onClick:N,subItems:S,subItemGroups:P,as:T,onItemClick:p,className:B,level:r=1,isCollapsed:c=!1,isDefaultOpen:$=!1,sideNavItemSize:z="default",...u}=O,{getLabel:q}=J.useLabels(),[n,w]=x.useState($??!1),[y,F]=x.useState(!1),v=x.useId(),m=P??(S?[{subItems:S}]:null),d=!!m,H=o.default(s.default["tedi-sidenav__item"],s.default[`tedi-sidenav__item--${z}`],{[s.default[`tedi-sidenav__item--level-${r}`]]:r>1,[s.default["tedi-sidenav__item--current"]]:j,[s.default["tedi-sidenav__item--has-children"]]:d},B),_=a=>{const i={color:"white",className:o.default(s.default["tedi-sidenav__icon"])},h=typeof a=="string"?{...i,name:a}:{...i,...a,className:o.default(i.className,a==null?void 0:a.className)};return e.jsx(D.Icon,{...h})},K=a=>{N==null||N(a),d||p==null||p()},b=a=>{w(a)},A=a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),w(f=>{const i=!f;return b(i),i}))},G=d&&(u.href||u.to),k={...u,as:T,onClick:K,className:o.default(s.default["tedi-sidenav__link"],G&&s.default["tedi-sidenav__link--has-children-link"]),noStyle:!0,role:"menuitem","aria-current":j?"page":void 0,"aria-label":c&&typeof l=="string"?l:void 0,...d?{"aria-haspopup":"true","aria-expanded":n,"aria-controls":v}:{}},I=()=>!c&&(m==null?void 0:m.map((a,f)=>{var i;return e.jsxs("div",{children:[(a==null?void 0:a.subHeading)&&e.jsx("div",{className:s.default["tedi-sidenav__subheading"],children:a.subHeading}),e.jsx("ul",{className:s.default["tedi-sidenav__list"],role:"menu",children:(i=a.subItems)==null?void 0:i.map((h,R)=>x.createElement(M,{as:T,...h,key:R,level:r+1,onItemClick:p,isCollapsed:c,className:o.default(s.default["tedi-sidenav__sub-item"],h.className)}))})]},f)})),L=e.jsx("li",{"data-name":"sidenav-item",className:H,children:d&&c?e.jsx(W.SideNavDropdown,{trigger:e.jsx(g.Tooltip.Trigger,{children:e.jsxs("span",{className:o.default(s.default["tedi-sidenav__link"],y&&s.default["tedi-sidenav__link--active"]),children:[t&&_(t),e.jsx(D.Icon,{name:y?"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:l})]})}),groups:m,onOpenChange:F}):d&&r===1?u.href||u.to?e.jsxs(e.Fragment,{children:[e.jsxs(C.Link,{...k,children:[t&&_(t),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:l})]}),e.jsx("div",{className:s.default["tedi-sidenav__link-collapse-wrapper"],children:e.jsx(E.Collapse,{id:v,hideCollapseText:!0,open:n,onToggle:b,toggleLabel:q("sidenav.toggleSubmenuChildren",{isCollapsedInternal:n,children:l}),className:s.default["tedi-sidenav__collapse"],children:I()})})]}):e.jsx(E.Collapse,{id:v,hideCollapseText:!0,open:n,onToggle:b,className:s.default["tedi-sidenav__collapse"],toggleLabel:q("sidenav.toggleSubmenuChildren",{isCollapsedInternal:n,children:l}),title:e.jsxs("span",{className:o.default(s.default["tedi-sidenav__link"],n&&s.default["tedi-sidenav__link--active"]),role:"button","aria-expanded":n,"aria-controls":v,"aria-current":j?"page":void 0,onKeyDown:A,children:[t&&_(t),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:l})]}),children:I()}):d?e.jsxs(e.Fragment,{children:[e.jsxs(C.Link,{...k,children:[t&&_(t),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:l}),e.jsx("i",{className:s.default["tedi-sidenav__bullet"]})]}),I()]}):e.jsx(g.Tooltip.Trigger,{children:e.jsxs(C.Link,{...k,children:[t&&_(t),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:l})]})})});return r===1&&c?e.jsxs(g.Tooltip,{placement:"right",focusManager:{order:["content"]},children:[e.jsx(g.Tooltip.Content,{maxWidth:"medium",children:l}),L]}):L};exports.SideNavItem=M;
|
|
@@ -1,159 +1,181 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { Collapse as
|
|
6
|
-
import { Link as
|
|
1
|
+
import { jsx as s, jsxs as l, Fragment as M } from "react/jsx-runtime";
|
|
2
|
+
import Q, { useState as O, createElement as R } from "react";
|
|
3
|
+
import o from "../../../../../../../external/classnames/index.es.js";
|
|
4
|
+
import { Icon as P } from "../../../../base/icon/icon.es.js";
|
|
5
|
+
import { Collapse as B } from "../../../../buttons/collapse/collapse.es.js";
|
|
6
|
+
import { Link as w } from "../../../../navigation/link/link.es.js";
|
|
7
7
|
import e from "../../sidenav.module.scss.es.js";
|
|
8
|
-
import { SideNavDropdown as
|
|
9
|
-
import { Tooltip as
|
|
10
|
-
|
|
8
|
+
import { SideNavDropdown as U } from "../sidenav-dropdown/sidenav-dropdown.es.js";
|
|
9
|
+
import { Tooltip as f } from "../../../../overlays/tooltip/tooltip.es.js";
|
|
10
|
+
import { useLabels as V } from "../../../../../providers/label-provider/use-labels.es.js";
|
|
11
|
+
const X = (j) => {
|
|
11
12
|
const {
|
|
12
|
-
icon:
|
|
13
|
-
children:
|
|
14
|
-
isActive:
|
|
15
|
-
onClick:
|
|
16
|
-
subItems:
|
|
17
|
-
subItemGroups:
|
|
18
|
-
as:
|
|
19
|
-
onItemClick:
|
|
20
|
-
className:
|
|
21
|
-
level:
|
|
22
|
-
isCollapsed:
|
|
23
|
-
isDefaultOpen:
|
|
24
|
-
sideNavItemSize:
|
|
25
|
-
...
|
|
26
|
-
} =
|
|
13
|
+
icon: i,
|
|
14
|
+
children: n,
|
|
15
|
+
isActive: b,
|
|
16
|
+
onClick: I,
|
|
17
|
+
subItems: y,
|
|
18
|
+
subItemGroups: z,
|
|
19
|
+
as: S,
|
|
20
|
+
onItemClick: h,
|
|
21
|
+
className: H,
|
|
22
|
+
level: c = 1,
|
|
23
|
+
isCollapsed: m = !1,
|
|
24
|
+
isDefaultOpen: K = !1,
|
|
25
|
+
sideNavItemSize: $ = "default",
|
|
26
|
+
..._
|
|
27
|
+
} = j, { getLabel: T } = V(), [d, D] = O(K ?? !1), [L, A] = O(!1), u = Q.useId(), p = z ?? (y ? [{ subItems: y }] : null), r = !!p, F = o(
|
|
27
28
|
e["tedi-sidenav__item"],
|
|
28
|
-
e[`tedi-sidenav__item--${
|
|
29
|
+
e[`tedi-sidenav__item--${$}`],
|
|
29
30
|
{
|
|
30
|
-
[e[`tedi-sidenav__item--level-${
|
|
31
|
-
[e["tedi-sidenav__item--current"]]:
|
|
32
|
-
[e["tedi-sidenav__item--has-children"]]:
|
|
31
|
+
[e[`tedi-sidenav__item--level-${c}`]]: c > 1,
|
|
32
|
+
[e["tedi-sidenav__item--current"]]: b,
|
|
33
|
+
[e["tedi-sidenav__item--has-children"]]: r
|
|
33
34
|
},
|
|
34
|
-
|
|
35
|
-
),
|
|
36
|
-
const
|
|
35
|
+
H
|
|
36
|
+
), v = (a) => {
|
|
37
|
+
const t = {
|
|
37
38
|
color: "white",
|
|
38
|
-
className:
|
|
39
|
-
},
|
|
40
|
-
...
|
|
41
|
-
...
|
|
42
|
-
className:
|
|
39
|
+
className: o(e["tedi-sidenav__icon"])
|
|
40
|
+
}, N = typeof a == "string" ? { ...t, name: a } : {
|
|
41
|
+
...t,
|
|
42
|
+
...a,
|
|
43
|
+
className: o(t.className, a == null ? void 0 : a.className)
|
|
43
44
|
};
|
|
44
|
-
return /* @__PURE__ */ s(
|
|
45
|
-
}, G = (
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
}, W =
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
return /* @__PURE__ */ s(P, { ...N });
|
|
46
|
+
}, G = (a) => {
|
|
47
|
+
I == null || I(a), r || h == null || h();
|
|
48
|
+
}, k = (a) => {
|
|
49
|
+
D(a);
|
|
50
|
+
}, W = (a) => {
|
|
51
|
+
(a.key === "Enter" || a.key === " ") && (a.preventDefault(), D((g) => {
|
|
52
|
+
const t = !g;
|
|
53
|
+
return k(t), t;
|
|
54
|
+
}));
|
|
55
|
+
}, q = r && (_.href || _.to), C = {
|
|
56
|
+
..._,
|
|
57
|
+
as: S,
|
|
52
58
|
onClick: G,
|
|
53
|
-
className:
|
|
59
|
+
className: o(e["tedi-sidenav__link"], q && e["tedi-sidenav__link--has-children-link"]),
|
|
54
60
|
noStyle: !0,
|
|
55
61
|
role: "menuitem",
|
|
56
|
-
"aria-current":
|
|
57
|
-
"aria-label":
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
"aria-current": b ? "page" : void 0,
|
|
63
|
+
"aria-label": m && typeof n == "string" ? n : void 0,
|
|
64
|
+
...r ? {
|
|
65
|
+
"aria-haspopup": "true",
|
|
66
|
+
"aria-expanded": d,
|
|
67
|
+
"aria-controls": u
|
|
68
|
+
} : {}
|
|
69
|
+
}, x = () => !m && (p == null ? void 0 : p.map((a, g) => {
|
|
70
|
+
var t;
|
|
71
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
72
|
+
(a == null ? void 0 : a.subHeading) && /* @__PURE__ */ s("div", { className: e["tedi-sidenav__subheading"], children: a.subHeading }),
|
|
73
|
+
/* @__PURE__ */ s("ul", { className: e["tedi-sidenav__list"], role: "menu", children: (t = a.subItems) == null ? void 0 : t.map((N, J) => /* @__PURE__ */ R(
|
|
74
|
+
X,
|
|
64
75
|
{
|
|
65
|
-
as:
|
|
66
|
-
...
|
|
67
|
-
key:
|
|
68
|
-
level:
|
|
69
|
-
onItemClick:
|
|
70
|
-
isCollapsed:
|
|
71
|
-
className:
|
|
76
|
+
as: S,
|
|
77
|
+
...N,
|
|
78
|
+
key: J,
|
|
79
|
+
level: c + 1,
|
|
80
|
+
onItemClick: h,
|
|
81
|
+
isCollapsed: m,
|
|
82
|
+
className: o(e["tedi-sidenav__sub-item"], N.className)
|
|
72
83
|
}
|
|
73
84
|
)) })
|
|
74
|
-
] },
|
|
75
|
-
})),
|
|
76
|
-
|
|
85
|
+
] }, g);
|
|
86
|
+
})), E = /* @__PURE__ */ s("li", { "data-name": "sidenav-item", className: F, children: r && m ? /* @__PURE__ */ s(
|
|
87
|
+
U,
|
|
77
88
|
{
|
|
78
|
-
trigger: /* @__PURE__ */ s(
|
|
89
|
+
trigger: /* @__PURE__ */ s(f.Trigger, { children: /* @__PURE__ */ l(
|
|
79
90
|
"span",
|
|
80
91
|
{
|
|
81
|
-
className:
|
|
92
|
+
className: o(e["tedi-sidenav__link"], L && e["tedi-sidenav__link--active"]),
|
|
82
93
|
children: [
|
|
83
|
-
|
|
94
|
+
i && v(i),
|
|
84
95
|
/* @__PURE__ */ s(
|
|
85
|
-
|
|
96
|
+
P,
|
|
86
97
|
{
|
|
87
|
-
name:
|
|
98
|
+
name: L ? "chevron_right" : "expand_more",
|
|
88
99
|
color: "white",
|
|
89
100
|
className: e["tedi-sidenav__toggle-icon"],
|
|
90
101
|
size: 18
|
|
91
102
|
}
|
|
92
103
|
),
|
|
93
|
-
/* @__PURE__ */ s("span", { className: e["tedi-sidenav__title"], children:
|
|
104
|
+
/* @__PURE__ */ s("span", { className: e["tedi-sidenav__title"], children: n })
|
|
94
105
|
]
|
|
95
106
|
}
|
|
96
107
|
) }),
|
|
97
|
-
groups:
|
|
108
|
+
groups: p,
|
|
98
109
|
onOpenChange: A
|
|
99
110
|
}
|
|
100
|
-
) :
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
|
|
103
|
-
/* @__PURE__ */ s("span", { className: e["tedi-sidenav__title"], children:
|
|
111
|
+
) : r && c === 1 ? _.href || _.to ? /* @__PURE__ */ l(M, { children: [
|
|
112
|
+
/* @__PURE__ */ l(w, { ...C, children: [
|
|
113
|
+
i && v(i),
|
|
114
|
+
/* @__PURE__ */ s("span", { className: e["tedi-sidenav__title"], children: n })
|
|
104
115
|
] }),
|
|
105
116
|
/* @__PURE__ */ s("div", { className: e["tedi-sidenav__link-collapse-wrapper"], children: /* @__PURE__ */ s(
|
|
106
|
-
|
|
117
|
+
B,
|
|
107
118
|
{
|
|
108
|
-
id:
|
|
119
|
+
id: u,
|
|
109
120
|
hideCollapseText: !0,
|
|
110
|
-
open:
|
|
111
|
-
onToggle:
|
|
121
|
+
open: d,
|
|
122
|
+
onToggle: k,
|
|
123
|
+
toggleLabel: T("sidenav.toggleSubmenuChildren", {
|
|
124
|
+
isCollapsedInternal: d,
|
|
125
|
+
children: n
|
|
126
|
+
}),
|
|
112
127
|
className: e["tedi-sidenav__collapse"],
|
|
113
|
-
children:
|
|
128
|
+
children: x()
|
|
114
129
|
}
|
|
115
130
|
) })
|
|
116
131
|
] }) : /* @__PURE__ */ s(
|
|
117
|
-
|
|
132
|
+
B,
|
|
118
133
|
{
|
|
119
|
-
id:
|
|
134
|
+
id: u,
|
|
120
135
|
hideCollapseText: !0,
|
|
121
|
-
open:
|
|
122
|
-
onToggle:
|
|
136
|
+
open: d,
|
|
137
|
+
onToggle: k,
|
|
123
138
|
className: e["tedi-sidenav__collapse"],
|
|
124
|
-
|
|
139
|
+
toggleLabel: T("sidenav.toggleSubmenuChildren", {
|
|
140
|
+
isCollapsedInternal: d,
|
|
141
|
+
children: n
|
|
142
|
+
}),
|
|
143
|
+
title: /* @__PURE__ */ l(
|
|
125
144
|
"span",
|
|
126
145
|
{
|
|
127
|
-
className:
|
|
146
|
+
className: o(
|
|
128
147
|
e["tedi-sidenav__link"],
|
|
129
|
-
|
|
148
|
+
d && e["tedi-sidenav__link--active"]
|
|
130
149
|
),
|
|
131
|
-
role: "
|
|
132
|
-
"aria-
|
|
150
|
+
role: "button",
|
|
151
|
+
"aria-expanded": d,
|
|
152
|
+
"aria-controls": u,
|
|
153
|
+
"aria-current": b ? "page" : void 0,
|
|
154
|
+
onKeyDown: W,
|
|
133
155
|
children: [
|
|
134
|
-
|
|
135
|
-
/* @__PURE__ */ s("span", { className: e["tedi-sidenav__title"], children:
|
|
156
|
+
i && v(i),
|
|
157
|
+
/* @__PURE__ */ s("span", { className: e["tedi-sidenav__title"], children: n })
|
|
136
158
|
]
|
|
137
159
|
}
|
|
138
160
|
),
|
|
139
|
-
children:
|
|
161
|
+
children: x()
|
|
140
162
|
}
|
|
141
|
-
) :
|
|
142
|
-
/* @__PURE__ */
|
|
143
|
-
|
|
144
|
-
/* @__PURE__ */ s("span", { className: e["tedi-sidenav__title"], children:
|
|
163
|
+
) : r ? /* @__PURE__ */ l(M, { children: [
|
|
164
|
+
/* @__PURE__ */ l(w, { ...C, children: [
|
|
165
|
+
i && v(i),
|
|
166
|
+
/* @__PURE__ */ s("span", { className: e["tedi-sidenav__title"], children: n }),
|
|
145
167
|
/* @__PURE__ */ s("i", { className: e["tedi-sidenav__bullet"] })
|
|
146
168
|
] }),
|
|
147
|
-
|
|
148
|
-
] }) : /* @__PURE__ */ s(
|
|
149
|
-
|
|
150
|
-
/* @__PURE__ */ s("span", { className: e["tedi-sidenav__title"], children:
|
|
169
|
+
x()
|
|
170
|
+
] }) : /* @__PURE__ */ s(f.Trigger, { children: /* @__PURE__ */ l(w, { ...C, children: [
|
|
171
|
+
i && v(i),
|
|
172
|
+
/* @__PURE__ */ s("span", { className: e["tedi-sidenav__title"], children: n })
|
|
151
173
|
] }) }) });
|
|
152
|
-
return
|
|
153
|
-
/* @__PURE__ */ s(
|
|
154
|
-
|
|
155
|
-
] }) :
|
|
174
|
+
return c === 1 && m ? /* @__PURE__ */ l(f, { placement: "right", focusManager: { order: ["content"] }, children: [
|
|
175
|
+
/* @__PURE__ */ s(f.Content, { maxWidth: "medium", children: n }),
|
|
176
|
+
E
|
|
177
|
+
] }) : E;
|
|
156
178
|
};
|
|
157
179
|
export {
|
|
158
|
-
|
|
180
|
+
X as SideNavItem
|
|
159
181
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("react/jsx-runtime"),p=require("../../../../../../../external/classnames/index.cjs.js"),b=require("../../../../buttons/button/button.cjs.js"),_=require("../../../../buttons/floating-button/floating-button.cjs.js"),o=require("./sidenav-toggle.module.scss.cjs.js"),y=require("../../../../../providers/label-provider/use-labels.cjs.js"),i=({menuOpen:l,toggleMenu:s,referenceRef:n,getReferenceProps:a=()=>({}),variant:e="mobile"})=>{const{getLabel:c}=y.useLabels(),d=c("header.toggle",l),u=p.default(o.default["tedi-sidenav-toggle"],{[o.default["tedi-sidenav-toggle--open"]]:l,[o.default[`tedi-sidenav-toggle--${e}`]]:!0}),r=e==="collapse"?_.FloatingButton:b.Button,g=t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),s(!l))};return f.jsx(r,{...a(),ref:n,icon:{name:e==="collapse"?l?"right_panel_open":"left_panel_open":l?"close":"menu",className:o.default["tedi-sidenav-toggle__icon"],size:e==="collapse"?18:24},visualType:e==="collapse"?"secondary":"primary",className:u,onClick:()=>s(!l),onKeyDown:g,position:e==="collapse"?"absolute":"static",size:e==="collapse"?"small":"",children:d})};exports.SidenavToggle=i;exports.default=i;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { UnknownType } from '
|
|
2
|
+
import { UnknownType } from '../../../../../types/commonTypes';
|
|
3
3
|
export type SidenavToggleVariant = 'mobile' | 'collapse';
|
|
4
4
|
export type SidenavToggleProps = {
|
|
5
5
|
/**
|
|
@@ -1,36 +1,39 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { Button as
|
|
4
|
-
import { FloatingButton as
|
|
1
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import d from "../../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { Button as f } from "../../../../buttons/button/button.es.js";
|
|
4
|
+
import { FloatingButton as y } from "../../../../buttons/floating-button/floating-button.es.js";
|
|
5
5
|
import l from "./sidenav-toggle.module.scss.es.js";
|
|
6
|
-
import { useLabels as
|
|
6
|
+
import { useLabels as _ } from "../../../../../providers/label-provider/use-labels.es.js";
|
|
7
7
|
const E = ({
|
|
8
8
|
menuOpen: o,
|
|
9
|
-
toggleMenu:
|
|
10
|
-
referenceRef:
|
|
11
|
-
getReferenceProps:
|
|
9
|
+
toggleMenu: t,
|
|
10
|
+
referenceRef: i,
|
|
11
|
+
getReferenceProps: a = () => ({}),
|
|
12
12
|
variant: e = "mobile"
|
|
13
13
|
}) => {
|
|
14
|
-
const { getLabel:
|
|
14
|
+
const { getLabel: c } = _(), r = c("header.toggle", o), n = d(l["tedi-sidenav-toggle"], {
|
|
15
15
|
[l["tedi-sidenav-toggle--open"]]: o,
|
|
16
16
|
[l[`tedi-sidenav-toggle--${e}`]]: !0
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
}), p = e === "collapse" ? y : f, m = (s) => {
|
|
18
|
+
(s.key === "Enter" || s.key === " ") && (s.preventDefault(), t(!o));
|
|
19
|
+
};
|
|
20
|
+
return /* @__PURE__ */ g(
|
|
21
|
+
p,
|
|
20
22
|
{
|
|
21
|
-
...
|
|
22
|
-
ref:
|
|
23
|
+
...a(),
|
|
24
|
+
ref: i,
|
|
23
25
|
icon: {
|
|
24
26
|
name: e === "collapse" ? o ? "right_panel_open" : "left_panel_open" : o ? "close" : "menu",
|
|
25
27
|
className: l["tedi-sidenav-toggle__icon"],
|
|
26
28
|
size: e === "collapse" ? 18 : 24
|
|
27
29
|
},
|
|
28
30
|
visualType: e === "collapse" ? "secondary" : "primary",
|
|
29
|
-
className:
|
|
30
|
-
onClick:
|
|
31
|
+
className: n,
|
|
32
|
+
onClick: () => t(!o),
|
|
33
|
+
onKeyDown: m,
|
|
31
34
|
position: e === "collapse" ? "absolute" : "static",
|
|
32
35
|
size: e === "collapse" ? "small" : "",
|
|
33
|
-
children:
|
|
36
|
+
children: r
|
|
34
37
|
}
|
|
35
38
|
);
|
|
36
39
|
};
|
|
@@ -84,15 +84,7 @@ export declare const SideNav: (<C extends React.ElementType = "a">(props: SideNa
|
|
|
84
84
|
Item: <C extends React.ElementType = "a">(props: SideNavItemProps<C> & {
|
|
85
85
|
onItemClick?: () => void;
|
|
86
86
|
level?: number;
|
|
87
|
-
isCollapsed
|
|
88
|
-
/**
|
|
89
|
-
* Show dividers between navigation items
|
|
90
|
-
* @default true
|
|
91
|
-
*/
|
|
92
|
-
? /**
|
|
93
|
-
* Show dividers between navigation items
|
|
94
|
-
* @default true
|
|
95
|
-
*/: boolean;
|
|
87
|
+
isCollapsed?: boolean;
|
|
96
88
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
97
89
|
Dropdown: <C extends React.ElementType = "a">({ trigger, groups, onOpenChange, }: {
|
|
98
90
|
trigger: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react"),A=require("../../providers/label-provider/use-labels.cjs.js"),$=({accept:g,maxSize:r},o)=>{if(!g&&!r)return;const a=[g&&`${o("file-upload.accept")} ${g.replaceAll(",",", ")}`,r&&`${o("file-upload.max-size")} ${r}MB`].filter(Boolean).join(". ");return a.length?{text:a}:void 0},H=()=>`${Date.now()}-${Math.random().toString(36).slice(2)}`,I=g=>{const{getLabel:r}=A.useLabels(),{accept:o,maxSize:a,multiple:w=!1,validateIndividually:E=!1,defaultFiles:S=[],onChange:u,onDelete:f,files:x,announcementTimeout:T=5e3}=g,F=x!==void 0,[b,j]=m.useState(S),p=F?x:b,[L,h]=m.useState($({accept:o,maxSize:a},r)),[R,M]=m.useState(""),y=m.useRef(!0);m.useEffect(()=>()=>{y.current=!1},[]);const d=m.useRef(null),U=s=>{var n;if(!o)return!0;const l=o.split(",").map(e=>e.trim().toLowerCase()),t=s.name.includes(".")?`.${(n=s.name.split(".").pop())==null?void 0:n.toLowerCase()}`:"",i=s.type.toLowerCase();return l.includes(t)||l.includes(i)},V=s=>{const l=s.reduce((t,{type:i,file:n})=>(t[i].push(n.name),t),{extension:[],size:[]});return Object.entries(l).filter(([t,i])=>i.length).map(([t,i])=>{const n=i.map(e=>`'${e}'`).join(", ");return r(`file-upload.${t}-rejected`,n)}).join(". ")};return{innerFiles:p,uploadErrorHelper:L,onFileChange:s=>{if(s.target.files){const l=Array.from(s.target.files),t=[],i=l.map(e=>{const c=U(e),v=!a||e.size<=a*1024**2;c||t.push({type:"extension",file:e}),v||t.push({type:"size",file:e});const z=new File([e],e.name,{type:e.type,lastModified:e.lastModified});return Object.assign(z,{id:H(),isLoading:!1,isValid:c&&v})});let n=[];if(!w&&i.length>0)i[0].isValid&&(n=[i[0]]);else if(E)n=[...p,...i];else{const e=i.filter(c=>c.isValid);e.length>0&&(n=[...p,...e])}if(n.length>0&&(F||j(n),u==null||u(n),t.length===0)){const e=n.length-p.length,c=r("file-upload.success-added",e.toString())||`${e} file(s) added successfully`;y.current&&M(c)}if(t.length){const e=t.map(v=>v.file.name).join(", "),c=r("file-upload.failed-some",e)||`Upload failed for: ${e}`;y.current&&M(c),h({type:"error",text:V(t)})}else h($({accept:o,maxSize:a},r));setTimeout(()=>{y.current&&M("")},T),d.current&&(d.current.value="")}},onFileRemove:s=>{const l=p.filter(t=>t!==s);F||j(l),f==null||f(s),u==null||u(l),l.length===0&&h($({accept:o,maxSize:a},r)),d.current&&(d.current.value="")},handleClear:()=>{const s=[...p];return s.forEach(l=>f==null?void 0:f(l)),F||j([]),u==null||u([]),h($({accept:o,maxSize:a},r)),d.current&&(d.current.value=""),s},fileInputRef:d,announcement:R}};exports.useFileUpload=I;
|
|
@@ -19,6 +19,11 @@ export interface UseFileUploadProps {
|
|
|
19
19
|
onChange?: (files: FileUploadFile[]) => void;
|
|
20
20
|
onDelete?: (file: FileUploadFile) => void;
|
|
21
21
|
files?: FileUploadFile[];
|
|
22
|
+
/**
|
|
23
|
+
* How long (ms) the announcement message should be visible.
|
|
24
|
+
* @default 5000
|
|
25
|
+
*/
|
|
26
|
+
announcementTimeout?: number;
|
|
22
27
|
}
|
|
23
28
|
export declare const useFileUpload: (props: UseFileUploadProps) => {
|
|
24
29
|
innerFiles: FileUploadFile[];
|
|
@@ -27,4 +32,5 @@ export declare const useFileUpload: (props: UseFileUploadProps) => {
|
|
|
27
32
|
onFileRemove: (file: FileUploadFile) => void;
|
|
28
33
|
handleClear: () => FileUploadFile[];
|
|
29
34
|
fileInputRef: React.RefObject<HTMLInputElement>;
|
|
35
|
+
announcement: string;
|
|
30
36
|
};
|