@tedi-design-system/react 18.0.0-rc.22 → 18.0.0-rc.24

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 (59) hide show
  1. package/_virtual/index.cjs10.js +1 -1
  2. package/_virtual/index.cjs11.js +1 -1
  3. package/_virtual/index.cjs12.js +1 -1
  4. package/_virtual/index.cjs13.js +1 -1
  5. package/_virtual/index.cjs5.js +1 -1
  6. package/_virtual/index.cjs6.js +1 -1
  7. package/_virtual/index.cjs7.js +1 -1
  8. package/_virtual/index.cjs8.js +1 -1
  9. package/_virtual/index.cjs9.js +1 -1
  10. package/_virtual/index.es10.js +1 -1
  11. package/_virtual/index.es11.js +1 -1
  12. package/_virtual/index.es12.js +1 -1
  13. package/_virtual/index.es13.js +4 -2
  14. package/_virtual/index.es5.js +2 -4
  15. package/_virtual/index.es6.js +1 -1
  16. package/_virtual/index.es7.js +1 -1
  17. package/_virtual/index.es8.js +1 -1
  18. package/_virtual/index.es9.js +1 -1
  19. package/bundle-stats.html +1 -1
  20. package/external/@mui/system/colorManipulator.cjs.js +1 -1
  21. package/external/@mui/system/colorManipulator.es.js +2 -2
  22. package/external/@mui/system/createStyled.cjs.js +1 -1
  23. package/external/@mui/system/createStyled.es.js +6 -6
  24. package/external/@mui/system/useThemeWithoutDefault.cjs.js +1 -1
  25. package/external/@mui/system/useThemeWithoutDefault.es.js +1 -1
  26. package/external/toposort/index.cjs.js +1 -1
  27. package/external/toposort/index.es.js +1 -1
  28. package/index.css +1 -1
  29. package/package.json +1 -1
  30. package/src/tedi/components/content/label/label.cjs.js +1 -1
  31. package/src/tedi/components/content/label/label.es.js +10 -10
  32. package/src/tedi/components/content/label/label.module.scss.cjs.js +1 -1
  33. package/src/tedi/components/content/label/label.module.scss.es.js +2 -1
  34. package/src/tedi/components/form/file-dropzone/file-dropzone.cjs.js +1 -1
  35. package/src/tedi/components/form/file-dropzone/file-dropzone.d.ts +29 -3
  36. package/src/tedi/components/form/file-dropzone/file-dropzone.es.js +90 -68
  37. package/src/tedi/components/form/file-dropzone/file-dropzone.module.scss.cjs.js +1 -1
  38. package/src/tedi/components/form/file-dropzone/file-dropzone.module.scss.es.js +2 -2
  39. package/src/tedi/components/form/file-upload/file-upload.d.ts +9 -0
  40. package/src/tedi/components/misc/attachment/attachment.cjs.js +1 -0
  41. package/src/tedi/components/misc/attachment/attachment.d.ts +61 -0
  42. package/src/tedi/components/misc/attachment/attachment.es.js +92 -0
  43. package/src/tedi/components/misc/attachment/attachment.module.scss.cjs.js +1 -0
  44. package/src/tedi/components/misc/attachment/attachment.module.scss.es.js +19 -0
  45. package/src/tedi/components/misc/attachment/index.d.ts +1 -0
  46. package/src/tedi/components/misc/ellipsis/ellipsis.cjs.js +1 -1
  47. package/src/tedi/components/misc/ellipsis/ellipsis.d.ts +11 -1
  48. package/src/tedi/components/misc/ellipsis/ellipsis.es.js +28 -21
  49. package/src/tedi/components/misc/ellipsis/ellipsis.module.scss.cjs.js +1 -1
  50. package/src/tedi/components/misc/ellipsis/ellipsis.module.scss.es.js +6 -3
  51. package/src/tedi/components/tags/tag/tag.cjs.js +1 -1
  52. package/src/tedi/components/tags/tag/tag.d.ts +10 -0
  53. package/src/tedi/components/tags/tag/tag.es.js +24 -21
  54. package/src/tedi/components/tags/tag/tag.module.scss.cjs.js +1 -1
  55. package/src/tedi/components/tags/tag/tag.module.scss.es.js +1 -0
  56. package/src/tedi/helpers/hooks/use-file-upload.d.ts +43 -0
  57. package/src/tedi/index.d.ts +1 -0
  58. package/tedi.cjs.js +1 -1
  59. package/tedi.es.js +223 -221
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tedi-design-system/react",
3
- "version": "18.0.0-rc.22",
3
+ "version": "18.0.0-rc.24",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("../../../../../external/classnames/index.cjs.js"),j=require("react"),x=require("../../buttons/info-button/info-button.cjs.js"),l=require("../../overlays/tooltip/tooltip.cjs.js"),t=require("./label.module.scss.cjs.js"),B=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),g=require("../../../providers/label-provider/use-labels.cjs.js"),i=j.forwardRef((r,s)=>{const{getCurrentBreakpointProps:n}=B.useBreakpointProps(r.defaultServerBreakpoint),{as:u="label",children:d,className:c,isBold:b,isSmall:o,required:p,tooltip:a,...f}=n(r),{getLabel:m}=g.useLabels(),q=h.default(t.default["tedi-label"],b&&t.default["tedi-label--bold"],o&&t.default["tedi-label--small"],c);return e.jsxs(u,{ref:s,className:q,...f,children:[d,p&&e.jsx("span",{className:t.default["tedi-label__required"],"aria-hidden":"true",children:"*"}),a&&e.jsx("span",{"aria-hidden":"true",children:e.jsxs(l.Tooltip,{children:[e.jsx(l.Tooltip.Trigger,{children:e.jsx(x.InfoButton,{isSmall:o,"aria-label":m("infoButton.moreInformation")})}),e.jsx(l.Tooltip.Content,{children:a})]})})]})});i.displayName="Label";exports.Label=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("../../../../../external/classnames/index.cjs.js"),j=require("react"),x=require("../../buttons/info-button/info-button.cjs.js"),l=require("../../overlays/tooltip/tooltip.cjs.js"),t=require("./label.module.scss.cjs.js"),B=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),g=require("../../../providers/label-provider/use-labels.cjs.js"),o=j.forwardRef((r,s)=>{const{getCurrentBreakpointProps:n}=B.useBreakpointProps(r.defaultServerBreakpoint),{as:d="label",children:u,className:c,isBold:b,isSmall:a,required:f,tooltip:i,...p}=n(r),{getLabel:m}=g.useLabels(),q=h.default(t.default["tedi-label"],b&&t.default["tedi-label--bold"],a&&t.default["tedi-label--small"],c);return e.jsxs(d,{ref:s,className:q,...p,children:[u,f&&e.jsx("span",{className:t.default["tedi-label__required"],"aria-hidden":"true",children:"*"}),i&&e.jsx("span",{"aria-hidden":"true",className:t.default["tedi-label__info"],children:e.jsxs(l.Tooltip,{children:[e.jsx(l.Tooltip.Trigger,{children:e.jsx(x.InfoButton,{isSmall:a,"aria-label":m("infoButton.moreInformation")})}),e.jsx(l.Tooltip.Content,{children:i})]})})]})});o.displayName="Label";exports.Label=o;
@@ -5,33 +5,33 @@ import { InfoButton as g } from "../../buttons/info-button/info-button.es.js";
5
5
  import { Tooltip as l } from "../../overlays/tooltip/tooltip.es.js";
