@scalio-cloud/ui 0.109.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 (83) 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/ScalioFactoryReset.d.ts +15 -0
  10. package/dist/app-kit/ScalioFactoryReset.d.ts.map +1 -0
  11. package/dist/app-kit/ScalioFormDialog.d.ts +33 -0
  12. package/dist/app-kit/ScalioFormDialog.d.ts.map +1 -0
  13. package/dist/app-kit/ScalioFormField.d.ts +36 -0
  14. package/dist/app-kit/ScalioFormField.d.ts.map +1 -0
  15. package/dist/app-kit/ScalioInputs.d.ts +80 -0
  16. package/dist/app-kit/ScalioInputs.d.ts.map +1 -0
  17. package/dist/app-kit/ScalioLayout.d.ts +27 -0
  18. package/dist/app-kit/ScalioLayout.d.ts.map +1 -0
  19. package/dist/app-kit/ScalioLicensePanel.d.ts +23 -0
  20. package/dist/app-kit/ScalioLicensePanel.d.ts.map +1 -0
  21. package/dist/app-kit/ScalioLoginPage.d.ts +1 -1
  22. package/dist/app-kit/ScalioLoginPage.d.ts.map +1 -1
  23. package/dist/app-kit/ScalioMailSettings.d.ts +13 -0
  24. package/dist/app-kit/ScalioMailSettings.d.ts.map +1 -0
  25. package/dist/app-kit/ScalioResultBadge.d.ts +19 -0
  26. package/dist/app-kit/ScalioResultBadge.d.ts.map +1 -0
  27. package/dist/app-kit/ScalioRoleTenants.d.ts +22 -0
  28. package/dist/app-kit/ScalioRoleTenants.d.ts.map +1 -0
  29. package/dist/app-kit/ScalioTenantSettings.d.ts +24 -0
  30. package/dist/app-kit/ScalioTenantSettings.d.ts.map +1 -0
  31. package/dist/app-kit/ScalioUtilities.d.ts +33 -0
  32. package/dist/app-kit/ScalioUtilities.d.ts.map +1 -0
  33. package/dist/app-kit/_uiReact.d.ts +368 -0
  34. package/dist/app-kit/_uiReact.d.ts.map +1 -0
  35. package/dist/app-kit/index.d.ts +15 -0
  36. package/dist/app-kit/index.d.ts.map +1 -1
  37. package/dist/app-kit/index.js +1467 -108
  38. package/dist/app-kit/index.js.map +1 -1
  39. package/dist/app-kit/index.mjs +1357 -42
  40. package/dist/app-kit/index.mjs.map +1 -1
  41. package/dist/{chunk-A7O3P4YV.mjs → chunk-WBI44QWN.mjs} +92 -1
  42. package/dist/chunk-WBI44QWN.mjs.map +1 -0
  43. package/dist/config/i18nCheck.d.ts +49 -0
  44. package/dist/config/i18nCheck.d.ts.map +1 -0
  45. package/dist/config/index.d.ts +2 -0
  46. package/dist/config/index.d.ts.map +1 -1
  47. package/dist/config/index.js +187 -4
  48. package/dist/config/index.js.map +1 -1
  49. package/dist/config/index.mjs +178 -3
  50. package/dist/config/index.mjs.map +1 -1
  51. package/dist/config/openapi.d.ts +34 -0
  52. package/dist/config/openapi.d.ts.map +1 -0
  53. package/dist/core/format.d.ts +36 -0
  54. package/dist/core/format.d.ts.map +1 -0
  55. package/dist/core/index.d.ts +1 -0
  56. package/dist/core/index.d.ts.map +1 -1
  57. package/dist/core/index.js +97 -0
  58. package/dist/core/index.js.map +1 -1
  59. package/dist/core/index.mjs +13 -1
  60. package/dist/data-table/ScalioDataTable.d.ts +12 -0
  61. package/dist/data-table/ScalioDataTable.d.ts.map +1 -0
  62. package/dist/data-table/helpers.d.ts +40 -0
  63. package/dist/data-table/helpers.d.ts.map +1 -0
  64. package/dist/data-table/index.d.ts +8 -0
  65. package/dist/data-table/index.d.ts.map +1 -0
  66. package/dist/data-table/index.js +1040 -0
  67. package/dist/data-table/index.js.map +1 -0
  68. package/dist/data-table/index.mjs +1008 -0
  69. package/dist/data-table/index.mjs.map +1 -0
  70. package/dist/data-table/labels.d.ts +5 -0
  71. package/dist/data-table/labels.d.ts.map +1 -0
  72. package/dist/data-table/types.d.ts +178 -0
  73. package/dist/data-table/types.d.ts.map +1 -0
  74. package/dist/editor/RichTextEditor.d.ts +58 -0
  75. package/dist/editor/RichTextEditor.d.ts.map +1 -0
  76. package/dist/editor/index.d.ts +5 -0
  77. package/dist/editor/index.d.ts.map +1 -0
  78. package/dist/editor/index.js +350 -0
  79. package/dist/editor/index.js.map +1 -0
  80. package/dist/editor/index.mjs +324 -0
  81. package/dist/editor/index.mjs.map +1 -0
  82. package/package.json +28 -1
  83. package/dist/chunk-A7O3P4YV.mjs.map +0 -1
@@ -30,28 +30,113 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/app-kit/index.ts
31
31
  var app_kit_exports = {};
32
32
  __export(app_kit_exports, {
33
+ ScalioAppProviders: () => ScalioAppProviders,
33
34
  ScalioAuditHeader: () => ScalioAuditHeader,
34
35
  ScalioAuditPage: () => ScalioAuditPage,
35
36
  ScalioBackupSection: () => ScalioBackupSection,
37
+ ScalioCombobox: () => ScalioCombobox,
38
+ ScalioCopyButton: () => ScalioCopyButton,
39
+ ScalioDateRangeInput: () => ScalioDateRangeInput,
40
+ ScalioDrawer: () => ScalioDrawer,
41
+ ScalioEmptyState: () => ScalioEmptyState,
42
+ ScalioErrorBoundary: () => ScalioErrorBoundary,
43
+ ScalioFactoryReset: () => ScalioFactoryReset,
44
+ ScalioFormDialog: () => ScalioFormDialog,
45
+ ScalioFormError: () => ScalioFormError,
46
+ ScalioFormField: () => ScalioFormField,
36
47
  ScalioInvitePage: () => ScalioInvitePage,
37
48
  ScalioJobsPage: () => ScalioJobsPage,
49
+ ScalioLayout: () => ScalioLayout,
50
+ ScalioLicensePanel: () => ScalioLicensePanel,
38
51
  ScalioLoginPage: () => ScalioLoginPage,
52
+ ScalioMailSettings: () => ScalioMailSettings,
39
53
  ScalioMaintenanceBanner: () => ScalioMaintenanceBanner,
54
+ ScalioMoneyInput: () => ScalioMoneyInput,
55
+ ScalioOfflineBanner: () => ScalioOfflineBanner,
40
56
  ScalioPasswordChangePage: () => ScalioPasswordChangePage,
41
57
  ScalioProfilePage: () => ScalioProfilePage,
58
+ ScalioResultBadge: () => ScalioResultBadge,
59
+ ScalioRoleTenants: () => ScalioRoleTenants,
42
60
  ScalioSaasUpdateBanner: () => ScalioSaasUpdateBanner,
43
61
  ScalioSaasUpdatesSection: () => ScalioSaasUpdatesSection,
44
62
  ScalioSecurityFactors: () => ScalioSecurityFactors,
45
63
  ScalioSelfTestPage: () => ScalioSelfTestPage,
64
+ ScalioSkeleton: () => ScalioSkeleton,
46
65
  ScalioSupportCard: () => ScalioSupportCard,
47
- ScalioUsersPage: () => ScalioUsersPage
66
+ ScalioTagInput: () => ScalioTagInput,
67
+ ScalioTenantSettings: () => ScalioTenantSettings,
68
+ ScalioUsersPage: () => ScalioUsersPage,
69
+ formatDisplayValue: () => formatDisplayValue,
70
+ formatMinorToEditable: () => formatMinorToEditable,
71
+ parseEditableToMinor: () => parseEditableToMinor
48
72
  });
49
73
  module.exports = __toCommonJS(app_kit_exports);
50
74
 
51
75
  // src/app-kit/ScalioSecurityFactors.tsx
52
- var import_react = require("react");
76
+ var import_react2 = require("react");
53
77
  var import_sonner = require("sonner");
54
- var import_react2 = require("@scalio-cloud/ui/react");
78
+
79
+ // src/app-kit/_uiReact.ts
80
+ var import_react = __toESM(require("@scalio-cloud/ui/react"));
81
+ var {
82
+ AppHeader,
83
+ AppShell,
84
+ AuditLog,
85
+ AuditNav,
86
+ AuthHeader,
87
+ AuthLayout,
88
+ AuthMessage,
89
+ BackupPanel,
90
+ FactoryReset,
91
+ JobsPanel,
92
+ LanguageChoice,
93
+ LicensePanel,
94
+ LoginPage,
95
+ MailTransport,
96
+ MaintenanceNotice,
97
+ MicrosoftConnection,
98
+ PageHeader,
99
+ PasswordChange,
100
+ PasswordPolicySelect,
101
+ ProductSwitcher,
102
+ ProfileIdentity,
103
+ ProfileSection,
104
+ RoleAdmin,
105
+ RoleSourceSettings,
106
+ SaasUpdatesPanel,
107
+ SecurityFactors,
108
+ SelfTestPanel,
109
+ SettingsLayout,
110
+ SettingsSection,
111
+ Sidebar,
112
+ SupportConnection,
113
+ SupportDrawer,
114
+ TenantConnectStep,
115
+ ThemeChoice,
116
+ ThemeProvider,
117
+ TimezoneChoice,
118
+ UpdateBanner,
119
+ UserAdmin,
120
+ accountArea,
121
+ accountGroups,
122
+ announceTenantChange,
123
+ auditApi,
124
+ backupApi,
125
+ customerAccessProps,
126
+ factoryResetApi,
127
+ jobsApi,
128
+ labelsFor,
129
+ licenseApi,
130
+ mailApi,
131
+ rolesApi,
132
+ saasUpdatesApi,
133
+ securityApi,
134
+ selftestApi,
135
+ supportApi,
136
+ usersApi
137
+ } = import_react.default;
138
+
139
+ // src/app-kit/ScalioSecurityFactors.tsx
55
140
  var import_jsx_runtime = require("react/jsx-runtime");
