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