dssoca 0.9.0 → 0.11.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 (35) hide show
  1. package/dist/components/Avatar.svelte +119 -0
  2. package/dist/components/Avatar.svelte.d.ts +18 -0
  3. package/dist/components/BoxPlot.svelte +427 -0
  4. package/dist/components/BoxPlot.svelte.d.ts +36 -0
  5. package/dist/components/BumpChart.svelte +351 -0
  6. package/dist/components/BumpChart.svelte.d.ts +32 -0
  7. package/dist/components/Chart.svelte +527 -0
  8. package/dist/components/Chart.svelte.d.ts +42 -0
  9. package/dist/components/DateField.svelte +188 -0
  10. package/dist/components/DateField.svelte.d.ts +37 -0
  11. package/dist/components/FileDrop.svelte +355 -0
  12. package/dist/components/FileDrop.svelte.d.ts +24 -0
  13. package/dist/components/Heatmap.svelte +333 -0
  14. package/dist/components/Heatmap.svelte.d.ts +30 -0
  15. package/dist/components/Modal.svelte +223 -0
  16. package/dist/components/Modal.svelte.d.ts +29 -0
  17. package/dist/components/NumberField.svelte +260 -0
  18. package/dist/components/NumberField.svelte.d.ts +35 -0
  19. package/dist/components/Pagination.svelte +193 -0
  20. package/dist/components/Pagination.svelte.d.ts +22 -0
  21. package/dist/components/ScatterPlot.svelte +401 -0
  22. package/dist/components/ScatterPlot.svelte.d.ts +55 -0
  23. package/dist/components/Select.svelte +224 -0
  24. package/dist/components/Select.svelte.d.ts +42 -0
  25. package/dist/components/Switch.svelte +144 -0
  26. package/dist/components/Switch.svelte.d.ts +22 -0
  27. package/dist/components/Table.svelte +267 -0
  28. package/dist/components/Table.svelte.d.ts +52 -0
  29. package/dist/components/Tooltip.svelte +162 -0
  30. package/dist/components/Tooltip.svelte.d.ts +17 -0
  31. package/dist/dssoca.config.d.ts +1 -1
  32. package/dist/dssoca.config.js +11 -0
  33. package/dist/index.d.ts +16 -0
  34. package/dist/index.js +17 -0
  35. package/package.json +9 -1
