@r2digisolutions/components 0.9.4 → 0.9.5
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.
|
@@ -144,7 +144,8 @@
|
|
|
144
144
|
s.setProperty('left', `${Math.round(left)}px`);
|
|
145
145
|
s.setProperty('right', 'auto');
|
|
146
146
|
s.setProperty('bottom', 'auto');
|
|
147
|
-
s.setProperty('width',
|
|
147
|
+
s.setProperty('width', 'max-content');
|
|
148
|
+
s.setProperty('min-width', `${Math.round(Math.min(panelW, trigger.width))}px`);
|
|
148
149
|
s.setProperty('visibility', placed ? 'visible' : 'hidden');
|
|
149
150
|
}
|
|
150
151
|
}
|
|
@@ -246,13 +247,18 @@
|
|
|
246
247
|
return `${h12} ${period}`;
|
|
247
248
|
}
|
|
248
249
|
|
|
250
|
+
function scrollSelected(listEl: HTMLDivElement | null) {
|
|
251
|
+
const selected = listEl?.querySelector('[aria-selected="true"]') as HTMLElement | null;
|
|
252
|
+
if (!listEl || !selected) return;
|
|
253
|
+
// Don't use scrollIntoView — it also scrolls the dialog/modal ancestors.
|
|
254
|
+
listEl.scrollTop = selected.offsetTop - listEl.clientHeight / 2 + selected.clientHeight / 2;
|
|
255
|
+
}
|
|
256
|
+
|
|
249
257
|
$effect(() => {
|
|
250
258
|
if (!open) return;
|
|
251
259
|
requestAnimationFrame(() => {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
hEl?.scrollIntoView({ block: 'center' });
|
|
255
|
-
mEl?.scrollIntoView({ block: 'center' });
|
|
260
|
+
scrollSelected(hourListEl);
|
|
261
|
+
scrollSelected(minuteListEl);
|
|
256
262
|
});
|
|
257
263
|
});
|
|
258
264
|
</script>
|