@makolabs/ripple 1.0.5 → 1.0.7

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.
@@ -2,6 +2,7 @@
2
2
  import { fade, scale } from 'svelte/transition';
3
3
  import { quintOut } from 'svelte/easing';
4
4
  import { modal, type ModalProps } from './modal.js';
5
+ import { cn } from 'tailwind-variants';
5
6
 
6
7
  let {
7
8
  open = $bindable(false),
@@ -11,7 +12,12 @@
11
12
  size,
12
13
  hideCloseButton = false,
13
14
  class: className = '',
14
- contentClass = '',
15
+ contentclass: contentClassName = '',
16
+ bodyclass: bodyClassName = '',
17
+ titleclass: titleClassName = '',
18
+ headerclass: headerClassName = '',
19
+ backdropclass: backdropClassName = '',
20
+ footerclass: footerClassName = '',
15
21
  children,
16
22
  footer
17
23
  }: ModalProps = $props();
@@ -42,28 +48,37 @@
42
48
  document.removeEventListener('keydown', handleKeydown);
43
49
  };
44
50
  });
51
+
52
+ const computedClassName = $derived(cn(styles.base(), className));
53
+ const computedBackdropClassName = $derived(cn(styles.backdrop(), backdropClassName));
54
+ const computedContentClassName = $derived(cn(styles.container(), contentClassName));
55
+ const computedHeaderClassName = $derived(cn(styles.header(), headerClassName));
56
+ const computedBodyClassName = $derived(cn(styles.body(), bodyClassName));
57
+ const computedTitleClassName = $derived(cn(styles.title(), titleClassName));
58
+ const computedCloseClassName = $derived(cn(styles.close(), ''));
59
+ const computedFooterClassName = $derived(cn(styles.footer(), 'mt-auto', footerClassName));
45
60
  </script>
46
61
 
47
62
  {#if open}
48
- <div class={styles.base()} role="dialog" aria-modal="true">
63
+ <div class={computedClassName} role="dialog" aria-modal="true">
49
64
  <!-- Backdrop -->
50
65
  <div
51
- class={styles.backdrop()}
66
+ class={computedBackdropClassName}
52
67
  onclick={handleBackdropClick}
53
68
  transition:fade={{ duration: 200 }}
54
69
  role="presentation"></div>
55
70
 
56
71
  <!-- Modal Container -->
57
72
  <div
58
- class="{styles.container()} {contentClass || className}"
73
+ class={computedContentClassName}
59
74
  transition:scale={{ duration: 200, easing: quintOut, start: 0.95 }}
60
75
  >
61
76
  <!-- Header -->
62
77
  {#if title || !hideCloseButton}
63
- <header class={styles.header()}>
78
+ <header class={computedHeaderClassName}>
64
79
  <div class="flex-1">
65
80
  {#if title}
66
- <h2 class={styles.title()}>{title}</h2>
81
+ <h2 class={computedTitleClassName}>{title}</h2>
67
82
  {/if}
68
83
  {#if description}
69
84
  <p class={styles.description()}>{description}</p>
@@ -73,7 +88,7 @@
73
88
  {#if !hideCloseButton}
74
89
  <button
75
90
  type="button"
76
- class={styles.close()}
91
+ class={computedCloseClassName}
77
92
  onclick={onclose}
78
93
  aria-label="Close"
79
94
  >
@@ -92,14 +107,14 @@
92
107
 
93
108
  <!-- Body -->
94
109
  {#if children}
95
- <div class={styles.body()}>
110
+ <div class={computedBodyClassName}>
96
111
  {@render children()}
97
112
  </div>
98
113
  {/if}
99
114
 
100
115
  <!-- Footer -->
101
116
  {#if footer}
102
- <footer class={styles.footer()}>
117
+ <footer class={computedFooterClassName}>
103
118
  {@render footer()}
104
119
  </footer>
105
120
  {/if}
@@ -102,7 +102,12 @@ export type ModalProps = {
102
102
  size?: VariantSizes;
103
103
  hideCloseButton?: boolean;
104
104
  class?: string;
105
- contentClass?: string;
105
+ contentclass?: string;
106
+ bodyclass?: string;
107
+ titleclass?: string;
108
+ headerclass?: string;
109
+ backdropclass?: string;
110
+ footerclass?: string;
106
111
  children?: Snippet;
107
112
  footer?: Snippet;
108
113
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makolabs/ripple",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Simple Svelte 5 powered component library ✨",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {