@makolabs/ripple 1.1.0 → 1.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.
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { cn } from '../helper/cls.js';
3
3
  import type { DateRangeProps } from '../index.js';
4
+ import Portal from '../utils/Portal.svelte';
4
5
 
5
6
  let {
6
7
  startDate = $bindable(),
@@ -21,13 +22,17 @@
21
22
  let isOpen = $state(false);
22
23
  let hoveredDate = $state<Date | null>(null);
23
24
  let datePickerRef = $state<HTMLDivElement | null>(null);
25
+ let calendarRef = $state<HTMLDivElement | null>(null);
24
26
 
25
27
  let viewMode = $state<'days' | 'months' | 'years'>('days');
26
28
  let viewDate = $state(new Date());
27
29
 
28
30
  const handleOutsideClick = (event: MouseEvent) => {
29
- if (isOpen && datePickerRef && !datePickerRef.contains(event.target as Node)) {
30
- isOpen = false;
31
+ if (isOpen && datePickerRef && calendarRef) {
32
+ const target = event.target as Node;
33
+ if (!datePickerRef.contains(target) && !calendarRef.contains(target)) {
34
+ isOpen = false;
35
+ }
31
36
  }
32
37
  };
33
38
 
@@ -290,9 +295,11 @@
290
295
  </div>
291
296
 
292
297
  {#if isOpen}
293
- <div
294
- class="ring-opacity-5 absolute z-10 mt-1 w-full origin-top-left rounded-md bg-white p-4 shadow-lg ring-1 ring-black focus:outline-none"
295
- >
298
+ <Portal target={datePickerRef}>
299
+ <div
300
+ bind:this={calendarRef}
301
+ class="ring-opacity-5 absolute z-10 mt-1 w-full origin-top-left rounded-md bg-white p-4 shadow-lg ring-1 ring-default-300 focus:outline-none"
302
+ >
296
303
  <div class="mb-2 flex items-center justify-between">
297
304
  {#if viewMode === 'days'}
298
305
  <button
@@ -490,6 +497,7 @@
490
497
  </div>
491
498
  </div>
492
499
  {/if}
493
- </div>
500
+ </div>
501
+ </Portal>
494
502
  {/if}
495
503
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makolabs/ripple",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Simple Svelte 5 powered component library ✨",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {