@r2digisolutions/components 0.22.2 → 0.23.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.
Files changed (65) hide show
  1. package/dist/components/atoms/Avatar/Avatar.stories.d.ts +1 -1
  2. package/dist/components/atoms/Avatar/Avatar.stories.js +1 -1
  3. package/dist/components/atoms/Avatar/Avatar.svelte +5 -3
  4. package/dist/components/atoms/Avatar/Avatar.svelte.d.ts +1 -1
  5. package/dist/components/atoms/Avatar/AvatarStory.svelte +1 -1
  6. package/dist/components/atoms/Avatar/AvatarStory.svelte.d.ts +1 -1
  7. package/dist/components/atoms/Container/Container.stories.d.ts +1 -1
  8. package/dist/components/atoms/Container/ContainerStory.svelte.d.ts +1 -1
  9. package/dist/components/atoms/Input/Input.svelte +5 -4
  10. package/dist/components/molecules/AdSlot/AdSlot.stories.js +10 -0
  11. package/dist/components/molecules/AdSlot/AdSlot.svelte +16 -0
  12. package/dist/components/molecules/AdSlot/AdSlot.svelte.d.ts +8 -0
  13. package/dist/components/molecules/AdSlot/AdSlotStory.svelte +23 -0
  14. package/dist/components/molecules/AdSlot/AdSlotStory.svelte.d.ts +18 -0
  15. package/dist/components/molecules/AdUnit/AdUnit.stories.js +28 -0
  16. package/dist/components/molecules/AdUnit/AdUnit.svelte +151 -0
  17. package/dist/components/molecules/AdUnit/AdUnit.svelte.d.ts +15 -0
  18. package/dist/components/molecules/AdUnit/AdUnitStory.svelte +36 -0
  19. package/dist/components/molecules/AdUnit/AdUnitStory.svelte.d.ts +7 -0
  20. package/dist/components/molecules/AvatarGroup/AvatarGroup.svelte +1 -1
  21. package/dist/components/molecules/AvatarGroup/AvatarGroup.svelte.d.ts +1 -1
  22. package/dist/components/molecules/AvatarLabel/AvatarLabel.svelte +1 -1
  23. package/dist/components/molecules/AvatarLabel/AvatarLabel.svelte.d.ts +1 -1
  24. package/dist/components/molecules/Card/Card.svelte +6 -15
  25. package/dist/components/molecules/ChipBar/ChipBar.svelte +18 -5
  26. package/dist/components/molecules/ChipBar/ChipBar.svelte.d.ts +1 -1
  27. package/dist/components/molecules/FeatureList/FeatureList.svelte +26 -7
  28. package/dist/components/molecules/FeatureList/FeatureList.svelte.d.ts +2 -0
  29. package/dist/components/molecules/KnowledgeCard/KnowledgeCard.stories.js +25 -0
  30. package/dist/components/molecules/KnowledgeCard/KnowledgeCard.svelte +95 -0
  31. package/dist/components/molecules/KnowledgeCard/KnowledgeCard.svelte.d.ts +15 -0
  32. package/dist/components/molecules/KnowledgeCard/KnowledgeCardStory.svelte +56 -0
  33. package/dist/components/molecules/KnowledgeCard/KnowledgeCardStory.svelte.d.ts +6 -0
  34. package/dist/components/molecules/LocaleSwitcher/LocaleSwitcher.svelte +5 -5
  35. package/dist/components/molecules/MediaCard/MediaCard.svelte +101 -24
  36. package/dist/components/molecules/MediaCard/MediaCard.svelte.d.ts +25 -6
  37. package/dist/components/molecules/MediaCard/MediaCardStory.svelte +34 -1
  38. package/dist/components/molecules/SearchBar/SearchBar.svelte +7 -1
  39. package/dist/components/molecules/SearchInput/SearchInput.svelte +77 -18
  40. package/dist/components/molecules/SearchInput/SearchInput.svelte.d.ts +4 -0
  41. package/dist/components/molecules/SearchInput/SearchInputStory.svelte +1 -0
  42. package/dist/components/molecules/SearchResultRow/SearchResultRow.stories.js +25 -0
  43. package/dist/components/molecules/SearchResultRow/SearchResultRow.svelte +74 -0
  44. package/dist/components/molecules/SearchResultRow/SearchResultRow.svelte.d.ts +18 -0
  45. package/dist/components/molecules/SearchResultRow/SearchResultRowStory.svelte +85 -0
  46. package/dist/components/molecules/SearchResultRow/SearchResultRowStory.svelte.d.ts +6 -0
  47. package/dist/components/molecules/StatCard/StatCard.svelte +7 -1
  48. package/dist/components/molecules/StatCard/StatCard.svelte.d.ts +2 -0
  49. package/dist/components/organisms/Drawer/Drawer.svelte +120 -37
  50. package/dist/components/organisms/Drawer/Drawer.svelte.d.ts +6 -0
  51. package/dist/components/organisms/MapExplorer/MapExplorer.stories.d.ts +12 -0
  52. package/dist/components/organisms/MapExplorer/MapExplorer.stories.js +11 -0
  53. package/dist/components/organisms/MapExplorer/MapExplorer.svelte +928 -0
  54. package/dist/components/organisms/MapExplorer/MapExplorer.svelte.d.ts +96 -0
  55. package/dist/components/organisms/MapExplorer/MapExplorerStory.svelte +124 -0
  56. package/dist/components/organisms/MapExplorer/MapExplorerStory.svelte.d.ts +3 -0
  57. package/dist/components/organisms/Navbar/Navbar.stories.d.ts +1 -1
  58. package/dist/components/organisms/Navbar/Navbar.stories.js +1 -1
  59. package/dist/components/organisms/Navbar/Navbar.svelte +137 -64
  60. package/dist/components/organisms/Navbar/Navbar.svelte.d.ts +5 -1
  61. package/dist/components/organisms/Navbar/NavbarStory.svelte +1 -1
  62. package/dist/components/organisms/Navbar/NavbarStory.svelte.d.ts +1 -1
  63. package/dist/index.d.ts +8 -0
  64. package/dist/index.js +5 -0
  65. package/package.json +12 -8
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import IconButton from '../../atoms/IconButton/IconButton.svelte';
2
3
  import Input from '../../atoms/Input/Input.svelte';
