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
@@ -0,0 +1,35 @@
1
+ import { type Size } from '../config.js';
2
+ interface Props {
3
+ label?: string;
4
+ id?: string;
5
+ name?: string;
6
+ /** Bindable current value; `null` when the input is empty. */
7
+ value?: number | null;
8
+ min?: number;
9
+ max?: number;
10
+ /** Increment/decrement step for the steppers (and native arrows). */
11
+ step?: number;
12
+ required?: boolean;
13
+ disabled?: boolean;
14
+ /** Native readonly — value visible but not editable; rendered muted. */
15
+ readonly?: boolean;
16
+ /** Token size (sm|md|lg); inherits the global size when unset. */
17
+ size?: Size;
18
+ /** Marks the field invalid for assistive tech (aria-invalid). */
19
+ invalid?: boolean;
20
+ /** Supplementary helper text rendered under the input. */
21
+ hint?: string;
22
+ /** Error text rendered under the input; its presence implies aria-invalid and is announced to AT. */
23
+ error?: string;
24
+ /** id(s) of element(s) describing the field (aria-describedby) — e.g. hint/error text. */
25
+ describedby?: string;
26
+ placeholder?: string;
27
+ onchange?: (e: Event & {
28
+ currentTarget: HTMLInputElement;
29
+ }) => void;
30
+ /** Any remaining native input attributes / event handlers are forwarded. */
31
+ [key: string]: unknown;
32
+ }
33
+ declare const NumberField: import("svelte").Component<Props, {}, "value">;
34
+ type NumberField = ReturnType<typeof NumberField>;
35
+ export default NumberField;
@@ -0,0 +1,193 @@
1
+ <script lang="ts">
2
+ // ─────────────────────────────────────────────────────────────────────────
3
+ // Pagination — DS-0100. A windowed page navigator: a Prev button, a list of
4
+ // page-number buttons (first, last, and ±siblingCount around the current one,
5
+ // with `…` ellipses bridging the gaps), and a Next button. Bindable 1-based
6
+ // `page`, zero radius, mono numerals, `--ss-line` hairlines, size-token
7
+ // density. The current page is `aria-current="page"`, visually active and
8
+ // inert (re-clicking it never re-fires). WCAG 2.2 AA.
9
+ // ─────────────────────────────────────────────────────────────────────────
10
+ import { resolveComponentSize, type Size } from '../config.js'
11
+
12
+ interface Props {
13
+ /** Current page, 1-based (bindable). */
14
+ page?: number
15
+ /** Total item count — used with `pageSize` to derive the page count. */
16
+ total?: number
17
+ /** Explicit page count; overrides the `total`/`pageSize` computation. */
18
+ pageCount?: number
19
+ /** Items per page when deriving the count from `total`. Default 10. */
20
+ pageSize?: number
21
+ /** Page-number buttons to show on each side of the current page. Default 1. */
22
+ siblingCount?: number
23
+ /** Disable the whole control: every button is inert. */
24
+ disabled?: boolean
25
+ /** Token size (sm|md|lg); inherits the global size when unset. */
26
+ size?: Size
27
+ /** Fired when the page changes (after `page` updates). */
28
+ onchange?: (page: number) => void
29
+ }
30
+
31
+ let {
32
+ page = $bindable(1),
33
+ total,
34
+ pageCount,
35
+ pageSize = 10,
36
+ siblingCount = 1,
37
+ disabled = false,
38
+ size,
39
+ onchange,
40
+ }: Props = $props()
41
+
42
+ // Total number of pages — explicit `pageCount` wins, else derived from the
43
+ // item count. Always at least 1 so the control never renders empty.
44
+ const pages = $derived(pageCount ?? Math.max(1, Math.ceil((total ?? 0) / pageSize)))
45
+
46
+ // Clamp the active page into [1, pages] for all rendering/decisions.
47
+ const current = $derived(Math.min(Math.max(1, page), pages))
48
+
49
+ type Slot = number | 'gap-start' | 'gap-end'
50
+
51
+ // Windowed list of slots: first page, last page, the sibling window around
52
+ // the current page, and an ellipsis marker wherever a run of pages is hidden.
53
+ const slots = $derived.by<Slot[]>(() => {
54
+ const start = Math.max(2, current - siblingCount)
55
+ const end = Math.min(pages - 1, current + siblingCount)
56
+ const out: Slot[] = [1]
57
+ // A single hidden page is cheaper to show than an ellipsis — only collapse
58
+ // a run into `…` when it hides more than one page.
59
+ if (start > 3) out.push('gap-start')
60
+ else if (start === 3) out.push(2)
61
+ for (let p = start; p <= end; p++) out.push(p)
62
+ if (end < pages - 2) out.push('gap-end')
63
+ else if (end === pages - 2) out.push(pages - 1)
64
+ if (pages > 1) out.push(pages)
65
+ return out
66
+ })
67
+
68
+ const atFirst = $derived(current <= 1)
69
+ const atLast = $derived(current >= pages)
70
+
71
+ function go(target: number) {
72
+ const next = Math.min(Math.max(1, target), pages)
73
+ if (disabled || next === current) return
74
+ page = next
75
+ onchange?.(next)
76
+ }
77
+
78
+ const sizeAttr = $derived(resolveComponentSize('Pagination', size))
79
+ </script>
80
+
81
+ <nav
82
+ class="ss-pagination"
83
+ aria-label="Pagination"
84
+ data-size-variant={sizeAttr}
85
+ data-disabled={disabled ? 'true' : undefined}
86
+ >
87
+ <button
88
+ type="button"
89
+ class="page nav-btn"
90
+ aria-label="Previous page"
91
+ disabled={disabled || atFirst}
92
+ onclick={() => go(current - 1)}
93
+ >
94
+ <span aria-hidden="true">‹</span>
95
+ </button>
96
+
97
+ {#each slots as slot (slot)}
98
+ {#if slot === 'gap-start' || slot === 'gap-end'}
99
+ <span class="ellipsis" aria-hidden="true">…</span>
100
+ {:else}
101
+ {@const isCurrent = slot === current}
102
+ <button
103
+ type="button"
104
+ class="page"
105
+ class:active={isCurrent}
106
+ aria-current={isCurrent ? 'page' : undefined}
107
+ aria-label={`Page ${slot}`}
108
+ {disabled}
109
+ onclick={() => go(slot)}
110
+ >
111
+ {slot}
112
+ </button>
113
+ {/if}
114
+ {/each}
115
+
116
+ <button
117
+ type="button"
118
+ class="page nav-btn"
119
+ aria-label="Next page"
120
+ disabled={disabled || atLast}
121
+ onclick={() => go(current + 1)}
122
+ >
123
+ <span aria-hidden="true">›</span>
124
+ </button>
125
+ </nav>
126
+
127
+ <style>.ss-pagination {
128
+ display: inline-flex;
129
+ align-items: center;
130
+ gap: 0;
131
+ border: 1px solid var(--ss-line);
132
+ background: var(--ss-bg);
133
+ width: max-content;
134
+ max-width: 100%;
135
+ }
136
+ .ss-pagination .page {
137
+ display: inline-flex;
138
+ align-items: center;
139
+ justify-content: center;
140
+ min-width: var(--ss-pagination-min, 2.25em);
141
+ font: 500 var(--ss-pagination-font, 0.875rem)/1 var(--ss-font-mono);
142
+ color: var(--ss-fg-muted);
143
+ background: transparent;
144
+ border: 0;
145
+ border-left: 1px solid var(--ss-line);
146
+ padding: var(--ss-pagination-py, 0.5em) var(--ss-pagination-px, 0.625em);
147
+ cursor: pointer;
148
+ white-space: nowrap;
149
+ transition: color var(--ss-dur-fast) var(--ss-ease), background var(--ss-dur-fast) var(--ss-ease);
150
+ }
151
+ .ss-pagination .page:first-child {
152
+ border-left: 0;
153
+ }
154
+ .ss-pagination .page:hover:not(.active):not(:disabled) {
155
+ color: var(--ss-fg);
156
+ background: var(--ss-hover);
157
+ }
158
+ .ss-pagination .page.active {
159
+ color: var(--ss-fg-on-primary);
160
+ background: var(--ss-primary);
161
+ cursor: default;
162
+ }
163
+ .ss-pagination .page:focus-visible {
164
+ outline: none;
165
+ box-shadow: inset 0 0 0 2px var(--ss-primary-soft);
166
+ z-index: 1;
167
+ }
168
+ .ss-pagination .page.active:focus-visible {
169
+ box-shadow: inset 0 0 0 2px var(--ss-bg);
170
+ }
171
+ .ss-pagination .page:disabled {
172
+ cursor: not-allowed;
173
+ opacity: 0.45;
174
+ }
175
+ .ss-pagination .page.active:disabled {
176
+ opacity: 1;
177
+ cursor: default;
178
+ }
179
+ .ss-pagination .nav-btn {
180
+ font-size: var(--ss-pagination-nav-font, 1rem);
181
+ }
182
+ .ss-pagination .ellipsis {
183
+ display: inline-flex;
184
+ align-items: center;
185
+ justify-content: center;
186
+ min-width: var(--ss-pagination-min, 2.25em);
187
+ padding: var(--ss-pagination-py, 0.5em) var(--ss-pagination-px, 0.625em);
188
+ border-left: 1px solid var(--ss-line);
189
+ color: var(--ss-fg-muted);
190
+ font-family: var(--ss-font-mono);
191
+ line-height: 1;
192
+ user-select: none;
193
+ }</style>
@@ -0,0 +1,22 @@
1
+ import { type Size } from '../config.js';
2
+ interface Props {
3
+ /** Current page, 1-based (bindable). */
4
+ page?: number;
5
+ /** Total item count — used with `pageSize` to derive the page count. */
6
+ total?: number;
7
+ /** Explicit page count; overrides the `total`/`pageSize` computation. */
8
+ pageCount?: number;
9
+ /** Items per page when deriving the count from `total`. Default 10. */
10
+ pageSize?: number;
11
+ /** Page-number buttons to show on each side of the current page. Default 1. */
12
+ siblingCount?: number;
13
+ /** Disable the whole control: every button is inert. */
14
+ disabled?: boolean;
15
+ /** Token size (sm|md|lg); inherits the global size when unset. */
16
+ size?: Size;
17
+ /** Fired when the page changes (after `page` updates). */
18
+ onchange?: (page: number) => void;
19
+ }
20
+ declare const Pagination: import("svelte").Component<Props, {}, "page">;
21
+ type Pagination = ReturnType<typeof Pagination>;
22
+ export default Pagination;
@@ -31,6 +31,13 @@
31
31
  onChange?: (value: string) => void
32
32
  /** Stretch segments to equal widths and fill the container. */
33
33
  fullWidth?: boolean
34
+ /**
35
+ * Disable the whole control (DS-0078): every segment is rendered inert
36
+ * (`disabled` + skipped by keyboard nav) and the group carries
37
+ * `aria-disabled="true"`. Per-option `disabled` still works for
38
+ * disabling individual segments.
39
+ */
40
+ disabled?: boolean
34
41
  /** Token size (sm|md|lg); inherits the global size when unset. */
35
42
  size?: Size
36
43
  /**
@@ -45,29 +52,33 @@
45
52
  value = $bindable(),
46
53
  onChange,
47
54
  fullWidth = false,
55
+ disabled = false,
48
56
  size,
49
57
  label,
50
58
  }: Props = $props()
51
59
 
60
+ // Component-wide `disabled` wins over (and combines with) per-option flags.
61
+ const isOptionDisabled = (o: SegmentOption) => disabled || Boolean(o.disabled)
62
+
52
63
  // Bound references to each segment, indexed by option position, so keyboard
53
64
  // navigation can move focus across the roving-tabindex group.
54
65
  let segments = $state<(HTMLButtonElement | undefined)[]>([])
55
66
 
56
67
  const enabledIndexes = $derived(
57
- options.map((o, i) => (o.disabled ? -1 : i)).filter((i) => i >= 0),
68
+ options.map((o, i) => (isOptionDisabled(o) ? -1 : i)).filter((i) => i >= 0),
58
69
  )
59
70
 
60
71
  /** Index that owns the single tab stop (roving tabindex). The selected option
61
72
  * when it's enabled; otherwise the first enabled option; -1 when none. */
62
73
  const tabbableIndex = $derived.by(() => {
63
- const sel = options.findIndex((o) => o.value === value && !o.disabled)
74
+ const sel = options.findIndex((o) => o.value === value && !isOptionDisabled(o))
64
75
  if (sel >= 0) return sel
65
76
  return enabledIndexes[0] ?? -1
66
77
  })
67
78
 
68
79
  function select(index: number) {
69
80
  const opt = options[index]
70
- if (!opt || opt.disabled) return
81
+ if (!opt || isOptionDisabled(opt)) return
71
82
  if (opt.value !== value) {
72
83
  value = opt.value
73
84
  onChange?.(opt.value)
@@ -123,6 +134,7 @@
123
134
  class:full={fullWidth}
124
135
  role="radiogroup"
125
136
  aria-label={label}
137
+ aria-disabled={disabled ? 'true' : undefined}
126
138
  data-size-variant={sizeAttr}
127
139
  >
128
140
  {#each options as opt, i (opt.value)}
@@ -135,7 +147,7 @@
135
147
  role="radio"
136
148
  aria-checked={selected}
137
149
  tabindex={i === tabbableIndex ? 0 : -1}
138
- disabled={opt.disabled}
150
+ disabled={isOptionDisabled(opt)}
139
151
  onclick={() => select(i)}
140
152
  onkeydown={(e) => onKeydown(e, i)}
141
153
  >
@@ -17,6 +17,13 @@ interface Props {
17
17
  onChange?: (value: string) => void;
18
18
  /** Stretch segments to equal widths and fill the container. */
19
19
  fullWidth?: boolean;
20
+ /**
21
+ * Disable the whole control (DS-0078): every segment is rendered inert
22
+ * (`disabled` + skipped by keyboard nav) and the group carries
23
+ * `aria-disabled="true"`. Per-option `disabled` still works for
24
+ * disabling individual segments.
25
+ */
26
+ disabled?: boolean;
20
27
  /** Token size (sm|md|lg); inherits the global size when unset. */
21
28
  size?: Size;
22
29
  /**
@@ -0,0 +1,224 @@
1
+ <script module lang="ts">
2
+ /** A single selectable option. */
3
+ export interface SelectOption {
4
+ value: string
5
+ label: string
6
+ disabled?: boolean
7
+ }
8
+ /** A labelled group of options, rendered as an <optgroup>. */
9
+ export interface SelectOptGroup {
10
+ label: string
11
+ options: SelectOption[]
12
+ }
13
+ </script>
14
+
15
+ <script lang="ts">
16
+ import type { HTMLSelectAttributes } from 'svelte/elements'
17
+ import { resolveComponentSize, type Size } from '../config.js'
18
+
19
+ interface Props {
20
+ label?: string
21
+ id?: string
22
+ name?: string
23
+ value?: string
24
+ /** Flat options, or grouped options (detected by an `options` array on the first element). */
25
+ options?: SelectOption[] | SelectOptGroup[]
26
+ /** Renders a disabled, hidden first option, selected while the value is empty. */
27
+ placeholder?: string
28
+ required?: boolean
29
+ disabled?: boolean
30
+ /** Token size (sm|md|lg); inherits the global size when unset. */
31
+ size?: Size
32
+ /** Marks the field invalid for assistive tech (aria-invalid). */
33
+ invalid?: boolean
34
+ /** Supplementary helper text rendered under the select. */
35
+ hint?: string
36
+ /** Error text rendered under the select; its presence implies aria-invalid and is announced. */
37
+ error?: string
38
+ /** id(s) of element(s) describing the field (aria-describedby) — e.g. hint/error text. */
39
+ describedby?: string
40
+ onchange?: (e: Event & { currentTarget: HTMLSelectElement }) => void
41
+ /** Any remaining native select attributes / event handlers are forwarded. */
42
+ [key: string]: unknown
43
+ }
44
+ let {
45
+ label,
46
+ id,
47
+ name,
48
+ value = $bindable(''),
49
+ options = [],
50
+ placeholder,
51
+ required = false,
52
+ disabled = false,
53
+ size,
54
+ invalid,
55
+ hint,
56
+ error,
57
+ describedby,
58
+ onchange,
59
+ ...rest
60
+ }: Props = $props()
61
+
62
+ // Guarantee a label↔select association even when no `id` is passed.
63
+ const uid = $props.id()
64
+ const selectId = $derived(id ?? uid)
65
+ const hintId = $derived(`${selectId}-hint`)
66
+ const errorId = $derived(`${selectId}-error`)
67
+
68
+ // error wins, then hint, then any caller-supplied describedby — order matters for AT.
69
+ const describedBy = $derived(
70
+ [error ? errorId : null, hint ? hintId : null, describedby].filter(Boolean).join(' ') ||
71
+ undefined,
72
+ )
73
+ const isInvalid = $derived(invalid || Boolean(error) || undefined)
74
+ const resolvedSize = $derived(resolveComponentSize('Select', size))
75
+
76
+ // Grouped input is detected by an `options` array on the first element.
77
+ const grouped = $derived(
78
+ options.length > 0 && Array.isArray((options[0] as SelectOptGroup).options),
79
+ )
80
+ const groups = $derived(grouped ? (options as SelectOptGroup[]) : [])
81
+ const flat = $derived(grouped ? [] : (options as SelectOption[]))
82
+ </script>
83
+
84
+ <div class="ss-select" data-size-variant={resolvedSize} class:invalid={isInvalid} class:disabled>
85
+ {#if label}
86
+ <label class="lbl" for={selectId}>
87
+ {label}
88
+ {#if required}<span class="req" aria-hidden="true">*</span>{/if}
89
+ </label>
90
+ {/if}
91
+
92
+ <div class="control">
93
+ <select
94
+ class="select"
95
+ id={selectId}
96
+ {name}
97
+ bind:value
98
+ {required}
99
+ {disabled}
100
+ aria-invalid={isInvalid}
101
+ aria-describedby={describedBy}
102
+ {onchange}
103
+ {...rest}
104
+ >
105
+ {#if placeholder}
106
+ <option value="" disabled hidden selected={!value}>{placeholder}</option>
107
+ {/if}
108
+ {#if grouped}
109
+ {#each groups as group (group.label)}
110
+ <optgroup label={group.label}>
111
+ {#each group.options as opt (opt.value)}
112
+ <option value={opt.value} disabled={opt.disabled}>{opt.label}</option>
113
+ {/each}
114
+ </optgroup>
115
+ {/each}
116
+ {:else}
117
+ {#each flat as opt (opt.value)}
118
+ <option value={opt.value} disabled={opt.disabled}>{opt.label}</option>
119
+ {/each}
120
+ {/if}
121
+ </select>
122
+ <span class="chevron" aria-hidden="true"></span>
123
+ </div>
124
+
125
+ {#if error}<span class="msg error" id={errorId} role="alert">{error}</span>{/if}
126
+ {#if hint}<span class="msg hint" id={hintId}>{hint}</span>{/if}
127
+ </div>
128
+
129
+ <style>.ss-select {
130
+ display: flex;
131
+ flex-direction: column;
132
+ gap: 6px;
133
+ }
134
+ .ss-select .lbl {
135
+ font-family: var(--ss-font-mono);
136
+ font-size: var(--ss-ui-xs);
137
+ color: var(--ss-fg-muted);
138
+ text-transform: uppercase;
139
+ letter-spacing: 0.08em;
140
+ }
141
+ .ss-select .lbl .req {
142
+ color: var(--ss-red);
143
+ margin-left: 2px;
144
+ }
145
+ .ss-select .control {
146
+ position: relative;
147
+ display: flex;
148
+ align-items: center;
149
+ background: transparent;
150
+ color: var(--ss-fg);
151
+ border: 1px solid var(--ss-line);
152
+ padding: 0 var(--ss-input-px);
153
+ transition: border-color var(--ss-dur-fast) var(--ss-ease), box-shadow var(--ss-dur-fast) var(--ss-ease);
154
+ }
155
+ .ss-select .control:focus-within {
156
+ border-color: var(--ss-primary);
157
+ box-shadow: 0 0 0 3px var(--ss-primary-soft);
158
+ }
159
+ .ss-select.invalid .control {
160
+ border-color: var(--ss-red);
161
+ }
162
+ .ss-select.invalid .control:focus-within {
163
+ border-color: var(--ss-red);
164
+ box-shadow: 0 0 0 3px rgba(var(--ss-red-rgb), 0.22);
165
+ }
166
+ .ss-select.disabled .control {
167
+ border-color: var(--ss-line);
168
+ }
169
+ .ss-select .chevron {
170
+ flex: none;
171
+ pointer-events: none;
172
+ width: 0;
173
+ height: 0;
174
+ margin-left: var(--ss-gap-sm);
175
+ border-left: var(--ss-select-chevron, 5px) solid transparent;
176
+ border-right: var(--ss-select-chevron, 5px) solid transparent;
177
+ border-top: var(--ss-select-chevron, 5px) solid var(--ss-fg-muted);
178
+ transition: border-top-color var(--ss-dur-fast) var(--ss-ease);
179
+ }
180
+ .ss-select:not(.disabled) .control:focus-within .chevron {
181
+ border-top-color: var(--ss-fg);
182
+ }
183
+ .ss-select.disabled .chevron {
184
+ border-top-color: var(--ss-fg-faint);
185
+ }
186
+ .ss-select .msg {
187
+ font-family: var(--ss-font-mono);
188
+ font-size: var(--ss-ui-xs);
189
+ letter-spacing: 0.02em;
190
+ }
191
+ .ss-select .msg.hint {
192
+ color: var(--ss-fg-faint);
193
+ }
194
+ .ss-select .msg.error {
195
+ color: var(--ss-red);
196
+ }
197
+
198
+ .select {
199
+ appearance: none;
200
+ -webkit-appearance: none;
201
+ font-family: var(--ss-font-body);
202
+ font-size: var(--ss-input-font);
203
+ background: transparent;
204
+ color: var(--ss-fg);
205
+ border: none;
206
+ padding: var(--ss-input-py) 0;
207
+ width: 100%;
208
+ min-width: 0;
209
+ cursor: pointer;
210
+ transition: color var(--ss-dur-fast) var(--ss-ease);
211
+ }
212
+ .select:focus {
213
+ outline: none;
214
+ }
215
+ .select:disabled {
216
+ color: var(--ss-fg-faint);
217
+ cursor: not-allowed;
218
+ -webkit-text-fill-color: var(--ss-fg-faint);
219
+ }
220
+ .select option,
221
+ .select optgroup {
222
+ background: var(--ss-bg-elev);
223
+ color: var(--ss-fg);
224
+ }</style>
@@ -0,0 +1,42 @@
1
+ /** A single selectable option. */
2
+ export interface SelectOption {
3
+ value: string;
4
+ label: string;
5
+ disabled?: boolean;
6
+ }
7
+ /** A labelled group of options, rendered as an <optgroup>. */
8
+ export interface SelectOptGroup {
9
+ label: string;
10
+ options: SelectOption[];
11
+ }
12
+ import { type Size } from '../config.js';
13
+ interface Props {
14
+ label?: string;
15
+ id?: string;
16
+ name?: string;
17
+ value?: string;
18
+ /** Flat options, or grouped options (detected by an `options` array on the first element). */
19
+ options?: SelectOption[] | SelectOptGroup[];
20
+ /** Renders a disabled, hidden first option, selected while the value is empty. */
21
+ placeholder?: string;
22
+ required?: boolean;
23
+ disabled?: boolean;
24
+ /** Token size (sm|md|lg); inherits the global size when unset. */
25
+ size?: Size;
26
+ /** Marks the field invalid for assistive tech (aria-invalid). */
27
+ invalid?: boolean;
28
+ /** Supplementary helper text rendered under the select. */
29
+ hint?: string;
30
+ /** Error text rendered under the select; its presence implies aria-invalid and is announced. */
31
+ error?: string;
32
+ /** id(s) of element(s) describing the field (aria-describedby) — e.g. hint/error text. */
33
+ describedby?: string;
34
+ onchange?: (e: Event & {
35
+ currentTarget: HTMLSelectElement;
36
+ }) => void;
37
+ /** Any remaining native select attributes / event handlers are forwarded. */
38
+ [key: string]: unknown;
39
+ }
40
+ declare const Select: import("svelte").Component<Props, {}, "value">;
41
+ type Select = ReturnType<typeof Select>;
42
+ export default Select;
@@ -42,17 +42,18 @@
42
42
  }: Props = $props()
43
43
 
44
44
  const sparkColor = $derived(
45
- status === 'deg' ? 'var(--ss-yellow)'
46
- : status === 'down' ? 'var(--ss-red)'
47
- : status === 'maint' ? 'var(--ss-blue)'
48
- : 'var(--ss-primary)'
45
+ status === 'deg'
46
+ ? 'var(--ss-yellow)'
47
+ : status === 'down'
48
+ ? 'var(--ss-red)'
49
+ : status === 'maint'
50
+ ? 'var(--ss-blue)'
51
+ : 'var(--ss-primary)',
49
52
  )
50
53
 
51
54
  // Spell the status out for assistive tech (the abbreviations are opaque).
52
55
  const statusLabel = $derived(
53
- status === 'deg' ? 'degraded'
54
- : status === 'maint' ? 'maintenance'
55
- : status
56
+ status === 'deg' ? 'degraded' : status === 'maint' ? 'maintenance' : status,
56
57
  )
57
58
 
58
59
  // Status is decorative on the dot/badge, but meaningful — fold it into the label.
@@ -65,13 +66,9 @@
65
66
 
66
67
  // --- relative "last checked" timestamp -------------------------------------
67
68
  const updatedDate = $derived(
68
- updatedAt == null ? undefined
69
- : updatedAt instanceof Date ? updatedAt
70
- : new Date(updatedAt)
71
- )
72
- const updatedValid = $derived(
73
- !!updatedDate && !Number.isNaN(updatedDate.getTime())
69
+ updatedAt == null ? undefined : updatedAt instanceof Date ? updatedAt : new Date(updatedAt),
74
70
  )
71
+ const updatedValid = $derived(!!updatedDate && !Number.isNaN(updatedDate.getTime()))
75
72
  const updatedISO = $derived(updatedValid ? updatedDate!.toISOString() : undefined)
76
73
 
77
74
  function relativeTime(d: Date): string {
@@ -146,7 +143,10 @@
146
143
  data-size-variant={resolveComponentSize('ServiceCard', size)}
147
144
  {onclick}
148
145
  onkeydown={(e) => {
149
- if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onclick?.() }
146
+ if (e.key === 'Enter' || e.key === ' ') {
147
+ e.preventDefault()
148
+ onclick?.()
149
+ }
150
150
  }}
151
151
  >
152
152
  {@render body()}
@@ -180,7 +180,7 @@
180
180
  .ss-svc .head {
181
181
  display: flex;
182
182
  align-items: center;
183
- gap: 10px;
183
+ gap: var(--ss-gap-sm);
184
184
  }
185
185
  .ss-svc .head .name {
186
186
  font-family: var(--ss-font-display);