klun-ui 0.2.0 → 0.2.2
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/CHANGELOG.md +50 -0
- package/README.md +2 -2
- package/dist/styles.css +19 -19
- package/dist/templates/index.cjs +2498 -9
- package/dist/templates/index.cjs.map +1 -1
- package/dist/templates/index.d.cts +142 -1
- package/dist/templates/index.d.ts +142 -1
- package/dist/templates/index.js +2480 -13
- package/dist/templates/index.js.map +1 -1
- package/package.json +3 -2
package/dist/templates/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Badge, Button, SegmentedControl, Card, Tabs, ProgressBar, Input, Select, Switch, Divider, AvatarGroup, HorizontalFilter, ContentLabel, Chip, Alert, Accordion, Label,
|
|
1
|
+
import { Badge, Button, SegmentedControl, Card, Tabs, ProgressBar, Input, Select, Switch, Divider, AvatarGroup, HorizontalFilter, ContentLabel, Chip, Alert, Accordion, Avatar, Table, CounterInput, Money, Breadcrumb, Wizard, Dropdown, Modal, Label, Checkbox, Textarea, RelativeTime, Confirm, StatusDot, ImageUpload, SelectMenu, CharacterCounter, Drawer, Spinner } from '../chunk-UJOMGMCV.js';
|
|
2
2
|
import '../chunk-T225J6LV.js';
|
|
3
|
-
import { useState, useRef, useEffect } from 'react';
|
|
4
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useRef, useEffect, useId, useMemo } from 'react';
|
|
4
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
function Sidebar({ active, onNavigate, user }) {
|
|
7
7
|
const main = [
|
|
@@ -168,7 +168,7 @@ function OverviewScreen() {
|
|
|
168
168
|
function SettingsScreen() {
|
|
169
169
|
const [n, setN] = useState(true);
|
|
170
170
|
const [m, setM] = useState(false);
|
|
171
|
-
const
|
|
171
|
+
const Field4 = ({ label, children, hint, required }) => /* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "220px 1fr", gap: 24, padding: "20px 0", borderTop: "1px solid var(--klun-stroke-soft-200)" }, children: [
|
|
172
172
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
173
173
|
/* @__PURE__ */ jsx(Label, { required, children: label }),
|
|
174
174
|
hint ? /* @__PURE__ */ jsx("div", { style: { marginTop: 2, font: "var(--klun-text-paragraph-xs)", color: "var(--klun-text-soft-400)" }, children: hint }) : null
|
|
@@ -188,14 +188,14 @@ function SettingsScreen() {
|
|
|
188
188
|
/* @__PURE__ */ jsx(Button, { variant: "neutral", appearance: "stroke", size: "small", leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-upload-2-line" }), children: "Change photo" })
|
|
189
189
|
] }),
|
|
190
190
|
/* @__PURE__ */ jsxs("div", { style: { marginTop: 8 }, children: [
|
|
191
|
-
/* @__PURE__ */ jsx(
|
|
192
|
-
/* @__PURE__ */ jsx(
|
|
193
|
-
/* @__PURE__ */ jsx(
|
|
191
|
+
/* @__PURE__ */ jsx(Field4, { label: "Full name", required: true, children: /* @__PURE__ */ jsx(Input, { defaultValue: "Arthur Taylor" }) }),
|
|
192
|
+
/* @__PURE__ */ jsx(Field4, { label: "Email address", required: true, hint: "Used for sign-in and receipts.", children: /* @__PURE__ */ jsx(Input, { type: "email", defaultValue: "arthur@alignui.com", leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-mail-line" }) }) }),
|
|
193
|
+
/* @__PURE__ */ jsx(Field4, { label: "Role", children: /* @__PURE__ */ jsxs(Select, { defaultValue: "finance", children: [
|
|
194
194
|
/* @__PURE__ */ jsx("option", { value: "finance", children: "Finance lead" }),
|
|
195
195
|
/* @__PURE__ */ jsx("option", { value: "admin", children: "Administrator" }),
|
|
196
196
|
/* @__PURE__ */ jsx("option", { value: "member", children: "Member" })
|
|
197
197
|
] }) }),
|
|
198
|
-
/* @__PURE__ */ jsx(
|
|
198
|
+
/* @__PURE__ */ jsx(Field4, { label: "Notifications", hint: "How we reach you.", children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 14 }, children: [
|
|
199
199
|
/* @__PURE__ */ jsxs("label", { style: { display: "flex", alignItems: "center", gap: 10, font: "var(--klun-text-label-sm)", color: "var(--klun-text-strong-950)" }, children: [
|
|
200
200
|
/* @__PURE__ */ jsx(Switch, { checked: n, onChange: setN }),
|
|
201
201
|
" Email notifications"
|
|
@@ -422,13 +422,13 @@ var REPLIES = [
|
|
|
422
422
|
"Got it. I've blocked focus time around your 3 deadlines and left buffers for review. Shall I add them to your calendar?"
|
|
423
423
|
];
|
|
424
424
|
function AIAssistantTemplate() {
|
|
425
|
-
const
|
|
425
|
+
const seed2 = [
|
|
426
426
|
{ id: "c1", group: "today", title: "Q2 revenue breakdown" },
|
|
427
427
|
{ id: "c2", group: "today", title: "Follow-up email draft" },
|
|
428
428
|
{ id: "c3", group: "week", title: "Invoice reminders" },
|
|
429
429
|
{ id: "c4", group: "week", title: "Weekly planning" }
|
|
430
430
|
];
|
|
431
|
-
const [convs] = useState(
|
|
431
|
+
const [convs] = useState(seed2);
|
|
432
432
|
const [activeId, setActiveId] = useState("new");
|
|
433
433
|
const [threads, setThreads] = useState({ new: [] });
|
|
434
434
|
const [busy, setBusy] = useState(false);
|
|
@@ -883,9 +883,9 @@ function AgentTurn({ msg }) {
|
|
|
883
883
|
] })
|
|
884
884
|
] });
|
|
885
885
|
}
|
|
886
|
-
function UserTurn({ msg, initials }) {
|
|
886
|
+
function UserTurn({ msg, initials: initials4 }) {
|
|
887
887
|
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "row-reverse", gap: 12, alignItems: "flex-start" }, children: [
|
|
888
|
-
/* @__PURE__ */ jsx(Avatar, { size: "32", initials, color: "purple" }),
|
|
888
|
+
/* @__PURE__ */ jsx(Avatar, { size: "32", initials: initials4, color: "purple" }),
|
|
889
889
|
/* @__PURE__ */ jsx(
|
|
890
890
|
"div",
|
|
891
891
|
{
|
|
@@ -2078,7 +2078,2474 @@ function SettingsTemplate() {
|
|
|
2078
2078
|
tab === "profile" ? /* @__PURE__ */ jsx(ProfileTab, {}) : tab === "notifications" ? /* @__PURE__ */ jsx(NotificationsTab, {}) : /* @__PURE__ */ jsx(IntegrationsTab, {})
|
|
2079
2079
|
] });
|
|
2080
2080
|
}
|
|
2081
|
+
var ITEMS = [
|
|
2082
|
+
{ key: "dashboard", label: "Dashboard", icon: "ri-dashboard-line" },
|
|
2083
|
+
{ key: "orders", label: "Orders", icon: "ri-shopping-bag-line", badge: "5" },
|
|
2084
|
+
{ key: "products", label: "Products", icon: "ri-archive-line" },
|
|
2085
|
+
{ key: "customers", label: "Customers", icon: "ri-team-line" },
|
|
2086
|
+
{ key: "users", label: "Users", icon: "ri-user-3-line" },
|
|
2087
|
+
{ key: "roles", label: "Roles", icon: "ri-shield-keyhole-line" },
|
|
2088
|
+
{
|
|
2089
|
+
key: "reports",
|
|
2090
|
+
label: "Reports",
|
|
2091
|
+
icon: "ri-bar-chart-box-line",
|
|
2092
|
+
children: [
|
|
2093
|
+
{ key: "sales", label: "Sales" },
|
|
2094
|
+
{ key: "traffic", label: "Traffic" }
|
|
2095
|
+
]
|
|
2096
|
+
},
|
|
2097
|
+
{ key: "settings", label: "Settings", icon: "ri-settings-3-line" }
|
|
2098
|
+
];
|
|
2099
|
+
function MetronicSidebar({ active, onNavigate }) {
|
|
2100
|
+
const [reportsOpen, setReportsOpen] = useState(false);
|
|
2101
|
+
const Item = ({ item }) => {
|
|
2102
|
+
const on = active === item.key;
|
|
2103
|
+
const hasKids = Boolean(item.children?.length);
|
|
2104
|
+
return /* @__PURE__ */ jsxs(
|
|
2105
|
+
"button",
|
|
2106
|
+
{
|
|
2107
|
+
onClick: () => {
|
|
2108
|
+
if (hasKids) setReportsOpen((o) => !o);
|
|
2109
|
+
else onNavigate(item.key);
|
|
2110
|
+
},
|
|
2111
|
+
style: {
|
|
2112
|
+
display: "flex",
|
|
2113
|
+
alignItems: "center",
|
|
2114
|
+
gap: 10,
|
|
2115
|
+
width: "100%",
|
|
2116
|
+
height: 38,
|
|
2117
|
+
padding: "0 12px",
|
|
2118
|
+
border: "none",
|
|
2119
|
+
borderRadius: "var(--klun-radius-lg)",
|
|
2120
|
+
cursor: "pointer",
|
|
2121
|
+
textAlign: "left",
|
|
2122
|
+
background: on ? "var(--klun-primary-lighter)" : "transparent",
|
|
2123
|
+
color: on ? "var(--klun-primary-base)" : "var(--klun-text-sub-600)",
|
|
2124
|
+
font: "var(--klun-text-label-sm)"
|
|
2125
|
+
},
|
|
2126
|
+
children: [
|
|
2127
|
+
/* @__PURE__ */ jsx(
|
|
2128
|
+
"i",
|
|
2129
|
+
{
|
|
2130
|
+
className: item.icon,
|
|
2131
|
+
style: { fontSize: 19, color: on ? "var(--klun-primary-base)" : "var(--klun-icon-sub-600)" }
|
|
2132
|
+
}
|
|
2133
|
+
),
|
|
2134
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 }, children: item.label }),
|
|
2135
|
+
item.badge ? /* @__PURE__ */ jsx(
|
|
2136
|
+
"span",
|
|
2137
|
+
{
|
|
2138
|
+
style: {
|
|
2139
|
+
font: "var(--klun-text-label-xs)",
|
|
2140
|
+
padding: "1px 7px",
|
|
2141
|
+
borderRadius: "var(--klun-radius-pill)",
|
|
2142
|
+
background: "var(--klun-bg-weak-50)",
|
|
2143
|
+
color: "var(--klun-text-sub-600)"
|
|
2144
|
+
},
|
|
2145
|
+
children: item.badge
|
|
2146
|
+
}
|
|
2147
|
+
) : null,
|
|
2148
|
+
hasKids ? /* @__PURE__ */ jsx(
|
|
2149
|
+
"i",
|
|
2150
|
+
{
|
|
2151
|
+
className: "ri-arrow-down-s-line",
|
|
2152
|
+
style: { fontSize: 16, transform: reportsOpen ? "rotate(180deg)" : "none", transition: "transform .15s ease" }
|
|
2153
|
+
}
|
|
2154
|
+
) : null
|
|
2155
|
+
]
|
|
2156
|
+
}
|
|
2157
|
+
);
|
|
2158
|
+
};
|
|
2159
|
+
return /* @__PURE__ */ jsxs(
|
|
2160
|
+
"aside",
|
|
2161
|
+
{
|
|
2162
|
+
style: {
|
|
2163
|
+
width: 248,
|
|
2164
|
+
flexShrink: 0,
|
|
2165
|
+
height: "100%",
|
|
2166
|
+
boxSizing: "border-box",
|
|
2167
|
+
display: "flex",
|
|
2168
|
+
flexDirection: "column",
|
|
2169
|
+
gap: 14,
|
|
2170
|
+
padding: "16px 12px",
|
|
2171
|
+
background: "var(--klun-bg-white-0)",
|
|
2172
|
+
borderRight: "1px solid var(--klun-stroke-soft-200)"
|
|
2173
|
+
},
|
|
2174
|
+
children: [
|
|
2175
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10, padding: "4px 8px 6px" }, children: [
|
|
2176
|
+
/* @__PURE__ */ jsx(
|
|
2177
|
+
"span",
|
|
2178
|
+
{
|
|
2179
|
+
style: {
|
|
2180
|
+
width: 30,
|
|
2181
|
+
height: 30,
|
|
2182
|
+
borderRadius: "var(--klun-radius-md)",
|
|
2183
|
+
background: "var(--klun-primary-base)",
|
|
2184
|
+
color: "var(--klun-text-white-0)",
|
|
2185
|
+
display: "inline-flex",
|
|
2186
|
+
alignItems: "center",
|
|
2187
|
+
justifyContent: "center",
|
|
2188
|
+
font: "var(--klun-text-label-md)"
|
|
2189
|
+
},
|
|
2190
|
+
children: "M"
|
|
2191
|
+
}
|
|
2192
|
+
),
|
|
2193
|
+
/* @__PURE__ */ jsx("b", { style: { font: "var(--klun-text-label-md)", color: "var(--klun-text-strong-950)" }, children: "Metronic" })
|
|
2194
|
+
] }),
|
|
2195
|
+
/* @__PURE__ */ jsx("nav", { style: { display: "flex", flexDirection: "column", gap: 2 }, children: ITEMS.map((item) => /* @__PURE__ */ jsxs("div", { children: [
|
|
2196
|
+
/* @__PURE__ */ jsx(Item, { item }),
|
|
2197
|
+
item.children && reportsOpen ? /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: 2, padding: "4px 0 4px 30px" }, children: item.children.map((kid) => /* @__PURE__ */ jsx(
|
|
2198
|
+
"button",
|
|
2199
|
+
{
|
|
2200
|
+
onClick: () => onNavigate(kid.key),
|
|
2201
|
+
style: {
|
|
2202
|
+
display: "flex",
|
|
2203
|
+
alignItems: "center",
|
|
2204
|
+
height: 32,
|
|
2205
|
+
padding: "0 10px",
|
|
2206
|
+
border: "none",
|
|
2207
|
+
borderRadius: "var(--klun-radius-md)",
|
|
2208
|
+
cursor: "pointer",
|
|
2209
|
+
textAlign: "left",
|
|
2210
|
+
background: active === kid.key ? "var(--klun-primary-lighter)" : "transparent",
|
|
2211
|
+
color: active === kid.key ? "var(--klun-primary-base)" : "var(--klun-text-sub-600)",
|
|
2212
|
+
font: "var(--klun-text-label-sm)"
|
|
2213
|
+
},
|
|
2214
|
+
children: kid.label
|
|
2215
|
+
},
|
|
2216
|
+
kid.key
|
|
2217
|
+
)) }) : null
|
|
2218
|
+
] }, item.key)) }),
|
|
2219
|
+
/* @__PURE__ */ jsxs(
|
|
2220
|
+
"div",
|
|
2221
|
+
{
|
|
2222
|
+
style: {
|
|
2223
|
+
marginTop: "auto",
|
|
2224
|
+
padding: 10,
|
|
2225
|
+
borderRadius: "var(--klun-radius-lg)",
|
|
2226
|
+
background: "var(--klun-bg-weak-50)",
|
|
2227
|
+
display: "flex",
|
|
2228
|
+
alignItems: "center",
|
|
2229
|
+
gap: 10
|
|
2230
|
+
},
|
|
2231
|
+
children: [
|
|
2232
|
+
/* @__PURE__ */ jsx(Avatar, { size: "32", initials: "AK", color: "blue", status: "online" }),
|
|
2233
|
+
/* @__PURE__ */ jsxs("div", { style: { minWidth: 0 }, children: [
|
|
2234
|
+
/* @__PURE__ */ jsx("div", { style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-strong-950)" }, children: "Anna Krause" }),
|
|
2235
|
+
/* @__PURE__ */ jsx("div", { style: { font: "var(--klun-text-label-xs)", color: "var(--klun-text-soft-400)" }, children: "Admin" })
|
|
2236
|
+
] })
|
|
2237
|
+
]
|
|
2238
|
+
}
|
|
2239
|
+
)
|
|
2240
|
+
]
|
|
2241
|
+
}
|
|
2242
|
+
);
|
|
2243
|
+
}
|
|
2244
|
+
function MetronicTopBar() {
|
|
2245
|
+
return /* @__PURE__ */ jsxs(
|
|
2246
|
+
"header",
|
|
2247
|
+
{
|
|
2248
|
+
style: {
|
|
2249
|
+
display: "flex",
|
|
2250
|
+
alignItems: "center",
|
|
2251
|
+
justifyContent: "space-between",
|
|
2252
|
+
gap: 12,
|
|
2253
|
+
padding: "10px 24px",
|
|
2254
|
+
background: "var(--klun-bg-white-0)",
|
|
2255
|
+
borderBottom: "1px solid var(--klun-stroke-soft-200)"
|
|
2256
|
+
},
|
|
2257
|
+
children: [
|
|
2258
|
+
/* @__PURE__ */ jsx("div", { style: { width: 300, maxWidth: "45%" }, children: /* @__PURE__ */ jsx(Input, { size: "small", placeholder: "Search\u2026", leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-search-line" }) }) }),
|
|
2259
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
2260
|
+
/* @__PURE__ */ jsx(Button, { iconOnly: true, variant: "neutral", appearance: "ghost", size: "small", icon: /* @__PURE__ */ jsx("i", { className: "ri-notification-3-line" }), "aria-label": "Notifications" }),
|
|
2261
|
+
/* @__PURE__ */ jsx(Button, { iconOnly: true, variant: "neutral", appearance: "ghost", size: "small", icon: /* @__PURE__ */ jsx("i", { className: "ri-question-line" }), "aria-label": "Help" }),
|
|
2262
|
+
/* @__PURE__ */ jsx("span", { style: { width: 1, height: 20, background: "var(--klun-stroke-soft-200)", margin: "0 4px" } }),
|
|
2263
|
+
/* @__PURE__ */ jsx(Button, { size: "small", leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-add-line" }), children: "New order" })
|
|
2264
|
+
] })
|
|
2265
|
+
]
|
|
2266
|
+
}
|
|
2267
|
+
);
|
|
2268
|
+
}
|
|
2269
|
+
var TONE = {
|
|
2270
|
+
primary: "var(--klun-primary-base)",
|
|
2271
|
+
success: "var(--klun-state-success-base)",
|
|
2272
|
+
danger: "var(--klun-state-error-base)",
|
|
2273
|
+
info: "var(--klun-state-information-base)",
|
|
2274
|
+
warning: "var(--klun-state-warning-base)",
|
|
2275
|
+
feature: "var(--klun-state-feature-base)"
|
|
2276
|
+
};
|
|
2277
|
+
function Sparkline({ data, tone = "primary", width = 200, height = 40 }) {
|
|
2278
|
+
const gid = useId();
|
|
2279
|
+
const color = TONE[tone];
|
|
2280
|
+
const max = Math.max(...data);
|
|
2281
|
+
const min = Math.min(...data);
|
|
2282
|
+
const span = max - min || 1;
|
|
2283
|
+
const step = width / (data.length - 1);
|
|
2284
|
+
const y = (v) => height - 3 - (v - min) / span * (height - 8);
|
|
2285
|
+
const line = data.map((v, i) => `${i ? "L" : "M"}${(i * step).toFixed(1)},${y(v).toFixed(1)}`).join(" ");
|
|
2286
|
+
const area = `${line} L${width},${height} L0,${height} Z`;
|
|
2287
|
+
return /* @__PURE__ */ jsxs(
|
|
2288
|
+
"svg",
|
|
2289
|
+
{
|
|
2290
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
2291
|
+
preserveAspectRatio: "none",
|
|
2292
|
+
style: { width: "100%", height, display: "block" },
|
|
2293
|
+
"aria-hidden": true,
|
|
2294
|
+
children: [
|
|
2295
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gid, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
2296
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: "0.22" }),
|
|
2297
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: color, stopOpacity: "0" })
|
|
2298
|
+
] }) }),
|
|
2299
|
+
/* @__PURE__ */ jsx("path", { d: area, fill: `url(#${gid})` }),
|
|
2300
|
+
/* @__PURE__ */ jsx("path", { d: line, fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
2301
|
+
]
|
|
2302
|
+
}
|
|
2303
|
+
);
|
|
2304
|
+
}
|
|
2305
|
+
function BarChart({ data, tone = "primary", height = 200, showValues = true }) {
|
|
2306
|
+
const max = Math.max(...data.map((d) => d.value), 1);
|
|
2307
|
+
const color = TONE[tone];
|
|
2308
|
+
const maxBar = height - (showValues ? 44 : 26);
|
|
2309
|
+
return /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "flex-end", gap: 10, height, paddingTop: 4 }, children: data.map((d) => /* @__PURE__ */ jsxs(
|
|
2310
|
+
"div",
|
|
2311
|
+
{
|
|
2312
|
+
style: {
|
|
2313
|
+
flex: 1,
|
|
2314
|
+
minWidth: 0,
|
|
2315
|
+
display: "flex",
|
|
2316
|
+
flexDirection: "column",
|
|
2317
|
+
alignItems: "center",
|
|
2318
|
+
justifyContent: "flex-end",
|
|
2319
|
+
gap: 6,
|
|
2320
|
+
height: "100%"
|
|
2321
|
+
},
|
|
2322
|
+
children: [
|
|
2323
|
+
showValues ? /* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-xs)", color: "var(--klun-text-soft-400)" }, children: d.value }) : null,
|
|
2324
|
+
/* @__PURE__ */ jsx(
|
|
2325
|
+
"div",
|
|
2326
|
+
{
|
|
2327
|
+
style: {
|
|
2328
|
+
width: "100%",
|
|
2329
|
+
maxWidth: 34,
|
|
2330
|
+
height: Math.max(4, Math.round(d.value / max * maxBar)),
|
|
2331
|
+
borderRadius: "var(--klun-radius-md) var(--klun-radius-md) 3px 3px",
|
|
2332
|
+
background: color,
|
|
2333
|
+
opacity: 0.9
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
),
|
|
2337
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-xs)", color: "var(--klun-text-sub-600)" }, children: d.label })
|
|
2338
|
+
]
|
|
2339
|
+
},
|
|
2340
|
+
d.label
|
|
2341
|
+
)) });
|
|
2342
|
+
}
|
|
2343
|
+
function DonutChart({
|
|
2344
|
+
data,
|
|
2345
|
+
centerValue,
|
|
2346
|
+
centerLabel,
|
|
2347
|
+
size = 168,
|
|
2348
|
+
thickness = 22
|
|
2349
|
+
}) {
|
|
2350
|
+
const r = (size - thickness) / 2;
|
|
2351
|
+
const c = 2 * Math.PI * r;
|
|
2352
|
+
const total = data.reduce((s, d) => s + d.value, 0) || 1;
|
|
2353
|
+
const palette = [TONE.primary, TONE.success, TONE.info, TONE.feature, TONE.warning];
|
|
2354
|
+
let acc = 0;
|
|
2355
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 20, flexWrap: "wrap" }, children: [
|
|
2356
|
+
/* @__PURE__ */ jsxs("div", { style: { position: "relative", width: size, height: size, flexShrink: 0 }, children: [
|
|
2357
|
+
/* @__PURE__ */ jsx(
|
|
2358
|
+
"svg",
|
|
2359
|
+
{
|
|
2360
|
+
viewBox: `0 0 ${size} ${size}`,
|
|
2361
|
+
width: size,
|
|
2362
|
+
height: size,
|
|
2363
|
+
style: { display: "block", transform: "rotate(-90deg)" },
|
|
2364
|
+
"aria-hidden": true,
|
|
2365
|
+
children: data.map((d, i) => {
|
|
2366
|
+
const frac = d.value / total;
|
|
2367
|
+
const dash = `${(frac * c).toFixed(2)} ${(c - frac * c).toFixed(2)}`;
|
|
2368
|
+
const offset = -acc * c;
|
|
2369
|
+
acc += frac;
|
|
2370
|
+
return /* @__PURE__ */ jsx(
|
|
2371
|
+
"circle",
|
|
2372
|
+
{
|
|
2373
|
+
cx: size / 2,
|
|
2374
|
+
cy: size / 2,
|
|
2375
|
+
r,
|
|
2376
|
+
fill: "none",
|
|
2377
|
+
stroke: palette[i % palette.length],
|
|
2378
|
+
strokeWidth: thickness,
|
|
2379
|
+
strokeDasharray: dash,
|
|
2380
|
+
strokeDashoffset: offset
|
|
2381
|
+
},
|
|
2382
|
+
d.label
|
|
2383
|
+
);
|
|
2384
|
+
})
|
|
2385
|
+
}
|
|
2386
|
+
),
|
|
2387
|
+
/* @__PURE__ */ jsxs(
|
|
2388
|
+
"div",
|
|
2389
|
+
{
|
|
2390
|
+
style: {
|
|
2391
|
+
position: "absolute",
|
|
2392
|
+
inset: 0,
|
|
2393
|
+
display: "flex",
|
|
2394
|
+
flexDirection: "column",
|
|
2395
|
+
alignItems: "center",
|
|
2396
|
+
justifyContent: "center",
|
|
2397
|
+
gap: 2
|
|
2398
|
+
},
|
|
2399
|
+
children: [
|
|
2400
|
+
centerValue ? /* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-title-h5)", color: "var(--klun-text-strong-950)" }, children: centerValue }) : null,
|
|
2401
|
+
centerLabel ? /* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-paragraph-xs)", color: "var(--klun-text-soft-400)" }, children: centerLabel }) : null
|
|
2402
|
+
]
|
|
2403
|
+
}
|
|
2404
|
+
)
|
|
2405
|
+
] }),
|
|
2406
|
+
/* @__PURE__ */ jsx(
|
|
2407
|
+
"ul",
|
|
2408
|
+
{
|
|
2409
|
+
style: {
|
|
2410
|
+
listStyle: "none",
|
|
2411
|
+
margin: 0,
|
|
2412
|
+
padding: 0,
|
|
2413
|
+
display: "flex",
|
|
2414
|
+
flexDirection: "column",
|
|
2415
|
+
gap: 8,
|
|
2416
|
+
flex: 1,
|
|
2417
|
+
minWidth: 140
|
|
2418
|
+
},
|
|
2419
|
+
children: data.map((d, i) => /* @__PURE__ */ jsxs("li", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
2420
|
+
/* @__PURE__ */ jsx(
|
|
2421
|
+
"span",
|
|
2422
|
+
{
|
|
2423
|
+
style: {
|
|
2424
|
+
width: 8,
|
|
2425
|
+
height: 8,
|
|
2426
|
+
borderRadius: "var(--klun-radius-pill)",
|
|
2427
|
+
background: palette[i % palette.length],
|
|
2428
|
+
flexShrink: 0
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
),
|
|
2432
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1, font: "var(--klun-text-label-sm)", color: "var(--klun-text-sub-600)" }, children: d.label }),
|
|
2433
|
+
/* @__PURE__ */ jsxs("span", { style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-strong-950)" }, children: [
|
|
2434
|
+
Math.round(d.value / total * 100),
|
|
2435
|
+
"%"
|
|
2436
|
+
] })
|
|
2437
|
+
] }, d.label))
|
|
2438
|
+
}
|
|
2439
|
+
)
|
|
2440
|
+
] });
|
|
2441
|
+
}
|
|
2442
|
+
function AreaChart2({ data, labels, tone = "primary", height = 220, formatValue }) {
|
|
2443
|
+
const gid = useId();
|
|
2444
|
+
const color = TONE[tone];
|
|
2445
|
+
const W = 720;
|
|
2446
|
+
const H = 240;
|
|
2447
|
+
const max = Math.max(...data, 1) * 1.08;
|
|
2448
|
+
const step = W / (data.length - 1);
|
|
2449
|
+
const y = (v) => H - v / max * H;
|
|
2450
|
+
const line = data.map((v, i) => `${i ? "L" : "M"}${(i * step).toFixed(1)},${y(v).toFixed(1)}`).join(" ");
|
|
2451
|
+
const area = `${line} L${W},${H} L0,${H} Z`;
|
|
2452
|
+
const fmt = formatValue ?? ((v) => v >= 1e3 ? `${Math.round(v / 100) / 10}k` : String(Math.round(v)));
|
|
2453
|
+
const ticks = [1, 0.75, 0.5, 0.25, 0];
|
|
2454
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 10 }, children: [
|
|
2455
|
+
/* @__PURE__ */ jsx(
|
|
2456
|
+
"div",
|
|
2457
|
+
{
|
|
2458
|
+
style: {
|
|
2459
|
+
width: 46,
|
|
2460
|
+
flexShrink: 0,
|
|
2461
|
+
display: "flex",
|
|
2462
|
+
flexDirection: "column",
|
|
2463
|
+
justifyContent: "space-between",
|
|
2464
|
+
paddingBottom: labels ? 24 : 0,
|
|
2465
|
+
textAlign: "right"
|
|
2466
|
+
},
|
|
2467
|
+
children: ticks.map((t) => /* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-xs)", color: "var(--klun-text-soft-400)" }, children: fmt(max * t) }, t))
|
|
2468
|
+
}
|
|
2469
|
+
),
|
|
2470
|
+
/* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
2471
|
+
/* @__PURE__ */ jsx("div", { style: { height }, children: /* @__PURE__ */ jsxs(
|
|
2472
|
+
"svg",
|
|
2473
|
+
{
|
|
2474
|
+
viewBox: `0 0 ${W} ${H}`,
|
|
2475
|
+
preserveAspectRatio: "none",
|
|
2476
|
+
style: { width: "100%", height: "100%", display: "block" },
|
|
2477
|
+
"aria-hidden": true,
|
|
2478
|
+
children: [
|
|
2479
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gid, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
2480
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: "0.22" }),
|
|
2481
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: color, stopOpacity: "0" })
|
|
2482
|
+
] }) }),
|
|
2483
|
+
ticks.slice(0, -1).map((t) => /* @__PURE__ */ jsx(
|
|
2484
|
+
"line",
|
|
2485
|
+
{
|
|
2486
|
+
x1: "0",
|
|
2487
|
+
x2: W,
|
|
2488
|
+
y1: (H * (1 - t)).toFixed(1),
|
|
2489
|
+
y2: (H * (1 - t)).toFixed(1),
|
|
2490
|
+
stroke: "var(--klun-stroke-soft-200)",
|
|
2491
|
+
strokeWidth: "1",
|
|
2492
|
+
vectorEffect: "non-scaling-stroke"
|
|
2493
|
+
},
|
|
2494
|
+
t
|
|
2495
|
+
)),
|
|
2496
|
+
/* @__PURE__ */ jsx("path", { d: area, fill: `url(#${gid})` }),
|
|
2497
|
+
/* @__PURE__ */ jsx(
|
|
2498
|
+
"path",
|
|
2499
|
+
{
|
|
2500
|
+
d: line,
|
|
2501
|
+
fill: "none",
|
|
2502
|
+
stroke: color,
|
|
2503
|
+
strokeWidth: "2.5",
|
|
2504
|
+
strokeLinecap: "round",
|
|
2505
|
+
strokeLinejoin: "round",
|
|
2506
|
+
vectorEffect: "non-scaling-stroke"
|
|
2507
|
+
}
|
|
2508
|
+
)
|
|
2509
|
+
]
|
|
2510
|
+
}
|
|
2511
|
+
) }),
|
|
2512
|
+
labels ? /* @__PURE__ */ jsx("div", { style: { display: "flex", justifyContent: "space-between", marginTop: 6 }, children: labels.map((l) => /* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-xs)", color: "var(--klun-text-sub-600)" }, children: l }, l)) }) : null
|
|
2513
|
+
] })
|
|
2514
|
+
] });
|
|
2515
|
+
}
|
|
2516
|
+
var STATE_TOKEN = {
|
|
2517
|
+
success: "success",
|
|
2518
|
+
danger: "error",
|
|
2519
|
+
info: "information",
|
|
2520
|
+
warning: "warning",
|
|
2521
|
+
feature: "feature"
|
|
2522
|
+
};
|
|
2523
|
+
function toneVars(tone) {
|
|
2524
|
+
if (tone === "primary") {
|
|
2525
|
+
return { fg: "var(--klun-primary-base)", bg: "var(--klun-primary-lighter)" };
|
|
2526
|
+
}
|
|
2527
|
+
const s = STATE_TOKEN[tone];
|
|
2528
|
+
return { fg: `var(--klun-state-${s}-base)`, bg: `var(--klun-state-${s}-lighter)` };
|
|
2529
|
+
}
|
|
2530
|
+
function Kpi({ label, value, delta, trend = "up", tone = "primary", icon, spark }) {
|
|
2531
|
+
const { fg, bg } = toneVars(tone);
|
|
2532
|
+
const deltaTone = trend === "up" ? "success" : "error";
|
|
2533
|
+
return /* @__PURE__ */ jsxs(Card, { variant: "stroke", padding: 18, children: [
|
|
2534
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8 }, children: [
|
|
2535
|
+
/* @__PURE__ */ jsx(
|
|
2536
|
+
"span",
|
|
2537
|
+
{
|
|
2538
|
+
style: {
|
|
2539
|
+
font: "var(--klun-text-label-xs)",
|
|
2540
|
+
letterSpacing: "0.02em",
|
|
2541
|
+
textTransform: "uppercase",
|
|
2542
|
+
color: "var(--klun-text-soft-400)"
|
|
2543
|
+
},
|
|
2544
|
+
children: label
|
|
2545
|
+
}
|
|
2546
|
+
),
|
|
2547
|
+
/* @__PURE__ */ jsx(
|
|
2548
|
+
"span",
|
|
2549
|
+
{
|
|
2550
|
+
style: {
|
|
2551
|
+
width: 32,
|
|
2552
|
+
height: 32,
|
|
2553
|
+
borderRadius: "var(--klun-radius-md)",
|
|
2554
|
+
background: bg,
|
|
2555
|
+
color: fg,
|
|
2556
|
+
display: "inline-flex",
|
|
2557
|
+
alignItems: "center",
|
|
2558
|
+
justifyContent: "center",
|
|
2559
|
+
fontSize: 16
|
|
2560
|
+
},
|
|
2561
|
+
children: icon
|
|
2562
|
+
}
|
|
2563
|
+
)
|
|
2564
|
+
] }),
|
|
2565
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "baseline", gap: 10, marginTop: 10, flexWrap: "wrap" }, children: [
|
|
2566
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-title-h4)", color: "var(--klun-text-strong-950)", lineHeight: 1 }, children: value }),
|
|
2567
|
+
/* @__PURE__ */ jsxs(
|
|
2568
|
+
"span",
|
|
2569
|
+
{
|
|
2570
|
+
style: {
|
|
2571
|
+
font: "var(--klun-text-label-sm)",
|
|
2572
|
+
color: `var(--klun-state-${deltaTone}-base)`,
|
|
2573
|
+
display: "inline-flex",
|
|
2574
|
+
alignItems: "center",
|
|
2575
|
+
gap: 2
|
|
2576
|
+
},
|
|
2577
|
+
children: [
|
|
2578
|
+
/* @__PURE__ */ jsx("i", { className: trend === "up" ? "ri-arrow-up-line" : "ri-arrow-down-line", style: { fontSize: 14 } }),
|
|
2579
|
+
delta
|
|
2580
|
+
]
|
|
2581
|
+
}
|
|
2582
|
+
)
|
|
2583
|
+
] }),
|
|
2584
|
+
/* @__PURE__ */ jsx("div", { style: { marginTop: 10 }, children: /* @__PURE__ */ jsx(Sparkline, { data: spark, tone, height: 36 }) })
|
|
2585
|
+
] });
|
|
2586
|
+
}
|
|
2587
|
+
function MiniStat({ label, value, hint, tone = "primary" }) {
|
|
2588
|
+
const { fg } = toneVars(tone);
|
|
2589
|
+
return /* @__PURE__ */ jsxs(Card, { variant: "stroke", padding: 16, children: [
|
|
2590
|
+
/* @__PURE__ */ jsx(
|
|
2591
|
+
"div",
|
|
2592
|
+
{
|
|
2593
|
+
style: {
|
|
2594
|
+
font: "var(--klun-text-label-xs)",
|
|
2595
|
+
letterSpacing: "0.02em",
|
|
2596
|
+
textTransform: "uppercase",
|
|
2597
|
+
color: "var(--klun-text-soft-400)"
|
|
2598
|
+
},
|
|
2599
|
+
children: label
|
|
2600
|
+
}
|
|
2601
|
+
),
|
|
2602
|
+
/* @__PURE__ */ jsx("div", { style: { marginTop: 6, font: "var(--klun-text-title-h5)", color: "var(--klun-text-strong-950)" }, children: value }),
|
|
2603
|
+
hint ? /* @__PURE__ */ jsx("div", { style: { marginTop: 2, font: "var(--klun-text-label-xs)", color: fg }, children: hint }) : null
|
|
2604
|
+
] });
|
|
2605
|
+
}
|
|
2606
|
+
var ORDERS = [
|
|
2607
|
+
{ id: "#A-1042", customer: "Anna Krause", date: "Jun 18", status: "Paid", total: "$420.00" },
|
|
2608
|
+
{ id: "#A-1041", customer: "Ben Ortiz", date: "Jun 18", status: "Pending", total: "$215.50" },
|
|
2609
|
+
{ id: "#A-1040", customer: "Chloe Lin", date: "Jun 17", status: "Paid", total: "$980.00" },
|
|
2610
|
+
{ id: "#A-1039", customer: "Dmitri Volkov", date: "Jun 17", status: "Refunded", total: "$120.00" },
|
|
2611
|
+
{ id: "#A-1038", customer: "Erin Walsh", date: "Jun 16", status: "Paid", total: "$66.00" }
|
|
2612
|
+
];
|
|
2613
|
+
var STATUS_COLOR = { Paid: "green", Pending: "yellow", Refunded: "gray" };
|
|
2614
|
+
var customerInitials = (name) => name.split(" ").map((s) => s[0]).join("");
|
|
2615
|
+
var ORDER_COLUMNS = [
|
|
2616
|
+
{
|
|
2617
|
+
key: "id",
|
|
2618
|
+
header: "Order",
|
|
2619
|
+
render: (r) => /* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-strong-950)" }, children: r.id })
|
|
2620
|
+
},
|
|
2621
|
+
{
|
|
2622
|
+
key: "customer",
|
|
2623
|
+
header: "Customer",
|
|
2624
|
+
render: (r) => /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 8 }, children: [
|
|
2625
|
+
/* @__PURE__ */ jsx(Avatar, { size: "24", initials: customerInitials(r.customer), color: "blue" }),
|
|
2626
|
+
r.customer
|
|
2627
|
+
] })
|
|
2628
|
+
},
|
|
2629
|
+
{ key: "date", header: "Date" },
|
|
2630
|
+
{
|
|
2631
|
+
key: "status",
|
|
2632
|
+
header: "Status",
|
|
2633
|
+
render: (r) => /* @__PURE__ */ jsx(Badge, { color: STATUS_COLOR[r.status], variant: "light", size: "small", dot: true, children: r.status })
|
|
2634
|
+
},
|
|
2635
|
+
{
|
|
2636
|
+
key: "total",
|
|
2637
|
+
header: "Total",
|
|
2638
|
+
align: "right",
|
|
2639
|
+
render: (r) => /* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-strong-950)" }, children: r.total })
|
|
2640
|
+
}
|
|
2641
|
+
];
|
|
2642
|
+
function DashboardScreen() {
|
|
2643
|
+
const [tab, setTab] = useState("revenue");
|
|
2644
|
+
return /* @__PURE__ */ jsxs("div", { style: { padding: 24, display: "flex", flexDirection: "column", gap: 20 }, children: [
|
|
2645
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "flex-end", justifyContent: "space-between", gap: 16 }, children: [
|
|
2646
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2647
|
+
/* @__PURE__ */ jsx("h1", { style: { margin: 0, font: "var(--klun-text-title-h4)", color: "var(--klun-text-strong-950)" }, children: "Dashboard" }),
|
|
2648
|
+
/* @__PURE__ */ jsx("p", { style: { margin: "4px 0 0", font: "var(--klun-text-paragraph-sm)", color: "var(--klun-text-sub-600)" }, children: "Welcome back \u2014 here's your store today." })
|
|
2649
|
+
] }),
|
|
2650
|
+
/* @__PURE__ */ jsx(
|
|
2651
|
+
AvatarGroup,
|
|
2652
|
+
{
|
|
2653
|
+
size: "32",
|
|
2654
|
+
max: 4,
|
|
2655
|
+
avatars: [
|
|
2656
|
+
{ initials: "AK", color: "blue" },
|
|
2657
|
+
{ initials: "BO", color: "green" },
|
|
2658
|
+
{ initials: "CL", color: "purple" },
|
|
2659
|
+
{ initials: "DV", color: "orange" },
|
|
2660
|
+
{ initials: "EW", color: "gray" }
|
|
2661
|
+
]
|
|
2662
|
+
}
|
|
2663
|
+
)
|
|
2664
|
+
] }),
|
|
2665
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))", gap: 16 }, children: [
|
|
2666
|
+
/* @__PURE__ */ jsx(
|
|
2667
|
+
Kpi,
|
|
2668
|
+
{
|
|
2669
|
+
label: "Revenue",
|
|
2670
|
+
value: "$84,920",
|
|
2671
|
+
delta: "12.4%",
|
|
2672
|
+
tone: "primary",
|
|
2673
|
+
icon: /* @__PURE__ */ jsx("i", { className: "ri-money-dollar-circle-line" }),
|
|
2674
|
+
spark: [10, 14, 12, 18, 16, 24, 22, 30]
|
|
2675
|
+
}
|
|
2676
|
+
),
|
|
2677
|
+
/* @__PURE__ */ jsx(
|
|
2678
|
+
Kpi,
|
|
2679
|
+
{
|
|
2680
|
+
label: "Orders",
|
|
2681
|
+
value: "1,284",
|
|
2682
|
+
delta: "6.1%",
|
|
2683
|
+
tone: "success",
|
|
2684
|
+
icon: /* @__PURE__ */ jsx("i", { className: "ri-shopping-bag-line" }),
|
|
2685
|
+
spark: [8, 10, 9, 14, 13, 16, 18, 22]
|
|
2686
|
+
}
|
|
2687
|
+
),
|
|
2688
|
+
/* @__PURE__ */ jsx(
|
|
2689
|
+
Kpi,
|
|
2690
|
+
{
|
|
2691
|
+
label: "Customers",
|
|
2692
|
+
value: "9,402",
|
|
2693
|
+
delta: "2.3%",
|
|
2694
|
+
trend: "down",
|
|
2695
|
+
tone: "danger",
|
|
2696
|
+
icon: /* @__PURE__ */ jsx("i", { className: "ri-team-line" }),
|
|
2697
|
+
spark: [20, 18, 19, 15, 16, 14, 13, 12]
|
|
2698
|
+
}
|
|
2699
|
+
),
|
|
2700
|
+
/* @__PURE__ */ jsx(
|
|
2701
|
+
Kpi,
|
|
2702
|
+
{
|
|
2703
|
+
label: "Conversion",
|
|
2704
|
+
value: "3.6%",
|
|
2705
|
+
delta: "0.8%",
|
|
2706
|
+
tone: "info",
|
|
2707
|
+
icon: /* @__PURE__ */ jsx("i", { className: "ri-percent-line" }),
|
|
2708
|
+
spark: [2, 3, 2.5, 3.2, 3, 3.4, 3.5, 3.6]
|
|
2709
|
+
}
|
|
2710
|
+
)
|
|
2711
|
+
] }),
|
|
2712
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "minmax(0, 1.6fr) minmax(0, 1fr)", gap: 16, alignItems: "start" }, children: [
|
|
2713
|
+
/* @__PURE__ */ jsxs(Card, { variant: "stroke", padding: 20, children: [
|
|
2714
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 12, marginBottom: 16 }, children: [
|
|
2715
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-lg)", color: "var(--klun-text-strong-950)" }, children: "Performance" }),
|
|
2716
|
+
/* @__PURE__ */ jsx(
|
|
2717
|
+
Tabs,
|
|
2718
|
+
{
|
|
2719
|
+
variant: "pill",
|
|
2720
|
+
value: tab,
|
|
2721
|
+
onChange: setTab,
|
|
2722
|
+
items: [
|
|
2723
|
+
{ value: "revenue", label: "Revenue" },
|
|
2724
|
+
{ value: "orders", label: "Orders" }
|
|
2725
|
+
]
|
|
2726
|
+
}
|
|
2727
|
+
)
|
|
2728
|
+
] }),
|
|
2729
|
+
/* @__PURE__ */ jsx(
|
|
2730
|
+
BarChart,
|
|
2731
|
+
{
|
|
2732
|
+
height: 200,
|
|
2733
|
+
tone: tab === "revenue" ? "primary" : "success",
|
|
2734
|
+
data: tab === "revenue" ? [
|
|
2735
|
+
{ label: "Mon", value: 32 },
|
|
2736
|
+
{ label: "Tue", value: 48 },
|
|
2737
|
+
{ label: "Wed", value: 40 },
|
|
2738
|
+
{ label: "Thu", value: 64 },
|
|
2739
|
+
{ label: "Fri", value: 58 },
|
|
2740
|
+
{ label: "Sat", value: 30 },
|
|
2741
|
+
{ label: "Sun", value: 22 }
|
|
2742
|
+
] : [
|
|
2743
|
+
{ label: "Mon", value: 120 },
|
|
2744
|
+
{ label: "Tue", value: 168 },
|
|
2745
|
+
{ label: "Wed", value: 142 },
|
|
2746
|
+
{ label: "Thu", value: 210 },
|
|
2747
|
+
{ label: "Fri", value: 196 },
|
|
2748
|
+
{ label: "Sat", value: 88 },
|
|
2749
|
+
{ label: "Sun", value: 64 }
|
|
2750
|
+
]
|
|
2751
|
+
}
|
|
2752
|
+
)
|
|
2753
|
+
] }),
|
|
2754
|
+
/* @__PURE__ */ jsxs(Card, { variant: "stroke", padding: 20, children: [
|
|
2755
|
+
/* @__PURE__ */ jsx("div", { style: { font: "var(--klun-text-label-lg)", color: "var(--klun-text-strong-950)", marginBottom: 16 }, children: "Traffic sources" }),
|
|
2756
|
+
/* @__PURE__ */ jsx(
|
|
2757
|
+
DonutChart,
|
|
2758
|
+
{
|
|
2759
|
+
centerValue: "68%",
|
|
2760
|
+
centerLabel: "Organic",
|
|
2761
|
+
data: [
|
|
2762
|
+
{ label: "Organic", value: 68 },
|
|
2763
|
+
{ label: "Direct", value: 18 },
|
|
2764
|
+
{ label: "Referral", value: 9 },
|
|
2765
|
+
{ label: "Social", value: 5 }
|
|
2766
|
+
]
|
|
2767
|
+
}
|
|
2768
|
+
)
|
|
2769
|
+
] })
|
|
2770
|
+
] }),
|
|
2771
|
+
/* @__PURE__ */ jsxs(Card, { variant: "stroke", padding: 0, children: [
|
|
2772
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 12, padding: "16px 20px" }, children: [
|
|
2773
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-lg)", color: "var(--klun-text-strong-950)" }, children: "Recent orders" }),
|
|
2774
|
+
/* @__PURE__ */ jsx(Button, { size: "small", variant: "neutral", appearance: "stroke", children: "View all" })
|
|
2775
|
+
] }),
|
|
2776
|
+
/* @__PURE__ */ jsx(
|
|
2777
|
+
Table,
|
|
2778
|
+
{
|
|
2779
|
+
columns: ORDER_COLUMNS,
|
|
2780
|
+
rows: ORDERS,
|
|
2781
|
+
getRowId: (r) => r.id,
|
|
2782
|
+
style: { borderRadius: 0, boxShadow: "none", borderTop: "1px solid var(--klun-stroke-soft-200)" }
|
|
2783
|
+
}
|
|
2784
|
+
)
|
|
2785
|
+
] })
|
|
2786
|
+
] });
|
|
2787
|
+
}
|
|
2788
|
+
var ORDERS2 = [
|
|
2789
|
+
{ id: "#A-1042", date: "2026-09-16", customer: "Anna Krause", items: 3, status: "Fulfilled", payment: "Visa \u2022\u2022 4242", total: 420 },
|
|
2790
|
+
{ id: "#A-1041", date: "2026-09-16", customer: "Ben Ortiz", items: 1, status: "Pending", payment: "PayPal", total: 215.5 },
|
|
2791
|
+
{ id: "#A-1040", date: "2026-09-15", customer: "Chloe Lin", items: 6, status: "Fulfilled", payment: "Visa \u2022\u2022 1881", total: 980 },
|
|
2792
|
+
{ id: "#A-1039", date: "2026-09-15", customer: "Dmitri Volkov", items: 2, status: "Refunded", payment: "Mastercard \u2022\u2022 5501", total: 120 },
|
|
2793
|
+
{ id: "#A-1038", date: "2026-09-14", customer: "Erin Walsh", items: 1, status: "Fulfilled", payment: "Apple Pay", total: 66 },
|
|
2794
|
+
{ id: "#A-1037", date: "2026-09-14", customer: "Farid Haddad", items: 4, status: "Processing", payment: "Visa \u2022\u2022 9034", total: 512.4 },
|
|
2795
|
+
{ id: "#A-1036", date: "2026-09-13", customer: "Grace Miller", items: 2, status: "Fulfilled", payment: "PayPal", total: 148 },
|
|
2796
|
+
{ id: "#A-1035", date: "2026-09-12", customer: "Hugo Silva", items: 5, status: "Processing", payment: "Mastercard \u2022\u2022 2210", total: 764.9 },
|
|
2797
|
+
{ id: "#A-1034", date: "2026-09-12", customer: "Ivy Chen", items: 1, status: "Pending", payment: "Visa \u2022\u2022 7742", total: 89 },
|
|
2798
|
+
{ id: "#A-1033", date: "2026-09-11", customer: "Jonas Weber", items: 3, status: "Fulfilled", payment: "Bank transfer", total: 355 },
|
|
2799
|
+
{ id: "#A-1032", date: "2026-09-10", customer: "Karla Novak", items: 2, status: "Refunded", payment: "PayPal", total: 210 },
|
|
2800
|
+
{ id: "#A-1031", date: "2026-09-10", customer: "Liam Byrne", items: 7, status: "Fulfilled", payment: "Visa \u2022\u2022 3360", total: 1284 }
|
|
2801
|
+
];
|
|
2802
|
+
var STATUS_COLOR2 = {
|
|
2803
|
+
Fulfilled: "green",
|
|
2804
|
+
Processing: "blue",
|
|
2805
|
+
Pending: "yellow",
|
|
2806
|
+
Refunded: "gray"
|
|
2807
|
+
};
|
|
2808
|
+
var initials = (name) => name.split(" ").map((s) => s[0]).join("");
|
|
2809
|
+
function OrdersScreen() {
|
|
2810
|
+
const [query, setQuery] = useState("");
|
|
2811
|
+
const [selected, setSelected] = useState([]);
|
|
2812
|
+
const rows = useMemo(() => {
|
|
2813
|
+
const q = query.trim().toLowerCase();
|
|
2814
|
+
if (!q) return ORDERS2;
|
|
2815
|
+
return ORDERS2.filter(
|
|
2816
|
+
(o) => o.id.toLowerCase().includes(q) || o.customer.toLowerCase().includes(q)
|
|
2817
|
+
);
|
|
2818
|
+
}, [query]);
|
|
2819
|
+
const columns = [
|
|
2820
|
+
{
|
|
2821
|
+
key: "id",
|
|
2822
|
+
header: "Order",
|
|
2823
|
+
render: (r) => /* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-strong-950)" }, children: r.id })
|
|
2824
|
+
},
|
|
2825
|
+
{ key: "date", header: "Date" },
|
|
2826
|
+
{
|
|
2827
|
+
key: "customer",
|
|
2828
|
+
header: "Customer",
|
|
2829
|
+
render: (r) => /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 8 }, children: [
|
|
2830
|
+
/* @__PURE__ */ jsx(Avatar, { size: "24", initials: initials(r.customer), color: "blue" }),
|
|
2831
|
+
r.customer
|
|
2832
|
+
] })
|
|
2833
|
+
},
|
|
2834
|
+
{ key: "items", header: "Items", align: "center" },
|
|
2835
|
+
{
|
|
2836
|
+
key: "status",
|
|
2837
|
+
header: "Status",
|
|
2838
|
+
filters: [
|
|
2839
|
+
{ label: "Fulfilled", value: "Fulfilled" },
|
|
2840
|
+
{ label: "Processing", value: "Processing" },
|
|
2841
|
+
{ label: "Pending", value: "Pending" },
|
|
2842
|
+
{ label: "Refunded", value: "Refunded" }
|
|
2843
|
+
],
|
|
2844
|
+
render: (r) => /* @__PURE__ */ jsx(Badge, { color: STATUS_COLOR2[r.status], variant: "light", size: "small", dot: true, children: r.status })
|
|
2845
|
+
},
|
|
2846
|
+
{ key: "payment", header: "Payment" },
|
|
2847
|
+
{
|
|
2848
|
+
key: "total",
|
|
2849
|
+
header: "Total",
|
|
2850
|
+
align: "right",
|
|
2851
|
+
render: (r) => /* @__PURE__ */ jsx(
|
|
2852
|
+
Money,
|
|
2853
|
+
{
|
|
2854
|
+
value: r.total,
|
|
2855
|
+
currency: "USD",
|
|
2856
|
+
locale: "en-US",
|
|
2857
|
+
tone: r.status === "Refunded" ? "refund" : "default",
|
|
2858
|
+
style: { font: "var(--klun-text-label-sm)" }
|
|
2859
|
+
}
|
|
2860
|
+
)
|
|
2861
|
+
}
|
|
2862
|
+
];
|
|
2863
|
+
return /* @__PURE__ */ jsxs("div", { style: { padding: 24, display: "flex", flexDirection: "column", gap: 20 }, children: [
|
|
2864
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "flex-end", justifyContent: "space-between", gap: 16, flexWrap: "wrap" }, children: [
|
|
2865
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2866
|
+
/* @__PURE__ */ jsx("h1", { style: { margin: 0, font: "var(--klun-text-title-h4)", color: "var(--klun-text-strong-950)" }, children: "Orders" }),
|
|
2867
|
+
/* @__PURE__ */ jsx("p", { style: { margin: "4px 0 0", font: "var(--klun-text-paragraph-sm)", color: "var(--klun-text-sub-600)" }, children: "Track, filter and fulfil every order in one place." })
|
|
2868
|
+
] }),
|
|
2869
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 8 }, children: [
|
|
2870
|
+
/* @__PURE__ */ jsx(Button, { variant: "neutral", appearance: "stroke", size: "small", leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-download-2-line" }), children: "Export" }),
|
|
2871
|
+
/* @__PURE__ */ jsx(Button, { size: "small", leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-add-line" }), children: "New order" })
|
|
2872
|
+
] })
|
|
2873
|
+
] }),
|
|
2874
|
+
/* @__PURE__ */ jsx(
|
|
2875
|
+
Table,
|
|
2876
|
+
{
|
|
2877
|
+
columns,
|
|
2878
|
+
rows,
|
|
2879
|
+
getRowId: (r) => r.id,
|
|
2880
|
+
title: "All orders",
|
|
2881
|
+
toolbar: /* @__PURE__ */ jsx("div", { style: { width: 220 }, children: /* @__PURE__ */ jsx(
|
|
2882
|
+
Input,
|
|
2883
|
+
{
|
|
2884
|
+
size: "small",
|
|
2885
|
+
placeholder: "Search orders\u2026",
|
|
2886
|
+
leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-search-line" }),
|
|
2887
|
+
value: query,
|
|
2888
|
+
onChange: (e) => setQuery(e.target.value)
|
|
2889
|
+
}
|
|
2890
|
+
) }),
|
|
2891
|
+
selectable: true,
|
|
2892
|
+
selected,
|
|
2893
|
+
onSelectRow: (id) => setSelected((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev, id]),
|
|
2894
|
+
onSelectAll: (ids) => setSelected(ids),
|
|
2895
|
+
selectionActions: (rowsSelected, clear) => /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
2896
|
+
/* @__PURE__ */ jsxs("span", { style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-sub-600)" }, children: [
|
|
2897
|
+
rowsSelected.length,
|
|
2898
|
+
" selected"
|
|
2899
|
+
] }),
|
|
2900
|
+
/* @__PURE__ */ jsx(Button, { size: "tiny", variant: "neutral", appearance: "stroke", leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-check-line" }), children: "Mark fulfilled" }),
|
|
2901
|
+
/* @__PURE__ */ jsx(Button, { size: "tiny", variant: "neutral", appearance: "ghost", onClick: clear, children: "Clear" })
|
|
2902
|
+
] }),
|
|
2903
|
+
sortable: true,
|
|
2904
|
+
exportable: { filename: "orders.csv" },
|
|
2905
|
+
pagination: { defaultPageSize: 6, pageSizeOptions: [6, 12] }
|
|
2906
|
+
}
|
|
2907
|
+
)
|
|
2908
|
+
] });
|
|
2909
|
+
}
|
|
2910
|
+
|
|
2911
|
+
// src/templates/metronic-dashboard/productModel.ts
|
|
2912
|
+
var CATEGORIES = ["Peripherals", "Displays", "Accessories", "Audio", "Office", "Video"];
|
|
2913
|
+
var STATUS_COLOR3 = { Active: "green", "Low stock": "yellow", "Out of stock": "gray" };
|
|
2914
|
+
var deriveStatus = (stock, capacity) => stock === 0 ? "Out of stock" : stock / capacity < 0.25 ? "Low stock" : "Active";
|
|
2915
|
+
function emptyDraft() {
|
|
2916
|
+
return {
|
|
2917
|
+
name: "",
|
|
2918
|
+
sku: "",
|
|
2919
|
+
category: "Accessories",
|
|
2920
|
+
price: 0,
|
|
2921
|
+
stock: 0,
|
|
2922
|
+
capacity: 100,
|
|
2923
|
+
status: "Active",
|
|
2924
|
+
description: ""
|
|
2925
|
+
};
|
|
2926
|
+
}
|
|
2927
|
+
function Field({
|
|
2928
|
+
label,
|
|
2929
|
+
hint,
|
|
2930
|
+
children
|
|
2931
|
+
}) {
|
|
2932
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
2933
|
+
/* @__PURE__ */ jsx(Label, { children: label }),
|
|
2934
|
+
children,
|
|
2935
|
+
hint ? /* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-paragraph-xs)", color: "var(--klun-text-soft-400)" }, children: hint }) : null
|
|
2936
|
+
] });
|
|
2937
|
+
}
|
|
2938
|
+
function ReviewRow({ label, children }) {
|
|
2939
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 16, padding: "10px 0" }, children: [
|
|
2940
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-soft-400)" }, children: label }),
|
|
2941
|
+
/* @__PURE__ */ jsx(
|
|
2942
|
+
"span",
|
|
2943
|
+
{
|
|
2944
|
+
style: {
|
|
2945
|
+
font: "var(--klun-text-label-sm)",
|
|
2946
|
+
color: "var(--klun-text-strong-950)",
|
|
2947
|
+
display: "inline-flex",
|
|
2948
|
+
alignItems: "center",
|
|
2949
|
+
gap: 8
|
|
2950
|
+
},
|
|
2951
|
+
children
|
|
2952
|
+
}
|
|
2953
|
+
)
|
|
2954
|
+
] });
|
|
2955
|
+
}
|
|
2956
|
+
function ProductWizardPage({ mode, initial, onCancel, onSave }) {
|
|
2957
|
+
const [draft, setDraft] = useState(initial);
|
|
2958
|
+
const [step, setStep] = useState(0);
|
|
2959
|
+
const [triedNext, setTriedNext] = useState(false);
|
|
2960
|
+
const set = (patch) => setDraft((d) => ({ ...d, ...patch }));
|
|
2961
|
+
const nameError = triedNext && step === 0 && draft.name.trim().length === 0;
|
|
2962
|
+
const skuError = triedNext && step === 0 && draft.sku.trim().length === 0;
|
|
2963
|
+
const stockError = triedNext && step === 1 && (draft.stock < 0 || draft.stock > draft.capacity);
|
|
2964
|
+
const nextStatus = deriveStatus(draft.stock, draft.capacity);
|
|
2965
|
+
const title = mode === "create" ? "New product" : "Edit product";
|
|
2966
|
+
const steps = [
|
|
2967
|
+
{
|
|
2968
|
+
title: "Basics",
|
|
2969
|
+
content: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 16 }, children: [
|
|
2970
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "2fr 1fr", gap: 16 }, children: [
|
|
2971
|
+
/* @__PURE__ */ jsx(Field, { label: "Name", hint: nameError ? "A product name is required." : void 0, children: /* @__PURE__ */ jsx(
|
|
2972
|
+
Input,
|
|
2973
|
+
{
|
|
2974
|
+
error: nameError,
|
|
2975
|
+
value: draft.name,
|
|
2976
|
+
placeholder: "Aero Wireless Keyboard",
|
|
2977
|
+
onChange: (e) => set({ name: e.target.value })
|
|
2978
|
+
}
|
|
2979
|
+
) }),
|
|
2980
|
+
/* @__PURE__ */ jsx(Field, { label: "SKU", hint: skuError ? "A unique SKU is required." : void 0, children: /* @__PURE__ */ jsx(
|
|
2981
|
+
Input,
|
|
2982
|
+
{
|
|
2983
|
+
error: skuError,
|
|
2984
|
+
value: draft.sku,
|
|
2985
|
+
placeholder: "KB-1042",
|
|
2986
|
+
onChange: (e) => set({ sku: e.target.value })
|
|
2987
|
+
}
|
|
2988
|
+
) })
|
|
2989
|
+
] }),
|
|
2990
|
+
/* @__PURE__ */ jsx("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 16 }, children: /* @__PURE__ */ jsx(Field, { label: "Category", children: /* @__PURE__ */ jsx(Select, { value: draft.category, onChange: (e) => set({ category: e.target.value }), children: CATEGORIES.map((c) => /* @__PURE__ */ jsx("option", { value: c, children: c }, c)) }) }) }),
|
|
2991
|
+
/* @__PURE__ */ jsx(Field, { label: "Description", hint: "Shown to teammates in the inventory \u2014 not on the storefront.", children: /* @__PURE__ */ jsx(
|
|
2992
|
+
Input,
|
|
2993
|
+
{
|
|
2994
|
+
value: draft.description ?? "",
|
|
2995
|
+
placeholder: "Short internal description",
|
|
2996
|
+
onChange: (e) => set({ description: e.target.value })
|
|
2997
|
+
}
|
|
2998
|
+
) })
|
|
2999
|
+
] })
|
|
3000
|
+
},
|
|
3001
|
+
{
|
|
3002
|
+
title: "Pricing & stock",
|
|
3003
|
+
content: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 16 }, children: [
|
|
3004
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 16 }, children: [
|
|
3005
|
+
/* @__PURE__ */ jsx(Field, { label: "Price (USD)", children: /* @__PURE__ */ jsx(
|
|
3006
|
+
Input,
|
|
3007
|
+
{
|
|
3008
|
+
type: "number",
|
|
3009
|
+
value: String(draft.price),
|
|
3010
|
+
leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-money-dollar-circle-line" }),
|
|
3011
|
+
onChange: (e) => set({ price: Number(e.target.value) || 0 })
|
|
3012
|
+
}
|
|
3013
|
+
) }),
|
|
3014
|
+
/* @__PURE__ */ jsx(Field, { label: "Capacity", hint: "Used for the stock bar \u2014 how many units fit.", children: /* @__PURE__ */ jsx(CounterInput, { value: draft.capacity, min: 1, max: 1e3, step: 10, onChange: (v) => set({ capacity: v }) }) })
|
|
3015
|
+
] }),
|
|
3016
|
+
/* @__PURE__ */ jsx(
|
|
3017
|
+
Field,
|
|
3018
|
+
{
|
|
3019
|
+
label: "Stock on hand",
|
|
3020
|
+
hint: stockError ? "Stock must be between 0 and capacity." : "Status is derived from this level.",
|
|
3021
|
+
children: /* @__PURE__ */ jsx(CounterInput, { value: draft.stock, min: 0, max: draft.capacity, onChange: (v) => set({ stock: v }) })
|
|
3022
|
+
}
|
|
3023
|
+
),
|
|
3024
|
+
/* @__PURE__ */ jsxs(
|
|
3025
|
+
"div",
|
|
3026
|
+
{
|
|
3027
|
+
style: {
|
|
3028
|
+
display: "flex",
|
|
3029
|
+
alignItems: "center",
|
|
3030
|
+
gap: 10,
|
|
3031
|
+
padding: "12px 14px",
|
|
3032
|
+
borderRadius: "var(--klun-radius-lg)",
|
|
3033
|
+
background: "var(--klun-bg-weak-50)"
|
|
3034
|
+
},
|
|
3035
|
+
children: [
|
|
3036
|
+
/* @__PURE__ */ jsx("i", { className: "ri-information-line", style: { fontSize: 18, color: "var(--klun-icon-sub-600)" } }),
|
|
3037
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-paragraph-sm)", color: "var(--klun-text-sub-600)" }, children: "With this stock level the product will be saved as" }),
|
|
3038
|
+
/* @__PURE__ */ jsx(Badge, { color: STATUS_COLOR3[nextStatus], variant: "light", size: "small", dot: true, children: nextStatus })
|
|
3039
|
+
]
|
|
3040
|
+
}
|
|
3041
|
+
)
|
|
3042
|
+
] })
|
|
3043
|
+
},
|
|
3044
|
+
{
|
|
3045
|
+
title: "Review",
|
|
3046
|
+
content: /* @__PURE__ */ jsxs("div", { children: [
|
|
3047
|
+
/* @__PURE__ */ jsxs("div", { style: { boxShadow: "inset 0 -1px 0 var(--klun-stroke-soft-200)" }, children: [
|
|
3048
|
+
/* @__PURE__ */ jsx(ReviewRow, { label: "Name", children: draft.name || "\u2014" }),
|
|
3049
|
+
/* @__PURE__ */ jsx(ReviewRow, { label: "SKU", children: draft.sku || "\u2014" }),
|
|
3050
|
+
/* @__PURE__ */ jsx(ReviewRow, { label: "Category", children: draft.category }),
|
|
3051
|
+
/* @__PURE__ */ jsx(ReviewRow, { label: "Description", children: draft.description || "\u2014" })
|
|
3052
|
+
] }),
|
|
3053
|
+
/* @__PURE__ */ jsxs("div", { style: { boxShadow: "inset 0 -1px 0 var(--klun-stroke-soft-200)" }, children: [
|
|
3054
|
+
/* @__PURE__ */ jsx(ReviewRow, { label: "Price", children: /* @__PURE__ */ jsx(Money, { value: draft.price, currency: "USD", locale: "en-US" }) }),
|
|
3055
|
+
/* @__PURE__ */ jsxs(ReviewRow, { label: "Stock", children: [
|
|
3056
|
+
draft.stock,
|
|
3057
|
+
" of ",
|
|
3058
|
+
draft.capacity
|
|
3059
|
+
] }),
|
|
3060
|
+
/* @__PURE__ */ jsx(ReviewRow, { label: "Status", children: /* @__PURE__ */ jsx(Badge, { color: STATUS_COLOR3[nextStatus], variant: "light", size: "small", dot: true, children: nextStatus }) })
|
|
3061
|
+
] }),
|
|
3062
|
+
/* @__PURE__ */ jsxs(
|
|
3063
|
+
"span",
|
|
3064
|
+
{
|
|
3065
|
+
style: {
|
|
3066
|
+
display: "block",
|
|
3067
|
+
marginTop: 14,
|
|
3068
|
+
font: "var(--klun-text-paragraph-xs)",
|
|
3069
|
+
color: "var(--klun-text-soft-400)"
|
|
3070
|
+
},
|
|
3071
|
+
children: [
|
|
3072
|
+
"Click Finish to save \u2014 the product ",
|
|
3073
|
+
mode === "create" ? "is added to" : "is updated in",
|
|
3074
|
+
" the inventory."
|
|
3075
|
+
]
|
|
3076
|
+
}
|
|
3077
|
+
)
|
|
3078
|
+
] })
|
|
3079
|
+
}
|
|
3080
|
+
];
|
|
3081
|
+
return /* @__PURE__ */ jsxs("div", { style: { padding: 24, display: "flex", flexDirection: "column", gap: 20 }, children: [
|
|
3082
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
3083
|
+
/* @__PURE__ */ jsx(
|
|
3084
|
+
Breadcrumb,
|
|
3085
|
+
{
|
|
3086
|
+
items: [
|
|
3087
|
+
{ label: "Products" },
|
|
3088
|
+
{ label: mode === "create" ? "New product" : draft.name || "Edit product" }
|
|
3089
|
+
]
|
|
3090
|
+
}
|
|
3091
|
+
),
|
|
3092
|
+
/* @__PURE__ */ jsxs(
|
|
3093
|
+
"div",
|
|
3094
|
+
{
|
|
3095
|
+
style: {
|
|
3096
|
+
display: "flex",
|
|
3097
|
+
alignItems: "flex-end",
|
|
3098
|
+
justifyContent: "space-between",
|
|
3099
|
+
gap: 16,
|
|
3100
|
+
marginTop: 8,
|
|
3101
|
+
flexWrap: "wrap"
|
|
3102
|
+
},
|
|
3103
|
+
children: [
|
|
3104
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
3105
|
+
/* @__PURE__ */ jsx("h1", { style: { margin: 0, font: "var(--klun-text-title-h4)", color: "var(--klun-text-strong-950)" }, children: title }),
|
|
3106
|
+
/* @__PURE__ */ jsx("p", { style: { margin: "4px 0 0", font: "var(--klun-text-paragraph-sm)", color: "var(--klun-text-sub-600)" }, children: "Route-style editor \u2014 three steps, saved at the end." })
|
|
3107
|
+
] }),
|
|
3108
|
+
/* @__PURE__ */ jsx(
|
|
3109
|
+
Button,
|
|
3110
|
+
{
|
|
3111
|
+
variant: "neutral",
|
|
3112
|
+
appearance: "stroke",
|
|
3113
|
+
size: "small",
|
|
3114
|
+
leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-arrow-left-line" }),
|
|
3115
|
+
onClick: onCancel,
|
|
3116
|
+
children: "Back to list"
|
|
3117
|
+
}
|
|
3118
|
+
)
|
|
3119
|
+
]
|
|
3120
|
+
}
|
|
3121
|
+
)
|
|
3122
|
+
] }),
|
|
3123
|
+
/* @__PURE__ */ jsx(Card, { variant: "stroke", padding: 20, children: /* @__PURE__ */ jsx(
|
|
3124
|
+
Wizard,
|
|
3125
|
+
{
|
|
3126
|
+
steps,
|
|
3127
|
+
current: step,
|
|
3128
|
+
onStepChange: (n) => {
|
|
3129
|
+
if (n > step) {
|
|
3130
|
+
setTriedNext(true);
|
|
3131
|
+
if (step === 0 && (draft.name.trim() === "" || draft.sku.trim() === "")) return;
|
|
3132
|
+
if (step === 1 && (draft.stock < 0 || draft.stock > draft.capacity)) return;
|
|
3133
|
+
}
|
|
3134
|
+
setTriedNext(false);
|
|
3135
|
+
setStep(n);
|
|
3136
|
+
},
|
|
3137
|
+
onFinish: () => onSave({ ...draft, status: nextStatus })
|
|
3138
|
+
}
|
|
3139
|
+
) })
|
|
3140
|
+
] });
|
|
3141
|
+
}
|
|
3142
|
+
var INITIAL_PRODUCTS = [
|
|
3143
|
+
{ id: "p1", name: "Aero Wireless Keyboard", sku: "KB-1042", category: "Peripherals", price: 129, stock: 84, capacity: 120, status: "Active" },
|
|
3144
|
+
{ id: "p2", name: 'Lumen 27" 4K Monitor', sku: "MN-2210", category: "Displays", price: 549, stock: 12, capacity: 80, status: "Low stock" },
|
|
3145
|
+
{ id: "p3", name: "Pulse USB-C Dock", sku: "DK-3301", category: "Accessories", price: 89.5, stock: 0, capacity: 60, status: "Out of stock" },
|
|
3146
|
+
{ id: "p4", name: "Nimbus Laptop Stand", sku: "ST-1187", category: "Accessories", price: 45, stock: 132, capacity: 200, status: "Active" },
|
|
3147
|
+
{ id: "p5", name: "Vertex Mechanical Mouse", sku: "MS-2205", category: "Peripherals", price: 79, stock: 18, capacity: 100, status: "Low stock" },
|
|
3148
|
+
{ id: "p6", name: "Echo Conference Speaker", sku: "SP-4402", category: "Audio", price: 219, stock: 47, capacity: 90, status: "Active" },
|
|
3149
|
+
{ id: "p7", name: "Flux Desk Lamp", sku: "LP-0913", category: "Office", price: 64, stock: 0, capacity: 40, status: "Out of stock" },
|
|
3150
|
+
{ id: "p8", name: "Orbit Webcam 4K", sku: "WC-5520", category: "Video", price: 149, stock: 63, capacity: 120, status: "Active" }
|
|
3151
|
+
];
|
|
3152
|
+
var CATEGORY_TONE = {
|
|
3153
|
+
Peripherals: { bg: "var(--klun-state-feature-lighter)", fg: "var(--klun-state-feature-base)", icon: "ri-keyboard-line" },
|
|
3154
|
+
Displays: { bg: "var(--klun-state-information-lighter)", fg: "var(--klun-state-information-base)", icon: "ri-computer-line" },
|
|
3155
|
+
Accessories: { bg: "var(--klun-state-success-lighter)", fg: "var(--klun-state-success-base)", icon: "ri-plug-line" },
|
|
3156
|
+
Audio: { bg: "var(--klun-state-warning-lighter)", fg: "var(--klun-state-warning-base)", icon: "ri-volume-up-line" },
|
|
3157
|
+
Office: { bg: "var(--klun-state-error-lighter)", fg: "var(--klun-state-error-base)", icon: "ri-lightbulb-line" },
|
|
3158
|
+
Video: { bg: "var(--klun-primary-lighter)", fg: "var(--klun-primary-base)", icon: "ri-vidicon-line" }
|
|
3159
|
+
};
|
|
3160
|
+
var stockColor = (p) => p.stock === 0 ? "error" : p.stock / p.capacity < 0.25 ? "warning" : "success";
|
|
3161
|
+
function Field2({ label, children }) {
|
|
3162
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
3163
|
+
/* @__PURE__ */ jsx(Label, { children: label }),
|
|
3164
|
+
children
|
|
3165
|
+
] });
|
|
3166
|
+
}
|
|
3167
|
+
function ProductEditor({ open, mode, draft, onChange, onClose, onSave }) {
|
|
3168
|
+
const valid = draft.name.trim().length > 0 && draft.sku.trim().length > 0;
|
|
3169
|
+
return /* @__PURE__ */ jsx(
|
|
3170
|
+
Modal,
|
|
3171
|
+
{
|
|
3172
|
+
open,
|
|
3173
|
+
onClose,
|
|
3174
|
+
title: mode === "create" ? "New product" : "Edit product",
|
|
3175
|
+
description: mode === "create" ? "The product appears in the inventory as soon as you save it." : draft.sku,
|
|
3176
|
+
okText: mode === "create" ? "Create product" : "Save changes",
|
|
3177
|
+
okButtonProps: { disabled: !valid },
|
|
3178
|
+
onOk: () => valid && onSave(),
|
|
3179
|
+
width: 560,
|
|
3180
|
+
children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 14 }, children: [
|
|
3181
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "2fr 1fr", gap: 14 }, children: [
|
|
3182
|
+
/* @__PURE__ */ jsx(Field2, { label: "Name", children: /* @__PURE__ */ jsx(
|
|
3183
|
+
Input,
|
|
3184
|
+
{
|
|
3185
|
+
value: draft.name,
|
|
3186
|
+
placeholder: "Aero Wireless Keyboard",
|
|
3187
|
+
onChange: (e) => onChange({ name: e.target.value })
|
|
3188
|
+
}
|
|
3189
|
+
) }),
|
|
3190
|
+
/* @__PURE__ */ jsx(Field2, { label: "SKU", children: /* @__PURE__ */ jsx(
|
|
3191
|
+
Input,
|
|
3192
|
+
{
|
|
3193
|
+
value: draft.sku,
|
|
3194
|
+
placeholder: "KB-1042",
|
|
3195
|
+
onChange: (e) => onChange({ sku: e.target.value })
|
|
3196
|
+
}
|
|
3197
|
+
) })
|
|
3198
|
+
] }),
|
|
3199
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 14 }, children: [
|
|
3200
|
+
/* @__PURE__ */ jsx(Field2, { label: "Category", children: /* @__PURE__ */ jsx(Select, { value: draft.category, onChange: (e) => onChange({ category: e.target.value }), children: CATEGORIES.map((c) => /* @__PURE__ */ jsx("option", { value: c, children: c }, c)) }) }),
|
|
3201
|
+
/* @__PURE__ */ jsx(Field2, { label: "Price (USD)", children: /* @__PURE__ */ jsx(
|
|
3202
|
+
Input,
|
|
3203
|
+
{
|
|
3204
|
+
type: "number",
|
|
3205
|
+
value: String(draft.price),
|
|
3206
|
+
leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-money-dollar-circle-line" }),
|
|
3207
|
+
onChange: (e) => onChange({ price: Number(e.target.value) || 0 })
|
|
3208
|
+
}
|
|
3209
|
+
) })
|
|
3210
|
+
] }),
|
|
3211
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 14 }, children: [
|
|
3212
|
+
/* @__PURE__ */ jsx(Field2, { label: "Stock on hand", children: /* @__PURE__ */ jsx(CounterInput, { value: draft.stock, min: 0, max: draft.capacity, onChange: (v) => onChange({ stock: v }) }) }),
|
|
3213
|
+
/* @__PURE__ */ jsx(Field2, { label: "Capacity", children: /* @__PURE__ */ jsx(CounterInput, { value: draft.capacity, min: 1, max: 1e3, step: 10, onChange: (v) => onChange({ capacity: v }) }) })
|
|
3214
|
+
] }),
|
|
3215
|
+
/* @__PURE__ */ jsx(Field2, { label: "Description", children: /* @__PURE__ */ jsx(
|
|
3216
|
+
Input,
|
|
3217
|
+
{
|
|
3218
|
+
value: draft.description ?? "",
|
|
3219
|
+
placeholder: "Short internal description",
|
|
3220
|
+
onChange: (e) => onChange({ description: e.target.value })
|
|
3221
|
+
}
|
|
3222
|
+
) }),
|
|
3223
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-paragraph-xs)", color: "var(--klun-text-soft-400)" }, children: "Status follows stock: 0 = out of stock, below 25% of capacity = low stock." })
|
|
3224
|
+
] })
|
|
3225
|
+
}
|
|
3226
|
+
);
|
|
3227
|
+
}
|
|
3228
|
+
function DetailRow({ label, children }) {
|
|
3229
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 16 }, children: [
|
|
3230
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-soft-400)" }, children: label }),
|
|
3231
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-strong-950)" }, children })
|
|
3232
|
+
] });
|
|
3233
|
+
}
|
|
3234
|
+
function ProductDetail({ product, onClose, onEdit, onOpenPage, onDelete }) {
|
|
3235
|
+
return /* @__PURE__ */ jsx(
|
|
3236
|
+
Drawer,
|
|
3237
|
+
{
|
|
3238
|
+
open: product !== null,
|
|
3239
|
+
onClose,
|
|
3240
|
+
title: "Product details",
|
|
3241
|
+
width: 420,
|
|
3242
|
+
footer: product ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", gap: 8, width: "100%" }, children: [
|
|
3243
|
+
/* @__PURE__ */ jsx(
|
|
3244
|
+
Button,
|
|
3245
|
+
{
|
|
3246
|
+
size: "small",
|
|
3247
|
+
variant: "error",
|
|
3248
|
+
appearance: "lighter",
|
|
3249
|
+
leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-delete-bin-line" }),
|
|
3250
|
+
onClick: () => onDelete(product),
|
|
3251
|
+
children: "Delete"
|
|
3252
|
+
}
|
|
3253
|
+
),
|
|
3254
|
+
/* @__PURE__ */ jsxs("span", { style: { display: "flex", gap: 8 }, children: [
|
|
3255
|
+
/* @__PURE__ */ jsx(Button, { size: "small", variant: "neutral", appearance: "ghost", onClick: () => onOpenPage(product), children: "Full editor" }),
|
|
3256
|
+
/* @__PURE__ */ jsx(Button, { size: "small", leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-edit-line" }), onClick: () => onEdit(product), children: "Edit product" })
|
|
3257
|
+
] })
|
|
3258
|
+
] }) : null,
|
|
3259
|
+
children: product ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 20 }, children: [
|
|
3260
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 12 }, children: [
|
|
3261
|
+
/* @__PURE__ */ jsx(Thumb, { category: product.category }),
|
|
3262
|
+
/* @__PURE__ */ jsxs("div", { style: { minWidth: 0 }, children: [
|
|
3263
|
+
/* @__PURE__ */ jsx("div", { style: { font: "var(--klun-text-label-md)", color: "var(--klun-text-strong-950)" }, children: product.name }),
|
|
3264
|
+
/* @__PURE__ */ jsx("div", { style: { font: "var(--klun-text-paragraph-xs)", color: "var(--klun-text-soft-400)" }, children: product.sku })
|
|
3265
|
+
] }),
|
|
3266
|
+
/* @__PURE__ */ jsx("span", { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(Badge, { color: STATUS_COLOR3[product.status], variant: "light", size: "small", dot: true, children: product.status }) })
|
|
3267
|
+
] }),
|
|
3268
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
3269
|
+
/* @__PURE__ */ jsx(DetailRow, { label: "Category", children: product.category }),
|
|
3270
|
+
/* @__PURE__ */ jsx(DetailRow, { label: "Price", children: /* @__PURE__ */ jsx(Money, { value: product.price, currency: "USD", locale: "en-US" }) }),
|
|
3271
|
+
/* @__PURE__ */ jsxs(DetailRow, { label: "Stock", children: [
|
|
3272
|
+
product.stock,
|
|
3273
|
+
" of ",
|
|
3274
|
+
product.capacity
|
|
3275
|
+
] })
|
|
3276
|
+
] }),
|
|
3277
|
+
/* @__PURE__ */ jsx(ProgressBar, { value: product.stock, max: product.capacity, color: stockColor(product) }),
|
|
3278
|
+
product.description ? /* @__PURE__ */ jsx(
|
|
3279
|
+
"span",
|
|
3280
|
+
{
|
|
3281
|
+
style: {
|
|
3282
|
+
font: "var(--klun-text-paragraph-sm)",
|
|
3283
|
+
color: "var(--klun-text-sub-600)",
|
|
3284
|
+
boxShadow: "inset 0 1px 0 var(--klun-stroke-soft-200)",
|
|
3285
|
+
paddingTop: 16
|
|
3286
|
+
},
|
|
3287
|
+
children: product.description
|
|
3288
|
+
}
|
|
3289
|
+
) : null
|
|
3290
|
+
] }) : null
|
|
3291
|
+
}
|
|
3292
|
+
);
|
|
3293
|
+
}
|
|
3294
|
+
function Thumb({ category }) {
|
|
3295
|
+
const tone = CATEGORY_TONE[category] ?? CATEGORY_TONE.Accessories;
|
|
3296
|
+
return /* @__PURE__ */ jsx(
|
|
3297
|
+
"span",
|
|
3298
|
+
{
|
|
3299
|
+
style: {
|
|
3300
|
+
width: 34,
|
|
3301
|
+
height: 34,
|
|
3302
|
+
borderRadius: "var(--klun-radius-md)",
|
|
3303
|
+
background: tone.bg,
|
|
3304
|
+
color: tone.fg,
|
|
3305
|
+
display: "inline-flex",
|
|
3306
|
+
alignItems: "center",
|
|
3307
|
+
justifyContent: "center",
|
|
3308
|
+
fontSize: 17,
|
|
3309
|
+
flexShrink: 0
|
|
3310
|
+
},
|
|
3311
|
+
children: /* @__PURE__ */ jsx("i", { className: tone.icon })
|
|
3312
|
+
}
|
|
3313
|
+
);
|
|
3314
|
+
}
|
|
3315
|
+
function ProductsScreen() {
|
|
3316
|
+
const [products, setProducts] = useState(INITIAL_PRODUCTS);
|
|
3317
|
+
const [editor, setEditor] = useState(null);
|
|
3318
|
+
const [draft, setDraft] = useState(emptyDraft);
|
|
3319
|
+
const [detail, setDetail] = useState(null);
|
|
3320
|
+
const [route, setRoute] = useState({
|
|
3321
|
+
name: "list"
|
|
3322
|
+
});
|
|
3323
|
+
const toDraft = (p) => {
|
|
3324
|
+
const { id: _id, ...rest } = p;
|
|
3325
|
+
return rest;
|
|
3326
|
+
};
|
|
3327
|
+
const upsert = (d, mode, id) => {
|
|
3328
|
+
if (mode === "create") {
|
|
3329
|
+
setProducts((prev) => [{ id: `p${Date.now()}`, ...d }, ...prev]);
|
|
3330
|
+
return;
|
|
3331
|
+
}
|
|
3332
|
+
if (id) {
|
|
3333
|
+
setProducts((prev) => prev.map((p) => p.id === id ? { ...p, ...d } : p));
|
|
3334
|
+
setDetail((x) => x && x.id === id ? { ...x, ...d } : x);
|
|
3335
|
+
}
|
|
3336
|
+
};
|
|
3337
|
+
if (route.name !== "list") {
|
|
3338
|
+
const mode = route.name;
|
|
3339
|
+
const editing = mode === "edit" ? route.product : void 0;
|
|
3340
|
+
return /* @__PURE__ */ jsx(
|
|
3341
|
+
ProductWizardPage,
|
|
3342
|
+
{
|
|
3343
|
+
mode,
|
|
3344
|
+
initial: editing ? toDraft(editing) : emptyDraft(),
|
|
3345
|
+
onCancel: () => setRoute({ name: "list" }),
|
|
3346
|
+
onSave: (d) => {
|
|
3347
|
+
upsert(d, mode, editing?.id);
|
|
3348
|
+
setRoute({ name: "list" });
|
|
3349
|
+
}
|
|
3350
|
+
}
|
|
3351
|
+
);
|
|
3352
|
+
}
|
|
3353
|
+
const totals = {
|
|
3354
|
+
skus: products.length,
|
|
3355
|
+
low: products.filter((p) => p.status === "Low stock").length,
|
|
3356
|
+
out: products.filter((p) => p.status === "Out of stock").length,
|
|
3357
|
+
value: products.reduce((sum, p) => sum + p.price * p.stock, 0)
|
|
3358
|
+
};
|
|
3359
|
+
const openCreate = () => {
|
|
3360
|
+
setDraft(emptyDraft());
|
|
3361
|
+
setEditor({ mode: "create" });
|
|
3362
|
+
};
|
|
3363
|
+
const openEdit = (p) => {
|
|
3364
|
+
setDraft(toDraft(p));
|
|
3365
|
+
setEditor({ mode: "edit", product: p });
|
|
3366
|
+
};
|
|
3367
|
+
const saveDraft = () => {
|
|
3368
|
+
const status = deriveStatus(draft.stock, draft.capacity);
|
|
3369
|
+
upsert({ ...draft, status }, editor?.mode ?? "create", editor?.product?.id);
|
|
3370
|
+
setEditor(null);
|
|
3371
|
+
};
|
|
3372
|
+
const removeProduct = async (p) => {
|
|
3373
|
+
const res = await Confirm({
|
|
3374
|
+
title: `Delete ${p.name}?`,
|
|
3375
|
+
description: `${p.sku} will be removed from the inventory. This can't be undone.`,
|
|
3376
|
+
intent: "danger",
|
|
3377
|
+
confirmText: "Delete product"
|
|
3378
|
+
});
|
|
3379
|
+
if (res === true || typeof res === "object" && res.confirmed) {
|
|
3380
|
+
setProducts((prev) => prev.filter((x) => x.id !== p.id));
|
|
3381
|
+
setDetail((d) => d && d.id === p.id ? null : d);
|
|
3382
|
+
}
|
|
3383
|
+
};
|
|
3384
|
+
const columns = [
|
|
3385
|
+
{
|
|
3386
|
+
key: "name",
|
|
3387
|
+
header: "Product",
|
|
3388
|
+
render: (p) => /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 10 }, children: [
|
|
3389
|
+
/* @__PURE__ */ jsx(Thumb, { category: p.category }),
|
|
3390
|
+
/* @__PURE__ */ jsxs("span", { style: { display: "flex", flexDirection: "column" }, children: [
|
|
3391
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-strong-950)" }, children: p.name }),
|
|
3392
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-xs)", color: "var(--klun-text-soft-400)" }, children: p.sku })
|
|
3393
|
+
] })
|
|
3394
|
+
] })
|
|
3395
|
+
},
|
|
3396
|
+
{ key: "category", header: "Category" },
|
|
3397
|
+
{
|
|
3398
|
+
key: "price",
|
|
3399
|
+
header: "Price",
|
|
3400
|
+
align: "right",
|
|
3401
|
+
render: (p) => /* @__PURE__ */ jsx(Money, { value: p.price, currency: "USD", locale: "en-US", style: { font: "var(--klun-text-label-sm)" } })
|
|
3402
|
+
},
|
|
3403
|
+
{
|
|
3404
|
+
key: "stock",
|
|
3405
|
+
header: "Stock",
|
|
3406
|
+
width: 190,
|
|
3407
|
+
render: (p) => /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: 10, minWidth: 150 }, children: [
|
|
3408
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 }, children: /* @__PURE__ */ jsx(ProgressBar, { value: p.stock, max: p.capacity, color: stockColor(p) }) }),
|
|
3409
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-xs)", color: "var(--klun-text-sub-600)", width: 32, textAlign: "right" }, children: p.stock })
|
|
3410
|
+
] })
|
|
3411
|
+
},
|
|
3412
|
+
{
|
|
3413
|
+
key: "status",
|
|
3414
|
+
header: "Status",
|
|
3415
|
+
filters: [
|
|
3416
|
+
{ label: "Active", value: "Active" },
|
|
3417
|
+
{ label: "Low stock", value: "Low stock" },
|
|
3418
|
+
{ label: "Out of stock", value: "Out of stock" }
|
|
3419
|
+
],
|
|
3420
|
+
render: (p) => /* @__PURE__ */ jsx(Badge, { color: STATUS_COLOR3[p.status], variant: "light", size: "small", dot: true, children: p.status })
|
|
3421
|
+
},
|
|
3422
|
+
{
|
|
3423
|
+
key: "actions",
|
|
3424
|
+
header: "",
|
|
3425
|
+
width: 56,
|
|
3426
|
+
align: "right",
|
|
3427
|
+
exportable: false,
|
|
3428
|
+
render: (p) => /* @__PURE__ */ jsx(
|
|
3429
|
+
Dropdown,
|
|
3430
|
+
{
|
|
3431
|
+
align: "right",
|
|
3432
|
+
width: 190,
|
|
3433
|
+
trigger: /* @__PURE__ */ jsx(
|
|
3434
|
+
Button,
|
|
3435
|
+
{
|
|
3436
|
+
kind: "compact",
|
|
3437
|
+
appearance: "ghost",
|
|
3438
|
+
icon: /* @__PURE__ */ jsx("i", { className: "ri-more-2-line" }),
|
|
3439
|
+
"aria-label": `Actions for ${p.name}`
|
|
3440
|
+
}
|
|
3441
|
+
),
|
|
3442
|
+
items: [
|
|
3443
|
+
{ label: "View details", icon: /* @__PURE__ */ jsx("i", { className: "ri-eye-line" }), onClick: () => setDetail(p) },
|
|
3444
|
+
{ label: "Quick edit \u2014 modal", icon: /* @__PURE__ */ jsx("i", { className: "ri-edit-line" }), onClick: () => openEdit(p) },
|
|
3445
|
+
{ label: "Edit in page", icon: /* @__PURE__ */ jsx("i", { className: "ri-layout-top-line" }), onClick: () => setRoute({ name: "edit", product: p }) },
|
|
3446
|
+
{ label: "Duplicate", icon: /* @__PURE__ */ jsx("i", { className: "ri-file-copy-line" }), onClick: () => openCreate() },
|
|
3447
|
+
{ divider: true },
|
|
3448
|
+
{ label: "Delete product", icon: /* @__PURE__ */ jsx("i", { className: "ri-delete-bin-line" }), danger: true, onClick: () => void removeProduct(p) }
|
|
3449
|
+
]
|
|
3450
|
+
}
|
|
3451
|
+
)
|
|
3452
|
+
}
|
|
3453
|
+
];
|
|
3454
|
+
return /* @__PURE__ */ jsxs("div", { style: { padding: 24, display: "flex", flexDirection: "column", gap: 20 }, children: [
|
|
3455
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "flex-end", justifyContent: "space-between", gap: 16, flexWrap: "wrap" }, children: [
|
|
3456
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
3457
|
+
/* @__PURE__ */ jsx("h1", { style: { margin: 0, font: "var(--klun-text-title-h4)", color: "var(--klun-text-strong-950)" }, children: "Products" }),
|
|
3458
|
+
/* @__PURE__ */ jsx("p", { style: { margin: "4px 0 0", font: "var(--klun-text-paragraph-sm)", color: "var(--klun-text-sub-600)" }, children: "Inventory levels, pricing and availability \u2014 full create, edit and delete flows." })
|
|
3459
|
+
] }),
|
|
3460
|
+
/* @__PURE__ */ jsx(
|
|
3461
|
+
Dropdown,
|
|
3462
|
+
{
|
|
3463
|
+
align: "right",
|
|
3464
|
+
width: 220,
|
|
3465
|
+
trigger: /* @__PURE__ */ jsx(Button, { size: "small", leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-add-line" }), children: "Add product" }),
|
|
3466
|
+
items: [
|
|
3467
|
+
{ label: "Quick add \u2014 modal", icon: /* @__PURE__ */ jsx("i", { className: "ri-add-box-line" }), onClick: openCreate },
|
|
3468
|
+
{
|
|
3469
|
+
label: "Full-page editor",
|
|
3470
|
+
icon: /* @__PURE__ */ jsx("i", { className: "ri-layout-top-line" }),
|
|
3471
|
+
onClick: () => setRoute({ name: "create" })
|
|
3472
|
+
}
|
|
3473
|
+
]
|
|
3474
|
+
}
|
|
3475
|
+
)
|
|
3476
|
+
] }),
|
|
3477
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(180px, 1fr))", gap: 16 }, children: [
|
|
3478
|
+
/* @__PURE__ */ jsx(MiniStat, { label: "SKUs", value: totals.skus, hint: "across 6 categories" }),
|
|
3479
|
+
/* @__PURE__ */ jsx(MiniStat, { label: "Low stock", value: totals.low, hint: "needs restocking", tone: "warning" }),
|
|
3480
|
+
/* @__PURE__ */ jsx(MiniStat, { label: "Out of stock", value: totals.out, hint: "not purchasable", tone: "danger" }),
|
|
3481
|
+
/* @__PURE__ */ jsx(MiniStat, { label: "Inventory value", value: /* @__PURE__ */ jsx(Money, { value: totals.value, currency: "USD", locale: "en-US", size: "lg" }), hint: "at cost price", tone: "success" })
|
|
3482
|
+
] }),
|
|
3483
|
+
/* @__PURE__ */ jsx(
|
|
3484
|
+
Table,
|
|
3485
|
+
{
|
|
3486
|
+
columns,
|
|
3487
|
+
rows: products,
|
|
3488
|
+
getRowId: (p) => p.id,
|
|
3489
|
+
title: "Inventory",
|
|
3490
|
+
toolbar: /* @__PURE__ */ jsx(Button, { size: "tiny", variant: "neutral", appearance: "stroke", leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-filter-3-line" }), children: "Filters" }),
|
|
3491
|
+
sortable: true,
|
|
3492
|
+
columnSettings: true,
|
|
3493
|
+
exportable: { filename: "products.csv" }
|
|
3494
|
+
}
|
|
3495
|
+
),
|
|
3496
|
+
/* @__PURE__ */ jsx(
|
|
3497
|
+
ProductEditor,
|
|
3498
|
+
{
|
|
3499
|
+
open: editor !== null,
|
|
3500
|
+
mode: editor?.mode ?? "create",
|
|
3501
|
+
draft,
|
|
3502
|
+
onChange: (patch) => setDraft((d) => ({ ...d, ...patch })),
|
|
3503
|
+
onClose: () => setEditor(null),
|
|
3504
|
+
onSave: saveDraft
|
|
3505
|
+
}
|
|
3506
|
+
),
|
|
3507
|
+
/* @__PURE__ */ jsx(
|
|
3508
|
+
ProductDetail,
|
|
3509
|
+
{
|
|
3510
|
+
product: detail,
|
|
3511
|
+
onClose: () => setDetail(null),
|
|
3512
|
+
onEdit: (p) => {
|
|
3513
|
+
setDetail(null);
|
|
3514
|
+
openEdit(p);
|
|
3515
|
+
},
|
|
3516
|
+
onOpenPage: (p) => {
|
|
3517
|
+
setDetail(null);
|
|
3518
|
+
setRoute({ name: "edit", product: p });
|
|
3519
|
+
},
|
|
3520
|
+
onDelete: (p) => void removeProduct(p)
|
|
3521
|
+
}
|
|
3522
|
+
)
|
|
3523
|
+
] });
|
|
3524
|
+
}
|
|
3525
|
+
var CUSTOMERS = [
|
|
3526
|
+
{ id: "c1", name: "Anna Krause", email: "anna@acme.io", segment: "VIP", orders: 42, spend: 18420, lastSeen: "2026-09-16T08:30:00Z", country: "Germany" },
|
|
3527
|
+
{ id: "c2", name: "Ben Ortiz", email: "ben@northwind.co", segment: "Regular", orders: 17, spend: 5210.5, lastSeen: "2026-09-16T06:10:00Z", country: "Mexico" },
|
|
3528
|
+
{ id: "c3", name: "Chloe Lin", email: "chloe@lumen.dev", segment: "VIP", orders: 55, spend: 24980, lastSeen: "2026-09-15T19:45:00Z", country: "Singapore" },
|
|
3529
|
+
{ id: "c4", name: "Dmitri Volkov", email: "dmitri@volk.io", segment: "New", orders: 2, spend: 340, lastSeen: "2026-09-15T12:05:00Z", country: "Georgia" },
|
|
3530
|
+
{ id: "c5", name: "Erin Walsh", email: "erin@walsh.ie", segment: "Regular", orders: 23, spend: 7690, lastSeen: "2026-09-14T16:20:00Z", country: "Ireland" },
|
|
3531
|
+
{ id: "c6", name: "Farid Haddad", email: "farid@levant.sa", segment: "Regular", orders: 11, spend: 3980, lastSeen: "2026-09-14T09:00:00Z", country: "Saudi Arabia" },
|
|
3532
|
+
{ id: "c7", name: "Grace Miller", email: "grace@miller.us", segment: "New", orders: 1, spend: 148, lastSeen: "2026-09-13T20:12:00Z", country: "United States" },
|
|
3533
|
+
{ id: "c8", name: "Hugo Silva", email: "hugo@silva.br", segment: "VIP", orders: 38, spend: 15340, lastSeen: "2026-09-13T10:40:00Z", country: "Brazil" }
|
|
3534
|
+
];
|
|
3535
|
+
var SEGMENT_COLOR = {
|
|
3536
|
+
VIP: "purple",
|
|
3537
|
+
Regular: "blue",
|
|
3538
|
+
New: "green"
|
|
3539
|
+
};
|
|
3540
|
+
var initials2 = (name) => name.split(" ").map((s) => s[0]).join("");
|
|
3541
|
+
function CustomersScreen() {
|
|
3542
|
+
const totalSpend = CUSTOMERS.reduce((sum, c) => sum + c.spend, 0);
|
|
3543
|
+
const columns = [
|
|
3544
|
+
{
|
|
3545
|
+
key: "name",
|
|
3546
|
+
header: "Customer",
|
|
3547
|
+
render: (c) => /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 10 }, children: [
|
|
3548
|
+
/* @__PURE__ */ jsx(Avatar, { size: "32", initials: initials2(c.name), color: "blue" }),
|
|
3549
|
+
/* @__PURE__ */ jsxs("span", { style: { display: "flex", flexDirection: "column" }, children: [
|
|
3550
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-strong-950)" }, children: c.name }),
|
|
3551
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-xs)", color: "var(--klun-text-soft-400)" }, children: c.email })
|
|
3552
|
+
] })
|
|
3553
|
+
] })
|
|
3554
|
+
},
|
|
3555
|
+
{
|
|
3556
|
+
key: "segment",
|
|
3557
|
+
header: "Segment",
|
|
3558
|
+
filters: [
|
|
3559
|
+
{ label: "VIP", value: "VIP" },
|
|
3560
|
+
{ label: "Regular", value: "Regular" },
|
|
3561
|
+
{ label: "New", value: "New" }
|
|
3562
|
+
],
|
|
3563
|
+
render: (c) => /* @__PURE__ */ jsx(Chip, { color: SEGMENT_COLOR[c.segment], dot: true, children: c.segment })
|
|
3564
|
+
},
|
|
3565
|
+
{ key: "country", header: "Country" },
|
|
3566
|
+
{ key: "orders", header: "Orders", align: "center" },
|
|
3567
|
+
{
|
|
3568
|
+
key: "spend",
|
|
3569
|
+
header: "Lifetime spend",
|
|
3570
|
+
align: "right",
|
|
3571
|
+
render: (c) => /* @__PURE__ */ jsx(
|
|
3572
|
+
Money,
|
|
3573
|
+
{
|
|
3574
|
+
value: c.spend,
|
|
3575
|
+
currency: "USD",
|
|
3576
|
+
locale: "en-US",
|
|
3577
|
+
tone: c.segment === "VIP" ? "increase" : "default",
|
|
3578
|
+
style: { font: "var(--klun-text-label-sm)" }
|
|
3579
|
+
}
|
|
3580
|
+
)
|
|
3581
|
+
},
|
|
3582
|
+
{
|
|
3583
|
+
key: "lastSeen",
|
|
3584
|
+
header: "Last active",
|
|
3585
|
+
render: (c) => /* @__PURE__ */ jsx(
|
|
3586
|
+
RelativeTime,
|
|
3587
|
+
{
|
|
3588
|
+
date: c.lastSeen,
|
|
3589
|
+
live: false,
|
|
3590
|
+
style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-sub-600)" }
|
|
3591
|
+
}
|
|
3592
|
+
)
|
|
3593
|
+
}
|
|
3594
|
+
];
|
|
3595
|
+
return /* @__PURE__ */ jsxs("div", { style: { padding: 24, display: "flex", flexDirection: "column", gap: 20 }, children: [
|
|
3596
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "flex-end", justifyContent: "space-between", gap: 16, flexWrap: "wrap" }, children: [
|
|
3597
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
3598
|
+
/* @__PURE__ */ jsx("h1", { style: { margin: 0, font: "var(--klun-text-title-h4)", color: "var(--klun-text-strong-950)" }, children: "Customers" }),
|
|
3599
|
+
/* @__PURE__ */ jsx("p", { style: { margin: "4px 0 0", font: "var(--klun-text-paragraph-sm)", color: "var(--klun-text-sub-600)" }, children: "Segments, spend and engagement across your customer base." })
|
|
3600
|
+
] }),
|
|
3601
|
+
/* @__PURE__ */ jsx(Button, { size: "small", leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-user-add-line" }), children: "Invite customer" })
|
|
3602
|
+
] }),
|
|
3603
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(180px, 1fr))", gap: 16 }, children: [
|
|
3604
|
+
/* @__PURE__ */ jsx(MiniStat, { label: "Customers", value: "9,402", hint: "+2.3% this month" }),
|
|
3605
|
+
/* @__PURE__ */ jsx(MiniStat, { label: "New (30d)", value: "384", hint: "+12.4% vs last month", tone: "success" }),
|
|
3606
|
+
/* @__PURE__ */ jsx(MiniStat, { label: "Repeat rate", value: "46%", hint: "+1.8 pts", tone: "success" }),
|
|
3607
|
+
/* @__PURE__ */ jsx(MiniStat, { label: "Lifetime value shown", value: /* @__PURE__ */ jsx(Money, { value: totalSpend, currency: "USD", locale: "en-US", size: "lg" }), hint: "top 8 customers", tone: "feature" })
|
|
3608
|
+
] }),
|
|
3609
|
+
/* @__PURE__ */ jsx(
|
|
3610
|
+
Table,
|
|
3611
|
+
{
|
|
3612
|
+
columns,
|
|
3613
|
+
rows: CUSTOMERS,
|
|
3614
|
+
getRowId: (c) => c.id,
|
|
3615
|
+
title: "All customers",
|
|
3616
|
+
sortable: true,
|
|
3617
|
+
exportable: { filename: "customers.csv" },
|
|
3618
|
+
pagination: { defaultPageSize: 8 }
|
|
3619
|
+
}
|
|
3620
|
+
)
|
|
3621
|
+
] });
|
|
3622
|
+
}
|
|
3623
|
+
var ROLES = ["Owner", "Admin", "Manager", "Editor", "Viewer"];
|
|
3624
|
+
var INITIAL_USERS = [
|
|
3625
|
+
{ id: "u1", name: "Anna Krause", email: "anna@acme.io", role: "Owner", status: "Active", twoFA: true, lastSeen: "2026-09-16T08:30:00Z" },
|
|
3626
|
+
{ id: "u2", name: "Ben Ortiz", email: "ben@acme.io", role: "Admin", status: "Active", twoFA: true, lastSeen: "2026-09-16T06:10:00Z" },
|
|
3627
|
+
{ id: "u3", name: "Chloe Lin", email: "chloe@acme.io", role: "Manager", status: "Active", twoFA: false, lastSeen: "2026-09-15T19:45:00Z" },
|
|
3628
|
+
{ id: "u4", name: "Dmitri Volkov", email: "dmitri@acme.io", role: "Editor", status: "Invited", twoFA: false, lastSeen: "2026-09-15T12:05:00Z" },
|
|
3629
|
+
{ id: "u5", name: "Erin Walsh", email: "erin@acme.io", role: "Editor", status: "Active", twoFA: true, lastSeen: "2026-09-14T16:20:00Z" },
|
|
3630
|
+
{ id: "u6", name: "Farid Haddad", email: "farid@acme.io", role: "Viewer", status: "Suspended", twoFA: false, lastSeen: "2026-09-02T09:00:00Z" },
|
|
3631
|
+
{ id: "u7", name: "Grace Miller", email: "grace@acme.io", role: "Viewer", status: "Active", twoFA: false, lastSeen: "2026-09-13T20:12:00Z" }
|
|
3632
|
+
];
|
|
3633
|
+
var ROLE_COLOR = {
|
|
3634
|
+
Owner: "purple",
|
|
3635
|
+
Admin: "blue",
|
|
3636
|
+
Manager: "teal",
|
|
3637
|
+
Editor: "green",
|
|
3638
|
+
Viewer: "gray"
|
|
3639
|
+
};
|
|
3640
|
+
var STATUS_COLOR4 = {
|
|
3641
|
+
Active: "green",
|
|
3642
|
+
Invited: "blue",
|
|
3643
|
+
Suspended: "gray"
|
|
3644
|
+
};
|
|
3645
|
+
var initials3 = (name) => name.split(" ").map((s) => s[0]).join("");
|
|
3646
|
+
function UsersScreen() {
|
|
3647
|
+
const [users, setUsers] = useState(INITIAL_USERS);
|
|
3648
|
+
const [editor, setEditor] = useState(null);
|
|
3649
|
+
const [form, setForm] = useState({
|
|
3650
|
+
name: "",
|
|
3651
|
+
email: "",
|
|
3652
|
+
role: "Viewer",
|
|
3653
|
+
twoFA: false
|
|
3654
|
+
});
|
|
3655
|
+
const openCreate = () => {
|
|
3656
|
+
setForm({ name: "", email: "", role: "Viewer", twoFA: false });
|
|
3657
|
+
setEditor({ mode: "create" });
|
|
3658
|
+
};
|
|
3659
|
+
const openEdit = (user) => {
|
|
3660
|
+
setForm({ name: user.name, email: user.email, role: user.role, twoFA: user.twoFA });
|
|
3661
|
+
setEditor({ mode: "edit", user });
|
|
3662
|
+
};
|
|
3663
|
+
const save = () => {
|
|
3664
|
+
if (!editor) return;
|
|
3665
|
+
if (editor.mode === "create") {
|
|
3666
|
+
setUsers((prev) => [
|
|
3667
|
+
...prev,
|
|
3668
|
+
{
|
|
3669
|
+
id: `u${Date.now()}`,
|
|
3670
|
+
name: form.name.trim() || "New teammate",
|
|
3671
|
+
email: form.email.trim() || "teammate@acme.io",
|
|
3672
|
+
role: form.role,
|
|
3673
|
+
status: "Invited",
|
|
3674
|
+
twoFA: form.twoFA,
|
|
3675
|
+
lastSeen: (/* @__PURE__ */ new Date()).toISOString()
|
|
3676
|
+
}
|
|
3677
|
+
]);
|
|
3678
|
+
} else if (editor.user) {
|
|
3679
|
+
setUsers(
|
|
3680
|
+
(prev) => prev.map(
|
|
3681
|
+
(u) => u.id === editor.user.id ? { ...u, name: form.name.trim() || u.name, email: form.email.trim() || u.email, role: form.role, twoFA: form.twoFA } : u
|
|
3682
|
+
)
|
|
3683
|
+
);
|
|
3684
|
+
}
|
|
3685
|
+
setEditor(null);
|
|
3686
|
+
};
|
|
3687
|
+
const toggleSuspend = (user) => {
|
|
3688
|
+
setUsers(
|
|
3689
|
+
(prev) => prev.map(
|
|
3690
|
+
(u) => u.id === user.id ? { ...u, status: u.status === "Suspended" ? "Active" : "Suspended" } : u
|
|
3691
|
+
)
|
|
3692
|
+
);
|
|
3693
|
+
};
|
|
3694
|
+
const remove = async (user) => {
|
|
3695
|
+
const res = await Confirm({
|
|
3696
|
+
title: `Remove ${user.name}?`,
|
|
3697
|
+
description: `${user.email} will lose access to the workspace immediately. This can't be undone.`,
|
|
3698
|
+
intent: "danger",
|
|
3699
|
+
confirmText: "Remove user"
|
|
3700
|
+
});
|
|
3701
|
+
if (res === true || typeof res === "object" && res.confirmed) {
|
|
3702
|
+
setUsers((prev) => prev.filter((u) => u.id !== user.id));
|
|
3703
|
+
}
|
|
3704
|
+
};
|
|
3705
|
+
const columns = [
|
|
3706
|
+
{
|
|
3707
|
+
key: "name",
|
|
3708
|
+
header: "User",
|
|
3709
|
+
render: (u) => /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 10 }, children: [
|
|
3710
|
+
/* @__PURE__ */ jsx(Avatar, { size: "32", initials: initials3(u.name), color: "blue" }),
|
|
3711
|
+
/* @__PURE__ */ jsxs("span", { style: { display: "flex", flexDirection: "column" }, children: [
|
|
3712
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-strong-950)" }, children: u.name }),
|
|
3713
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-xs)", color: "var(--klun-text-soft-400)" }, children: u.email })
|
|
3714
|
+
] })
|
|
3715
|
+
] })
|
|
3716
|
+
},
|
|
3717
|
+
{
|
|
3718
|
+
key: "role",
|
|
3719
|
+
header: "Role",
|
|
3720
|
+
filters: ROLES.map((r) => ({ label: r, value: r })),
|
|
3721
|
+
render: (u) => /* @__PURE__ */ jsx(Chip, { color: ROLE_COLOR[u.role], dot: true, children: u.role })
|
|
3722
|
+
},
|
|
3723
|
+
{
|
|
3724
|
+
key: "status",
|
|
3725
|
+
header: "Status",
|
|
3726
|
+
filters: ["Active", "Invited", "Suspended"].map((s) => ({ label: s, value: s })),
|
|
3727
|
+
render: (u) => /* @__PURE__ */ jsx(Badge, { color: STATUS_COLOR4[u.status], variant: "light", size: "small", dot: true, children: u.status })
|
|
3728
|
+
},
|
|
3729
|
+
{
|
|
3730
|
+
key: "twoFA",
|
|
3731
|
+
header: "2FA",
|
|
3732
|
+
align: "center",
|
|
3733
|
+
render: (u) => u.twoFA ? /* @__PURE__ */ jsx(Badge, { color: "green", variant: "lighter", size: "small", leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-lock-2-line" }), children: "On" }) : /* @__PURE__ */ jsx(Badge, { color: "gray", variant: "lighter", size: "small", leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-lock-unlock-line" }), children: "Off" })
|
|
3734
|
+
},
|
|
3735
|
+
{
|
|
3736
|
+
key: "lastSeen",
|
|
3737
|
+
header: "Last active",
|
|
3738
|
+
render: (u) => /* @__PURE__ */ jsx(
|
|
3739
|
+
RelativeTime,
|
|
3740
|
+
{
|
|
3741
|
+
date: u.lastSeen,
|
|
3742
|
+
live: false,
|
|
3743
|
+
style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-sub-600)" }
|
|
3744
|
+
}
|
|
3745
|
+
)
|
|
3746
|
+
},
|
|
3747
|
+
{
|
|
3748
|
+
key: "actions",
|
|
3749
|
+
header: "",
|
|
3750
|
+
width: 60,
|
|
3751
|
+
align: "right",
|
|
3752
|
+
exportable: false,
|
|
3753
|
+
render: (u) => /* @__PURE__ */ jsx(
|
|
3754
|
+
Dropdown,
|
|
3755
|
+
{
|
|
3756
|
+
align: "right",
|
|
3757
|
+
width: 190,
|
|
3758
|
+
trigger: /* @__PURE__ */ jsx(
|
|
3759
|
+
Button,
|
|
3760
|
+
{
|
|
3761
|
+
kind: "compact",
|
|
3762
|
+
appearance: "ghost",
|
|
3763
|
+
icon: /* @__PURE__ */ jsx("i", { className: "ri-more-2-line" }),
|
|
3764
|
+
"aria-label": `Actions for ${u.name}`
|
|
3765
|
+
}
|
|
3766
|
+
),
|
|
3767
|
+
items: [
|
|
3768
|
+
{ label: "Edit details", icon: /* @__PURE__ */ jsx("i", { className: "ri-edit-line" }), onClick: () => openEdit(u) },
|
|
3769
|
+
{ label: "Send reset link", icon: /* @__PURE__ */ jsx("i", { className: "ri-mail-send-line" }), onClick: () => {
|
|
3770
|
+
} },
|
|
3771
|
+
{
|
|
3772
|
+
label: u.status === "Suspended" ? "Restore access" : "Suspend access",
|
|
3773
|
+
icon: /* @__PURE__ */ jsx("i", { className: u.status === "Suspended" ? "ri-play-circle-line" : "ri-pause-circle-line" }),
|
|
3774
|
+
onClick: () => toggleSuspend(u)
|
|
3775
|
+
},
|
|
3776
|
+
{ divider: true, label: "" },
|
|
3777
|
+
{ label: "Remove user", icon: /* @__PURE__ */ jsx("i", { className: "ri-delete-bin-line" }), danger: true, onClick: () => void remove(u) }
|
|
3778
|
+
]
|
|
3779
|
+
}
|
|
3780
|
+
)
|
|
3781
|
+
}
|
|
3782
|
+
];
|
|
3783
|
+
return /* @__PURE__ */ jsxs("div", { style: { padding: 24, display: "flex", flexDirection: "column", gap: 20 }, children: [
|
|
3784
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "flex-end", justifyContent: "space-between", gap: 16, flexWrap: "wrap" }, children: [
|
|
3785
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
3786
|
+
/* @__PURE__ */ jsx("h1", { style: { margin: 0, font: "var(--klun-text-title-h4)", color: "var(--klun-text-strong-950)" }, children: "Team members" }),
|
|
3787
|
+
/* @__PURE__ */ jsx("p", { style: { margin: "4px 0 0", font: "var(--klun-text-paragraph-sm)", color: "var(--klun-text-sub-600)" }, children: "Invite people, assign roles and control access. Roles are managed on the Roles page." })
|
|
3788
|
+
] }),
|
|
3789
|
+
/* @__PURE__ */ jsx(Button, { size: "small", leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-user-add-line" }), onClick: openCreate, children: "Invite user" })
|
|
3790
|
+
] }),
|
|
3791
|
+
/* @__PURE__ */ jsx(
|
|
3792
|
+
Table,
|
|
3793
|
+
{
|
|
3794
|
+
columns,
|
|
3795
|
+
rows: users,
|
|
3796
|
+
getRowId: (u) => u.id,
|
|
3797
|
+
title: `Members (${users.length})`,
|
|
3798
|
+
sortable: true,
|
|
3799
|
+
exportable: { filename: "team.csv" },
|
|
3800
|
+
pagination: { defaultPageSize: 8 }
|
|
3801
|
+
}
|
|
3802
|
+
),
|
|
3803
|
+
/* @__PURE__ */ jsx(
|
|
3804
|
+
Modal,
|
|
3805
|
+
{
|
|
3806
|
+
open: editor !== null,
|
|
3807
|
+
onClose: () => setEditor(null),
|
|
3808
|
+
title: editor?.mode === "create" ? "Invite user" : "Edit user",
|
|
3809
|
+
description: editor?.mode === "create" ? "They'll receive an email with a link to set their password." : editor?.user?.email,
|
|
3810
|
+
okText: editor?.mode === "create" ? "Send invite" : "Save changes",
|
|
3811
|
+
onOk: save,
|
|
3812
|
+
width: 480,
|
|
3813
|
+
children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 14 }, children: [
|
|
3814
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 14 }, children: [
|
|
3815
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
3816
|
+
/* @__PURE__ */ jsx(Label, { children: "Full name" }),
|
|
3817
|
+
/* @__PURE__ */ jsx(
|
|
3818
|
+
Input,
|
|
3819
|
+
{
|
|
3820
|
+
placeholder: "Jane Cooper",
|
|
3821
|
+
value: form.name,
|
|
3822
|
+
onChange: (e) => setForm((f) => ({ ...f, name: e.target.value }))
|
|
3823
|
+
}
|
|
3824
|
+
)
|
|
3825
|
+
] }),
|
|
3826
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
3827
|
+
/* @__PURE__ */ jsx(Label, { children: "Role" }),
|
|
3828
|
+
/* @__PURE__ */ jsx(Select, { value: form.role, onChange: (e) => setForm((f) => ({ ...f, role: e.target.value })), children: ROLES.map((r) => /* @__PURE__ */ jsx("option", { value: r, children: r }, r)) })
|
|
3829
|
+
] })
|
|
3830
|
+
] }),
|
|
3831
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
3832
|
+
/* @__PURE__ */ jsx(Label, { children: "Email address" }),
|
|
3833
|
+
/* @__PURE__ */ jsx(
|
|
3834
|
+
Input,
|
|
3835
|
+
{
|
|
3836
|
+
type: "email",
|
|
3837
|
+
placeholder: "jane@acme.io",
|
|
3838
|
+
leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-mail-line" }),
|
|
3839
|
+
value: form.email,
|
|
3840
|
+
onChange: (e) => setForm((f) => ({ ...f, email: e.target.value }))
|
|
3841
|
+
}
|
|
3842
|
+
)
|
|
3843
|
+
] }),
|
|
3844
|
+
/* @__PURE__ */ jsxs(
|
|
3845
|
+
"div",
|
|
3846
|
+
{
|
|
3847
|
+
style: {
|
|
3848
|
+
display: "flex",
|
|
3849
|
+
alignItems: "center",
|
|
3850
|
+
justifyContent: "space-between",
|
|
3851
|
+
gap: 16,
|
|
3852
|
+
paddingTop: 4
|
|
3853
|
+
},
|
|
3854
|
+
children: [
|
|
3855
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 2 }, children: [
|
|
3856
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-strong-950)" }, children: "Require two-factor authentication" }),
|
|
3857
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-paragraph-xs)", color: "var(--klun-text-sub-600)" }, children: "Ask for a second factor at every sign-in." })
|
|
3858
|
+
] }),
|
|
3859
|
+
/* @__PURE__ */ jsx(Switch, { checked: form.twoFA, onChange: (c) => setForm((f) => ({ ...f, twoFA: c })) })
|
|
3860
|
+
]
|
|
3861
|
+
}
|
|
3862
|
+
)
|
|
3863
|
+
] })
|
|
3864
|
+
}
|
|
3865
|
+
)
|
|
3866
|
+
] });
|
|
3867
|
+
}
|
|
3868
|
+
var ROLES2 = [
|
|
3869
|
+
{ id: "owner", name: "Owner", description: "Full access including billing and workspace settings.", members: 1 },
|
|
3870
|
+
{ id: "admin", name: "Admin", description: "Manages people, roles and everything in the workspace.", members: 3 },
|
|
3871
|
+
{ id: "manager", name: "Manager", description: "Runs day-to-day operations across orders and products.", members: 8 },
|
|
3872
|
+
{ id: "editor", name: "Editor", description: "Creates and edits content; cannot delete or manage users.", members: 14 },
|
|
3873
|
+
{ id: "viewer", name: "Viewer", description: "Read-only access to dashboards and reports.", members: 46 }
|
|
3874
|
+
];
|
|
3875
|
+
var MODULES = ["Dashboard", "Orders", "Products", "Customers", "Reports", "Users", "Billing"];
|
|
3876
|
+
var ACTIONS = ["View", "Create", "Edit", "Delete", "Manage"];
|
|
3877
|
+
var key = (m, a) => `${m}:${a}`;
|
|
3878
|
+
function seed(fn) {
|
|
3879
|
+
const out = {};
|
|
3880
|
+
for (const m of MODULES) for (const a of ACTIONS) out[key(m, a)] = fn(m, a);
|
|
3881
|
+
return out;
|
|
3882
|
+
}
|
|
3883
|
+
var OPERATIONS = ["Orders", "Products", "Customers"];
|
|
3884
|
+
var INITIAL = {
|
|
3885
|
+
owner: seed(() => true),
|
|
3886
|
+
admin: seed(() => true),
|
|
3887
|
+
manager: seed((m, a) => OPERATIONS.includes(m) ? a !== "Manage" : a === "View"),
|
|
3888
|
+
editor: seed((m, a) => OPERATIONS.includes(m) ? a === "View" || a === "Create" || a === "Edit" : a === "View"),
|
|
3889
|
+
viewer: seed((m, a) => OPERATIONS.includes(m) ? a === "View" : false)
|
|
3890
|
+
};
|
|
3891
|
+
function RolesScreen() {
|
|
3892
|
+
const [roleId, setRoleId] = useState("manager");
|
|
3893
|
+
const [perms, setPerms] = useState(() => ROLES2.map((r) => ({ ...INITIAL[r.id] })));
|
|
3894
|
+
const [baseline, setBaseline] = useState(() => ROLES2.map((r) => ({ ...INITIAL[r.id] })));
|
|
3895
|
+
const roleIndex = ROLES2.findIndex((r) => r.id === roleId);
|
|
3896
|
+
const current = perms[roleIndex];
|
|
3897
|
+
const base = baseline[roleIndex];
|
|
3898
|
+
const dirty = JSON.stringify(current) !== JSON.stringify(base);
|
|
3899
|
+
const role = ROLES2[roleIndex];
|
|
3900
|
+
const setCell = (m, a, value) => {
|
|
3901
|
+
setPerms((prev) => prev.map((p, i) => i === roleIndex ? { ...p, [key(m, a)]: value } : p));
|
|
3902
|
+
};
|
|
3903
|
+
const setRow = (m, value) => {
|
|
3904
|
+
setPerms(
|
|
3905
|
+
(prev) => prev.map((p, i) => {
|
|
3906
|
+
if (i !== roleIndex) return p;
|
|
3907
|
+
const next = { ...p };
|
|
3908
|
+
for (const a of ACTIONS) next[key(m, a)] = value;
|
|
3909
|
+
return next;
|
|
3910
|
+
})
|
|
3911
|
+
);
|
|
3912
|
+
};
|
|
3913
|
+
const granted = MODULES.filter((m) => ACTIONS.every((a) => current[key(m, a)])).length;
|
|
3914
|
+
return /* @__PURE__ */ jsxs("div", { style: { padding: 24, display: "flex", flexDirection: "column", gap: 20 }, children: [
|
|
3915
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
3916
|
+
/* @__PURE__ */ jsx("h1", { style: { margin: 0, font: "var(--klun-text-title-h4)", color: "var(--klun-text-strong-950)" }, children: "Roles & permissions" }),
|
|
3917
|
+
/* @__PURE__ */ jsx("p", { style: { margin: "4px 0 0", font: "var(--klun-text-paragraph-sm)", color: "var(--klun-text-sub-600)" }, children: "Control what each role can see and do. Changes apply to every member of the role." })
|
|
3918
|
+
] }),
|
|
3919
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "300px minmax(0, 1fr)", gap: 20, alignItems: "start" }, children: [
|
|
3920
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: ROLES2.map((r) => {
|
|
3921
|
+
const on = r.id === roleId;
|
|
3922
|
+
return /* @__PURE__ */ jsxs(
|
|
3923
|
+
"button",
|
|
3924
|
+
{
|
|
3925
|
+
onClick: () => setRoleId(r.id),
|
|
3926
|
+
style: {
|
|
3927
|
+
textAlign: "left",
|
|
3928
|
+
padding: "12px 14px",
|
|
3929
|
+
border: "none",
|
|
3930
|
+
borderRadius: "var(--klun-radius-xl)",
|
|
3931
|
+
cursor: "pointer",
|
|
3932
|
+
background: on ? "var(--klun-bg-white-0)" : "transparent",
|
|
3933
|
+
boxShadow: on ? "inset 0 0 0 1px var(--klun-stroke-soft-200), var(--klun-shadow-xs)" : "none"
|
|
3934
|
+
},
|
|
3935
|
+
children: [
|
|
3936
|
+
/* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
3937
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-strong-950)" }, children: r.name }),
|
|
3938
|
+
/* @__PURE__ */ jsx(Badge, { color: "gray", variant: "lighter", size: "small", children: r.members })
|
|
3939
|
+
] }),
|
|
3940
|
+
/* @__PURE__ */ jsx(
|
|
3941
|
+
"span",
|
|
3942
|
+
{
|
|
3943
|
+
style: {
|
|
3944
|
+
display: "block",
|
|
3945
|
+
marginTop: 2,
|
|
3946
|
+
font: "var(--klun-text-paragraph-xs)",
|
|
3947
|
+
color: "var(--klun-text-soft-400)"
|
|
3948
|
+
},
|
|
3949
|
+
children: r.description
|
|
3950
|
+
}
|
|
3951
|
+
)
|
|
3952
|
+
]
|
|
3953
|
+
},
|
|
3954
|
+
r.id
|
|
3955
|
+
);
|
|
3956
|
+
}) }),
|
|
3957
|
+
/* @__PURE__ */ jsxs(Card, { variant: "stroke", padding: 0, children: [
|
|
3958
|
+
/* @__PURE__ */ jsxs(
|
|
3959
|
+
"div",
|
|
3960
|
+
{
|
|
3961
|
+
style: {
|
|
3962
|
+
display: "flex",
|
|
3963
|
+
alignItems: "center",
|
|
3964
|
+
justifyContent: "space-between",
|
|
3965
|
+
gap: 12,
|
|
3966
|
+
padding: "16px 20px",
|
|
3967
|
+
boxShadow: "inset 0 -1px 0 var(--klun-stroke-soft-200)",
|
|
3968
|
+
flexWrap: "wrap"
|
|
3969
|
+
},
|
|
3970
|
+
children: [
|
|
3971
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
|
|
3972
|
+
/* @__PURE__ */ jsxs("span", { style: { font: "var(--klun-text-label-md)", color: "var(--klun-text-strong-950)" }, children: [
|
|
3973
|
+
role.name,
|
|
3974
|
+
" permissions"
|
|
3975
|
+
] }),
|
|
3976
|
+
/* @__PURE__ */ jsxs(Badge, { color: "blue", variant: "light", size: "small", children: [
|
|
3977
|
+
role.members,
|
|
3978
|
+
" ",
|
|
3979
|
+
role.members === 1 ? "member" : "members"
|
|
3980
|
+
] }),
|
|
3981
|
+
dirty ? /* @__PURE__ */ jsx(Badge, { color: "yellow", variant: "light", size: "small", dot: true, children: "Unsaved changes" }) : null
|
|
3982
|
+
] }),
|
|
3983
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 8 }, children: [
|
|
3984
|
+
/* @__PURE__ */ jsx(
|
|
3985
|
+
Button,
|
|
3986
|
+
{
|
|
3987
|
+
size: "small",
|
|
3988
|
+
variant: "neutral",
|
|
3989
|
+
appearance: "ghost",
|
|
3990
|
+
disabled: !dirty,
|
|
3991
|
+
onClick: () => setPerms((prev) => prev.map((p, i) => i === roleIndex ? { ...base } : p)),
|
|
3992
|
+
children: "Reset"
|
|
3993
|
+
}
|
|
3994
|
+
),
|
|
3995
|
+
/* @__PURE__ */ jsx(
|
|
3996
|
+
Button,
|
|
3997
|
+
{
|
|
3998
|
+
size: "small",
|
|
3999
|
+
disabled: !dirty,
|
|
4000
|
+
onClick: () => setBaseline((prev) => prev.map((p, i) => i === roleIndex ? { ...current } : p)),
|
|
4001
|
+
children: "Save changes"
|
|
4002
|
+
}
|
|
4003
|
+
)
|
|
4004
|
+
] })
|
|
4005
|
+
]
|
|
4006
|
+
}
|
|
4007
|
+
),
|
|
4008
|
+
/* @__PURE__ */ jsxs("div", { style: { padding: "8px 20px 20px" }, children: [
|
|
4009
|
+
/* @__PURE__ */ jsxs(
|
|
4010
|
+
"div",
|
|
4011
|
+
{
|
|
4012
|
+
style: {
|
|
4013
|
+
display: "grid",
|
|
4014
|
+
gridTemplateColumns: "minmax(140px, 1fr) repeat(5, 74px) 64px",
|
|
4015
|
+
alignItems: "center",
|
|
4016
|
+
gap: 4,
|
|
4017
|
+
padding: "10px 8px"
|
|
4018
|
+
},
|
|
4019
|
+
children: [
|
|
4020
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-xs)", color: "var(--klun-text-soft-400)", textTransform: "uppercase", letterSpacing: "0.02em" }, children: "Module" }),
|
|
4021
|
+
ACTIONS.map((a) => /* @__PURE__ */ jsx(
|
|
4022
|
+
"span",
|
|
4023
|
+
{
|
|
4024
|
+
style: {
|
|
4025
|
+
font: "var(--klun-text-label-xs)",
|
|
4026
|
+
color: "var(--klun-text-soft-400)",
|
|
4027
|
+
textTransform: "uppercase",
|
|
4028
|
+
letterSpacing: "0.02em",
|
|
4029
|
+
textAlign: "center"
|
|
4030
|
+
},
|
|
4031
|
+
children: a
|
|
4032
|
+
},
|
|
4033
|
+
a
|
|
4034
|
+
)),
|
|
4035
|
+
/* @__PURE__ */ jsx(
|
|
4036
|
+
"span",
|
|
4037
|
+
{
|
|
4038
|
+
style: {
|
|
4039
|
+
font: "var(--klun-text-label-xs)",
|
|
4040
|
+
color: "var(--klun-text-soft-400)",
|
|
4041
|
+
textTransform: "uppercase",
|
|
4042
|
+
letterSpacing: "0.02em",
|
|
4043
|
+
textAlign: "center"
|
|
4044
|
+
},
|
|
4045
|
+
children: "All"
|
|
4046
|
+
}
|
|
4047
|
+
)
|
|
4048
|
+
]
|
|
4049
|
+
}
|
|
4050
|
+
),
|
|
4051
|
+
MODULES.map((m, i) => {
|
|
4052
|
+
const all = ACTIONS.every((a) => current[key(m, a)]);
|
|
4053
|
+
const some = !all && ACTIONS.some((a) => current[key(m, a)]);
|
|
4054
|
+
return /* @__PURE__ */ jsxs(
|
|
4055
|
+
"div",
|
|
4056
|
+
{
|
|
4057
|
+
style: {
|
|
4058
|
+
display: "grid",
|
|
4059
|
+
gridTemplateColumns: "minmax(140px, 1fr) repeat(5, 74px) 64px",
|
|
4060
|
+
alignItems: "center",
|
|
4061
|
+
gap: 4,
|
|
4062
|
+
padding: "10px 8px",
|
|
4063
|
+
boxShadow: "inset 0 1px 0 var(--klun-stroke-soft-200)"
|
|
4064
|
+
},
|
|
4065
|
+
children: [
|
|
4066
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-strong-950)" }, children: m }),
|
|
4067
|
+
ACTIONS.map((a) => /* @__PURE__ */ jsx("span", { style: { display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ jsx(
|
|
4068
|
+
Checkbox,
|
|
4069
|
+
{
|
|
4070
|
+
size: "small",
|
|
4071
|
+
checked: current[key(m, a)],
|
|
4072
|
+
onChange: (c) => setCell(m, a, c)
|
|
4073
|
+
}
|
|
4074
|
+
) }, a)),
|
|
4075
|
+
/* @__PURE__ */ jsx("span", { style: { display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ jsx(Checkbox, { size: "small", checked: all, indeterminate: some, onChange: (c) => setRow(m, c) }) })
|
|
4076
|
+
]
|
|
4077
|
+
},
|
|
4078
|
+
m
|
|
4079
|
+
);
|
|
4080
|
+
}),
|
|
4081
|
+
/* @__PURE__ */ jsxs(
|
|
4082
|
+
"div",
|
|
4083
|
+
{
|
|
4084
|
+
style: {
|
|
4085
|
+
marginTop: 14,
|
|
4086
|
+
paddingTop: 14,
|
|
4087
|
+
boxShadow: "inset 0 1px 0 var(--klun-stroke-soft-200)",
|
|
4088
|
+
display: "flex",
|
|
4089
|
+
alignItems: "center",
|
|
4090
|
+
justifyContent: "space-between",
|
|
4091
|
+
gap: 12,
|
|
4092
|
+
flexWrap: "wrap"
|
|
4093
|
+
},
|
|
4094
|
+
children: [
|
|
4095
|
+
/* @__PURE__ */ jsxs("span", { style: { font: "var(--klun-text-paragraph-xs)", color: "var(--klun-text-soft-400)" }, children: [
|
|
4096
|
+
"Full access to ",
|
|
4097
|
+
granted,
|
|
4098
|
+
" of ",
|
|
4099
|
+
MODULES.length,
|
|
4100
|
+
" modules"
|
|
4101
|
+
] }),
|
|
4102
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-paragraph-xs)", color: "var(--klun-text-soft-400)" }, children: "Owner role is always unrestricted" })
|
|
4103
|
+
]
|
|
4104
|
+
}
|
|
4105
|
+
)
|
|
4106
|
+
] })
|
|
4107
|
+
] })
|
|
4108
|
+
] })
|
|
4109
|
+
] });
|
|
4110
|
+
}
|
|
4111
|
+
var RANGES = [
|
|
4112
|
+
{ value: "7d", label: "7d" },
|
|
4113
|
+
{ value: "30d", label: "30d" },
|
|
4114
|
+
{ value: "90d", label: "90d" }
|
|
4115
|
+
];
|
|
4116
|
+
var SALES_SERIES = {
|
|
4117
|
+
"7d": { data: [8200, 9100, 7800, 10400, 12600, 11200, 14800], labels: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] },
|
|
4118
|
+
"30d": { data: [38200, 41600, 39800, 47400, 52100], labels: ["W1", "W2", "W3", "W4", "W5"] },
|
|
4119
|
+
"90d": { data: [98200, 110400, 106800, 121600, 134200, 148900], labels: ["Apr", "May", "Jun", "Jul", "Aug", "Sep"] }
|
|
4120
|
+
};
|
|
4121
|
+
var TRAFFIC_SERIES = {
|
|
4122
|
+
"7d": { data: [12400, 13800, 12950, 15600, 17200, 14900, 18600], labels: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] },
|
|
4123
|
+
"30d": { data: [58600, 61200, 59400, 66800, 72300], labels: ["W1", "W2", "W3", "W4", "W5"] },
|
|
4124
|
+
"90d": { data: [142e3, 156800, 149500, 168200, 178400, 192600], labels: ["Apr", "May", "Jun", "Jul", "Aug", "Sep"] }
|
|
4125
|
+
};
|
|
4126
|
+
var SALES_REGIONS = [
|
|
4127
|
+
{ region: "Europe", orders: 512, revenue: 42860, share: 50 },
|
|
4128
|
+
{ region: "North America", orders: 388, revenue: 26400, share: 31 },
|
|
4129
|
+
{ region: "Asia Pacific", orders: 241, revenue: 11240, share: 13 },
|
|
4130
|
+
{ region: "Rest of world", orders: 143, revenue: 4420, share: 6 }
|
|
4131
|
+
];
|
|
4132
|
+
var TRAFFIC_DEVICES = [
|
|
4133
|
+
{ device: "Desktop", sessions: 73420, share: 57 },
|
|
4134
|
+
{ device: "Mobile", sessions: 44180, share: 34 },
|
|
4135
|
+
{ device: "Tablet", sessions: 9420, share: 7 },
|
|
4136
|
+
{ device: "Other", sessions: 2520, share: 2 }
|
|
4137
|
+
];
|
|
4138
|
+
var SALES_TOP = [
|
|
4139
|
+
{ key: "1", label: 'Lumen 27" 4K Monitor', value: 24860, share: 100 },
|
|
4140
|
+
{ key: "2", label: "Aero Wireless Keyboard", value: 18240, share: 73 },
|
|
4141
|
+
{ key: "3", label: "Echo Conference Speaker", value: 12980, share: 52 },
|
|
4142
|
+
{ key: "4", label: "Orbit Webcam 4K", value: 9640, share: 39 },
|
|
4143
|
+
{ key: "5", label: "Pulse USB-C Dock", value: 6210, share: 25 }
|
|
4144
|
+
];
|
|
4145
|
+
var TRAFFIC_TOP = [
|
|
4146
|
+
{ key: "1", label: "/pricing", value: 12480, share: 100 },
|
|
4147
|
+
{ key: "2", label: "/docs/getting-started", value: 9860, share: 79 },
|
|
4148
|
+
{ key: "3", label: "/blog/design-tokens", value: 7420, share: 59 },
|
|
4149
|
+
{ key: "4", label: "/changelog", value: 5140, share: 41 },
|
|
4150
|
+
{ key: "5", label: "/contact", value: 2380, share: 19 }
|
|
4151
|
+
];
|
|
4152
|
+
function ReportsScreen({ view = "sales" }) {
|
|
4153
|
+
const [range, setRange] = useState("7d");
|
|
4154
|
+
const sales = view === "sales";
|
|
4155
|
+
const series = (sales ? SALES_SERIES : TRAFFIC_SERIES)[range];
|
|
4156
|
+
const regionColumns = [
|
|
4157
|
+
{ key: "region", header: "Region" },
|
|
4158
|
+
{ key: "orders", header: "Orders", align: "center" },
|
|
4159
|
+
{
|
|
4160
|
+
key: "revenue",
|
|
4161
|
+
header: "Revenue",
|
|
4162
|
+
align: "right",
|
|
4163
|
+
render: (r) => /* @__PURE__ */ jsx(Money, { value: r.revenue, currency: "USD", locale: "en-US", style: { font: "var(--klun-text-label-sm)" } })
|
|
4164
|
+
},
|
|
4165
|
+
{
|
|
4166
|
+
key: "share",
|
|
4167
|
+
header: "Share",
|
|
4168
|
+
width: 170,
|
|
4169
|
+
render: (r) => /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: 10, minWidth: 140 }, children: [
|
|
4170
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 }, children: /* @__PURE__ */ jsx(ProgressBar, { value: r.share }) }),
|
|
4171
|
+
/* @__PURE__ */ jsxs("span", { style: { font: "var(--klun-text-label-xs)", color: "var(--klun-text-sub-600)", width: 34, textAlign: "right" }, children: [
|
|
4172
|
+
r.share,
|
|
4173
|
+
"%"
|
|
4174
|
+
] })
|
|
4175
|
+
] })
|
|
4176
|
+
}
|
|
4177
|
+
];
|
|
4178
|
+
const deviceColumns = [
|
|
4179
|
+
{ key: "device", header: "Device" },
|
|
4180
|
+
{
|
|
4181
|
+
key: "sessions",
|
|
4182
|
+
header: "Sessions",
|
|
4183
|
+
align: "center",
|
|
4184
|
+
render: (r) => r.sessions.toLocaleString("en-US")
|
|
4185
|
+
},
|
|
4186
|
+
{
|
|
4187
|
+
key: "share",
|
|
4188
|
+
header: "Share",
|
|
4189
|
+
width: 170,
|
|
4190
|
+
render: (r) => /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: 10, minWidth: 140 }, children: [
|
|
4191
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 }, children: /* @__PURE__ */ jsx(ProgressBar, { value: r.share, color: "primary" }) }),
|
|
4192
|
+
/* @__PURE__ */ jsxs("span", { style: { font: "var(--klun-text-label-xs)", color: "var(--klun-text-sub-600)", width: 34, textAlign: "right" }, children: [
|
|
4193
|
+
r.share,
|
|
4194
|
+
"%"
|
|
4195
|
+
] })
|
|
4196
|
+
] })
|
|
4197
|
+
}
|
|
4198
|
+
];
|
|
4199
|
+
const top = sales ? SALES_TOP : TRAFFIC_TOP;
|
|
4200
|
+
return /* @__PURE__ */ jsxs("div", { style: { padding: 24, display: "flex", flexDirection: "column", gap: 20 }, children: [
|
|
4201
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "flex-end", justifyContent: "space-between", gap: 16, flexWrap: "wrap" }, children: [
|
|
4202
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4203
|
+
/* @__PURE__ */ jsx("h1", { style: { margin: 0, font: "var(--klun-text-title-h4)", color: "var(--klun-text-strong-950)" }, children: sales ? "Sales report" : "Traffic report" }),
|
|
4204
|
+
/* @__PURE__ */ jsx("p", { style: { margin: "4px 0 0", font: "var(--klun-text-paragraph-sm)", color: "var(--klun-text-sub-600)" }, children: sales ? "Revenue, channels and the products that drive them." : "Sessions, sources and where visitors spend their time." })
|
|
4205
|
+
] }),
|
|
4206
|
+
/* @__PURE__ */ jsx(SegmentedControl, { items: RANGES, value: range, onChange: (v) => setRange(v) })
|
|
4207
|
+
] }),
|
|
4208
|
+
/* @__PURE__ */ jsx("div", { style: { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))", gap: 16 }, children: sales ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4209
|
+
/* @__PURE__ */ jsx(Kpi, { label: "Revenue", value: "$84,920", delta: "12.4%", tone: "primary", icon: /* @__PURE__ */ jsx("i", { className: "ri-money-dollar-circle-line" }), spark: [10, 14, 12, 18, 16, 24, 22, 30] }),
|
|
4210
|
+
/* @__PURE__ */ jsx(Kpi, { label: "Orders", value: "1,284", delta: "6.1%", tone: "success", icon: /* @__PURE__ */ jsx("i", { className: "ri-shopping-bag-line" }), spark: [8, 10, 9, 14, 13, 16, 18, 22] }),
|
|
4211
|
+
/* @__PURE__ */ jsx(Kpi, { label: "Avg. order value", value: "$66.10", delta: "1.2%", tone: "warning", icon: /* @__PURE__ */ jsx("i", { className: "ri-shopping-cart-2-line" }), spark: [60, 62, 61, 64, 63, 65, 66, 66] }),
|
|
4212
|
+
/* @__PURE__ */ jsx(Kpi, { label: "Conversion", value: "3.6%", delta: "0.8%", tone: "info", icon: /* @__PURE__ */ jsx("i", { className: "ri-percent-line" }), spark: [2, 3, 2.5, 3.2, 3, 3.4, 3.5, 3.6] })
|
|
4213
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4214
|
+
/* @__PURE__ */ jsx(Kpi, { label: "Sessions", value: "128,540", delta: "8.2%", tone: "primary", icon: /* @__PURE__ */ jsx("i", { className: "ri-line-chart-line" }), spark: [12, 14, 13, 16, 15, 18, 17, 20] }),
|
|
4215
|
+
/* @__PURE__ */ jsx(Kpi, { label: "Users", value: "84,210", delta: "5.4%", tone: "success", icon: /* @__PURE__ */ jsx("i", { className: "ri-group-line" }), spark: [8, 9, 8, 10, 9, 11, 10, 12] }),
|
|
4216
|
+
/* @__PURE__ */ jsx(Kpi, { label: "Bounce rate", value: "32.4%", delta: "1.1%", trend: "down", tone: "danger", icon: /* @__PURE__ */ jsx("i", { className: "ri-logout-box-r-line" }), spark: [40, 38, 39, 36, 35, 34, 33, 32] }),
|
|
4217
|
+
/* @__PURE__ */ jsx(Kpi, { label: "Avg. session", value: "4m 12s", delta: "2.0%", tone: "info", icon: /* @__PURE__ */ jsx("i", { className: "ri-timer-line" }), spark: [3.4, 3.5, 3.7, 3.6, 3.9, 4, 4.1, 4.2] })
|
|
4218
|
+
] }) }),
|
|
4219
|
+
/* @__PURE__ */ jsxs(Card, { variant: "stroke", padding: 20, children: [
|
|
4220
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 12, marginBottom: 16 }, children: [
|
|
4221
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-lg)", color: "var(--klun-text-strong-950)" }, children: sales ? "Revenue over time" : "Sessions over time" }),
|
|
4222
|
+
/* @__PURE__ */ jsxs("span", { style: { font: "var(--klun-text-paragraph-xs)", color: "var(--klun-text-soft-400)" }, children: [
|
|
4223
|
+
"Last ",
|
|
4224
|
+
range
|
|
4225
|
+
] })
|
|
4226
|
+
] }),
|
|
4227
|
+
/* @__PURE__ */ jsx(
|
|
4228
|
+
AreaChart2,
|
|
4229
|
+
{
|
|
4230
|
+
data: series.data,
|
|
4231
|
+
labels: series.labels,
|
|
4232
|
+
tone: sales ? "primary" : "info",
|
|
4233
|
+
height: 220,
|
|
4234
|
+
formatValue: sales ? (v) => `$${v >= 1e3 ? `${Math.round(v / 100) / 10}k` : Math.round(v)}` : void 0
|
|
4235
|
+
}
|
|
4236
|
+
)
|
|
4237
|
+
] }),
|
|
4238
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "minmax(0, 1fr) minmax(0, 1fr)", gap: 16, alignItems: "start" }, children: [
|
|
4239
|
+
/* @__PURE__ */ jsxs(Card, { variant: "stroke", padding: 20, children: [
|
|
4240
|
+
/* @__PURE__ */ jsx("div", { style: { font: "var(--klun-text-label-lg)", color: "var(--klun-text-strong-950)", marginBottom: 16 }, children: sales ? "Sales by channel" : "Traffic sources" }),
|
|
4241
|
+
/* @__PURE__ */ jsx(
|
|
4242
|
+
DonutChart,
|
|
4243
|
+
{
|
|
4244
|
+
centerValue: sales ? "52%" : "48%",
|
|
4245
|
+
centerLabel: sales ? "Online" : "Organic",
|
|
4246
|
+
data: sales ? [
|
|
4247
|
+
{ label: "Online", value: 52 },
|
|
4248
|
+
{ label: "Retail", value: 28 },
|
|
4249
|
+
{ label: "Partner", value: 14 },
|
|
4250
|
+
{ label: "Other", value: 6 }
|
|
4251
|
+
] : [
|
|
4252
|
+
{ label: "Organic", value: 48 },
|
|
4253
|
+
{ label: "Direct", value: 22 },
|
|
4254
|
+
{ label: "Referral", value: 18 },
|
|
4255
|
+
{ label: "Social", value: 12 }
|
|
4256
|
+
]
|
|
4257
|
+
}
|
|
4258
|
+
)
|
|
4259
|
+
] }),
|
|
4260
|
+
/* @__PURE__ */ jsxs(Card, { variant: "stroke", padding: 20, children: [
|
|
4261
|
+
/* @__PURE__ */ jsx("div", { style: { font: "var(--klun-text-label-lg)", color: "var(--klun-text-strong-950)", marginBottom: 16 }, children: sales ? "Top products" : "Top pages" }),
|
|
4262
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: 14 }, children: top.map((row) => /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
4263
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "baseline", justifyContent: "space-between", gap: 12 }, children: [
|
|
4264
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-strong-950)" }, children: row.label }),
|
|
4265
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-sub-600)" }, children: sales ? `$${row.value.toLocaleString("en-US")}` : `${row.value.toLocaleString("en-US")} views` })
|
|
4266
|
+
] }),
|
|
4267
|
+
/* @__PURE__ */ jsx(ProgressBar, { value: row.share, color: sales ? "primary" : "success" })
|
|
4268
|
+
] }, row.key)) })
|
|
4269
|
+
] })
|
|
4270
|
+
] }),
|
|
4271
|
+
sales ? /* @__PURE__ */ jsx(Table, { columns: regionColumns, rows: SALES_REGIONS, getRowId: (r) => r.region, title: "Regional breakdown" }) : /* @__PURE__ */ jsx(Table, { columns: deviceColumns, rows: TRAFFIC_DEVICES, getRowId: (r) => r.device, title: "Devices" })
|
|
4272
|
+
] });
|
|
4273
|
+
}
|
|
4274
|
+
function Field3({ label, children }) {
|
|
4275
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
4276
|
+
/* @__PURE__ */ jsx(Label, { children: label }),
|
|
4277
|
+
children
|
|
4278
|
+
] });
|
|
4279
|
+
}
|
|
4280
|
+
function Section({ title, subtitle, children, footer }) {
|
|
4281
|
+
return /* @__PURE__ */ jsxs(Card, { variant: "stroke", padding: 0, children: [
|
|
4282
|
+
/* @__PURE__ */ jsxs("div", { style: { padding: "16px 20px", boxShadow: "inset 0 -1px 0 var(--klun-stroke-soft-200)" }, children: [
|
|
4283
|
+
/* @__PURE__ */ jsx("div", { style: { font: "var(--klun-text-label-md)", color: "var(--klun-text-strong-950)" }, children: title }),
|
|
4284
|
+
subtitle ? /* @__PURE__ */ jsx("div", { style: { marginTop: 2, font: "var(--klun-text-paragraph-xs)", color: "var(--klun-text-soft-400)" }, children: subtitle }) : null
|
|
4285
|
+
] }),
|
|
4286
|
+
/* @__PURE__ */ jsx("div", { style: { padding: 20 }, children }),
|
|
4287
|
+
footer ? /* @__PURE__ */ jsx(
|
|
4288
|
+
"div",
|
|
4289
|
+
{
|
|
4290
|
+
style: {
|
|
4291
|
+
padding: "14px 20px",
|
|
4292
|
+
boxShadow: "inset 0 1px 0 var(--klun-stroke-soft-200)",
|
|
4293
|
+
display: "flex",
|
|
4294
|
+
justifyContent: "flex-end",
|
|
4295
|
+
gap: 8
|
|
4296
|
+
},
|
|
4297
|
+
children: footer
|
|
4298
|
+
}
|
|
4299
|
+
) : null
|
|
4300
|
+
] });
|
|
4301
|
+
}
|
|
4302
|
+
var NAV = [
|
|
4303
|
+
{ key: "profile", label: "Profile", icon: "ri-user-line" },
|
|
4304
|
+
{ key: "account", label: "Account", icon: "ri-shield-user-line" },
|
|
4305
|
+
{ key: "notifications", label: "Notifications", icon: "ri-notification-3-line" },
|
|
4306
|
+
{ key: "billing", label: "Billing", icon: "ri-bank-card-line" },
|
|
4307
|
+
{ key: "api", label: "API keys", icon: "ri-key-2-line" }
|
|
4308
|
+
];
|
|
4309
|
+
function MetronicSettingsTemplate() {
|
|
4310
|
+
const [tab, setTab] = useState("profile");
|
|
4311
|
+
return /* @__PURE__ */ jsx(
|
|
4312
|
+
"div",
|
|
4313
|
+
{
|
|
4314
|
+
"data-mode": "metronic",
|
|
4315
|
+
"data-density": "compact",
|
|
4316
|
+
style: {
|
|
4317
|
+
minHeight: "100%",
|
|
4318
|
+
overflow: "auto",
|
|
4319
|
+
background: "var(--klun-bg-weak-50)",
|
|
4320
|
+
color: "var(--klun-text-strong-950)"
|
|
4321
|
+
},
|
|
4322
|
+
children: /* @__PURE__ */ jsxs(
|
|
4323
|
+
"div",
|
|
4324
|
+
{
|
|
4325
|
+
style: {
|
|
4326
|
+
maxWidth: 1e3,
|
|
4327
|
+
margin: "0 auto",
|
|
4328
|
+
padding: 28,
|
|
4329
|
+
display: "flex",
|
|
4330
|
+
flexDirection: "column",
|
|
4331
|
+
gap: 20
|
|
4332
|
+
},
|
|
4333
|
+
children: [
|
|
4334
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4335
|
+
/* @__PURE__ */ jsx(Breadcrumb, { items: [{ label: "Home" }, { label: "Settings" }] }),
|
|
4336
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "flex-end", justifyContent: "space-between", gap: 16, marginTop: 8 }, children: [
|
|
4337
|
+
/* @__PURE__ */ jsx("h1", { style: { margin: 0, font: "var(--klun-text-title-h4)", color: "var(--klun-text-strong-950)" }, children: "Settings" }),
|
|
4338
|
+
/* @__PURE__ */ jsx(Badge, { color: "green", variant: "light", dot: true, children: "All changes saved" })
|
|
4339
|
+
] })
|
|
4340
|
+
] }),
|
|
4341
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "220px minmax(0, 1fr)", gap: 20, alignItems: "start" }, children: [
|
|
4342
|
+
/* @__PURE__ */ jsx("nav", { style: { display: "flex", flexDirection: "column", gap: 2 }, children: NAV.map((item) => {
|
|
4343
|
+
const on = tab === item.key;
|
|
4344
|
+
return /* @__PURE__ */ jsxs(
|
|
4345
|
+
"button",
|
|
4346
|
+
{
|
|
4347
|
+
onClick: () => setTab(item.key),
|
|
4348
|
+
style: {
|
|
4349
|
+
display: "flex",
|
|
4350
|
+
alignItems: "center",
|
|
4351
|
+
gap: 10,
|
|
4352
|
+
height: 36,
|
|
4353
|
+
padding: "0 12px",
|
|
4354
|
+
border: "none",
|
|
4355
|
+
borderRadius: "var(--klun-radius-lg)",
|
|
4356
|
+
cursor: "pointer",
|
|
4357
|
+
textAlign: "left",
|
|
4358
|
+
background: on ? "var(--klun-bg-white-0)" : "transparent",
|
|
4359
|
+
boxShadow: on ? "inset 0 0 0 1px var(--klun-stroke-soft-200)" : "none",
|
|
4360
|
+
color: on ? "var(--klun-text-strong-950)" : "var(--klun-text-sub-600)",
|
|
4361
|
+
font: "var(--klun-text-label-sm)"
|
|
4362
|
+
},
|
|
4363
|
+
children: [
|
|
4364
|
+
/* @__PURE__ */ jsx(
|
|
4365
|
+
"i",
|
|
4366
|
+
{
|
|
4367
|
+
className: item.icon,
|
|
4368
|
+
style: { fontSize: 16, color: on ? "var(--klun-primary-base)" : "var(--klun-icon-sub-600)" }
|
|
4369
|
+
}
|
|
4370
|
+
),
|
|
4371
|
+
item.label
|
|
4372
|
+
]
|
|
4373
|
+
},
|
|
4374
|
+
item.key
|
|
4375
|
+
);
|
|
4376
|
+
}) }),
|
|
4377
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 20 }, children: [
|
|
4378
|
+
/* @__PURE__ */ jsx(Section, { title: "Profile photo", subtitle: "PNG or JPG, at least 200\xD7200px.", children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 20, flexWrap: "wrap" }, children: [
|
|
4379
|
+
/* @__PURE__ */ jsxs("div", { style: { position: "relative", width: 76, height: 76, flexShrink: 0 }, children: [
|
|
4380
|
+
/* @__PURE__ */ jsx(Avatar, { size: "72", initials: "AK", color: "blue" }),
|
|
4381
|
+
/* @__PURE__ */ jsx(
|
|
4382
|
+
"button",
|
|
4383
|
+
{
|
|
4384
|
+
"aria-label": "Change photo",
|
|
4385
|
+
style: {
|
|
4386
|
+
position: "absolute",
|
|
4387
|
+
right: 0,
|
|
4388
|
+
bottom: 0,
|
|
4389
|
+
width: 26,
|
|
4390
|
+
height: 26,
|
|
4391
|
+
borderRadius: "var(--klun-radius-pill)",
|
|
4392
|
+
border: "2px solid var(--klun-bg-white-0)",
|
|
4393
|
+
background: "var(--klun-primary-base)",
|
|
4394
|
+
color: "var(--klun-text-white-0)",
|
|
4395
|
+
display: "inline-flex",
|
|
4396
|
+
alignItems: "center",
|
|
4397
|
+
justifyContent: "center",
|
|
4398
|
+
cursor: "pointer",
|
|
4399
|
+
fontSize: 13
|
|
4400
|
+
},
|
|
4401
|
+
children: /* @__PURE__ */ jsx("i", { className: "ri-camera-line" })
|
|
4402
|
+
}
|
|
4403
|
+
)
|
|
4404
|
+
] }),
|
|
4405
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
4406
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 8 }, children: [
|
|
4407
|
+
/* @__PURE__ */ jsx(Button, { size: "small", children: "Upload new" }),
|
|
4408
|
+
/* @__PURE__ */ jsx(Button, { size: "small", variant: "neutral", appearance: "ghost", children: "Remove" })
|
|
4409
|
+
] }),
|
|
4410
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-paragraph-xs)", color: "var(--klun-text-soft-400)" }, children: "Recommended 400\xD7400px, max 2MB." })
|
|
4411
|
+
] })
|
|
4412
|
+
] }) }),
|
|
4413
|
+
/* @__PURE__ */ jsx(
|
|
4414
|
+
Section,
|
|
4415
|
+
{
|
|
4416
|
+
title: "Personal information",
|
|
4417
|
+
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4418
|
+
/* @__PURE__ */ jsx(Button, { variant: "neutral", appearance: "ghost", children: "Cancel" }),
|
|
4419
|
+
/* @__PURE__ */ jsx(Button, { children: "Save changes" })
|
|
4420
|
+
] }),
|
|
4421
|
+
children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 16 }, children: [
|
|
4422
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 16 }, children: [
|
|
4423
|
+
/* @__PURE__ */ jsx(Field3, { label: "First name", children: /* @__PURE__ */ jsx(Input, { defaultValue: "Anna" }) }),
|
|
4424
|
+
/* @__PURE__ */ jsx(Field3, { label: "Last name", children: /* @__PURE__ */ jsx(Input, { defaultValue: "Krause" }) })
|
|
4425
|
+
] }),
|
|
4426
|
+
/* @__PURE__ */ jsx(Field3, { label: "Email", children: /* @__PURE__ */ jsx(Input, { defaultValue: "anna@acme.io", leadingIcon: /* @__PURE__ */ jsx("i", { className: "ri-mail-line" }) }) }),
|
|
4427
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 16 }, children: [
|
|
4428
|
+
/* @__PURE__ */ jsx(Field3, { label: "Role", children: /* @__PURE__ */ jsxs(Select, { defaultValue: "designer", children: [
|
|
4429
|
+
/* @__PURE__ */ jsx("option", { value: "designer", children: "Product designer" }),
|
|
4430
|
+
/* @__PURE__ */ jsx("option", { value: "eng", children: "Engineer" }),
|
|
4431
|
+
/* @__PURE__ */ jsx("option", { value: "pm", children: "Product manager" })
|
|
4432
|
+
] }) }),
|
|
4433
|
+
/* @__PURE__ */ jsx(Field3, { label: "Timezone", children: /* @__PURE__ */ jsxs(Select, { defaultValue: "cet", children: [
|
|
4434
|
+
/* @__PURE__ */ jsx("option", { value: "cet", children: "CET \u2014 Berlin" }),
|
|
4435
|
+
/* @__PURE__ */ jsx("option", { value: "pst", children: "PST \u2014 San Francisco" }),
|
|
4436
|
+
/* @__PURE__ */ jsx("option", { value: "jst", children: "JST \u2014 Tokyo" })
|
|
4437
|
+
] }) })
|
|
4438
|
+
] }),
|
|
4439
|
+
/* @__PURE__ */ jsx(Field3, { label: "Bio", children: /* @__PURE__ */ jsx(Textarea, { rows: 3, defaultValue: "Product designer focused on design systems and tooling." }) })
|
|
4440
|
+
] })
|
|
4441
|
+
}
|
|
4442
|
+
),
|
|
4443
|
+
/* @__PURE__ */ jsx(Section, { title: "Notifications", children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
|
|
4444
|
+
/* @__PURE__ */ jsx(
|
|
4445
|
+
ToggleRow,
|
|
4446
|
+
{
|
|
4447
|
+
first: true,
|
|
4448
|
+
title: "Email notifications",
|
|
4449
|
+
desc: "Order updates, mentions and weekly summaries.",
|
|
4450
|
+
defaultChecked: true
|
|
4451
|
+
}
|
|
4452
|
+
),
|
|
4453
|
+
/* @__PURE__ */ jsx(
|
|
4454
|
+
ToggleRow,
|
|
4455
|
+
{
|
|
4456
|
+
title: "Push notifications",
|
|
4457
|
+
desc: "Real-time alerts on your devices.",
|
|
4458
|
+
defaultChecked: true
|
|
4459
|
+
}
|
|
4460
|
+
),
|
|
4461
|
+
/* @__PURE__ */ jsx(ToggleRow, { title: "Product newsletter", desc: "Occasional news about new features." })
|
|
4462
|
+
] }) })
|
|
4463
|
+
] })
|
|
4464
|
+
] })
|
|
4465
|
+
]
|
|
4466
|
+
}
|
|
4467
|
+
)
|
|
4468
|
+
}
|
|
4469
|
+
);
|
|
4470
|
+
}
|
|
4471
|
+
function ToggleRow({ title, desc, defaultChecked, first }) {
|
|
4472
|
+
return /* @__PURE__ */ jsxs(
|
|
4473
|
+
"div",
|
|
4474
|
+
{
|
|
4475
|
+
style: {
|
|
4476
|
+
display: "flex",
|
|
4477
|
+
alignItems: "center",
|
|
4478
|
+
justifyContent: "space-between",
|
|
4479
|
+
gap: 16,
|
|
4480
|
+
padding: "14px 0",
|
|
4481
|
+
boxShadow: first ? "none" : "inset 0 1px 0 var(--klun-stroke-soft-200)"
|
|
4482
|
+
},
|
|
4483
|
+
children: [
|
|
4484
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 2 }, children: [
|
|
4485
|
+
/* @__PURE__ */ jsx("b", { style: { font: "var(--klun-text-label-sm)", color: "var(--klun-text-strong-950)" }, children: title }),
|
|
4486
|
+
/* @__PURE__ */ jsx("span", { style: { font: "var(--klun-text-paragraph-xs)", color: "var(--klun-text-sub-600)" }, children: desc })
|
|
4487
|
+
] }),
|
|
4488
|
+
/* @__PURE__ */ jsx(Switch, { defaultChecked, onChange: () => {
|
|
4489
|
+
} })
|
|
4490
|
+
]
|
|
4491
|
+
}
|
|
4492
|
+
);
|
|
4493
|
+
}
|
|
4494
|
+
var SCREENS = {
|
|
4495
|
+
dashboard: /* @__PURE__ */ jsx(DashboardScreen, {}),
|
|
4496
|
+
orders: /* @__PURE__ */ jsx(OrdersScreen, {}),
|
|
4497
|
+
products: /* @__PURE__ */ jsx(ProductsScreen, {}),
|
|
4498
|
+
customers: /* @__PURE__ */ jsx(CustomersScreen, {}),
|
|
4499
|
+
users: /* @__PURE__ */ jsx(UsersScreen, {}),
|
|
4500
|
+
roles: /* @__PURE__ */ jsx(RolesScreen, {}),
|
|
4501
|
+
reports: /* @__PURE__ */ jsx(ReportsScreen, { view: "sales" }),
|
|
4502
|
+
sales: /* @__PURE__ */ jsx(ReportsScreen, { view: "sales" }),
|
|
4503
|
+
traffic: /* @__PURE__ */ jsx(ReportsScreen, { view: "traffic" }),
|
|
4504
|
+
settings: /* @__PURE__ */ jsx(MetronicSettingsTemplate, {})
|
|
4505
|
+
};
|
|
4506
|
+
function Placeholder({ name }) {
|
|
4507
|
+
return /* @__PURE__ */ jsxs(
|
|
4508
|
+
"div",
|
|
4509
|
+
{
|
|
4510
|
+
style: {
|
|
4511
|
+
padding: 64,
|
|
4512
|
+
textAlign: "center",
|
|
4513
|
+
color: "var(--klun-text-soft-400)",
|
|
4514
|
+
font: "var(--klun-text-paragraph-lg)"
|
|
4515
|
+
},
|
|
4516
|
+
children: [
|
|
4517
|
+
/* @__PURE__ */ jsx("i", { className: "ri-inbox-line", style: { fontSize: 40, display: "block", marginBottom: 12 } }),
|
|
4518
|
+
"\u201C",
|
|
4519
|
+
name,
|
|
4520
|
+
"\u201D isn't part of this demo."
|
|
4521
|
+
]
|
|
4522
|
+
}
|
|
4523
|
+
);
|
|
4524
|
+
}
|
|
4525
|
+
function MetronicDashboardTemplate() {
|
|
4526
|
+
const [active, setActive] = useState("dashboard");
|
|
4527
|
+
return /* @__PURE__ */ jsxs(
|
|
4528
|
+
"div",
|
|
4529
|
+
{
|
|
4530
|
+
"data-mode": "metronic",
|
|
4531
|
+
"data-density": "compact",
|
|
4532
|
+
style: {
|
|
4533
|
+
display: "flex",
|
|
4534
|
+
height: "100%",
|
|
4535
|
+
background: "var(--klun-bg-weak-50)",
|
|
4536
|
+
color: "var(--klun-text-strong-950)"
|
|
4537
|
+
},
|
|
4538
|
+
children: [
|
|
4539
|
+
/* @__PURE__ */ jsx(MetronicSidebar, { active, onNavigate: setActive }),
|
|
4540
|
+
/* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column" }, children: [
|
|
4541
|
+
/* @__PURE__ */ jsx(MetronicTopBar, {}),
|
|
4542
|
+
/* @__PURE__ */ jsx("main", { style: { flex: 1, overflow: "auto" }, children: SCREENS[active] ?? /* @__PURE__ */ jsx(Placeholder, { name: active }) })
|
|
4543
|
+
] })
|
|
4544
|
+
]
|
|
4545
|
+
}
|
|
4546
|
+
);
|
|
4547
|
+
}
|
|
2081
4548
|
|
|
2082
|
-
export { AIAssistantTemplate, AgentChatTemplate, CalendarTemplate, CryptoTemplate, DashboardTemplate, MarketingTemplate, OverviewScreen, PricingTemplate, SettingsScreen, SettingsTemplate, Sidebar, TopBar };
|
|
4549
|
+
export { AIAssistantTemplate, AgentChatTemplate, AreaChart2 as AreaChart, BarChart, CATEGORIES, CalendarTemplate, CryptoTemplate, CustomersScreen, DashboardScreen, DashboardTemplate, DonutChart, Kpi, MarketingTemplate, MetronicDashboardTemplate, MetronicSettingsTemplate, MetronicSidebar, MetronicTopBar, MiniStat, OrdersScreen, OverviewScreen, PricingTemplate, ProductWizardPage, ProductsScreen, ReportsScreen, RolesScreen, STATUS_COLOR3 as STATUS_COLOR, SettingsScreen, SettingsTemplate, Sidebar, Sparkline, TopBar, UsersScreen, deriveStatus, emptyDraft };
|
|
2083
4550
|
//# sourceMappingURL=index.js.map
|
|
2084
4551
|
//# sourceMappingURL=index.js.map
|