@stoa-dev/kit 0.1.4 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -0
- package/README.md +23 -2
- package/dist/display/BarChart/index.js +70 -0
- package/dist/display/BarChart/index.js.map +1 -0
- package/dist/display/Marginalia/index.js +16 -0
- package/dist/display/Marginalia/index.js.map +1 -0
- package/dist/display/MarginaliaFramed/index.js +19 -0
- package/dist/display/MarginaliaFramed/index.js.map +1 -0
- package/dist/display/MarginaliaPair/index.js +32 -0
- package/dist/display/MarginaliaPair/index.js.map +1 -0
- package/dist/display/ProgressBar/index.js +72 -0
- package/dist/display/ProgressBar/index.js.map +1 -0
- package/dist/display/TimeMeasured/index.js +38 -0
- package/dist/display/TimeMeasured/index.js.map +1 -0
- package/dist/display/index.js +16 -0
- package/dist/display/index.js.map +1 -0
- package/dist/i18n/locales/at.json.js +8 -4
- package/dist/i18n/locales/at.json.js.map +1 -1
- package/dist/i18n/locales/de.json.js +8 -4
- package/dist/i18n/locales/de.json.js.map +1 -1
- package/dist/i18n/locales/en.json.js +8 -4
- package/dist/i18n/locales/en.json.js.map +1 -1
- package/dist/i18n/locales/it.json.js +10 -6
- package/dist/i18n/locales/it.json.js.map +1 -1
- package/dist/shell/AnimatedSwap/index.js +61 -0
- package/dist/shell/AnimatedSwap/index.js.map +1 -0
- package/dist/shell/AppNavigation/index.js +62 -43
- package/dist/shell/AppNavigation/index.js.map +1 -1
- package/dist/shell/BrandLines/index.js +14 -12
- package/dist/shell/BrandLines/index.js.map +1 -1
- package/dist/shell/DatePicker/index.js +16 -15
- package/dist/shell/DatePicker/index.js.map +1 -1
- package/dist/shell/ExternalLink/index.js +30 -0
- package/dist/shell/ExternalLink/index.js.map +1 -0
- package/dist/shell/PageHeading/index.js +15 -8
- package/dist/shell/PageHeading/index.js.map +1 -1
- package/dist/shell/SaveStatus/index.js +61 -0
- package/dist/shell/SaveStatus/index.js.map +1 -0
- package/dist/shell/SectionNavigation/index.js +29 -27
- package/dist/shell/SectionNavigation/index.js.map +1 -1
- package/dist/shell/StartupAnimation/index.js +88 -0
- package/dist/shell/StartupAnimation/index.js.map +1 -0
- package/dist/shell/StartupProvider/index.js +37 -0
- package/dist/shell/StartupProvider/index.js.map +1 -0
- package/dist/shell/TagInput/index.js +93 -0
- package/dist/shell/TagInput/index.js.map +1 -0
- package/dist/shell/ValidatedInput/index.js +31 -0
- package/dist/shell/ValidatedInput/index.js.map +1 -0
- package/dist/shell/index.js +41 -24
- package/dist/shell/index.js.map +1 -1
- package/dist/types/display/BarChart/index.d.ts +25 -0
- package/dist/types/display/BarChart/index.d.ts.map +1 -0
- package/dist/types/display/Marginalia/index.d.ts +8 -0
- package/dist/types/display/Marginalia/index.d.ts.map +1 -0
- package/dist/types/display/MarginaliaFramed/index.d.ts +8 -0
- package/dist/types/display/MarginaliaFramed/index.d.ts.map +1 -0
- package/dist/types/display/MarginaliaPair/index.d.ts +9 -0
- package/dist/types/display/MarginaliaPair/index.d.ts.map +1 -0
- package/dist/types/display/ProgressBar/index.d.ts +19 -0
- package/dist/types/display/ProgressBar/index.d.ts.map +1 -0
- package/dist/types/display/TimeMeasured/index.d.ts +16 -0
- package/dist/types/display/TimeMeasured/index.d.ts.map +1 -0
- package/dist/types/display/index.d.ts +7 -0
- package/dist/types/display/index.d.ts.map +1 -0
- package/dist/types/i18n/index.d.ts +44 -0
- package/dist/types/i18n/index.d.ts.map +1 -1
- package/dist/types/shell/AnimatedSwap/index.d.ts +13 -0
- package/dist/types/shell/AnimatedSwap/index.d.ts.map +1 -0
- package/dist/types/shell/AppNavigation/index.d.ts.map +1 -1
- package/dist/types/shell/BrandLines/index.d.ts.map +1 -1
- package/dist/types/shell/DatePicker/index.d.ts.map +1 -1
- package/dist/types/shell/ErrorBoundary/index.d.ts +1 -1
- package/dist/types/shell/ExternalLink/index.d.ts +10 -0
- package/dist/types/shell/ExternalLink/index.d.ts.map +1 -0
- package/dist/types/shell/PageHeading/index.d.ts.map +1 -1
- package/dist/types/shell/SaveStatus/index.d.ts +15 -0
- package/dist/types/shell/SaveStatus/index.d.ts.map +1 -0
- package/dist/types/shell/SectionNavigation/index.d.ts.map +1 -1
- package/dist/types/shell/StartupAnimation/index.d.ts +26 -0
- package/dist/types/shell/StartupAnimation/index.d.ts.map +1 -0
- package/dist/types/shell/StartupProvider/index.d.ts +22 -0
- package/dist/types/shell/StartupProvider/index.d.ts.map +1 -0
- package/dist/types/shell/TagInput/index.d.ts +20 -0
- package/dist/types/shell/TagInput/index.d.ts.map +1 -0
- package/dist/types/shell/ValidatedInput/index.d.ts +17 -0
- package/dist/types/shell/ValidatedInput/index.d.ts.map +1 -0
- package/dist/types/shell/index.d.ts +7 -0
- package/dist/types/shell/index.d.ts.map +1 -1
- package/dist/types/ui/field/index.d.ts +1 -1
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/saveFeedback.d.ts +35 -0
- package/dist/types/utils/saveFeedback.d.ts.map +1 -0
- package/dist/utils/index.js +5 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/saveFeedback.js +54 -0
- package/dist/utils/saveFeedback.js.map +1 -0
- package/package.json +8 -2
- package/styles/instrument.css +705 -0
- package/styles/theme.css +1 -0
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
const e = { cancel: "Annulla", close: "Chiudi" }, i = { back: "Torna alla home", errorDescription: "Ricarica l’interfaccia e riprova.", errorTitle: "Qualcosa è andato storto.", loadingApp: "Preparazione dell’app …", navigation: "Navigazione principale", restart: "Ricarica", switchTheme: "Cambia aspetto" }, a = { selectDate: "Seleziona data", today: "Oggi", nextMonth: "Mese successivo", previousMonth: "Mese precedente", chooseMonth: "Scegli mese", chooseYear: "Scegli anno", navigation: "Navigazione del calendario", selected: "selezionato" },
|
|
1
|
+
const e = { cancel: "Annulla", close: "Chiudi", retry: "Riprova" }, i = { back: "Torna alla home", errorDescription: "Ricarica l’interfaccia e riprova.", errorTitle: "Qualcosa è andato storto.", loadingApp: "Preparazione dell’app …", navigation: "Navigazione principale", restart: "Ricarica", switchTheme: "Cambia aspetto", loadingSettings: "Caricamento impostazioni …" }, a = { selectDate: "Seleziona data", today: "Oggi", nextMonth: "Mese successivo", previousMonth: "Mese precedente", chooseMonth: "Scegli mese", chooseYear: "Scegli anno", navigation: "Navigazione del calendario", selected: "selezionato" }, o = { checking: "Verifica in corso …", checkAgain: "Verifica nuovamente", gate: { loading: "Verifica della licenza e dello stato del dispositivo …", failed: "Verifica della licenza non riuscita.", activationRequired: "L’attivazione precedente non è più valida. Attiva nuovamente questa installazione. I dati verranno conservate.", readOnly: "Consulta ed esporta i dati esistenti" }, activation: { title: "Attiva App", renew: "Rinnova attivazione", description: "Inserisci il codice di attivazione per collegare questa installazione alla tua licenza.", replacementDescription: "Inserisci un nuovo codice di attivazione per la licenza attuale o per un’altra licenza valida. I dati verranno conservate. L’attivazione precedente viene sostituita solo dopo l’attivazione riuscita.", replacementNotice: "L’attivazione esistente viene sostituita solo dopo una verifica riuscita.", code: "Codice di attivazione", deviceName: "Nome del dispositivo", devicePlaceholder: "Il mio dispositivo", defaultDeviceName: "Il mio dispositivo", pending: "Attivazione in corso …", submit: "Attiva licenza" }, banner: { readOnlyTitle: "Modalità di sola lettura", refreshFailed: "Aggiornamento della licenza non disponibile", retryStorage: "Riprova il salvataggio", readOnlyDescription: "Puoi ancora consultare ed esportare i dati esistenti. La creazione e la modifica sono bloccate.", persistencePending: "Non è stato ancora possibile salvare completamente lo stato di blocco della licenza. Il dispositivo resta bloccato. Riprova il salvataggio." }, errors: { activationRequired: "L’attivazione precedente non è più valida sul server delle licenze. Inserisci un nuovo codice di attivazione.", network: "Il server delle licenze non è attualmente raggiungibile. La validità locale resta invariata.", deviceRevoked: "L’attivazione di questo dispositivo è stata revocata.", licenseRevoked: "Questa licenza è stata revocata.", storage: "Non è stato possibile leggere o salvare in modo sicuro lo stato locale della licenza.", certificate: "Il certificato della licenza non è valido.", alreadyActivated: "Questa installazione è già attivata.", api: "Il server ha rifiutato l’attivazione o l’aggiornamento. Verifica il codice e lo stato della licenza.", protocol: "Non è stato possibile elaborare la risposta del server delle licenze.", unactivated: "Questa installazione non è ancora attivata.", stateChanged: "Lo stato della licenza è cambiato. Verificalo nuovamente.", synchronization: "La sincronizzazione della licenza non è attualmente disponibile. Riprova.", readOnly: "Questa azione richiede un’attivazione valida. I dati esistenti restano consultabili ed esportabili.", featureDenied: "Questa funzionalità non è abilitata nella tua licenza.", unknown: "Verifica della licenza non riuscita. Riprova." } }, t = { title: "Licenza", checking: "Verifica della licenza …", unknown: "Non disponibile", plan: "Piano", licenseTerm: "Durata della licenza acquistata", termUnknown: "Non comunicata dal server", certificateExpires: "Certificato attuale valido fino al", nextSync: "Prossima sincronizzazione", syncDue: "Dovuta dal {{date}}", noSyncScheduled: "Nessuna sincronizzazione automatica attualmente prevista", features: "Funzionalità indicate nel certificato", noFeatures: "Nessuna funzionalità disponibile nel certificato attuale.", validityHint: "La validità del certificato limita l’uso offline. La sua scadenza non coincide necessariamente con la fine della licenza acquistata. La durata effettiva della licenza non viene attualmente comunicata separatamente.", synchronize: "Sincronizza licenza", syncing: "Sincronizzazione …", synchronized: "Stato della licenza aggiornato.", persistencePending: "Non è stato ancora possibile salvare completamente lo stato di blocco della licenza. Sincronizza nuovamente.", deviceDetails: "Dettagli avanzati del dispositivo", deviceId: "ID del dispositivo attuale", noDevice: "Nessuna attivazione del dispositivo presente.", deviceReleaseHint: "La disattivazione di un dispositivo non è ancora disponibile nell’app. Eliminare i dati locali della licenza non libera un posto dispositivo sul server.", status: { active: { label: "Attiva", description: "Il certificato firmato della licenza è valido. Puoi usare normalmente l’app." }, offline_grace: { label: "Valida offline", description: "Il certificato esistente consente ancora l’uso locale. È dovuta una sincronizzazione; il certificato viene rinnovato solo dopo una verifica riuscita del server." }, expired: { label: "Certificato scaduto", description: "Il certificato locale è scaduto. Sincronizza per ottenerne uno nuovo. Questo da solo non indica se anche la licenza acquistata sia scaduta. I dati esistenti restano consultabili ed esportabili." }, revoked: { label: "Attivazione del dispositivo revocata", description: "L’attivazione di questo dispositivo è stata revocata. Le modifiche sono bloccate; i dati esistenti restano consultabili ed esportabili." }, license_revoked: { label: "Licenza revocata", description: "Il server ha confermato la revoca della licenza. Le modifiche sono bloccate; i dati esistenti restano consultabili ed esportabili." }, unactivated: { label: "Non attivata", description: "Questa installazione non è ancora associata a una licenza. Per usarla serve un codice di attivazione." }, activation_required: { label: "Attivazione necessaria", description: "L’associazione precedente sul server manca o non corrisponde più a questa installazione. Rinnova l’attivazione. I dati esistenti vengono conservati." }, invalid: { label: "Non verificabile", description: "Al momento il certificato locale non può essere verificato in modo affidabile. Le modifiche restano bloccate. Sincronizza per verificare nuovamente lo stato della licenza." } }, plans: { trial: "Versione di prova", personal: "Personal", professional: "Professional", lifetime: "Lifetime" }, featureLabels: { all_features: "Tutte le funzionalità", core: "Funzioni di base" } }, n = { saving: "Salvataggio …", saved: "Modifiche salvate", error: "Salvataggio non riuscito." }, l = { placeholder: "Scrivi una parola chiave e premi Invio", remove: "Rimuovi “{{tag}}”" }, s = {
|
|
2
2
|
actions: e,
|
|
3
3
|
app: i,
|
|
4
4
|
datePicker: a,
|
|
5
|
-
licensing:
|
|
6
|
-
licenseProfile:
|
|
5
|
+
licensing: o,
|
|
6
|
+
licenseProfile: t,
|
|
7
|
+
autosave: n,
|
|
8
|
+
tags: l
|
|
7
9
|
};
|
|
8
10
|
export {
|
|
9
11
|
e as actions,
|
|
10
12
|
i as app,
|
|
13
|
+
n as autosave,
|
|
11
14
|
a as datePicker,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
s as default,
|
|
16
|
+
t as licenseProfile,
|
|
17
|
+
o as licensing,
|
|
18
|
+
l as tags
|
|
15
19
|
};
|
|
16
20
|
//# sourceMappingURL=it.json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"it.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"it.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useReducedMotion as f, motion as c, AnimatePresence as m, useIsPresent as u } from "motion/react";
|
|
3
|
+
import { useState as p, useRef as h, useLayoutEffect as d } from "react";
|
|
4
|
+
import { cn as v } from "../../utils/cn.js";
|
|
5
|
+
function y({
|
|
6
|
+
children: r,
|
|
7
|
+
onHeight: n,
|
|
8
|
+
reducedMotion: e
|
|
9
|
+
}) {
|
|
10
|
+
const a = h(null), t = u();
|
|
11
|
+
return d(() => {
|
|
12
|
+
const i = a.current;
|
|
13
|
+
if (!i || !t) return;
|
|
14
|
+
const o = () => n(i.offsetHeight);
|
|
15
|
+
o();
|
|
16
|
+
const l = new ResizeObserver(o);
|
|
17
|
+
return l.observe(i), () => l.disconnect();
|
|
18
|
+
}, [n, t]), /* @__PURE__ */ s(
|
|
19
|
+
c.div,
|
|
20
|
+
{
|
|
21
|
+
ref: a,
|
|
22
|
+
className: "flow-root p-1",
|
|
23
|
+
inert: !t,
|
|
24
|
+
"aria-hidden": !t,
|
|
25
|
+
initial: { opacity: e ? 1 : 0, y: e ? 0 : 6 },
|
|
26
|
+
animate: { opacity: 1, y: 0 },
|
|
27
|
+
exit: {
|
|
28
|
+
opacity: e ? 1 : 0,
|
|
29
|
+
y: e ? 0 : -4,
|
|
30
|
+
transition: { duration: e ? 0 : 0.1 }
|
|
31
|
+
},
|
|
32
|
+
transition: { duration: e ? 0 : 0.18, ease: "easeOut" },
|
|
33
|
+
children: r
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
function P({
|
|
38
|
+
swapKey: r,
|
|
39
|
+
children: n,
|
|
40
|
+
className: e
|
|
41
|
+
}) {
|
|
42
|
+
const [a, t] = p(null), i = f() ?? !1;
|
|
43
|
+
return /* @__PURE__ */ s(
|
|
44
|
+
c.div,
|
|
45
|
+
{
|
|
46
|
+
"data-slot": "animated-swap",
|
|
47
|
+
className: v("relative shrink-0 overflow-hidden", e),
|
|
48
|
+
initial: !1,
|
|
49
|
+
animate: { height: a ?? "auto" },
|
|
50
|
+
transition: {
|
|
51
|
+
duration: i ? 0 : 0.24,
|
|
52
|
+
ease: [0.22, 1, 0.36, 1]
|
|
53
|
+
},
|
|
54
|
+
children: /* @__PURE__ */ s(m, { initial: !1, mode: "wait", children: /* @__PURE__ */ s(y, { onHeight: t, reducedMotion: i, children: n }, r) })
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
P as AnimatedSwap
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/shell/AnimatedSwap/index.tsx"],"sourcesContent":["import {\n\tAnimatePresence,\n\tmotion,\n\tuseIsPresent,\n\tuseReducedMotion,\n} from 'motion/react'\nimport {\n\ttype Key,\n\ttype ReactNode,\n\tuseLayoutEffect,\n\tuseRef,\n\tuseState,\n} from 'react'\nimport { cn } from '../../utils/cn'\n\nfunction Panel({\n\tchildren,\n\tonHeight,\n\treducedMotion,\n}: {\n\tchildren: ReactNode\n\tonHeight: (height: number) => void\n\treducedMotion: boolean\n}) {\n\tconst ref = useRef<HTMLDivElement>(null)\n\tconst present = useIsPresent()\n\tuseLayoutEffect(() => {\n\t\tconst panel = ref.current\n\t\tif (!panel || !present) return\n\t\tconst measure = () => onHeight(panel.offsetHeight)\n\t\tmeasure()\n\t\tconst observer = new ResizeObserver(measure)\n\t\tobserver.observe(panel)\n\t\treturn () => observer.disconnect()\n\t}, [onHeight, present])\n\n\treturn (\n\t\t<motion.div\n\t\t\tref={ref}\n\t\t\tclassName='flow-root p-1'\n\t\t\tinert={!present}\n\t\t\taria-hidden={!present}\n\t\t\tinitial={{ opacity: reducedMotion ? 1 : 0, y: reducedMotion ? 0 : 6 }}\n\t\t\tanimate={{ opacity: 1, y: 0 }}\n\t\t\texit={{\n\t\t\t\topacity: reducedMotion ? 1 : 0,\n\t\t\t\ty: reducedMotion ? 0 : -4,\n\t\t\t\ttransition: { duration: reducedMotion ? 0 : 0.1 },\n\t\t\t}}\n\t\t\ttransition={{ duration: reducedMotion ? 0 : 0.18, ease: 'easeOut' }}\n\t\t>\n\t\t\t{children}\n\t\t</motion.div>\n\t)\n}\n\nexport interface AnimatedSwapProps {\n\t/** Changing the key cross-fades to the new children. */\n\tswapKey: Key\n\tchildren: ReactNode\n\tclassName?: string\n}\n\n/**\n * Cross-fades between contents and animates its height in between, e.g. a\n * toolbar that changes with the selection.\n */\nexport function AnimatedSwap({\n\tswapKey,\n\tchildren,\n\tclassName,\n}: AnimatedSwapProps) {\n\tconst [height, setHeight] = useState<number | null>(null)\n\tconst reducedMotion = useReducedMotion() ?? false\n\treturn (\n\t\t<motion.div\n\t\t\tdata-slot='animated-swap'\n\t\t\tclassName={cn('relative shrink-0 overflow-hidden', className)}\n\t\t\tinitial={false}\n\t\t\tanimate={{ height: height ?? 'auto' }}\n\t\t\ttransition={{\n\t\t\t\tduration: reducedMotion ? 0 : 0.24,\n\t\t\t\tease: [0.22, 1, 0.36, 1],\n\t\t\t}}\n\t\t>\n\t\t\t<AnimatePresence initial={false} mode='wait'>\n\t\t\t\t<Panel key={swapKey} onHeight={setHeight} reducedMotion={reducedMotion}>\n\t\t\t\t\t{children}\n\t\t\t\t</Panel>\n\t\t\t</AnimatePresence>\n\t\t</motion.div>\n\t)\n}\n"],"names":["Panel","children","onHeight","reducedMotion","ref","useRef","present","useIsPresent","useLayoutEffect","panel","measure","observer","jsx","motion","AnimatedSwap","swapKey","className","height","setHeight","useState","useReducedMotion","cn","AnimatePresence"],"mappings":";;;;AAeA,SAASA,EAAM;AAAA,EACd,UAAAC;AAAA,EACA,UAAAC;AAAA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AA,QACX,UAAUd,IAAgB,IAAI;AAAA,QAC9B,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;AAAA,MAAA;AAAA,MAGxB,UAAA,gBAAAS,EAACU,GAAA,EAAgB,SAAS,IAAO,MAAK,QACrC,UAAA,gBAAAV,EAACZ,GAAA,EAAoB,UAAUkB,GAAW,eAAAf,GACxC,UAAAF,EAAA,GADUc,CAEZ,EAAA,CACD;AAAA,IAAA;AAAA,EAAA;AAGH;"}
|
|
@@ -2,7 +2,7 @@ import { jsxs as c, jsx as t, Fragment as N } from "react/jsx-runtime";
|
|
|
2
2
|
import { Eclipse as T } from "lucide-react";
|
|
3
3
|
import { useTheme as k } from "next-themes";
|
|
4
4
|
import { Fragment as p } from "react";
|
|
5
|
-
import { useTranslation as
|
|
5
|
+
import { useTranslation as u } from "react-i18next";
|
|
6
6
|
import { useLocation as A, Link as z } from "react-router";
|
|
7
7
|
import { STOA_NS as h } from "../../i18n/namespace.js";
|
|
8
8
|
import { Button as f } from "../../ui/button/index.js";
|
|
@@ -17,36 +17,37 @@ function b(i) {
|
|
|
17
17
|
}
|
|
18
18
|
function g({
|
|
19
19
|
label: i,
|
|
20
|
-
children:
|
|
20
|
+
children: n
|
|
21
21
|
}) {
|
|
22
22
|
return /* @__PURE__ */ c(C, { children: [
|
|
23
|
-
/* @__PURE__ */ t(j, { asChild: !0, children:
|
|
23
|
+
/* @__PURE__ */ t(j, { asChild: !0, children: n }),
|
|
24
24
|
/* @__PURE__ */ t(x, { side: "right", children: i })
|
|
25
25
|
] });
|
|
26
26
|
}
|
|
27
27
|
function F({
|
|
28
28
|
path: i,
|
|
29
|
-
label:
|
|
30
|
-
Icon:
|
|
31
|
-
isActive:
|
|
32
|
-
disabled:
|
|
29
|
+
label: n,
|
|
30
|
+
Icon: o,
|
|
31
|
+
isActive: r,
|
|
32
|
+
disabled: a
|
|
33
33
|
}) {
|
|
34
|
-
const { pathname:
|
|
35
|
-
return /* @__PURE__ */ t(g, { label:
|
|
34
|
+
const { pathname: e } = A(), m = r ? r(e) : e === i;
|
|
35
|
+
return /* @__PURE__ */ t(g, { label: n, children: /* @__PURE__ */ t(
|
|
36
36
|
f,
|
|
37
37
|
{
|
|
38
38
|
variant: "ghost",
|
|
39
39
|
size: "icon",
|
|
40
|
+
"data-nav-item": "",
|
|
40
41
|
className: l(s.menuButton, "rounded-xl"),
|
|
41
|
-
disabled:
|
|
42
|
-
asChild: !
|
|
43
|
-
children:
|
|
42
|
+
disabled: a,
|
|
43
|
+
asChild: !a,
|
|
44
|
+
children: a ? /* @__PURE__ */ t(o, { className: "size-4", strokeWidth: 1.75 }) : /* @__PURE__ */ t(
|
|
44
45
|
z,
|
|
45
46
|
{
|
|
46
47
|
to: i,
|
|
47
|
-
"aria-label":
|
|
48
|
+
"aria-label": n,
|
|
48
49
|
"aria-current": m ? "page" : void 0,
|
|
49
|
-
children: /* @__PURE__ */ t(
|
|
50
|
+
children: /* @__PURE__ */ t(o, { className: "size-4", strokeWidth: 1.75 })
|
|
50
51
|
}
|
|
51
52
|
)
|
|
52
53
|
}
|
|
@@ -54,36 +55,37 @@ function F({
|
|
|
54
55
|
}
|
|
55
56
|
function v({
|
|
56
57
|
label: i,
|
|
57
|
-
Icon:
|
|
58
|
-
onClick:
|
|
59
|
-
disabled:
|
|
58
|
+
Icon: n,
|
|
59
|
+
onClick: o,
|
|
60
|
+
disabled: r
|
|
60
61
|
}) {
|
|
61
62
|
return /* @__PURE__ */ t(g, { label: i, children: /* @__PURE__ */ t(
|
|
62
63
|
f,
|
|
63
64
|
{
|
|
64
65
|
variant: "ghost",
|
|
65
66
|
size: "icon",
|
|
67
|
+
"data-nav-item": "",
|
|
66
68
|
className: l(s.menuButton, "rounded-xl"),
|
|
67
69
|
"aria-label": i,
|
|
68
|
-
disabled:
|
|
69
|
-
onClick:
|
|
70
|
-
children: /* @__PURE__ */ t(
|
|
70
|
+
disabled: r,
|
|
71
|
+
onClick: o,
|
|
72
|
+
children: /* @__PURE__ */ t(n, { className: "size-4", strokeWidth: 1.75 })
|
|
71
73
|
}
|
|
72
74
|
) });
|
|
73
75
|
}
|
|
74
76
|
function J({
|
|
75
77
|
onToggle: i,
|
|
76
|
-
theme:
|
|
77
|
-
disabled:
|
|
78
|
-
label:
|
|
78
|
+
theme: n = "system",
|
|
79
|
+
disabled: o,
|
|
80
|
+
label: r
|
|
79
81
|
}) {
|
|
80
|
-
const { t:
|
|
82
|
+
const { t: a } = u(h), { resolvedTheme: e } = k(), m = n === "system" ? e : n;
|
|
81
83
|
return /* @__PURE__ */ t(
|
|
82
84
|
v,
|
|
83
85
|
{
|
|
84
|
-
label:
|
|
86
|
+
label: r ?? a("app.switchTheme"),
|
|
85
87
|
Icon: T,
|
|
86
|
-
disabled:
|
|
88
|
+
disabled: o,
|
|
87
89
|
onClick: () => {
|
|
88
90
|
i(m === "dark" ? "light" : "dark");
|
|
89
91
|
}
|
|
@@ -91,36 +93,53 @@ function J({
|
|
|
91
93
|
);
|
|
92
94
|
}
|
|
93
95
|
function I() {
|
|
94
|
-
return /* @__PURE__ */ t(
|
|
96
|
+
return /* @__PURE__ */ t(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
"data-slot": "app-navigation-divider",
|
|
100
|
+
className: s.divider,
|
|
101
|
+
"aria-hidden": "true"
|
|
102
|
+
}
|
|
103
|
+
);
|
|
95
104
|
}
|
|
96
|
-
function
|
|
97
|
-
return i.map((
|
|
105
|
+
function d(i, n) {
|
|
106
|
+
return i.map((o, r) => (
|
|
98
107
|
// biome-ignore lint/suspicious/noArrayIndexKey: groups are static configuration
|
|
99
108
|
/* @__PURE__ */ c(p, { children: [
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
] }, `${
|
|
109
|
+
r > 0 && /* @__PURE__ */ t(I, {}),
|
|
110
|
+
o.map((a, e) => B(a) ? /* @__PURE__ */ t(F, { ...a }, a.path) : b(a) ? /* @__PURE__ */ t(v, { ...a }, a.id ?? a.label) : /* @__PURE__ */ t(p, { children: a }, e))
|
|
111
|
+
] }, `${n}-${r}`)
|
|
103
112
|
));
|
|
104
113
|
}
|
|
105
114
|
function K({
|
|
106
115
|
groups: i,
|
|
107
|
-
logo:
|
|
108
|
-
footerGroups:
|
|
109
|
-
label:
|
|
110
|
-
className:
|
|
116
|
+
logo: n,
|
|
117
|
+
footerGroups: o,
|
|
118
|
+
label: r,
|
|
119
|
+
className: a
|
|
111
120
|
}) {
|
|
112
|
-
const { t:
|
|
121
|
+
const { t: e } = u(h);
|
|
113
122
|
return /* @__PURE__ */ c(
|
|
114
123
|
"nav",
|
|
115
124
|
{
|
|
116
|
-
"
|
|
117
|
-
|
|
125
|
+
"data-slot": "app-navigation",
|
|
126
|
+
"aria-label": r ?? e("app.navigation"),
|
|
127
|
+
className: l(s.root, a),
|
|
118
128
|
children: [
|
|
119
|
-
typeof
|
|
120
|
-
|
|
121
|
-
|
|
129
|
+
typeof n == "string" ? /* @__PURE__ */ t(
|
|
130
|
+
"img",
|
|
131
|
+
{
|
|
132
|
+
src: n,
|
|
133
|
+
"data-slot": "app-navigation-logo",
|
|
134
|
+
className: s.logo,
|
|
135
|
+
alt: "",
|
|
136
|
+
"aria-hidden": "true"
|
|
137
|
+
}
|
|
138
|
+
) : n,
|
|
139
|
+
d(i, "main"),
|
|
140
|
+
o && o.length > 0 && /* @__PURE__ */ c(N, { children: [
|
|
122
141
|
/* @__PURE__ */ t("div", { className: s.spacer }),
|
|
123
|
-
|
|
142
|
+
d(o, "footer")
|
|
124
143
|
] })
|
|
125
144
|
]
|
|
126
145
|
}
|
|
@@ -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,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,E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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 { Eclipse, type LucideIcon } from 'lucide-react'\nimport { useTheme } from 'next-themes'\nimport { Fragment, type ReactNode } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { Link, useLocation } from 'react-router'\nimport { STOA_NS } from '../../i18n/namespace'\nimport { Button } from '../../ui/button'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../../ui/tooltip'\nimport { cn } from '../../utils/cn'\nimport styles from './AppNavigation.module.scss'\n\ntype ItemBase = {\n\t/** Translated label, used for tooltip and aria-label. */\n\tlabel: string\n\tIcon: LucideIcon\n\tdisabled?: boolean\n}\n\nexport type AppNavigationLink = ItemBase & {\n\tpath: string\n\t/** Custom active matcher, e.g. to keep \"Library\" active on `/books/:id`. */\n\tisActive?: (pathname: string) => boolean\n}\n\nexport type AppNavigationAction = ItemBase & {\n\tonClick: () => void\n\t/** Stable React key; defaults to the label. */\n\tid?: string\n}\n\nexport type AppNavigationEntry =\n\t| AppNavigationLink\n\t| AppNavigationAction\n\t| ReactNode\n\n/** Groups are rendered top to bottom and separated by dividers. */\nexport type AppNavigationGroup = readonly AppNavigationEntry[]\n\nexport interface AppNavigationProps {\n\tgroups: readonly AppNavigationGroup[]\n\t/** Image URL or custom node rendered above the first group. */\n\tlogo?: string | ReactNode\n\t/** Groups pinned to the bottom of the bar. */\n\tfooterGroups?: readonly AppNavigationGroup[]\n\tlabel?: string\n\tclassName?: string\n}\n\nfunction isLink(entry: AppNavigationEntry): entry is AppNavigationLink {\n\treturn (\n\t\ttypeof entry === 'object' &&\n\t\tentry !== null &&\n\t\t'path' in entry &&\n\t\t'Icon' in entry\n\t)\n}\n\nfunction isAction(entry: AppNavigationEntry): entry is AppNavigationAction {\n\treturn (\n\t\ttypeof entry === 'object' &&\n\t\tentry !== null &&\n\t\t'onClick' in entry &&\n\t\t'Icon' in entry\n\t)\n}\n\nfunction ItemTooltip({\n\tlabel,\n\tchildren,\n}: {\n\tlabel: string\n\tchildren: ReactNode\n}) {\n\treturn (\n\t\t<Tooltip>\n\t\t\t<TooltipTrigger asChild>{children}</TooltipTrigger>\n\t\t\t<TooltipContent side='right'>{label}</TooltipContent>\n\t\t</Tooltip>\n\t)\n}\n\nexport function AppNavigationItem({\n\tpath,\n\tlabel,\n\tIcon,\n\tisActive,\n\tdisabled,\n}: AppNavigationLink) {\n\tconst { pathname } = useLocation()\n\tconst active = isActive ? isActive(pathname) : pathname === path\n\n\treturn (\n\t\t<ItemTooltip label={label}>\n\t\t\t<Button\n\t\t\t\tvariant='ghost'\n\t\t\t\tsize='icon'\n\t\t\t\tdata-nav-item=''\n\t\t\t\tclassName={cn(styles.menuButton, 'rounded-xl')}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tasChild={!disabled}\n\t\t\t>\n\t\t\t\t{disabled ? (\n\t\t\t\t\t<Icon className='size-4' strokeWidth={1.75} />\n\t\t\t\t) : (\n\t\t\t\t\t<Link\n\t\t\t\t\t\tto={path}\n\t\t\t\t\t\taria-label={label}\n\t\t\t\t\t\taria-current={active ? 'page' : undefined}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon className='size-4' strokeWidth={1.75} />\n\t\t\t\t\t</Link>\n\t\t\t\t)}\n\t\t\t</Button>\n\t\t</ItemTooltip>\n\t)\n}\n\nexport function AppNavigationButton({\n\tlabel,\n\tIcon,\n\tonClick,\n\tdisabled,\n}: AppNavigationAction) {\n\treturn (\n\t\t<ItemTooltip label={label}>\n\t\t\t<Button\n\t\t\t\tvariant='ghost'\n\t\t\t\tsize='icon'\n\t\t\t\tdata-nav-item=''\n\t\t\t\tclassName={cn(styles.menuButton, 'rounded-xl')}\n\t\t\t\taria-label={label}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tonClick={onClick}\n\t\t\t>\n\t\t\t\t<Icon className='size-4' strokeWidth={1.75} />\n\t\t\t</Button>\n\t\t</ItemTooltip>\n\t)\n}\n\nexport interface AppNavigationThemeToggleProps {\n\t/** Persist the new theme (settings file, autosave, …). `next-themes` is updated by the app. */\n\tonToggle: (theme: 'light' | 'dark') => void | Promise<void>\n\t/** Current stored preference; `system` resolves via `next-themes`. */\n\ttheme?: 'light' | 'dark' | 'system'\n\tdisabled?: boolean\n\tlabel?: string\n}\n\nexport function AppNavigationThemeToggle({\n\tonToggle,\n\ttheme = 'system',\n\tdisabled,\n\tlabel,\n}: AppNavigationThemeToggleProps) {\n\tconst { t } = useTranslation(STOA_NS)\n\tconst { resolvedTheme } = useTheme()\n\tconst current = theme === 'system' ? resolvedTheme : theme\n\n\treturn (\n\t\t<AppNavigationButton\n\t\t\tlabel={label ?? t('app.switchTheme')}\n\t\t\tIcon={Eclipse}\n\t\t\tdisabled={disabled}\n\t\t\tonClick={() => void onToggle(current === 'dark' ? 'light' : 'dark')}\n\t\t/>\n\t)\n}\n\nexport function AppNavigationDivider() {\n\treturn (\n\t\t<div\n\t\t\tdata-slot='app-navigation-divider'\n\t\t\tclassName={styles.divider}\n\t\t\taria-hidden='true'\n\t\t/>\n\t)\n}\n\nfunction renderGroups(\n\tgroups: readonly AppNavigationGroup[],\n\tkeyPrefix: string,\n) {\n\treturn groups.map((group, groupIndex) => (\n\t\t// biome-ignore lint/suspicious/noArrayIndexKey: groups are static configuration\n\t\t<Fragment key={`${keyPrefix}-${groupIndex}`}>\n\t\t\t{groupIndex > 0 && <AppNavigationDivider />}\n\t\t\t{group.map((entry, index) => {\n\t\t\t\tif (isLink(entry))\n\t\t\t\t\treturn <AppNavigationItem key={entry.path} {...entry} />\n\t\t\t\tif (isAction(entry))\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<AppNavigationButton key={entry.id ?? entry.label} {...entry} />\n\t\t\t\t\t)\n\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: custom nodes have no identity\n\t\t\t\treturn <Fragment key={index}>{entry}</Fragment>\n\t\t\t})}\n\t\t</Fragment>\n\t))\n}\n\nexport function AppNavigation({\n\tgroups,\n\tlogo,\n\tfooterGroups,\n\tlabel,\n\tclassName,\n}: AppNavigationProps) {\n\tconst { t } = useTranslation(STOA_NS)\n\n\treturn (\n\t\t<nav\n\t\t\tdata-slot='app-navigation'\n\t\t\taria-label={label ?? t('app.navigation')}\n\t\t\tclassName={cn(styles.root, className)}\n\t\t>\n\t\t\t{typeof logo === 'string' ? (\n\t\t\t\t<img\n\t\t\t\t\tsrc={logo}\n\t\t\t\t\tdata-slot='app-navigation-logo'\n\t\t\t\t\tclassName={styles.logo}\n\t\t\t\t\talt=''\n\t\t\t\t\taria-hidden='true'\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\tlogo\n\t\t\t)}\n\t\t\t{renderGroups(groups, 'main')}\n\t\t\t{footerGroups && footerGroups.length > 0 && (\n\t\t\t\t<>\n\t\t\t\t\t<div className={styles.spacer} />\n\t\t\t\t\t{renderGroups(footerGroups, 'footer')}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</nav>\n\t)\n}\n"],"names":["isLink","entry","isAction","ItemTooltip","label","children","Tooltip","jsx","TooltipTrigger","TooltipContent","AppNavigationItem","path","Icon","isActive","disabled","pathname","useLocation","active","Button","cn","styles","Link","AppNavigationButton","onClick","AppNavigationThemeToggle","onToggle","theme","t","useTranslation","STOA_NS","resolvedTheme","useTheme","current","Eclipse","AppNavigationDivider","renderGroups","groups","keyPrefix","group","groupIndex","jsxs","Fragment","index","AppNavigation","logo","footerGroups","className"],"mappings":";;;;;;;;;;;AAgDA,SAASA,EAAOC,GAAuD;AACtE,SACC,OAAOA,KAAU,YACjBA,MAAU,QACV,UAAUA,KACV,UAAUA;AAEZ;AAEA,SAASC,EAASD,GAAyD;AAC1E,SACC,OAAOA,KAAU,YACjBA,MAAU,QAC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GrB,KAA7BA,EAAM,MAAMA,EAAM,KAAkB,IAGzD,gBAAAM,EAACkC,GAAA,EAAsB,UAAAxC,EAAA,GAARyC,CAAc,CACpC;AAAA,IAAA,EAAA,GAXa,GAAGL,CAAS,IAAIE,CAAU,EAYzC;AAAA,GACA;AACF;AAEO,SAASI,EAAc;AAAA,EAC7B,QAAAP;AAAA,EACA,MAAAQ;AAAA,EACA,cAAAC;AAAA,EACA,OAAAzC;AAAA,EACA,WAAA0C;AACD,GAAuB;AACtB,QAAM,EAAE,GAAAnB,EAAA,IAAMC,EAAeC,CAAO;AAEpC,SACC,gBAAAW;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,aAAU;AAAA,MACV,cAAYpC,KAASuB,EAAE,gBAAgB;AAAA,MACvC,WAAWR,EAAGC,EAAO,MAAM0B,CAAS;AAAA,MAEnC,UAAA;AAAA,QAAA,OAAOF,KAAS,WAChB,gBAAArC;AAAA,UAAC;AAAA,UAAA;AAAA,YACA,KAAKqC;AAAA,YACL,aAAU;AAAA,YACV,WAAWxB,EAAO;AAAA,YAClB,KAAI;AAAA,YACJ,eAAY;AAAA,UAAA;AAAA,QAAA,IAGbwB;AAAA,QAEAT,EAAaC,GAAQ,MAAM;AAAA,QAC3BS,KAAgBA,EAAa,SAAS,KACtC,gBAAAL,EAAAC,GAAA,EACC,UAAA;AAAA,UAAA,gBAAAlC,EAAC,OAAA,EAAI,WAAWa,EAAO,OAAA,CAAQ;AAAA,UAC9Be,EAAaU,GAAc,QAAQ;AAAA,QAAA,EAAA,CACrC;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIJ;"}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { cn as
|
|
3
|
-
import
|
|
4
|
-
function m({ loading: n = !1, className:
|
|
5
|
-
return /* @__PURE__ */
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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__ */
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */
|
|
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,
|
|
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
|
|
7
|
-
import { Button as
|
|
8
|
-
import { Calendar as
|
|
9
|
-
import { Field as
|
|
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(
|
|
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(
|
|
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
|
|
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)),
|
|
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(""),
|
|
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)),
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
208
|
+
selected: M,
|
|
208
209
|
month: $,
|
|
209
210
|
onMonthChange: N,
|
|
210
211
|
onSelect: (e) => {
|
|
211
|
-
a || (v(e), g(P(e)),
|
|
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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AAA,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","Pop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