@@ -0,0 +1,333 @@
1
+ <script lang="ts">
2
+ import { scaleLinear } from 'd3-scale'
3
+ import { extent } from 'd3-array'
4
+ import { resolveComponentSize, type Size } from '../config.js'
5
+
6
+ interface Props {
7
+ /** Row labels, top→bottom. */
8
+ rows: string[]
9
+ /** Column labels, left→right. */
10
+ columns: string[]
11
+ /** values[r][c]; `null` renders a blank cell excluded from the colour scale (e.g. the diagonal). */
12
+ values: (number | null)[][]
13
+ /** Value range mapped to colour intensity; defaults to the [min, max] of all non-null values. */
14
+ domain?: [number, number]
15
+ /** Format a cell value for its text + tooltip. */
16
+ valueFormat?: (v: number) => string
17
+ /** Render the value text inside each cell. Default true. */
18
+ showValues?: boolean
19
+ /** X axis caption (drawn under the column headers). */
20
+ xLabel?: string
21
+ /** Y axis caption (drawn rotated beside the row headers). */
22
+ yLabel?: string
23
+ /** Square cell size in px. Default 48. */
24
+ cellSize?: number
25
+ /** Reveal a tooltip on hover/focus of a cell. Default true. */
26
+ tooltip?: boolean
27
+ /** SR summary + accessible name; auto-generated when absent. */
28
+ summary?: string
29
+ /** Token size (sm|md|lg); inherits the global size when unset. */
30
+ size?: Size
31
+ }
32
+
33
+ let {
34
+ rows,
35
+ columns,
36
+ values,
37
+ domain,
38
+ valueFormat,
39
+ showValues = true,
40
+ xLabel,
41
+ yLabel,
42
+ cellSize = 48,
43
+ tooltip = true,
44
+ summary,
45
+ size,
46
+ }: Props = $props()
47
+
48
+ const cleanRows = $derived(rows ?? [])
49
+ const cleanCols = $derived(columns ?? [])
50
+ const isEmpty = $derived(cleanRows.length === 0 || cleanCols.length === 0)
51
+
52
+ const fmt = $derived(valueFormat ?? ((v: number) => String(v)))
53
+
54
+ // Header gutters + optional axis-label room.
55
+ const headLeft = $derived(72 + (yLabel ? 20 : 0))
56
+ const headTop = 28
57
+ const labelBottom = $derived(xLabel ? 24 : 0)
58
+
59
+ const gridW = $derived(cleanCols.length * cellSize)
60
+ const gridH = $derived(cleanRows.length * cellSize)
61
+ const width = $derived(headLeft + gridW)
62
+ const height = $derived(headTop + gridH + labelBottom)
63
+
64
+ function valueAt(r: number, c: number): number | null {
65
+ const v = values?.[r]?.[c]
66
+ return typeof v === 'number' && Number.isFinite(v) ? v : null
67
+ }
68
+
69
+ const allValues = $derived.by(() => {
70
+ const out: number[] = []
71
+ for (let r = 0; r < cleanRows.length; r++) {
72
+ for (let c = 0; c < cleanCols.length; c++) {
73
+ const v = valueAt(r, c)
74
+ if (v !== null) out.push(v)
75
+ }
76
+ }
77
+ return out
78
+ })
79
+
80
+ const dom = $derived.by<[number, number]>(() => {
81
+ if (domain) return domain
82
+ const e = extent(allValues) as [number, number]
83
+ if (e[0] === undefined) return [0, 1]
84
+ if (e[0] === e[1]) return [e[0], e[1] + 1]
85
+ return e
86
+ })
87
+
88
+ // Opacity on the primary token encodes intensity.
89
+ const opacityScale = $derived(scaleLinear().domain(dom).range([0.12, 1]).clamp(true))
90
+
91
+ const cells = $derived.by(() =>
92
+ cleanRows.flatMap((row, r) =>
93
+ cleanCols.map((col, c) => {
94
+ const v = valueAt(r, c)
95
+ return {
96
+ r,
97
+ c,
98
+ row,
99
+ col,
100
+ x: headLeft + c * cellSize,
101
+ y: headTop + r * cellSize,
102
+ value: v,
103
+ opacity: v === null ? 0 : opacityScale(v),
104
+ }
105
+ }),
106
+ ),
107
+ )
108
+
109
+ const autoSummary = $derived.by(() => {
110
+ if (isEmpty) return 'No data'
111
+ return `Heatmap, ${cleanRows.length} rows × ${cleanCols.length} columns.`
112
+ })
113
+ const srText = $derived(summary ?? autoSummary)
114
+
115
+ const resolvedSize = $derived(resolveComponentSize('Chart', size))
116
+
117
+ let active = $state<{ row: string; col: string; value: number; cx: number; cy: number } | null>(
118
+ null,
119
+ )
120
+ function show(row: string, col: string, value: number, cx: number, cy: number) {
121
+ if (tooltip) active = { row, col, value, cx, cy }
122
+ }
123
+ function hide() {
124
+ active = null
125
+ }
126
+ function cellLabel(row: string, col: string, value: number): string {
127
+ return `${row} vs ${col}: ${fmt(value)}`
128
+ }
129
+ </script>
130
+
131
+ <div class="ss-heatmap" data-size-variant={resolvedSize} role="group" aria-label={srText}>
132
+ {#if isEmpty}
133
+ <span class="empty" aria-hidden="true">—</span>
134
+ <span class="sr-only">No data</span>
135
+ {:else}
136
+ <div class="plot">
137
+ <svg
138
+ class="canvas"
139
+ viewBox="0 0 {width} {height}"
140
+ {width}
141
+ {height}
142
+ preserveAspectRatio="xMidYMid meet"
143
+ role="presentation"
144
+ >
145
+ <!-- column headers -->
146
+ {#each cleanCols as col, c}
147
+ <text
148
+ class="header col"
149
+ x={headLeft + c * cellSize + cellSize / 2}
150
+ y={headTop - 8}
151
+ text-anchor="middle">{col}</text
152
+ >
153
+ {/each}
154
+
155
+ <!-- row headers -->
156
+ {#each cleanRows as row, r}
157
+ <text
158
+ class="header row"
159
+ x={headLeft - 8}
160
+ y={headTop + r * cellSize + cellSize / 2}
161
+ dy="0.32em"
162
+ text-anchor="end">{row}</text
163
+ >
164
+ {/each}
165
+
166
+ <!-- cells -->
167
+ {#each cells as cell}
168
+ {#if cell.value === null}
169
+ <rect
170
+ class="cell cell-empty"
171
+ x={cell.x}
172
+ y={cell.y}
173
+ width={cellSize}
174
+ height={cellSize}
175
+ aria-hidden="true"
176
+ />
177
+ {:else}
178
+ <rect
179
+ class="cell"
180
+ x={cell.x}
181
+ y={cell.y}
182
+ width={cellSize}
183
+ height={cellSize}
184
+ fill="var(--ss-primary)"
185
+ fill-opacity={cell.opacity}
186
+ tabindex="0"
187
+ role="button"
188
+ aria-label={cellLabel(cell.row, cell.col, cell.value)}
189
+ onfocus={() => show(cell.row, cell.col, cell.value!, cell.x + cellSize / 2, cell.y)}
190
+ onblur={hide}
191
+ onmouseenter={() =>
192
+ show(cell.row, cell.col, cell.value!, cell.x + cellSize / 2, cell.y)}
193
+ onmouseleave={hide}
194
+ />
195
+ {#if showValues}
196
+ <text
197
+ class="cell-text"
198
+ x={cell.x + cellSize / 2}
199
+ y={cell.y + cellSize / 2}
200
+ dy="0.32em"
201
+ text-anchor="middle">{fmt(cell.value)}</text
202
+ >
203
+ {/if}
204
+ {/if}
205
+ {/each}
206
+
207
+ <!-- axis captions -->
208
+ {#if xLabel}
209
+ <text class="axis-label x" x={headLeft + gridW / 2} y={height - 6} text-anchor="middle"
210
+ >{xLabel}</text
211
+ >
212
+ {/if}
213
+ {#if yLabel}
214
+ <text
215
+ class="axis-label y"
216
+ transform="translate(12,{headTop + gridH / 2}) rotate(-90)"
217
+ text-anchor="middle">{yLabel}</text
218
+ >
219
+ {/if}
220
+ </svg>
221
+
222
+ {#if tooltip && active}
223
+ <div
224
+ class="tooltip"
225
+ role="status"
226
+ style="left:{(active.cx / width) * 100}%;top:{(active.cy / height) * 100}%"
227
+ >
228
+ <span class="t-label">{active.row} · {active.col}</span>
229
+ <span class="t-val">{fmt(active.value)}</span>
230
+ </div>
231
+ {/if}
232
+ </div>
233
+ {/if}
234
+ </div>
235
+
236
+ <style>.ss-heatmap {
237
+ display: inline-flex;
238
+ flex-direction: column;
239
+ gap: var(--ss-gap-sm);
240
+ font-family: var(--ss-font-body);
241
+ color: var(--ss-fg);
242
+ max-width: 100%;
243
+ }
244
+ .ss-heatmap .plot {
245
+ position: relative;
246
+ width: 100%;
247
+ }
248
+ .ss-heatmap .canvas {
249
+ display: block;
250
+ max-width: 100%;
251
+ height: auto;
252
+ overflow: visible;
253
+ }
254
+ .ss-heatmap .empty {
255
+ align-self: center;
256
+ margin: auto;
257
+ padding: var(--ss-gap-sm);
258
+ color: var(--ss-fg-muted);
259
+ font-family: var(--ss-font-mono);
260
+ line-height: 1;
261
+ min-height: var(--ss-chart-h, 240px);
262
+ display: flex;
263
+ align-items: center;
264
+ }
265
+ .ss-heatmap .sr-only {
266
+ position: absolute;
267
+ width: 1px;
268
+ height: 1px;
269
+ padding: 0;
270
+ margin: -1px;
271
+ overflow: hidden;
272
+ clip: rect(0, 0, 0, 0);
273
+ white-space: nowrap;
274
+ border: 0;
275
+ }
276
+ .ss-heatmap .header {
277
+ font-family: var(--ss-font-mono);
278
+ font-size: var(--ss-ui-xs);
279
+ fill: var(--ss-fg-muted);
280
+ }
281
+ .ss-heatmap .axis-label {
282
+ font-family: var(--ss-font-mono);
283
+ font-size: var(--ss-ui-xs);
284
+ fill: var(--ss-fg-muted);
285
+ }
286
+ .ss-heatmap .cell {
287
+ stroke: var(--ss-line);
288
+ stroke-width: 1;
289
+ cursor: pointer;
290
+ shape-rendering: crispEdges;
291
+ transition: fill-opacity var(--ss-dur-fast) var(--ss-ease);
292
+ }
293
+ .ss-heatmap .cell:hover {
294
+ fill-opacity: 1;
295
+ }
296
+ .ss-heatmap .cell:focus-visible {
297
+ outline: none;
298
+ stroke: var(--ss-fg);
299
+ stroke-width: 2;
300
+ }
301
+ .ss-heatmap .cell-empty {
302
+ fill: none;
303
+ cursor: default;
304
+ }
305
+ .ss-heatmap .cell-text {
306
+ font-family: var(--ss-font-mono);
307
+ font-size: var(--ss-ui-xs);
308
+ fill: var(--ss-fg);
309
+ pointer-events: none;
310
+ }
311
+ .ss-heatmap .tooltip {
312
+ position: absolute;
313
+ transform: translate(-50%, calc(-100% - 8px));
314
+ pointer-events: none;
315
+ background: var(--ss-bg-elev);
316
+ border: 1px solid var(--ss-line-strong);
317
+ padding: var(--ss-gap-sm);
318
+ font-size: var(--ss-ui-xs);
319
+ line-height: 1.3;
320
+ white-space: nowrap;
321
+ display: flex;
322
+ flex-direction: column;
323
+ gap: 2px;
324
+ z-index: 2;
325
+ }
326
+ .ss-heatmap .tooltip .t-label {
327
+ font-family: var(--ss-font-mono);
328
+ color: var(--ss-fg);
329
+ }
330
+ .ss-heatmap .tooltip .t-val {
331
+ font-family: var(--ss-font-mono);
332
+ color: var(--ss-fg-muted);
333
+ }</style>
@@ -0,0 +1,30 @@
1
+ import { type Size } from '../config.js';
2
+ interface Props {
3
+ /** Row labels, top→bottom. */
4
+ rows: string[];
5
+ /** Column labels, left→right. */
6
+ columns: string[];
7
+ /** values[r][c]; `null` renders a blank cell excluded from the colour scale (e.g. the diagonal). */
8
+ values: (number | null)[][];
9
+ /** Value range mapped to colour intensity; defaults to the [min, max] of all non-null values. */
10
+ domain?: [number, number];
11
+ /** Format a cell value for its text + tooltip. */
12
+ valueFormat?: (v: number) => string;
13
+ /** Render the value text inside each cell. Default true. */
14
+ showValues?: boolean;
15
+ /** X axis caption (drawn under the column headers). */
16
+ xLabel?: string;
17
+ /** Y axis caption (drawn rotated beside the row headers). */
18
+ yLabel?: string;
19
+ /** Square cell size in px. Default 48. */
20
+ cellSize?: number;
21
+ /** Reveal a tooltip on hover/focus of a cell. Default true. */
22
+ tooltip?: boolean;
23
+ /** SR summary + accessible name; auto-generated when absent. */
24
+ summary?: string;
25
+ /** Token size (sm|md|lg); inherits the global size when unset. */
26
+ size?: Size;
27
+ }
28
+ declare const Heatmap: import("svelte").Component<Props, {}, "">;
29
+ type Heatmap = ReturnType<typeof Heatmap>;
30
+ export default Heatmap;
@@ -0,0 +1,223 @@
1
+ <script lang="ts">
2
+ // ─────────────────────────────────────────────────────────────────────────
3
+ // Modal (DS-0094). Built on the native <dialog> element so the platform
4
+ // hands us a focus trap, Esc-to-close and an inert ::backdrop for free.
5
+ //
6
+ // `open` is $bindable; an $effect mirrors it onto the dialog via
7
+ // showModal()/close(). The dialog's native `close` event syncs `open` back
8
+ // to false and fires `onclose`. Esc is native; when `closeOnEsc` is false we
9
+ // intercept the `cancel` event and preventDefault(). Backdrop click closes
10
+ // when `closeOnBackdrop` by detecting a pointerdown whose target IS the
11
+ // dialog itself (the inner .panel covers the dialog's content box, so any
12
+ // hit on the dialog element is the surrounding backdrop area).
13
+ //
14
+ // Zero radius; surface = --ss-bg-elev, border = --ss-line; tinted ::backdrop.
15
+ // Component metrics are inline var(--ss-modal-*, fallback) so no global SCSS
16
+ // is touched (DS-0094).
17
+ // ─────────────────────────────────────────────────────────────────────────
18
+ import type { Snippet } from 'svelte'
19
+ import { resolveComponentSize, type Size } from '../config.js'
20
+
21
+ interface Props {
22
+ /** Whether the modal is shown. Bindable — sync it from caller state. */
23
+ open?: boolean
24
+ /** Title rendered in the header; also wires `aria-labelledby`. */
25
+ title?: string
26
+ /** Token size (sm|md|lg); controls max-width. Inherits the global size when unset. */
27
+ size?: Size
28
+ /** Clicking the backdrop (outside the panel) closes the modal. @default true */
29
+ closeOnBackdrop?: boolean
30
+ /** Esc closes the modal. When false, Esc is swallowed (cancel prevented). @default true */
31
+ closeOnEsc?: boolean
32
+ /** Styling hint for destructive dialogs (tints the accent rail/title). @default false */
33
+ danger?: boolean
34
+ /** Accessible name when no `title` is set (maps to aria-label on the dialog). */
35
+ 'aria-label'?: string
36
+ /** Called after the dialog has closed (any reason: Esc, backdrop, button). */
37
+ onclose?: () => void
38
+ /** Header content; replaces the default title row when provided. */
39
+ header?: Snippet
40
+ /** Footer content (typically action buttons). */
41
+ footer?: Snippet
42
+ /** Body content. */
43
+ children: Snippet
44
+ }
45
+
46
+ let {
47
+ open = $bindable(false),
48
+ title,
49
+ size,
50
+ closeOnBackdrop = true,
51
+ closeOnEsc = true,
52
+ danger = false,
53
+ 'aria-label': ariaLabel,
54
+ onclose,
55
+ header,
56
+ footer,
57
+ children,
58
+ }: Props = $props()
59
+
60
+ let dialog = $state<HTMLDialogElement | null>(null)
61
+
62
+ // Stable id so the dialog's `aria-labelledby` can point at the title element.
63
+ const uid = $props.id()
64
+ const titleId = $derived(`${uid}-title`)
65
+
66
+ // Mirror `open` onto the native dialog. showModal()/close() throw if called
67
+ // in the wrong state, so guard on dialog.open before flipping it.
68
+ $effect(() => {
69
+ const el = dialog
70
+ if (!el) return
71
+ if (open && !el.open) el.showModal()
72
+ else if (!open && el.open) el.close()
73
+ })
74
+
75
+ // Native `close` (Esc, form method=dialog, .close()) → sync state + notify.
76
+ function onDialogClose() {
77
+ if (open) open = false
78
+ onclose?.()
79
+ }
80
+
81
+ // Esc dispatches `cancel` before `close`; swallow it when Esc is disabled.
82
+ function onCancel(e: Event) {
83
+ if (!closeOnEsc) e.preventDefault()
84
+ }
85
+
86
+ // A pointerdown landing on the <dialog> itself (not the inner .panel) is a
87
+ // backdrop hit. Using pointerdown avoids closing on a drag that began inside
88
+ // the panel and released on the backdrop.
89
+ function onPointerDown(e: PointerEvent) {
90
+ if (!closeOnBackdrop) return
91
+ if (e.target === dialog) open = false
92
+ }
93
+ </script>
94
+
95
+ <dialog
96
+ bind:this={dialog}
97
+ class="ss-modal"
98
+ class:danger
99
+ data-size-variant={resolveComponentSize('Modal', size)}
100
+ aria-labelledby={title ? titleId : undefined}
101
+ aria-label={title ? undefined : ariaLabel}
102
+ onclose={onDialogClose}
103
+ oncancel={onCancel}
104
+ onpointerdown={onPointerDown}
105
+ >
106
+ <div class="panel">
107
+ <header class="head">
108
+ {#if header}
109
+ {@render header()}
110
+ {:else if title}
111
+ <h2 class="title" id={titleId}>{title}</h2>
112
+ {/if}
113
+ <button type="button" class="close" aria-label="Close" onclick={() => (open = false)}
114
+ >×</button
115
+ >
116
+ </header>
117
+
118
+ <div class="body">
119
+ {@render children()}
120
+ </div>
121
+
122
+ {#if footer}
123
+ <footer class="foot">
124
+ {@render footer()}
125
+ </footer>
126
+ {/if}
127
+ </div>
128
+ </dialog>
129
+
130
+ <style>.ss-modal {
131
+ padding: 0;
132
+ border: 1px solid var(--ss-line);
133
+ background: var(--ss-bg-elev);
134
+ color: var(--ss-fg);
135
+ box-shadow: var(--ss-shadow-pop);
136
+ width: var(--ss-modal-w, 32rem);
137
+ max-width: var(--ss-modal-max, calc(100vw - var(--ss-s-8)));
138
+ max-height: var(--ss-modal-max-h, calc(100vh - var(--ss-s-16)));
139
+ margin: auto;
140
+ overflow: hidden;
141
+ }
142
+ .ss-modal::backdrop {
143
+ background: var(--ss-modal-backdrop, rgba(0, 0, 0, 0.62));
144
+ }
145
+ .ss-modal[data-size-variant=sm] {
146
+ --ss-modal-w: 24rem;
147
+ }
148
+ .ss-modal[data-size-variant=lg] {
149
+ --ss-modal-w: 48rem;
150
+ }
151
+
152
+ .panel {
153
+ display: flex;
154
+ flex-direction: column;
155
+ max-height: inherit;
156
+ }
157
+
158
+ .head {
159
+ display: flex;
160
+ align-items: center;
161
+ gap: var(--ss-modal-head-gap, var(--ss-s-3));
162
+ padding: var(--ss-modal-pad-y, var(--ss-s-4)) var(--ss-modal-pad-x, var(--ss-s-5));
163
+ border-bottom: 1px solid var(--ss-line);
164
+ }
165
+
166
+ .title {
167
+ flex: 1 1 auto;
168
+ margin: 0;
169
+ min-width: 0;
170
+ font-family: var(--ss-font-display, var(--ss-font-body));
171
+ font-size: var(--ss-modal-title, var(--ss-size-h3));
172
+ line-height: 1.2;
173
+ color: var(--ss-fg);
174
+ }
175
+
176
+ .ss-modal.danger .title {
177
+ color: var(--ss-danger);
178
+ }
179
+
180
+ .close {
181
+ flex: none;
182
+ margin-left: auto;
183
+ appearance: none;
184
+ display: inline-flex;
185
+ align-items: center;
186
+ justify-content: center;
187
+ width: var(--ss-modal-close, var(--ss-s-8));
188
+ height: var(--ss-modal-close, var(--ss-s-8));
189
+ padding: 0;
190
+ background: transparent;
191
+ border: 1px solid transparent;
192
+ color: var(--ss-fg-muted);
193
+ font-size: var(--ss-size-h3);
194
+ line-height: 1;
195
+ cursor: pointer;
196
+ transition: color var(--ss-dur-fast) var(--ss-ease), border-color var(--ss-dur-fast) var(--ss-ease);
197
+ }
198
+ .close:hover {
199
+ color: var(--ss-fg);
200
+ border-color: var(--ss-line-strong);
201
+ }
202
+ .close:focus-visible {
203
+ outline: 2px solid var(--ss-primary);
204
+ outline-offset: 2px;
205
+ color: var(--ss-fg);
206
+ }
207
+
208
+ .body {
209
+ padding: var(--ss-modal-pad-y, var(--ss-s-4)) var(--ss-modal-pad-x, var(--ss-s-5));
210
+ overflow: auto;
211
+ color: var(--ss-fg);
212
+ font-family: var(--ss-font-body);
213
+ line-height: var(--ss-leading, 1.5);
214
+ }
215
+
216
+ .foot {
217
+ display: flex;
218
+ align-items: center;
219
+ justify-content: flex-end;
220
+ gap: var(--ss-modal-foot-gap, var(--ss-s-2));
221
+ padding: var(--ss-modal-pad-y, var(--ss-s-4)) var(--ss-modal-pad-x, var(--ss-s-5));
222
+ border-top: 1px solid var(--ss-line);
223
+ }</style>
@@ -0,0 +1,29 @@
1
+ import type { Snippet } from 'svelte';
2
+ import { type Size } from '../config.js';
3
+ interface Props {
4
+ /** Whether the modal is shown. Bindable — sync it from caller state. */
5
+ open?: boolean;
6
+ /** Title rendered in the header; also wires `aria-labelledby`. */
7
+ title?: string;
8
+ /** Token size (sm|md|lg); controls max-width. Inherits the global size when unset. */
9
+ size?: Size;
10
+ /** Clicking the backdrop (outside the panel) closes the modal. @default true */
11
+ closeOnBackdrop?: boolean;
12
+ /** Esc closes the modal. When false, Esc is swallowed (cancel prevented). @default true */
13
+ closeOnEsc?: boolean;
14
+ /** Styling hint for destructive dialogs (tints the accent rail/title). @default false */
15
+ danger?: boolean;
16
+ /** Accessible name when no `title` is set (maps to aria-label on the dialog). */
17
+ 'aria-label'?: string;
18
+ /** Called after the dialog has closed (any reason: Esc, backdrop, button). */
19
+ onclose?: () => void;
20
+ /** Header content; replaces the default title row when provided. */
21
+ header?: Snippet;
22
+ /** Footer content (typically action buttons). */
23
+ footer?: Snippet;
24
+ /** Body content. */
25
+ children: Snippet;
26
+ }
27
+ declare const Modal: import("svelte").Component<Props, {}, "open">;
28
+ type Modal = ReturnType<typeof Modal>;
29
+ export default Modal;