@r2digisolutions/components 0.25.0 → 0.25.2
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.
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import Filter from '@lucide/svelte/icons/filter';
|
|
4
4
|
import List from '@lucide/svelte/icons/list';
|
|
5
5
|
import LayoutGrid from '@lucide/svelte/icons/layout-grid';
|
|
6
|
+
import GalleryVertical from '@lucide/svelte/icons/gallery-vertical';
|
|
7
|
+
import CalendarDays from '@lucide/svelte/icons/calendar-days';
|
|
6
8
|
import LayoutList from '@lucide/svelte/icons/layout-list';
|
|
7
9
|
import LocateFixed from '@lucide/svelte/icons/locate-fixed';
|
|
8
10
|
import MapIcon from '@lucide/svelte/icons/map';
|
|
@@ -60,7 +62,7 @@
|
|
|
60
62
|
};
|
|
61
63
|
|
|
62
64
|
export type MapExplorerPanel = 'list' | 'map';
|
|
63
|
-
export type MapExplorerListView = 'list' | 'grid';
|
|
65
|
+
export type MapExplorerListView = 'list' | 'grid' | 'flyer' | 'calendar';
|
|
64
66
|
export type MapExplorerCardContext = {
|
|
65
67
|
select: () => void;
|
|
66
68
|
selected: boolean;
|
|
@@ -92,6 +94,8 @@
|
|
|
92
94
|
detailCtaLabel?: string;
|
|
93
95
|
listViewLabel?: string;
|
|
94
96
|
gridViewLabel?: string;
|
|
97
|
+
flyerViewLabel?: string;
|
|
98
|
+
calendarViewLabel?: string;
|
|
95
99
|
listView?: MapExplorerListView;
|
|
96
100
|
locateOnLoad?: boolean;
|
|
97
101
|
showSearchArea?: boolean;
|
|
@@ -103,6 +107,8 @@
|
|
|
103
107
|
tileAttribution?: string;
|
|
104
108
|
class?: string;
|
|
105
109
|
card?: Snippet<[MapExplorerItem, MapExplorerCardContext]>;
|
|
110
|
+
/** Si se pasa, habilita la vista 'calendar' (ocupa el lugar de lista + mapa). */
|
|
111
|
+
calendar?: Snippet;
|
|
106
112
|
detail?: Snippet<[MapExplorerItem]>;
|
|
107
113
|
emptyAction?: Snippet;
|
|
108
114
|
onsearch?: (query: string) => void;
|
|
@@ -140,6 +146,8 @@
|
|
|
140
146
|
detailCtaLabel = 'View',
|
|
141
147
|
listViewLabel = 'List',
|
|
142
148
|
gridViewLabel = 'Grid',
|
|
149
|
+
flyerViewLabel = 'Flyer',
|
|
150
|
+
calendarViewLabel = 'Calendar',
|
|
143
151
|
listView = $bindable<MapExplorerListView>('list'),
|
|
144
152
|
locateOnLoad = true,
|
|
145
153
|
showSearchArea = true,
|
|
@@ -151,6 +159,7 @@
|
|
|
151
159
|
tileAttribution = '© OpenStreetMap contributors',
|
|
152
160
|
class: className = '',
|
|
153
161
|
card,
|
|
162
|
+
calendar,
|
|
154
163
|
detail,
|
|
155
164
|
emptyAction,
|
|
156
165
|
onsearch,
|
|
@@ -526,6 +535,24 @@
|
|
|
526
535
|
>
|
|
527
536
|
<LayoutGrid class="h-4 w-4" />
|
|
528
537
|
</IconButton>
|
|
538
|
+
<IconButton
|
|
539
|
+
label={flyerViewLabel}
|
|
540
|
+
size="sm"
|
|
541
|
+
variant={listView === 'flyer' ? 'secondary' : 'ghost'}
|
|
542
|
+
onclick={() => (listView = 'flyer')}
|
|
543
|
+
>
|
|
544
|
+
<GalleryVertical class="h-4 w-4" />
|
|
545
|
+
</IconButton>
|
|
546
|
+
{#if calendar}
|
|
547
|
+
<IconButton
|
|
548
|
+
label={calendarViewLabel}
|
|
549
|
+
size="sm"
|
|
550
|
+
variant={listView === 'calendar' ? 'secondary' : 'ghost'}
|
|
551
|
+
onclick={() => (listView = 'calendar')}
|
|
552
|
+
>
|
|
553
|
+
<CalendarDays class="h-4 w-4" />
|
|
554
|
+
</IconButton>
|
|
555
|
+
{/if}
|
|
529
556
|
</div>
|
|
530
557
|
<Button variant="secondary" size="sm" loading={locating} onclick={() => void locate()}>
|
|
531
558
|
<LocateFixed class="h-4 w-4" />
|
|
@@ -553,7 +580,12 @@
|
|
|
553
580
|
</div>
|
|
554
581
|
</div>
|
|
555
582
|
|
|
556
|
-
|
|
583
|
+
{#if calendar && listView === 'calendar'}
|
|
584
|
+
<div class="min-h-0 p-3 flex-1 overflow-y-auto">
|
|
585
|
+
{@render calendar()}
|
|
586
|
+
</div>
|
|
587
|
+
{/if}
|
|
588
|
+
<div class={['min-h-0 relative flex-1', calendar && listView === 'calendar' ? 'hidden' : 'flex']}>
|
|
557
589
|
<aside
|
|
558
590
|
class={[
|
|
559
591
|
'border-border bg-surface min-h-0 lg:flex lg:w-[26rem] xl:w-[32rem] w-full shrink-0 flex-col overflow-hidden border-r',
|
|
@@ -564,7 +596,9 @@
|
|
|
564
596
|
bind:this={listEl}
|
|
565
597
|
class={[
|
|
566
598
|
'min-h-0 p-3 flex-1 overflow-y-auto',
|
|
567
|
-
listView === 'grid'
|
|
599
|
+
listView === 'grid' || listView === 'flyer'
|
|
600
|
+
? 'gap-3 sm:grid-cols-2 grid grid-cols-1 content-start'
|
|
601
|
+
: 'space-y-3'
|
|
568
602
|
]}
|
|
569
603
|
>
|
|
570
604
|
{#if items.length === 0 && !loading}
|
|
@@ -579,8 +613,11 @@
|
|
|
579
613
|
</div>
|
|
580
614
|
{:else}
|
|
581
615
|
{#each items as item (item.id)}
|
|
582
|
-
<div
|
|
583
|
-
{
|
|
616
|
+
<div
|
|
617
|
+
data-map-item={item.id}
|
|
618
|
+
class={listView === 'grid' || listView === 'flyer' ? 'min-w-0' : undefined}
|
|
619
|
+
>
|
|
620
|
+
{#if card && listView !== 'flyer'}
|
|
584
621
|
{@render card(item, {
|
|
585
622
|
select: () => selectItem(item),
|
|
586
623
|
selected: selectedId === item.id,
|
|
@@ -596,7 +633,32 @@
|
|
|
596
633
|
]}
|
|
597
634
|
onclick={() => selectItem(item)}
|
|
598
635
|
>
|
|
599
|
-
{#if listView === '
|
|
636
|
+
{#if listView === 'flyer'}
|
|
637
|
+
<div class="relative aspect-[3/4] w-full overflow-hidden">
|
|
638
|
+
{#if item.imageUrl}
|
|
639
|
+
<Image
|
|
640
|
+
src={item.imageUrl}
|
|
641
|
+
alt={item.title}
|
|
642
|
+
class="inset-0 absolute h-full w-full"
|
|
643
|
+
objectFit="cover"
|
|
644
|
+
/>
|
|
645
|
+
{:else}
|
|
646
|
+
<div
|
|
647
|
+
class="bg-brand-500/10 text-brand-700 dark:text-brand-300 inset-0 text-3xl font-semibold absolute flex items-center justify-center"
|
|
648
|
+
>
|
|
649
|
+
{item.title.slice(0, 1)}
|
|
650
|
+
</div>
|
|
651
|
+
{/if}
|
|
652
|
+
<div
|
|
653
|
+
class="inset-x-0 bottom-0 space-y-0.5 p-3 absolute bg-linear-to-t from-black/80 to-transparent"
|
|
654
|
+
>
|
|
655
|
+
<p class="text-sm font-semibold line-clamp-2 text-white">{item.title}</p>
|
|
656
|
+
{#if item.meta}
|
|
657
|
+
<p class="text-xs text-white/80">{item.meta}</p>
|
|
658
|
+
{/if}
|
|
659
|
+
</div>
|
|
660
|
+
</div>
|
|
661
|
+
{:else if listView === 'grid'}
|
|
600
662
|
{#if item.imageUrl}
|
|
601
663
|
<div class="h-36 w-full overflow-hidden">
|
|
602
664
|
<Image
|
|
@@ -35,7 +35,7 @@ export type MapExplorerFilter = {
|
|
|
35
35
|
searchable?: boolean;
|
|
36
36
|
};
|
|
37
37
|
export type MapExplorerPanel = 'list' | 'map';
|
|
38
|
-
export type MapExplorerListView = 'list' | 'grid';
|
|
38
|
+
export type MapExplorerListView = 'list' | 'grid' | 'flyer' | 'calendar';
|
|
39
39
|
export type MapExplorerCardContext = {
|
|
40
40
|
select: () => void;
|
|
41
41
|
selected: boolean;
|
|
@@ -66,6 +66,8 @@ interface MapExplorerProps {
|
|
|
66
66
|
detailCtaLabel?: string;
|
|
67
67
|
listViewLabel?: string;
|
|
68
68
|
gridViewLabel?: string;
|
|
69
|
+
flyerViewLabel?: string;
|
|
70
|
+
calendarViewLabel?: string;
|
|
69
71
|
listView?: MapExplorerListView;
|
|
70
72
|
locateOnLoad?: boolean;
|
|
71
73
|
showSearchArea?: boolean;
|
|
@@ -77,6 +79,8 @@ interface MapExplorerProps {
|
|
|
77
79
|
tileAttribution?: string;
|
|
78
80
|
class?: string;
|
|
79
81
|
card?: Snippet<[MapExplorerItem, MapExplorerCardContext]>;
|
|
82
|
+
/** Si se pasa, habilita la vista 'calendar' (ocupa el lugar de lista + mapa). */
|
|
83
|
+
calendar?: Snippet;
|
|
80
84
|
detail?: Snippet<[MapExplorerItem]>;
|
|
81
85
|
emptyAction?: Snippet;
|
|
82
86
|
onsearch?: (query: string) => void;
|