framepexls-ui-lib 0.1.7 → 0.1.9
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/Badge.d.mts +3 -1
- package/dist/Badge.d.ts +3 -1
- package/dist/Badge.js +12 -2
- package/dist/Badge.mjs +12 -2
- package/dist/Button.d.mts +6 -1
- package/dist/Button.d.ts +6 -1
- package/dist/Button.js +35 -13
- package/dist/Button.mjs +35 -13
- package/dist/ReviewHistory.d.mts +23 -0
- package/dist/ReviewHistory.d.ts +23 -0
- package/dist/ReviewHistory.js +137 -0
- package/dist/ReviewHistory.mjs +103 -0
- package/dist/Sidebar.d.mts +35 -0
- package/dist/Sidebar.d.ts +35 -0
- package/dist/Sidebar.js +407 -0
- package/dist/Sidebar.mjs +377 -0
- package/dist/TimePopover.js +2 -2
- package/dist/TimePopover.mjs +2 -2
- package/dist/TimeRangeField.d.mts +20 -0
- package/dist/TimeRangeField.d.ts +20 -0
- package/dist/TimeRangeField.js +269 -0
- package/dist/TimeRangeField.mjs +239 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +12 -0
- package/dist/index.mjs +16 -8
- package/package.json +4 -4
package/dist/Sidebar.mjs
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
4
|
+
import Button from "./Button";
|
|
5
|
+
import AvatarSquare from "./AvatarSquare";
|
|
6
|
+
import { CloseIcon, ChevronLeftRightIcon, MenuIcon } from "./iconos";
|
|
7
|
+
function groupItems(items) {
|
|
8
|
+
var _a;
|
|
9
|
+
const byGroup = /* @__PURE__ */ new Map();
|
|
10
|
+
for (const it of items) {
|
|
11
|
+
const arr = (_a = byGroup.get(it.group)) != null ? _a : [];
|
|
12
|
+
arr.push(it);
|
|
13
|
+
byGroup.set(it.group, arr);
|
|
14
|
+
}
|
|
15
|
+
return Array.from(byGroup.entries());
|
|
16
|
+
}
|
|
17
|
+
function GroupHeader({ title }) {
|
|
18
|
+
return /* @__PURE__ */ jsx("div", { className: "mb-3 px-1 text-[11px] font-semibold uppercase tracking-wider text-slate-400", children: title });
|
|
19
|
+
}
|
|
20
|
+
function ChevronDown({ open }) {
|
|
21
|
+
return /* @__PURE__ */ jsx("svg", { className: `h-4 w-4 transition-transform ${open ? "rotate-180" : ""}`, viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx(
|
|
22
|
+
"path",
|
|
23
|
+
{
|
|
24
|
+
fillRule: "evenodd",
|
|
25
|
+
d: "M5.23 7.21a.75.75 0 011.06.02L10 11.127l3.71-3.896a.75.75 0 111.08 1.04l-4.24 4.46a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z",
|
|
26
|
+
clipRule: "evenodd"
|
|
27
|
+
}
|
|
28
|
+
) });
|
|
29
|
+
}
|
|
30
|
+
function Sidebar({
|
|
31
|
+
items,
|
|
32
|
+
activeKey,
|
|
33
|
+
onNavigate,
|
|
34
|
+
user,
|
|
35
|
+
userMenuSlot,
|
|
36
|
+
onBrandClick,
|
|
37
|
+
collapsedKey = "ga:sidebar-collapsed",
|
|
38
|
+
brandInitials = "C",
|
|
39
|
+
brandTitle = "Campaign",
|
|
40
|
+
brandSubtitle = "Tablero"
|
|
41
|
+
}) {
|
|
42
|
+
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
43
|
+
const [collapsed, setCollapsed] = useState(false);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
try {
|
|
46
|
+
if (localStorage.getItem(collapsedKey) === "1") setCollapsed(true);
|
|
47
|
+
} catch {
|
|
48
|
+
}
|
|
49
|
+
}, [collapsedKey]);
|
|
50
|
+
const toggleCollapsed = () => {
|
|
51
|
+
setCollapsed((c) => {
|
|
52
|
+
const n = !c;
|
|
53
|
+
try {
|
|
54
|
+
localStorage.setItem(collapsedKey, n ? "1" : "0");
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
57
|
+
return n;
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (drawerOpen) document.body.style.overflow = "hidden";
|
|
62
|
+
else document.body.style.overflow = "";
|
|
63
|
+
return () => {
|
|
64
|
+
document.body.style.overflow = "";
|
|
65
|
+
};
|
|
66
|
+
}, [drawerOpen]);
|
|
67
|
+
const groups = useMemo(() => groupItems(items), [items]);
|
|
68
|
+
const go = (key) => {
|
|
69
|
+
onNavigate(key);
|
|
70
|
+
setDrawerOpen(false);
|
|
71
|
+
};
|
|
72
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
73
|
+
/* @__PURE__ */ jsxs("div", { className: "sticky top-0 z-40 flex h-14 items-center gap-2 border-b border-black/5 bg-white/80 px-3 backdrop-blur shadow-sm xl:hidden dark:bg-[#0b0a0a]/70", children: [
|
|
74
|
+
/* @__PURE__ */ jsx(
|
|
75
|
+
Button,
|
|
76
|
+
{
|
|
77
|
+
noPaddingX: true,
|
|
78
|
+
"aria-label": "Abrir men\xFA",
|
|
79
|
+
onClick: () => setDrawerOpen(true),
|
|
80
|
+
variant: "ghost",
|
|
81
|
+
size: "sm",
|
|
82
|
+
leftIcon: /* @__PURE__ */ jsx(MenuIcon, {}),
|
|
83
|
+
className: "h-9 w-9 p-0 !gap-0 rounded-xl border border-slate-200 bg-white text-slate-700 shadow-sm hover:bg-slate-50 active:scale-95 dark:border-white/10 dark:bg-white/5 dark:text-slate-200 dark:hover:bg-white/10"
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ jsxs("button", { onClick: onBrandClick, className: "flex items-center gap-2", children: [
|
|
87
|
+
/* @__PURE__ */ jsx("div", { className: "text-2xl font-black leading-none tracking-tight", children: brandInitials }),
|
|
88
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
89
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm font-semibold leading-4", children: brandTitle }),
|
|
90
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-slate-500 text-left", children: brandSubtitle })
|
|
91
|
+
] })
|
|
92
|
+
] })
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ jsx(
|
|
95
|
+
"aside",
|
|
96
|
+
{
|
|
97
|
+
className: [
|
|
98
|
+
"hidden xl:fixed xl:inset-y-0 xl:flex xl:flex-col xl:border-r xl:border-black/5 xl:bg-white xl:py-6 dark:xl:bg-[#0b0a0a]/70 z-40",
|
|
99
|
+
"transition-[width] duration-200",
|
|
100
|
+
collapsed ? "xl:w-28 xl:px-3" : "xl:w-72 xl:px-4"
|
|
101
|
+
].join(" "),
|
|
102
|
+
children: /* @__PURE__ */ jsx(
|
|
103
|
+
SidebarInner,
|
|
104
|
+
{
|
|
105
|
+
groups,
|
|
106
|
+
collapsed,
|
|
107
|
+
toggleCollapsed,
|
|
108
|
+
activeKey,
|
|
109
|
+
go,
|
|
110
|
+
user,
|
|
111
|
+
userMenuSlot,
|
|
112
|
+
brandInitials,
|
|
113
|
+
brandTitle,
|
|
114
|
+
brandSubtitle
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
/* @__PURE__ */ jsx("div", { className: ["hidden xl:block", "transition-[width] duration-200", collapsed ? "xl:w-20" : "xl:w-72"].join(" ") }),
|
|
120
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: drawerOpen && /* @__PURE__ */ jsxs(motion.div, { className: "fixed inset-0 z-40 xl:hidden", initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, children: [
|
|
121
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-black/40" }),
|
|
122
|
+
/* @__PURE__ */ jsxs(
|
|
123
|
+
motion.div,
|
|
124
|
+
{
|
|
125
|
+
role: "dialog",
|
|
126
|
+
"aria-modal": "true",
|
|
127
|
+
initial: { x: -340 },
|
|
128
|
+
animate: { x: 0 },
|
|
129
|
+
exit: { x: -340 },
|
|
130
|
+
transition: { type: "spring", stiffness: 260, damping: 28 },
|
|
131
|
+
className: "relative h-full w-[88%] max-w-80 bg-white px-5 py-6 shadow-2xl dark:bg-[#0b0a0a]",
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-4 flex items-center justify-between", children: [
|
|
134
|
+
/* @__PURE__ */ jsx(
|
|
135
|
+
Button,
|
|
136
|
+
{
|
|
137
|
+
noPaddingX: true,
|
|
138
|
+
onClick: () => setDrawerOpen(false),
|
|
139
|
+
variant: "ghost",
|
|
140
|
+
size: "sm",
|
|
141
|
+
leftIcon: /* @__PURE__ */ jsx(CloseIcon, {}),
|
|
142
|
+
className: "h-9 w-9 p-0 !gap-0 rounded-xl border border-slate-200 bg-white text-slate-700 shadow-sm hover:bg-slate-50 dark:border-white/10 dark:bg-white/5 dark:text-slate-200"
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-slate-500", children: "Men\xFA" })
|
|
146
|
+
] }),
|
|
147
|
+
/* @__PURE__ */ jsx(
|
|
148
|
+
SidebarInner,
|
|
149
|
+
{
|
|
150
|
+
groups,
|
|
151
|
+
mobile: true,
|
|
152
|
+
activeKey,
|
|
153
|
+
go,
|
|
154
|
+
user,
|
|
155
|
+
userMenuSlot,
|
|
156
|
+
brandInitials,
|
|
157
|
+
brandTitle,
|
|
158
|
+
brandSubtitle
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
] }) })
|
|
165
|
+
] });
|
|
166
|
+
}
|
|
167
|
+
function SidebarInner({
|
|
168
|
+
groups,
|
|
169
|
+
collapsed,
|
|
170
|
+
toggleCollapsed,
|
|
171
|
+
mobile,
|
|
172
|
+
activeKey,
|
|
173
|
+
go,
|
|
174
|
+
user,
|
|
175
|
+
userMenuSlot,
|
|
176
|
+
brandInitials,
|
|
177
|
+
brandTitle,
|
|
178
|
+
brandSubtitle
|
|
179
|
+
}) {
|
|
180
|
+
var _a, _b, _c, _d;
|
|
181
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col", children: [
|
|
182
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-1", children: [
|
|
183
|
+
/* @__PURE__ */ jsxs("button", { className: "flex items-center gap-3", title: "Ir al inicio", children: [
|
|
184
|
+
/* @__PURE__ */ jsx("div", { className: "text-2xl font-black tracking-tight", children: brandInitials }),
|
|
185
|
+
!collapsed && /* @__PURE__ */ jsxs("div", { className: "leading-tight", children: [
|
|
186
|
+
/* @__PURE__ */ jsx("div", { className: "text-lg font-semibold tracking-tight", children: brandTitle }),
|
|
187
|
+
/* @__PURE__ */ jsx("div", { className: "text-[11px] uppercase tracking-wide text-slate-400 text-left", children: brandSubtitle })
|
|
188
|
+
] })
|
|
189
|
+
] }),
|
|
190
|
+
!mobile && /* @__PURE__ */ jsx(
|
|
191
|
+
Button,
|
|
192
|
+
{
|
|
193
|
+
noPaddingX: true,
|
|
194
|
+
"aria-label": collapsed ? "Expandir barra lateral" : "Contraer barra lateral",
|
|
195
|
+
onClick: toggleCollapsed,
|
|
196
|
+
variant: "ghost",
|
|
197
|
+
size: "sm",
|
|
198
|
+
leftIcon: /* @__PURE__ */ jsx(ChevronLeftRightIcon, { collapsed: collapsed != null ? collapsed : false }),
|
|
199
|
+
className: "hidden xl:inline-flex h-8 w-8 p-0 !gap-0 rounded-xl border border-slate-200 bg-white text-slate-700 shadow-sm hover:bg-slate-50 dark:border-white/10 dark:bg-white/5 dark:text-slate-200",
|
|
200
|
+
title: collapsed ? "Expandir" : "Contraer"
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
] }),
|
|
204
|
+
collapsed && /* @__PURE__ */ jsx("div", { className: "mt-4 flex items-center justify-center", children: /* @__PURE__ */ jsx(AvatarSquare, { size: 48, src: (_a = user == null ? void 0 : user.avatarUrl) != null ? _a : void 0, radiusClass: "rounded-2xl" }) }),
|
|
205
|
+
!collapsed && /* @__PURE__ */ jsxs("div", { className: "mt-4 flex items-center gap-3 rounded-2xl border border-slate-200 bg-white p-2 pr-3 shadow-sm dark:border-white/10 dark:bg:white/5 dark:bg-white/5", children: [
|
|
206
|
+
/* @__PURE__ */ jsx(AvatarSquare, { size: 48, src: (_b = user == null ? void 0 : user.avatarUrl) != null ? _b : void 0, radiusClass: "rounded-2xl" }),
|
|
207
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
208
|
+
/* @__PURE__ */ jsx("div", { className: "truncate text-sm font-semibold", children: (_c = user == null ? void 0 : user.name) != null ? _c : "Usuario" }),
|
|
209
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-slate-500", children: (_d = user == null ? void 0 : user.rol_principal) != null ? _d : "\u2014" })
|
|
210
|
+
] }),
|
|
211
|
+
/* @__PURE__ */ jsx("div", { className: "ml-auto", children: userMenuSlot })
|
|
212
|
+
] }),
|
|
213
|
+
/* @__PURE__ */ jsx("nav", { className: "my-6 flex-1 space-y-7 overflow-auto overflow-x-hidden px-2", children: groups.map(([groupName, items]) => {
|
|
214
|
+
const visibles = items.filter((i) => {
|
|
215
|
+
var _a2;
|
|
216
|
+
return ((_a2 = i.children) == null ? void 0 : _a2.length) ? i.children.some((c) => c) : true;
|
|
217
|
+
});
|
|
218
|
+
if (visibles.length === 0) return null;
|
|
219
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
220
|
+
!collapsed && /* @__PURE__ */ jsx(GroupHeader, { title: groupName }),
|
|
221
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: visibles.map((item) => /* @__PURE__ */ jsx(RenderItem, { item, collapsed: collapsed != null ? collapsed : false, activeKey, go }, item.key)) })
|
|
222
|
+
] }, groupName);
|
|
223
|
+
}) })
|
|
224
|
+
] });
|
|
225
|
+
}
|
|
226
|
+
function RenderItem({
|
|
227
|
+
item,
|
|
228
|
+
collapsed,
|
|
229
|
+
activeKey,
|
|
230
|
+
go
|
|
231
|
+
}) {
|
|
232
|
+
var _a, _b, _c;
|
|
233
|
+
const Icon = (_a = item.icon) != null ? _a : (() => null);
|
|
234
|
+
const hasChildren = !!((_b = item.children) == null ? void 0 : _b.length);
|
|
235
|
+
const children = ((_c = item.children) != null ? _c : []).filter(Boolean);
|
|
236
|
+
const isActive = item.key === activeKey || hasChildren && children.some((ch) => ch.key === activeKey);
|
|
237
|
+
const [open, setOpen] = useState(false);
|
|
238
|
+
useEffect(() => {
|
|
239
|
+
if (!hasChildren) return;
|
|
240
|
+
try {
|
|
241
|
+
const raw = localStorage.getItem(`ga:submenu:${item.key}`);
|
|
242
|
+
if (raw === "1") setOpen(true);
|
|
243
|
+
} catch {
|
|
244
|
+
}
|
|
245
|
+
}, [hasChildren, item.key]);
|
|
246
|
+
useEffect(() => {
|
|
247
|
+
if (!hasChildren) return;
|
|
248
|
+
try {
|
|
249
|
+
localStorage.setItem(`ga:submenu:${item.key}`, open ? "1" : "0");
|
|
250
|
+
} catch {
|
|
251
|
+
}
|
|
252
|
+
}, [hasChildren, open, item.key]);
|
|
253
|
+
if (hasChildren && collapsed) {
|
|
254
|
+
return /* @__PURE__ */ jsx(
|
|
255
|
+
"button",
|
|
256
|
+
{
|
|
257
|
+
onClick: () => go(item.key),
|
|
258
|
+
title: item.label,
|
|
259
|
+
className: [
|
|
260
|
+
"group flex w-full items-center gap-3 rounded-2xl px-3 py-2 text-left text-[15px] transition justify-center",
|
|
261
|
+
isActive ? "bg-blue-600/20 text-slate-900 ring-1 ring-blue-300 dark:bg-blue-600/25 dark:text-white" : "text-slate-700 hover:bg-slate-100 dark:text-slate-200 dark:hover:bg-white/5"
|
|
262
|
+
].join(" "),
|
|
263
|
+
children: /* @__PURE__ */ jsx(
|
|
264
|
+
"span",
|
|
265
|
+
{
|
|
266
|
+
className: [
|
|
267
|
+
"grid h-9 w-9 place-items-center rounded-xl border transition",
|
|
268
|
+
isActive ? "border-blue-300/60 bg-white shadow-sm dark:border-blue-700/40 dark:bg-white/10" : "border-slate-200 bg-white shadow-sm dark:border-white/10 dark:bg-white/5"
|
|
269
|
+
].join(" "),
|
|
270
|
+
children: /* @__PURE__ */ jsx(Icon, { className: "h-5 w-5" })
|
|
271
|
+
}
|
|
272
|
+
)
|
|
273
|
+
}
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
if (hasChildren) {
|
|
277
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
278
|
+
/* @__PURE__ */ jsxs(
|
|
279
|
+
"div",
|
|
280
|
+
{
|
|
281
|
+
className: [
|
|
282
|
+
"flex w-full min-w-0 items-center rounded-2xl px-3 py-2 text-[15px] transition gap-2",
|
|
283
|
+
isActive ? "bg-blue-600/20 text-slate-900 ring-1 ring-blue-300 dark:bg-blue-600/25 dark:text-white" : "text-slate-700 hover:bg-slate-100 dark:text-slate-200 dark:hover:bg-white/5"
|
|
284
|
+
].join(" "),
|
|
285
|
+
children: [
|
|
286
|
+
/* @__PURE__ */ jsxs("button", { type: "button", onClick: () => go(item.key), className: "flex min-w-0 flex-1 items-center gap-3", children: [
|
|
287
|
+
/* @__PURE__ */ jsx(
|
|
288
|
+
"span",
|
|
289
|
+
{
|
|
290
|
+
className: [
|
|
291
|
+
"grid h-9 w-9 place-items-center rounded-xl border transition",
|
|
292
|
+
isActive ? "border-blue-300/60 bg-white shadow-sm dark:border-blue-700/40 dark:bg-white/10" : "border-slate-200 bg-white shadow-sm dark:border-white/10 dark:bg-white/5"
|
|
293
|
+
].join(" "),
|
|
294
|
+
children: /* @__PURE__ */ jsx(Icon, { className: "h-5 w-5" })
|
|
295
|
+
}
|
|
296
|
+
),
|
|
297
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: item.label })
|
|
298
|
+
] }),
|
|
299
|
+
/* @__PURE__ */ jsx(
|
|
300
|
+
Button,
|
|
301
|
+
{
|
|
302
|
+
type: "button",
|
|
303
|
+
"aria-label": open ? "Contraer submen\xFA" : "Expandir submen\xFA",
|
|
304
|
+
onClick: (e) => {
|
|
305
|
+
e.stopPropagation();
|
|
306
|
+
setOpen(!open);
|
|
307
|
+
},
|
|
308
|
+
variant: "ghost",
|
|
309
|
+
size: "sm",
|
|
310
|
+
leftIcon: /* @__PURE__ */ jsx(ChevronDown, { open }),
|
|
311
|
+
className: [
|
|
312
|
+
"h-8 w-8 shrink-0 rounded-lg p-0 !gap-0 border",
|
|
313
|
+
isActive ? "border-blue-200 bg-white/80 dark:border-blue-700/40 dark:bg-white/10" : "border-slate-200 bg-white dark:border-white/10 dark:bg-white/5"
|
|
314
|
+
].join(" ")
|
|
315
|
+
}
|
|
316
|
+
)
|
|
317
|
+
]
|
|
318
|
+
}
|
|
319
|
+
),
|
|
320
|
+
/* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: open && /* @__PURE__ */ jsx(
|
|
321
|
+
motion.div,
|
|
322
|
+
{
|
|
323
|
+
initial: { height: 0, opacity: 0, y: -4 },
|
|
324
|
+
animate: { height: "auto", opacity: 1, y: 0 },
|
|
325
|
+
exit: { height: 0, opacity: 0, y: -4 },
|
|
326
|
+
transition: { type: "tween", duration: 0.18 },
|
|
327
|
+
className: "mt-1 overflow-hidden",
|
|
328
|
+
children: /* @__PURE__ */ jsx("div", { className: "rounded-xl border border-slate-200 bg-white shadow-sm dark:border-white/10 dark:bg-white/5", children: children.map((ch) => {
|
|
329
|
+
const active2 = ch.key === activeKey;
|
|
330
|
+
return /* @__PURE__ */ jsx(
|
|
331
|
+
"button",
|
|
332
|
+
{
|
|
333
|
+
onClick: () => go(ch.key),
|
|
334
|
+
className: [
|
|
335
|
+
"block w-full text-left px-3 py-2 text-[14px] transition",
|
|
336
|
+
active2 ? "bg-blue-50 text-blue-700 ring-1 ring-blue-200 dark:bg-blue-900/20 dark:text-blue-200 dark:ring-blue-700/40 rounded-xl" : "text-slate-700 hover:bg-slate-50 dark:text-slate-200 dark:hover:bg-white/10"
|
|
337
|
+
].join(" "),
|
|
338
|
+
children: ch.label
|
|
339
|
+
},
|
|
340
|
+
ch.key
|
|
341
|
+
);
|
|
342
|
+
}) })
|
|
343
|
+
},
|
|
344
|
+
`submenu-${item.key}`
|
|
345
|
+
) })
|
|
346
|
+
] });
|
|
347
|
+
}
|
|
348
|
+
const active = item.key === activeKey;
|
|
349
|
+
return /* @__PURE__ */ jsxs(
|
|
350
|
+
"button",
|
|
351
|
+
{
|
|
352
|
+
onClick: () => go(item.key),
|
|
353
|
+
title: collapsed ? item.label : void 0,
|
|
354
|
+
className: [
|
|
355
|
+
"group flex w-full min-w-0 items-center gap-3 rounded-2xl px-3 py-2 text-left text-[15px] transition",
|
|
356
|
+
active ? "bg-blue-600/20 text-slate-900 ring-1 ring-blue-300 dark:bg-blue-600/25 dark:text-white" : "text-slate-700 hover:bg-slate-100 dark:text-slate-200 dark:hover:bg-white/5",
|
|
357
|
+
collapsed ? "justify-center" : ""
|
|
358
|
+
].join(" "),
|
|
359
|
+
children: [
|
|
360
|
+
/* @__PURE__ */ jsx(
|
|
361
|
+
"span",
|
|
362
|
+
{
|
|
363
|
+
className: [
|
|
364
|
+
"grid h-9 w-9 place-items-center rounded-xl border text-slate-700 transition group-hover:scale-105 dark:text-slate-200",
|
|
365
|
+
active ? "border-blue-300/60 bg-white shadow-sm dark:border-blue-700/40 dark:bg-white/10" : "border-slate-200 bg-white shadow-sm dark:border-white/10 dark:bg-white/5"
|
|
366
|
+
].join(" "),
|
|
367
|
+
children: /* @__PURE__ */ jsx(Icon, { className: "h-5 w-5" })
|
|
368
|
+
}
|
|
369
|
+
),
|
|
370
|
+
!collapsed && /* @__PURE__ */ jsx("span", { className: "truncate", children: item.label })
|
|
371
|
+
]
|
|
372
|
+
}
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
export {
|
|
376
|
+
Sidebar as default
|
|
377
|
+
};
|
package/dist/TimePopover.js
CHANGED
|
@@ -84,12 +84,12 @@ function TimePopover({
|
|
|
84
84
|
if (e.key === "Escape") onClose();
|
|
85
85
|
};
|
|
86
86
|
const onScroll = () => place();
|
|
87
|
-
window.addEventListener("pointerdown", onDown
|
|
87
|
+
window.addEventListener("pointerdown", onDown);
|
|
88
88
|
window.addEventListener("keydown", onKey);
|
|
89
89
|
window.addEventListener("scroll", onScroll, true);
|
|
90
90
|
window.addEventListener("resize", onScroll);
|
|
91
91
|
return () => {
|
|
92
|
-
window.removeEventListener("pointerdown", onDown
|
|
92
|
+
window.removeEventListener("pointerdown", onDown);
|
|
93
93
|
window.removeEventListener("keydown", onKey);
|
|
94
94
|
window.removeEventListener("scroll", onScroll, true);
|
|
95
95
|
window.removeEventListener("resize", onScroll);
|
package/dist/TimePopover.mjs
CHANGED
|
@@ -49,12 +49,12 @@ function TimePopover({
|
|
|
49
49
|
if (e.key === "Escape") onClose();
|
|
50
50
|
};
|
|
51
51
|
const onScroll = () => place();
|
|
52
|
-
window.addEventListener("pointerdown", onDown
|
|
52
|
+
window.addEventListener("pointerdown", onDown);
|
|
53
53
|
window.addEventListener("keydown", onKey);
|
|
54
54
|
window.addEventListener("scroll", onScroll, true);
|
|
55
55
|
window.addEventListener("resize", onScroll);
|
|
56
56
|
return () => {
|
|
57
|
-
window.removeEventListener("pointerdown", onDown
|
|
57
|
+
window.removeEventListener("pointerdown", onDown);
|
|
58
58
|
window.removeEventListener("keydown", onKey);
|
|
59
59
|
window.removeEventListener("scroll", onScroll, true);
|
|
60
60
|
window.removeEventListener("resize", onScroll);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type TimeRange = {
|
|
4
|
+
from: string | null;
|
|
5
|
+
to: string | null;
|
|
6
|
+
};
|
|
7
|
+
type TimeRangeFieldProps = {
|
|
8
|
+
value?: TimeRange;
|
|
9
|
+
onValueChange?: (next: TimeRange) => void;
|
|
10
|
+
portal?: boolean;
|
|
11
|
+
portalId?: string;
|
|
12
|
+
clearable?: boolean;
|
|
13
|
+
step?: number;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
};
|
|
18
|
+
declare function TimeRangeField({ value, onValueChange, portal, portalId, clearable, step, placeholder, className, disabled }: TimeRangeFieldProps): react_jsx_runtime.JSX.Element;
|
|
19
|
+
|
|
20
|
+
export { type TimeRange, type TimeRangeFieldProps, TimeRangeField as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type TimeRange = {
|
|
4
|
+
from: string | null;
|
|
5
|
+
to: string | null;
|
|
6
|
+
};
|
|
7
|
+
type TimeRangeFieldProps = {
|
|
8
|
+
value?: TimeRange;
|
|
9
|
+
onValueChange?: (next: TimeRange) => void;
|
|
10
|
+
portal?: boolean;
|
|
11
|
+
portalId?: string;
|
|
12
|
+
clearable?: boolean;
|
|
13
|
+
step?: number;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
};
|
|
18
|
+
declare function TimeRangeField({ value, onValueChange, portal, portalId, clearable, step, placeholder, className, disabled }: TimeRangeFieldProps): react_jsx_runtime.JSX.Element;
|
|
19
|
+
|
|
20
|
+
export { type TimeRange, type TimeRangeFieldProps, TimeRangeField as default };
|