@sentropic/design-system-svelte 0.5.0 → 0.7.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.
- package/dist/AspectRatio.svelte +44 -0
- package/dist/AspectRatio.svelte.d.ts +11 -0
- package/dist/AspectRatio.svelte.d.ts.map +1 -0
- package/dist/CodeSnippet.svelte +91 -0
- package/dist/CodeSnippet.svelte.d.ts +13 -0
- package/dist/CodeSnippet.svelte.d.ts.map +1 -0
- package/dist/Form.svelte +117 -0
- package/dist/Form.svelte.d.ts +16 -0
- package/dist/Form.svelte.d.ts.map +1 -0
- package/dist/FormGroup.svelte +71 -0
- package/dist/FormGroup.svelte.d.ts +13 -0
- package/dist/FormGroup.svelte.d.ts.map +1 -0
- package/dist/Header.svelte +117 -0
- package/dist/Header.svelte.d.ts +16 -0
- package/dist/Header.svelte.d.ts.map +1 -0
- package/dist/OverflowMenu.svelte +222 -0
- package/dist/OverflowMenu.svelte.d.ts +21 -0
- package/dist/OverflowMenu.svelte.d.ts.map +1 -0
- package/dist/PaginationNav.svelte +219 -0
- package/dist/PaginationNav.svelte.d.ts +15 -0
- package/dist/PaginationNav.svelte.d.ts.map +1 -0
- package/dist/ProgressIndicator.svelte +283 -0
- package/dist/ProgressIndicator.svelte.d.ts +18 -0
- package/dist/ProgressIndicator.svelte.d.ts.map +1 -0
- package/dist/StructuredList.svelte +86 -0
- package/dist/StructuredList.svelte.d.ts +15 -0
- package/dist/StructuredList.svelte.d.ts.map +1 -0
- package/dist/TileGroup.svelte +179 -0
- package/dist/TileGroup.svelte.d.ts +21 -0
- package/dist/TileGroup.svelte.d.ts.map +1 -0
- package/dist/UnorderedList.svelte +108 -0
- package/dist/UnorderedList.svelte.d.ts +16 -0
- package/dist/UnorderedList.svelte.d.ts.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -0
- package/package.json +2 -2
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export type ProgressIndicatorStatus =
|
|
3
|
+
| "complete"
|
|
4
|
+
| "current"
|
|
5
|
+
| "upcoming"
|
|
6
|
+
| "invalid"
|
|
7
|
+
| "disabled";
|
|
8
|
+
|
|
9
|
+
export interface ProgressIndicatorItem {
|
|
10
|
+
value: string;
|
|
11
|
+
label: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
status?: ProgressIndicatorStatus;
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<script lang="ts">
|
|
18
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
19
|
+
|
|
20
|
+
type ProgressIndicatorProps = Omit<HTMLAttributes<HTMLOListElement>, "class"> & {
|
|
21
|
+
items: ProgressIndicatorItem[];
|
|
22
|
+
vertical?: boolean;
|
|
23
|
+
label?: string;
|
|
24
|
+
class?: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
let {
|
|
28
|
+
items,
|
|
29
|
+
vertical = false,
|
|
30
|
+
label = "Progress",
|
|
31
|
+
class: className,
|
|
32
|
+
...rest
|
|
33
|
+
}: ProgressIndicatorProps = $props();
|
|
34
|
+
|
|
35
|
+
const classes = () =>
|
|
36
|
+
[
|
|
37
|
+
"st-progressIndicator",
|
|
38
|
+
vertical ? "st-progressIndicator--vertical" : "st-progressIndicator--horizontal",
|
|
39
|
+
className
|
|
40
|
+
]
|
|
41
|
+
.filter(Boolean)
|
|
42
|
+
.join(" ");
|
|
43
|
+
|
|
44
|
+
const resolvedStatus = (item: ProgressIndicatorItem): ProgressIndicatorStatus =>
|
|
45
|
+
item.status ?? "upcoming";
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<ol {...rest} class={classes()} aria-label={label}>
|
|
49
|
+
{#each items as item, index (item.value)}
|
|
50
|
+
{@const status = resolvedStatus(item)}
|
|
51
|
+
{@const isLast = index === items.length - 1}
|
|
52
|
+
<li
|
|
53
|
+
class={["st-progressIndicator__step", `st-progressIndicator__step--${status}`].join(" ")}
|
|
54
|
+
aria-current={status === "current" ? "step" : undefined}
|
|
55
|
+
>
|
|
56
|
+
<span class="st-progressIndicator__indicator" aria-hidden="true">
|
|
57
|
+
<span class="st-progressIndicator__circle">
|
|
58
|
+
{#if status === "complete"}
|
|
59
|
+
<svg viewBox="0 0 16 16" width="14" height="14" focusable="false">
|
|
60
|
+
<path
|
|
61
|
+
d="m3 8 3.5 3.5L13 5"
|
|
62
|
+
fill="none"
|
|
63
|
+
stroke="currentColor"
|
|
64
|
+
stroke-width="1.6"
|
|
65
|
+
stroke-linecap="round"
|
|
66
|
+
stroke-linejoin="round"
|
|
67
|
+
/>
|
|
68
|
+
</svg>
|
|
69
|
+
{:else if status === "invalid"}
|
|
70
|
+
<svg viewBox="0 0 16 16" width="14" height="14" focusable="false">
|
|
71
|
+
<path
|
|
72
|
+
d="M4 4l8 8M12 4l-8 8"
|
|
73
|
+
fill="none"
|
|
74
|
+
stroke="currentColor"
|
|
75
|
+
stroke-width="1.6"
|
|
76
|
+
stroke-linecap="round"
|
|
77
|
+
/>
|
|
78
|
+
</svg>
|
|
79
|
+
{:else if status === "current"}
|
|
80
|
+
<span class="st-progressIndicator__dot"></span>
|
|
81
|
+
{:else}
|
|
82
|
+
<span class="st-progressIndicator__index">{index + 1}</span>
|
|
83
|
+
{/if}
|
|
84
|
+
</span>
|
|
85
|
+
{#if !isLast}
|
|
86
|
+
<span class="st-progressIndicator__connector"></span>
|
|
87
|
+
{/if}
|
|
88
|
+
</span>
|
|
89
|
+
<span class="st-progressIndicator__text">
|
|
90
|
+
<span class="st-progressIndicator__label">{item.label}</span>
|
|
91
|
+
{#if item.description}
|
|
92
|
+
<span class="st-progressIndicator__description">{item.description}</span>
|
|
93
|
+
{/if}
|
|
94
|
+
</span>
|
|
95
|
+
</li>
|
|
96
|
+
{/each}
|
|
97
|
+
</ol>
|
|
98
|
+
|
|
99
|
+
<style>
|
|
100
|
+
.st-progressIndicator {
|
|
101
|
+
color: var(--st-component-progressIndicator-text, var(--st-semantic-text-primary));
|
|
102
|
+
display: flex;
|
|
103
|
+
list-style: none;
|
|
104
|
+
margin: 0;
|
|
105
|
+
padding: 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.st-progressIndicator--horizontal {
|
|
109
|
+
align-items: flex-start;
|
|
110
|
+
flex-direction: row;
|
|
111
|
+
gap: 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.st-progressIndicator--vertical {
|
|
115
|
+
flex-direction: column;
|
|
116
|
+
gap: 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.st-progressIndicator__step {
|
|
120
|
+
display: flex;
|
|
121
|
+
flex: 1 1 0;
|
|
122
|
+
gap: var(--st-spacing-2, 0.5rem);
|
|
123
|
+
min-width: 0;
|
|
124
|
+
position: relative;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.st-progressIndicator--horizontal .st-progressIndicator__step {
|
|
128
|
+
align-items: flex-start;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.st-progressIndicator--vertical .st-progressIndicator__step {
|
|
133
|
+
align-items: flex-start;
|
|
134
|
+
flex: 0 0 auto;
|
|
135
|
+
flex-direction: row;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.st-progressIndicator__indicator {
|
|
139
|
+
align-items: center;
|
|
140
|
+
color: var(--st-component-progressIndicator-iconText, var(--st-semantic-text-secondary));
|
|
141
|
+
display: flex;
|
|
142
|
+
flex: 0 0 auto;
|
|
143
|
+
justify-content: center;
|
|
144
|
+
position: relative;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.st-progressIndicator--horizontal .st-progressIndicator__indicator {
|
|
148
|
+
flex-direction: row;
|
|
149
|
+
width: 100%;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.st-progressIndicator--vertical .st-progressIndicator__indicator {
|
|
153
|
+
flex-direction: column;
|
|
154
|
+
min-height: 3rem;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.st-progressIndicator__circle {
|
|
158
|
+
align-items: center;
|
|
159
|
+
background: var(--st-component-progressIndicator-circleBackground, var(--st-semantic-surface-default));
|
|
160
|
+
border: 1.5px solid
|
|
161
|
+
var(--st-component-progressIndicator-circleBorder, var(--st-semantic-border-strong));
|
|
162
|
+
border-radius: 50%;
|
|
163
|
+
color: var(--st-component-progressIndicator-iconText, var(--st-semantic-text-secondary));
|
|
164
|
+
display: inline-flex;
|
|
165
|
+
flex: 0 0 auto;
|
|
166
|
+
font-size: 0.75rem;
|
|
167
|
+
font-weight: 600;
|
|
168
|
+
height: 1.5rem;
|
|
169
|
+
justify-content: center;
|
|
170
|
+
line-height: 1;
|
|
171
|
+
width: 1.5rem;
|
|
172
|
+
z-index: 1;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.st-progressIndicator__index {
|
|
176
|
+
line-height: 1;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.st-progressIndicator__dot {
|
|
180
|
+
background: currentColor;
|
|
181
|
+
border-radius: 50%;
|
|
182
|
+
height: 0.5rem;
|
|
183
|
+
width: 0.5rem;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.st-progressIndicator__connector {
|
|
187
|
+
background: var(--st-component-progressIndicator-connector, var(--st-semantic-border-subtle));
|
|
188
|
+
flex: 1 1 auto;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.st-progressIndicator--horizontal .st-progressIndicator__connector {
|
|
192
|
+
height: 2px;
|
|
193
|
+
margin-top: calc(0.75rem - 1px);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.st-progressIndicator--vertical .st-progressIndicator__connector {
|
|
197
|
+
margin-left: calc(0.75rem - 1px);
|
|
198
|
+
min-height: 1.5rem;
|
|
199
|
+
width: 2px;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.st-progressIndicator__text {
|
|
203
|
+
display: grid;
|
|
204
|
+
gap: 0.125rem;
|
|
205
|
+
min-width: 0;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.st-progressIndicator--horizontal .st-progressIndicator__text {
|
|
209
|
+
padding-right: var(--st-spacing-3, 0.75rem);
|
|
210
|
+
padding-top: var(--st-spacing-2, 0.5rem);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.st-progressIndicator--vertical .st-progressIndicator__text {
|
|
214
|
+
padding-bottom: var(--st-spacing-3, 0.75rem);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.st-progressIndicator__label {
|
|
218
|
+
color: var(--st-component-progressIndicator-text, var(--st-semantic-text-primary));
|
|
219
|
+
font-size: 0.875rem;
|
|
220
|
+
font-weight: 600;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.st-progressIndicator__description {
|
|
224
|
+
color: var(--st-component-progressIndicator-descriptionText, var(--st-semantic-text-secondary));
|
|
225
|
+
font-size: 0.8125rem;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* Status: complete */
|
|
229
|
+
.st-progressIndicator__step--complete .st-progressIndicator__circle {
|
|
230
|
+
background: var(
|
|
231
|
+
--st-component-progressIndicator-completeBackground,
|
|
232
|
+
var(--st-semantic-action-primary)
|
|
233
|
+
);
|
|
234
|
+
border-color: var(
|
|
235
|
+
--st-component-progressIndicator-completeBackground,
|
|
236
|
+
var(--st-semantic-action-primary)
|
|
237
|
+
);
|
|
238
|
+
color: var(--st-component-progressIndicator-completeIcon, var(--st-semantic-action-primaryText));
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.st-progressIndicator__step--complete .st-progressIndicator__connector {
|
|
242
|
+
background: var(
|
|
243
|
+
--st-component-progressIndicator-completeConnector,
|
|
244
|
+
var(--st-semantic-action-primary)
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/* Status: current */
|
|
249
|
+
.st-progressIndicator__step--current .st-progressIndicator__circle {
|
|
250
|
+
border-color: var(
|
|
251
|
+
--st-component-progressIndicator-currentBorder,
|
|
252
|
+
var(--st-semantic-action-primary)
|
|
253
|
+
);
|
|
254
|
+
color: var(--st-component-progressIndicator-currentText, var(--st-semantic-action-primary));
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.st-progressIndicator__step--current .st-progressIndicator__label {
|
|
258
|
+
color: var(--st-component-progressIndicator-currentText, var(--st-semantic-action-primary));
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/* Status: invalid */
|
|
262
|
+
.st-progressIndicator__step--invalid .st-progressIndicator__circle {
|
|
263
|
+
border-color: var(
|
|
264
|
+
--st-component-progressIndicator-invalidBorder,
|
|
265
|
+
var(--st-semantic-feedback-error)
|
|
266
|
+
);
|
|
267
|
+
color: var(--st-component-progressIndicator-invalidText, var(--st-semantic-feedback-error));
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.st-progressIndicator__step--invalid .st-progressIndicator__label {
|
|
271
|
+
color: var(--st-component-progressIndicator-invalidText, var(--st-semantic-feedback-error));
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/* Status: disabled */
|
|
275
|
+
.st-progressIndicator__step--disabled {
|
|
276
|
+
opacity: 0.55;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.st-progressIndicator__step--disabled .st-progressIndicator__label,
|
|
280
|
+
.st-progressIndicator__step--disabled .st-progressIndicator__description {
|
|
281
|
+
color: var(--st-component-progressIndicator-disabledText, var(--st-semantic-text-muted));
|
|
282
|
+
}
|
|
283
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ProgressIndicatorStatus = "complete" | "current" | "upcoming" | "invalid" | "disabled";
|
|
2
|
+
export interface ProgressIndicatorItem {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
status?: ProgressIndicatorStatus;
|
|
7
|
+
}
|
|
8
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
9
|
+
type ProgressIndicatorProps = Omit<HTMLAttributes<HTMLOListElement>, "class"> & {
|
|
10
|
+
items: ProgressIndicatorItem[];
|
|
11
|
+
vertical?: boolean;
|
|
12
|
+
label?: string;
|
|
13
|
+
class?: string;
|
|
14
|
+
};
|
|
15
|
+
declare const ProgressIndicator: import("svelte").Component<ProgressIndicatorProps, {}, "">;
|
|
16
|
+
type ProgressIndicator = ReturnType<typeof ProgressIndicator>;
|
|
17
|
+
export default ProgressIndicator;
|
|
18
|
+
//# sourceMappingURL=ProgressIndicator.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressIndicator.svelte.d.ts","sourceRoot":"","sources":["../src/lib/ProgressIndicator.svelte.ts"],"names":[],"mappings":"AAGE,MAAM,MAAM,uBAAuB,GAC/B,UAAU,GACV,SAAS,GACT,UAAU,GACV,SAAS,GACT,UAAU,CAAC;AAEf,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,uBAAuB,CAAC;CAClC;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGpD,KAAK,sBAAsB,GAAG,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,GAAG;IAC9E,KAAK,EAAE,qBAAqB,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAmEJ,QAAA,MAAM,iBAAiB,4DAAwC,CAAC;AAChE,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
|
|
4
|
+
export interface StructuredListItem {
|
|
5
|
+
key: string;
|
|
6
|
+
value: string | Snippet;
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
12
|
+
|
|
13
|
+
type StructuredListProps = Omit<HTMLAttributes<HTMLDListElement>, "class"> & {
|
|
14
|
+
items: StructuredListItem[];
|
|
15
|
+
bordered?: boolean;
|
|
16
|
+
class?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
let {
|
|
20
|
+
items,
|
|
21
|
+
bordered = true,
|
|
22
|
+
class: className,
|
|
23
|
+
...rest
|
|
24
|
+
}: StructuredListProps = $props();
|
|
25
|
+
|
|
26
|
+
const classes = () =>
|
|
27
|
+
["st-structuredList", bordered ? "st-structuredList--bordered" : null, className]
|
|
28
|
+
.filter(Boolean)
|
|
29
|
+
.join(" ");
|
|
30
|
+
|
|
31
|
+
function isSnippet(value: string | Snippet): value is Snippet {
|
|
32
|
+
return typeof value === "function";
|
|
33
|
+
}
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<dl {...rest} class={classes()}>
|
|
37
|
+
{#each items as item (item.key)}
|
|
38
|
+
<div class="st-structuredList__row">
|
|
39
|
+
<dt class="st-structuredList__term">{item.key}</dt>
|
|
40
|
+
<dd class="st-structuredList__definition">
|
|
41
|
+
{#if isSnippet(item.value)}
|
|
42
|
+
{@render item.value()}
|
|
43
|
+
{:else}
|
|
44
|
+
{item.value}
|
|
45
|
+
{/if}
|
|
46
|
+
</dd>
|
|
47
|
+
</div>
|
|
48
|
+
{/each}
|
|
49
|
+
</dl>
|
|
50
|
+
|
|
51
|
+
<style>
|
|
52
|
+
.st-structuredList {
|
|
53
|
+
color: var(--st-semantic-text-primary);
|
|
54
|
+
display: grid;
|
|
55
|
+
margin: 0;
|
|
56
|
+
width: 100%;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.st-structuredList--bordered {
|
|
60
|
+
border-block-start: 1px solid
|
|
61
|
+
var(--st-component-structuredList-border, var(--st-semantic-border-subtle));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.st-structuredList__row {
|
|
65
|
+
align-items: baseline;
|
|
66
|
+
display: grid;
|
|
67
|
+
gap: var(--st-spacing-3, 0.75rem);
|
|
68
|
+
grid-template-columns: minmax(8rem, 1fr) 2fr;
|
|
69
|
+
padding: 0.75rem 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.st-structuredList--bordered .st-structuredList__row {
|
|
73
|
+
border-block-end: 1px solid
|
|
74
|
+
var(--st-component-structuredList-border, var(--st-semantic-border-subtle));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.st-structuredList__term {
|
|
78
|
+
color: var(--st-semantic-text-secondary);
|
|
79
|
+
font-weight: 600;
|
|
80
|
+
margin: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.st-structuredList__definition {
|
|
84
|
+
margin: 0;
|
|
85
|
+
}
|
|
86
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
export interface StructuredListItem {
|
|
3
|
+
key: string;
|
|
4
|
+
value: string | Snippet;
|
|
5
|
+
}
|
|
6
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
7
|
+
type StructuredListProps = Omit<HTMLAttributes<HTMLDListElement>, "class"> & {
|
|
8
|
+
items: StructuredListItem[];
|
|
9
|
+
bordered?: boolean;
|
|
10
|
+
class?: string;
|
|
11
|
+
};
|
|
12
|
+
declare const StructuredList: import("svelte").Component<StructuredListProps, {}, "">;
|
|
13
|
+
type StructuredList = ReturnType<typeof StructuredList>;
|
|
14
|
+
export default StructuredList;
|
|
15
|
+
//# sourceMappingURL=StructuredList.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StructuredList.svelte.d.ts","sourceRoot":"","sources":["../src/lib/StructuredList.svelte.ts"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CACzB;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGpD,KAAK,mBAAmB,GAAG,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,GAAG;IAC3E,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AA2CJ,QAAA,MAAM,cAAc,yDAAwC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export interface TileGroupItem {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
12
|
+
|
|
13
|
+
type TileGroupProps = Omit<
|
|
14
|
+
HTMLAttributes<HTMLFieldSetElement>,
|
|
15
|
+
"class" | "onchange"
|
|
16
|
+
> & {
|
|
17
|
+
items: TileGroupItem[];
|
|
18
|
+
value?: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
legend?: string;
|
|
21
|
+
legendHidden?: boolean;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
class?: string;
|
|
24
|
+
onchange?: (value: string) => void;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
let {
|
|
28
|
+
items,
|
|
29
|
+
value = $bindable<string | undefined>(undefined),
|
|
30
|
+
name,
|
|
31
|
+
legend,
|
|
32
|
+
legendHidden = false,
|
|
33
|
+
disabled = false,
|
|
34
|
+
class: className,
|
|
35
|
+
onchange,
|
|
36
|
+
...rest
|
|
37
|
+
}: TileGroupProps = $props();
|
|
38
|
+
|
|
39
|
+
const groupId = $props.id();
|
|
40
|
+
const groupName = $derived(name ?? `st-tileGroup-${groupId}`);
|
|
41
|
+
|
|
42
|
+
const classes = () =>
|
|
43
|
+
["st-tileGroup", disabled ? "st-tileGroup--disabled" : null, className]
|
|
44
|
+
.filter(Boolean)
|
|
45
|
+
.join(" ");
|
|
46
|
+
|
|
47
|
+
function select(next: string, itemDisabled?: boolean) {
|
|
48
|
+
if (disabled || itemDisabled) return;
|
|
49
|
+
value = next;
|
|
50
|
+
onchange?.(next);
|
|
51
|
+
}
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<fieldset {...rest} class={classes()} {disabled}>
|
|
55
|
+
{#if legend}
|
|
56
|
+
<legend class={legendHidden ? "st-tileGroup__legend st-tileGroup__legend--hidden" : "st-tileGroup__legend"}
|
|
57
|
+
>{legend}</legend>
|
|
58
|
+
{/if}
|
|
59
|
+
<div class="st-tileGroup__items">
|
|
60
|
+
{#each items as item (item.value)}
|
|
61
|
+
{@const checked = value === item.value}
|
|
62
|
+
<label
|
|
63
|
+
class="st-tileGroup__tile"
|
|
64
|
+
class:st-tileGroup__tile--checked={checked}
|
|
65
|
+
class:st-tileGroup__tile--disabled={item.disabled || disabled}
|
|
66
|
+
>
|
|
67
|
+
<input
|
|
68
|
+
type="radio"
|
|
69
|
+
class="st-tileGroup__input"
|
|
70
|
+
name={groupName}
|
|
71
|
+
value={item.value}
|
|
72
|
+
{checked}
|
|
73
|
+
disabled={item.disabled || disabled}
|
|
74
|
+
onchange={() => select(item.value, item.disabled)}
|
|
75
|
+
/>
|
|
76
|
+
<span class="st-tileGroup__content">
|
|
77
|
+
<span class="st-tileGroup__label">{item.label}</span>
|
|
78
|
+
{#if item.description}
|
|
79
|
+
<span class="st-tileGroup__description">{item.description}</span>
|
|
80
|
+
{/if}
|
|
81
|
+
</span>
|
|
82
|
+
</label>
|
|
83
|
+
{/each}
|
|
84
|
+
</div>
|
|
85
|
+
</fieldset>
|
|
86
|
+
|
|
87
|
+
<style>
|
|
88
|
+
.st-tileGroup {
|
|
89
|
+
border: 0;
|
|
90
|
+
color: var(--st-semantic-text-primary);
|
|
91
|
+
margin: 0;
|
|
92
|
+
min-width: 0;
|
|
93
|
+
padding: 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.st-tileGroup__legend {
|
|
97
|
+
color: var(--st-component-field-labelText, var(--st-semantic-text-primary));
|
|
98
|
+
font-weight: 600;
|
|
99
|
+
margin-block-end: var(--st-spacing-2, 0.5rem);
|
|
100
|
+
padding: 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.st-tileGroup__legend--hidden {
|
|
104
|
+
border: 0;
|
|
105
|
+
clip: rect(0 0 0 0);
|
|
106
|
+
height: 1px;
|
|
107
|
+
margin: -1px;
|
|
108
|
+
overflow: hidden;
|
|
109
|
+
padding: 0;
|
|
110
|
+
position: absolute;
|
|
111
|
+
white-space: nowrap;
|
|
112
|
+
width: 1px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.st-tileGroup__items {
|
|
116
|
+
display: grid;
|
|
117
|
+
gap: var(--st-spacing-2, 0.5rem);
|
|
118
|
+
grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.st-tileGroup__tile {
|
|
122
|
+
background: var(--st-component-card-background, var(--st-semantic-surface-raised));
|
|
123
|
+
border: 1px solid
|
|
124
|
+
var(--st-component-card-border, var(--st-semantic-border-subtle));
|
|
125
|
+
border-radius: var(--st-component-card-radius, 0.5rem);
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
display: grid;
|
|
128
|
+
gap: 0.5rem;
|
|
129
|
+
grid-template-columns: auto 1fr;
|
|
130
|
+
padding: 0.875rem 1rem;
|
|
131
|
+
transition:
|
|
132
|
+
border-color var(--st-motion-fast, 120ms) var(--st-motion-easing, ease),
|
|
133
|
+
box-shadow var(--st-motion-fast, 120ms) var(--st-motion-easing, ease);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.st-tileGroup__tile:hover:not(.st-tileGroup__tile--disabled) {
|
|
137
|
+
border-color: var(
|
|
138
|
+
--st-component-control-hoverBorder,
|
|
139
|
+
var(--st-semantic-border-strong)
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.st-tileGroup__tile--checked {
|
|
144
|
+
border-color: var(
|
|
145
|
+
--st-component-control-focusRing,
|
|
146
|
+
var(--st-semantic-border-interactive)
|
|
147
|
+
);
|
|
148
|
+
box-shadow: 0 0 0 1px
|
|
149
|
+
var(--st-component-control-focusRing, var(--st-semantic-border-interactive));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.st-tileGroup__tile--disabled {
|
|
153
|
+
cursor: not-allowed;
|
|
154
|
+
opacity: 0.55;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.st-tileGroup__input {
|
|
158
|
+
accent-color: var(
|
|
159
|
+
--st-component-control-focusRing,
|
|
160
|
+
var(--st-semantic-border-interactive)
|
|
161
|
+
);
|
|
162
|
+
margin: 0.25rem 0 0;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.st-tileGroup__content {
|
|
166
|
+
display: grid;
|
|
167
|
+
gap: 0.25rem;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.st-tileGroup__label {
|
|
171
|
+
font-size: 0.9375rem;
|
|
172
|
+
font-weight: 600;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.st-tileGroup__description {
|
|
176
|
+
color: var(--st-component-field-helpText, var(--st-semantic-text-secondary));
|
|
177
|
+
font-size: 0.8125rem;
|
|
178
|
+
}
|
|
179
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface TileGroupItem {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
8
|
+
type TileGroupProps = Omit<HTMLAttributes<HTMLFieldSetElement>, "class" | "onchange"> & {
|
|
9
|
+
items: TileGroupItem[];
|
|
10
|
+
value?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
legend?: string;
|
|
13
|
+
legendHidden?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
class?: string;
|
|
16
|
+
onchange?: (value: string) => void;
|
|
17
|
+
};
|
|
18
|
+
declare const TileGroup: import("svelte").Component<TileGroupProps, {}, "value">;
|
|
19
|
+
type TileGroup = ReturnType<typeof TileGroup>;
|
|
20
|
+
export default TileGroup;
|
|
21
|
+
//# sourceMappingURL=TileGroup.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TileGroup.svelte.d.ts","sourceRoot":"","sources":["../src/lib/TileGroup.svelte.ts"],"names":[],"mappings":"AAGE,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGpD,KAAK,cAAc,GAAG,IAAI,CACxB,cAAc,CAAC,mBAAmB,CAAC,EACnC,OAAO,GAAG,UAAU,CACrB,GAAG;IACF,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;AA0DJ,QAAA,MAAM,SAAS,yDAAwC,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}
|