@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.
Files changed (43) hide show
  1. package/bundle-stats.html +1 -1
  2. package/community.cjs.js +1 -1
  3. package/community.es.js +221 -223
  4. package/index.css +1 -1
  5. package/package.json +1 -1
  6. package/src/community/components/layout/footer/footer.cjs.js +1 -1
  7. package/src/community/components/layout/footer/footer.es.js +9 -9
  8. package/src/community/components/layout/header/components/header-role/header-role.cjs.js +1 -1
  9. package/src/community/components/layout/header/components/header-role/header-role.es.js +1 -1
  10. package/src/community/components/layout/sidenav/sidenav.cjs.js +1 -1
  11. package/src/community/components/layout/sidenav/sidenav.es.js +6 -6
  12. package/src/community/index.d.ts +0 -1
  13. package/src/tedi/components/buttons/collapse/collapse.cjs.js +1 -1
  14. package/src/tedi/components/buttons/collapse/collapse.d.ts +5 -0
  15. package/src/tedi/components/buttons/collapse/collapse.es.js +60 -60
  16. package/src/tedi/components/form/file-upload/file-upload.cjs.js +1 -1
  17. package/src/tedi/components/form/file-upload/file-upload.es.js +109 -90
  18. package/src/tedi/components/form/file-upload/file-upload.module.scss.cjs.js +1 -1
  19. package/src/tedi/components/form/file-upload/file-upload.module.scss.es.js +3 -1
  20. package/src/tedi/components/form/radio/radio.cjs.js +1 -1
  21. package/src/tedi/components/form/radio/radio.es.js +42 -41
  22. package/src/tedi/components/form/search/search.cjs.js +1 -1
  23. package/src/tedi/components/form/search/search.d.ts +5 -0
  24. package/src/tedi/components/form/search/search.es.js +30 -28
  25. package/src/tedi/components/layout/sidenav/components/sidenav-dropdown/sidenav-dropdown.cjs.js +1 -1
  26. package/src/tedi/components/layout/sidenav/components/sidenav-dropdown/sidenav-dropdown.es.js +58 -45
  27. package/src/tedi/components/layout/sidenav/components/sidenav-item/sidenav-item.cjs.js +1 -1
  28. package/src/tedi/components/layout/sidenav/components/sidenav-item/sidenav-item.es.js +126 -104
  29. package/src/tedi/components/layout/sidenav/components/sidenav-toggle/sidenav-toggle.cjs.js +1 -1
  30. package/src/tedi/components/layout/sidenav/components/sidenav-toggle/sidenav-toggle.d.ts +1 -1
  31. package/src/tedi/components/layout/sidenav/components/sidenav-toggle/sidenav-toggle.es.js +20 -17
  32. package/src/tedi/components/layout/sidenav/sidenav.d.ts +1 -9
  33. package/src/tedi/helpers/hooks/use-file-upload.cjs.js +1 -1
  34. package/src/tedi/helpers/hooks/use-file-upload.d.ts +6 -0
  35. package/src/tedi/helpers/hooks/use-file-upload.es.js +67 -50
  36. package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
  37. package/src/tedi/providers/label-provider/labels-map.d.ts +44 -0
  38. package/src/tedi/providers/label-provider/labels-map.es.js +37 -2
  39. package/src/community/components/collapse/collapse.cjs.js +0 -1
  40. package/src/community/components/collapse/collapse.d.ts +0 -56
  41. package/src/community/components/collapse/collapse.es.js +0 -67
  42. package/src/community/components/collapse/collapse.module.scss.cjs.js +0 -1
  43. package/src/community/components/collapse/collapse.module.scss.es.js +0 -12
@@ -1,134 +1,153 @@
1
- import { jsxs as c, Fragment as F, jsx as e } from "react/jsx-runtime";
2
- import N from "../../../../../external/classnames/index.es.js";
3
- import V from "react";
4
- import { useFileUpload as W } from "../../../helpers/hooks/use-file-upload.es.js";
5
- import { Text as q } from "../../base/typography/text/text.es.js";
1
+ import { jsxs as u, Fragment as N, jsx as i } from "react/jsx-runtime";
2
+ import p from "../../../../../external/classnames/index.es.js";
3
+ import q from "react";
4
+ import { useFileUpload as A } from "../../../helpers/hooks/use-file-upload.es.js";
5
+ import { Text as E } from "../../base/typography/text/text.es.js";
6
6
  import { Button as C } from "../../buttons/button/button.es.js";
