Skip to content

Commit 89e2b1b

Browse files
committed
v0.8.6
1 parent 0443fbd commit 89e2b1b

File tree

20 files changed

+349
-167
lines changed

20 files changed

+349
-167
lines changed

.changeset/clean-tables-grab.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 0.8.6
4+
5+
### Patch Changes
6+
7+
- fix: Input component ([`0443fbd838714b5a9830e7bb5e64064df33cbb02`](https://github.com/shinokada/svelte-5-ui-lib/commit/0443fbd838714b5a9830e7bb5e64064df33cbb02))
8+
39
## 0.8.5
410

511
### Patch Changes

package.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "svelte-5-ui-lib",
3-
"version": "0.8.5",
3+
"version": "0.8.6",
44
"description": "A UI library for Svelte 5.",
55
"license": "MIT",
66
"main": "dist/index.js",
@@ -239,6 +239,14 @@
239239
"types": "./dist/forms/checkbox/Checkbox.svelte.d.ts",
240240
"svelte": "./dist/forms/checkbox/Checkbox.svelte"
241241
},
242+
"./CheckboxButton.svelte": {
243+
"types": "./dist/forms/checkbox-button/CheckboxButton.svelte.d.ts",
244+
"svelte": "./dist/forms/checkbox-button/CheckboxButton.svelte"
245+
},
246+
"./Fileupload.svelte": {
247+
"types": "./dist/forms/fileupload/Fileupload.svelte.d.ts",
248+
"svelte": "./dist/forms/fileupload/Fileupload.svelte"
249+
},
242250
"./FloatingLabelInput.svelte": {
243251
"types": "./dist/forms/floating-label-input/FloatingLabelInput.svelte.d.ts",
244252
"svelte": "./dist/forms/floating-label-input/FloatingLabelInput.svelte"
@@ -271,6 +279,10 @@
271279
"types": "./dist/forms/range/Range.svelte.d.ts",
272280
"svelte": "./dist/forms/range/Range.svelte"
273281
},
282+
"./Search.svelte": {
283+
"types": "./dist/forms/search/Search.svelte.d.ts",
284+
"svelte": "./dist/forms/search/Search.svelte"
285+
},
274286
"./Select.svelte": {
275287
"types": "./dist/forms/select/Select.svelte.d.ts",
276288
"svelte": "./dist/forms/select/Select.svelte"

src/lib/forms/checkbox-button/CheckboxButton.svelte

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,25 @@
1717
color?: ButtonColorType;
1818
shadow?: boolean;
1919
}
20-
let { children, class: className, group = [], value = 'on', checked, inline = true, pill, outline, size, color, shadow, ...restProps }: Props = $props();
20+
let {
21+
children,
22+
class: className,
23+
group = [],
24+
value = 'on',
25+
checked,
26+
inline = true,
27+
pill,
28+
outline,
29+
size,
30+
color,
31+
shadow,
32+
...restProps
33+
}: Props = $props();
2134
2235
// react on external group changes
2336
function init(_: HTMLElement, _group: (string | number)[]) {
24-
if (checked === undefined && value !== undefined) checked = _group.includes(value);
37+
if (checked === undefined && value !== undefined)
38+
checked = _group.includes(value);
2539
onChange();
2640
2741
return {
@@ -54,17 +68,47 @@
5468
}
5569
}
5670
57-
let buttonClass: string = $derived(twMerge(inline ? 'inline-flex' : 'flex', className));
71+
let buttonClass: string = $derived(
72+
twMerge(inline ? 'inline-flex' : 'flex', className)
73+
);
5874
</script>
5975

60-
<Button tag="label" {checked} {pill} {outline} {size} {color} {shadow} class={buttonClass}>
76+
<Button
77+
tag="label"
78+
{checked}
79+
{pill}
80+
{outline}
81+
{size}
82+
{color}
83+
{shadow}
84+
class={buttonClass}
85+
>
6186
<input
6287
use:init={group}
6388
type="checkbox"
6489
bind:checked
6590
{value}
6691
{...restProps}
6792
class="sr-only"
68-
onchange={onChange}/>
93+
onchange={onChange}
94+
/>
6995
{@render children()}
7096
</Button>
97+
98+
<!--
99+
@component
100+
[Go to docs](https://svelte-5-ui-lib.codewithshin.com/)
101+
## Props
102+
@prop children
103+
@prop class: className
104+
@prop group = []
105+
@prop value = 'on'
106+
@prop checked
107+
@prop inline = true
108+
@prop pill
109+
@prop outline
110+
@prop size
111+
@prop color
112+
@prop shadow
113+
@prop ...restProps
114+
-->
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import CheckboxButton from "./CheckboxButton.svelte";
2-
1+
import CheckboxButton from './CheckboxButton.svelte';
32

43
export { CheckboxButton };
5-
6-

src/lib/forms/checkbox/Checkbox.svelte

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,38 @@
2424
checkbox({ color, tinted, custom, rounded, inline })
2525
);
2626
</script>
27+
2728
{#if choices.length > 0}
28-
{#each choices as {value, checkboxLabel}, i}
29+
{#each choices as { value, checkboxLabel }, i}
2930
<Label class={label({ class: classLabel })} for={`checkbox-${i}`}>
30-
{ checkboxLabel }
31-
<input id={`checkbox-${i}`} type="checkbox" value={ value } bind:group {...attributes}
32-
class={base({ class: className })}
31+
{checkboxLabel}
32+
<input
33+
id={`checkbox-${i}`}
34+
type="checkbox"
35+
{value}
36+
bind:group
37+
{...attributes}
38+
class={base({ class: className })}
3339
/>
3440
{#if children}
35-
{@render children()}
41+
{@render children()}
3642
{/if}
3743
</Label>
3844
{/each}
3945
{:else}
40-
<Label class={label({ class: classLabel })}>
41-
<input
42-
type="checkbox"
43-
bind:checked
44-
aria-describedby={aria_describedby}
45-
{indeterminate}
46-
{...attributes}
47-
class={base({ class: className })}
48-
/>
49-
{#if children}
50-
{@render children()}
51-
{/if}
52-
</Label>
46+
<Label class={label({ class: classLabel })}>
47+
<input
48+
type="checkbox"
49+
bind:checked
50+
aria-describedby={aria_describedby}
51+
{indeterminate}
52+
{...attributes}
53+
class={base({ class: className })}
54+
/>
55+
{#if children}
56+
{@render children()}
57+
{/if}
58+
</Label>
5359
{/if}
5460

5561
<!--
@@ -63,7 +69,8 @@
6369
@prop inline
6470
@prop tinted
6571
@prop rounded
66-
@prop group = []
72+
@prop group = $bindable([])
73+
@prop choices = []
6774
@prop checked = $bindable(false)
6875
@prop spacing
6976
@prop classLabel

src/lib/forms/checkbox/index.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { type VariantProps } from 'tailwind-variants';
77

88
type CheckboxItem = {
99
value: string;
10-
checkboxLabel?: string;
11-
isChecked?: boolean;
10+
checkboxLabel?: string;
11+
isChecked?: boolean;
1212
};
1313

1414
type ColorType = VariantProps<typeof checkbox>['color'];
@@ -29,4 +29,10 @@ interface CheckboxProps extends HTMLInputAttributes {
2929
class?: string | undefined | null;
3030
}
3131

32-
export { Checkbox, checkbox, type CheckboxProps, type CheckboxItem, type ColorType };
32+
export {
33+
Checkbox,
34+
checkbox,
35+
type CheckboxProps,
36+
type CheckboxItem,
37+
type ColorType
38+
};
Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
<script lang="ts">
2-
import { type FileuploadProps as Props, fileupload } from '.'
3-
2+
import { type FileuploadProps as Props, fileupload } from '.';
3+
44
let {
55
files = $bindable(),
66
value = $bindable(),
77
size = 'md',
8-
class: className,
9-
...attributes
8+
class: className,
9+
...attributes
1010
}: Props = $props();
1111
const base = $derived(fileupload({ size, class: className }));
1212
</script>
1313

14-
<input type="file" bind:files {...attributes} class={base}/>
14+
<input type="file" bind:files {...attributes} class={base} />
1515

16+
<!--
17+
@component
18+
[Go to docs](https://svelte-5-ui-lib.codewithshin.com/)
19+
## Props
20+
@prop files = $bindable()
21+
@prop value = $bindable()
22+
@prop size = 'md'
23+
@prop class: className
24+
@prop ...attributes
25+
-->

src/lib/forms/fileupload/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import Fileupload from "./Fileupload.svelte";
2-
import type { HTMLInputAttributes } from "svelte/elements";
3-
import type { InputProps } from '$lib'
1+
import Fileupload from './Fileupload.svelte';
2+
import type { HTMLInputAttributes } from 'svelte/elements';
3+
import type { InputProps } from '$lib';
44
import { fileupload } from './theme';
55

66
interface FileuploadProps extends Omit<HTMLInputAttributes, 'size'> {
@@ -10,4 +10,4 @@ interface FileuploadProps extends Omit<HTMLInputAttributes, 'size'> {
1010
color?: InputProps['color'];
1111
}
1212

13-
export { Fileupload, fileupload, type FileuploadProps }
13+
export { Fileupload, fileupload, type FileuploadProps };

src/lib/forms/fileupload/theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ export const fileupload = tv({
99
lg: 'sm:text-base ps-11 pe-11 p-3'
1010
}
1111
}
12-
});
12+
});

0 commit comments

Comments
 (0)