impact-nova 1.7.10 → 1.7.11
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/components/ui/calendar.js +242 -234
- package/dist/components/ui/command-palette/shortcut-overlay.js +97 -75
- package/dist/components/ui/data-table/data-table-saved-views.js +116 -113
- package/dist/components/ui/date-picker/month-range-picker.js +50 -50
- package/dist/impact-nova.css +1 -1
- package/package.json +1 -1
|
@@ -1,90 +1,112 @@
|
|
|
1
|
-
import { jsxs as x, Fragment as
|
|
2
|
-
import * as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { useShortcutOverlay as
|
|
5
|
-
import { useCommandPalette as
|
|
6
|
-
import { Kbd as
|
|
7
|
-
const
|
|
8
|
-
function X(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { jsxs as x, Fragment as L, jsx as v } from "react/jsx-runtime";
|
|
2
|
+
import * as h from "react";
|
|
3
|
+
import { createPortal as O } from "react-dom";
|
|
4
|
+
import { useShortcutOverlay as S } from "./shortcut-overlay-context.js";
|
|
5
|
+
import { useCommandPalette as M } from "./command-palette-context.js";
|
|
6
|
+
import { Kbd as T } from "./kbd.js";
|
|
7
|
+
const u = 26, y = 80, s = 4;
|
|
8
|
+
function X() {
|
|
9
|
+
const o = document.querySelectorAll(
|
|
10
|
+
'[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"], [data-component="sheet-content"][data-state="open"]'
|
|
11
|
+
);
|
|
12
|
+
return o.length === 0 ? null : o[o.length - 1];
|
|
13
|
+
}
|
|
14
|
+
function z(o) {
|
|
15
|
+
if (o.length <= 1) return o;
|
|
16
|
+
const a = [...o].sort((e, t) => e.top - t.top || e.left - t.left), f = (e, t) => Math.abs(e.left - t.left) < y && Math.abs(e.top - t.top) < u + s, c = (e) => a.slice(0, e).some((t) => f(t, a[e]));
|
|
17
|
+
for (let e = 1; e < a.length; e++) {
|
|
18
|
+
if (!c(e)) continue;
|
|
19
|
+
const t = a[e], d = t.top, m = t.left, n = t.placement;
|
|
20
|
+
if (t.placement === "above" ? (t.placement = "below", t.top = d + u + 32 + s) : (t.placement = "above", t.top = d - u - 32 - s), !c(e)) continue;
|
|
21
|
+
t.placement = n, t.left = m;
|
|
22
|
+
let i = !1;
|
|
23
|
+
for (let r = 1; r <= 6; r++)
|
|
24
|
+
if (t.top = d + (u + s) * r, !c(e)) {
|
|
25
|
+
i = !0;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
if (!i) {
|
|
29
|
+
t.top = d;
|
|
30
|
+
for (let r = 1; r <= 4; r++)
|
|
31
|
+
if (t.left = m + (y + s) * r, !c(e)) {
|
|
32
|
+
i = !0;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
if (!i) {
|
|
36
|
+
t.left = m;
|
|
37
|
+
for (let r = 1; r <= 4 && (t.top = d - (u + s) * r, !!c(e)); r++)
|
|
38
|
+
;
|
|
39
|
+
}
|
|
18
40
|
}
|
|
19
41
|
}
|
|
20
|
-
return
|
|
42
|
+
return a;
|
|
21
43
|
}
|
|
22
|
-
function
|
|
23
|
-
const
|
|
44
|
+
function C(o) {
|
|
45
|
+
const a = window.innerWidth, f = window.innerHeight;
|
|
24
46
|
return {
|
|
25
|
-
...
|
|
26
|
-
top: Math.max(s, Math.min(
|
|
27
|
-
left: Math.max(y / 2, Math.min(
|
|
47
|
+
...o,
|
|
48
|
+
top: Math.max(s, Math.min(o.top, f - u - s)),
|
|
49
|
+
left: Math.max(y / 2, Math.min(o.left, a - y / 2))
|
|
28
50
|
};
|
|
29
51
|
}
|
|
30
|
-
function
|
|
31
|
-
const { isOverlayVisible:
|
|
32
|
-
return
|
|
33
|
-
if (!
|
|
52
|
+
function D() {
|
|
53
|
+
const { isOverlayVisible: o, setOverlayVisible: a } = S(), { getEffectiveKeybinding: f, version: c } = M(), [e, t] = h.useState([]), [d, m] = h.useState(0);
|
|
54
|
+
return h.useLayoutEffect(() => {
|
|
55
|
+
if (!o) {
|
|
34
56
|
t([]);
|
|
35
57
|
return;
|
|
36
58
|
}
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
if (!
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
59
|
+
const n = X(), i = document.querySelectorAll("[data-shortcut-id]"), r = [];
|
|
60
|
+
i.forEach((p) => {
|
|
61
|
+
const w = p.getAttribute("data-shortcut-id");
|
|
62
|
+
if (!w || n && !n.contains(p)) return;
|
|
63
|
+
const b = window.getComputedStyle(p);
|
|
64
|
+
if (b.display === "none" || b.visibility === "hidden" || b.opacity === "0")
|
|
43
65
|
return;
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
66
|
+
const l = p.getBoundingClientRect();
|
|
67
|
+
if (l.width === 0 || l.height === 0 || l.bottom < 0 || l.top > window.innerHeight || l.right < 0 || l.left > window.innerWidth)
|
|
46
68
|
return;
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
49
|
-
const
|
|
50
|
-
let
|
|
51
|
-
|
|
52
|
-
id:
|
|
53
|
-
keybinding:
|
|
54
|
-
top:
|
|
55
|
-
left:
|
|
56
|
-
placement:
|
|
69
|
+
const k = f(w);
|
|
70
|
+
if (!k) return;
|
|
71
|
+
const A = l.left + l.width / 2;
|
|
72
|
+
let E = "above", g = l.top - u - s;
|
|
73
|
+
g < s && (E = "below", g = l.bottom + s), r.push({
|
|
74
|
+
id: w,
|
|
75
|
+
keybinding: k,
|
|
76
|
+
top: g,
|
|
77
|
+
left: A,
|
|
78
|
+
placement: E
|
|
57
79
|
});
|
|
58
|
-
}), t(
|
|
59
|
-
}, [
|
|
60
|
-
if (!
|
|
61
|
-
const
|
|
62
|
-
|
|
80
|
+
}), t(z(r).map(C));
|
|
81
|
+
}, [o, f, c, d]), h.useEffect(() => {
|
|
82
|
+
if (!o) return;
|
|
83
|
+
const n = (i) => {
|
|
84
|
+
i.key === "Escape" && (i.preventDefault(), i.stopPropagation(), a(!1));
|
|
63
85
|
};
|
|
64
|
-
return window.addEventListener("keydown",
|
|
65
|
-
}, [
|
|
66
|
-
if (!
|
|
67
|
-
let
|
|
68
|
-
const
|
|
69
|
-
cancelAnimationFrame(
|
|
86
|
+
return window.addEventListener("keydown", n, !0), () => window.removeEventListener("keydown", n, !0);
|
|
87
|
+
}, [o, a]), h.useEffect(() => {
|
|
88
|
+
if (!o) return;
|
|
89
|
+
let n;
|
|
90
|
+
const i = () => {
|
|
91
|
+
cancelAnimationFrame(n), n = requestAnimationFrame(() => m((p) => p + 1));
|
|
70
92
|
};
|
|
71
|
-
window.addEventListener("scroll",
|
|
72
|
-
const
|
|
73
|
-
return
|
|
93
|
+
window.addEventListener("scroll", i, !0), window.addEventListener("resize", i);
|
|
94
|
+
const r = new MutationObserver(i);
|
|
95
|
+
return r.observe(document.body, {
|
|
74
96
|
childList: !0,
|
|
75
97
|
subtree: !0,
|
|
76
98
|
attributes: !0,
|
|
77
99
|
attributeFilter: ["data-state"]
|
|
78
100
|
}), () => {
|
|
79
|
-
cancelAnimationFrame(
|
|
101
|
+
cancelAnimationFrame(n), window.removeEventListener("scroll", i, !0), window.removeEventListener("resize", i), r.disconnect();
|
|
80
102
|
};
|
|
81
|
-
}, [
|
|
82
|
-
/* @__PURE__ */ x(
|
|
83
|
-
/* @__PURE__ */
|
|
103
|
+
}, [o]), !o || e.length === 0 ? null : O(
|
|
104
|
+
/* @__PURE__ */ x(L, { children: [
|
|
105
|
+
/* @__PURE__ */ v(
|
|
84
106
|
"div",
|
|
85
107
|
{
|
|
86
108
|
"data-shortcut-overlay-backdrop": "",
|
|
87
|
-
onClick: () =>
|
|
109
|
+
onClick: () => a(!1),
|
|
88
110
|
style: {
|
|
89
111
|
position: "fixed",
|
|
90
112
|
inset: 0,
|
|
@@ -94,31 +116,31 @@ function C() {
|
|
|
94
116
|
}
|
|
95
117
|
}
|
|
96
118
|
),
|
|
97
|
-
e.map((
|
|
119
|
+
e.map((n) => /* @__PURE__ */ v(
|
|
98
120
|
"div",
|
|
99
121
|
{
|
|
100
122
|
"data-shortcut-overlay-badge": "",
|
|
101
123
|
style: {
|
|
102
124
|
position: "fixed",
|
|
103
|
-
top:
|
|
104
|
-
left:
|
|
125
|
+
top: n.top,
|
|
126
|
+
left: n.left,
|
|
105
127
|
transform: "translateX(-50%)",
|
|
106
128
|
zIndex: 99999,
|
|
107
129
|
pointerEvents: "none",
|
|
108
|
-
animation:
|
|
130
|
+
animation: n.placement === "below" ? "shortcut-overlay-badge-in-below 0.15s ease-out" : "shortcut-overlay-badge-in 0.15s ease-out"
|
|
109
131
|
},
|
|
110
|
-
children: /* @__PURE__ */
|
|
111
|
-
|
|
132
|
+
children: /* @__PURE__ */ v(
|
|
133
|
+
T,
|
|
112
134
|
{
|
|
113
|
-
keybinding:
|
|
135
|
+
keybinding: n.keybinding,
|
|
114
136
|
size: "sm",
|
|
115
137
|
variant: "dark"
|
|
116
138
|
}
|
|
117
139
|
)
|
|
118
140
|
},
|
|
119
|
-
|
|
141
|
+
n.id
|
|
120
142
|
)),
|
|
121
|
-
/* @__PURE__ */
|
|
143
|
+
/* @__PURE__ */ v("style", { children: `
|
|
122
144
|
@keyframes shortcut-overlay-badge-in {
|
|
123
145
|
from {
|
|
124
146
|
opacity: 0;
|
|
@@ -144,7 +166,7 @@ function C() {
|
|
|
144
166
|
document.body
|
|
145
167
|
);
|
|
146
168
|
}
|
|
147
|
-
|
|
169
|
+
D.displayName = "ShortcutOverlay";
|
|
148
170
|
export {
|
|
149
|
-
|
|
171
|
+
D as ShortcutOverlay
|
|
150
172
|
};
|