@stoa-dev/kit 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +75 -1
  3. package/dist/autosave/controller.js +93 -0
  4. package/dist/autosave/controller.js.map +1 -0
  5. package/dist/autosave/index.js +7 -0
  6. package/dist/autosave/index.js.map +1 -0
  7. package/dist/autosave/provider.js +48 -0
  8. package/dist/autosave/provider.js.map +1 -0
  9. package/dist/i18n/locales/at.json.js +8 -6
  10. package/dist/i18n/locales/at.json.js.map +1 -1
  11. package/dist/i18n/locales/de.json.js +6 -4
  12. package/dist/i18n/locales/de.json.js.map +1 -1
  13. package/dist/i18n/locales/en.json.js +7 -5
  14. package/dist/i18n/locales/en.json.js.map +1 -1
  15. package/dist/i18n/locales/it.json.js +8 -6
  16. package/dist/i18n/locales/it.json.js.map +1 -1
  17. package/dist/kit.css +1 -1
  18. package/dist/shell/AppNavigation/index.js +63 -62
  19. package/dist/shell/AppNavigation/index.js.map +1 -1
  20. package/dist/shell/BackButton/index.js +24 -0
  21. package/dist/shell/BackButton/index.js.map +1 -0
  22. package/dist/shell/SectionNavigation/index.js +5 -114
  23. package/dist/shell/SectionNavigation/index.js.map +1 -1
  24. package/dist/shell/SetupWizard/index.js +158 -0
  25. package/dist/shell/SetupWizard/index.js.map +1 -0
  26. package/dist/shell/SubNavigation/index.js +127 -0
  27. package/dist/shell/SubNavigation/index.js.map +1 -0
  28. package/dist/shell/index.js +25 -21
  29. package/dist/shell/index.js.map +1 -1
  30. package/dist/types/autosave/controller.d.ts +44 -0
  31. package/dist/types/autosave/controller.d.ts.map +1 -0
  32. package/dist/types/autosave/index.d.ts +3 -0
  33. package/dist/types/autosave/index.d.ts.map +1 -0
  34. package/dist/types/autosave/provider.d.ts +20 -0
  35. package/dist/types/autosave/provider.d.ts.map +1 -0
  36. package/dist/types/i18n/index.d.ts +44 -0
  37. package/dist/types/i18n/index.d.ts.map +1 -1
  38. package/dist/types/shell/AppNavigation/index.d.ts +1 -1
  39. package/dist/types/shell/AppNavigation/index.d.ts.map +1 -1
  40. package/dist/types/shell/BackButton/index.d.ts +8 -0
  41. package/dist/types/shell/BackButton/index.d.ts.map +1 -0
  42. package/dist/types/shell/SectionNavigation/index.d.ts +4 -11
  43. package/dist/types/shell/SectionNavigation/index.d.ts.map +1 -1
  44. package/dist/types/shell/SetupWizard/index.d.ts +23 -0
  45. package/dist/types/shell/SetupWizard/index.d.ts.map +1 -0
  46. package/dist/types/shell/SubNavigation/index.d.ts +16 -0
  47. package/dist/types/shell/SubNavigation/index.d.ts.map +1 -0
  48. package/dist/types/shell/index.d.ts +3 -1
  49. package/dist/types/shell/index.d.ts.map +1 -1
  50. package/dist/types/ui/index.d.ts +2 -0
  51. package/dist/types/ui/index.d.ts.map +1 -1
  52. package/dist/types/ui/theme-switch/index.d.ts +12 -0
  53. package/dist/types/ui/theme-switch/index.d.ts.map +1 -0
  54. package/dist/types/ui/theme-toggle/index.d.ts +12 -0
  55. package/dist/types/ui/theme-toggle/index.d.ts.map +1 -0
  56. package/dist/types/utils/saveFeedback.d.ts +1 -1
  57. package/dist/types/utils/saveFeedback.d.ts.map +1 -1
  58. package/dist/ui/index.js +41 -37
  59. package/dist/ui/index.js.map +1 -1
  60. package/dist/ui/theme-switch/ThemeSwitch.module.scss.js +14 -0
  61. package/dist/ui/theme-switch/ThemeSwitch.module.scss.js.map +1 -0
  62. package/dist/ui/theme-switch/index.js +38 -0
  63. package/dist/ui/theme-switch/index.js.map +1 -0
  64. package/dist/ui/theme-toggle/index.js +36 -0
  65. package/dist/ui/theme-toggle/index.js.map +1 -0
  66. package/dist/ui/tooltip/index.js +11 -11
  67. package/dist/ui/tooltip/index.js.map +1 -1
  68. package/dist/utils/saveFeedback.js.map +1 -1
  69. package/package.json +6 -2
  70. package/styles/instrument.css +0 -2
  71. package/dist/shell/BackHomeButton/index.js +0 -23
  72. package/dist/shell/BackHomeButton/index.js.map +0 -1
  73. package/dist/types/shell/BackHomeButton/index.d.ts +0 -7
  74. package/dist/types/shell/BackHomeButton/index.d.ts.map +0 -1
@@ -1,98 +1,99 @@
1
- import { jsxs as c, jsx as t, Fragment as N } from "react/jsx-runtime";
2
- import { Eclipse as T } from "lucide-react";
3
- import { useTheme as k } from "next-themes";
4
- import { Fragment as p } from "react";
5
- import { useTranslation as u } from "react-i18next";
6
- import { useLocation as A, Link as z } from "react-router";
7
- import { STOA_NS as h } from "../../i18n/namespace.js";
8
- import { Button as f } from "../../ui/button/index.js";
9
- import { Tooltip as C, TooltipTrigger as j, TooltipContent as x } from "../../ui/tooltip/index.js";
10
- import { cn as l } from "../../utils/cn.js";
1
+ import { jsxs as l, jsx as t, Fragment as N } from "react/jsx-runtime";
2
+ import { useTheme as T } from "next-themes";
3
+ import { Fragment as u } from "react";
4
+ import { useTranslation as g } from "react-i18next";
5
+ import { useLocation as k, Link as A } from "react-router";
6
+ import { STOA_NS as f } from "../../i18n/namespace.js";
7
+ import { Button as v } from "../../ui/button/index.js";
8
+ import { ThemeToggle as b } from "../../ui/theme-toggle/index.js";
9
+ import { Tooltip as x, TooltipTrigger as z, TooltipContent as B } from "../../ui/tooltip/index.js";
10
+ import { cn as m } from "../../utils/cn.js";
11
11
  import s from "./AppNavigation.module.scss.js";
