@hyvor/design 2.1.0 → 2.1.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.
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
show?: boolean;
|
|
13
13
|
title?: string | Snippet;
|
|
14
14
|
size?: 'small' | 'medium' | 'large';
|
|
15
|
+
width?: string;
|
|
16
|
+
height?: string;
|
|
17
|
+
bare?: boolean;
|
|
15
18
|
id?: string;
|
|
16
19
|
role?: 'dialog' | 'alertdialog';
|
|
17
20
|
closeOnOutsideClick?: boolean;
|
|
@@ -28,6 +31,9 @@
|
|
|
28
31
|
show = $bindable(false),
|
|
29
32
|
title,
|
|
30
33
|
size = 'medium',
|
|
34
|
+
width,
|
|
35
|
+
height,
|
|
36
|
+
bare = false,
|
|
31
37
|
id = 'modal',
|
|
32
38
|
role = 'alertdialog',
|
|
33
39
|
closeOnOutsideClick = true,
|
|
@@ -44,6 +50,10 @@
|
|
|
44
50
|
const titleId = id + '-title';
|
|
45
51
|
const descId = id + '-desc';
|
|
46
52
|
|
|
53
|
+
const innerStyle = $derived(
|
|
54
|
+
[width ? `width: ${width}` : '', height ? `height: ${height}` : ''].filter(Boolean).join('; ')
|
|
55
|
+
);
|
|
56
|
+
|
|
47
57
|
let wrapEl: HTMLDivElement | undefined = $state();
|
|
48
58
|
let innerEl: HTMLDivElement | undefined = $state();
|
|
49
59
|
|
|
@@ -96,36 +106,44 @@
|
|
|
96
106
|
>
|
|
97
107
|
<div
|
|
98
108
|
class="inner {size}"
|
|
109
|
+
class:bare
|
|
110
|
+
style={innerStyle || undefined}
|
|
99
111
|
transition:scale|global={{ duration: 100, start: 0.9, opacity: 0.9 }}
|
|
100
112
|
bind:this={innerEl}
|
|
101
113
|
{role}
|
|
102
114
|
aria-modal="true"
|
|
103
|
-
aria-labelledby={titleId}
|
|
115
|
+
aria-labelledby={bare ? undefined : titleId}
|
|
104
116
|
aria-describedby={descId}
|
|
105
117
|
>
|
|
106
|
-
|
|
107
|
-
<div class="
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
{#if !bare}
|
|
119
|
+
<div class="header">
|
|
120
|
+
<div class="title" id={titleId}>
|
|
121
|
+
{#if typeof title === 'string'}
|
|
122
|
+
<span>{title}</span>
|
|
123
|
+
{:else}
|
|
124
|
+
{@render title?.()}
|
|
125
|
+
{/if}
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
<div class="close-wrap">
|
|
129
|
+
{#if hasClose}
|
|
130
|
+
<IconButton
|
|
131
|
+
variant="invisible"
|
|
132
|
+
on:click={handleCancel}
|
|
133
|
+
aria-label="Close modal"
|
|
134
|
+
>
|
|
135
|
+
<IconX size={25} />
|
|
136
|
+
</IconButton>
|
|
137
|
+
{/if}
|
|
138
|
+
</div>
|
|
121
139
|
</div>
|
|
122
|
-
|
|
140
|
+
{/if}
|
|
123
141
|
|
|
124
142
|
<div class="content" id={descId}>
|
|
125
143
|
{@render children?.()}
|
|
126
144
|
</div>
|
|
127
145
|
|
|
128
|
-
{#if footer}
|
|
146
|
+
{#if footer && !bare}
|
|
129
147
|
<div class="footer">
|
|
130
148
|
{#if typeof footer === 'object'}
|
|
131
149
|
<ModalFooter {footer} bind:show on:cancel on:confirm />
|
|
@@ -168,7 +186,7 @@
|
|
|
168
186
|
z-index: 10000000;
|
|
169
187
|
width: 100%;
|
|
170
188
|
height: 100%;
|
|
171
|
-
background: rgba(0, 0, 0, 0.
|
|
189
|
+
background: rgba(0, 0, 0, 0.15);
|
|
172
190
|
display: flex;
|
|
173
191
|
align-items: center;
|
|
174
192
|
justify-content: center;
|
|
@@ -209,6 +227,14 @@
|
|
|
209
227
|
.content {
|
|
210
228
|
padding: 20px 25px;
|
|
211
229
|
}
|
|
230
|
+
.inner.bare {
|
|
231
|
+
display: flex;
|
|
232
|
+
flex-direction: column;
|
|
233
|
+
}
|
|
234
|
+
.inner.bare .content {
|
|
235
|
+
padding: 0;
|
|
236
|
+
flex: 1;
|
|
237
|
+
}
|
|
212
238
|
|
|
213
239
|
.footer {
|
|
214
240
|
padding: 20px 25px;
|