@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
- <div class="header">
107
- <div class="title" id={titleId}>
108
- {#if typeof title === 'string'}
109
- <span>{title}</span>
110
- {:else}
111
- {@render title?.()}
112
- {/if}
113
- </div>
114
-
115
- <div class="close-wrap">
116
- {#if hasClose}
117
- <IconButton variant="invisible" on:click={handleCancel} aria-label="Close modal">
118
- <IconX size={25} />
119
- </IconButton>
120
- {/if}
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
- </div>
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.5);
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;
@@ -4,6 +4,9 @@ interface Props {
4
4
  show?: boolean;
5
5
  title?: string | Snippet;
6
6
  size?: 'small' | 'medium' | 'large';
7
+ width?: string;
8
+ height?: string;
9
+ bare?: boolean;
7
10
  id?: string;
8
11
  role?: 'dialog' | 'alertdialog';
9
12
  closeOnOutsideClick?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyvor/design",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "repository": {