6
6
  import r from "./label.module.scss.es.js";
7
7
  import { useBreakpointProps as L } from "../../../helpers/hooks/use-breakpoint-props.es.js";
8
- import { useLabels as k } from "../../../providers/label-provider/use-labels.es.js";
9
- const x = N((o, s) => {
8
+ import { useLabels as _ } from "../../../providers/label-provider/use-labels.es.js";
9
+ const k = N((o, s) => {
10
10
  const { getCurrentBreakpointProps: n } = L(o.defaultServerBreakpoint), {
11
11
  as: m = "label",
12
12
  children: d,
13
- className: p,
14
- isBold: c,
13
+ className: c,
14
+ isBold: p,
15
15
  isSmall: t,
16
16
  required: f,
17
17
  tooltip: a,
18
18
  ...b
19
- } = n(o), { getLabel: u } = k(), h = B(
19
+ } = n(o), { getLabel: u } = _(), h = B(
20
20
  r["tedi-label"],
21
- c && r["tedi-label--bold"],
21
+ p && r["tedi-label--bold"],
22
22
  t && r["tedi-label--small"],
23
- p
23
+ c
24
24
  );
25
25
  return /* @__PURE__ */ i(m, { ref: s, className: h, ...b, children: [
26
26
  d,
27
27
  f && /* @__PURE__ */ e("span", { className: r["tedi-label__required"], "aria-hidden": "true", children: "*" }),
28
- a && /* @__PURE__ */ e("span", { "aria-hidden": "true", children: /* @__PURE__ */ i(l, { children: [
28
+ a && /* @__PURE__ */ e("span", { "aria-hidden": "true", className: r["tedi-label__info"], children: /* @__PURE__ */ i(l, { children: [
29
29
  /* @__PURE__ */ e(l.Trigger, { children: /* @__PURE__ */ e(g, { isSmall: t, "aria-label": u("infoButton.moreInformation") }) }),
30
30
  /* @__PURE__ */ e(l.Content, { children: a })
31
31
  ] }) })
32
32
  ] });
33
33
  });
34
- x.displayName = "Label";
34
+ k.displayName = "Label";
35
35
  export {
36
- x as Label
36
+ k as Label
37
37
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-label":"tedi-label-473ab627","tedi-label--small":"tedi-label--small-20e328dc","tedi-label--bold":"tedi-label--bold-9d758835","tedi-label__required":"tedi-label__required-414e3f9d"};exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-label":"tedi-label-473ab627","tedi-label--small":"tedi-label--small-20e328dc","tedi-label--bold":"tedi-label--bold-9d758835","tedi-label__required":"tedi-label__required-414e3f9d","tedi-label__info":"tedi-label__info-c9df19b4"};exports.default=e;
@@ -2,7 +2,8 @@ const e = {
2
2
  "tedi-label": "tedi-label-473ab627",
3
3
  "tedi-label--small": "tedi-label--small-20e328dc",
4
4
  "tedi-label--bold": "tedi-label--bold-9d758835",
5
- "tedi-label__required": "tedi-label__required-414e3f9d"
5
+ "tedi-label__required": "tedi-label__required-414e3f9d",
6
+ "tedi-label__info": "tedi-label__info-c9df19b4"
6
7
  };
7
8
  export {
8
9
  e as default
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),_=require("../../../../../external/classnames/index.cjs.js"),F=require("../../../../../external/react-dropzone/dist/es/index.cjs.js"),C=require("../../../helpers/hooks/use-file-upload.cjs.js"),u=require("../../base/icon/icon.cjs.js"),N=require("../../buttons/closing-button/closing-button.cjs.js"),f=require("../feedback-text/feedback-text.cjs.js"),D=require("../form-label/form-label.cjs.js"),t=require("./file-dropzone.module.scss.cjs.js"),I=require("../../../providers/label-provider/use-labels.cjs.js"),m=require("../../content/list/list.cjs.js"),L=require("../../cards/card/card.cjs.js"),S=require("../../cards/card/card-content/card-content.cjs.js"),k=require("../../layout/grid/row.cjs.js"),x=require("../../layout/grid/col.cjs.js"),w=o=>{const{getLabel:s}=I.useLabels(),{label:p=s("file-dropzone.label"),className:z,disabled:a=!1,helper:i,id:c,...b}=o,{innerFiles:d,uploadErrorHelper:n,onFileChange:j,onFileRemove:g}=C.useFileUpload(o),{getRootProps:v,getInputProps:q,isDragActive:h}=F.useDropzone({disabled:a,accept:o.accept?{"application/*":[o.accept]}:void 0,multiple:o.multiple,maxSize:o.maxSize?o.maxSize*1024**2:void 0,onDrop:l=>{if(a)return;j({target:{files:l}})}}),y=_.default(t.default["tedi-file-dropzone"],{[t.default["tedi-file-dropzone--disabled"]]:a},{[t.default["tedi-file-dropzone--invalid"]]:((n==null?void 0:n.type)||(i==null?void 0:i.type))==="error"},{[t.default["tedi-file-dropzone--valid"]]:((n==null?void 0:n.type)||(i==null?void 0:i.type))==="valid"},{[t.default["tedi-file-dropzone--drop-over"]]:h},z),r=i?(i==null?void 0:i.id)??`${c}-helper`:void 0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{...v({tabIndex:a?-1:0,"aria-disabled":a,"aria-describedby":r}),className:y,children:[e.jsx("input",{...q(),disabled:a}),e.jsxs("div",{className:t.default["tedi-file-dropzone__label-wrapper"],children:[e.jsx(u.Icon,{color:a?"tertiary":"secondary",size:24,name:"attach_file"}),e.jsx(D.FormLabel,{...b,id:c,label:p,className:t.default["tedi-file-dropzone__label"]})]})]}),i?e.jsx(f.FeedbackText,{...i,id:r}):n?e.jsx(f.FeedbackText,{...n,id:r}):null,!!d.length&&e.jsx(m.List,{className:t.default["tedi-file-dropzone__file-list"],style:"none","aria-label":s("file-dropzone.selected-files"),children:d.map(l=>e.jsx(m.List.Item,{className:t.default["tedi-file-dropzone__file-list-item"],children:e.jsx(L.Card,{background:l.isValid===!1?"danger-primary":"tertiary",borderless:!0,className:t.default["tedi-file-dropzone__file-item"],children:e.jsx(S.CardContent,{padding:.5,children:e.jsxs(k.Row,{alignItems:"center",children:[e.jsxs(x.Col,{className:t.default["tedi-file-dropzone__file-name"],children:[l.name," ",l.isValid===!1&&e.jsx(u.Icon,{name:"info",color:"danger",display:"inline",size:18})]}),e.jsx(x.Col,{width:"auto",children:e.jsx(N.ClosingButton,{iconSize:18,title:s("remove")+" "+l.name,onClick:()=>g(l)})})]})})})},l.id||l.name))}),e.jsx("div",{className:"sr-only",role:"status","aria-live":"polite","aria-atomic":"true",children:d.length===0?s("file-dropzone.no-file"):s("file-dropzone.files-selected",d.length)})]})};exports.FileDropzone=w;
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,12 +1,38 @@
1
- import { UseFileUploadProps } from '../../../helpers/hooks/use-file-upload';
1
+ import { FileUploadFile, UseFileUploadProps } from '../../../helpers/hooks/use-file-upload';
2
+ import { AttachmentProps } from '../../misc/attachment/attachment';
2
3
  import { FeedbackTextProps } from '../feedback-text/feedback-text';
3
4
  import { FormLabelProps } from '../form-label/form-label';
4
- export interface FileDropzoneProps extends Omit<FormLabelProps, 'size' | 'hideLabel'>, UseFileUploadProps {
5
+ export type FileDropzoneAttachmentProps = Partial<Omit<AttachmentProps, 'name'>> | ((file: FileUploadFile) => Partial<Omit<AttachmentProps, 'name'>>);
6
+ export interface FileDropzoneProps extends Omit<FormLabelProps, 'size' | 'hideLabel' | 'label'>, UseFileUploadProps {
7
+ /**
8
+ * Additional CSS class names to apply to the dropzone for custom styling
9
+ */
5
10
  className?: string;
11
+ /**
12
+ * The name attribute for the file input, used for form submission and identifying the field.
13
+ */
6
14
  name: string;
7
- label: string;
15
+ /**
16
+ * The text label displayed for the file dropzone, providing context for users.
17
+ * Defaults to the `LabelProvider`'s localised `file-dropzone.label` (e.g. "Lohista
18
+ * failid siia või klõpsa, et sirvida" in Estonian).
19
+ */
20
+ label?: string;
21
+ /**
22
+ * Provides helper text or feedback (such as an error or instruction message) to guide the user.
23
+ */
8
24
  helper?: FeedbackTextProps;
25
+ /**
26
+ * Disables the file dropzone, preventing user interaction.
27
+ */
9
28
  disabled?: boolean;
29
+ /**
30
+ * Overrides forwarded to each rendered `Attachment` (e.g. `icon`, `fileSize`,
31
+ * `progress`, `feedback`). Pass a function to vary per file. `FileDropzone`
32
+ * sets `name`, `isValid` and `isLoading` itself, and always appends a remove
33
+ * button to the `actions` slot (after any `actions` you provide here).
34
+ */
35
+ attachmentProps?: FileDropzoneAttachmentProps;
10
36
  }
11
37
  export declare const FileDropzone: (props: FileDropzoneProps) => JSX.Element;
12
38
  export default FileDropzone;
@@ -1,92 +1,114 @@
1
- import { jsxs as d, Fragment as C, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as c, Fragment as f, jsx as t } from "react/jsx-runtime";
2
2
  import I from "../../../../../external/classnames/index.es.js";
3
- import { useDropzone as D } from "../../../../../external/react-dropzone/dist/es/index.es.js";
4
- import { useFileUpload as L } from "../../../helpers/hooks/use-file-upload.es.js";
5
- import { Icon as f } from "../../base/icon/icon.es.js";
6
- import { ClosingButton as S } from "../../buttons/closing-button/closing-button.es.js";
7
- import { FeedbackText as p } from "../feedback-text/feedback-text.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";
8
9
  import { FormLabel as k } from "../form-label/form-label.es.js";
9
10
  import o from "./file-dropzone.module.scss.es.js";
10
- import { useLabels as w } from "../../../providers/label-provider/use-labels.es.js";
11
- import { List as z } from "../../content/list/list.es.js";
12
- import { Card as R } from "../../cards/card/card.es.js";
13
- import { CardContent as j } from "../../cards/card/card-content/card-content.es.js";
14
- import { Row as B } from "../../layout/grid/row.es.js";
15
- import { Col as b } from "../../layout/grid/col.es.js";
16
- const Z = (r) => {
17
- const { getLabel: n } = w(), { label: g = n("file-dropzone.label"), className: v, disabled: a = !1, helper: i, id: c, ...h } = r, { innerFiles: s, uploadErrorHelper: l, onFileChange: u, onFileRemove: y } = L(r), { getRootProps: _, getInputProps: N, isDragActive: x } = D({
18
- disabled: a,
19
- accept: r.accept ? { "application/*": [r.accept] } : void 0,
20
- multiple: r.multiple,
21
- maxSize: r.maxSize ? r.maxSize * 1024 ** 2 : void 0,
22
- onDrop: (t) => {
23
- if (a) return;
24
- u({
25
- target: { files: t }
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,
20
+ 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,
24
+ accept: l.accept ? { "application/*": [l.accept] } : void 0,
25
+ multiple: l.multiple,
26
+ maxSize: l.maxSize ? l.maxSize * 1024 ** 2 : void 0,
27
+ onDrop: (i) => {
28
+ if (d) return;
29
+ y({
30
+ target: { files: i }
26
31
  });
27
32
  }
28
- }), F = I(
33
+ }), L = I(
29
34
  o["tedi-file-dropzone"],
30
- { [o["tedi-file-dropzone--disabled"]]: a },
31
- { [o["tedi-file-dropzone--invalid"]]: ((l == null ? void 0 : l.type) || (i == null ? void 0 : i.type)) === "error" },
32
- { [o["tedi-file-dropzone--valid"]]: ((l == null ? void 0 : l.type) || (i == null ? void 0 : i.type)) === "valid" },
33
- { [o["tedi-file-dropzone--drop-over"]]: x },
34
- v
35
- ), m = i ? (i == null ? void 0 : i.id) ?? `${c}-helper` : void 0;
36
- return /* @__PURE__ */ d(C, { children: [
37
- /* @__PURE__ */ d(
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
43
  "div",
39
44
  {
40
- ..._({
41
- tabIndex: a ? -1 : 0,
42
- "aria-disabled": a,
43
- "aria-describedby": m
45
+ ...N({
46
+ tabIndex: d ? -1 : 0,
47
+ "aria-disabled": d,
48
+ "aria-describedby": p
44
49
  }),
45
- className: F,
50
+ className: L,
46
51
  children: [
47
- /* @__PURE__ */ e("input", { ...N(), disabled: a }),
48
- /* @__PURE__ */ d("div", { className: o["tedi-file-dropzone__label-wrapper"], children: [
49
- /* @__PURE__ */ e(f, { color: a ? "tertiary" : "secondary", size: 24, name: "attach_file" }),
50
- /* @__PURE__ */ e(k, { ...h, id: c, label: g, className: o["tedi-file-dropzone__label"] })
51
- ] })
52
+ /* @__PURE__ */ t("input", { ...x(), disabled: d }),
53
+ /* @__PURE__ */ t("div", { className: o["tedi-file-dropzone__label-wrapper"], children: /* @__PURE__ */ t(
54
+ k,
55
+ {
56
+ ...g,
57
+ id: z,
58
+ label: /* @__PURE__ */ c(f, { children: [
59
+ /* @__PURE__ */ t(
60
+ S,
61
+ {
62
+ color: d ? "tertiary" : "secondary",
63
+ size: 24,
64
+ name: "attach_file",
65
+ display: "inline",
66
+ className: o["tedi-file-dropzone__label-icon"]
67
+ }
68
+ ),
69
+ h
70
+ ] }),
71
+ className: o["tedi-file-dropzone__label"]
72
+ }
73
+ ) })
52
74
  ]
53
75
  }
54
76
  ),
55
- i ? /* @__PURE__ */ e(p, { ...i, id: m }) : l ? /* @__PURE__ */ e(p, { ...l, id: m }) : null,
56
- !!s.length && /* @__PURE__ */ e(
57
- z,
77
+ e ? /* @__PURE__ */ t(b, { ...e, id: p }) : a ? /* @__PURE__ */ t(b, { ...a, id: p }) : null,
78
+ !!r.length && /* @__PURE__ */ t(
79
+ v,
58
80
  {
59
81
  className: o["tedi-file-dropzone__file-list"],
60
82
  style: "none",
61
- "aria-label": n("file-dropzone.selected-files"),
62
- children: s.map((t) => /* @__PURE__ */ e(z.Item, { className: o["tedi-file-dropzone__file-list-item"], children: /* @__PURE__ */ e(
63
- R,
64
- {
65
- background: t.isValid === !1 ? "danger-primary" : "tertiary",
66
- borderless: !0,
67
- className: o["tedi-file-dropzone__file-item"],
68
- children: /* @__PURE__ */ e(j, { padding: 0.5, children: /* @__PURE__ */ d(B, { alignItems: "center", children: [
69
- /* @__PURE__ */ d(b, { className: o["tedi-file-dropzone__file-name"], children: [
70
- t.name,
71
- " ",
72
- t.isValid === !1 && /* @__PURE__ */ e(f, { name: "info", color: "danger", display: "inline", size: 18 })
73
- ] }),
74
- /* @__PURE__ */ e(b, { width: "auto", children: /* @__PURE__ */ e(
75
- S,
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,
88
+ {
89
+ className: o["tedi-file-dropzone__file-list-item"],
90
+ children: /* @__PURE__ */ t(
91
+ j,
76
92
  {
77
- iconSize: 18,
78
- title: n("remove") + " " + t.name,
79
- onClick: () => y(t)
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
+ ] })
80
101
  }
81
- ) })
82
- ] }) })
83
- }
84
- ) }, t.id || t.name))
102
+ )
103
+ },
104
+ i.id ?? `${i.name ?? "file"}-${i.size ?? ""}-${i.lastModified ?? ""}`
105
+ );
106
+ })
85
107
  }
86
108
  ),
87
- /* @__PURE__ */ e("div", { className: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: s.length === 0 ? n("file-dropzone.no-file") : n("file-dropzone.files-selected", s.length) })
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) })
88
110
  ] });
89
111
  };
