dssoca 0.8.2 → 0.10.0

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.
Files changed (65) hide show
  1. package/README.md +39 -13
  2. package/dist/components/Accordion.svelte +22 -6
  3. package/dist/components/Accordion.svelte.d.ts +5 -1
  4. package/dist/components/Avatar.svelte +119 -0
  5. package/dist/components/Avatar.svelte.d.ts +18 -0
  6. package/dist/components/Badge.svelte +3 -5
  7. package/dist/components/BottomNav.svelte +57 -19
  8. package/dist/components/BottomNav.svelte.d.ts +2 -0
  9. package/dist/components/Card.svelte +7 -1
  10. package/dist/components/Chart.svelte +527 -0
  11. package/dist/components/Chart.svelte.d.ts +42 -0
  12. package/dist/components/Container.svelte +55 -0
  13. package/dist/components/Container.svelte.d.ts +16 -0
  14. package/dist/components/DateField.svelte +188 -0
  15. package/dist/components/DateField.svelte.d.ts +37 -0
  16. package/dist/components/EmptyState.svelte +9 -3
  17. package/dist/components/EmptyState.svelte.d.ts +6 -0
  18. package/dist/components/FileDrop.svelte +355 -0
  19. package/dist/components/FileDrop.svelte.d.ts +24 -0
  20. package/dist/components/Heading.svelte +83 -0
  21. package/dist/components/Heading.svelte.d.ts +17 -0
  22. package/dist/components/Icon.svelte +32 -23
  23. package/dist/components/Icon.svelte.d.ts +7 -0
  24. package/dist/components/Image.svelte +19 -21
  25. package/dist/components/Input.svelte +2 -3
  26. package/dist/components/Link.svelte +42 -7
  27. package/dist/components/Link.svelte.d.ts +7 -0
  28. package/dist/components/LogStream.svelte +46 -31
  29. package/dist/components/Menu.svelte +59 -6
  30. package/dist/components/Menu.svelte.d.ts +22 -2
  31. package/dist/components/MetricTile.svelte +4 -4
  32. package/dist/components/Modal.svelte +223 -0
  33. package/dist/components/Modal.svelte.d.ts +29 -0
  34. package/dist/components/NumberField.svelte +260 -0
  35. package/dist/components/NumberField.svelte.d.ts +35 -0
  36. package/dist/components/Pagination.svelte +193 -0
  37. package/dist/components/Pagination.svelte.d.ts +22 -0
  38. package/dist/components/SegmentedControl.svelte +16 -4
  39. package/dist/components/SegmentedControl.svelte.d.ts +7 -0
  40. package/dist/components/Select.svelte +224 -0
  41. package/dist/components/Select.svelte.d.ts +42 -0
  42. package/dist/components/ServiceCard.svelte +15 -15
  43. package/dist/components/Sidebar.svelte +47 -21
  44. package/dist/components/Sparkline.svelte +15 -13
  45. package/dist/components/Spinner.svelte +124 -0
  46. package/dist/components/Spinner.svelte.d.ts +74 -0
  47. package/dist/components/Switch.svelte +144 -0
  48. package/dist/components/Switch.svelte.d.ts +22 -0
  49. package/dist/components/Table.svelte +267 -0
  50. package/dist/components/Table.svelte.d.ts +52 -0
  51. package/dist/components/Textarea.svelte +214 -0
  52. package/dist/components/Textarea.svelte.d.ts +38 -0
  53. package/dist/components/Toaster.svelte +20 -4
  54. package/dist/components/Tooltip.svelte +162 -0
  55. package/dist/components/Tooltip.svelte.d.ts +17 -0
  56. package/dist/components/Topbar.svelte +170 -50
  57. package/dist/components/Topbar.svelte.d.ts +30 -3
  58. package/dist/dssoca.config.d.ts +1 -1
  59. package/dist/dssoca.config.js +15 -0
  60. package/dist/index.d.ts +19 -1
  61. package/dist/index.js +19 -1
  62. package/dist/theme.css +177 -37
  63. package/dist/toast.svelte.js +3 -3
  64. package/dist/tokens.css +597 -0
  65. package/package.json +33 -4
package/README.md CHANGED
@@ -7,10 +7,10 @@
7
7
  A Svelte 5 design system — **signal green on near-black, monospace-forward, zero border-radius**
8
8
  everywhere. Configured along two orthogonal axes:
9
9
 
10
- | Axis | Attribute | Values | Default |
11
- |------------|----------------------|--------------------|---------|
12
- | **Color** | `data-theme` | `dark` · `light` | `dark` |
13
- | **Size** | `data-size-variant` | `sm` · `md` · `lg` | `md` |
10
+ | Axis | Attribute | Values | Default |
11
+ | --------- | ------------------- | ------------------ | ------- |
12
+ | **Color** | `data-theme` | `dark` · `light` | `dark` |
13
+ | **Size** | `data-size-variant` | `sm` · `md` · `lg` | `md` |
14
14
 
15
15
  Each component styles itself in a scoped block and consumes token-driven CSS custom properties;
16
16
  flip an axis on any ancestor (usually `<html>`) and everything below rescales/recolors. Components
@@ -44,15 +44,23 @@ Import the stylesheet once (global tokens + base styles), then use components:
44
44
  </Card>
45
45
  ```
46
46
 
47
+ Apps that own their global styles can import **tokens only** — every `--ss-*`
48
+ custom property (both themes, all size tiers, reduced-motion zeroing) with no
49
+ element styles and no webfont loading:
50
+
51
+ ```js
52
+ import 'dssoca/tokens.css'
53
+ ```
54
+
47
55
  ### Configure the axes from code
48
56
 
49
57
  ```ts
50
58
  import { applyDesignConfig, designAttributes } from 'dssoca'
51
59
 
52
60
  // flip axes; merges over current config; writes to <html>
53
- applyDesignConfig({ sizeVariant: 'sm' }) // global: everything small
54
- applyDesignConfig({ theme: 'light' }) // keeps size
55
- applyDesignConfig({ componentsSize: { Button: 'lg' } }) // per-component default
61
+ applyDesignConfig({ sizeVariant: 'sm' }) // global: everything small
62
+ applyDesignConfig({ theme: 'light' }) // keeps size
63
+ applyDesignConfig({ componentsSize: { Button: 'lg' } }) // per-component default
56
64
  ```
57
65
 
58
66
  Per instance, just set the `size` prop: `<Button size="lg">`.
@@ -69,15 +77,24 @@ SSR / no-flash — spread the attributes directly in markup instead of mutating
69
77
 
70
78
  ## What's in the box
71
79
 
72
- **Components:** `Icon`, `Badge`, `Button`, `Input`, `Card`, `Sparkline`,
73
- `ServiceCard`, `MetricTile`, `Topbar`, `Sidebar`, `LogStream`, `Toaster`, `EmptyState`.
80
+ **Components (23):** `Icon`, `Badge`, `Button`, `Input`, `Textarea`, `Card`, `Sparkline`,
81
+ `ServiceCard`, `MetricTile`, `Topbar`, `Sidebar`, `BottomNav`, `Menu`, `Link`,
82
+ `SegmentedControl`, `Accordion`, `LogStream`, `Toaster`, `EmptyState`, `Image`,
83
+ `Heading`, `Container`, `Spinner`.
74
84
 
75
- **Toasts:** `toast` (`.success` / `.error` / `.info`) + the `toasts` store — render once with
76
- `<Toaster />`.
85
+ **Toasts:** `toast` (`.success` / `.error` / `.info` / `.loading` / `.promise`) + the `toasts`
86
+ store (`update` / `dismiss` / `pause` / `resume` / `clear`, `max` cap) — render once with
87
+ `<Toaster />`. Types: `Toast`, `ToastKind`, `ToastAction`, `ToastOptions`, `ToastPatch`,
88
+ `PromiseMessages`.
77
89
 
78
90
  **Config:** `dssocaConfig` (the manifest), `applyDesignConfig`, `designAttributes`,
79
91
  `getDesignConfig`, `resolveComponentSize`, `defaultDesignConfig`, and the `ColorTheme` / `Size` /
80
- `DesignConfig` / `ComponentsSize` types.
92
+ `DesignConfig` / `ComponentsSize` / `DesignAxis` / `ComponentName` / `DssocaConfig` types.
93
+
94
+ **Component types:** `IconName` (+ `registerIcon`), `TopbarTab`, `TopbarServices`, `SideItem` /
95
+ `SideGroup` / `SideStatus`, `LogLevel` / `LogLine`, `MenuItem`, `AccordionItem`,
96
+ `SegmentOption`, `BottomNavItem`, `ImageSource`, and `SpinnerVariant` / `SpinnerFrames`
97
+ (+ `SPINNER_VARIANTS` / `SPINNER_VARIANT_NAMES`).
81
98
 
82
99
  ## Accessibility
83
100
 
@@ -104,7 +121,16 @@ pnpm docs:dev # docs site (run `pnpm storybook` alongside for the live demo
104
121
  pnpm docs:build # static build of the docs site
105
122
  ```
