@ims360/svelte-ivory 0.0.2 → 0.0.3

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/README.md CHANGED
@@ -9,7 +9,7 @@ Eventually we will add more documentation and examples to make it easier for dev
9
9
  Include this line in your `app.css` file, so the TW classes used in the lib are included:
10
10
 
11
11
  ```css
12
- @source "../node_modules/@ims360/svelte-lib";
12
+ @source "../node_modules/@ims360/svelte-ivory";
13
13
  ```
14
14
 
15
15
  _You may need to adjust the path if your `app.css` is not located in `/src`_
@@ -0,0 +1,60 @@
1
+ <script lang="ts">
2
+ import { X } from '@lucide/svelte';
3
+ import clsx from 'clsx';
4
+ import type { Snippet } from 'svelte';
5
+ import { fly } from 'svelte/transition';
6
+ import { twMerge } from 'tailwind-merge';
7
+ import Heading from '../heading';
8
+ import HiddenBackground from '../hiddenBackground';
9
+
10
+ type DrawerPlacement = 'left' | 'right';
11
+
12
+ interface Props {
13
+ class?: string;
14
+ b_open: boolean;
15
+ title?: string;
16
+ children: Snippet;
17
+ placement?: DrawerPlacement;
18
+ }
19
+
20
+ let {
21
+ class: clazz,
22
+ b_open = $bindable(false),
23
+ children,
24
+ title,
25
+ placement = 'right'
26
+ }: Props = $props();
27
+
28
+ const close = () => {
29
+ b_open = false;
30
+ };
31
+ </script>
32
+
33
+ {#if b_open}
34
+ <HiddenBackground onclose={close}>
35
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
36
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
37
+ <div
38
+ class={twMerge(
39
+ clsx([
40
+ 'bg-surface-50-950 absolute top-0 flex h-full flex-col gap-4 p-4',
41
+ placement === 'left' && 'left-0',
42
+ placement === 'right' && 'right-0',
43
+ clazz
44
+ ])
45
+ )}
46
+ transition:fly={{ x: placement === 'right' ? '100%' : '-100%', duration: 200 }}
47
+ onclick={(e) => e.stopPropagation()}
48
+ >
49
+ <div class="flex flex-row items-center justify-between gap-8">
50
+ {#if title}
51
+ <Heading>{title}</Heading>
52
+ {/if}
53
+ <button class="group ml-auto flex justify-end" type="button" onclick={close}>
54
+ <X class="h-full w-auto transition-[stroke-width] group-hover:stroke-3" />
55
+ </button>
56
+ </div>
57
+ {@render children()}
58
+ </div>
59
+ </HiddenBackground>
60
+ {/if}
@@ -0,0 +1,12 @@
1
+ import type { Snippet } from 'svelte';
2
+ type DrawerPlacement = 'left' | 'right';
3
+ interface Props {
4
+ class?: string;
5
+ b_open: boolean;
6
+ title?: string;
7
+ children: Snippet;
8
+ placement?: DrawerPlacement;
9
+ }
10
+ declare const Drawer: import("svelte").Component<Props, {}, "b_open">;
11
+ type Drawer = ReturnType<typeof Drawer>;
12
+ export default Drawer;
@@ -1,3 +1,4 @@
1
+ export { default as Drawer } from './drawer/Drawer.svelte';
1
2
  export { default as Heading } from './heading/index';
2
3
  export { default as HiddenBackground } from './hiddenBackground/index';
3
4
  export { default as Modal } from './modal/Modal.svelte';
@@ -1,3 +1,4 @@
1
+ export { default as Drawer } from './drawer/Drawer.svelte';
1
2
  export { default as Heading } from './heading/index';
2
3
  export { default as HiddenBackground } from './hiddenBackground/index';
3
4
  export { default as Modal } from './modal/Modal.svelte';
package/package.json CHANGED
@@ -103,5 +103,5 @@
103
103
  "svelte": "./dist/index.js",
104
104
  "type": "module",
105
105
  "types": "./dist/index.d.ts",
106
- "version": "0.0.2"
106
+ "version": "0.0.3"
107
107
  }
@@ -0,0 +1,60 @@
1
+ <script lang="ts">
2
+ import { X } from '@lucide/svelte';
3
+ import clsx from 'clsx';
4
+ import type { Snippet } from 'svelte';
5
+ import { fly } from 'svelte/transition';
6
+ import { twMerge } from 'tailwind-merge';
7
+ import Heading from '../heading';
8
+ import HiddenBackground from '../hiddenBackground';
9
+
10
+ type DrawerPlacement = 'left' | 'right';
11
+
12
+ interface Props {
13
+ class?: string;
14
+ b_open: boolean;
15
+ title?: string;
16
+ children: Snippet;
17
+ placement?: DrawerPlacement;
18
+ }
19
+
20
+ let {
21
+ class: clazz,
22
+ b_open = $bindable(false),
23
+ children,
24
+ title,
25
+ placement = 'right'
26
+ }: Props = $props();
27
+
28
+ const close = () => {
29
+ b_open = false;
30
+ };
31
+ </script>
32
+
33
+ {#if b_open}
34
+ <HiddenBackground onclose={close}>
35
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
36
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
37
+ <div
38
+ class={twMerge(
39
+ clsx([
40
+ 'bg-surface-50-950 absolute top-0 flex h-full flex-col gap-4 p-4',
41
+ placement === 'left' && 'left-0',
42
+ placement === 'right' && 'right-0',
43
+ clazz
44
+ ])
45
+ )}
46
+ transition:fly={{ x: placement === 'right' ? '100%' : '-100%', duration: 200 }}
47
+ onclick={(e) => e.stopPropagation()}
48
+ >
49
+ <div class="flex flex-row items-center justify-between gap-8">
50
+ {#if title}
51
+ <Heading>{title}</Heading>
52
+ {/if}
53
+ <button class="group ml-auto flex justify-end" type="button" onclick={close}>
54
+ <X class="h-full w-auto transition-[stroke-width] group-hover:stroke-3" />
55
+ </button>
56
+ </div>
57
+ {@render children()}
58
+ </div>
59
+ </HiddenBackground>
60
+ {/if}
@@ -1,3 +1,4 @@
1
+ export { default as Drawer } from './drawer/Drawer.svelte';
1
2
  export { default as Heading } from './heading/index';
2
3
  export { default as HiddenBackground } from './hiddenBackground/index';
3
4
  export { default as Modal } from './modal/Modal.svelte';