@stoa-dev/kit 0.0.0-stage → 0.1.1
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.
- package/LICENSE +21 -0
- package/README.md +80 -2
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useOnlineStatus/index.js +14 -0
- package/dist/hooks/useOnlineStatus/index.js.map +1 -0
- package/dist/hooks/useRouting/index.js +17 -0
- package/dist/hooks/useRouting/index.js.map +1 -0
- package/dist/i18n/index.js +30 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/locales/at.json.js +16 -0
- package/dist/i18n/locales/at.json.js.map +1 -0
- package/dist/i18n/locales/de.json.js +16 -0
- package/dist/i18n/locales/de.json.js.map +1 -0
- package/dist/i18n/locales/en.json.js +16 -0
- package/dist/i18n/locales/en.json.js.map +1 -0
- package/dist/i18n/locales/it.json.js +16 -0
- package/dist/i18n/locales/it.json.js.map +1 -0
- package/dist/i18n/namespace.js +5 -0
- package/dist/i18n/namespace.js.map +1 -0
- package/dist/kit.css +1 -0
- package/dist/licensing/LicenseActivation/index.js +101 -0
- package/dist/licensing/LicenseActivation/index.js.map +1 -0
- package/dist/licensing/LicenseCard/index.js +149 -0
- package/dist/licensing/LicenseCard/index.js.map +1 -0
- package/dist/licensing/LicenseGate/index.js +72 -0
- package/dist/licensing/LicenseGate/index.js.map +1 -0
- package/dist/licensing/LicenseProvider/index.js +137 -0
- package/dist/licensing/LicenseProvider/index.js.map +1 -0
- package/dist/licensing/LicenseStatusBanner/index.js +135 -0
- package/dist/licensing/LicenseStatusBanner/index.js.map +1 -0
- package/dist/licensing/api.js +57 -0
- package/dist/licensing/api.js.map +1 -0
- package/dist/licensing/index.js +23 -0
- package/dist/licensing/index.js.map +1 -0
- package/dist/shell/AppNavigation/AppNavigation.module.scss.js +16 -0
- package/dist/shell/AppNavigation/AppNavigation.module.scss.js.map +1 -0
- package/dist/shell/AppNavigation/index.js +136 -0
- package/dist/shell/AppNavigation/index.js.map +1 -0
- package/dist/shell/BackHomeButton/index.js +23 -0
- package/dist/shell/BackHomeButton/index.js.map +1 -0
- package/dist/shell/BrandLines/BrandLines.module.scss.js +10 -0
- package/dist/shell/BrandLines/BrandLines.module.scss.js.map +1 -0
- package/dist/shell/BrandLines/index.js +25 -0
- package/dist/shell/BrandLines/index.js.map +1 -0
- package/dist/shell/ConfirmDialog/index.js +53 -0
- package/dist/shell/ConfirmDialog/index.js.map +1 -0
- package/dist/shell/DatePicker/index.js +219 -0
- package/dist/shell/DatePicker/index.js.map +1 -0
- package/dist/shell/ErrorBoundary/index.js +29 -0
- package/dist/shell/ErrorBoundary/index.js.map +1 -0
- package/dist/shell/NativeSelect/index.js +24 -0
- package/dist/shell/NativeSelect/index.js.map +1 -0
- package/dist/shell/PageHeading/PageHeading.module.scss.js +8 -0
- package/dist/shell/PageHeading/PageHeading.module.scss.js.map +1 -0
- package/dist/shell/PageHeading/index.js +14 -0
- package/dist/shell/PageHeading/index.js.map +1 -0
- package/dist/shell/SectionNavigation/index.js +116 -0
- package/dist/shell/SectionNavigation/index.js.map +1 -0
- package/dist/shell/Spinner/index.js +16 -0
- package/dist/shell/Spinner/index.js.map +1 -0
- package/dist/shell/UploadButton/index.js +44 -0
- package/dist/shell/UploadButton/index.js.map +1 -0
- package/dist/shell/index.js +29 -0
- package/dist/shell/index.js.map +1 -0
- package/dist/types/hooks/index.d.ts +3 -0
- package/dist/types/hooks/index.d.ts.map +1 -0
- package/dist/types/hooks/useOnlineStatus/index.d.ts +2 -0
- package/dist/types/hooks/useOnlineStatus/index.d.ts.map +1 -0
- package/dist/types/hooks/useRouting/index.d.ts +14 -0
- package/dist/types/hooks/useRouting/index.d.ts.map +1 -0
- package/dist/types/i18n/index.d.ts +582 -0
- package/dist/types/i18n/index.d.ts.map +1 -0
- package/dist/types/i18n/namespace.d.ts +3 -0
- package/dist/types/i18n/namespace.d.ts.map +1 -0
- package/dist/types/licensing/LicenseActivation/index.d.ts +8 -0
- package/dist/types/licensing/LicenseActivation/index.d.ts.map +1 -0
- package/dist/types/licensing/LicenseCard/index.d.ts +2 -0
- package/dist/types/licensing/LicenseCard/index.d.ts.map +1 -0
- package/dist/types/licensing/LicenseGate/index.d.ts +11 -0
- package/dist/types/licensing/LicenseGate/index.d.ts.map +1 -0
- package/dist/types/licensing/LicenseProvider/index.d.ts +20 -0
- package/dist/types/licensing/LicenseProvider/index.d.ts.map +1 -0
- package/dist/types/licensing/LicenseStatusBanner/index.d.ts +4 -0
- package/dist/types/licensing/LicenseStatusBanner/index.d.ts.map +1 -0
- package/dist/types/licensing/api.d.ts +28 -0
- package/dist/types/licensing/api.d.ts.map +1 -0
- package/dist/types/licensing/index.d.ts +7 -0
- package/dist/types/licensing/index.d.ts.map +1 -0
- package/dist/types/shell/AppNavigation/index.d.ts +45 -0
- package/dist/types/shell/AppNavigation/index.d.ts.map +1 -0
- package/dist/types/shell/BackHomeButton/index.d.ts +7 -0
- package/dist/types/shell/BackHomeButton/index.d.ts.map +1 -0
- package/dist/types/shell/BrandLines/index.d.ts +6 -0
- package/dist/types/shell/BrandLines/index.d.ts.map +1 -0
- package/dist/types/shell/ConfirmDialog/index.d.ts +21 -0
- package/dist/types/shell/ConfirmDialog/index.d.ts.map +1 -0
- package/dist/types/shell/DatePicker/index.d.ts +14 -0
- package/dist/types/shell/DatePicker/index.d.ts.map +1 -0
- package/dist/types/shell/ErrorBoundary/index.d.ts +20 -0
- package/dist/types/shell/ErrorBoundary/index.d.ts.map +1 -0
- package/dist/types/shell/NativeSelect/index.d.ts +3 -0
- package/dist/types/shell/NativeSelect/index.d.ts.map +1 -0
- package/dist/types/shell/PageHeading/index.d.ts +9 -0
- package/dist/types/shell/PageHeading/index.d.ts.map +1 -0
- package/dist/types/shell/SectionNavigation/index.d.ts +12 -0
- package/dist/types/shell/SectionNavigation/index.d.ts.map +1 -0
- package/dist/types/shell/Spinner/index.d.ts +6 -0
- package/dist/types/shell/Spinner/index.d.ts.map +1 -0
- package/dist/types/shell/UploadButton/index.d.ts +6 -0
- package/dist/types/shell/UploadButton/index.d.ts.map +1 -0
- package/dist/types/shell/index.d.ts +12 -0
- package/dist/types/shell/index.d.ts.map +1 -0
- package/dist/types/ui/accordion/index.d.ts +8 -0
- package/dist/types/ui/accordion/index.d.ts.map +1 -0
- package/dist/types/ui/button/index.d.ts +11 -0
- package/dist/types/ui/button/index.d.ts.map +1 -0
- package/dist/types/ui/calendar/index.d.ts +11 -0
- package/dist/types/ui/calendar/index.d.ts.map +1 -0
- package/dist/types/ui/card/index.d.ts +12 -0
- package/dist/types/ui/card/index.d.ts.map +1 -0
- package/dist/types/ui/dialog/index.d.ts +18 -0
- package/dist/types/ui/dialog/index.d.ts.map +1 -0
- package/dist/types/ui/dropdown-menu/index.d.ts +30 -0
- package/dist/types/ui/dropdown-menu/index.d.ts.map +1 -0
- package/dist/types/ui/field/index.d.ts +25 -0
- package/dist/types/ui/field/index.d.ts.map +1 -0
- package/dist/types/ui/index.d.ts +21 -0
- package/dist/types/ui/index.d.ts.map +1 -0
- package/dist/types/ui/input/index.d.ts +4 -0
- package/dist/types/ui/input/index.d.ts.map +1 -0
- package/dist/types/ui/input-group/index.d.ts +17 -0
- package/dist/types/ui/input-group/index.d.ts.map +1 -0
- package/dist/types/ui/label/index.d.ts +5 -0
- package/dist/types/ui/label/index.d.ts.map +1 -0
- package/dist/types/ui/popover/index.d.ts +11 -0
- package/dist/types/ui/popover/index.d.ts.map +1 -0
- package/dist/types/ui/radio-group/index.d.ts +6 -0
- package/dist/types/ui/radio-group/index.d.ts.map +1 -0
- package/dist/types/ui/scroll-area/index.d.ts +6 -0
- package/dist/types/ui/scroll-area/index.d.ts.map +1 -0
- package/dist/types/ui/select/index.d.ts +16 -0
- package/dist/types/ui/select/index.d.ts.map +1 -0
- package/dist/types/ui/separator/index.d.ts +5 -0
- package/dist/types/ui/separator/index.d.ts.map +1 -0
- package/dist/types/ui/sonner/index.d.ts +4 -0
- package/dist/types/ui/sonner/index.d.ts.map +1 -0
- package/dist/types/ui/switch/index.d.ts +7 -0
- package/dist/types/ui/switch/index.d.ts.map +1 -0
- package/dist/types/ui/textarea/index.d.ts +4 -0
- package/dist/types/ui/textarea/index.d.ts.map +1 -0
- package/dist/types/ui/toggle/index.d.ts +10 -0
- package/dist/types/ui/toggle/index.d.ts.map +1 -0
- package/dist/types/ui/tooltip/index.d.ts +8 -0
- package/dist/types/ui/tooltip/index.d.ts.map +1 -0
- package/dist/types/utils/cn.d.ts +3 -0
- package/dist/types/utils/cn.d.ts.map +1 -0
- package/dist/types/utils/colors.d.ts +3 -0
- package/dist/types/utils/colors.d.ts.map +1 -0
- package/dist/types/utils/dates.d.ts +9 -0
- package/dist/types/utils/dates.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +4 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/ui/accordion/index.js +65 -0
- package/dist/ui/accordion/index.js.map +1 -0
- package/dist/ui/button/index.js +57 -0
- package/dist/ui/button/index.js.map +1 -0
- package/dist/ui/calendar/index.js +179 -0
- package/dist/ui/calendar/index.js.map +1 -0
- package/dist/ui/card/index.js +102 -0
- package/dist/ui/card/index.js.map +1 -0
- package/dist/ui/dialog/index.js +158 -0
- package/dist/ui/dialog/index.js.map +1 -0
- package/dist/ui/dropdown-menu/index.js +252 -0
- package/dist/ui/dropdown-menu/index.js.map +1 -0
- package/dist/ui/field/index.js +209 -0
- package/dist/ui/field/index.js.map +1 -0
- package/dist/ui/index.js +112 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/input/index.js +20 -0
- package/dist/ui/input/index.js.map +1 -0
- package/dist/ui/input-group/index.js +143 -0
- package/dist/ui/input-group/index.js.map +1 -0
- package/dist/ui/label/index.js +23 -0
- package/dist/ui/label/index.js.map +1 -0
- package/dist/ui/popover/index.js +81 -0
- package/dist/ui/popover/index.js.map +1 -0
- package/dist/ui/radio-group/index.js +45 -0
- package/dist/ui/radio-group/index.js.map +1 -0
- package/dist/ui/scroll-area/index.js +60 -0
- package/dist/ui/scroll-area/index.js.map +1 -0
- package/dist/ui/select/index.js +182 -0
- package/dist/ui/select/index.js.map +1 -0
- package/dist/ui/separator/index.js +27 -0
- package/dist/ui/separator/index.js.map +1 -0
- package/dist/ui/sonner/index.js +37 -0
- package/dist/ui/sonner/index.js.map +1 -0
- package/dist/ui/switch/index.js +32 -0
- package/dist/ui/switch/index.js.map +1 -0
- package/dist/ui/textarea/index.js +19 -0
- package/dist/ui/textarea/index.js.map +1 -0
- package/dist/ui/toggle/index.js +44 -0
- package/dist/ui/toggle/index.js.map +1 -0
- package/dist/ui/tooltip/index.js +56 -0
- package/dist/ui/tooltip/index.js.map +1 -0
- package/dist/utils/cn.js +9 -0
- package/dist/utils/cn.js.map +1 -0
- package/dist/utils/colors.js +8 -0
- package/dist/utils/colors.js.map +1 -0
- package/dist/utils/dates.js +28 -0
- package/dist/utils/dates.js.map +1 -0
- package/dist/utils/index.js +12 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +121 -4
- package/scss/_index.scss +4 -0
- package/scss/_tools.scss +21 -0
- package/styles/theme.css +192 -0
|
@@ -0,0 +1,136 @@
|
|
|
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";
|
|
11
|
+
import s from "./AppNavigation.module.scss.js";
|
|
12
|
+
function B(i) {
|
|
13
|
+
return typeof i == "object" && i !== null && "path" in i && "Icon" in i;
|
|
14
|
+
}
|
|
15
|
+
function b(i) {
|
|
16
|
+
return typeof i == "object" && i !== null && "onClick" in i && "Icon" in i;
|
|
17
|
+
}
|
|
18
|
+
function g({
|
|
19
|
+
label: i,
|
|
20
|
+
children: o
|
|
21
|
+
}) {
|
|
22
|
+
return /* @__PURE__ */ c(C, { children: [
|
|
23
|
+
/* @__PURE__ */ t(j, { asChild: !0, children: o }),
|
|
24
|
+
/* @__PURE__ */ t(x, { side: "right", children: i })
|
|
25
|
+
] });
|
|
26
|
+
}
|
|
27
|
+
function F({
|
|
28
|
+
path: i,
|
|
29
|
+
label: o,
|
|
30
|
+
Icon: r,
|
|
31
|
+
isActive: e,
|
|
32
|
+
disabled: n
|
|
33
|
+
}) {
|
|
34
|
+
const { pathname: a } = A(), m = e ? e(a) : a === i;
|
|
35
|
+
return /* @__PURE__ */ t(g, { label: o, children: /* @__PURE__ */ t(
|
|
36
|
+
f,
|
|
37
|
+
{
|
|
38
|
+
variant: "ghost",
|
|
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,
|
|
45
|
+
{
|
|
46
|
+
to: i,
|
|
47
|
+
"aria-label": o,
|
|
48
|
+
"aria-current": m ? "page" : void 0,
|
|
49
|
+
children: /* @__PURE__ */ t(r, { className: "size-4", strokeWidth: 1.75 })
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
) });
|
|
54
|
+
}
|
|
55
|
+
function v({
|
|
56
|
+
label: i,
|
|
57
|
+
Icon: o,
|
|
58
|
+
onClick: r,
|
|
59
|
+
disabled: e
|
|
60
|
+
}) {
|
|
61
|
+
return /* @__PURE__ */ t(g, { label: i, children: /* @__PURE__ */ t(
|
|
62
|
+
f,
|
|
63
|
+
{
|
|
64
|
+
variant: "ghost",
|
|
65
|
+
size: "icon",
|
|
66
|
+
className: l(s.menuButton, "rounded-xl"),
|
|
67
|
+
"aria-label": i,
|
|
68
|
+
disabled: e,
|
|
69
|
+
onClick: r,
|
|
70
|
+
children: /* @__PURE__ */ t(o, { className: "size-4", strokeWidth: 1.75 })
|
|
71
|
+
}
|
|
72
|
+
) });
|
|
73
|
+
}
|
|
74
|
+
function J({
|
|
75
|
+
onToggle: i,
|
|
76
|
+
theme: o = "system",
|
|
77
|
+
disabled: r,
|
|
78
|
+
label: e
|
|
79
|
+
}) {
|
|
80
|
+
const { t: n } = d(h), { resolvedTheme: a } = k(), m = o === "system" ? a : o;
|
|
81
|
+
return /* @__PURE__ */ t(
|
|
82
|
+
v,
|
|
83
|
+
{
|
|
84
|
+
label: e ?? n("app.switchTheme"),
|
|
85
|
+
Icon: T,
|
|
86
|
+
disabled: r,
|
|
87
|
+
onClick: () => {
|
|
88
|
+
i(m === "dark" ? "light" : "dark");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
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) => (
|
|
98
|
+
// 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}`)
|
|
103
|
+
));
|
|
104
|
+
}
|
|
105
|
+
function K({
|
|
106
|
+
groups: i,
|
|
107
|
+
logo: o,
|
|
108
|
+
footerGroups: r,
|
|
109
|
+
label: e,
|
|
110
|
+
className: n
|
|
111
|
+
}) {
|
|
112
|
+
const { t: a } = d(h);
|
|
113
|
+
return /* @__PURE__ */ c(
|
|
114
|
+
"nav",
|
|
115
|
+
{
|
|
116
|
+
"aria-label": e ?? a("app.navigation"),
|
|
117
|
+
className: l(s.root, n),
|
|
118
|
+
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: [
|
|
122
|
+
/* @__PURE__ */ t("div", { className: s.spacer }),
|
|
123
|
+
u(r, "footer")
|
|
124
|
+
] })
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
export {
|
|
130
|
+
K as AppNavigation,
|
|
131
|
+
v as AppNavigationButton,
|
|
132
|
+
I as AppNavigationDivider,
|
|
133
|
+
F as AppNavigationItem,
|
|
134
|
+
J as AppNavigationThemeToggle
|
|
135
|
+
};
|
|
136
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,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,WAAWC,EAAGC,EAAO,YAAY,YAAY;AAAA,MAC7C,UAAAN;AAAA,MACA,SAAS,CAACA;AAAA,MAET,cACA,gBAAAP,EAACK,GAAA,EAAK,WAAU,UAAS,aAAa,MAAM,IAE5C,gBAAAL;AAAA,QAACc;AAAA,QAAA;AAAA,UACA,IAAIV;AAAA,UACJ,cAAYP;AAAA,UACZ,gBAAca,IAAS,SAAS;AAAA,UAEhC,UAAA,gBAAAV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|
|
3
|
+
import { useTranslation as a } from "react-i18next";
|
|
4
|
+
import { useRouting as e } from "../../hooks/useRouting/index.js";
|
|
5
|
+
import { STOA_NS as f } from "../../i18n/namespace.js";
|
|
6
|
+
import { Button as p } from "../../ui/button/index.js";
|
|
7
|
+
function T({ to: t = "/", label: r }) {
|
|
8
|
+
const { routeToDefault: i } = e(t), { t: n } = a(f);
|
|
9
|
+
return /* @__PURE__ */ o(
|
|
10
|
+
p,
|
|
11
|
+
{
|
|
12
|
+
variant: "ghost",
|
|
13
|
+
size: "icon",
|
|
14
|
+
"aria-label": r ?? n("app.back"),
|
|
15
|
+
onClick: i,
|
|
16
|
+
children: /* @__PURE__ */ o(m, {})
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
T as BackHomeButton
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/shell/BackHomeButton/index.tsx"],"sourcesContent":["import { ArrowLeft } from 'lucide-react'\nimport { useTranslation } from 'react-i18next'\nimport { useRouting } from '../../hooks/useRouting'\nimport { STOA_NS } from '../../i18n/namespace'\nimport { Button } from '../../ui/button'\n\nexport interface BackHomeButtonProps {\n\t/** Route to return to. Defaults to `/`. */\n\tto?: string\n\tlabel?: string\n}\n\nexport function BackHomeButton({ to = '/', label }: BackHomeButtonProps) {\n\tconst { routeToDefault } = useRouting(to)\n\tconst { t } = useTranslation(STOA_NS)\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={routeToDefault}\n\t\t>\n\t\t\t<ArrowLeft />\n\t\t</Button>\n\t)\n}\n"],"names":["BackHomeButton","to","label","routeToDefault","useRouting","t","useTranslation","STOA_NS","jsx","Button","ArrowLeft"],"mappings":";;;;;;AAYO,SAASA,EAAe,EAAE,IAAAC,IAAK,KAAK,OAAAC,KAA8B;AACxE,QAAM,EAAE,gBAAAC,EAAA,IAAmBC,EAAWH,CAAE,GAClC,EAAE,GAAAI,EAAA,IAAMC,EAAeC,CAAO;AACpC,SACC,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACA,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,cAAYP,KAASG,EAAE,UAAU;AAAA,MACjC,SAASF;AAAA,MAET,4BAACO,GAAA,CAAA,CAAU;AAAA,IAAA;AAAA,EAAA;AAGd;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const n = "stoa-BrandLines-brand-lines-dcsr", s = "stoa-BrandLines-brand-lines-loading-1z0s", a = {
|
|
2
|
+
brandLines: n,
|
|
3
|
+
brandLinesLoading: s
|
|
4
|
+
};
|
|
5
|
+
export {
|
|
6
|
+
n as brandLines,
|
|
7
|
+
s as brandLinesLoading,
|
|
8
|
+
a as default
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=BrandLines.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrandLines.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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(
|
|
6
|
+
"span",
|
|
7
|
+
{
|
|
8
|
+
"aria-hidden": "true",
|
|
9
|
+
className: a(
|
|
10
|
+
i.brandLines,
|
|
11
|
+
n && i.brandLinesLoading,
|
|
12
|
+
s
|
|
13
|
+
),
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ r("i", {}),
|
|
16
|
+
/* @__PURE__ */ r("i", {}),
|
|
17
|
+
/* @__PURE__ */ r("i", {})
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
m as BrandLines
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsxs as e, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as s } from "react";
|
|
3
|
+
import { useTranslation as T } from "react-i18next";
|
|
4
|
+
import { STOA_NS as b } from "../../i18n/namespace.js";
|
|
5
|
+
import { Button as c } from "../../ui/button/index.js";
|
|
6
|
+
import { Dialog as v, DialogTrigger as S, DialogContent as j, DialogHeader as x, DialogTitle as B, DialogDescription as k, DialogFooter as w, DialogClose as A } from "../../ui/dialog/index.js";
|
|
7
|
+
function z({
|
|
8
|
+
title: d,
|
|
9
|
+
description: f,
|
|
10
|
+
confirmLabel: h,
|
|
11
|
+
cancelLabel: m,
|
|
12
|
+
onConfirm: p,
|
|
13
|
+
trigger: i,
|
|
14
|
+
open: n,
|
|
15
|
+
onOpenChange: u,
|
|
16
|
+
variant: g = "destructive"
|
|
17
|
+
}) {
|
|
18
|
+
const { t: D } = T(b), [C, y] = s(!1), [r, t] = s(!1), O = n ?? C, l = (a) => {
|
|
19
|
+
n === void 0 && y(a), u?.(a);
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ e(v, { open: O, onOpenChange: l, children: [
|
|
22
|
+
i && /* @__PURE__ */ o(S, { asChild: !0, children: i }),
|
|
23
|
+
/* @__PURE__ */ e(j, { children: [
|
|
24
|
+
/* @__PURE__ */ e(x, { children: [
|
|
25
|
+
/* @__PURE__ */ o(B, { children: d }),
|
|
26
|
+
/* @__PURE__ */ o(k, { children: f })
|
|
27
|
+
] }),
|
|
28
|
+
/* @__PURE__ */ e(w, { children: [
|
|
29
|
+
/* @__PURE__ */ o(A, { asChild: !0, children: /* @__PURE__ */ o(c, { variant: "ghost", disabled: r, children: m ?? D("actions.cancel") }) }),
|
|
30
|
+
/* @__PURE__ */ o(
|
|
31
|
+
c,
|
|
32
|
+
{
|
|
33
|
+
variant: g,
|
|
34
|
+
disabled: r,
|
|
35
|
+
onClick: async () => {
|
|
36
|
+
t(!0);
|
|
37
|
+
try {
|
|
38
|
+
await p(), l(!1);
|
|
39
|
+
} finally {
|
|
40
|
+
t(!1);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
children: h
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
] })
|
|
47
|
+
] })
|
|
48
|
+
] });
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
z as ConfirmDialog
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/shell/ConfirmDialog/index.tsx"],"sourcesContent":["import { type ReactNode, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { STOA_NS } from '../../i18n/namespace'\nimport { Button } from '../../ui/button'\nimport {\n\tDialog,\n\tDialogClose,\n\tDialogContent,\n\tDialogDescription,\n\tDialogFooter,\n\tDialogHeader,\n\tDialogTitle,\n\tDialogTrigger,\n} from '../../ui/dialog'\n\nexport interface ConfirmDialogProps {\n\ttitle: string\n\tdescription: ReactNode\n\tconfirmLabel: string\n\tcancelLabel?: string\n\tonConfirm: () => Promise<unknown> | unknown\n\t/** Uncontrolled usage: element that opens the dialog. */\n\ttrigger?: ReactNode\n\t/** Controlled usage: pass `open` and `onOpenChange` instead of `trigger`. */\n\topen?: boolean\n\tonOpenChange?: (open: boolean) => void\n\tvariant?: 'destructive' | 'default'\n}\n\n/**\n * Supports both call styles found in the apps:\n * `<ConfirmDialog trigger={<Button/>} … />` (latextemplater) and\n * `<ConfirmDialog open={open} onOpenChange={setOpen} … />` (practicr).\n */\nexport function ConfirmDialog({\n\ttitle,\n\tdescription,\n\tconfirmLabel,\n\tcancelLabel,\n\tonConfirm,\n\ttrigger,\n\topen: controlledOpen,\n\tonOpenChange,\n\tvariant = 'destructive',\n}: ConfirmDialogProps) {\n\tconst { t } = useTranslation(STOA_NS)\n\tconst [uncontrolledOpen, setUncontrolledOpen] = useState(false)\n\tconst [busy, setBusy] = useState(false)\n\tconst open = controlledOpen ?? uncontrolledOpen\n\tconst setOpen = (next: boolean) => {\n\t\tif (controlledOpen === undefined) setUncontrolledOpen(next)\n\t\tonOpenChange?.(next)\n\t}\n\n\treturn (\n\t\t<Dialog open={open} onOpenChange={setOpen}>\n\t\t\t{trigger && <DialogTrigger asChild>{trigger}</DialogTrigger>}\n\t\t\t<DialogContent>\n\t\t\t\t<DialogHeader>\n\t\t\t\t\t<DialogTitle>{title}</DialogTitle>\n\t\t\t\t\t<DialogDescription>{description}</DialogDescription>\n\t\t\t\t</DialogHeader>\n\t\t\t\t<DialogFooter>\n\t\t\t\t\t<DialogClose asChild>\n\t\t\t\t\t\t<Button variant='ghost' disabled={busy}>\n\t\t\t\t\t\t\t{cancelLabel ?? t('actions.cancel')}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</DialogClose>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant={variant}\n\t\t\t\t\t\tdisabled={busy}\n\t\t\t\t\t\tonClick={async () => {\n\t\t\t\t\t\t\tsetBusy(true)\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tawait onConfirm()\n\t\t\t\t\t\t\t\tsetOpen(false)\n\t\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\t\tsetBusy(false)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{confirmLabel}\n\t\t\t\t\t</Button>\n\t\t\t\t</DialogFooter>\n\t\t\t</DialogContent>\n\t\t</Dialog>\n\t)\n}\n"],"names":["ConfirmDialog","title","description","confirmLabel","cancelLabel","onConfirm","trigger","controlledOpen","onOpenChange","variant","t","useTranslation","STOA_NS","uncontrolledOpen","setUncontrolledOpen","useState","busy","setBusy","open","setOpen","next","jsxs","Dialog","jsx","DialogTrigger","DialogContent","DialogHeader","DialogTitle","DialogDescription","DialogFooter","DialogClose","Button"],"mappings":";;;;;;AAkCO,SAASA,EAAc;AAAA,EAC7B,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAMC;AAAA,EACN,cAAAC;AAAA,EACA,SAAAC,IAAU;AACX,GAAuB;AACtB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAeC,CAAO,GAC9B,CAACC,GAAkBC,CAAmB,IAAIC,EAAS,EAAK,GACxD,CAACC,GAAMC,CAAO,IAAIF,EAAS,EAAK,GAChCG,IAAOX,KAAkBM,GACzBM,IAAU,CAACC,MAAkB;AAClC,IAAIb,MAAmB,UAAWO,EAAoBM,CAAI,GAC1DZ,IAAeY,CAAI;AAAA,EACpB;AAEA,SACC,gBAAAC,EAACC,GAAA,EAAO,MAAAJ,GAAY,cAAcC,GAChC,UAAA;AAAA,IAAAb,KAAW,gBAAAiB,EAACC,GAAA,EAAc,SAAO,IAAE,UAAAlB,GAAQ;AAAA,sBAC3CmB,GAAA,EACA,UAAA;AAAA,MAAA,gBAAAJ,EAACK,GAAA,EACA,UAAA;AAAA,QAAA,gBAAAH,EAACI,KAAa,UAAA1B,EAAA,CAAM;AAAA,QACpB,gBAAAsB,EAACK,KAAmB,UAAA1B,EAAA,CAAY;AAAA,MAAA,GACjC;AAAA,wBACC2B,GAAA,EACA,UAAA;AAAA,QAAA,gBAAAN,EAACO,GAAA,EAAY,SAAO,IACnB,UAAA,gBAAAP,EAACQ,GAAA,EAAO,SAAQ,SAAQ,UAAUf,GAChC,UAAAZ,KAAeM,EAAE,gBAAgB,GACnC,GACD;AAAA,QACA,gBAAAa;AAAA,UAACQ;AAAA,UAAA;AAAA,YACA,SAAAtB;AAAA,YACA,UAAUO;AAAA,YACV,SAAS,YAAY;AACpB,cAAAC,EAAQ,EAAI;AACZ,kBAAI;AACH,sBAAMZ,EAAA,GACNc,EAAQ,EAAK;AAAA,cACd,UAAA;AACC,gBAAAF,EAAQ,EAAK;AAAA,cACd;AAAA,YACD;AAAA,YAEC,UAAAd;AAAA,UAAA;AAAA,QAAA;AAAA,MACF,EAAA,CACD;AAAA,IAAA,EAAA,CACD;AAAA,EAAA,GACD;AAEF;"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { jsxs as g, jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { it as B, enUS as j, deAT as E, de as F } from "date-fns/locale";
|
|
3
|
+
import { CalendarIcon as G, Target as Y } from "lucide-react";
|
|
4
|
+
import * as y from "react";
|
|
5
|
+
import { useTranslation as R } from "react-i18next";
|
|
6
|
+
import { STOA_NS as K } from "../../i18n/namespace.js";
|
|
7
|
+
import { Button as U } from "../../ui/button/index.js";
|
|
8
|
+
import { Calendar as _ } from "../../ui/calendar/index.js";
|
|
9
|
+
import { Field as q, FieldLabel as H } from "../../ui/field/index.js";
|
|
10
|
+
import { InputGroup as J, InputGroupInput as Q, InputGroupAddon as W, InputGroupButton as X } from "../../ui/input-group/index.js";
|
|
11
|
+
import { Popover as Z, PopoverTrigger as ee, PopoverContent as te } from "../../ui/popover/index.js";
|
|
12
|
+
import { formatDate as N, isValidDate as M, getRuntimeLocale as S } from "../../utils/dates.js";
|
|
13
|
+
function C(n) {
|
|
14
|
+
return L(n);
|
|
15
|
+
}
|
|
16
|
+
function b(n, r, l) {
|
|
17
|
+
const o = new Date(n, r - 1, l);
|
|
18
|
+
if (o.getFullYear() === n && o.getMonth() === r - 1 && o.getDate() === l)
|
|
19
|
+
return o;
|
|
20
|
+
}
|
|
21
|
+
function T(n) {
|
|
22
|
+
return n.trim().toLocaleLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
23
|
+
}
|
|
24
|
+
function ne(n) {
|
|
25
|
+
return T(n).match(/[a-z0-9]+/g) ?? [];
|
|
26
|
+
}
|
|
27
|
+
function oe(n) {
|
|
28
|
+
const l = new Intl.DateTimeFormat(S(), {
|
|
29
|
+
day: "2-digit",
|
|
30
|
+
month: "long",
|
|
31
|
+
year: "numeric"
|
|
32
|
+
}).formatToParts(new Date(2026, 4, 11)).filter(
|
|
33
|
+
(e) => e.type === "day" || e.type === "month" || e.type === "year"
|
|
34
|
+
).map((e) => e.type), o = ne(n);
|
|
35
|
+
if (o.length !== l.length)
|
|
36
|
+
return;
|
|
37
|
+
const d = /* @__PURE__ */ new Map();
|
|
38
|
+
for (let e = 0; e < 12; e += 1) {
|
|
39
|
+
const s = new Date(2026, e, 1), i = new Intl.DateTimeFormat(S(), {
|
|
40
|
+
month: "long"
|
|
41
|
+
}).format(s), h = new Intl.DateTimeFormat(S(), {
|
|
42
|
+
month: "short"
|
|
43
|
+
}).format(s);
|
|
44
|
+
d.set(T(i), e + 1), d.set(T(h), e + 1);
|
|
45
|
+
}
|
|
46
|
+
let u, m, a;
|
|
47
|
+
if (l.forEach((e, s) => {
|
|
48
|
+
const i = o[s];
|
|
49
|
+
e === "day" && (u = Number(i)), e === "month" && (m = d.get(i) ?? Number(i)), e === "year" && (a = Number(i));
|
|
50
|
+
}), !(!u || !m || !a))
|
|
51
|
+
return b(a, m, u);
|
|
52
|
+
}
|
|
53
|
+
function L(n) {
|
|
54
|
+
const r = n.trim();
|
|
55
|
+
if (!r)
|
|
56
|
+
return;
|
|
57
|
+
const l = r.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
58
|
+
if (l) {
|
|
59
|
+
const [, m, a, e] = l, s = Number(m), i = Number(a), h = Number(e);
|
|
60
|
+
return b(s, i, h);
|
|
61
|
+
}
|
|
62
|
+
const o = r.match(
|
|
63
|
+
/^(\d{1,2})[./-](\d{1,2})[./-](\d{4})$/
|
|
64
|
+
);
|
|
65
|
+
if (o) {
|
|
66
|
+
const [, m, a, e] = o, s = Number(e), i = Number(a), h = Number(m);
|
|
67
|
+
return b(s, i, h);
|
|
68
|
+
}
|
|
69
|
+
if (!/\d{4}/.test(r))
|
|
70
|
+
return;
|
|
71
|
+
const d = oe(r);
|
|
72
|
+
if (M(d))
|
|
73
|
+
return d;
|
|
74
|
+
const u = new Date(r);
|
|
75
|
+
return M(u) ? u : void 0;
|
|
76
|
+
}
|
|
77
|
+
function x(n) {
|
|
78
|
+
if (!n)
|
|
79
|
+
return "";
|
|
80
|
+
const r = n.getFullYear(), l = String(n.getMonth() + 1).padStart(2, "0"), o = String(n.getDate()).padStart(2, "0");
|
|
81
|
+
return `${r}-${l}-${o}`;
|
|
82
|
+
}
|
|
83
|
+
function pe({
|
|
84
|
+
id: n,
|
|
85
|
+
label: r,
|
|
86
|
+
hideLabel: l = !1,
|
|
87
|
+
value: o,
|
|
88
|
+
onChange: d,
|
|
89
|
+
invalid: u = !1,
|
|
90
|
+
required: m = !1,
|
|
91
|
+
disabled: a = !1
|
|
92
|
+
}) {
|
|
93
|
+
const { t: e, i18n: s } = R(K), i = s.resolvedLanguage ?? "de", z = { de: F, "de-AT": E, en: j, it: B }[i] ?? F, [O, p] = y.useState(!1), [V, v] = y.useState(
|
|
94
|
+
() => C(o)
|
|
95
|
+
), [$, w] = y.useState(V), [k, D] = y.useState(N(V) || o);
|
|
96
|
+
y.useEffect(() => {
|
|
97
|
+
a && p(!1);
|
|
98
|
+
}, [a]);
|
|
99
|
+
const P = (t) => {
|
|
100
|
+
t !== o && d(t);
|
|
101
|
+
}, A = () => {
|
|
102
|
+
if (a) return;
|
|
103
|
+
const t = /* @__PURE__ */ new Date();
|
|
104
|
+
v(t), w(t), D(N(t)), P(x(t)), p(!1);
|
|
105
|
+
}, I = (t) => {
|
|
106
|
+
if (a) return;
|
|
107
|
+
if (!t.trim()) {
|
|
108
|
+
v(void 0), w(void 0), D(""), P("");
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const c = L(t);
|
|
112
|
+
M(c) && (v(c), w(c), D(N(c)), P(x(c)));
|
|
113
|
+
};
|
|
114
|
+
return y.useEffect(() => {
|
|
115
|
+
const t = C(o);
|
|
116
|
+
v(t), w(t), D(N(t, { locale: i }) || o);
|
|
117
|
+
}, [o, i]), /* @__PURE__ */ g(q, { className: "w-full", children: [
|
|
118
|
+
!l && /* @__PURE__ */ f(H, { htmlFor: n, children: r }),
|
|
119
|
+
/* @__PURE__ */ g(J, { "aria-invalid": u, children: [
|
|
120
|
+
/* @__PURE__ */ f(
|
|
121
|
+
Q,
|
|
122
|
+
{
|
|
123
|
+
id: n,
|
|
124
|
+
"aria-label": l ? r : void 0,
|
|
125
|
+
"aria-invalid": u,
|
|
126
|
+
value: k,
|
|
127
|
+
placeholder: void 0,
|
|
128
|
+
required: m,
|
|
129
|
+
disabled: a,
|
|
130
|
+
onChange: (t) => {
|
|
131
|
+
const c = t.target.value;
|
|
132
|
+
D(c), I(c);
|
|
133
|
+
},
|
|
134
|
+
onBlur: () => {
|
|
135
|
+
I(k);
|
|
136
|
+
},
|
|
137
|
+
onKeyDown: (t) => {
|
|
138
|
+
t.key === "Enter" && (t.preventDefault(), I(k), p(!1)), t.key === "ArrowDown" && (t.preventDefault(), p(!0));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
/* @__PURE__ */ f(W, { align: "inline-end", children: /* @__PURE__ */ g(Z, { open: O && !a, onOpenChange: p, children: [
|
|
143
|
+
/* @__PURE__ */ f(ee, { asChild: !0, children: /* @__PURE__ */ g(
|
|
144
|
+
X,
|
|
145
|
+
{
|
|
146
|
+
id: `${n}-picker`,
|
|
147
|
+
disabled: a,
|
|
148
|
+
variant: "ghost",
|
|
149
|
+
size: "icon-xs",
|
|
150
|
+
"aria-label": e("datePicker.selectDate"),
|
|
151
|
+
children: [
|
|
152
|
+
/* @__PURE__ */ f(G, {}),
|
|
153
|
+
/* @__PURE__ */ f("span", { className: "sr-only", children: e("datePicker.selectDate") })
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
) }),
|
|
157
|
+
/* @__PURE__ */ g(
|
|
158
|
+
te,
|
|
159
|
+
{
|
|
160
|
+
className: "w-auto overflow-hidden p-0",
|
|
161
|
+
align: "end",
|
|
162
|
+
alignOffset: -8,
|
|
163
|
+
sideOffset: 10,
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ f("div", { className: "flex items-center justify-center px-1 py-2 mb-1 border-b", children: /* @__PURE__ */ g(
|
|
166
|
+
U,
|
|
167
|
+
{
|
|
168
|
+
type: "button",
|
|
169
|
+
variant: "ghost",
|
|
170
|
+
size: "sm",
|
|
171
|
+
onClick: A,
|
|
172
|
+
disabled: a,
|
|
173
|
+
className: "w-fit",
|
|
174
|
+
children: [
|
|
175
|
+
/* @__PURE__ */ f(Y, {}),
|
|
176
|
+
" ",
|
|
177
|
+
e("datePicker.today")
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
) }),
|
|
181
|
+
/* @__PURE__ */ f(
|
|
182
|
+
_,
|
|
183
|
+
{
|
|
184
|
+
mode: "single",
|
|
185
|
+
disabled: a,
|
|
186
|
+
locale: z,
|
|
187
|
+
labels: {
|
|
188
|
+
labelNext: () => e("datePicker.nextMonth"),
|
|
189
|
+
labelPrevious: () => e("datePicker.previousMonth"),
|
|
190
|
+
labelMonthDropdown: () => e("datePicker.chooseMonth"),
|
|
191
|
+
labelYearDropdown: () => e("datePicker.chooseYear"),
|
|
192
|
+
labelNav: () => e("datePicker.navigation"),
|
|
193
|
+
labelDayButton: (t, c) => [
|
|
194
|
+
c.today ? e("datePicker.today") : "",
|
|
195
|
+
new Intl.DateTimeFormat(i, {
|
|
196
|
+
dateStyle: "full"
|
|
197
|
+
}).format(t),
|
|
198
|
+
c.selected ? e("datePicker.selected") : ""
|
|
199
|
+
].filter(Boolean).join(", ")
|
|
200
|
+
},
|
|
201
|
+
selected: V,
|
|
202
|
+
month: $,
|
|
203
|
+
onMonthChange: w,
|
|
204
|
+
onSelect: (t) => {
|
|
205
|
+
a || (v(t), D(N(t)), P(x(t)), p(!1));
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
] }) })
|
|
213
|
+
] })
|
|
214
|
+
] });
|
|
215
|
+
}
|
|
216
|
+
export {
|
|
217
|
+
pe as DatePickerInput
|
|
218
|
+
};
|
|
219
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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}\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}: DatePickerInputProps) {\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\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":["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","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","e","nextInputValue","InputGroupAddon","Popover","PopoverTrigger","InputGroupButton","CalendarIcon","PopoverContent","Button","Target","Calendar","modifiers"],"mappings":";;;;;;;;;;;;AA4BA,SAASA,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,SAASC,EAAmBP,GAAe;AAC1C,SAAOA,EACL,KAAA,EACA,kBAAA,EACA,UAAU,KAAK,EACf,QAAQ,oBAAoB,EAAE;AACjC;AAEA,SAASQ,GAAiBR,GAAe;AACxC,SAAOO,EAAmBP,CAAK,EAAE,MAAM,YAAY,KAAK,CAAA;AACzD;AAEA,SAASS,GAAqBT,GAAe;AAM5C,QAAMU,IALY,IAAI,KAAK,eAAeC,KAAoB;AAAA,IAC7D,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,EAAA,CACN,EAAE,cAAc,IAAI,KAAK,MAAM,GAAG,EAAE,CAAC,EAEpC;AAAA,IACA,CAACC,MACAA,EAAK,SAAS,SAASA,EAAK,SAAS,WAAWA,EAAK,SAAS;AAAA,E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A,kBACV,OAAAF;AAAA,kBACA,eAAeiD;AAAA,kBACf,UAAU,CAAC/C,MAAS;AACnB,oBAAIgC,MACJc,EAAQ9C,CAAI,GACZiD,EAAcC,EAAWlD,CAAI,CAAC,GAC9BmD,EAAY3B,EAAYxB,CAAI,CAAC,GAC7B4C,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;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsxs as i, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import n from "i18next";
|
|
3
|
+
import { Component as s } from "react";
|
|
4
|
+
import { STOA_NS as a } from "../../i18n/namespace.js";
|
|
5
|
+
import { Button as l } from "../../ui/button/index.js";
|
|
6
|
+
class u extends s {
|
|
7
|
+
state = { failed: !1 };
|
|
8
|
+
static getDerivedStateFromError() {
|
|
9
|
+
return { failed: !0 };
|
|
10
|
+
}
|
|
11
|
+
componentDidCatch(e, r) {
|
|
12
|
+
console.error("UI rendering failed", e, r.componentStack), this.props.onError?.(e, r);
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
if (!this.state.failed) return this.props.children;
|
|
16
|
+
const e = () => window.location.reload();
|
|
17
|
+
if (this.props.fallback) return this.props.fallback(e);
|
|
18
|
+
const r = (o) => n.t(o, { ns: a });
|
|
19
|
+
return /* @__PURE__ */ i("section", { role: "alert", className: "grid gap-4 rounded-xl bg-card p-6", children: [
|
|
20
|
+
/* @__PURE__ */ t("h2", { className: "text-xl font-semibold", children: r("app.errorTitle") }),
|
|
21
|
+
/* @__PURE__ */ t("p", { children: r("app.errorDescription") }),
|
|
22
|
+
/* @__PURE__ */ t(l, { onClick: e, children: r("app.restart") })
|
|
23
|
+
] });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
u as ErrorBoundary
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/shell/ErrorBoundary/index.tsx"],"sourcesContent":["import i18next from 'i18next'\nimport { Component, type ErrorInfo, type ReactNode } from 'react'\nimport { STOA_NS } from '../../i18n/namespace'\nimport { Button } from '../../ui/button'\n\nexport interface ErrorBoundaryProps {\n\tchildren: ReactNode\n\t/** Custom fallback; receives a reset callback that reloads the window by default. */\n\tfallback?: (reset: () => void) => ReactNode\n\tonError?: (error: Error, info: ErrorInfo) => void\n}\n\nexport class ErrorBoundary extends Component<\n\tErrorBoundaryProps,\n\t{ failed: boolean }\n> {\n\tstate = { failed: false }\n\n\tstatic getDerivedStateFromError() {\n\t\treturn { failed: true }\n\t}\n\n\tcomponentDidCatch(error: Error, info: ErrorInfo) {\n\t\tconsole.error('UI rendering failed', error, info.componentStack)\n\t\tthis.props.onError?.(error, info)\n\t}\n\n\trender() {\n\t\tif (!this.state.failed) return this.props.children\n\t\tconst reset = () => window.location.reload()\n\t\tif (this.props.fallback) return this.props.fallback(reset)\n\t\tconst t = (key: string) => i18next.t(key, { ns: STOA_NS })\n\t\treturn (\n\t\t\t<section role='alert' className='grid gap-4 rounded-xl bg-card p-6'>\n\t\t\t\t<h2 className='text-xl font-semibold'>{t('app.errorTitle')}</h2>\n\t\t\t\t<p>{t('app.errorDescription')}</p>\n\t\t\t\t<Button onClick={reset}>{t('app.restart')}</Button>\n\t\t\t</section>\n\t\t)\n\t}\n}\n"],"names":["ErrorBoundary","Component","error","info","reset","t","key","i18next","STOA_NS","jsxs","jsx","Button"],"mappings":";;;;;AAYO,MAAMA,UAAsBC,EAGjC;AAAA,EACD,QAAQ,EAAE,QAAQ,GAAA;AAAA,EAElB,OAAO,2BAA2B;AACjC,WAAO,EAAE,QAAQ,GAAA;AAAA,EAClB;AAAA,EAEA,kBAAkBC,GAAcC,GAAiB;AAChD,YAAQ,MAAM,uBAAuBD,GAAOC,EAAK,cAAc,GAC/D,KAAK,MAAM,UAAUD,GAAOC,CAAI;AAAA,EACjC;AAAA,EAEA,SAAS;AACR,QAAI,CAAC,KAAK,MAAM,OAAQ,QAAO,KAAK,MAAM;AAC1C,UAAMC,IAAQ,MAAM,OAAO,SAAS,OAAA;AACpC,QAAI,KAAK,MAAM,iBAAiB,KAAK,MAAM,SAASA,CAAK;AACzD,UAAMC,IAAI,CAACC,MAAgBC,EAAQ,EAAED,GAAK,EAAE,IAAIE,GAAS;AACzD,WACC,gBAAAC,EAAC,WAAA,EAAQ,MAAK,SAAQ,WAAU,qCAC/B,UAAA;AAAA,MAAA,gBAAAC,EAAC,MAAA,EAAG,WAAU,yBAAyB,UAAAL,EAAE,gBAAgB,GAAE;AAAA,MAC3D,gBAAAK,EAAC,KAAA,EAAG,UAAAL,EAAE,sBAAsB,EAAA,CAAE;AAAA,wBAC7BM,GAAA,EAAO,SAASP,GAAQ,UAAAC,EAAE,aAAa,EAAA,CAAE;AAAA,IAAA,GAC3C;AAAA,EAEF;AACD;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { cn as t } from "../../utils/cn.js";
|
|
3
|
+
function l({
|
|
4
|
+
className: o,
|
|
5
|
+
children: r,
|
|
6
|
+
...e
|
|
7
|
+
}) {
|
|
8
|
+
return /* @__PURE__ */ i(
|
|
9
|
+
"select",
|
|
10
|
+
{
|
|
11
|
+
"data-slot": "native-select",
|
|
12
|
+
className: t(
|
|
13
|
+
"h-12 w-full rounded-lg border border-input bg-background/70 px-3 text-sm outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-background/40",
|
|
14
|
+
o
|
|
15
|
+
),
|
|
16
|
+
...e,
|
|
17
|
+
children: r
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
l as NativeSelect
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/shell/NativeSelect/index.tsx"],"sourcesContent":["import { cn } from '../../utils/cn'\n\nexport type NativeSelectProps = React.SelectHTMLAttributes<HTMLSelectElement>\n\nexport function NativeSelect({\n\tclassName,\n\tchildren,\n\t...props\n}: NativeSelectProps) {\n\treturn (\n\t\t<select\n\t\t\tdata-slot='native-select'\n\t\t\tclassName={cn(\n\t\t\t\t'h-12 w-full rounded-lg border border-input bg-background/70 px-3 text-sm outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-background/40',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</select>\n\t)\n}\n"],"names":["NativeSelect","className","children","props","jsx","cn"],"mappings":";;AAIO,SAASA,EAAa;AAAA,EAC5B,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACJ,GAAsB;AACrB,SACC,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,aAAU;AAAA,MACV,WAAWC;AAAA,QACV;AAAA,QACAJ;AAAA,MAAA;AAAA,MAEA,GAAGE;AAAA,MAEH,UAAAD;AAAA,IAAA;AAAA,EAAA;AAGJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageHeading.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|