@tedi-design-system/react 14.4.0-rc.2 → 14.4.0-rc.4
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/_virtual/index.es13.js +2 -2
- package/_virtual/index.es14.js +2 -2
- package/bundle-stats.html +1 -1
- package/external/react-is/index.cjs.js +1 -1
- package/external/react-is/index.es.js +1 -1
- package/external/toposort/index.cjs.js +1 -1
- package/external/toposort/index.es.js +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/tedi/components/buttons/collapse/collapse.cjs.js +1 -1
- package/src/tedi/components/buttons/collapse/collapse.d.ts +13 -8
- package/src/tedi/components/buttons/collapse/collapse.es.js +90 -66
- package/src/tedi/components/buttons/collapse/collapse.module.scss.cjs.js +1 -1
- package/src/tedi/components/buttons/collapse/collapse.module.scss.es.js +9 -2
- 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/package.json
CHANGED
|
@@ -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 t=require("react/jsx-runtime"),s=require("../../../../../external/classnames/index.cjs.js"),_=require("react"),L=require("../../../../../external/react-animate-height/dist/esm/index.cjs.js"),z=require("../../base/icon/icon.cjs.js"),E=require("../../base/typography/text/text.cjs.js"),K=require("../../misc/print/print.cjs.js"),e=require("./collapse.module.scss.cjs.js"),A=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),F=require("../../../providers/label-provider/use-labels.cjs.js"),G=require("../../../helpers/hooks/use-print.cjs.js"),C=require("../../layout/grid/row.cjs.js"),r=require("../../layout/grid/col.cjs.js"),g=f=>{const{getCurrentBreakpointProps:v}=A.useBreakpointProps(f.defaultServerBreakpoint),{getLabel:m}=F.useLabels(),{id:n,children:x,className:P,openText:k=m("open"),closeText:I=m("close"),hideCollapseText:h=!1,title:w,titleRowProps:N,defaultOpen:$,open:d,onToggle:c,arrowType:i="default",size:o="default",underline:O=!0,...S}=v(f),B=`${n}__trigger`,j=`${n}__label`,u=`${n}__content`,M=`${n}__animate`,[b,R]=_.useState(()=>$),p=G.usePrint(),a=_.useMemo(()=>p||(d!==void 0?d:b),[p,d,b]),T=s.default(e.default["tedi-collapse"],o==="small"&&e.default["tedi-collapse--small"],a&&e.default["tedi-collapse--is-open"],h&&e.default["tedi-collapse--icon-only"],e.default[`tedi-collapse--arrow-${i}`],P),q=()=>{const l=!a;R(l),c==null||c(l)},D=l=>{(l.key==="Enter"||l.key===" ")&&!l.repeat&&(l.preventDefault(),q())},y=_.useMemo(()=>t.jsx("div",{id:u,className:e.default["tedi-collapse__content"],children:x}),[x,u]);return t.jsxs("div",{"data-name":"collapse",...S,className:T,children:[t.jsx("button",{id:B,type:"button","data-name":"collapse-trigger",className:e.default["tedi-collapse__title"],"aria-labelledby":j,"aria-expanded":a,"aria-controls":u,onKeyDown:D,onClick:q,children:t.jsxs(C.Row,{justifyContent:"between",alignItems:"center",wrap:"nowrap",...N,element:"span",children:[w&&t.jsx(r.Col,{"aria-hidden":"true",children:w}),t.jsx(r.Col,{width:"auto",children:t.jsxs(C.Row,{element:"span",alignItems:"center",gutter:0,wrap:"nowrap",children:[t.jsx(K.Print,{visibility:"hide",children:t.jsx(r.Col,{width:"auto",className:s.default({"visually-hidden":h}),children:t.jsx(E.Text,{element:"span",className:s.default(e.default["tedi-collapse__text"],{[e.default["tedi-collapse__text--underline"]]:O}),id:j,children:a?I:k})})}),t.jsx(r.Col,{width:"auto",children:t.jsx("div",{className:s.default(e.default["tedi-collapse__icon-wrapper"],e.default[`tedi-collapse__icon-wrapper--${i}`],o==="small"&&e.default["tedi-collapse__icon-wrapper--small"]),children:t.jsx(z.Icon,{className:s.default(e.default["tedi-collapse__icon"],e.default[`tedi-collapse__icon--${i}`],o==="small"&&e.default["tedi-collapse__icon--small"]),name:"expand_more",size:o==="small"||i==="secondary"?18:24})})})]})})]})}),p?y:t.jsx(L.default,{id:M,duration:300,height:a?"auto":0,"data-testid":"collapse-inner",children:y})]})};exports.Collapse=g;exports.default=g;
|
|
@@ -3,31 +3,36 @@ import { BreakpointSupport } from '../../../helpers';
|
|
|
3
3
|
import { RowProps } from '../../layout/grid';
|
|
4
4
|
type CollapseBreakpointProps = {
|
|
5
5
|
/**
|
|
6
|
-
* Whether the collapse should be initially open (uncontrolled mode)
|
|
7
|
-
* This is ignored when `open` and `onToggle` are provided
|
|
6
|
+
* Whether the collapse should be initially open (uncontrolled mode)
|
|
7
|
+
* This is ignored when `open` and `onToggle` are provided
|
|
8
8
|
* @default false
|
|
9
9
|
*/
|
|
10
10
|
defaultOpen?: boolean;
|
|
11
11
|
/**
|
|
12
|
-
* Controls the open/closed state of the collapse (controlled mode)
|
|
13
|
-
* Should be used together with `onToggle
|
|
12
|
+
* Controls the open/closed state of the collapse (controlled mode)
|
|
13
|
+
* Should be used together with `onToggle`
|
|
14
14
|
*/
|
|
15
15
|
open?: boolean;
|
|
16
16
|
/**
|
|
17
|
-
* Whether to visually hide the open/close text on the toggle button
|
|
18
|
-
* Useful for icon-only toggles
|
|
17
|
+
* Whether to visually hide the open/close text on the toggle button
|
|
18
|
+
* Useful for icon-only toggles
|
|
19
19
|
* @default false
|
|
20
20
|
*/
|
|
21
21
|
hideCollapseText?: boolean;
|
|
22
22
|
/**
|
|
23
|
-
* Additional props to pass to the `Row` component used in the title area
|
|
23
|
+
* Additional props to pass to the `Row` component used in the title area
|
|
24
24
|
*/
|
|
25
25
|
titleRowProps?: RowProps;
|
|
26
26
|
/**
|
|
27
|
-
* Custom class name for the root element
|
|
27
|
+
* Custom class name for the root element
|
|
28
28
|
*/
|
|
29
29
|
className?: string;
|
|
30
30
|
arrowType?: 'default' | 'secondary';
|
|
31
|
+
/**
|
|
32
|
+
* Collapse text & icon size
|
|
33
|
+
* @default default
|
|
34
|
+
*/
|
|
35
|
+
size?: 'default' | 'small';
|
|
31
36
|
underline?: boolean;
|
|
32
37
|
};
|
|
33
38
|
export interface CollapseProps extends BreakpointSupport<CollapseBreakpointProps> {
|
|
@@ -1,85 +1,109 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { Text as
|
|
7
|
-
import { Print as
|
|
8
|
-
import
|
|
9
|
-
import { useBreakpointProps as
|
|
10
|
-
import { useLabels as
|
|
11
|
-
import { usePrint as
|
|
12
|
-
import { Row as
|
|
1
|
+
import { jsx as t, jsxs as _ } from "react/jsx-runtime";
|
|
2
|
+
import o from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import u from "react";
|
|
4
|
+
import E from "../../../../../external/react-animate-height/dist/esm/index.es.js";
|
|
5
|
+
import { Icon as K } from "../../base/icon/icon.es.js";
|
|
6
|
+
import { Text as L } from "../../base/typography/text/text.es.js";
|
|
7
|
+
import { Print as A } from "../../misc/print/print.es.js";
|
|
8
|
+
import e from "./collapse.module.scss.es.js";
|
|
9
|
+
import { useBreakpointProps as H } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
10
|
+
import { useLabels as q } from "../../../providers/label-provider/use-labels.es.js";
|
|
11
|
+
import { usePrint as F } from "../../../helpers/hooks/use-print.es.js";
|
|
12
|
+
import { Row as v } from "../../layout/grid/row.es.js";
|
|
13
13
|
import { Col as r } from "../../layout/grid/col.es.js";
|
|
14
|
-
const
|
|
15
|
-
const { getCurrentBreakpointProps:
|
|
16
|
-
id:
|
|
17
|
-
children:
|
|
18
|
-
className:
|
|
19
|
-
openText:
|
|
20
|
-
closeText:
|
|
21
|
-
hideCollapseText:
|
|
22
|
-
title:
|
|
23
|
-
titleRowProps:
|
|
24
|
-
defaultOpen:
|
|
25
|
-
open:
|
|
26
|
-
onToggle:
|
|
27
|
-
arrowType:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
[
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
14
|
+
const oe = (h) => {
|
|
15
|
+
const { getCurrentBreakpointProps: I } = H(h.defaultServerBreakpoint), { getLabel: f } = q(), {
|
|
16
|
+
id: n,
|
|
17
|
+
children: w,
|
|
18
|
+
className: k,
|
|
19
|
+
openText: $ = f("open"),
|
|
20
|
+
closeText: P = f("close"),
|
|
21
|
+
hideCollapseText: y = !1,
|
|
22
|
+
title: g,
|
|
23
|
+
titleRowProps: O,
|
|
24
|
+
defaultOpen: B,
|
|
25
|
+
open: c,
|
|
26
|
+
onToggle: d,
|
|
27
|
+
arrowType: i = "default",
|
|
28
|
+
size: s = "default",
|
|
29
|
+
underline: S = !0,
|
|
30
|
+
...T
|
|
31
|
+
} = I(h), j = `${n}__trigger`, x = `${n}__label`, p = `${n}__content`, D = `${n}__animate`, [b, M] = u.useState(() => B), m = F(), a = u.useMemo(
|
|
32
|
+
() => m || (c !== void 0 ? c : b),
|
|
33
|
+
[m, c, b]
|
|
34
|
+
), R = o(
|
|
35
|
+
e["tedi-collapse"],
|
|
36
|
+
s === "small" && e["tedi-collapse--small"],
|
|
37
|
+
a && e["tedi-collapse--is-open"],
|
|
38
|
+
y && e["tedi-collapse--icon-only"],
|
|
39
|
+
e[`tedi-collapse--arrow-${i}`],
|
|
40
|
+
k
|
|
41
|
+
), C = () => {
|
|
42
|
+
const l = !a;
|
|
43
|
+
M(l), d == null || d(l);
|
|
44
|
+
}, z = (l) => {
|
|
45
|
+
(l.key === "Enter" || l.key === " ") && !l.repeat && (l.preventDefault(), C());
|
|
46
|
+
}, N = u.useMemo(
|
|
47
|
+
() => /* @__PURE__ */ t("div", { id: p, className: e["tedi-collapse__content"], children: w }),
|
|
48
|
+
[w, p]
|
|
46
49
|
);
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
/* @__PURE__ */
|
|
50
|
+
return /* @__PURE__ */ _("div", { "data-name": "collapse", ...T, className: R, children: [
|
|
51
|
+
/* @__PURE__ */ t(
|
|
49
52
|
"button",
|
|
50
53
|
{
|
|
54
|
+
id: j,
|
|
51
55
|
type: "button",
|
|
52
56
|
"data-name": "collapse-trigger",
|
|
53
|
-
className:
|
|
54
|
-
"aria-labelledby":
|
|
55
|
-
"aria-expanded":
|
|
56
|
-
"aria-controls":
|
|
57
|
-
onKeyDown:
|
|
58
|
-
onClick:
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
-
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
|
|
57
|
+
className: e["tedi-collapse__title"],
|
|
58
|
+
"aria-labelledby": x,
|
|
59
|
+
"aria-expanded": a,
|
|
60
|
+
"aria-controls": p,
|
|
61
|
+
onKeyDown: z,
|
|
62
|
+
onClick: C,
|
|
63
|
+
children: /* @__PURE__ */ _(v, { justifyContent: "between", alignItems: "center", wrap: "nowrap", ...O, element: "span", children: [
|
|
64
|
+
g && /* @__PURE__ */ t(r, { "aria-hidden": "true", children: g }),
|
|
65
|
+
/* @__PURE__ */ t(r, { width: "auto", children: /* @__PURE__ */ _(v, { element: "span", alignItems: "center", gutter: 0, wrap: "nowrap", children: [
|
|
66
|
+
/* @__PURE__ */ t(A, { visibility: "hide", children: /* @__PURE__ */ t(r, { width: "auto", className: o({ "visually-hidden": y }), children: /* @__PURE__ */ t(
|
|
67
|
+
L,
|
|
64
68
|
{
|
|
65
69
|
element: "span",
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
[t["tedi-collapse__text--underline"]]: I
|
|
70
|
+
className: o(e["tedi-collapse__text"], {
|
|
71
|
+
[e["tedi-collapse__text--underline"]]: S
|
|
69
72
|
}),
|
|
70
|
-
id:
|
|
71
|
-
children:
|
|
73
|
+
id: x,
|
|
74
|
+
children: a ? P : $
|
|
72
75
|
}
|
|
73
76
|
) }) }),
|
|
74
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ t(r, { width: "auto", children: /* @__PURE__ */ t(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
className: o(
|
|
81
|
+
e["tedi-collapse__icon-wrapper"],
|
|
82
|
+
e[`tedi-collapse__icon-wrapper--${i}`],
|
|
83
|
+
s === "small" && e["tedi-collapse__icon-wrapper--small"]
|
|
84
|
+
),
|
|
85
|
+
children: /* @__PURE__ */ t(
|
|
86
|
+
K,
|
|
87
|
+
{
|
|
88
|
+
className: o(
|
|
89
|
+
e["tedi-collapse__icon"],
|
|
90
|
+
e[`tedi-collapse__icon--${i}`],
|
|
91
|
+
s === "small" && e["tedi-collapse__icon--small"]
|
|
92
|
+
),
|
|
93
|
+
name: "expand_more",
|
|
94
|
+
size: s === "small" || i === "secondary" ? 18 : 24
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
) })
|
|
75
99
|
] }) })
|
|
76
100
|
] })
|
|
77
101
|
}
|
|
78
102
|
),
|
|
79
|
-
|
|
103
|
+
m ? N : /* @__PURE__ */ t(E, { id: D, duration: 300, height: a ? "auto" : 0, "data-testid": "collapse-inner", children: N })
|
|
80
104
|
] });
|
|
81
105
|
};
|
|
82
106
|
export {
|
|
83
|
-
|
|
84
|
-
|
|
107
|
+
oe as Collapse,
|
|
108
|
+
oe as default
|
|
85
109
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-collapse__title":"tedi-collapse__title-3e140e5c","tedi-collapse__text--underline":"tedi-collapse__text--underline-73ca86bd","tedi-collapse__icon-wrapper":"tedi-collapse__icon-wrapper-d2b036ea","tedi-collapse__icon":"tedi-collapse__icon-5156e480","tedi-collapse--
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-collapse__title":"tedi-collapse__title-3e140e5c","tedi-collapse__text":"tedi-collapse__text-d150fea1","tedi-collapse__text--underline":"tedi-collapse__text--underline-73ca86bd","tedi-collapse__icon-wrapper":"tedi-collapse__icon-wrapper-d2b036ea","tedi-collapse__icon":"tedi-collapse__icon-5156e480","tedi-collapse__icon-wrapper--secondary":"tedi-collapse__icon-wrapper--secondary-3321348a","tedi-collapse__icon--secondary":"tedi-collapse__icon--secondary-f0f3125f","tedi-collapse__icon--default":"tedi-collapse__icon--default-9c7e19e4","tedi-collapse__icon-wrapper--default":"tedi-collapse__icon-wrapper--default-450808b2","tedi-collapse__icon-wrapper--small":"tedi-collapse__icon-wrapper--small-65e6d09a","tedi-collapse--icon-only":"tedi-collapse--icon-only-335962f8","tedi-collapse__content":"tedi-collapse__content-350b91f8","tedi-collapse--is-open":"tedi-collapse--is-open-b34b11c3"};exports.default=e;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
const e = {
|
|
2
2
|
"tedi-collapse__title": "tedi-collapse__title-3e140e5c",
|
|
3
|
+
"tedi-collapse__text": "tedi-collapse__text-d150fea1",
|
|
3
4
|
"tedi-collapse__text--underline": "tedi-collapse__text--underline-73ca86bd",
|
|
4
5
|
"tedi-collapse__icon-wrapper": "tedi-collapse__icon-wrapper-d2b036ea",
|
|
5
6
|
"tedi-collapse__icon": "tedi-collapse__icon-5156e480",
|
|
6
|
-
"tedi-
|
|
7
|
-
"tedi-
|
|
7
|
+
"tedi-collapse__icon-wrapper--secondary": "tedi-collapse__icon-wrapper--secondary-3321348a",
|
|
8
|
+
"tedi-collapse__icon--secondary": "tedi-collapse__icon--secondary-f0f3125f",
|
|
9
|
+
"tedi-collapse__icon--default": "tedi-collapse__icon--default-9c7e19e4",
|
|
10
|
+
"tedi-collapse__icon-wrapper--default": "tedi-collapse__icon-wrapper--default-450808b2",
|
|
11
|
+
"tedi-collapse__icon-wrapper--small": "tedi-collapse__icon-wrapper--small-65e6d09a",
|
|
12
|
+
"tedi-collapse--icon-only": "tedi-collapse--icon-only-335962f8",
|
|
13
|
+
"tedi-collapse__content": "tedi-collapse__content-350b91f8",
|
|
14
|
+
"tedi-collapse--is-open": "tedi-collapse--is-open-b34b11c3"
|
|
8
15
|
};
|
|
9
16
|
export {
|
|
10
17
|
e as default
|
|
@@ -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;
|