mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-22 00:01:34 +00:00
5d79f33590
* Remove $$props.field usage * Rename slots to ensure no hyphen * _props * _trigger * OnSelectedIteration type correct capitalization * rename _content * Remove afterUpdate * Migrate everything to svelte 5 * array bind * Fix popover * type never * nit fixes * Fixed many trivial errors * onClick * Fix errors * use let: * nit typing * fix: wrap state_referenced_locally vars with untrack() Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add untrack import * Fix all syntax errors due to untrack migration * Fix undefined errors * Fix more undefined errors * untrack(() => initialOpen) * svelte-ignore * Fix state_descriptors_fixed error in Chart.svelte Use $state.snapshot() to pass plain copies of data/options to Chart.js instead of $state proxies. Chart.js's listenArrayEvents tries to define property descriptors on data arrays, which Svelte 5 proxies reject. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * nit typing * Merge issue * Fix "path is not set" error in resource picker / editor * Fix InputTransformForm error when rerunning some flows * fix npm run check --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
54 lines
1.3 KiB
Svelte
54 lines
1.3 KiB
Svelte
<script lang="ts">
|
|
|
|
import { createEventDispatcher } from 'svelte'
|
|
import Tooltip from './Tooltip.svelte'
|
|
interface Props {
|
|
label?: string;
|
|
options: [string | { title: string; desc: string }, any][];
|
|
value: any;
|
|
disabled?: boolean;
|
|
labelClass?: string;
|
|
inputClass?: string;
|
|
}
|
|
|
|
let {
|
|
label = '',
|
|
options,
|
|
value = $bindable(),
|
|
disabled = false,
|
|
labelClass = '',
|
|
inputClass = ''
|
|
}: Props = $props();
|
|
|
|
const dispatch = createEventDispatcher()
|
|
</script>
|
|
|
|
<fieldset class="w-full">
|
|
<legend class="sr-only {labelClass}">{label}</legend>
|
|
<div class="flex flex-row flex-wrap gap-2 items-center mb-2 w-full">
|
|
{#each options as [label, val]}
|
|
<label
|
|
class="text-center text-sm border border-gray-300 h-full rounded-sm cursor-pointer p-2
|
|
grow whitespace-nowrap duration-200 hover:border-gray-600 hover:bg-surface-hover
|
|
{val === value ? '!bg-blue-50 !border-blue-500 dark:!bg-frost-900' : ''} {inputClass}"
|
|
>
|
|
<input
|
|
{disabled}
|
|
type="radio"
|
|
value={val}
|
|
class="sr-only"
|
|
bind:group={value}
|
|
aria-labelledby="memory-option-0-label"
|
|
onclick={() => dispatch('change', val)}
|
|
/>
|
|
<p>
|
|
{#if typeof label !== 'string'}
|
|
{label.title}
|
|
<Tooltip>{label.desc}</Tooltip>
|
|
{:else}{label}{/if}
|
|
</p>
|
|
</label>
|
|
{/each}
|
|
</div>
|
|
</fieldset>
|