@r2digisolutions/components 0.21.5 → 0.21.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.
@@ -72,7 +72,14 @@
72
72
 
73
73
  <div class={['w-full space-y-3', className]}>
74
74
  {#if type === 'bar'}
75
- <svg viewBox={`0 0 320 ${height}`} class="h-auto w-full" role="img" aria-label="Bar chart">
75
+ <svg
76
+ viewBox={`0 0 320 ${height}`}
77
+ preserveAspectRatio="none"
78
+ class="block w-full"
79
+ style:height={`${height}px`}
80
+ role="img"
81
+ aria-label="Bar chart"
82
+ >
76
83
  {#each data as d, i}
77
84
  {@const bw = Math.max(12, (320 - 32) / data.length - 8)}
78
85
  {@const x = 16 + i * ((320 - 32) / data.length)}
@@ -93,7 +100,14 @@
93
100
  {/each}
94
101
  </svg>
95
102
  {:else if type === 'line'}
96
- <svg viewBox={`0 0 320 ${height}`} class="h-auto w-full" role="img" aria-label="Line chart">
103
+ <svg
104
+ viewBox={`0 0 320 ${height}`}
105
+ preserveAspectRatio="none"
106
+ class="block w-full"
107
+ style:height={`${height}px`}
108
+ role="img"
109
+ aria-label="Line chart"
110
+ >
97
111
  <polyline
98
112
  points={linePoints}
99
113
  fill="none"
@@ -166,7 +166,17 @@
166
166
  }
167
167
 
168
168
  function handleSubmit(e: SubmitEvent) {
169
- if (isRemote) {
169
+ e.preventDefault();
170
+ submitted = true;
171
+ onsubmit?.(e);
172
+ }
173
+
174
+ let formEl = $state<HTMLFormElement | null>(null);
175
+
176
+ $effect(() => {
177
+ const el = formEl;
178
+ if (!el || !isRemote) return;
179
+ const onSubmit = () => {
170
180
  submitted = true;
171
181
  queueMicrotask(() => {
172
182
  const check = () => {
@@ -178,22 +188,13 @@
178
188
  };
179
189
  check();
180
190
  });
181
- // Do not preventDefault — Kit remote attachment owns progressive enhancement.
182
- return;
183
- }
184
- e.preventDefault();
185
- submitted = true;
186
- onsubmit?.(e);
187
- }
191
+ };
192
+ el.addEventListener('submit', onSubmit);
193
+ return () => el.removeEventListener('submit', onSubmit);
194
+ });
188
195
  </script>
189
196
 
190
- <form
191
- {...(remote as object | null)}
192
- class={['w-full', gaps[gap], className]}
193
- onsubmit={handleSubmit}
194
- novalidate
195
- aria-busy={busy || undefined}
196
- >
197
+ {#snippet fields()}
197
198
  {#if header}
198
199
  {@render header()}
199
200
  {:else if title || description}
@@ -230,4 +231,25 @@
230
231
  {@render footer()}
231
232
  </div>
232
233
  {/if}
233
- </form>
234
+ {/snippet}
235
+
236
+ {#if isRemote}
237
+ <form
238
+ bind:this={formEl}
239
+ {...(remote as object)}
240
+ class={['w-full', gaps[gap], className]}
241
+ novalidate
242
+ aria-busy={busy || undefined}
243
+ >
244
+ {@render fields()}
245
+ </form>
246
+ {:else}
247
+ <form
248
+ class={['w-full', gaps[gap], className]}
249
+ onsubmit={handleSubmit}
250
+ novalidate
251
+ aria-busy={busy || undefined}
252
+ >
253
+ {@render fields()}
254
+ </form>
255
+ {/if}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r2digisolutions/components",
3
- "version": "0.21.5",
3
+ "version": "0.21.7",
4
4
  "private": false,
5
5
  "description": "R2DigiSolutions Svelte 5 component library — Atomic Design, Tailwind 4, Light/Dark mode",
6
6
  "license": "MIT",