se-design 1.0.76-dev1 → 1.0.76

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/dist/index13.js CHANGED
@@ -1,6 +1,6 @@
1
- import i from "react";
1
+ import s from "react";
2
2
  import "./index72.js";
3
- import { useModalA11y as g } from "./index201.js";
3
+ import { useModalA11y as b } from "./index201.js";
4
4
  function o() {
5
5
  return o = Object.assign ? Object.assign.bind() : function(n) {
6
6
  for (var a = 1; a < arguments.length; a++) {
@@ -10,13 +10,13 @@ function o() {
10
10
  return n;
11
11
  }, o.apply(null, arguments);
12
12
  }
13
- const x = (n) => {
13
+ const h = (n) => {
14
14
  const {
15
15
  renderModalContent: a,
16
16
  isOpen: e,
17
17
  width: t = "500px",
18
- className: r = "",
19
- contentClassName: s = "",
18
+ className: i = "",
19
+ contentClassName: r = "",
20
20
  automationId: l = "",
21
21
  onModalClick: d = () => {
22
22
  },
@@ -26,30 +26,28 @@ const x = (n) => {
26
26
  } = n, {
27
27
  containerRef: p,
28
28
  dialogProps: f
29
- } = g({
29
+ } = b({
30
30
  isOpen: e,
31
31
  onDismiss: c,
32
32
  ariaLabel: m,
33
33
  ariaLabelledBy: u
34
34
  });
35
- return /* @__PURE__ */ i.createElement("div", {
36
- className: `se-design-modal fixed inset-0 flex items-center justify-center p-4 z-[2001] backdrop-brightness-50 backdrop-blur-sm ${e ? "visible" : "invisible pointer-events-none"} ${r}`,
35
+ return /* @__PURE__ */ s.createElement("div", {
36
+ className: `se-design-modal fixed inset-0 flex items-start justify-center z-[2001] backdrop-brightness-50 backdrop-blur-sm ${e ? "visible" : "invisible pointer-events-none"} ${i}`,
37
37
  "data-automation-id": l,
38
38
  onClick: d,
39
39
  "aria-hidden": e ? void 0 : !0
40
- }, /* @__PURE__ */ i.createElement("div", o({
40
+ }, /* @__PURE__ */ s.createElement("div", o({
41
41
  ref: p
42
42
  }, f, {
43
- className: `modal-content flex flex-col gap-3 bg-[var(--color-white)] rounded shadow-lg p-8 ${s}`,
43
+ className: `modal-content flex flex-col gap-3 bg-[var(--color-white)] rounded shadow-lg p-8 mt-[48px] ${r}`,
44
44
  style: {
45
45
  width: t,
46
- maxWidth: "100%",
47
- maxHeight: "90vh",
48
- overflowY: "auto"
46
+ maxWidth: "100vw"
49
47
  }
50
48
  }), a()));
51
49
  };
52
50
  export {
53
- x as CustomModal
51
+ h as CustomModal
54
52
  };
55
53
  //# sourceMappingURL=index13.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index13.js","sources":["../src/components/CustomModal/index.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { useModalA11y } from 'src/utils/a11y';\n\nexport interface CustomModalProps {\n onSubmit?: () => void;\n onClose?: () => void;\n onModalClick?: () => void;\n renderModalContent: () => React.ReactNode;\n isOpen: boolean;\n width?: string;\n className?: string;\n contentClassName?: string;\n automationId?: string;\n /**\n * ID of a visible heading element rendered inside `renderModalContent`.\n * Add `id={ariaLabelledBy}` to that element to complete the association.\n */\n ariaLabelledBy?: string;\n /**\n * aria-label for modals without a visible title heading.\n * Ignored when `ariaLabelledBy` is provided.\n */\n ariaLabel?: string;\n}\n\n/**\n * Modal container with built-in focus trap, Escape dismissal, and dialog semantics.\n *\n * Labelling (pick one):\n * - `ariaLabelledBy` — ID of a heading rendered inside `renderModalContent`\n * - `ariaLabel` — for modals with no visible title\n *\n * Escape dismissal requires `onClose` to be passed.\n */\nexport const CustomModal: FC<CustomModalProps> = (props) => {\n const {\n renderModalContent,\n isOpen,\n width = '500px',\n className = '',\n contentClassName = '',\n automationId = '',\n onModalClick = () => {},\n onClose,\n ariaLabel,\n ariaLabelledBy,\n } = props;\n\n const { containerRef, dialogProps } = useModalA11y({\n isOpen,\n onDismiss: onClose,\n ariaLabel,\n ariaLabelledBy,\n });\n\n return (\n <div\n className={`se-design-modal fixed inset-0 flex items-center justify-center p-4 z-[2001] backdrop-brightness-50 backdrop-blur-sm ${\n isOpen ? 'visible' : 'invisible pointer-events-none'\n } ${className}`}\n data-automation-id={automationId}\n onClick={onModalClick}\n aria-hidden={isOpen ? undefined : true}\n >\n <div\n ref={containerRef}\n {...dialogProps}\n className={`modal-content flex flex-col gap-3 bg-[var(--color-white)] rounded shadow-lg p-8 ${contentClassName}`}\n style={{ width, maxWidth: '100%', maxHeight: '90vh', overflowY: 'auto' }}\n >\n {renderModalContent()}\n </div>\n </div>\n );\n};\n"],"names":["CustomModal","props","renderModalContent","isOpen","width","className","contentClassName","automationId","onModalClick","onClose","ariaLabel","ariaLabelledBy","containerRef","dialogProps","useModalA11y","onDismiss","React","createElement","onClick","undefined","_extends","ref","style","maxWidth","maxHeight","overflowY"],"mappings":";;;;;;;;;;;;AAkCO,MAAMA,IAAqCC,CAAAA,MAAU;AAC1D,QAAM;AAAA,IACJC,oBAAAA;AAAAA,IACAC,QAAAA;AAAAA,IACAC,OAAAA,IAAQ;AAAA,IACRC,WAAAA,IAAY;AAAA,IACZC,kBAAAA,IAAmB;AAAA,IACnBC,cAAAA,IAAe;AAAA,IACfC,cAAAA,IAAeA,MAAM;AAAA,IAAC;AAAA,IACtBC,SAAAA;AAAAA,IACAC,WAAAA;AAAAA,IACAC,gBAAAA;AAAAA,EAAAA,IACEV,GAEE;AAAA,IAAEW,cAAAA;AAAAA,IAAcC,aAAAA;AAAAA,EAAAA,IAAgBC,EAAa;AAAA,IACjDX,QAAAA;AAAAA,IACAY,WAAWN;AAAAA,IACXC,WAAAA;AAAAA,IACAC,gBAAAA;AAAAA,EAAAA,CACD;AAED,SACEK,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IACEZ,WAAW,uHACTF,IAAS,YAAY,+BAA+B,IAClDE,CAAS;AAAA,IACb,sBAAoBE;AAAAA,IACpBW,SAASV;AAAAA,IACT,eAAaL,IAASgB,SAAY;AAAA,EAAA,GAElCH,gBAAAA,EAAAC,cAAA,OAAAG,EAAA;AAAA,IACEC,KAAKT;AAAAA,EAAAA,GACDC,GAAW;AAAA,IACfR,WAAW,mFAAmFC,CAAgB;AAAA,IAC9GgB,OAAO;AAAA,MAAElB,OAAAA;AAAAA,MAAOmB,UAAU;AAAA,MAAQC,WAAW;AAAA,MAAQC,WAAW;AAAA,IAAA;AAAA,EAAO,CAAE,GAExEvB,EAAAA,CACE,CACF;AAET;"}
1
+ {"version":3,"file":"index13.js","sources":["../src/components/CustomModal/index.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { useModalA11y } from 'src/utils/a11y';\n\nexport interface CustomModalProps {\n onSubmit?: () => void;\n onClose?: () => void;\n onModalClick?: () => void;\n renderModalContent: () => React.ReactNode;\n isOpen: boolean;\n width?: string;\n className?: string;\n contentClassName?: string;\n automationId?: string;\n /**\n * ID of a visible heading element rendered inside `renderModalContent`.\n * Add `id={ariaLabelledBy}` to that element to complete the association.\n */\n ariaLabelledBy?: string;\n /**\n * aria-label for modals without a visible title heading.\n * Ignored when `ariaLabelledBy` is provided.\n */\n ariaLabel?: string;\n}\n\n/**\n * Modal container with built-in focus trap, Escape dismissal, and dialog semantics.\n *\n * Labelling (pick one):\n * - `ariaLabelledBy` — ID of a heading rendered inside `renderModalContent`\n * - `ariaLabel` — for modals with no visible title\n *\n * Escape dismissal requires `onClose` to be passed.\n */\nexport const CustomModal: FC<CustomModalProps> = (props) => {\n const {\n renderModalContent,\n isOpen,\n width = '500px',\n className = '',\n contentClassName = '',\n automationId = '',\n onModalClick = () => {},\n onClose,\n ariaLabel,\n ariaLabelledBy,\n } = props;\n\n const { containerRef, dialogProps } = useModalA11y({\n isOpen,\n onDismiss: onClose,\n ariaLabel,\n ariaLabelledBy,\n });\n\n return (\n <div\n className={`se-design-modal fixed inset-0 flex items-start justify-center z-[2001] backdrop-brightness-50 backdrop-blur-sm ${\n isOpen ? 'visible' : 'invisible pointer-events-none'\n } ${className}`}\n data-automation-id={automationId}\n onClick={onModalClick}\n aria-hidden={isOpen ? undefined : true}\n >\n <div\n ref={containerRef}\n {...dialogProps}\n className={`modal-content flex flex-col gap-3 bg-[var(--color-white)] rounded shadow-lg p-8 mt-[48px] ${contentClassName}`}\n style={{ width, maxWidth: '100vw' }}\n >\n {renderModalContent()}\n </div>\n </div>\n );\n};\n"],"names":["CustomModal","props","renderModalContent","isOpen","width","className","contentClassName","automationId","onModalClick","onClose","ariaLabel","ariaLabelledBy","containerRef","dialogProps","useModalA11y","onDismiss","React","createElement","onClick","undefined","_extends","ref","style","maxWidth"],"mappings":";;;;;;;;;;;;AAkCO,MAAMA,IAAqCC,CAAAA,MAAU;AAC1D,QAAM;AAAA,IACJC,oBAAAA;AAAAA,IACAC,QAAAA;AAAAA,IACAC,OAAAA,IAAQ;AAAA,IACRC,WAAAA,IAAY;AAAA,IACZC,kBAAAA,IAAmB;AAAA,IACnBC,cAAAA,IAAe;AAAA,IACfC,cAAAA,IAAeA,MAAM;AAAA,IAAC;AAAA,IACtBC,SAAAA;AAAAA,IACAC,WAAAA;AAAAA,IACAC,gBAAAA;AAAAA,EAAAA,IACEV,GAEE;AAAA,IAAEW,cAAAA;AAAAA,IAAcC,aAAAA;AAAAA,EAAAA,IAAgBC,EAAa;AAAA,IACjDX,QAAAA;AAAAA,IACAY,WAAWN;AAAAA,IACXC,WAAAA;AAAAA,IACAC,gBAAAA;AAAAA,EAAAA,CACD;AAED,SACEK,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IACEZ,WAAW,kHACTF,IAAS,YAAY,+BAA+B,IAClDE,CAAS;AAAA,IACb,sBAAoBE;AAAAA,IACpBW,SAASV;AAAAA,IACT,eAAaL,IAASgB,SAAY;AAAA,EAAA,GAElCH,gBAAAA,EAAAC,cAAA,OAAAG,EAAA;AAAA,IACEC,KAAKT;AAAAA,EAAAA,GACDC,GAAW;AAAA,IACfR,WAAW,6FAA6FC,CAAgB;AAAA,IACxHgB,OAAO;AAAA,MAAElB,OAAAA;AAAAA,MAAOmB,UAAU;AAAA,IAAA;AAAA,EAAQ,CAAE,GAEnCrB,EAAAA,CACE,CACF;AAET;"}
package/dist/index19.js CHANGED
@@ -1,32 +1,32 @@
1
- import A, { forwardRef as le, useState as F, useRef as J, useEffect as H, useImperativeHandle as fe } from "react";
2
- import ue from "react-dom";
3
- import { getA11yNameAttributes as pe } from "./index78.js";
4
- import { useDismissOnFocusOut as de } from "./index77.js";
5
- import { getFirstFocusableElement as O, getLastFocusableElement as me, getFocusableElements as ve, FOCUSABLE_WITH_ROLES_SELECTOR as we } from "./index71.js";
1
+ import B, { forwardRef as lt, useState as O, useRef as G, useEffect as I, useImperativeHandle as ft } from "react";
2
+ import ut from "react-dom";
3
+ import { getA11yNameAttributes as pt } from "./index78.js";
4
+ import { useDismissOnFocusOut as dt } from "./index77.js";
5
+ import { getFirstFocusableElement as A, getLastFocusableElement as mt, getFocusableElements as vt, FOCUSABLE_WITH_ROLES_SELECTOR as wt } from "./index71.js";
6
6
  import "./index72.js";
7
- function B() {
8
- return B = Object.assign ? Object.assign.bind() : function(y) {
7
+ function N() {
8
+ return N = Object.assign ? Object.assign.bind() : function(y) {
9
9
  for (var E = 1; E < arguments.length; E++) {
10
10
  var d = arguments[E];
11
11
  for (var b in d) ({}).hasOwnProperty.call(d, b) && (y[b] = d[b]);
12
12
  }
13
13
  return y;
14
- }, B.apply(null, arguments);
14
+ }, N.apply(null, arguments);
15
15
  }
16
- const Pe = /* @__PURE__ */ le(({
16
+ const Pt = /* @__PURE__ */ lt(({
17
17
  className: y = "",
18
18
  automationId: E = "",
19
19
  position: d = "bottom-center",
20
20
  popoverContentAutomationId: b = "",
21
- contentWidth: I = "max",
22
- renderPopoverContents: N,
23
- renderPopoverSrcElement: Q,
24
- onPopoverToggle: T,
25
- isPopoverOpen: C,
21
+ contentWidth: H = "max",
22
+ renderPopoverContents: T,
23
+ renderPopoverSrcElement: J,
24
+ onPopoverToggle: C,
25
+ isPopoverOpen: z,
26
26
  disabled: k = !1,
27
27
  isWithPortal: f = !1,
28
- ariaLabel: Y,
29
- ariaLabelledBy: Z,
28
+ ariaLabel: Q,
29
+ ariaLabelledBy: Y,
30
30
  sourceRole: K = "button",
31
31
  popoverContentStyleProperty: _ = {
32
32
  zIndex: 1e3,
@@ -35,184 +35,187 @@ const Pe = /* @__PURE__ */ le(({
35
35
  backgroundColor: "var(--color-white)"
36
36
  },
37
37
  disableClickToggle: w = !1,
38
- noBorder: W = !1,
38
+ noBorder: Z = !1,
39
39
  disableAutoClose: m = !1,
40
- focusFirstOnOpen: ee = !1,
41
- ...te
42
- }, oe) => {
43
- const [i, u] = F(!1), [h, z] = F(d), [ne, U] = F(!1), l = J(null), a = J(null), re = pe({
44
- ariaLabel: Y,
45
- ariaLabelledBy: Z,
40
+ focusFirstOnOpen: tt = !1,
41
+ ...et
42
+ }, ot) => {
43
+ const [i, u] = O(!1), [h, $] = O(d), [nt, U] = O(!1), l = G(null), a = G(null), rt = pt({
44
+ ariaLabel: Q,
45
+ ariaLabelledBy: Y,
46
46
  ariaDescribedBy: void 0
47
47
  // Popover doesn't support describedBy yet
48
48
  }), {
49
- onBlurCapture: se
50
- } = de({
49
+ onBlurCapture: st
50
+ } = dt({
51
51
  disabled: !i || m || f,
52
52
  onFocusOut: () => u(!1),
53
53
  closeOnEscape: !1
54
- }), [$, P] = F({
54
+ }), [x, P] = O({
55
55
  top: 0,
56
- left: 0
57
- }), D = (e = "bottom-center") => {
56
+ left: 0,
57
+ srcWidth: 0
58
+ }), D = (t = "bottom-center") => {
58
59
  if (!l.current) return {
59
60
  top: 0,
60
- left: 0
61
+ left: 0,
62
+ srcWidth: 0
61
63
  };
62
- let o = e;
63
- const t = l.current.getBoundingClientRect(), s = window.innerWidth, c = window.innerHeight;
64
+ let o = t;
65
+ const e = l.current.getBoundingClientRect(), s = window.innerWidth, c = window.innerHeight;
64
66
  let n = 0, r = 0;
65
67
  switch (o) {
66
68
  case "bottom-left":
67
- n = t.bottom, r = t.left;
69
+ n = e.bottom, r = e.left;
68
70
  break;
69
71
  case "bottom-right":
70
- n = t.bottom, r = t.right - t.width * 0.5;
72
+ n = e.bottom, r = e.right - e.width * 0.5;
71
73
  break;
72
74
  case "bottom-center":
73
- n = t.bottom, r = t.left + t.width / 2;
75
+ n = e.bottom, r = e.left + e.width / 2;
74
76
  break;
75
77
  case "top-left":
76
- n = t.top - t.height * 1.9, r = t.left;
78
+ n = e.top - e.height * 1.9, r = e.left;
77
79
  break;
78
80
  case "top-right":
79
- n = t.top - t.height * 1.9, r = t.right - t.width * 0.5;
81
+ n = e.top - e.height * 1.9, r = e.right - e.width * 0.5;
80
82
  break;
81
83
  case "top-center":
82
- n = t.top - t.height * 1.9, r = t.left + t.width / 2;
84
+ n = e.top - e.height * 1.9, r = e.left + e.width / 2;
83
85
  break;
84
86
  default:
85
- n = t.bottom, r = t.left;
87
+ n = e.bottom, r = e.left;
86
88
  break;
87
89
  }
88
90
  const p = a.current?.getBoundingClientRect(), g = p?.width || 0, v = p?.height || 0;
89
91
  if ((o === "bottom-center" || o === "top-center") && (r = r - g / 2), r + g > s && (r = Math.max(0, s - g)), r < 0 && (r = 0), n + v > c) {
90
- const R = t.top, ae = c - t.bottom;
91
- R >= v || R > ae ? (n = t.top - v, n < 0 && (n = 0)) : n = Math.max(0, c - v);
92
+ const R = e.top, at = c - e.bottom;
93
+ R >= v || R > at ? (n = e.top - v, n < 0 && (n = 0)) : n = Math.max(0, c - v);
92
94
  }
93
- return n < 0 && (n = t.bottom, n + v > c && (n = Math.max(0, c - v))), {
95
+ return n < 0 && (n = e.bottom, n + v > c && (n = Math.max(0, c - v))), {
94
96
  top: n,
95
- left: r
97
+ left: r,
98
+ srcWidth: e.width
96
99
  };
97
100
  };
98
- H(() => {
99
- if (T && T(i), i && !f)
100
- return m || document.body.addEventListener("click", M, !0), ie(), () => {
101
+ I(() => {
102
+ if (C && C(i), i && !f)
103
+ return m || document.body.addEventListener("click", M, !0), it(), () => {
101
104
  m || document.body.removeEventListener("click", M, !0);
102
105
  };
103
106
  if (i && f) {
104
- m ? window.addEventListener("scroll", X) : (document.body.addEventListener("click", L, !0), window.addEventListener("scroll", L)), window.addEventListener("resize", V);
105
- const e = setTimeout(() => {
106
- const t = D(h);
107
- x(), t && P(t);
107
+ m ? window.addEventListener("scroll", X) : (document.body.addEventListener("click", S, !0), window.addEventListener("scroll", S)), window.addEventListener("resize", V);
108
+ const t = setTimeout(() => {
109
+ const e = D(h);
110
+ L(), e && P(e);
108
111
  }, 0), o = setTimeout(() => {
109
- const t = D(h);
110
- t && P(t);
112
+ const e = D(h);
113
+ e && P(e);
111
114
  }, 10);
112
115
  return () => {
113
- m ? window.removeEventListener("scroll", X) : (document.body.removeEventListener("click", L, !0), window.removeEventListener("scroll", L)), window.removeEventListener("resize", V), clearTimeout(e), clearTimeout(o);
116
+ m ? window.removeEventListener("scroll", X) : (document.body.removeEventListener("click", S, !0), window.removeEventListener("scroll", S)), window.removeEventListener("resize", V), clearTimeout(t), clearTimeout(o);
114
117
  };
115
118
  }
116
119
  }, [i, f, m]);
117
- const x = () => {
120
+ const L = () => {
118
121
  if (!l.current) {
119
122
  U(!1);
120
123
  return;
121
124
  }
122
- const e = l.current.getBoundingClientRect(), o = window.innerHeight, t = window.innerWidth, s = e.top < o && e.bottom > 0 && e.left < t && e.right > 0;
125
+ const t = l.current.getBoundingClientRect(), o = window.innerHeight, e = window.innerWidth, s = t.top < o && t.bottom > 0 && t.left < e && t.right > 0;
123
126
  U(s);
124
127
  };
125
- H(() => {
126
- u(C ?? !1);
127
- }, [C]), H(() => {
128
+ I(() => {
129
+ u(z ?? !1);
130
+ }, [z]), I(() => {
128
131
  i && setTimeout(() => {
129
- const e = O({
132
+ const t = A({
130
133
  container: a.current,
131
134
  includeRoles: !0
132
135
  });
133
- e && (ee || document.activeElement === l.current) && e.focus();
136
+ t && (tt || document.activeElement === l.current) && t.focus();
134
137
  }, f ? 60 : 0);
135
138
  }, [i]);
136
- const ie = () => {
139
+ const it = () => {
137
140
  if (!a.current) return;
138
- const e = a.current.getBoundingClientRect(), o = window.innerHeight;
139
- e?.bottom > o ? z(d.includes("left") ? "top-left" : d.includes("right") ? "top-right" : "top-center") : e?.top < 0 && z(d.includes("left") ? "bottom-left" : d.includes("right") ? "bottom-right" : "bottom-center");
140
- }, M = (e) => {
141
+ const t = a.current.getBoundingClientRect(), o = window.innerHeight;
142
+ t?.bottom > o ? $(d.includes("left") ? "top-left" : d.includes("right") ? "top-right" : "top-center") : t?.top < 0 && $(d.includes("left") ? "bottom-left" : d.includes("right") ? "bottom-right" : "bottom-center");
143
+ }, M = (t) => {
141
144
  const o = l.current;
142
145
  if (!o) return;
143
- const t = e.target, s = o.contains(t), c = a.current?.contains(t), r = t.closest?.(".se-design-popover-wrapper"), p = r && r !== o, g = a.current?.contains(r);
146
+ const e = t.target, s = o.contains(e), c = a.current?.contains(e), r = e.closest?.(".se-design-popover-wrapper"), p = r && r !== o, g = a.current?.contains(r);
144
147
  m || (!s && !c || p && !g) && u(!1);
145
- }, L = (e) => {
146
- const o = l.current, t = a.current;
148
+ }, S = (t) => {
149
+ const o = l.current, e = a.current;
147
150
  if (!o) return;
148
- if (x(), e.type === "scroll" && i) {
151
+ if (L(), t.type === "scroll" && i) {
149
152
  const R = D(h);
150
153
  R && P(R);
151
154
  }
152
- const s = e.target, c = o.contains(s), n = t?.contains(s), p = s.closest?.(".se-design-popover-wrapper"), g = p && p !== o, v = a.current?.contains(p);
155
+ const s = t.target, c = o.contains(s), n = e?.contains(s), p = s.closest?.(".se-design-popover-wrapper"), g = p && p !== o, v = a.current?.contains(p);
153
156
  m || (!c && !n || g && !v) && u(!1);
154
157
  }, V = () => {
155
158
  if (i && f && l.current) {
156
- x();
157
- const e = D(h);
158
- e && P(e);
159
+ L();
160
+ const t = D(h);
161
+ t && P(t);
159
162
  }
160
163
  }, X = () => {
161
164
  if (i && f && l.current) {
162
- x();
163
- const e = D(h);
164
- e && P(e);
165
+ L();
166
+ const t = D(h);
167
+ t && P(t);
165
168
  }
166
- }, S = (e = !1) => {
169
+ }, F = (t = !1) => {
167
170
  const o = i;
168
- u((t) => !t), !o && e && setTimeout(() => {
169
- if (e === "last") {
170
- const t = me({
171
+ u((e) => !e), !o && t && setTimeout(() => {
172
+ if (t === "last") {
173
+ const e = mt({
171
174
  container: a.current,
172
175
  includeRoles: !0
173
176
  });
174
- t && t.focus();
177
+ e && e.focus();
175
178
  } else {
176
- const t = O({
179
+ const e = A({
177
180
  container: a.current,
178
181
  includeRoles: !0
179
182
  });
180
- t && t.focus();
183
+ e && e.focus();
181
184
  }
182
185
  }, 50);
183
- }, j = (e, o) => {
186
+ }, j = (t, o) => {
184
187
  if (!o) return;
185
- const t = document.activeElement;
186
- if (t?.tagName === "INPUT" || t?.tagName === "TEXTAREA" || t?.tagName === "SELECT")
188
+ const e = document.activeElement;
189
+ if (e?.tagName === "INPUT" || e?.tagName === "TEXTAREA" || e?.tagName === "SELECT")
187
190
  return;
188
- const s = Array.from(o.querySelectorAll(we)).filter((r) => {
191
+ const s = Array.from(o.querySelectorAll(wt)).filter((r) => {
189
192
  const p = window.getComputedStyle(r);
190
193
  return !r.hasAttribute("disabled") && r.getAttribute("aria-disabled") !== "true" && p.display !== "none" && p.visibility !== "hidden" && (r.tabIndex >= 0 || r.hasAttribute("role"));
191
194
  });
192
195
  if (s.length === 0) return;
193
196
  const c = s.findIndex((r) => r === document.activeElement);
194
197
  let n = -1;
195
- e.key === "ArrowDown" ? (e.preventDefault(), e.stopPropagation(), n = c < s.length - 1 ? c + 1 : 0) : e.key === "ArrowUp" ? (e.preventDefault(), e.stopPropagation(), n = c > 0 ? c - 1 : s.length - 1) : e.key === "Home" ? (e.preventDefault(), e.stopPropagation(), n = 0) : e.key === "End" && (e.preventDefault(), e.stopPropagation(), n = s.length - 1), n >= 0 && s[n] ? s[n].focus() : c === -1 && s.length > 0 && s[0].focus();
196
- }, q = (e) => {
197
- if (e.key === "Escape")
198
- e.preventDefault(), e.stopPropagation(), u(!1), l.current?.focus();
199
- else if (e.key === "Tab") {
200
- if (u(!1), e.shiftKey)
201
- e.preventDefault(), l.current?.focus();
198
+ t.key === "ArrowDown" ? (t.preventDefault(), t.stopPropagation(), n = c < s.length - 1 ? c + 1 : 0) : t.key === "ArrowUp" ? (t.preventDefault(), t.stopPropagation(), n = c > 0 ? c - 1 : s.length - 1) : t.key === "Home" ? (t.preventDefault(), t.stopPropagation(), n = 0) : t.key === "End" && (t.preventDefault(), t.stopPropagation(), n = s.length - 1), n >= 0 && s[n] ? s[n].focus() : c === -1 && s.length > 0 && s[0].focus();
199
+ }, W = (t) => {
200
+ if (t.key === "Escape")
201
+ t.preventDefault(), t.stopPropagation(), u(!1), l.current?.focus();
202
+ else if (t.key === "Tab") {
203
+ if (u(!1), t.shiftKey)
204
+ t.preventDefault(), l.current?.focus();
202
205
  else if (f) {
203
- e.preventDefault();
204
- const o = l.current, t = ve({
206
+ t.preventDefault();
207
+ const o = l.current, e = vt({
205
208
  container: document.body,
206
209
  filterHidden: !0
207
- }), s = o ? t.indexOf(o) : -1, c = t[s + 1];
210
+ }), s = o ? e.indexOf(o) : -1, c = e[s + 1];
208
211
  c ? c.focus() : o?.focus();
209
212
  }
210
- } else e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Home" || e.key === "End" ? j(e, a.current) : (e.key === "Enter" || e.key === " ") && e.stopPropagation();
213
+ } else t.key === "ArrowDown" || t.key === "ArrowUp" || t.key === "Home" || t.key === "End" ? j(t, a.current) : (t.key === "Enter" || t.key === " ") && t.stopPropagation();
211
214
  };
212
- fe(oe, () => ({
213
- togglePopover: S
215
+ ft(ot, () => ({
216
+ togglePopover: F
214
217
  }), []);
215
- const ce = {
218
+ const ct = {
216
219
  "bottom-left": {
217
220
  left: "0",
218
221
  top: "100%"
@@ -239,83 +242,86 @@ const Pe = /* @__PURE__ */ le(({
239
242
  transform: "translateX(-50%)",
240
243
  bottom: "100%"
241
244
  }
242
- }, G = W ? "" : "shadow-md border rounded-md";
243
- return /* @__PURE__ */ A.createElement("div", B({
245
+ }, q = Z ? "" : "shadow-md border rounded-md";
246
+ return /* @__PURE__ */ B.createElement("div", N({
244
247
  className: "se-design-popover-wrapper cursor-pointer relative focus-outline rounded-md" + (y.length > 0 ? ` ${y}` : "") + (i ? " open" : "") + (k ? " opacity-50 cursor-not-allowed pointer-events-none" : ""),
245
248
  ref: l,
246
- onClick: (e) => {
247
- k || w || (e.stopPropagation(), S());
249
+ onClick: (t) => {
250
+ k || w || (t.stopPropagation(), F());
248
251
  },
249
- onKeyDown: (e) => {
252
+ onKeyDown: (t) => {
250
253
  if (!(k || w))
251
- if (e.key === "Enter" || e.key === " ") {
252
- e.preventDefault(), e.stopPropagation();
254
+ if (t.key === "Enter" || t.key === " ") {
255
+ t.preventDefault(), t.stopPropagation();
253
256
  const o = i;
254
- S(), o || setTimeout(() => {
255
- const t = O({
257
+ F(), o || setTimeout(() => {
258
+ const e = A({
256
259
  container: a.current,
257
260
  includeRoles: !0
258
261
  });
259
- t && t.focus();
262
+ e && e.focus();
260
263
  }, f ? 60 : 0);
261
- } else if (e.key === "Escape" && i)
262
- e.preventDefault(), e.stopPropagation(), u(!1);
263
- else if ((e.key === "ArrowDown" || e.key === "ArrowUp") && i) {
264
+ } else if (t.key === "Escape" && i)
265
+ t.preventDefault(), t.stopPropagation(), u(!1);
266
+ else if ((t.key === "ArrowDown" || t.key === "ArrowUp") && i) {
264
267
  const o = a.current;
265
- o && j(e, o);
266
- } else e.key === "ArrowDown" && !i && (e.preventDefault(), e.stopPropagation(), u(!0), setTimeout(() => {
267
- const o = O({
268
+ o && j(t, o);
269
+ } else t.key === "ArrowDown" && !i && (t.preventDefault(), t.stopPropagation(), u(!0), setTimeout(() => {
270
+ const o = A({
268
271
  container: a.current,
269
272
  includeRoles: !0
270
273
  });
271
274
  o && o.focus();
272
275
  }, 0));
273
276
  },
274
- onBlurCapture: se,
275
- onBlur: (e) => {
277
+ onBlurCapture: st,
278
+ onBlur: (t) => {
276
279
  if (!i || m || !f) return;
277
- const o = e.relatedTarget, t = !!(o && l.current?.contains(o)), s = !!(o && a.current?.contains(o));
278
- !t && !s && u(!1);
280
+ const o = t.relatedTarget, e = !!(o && l.current?.contains(o)), s = !!(o && a.current?.contains(o));
281
+ !e && !s && u(!1);
279
282
  },
280
283
  role: w ? "none" : K,
281
284
  "aria-expanded": w ? void 0 : i ? "true" : "false",
282
285
  "aria-haspopup": w ? void 0 : K === "combobox" ? "listbox" : "true",
283
286
  tabIndex: k || w ? -1 : 0,
284
287
  "aria-disabled": w ? void 0 : k ? "true" : "false"
285
- }, re, {
288
+ }, rt, {
286
289
  "data-automation-id": E
287
- }, te), Q({
290
+ }, et), J({
288
291
  displayPopover: i,
289
- togglePopover: S
290
- }), i && !f && /* @__PURE__ */ A.createElement("div", {
291
- className: `popover-content absolute ${G} z-[1000] ${I == "full" ? "w-full" : "w-max"}`,
292
+ togglePopover: F
293
+ }), i && !f && /* @__PURE__ */ B.createElement("div", {
294
+ className: `popover-content absolute ${q} z-[1000] ${H == "full" ? "w-full" : "w-max"}`,
292
295
  style: {
293
296
  ..._,
294
- ...ce[h]
297
+ ...ct[h]
295
298
  },
296
- onClick: (e) => e.stopPropagation(),
297
- onKeyDown: q,
299
+ onClick: (t) => t.stopPropagation(),
300
+ onKeyDown: W,
298
301
  ref: a,
299
302
  "data-automation-id": b
300
- }, N({
303
+ }, T({
301
304
  closePopoverCb: () => u(!1)
302
- })), f && i && ne && /* @__PURE__ */ ue.createPortal(/* @__PURE__ */ A.createElement("div", {
303
- className: `popover-content-with-portal ${G} ${I == "full" ? "w-full" : "w-max"}`,
305
+ })), f && i && nt && /* @__PURE__ */ ut.createPortal(/* @__PURE__ */ B.createElement("div", {
306
+ className: `popover-content-with-portal z-[2002] ${q} ${H == "full" ? "" : "w-max"}`,
304
307
  style: {
305
308
  position: "fixed",
306
- top: $.top,
307
- left: $.left,
309
+ top: x.top,
310
+ left: x.left,
311
+ ...H === "full" && x.srcWidth ? {
312
+ width: `${x.srcWidth}px`
313
+ } : {},
308
314
  ..._
309
315
  },
310
- onClick: (e) => e.stopPropagation(),
311
- onKeyDown: q,
316
+ onClick: (t) => t.stopPropagation(),
317
+ onKeyDown: W,
312
318
  ref: a,
313
319
  "data-automation-id": b
314
- }, N({
320
+ }, T({
315
321
  closePopoverCb: () => u(!1)
316
322
  })), document.body));
317
323
  });
318
324
  export {
319
- Pe as Popover
325
+ Pt as Popover
320
326
  };
321
327
  //# sourceMappingURL=index19.js.map