@shival99/z-ui-svelte 0.1.10 → 0.1.12
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/z-autocomplete/ZAutocomplete.svelte +21 -0
- package/dist/components/z-select/ZSelect.svelte +1631 -1593
- package/dist/components/z-select/z-select.types.d.ts +1 -0
- package/dist/components/z-shimmer-text/ZShimmerText.svelte +70 -70
- package/dist/components/z-toast/ZToastPillText.svelte +77 -77
- package/dist/components/z-tooltip/ZTooltipPanel.svelte +3 -2
- package/dist/components/z-tooltip/z-tooltip.define.d.ts +7 -0
- package/dist/components/z-tooltip/z-tooltip.define.js +5 -0
- package/dist/components/z-tooltip/z-tooltip.svelte.js +23 -3
- package/dist/interactions/index.d.ts +1 -0
- package/dist/interactions/index.js +1 -0
- package/dist/interactions/z-scroll-edges.d.ts +14 -0
- package/dist/interactions/z-scroll-edges.js +43 -0
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import type { ClassValue } from 'clsx';
|
|
5
5
|
import { zTranslate } from '../../i18n/translate.svelte';
|
|
6
6
|
import { zHoverGlide } from '../../interactions/z-hover-glide';
|
|
7
|
+
import { zScrollEdges, type ZScrollEdges } from '../../interactions/z-scroll-edges';
|
|
7
8
|
import {
|
|
8
9
|
Z_ASYNC_OPTIONS_DEFAULT_PAGE_SIZE,
|
|
9
10
|
zMergeAsyncOptions,
|
|
@@ -161,6 +162,8 @@
|
|
|
161
162
|
let inputEl = $state<HTMLInputElement | null>(null);
|
|
162
163
|
let dropdownEl = $state<HTMLDivElement | null>(null);
|
|
163
164
|
let optionsEl = $state<HTMLDivElement | null>(null);
|
|
165
|
+
// Which edges of the option list have more to show: they fade while it is scrolled (see `fades`).
|
|
166
|
+
let listEdges = $state<ZScrollEdges>({ atTop: true, atEnd: true });
|
|
164
167
|
let sentinel = $state<HTMLDivElement | null>(null);
|
|
165
168
|
|
|
166
169
|
let isFocused = $state(false);
|
|
@@ -1078,6 +1081,16 @@
|
|
|
1078
1081
|
</div>
|
|
1079
1082
|
{/snippet}
|
|
1080
1083
|
|
|
1084
|
+
{#snippet fades(edges: ZScrollEdges)}
|
|
1085
|
+
<!-- Soft edges while a list is scrolled: the top once it left the start, the bottom while there is more below. -->
|
|
1086
|
+
{#if !edges.atTop}
|
|
1087
|
+
<div class="pointer-events-none absolute inset-x-0 top-0 h-6 bg-gradient-to-b from-popover to-transparent" aria-hidden="true"></div>
|
|
1088
|
+
{/if}
|
|
1089
|
+
{#if !edges.atTop && !edges.atEnd}
|
|
1090
|
+
<div class="pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-popover to-transparent" aria-hidden="true"></div>
|
|
1091
|
+
{/if}
|
|
1092
|
+
{/snippet}
|
|
1093
|
+
|
|
1081
1094
|
{#snippet loadingMore()}
|
|
1082
1095
|
<div
|
|
1083
1096
|
class="z-autocomplete-loading-more z-autocomplete-loading-enter from-popover via-popover/95 sticky bottom-0 -mx-1 -mb-1 flex items-center justify-center bg-gradient-to-t to-transparent pt-6 pb-2"
|
|
@@ -1221,9 +1234,11 @@
|
|
|
1221
1234
|
{/if}
|
|
1222
1235
|
</div>
|
|
1223
1236
|
{:else if useVirtual}
|
|
1237
|
+
<div class="relative">
|
|
1224
1238
|
<div
|
|
1225
1239
|
bind:this={optionsEl}
|
|
1226
1240
|
{@attach zHoverGlide({ class: 'bg-primary/15 rounded-(--radius-sm)' })}
|
|
1241
|
+
{@attach zScrollEdges(edges => (listEdges = edges))}
|
|
1227
1242
|
class="z-autocomplete-content-state z-autocomplete-options z-autocomplete-virtual-scroll relative overflow-x-hidden overflow-y-auto overscroll-y-contain p-1"
|
|
1228
1243
|
style:height={`${heightExpand}px`}
|
|
1229
1244
|
onscroll={onOptionsScroll}
|
|
@@ -1257,10 +1272,14 @@
|
|
|
1257
1272
|
</div>
|
|
1258
1273
|
{#if isLoadingMore}{@render loadingMore()}{/if}
|
|
1259
1274
|
</div>
|
|
1275
|
+
{@render fades(listEdges)}
|
|
1276
|
+
</div>
|
|
1260
1277
|
{:else}
|
|
1278
|
+
<div class="relative">
|
|
1261
1279
|
<div
|
|
1262
1280
|
bind:this={optionsEl}
|
|
1263
1281
|
{@attach zHoverGlide({ class: 'bg-primary/15 rounded-(--radius-sm)' })}
|
|
1282
|
+
{@attach zScrollEdges(edges => (listEdges = edges))}
|
|
1264
1283
|
class="z-autocomplete-content-state z-autocomplete-options flex flex-col gap-0.75 overflow-x-hidden overflow-y-auto overscroll-y-contain p-1"
|
|
1265
1284
|
style:min-height={`${heightExpand}px`}
|
|
1266
1285
|
style:max-height={`${heightExpand}px`}
|
|
@@ -1286,6 +1305,8 @@
|
|
|
1286
1305
|
{#if canLoadMore}<div bind:this={sentinel} class="h-px w-full shrink-0"></div>{/if}
|
|
1287
1306
|
{#if isLoadingMore}{@render loadingMore()}{/if}
|
|
1288
1307
|
</div>
|
|
1308
|
+
{@render fades(listEdges)}
|
|
1309
|
+
</div>
|
|
1289
1310
|
{/if}
|
|
1290
1311
|
</div>
|
|
1291
1312
|
</ZPopover>
|