@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tedi-design-system/react",
3
- "version": "14.4.0-rc.2",
3
+ "version": "14.4.0-rc.4",
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"),n=require("../../../../../external/classnames/index.cjs.js"),o=require("react"),R=require("../../../../../external/react-animate-height/dist/esm/index.cjs.js"),w=require("../../base/icon/icon.cjs.js"),T=require("../../base/typography/text/text.cjs.js"),D=require("../../misc/print/print.cjs.js"),t=require("./collapse.module.scss.cjs.js"),L=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),$=require("../../../providers/label-provider/use-labels.cjs.js"),E=require("../../../helpers/hooks/use-print.cjs.js"),b=require("../../layout/grid/row.cjs.js"),i=require("../../layout/grid/col.cjs.js"),q=u=>{const{getCurrentBreakpointProps:C}=L.useBreakpointProps(u.defaultServerBreakpoint),{getLabel:p}=$.useLabels(),{id:a,children:x,className:m,openText:y=p("open"),closeText:v=p("close"),hideCollapseText:N=!1,title:h,titleRowProps:P,defaultOpen:g,open:r,onToggle:c,arrowType:k="neutral",underline:M=!0,...O}=C(u),[f,S]=o.useState(()=>g),d=E.usePrint(),s=o.useMemo(()=>d||(r!==void 0?r:f),[d,r,f]),B=o.useMemo(()=>n.default(t.default["tedi-collapse"],m,{[t.default["tedi-collapse--is-open"]]:s}),[m,s]),_=()=>{const l=!s;S(l),c==null||c(l)},I=l=>{(l.key==="Enter"||l.key===" ")&&!l.repeat&&(l.preventDefault(),_())},j=o.useMemo(()=>e.jsx("div",{className:t.default["tedi-collapse__content"],children:x}),[x]);return e.jsxs("div",{"data-name":"collapse",...O,className:B,children:[e.jsx("button",{type:"button","data-name":"collapse-trigger",className:t.default["tedi-collapse__title"],"aria-labelledby":`${a}-collapse-label`,"aria-expanded":s,"aria-controls":a,onKeyDown:I,onClick:_,children:e.jsxs(b.Row,{justifyContent:"between",alignItems:"center",wrap:"nowrap",...P,element:"span",children:[h&&e.jsx(i.Col,{"aria-hidden":"true",children:h}),e.jsx(i.Col,{width:"auto",children:e.jsxs(b.Row,{element:"span",alignItems:"center",gutter:1,children:[e.jsx(D.Print,{visibility:"hide",children:e.jsx(i.Col,{width:"auto",className:n.default({"visually-hidden":N}),children:e.jsx(T.Text,{element:"span",color:"brand",className:n.default(t.default["tedi-collapse__text"],{[t.default["tedi-collapse__text--underline"]]:M}),id:`${a}-collapse-label`,children:s?v:y})})}),e.jsx(i.Col,{width:"auto",children:k==="secondary"?e.jsx("div",{className:t.default["tedi-collapse__icon-wrapper"],children:e.jsx(w.Icon,{className:n.default(t.default["tedi-collapse__icon"]),name:"expand_more"})}):e.jsx(w.Icon,{className:n.default(t.default["tedi-collapse__icon"]),name:"expand_more"})})]})})]})}),d?j:e.jsx(R.default,{duration:300,id:a,height:s?"auto":0,"data-testid":"collapse-inner",children:j})]})};exports.Collapse=q;exports.default=q;
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 e, jsxs as p } from "react/jsx-runtime";
2
- import n from "../../../../../external/classnames/index.es.js";
3
- import i from "react";
4
- import D from "../../../../../external/react-animate-height/dist/esm/index.es.js";
5
- import { Icon as b } from "../../base/icon/icon.es.js";
6
- import { Text as R } from "../../base/typography/text/text.es.js";
7
- import { Print as E } from "../../misc/print/print.es.js";
8
- import t from "./collapse.module.scss.es.js";
9
- import { useBreakpointProps as K } from "../../../helpers/hooks/use-breakpoint-props.es.js";
10
- import { useLabels as L } from "../../../providers/label-provider/use-labels.es.js";
11
- import { usePrint as $ } from "../../../helpers/hooks/use-print.es.js";
12
- import { Row as N } from "../../layout/grid/row.es.js";
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 Z = (m) => {
15
- const { getCurrentBreakpointProps: C } = K(m.defaultServerBreakpoint), { getLabel: u } = L(), {
16
- id: l,
17
- children: h,
18
- className: f,
19
- openText: v = u("open"),
20
- closeText: g = u("close"),
21
- hideCollapseText: k = !1,
22
- title: _,
23
- titleRowProps: P,
24
- defaultOpen: O,
25
- open: s,
26
- onToggle: c,
27
- arrowType: B = "neutral",
28
- underline: I = !0,
29
- ...M
30
- } = C(m), [w, S] = i.useState(() => O), d = $(), o = i.useMemo(
31
- () => d || (s !== void 0 ? s : w),
32
- [d, s, w]
33
- ), T = i.useMemo(
34
- () => n(t["tedi-collapse"], f, {
35
- [t["tedi-collapse--is-open"]]: o
36
- }),
37
- [f, o]
38
- ), x = () => {
39
- const a = !o;
40
- S(a), c == null || c(a);
41
- }, j = (a) => {
42
- (a.key === "Enter" || a.key === " ") && !a.repeat && (a.preventDefault(), x());
43
- }, y = i.useMemo(
44
- () => /* @__PURE__ */ e("div", { className: t["tedi-collapse__content"], children: h }),
45
- [h]
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__ */ p("div", { "data-name": "collapse", ...M, className: T, children: [
48
- /* @__PURE__ */ e(
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: t["tedi-collapse__title"],
54
- "aria-labelledby": `${l}-collapse-label`,
55
- "aria-expanded": o,
56
- "aria-controls": l,
57
- onKeyDown: j,
58
- onClick: x,
59
- children: /* @__PURE__ */ p(N, { justifyContent: "between", alignItems: "center", wrap: "nowrap", ...P, element: "span", children: [
60
- _ && /* @__PURE__ */ e(r, { "aria-hidden": "true", children: _ }),
61
- /* @__PURE__ */ e(r, { width: "auto", children: /* @__PURE__ */ p(N, { element: "span", alignItems: "center", gutter: 1, children: [
62
- /* @__PURE__ */ e(E, { visibility: "hide", children: /* @__PURE__ */ e(r, { width: "auto", className: n({ "visually-hidden": k }), children: /* @__PURE__ */ e(
63
- R,
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
- color: "brand",
67
- className: n(t["tedi-collapse__text"], {
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: `${l}-collapse-label`,
71
- children: o ? g : v
73
+ id: x,
74
+ children: a ? P : $
72
75
  }
73
76
  ) }) }),
74
- /* @__PURE__ */ e(r, { width: "auto", children: B === "secondary" ? /* @__PURE__ */ e("div", { className: t["tedi-collapse__icon-wrapper"], children: /* @__PURE__ */ e(b, { className: n(t["tedi-collapse__icon"]), name: "expand_more" }) }) : /* @__PURE__ */ e(b, { className: n(t["tedi-collapse__icon"]), name: "expand_more" }) })
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
- d ? y : /* @__PURE__ */ e(D, { duration: 300, id: l, height: o ? "auto" : 0, "data-testid": "collapse-inner", children: y })
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
- Z as Collapse,
84
- Z as default
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--is-open":"tedi-collapse--is-open-b34b11c3","tedi-collapse__content":"tedi-collapse__content-350b91f8"};exports.default=e;
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-collapse--is-open": "tedi-collapse--is-open-b34b11c3",
7
- "tedi-collapse__content": "tedi-collapse__content-350b91f8"
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 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;