Skip to content

Commit 615c5b6

Browse files
committed
[flowbite] Augment InputAttributes type
1 parent e2c9d61 commit 615c5b6

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

.changeset/thin-lizards-mix.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@sjsf/flowbite-theme": minor
3+
---
4+
5+
Augment `InputAttributes` type

packages/flowbite-theme/src/lib/widgets/index.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
import type { HTMLInputAttributes } from 'svelte/elements';
2-
32
import type { Widget, WidgetCommonProps, Widgets, WidgetType } from '@sjsf/form';
3+
import type { CheckboxProps } from 'flowbite-svelte/Checkbox.svelte';
4+
import type { FileuploadProps } from 'flowbite-svelte/Fileupload.svelte';
5+
import type { RangeProps } from 'flowbite-svelte/Range.svelte';
6+
import type { InputProps } from 'flowbite-svelte/Input.svelte';
7+
import type { RadioProps } from 'flowbite-svelte/Radio.svelte';
8+
import type { SelectProps } from 'flowbite-svelte/Select.svelte';
9+
import type { MultiSelectSlots } from 'flowbite-svelte/MultiSelect.svelte';
10+
import type { DatepickerProps } from 'flowbite-svelte/Datepicker.svelte';
11+
import type { TextareaProps } from 'flowbite-svelte/Textarea.svelte';
12+
import type { ToggleProps } from 'flowbite-svelte/Toggle.svelte';
413

514
import TextWidget from './text-widget.svelte';
615
import TextareaWidget from './textarea-widget.svelte';
@@ -13,6 +22,19 @@ import FileWidget from './file-widget.svelte';
1322
import ToggleWidget from './toggle-widget.svelte';
1423

1524
declare module '@sjsf/form' {
25+
export interface Inputs {
26+
flowbiteCheckbox: CheckboxProps;
27+
flowbiteFileUpload: FileuploadProps;
28+
flowbiteRange: RangeProps;
29+
flowbiteInput: InputProps;
30+
flowbiteRadio: RadioProps;
31+
flowbiteSelect: SelectProps;
32+
flowbiteMultiSelect: MultiSelectSlots;
33+
flowbiteDatepicker: DatepickerProps;
34+
flowbiteTextarea: TextareaProps;
35+
flowbiteToggle: ToggleProps;
36+
}
37+
1638
export interface WidgetsAndProps<V> {
1739
toggle: WidgetCommonProps<V, HTMLInputAttributes>;
1840
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<script lang="ts">
22
import type { WidgetProps } from '@sjsf/form';
33
import Input, { type InputProps } from 'flowbite-svelte/Input.svelte';
4-
import Range from 'flowbite-svelte/Range.svelte';
4+
import Range, { type RangeProps } from 'flowbite-svelte/Range.svelte';
55
66
let { value = $bindable(), attributes }: WidgetProps<'number'> = $props();
77
</script>
88

99
{#if attributes.type === 'range'}
10-
<Range bind:value {...attributes as InputProps} />
10+
<Range bind:value {...attributes as RangeProps} />
1111
{:else}
1212
<Input type="number" bind:value {...attributes as InputProps} />
1313
{/if}

0 commit comments

Comments
 (0)