106
123
 
107
- The docs app is local-only and is **not** part of the published npm package.
124
+ The docs app is **not** part of the published npm package.
125
+
126
+ ### Deployment (maintainers)
127
+
128
+ The docs site and Storybook deploy to **Vercel as two projects** from this one repo; the
129
+ repo-root `vercel.json` branches its `buildCommand` on a `VERCEL_DEPLOY_TARGET=storybook` env
130
+ var. The per-component Storybook embeds on the deployed docs default to
131
+ `http://localhost:6006` — set **`VITE_STORYBOOK_URL`** (Vercel env var on the **docs**
132
+ project) to the deployed Storybook URL and redeploy, or the iframes stay blank. Full setup:
133
+ [`documentation/CLAUDE.md`](./documentation/CLAUDE.md) → _Deployment_.
108
134
 
109
135
  ## Develop
110
136
 
@@ -45,10 +45,18 @@
45
45
  size?: Size
46
46
  /** Heading level wrapping each header button (for the document outline). */
47
47
  headingLevel?: 1 | 2 | 3 | 4 | 5 | 6
48
- /** Base id used to namespace the generated header/panel ids. */
48
+ /**
49
+ * Base id used to namespace the generated header/panel ids. Defaults to a
50
+ * stable per-instance id from `$props.id()` so server- and client-rendered
51
+ * IDs match (SSR-safe, DS-0067).
52
+ */
49
53
  idBase?: string
50
54
  }
51
55
 
56
+ // Stable instance id — consistent between server and client renders, unlike
57
+ // the previous Math.random() default (DS-0067).
58
+ const uid = $props.id()
59
+
52
60
  let {
53
61
  items,
54
62
  panel,
@@ -59,7 +67,7 @@
59
67
  onChange,
60
68
  size,
61
69
  headingLevel = 3,
62
- idBase = `ss-acc-${Math.random().toString(36).slice(2, 8)}`,
70
+ idBase = `ss-acc-${uid}`,
63
71
  }: Props = $props()
64
72
 
65
73
  // --- open-state model ----------------------------------------------------
@@ -116,13 +124,21 @@
116
124
  function onHeaderKeydown(e: KeyboardEvent, index: number) {
117
125
  switch (e.key) {
118
126
  case 'ArrowDown':
119
- e.preventDefault(); focusHeader(index + 1); break
127
+ e.preventDefault()
128
+ focusHeader(index + 1)
129
+ break
120
130
  case 'ArrowUp':
121
- e.preventDefault(); focusHeader(index - 1); break
131
+ e.preventDefault()
132
+ focusHeader(index - 1)
133
+ break
122
134
  case 'Home':
123
- e.preventDefault(); focusHeader(0); break
135
+ e.preventDefault()
136
+ focusHeader(0)
137
+ break
124
138
  case 'End':
125
- e.preventDefault(); focusHeader(items.length - 1); break
139
+ e.preventDefault()
140
+ focusHeader(items.length - 1)
141
+ break
126
142
  // Enter / Space activate the native <button>; no extra handling needed.
127
143
  }
128
144
  }