90
112
  export {
91
- Z as FileDropzone
113
+ W as FileDropzone
92
114
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-file-dropzone":"tedi-file-dropzone-70698e52","tedi-file-dropzone__label-wrapper":"tedi-file-dropzone__label-wrapper-78360685","tedi-file-dropzone__label":"tedi-file-dropzone__label-5c15bc34","tedi-file-dropzone--disabled":"tedi-file-dropzone--disabled-0e01143d","tedi-file-dropzone--invalid":"tedi-file-dropzone--invalid-159cce6d","tedi-file-dropzone--valid":"tedi-file-dropzone--valid-d2d3ef3d","tedi-file-dropzone--drop-over":"tedi-file-dropzone--drop-over-3e31af77","tedi-file-dropzone__file-list":"tedi-file-dropzone__file-list-c1ededa3","tedi-file-dropzone__file-list-item":"tedi-file-dropzone__file-list-item-3ad71621","tedi-file-dropzone__file-name":"tedi-file-dropzone__file-name-f9bf2a63"};exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-file-dropzone":"tedi-file-dropzone-70698e52","tedi-file-dropzone__label-wrapper":"tedi-file-dropzone__label-wrapper-78360685","tedi-file-dropzone__label":"tedi-file-dropzone__label-5c15bc34","tedi-file-dropzone__label-icon":"tedi-file-dropzone__label-icon-180ef5ad","tedi-file-dropzone--disabled":"tedi-file-dropzone--disabled-0e01143d","tedi-file-dropzone--invalid":"tedi-file-dropzone--invalid-159cce6d","tedi-file-dropzone--valid":"tedi-file-dropzone--valid-d2d3ef3d","tedi-file-dropzone--drop-over":"tedi-file-dropzone--drop-over-3e31af77","tedi-file-dropzone__file-list":"tedi-file-dropzone__file-list-c1ededa3","tedi-file-dropzone__file-list-item":"tedi-file-dropzone__file-list-item-3ad71621"};exports.default=e;
@@ -2,13 +2,13 @@ const e = {
2
2
  "tedi-file-dropzone": "tedi-file-dropzone-70698e52",
3
3
  "tedi-file-dropzone__label-wrapper": "tedi-file-dropzone__label-wrapper-78360685",
4
4
  "tedi-file-dropzone__label": "tedi-file-dropzone__label-5c15bc34",
5
+ "tedi-file-dropzone__label-icon": "tedi-file-dropzone__label-icon-180ef5ad",
5
6
  "tedi-file-dropzone--disabled": "tedi-file-dropzone--disabled-0e01143d",
6
7
  "tedi-file-dropzone--invalid": "tedi-file-dropzone--invalid-159cce6d",
7
8
  "tedi-file-dropzone--valid": "tedi-file-dropzone--valid-d2d3ef3d",
8
9
  "tedi-file-dropzone--drop-over": "tedi-file-dropzone--drop-over-3e31af77",
9
10
  "tedi-file-dropzone__file-list": "tedi-file-dropzone__file-list-c1ededa3",
10
- "tedi-file-dropzone__file-list-item": "tedi-file-dropzone__file-list-item-3ad71621",
11
- "tedi-file-dropzone__file-name": "tedi-file-dropzone__file-name-f9bf2a63"
11
+ "tedi-file-dropzone__file-list-item": "tedi-file-dropzone__file-list-item-3ad71621"
12
12
  };
