@makolabs/ripple 0.5.0 → 1.0.1
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/index.d.ts +1 -21
- package/dist/layout/card/metric-card.d.ts +3 -3
- package/dist/modal/Modal.svelte +74 -176
- package/dist/modal/Modal.svelte.d.ts +2 -2
- package/dist/modal/modal.d.ts +43 -148
- package/dist/modal/modal.js +16 -58
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -48,27 +48,7 @@ export type AnchorHTMLProps = {
|
|
|
48
48
|
href: string;
|
|
49
49
|
} & Record<string, unknown>;
|
|
50
50
|
export type ButtonProps = BaseButtonProps & (ButtonHTMLProps | AnchorHTMLProps);
|
|
51
|
-
export type
|
|
52
|
-
open?: boolean;
|
|
53
|
-
onclose?: () => void;
|
|
54
|
-
title?: string;
|
|
55
|
-
description?: string;
|
|
56
|
-
hideCloseButton?: boolean;
|
|
57
|
-
closeOnBackdropClick?: boolean;
|
|
58
|
-
closeOnEsc?: boolean;
|
|
59
|
-
position?: 'top' | 'center' | 'bottom';
|
|
60
|
-
size?: VariantSizes;
|
|
61
|
-
class?: string;
|
|
62
|
-
backdropclass?: string;
|
|
63
|
-
contentclass?: string;
|
|
64
|
-
headerclass?: string;
|
|
65
|
-
bodyclass?: string;
|
|
66
|
-
titleclass?: string;
|
|
67
|
-
children?: Snippet;
|
|
68
|
-
header?: Snippet;
|
|
69
|
-
footer?: Snippet;
|
|
70
|
-
custom?: Snippet;
|
|
71
|
-
};
|
|
51
|
+
export type { ModalProps } from './modal/modal.js';
|
|
72
52
|
export type DrawerProps = {
|
|
73
53
|
open?: boolean;
|
|
74
54
|
onclose?: () => void;
|
|
@@ -2,8 +2,8 @@ export declare const metricCard: import("tailwind-variants").TVReturnType<{
|
|
|
2
2
|
[key: string]: {
|
|
3
3
|
[key: string]: import("tailwind-variants").ClassValue | {
|
|
4
4
|
base?: import("tailwind-variants").ClassValue;
|
|
5
|
-
value?: import("tailwind-variants").ClassValue;
|
|
6
5
|
title?: import("tailwind-variants").ClassValue;
|
|
6
|
+
value?: import("tailwind-variants").ClassValue;
|
|
7
7
|
progress?: import("tailwind-variants").ClassValue;
|
|
8
8
|
detail?: import("tailwind-variants").ClassValue;
|
|
9
9
|
};
|
|
@@ -12,8 +12,8 @@ export declare const metricCard: import("tailwind-variants").TVReturnType<{
|
|
|
12
12
|
[x: string]: {
|
|
13
13
|
[x: string]: import("tailwind-variants").ClassValue | {
|
|
14
14
|
base?: import("tailwind-variants").ClassValue;
|
|
15
|
-
value?: import("tailwind-variants").ClassValue;
|
|
16
15
|
title?: import("tailwind-variants").ClassValue;
|
|
16
|
+
value?: import("tailwind-variants").ClassValue;
|
|
17
17
|
progress?: import("tailwind-variants").ClassValue;
|
|
18
18
|
detail?: import("tailwind-variants").ClassValue;
|
|
19
19
|
};
|
|
@@ -28,8 +28,8 @@ export declare const metricCard: import("tailwind-variants").TVReturnType<{
|
|
|
28
28
|
[key: string]: {
|
|
29
29
|
[key: string]: import("tailwind-variants").ClassValue | {
|
|
30
30
|
base?: import("tailwind-variants").ClassValue;
|
|
31
|
-
value?: import("tailwind-variants").ClassValue;
|
|
32
31
|
title?: import("tailwind-variants").ClassValue;
|
|
32
|
+
value?: import("tailwind-variants").ClassValue;
|
|
33
33
|
progress?: import("tailwind-variants").ClassValue;
|
|
34
34
|
detail?: import("tailwind-variants").ClassValue;
|
|
35
35
|
};
|
package/dist/modal/Modal.svelte
CHANGED
|
@@ -1,209 +1,107 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { onMount, onDestroy, tick } from 'svelte';
|
|
3
|
-
import { browser } from '$app/environment';
|
|
4
2
|
import { fade, scale } from 'svelte/transition';
|
|
5
3
|
import { quintOut } from 'svelte/easing';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import { Size, type MakeModalProps } from '../index.js';
|
|
9
|
-
|
|
4
|
+
import { modal, type ModalProps } from './modal.js';
|
|
5
|
+
|
|
10
6
|
let {
|
|
11
7
|
open = $bindable(false),
|
|
12
|
-
onclose
|
|
8
|
+
onclose = () => {},
|
|
13
9
|
title,
|
|
14
10
|
description,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
children,
|
|
18
|
-
header,
|
|
19
|
-
custom,
|
|
11
|
+
size,
|
|
12
|
+
hideCloseButton = false,
|
|
20
13
|
class: className = '',
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
titleclass: titleClass = '',
|
|
25
|
-
bodyclass: bodyClassName = ''
|
|
26
|
-
}: MakeModalProps = $props();
|
|
27
|
-
|
|
28
|
-
let modalElement: HTMLDivElement | undefined = $state();
|
|
29
|
-
|
|
30
|
-
const {
|
|
31
|
-
base,
|
|
32
|
-
backdrop,
|
|
33
|
-
contentWrapper,
|
|
34
|
-
content,
|
|
35
|
-
header: headerVClass,
|
|
36
|
-
title: titleVClass,
|
|
37
|
-
closeButton,
|
|
38
|
-
body
|
|
39
|
-
} = $derived(
|
|
40
|
-
modal({
|
|
41
|
-
open,
|
|
42
|
-
position,
|
|
43
|
-
size
|
|
44
|
-
})
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
const closeButtonClasses = $derived(closeButton());
|
|
48
|
-
const contentItemClass = $derived(content());
|
|
49
|
-
const baseClass = $derived(cn(base(), className));
|
|
50
|
-
const backdropClass = $derived(cn(backdrop(), backdropClassName));
|
|
51
|
-
const contentWrapperClass = $derived(cn(contentWrapper(), contentClassName));
|
|
52
|
-
const headerClass = $derived(cn(headerVClass(), headerClassName));
|
|
53
|
-
const titleClasses = $derived(cn(titleVClass(), titleClass));
|
|
54
|
-
const bodyClasses = $derived(cn(body(), bodyClassName));
|
|
14
|
+
children,
|
|
15
|
+
footer
|
|
16
|
+
}: ModalProps = $props();
|
|
55
17
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
18
|
+
const styles = $derived(modal({ size }));
|
|
19
|
+
|
|
20
|
+
function handleBackdropClick() {
|
|
21
|
+
onclose();
|
|
60
22
|
}
|
|
61
|
-
|
|
62
|
-
function
|
|
23
|
+
|
|
24
|
+
function handleKeydown(e: KeyboardEvent) {
|
|
63
25
|
if (e.key === 'Escape' && open) {
|
|
64
|
-
|
|
65
|
-
e.preventDefault();
|
|
66
|
-
e.stopPropagation();
|
|
26
|
+
onclose();
|
|
67
27
|
}
|
|
68
28
|
}
|
|
69
|
-
|
|
70
|
-
function handleCloseClick() {
|
|
71
|
-
onClose();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Focus trap functionality
|
|
75
|
-
let previouslyFocusedElement: HTMLElement | null = null;
|
|
76
|
-
|
|
77
|
-
function trapFocus(element: HTMLElement) {
|
|
78
|
-
const focusableElements = element.querySelectorAll(
|
|
79
|
-
'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
if (focusableElements.length === 0) return;
|
|
83
|
-
|
|
84
|
-
const firstElement = focusableElements[0] as HTMLElement;
|
|
85
|
-
const lastElement = focusableElements[focusableElements.length - 1] as HTMLElement;
|
|
86
|
-
|
|
87
|
-
function handleTabKey(e: KeyboardEvent) {
|
|
88
|
-
if (e.key !== 'Tab') return;
|
|
89
|
-
|
|
90
|
-
if (e.shiftKey) {
|
|
91
|
-
if (document.activeElement === firstElement) {
|
|
92
|
-
lastElement.focus();
|
|
93
|
-
e.preventDefault();
|
|
94
|
-
}
|
|
95
|
-
} else {
|
|
96
|
-
if (document.activeElement === lastElement) {
|
|
97
|
-
firstElement.focus();
|
|
98
|
-
e.preventDefault();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
element.addEventListener('keydown', handleTabKey);
|
|
104
|
-
firstElement.focus();
|
|
105
|
-
|
|
106
|
-
return () => {
|
|
107
|
-
element.removeEventListener('keydown', handleTabKey);
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
onMount(() => {
|
|
112
|
-
document.addEventListener('keydown', handleEscapeKey);
|
|
113
|
-
return () => {
|
|
114
|
-
document.removeEventListener('keydown', handleEscapeKey);
|
|
115
|
-
};
|
|
116
|
-
});
|
|
117
|
-
|
|
29
|
+
|
|
118
30
|
$effect(() => {
|
|
119
|
-
if (!browser) return;
|
|
120
31
|
if (open) {
|
|
121
|
-
previouslyFocusedElement = document.activeElement as HTMLElement;
|
|
122
32
|
document.body.style.overflow = 'hidden';
|
|
123
|
-
|
|
124
|
-
tick().then(() => {
|
|
125
|
-
if (modalElement) {
|
|
126
|
-
trapFocus(modalElement);
|
|
127
|
-
}
|
|
128
|
-
});
|
|
33
|
+
document.addEventListener('keydown', handleKeydown);
|
|
129
34
|
} else {
|
|
130
35
|
document.body.style.overflow = '';
|
|
131
|
-
|
|
132
|
-
previouslyFocusedElement.focus();
|
|
133
|
-
}
|
|
36
|
+
document.removeEventListener('keydown', handleKeydown);
|
|
134
37
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
onDestroy(() => {
|
|
138
|
-
if (browser && document.body.style.overflow === 'hidden') {
|
|
38
|
+
|
|
39
|
+
return () => {
|
|
139
40
|
document.body.style.overflow = '';
|
|
140
|
-
|
|
41
|
+
document.removeEventListener('keydown', handleKeydown);
|
|
42
|
+
};
|
|
141
43
|
});
|
|
142
44
|
</script>
|
|
143
45
|
|
|
144
|
-
{#if
|
|
145
|
-
<div
|
|
146
|
-
class={baseClass}
|
|
147
|
-
bind:this={modalElement}
|
|
148
|
-
role="dialog"
|
|
149
|
-
aria-modal="true"
|
|
150
|
-
aria-labelledby={title ? 'modal-title' : undefined}
|
|
151
|
-
aria-describedby={description ? 'modal-description' : undefined}
|
|
152
|
-
>
|
|
46
|
+
{#if open}
|
|
47
|
+
<div class={styles.base()} role="dialog" aria-modal="true">
|
|
153
48
|
<!-- Backdrop -->
|
|
154
|
-
<
|
|
155
|
-
class={
|
|
49
|
+
<div
|
|
50
|
+
class={styles.backdrop()}
|
|
156
51
|
onclick={handleBackdropClick}
|
|
157
52
|
transition:fade={{ duration: 200 }}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
class={contentWrapperClass}
|
|
53
|
+
role="presentation"></div>
|
|
54
|
+
|
|
55
|
+
<!-- Modal Container -->
|
|
56
|
+
<div
|
|
57
|
+
class="{styles.container()} {className}"
|
|
164
58
|
transition:scale={{ duration: 200, easing: quintOut, start: 0.95 }}
|
|
165
59
|
>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
{
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
</svg>
|
|
195
|
-
</button>
|
|
196
|
-
{/if}
|
|
197
|
-
</div>
|
|
198
|
-
{/if}
|
|
199
|
-
|
|
200
|
-
{#if children}
|
|
201
|
-
<div class={bodyClasses}>
|
|
202
|
-
{@render children()}
|
|
203
|
-
</div>
|
|
60
|
+
<!-- Header -->
|
|
61
|
+
{#if title || !hideCloseButton}
|
|
62
|
+
<header class={styles.header()}>
|
|
63
|
+
<div class="flex-1">
|
|
64
|
+
{#if title}
|
|
65
|
+
<h2 class={styles.title()}>{title}</h2>
|
|
66
|
+
{/if}
|
|
67
|
+
{#if description}
|
|
68
|
+
<p class={styles.description()}>{description}</p>
|
|
69
|
+
{/if}
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
{#if !hideCloseButton}
|
|
73
|
+
<button
|
|
74
|
+
type="button"
|
|
75
|
+
class={styles.close()}
|
|
76
|
+
onclick={onclose}
|
|
77
|
+
aria-label="Close"
|
|
78
|
+
>
|
|
79
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
80
|
+
<path
|
|
81
|
+
d="M15 5L5 15M5 5L15 15"
|
|
82
|
+
stroke="currentColor"
|
|
83
|
+
stroke-width="2"
|
|
84
|
+
stroke-linecap="round"
|
|
85
|
+
/>
|
|
86
|
+
</svg>
|
|
87
|
+
</button>
|
|
204
88
|
{/if}
|
|
89
|
+
</header>
|
|
90
|
+
{/if}
|
|
91
|
+
|
|
92
|
+
<!-- Body -->
|
|
93
|
+
{#if children}
|
|
94
|
+
<div class={styles.body()}>
|
|
95
|
+
{@render children()}
|
|
205
96
|
</div>
|
|
206
97
|
{/if}
|
|
98
|
+
|
|
99
|
+
<!-- Footer -->
|
|
100
|
+
{#if footer}
|
|
101
|
+
<footer class={styles.footer()}>
|
|
102
|
+
{@render footer()}
|
|
103
|
+
</footer>
|
|
104
|
+
{/if}
|
|
207
105
|
</div>
|
|
208
106
|
</div>
|
|
209
|
-
{/if}
|
|
107
|
+
{/if}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
declare const Modal: import("svelte").Component<
|
|
1
|
+
import { type ModalProps } from './modal.js';
|
|
2
|
+
declare const Modal: import("svelte").Component<ModalProps, {}, "open">;
|
|
3
3
|
type Modal = ReturnType<typeof Modal>;
|
|
4
4
|
export default Modal;
|
package/dist/modal/modal.d.ts
CHANGED
|
@@ -1,212 +1,107 @@
|
|
|
1
|
-
import { Size } from '../index.js';
|
|
1
|
+
import { Size, type VariantSizes } from '../index.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
2
3
|
export declare const modal: import("tailwind-variants").TVReturnType<{
|
|
3
|
-
open: {
|
|
4
|
-
true: {
|
|
5
|
-
base: string;
|
|
6
|
-
backdrop: string;
|
|
7
|
-
contentWrapper: string;
|
|
8
|
-
};
|
|
9
|
-
false: {
|
|
10
|
-
base: string;
|
|
11
|
-
backdrop: string;
|
|
12
|
-
contentWrapper: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
position: {
|
|
16
|
-
center: {
|
|
17
|
-
contentWrapper: string;
|
|
18
|
-
};
|
|
19
|
-
top: {
|
|
20
|
-
contentWrapper: string;
|
|
21
|
-
};
|
|
22
|
-
bottom: {
|
|
23
|
-
contentWrapper: string;
|
|
24
|
-
};
|
|
25
|
-
left: {
|
|
26
|
-
contentWrapper: string;
|
|
27
|
-
};
|
|
28
|
-
right: {
|
|
29
|
-
contentWrapper: string;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
4
|
size: {
|
|
33
5
|
[Size.XS]: {
|
|
34
|
-
|
|
6
|
+
container: string;
|
|
35
7
|
};
|
|
36
8
|
[Size.SM]: {
|
|
37
|
-
|
|
9
|
+
container: string;
|
|
38
10
|
};
|
|
39
11
|
[Size.BASE]: {
|
|
40
|
-
|
|
12
|
+
container: string;
|
|
41
13
|
};
|
|
42
14
|
[Size.LG]: {
|
|
43
|
-
|
|
15
|
+
container: string;
|
|
44
16
|
};
|
|
45
17
|
[Size.XL]: {
|
|
46
|
-
|
|
18
|
+
container: string;
|
|
47
19
|
};
|
|
48
20
|
[Size.XXL]: {
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
border: {
|
|
53
|
-
none: {
|
|
54
|
-
content: string;
|
|
55
|
-
};
|
|
56
|
-
default: {
|
|
57
|
-
content: string;
|
|
58
|
-
};
|
|
59
|
-
colored: {
|
|
60
|
-
content: string;
|
|
21
|
+
container: string;
|
|
61
22
|
};
|
|
62
23
|
};
|
|
63
24
|
}, {
|
|
64
25
|
base: string;
|
|
65
26
|
backdrop: string;
|
|
66
|
-
|
|
67
|
-
content: string;
|
|
27
|
+
container: string;
|
|
68
28
|
header: string;
|
|
69
29
|
body: string;
|
|
30
|
+
footer: string;
|
|
70
31
|
title: string;
|
|
71
|
-
|
|
32
|
+
description: string;
|
|
33
|
+
close: string;
|
|
72
34
|
}, undefined, {
|
|
73
|
-
open: {
|
|
74
|
-
true: {
|
|
75
|
-
base: string;
|
|
76
|
-
backdrop: string;
|
|
77
|
-
contentWrapper: string;
|
|
78
|
-
};
|
|
79
|
-
false: {
|
|
80
|
-
base: string;
|
|
81
|
-
backdrop: string;
|
|
82
|
-
contentWrapper: string;
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
position: {
|
|
86
|
-
center: {
|
|
87
|
-
contentWrapper: string;
|
|
88
|
-
};
|
|
89
|
-
top: {
|
|
90
|
-
contentWrapper: string;
|
|
91
|
-
};
|
|
92
|
-
bottom: {
|
|
93
|
-
contentWrapper: string;
|
|
94
|
-
};
|
|
95
|
-
left: {
|
|
96
|
-
contentWrapper: string;
|
|
97
|
-
};
|
|
98
|
-
right: {
|
|
99
|
-
contentWrapper: string;
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
35
|
size: {
|
|
103
36
|
[Size.XS]: {
|
|
104
|
-
|
|
37
|
+
container: string;
|
|
105
38
|
};
|
|
106
39
|
[Size.SM]: {
|
|
107
|
-
|
|
40
|
+
container: string;
|
|
108
41
|
};
|
|
109
42
|
[Size.BASE]: {
|
|
110
|
-
|
|
43
|
+
container: string;
|
|
111
44
|
};
|
|
112
45
|
[Size.LG]: {
|
|
113
|
-
|
|
46
|
+
container: string;
|
|
114
47
|
};
|
|
115
48
|
[Size.XL]: {
|
|
116
|
-
|
|
49
|
+
container: string;
|
|
117
50
|
};
|
|
118
51
|
[Size.XXL]: {
|
|
119
|
-
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
border: {
|
|
123
|
-
none: {
|
|
124
|
-
content: string;
|
|
125
|
-
};
|
|
126
|
-
default: {
|
|
127
|
-
content: string;
|
|
128
|
-
};
|
|
129
|
-
colored: {
|
|
130
|
-
content: string;
|
|
52
|
+
container: string;
|
|
131
53
|
};
|
|
132
54
|
};
|
|
133
55
|
}, {
|
|
134
56
|
base: string;
|
|
135
57
|
backdrop: string;
|
|
136
|
-
|
|
137
|
-
content: string;
|
|
58
|
+
container: string;
|
|
138
59
|
header: string;
|
|
139
60
|
body: string;
|
|
61
|
+
footer: string;
|
|
140
62
|
title: string;
|
|
141
|
-
|
|
63
|
+
description: string;
|
|
64
|
+
close: string;
|
|
142
65
|
}, import("tailwind-variants").TVReturnType<{
|
|
143
|
-
open: {
|
|
144
|
-
true: {
|
|
145
|
-
base: string;
|
|
146
|
-
backdrop: string;
|
|
147
|
-
contentWrapper: string;
|
|
148
|
-
};
|
|
149
|
-
false: {
|
|
150
|
-
base: string;
|
|
151
|
-
backdrop: string;
|
|
152
|
-
contentWrapper: string;
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
position: {
|
|
156
|
-
center: {
|
|
157
|
-
contentWrapper: string;
|
|
158
|
-
};
|
|
159
|
-
top: {
|
|
160
|
-
contentWrapper: string;
|
|
161
|
-
};
|
|
162
|
-
bottom: {
|
|
163
|
-
contentWrapper: string;
|
|
164
|
-
};
|
|
165
|
-
left: {
|
|
166
|
-
contentWrapper: string;
|
|
167
|
-
};
|
|
168
|
-
right: {
|
|
169
|
-
contentWrapper: string;
|
|
170
|
-
};
|
|
171
|
-
};
|
|
172
66
|
size: {
|
|
173
67
|
[Size.XS]: {
|
|
174
|
-
|
|
68
|
+
container: string;
|
|
175
69
|
};
|
|
176
70
|
[Size.SM]: {
|
|
177
|
-
|
|
71
|
+
container: string;
|
|
178
72
|
};
|
|
179
73
|
[Size.BASE]: {
|
|
180
|
-
|
|
74
|
+
container: string;
|
|
181
75
|
};
|
|
182
76
|
[Size.LG]: {
|
|
183
|
-
|
|
77
|
+
container: string;
|
|
184
78
|
};
|
|
185
79
|
[Size.XL]: {
|
|
186
|
-
|
|
80
|
+
container: string;
|
|
187
81
|
};
|
|
188
82
|
[Size.XXL]: {
|
|
189
|
-
|
|
190
|
-
};
|
|
191
|
-
};
|
|
192
|
-
border: {
|
|
193
|
-
none: {
|
|
194
|
-
content: string;
|
|
195
|
-
};
|
|
196
|
-
default: {
|
|
197
|
-
content: string;
|
|
198
|
-
};
|
|
199
|
-
colored: {
|
|
200
|
-
content: string;
|
|
83
|
+
container: string;
|
|
201
84
|
};
|
|
202
85
|
};
|
|
203
86
|
}, {
|
|
204
87
|
base: string;
|
|
205
88
|
backdrop: string;
|
|
206
|
-
|
|
207
|
-
content: string;
|
|
89
|
+
container: string;
|
|
208
90
|
header: string;
|
|
209
91
|
body: string;
|
|
92
|
+
footer: string;
|
|
210
93
|
title: string;
|
|
211
|
-
|
|
94
|
+
description: string;
|
|
95
|
+
close: string;
|
|
212
96
|
}, undefined, unknown, unknown, undefined>>;
|
|
97
|
+
export type ModalProps = {
|
|
98
|
+
open?: boolean;
|
|
99
|
+
onclose?: () => void;
|
|
100
|
+
title?: string;
|
|
101
|
+
description?: string;
|
|
102
|
+
size?: VariantSizes;
|
|
103
|
+
hideCloseButton?: boolean;
|
|
104
|
+
class?: string;
|
|
105
|
+
children?: Snippet;
|
|
106
|
+
footer?: Snippet;
|
|
107
|
+
};
|
package/dist/modal/modal.js
CHANGED
|
@@ -2,81 +2,39 @@ import { tv } from 'tailwind-variants';
|
|
|
2
2
|
import { Size } from '../index.js';
|
|
3
3
|
export const modal = tv({
|
|
4
4
|
slots: {
|
|
5
|
-
base: 'fixed inset-0 z-50 flex items-center justify-center
|
|
6
|
-
backdrop: 'fixed inset-0
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
title: 'text-
|
|
12
|
-
|
|
5
|
+
base: 'fixed inset-0 z-50 flex items-center justify-center p-4',
|
|
6
|
+
backdrop: 'fixed inset-0 bg-black/50 backdrop-blur-sm',
|
|
7
|
+
container: 'relative w-full flex flex-col bg-white rounded-xl shadow-2xl overflow-hidden',
|
|
8
|
+
header: 'px-6 py-4 border-b border-gray-200 flex items-center justify-between shrink-0',
|
|
9
|
+
body: 'flex-1 px-6 py-4 overflow-y-auto',
|
|
10
|
+
footer: 'px-6 py-4 border-t border-gray-200 bg-gray-50/80 shrink-0',
|
|
11
|
+
title: 'text-lg font-semibold text-gray-900',
|
|
12
|
+
description: 'text-sm text-gray-600 mt-1',
|
|
13
|
+
close: 'p-2 -mr-2 ml-4 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 transition-colors'
|
|
13
14
|
},
|
|
14
15
|
variants: {
|
|
15
|
-
open: {
|
|
16
|
-
true: {
|
|
17
|
-
base: 'visible',
|
|
18
|
-
backdrop: 'visible opacity-100',
|
|
19
|
-
contentWrapper: 'visible scale-100 opacity-100'
|
|
20
|
-
},
|
|
21
|
-
false: {
|
|
22
|
-
base: 'invisible',
|
|
23
|
-
backdrop: 'invisible opacity-0',
|
|
24
|
-
contentWrapper: 'invisible scale-95 opacity-0'
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
position: {
|
|
28
|
-
center: {
|
|
29
|
-
contentWrapper: 'mx-auto'
|
|
30
|
-
},
|
|
31
|
-
top: {
|
|
32
|
-
contentWrapper: 'mx-auto top-7'
|
|
33
|
-
},
|
|
34
|
-
bottom: {
|
|
35
|
-
contentWrapper: 'mx-auto bottom-7'
|
|
36
|
-
},
|
|
37
|
-
left: {
|
|
38
|
-
contentWrapper: 'left-7'
|
|
39
|
-
},
|
|
40
|
-
right: {
|
|
41
|
-
contentWrapper: 'right-7'
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
16
|
size: {
|
|
45
17
|
[Size.XS]: {
|
|
46
|
-
|
|
18
|
+
container: 'max-w-xs max-h-[80vh]'
|
|
47
19
|
},
|
|
48
20
|
[Size.SM]: {
|
|
49
|
-
|
|
21
|
+
container: 'max-w-sm max-h-[85vh]'
|
|
50
22
|
},
|
|
51
23
|
[Size.BASE]: {
|
|
52
|
-
|
|
24
|
+
container: 'max-w-md max-h-[85vh]'
|
|
53
25
|
},
|
|
54
26
|
[Size.LG]: {
|
|
55
|
-
|
|
27
|
+
container: 'max-w-lg max-h-[90vh]'
|
|
56
28
|
},
|
|
57
29
|
[Size.XL]: {
|
|
58
|
-
|
|
30
|
+
container: 'max-w-xl max-h-[90vh]'
|
|
59
31
|
},
|
|
60
32
|
[Size.XXL]: {
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
border: {
|
|
65
|
-
none: {
|
|
66
|
-
content: 'border-0'
|
|
67
|
-
},
|
|
68
|
-
default: {
|
|
69
|
-
content: 'border border-default-200'
|
|
70
|
-
},
|
|
71
|
-
colored: {
|
|
72
|
-
content: 'border'
|
|
33
|
+
container: 'max-w-2xl max-h-[90vh]'
|
|
73
34
|
}
|
|
74
35
|
}
|
|
75
36
|
},
|
|
76
37
|
defaultVariants: {
|
|
77
|
-
|
|
78
|
-
position: 'center',
|
|
79
|
-
size: 'base',
|
|
80
|
-
color: 'default'
|
|
38
|
+
size: Size.BASE
|
|
81
39
|
}
|
|
82
40
|
});
|