@imput/helium-prism 0.1.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/LICENSE +673 -0
- package/README.md +77 -0
- package/dist/components/Button.svelte +38 -0
- package/dist/components/Button.svelte.d.ts +13 -0
- package/dist/components/Button.svelte.d.ts.map +1 -0
- package/dist/components/CardLink.svelte +41 -0
- package/dist/components/CardLink.svelte.d.ts +11 -0
- package/dist/components/CardLink.svelte.d.ts.map +1 -0
- package/dist/components/Checkbox.svelte +151 -0
- package/dist/components/Checkbox.svelte.d.ts +23 -0
- package/dist/components/Checkbox.svelte.d.ts.map +1 -0
- package/dist/components/CopyIcon.svelte +71 -0
- package/dist/components/CopyIcon.svelte.d.ts +10 -0
- package/dist/components/CopyIcon.svelte.d.ts.map +1 -0
- package/dist/components/Dropdown.svelte +128 -0
- package/dist/components/Dropdown.svelte.d.ts +32 -0
- package/dist/components/Dropdown.svelte.d.ts.map +1 -0
- package/dist/components/GradientShimmer.svelte +467 -0
- package/dist/components/GradientShimmer.svelte.d.ts +13 -0
- package/dist/components/GradientShimmer.svelte.d.ts.map +1 -0
- package/dist/components/HeliumLogo.svelte +40 -0
- package/dist/components/HeliumLogo.svelte.d.ts +10 -0
- package/dist/components/HeliumLogo.svelte.d.ts.map +1 -0
- package/dist/components/Input.svelte +117 -0
- package/dist/components/Input.svelte.d.ts +17 -0
- package/dist/components/Input.svelte.d.ts.map +1 -0
- package/dist/components/OuterLink.svelte +30 -0
- package/dist/components/OuterLink.svelte.d.ts +10 -0
- package/dist/components/OuterLink.svelte.d.ts.map +1 -0
- package/dist/components/SearchBar.svelte +68 -0
- package/dist/components/SearchBar.svelte.d.ts +15 -0
- package/dist/components/SearchBar.svelte.d.ts.map +1 -0
- package/dist/components/Skeleton.svelte +47 -0
- package/dist/components/Skeleton.svelte.d.ts +10 -0
- package/dist/components/Skeleton.svelte.d.ts.map +1 -0
- package/dist/components/Spinner.svelte +44 -0
- package/dist/components/Spinner.svelte.d.ts +9 -0
- package/dist/components/Spinner.svelte.d.ts.map +1 -0
- package/dist/components/Text.svelte +83 -0
- package/dist/components/Text.svelte.d.ts +24 -0
- package/dist/components/Text.svelte.d.ts.map +1 -0
- package/dist/components/Toggle.svelte +109 -0
- package/dist/components/Toggle.svelte.d.ts +19 -0
- package/dist/components/Toggle.svelte.d.ts.map +1 -0
- package/dist/components/Tooltip.svelte +130 -0
- package/dist/components/Tooltip.svelte.d.ts +10 -0
- package/dist/components/Tooltip.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconArrowDown.svelte +15 -0
- package/dist/components/icons/IconArrowDown.svelte.d.ts +27 -0
- package/dist/components/icons/IconArrowDown.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconArrowLeft.svelte +15 -0
- package/dist/components/icons/IconArrowLeft.svelte.d.ts +27 -0
- package/dist/components/icons/IconArrowLeft.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconArrowRight.svelte +15 -0
- package/dist/components/icons/IconArrowRight.svelte.d.ts +27 -0
- package/dist/components/icons/IconArrowRight.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconArrowUp.svelte +15 -0
- package/dist/components/icons/IconArrowUp.svelte.d.ts +27 -0
- package/dist/components/icons/IconArrowUp.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconBang.svelte +16 -0
- package/dist/components/icons/IconBang.svelte.d.ts +27 -0
- package/dist/components/icons/IconBang.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconCheck.svelte +13 -0
- package/dist/components/icons/IconCheck.svelte.d.ts +27 -0
- package/dist/components/icons/IconCheck.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconChevronDown.svelte +13 -0
- package/dist/components/icons/IconChevronDown.svelte.d.ts +27 -0
- package/dist/components/icons/IconChevronDown.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconCopy.svelte +18 -0
- package/dist/components/icons/IconCopy.svelte.d.ts +27 -0
- package/dist/components/icons/IconCopy.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconDownload.svelte +15 -0
- package/dist/components/icons/IconDownload.svelte.d.ts +27 -0
- package/dist/components/icons/IconDownload.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconExternalLink.svelte +15 -0
- package/dist/components/icons/IconExternalLink.svelte.d.ts +27 -0
- package/dist/components/icons/IconExternalLink.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconInfo.svelte +15 -0
- package/dist/components/icons/IconInfo.svelte.d.ts +27 -0
- package/dist/components/icons/IconInfo.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconLink.svelte +15 -0
- package/dist/components/icons/IconLink.svelte.d.ts +27 -0
- package/dist/components/icons/IconLink.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconLoader.svelte +13 -0
- package/dist/components/icons/IconLoader.svelte.d.ts +27 -0
- package/dist/components/icons/IconLoader.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconSearch.svelte +14 -0
- package/dist/components/icons/IconSearch.svelte.d.ts +27 -0
- package/dist/components/icons/IconSearch.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconWorld.svelte +17 -0
- package/dist/components/icons/IconWorld.svelte.d.ts +27 -0
- package/dist/components/icons/IconWorld.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconX.svelte +14 -0
- package/dist/components/icons/IconX.svelte.d.ts +27 -0
- package/dist/components/icons/IconX.svelte.d.ts.map +1 -0
- package/dist/components/icons/LICENSE +21 -0
- package/dist/components/logos/HeliumLogoRaw.svelte +6 -0
- package/dist/components/logos/HeliumLogoRaw.svelte.d.ts +27 -0
- package/dist/components/logos/HeliumLogoRaw.svelte.d.ts.map +1 -0
- package/dist/components/logos/HeliumTextRaw.svelte +16 -0
- package/dist/components/logos/HeliumTextRaw.svelte.d.ts +27 -0
- package/dist/components/logos/HeliumTextRaw.svelte.d.ts.map +1 -0
- package/dist/gradient-shimmer.d.ts +85 -0
- package/dist/gradient-shimmer.d.ts.map +1 -0
- package/dist/gradient-shimmer.js +227 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/styles.css +386 -0
- package/package.json +54 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
4
|
+
|
|
5
|
+
type Props = Omit<HTMLAnchorAttributes, "href"> & {
|
|
6
|
+
href: string;
|
|
7
|
+
children: Snippet;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
href,
|
|
12
|
+
children,
|
|
13
|
+
class: className,
|
|
14
|
+
target: targetProp,
|
|
15
|
+
rel: relProp,
|
|
16
|
+
...rest
|
|
17
|
+
}: Props = $props();
|
|
18
|
+
let target = $derived(targetProp ?? (href.startsWith("#") ? undefined : "_blank"));
|
|
19
|
+
let rel = $derived(relProp ?? (target ? "noopener noreferrer" : undefined));
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<a class={["outer-link", className]} {href} {target} {rel} {...rest}>
|
|
23
|
+
{@render children()}
|
|
24
|
+
</a>
|
|
25
|
+
|
|
26
|
+
<style>
|
|
27
|
+
.outer-link.button:not(.card) {
|
|
28
|
+
width: fit-content;
|
|
29
|
+
}
|
|
30
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
3
|
+
type Props = Omit<HTMLAnchorAttributes, "href"> & {
|
|
4
|
+
href: string;
|
|
5
|
+
children: Snippet;
|
|
6
|
+
};
|
|
7
|
+
declare const OuterLink: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type OuterLink = ReturnType<typeof OuterLink>;
|
|
9
|
+
export default OuterLink;
|
|
10
|
+
//# sourceMappingURL=OuterLink.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OuterLink.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/OuterLink.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAGxD,KAAK,KAAK,GAAG,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,GAAG;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;CACrB,CAAC;AA0BN,QAAA,MAAM,SAAS,2CAAwC,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
3
|
+
import Input from "./Input.svelte";
|
|
4
|
+
import IconSearch from "./icons/IconSearch.svelte";
|
|
5
|
+
|
|
6
|
+
type NativeInputProps = Omit<
|
|
7
|
+
HTMLInputAttributes,
|
|
8
|
+
"aria-label" | "id" | "input" | "type" | "value" | "size" | "width"
|
|
9
|
+
>;
|
|
10
|
+
|
|
11
|
+
type Props = NativeInputProps & {
|
|
12
|
+
id: string;
|
|
13
|
+
"aria-label": string;
|
|
14
|
+
value?: string;
|
|
15
|
+
input?: HTMLInputElement | undefined;
|
|
16
|
+
container?: HTMLDivElement | undefined;
|
|
17
|
+
small?: boolean;
|
|
18
|
+
width?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
let {
|
|
22
|
+
id,
|
|
23
|
+
value = $bindable(""),
|
|
24
|
+
input = $bindable(),
|
|
25
|
+
container = $bindable(),
|
|
26
|
+
small = false,
|
|
27
|
+
width,
|
|
28
|
+
class: className,
|
|
29
|
+
placeholder,
|
|
30
|
+
"aria-label": ariaLabel,
|
|
31
|
+
...rest
|
|
32
|
+
}: Props = $props();
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<div
|
|
36
|
+
bind:this={container}
|
|
37
|
+
class="search-bar"
|
|
38
|
+
style:width
|
|
39
|
+
role="search"
|
|
40
|
+
>
|
|
41
|
+
<Input
|
|
42
|
+
bind:input
|
|
43
|
+
bind:value
|
|
44
|
+
{id}
|
|
45
|
+
{small}
|
|
46
|
+
width="100%"
|
|
47
|
+
type="search"
|
|
48
|
+
{placeholder}
|
|
49
|
+
aria-label={ariaLabel}
|
|
50
|
+
class={className}
|
|
51
|
+
{...rest}
|
|
52
|
+
>
|
|
53
|
+
{#snippet leading()}
|
|
54
|
+
<IconSearch />
|
|
55
|
+
{/snippet}
|
|
56
|
+
</Input>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<style>
|
|
60
|
+
.search-bar {
|
|
61
|
+
width: 100%;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.search-bar :global(input[type="search"]::-webkit-search-decoration),
|
|
65
|
+
.search-bar :global(input[type="search"]::-webkit-search-cancel-button) {
|
|
66
|
+
-webkit-appearance: none;
|
|
67
|
+
}
|
|
68
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
2
|
+
type NativeInputProps = Omit<HTMLInputAttributes, "aria-label" | "id" | "input" | "type" | "value" | "size" | "width">;
|
|
3
|
+
type Props = NativeInputProps & {
|
|
4
|
+
id: string;
|
|
5
|
+
"aria-label": string;
|
|
6
|
+
value?: string;
|
|
7
|
+
input?: HTMLInputElement | undefined;
|
|
8
|
+
container?: HTMLDivElement | undefined;
|
|
9
|
+
small?: boolean;
|
|
10
|
+
width?: string;
|
|
11
|
+
};
|
|
12
|
+
declare const SearchBar: import("svelte").Component<Props, {}, "value" | "input" | "container">;
|
|
13
|
+
type SearchBar = ReturnType<typeof SearchBar>;
|
|
14
|
+
export default SearchBar;
|
|
15
|
+
//# sourceMappingURL=SearchBar.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchBar.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/SearchBar.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAKvD,KAAK,gBAAgB,GAAG,IAAI,CACxB,mBAAmB,EACnB,YAAY,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CACtE,CAAC;AAEF,KAAK,KAAK,GAAG,gBAAgB,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACrC,SAAS,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IACvC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAkCN,QAAA,MAAM,SAAS,wEAAwC,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ClassValue } from "svelte/elements";
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
class?: ClassValue;
|
|
6
|
+
width?: string;
|
|
7
|
+
height?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
let { class: className, width, height }: Props = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div class={["skeleton", className]} style:width style:height></div>
|
|
14
|
+
|
|
15
|
+
<style>
|
|
16
|
+
.skeleton {
|
|
17
|
+
height: 100%;
|
|
18
|
+
width: 100%;
|
|
19
|
+
background: var(--helium-elevated-10);
|
|
20
|
+
border-radius: 12px;
|
|
21
|
+
background-image: linear-gradient(
|
|
22
|
+
90deg,
|
|
23
|
+
transparent,
|
|
24
|
+
var(--helium-elevated-10),
|
|
25
|
+
transparent
|
|
26
|
+
);
|
|
27
|
+
background-repeat: no-repeat;
|
|
28
|
+
animation: skeleton 1.2s ease-in-out infinite;
|
|
29
|
+
background-size: var(--shimmer-size) var(--shimmer-size);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@media (prefers-reduced-motion: reduce) {
|
|
33
|
+
.skeleton {
|
|
34
|
+
animation: none;
|
|
35
|
+
background-image: none;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@keyframes skeleton {
|
|
40
|
+
0% {
|
|
41
|
+
background-position: -350px 0;
|
|
42
|
+
}
|
|
43
|
+
100% {
|
|
44
|
+
background-position: calc(350px + 100%) 0;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ClassValue } from "svelte/elements";
|
|
2
|
+
type Props = {
|
|
3
|
+
class?: ClassValue;
|
|
4
|
+
width?: string;
|
|
5
|
+
height?: string;
|
|
6
|
+
};
|
|
7
|
+
declare const Skeleton: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type Skeleton = ReturnType<typeof Skeleton>;
|
|
9
|
+
export default Skeleton;
|
|
10
|
+
//# sourceMappingURL=Skeleton.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Skeleton.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/Skeleton.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG9C,KAAK,KAAK,GAAG;IACT,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAcN,QAAA,MAAM,QAAQ,2CAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ClassValue } from "svelte/elements";
|
|
3
|
+
import IconLoader from "./icons/IconLoader.svelte";
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
size?: number;
|
|
7
|
+
class?: ClassValue;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
let { size = 24, class: className }: Props = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div class={["spinner", className]} style="--size: {size}px">
|
|
14
|
+
<IconLoader />
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<style>
|
|
18
|
+
.spinner {
|
|
19
|
+
display: flex;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.spinner :global(svg) {
|
|
23
|
+
width: var(--size);
|
|
24
|
+
height: var(--size);
|
|
25
|
+
color: inherit;
|
|
26
|
+
animation: spinner 1s infinite linear;
|
|
27
|
+
will-change: transform;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@media (prefers-reduced-motion: reduce) {
|
|
31
|
+
.spinner :global(svg) {
|
|
32
|
+
animation: none;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@keyframes spinner {
|
|
37
|
+
from {
|
|
38
|
+
transform: rotate(0);
|
|
39
|
+
}
|
|
40
|
+
to {
|
|
41
|
+
transform: rotate(360deg);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ClassValue } from "svelte/elements";
|
|
2
|
+
type Props = {
|
|
3
|
+
size?: number;
|
|
4
|
+
class?: ClassValue;
|
|
5
|
+
};
|
|
6
|
+
declare const Spinner: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type Spinner = ReturnType<typeof Spinner>;
|
|
8
|
+
export default Spinner;
|
|
9
|
+
//# sourceMappingURL=Spinner.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spinner.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/Spinner.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI9C,KAAK,KAAK,GAAG;IACT,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,UAAU,CAAC;CACtB,CAAC;AAiBN,QAAA,MAAM,OAAO,2CAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { ClassValue } from "svelte/elements";
|
|
4
|
+
|
|
5
|
+
type Variant =
|
|
6
|
+
| "display"
|
|
7
|
+
| "title"
|
|
8
|
+
| "heading"
|
|
9
|
+
| "subheading"
|
|
10
|
+
| "body"
|
|
11
|
+
| "caption";
|
|
12
|
+
type Tone = "primary" | "secondary" | "tertiary" | "white";
|
|
13
|
+
type Tag = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div";
|
|
14
|
+
|
|
15
|
+
type BaseProps = {
|
|
16
|
+
children: Snippet;
|
|
17
|
+
tone?: Tone;
|
|
18
|
+
center?: boolean;
|
|
19
|
+
class?: ClassValue;
|
|
20
|
+
};
|
|
21
|
+
type VariantProps = BaseProps & {
|
|
22
|
+
variant?: Variant;
|
|
23
|
+
tag?: never;
|
|
24
|
+
};
|
|
25
|
+
type TagProps = BaseProps & {
|
|
26
|
+
tag: Tag;
|
|
27
|
+
variant?: never;
|
|
28
|
+
};
|
|
29
|
+
type Props = VariantProps | TagProps;
|
|
30
|
+
|
|
31
|
+
const defaultTag = (variant: Variant): Tag => {
|
|
32
|
+
if (variant === "display") return "h1";
|
|
33
|
+
if (variant === "title") return "h2";
|
|
34
|
+
if (variant === "heading") return "h3";
|
|
35
|
+
if (variant === "subheading") return "h4";
|
|
36
|
+
return "p";
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
let {
|
|
40
|
+
children,
|
|
41
|
+
variant = "body",
|
|
42
|
+
tone,
|
|
43
|
+
tag,
|
|
44
|
+
center = false,
|
|
45
|
+
class: className,
|
|
46
|
+
}: Props = $props();
|
|
47
|
+
|
|
48
|
+
let element = $derived(tag ?? defaultTag(variant));
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<svelte:element
|
|
52
|
+
this={element}
|
|
53
|
+
class={["text", tone && `tone-${tone}`, center && "center", className]}
|
|
54
|
+
>
|
|
55
|
+
{@render children()}
|
|
56
|
+
</svelte:element>
|
|
57
|
+
|
|
58
|
+
<style>
|
|
59
|
+
.text {
|
|
60
|
+
margin: 0;
|
|
61
|
+
white-space: var(--text-white-space, pre-line);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.center {
|
|
65
|
+
text-align: center;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.tone-primary {
|
|
69
|
+
color: var(--primary);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.tone-secondary {
|
|
73
|
+
color: var(--secondary);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.tone-tertiary {
|
|
77
|
+
color: var(--tertiary);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.tone-white {
|
|
81
|
+
color: var(--white);
|
|
82
|
+
}
|
|
83
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { ClassValue } from "svelte/elements";
|
|
3
|
+
type Variant = "display" | "title" | "heading" | "subheading" | "body" | "caption";
|
|
4
|
+
type Tone = "primary" | "secondary" | "tertiary" | "white";
|
|
5
|
+
type Tag = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div";
|
|
6
|
+
type BaseProps = {
|
|
7
|
+
children: Snippet;
|
|
8
|
+
tone?: Tone;
|
|
9
|
+
center?: boolean;
|
|
10
|
+
class?: ClassValue;
|
|
11
|
+
};
|
|
12
|
+
type VariantProps = BaseProps & {
|
|
13
|
+
variant?: Variant;
|
|
14
|
+
tag?: never;
|
|
15
|
+
};
|
|
16
|
+
type TagProps = BaseProps & {
|
|
17
|
+
tag: Tag;
|
|
18
|
+
variant?: never;
|
|
19
|
+
};
|
|
20
|
+
type Props = VariantProps | TagProps;
|
|
21
|
+
declare const Text: import("svelte").Component<Props, {}, "">;
|
|
22
|
+
type Text = ReturnType<typeof Text>;
|
|
23
|
+
export default Text;
|
|
24
|
+
//# sourceMappingURL=Text.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/Text.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG9C,KAAK,OAAO,GACN,SAAS,GACT,OAAO,GACP,SAAS,GACT,YAAY,GACZ,MAAM,GACN,SAAS,CAAC;AAChB,KAAK,IAAI,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;AAC3D,KAAK,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,GAAG,MAAM,GAAG,KAAK,CAAC;AAE1E,KAAK,SAAS,GAAG;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,UAAU,CAAC;CACtB,CAAC;AACF,KAAK,YAAY,GAAG,SAAS,GAAG;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AACF,KAAK,QAAQ,GAAG,SAAS,GAAG;IACxB,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,CAAC,EAAE,KAAK,CAAC;CACnB,CAAC;AACF,KAAK,KAAK,GAAG,YAAY,GAAG,QAAQ,CAAC;AAwCzC,QAAA,MAAM,IAAI,2CAAwC,CAAC;AACnD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AACpC,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
4
|
+
|
|
5
|
+
type ToggleContentProps =
|
|
6
|
+
| {
|
|
7
|
+
children: Snippet;
|
|
8
|
+
name?: never;
|
|
9
|
+
desc?: never;
|
|
10
|
+
}
|
|
11
|
+
| {
|
|
12
|
+
children?: never;
|
|
13
|
+
name: string;
|
|
14
|
+
desc?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type Props = Omit<HTMLButtonAttributes, "aria-checked" | "onchange"> & {
|
|
18
|
+
checked?: boolean;
|
|
19
|
+
onchange?: (checked: boolean) => void;
|
|
20
|
+
} & ToggleContentProps;
|
|
21
|
+
type ButtonClickEvent = Parameters<NonNullable<HTMLButtonAttributes["onclick"]>>[0];
|
|
22
|
+
|
|
23
|
+
let {
|
|
24
|
+
checked = $bindable(false),
|
|
25
|
+
name,
|
|
26
|
+
desc,
|
|
27
|
+
children,
|
|
28
|
+
onchange,
|
|
29
|
+
class: className,
|
|
30
|
+
type = "button",
|
|
31
|
+
disabled,
|
|
32
|
+
onclick,
|
|
33
|
+
...rest
|
|
34
|
+
}: Props = $props();
|
|
35
|
+
|
|
36
|
+
const toggle = (event: ButtonClickEvent) => {
|
|
37
|
+
onclick?.(event);
|
|
38
|
+
|
|
39
|
+
if (event.defaultPrevented || disabled) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
checked = !checked;
|
|
44
|
+
onchange?.(checked);
|
|
45
|
+
};
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<button
|
|
49
|
+
class={["toggle-button card", className]}
|
|
50
|
+
{disabled}
|
|
51
|
+
{type}
|
|
52
|
+
role="switch"
|
|
53
|
+
aria-checked={checked}
|
|
54
|
+
onclick={toggle}
|
|
55
|
+
{...rest}
|
|
56
|
+
>
|
|
57
|
+
<div class="toggle-text">
|
|
58
|
+
{#if children}
|
|
59
|
+
{@render children()}
|
|
60
|
+
{:else}
|
|
61
|
+
{#if name}
|
|
62
|
+
<h4>{name}</h4>
|
|
63
|
+
{/if}
|
|
64
|
+
{#if desc}
|
|
65
|
+
<p>{desc}</p>
|
|
66
|
+
{/if}
|
|
67
|
+
{/if}
|
|
68
|
+
</div>
|
|
69
|
+
<div class={["toggle", checked && "enabled"]} aria-hidden="true">
|
|
70
|
+
<div class="runner"></div>
|
|
71
|
+
</div>
|
|
72
|
+
</button>
|
|
73
|
+
|
|
74
|
+
<style>
|
|
75
|
+
.toggle-text {
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
gap: 4px;
|
|
79
|
+
width: 100%;
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.toggle {
|
|
84
|
+
min-width: 48px;
|
|
85
|
+
width: 48px;
|
|
86
|
+
height: 28px;
|
|
87
|
+
border-radius: 50px;
|
|
88
|
+
background-color: var(--helium-elevated-30);
|
|
89
|
+
transition: background-color 0.25s;
|
|
90
|
+
|
|
91
|
+
& .runner {
|
|
92
|
+
width: 22px;
|
|
93
|
+
height: 22px;
|
|
94
|
+
margin: 3px;
|
|
95
|
+
background-color: var(--white);
|
|
96
|
+
border-radius: 50px;
|
|
97
|
+
will-change: translate;
|
|
98
|
+
transition: translate 0.15s;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&.enabled {
|
|
102
|
+
background-color: var(--helium-blue);
|
|
103
|
+
|
|
104
|
+
& .runner {
|
|
105
|
+
translate: 20px 0;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
3
|
+
type ToggleContentProps = {
|
|
4
|
+
children: Snippet;
|
|
5
|
+
name?: never;
|
|
6
|
+
desc?: never;
|
|
7
|
+
} | {
|
|
8
|
+
children?: never;
|
|
9
|
+
name: string;
|
|
10
|
+
desc?: string;
|
|
11
|
+
};
|
|
12
|
+
type Props = Omit<HTMLButtonAttributes, "aria-checked" | "onchange"> & {
|
|
13
|
+
checked?: boolean;
|
|
14
|
+
onchange?: (checked: boolean) => void;
|
|
15
|
+
} & ToggleContentProps;
|
|
16
|
+
declare const Toggle: import("svelte").Component<Props, {}, "checked">;
|
|
17
|
+
type Toggle = ReturnType<typeof Toggle>;
|
|
18
|
+
export default Toggle;
|
|
19
|
+
//# sourceMappingURL=Toggle.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toggle.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/Toggle.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAGxD,KAAK,kBAAkB,GACjB;IACE,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,CAAC;CAChB,GACC;IACE,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEN,KAAK,KAAK,GAAG,IAAI,CAAC,oBAAoB,EAAE,cAAc,GAAG,UAAU,CAAC,GAAG;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC,GAAG,kBAAkB,CAAC;AAwD3B,QAAA,MAAM,MAAM,kDAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
anchor: Snippet;
|
|
6
|
+
content: Snippet;
|
|
7
|
+
id?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const generatedId = $props.id();
|
|
11
|
+
let { anchor, content, id = generatedId }: Props = $props();
|
|
12
|
+
|
|
13
|
+
let anchorElement: HTMLDivElement;
|
|
14
|
+
let popover: HTMLDivElement;
|
|
15
|
+
|
|
16
|
+
let tooltipX = $state(0);
|
|
17
|
+
let tooltipY = $state(0);
|
|
18
|
+
|
|
19
|
+
let visible = $state(false);
|
|
20
|
+
|
|
21
|
+
const offsetY = 12;
|
|
22
|
+
const offsetX = 16;
|
|
23
|
+
|
|
24
|
+
const updatePosition = (e: MouseEvent) => {
|
|
25
|
+
tooltipX = e.clientX - offsetX;
|
|
26
|
+
tooltipY = e.clientY - offsetY;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const updatePositionFromAnchor = () => {
|
|
30
|
+
const rect = anchorElement.getBoundingClientRect();
|
|
31
|
+
|
|
32
|
+
tooltipX = rect.left;
|
|
33
|
+
tooltipY = rect.top - offsetY;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
$effect(() => {
|
|
37
|
+
if (!popover) return;
|
|
38
|
+
|
|
39
|
+
if (visible) {
|
|
40
|
+
popover.showPopover();
|
|
41
|
+
} else {
|
|
42
|
+
popover.hidePopover();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<div
|
|
48
|
+
bind:this={anchorElement}
|
|
49
|
+
class="tooltip-anchor"
|
|
50
|
+
onpointermove={updatePosition}
|
|
51
|
+
onpointerenter={() => (visible = true)}
|
|
52
|
+
onpointerleave={() => (visible = false)}
|
|
53
|
+
onfocusin={() => {
|
|
54
|
+
updatePositionFromAnchor();
|
|
55
|
+
visible = true;
|
|
56
|
+
}}
|
|
57
|
+
onfocusout={() => (visible = false)}
|
|
58
|
+
role="group"
|
|
59
|
+
aria-describedby={id}
|
|
60
|
+
>
|
|
61
|
+
{@render anchor()}
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div
|
|
65
|
+
bind:this={popover}
|
|
66
|
+
popover="manual"
|
|
67
|
+
class="tooltip-container"
|
|
68
|
+
role="tooltip"
|
|
69
|
+
{id}
|
|
70
|
+
style:left="{tooltipX}px"
|
|
71
|
+
style:top="{tooltipY}px"
|
|
72
|
+
>
|
|
73
|
+
<div class="tooltip-content">
|
|
74
|
+
{@render content()}
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<style>
|
|
79
|
+
.tooltip-anchor {
|
|
80
|
+
display: flex;
|
|
81
|
+
position: relative;
|
|
82
|
+
width: fit-content;
|
|
83
|
+
height: fit-content;
|
|
84
|
+
gap: var(--gap);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.tooltip-container {
|
|
88
|
+
position: fixed;
|
|
89
|
+
margin: 0;
|
|
90
|
+
padding: 16px;
|
|
91
|
+
border: none;
|
|
92
|
+
background: none;
|
|
93
|
+
pointer-events: none;
|
|
94
|
+
|
|
95
|
+
opacity: 0;
|
|
96
|
+
transform: scale(0.8);
|
|
97
|
+
transform-origin: left;
|
|
98
|
+
transition: transform 0.15s, opacity 0.15s;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.tooltip-container:popover-open {
|
|
102
|
+
opacity: 1;
|
|
103
|
+
transform: none;
|
|
104
|
+
transform-origin: top left;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@starting-style {
|
|
108
|
+
.tooltip-container:popover-open {
|
|
109
|
+
opacity: 0;
|
|
110
|
+
transform: scale(0.8);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.tooltip-content {
|
|
115
|
+
color: var(--primary);
|
|
116
|
+
background-color: var(--tooltip-bg);
|
|
117
|
+
outline: 1.5px solid var(--helium-elevated-10);
|
|
118
|
+
outline-offset: -1.5px;
|
|
119
|
+
|
|
120
|
+
text-wrap: pretty;
|
|
121
|
+
padding: 10px 12px;
|
|
122
|
+
font-size: 14px;
|
|
123
|
+
white-space: pre;
|
|
124
|
+
line-height: 120%;
|
|
125
|
+
|
|
126
|
+
border-radius: 12px;
|
|
127
|
+
border-top-left-radius: 4px;
|
|
128
|
+
box-shadow: 4px 4px 10px 0 var(--tooltip-shadow);
|
|
129
|
+
}
|
|
130
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
type Props = {
|
|
3
|
+
anchor: Snippet;
|
|
4
|
+
content: Snippet;
|
|
5
|
+
id?: string;
|
|
6
|
+
};
|
|
7
|
+
declare const Tooltip: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type Tooltip = ReturnType<typeof Tooltip>;
|
|
9
|
+
export default Tooltip;
|
|
10
|
+
//# sourceMappingURL=Tooltip.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/Tooltip.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGlC,KAAK,KAAK,GAAG;IACT,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AA2DN,QAAA,MAAM,OAAO,2CAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<svg
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
+
width="24"
|
|
4
|
+
height="24"
|
|
5
|
+
viewBox="0 0 24 24"
|
|
6
|
+
fill="none"
|
|
7
|
+
stroke="currentColor"
|
|
8
|
+
stroke-width="2"
|
|
9
|
+
stroke-linecap="round"
|
|
10
|
+
stroke-linejoin="round"
|
|
11
|
+
>
|
|
12
|
+
<path d="M12 5l0 14" />
|
|
13
|
+
<path d="M18 13l-6 6" />
|
|
14
|
+
<path d="M6 13l6 6" />
|
|
15
|
+
</svg>
|