@@ -39,7 +39,11 @@ interface Props {
39
39
  size?: Size;
40
40
  /** Heading level wrapping each header button (for the document outline). */
41
41
  headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
42
- /** Base id used to namespace the generated header/panel ids. */
42
+ /**
43
+ * Base id used to namespace the generated header/panel ids. Defaults to a
44
+ * stable per-instance id from `$props.id()` so server- and client-rendered
45
+ * IDs match (SSR-safe, DS-0067).
46
+ */
43
47
  idBase?: string;
44
48
  }
45
49
  declare const Accordion: import("svelte").Component<Props, {}, "value">;
@@ -0,0 +1,119 @@
1
+ <script module lang="ts">
2
+ // Deterministic palette for the initials tile background (DS-0099). A given
3
+ // `name` always maps to the same entry via a simple string hash, so the same
4
+ // person reads with a stable colour across the app.
5
+ const PALETTE = [
6
+ 'var(--ss-primary)',
7
+ 'var(--ss-blue)',
8
+ 'var(--ss-purple)',
9
+ 'var(--ss-cyan)',
10
+ 'var(--ss-yellow)',
11
+ 'var(--ss-lime)',
12
+ ]
13
+
14
+ /** Up to two leading initials, uppercased: "Ada Lovelace" → "AL", "Cher" → "C". */
15
+ export function avatarInitials(name: string): string {
16
+ return name
17
+ .trim()
18
+ .split(/\s+/)
19
+ .filter(Boolean)
20
+ .slice(0, 2)
21
+ .map((w) => w[0]!.toUpperCase())
22
+ .join('')
23
+ }
24
+
25
+ /** djb2-ish string hash → palette index. Stable for a given `name`. */
26
+ export function avatarColor(name: string): string {
27
+ let h = 0
28
+ for (let i = 0; i < name.length; i++) h = (h * 31 + name.charCodeAt(i)) | 0
29
+ return PALETTE[Math.abs(h) % PALETTE.length]
30
+ }
31
+ </script>
32
+
33
+ <script lang="ts">
34
+ // ─────────────────────────────────────────────────────────────────────────
35
+ // Avatar (DS-0099). A SQUARE tile (zero radius — house rule) showing either an
36
+ // image or deterministic initials. If `src` is set we render an <img>; on a
37
+ // load error we fall back to the initials tile. The root carries role="img" +
38
+ // aria-label={name} so the name is exposed once; the visual initials are
39
+ // aria-hidden to avoid a doubled accessible name.
40
+ // ─────────────────────────────────────────────────────────────────────────
41
+ import { resolveComponentSize, type Size } from '../config.js'
42
+
43
+ interface Props {
44
+ /** Person/entity name — drives the initials, the deterministic colour, and the accessible name. */
45
+ name: string
46
+ /** Optional image URL; when set, rendered as an <img> that falls back to initials on error. */
47
+ src?: string
48
+ /** Image alt text; defaults to `name`. */
49
+ alt?: string
50
+ /** Token size (sm|md|lg); inherits the global size when unset. Controls the tile box. */
51
+ size?: Size
52
+ }
53
+
54
+ let { name, src, alt, size }: Props = $props()
55
+
56
+ const initials = $derived(avatarInitials(name))
57
+ const bg = $derived(avatarColor(name))
58
+
59
+ // Show the image until/unless it errors, then fall back to the initials tile.
60
+ let failed = $state(false)
61
+ const showImage = $derived(!!src && !failed)
62
+
63
+ function onError() {
64
+ failed = true
65
+ }
66
+ </script>
67
+
68
+ <span
69
+ class="ss-avatar"
70
+ data-size-variant={resolveComponentSize('Avatar', size)}
71
+ role="img"
72
+ aria-label={name}
73
+ style:--ss-avatar-bg={showImage ? undefined : bg}
74
+ >
75
+ {#if showImage}
76
+ <img class="img" {src} alt={alt ?? name} onerror={onError} />
77
+ {:else}
78
+ <span class="initials" aria-hidden="true">{initials}</span>
79
+ {/if}
80
+ </span>
81
+
82
+ <style>.ss-avatar {
83
+ --ss-avatar-size: var(--ss-avatar-size-md, 36px);
84
+ }
85
+ .ss-avatar[data-size-variant=sm] {
86
+ --ss-avatar-size: var(--ss-avatar-size-sm, 28px);
87
+ }
88
+ .ss-avatar[data-size-variant=lg] {
89
+ --ss-avatar-size: var(--ss-avatar-size-lg, 48px);
90
+ }
91
+ .ss-avatar {
92
+ display: inline-flex;
93
+ align-items: center;
94
+ justify-content: center;
95
+ width: var(--ss-avatar-size);
96
+ height: var(--ss-avatar-size);
97
+ flex: 0 0 auto;
98
+ overflow: hidden;
99
+ border-radius: 0;
100
+ background: var(--ss-avatar-bg, var(--ss-bg-elev));
101
+ color: var(--ss-fg-on-primary, var(--ss-bg));
102
+ user-select: none;
103
+ vertical-align: middle;
104
+ }
105
+
106
+ .img {
107
+ display: block;
108
+ width: 100%;
109
+ height: 100%;
110
+ object-fit: cover;
111
+ }
112
+
113
+ .initials {
114
+ font-family: var(--ss-font-mono);
115
+ font-size: var(--ss-avatar-font, calc(var(--ss-avatar-size) * 0.4));
116
+ font-weight: 600;
117
+ line-height: 1;
118
+ letter-spacing: 0.02em;
119
+ }</style>
@@ -0,0 +1,18 @@
1
+ /** Up to two leading initials, uppercased: "Ada Lovelace" → "AL", "Cher" → "C". */
2
+ export declare function avatarInitials(name: string): string;
3
+ /** djb2-ish string hash → palette index. Stable for a given `name`. */
4
+ export declare function avatarColor(name: string): string;
5
+ import { type Size } from '../config.js';
6
+ interface Props {
7
+ /** Person/entity name — drives the initials, the deterministic colour, and the accessible name. */
8
+ name: string;
9
+ /** Optional image URL; when set, rendered as an <img> that falls back to initials on error. */
10
+ src?: string;
11
+ /** Image alt text; defaults to `name`. */
12
+ alt?: string;
13
+ /** Token size (sm|md|lg); inherits the global size when unset. Controls the tile box. */
14
+ size?: Size;
15
+ }
16
+ declare const Avatar: import("svelte").Component<Props, {}, "">;
17
+ type Avatar = ReturnType<typeof Avatar>;
18
+ export default Avatar;
@@ -50,9 +50,7 @@
50
50
 
51
51
  // Numeric badge: clamp to max, hide entirely when zero.
52
52
  const showCount = $derived(count !== undefined && count !== 0)
53
- const countText = $derived(
54
- count === undefined ? '' : count > max ? `${max}+` : `${count}`,
55
- )
53
+ const countText = $derived(count === undefined ? '' : count > max ? `${max}+` : `${count}`)
56
54
 
57
55
  const hasLabel = $derived(children !== undefined)
58
56
  // Dot-only / count-only badges have no visible text → carry an aria-label so
@@ -80,8 +78,8 @@
80
78
  class="x"
81
79
  type="button"
82
80
  aria-label={label ? `Remove ${label}` : 'Remove'}
83
- onclick={ondismiss}
84
- >×</button>
81
+ onclick={ondismiss}>×</button
82
+ >
85
83
  {/if}
86
84
  </span>
87
85
 
@@ -13,6 +13,8 @@
13
13
  href?: string
14
14
  /** Optional count/label rendered as a small square badge on the icon. */
15
15
  badge?: string | number
16
+ /** Renders the tab inert: no navigation/onSelect, `aria-disabled`, out of the tab order. */
17
+ disabled?: boolean
16
18
  }
