Приложение и дашборд appdashboardsaashealthcaresoapformcomboboxautosave
Med Consultation Note
Протокол приёма SOAP: отметка показателей вне нормы, поиск диагнозов МКБ-10 (combobox), шаблоны, автосохранение и подпись с блокировкой.
Живое превью
Consultation note
Elena Duarte · Wed 10:30 · In person · Blood pressure follow-up
Not saved yet
Signed
Использование
Скопируйте и вставьте этот код на вашу страницу Astro:
astro
---
import { MedConsultationNote } from 'astro-component-kit/app';
---
<MedConsultationNote patient="Elena Duarte" clinician="Dr. Laura Navarro"
diagnoses={[{ code: 'I10', label: 'Essential (primary) hypertension' }]} /> ---
import { MedConsultationNote } from 'astro-component-kit/app';
---
<MedConsultationNote patient="Elena Duarte" clinician="Dr. Laura Navarro"
diagnoses={[{ code: 'I10', label: 'Essential (primary) hypertension' }]} /> Примеры в контексте
Реальный код из набора: как этот элемент используется в шаблонах, секциях и других компонентах.
ClinicConsultationPage.astro astro
<MedConsultationNote
patient={p.name}
visit={`${data.days[appt.day]} ${appt.start} · ${appt.type === 'video' ? 'Video' : `In person, ${doc.room}`} · ${appt.reason}`}
clinician={doc.name}
diagnoses={data.diagnoses}
storageKey={`pulso-note-${appt.id}`}
/> <MedConsultationNote
patient={p.name}
visit={`${data.days[appt.day]} ${appt.start} · ${appt.type === 'video' ? 'Video' : `In person, ${doc.room}`} · ${appt.reason}`}
clinician={doc.name}
diagnoses={data.diagnoses}
storageKey={`pulso-note-${appt.id}`}
/> Используется в
Хорошо сочетается с
Ручная установка
Если вы не используете пакет npm, создайте файл и вставьте следующий код: src/components/lib/MedConsultationNote.astro:
astro
---
/**
* MedConsultationNote — Structured SOAP consultation note: Subjective, Objective (vitals inputs that
* flag out-of-range values), Assessment (ICD-10 diagnosis combobox with chips) and Plan (follow-up,
* patient summary). Templates prefill the note, drafts autosave locally and "Sign & lock" validates,
* timestamps and locks it.
*
* @param {string} patient - Patient name shown in the header. Default 'Elena Duarte'.
* @param {string} visit - Visit line (time, type, reason).
* @param {string} clinician - Name used in the signature. Default 'Dr. Laura Navarro'.
* @param {Array<{code: string, label: string}>} diagnoses - Searchable diagnosis list.
* @param {Array<{name: string, label: string, unit: string, low?: number, high?: number, step?: number, value?: number}>} vitals - Vital sign inputs with normal range.
* @param {Array<{label: string, subjective?: string, exam?: string, plan?: string, diagnoses?: string[]}>} templates - Note templates (diagnoses = codes).
* @param {string} storageKey - localStorage key for the draft (empty disables autosave). Default 'pulso-note-draft'.
* @param {string} id - Base id. Default 'note'.
* @param {string} variant - Style (card|plain). Default 'card'.
* @param {string} className - Extra class.
*
* Accessibility: four fieldsets with legends; every input has a label; vitals flags are text in
* live outputs; the diagnosis field is an ARIA 1.2 combobox (arrow keys, Enter, Escape) and chips
* have labelled remove buttons; validation errors are listed in an alert and focus moves to it;
* autosave status is a polite status message. Emits `app:note-signed` with the note data.
*/
interface Diagnosis { code: string; label: string }
interface Vital { name: string; label: string; unit: string; low?: number; high?: number; step?: number; value?: number }
interface Template { label: string; subjective?: string; exam?: string; plan?: string; diagnoses?: string[] }
interface Props {
patient?: string;
visit?: string;
clinician?: string;
diagnoses?: Diagnosis[];
vitals?: Vital[];
templates?: Template[];
storageKey?: string;
id?: string;
variant?: 'card' | 'plain';
className?: string;
}
const {
patient = 'Elena Duarte',
visit = 'Wed 10:30 · In person · Blood pressure follow-up',
clinician = 'Dr. Laura Navarro',
diagnoses = [
{ code: 'I10', label: 'Essential (primary) hypertension' },
{ code: 'J06.9', label: 'Acute upper respiratory infection' },
{ code: 'J30.2', label: 'Seasonal allergic rhinitis' },
{ code: 'R51', label: 'Headache' },
{ code: 'Z00.00', label: 'General adult medical examination' },
],
vitals = [
{ name: 'sys', label: 'Systolic', unit: 'mmHg', low: 90, high: 135, value: 136 },
{ name: 'dia', label: 'Diastolic', unit: 'mmHg', low: 60, high: 85, value: 86 },
{ name: 'hr', label: 'Heart rate', unit: 'bpm', low: 60, high: 100, value: 72 },
{ name: 'temp', label: 'Temperature', unit: '°C', low: 36.1, high: 37.5, step: 0.1, value: 36.7 },
{ name: 'spo2', label: 'SpO₂', unit: '%', low: 95, high: 100, value: 98 },
{ name: 'weight', label: 'Weight', unit: 'kg', step: 0.1, value: 71 },
],
templates = [
{ label: 'Hypertension follow-up', subjective: 'Follows up on blood pressure. Home readings average 138/87. No headache, chest pain or shortness of breath. Taking enalapril daily, no side effects.', exam: 'Alert and well. Heart sounds regular, no murmurs. No peripheral oedema.', plan: 'Continue enalapril 10 mg. Reduce salt, 30 min walk 5×/week. Repeat home BP log for 2 weeks.', diagnoses: ['I10'] },
{ label: 'Upper respiratory infection', subjective: 'Sore throat and runny nose for 3 days. Low-grade fever yesterday. No shortness of breath.', exam: 'Pharynx mildly erythematous, no exudate. Chest clear.', plan: 'Fluids, rest and paracetamol as needed. Return if fever lasts more than 3 days or breathing gets worse.', diagnoses: ['J06.9'] },
],
storageKey = 'pulso-note-draft',
id = 'note',
variant = 'card',
className = '',
} = Astro.props;
---
<section class:list={['note', `note--${variant}`, className]} aria-labelledby={`${id}-title`} data-note data-key={storageKey} data-clinician={clinician} data-templates={JSON.stringify(templates)} data-diagnoses={JSON.stringify(diagnoses)}>
<header class="note__head">
<div>
<h2 class="note__title" id={`${id}-title`}>Consultation note</h2>
<p class="note__sub"><strong>{patient}</strong> · {visit}</p>
</div>
<div class="note__tools">
{templates.length > 0 && (
<label class="note__template">
<span>Template</span>
<select data-note-template>
<option value="">Blank note</option>
{templates.map((t, i) => <option value={i}>{t.label}</option>)}
</select>
</label>
)}
<p class="note__saved" role="status" data-note-saved>Not saved yet</p>
</div>
</header>
<div class="note__signed" data-note-signed hidden>
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>
<span data-note-signed-text>Signed</span>
</div>
<div class="note__errors" role="alert" tabindex="-1" data-note-errors hidden></div>
<form class="note__form" id={`${id}-form`} novalidate data-note-form>
<fieldset class="note__section">
<legend><span class="note__letter" aria-hidden="true">S</span>Subjective</legend>
<label class="note__label" for={`${id}-subjective`}>Chief complaint & history <span class="note__req">required</span></label>
<textarea class="note__textarea" id={`${id}-subjective`} name="subjective" rows="4" placeholder="What brings the patient in, in their words. Onset, duration, severity…"></textarea>
</fieldset>
<fieldset class="note__section">
<legend><span class="note__letter" aria-hidden="true">O</span>Objective</legend>
<div class="note__vitals">
{vitals.map((v) => (
<div class="note__vital" data-low={v.low} data-high={v.high}>
<label for={`${id}-v-${v.name}`}>{v.label}</label>
<div class="note__vital-input">
<input id={`${id}-v-${v.name}`} name={`v-${v.name}`} type="number" inputmode="decimal" step={v.step ?? 1} value={v.value} aria-describedby={`${id}-v-${v.name}-flag`} />
<span aria-hidden="true">{v.unit}</span>
</div>
<output class="note__flag" id={`${id}-v-${v.name}-flag`} for={`${id}-v-${v.name}`} aria-live="polite" data-flag>
{v.low !== undefined && v.high !== undefined ? `Normal ${v.low}–${v.high}` : ''}
</output>
</div>
))}
</div>
<label class="note__label" for={`${id}-exam`}>Examination</label>
<textarea class="note__textarea" id={`${id}-exam`} name="exam" rows="3" placeholder="Findings on examination"></textarea>
</fieldset>
<fieldset class="note__section">
<legend><span class="note__letter" aria-hidden="true">A</span>Assessment</legend>
<label class="note__label" for={`${id}-dx`} id={`${id}-dx-label`}>Diagnoses (ICD-10) <span class="note__req">at least one</span></label>
<div class="note__combo">
<input
class="note__input"
id={`${id}-dx`}
type="text"
role="combobox"
aria-autocomplete="list"
aria-expanded="false"
aria-controls={`${id}-dx-list`}
autocomplete="off"
placeholder="Search by name or code, e.g. hypertension or I10"
data-dx-input
/>
<ul class="note__options" id={`${id}-dx-list`} role="listbox" aria-labelledby={`${id}-dx-label`} hidden data-dx-list></ul>
</div>
<ul class="note__chips" aria-label="Selected diagnoses" data-dx-chips></ul>
<input type="hidden" name="diagnoses" data-dx-value />
<label class="note__label" for={`${id}-assessment`}>Clinical reasoning</label>
<textarea class="note__textarea" id={`${id}-assessment`} name="assessment" rows="2" placeholder="Differential, severity, risk"></textarea>
</fieldset>
<fieldset class="note__section">
<legend><span class="note__letter" aria-hidden="true">P</span>Plan</legend>
<label class="note__label" for={`${id}-plan`}>Treatment & advice</label>
<textarea class="note__textarea" id={`${id}-plan`} name="plan" rows="3" placeholder="Medication, tests, referrals, advice"></textarea>
<div class="note__row">
<label class="note__inline">
<span>Follow-up</span>
<select name="followup">
<option value="">None</option>
<option>In 1 week</option>
<option selected>In 2 weeks</option>
<option>In 1 month</option>
<option>In 3 months</option>
</select>
</label>
<label class="note__check"><input type="checkbox" name="summary" checked /> Email a plain-language summary to the patient</label>
</div>
</fieldset>
<div class="note__footer">
<button type="button" class="note__btn" data-note-save>Save draft</button>
<button type="submit" class="note__btn note__btn--primary" data-note-sign>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg>
Sign & lock
</button>
</div>
</form>
</section>
<script>
type Dx = { code: string; label: string };
document.querySelectorAll<HTMLElement>('[data-note]:not([data-bound])').forEach((root) => {
root.dataset.bound = '';
const form = root.querySelector<HTMLFormElement>('[data-note-form]')!;
const key = root.dataset.key || '';
const saved = root.querySelector<HTMLElement>('[data-note-saved]')!;
const errors = root.querySelector<HTMLElement>('[data-note-errors]')!;
const all: Dx[] = JSON.parse(root.dataset.diagnoses || '[]');
const templates = JSON.parse(root.dataset.templates || '[]');
const input = root.querySelector<HTMLInputElement>('[data-dx-input]')!;
const list = root.querySelector<HTMLUListElement>('[data-dx-list]')!;
const chips = root.querySelector<HTMLUListElement>('[data-dx-chips]')!;
const hidden = root.querySelector<HTMLInputElement>('[data-dx-value]')!;
let chosen: Dx[] = [];
let options: Dx[] = [];
let active = -1;
/* ---- Vitals flags ---- */
const flagVital = (box: HTMLElement) => {
const field = box.querySelector<HTMLInputElement>('input')!;
const out = box.querySelector<HTMLOutputElement>('[data-flag]')!;
const low = box.dataset.low ? Number(box.dataset.low) : undefined;
const high = box.dataset.high ? Number(box.dataset.high) : undefined;
const v = field.value === '' ? NaN : Number(field.value);
box.classList.remove('is-high', 'is-low');
if (low === undefined || high === undefined) { out.textContent = ''; return; }
if (Number.isNaN(v)) { out.textContent = `Normal ${low}–${high}`; return; }
if (v > high) { box.classList.add('is-high'); out.textContent = `High (normal ≤ ${high})`; }
else if (v < low) { box.classList.add('is-low'); out.textContent = `Low (normal ≥ ${low})`; }
else out.textContent = 'In range';
};
const vitalBoxes = Array.from(root.querySelectorAll<HTMLElement>('.note__vital'));
vitalBoxes.forEach((b) => { flagVital(b); b.querySelector('input')?.addEventListener('input', () => flagVital(b)); });
/* ---- Diagnosis combobox ---- */
const renderChips = () => {
chips.innerHTML = '';
chosen.forEach((d) => {
const li = document.createElement('li');
li.className = 'note__chip';
li.innerHTML = `<span class="note__code"></span><span class="note__chip-label"></span><button type="button" class="note__chip-x"><span aria-hidden="true">×</span></button>`;
li.querySelector('.note__code')!.textContent = d.code;
li.querySelector('.note__chip-label')!.textContent = d.label;
const x = li.querySelector<HTMLButtonElement>('button')!;
x.setAttribute('aria-label', `Remove ${d.code} ${d.label}`);
x.addEventListener('click', () => { chosen = chosen.filter((c) => c.code !== d.code); renderChips(); input.focus(); schedule(); });
chips.append(li);
});
hidden.value = chosen.map((d) => d.code).join(',');
};
const close = () => { list.hidden = true; input.setAttribute('aria-expanded', 'false'); input.removeAttribute('aria-activedescendant'); active = -1; };
const open = () => {
const q = input.value.trim().toLowerCase();
options = all.filter((d) => !chosen.some((c) => c.code === d.code) && (!q || d.label.toLowerCase().includes(q) || d.code.toLowerCase().startsWith(q))).slice(0, 8);
list.innerHTML = '';
options.forEach((d, i) => {
const li = document.createElement('li');
li.id = `${list.id}-${i}`;
li.setAttribute('role', 'option');
li.className = 'note__option';
li.innerHTML = '<span class="note__code"></span><span></span>';
li.firstElementChild!.textContent = d.code;
li.lastElementChild!.textContent = d.label;
li.addEventListener('mousedown', (e) => { e.preventDefault(); pick(i); });
list.append(li);
});
if (!options.length) {
const li = document.createElement('li');
li.className = 'note__option note__option--empty';
li.textContent = 'No matching diagnosis';
list.append(li);
}
list.hidden = false;
input.setAttribute('aria-expanded', 'true');
};
const highlight = (i: number) => {
active = i;
list.querySelectorAll('[role="option"]').forEach((o, n) => o.setAttribute('aria-selected', String(n === i)));
if (i >= 0) { input.setAttribute('aria-activedescendant', `${list.id}-${i}`); list.children[i]?.scrollIntoView({ block: 'nearest' }); }
};
const pick = (i: number) => {
const d = options[i];
if (!d) return;
chosen.push(d);
input.value = '';
renderChips();
close();
schedule();
};
input.addEventListener('input', () => { open(); highlight(options.length ? 0 : -1); });
input.addEventListener('focus', () => open());
input.addEventListener('blur', () => window.setTimeout(close, 100));
input.addEventListener('keydown', (e) => {
if (e.key === 'ArrowDown') { e.preventDefault(); if (list.hidden) open(); highlight(Math.min(options.length - 1, active + 1)); }
else if (e.key === 'ArrowUp') { e.preventDefault(); highlight(Math.max(0, active - 1)); }
else if (e.key === 'Enter') { if (!list.hidden && active >= 0) { e.preventDefault(); pick(active); } }
else if (e.key === 'Escape') { if (!list.hidden) { e.preventDefault(); close(); } }
});
/* ---- Templates ---- */
root.querySelector<HTMLSelectElement>('[data-note-template]')?.addEventListener('change', (e) => {
const t = templates[Number((e.target as HTMLSelectElement).value)];
if (!t) return;
const set = (name: string, v?: string) => { const f = form.elements.namedItem(name) as HTMLTextAreaElement | null; if (f && v) f.value = v; };
set('subjective', t.subjective);
set('exam', t.exam);
set('plan', t.plan);
(t.diagnoses || []).forEach((code: string) => {
const d = all.find((x) => x.code === code);
if (d && !chosen.some((c) => c.code === code)) chosen.push(d);
});
renderChips();
schedule();
});
/* ---- Autosave ---- */
const time = () => new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
const snapshot = () => ({ fields: Object.fromEntries(Array.from(new FormData(form).entries()).map(([k, v]) => [k, String(v)])), diagnoses: chosen });
const save = () => {
if (!key) { saved.textContent = `Draft kept · ${time()}`; return; }
try { localStorage.setItem(key, JSON.stringify(snapshot())); saved.textContent = `Draft saved · ${time()}`; }
catch { saved.textContent = 'Could not save the draft on this device'; }
};
let timer = 0;
const schedule = () => { saved.textContent = 'Saving…'; window.clearTimeout(timer); timer = window.setTimeout(save, 800); };
form.addEventListener('input', (e) => { if (e.target !== input) schedule(); });
root.querySelector('[data-note-save]')?.addEventListener('click', save);
if (key) {
try {
const draft = JSON.parse(localStorage.getItem(key) || 'null');
if (draft) {
Object.entries(draft.fields || {}).forEach(([k, v]) => {
const f = form.elements.namedItem(k) as HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null;
if (!f || k === 'diagnoses') return;
if (f instanceof HTMLInputElement && f.type === 'checkbox') f.checked = v === 'on';
else f.value = String(v);
});
chosen = draft.diagnoses || [];
renderChips();
vitalBoxes.forEach(flagVital);
saved.textContent = 'Draft restored';
}
} catch { /* ignore */ }
}
/* ---- Sign & lock ---- */
form.addEventListener('submit', (e) => {
e.preventDefault();
const problems: Array<[string, string]> = [];
const subj = form.elements.namedItem('subjective') as HTMLTextAreaElement;
if (!subj.value.trim()) problems.push([subj.id, 'Add the chief complaint and history.']);
if (!chosen.length) problems.push([input.id, 'Add at least one diagnosis.']);
subj.setAttribute('aria-invalid', String(!subj.value.trim()));
input.setAttribute('aria-invalid', String(!chosen.length));
if (problems.length) {
errors.hidden = false;
errors.innerHTML = '<p><strong>The note can’t be signed yet:</strong></p><ul></ul>';
const ul = errors.querySelector('ul')!;
problems.forEach(([fid, msg]) => { const li = document.createElement('li'); const a = document.createElement('a'); a.href = `#${fid}`; a.textContent = msg; li.append(a); ul.append(li); });
errors.focus();
return;
}
errors.hidden = true;
const data = snapshot();
form.querySelectorAll<HTMLFieldSetElement>('fieldset').forEach((f) => { f.disabled = true; });
form.querySelectorAll<HTMLButtonElement>('.note__footer button').forEach((b) => { b.disabled = true; });
chips.querySelectorAll<HTMLButtonElement>('button').forEach((b) => { b.disabled = true; });
const banner = root.querySelector<HTMLElement>('[data-note-signed]')!;
banner.hidden = false;
root.querySelector('[data-note-signed-text]')!.textContent = `Signed and locked by ${root.dataset.clinician} at ${time()}. Amendments are added as addenda.`;
saved.textContent = 'Signed';
root.classList.add('is-signed');
try { if (key) localStorage.removeItem(key); } catch { /* ignore */ }
document.dispatchEvent(new CustomEvent('app:note-signed', { detail: data }));
banner.setAttribute('tabindex', '-1');
banner.focus();
});
});
</script>
<style>
.note { --nt-accent: var(--app-accent, var(--c-primary-light, #0e7490)); min-width: 0; }
.note--card { padding: var(--sp-5, 1.25rem); border: 1px solid var(--c-border, rgba(0, 0, 0, 0.1)); border-radius: var(--r-lg, 14px); background: var(--c-bg-1, #fff); }
.note__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--sp-3, 0.75rem); margin-bottom: var(--sp-4, 1rem); }
.note__title { margin: 0; font-size: 1.1rem; font-weight: 700; color: var(--c-text-1, #0b2a33); }
.note__sub { margin: 2px 0 0; font-size: 0.88rem; color: var(--c-text-2, #3d5a63); }
.note__sub strong { color: var(--c-text-1, #0b2a33); }
.note__tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3, 0.75rem); }
.note__template { display: inline-flex; align-items: center; gap: var(--sp-2, 0.5rem); font-size: 0.82rem; font-weight: 600; color: var(--c-text-2, #3d5a63); }
.note__saved { margin: 0; font-size: 0.8rem; color: var(--c-text-3, #5b747c); }
.note select, .note__input, .note__textarea, .note__vital input {
min-height: 44px;
padding: 0 var(--sp-3, 0.75rem);
border: 1px solid var(--c-border, rgba(0, 0, 0, 0.18));
border-radius: var(--r-sm, 8px);
background: var(--c-bg, #f3f8f9);
color: var(--c-text-1, #0b2a33);
font: inherit;
font-size: 0.95rem;
}
.note__textarea { width: 100%; padding: var(--sp-3, 0.75rem); line-height: 1.55; resize: vertical; }
.note__input { width: 100%; }
.note :is(select, input, textarea):focus-visible { outline: 3px solid color-mix(in srgb, var(--nt-accent) 45%, transparent); outline-offset: 1px; border-color: var(--nt-accent); }
.note [aria-invalid='true'] { border-color: var(--c-danger, #b91c1c); }
.note__signed { display: flex; align-items: center; gap: var(--sp-2, 0.5rem); margin-bottom: var(--sp-4, 1rem); padding: var(--sp-3, 0.75rem) var(--sp-4, 1rem); border-radius: var(--r-md, 10px); background: color-mix(in srgb, var(--c-success, #15803d) 12%, transparent); color: var(--c-success, #15803d); font-weight: 700; font-size: 0.9rem; }
.note__signed[hidden], .note__errors[hidden] { display: none; }
.note__errors { margin-bottom: var(--sp-4, 1rem); padding: var(--sp-3, 0.75rem) var(--sp-4, 1rem); border: 1px solid var(--c-danger, #b91c1c); border-radius: var(--r-md, 10px); background: color-mix(in srgb, var(--c-danger, #b91c1c) 7%, transparent); color: var(--c-text-1, #0b2a33); font-size: 0.9rem; }
.note__errors :global(p) { margin: 0 0 4px; }
.note__errors :global(ul) { margin: 0; padding-left: 1.2rem; }
.note__errors :global(a) { color: var(--c-danger, #b91c1c); font-weight: 600; }
.note__errors:focus-visible { outline: 3px solid var(--c-danger, #b91c1c); outline-offset: 2px; }
.note__form { display: grid; gap: var(--sp-4, 1rem); }
.note__section { display: grid; gap: var(--sp-2, 0.5rem); margin: 0; padding: var(--sp-4, 1rem); border: 1px solid var(--c-border, rgba(0, 0, 0, 0.1)); border-radius: var(--r-md, 10px); }
.note__section legend { display: inline-flex; align-items: center; gap: var(--sp-2, 0.5rem); padding: 0 var(--sp-2, 0.5rem); font-weight: 700; color: var(--c-text-1, #0b2a33); }
.note__letter { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--nt-accent); color: var(--c-on-primary, #fff); font-size: 0.85rem; font-weight: 800; }
.note__section:disabled { opacity: 0.85; }
.note__label { margin-top: var(--sp-1, 0.25rem); font-size: 0.85rem; font-weight: 600; color: var(--c-text-1, #0b2a33); }
.note__req { font-weight: 500; font-size: 0.75rem; color: var(--c-text-3, #5b747c); }
.note__vitals { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--sp-3, 0.75rem); }
.note__vital { display: grid; gap: 4px; }
.note__vital label { font-size: 0.8rem; font-weight: 600; color: var(--c-text-2, #3d5a63); }
.note__vital-input { display: flex; align-items: center; gap: 6px; }
.note__vital-input input { width: 100%; min-width: 0; font-variant-numeric: tabular-nums; }
.note__vital-input span { font-size: 0.78rem; color: var(--c-text-3, #5b747c); white-space: nowrap; }
.note__flag { font-size: 0.74rem; color: var(--c-text-3, #5b747c); }
.note__vital.is-high input, .note__vital.is-low input { border-color: var(--c-danger, #b91c1c); }
.note__vital.is-high .note__flag, .note__vital.is-low .note__flag { color: var(--c-danger, #b91c1c); font-weight: 700; }
.note__combo { position: relative; }
.note__options { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; margin: 0; padding: 4px; overflow-y: auto; list-style: none; border: 1px solid var(--c-border, rgba(0, 0, 0, 0.15)); border-radius: var(--r-md, 10px); background: var(--c-bg-1, #fff); box-shadow: 0 12px 30px rgb(0 0 0 / 0.15); }
.note__options[hidden] { display: none; }
.note__options :global(.note__option) { display: flex; gap: var(--sp-3, 0.75rem); padding: var(--sp-2, 0.5rem) var(--sp-3, 0.75rem); border-radius: 6px; font-size: 0.9rem; color: var(--c-text-1, #0b2a33); cursor: pointer; }
.note__options :global(.note__option[aria-selected='true']), .note__options :global(.note__option:hover) { background: color-mix(in srgb, var(--nt-accent) 12%, transparent); }
.note__options :global(.note__option--empty) { color: var(--c-text-3, #5b747c); cursor: default; }
.note :global(.note__code) { flex-shrink: 0; min-width: 52px; font-family: var(--font-mono, monospace); font-size: 0.8rem; font-weight: 700; color: var(--nt-accent); }
.note__chips { display: flex; flex-wrap: wrap; gap: var(--sp-2, 0.5rem); margin: 0; padding: 0; list-style: none; }
.note__chips:empty { display: none; }
.note__chips :global(.note__chip) { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border: 1px solid var(--nt-accent); border-radius: 999px; background: color-mix(in srgb, var(--nt-accent) 8%, transparent); font-size: 0.85rem; color: var(--c-text-1, #0b2a33); }
.note__chips :global(.note__code) { min-width: 0; }
.note__chips :global(.note__chip-x) { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--c-text-2, #3d5a63); font-size: 1.1rem; cursor: pointer; }
.note__chips :global(.note__chip-x:hover) { background: rgb(var(--ink-rgb, 15 23 42) / 0.08); }
.note__chips :global(.note__chip-x:focus-visible) { outline: 3px solid var(--nt-accent); outline-offset: 1px; }
.note__chips :global(.note__chip-x:disabled) { display: none; }
.note__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3, 0.75rem) var(--sp-5, 1.25rem); margin-top: var(--sp-2, 0.5rem); }
.note__inline { display: inline-flex; align-items: center; gap: var(--sp-2, 0.5rem); font-size: 0.85rem; font-weight: 600; color: var(--c-text-1, #0b2a33); }
.note__check { display: inline-flex; align-items: center; gap: var(--sp-2, 0.5rem); min-height: 44px; font-size: 0.88rem; color: var(--c-text-1, #0b2a33); cursor: pointer; }
.note__check input { width: 18px; height: 18px; accent-color: var(--nt-accent); }
.note__footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2, 0.5rem); }
.note__btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 var(--sp-5, 1.25rem); border: 1px solid var(--c-border, rgba(0, 0, 0, 0.18)); border-radius: var(--r-sm, 8px); background: var(--c-bg-1, #fff); color: var(--c-text-1, #0b2a33); font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer; }
.note__btn--primary { border-color: var(--nt-accent); background: var(--nt-accent); color: var(--c-on-primary, #fff); }
.note__btn:hover:not(:disabled) { filter: brightness(1.05); }
.note__btn:disabled { opacity: 0.5; cursor: not-allowed; }
.note__btn:focus-visible { outline: 3px solid var(--nt-accent); outline-offset: 2px; }
@media (max-width: 520px) {
.note__footer { flex-direction: column-reverse; }
.note__btn { justify-content: center; }
}
</style> ---
/**
* MedConsultationNote — Structured SOAP consultation note: Subjective, Objective (vitals inputs that
* flag out-of-range values), Assessment (ICD-10 diagnosis combobox with chips) and Plan (follow-up,
* patient summary). Templates prefill the note, drafts autosave locally and "Sign & lock" validates,
* timestamps and locks it.
*
* @param {string} patient - Patient name shown in the header. Default 'Elena Duarte'.
* @param {string} visit - Visit line (time, type, reason).
* @param {string} clinician - Name used in the signature. Default 'Dr. Laura Navarro'.
* @param {Array<{code: string, label: string}>} diagnoses - Searchable diagnosis list.
* @param {Array<{name: string, label: string, unit: string, low?: number, high?: number, step?: number, value?: number}>} vitals - Vital sign inputs with normal range.
* @param {Array<{label: string, subjective?: string, exam?: string, plan?: string, diagnoses?: string[]}>} templates - Note templates (diagnoses = codes).
* @param {string} storageKey - localStorage key for the draft (empty disables autosave). Default 'pulso-note-draft'.
* @param {string} id - Base id. Default 'note'.
* @param {string} variant - Style (card|plain). Default 'card'.
* @param {string} className - Extra class.
*
* Accessibility: four fieldsets with legends; every input has a label; vitals flags are text in
* live outputs; the diagnosis field is an ARIA 1.2 combobox (arrow keys, Enter, Escape) and chips
* have labelled remove buttons; validation errors are listed in an alert and focus moves to it;
* autosave status is a polite status message. Emits `app:note-signed` with the note data.
*/
interface Diagnosis { code: string; label: string }
interface Vital { name: string; label: string; unit: string; low?: number; high?: number; step?: number; value?: number }
interface Template { label: string; subjective?: string; exam?: string; plan?: string; diagnoses?: string[] }
interface Props {
patient?: string;
visit?: string;
clinician?: string;
diagnoses?: Diagnosis[];
vitals?: Vital[];
templates?: Template[];
storageKey?: string;
id?: string;
variant?: 'card' | 'plain';
className?: string;
}
const {
patient = 'Elena Duarte',
visit = 'Wed 10:30 · In person · Blood pressure follow-up',
clinician = 'Dr. Laura Navarro',
diagnoses = [
{ code: 'I10', label: 'Essential (primary) hypertension' },
{ code: 'J06.9', label: 'Acute upper respiratory infection' },
{ code: 'J30.2', label: 'Seasonal allergic rhinitis' },
{ code: 'R51', label: 'Headache' },
{ code: 'Z00.00', label: 'General adult medical examination' },
],
vitals = [
{ name: 'sys', label: 'Systolic', unit: 'mmHg', low: 90, high: 135, value: 136 },
{ name: 'dia', label: 'Diastolic', unit: 'mmHg', low: 60, high: 85, value: 86 },
{ name: 'hr', label: 'Heart rate', unit: 'bpm', low: 60, high: 100, value: 72 },
{ name: 'temp', label: 'Temperature', unit: '°C', low: 36.1, high: 37.5, step: 0.1, value: 36.7 },
{ name: 'spo2', label: 'SpO₂', unit: '%', low: 95, high: 100, value: 98 },
{ name: 'weight', label: 'Weight', unit: 'kg', step: 0.1, value: 71 },
],
templates = [
{ label: 'Hypertension follow-up', subjective: 'Follows up on blood pressure. Home readings average 138/87. No headache, chest pain or shortness of breath. Taking enalapril daily, no side effects.', exam: 'Alert and well. Heart sounds regular, no murmurs. No peripheral oedema.', plan: 'Continue enalapril 10 mg. Reduce salt, 30 min walk 5×/week. Repeat home BP log for 2 weeks.', diagnoses: ['I10'] },
{ label: 'Upper respiratory infection', subjective: 'Sore throat and runny nose for 3 days. Low-grade fever yesterday. No shortness of breath.', exam: 'Pharynx mildly erythematous, no exudate. Chest clear.', plan: 'Fluids, rest and paracetamol as needed. Return if fever lasts more than 3 days or breathing gets worse.', diagnoses: ['J06.9'] },
],
storageKey = 'pulso-note-draft',
id = 'note',
variant = 'card',
className = '',
} = Astro.props;
---
<section class:list={['note', `note--${variant}`, className]} aria-labelledby={`${id}-title`} data-note data-key={storageKey} data-clinician={clinician} data-templates={JSON.stringify(templates)} data-diagnoses={JSON.stringify(diagnoses)}>
<header class="note__head">
<div>
<h2 class="note__title" id={`${id}-title`}>Consultation note</h2>
<p class="note__sub"><strong>{patient}</strong> · {visit}</p>
</div>
<div class="note__tools">
{templates.length > 0 && (
<label class="note__template">
<span>Template</span>
<select data-note-template>
<option value="">Blank note</option>
{templates.map((t, i) => <option value={i}>{t.label}</option>)}
</select>
</label>
)}
<p class="note__saved" role="status" data-note-saved>Not saved yet</p>
</div>
</header>
<div class="note__signed" data-note-signed hidden>
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>
<span data-note-signed-text>Signed</span>
</div>
<div class="note__errors" role="alert" tabindex="-1" data-note-errors hidden></div>
<form class="note__form" id={`${id}-form`} novalidate data-note-form>
<fieldset class="note__section">
<legend><span class="note__letter" aria-hidden="true">S</span>Subjective</legend>
<label class="note__label" for={`${id}-subjective`}>Chief complaint & history <span class="note__req">required</span></label>
<textarea class="note__textarea" id={`${id}-subjective`} name="subjective" rows="4" placeholder="What brings the patient in, in their words. Onset, duration, severity…"></textarea>
</fieldset>
<fieldset class="note__section">
<legend><span class="note__letter" aria-hidden="true">O</span>Objective</legend>
<div class="note__vitals">
{vitals.map((v) => (
<div class="note__vital" data-low={v.low} data-high={v.high}>
<label for={`${id}-v-${v.name}`}>{v.label}</label>
<div class="note__vital-input">
<input id={`${id}-v-${v.name}`} name={`v-${v.name}`} type="number" inputmode="decimal" step={v.step ?? 1} value={v.value} aria-describedby={`${id}-v-${v.name}-flag`} />
<span aria-hidden="true">{v.unit}</span>
</div>
<output class="note__flag" id={`${id}-v-${v.name}-flag`} for={`${id}-v-${v.name}`} aria-live="polite" data-flag>
{v.low !== undefined && v.high !== undefined ? `Normal ${v.low}–${v.high}` : ''}
</output>
</div>
))}
</div>
<label class="note__label" for={`${id}-exam`}>Examination</label>
<textarea class="note__textarea" id={`${id}-exam`} name="exam" rows="3" placeholder="Findings on examination"></textarea>
</fieldset>
<fieldset class="note__section">
<legend><span class="note__letter" aria-hidden="true">A</span>Assessment</legend>
<label class="note__label" for={`${id}-dx`} id={`${id}-dx-label`}>Diagnoses (ICD-10) <span class="note__req">at least one</span></label>
<div class="note__combo">
<input
class="note__input"
id={`${id}-dx`}
type="text"
role="combobox"
aria-autocomplete="list"
aria-expanded="false"
aria-controls={`${id}-dx-list`}
autocomplete="off"
placeholder="Search by name or code, e.g. hypertension or I10"
data-dx-input
/>
<ul class="note__options" id={`${id}-dx-list`} role="listbox" aria-labelledby={`${id}-dx-label`} hidden data-dx-list></ul>
</div>
<ul class="note__chips" aria-label="Selected diagnoses" data-dx-chips></ul>
<input type="hidden" name="diagnoses" data-dx-value />
<label class="note__label" for={`${id}-assessment`}>Clinical reasoning</label>
<textarea class="note__textarea" id={`${id}-assessment`} name="assessment" rows="2" placeholder="Differential, severity, risk"></textarea>
</fieldset>
<fieldset class="note__section">
<legend><span class="note__letter" aria-hidden="true">P</span>Plan</legend>
<label class="note__label" for={`${id}-plan`}>Treatment & advice</label>
<textarea class="note__textarea" id={`${id}-plan`} name="plan" rows="3" placeholder="Medication, tests, referrals, advice"></textarea>
<div class="note__row">
<label class="note__inline">
<span>Follow-up</span>
<select name="followup">
<option value="">None</option>
<option>In 1 week</option>
<option selected>In 2 weeks</option>
<option>In 1 month</option>
<option>In 3 months</option>
</select>
</label>
<label class="note__check"><input type="checkbox" name="summary" checked /> Email a plain-language summary to the patient</label>
</div>
</fieldset>
<div class="note__footer">
<button type="button" class="note__btn" data-note-save>Save draft</button>
<button type="submit" class="note__btn note__btn--primary" data-note-sign>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg>
Sign & lock
</button>
</div>
</form>
</section>
<script>
type Dx = { code: string; label: string };
document.querySelectorAll<HTMLElement>('[data-note]:not([data-bound])').forEach((root) => {
root.dataset.bound = '';
const form = root.querySelector<HTMLFormElement>('[data-note-form]')!;
const key = root.dataset.key || '';
const saved = root.querySelector<HTMLElement>('[data-note-saved]')!;
const errors = root.querySelector<HTMLElement>('[data-note-errors]')!;
const all: Dx[] = JSON.parse(root.dataset.diagnoses || '[]');
const templates = JSON.parse(root.dataset.templates || '[]');
const input = root.querySelector<HTMLInputElement>('[data-dx-input]')!;
const list = root.querySelector<HTMLUListElement>('[data-dx-list]')!;
const chips = root.querySelector<HTMLUListElement>('[data-dx-chips]')!;
const hidden = root.querySelector<HTMLInputElement>('[data-dx-value]')!;
let chosen: Dx[] = [];
let options: Dx[] = [];
let active = -1;
/* ---- Vitals flags ---- */
const flagVital = (box: HTMLElement) => {
const field = box.querySelector<HTMLInputElement>('input')!;
const out = box.querySelector<HTMLOutputElement>('[data-flag]')!;
const low = box.dataset.low ? Number(box.dataset.low) : undefined;
const high = box.dataset.high ? Number(box.dataset.high) : undefined;
const v = field.value === '' ? NaN : Number(field.value);
box.classList.remove('is-high', 'is-low');
if (low === undefined || high === undefined) { out.textContent = ''; return; }
if (Number.isNaN(v)) { out.textContent = `Normal ${low}–${high}`; return; }
if (v > high) { box.classList.add('is-high'); out.textContent = `High (normal ≤ ${high})`; }
else if (v < low) { box.classList.add('is-low'); out.textContent = `Low (normal ≥ ${low})`; }
else out.textContent = 'In range';
};
const vitalBoxes = Array.from(root.querySelectorAll<HTMLElement>('.note__vital'));
vitalBoxes.forEach((b) => { flagVital(b); b.querySelector('input')?.addEventListener('input', () => flagVital(b)); });
/* ---- Diagnosis combobox ---- */
const renderChips = () => {
chips.innerHTML = '';
chosen.forEach((d) => {
const li = document.createElement('li');
li.className = 'note__chip';
li.innerHTML = `<span class="note__code"></span><span class="note__chip-label"></span><button type="button" class="note__chip-x"><span aria-hidden="true">×</span></button>`;
li.querySelector('.note__code')!.textContent = d.code;
li.querySelector('.note__chip-label')!.textContent = d.label;
const x = li.querySelector<HTMLButtonElement>('button')!;
x.setAttribute('aria-label', `Remove ${d.code} ${d.label}`);
x.addEventListener('click', () => { chosen = chosen.filter((c) => c.code !== d.code); renderChips(); input.focus(); schedule(); });
chips.append(li);
});
hidden.value = chosen.map((d) => d.code).join(',');
};
const close = () => { list.hidden = true; input.setAttribute('aria-expanded', 'false'); input.removeAttribute('aria-activedescendant'); active = -1; };
const open = () => {
const q = input.value.trim().toLowerCase();
options = all.filter((d) => !chosen.some((c) => c.code === d.code) && (!q || d.label.toLowerCase().includes(q) || d.code.toLowerCase().startsWith(q))).slice(0, 8);
list.innerHTML = '';
options.forEach((d, i) => {
const li = document.createElement('li');
li.id = `${list.id}-${i}`;
li.setAttribute('role', 'option');
li.className = 'note__option';
li.innerHTML = '<span class="note__code"></span><span></span>';
li.firstElementChild!.textContent = d.code;
li.lastElementChild!.textContent = d.label;
li.addEventListener('mousedown', (e) => { e.preventDefault(); pick(i); });
list.append(li);
});
if (!options.length) {
const li = document.createElement('li');
li.className = 'note__option note__option--empty';
li.textContent = 'No matching diagnosis';
list.append(li);
}
list.hidden = false;
input.setAttribute('aria-expanded', 'true');
};
const highlight = (i: number) => {
active = i;
list.querySelectorAll('[role="option"]').forEach((o, n) => o.setAttribute('aria-selected', String(n === i)));
if (i >= 0) { input.setAttribute('aria-activedescendant', `${list.id}-${i}`); list.children[i]?.scrollIntoView({ block: 'nearest' }); }
};
const pick = (i: number) => {
const d = options[i];
if (!d) return;
chosen.push(d);
input.value = '';
renderChips();
close();
schedule();
};
input.addEventListener('input', () => { open(); highlight(options.length ? 0 : -1); });
input.addEventListener('focus', () => open());
input.addEventListener('blur', () => window.setTimeout(close, 100));
input.addEventListener('keydown', (e) => {
if (e.key === 'ArrowDown') { e.preventDefault(); if (list.hidden) open(); highlight(Math.min(options.length - 1, active + 1)); }
else if (e.key === 'ArrowUp') { e.preventDefault(); highlight(Math.max(0, active - 1)); }
else if (e.key === 'Enter') { if (!list.hidden && active >= 0) { e.preventDefault(); pick(active); } }
else if (e.key === 'Escape') { if (!list.hidden) { e.preventDefault(); close(); } }
});
/* ---- Templates ---- */
root.querySelector<HTMLSelectElement>('[data-note-template]')?.addEventListener('change', (e) => {
const t = templates[Number((e.target as HTMLSelectElement).value)];
if (!t) return;
const set = (name: string, v?: string) => { const f = form.elements.namedItem(name) as HTMLTextAreaElement | null; if (f && v) f.value = v; };
set('subjective', t.subjective);
set('exam', t.exam);
set('plan', t.plan);
(t.diagnoses || []).forEach((code: string) => {
const d = all.find((x) => x.code === code);
if (d && !chosen.some((c) => c.code === code)) chosen.push(d);
});
renderChips();
schedule();
});
/* ---- Autosave ---- */
const time = () => new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
const snapshot = () => ({ fields: Object.fromEntries(Array.from(new FormData(form).entries()).map(([k, v]) => [k, String(v)])), diagnoses: chosen });
const save = () => {
if (!key) { saved.textContent = `Draft kept · ${time()}`; return; }
try { localStorage.setItem(key, JSON.stringify(snapshot())); saved.textContent = `Draft saved · ${time()}`; }
catch { saved.textContent = 'Could not save the draft on this device'; }
};
let timer = 0;
const schedule = () => { saved.textContent = 'Saving…'; window.clearTimeout(timer); timer = window.setTimeout(save, 800); };
form.addEventListener('input', (e) => { if (e.target !== input) schedule(); });
root.querySelector('[data-note-save]')?.addEventListener('click', save);
if (key) {
try {
const draft = JSON.parse(localStorage.getItem(key) || 'null');
if (draft) {
Object.entries(draft.fields || {}).forEach(([k, v]) => {
const f = form.elements.namedItem(k) as HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null;
if (!f || k === 'diagnoses') return;
if (f instanceof HTMLInputElement && f.type === 'checkbox') f.checked = v === 'on';
else f.value = String(v);
});
chosen = draft.diagnoses || [];
renderChips();
vitalBoxes.forEach(flagVital);
saved.textContent = 'Draft restored';
}
} catch { /* ignore */ }
}
/* ---- Sign & lock ---- */
form.addEventListener('submit', (e) => {
e.preventDefault();
const problems: Array<[string, string]> = [];
const subj = form.elements.namedItem('subjective') as HTMLTextAreaElement;
if (!subj.value.trim()) problems.push([subj.id, 'Add the chief complaint and history.']);
if (!chosen.length) problems.push([input.id, 'Add at least one diagnosis.']);
subj.setAttribute('aria-invalid', String(!subj.value.trim()));
input.setAttribute('aria-invalid', String(!chosen.length));
if (problems.length) {
errors.hidden = false;
errors.innerHTML = '<p><strong>The note can’t be signed yet:</strong></p><ul></ul>';
const ul = errors.querySelector('ul')!;
problems.forEach(([fid, msg]) => { const li = document.createElement('li'); const a = document.createElement('a'); a.href = `#${fid}`; a.textContent = msg; li.append(a); ul.append(li); });
errors.focus();
return;
}
errors.hidden = true;
const data = snapshot();
form.querySelectorAll<HTMLFieldSetElement>('fieldset').forEach((f) => { f.disabled = true; });
form.querySelectorAll<HTMLButtonElement>('.note__footer button').forEach((b) => { b.disabled = true; });
chips.querySelectorAll<HTMLButtonElement>('button').forEach((b) => { b.disabled = true; });
const banner = root.querySelector<HTMLElement>('[data-note-signed]')!;
banner.hidden = false;
root.querySelector('[data-note-signed-text]')!.textContent = `Signed and locked by ${root.dataset.clinician} at ${time()}. Amendments are added as addenda.`;
saved.textContent = 'Signed';
root.classList.add('is-signed');
try { if (key) localStorage.removeItem(key); } catch { /* ignore */ }
document.dispatchEvent(new CustomEvent('app:note-signed', { detail: data }));
banner.setAttribute('tabindex', '-1');
banner.focus();
});
});
</script>
<style>
.note { --nt-accent: var(--app-accent, var(--c-primary-light, #0e7490)); min-width: 0; }
.note--card { padding: var(--sp-5, 1.25rem); border: 1px solid var(--c-border, rgba(0, 0, 0, 0.1)); border-radius: var(--r-lg, 14px); background: var(--c-bg-1, #fff); }
.note__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--sp-3, 0.75rem); margin-bottom: var(--sp-4, 1rem); }
.note__title { margin: 0; font-size: 1.1rem; font-weight: 700; color: var(--c-text-1, #0b2a33); }
.note__sub { margin: 2px 0 0; font-size: 0.88rem; color: var(--c-text-2, #3d5a63); }
.note__sub strong { color: var(--c-text-1, #0b2a33); }
.note__tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3, 0.75rem); }
.note__template { display: inline-flex; align-items: center; gap: var(--sp-2, 0.5rem); font-size: 0.82rem; font-weight: 600; color: var(--c-text-2, #3d5a63); }
.note__saved { margin: 0; font-size: 0.8rem; color: var(--c-text-3, #5b747c); }
.note select, .note__input, .note__textarea, .note__vital input {
min-height: 44px;
padding: 0 var(--sp-3, 0.75rem);
border: 1px solid var(--c-border, rgba(0, 0, 0, 0.18));
border-radius: var(--r-sm, 8px);
background: var(--c-bg, #f3f8f9);
color: var(--c-text-1, #0b2a33);
font: inherit;
font-size: 0.95rem;
}
.note__textarea { width: 100%; padding: var(--sp-3, 0.75rem); line-height: 1.55; resize: vertical; }
.note__input { width: 100%; }
.note :is(select, input, textarea):focus-visible { outline: 3px solid color-mix(in srgb, var(--nt-accent) 45%, transparent); outline-offset: 1px; border-color: var(--nt-accent); }
.note [aria-invalid='true'] { border-color: var(--c-danger, #b91c1c); }
.note__signed { display: flex; align-items: center; gap: var(--sp-2, 0.5rem); margin-bottom: var(--sp-4, 1rem); padding: var(--sp-3, 0.75rem) var(--sp-4, 1rem); border-radius: var(--r-md, 10px); background: color-mix(in srgb, var(--c-success, #15803d) 12%, transparent); color: var(--c-success, #15803d); font-weight: 700; font-size: 0.9rem; }
.note__signed[hidden], .note__errors[hidden] { display: none; }
.note__errors { margin-bottom: var(--sp-4, 1rem); padding: var(--sp-3, 0.75rem) var(--sp-4, 1rem); border: 1px solid var(--c-danger, #b91c1c); border-radius: var(--r-md, 10px); background: color-mix(in srgb, var(--c-danger, #b91c1c) 7%, transparent); color: var(--c-text-1, #0b2a33); font-size: 0.9rem; }
.note__errors :global(p) { margin: 0 0 4px; }
.note__errors :global(ul) { margin: 0; padding-left: 1.2rem; }
.note__errors :global(a) { color: var(--c-danger, #b91c1c); font-weight: 600; }
.note__errors:focus-visible { outline: 3px solid var(--c-danger, #b91c1c); outline-offset: 2px; }
.note__form { display: grid; gap: var(--sp-4, 1rem); }
.note__section { display: grid; gap: var(--sp-2, 0.5rem); margin: 0; padding: var(--sp-4, 1rem); border: 1px solid var(--c-border, rgba(0, 0, 0, 0.1)); border-radius: var(--r-md, 10px); }
.note__section legend { display: inline-flex; align-items: center; gap: var(--sp-2, 0.5rem); padding: 0 var(--sp-2, 0.5rem); font-weight: 700; color: var(--c-text-1, #0b2a33); }
.note__letter { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--nt-accent); color: var(--c-on-primary, #fff); font-size: 0.85rem; font-weight: 800; }
.note__section:disabled { opacity: 0.85; }
.note__label { margin-top: var(--sp-1, 0.25rem); font-size: 0.85rem; font-weight: 600; color: var(--c-text-1, #0b2a33); }
.note__req { font-weight: 500; font-size: 0.75rem; color: var(--c-text-3, #5b747c); }
.note__vitals { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--sp-3, 0.75rem); }
.note__vital { display: grid; gap: 4px; }
.note__vital label { font-size: 0.8rem; font-weight: 600; color: var(--c-text-2, #3d5a63); }
.note__vital-input { display: flex; align-items: center; gap: 6px; }
.note__vital-input input { width: 100%; min-width: 0; font-variant-numeric: tabular-nums; }
.note__vital-input span { font-size: 0.78rem; color: var(--c-text-3, #5b747c); white-space: nowrap; }
.note__flag { font-size: 0.74rem; color: var(--c-text-3, #5b747c); }
.note__vital.is-high input, .note__vital.is-low input { border-color: var(--c-danger, #b91c1c); }
.note__vital.is-high .note__flag, .note__vital.is-low .note__flag { color: var(--c-danger, #b91c1c); font-weight: 700; }
.note__combo { position: relative; }
.note__options { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; margin: 0; padding: 4px; overflow-y: auto; list-style: none; border: 1px solid var(--c-border, rgba(0, 0, 0, 0.15)); border-radius: var(--r-md, 10px); background: var(--c-bg-1, #fff); box-shadow: 0 12px 30px rgb(0 0 0 / 0.15); }
.note__options[hidden] { display: none; }
.note__options :global(.note__option) { display: flex; gap: var(--sp-3, 0.75rem); padding: var(--sp-2, 0.5rem) var(--sp-3, 0.75rem); border-radius: 6px; font-size: 0.9rem; color: var(--c-text-1, #0b2a33); cursor: pointer; }
.note__options :global(.note__option[aria-selected='true']), .note__options :global(.note__option:hover) { background: color-mix(in srgb, var(--nt-accent) 12%, transparent); }
.note__options :global(.note__option--empty) { color: var(--c-text-3, #5b747c); cursor: default; }
.note :global(.note__code) { flex-shrink: 0; min-width: 52px; font-family: var(--font-mono, monospace); font-size: 0.8rem; font-weight: 700; color: var(--nt-accent); }
.note__chips { display: flex; flex-wrap: wrap; gap: var(--sp-2, 0.5rem); margin: 0; padding: 0; list-style: none; }
.note__chips:empty { display: none; }
.note__chips :global(.note__chip) { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border: 1px solid var(--nt-accent); border-radius: 999px; background: color-mix(in srgb, var(--nt-accent) 8%, transparent); font-size: 0.85rem; color: var(--c-text-1, #0b2a33); }
.note__chips :global(.note__code) { min-width: 0; }
.note__chips :global(.note__chip-x) { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--c-text-2, #3d5a63); font-size: 1.1rem; cursor: pointer; }
.note__chips :global(.note__chip-x:hover) { background: rgb(var(--ink-rgb, 15 23 42) / 0.08); }
.note__chips :global(.note__chip-x:focus-visible) { outline: 3px solid var(--nt-accent); outline-offset: 1px; }
.note__chips :global(.note__chip-x:disabled) { display: none; }
.note__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3, 0.75rem) var(--sp-5, 1.25rem); margin-top: var(--sp-2, 0.5rem); }
.note__inline { display: inline-flex; align-items: center; gap: var(--sp-2, 0.5rem); font-size: 0.85rem; font-weight: 600; color: var(--c-text-1, #0b2a33); }
.note__check { display: inline-flex; align-items: center; gap: var(--sp-2, 0.5rem); min-height: 44px; font-size: 0.88rem; color: var(--c-text-1, #0b2a33); cursor: pointer; }
.note__check input { width: 18px; height: 18px; accent-color: var(--nt-accent); }
.note__footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2, 0.5rem); }
.note__btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 var(--sp-5, 1.25rem); border: 1px solid var(--c-border, rgba(0, 0, 0, 0.18)); border-radius: var(--r-sm, 8px); background: var(--c-bg-1, #fff); color: var(--c-text-1, #0b2a33); font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer; }
.note__btn--primary { border-color: var(--nt-accent); background: var(--nt-accent); color: var(--c-on-primary, #fff); }
.note__btn:hover:not(:disabled) { filter: brightness(1.05); }
.note__btn:disabled { opacity: 0.5; cursor: not-allowed; }
.note__btn:focus-visible { outline: 3px solid var(--nt-accent); outline-offset: 2px; }
@media (max-width: 520px) {
.note__footer { flex-direction: column-reverse; }
.note__btn { justify-content: center; }
}
</style>
Краткая информация
- Категория
- Приложение и дашборд
- Имя файла
MedConsultationNote.astro- Зависимости
- Нет — чистый Astro + CSS
- Теги
- appdashboardsaashealthcaresoapformcomboboxautosave