@stoa-dev/kit 0.1.3 → 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 +134 -127
- 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 +5 -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/ui/input-group/index.d.ts.map +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/ui/input-group/index.js +25 -24
- package/dist/ui/input-group/index.js.map +1 -1
- 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,EACA,eAAAC;AACD,GAIG;AACF,QAAMC,IAAMC,EAAuB,IAAI,GACjCC,IAAUC,EAAA;AAChB,SAAAC,EAAgB,MAAM;AACrB,UAAMC,IAAQL,EAAI;AAClB,QAAI,CAACK,KAAS,CAACH,EAAS;AACxB,UAAMI,IAAU,MAAMR,EAASO,EAAM,YAAY;AACjD,IAAAC,EAAA;AACA,UAAMC,IAAW,IAAI,eAAeD,CAAO;AAC3C,WAAAC,EAAS,QAAQF,CAAK,GACf,MAAME,EAAS,WAAA;AAAA,EACvB,GAAG,CAACT,GAAUI,CAAO,CAAC,GAGrB,gBAAAM;AAAA,IAACC,EAAO;AAAA,IAAP;AAAA,MACA,KAAAT;AAAA,MACA,WAAU;AAAA,MACV,OAAO,CAACE;AAAA,MACR,eAAa,CAACA;AAAA,MACd,SAAS,EAAE,SAASH,IAAgB,IAAI,GAAG,GAAGA,IAAgB,IAAI,EAAA;AAAA,MAClE,SAAS,EAAE,SAAS,GAAG,GAAG,EAAA;AAAA,MAC1B,MAAM;AAAA,QACL,SAASA,IAAgB,IAAI;AAAA,QAC7B,GAAGA,IAAgB,IAAI;AAAA,QACvB,YAAY,EAAE,UAAUA,IAAgB,IAAI,IAAA;AAAA,MAAI;AAAA,MAEjD,YAAY,EAAE,UAAUA,IAAgB,IAAI,MAAM,MAAM,UAAA;AAAA,MAEvD,UAAAF;AAAA,IAAA;AAAA,EAAA;AAGJ;AAaO,SAASa,EAAa;AAAA,EAC5B,SAAAC;AAAA,EACA,UAAAd;AAAA,EACA,WAAAe;AACD,GAAsB;AACrB,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAwB,IAAI,GAClDhB,IAAgBiB,OAAsB;AAC5C,SACC,gBAAAR;AAAA,IAACC,EAAO;AAAA,IAAP;AAAA,MACA,aAAU;AAAA,MACV,WAAWQ,EAAG,qCAAqCL,CAAS;AAAA,MAC5D,SAAS;AAAA,MACT,SAAS,EAAE,QAAQC,KAAU,OAAA;AAAA,MAC7B,YAAY;AAAA,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,E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ElEwB;AAAA,QAEAT,EAAaC,GAAQ,MAAM;AAAA,QAC3BS,KAAgBA,EAAa,SAAS,KACtC,gBAAAL,EAAAC,GAAA,EACC,UAAA;AAAA,UAAA,gBAAAlC,EAAC,OAAA,EAAI,WAAWa,EAAO,OAAA,CAAQ;AAAA,UAC9Be,EAAaU,GAAc,QAAQ;AAAA,QAAA,EAAA,CACrC;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIJ;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/shell/AppNavigation/index.tsx"],"sourcesContent":["import { 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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= !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;"}
|