@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', `${Math.round(panelW)}px`);
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
- const hEl = hourListEl?.querySelector('[aria-selected="true"]') as HTMLElement | null;
253
- const mEl = minuteListEl?.querySelector('[aria-selected="true"]') as HTMLElement | null;
254
- hEl?.scrollIntoView({ block: 'center' });
255
- mEl?.scrollIntoView({ block: 'center' });
260
+ scrollSelected(hourListEl);
261
+ scrollSelected(minuteListEl);
256
262
  });
257
263
  });
258
264
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r2digisolutions/components",
3
- "version": "0.9.4",
3
+ "version": "0.9.5",
4
4
  "private": false,
5
5
  "description": "R2DigiSolutions Svelte 5 component library — Atomic Design, Tailwind 4, Light/Dark mode",
6
6
  "license": "MIT",