notices.svelte (2213B)
1 <script lang="ts"> 2 import { onMount } from 'svelte'; 3 import Notice from '../../../src/lib/components/Notice.svelte'; 4 import OperationStatus from '../../../src/lib/components/OperationStatus.svelte'; 5 import ErrorSummary from '../../../src/lib/components/ErrorSummary.svelte'; 6 import FormField from '../../../src/lib/components/primitives/FormField.svelte'; 7 let input = $state('preserved food'); 8 let mounted = $state(false); 9 onMount(() => { 10 mounted = true; 11 }); 12 let failed = $state(false); 13 let text = $state( 14 'Waiting for your extension. Another approval may be needed.' 15 ); 16 </script> 17 18 <div class="page page--reading stack"> 19 <h1>HC_TEST_ONLY_NOTICES</h1> 20 <form 21 class="stack" 22 onsubmit={(event) => { 23 event.preventDefault(); 24 failed = true; 25 }} 26 > 27 <ErrorSummary 28 errors={failed 29 ? [ 30 { href: '#food', text: 'Enter a supported food description.' }, 31 { 32 href: 'https://example.com', 33 text: 'Unsafe target remains plain text.' 34 } 35 ] 36 : []} 37 /> 38 <FormField 39 id="food" 40 label="Food" 41 error={failed ? 'Enter a supported food description.' : undefined} 42 > 43 {#snippet control({ id, describedby, invalid })}<textarea 44 {id} 45 class="input textarea" 46 bind:value={input} 47 disabled={!mounted} 48 aria-describedby={describedby} 49 aria-invalid={invalid}></textarea>{/snippet} 50 </FormField> 51 <button type="submit" class="button button--primary">Review</button> 52 </form> 53 <Notice {text} /> 54 <button 55 type="button" 56 class="button button--secondary" 57 onclick={() => { 58 text = 'One source did not respond. These results may be incomplete.'; 59 }}>Update information</button 60 > 61 <OperationStatus 62 fact="unknown" 63 receipts={[ 64 { 65 role: 'recipient', 66 outcome: 'unknown', 67 readback: 'confirmed', 68 eventId: 'event-A', 69 destination: 'recipient-target' 70 }, 71 { 72 role: 'archive', 73 outcome: 'accepted', 74 readback: 'unknown', 75 eventId: 'event-B', 76 destination: 'archive-target' 77 } 78 ]} 79 /> 80 </div>