@scalio-cloud/ui 0.110.0 → 0.111.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/app-kit/ScalioAppProviders.d.ts +20 -0
  2. package/dist/app-kit/ScalioAppProviders.d.ts.map +1 -0
  3. package/dist/app-kit/ScalioDrawer.d.ts +28 -0
  4. package/dist/app-kit/ScalioDrawer.d.ts.map +1 -0
  5. package/dist/app-kit/ScalioEmptyState.d.ts +14 -0
  6. package/dist/app-kit/ScalioEmptyState.d.ts.map +1 -0
  7. package/dist/app-kit/ScalioErrorBoundary.d.ts +27 -0
  8. package/dist/app-kit/ScalioErrorBoundary.d.ts.map +1 -0
  9. package/dist/app-kit/ScalioFormDialog.d.ts +33 -0
  10. package/dist/app-kit/ScalioFormDialog.d.ts.map +1 -0
  11. package/dist/app-kit/ScalioFormField.d.ts +36 -0
  12. package/dist/app-kit/ScalioFormField.d.ts.map +1 -0
  13. package/dist/app-kit/ScalioInputs.d.ts +80 -0
  14. package/dist/app-kit/ScalioInputs.d.ts.map +1 -0
  15. package/dist/app-kit/ScalioLayout.d.ts +27 -0
  16. package/dist/app-kit/ScalioLayout.d.ts.map +1 -0
  17. package/dist/app-kit/ScalioResultBadge.d.ts +19 -0
  18. package/dist/app-kit/ScalioResultBadge.d.ts.map +1 -0
  19. package/dist/app-kit/ScalioTenantSettings.d.ts +24 -0
  20. package/dist/app-kit/ScalioTenantSettings.d.ts.map +1 -0
  21. package/dist/app-kit/ScalioUtilities.d.ts +33 -0
  22. package/dist/app-kit/ScalioUtilities.d.ts.map +1 -0
  23. package/dist/app-kit/_uiReact.d.ts +64 -3
  24. package/dist/app-kit/_uiReact.d.ts.map +1 -1
  25. package/dist/app-kit/index.d.ts +11 -0
  26. package/dist/app-kit/index.d.ts.map +1 -1
  27. package/dist/app-kit/index.js +1164 -2
  28. package/dist/app-kit/index.js.map +1 -1
  29. package/dist/app-kit/index.mjs +1144 -2
  30. package/dist/app-kit/index.mjs.map +1 -1
  31. package/dist/{chunk-A7O3P4YV.mjs → chunk-WBI44QWN.mjs} +92 -1
  32. package/dist/chunk-WBI44QWN.mjs.map +1 -0
  33. package/dist/core/format.d.ts +36 -0
  34. package/dist/core/format.d.ts.map +1 -0
  35. package/dist/core/index.d.ts +1 -0
  36. package/dist/core/index.d.ts.map +1 -1
  37. package/dist/core/index.js +97 -0
  38. package/dist/core/index.js.map +1 -1
  39. package/dist/core/index.mjs +13 -1
  40. package/dist/data-table/ScalioDataTable.d.ts +12 -0
  41. package/dist/data-table/ScalioDataTable.d.ts.map +1 -0
  42. package/dist/data-table/helpers.d.ts +40 -0
  43. package/dist/data-table/helpers.d.ts.map +1 -0
  44. package/dist/data-table/index.d.ts +8 -0
  45. package/dist/data-table/index.d.ts.map +1 -0
  46. package/dist/data-table/index.js +1040 -0
  47. package/dist/data-table/index.js.map +1 -0
  48. package/dist/data-table/index.mjs +1008 -0
  49. package/dist/data-table/index.mjs.map +1 -0
  50. package/dist/data-table/labels.d.ts +5 -0
  51. package/dist/data-table/labels.d.ts.map +1 -0
  52. package/dist/data-table/types.d.ts +178 -0
  53. package/dist/data-table/types.d.ts.map +1 -0
  54. package/package.json +7 -1
  55. package/dist/chunk-A7O3P4YV.mjs.map +0 -1
@@ -2,7 +2,7 @@ import {
2
2
  N_,
3
3
  can,
4
4
  mailReady
5
- } from "../chunk-A7O3P4YV.mjs";
5
+ } from "../chunk-WBI44QWN.mjs";
6
6
 
7
7
  // src/app-kit/ScalioSecurityFactors.tsx
8
8
  import { useMemo } from "react";
@@ -11,6 +11,8 @@ import { toast } from "sonner";
11
11
  // src/app-kit/_uiReact.ts
12
12
  import uiReact from "@scalio-cloud/ui/react";
13
13
  var {
14
+ AppHeader,
15
+ AppShell,
14
16
  AuditLog,
15
17
  AuditNav,
16
18
  AuthHeader,
@@ -28,6 +30,7 @@ var {
28
30
  PageHeader,
29
31
  PasswordChange,
30
32
  PasswordPolicySelect,
33
+ ProductSwitcher,
31
34
  ProfileIdentity,
32
35
  ProfileSection,
33
36
  RoleAdmin,
@@ -37,13 +40,18 @@ var {
37
40
  SelfTestPanel,
38
41
  SettingsLayout,
39
42
  SettingsSection,
43
+ Sidebar,
40
44
  SupportConnection,
45
+ SupportDrawer,
46
+ TenantConnectStep,
41
47
  ThemeChoice,
48
+ ThemeProvider,
42
49
  TimezoneChoice,
43
50
  UpdateBanner,
44
51
  UserAdmin,
45
52
  accountArea,
46
53
  accountGroups,
54
+ announceTenantChange,
47
55
  auditApi,
48
56
  backupApi,
49
57
  customerAccessProps,
@@ -1027,25 +1035,1159 @@ function ScalioRoleTenants({
1027
1035
  }
1028
1036
  ) });
1029
1037
  }