12
- function B(i) {
12
+ function j(i) {
13
13
  return typeof i == "object" && i !== null && "path" in i && "Icon" in i;
14
14
  }
15
- function b(i) {
15
+ function C(i) {
16
16
  return typeof i == "object" && i !== null && "onClick" in i && "Icon" in i;
17
17
  }
18
- function g({
18
+ function p({
19
19
  label: i,
20
20
  children: n
21
21
  }) {
22
- return /* @__PURE__ */ c(C, { children: [
23
- /* @__PURE__ */ t(j, { asChild: !0, children: n }),
24
- /* @__PURE__ */ t(x, { side: "right", children: i })
22
+ return /* @__PURE__ */ l(x, { children: [
23
+ /* @__PURE__ */ t(z, { asChild: !0, children: n }),
24
+ /* @__PURE__ */ t(B, { side: "right", children: i })
25
25
  ] });
26
26
  }
27
- function F({
27
+ function L({
28
28
  path: i,
29
29
  label: n,
30
30
  Icon: o,
31
- isActive: r,
31
+ isActive: e,
32
32
  disabled: a
33
33
  }) {
34
- const { pathname: e } = A(), m = r ? r(e) : e === i;
35
- return /* @__PURE__ */ t(g, { label: n, children: /* @__PURE__ */ t(
36
- f,
34
+ const { pathname: r } = k(), c = e ? e(r) : r === i;
35
+ return /* @__PURE__ */ t(p, { label: n, children: /* @__PURE__ */ t(
36
+ v,
37
37
  {
38
38
  variant: "ghost",
39
39
  size: "icon",
40
40
  "data-nav-item": "",
41
- className: l(s.menuButton, "rounded-xl"),
41
+ className: m(s.menuButton, "rounded-xl"),
42
42
  disabled: a,
43
43
  asChild: !a,
44
44
  children: a ? /* @__PURE__ */ t(o, { className: "size-4", strokeWidth: 1.75 }) : /* @__PURE__ */ t(
45
- z,
45
+ A,
46
46
  {
47
47
  to: i,
48
48
  "aria-label": n,
49
- "aria-current": m ? "page" : void 0,
49
+ "aria-current": c ? "page" : void 0,
50
50
  children: /* @__PURE__ */ t(o, { className: "size-4", strokeWidth: 1.75 })
51
51
  }
52
52
  )
53
53
  }
54
54
  ) });
55
55
  }
56
- function v({
56
+ function F({
57
57
  label: i,
58
58
  Icon: n,
59
59
  onClick: o,
60
- disabled: r
60
+ disabled: e
61
61
  }) {
62
- return /* @__PURE__ */ t(g, { label: i, children: /* @__PURE__ */ t(
63
- f,
62
+ return /* @__PURE__ */ t(p, { label: i, children: /* @__PURE__ */ t(
63
+ v,
64
64
  {
65
65
  variant: "ghost",
66
66
  size: "icon",
67
67
  "data-nav-item": "",
68
- className: l(s.menuButton, "rounded-xl"),
68
+ className: m(s.menuButton, "rounded-xl"),
69
69
  "aria-label": i,
70
- disabled: r,
70
+ disabled: e,
71
71
  onClick: o,
72
72
  children: /* @__PURE__ */ t(n, { className: "size-4", strokeWidth: 1.75 })
73
73
  }
74
74
  ) });
75
75
  }
76
- function J({
76
+ function K({
77
77
  onToggle: i,
78
78
  theme: n = "system",
79
79
  disabled: o,
80
- label: r
80
+ label: e
81
81
  }) {
82
- const { t: a } = u(h), { resolvedTheme: e } = k(), m = n === "system" ? e : n;
83
- return /* @__PURE__ */ t(
84
- v,
82
+ const { t: a } = g(f), { resolvedTheme: r } = T(), c = n === "system" ? r : n, d = e ?? a("app.switchTheme");
83
+ return /* @__PURE__ */ t(p, { label: d, children: /* @__PURE__ */ t(
84
+ b,
85
85
  {
86
- label: r ?? a("app.switchTheme"),
87
- Icon: T,
86
+ variant: "ghost",
87
+ "data-nav-item": "",
88
+ className: m(s.menuButton, "rounded-xl"),
89
+ theme: c === "dark" ? "dark" : "light",
90
+ label: d,
88
91
  disabled: o,
89
- onClick: () => {
90
- i(m === "dark" ? "light" : "dark");
91
- }
92
+ onToggle: i
92
93
  }
93
- );
94
+ ) });
94
95
  }
95
- function I() {
96
+ function W() {
96
97
  return /* @__PURE__ */ t(
97
98
  "div",
98
99
  {
@@ -102,29 +103,29 @@ function I() {
102
103
  }
103
104
  );
104
105
  }
105
- function d(i, n) {
106
- return i.map((o, r) => (
106
+ function h(i, n) {
107
+ return i.map((o, e) => (
107
108
  // biome-ignore lint/suspicious/noArrayIndexKey: groups are static configuration
108
- /* @__PURE__ */ c(p, { children: [
109
- r > 0 && /* @__PURE__ */ t(I, {}),
110
- o.map((a, e) => B(a) ? /* @__PURE__ */ t(F, { ...a }, a.path) : b(a) ? /* @__PURE__ */ t(v, { ...a }, a.id ?? a.label) : /* @__PURE__ */ t(p, { children: a }, e))
111
- ] }, `${n}-${r}`)
109
+ /* @__PURE__ */ l(u, { children: [
110
+ e > 0 && /* @__PURE__ */ t(W, {}),
111
+ o.map((a, r) => j(a) ? /* @__PURE__ */ t(L, { ...a }, a.path) : C(a) ? /* @__PURE__ */ t(F, { ...a }, a.id ?? a.label) : /* @__PURE__ */ t(u, { children: a }, r))
112
+ ] }, `${n}-${e}`)
112
113
  ));
113
114
  }
114
- function K({
115
+ function M({
115
116
  groups: i,
116
117
  logo: n,
117
118
  footerGroups: o,
118
- label: r,
119
+ label: e,
119
120
  className: a
120
121
  }) {
121
- const { t: e } = u(h);
122
- return /* @__PURE__ */ c(
122
+ const { t: r } = g(f);
123
+ return /* @__PURE__ */ l(
123
124
  "nav",
124
125
  {
125
126
  "data-slot": "app-navigation",
126
- "aria-label": r ?? e("app.navigation"),
127
- className: l(s.root, a),
127
+ "aria-label": e ?? r("app.navigation"),
128
+ className: m(s.root, a),
128
129
  children: [
129
130
  typeof n == "string" ? /* @__PURE__ */ t(
130
131
  "img",
@@ -136,20 +137,20 @@ function K({
136
137
  "aria-hidden": "true"
137
138
  }
138
139
  ) : n,
139
- d(i, "main"),
140
- o && o.length > 0 && /* @__PURE__ */ c(N, { children: [
140
+ h(i, "main"),
141
+ o && o.length > 0 && /* @__PURE__ */ l(N, { children: [
141
142
  /* @__PURE__ */ t("div", { className: s.spacer }),
142
- d(o, "footer")
143
+ h(o, "footer")
143
144
  ] })
144
145
  ]
145
146
  }
146
147
  );
147
148
  }
148
149
  export {
149
- K as AppNavigation,
150
- v as AppNavigationButton,
151
- I as AppNavigationDivider,
152
- F as AppNavigationItem,
153
- J as AppNavigationThemeToggle
150
+ M as AppNavigation,
151
+ F as AppNavigationButton,
152
+ W as AppNavigationDivider,
153
+ L as AppNavigationItem,
154
+ K as AppNavigationThemeToggle
154
155
  };
155
156
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/shell/AppNavigation/index.tsx"],"sourcesContent":["import { Eclipse, type LucideIcon } from 'lucide-react'\nimport { useTheme } from 'next-themes'\nimport { Fragment, type ReactNode } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { Link, useLocation } from 'react-router'\nimport { STOA_NS } from '../../i18n/namespace'\nimport { Button } from '../../ui/button'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../../ui/tooltip'\nimport { cn } from '../../utils/cn'\nimport styles from './AppNavigation.module.scss'\n\ntype ItemBase = {\n\t/** Translated label, used for tooltip and aria-label. */\n\tlabel: string\n\tIcon: LucideIcon\n\tdisabled?: boolean\n}\n\nexport type AppNavigationLink = ItemBase & {\n\tpath: string\n\t/** Custom active matcher, e.g. to keep \"Library\" active on `/books/:id`. */\n\tisActive?: (pathname: string) => boolean\n}\n\nexport type AppNavigationAction = ItemBase & {\n\tonClick: () => void\n\t/** Stable React key; defaults to the label. */\n\tid?: string\n}\n\nexport type AppNavigationEntry =\n\t| AppNavigationLink\n\t| AppNavigationAction\n\t| ReactNode\n\n/** Groups are rendered top to bottom and separated by dividers. */\nexport type AppNavigationGroup = readonly AppNavigationEntry[]\n\nexport interface AppNavigationProps {\n\tgroups: readonly AppNavigationGroup[]\n\t/** Image URL or custom node rendered above the first group. */\n\tlogo?: string | ReactNode\n\t/** Groups pinned to the bottom of the bar. */\n\tfooterGroups?: readonly AppNavigationGroup[]\n\tlabel?: string\n\tclassName?: string\n}\n\nfunction isLink(entry: AppNavigationEntry): entry is AppNavigationLink {\n\treturn (\n\t\ttypeof entry === 'object' &&\n\t\tentry !== null &&\n\t\t'path' in entry &&\n\t\t'Icon' in entry\n\t)\n}\n\nfunction isAction(entry: AppNavigationEntry): entry is AppNavigationAction {\n\treturn (\n\t\ttypeof entry === 'object' &&\n\t\tentry !== null &&\n\t\t'onClick' in entry &&\n\t\t'Icon' in entry\n\t)\n}\n\nfunction ItemTooltip({\n\tlabel,\n\tchildren,\n}: {\n\tlabel: string\n\tchildren: ReactNode\n}) {\n\treturn (\n\t\t<Tooltip>\n\t\t\t<TooltipTrigger asChild>{children}</TooltipTrigger>\n\t\t\t<TooltipContent side='right'>{label}</TooltipContent>\n\t\t</Tooltip>\n\t)\n}\n\nexport function AppNavigationItem({\n\tpath,\n\tlabel,\n\tIcon,\n\tisActive,\n\tdisabled,\n}: AppNavigationLink) {\n\tconst { pathname } = useLocation()\n\tconst active = isActive ? isActive(pathname) : pathname === path\n\n\treturn (\n\t\t<ItemTooltip label={label}>\n\t\t\t<Button\n\t\t\t\tvariant='ghost'\n\t\t\t\tsize='icon'\n\t\t\t\tdata-nav-item=''\n\t\t\t\tclassName={cn(styles.menuButton, 'rounded-xl')}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tasChild={!disabled}\n\t\t\t>\n\t\t\t\t{disabled ? (\n\t\t\t\t\t<Icon className='size-4' strokeWidth={1.75} />\n\t\t\t\t) : (\n\t\t\t\t\t<Link\n\t\t\t\t\t\tto={path}\n\t\t\t\t\t\taria-label={label}\n\t\t\t\t\t\taria-current={active ? 'page' : undefined}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon className='size-4' strokeWidth={1.75} />\n\t\t\t\t\t</Link>\n\t\t\t\t)}\n\t\t\t</Button>\n\t\t</ItemTooltip>\n\t)\n}\n\nexport function AppNavigationButton({\n\tlabel,\n\tIcon,\n\tonClick,\n\tdisabled,\n}: AppNavigationAction) {\n\treturn (\n\t\t<ItemTooltip label={label}>\n\t\t\t<Button\n\t\t\t\tvariant='ghost'\n\t\t\t\tsize='icon'\n\t\t\t\tdata-nav-item=''\n\t\t\t\tclassName={cn(styles.menuButton, 'rounded-xl')}\n\t\t\t\taria-label={label}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tonClick={onClick}\n\t\t\t>\n\t\t\t\t<Icon className='size-4' strokeWidth={1.75} />\n\t\t\t</Button>\n\t\t</ItemTooltip>\n\t)\n}\n\nexport interface AppNavigationThemeToggleProps {\n\t/** Persist the new theme (settings file, autosave, …). `next-themes` is updated by the app. */\n\tonToggle: (theme: 'light' | 'dark') => void | Promise<void>\n\t/** Current stored preference; `system` resolves via `next-themes`. */\n\ttheme?: 'light' | 'dark' | 'system'\n\tdisabled?: boolean\n\tlabel?: string\n}\n\nexport function AppNavigationThemeToggle({\n\tonToggle,\n\ttheme = 'system',\n\tdisabled,\n\tlabel,\n}: AppNavigationThemeToggleProps) {\n\tconst { t } = useTranslation(STOA_NS)\n\tconst { resolvedTheme } = useTheme()\n\tconst current = theme === 'system' ? resolvedTheme : theme\n\n\treturn (\n\t\t<AppNavigationButton\n\t\t\tlabel={label ?? t('app.switchTheme')}\n\t\t\tIcon={Eclipse}\n\t\t\tdisabled={disabled}\n\t\t\tonClick={() => void onToggle(current === 'dark' ? 'light' : 'dark')}\n\t\t/>\n\t)\n}\n\nexport function AppNavigationDivider() {\n\treturn (\n\t\t<div\n\t\t\tdata-slot='app-navigation-divider'\n\t\t\tclassName={styles.divider}\n\t\t\taria-hidden='true'\n\t\t/>\n\t)\n}\n\nfunction renderGroups(\n\tgroups: readonly AppNavigationGroup[],\n\tkeyPrefix: string,\n) {\n\treturn groups.map((group, groupIndex) => (\n\t\t// biome-ignore lint/suspicious/noArrayIndexKey: groups are static configuration\n\t\t<Fragment key={`${keyPrefix}-${groupIndex}`}>\n\t\t\t{groupIndex > 0 && <AppNavigationDivider />}\n\t\t\t{group.map((entry, index) => {\n\t\t\t\tif (isLink(entry))\n\t\t\t\t\treturn <AppNavigationItem key={entry.path} {...entry} />\n\t\t\t\tif (isAction(entry))\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<AppNavigationButton key={entry.id ?? entry.label} {...entry} />\n\t\t\t\t\t)\n\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: custom nodes have no identity\n\t\t\t\treturn <Fragment key={index}>{entry}</Fragment>\n\t\t\t})}\n\t\t</Fragment>\n\t))\n}\n\nexport function AppNavigation({\n\tgroups,\n\tlogo,\n\tfooterGroups,\n\tlabel,\n\tclassName,\n}: AppNavigationProps) {\n\tconst { t } = useTranslation(STOA_NS)\n\n\treturn (\n\t\t<nav\n\t\t\tdata-slot='app-navigation'\n\t\t\taria-label={label ?? t('app.navigation')}\n\t\t\tclassName={cn(styles.root, className)}\n\t\t>\n\t\t\t{typeof logo === 'string' ? (\n\t\t\t\t<img\n\t\t\t\t\tsrc={logo}\n\t\t\t\t\tdata-slot='app-navigation-logo'\n\t\t\t\t\tclassName={styles.logo}\n\t\t\t\t\talt=''\n\t\t\t\t\taria-hidden='true'\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\tlogo\n\t\t\t)}\n\t\t\t{renderGroups(groups, 'main')}\n\t\t\t{footerGroups && footerGroups.length > 0 && (\n\t\t\t\t<>\n\t\t\t\t\t<div className={styles.spacer} />\n\t\t\t\t\t{renderGroups(footerGroups, 'footer')}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</nav>\n\t)\n}\n"],"names":["isLink","entry","isAction","ItemTooltip","label","children","Tooltip","jsx","TooltipTrigger","TooltipContent","AppNavigationItem","path","Icon","isActive","disabled","pathname","useLocation","active","Button","cn","styles","Link","AppNavigationButton","onClick","AppNavigationThemeToggle","onToggle","theme","t","useTranslation","STOA_NS","resolvedTheme","useTheme","current","Eclipse","AppNavigationDivider","renderGroups","groups","keyPrefix","group","groupIndex","jsxs","Fragment","index","AppNavigation","logo","footerGroups","className"],"mappings":";;;;;;;;;;;AAgDA,SAASA,EAAOC,GAAuD;AACtE,SACC,OAAOA,KAAU,YACjBA,MAAU,QACV,UAAUA,KACV,UAAUA;AAEZ;AAEA,SAASC,EAASD,GAAyD;AAC1E,SACC,OAAOA,KAAU,YACjBA,MAAU,QACV,aAAaA,KACb,UAAUA;AAEZ;AAEA,SAASE,EAAY;AAAA,EACpB,OAAAC;AAAA,EACA,UAAAC;AACD,GAGG;AACF,2BACEC,GAAA,EACA,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAA,EAAe,SAAO,IAAE,UAAAH,EAAA,CAAS;AAAA,IAClC,gBAAAE,EAACE,GAAA,EAAe,MAAK,SAAS,UAAAL,EAAA,CAAM;AAAA,EAAA,GACrC;AAEF;AAEO,SAASM,EAAkB;AAAA,EACjC,MAAAC;AAAA,EACA,OAAAP;AAAA,EACA,MAAAQ;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AACD,GAAsB;AACrB,QAAM,EAAE,UAAAC,EAAA,IAAaC,EAAA,GACfC,IAASJ,IAAWA,EAASE,CAAQ,IAAIA,MAAaJ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B,CAAS;AAAA,MAEnC,UAAA;AAAA,QAAA,OAAOF,KAAS,WAChB,gBAAArC;AAAA,UAAC;AAAA,UAAA;AAAA,YACA,KAAKqC;AAAA,YACL,aAAU;AAAA,YACV,WAAWxB,EAAO;AAAA,YAClB,KAAI;AAAA,YACJ,eAAY;AAAA,UAAA;AAAA,QAAA,IAGbwB;AAAA,QAEAT,EAAaC,GAAQ,MAAM;AAAA,QAC3BS,KAAgBA,EAAa,SAAS,KACtC,gBAAAL,EAAAC,GAAA,EACC,UAAA;AAAA,UAAA,gBAAAlC,EAAC,OAAA,EAAI,WAAWa,EAAO,OAAA,CAAQ;AAAA,UAC9Be,EAAaU,GAAc,QAAQ;AAAA,QAAA,EAAA,CACrC;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIJ;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/shell/AppNavigation/index.tsx"],"sourcesContent":["import type { LucideIcon } from 'lucide-react'\nimport { useTheme } from 'next-themes'\nimport { Fragment, type ReactNode } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { Link, useLocation } from 'react-router'\nimport { STOA_NS } from '../../i18n/namespace'\nimport { Button } from '../../ui/button'\nimport { ThemeToggle } from '../../ui/theme-toggle'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../../ui/tooltip'\nimport { cn } from '../../utils/cn'\nimport styles from './AppNavigation.module.scss'\n\ntype ItemBase = {\n\t/** Translated label, used for tooltip and aria-label. */\n\tlabel: string\n\tIcon: LucideIcon\n\tdisabled?: boolean\n}\n\nexport type AppNavigationLink = ItemBase & {\n\tpath: string\n\t/** Custom active matcher, e.g. to keep \"Library\" active on `/books/:id`. */\n\tisActive?: (pathname: string) => boolean\n}\n\nexport type AppNavigationAction = ItemBase & {\n\tonClick: () => void\n\t/** Stable React key; defaults to the label. */\n\tid?: string\n}\n\nexport type AppNavigationEntry =\n\t| AppNavigationLink\n\t| AppNavigationAction\n\t| ReactNode\n\n/** Groups are rendered top to bottom and separated by dividers. */\nexport type AppNavigationGroup = readonly AppNavigationEntry[]\n\nexport interface AppNavigationProps {\n\tgroups: readonly AppNavigationGroup[]\n\t/** Image URL or custom node rendered above the first group. */\n\tlogo?: string | ReactNode\n\t/** Groups pinned to the bottom of the bar. */\n\tfooterGroups?: readonly AppNavigationGroup[]\n\tlabel?: string\n\tclassName?: string\n}\n\nfunction isLink(entry: AppNavigationEntry): entry is AppNavigationLink {\n\treturn (\n\t\ttypeof entry === 'object' &&\n\t\tentry !== null &&\n\t\t'path' in entry &&\n\t\t'Icon' in entry\n\t)\n}\n\nfunction isAction(entry: AppNavigationEntry): entry is AppNavigationAction {\n\treturn (\n\t\ttypeof entry === 'object' &&\n\t\tentry !== null &&\n\t\t'onClick' in entry &&\n\t\t'Icon' in entry\n\t)\n}\n\nfunction ItemTooltip({\n\tlabel,\n\tchildren,\n}: {\n\tlabel: string\n\tchildren: ReactNode\n}) {\n\treturn (\n\t\t<Tooltip>\n\t\t\t<TooltipTrigger asChild>{children}</TooltipTrigger>\n\t\t\t<TooltipContent side='right'>{label}</TooltipContent>\n\t\t</Tooltip>\n\t)\n}\n\nexport function AppNavigationItem({\n\tpath,\n\tlabel,\n\tIcon,\n\tisActive,\n\tdisabled,\n}: AppNavigationLink) {\n\tconst { pathname } = useLocation()\n\tconst active = isActive ? isActive(pathname) : pathname === path\n\n\treturn (\n\t\t<ItemTooltip label={label}>\n\t\t\t<Button\n\t\t\t\tvariant='ghost'\n\t\t\t\tsize='icon'\n\t\t\t\tdata-nav-item=''\n\t\t\t\tclassName={cn(styles.menuButton, 'rounded-xl')}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tasChild={!disabled}\n\t\t\t>\n\t\t\t\t{disabled ? (\n\t\t\t\t\t<Icon className='size-4' strokeWidth={1.75} />\n\t\t\t\t) : (\n\t\t\t\t\t<Link\n\t\t\t\t\t\tto={path}\n\t\t\t\t\t\taria-label={label}\n\t\t\t\t\t\taria-current={active ? 'page' : undefined}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon className='size-4' strokeWidth={1.75} />\n\t\t\t\t\t</Link>\n\t\t\t\t)}\n\t\t\t</Button>\n\t\t</ItemTooltip>\n\t)\n}\n\nexport function AppNavigationButton({\n\tlabel,\n\tIcon,\n\tonClick,\n\tdisabled,\n}: AppNavigationAction) {\n\treturn (\n\t\t<ItemTooltip label={label}>\n\t\t\t<Button\n\t\t\t\tvariant='ghost'\n\t\t\t\tsize='icon'\n\t\t\t\tdata-nav-item=''\n\t\t\t\tclassName={cn(styles.menuButton, 'rounded-xl')}\n\t\t\t\taria-label={label}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tonClick={onClick}\n\t\t\t>\n\t\t\t\t<Icon className='size-4' strokeWidth={1.75} />\n\t\t\t</Button>\n\t\t</ItemTooltip>\n\t)\n}\n\nexport interface AppNavigationThemeToggleProps {\n\t/** Persist the new theme (settings file, autosave, …). `next-themes` is updated by the app. */\n\tonToggle: (theme: 'light' | 'dark') => void | Promise<void>\n\t/** Current stored preference; `system` resolves via `next-themes`. */\n\ttheme?: 'light' | 'dark' | 'system'\n\tdisabled?: boolean\n\tlabel?: string\n}\n\nexport function AppNavigationThemeToggle({\n\tonToggle,\n\ttheme = 'system',\n\tdisabled,\n\tlabel,\n}: AppNavigationThemeToggleProps) {\n\tconst { t } = useTranslation(STOA_NS)\n\tconst { resolvedTheme } = useTheme()\n\tconst current = theme === 'system' ? resolvedTheme : theme\n\tconst toggleLabel = label ?? t('app.switchTheme')\n\n\treturn (\n\t\t<ItemTooltip label={toggleLabel}>\n\t\t\t<ThemeToggle\n\t\t\t\tvariant='ghost'\n\t\t\t\tdata-nav-item=''\n\t\t\t\tclassName={cn(styles.menuButton, 'rounded-xl')}\n\t\t\t\ttheme={current === 'dark' ? 'dark' : 'light'}\n\t\t\t\tlabel={toggleLabel}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tonToggle={onToggle}\n\t\t\t/>\n\t\t</ItemTooltip>\n\t)\n}\n\nexport function AppNavigationDivider() {\n\treturn (\n\t\t<div\n\t\t\tdata-slot='app-navigation-divider'\n\t\t\tclassName={styles.divider}\n\t\t\taria-hidden='true'\n\t\t/>\n\t)\n}\n\nfunction renderGroups(\n\tgroups: readonly AppNavigationGroup[],\n\tkeyPrefix: string,\n) {\n\treturn groups.map((group, groupIndex) => (\n\t\t// biome-ignore lint/suspicious/noArrayIndexKey: groups are static configuration\n\t\t<Fragment key={`${keyPrefix}-${groupIndex}`}>\n\t\t\t{groupIndex > 0 && <AppNavigationDivider />}\n\t\t\t{group.map((entry, index) => {\n\t\t\t\tif (isLink(entry))\n\t\t\t\t\treturn <AppNavigationItem key={entry.path} {...entry} />\n\t\t\t\tif (isAction(entry))\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<AppNavigationButton key={entry.id ?? entry.label} {...entry} />\n\t\t\t\t\t)\n\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: custom nodes have no identity\n\t\t\t\treturn <Fragment key={index}>{entry}</Fragment>\n\t\t\t})}\n\t\t</Fragment>\n\t))\n}\n\nexport function AppNavigation({\n\tgroups,\n\tlogo,\n\tfooterGroups,\n\tlabel,\n\tclassName,\n}: AppNavigationProps) {\n\tconst { t } = useTranslation(STOA_NS)\n\n\treturn (\n\t\t<nav\n\t\t\tdata-slot='app-navigation'\n\t\t\taria-label={label ?? t('app.navigation')}\n\t\t\tclassName={cn(styles.root, className)}\n\t\t>\n\t\t\t{typeof logo === 'string' ? (\n\t\t\t\t<img\n\t\t\t\t\tsrc={logo}\n\t\t\t\t\tdata-slot='app-navigation-logo'\n\t\t\t\t\tclassName={styles.logo}\n\t\t\t\t\talt=''\n\t\t\t\t\taria-hidden='true'\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\tlogo\n\t\t\t)}\n\t\t\t{renderGroups(groups, 'main')}\n\t\t\t{footerGroups && footerGroups.length > 0 && (\n\t\t\t\t<>\n\t\t\t\t\t<div className={styles.spacer} />\n\t\t\t\t\t{renderGroups(footerGroups, 'footer')}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</nav>\n\t)\n}\n"],"names":["isLink","entry","isAction","ItemTooltip","label","children","Tooltip","jsx","TooltipTrigger","TooltipContent","AppNavigationItem","path","Icon","isActive","disabled","pathname","useLocation","active","Button","cn","styles","Link","AppNavigationButton","onClick","AppNavigationThemeToggle","onToggle","theme","t","useTranslation","STOA_NS","resolvedTheme","useTheme","current","toggleLabel","ThemeToggle","AppNavigationDivider","renderGroups","groups","keyPrefix","group","groupIndex","jsxs","Fragment","index","AppNavigation","logo","footerGroups","className"],"mappings":";;;;;;;;;;;AAiDA,SAASA,EAAOC,GAAuD;AACtE,SACC,OAAOA,KAAU,YACjBA,MAAU,QACV,UAAUA,KACV,UAAUA;AAEZ;AAEA,SAASC,EAASD,GAAyD;AAC1E,SACC,OAAOA,KAAU,YACjBA,MAAU,QACV,aAAaA,KACb,UAAUA;AAEZ;AAEA,SAASE,EAAY;AAAA,EACpB,OAAAC;AAAA,EACA,UAAAC;AACD,GAGG;AACF,2BACEC,GAAA,EACA,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAA,EAAe,SAAO,IAAE,UAAAH,EAAA,CAAS;AAAA,IAClC,gBAAAE,EAACE,GAAA,EAAe,MAAK,SAAS,UAAAL,EAAA,CAAM;AAAA,EAAA,GACrC;AAEF;AAEO,SAASM,EAAkB;AAAA,EACjC,MAAAC;AAAA,EACA,OAAAP;AAAA,EACA,MAAAQ;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AACD,GAAsB;AACrB,QAAM,EAAE,UAAAC,EAAA,IAAaC,EAAA,GACfC,IAASJ,IAAWA,EAASE,CAAQ,IAAIA,MAAaJ;AAE5D,SACC,gBAAAJ,EAACJ,KAAY,OAAAC,GACZ,UAAA,gBAAAG;AAAA,IAACW;AAAA,IAAA;AAAA,MACA,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,iBAAc;AAAA,MACd,WAAWC,EAAGC,EAAO,YAAY,YAAY;AAAA,MAC7C,U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AAAA,UAAA;AAAA,YACA,KAAKsC;AAAA,YACL,aAAU;AAAA,YACV,WAAWzB,EAAO;AAAA,YAClB,KAAI;AAAA,YACJ,eAAY;AAAA,UAAA;AAAA,QAAA,IAGbyB;AAAA,QAEAT,EAAaC,GAAQ,MAAM;AAAA,QAC3BS,KAAgBA,EAAa,SAAS,KACtC,gBAAAL,EAAAC,GAAA,EACC,UAAA;AAAA,UAAA,gBAAAnC,EAAC,OAAA,EAAI,WAAWa,EAAO,OAAA,CAAQ;AAAA,UAC9BgB,EAAaU,GAAc,QAAQ;AAAA,QAAA,EAAA,CACrC;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIJ;"}
@@ -0,0 +1,24 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { ArrowLeft as m } from "lucide-react";
3
+ import { useTranslation as f } from "react-i18next";
4
+ import { useNavigate as s } from "react-router";
5
+ import { useRouting as p } from "../../hooks/useRouting/index.js";
6
+ import { STOA_NS as u } from "../../i18n/namespace.js";
7
+ import { Button as c } from "../../ui/button/index.js";
8
+ function h({ strict: t = !1, to: r = "/", label: i }) {
9
+ const a = s(), { routeToDefault: n } = p(r), { t: e } = f(u);
10
+ return /* @__PURE__ */ o(
11
+ c,
12
+ {
13
+ variant: "ghost",
14
+ size: "icon",
15
+ "aria-label": i ?? e("app.back"),
16
+ onClick: () => t ? a(-1) : n,
17
+ children: /* @__PURE__ */ o(m, {})
18
+ }
19
+ );
20
+ }
21
+ export {
22
+ h as BackButton
23
+ };
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/shell/BackButton/index.tsx"],"sourcesContent":["import { ArrowLeft } from 'lucide-react'\nimport { useTranslation } from 'react-i18next'\nimport { useNavigate } from 'react-router'\nimport { useRouting } from '../../hooks/useRouting'\nimport { STOA_NS } from '../../i18n/namespace'\nimport { Button } from '../../ui/button'\n\nexport interface BackButtonProps {\n\t/** Route to return to. Defaults to `/`. */\n\tstrict?: boolean\n\tto?: string\n\tlabel?: string\n}\n\nexport function BackButton({ strict = false, to = '/', label }: BackButtonProps) {\n\tconst navigate = useNavigate()\n\tconst { routeToDefault } = useRouting(to)\n\tconst { t } = useTranslation(STOA_NS)\n\n\treturn (\n\t\t<Button\n\t\t\tvariant='ghost'\n\t\t\tsize='icon'\n\t\t\taria-label={label ?? t('app.back')}\n\t\t\tonClick={() => strict ? navigate(-1) : routeToDefault}\n\t\t>\n\t\t\t<ArrowLeft />\n\t\t</Button>\n\t)\n}\n"],"names":["BackButton","strict","to","label","navigate","useNavigate","routeToDefault","useRouting","t","useTranslation","STOA_NS","jsx","Button","ArrowLeft"],"mappings":";;;;;;;AAcO,SAASA,EAAW,EAAE,QAAAC,IAAS,IAAO,IAAAC,IAAK,KAAK,OAAAC,KAA0B;AAChF,QAAMC,IAAWC,EAAA,GACX,EAAE,gBAAAC,EAAA,IAAmBC,EAAWL,CAAE,GAClC,EAAE,GAAAM,EAAA,IAAMC,EAAeC,CAAO;AAEpC,SACC,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACA,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,cAAYT,KAASK,EAAE,UAAU;AAAA,MACjC,SAAS,MAAMP,IAASG,EAAS,EAAE,IAAIE;AAAA,MAEvC,4BAACO,GAAA,CAAA,CAAU;AAAA,IAAA;AAAA,EAAA;AAGd;"}
@@ -1,118 +1,9 @@
1
- import { jsxs as R, jsx as x } from "react/jsx-runtime";
2
- import { useReducedMotion as z, motion as A } from "motion/react";
3
- import { useState as w, useRef as N, useCallback as O, useEffect as B } from "react";
4
- import { useTranslation as F } from "react-i18next";
5
- import { useLocation as $, Link as j } from "react-router";
6
- import { STOA_NS as I } from "../../i18n/namespace.js";
7
- const q = 125, U = 75;
8
- function S(r) {
9
- let e = r?.parentElement;
10
- for (; e; ) {
11
- if (/(auto|scroll)/.test(getComputedStyle(e).overflowY)) return e;
12
- e = e.parentElement;
13
- }
14
- return null;
15
- }
16
- function K({
17
- scrollContainerRef: r,
18
- sections: e,
19
- label: k
20
- }) {
21
- const [E, T] = w(!1), H = z() ?? !1, { t: M } = F(I), { hash: d } = $(), m = N(null), [g, y] = w(
22
- e[0]?.id ?? ""
23
- ), f = O(
24
- (t) => {
25
- const o = S(r.current), a = m.current, n = document.getElementById(t);
26
- if (!o || !a || !n) return;
27
- const l = o.scrollTop + n.getBoundingClientRect().top - o.getBoundingClientRect().top - a.offsetHeight - 16;
28
- o.scrollTo({ top: Math.max(0, l) }), n.focus({ preventScroll: !0 });
29
- },
30
- [r]
31
- );
32
- return B(() => {
33
- const t = S(r.current), o = m.current;
34
- if (!t || !o) return;
35
- const a = e.map(({ id: i }) => document.getElementById(i));
36
- let n;
37
- function l() {
38
- if (n = void 0, !t || !o) return;
39
- T(
40
- (s) => s ? t.scrollTop > U : t.scrollTop >= q
41
- );
42
- let i = e[0]?.id ?? "", p = 0;
43
- const v = t.getBoundingClientRect(), C = Math.max(
44
- v.top,
45
- o.getBoundingClientRect().bottom
46
- ), L = Math.min(v.bottom, window.innerHeight);
47
- for (const s of a) {
48
- if (!s) continue;
49
- const h = s.getBoundingClientRect(), b = Math.max(
50
- 0,
51
- Math.min(h.bottom, L) - Math.max(h.top, C)
52
- );
53
- b > p && (p = b, i = s.id);
54
- }
55
- t.scrollHeight > t.clientHeight && t.scrollHeight - t.clientHeight - t.scrollTop <= 2 && (i = e[e.length - 1]?.id ?? ""), y(i);
56
- }
57
- function c() {
58
- n === void 0 && (n = requestAnimationFrame(l));
59
- }
60
- document.addEventListener("scroll", c, {
61
- capture: !0,
62
- passive: !0
63
- }), window.addEventListener("resize", c);
64
- const u = new ResizeObserver(c);
65
- u.observe(t), u.observe(o);
66
- for (const i of a) i && u.observe(i);
67
- return l(), () => {
68
- document.removeEventListener("scroll", c, !0), window.removeEventListener("resize", c), n !== void 0 && cancelAnimationFrame(n), u.disconnect();
69
- };
70
- }, [r, e]), B(() => {
71
- const t = d.slice(1);
72
- e.some((o) => o.id === t) && f(t);
73
- }, [d, f, e]), e.length === 0 ? null : /* @__PURE__ */ R(
74
- "nav",
75
- {
76
- ref: m,
77
- "data-slot": "section-navigation",
78
- "aria-label": k ?? M("app.navigation"),
79
- className: "sticky top-1 z-20 isolate m-1 mt-4 flex flex-wrap gap-1 rounded-xl p-2",
80
- children: [
81
- /* @__PURE__ */ x(
82
- A.div,
83
- {
84
- "aria-hidden": "true",
85
- className: "pointer-events-none absolute inset-0 -z-10 rounded-xl bg-background/25 shadow-sm backdrop-blur-xs",
86
- initial: !1,
87
- animate: { opacity: E ? 1 : 0 },
88
- transition: { duration: H ? 0 : 0.2, ease: "easeOut" }
89
- }
90
- ),
91
- e.map(({ id: t, label: o }) => /* @__PURE__ */ x(
92
- j,
93
- {
94
- to: `#${t}`,
95
- replace: !0,
96
- "data-slot": "section-navigation-link",
97
- "aria-current": g === t ? "location" : void 0,
98
- onClick: () => {
99
- d === `#${t}` && f(t);
100
- },
101
- className: `
102
- rounded-full px-3 py-2
103
- text-sm font-medium transition-colors
104
- outline-none focus-visible:ring-2 focus-visible:ring-ring
105
- ${g === t ? "bg-(--section-active) text-foreground" : "text-muted-foreground hover:bg-muted hover:text-foreground"}
106
- `,
107
- children: o
108
- },
109
- t
110
- ))
111
- ]
112
- }
113
- );
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { SubNavigation as i } from "../SubNavigation/index.js";
3
+ function a(o) {
4
+ return /* @__PURE__ */ t(i, { ...o, floating: !0 });
114
5
  }
115
6
  export {
116
- K as SectionNavigation
7
+ a as SectionNavigation
117
8
  };
118
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/shell/SectionNavigation/index.tsx"],"sourcesContent":["import { motion, useReducedMotion } from 'motion/react'\nimport { type RefObject, useCallback, useEffect, useRef, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { Link, useLocation } from 'react-router'\nimport { STOA_NS } from '../../i18n/namespace'\n\nexport type NavigationSection = { id: string; label: string }\n\nconst showBackgroundOffset = 125\nconst hideBackgroundOffset = 75\n\nfunction getScrollContainer(content: HTMLElement | null) {\n\tlet parent = content?.parentElement\n\twhile (parent) {\n\t\tif (/(auto|scroll)/.test(getComputedStyle(parent).overflowY)) return parent\n\t\tparent = parent.parentElement\n\t}\n\treturn null\n}\n\nexport interface SectionNavigationProps {\n\tsections: readonly NavigationSection[]\n\tlabel?: string\n\tscrollContainerRef: RefObject<HTMLDivElement | null>\n}\n\nexport function SectionNavigation({\n\tscrollContainerRef,\n\tsections,\n\tlabel,\n}: SectionNavigationProps) {\n\tconst [showBackground, setShowBackground] = useState(false)\n\tconst reducedMotion = useReducedMotion() ?? false\n\tconst { t } = useTranslation(STOA_NS)\n\tconst { hash } = useLocation()\n\tconst navigationRef = useRef<HTMLElement>(null)\n\tconst [activeSection, setActiveSection] = useState<string>(\n\t\tsections[0]?.id ?? '',\n\t)\n\n\tconst scrollToSection = useCallback(\n\t\t(id: string) => {\n\t\t\tconst container = getScrollContainer(scrollContainerRef.current)\n\t\t\tconst navigation = navigationRef.current\n\t\t\tconst section = document.getElementById(id)\n\n\t\t\tif (!container || !navigation || !section) return\n\n\t\t\tconst top =\n\t\t\t\tcontainer.scrollTop +\n\t\t\t\tsection.getBoundingClientRect().top -\n\t\t\t\tcontainer.getBoundingClientRect().top -\n\t\t\t\tnavigation.offsetHeight -\n\t\t\t\t16\n\t\t\tcontainer.scrollTo({ top: Math.max(0, top) })\n\t\t\tsection.focus({ preventScroll: true })\n\t\t},\n\t\t[scrollContainerRef],\n\t)\n\n\tuseEffect(() => {\n\t\tconst container = getScrollContainer(scrollContainerRef.current)\n\t\tconst navigation = navigationRef.current\n\n\t\tif (!container || !navigation) return\n\n\t\tconst targets = sections.map(({ id }) => document.getElementById(id))\n\t\tlet animationFrame: number | undefined\n\n\t\tfunction updateActiveSection() {\n\t\t\tanimationFrame = undefined\n\n\t\t\tif (!container || !navigation) return\n\n\t\t\tsetShowBackground((visible) =>\n\t\t\t\tvisible\n\t\t\t\t\t? container.scrollTop > hideBackgroundOffset\n\t\t\t\t\t: container.scrollTop >= showBackgroundOffset,\n\t\t\t)\n\n\t\t\tlet active: string = sections[0]?.id ?? ''\n\t\t\tlet largestVisibleHeight = 0\n\t\t\tconst viewport = container.getBoundingClientRect()\n\t\t\tconst visibleTop = Math.max(\n\t\t\t\tviewport.top,\n\t\t\t\tnavigation.getBoundingClientRect().bottom,\n\t\t\t)\n\t\t\tconst visibleBottom = Math.min(viewport.bottom, window.innerHeight)\n\n\t\t\tfor (const section of targets) {\n\t\t\t\tif (!section) continue\n\t\t\t\tconst bounds = section.getBoundingClientRect()\n\t\t\t\tconst visibleHeight = Math.max(\n\t\t\t\t\t0,\n\t\t\t\t\tMath.min(bounds.bottom, visibleBottom) -\n\t\t\t\t\t\tMath.max(bounds.top, visibleTop),\n\t\t\t\t)\n\t\t\t\tif (visibleHeight > largestVisibleHeight) {\n\t\t\t\t\tlargestVisibleHeight = visibleHeight\n\t\t\t\t\tactive = section.id\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tcontainer.scrollHeight > container.clientHeight &&\n\t\t\t\tcontainer.scrollHeight - container.clientHeight - container.scrollTop <=\n\t\t\t\t\t2\n\t\t\t) {\n\t\t\t\tactive = sections[sections.length - 1]?.id ?? ''\n\t\t\t}\n\t\t\tsetActiveSection(active)\n\t\t}\n\n\t\tfunction scheduleUpdate() {\n\t\t\tif (animationFrame === undefined)\n\t\t\t\tanimationFrame = requestAnimationFrame(updateActiveSection)\n\t\t}\n\n\t\t// Capture scrolls from the page and its ancestors, including native WebView scrolling.\n\t\tdocument.addEventListener('scroll', scheduleUpdate, {\n\t\t\tcapture: true,\n\t\t\tpassive: true,\n\t\t})\n\n\t\twindow.addEventListener('resize', scheduleUpdate)\n\t\tconst observer = new ResizeObserver(scheduleUpdate)\n\t\tobserver.observe(container)\n\t\tobserver.observe(navigation)\n\t\tfor (const target of targets) if (target) observer.observe(target)\n\t\tupdateActiveSection()\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('scroll', scheduleUpdate, true)\n\t\t\twindow.removeEventListener('resize', scheduleUpdate)\n\t\t\tif (animationFrame !== undefined) cancelAnimationFrame(animationFrame)\n\t\t\tobserver.disconnect()\n\t\t}\n\t}, [scrollContainerRef, sections])\n\n\tuseEffect(() => {\n\t\tconst id = hash.slice(1)\n\t\tif (sections.some((section) => section.id === id)) scrollToSection(id)\n\t}, [hash, scrollToSection, sections])\n\n\tif (sections.length === 0) return null\n\n\treturn (\n\t\t<nav\n\t\t\tref={navigationRef}\n\t\t\tdata-slot='section-navigation'\n\t\t\taria-label={label ?? t('app.navigation')}\n\t\t\tclassName='sticky top-1 z-20 isolate m-1 mt-4 flex flex-wrap gap-1 rounded-xl p-2'\n\t\t>\n\t\t\t<motion.div\n\t\t\t\taria-hidden='true'\n\t\t\t\tclassName='pointer-events-none absolute inset-0 -z-10 rounded-xl bg-background/25 shadow-sm backdrop-blur-xs'\n\t\t\t\tinitial={false}\n\t\t\t\tanimate={{ opacity: showBackground ? 1 : 0 }}\n\t\t\t\ttransition={{ duration: reducedMotion ? 0 : 0.2, ease: 'easeOut' }}\n\t\t\t/>\n\t\t\t{sections.map(({ id, label }) => (\n\t\t\t\t<Link\n\t\t\t\t\tkey={id}\n\t\t\t\t\tto={`#${id}`}\n\t\t\t\t\treplace\n\t\t\t\t\tdata-slot='section-navigation-link'\n\t\t\t\t\taria-current={activeSection === id ? 'location' : undefined}\n\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\tif (hash === `#${id}`) scrollToSection(id)\n\t\t\t\t\t}}\n\t\t\t\t\tclassName={`\n\t\t\t\t\t\trounded-full px-3 py-2\n\t\t\t\t\t\ttext-sm font-medium transition-colors\n\t\t\t\t\t\toutline-none focus-visible:ring-2 focus-visible:ring-ring\n\t\t\t\t\t\t${\n\t\t\t\t\t\t\tactiveSection === id\n\t\t\t\t\t\t\t\t? 'bg-(--section-active) text-foreground'\n\t\t\t\t\t\t\t\t: 'text-muted-foreground hover:bg-muted hover:text-foreground'\n\t\t\t\t\t\t}\n\t\t\t\t\t`}\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t</Link>\n\t\t\t))}\n\t\t</nav>\n\t)\n}\n"],"names":["showBackgroundOffset","hideBackgroundOffset","getScrollContainer","content","parent","SectionNavigation","scrollContainerRef","sections","label","showBackground","setShowBackground","useState","reducedMotion","useReducedMotion","t","useTranslation","STOA_NS","hash","useLocation","navigationRef","useRef","activeSection","setActiveSection","scrollToSection","useCallback","id","container","navigation","section","top","useEffect","targets","animationFrame","updateActiveSection","visible","active","largestVisibleHeight","viewport","visibleTop","visibleBottom","bounds","visibleHeight","scheduleUpdate","observer","target","jsxs","jsx","motion","Link"],"mappings":";;;;;;AAQA,MAAMA,IAAuB,KACvBC,IAAuB;AAE7B,SAASC,EAAmBC,GAA6B;AACxD,MAAIC,IAASD,GAAS;AACtB,SAAOC,KAAQ;AACd,QAAI,gBAAgB,KAAK,iBAAiBA,CAAM,EAAE,SAAS,EAAG,QAAOA;AACrE,IAAAA,IAASA,EAAO;AAAA,EACjB;AACA,SAAO;AACR;AAQO,SAASC,EAAkB;AAAA,EACjC,oBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AACD,GAA2B;AAC1B,QAAM,CAACC,GAAgBC,CAAiB,IAAIC,EAAS,EAAK,GACpDC,IAAgBC,OAAsB,IACtC,EAAE,GAAAC,EAAA,IAAMC,EAAeC,CAAO,GAC9B,EAAE,MAAAC,EAAA,IAASC,EAAA,GACXC,IAAgBC,EAAoB,IAAI,GACxC,CAACC,GAAeC,CAAgB,IAAIX;AAAA,IACzCJ,EAAS,CAAC,GAAG,MAAM;AAAA,EAAA,GAGdgB,IAAkBC;AAAA,IACvB,CAACC,MAAe;AACf,YAAMC,IAAYxB,EAAmBI,EAAmB,OAAO,GACzDqB,IAAaR,EAAc,SAC3BS,IAAU,SAAS,eAAeH,CAAE;AAE1C,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AS,EAAE,SAAStC,IAAiB,IAAI,EAAA;AAAA,YACzC,YAAY,EAAE,UAAUG,IAAgB,IAAI,KAAK,MAAM,UAAA;AAAA,UAAU;AAAA,QAAA;AAAA,QAEjEL,EAAS,IAAI,CAAC,EAAE,IAAAkB,GAAI,OAAAjB,QACpB,gBAAAsC;AAAA,UAACE;AAAA,UAAA;AAAA,YAEA,IAAI,IAAIvB,CAAE;AAAA,YACV,SAAO;AAAA,YACP,aAAU;AAAA,YACV,gBAAcJ,MAAkBI,IAAK,aAAa;AAAA,YAClD,SAAS,MAAM;AACd,cAAIR,MAAS,IAAIQ,CAAE,QAAoBA,CAAE;AAAA,YAC1C;AAAA,YACA,WAAW;AAAA;AAAA;AAAA;AAAA,QAKTJ,MAAkBI,IACf,0CACA,4DACJ;AAAA;AAAA,YAGA,UAAAjB;AAAAA,UAAA;AAAA,UAnBIiB;AAAA,QAAA,CAqBN;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGJ;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/shell/SectionNavigation/index.tsx"],"sourcesContent":["import { SubNavigation, type SubNavigationProps } from '../SubNavigation'\n\nexport type SectionNavigationProps = Omit<\n\tSubNavigationProps,\n\t'floating' | 'className'\n>\n\n/** @deprecated Use SubNavigation with the floating prop. */\nexport function SectionNavigation(props: SectionNavigationProps) {\n\treturn <SubNavigation {...props} floating />\n}\n"],"names":["SectionNavigation","props","jsx","SubNavigation"],"mappings":";;AAQO,SAASA,EAAkBC,GAA+B;AAChE,SAAO,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GAAO,UAAQ,IAAC;AAC3C;"}
@@ -0,0 +1,158 @@
1
+ import { jsx as e, jsxs as r } from "react/jsx-runtime";
2
+ import { Check as L, ArrowLeft as R, LoaderCircle as T, ArrowRight as B } from "lucide-react";
3
+ import { useState as m, useRef as v, useEffect as D } from "react";
4
+ import { useTranslation as F } from "react-i18next";
5
+ import { STOA_NS as H } from "../../i18n/namespace.js";
6
+ import { Button as w } from "../../ui/button/index.js";
7
+ import { Card as M, CardHeader as O, CardContent as _ } from "../../ui/card/index.js";
8
+ import { cn as u } from "../../utils/cn.js";
9
+ function X({
10
+ steps: n,
11
+ title: y,
12
+ appName: f,
13
+ description: p,
14
+ notice: z,
15
+ footer: x,
16
+ className: S,
17
+ onComplete: W,
18
+ errorMessage: C
19
+ }) {
20
+ const { t: i } = F(H), [j, h] = m(0), [s, g] = m(!1), [k, d] = m(!1), c = v(!1), b = v(null), t = Math.min(j, n.length - 1), a = n[t], I = a?.id, N = t === n.length - 1;
21
+ D(() => {
22
+ b.current?.focus();
23
+ }, [I]);
24
+ async function A(o) {
25
+ if (o.preventDefault(), !c.current) {
26
+ if (d(!1), !N) {
27
+ h(t + 1);
28
+ return;
29
+ }
30
+ c.current = !0, g(!0);
31
+ try {
32
+ await W();
33
+ } catch {
34
+ d(!0);
35
+ } finally {
36
+ c.current = !1, g(!1);
37
+ }
38
+ }
39
+ }
40
+ return a ? /* @__PURE__ */ e(
41
+ "div",
42
+ {
43
+ "data-slot": "setup-wizard",
44
+ className: u("relative bg-background px-4 py-8 sm:px-8", S),
45
+ children: /* @__PURE__ */ r("div", { className: "mx-auto grid w-full max-w-2xl gap-6", children: [
46
+ z,
47
+ /* @__PURE__ */ r("header", { className: "text-center", children: [
48
+ f && /* @__PURE__ */ e("p", { className: "mb-2 text-sm font-medium tracking-widest uppercase", children: f }),
49
+ /* @__PURE__ */ e("h1", { className: "text-3xl font-semibold", children: y }),
50
+ p && /* @__PURE__ */ e("p", { className: "mt-2 text-xs text-muted-foreground", children: p })
51
+ ] }),
52
+ /* @__PURE__ */ e(
53
+ "ol",
54
+ {
55
+ "aria-label": i("setupWizard.progress"),
56
+ className: "flex flex-wrap justify-center gap-3 sm:gap-2",
57
+ children: n.map(({ id: o, title: E }, l) => /* @__PURE__ */ r(
58
+ "li",
59
+ {
60
+ "aria-current": l === t ? "step" : void 0,
61
+ className: "grid w-24 justify-items-center gap-2 text-center sm:min-w-0 sm:flex-1",
62
+ children: [
63
+ /* @__PURE__ */ e(
64
+ "span",
65
+ {
66
+ "aria-hidden": "true",
67
+ className: u(
68
+ "flex size-8 items-center justify-center rounded-full text-sm font-medium",
69
+ l <= t ? "bg-primary text-primary-foreground" : "border bg-card text-muted-foreground"
70
+ ),
71
+ children: l < t ? /* @__PURE__ */ e(L, { className: "size-4" }) : l + 1
72
+ }
73
+ ),
74
+ /* @__PURE__ */ e(
75
+ "span",
76
+ {
77
+ className: u(
78
+ "w-full text-xs [overflow-wrap:anywhere]",
79
+ l === t ? "font-semibold" : "text-muted-foreground"
80
+ ),
81
+ children: E
82
+ }
83
+ )
84
+ ]
85
+ },
86
+ o
87
+ ))
88
+ }
89
+ ),
90
+ /* @__PURE__ */ r(M, { children: [
91
+ /* @__PURE__ */ r(O, { children: [
92
+ /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: i("setupWizard.step", {
93
+ current: t + 1,
94
+ total: n.length
95
+ }) }),
96
+ /* @__PURE__ */ e(
97
+ "h2",
98
+ {
99
+ ref: b,
100
+ tabIndex: -1,
101
+ className: "text-xl font-semibold outline-none",
102
+ children: a.title
103
+ }
104
+ ),
105
+ a.description && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: a.description })
106
+ ] }),
107
+ /* @__PURE__ */ e(_, { children: /* @__PURE__ */ e("form", { onSubmit: A, "aria-busy": s || void 0, children: /* @__PURE__ */ r("fieldset", { disabled: s, className: "grid gap-5", children: [
108
+ /* @__PURE__ */ e("div", { className: "grid gap-4", children: a.content }, a.id),
109
+ k && /* @__PURE__ */ e("p", { role: "alert", className: "text-sm text-destructive", children: C ?? i("setupWizard.saveError") }),
110
+ /* @__PURE__ */ r("div", { className: "mt-1 flex flex-wrap justify-between gap-3 border-t pt-5", children: [
111
+ /* @__PURE__ */ r(
112
+ w,
113
+ {
114
+ type: "button",
115
+ variant: "outline",
116
+ disabled: t === 0 || s,
117
+ onClick: () => {
118
+ d(!1), h(t - 1);
119
+ },
120
+ children: [
121
+ /* @__PURE__ */ e(R, { "aria-hidden": "true" }),
122
+ i("setupWizard.back")
123
+ ]
124
+ }
125
+ ),
126
+ /* @__PURE__ */ r(
127
+ w,
128
+ {
129
+ type: "submit",
130
+ disabled: s,
131
+ className: "h-auto min-h-12 whitespace-normal py-2",
132
+ children: [
133
+ s ? /* @__PURE__ */ e(
134
+ T,
135
+ {
136
+ className: "motion-safe:animate-spin",
137
+ "aria-hidden": "true"
138
+ }
139
+ ) : null,
140
+ s ? i("setupWizard.saving") : a.submitLabel ?? i(
141
+ N ? "setupWizard.finish" : "setupWizard.next"
142
+ ),
143
+ !s && /* @__PURE__ */ e(B, { "aria-hidden": "true" })
144
+ ]
145
+ }
146
+ )
147
+ ] })
148
+ ] }) }) })
149
+ ] }),
150
+ x && /* @__PURE__ */ e("div", { className: "text-center text-xs text-muted-foreground", children: x })
151
+ ] })
152
+ }
153
+ ) : null;
154
+ }
155
+ export {
156
+ X as SetupWizard
157
+ };
158
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/shell/SetupWizard/index.tsx"],"sourcesContent":["import { ArrowLeft, ArrowRight, Check, LoaderCircle } from 'lucide-react'\nimport {\n\ttype FormEvent,\n\ttype ReactNode,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n} from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { STOA_NS } from '../../i18n/namespace'\nimport { Button } from '../../ui/button'\nimport { Card, CardContent, CardHeader } from '../../ui/card'\nimport { cn } from '../../utils/cn'\n\nexport interface SetupWizardStep {\n\tid: string\n\ttitle: string\n\tdescription?: string\n\t/** Only the active step is mounted. Keep field values in the calling app. */\n\tcontent: ReactNode\n\tsubmitLabel?: string\n}\n\nexport interface SetupWizardProps {\n\tsteps: readonly SetupWizardStep[]\n\ttitle: string\n\tappName?: string\n\tdescription?: string\n\tnotice?: ReactNode\n\tfooter?: ReactNode\n\tclassName?: string\n\t/** Persist the setup. Reject to show the error and allow a retry. */\n\tonComplete: () => void | Promise<void>\n\terrorMessage?: string\n}\n\nexport function SetupWizard({\n\tsteps,\n\ttitle,\n\tappName,\n\tdescription,\n\tnotice,\n\tfooter,\n\tclassName,\n\tonComplete,\n\terrorMessage,\n}: SetupWizardProps) {\n\tconst { t } = useTranslation(STOA_NS)\n\tconst [stepIndex, setStepIndex] = useState(0)\n\tconst [saving, setSaving] = useState(false)\n\tconst [error, setError] = useState(false)\n\tconst saveInFlight = useRef(false)\n\tconst headingRef = useRef<HTMLHeadingElement>(null)\n\tconst index = Math.min(stepIndex, steps.length - 1)\n\tconst step = steps[index]\n\tconst stepId = step?.id\n\tconst finalStep = index === steps.length - 1\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: Refocus when the displayed step changes.\n\tuseEffect(() => {\n\t\theadingRef.current?.focus()\n\t}, [stepId])\n\n\tasync function submit(event: FormEvent<HTMLFormElement>) {\n\t\tevent.preventDefault()\n\t\tif (saveInFlight.current) return\n\t\tsetError(false)\n\n\t\tif (!finalStep) {\n\t\t\tsetStepIndex(index + 1)\n\t\t\treturn\n\t\t}\n\n\t\tsaveInFlight.current = true\n\t\tsetSaving(true)\n\t\ttry {\n\t\t\tawait onComplete()\n\t\t} catch {\n\t\t\tsetError(true)\n\t\t} finally {\n\t\t\tsaveInFlight.current = false\n\t\t\tsetSaving(false)\n\t\t}\n\t}\n\n\tif (!step) return null\n\n\treturn (\n\t\t<div\n\t\t\tdata-slot='setup-wizard'\n\t\t\tclassName={cn('relative bg-background px-4 py-8 sm:px-8', className)}\n\t\t>\n\t\t\t<div className='mx-auto grid w-full max-w-2xl gap-6'>\n\t\t\t\t{notice}\n\t\t\t\t<header className='text-center'>\n\t\t\t\t\t{appName && (\n\t\t\t\t\t\t<p className='mb-2 text-sm font-medium tracking-widest uppercase'>\n\t\t\t\t\t\t\t{appName}\n\t\t\t\t\t\t</p>\n\t\t\t\t\t)}\n\t\t\t\t\t<h1 className='text-3xl font-semibold'>{title}</h1>\n\t\t\t\t\t{description && (\n\t\t\t\t\t\t<p className='mt-2 text-xs text-muted-foreground'>{description}</p>\n\t\t\t\t\t)}\n\t\t\t\t</header>\n\n\t\t\t\t<ol\n\t\t\t\t\taria-label={t('setupWizard.progress')}\n\t\t\t\t\tclassName='flex flex-wrap justify-center gap-3 sm:gap-2'\n\t\t\t\t>\n\t\t\t\t\t{steps.map(({ id, title }, position) => (\n\t\t\t\t\t\t<li\n\t\t\t\t\t\t\tkey={id}\n\t\t\t\t\t\t\taria-current={position === index ? 'step' : undefined}\n\t\t\t\t\t\t\tclassName='grid w-24 justify-items-center gap-2 text-center sm:min-w-0 sm:flex-1'\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\taria-hidden='true'\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t'flex size-8 items-center justify-center rounded-full text-sm font-medium',\n\t\t\t\t\t\t\t\t\tposition <= index\n\t\t\t\t\t\t\t\t\t\t? 'bg-primary text-primary-foreground'\n\t\t\t\t\t\t\t\t\t\t: 'border bg-card text-muted-foreground',\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{position < index ? <Check className='size-4' /> : position + 1}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t'w-full text-xs [overflow-wrap:anywhere]',\n\t\t\t\t\t\t\t\t\tposition === index\n\t\t\t\t\t\t\t\t\t\t? 'font-semibold'\n\t\t\t\t\t\t\t\t\t\t: 'text-muted-foreground',\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{title}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t))}\n\t\t\t\t</ol>\n\n\t\t\t\t<Card>\n\t\t\t\t\t<CardHeader>\n\t\t\t\t\t\t<p className='text-xs text-muted-foreground'>\n\t\t\t\t\t\t\t{t('setupWizard.step', {\n\t\t\t\t\t\t\t\tcurrent: index + 1,\n\t\t\t\t\t\t\t\ttotal: steps.length,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<h2\n\t\t\t\t\t\t\tref={headingRef}\n\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\tclassName='text-xl font-semibold outline-none'\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{step.title}\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t{step.description && (\n\t\t\t\t\t\t\t<p className='text-xs text-muted-foreground'>\n\t\t\t\t\t\t\t\t{step.description}\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</CardHeader>\n\t\t\t\t\t<CardContent>\n\t\t\t\t\t\t<form onSubmit={submit} aria-busy={saving || undefined}>\n\t\t\t\t\t\t\t<fieldset disabled={saving} className='grid gap-5'>\n\t\t\t\t\t\t\t\t<div key={step.id} className='grid gap-4'>\n\t\t\t\t\t\t\t\t\t{step.content}\n\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t{error && (\n\t\t\t\t\t\t\t\t\t<p role='alert' className='text-sm text-destructive'>\n\t\t\t\t\t\t\t\t\t\t{errorMessage ?? t('setupWizard.saveError')}\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t\t<div className='mt-1 flex flex-wrap justify-between gap-3 border-t pt-5'>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\ttype='button'\n\t\t\t\t\t\t\t\t\t\tvariant='outline'\n\t\t\t\t\t\t\t\t\t\tdisabled={index === 0 || saving}\n\t\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\t\tsetError(false)\n\t\t\t\t\t\t\t\t\t\t\tsetStepIndex(index - 1)\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<ArrowLeft aria-hidden='true' />\n\t\t\t\t\t\t\t\t\t\t{t('setupWizard.back')}\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\ttype='submit'\n\t\t\t\t\t\t\t\t\t\tdisabled={saving}\n\t\t\t\t\t\t\t\t\t\tclassName='h-auto min-h-12 whitespace-normal py-2'\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{saving ? (\n\t\t\t\t\t\t\t\t\t\t\t<LoaderCircle\n\t\t\t\t\t\t\t\t\t\t\t\tclassName='motion-safe:animate-spin'\n\t\t\t\t\t\t\t\t\t\t\t\taria-hidden='true'\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t\t{saving\n\t\t\t\t\t\t\t\t\t\t\t? t('setupWizard.saving')\n\t\t\t\t\t\t\t\t\t\t\t: (step.submitLabel ??\n\t\t\t\t\t\t\t\t\t\t\t\tt(\n\t\t\t\t\t\t\t\t\t\t\t\t\tfinalStep ? 'setupWizard.finish' : 'setupWizard.next',\n\t\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t{!saving && <ArrowRight aria-hidden='true' />}\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</fieldset>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t</CardContent>\n\t\t\t\t</Card>\n\t\t\t\t{footer && (\n\t\t\t\t\t<div className='text-center text-xs text-muted-foreground'>\n\t\t\t\t\t\t{footer}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"names":["SetupWizard","steps","title","appName","description","notice","footer","className","onComplete","errorMessage","t","useTranslation","STOA_NS","stepIndex","setStepIndex","useState","saving","setSaving","error","setError","saveInFlight","useRef","headingRef","index","step","stepId","finalStep","useEffect","submit","event","jsx","cn","jsxs","id","position","Check","Card","CardHeader","CardContent","Button","ArrowLeft","LoaderCircle","ArrowRight"],"mappings":";;;;;;;;AAoCO,SAASA,EAAY;AAAA,EAC3B,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC;AACD,GAAqB;AACpB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAeC,CAAO,GAC9B,CAACC,GAAWC,CAAY,IAAIC,EAAS,CAAC,GACtC,CAACC,GAAQC,CAAS,IAAIF,EAAS,EAAK,GACpC,CAACG,GAAOC,CAAQ,IAAIJ,EAAS,EAAK,GAClCK,IAAeC,EAAO,EAAK,GAC3BC,IAAaD,EAA2B,IAAI,GAC5CE,IAAQ,KAAK,IAAIV,GAAWZ,EAAM,SAAS,CAAC,GAC5CuB,IAAOvB,EAAMsB,CAAK,GAClBE,IAASD,GAAM,IACfE,IAAYH,MAAUtB,EAAM,SAAS;AAG3C,EAAA0B,EAAU,MAAM;AACf,IAAAL,EAAW,SAAS,MAAA;AAAA,EACrB,GAAG,CAACG,CAAM,CAAC;AAEX,iBAAeG,EAAOC,GAAmC;AAExD,QADAA,EAAM,eAAA,GACF,CAAAT,EAAa,SAGjB;AAAA,UAFAD,EAAS,EAAK,GAEV,CAACO,GAAW;AACf,QAAAZ,EAAaS,IAAQ,CAAC;AACtB;AAAA,MACD;AAEA,MAAAH,EAAa,UAAU,IACvBH,EAAU,EAAI;AACd,UAAI;AACH,cAAMT,EAAA;AAAA,MACP,QAAQ;AACP,QAAAW,EAAS,EAAI;AAAA,MACd,UAAA;AACC,QAAAC,EAAa,UAAU,IACvBH,EAAU,EAAK;AAAA,MAChB;AAAA;AAAA,EACD;AAEA,SAAKO,IA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