@sentropic/design-system-svelte 0.4.1 → 0.6.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/ContentSwitcher.svelte +126 -0
- package/dist/ContentSwitcher.svelte.d.ts +17 -0
- package/dist/ContentSwitcher.svelte.d.ts.map +1 -0
- package/dist/CopyButton.svelte +132 -0
- package/dist/CopyButton.svelte.d.ts +15 -0
- package/dist/CopyButton.svelte.d.ts.map +1 -0
- package/dist/DatePicker.svelte +680 -0
- package/dist/DatePicker.svelte.d.ts +34 -0
- package/dist/DatePicker.svelte.d.ts.map +1 -0
- package/dist/FileUploader.svelte +431 -0
- package/dist/FileUploader.svelte.d.ts +30 -0
- package/dist/FileUploader.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/InlineLoading.svelte +81 -0
- package/dist/InlineLoading.svelte.d.ts +10 -0
- package/dist/InlineLoading.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/SkeletonText.svelte +79 -0
- package/dist/SkeletonText.svelte.d.ts +12 -0
- package/dist/SkeletonText.svelte.d.ts.map +1 -0
- package/dist/Toggletip.svelte +148 -0
- package/dist/Toggletip.svelte.d.ts +14 -0
- package/dist/Toggletip.svelte.d.ts.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -0
- package/package.json +2 -2
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
|
|
4
|
+
type PaginationNavProps = Omit<HTMLAttributes<HTMLElement>, "class"> & {
|
|
5
|
+
page: number;
|
|
6
|
+
pageCount: number;
|
|
7
|
+
siblings?: number;
|
|
8
|
+
label?: string;
|
|
9
|
+
previousLabel?: string;
|
|
10
|
+
nextLabel?: string;
|
|
11
|
+
class?: string;
|
|
12
|
+
onPageChange?: (page: number) => void;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
page = $bindable(1),
|
|
17
|
+
pageCount,
|
|
18
|
+
siblings = 1,
|
|
19
|
+
label = "Pagination",
|
|
20
|
+
previousLabel = "Previous page",
|
|
21
|
+
nextLabel = "Next page",
|
|
22
|
+
class: className,
|
|
23
|
+
onPageChange,
|
|
24
|
+
...rest
|
|
25
|
+
}: PaginationNavProps = $props();
|
|
26
|
+
|
|
27
|
+
type Slot = number | "ellipsis-start" | "ellipsis-end";
|
|
28
|
+
|
|
29
|
+
const classes = () => ["st-paginationNav", className].filter(Boolean).join(" ");
|
|
30
|
+
|
|
31
|
+
const slots = $derived.by<Slot[]>(() => {
|
|
32
|
+
const total = Math.max(0, Math.floor(pageCount));
|
|
33
|
+
if (total <= 0) return [];
|
|
34
|
+
|
|
35
|
+
const current = Math.min(Math.max(1, Math.floor(page)), total);
|
|
36
|
+
const sib = Math.max(0, Math.floor(siblings));
|
|
37
|
+
|
|
38
|
+
// Minimum: first, last, current, sib left, sib right, two ellipses
|
|
39
|
+
const minSlots = sib * 2 + 5;
|
|
40
|
+
if (total <= minSlots) {
|
|
41
|
+
return Array.from({ length: total }, (_, i) => i + 1) as Slot[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const leftSibling = Math.max(current - sib, 1);
|
|
45
|
+
const rightSibling = Math.min(current + sib, total);
|
|
46
|
+
const showLeftEllipsis = leftSibling > 2;
|
|
47
|
+
const showRightEllipsis = rightSibling < total - 1;
|
|
48
|
+
|
|
49
|
+
const result: Slot[] = [];
|
|
50
|
+
|
|
51
|
+
if (!showLeftEllipsis && showRightEllipsis) {
|
|
52
|
+
const leftItemCount = 3 + sib * 2;
|
|
53
|
+
for (let i = 1; i <= leftItemCount; i += 1) result.push(i);
|
|
54
|
+
result.push("ellipsis-end");
|
|
55
|
+
result.push(total);
|
|
56
|
+
} else if (showLeftEllipsis && !showRightEllipsis) {
|
|
57
|
+
result.push(1);
|
|
58
|
+
result.push("ellipsis-start");
|
|
59
|
+
const rightItemCount = 3 + sib * 2;
|
|
60
|
+
for (let i = total - rightItemCount + 1; i <= total; i += 1) result.push(i);
|
|
61
|
+
} else if (showLeftEllipsis && showRightEllipsis) {
|
|
62
|
+
result.push(1);
|
|
63
|
+
result.push("ellipsis-start");
|
|
64
|
+
for (let i = leftSibling; i <= rightSibling; i += 1) result.push(i);
|
|
65
|
+
result.push("ellipsis-end");
|
|
66
|
+
result.push(total);
|
|
67
|
+
} else {
|
|
68
|
+
for (let i = 1; i <= total; i += 1) result.push(i);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return result;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
function go(target: number) {
|
|
75
|
+
const total = Math.max(0, Math.floor(pageCount));
|
|
76
|
+
if (target < 1 || target > total || target === page) return;
|
|
77
|
+
page = target;
|
|
78
|
+
onPageChange?.(target);
|
|
79
|
+
}
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<nav {...rest} class={classes()} aria-label={label}>
|
|
83
|
+
<ul class="st-paginationNav__list">
|
|
84
|
+
<li>
|
|
85
|
+
<button
|
|
86
|
+
type="button"
|
|
87
|
+
class="st-paginationNav__nav"
|
|
88
|
+
aria-label={previousLabel}
|
|
89
|
+
disabled={page <= 1 || pageCount <= 0}
|
|
90
|
+
onclick={() => go(page - 1)}
|
|
91
|
+
>
|
|
92
|
+
<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true" focusable="false">
|
|
93
|
+
<path
|
|
94
|
+
d="M10 3 5 8l5 5"
|
|
95
|
+
fill="none"
|
|
96
|
+
stroke="currentColor"
|
|
97
|
+
stroke-width="1.6"
|
|
98
|
+
stroke-linecap="round"
|
|
99
|
+
stroke-linejoin="round"
|
|
100
|
+
/>
|
|
101
|
+
</svg>
|
|
102
|
+
</button>
|
|
103
|
+
</li>
|
|
104
|
+
{#each slots as slot, index (typeof slot === "number" ? `p-${slot}` : `${slot}-${index}`)}
|
|
105
|
+
<li>
|
|
106
|
+
{#if slot === "ellipsis-start" || slot === "ellipsis-end"}
|
|
107
|
+
<span class="st-paginationNav__ellipsis" aria-hidden="true">…</span>
|
|
108
|
+
{:else}
|
|
109
|
+
<button
|
|
110
|
+
type="button"
|
|
111
|
+
class="st-paginationNav__page"
|
|
112
|
+
class:st-paginationNav__page--active={slot === page}
|
|
113
|
+
aria-label={`Page ${slot}`}
|
|
114
|
+
aria-current={slot === page ? "page" : undefined}
|
|
115
|
+
onclick={() => go(slot)}
|
|
116
|
+
>
|
|
117
|
+
{slot}
|
|
118
|
+
</button>
|
|
119
|
+
{/if}
|
|
120
|
+
</li>
|
|
121
|
+
{/each}
|
|
122
|
+
<li>
|
|
123
|
+
<button
|
|
124
|
+
type="button"
|
|
125
|
+
class="st-paginationNav__nav"
|
|
126
|
+
aria-label={nextLabel}
|
|
127
|
+
disabled={page >= pageCount || pageCount <= 0}
|
|
128
|
+
onclick={() => go(page + 1)}
|
|
129
|
+
>
|
|
130
|
+
<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true" focusable="false">
|
|
131
|
+
<path
|
|
132
|
+
d="M6 3l5 5-5 5"
|
|
133
|
+
fill="none"
|
|
134
|
+
stroke="currentColor"
|
|
135
|
+
stroke-width="1.6"
|
|
136
|
+
stroke-linecap="round"
|
|
137
|
+
stroke-linejoin="round"
|
|
138
|
+
/>
|
|
139
|
+
</svg>
|
|
140
|
+
</button>
|
|
141
|
+
</li>
|
|
142
|
+
</ul>
|
|
143
|
+
</nav>
|
|
144
|
+
|
|
145
|
+
<style>
|
|
146
|
+
.st-paginationNav {
|
|
147
|
+
color: var(--st-component-paginationNav-text, var(--st-semantic-text-primary));
|
|
148
|
+
display: inline-block;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.st-paginationNav__list {
|
|
152
|
+
align-items: center;
|
|
153
|
+
display: flex;
|
|
154
|
+
flex-wrap: wrap;
|
|
155
|
+
gap: var(--st-spacing-1, 0.25rem);
|
|
156
|
+
list-style: none;
|
|
157
|
+
margin: 0;
|
|
158
|
+
padding: 0;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.st-paginationNav__page,
|
|
162
|
+
.st-paginationNav__nav {
|
|
163
|
+
align-items: center;
|
|
164
|
+
background: var(--st-component-paginationNav-background, var(--st-semantic-surface-default));
|
|
165
|
+
border: 1px solid var(--st-component-paginationNav-border, var(--st-semantic-border-subtle));
|
|
166
|
+
border-radius: var(--st-component-paginationNav-radius, 0.375rem);
|
|
167
|
+
color: var(--st-component-paginationNav-text, var(--st-semantic-text-primary));
|
|
168
|
+
cursor: pointer;
|
|
169
|
+
display: inline-flex;
|
|
170
|
+
font: inherit;
|
|
171
|
+
font-size: 0.875rem;
|
|
172
|
+
height: 2.25rem;
|
|
173
|
+
justify-content: center;
|
|
174
|
+
min-width: 2.25rem;
|
|
175
|
+
padding: 0 0.5rem;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.st-paginationNav__page:hover:not(:disabled),
|
|
179
|
+
.st-paginationNav__nav:hover:not(:disabled) {
|
|
180
|
+
background: var(
|
|
181
|
+
--st-component-paginationNav-hoverBackground,
|
|
182
|
+
var(--st-semantic-surface-subtle)
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.st-paginationNav__page:focus-visible,
|
|
187
|
+
.st-paginationNav__nav:focus-visible {
|
|
188
|
+
border-color: var(--st-component-control-focusRing, var(--st-semantic-border-interactive));
|
|
189
|
+
box-shadow: 0 0 0 2px var(--st-component-control-focusRing, var(--st-semantic-border-interactive));
|
|
190
|
+
outline: none;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.st-paginationNav__page--active {
|
|
194
|
+
background: var(--st-component-paginationNav-activeBackground, var(--st-semantic-action-primary));
|
|
195
|
+
border-color: var(--st-component-paginationNav-activeBackground, var(--st-semantic-action-primary));
|
|
196
|
+
color: var(--st-component-paginationNav-activeText, var(--st-semantic-action-primaryText));
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.st-paginationNav__page--active:hover {
|
|
200
|
+
background: var(--st-component-paginationNav-activeBackground, var(--st-semantic-action-primary));
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.st-paginationNav__page:disabled,
|
|
204
|
+
.st-paginationNav__nav:disabled {
|
|
205
|
+
color: var(--st-component-paginationNav-disabledText, var(--st-semantic-text-muted));
|
|
206
|
+
cursor: not-allowed;
|
|
207
|
+
opacity: 0.6;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.st-paginationNav__ellipsis {
|
|
211
|
+
align-items: center;
|
|
212
|
+
color: var(--st-component-paginationNav-ellipsisText, var(--st-semantic-text-muted));
|
|
213
|
+
display: inline-flex;
|
|
214
|
+
height: 2.25rem;
|
|
215
|
+
justify-content: center;
|
|
216
|
+
min-width: 2.25rem;
|
|
217
|
+
padding: 0 0.25rem;
|
|
218
|
+
}
|
|
219
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
+
type PaginationNavProps = Omit<HTMLAttributes<HTMLElement>, "class"> & {
|
|
3
|
+
page: number;
|
|
4
|
+
pageCount: number;
|
|
5
|
+
siblings?: number;
|
|
6
|
+
label?: string;
|
|
7
|
+
previousLabel?: string;
|
|
8
|
+
nextLabel?: string;
|
|
9
|
+
class?: string;
|
|
10
|
+
onPageChange?: (page: number) => void;
|
|
11
|
+
};
|
|
12
|
+
declare const PaginationNav: import("svelte").Component<PaginationNavProps, {}, "page">;
|
|
13
|
+
type PaginationNav = ReturnType<typeof PaginationNav>;
|
|
14
|
+
export default PaginationNav;
|
|
15
|
+
//# sourceMappingURL=PaginationNav.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaginationNav.svelte.d.ts","sourceRoot":"","sources":["../src/lib/PaginationNav.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGpD,KAAK,kBAAkB,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,GAAG;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC,CAAC;AA2GJ,QAAA,MAAM,aAAa,4DAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
|
|
@@ -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,79 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
|
|
4
|
+
type SkeletonTextProps = Omit<HTMLAttributes<HTMLDivElement>, "class"> & {
|
|
5
|
+
lines?: number;
|
|
6
|
+
width?: string;
|
|
7
|
+
heading?: boolean;
|
|
8
|
+
paragraph?: boolean;
|
|
9
|
+
class?: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
lines = 1,
|
|
14
|
+
width,
|
|
15
|
+
heading = false,
|
|
16
|
+
paragraph = false,
|
|
17
|
+
class: className,
|
|
18
|
+
...rest
|
|
19
|
+
}: SkeletonTextProps = $props();
|
|
20
|
+
|
|
21
|
+
const wrapperClasses = () => ["st-skeleton", className].filter(Boolean).join(" ");
|
|
22
|
+
const lineClasses = () =>
|
|
23
|
+
["st-skeleton__line", heading ? "st-skeleton__line--heading" : null].filter(Boolean).join(" ");
|
|
24
|
+
const lineCount = () => (paragraph ? Math.max(lines, 3) : lines);
|
|
25
|
+
|
|
26
|
+
function lineWidth(index: number, total: number): string | undefined {
|
|
27
|
+
if (width && index === 0) return width;
|
|
28
|
+
if (paragraph && index === total - 1) return "60%";
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<div {...rest} class={wrapperClasses()} role="status" aria-label="Loading…" aria-busy="true">
|
|
34
|
+
{#each Array.from({ length: lineCount() }) as _, i (i)}
|
|
35
|
+
<span class={lineClasses()} style={lineWidth(i, lineCount()) ? `width:${lineWidth(i, lineCount())}` : undefined}></span>
|
|
36
|
+
{/each}
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<style>
|
|
40
|
+
.st-skeleton {
|
|
41
|
+
display: grid;
|
|
42
|
+
gap: 0.5rem;
|
|
43
|
+
width: 100%;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.st-skeleton__line {
|
|
47
|
+
background: linear-gradient(
|
|
48
|
+
90deg,
|
|
49
|
+
var(--st-semantic-surface-subtle, #eaeef2),
|
|
50
|
+
var(--st-semantic-border-subtle, #d8dee4),
|
|
51
|
+
var(--st-semantic-surface-subtle, #eaeef2)
|
|
52
|
+
);
|
|
53
|
+
background-size: 200% 100%;
|
|
54
|
+
border-radius: 0.25rem;
|
|
55
|
+
display: block;
|
|
56
|
+
height: 0.875rem;
|
|
57
|
+
width: 100%;
|
|
58
|
+
animation: st-skeleton-shimmer 1.4s ease-in-out infinite;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.st-skeleton__line--heading {
|
|
62
|
+
height: 1.25rem;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@keyframes st-skeleton-shimmer {
|
|
66
|
+
0% {
|
|
67
|
+
background-position: 200% 0;
|
|
68
|
+
}
|
|
69
|
+
100% {
|
|
70
|
+
background-position: -200% 0;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@media (prefers-reduced-motion: reduce) {
|
|
75
|
+
.st-skeleton__line {
|
|
76
|
+
animation: none;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
+
type SkeletonTextProps = Omit<HTMLAttributes<HTMLDivElement>, "class"> & {
|
|
3
|
+
lines?: number;
|
|
4
|
+
width?: string;
|
|
5
|
+
heading?: boolean;
|
|
6
|
+
paragraph?: boolean;
|
|
7
|
+
class?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const SkeletonText: import("svelte").Component<SkeletonTextProps, {}, "">;
|
|
10
|
+
type SkeletonText = ReturnType<typeof SkeletonText>;
|
|
11
|
+
export default SkeletonText;
|
|
12
|
+
//# sourceMappingURL=SkeletonText.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SkeletonText.svelte.d.ts","sourceRoot":"","sources":["../src/lib/SkeletonText.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGpD,KAAK,iBAAiB,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,GAAG;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAoCJ,QAAA,MAAM,YAAY,uDAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
|