@shival99/z-ui-svelte 0.1.12 → 0.1.13
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.
|
@@ -1084,10 +1084,16 @@
|
|
|
1084
1084
|
{#snippet fades(edges: ZScrollEdges)}
|
|
1085
1085
|
<!-- Soft edges while a list is scrolled: the top once it left the start, the bottom while there is more below. -->
|
|
1086
1086
|
{#if !edges.atTop}
|
|
1087
|
-
<div
|
|
1087
|
+
<div
|
|
1088
|
+
class="from-popover pointer-events-none absolute inset-x-0 top-0 h-6 bg-gradient-to-b to-transparent"
|
|
1089
|
+
aria-hidden="true"
|
|
1090
|
+
></div>
|
|
1088
1091
|
{/if}
|
|
1089
1092
|
{#if !edges.atTop && !edges.atEnd}
|
|
1090
|
-
<div
|
|
1093
|
+
<div
|
|
1094
|
+
class="from-popover pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t to-transparent"
|
|
1095
|
+
aria-hidden="true"
|
|
1096
|
+
></div>
|
|
1091
1097
|
{/if}
|
|
1092
1098
|
{/snippet}
|
|
1093
1099
|
|
|
@@ -1235,77 +1241,77 @@
|
|
|
1235
1241
|
</div>
|
|
1236
1242
|
{:else if useVirtual}
|
|
1237
1243
|
<div class="relative">
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1244
|
+
<div
|
|
1245
|
+
bind:this={optionsEl}
|
|
1246
|
+
{@attach zHoverGlide({ class: 'bg-primary/15 rounded-(--radius-sm)' })}
|
|
1247
|
+
{@attach zScrollEdges(edges => (listEdges = edges))}
|
|
1248
|
+
class="z-autocomplete-content-state z-autocomplete-options z-autocomplete-virtual-scroll relative overflow-x-hidden overflow-y-auto overscroll-y-contain p-1"
|
|
1249
|
+
style:height={`${heightExpand}px`}
|
|
1250
|
+
onscroll={onOptionsScroll}
|
|
1251
|
+
>
|
|
1252
|
+
<div class="z-autocomplete-virtual-inner relative" style:height={`${$virtualizer.getTotalSize()}px`}>
|
|
1253
|
+
{#each $virtualizer.getVirtualItems() as item (item.key)}
|
|
1254
|
+
{@const option = filteredOptions[item.index]}
|
|
1255
|
+
{#if option}
|
|
1256
|
+
<!-- svelte-ignore a11y_click_events_have_key_events (keyboard is handled by the input) -->
|
|
1257
|
+
<div
|
|
1258
|
+
data-glide-item
|
|
1259
|
+
data-index={item.index}
|
|
1260
|
+
role="option"
|
|
1261
|
+
tabindex="-1"
|
|
1262
|
+
aria-selected={activeIndex === item.index}
|
|
1263
|
+
aria-disabled={option.disabled || undefined}
|
|
1264
|
+
class={['z-autocomplete-option absolute right-0 left-0 min-w-0', optionClass(option, item.index)]}
|
|
1265
|
+
style:display={hasTemplate ? 'block' : null}
|
|
1266
|
+
style:height={zDynamicSize ? null : `${optionHeight}px`}
|
|
1267
|
+
style:min-height={zDynamicSize ? `${optionHeight}px` : null}
|
|
1268
|
+
style:overflow={hasTemplate ? 'visible' : null}
|
|
1269
|
+
style:transform={`translateY(${item.start}px) translateZ(0)`}
|
|
1270
|
+
onmouseenter={() => (activeIndex = item.index)}
|
|
1271
|
+
onclick={() => selectOption(option)}
|
|
1272
|
+
{@attach zDynamicSize ? (node: HTMLDivElement) => $virtualizer.measureElement(node) : null}
|
|
1273
|
+
>
|
|
1274
|
+
{@render optionBody(option, item.index)}
|
|
1275
|
+
</div>
|
|
1276
|
+
{/if}
|
|
1277
|
+
{/each}
|
|
1278
|
+
</div>
|
|
1279
|
+
{#if isLoadingMore}{@render loadingMore()}{/if}
|
|
1272
1280
|
</div>
|
|
1273
|
-
{
|
|
1274
|
-
</div>
|
|
1275
|
-
{@render fades(listEdges)}
|
|
1281
|
+
{@render fades(listEdges)}
|
|
1276
1282
|
</div>
|
|
1277
1283
|
{:else}
|
|
1278
1284
|
<div class="relative">
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1285
|
+
<div
|
|
1286
|
+
bind:this={optionsEl}
|
|
1287
|
+
{@attach zHoverGlide({ class: 'bg-primary/15 rounded-(--radius-sm)' })}
|
|
1288
|
+
{@attach zScrollEdges(edges => (listEdges = edges))}
|
|
1289
|
+
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"
|
|
1290
|
+
style:min-height={`${heightExpand}px`}
|
|
1291
|
+
style:max-height={`${heightExpand}px`}
|
|
1292
|
+
>
|
|
1293
|
+
{#each filteredOptions as option, index (trackKey(option, index))}
|
|
1294
|
+
<!-- svelte-ignore a11y_click_events_have_key_events (keyboard is handled by the input) -->
|
|
1295
|
+
<div
|
|
1296
|
+
data-glide-item
|
|
1297
|
+
role="option"
|
|
1298
|
+
tabindex="-1"
|
|
1299
|
+
aria-selected={activeIndex === index}
|
|
1300
|
+
aria-disabled={option.disabled || undefined}
|
|
1301
|
+
class={['z-autocomplete-option relative min-w-0', optionClass(option, index)]}
|
|
1302
|
+
style:display={hasTemplate ? 'block' : null}
|
|
1303
|
+
style:min-height={hasTemplate ? null : `${optionHeight}px`}
|
|
1304
|
+
style:overflow={hasTemplate ? 'visible' : null}
|
|
1305
|
+
onmouseenter={() => (activeIndex = index)}
|
|
1306
|
+
onclick={() => selectOption(option)}
|
|
1307
|
+
>
|
|
1308
|
+
{@render optionBody(option, index)}
|
|
1309
|
+
</div>
|
|
1310
|
+
{/each}
|
|
1311
|
+
{#if canLoadMore}<div bind:this={sentinel} class="h-px w-full shrink-0"></div>{/if}
|
|
1312
|
+
{#if isLoadingMore}{@render loadingMore()}{/if}
|
|
1313
|
+
</div>
|
|
1314
|
+
{@render fades(listEdges)}
|
|
1309
1315
|
</div>
|
|
1310
1316
|
{/if}
|
|
1311
1317
|
</div>
|