@stoa-dev/kit 0.1.4 → 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 (147) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/README.md +97 -2
  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/display/BarChart/index.js +70 -0
  10. package/dist/display/BarChart/index.js.map +1 -0
  11. package/dist/display/Marginalia/index.js +16 -0
  12. package/dist/display/Marginalia/index.js.map +1 -0
  13. package/dist/display/MarginaliaFramed/index.js +19 -0
  14. package/dist/display/MarginaliaFramed/index.js.map +1 -0
  15. package/dist/display/MarginaliaPair/index.js +32 -0
  16. package/dist/display/MarginaliaPair/index.js.map +1 -0
  17. package/dist/display/ProgressBar/index.js +72 -0
  18. package/dist/display/ProgressBar/index.js.map +1 -0
  19. package/dist/display/TimeMeasured/index.js +38 -0
  20. package/dist/display/TimeMeasured/index.js.map +1 -0
  21. package/dist/display/index.js +16 -0
  22. package/dist/display/index.js.map +1 -0
  23. package/dist/i18n/locales/at.json.js +10 -4
  24. package/dist/i18n/locales/at.json.js.map +1 -1
  25. package/dist/i18n/locales/de.json.js +10 -4
  26. package/dist/i18n/locales/de.json.js.map +1 -1
  27. package/dist/i18n/locales/en.json.js +10 -4
  28. package/dist/i18n/locales/en.json.js.map +1 -1
  29. package/dist/i18n/locales/it.json.js +12 -6
  30. package/dist/i18n/locales/it.json.js.map +1 -1
  31. package/dist/kit.css +1 -1
  32. package/dist/shell/AnimatedSwap/index.js +61 -0
  33. package/dist/shell/AnimatedSwap/index.js.map +1 -0
  34. package/dist/shell/AppNavigation/index.js +97 -77
  35. package/dist/shell/AppNavigation/index.js.map +1 -1
  36. package/dist/shell/BackButton/index.js +24 -0
  37. package/dist/shell/BackButton/index.js.map +1 -0
  38. package/dist/shell/BrandLines/index.js +14 -12
  39. package/dist/shell/BrandLines/index.js.map +1 -1
  40. package/dist/shell/DatePicker/index.js +16 -15
  41. package/dist/shell/DatePicker/index.js.map +1 -1
  42. package/dist/shell/ExternalLink/index.js +30 -0
  43. package/dist/shell/ExternalLink/index.js.map +1 -0
  44. package/dist/shell/PageHeading/index.js +15 -8
  45. package/dist/shell/PageHeading/index.js.map +1 -1
  46. package/dist/shell/SaveStatus/index.js +61 -0
  47. package/dist/shell/SaveStatus/index.js.map +1 -0
  48. package/dist/shell/SectionNavigation/index.js +5 -112
  49. package/dist/shell/SectionNavigation/index.js.map +1 -1
  50. package/dist/shell/SetupWizard/index.js +158 -0
  51. package/dist/shell/SetupWizard/index.js.map +1 -0
  52. package/dist/shell/StartupAnimation/index.js +88 -0
  53. package/dist/shell/StartupAnimation/index.js.map +1 -0
  54. package/dist/shell/StartupProvider/index.js +37 -0
  55. package/dist/shell/StartupProvider/index.js.map +1 -0
  56. package/dist/shell/SubNavigation/index.js +127 -0
  57. package/dist/shell/SubNavigation/index.js.map +1 -0
  58. package/dist/shell/TagInput/index.js +93 -0
  59. package/dist/shell/TagInput/index.js.map +1 -0
  60. package/dist/shell/ValidatedInput/index.js +31 -0
  61. package/dist/shell/ValidatedInput/index.js.map +1 -0
  62. package/dist/shell/index.js +45 -24
  63. package/dist/shell/index.js.map +1 -1
  64. package/dist/types/autosave/controller.d.ts +44 -0
  65. package/dist/types/autosave/controller.d.ts.map +1 -0
  66. package/dist/types/autosave/index.d.ts +3 -0
  67. package/dist/types/autosave/index.d.ts.map +1 -0
  68. package/dist/types/autosave/provider.d.ts +20 -0
  69. package/dist/types/autosave/provider.d.ts.map +1 -0
  70. package/dist/types/display/BarChart/index.d.ts +25 -0
  71. package/dist/types/display/BarChart/index.d.ts.map +1 -0
  72. package/dist/types/display/Marginalia/index.d.ts +8 -0
  73. package/dist/types/display/Marginalia/index.d.ts.map +1 -0
  74. package/dist/types/display/MarginaliaFramed/index.d.ts +8 -0
  75. package/dist/types/display/MarginaliaFramed/index.d.ts.map +1 -0
  76. package/dist/types/display/MarginaliaPair/index.d.ts +9 -0
  77. package/dist/types/display/MarginaliaPair/index.d.ts.map +1 -0
  78. package/dist/types/display/ProgressBar/index.d.ts +19 -0
  79. package/dist/types/display/ProgressBar/index.d.ts.map +1 -0
  80. package/dist/types/display/TimeMeasured/index.d.ts +16 -0
  81. package/dist/types/display/TimeMeasured/index.d.ts.map +1 -0
  82. package/dist/types/display/index.d.ts +7 -0
  83. package/dist/types/display/index.d.ts.map +1 -0
  84. package/dist/types/i18n/index.d.ts +88 -0
  85. package/dist/types/i18n/index.d.ts.map +1 -1
  86. package/dist/types/shell/AnimatedSwap/index.d.ts +13 -0
  87. package/dist/types/shell/AnimatedSwap/index.d.ts.map +1 -0
  88. package/dist/types/shell/AppNavigation/index.d.ts +1 -1
  89. package/dist/types/shell/AppNavigation/index.d.ts.map +1 -1
  90. package/dist/types/shell/BackButton/index.d.ts +8 -0
  91. package/dist/types/shell/BackButton/index.d.ts.map +1 -0
  92. package/dist/types/shell/BrandLines/index.d.ts.map +1 -1
  93. package/dist/types/shell/DatePicker/index.d.ts.map +1 -1
  94. package/dist/types/shell/ErrorBoundary/index.d.ts +1 -1
  95. package/dist/types/shell/ExternalLink/index.d.ts +10 -0
  96. package/dist/types/shell/ExternalLink/index.d.ts.map +1 -0
  97. package/dist/types/shell/PageHeading/index.d.ts.map +1 -1
  98. package/dist/types/shell/SaveStatus/index.d.ts +15 -0
  99. package/dist/types/shell/SaveStatus/index.d.ts.map +1 -0
  100. package/dist/types/shell/SectionNavigation/index.d.ts +4 -11
  101. package/dist/types/shell/SectionNavigation/index.d.ts.map +1 -1
  102. package/dist/types/shell/SetupWizard/index.d.ts +23 -0
  103. package/dist/types/shell/SetupWizard/index.d.ts.map +1 -0
  104. package/dist/types/shell/StartupAnimation/index.d.ts +26 -0
  105. package/dist/types/shell/StartupAnimation/index.d.ts.map +1 -0
  106. package/dist/types/shell/StartupProvider/index.d.ts +22 -0
  107. package/dist/types/shell/StartupProvider/index.d.ts.map +1 -0
  108. package/dist/types/shell/SubNavigation/index.d.ts +16 -0
  109. package/dist/types/shell/SubNavigation/index.d.ts.map +1 -0
  110. package/dist/types/shell/TagInput/index.d.ts +20 -0
  111. package/dist/types/shell/TagInput/index.d.ts.map +1 -0
  112. package/dist/types/shell/ValidatedInput/index.d.ts +17 -0
  113. package/dist/types/shell/ValidatedInput/index.d.ts.map +1 -0
  114. package/dist/types/shell/index.d.ts +10 -1
  115. package/dist/types/shell/index.d.ts.map +1 -1
  116. package/dist/types/ui/field/index.d.ts +1 -1
  117. package/dist/types/ui/index.d.ts +2 -0
  118. package/dist/types/ui/index.d.ts.map +1 -1
  119. package/dist/types/ui/theme-switch/index.d.ts +12 -0
  120. package/dist/types/ui/theme-switch/index.d.ts.map +1 -0
  121. package/dist/types/ui/theme-toggle/index.d.ts +12 -0
  122. package/dist/types/ui/theme-toggle/index.d.ts.map +1 -0
  123. package/dist/types/utils/index.d.ts +1 -0
  124. package/dist/types/utils/index.d.ts.map +1 -1
  125. package/dist/types/utils/saveFeedback.d.ts +35 -0
  126. package/dist/types/utils/saveFeedback.d.ts.map +1 -0
  127. package/dist/ui/index.js +41 -37
  128. package/dist/ui/index.js.map +1 -1
  129. package/dist/ui/theme-switch/ThemeSwitch.module.scss.js +14 -0
  130. package/dist/ui/theme-switch/ThemeSwitch.module.scss.js.map +1 -0
  131. package/dist/ui/theme-switch/index.js +38 -0
  132. package/dist/ui/theme-switch/index.js.map +1 -0
  133. package/dist/ui/theme-toggle/index.js +36 -0
  134. package/dist/ui/theme-toggle/index.js.map +1 -0
  135. package/dist/ui/tooltip/index.js +11 -11
  136. package/dist/ui/tooltip/index.js.map +1 -1
  137. package/dist/utils/index.js +5 -3
  138. package/dist/utils/index.js.map +1 -1
  139. package/dist/utils/saveFeedback.js +54 -0
  140. package/dist/utils/saveFeedback.js.map +1 -0
  141. package/package.json +13 -3
  142. package/styles/instrument.css +703 -0
  143. package/styles/theme.css +1 -0
  144. package/dist/shell/BackHomeButton/index.js +0 -23
  145. package/dist/shell/BackHomeButton/index.js.map +0 -1
  146. package/dist/types/shell/BackHomeButton/index.d.ts +0 -7
  147. package/dist/types/shell/BackHomeButton/index.d.ts.map +0 -1
