@r2digisolutions/components 0.22.2 → 0.23.0
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.
- package/dist/components/atoms/Avatar/Avatar.stories.d.ts +1 -1
- package/dist/components/atoms/Avatar/Avatar.svelte +5 -3
- package/dist/components/atoms/Avatar/Avatar.svelte.d.ts +1 -1
- package/dist/components/atoms/Avatar/AvatarStory.svelte +1 -1
- package/dist/components/atoms/Avatar/AvatarStory.svelte.d.ts +1 -1
- package/dist/components/atoms/Container/Container.stories.d.ts +1 -1
- package/dist/components/atoms/Container/ContainerStory.svelte.d.ts +1 -1
- package/dist/components/molecules/AdSlot/AdSlot.stories.js +10 -0
- package/dist/components/molecules/AdSlot/AdSlot.svelte +16 -0
- package/dist/components/molecules/AdSlot/AdSlot.svelte.d.ts +8 -0
- package/dist/components/molecules/AdSlot/AdSlotStory.svelte +23 -0
- package/dist/components/molecules/AdSlot/AdSlotStory.svelte.d.ts +18 -0
- package/dist/components/molecules/AdUnit/AdUnit.stories.js +28 -0
- package/dist/components/molecules/AdUnit/AdUnit.svelte +151 -0
- package/dist/components/molecules/AdUnit/AdUnit.svelte.d.ts +15 -0
- package/dist/components/molecules/AdUnit/AdUnitStory.svelte +36 -0
- package/dist/components/molecules/AdUnit/AdUnitStory.svelte.d.ts +7 -0
- package/dist/components/molecules/AvatarGroup/AvatarGroup.svelte +1 -1
- package/dist/components/molecules/AvatarGroup/AvatarGroup.svelte.d.ts +1 -1
- package/dist/components/molecules/AvatarLabel/AvatarLabel.svelte +1 -1
- package/dist/components/molecules/AvatarLabel/AvatarLabel.svelte.d.ts +1 -1
- package/dist/components/molecules/Card/Card.svelte +6 -15
- package/dist/components/molecules/FeatureList/FeatureList.svelte +26 -7
- package/dist/components/molecules/FeatureList/FeatureList.svelte.d.ts +2 -0
- package/dist/components/molecules/KnowledgeCard/KnowledgeCard.stories.js +25 -0
- package/dist/components/molecules/KnowledgeCard/KnowledgeCard.svelte +95 -0
- package/dist/components/molecules/KnowledgeCard/KnowledgeCard.svelte.d.ts +15 -0
- package/dist/components/molecules/KnowledgeCard/KnowledgeCardStory.svelte +56 -0
- package/dist/components/molecules/KnowledgeCard/KnowledgeCardStory.svelte.d.ts +6 -0
- package/dist/components/molecules/LocaleSwitcher/LocaleSwitcher.svelte +5 -5
- package/dist/components/molecules/MediaCard/MediaCard.svelte +101 -24
- package/dist/components/molecules/MediaCard/MediaCard.svelte.d.ts +25 -6
- package/dist/components/molecules/MediaCard/MediaCardStory.svelte +34 -1
- package/dist/components/molecules/SearchResultRow/SearchResultRow.stories.js +25 -0
- package/dist/components/molecules/SearchResultRow/SearchResultRow.svelte +74 -0
- package/dist/components/molecules/SearchResultRow/SearchResultRow.svelte.d.ts +18 -0
- package/dist/components/molecules/SearchResultRow/SearchResultRowStory.svelte +85 -0
- package/dist/components/molecules/SearchResultRow/SearchResultRowStory.svelte.d.ts +6 -0
- package/dist/components/molecules/StatCard/StatCard.svelte +7 -1
- package/dist/components/molecules/StatCard/StatCard.svelte.d.ts +2 -0
- package/dist/components/organisms/Drawer/Drawer.svelte +120 -37
- package/dist/components/organisms/Drawer/Drawer.svelte.d.ts +6 -0
- package/dist/components/organisms/MapExplorer/MapExplorer.stories.d.ts +12 -0
- package/dist/components/organisms/MapExplorer/MapExplorer.stories.js +11 -0
- package/dist/components/organisms/MapExplorer/MapExplorer.svelte +928 -0
- package/dist/components/organisms/MapExplorer/MapExplorer.svelte.d.ts +96 -0
- package/dist/components/organisms/MapExplorer/MapExplorerStory.svelte +124 -0
- package/dist/components/organisms/MapExplorer/MapExplorerStory.svelte.d.ts +3 -0
- package/dist/components/organisms/Navbar/Navbar.stories.d.ts +1 -1
- package/dist/components/organisms/Navbar/Navbar.stories.js +1 -1
- package/dist/components/organisms/Navbar/Navbar.svelte +137 -64
- package/dist/components/organisms/Navbar/Navbar.svelte.d.ts +5 -1
- package/dist/components/organisms/Navbar/NavbarStory.svelte +1 -1
- package/dist/components/organisms/Navbar/NavbarStory.svelte.d.ts +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +5 -0
- package/package.json +12 -8
|
@@ -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
|
|
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
|
|
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 (!
|
|
124
|
+
if (!shellEl) return;
|
|
96
125
|
|
|
97
126
|
if (open) {
|
|
98
127
|
clearCloseFallback();
|
|
99
128
|
cancelEnterRaf();
|
|
100
129
|
|
|
101
|
-
if (!
|
|
102
|
-
// Paint off-screen first, then transition in (avoids skipped enter on <dialog>)
|
|
130
|
+
if (!isShellOpen()) {
|
|
103
131
|
motion = 'idle';
|
|
104
|
-
|
|
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 (
|
|
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' || !
|
|
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
|
-
|
|
201
|
+
hideShell();
|
|
170
202
|
}
|
|
171
203
|
|
|
172
204
|
function close() {
|
|
173
|
-
if (!
|
|
205
|
+
if (!isShellOpen() || motion === 'closing' || !open) return;
|
|
174
206
|
open = false;
|
|
175
207
|
onclose?.();
|
|
176
208
|
}
|
|
177
209
|
|
|
178
|
-
function
|
|
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 !==
|
|
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
|
-
<
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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
|
-
|
|
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;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import MapExplorerStory from './MapExplorerStory.svelte';
|
|
2
|
+
const meta = {
|
|
3
|
+
title: 'Organisms/MapExplorer',
|
|
4
|
+
component: MapExplorerStory,
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'fullscreen'
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
export const Default = {};
|