dssoca 0.11.0 → 0.13.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 (49) hide show
  1. package/dist/components/Accordion.svelte +35 -15
  2. package/dist/components/Accordion.svelte.d.ts +7 -0
  3. package/dist/components/Avatar.svelte +5 -9
  4. package/dist/components/Badge.svelte +27 -53
  5. package/dist/components/Badge.svelte.d.ts +2 -5
  6. package/dist/components/BottomNav.svelte +2 -2
  7. package/dist/components/BoxPlot.svelte +2 -8
  8. package/dist/components/BumpChart.svelte +2 -8
  9. package/dist/components/Button.svelte +50 -34
  10. package/dist/components/Button.svelte.d.ts +8 -2
  11. package/dist/components/Chart.svelte +2 -8
  12. package/dist/components/DateField.svelte +1 -1
  13. package/dist/components/FileDrop.svelte +1 -1
  14. package/dist/components/Icon.svelte +29 -7
  15. package/dist/components/Icon.svelte.d.ts +14 -2
  16. package/dist/components/Input.svelte +1 -1
  17. package/dist/components/Kbd.svelte +120 -0
  18. package/dist/components/Kbd.svelte.d.ts +30 -0
  19. package/dist/components/LogStream.svelte +3 -3
  20. package/dist/components/Menu.svelte +1 -1
  21. package/dist/components/NumberField.svelte +1 -1
  22. package/dist/components/ScatterPlot.svelte +2 -8
  23. package/dist/components/SearchPalette.svelte +526 -0
  24. package/dist/components/SearchPalette.svelte.d.ts +82 -0
  25. package/dist/components/Select.svelte +1 -1
  26. package/dist/components/ServiceCard.svelte +13 -2
  27. package/dist/components/ShortcutsHelp.svelte +365 -0
  28. package/dist/components/ShortcutsHelp.svelte.d.ts +34 -0
  29. package/dist/components/Sidebar.svelte +1 -1
  30. package/dist/components/Spinner.svelte +26 -19
  31. package/dist/components/Spinner.svelte.d.ts +14 -4
  32. package/dist/components/Switch.svelte +32 -2
  33. package/dist/components/Switch.svelte.d.ts +5 -0
  34. package/dist/components/Textarea.svelte +1 -1
  35. package/dist/components/Topbar.svelte +41 -26
  36. package/dist/components/Topbar.svelte.d.ts +5 -2
  37. package/dist/config.d.ts +44 -3
  38. package/dist/config.js +52 -3
  39. package/dist/dssoca.config.d.ts +39 -2
  40. package/dist/dssoca.config.js +49 -0
  41. package/dist/index.d.ts +10 -5
  42. package/dist/index.js +11 -4
  43. package/dist/palette.d.ts +10 -0
  44. package/dist/palette.js +17 -0
  45. package/dist/shortcuts.svelte.d.ts +192 -0
  46. package/dist/shortcuts.svelte.js +633 -0
  47. package/dist/theme.css +158 -158
  48. package/dist/tokens.css +158 -158
  49. package/package.json +4 -3
@@ -18,6 +18,7 @@
18
18
  <script lang="ts">
19
19
  import { untrack, type Snippet } from 'svelte'
20
20
  import { resolveComponentSize, type Size } from '../config.js'
21
+ import Icon from './Icon.svelte'
21
22
 
