@mdxui/tremor 6.0.0
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/README.md +255 -0
- package/dist/dashboard/components/index.d.ts +355 -0
- package/dist/dashboard/components/index.js +549 -0
- package/dist/dashboard/components/index.js.map +1 -0
- package/dist/dashboard/index.d.ts +275 -0
- package/dist/dashboard/index.js +1062 -0
- package/dist/dashboard/index.js.map +1 -0
- package/dist/database/index.d.ts +334 -0
- package/dist/database/index.js +474 -0
- package/dist/database/index.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1089 -0
- package/dist/index.js.map +1 -0
- package/dist/insights/components/index.d.ts +362 -0
- package/dist/insights/components/index.js +1397 -0
- package/dist/insights/components/index.js.map +1 -0
- package/dist/insights/index.d.ts +360 -0
- package/dist/insights/index.js +1815 -0
- package/dist/insights/index.js.map +1 -0
- package/dist/overview/components/index.d.ts +86 -0
- package/dist/overview/components/index.js +775 -0
- package/dist/overview/components/index.js.map +1 -0
- package/dist/overview/index.d.ts +301 -0
- package/dist/overview/index.js +1077 -0
- package/dist/overview/index.js.map +1 -0
- package/dist/shared/index.d.ts +296 -0
- package/dist/shared/index.js +395 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/solar/components/index.d.ts +341 -0
- package/dist/solar/components/index.js +831 -0
- package/dist/solar/components/index.js.map +1 -0
- package/dist/solar/index.d.ts +301 -0
- package/dist/solar/index.js +1130 -0
- package/dist/solar/index.js.map +1 -0
- package/package.json +135 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1089 @@
|
|
|
1
|
+
// src/dashboard/components/shell/shell.tsx
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
function Shell({
|
|
5
|
+
variant = "sidebar-left",
|
|
6
|
+
children,
|
|
7
|
+
navigation: _navigation = [],
|
|
8
|
+
shortcuts: _shortcuts = [],
|
|
9
|
+
workspace: _workspace,
|
|
10
|
+
workspaces: _workspaces = [],
|
|
11
|
+
user: _user,
|
|
12
|
+
sidebarCollapsed = false,
|
|
13
|
+
onSidebarCollapse: _onSidebarCollapse,
|
|
14
|
+
pathname: _pathname,
|
|
15
|
+
LinkComponent: _LinkComponent,
|
|
16
|
+
sidebar,
|
|
17
|
+
header,
|
|
18
|
+
theme: _theme = "system",
|
|
19
|
+
loading = false,
|
|
20
|
+
className,
|
|
21
|
+
containerClassName
|
|
22
|
+
}) {
|
|
23
|
+
const showSidebar = variant === "sidebar-left" || variant === "sidebar-right";
|
|
24
|
+
const sidebarWidth = sidebarCollapsed ? "lg:pl-16" : "lg:pl-72";
|
|
25
|
+
if (loading) {
|
|
26
|
+
return /* @__PURE__ */ jsx("div", { className: "flex h-screen items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-gray-300 border-t-indigo-600" }) });
|
|
27
|
+
}
|
|
28
|
+
if (variant === "top-nav") {
|
|
29
|
+
return /* @__PURE__ */ jsxs("div", { className: twMerge("mx-auto max-w-screen-2xl", containerClassName), children: [
|
|
30
|
+
header,
|
|
31
|
+
/* @__PURE__ */ jsx("main", { role: "main", className: twMerge("flex-1", className), children })
|
|
32
|
+
] });
|
|
33
|
+
}
|
|
34
|
+
if (variant === "minimal") {
|
|
35
|
+
return /* @__PURE__ */ jsx("div", { className: twMerge("mx-auto max-w-screen-2xl", containerClassName), children: /* @__PURE__ */ jsx("main", { role: "main", className: twMerge("flex-1", className), children }) });
|
|
36
|
+
}
|
|
37
|
+
return /* @__PURE__ */ jsxs("div", { className: twMerge("mx-auto max-w-screen-2xl", containerClassName), children: [
|
|
38
|
+
sidebar,
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
"main",
|
|
41
|
+
{
|
|
42
|
+
role: "main",
|
|
43
|
+
className: twMerge(showSidebar && sidebarWidth, className),
|
|
44
|
+
children
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
] });
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// src/dashboard/components/shell/shell-sidebar-left.tsx
|
|
51
|
+
import { twMerge as twMerge2 } from "tailwind-merge";
|
|
52
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
53
|
+
function ShellSidebarLeft({
|
|
54
|
+
sidebar,
|
|
55
|
+
mobileHeader,
|
|
56
|
+
children,
|
|
57
|
+
navigation: _navigation = [],
|
|
58
|
+
shortcuts: _shortcuts = [],
|
|
59
|
+
workspace: _workspace,
|
|
60
|
+
workspaces: _workspaces = [],
|
|
61
|
+
user: _user,
|
|
62
|
+
collapsed = false,
|
|
63
|
+
onCollapse: _onCollapse,
|
|
64
|
+
pathname: _pathname,
|
|
65
|
+
LinkComponent: _LinkComponent,
|
|
66
|
+
className,
|
|
67
|
+
containerClassName
|
|
68
|
+
}) {
|
|
69
|
+
const sidebarWidth = collapsed ? "lg:pl-16" : "lg:pl-72";
|
|
70
|
+
return /* @__PURE__ */ jsxs2("div", { className: twMerge2("mx-auto max-w-screen-2xl", containerClassName), children: [
|
|
71
|
+
sidebar && /* @__PURE__ */ jsx2(
|
|
72
|
+
"nav",
|
|
73
|
+
{
|
|
74
|
+
className: twMerge2(
|
|
75
|
+
"hidden lg:fixed lg:inset-y-0 lg:z-50 lg:flex lg:flex-col",
|
|
76
|
+
collapsed ? "lg:w-16" : "lg:w-72"
|
|
77
|
+
),
|
|
78
|
+
children: sidebar
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
mobileHeader && /* @__PURE__ */ jsx2(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
"data-testid": "mobile-header",
|
|
85
|
+
className: "sticky top-0 z-40 flex h-16 shrink-0 items-center justify-between border-b border-gray-200 bg-white px-2 shadow-sm sm:gap-x-6 sm:px-4 lg:hidden dark:border-gray-800 dark:bg-gray-950",
|
|
86
|
+
children: mobileHeader
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ jsx2("main", { role: "main", className: twMerge2(sidebarWidth, className), children })
|
|
90
|
+
] });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// src/dashboard/components/shell/shell-top-nav.tsx
|
|
94
|
+
import { twMerge as twMerge3 } from "tailwind-merge";
|
|
95
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
96
|
+
function ShellTopNav({
|
|
97
|
+
header,
|
|
98
|
+
sidebar,
|
|
99
|
+
children,
|
|
100
|
+
className
|
|
101
|
+
}) {
|
|
102
|
+
return /* @__PURE__ */ jsxs3("div", { className: "flex min-h-screen flex-col", children: [
|
|
103
|
+
header,
|
|
104
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-1", children: [
|
|
105
|
+
sidebar && /* @__PURE__ */ jsx3("aside", { className: "flex-shrink-0", children: sidebar }),
|
|
106
|
+
/* @__PURE__ */ jsx3("main", { role: "main", className: twMerge3("flex-1", className), children })
|
|
107
|
+
] })
|
|
108
|
+
] });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// src/dashboard/utils.ts
|
|
112
|
+
import { twMerge as twMerge4 } from "tailwind-merge";
|
|
113
|
+
function cx(...args) {
|
|
114
|
+
return twMerge4(...args);
|
|
115
|
+
}
|
|
116
|
+
var focusInput = [
|
|
117
|
+
// base
|
|
118
|
+
"focus:ring-2",
|
|
119
|
+
// ring color
|
|
120
|
+
"focus:ring-indigo-200 focus:dark:ring-indigo-700/30",
|
|
121
|
+
// border color
|
|
122
|
+
"focus:border-indigo-500 focus:dark:border-indigo-700"
|
|
123
|
+
].join(" ");
|
|
124
|
+
var focusRing = [
|
|
125
|
+
// base
|
|
126
|
+
"outline outline-offset-2 outline-0 focus-visible:outline-2",
|
|
127
|
+
// outline color
|
|
128
|
+
"outline-indigo-500 dark:outline-indigo-500"
|
|
129
|
+
].join(" ");
|
|
130
|
+
var hasErrorInput = [
|
|
131
|
+
// base
|
|
132
|
+
"ring-2",
|
|
133
|
+
// border color
|
|
134
|
+
"border-red-500 dark:border-red-700",
|
|
135
|
+
// ring color
|
|
136
|
+
"ring-red-200 dark:ring-red-700/30"
|
|
137
|
+
].join(" ");
|
|
138
|
+
|
|
139
|
+
// src/dashboard/components/sidebar/sidebar.tsx
|
|
140
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
141
|
+
function DefaultLink({
|
|
142
|
+
href,
|
|
143
|
+
className,
|
|
144
|
+
children
|
|
145
|
+
}) {
|
|
146
|
+
return /* @__PURE__ */ jsx4("a", { href, className, children });
|
|
147
|
+
}
|
|
148
|
+
function isItemActive(itemHref, pathname, settingsPath = "/settings") {
|
|
149
|
+
if (!itemHref || !pathname) return false;
|
|
150
|
+
if (itemHref === settingsPath) {
|
|
151
|
+
return pathname.startsWith("/settings");
|
|
152
|
+
}
|
|
153
|
+
return pathname === itemHref || pathname.startsWith(itemHref);
|
|
154
|
+
}
|
|
155
|
+
function Sidebar({
|
|
156
|
+
items = [],
|
|
157
|
+
shortcuts = [],
|
|
158
|
+
workspace,
|
|
159
|
+
workspaces = [],
|
|
160
|
+
user,
|
|
161
|
+
collapsed = false,
|
|
162
|
+
onCollapse: _onCollapse,
|
|
163
|
+
header,
|
|
164
|
+
footer,
|
|
165
|
+
className,
|
|
166
|
+
pathname,
|
|
167
|
+
LinkComponent = DefaultLink
|
|
168
|
+
}) {
|
|
169
|
+
return /* @__PURE__ */ jsx4(
|
|
170
|
+
"nav",
|
|
171
|
+
{
|
|
172
|
+
"data-testid": "sidebar",
|
|
173
|
+
className: cx(
|
|
174
|
+
"hidden lg:fixed lg:inset-y-0 lg:z-50 lg:flex lg:flex-col",
|
|
175
|
+
collapsed ? "lg:w-16" : "lg:w-72",
|
|
176
|
+
className
|
|
177
|
+
),
|
|
178
|
+
children: /* @__PURE__ */ jsxs4("aside", { className: "flex grow flex-col gap-y-6 overflow-y-auto border-r border-gray-200 bg-white p-4 dark:border-gray-800 dark:bg-gray-950", children: [
|
|
179
|
+
workspace && /* @__PURE__ */ jsx4(
|
|
180
|
+
WorkspaceSwitcher,
|
|
181
|
+
{
|
|
182
|
+
workspace,
|
|
183
|
+
workspaces,
|
|
184
|
+
collapsed
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
header,
|
|
188
|
+
/* @__PURE__ */ jsxs4(
|
|
189
|
+
"nav",
|
|
190
|
+
{
|
|
191
|
+
"aria-label": "core navigation links",
|
|
192
|
+
className: "flex flex-1 flex-col space-y-10",
|
|
193
|
+
children: [
|
|
194
|
+
/* @__PURE__ */ jsx4("ul", { role: "list", className: "space-y-0.5", children: items.map((item) => {
|
|
195
|
+
const isActive = item.active ?? isItemActive(item.href, pathname);
|
|
196
|
+
const Icon = item.icon;
|
|
197
|
+
return /* @__PURE__ */ jsx4("li", { children: /* @__PURE__ */ jsxs4(
|
|
198
|
+
LinkComponent,
|
|
199
|
+
{
|
|
200
|
+
href: item.href || "#",
|
|
201
|
+
className: cx(
|
|
202
|
+
isActive ? "text-indigo-600 dark:text-indigo-400" : "text-gray-700 hover:text-gray-900 dark:text-gray-400 hover:dark:text-gray-50",
|
|
203
|
+
"flex items-center gap-x-2.5 rounded-md px-2 py-1.5 text-sm font-medium transition hover:bg-gray-100 hover:dark:bg-gray-900",
|
|
204
|
+
focusRing
|
|
205
|
+
),
|
|
206
|
+
"data-testid": "nav-item",
|
|
207
|
+
"data-active": isActive,
|
|
208
|
+
children: [
|
|
209
|
+
Icon && /* @__PURE__ */ jsx4(Icon, { className: "size-4 shrink-0", "aria-hidden": "true" }),
|
|
210
|
+
!collapsed && item.label
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
) }, item.id);
|
|
214
|
+
}) }),
|
|
215
|
+
shortcuts.length > 0 && !collapsed && /* @__PURE__ */ jsxs4("div", { children: [
|
|
216
|
+
/* @__PURE__ */ jsx4("span", { className: "text-xs font-medium leading-6 text-gray-500", children: "Shortcuts" }),
|
|
217
|
+
/* @__PURE__ */ jsx4("ul", { "aria-label": "shortcuts", role: "list", className: "space-y-0.5", children: shortcuts.map((shortcut) => {
|
|
218
|
+
const isActive = isItemActive(shortcut.href, pathname);
|
|
219
|
+
const Icon = shortcut.icon;
|
|
220
|
+
return /* @__PURE__ */ jsx4("li", { children: /* @__PURE__ */ jsxs4(
|
|
221
|
+
LinkComponent,
|
|
222
|
+
{
|
|
223
|
+
href: shortcut.href,
|
|
224
|
+
className: cx(
|
|
225
|
+
isActive ? "text-indigo-600 dark:text-indigo-400" : "text-gray-700 hover:text-gray-900 dark:text-gray-400 hover:dark:text-gray-50",
|
|
226
|
+
"flex items-center gap-x-2.5 rounded-md px-2 py-1.5 text-sm font-medium transition hover:bg-gray-100 hover:dark:bg-gray-900",
|
|
227
|
+
focusRing
|
|
228
|
+
),
|
|
229
|
+
children: [
|
|
230
|
+
Icon && /* @__PURE__ */ jsx4(
|
|
231
|
+
Icon,
|
|
232
|
+
{
|
|
233
|
+
className: "size-4 shrink-0",
|
|
234
|
+
"aria-hidden": "true"
|
|
235
|
+
}
|
|
236
|
+
),
|
|
237
|
+
shortcut.name
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
) }, shortcut.name);
|
|
241
|
+
}) })
|
|
242
|
+
] })
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
),
|
|
246
|
+
user && !footer && /* @__PURE__ */ jsx4("div", { className: "mt-auto", children: /* @__PURE__ */ jsx4(UserProfile, { user, collapsed }) }),
|
|
247
|
+
footer && /* @__PURE__ */ jsx4("div", { className: "mt-auto", children: footer })
|
|
248
|
+
] })
|
|
249
|
+
}
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
function WorkspaceSwitcher({
|
|
253
|
+
workspace,
|
|
254
|
+
workspaces: _workspaces = [],
|
|
255
|
+
collapsed
|
|
256
|
+
}) {
|
|
257
|
+
if (collapsed) {
|
|
258
|
+
return /* @__PURE__ */ jsx4("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx4(
|
|
259
|
+
"span",
|
|
260
|
+
{
|
|
261
|
+
className: cx(
|
|
262
|
+
workspace.color || "bg-indigo-600 dark:bg-indigo-500",
|
|
263
|
+
"flex aspect-square size-8 items-center justify-center rounded p-2 text-xs font-medium text-white"
|
|
264
|
+
),
|
|
265
|
+
"aria-hidden": "true",
|
|
266
|
+
children: workspace.initials
|
|
267
|
+
}
|
|
268
|
+
) });
|
|
269
|
+
}
|
|
270
|
+
return /* @__PURE__ */ jsxs4(
|
|
271
|
+
"button",
|
|
272
|
+
{
|
|
273
|
+
className: cx(
|
|
274
|
+
"flex w-full items-center gap-x-2.5 rounded-md border border-gray-300 bg-white p-2 text-sm shadow-sm transition-all hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950 hover:dark:bg-gray-900",
|
|
275
|
+
"focus:ring-2 focus:ring-indigo-200 focus:border-indigo-500 focus:dark:ring-indigo-700/30 focus:dark:border-indigo-700"
|
|
276
|
+
),
|
|
277
|
+
children: [
|
|
278
|
+
/* @__PURE__ */ jsx4(
|
|
279
|
+
"span",
|
|
280
|
+
{
|
|
281
|
+
className: cx(
|
|
282
|
+
workspace.color || "bg-indigo-600 dark:bg-indigo-500",
|
|
283
|
+
"flex aspect-square size-8 items-center justify-center rounded p-2 text-xs font-medium text-white"
|
|
284
|
+
),
|
|
285
|
+
"aria-hidden": "true",
|
|
286
|
+
children: workspace.initials
|
|
287
|
+
}
|
|
288
|
+
),
|
|
289
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-between gap-x-4 truncate", children: [
|
|
290
|
+
/* @__PURE__ */ jsxs4("div", { className: "truncate", children: [
|
|
291
|
+
/* @__PURE__ */ jsx4("p", { className: "truncate whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-50", children: workspace.name }),
|
|
292
|
+
/* @__PURE__ */ jsx4("p", { className: "whitespace-nowrap text-left text-xs text-gray-700 dark:text-gray-300", children: workspace.role })
|
|
293
|
+
] }),
|
|
294
|
+
/* @__PURE__ */ jsxs4(
|
|
295
|
+
"svg",
|
|
296
|
+
{
|
|
297
|
+
className: "size-5 shrink-0 text-gray-500",
|
|
298
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
299
|
+
viewBox: "0 0 24 24",
|
|
300
|
+
fill: "none",
|
|
301
|
+
stroke: "currentColor",
|
|
302
|
+
strokeWidth: "2",
|
|
303
|
+
strokeLinecap: "round",
|
|
304
|
+
strokeLinejoin: "round",
|
|
305
|
+
children: [
|
|
306
|
+
/* @__PURE__ */ jsx4("path", { d: "m7 15 5 5 5-5" }),
|
|
307
|
+
/* @__PURE__ */ jsx4("path", { d: "m7 9 5-5 5 5" })
|
|
308
|
+
]
|
|
309
|
+
}
|
|
310
|
+
)
|
|
311
|
+
] })
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
function UserProfile({ user, collapsed }) {
|
|
317
|
+
if (collapsed) {
|
|
318
|
+
return /* @__PURE__ */ jsx4(
|
|
319
|
+
"button",
|
|
320
|
+
{
|
|
321
|
+
"aria-label": "User settings",
|
|
322
|
+
className: cx(
|
|
323
|
+
focusRing,
|
|
324
|
+
"flex w-full justify-center rounded-md p-2 text-sm font-medium text-gray-900 hover:bg-gray-100 dark:text-gray-50 hover:dark:bg-gray-400/10"
|
|
325
|
+
),
|
|
326
|
+
children: /* @__PURE__ */ jsx4(
|
|
327
|
+
"span",
|
|
328
|
+
{
|
|
329
|
+
className: "flex size-8 shrink-0 items-center justify-center rounded-full border border-gray-300 bg-white text-xs text-gray-700 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-300",
|
|
330
|
+
"aria-hidden": "true",
|
|
331
|
+
children: user.initials
|
|
332
|
+
}
|
|
333
|
+
)
|
|
334
|
+
}
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
return /* @__PURE__ */ jsxs4(
|
|
338
|
+
"button",
|
|
339
|
+
{
|
|
340
|
+
"aria-label": "User settings",
|
|
341
|
+
className: cx(
|
|
342
|
+
focusRing,
|
|
343
|
+
"group flex w-full items-center justify-between rounded-md p-2 text-sm font-medium text-gray-900 hover:bg-gray-100 data-[state=open]:bg-gray-100 data-[state=open]:bg-gray-400/10 hover:dark:bg-gray-400/10"
|
|
344
|
+
),
|
|
345
|
+
children: [
|
|
346
|
+
/* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-3", children: [
|
|
347
|
+
/* @__PURE__ */ jsx4(
|
|
348
|
+
"span",
|
|
349
|
+
{
|
|
350
|
+
className: "flex size-8 shrink-0 items-center justify-center rounded-full border border-gray-300 bg-white text-xs text-gray-700 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-300",
|
|
351
|
+
"aria-hidden": "true",
|
|
352
|
+
children: user.initials
|
|
353
|
+
}
|
|
354
|
+
),
|
|
355
|
+
/* @__PURE__ */ jsx4("span", { className: "dark:text-gray-50", children: user.name })
|
|
356
|
+
] }),
|
|
357
|
+
/* @__PURE__ */ jsxs4(
|
|
358
|
+
"svg",
|
|
359
|
+
{
|
|
360
|
+
className: "size-4 shrink-0 text-gray-500 group-hover:text-gray-700 group-hover:dark:text-gray-400",
|
|
361
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
362
|
+
viewBox: "0 0 24 24",
|
|
363
|
+
fill: "currentColor",
|
|
364
|
+
children: [
|
|
365
|
+
/* @__PURE__ */ jsx4("circle", { cx: "12", cy: "6", r: "2" }),
|
|
366
|
+
/* @__PURE__ */ jsx4("circle", { cx: "12", cy: "12", r: "2" }),
|
|
367
|
+
/* @__PURE__ */ jsx4("circle", { cx: "12", cy: "18", r: "2" })
|
|
368
|
+
]
|
|
369
|
+
}
|
|
370
|
+
)
|
|
371
|
+
]
|
|
372
|
+
}
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// src/dashboard/pages/settings.tsx
|
|
377
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
378
|
+
var DEFAULT_SECTIONS = [
|
|
379
|
+
"profile",
|
|
380
|
+
"notifications",
|
|
381
|
+
"security",
|
|
382
|
+
"billing",
|
|
383
|
+
"team",
|
|
384
|
+
"api",
|
|
385
|
+
"integrations"
|
|
386
|
+
];
|
|
387
|
+
function ProfileSection({ user }) {
|
|
388
|
+
return /* @__PURE__ */ jsx5(
|
|
389
|
+
"section",
|
|
390
|
+
{
|
|
391
|
+
"aria-labelledby": "profile-heading",
|
|
392
|
+
role: "region",
|
|
393
|
+
"aria-label": "Profile",
|
|
394
|
+
children: /* @__PURE__ */ jsxs5("div", { className: "grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3", children: [
|
|
395
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
396
|
+
/* @__PURE__ */ jsx5(
|
|
397
|
+
"h2",
|
|
398
|
+
{
|
|
399
|
+
id: "profile-heading",
|
|
400
|
+
className: "scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",
|
|
401
|
+
children: "Profile"
|
|
402
|
+
}
|
|
403
|
+
),
|
|
404
|
+
/* @__PURE__ */ jsx5("p", { className: "mt-2 text-sm leading-6 text-gray-500", children: "Manage your personal information and preferences." })
|
|
405
|
+
] }),
|
|
406
|
+
/* @__PURE__ */ jsx5("div", { className: "md:col-span-2", children: /* @__PURE__ */ jsxs5("form", { className: "space-y-4", children: [
|
|
407
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
408
|
+
/* @__PURE__ */ jsx5(
|
|
409
|
+
"label",
|
|
410
|
+
{
|
|
411
|
+
htmlFor: "name",
|
|
412
|
+
className: "block text-sm font-medium text-gray-900 dark:text-gray-50",
|
|
413
|
+
children: "Name"
|
|
414
|
+
}
|
|
415
|
+
),
|
|
416
|
+
/* @__PURE__ */ jsx5(
|
|
417
|
+
"input",
|
|
418
|
+
{
|
|
419
|
+
type: "text",
|
|
420
|
+
id: "name",
|
|
421
|
+
name: "name",
|
|
422
|
+
defaultValue: user?.name || "",
|
|
423
|
+
placeholder: "Your name",
|
|
424
|
+
className: "mt-2 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-50"
|
|
425
|
+
}
|
|
426
|
+
)
|
|
427
|
+
] }),
|
|
428
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
429
|
+
/* @__PURE__ */ jsx5(
|
|
430
|
+
"label",
|
|
431
|
+
{
|
|
432
|
+
htmlFor: "email",
|
|
433
|
+
className: "block text-sm font-medium text-gray-900 dark:text-gray-50",
|
|
434
|
+
children: "Email"
|
|
435
|
+
}
|
|
436
|
+
),
|
|
437
|
+
/* @__PURE__ */ jsx5(
|
|
438
|
+
"input",
|
|
439
|
+
{
|
|
440
|
+
type: "email",
|
|
441
|
+
id: "email",
|
|
442
|
+
name: "email",
|
|
443
|
+
defaultValue: user?.email || "",
|
|
444
|
+
placeholder: "your@email.com",
|
|
445
|
+
className: "mt-2 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-50"
|
|
446
|
+
}
|
|
447
|
+
)
|
|
448
|
+
] }),
|
|
449
|
+
/* @__PURE__ */ jsx5("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx5(
|
|
450
|
+
"button",
|
|
451
|
+
{
|
|
452
|
+
type: "submit",
|
|
453
|
+
className: "rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",
|
|
454
|
+
children: "Save changes"
|
|
455
|
+
}
|
|
456
|
+
) })
|
|
457
|
+
] }) })
|
|
458
|
+
] })
|
|
459
|
+
}
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
function NotificationsSection() {
|
|
463
|
+
return /* @__PURE__ */ jsx5(
|
|
464
|
+
"section",
|
|
465
|
+
{
|
|
466
|
+
"aria-labelledby": "notifications-heading",
|
|
467
|
+
role: "region",
|
|
468
|
+
"aria-label": "Notifications",
|
|
469
|
+
children: /* @__PURE__ */ jsxs5("div", { className: "grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3", children: [
|
|
470
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
471
|
+
/* @__PURE__ */ jsx5(
|
|
472
|
+
"h2",
|
|
473
|
+
{
|
|
474
|
+
id: "notifications-heading",
|
|
475
|
+
className: "scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",
|
|
476
|
+
children: "Notifications"
|
|
477
|
+
}
|
|
478
|
+
),
|
|
479
|
+
/* @__PURE__ */ jsx5("p", { className: "mt-2 text-sm leading-6 text-gray-500", children: "Configure how and when you receive notifications." })
|
|
480
|
+
] }),
|
|
481
|
+
/* @__PURE__ */ jsx5("div", { className: "md:col-span-2", children: /* @__PURE__ */ jsxs5("form", { className: "space-y-4", children: [
|
|
482
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between", children: [
|
|
483
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
484
|
+
/* @__PURE__ */ jsx5("h3", { className: "text-sm font-medium text-gray-900 dark:text-gray-50", children: "Email notifications" }),
|
|
485
|
+
/* @__PURE__ */ jsx5("p", { className: "text-sm text-gray-500", children: "Receive email updates about your account." })
|
|
486
|
+
] }),
|
|
487
|
+
/* @__PURE__ */ jsx5(
|
|
488
|
+
"button",
|
|
489
|
+
{
|
|
490
|
+
type: "button",
|
|
491
|
+
role: "switch",
|
|
492
|
+
"aria-checked": "true",
|
|
493
|
+
className: "relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent bg-blue-600 transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",
|
|
494
|
+
children: /* @__PURE__ */ jsx5("span", { className: "translate-x-5 pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out" })
|
|
495
|
+
}
|
|
496
|
+
)
|
|
497
|
+
] }),
|
|
498
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between", children: [
|
|
499
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
500
|
+
/* @__PURE__ */ jsx5("h3", { className: "text-sm font-medium text-gray-900 dark:text-gray-50", children: "Push notifications" }),
|
|
501
|
+
/* @__PURE__ */ jsx5("p", { className: "text-sm text-gray-500", children: "Receive push notifications on your devices." })
|
|
502
|
+
] }),
|
|
503
|
+
/* @__PURE__ */ jsx5(
|
|
504
|
+
"button",
|
|
505
|
+
{
|
|
506
|
+
type: "button",
|
|
507
|
+
role: "switch",
|
|
508
|
+
"aria-checked": "false",
|
|
509
|
+
className: "relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent bg-gray-200 transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:bg-gray-700",
|
|
510
|
+
children: /* @__PURE__ */ jsx5("span", { className: "translate-x-0 pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out" })
|
|
511
|
+
}
|
|
512
|
+
)
|
|
513
|
+
] })
|
|
514
|
+
] }) })
|
|
515
|
+
] })
|
|
516
|
+
}
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
function SecuritySection() {
|
|
520
|
+
return /* @__PURE__ */ jsx5(
|
|
521
|
+
"section",
|
|
522
|
+
{
|
|
523
|
+
"aria-labelledby": "security-heading",
|
|
524
|
+
role: "region",
|
|
525
|
+
"aria-label": "Security",
|
|
526
|
+
children: /* @__PURE__ */ jsxs5("div", { className: "grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3", children: [
|
|
527
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
528
|
+
/* @__PURE__ */ jsx5(
|
|
529
|
+
"h2",
|
|
530
|
+
{
|
|
531
|
+
id: "security-heading",
|
|
532
|
+
className: "scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",
|
|
533
|
+
children: "Security"
|
|
534
|
+
}
|
|
535
|
+
),
|
|
536
|
+
/* @__PURE__ */ jsx5("p", { className: "mt-2 text-sm leading-6 text-gray-500", children: "Manage your password and security preferences." })
|
|
537
|
+
] }),
|
|
538
|
+
/* @__PURE__ */ jsx5("div", { className: "md:col-span-2", children: /* @__PURE__ */ jsxs5("form", { className: "space-y-4", children: [
|
|
539
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
540
|
+
/* @__PURE__ */ jsx5(
|
|
541
|
+
"label",
|
|
542
|
+
{
|
|
543
|
+
htmlFor: "current-password",
|
|
544
|
+
className: "block text-sm font-medium text-gray-900 dark:text-gray-50",
|
|
545
|
+
children: "Current password"
|
|
546
|
+
}
|
|
547
|
+
),
|
|
548
|
+
/* @__PURE__ */ jsx5(
|
|
549
|
+
"input",
|
|
550
|
+
{
|
|
551
|
+
type: "password",
|
|
552
|
+
id: "current-password",
|
|
553
|
+
name: "current-password",
|
|
554
|
+
placeholder: "Enter current password",
|
|
555
|
+
className: "mt-2 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-50"
|
|
556
|
+
}
|
|
557
|
+
)
|
|
558
|
+
] }),
|
|
559
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
560
|
+
/* @__PURE__ */ jsx5(
|
|
561
|
+
"label",
|
|
562
|
+
{
|
|
563
|
+
htmlFor: "new-password",
|
|
564
|
+
className: "block text-sm font-medium text-gray-900 dark:text-gray-50",
|
|
565
|
+
children: "New password"
|
|
566
|
+
}
|
|
567
|
+
),
|
|
568
|
+
/* @__PURE__ */ jsx5(
|
|
569
|
+
"input",
|
|
570
|
+
{
|
|
571
|
+
type: "password",
|
|
572
|
+
id: "new-password",
|
|
573
|
+
name: "new-password",
|
|
574
|
+
placeholder: "Enter new password",
|
|
575
|
+
className: "mt-2 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-50"
|
|
576
|
+
}
|
|
577
|
+
)
|
|
578
|
+
] }),
|
|
579
|
+
/* @__PURE__ */ jsx5("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx5(
|
|
580
|
+
"button",
|
|
581
|
+
{
|
|
582
|
+
type: "submit",
|
|
583
|
+
className: "rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",
|
|
584
|
+
children: "Update password"
|
|
585
|
+
}
|
|
586
|
+
) })
|
|
587
|
+
] }) })
|
|
588
|
+
] })
|
|
589
|
+
}
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
function AccountSection() {
|
|
593
|
+
return /* @__PURE__ */ jsx5(
|
|
594
|
+
"section",
|
|
595
|
+
{
|
|
596
|
+
"aria-labelledby": "account-heading",
|
|
597
|
+
role: "region",
|
|
598
|
+
"aria-label": "Account",
|
|
599
|
+
children: /* @__PURE__ */ jsxs5("div", { className: "grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3", children: [
|
|
600
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
601
|
+
/* @__PURE__ */ jsx5(
|
|
602
|
+
"h2",
|
|
603
|
+
{
|
|
604
|
+
id: "account-heading",
|
|
605
|
+
className: "scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",
|
|
606
|
+
children: "Account"
|
|
607
|
+
}
|
|
608
|
+
),
|
|
609
|
+
/* @__PURE__ */ jsx5("p", { className: "mt-2 text-sm leading-6 text-gray-500", children: "Manage your account settings and preferences." })
|
|
610
|
+
] }),
|
|
611
|
+
/* @__PURE__ */ jsx5("div", { className: "md:col-span-2", children: /* @__PURE__ */ jsxs5("div", { className: "space-y-6", children: [
|
|
612
|
+
/* @__PURE__ */ jsxs5("div", { className: "rounded-md border border-gray-200 p-4 dark:border-gray-700", children: [
|
|
613
|
+
/* @__PURE__ */ jsx5("h3", { className: "text-sm font-medium text-gray-900 dark:text-gray-50", children: "Export data" }),
|
|
614
|
+
/* @__PURE__ */ jsx5("p", { className: "mt-1 text-sm text-gray-500", children: "Download a copy of all your data." }),
|
|
615
|
+
/* @__PURE__ */ jsx5(
|
|
616
|
+
"button",
|
|
617
|
+
{
|
|
618
|
+
type: "button",
|
|
619
|
+
className: "mt-3 rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",
|
|
620
|
+
children: "Export data"
|
|
621
|
+
}
|
|
622
|
+
)
|
|
623
|
+
] }),
|
|
624
|
+
/* @__PURE__ */ jsxs5("div", { className: "rounded-md border border-red-200 p-4 dark:border-red-900", children: [
|
|
625
|
+
/* @__PURE__ */ jsx5("h3", { className: "text-sm font-medium text-red-700 dark:text-red-400", children: "Delete account" }),
|
|
626
|
+
/* @__PURE__ */ jsx5("p", { className: "mt-1 text-sm text-gray-500", children: "Permanently delete your account and all associated data." }),
|
|
627
|
+
/* @__PURE__ */ jsx5(
|
|
628
|
+
"button",
|
|
629
|
+
{
|
|
630
|
+
type: "button",
|
|
631
|
+
className: "mt-3 rounded-md bg-red-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2",
|
|
632
|
+
children: "Delete account"
|
|
633
|
+
}
|
|
634
|
+
)
|
|
635
|
+
] })
|
|
636
|
+
] }) })
|
|
637
|
+
] })
|
|
638
|
+
}
|
|
639
|
+
);
|
|
640
|
+
}
|
|
641
|
+
function Divider() {
|
|
642
|
+
return /* @__PURE__ */ jsx5("hr", { className: "my-10 border-gray-200 dark:border-gray-800" });
|
|
643
|
+
}
|
|
644
|
+
function Settings({
|
|
645
|
+
sections = DEFAULT_SECTIONS,
|
|
646
|
+
user,
|
|
647
|
+
children
|
|
648
|
+
}) {
|
|
649
|
+
const sectionComponents = {
|
|
650
|
+
profile: /* @__PURE__ */ jsx5(ProfileSection, { user }, "profile"),
|
|
651
|
+
notifications: /* @__PURE__ */ jsx5(NotificationsSection, {}, "notifications"),
|
|
652
|
+
security: /* @__PURE__ */ jsx5(SecuritySection, {}, "security"),
|
|
653
|
+
billing: null,
|
|
654
|
+
// Placeholder for future implementation
|
|
655
|
+
team: null,
|
|
656
|
+
// Placeholder for future implementation
|
|
657
|
+
api: null,
|
|
658
|
+
// Placeholder for future implementation
|
|
659
|
+
integrations: null
|
|
660
|
+
// Placeholder for future implementation
|
|
661
|
+
};
|
|
662
|
+
const showAccount = sections?.length === void 0 || sections.length === DEFAULT_SECTIONS?.length;
|
|
663
|
+
const activeSections = (sections || DEFAULT_SECTIONS || []).map((section) => sectionComponents[section]).filter((component) => component !== null);
|
|
664
|
+
return /* @__PURE__ */ jsxs5("div", { className: "min-h-dvh bg-white p-4 sm:p-6 lg:rounded-lg lg:border lg:border-gray-200 dark:bg-gray-925 lg:dark:border-gray-900", children: [
|
|
665
|
+
/* @__PURE__ */ jsx5("h1", { className: "text-lg font-semibold text-gray-900 dark:text-gray-50", children: "Settings" }),
|
|
666
|
+
/* @__PURE__ */ jsxs5("div", { "data-testid": "settings-content", className: "mt-8 space-y-0", children: [
|
|
667
|
+
activeSections.map((component, index) => /* @__PURE__ */ jsxs5("div", { children: [
|
|
668
|
+
index > 0 && /* @__PURE__ */ jsx5(Divider, {}),
|
|
669
|
+
component
|
|
670
|
+
] }, index)),
|
|
671
|
+
showAccount && /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
672
|
+
activeSections.length > 0 && /* @__PURE__ */ jsx5(Divider, {}),
|
|
673
|
+
/* @__PURE__ */ jsx5(AccountSection, {})
|
|
674
|
+
] })
|
|
675
|
+
] }),
|
|
676
|
+
children
|
|
677
|
+
] });
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
// src/dashboard/index.ts
|
|
681
|
+
var components = {
|
|
682
|
+
Shell,
|
|
683
|
+
ShellSidebarLeft,
|
|
684
|
+
ShellTopNav,
|
|
685
|
+
Sidebar,
|
|
686
|
+
Settings
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
// src/shared/adapters/chart-adapter.ts
|
|
690
|
+
function adaptAreaChartProps(props) {
|
|
691
|
+
const {
|
|
692
|
+
data,
|
|
693
|
+
index,
|
|
694
|
+
categories,
|
|
695
|
+
colors,
|
|
696
|
+
valueFormatter,
|
|
697
|
+
startEndOnly,
|
|
698
|
+
showLegend,
|
|
699
|
+
showGridLines,
|
|
700
|
+
showAnimation,
|
|
701
|
+
stack,
|
|
702
|
+
curveType,
|
|
703
|
+
connectNulls,
|
|
704
|
+
yAxisWidth,
|
|
705
|
+
minValue,
|
|
706
|
+
maxValue,
|
|
707
|
+
className
|
|
708
|
+
} = props;
|
|
709
|
+
return {
|
|
710
|
+
data,
|
|
711
|
+
index,
|
|
712
|
+
categories,
|
|
713
|
+
colors,
|
|
714
|
+
valueFormatter,
|
|
715
|
+
startEndOnly,
|
|
716
|
+
showLegend,
|
|
717
|
+
showGridLines,
|
|
718
|
+
showAnimation,
|
|
719
|
+
stack,
|
|
720
|
+
curveType,
|
|
721
|
+
connectNulls,
|
|
722
|
+
yAxisWidth,
|
|
723
|
+
minValue,
|
|
724
|
+
maxValue,
|
|
725
|
+
className
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
function adaptBarChartProps(props) {
|
|
729
|
+
const {
|
|
730
|
+
data,
|
|
731
|
+
index,
|
|
732
|
+
categories,
|
|
733
|
+
colors,
|
|
734
|
+
valueFormatter,
|
|
735
|
+
layout,
|
|
736
|
+
stack,
|
|
737
|
+
relative,
|
|
738
|
+
showLegend,
|
|
739
|
+
showGridLines,
|
|
740
|
+
showAnimation,
|
|
741
|
+
yAxisWidth,
|
|
742
|
+
barCategoryGap,
|
|
743
|
+
className
|
|
744
|
+
} = props;
|
|
745
|
+
return {
|
|
746
|
+
data,
|
|
747
|
+
index,
|
|
748
|
+
categories,
|
|
749
|
+
colors,
|
|
750
|
+
valueFormatter,
|
|
751
|
+
layout,
|
|
752
|
+
stack,
|
|
753
|
+
relative,
|
|
754
|
+
showLegend,
|
|
755
|
+
showGridLines,
|
|
756
|
+
showAnimation,
|
|
757
|
+
yAxisWidth,
|
|
758
|
+
barCategoryGap,
|
|
759
|
+
className
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
function adaptLineChartProps(props) {
|
|
763
|
+
const {
|
|
764
|
+
data,
|
|
765
|
+
index,
|
|
766
|
+
categories,
|
|
767
|
+
colors,
|
|
768
|
+
valueFormatter,
|
|
769
|
+
curveType,
|
|
770
|
+
connectNulls,
|
|
771
|
+
showDots,
|
|
772
|
+
showLegend,
|
|
773
|
+
showGridLines,
|
|
774
|
+
showAnimation,
|
|
775
|
+
yAxisWidth,
|
|
776
|
+
className
|
|
777
|
+
} = props;
|
|
778
|
+
return {
|
|
779
|
+
data,
|
|
780
|
+
index,
|
|
781
|
+
categories,
|
|
782
|
+
colors,
|
|
783
|
+
valueFormatter,
|
|
784
|
+
curveType,
|
|
785
|
+
connectNulls,
|
|
786
|
+
showDots,
|
|
787
|
+
showLegend,
|
|
788
|
+
showGridLines,
|
|
789
|
+
showAnimation,
|
|
790
|
+
yAxisWidth,
|
|
791
|
+
className
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
function adaptDonutChartProps(props) {
|
|
795
|
+
const {
|
|
796
|
+
data,
|
|
797
|
+
category,
|
|
798
|
+
value,
|
|
799
|
+
colors,
|
|
800
|
+
variant,
|
|
801
|
+
label,
|
|
802
|
+
showLegend,
|
|
803
|
+
showTooltip,
|
|
804
|
+
animationDuration,
|
|
805
|
+
valueFormatter,
|
|
806
|
+
className
|
|
807
|
+
} = props;
|
|
808
|
+
return {
|
|
809
|
+
data,
|
|
810
|
+
category,
|
|
811
|
+
value,
|
|
812
|
+
colors,
|
|
813
|
+
variant,
|
|
814
|
+
label,
|
|
815
|
+
showLegend,
|
|
816
|
+
showTooltip,
|
|
817
|
+
animationDuration,
|
|
818
|
+
valueFormatter,
|
|
819
|
+
className
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
function adaptSparkChartProps(props) {
|
|
823
|
+
const { data, type, color, showMinMax, height, width, animate, className } = props;
|
|
824
|
+
return {
|
|
825
|
+
data,
|
|
826
|
+
type,
|
|
827
|
+
color,
|
|
828
|
+
showMinMax,
|
|
829
|
+
height,
|
|
830
|
+
width,
|
|
831
|
+
animate,
|
|
832
|
+
className
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
// src/shared/adapters/metric-adapter.ts
|
|
837
|
+
function adaptMetricCardProps(props) {
|
|
838
|
+
const { title, value, delta, deltaType, decorationColor, icon, className } = props;
|
|
839
|
+
return {
|
|
840
|
+
title,
|
|
841
|
+
value,
|
|
842
|
+
delta: delta ? {
|
|
843
|
+
value: delta.value,
|
|
844
|
+
type: delta.type,
|
|
845
|
+
isIncreasePositive: delta.isIncreasePositive
|
|
846
|
+
} : void 0,
|
|
847
|
+
deltaType,
|
|
848
|
+
decorationColor,
|
|
849
|
+
icon,
|
|
850
|
+
className
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
function adaptAnalyticsCardProps(props) {
|
|
854
|
+
const {
|
|
855
|
+
title,
|
|
856
|
+
description,
|
|
857
|
+
metric,
|
|
858
|
+
subtext,
|
|
859
|
+
chartType,
|
|
860
|
+
chartData,
|
|
861
|
+
chartConfig,
|
|
862
|
+
timeRange,
|
|
863
|
+
showTimeRangeSelector,
|
|
864
|
+
loading,
|
|
865
|
+
className
|
|
866
|
+
} = props;
|
|
867
|
+
return {
|
|
868
|
+
title,
|
|
869
|
+
description,
|
|
870
|
+
metric,
|
|
871
|
+
subtext,
|
|
872
|
+
chartType,
|
|
873
|
+
chartData,
|
|
874
|
+
chartConfig,
|
|
875
|
+
timeRange,
|
|
876
|
+
showTimeRangeSelector,
|
|
877
|
+
loading,
|
|
878
|
+
className
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
function adaptCategoryBarProps(props) {
|
|
882
|
+
const {
|
|
883
|
+
values,
|
|
884
|
+
colors,
|
|
885
|
+
labels,
|
|
886
|
+
markerValue,
|
|
887
|
+
showMarker,
|
|
888
|
+
showLabels,
|
|
889
|
+
showValues,
|
|
890
|
+
height,
|
|
891
|
+
className
|
|
892
|
+
} = props;
|
|
893
|
+
return {
|
|
894
|
+
values,
|
|
895
|
+
colors,
|
|
896
|
+
labels,
|
|
897
|
+
markerValue,
|
|
898
|
+
showMarker,
|
|
899
|
+
showLabels,
|
|
900
|
+
showValues,
|
|
901
|
+
height,
|
|
902
|
+
className
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
function adaptBarListProps(props) {
|
|
906
|
+
const { data, valueFormatter, color, showAnimation, sortOrder, className } = props;
|
|
907
|
+
return {
|
|
908
|
+
data,
|
|
909
|
+
valueFormatter,
|
|
910
|
+
color,
|
|
911
|
+
showAnimation,
|
|
912
|
+
sortOrder,
|
|
913
|
+
className
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
function adaptTrackerProps(props) {
|
|
917
|
+
const { data, className } = props;
|
|
918
|
+
return {
|
|
919
|
+
data,
|
|
920
|
+
className
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
function adaptDeltaBarProps(props) {
|
|
924
|
+
const { value, showAnimation, positiveColor, negativeColor, className } = props;
|
|
925
|
+
return {
|
|
926
|
+
value,
|
|
927
|
+
showAnimation,
|
|
928
|
+
positiveColor,
|
|
929
|
+
negativeColor,
|
|
930
|
+
className
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
function formatDelta(value, type = "percentage") {
|
|
934
|
+
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
|
935
|
+
const sign = numValue >= 0 ? "+" : "";
|
|
936
|
+
if (type === "percentage") {
|
|
937
|
+
return `${sign}${numValue.toFixed(1)}%`;
|
|
938
|
+
}
|
|
939
|
+
return `${sign}${numValue}`;
|
|
940
|
+
}
|
|
941
|
+
function getTrendFromDelta(value) {
|
|
942
|
+
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
|
943
|
+
if (numValue > 0) return "up";
|
|
944
|
+
if (numValue < 0) return "down";
|
|
945
|
+
return "unchanged";
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
// src/shared/adapters/table-adapter.ts
|
|
949
|
+
function adaptTransactionsListProps(props) {
|
|
950
|
+
const {
|
|
951
|
+
transactions,
|
|
952
|
+
title,
|
|
953
|
+
currency,
|
|
954
|
+
valueFormatter,
|
|
955
|
+
showCategoryFilter,
|
|
956
|
+
showDateFilter,
|
|
957
|
+
showExport,
|
|
958
|
+
pageSize,
|
|
959
|
+
emptyMessage,
|
|
960
|
+
loading,
|
|
961
|
+
className
|
|
962
|
+
} = props;
|
|
963
|
+
return {
|
|
964
|
+
data: transactions,
|
|
965
|
+
title,
|
|
966
|
+
currency,
|
|
967
|
+
valueFormatter,
|
|
968
|
+
showCategoryFilter,
|
|
969
|
+
showDateFilter,
|
|
970
|
+
showExport,
|
|
971
|
+
pageSize,
|
|
972
|
+
emptyMessage,
|
|
973
|
+
loading,
|
|
974
|
+
className
|
|
975
|
+
};
|
|
976
|
+
}
|
|
977
|
+
function adaptAuditLogTableProps(props) {
|
|
978
|
+
const {
|
|
979
|
+
logs,
|
|
980
|
+
title,
|
|
981
|
+
searchable,
|
|
982
|
+
filterByActor,
|
|
983
|
+
filterByAction,
|
|
984
|
+
filterByResource,
|
|
985
|
+
showDateRange,
|
|
986
|
+
showExport,
|
|
987
|
+
pageSize,
|
|
988
|
+
loading,
|
|
989
|
+
className
|
|
990
|
+
} = props;
|
|
991
|
+
return {
|
|
992
|
+
data: logs,
|
|
993
|
+
title,
|
|
994
|
+
searchable,
|
|
995
|
+
filterByActor,
|
|
996
|
+
filterByAction,
|
|
997
|
+
filterByResource,
|
|
998
|
+
showDateRange,
|
|
999
|
+
showExport,
|
|
1000
|
+
pageSize,
|
|
1001
|
+
loading,
|
|
1002
|
+
className
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
function createTransactionColumns(currency = "USD") {
|
|
1006
|
+
return [
|
|
1007
|
+
{
|
|
1008
|
+
accessorKey: "date",
|
|
1009
|
+
header: "Date",
|
|
1010
|
+
cell: (info) => new Date(info.getValue()).toLocaleDateString()
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
accessorKey: "description",
|
|
1014
|
+
header: "Description"
|
|
1015
|
+
},
|
|
1016
|
+
{
|
|
1017
|
+
accessorKey: "amount",
|
|
1018
|
+
header: "Amount",
|
|
1019
|
+
cell: (info) => {
|
|
1020
|
+
const value = info.getValue();
|
|
1021
|
+
const type = info.row.original.type;
|
|
1022
|
+
const formatted = new Intl.NumberFormat("en-US", {
|
|
1023
|
+
style: "currency",
|
|
1024
|
+
currency
|
|
1025
|
+
}).format(Math.abs(value));
|
|
1026
|
+
return type === "debit" ? `-${formatted}` : formatted;
|
|
1027
|
+
}
|
|
1028
|
+
},
|
|
1029
|
+
{
|
|
1030
|
+
accessorKey: "status",
|
|
1031
|
+
header: "Status"
|
|
1032
|
+
},
|
|
1033
|
+
{
|
|
1034
|
+
accessorKey: "category",
|
|
1035
|
+
header: "Category"
|
|
1036
|
+
}
|
|
1037
|
+
];
|
|
1038
|
+
}
|
|
1039
|
+
function createAuditLogColumns() {
|
|
1040
|
+
return [
|
|
1041
|
+
{
|
|
1042
|
+
accessorKey: "timestamp",
|
|
1043
|
+
header: "Time",
|
|
1044
|
+
cell: (info) => new Date(info.getValue()).toLocaleString()
|
|
1045
|
+
},
|
|
1046
|
+
{
|
|
1047
|
+
accessorKey: "actor.name",
|
|
1048
|
+
header: "User"
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
accessorKey: "action",
|
|
1052
|
+
header: "Action"
|
|
1053
|
+
},
|
|
1054
|
+
{
|
|
1055
|
+
accessorKey: "resource.type",
|
|
1056
|
+
header: "Resource"
|
|
1057
|
+
},
|
|
1058
|
+
{
|
|
1059
|
+
accessorKey: "resource.name",
|
|
1060
|
+
header: "Name"
|
|
1061
|
+
}
|
|
1062
|
+
];
|
|
1063
|
+
}
|
|
1064
|
+
export {
|
|
1065
|
+
Settings as DashboardSettings,
|
|
1066
|
+
Shell as DashboardShell,
|
|
1067
|
+
ShellSidebarLeft as DashboardShellSidebarLeft,
|
|
1068
|
+
ShellTopNav as DashboardShellTopNav,
|
|
1069
|
+
Sidebar as DashboardSidebar,
|
|
1070
|
+
adaptAnalyticsCardProps,
|
|
1071
|
+
adaptAreaChartProps,
|
|
1072
|
+
adaptAuditLogTableProps,
|
|
1073
|
+
adaptBarChartProps,
|
|
1074
|
+
adaptBarListProps,
|
|
1075
|
+
adaptCategoryBarProps,
|
|
1076
|
+
adaptDeltaBarProps,
|
|
1077
|
+
adaptDonutChartProps,
|
|
1078
|
+
adaptLineChartProps,
|
|
1079
|
+
adaptMetricCardProps,
|
|
1080
|
+
adaptSparkChartProps,
|
|
1081
|
+
adaptTrackerProps,
|
|
1082
|
+
adaptTransactionsListProps,
|
|
1083
|
+
createAuditLogColumns,
|
|
1084
|
+
createTransactionColumns,
|
|
1085
|
+
components as dashboardComponents,
|
|
1086
|
+
formatDelta,
|
|
1087
|
+
getTrendFromDelta
|
|
1088
|
+
};
|
|
1089
|
+
//# sourceMappingURL=index.js.map
|