se-design 1.0.76-dev1 → 1.0.76-dev2
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/assets/style.css +1 -1
- package/dist/components/Dropdown/index.d.ts +2 -0
- package/dist/components/DropdownWithInputTags/index.d.ts +1 -0
- package/dist/index12.js +11 -13
- package/dist/index12.js.map +1 -1
- package/dist/index13.js +12 -14
- package/dist/index13.js.map +1 -1
- package/dist/index19.js +142 -136
- package/dist/index19.js.map +1 -1
- package/dist/index25.js +78 -68
- package/dist/index25.js.map +1 -1
- package/dist/index38.js +61 -59
- package/dist/index38.js.map +1 -1
- package/package.json +1 -1
package/dist/index13.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import s from "react";
|
|
2
2
|
import "./index72.js";
|
|
3
|
-
import { useModalA11y as
|
|
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
|
|
13
|
+
const h = (n) => {
|
|
14
14
|
const {
|
|
15
15
|
renderModalContent: a,
|
|
16
16
|
isOpen: e,
|
|
17
17
|
width: t = "500px",
|
|
18
|
-
className:
|
|
19
|
-
contentClassName:
|
|
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
|
-
} =
|
|
29
|
+
} = b({
|
|
30
30
|
isOpen: e,
|
|
31
31
|
onDismiss: c,
|
|
32
32
|
ariaLabel: m,
|
|
33
33
|
ariaLabelledBy: u
|
|
34
34
|
});
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
className: `se-design-modal fixed inset-0 flex items-
|
|
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__ */
|
|
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 ${
|
|
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: "
|
|
47
|
-
maxHeight: "90vh",
|
|
48
|
-
overflowY: "auto"
|
|
46
|
+
maxWidth: "100vw"
|
|
49
47
|
}
|
|
50
48
|
}), a()));
|
|
51
49
|
};
|
|
52
50
|
export {
|
|
53
|
-
|
|
51
|
+
h as CustomModal
|
|
54
52
|
};
|
|
55
53
|
//# sourceMappingURL=index13.js.map
|
package/dist/index13.js.map
CHANGED
|
@@ -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-
|
|
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
|
|
2
|
-
import
|
|
3
|
-
import { getA11yNameAttributes as
|
|
4
|
-
import { useDismissOnFocusOut as
|
|
5
|
-
import { getFirstFocusableElement as
|
|
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
|
|
8
|
-
return
|
|
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
|
-
},
|
|
14
|
+
}, N.apply(null, arguments);
|
|
15
15
|
}
|
|
16
|
-
const
|
|
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:
|
|
22
|
-
renderPopoverContents:
|
|
23
|
-
renderPopoverSrcElement:
|
|
24
|
-
onPopoverToggle:
|
|
25
|
-
isPopoverOpen:
|
|
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:
|
|
29
|
-
ariaLabelledBy:
|
|
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:
|
|
38
|
+
noBorder: Z = !1,
|
|
39
39
|
disableAutoClose: m = !1,
|
|
40
|
-
focusFirstOnOpen:
|
|
41
|
-
...
|
|
42
|
-
},
|
|
43
|
-
const [i, u] =
|
|
44
|
-
ariaLabel:
|
|
45
|
-
ariaLabelledBy:
|
|
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:
|
|
50
|
-
} =
|
|
49
|
+
onBlurCapture: st
|
|
50
|
+
} = dt({
|
|
51
51
|
disabled: !i || m || f,
|
|
52
52
|
onFocusOut: () => u(!1),
|
|
53
53
|
closeOnEscape: !1
|
|
54
|
-
}), [
|
|
54
|
+
}), [x, P] = O({
|
|
55
55
|
top: 0,
|
|
56
|
-
left: 0
|
|
57
|
-
|
|
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 =
|
|
63
|
-
const
|
|
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 =
|
|
69
|
+
n = e.bottom, r = e.left;
|
|
68
70
|
break;
|
|
69
71
|
case "bottom-right":
|
|
70
|
-
n =
|
|
72
|
+
n = e.bottom, r = e.right - e.width * 0.5;
|
|
71
73
|
break;
|
|
72
74
|
case "bottom-center":
|
|
73
|
-
n =
|
|
75
|
+
n = e.bottom, r = e.left + e.width / 2;
|
|
74
76
|
break;
|
|
75
77
|
case "top-left":
|
|
76
|
-
n =
|
|
78
|
+
n = e.top - e.height * 1.9, r = e.left;
|
|
77
79
|
break;
|
|
78
80
|
case "top-right":
|
|
79
|
-
n =
|
|
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 =
|
|
84
|
+
n = e.top - e.height * 1.9, r = e.left + e.width / 2;
|
|
83
85
|
break;
|
|
84
86
|
default:
|
|
85
|
-
n =
|
|
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 =
|
|
91
|
-
R >= v || R >
|
|
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 =
|
|
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
|
-
|
|
99
|
-
if (
|
|
100
|
-
return m || document.body.addEventListener("click", M, !0),
|
|
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",
|
|
105
|
-
const
|
|
106
|
-
const
|
|
107
|
-
|
|
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
|
|
110
|
-
|
|
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",
|
|
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
|
|
120
|
+
const L = () => {
|
|
118
121
|
if (!l.current) {
|
|
119
122
|
U(!1);
|
|
120
123
|
return;
|
|
121
124
|
}
|
|
122
|
-
const
|
|
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
|
-
|
|
126
|
-
u(
|
|
127
|
-
}, [
|
|
128
|
+
I(() => {
|
|
129
|
+
u(z ?? !1);
|
|
130
|
+
}, [z]), I(() => {
|
|
128
131
|
i && setTimeout(() => {
|
|
129
|
-
const
|
|
132
|
+
const t = A({
|
|
130
133
|
container: a.current,
|
|
131
134
|
includeRoles: !0
|
|
132
135
|
});
|
|
133
|
-
|
|
136
|
+
t && (tt || document.activeElement === l.current) && t.focus();
|
|
134
137
|
}, f ? 60 : 0);
|
|
135
138
|
}, [i]);
|
|
136
|
-
const
|
|
139
|
+
const it = () => {
|
|
137
140
|
if (!a.current) return;
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
}, M = (
|
|
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
|
|
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
|
-
},
|
|
146
|
-
const o = l.current,
|
|
148
|
+
}, S = (t) => {
|
|
149
|
+
const o = l.current, e = a.current;
|
|
147
150
|
if (!o) return;
|
|
148
|
-
if (
|
|
151
|
+
if (L(), t.type === "scroll" && i) {
|
|
149
152
|
const R = D(h);
|
|
150
153
|
R && P(R);
|
|
151
154
|
}
|
|
152
|
-
const s =
|
|
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
|
-
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
+
L();
|
|
160
|
+
const t = D(h);
|
|
161
|
+
t && P(t);
|
|
159
162
|
}
|
|
160
163
|
}, X = () => {
|
|
161
164
|
if (i && f && l.current) {
|
|
162
|
-
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
+
L();
|
|
166
|
+
const t = D(h);
|
|
167
|
+
t && P(t);
|
|
165
168
|
}
|
|
166
|
-
},
|
|
169
|
+
}, F = (t = !1) => {
|
|
167
170
|
const o = i;
|
|
168
|
-
u((
|
|
169
|
-
if (
|
|
170
|
-
const
|
|
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
|
-
|
|
177
|
+
e && e.focus();
|
|
175
178
|
} else {
|
|
176
|
-
const
|
|
179
|
+
const e = A({
|
|
177
180
|
container: a.current,
|
|
178
181
|
includeRoles: !0
|
|
179
182
|
});
|
|
180
|
-
|
|
183
|
+
e && e.focus();
|
|
181
184
|
}
|
|
182
185
|
}, 50);
|
|
183
|
-
}, j = (
|
|
186
|
+
}, j = (t, o) => {
|
|
184
187
|
if (!o) return;
|
|
185
|
-
const
|
|
186
|
-
if (
|
|
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(
|
|
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
|
-
|
|
196
|
-
},
|
|
197
|
-
if (
|
|
198
|
-
|
|
199
|
-
else if (
|
|
200
|
-
if (u(!1),
|
|
201
|
-
|
|
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
|
-
|
|
204
|
-
const o = l.current,
|
|
206
|
+
t.preventDefault();
|
|
207
|
+
const o = l.current, e = vt({
|
|
205
208
|
container: document.body,
|
|
206
209
|
filterHidden: !0
|
|
207
|
-
}), s = o ?
|
|
210
|
+
}), s = o ? e.indexOf(o) : -1, c = e[s + 1];
|
|
208
211
|
c ? c.focus() : o?.focus();
|
|
209
212
|
}
|
|
210
|
-
} else
|
|
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
|
-
|
|
213
|
-
togglePopover:
|
|
215
|
+
ft(ot, () => ({
|
|
216
|
+
togglePopover: F
|
|
214
217
|
}), []);
|
|
215
|
-
const
|
|
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
|
-
},
|
|
243
|
-
return /* @__PURE__ */
|
|
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: (
|
|
247
|
-
k || w || (
|
|
249
|
+
onClick: (t) => {
|
|
250
|
+
k || w || (t.stopPropagation(), F());
|
|
248
251
|
},
|
|
249
|
-
onKeyDown: (
|
|
252
|
+
onKeyDown: (t) => {
|
|
250
253
|
if (!(k || w))
|
|
251
|
-
if (
|
|
252
|
-
|
|
254
|
+
if (t.key === "Enter" || t.key === " ") {
|
|
255
|
+
t.preventDefault(), t.stopPropagation();
|
|
253
256
|
const o = i;
|
|
254
|
-
|
|
255
|
-
const
|
|
257
|
+
F(), o || setTimeout(() => {
|
|
258
|
+
const e = A({
|
|
256
259
|
container: a.current,
|
|
257
260
|
includeRoles: !0
|
|
258
261
|
});
|
|
259
|
-
|
|
262
|
+
e && e.focus();
|
|
260
263
|
}, f ? 60 : 0);
|
|
261
|
-
} else if (
|
|
262
|
-
|
|
263
|
-
else if ((
|
|
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(
|
|
266
|
-
} else
|
|
267
|
-
const 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:
|
|
275
|
-
onBlur: (
|
|
277
|
+
onBlurCapture: st,
|
|
278
|
+
onBlur: (t) => {
|
|
276
279
|
if (!i || m || !f) return;
|
|
277
|
-
const o =
|
|
278
|
-
!
|
|
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
|
-
},
|
|
288
|
+
}, rt, {
|
|
286
289
|
"data-automation-id": E
|
|
287
|
-
},
|
|
290
|
+
}, et), J({
|
|
288
291
|
displayPopover: i,
|
|
289
|
-
togglePopover:
|
|
290
|
-
}), i && !f && /* @__PURE__ */
|
|
291
|
-
className: `popover-content absolute ${
|
|
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
|
-
...
|
|
297
|
+
...ct[h]
|
|
295
298
|
},
|
|
296
|
-
onClick: (
|
|
297
|
-
onKeyDown:
|
|
299
|
+
onClick: (t) => t.stopPropagation(),
|
|
300
|
+
onKeyDown: W,
|
|
298
301
|
ref: a,
|
|
299
302
|
"data-automation-id": b
|
|
300
|
-
},
|
|
303
|
+
}, T({
|
|
301
304
|
closePopoverCb: () => u(!1)
|
|
302
|
-
})), f && i &&
|
|
303
|
-
className: `popover-content-with-portal ${
|
|
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:
|
|
307
|
-
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: (
|
|
311
|
-
onKeyDown:
|
|
316
|
+
onClick: (t) => t.stopPropagation(),
|
|
317
|
+
onKeyDown: W,
|
|
312
318
|
ref: a,
|
|
313
319
|
"data-automation-id": b
|
|
314
|
-
},
|
|
320
|
+
}, T({
|
|
315
321
|
closePopoverCb: () => u(!1)
|
|
316
322
|
})), document.body));
|
|
317
323
|
});
|
|
318
324
|
export {
|
|
319
|
-
|
|
325
|
+
Pt as Popover
|
|
320
326
|
};
|
|
321
327
|
//# sourceMappingURL=index19.js.map
|