17
19
  </script>
18
20
 
@@ -34,24 +36,17 @@
34
36
  }
35
37
 
36
38
  const DEFAULT_ITEMS: BottomNavItem[] = [
37
- { id: 'home', label: 'Home', icon: 'grid' },
39
+ { id: 'home', label: 'Home', icon: 'grid' },
38
40
  { id: 'services', label: 'Services', icon: 'database' },
39
41
  { id: 'activity', label: 'Activity', icon: 'activity' },
40
- { id: 'account', label: 'Account', icon: 'user' },
42
+ { id: 'account', label: 'Account', icon: 'user' },
41
43
  ]
42
44
 
43
- let {
44
- items = DEFAULT_ITEMS,
45
- active,
46
- onSelect,
47
- ariaLabel = 'Primary',
48
- size,
49
- }: Props = $props()
45
+ let { items = DEFAULT_ITEMS, active, onSelect, ariaLabel = 'Primary', size }: Props = $props()
50
46
 
51
47
  const isActive = (item: BottomNavItem): boolean => item.id === active
52
48
 
53
- const hasBadge = (item: BottomNavItem): boolean =>
54
- item.badge != null && item.badge !== ''
49
+ const hasBadge = (item: BottomNavItem): boolean => item.badge != null && item.badge !== ''
55
50
 
