|
| 1 | +<script> |
| 2 | + import { Info, CircleCheck } from '@lucide/svelte' |
| 3 | + import Callout from '../../../../vendor/filament/support/resources/js/svelte/Callout.svelte' |
| 4 | + let color = $state('gray') |
| 5 | + let icon = $state('none') |
| 6 | + let override = $state(false) |
| 7 | + let details = $state(true) |
| 8 | + let actions = $state(true) |
| 9 | + let visible = $state(true) |
| 10 | + let message = $state('No changes published.') |
| 11 | +</script> |
| 12 | + |
| 13 | +{#snippet artwork()}{#if icon === 'info'}<Info />{:else}<CircleCheck |
| 14 | + />{/if}{/snippet} |
| 15 | +{#snippet description()}Review the <strong>release notes</strong> before publishing.{/snippet} |
| 16 | +{#snippet footer()}<button |
| 17 | + type="button" |
| 18 | + data-testid="review" |
| 19 | + onclick={() => (message = 'Release notes reviewed locally.')} |
| 20 | + >Review notes</button |
| 21 | + ><a href="#svelte-release">View release</a>{/snippet} |
| 22 | +{#snippet controls()}<button |
| 23 | + type="button" |
| 24 | + data-testid="dismiss" |
| 25 | + aria-label="Dismiss release notice" |
| 26 | + onclick={() => { |
| 27 | + visible = false |
| 28 | + message = 'Release notice dismissed locally.' |
| 29 | + }}>×</button |
| 30 | + >{/snippet} |
| 31 | +<section class="callout-demo" data-framework="svelte"> |
| 32 | + <h2 class="fi-section-header-heading">Svelte · JavaScript</h2> |
| 33 | + {#if visible}<Callout |
| 34 | + data-testid="callout" |
| 35 | + {color} |
| 36 | + heading="Your next release" |
| 37 | + description={details ? description : undefined} |
| 38 | + icon={icon === 'none' ? undefined : artwork} |
| 39 | + footer={actions ? footer : undefined} |
| 40 | + controls={actions ? controls : undefined} |
| 41 | + iconColor={override ? 'success' : undefined} |
| 42 | + iconSize={override ? 'sm' : 'lg'} |
| 43 | + />{/if} |
| 44 | + <div class="icon-demo-controls"> |
| 45 | + <label |
| 46 | + >Color <select bind:value={color} data-testid="color" |
| 47 | + >{#each ['gray', 'primary', 'info', 'success', 'warning', 'danger', 'brand'] as value}<option |
| 48 | + >{value}</option |
| 49 | + >{/each}</select |
| 50 | + ></label |
| 51 | + > |
| 52 | + <label |
| 53 | + >Icon <select bind:value={icon} data-testid="icon" |
| 54 | + >{#each ['none', 'info', 'check'] as value}<option |
| 55 | + >{value}</option |
| 56 | + >{/each}</select |
| 57 | + ></label |
| 58 | + > |
| 59 | + <label |
| 60 | + ><input |
| 61 | + bind:checked={override} |
| 62 | + type="checkbox" |
| 63 | + data-testid="override" |
| 64 | + />Small success icon</label |
| 65 | + > |
| 66 | + <label |
| 67 | + ><input |
| 68 | + bind:checked={details} |
| 69 | + type="checkbox" |
| 70 | + data-testid="details" |
| 71 | + />Description</label |
| 72 | + > |
| 73 | + <label |
| 74 | + ><input |
| 75 | + bind:checked={actions} |
| 76 | + type="checkbox" |
| 77 | + data-testid="actions" |
| 78 | + />Actions and controls</label |
| 79 | + > |
| 80 | + <button |
| 81 | + type="button" |
| 82 | + data-testid="reset" |
| 83 | + onclick={() => { |
| 84 | + color = 'gray' |
| 85 | + icon = 'none' |
| 86 | + override = false |
| 87 | + details = true |
| 88 | + actions = true |
| 89 | + visible = true |
| 90 | + message = 'No changes published.' |
| 91 | + }}>Reset</button |
| 92 | + > |
| 93 | + </div> |
| 94 | + <p role="status" data-testid="result">{message}</p> |
| 95 | + <p id="svelte-release" tabindex="-1"> |
| 96 | + September release · Ready for review |
| 97 | + </p> |
| 98 | +</section> |
0 commit comments