@@ -1,136 +1,156 @@
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 d } 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
- children: o
20
+ children: n
21
21
  }) {
22
- return /* @__PURE__ */ c(C, { children: [
23
- /* @__PURE__ */ t(j, { asChild: !0, children: o }),
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
- label: o,
30
- Icon: r,
29
+ label: n,
30
+ Icon: o,
31
31
  isActive: e,
32
- disabled: n
32
+ disabled: a
33
33
  }) {
34
- const { pathname: a } = A(), m = e ? e(a) : a === i;
35
- return /* @__PURE__ */ t(g, { label: o, 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
- className: l(s.menuButton, "rounded-xl"),
41
- disabled: n,
42
- asChild: !n,
43
- children: n ? /* @__PURE__ */ t(r, { className: "size-4", strokeWidth: 1.75 }) : /* @__PURE__ */ t(
44
- z,
40
+ "data-nav-item": "",
41
+ className: m(s.menuButton, "rounded-xl"),
42
+ disabled: a,
43
+ asChild: !a,
44
+ children: a ? /* @__PURE__ */ t(o, { className: "size-4", strokeWidth: 1.75 }) : /* @__PURE__ */ t(
45
+ A,
45
46
  {
46
47
  to: i,
47
- "aria-label": o,
48
- "aria-current": m ? "page" : void 0,
49
- children: /* @__PURE__ */ t(r, { className: "size-4", strokeWidth: 1.75 })
48
+ "aria-label": n,
49
+ "aria-current": c ? "page" : void 0,
50
+ children: /* @__PURE__ */ t(o, { className: "size-4", strokeWidth: 1.75 })
50
51
  }
51
52
  )
52
53
  }
53
54
  ) });
54
55
  }
55
- function v({
56
+ function F({
56
57
  label: i,
57
- Icon: o,
58
- onClick: r,
58
+ Icon: n,
59
+ onClick: o,
59
60
  disabled: e
60
61
  }) {
61
- return /* @__PURE__ */ t(g, { label: i, children: /* @__PURE__ */ t(
62
- f,
62
+ return /* @__PURE__ */ t(p, { label: i, children: /* @__PURE__ */ t(
63
+ v,
63
64
  {
64
65
  variant: "ghost",
65
66
  size: "icon",
66
- className: l(s.menuButton, "rounded-xl"),
67
+ "data-nav-item": "",
68
+ className: m(s.menuButton, "rounded-xl"),
67
69
  "aria-label": i,
68
70
  disabled: e,
69
- onClick: r,
70
- children: /* @__PURE__ */ t(o, { className: "size-4", strokeWidth: 1.75 })
71
+ onClick: o,
72
+ children: /* @__PURE__ */ t(n, { className: "size-4", strokeWidth: 1.75 })
71
73
  }
72
74
  ) });
73
75
  }
74
- function J({
76
+ function K({
75
77
  onToggle: i,
76
- theme: o = "system",
77
- disabled: r,
78
+ theme: n = "system",
79
+ disabled: o,
78
80
  label: e
79
81
  }) {
80
- const { t: n } = d(h), { resolvedTheme: a } = k(), m = o === "system" ? a : o;
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
+ {
86
+ variant: "ghost",
87
+ "data-nav-item": "",
88
+ className: m(s.menuButton, "rounded-xl"),
89
+ theme: c === "dark" ? "dark" : "light",
90
+ label: d,
91
+ disabled: o,
92
+ onToggle: i
93
+ }
94
+ ) });
95
+ }
96
+ function W() {
81
97
  return /* @__PURE__ */ t(
82
- v,
98
+ "div",
83
99
  {
84
- label: e ?? n("app.switchTheme"),
85
- Icon: T,
86
- disabled: r,
87
- onClick: () => {
88
- i(m === "dark" ? "light" : "dark");
89
- }
100
+ "data-slot": "app-navigation-divider",
101
+ className: s.divider,
102
+ "aria-hidden": "true"
90
103
  }
91
104
  );
92
105
  }
93
- function I() {
94
- return /* @__PURE__ */ t("div", { className: s.divider, "aria-hidden": "true" });
95
- }
96
- function u(i, o) {
97
- return i.map((r, e) => (
106
+ function h(i, n) {
107
+ return i.map((o, e) => (
98
108
  // biome-ignore lint/suspicious/noArrayIndexKey: groups are static configuration
99
- /* @__PURE__ */ c(p, { children: [
100
- e > 0 && /* @__PURE__ */ t(I, {}),
101
- r.map((n, a) => B(n) ? /* @__PURE__ */ t(F, { ...n }, n.path) : b(n) ? /* @__PURE__ */ t(v, { ...n }, n.id ?? n.label) : /* @__PURE__ */ t(p, { children: n }, a))
102
- ] }, `${o}-${e}`)
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}`)
103
113
  ));
104
114
  }
105
- function K({
115
+ function M({
106
116
  groups: i,
107
- logo: o,
108
- footerGroups: r,
117
+ logo: n,
118
+ footerGroups: o,
109
119
  label: e,
110
- className: n
120
+ className: a
111
121
  }) {
112
- const { t: a } = d(h);
113
- return /* @__PURE__ */ c(
122
+ const { t: r } = g(f);
123
+ return /* @__PURE__ */ l(
114
124
  "nav",
115
125
  {
116
- "aria-label": e ?? a("app.navigation"),
117
- className: l(s.root, n),
126
+ "data-slot": "app-navigation",
127
+ "aria-label": e ?? r("app.navigation"),
128
+ className: m(s.root, a),
118
129
  children: [
119
- typeof o == "string" ? /* @__PURE__ */ t("img", { src: o, className: s.logo, alt: "", "aria-hidden": "true" }) : o,
120
- u(i, "main"),
121
- r && r.length > 0 && /* @__PURE__ */ c(N, { children: [
130
+ typeof n == "string" ? /* @__PURE__ */ t(
131
+ "img",
132
+ {
133
+ src: n,
134
+ "data-slot": "app-navigation-logo",
135
+ className: s.logo,
136
+ alt: "",
137
+ "aria-hidden": "true"
138
+ }
139
+ ) : n,
140
+ h(i, "main"),
141
+ o && o.length > 0 && /* @__PURE__ */ l(N, { children: [
122
142
  /* @__PURE__ */ t("div", { className: s.spacer }),
123
- u(r, "footer")
143
+ h(o, "footer")
124
144
  ] })
125
145
  ]
126
146
  }
127
147
  );
128
148
  }
129
149
  export {
130
- K as AppNavigation,
131
- v as AppNavigationButton,
132
- I as AppNavigationDivider,
133
- F as AppNavigationItem,
134
- J as AppNavigationThemeToggle
150
+ M as AppNavigation,
151
+ F as AppNavigationButton,
152
+ W as AppNavigationDivider,
153
+ L as AppNavigationItem,
154
+ K as AppNavigationThemeToggle
135
155
  };
136
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\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\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 <div className={styles.divider} aria-hidden='true' />\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\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 src={logo} className={styles.logo} alt='' aria-hidden='true' />\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,CAA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;AACD,GAAuB;AACtB,QAAM,EAAE,GAAAnB,EAAA,IAAMC,EAAeC,CAAO;AAEpC,SACC,gBAAAW;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,cAAYpC,KAASuB,EAAE,gBAAgB;AAAA,MACvC,WAAWR,EAAGC,EAAO,MAAM0B,CAAS;AAAA,MAEnC,UAAA;AAAA,QAAA,OAAOF,KAAS,WAChB,gBAAArC,EAAC,OAAA,EAAI,KAAKqC,GAAM,WAAWxB,EAAO,MAAM,KAAI,IAAG,eAAY,QAAO,IAElEwB;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;A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B;AAAA,MACvC,WAAWR,EAAGC,EAAO,MAAM2B,CAAS;AAAA,MAEnC,UAAA;AAAA,QAAA,OAAOF,KAAS,WAChB,gBAAAtC;AAAA,UAAC;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,20 +1,22 @@
1
- import { jsxs as e, jsx as r } from "react/jsx-runtime";
2
- import { cn as a } from "../../utils/cn.js";
3
- import i from "./BrandLines.module.scss.js";
4
- function m({ loading: n = !1, className: s }) {
5
- return /* @__PURE__ */ e(
1
+ import { jsxs as s, jsx as i } from "react/jsx-runtime";
2
+ import { cn as e } from "../../utils/cn.js";
3
+ import r from "./BrandLines.module.scss.js";
4
+ function m({ loading: n = !1, className: a }) {
5
+ return /* @__PURE__ */ s(
6
6
  "span",
7
7
  {
8
8
  "aria-hidden": "true",
9
- className: a(
10
- i.brandLines,
11
- n && i.brandLinesLoading,
12
- s
9
+ "data-slot": "brand-lines",
10
+ "data-loading": n || void 0,
11
+ className: e(
12
+ r.brandLines,
13
+ n && r.brandLinesLoading,
14
+ a
13
15
  ),
14
16
  children: [
15
- /* @__PURE__ */ r("i", {}),
16
- /* @__PURE__ */ r("i", {}),
17
- /* @__PURE__ */ r("i", {})
17
+ /* @__PURE__ */ i("i", {}),
18
+ /* @__PURE__ */ i("i", {}),
19
+ /* @__PURE__ */ i("i", {})
18
20
  ]
19
21
  }
20
22
  );
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/shell/BrandLines/index.tsx"],"sourcesContent":["import { cn } from '../../utils/cn'\nimport styles from './BrandLines.module.scss'\n\nexport interface BrandLinesProps {\n\tloading?: boolean\n\tclassName?: string\n}\n\nexport function BrandLines({ loading = false, className }: BrandLinesProps) {\n\treturn (\n\t\t<span\n\t\t\taria-hidden='true'\n\t\t\tclassName={cn(\n\t\t\t\tstyles.brandLines,\n\t\t\t\tloading && styles.brandLinesLoading,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t<i />\n\t\t\t<i />\n\t\t\t<i />\n\t\t</span>\n\t)\n}\n"],"names":["BrandLines","loading","className","jsxs","cn","styles","jsx"],"mappings":";;;AAQO,SAASA,EAAW,EAAE,SAAAC,IAAU,IAAO,WAAAC,KAA8B;AAC3E,SACC,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,eAAY;AAAA,MACZ,WAAWC;AAAA,QACVC,EAAO;AAAA,QACPJ,KAAWI,EAAO;AAAA,QAClBH;AAAA,MAAA;AAAA,MAGD,UAAA;AAAA,QAAA,gBAAAI,EAAC,KAAA,EAAE;AAAA,0BACF,KAAA,EAAE;AAAA,0BACF,KAAA,CAAA,CAAE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/shell/BrandLines/index.tsx"],"sourcesContent":["import { cn } from '../../utils/cn'\nimport styles from './BrandLines.module.scss'\n\nexport interface BrandLinesProps {\n\tloading?: boolean\n\tclassName?: string\n}\n\nexport function BrandLines({ loading = false, className }: BrandLinesProps) {\n\treturn (\n\t\t<span\n\t\t\taria-hidden='true'\n\t\t\tdata-slot='brand-lines'\n\t\t\tdata-loading={loading || undefined}\n\t\t\tclassName={cn(\n\t\t\t\tstyles.brandLines,\n\t\t\t\tloading && styles.brandLinesLoading,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t<i />\n\t\t\t<i />\n\t\t\t<i />\n\t\t</span>\n\t)\n}\n"],"names":["BrandLines","loading","className","jsxs","cn","styles","jsx"],"mappings":";;;AAQO,SAASA,EAAW,EAAE,SAAAC,IAAU,IAAO,WAAAC,KAA8B;AAC3E,SACC,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,eAAY;AAAA,MACZ,aAAU;AAAA,MACV,gBAAcF,KAAW;AAAA,MACzB,WAAWG;AAAA,QACVC,EAAO;AAAA,QACPJ,KAAWI,EAAO;AAAA,QAClBH;AAAA,MAAA;AAAA,MAGD,UAAA;AAAA,QAAA,gBAAAI,EAAC,KAAA,EAAE;AAAA,0BACF,KAAA,EAAE;AAAA,0BACF,KAAA,CAAA,CAAE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -3,10 +3,10 @@ import { it as G, enUS as R, deAT as _, de as C } from "date-fns/locale";
3
3
  import { CalendarIcon as K, Target as H } from "lucide-react";
4
4
  import * as w from "react";
5
5
  import { useTranslation as U } from "react-i18next";
6
- import { STOA_NS as q } from "../../i18n/namespace.js";
7
- import { Button as J } from "../../ui/button/index.js";
8
- import { Calendar as Q } from "../../ui/calendar/index.js";
9
- import { Field as W, FieldLabel as X } from "../../ui/field/index.js";
6
+ import { STOA_NS as W } from "../../i18n/namespace.js";
7
+ import { Button as q } from "../../ui/button/index.js";
8
+ import { Calendar as J } from "../../ui/calendar/index.js";
9
+ import { Field as Q, FieldLabel as X } from "../../ui/field/index.js";
10
10
  import { InputGroup as Z, InputGroupInput as ee, InputGroupAddon as te, InputGroupButton as ne } from "../../ui/input-group/index.js";
11
11
  import { Popover as oe, PopoverTrigger as ae, PopoverContent as re } from "../../ui/popover/index.js";
12
12
  import { formatDate as P, isValidDate as T, getRuntimeLocale as x } from "../../utils/dates.js";
@@ -93,31 +93,31 @@ function Pe({
93
93
  startMonth: n,
94
94
  endMonth: s
95
95
  }) {
96
- const l = (/* @__PURE__ */ new Date()).getFullYear(), p = n ?? new Date(l - ie, 0, 1), z = s ?? new Date(l + le, 11, 1), { t: u, i18n: E } = U(q), V = E.resolvedLanguage ?? "de", B = { de: C, "de-AT": _, en: R, it: G }[V] ?? C, [O, D] = w.useState(!1), [k, v] = w.useState(
96
+ const l = (/* @__PURE__ */ new Date()).getFullYear(), p = n ?? new Date(l - ie, 0, 1), z = s ?? new Date(l + le, 11, 1), { t: u, i18n: E } = U(W), V = E.resolvedLanguage ?? "de", B = { de: C, "de-AT": _, en: R, it: G }[V] ?? C, [O, D] = w.useState(!1), [M, v] = w.useState(
97
97
  () => L(o)
98
- ), [$, N] = w.useState(k), [I, g] = w.useState(P(k) || o);
98
+ ), [$, N] = w.useState(M), [I, g] = w.useState(P(M) || o);
99
99
  w.useEffect(() => {
100
100
  a && D(!1);
101
101
  }, [a]);
102
- const M = (e) => {
102
+ const k = (e) => {
103
103
  e !== o && h(e);
104
104
  }, j = () => {
105
105
  if (a) return;
106
106
  const e = /* @__PURE__ */ new Date();
107
- v(e), N(e), g(P(e)), M(b(e)), D(!1);
107
+ v(e), N(e), g(P(e)), k(b(e)), D(!1);
108
108
  }, S = (e) => {
109
109
  if (a) return;
110
110
  if (!e.trim()) {
111
- v(void 0), N(void 0), g(""), M("");
111
+ v(void 0), N(void 0), g(""), k("");
112
112
  return;
113
113
  }
114
114
  const c = Y(e);
115
- T(c) && (v(c), N(c), g(P(c)), M(b(c)));
115
+ T(c) && (v(c), N(c), g(P(c)), k(b(c)));
116
116
  };
117
117
  return w.useEffect(() => {
118
118
  const e = L(o);
119
119
  v(e), N(e), g(P(e, { locale: V }) || o);
120
- }, [o, V]), /* @__PURE__ */ y(W, { className: "w-full", children: [
120
+ }, [o, V]), /* @__PURE__ */ y(Q, { className: "w-full", children: [
121
121
  !i && /* @__PURE__ */ d(X, { htmlFor: t, children: r }),
122
122
  /* @__PURE__ */ y(Z, { "aria-invalid": m, children: [
123
123
  /* @__PURE__ */ d(
@@ -166,7 +166,7 @@ function Pe({
166
166
  sideOffset: 10,
167
167
  children: [
168
168
  /* @__PURE__ */ d("div", { className: "flex items-center justify-center px-1 py-2 mb-1 border-b", children: /* @__PURE__ */ y(
169
- J,
169
+ q,
170
170
  {
171
171
  type: "button",
172
172
  variant: "ghost",
@@ -182,10 +182,11 @@ function Pe({
182
182
  }
183
183
  ) }),
184
184
  /* @__PURE__ */ d(
185
- Q,
185
+ J,
186
186
  {
187
187
  mode: "single",
188
188
  captionLayout: "dropdown",
189
+ fixedWeeks: !0,
189
190
  startMonth: p,
190
191
  endMonth: z,
191
192
  disabled: a,
@@ -204,11 +205,11 @@ function Pe({
204
205
  c.selected ? u("datePicker.selected") : ""
205
206
  ].filter(Boolean).join(", ")
206
207
  },
207
- selected: k,
208
+ selected: M,
208
209
  month: $,
209
210
  onMonthChange: N,
210
211
  onSelect: (e) => {
211
- a || (v(e), g(P(e)), M(b(e)), D(!1));
212
+ a || (v(e), g(P(e)), k(b(e)), D(!1));
212
213
  }
213
214
  }
214
215
  )
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/shell/DatePicker/index.tsx"],"sourcesContent":["import { de, deAT, enUS, it } from 'date-fns/locale'\nimport { CalendarIcon, Target } from 'lucide-react'\nimport * as React from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { STOA_NS } from '../../i18n/namespace'\nimport { Button } from '../../ui/button'\nimport { Calendar } from '../../ui/calendar'\nimport { Field, FieldLabel } from '../../ui/field'\nimport {\n\tInputGroup,\n\tInputGroupAddon,\n\tInputGroupButton,\n\tInputGroupInput,\n} from '../../ui/input-group'\nimport { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover'\nimport { formatDate, getRuntimeLocale, isValidDate } from '../../utils/dates'\n\ntype DatePickerInputProps = {\n\tid: string\n\tlabel: string\n\thideLabel?: boolean\n\tvalue: string\n\tonChange: (value: string) => void\n\tinvalid?: boolean\n\trequired?: boolean\n\tdisabled?: boolean\n\t/** First month reachable in the calendar. Defaults to January, 100 years ago. */\n\tstartMonth?: Date\n\t/** Last month reachable in the calendar. Defaults to December, 10 years ahead. */\n\tendMonth?: Date\n}\n\nconst YEARS_BACK = 100\nconst YEARS_AHEAD = 10\n\nfunction parseDateValue(value: string) {\n\treturn parseTypedDateValue(value)\n}\n\nfunction createDateIfValid(year: number, month: number, day: number) {\n\tconst date = new Date(year, month - 1, day)\n\n\tif (\n\t\tdate.getFullYear() === year &&\n\t\tdate.getMonth() === month - 1 &&\n\t\tdate.getDate() === day\n\t) {\n\t\treturn date\n\t}\n\n\treturn undefined\n}\n\nfunction normalizeTextValue(value: string) {\n\treturn value\n\t\t.trim()\n\t\t.toLocaleLowerCase()\n\t\t.normalize('NFD')\n\t\t.replace(/[\\u0300-\\u036f]/g, '')\n}\n\nfunction tokenizeDateText(value: string) {\n\treturn normalizeTextValue(value).match(/[a-z0-9]+/g) ?? []\n}\n\nfunction parseLocaleDateValue(value: string) {\n\tconst dateParts = new Intl.DateTimeFormat(getRuntimeLocale(), {\n\t\tday: '2-digit',\n\t\tmonth: 'long',\n\t\tyear: 'numeric',\n\t}).formatToParts(new Date(2026, 4, 11))\n\tconst partOrder = dateParts\n\t\t.filter(\n\t\t\t(part) =>\n\t\t\t\tpart.type === 'day' || part.type === 'month' || part.type === 'year',\n\t\t)\n\t\t.map((part) => part.type)\n\tconst normalizedParts = tokenizeDateText(value)\n\n\tif (normalizedParts.length !== partOrder.length) {\n\t\treturn undefined\n\t}\n\n\tconst monthNames = new Map<string, number>()\n\n\tfor (let monthIndex = 0; monthIndex < 12; monthIndex += 1) {\n\t\tconst monthDate = new Date(2026, monthIndex, 1)\n\t\tconst longMonth = new Intl.DateTimeFormat(getRuntimeLocale(), {\n\t\t\tmonth: 'long',\n\t\t}).format(monthDate)\n\t\tconst shortMonth = new Intl.DateTimeFormat(getRuntimeLocale(), {\n\t\t\tmonth: 'short',\n\t\t}).format(monthDate)\n\n\t\tmonthNames.set(normalizeTextValue(longMonth), monthIndex + 1)\n\t\tmonthNames.set(normalizeTextValue(shortMonth), monthIndex + 1)\n\t}\n\n\tlet day: number | undefined\n\tlet month: number | undefined\n\tlet year: number | undefined\n\n\tpartOrder.forEach((partType, index) => {\n\t\tconst partValue = normalizedParts[index]\n\n\t\tif (partType === 'day') {\n\t\t\tday = Number(partValue)\n\t\t}\n\n\t\tif (partType === 'month') {\n\t\t\tmonth = monthNames.get(partValue) ?? Number(partValue)\n\t\t}\n\n\t\tif (partType === 'year') {\n\t\t\tyear = Number(partValue)\n\t\t}\n\t})\n\n\tif (!day || !month || !year) {\n\t\treturn undefined\n\t}\n\n\treturn createDateIfValid(year, month, day)\n}\n\nfunction parseTypedDateValue(value: string) {\n\tconst trimmedValue = value.trim()\n\n\tif (!trimmedValue) {\n\t\treturn undefined\n\t}\n\n\tconst isoDateMatch = trimmedValue.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/)\n\n\tif (isoDateMatch) {\n\t\tconst [, yearValue, monthValue, dayValue] = isoDateMatch\n\t\tconst year = Number(yearValue)\n\t\tconst month = Number(monthValue)\n\t\tconst day = Number(dayValue)\n\n\t\treturn createDateIfValid(year, month, day)\n\t}\n\n\tconst numericDateMatch = trimmedValue.match(\n\t\t/^(\\d{1,2})[./-](\\d{1,2})[./-](\\d{4})$/,\n\t)\n\n\tif (numericDateMatch) {\n\t\tconst [, dayValue, monthValue, yearValue] = numericDateMatch\n\t\tconst year = Number(yearValue)\n\t\tconst month = Number(monthValue)\n\t\tconst day = Number(dayValue)\n\n\t\treturn createDateIfValid(year, month, day)\n\t}\n\n\tif (!/\\d{4}/.test(trimmedValue)) {\n\t\treturn undefined\n\t}\n\n\tconst localeDate = parseLocaleDateValue(trimmedValue)\n\n\tif (isValidDate(localeDate)) {\n\t\treturn localeDate\n\t}\n\n\tconst date = new Date(trimmedValue)\n\n\treturn isValidDate(date) ? date : undefined\n}\n\nfunction toDateValue(date: Date | undefined) {\n\tif (!date) {\n\t\treturn ''\n\t}\n\n\tconst year = date.getFullYear()\n\tconst month = String(date.getMonth() + 1).padStart(2, '0')\n\tconst day = String(date.getDate()).padStart(2, '0')\n\n\treturn `${year}-${month}-${day}`\n}\n\nexport function DatePickerInput({\n\tid,\n\tlabel,\n\thideLabel = false,\n\tvalue,\n\tonChange,\n\tinvalid = false,\n\trequired = false,\n\tdisabled = false,\n\tstartMonth,\n\tendMonth,\n}: DatePickerInputProps) {\n\tconst currentYear = new Date().getFullYear()\n\tconst firstMonth = startMonth ?? new Date(currentYear - YEARS_BACK, 0, 1)\n\tconst lastMonth = endMonth ?? new Date(currentYear + YEARS_AHEAD, 11, 1)\n\tconst { t, i18n } = useTranslation(STOA_NS)\n\tconst language = i18n.resolvedLanguage ?? 'de'\n\tconst calendarLocales = { de, 'de-AT': deAT, en: enUS, it }\n\tconst calendarLocale =\n\t\tcalendarLocales[language as keyof typeof calendarLocales] ?? de\n\tconst [open, setOpen] = React.useState(false)\n\tconst [date, setDate] = React.useState<Date | undefined>(() =>\n\t\tparseDateValue(value),\n\t)\n\tconst [month, setMonth] = React.useState<Date | undefined>(date)\n\tconst [inputValue, setInputValue] = React.useState(formatDate(date) || value)\n\n\tReact.useEffect(() => {\n\t\tif (disabled) setOpen(false)\n\t}, [disabled])\n\n\tconst updateValue = (nextValue: string) => {\n\t\tif (nextValue !== value) onChange(nextValue)\n\t}\n\n\tconst handleSetToday = () => {\n\t\tif (disabled) return\n\t\tconst today = new Date()\n\t\tsetDate(today)\n\t\tsetMonth(today)\n\t\tsetInputValue(formatDate(today))\n\t\tupdateValue(toDateValue(today))\n\t\tsetOpen(false)\n\t}\n\n\tconst commitInputValue = (valueToCommit: string) => {\n\t\tif (disabled) return\n\t\tif (!valueToCommit.trim()) {\n\t\t\tsetDate(undefined)\n\t\t\tsetMonth(undefined)\n\t\t\tsetInputValue('')\n\t\t\tupdateValue('')\n\t\t\treturn\n\t\t}\n\n\t\tconst nextDate = parseTypedDateValue(valueToCommit)\n\n\t\tif (!isValidDate(nextDate)) {\n\t\t\treturn\n\t\t}\n\n\t\tsetDate(nextDate)\n\t\tsetMonth(nextDate)\n\t\tsetInputValue(formatDate(nextDate))\n\t\tupdateValue(toDateValue(nextDate))\n\t}\n\n\tReact.useEffect(() => {\n\t\tconst nextDate = parseDateValue(value)\n\n\t\tsetDate(nextDate)\n\t\tsetMonth(nextDate)\n\t\tsetInputValue(formatDate(nextDate, { locale: language }) || value)\n\t}, [value, language])\n\n\treturn (\n\t\t<Field className='w-full'>\n\t\t\t{!hideLabel && <FieldLabel htmlFor={id}>{label}</FieldLabel>}\n\t\t\t<InputGroup aria-invalid={invalid}>\n\t\t\t\t<InputGroupInput\n\t\t\t\t\tid={id}\n\t\t\t\t\taria-label={hideLabel ? label : undefined}\n\t\t\t\t\taria-invalid={invalid}\n\t\t\t\t\tvalue={inputValue}\n\t\t\t\t\t// placeholder={formatDate(new Date())}\n\t\t\t\t\tplaceholder={undefined}\n\t\t\t\t\trequired={required}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\tconst nextInputValue = e.target.value\n\t\t\t\t\t\tsetInputValue(nextInputValue)\n\t\t\t\t\t\tcommitInputValue(nextInputValue)\n\t\t\t\t\t}}\n\t\t\t\t\tonBlur={() => {\n\t\t\t\t\t\tcommitInputValue(inputValue)\n\t\t\t\t\t}}\n\t\t\t\t\tonKeyDown={(e) => {\n\t\t\t\t\t\tif (e.key === 'Enter') {\n\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\tcommitInputValue(inputValue)\n\t\t\t\t\t\t\tsetOpen(false)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (e.key === 'ArrowDown') {\n\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\tsetOpen(true)\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t\t<InputGroupAddon align='inline-end'>\n\t\t\t\t\t<Popover open={open && !disabled} onOpenChange={setOpen}>\n\t\t\t\t\t\t<PopoverTrigger asChild>\n\t\t\t\t\t\t\t<InputGroupButton\n\t\t\t\t\t\t\t\tid={`${id}-picker`}\n\t\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t\t\tvariant='ghost'\n\t\t\t\t\t\t\t\tsize='icon-xs'\n\t\t\t\t\t\t\t\taria-label={t('datePicker.selectDate')}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<CalendarIcon />\n\t\t\t\t\t\t\t\t<span className='sr-only'>{t('datePicker.selectDate')}</span>\n\t\t\t\t\t\t\t</InputGroupButton>\n\t\t\t\t\t\t</PopoverTrigger>\n\t\t\t\t\t\t<PopoverContent\n\t\t\t\t\t\t\tclassName='w-auto overflow-hidden p-0'\n\t\t\t\t\t\t\talign='end'\n\t\t\t\t\t\t\talignOffset={-8}\n\t\t\t\t\t\t\tsideOffset={10}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className='flex items-center justify-center px-1 py-2 mb-1 border-b'>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\ttype='button'\n\t\t\t\t\t\t\t\t\tvariant='ghost'\n\t\t\t\t\t\t\t\t\tsize='sm'\n\t\t\t\t\t\t\t\t\tonClick={handleSetToday}\n\t\t\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t\t\t\tclassName='w-fit'\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Target /> {t('datePicker.today')}\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<Calendar\n\t\t\t\t\t\t\t\tmode='single'\n\t\t\t\t\t\t\t\tcaptionLayout='dropdown'\n\t\t\t\t\t\t\t\tstartMonth={firstMonth}\n\t\t\t\t\t\t\t\tendMonth={lastMonth}\n\t\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t\t\tlocale={calendarLocale}\n\t\t\t\t\t\t\t\tlabels={{\n\t\t\t\t\t\t\t\t\tlabelNext: () => t('datePicker.nextMonth'),\n\t\t\t\t\t\t\t\t\tlabelPrevious: () => t('datePicker.previousMonth'),\n\t\t\t\t\t\t\t\t\tlabelMonthDropdown: () => t('datePicker.chooseMonth'),\n\t\t\t\t\t\t\t\t\tlabelYearDropdown: () => t('datePicker.chooseYear'),\n\t\t\t\t\t\t\t\t\tlabelNav: () => t('datePicker.navigation'),\n\t\t\t\t\t\t\t\t\tlabelDayButton: (day, modifiers) =>\n\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\tmodifiers.today ? t('datePicker.today') : '',\n\t\t\t\t\t\t\t\t\t\t\tnew Intl.DateTimeFormat(language, {\n\t\t\t\t\t\t\t\t\t\t\t\tdateStyle: 'full',\n\t\t\t\t\t\t\t\t\t\t\t}).format(day),\n\t\t\t\t\t\t\t\t\t\t\tmodifiers.selected ? t('datePicker.selected') : '',\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t\t\t\t\t\t\t.join(', '),\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tselected={date}\n\t\t\t\t\t\t\t\tmonth={month}\n\t\t\t\t\t\t\t\tonMonthChange={setMonth}\n\t\t\t\t\t\t\t\tonSelect={(date) => {\n\t\t\t\t\t\t\t\t\tif (disabled) return\n\t\t\t\t\t\t\t\t\tsetDate(date)\n\t\t\t\t\t\t\t\t\tsetInputValue(formatDate(date))\n\t\t\t\t\t\t\t\t\tupdateValue(toDateValue(date))\n\t\t\t\t\t\t\t\t\tsetOpen(false)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PopoverContent>\n\t\t\t\t\t</Popover>\n\t\t\t\t</InputGroupAddon>\n\t\t\t</InputGroup>\n\t\t</Field>\n\t)\n}\n"],"names":["YEARS_BACK","YEARS_AHEAD","parseDateValue","value","parseTypedDateValue","createDateIfValid","year","month","day","date","normalizeTextValue","tokenizeDateText","parseLocaleDateValue","partOrder","getRuntimeLocale","part","normalizedParts","monthNames","monthIndex","monthDate","longMonth","shortMonth","partType","index","partValue","trimmedValue","isoDateMatch","yearValue","monthValue","dayValue","numericDateMatch","localeDate","isValidDate","toDateValue","DatePickerInput","id","label","hideLabel","onChange","invalid","required","disabled","startMonth","endMonth","currentYear","firstMonth","lastMonth","t","i18n","useTranslation","STOA_NS","language","calendarLocale","de","deAT","enUS","it","open","setOpen","React","setDate","setMonth","inputValue","setInputValue","formatDate","updateValue","nextValue","handleSetToday","today","commitInputValue","valueToCommit","nextDate","jsxs","Field","jsx","FieldLabel","InputGroup","InputGroupInput","nextInputValue","InputGroupAddon","Popover","PopoverTrigger","InputGroupButton","CalendarIcon","PopoverContent","Button","Target","Calendar","modifiers"],"mappings":";;;;;;;;;;;;AAgCA,MAAMA,KAAa,KACbC,KAAc;AAEpB,SAASC,EAAeC,GAAe;AACtC,SAAOC,EAAoBD,CAAK;AACjC;AAEA,SAASE,EAAkBC,GAAcC,GAAeC,GAAa;AACpE,QAAMC,IAAO,IAAI,KAAKH,GAAMC,IAAQ,GAAGC,CAAG;AAE1C,MACCC,EAAK,kBAAkBH,KACvBG,EAAK,eAAeF,IAAQ,KAC5BE,EAAK,QAAA,MAAcD;AAEnB,WAAOC;AAIT;AAEA,SA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AElC;AAAA,cAEA,gBAAA2B;AAAA,gBAACa;AAAA,gBAAA;AAAA,kBACA,MAAK;AAAA,kBACL,eAAc;AAAA,kBACd,YAAY1C;AAAA,kBACZ,UAAUC;AAAA,kBACV,UAAAL;AAAA,kBACA,QAAQW;AAAA,kBACR,QAAQ;AAAA,oBACP,WAAW,MAAML,EAAE,sBAAsB;AAAA,oBACzC,eAAe,MAAMA,EAAE,0BAA0B;AAAA,oBACjD,oBAAoB,MAAMA,EAAE,wBAAwB;AAAA,oBACpD,mBAAmB,MAAMA,EAAE,uBAAuB;AAAA,oBAClD,UAAU,MAAMA,EAAE,uBAAuB;AAAA,oBACzC,gBAAgB,CAACvC,GAAKgF,MACrB;AAAA,sBACCA,EAAU,QAAQzC,EAAE,kBAAkB,IAAI;AAAA,sBAC1C,IAAI,KAAK,eAAeI,GAAU;AAAA,wBACjC,WAAW;AAAA,sBAAA,CACX,EAAE,OAAO3C,CAAG;AAAA,sBACbgF,EAAU,WAAWzC,EAAE,qBAAqB,IAAI;AAAA,oBAAA,EAE/C,OAAO,OAAO,EACd,KAAK,IAAI;AAAA,kBAAA;AAAA,kBAEb,UAAUtC;AAAA,kBACV,OAAAF;AAAA,kBACA,eAAesD;AAAA,kBACf,UAAU,CAACpD,MAAS;AACnB,oBAAIgC,MACJmB,EAAQnD,CAAI,GACZsD,EAAcC,EAAWvD,CAAI,CAAC,GAC9BwD,EAAYhC,EAAYxB,CAAI,CAAC,GAC7BiD,EAAQ,EAAK;AAAA,kBACd;AAAA,gBAAA;AAAA,cAAA;AAAA,YACD;AAAA,UAAA;AAAA,QAAA;AAAA,MACD,EAAA,CACD,EAAA,CACD;AAAA,IAAA,EAAA,CACD;AAAA,EAAA,GACD;AAEF;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/shell/DatePicker/index.tsx"],"sourcesContent":["import { de, deAT, enUS, it } from 'date-fns/locale'\nimport { CalendarIcon, Target } from 'lucide-react'\nimport * as React from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { STOA_NS } from '../../i18n/namespace'\nimport { Button } from '../../ui/button'\nimport { Calendar } from '../../ui/calendar'\nimport { Field, FieldLabel } from '../../ui/field'\nimport {\n\tInputGroup,\n\tInputGroupAddon,\n\tInputGroupButton,\n\tInputGroupInput,\n} from '../../ui/input-group'\nimport { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover'\nimport { formatDate, getRuntimeLocale, isValidDate } from '../../utils/dates'\n\ntype DatePickerInputProps = {\n\tid: string\n\tlabel: string\n\thideLabel?: boolean\n\tvalue: string\n\tonChange: (value: string) => void\n\tinvalid?: boolean\n\trequired?: boolean\n\tdisabled?: boolean\n\t/** First month reachable in the calendar. Defaults to January, 100 years ago. */\n\tstartMonth?: Date\n\t/** Last month reachable in the calendar. Defaults to December, 10 years ahead. */\n\tendMonth?: Date\n}\n\nconst YEARS_BACK = 100\nconst YEARS_AHEAD = 10\n\nfunction parseDateValue(value: string) {\n\treturn parseTypedDateValue(value)\n}\n\nfunction createDateIfValid(year: number, month: number, day: number) {\n\tconst date = new Date(year, month - 1, day)\n\n\tif (\n\t\tdate.getFullYear() === year &&\n\t\tdate.getMonth() === month - 1 &&\n\t\tdate.getDate() === day\n\t) {\n\t\treturn date\n\t}\n\n\treturn undefined\n}\n\nfunction normalizeTextValue(value: string) {\n\treturn value\n\t\t.trim()\n\t\t.toLocaleLowerCase()\n\t\t.normalize('NFD')\n\t\t.replace(/[\\u0300-\\u036f]/g, '')\n}\n\nfunction tokenizeDateText(value: string) {\n\treturn normalizeTextValue(value).match(/[a-z0-9]+/g) ?? []\n}\n\nfunction parseLocaleDateValue(value: string) {\n\tconst dateParts = new Intl.DateTimeFormat(getRuntimeLocale(), {\n\t\tday: '2-digit',\n\t\tmonth: 'long',\n\t\tyear: 'numeric',\n\t}).formatToParts(new Date(2026, 4, 11))\n\tconst partOrder = dateParts\n\t\t.filter(\n\t\t\t(part) =>\n\t\t\t\tpart.type === 'day' || part.type === 'month' || part.type === 'year',\n\t\t)\n\t\t.map((part) => part.type)\n\tconst normalizedParts = tokenizeDateText(value)\n\n\tif (normalizedParts.length !== partOrder.length) {\n\t\treturn undefined\n\t}\n\n\tconst monthNames = new Map<string, number>()\n\n\tfor (let monthIndex = 0; monthIndex < 12; monthIndex += 1) {\n\t\tconst monthDate = new Date(2026, monthIndex, 1)\n\t\tconst longMonth = new Intl.DateTimeFormat(getRuntimeLocale(), {\n\t\t\tmonth: 'long',\n\t\t}).format(monthDate)\n\t\tconst shortMonth = new Intl.DateTimeFormat(getRuntimeLocale(), {\n\t\t\tmonth: 'short',\n\t\t}).format(monthDate)\n\n\t\tmonthNames.set(normalizeTextValue(longMonth), monthIndex + 1)\n\t\tmonthNames.set(normalizeTextValue(shortMonth), monthIndex + 1)\n\t}\n\n\tlet day: number | undefined\n\tlet month: number | undefined\n\tlet year: number | undefined\n\n\tpartOrder.forEach((partType, index) => {\n\t\tconst partValue = normalizedParts[index]\n\n\t\tif (partType === 'day') {\n\t\t\tday = Number(partValue)\n\t\t}\n\n\t\tif (partType === 'month') {\n\t\t\tmonth = monthNames.get(partValue) ?? Number(partValue)\n\t\t}\n\n\t\tif (partType === 'year') {\n\t\t\tyear = Number(partValue)\n\t\t}\n\t})\n\n\tif (!day || !month || !year) {\n\t\treturn undefined\n\t}\n\n\treturn createDateIfValid(year, month, day)\n}\n\nfunction parseTypedDateValue(value: string) {\n\tconst trimmedValue = value.trim()\n\n\tif (!trimmedValue) {\n\t\treturn undefined\n\t}\n\n\tconst isoDateMatch = trimmedValue.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/)\n\n\tif (isoDateMatch) {\n\t\tconst [, yearValue, monthValue, dayValue] = isoDateMatch\n\t\tconst year = Number(yearValue)\n\t\tconst month = Number(monthValue)\n\t\tconst day = Number(dayValue)\n\n\t\treturn createDateIfValid(year, month, day)\n\t}\n\n\tconst numericDateMatch = trimmedValue.match(\n\t\t/^(\\d{1,2})[./-](\\d{1,2})[./-](\\d{4})$/,\n\t)\n\n\tif (numericDateMatch) {\n\t\tconst [, dayValue, monthValue, yearValue] = numericDateMatch\n\t\tconst year = Number(yearValue)\n\t\tconst month = Number(monthValue)\n\t\tconst day = Number(dayValue)\n\n\t\treturn createDateIfValid(year, month, day)\n\t}\n\n\tif (!/\\d{4}/.test(trimmedValue)) {\n\t\treturn undefined\n\t}\n\n\tconst localeDate = parseLocaleDateValue(trimmedValue)\n\n\tif (isValidDate(localeDate)) {\n\t\treturn localeDate\n\t}\n\n\tconst date = new Date(trimmedValue)\n\n\treturn isValidDate(date) ? date : undefined\n}\n\nfunction toDateValue(date: Date | undefined) {\n\tif (!date) {\n\t\treturn ''\n\t}\n\n\tconst year = date.getFullYear()\n\tconst month = String(date.getMonth() + 1).padStart(2, '0')\n\tconst day = String(date.getDate()).padStart(2, '0')\n\n\treturn `${year}-${month}-${day}`\n}\n\nexport function DatePickerInput({\n\tid,\n\tlabel,\n\thideLabel = false,\n\tvalue,\n\tonChange,\n\tinvalid = false,\n\trequired = false,\n\tdisabled = false,\n\tstartMonth,\n\tendMonth,\n}: DatePickerInputProps) {\n\tconst currentYear = new Date().getFullYear()\n\tconst firstMonth = startMonth ?? new Date(currentYear - YEARS_BACK, 0, 1)\n\tconst lastMonth = endMonth ?? new Date(currentYear + YEARS_AHEAD, 11, 1)\n\tconst { t, i18n } = useTranslation(STOA_NS)\n\tconst language = i18n.resolvedLanguage ?? 'de'\n\tconst calendarLocales = { de, 'de-AT': deAT, en: enUS, it }\n\tconst calendarLocale =\n\t\tcalendarLocales[language as keyof typeof calendarLocales] ?? de\n\tconst [open, setOpen] = React.useState(false)\n\tconst [date, setDate] = React.useState<Date | undefined>(() =>\n\t\tparseDateValue(value),\n\t)\n\tconst [month, setMonth] = React.useState<Date | undefined>(date)\n\tconst [inputValue, setInputValue] = React.useState(formatDate(date) || value)\n\n\tReact.useEffect(() => {\n\t\tif (disabled) setOpen(false)\n\t}, [disabled])\n\n\tconst updateValue = (nextValue: string) => {\n\t\tif (nextValue !== value) onChange(nextValue)\n\t}\n\n\tconst handleSetToday = () => {\n\t\tif (disabled) return\n\t\tconst today = new Date()\n\t\tsetDate(today)\n\t\tsetMonth(today)\n\t\tsetInputValue(formatDate(today))\n\t\tupdateValue(toDateValue(today))\n\t\tsetOpen(false)\n\t}\n\n\tconst commitInputValue = (valueToCommit: string) => {\n\t\tif (disabled) return\n\t\tif (!valueToCommit.trim()) {\n\t\t\tsetDate(undefined)\n\t\t\tsetMonth(undefined)\n\t\t\tsetInputValue('')\n\t\t\tupdateValue('')\n\t\t\treturn\n\t\t}\n\n\t\tconst nextDate = parseTypedDateValue(valueToCommit)\n\n\t\tif (!isValidDate(nextDate)) {\n\t\t\treturn\n\t\t}\n\n\t\tsetDate(nextDate)\n\t\tsetMonth(nextDate)\n\t\tsetInputValue(formatDate(nextDate))\n\t\tupdateValue(toDateValue(nextDate))\n\t}\n\n\tReact.useEffect(() => {\n\t\tconst nextDate = parseDateValue(value)\n\n\t\tsetDate(nextDate)\n\t\tsetMonth(nextDate)\n\t\tsetInputValue(formatDate(nextDate, { locale: language }) || value)\n\t}, [value, language])\n\n\treturn (\n\t\t<Field className='w-full'>\n\t\t\t{!hideLabel && <FieldLabel htmlFor={id}>{label}</FieldLabel>}\n\t\t\t<InputGroup aria-invalid={invalid}>\n\t\t\t\t<InputGroupInput\n\t\t\t\t\tid={id}\n\t\t\t\t\taria-label={hideLabel ? label : undefined}\n\t\t\t\t\taria-invalid={invalid}\n\t\t\t\t\tvalue={inputValue}\n\t\t\t\t\t// placeholder={formatDate(new Date())}\n\t\t\t\t\tplaceholder={undefined}\n\t\t\t\t\trequired={required}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\tconst nextInputValue = e.target.value\n\t\t\t\t\t\tsetInputValue(nextInputValue)\n\t\t\t\t\t\tcommitInputValue(nextInputValue)\n\t\t\t\t\t}}\n\t\t\t\t\tonBlur={() => {\n\t\t\t\t\t\tcommitInputValue(inputValue)\n\t\t\t\t\t}}\n\t\t\t\t\tonKeyDown={(e) => {\n\t\t\t\t\t\tif (e.key === 'Enter') {\n\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\tcommitInputValue(inputValue)\n\t\t\t\t\t\t\tsetOpen(false)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (e.key === 'ArrowDown') {\n\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\tsetOpen(true)\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t\t<InputGroupAddon align='inline-end'>\n\t\t\t\t\t<Popover open={open && !disabled} onOpenChange={setOpen}>\n\t\t\t\t\t\t<PopoverTrigger asChild>\n\t\t\t\t\t\t\t<InputGroupButton\n\t\t\t\t\t\t\t\tid={`${id}-picker`}\n\t\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t\t\tvariant='ghost'\n\t\t\t\t\t\t\t\tsize='icon-xs'\n\t\t\t\t\t\t\t\taria-label={t('datePicker.selectDate')}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<CalendarIcon />\n\t\t\t\t\t\t\t\t<span className='sr-only'>{t('datePicker.selectDate')}</span>\n\t\t\t\t\t\t\t</InputGroupButton>\n\t\t\t\t\t\t</PopoverTrigger>\n\t\t\t\t\t\t<PopoverContent\n\t\t\t\t\t\t\tclassName='w-auto overflow-hidden p-0'\n\t\t\t\t\t\t\talign='end'\n\t\t\t\t\t\t\talignOffset={-8}\n\t\t\t\t\t\t\tsideOffset={10}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className='flex items-center justify-center px-1 py-2 mb-1 border-b'>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\ttype='button'\n\t\t\t\t\t\t\t\t\tvariant='ghost'\n\t\t\t\t\t\t\t\t\tsize='sm'\n\t\t\t\t\t\t\t\t\tonClick={handleSetToday}\n\t\t\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t\t\t\tclassName='w-fit'\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Target /> {t('datePicker.today')}\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<Calendar\n\t\t\t\t\t\t\t\tmode='single'\n\t\t\t\t\t\t\t\tcaptionLayout='dropdown'\n\t\t\t\t\t\t\t\t// Always six week rows: the popover keeps its height, so the\n\t\t\t\t\t\t\t\t// month chevrons never jump away from the pointer.\n\t\t\t\t\t\t\t\tfixedWeeks\n\t\t\t\t\t\t\t\tstartMonth={firstMonth}\n\t\t\t\t\t\t\t\tendMonth={lastMonth}\n\t\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t\t\tlocale={calendarLocale}\n\t\t\t\t\t\t\t\tlabels={{\n\t\t\t\t\t\t\t\t\tlabelNext: () => t('datePicker.nextMonth'),\n\t\t\t\t\t\t\t\t\tlabelPrevious: () => t('datePicker.previousMonth'),\n\t\t\t\t\t\t\t\t\tlabelMonthDropdown: () => t('datePicker.chooseMonth'),\n\t\t\t\t\t\t\t\t\tlabelYearDropdown: () => t('datePicker.chooseYear'),\n\t\t\t\t\t\t\t\t\tlabelNav: () => t('datePicker.navigation'),\n\t\t\t\t\t\t\t\t\tlabelDayButton: (day, modifiers) =>\n\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\tmodifiers.today ? t('datePicker.today') : '',\n\t\t\t\t\t\t\t\t\t\t\tnew Intl.DateTimeFormat(language, {\n\t\t\t\t\t\t\t\t\t\t\t\tdateStyle: 'full',\n\t\t\t\t\t\t\t\t\t\t\t}).format(day),\n\t\t\t\t\t\t\t\t\t\t\tmodifiers.selected ? t('datePicker.selected') : '',\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t\t\t\t\t\t\t.join(', '),\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tselected={date}\n\t\t\t\t\t\t\t\tmonth={month}\n\t\t\t\t\t\t\t\tonMonthChange={setMonth}\n\t\t\t\t\t\t\t\tonSelect={(date) => {\n\t\t\t\t\t\t\t\t\tif (disabled) return\n\t\t\t\t\t\t\t\t\tsetDate(date)\n\t\t\t\t\t\t\t\t\tsetInputValue(formatDate(date))\n\t\t\t\t\t\t\t\t\tupdateValue(toDateValue(date))\n\t\t\t\t\t\t\t\t\tsetOpen(false)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PopoverContent>\n\t\t\t\t\t</Popover>\n\t\t\t\t</InputGroupAddon>\n\t\t\t</InputGroup>\n\t\t</Field>\n\t)\n}\n"],"names":["YEARS_BACK","YEARS_AHEAD","parseDateValue","value","parseTypedDateValue","createDateIfValid","year","month","day","date","normalizeTextValue","tokenizeDateText","parseLocaleDateValue","partOrder","getRuntimeLocale","part","normalizedParts","monthNames","monthIndex","monthDate","longMonth","shortMonth","partType","index","partValue","trimmedValue","isoDateMatch","yearValue","monthValue","dayValue","numericDateMatch","localeDate","isValidDate","toDateValue","DatePickerInput","id","label","hideLabel","onChange","invalid","required","disabled","startMonth","endMonth","currentYear","firstMonth","lastMonth","t","i18n","useTranslation","STOA_NS","language","calendarLocale","de","deAT","enUS","it","open","setOpen","React","setDate","setMonth","inputValue","setInputValue","formatDate","updateValue","nextValue","handleSetToday","today","commitInputValue","valueToCommit","nextDate","jsxs","Field","jsx","FieldLabel","InputGroup","InputGroupInput","nextInputValue","InputGroupAddon","Popover","PopoverTrigger","InputGroupButton","CalendarIcon","PopoverContent","Button","Target","Calendar","modifiers"],"mappings":";;;;;;;;;;;;AAgCA,MAAMA,KAAa,KACbC,KAAc;AAEpB,SAASC,EAAeC,GAAe;AACtC,SAAOC,EAAoBD,CAAK;AACjC;AAEA,SAASE,EAAkBC,GAAcC,GAAeC,GAAa;AACpE,QAAMC,IAAO,IAAI,KAAKH,GAAMC,IAAQ,GAAGC,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1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { isTauri as a, invoke as u } from "@tauri-apps/api/core";
3
+ import { cn as f } from "../../utils/cn.js";
4
+ function s({
5
+ href: e,
6
+ className: n,
7
+ onClick: o,
8
+ children: t,
9
+ ...i
10
+ }) {
11
+ return /* @__PURE__ */ l(
12
+ "a",
13
+ {
14
+ ...i,
15
+ href: e,
16
+ target: "_blank",
17
+ rel: "noreferrer",
18
+ "data-slot": "external-link",
19
+ className: f("underline underline-offset-2", n),
20
+ onClick: (r) => {
21
+ o?.(r), !(r.defaultPrevented || !a()) && (r.preventDefault(), u("plugin:opener|open_url", { url: e }));
22
+ },
23
+ children: t
24
+ }
25
+ );
26
+ }
27
+ export {
28
+ s as ExternalLink
29
+ };
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/shell/ExternalLink/index.tsx"],"sourcesContent":["import { invoke, isTauri } from '@tauri-apps/api/core'\nimport type { ComponentProps } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport type ExternalLinkProps = ComponentProps<'a'> & { href: string }\n\n/**\n * Opens http(s) links in the system browser inside Tauri (needs the opener\n * plugin on the Rust side) and in a new tab in the browser preview.\n */\nexport function ExternalLink({\n\thref,\n\tclassName,\n\tonClick,\n\tchildren,\n\t...props\n}: ExternalLinkProps) {\n\treturn (\n\t\t<a\n\t\t\t{...props}\n\t\t\thref={href}\n\t\t\ttarget='_blank'\n\t\t\trel='noreferrer'\n\t\t\tdata-slot='external-link'\n\t\t\tclassName={cn('underline underline-offset-2', className)}\n\t\t\tonClick={(event) => {\n\t\t\t\tonClick?.(event)\n\t\t\t\tif (event.defaultPrevented || !isTauri()) return\n\t\t\t\tevent.preventDefault()\n\t\t\t\tvoid invoke('plugin:opener|open_url', { url: href })\n\t\t\t}}\n\t\t>\n\t\t\t{children}\n\t\t</a>\n\t)\n}\n"],"names":["ExternalLink","href","className","onClick","children","props","jsx","cn","event","isTauri","invoke"],"mappings":";;;AAUO,SAASA,EAAa;AAAA,EAC5B,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACJ,GAAsB;AACrB,SACC,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,GAAGD;AAAA,MACJ,MAAAJ;AAAA,MACA,QAAO;AAAA,MACP,KAAI;AAAA,MACJ,aAAU;AAAA,MACV,WAAWM,EAAG,gCAAgCL,CAAS;AAAA,MACvD,SAAS,CAACM,MAAU;AAEnB,QADAL,IAAUK,CAAK,GACX,EAAAA,EAAM,oBAAoB,CAACC,SAC/BD,EAAM,eAAA,GACDE,EAAO,0BAA0B,EAAE,KAAKT,GAAM;AAAA,MACpD;AAAA,MAEC,UAAAG;AAAA,IAAA;AAAA,EAAA;AAGJ;"}
@@ -1,14 +1,21 @@
1
- import { jsxs as n, jsx as o } from "react/jsx-runtime";
2
- import { cn as m } from "../../utils/cn.js";
1
+ import { jsxs as i, jsx as n } from "react/jsx-runtime";
2
+ import { cn as o } from "../../utils/cn.js";
3
3
  import { BrandLines as s } from "../BrandLines/index.js";
4
4
  import t from "./PageHeading.module.scss.js";
5
- function d({ children: r, className: e, plain: i }) {
6
- return /* @__PURE__ */ n("h2", { className: m(t.pageHeading, "shrink-0", e), children: [
7
- !i && /* @__PURE__ */ o(s, {}),
8
- r
9
- ] });
5
+ function f({ children: r, className: e, plain: a }) {
6
+ return /* @__PURE__ */ i(
7
+ "h2",
8
+ {
9
+ "data-slot": "page-heading",
10
+ className: o(t.pageHeading, "shrink-0", e),
11
+ children: [
12
+ !a && /* @__PURE__ */ n(s, {}),
13
+ r
14
+ ]
15
+ }
16
+ );
10
17
  }
11
18
  export {
12
- d as PageHeading
19
+ f as PageHeading
13
20
  };
14
21
  //# sourceMappingURL=index.js.map