@spaethtech/svelte-ui 0.6.0 → 0.6.1-dev.32.fbb6fa6
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,10 +41,11 @@
|
|
|
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
|
-
* so the base line runs through them
|
|
47
|
-
|
|
44
|
+
/** Strip padding, in `rem` (default `0`). A scalar pads both equally; `{ top, sides }` sets them
|
|
45
|
+
* independently. **sides** = leading + trailing bordered spacer cells (before the first tab, after
|
|
46
|
+
* the last) — cells, not CSS padding, so the base line runs through them. **top** = a real
|
|
47
|
+
* `padding-top` on the strip (no line there; there is no bottom pad — the base line lives there). */
|
|
48
|
+
pad?: number | { top?: number; sides?: number };
|
|
48
49
|
onselect?: (index: number) => void;
|
|
49
50
|
right?: Snippet;
|
|
50
51
|
/** Optional aria-label for the strip when it renders as a navigation landmark
|
|
@@ -97,6 +98,11 @@
|
|
|
97
98
|
const svgClass = $derived(responsiveClasses(size, svgMap));
|
|
98
99
|
const gapClass = $derived(responsiveClasses(size, gapMap));
|
|
99
100
|
|
|
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
|
+
|
|
100
106
|
// Mode → label visibility. `expanded` shows the label span inline; `collapsed` hides it. Tabs
|
|
101
107
|
// without an icon show the label regardless (falling back gracefully — nothing disappears).
|
|
102
108
|
// Responsive shape supported: `{ base: 'collapsed', sm: 'expanded' }` collapses on mobile only.
|
|
@@ -341,11 +347,11 @@
|
|
|
341
347
|
aria-orientation={semanticMode === "tablist" ? "horizontal" : undefined}
|
|
342
348
|
aria-label={semanticMode === "navigation" ? ariaLabel : undefined}
|
|
343
349
|
class={`ui-accent flex items-stretch overflow-x-auto list-none m-0 p-0 ${cls}`}
|
|
344
|
-
style={`${accentVar} padding-top:${
|
|
350
|
+
style={`${accentVar} padding-top:${padTop}rem; ${styleProp ?? ""}`}
|
|
345
351
|
{...restProps}
|
|
346
352
|
>
|
|
347
353
|
<!-- Leading pad cell (before the first left tab). -->
|
|
348
|
-
{#if
|
|
354
|
+
{#if padSides > 0 && leftTabs.length > 0}{@render spacer(padSides)}{/if}
|
|
349
355
|
|
|
350
356
|
{#each leftTabs as { t, i }, idx (i)}
|
|
351
357
|
{@render tabItem({ t, i })}
|
|
@@ -354,7 +360,7 @@
|
|
|
354
360
|
{/each}
|
|
355
361
|
|
|
356
362
|
<!-- Trailing pad cell when the left cluster is the last thing (no right tabs). -->
|
|
357
|
-
{#if
|
|
363
|
+
{#if padSides > 0 && leftTabs.length > 0 && rightTabs.length === 0}{@render spacer(padSides)}{/if}
|
|
358
364
|
|
|
359
365
|
<!-- Grow filler (the "+1"): an empty list item that stretches to eat the free space and carry the
|
|
360
366
|
base line across it. It sits BETWEEN the left and right clusters, so it lands last (only left
|
|
@@ -372,7 +378,7 @@
|
|
|
372
378
|
{/if}
|
|
373
379
|
|
|
374
380
|
<!-- Leading pad cell for a right-only strip (no left cluster). -->
|
|
375
|
-
{#if
|
|
381
|
+
{#if padSides > 0 && rightTabs.length > 0 && leftTabs.length === 0}{@render spacer(padSides)}{/if}
|
|
376
382
|
|
|
377
383
|
{#each rightTabs as { t, i }, idx (i)}
|
|
378
384
|
{@render tabItem({ t, i })}
|
|
@@ -380,5 +386,5 @@
|
|
|
380
386
|
{/each}
|
|
381
387
|
|
|
382
388
|
<!-- Trailing pad cell (after the last right tab). -->
|
|
383
|
-
{#if
|
|
389
|
+
{#if padSides > 0 && rightTabs.length > 0}{@render spacer(padSides)}{/if}
|
|
384
390
|
</ul>
|
|
@@ -34,10 +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
|
-
* so the base line runs through them
|
|
40
|
-
|
|
37
|
+
/** Strip padding, in `rem` (default `0`). A scalar pads both equally; `{ top, sides }` sets them
|
|
38
|
+
* independently. **sides** = leading + trailing bordered spacer cells (before the first tab, after
|
|
39
|
+
* the last) — cells, not CSS padding, so the base line runs through them. **top** = a real
|
|
40
|
+
* `padding-top` on the strip (no line there; there is no bottom pad — the base line lives there). */
|
|
41
|
+
pad?: number | {
|
|
42
|
+
top?: number;
|
|
43
|
+
sides?: number;
|
|
44
|
+
};
|
|
41
45
|
onselect?: (index: number) => void;
|
|
42
46
|
right?: Snippet;
|
|
43
47
|
/** Optional aria-label for the strip when it renders as a navigation landmark
|