@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
package/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img width="1000" alt="Helium Prism" src="https://raw.githubusercontent.com/imputnet/helium-prism/refs/heads/main/docs/prism-splash.png">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
Shared UI components of
|
|
7
|
+
<a href="https://github.com/imputnet/helium">Helium</a>
|
|
8
|
+
web interfaces for Svelte.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
Prism UI library contains the shared building blocks used by web-based Helium applications and
|
|
12
|
+
websites, such as: typography, buttons, inputs, loading states, icons, and the brand gradient
|
|
13
|
+
shimmer effect.
|
|
14
|
+
|
|
15
|
+
This library isn't built for use outside of Helium web apps, so it may feel clunky for anything
|
|
16
|
+
else.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
deno:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
deno add npm:@imput/helium-prism
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
pnpm:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
pnpm add @imput/helium-prism
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
npm:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
npm i @imput/helium-prism
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Basic usage
|
|
39
|
+
|
|
40
|
+
Import the stylesheet once near the root of your app:
|
|
41
|
+
|
|
42
|
+
```svelte
|
|
43
|
+
<script>
|
|
44
|
+
import "@imput/helium-prism/styles.css";
|
|
45
|
+
</script>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Then import components from the package root:
|
|
49
|
+
|
|
50
|
+
```svelte
|
|
51
|
+
<script>
|
|
52
|
+
import { Button } from "@imput/helium-prism";
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<Button primary>Button</Button>
|
|
56
|
+
<Button>Button 2</Button>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
You can also import all components at once if you're a madman or have an actual reason to do so
|
|
60
|
+
(such as for [demo](src/demo/App.svelte) purposes):
|
|
61
|
+
|
|
62
|
+
```svelte
|
|
63
|
+
<script>
|
|
64
|
+
import * as Prism from "@imput/helium-prism";
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<Prism.Button primary>Button</Prism.Button>
|
|
68
|
+
<Prism.Button>Button 2</Prism.Button>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## API docs
|
|
72
|
+
|
|
73
|
+
Sample usage of components is documented in [docs/api.md](docs/api.md).
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
Helium Prism is licensed under GPL-3.0, just like the rest of Helium. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
4
|
+
|
|
5
|
+
type Props = HTMLButtonAttributes & {
|
|
6
|
+
children: Snippet;
|
|
7
|
+
primary?: boolean;
|
|
8
|
+
card?: boolean;
|
|
9
|
+
selected?: boolean;
|
|
10
|
+
circle?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
children,
|
|
15
|
+
class: className,
|
|
16
|
+
type = "button",
|
|
17
|
+
primary = false,
|
|
18
|
+
card = false,
|
|
19
|
+
selected = false,
|
|
20
|
+
circle = false,
|
|
21
|
+
...rest
|
|
22
|
+
}: Props = $props();
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<button
|
|
26
|
+
class={[
|
|
27
|
+
"button",
|
|
28
|
+
primary && "primary",
|
|
29
|
+
card && "card",
|
|
30
|
+
selected && "selected",
|
|
31
|
+
circle && "circle",
|
|
32
|
+
className,
|
|
33
|
+
]}
|
|
34
|
+
{type}
|
|
35
|
+
{...rest}
|
|
36
|
+
>
|
|
37
|
+
{@render children()}
|
|
38
|
+
</button>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
3
|
+
type Props = HTMLButtonAttributes & {
|
|
4
|
+
children: Snippet;
|
|
5
|
+
primary?: boolean;
|
|
6
|
+
card?: boolean;
|
|
7
|
+
selected?: boolean;
|
|
8
|
+
circle?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const Button: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type Button = ReturnType<typeof Button>;
|
|
12
|
+
export default Button;
|
|
13
|
+
//# sourceMappingURL=Button.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/Button.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,oBAAoB,GAAG;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AA+BN,QAAA,MAAM,MAAM,2CAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ClassValue } from "svelte/elements";
|
|
3
|
+
import IconExternalLink from "./icons/IconExternalLink.svelte";
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
title: string;
|
|
7
|
+
desc: string;
|
|
8
|
+
href: string;
|
|
9
|
+
class?: ClassValue;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const { title, desc, href, class: className }: Props = $props();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<a
|
|
16
|
+
class={["button card card-link", className]}
|
|
17
|
+
{href}
|
|
18
|
+
target="_blank"
|
|
19
|
+
rel="noopener noreferrer"
|
|
20
|
+
>
|
|
21
|
+
<div class="link-text">
|
|
22
|
+
<h4>{title}</h4>
|
|
23
|
+
<p>{desc}</p>
|
|
24
|
+
</div>
|
|
25
|
+
<IconExternalLink />
|
|
26
|
+
</a>
|
|
27
|
+
|
|
28
|
+
<style>
|
|
29
|
+
.card-link {
|
|
30
|
+
text-decoration: none;
|
|
31
|
+
align-items: flex-start;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.link-text {
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
gap: 4px;
|
|
38
|
+
width: 100%;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ClassValue } from "svelte/elements";
|
|
2
|
+
type Props = {
|
|
3
|
+
title: string;
|
|
4
|
+
desc: string;
|
|
5
|
+
href: string;
|
|
6
|
+
class?: ClassValue;
|
|
7
|
+
};
|
|
8
|
+
declare const CardLink: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type CardLink = ReturnType<typeof CardLink>;
|
|
10
|
+
export default CardLink;
|
|
11
|
+
//# sourceMappingURL=CardLink.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardLink.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/CardLink.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI9C,KAAK,KAAK,GAAG;IACT,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,UAAU,CAAC;CACtB,CAAC;AAqBN,QAAA,MAAM,QAAQ,2CAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
4
|
+
import IconCheck from "./icons/IconCheck.svelte";
|
|
5
|
+
|
|
6
|
+
type CheckboxLabelProps =
|
|
7
|
+
| {
|
|
8
|
+
children: Snippet;
|
|
9
|
+
"aria-label"?: string;
|
|
10
|
+
"aria-labelledby"?: string;
|
|
11
|
+
}
|
|
12
|
+
| {
|
|
13
|
+
children?: never;
|
|
14
|
+
"aria-label": string;
|
|
15
|
+
"aria-labelledby"?: string;
|
|
16
|
+
}
|
|
17
|
+
| {
|
|
18
|
+
children?: never;
|
|
19
|
+
"aria-label"?: string;
|
|
20
|
+
"aria-labelledby": string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type Props = Omit<HTMLInputAttributes, "id" | "type" | "checked"> & {
|
|
24
|
+
id: string;
|
|
25
|
+
checked?: boolean;
|
|
26
|
+
} & CheckboxLabelProps;
|
|
27
|
+
|
|
28
|
+
let {
|
|
29
|
+
id,
|
|
30
|
+
checked = $bindable(false),
|
|
31
|
+
children,
|
|
32
|
+
class: className,
|
|
33
|
+
disabled,
|
|
34
|
+
...rest
|
|
35
|
+
}: Props = $props();
|
|
36
|
+
|
|
37
|
+
let previousChecked = $state(checked);
|
|
38
|
+
let toggling = $state(false);
|
|
39
|
+
|
|
40
|
+
$effect(() => {
|
|
41
|
+
if (checked === previousChecked) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
previousChecked = checked;
|
|
46
|
+
toggling = true;
|
|
47
|
+
|
|
48
|
+
requestAnimationFrame(() => {
|
|
49
|
+
toggling = false;
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<label class={["checkbox", disabled && "disabled", toggling && "toggling", className]}>
|
|
55
|
+
<input {id} type="checkbox" bind:checked {disabled} {...rest} />
|
|
56
|
+
<span class="checkbox-control" aria-hidden="true">
|
|
57
|
+
<IconCheck />
|
|
58
|
+
</span>
|
|
59
|
+
{#if children}
|
|
60
|
+
<span class="checkbox-content">
|
|
61
|
+
{@render children()}
|
|
62
|
+
</span>
|
|
63
|
+
{/if}
|
|
64
|
+
</label>
|
|
65
|
+
|
|
66
|
+
<style>
|
|
67
|
+
.checkbox {
|
|
68
|
+
display: inline-flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
gap: 8px;
|
|
71
|
+
width: fit-content;
|
|
72
|
+
color: var(--primary);
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
line-height: 120%;
|
|
75
|
+
user-select: none;
|
|
76
|
+
-webkit-user-select: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
input {
|
|
80
|
+
position: absolute;
|
|
81
|
+
width: 1px;
|
|
82
|
+
height: 1px;
|
|
83
|
+
margin: -1px;
|
|
84
|
+
overflow: hidden;
|
|
85
|
+
clip: rect(0, 0, 0, 0);
|
|
86
|
+
clip-path: inset(50%);
|
|
87
|
+
white-space: nowrap;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.checkbox-control {
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
justify-content: center;
|
|
94
|
+
flex: 0 0 28px;
|
|
95
|
+
width: 28px;
|
|
96
|
+
height: 28px;
|
|
97
|
+
border-radius: 100%;
|
|
98
|
+
background-color: var(--helium-elevated-7);
|
|
99
|
+
box-shadow: 0 0 0 1.5px var(--helium-elevated-5) inset;
|
|
100
|
+
transition: background-color 0.2s, transform 0.2s;
|
|
101
|
+
will-change: transform;
|
|
102
|
+
|
|
103
|
+
& :global(svg) {
|
|
104
|
+
width: 21px;
|
|
105
|
+
height: 21px;
|
|
106
|
+
stroke-width: 2px;
|
|
107
|
+
opacity: 0;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.toggling .checkbox-control {
|
|
112
|
+
transition: transform 0.2s;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.checkbox:hover input:not(:checked) + .checkbox-control {
|
|
116
|
+
background-color: var(--helium-elevated-10);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.checkbox:hover input:checked + .checkbox-control {
|
|
120
|
+
background-color: var(--helium-blue-hover);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.checkbox:active .checkbox-control {
|
|
124
|
+
transform: scale(0.97);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
input:checked + .checkbox-control {
|
|
128
|
+
background-color: var(--helium-blue);
|
|
129
|
+
color: #ffffff;
|
|
130
|
+
|
|
131
|
+
& :global(svg) {
|
|
132
|
+
opacity: 1;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
input:focus-visible + .checkbox-control {
|
|
137
|
+
outline: 2px var(--primary) solid;
|
|
138
|
+
outline-offset: 3px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.checkbox-content {
|
|
142
|
+
color: var(--secondary);
|
|
143
|
+
font-size: 16px;
|
|
144
|
+
line-height: 122%;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.disabled {
|
|
148
|
+
cursor: not-allowed;
|
|
149
|
+
opacity: 0.5;
|
|
150
|
+
}
|
|
151
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
3
|
+
type CheckboxLabelProps = {
|
|
4
|
+
children: Snippet;
|
|
5
|
+
"aria-label"?: string;
|
|
6
|
+
"aria-labelledby"?: string;
|
|
7
|
+
} | {
|
|
8
|
+
children?: never;
|
|
9
|
+
"aria-label": string;
|
|
10
|
+
"aria-labelledby"?: string;
|
|
11
|
+
} | {
|
|
12
|
+
children?: never;
|
|
13
|
+
"aria-label"?: string;
|
|
14
|
+
"aria-labelledby": string;
|
|
15
|
+
};
|
|
16
|
+
type Props = Omit<HTMLInputAttributes, "id" | "type" | "checked"> & {
|
|
17
|
+
id: string;
|
|
18
|
+
checked?: boolean;
|
|
19
|
+
} & CheckboxLabelProps;
|
|
20
|
+
declare const Checkbox: import("svelte").Component<Props, {}, "checked">;
|
|
21
|
+
type Checkbox = ReturnType<typeof Checkbox>;
|
|
22
|
+
export default Checkbox;
|
|
23
|
+
//# sourceMappingURL=Checkbox.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/Checkbox.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAIvD,KAAK,kBAAkB,GACjB;IACE,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B,GACC;IACE,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B,GACC;IACE,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEN,KAAK,KAAK,GAAG,IAAI,CAAC,mBAAmB,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC,GAAG;IAChE,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,GAAG,kBAAkB,CAAC;AAkD3B,QAAA,MAAM,QAAQ,kDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ClassValue } from "svelte/elements";
|
|
3
|
+
import IconCopy from "./icons/IconCopy.svelte";
|
|
4
|
+
import IconLink from "./icons/IconLink.svelte";
|
|
5
|
+
import IconCheck from "./icons/IconCheck.svelte";
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
check: boolean;
|
|
9
|
+
link?: boolean;
|
|
10
|
+
class?: ClassValue;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
let { check, link = false, class: className }: Props = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<div class={["copy-animation", check && "check", className]}>
|
|
17
|
+
<div class="icon-copy">
|
|
18
|
+
{#if link}
|
|
19
|
+
<IconLink />
|
|
20
|
+
{:else}
|
|
21
|
+
<IconCopy />
|
|
22
|
+
{/if}
|
|
23
|
+
</div>
|
|
24
|
+
<div class="icon-check">
|
|
25
|
+
<IconCheck />
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<style>
|
|
30
|
+
.copy-animation {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
position: relative;
|
|
35
|
+
height: 18px;
|
|
36
|
+
width: 18px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.copy-animation :global(svg) {
|
|
40
|
+
width: 18px;
|
|
41
|
+
height: 18px;
|
|
42
|
+
will-change: transform;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.icon-copy,
|
|
46
|
+
.icon-check {
|
|
47
|
+
display: flex;
|
|
48
|
+
position: absolute;
|
|
49
|
+
transition: transform 0.25s, opacity 0.25s;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.icon-copy {
|
|
53
|
+
transform: none;
|
|
54
|
+
opacity: 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.icon-check {
|
|
58
|
+
transform: scale(0.4);
|
|
59
|
+
opacity: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.check .icon-copy {
|
|
63
|
+
transform: scale(0.4);
|
|
64
|
+
opacity: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.check .icon-check {
|
|
68
|
+
transform: none;
|
|
69
|
+
opacity: 1;
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ClassValue } from "svelte/elements";
|
|
2
|
+
type Props = {
|
|
3
|
+
check: boolean;
|
|
4
|
+
link?: boolean;
|
|
5
|
+
class?: ClassValue;
|
|
6
|
+
};
|
|
7
|
+
declare const CopyIcon: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type CopyIcon = ReturnType<typeof CopyIcon>;
|
|
9
|
+
export default CopyIcon;
|
|
10
|
+
//# sourceMappingURL=CopyIcon.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyIcon.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/CopyIcon.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAM9C,KAAK,KAAK,GAAG;IACT,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,UAAU,CAAC;CACtB,CAAC;AA4BN,QAAA,MAAM,QAAQ,2CAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLSelectAttributes } from "svelte/elements";
|
|
4
|
+
import IconChevronDown from "./icons/IconChevronDown.svelte";
|
|
5
|
+
|
|
6
|
+
type DropdownOption = {
|
|
7
|
+
value: string;
|
|
8
|
+
label: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
};
|
|
11
|
+
type NativeSelectProps = Omit<
|
|
12
|
+
HTMLSelectAttributes,
|
|
13
|
+
"aria-label" | "id" | "size" | "value"
|
|
14
|
+
>;
|
|
15
|
+
type DropdownContentProps =
|
|
16
|
+
| {
|
|
17
|
+
options: readonly DropdownOption[];
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
children?: never;
|
|
20
|
+
}
|
|
21
|
+
| {
|
|
22
|
+
options?: never;
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
children: Snippet;
|
|
25
|
+
}
|
|
26
|
+
| {
|
|
27
|
+
options?: never;
|
|
28
|
+
placeholder: string;
|
|
29
|
+
children?: never;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
type Props = NativeSelectProps & {
|
|
33
|
+
id: string;
|
|
34
|
+
"aria-label": string;
|
|
35
|
+
value?: string;
|
|
36
|
+
width?: string;
|
|
37
|
+
select?: HTMLSelectElement;
|
|
38
|
+
} & DropdownContentProps;
|
|
39
|
+
|
|
40
|
+
let {
|
|
41
|
+
id,
|
|
42
|
+
value = $bindable(""),
|
|
43
|
+
width,
|
|
44
|
+
select = $bindable(),
|
|
45
|
+
options = [],
|
|
46
|
+
placeholder,
|
|
47
|
+
children,
|
|
48
|
+
class: className,
|
|
49
|
+
"aria-label": ariaLabel,
|
|
50
|
+
disabled,
|
|
51
|
+
...rest
|
|
52
|
+
}: Props = $props();
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<label class={["dropdown", disabled && "disabled", className]} style:width>
|
|
56
|
+
<select
|
|
57
|
+
bind:this={select}
|
|
58
|
+
bind:value
|
|
59
|
+
{id}
|
|
60
|
+
class={!value && placeholder ? "placeholder" : undefined}
|
|
61
|
+
aria-label={ariaLabel}
|
|
62
|
+
{disabled}
|
|
63
|
+
{...rest}
|
|
64
|
+
>
|
|
65
|
+
{#if placeholder}
|
|
66
|
+
<option value="" disabled hidden>{placeholder}</option>
|
|
67
|
+
{/if}
|
|
68
|
+
{#if options.length}
|
|
69
|
+
{#each options as option}
|
|
70
|
+
<option value={option.value} disabled={option.disabled}>
|
|
71
|
+
{option.label}
|
|
72
|
+
</option>
|
|
73
|
+
{/each}
|
|
74
|
+
{:else}
|
|
75
|
+
{@render children?.()}
|
|
76
|
+
{/if}
|
|
77
|
+
</select>
|
|
78
|
+
<span class="dropdown-icon" aria-hidden="true">
|
|
79
|
+
<IconChevronDown />
|
|
80
|
+
</span>
|
|
81
|
+
</label>
|
|
82
|
+
|
|
83
|
+
<style>
|
|
84
|
+
.dropdown {
|
|
85
|
+
--dropdown-padding-inline: 16px;
|
|
86
|
+
--dropdown-icon-size: 18px;
|
|
87
|
+
position: relative;
|
|
88
|
+
width: fit-content;
|
|
89
|
+
max-width: 100%;
|
|
90
|
+
min-height: 40px;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
select {
|
|
95
|
+
cursor: inherit;
|
|
96
|
+
font-size: 16px;
|
|
97
|
+
line-height: 122%;
|
|
98
|
+
height: 100%;
|
|
99
|
+
padding-inline: var(--dropdown-padding-inline);
|
|
100
|
+
padding-right: calc(var(--dropdown-padding-inline) + var(--dropdown-icon-size) + 9px);
|
|
101
|
+
user-select: none;
|
|
102
|
+
-webkit-user-select: none;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
select.placeholder {
|
|
106
|
+
color: var(--tertiary);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.dropdown-icon {
|
|
110
|
+
position: absolute;
|
|
111
|
+
right: var(--dropdown-padding-inline);
|
|
112
|
+
display: inline-flex;
|
|
113
|
+
align-items: center;
|
|
114
|
+
justify-content: center;
|
|
115
|
+
color: var(--tertiary);
|
|
116
|
+
pointer-events: none;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.dropdown:focus-within .dropdown-icon {
|
|
120
|
+
color: var(--primary);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.dropdown-icon :global(svg) {
|
|
124
|
+
width: var(--dropdown-icon-size);
|
|
125
|
+
height: var(--dropdown-icon-size);
|
|
126
|
+
stroke-width: 1.8px;
|
|
127
|
+
}
|
|
128
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLSelectAttributes } from "svelte/elements";
|
|
3
|
+
type DropdownOption = {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type NativeSelectProps = Omit<HTMLSelectAttributes, "aria-label" | "id" | "size" | "value">;
|
|
9
|
+
type DropdownContentProps = {
|
|
10
|
+
options: readonly DropdownOption[];
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
children?: never;
|
|
13
|
+
} | {
|
|
14
|
+
options?: never;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
children: Snippet;
|
|
17
|
+
} | {
|
|
18
|
+
options?: never;
|
|
19
|
+
placeholder: string;
|
|
20
|
+
children?: never;
|
|
21
|
+
};
|
|
22
|
+
type Props = NativeSelectProps & {
|
|
23
|
+
id: string;
|
|
24
|
+
"aria-label": string;
|
|
25
|
+
value?: string;
|
|
26
|
+
width?: string;
|
|
27
|
+
select?: HTMLSelectElement;
|
|
28
|
+
} & DropdownContentProps;
|
|
29
|
+
declare const Dropdown: import("svelte").Component<Props, {}, "value" | "select">;
|
|
30
|
+
type Dropdown = ReturnType<typeof Dropdown>;
|
|
31
|
+
export default Dropdown;
|
|
32
|
+
//# sourceMappingURL=Dropdown.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dropdown.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/Dropdown.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAIxD,KAAK,cAAc,GAAG;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AACF,KAAK,iBAAiB,GAAG,IAAI,CACzB,oBAAoB,EACpB,YAAY,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,CACzC,CAAC;AACF,KAAK,oBAAoB,GACnB;IACE,OAAO,EAAE,SAAS,cAAc,EAAE,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC;CACpB,GACC;IACE,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;CACrB,GACC;IACE,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC;CACpB,CAAC;AAEN,KAAK,KAAK,GAAG,iBAAiB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC9B,GAAG,oBAAoB,CAAC;AAiD7B,QAAA,MAAM,QAAQ,2DAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
|