@m4l/components 9.22.0 → 9.22.1
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/extended/mui/Popover/Popover.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,SAAS,CAAC;AA8MjB;;GAEG;AACH,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/extended/mui/Popover/Popover.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,SAAS,CAAC;AA8MjB;;GAEG;AACH,eAAO,MAAM,OAAO,sHAqRnB,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Paper as
|
|
3
|
-
import { useForkRef as
|
|
4
|
-
import
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import { forwardRef as
|
|
7
|
-
import { getPropDataTestId as
|
|
8
|
-
import { POPOVER_CLASS_NAME_SPECIFY as
|
|
9
|
-
import { PopoverRootStyled as
|
|
10
|
-
import { PopoverSlots as
|
|
11
|
-
const
|
|
1
|
+
import { jsx as W } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { Paper as re } from "@mui/material";
|
|
3
|
+
import { useForkRef as ie } from "@mui/material/utils";
|
|
4
|
+
import $ from "clsx";
|
|
5
|
+
import { createPortal as se } from "react-dom";
|
|
6
|
+
import { forwardRef as ce, useRef as j, useState as ae, useLayoutEffect as le, useEffect as U } from "react";
|
|
7
|
+
import { getPropDataTestId as fe } from "../../../../test/getNameDataTestId.js";
|
|
8
|
+
import { POPOVER_CLASS_NAME_SPECIFY as pe, POPOVER_PREFIX as ue } from "./constants.js";
|
|
9
|
+
import { PopoverRootStyled as de } from "./slots/PopoverSlots.js";
|
|
10
|
+
import { PopoverSlots as me } from "./slots/PopoverEnum.js";
|
|
11
|
+
const X = {
|
|
12
12
|
left: "0px",
|
|
13
13
|
top: "0px",
|
|
14
14
|
transformOrigin: "top left",
|
|
@@ -24,16 +24,16 @@ function k(t) {
|
|
|
24
24
|
function F(t, e) {
|
|
25
25
|
return typeof document > "u" ? null : t ? typeof t == "function" ? t() : t ?? null : k(e)?.ownerDocument.body ?? document.body;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function Y(t, e) {
|
|
28
28
|
return typeof e == "number" ? e : e === "center" ? t.height / 2 : e === "bottom" ? t.height : 0;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function q(t, e) {
|
|
31
31
|
return typeof e == "number" ? e : e === "center" ? t.width / 2 : e === "right" ? t.width : 0;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function G(t) {
|
|
34
34
|
return [t.horizontal, t.vertical].map((e) => typeof e == "number" ? `${e}px` : e).join(" ");
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function he(t) {
|
|
37
37
|
const {
|
|
38
38
|
anchorEl: e,
|
|
39
39
|
anchorOrigin: y,
|
|
@@ -45,15 +45,15 @@ function me(t) {
|
|
|
45
45
|
} = t, g = {
|
|
46
46
|
height: P.offsetHeight,
|
|
47
47
|
width: P.offsetWidth
|
|
48
|
-
},
|
|
49
|
-
horizontal:
|
|
50
|
-
vertical:
|
|
48
|
+
}, c = {
|
|
49
|
+
horizontal: q(g, b.horizontal),
|
|
50
|
+
vertical: Y(g, b.vertical)
|
|
51
51
|
};
|
|
52
52
|
if (r === "none")
|
|
53
53
|
return {
|
|
54
54
|
left: "0px",
|
|
55
55
|
top: "0px",
|
|
56
|
-
transformOrigin:
|
|
56
|
+
transformOrigin: G(c),
|
|
57
57
|
visibility: "visible"
|
|
58
58
|
};
|
|
59
59
|
const R = k(e), E = r === "anchorPosition" ? {
|
|
@@ -69,33 +69,33 @@ function me(t) {
|
|
|
69
69
|
top: 0,
|
|
70
70
|
width: 0
|
|
71
71
|
}, T = {
|
|
72
|
-
left: E.left +
|
|
73
|
-
top: E.top +
|
|
72
|
+
left: E.left + q(E, y.horizontal),
|
|
73
|
+
top: E.top + Y(E, y.vertical)
|
|
74
74
|
};
|
|
75
|
-
let m = T.top -
|
|
76
|
-
const D = m + g.height, L = h + g.width, p = R?.ownerDocument.defaultView ?? window,
|
|
75
|
+
let m = T.top - c.vertical, h = T.left - c.horizontal;
|
|
76
|
+
const D = m + g.height, L = h + g.width, p = R?.ownerDocument.defaultView ?? window, A = p.innerHeight - (n ?? 0), S = p.innerWidth - (n ?? 0);
|
|
77
77
|
if (n !== null && m < n) {
|
|
78
78
|
const i = m - n;
|
|
79
|
-
m -= i,
|
|
80
|
-
} else if (n !== null && D >
|
|
81
|
-
const i = D -
|
|
82
|
-
m -= i,
|
|
79
|
+
m -= i, c.vertical += i;
|
|
80
|
+
} else if (n !== null && D > A) {
|
|
81
|
+
const i = D - A;
|
|
82
|
+
m -= i, c.vertical += i;
|
|
83
83
|
}
|
|
84
84
|
if (n !== null && h < n) {
|
|
85
85
|
const i = h - n;
|
|
86
|
-
h -= i,
|
|
87
|
-
} else if (n !== null && L >
|
|
88
|
-
const i = L -
|
|
89
|
-
h -= i,
|
|
86
|
+
h -= i, c.horizontal += i;
|
|
87
|
+
} else if (n !== null && L > S) {
|
|
88
|
+
const i = L - S;
|
|
89
|
+
h -= i, c.horizontal += i;
|
|
90
90
|
}
|
|
91
91
|
return {
|
|
92
92
|
left: `${Math.round(h)}px`,
|
|
93
93
|
top: `${Math.round(m)}px`,
|
|
94
|
-
transformOrigin:
|
|
94
|
+
transformOrigin: G(c),
|
|
95
95
|
visibility: "visible"
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
|
-
const Ne =
|
|
98
|
+
const Ne = ce(
|
|
99
99
|
function(e, y) {
|
|
100
100
|
const {
|
|
101
101
|
action: w,
|
|
@@ -104,7 +104,7 @@ const Ne = se(
|
|
|
104
104
|
anchorPosition: P,
|
|
105
105
|
anchorReference: b = "anchorEl",
|
|
106
106
|
arrowType: g = "no-arrow",
|
|
107
|
-
BackdropComponent:
|
|
107
|
+
BackdropComponent: c,
|
|
108
108
|
BackdropProps: R,
|
|
109
109
|
children: E,
|
|
110
110
|
className: T,
|
|
@@ -113,63 +113,63 @@ const Ne = se(
|
|
|
113
113
|
components: D,
|
|
114
114
|
componentsProps: L,
|
|
115
115
|
container: p,
|
|
116
|
-
disableAutoFocus:
|
|
117
|
-
disableEnforceFocus:
|
|
116
|
+
disableAutoFocus: A,
|
|
117
|
+
disableEnforceFocus: S,
|
|
118
118
|
disableEscapeKeyDown: i,
|
|
119
|
-
disablePortal:
|
|
119
|
+
disablePortal: ve,
|
|
120
120
|
disableRestoreFocus: M = !1,
|
|
121
|
-
disableScrollLock:
|
|
122
|
-
elevation:
|
|
123
|
-
hideBackdrop:
|
|
124
|
-
instaceDataTestId:
|
|
125
|
-
keepMounted:
|
|
121
|
+
disableScrollLock: Ee,
|
|
122
|
+
elevation: J = 8,
|
|
123
|
+
hideBackdrop: we,
|
|
124
|
+
instaceDataTestId: Q,
|
|
125
|
+
keepMounted: Pe,
|
|
126
126
|
marginThreshold: B = 16,
|
|
127
|
-
onBackdropClick:
|
|
127
|
+
onBackdropClick: be,
|
|
128
128
|
onClose: O,
|
|
129
|
-
onTransitionEnter:
|
|
130
|
-
onTransitionExited:
|
|
129
|
+
onTransitionEnter: ge,
|
|
130
|
+
onTransitionExited: _e,
|
|
131
131
|
open: u = !1,
|
|
132
|
-
ownerState:
|
|
132
|
+
ownerState: ye,
|
|
133
133
|
PaperProps: I = {},
|
|
134
|
-
size:
|
|
134
|
+
size: Te,
|
|
135
135
|
slotProps: x,
|
|
136
|
-
slots:
|
|
137
|
-
sx:
|
|
136
|
+
slots: Oe,
|
|
137
|
+
sx: Z,
|
|
138
138
|
transformOrigin: N = { horizontal: "right", vertical: "top" },
|
|
139
|
-
TransitionComponent:
|
|
140
|
-
transitionDuration:
|
|
141
|
-
TransitionProps:
|
|
142
|
-
...
|
|
143
|
-
} = e,
|
|
144
|
-
|
|
139
|
+
TransitionComponent: xe,
|
|
140
|
+
transitionDuration: ke,
|
|
141
|
+
TransitionProps: Re,
|
|
142
|
+
...ee
|
|
143
|
+
} = e, a = j(null), te = ie(
|
|
144
|
+
a,
|
|
145
145
|
((typeof x?.paper == "function" ? void 0 : x?.paper) ?? I)?.ref
|
|
146
|
-
), [
|
|
147
|
-
|
|
148
|
-
), z =
|
|
146
|
+
), [oe, V] = ae(
|
|
147
|
+
X
|
|
148
|
+
), z = j(null), K = u ? F(p, r) : null, d = (typeof x?.paper == "function" ? void 0 : x?.paper) ?? I, ne = Array.isArray(
|
|
149
149
|
d?.sx
|
|
150
150
|
) ? [C, ...d.sx] : d?.sx ? [C, d.sx] : C;
|
|
151
|
-
return
|
|
152
|
-
if (!u || !
|
|
153
|
-
V(
|
|
151
|
+
return le(() => {
|
|
152
|
+
if (!u || !a.current) {
|
|
153
|
+
V(X);
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
156
|
const o = () => {
|
|
157
|
-
if (!
|
|
157
|
+
if (!a.current)
|
|
158
158
|
return;
|
|
159
|
-
const s =
|
|
159
|
+
const s = he({
|
|
160
160
|
anchorEl: r,
|
|
161
161
|
anchorOrigin: n,
|
|
162
162
|
anchorPosition: P,
|
|
163
163
|
anchorReference: b,
|
|
164
164
|
marginThreshold: B,
|
|
165
|
-
paperElement:
|
|
165
|
+
paperElement: a.current,
|
|
166
166
|
transformOrigin: N
|
|
167
167
|
});
|
|
168
168
|
V((v) => v.left === s.left && v.top === s.top && v.transformOrigin === s.transformOrigin && v.visibility === s.visibility ? v : s);
|
|
169
|
-
}, l =
|
|
169
|
+
}, l = a.current.ownerDocument, _ = k(r), f = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => {
|
|
170
170
|
o();
|
|
171
171
|
});
|
|
172
|
-
return o(), l.defaultView?.addEventListener("resize", o), l.addEventListener("scroll", o, !0), f?.observe(
|
|
172
|
+
return o(), l.defaultView?.addEventListener("resize", o), l.addEventListener("scroll", o, !0), f?.observe(a.current), _ && f?.observe(_), () => {
|
|
173
173
|
l.defaultView?.removeEventListener("resize", o), l.removeEventListener("scroll", o, !0), f?.disconnect();
|
|
174
174
|
};
|
|
175
175
|
}, [
|
|
@@ -180,19 +180,22 @@ const Ne = se(
|
|
|
180
180
|
B,
|
|
181
181
|
u,
|
|
182
182
|
N
|
|
183
|
-
]),
|
|
183
|
+
]), U(() => {
|
|
184
184
|
if (!u)
|
|
185
185
|
return;
|
|
186
|
-
const o =
|
|
186
|
+
const o = a.current?.ownerDocument ?? F(p, r)?.ownerDocument ?? document;
|
|
187
187
|
return z.current = o.activeElement instanceof HTMLElement ? o.activeElement : null, () => {
|
|
188
188
|
M || z.current?.focus?.(), z.current = null;
|
|
189
189
|
};
|
|
190
|
-
}, [r, p, M, u]),
|
|
190
|
+
}, [r, p, M, u]), U(() => {
|
|
191
191
|
if (!u || !O)
|
|
192
192
|
return;
|
|
193
|
-
const o =
|
|
193
|
+
const o = a.current?.ownerDocument ?? F(p, r)?.ownerDocument ?? document, l = (f) => {
|
|
194
194
|
const s = f.target, v = k(r);
|
|
195
|
-
!s ||
|
|
195
|
+
if (!s || a.current?.contains(s) || v?.contains(s))
|
|
196
|
+
return;
|
|
197
|
+
const H = s instanceof Element ? s : s.parentElement;
|
|
198
|
+
H?.closest(".MuiModal-root") || H?.closest(".MuiAutocomplete-popper") || O(
|
|
196
199
|
f,
|
|
197
200
|
"backdropClick"
|
|
198
201
|
);
|
|
@@ -205,29 +208,29 @@ const Ne = se(
|
|
|
205
208
|
return o.addEventListener("mousedown", l, !0), o.addEventListener("touchstart", l, !0), o.addEventListener("keydown", _), () => {
|
|
206
209
|
o.removeEventListener("mousedown", l, !0), o.removeEventListener("touchstart", l, !0), o.removeEventListener("keydown", _);
|
|
207
210
|
};
|
|
208
|
-
}, [r, p, O, u]), !u || !K ? null :
|
|
209
|
-
/* @__PURE__ */
|
|
210
|
-
|
|
211
|
+
}, [r, p, O, u]), !u || !K ? null : se(
|
|
212
|
+
/* @__PURE__ */ W(
|
|
213
|
+
de,
|
|
211
214
|
{
|
|
212
|
-
...
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
...fe(
|
|
216
|
+
ue,
|
|
217
|
+
me.root,
|
|
218
|
+
Q
|
|
216
219
|
),
|
|
217
|
-
...
|
|
220
|
+
...ee,
|
|
218
221
|
ref: y,
|
|
219
|
-
className:
|
|
220
|
-
ownerState: { position:
|
|
221
|
-
sx:
|
|
222
|
-
children: /* @__PURE__ */
|
|
223
|
-
|
|
222
|
+
className: $(T, pe),
|
|
223
|
+
ownerState: { position: oe },
|
|
224
|
+
sx: Z,
|
|
225
|
+
children: /* @__PURE__ */ W(
|
|
226
|
+
re,
|
|
224
227
|
{
|
|
225
228
|
...d,
|
|
226
|
-
ref:
|
|
229
|
+
ref: te,
|
|
227
230
|
"aria-label": d?.["aria-label"] ?? "Paper-popover-root",
|
|
228
|
-
className:
|
|
229
|
-
elevation: d?.elevation ??
|
|
230
|
-
sx:
|
|
231
|
+
className: $(d?.className),
|
|
232
|
+
elevation: d?.elevation ?? J,
|
|
233
|
+
sx: ne,
|
|
231
234
|
children: E
|
|
232
235
|
}
|
|
233
236
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/components",
|
|
3
|
-
"version": "9.22.
|
|
3
|
+
"version": "9.22.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"@hookform/resolvers": "2.9.11",
|
|
52
52
|
"nprogress": "0.2.0",
|
|
53
53
|
"react-transition-group": "4.4.5",
|
|
54
|
-
"react-dropzone": "14.4.1",
|
|
55
|
-
"react-draggable": "4.5.0",
|
|
56
54
|
"react-color": "2.19.3",
|
|
57
|
-
"
|
|
55
|
+
"react-draggable": "4.5.0",
|
|
58
56
|
"react-rnd": "10.5.2",
|
|
57
|
+
"@mui/x-date-pickers": "6.20.2",
|
|
58
|
+
"react-dropzone": "14.4.1",
|
|
59
59
|
"react-spinners": "0.13.8",
|
|
60
60
|
"date-fns": "2.30.0",
|
|
61
61
|
"chart.js": "4.5.1",
|