13
13
  export {
14
14
  e as default
@@ -2,7 +2,16 @@ import { FileUploadFile } from '../../../helpers/hooks/use-file-upload';
2
2
  import { FormLabelProps } from '../../form/form-label/form-label';
3
3
  import { FeedbackTextProps } from '../feedback-text/feedback-text';
4
4
  export interface FileUploadProps extends Omit<FormLabelProps, 'id' | 'label'> {
5
+ /**
6
+ * Unique HTML id for the file input, also used to associate the label and
7
+ * helper/error text for accessibility. When omitted, falls back to the
8
+ * surrounding `InputGroup`'s id or a generated one.
9
+ */
5
10
  id?: string;
11
+ /**
12
+ * Visible label for the field. May be omitted when the surrounding
13
+ * `InputGroup` provides its own label.
14
+ */
6
15
  label?: string;
7
16
  /**
8
17
  * Additional class names appended to the inner dropzone element
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),_=require("../../../../../external/classnames/index.cjs.js"),i=require("react"),v=require("../../base/icon/icon.cjs.js"),b=require("../../base/typography/text/text.cjs.js"),R=require("../../buttons/button/button.cjs.js"),V=require("../../form/feedback-text/feedback-text.cjs.js"),$=require("../../loaders/progress-bar/progress-bar.cjs.js"),t=require("./attachment.module.scss.cjs.js"),j=require("../../../helpers/hooks/use-breakpoint.cjs.js"),y=i.forwardRef((N,g)=>{const{name:c,feedback:s,fileSize:r,icon:l,actions:d,isLoading:o=!1,progress:q,progressLabel:m,isValid:k,direction:u,verticalBelow:B="sm",className:T,id:I,...w}=N,z=j.default(),A=u?u==="vertical":j.isBreakpointBelow(z,B),E=i.useId(),h=I??`tedi-attachment-${E}`,f=s?s.id??`${h}-feedback`:void 0,n=k===!1,S=_.default(t.default["tedi-attachment"],{[t.default["tedi-attachment--invalid"]]:n,[t.default["tedi-attachment--multi-line"]]:o,[t.default["tedi-attachment--vertical"]]:A},T),F=e.jsxs(e.Fragment,{children:[l&&e.jsx("span",{className:t.default["tedi-attachment__icon"],"aria-hidden":"true",children:e.jsx(v.Icon,{name:l,size:18,color:n?"danger":"secondary"})}),e.jsxs("span",{className:t.default["tedi-attachment__body"],children:[e.jsxs("span",{className:t.default["tedi-attachment__name"],children:[e.jsxs(b.Text,{element:"span",className:t.default["tedi-attachment__name-text"],children:[c,n&&e.jsx(v.Icon,{name:"error",color:"inherit",display:"inline",size:18,className:t.default["tedi-attachment__invalid-icon"]})]}),r&&e.jsx(b.Text,{element:"span",modifiers:"small",color:"tertiary",className:t.default["tedi-attachment__file-size"],children:r})]}),o&&e.jsx($.ProgressBar,{value:q,ariaLabel:c,valuePosition:"bottom",helper:m?{text:m,type:"hint"}:void 0,className:t.default["tedi-attachment__progress"]})]})]}),p=a=>{if(!i.isValidElement(a))return a;if(a.type===i.Fragment){const P=a.props.children;return i.cloneElement(a,void 0,i.Children.map(P,p))}return a.type===R.Button&&a.props.visualType===void 0?i.cloneElement(a,{visualType:"neutral"}):a},L=d?e.jsx("span",{className:t.default["tedi-attachment__actions"],"data-name":"attachment-actions",children:i.Children.map(d,p)}):null,x=e.jsxs("div",{ref:g,id:h,className:S,"aria-describedby":f,...w,children:[F,L]});return s?e.jsxs("div",{className:t.default["tedi-attachment-wrapper"],children:[x,e.jsx(V.FeedbackText,{...s,id:f,className:_.default(t.default["tedi-attachment__feedback"],s.className)})]}):x});y.displayName="Attachment";exports.Attachment=y;
@@ -0,0 +1,61 @@
1
+ import { default as React } from 'react';
2
+ import { Breakpoint } from '../../../helpers';
3
+ import { FeedbackTextProps } from '../../form/feedback-text/feedback-text';
4
+ export type AttachmentDirection = 'horizontal' | 'vertical';
5
+ export interface AttachmentProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick' | 'color'> {
6
+ /**
7
+ * File name (required).
8
+ */
9
+ name: string;
10
+ /**
11
+ * Hint / error message shown below the card, wired via `aria-describedby`.
12
+ */
13
+ feedback?: FeedbackTextProps;
14
+ /**
15
+ * Pre-formatted file size (e.g. `'1.2 MB'`), shown after the name. Format it yourself.
16
+ */
17
+ fileSize?: string;
18
+ /**
19
+ * Material icon name for a leading file-type glyph.
20
+ */
21
+ icon?: string | null;
22
+ /**
23
+ * Action buttons (download, delete, …) shown on the right. `Button`s default to
24
+ * `visualType="neutral"`.
25
+ */
26
+ actions?: React.ReactNode;
27
+ /**
28
+ * Show an upload progress bar.
29
+ * @default false
30
+ */
31
+ isLoading?: boolean;
32
+ /**
33
+ * Upload progress (0..100); only shown while `isLoading`.
34
+ * @default 0
35
+ */
36
+ progress?: number;
37
+ /**
38
+ * Hint text under the progress bar (e.g. `'Üleslaadimine'`); only shown while `isLoading`.
39
+ */
40
+ progressLabel?: string;
41
+ /**
42
+ * `false` switches the card to the error state (danger surface + warning glyph).
43
+ */
44
+ isValid?: boolean;
45
+ /**
46
+ * Force the layout: `'vertical'` stacks the content, `'horizontal'` keeps one row.
47
+ * When omitted, derived from the viewport via `verticalBelow`.
48
+ */
49
+ direction?: AttachmentDirection;
50
+ /**
51
+ * Breakpoint below which the layout auto-switches to vertical (when `direction` is unset).
52
+ * @default sm
53
+ */
54
+ verticalBelow?: Breakpoint;
55
+ /**
56
+ * Additional class name on the root element.
57
+ */
58
+ className?: string;
59
+ }
60
+ export declare const Attachment: React.ForwardRefExoticComponent<AttachmentProps & React.RefAttributes<HTMLDivElement>>;
61
+ export default Attachment;
@@ -0,0 +1,92 @@
1
+ import { jsx as a, jsxs as r, Fragment as P } from "react/jsx-runtime";
2
+ import N from "../../../../../external/classnames/index.es.js";
3
+ import i, { forwardRef as R } from "react";
4
+ import { Icon as y } from "../../base/icon/icon.es.js";
5
+ import { Text as b } from "../../base/typography/text/text.es.js";
6
+ import { Button as S } from "../../buttons/button/button.es.js";
7
+ import { FeedbackText as $ } from "../../form/feedback-text/feedback-text.es.js";
8
+ import { ProgressBar as M } from "../../loaders/progress-bar/progress-bar.es.js";
9
+ import e from "./attachment.module.scss.es.js";
10
+ import q, { isBreakpointBelow as D } from "../../../helpers/hooks/use-breakpoint.es.js";
11
+ const G = R((g, k) => {
12
+ const {
13
+ name: c,
14
+ feedback: n,
15
+ fileSize: m,
16
+ icon: o,
17
+ actions: l,
18
+ isLoading: d = !1,
19
+ progress: B,
20
+ progressLabel: p,
21
+ isValid: x,
22
+ direction: h,
23
+ verticalBelow: w = "sm",
24
+ className: I,
25
+ id: z,
26
+ ...E
27
+ } = g, T = q(), A = h ? h === "vertical" : D(T, w), F = i.useId(), f = z ?? `tedi-attachment-${F}`, _ = n ? n.id ?? `${f}-feedback` : void 0, s = x === !1, L = N(
28
+ e["tedi-attachment"],
29
+ {
30
+ [e["tedi-attachment--invalid"]]: s,
31
+ [e["tedi-attachment--multi-line"]]: d,
32
+ [e["tedi-attachment--vertical"]]: A
33
+ },
34
+ I
35
+ ), V = /* @__PURE__ */ r(P, { children: [
36
+ o && /* @__PURE__ */ a("span", { className: e["tedi-attachment__icon"], "aria-hidden": "true", children: /* @__PURE__ */ a(y, { name: o, size: 18, color: s ? "danger" : "secondary" }) }),
37
+ /* @__PURE__ */ r("span", { className: e["tedi-attachment__body"], children: [
38
+ /* @__PURE__ */ r("span", { className: e["tedi-attachment__name"], children: [
39
+ /* @__PURE__ */ r(b, { element: "span", className: e["tedi-attachment__name-text"], children: [
40
+ c,
41
+ s && /* @__PURE__ */ a(
42
+ y,
43
+ {
44
+ name: "error",
45
+ color: "inherit",
46
+ display: "inline",
47
+ size: 18,
48
+ className: e["tedi-attachment__invalid-icon"]
49
+ }
50
+ )
51
+ ] }),
52
+ m && /* @__PURE__ */ a(b, { element: "span", modifiers: "small", color: "tertiary", className: e["tedi-attachment__file-size"], children: m })
53
+ ] }),
54
+ d && /* @__PURE__ */ a(
55
+ M,
56
+ {
57
+ value: B,
58
+ ariaLabel: c,
59
+ valuePosition: "bottom",
60
+ helper: p ? { text: p, type: "hint" } : void 0,
61
+ className: e["tedi-attachment__progress"]
62
+ }
63
+ )
64
+ ] })
65
+ ] }), u = (t) => {
66
+ if (!i.isValidElement(t))
67
+ return t;
68
+ if (t.type === i.Fragment) {
69
+ const C = t.props.children;
70
+ return i.cloneElement(t, void 0, i.Children.map(C, u));
71
+ }
72
+ return t.type === S && t.props.visualType === void 0 ? i.cloneElement(t, { visualType: "neutral" }) : t;
73
+ }, j = l ? /* @__PURE__ */ a("span", { className: e["tedi-attachment__actions"], "data-name": "attachment-actions", children: i.Children.map(l, u) }) : null, v = /* @__PURE__ */ r("div", { ref: k, id: f, className: L, "aria-describedby": _, ...E, children: [
74
+ V,
75
+ j
76
+ ] });
77
+ return n ? /* @__PURE__ */ r("div", { className: e["tedi-attachment-wrapper"], children: [
78
+ v,
79
+ /* @__PURE__ */ a(
80
+ $,
81
+ {
82
+ ...n,
83
+ id: _,
84
+ className: N(e["tedi-attachment__feedback"], n.className)
85
+ }
86
+ )
87
+ ] }) : v;
88
+ });
89
+ G.displayName = "Attachment";
90
+ export {
91
+ G as Attachment
92
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={"tedi-attachment-wrapper":"tedi-attachment-wrapper-dcfb5d64","tedi-attachment":"tedi-attachment-02d5f843","tedi-attachment--multi-line":"tedi-attachment--multi-line-6f305917","tedi-attachment--invalid":"tedi-attachment--invalid-e6248abb","tedi-attachment__feedback":"tedi-attachment__feedback-bc74bea5","tedi-attachment__icon":"tedi-attachment__icon-0eb17a7c","tedi-attachment__body":"tedi-attachment__body-3a026aed","tedi-attachment__name":"tedi-attachment__name-ab40704e","tedi-attachment__name-text":"tedi-attachment__name-text-a17b7fb9","tedi-attachment__invalid-icon":"tedi-attachment__invalid-icon-0d13ecad","tedi-attachment__progress":"tedi-attachment__progress-e454173e","tedi-attachment--vertical":"tedi-attachment--vertical-4a691e7c","tedi-attachment__file-size":"tedi-attachment__file-size-1728ef22","tedi-attachment__actions":"tedi-attachment__actions-225799e0"};exports.default=t;
@@ -0,0 +1,19 @@
1
+ const t = {
2
+ "tedi-attachment-wrapper": "tedi-attachment-wrapper-dcfb5d64",
3
+ "tedi-attachment": "tedi-attachment-02d5f843",
4
+ "tedi-attachment--multi-line": "tedi-attachment--multi-line-6f305917",
5
+ "tedi-attachment--invalid": "tedi-attachment--invalid-e6248abb",
6
+ "tedi-attachment__feedback": "tedi-attachment__feedback-bc74bea5",
7
+ "tedi-attachment__icon": "tedi-attachment__icon-0eb17a7c",
8
+ "tedi-attachment__body": "tedi-attachment__body-3a026aed",
9
+ "tedi-attachment__name": "tedi-attachment__name-ab40704e",
10
+ "tedi-attachment__name-text": "tedi-attachment__name-text-a17b7fb9",
11
+ "tedi-attachment__invalid-icon": "tedi-attachment__invalid-icon-0d13ecad",
12
+ "tedi-attachment__progress": "tedi-attachment__progress-e454173e",
13
+ "tedi-attachment--vertical": "tedi-attachment--vertical-4a691e7c",
14
+ "tedi-attachment__file-size": "tedi-attachment__file-size-1728ef22",
15
+ "tedi-attachment__actions": "tedi-attachment__actions-225799e0"
16
+ };
17
+ export {
18
+ t as default
19
+ };
@@ -0,0 +1 @@
1
+ export * from './attachment';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),f=require("../../../../../external/classnames/index.cjs.js"),t=require("react"),i=require("../../overlays/popover/popover.cjs.js"),v=require("./ellipsis.module.scss.cjs.js"),g=require("../../../helpers/hooks/use-element-size.cjs.js"),h=o=>{const{children:l,lineClamp:r=2,popover:c=!0,className:u,...p}=o,e=t.useRef(null),[a,d]=t.useState(!1),m=g.useElementSize(e);t.useEffect(()=>{e.current&&d(e.current.scrollHeight>e.current.clientHeight)},[e,m]);const n=s.jsx("div",{"data-name":"ellipsis",...p,ref:e,className:f.default(v.default["tedi-ellipsis"],u),style:{lineClamp:r,WebkitLineClamp:r},children:l});return a&&c?s.jsxs(i.Popover,{openWith:"hover",focusManager:{modal:!1},children:[s.jsx(i.Popover.Trigger,{children:n}),s.jsx(i.Popover.Content,{children:l})]}):n};exports.Ellipsis=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("../../../../../external/classnames/index.cjs.js"),o=require("react"),a=require("../../overlays/popover/popover.cjs.js"),i=require("./ellipsis.module.scss.cjs.js"),x=require("../../../helpers/hooks/use-element-size.cjs.js"),g=d=>{const{children:l,lineClamp:r=2,position:s="end",popover:p=!0,className:u,...m}=d,n=o.useRef(null),[f,h]=o.useState(!1),v=x.useElementSize(n);o.useEffect(()=>{const t=n.current;t&&h(s==="start"?t.scrollWidth>t.clientWidth:t.scrollHeight>t.clientHeight)},[v,s,r]);const c=e.jsx("div",{"data-name":"ellipsis",...m,ref:n,className:j.default(i.default["tedi-ellipsis"],{[i.default["tedi-ellipsis--start"]]:s==="start"},u),style:s==="end"?{lineClamp:r,WebkitLineClamp:r}:void 0,children:s==="start"?e.jsx("span",{className:i.default["tedi-ellipsis__inner"],children:l}):l});return f&&p?e.jsxs(a.Popover,{openWith:"hover",focusManager:{modal:!1},children:[e.jsx(a.Popover.Trigger,{children:c}),e.jsx(a.Popover.Content,{children:e.jsx("span",{className:i.default["tedi-ellipsis__overlay"],children:l})})]}):c};exports.Ellipsis=g;
@@ -1,4 +1,5 @@
1
1
  import { default as React } from 'react';
2
+ export type EllipsisPosition = 'start' | 'end';
2
3
  export interface EllipsisProps {
3
4
  /**
4
5
  * The content to be displayed inside the ellipsis container.
@@ -6,10 +7,19 @@ export interface EllipsisProps {
6
7
  children: React.ReactNode;
7
8
  /**
8
9
  * The maximum number of lines before truncating the text with an ellipsis.
9
- * If the content exceeds this limit, it will be truncated.
10
+ * If the content exceeds this limit, it will be truncated. Applies to the
11
+ * `end` (multi-line) position only.
10
12
  * @default 2
11
13
  */
12
14
  lineClamp?: number;
15
+ /**
16
+ * Where the ellipsis is placed.
17
+ * - `end` — trailing ellipsis, multi-line (clamped by `lineClamp`).
18
+ * - `start` — leading ellipsis, single-line (keeps the end of the text visible,
19
+ * e.g. for file paths or IDs).
20
+ * @default end
21
+ */
22
+ position?: EllipsisPosition;
13
23
  /**
14
24
  * Determines whether a popover should be displayed when the text is truncated.
15
25
  * If `true`, hovering over the truncated text will show the full content in a popover.