7
- import { ClosingButton as A } from "../../buttons/closing-button/closing-button.es.js";
8
- import { FormLabel as E } from "../form-label/form-label.es.js";
9
- import { Separator as G } from "../../misc/separator/separator.es.js";
10
- import { Tag as J } from "../../tags/tag/tag.es.js";
11
- import { FeedbackText as x } from "../feedback-text/feedback-text.es.js";
12
- import i from "./file-upload.module.scss.es.js";
13
- import { useLabels as K } from "../../../providers/label-provider/use-labels.es.js";
14
- import { useBreakpoint as P, isBreakpointBelow as Q } from "../../../helpers/hooks/use-breakpoint.es.js";
15
- import { Row as X } from "../../layout/grid/row.es.js";
16
- import { Col as B } from "../../layout/grid/col.es.js";
17
- const ue = (L) => {
18
- const { getLabel: p } = K(), {
19
- id: r,
7
+ import { ClosingButton as G } from "../../buttons/closing-button/closing-button.es.js";
8
+ import { FormLabel as J } from "../form-label/form-label.es.js";
9
+ import { Separator as K } from "../../misc/separator/separator.es.js";
10
+ import { Tag as P } from "../../tags/tag/tag.es.js";
11
+ import { FeedbackText as L } from "../feedback-text/feedback-text.es.js";
12
+ import l from "./file-upload.module.scss.es.js";
13
+ import { useLabels as Q } from "../../../providers/label-provider/use-labels.es.js";
14
+ import { useBreakpoint as X, isBreakpointBelow as Y } from "../../../helpers/hooks/use-breakpoint.es.js";
15
+ import { Row as Z } from "../../layout/grid/row.es.js";
16
+ import { Col as x } from "../../layout/grid/col.es.js";
17
+ const he = (B) => {
18
+ const { getLabel: n } = Q(), {
19
+ id: s,
20
20
  name: k,
21
- accept: _,
22
- multiple: g,
23
- onChange: u,
24
- className: T,
25
- defaultFiles: w,
26
- onDelete: z,
27
- hasClearButton: I = !0,
28
- files: n,
29
- readOnly: f,
21
+ accept: g,
22
+ multiple: b,
23
+ onChange: f,
24
+ className: $,
25
+ defaultFiles: T,
26
+ onDelete: w,
27
+ hasClearButton: z = !0,
28
+ files: m,
29
+ readOnly: h,
30
30
  disabled: o = !1,
31
- maxSize: R,
32
- validateIndividually: U = !1,
33
- size: s = "default",
34
- helper: l,
35
- ...j
36
- } = L, { innerFiles: b, uploadErrorHelper: t, onFileChange: M, onFileRemove: S, handleClear: y } = W({
37
- accept: _,
38
- maxSize: R,
39
- multiple: g,
40
- validateIndividually: U,
41
- defaultFiles: w,
42
- onChange: u,
43
- onDelete: z,
44
- files: n
45
- }), $ = P(), D = N(i["tedi-file-upload"], { [i["tedi-file-upload--disabled"]]: o }, T), m = l ? (l == null ? void 0 : l.id) ?? `${r}-helper` : void 0, d = V.useMemo(() => n && u ? n : b, [n, b, u]), O = (a, h) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
46
- J,
47
- {
48
- color: a.isValid === !1 ? "danger" : "primary",
49
- onClose: !a.isLoading && !o && !f ? () => S(a) : void 0,
50
- isLoading: a.isLoading,
51
- children: a.name
31
+ maxSize: I,
32
+ validateIndividually: R = !1,
33
+ size: c = "default",
34
+ helper: a,
35
+ ...U
36
+ } = B, { innerFiles: v, uploadErrorHelper: t, onFileChange: V, onFileRemove: j, handleClear: y, announcement: M } = A({
37
+ accept: g,
38
+ maxSize: I,
39
+ multiple: b,
40
+ validateIndividually: R,
41
+ defaultFiles: T,
42
+ onChange: f,
43
+ onDelete: w,
44
+ files: m
45
+ }), S = X(), D = p(l["tedi-file-upload"], { [l["tedi-file-upload--disabled"]]: o }, $), _ = a ? (a == null ? void 0 : a.id) ?? `${s}-helper` : void 0, d = q.useMemo(() => m && f ? m : v, [m, v, f]), O = (e, r) => {
46
+ const W = e.isValid === !1 ? `${e.name} (${n("file-upload.failed")})` : e.name;
47
+ return /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(
48
+ P,
49
+ {
50
+ color: e.isValid === !1 ? "danger" : "primary",
51
+ onClose: !e.isLoading && !o && !h ? () => j(e) : void 0,
52
+ isLoading: e.isLoading,
53
+ "aria-label": W,
54
+ children: e.name
55
+ }
56
+ ) }, r);
57
+ }, F = () => {
58
+ if (d.length > 1)
59
+ return /* @__PURE__ */ i("ul", { className: p(l["tedi-file-upload__items"], l["tedi-file-upload__truncate-list"]), children: d.map((e, r) => O(e, r)) });
60
+ if (d.length === 1) {
61
+ const e = d[0], r = e.isValid === !1 ? `${e.name} (${n("file-upload.failed")})` : e.name;
62
+ return /* @__PURE__ */ i(
63
+ E,
64
+ {
65
+ "aria-label": r,
66
+ className: p(l["tedi-file-upload__items"], l["tedi-file-upload__truncate"]),
67
+ children: e.name
68
+ }
69
+ );
52
70
  }
53
- ) }, h), v = () => d.length > 1 ? /* @__PURE__ */ e("ul", { className: i["tedi-file-upload__items"], children: d.map((a, h) => O(a, h)) }) : d.length === 1 ? /* @__PURE__ */ e(q, { className: i["tedi-file-upload__items"], children: d[0].name }) : null;
54
- return /* @__PURE__ */ c(F, { children: [
55
- /* @__PURE__ */ e("div", { className: i["tedi-file-upload__label-wrapper"], children: /* @__PURE__ */ e(
56
- E,
71
+ return null;
72
+ };
73
+ return /* @__PURE__ */ u(N, { children: [
74
+ /* @__PURE__ */ i("div", { className: l["tedi-file-upload__label-wrapper"], children: /* @__PURE__ */ i(
75
+ J,
57
76
  {
58
- id: r,
59
- ...j,
60
- renderWithoutLabel: f,
61
- className: i["tedi-file-upload__label"],
62
- size: s
77
+ id: s,
78
+ ...U,
79
+ renderWithoutLabel: h,
80
+ className: l["tedi-file-upload__label"],
81
+ size: c
63
82
  }
64
83
  ) }),
65
- f ? v() : /* @__PURE__ */ e(
84
+ /* @__PURE__ */ i("div", { "aria-live": "polite", "aria-atomic": "true", className: "sr-only", children: M }),
85
+ h ? F() : /* @__PURE__ */ i(
66
86
  "div",
67
87
  {
68
- className: N(
69
- i["tedi-file-upload__container"],
88
+ className: p(
89
+ l["tedi-file-upload__container"],
70
90
  {
71
- [i["tedi-file-upload--disabled"]]: o,
72
- [i["tedi-file-upload--error"]]: ((t == null ? void 0 : t.type) || (l == null ? void 0 : l.type)) === "error",
73
- [i["tedi-file-upload--valid"]]: ((t == null ? void 0 : t.type) || (l == null ? void 0 : l.type)) === "valid"
91
+ [l["tedi-file-upload--disabled"]]: o,
92
+ [l["tedi-file-upload--error"]]: ((t == null ? void 0 : t.type) || (a == null ? void 0 : a.type)) === "error",
93
+ [l["tedi-file-upload--valid"]]: ((t == null ? void 0 : t.type) || (a == null ? void 0 : a.type)) === "valid"
74
94
  },
75
- { [i[`tedi-file-upload__container--${s}`]]: s }
95
+ { [l[`tedi-file-upload__container--${c}`]]: c }
76
96
  ),
77
- children: /* @__PURE__ */ e("div", { className: i["tedi-file-upload__content"], children: /* @__PURE__ */ c(X, { children: [
78
- /* @__PURE__ */ e(B, { className: "display-flex", children: v() }),
79
- /* @__PURE__ */ e(B, { xs: 12, md: "auto", children: /* @__PURE__ */ c("div", { className: D, children: [
80
- /* @__PURE__ */ e(
97
+ children: /* @__PURE__ */ i("div", { className: l["tedi-file-upload__content"], children: /* @__PURE__ */ u(Z, { children: [
98
+ /* @__PURE__ */ i(x, { className: "display-flex", children: F() }),
99
+ /* @__PURE__ */ i(x, { xs: 12, md: "auto", children: /* @__PURE__ */ u("div", { className: D, children: [
100
+ /* @__PURE__ */ i(
81
101
  "input",
82
102
  {
83
- id: r,
103
+ id: s,
84
104
  type: "file",
85
105
  name: k,
86
- accept: _,
87
- onChange: M,
88
- multiple: g,
106
+ accept: g,
107
+ onChange: V,
108
+ multiple: b,
89
109
  disabled: o,
90
- "aria-invalid": !!t
110
+ "aria-invalid": !!t && t.type === "error",
111
+ "aria-describedby": _
91
112
  }
92
113
  ),
93
- I && d.length > 0 && !o && /* @__PURE__ */ c(F, { children: [
94
- Q($, "md") ? /* @__PURE__ */ e(
114
+ z && d.length > 0 && !o && /* @__PURE__ */ u(N, { children: [
115
+ Y(S, "md") ? /* @__PURE__ */ i(
95
116
  C,
96
117
  {
97
118
  visualType: "neutral",
98
119
  iconLeft: "close",
99
- "aria-describedby": m,
100
120
  disabled: o,
101
121
  onClick: y,
102
- className: i["tedi-file-upload__button"],
103
- children: p("clear")
122
+ className: l["tedi-file-upload__button"],
123
+ children: n("clear")
104
124
  }
105
- ) : /* @__PURE__ */ e(A, { onClick: y, size: "medium", title: p("clear") }),
106
- /* @__PURE__ */ e(G, { axis: "vertical", height: 1.5, spacing: 0.5, color: "primary" })
125
+ ) : /* @__PURE__ */ i(G, { onClick: y, size: "medium", title: n("clear") }),
126
+ /* @__PURE__ */ i(K, { axis: "vertical", height: 1.5, spacing: 0.5, color: "primary" })
107
127
  ] }),
108
- /* @__PURE__ */ e(
128
+ /* @__PURE__ */ i(
109
129
  C,
110
130
  {
111
131
  visualType: "neutral",
112
132
  iconLeft: "file_upload",
113
- "aria-describedby": m,
114
133
  disabled: o,
115
134
  onClick: () => {
116
- var a;
117
- return (a = document.getElementById(r)) == null ? void 0 : a.click();
135
+ var e;
136
+ return (e = document.getElementById(s)) == null ? void 0 : e.click();
118
137
  },
119
- className: i["tedi-file-upload__button"],
120
- size: s,
121
- children: p("file-upload.add")
138
+ className: l["tedi-file-upload__button"],
139
+ size: c,
140
+ children: n("file-upload.add")
122
141
  }
123
142
  )
124
143
  ] }) })
125
144
  ] }) })
126
145
  }
127
146
  ),
128
- l ? /* @__PURE__ */ e(x, { ...l, id: m }) : t ? /* @__PURE__ */ e(x, { ...t, id: m }) : null
147
+ a ? /* @__PURE__ */ i(L, { ...a, id: _ }) : t ? /* @__PURE__ */ i(L, { ...t, id: _ }) : null
129
148
  ] });
130
149
  };
131
150
  export {
132
- ue as FileUpload,
133
- ue as default
151
+ he as FileUpload,
152
+ he as default
134
153
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-file-upload":"tedi-file-upload-115f37c2","tedi-file-upload__items":"tedi-file-upload__items-c73c19e5","tedi-file-upload__container":"tedi-file-upload__container-6b0f28a8","tedi-file-upload__container--default":"tedi-file-upload__container--default-56af0d96","tedi-file-upload__button":"tedi-file-upload__button-f37449e6","tedi-file-upload__container--small":"tedi-file-upload__container--small-4d5cd36e","tedi-file-upload--disabled":"tedi-file-upload--disabled-88f4fdcd","tedi-file-upload--error":"tedi-file-upload--error-388cda6f","tedi-file-upload--valid":"tedi-file-upload--valid-28d5eb71","tedi-file-upload__content":"tedi-file-upload__content-8b6bf324"};exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-file-upload":"tedi-file-upload-115f37c2","tedi-file-upload__items":"tedi-file-upload__items-c73c19e5","tedi-file-upload__container":"tedi-file-upload__container-6b0f28a8","tedi-file-upload__container--default":"tedi-file-upload__container--default-56af0d96","tedi-file-upload__button":"tedi-file-upload__button-f37449e6","tedi-file-upload__container--small":"tedi-file-upload__container--small-4d5cd36e","tedi-file-upload--disabled":"tedi-file-upload--disabled-88f4fdcd","tedi-file-upload--error":"tedi-file-upload--error-388cda6f","tedi-file-upload--valid":"tedi-file-upload--valid-28d5eb71","tedi-file-upload__content":"tedi-file-upload__content-8b6bf324","tedi-file-upload__items--truncate":"tedi-file-upload__items--truncate-5c249a01","tedi-file-upload__tag--truncate":"tedi-file-upload__tag--truncate-4c99cb2b"};exports.default=e;
@@ -8,7 +8,9 @@ const e = {
8
8
  "tedi-file-upload--disabled": "tedi-file-upload--disabled-88f4fdcd",
9
9
  "tedi-file-upload--error": "tedi-file-upload--error-388cda6f",
10
10
  "tedi-file-upload--valid": "tedi-file-upload--valid-28d5eb71",
11
- "tedi-file-upload__content": "tedi-file-upload__content-8b6bf324"
11
+ "tedi-file-upload__content": "tedi-file-upload__content-8b6bf324",
12
+ "tedi-file-upload__items--truncate": "tedi-file-upload__items--truncate-5c249a01",
13
+ "tedi-file-upload__tag--truncate": "tedi-file-upload__tag--truncate-4c99cb2b"
12
14
  };
13
15
  export {
14
16
  e as default
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),c=require("../../../../../external/classnames/index.cjs.js"),n=require("react"),S=require("../feedback-text/feedback-text.cjs.js"),T=require("../form-label/form-label.cjs.js"),a=require("./radio.module.scss.cjs.js"),v=require("../../layout/grid/row.cjs.js"),b=require("../../layout/grid/col.cjs.js"),x=j=>{const{id:r,label:l,value:u,className:k,disabled:f,onChange:t,hideLabel:p,helper:i,checked:o,defaultChecked:g,hover:q,name:C,tooltip:N,size:h="default",invalid:R,...y}=j,[m,w]=n.useState(g||!1),s=n.useRef(null),L=n.useMemo(()=>t&&typeof o<"u"?o:m,[t,m,o]),M=d=>{typeof o>"u"&&w(d==null?void 0:d.target.checked),t==null||t(u,d==null?void 0:d.target.checked)},F=i?(i==null?void 0:i.id)??`${r}-helper`:void 0,_=c.default(a.default["tedi-radio"],{[a.default["tedi-radio--disabled"]]:f});return e.jsxs("div",{"data-name":"radio",...y,children:[e.jsxs(v.Row,{gutter:0,children:[e.jsx(b.Col,{width:"auto",children:e.jsxs("div",{className:a.default["tedi-radio__outer-indicator-wrapper"],children:[e.jsx("input",{id:r,value:u,name:C,type:"radio",disabled:f,checked:L,onChange:M,className:a.default["tedi-radio__input"]}),e.jsx("div",{"aria-hidden":"true",onClick:()=>{var d;return(d=s.current)==null?void 0:d.click()},className:c.default(a.default["tedi-radio__indicator"],{[a.default["tedi-radio__indicator--hover"]]:q},{[a.default[`tedi-radio__indicator--size-${h}`]]:h},{[a.default["tedi-radio__indicator--invalid"]]:R},k),"data-testid":"radio-indicator"})]})}),e.jsx(b.Col,{children:l&&typeof l=="string"?e.jsx(T.FormLabel,{ref:s,className:_,id:r,"data-testid":"radio-label",hideLabel:p,label:l,tooltip:N}):e.jsx("label",{ref:s,htmlFor:r,className:_,"data-testid":"radio-label",children:l})})]}),i&&e.jsx(S.FeedbackText,{id:F,...i,className:c.default(a.default["tedi-radio__helper"],i.className)})]})};exports.Radio=x;exports.default=x;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),c=require("../../../../../external/classnames/index.cjs.js"),n=require("react"),I=require("../feedback-text/feedback-text.cjs.js"),S=require("../form-label/form-label.cjs.js"),a=require("./radio.module.scss.cjs.js"),T=require("../../layout/grid/row.cjs.js"),x=require("../../layout/grid/col.cjs.js"),j=k=>{const{id:i,label:o,value:u,className:g,disabled:f,onChange:t,hideLabel:q,helper:r,checked:l,defaultChecked:C,hover:N,name:R,tooltip:h,size:b="default",invalid:y,...w}=k,[m,L]=n.useState(C||!1),s=n.useRef(null),M=n.useMemo(()=>t&&typeof l<"u"?l:m,[t,m,l]),v=d=>{typeof l>"u"&&L(d==null?void 0:d.target.checked),t==null||t(u,d==null?void 0:d.target.checked)},_=r?r.id??`${i}-helper`:void 0,F=h?`${i}-tooltip`:void 0,p=c.default(a.default["tedi-radio"],{[a.default["tedi-radio--disabled"]]:f});return e.jsxs("div",{"data-name":"radio",...w,children:[e.jsxs(T.Row,{gutter:0,children:[e.jsx(x.Col,{width:"auto",children:e.jsxs("div",{className:a.default["tedi-radio__outer-indicator-wrapper"],children:[e.jsx("input",{id:i,value:u,name:R,type:"radio",disabled:f,checked:M,onChange:v,className:a.default["tedi-radio__input"],"aria-describedby":[_,F].filter(Boolean).join(" ")}),e.jsx("div",{"aria-hidden":"true",onClick:()=>{var d;return(d=s.current)==null?void 0:d.click()},className:c.default(a.default["tedi-radio__indicator"],{[a.default["tedi-radio__indicator--hover"]]:N},{[a.default[`tedi-radio__indicator--size-${b}`]]:b},{[a.default["tedi-radio__indicator--invalid"]]:y},g),"data-testid":"radio-indicator"})]})}),e.jsx(x.Col,{children:o&&typeof o=="string"?e.jsx(S.FormLabel,{ref:s,className:p,id:i,"data-testid":"radio-label",hideLabel:q,label:o,tooltip:h}):e.jsx("label",{ref:s,htmlFor:i,className:p,"data-testid":"radio-label",children:o})})]}),r&&e.jsx(I.FeedbackText,{id:_,...r,className:c.default(a.default["tedi-radio__helper"],r.className)})]})};exports.Radio=j;exports.default=j;
@@ -1,46 +1,47 @@
1
1
  import { jsxs as s, jsx as d } from "react/jsx-runtime";
2
2
  import n from "../../../../../external/classnames/index.es.js";
3
3
  import m from "react";
4
- import { FeedbackText as M } from "../feedback-text/feedback-text.es.js";
5
- import { FormLabel as $ } from "../form-label/form-label.es.js";
4
+ import { FeedbackText as B } from "../feedback-text/feedback-text.es.js";
5
+ import { FormLabel as M } from "../form-label/form-label.es.js";
6
6
  import i from "./radio.module.scss.es.js";
7
- import { Row as B } from "../../layout/grid/row.es.js";
8
- import { Col as b } from "../../layout/grid/col.es.js";
9
- const G = (k) => {
7
+ import { Row as v } from "../../layout/grid/row.es.js";
8
+ import { Col as N } from "../../layout/grid/col.es.js";
9
+ const J = (C) => {
10
10
  const {
11
- id: t,
11
+ id: a,
12
12
  label: o,
13
- value: f,
14
- className: N,
15
- disabled: h,
13
+ value: h,
14
+ className: g,
15
+ disabled: f,
16
16
  onChange: r,
17
- hideLabel: C,
18
- helper: a,
17
+ hideLabel: y,
18
+ helper: t,
19
19
  checked: l,
20
- defaultChecked: g,
21
- hover: y,
22
- name: R,
23
- tooltip: x,
24
- size: p = "default",
20
+ defaultChecked: R,
21
+ hover: x,
22
+ name: j,
23
+ tooltip: p,
24
+ size: u = "default",
25
25
  invalid: w,
26
26
  ...F
27
- } = k, [u, L] = m.useState(g || !1), c = m.useRef(null), j = m.useMemo(() => r && typeof l < "u" ? l : u, [r, u, l]), z = (e) => {
28
- typeof l > "u" && L(e == null ? void 0 : e.target.checked), r == null || r(f, e == null ? void 0 : e.target.checked);
29
- }, I = a ? (a == null ? void 0 : a.id) ?? `${t}-helper` : void 0, _ = n(i["tedi-radio"], { [i["tedi-radio--disabled"]]: h });
27
+ } = C, [_, I] = m.useState(R || !1), c = m.useRef(null), L = m.useMemo(() => r && typeof l < "u" ? l : _, [r, _, l]), $ = (e) => {
28
+ typeof l > "u" && I(e == null ? void 0 : e.target.checked), r == null || r(h, e == null ? void 0 : e.target.checked);
29
+ }, b = t ? t.id ?? `${a}-helper` : void 0, z = p ? `${a}-tooltip` : void 0, k = n(i["tedi-radio"], { [i["tedi-radio--disabled"]]: f });
30
30
  return /* @__PURE__ */ s("div", { "data-name": "radio", ...F, children: [
31
- /* @__PURE__ */ s(B, { gutter: 0, children: [
32
- /* @__PURE__ */ d(b, { width: "auto", children: /* @__PURE__ */ s("div", { className: i["tedi-radio__outer-indicator-wrapper"], children: [
31
+ /* @__PURE__ */ s(v, { gutter: 0, children: [
32
+ /* @__PURE__ */ d(N, { width: "auto", children: /* @__PURE__ */ s("div", { className: i["tedi-radio__outer-indicator-wrapper"], children: [
33
33
  /* @__PURE__ */ d(
34
34
  "input",
35
35
  {
36
- id: t,
37
- value: f,
38
- name: R,
36
+ id: a,
37
+ value: h,
38
+ name: j,
39
39
  type: "radio",
40
- disabled: h,
41
- checked: j,
42
- onChange: z,
43
- className: i["tedi-radio__input"]
40
+ disabled: f,
41
+ checked: L,
42
+ onChange: $,
43
+ className: i["tedi-radio__input"],
44
+ "aria-describedby": [b, z].filter(Boolean).join(" ")
44
45
  }
45
46
  ),
46
47
  /* @__PURE__ */ d(
@@ -53,32 +54,32 @@ const G = (k) => {
53
54
  },
54
55
  className: n(
55
56
  i["tedi-radio__indicator"],
56
- { [i["tedi-radio__indicator--hover"]]: y },
57
- { [i[`tedi-radio__indicator--size-${p}`]]: p },
57
+ { [i["tedi-radio__indicator--hover"]]: x },
58
+ { [i[`tedi-radio__indicator--size-${u}`]]: u },
58
59
  { [i["tedi-radio__indicator--invalid"]]: w },
59
- N
60
+ g
60
61
  ),
61
62
  "data-testid": "radio-indicator"
62
63
  }
63
64
  )
64
65
  ] }) }),
65
- /* @__PURE__ */ d(b, { children: o && typeof o == "string" ? /* @__PURE__ */ d(
66
- $,
66
+ /* @__PURE__ */ d(N, { children: o && typeof o == "string" ? /* @__PURE__ */ d(
67
+ M,
67
68
  {
68
69
  ref: c,
69
- className: _,
70
- id: t,
70
+ className: k,
71
+ id: a,
71
72
  "data-testid": "radio-label",
72
- hideLabel: C,
73
+ hideLabel: y,
73
74
  label: o,
74
- tooltip: x
75
+ tooltip: p
75
76
  }
76
- ) : /* @__PURE__ */ d("label", { ref: c, htmlFor: t, className: _, "data-testid": "radio-label", children: o }) })
77
+ ) : /* @__PURE__ */ d("label", { ref: c, htmlFor: a, className: k, "data-testid": "radio-label", children: o }) })
77
78
  ] }),
78
- a && /* @__PURE__ */ d(M, { id: I, ...a, className: n(i["tedi-radio__helper"], a.className) })
79
+ t && /* @__PURE__ */ d(B, { id: b, ...t, className: n(i["tedi-radio__helper"], t.className) })
79
80
  ] });
80
81
  };
81
82
  export {
82
- G as Radio,
83
- G as default
83
+ J as Radio,
84
+ J as default
84
85
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),l=require("../../../../../external/classnames/index.cjs.js"),x=require("react"),h=require("../../buttons/button/button.cjs.js"),q=require("../textfield/textfield.cjs.js"),i=require("./search.module.scss.cjs.js"),r=x.forwardRef(({placeholder:d,isClearable:u=!0,searchIcon:c="search",onSearch:e,onChange:n,button:t,...s},f)=>{const o=p=>{p.key==="Enter"&&(e==null||e(s.value))},m=()=>{e==null||e(s.value)},_={...s,ref:f,inputClassName:l.default(i.default["tedi-search__input"],t&&i.default["tedi-search__input--has-button"]),placeholder:d,isClearable:u,onKeyPress:o,onChange:n,...t?{}:{icon:c}};return a.jsxs("div",{className:l.default(i.default["tedi-search__wrapper"],s.className),children:[a.jsx(q.TextField,{..._}),t&&a.jsx(h.Button,{...t,onClick:m,className:l.default(i.default["tedi-search__button"],t.className),children:t.children})]})});r.displayName="Search";exports.Search=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),r=require("../../../../../external/classnames/index.cjs.js"),y=require("react"),N=require("../../buttons/button/button.cjs.js"),j=require("../textfield/textfield.cjs.js"),t=require("./search.module.scss.cjs.js"),v=require("../../../providers/label-provider/use-labels.cjs.js"),u=y.forwardRef(({placeholder:c,isClearable:d=!0,searchIcon:n="search",onSearch:a,onChange:o,button:e,ariaLabel:f,...s},h)=>{const{getLabel:l}=v.useLabels(),m=q=>{q.key==="Enter"&&(a==null||a(s.value))},_=()=>{a==null||a(s.value)},x={...s,ref:h,inputClassName:r.default(t.default["tedi-search__input"],e&&t.default["tedi-search__input--has-button"]),placeholder:c,isClearable:d,onKeyDown:m,onChange:o,...e?{}:{icon:n}},b=c||l("search"),p=f??b;return i.jsxs("div",{className:r.default(t.default["tedi-search__wrapper"],s.className),role:"search","aria-label":p,children:[i.jsx(j.TextField,{...x}),e&&i.jsx(N.Button,{...e,onClick:_,className:r.default(t.default["tedi-search__button"],e.className),"aria-label":e.children?void 0:l("search"),children:e.children??l("search")})]})});u.displayName="Search";exports.Search=u;
@@ -15,5 +15,10 @@ export interface SearchProps extends Omit<TextFieldProps, 'isTextArea' | 'icon'
15
15
  * Optional button properties.
16
16
  */
17
17
  button?: Partial<ButtonProps>;
18
+ /**
19
+ * For accessibility: search field name (accessible name). Recommended to always set.
20
+ * E.g., "Search products" or "Search site".
21
+ */
22
+ ariaLabel?: string;
18
23
  }
19
24
  export declare const Search: React.ForwardRefExoticComponent<SearchProps & React.RefAttributes<TextFieldForwardRef>>;
@@ -1,40 +1,42 @@
1
- import { jsxs as N, jsx as a } from "react/jsx-runtime";
2
- import t from "../../../../../external/classnames/index.es.js";
3
- import { forwardRef as u } from "react";
4
- import { Button as x } from "../../buttons/button/button.es.js";
5
- import { TextField as y } from "../textfield/textfield.es.js";
1
+ import { jsxs as y, jsx as c } from "react/jsx-runtime";
2
+ import l from "../../../../../external/classnames/index.es.js";
3
+ import { forwardRef as v } from "react";
4
+ import { Button as w } from "../../buttons/button/button.es.js";
5
+ import { TextField as L } from "../textfield/textfield.es.js";
6
6
  import r from "./search.module.scss.es.js";
7
- const h = u(
8
- ({ placeholder: l, isClearable: m = !0, searchIcon: d = "search", onSearch: s, onChange: p, button: e, ...i }, c) => {
9
- const o = (n) => {
10
- n.key === "Enter" && (s == null || s(i.value));
11
- }, f = () => {
12
- s == null || s(i.value);
7
+ import { useLabels as k } from "../../../providers/label-provider/use-labels.es.js";
8
+ const C = v(
9
+ ({ placeholder: t, isClearable: m = !0, searchIcon: o = "search", onSearch: s, onChange: d, button: e, ariaLabel: p, ...a }, n) => {
10
+ const { getLabel: i } = k(), f = (x) => {
11
+ x.key === "Enter" && (s == null || s(a.value));
12
+ }, h = () => {
13
+ s == null || s(a.value);
13
14
  }, _ = {
14
- ...i,
15
- ref: c,
16
- inputClassName: t(r["tedi-search__input"], e && r["tedi-search__input--has-button"]),
17
- placeholder: l,
15
+ ...a,
16
+ ref: n,
17
+ inputClassName: l(r["tedi-search__input"], e && r["tedi-search__input--has-button"]),
18
+ placeholder: t,
18
19
  isClearable: m,
19
- onKeyPress: o,
20
- onChange: p,
21
- ...e ? {} : { icon: d }
22
- };
23
- return /* @__PURE__ */ N("div", { className: t(r["tedi-search__wrapper"], i.className), children: [
24
- /* @__PURE__ */ a(y, { ..._ }),
25
- e && /* @__PURE__ */ a(
26
- x,
20
+ onKeyDown: f,
21
+ onChange: d,
22
+ ...e ? {} : { icon: o }
23
+ }, u = t || i("search"), N = p ?? u;
24
+ return /* @__PURE__ */ y("div", { className: l(r["tedi-search__wrapper"], a.className), role: "search", "aria-label": N, children: [
25
+ /* @__PURE__ */ c(L, { ..._ }),
26
+ e && /* @__PURE__ */ c(
27
+ w,
27
28
  {
28
29
  ...e,
29
- onClick: f,
30
- className: t(r["tedi-search__button"], e.className),
31
- children: e.children
30
+ onClick: h,
31
+ className: l(r["tedi-search__button"], e.className),
32
+ "aria-label": e.children ? void 0 : i("search"),
33
+ children: e.children ?? i("search")
32
34
  }
33
35
  )
34
36
  ] });
35
37
  }
36
38
  );
37
- h.displayName = "Search";
39
+ C.displayName = "Search";
38
40
  export {
39
- h as Search
41
+ C as Search
40
42
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),d=require("../../../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),y=require("../../../../../../../external/classnames/index.cjs.js"),m=require("react"),I=require("../../../../navigation/link/link.cjs.js"),n=require("./sidenav-dropdown.module.scss.cjs.js"),N=require("../../../../../../../external/@floating-ui/dom/dist/floating-ui.dom.cjs.js"),v=require("../../../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js"),k=({trigger:h,groups:_,onOpenChange:l})=>{const[o,c]=m.useState(!1),{refs:f,floatingStyles:g,context:u}=d.useFloating({open:o,middleware:[v.offset({mainAxis:8}),v.flip()],whileElementsMounted:N.autoUpdate,placement:"right-start",onOpenChange:e=>{c(e),l==null||l(e)},strategy:"fixed"}),{getReferenceProps:x,getFloatingProps:b}=d.useInteractions([d.useClick(u),d.useDismiss(u)]),p=e=>{var i;const a=e.subItemGroups||e.subItems;return s.jsxs("li",{role:"none",className:y.default(n.default["tedi-sidenav-dropdown__item"],a&&n.default["tedi-sidenav-dropdown__item--has-children"]),children:[s.jsxs(I.Link,{...e,role:"menuitem",className:n.default["tedi-sidenav-dropdown__link"],"data-active":e.isActive,"aria-current":e.isActive?"page":void 0,noStyle:!0,onClick:t=>{var r;(r=e.onClick)==null||r.call(e,t),c(!1)},children:[e.children,a&&s.jsx("span",{className:n.default["tedi-sidenav__bullet"]})]}),a&&s.jsx("ul",{className:n.default["tedi-sidenav-dropdown__list"],role:"menu",children:(e.subItemGroups??(e.subItems?[{subItems:e.subItems}]:[])).map((t,r)=>s.jsxs(m.Fragment,{children:[t.subHeading&&s.jsx("div",{className:n.default["tedi-sidenav-dropdown__heading"],role:"presentation",children:t.subHeading}),t.subItems.map(w=>p(w))]},r))})]},e.key||e.href||((i=e.children)==null?void 0:i.toString()))},j=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),c(a=>!a))};return s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:f.setReference,...x(),role:"button",tabIndex:-1,"aria-haspopup":"menu","aria-expanded":o,onKeyDown:j,children:h}),o&&s.jsx(d.FloatingOverlay,{children:s.jsx(d.FloatingPortal,{children:s.jsx(d.FloatingFocusManager,{context:u,modal:!1,children:s.jsx("div",{ref:f.setFloating,style:g,className:n.default["tedi-sidenav-dropdown"],role:"menu",...b(),children:_.map((e,a)=>s.jsxs("div",{className:n.default["tedi-sidenav-dropdown__group"],children:[e.subHeading&&s.jsx("div",{className:n.default["tedi-sidenav-dropdown__heading"],role:"presentation",children:e.subHeading}),s.jsx("ul",{className:n.default["tedi-sidenav-dropdown__list"],role:"menu",children:e.subItems.map(i=>p(i))})]},a))})})})})]})};exports.SideNavDropdown=k;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),d=require("../../../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),N=require("../../../../../../../external/classnames/index.cjs.js"),v=require("react"),k=require("../../../../navigation/link/link.cjs.js"),a=require("./sidenav-dropdown.module.scss.cjs.js"),D=require("../../../../../../../external/@floating-ui/dom/dist/floating-ui.dom.cjs.js"),h=require("../../../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js"),q=require("../../../../../providers/label-provider/use-labels.cjs.js"),F=({trigger:b,groups:g,onOpenChange:o})=>{const{getLabel:x}=q.useLabels(),[u,r]=v.useState(!1),{refs:c,floatingStyles:_,context:f}=d.useFloating({open:u,middleware:[h.offset({mainAxis:8}),h.flip()],whileElementsMounted:D.autoUpdate,placement:"right-start",onOpenChange:e=>{r(e),o==null||o(e)},strategy:"fixed"}),{getReferenceProps:j,getFloatingProps:w}=d.useInteractions([d.useClick(f),d.useDismiss(f)]),p=e=>{var m;const n=e.subItemGroups||e.subItems,t=e.key||e.href||((m=e.children)==null?void 0:m.toString());return s.jsxs("li",{role:"none",className:N.default(a.default["tedi-sidenav-dropdown__item"],n&&a.default["tedi-sidenav-dropdown__item--has-children"]),children:[s.jsxs(k.Link,{...e,role:"menuitem","aria-haspopup":n?"true":void 0,"aria-expanded":n?!1:void 0,"aria-controls":n?`${t}-submenu`:void 0,className:a.default["tedi-sidenav-dropdown__link"],"data-active":e.isActive,"aria-current":e.isActive?"page":void 0,noStyle:!0,onClick:i=>{var l;(l=e.onClick)==null||l.call(e,i),r(!1)},children:[e.children,n&&s.jsx("span",{className:a.default["tedi-sidenav__bullet"]})]}),n&&s.jsx("ul",{id:`${t}-submenu`,className:a.default["tedi-sidenav-dropdown__list"],role:"menu","aria-label":x("sidenav.submenu"),children:(e.subItemGroups??(e.subItems?[{subItems:e.subItems}]:[])).map((i,l)=>s.jsxs(v.Fragment,{children:[i.subHeading&&s.jsx("div",{className:a.default["tedi-sidenav-dropdown__heading"],role:"presentation",children:i.subHeading}),i.subItems.map(I=>p(I))]},l))})]},t)},y=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),r(n=>!n)),e.key==="Escape"&&(e.preventDefault(),r(!1),c.setReference(null))};return s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:c.setReference,...j(),role:"button",tabIndex:-1,"aria-haspopup":"menu","aria-expanded":u,onKeyDown:y,children:b}),u&&s.jsx(d.FloatingOverlay,{children:s.jsx(d.FloatingPortal,{children:s.jsx(d.FloatingFocusManager,{context:f,modal:!1,children:s.jsx("div",{ref:c.setFloating,style:_,className:a.default["tedi-sidenav-dropdown"],role:"menu",...w(),children:g.map((e,n)=>s.jsxs("div",{className:a.default["tedi-sidenav-dropdown__group"],children:[e.subHeading&&s.jsx("div",{className:a.default["tedi-sidenav-dropdown__heading"],role:"presentation",children:e.subHeading}),s.jsx("ul",{className:a.default["tedi-sidenav-dropdown__list"],role:"menu",children:e.subItems.map(t=>p(t))})]},n))})})})})]})};exports.SideNavDropdown=F;