22
23
  interface Props {
23
24
  /** The collapsible sections, top to bottom. */
@@ -43,6 +44,13 @@
43
44
  onChange?: (value: AccordionValue) => void
44
45
  /** Token size (sm|md|lg); inherits the global size when unset. */
45
46
  size?: Size
47
+ /**
48
+ * How a long header label behaves when it exceeds the available width.
49
+ * `wrap` (default) lets the label flow onto multiple lines; `truncate`
50
+ * keeps it on a single line with an ellipsis. Applies to the default
51
+ * header markup only — a custom `header` snippet owns its own overflow.
52
+ */
53
+ overflow?: 'truncate' | 'wrap'
46
54
  /** Heading level wrapping each header button (for the document outline). */
47
55
  headingLevel?: 1 | 2 | 3 | 4 | 5 | 6
48
56
  /**
@@ -66,6 +74,7 @@
66
74
  defaultValue,
67
75
  onChange,
68
76
  size,
77
+ overflow = 'wrap',
69
78
  headingLevel = 3,
70
79
  idBase = `ss-acc-${uid}`,
71
80
  }: Props = $props()
@@ -145,9 +154,15 @@
145
154
 
146
155
  const headerId = (item: AccordionItem) => `${idBase}-h-${item.id}`
147
156
  const panelId = (item: AccordionItem) => `${idBase}-p-${item.id}`
157
+
158
+ // DS-0111: resolve size ONCE at the root, then hand it explicitly to the
159
+ // nested chevron Icon so a sm/md/lg Accordion gets a matching chevron rather
160
+ // than relying on the cascade. `undefined` → Icon inherits the active
161
+ // --ss-icon token (still coordinated, since the root carries no override).
162
+ const resolvedSize = $derived(resolveComponentSize('Accordion', size))
148
163
  </script>
149
164
 
150
- <div class="ss-accordion" data-size-variant={resolveComponentSize('Accordion', size)}>
165
+ <div class="ss-accordion" data-size-variant={resolvedSize} data-overflow={overflow}>
151
166
  {#each items as item, i (item.id)}
152
167
  {@const expanded = isOpen(item)}
153
168
  <div class="item" class:open={expanded} class:disabled={item.disabled}>
@@ -169,7 +184,9 @@
169
184
  <span class="title">{item.label}</span>
170
185
  {#if item.hint}<span class="hint">{item.hint}</span>{/if}
171
186
  {/if}
172
- <span class="chevron" aria-hidden="true"></span>
187
+ <span class="chevron" aria-hidden="true">
188
+ <Icon name="chevron" size={resolvedSize} />
189
+ </span>
173
190
  </button>
174
191
  </div>
175
192
  <div
@@ -179,8 +196,10 @@
179
196
  aria-labelledby={headerId(item)}
180
197
  hidden={!expanded}
181
198
  >
182
- <div class="panel-inner">
183
- {@render panel(item)}
199
+ <div class="panel-clip">
200
+ <div class="panel-inner">
201
+ {@render panel(item)}
202
+ </div>
184
203
  </div>
185
204
  </div>
186
205
  </div>
@@ -192,7 +211,6 @@
192
211
  --ss-acc-head-px: var(--ss-row-px);
193
212
  --ss-acc-body-py: var(--ss-s-3);
194
213
  --ss-acc-body-px: var(--ss-row-px);
195
- --ss-acc-chevron: 9px;
196
214
  --ss-acc-gap: var(--ss-s-3);
197
215
  }
198
216
  .ss-accordion[data-size-variant=sm] {
@@ -200,7 +218,6 @@
200
218
  --ss-acc-head-px: var(--ss-s-2);
201
219
  --ss-acc-body-py: var(--ss-s-2);
202
220
  --ss-acc-body-px: var(--ss-s-2);
203
- --ss-acc-chevron: 7px;
204
221
  --ss-acc-gap: var(--ss-s-2);
205
222
  }
206
223
  .ss-accordion[data-size-variant=lg] {
@@ -208,7 +225,6 @@
208
225
  --ss-acc-head-px: var(--ss-s-4);
209
226
  --ss-acc-body-py: var(--ss-s-4);
210
227
  --ss-acc-body-px: var(--ss-s-4);
211
- --ss-acc-chevron: 11px;
212
228
  --ss-acc-gap: var(--ss-s-4);
213
229
  }
214
230
  .ss-accordion {
@@ -261,17 +277,21 @@
261
277
  }
262
278
  .ss-accordion .head .chevron {
263
279
  flex: 0 0 auto;
264
- width: var(--ss-acc-chevron);
265
- height: var(--ss-acc-chevron);
266
- border-right: 1.5px solid currentColor;
267
- border-bottom: 1.5px solid currentColor;
268
- transform: rotate(45deg);
280
+ display: inline-flex;
281
+ align-items: center;
282
+ justify-content: center;
283
+ transform: rotate(0deg);
269
284
  transform-origin: center;
270
285
  transition: transform var(--ss-dur) var(--ss-ease);
271
286
  color: var(--ss-fg-muted);
272
287
  }
288
+ .ss-accordion[data-overflow=truncate] .head .title {
289
+ white-space: nowrap;
290
+ overflow: hidden;
291
+ text-overflow: ellipsis;
292
+ }
273
293
  .ss-accordion .item.open .head .chevron {
274
- transform: rotate(225deg);
294
+ transform: rotate(180deg);
275
295
  }
276
296
  .ss-accordion .panel {
277
297
  display: grid;
@@ -285,11 +305,11 @@
285
305
  .ss-accordion .panel:not([hidden]) {
286
306
  grid-template-rows: 1fr;
287
307
  }
288
- .ss-accordion .panel-inner {
308
+ .ss-accordion .panel-clip {
289
309
  overflow: hidden;
290
310
  min-height: 0;
291
311
  }
292
- .ss-accordion .panel:not([hidden]) .panel-inner {
312
+ .ss-accordion .panel-inner {
293
313
  padding: var(--ss-acc-body-py) var(--ss-acc-body-px);
294
314
  color: var(--ss-fg-muted);
295
315
  font-size: var(--ss-ui-md);
@@ -37,6 +37,13 @@ interface Props {
37
37
  onChange?: (value: AccordionValue) => void;
38
38
  /** Token size (sm|md|lg); inherits the global size when unset. */
39
39
  size?: Size;
40
+ /**
41
+ * How a long header label behaves when it exceeds the available width.
42
+ * `wrap` (default) lets the label flow onto multiple lines; `truncate`
43
+ * keeps it on a single line with an ellipsis. Applies to the default
44
+ * header markup only — a custom `header` snippet owns its own overflow.
45
+ */
46
+ overflow?: 'truncate' | 'wrap';
40
47
  /** Heading level wrapping each header button (for the document outline). */
41
48
  headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
42
49
  /**
@@ -1,15 +1,11 @@
1
1
  <script module lang="ts">
2
+ import { CHART_PALETTE } from '../palette.js'
3
+
2
4
  // Deterministic palette for the initials tile background (DS-0099). A given
3
5
  // `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
- ]
6
+ // person reads with a stable colour across the app — CHART_PALETTE's order
7
+ // and length are stable API for exactly this reason.
8
+ const PALETTE = CHART_PALETTE
13
9
 
14
10
  /** Up to two leading initials, uppercased: "Ada Lovelace" → "AL", "Cher" → "C". */
15
11
  export function avatarInitials(name: string): string {
@@ -2,7 +2,7 @@
2
2
  import type { Snippet } from 'svelte'
3
3
  import { resolveComponentSize, type Size } from '../config.js'
4
4
 
5
- type Tone = 'up' | 'deg' | 'down' | 'maint' | 'info' | 'neutral'
5
+ type Tone = 'brand' | 'neutral' | 'positive' | 'caution' | 'critical' | 'info'
6
6
 
7
7
  interface Props {
8
8
  /** Semantic tone; `neutral` is the safe baseline for non-status labels. */
@@ -26,25 +26,21 @@
26
26
  live?: boolean
27
27
  /**
28
28
  * Accessible label. Required for dot-only / label-less badges so the
29
- * status isn't conveyed by colour alone (WCAG 1.4.1). Also names the
30
- * dismiss button's target.
29
+ * status isn't conveyed by colour alone (WCAG 1.4.1).
31
30
  */
32
31
  label?: string
33
- /** When provided, renders a trailing, keyboard-focusable dismiss button. */
34
- ondismiss?: () => void
35
32
  /** Badge text. Optional: omit for a dot-only or count-only badge. */
36
33
  children?: Snippet
37
34
  }
38
35
 
39
36
  let {
40
- tone = 'info',
37
+ tone = 'neutral',
41
38
  size,
42
39
  dot = false,
43
40
  count,
44
41
  max = 99,
45
42
  live = false,
46
43
  label,
47
- ondismiss,
48
44
  children,
49
45
  }: Props = $props()
50
46
 
@@ -73,20 +69,13 @@
73
69
  {#if dot}<span class="dot" aria-hidden="true"></span>{/if}
74
70
  {#if hasLabel}{@render children?.()}{/if}
75
71
  {#if showCount}<span class="count">{countText}</span>{/if}
76
- {#if ondismiss}
77
- <button
78
- class="x"
79
- type="button"
80
- aria-label={label ? `Remove ${label}` : 'Remove'}
81
- onclick={ondismiss}>×</button
82
- >
83
- {/if}
84
72
  </span>
85
73
 
86
74
  <style>.ss-badge {
87
75
  font-family: var(--ss-font-mono);
88
76
  font-size: var(--ss-ui-xs);
89
- padding: var(--ss-badge-py) var(--ss-badge-px);
77
+ padding: 0 var(--ss-badge-px);
78
+ line-height: 1.6;
90
79
  letter-spacing: 0.05em;
91
80
  display: inline-flex;
92
81
  align-items: center;
@@ -94,36 +83,36 @@
94
83
  text-transform: lowercase;
95
84
  border: 1px solid var(--ss-line);
96
85
  }
97
- .ss-badge.up {
98
- background: var(--ss-badge-up-bg);
99
- color: var(--ss-primary);
100
- border-color: var(--ss-badge-up-border);
86
+ .ss-badge.brand {
87
+ background: var(--ss-badge-brand-bg);
88
+ color: var(--ss-badge-brand-fg);
89
+ border-color: var(--ss-badge-brand-border);
101
90
  }
102
- .ss-badge.deg {
103
- background: var(--ss-badge-deg-bg);
104
- color: var(--ss-yellow);
105
- border-color: var(--ss-badge-deg-border);
91
+ .ss-badge.neutral {
92
+ background: var(--ss-badge-neutral-bg);
93
+ color: var(--ss-badge-neutral-fg);
94
+ border-color: var(--ss-badge-neutral-border);
106
95
  }
107
- .ss-badge.down {
108
- background: var(--ss-badge-down-bg);
109
- color: var(--ss-red);
110
- border-color: var(--ss-badge-down-border);
96
+ .ss-badge.positive {
97
+ background: var(--ss-badge-positive-bg);
98
+ color: var(--ss-badge-positive-fg);
99
+ border-color: var(--ss-badge-positive-border);
111
100
  }
112
- .ss-badge.maint {
113
- background: var(--ss-badge-maint-bg);
114
- color: var(--ss-blue);
115
- border-color: var(--ss-badge-maint-border);
101
+ .ss-badge.caution {
102
+ background: var(--ss-badge-caution-bg);
103
+ color: var(--ss-badge-caution-fg);
104
+ border-color: var(--ss-badge-caution-border);
105
+ }
106
+ .ss-badge.critical {
107
+ background: var(--ss-badge-critical-bg);
108
+ color: var(--ss-badge-critical-fg);
109
+ border-color: var(--ss-badge-critical-border);
116
110
  }
117
111
  .ss-badge.info {
118
112
  background: var(--ss-badge-info-bg);
119
- color: var(--ss-cyan);
113
+ color: var(--ss-badge-info-fg);
120
114
  border-color: var(--ss-badge-info-border);
121
115
  }
122
- .ss-badge.neutral {
123
- background: var(--ss-badge-neutral-bg);
124
- color: var(--ss-fg-muted);
125
- border-color: var(--ss-badge-neutral-border);
126
- }
127
116
  .ss-badge .dot {
128
117
  width: var(--ss-badge-dot);
129
118
  height: var(--ss-badge-dot);
@@ -133,19 +122,4 @@
133
122
  .ss-badge .count {
134
123
  text-transform: none;
135
124
  font-variant-numeric: tabular-nums;
136
- }
137
- .ss-badge .x {
138
- flex: none;
139
- background: none;
140
- border: none;
141
- color: currentColor;
142
- cursor: pointer;
143
- font-size: var(--ss-size-sm);
144
- line-height: 1;
145
- padding: 0;
146
- margin-inline-start: calc(var(--ss-badge-gap) * -0.25);
147
- opacity: 0.8;
148
- }
149
- .ss-badge .x:hover, .ss-badge .x:focus-visible {
150
- opacity: 1;
151
125
  }</style>
@@ -1,6 +1,6 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import { type Size } from '../config.js';
3
- type Tone = 'up' | 'deg' | 'down' | 'maint' | 'info' | 'neutral';
3
+ type Tone = 'brand' | 'neutral' | 'positive' | 'caution' | 'critical' | 'info';
4
4
  interface Props {
5
5
  /** Semantic tone; `neutral` is the safe baseline for non-status labels. */
6
6
  tone?: Tone;
@@ -23,12 +23,9 @@ interface Props {
23
23
  live?: boolean;
24
24
  /**
25
25
  * Accessible label. Required for dot-only / label-less badges so the
26
- * status isn't conveyed by colour alone (WCAG 1.4.1). Also names the
27
- * dismiss button's target.
26
+ * status isn't conveyed by colour alone (WCAG 1.4.1).
28
27
  */
29
28
  label?: string;
30
- /** When provided, renders a trailing, keyboard-focusable dismiss button. */
31
- ondismiss?: () => void;
32
29
  /** Badge text. Optional: omit for a dot-only or count-only badge. */
33
30
  children?: Snippet;
34
31
  }
@@ -158,7 +158,7 @@
158
158
  background: color-mix(in srgb, var(--ss-bg) 88%, transparent);
159
159
  backdrop-filter: blur(14px);
160
160
  -webkit-backdrop-filter: blur(14px);
161
- border-top: 1px solid var(--ss-line);
161
+ box-shadow: 0 -1px 0 var(--ss-line);
162
162
  font-family: var(--ss-font-mono);
163
163
  }
164
164
  .ss-bottom-nav .list {
@@ -202,7 +202,7 @@
202
202
  }
203
203
  .ss-bottom-nav .tab.active {
204
204
  color: var(--ss-primary);
205
- background: rgba(var(--ss-primary-rgb), 0.06);
205
+ background: color-mix(in srgb, var(--ss-accent) 6%, transparent);
206
206
  border-top-color: var(--ss-primary);
207
207
  }
208
208
  .ss-bottom-nav .tab:disabled, .ss-bottom-nav .tab.disabled {
@@ -10,6 +10,7 @@
10
10
  </script>
11
11
 
12
12
  <script lang="ts">
13
+ import { CHART_PALETTE } from '../palette.js'
13
14
  import { scaleBand, scaleLinear } from 'd3-scale'
14
15
  import { extent, quantile } from 'd3-array'
15
16
  import { resolveComponentSize, type Size } from '../config.js'
@@ -53,14 +54,7 @@
53
54
  size,
54
55
  }: Props = $props()
55
56
 
56
- const PALETTE = [
57
- 'var(--ss-primary)',
58
- 'var(--ss-blue)',
59
- 'var(--ss-purple)',
60
- 'var(--ss-cyan)',
61
- 'var(--ss-yellow)',
62
- 'var(--ss-lime)',
63
- ]
57
+ const PALETTE = CHART_PALETTE
64
58
 
65
59
  const M = { top: 12, right: 16, bottom: 36, left: 48 }
66
60
 
@@ -10,6 +10,7 @@
10
10
  </script>
11
11
 
12
12
  <script lang="ts">
13
+ import { CHART_PALETTE } from '../palette.js'
13
14
  import { scalePoint, scaleLinear } from 'd3-scale'
14
15
  import { line as shapeLine } from 'd3-shape'
15
16
  import { max } from 'd3-array'
@@ -48,14 +49,7 @@
48
49
  size,
49
50
  }: Props = $props()
50
51
 
51
- const PALETTE = [
52
- 'var(--ss-primary)',
53
- 'var(--ss-blue)',
54
- 'var(--ss-purple)',
55
- 'var(--ss-cyan)',
56
- 'var(--ss-yellow)',
57
- 'var(--ss-lime)',
58
- ]
52
+ const PALETTE = CHART_PALETTE
59
53
 
60
54
  const M = { top: 12, right: 56, bottom: 28, left: 32 }
61
55
 
@@ -1,14 +1,21 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from 'svelte'
3
3
  import type { HTMLButtonAttributes } from 'svelte/elements'
4
- import { resolveComponentSize, type Size } from '../config.js'
4
+ import { resolveComponentSize, resolveSpinnerVariant, type Size } from '../config.js'
5
+ import type { SpinnerVariant } from '../config.js'
6
+ import Spinner from './Spinner.svelte'
5
7
 
6
8
  interface Props extends HTMLButtonAttributes {
7
9
  variant?: 'primary' | 'secondary' | 'ghost' | 'danger'
8
10
  type?: 'button' | 'submit' | 'reset'
9
11
  disabled?: boolean
10
- /** Loading state: shows a spinner, blocks clicks, sets aria-busy; stays focusable. */
11
- loading?: boolean
12
+ /**
13
+ * Loading state: shows a {@link Spinner}, blocks clicks, sets aria-busy;
14
+ * stays focusable. `true` uses the configured default spinner variant; pass
15
+ * a {@link SpinnerVariant} string to pick a specific glyph; `false`/omitted
16
+ * is not loading.
17
+ */
18
+ loading?: boolean | SpinnerVariant
12
19
  /** Accessible name while loading (keeps the name stable when the label is hidden). */
13
20
  loadingLabel?: string
14
21
  onclick?: (e: MouseEvent) => void
@@ -46,14 +53,25 @@
46
53
  ...rest
47
54
  }: Props = $props()
48
55
 
56
+ // `loading` is a discriminated union: `true` → configured default variant; a
57
+ // SpinnerVariant string → that variant; `false`/undefined → not loading.
58
+ let isLoading = $derived(loading !== false && loading != null)
59
+ // The size Button paints on its root, threaded down to nested Icon/Spinner so
60
+ // the loading glyph tracks the button's tier (coordinated inner sizes).
61
+ let resolvedSize = $derived(resolveComponentSize('Button', size))
62
+ // An explicit variant string wins; `true` falls back to the house default.
63
+ let spinnerVariant = $derived(
64
+ typeof loading === 'string' ? loading : resolveSpinnerVariant(undefined),
65
+ )
66
+
49
67
  // Soft-disable: keep the control focusable/announceable via aria-disabled while
50
68
  // loading, but still emit native `disabled` so forms don't submit it.
51
- let busy = $derived(loading)
69
+ let busy = $derived(isLoading)
52
70
  let ariaLabel = $derived(iconOnly ? label : rest['aria-label'])
53
- let accessibleName = $derived(loading ? (loadingLabel ?? ariaLabel) : ariaLabel)
71
+ let accessibleName = $derived(isLoading ? (loadingLabel ?? ariaLabel) : ariaLabel)
54
72
 
55
73
  function handleClick(e: MouseEvent) {
56
- if (loading || disabled) {
74
+ if (isLoading || disabled) {
57
75
  e.preventDefault()
58
76
  e.stopImmediatePropagation()
59
77
  return
@@ -67,28 +85,36 @@
67
85
  class="ss-btn {variant}"
68
86
  class:icon-only={iconOnly}
69
87
  class:full-width={fullWidth}
70
- class:loading
88
+ class:loading={isLoading}
71
89
  {type}
72
90
  {disabled}
73
91
  aria-busy={busy ? 'true' : undefined}
74
- aria-disabled={loading ? 'true' : undefined}
92
+ aria-disabled={isLoading ? 'true' : undefined}
75
93
  aria-label={accessibleName}
76
- data-size-variant={resolveComponentSize('Button', size)}
94
+ data-size-variant={resolvedSize}
77
95
  {...rest}
78
96
  onclick={handleClick}
79
97
  >
80
- {#if loading}
81
- <span class="spinner" aria-hidden="true"></span>
98
+ {#if isLoading}
99
+ <!-- Shared Spinner, sized to the button's tier. Its own role="status" is
100
+ suppressed (role/aria-hidden) so the button's name is the single
101
+ announcement — no double live-region. -->
102
+ <span class="affix" aria-hidden="true">
103
+ <Spinner variant={spinnerVariant} size={resolvedSize} role={undefined} aria-hidden="true" />
104
+ </span>
82
105
  {/if}
83
106
  {#if leading}<span class="affix" aria-hidden="true">{@render leading()}</span>{/if}
84
107
  {#if children}<span class="label">{@render children()}</span>{/if}
85
108
  {#if trailing}<span class="affix" aria-hidden="true">{@render trailing()}</span>{/if}
86
109
  </button>
87
110
 
88
- <style>.ss-btn {
111
+ <style>@charset "UTF-8";
112
+ .ss-btn {
89
113
  font-family: var(--ss-font-body);
90
114
  font-size: var(--ss-control-font);
91
115
  line-height: 1;
116
+ min-height: calc(var(--ss-control-font) + var(--ss-control-py) * 2);
117
+ box-sizing: border-box;
92
118
  font-weight: 500;
93
119
  padding: var(--ss-control-py) var(--ss-control-px);
94
120
  border: 1px solid var(--ss-line);
@@ -167,31 +193,21 @@
167
193
  align-items: center;
168
194
  }
169
195
 
196
+ /* Clamp the icon/spinner to the text line-box (1em of the control font) and
197
+ centre it, so a glyph sized to --ss-icon (taller than 1em) never enlarges
198
+ the line-box and grows the control (DS-0112). The icon stays visually
199
+ centred; overflow stays visible so a slightly-taller glyph is not cropped,
200
+ while the box's own height — what align-items:center measures — is the
201
+ line-box. `min-height: 0` / `min-width: 0` defang the flex auto-min-size: as
202
+ a flex ITEM of `.ss-btn`, `.affix` would otherwise take a content-based
203
+ automatic minimum from the (taller) icon, which could override the explicit
204
+ `height: 1em` and grow the control past its `min-height` floor. */
170
205
  .affix {
171
206
  display: inline-flex;
172
207
  align-items: center;
173
208
  justify-content: center;
174
- line-height: 0;
175
- }
176
-
177
- /* em-sized spinner so it tracks the button font; reduced-motion safe. */
178
- .spinner {
179
- display: inline-block;
180
- width: 1em;
181
209
  height: 1em;
182
- border: 2px solid currentColor;
183
- border-top-color: transparent;
184
- box-sizing: border-box;
185
- animation: ss-btn-spin var(--ss-dur-xslow) linear infinite;
186
- }
187
-
188
- @keyframes ss-btn-spin {
189
- to {
190
- transform: rotate(360deg);
191
- }
192
- }
193
- @media (prefers-reduced-motion: reduce) {
194
- .spinner {
195
- animation: none;
196
- }
210
+ min-height: 0;
211
+ min-width: 0;
212
+ line-height: 0;
197
213
  }</style>
@@ -1,12 +1,18 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { HTMLButtonAttributes } from 'svelte/elements';
3
3
  import { type Size } from '../config.js';
4
+ import type { SpinnerVariant } from '../config.js';
4
5
  interface Props extends HTMLButtonAttributes {
5
6
  variant?: 'primary' | 'secondary' | 'ghost' | 'danger';
6
7
  type?: 'button' | 'submit' | 'reset';
7
8
  disabled?: boolean;
8
- /** Loading state: shows a spinner, blocks clicks, sets aria-busy; stays focusable. */
9
- loading?: boolean;
9
+ /**
10
+ * Loading state: shows a {@link Spinner}, blocks clicks, sets aria-busy;
11
+ * stays focusable. `true` uses the configured default spinner variant; pass
12
+ * a {@link SpinnerVariant} string to pick a specific glyph; `false`/omitted
13
+ * is not loading.
14
+ */
15
+ loading?: boolean | SpinnerVariant;
10
16
  /** Accessible name while loading (keeps the name stable when the label is hidden). */
11
17
  loadingLabel?: string;
12
18
  onclick?: (e: MouseEvent) => void;
@@ -13,6 +13,7 @@
13
13
  </script>
14
14
 
15
15
  <script lang="ts">
16
+ import { CHART_PALETTE } from '../palette.js'
16
17
  import { scaleLinear, scaleTime, scaleBand } from 'd3-scale'
17
18
  import { line as shapeLine, area as shapeArea } from 'd3-shape'
18
19
  import { extent, max } from 'd3-array'
@@ -62,14 +63,7 @@
62
63
  size,
63
64
  }: Props = $props()
64
65
 
65
- const PALETTE = [
66
- 'var(--ss-primary)',
67
- 'var(--ss-blue)',
68
- 'var(--ss-purple)',
69
- 'var(--ss-cyan)',
70
- 'var(--ss-yellow)',
71
- 'var(--ss-lime)',
72
- ]
66
+ const PALETTE = CHART_PALETTE
73
67
 
74
68
  const M = { top: 8, right: 12, bottom: 24, left: 40 }
75
69
 
@@ -133,7 +133,7 @@
133
133
  }
134
134
  .ss-datefield.invalid .control:focus-within {
135
135
  border-color: var(--ss-red);
136
- box-shadow: 0 0 0 3px rgba(var(--ss-red-rgb), 0.22);
136
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--ss-danger) 22%, transparent);
137
137
  }
138
138
  .ss-datefield.disabled .control {
139
139
  border-color: var(--ss-line);
@@ -269,7 +269,7 @@
269
269
  padding: 0;
270
270
  display: flex;
271
271
  flex-direction: column;
272
- gap: var(--ss-gap-sm, 4px);
272
+ gap: var(--ss-gap-xs);
273
273
  }
274
274
  .ss-filedrop .file {
275
275
  display: flex;