@tedi-design-system/react 18.1.0-rc.2 → 18.1.0-rc.20

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 (155) hide show
  1. package/_virtual/index.es13.js +2 -2
  2. package/_virtual/index.es14.js +2 -2
  3. package/bundle-stats.html +1 -1
  4. package/community.cjs.js +1 -1
  5. package/community.es.js +156 -152
  6. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
  7. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
  8. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  9. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
  10. package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
  11. package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
  12. package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
  13. package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
  14. package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  15. package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
  16. package/external/prop-types/external/react-is/index.cjs.js +1 -1
  17. package/external/prop-types/external/react-is/index.es.js +1 -1
  18. package/external/react-is/index.cjs.js +1 -1
  19. package/external/react-is/index.es.js +1 -1
  20. package/external/toposort/index.cjs.js +1 -1
  21. package/external/toposort/index.es.js +1 -1
  22. package/index.css +1 -1
  23. package/package.json +1 -1
  24. package/src/community/components/anchor/anchor.d.ts +1 -0
  25. package/src/community/components/button/button.d.ts +1 -0
  26. package/src/community/components/card/card-content/card-content.d.ts +3 -0
  27. package/src/community/components/card/card-header/card-header.d.ts +3 -0
  28. package/src/community/components/card/card-notification/card-notification.d.ts +3 -0
  29. package/src/community/components/card/card.d.ts +3 -0
  30. package/src/community/components/dropdown/dropdown.cjs.js +1 -1
  31. package/src/community/components/dropdown/dropdown.d.ts +3 -0
  32. package/src/community/components/dropdown/dropdown.es.js +5 -6
  33. package/src/community/components/form/choice-group/choice-group.d.ts +3 -0
  34. package/src/community/components/form/file-upload/file-upload.d.ts +6 -0
  35. package/src/community/components/form/radio/radio.d.ts +3 -0
  36. package/src/community/components/form/select/select.d.ts +3 -0
  37. package/src/community/components/form/toggle/toggle.cjs.js +1 -1
  38. package/src/community/components/form/toggle/toggle.d.ts +3 -0
  39. package/src/community/components/form/toggle/toggle.es.js +5 -6
  40. package/src/community/components/layout/header/components/header-language/header-language.d.ts +3 -0
  41. package/src/community/components/layout/header/components/header-role/header-role.d.ts +3 -0
  42. package/src/community/components/layout/header/components/sidenav-toggle/sidenav-toggle.d.ts +3 -0
  43. package/src/community/components/layout/header/header/header.d.ts +3 -0
  44. package/src/community/components/layout/sidenav/sidenav.d.ts +3 -0
  45. package/src/community/components/map-components/base-map-selection/base-map-option.cjs.js +1 -0
  46. package/src/community/components/map-components/base-map-selection/base-map-option.d.ts +64 -0
  47. package/src/community/components/map-components/base-map-selection/base-map-option.es.js +75 -0
  48. package/src/community/components/map-components/base-map-selection/base-map-selection.cjs.js +1 -1
  49. package/src/community/components/map-components/base-map-selection/base-map-selection.d.ts +37 -22
  50. package/src/community/components/map-components/base-map-selection/base-map-selection.es.js +76 -17
  51. package/src/community/components/map-components/base-map-selection/base-map-selection.module.scss.cjs.js +1 -1
  52. package/src/community/components/map-components/base-map-selection/base-map-selection.module.scss.es.js +5 -1
  53. package/src/community/components/map-components/button-group/button-group.module.scss.cjs.js +1 -1
  54. package/src/community/components/map-components/button-group/button-group.module.scss.es.js +1 -0
  55. package/src/community/components/map-components/left-panel/left-panel-content.cjs.js +1 -1
  56. package/src/community/components/map-components/left-panel/left-panel-content.d.ts +10 -5
  57. package/src/community/components/map-components/left-panel/left-panel-content.es.js +7 -21
  58. package/src/community/components/map-components/left-panel/left-panel-footer.cjs.js +1 -1
  59. package/src/community/components/map-components/left-panel/left-panel-footer.d.ts +11 -1
  60. package/src/community/components/map-components/left-panel/left-panel-footer.es.js +7 -24
  61. package/src/community/components/map-components/left-panel/left-panel-header.cjs.js +1 -1
  62. package/src/community/components/map-components/left-panel/left-panel-header.d.ts +11 -1
  63. package/src/community/components/map-components/left-panel/left-panel-header.es.js +7 -62
  64. package/src/community/components/map-components/left-panel/left-panel.cjs.js +1 -1
  65. package/src/community/components/map-components/left-panel/left-panel.d.ts +67 -5
  66. package/src/community/components/map-components/left-panel/left-panel.es.js +85 -14
  67. package/src/community/components/map-components/left-panel/left-panel.module.scss.cjs.js +1 -1
  68. package/src/community/components/map-components/left-panel/left-panel.module.scss.es.js +4 -4
  69. package/src/community/components/map-components/map-button/map-button.cjs.js +1 -1
  70. package/src/community/components/map-components/map-button/map-button.d.ts +8 -3
  71. package/src/community/components/map-components/map-button/map-button.es.js +42 -33
  72. package/src/community/components/map-components/map-button/map-button.module.scss.cjs.js +1 -1
  73. package/src/community/components/map-components/map-button/map-button.module.scss.es.js +3 -0
  74. package/src/community/components/map-components/resizer/resizer.cjs.js +1 -1
  75. package/src/community/components/map-components/resizer/resizer.es.js +9 -10
  76. package/src/community/components/map-components/split-pane/split-pane.cjs.js +1 -0
  77. package/src/community/components/map-components/split-pane/split-pane.d.ts +37 -0
  78. package/src/community/components/map-components/split-pane/split-pane.es.js +128 -0
  79. package/src/community/components/map-components/split-pane/split-pane.module.scss.cjs.js +1 -0
  80. package/src/community/components/map-components/split-pane/split-pane.module.scss.es.js +17 -0
  81. package/src/community/components/status/status.d.ts +3 -0
  82. package/src/community/components/table/table.d.ts +3 -0
  83. package/src/community/components/tag/tag.d.ts +3 -0
  84. package/src/community/components/toggle-open/toggle-open.d.ts +3 -0
  85. package/src/community/components/tooltip/tooltip-trigger.d.ts +3 -0
  86. package/src/community/components/tooltip/tooltip.d.ts +3 -0
  87. package/src/community/index.d.ts +1 -0
  88. package/src/tedi/components/buttons/collapse-button/collapse-button.cjs.js +1 -1
  89. package/src/tedi/components/buttons/collapse-button/collapse-button.es.js +2 -1
  90. package/src/tedi/components/content/table/table.cjs.js +1 -1
  91. package/src/tedi/components/content/table/table.d.ts +8 -5
  92. package/src/tedi/components/content/table/table.es.js +308 -295
  93. package/src/tedi/components/form/file-dropzone/file-dropzone.cjs.js +1 -1
  94. package/src/tedi/components/form/file-dropzone/file-dropzone.es.js +90 -79
  95. package/src/tedi/components/form/file-upload/file-upload.cjs.js +1 -1
  96. package/src/tedi/components/form/file-upload/file-upload.d.ts +4 -1
  97. package/src/tedi/components/form/file-upload/file-upload.es.js +138 -119
  98. package/src/tedi/components/form/file-upload/file-upload.module.scss.cjs.js +1 -1
  99. package/src/tedi/components/form/file-upload/file-upload.module.scss.es.js +1 -1
  100. package/src/tedi/components/form/search/search.cjs.js +1 -1
  101. package/src/tedi/components/form/search/search.es.js +60 -40
  102. package/src/tedi/components/form/search/search.module.scss.cjs.js +1 -1
  103. package/src/tedi/components/form/search/search.module.scss.es.js +7 -3
  104. package/src/tedi/components/layout/header/components/header-language/header-language.cjs.js +1 -0
  105. package/src/tedi/components/layout/header/components/header-language/header-language.es.js +105 -0
  106. package/src/tedi/components/layout/header/components/header-language/header-language.module.scss.cjs.js +1 -0
  107. package/src/tedi/components/layout/header/components/header-language/header-language.module.scss.es.js +12 -0
  108. package/src/tedi/components/layout/header/components/header-login/header-login.cjs.js +1 -0
  109. package/src/tedi/components/layout/header/components/header-login/header-login.es.js +36 -0
  110. package/src/tedi/components/layout/header/components/header-login/header-login.module.scss.cjs.js +1 -0
  111. package/src/tedi/components/layout/header/components/header-login/header-login.module.scss.es.js +8 -0
  112. package/src/tedi/components/layout/header/components/header-logout/header-logout.cjs.js +1 -0
  113. package/src/tedi/components/layout/header/components/header-logout/header-logout.es.js +33 -0
  114. package/src/tedi/components/layout/header/components/header-logout/header-logout.module.scss.cjs.js +1 -0
  115. package/src/tedi/components/layout/header/components/header-logout/header-logout.module.scss.es.js +7 -0
  116. package/src/tedi/components/layout/header/components/header-mobile-button/header-mobile-button.cjs.js +1 -0
  117. package/src/tedi/components/layout/header/components/header-mobile-button/header-mobile-button.es.js +25 -0
  118. package/src/tedi/components/layout/header/components/header-mobile-button/header-mobile-button.module.scss.cjs.js +1 -0
  119. package/src/tedi/components/layout/header/components/header-mobile-button/header-mobile-button.module.scss.es.js +10 -0
  120. package/src/tedi/components/layout/header/components/header-profile/header-profile.cjs.js +1 -0
  121. package/src/tedi/components/layout/header/components/header-profile/header-profile.es.js +136 -0
  122. package/src/tedi/components/layout/header/components/header-profile/header-profile.module.scss.cjs.js +1 -0
  123. package/src/tedi/components/layout/header/components/header-profile/header-profile.module.scss.es.js +14 -0
  124. package/src/tedi/components/layout/header/components/header-role/header-role-representatives.cjs.js +1 -0
  125. package/src/tedi/components/layout/header/components/header-role/header-role-representatives.es.js +89 -0
  126. package/src/tedi/components/layout/header/components/header-role/header-role.cjs.js +1 -0
  127. package/src/tedi/components/layout/header/components/header-role/header-role.es.js +162 -0
  128. package/src/tedi/components/layout/header/components/header-role/header-role.module.scss.cjs.js +1 -0
  129. package/src/tedi/components/layout/header/components/header-role/header-role.module.scss.es.js +25 -0
  130. package/src/tedi/components/layout/header/components/header-search/header-search.cjs.js +1 -0
  131. package/src/tedi/components/layout/header/components/header-search/header-search.es.js +60 -0
  132. package/src/tedi/components/layout/header/components/header-search/header-search.module.scss.cjs.js +1 -0
  133. package/src/tedi/components/layout/header/components/header-search/header-search.module.scss.es.js +9 -0
  134. package/src/tedi/components/layout/header/header.cjs.js +1 -0
  135. package/src/tedi/components/layout/header/header.es.js +63 -0
  136. package/src/tedi/components/layout/header/header.module.scss.cjs.js +1 -0
  137. package/src/tedi/components/layout/header/header.module.scss.es.js +13 -0
  138. package/src/tedi/components/layout/hide-at/hide-at.cjs.js +1 -0
  139. package/src/tedi/components/layout/hide-at/hide-at.es.js +10 -0
  140. package/src/tedi/components/layout/show-at/show-at.cjs.js +1 -0
  141. package/src/tedi/components/layout/show-at/show-at.es.js +10 -0
  142. package/src/tedi/components/tags/tag/tag.cjs.js +1 -1
  143. package/src/tedi/components/tags/tag/tag.d.ts +9 -0
  144. package/src/tedi/components/tags/tag/tag.es.js +18 -17
  145. package/src/tedi/helpers/hooks/use-file-upload.cjs.js +1 -1
  146. package/src/tedi/helpers/hooks/use-file-upload.es.js +71 -66
  147. package/src/tedi/index.d.ts +3 -0
  148. package/src/tedi/providers/label-provider/label-provider.cjs.js +1 -1
  149. package/src/tedi/providers/label-provider/label-provider.d.ts +2 -2
  150. package/src/tedi/providers/label-provider/label-provider.es.js +2 -2
  151. package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
  152. package/src/tedi/providers/label-provider/labels-map.d.ts +49 -0
  153. package/src/tedi/providers/label-provider/labels-map.es.js +114 -65
  154. package/tedi.cjs.js +1 -1
  155. package/tedi.es.js +303 -281
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),L=require("../../../../../external/classnames/index.cjs.js"),N=require("../../../../../external/react-dropzone/dist/es/index.cjs.js"),D=require("../../../helpers/hooks/use-file-upload.cjs.js"),$=require("../../base/icon/icon.cjs.js"),I=require("../../buttons/button/button.cjs.js"),S=require("../../misc/attachment/attachment.cjs.js"),f=require("../feedback-text/feedback-text.cjs.js"),T=require("../form-label/form-label.cjs.js"),n=require("./file-dropzone.module.scss.cjs.js"),k=require("../../../providers/label-provider/use-labels.cjs.js"),p=require("../../content/list/list.cjs.js"),P=s=>{const{getLabel:d}=k.useLabels(),{label:x=d("file-dropzone.label"),className:b,disabled:o=!1,helper:i,id:m,attachmentProps:c,...z}=s,{innerFiles:r,uploadErrorHelper:a,onFileChange:g,onFileRemove:j}=D.useFileUpload(s),{getRootProps:v,getInputProps:h,isDragActive:y}=N.useDropzone({disabled:o,accept:s.accept?{"application/*":[s.accept]}:void 0,multiple:s.multiple,maxSize:s.maxSize?s.maxSize*1024**2:void 0,onDrop:t=>{if(o)return;g({target:{files:t}})}}),F=L.default(n.default["tedi-file-dropzone"],{[n.default["tedi-file-dropzone--disabled"]]:o},{[n.default["tedi-file-dropzone--invalid"]]:((a==null?void 0:a.type)||(i==null?void 0:i.type))==="error"},{[n.default["tedi-file-dropzone--valid"]]:((a==null?void 0:a.type)||(i==null?void 0:i.type))==="valid"},{[n.default["tedi-file-dropzone--drop-over"]]:y},b),u=i?(i==null?void 0:i.id)??`${m}-helper`:void 0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{...v({tabIndex:o?-1:0,"aria-disabled":o,"aria-describedby":u}),className:F,children:[e.jsx("input",{...h(),disabled:o}),e.jsx("div",{className:n.default["tedi-file-dropzone__label-wrapper"],children:e.jsx(T.FormLabel,{...z,id:m,label:e.jsxs(e.Fragment,{children:[e.jsx($.Icon,{color:o?"tertiary":"secondary",size:24,name:"attach_file",display:"inline",className:n.default["tedi-file-dropzone__label-icon"]}),x]}),className:n.default["tedi-file-dropzone__label"]})})]}),i?e.jsx(f.FeedbackText,{...i,id:u}):a?e.jsx(f.FeedbackText,{...a,id:u}):null,!!r.length&&e.jsx(p.List,{className:n.default["tedi-file-dropzone__file-list"],style:"none","aria-label":d("file-dropzone.selected-files"),children:r.map(t=>{const l=typeof c=="function"?c(t):c,{actions:q,..._}=l??{};return e.jsx(p.List.Item,{className:n.default["tedi-file-dropzone__file-list-item"],children:e.jsx(S.Attachment,{..._,name:t.name??"",isValid:t.isValid??(l==null?void 0:l.isValid),isLoading:t.isLoading??(l==null?void 0:l.isLoading),actions:e.jsxs(e.Fragment,{children:[q,e.jsx(I.Button,{visualType:"neutral",icon:"delete",onClick:()=>j(t),children:`${d("remove")} ${t.name??""}`})]})})},t.id??`${t.name??"file"}-${t.size??""}-${t.lastModified??""}`)})}),e.jsx("div",{className:"sr-only",role:"status","aria-live":"polite","aria-atomic":"true",children:r.length===0?d("file-dropzone.no-file"):d("file-dropzone.files-selected",r.length)})]})};exports.FileDropzone=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),R=require("../../../../../external/classnames/index.cjs.js"),S=require("react"),P=require("../../../../../external/react-dropzone/dist/es/index.cjs.js"),T=require("../../../helpers/hooks/use-file-upload.cjs.js"),V=require("../../base/icon/icon.cjs.js"),A=require("../../buttons/button/button.cjs.js"),M=require("../../misc/attachment/attachment.cjs.js"),B=require("../feedback-text/feedback-text.cjs.js"),C=require("../form-label/form-label.cjs.js"),n=require("./file-dropzone.module.scss.cjs.js"),O=require("../../../providers/label-provider/use-labels.cjs.js"),b=require("../../content/list/list.cjs.js"),U=l=>{const{getLabel:r}=O.useLabels(),{label:h=r("file-dropzone.label"),className:v,disabled:o=!1,helper:g,id:j,attachmentProps:c,...y}=l,{innerFiles:p,uploadErrorHelper:s,onFileChange:q,onFileRemove:F,announcement:_}=T.useFileUpload(l),L=S.useId(),f=j??L,{getRootProps:N,getInputProps:$,isDragActive:I}=P.useDropzone({disabled:o,accept:l.accept?{"application/*":[l.accept]}:void 0,multiple:l.multiple,maxSize:l.maxSize?l.maxSize*1024**2:void 0,onDrop:(i,a=[])=>{if(o)return;const u=a.filter(m=>m.errors.some(z=>z.code==="file-too-large"||z.code==="file-invalid-type")).map(m=>m.file),d=[...i,...u];if(d.length===0)return;q({target:{files:d}})}}),t=(s==null?void 0:s.type)==="error"?s:g??s,x=t?t.id??`${f}-helper`:void 0,D=R.default(n.default["tedi-file-dropzone"],{[n.default["tedi-file-dropzone--disabled"]]:o},{[n.default["tedi-file-dropzone--invalid"]]:(t==null?void 0:t.type)==="error"},{[n.default["tedi-file-dropzone--valid"]]:(t==null?void 0:t.type)==="valid"},{[n.default["tedi-file-dropzone--drop-over"]]:I},v);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{...N({role:"button",tabIndex:o?-1:0,"aria-disabled":o,"aria-describedby":x}),className:D,children:[e.jsx("input",{...$(),disabled:o}),e.jsx("div",{className:n.default["tedi-file-dropzone__label-wrapper"],children:e.jsx(C.FormLabel,{...y,id:f,label:e.jsxs(e.Fragment,{children:[e.jsx(V.Icon,{color:o?"tertiary":"secondary",size:24,name:"attach_file",display:"inline",className:n.default["tedi-file-dropzone__label-icon"]}),h]}),className:n.default["tedi-file-dropzone__label"]})})]}),t&&e.jsx(B.FeedbackText,{...t,id:x}),!!p.length&&e.jsx(b.List,{className:n.default["tedi-file-dropzone__file-list"],style:"none","aria-label":r("file-dropzone.selected-files"),children:p.map(i=>{const a=typeof c=="function"?c(i):c,{actions:u,...d}=a??{};return e.jsxs(b.List.Item,{className:n.default["tedi-file-dropzone__file-list-item"],children:[e.jsx(M.Attachment,{...d,name:i.name??"",isValid:i.isValid??(a==null?void 0:a.isValid),isLoading:i.isLoading??(a==null?void 0:a.isLoading),actions:e.jsxs(e.Fragment,{children:[u,e.jsx(A.Button,{visualType:"neutral",icon:"delete",onClick:()=>F(i),children:`${r("remove")} ${i.name??""}`})]})}),i.isValid===!1&&e.jsx("span",{className:"sr-only",children:`${r("file-dropzone.failed")} ${i.name??""}`})]},i.id??`${i.name??"file"}-${i.size??""}-${i.lastModified??""}`)})}),e.jsx("div",{className:"sr-only",role:"status","aria-live":"polite","aria-atomic":"true",children:_})]})};exports.FileDropzone=U;
@@ -1,114 +1,125 @@
1
- import { jsxs as c, Fragment as f, jsx as t } from "react/jsx-runtime";
2
- import I from "../../../../../external/classnames/index.es.js";
3
- import { useDropzone as A } from "../../../../../external/react-dropzone/dist/es/index.es.js";
4
- import { useFileUpload as P } from "../../../helpers/hooks/use-file-upload.es.js";
5
- import { Icon as S } from "../../base/icon/icon.es.js";
6
- import { Button as V } from "../../buttons/button/button.es.js";
7
- import { Attachment as j } from "../../misc/attachment/attachment.es.js";
8
- import { FeedbackText as b } from "../feedback-text/feedback-text.es.js";
9
- import { FormLabel as k } from "../form-label/form-label.es.js";
10
- import o from "./file-dropzone.module.scss.es.js";
11
- import { useLabels as B } from "../../../providers/label-provider/use-labels.es.js";
12
- import { List as v } from "../../content/list/list.es.js";
13
- const W = (l) => {
14
- const { getLabel: s } = B(), {
15
- label: h = s("file-dropzone.label"),
16
- className: u,
17
- disabled: d = !1,
18
- helper: e,
19
- id: z,
1
+ import { jsxs as s, Fragment as z, jsx as o } from "react/jsx-runtime";
2
+ import P from "../../../../../external/classnames/index.es.js";
3
+ import S from "react";
4
+ import { useDropzone as B } from "../../../../../external/react-dropzone/dist/es/index.es.js";
5
+ import { useFileUpload as C } from "../../../helpers/hooks/use-file-upload.es.js";
6
+ import { Icon as M } from "../../base/icon/icon.es.js";
7
+ import { Button as T } from "../../buttons/button/button.es.js";
8
+ import { Attachment as w } from "../../misc/attachment/attachment.es.js";
9
+ import { FeedbackText as O } from "../feedback-text/feedback-text.es.js";
10
+ import { FormLabel as U } from "../form-label/form-label.es.js";
11
+ import t from "./file-dropzone.module.scss.es.js";
12
+ import { useLabels as q } from "../../../providers/label-provider/use-labels.es.js";
13
+ import { List as g } from "../../content/list/list.es.js";
14
+ const te = (l) => {
15
+ const { getLabel: d } = q(), {
16
+ label: y = d("file-dropzone.label"),
17
+ className: _,
18
+ disabled: n = !1,
19
+ helper: N,
20
+ id: x,
20
21
  attachmentProps: m,
21
- ...g
22
- } = l, { innerFiles: r, uploadErrorHelper: a, onFileChange: y, onFileRemove: _ } = P(l), { getRootProps: N, getInputProps: x, isDragActive: F } = A({
23
- disabled: d,
22
+ ...F
23
+ } = l, { innerFiles: h, uploadErrorHelper: r, onFileChange: I, onFileRemove: $, announcement: L } = C(l), D = S.useId(), u = x ?? D, { getRootProps: R, getInputProps: V, isDragActive: j } = B({
24
+ disabled: n,
24
25
  accept: l.accept ? { "application/*": [l.accept] } : void 0,
25
26
  multiple: l.multiple,
26
27
  maxSize: l.maxSize ? l.maxSize * 1024 ** 2 : void 0,
27
- onDrop: (i) => {
28
- if (d) return;
29
- y({
30
- target: { files: i }
28
+ onDrop: (e, a = []) => {
29
+ if (n) return;
30
+ const p = a.filter(
31
+ (f) => f.errors.some((b) => b.code === "file-too-large" || b.code === "file-invalid-type")
32
+ ).map((f) => f.file), c = [...e, ...p];
33
+ if (c.length === 0) return;
34
+ I({
35
+ target: { files: c }
31
36
  });
32
37
  }
33
- }), L = I(
34
- o["tedi-file-dropzone"],
35
- { [o["tedi-file-dropzone--disabled"]]: d },
36
- { [o["tedi-file-dropzone--invalid"]]: ((a == null ? void 0 : a.type) || (e == null ? void 0 : e.type)) === "error" },
37
- { [o["tedi-file-dropzone--valid"]]: ((a == null ? void 0 : a.type) || (e == null ? void 0 : e.type)) === "valid" },
38
- { [o["tedi-file-dropzone--drop-over"]]: F },
39
- u
40
- ), p = e ? (e == null ? void 0 : e.id) ?? `${z}-helper` : void 0;
41
- return /* @__PURE__ */ c(f, { children: [
42
- /* @__PURE__ */ c(
38
+ }), i = (r == null ? void 0 : r.type) === "error" ? r : N ?? r, v = i ? i.id ?? `${u}-helper` : void 0, A = P(
39
+ t["tedi-file-dropzone"],
40
+ { [t["tedi-file-dropzone--disabled"]]: n },
41
+ // Drive the visual state from the same `feedback` that is rendered, so the
42
+ // invalid/valid styling never diverges from the message shown.
43
+ { [t["tedi-file-dropzone--invalid"]]: (i == null ? void 0 : i.type) === "error" },
44
+ { [t["tedi-file-dropzone--valid"]]: (i == null ? void 0 : i.type) === "valid" },
45
+ { [t["tedi-file-dropzone--drop-over"]]: j },
46
+ _
47
+ );
48
+ return /* @__PURE__ */ s(z, { children: [
49
+ /* @__PURE__ */ s(
43
50
  "div",
44
51
  {
45
- ...N({
46
- tabIndex: d ? -1 : 0,
47
- "aria-disabled": d,
48
- "aria-describedby": p
52
+ ...R({
53
+ role: "button",
54
+ tabIndex: n ? -1 : 0,
55
+ "aria-disabled": n,
56
+ "aria-describedby": v
49
57
  }),
50
- className: L,
58
+ className: A,
51
59
  children: [
52
- /* @__PURE__ */ t("input", { ...x(), disabled: d }),
53
- /* @__PURE__ */ t("div", { className: o["tedi-file-dropzone__label-wrapper"], children: /* @__PURE__ */ t(
54
- k,
60
+ /* @__PURE__ */ o("input", { ...V(), disabled: n }),
61
+ /* @__PURE__ */ o("div", { className: t["tedi-file-dropzone__label-wrapper"], children: /* @__PURE__ */ o(
62
+ U,
55
63
  {
56
- ...g,
57
- id: z,
58
- label: /* @__PURE__ */ c(f, { children: [
59
- /* @__PURE__ */ t(
60
- S,
64
+ ...F,
65
+ id: u,
66
+ label: /* @__PURE__ */ s(z, { children: [
67
+ /* @__PURE__ */ o(
68
+ M,
61
69
  {
62
- color: d ? "tertiary" : "secondary",
70
+ color: n ? "tertiary" : "secondary",
63
71
  size: 24,
64
72
  name: "attach_file",
65
73
  display: "inline",
66
- className: o["tedi-file-dropzone__label-icon"]
74
+ className: t["tedi-file-dropzone__label-icon"]
67
75
  }
68
76
  ),
69
- h
77
+ y
70
78
  ] }),
71
- className: o["tedi-file-dropzone__label"]
79
+ className: t["tedi-file-dropzone__label"]
72
80
  }
73
81
  ) })
74
82
  ]
75
83
  }
76
84
  ),
77
- e ? /* @__PURE__ */ t(b, { ...e, id: p }) : a ? /* @__PURE__ */ t(b, { ...a, id: p }) : null,
78
- !!r.length && /* @__PURE__ */ t(
79
- v,
85
+ i && /* @__PURE__ */ o(O, { ...i, id: v }),
86
+ !!h.length && /* @__PURE__ */ o(
87
+ g,
80
88
  {
81
- className: o["tedi-file-dropzone__file-list"],
89
+ className: t["tedi-file-dropzone__file-list"],
82
90
  style: "none",
83
- "aria-label": s("file-dropzone.selected-files"),
84
- children: r.map((i) => {
85
- const n = typeof m == "function" ? m(i) : m, { actions: $, ...D } = n ?? {};
86
- return /* @__PURE__ */ t(
87
- v.Item,
91
+ "aria-label": d("file-dropzone.selected-files"),
92
+ children: h.map((e) => {
93
+ const a = typeof m == "function" ? m(e) : m, { actions: p, ...c } = a ?? {};
94
+ return /* @__PURE__ */ s(
95
+ g.Item,
88
96
  {
89
- className: o["tedi-file-dropzone__file-list-item"],
90
- children: /* @__PURE__ */ t(
91
- j,
92
- {
93
- ...D,
94
- name: i.name ?? "",
95
- isValid: i.isValid ?? (n == null ? void 0 : n.isValid),
96
- isLoading: i.isLoading ?? (n == null ? void 0 : n.isLoading),
97
- actions: /* @__PURE__ */ c(f, { children: [
98
- $,
99
- /* @__PURE__ */ t(V, { visualType: "neutral", icon: "delete", onClick: () => _(i), children: `${s("remove")} ${i.name ?? ""}` })
100
- ] })
101
- }
102
- )
97
+ className: t["tedi-file-dropzone__file-list-item"],
98
+ children: [
99
+ /* @__PURE__ */ o(
100
+ w,
101
+ {
102
+ ...c,
103
+ name: e.name ?? "",
104
+ isValid: e.isValid ?? (a == null ? void 0 : a.isValid),
105
+ isLoading: e.isLoading ?? (a == null ? void 0 : a.isLoading),
106
+ actions: /* @__PURE__ */ s(z, { children: [
107
+ p,
108
+ /* @__PURE__ */ o(T, { visualType: "neutral", icon: "delete", onClick: () => $(e), children: `${d("remove")} ${e.name ?? ""}` })
109
+ ] })
110
+ }
111
+ ),
112
+ e.isValid === !1 && /* @__PURE__ */ o("span", { className: "sr-only", children: `${d("file-dropzone.failed")} ${e.name ?? ""}` })
113
+ ]
103
114
  },
104
- i.id ?? `${i.name ?? "file"}-${i.size ?? ""}-${i.lastModified ?? ""}`
115
+ e.id ?? `${e.name ?? "file"}-${e.size ?? ""}-${e.lastModified ?? ""}`
105
116
  );
106
117
  })
107
118
  }
108
119
  ),
109
- /* @__PURE__ */ t("div", { className: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: r.length === 0 ? s("file-dropzone.no-file") : s("file-dropzone.files-selected", r.length) })
120
+ /* @__PURE__ */ o("div", { className: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: L })
110
121
  ] });
111
122
  };
112
123
  export {
113
- W as FileDropzone
124
+ te as FileDropzone
114
125
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),f=require("../../../../../external/classnames/index.cjs.js"),h=require("react"),Y=require("../../../helpers/hooks/use-file-upload.cjs.js"),Z=require("../../base/typography/text/text.cjs.js"),k=require("../../buttons/button/button.cjs.js"),H=require("../../buttons/closing-button/closing-button.cjs.js"),G=require("../form-label/form-label.cjs.js"),ee=require("../../misc/separator/separator.cjs.js"),le=require("../../tags/tag/tag.cjs.js"),B=require("../feedback-text/feedback-text.cjs.js"),g=require("../input-group/input-group.cjs.js"),a=require("./file-upload.module.scss.cjs.js"),ae=require("../../../providers/label-provider/use-labels.cjs.js"),T=require("../../../helpers/hooks/use-breakpoint.cjs.js"),ie=require("../../layout/grid/row.cjs.js"),I=require("../../layout/grid/col.cjs.js"),te=j=>{var N;const{getLabel:n}=ae.useLabels(),{id:se,name:w,label:_,accept:v,multiple:q,onChange:m,className:R,wrapperClassName:U,defaultFiles:S,onDelete:z,hasClearButton:M=!0,files:u,readOnly:p,disabled:s=!1,maxSize:O,validateIndividually:V=!1,size:c="default",helper:i,...$}=j,{innerFiles:y,uploadErrorHelper:t,onFileChange:D,onFileRemove:P,handleClear:F,announcement:W}=Y.useFileUpload({accept:v,maxSize:O,multiple:q,validateIndividually:V,defaultFiles:S,onChange:m,onDelete:z,files:u}),A=T.default(),E=h.useId(),d=(N=g.useOptionalInputGroup)==null?void 0:N.call(g),J=d==null?void 0:d.hasExternalLabel,x=j.id??(d==null?void 0:d.inputId)??E,L=h.useRef(null),K=f.default(a.default["tedi-file-upload"],{[a.default["tedi-file-upload--disabled"]]:s},R),b=(i==null?void 0:i.id)??(i||t?`${x}-helper`:void 0),o=h.useMemo(()=>u&&m?u:y,[u,y,m]),Q=(l,r)=>{const X=l.isValid===!1?`${l.name} (${n("file-upload.failed")})`:l.name;return e.jsx("li",{children:e.jsx(le.Tag,{color:l.isValid===!1?"danger":"primary",onClose:!l.isLoading&&!s&&!p?()=>P(l):void 0,isLoading:l.isLoading,"aria-label":X,children:l.name})},r)},C=()=>{if(o.length>1)return e.jsx("ul",{className:f.default(a.default["tedi-file-upload__items"],a.default["tedi-file-upload__truncate-list"]),children:o.map((l,r)=>Q(l,r))});if(o.length===1){const l=o[0],r=l.isValid===!1?`${l.name} (${n("file-upload.failed")})`:l.name;return e.jsx(Z.Text,{"aria-label":r,className:f.default(a.default["tedi-file-upload__items"],a.default["tedi-file-upload__truncate"]),children:l.name})}return null};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:a.default["tedi-file-upload__label-wrapper"],children:!J&&_&&e.jsx(G.FormLabel,{id:x,label:_??"",...$,renderWithoutLabel:p,className:a.default["tedi-file-upload__label"],size:c})}),e.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:W}),p?C():e.jsx("div",{className:f.default(a.default["tedi-file-upload__container"],{[a.default["tedi-file-upload--disabled"]]:s,[a.default["tedi-file-upload--error"]]:((t==null?void 0:t.type)||(i==null?void 0:i.type))==="error",[a.default["tedi-file-upload--valid"]]:((t==null?void 0:t.type)||(i==null?void 0:i.type))==="valid"},{[a.default[`tedi-file-upload__container--${c}`]]:c},U),children:e.jsx("div",{className:a.default["tedi-file-upload__content"],children:e.jsxs(ie.Row,{children:[e.jsx(I.Col,{className:"display-flex",children:C()}),e.jsx(I.Col,{xs:12,md:"auto",children:e.jsxs("div",{className:K,children:[e.jsx("input",{ref:L,id:x,type:"file",name:w,accept:v,onChange:D,multiple:q,disabled:s,"aria-invalid":!!t&&t.type==="error","aria-describedby":b}),M&&o.length>0&&!s&&e.jsxs(e.Fragment,{children:[T.isBreakpointBelow(A,"md")?e.jsx(k.Button,{visualType:"neutral",iconLeft:"close",disabled:s,onClick:F,className:a.default["tedi-file-upload__button"],children:n("clear")}):e.jsx(H.ClosingButton,{onClick:F,iconSize:18,title:n("clear")}),e.jsx(ee.Separator,{axis:"vertical",height:1.5,spacing:.5,color:"primary"})]}),e.jsx(k.Button,{visualType:"neutral",iconLeft:"file_upload",disabled:s,onClick:()=>{var l;return(l=L.current)==null?void 0:l.click()},className:a.default["tedi-file-upload__button"],size:c,children:n("file-upload.add")})]})})]})})}),i?e.jsx(B.FeedbackText,{...i,id:b}):t?e.jsx(B.FeedbackText,{...t,id:b}):null]})};exports.FileUpload=te;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("../../../../../external/classnames/index.cjs.js"),p=require("react"),de=require("../../../helpers/hooks/use-file-upload.cjs.js"),oe=require("../../base/typography/text/text.cjs.js"),S=require("../../buttons/button/button.cjs.js"),re=require("../../buttons/closing-button/closing-button.cjs.js"),ce=require("../form-label/form-label.cjs.js"),ue=require("../../misc/separator/separator.cjs.js"),fe=require("../../tags/tag/tag.cjs.js"),z=require("../feedback-text/feedback-text.cjs.js"),g=require("../input-group/input-group.cjs.js"),a=require("./file-upload.module.scss.cjs.js"),pe=require("../../../providers/label-provider/use-labels.cjs.js"),M=require("../../../helpers/hooks/use-breakpoint.cjs.js"),me=require("../../layout/grid/row.cjs.js"),O=require("../../layout/grid/col.cjs.js"),A=P=>{var U;const{getLabel:n}=pe.useLabels(),{id:V,name:$,label:v,accept:y,multiple:F,onChange:m,className:D,wrapperClassName:W,defaultFiles:H,onDelete:J,hasClearButton:K=!0,files:c,readOnly:x,disabled:s=!1,maxSize:Q,validateIndividually:X=!1,size:u="default",helper:i,...Y}=P,{innerFiles:_,uploadErrorHelper:t,onFileChange:Z,onFileRemove:E,handleClear:G,announcement:ee}=de.useFileUpload({accept:y,maxSize:Q,multiple:F,validateIndividually:X,defaultFiles:H,onChange:m,onDelete:J,files:c}),le=M.default(),ae=p.useId(),d=(U=g.useOptionalInputGroup)==null?void 0:U.call(g),te=d==null?void 0:d.hasExternalLabel,f=V??(d==null?void 0:d.inputId)??ae,q=p.useRef(null),N=p.useRef(null),ie=j.default(a.default["tedi-file-upload"],{[a.default["tedi-file-upload--disabled"]]:s},D),B=(t==null?void 0:t.type)==="error",h=i??(B?void 0:t),b=B?t:void 0,C=h?(i==null?void 0:i.id)??`${f}-helper`:void 0,L=b?`${f}-error`:void 0,k=[C,L].filter(Boolean).join(" ")||void 0,o=p.useMemo(()=>c&&m?c:_,[c,_,m]),R=()=>{var l;return(l=N.current)==null?void 0:l.focus()},se=l=>{E(l),R()},I=()=>{G(),R()},ne=(l,r)=>{const w=l.isValid===!1;return e.jsx("li",{children:e.jsxs(fe.Tag,{role:"presentation",color:w?"danger":"primary",onClose:!l.isLoading&&!s&&!x?()=>se(l):void 0,isLoading:l.isLoading,closeButtonProps:{title:`${n("remove")} ${l.name}`},children:[l.name,w&&e.jsxs("span",{className:"sr-only",children:[" (",n("file-upload.failed"),")"]})]})},l.id??r)},T=()=>{if(o.length>1)return e.jsx("ul",{className:a.default["tedi-file-upload__items"],children:o.map((l,r)=>ne(l,r))});if(o.length===1){const l=o[0],r=l.isValid===!1;return e.jsxs(oe.Text,{className:j.default(a.default["tedi-file-upload__items"],a.default["tedi-file-upload__items--truncate"]),children:[l.name,r&&e.jsxs("span",{className:"sr-only",children:[" (",n("file-upload.failed"),")"]})]})}return null};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:a.default["tedi-file-upload__label-wrapper"],children:!te&&v&&e.jsx(ce.FormLabel,{id:f,label:v??"",...Y,renderWithoutLabel:x,className:a.default["tedi-file-upload__label"],size:u})}),e.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:ee}),x?T():e.jsx("div",{className:j.default(a.default["tedi-file-upload__container"],{[a.default["tedi-file-upload--disabled"]]:s,[a.default["tedi-file-upload--error"]]:((t==null?void 0:t.type)||(i==null?void 0:i.type))==="error",[a.default["tedi-file-upload--valid"]]:((t==null?void 0:t.type)||(i==null?void 0:i.type))==="valid"},{[a.default[`tedi-file-upload__container--${u}`]]:u},W),children:e.jsx("div",{className:a.default["tedi-file-upload__content"],children:e.jsxs(me.Row,{children:[e.jsx(O.Col,{className:"display-flex",children:T()}),e.jsx(O.Col,{xs:12,md:"auto",children:e.jsxs("div",{className:ie,children:[e.jsx("input",{ref:q,id:f,type:"file",name:$,accept:y,onChange:Z,multiple:F,disabled:s,"aria-invalid":!!t&&t.type==="error","aria-describedby":k}),K&&o.length>0&&!s&&e.jsxs(e.Fragment,{children:[M.isBreakpointBelow(le,"md")?e.jsx(S.Button,{visualType:"neutral",iconLeft:"close",disabled:s,onClick:I,className:a.default["tedi-file-upload__button"],children:n("clear")}):e.jsx(re.ClosingButton,{onClick:I,iconSize:18,title:n("clear")}),e.jsx(ue.Separator,{axis:"vertical",height:1.5,spacing:.5,color:"primary"})]}),e.jsx(S.Button,{ref:N,visualType:"neutral",iconLeft:"file_upload",disabled:s,onClick:()=>{var l;return(l=q.current)==null?void 0:l.click()},className:a.default["tedi-file-upload__button"],size:u,"aria-describedby":k,children:n("file-upload.add")})]})})]})})}),h&&e.jsx(z.FeedbackText,{...h,id:C}),b&&e.jsx(z.FeedbackText,{...b,id:L})]})};A.displayName="FileUpload";exports.FileUpload=A;
@@ -84,5 +84,8 @@ export interface FileUploadProps extends Omit<FormLabelProps, 'id' | 'label'> {
84
84
  */
85
85
  size?: 'small' | 'default';
86
86
  }
87
- export declare const FileUpload: (props: FileUploadProps) => JSX.Element;
87
+ export declare const FileUpload: {
88
+ (props: FileUploadProps): JSX.Element;
89
+ displayName: string;
90
+ };
88
91
  export default FileUpload;
@@ -1,159 +1,178 @@
1
- import { jsxs as u, Fragment as I, jsx as l } from "react/jsx-runtime";
2
- import p from "../../../../../external/classnames/index.es.js";
3
- import g from "react";
4
- import { useFileUpload as Y } from "../../../helpers/hooks/use-file-upload.es.js";
5
- import { Text as Z } from "../../base/typography/text/text.es.js";
6
- import { Button as $ } from "../../buttons/button/button.es.js";
7
- import { ClosingButton as G } from "../../buttons/closing-button/closing-button.es.js";
8
- import { FormLabel as H } from "../form-label/form-label.es.js";
9
- import { Separator as ee } from "../../misc/separator/separator.es.js";
10
- import { Tag as le } from "../../tags/tag/tag.es.js";
11
- import { FeedbackText as w } from "../feedback-text/feedback-text.es.js";
12
- import { useOptionalInputGroup as ie } from "../input-group/input-group.es.js";
13
- import i from "./file-upload.module.scss.es.js";
14
- import { useLabels as ae } from "../../../providers/label-provider/use-labels.es.js";
15
- import te, { isBreakpointBelow as oe } from "../../../helpers/hooks/use-breakpoint.es.js";
16
- import { Row as ne } from "../../layout/grid/row.es.js";
17
- import { Col as R } from "../../layout/grid/col.es.js";
18
- const xe = (v) => {
19
- var B;
20
- const { getLabel: d } = ae(), {
21
- id: de,
22
- name: T,
23
- label: y,
24
- accept: N,
25
- multiple: F,
26
- onChange: f,
27
- className: z,
28
- wrapperClassName: S,
29
- defaultFiles: U,
30
- onDelete: V,
31
- hasClearButton: j = !0,
32
- files: c,
33
- readOnly: h,
34
- disabled: o = !1,
35
- maxSize: M,
36
- validateIndividually: O = !1,
37
- size: m = "default",
38
- helper: a,
39
- ...D
40
- } = v, { innerFiles: L, uploadErrorHelper: t, onFileChange: W, onFileRemove: q, handleClear: C, announcement: A } = Y({
41
- accept: N,
42
- maxSize: M,
43
- multiple: F,
44
- validateIndividually: O,
45
- defaultFiles: U,
46
- onChange: f,
47
- onDelete: V,
48
- files: c
49
- }), E = te(), J = g.useId(), n = (B = ie) == null ? void 0 : B(), K = n == null ? void 0 : n.hasExternalLabel, _ = v.id ?? (n == null ? void 0 : n.inputId) ?? J, x = g.useRef(null), P = p(i["tedi-file-upload"], { [i["tedi-file-upload--disabled"]]: o }, z), b = (a == null ? void 0 : a.id) ?? (a || t ? `${_}-helper` : void 0), r = g.useMemo(() => c && f ? c : L, [c, L, f]), Q = (e, s) => {
50
- const X = e.isValid === !1 ? `${e.name} (${d("file-upload.failed")})` : e.name;
51
- return /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l(
52
- le,
1
+ import { jsxs as t, Fragment as z, jsx as i } from "react/jsx-runtime";
2
+ import y from "../../../../../external/classnames/index.es.js";
3
+ import f from "react";
4
+ import { useFileUpload as ne } from "../../../helpers/hooks/use-file-upload.es.js";
5
+ import { Text as se } from "../../base/typography/text/text.es.js";
6
+ import { Button as S } from "../../buttons/button/button.es.js";
7
+ import { ClosingButton as re } from "../../buttons/closing-button/closing-button.es.js";
8
+ import { FormLabel as de } from "../form-label/form-label.es.js";
9
+ import { Separator as ce } from "../../misc/separator/separator.es.js";
10
+ import { Tag as me } from "../../tags/tag/tag.es.js";
11
+ import { FeedbackText as A } from "../feedback-text/feedback-text.es.js";
12
+ import { useOptionalInputGroup as pe } from "../input-group/input-group.es.js";
13
+ import l from "./file-upload.module.scss.es.js";
14
+ import { useLabels as ue } from "../../../providers/label-provider/use-labels.es.js";
15
+ import fe, { isBreakpointBelow as he } from "../../../helpers/hooks/use-breakpoint.es.js";
16
+ import { Row as ve } from "../../layout/grid/row.es.js";
17
+ import { Col as M } from "../../layout/grid/col.es.js";
18
+ const be = (O) => {
19
+ var $;
20
+ const { getLabel: s } = ue(), {
21
+ id: V,
22
+ name: D,
23
+ label: g,
24
+ accept: F,
25
+ multiple: N,
26
+ onChange: h,
27
+ className: P,
28
+ wrapperClassName: W,
29
+ defaultFiles: q,
30
+ onDelete: H,
31
+ hasClearButton: J = !0,
32
+ files: m,
33
+ readOnly: v,
34
+ disabled: n = !1,
35
+ maxSize: K,
36
+ validateIndividually: Q = !1,
37
+ size: p = "default",
38
+ helper: o,
39
+ ...X
40
+ } = O, { innerFiles: B, uploadErrorHelper: a, onFileChange: Y, onFileRemove: Z, handleClear: E, announcement: G } = ne({
41
+ accept: F,
42
+ maxSize: K,
43
+ multiple: N,
44
+ validateIndividually: Q,
45
+ defaultFiles: q,
46
+ onChange: h,
47
+ onDelete: H,
48
+ files: m
49
+ }), ee = fe(), ie = f.useId(), r = ($ = pe) == null ? void 0 : $(), le = r == null ? void 0 : r.hasExternalLabel, u = V ?? (r == null ? void 0 : r.inputId) ?? ie, C = f.useRef(null), L = f.useRef(null), ae = y(l["tedi-file-upload"], { [l["tedi-file-upload--disabled"]]: n }, P), x = (a == null ? void 0 : a.type) === "error", b = o ?? (x ? void 0 : a), _ = x ? a : void 0, k = b ? (o == null ? void 0 : o.id) ?? `${u}-helper` : void 0, I = _ ? `${u}-error` : void 0, R = [k, I].filter(Boolean).join(" ") || void 0, d = f.useMemo(() => m && h ? m : B, [m, B, h]), w = () => {
50
+ var e;
51
+ return (e = L.current) == null ? void 0 : e.focus();
52
+ }, oe = (e) => {
53
+ Z(e), w();
54
+ }, T = () => {
55
+ E(), w();
56
+ }, te = (e, c) => {
57
+ const j = e.isValid === !1;
58
+ return /* @__PURE__ */ i("li", { children: /* @__PURE__ */ t(
59
+ me,
53
60
  {
54
- color: e.isValid === !1 ? "danger" : "primary",
55
- onClose: !e.isLoading && !o && !h ? () => q(e) : void 0,
61
+ role: "presentation",
62
+ color: j ? "danger" : "primary",
63
+ onClose: !e.isLoading && !n && !v ? () => oe(e) : void 0,
56
64
  isLoading: e.isLoading,
57
- "aria-label": X,
58
- children: e.name
65
+ closeButtonProps: { title: `${s("remove")} ${e.name}` },
66
+ children: [
67
+ e.name,
68
+ j && /* @__PURE__ */ t("span", { className: "sr-only", children: [
69
+ " (",
70
+ s("file-upload.failed"),
71
+ ")"
72
+ ] })
73
+ ]
59
74
  }
60
- ) }, s);
61
- }, k = () => {
62
- if (r.length > 1)
63
- return /* @__PURE__ */ l("ul", { className: p(i["tedi-file-upload__items"], i["tedi-file-upload__truncate-list"]), children: r.map((e, s) => Q(e, s)) });
64
- if (r.length === 1) {
65
- const e = r[0], s = e.isValid === !1 ? `${e.name} (${d("file-upload.failed")})` : e.name;
66
- return /* @__PURE__ */ l(
67
- Z,
68
- {
69
- "aria-label": s,
70
- className: p(i["tedi-file-upload__items"], i["tedi-file-upload__truncate"]),
71
- children: e.name
72
- }
73
- );
75
+ ) }, e.id ?? c);
76
+ }, U = () => {
77
+ if (d.length > 1)
78
+ return /* @__PURE__ */ i("ul", { className: l["tedi-file-upload__items"], children: d.map((e, c) => te(e, c)) });
79
+ if (d.length === 1) {
80
+ const e = d[0], c = e.isValid === !1;
81
+ return /* @__PURE__ */ t(se, { className: y(l["tedi-file-upload__items"], l["tedi-file-upload__items--truncate"]), children: [
82
+ e.name,
83
+ c && /* @__PURE__ */ t("span", { className: "sr-only", children: [
84
+ " (",
85
+ s("file-upload.failed"),
86
+ ")"
87
+ ] })
88
+ ] });
74
89
  }
75
90
  return null;
76
91
  };
77
- return /* @__PURE__ */ u(I, { children: [
78
- /* @__PURE__ */ l("div", { className: i["tedi-file-upload__label-wrapper"], children: !K && y && /* @__PURE__ */ l(
79
- H,
92
+ return /* @__PURE__ */ t(z, { children: [
93
+ /* @__PURE__ */ i("div", { className: l["tedi-file-upload__label-wrapper"], children: !le && g && /* @__PURE__ */ i(
94
+ de,
80
95
  {
81
- id: _,
82
- label: y ?? "",
83
- ...D,
84
- renderWithoutLabel: h,
85
- className: i["tedi-file-upload__label"],
86
- size: m
96
+ id: u,
97
+ label: g ?? "",
98
+ ...X,
99
+ renderWithoutLabel: v,
100
+ className: l["tedi-file-upload__label"],
101
+ size: p
87
102
  }
88
103
  ) }),
89
- /* @__PURE__ */ l("div", { "aria-live": "polite", "aria-atomic": "true", className: "sr-only", children: A }),
90
- h ? k() : /* @__PURE__ */ l(
104
+ /* @__PURE__ */ i("div", { role: "status", "aria-live": "polite", "aria-atomic": "true", className: "sr-only", children: G }),
105
+ v ? U() : /* @__PURE__ */ i(
91
106
  "div",
92
107
  {
93
- className: p(
94
- i["tedi-file-upload__container"],
108
+ className: y(
109
+ l["tedi-file-upload__container"],
95
110
  {
96
- [i["tedi-file-upload--disabled"]]: o,
97
- [i["tedi-file-upload--error"]]: ((t == null ? void 0 : t.type) || (a == null ? void 0 : a.type)) === "error",
98
- [i["tedi-file-upload--valid"]]: ((t == null ? void 0 : t.type) || (a == null ? void 0 : a.type)) === "valid"
111
+ [l["tedi-file-upload--disabled"]]: n,
112
+ [l["tedi-file-upload--error"]]: ((a == null ? void 0 : a.type) || (o == null ? void 0 : o.type)) === "error",
113
+ [l["tedi-file-upload--valid"]]: ((a == null ? void 0 : a.type) || (o == null ? void 0 : o.type)) === "valid"
99
114
  },
100
- { [i[`tedi-file-upload__container--${m}`]]: m },
101
- S
115
+ { [l[`tedi-file-upload__container--${p}`]]: p },
116
+ W
102
117
  ),
103
- children: /* @__PURE__ */ l("div", { className: i["tedi-file-upload__content"], children: /* @__PURE__ */ u(ne, { children: [
104
- /* @__PURE__ */ l(R, { className: "display-flex", children: k() }),
105
- /* @__PURE__ */ l(R, { xs: 12, md: "auto", children: /* @__PURE__ */ u("div", { className: P, children: [
106
- /* @__PURE__ */ l(
118
+ children: /* @__PURE__ */ i("div", { className: l["tedi-file-upload__content"], children: /* @__PURE__ */ t(ve, { children: [
119
+ /* @__PURE__ */ i(M, { className: "display-flex", children: U() }),
120
+ /* @__PURE__ */ i(M, { xs: 12, md: "auto", children: /* @__PURE__ */ t("div", { className: ae, children: [
121
+ /* @__PURE__ */ i(
107
122
  "input",
108
123
  {
109
- ref: x,
110
- id: _,
124
+ ref: C,
125
+ id: u,
111
126
  type: "file",
112
- name: T,
113
- accept: N,
114
- onChange: W,
115
- multiple: F,
116
- disabled: o,
117
- "aria-invalid": !!t && t.type === "error",
118
- "aria-describedby": b
127
+ name: D,
128
+ accept: F,
129
+ onChange: Y,
130
+ multiple: N,
131
+ disabled: n,
132
+ "aria-invalid": !!a && a.type === "error",
133
+ "aria-describedby": R
119
134
  }
120
135
  ),
121
- j && r.length > 0 && !o && /* @__PURE__ */ u(I, { children: [
122
- oe(E, "md") ? /* @__PURE__ */ l(
123
- $,
136
+ J && d.length > 0 && !n && /* @__PURE__ */ t(z, { children: [
137
+ he(ee, "md") ? /* @__PURE__ */ i(
138
+ S,
124
139
  {
125
140
  visualType: "neutral",
126
141
  iconLeft: "close",
127
- disabled: o,
128
- onClick: C,
129
- className: i["tedi-file-upload__button"],
130
- children: d("clear")
142
+ disabled: n,
143
+ onClick: T,
144
+ className: l["tedi-file-upload__button"],
145
+ children: s("clear")
131
146
  }
132
- ) : /* @__PURE__ */ l(G, { onClick: C, iconSize: 18, title: d("clear") }),
133
- /* @__PURE__ */ l(ee, { axis: "vertical", height: 1.5, spacing: 0.5, color: "primary" })
147
+ ) : /* @__PURE__ */ i(re, { onClick: T, iconSize: 18, title: s("clear") }),
148
+ /* @__PURE__ */ i(ce, { axis: "vertical", height: 1.5, spacing: 0.5, color: "primary" })
134
149
  ] }),
135
- /* @__PURE__ */ l(
136
- $,
150
+ /* @__PURE__ */ i(
151
+ S,
137
152
  {
153
+ ref: L,
138
154
  visualType: "neutral",
139
155
  iconLeft: "file_upload",
140
- disabled: o,
156
+ disabled: n,
141
157
  onClick: () => {
142
158
  var e;
143
- return (e = x.current) == null ? void 0 : e.click();
159
+ return (e = C.current) == null ? void 0 : e.click();
144
160
  },
145
- className: i["tedi-file-upload__button"],
146
- size: m,
147
- children: d("file-upload.add")
161
+ className: l["tedi-file-upload__button"],
162
+ size: p,
163
+ "aria-describedby": R,
164
+ children: s("file-upload.add")
148
165
  }
149
166
  )
150
167
  ] }) })
151
168
  ] }) })
152
169
  }
153
170
  ),
154
- a ? /* @__PURE__ */ l(w, { ...a, id: b }) : t ? /* @__PURE__ */ l(w, { ...t, id: b }) : null
171
+ b && /* @__PURE__ */ i(A, { ...b, id: k }),
172
+ _ && /* @__PURE__ */ i(A, { ..._, id: I })
155
173
  ] });
156
174
  };
175
+ be.displayName = "FileUpload";
157
176
  export {
158
- xe as FileUpload
177
+ be as FileUpload
159
178
  };
@@ -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","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;
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__button":"tedi-file-upload__button-f37449e6","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__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;
@@ -1,9 +1,9 @@
1
1
  const e = {
2
2
  "tedi-file-upload": "tedi-file-upload-115f37c2",
3
+ "tedi-file-upload__button": "tedi-file-upload__button-f37449e6",
3
4
  "tedi-file-upload__items": "tedi-file-upload__items-c73c19e5",
4
5
  "tedi-file-upload__container": "tedi-file-upload__container-6b0f28a8",
5
6
  "tedi-file-upload__container--default": "tedi-file-upload__container--default-56af0d96",
6
- "tedi-file-upload__button": "tedi-file-upload__button-f37449e6",
7
7
  "tedi-file-upload__container--small": "tedi-file-upload__container--small-4d5cd36e",
8
8
  "tedi-file-upload--disabled": "tedi-file-upload--disabled-88f4fdcd",
9
9
  "tedi-file-upload--error": "tedi-file-upload--error-388cda6f",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),i=require("../../../../../external/classnames/index.cjs.js"),v=require("react"),L=require("../../buttons/button/button.cjs.js"),N=require("../textfield/textfield.cjs.js"),s=require("./search.module.scss.cjs.js"),w=require("../../../providers/label-provider/use-labels.cjs.js"),u=v.forwardRef(({placeholder:c,isClearable:d=!0,searchIcon:n="search",onSearch:a,onChange:o,button:e,ariaLabel:f,className:h,input:x,...t},_)=>{const{getLabel:r}=w.useLabels(),b=j=>{j.key==="Enter"&&(a==null||a(t.value))},m=()=>{a==null||a(t.value)},p={...t,ref:_,inputClassName:i.default(s.default["tedi-search__input"],e&&s.default["tedi-search__input--has-button"],h),placeholder:c,isClearable:d,onKeyDown:b,onChange:o,input:{...x,role:"searchbox"},...e?{}:{icon:n}},q=c||r("search"),y=f??q;return l.jsxs("div",{className:i.default(s.default["tedi-search__wrapper"]),role:"search","aria-label":y,children:[l.jsx(N.TextField,{...p}),e&&l.jsx(L.Button,{...e,onClick:m,className:i.default(s.default["tedi-search__button"],e.className),"aria-label":e.children?void 0:r("search"),children:e.children??r("search")})]})});u.displayName="Search";exports.Search=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),t=require("../../../../../external/classnames/index.cjs.js"),v=require("react"),w=require("../../buttons/button/button.cjs.js"),j=require("../textfield/textfield.cjs.js"),a=require("./search.module.scss.cjs.js"),L=require("../../../providers/label-provider/use-labels.cjs.js"),n=v.forwardRef(({placeholder:u,isClearable:o=!0,searchIcon:r="search",onSearch:s,onChange:f,button:e,ariaLabel:h,className:_,input:p,...l},m)=>{const{getLabel:i}=L.useLabels(),b=g=>{g.key==="Enter"&&(s==null||s(l.value))},x=()=>{s==null||s(l.value)},d=typeof r=="string"?{name:r}:r,y={color:"secondary",...d,className:t.default(d.className,l.disabled&&a.default["tedi-search__icon--disabled"])},q={...l,ref:m,inputClassName:t.default(a.default["tedi-search__input"],e&&a.default["tedi-search__input--has-button"],_),placeholder:u,isClearable:o,onKeyDown:b,onChange:f,input:{...p,role:"searchbox"},...e?{}:{icon:y}},N=h||i("search");return c.jsxs("div",{className:t.default(a.default["tedi-search__wrapper"],l.size==="small"&&a.default["tedi-search__wrapper--small"],l.size==="large"&&a.default["tedi-search__wrapper--large"]),role:"search","aria-label":N,children:[c.jsx(j.TextField,{...q}),e&&c.jsx(w.Button,{...e,onClick:x,className:t.default(a.default["tedi-search__button"],!e.children&&a.default["tedi-search__button--icon-only"],e.className),"aria-label":e.children?void 0:i("search"),children:e.children??i("search")})]})});n.displayName="Search";exports.Search=n;