Skip to content

Commit e197502

Browse files
committed
v0.9.14
1 parent 47c51b8 commit e197502

File tree

21 files changed

+87
-75
lines changed

21 files changed

+87
-75
lines changed

.changeset/orange-foxes-compete.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.9.14
4+
5+
### Patch Changes
6+
7+
- feat: modal component and page ([`47c51b8ddbbda5209099f2b88636a05e0218d398`](https://github.com/shinokada/svelte-5-ui-lib/commit/47c51b8ddbbda5209099f2b88636a05e0218d398))
8+
39
## 0.9.13
410

511
### Patch Changes

package.json

Lines changed: 5 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.9.13",
3+
"version": "0.9.14",
44
"description": "A UI library for Svelte 5.",
55
"license": "MIT",
66
"main": "dist/index.js",
@@ -351,6 +351,10 @@
351351
"types": "./dist/list-group/ListgroupItem.svelte.d.ts",
352352
"svelte": "./dist/list-group/ListgroupItem.svelte"
353353
},
354+
"./Modal.svelte": {
355+
"types": "./dist/modal/Modal.svelte.d.ts",
356+
"svelte": "./dist/modal/Modal.svelte"
357+
},
354358
"./NavBrand.svelte": {
355359
"types": "./dist/nav/NavBrand.svelte.d.ts",
356360
"svelte": "./dist/nav/NavBrand.svelte"

src/lib/forms/input/Input.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</div>
2626
{/if}
2727
{#if children}
28-
{@render children({ ...restProps, class:inputCls() })}
28+
{@render children({ ...restProps, class: inputCls() })}
2929
{:else}
3030
<input {...restProps} bind:value class={inputCls({ class: className })} />
3131
{/if}

src/lib/modal/Modal.svelte

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,24 @@
77
88
let { children, header, footer, title, modalStatus, dismissable = true, closeModal, divClass, contentClass, closeBtnClass, h3Class, headerClass, bodyClass, footerClass, outsideClose = true, size = 'md', backdrop = true, backdropClass, position = 'center', class: className, params = { duration: 100, easing: sineIn }, transition = fade, rounded = true, shadow = true, ...restProps }: Props = $props();
99
10-
const { base, div, content, backdrop: backdropCls, header: headerCls, footer: footerCls, body, closeBtn, h3 } = $derived(
10+
const {
11+
base,
12+
div,
13+
content,
14+
backdrop: backdropCls,
15+
header: headerCls,
16+
footer: footerCls,
17+
body,
18+
closeBtn,
19+
h3
20+
} = $derived(
1121
modal({
1222
position,
1323
size,
1424
backdrop,
1525
rounded
1626
})
1727
);
18-
1928
</script>
2029

2130
{#if modalStatus}
@@ -41,13 +50,13 @@
4150
{@render header()}
4251
{/if}
4352
{#if dismissable}
44-
<CloseButton onclick={closeModal} class={closeBtn({ class: closeBtnClass })}/>
53+
<CloseButton onclick={closeModal} class={closeBtn({ class: closeBtnClass })} />
4554
{/if}
4655
</div>
4756
{/if}
4857
<div class={body({ class: bodyClass })}>
4958
{#if dismissable && !title && !header}
50-
<CloseButton onclick={closeModal} class={closeBtn({ class: closeBtnClass })}/>
59+
<CloseButton onclick={closeModal} class={closeBtn({ class: closeBtnClass })} />
5160
{/if}
5261
{@render children()}
5362
</div>

src/lib/modal/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ type WidthType = VariantProps<typeof modal>['size'];
1010
type PosisionType = VariantProps<typeof modal>['position'];
1111
interface ModalProps extends HTMLAttributes<HTMLDivElement> {
1212
children: Snippet;
13-
header?: Snippet,
14-
footer?: Snippet,
15-
title?: string,
13+
header?: Snippet;
14+
footer?: Snippet;
15+
title?: string;
1616
modalStatus: boolean;
1717
dismissable?: boolean;
1818
closeModal?: () => void;
@@ -37,4 +37,3 @@ interface ModalProps extends HTMLAttributes<HTMLDivElement> {
3737
}
3838

3939
export { Modal, modal, type ModalProps };
40-

src/lib/modal/theme.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,40 @@ export const modal = tv({
1010
footer: 'flex items-center p-4 md:p-5 space-x-3 rtl:space-x-reverse rounded-b-lg',
1111
body: 'p-4 md:p-5 space-y-4 flex-1 overflow-y-auto overscroll-contain',
1212
closeBtn: 'absolute top-3 end-2.5',
13-
h3:'text-xl font-semibold text-gray-900 dark:text-white p-0'
13+
h3: 'text-xl font-semibold text-gray-900 dark:text-white p-0'
1414
},
1515
variants: {
1616
// position: {
1717
// fixed: { base: 'fixed' },
1818
// absolute: { base: 'absolute' }
1919
// },
2020
position: {
21-
'top-left': { base: 'justify-start items-start'},
22-
'top-center': { base: 'justify-center items-start'},
23-
'top-right': { base: 'justify-end items-start'},
24-
'center-left': { base: 'justify-start items-center'},
25-
'center': { base: 'justify-center items-center'},
26-
'center-right': { base: 'justify-end items-center'},
27-
'bottom-left': { base: 'justify-start items-end'},
28-
'bottom-center': { base: 'justify-center items-end'},
29-
'bottom-right': { base: 'justify-end items-end'},
30-
'default': { base: 'justify-center items-center'}
21+
'top-left': { base: 'justify-start items-start' },
22+
'top-center': { base: 'justify-center items-start' },
23+
'top-right': { base: 'justify-end items-start' },
24+
'center-left': { base: 'justify-start items-center' },
25+
center: { base: 'justify-center items-center' },
26+
'center-right': { base: 'justify-end items-center' },
27+
'bottom-left': { base: 'justify-start items-end' },
28+
'bottom-center': { base: 'justify-center items-end' },
29+
'bottom-right': { base: 'justify-end items-end' },
30+
default: { base: 'justify-center items-center' }
3131
},
3232
size: {
3333
xs: { div: 'max-w-md' },
3434
sm: { div: 'max-w-lg' },
3535
md: { div: 'max-w-2xl' },
3636
lg: { div: 'max-w-4xl' },
37-
xl: { div: 'max-w-7xl' },
37+
xl: { div: 'max-w-7xl' }
3838
},
3939
backdrop: {
4040
true: { backdrop: 'bg-gray-900 bg-opacity-75' }
4141
},
4242
rounded: {
43-
true: { content: 'rounded' },
43+
true: { content: 'rounded' }
4444
},
4545
shadow: {
4646
true: { content: 'shadow-md' }
4747
}
48-
},
49-
})
48+
}
49+
});

src/lib/utils/CloseButton.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
@component
2727
[Go to docs](https://svelte-5-ui-lib.codewithshin.com/)
2828
## Props
29-
@prop color = 'primary'
29+
@prop color = 'gray'
3030
@prop onclick
3131
@prop name = 'Close'
3232
@prop ariaLabel
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"name":"CloseButton","props":[["color","primary"],["onclick",""],["name","Close"],["ariaLabel",""],["size","md"],["href",""],["class: className",""],["...restProps",""]]}
1+
{"name":"CloseButton","props":[["color","gray"],["onclick",""],["name","Close"],["ariaLabel",""],["size","md"],["href",""],["class: className",""],["...restProps",""]]}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"Modal","props":[]}

0 commit comments

Comments
 (0)