3
4
 
4
5
  interface SearchInputProps {
@@ -8,6 +9,10 @@
8
9
  disabled?: boolean;
9
10
  size?: 'sm' | 'md' | 'lg';
10
11
  class?: string;
12
+ /** Accessible label for the submit control. */
13
+ submitLabel?: string;
14
+ /** Show the trailing submit button. Default true. */
15
+ showSubmit?: boolean;
11
16
  oninput?: (e: Event) => void;
12
17
  onsubmit?: (value: string) => void;
13
18
  onchange?: (e: Event) => void;
@@ -20,32 +25,86 @@
20
25
  disabled = false,
21
26
  size = 'md',
22
27
  class: className = '',
28
+ submitLabel = 'Search',
29
+ showSubmit = true,
23
30
  oninput,
24
31
  onsubmit,
25
32
  onchange
26
33
  }: SearchInputProps = $props();
27
34
 
35
+ const submitButtonSize = $derived(size === 'sm' ? 'xs' : 'sm');
36
+
37
+ function submit() {
38
+ onsubmit?.(value);
39
+ }
40
+
28
41
  function handleKeydown(e: KeyboardEvent) {
29
- if (e.key === 'Enter') onsubmit?.(value);
42
+ if (e.key !== 'Enter') return;
43
+ e.preventDefault();
44
+ submit();
30
45
  }
31
46
  </script>
32
47
 
