@isoftdata/svelte-checkbox
Advanced tools
@@ -38,2 +38,4 @@ <script | ||
| interface Props { | ||
| allowUnset?: boolean | ||
| btnGroupClass?: ClassValue | ||
| disabled?: boolean | ||
@@ -50,2 +52,3 @@ hint?: ComponentProps<typeof Label>['hint'] | ||
| title?: string | ||
| unsetValue?: T | ||
| value: T | ||
@@ -60,2 +63,4 @@ color?: ButtonColors | ||
| // | ||
| allowUnset = false, | ||
| btnGroupClass, | ||
| disabled = false, | ||
@@ -72,2 +77,3 @@ hint, | ||
| title, | ||
| unsetValue, | ||
| value = $bindable(), | ||
@@ -91,3 +97,3 @@ color = 'secondary', | ||
| {/if} | ||
| <div class={['btn-group', size && `btn-group-${size}`, bs5 && 'btn-group-toggle']}> | ||
| <div class={['btn-group', size && `btn-group-${size}`, !bs5 && 'btn-group-toggle', btnGroupClass]}> | ||
| {#each options as option} | ||
@@ -117,3 +123,3 @@ {@const colorClass = option.color ?? color} | ||
| onclick={() => { | ||
| value = option.value | ||
| value = value === option.value && allowUnset ? (unsetValue ?? ('' as T)) : option.value | ||
| change?.(option.value) | ||
@@ -120,0 +126,0 @@ }} |
@@ -8,2 +8,4 @@ import { type ComponentProps } from 'svelte'; | ||
| props(): { | ||
| allowUnset?: boolean; | ||
| btnGroupClass?: ClassValue; | ||
| disabled?: boolean; | ||
@@ -26,2 +28,3 @@ hint?: ComponentProps<typeof Label>["hint"]; | ||
| title?: string; | ||
| unsetValue?: T | undefined; | ||
| value: T; | ||
@@ -28,0 +31,0 @@ color?: ButtonColors; |
+1
-1
| { | ||
| "name": "@isoftdata/svelte-checkbox", | ||
| "version": "2.3.0", | ||
| "version": "2.4.0", | ||
| "exports": { | ||
@@ -5,0 +5,0 @@ ".": { |
+1
-0
| # Svelte Checkbox | ||
|  | ||
@@ -3,0 +4,0 @@ Checkbox and radio button components for Svelte 5 |
16040
2.52%81
3.85%63
1.61%