56
141
  var defaultNotify = (text, tone) => {
57
142
  if (tone === "error") import_sonner.toast.error(text);
@@ -70,8 +155,8 @@ function ScalioSecurityFactors({
70
155
  onMfaChange,
71
156
  className = "mt-8 pt-6 border-t border-border"
72
157
  }) {
73
- const client = (0, import_react.useMemo)(
74
- () => (0, import_react2.securityApi)(api, { startRegistration, browserSupportsWebAuthn }),
158
+ const client = (0, import_react2.useMemo)(
159
+ () => securityApi(api, { startRegistration, browserSupportsWebAuthn }),
75
160
  [api, startRegistration, browserSupportsWebAuthn]
76
161
  );
77
162
  const formatError = (e) => {
@@ -79,7 +164,7 @@ function ScalioSecurityFactors({
79
164
  return formatApiErrorDetail(err?.response?.data?.detail) || err?.message || "";
80
165
  };
81
166
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
82
- import_react2.SecurityFactors,
167
+ SecurityFactors,
83
168
  {
84
169
  client,
85
170
  lang,
@@ -97,7 +182,6 @@ function ScalioSecurityFactors({
97
182
 
98
183
  // src/app-kit/ScalioPasswordChangePage.tsx
99
184
  var import_sonner2 = require("sonner");
100
- var import_react3 = require("@scalio-cloud/ui/react");
101
185
  var import_jsx_runtime2 = require("react/jsx-runtime");
102
186
  function ScalioPasswordChangePage({
103
187
  api,
@@ -118,9 +202,9 @@ function ScalioPasswordChangePage({
118
202
  });
119
203
  return data;
120
204
  };
121
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react3.AuthLayout, { legalUrl, brand, lang, onLangChange, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-4", "data-testid": "password-change-required", children: [
205
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AuthLayout, { legalUrl, brand, lang, onLangChange, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-4", "data-testid": "password-change-required", children: [
122
206
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
123
- import_react3.AuthHeader,
207
+ AuthHeader,
124
208
  {
125
209
  eyebrow: email,
126
210
  title: t("Choose your password"),
@@ -128,7 +212,7 @@ function ScalioPasswordChangePage({
128
212
  }
129
213
  ),
130
214
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
131
- import_react3.PasswordChange,
215
+ PasswordChange,
132
216
  {
133
217
  onSubmit: change,
134
218
  minLength,
@@ -153,16 +237,15 @@ function ScalioPasswordChangePage({
153
237
  }
154
238
 
155
239
  // src/app-kit/ScalioProfilePage.tsx
156
- var import_react6 = require("react");
240
+ var import_react5 = require("react");
157
241
  var import_sonner3 = require("sonner");
158
242
  var import_lucide_react = require("lucide-react");
159
- var import_react7 = require("@scalio-cloud/ui/react");
160
243
 
161
244
  // src/core/api.ts
162
245
  var import_axios = __toESM(require("axios"));
163
246
 
164
247
  // src/core/i18n.tsx
165
- var import_react4 = __toESM(require("react"));
248
+ var import_react3 = __toESM(require("react"));
166
249
  function N_(text) {
167
250
  return text;
168
251
  }
@@ -182,7 +265,7 @@ function mailReady(settings) {
182
265
  }
183
266
 
184
267
  // src/core/legal.ts
185
- var import_react5 = require("react");
268
+ var import_react4 = require("react");
186
269
 
187
270
  // src/app-kit/ScalioProfilePage.tsx
188
271
  var import_jsx_runtime3 = require("react/jsx-runtime");
@@ -210,11 +293,11 @@ function ScalioProfilePage({
210
293
  minPasswordLength = 12,
211
294
  securityFactors
212
295
  }) {
213
- const L = (0, import_react7.labelsFor)(lang);
296
+ const L = labelsFor(lang);
214
297
  const P = L.profile_;
215
- const [name, setName] = (0, import_react6.useState)(user?.name || "");
216
- const [savingName, setSavingName] = (0, import_react6.useState)(false);
217
- const [ssoOn, setSsoOn] = (0, import_react6.useState)(false);
298
+ const [name, setName] = (0, import_react5.useState)(user?.name || "");
299
+ const [savingName, setSavingName] = (0, import_react5.useState)(false);
300
+ const [ssoOn, setSsoOn] = (0, import_react5.useState)(false);
218
301
  const saved = () => {
219
302
  import_sonner3.toast.success(P.saved);
220
303
  };
@@ -230,7 +313,7 @@ function ScalioProfilePage({
230
313
  };
231
314
  const resolvedRoles = roleLabels ?? defaultRoles;
232
315
  const roleName = user?.role && resolvedRoles[user.role] || t("Reader");
233
- (0, import_react6.useEffect)(() => {
316
+ (0, import_react5.useEffect)(() => {
234
317
  api.get("/auth/scalio/status").then((r) => setSsoOn(Boolean(r.data?.enabled))).catch(() => setSsoOn(false));
235
318
  if (typeof window === "undefined") return;
236
319
  const result = new URLSearchParams(window.location.search).get("microsoft");
@@ -304,7 +387,7 @@ function ScalioProfilePage({
304
387
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "text-sm text-muted-foreground", children: P.subtitle })
305
388
  ] }),
306
389
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
307
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react7.ProfileSection, { id: "account", lang, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react7.ProfileIdentity, { name: user?.name, email: user?.email, role: roleName, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("form", { onSubmit: saveName, className: "flex flex-col sm:flex-row sm:items-end gap-3", children: [
390
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ProfileSection, { id: "account", lang, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ProfileIdentity, { name: user?.name, email: user?.email, role: roleName, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("form", { onSubmit: saveName, className: "flex flex-col sm:flex-row sm:items-end gap-3", children: [
308
391
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex-1", children: [
309
392
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("label", { className: LABEL_CLASS, htmlFor: "profile-name", children: t("Name") }),
310
393
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -335,8 +418,8 @@ function ScalioProfilePage({
335
418
  }
336
419
  )
337
420
  ] }) }) }),
338
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react7.ProfileSection, { id: "appearance", lang, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
339
- import_react7.ThemeChoice,
421
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ProfileSection, { id: "appearance", lang, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
422
+ ThemeChoice,
340
423
  {
341
424
  theme,
342
425
  onChange: (m) => {
@@ -346,13 +429,13 @@ function ScalioProfilePage({
346
429
  lang
347
430
  }
348
431
  ) }),
349
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react7.ProfileSection, { id: "language", lang, children: [
350
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react7.LanguageChoice, { lang, onChange: chooseLang }),
351
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react7.TimezoneChoice, { value: user?.timezone || "", onChange: chooseTz, lang })
432
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(ProfileSection, { id: "language", lang, children: [
433
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(LanguageChoice, { lang, onChange: chooseLang }),
434
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TimezoneChoice, { value: user?.timezone || "", onChange: chooseTz, lang })
352
435
  ] }),
353
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react7.ProfileSection, { id: "security", lang, testId: "change-password-section", children: [
436
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(ProfileSection, { id: "security", lang, testId: "change-password-section", children: [
354
437
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
355
- import_react7.PasswordChange,
438
+ PasswordChange,
356
439
  {
357
440
  onSubmit: changePassword,
358
441
  onDone: () => import_sonner3.toast.success(t("Password changed. Other devices have been signed out.")),
@@ -362,8 +445,8 @@ function ScalioProfilePage({
362
445
  ),
363
446
  securityFactors
364
447
  ] }),
365
- (ssoOn || user?.microsoft) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react7.ProfileSection, { id: "connections", lang, testId: "connections-section", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
366
- import_react7.MicrosoftConnection,
448
+ (ssoOn || user?.microsoft) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ProfileSection, { id: "connections", lang, testId: "connections-section", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
449
+ MicrosoftConnection,
367
450
  {
368
451
  linked: Boolean(user?.microsoft),
369
452
  canUnlink: Boolean(user?.has_password),
@@ -377,10 +460,9 @@ function ScalioProfilePage({
377
460
  }
378
461
 
379
462
  // src/app-kit/ScalioUsersPage.tsx
380
- var import_react8 = require("react");
463
+ var import_react6 = require("react");
381
464
  var import_react_router_dom = require("react-router-dom");
382
465
  var import_sonner4 = require("sonner");
383
- var import_react9 = require("@scalio-cloud/ui/react");
384
466
  var import_jsx_runtime4 = require("react/jsx-runtime");
385
467
  function roleLabel(name, lang) {
386
468
  if (name && typeof name === "object") {
@@ -400,25 +482,25 @@ function ScalioUsersPage({
400
482
  emptyCustomersHint,
401
483
  renderEntraTab
402
484
  }) {
403
- const L = (0, import_react9.labelsFor)(lang);
485
+ const L = labelsFor(lang);
404
486
  const [params] = (0, import_react_router_dom.useSearchParams)();
405
487
  const { area } = (0, import_react_router_dom.useParams)();
406
488
  const navigate = (0, import_react_router_dom.useNavigate)();
407
- const usersClient = (0, import_react8.useMemo)(() => (0, import_react9.usersApi)(api), [api]);
408
- const rolesClient = (0, import_react8.useMemo)(() => (0, import_react9.rolesApi)(api), [api]);
409
- const [rows, setRows] = (0, import_react8.useState)([]);
410
- const [ssoOn, setSsoOn] = (0, import_react8.useState)(false);
411
- const [mailOn, setMailOn] = (0, import_react8.useState)(false);
412
- const [roles, setRoles] = (0, import_react8.useState)([]);
413
- const [policy, setPolicy] = (0, import_react8.useState)(null);
414
- const load = (0, import_react8.useCallback)(() => {
489
+ const usersClient = (0, import_react6.useMemo)(() => usersApi(api), [api]);
490
+ const rolesClient = (0, import_react6.useMemo)(() => rolesApi(api), [api]);
491
+ const [rows, setRows] = (0, import_react6.useState)([]);
492
+ const [ssoOn, setSsoOn] = (0, import_react6.useState)(false);
493
+ const [mailOn, setMailOn] = (0, import_react6.useState)(false);
494
+ const [roles, setRoles] = (0, import_react6.useState)([]);
495
+ const [policy, setPolicy] = (0, import_react6.useState)(null);
496
+ const load = (0, import_react6.useCallback)(() => {
415
497
  api.get("/users").then((r) => setRows(r.data)).catch(() => setRows([]));
416
498
  rolesClient.list().then(setRoles).catch(() => setRoles([]));
417
499
  api.get("/users/login-policy").then((r) => setPolicy(r.data)).catch(() => setPolicy(null));
418
500
  api.get("/auth/scalio/status").then((r) => setSsoOn(Boolean(r.data?.enabled))).catch(() => setSsoOn(false));
419
501
  api.get("/mail/settings").then((r) => setMailOn(mailReady(r.data))).catch(() => setMailOn(false));
420
502
  }, [api, rolesClient]);
421
- (0, import_react8.useEffect)(() => {
503
+ (0, import_react6.useEffect)(() => {
422
504
  load();
423
505
  }, [load]);
424
506
  const fail = (e) => {
@@ -453,7 +535,7 @@ function ScalioUsersPage({
453
535
  const emergencyCount = rows.filter(
454
536
  (u) => u.emergency_admin && u.role === "admin" && u.has_password && !u.access_pending
455
537
  ).length;
456
- const active = (0, import_react9.accountArea)(area);
538
+ const active = accountArea(area);
457
539
  if (!area) {
458
540
  const old = params.get("tab");
459
541
  const target = old === "signIn" ? "sign-in" : old && ["roles", "entra"].includes(old) ? old : "users";
@@ -467,7 +549,7 @@ function ScalioUsersPage({
467
549
  const err = e;
468
550
  return err?.response?.data?.detail ? formatApiErrorDetail(err.response.data.detail) : t("The action failed.");
469
551
  };
470
- const groups = (0, import_react9.accountGroups)({ lang }).map(
552
+ const groups = accountGroups({ lang }).map(
471
553
  (g) => ({
472
554
  ...g,
473
555
  items: g.items.map(
@@ -479,13 +561,13 @@ function ScalioUsersPage({
479
561
  )
480
562
  })
481
563
  );
482
- const extraCustomerProps = customers ? (0, import_react9.customerAccessProps)({
564
+ const extraCustomerProps = customers ? customerAccessProps({
483
565
  customers,
484
566
  lang,
485
567
  emptyHint: emptyCustomersHint ?? t("No customers yet. Add them under Settings, Tenants.")
486
568
  }) : {};
487
569
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { "data-testid": "users-page", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
488
- import_react9.SettingsLayout,
570
+ SettingsLayout,
489
571
  {
490
572
  groups,
491
573
  active,
@@ -498,7 +580,7 @@ function ScalioUsersPage({
498
580
  testId: "accounts-layout",
499
581
  children: [
500
582
  active === "users" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
501
- import_react9.UserAdmin,
583
+ UserAdmin,
502
584
  {
503
585
  client: usersClient,
504
586
  me: user.id,
@@ -516,7 +598,7 @@ function ScalioUsersPage({
516
598
  }
517
599
  ),
518
600
  active === "roles" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
519
- import_react9.RoleAdmin,
601
+ RoleAdmin,
520
602
  {
521
603
  client: rolesClient,
522
604
  lang,
@@ -529,7 +611,7 @@ function ScalioUsersPage({
529
611
  ),
530
612
  active === "entra" && renderEntraTab?.(load),
531
613
  active === "signIn" && policy && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { "data-testid": "login-policy-card", className: "bg-card border border-border rounded-sm px-4 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
532
- import_react9.PasswordPolicySelect,
614
+ PasswordPolicySelect,
533
615
  {
534
616
  value: policy.value,
535
617
  emergencyCount,
@@ -545,9 +627,8 @@ function ScalioUsersPage({
545
627
  }
546
628
 
547
629
  // src/app-kit/ScalioLoginPage.tsx
548
- var import_react10 = require("react");
630
+ var import_react7 = require("react");
549
631
  var import_react_router_dom2 = require("react-router-dom");
550
- var import_react11 = require("@scalio-cloud/ui/react");
551
632
  var import_jsx_runtime5 = require("react/jsx-runtime");
552
633
  function ScalioLoginPage({
553
634
  api,
@@ -564,7 +645,7 @@ function ScalioLoginPage({
564
645
  onSignedIn
565
646
  }) {
566
647
  const navigate = (0, import_react_router_dom2.useNavigate)();
567
- (0, import_react10.useEffect)(() => {
648
+ (0, import_react7.useEffect)(() => {
568
649
  if (clearSessionKeys.length === 0) return;
569
650
  try {
570
651
  for (const key of clearSessionKeys) {
@@ -573,12 +654,12 @@ function ScalioLoginPage({
573
654
  } catch {
574
655
  }
575
656
  }, [clearSessionKeys]);
576
- const handleSignedIn = (0, import_react10.useCallback)(() => {
657
+ const handleSignedIn = (0, import_react7.useCallback)(() => {
577
658
  if (onSignedIn) onSignedIn();
578
659
  else navigate(afterLoginTo, { replace: true });
579
660
  }, [onSignedIn, navigate, afterLoginTo]);
580
661
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
581
- import_react11.LoginPage,
662
+ LoginPage,
582
663
  {
583
664
  api,
584
665
  apiBase,
@@ -595,10 +676,9 @@ function ScalioLoginPage({
595
676
  }
596
677
 
597
678
  // src/app-kit/ScalioInvitePage.tsx
598
- var import_react12 = require("react");
679
+ var import_react8 = require("react");
599
680
  var import_react_router_dom3 = require("react-router-dom");
600
681
  var import_lucide_react2 = require("lucide-react");
601
- var import_react13 = require("@scalio-cloud/ui/react");
602
682
  var import_jsx_runtime6 = require("react/jsx-runtime");
603
683
  var FIELD_CLASS2 = "mt-1 w-full h-11 px-3 bg-background border border-input rounded-sm text-sm focus:outline-none focus:ring-1 focus:ring-ring";
604
684
  var LABEL_CLASS2 = "text-[11px] font-bold uppercase tracking-widest text-muted-foreground";
@@ -615,14 +695,14 @@ function ScalioInvitePage({
615
695
  redirectTo = "/"
616
696
  }) {
617
697
  const navigate = (0, import_react_router_dom3.useNavigate)();
618
- const [token] = (0, import_react12.useState)(() => typeof window !== "undefined" ? window.location.hash.replace(/^#/, "") : "");
619
- const [info, setInfo] = (0, import_react12.useState)(null);
620
- const [invalid, setInvalid] = (0, import_react12.useState)(false);
621
- const [pw, setPw] = (0, import_react12.useState)("");
622
- const [pw2, setPw2] = (0, import_react12.useState)("");
623
- const [error, setError] = (0, import_react12.useState)("");
624
- const [busy, setBusy] = (0, import_react12.useState)(false);
625
- (0, import_react12.useEffect)(() => {
698
+ const [token] = (0, import_react8.useState)(() => typeof window !== "undefined" ? window.location.hash.replace(/^#/, "") : "");
699
+ const [info, setInfo] = (0, import_react8.useState)(null);
700
+ const [invalid, setInvalid] = (0, import_react8.useState)(false);
701
+ const [pw, setPw] = (0, import_react8.useState)("");
702
+ const [pw2, setPw2] = (0, import_react8.useState)("");
703
+ const [error, setError] = (0, import_react8.useState)("");
704
+ const [busy, setBusy] = (0, import_react8.useState)(false);
705
+ (0, import_react8.useEffect)(() => {
626
706
  if (!token) {
627
707
  setInvalid(true);
628
708
  return;
@@ -651,16 +731,16 @@ function ScalioInvitePage({
651
731
  setBusy(false);
652
732
  }
653
733
  };
654
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react13.AuthLayout, { legalUrl, brand, lang, onLangChange, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-4", "data-testid": "invite-page", children: [
734
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AuthLayout, { legalUrl, brand, lang, onLangChange, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-4", "data-testid": "invite-page", children: [
655
735
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
656
- import_react13.AuthHeader,
736
+ AuthHeader,
657
737
  {
658
738
  eyebrow: info?.email,
659
739
  title: welcomeTitle,
660
740
  subtitle: t("Choose your password to finish the invitation.")
661
741
  }
662
742
  ),
663
- invalid && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react13.AuthMessage, { kind: "error", testId: "invite-invalid", children: t("This invitation is no longer valid. Ask an administrator for a new one.") }),
743
+ invalid && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AuthMessage, { kind: "error", testId: "invite-invalid", children: t("This invitation is no longer valid. Ask an administrator for a new one.") }),
664
744
  !invalid && !info && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Loader2, { className: "w-5 h-5 animate-spin text-primary" }),
665
745
  info && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("form", { onSubmit: submit, className: "space-y-3", children: [
666
746
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "block", children: [
@@ -691,7 +771,7 @@ function ScalioInvitePage({
691
771
  }
692
772
  )
693
773
  ] }),
694
- error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react13.AuthMessage, { kind: "error", testId: "invite-error", children: error }),
774
+ error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AuthMessage, { kind: "error", testId: "invite-error", children: error }),
695
775
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
696
776
  "button",
697
777
  {
@@ -710,20 +790,19 @@ function ScalioInvitePage({
710
790
  }
711
791
 
712
792
  // src/app-kit/ScalioAuditPages.tsx
713
- var import_react14 = require("react");
793
+ var import_react9 = require("react");
714
794
  var import_react_router_dom4 = require("react-router-dom");
715
795
  var import_sonner5 = require("sonner");
716
- var import_react15 = require("@scalio-cloud/ui/react");
717
796
  var import_jsx_runtime7 = require("react/jsx-runtime");
718
797
  var defaultNotify2 = (text, tone) => {
719
798
  if (tone === "error") import_sonner5.toast.error(text);
720
799
  else import_sonner5.toast.success(text);
721
800
  };
722
801
  function ScalioAuditHeader({ lang, t }) {
723
- const L = (0, import_react15.labelsFor)(lang);
802
+ const L = labelsFor(lang);
724
803
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-3", children: [
725
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react15.PageHeader, { title: L.auditLog, subtitle: t("Who changed what, and the background jobs of this installation") }),
726
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react15.AuditNav, { link: import_react_router_dom4.NavLink, lang })
804
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PageHeader, { title: L.auditLog, subtitle: t("Who changed what, and the background jobs of this installation") }),
805
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AuditNav, { link: import_react_router_dom4.NavLink, lang })
727
806
  ] });
728
807
  }
729
808
  function ScalioAuditPage({
@@ -734,20 +813,20 @@ function ScalioAuditPage({
734
813
  actionLabel,
735
814
  storageKey
736
815
  }) {
737
- const client = (0, import_react14.useMemo)(() => (0, import_react15.auditApi)(api), [api]);
816
+ const client = (0, import_react9.useMemo)(() => auditApi(api), [api]);
738
817
  if (!can(user, "audit.view")) return null;
739
818
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { "data-testid": "audit-page", className: "space-y-5", children: [
740
819
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ScalioAuditHeader, { lang, t }),
741
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react15.AuditLog, { client, lang, notify: defaultNotify2, actionLabel, storageKey })
820
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AuditLog, { client, lang, notify: defaultNotify2, actionLabel, storageKey })
742
821
  ] });
743
822
  }
744
823
  function ScalioJobsPage({ api, user, lang, t, confirm }) {
745
- const client = (0, import_react14.useMemo)(() => (0, import_react15.jobsApi)(api), [api]);
824
+ const client = (0, import_react9.useMemo)(() => jobsApi(api), [api]);
746
825
  if (!can(user, "audit.view")) return null;
747
826
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { "data-testid": "jobs-page", className: "space-y-5", children: [
748
827
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ScalioAuditHeader, { lang, t }),
749
828
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
750
- import_react15.JobsPanel,
829
+ JobsPanel,
751
830
  {
752
831
  client,
753
832
  lang,
@@ -761,23 +840,22 @@ function ScalioJobsPage({ api, user, lang, t, confirm }) {
761
840
  }
762
841
 
763
842
  // src/app-kit/ScalioSelfTestPage.tsx
764
- var import_react16 = require("react");
843
+ var import_react10 = require("react");
765
844
  var import_react_router_dom5 = require("react-router-dom");
766
845
  var import_sonner6 = require("sonner");
767
- var import_react17 = require("@scalio-cloud/ui/react");
768
846
  var import_jsx_runtime8 = require("react/jsx-runtime");
769
847
  function ScalioSelfTestPage({ api, user, lang, t }) {
770
- const [on, setOn] = (0, import_react16.useState)(null);
771
- const client = (0, import_react16.useMemo)(() => (0, import_react17.selftestApi)(api), [api]);
772
- (0, import_react16.useEffect)(() => {
848
+ const [on, setOn] = (0, import_react10.useState)(null);
849
+ const client = (0, import_react10.useMemo)(() => selftestApi(api), [api]);
850
+ (0, import_react10.useEffect)(() => {
773
851
  api.get("/e2e/status").then((r) => setOn(Boolean(r.data?.enabled))).catch(() => setOn(false));
774
852
  }, [api]);
775
853
  if (user?.role !== "admin" || on === false) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_router_dom5.Navigate, { to: "/", replace: true });
776
854
  if (on === null) return null;
777
855
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { "data-testid": "selftest-page", className: "space-y-5", children: [
778
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react17.PageHeader, { eyebrow: t("Tests"), title: t("E2E self-check"), subtitle: t("Self-check of this test instance") }),
856
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PageHeader, { eyebrow: t("Tests"), title: t("E2E self-check"), subtitle: t("Self-check of this test instance") }),
779
857
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
780
- import_react17.SelfTestPanel,
858
+ SelfTestPanel,
781
859
  {
782
860
  client,
783
861
  lang,
@@ -788,10 +866,9 @@ function ScalioSelfTestPage({ api, user, lang, t }) {
788
866
  }
789
867
 
790
868
  // src/app-kit/ScalioBackupSection.tsx
791
- var import_react18 = require("react");
869
+ var import_react11 = require("react");
792
870
  var import_react_router_dom6 = require("react-router-dom");
793
871
  var import_sonner7 = require("sonner");
794
- var import_react19 = require("@scalio-cloud/ui/react");
795
872
  var import_jsx_runtime9 = require("react/jsx-runtime");
796
873
  var notify = (text, tone) => {
797
874
  if (tone === "error") import_sonner7.toast.error(text);
@@ -806,20 +883,20 @@ function ScalioBackupSection({
806
883
  description,
807
884
  accountTo = "/profile"
808
885
  }) {
809
- const client = (0, import_react18.useMemo)(() => (0, import_react19.backupApi)(api), [api]);
810
- const labels = (0, import_react18.useMemo)(
886
+ const client = (0, import_react11.useMemo)(() => backupApi(api), [api]);
887
+ const labels = (0, import_react11.useMemo)(
811
888
  () => withDataOnLabel ? { backup: { withDataOn: withDataOnLabel } } : void 0,
812
889
  [withDataOnLabel]
813
890
  );
814
891
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
815
- import_react19.SettingsSection,
892
+ SettingsSection,
816
893
  {
817
894
  id: "backup",
818
895
  title: t("Backup"),
819
896
  testId: "backup-card",
820
897
  description: description ?? t("Encrypted export and import, e.g. to move to another instance. After a move the tenants are connected again."),
821
898
  children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
822
- import_react19.BackupPanel,
899
+ BackupPanel,
823
900
  {
824
901
  client,
825
902
  lang,
@@ -834,24 +911,23 @@ function ScalioBackupSection({
834
911
  );
835
912
  }
836
913
  function ScalioMaintenanceBanner({ api, lang }) {
837
- const client = (0, import_react18.useMemo)(() => (0, import_react19.backupApi)(api), [api]);
838
- const [on, setOn] = (0, import_react18.useState)(false);
839
- (0, import_react18.useEffect)(() => {
914
+ const client = (0, import_react11.useMemo)(() => backupApi(api), [api]);
915
+ const [on, setOn] = (0, import_react11.useState)(false);
916
+ (0, import_react11.useEffect)(() => {
840
917
  const show = () => setOn(true);
841
918
  window.addEventListener("scalio-maintenance", show);
842
919
  return () => window.removeEventListener("scalio-maintenance", show);
843
920
  }, []);
844
- return on ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react19.MaintenanceNotice, { client, lang }) : null;
921
+ return on ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MaintenanceNotice, { client, lang }) : null;
845
922
  }
846
923
 
847
924
  // src/app-kit/ScalioSaasUpdatesSection.tsx
848
- var import_react20 = require("react");
925
+ var import_react12 = require("react");
849
926
  var import_sonner8 = require("sonner");
850
- var import_react21 = require("@scalio-cloud/ui/react");
851
927
  var import_jsx_runtime10 = require("react/jsx-runtime");
852
928
  function ScalioSaasUpdateBanner({ api, lang, onOpen }) {
853
- const client = (0, import_react20.useMemo)(() => (0, import_react21.saasUpdatesApi)(api), [api]);
854
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react21.UpdateBanner, { client, lang, onOpen });
929
+ const client = (0, import_react12.useMemo)(() => saasUpdatesApi(api), [api]);
930
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(UpdateBanner, { client, lang, onOpen });
855
931
  }
856
932
  function ScalioSaasUpdatesSection({
857
933
  api,
@@ -859,13 +935,13 @@ function ScalioSaasUpdatesSection({
859
935
  t,
860
936
  admin = true
861
937
  }) {
862
- const client = (0, import_react20.useMemo)(() => (0, import_react21.saasUpdatesApi)(api), [api]);
863
- const notify2 = (0, import_react20.useMemo)(
938
+ const client = (0, import_react12.useMemo)(() => saasUpdatesApi(api), [api]);
939
+ const notify2 = (0, import_react12.useMemo)(
864
940
  () => (msg, tone) => tone === "error" ? import_sonner8.toast.error(msg) : import_sonner8.toast.success(msg),
865
941
  []
866
942
  );
867
- const [prerelease, setPrerelease] = (0, import_react20.useState)(false);
868
- (0, import_react20.useEffect)(() => {
943
+ const [prerelease, setPrerelease] = (0, import_react12.useState)(false);
944
+ (0, import_react12.useEffect)(() => {
869
945
  let alive = true;
870
946
  client.state().then((d) => {
871
947
  if (alive) setPrerelease(Boolean(d?.prerelease?.opt_in));
@@ -881,14 +957,14 @@ function ScalioSaasUpdatesSection({
881
957
  setPrerelease(d?.prerelease ? Boolean(d.prerelease.opt_in) : Boolean(on));
882
958
  };
883
959
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
884
- import_react21.SettingsSection,
960
+ SettingsSection,
885
961
  {
886
962
  id: "updates",
887
963
  title: t("Updates"),
888
964
  description: t("New versions from Scalio, your maintenance window and the deadline"),
889
965
  testId: "saas-updates-card",
890
966
  children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
891
- import_react21.SaasUpdatesPanel,
967
+ SaasUpdatesPanel,
892
968
  {
893
969
  client,
894
970
  lang,
@@ -903,29 +979,1312 @@ function ScalioSaasUpdatesSection({
903
979
  }
904
980
 
905
981
  // src/app-kit/ScalioSupportCard.tsx
906
- var import_react22 = require("react");
907
- var import_react23 = require("@scalio-cloud/ui/react");
982
+ var import_react13 = require("react");
908
983
  var import_jsx_runtime11 = require("react/jsx-runtime");
909
984
  function ScalioSupportCard({ api, lang, t }) {
910
- const client = (0, import_react22.useMemo)(() => (0, import_react23.supportApi)(api), [api]);
911
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react23.SettingsSection, { id: "support", title: t("Support connection"), testId: "support-connection-card", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react23.SupportConnection, { client, lang }) });
985
+ const client = (0, import_react13.useMemo)(() => supportApi(api), [api]);
986
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SettingsSection, { id: "support", title: t("Support connection"), testId: "support-connection-card", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SupportConnection, { client, lang }) });
987
+ }
988
+
989
+ // src/app-kit/ScalioMailSettings.tsx
990
+ var import_react14 = require("react");
991
+ var import_sonner9 = require("sonner");
992
+ var import_jsx_runtime12 = require("react/jsx-runtime");
993
+ var defaultNotify3 = (text, tone) => {
994
+ if (tone === "error") import_sonner9.toast.error(text);
995
+ else import_sonner9.toast.success(text);
996
+ };
997
+ function ScalioMailSettings({
998
+ api,
999
+ lang,
1000
+ formatApiErrorDetail
1001
+ }) {
1002
+ const client = (0, import_react14.useMemo)(() => mailApi(api), [api]);
1003
+ const formatError = (e) => {
1004
+ const err = e;
1005
+ return formatApiErrorDetail(err?.response?.data?.detail) || err?.message || "";
1006
+ };
1007
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MailTransport, { client, lang, notify: defaultNotify3, formatError });
1008
+ }
1009
+
1010
+ // src/app-kit/ScalioLicensePanel.tsx
1011
+ var import_react15 = require("react");
1012
+ var import_sonner10 = require("sonner");
1013
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1014
+ var defaultNotify4 = (text, tone) => {
1015
+ if (tone === "error") import_sonner10.toast.error(text);
1016
+ else import_sonner10.toast.success(text);
1017
+ };
1018
+ function ScalioLicensePanel({
1019
+ api,
1020
+ product,
1021
+ lang,
1022
+ kindLabel,
1023
+ featureLabel,
1024
+ confirm,
1025
+ formatApiErrorDetail,
1026
+ noFeatures
1027
+ }) {
1028
+ const client = (0, import_react15.useMemo)(() => licenseApi(api), [api]);
1029
+ const formatError = (e) => {
1030
+ const err = e;
1031
+ return formatApiErrorDetail(err?.response?.data?.detail) || err?.message || "";
1032
+ };
1033
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1034
+ LicensePanel,
1035
+ {
1036
+ client,
1037
+ lang,
1038
+ product,
1039
+ kindLabel,
1040
+ featureLabel,
1041
+ noFeatures,
1042
+ notify: defaultNotify4,
1043
+ confirm,
1044
+ formatError
1045
+ }
1046
+ );
1047
+ }
1048
+
1049
+ // src/app-kit/ScalioFactoryReset.tsx
1050
+ var import_react16 = require("react");
1051
+ var import_react_router_dom7 = require("react-router-dom");
1052
+ var import_sonner11 = require("sonner");
1053
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1054
+ var defaultNotify5 = (text, tone) => {
1055
+ if (tone === "error") import_sonner11.toast.error(text);
1056
+ else import_sonner11.toast.success(text);
1057
+ };
1058
+ function ScalioFactoryReset({
1059
+ api,
1060
+ lang,
1061
+ formatApiErrorDetail,
1062
+ accountTo = "/profile",
1063
+ backupTo = "/settings/backup"
1064
+ }) {
1065
+ const client = (0, import_react16.useMemo)(() => factoryResetApi(api), [api]);
1066
+ const formatError = (e) => {
1067
+ const err = e;
1068
+ return formatApiErrorDetail(err?.response?.data?.detail) || err?.message || "";
1069
+ };
1070
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1071
+ FactoryReset,
1072
+ {
1073
+ client,
1074
+ lang,
1075
+ accountTo,
1076
+ backupTo,
1077
+ link: import_react_router_dom7.Link,
1078
+ notify: defaultNotify5,
1079
+ formatError
1080
+ }
1081
+ );
1082
+ }
1083
+
1084
+ // src/app-kit/ScalioRoleTenants.tsx
1085
+ var import_react17 = require("react");
1086
+ var import_sonner12 = require("sonner");
1087
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1088
+ var defaultNotify6 = (text, tone) => {
1089
+ if (tone === "error") import_sonner12.toast.error(text);
1090
+ else import_sonner12.toast.success(text);
1091
+ };
1092
+ function ScalioRoleTenants({
1093
+ api,
1094
+ apiBaseUrl,
1095
+ lang,
1096
+ t,
1097
+ confirm,
1098
+ formatApiErrorDetail,
1099
+ onChange
1100
+ }) {
1101
+ const [source, setSource] = (0, import_react17.useState)(null);
1102
+ const [ssoOn, setSsoOn] = (0, import_react17.useState)(false);
1103
+ const load = (0, import_react17.useCallback)(() => {
1104
+ api.get("/users/role-source").then((r) => setSource(r.data)).catch(() => setSource(null));
1105
+ api.get("/auth/scalio/status").then((r) => setSsoOn(Boolean(r.data?.enabled))).catch(() => setSsoOn(false));
1106
+ }, [api]);
1107
+ (0, import_react17.useEffect)(() => {
1108
+ load();
1109
+ }, [load]);
1110
+ if (!source) return null;
1111
+ const save = async ({ source: value, tenants }) => {
1112
+ await api.put("/users/role-source", { source: value, tenants });
1113
+ load();
1114
+ onChange?.();
1115
+ };
1116
+ const formatError = (e) => {
1117
+ const err = e;
1118
+ return err?.response?.data?.detail ? formatApiErrorDetail(err.response.data.detail) : t("The action failed.");
1119
+ };
1120
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "bg-card border border-border rounded-sm px-4 py-3", "data-testid": "role-tenants", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1121
+ RoleSourceSettings,
1122
+ {
1123
+ lang,
1124
+ tenants: true,
1125
+ confirm,
1126
+ onSave: save,
1127
+ consentUrl: ssoOn ? `${apiBaseUrl}/auth/scalio/consent` : void 0,
1128
+ value: { source: source.source, values: source.values, tenants: source.tenants },
1129
+ notify: defaultNotify6,
1130
+ formatError
1131
+ }
1132
+ ) });
1133
+ }
1134
+
1135
+ // src/app-kit/ScalioResultBadge.tsx
1136
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1137
+ var STATUS_MAP = {
1138
+ ok: {
1139
+ en: "fulfilled",
1140
+ de: "erf\xFCllt",
1141
+ cls: "bg-[#34C759]/10 text-[#1f7a3d] dark:text-emerald-400 border-[#34C759]/40"
1142
+ },
1143
+ success: {
1144
+ en: "ok",
1145
+ de: "ok",
1146
+ cls: "bg-[#34C759]/10 text-[#1f7a3d] dark:text-emerald-400 border-[#34C759]/40"
1147
+ },
1148
+ drift: {
1149
+ en: "deviation",
1150
+ de: "Abweichung",
1151
+ cls: "bg-[#FF3B30]/10 text-[#FF3B30] border-[#FF3B30]/30"
1152
+ },
1153
+ missing: {
1154
+ en: "missing",
1155
+ de: "fehlt",
1156
+ cls: "bg-[#FF3B30]/10 text-[#FF3B30] border-[#FF3B30]/30"
1157
+ },
1158
+ error: {
1159
+ en: "error",
1160
+ de: "Fehler",
1161
+ cls: "bg-[#FF3B30]/10 text-[#FF3B30] border-[#FF3B30]/30"
1162
+ },
1163
+ excepted: {
1164
+ en: "exception",
1165
+ de: "Ausnahme",
1166
+ cls: "bg-[#FFCC00]/15 text-[#8a6d00] dark:text-yellow-300 border-[#FFCC00]/50"
1167
+ },
1168
+ warning: {
1169
+ en: "warning",
1170
+ de: "Warnung",
1171
+ cls: "bg-[#FFCC00]/15 text-[#8a6d00] dark:text-yellow-300 border-[#FFCC00]/50"
1172
+ },
1173
+ info: {
1174
+ en: "info",
1175
+ de: "Info",
1176
+ cls: "bg-primary/10 text-primary border-primary/30"
1177
+ },
1178
+ removed: {
1179
+ en: "removed",
1180
+ de: "entfernt",
1181
+ cls: "bg-secondary text-muted-foreground border-border"
1182
+ },
1183
+ incomplete: {
1184
+ en: "value missing",
1185
+ de: "Wert fehlt",
1186
+ cls: "bg-secondary text-muted-foreground border-border"
1187
+ },
1188
+ not_read: {
1189
+ en: "not read",
1190
+ de: "nicht gelesen",
1191
+ cls: "bg-secondary text-muted-foreground border-border"
1192
+ },
1193
+ neutral: {
1194
+ en: "neutral",
1195
+ de: "neutral",
1196
+ cls: "bg-secondary text-muted-foreground border-border"
1197
+ }
1198
+ };
1199
+ function ScalioResultBadge({
1200
+ status,
1201
+ lang = "en",
1202
+ label,
1203
+ className = "",
1204
+ testId
1205
+ }) {
1206
+ const spec = STATUS_MAP[status] ?? STATUS_MAP.not_read;
1207
+ const text = label ?? (lang === "de" ? spec.de : spec.en);
1208
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1209
+ "span",
1210
+ {
1211
+ "data-testid": testId,
1212
+ className: `inline-flex items-center rounded-sm border px-2 py-0.5 text-xs font-semibold font-mono ${spec.cls} ${className}`.trim(),
1213
+ children: text
1214
+ }
1215
+ );
1216
+ }
1217
+ function formatDisplayValue(value) {
1218
+ if (value === void 0 || value === null) return "\u2014";
1219
+ return typeof value === "string" ? value : JSON.stringify(value);
1220
+ }
1221
+
1222
+ // src/app-kit/ScalioTenantSettings.tsx
1223
+ var import_react18 = require("react");
1224
+ var import_sonner13 = require("sonner");
1225
+ var import_lucide_react3 = require("lucide-react");
1226
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1227
+ function ScalioTenantSettings({
1228
+ api,
1229
+ appName,
1230
+ lang,
1231
+ t,
1232
+ confirm,
1233
+ formatApiErrorDetail,
1234
+ description,
1235
+ removeConfirmText,
1236
+ endpointPrefix = "/tenant/connection"
1237
+ }) {
1238
+ const [connected, setConnected] = (0, import_react18.useState)(false);
1239
+ const [resetKey, setResetKey] = (0, import_react18.useState)(0);
1240
+ const client = (0, import_react18.useMemo)(
1241
+ () => ({
1242
+ status: () => api.get(endpointPrefix).then((r) => {
1243
+ setConnected(Boolean(r.data?.connected));
1244
+ return r.data;
1245
+ }),
1246
+ link: () => api.post(`${endpointPrefix}/link`).then((r) => r.data),
1247
+ script: () => api.post(`${endpointPrefix}/script`).then((r) => r.data),
1248
+ redeem: (code) => api.post(`${endpointPrefix}/code`, { code }).then((r) => r.data),
1249
+ check: () => api.post(`${endpointPrefix}/check`).then((r) => r.data)
1250
+ }),
1251
+ [api, endpointPrefix]
1252
+ );
1253
+ const remove = async () => {
1254
+ const ok = await confirm({
1255
+ title: t("Remove the connection?"),
1256
+ text: removeConfirmText,
1257
+ action: t("Remove"),
1258
+ danger: true
1259
+ });
1260
+ if (!ok) return;
1261
+ try {
1262
+ await api.delete(endpointPrefix);
1263
+ import_sonner13.toast.success(t("Connection removed"));
1264
+ announceTenantChange({});
1265
+ setResetKey((k) => k + 1);
1266
+ } catch (err) {
1267
+ const e = err;
1268
+ import_sonner13.toast.error(formatApiErrorDetail(e?.response?.data?.detail) || e?.message || t("The action failed."));
1269
+ }
1270
+ };
1271
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1272
+ SettingsSection,
1273
+ {
1274
+ id: "tenant",
1275
+ title: t("Microsoft tenant"),
1276
+ testId: "tenant-settings",
1277
+ description,
1278
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "space-y-3", children: [
1279
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TenantConnectStep, { client, app: appName, lang, showLater: false }, resetKey),
1280
+ connected && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
1281
+ "button",
1282
+ {
1283
+ type: "button",
1284
+ onClick: remove,
1285
+ "data-testid": "tenant-remove",
1286
+ 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",
1287
+ children: [
1288
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react3.Unplug, { className: "w-3.5 h-3.5" }),
1289
+ t("Remove connection")
1290
+ ]
1291
+ }
1292
+ )
1293
+ ] })
1294
+ }
1295
+ );
1296
+ }
1297
+
1298
+ // src/app-kit/ScalioFormField.tsx
1299
+ var import_lucide_react4 = require("lucide-react");
1300
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1301
+ function ScalioFormField({
1302
+ label,
1303
+ htmlFor,
1304
+ required = false,
1305
+ hint,
1306
+ error,
1307
+ labelExtra,
1308
+ className = "",
1309
+ testId,
1310
+ children
1311
+ }) {
1312
+ const errorId = htmlFor ? `${htmlFor}-error` : void 0;
1313
+ const hintId = htmlFor ? `${htmlFor}-hint` : void 0;
1314
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `space-y-1.5 ${className}`.trim(), "data-testid": testId, children: [
1315
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1316
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1317
+ "label",
1318
+ {
1319
+ htmlFor,
1320
+ className: "text-[11px] font-bold uppercase tracking-widest text-muted-foreground",
1321
+ children: [
1322
+ label,
1323
+ required && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "ml-0.5 text-destructive", "aria-hidden": "true", children: "*" })
1324
+ ]
1325
+ }
1326
+ ),
1327
+ labelExtra
1328
+ ] }),
1329
+ children,
1330
+ error ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1331
+ "p",
1332
+ {
1333
+ id: errorId,
1334
+ role: "alert",
1335
+ "data-testid": testId ? `${testId}-error` : void 0,
1336
+ className: "flex items-center gap-1.5 text-xs font-medium text-destructive",
1337
+ children: [
1338
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react4.AlertCircle, { className: "w-3.5 h-3.5 shrink-0" }),
1339
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: error })
1340
+ ]
1341
+ }
1342
+ ) : hint && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { id: hintId, className: "text-xs text-muted-foreground", children: hint })
1343
+ ] });
1344
+ }
1345
+ function ScalioFormError({
1346
+ message,
1347
+ fieldErrors,
1348
+ title,
1349
+ className = "",
1350
+ testId = "scalio-form-error"
1351
+ }) {
1352
+ const entries = fieldErrors ? Object.entries(fieldErrors).filter(([, v]) => Boolean(v)) : [];
1353
+ if (!message && entries.length === 0) return null;
1354
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1355
+ "div",
1356
+ {
1357
+ role: "alert",
1358
+ "data-testid": testId,
1359
+ 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(),
1360
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start gap-2", children: [
1361
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react4.AlertCircle, { className: "w-4 h-4 shrink-0 mt-0.5" }),
1362
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-1", children: [
1363
+ title && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "font-semibold", children: title }),
1364
+ message && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: message }),
1365
+ entries.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { className: "list-disc pl-4 space-y-0.5", children: entries.map(([field, text]) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("li", { children: [
1366
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "font-semibold", children: [
1367
+ field,
1368
+ ":"
1369
+ ] }),
1370
+ " ",
1371
+ text
1372
+ ] }, field)) })
1373
+ ] })
1374
+ ] })
1375
+ }
1376
+ );
1377
+ }
1378
+
1379
+ // src/app-kit/ScalioErrorBoundary.tsx
1380
+ var import_react19 = __toESM(require("react"));
1381
+ var import_lucide_react5 = require("lucide-react");
1382
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1383
+ var DEFAULT_TEXT = {
1384
+ en: {
1385
+ title: "Something went wrong",
1386
+ description: "This view encountered an unexpected error. Reload the page to continue.",
1387
+ reload: "Reload page"
1388
+ },
1389
+ de: {
1390
+ title: "Etwas ist schiefgelaufen",
1391
+ description: "In dieser Ansicht ist ein unerwarteter Fehler aufgetreten. Lade die Seite neu, um fortzufahren.",
1392
+ reload: "Seite neu laden"
1393
+ }
1394
+ };
1395
+ var ScalioErrorBoundary = class extends import_react19.default.Component {
1396
+ state = { hasError: false };
1397
+ static getDerivedStateFromError() {
1398
+ return { hasError: true };
1399
+ }
1400
+ componentDidCatch(error, info) {
1401
+ this.props.onError?.(error, info);
1402
+ }
1403
+ handleReset = () => {
1404
+ this.setState({ hasError: false });
1405
+ if (this.props.onReset) {
1406
+ this.props.onReset();
1407
+ } else if (typeof window !== "undefined") {
1408
+ window.location.reload();
1409
+ }
1410
+ };
1411
+ render() {
1412
+ if (!this.state.hasError) {
1413
+ return this.props.children;
1414
+ }
1415
+ const lang = this.props.lang ?? "en";
1416
+ const texts = DEFAULT_TEXT[lang];
1417
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1418
+ "div",
1419
+ {
1420
+ role: "alert",
1421
+ "data-testid": "scalio-error-boundary",
1422
+ className: "min-h-[240px] flex items-center justify-center p-6",
1423
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("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: [
1424
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "mx-auto w-10 h-10 rounded-full bg-destructive/10 text-destructive flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react5.AlertTriangle, { className: "w-5 h-5" }) }),
1425
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h2", { className: "text-base font-bold text-foreground", children: this.props.title ?? texts.title }),
1426
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-xs text-muted-foreground", children: this.props.description ?? texts.description }),
1427
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
1428
+ "button",
1429
+ {
1430
+ type: "button",
1431
+ onClick: this.handleReset,
1432
+ "data-testid": "scalio-error-boundary-reload",
1433
+ 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",
1434
+ children: [
1435
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react5.RotateCcw, { className: "w-3.5 h-3.5" }),
1436
+ this.props.reloadLabel ?? texts.reload
1437
+ ]
1438
+ }
1439
+ )
1440
+ ] })
1441
+ }
1442
+ );
1443
+ }
1444
+ };
1445
+
1446
+ // src/app-kit/ScalioEmptyState.tsx
1447
+ var import_jsx_runtime20 = require("react/jsx-runtime");
1448
+ function ScalioEmptyState({
1449
+ icon,
1450
+ title,
1451
+ description,
1452
+ action,
1453
+ className = "",
1454
+ testId = "scalio-empty-state"
1455
+ }) {
1456
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
1457
+ "div",
1458
+ {
1459
+ "data-testid": testId,
1460
+ className: `rounded-sm border border-dashed border-border bg-card/50 px-6 py-10 text-center space-y-2 ${className}`.trim(),
1461
+ children: [
1462
+ icon && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "mx-auto w-10 h-10 rounded-full bg-muted text-muted-foreground flex items-center justify-center", children: icon }),
1463
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h3", { className: "text-sm font-semibold text-foreground", children: title }),
1464
+ description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-xs text-muted-foreground max-w-md mx-auto", children: description }),
1465
+ action && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "pt-2", children: action })
1466
+ ]
1467
+ }
1468
+ );
1469
+ }
1470
+
1471
+ // src/app-kit/ScalioFormDialog.tsx
1472
+ var import_react20 = require("react");
1473
+ var import_lucide_react6 = require("lucide-react");
1474
+ var import_jsx_runtime21 = require("react/jsx-runtime");
1475
+ var SIZE_CLASS = {
1476
+ sm: "max-w-md",
1477
+ md: "max-w-lg",
1478
+ lg: "max-w-2xl",
1479
+ xl: "max-w-4xl"
1480
+ };
1481
+ var LABELS = {
1482
+ en: {
1483
+ save: "Save",
1484
+ cancel: "Cancel",
1485
+ close: "Close dialog",
1486
+ discardTitle: "Discard unsaved changes?",
1487
+ discardText: "Your changes have not been saved yet.",
1488
+ discardAction: "Discard"
1489
+ },
1490
+ de: {
1491
+ save: "Speichern",
1492
+ cancel: "Abbrechen",
1493
+ close: "Dialog schliessen",
1494
+ discardTitle: "Ungespeicherte \xC4nderungen verwerfen?",
1495
+ discardText: "Deine \xC4nderungen wurden noch nicht gespeichert.",
1496
+ discardAction: "Verwerfen"
1497
+ }
1498
+ };
1499
+ function ScalioFormDialog({
1500
+ open,
1501
+ onOpenChange,
1502
+ title,
1503
+ description,
1504
+ onSubmit,
1505
+ submitLabel,
1506
+ cancelLabel,
1507
+ submitting = false,
1508
+ submitDisabled = false,
1509
+ dirty = false,
1510
+ confirm,
1511
+ error,
1512
+ fieldErrors,
1513
+ size = "md",
1514
+ lang = "en",
1515
+ testId = "scalio-form-dialog",
1516
+ children
1517
+ }) {
1518
+ const L = LABELS[lang];
1519
+ const requestClose = (0, import_react20.useCallback)(async () => {
1520
+ if (submitting) return;
1521
+ if (dirty && confirm) {
1522
+ const ok = await confirm({
1523
+ title: L.discardTitle,
1524
+ text: L.discardText,
1525
+ action: L.discardAction,
1526
+ danger: true
1527
+ });
1528
+ if (!ok) return;
1529
+ }
1530
+ onOpenChange(false);
1531
+ }, [submitting, dirty, confirm, L, onOpenChange]);
1532
+ (0, import_react20.useEffect)(() => {
1533
+ if (!open) return;
1534
+ const onKeyDown = (e) => {
1535
+ if (e.key === "Escape") {
1536
+ e.preventDefault();
1537
+ void requestClose();
1538
+ }
1539
+ };
1540
+ document.addEventListener("keydown", onKeyDown);
1541
+ return () => document.removeEventListener("keydown", onKeyDown);
1542
+ }, [open, requestClose]);
1543
+ if (!open) return null;
1544
+ const handleFormSubmit = (e) => {
1545
+ e.preventDefault();
1546
+ if (submitting || submitDisabled) return;
1547
+ void onSubmit();
1548
+ };
1549
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1550
+ "div",
1551
+ {
1552
+ className: "fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-[1px]",
1553
+ onMouseDown: (e) => {
1554
+ if (e.target === e.currentTarget) void requestClose();
1555
+ },
1556
+ "data-testid": `${testId}-backdrop`,
1557
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
1558
+ "div",
1559
+ {
1560
+ role: "dialog",
1561
+ "aria-modal": "true",
1562
+ "aria-labelledby": `${testId}-title`,
1563
+ "data-testid": testId,
1564
+ className: `w-full ${SIZE_CLASS[size]} max-h-[90vh] flex flex-col rounded-sm border border-border bg-card text-card-foreground shadow-xl`,
1565
+ children: [
1566
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-start justify-between gap-4 px-5 py-4 border-b border-border shrink-0", children: [
1567
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
1568
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h2", { id: `${testId}-title`, className: "text-base font-bold text-foreground", children: title }),
1569
+ description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "mt-0.5 text-xs text-muted-foreground", children: description })
1570
+ ] }),
1571
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1572
+ "button",
1573
+ {
1574
+ type: "button",
1575
+ onClick: () => void requestClose(),
1576
+ disabled: submitting,
1577
+ "aria-label": L.close,
1578
+ "data-testid": `${testId}-close`,
1579
+ 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",
1580
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react6.X, { className: "w-4 h-4" })
1581
+ }
1582
+ )
1583
+ ] }),
1584
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("form", { onSubmit: handleFormSubmit, className: "flex flex-col min-h-0 flex-1", children: [
1585
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "px-5 py-4 overflow-y-auto space-y-4 flex-1", children: [
1586
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ScalioFormError, { message: error, fieldErrors }),
1587
+ children
1588
+ ] }),
1589
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-end gap-2 px-5 py-3 border-t border-border bg-muted/30 shrink-0", children: [
1590
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1591
+ "button",
1592
+ {
1593
+ type: "button",
1594
+ onClick: () => void requestClose(),
1595
+ disabled: submitting,
1596
+ "data-testid": `${testId}-cancel`,
1597
+ 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",
1598
+ children: cancelLabel ?? L.cancel
1599
+ }
1600
+ ),
1601
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
1602
+ "button",
1603
+ {
1604
+ type: "submit",
1605
+ disabled: submitting || submitDisabled,
1606
+ "data-testid": `${testId}-submit`,
1607
+ 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",
1608
+ children: [
1609
+ submitting && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react6.Loader2, { className: "w-3.5 h-3.5 animate-spin" }),
1610
+ submitLabel ?? L.save
1611
+ ]
1612
+ }
1613
+ )
1614
+ ] })
1615
+ ] })
1616
+ ]
1617
+ }
1618
+ )
1619
+ }
1620
+ );
1621
+ }
1622
+
1623
+ // src/app-kit/ScalioDrawer.tsx
1624
+ var import_react21 = require("react");
1625
+ var import_lucide_react7 = require("lucide-react");
1626
+ var import_jsx_runtime22 = require("react/jsx-runtime");
1627
+ var DRAWER_WIDTH = {
1628
+ sm: "max-w-sm",
1629
+ md: "max-w-md",
1630
+ lg: "max-w-xl",
1631
+ xl: "max-w-3xl"
1632
+ };
1633
+ var LABELS2 = {
1634
+ en: {
1635
+ close: "Close panel",
1636
+ discardTitle: "Discard unsaved changes?",
1637
+ discardText: "Your changes have not been saved yet.",
1638
+ discardAction: "Discard"
1639
+ },
1640
+ de: {
1641
+ close: "Seitenleiste schliessen",
1642
+ discardTitle: "Ungespeicherte \xC4nderungen verwerfen?",
1643
+ discardText: "Deine \xC4nderungen wurden noch nicht gespeichert.",
1644
+ discardAction: "Verwerfen"
1645
+ }
1646
+ };
1647
+ function ScalioDrawer({
1648
+ open,
1649
+ onOpenChange,
1650
+ title,
1651
+ description,
1652
+ headerExtra,
1653
+ footer,
1654
+ size = "md",
1655
+ dirty = false,
1656
+ confirm,
1657
+ lang = "en",
1658
+ testId = "scalio-drawer",
1659
+ children
1660
+ }) {
1661
+ const L = LABELS2[lang];
1662
+ const requestClose = (0, import_react21.useCallback)(async () => {
1663
+ if (dirty && confirm) {
1664
+ const ok = await confirm({
1665
+ title: L.discardTitle,
1666
+ text: L.discardText,
1667
+ action: L.discardAction,
1668
+ danger: true
1669
+ });
1670
+ if (!ok) return;
1671
+ }
1672
+ onOpenChange(false);
1673
+ }, [dirty, confirm, L, onOpenChange]);
1674
+ (0, import_react21.useEffect)(() => {
1675
+ if (!open) return;
1676
+ const onKeyDown = (e) => {
1677
+ if (e.key === "Escape") {
1678
+ e.preventDefault();
1679
+ void requestClose();
1680
+ }
1681
+ };
1682
+ document.addEventListener("keydown", onKeyDown);
1683
+ return () => document.removeEventListener("keydown", onKeyDown);
1684
+ }, [open, requestClose]);
1685
+ if (!open) return null;
1686
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1687
+ "div",
1688
+ {
1689
+ className: "fixed inset-0 z-50 flex justify-end bg-black/50 backdrop-blur-[1px]",
1690
+ onMouseDown: (e) => {
1691
+ if (e.target === e.currentTarget) void requestClose();
1692
+ },
1693
+ "data-testid": `${testId}-backdrop`,
1694
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
1695
+ "div",
1696
+ {
1697
+ role: "dialog",
1698
+ "aria-modal": "true",
1699
+ "aria-labelledby": `${testId}-title`,
1700
+ "data-testid": testId,
1701
+ className: `w-full ${DRAWER_WIDTH[size]} h-full flex flex-col border-l border-border bg-card text-card-foreground shadow-2xl`,
1702
+ children: [
1703
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-start justify-between gap-3 px-5 py-4 border-b border-border shrink-0", children: [
1704
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "min-w-0", children: [
1705
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h2", { id: `${testId}-title`, className: "text-base font-bold text-foreground truncate", children: title }),
1706
+ description && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "mt-0.5 text-xs text-muted-foreground", children: description })
1707
+ ] }),
1708
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 shrink-0", children: [
1709
+ headerExtra,
1710
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1711
+ "button",
1712
+ {
1713
+ type: "button",
1714
+ onClick: () => void requestClose(),
1715
+ "aria-label": L.close,
1716
+ "data-testid": `${testId}-close`,
1717
+ className: "h-7 w-7 inline-flex items-center justify-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground",
1718
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react7.X, { className: "w-4 h-4" })
1719
+ }
1720
+ )
1721
+ ] })
1722
+ ] }),
1723
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex-1 overflow-y-auto px-5 py-4", children }),
1724
+ footer && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "px-5 py-3 border-t border-border bg-muted/30 shrink-0", children: footer })
1725
+ ]
1726
+ }
1727
+ )
1728
+ }
1729
+ );
1730
+ }
1731
+
1732
+ // src/app-kit/ScalioInputs.tsx
1733
+ var import_react22 = require("react");
1734
+ var import_lucide_react8 = require("lucide-react");
1735
+ var import_jsx_runtime23 = require("react/jsx-runtime");
1736
+ function formatMinorToEditable(minorUnits, digits = 2) {
1737
+ if (minorUnits === null || Number.isNaN(minorUnits)) return "";
1738
+ return (minorUnits / 10 ** digits).toFixed(digits);
1739
+ }
1740
+ function parseEditableToMinor(raw, digits = 2) {
1741
+ const normalized = raw.trim().replace(/'/g, "").replace(/\s+/g, "").replace(",", ".");
1742
+ if (!normalized) return null;
1743
+ if (!/^-?\d+(?:\.\d*)?$/.test(normalized)) return null;
1744
+ const parsed = Number(normalized);
1745
+ if (!Number.isFinite(parsed)) return null;
1746
+ return Math.round(parsed * 10 ** digits);
1747
+ }
1748
+ function ScalioMoneyInput({
1749
+ value,
1750
+ onChange,
1751
+ currency = "CHF",
1752
+ minorUnitDigits = 2,
1753
+ id,
1754
+ disabled = false,
1755
+ placeholder = "0.00",
1756
+ testId = "scalio-money-input",
1757
+ className = ""
1758
+ }) {
1759
+ const [draft, setDraft] = (0, import_react22.useState)(() => formatMinorToEditable(value, minorUnitDigits));
1760
+ const [focused, setFocused] = (0, import_react22.useState)(false);
1761
+ (0, import_react22.useEffect)(() => {
1762
+ if (!focused) {
1763
+ setDraft(formatMinorToEditable(value, minorUnitDigits));
1764
+ }
1765
+ }, [value, minorUnitDigits, focused]);
1766
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1767
+ "div",
1768
+ {
1769
+ 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(),
1770
+ children: [
1771
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "px-3 text-xs font-bold uppercase tracking-wider text-muted-foreground border-r border-border select-none", children: currency.toUpperCase() }),
1772
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1773
+ "input",
1774
+ {
1775
+ id,
1776
+ type: "text",
1777
+ inputMode: "decimal",
1778
+ disabled,
1779
+ value: draft,
1780
+ placeholder,
1781
+ "data-testid": testId,
1782
+ onFocus: () => setFocused(true),
1783
+ onChange: (e) => {
1784
+ const text = e.target.value;
1785
+ setDraft(text);
1786
+ if (text.trim() === "") {
1787
+ onChange(null);
1788
+ return;
1789
+ }
1790
+ const minor = parseEditableToMinor(text, minorUnitDigits);
1791
+ if (minor !== null) onChange(minor);
1792
+ },
1793
+ onBlur: () => {
1794
+ setFocused(false);
1795
+ const minor = parseEditableToMinor(draft, minorUnitDigits);
1796
+ onChange(minor);
1797
+ setDraft(formatMinorToEditable(minor, minorUnitDigits));
1798
+ },
1799
+ className: "flex-1 h-full px-3 text-sm text-right tabular-nums bg-transparent text-foreground outline-none"
1800
+ }
1801
+ )
1802
+ ]
1803
+ }
1804
+ );
1805
+ }
1806
+ function ScalioTagInput({
1807
+ values,
1808
+ onChange,
1809
+ validate,
1810
+ id,
1811
+ placeholder = "Add entry...",
1812
+ disabled = false,
1813
+ testId = "scalio-tag-input",
1814
+ className = ""
1815
+ }) {
1816
+ const [draft, setDraft] = (0, import_react22.useState)("");
1817
+ const [localError, setLocalError] = (0, import_react22.useState)(null);
1818
+ const commit = (raw) => {
1819
+ const trimmed = raw.trim();
1820
+ if (!trimmed) {
1821
+ setDraft("");
1822
+ setLocalError(null);
1823
+ return;
1824
+ }
1825
+ if (validate) {
1826
+ const err = validate(trimmed);
1827
+ if (err) {
1828
+ setLocalError(err);
1829
+ return;
1830
+ }
1831
+ }
1832
+ setLocalError(null);
1833
+ if (!values.includes(trimmed)) {
1834
+ onChange([...values, trimmed]);
1835
+ }
1836
+ setDraft("");
1837
+ };
1838
+ const remove = (item) => {
1839
+ onChange(values.filter((v) => v !== item));
1840
+ };
1841
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "space-y-1", children: [
1842
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1843
+ "div",
1844
+ {
1845
+ "data-testid": testId,
1846
+ 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(),
1847
+ children: [
1848
+ values.map((item) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1849
+ "span",
1850
+ {
1851
+ "data-testid": `${testId}-chip-${item}`,
1852
+ 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",
1853
+ children: [
1854
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: item }),
1855
+ !disabled && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1856
+ "button",
1857
+ {
1858
+ type: "button",
1859
+ onClick: () => remove(item),
1860
+ "aria-label": `Remove ${item}`,
1861
+ className: "text-muted-foreground hover:text-foreground",
1862
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react8.X, { className: "w-3 h-3" })
1863
+ }
1864
+ )
1865
+ ]
1866
+ },
1867
+ item
1868
+ )),
1869
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1870
+ "input",
1871
+ {
1872
+ id,
1873
+ type: "text",
1874
+ disabled,
1875
+ value: draft,
1876
+ placeholder: values.length === 0 ? placeholder : "",
1877
+ "data-testid": `${testId}-field`,
1878
+ onChange: (e) => {
1879
+ setDraft(e.target.value);
1880
+ if (localError) setLocalError(null);
1881
+ },
1882
+ onKeyDown: (e) => {
1883
+ if (e.key === "Enter" || e.key === ",") {
1884
+ e.preventDefault();
1885
+ commit(draft);
1886
+ } else if (e.key === "Backspace" && !draft && values.length > 0) {
1887
+ const last = values[values.length - 1];
1888
+ if (last !== void 0) remove(last);
1889
+ }
1890
+ },
1891
+ onBlur: () => {
1892
+ if (draft.trim()) commit(draft);
1893
+ },
1894
+ className: "flex-1 min-w-[120px] h-7 px-1 text-sm bg-transparent text-foreground outline-none"
1895
+ }
1896
+ )
1897
+ ]
1898
+ }
1899
+ ),
1900
+ localError && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", "data-testid": `${testId}-error`, className: "text-xs text-destructive", children: localError })
1901
+ ] });
1902
+ }
1903
+ function ScalioCombobox({
1904
+ options,
1905
+ value,
1906
+ onChange,
1907
+ placeholder,
1908
+ searchPlaceholder,
1909
+ emptyLabel,
1910
+ clearable = false,
1911
+ disabled = false,
1912
+ lang = "en",
1913
+ testId = "scalio-combobox",
1914
+ className = ""
1915
+ }) {
1916
+ const [open, setOpen] = (0, import_react22.useState)(false);
1917
+ const [query, setQuery] = (0, import_react22.useState)("");
1918
+ const [activeIdx, setActiveIdx] = (0, import_react22.useState)(0);
1919
+ const rootRef = (0, import_react22.useRef)(null);
1920
+ const selected = (0, import_react22.useMemo)(
1921
+ () => options.find((o) => o.value === value) ?? null,
1922
+ [options, value]
1923
+ );
1924
+ const filtered = (0, import_react22.useMemo)(() => {
1925
+ const q = query.trim().toLowerCase();
1926
+ if (!q) return options;
1927
+ return options.filter(
1928
+ (o) => o.label.toLowerCase().includes(q) || o.value.toLowerCase().includes(q) || (o.description?.toLowerCase().includes(q) ?? false)
1929
+ );
1930
+ }, [options, query]);
1931
+ (0, import_react22.useEffect)(() => {
1932
+ if (!open) return;
1933
+ const onDoc = (e) => {
1934
+ if (rootRef.current && !rootRef.current.contains(e.target)) {
1935
+ setOpen(false);
1936
+ }
1937
+ };
1938
+ document.addEventListener("mousedown", onDoc);
1939
+ return () => document.removeEventListener("mousedown", onDoc);
1940
+ }, [open]);
1941
+ const selectOption = (opt) => {
1942
+ if (opt.disabled) return;
1943
+ onChange(opt.value);
1944
+ setOpen(false);
1945
+ setQuery("");
1946
+ };
1947
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { ref: rootRef, className: `relative ${className}`.trim(), "data-testid": testId, children: [
1948
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1949
+ "button",
1950
+ {
1951
+ type: "button",
1952
+ disabled,
1953
+ "aria-expanded": open,
1954
+ "aria-haspopup": "listbox",
1955
+ "data-testid": `${testId}-trigger`,
1956
+ onClick: () => {
1957
+ setOpen((v) => !v);
1958
+ setActiveIdx(0);
1959
+ },
1960
+ 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",
1961
+ children: [
1962
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: `truncate ${selected ? "text-foreground" : "text-muted-foreground"}`, children: selected ? selected.label : placeholder ?? (lang === "de" ? "Ausw\xE4hlen..." : "Select...") }),
1963
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "inline-flex items-center gap-1 shrink-0", children: [
1964
+ clearable && selected && !disabled && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1965
+ "span",
1966
+ {
1967
+ role: "button",
1968
+ tabIndex: 0,
1969
+ "aria-label": lang === "de" ? "Auswahl leeren" : "Clear selection",
1970
+ onClick: (e) => {
1971
+ e.stopPropagation();
1972
+ onChange(null);
1973
+ },
1974
+ onKeyDown: (e) => {
1975
+ if (e.key === "Enter" || e.key === " ") {
1976
+ e.preventDefault();
1977
+ e.stopPropagation();
1978
+ onChange(null);
1979
+ }
1980
+ },
1981
+ className: "p-0.5 text-muted-foreground hover:text-foreground",
1982
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react8.X, { className: "w-3.5 h-3.5" })
1983
+ }
1984
+ ),
1985
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react8.ChevronDown, { className: "w-4 h-4 opacity-60" })
1986
+ ] })
1987
+ ]
1988
+ }
1989
+ ),
1990
+ open && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1991
+ "div",
1992
+ {
1993
+ className: "absolute left-0 right-0 mt-1 rounded-sm border border-border bg-popover text-popover-foreground shadow-lg z-40 overflow-hidden",
1994
+ "data-testid": `${testId}-menu`,
1995
+ children: [
1996
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "p-1.5 border-b border-border", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1997
+ "input",
1998
+ {
1999
+ type: "search",
2000
+ autoFocus: true,
2001
+ value: query,
2002
+ onChange: (e) => {
2003
+ setQuery(e.target.value);
2004
+ setActiveIdx(0);
2005
+ },
2006
+ onKeyDown: (e) => {
2007
+ if (e.key === "ArrowDown") {
2008
+ e.preventDefault();
2009
+ setActiveIdx((i) => Math.min(i + 1, Math.max(0, filtered.length - 1)));
2010
+ } else if (e.key === "ArrowUp") {
2011
+ e.preventDefault();
2012
+ setActiveIdx((i) => Math.max(i - 1, 0));
2013
+ } else if (e.key === "Enter") {
2014
+ e.preventDefault();
2015
+ const chosen = filtered[activeIdx];
2016
+ if (chosen) selectOption(chosen);
2017
+ } else if (e.key === "Escape") {
2018
+ setOpen(false);
2019
+ }
2020
+ },
2021
+ placeholder: searchPlaceholder ?? (lang === "de" ? "Suchen..." : "Search..."),
2022
+ "data-testid": `${testId}-search`,
2023
+ 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"
2024
+ }
2025
+ ) }),
2026
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("ul", { role: "listbox", className: "max-h-60 overflow-y-auto p-1 space-y-0.5", children: filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("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) => {
2027
+ const isSelected = opt.value === value;
2028
+ const isActive = idx === activeIdx;
2029
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("li", { role: "option", "aria-selected": isSelected, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2030
+ "button",
2031
+ {
2032
+ type: "button",
2033
+ disabled: opt.disabled,
2034
+ onClick: () => selectOption(opt),
2035
+ "data-testid": `${testId}-opt-${opt.value}`,
2036
+ 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"}`,
2037
+ children: [
2038
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "min-w-0", children: [
2039
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "block truncate", children: opt.label }),
2040
+ opt.description && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "block text-[11px] text-muted-foreground truncate", children: opt.description })
2041
+ ] }),
2042
+ isSelected && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react8.Check, { className: "w-3.5 h-3.5 shrink-0 text-primary" })
2043
+ ]
2044
+ }
2045
+ ) }, opt.value);
2046
+ }) })
2047
+ ]
2048
+ }
2049
+ )
2050
+ ] });
2051
+ }
2052
+ function ScalioDateRangeInput({
2053
+ value,
2054
+ onChange,
2055
+ min,
2056
+ max,
2057
+ disabled = false,
2058
+ lang = "en",
2059
+ testId = "scalio-date-range",
2060
+ className = ""
2061
+ }) {
2062
+ const fromLabel = lang === "de" ? "Von" : "From";
2063
+ const toLabel = lang === "de" ? "Bis" : "To";
2064
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `flex flex-wrap items-center gap-2 ${className}`.trim(), "data-testid": testId, children: [
2065
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "inline-flex items-center gap-1.5 text-xs text-muted-foreground", children: [
2066
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: fromLabel }),
2067
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2068
+ "input",
2069
+ {
2070
+ type: "date",
2071
+ disabled,
2072
+ value: value.from,
2073
+ min,
2074
+ max: value.to || max,
2075
+ "data-testid": `${testId}-from`,
2076
+ onChange: (e) => onChange({ ...value, from: e.target.value }),
2077
+ 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"
2078
+ }
2079
+ )
2080
+ ] }),
2081
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "inline-flex items-center gap-1.5 text-xs text-muted-foreground", children: [
2082
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: toLabel }),
2083
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2084
+ "input",
2085
+ {
2086
+ type: "date",
2087
+ disabled,
2088
+ value: value.to,
2089
+ min: value.from || min,
2090
+ max,
2091
+ "data-testid": `${testId}-to`,
2092
+ onChange: (e) => onChange({ ...value, to: e.target.value }),
2093
+ 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"
2094
+ }
2095
+ )
2096
+ ] })
2097
+ ] });
2098
+ }
2099
+
2100
+ // src/app-kit/ScalioUtilities.tsx
2101
+ var import_react23 = require("react");
2102
+ var import_lucide_react9 = require("lucide-react");
2103
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2104
+ function ScalioOfflineBanner({
2105
+ lang = "en",
2106
+ message,
2107
+ testId = "scalio-offline-banner"
2108
+ }) {
2109
+ const [offline, setOffline] = (0, import_react23.useState)(
2110
+ () => typeof navigator !== "undefined" ? navigator.onLine === false : false
2111
+ );
2112
+ (0, import_react23.useEffect)(() => {
2113
+ if (typeof window === "undefined") return;
2114
+ const goOffline = () => setOffline(true);
2115
+ const goOnline = () => setOffline(false);
2116
+ window.addEventListener("offline", goOffline);
2117
+ window.addEventListener("online", goOnline);
2118
+ return () => {
2119
+ window.removeEventListener("offline", goOffline);
2120
+ window.removeEventListener("online", goOnline);
2121
+ };
2122
+ }, []);
2123
+ if (!offline) return null;
2124
+ 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.");
2125
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2126
+ "div",
2127
+ {
2128
+ role: "status",
2129
+ "data-testid": testId,
2130
+ 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",
2131
+ children: [
2132
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react9.WifiOff, { className: "w-3.5 h-3.5 shrink-0" }),
2133
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: text })
2134
+ ]
2135
+ }
2136
+ );
2137
+ }
2138
+ function ScalioCopyButton({
2139
+ value,
2140
+ label,
2141
+ copiedLabel,
2142
+ lang = "en",
2143
+ className = "",
2144
+ testId = "scalio-copy-btn"
2145
+ }) {
2146
+ const [copied, setCopied] = (0, import_react23.useState)(false);
2147
+ const defaultLabel = lang === "de" ? "Kopieren" : "Copy";
2148
+ const defaultCopied = lang === "de" ? "Kopiert" : "Copied";
2149
+ const handleCopy = async () => {
2150
+ try {
2151
+ await navigator.clipboard.writeText(value);
2152
+ setCopied(true);
2153
+ window.setTimeout(() => setCopied(false), 1800);
2154
+ } catch {
2155
+ }
2156
+ };
2157
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2158
+ "button",
2159
+ {
2160
+ type: "button",
2161
+ onClick: () => void handleCopy(),
2162
+ "aria-label": copied ? copiedLabel ?? defaultCopied : label ?? defaultLabel,
2163
+ "data-testid": testId,
2164
+ 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(),
2165
+ children: [
2166
+ copied ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react9.Check, { className: "w-3.5 h-3.5 text-[#1f7a3d] dark:text-emerald-400" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react9.Copy, { className: "w-3.5 h-3.5" }),
2167
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: copied ? copiedLabel ?? defaultCopied : label ?? defaultLabel })
2168
+ ]
2169
+ }
2170
+ );
2171
+ }
2172
+ function ScalioSkeleton({
2173
+ lines = 1,
2174
+ className = "h-4 w-full",
2175
+ testId = "scalio-skeleton"
2176
+ }) {
2177
+ if (lines <= 1) {
2178
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { "data-testid": testId, "aria-hidden": "true", className: `rounded-sm bg-muted animate-pulse ${className}` });
2179
+ }
2180
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { "data-testid": testId, "aria-hidden": "true", className: "space-y-2", children: Array.from({ length: lines }).map((_, idx) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2181
+ "div",
2182
+ {
2183
+ className: `h-4 rounded-sm bg-muted animate-pulse ${idx === lines - 1 ? "w-2/3" : "w-full"}`
2184
+ },
2185
+ idx
2186
+ )) });
2187
+ }
2188
+
2189
+ // src/app-kit/ScalioAppProviders.tsx
2190
+ var import_sonner14 = require("sonner");
2191
+ var import_confirm = require("@scalio-cloud/ui/shadcn/confirm");
2192
+ var import_jsx_runtime25 = require("react/jsx-runtime");
2193
+ function ScalioAppProviders({
2194
+ themeStoreKey,
2195
+ lang = "en",
2196
+ confirmLabels,
2197
+ onRenderError,
2198
+ children
2199
+ }) {
2200
+ const defaultConfirm = lang === "de" ? { cancel: "Abbrechen", confirm: "Best\xE4tigen" } : { cancel: "Cancel", confirm: "Confirm" };
2201
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ScalioErrorBoundary, { lang, onError: onRenderError, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ThemeProvider, { storeKey: themeStoreKey, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_confirm.ConfirmProvider, { labels: confirmLabels ?? defaultConfirm, children: [
2202
+ children,
2203
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_sonner14.Toaster, { position: "top-right", richColors: true })
2204
+ ] }) }) });
2205
+ }
2206
+
2207
+ // src/app-kit/ScalioLayout.tsx
2208
+ var import_react24 = require("react");
2209
+ var import_jsx_runtime26 = require("react/jsx-runtime");
2210
+ function ScalioLayout({
2211
+ api,
2212
+ lang,
2213
+ header,
2214
+ sidebar,
2215
+ switcher,
2216
+ extraBanners,
2217
+ showSaasUpdateBanner = false,
2218
+ onOpenSaasUpdates,
2219
+ drawerTop,
2220
+ legalUrl,
2221
+ testId = "scalio-layout",
2222
+ children
2223
+ }) {
2224
+ const [drawerOpen, setDrawerOpen] = (0, import_react24.useState)(false);
2225
+ const banner = /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
2226
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ScalioOfflineBanner, { lang }),
2227
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ScalioMaintenanceBanner, { api, lang }),
2228
+ showSaasUpdateBanner && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ScalioSaasUpdateBanner, { api, lang, onOpen: onOpenSaasUpdates }),
2229
+ extraBanners
2230
+ ] });
2231
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2232
+ AppShell,
2233
+ {
2234
+ switcher,
2235
+ header,
2236
+ banner,
2237
+ sidebar,
2238
+ drawerOpen,
2239
+ onDrawerClose: () => setDrawerOpen(false),
2240
+ drawerTop,
2241
+ legalUrl,
2242
+ lang,
2243
+ testId,
2244
+ children
2245
+ }
2246
+ );
912
2247
  }
913
2248
  // Annotate the CommonJS export names for ESM import in node:
914
2249
  0 && (module.exports = {
2250
+ ScalioAppProviders,
915
2251
  ScalioAuditHeader,
916
2252
  ScalioAuditPage,
917
2253
  ScalioBackupSection,
2254
+ ScalioCombobox,
2255
+ ScalioCopyButton,
2256
+ ScalioDateRangeInput,
2257
+ ScalioDrawer,
2258
+ ScalioEmptyState,
2259
+ ScalioErrorBoundary,
2260
+ ScalioFactoryReset,
2261
+ ScalioFormDialog,
2262
+ ScalioFormError,
2263
+ ScalioFormField,
918
2264
  ScalioInvitePage,
919
2265
  ScalioJobsPage,
2266
+ ScalioLayout,
2267
+ ScalioLicensePanel,
920
2268
  ScalioLoginPage,
2269
+ ScalioMailSettings,
921
2270
  ScalioMaintenanceBanner,
2271
+ ScalioMoneyInput,
2272
+ ScalioOfflineBanner,
922
2273
  ScalioPasswordChangePage,
923
2274
  ScalioProfilePage,
2275
+ ScalioResultBadge,
2276
+ ScalioRoleTenants,
924
2277
  ScalioSaasUpdateBanner,
925
2278
  ScalioSaasUpdatesSection,
926
2279
  ScalioSecurityFactors,
927
2280
  ScalioSelfTestPage,
2281
+ ScalioSkeleton,
928
2282
  ScalioSupportCard,
929
- ScalioUsersPage
2283
+ ScalioTagInput,
2284
+ ScalioTenantSettings,
2285
+ ScalioUsersPage,
2286
+ formatDisplayValue,
2287
+ formatMinorToEditable,
2288
+ parseEditableToMinor
930
2289
  });
931
2290
  //# sourceMappingURL=index.js.map