33
- <div class={className} onkeydown={handleKeydown}>
34
- <Input
35
- {label}
36
- {placeholder}
48
+ {#snippet leadIcon()}
49
+ <svg
50
+ class="h-4 w-4"
51
+ viewBox="0 0 24 24"
52
+ fill="none"
53
+ stroke="currentColor"
54
+ stroke-width="2"
55
+ aria-hidden="true"
56
+ >
57
+ <path
58
+ stroke-linecap="round"
59
+ stroke-linejoin="round"
60
+ d="M21 21l-4.35-4.35M11 18a7 7 0 100-14 7 7 0 000 14z"
61
+ />
62
+ </svg>
63
+ {/snippet}
64
+
65
+ {#snippet trailIcon()}
66
+ <IconButton
67
+ type="button"
68
+ variant="ghost"
69
+ size={submitButtonSize}
70
+ label={submitLabel}
37
71
  {disabled}
38
- {size}
39
- type="search"
40
- clearable
41
- bind:value
42
- {oninput}
43
- {onchange}
72
+ class="-me-1.5"
73
+ onclick={(e) => {
74
+ e.preventDefault();
75
+ e.stopPropagation();
76
+ submit();
77
+ }}
44
78
  >
45
- {#snippet leadIcon()}
46
- <svg class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
47
- <path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-4.35-4.35M11 18a7 7 0 100-14 7 7 0 000 14z" />
48
- </svg>
49
- {/snippet}
50
- </Input>
51
- </div>
79
+ <svg
80
+ class="h-full w-full"
81
+ viewBox="0 0 24 24"
82
+ fill="none"
83
+ stroke="currentColor"
84
+ stroke-width="2"
85
+ aria-hidden="true"
86
+ >
87
+ <path
88
+ stroke-linecap="round"
89
+ stroke-linejoin="round"
90
+ d="M21 21l-4.35-4.35M11 18a7 7 0 100-14 7 7 0 000 14z"
91
+ />
92
+ </svg>
93
+ </IconButton>
94
+ {/snippet}
95
+
96
+ <Input
97
+ {label}
98
+ {placeholder}
99
+ {disabled}
100
+ {size}
101
+ type="search"
102
+ clearable
103
+ class={className}
104
+ bind:value
105
+ {oninput}
106
+ {onchange}
107
+ onkeydown={handleKeydown}
108
+ {leadIcon}
109
+ trailIcon={showSubmit ? trailIcon : undefined}
110
+ />
@@ -5,6 +5,10 @@ interface SearchInputProps {
5
5
  disabled?: boolean;
6
6
  size?: 'sm' | 'md' | 'lg';
7
7
  class?: string;
8
+ /** Accessible label for the submit control. */
9
+ submitLabel?: string;
10
+ /** Show the trailing submit button. Default true. */
11
+ showSubmit?: boolean;
8
12
  oninput?: (e: Event) => void;
9
13
  onsubmit?: (value: string) => void;
10
14
  onchange?: (e: Event) => void;
@@ -17,6 +17,7 @@
17
17
  placeholder={props.placeholder ?? 'Search projects…'}
18
18
  size={props.size ?? 'md'}
19
19
  disabled={props.disabled ?? false}
20
+ submitLabel="Search"
20
21
  onsubmit={(v) => (lastSubmit = v)}
21
22
  />
22
23
  {#if lastSubmit}
@@ -0,0 +1,25 @@
1
+ import SearchResultRowStory from './SearchResultRowStory.svelte';
2
+ const meta = {
3
+ title: 'Molecules/SearchResultRow',
4
+ component: SearchResultRowStory,
5
+ tags: ['autodocs'],
6
+ argTypes: {
7
+ example: {
8
+ control: 'select',
9
+ options: ['basic', 'with-favicon', 'no-href', 'leading-slot']
10
+ }
11
+ }
12
+ };
13
+ export default meta;
14
+ export const Default = {
15
+ args: { example: 'basic' }
16
+ };
17
+ export const WithFavicons = {
18
+ args: { example: 'with-favicon' }
19
+ };
20
+ export const NoHref = {
21
+ args: { example: 'no-href' }
22
+ };
23
+ export const LeadingSlot = {
24
+ args: { example: 'leading-slot' }
25
+ };
@@ -0,0 +1,74 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte'
3
+
4
+ export type SearchResultRowKind = 'doc' | 'page' | 'person' | 'file' | 'product' | string
5
+
6
+ interface SearchResultRowProps {
7
+ title: string
8
+ href?: string
9
+ /** Breadcrumb text shown below the title */
10
+ urlLabel?: string
11
+ snippet?: string
12
+ kind?: SearchResultRowKind
13
+ /** URL or path to a favicon/icon image */
14
+ favicon?: string
15
+ class?: string
16
+ /** Optional leading slot (replaces favicon when provided) */
17
+ leading?: Snippet
18
+ }
19
+
20
+ let {
21
+ title,
22
+ href,
23
+ urlLabel,
24
+ snippet,
25
+ kind: _kind,
26
+ favicon,
27
+ class: className = '',
28
+ leading
29
+ }: SearchResultRowProps = $props()
30
+
31
+ const hasLeading = $derived(!!leading || !!favicon)
32
+ </script>
33
+
34
+ <div class={['group flex min-w-0 gap-3 py-2', className]}>
35
+ {#if hasLeading}
36
+ <div class="mt-0.5 shrink-0">
37
+ {#if leading}
38
+ {@render leading()}
39
+ {:else if favicon}
40
+ <img
41
+ src={favicon}
42
+ alt=""
43
+ aria-hidden="true"
44
+ class="h-4 w-4 rounded-sm object-contain"
45
+ loading="lazy"
46
+ decoding="async"
47
+ />
48
+ {/if}
49
+ </div>
50
+ {/if}
51
+
52
+ <div class="min-w-0 flex-1">
53
+ {#if urlLabel}
54
+ <p class="mb-0.5 truncate text-xs text-muted">{urlLabel}</p>
55
+ {/if}
56
+
57
+ {#if href}
58
+ <a
59
+ {href}
60
+ class="block truncate text-lg font-medium leading-snug text-brand-600 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/30"
61
+ >
62
+ {title}
63
+ </a>
64
+ {:else}
65
+ <span class="block truncate text-lg font-medium leading-snug text-brand-600">
66
+ {title}
67
+ </span>
68
+ {/if}
69
+
70
+ {#if snippet}
71
+ <p class="mt-1 line-clamp-2 text-sm text-secondary">{snippet}</p>
72
+ {/if}
73
+ </div>
74
+ </div>
@@ -0,0 +1,18 @@
1
+ import type { Snippet } from 'svelte';
2
+ export type SearchResultRowKind = 'doc' | 'page' | 'person' | 'file' | 'product' | string;
3
+ interface SearchResultRowProps {
4
+ title: string;
5
+ href?: string;
6
+ /** Breadcrumb text shown below the title */
7
+ urlLabel?: string;
8
+ snippet?: string;
9
+ kind?: SearchResultRowKind;
10
+ /** URL or path to a favicon/icon image */
11
+ favicon?: string;
12
+ class?: string;
13
+ /** Optional leading slot (replaces favicon when provided) */
14
+ leading?: Snippet;
15
+ }
16
+ declare const SearchResultRow: import("svelte").Component<SearchResultRowProps, {}, "">;
17
+ type SearchResultRow = ReturnType<typeof SearchResultRow>;
18
+ export default SearchResultRow;
@@ -0,0 +1,85 @@
1
+ <script lang="ts">
2
+ import SearchResultRow from './SearchResultRow.svelte'
3
+ import Avatar from '../../atoms/Avatar/Avatar.svelte'
4
+
5
+ interface Props {
6
+ example?: 'basic' | 'with-favicon' | 'no-href' | 'leading-slot'
7
+ }
8
+
9
+ let { example = 'basic' }: Props = $props()
10
+ </script>
11
+
12
+ <div class="mx-auto w-full max-w-2xl space-y-1 p-4">
13
+ {#if example === 'basic'}
14
+ <p class="mb-3 text-[11px] font-medium uppercase tracking-wide text-muted">Basic SERP rows</p>
15
+ <div class="divide-y divide-border">
16
+ <SearchResultRow
17
+ title="SvelteKit — The fastest way to build Svelte apps"
18
+ href="https://kit.svelte.dev"
19
+ urlLabel="kit.svelte.dev"
20
+ snippet="SvelteKit is the official application framework for Svelte. It provides everything you need to build fast, secure, and reliable web applications."
21
+ />
22
+ <SearchResultRow
23
+ title="Svelte • Cybernetically enhanced web apps"
24
+ href="https://svelte.dev"
25
+ urlLabel="svelte.dev"
26
+ snippet="Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue do the bulk of their work in the browser, Svelte shifts that work into a compile step."
27
+ />
28
+ <SearchResultRow
29
+ title="Vite — Next Generation Frontend Tooling"
30
+ href="https://vitejs.dev"
31
+ urlLabel="vitejs.dev › guide"
32
+ snippet="Vite (French word for 'quick', pronounced /vit/) is a build tool that aims to provide a faster and leaner development experience for modern web projects."
33
+ />
34
+ </div>
35
+ {:else if example === 'with-favicon'}
36
+ <p class="mb-3 text-[11px] font-medium uppercase tracking-wide text-muted">With favicons</p>
37
+ <div class="divide-y divide-border">
38
+ <SearchResultRow
39
+ title="Evoteg — Plataforma de gestión empresarial"
40
+ href="https://evoteg.com"
41
+ urlLabel="evoteg.com"
42
+ snippet="Software CRM, gestión de gimnasios y herramientas de marketing para empresas modernas."
43
+ favicon="https://evoteg.com/favicon.ico"
44
+ />
45
+ <SearchResultRow
46
+ title="EvoFact CRM — Facturación y clientes"
47
+ href="https://crm.evoteg.com"
48
+ urlLabel="crm.evoteg.com › dashboard"
49
+ snippet="Gestiona tus clientes, facturas y oportunidades de negocio desde una única plataforma."
50
+ favicon="https://evoteg.com/favicon.ico"
51
+ />
52
+ </div>
53
+ {:else if example === 'no-href'}
54
+ <p class="mb-3 text-[11px] font-medium uppercase tracking-wide text-muted">No link (static)</p>
55
+ <SearchResultRow
56
+ title="Resultado sin enlace"
57
+ urlLabel="ejemplo.com › ruta"
58
+ snippet="Este resultado no tiene href y muestra el título como span en lugar de enlace."
59
+ />
60
+ {:else}
61
+ <p class="mb-3 text-[11px] font-medium uppercase tracking-wide text-muted">Custom leading slot</p>
62
+ <div class="divide-y divide-border">
63
+ <SearchResultRow
64
+ title="Rafael González"
65
+ href="#"
66
+ urlLabel="linkedin.com › in › rafael-gonzalez"
67
+ snippet="Founder & Developer en R2 Digisolutions. Especializado en plataformas SaaS B2B."
68
+ >
69
+ {#snippet leading()}
70
+ <Avatar name="Rafael González" size="xs" ringed={false} />
71
+ {/snippet}
72
+ </SearchResultRow>
73
+ <SearchResultRow
74
+ title="María López"
75
+ href="#"
76
+ urlLabel="linkedin.com › in › maria-lopez"
77
+ snippet="Product Designer en Evoteg. Diseño de experiencias digitales para productos SaaS."
78
+ >
79
+ {#snippet leading()}
80
+ <Avatar name="María López" size="xs" ringed={false} />
81
+ {/snippet}
82
+ </SearchResultRow>
83
+ </div>
84
+ {/if}
85
+ </div>
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ example?: 'basic' | 'with-favicon' | 'no-href' | 'leading-slot';
3
+ }
4
+ declare const SearchResultRowStory: import("svelte").Component<Props, {}, "">;
5
+ type SearchResultRowStory = ReturnType<typeof SearchResultRowStory>;
6
+ export default SearchResultRowStory;
@@ -17,6 +17,8 @@
17
17
  badgeVariant?: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info';
18
18
  variant?: CardVariant;
19
19
  size?: StatCardSize;
20
+ /** Brand tint (default) or gray icon well */
21
+ iconTone?: 'brand' | 'neutral';
20
22
  class?: string;
21
23
  icon?: Snippet;
22
24
  onclick?: (e: MouseEvent) => void;
@@ -32,6 +34,7 @@
32
34
  badgeVariant = 'primary',
33
35
  variant = 'default',
34
36
  size = 'md',
37
+ iconTone = 'brand',
35
38
  class: className = '',
36
39
  icon,
37
40
  onclick
@@ -110,7 +113,10 @@
110
113
  {#if icon}
111
114
  <div
112
115
  class={[
113
- 'rounded-xl bg-brand-50 text-brand-600 dark:bg-brand-950/60 dark:text-brand-400 flex shrink-0 items-center justify-center',
116
+ 'rounded-xl flex shrink-0 items-center justify-center',
117
+ iconTone === 'neutral'
118
+ ? 'bg-surface-overlay text-secondary'
119
+ : 'bg-brand-50 text-brand-600 dark:bg-brand-950/60 dark:text-brand-400',
114
120
  compact ? 'h-8 w-8' : 'h-10 w-10'
115
121
  ]}
116
122
  >
@@ -12,6 +12,8 @@ interface StatCardProps {
12
12
  badgeVariant?: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info';
13
13
  variant?: CardVariant;
14
14
  size?: StatCardSize;
15
+ /** Brand tint (default) or gray icon well */
16
+ iconTone?: 'brand' | 'neutral';
15
17
  class?: string;
16
18
  icon?: Snippet;
17
19
  onclick?: (e: MouseEvent) => void;
@@ -17,6 +17,12 @@
17
17
  description?: string;
18
18
  side?: DrawerSide;
19
19
  size?: DrawerSize;
20
+ /**
21
+ * `true` (default): `<dialog>.showModal()` — top layer + backdrop + scroll lock.
22
+ * `false`: Popover API `popover="manual"` — top layer above maps, list stays interactive,
23
+ * no light-dismiss (click outside does not close).
24
+ */
25
+ modal?: boolean;
20
26
  closeOnBackdrop?: boolean;
21
27
  closeOnEscape?: boolean;
22
28
  showClose?: boolean;
@@ -34,6 +40,7 @@
34
40
  description,
35
41
  side = 'right',
36
42
  size = 'md',
43
+ modal = true,
37
44
  closeOnBackdrop = true,
38
45
  closeOnEscape = true,
39
46
  showClose = true,
@@ -44,7 +51,7 @@
44
51
  onclose
45
52
  }: DrawerProps = $props();
46
53
 
47
- let dialogEl = $state<HTMLDialogElement | null>(null);
54
+ let shellEl = $state<HTMLElement | null>(null);
48
55
  let motion = $state<DrawerMotion>('idle');
49
56
  let closeFallbackTimer: ReturnType<typeof setTimeout> | null = null;
50
57
  let enterRaf = 0;
@@ -91,17 +98,42 @@
91
98
  bottom: 'w-full max-w-none rounded-none border-x-0 border-b-0'
92
99
  };
93
100
 
101
+ function isShellOpen() {
102
+ if (!shellEl) return false;
103
+ if (modal) return (shellEl as HTMLDialogElement).open;
104
+ return shellEl.matches(':popover-open');
105
+ }
106
+
107
+ function showShell() {
108
+ if (!shellEl) return;
109
+ if (modal) (shellEl as HTMLDialogElement).showModal();
110
+ else shellEl.showPopover();
111
+ }
112
+
113
+ function hideShell() {
114
+ if (!shellEl) return;
115
+ if (modal) {
116
+ const dialog = shellEl as HTMLDialogElement;
117
+ if (dialog.open) dialog.close();
118
+ } else if (shellEl.matches(':popover-open')) {
119
+ shellEl.hidePopover();
120
+ }
121
+ }
122
+
94
123
  $effect(() => {
95
- if (!dialogEl) return;
124
+ if (!shellEl) return;
96
125
 
97
126
  if (open) {
98
127
  clearCloseFallback();
99
128
  cancelEnterRaf();
100
129
 
101
- if (!dialogEl.open) {
102
- // Paint off-screen first, then transition in (avoids skipped enter on <dialog>)
130
+ if (!isShellOpen()) {
103
131
  motion = 'idle';
104
- dialogEl.showModal();
132
+ try {
133
+ showShell();
134
+ } catch {
135
+ /* ignore */
136
+ }
105
137
  enterRaf = requestAnimationFrame(() => {
106
138
  enterRaf = requestAnimationFrame(() => {
107
139
  if (open) motion = 'open';
@@ -113,13 +145,13 @@
113
145
  return;
114
146
  }
115
147
 
116
- if (dialogEl.open && motion !== 'closing') {
148
+ if (isShellOpen() && motion !== 'closing') {
117
149
  startClosing();
118
150
  }
119
151
  });
120
152
 
121
153
  $effect(() => {
122
- const locked = open || motion === 'closing';
154
+ const locked = modal && (open || motion === 'closing');
123
155
  if (!locked || typeof document === 'undefined') return;
124
156
 
125
157
  scrollLockCount += 1;
@@ -155,7 +187,7 @@
155
187
  }
156
188
 
157
189
  function startClosing() {
158
- if (motion === 'closing' || !dialogEl?.open) return;
190
+ if (motion === 'closing' || !isShellOpen()) return;
159
191
  cancelEnterRaf();
160
192
  motion = 'closing';
161
193
  clearCloseFallback();
@@ -166,16 +198,16 @@
166
198
  if (motion !== 'closing') return;
167
199
  clearCloseFallback();
168
200
  motion = 'idle';
169
- if (dialogEl?.open) dialogEl.close();
201
+ hideShell();
170
202
  }
171
203
 
172
204
  function close() {
173
- if (!dialogEl?.open || motion === 'closing' || !open) return;
205
+ if (!isShellOpen() || motion === 'closing' || !open) return;
174
206
  open = false;
175
207
  onclose?.();
176
208
  }
177
209
 
178
- function handleDialogClose() {
210
+ function handleNativeClose() {
179
211
  cancelEnterRaf();
180
212
  clearCloseFallback();
181
213
  motion = 'idle';
@@ -192,10 +224,22 @@
192
224
  }
193
225
 
194
226
  function handleBackdropClick(event: MouseEvent) {
195
- if (!closeOnBackdrop || event.target !== dialogEl) return;
227
+ if (!modal || !closeOnBackdrop || event.target !== shellEl) return;
196
228
  close();
197
229
  }
198
230
 
231
+ function handlePopoverToggle(event: ToggleEvent) {
232
+ if (event.newState === 'closed') handleNativeClose();
233
+ }
234
+
235
+ function handleKeydown(event: KeyboardEvent) {
236
+ if (modal || !closeOnEscape) return;
237
+ if (event.key === 'Escape' && open) {
238
+ event.preventDefault();
239
+ close();
240
+ }
241
+ }
242
+
199
243
  function handlePanelTransitionEnd(event: TransitionEvent) {
200
244
  if (event.target !== event.currentTarget) return;
201
245
  if (event.propertyName !== 'transform') return;
@@ -204,25 +248,52 @@
204
248
  }
205
249
  </script>
206
250
 
207
- <dialog
208
- bind:this={dialogEl}
209
- id={id}
210
- data-side={side}
211
- data-motion={motion}
212
- aria-labelledby={title ? titleId : undefined}
213
- aria-describedby={description ? descriptionId : undefined}
214
- onclose={handleDialogClose}
215
- oncancel={handleCancelEvent}
216
- onclick={handleBackdropClick}
217
- class={[
218
- 'drawer m-0 h-full w-full max-h-none max-w-none overflow-clip border-0 bg-transparent p-0 open:block',
219
- blurBackdrop && 'backdrop:bg-black/40 backdrop:backdrop-blur-sm',
220
- !blurBackdrop && 'backdrop:bg-black/40'
221
- ]}
222
- >
251
+ <svelte:window onkeydown={handleKeydown} />
252
+
253
+ {#if modal}
254
+ <dialog
255
+ bind:this={shellEl}
256
+ {id}
257
+ data-side={side}
258
+ data-motion={motion}
259
+ data-modal="true"
260
+ aria-labelledby={title ? titleId : undefined}
261
+ aria-describedby={description ? descriptionId : undefined}
262
+ onclose={handleNativeClose}
263
+ oncancel={handleCancelEvent}
264
+ onclick={handleBackdropClick}
265
+ class={[
266
+ 'drawer m-0 h-full w-full max-h-none max-w-none overflow-clip border-0 bg-transparent p-0 open:block',
267
+ blurBackdrop && 'backdrop:bg-black/40 backdrop:backdrop-blur-sm',
268
+ !blurBackdrop && 'backdrop:bg-black/40'
269
+ ]}
270
+ >
271
+ {@render panel()}
272
+ </dialog>
273
+ {:else}
274
+ <!-- popover=manual → top layer (above Leaflet) + no light-dismiss -->
275
+ <div
276
+ bind:this={shellEl}
277
+ {id}
278
+ popover="manual"
279
+ role="dialog"
280
+ data-side={side}
281
+ data-motion={motion}
282
+ data-modal="false"
283
+ aria-modal="false"
284
+ aria-labelledby={title ? titleId : undefined}
285
+ aria-describedby={description ? descriptionId : undefined}
286
+ ontoggle={handlePopoverToggle}
287
+ class="drawer drawer-popover pointer-events-none m-0 h-dvh w-screen max-h-none max-w-none overflow-clip border-0 bg-transparent p-0"
288
+ >
289
+ {@render panel()}
290
+ </div>
291
+ {/if}
292
+
293
+ {#snippet panel()}
223
294
  <div
224
295
  class={[
225
- 'drawer-panel flex flex-col border border-border bg-surface-elevated shadow-xl outline-none',
296
+ 'drawer-panel pointer-events-auto flex flex-col border border-border bg-surface-elevated shadow-xl outline-none',
226
297
  sidePanelClasses[side],
227
298
  sizeClasses[side][size],
228
299
  className
@@ -266,19 +337,33 @@
266
337
  </footer>
267
338
  {/if}
268
339
  </div>
269
- </dialog>
340
+ {/snippet}
270
341
 
271
342
  <style>
272
- /*
273
- * Use overflow:clip (not hidden). hidden creates a scroll container, so
274
- * translateX/Y into the positive axis (right/bottom) expands scrollable
275
- * overflow and the panel stays visually on-screen — killing the enter anim.
276
- */
277
343
  .drawer {
278
344
  overflow: clip;
279
345
  overscroll-behavior: contain;
280
346
  }
281
347
 
348
+ /* Popover UA resets — keep full-viewport transparent shell in the top layer */
349
+ .drawer-popover {
350
+ inset: 0;
351
+ margin: 0;
352
+ border: none;
353
+ padding: 0;
354
+ background: transparent;
355
+ color: inherit;
356
+ overflow: clip;
357
+ }
358
+
359
+ .drawer-popover:popover-open {
360
+ inset: 0;
361
+ width: 100vw;
362
+ height: 100dvh;
363
+ max-width: none;
364
+ max-height: none;
365
+ }
366
+
282
367
  .drawer::backdrop {
283
368
  opacity: 0;
284
369
  transition: opacity 0.22s ease;
@@ -303,7 +388,6 @@
303
388
  transition-duration: 0.22s;
304
389
  }
305
390
 
306
- /* Dock + off-screen (idle / closing) */
307
391
  .drawer[data-side='left'] .drawer-panel {
308
392
  inset: 0 auto 0 0;
309
393
  transform: translate3d(-100%, 0, 0);
@@ -321,7 +405,6 @@
321
405
  transform: translate3d(0, 100%, 0);
322
406
  }
323
407
 
324
- /* On-screen */
325
408
  .drawer[data-motion='open'][data-side='left'] .drawer-panel,
326
409
  .drawer[data-motion='open'][data-side='right'] .drawer-panel,
327
410
  .drawer[data-motion='open'][data-side='top'] .drawer-panel,
@@ -8,6 +8,12 @@ interface DrawerProps {
8
8
  description?: string;
9
9
  side?: DrawerSide;
10
10
  size?: DrawerSize;
11
+ /**
12
+ * `true` (default): `<dialog>.showModal()` — top layer + backdrop + scroll lock.
13
+ * `false`: Popover API `popover="manual"` — top layer above maps, list stays interactive,
14
+ * no light-dismiss (click outside does not close).
15
+ */
16
+ modal?: boolean;
11
17
  closeOnBackdrop?: boolean;
12
18
  closeOnEscape?: boolean;
13
19
  showClose?: boolean;
@@ -0,0 +1,12 @@
1
+ import type { StoryObj } from '@storybook/svelte';
2
+ declare const meta: {
3
+ title: string;
4
+ component: import("svelte").Component<Record<string, never>, {}, "">;
5
+ tags: string[];
6
+ parameters: {
7
+ layout: string;
8
+ };
9
+ };
10
+ export default meta;
11
+ type Story = StoryObj<typeof meta>;
12
+ export declare const Default: Story;