@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.
@@ -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;
@@ -1,47 +1,49 @@
1
- import { jsxs as m, jsx as a } from "react/jsx-runtime";
2
- import r from "../../../../../external/classnames/index.es.js";
3
- import { useContext as v } from "react";
4
- import { Text as C } from "../../base/typography/text/text.es.js";
5
- import { ClosingButton as x } from "../../buttons/closing-button/closing-button.es.js";
6
- import { OverlayContext as N } from "../overlay/overlay.es.js";
7
- import { OverlayContent as _ } from "../overlay/overlay-content.es.js";
8
- import e from "./popover.module.scss.es.js";
9
- const B = (p) => {
1
+ import { jsxs as v, jsx as i } from "react/jsx-runtime";
2
+ import s from "../../../../../external/classnames/index.es.js";
3
+ import { useContext as _, useId as f } from "react";
4
+ import { Text as y } from "../../base/typography/text/text.es.js";
5
+ import { ClosingButton as g } from "../../buttons/closing-button/closing-button.es.js";
6
+ import { OverlayContext as u } from "../overlay/overlay.es.js";
7
+ import { OverlayContent as B } from "../overlay/overlay-content.es.js";
8
+ import o from "./popover.module.scss.es.js";
9
+ const P = (h) => {
10
10
  const {
11
- children: c,
12
- width: s = "small",
13
- className: d,
14
- title: o,
15
- titleProps: i = { element: "h4" },
16
- close: n,
11
+ children: r,
12
+ width: n = "small",
13
+ className: C,
14
+ title: e,
15
+ titleProps: l = { element: "h4" },
16
+ close: a,
17
17
  closeProps: t = { size: "large" }
18
- } = p, { onOpenChange: f } = v(N);
19
- return /* @__PURE__ */ m(
20
- _,
18
+ } = h, { onOpenChange: x } = _(u), d = f(), m = !!r, c = f();
19
+ return /* @__PURE__ */ v(
20
+ B,
21
21
  {
22
22
  classNames: {
23
- content: r(e["tedi-popover"], { [e[`tedi-popover--${s}`]]: s }, d),
24
- arrow: e["tedi-popover__arrow"]
23
+ content: s(o["tedi-popover"], { [o[`tedi-popover--${n}`]]: n }, C),
24
+ arrow: o["tedi-popover__arrow"]
25
25
  },
26
+ labelledBy: e ? d : void 0,
27
+ describedBy: m ? c : void 0,
26
28
  children: [
27
- (o || n) && /* @__PURE__ */ m("div", { className: r(e["tedi-popover__header"], { [e["tedi-popover__header--no-title"]]: !o }), children: [
28
- o && /* @__PURE__ */ a(C, { ...i, className: r("align-self-center", i.className), children: o }),
29
- n && /* @__PURE__ */ a(
30
- x,
29
+ (e || a) && /* @__PURE__ */ v("div", { className: s(o["tedi-popover__header"], { [o["tedi-popover__header--no-title"]]: !e }), children: [
30
+ e && /* @__PURE__ */ i(y, { ...l, id: d, className: s("align-self-center", l.className), children: e }),
31
+ a && /* @__PURE__ */ i(
32
+ g,
31
33
  {
32
34
  ...t,
33
- onClick: (h) => {
34
- var l;
35
- f(!1), (l = t.onClick) == null || l.call(t, h);
35
+ onClick: (N) => {
36
+ var p;
37
+ x(!1), (p = t.onClick) == null || p.call(t, N);
36
38
  }
37
39
  }
38
40
  )
39
41
  ] }),
40
- c
42
+ m ? /* @__PURE__ */ i("div", { id: c, children: r }) : r
41
43
  ]
42
44
  }
43
45
  );
44
46
  };
45
47
  export {
46
- B as PopoverContent
48
+ P as PopoverContent
47
49
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),i=require("../overlay/overlay.cjs.js"),s=require("./popover-content.cjs.js"),u=require("./popover-trigger.cjs.js"),c=34,p=17,e=o=>{const{openWith:r="click",...t}=o;return n.jsx(i.Overlay,{arrowDimensions:{width:c,height:p},openWith:r,...t})};e.Trigger=u.PopoverTrigger;e.Content=s.PopoverContent;exports.Popover=e;exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),i=require("../overlay/overlay.cjs.js"),s=require("./popover-content.cjs.js"),u=require("./popover-trigger.cjs.js"),c=34,l=17,e=o=>{const{openWith:r="click",...t}=o;return n.jsx(i.Overlay,{arrowDimensions:{width:c,height:l},openWith:r,role:"dialog",...t})};e.Trigger=u.PopoverTrigger;e.Content=s.PopoverContent;exports.Popover=e;exports.default=e;
@@ -12,6 +12,7 @@ const s = 34, c = 17, o = (r) => {
12
12
  height: c
13
13
  },
14
14
  openWith: t,
15
+ role: "dialog",
15
16
  ...e
16
17
  }
17
18
  );