@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,44 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
|
|
5
|
+
type AspectRatioProps = Omit<HTMLAttributes<HTMLDivElement>, "class"> & {
|
|
6
|
+
ratio?: string;
|
|
7
|
+
class?: string;
|
|
8
|
+
children?: Snippet;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
ratio = "16/9",
|
|
13
|
+
class: className,
|
|
14
|
+
children,
|
|
15
|
+
...rest
|
|
16
|
+
}: AspectRatioProps = $props();
|
|
17
|
+
|
|
18
|
+
const classes = () => ["st-aspectRatio", className].filter(Boolean).join(" ");
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<div {...rest} class={classes()} style:aspect-ratio={ratio}>
|
|
22
|
+
{@render children?.()}
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<style>
|
|
26
|
+
.st-aspectRatio {
|
|
27
|
+
display: block;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
position: relative;
|
|
30
|
+
width: 100%;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.st-aspectRatio > :global(*) {
|
|
34
|
+
block-size: 100%;
|
|
35
|
+
inline-size: 100%;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.st-aspectRatio > :global(img),
|
|
39
|
+
.st-aspectRatio > :global(video),
|
|
40
|
+
.st-aspectRatio > :global(iframe) {
|
|
41
|
+
display: block;
|
|
42
|
+
object-fit: cover;
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
type AspectRatioProps = Omit<HTMLAttributes<HTMLDivElement>, "class"> & {
|
|
4
|
+
ratio?: string;
|
|
5
|
+
class?: string;
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
};
|
|
8
|
+
declare const AspectRatio: import("svelte").Component<AspectRatioProps, {}, "">;
|
|
9
|
+
type AspectRatio = ReturnType<typeof AspectRatio>;
|
|
10
|
+
export default AspectRatio;
|
|
11
|
+
//# sourceMappingURL=AspectRatio.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AspectRatio.svelte.d.ts","sourceRoot":"","sources":["../src/lib/AspectRatio.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGpD,KAAK,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,GAAG;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAwBJ,QAAA,MAAM,WAAW,sDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import CopyButton from "./CopyButton.svelte";
|
|
3
|
+
|
|
4
|
+
type CodeSnippetProps = {
|
|
5
|
+
code: string;
|
|
6
|
+
language?: string;
|
|
7
|
+
inline?: boolean;
|
|
8
|
+
copyable?: boolean;
|
|
9
|
+
copyLabel?: string;
|
|
10
|
+
copiedLabel?: string;
|
|
11
|
+
class?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
code,
|
|
16
|
+
language,
|
|
17
|
+
inline = false,
|
|
18
|
+
copyable = true,
|
|
19
|
+
copyLabel = "Copy",
|
|
20
|
+
copiedLabel = "Copied",
|
|
21
|
+
class: className
|
|
22
|
+
}: CodeSnippetProps = $props();
|
|
23
|
+
|
|
24
|
+
const inlineClasses = () =>
|
|
25
|
+
["st-codeSnippet--inline", className].filter(Boolean).join(" ");
|
|
26
|
+
const blockClasses = () => ["st-codeSnippet", className].filter(Boolean).join(" ");
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
{#if inline}
|
|
30
|
+
<code class={inlineClasses()} data-language={language}>{code}</code>
|
|
31
|
+
{:else}
|
|
32
|
+
<div class="st-codeSnippet__wrapper">
|
|
33
|
+
<pre class={blockClasses()} data-language={language}><code
|
|
34
|
+
class="st-codeSnippet__code">{code}</code></pre>
|
|
35
|
+
{#if copyable}
|
|
36
|
+
<span class="st-codeSnippet__copy">
|
|
37
|
+
<CopyButton value={code} size="sm" label={copyLabel} copiedLabel={copiedLabel} />
|
|
38
|
+
</span>
|
|
39
|
+
{/if}
|
|
40
|
+
</div>
|
|
41
|
+
{/if}
|
|
42
|
+
|
|
43
|
+
<style>
|
|
44
|
+
.st-codeSnippet__wrapper {
|
|
45
|
+
position: relative;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.st-codeSnippet {
|
|
49
|
+
background: var(
|
|
50
|
+
--st-component-codeSnippet-background,
|
|
51
|
+
var(--st-semantic-surface-subtle)
|
|
52
|
+
);
|
|
53
|
+
border: 1px solid
|
|
54
|
+
var(--st-component-codeSnippet-border, var(--st-semantic-border-subtle));
|
|
55
|
+
border-radius: var(--st-component-codeSnippet-radius, 0.375rem);
|
|
56
|
+
color: var(--st-component-codeSnippet-text, var(--st-semantic-text-primary));
|
|
57
|
+
font-family: var(--st-font-mono, ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace);
|
|
58
|
+
font-size: 0.8125rem;
|
|
59
|
+
line-height: 1.5;
|
|
60
|
+
margin: 0;
|
|
61
|
+
max-height: var(--st-component-codeSnippet-maxHeight, 16rem);
|
|
62
|
+
overflow: auto;
|
|
63
|
+
padding: 0.75rem 0.875rem;
|
|
64
|
+
padding-inline-end: 4rem;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.st-codeSnippet__code {
|
|
68
|
+
font: inherit;
|
|
69
|
+
white-space: pre;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.st-codeSnippet__copy {
|
|
73
|
+
position: absolute;
|
|
74
|
+
inset-block-start: 0.375rem;
|
|
75
|
+
inset-inline-end: 0.375rem;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.st-codeSnippet--inline {
|
|
79
|
+
background: var(
|
|
80
|
+
--st-component-codeSnippet-background,
|
|
81
|
+
var(--st-semantic-surface-subtle)
|
|
82
|
+
);
|
|
83
|
+
border: 1px solid
|
|
84
|
+
var(--st-component-codeSnippet-border, var(--st-semantic-border-subtle));
|
|
85
|
+
border-radius: var(--st-radius-sm, 0.25rem);
|
|
86
|
+
color: var(--st-component-codeSnippet-text, var(--st-semantic-text-primary));
|
|
87
|
+
font-family: var(--st-font-mono, ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace);
|
|
88
|
+
font-size: 0.8125rem;
|
|
89
|
+
padding: 0.0625rem 0.375rem;
|
|
90
|
+
}
|
|
91
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type CodeSnippetProps = {
|
|
2
|
+
code: string;
|
|
3
|
+
language?: string;
|
|
4
|
+
inline?: boolean;
|
|
5
|
+
copyable?: boolean;
|
|
6
|
+
copyLabel?: string;
|
|
7
|
+
copiedLabel?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
};
|
|
10
|
+
declare const CodeSnippet: import("svelte").Component<CodeSnippetProps, {}, "">;
|
|
11
|
+
type CodeSnippet = ReturnType<typeof CodeSnippet>;
|
|
12
|
+
export default CodeSnippet;
|
|
13
|
+
//# sourceMappingURL=CodeSnippet.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeSnippet.svelte.d.ts","sourceRoot":"","sources":["../src/lib/CodeSnippet.svelte.ts"],"names":[],"mappings":"AAME,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAqCJ,QAAA,MAAM,WAAW,sDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
|
package/dist/Form.svelte
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLFormAttributes } from "svelte/elements";
|
|
4
|
+
|
|
5
|
+
type FormStatus = "idle" | "submitting" | "submitted" | "error";
|
|
6
|
+
|
|
7
|
+
type FormProps = Omit<HTMLFormAttributes, "class" | "onsubmit"> & {
|
|
8
|
+
onsubmit?: (event: SubmitEvent) => void | Promise<void>;
|
|
9
|
+
helperText?: string;
|
|
10
|
+
errorText?: string;
|
|
11
|
+
successText?: string;
|
|
12
|
+
submitting?: boolean;
|
|
13
|
+
noNoscript?: boolean;
|
|
14
|
+
class?: string;
|
|
15
|
+
children: Snippet;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
let {
|
|
19
|
+
onsubmit,
|
|
20
|
+
helperText,
|
|
21
|
+
errorText,
|
|
22
|
+
successText,
|
|
23
|
+
submitting = $bindable(false),
|
|
24
|
+
noNoscript = false,
|
|
25
|
+
class: className,
|
|
26
|
+
children,
|
|
27
|
+
...rest
|
|
28
|
+
}: FormProps = $props();
|
|
29
|
+
|
|
30
|
+
let status = $state<FormStatus>("idle");
|
|
31
|
+
let internalError = $state<string | undefined>(undefined);
|
|
32
|
+
|
|
33
|
+
const classes = () => ["st-form", className].filter(Boolean).join(" ");
|
|
34
|
+
|
|
35
|
+
async function handleSubmit(event: SubmitEvent) {
|
|
36
|
+
if (!onsubmit) return;
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
internalError = undefined;
|
|
39
|
+
status = "submitting";
|
|
40
|
+
submitting = true;
|
|
41
|
+
try {
|
|
42
|
+
await onsubmit(event);
|
|
43
|
+
status = "submitted";
|
|
44
|
+
} catch (err) {
|
|
45
|
+
status = "error";
|
|
46
|
+
internalError = err instanceof Error ? err.message : String(err);
|
|
47
|
+
} finally {
|
|
48
|
+
submitting = false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const resolvedErrorText = () => errorText ?? internalError;
|
|
53
|
+
const showError = () => status === "error" && Boolean(resolvedErrorText());
|
|
54
|
+
const showSuccess = () => status === "submitted" && Boolean(successText);
|
|
55
|
+
const showHelper = () =>
|
|
56
|
+
Boolean(helperText) && !showError() && !showSuccess();
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<form
|
|
60
|
+
{...rest}
|
|
61
|
+
class={classes()}
|
|
62
|
+
onsubmit={handleSubmit}
|
|
63
|
+
aria-busy={status === "submitting" ? "true" : undefined}
|
|
64
|
+
>
|
|
65
|
+
<div class="st-form__body">
|
|
66
|
+
{@render children()}
|
|
67
|
+
</div>
|
|
68
|
+
{#if showError()}
|
|
69
|
+
<p class="st-form__message st-form__message--error" role="alert">
|
|
70
|
+
{resolvedErrorText()}
|
|
71
|
+
</p>
|
|
72
|
+
{:else if showSuccess()}
|
|
73
|
+
<p class="st-form__message st-form__message--success" role="status">
|
|
74
|
+
{successText}
|
|
75
|
+
</p>
|
|
76
|
+
{:else if showHelper()}
|
|
77
|
+
<p class="st-form__message st-form__message--help">{helperText}</p>
|
|
78
|
+
{/if}
|
|
79
|
+
{#if !noNoscript}
|
|
80
|
+
<noscript>
|
|
81
|
+
<p class="st-form__message st-form__message--error">
|
|
82
|
+
JavaScript is required to submit this form.
|
|
83
|
+
</p>
|
|
84
|
+
</noscript>
|
|
85
|
+
{/if}
|
|
86
|
+
</form>
|
|
87
|
+
|
|
88
|
+
<style>
|
|
89
|
+
.st-form {
|
|
90
|
+
display: grid;
|
|
91
|
+
gap: var(--st-component-form-gap, 1rem);
|
|
92
|
+
width: 100%;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.st-form__body {
|
|
96
|
+
display: grid;
|
|
97
|
+
gap: var(--st-component-form-fieldGap, 1rem);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.st-form__message {
|
|
101
|
+
font-size: 0.8125rem;
|
|
102
|
+
line-height: 1.4;
|
|
103
|
+
margin: 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.st-form__message--help {
|
|
107
|
+
color: var(--st-component-form-helpText, var(--st-semantic-text-secondary));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.st-form__message--error {
|
|
111
|
+
color: var(--st-component-form-errorText, var(--st-semantic-feedback-error));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.st-form__message--success {
|
|
115
|
+
color: var(--st-component-form-successText, var(--st-semantic-feedback-success));
|
|
116
|
+
}
|
|
117
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLFormAttributes } from "svelte/elements";
|
|
3
|
+
type FormProps = Omit<HTMLFormAttributes, "class" | "onsubmit"> & {
|
|
4
|
+
onsubmit?: (event: SubmitEvent) => void | Promise<void>;
|
|
5
|
+
helperText?: string;
|
|
6
|
+
errorText?: string;
|
|
7
|
+
successText?: string;
|
|
8
|
+
submitting?: boolean;
|
|
9
|
+
noNoscript?: boolean;
|
|
10
|
+
class?: string;
|
|
11
|
+
children: Snippet;
|
|
12
|
+
};
|
|
13
|
+
declare const Form: import("svelte").Component<FormProps, {}, "submitting">;
|
|
14
|
+
type Form = ReturnType<typeof Form>;
|
|
15
|
+
export default Form;
|
|
16
|
+
//# sourceMappingURL=Form.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Form.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAKxD,KAAK,SAAS,GAAG,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,UAAU,CAAC,GAAG;IAChE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AA4EJ,QAAA,MAAM,IAAI,yDAAwC,CAAC;AACnD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AACpC,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLFieldsetAttributes } from "svelte/elements";
|
|
4
|
+
|
|
5
|
+
type FormGroupProps = Omit<HTMLFieldsetAttributes, "class"> & {
|
|
6
|
+
legend?: string;
|
|
7
|
+
helperText?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
class?: string;
|
|
10
|
+
children: Snippet;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
legend,
|
|
15
|
+
helperText,
|
|
16
|
+
disabled = false,
|
|
17
|
+
class: className,
|
|
18
|
+
children,
|
|
19
|
+
...rest
|
|
20
|
+
}: FormGroupProps = $props();
|
|
21
|
+
|
|
22
|
+
const classes = () => ["st-form-group", className].filter(Boolean).join(" ");
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<fieldset {...rest} class={classes()} {disabled}>
|
|
26
|
+
{#if legend}<legend class="st-form-group__legend">{legend}</legend>{/if}
|
|
27
|
+
<div class="st-form-group__body">
|
|
28
|
+
{@render children()}
|
|
29
|
+
</div>
|
|
30
|
+
{#if helperText}
|
|
31
|
+
<p class="st-form-group__help">{helperText}</p>
|
|
32
|
+
{/if}
|
|
33
|
+
</fieldset>
|
|
34
|
+
|
|
35
|
+
<style>
|
|
36
|
+
.st-form-group {
|
|
37
|
+
border: 1px solid
|
|
38
|
+
var(--st-component-formGroup-border, var(--st-semantic-border-subtle));
|
|
39
|
+
border-radius: var(--st-component-formGroup-radius, 0.5rem);
|
|
40
|
+
color: var(--st-semantic-text-primary);
|
|
41
|
+
display: grid;
|
|
42
|
+
gap: var(--st-component-formGroup-gap, 1rem);
|
|
43
|
+
margin: 0;
|
|
44
|
+
padding: var(--st-component-formGroup-padding, 1rem);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.st-form-group__legend {
|
|
48
|
+
font-size: 0.875rem;
|
|
49
|
+
font-weight: 600;
|
|
50
|
+
padding: 0 0.25rem;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.st-form-group__body {
|
|
54
|
+
display: grid;
|
|
55
|
+
gap: var(--st-component-formGroup-fieldGap, 1rem);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.st-form-group__help {
|
|
59
|
+
color: var(
|
|
60
|
+
--st-component-formGroup-helpText,
|
|
61
|
+
var(--st-semantic-text-secondary)
|
|
62
|
+
);
|
|
63
|
+
font-size: 0.8125rem;
|
|
64
|
+
line-height: 1.4;
|
|
65
|
+
margin: 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.st-form-group:disabled {
|
|
69
|
+
opacity: 0.6;
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLFieldsetAttributes } from "svelte/elements";
|
|
3
|
+
type FormGroupProps = Omit<HTMLFieldsetAttributes, "class"> & {
|
|
4
|
+
legend?: string;
|
|
5
|
+
helperText?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
class?: string;
|
|
8
|
+
children: Snippet;
|
|
9
|
+
};
|
|
10
|
+
declare const FormGroup: import("svelte").Component<FormGroupProps, {}, "">;
|
|
11
|
+
type FormGroup = ReturnType<typeof FormGroup>;
|
|
12
|
+
export default FormGroup;
|
|
13
|
+
//# sourceMappingURL=FormGroup.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormGroup.svelte.d.ts","sourceRoot":"","sources":["../src/lib/FormGroup.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAG5D,KAAK,cAAc,GAAG,IAAI,CAAC,sBAAsB,EAAE,OAAO,CAAC,GAAG;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAgCJ,QAAA,MAAM,SAAS,oDAAwC,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
|
|
5
|
+
type HeaderProps = Omit<HTMLAttributes<HTMLElement>, "class"> & {
|
|
6
|
+
title?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
sticky?: boolean;
|
|
9
|
+
class?: string;
|
|
10
|
+
logo?: Snippet;
|
|
11
|
+
navigation?: Snippet;
|
|
12
|
+
actions?: Snippet;
|
|
13
|
+
children?: Snippet;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
title,
|
|
18
|
+
label = "Application header",
|
|
19
|
+
sticky = true,
|
|
20
|
+
class: className,
|
|
21
|
+
logo,
|
|
22
|
+
navigation,
|
|
23
|
+
actions,
|
|
24
|
+
children,
|
|
25
|
+
...rest
|
|
26
|
+
}: HeaderProps = $props();
|
|
27
|
+
|
|
28
|
+
const classes = () =>
|
|
29
|
+
["st-header", sticky ? "st-header--sticky" : null, className].filter(Boolean).join(" ");
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<header {...rest} class={classes()} aria-label={label}>
|
|
33
|
+
<div class="st-header__leading">
|
|
34
|
+
{#if logo}
|
|
35
|
+
<span class="st-header__logo">{@render logo()}</span>
|
|
36
|
+
{/if}
|
|
37
|
+
{#if title}
|
|
38
|
+
<span class="st-header__title">{title}</span>
|
|
39
|
+
{/if}
|
|
40
|
+
</div>
|
|
41
|
+
{#if navigation}
|
|
42
|
+
<nav class="st-header__navigation" aria-label="Primary">
|
|
43
|
+
{@render navigation()}
|
|
44
|
+
</nav>
|
|
45
|
+
{/if}
|
|
46
|
+
{#if actions}
|
|
47
|
+
<div class="st-header__actions">
|
|
48
|
+
{@render actions()}
|
|
49
|
+
</div>
|
|
50
|
+
{/if}
|
|
51
|
+
{#if children}
|
|
52
|
+
{@render children()}
|
|
53
|
+
{/if}
|
|
54
|
+
</header>
|
|
55
|
+
|
|
56
|
+
<style>
|
|
57
|
+
.st-header {
|
|
58
|
+
align-items: center;
|
|
59
|
+
background: var(--st-component-header-background, var(--st-semantic-surface-default));
|
|
60
|
+
border-bottom: 1px solid var(--st-component-header-border, var(--st-semantic-border-subtle));
|
|
61
|
+
box-shadow: var(--st-component-header-shadow, 0 1px 3px rgb(15 23 42 / 0.06));
|
|
62
|
+
color: var(--st-component-header-text, var(--st-semantic-text-primary));
|
|
63
|
+
display: flex;
|
|
64
|
+
gap: var(--st-spacing-4, 1rem);
|
|
65
|
+
height: var(--st-component-header-height, 3.5rem);
|
|
66
|
+
padding: 0 var(--st-spacing-4, 1rem);
|
|
67
|
+
width: 100%;
|
|
68
|
+
z-index: var(--st-component-header-zIndex, 70);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.st-header--sticky {
|
|
72
|
+
position: sticky;
|
|
73
|
+
top: 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.st-header__leading {
|
|
77
|
+
align-items: center;
|
|
78
|
+
display: flex;
|
|
79
|
+
flex: 0 0 auto;
|
|
80
|
+
gap: var(--st-spacing-3, 0.75rem);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.st-header__logo {
|
|
84
|
+
align-items: center;
|
|
85
|
+
color: var(--st-component-header-logoText, var(--st-semantic-text-primary));
|
|
86
|
+
display: inline-flex;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.st-header__title {
|
|
90
|
+
color: var(--st-component-header-titleText, var(--st-semantic-text-primary));
|
|
91
|
+
font-size: 0.9375rem;
|
|
92
|
+
font-weight: 650;
|
|
93
|
+
letter-spacing: -0.005em;
|
|
94
|
+
line-height: 1.2;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.st-header__navigation {
|
|
98
|
+
align-items: center;
|
|
99
|
+
display: flex;
|
|
100
|
+
flex: 1 1 auto;
|
|
101
|
+
justify-content: center;
|
|
102
|
+
min-width: 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.st-header__actions {
|
|
106
|
+
align-items: center;
|
|
107
|
+
display: flex;
|
|
108
|
+
flex: 0 0 auto;
|
|
109
|
+
gap: var(--st-spacing-2, 0.5rem);
|
|
110
|
+
margin-left: auto;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/*
|
|
114
|
+
* When no navigation snippet is provided, the actions area still flushes
|
|
115
|
+
* to the right because flex:1 leading + auto margin keep the layout balanced.
|
|
116
|
+
*/
|
|
117
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
type HeaderProps = Omit<HTMLAttributes<HTMLElement>, "class"> & {
|
|
4
|
+
title?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
sticky?: boolean;
|
|
7
|
+
class?: string;
|
|
8
|
+
logo?: Snippet;
|
|
9
|
+
navigation?: Snippet;
|
|
10
|
+
actions?: Snippet;
|
|
11
|
+
children?: Snippet;
|
|
12
|
+
};
|
|
13
|
+
declare const Header: import("svelte").Component<HeaderProps, {}, "">;
|
|
14
|
+
type Header = ReturnType<typeof Header>;
|
|
15
|
+
export default Header;
|
|
16
|
+
//# sourceMappingURL=Header.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Header.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGpD,KAAK,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,GAAG;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAkDJ,QAAA,MAAM,MAAM,iDAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
|