@tedi-design-system/react 14.4.0-rc.3 → 14.4.0-rc.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tedi-design-system/react",
3
- "version": "14.4.0-rc.3",
3
+ "version": "14.4.0-rc.5",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),h=require("../../../../../external/classnames/index.cjs.js"),F=require("../../../../../external/react-dropzone/dist/es/index.cjs.js"),y=require("../../../helpers/hooks/use-file-upload.cjs.js"),u=require("../../base/icon/icon.cjs.js"),C=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"),N=require("../../cards/card/card.cjs.js"),S=require("../../cards/card/card-content/card-content.cjs.js"),k=require("../../../providers/label-provider/use-labels.cjs.js"),I=require("../../layout/vertical-spacing/vertical-spacing.cjs.js"),L=require("../../layout/grid/row.cjs.js"),m=require("../../layout/grid/col.cjs.js"),x=o=>{const{getLabel:a}=k.useLabels(),{label:p=a("file-dropzone.label"),className:z,disabled:s=!1,helper:i,id:d}=o,{innerFiles:r,uploadErrorHelper:n,onFileChange:g,onFileRemove:b}=y.useFileUpload(o),{getRootProps:j,getInputProps:v,isDragActive:q}=F.useDropzone({accept:o.accept?{"application/*":[o.accept]}:void 0,multiple:o.multiple,maxSize:o.maxSize?o.maxSize*1024**2:void 0,onDrop:l=>{g({target:{files:l}})}}),_=h.default(t.default["tedi-file-dropzone"],{[t.default["tedi-file-dropzone--disabled"]]:s},{[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"]]:q},z),c=i?(i==null?void 0:i.id)??`${d}-helper`:void 0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{...j(),className:_,children:[e.jsx("input",{...v()}),e.jsxs("div",{className:t.default["tedi-file-dropzone__label-wrapper"],children:[e.jsx(u.Icon,{color:s?"tertiary":"secondary",size:24,name:"attach_file"}),e.jsx(D.FormLabel,{id:d,label:p,className:t.default["tedi-file-dropzone__label"]})]})]}),i?e.jsx(f.FeedbackText,{...i,id:c}):n?e.jsx(f.FeedbackText,{...n,id:c}):null,!!r.length&&e.jsx(I.VerticalSpacing,{size:.5,className:t.default["tedi-file-dropzone__file-list"],children:r.map(l=>e.jsx(N.Card,{background:l.isValid===!1?"danger-primary":"tertiary",borderless:!0,className:t.default["tedi-file-dropzone__file-item"],children:e.jsx(S.CardContent,{padding:{bottom:.5,left:.5,right:.5,top:.5},children:e.jsxs(L.Row,{alignItems:"center",children:[e.jsxs(m.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(m.Col,{width:"auto",children:e.jsx(C.ClosingButton,{title:a("clear"),onClick:()=>b(l)})})]})})},l.id||l.name))})]})};exports.FileDropzone=x;exports.default=x;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),y=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("../../cards/card/card.cjs.js"),L=require("../../cards/card/card-content/card-content.cjs.js"),k=require("../../../providers/label-provider/use-labels.cjs.js"),m=require("../../content/list/list.cjs.js"),S=require("../../layout/grid/row.cjs.js"),x=require("../../layout/grid/col.cjs.js"),p=o=>{const{getLabel:s}=k.useLabels(),{label:z=s("file-dropzone.label"),className:b,disabled:a=!1,helper:i,id:c}=o,{innerFiles:d,uploadErrorHelper:n,onFileChange:j,onFileRemove:g}=C.useFileUpload(o),{getRootProps:v,getInputProps:_,isDragActive:q}=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}})}}),h=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"]]:q},b),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:h,children:[e.jsx("input",{..._(),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,{id:c,label:z,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(I.Card,{background:l.isValid===!1?"danger-primary":"tertiary",borderless:!0,className:t.default["tedi-file-dropzone__file-item"],children:e.jsx(L.CardContent,{padding:.5,children:e.jsxs(S.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,{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=p;exports.default=p;
@@ -1,73 +1,83 @@
1
- import { jsxs as r, Fragment as N, jsx as i } from "react/jsx-runtime";
2
- import x from "../../../../../external/classnames/index.es.js";
3
- import { useDropzone as C } from "../../../../../external/react-dropzone/dist/es/index.es.js";
1
+ import { jsxs as d, Fragment as F, jsx as e } from "react/jsx-runtime";
2
+ import C from "../../../../../external/classnames/index.es.js";
3
+ import { useDropzone as I } from "../../../../../external/react-dropzone/dist/es/index.es.js";
4
4
  import { useFileUpload as D } from "../../../helpers/hooks/use-file-upload.es.js";
5
- import { Icon as p } from "../../base/icon/icon.es.js";
6
- import { ClosingButton as I } from "../../buttons/closing-button/closing-button.es.js";
7
- import { FeedbackText as f } from "../feedback-text/feedback-text.es.js";
8
- import { FormLabel as S } from "../form-label/form-label.es.js";
5
+ import { Icon as f } from "../../base/icon/icon.es.js";
6
+ import { ClosingButton as L } from "../../buttons/closing-button/closing-button.es.js";
7
+ import { FeedbackText as p } from "../feedback-text/feedback-text.es.js";
8
+ import { FormLabel as k } from "../form-label/form-label.es.js";
9
9
  import o from "./file-dropzone.module.scss.es.js";
10
- import { Card as k } from "../../cards/card/card.es.js";
11
- import { CardContent as w } from "../../cards/card/card-content/card-content.es.js";
12
- import { useLabels as L } from "../../../providers/label-provider/use-labels.es.js";
13
- import { VerticalSpacing as R } from "../../layout/vertical-spacing/vertical-spacing.es.js";
14
- import { Row as V } from "../../layout/grid/row.es.js";
15
- import { Col as z } from "../../layout/grid/col.es.js";
16
- const Y = (l) => {
17
- const { getLabel: n } = L(), { label: g = n("file-dropzone.label"), className: b, disabled: d = !1, helper: e, id: m } = l, { innerFiles: s, uploadErrorHelper: t, onFileChange: v, onFileRemove: h } = D(l), { getRootProps: u, getInputProps: _, isDragActive: y } = C({
18
- accept: l.accept ? { "application/*": [l.accept] } : void 0,
19
- multiple: l.multiple,
20
- maxSize: l.maxSize ? l.maxSize * 1024 ** 2 : void 0,
21
- onDrop: (a) => {
22
- v({
23
- target: { files: a }
10
+ import { Card as w } from "../../cards/card/card.es.js";
11
+ import { CardContent as R } from "../../cards/card/card-content/card-content.es.js";
12
+ import { useLabels as S } from "../../../providers/label-provider/use-labels.es.js";
13
+ import { List as z } from "../../content/list/list.es.js";
14
+ import { Row as j } from "../../layout/grid/row.es.js";
15
+ import { Col as b } from "../../layout/grid/col.es.js";
16
+ const Y = (a) => {
17
+ const { getLabel: n } = S(), { label: g = n("file-dropzone.label"), className: v, disabled: r = !1, helper: i, id: c } = a, { innerFiles: s, uploadErrorHelper: l, onFileChange: h, onFileRemove: u } = D(a), { getRootProps: y, getInputProps: _, isDragActive: N } = I({
18
+ disabled: r,
19
+ accept: a.accept ? { "application/*": [a.accept] } : void 0,
20
+ multiple: a.multiple,
21
+ maxSize: a.maxSize ? a.maxSize * 1024 ** 2 : void 0,
22
+ onDrop: (t) => {
23
+ if (r) return;
24
+ h({
25
+ target: { files: t }
24
26
  });
25
27
  }
26
- }), F = x(
28
+ }), x = C(
27
29
  o["tedi-file-dropzone"],
28
- { [o["tedi-file-dropzone--disabled"]]: d },
29
- { [o["tedi-file-dropzone--invalid"]]: ((t == null ? void 0 : t.type) || (e == null ? void 0 : e.type)) === "error" },
30
- { [o["tedi-file-dropzone--valid"]]: ((t == null ? void 0 : t.type) || (e == null ? void 0 : e.type)) === "valid" },
31
- { [o["tedi-file-dropzone--drop-over"]]: y },
32
- b
33
- ), c = e ? (e == null ? void 0 : e.id) ?? `${m}-helper` : void 0;
34
- return /* @__PURE__ */ r(N, { children: [
35
- /* @__PURE__ */ r("div", { ...u(), className: F, children: [
36
- /* @__PURE__ */ i("input", { ..._() }),
37
- /* @__PURE__ */ r("div", { className: o["tedi-file-dropzone__label-wrapper"], children: [
38
- /* @__PURE__ */ i(p, { color: d ? "tertiary" : "secondary", size: 24, name: "attach_file" }),
39
- /* @__PURE__ */ i(S, { id: m, label: g, className: o["tedi-file-dropzone__label"] })
40
- ] })
41
- ] }),
42
- e ? /* @__PURE__ */ i(f, { ...e, id: c }) : t ? /* @__PURE__ */ i(f, { ...t, id: c }) : null,
43
- !!s.length && /* @__PURE__ */ i(R, { size: 0.5, className: o["tedi-file-dropzone__file-list"], children: s.map((a) => /* @__PURE__ */ i(
44
- k,
30
+ { [o["tedi-file-dropzone--disabled"]]: r },
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"]]: N },
34
+ v
35
+ ), m = i ? (i == null ? void 0 : i.id) ?? `${c}-helper` : void 0;
36
+ return /* @__PURE__ */ d(F, { children: [
37
+ /* @__PURE__ */ d(
38
+ "div",
45
39
  {
46
- background: a.isValid === !1 ? "danger-primary" : "tertiary",
47
- borderless: !0,
48
- className: o["tedi-file-dropzone__file-item"],
49
- children: /* @__PURE__ */ i(
40
+ ...y({
41
+ tabIndex: r ? -1 : 0,
42
+ "aria-disabled": r,
43
+ "aria-describedby": m
44
+ }),
45
+ className: x,
46
+ children: [
47
+ /* @__PURE__ */ e("input", { ..._(), disabled: r }),
48
+ /* @__PURE__ */ d("div", { className: o["tedi-file-dropzone__label-wrapper"], children: [
49
+ /* @__PURE__ */ e(f, { color: r ? "tertiary" : "secondary", size: 24, name: "attach_file" }),
50
+ /* @__PURE__ */ e(k, { id: c, label: g, className: o["tedi-file-dropzone__label"] })
51
+ ] })
52
+ ]
53
+ }
54
+ ),
55
+ i ? /* @__PURE__ */ e(p, { ...i, id: m }) : l ? /* @__PURE__ */ e(p, { ...l, id: m }) : null,
56
+ !!s.length && /* @__PURE__ */ e(
57
+ z,
58
+ {
59
+ className: o["tedi-file-dropzone__file-list"],
60
+ 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(
50
63
  w,
51
64
  {
52
- padding: {
53
- bottom: 0.5,
54
- left: 0.5,
55
- right: 0.5,
56
- top: 0.5
57
- },
58
- children: /* @__PURE__ */ r(V, { alignItems: "center", children: [
59
- /* @__PURE__ */ r(z, { className: o["tedi-file-dropzone__file-name"], children: [
60
- a.name,
65
+ background: t.isValid === !1 ? "danger-primary" : "tertiary",
66
+ borderless: !0,
67
+ className: o["tedi-file-dropzone__file-item"],
68
+ children: /* @__PURE__ */ e(R, { padding: 0.5, children: /* @__PURE__ */ d(j, { alignItems: "center", children: [
69
+ /* @__PURE__ */ d(b, { className: o["tedi-file-dropzone__file-name"], children: [
70
+ t.name,
61
71
  " ",
62
- a.isValid === !1 && /* @__PURE__ */ i(p, { name: "info", color: "danger", display: "inline", size: 18 })
72
+ t.isValid === !1 && /* @__PURE__ */ e(f, { name: "info", color: "danger", display: "inline", size: 18 })
63
73
  ] }),
64
- /* @__PURE__ */ i(z, { width: "auto", children: /* @__PURE__ */ i(I, { title: n("clear"), onClick: () => h(a) }) })
65
- ] })
74
+ /* @__PURE__ */ e(b, { width: "auto", children: /* @__PURE__ */ e(L, { title: n("remove") + " " + t.name, onClick: () => u(t) }) })
75
+ ] }) })
66
76
  }
67
- )
68
- },
69
- a.id || a.name
70
- )) })
77
+ ) }, t.id || t.name))
78
+ }
79
+ ),
80
+ /* @__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) })
71
81
  ] });
72
82
  };
73
83
  export {
@@ -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-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--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;
@@ -7,6 +7,7 @@ const e = {
7
7
  "tedi-file-dropzone--valid": "tedi-file-dropzone--valid-d2d3ef3d",
8
8
  "tedi-file-dropzone--drop-over": "tedi-file-dropzone--drop-over-3e31af77",
9
9
  "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",
10
11
  "tedi-file-dropzone__file-name": "tedi-file-dropzone__file-name-f9bf2a63"
11
12
  };
12
13
  export {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),r=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),s=require("react"),x=require("./overlay.cjs.js"),p=d=>{const{children:u,classNames:e}=d,{open:l,x:f,y,strategy:m,focusManager:o,floating:h,arrowRef:g,getFloatingProps:v,placement:w,context:i,arrow:t,scrollLock:c}=s.useContext(x.OverlayContext);return s.useEffect(()=>{c&&(l?(document.documentElement.style.overflow="hidden",document.documentElement.scrollHeight>window.innerHeight&&(document.body.style.overflow="scroll")):(document.documentElement.style.overflow="",document.body.style.overflow=""))},[l,c]),l?n.jsx(r.FloatingPortal,{children:n.jsx(r.FloatingFocusManager,{modal:(o==null?void 0:o.modal)||!1,...o,context:i,children:n.jsxs("div",{...v({ref:h,style:{position:m,left:f,top:y},className:e==null?void 0:e.content}),"data-placement":w,"data-testid":"overlay-content",children:[n.jsx(r.FloatingArrow,{ref:a=>g.current=a,context:i,className:e==null?void 0:e.arrow,height:t==null?void 0:t.height,width:t==null?void 0:t.width,"data-testid":"overlay-arrow"}),u]})})}):null};exports.OverlayContent=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),r=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),d=require("react"),p=require("./overlay.cjs.js"),j=s=>{const{children:u,classNames:e,labelledBy:y,describedBy:f}=s,{open:n,x:m,y:h,strategy:g,focusManager:o,floating:b,arrowRef:v,getFloatingProps:x,placement:w,context:i,arrow:t,scrollLock:a}=d.useContext(p.OverlayContext);return d.useEffect(()=>{a&&(n?(document.documentElement.style.overflow="hidden",document.documentElement.scrollHeight>window.innerHeight&&(document.body.style.overflow="scroll")):(document.documentElement.style.overflow="",document.body.style.overflow=""))},[n,a]),n?l.jsx(r.FloatingPortal,{children:l.jsx(r.FloatingFocusManager,{modal:(o==null?void 0:o.modal)||!1,...o,context:i,children:l.jsxs("div",{...x({ref:b,tabIndex:-1,"aria-labelledby":y,"aria-describedby":f,style:{position:g,left:m,top:h},className:e==null?void 0:e.content}),"data-placement":w,"data-testid":"overlay-content",children:[l.jsx(r.FloatingArrow,{ref:c=>v.current=c,context:i,className:e==null?void 0:e.arrow,height:t==null?void 0:t.height,width:t==null?void 0:t.width,"data-testid":"overlay-arrow"}),u]})})}):null};exports.OverlayContent=j;
@@ -1,15 +1,40 @@
1
1
  import { ReactNode } from 'react';
2
2
  export interface OverlayContentProps {
3
3
  /**
4
- * Content.
4
+ * Overlay content.
5
+ * Can contain any valid React nodes (text, elements, components).
5
6
  */
6
7
  children: ReactNode | ReactNode[];
7
8
  /**
8
- * Additional class names.
9
+ * Additional class names for styling overlay elements.
9
10
  */
10
11
  classNames?: {
12
+ /**
13
+ * Class name applied to the floating content container.
14
+ */
11
15
  content: string;
16
+ /**
17
+ * Class name applied to the overlay arrow element.
18
+ */
12
19
  arrow: string;
13
20
  };
21
+ /**
22
+ * ID of the element that labels the overlay content.
23
+ *
24
+ * This is used to set the `aria-labelledby` attribute on the overlay container,
25
+ * providing an accessible name for screen readers.
26
+ *
27
+ * Typically points to a heading element inside the overlay (e.g. a title).
28
+ */
29
+ labelledBy?: string;
30
+ /**
31
+ * ID of the element that describes the overlay content.
32
+ *
33
+ * This is used to set the `aria-describedby` attribute on the overlay container,
34
+ * allowing screen readers to announce additional descriptive text.
35
+ *
36
+ * Useful for longer explanations or supporting content that complements the title.
37
+ */
38
+ describedBy?: string;
14
39
  }
15
40
  export declare const OverlayContent: (props: OverlayContentProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,55 +1,58 @@
1
- import { jsx as l, jsxs as p } from "react/jsx-runtime";
2
- import { FloatingPortal as v, FloatingFocusManager as w, FloatingArrow as x } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
3
- import { useContext as F, useEffect as b } from "react";
4
- import { OverlayContext as E } from "./overlay.es.js";
5
- const P = (d) => {
6
- const { children: a, classNames: t } = d, {
7
- open: n,
8
- x: m,
9
- y: s,
10
- strategy: f,
1
+ import { jsx as n, jsxs as v } from "react/jsx-runtime";
2
+ import { FloatingPortal as w, FloatingFocusManager as x, FloatingArrow as F } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
3
+ import { useContext as E, useEffect as C } from "react";
4
+ import { OverlayContext as j } from "./overlay.es.js";
5
+ const S = (a) => {
6
+ const { children: c, classNames: e, labelledBy: s, describedBy: m } = a, {
7
+ open: l,
8
+ x: f,
9
+ y,
10
+ strategy: h,
11
11
  focusManager: o,
12
- floating: h,
13
- arrowRef: u,
14
- getFloatingProps: y,
15
- placement: g,
12
+ floating: u,
13
+ arrowRef: b,
14
+ getFloatingProps: g,
15
+ placement: p,
16
16
  context: r,
17
- arrow: e,
17
+ arrow: t,
18
18
  scrollLock: i
19
- } = F(E);
20
- return b(() => {
21
- i && (n ? (document.documentElement.style.overflow = "hidden", document.documentElement.scrollHeight > window.innerHeight && (document.body.style.overflow = "scroll")) : (document.documentElement.style.overflow = "", document.body.style.overflow = ""));
22
- }, [n, i]), n ? /* @__PURE__ */ l(v, { children: /* @__PURE__ */ l(w, { modal: (o == null ? void 0 : o.modal) || !1, ...o, context: r, children: /* @__PURE__ */ p(
19
+ } = E(j);
20
+ return C(() => {
21
+ i && (l ? (document.documentElement.style.overflow = "hidden", document.documentElement.scrollHeight > window.innerHeight && (document.body.style.overflow = "scroll")) : (document.documentElement.style.overflow = "", document.body.style.overflow = ""));
22
+ }, [l, i]), l ? /* @__PURE__ */ n(w, { children: /* @__PURE__ */ n(x, { modal: (o == null ? void 0 : o.modal) || !1, ...o, context: r, children: /* @__PURE__ */ v(
23
23
  "div",
24
24
  {
25
- ...y({
26
- ref: h,
25
+ ...g({
26
+ ref: u,
27
+ tabIndex: -1,
28
+ "aria-labelledby": s,
29
+ "aria-describedby": m,
27
30
  style: {
28
- position: f,
29
- left: m,
30
- top: s
31
+ position: h,
32
+ left: f,
33
+ top: y
31
34
  },
32
- className: t == null ? void 0 : t.content
35
+ className: e == null ? void 0 : e.content
33
36
  }),
34
- "data-placement": g,
37
+ "data-placement": p,
35
38
  "data-testid": "overlay-content",
36
39
  children: [
37
- /* @__PURE__ */ l(
38
- x,
40
+ /* @__PURE__ */ n(
41
+ F,
39
42
  {
40
- ref: (c) => u.current = c,
43
+ ref: (d) => b.current = d,
41
44
  context: r,
42
- className: t == null ? void 0 : t.arrow,
43
- height: e == null ? void 0 : e.height,
44
- width: e == null ? void 0 : e.width,
45
+ className: e == null ? void 0 : e.arrow,
46
+ height: t == null ? void 0 : t.height,
47
+ width: t == null ? void 0 : t.width,
45
48
  "data-testid": "overlay-arrow"
46
49
  }
47
50
  ),
48
- a
51
+ c
49
52
  ]
50
53
  }
51
54
  ) }) }) : null;
52
55
  };
53
56
  export {
54
- P as OverlayContent
57
+ S as OverlayContent
55
58
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=require("react/jsx-runtime"),t=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),s=require("react"),W=require("./overlay-content.cjs.js"),A=require("./overlay-trigger.cjs.js"),G=require("../../../../../external/@floating-ui/dom/dist/floating-ui.dom.cjs.js"),c=require("../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js"),H=require("../../../helpers/hooks/use-is-touch-device.cjs.js"),z=require("../../../helpers/hooks/use-is-mounted.cjs.js"),B=3,y=s.createContext({open:!1,onOpenChange:()=>{},isMounted:!1,openWith:"hover",reference:()=>{},floating:()=>{},focusManager:{},arrowRef:{current:null},x:0,y:0,strategy:"absolute",getReferenceProps:()=>({}),getFloatingProps:()=>({}),arrow:{width:0,height:0,x:0,y:0,centerOffset:0},placement:"top",context:{},scrollLock:void 0}),l=O=>{const m=H.useIsTouchDevice(),{children:M,placement:x="top",openWith:a=m?"click":"hover",defaultOpen:C=!1,open:r,onToggle:o,role:q="tooltip",arrowDimensions:e,offset:w=B+((e==null?void 0:e.height)??0),focusManager:P,dismissible:i,scrollLock:R}=O,{order:b=["reference","content"],initialFocus:F=-1,...k}=P??{},[u,f]=s.useState(C),d=s.useRef(null),T=z.useIsMounted(),g=s.useMemo(()=>o&&typeof r<"u"?r:u,[o,r,u]),p=s.useCallback(v=>{typeof r>"u"&&f(v),o==null||o(v)},[r,f,o]),{x:I,y:_,refs:h,strategy:U,context:n,middlewareData:j,placement:S}=t.useFloating({placement:x,open:g,onOpenChange:p,middleware:[c.offset(w),c.flip(),c.shift({padding:8}),c.arrow({element:d,padding:4})],whileElementsMounted:G.autoUpdate}),{getReferenceProps:D,getFloatingProps:E}=t.useInteractions([t.useHover(n,{enabled:a==="hover",handleClose:t.safePolygon()}),t.useClick(n,{toggle:i}),t.useFocus(n,{enabled:a==="hover"}),t.useRole(n,{role:q}),t.useDismiss(n,{enabled:i,outsidePressEvent:a==="click"?"mousedown":"pointerdown"})]);return L.jsx(y.Provider,{value:{open:g,onOpenChange:p,isMounted:T,openWith:a,reference:h.setReference,floating:h.setFloating,arrowRef:d,focusManager:{order:b,initialFocus:F,...k},x:I,y:_,strategy:U,getReferenceProps:D,getFloatingProps:E,arrow:{width:e==null?void 0:e.width,height:e==null?void 0:e.height,...j.arrow},context:n,placement:S,scrollLock:R},children:M})};l.Trigger=A.OverlayTrigger;l.Content=W.OverlayContent;exports.Overlay=l;exports.OverlayContext=y;exports.default=l;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const A=require("react/jsx-runtime"),t=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),s=require("react"),G=require("./overlay-content.cjs.js"),H=require("./overlay-trigger.cjs.js"),z=require("../../../../../external/@floating-ui/dom/dist/floating-ui.dom.cjs.js"),a=require("../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js"),B=require("../../../helpers/hooks/use-is-touch-device.cjs.js"),J=require("../../../helpers/hooks/use-is-mounted.cjs.js"),K=3,M=s.createContext({open:!1,onOpenChange:()=>{},isMounted:!1,openWith:"hover",reference:()=>{},floating:()=>{},focusManager:{},arrowRef:{current:null},x:0,y:0,strategy:"absolute",getReferenceProps:()=>({}),getFloatingProps:()=>({}),arrow:{width:0,height:0,x:0,y:0,centerOffset:0},placement:"top",context:{},scrollLock:void 0}),c=x=>{const C=B.useIsTouchDevice(),{children:q,placement:w="top",openWith:i=C?"click":"hover",defaultOpen:F=!1,open:r,onToggle:o,role:P="tooltip",arrowDimensions:e,offset:R=K+((e==null?void 0:e.height)??0),focusManager:l,dismissible:u,scrollLock:b}=x,{order:k=["reference","content"],initialFocus:d,modal:f,...I}=l??{},T=d!==void 0?d:f?0:void 0,[g,p]=s.useState(F),h=s.useRef(null),_=J.useIsMounted(),v=s.useMemo(()=>o&&typeof r<"u"?r:g,[o,r,g]),y=s.useCallback(m=>{typeof r>"u"&&p(m),o==null||o(m)},[r,p,o]),{x:U,y:j,refs:O,strategy:S,context:n,middlewareData:D,placement:E}=t.useFloating({placement:w,open:v,onOpenChange:y,middleware:[a.offset(R),a.flip(),a.shift({padding:8}),a.arrow({element:h,padding:4})],whileElementsMounted:z.autoUpdate}),{getReferenceProps:L,getFloatingProps:W}=t.useInteractions([t.useHover(n,{enabled:i==="hover",handleClose:t.safePolygon()}),t.useClick(n,{toggle:u}),t.useFocus(n,{enabled:i==="hover"}),t.useRole(n,{role:P}),t.useDismiss(n,{enabled:u,outsidePressEvent:i==="click"?"mousedown":"pointerdown"})]);return A.jsx(M.Provider,{value:{open:v,onOpenChange:y,isMounted:_,openWith:i,reference:O.setReference,floating:O.setFloating,arrowRef:h,focusManager:l?{order:k,modal:f,initialFocus:T,...I}:void 0,x:U,y:j,strategy:S,getReferenceProps:L,getFloatingProps:W,arrow:{width:e==null?void 0:e.width,height:e==null?void 0:e.height,...D.arrow},context:n,placement:E,scrollLock:b},children:q})};c.Trigger=H.OverlayTrigger;c.Content=G.OverlayContent;exports.Overlay=c;exports.OverlayContext=M;exports.default=c;
@@ -1,13 +1,13 @@
1
- import { jsx as j } from "react/jsx-runtime";
2
- import { useFloating as A, useInteractions as G, useHover as H, useClick as S, useFocus as U, useRole as q, useDismiss as z, safePolygon as B } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
3
- import { createContext as D, useState as J, useRef as K, useMemo as N, useCallback as Q } from "react";
4
- import { OverlayContent as V } from "./overlay-content.es.js";
5
- import { OverlayTrigger as X } from "./overlay-trigger.es.js";
6
- import { autoUpdate as Y } from "../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
7
- import { offset as Z, flip as _, shift as $, arrow as ee } from "../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
8
- import { useIsTouchDevice as te } from "../../../helpers/hooks/use-is-touch-device.es.js";
9
- import { useIsMounted as oe } from "../../../helpers/hooks/use-is-mounted.es.js";
10
- const ne = 3, re = D({
1
+ import { jsx as G } from "react/jsx-runtime";
2
+ import { useFloating as H, useInteractions as S, useHover as U, useClick as q, useFocus as z, useRole as B, useDismiss as D, safePolygon as J } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
3
+ import { createContext as K, useState as N, useRef as Q, useMemo as V, useCallback as X } from "react";
4
+ import { OverlayContent as Y } from "./overlay-content.es.js";
5
+ import { OverlayTrigger as Z } from "./overlay-trigger.es.js";
6
+ import { autoUpdate as _ } from "../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
7
+ import { offset as $, flip as ee, shift as te, arrow as oe } from "../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
8
+ import { useIsTouchDevice as ne } from "../../../helpers/hooks/use-is-touch-device.es.js";
9
+ import { useIsMounted as re } from "../../../helpers/hooks/use-is-mounted.es.js";
10
+ const se = 3, ae = K({
11
11
  open: !1,
12
12
  onOpenChange: () => {
13
13
  },
@@ -34,94 +34,95 @@ const ne = 3, re = D({
34
34
  placement: "top",
35
35
  context: {},
36
36
  scrollLock: void 0
37
- }), d = (g) => {
38
- const m = te(), {
39
- children: h,
40
- placement: v = "top",
41
- openWith: r = m ? "click" : "hover",
42
- defaultOpen: y = !1,
37
+ }), h = (v) => {
38
+ const y = ne(), {
39
+ children: O,
40
+ placement: x = "top",
41
+ openWith: r = y ? "click" : "hover",
42
+ defaultOpen: w = !1,
43
43
  open: n,
44
44
  onToggle: t,
45
- role: O = "tooltip",
45
+ role: C = "tooltip",
46
46
  arrowDimensions: e,
47
- offset: x = ne + ((e == null ? void 0 : e.height) ?? 0),
48
- focusManager: w,
49
- dismissible: s,
50
- scrollLock: C
51
- } = g, { order: M = ["reference", "content"], initialFocus: P = -1, ...F } = w ?? {}, [a, l] = J(y), c = K(null), R = oe(), i = N(() => t && typeof n < "u" ? n : a, [t, n, a]), f = Q(
52
- (u) => {
53
- typeof n > "u" && l(u), t == null || t(u);
47
+ offset: F = se + ((e == null ? void 0 : e.height) ?? 0),
48
+ focusManager: s,
49
+ dismissible: a,
50
+ scrollLock: M
51
+ } = v, { order: P = ["reference", "content"], initialFocus: i, modal: l, ...R } = s ?? {}, b = i !== void 0 ? i : l ? 0 : void 0, [c, f] = N(w), u = Q(null), k = re(), p = V(() => t && typeof n < "u" ? n : c, [t, n, c]), d = X(
52
+ (m) => {
53
+ typeof n > "u" && f(m), t == null || t(m);
54
54
  },
55
- [n, l, t]
56
- ), { x: b, y: k, refs: p, strategy: I, context: o, middlewareData: T, placement: E } = A({
57
- placement: v,
58
- open: i,
59
- onOpenChange: f,
55
+ [n, f, t]
56
+ ), { x: I, y: T, refs: g, strategy: E, context: o, middlewareData: L, placement: W } = H({
57
+ placement: x,
58
+ open: p,
59
+ onOpenChange: d,
60
60
  middleware: [
61
- Z(x),
62
- _(),
63
- $({ padding: 8 }),
64
- ee({
65
- element: c,
61
+ $(F),
62
+ ee(),
63
+ te({ padding: 8 }),
64
+ oe({
65
+ element: u,
66
66
  padding: 4
67
67
  })
68
68
  ],
69
- whileElementsMounted: Y
70
- }), { getReferenceProps: L, getFloatingProps: W } = G([
71
- H(o, {
69
+ whileElementsMounted: _
70
+ }), { getReferenceProps: j, getFloatingProps: A } = S([
71
+ U(o, {
72
72
  enabled: r === "hover",
73
- handleClose: B()
73
+ handleClose: J()
74
74
  }),
75
- S(o, {
76
- toggle: s
75
+ q(o, {
76
+ toggle: a
77
77
  }),
78
- U(o, {
78
+ z(o, {
79
79
  enabled: r === "hover"
80
80
  }),
81
- q(o, { role: O }),
82
- z(o, {
83
- enabled: s,
81
+ B(o, { role: C }),
82
+ D(o, {
83
+ enabled: a,
84
84
  outsidePressEvent: r === "click" ? "mousedown" : "pointerdown"
85
85
  })
86
86
  ]);
87
- return /* @__PURE__ */ j(
88
- re.Provider,
87
+ return /* @__PURE__ */ G(
88
+ ae.Provider,
89
89
  {
90
90
  value: {
91
- open: i,
92
- onOpenChange: f,
93
- isMounted: R,
91
+ open: p,
92
+ onOpenChange: d,
93
+ isMounted: k,
94
94
  openWith: r,
95
- reference: p.setReference,
96
- floating: p.setFloating,
97
- arrowRef: c,
98
- focusManager: {
99
- order: M,
100
- initialFocus: P,
101
- ...F
102
- },
103
- x: b,
104
- y: k,
105
- strategy: I,
106
- getReferenceProps: L,
107
- getFloatingProps: W,
95
+ reference: g.setReference,
96
+ floating: g.setFloating,
97
+ arrowRef: u,
98
+ focusManager: s ? {
99
+ order: P,
100
+ modal: l,
101
+ initialFocus: b,
102
+ ...R
103
+ } : void 0,
104
+ x: I,
105
+ y: T,
106
+ strategy: E,
107
+ getReferenceProps: j,
108
+ getFloatingProps: A,
108
109
  arrow: {
109
110
  width: e == null ? void 0 : e.width,
110
111
  height: e == null ? void 0 : e.height,
111
- ...T.arrow
112
+ ...L.arrow
112
113
  },
113
114
  context: o,
114
- placement: E,
115
- scrollLock: C
115
+ placement: W,
116
+ scrollLock: M
116
117
  },
117
- children: h
118
+ children: O
118
119
  }
119
120
  );
120
121
  };
121
- d.Trigger = X;
122
- d.Content = V;
122
+ h.Trigger = Z;
123
+ h.Content = Y;
123
124
  export {
124
- d as Overlay,
125
- re as OverlayContext,
126
- d as default
125
+ h as Overlay,
126
+ ae as OverlayContext,
127
+ h as default
127
128
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),n=require("../../../../../external/classnames/index.cjs.js"),f=require("react"),m=require("../../base/typography/text/text.cjs.js"),x=require("../../buttons/closing-button/closing-button.cjs.js"),C=require("../overlay/overlay.cjs.js"),h=require("../overlay/overlay-content.cjs.js"),e=require("./popover.module.scss.cjs.js"),q=c=>{const{children:d,width:l="small",className:u,title:t,titleProps:s={element:"h4"},close:a,closeProps:o={size:"large"}}=c,{onOpenChange:p}=f.useContext(C.OverlayContext);return r.jsxs(h.OverlayContent,{classNames:{content:n.default(e.default["tedi-popover"],{[e.default[`tedi-popover--${l}`]]:l},u),arrow:e.default["tedi-popover__arrow"]},children:[(t||a)&&r.jsxs("div",{className:n.default(e.default["tedi-popover__header"],{[e.default["tedi-popover__header--no-title"]]:!t}),children:[t&&r.jsx(m.Text,{...s,className:n.default("align-self-center",s.className),children:t}),a&&r.jsx(x.ClosingButton,{...o,onClick:v=>{var i;p(!1),(i=o.onClick)==null||i.call(o,v)}})]}),d]})};exports.PopoverContent=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),s=require("../../../../../external/classnames/index.cjs.js"),i=require("react"),C=require("../../base/typography/text/text.cjs.js"),q=require("../../buttons/closing-button/closing-button.cjs.js"),y=require("../overlay/overlay.cjs.js"),g=require("../overlay/overlay-content.cjs.js"),o=require("./popover.module.scss.cjs.js"),j=f=>{const{children:r,width:l="small",className:x,title:e,titleProps:d={element:"h4"},close:a,closeProps:n={size:"large"}}=f,{onOpenChange:h}=i.useContext(y.OverlayContext),c=i.useId(),u=!!r,p=i.useId();return t.jsxs(g.OverlayContent,{classNames:{content:s.default(o.default["tedi-popover"],{[o.default[`tedi-popover--${l}`]]:l},x),arrow:o.default["tedi-popover__arrow"]},labelledBy:e?c:void 0,describedBy:u?p:void 0,children:[(e||a)&&t.jsxs("div",{className:s.default(o.default["tedi-popover__header"],{[o.default["tedi-popover__header--no-title"]]:!e}),children:[e&&t.jsx(C.Text,{...d,id:c,className:s.default("align-self-center",d.className),children:e}),a&&t.jsx(q.ClosingButton,{...n,onClick:m=>{var v;h(!1),(v=n.onClick)==null||v.call(n,m)}})]}),u?t.jsx("div",{id:p,children:r}):r]})};exports.PopoverContent=j;