@spaethtech/svelte-ui 0.6.1-dev.32.fbb6fa6 → 0.6.1-dev.33.c371f46
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.
|
@@ -41,11 +41,14 @@
|
|
|
41
41
|
* Not CSS `gap` — a real cell, so the base line stays continuous through it. Excludes the grow
|
|
42
42
|
* filler and the leading/trailing cells (those are `pad`). */
|
|
43
43
|
gap?: number;
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
/** Leading + trailing bordered spacer cells (before the first tab, after the last), in `rem`
|
|
45
|
+
* (default `0`). Cells, not CSS padding, so the base line runs through them. For vertical room,
|
|
46
|
+
* set `height` (the tabs bottom-align to the base line). */
|
|
47
|
+
pad?: number;
|
|
48
|
+
/** Total strip height, in `rem` (applied as `min-height`, so it never clips a taller tab). The tab
|
|
49
|
+
* row bottom-aligns to the base line and the extra space breathes ABOVE it. `size` still sets the
|
|
50
|
+
* tab height; `height` sets the whole bar. Unset → the strip hugs the tab row. */
|
|
51
|
+
height?: number;
|
|
49
52
|
onselect?: (index: number) => void;
|
|
50
53
|
right?: Snippet;
|
|
51
54
|
/** Optional aria-label for the strip when it renders as a navigation landmark
|
|
@@ -63,6 +66,7 @@
|
|
|
63
66
|
borderless = false,
|
|
64
67
|
gap = 0,
|
|
65
68
|
pad = 0,
|
|
69
|
+
height,
|
|
66
70
|
onselect,
|
|
67
71
|
right,
|
|
68
72
|
"aria-label": ariaLabel,
|
|
@@ -98,11 +102,6 @@
|
|
|
98
102
|
const svgClass = $derived(responsiveClasses(size, svgMap));
|
|
99
103
|
const gapClass = $derived(responsiveClasses(size, gapMap));
|
|
100
104
|
|
|
101
|
-
// Normalize `pad` (scalar = both; `{ top, sides }` = independent). `sides` → leading/trailing spacer
|
|
102
|
-
// cells; `top` → the strip's padding-top. In rem.
|
|
103
|
-
const padTop = $derived(typeof pad === "number" ? pad : (pad.top ?? 0));
|
|
104
|
-
const padSides = $derived(typeof pad === "number" ? pad : (pad.sides ?? 0));
|
|
105
|
-
|
|
106
105
|
// Mode → label visibility. `expanded` shows the label span inline; `collapsed` hides it. Tabs
|
|
107
106
|
// without an icon show the label regardless (falling back gracefully — nothing disappears).
|
|
108
107
|
// Responsive shape supported: `{ base: 'collapsed', sm: 'expanded' }` collapses on mobile only.
|
|
@@ -346,12 +345,12 @@
|
|
|
346
345
|
role={semanticMode === "tablist" ? "tablist" : "navigation"}
|
|
347
346
|
aria-orientation={semanticMode === "tablist" ? "horizontal" : undefined}
|
|
348
347
|
aria-label={semanticMode === "navigation" ? ariaLabel : undefined}
|
|
349
|
-
class={`ui-accent flex items-
|
|
350
|
-
style={`${accentVar}
|
|
348
|
+
class={`ui-accent flex items-end overflow-x-auto list-none m-0 p-0 ${cls}`}
|
|
349
|
+
style={`${accentVar}${height != null ? ` min-height:${height}rem;` : ""} ${styleProp ?? ""}`}
|
|
351
350
|
{...restProps}
|
|
352
351
|
>
|
|
353
352
|
<!-- Leading pad cell (before the first left tab). -->
|
|
354
|
-
{#if
|
|
353
|
+
{#if pad > 0 && leftTabs.length > 0}{@render spacer(pad)}{/if}
|
|
355
354
|
|
|
356
355
|
{#each leftTabs as { t, i }, idx (i)}
|
|
357
356
|
{@render tabItem({ t, i })}
|
|
@@ -360,7 +359,7 @@
|
|
|
360
359
|
{/each}
|
|
361
360
|
|
|
362
361
|
<!-- Trailing pad cell when the left cluster is the last thing (no right tabs). -->
|
|
363
|
-
{#if
|
|
362
|
+
{#if pad > 0 && leftTabs.length > 0 && rightTabs.length === 0}{@render spacer(pad)}{/if}
|
|
364
363
|
|
|
365
364
|
<!-- Grow filler (the "+1"): an empty list item that stretches to eat the free space and carry the
|
|
366
365
|
base line across it. It sits BETWEEN the left and right clusters, so it lands last (only left
|
|
@@ -378,7 +377,7 @@
|
|
|
378
377
|
{/if}
|
|
379
378
|
|
|
380
379
|
<!-- Leading pad cell for a right-only strip (no left cluster). -->
|
|
381
|
-
{#if
|
|
380
|
+
{#if pad > 0 && rightTabs.length > 0 && leftTabs.length === 0}{@render spacer(pad)}{/if}
|
|
382
381
|
|
|
383
382
|
{#each rightTabs as { t, i }, idx (i)}
|
|
384
383
|
{@render tabItem({ t, i })}
|
|
@@ -386,5 +385,5 @@
|
|
|
386
385
|
{/each}
|
|
387
386
|
|
|
388
387
|
<!-- Trailing pad cell (after the last right tab). -->
|
|
389
|
-
{#if
|
|
388
|
+
{#if pad > 0 && rightTabs.length > 0}{@render spacer(pad)}{/if}
|
|
390
389
|
</ul>
|
|
@@ -34,14 +34,14 @@ interface Props extends Omit<HTMLAttributes<HTMLUListElement>, "onselect"> {
|
|
|
34
34
|
* Not CSS `gap` — a real cell, so the base line stays continuous through it. Excludes the grow
|
|
35
35
|
* filler and the leading/trailing cells (those are `pad`). */
|
|
36
36
|
gap?: number;
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
/** Leading + trailing bordered spacer cells (before the first tab, after the last), in `rem`
|
|
38
|
+
* (default `0`). Cells, not CSS padding, so the base line runs through them. For vertical room,
|
|
39
|
+
* set `height` (the tabs bottom-align to the base line). */
|
|
40
|
+
pad?: number;
|
|
41
|
+
/** Total strip height, in `rem` (applied as `min-height`, so it never clips a taller tab). The tab
|
|
42
|
+
* row bottom-aligns to the base line and the extra space breathes ABOVE it. `size` still sets the
|
|
43
|
+
* tab height; `height` sets the whole bar. Unset → the strip hugs the tab row. */
|
|
44
|
+
height?: number;
|
|
45
45
|
onselect?: (index: number) => void;
|
|
46
46
|
right?: Snippet;
|
|
47
47
|
/** Optional aria-label for the strip when it renders as a navigation landmark
|