milk-lib 0.0.24 → 0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Sheet/Sheet.svelte +52 -0
- package/dist/components/Sheet/Sheet.svelte.d.ts +4 -0
- package/dist/components/Sheet/Sheet.types.d.ts +23 -0
- package/dist/components/Sheet/Sheet.types.js +1 -0
- package/dist/components/Sheet/SheetActions.svelte +28 -0
- package/dist/components/Sheet/SheetActions.svelte.d.ts +4 -0
- package/dist/components/Sheet/SheetContent.svelte +13 -0
- package/dist/components/Sheet/SheetContent.svelte.d.ts +4 -0
- package/dist/components/Sheet/SheetDescription.svelte +13 -0
- package/dist/components/Sheet/SheetDescription.svelte.d.ts +4 -0
- package/dist/components/Sheet/SheetHeader.svelte +13 -0
- package/dist/components/Sheet/SheetHeader.svelte.d.ts +4 -0
- package/dist/components/Sheet/SheetTitle.svelte +13 -0
- package/dist/components/Sheet/SheetTitle.svelte.d.ts +4 -0
- package/dist/components/Sheet/index.d.ts +6 -0
- package/dist/components/Sheet/index.js +6 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {clickOutsideObject} from '../..';
|
|
3
|
+
import Portal from '../Portal/Portal.svelte';
|
|
4
|
+
import type { ISheetProps } from './Sheet.types';
|
|
5
|
+
import {onDestroy, onMount} from "svelte";
|
|
6
|
+
import {browser} from "$app/environment";
|
|
7
|
+
|
|
8
|
+
let { children, isOpen, hide, hideOnClickOutside }: ISheetProps = $props();
|
|
9
|
+
|
|
10
|
+
let sheetElement = $state<HTMLDivElement | null>(null)
|
|
11
|
+
|
|
12
|
+
const handleClickOutside = (event: MouseEvent) => {
|
|
13
|
+
clickOutsideObject(event, sheetElement as HTMLElement, null, () => hide?.());
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
onMount(() => {
|
|
17
|
+
if (browser && hideOnClickOutside) {
|
|
18
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
onDestroy(() => {
|
|
23
|
+
if (browser && hideOnClickOutside) {
|
|
24
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<Portal>
|
|
30
|
+
<div class={`Sheet ${isOpen ? 'Sheet-open' : ''}`} bind:this={sheetElement}>
|
|
31
|
+
{@render children()}
|
|
32
|
+
</div>
|
|
33
|
+
</Portal>
|
|
34
|
+
|
|
35
|
+
<style>.Sheet {
|
|
36
|
+
position: fixed;
|
|
37
|
+
z-index: var(--zindex-sheet);
|
|
38
|
+
top: 0;
|
|
39
|
+
right: 0;
|
|
40
|
+
height: 100vh;
|
|
41
|
+
background: white;
|
|
42
|
+
width: 400px;
|
|
43
|
+
border-left: 1px solid var(--line-base);
|
|
44
|
+
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
|
|
45
|
+
transform: translateX(110%);
|
|
46
|
+
opacity: 0;
|
|
47
|
+
transition: all 0.3s ease-in-out;
|
|
48
|
+
}
|
|
49
|
+
.Sheet.Sheet-open {
|
|
50
|
+
transform: translateX(0);
|
|
51
|
+
opacity: 1;
|
|
52
|
+
}</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
export interface ISheetProps {
|
|
3
|
+
children: Snippet;
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
hide?: () => unknown;
|
|
6
|
+
hideOnClickOutside?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface ISheetHeaderProps {
|
|
9
|
+
children: Snippet;
|
|
10
|
+
}
|
|
11
|
+
export interface ISheetDescriptionProps {
|
|
12
|
+
children: Snippet;
|
|
13
|
+
}
|
|
14
|
+
export interface ISheetContentProps {
|
|
15
|
+
children: Snippet;
|
|
16
|
+
}
|
|
17
|
+
export interface ISheetActionsProps {
|
|
18
|
+
children: Snippet;
|
|
19
|
+
hide?: () => unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface ISheetTitleProps {
|
|
22
|
+
children: Snippet;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ButtonMilk } from "../..";
|
|
3
|
+
import type { ISheetActionsProps } from './Sheet.types';
|
|
4
|
+
import { CloseLargeLineSystem } from "svelte-remix";
|
|
5
|
+
let { children, hide }: ISheetActionsProps = $props();
|
|
6
|
+
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<div class="SheetActions">
|
|
10
|
+
{@render children()}
|
|
11
|
+
{#if hide}
|
|
12
|
+
<div class="SheetActions-hide">
|
|
13
|
+
<ButtonMilk onClick={hide} iconButton variant="base-contained" size="sm">
|
|
14
|
+
<CloseLargeLineSystem size="1em"/>
|
|
15
|
+
</ButtonMilk>
|
|
16
|
+
</div>
|
|
17
|
+
{/if}
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<style>.SheetActions {
|
|
21
|
+
padding: 0.5rem;
|
|
22
|
+
border-bottom: 1px solid var(--line-base);
|
|
23
|
+
}
|
|
24
|
+
.SheetActions .SheetActions-hide {
|
|
25
|
+
position: absolute;
|
|
26
|
+
right: 0.5rem;
|
|
27
|
+
top: 0.5rem;
|
|
28
|
+
}</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ISheetContentProps } from "./Sheet.types";
|
|
3
|
+
|
|
4
|
+
let { children }: ISheetContentProps = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<div class="SheetContent">
|
|
8
|
+
{@render children()}
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<style>.SheetContent {
|
|
12
|
+
padding: 0.5rem 1.5rem;
|
|
13
|
+
}</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type {ISheetDescriptionProps} from "./Sheet.types";
|
|
3
|
+
|
|
4
|
+
let { children }: ISheetDescriptionProps = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<div class="SheetDescription">
|
|
8
|
+
{@render children()}
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<style>.SheetDescription {
|
|
12
|
+
color: var(--text-base-muted);
|
|
13
|
+
}</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type {ISheetHeaderProps} from "./Sheet.types";
|
|
3
|
+
|
|
4
|
+
let { children }: ISheetHeaderProps = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<div class="SheetHeader">
|
|
8
|
+
{@render children()}
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<style>.SheetHeader {
|
|
12
|
+
padding: 1.5rem 1.5rem 0.5rem;
|
|
13
|
+
}</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ISheetTitleProps } from './Sheet.types';
|
|
3
|
+
let { children } : ISheetTitleProps = $props();
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<h2 class="SheetTitle">
|
|
7
|
+
{@render children()}
|
|
8
|
+
</h2>
|
|
9
|
+
|
|
10
|
+
<style>.SheetTitle {
|
|
11
|
+
font-size: var(--font-size-h2);
|
|
12
|
+
font-weight: 500;
|
|
13
|
+
}</style>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Sheet } from './Sheet.svelte';
|
|
2
|
+
export { default as SheetHeader } from './SheetHeader.svelte';
|
|
3
|
+
export { default as SheetActions } from './SheetActions.svelte';
|
|
4
|
+
export { default as SheetTitle } from './SheetTitle.svelte';
|
|
5
|
+
export { default as SheetContent } from './SheetContent.svelte';
|
|
6
|
+
export { default as SheetDescription } from './SheetDescription.svelte';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Sheet } from './Sheet.svelte';
|
|
2
|
+
export { default as SheetHeader } from './SheetHeader.svelte';
|
|
3
|
+
export { default as SheetActions } from './SheetActions.svelte';
|
|
4
|
+
export { default as SheetTitle } from './SheetTitle.svelte';
|
|
5
|
+
export { default as SheetContent } from './SheetContent.svelte';
|
|
6
|
+
export { default as SheetDescription } from './SheetDescription.svelte';
|
package/dist/components/index.js
CHANGED