1038
+
1039
+ // src/app-kit/ScalioResultBadge.tsx
1040
+ import { jsx as jsx16 } from "react/jsx-runtime";
1041
+ var STATUS_MAP = {
1042
+ ok: {
1043
+ en: "fulfilled",
1044
+ de: "erf\xFCllt",
1045
+ cls: "bg-[#34C759]/10 text-[#1f7a3d] dark:text-emerald-400 border-[#34C759]/40"
1046
+ },
1047
+ success: {
1048
+ en: "ok",
1049
+ de: "ok",
1050
+ cls: "bg-[#34C759]/10 text-[#1f7a3d] dark:text-emerald-400 border-[#34C759]/40"
1051
+ },
1052
+ drift: {
1053
+ en: "deviation",
1054
+ de: "Abweichung",
1055
+ cls: "bg-[#FF3B30]/10 text-[#FF3B30] border-[#FF3B30]/30"
1056
+ },
1057
+ missing: {
1058
+ en: "missing",
1059
+ de: "fehlt",
1060
+ cls: "bg-[#FF3B30]/10 text-[#FF3B30] border-[#FF3B30]/30"
1061
+ },
1062
+ error: {
1063
+ en: "error",
1064
+ de: "Fehler",
1065
+ cls: "bg-[#FF3B30]/10 text-[#FF3B30] border-[#FF3B30]/30"
1066
+ },
1067
+ excepted: {
1068
+ en: "exception",
1069
+ de: "Ausnahme",
1070
+ cls: "bg-[#FFCC00]/15 text-[#8a6d00] dark:text-yellow-300 border-[#FFCC00]/50"
1071
+ },
1072
+ warning: {
1073
+ en: "warning",
1074
+ de: "Warnung",
1075
+ cls: "bg-[#FFCC00]/15 text-[#8a6d00] dark:text-yellow-300 border-[#FFCC00]/50"
1076
+ },
1077
+ info: {
1078
+ en: "info",
1079
+ de: "Info",
1080
+ cls: "bg-primary/10 text-primary border-primary/30"
1081
+ },
1082
+ removed: {
1083
+ en: "removed",
1084
+ de: "entfernt",
1085
+ cls: "bg-secondary text-muted-foreground border-border"
1086
+ },
1087
+ incomplete: {
1088
+ en: "value missing",
1089
+ de: "Wert fehlt",
1090
+ cls: "bg-secondary text-muted-foreground border-border"
1091
+ },
1092
+ not_read: {
1093
+ en: "not read",
1094
+ de: "nicht gelesen",
1095
+ cls: "bg-secondary text-muted-foreground border-border"
1096
+ },
1097
+ neutral: {
1098
+ en: "neutral",
1099
+ de: "neutral",
1100
+ cls: "bg-secondary text-muted-foreground border-border"
1101
+ }
1102
+ };
1103
+ function ScalioResultBadge({
1104
+ status,
1105
+ lang = "en",
1106
+ label,
1107
+ className = "",
1108
+ testId
1109
+ }) {
1110
+ const spec = STATUS_MAP[status] ?? STATUS_MAP.not_read;
1111
+ const text = label ?? (lang === "de" ? spec.de : spec.en);
1112
+ return /* @__PURE__ */ jsx16(
1113
+ "span",
1114
+ {
1115
+ "data-testid": testId,
1116
+ className: `inline-flex items-center rounded-sm border px-2 py-0.5 text-xs font-semibold font-mono ${spec.cls} ${className}`.trim(),
1117
+ children: text
1118
+ }
1119
+ );
1120
+ }
1121
+ function formatDisplayValue(value) {
1122
+ if (value === void 0 || value === null) return "\u2014";
1123
+ return typeof value === "string" ? value : JSON.stringify(value);
1124
+ }
1125
+
1126
+ // src/app-kit/ScalioTenantSettings.tsx
1127
+ import { useMemo as useMemo11, useState as useState8 } from "react";
1128
+ import { toast as toast13 } from "sonner";
1129
+ import { Unplug } from "lucide-react";
1130
+ import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
1131
+ function ScalioTenantSettings({
1132
+ api,
1133
+ appName,
1134
+ lang,
1135
+ t,
1136
+ confirm,
1137
+ formatApiErrorDetail,
1138
+ description,
1139
+ removeConfirmText,
1140
+ endpointPrefix = "/tenant/connection"
1141
+ }) {
1142
+ const [connected, setConnected] = useState8(false);
1143
+ const [resetKey, setResetKey] = useState8(0);
1144
+ const client = useMemo11(
1145
+ () => ({
1146
+ status: () => api.get(endpointPrefix).then((r) => {
1147
+ setConnected(Boolean(r.data?.connected));
1148
+ return r.data;
1149
+ }),
1150
+ link: () => api.post(`${endpointPrefix}/link`).then((r) => r.data),
1151
+ script: () => api.post(`${endpointPrefix}/script`).then((r) => r.data),
1152
+ redeem: (code) => api.post(`${endpointPrefix}/code`, { code }).then((r) => r.data),
1153
+ check: () => api.post(`${endpointPrefix}/check`).then((r) => r.data)
1154
+ }),
1155
+ [api, endpointPrefix]
1156
+ );
1157
+ const remove = async () => {
1158
+ const ok = await confirm({
1159
+ title: t("Remove the connection?"),
1160
+ text: removeConfirmText,
1161
+ action: t("Remove"),
1162
+ danger: true
1163
+ });
1164
+ if (!ok) return;
1165
+ try {
1166
+ await api.delete(endpointPrefix);
1167
+ toast13.success(t("Connection removed"));
1168
+ announceTenantChange({});
1169
+ setResetKey((k) => k + 1);
1170
+ } catch (err) {
1171
+ const e = err;
1172
+ toast13.error(formatApiErrorDetail(e?.response?.data?.detail) || e?.message || t("The action failed."));
1173
+ }
1174
+ };
1175
+ return /* @__PURE__ */ jsx17(
1176
+ SettingsSection,
1177
+ {
1178
+ id: "tenant",
1179
+ title: t("Microsoft tenant"),
1180
+ testId: "tenant-settings",
1181
+ description,
1182
+ children: /* @__PURE__ */ jsxs7("div", { className: "space-y-3", children: [
1183
+ /* @__PURE__ */ jsx17(TenantConnectStep, { client, app: appName, lang, showLater: false }, resetKey),
1184
+ connected && /* @__PURE__ */ jsxs7(
1185
+ "button",
1186
+ {
1187
+ type: "button",
1188
+ onClick: remove,
1189
+ "data-testid": "tenant-remove",
1190
+ className: "inline-flex items-center gap-1.5 h-8 px-3 text-xs font-semibold rounded-sm border border-destructive/40 text-destructive hover:bg-destructive/10 transition-colors",
1191
+ children: [
1192
+ /* @__PURE__ */ jsx17(Unplug, { className: "w-3.5 h-3.5" }),
1193
+ t("Remove connection")
1194
+ ]
1195
+ }
1196
+ )
1197
+ ] })
1198
+ }
1199
+ );
1200
+ }
1201
+
1202
+ // src/app-kit/ScalioFormField.tsx
1203
+ import { AlertCircle } from "lucide-react";
1204
+ import { jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
1205
+ function ScalioFormField({
1206
+ label,
1207
+ htmlFor,
1208
+ required = false,
1209
+ hint,
1210
+ error,
1211
+ labelExtra,
1212
+ className = "",
1213
+ testId,
1214
+ children
1215
+ }) {
1216
+ const errorId = htmlFor ? `${htmlFor}-error` : void 0;
1217
+ const hintId = htmlFor ? `${htmlFor}-hint` : void 0;
1218
+ return /* @__PURE__ */ jsxs8("div", { className: `space-y-1.5 ${className}`.trim(), "data-testid": testId, children: [
1219
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between gap-2", children: [
1220
+ /* @__PURE__ */ jsxs8(
1221
+ "label",
1222
+ {
1223
+ htmlFor,
1224
+ className: "text-[11px] font-bold uppercase tracking-widest text-muted-foreground",
1225
+ children: [
1226
+ label,
1227
+ required && /* @__PURE__ */ jsx18("span", { className: "ml-0.5 text-destructive", "aria-hidden": "true", children: "*" })
1228
+ ]
1229
+ }
1230
+ ),
1231
+ labelExtra
1232
+ ] }),
1233
+ children,
1234
+ error ? /* @__PURE__ */ jsxs8(
1235
+ "p",
1236
+ {
1237
+ id: errorId,
1238
+ role: "alert",
1239
+ "data-testid": testId ? `${testId}-error` : void 0,
1240
+ className: "flex items-center gap-1.5 text-xs font-medium text-destructive",
1241
+ children: [
1242
+ /* @__PURE__ */ jsx18(AlertCircle, { className: "w-3.5 h-3.5 shrink-0" }),
1243
+ /* @__PURE__ */ jsx18("span", { children: error })
1244
+ ]
1245
+ }
1246
+ ) : hint && /* @__PURE__ */ jsx18("p", { id: hintId, className: "text-xs text-muted-foreground", children: hint })
1247
+ ] });
1248
+ }
1249
+ function ScalioFormError({
1250
+ message,
1251
+ fieldErrors,
1252
+ title,
1253
+ className = "",
1254
+ testId = "scalio-form-error"
1255
+ }) {
1256
+ const entries = fieldErrors ? Object.entries(fieldErrors).filter(([, v]) => Boolean(v)) : [];
1257
+ if (!message && entries.length === 0) return null;
1258
+ return /* @__PURE__ */ jsx18(
1259
+ "div",
1260
+ {
1261
+ role: "alert",
1262
+ "data-testid": testId,
1263
+ className: `rounded-sm border border-destructive/40 bg-destructive/10 px-3.5 py-2.5 text-xs text-destructive space-y-1 ${className}`.trim(),
1264
+ children: /* @__PURE__ */ jsxs8("div", { className: "flex items-start gap-2", children: [
1265
+ /* @__PURE__ */ jsx18(AlertCircle, { className: "w-4 h-4 shrink-0 mt-0.5" }),
1266
+ /* @__PURE__ */ jsxs8("div", { className: "space-y-1", children: [
1267
+ title && /* @__PURE__ */ jsx18("p", { className: "font-semibold", children: title }),
1268
+ message && /* @__PURE__ */ jsx18("p", { children: message }),
1269
+ entries.length > 0 && /* @__PURE__ */ jsx18("ul", { className: "list-disc pl-4 space-y-0.5", children: entries.map(([field, text]) => /* @__PURE__ */ jsxs8("li", { children: [
1270
+ /* @__PURE__ */ jsxs8("span", { className: "font-semibold", children: [
1271
+ field,
1272
+ ":"
1273
+ ] }),
1274
+ " ",
1275
+ text
1276
+ ] }, field)) })
1277
+ ] })
1278
+ ] })
1279
+ }
1280
+ );
1281
+ }
1282
+
1283
+ // src/app-kit/ScalioErrorBoundary.tsx
1284
+ import React16 from "react";
1285
+ import { AlertTriangle, RotateCcw } from "lucide-react";
1286
+ import { jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
1287
+ var DEFAULT_TEXT = {
1288
+ en: {
1289
+ title: "Something went wrong",
1290
+ description: "This view encountered an unexpected error. Reload the page to continue.",
1291
+ reload: "Reload page"
1292
+ },
1293
+ de: {
1294
+ title: "Etwas ist schiefgelaufen",
1295
+ description: "In dieser Ansicht ist ein unerwarteter Fehler aufgetreten. Lade die Seite neu, um fortzufahren.",
1296
+ reload: "Seite neu laden"
1297
+ }
1298
+ };
1299
+ var ScalioErrorBoundary = class extends React16.Component {
1300
+ state = { hasError: false };
1301
+ static getDerivedStateFromError() {
1302
+ return { hasError: true };
1303
+ }
1304
+ componentDidCatch(error, info) {
1305
+ this.props.onError?.(error, info);
1306
+ }
1307
+ handleReset = () => {
1308
+ this.setState({ hasError: false });
1309
+ if (this.props.onReset) {
1310
+ this.props.onReset();
1311
+ } else if (typeof window !== "undefined") {
1312
+ window.location.reload();
1313
+ }
1314
+ };
1315
+ render() {
1316
+ if (!this.state.hasError) {
1317
+ return this.props.children;
1318
+ }
1319
+ const lang = this.props.lang ?? "en";
1320
+ const texts = DEFAULT_TEXT[lang];
1321
+ return /* @__PURE__ */ jsx19(
1322
+ "div",
1323
+ {
1324
+ role: "alert",
1325
+ "data-testid": "scalio-error-boundary",
1326
+ className: "min-h-[240px] flex items-center justify-center p-6",
1327
+ children: /* @__PURE__ */ jsxs9("div", { className: "max-w-md w-full rounded-sm border border-destructive/40 bg-card p-6 text-center space-y-3 shadow-sm", children: [
1328
+ /* @__PURE__ */ jsx19("div", { className: "mx-auto w-10 h-10 rounded-full bg-destructive/10 text-destructive flex items-center justify-center", children: /* @__PURE__ */ jsx19(AlertTriangle, { className: "w-5 h-5" }) }),
1329
+ /* @__PURE__ */ jsx19("h2", { className: "text-base font-bold text-foreground", children: this.props.title ?? texts.title }),
1330
+ /* @__PURE__ */ jsx19("p", { className: "text-xs text-muted-foreground", children: this.props.description ?? texts.description }),
1331
+ /* @__PURE__ */ jsxs9(
1332
+ "button",
1333
+ {
1334
+ type: "button",
1335
+ onClick: this.handleReset,
1336
+ "data-testid": "scalio-error-boundary-reload",
1337
+ className: "inline-flex items-center gap-1.5 h-9 px-4 text-xs font-semibold rounded-sm bg-primary text-primary-foreground hover:bg-primary/90",
1338
+ children: [
1339
+ /* @__PURE__ */ jsx19(RotateCcw, { className: "w-3.5 h-3.5" }),
1340
+ this.props.reloadLabel ?? texts.reload
1341
+ ]
1342
+ }
1343
+ )
1344
+ ] })
1345
+ }
1346
+ );
1347
+ }
1348
+ };
1349
+
1350
+ // src/app-kit/ScalioEmptyState.tsx
1351
+ import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
1352
+ function ScalioEmptyState({
1353
+ icon,
1354
+ title,
1355
+ description,
1356
+ action,
1357
+ className = "",
1358
+ testId = "scalio-empty-state"
1359
+ }) {
1360
+ return /* @__PURE__ */ jsxs10(
1361
+ "div",
1362
+ {
1363
+ "data-testid": testId,
1364
+ className: `rounded-sm border border-dashed border-border bg-card/50 px-6 py-10 text-center space-y-2 ${className}`.trim(),
1365
+ children: [
1366
+ icon && /* @__PURE__ */ jsx20("div", { className: "mx-auto w-10 h-10 rounded-full bg-muted text-muted-foreground flex items-center justify-center", children: icon }),
1367
+ /* @__PURE__ */ jsx20("h3", { className: "text-sm font-semibold text-foreground", children: title }),
1368
+ description && /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground max-w-md mx-auto", children: description }),
1369
+ action && /* @__PURE__ */ jsx20("div", { className: "pt-2", children: action })
1370
+ ]
1371
+ }
1372
+ );
1373
+ }
1374
+
1375
+ // src/app-kit/ScalioFormDialog.tsx
1376
+ import { useCallback as useCallback4, useEffect as useEffect9 } from "react";
1377
+ import { Loader2 as Loader23, X } from "lucide-react";
1378
+ import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
1379
+ var SIZE_CLASS = {
1380
+ sm: "max-w-md",
1381
+ md: "max-w-lg",
1382
+ lg: "max-w-2xl",
1383
+ xl: "max-w-4xl"
1384
+ };
1385
+ var LABELS = {
1386
+ en: {
1387
+ save: "Save",
1388
+ cancel: "Cancel",
1389
+ close: "Close dialog",
1390
+ discardTitle: "Discard unsaved changes?",
1391
+ discardText: "Your changes have not been saved yet.",
1392
+ discardAction: "Discard"
1393
+ },
1394
+ de: {
1395
+ save: "Speichern",
1396
+ cancel: "Abbrechen",
1397
+ close: "Dialog schliessen",
1398
+ discardTitle: "Ungespeicherte \xC4nderungen verwerfen?",
1399
+ discardText: "Deine \xC4nderungen wurden noch nicht gespeichert.",
1400
+ discardAction: "Verwerfen"
1401
+ }
1402
+ };
1403
+ function ScalioFormDialog({
1404
+ open,
1405
+ onOpenChange,
1406
+ title,
1407
+ description,
1408
+ onSubmit,
1409
+ submitLabel,
1410
+ cancelLabel,
1411
+ submitting = false,
1412
+ submitDisabled = false,
1413
+ dirty = false,
1414
+ confirm,
1415
+ error,
1416
+ fieldErrors,
1417
+ size = "md",
1418
+ lang = "en",
1419
+ testId = "scalio-form-dialog",
1420
+ children
1421
+ }) {
1422
+ const L = LABELS[lang];
1423
+ const requestClose = useCallback4(async () => {
1424
+ if (submitting) return;
1425
+ if (dirty && confirm) {
1426
+ const ok = await confirm({
1427
+ title: L.discardTitle,
1428
+ text: L.discardText,
1429
+ action: L.discardAction,
1430
+ danger: true
1431
+ });
1432
+ if (!ok) return;
1433
+ }
1434
+ onOpenChange(false);
1435
+ }, [submitting, dirty, confirm, L, onOpenChange]);
1436
+ useEffect9(() => {
1437
+ if (!open) return;
1438
+ const onKeyDown = (e) => {
1439
+ if (e.key === "Escape") {
1440
+ e.preventDefault();
1441
+ void requestClose();
1442
+ }
1443
+ };
1444
+ document.addEventListener("keydown", onKeyDown);
1445
+ return () => document.removeEventListener("keydown", onKeyDown);
1446
+ }, [open, requestClose]);
1447
+ if (!open) return null;
1448
+ const handleFormSubmit = (e) => {
1449
+ e.preventDefault();
1450
+ if (submitting || submitDisabled) return;
1451
+ void onSubmit();
1452
+ };
1453
+ return /* @__PURE__ */ jsx21(
1454
+ "div",
1455
+ {
1456
+ className: "fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-[1px]",
1457
+ onMouseDown: (e) => {
1458
+ if (e.target === e.currentTarget) void requestClose();
1459
+ },
1460
+ "data-testid": `${testId}-backdrop`,
1461
+ children: /* @__PURE__ */ jsxs11(
1462
+ "div",
1463
+ {
1464
+ role: "dialog",
1465
+ "aria-modal": "true",
1466
+ "aria-labelledby": `${testId}-title`,
1467
+ "data-testid": testId,
1468
+ className: `w-full ${SIZE_CLASS[size]} max-h-[90vh] flex flex-col rounded-sm border border-border bg-card text-card-foreground shadow-xl`,
1469
+ children: [
1470
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-start justify-between gap-4 px-5 py-4 border-b border-border shrink-0", children: [
1471
+ /* @__PURE__ */ jsxs11("div", { children: [
1472
+ /* @__PURE__ */ jsx21("h2", { id: `${testId}-title`, className: "text-base font-bold text-foreground", children: title }),
1473
+ description && /* @__PURE__ */ jsx21("p", { className: "mt-0.5 text-xs text-muted-foreground", children: description })
1474
+ ] }),
1475
+ /* @__PURE__ */ jsx21(
1476
+ "button",
1477
+ {
1478
+ type: "button",
1479
+ onClick: () => void requestClose(),
1480
+ disabled: submitting,
1481
+ "aria-label": L.close,
1482
+ "data-testid": `${testId}-close`,
1483
+ className: "h-7 w-7 inline-flex items-center justify-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-40",
1484
+ children: /* @__PURE__ */ jsx21(X, { className: "w-4 h-4" })
1485
+ }
1486
+ )
1487
+ ] }),
1488
+ /* @__PURE__ */ jsxs11("form", { onSubmit: handleFormSubmit, className: "flex flex-col min-h-0 flex-1", children: [
1489
+ /* @__PURE__ */ jsxs11("div", { className: "px-5 py-4 overflow-y-auto space-y-4 flex-1", children: [
1490
+ /* @__PURE__ */ jsx21(ScalioFormError, { message: error, fieldErrors }),
1491
+ children
1492
+ ] }),
1493
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-end gap-2 px-5 py-3 border-t border-border bg-muted/30 shrink-0", children: [
1494
+ /* @__PURE__ */ jsx21(
1495
+ "button",
1496
+ {
1497
+ type: "button",
1498
+ onClick: () => void requestClose(),
1499
+ disabled: submitting,
1500
+ "data-testid": `${testId}-cancel`,
1501
+ className: "h-9 px-3.5 text-xs font-semibold rounded-sm border border-input bg-background text-foreground hover:bg-muted disabled:opacity-40",
1502
+ children: cancelLabel ?? L.cancel
1503
+ }
1504
+ ),
1505
+ /* @__PURE__ */ jsxs11(
1506
+ "button",
1507
+ {
1508
+ type: "submit",
1509
+ disabled: submitting || submitDisabled,
1510
+ "data-testid": `${testId}-submit`,
1511
+ className: "h-9 px-4 text-xs font-bold uppercase tracking-wider rounded-sm bg-primary text-primary-foreground hover:bg-primary/90 inline-flex items-center gap-1.5 disabled:opacity-40",
1512
+ children: [
1513
+ submitting && /* @__PURE__ */ jsx21(Loader23, { className: "w-3.5 h-3.5 animate-spin" }),
1514
+ submitLabel ?? L.save
1515
+ ]
1516
+ }
1517
+ )
1518
+ ] })
1519
+ ] })
1520
+ ]
1521
+ }
1522
+ )
1523
+ }
1524
+ );
1525
+ }
1526
+
1527
+ // src/app-kit/ScalioDrawer.tsx
1528
+ import { useCallback as useCallback5, useEffect as useEffect10 } from "react";
1529
+ import { X as X2 } from "lucide-react";
1530
+ import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
1531
+ var DRAWER_WIDTH = {
1532
+ sm: "max-w-sm",
1533
+ md: "max-w-md",
1534
+ lg: "max-w-xl",
1535
+ xl: "max-w-3xl"
1536
+ };
1537
+ var LABELS2 = {
1538
+ en: {
1539
+ close: "Close panel",
1540
+ discardTitle: "Discard unsaved changes?",
1541
+ discardText: "Your changes have not been saved yet.",
1542
+ discardAction: "Discard"
1543
+ },
1544
+ de: {
1545
+ close: "Seitenleiste schliessen",
1546
+ discardTitle: "Ungespeicherte \xC4nderungen verwerfen?",
1547
+ discardText: "Deine \xC4nderungen wurden noch nicht gespeichert.",
1548
+ discardAction: "Verwerfen"
1549
+ }
1550
+ };
1551
+ function ScalioDrawer({
1552
+ open,
1553
+ onOpenChange,
1554
+ title,
1555
+ description,
1556
+ headerExtra,
1557
+ footer,
1558
+ size = "md",
1559
+ dirty = false,
1560
+ confirm,
1561
+ lang = "en",
1562
+ testId = "scalio-drawer",
1563
+ children
1564
+ }) {
1565
+ const L = LABELS2[lang];
1566
+ const requestClose = useCallback5(async () => {
1567
+ if (dirty && confirm) {
1568
+ const ok = await confirm({
1569
+ title: L.discardTitle,
1570
+ text: L.discardText,
1571
+ action: L.discardAction,
1572
+ danger: true
1573
+ });
1574
+ if (!ok) return;
1575
+ }
1576
+ onOpenChange(false);
1577
+ }, [dirty, confirm, L, onOpenChange]);
1578
+ useEffect10(() => {
1579
+ if (!open) return;
1580
+ const onKeyDown = (e) => {
1581
+ if (e.key === "Escape") {
1582
+ e.preventDefault();
1583
+ void requestClose();
1584
+ }
1585
+ };
1586
+ document.addEventListener("keydown", onKeyDown);
1587
+ return () => document.removeEventListener("keydown", onKeyDown);
1588
+ }, [open, requestClose]);
1589
+ if (!open) return null;
1590
+ return /* @__PURE__ */ jsx22(
1591
+ "div",
1592
+ {
1593
+ className: "fixed inset-0 z-50 flex justify-end bg-black/50 backdrop-blur-[1px]",
1594
+ onMouseDown: (e) => {
1595
+ if (e.target === e.currentTarget) void requestClose();
1596
+ },
1597
+ "data-testid": `${testId}-backdrop`,
1598
+ children: /* @__PURE__ */ jsxs12(
1599
+ "div",
1600
+ {
1601
+ role: "dialog",
1602
+ "aria-modal": "true",
1603
+ "aria-labelledby": `${testId}-title`,
1604
+ "data-testid": testId,
1605
+ className: `w-full ${DRAWER_WIDTH[size]} h-full flex flex-col border-l border-border bg-card text-card-foreground shadow-2xl`,
1606
+ children: [
1607
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-start justify-between gap-3 px-5 py-4 border-b border-border shrink-0", children: [
1608
+ /* @__PURE__ */ jsxs12("div", { className: "min-w-0", children: [
1609
+ /* @__PURE__ */ jsx22("h2", { id: `${testId}-title`, className: "text-base font-bold text-foreground truncate", children: title }),
1610
+ description && /* @__PURE__ */ jsx22("p", { className: "mt-0.5 text-xs text-muted-foreground", children: description })
1611
+ ] }),
1612
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 shrink-0", children: [
1613
+ headerExtra,
1614
+ /* @__PURE__ */ jsx22(
1615
+ "button",
1616
+ {
1617
+ type: "button",
1618
+ onClick: () => void requestClose(),
1619
+ "aria-label": L.close,
1620
+ "data-testid": `${testId}-close`,
1621
+ className: "h-7 w-7 inline-flex items-center justify-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground",
1622
+ children: /* @__PURE__ */ jsx22(X2, { className: "w-4 h-4" })
1623
+ }
1624
+ )
1625
+ ] })
1626
+ ] }),
1627
+ /* @__PURE__ */ jsx22("div", { className: "flex-1 overflow-y-auto px-5 py-4", children }),
1628
+ footer && /* @__PURE__ */ jsx22("div", { className: "px-5 py-3 border-t border-border bg-muted/30 shrink-0", children: footer })
1629
+ ]
1630
+ }
1631
+ )
1632
+ }
1633
+ );
1634
+ }
1635
+
1636
+ // src/app-kit/ScalioInputs.tsx
1637
+ import { useEffect as useEffect11, useMemo as useMemo12, useRef, useState as useState9 } from "react";
1638
+ import { Check, ChevronDown, X as X3 } from "lucide-react";
1639
+ import { jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
1640
+ function formatMinorToEditable(minorUnits, digits = 2) {
1641
+ if (minorUnits === null || Number.isNaN(minorUnits)) return "";
1642
+ return (minorUnits / 10 ** digits).toFixed(digits);
1643
+ }
1644
+ function parseEditableToMinor(raw, digits = 2) {
1645
+ const normalized = raw.trim().replace(/'/g, "").replace(/\s+/g, "").replace(",", ".");
1646
+ if (!normalized) return null;
1647
+ if (!/^-?\d+(?:\.\d*)?$/.test(normalized)) return null;
1648
+ const parsed = Number(normalized);
1649
+ if (!Number.isFinite(parsed)) return null;
1650
+ return Math.round(parsed * 10 ** digits);
1651
+ }
1652
+ function ScalioMoneyInput({
1653
+ value,
1654
+ onChange,
1655
+ currency = "CHF",
1656
+ minorUnitDigits = 2,
1657
+ id,
1658
+ disabled = false,
1659
+ placeholder = "0.00",
1660
+ testId = "scalio-money-input",
1661
+ className = ""
1662
+ }) {
1663
+ const [draft, setDraft] = useState9(() => formatMinorToEditable(value, minorUnitDigits));
1664
+ const [focused, setFocused] = useState9(false);
1665
+ useEffect11(() => {
1666
+ if (!focused) {
1667
+ setDraft(formatMinorToEditable(value, minorUnitDigits));
1668
+ }
1669
+ }, [value, minorUnitDigits, focused]);
1670
+ return /* @__PURE__ */ jsxs13(
1671
+ "div",
1672
+ {
1673
+ className: `flex items-center h-10 rounded-sm border border-input bg-background focus-within:ring-2 focus-within:ring-ring ${disabled ? "opacity-50" : ""} ${className}`.trim(),
1674
+ children: [
1675
+ /* @__PURE__ */ jsx23("span", { className: "px-3 text-xs font-bold uppercase tracking-wider text-muted-foreground border-r border-border select-none", children: currency.toUpperCase() }),
1676
+ /* @__PURE__ */ jsx23(
1677
+ "input",
1678
+ {
1679
+ id,
1680
+ type: "text",
1681
+ inputMode: "decimal",
1682
+ disabled,
1683
+ value: draft,
1684
+ placeholder,
1685
+ "data-testid": testId,
1686
+ onFocus: () => setFocused(true),
1687
+ onChange: (e) => {
1688
+ const text = e.target.value;
1689
+ setDraft(text);
1690
+ if (text.trim() === "") {
1691
+ onChange(null);
1692
+ return;
1693
+ }
1694
+ const minor = parseEditableToMinor(text, minorUnitDigits);
1695
+ if (minor !== null) onChange(minor);
1696
+ },
1697
+ onBlur: () => {
1698
+ setFocused(false);
1699
+ const minor = parseEditableToMinor(draft, minorUnitDigits);
1700
+ onChange(minor);
1701
+ setDraft(formatMinorToEditable(minor, minorUnitDigits));
1702
+ },
1703
+ className: "flex-1 h-full px-3 text-sm text-right tabular-nums bg-transparent text-foreground outline-none"
1704
+ }
1705
+ )
1706
+ ]
1707
+ }
1708
+ );
1709
+ }
1710
+ function ScalioTagInput({
1711
+ values,
1712
+ onChange,
1713
+ validate,
1714
+ id,
1715
+ placeholder = "Add entry...",
1716
+ disabled = false,
1717
+ testId = "scalio-tag-input",
1718
+ className = ""
1719
+ }) {
1720
+ const [draft, setDraft] = useState9("");
1721
+ const [localError, setLocalError] = useState9(null);
1722
+ const commit = (raw) => {
1723
+ const trimmed = raw.trim();
1724
+ if (!trimmed) {
1725
+ setDraft("");
1726
+ setLocalError(null);
1727
+ return;
1728
+ }
1729
+ if (validate) {
1730
+ const err = validate(trimmed);
1731
+ if (err) {
1732
+ setLocalError(err);
1733
+ return;
1734
+ }
1735
+ }
1736
+ setLocalError(null);
1737
+ if (!values.includes(trimmed)) {
1738
+ onChange([...values, trimmed]);
1739
+ }
1740
+ setDraft("");
1741
+ };
1742
+ const remove = (item) => {
1743
+ onChange(values.filter((v) => v !== item));
1744
+ };
1745
+ return /* @__PURE__ */ jsxs13("div", { className: "space-y-1", children: [
1746
+ /* @__PURE__ */ jsxs13(
1747
+ "div",
1748
+ {
1749
+ "data-testid": testId,
1750
+ className: `min-h-10 px-2 py-1.5 flex flex-wrap items-center gap-1.5 rounded-sm border border-input bg-background focus-within:ring-2 focus-within:ring-ring ${disabled ? "opacity-50" : ""} ${className}`.trim(),
1751
+ children: [
1752
+ values.map((item) => /* @__PURE__ */ jsxs13(
1753
+ "span",
1754
+ {
1755
+ "data-testid": `${testId}-chip-${item}`,
1756
+ className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-mono rounded-sm bg-secondary text-secondary-foreground border border-border",
1757
+ children: [
1758
+ /* @__PURE__ */ jsx23("span", { children: item }),
1759
+ !disabled && /* @__PURE__ */ jsx23(
1760
+ "button",
1761
+ {
1762
+ type: "button",
1763
+ onClick: () => remove(item),
1764
+ "aria-label": `Remove ${item}`,
1765
+ className: "text-muted-foreground hover:text-foreground",
1766
+ children: /* @__PURE__ */ jsx23(X3, { className: "w-3 h-3" })
1767
+ }
1768
+ )
1769
+ ]
1770
+ },
1771
+ item
1772
+ )),
1773
+ /* @__PURE__ */ jsx23(
1774
+ "input",
1775
+ {
1776
+ id,
1777
+ type: "text",
1778
+ disabled,
1779
+ value: draft,
1780
+ placeholder: values.length === 0 ? placeholder : "",
1781
+ "data-testid": `${testId}-field`,
1782
+ onChange: (e) => {
1783
+ setDraft(e.target.value);
1784
+ if (localError) setLocalError(null);
1785
+ },
1786
+ onKeyDown: (e) => {
1787
+ if (e.key === "Enter" || e.key === ",") {
1788
+ e.preventDefault();
1789
+ commit(draft);
1790
+ } else if (e.key === "Backspace" && !draft && values.length > 0) {
1791
+ const last = values[values.length - 1];
1792
+ if (last !== void 0) remove(last);
1793
+ }
1794
+ },
1795
+ onBlur: () => {
1796
+ if (draft.trim()) commit(draft);
1797
+ },
1798
+ className: "flex-1 min-w-[120px] h-7 px-1 text-sm bg-transparent text-foreground outline-none"
1799
+ }
1800
+ )
1801
+ ]
1802
+ }
1803
+ ),
1804
+ localError && /* @__PURE__ */ jsx23("p", { role: "alert", "data-testid": `${testId}-error`, className: "text-xs text-destructive", children: localError })
1805
+ ] });
1806
+ }
1807
+ function ScalioCombobox({
1808
+ options,
1809
+ value,
1810
+ onChange,
1811
+ placeholder,
1812
+ searchPlaceholder,
1813
+ emptyLabel,
1814
+ clearable = false,
1815
+ disabled = false,
1816
+ lang = "en",
1817
+ testId = "scalio-combobox",
1818
+ className = ""
1819
+ }) {
1820
+ const [open, setOpen] = useState9(false);
1821
+ const [query, setQuery] = useState9("");
1822
+ const [activeIdx, setActiveIdx] = useState9(0);
1823
+ const rootRef = useRef(null);
1824
+ const selected = useMemo12(
1825
+ () => options.find((o) => o.value === value) ?? null,
1826
+ [options, value]
1827
+ );
1828
+ const filtered = useMemo12(() => {
1829
+ const q = query.trim().toLowerCase();
1830
+ if (!q) return options;
1831
+ return options.filter(
1832
+ (o) => o.label.toLowerCase().includes(q) || o.value.toLowerCase().includes(q) || (o.description?.toLowerCase().includes(q) ?? false)
1833
+ );
1834
+ }, [options, query]);
1835
+ useEffect11(() => {
1836
+ if (!open) return;
1837
+ const onDoc = (e) => {
1838
+ if (rootRef.current && !rootRef.current.contains(e.target)) {
1839
+ setOpen(false);
1840
+ }
1841
+ };
1842
+ document.addEventListener("mousedown", onDoc);
1843
+ return () => document.removeEventListener("mousedown", onDoc);
1844
+ }, [open]);
1845
+ const selectOption = (opt) => {
1846
+ if (opt.disabled) return;
1847
+ onChange(opt.value);
1848
+ setOpen(false);
1849
+ setQuery("");
1850
+ };
1851
+ return /* @__PURE__ */ jsxs13("div", { ref: rootRef, className: `relative ${className}`.trim(), "data-testid": testId, children: [
1852
+ /* @__PURE__ */ jsxs13(
1853
+ "button",
1854
+ {
1855
+ type: "button",
1856
+ disabled,
1857
+ "aria-expanded": open,
1858
+ "aria-haspopup": "listbox",
1859
+ "data-testid": `${testId}-trigger`,
1860
+ onClick: () => {
1861
+ setOpen((v) => !v);
1862
+ setActiveIdx(0);
1863
+ },
1864
+ className: "w-full h-10 px-3 flex items-center justify-between gap-2 rounded-sm border border-input bg-background text-sm text-foreground hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
1865
+ children: [
1866
+ /* @__PURE__ */ jsx23("span", { className: `truncate ${selected ? "text-foreground" : "text-muted-foreground"}`, children: selected ? selected.label : placeholder ?? (lang === "de" ? "Ausw\xE4hlen..." : "Select...") }),
1867
+ /* @__PURE__ */ jsxs13("span", { className: "inline-flex items-center gap-1 shrink-0", children: [
1868
+ clearable && selected && !disabled && /* @__PURE__ */ jsx23(
1869
+ "span",
1870
+ {
1871
+ role: "button",
1872
+ tabIndex: 0,
1873
+ "aria-label": lang === "de" ? "Auswahl leeren" : "Clear selection",
1874
+ onClick: (e) => {
1875
+ e.stopPropagation();
1876
+ onChange(null);
1877
+ },
1878
+ onKeyDown: (e) => {
1879
+ if (e.key === "Enter" || e.key === " ") {
1880
+ e.preventDefault();
1881
+ e.stopPropagation();
1882
+ onChange(null);
1883
+ }
1884
+ },
1885
+ className: "p-0.5 text-muted-foreground hover:text-foreground",
1886
+ children: /* @__PURE__ */ jsx23(X3, { className: "w-3.5 h-3.5" })
1887
+ }
1888
+ ),
1889
+ /* @__PURE__ */ jsx23(ChevronDown, { className: "w-4 h-4 opacity-60" })
1890
+ ] })
1891
+ ]
1892
+ }
1893
+ ),
1894
+ open && /* @__PURE__ */ jsxs13(
1895
+ "div",
1896
+ {
1897
+ className: "absolute left-0 right-0 mt-1 rounded-sm border border-border bg-popover text-popover-foreground shadow-lg z-40 overflow-hidden",
1898
+ "data-testid": `${testId}-menu`,
1899
+ children: [
1900
+ /* @__PURE__ */ jsx23("div", { className: "p-1.5 border-b border-border", children: /* @__PURE__ */ jsx23(
1901
+ "input",
1902
+ {
1903
+ type: "search",
1904
+ autoFocus: true,
1905
+ value: query,
1906
+ onChange: (e) => {
1907
+ setQuery(e.target.value);
1908
+ setActiveIdx(0);
1909
+ },
1910
+ onKeyDown: (e) => {
1911
+ if (e.key === "ArrowDown") {
1912
+ e.preventDefault();
1913
+ setActiveIdx((i) => Math.min(i + 1, Math.max(0, filtered.length - 1)));
1914
+ } else if (e.key === "ArrowUp") {
1915
+ e.preventDefault();
1916
+ setActiveIdx((i) => Math.max(i - 1, 0));
1917
+ } else if (e.key === "Enter") {
1918
+ e.preventDefault();
1919
+ const chosen = filtered[activeIdx];
1920
+ if (chosen) selectOption(chosen);
1921
+ } else if (e.key === "Escape") {
1922
+ setOpen(false);
1923
+ }
1924
+ },
1925
+ placeholder: searchPlaceholder ?? (lang === "de" ? "Suchen..." : "Search..."),
1926
+ "data-testid": `${testId}-search`,
1927
+ className: "w-full h-8 px-2 text-xs rounded-sm border border-input bg-background text-foreground outline-none focus:ring-1 focus:ring-ring"
1928
+ }
1929
+ ) }),
1930
+ /* @__PURE__ */ jsx23("ul", { role: "listbox", className: "max-h-60 overflow-y-auto p-1 space-y-0.5", children: filtered.length === 0 ? /* @__PURE__ */ jsx23("li", { className: "px-2.5 py-2 text-xs text-muted-foreground text-center", children: emptyLabel ?? (lang === "de" ? "Keine Treffer" : "No matches") }) : filtered.map((opt, idx) => {
1931
+ const isSelected = opt.value === value;
1932
+ const isActive = idx === activeIdx;
1933
+ return /* @__PURE__ */ jsx23("li", { role: "option", "aria-selected": isSelected, children: /* @__PURE__ */ jsxs13(
1934
+ "button",
1935
+ {
1936
+ type: "button",
1937
+ disabled: opt.disabled,
1938
+ onClick: () => selectOption(opt),
1939
+ "data-testid": `${testId}-opt-${opt.value}`,
1940
+ className: `w-full text-left px-2.5 py-1.5 text-xs rounded-sm flex items-center justify-between gap-2 disabled:opacity-40 ${isActive ? "bg-muted" : "hover:bg-muted/60"} ${isSelected ? "font-semibold text-primary" : "text-foreground"}`,
1941
+ children: [
1942
+ /* @__PURE__ */ jsxs13("span", { className: "min-w-0", children: [
1943
+ /* @__PURE__ */ jsx23("span", { className: "block truncate", children: opt.label }),
1944
+ opt.description && /* @__PURE__ */ jsx23("span", { className: "block text-[11px] text-muted-foreground truncate", children: opt.description })
1945
+ ] }),
1946
+ isSelected && /* @__PURE__ */ jsx23(Check, { className: "w-3.5 h-3.5 shrink-0 text-primary" })
1947
+ ]
1948
+ }
1949
+ ) }, opt.value);
1950
+ }) })
1951
+ ]
1952
+ }
1953
+ )
1954
+ ] });
1955
+ }
1956
+ function ScalioDateRangeInput({
1957
+ value,
1958
+ onChange,
1959
+ min,
1960
+ max,
1961
+ disabled = false,
1962
+ lang = "en",
1963
+ testId = "scalio-date-range",
1964
+ className = ""
1965
+ }) {
1966
+ const fromLabel = lang === "de" ? "Von" : "From";
1967
+ const toLabel = lang === "de" ? "Bis" : "To";
1968
+ return /* @__PURE__ */ jsxs13("div", { className: `flex flex-wrap items-center gap-2 ${className}`.trim(), "data-testid": testId, children: [
1969
+ /* @__PURE__ */ jsxs13("label", { className: "inline-flex items-center gap-1.5 text-xs text-muted-foreground", children: [
1970
+ /* @__PURE__ */ jsx23("span", { children: fromLabel }),
1971
+ /* @__PURE__ */ jsx23(
1972
+ "input",
1973
+ {
1974
+ type: "date",
1975
+ disabled,
1976
+ value: value.from,
1977
+ min,
1978
+ max: value.to || max,
1979
+ "data-testid": `${testId}-from`,
1980
+ onChange: (e) => onChange({ ...value, from: e.target.value }),
1981
+ className: "h-9 px-2.5 text-xs rounded-sm border border-input bg-background text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50"
1982
+ }
1983
+ )
1984
+ ] }),
1985
+ /* @__PURE__ */ jsxs13("label", { className: "inline-flex items-center gap-1.5 text-xs text-muted-foreground", children: [
1986
+ /* @__PURE__ */ jsx23("span", { children: toLabel }),
1987
+ /* @__PURE__ */ jsx23(
1988
+ "input",
1989
+ {
1990
+ type: "date",
1991
+ disabled,
1992
+ value: value.to,
1993
+ min: value.from || min,
1994
+ max,
1995
+ "data-testid": `${testId}-to`,
1996
+ onChange: (e) => onChange({ ...value, to: e.target.value }),
1997
+ className: "h-9 px-2.5 text-xs rounded-sm border border-input bg-background text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50"
1998
+ }
1999
+ )
2000
+ ] })
2001
+ ] });
2002
+ }
2003
+
2004
+ // src/app-kit/ScalioUtilities.tsx
2005
+ import { useEffect as useEffect12, useState as useState10 } from "react";
2006
+ import { Check as Check2, Copy, WifiOff } from "lucide-react";
2007
+ import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
2008
+ function ScalioOfflineBanner({
2009
+ lang = "en",
2010
+ message,
2011
+ testId = "scalio-offline-banner"
2012
+ }) {
2013
+ const [offline, setOffline] = useState10(
2014
+ () => typeof navigator !== "undefined" ? navigator.onLine === false : false
2015
+ );
2016
+ useEffect12(() => {
2017
+ if (typeof window === "undefined") return;
2018
+ const goOffline = () => setOffline(true);
2019
+ const goOnline = () => setOffline(false);
2020
+ window.addEventListener("offline", goOffline);
2021
+ window.addEventListener("online", goOnline);
2022
+ return () => {
2023
+ window.removeEventListener("offline", goOffline);
2024
+ window.removeEventListener("online", goOnline);
2025
+ };
2026
+ }, []);
2027
+ if (!offline) return null;
2028
+ const text = message ?? (lang === "de" ? "Keine Internetverbindung. \xC4nderungen k\xF6nnen aktuell nicht gespeichert werden." : "You are offline. Changes cannot be saved until the connection returns.");
2029
+ return /* @__PURE__ */ jsxs14(
2030
+ "div",
2031
+ {
2032
+ role: "status",
2033
+ "data-testid": testId,
2034
+ className: "flex items-center justify-center gap-2 px-4 py-2 bg-[#FFCC00]/20 border-b border-[#FFCC00]/50 text-[#8a6d00] dark:text-yellow-300 text-xs font-medium",
2035
+ children: [
2036
+ /* @__PURE__ */ jsx24(WifiOff, { className: "w-3.5 h-3.5 shrink-0" }),
2037
+ /* @__PURE__ */ jsx24("span", { children: text })
2038
+ ]
2039
+ }
2040
+ );
2041
+ }
2042
+ function ScalioCopyButton({
2043
+ value,
2044
+ label,
2045
+ copiedLabel,
2046
+ lang = "en",
2047
+ className = "",
2048
+ testId = "scalio-copy-btn"
2049
+ }) {
2050
+ const [copied, setCopied] = useState10(false);
2051
+ const defaultLabel = lang === "de" ? "Kopieren" : "Copy";
2052
+ const defaultCopied = lang === "de" ? "Kopiert" : "Copied";
2053
+ const handleCopy = async () => {
2054
+ try {
2055
+ await navigator.clipboard.writeText(value);
2056
+ setCopied(true);
2057
+ window.setTimeout(() => setCopied(false), 1800);
2058
+ } catch {
2059
+ }
2060
+ };
2061
+ return /* @__PURE__ */ jsxs14(
2062
+ "button",
2063
+ {
2064
+ type: "button",
2065
+ onClick: () => void handleCopy(),
2066
+ "aria-label": copied ? copiedLabel ?? defaultCopied : label ?? defaultLabel,
2067
+ "data-testid": testId,
2068
+ className: `inline-flex items-center gap-1.5 h-8 px-2.5 text-xs font-medium rounded-sm border border-input bg-background text-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${className}`.trim(),
2069
+ children: [
2070
+ copied ? /* @__PURE__ */ jsx24(Check2, { className: "w-3.5 h-3.5 text-[#1f7a3d] dark:text-emerald-400" }) : /* @__PURE__ */ jsx24(Copy, { className: "w-3.5 h-3.5" }),
2071
+ /* @__PURE__ */ jsx24("span", { children: copied ? copiedLabel ?? defaultCopied : label ?? defaultLabel })
2072
+ ]
2073
+ }
2074
+ );
2075
+ }
2076
+ function ScalioSkeleton({
2077
+ lines = 1,
2078
+ className = "h-4 w-full",
2079
+ testId = "scalio-skeleton"
2080
+ }) {
2081
+ if (lines <= 1) {
2082
+ return /* @__PURE__ */ jsx24("div", { "data-testid": testId, "aria-hidden": "true", className: `rounded-sm bg-muted animate-pulse ${className}` });
2083
+ }
2084
+ return /* @__PURE__ */ jsx24("div", { "data-testid": testId, "aria-hidden": "true", className: "space-y-2", children: Array.from({ length: lines }).map((_, idx) => /* @__PURE__ */ jsx24(
2085
+ "div",
2086
+ {
2087
+ className: `h-4 rounded-sm bg-muted animate-pulse ${idx === lines - 1 ? "w-2/3" : "w-full"}`
2088
+ },
2089
+ idx
2090
+ )) });
2091
+ }
2092
+
2093
+ // src/app-kit/ScalioAppProviders.tsx
2094
+ import { Toaster } from "sonner";
2095
+ import { ConfirmProvider } from "@scalio-cloud/ui/shadcn/confirm";
2096
+ import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
2097
+ function ScalioAppProviders({
2098
+ themeStoreKey,
2099
+ lang = "en",
2100
+ confirmLabels,
2101
+ onRenderError,
2102
+ children
2103
+ }) {
2104
+ const defaultConfirm = lang === "de" ? { cancel: "Abbrechen", confirm: "Best\xE4tigen" } : { cancel: "Cancel", confirm: "Confirm" };
2105
+ return /* @__PURE__ */ jsx25(ScalioErrorBoundary, { lang, onError: onRenderError, children: /* @__PURE__ */ jsx25(ThemeProvider, { storeKey: themeStoreKey, children: /* @__PURE__ */ jsxs15(ConfirmProvider, { labels: confirmLabels ?? defaultConfirm, children: [
2106
+ children,
2107
+ /* @__PURE__ */ jsx25(Toaster, { position: "top-right", richColors: true })
2108
+ ] }) }) });
2109
+ }
2110
+
2111
+ // src/app-kit/ScalioLayout.tsx
2112
+ import { useState as useState11 } from "react";
2113
+ import { Fragment, jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
2114
+ function ScalioLayout({
2115
+ api,
2116
+ lang,
2117
+ header,
2118
+ sidebar,
2119
+ switcher,
2120
+ extraBanners,
2121
+ showSaasUpdateBanner = false,
2122
+ onOpenSaasUpdates,
2123
+ drawerTop,
2124
+ legalUrl,
2125
+ testId = "scalio-layout",
2126
+ children
2127
+ }) {
2128
+ const [drawerOpen, setDrawerOpen] = useState11(false);
2129
+ const banner = /* @__PURE__ */ jsxs16(Fragment, { children: [
2130
+ /* @__PURE__ */ jsx26(ScalioOfflineBanner, { lang }),
2131
+ /* @__PURE__ */ jsx26(ScalioMaintenanceBanner, { api, lang }),
2132
+ showSaasUpdateBanner && /* @__PURE__ */ jsx26(ScalioSaasUpdateBanner, { api, lang, onOpen: onOpenSaasUpdates }),
2133
+ extraBanners
2134
+ ] });
2135
+ return /* @__PURE__ */ jsx26(
2136
+ AppShell,
2137
+ {
2138
+ switcher,
2139
+ header,
2140
+ banner,
2141
+ sidebar,
2142
+ drawerOpen,
2143
+ onDrawerClose: () => setDrawerOpen(false),
2144
+ drawerTop,
2145
+ legalUrl,
2146
+ lang,
2147
+ testId,
2148
+ children
2149
+ }
2150
+ );
2151
+ }
1030
2152
  export {
2153
+ ScalioAppProviders,
1031
2154
  ScalioAuditHeader,
1032
2155
  ScalioAuditPage,
1033
2156
  ScalioBackupSection,
2157
+ ScalioCombobox,
2158
+ ScalioCopyButton,
2159
+ ScalioDateRangeInput,
2160
+ ScalioDrawer,
2161
+ ScalioEmptyState,
2162
+ ScalioErrorBoundary,
1034
2163
  ScalioFactoryReset,
2164
+ ScalioFormDialog,
2165
+ ScalioFormError,
2166
+ ScalioFormField,
1035
2167
  ScalioInvitePage,
1036
2168
  ScalioJobsPage,
2169
+ ScalioLayout,
1037
2170
  ScalioLicensePanel,
1038
2171
  ScalioLoginPage,
1039
2172
  ScalioMailSettings,
1040
2173
  ScalioMaintenanceBanner,
2174
+ ScalioMoneyInput,
2175
+ ScalioOfflineBanner,
1041
2176
  ScalioPasswordChangePage,
1042
2177
  ScalioProfilePage,
2178
+ ScalioResultBadge,
1043
2179
  ScalioRoleTenants,
1044
2180
  ScalioSaasUpdateBanner,
1045
2181
  ScalioSaasUpdatesSection,
1046
2182
  ScalioSecurityFactors,
1047
2183
  ScalioSelfTestPage,
2184
+ ScalioSkeleton,
1048
2185
  ScalioSupportCard,
1049
- ScalioUsersPage
2186
+ ScalioTagInput,
2187
+ ScalioTenantSettings,
2188
+ ScalioUsersPage,
2189
+ formatDisplayValue,
2190
+ formatMinorToEditable,
2191
+ parseEditableToMinor
1050
2192
  };
1051
2193
  //# sourceMappingURL=index.mjs.map