@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/bundle-stats.html +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/tedi/components/form/file-dropzone/file-dropzone.cjs.js +1 -1
- package/src/tedi/components/form/file-dropzone/file-dropzone.es.js +69 -59
- package/src/tedi/components/form/file-dropzone/file-dropzone.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/file-dropzone/file-dropzone.module.scss.es.js +1 -0
- package/src/tedi/components/overlays/overlay/overlay-content.cjs.js +1 -1
- package/src/tedi/components/overlays/overlay/overlay-content.d.ts +27 -2
- package/src/tedi/components/overlays/overlay/overlay-content.es.js +37 -34
- package/src/tedi/components/overlays/overlay/overlay.cjs.js +1 -1
- package/src/tedi/components/overlays/overlay/overlay.es.js +72 -71
- package/src/tedi/components/overlays/popover/popover-content.cjs.js +1 -1
- package/src/tedi/components/overlays/popover/popover-content.es.js +31 -29
- package/src/tedi/components/overlays/popover/popover.cjs.js +1 -1
- package/src/tedi/components/overlays/popover/popover.es.js +1 -0
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +21 -0
- package/src/tedi/providers/label-provider/labels-map.es.js +28 -4
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),
|
|
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
|
|
2
|
-
import
|
|
3
|
-
import { useDropzone as
|
|
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
|
|
6
|
-
import { ClosingButton as
|
|
7
|
-
import { FeedbackText as
|
|
8
|
-
import { FormLabel as
|
|
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
|
|
11
|
-
import { CardContent as
|
|
12
|
-
import { useLabels as
|
|
13
|
-
import {
|
|
14
|
-
import { Row as
|
|
15
|
-
import { Col as
|
|
16
|
-
const Y = (
|
|
17
|
-
const { getLabel: n } =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
}),
|
|
28
|
+
}), x = C(
|
|
27
29
|
o["tedi-file-dropzone"],
|
|
28
|
-
{ [o["tedi-file-dropzone--disabled"]]:
|
|
29
|
-
{ [o["tedi-file-dropzone--invalid"]]: ((
|
|
30
|
-
{ [o["tedi-file-dropzone--valid"]]: ((
|
|
31
|
-
{ [o["tedi-file-dropzone--drop-over"]]:
|
|
32
|
-
|
|
33
|
-
),
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
72
|
+
t.isValid === !1 && /* @__PURE__ */ e(f, { name: "info", color: "danger", display: "inline", size: 18 })
|
|
63
73
|
] }),
|
|
64
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
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
|
|
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
|
-
*
|
|
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
|
|
2
|
-
import { FloatingPortal as
|
|
3
|
-
import { useContext as
|
|
4
|
-
import { OverlayContext as
|
|
5
|
-
const
|
|
6
|
-
const { children:
|
|
7
|
-
open:
|
|
8
|
-
x:
|
|
9
|
-
y
|
|
10
|
-
strategy:
|
|
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:
|
|
13
|
-
arrowRef:
|
|
14
|
-
getFloatingProps:
|
|
15
|
-
placement:
|
|
12
|
+
floating: u,
|
|
13
|
+
arrowRef: b,
|
|
14
|
+
getFloatingProps: g,
|
|
15
|
+
placement: p,
|
|
16
16
|
context: r,
|
|
17
|
-
arrow:
|
|
17
|
+
arrow: t,
|
|
18
18
|
scrollLock: i
|
|
19
|
-
} =
|
|
20
|
-
return
|
|
21
|
-
i && (
|
|
22
|
-
}, [
|
|
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
|
-
...
|
|
26
|
-
ref:
|
|
25
|
+
...g({
|
|
26
|
+
ref: u,
|
|
27
|
+
tabIndex: -1,
|
|
28
|
+
"aria-labelledby": s,
|
|
29
|
+
"aria-describedby": m,
|
|
27
30
|
style: {
|
|
28
|
-
position:
|
|
29
|
-
left:
|
|
30
|
-
top:
|
|
31
|
+
position: h,
|
|
32
|
+
left: f,
|
|
33
|
+
top: y
|
|
31
34
|
},
|
|
32
|
-
className:
|
|
35
|
+
className: e == null ? void 0 : e.content
|
|
33
36
|
}),
|
|
34
|
-
"data-placement":
|
|
37
|
+
"data-placement": p,
|
|
35
38
|
"data-testid": "overlay-content",
|
|
36
39
|
children: [
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
|
|
40
|
+
/* @__PURE__ */ n(
|
|
41
|
+
F,
|
|
39
42
|
{
|
|
40
|
-
ref: (
|
|
43
|
+
ref: (d) => b.current = d,
|
|
41
44
|
context: r,
|
|
42
|
-
className:
|
|
43
|
-
height:
|
|
44
|
-
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
|
-
|
|
51
|
+
c
|
|
49
52
|
]
|
|
50
53
|
}
|
|
51
54
|
) }) }) : null;
|
|
52
55
|
};
|
|
53
56
|
export {
|
|
54
|
-
|
|
57
|
+
S as OverlayContent
|
|
55
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const 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
|
|
2
|
-
import { useFloating as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { OverlayContent as
|
|
5
|
-
import { OverlayTrigger as
|
|
6
|
-
import { autoUpdate as
|
|
7
|
-
import { offset as
|
|
8
|
-
import { useIsTouchDevice as
|
|
9
|
-
import { useIsMounted as
|
|
10
|
-
const
|
|
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
|
-
}),
|
|
38
|
-
const
|
|
39
|
-
children:
|
|
40
|
-
placement:
|
|
41
|
-
openWith: r =
|
|
42
|
-
defaultOpen:
|
|
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:
|
|
45
|
+
role: C = "tooltip",
|
|
46
46
|
arrowDimensions: e,
|
|
47
|
-
offset:
|
|
48
|
-
focusManager:
|
|
49
|
-
dismissible:
|
|
50
|
-
scrollLock:
|
|
51
|
-
} =
|
|
52
|
-
(
|
|
53
|
-
typeof n > "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,
|
|
56
|
-
), { x:
|
|
57
|
-
placement:
|
|
58
|
-
open:
|
|
59
|
-
onOpenChange:
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
element:
|
|
61
|
+
$(F),
|
|
62
|
+
ee(),
|
|
63
|
+
te({ padding: 8 }),
|
|
64
|
+
oe({
|
|
65
|
+
element: u,
|
|
66
66
|
padding: 4
|
|
67
67
|
})
|
|
68
68
|
],
|
|
69
|
-
whileElementsMounted:
|
|
70
|
-
}), { getReferenceProps:
|
|
71
|
-
|
|
69
|
+
whileElementsMounted: _
|
|
70
|
+
}), { getReferenceProps: j, getFloatingProps: A } = S([
|
|
71
|
+
U(o, {
|
|
72
72
|
enabled: r === "hover",
|
|
73
|
-
handleClose:
|
|
73
|
+
handleClose: J()
|
|
74
74
|
}),
|
|
75
|
-
|
|
76
|
-
toggle:
|
|
75
|
+
q(o, {
|
|
76
|
+
toggle: a
|
|
77
77
|
}),
|
|
78
|
-
|
|
78
|
+
z(o, {
|
|
79
79
|
enabled: r === "hover"
|
|
80
80
|
}),
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
enabled:
|
|
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__ */
|
|
88
|
-
|
|
87
|
+
return /* @__PURE__ */ G(
|
|
88
|
+
ae.Provider,
|
|
89
89
|
{
|
|
90
90
|
value: {
|
|
91
|
-
open:
|
|
92
|
-
onOpenChange:
|
|
93
|
-
isMounted:
|
|
91
|
+
open: p,
|
|
92
|
+
onOpenChange: d,
|
|
93
|
+
isMounted: k,
|
|
94
94
|
openWith: r,
|
|
95
|
-
reference:
|
|
96
|
-
floating:
|
|
97
|
-
arrowRef:
|
|
98
|
-
focusManager: {
|
|
99
|
-
order:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
...
|
|
112
|
+
...L.arrow
|
|
112
113
|
},
|
|
113
114
|
context: o,
|
|
114
|
-
placement:
|
|
115
|
-
scrollLock:
|
|
115
|
+
placement: W,
|
|
116
|
+
scrollLock: M
|
|
116
117
|
},
|
|
117
|
-
children:
|
|
118
|
+
children: O
|
|
118
119
|
}
|
|
119
120
|
);
|
|
120
121
|
};
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
h.Trigger = Z;
|
|
123
|
+
h.Content = Y;
|
|
123
124
|
export {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
|
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;
|