56
51
  /** Fold the count badge into the accessible name so it isn't lost to AT. */
57
52
  function accessibleName(item: BottomNavItem): string {
@@ -59,6 +54,12 @@
59
54
  }
60
55
 
61
56
  function activate(item: BottomNavItem, e: MouseEvent) {
57
+ // Disabled tabs are inert (DS-0078): no navigation, no onSelect. The
58
+ // <button> branch is natively disabled; this also guards the <a> branch.
59
+ if (item.disabled) {
60
+ e.preventDefault()
61
+ return
62
+ }
62
63
  // Real links navigate natively; intercept only the SPA (no-href) path so a
63
64
  // plain <button> never submits/scrolls. onSelect fires either way.
64
65
  if (!item.href) e.preventDefault()
@@ -73,7 +74,7 @@
73
74
  {#each items as item (item.id)}
74
75
  {@const current = isActive(item)}
75
76
  <li class="row">
76
- {#if item.href}
77
+ {#if item.href && !item.disabled}
77
78
  <a
78
79
  class="tab {current ? 'active' : ''}"
79
80
  href={item.href}
@@ -90,9 +91,15 @@
90
91
  <span class="label">{item.label}</span>
91
92
  </a>
92
93
  {:else}
94
+ <!-- Disabled href tabs also land here (DS-0078): a natively disabled
95
+ <button> is reliably inert + skipped by the tab order, where a
96
+ dead <a> would need tabindex/role juggling. -->
93
97
  <button
94
98
  type="button"
95
99
  class="tab {current ? 'active' : ''}"
100
+ class:disabled={item.disabled}
101
+ disabled={item.disabled || undefined}
102
+ aria-disabled={item.disabled ? 'true' : undefined}
96
103
  aria-current={current ? 'page' : undefined}
97
104
  aria-label={hasBadge(item) ? accessibleName(item) : undefined}
98
105
  onclick={(e) => activate(item, e)}
@@ -117,6 +124,30 @@
117
124
  --_tab-py: var(--ss-bottom-nav-tab-py, var(--ss-s-1, 4px));
118
125
  --_gap: var(--ss-bottom-nav-gap, 4px);
119
126
  --_label-fs: var(--ss-bottom-nav-label-fs, var(--ss-ui-xs, 11px));
127
+ --_badge-top: var(--ss-bottom-nav-badge-top, -6px);
128
+ --_badge-dx: var(--ss-bottom-nav-badge-dx, 6px);
129
+ --_badge-min-w: var(--ss-bottom-nav-badge-min-w, 14px);
130
+ --_badge-h: var(--ss-bottom-nav-badge-h, 14px);
131
+ --_badge-fs: var(--ss-bottom-nav-badge-fs, 9px);
132
+ --_badge-px: var(--ss-bottom-nav-badge-px, 3px);
133
+ }
134
+ .ss-bottom-nav[data-size-variant=sm] {
135
+ --_badge-top: var(--ss-bottom-nav-badge-top, -5px);
136
+ --_badge-dx: var(--ss-bottom-nav-badge-dx, 5px);
137
+ --_badge-min-w: var(--ss-bottom-nav-badge-min-w, 12px);
138
+ --_badge-h: var(--ss-bottom-nav-badge-h, 12px);
139
+ --_badge-fs: var(--ss-bottom-nav-badge-fs, 8px);
140
+ --_badge-px: var(--ss-bottom-nav-badge-px, 2px);
141
+ }
142
+ .ss-bottom-nav[data-size-variant=lg] {
143
+ --_badge-top: var(--ss-bottom-nav-badge-top, -7px);
144
+ --_badge-dx: var(--ss-bottom-nav-badge-dx, 7px);
145
+ --_badge-min-w: var(--ss-bottom-nav-badge-min-w, 16px);
146
+ --_badge-h: var(--ss-bottom-nav-badge-h, 16px);
147
+ --_badge-fs: var(--ss-bottom-nav-badge-fs, 10px);
148
+ --_badge-px: var(--ss-bottom-nav-badge-px, 4px);
149
+ }
150
+ .ss-bottom-nav {
120
151
  position: fixed;
121
152
  left: 0;
122
153
  right: 0;
@@ -174,6 +205,13 @@
174
205
  background: rgba(var(--ss-primary-rgb), 0.06);
175
206
  border-top-color: var(--ss-primary);
176
207
  }
208
+ .ss-bottom-nav .tab:disabled, .ss-bottom-nav .tab.disabled {
209
+ cursor: default;
210
+ opacity: 0.45;
211
+ }
212
+ .ss-bottom-nav .tab:disabled:hover, .ss-bottom-nav .tab.disabled:hover {
213
+ color: var(--ss-fg-faint);
214
+ }
177
215
  .ss-bottom-nav .glyph {
178
216
  position: relative;
179
217
  display: inline-flex;
@@ -183,20 +221,20 @@
183
221
  }
184
222
  .ss-bottom-nav .badge {
185
223
  position: absolute;
186
- top: -6px;
187
- left: calc(50% + 6px);
188
- min-width: 14px;
189
- height: 14px;
190
- padding: 0 3px;
224
+ top: var(--_badge-top);
225
+ left: calc(50% + var(--_badge-dx));
226
+ min-width: var(--_badge-min-w);
227
+ height: var(--_badge-h);
228
+ padding: 0 var(--_badge-px);
191
229
  box-sizing: border-box;
192
230
  display: inline-flex;
193
231
  align-items: center;
194
232
  justify-content: center;
195
233
  font-family: var(--ss-font-mono);
196
- font-size: 9px;
234
+ font-size: var(--_badge-fs);
197
235
  line-height: 1;
198
236
  font-variant-numeric: tabular-nums;
199
- color: var(--ss-fg-on-primary, #001b04);
237
+ color: var(--ss-fg-on-primary);
200
238
  background: var(--ss-primary);
201
239
  border-radius: 0;
202
240
  }
@@ -11,6 +11,8 @@ export interface BottomNavItem {
11
11
  href?: string;
12
12
  /** Optional count/label rendered as a small square badge on the icon. */
13
13
  badge?: string | number;
14
+ /** Renders the tab inert: no navigation/onSelect, `aria-disabled`, out of the tab order. */
15
+ disabled?: boolean;
14
16
  }
15
17
  import { type Size } from '../config.js';
16
18
  interface Props {
@@ -96,7 +96,13 @@
96
96
  <div class="foot">{@render footer()}</div>
97
97
  {/if}
98
98
  {#if href}
99
- <a class="overlay" {href} {onclick} onkeydown={onKeydown} aria-labelledby={title ? titleId : undefined}>
99
+ <a
100
+ class="overlay"
101
+ {href}
102
+ {onclick}
103
+ onkeydown={onKeydown}
104
+ aria-labelledby={title ? titleId : undefined}
105
+ >
100
106
  <span class="sr-only">{typeof title === 'string' ? title : 'Open'}</span>
101
107
  </a>
102
108
  {/if}