@celar-ui/svelte 0.0.1
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/README.md +58 -0
- package/dist/buttons/BaseButton.svelte +48 -0
- package/dist/buttons/BaseButton.svelte.d.ts +7 -0
- package/dist/buttons/ElevatedButton.svelte +27 -0
- package/dist/buttons/ElevatedButton.svelte.d.ts +4 -0
- package/dist/buttons/FilledButton.svelte +27 -0
- package/dist/buttons/FilledButton.svelte.d.ts +4 -0
- package/dist/buttons/IconButton.svelte +56 -0
- package/dist/buttons/IconButton.svelte.d.ts +4 -0
- package/dist/buttons/OutlinedButton.svelte +24 -0
- package/dist/buttons/OutlinedButton.svelte.d.ts +4 -0
- package/dist/buttons/TextBaseButton.svelte +64 -0
- package/dist/buttons/TextBaseButton.svelte.d.ts +8 -0
- package/dist/buttons/TextButton.svelte +21 -0
- package/dist/buttons/TextButton.svelte.d.ts +4 -0
- package/dist/containment/Avatar.svelte +38 -0
- package/dist/containment/Avatar.svelte.d.ts +11 -0
- package/dist/containment/Breadcrumb.svelte +34 -0
- package/dist/containment/Breadcrumb.svelte.d.ts +4 -0
- package/dist/containment/Card.svelte +13 -0
- package/dist/containment/Card.svelte.d.ts +4 -0
- package/dist/containment/Container.svelte +37 -0
- package/dist/containment/Container.svelte.d.ts +10 -0
- package/dist/containment/Spacer.svelte +40 -0
- package/dist/containment/Spacer.svelte.d.ts +12 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +26 -0
- package/dist/inputs/Checkbox.svelte +70 -0
- package/dist/inputs/Checkbox.svelte.d.ts +8 -0
- package/dist/inputs/ColorInput.svelte +71 -0
- package/dist/inputs/ColorInput.svelte.d.ts +8 -0
- package/dist/inputs/FileInput.svelte +55 -0
- package/dist/inputs/FileInput.svelte.d.ts +9 -0
- package/dist/inputs/RadioGroup.svelte +17 -0
- package/dist/inputs/RadioGroup.svelte.d.ts +8 -0
- package/dist/inputs/RadioItem.svelte +53 -0
- package/dist/inputs/RadioItem.svelte.d.ts +8 -0
- package/dist/inputs/Slider.svelte +101 -0
- package/dist/inputs/Slider.svelte.d.ts +4 -0
- package/dist/inputs/Switch.svelte +75 -0
- package/dist/inputs/Switch.svelte.d.ts +8 -0
- package/dist/inputs/TextInput.svelte +96 -0
- package/dist/inputs/TextInput.svelte.d.ts +8 -0
- package/dist/misc/DotSpinner.svelte +75 -0
- package/dist/misc/DotSpinner.svelte.d.ts +7 -0
- package/dist/misc/DuckSpinner.svelte +209 -0
- package/dist/misc/DuckSpinner.svelte.d.ts +8 -0
- package/dist/misc/Gap.svelte +16 -0
- package/dist/misc/Gap.svelte.d.ts +6 -0
- package/dist/navigation/AppBar.svelte +61 -0
- package/dist/navigation/AppBar.svelte.d.ts +10 -0
- package/dist/navigation/NavigationBar.svelte +46 -0
- package/dist/navigation/NavigationBar.svelte.d.ts +4 -0
- package/dist/navigation/NavigationBarButton.svelte +58 -0
- package/dist/navigation/NavigationBarButton.svelte.d.ts +10 -0
- package/dist/overlay/Dialog.svelte +133 -0
- package/dist/overlay/Dialog.svelte.d.ts +16 -0
- package/package.json +71 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Checkbox, type CheckboxRootProps, type WithoutChildren } from 'bits-ui';
|
|
3
|
+
import IconTick from '~icons/hugeicons/tick-01';
|
|
4
|
+
import IconMinus from '~icons/hugeicons/minus-sign';
|
|
5
|
+
import type { Snippet } from 'svelte';
|
|
6
|
+
|
|
7
|
+
type CheckboxProps = WithoutChildren<CheckboxRootProps> & {
|
|
8
|
+
children?: Snippet;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
let { children, ...rest }: CheckboxProps = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<label data-checkbox>
|
|
15
|
+
<div data-checkbox-icon>
|
|
16
|
+
<Checkbox.Root {...rest}>
|
|
17
|
+
{#snippet children({ checked, indeterminate })}
|
|
18
|
+
{#if checked}
|
|
19
|
+
<IconTick font-size="20px" />
|
|
20
|
+
{/if}
|
|
21
|
+
{#if indeterminate}
|
|
22
|
+
<IconMinus />
|
|
23
|
+
{/if}
|
|
24
|
+
{/snippet}
|
|
25
|
+
</Checkbox.Root>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
{@render children?.()}
|
|
29
|
+
</label>
|
|
30
|
+
|
|
31
|
+
<style>[data-checkbox] {
|
|
32
|
+
position: relative;
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
display: flex;
|
|
35
|
+
justify-content: flex-start;
|
|
36
|
+
align-items: center;
|
|
37
|
+
transition-property: background-color;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
-webkit-tap-highlight-color: transparent;
|
|
40
|
+
border-radius: var(--radius--half);
|
|
41
|
+
padding: var(--gap--sm) 0;
|
|
42
|
+
padding-right: var(--gap);
|
|
43
|
+
width: 100%;
|
|
44
|
+
}
|
|
45
|
+
[data-checkbox]:hover {
|
|
46
|
+
background-color: var(--color-primary--lighter);
|
|
47
|
+
}
|
|
48
|
+
[data-checkbox] [data-checkbox-icon] {
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-shrink: 0;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
align-items: center;
|
|
53
|
+
width: 48px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
:global([data-checkbox-root]) {
|
|
57
|
+
display: flex;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
align-items: center;
|
|
60
|
+
height: 24px;
|
|
61
|
+
width: 32px;
|
|
62
|
+
background-color: transparent;
|
|
63
|
+
outline: none;
|
|
64
|
+
border: 1px solid var(--color-primary--dark);
|
|
65
|
+
border-radius: var(--radius--half);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:global([data-checkbox-root][data-state="checked"]) {
|
|
69
|
+
background-color: var(--color-primary);
|
|
70
|
+
}</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Checkbox, type CheckboxRootProps, type WithoutChildren } from 'bits-ui';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type CheckboxProps = WithoutChildren<CheckboxRootProps> & {
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
};
|
|
6
|
+
declare const Checkbox: import("svelte").Component<CheckboxProps, {}, "">;
|
|
7
|
+
type Checkbox = ReturnType<typeof Checkbox>;
|
|
8
|
+
export default Checkbox;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
interface ColorInputProps extends HTMLInputAttributes {
|
|
6
|
+
icon?: Snippet;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { value = $bindable(), placeholder, icon, ...rest }: ColorInputProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<label data-color-input>
|
|
13
|
+
<input {...rest} type="color" bind:value {placeholder} />
|
|
14
|
+
|
|
15
|
+
<div data-color-input-icon>
|
|
16
|
+
{@render icon?.()}
|
|
17
|
+
</div>
|
|
18
|
+
<div data-color-input-placeholder>{placeholder}</div>
|
|
19
|
+
</label>
|
|
20
|
+
|
|
21
|
+
<style>[data-color-input] {
|
|
22
|
+
display: flex;
|
|
23
|
+
position: relative;
|
|
24
|
+
justify-content: flex-start;
|
|
25
|
+
align-items: center;
|
|
26
|
+
border: 1px solid var(--color-border);
|
|
27
|
+
border-radius: var(--radius);
|
|
28
|
+
padding: var(--gap--md) 0;
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
[data-color-input] > input {
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: 0;
|
|
34
|
+
right: 0;
|
|
35
|
+
-webkit-appearance: none;
|
|
36
|
+
-moz-appearance: none;
|
|
37
|
+
appearance: none;
|
|
38
|
+
outline: none;
|
|
39
|
+
border: none;
|
|
40
|
+
border-radius: var(--radius);
|
|
41
|
+
width: 64px;
|
|
42
|
+
height: 100%;
|
|
43
|
+
}
|
|
44
|
+
[data-color-input] > input::-moz-color-swatch {
|
|
45
|
+
border: none;
|
|
46
|
+
}
|
|
47
|
+
[data-color-input] > input::-webkit-color-swatch-wrapper {
|
|
48
|
+
padding: 0;
|
|
49
|
+
}
|
|
50
|
+
[data-color-input] > input::-webkit-color-swatch {
|
|
51
|
+
border: none;
|
|
52
|
+
border-radius: var(--radius);
|
|
53
|
+
}
|
|
54
|
+
[data-color-input] [data-color-input-icon] {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-shrink: 0;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
align-items: center;
|
|
59
|
+
width: 48px;
|
|
60
|
+
height: 100%;
|
|
61
|
+
line-height: 1rem;
|
|
62
|
+
}
|
|
63
|
+
[data-color-input] [data-color-input-placeholder] {
|
|
64
|
+
margin-right: 4rem;
|
|
65
|
+
padding-right: var(--gap--half);
|
|
66
|
+
max-width: 100%;
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
color: rgba(var(--color-text--rgb), 0.4);
|
|
69
|
+
text-overflow: ellipsis;
|
|
70
|
+
white-space: nowrap;
|
|
71
|
+
}</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
+
interface ColorInputProps extends HTMLInputAttributes {
|
|
4
|
+
icon?: Snippet;
|
|
5
|
+
}
|
|
6
|
+
declare const ColorInput: import("svelte").Component<ColorInputProps, {}, "value">;
|
|
7
|
+
type ColorInput = ReturnType<typeof ColorInput>;
|
|
8
|
+
export default ColorInput;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
interface FileInputProps extends HTMLInputAttributes {
|
|
6
|
+
icon?: Snippet;
|
|
7
|
+
files?: FileList;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let { icon, files = $bindable(), placeholder, ...rest }: FileInputProps = $props();
|
|
11
|
+
let firstFileName = $derived(files?.[0]?.name);
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<label data-file-input>
|
|
15
|
+
<input {...rest} type="file" bind:files {placeholder} />
|
|
16
|
+
|
|
17
|
+
<div data-file-input-icon>
|
|
18
|
+
{@render icon?.()}
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<div data-file-input-placeholder>
|
|
22
|
+
{firstFileName ?? placeholder}
|
|
23
|
+
</div>
|
|
24
|
+
</label>
|
|
25
|
+
|
|
26
|
+
<style>[data-file-input] {
|
|
27
|
+
display: flex;
|
|
28
|
+
position: relative;
|
|
29
|
+
justify-content: flex-start;
|
|
30
|
+
align-items: center;
|
|
31
|
+
border: 1px solid var(--color-border);
|
|
32
|
+
border-radius: var(--radius);
|
|
33
|
+
padding: var(--gap--md) 0;
|
|
34
|
+
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
[data-file-input] input {
|
|
37
|
+
display: none;
|
|
38
|
+
}
|
|
39
|
+
[data-file-input] [data-file-input-icon] {
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-shrink: 0;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
align-items: center;
|
|
44
|
+
width: 48px;
|
|
45
|
+
height: 100%;
|
|
46
|
+
line-height: 1rem;
|
|
47
|
+
}
|
|
48
|
+
[data-file-input] [data-file-input-placeholder] {
|
|
49
|
+
padding-right: var(--gap);
|
|
50
|
+
max-width: 100%;
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
color: rgba(var(--color-text--rgb), 0.4);
|
|
53
|
+
text-overflow: ellipsis;
|
|
54
|
+
white-space: nowrap;
|
|
55
|
+
}</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
+
interface FileInputProps extends HTMLInputAttributes {
|
|
4
|
+
icon?: Snippet;
|
|
5
|
+
files?: FileList;
|
|
6
|
+
}
|
|
7
|
+
declare const FileInput: import("svelte").Component<FileInputProps, {}, "files">;
|
|
8
|
+
type FileInput = ReturnType<typeof FileInput>;
|
|
9
|
+
export default FileInput;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RadioGroup, type RadioGroupRootProps, type WithoutChildren } from 'bits-ui';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
export type RadioGroupProps = WithoutChildren<RadioGroupRootProps> & {
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
};
|
|
8
|
+
let { value = $bindable(''), children, ...rest }: RadioGroupProps = $props();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<RadioGroup.Root {...rest} bind:value>
|
|
12
|
+
{@render children?.()}
|
|
13
|
+
</RadioGroup.Root>
|
|
14
|
+
|
|
15
|
+
<style>:global([data-radio-group-root]) {
|
|
16
|
+
position: relative;
|
|
17
|
+
}</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RadioGroup, type RadioGroupRootProps, type WithoutChildren } from 'bits-ui';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
export type RadioGroupProps = WithoutChildren<RadioGroupRootProps> & {
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
};
|
|
6
|
+
declare const RadioGroup: import("svelte").Component<RadioGroupProps, {}, "value">;
|
|
7
|
+
type RadioGroup = ReturnType<typeof RadioGroup>;
|
|
8
|
+
export default RadioGroup;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RadioGroup, type RadioGroupItemProps, type WithoutChildren } from 'bits-ui';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
export type RadioItemProps = WithoutChildren<RadioGroupItemProps> & {
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
};
|
|
8
|
+
let { children, ...rest }: RadioItemProps = $props();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<label data-radio-item>
|
|
12
|
+
<div data-radio-item-icon>
|
|
13
|
+
<RadioGroup.Item {...rest} />
|
|
14
|
+
</div>
|
|
15
|
+
{@render children?.()}
|
|
16
|
+
</label>
|
|
17
|
+
|
|
18
|
+
<style>[data-radio-item] {
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
display: flex;
|
|
21
|
+
justify-content: flex-start;
|
|
22
|
+
align-items: center;
|
|
23
|
+
transition-property: background-color;
|
|
24
|
+
transition-duration: var(--transition-dur);
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
-webkit-tap-highlight-color: transparent;
|
|
27
|
+
border-radius: var(--radius--half);
|
|
28
|
+
padding: var(--gap--sm) 0;
|
|
29
|
+
padding-right: var(--gap);
|
|
30
|
+
width: 100%;
|
|
31
|
+
}
|
|
32
|
+
[data-radio-item] [data-radio-item-icon] {
|
|
33
|
+
width: 48px;
|
|
34
|
+
display: flex;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
align-items: center;
|
|
37
|
+
}
|
|
38
|
+
[data-radio-item]:hover {
|
|
39
|
+
background-color: var(--color-primary--lighter);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:global([data-radio-group-item]) {
|
|
43
|
+
background-color: transparent;
|
|
44
|
+
outline: 1px solid var(--color-primary--dark);
|
|
45
|
+
border: 4px solid var(--color-bg);
|
|
46
|
+
width: 24px;
|
|
47
|
+
height: 24px;
|
|
48
|
+
border-radius: 50%;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:global([data-radio-group-item][data-state="checked"]) {
|
|
52
|
+
background-color: var(--color-primary--dark);
|
|
53
|
+
}</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type RadioGroupItemProps, type WithoutChildren } from 'bits-ui';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
export type RadioItemProps = WithoutChildren<RadioGroupItemProps> & {
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
};
|
|
6
|
+
declare const RadioItem: import("svelte").Component<RadioItemProps, {}, "">;
|
|
7
|
+
type RadioItem = ReturnType<typeof RadioItem>;
|
|
8
|
+
export default RadioItem;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
+
|
|
4
|
+
let { value = $bindable(), min, max, ...rest }: HTMLInputAttributes = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<div data-slider>
|
|
8
|
+
<input
|
|
9
|
+
type="range"
|
|
10
|
+
bind:value
|
|
11
|
+
style:--val={value || 0}
|
|
12
|
+
style:--min={min || 0}
|
|
13
|
+
style:--max={max || 100}
|
|
14
|
+
{...rest}
|
|
15
|
+
/>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<style>[data-slider] {
|
|
19
|
+
position: relative;
|
|
20
|
+
padding: 0 var(--gap);
|
|
21
|
+
}
|
|
22
|
+
[data-slider] > input {
|
|
23
|
+
--range: calc(var(--max) - var(--min));
|
|
24
|
+
--ratio: calc((var(--val) - var(--min)) / var(--range));
|
|
25
|
+
--sx: calc(0.5 *24px + var(--ratio) * (100% - 24px));
|
|
26
|
+
margin: 0;
|
|
27
|
+
background: transparent;
|
|
28
|
+
padding: 0;
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 24px;
|
|
31
|
+
}
|
|
32
|
+
[data-slider] > input, [data-slider] > input::-webkit-slider-thumb {
|
|
33
|
+
-webkit-appearance: none;
|
|
34
|
+
appearance: none;
|
|
35
|
+
}
|
|
36
|
+
[data-slider] > input::-webkit-slider-runnable-track {
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
border: none;
|
|
39
|
+
border-radius: var(--radius);
|
|
40
|
+
background: var(--color-alt--light);
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: var(--gap--half);
|
|
43
|
+
}
|
|
44
|
+
[data-slider] > input::-webkit-slider-runnable-track {
|
|
45
|
+
background: linear-gradient(var(--color-primary--dark), var(--color-primary--dark)) 0/var(--sx) 100% no-repeat var(--color-alt--light);
|
|
46
|
+
}
|
|
47
|
+
[data-slider] > input::-moz-range-track {
|
|
48
|
+
box-sizing: border-box;
|
|
49
|
+
border: none;
|
|
50
|
+
border-radius: var(--radius);
|
|
51
|
+
background: var(--color-alt--light);
|
|
52
|
+
width: 100%;
|
|
53
|
+
height: var(--gap--half);
|
|
54
|
+
}
|
|
55
|
+
[data-slider] > input::-ms-track {
|
|
56
|
+
box-sizing: border-box;
|
|
57
|
+
border: none;
|
|
58
|
+
border-radius: var(--radius);
|
|
59
|
+
background: var(--color-alt--light);
|
|
60
|
+
width: 100%;
|
|
61
|
+
height: var(--gap--half);
|
|
62
|
+
}
|
|
63
|
+
[data-slider] > input::-moz-range-progress {
|
|
64
|
+
border-radius: var(--radius);
|
|
65
|
+
background: var(--color-primary--dark);
|
|
66
|
+
height: var(--gap--half);
|
|
67
|
+
}
|
|
68
|
+
[data-slider] > input::-ms-fill-lower {
|
|
69
|
+
border-radius: var(--radius);
|
|
70
|
+
background: var(--color-primary--dark);
|
|
71
|
+
height: var(--gap--half);
|
|
72
|
+
}
|
|
73
|
+
[data-slider] > input::-webkit-slider-thumb {
|
|
74
|
+
margin-top: calc(0.5 * (var(--gap--half) - 24px));
|
|
75
|
+
box-sizing: border-box;
|
|
76
|
+
border: none;
|
|
77
|
+
border-radius: 50%;
|
|
78
|
+
background: var(--color-primary--dark);
|
|
79
|
+
width: 24px;
|
|
80
|
+
height: 24px;
|
|
81
|
+
}
|
|
82
|
+
[data-slider] > input::-moz-range-thumb {
|
|
83
|
+
box-sizing: border-box;
|
|
84
|
+
border: none;
|
|
85
|
+
border-radius: 50%;
|
|
86
|
+
background: var(--color-primary--dark);
|
|
87
|
+
width: 24px;
|
|
88
|
+
height: 24px;
|
|
89
|
+
}
|
|
90
|
+
[data-slider] > input::-ms-thumb {
|
|
91
|
+
margin-top: 0;
|
|
92
|
+
box-sizing: border-box;
|
|
93
|
+
border: none;
|
|
94
|
+
border-radius: 50%;
|
|
95
|
+
background: var(--color-primary--dark);
|
|
96
|
+
width: 24px;
|
|
97
|
+
height: 24px;
|
|
98
|
+
}
|
|
99
|
+
[data-slider] > input::-ms-tooltip {
|
|
100
|
+
display: none;
|
|
101
|
+
}</style>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Switch, type SwitchRootProps, type WithoutChildren } from 'bits-ui';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
export type SwitchProps = WithoutChildren<SwitchRootProps> & {
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
let { checked = $bindable(false), children, ...rest }: SwitchProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<label data-switch>
|
|
13
|
+
<Switch.Root {...rest} bind:checked>
|
|
14
|
+
<Switch.Thumb />
|
|
15
|
+
</Switch.Root>
|
|
16
|
+
|
|
17
|
+
{@render children?.()}
|
|
18
|
+
</label>
|
|
19
|
+
|
|
20
|
+
<style>[data-switch] {
|
|
21
|
+
position: relative;
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: flex-start;
|
|
25
|
+
align-items: center;
|
|
26
|
+
transition-property: background-color;
|
|
27
|
+
transition-duration: var(--transition-dur);
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
-webkit-tap-highlight-color: transparent;
|
|
30
|
+
border-radius: var(--radius--half);
|
|
31
|
+
padding: var(--gap--sm) 0;
|
|
32
|
+
padding-right: var(--gap);
|
|
33
|
+
width: 100%;
|
|
34
|
+
}
|
|
35
|
+
[data-switch]:hover {
|
|
36
|
+
background-color: var(--color-primary--lighter);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:global([data-switch-root]) {
|
|
40
|
+
position: relative;
|
|
41
|
+
display: block;
|
|
42
|
+
width: 38px;
|
|
43
|
+
height: 24px;
|
|
44
|
+
border-radius: 24px;
|
|
45
|
+
background-color: var(--color-bg);
|
|
46
|
+
outline: 1px solid var(--color-primary--dark);
|
|
47
|
+
border: none;
|
|
48
|
+
transition-property: background-color;
|
|
49
|
+
transition-duration: var(--transition-dur);
|
|
50
|
+
margin: 0 5px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:global([data-switch-thumb]) {
|
|
54
|
+
position: absolute;
|
|
55
|
+
top: 2px;
|
|
56
|
+
left: 2px;
|
|
57
|
+
display: block;
|
|
58
|
+
width: 20px;
|
|
59
|
+
height: 20px;
|
|
60
|
+
border-radius: 20px;
|
|
61
|
+
box-sizing: border-box;
|
|
62
|
+
background-color: var(--color-primary--dark);
|
|
63
|
+
transition-property: background-color, transform, outline-color;
|
|
64
|
+
transition-duration: var(--transition-dur);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:global([data-switch-root][data-state="checked"]) {
|
|
68
|
+
background-color: var(--color-primary--dark);
|
|
69
|
+
outline-color: var(--color-primary--darker);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:global([data-switch-thumb][data-state="checked"]) {
|
|
73
|
+
background-color: var(--color-primary--lighter);
|
|
74
|
+
transform: translateX(14px);
|
|
75
|
+
}</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Switch, type SwitchRootProps, type WithoutChildren } from 'bits-ui';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
export type SwitchProps = WithoutChildren<SwitchRootProps> & {
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
};
|
|
6
|
+
declare const Switch: import("svelte").Component<SwitchProps, {}, "checked">;
|
|
7
|
+
type Switch = ReturnType<typeof Switch>;
|
|
8
|
+
export default Switch;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
interface TextInputProps extends HTMLInputAttributes {
|
|
6
|
+
icon?: Snippet;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { icon, value = $bindable(), placeholder, ...rest }: TextInputProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<label data-text-input>
|
|
13
|
+
<input {...rest} bind:value {placeholder} />
|
|
14
|
+
|
|
15
|
+
<div data-text-input-icon>
|
|
16
|
+
{@render icon?.()}
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<div data-text-input-placeholder>{placeholder}</div>
|
|
20
|
+
</label>
|
|
21
|
+
|
|
22
|
+
<style>[data-text-input] {
|
|
23
|
+
margin: 0;
|
|
24
|
+
padding: 0;
|
|
25
|
+
display: block;
|
|
26
|
+
position: relative;
|
|
27
|
+
width: 100%;
|
|
28
|
+
}
|
|
29
|
+
[data-text-input] input {
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
transition-duration: var(--transition-dur);
|
|
32
|
+
transition-property: border-color;
|
|
33
|
+
border: 1px solid var(--color-border);
|
|
34
|
+
border-radius: var(--radius);
|
|
35
|
+
background-color: transparent;
|
|
36
|
+
padding: var(--gap--md) var(--gap);
|
|
37
|
+
padding-left: 48px;
|
|
38
|
+
width: 100%;
|
|
39
|
+
font-size: inherit;
|
|
40
|
+
font-family: inherit;
|
|
41
|
+
}
|
|
42
|
+
[data-text-input] input:focus {
|
|
43
|
+
outline: none;
|
|
44
|
+
border: 1px solid var(--color-primary);
|
|
45
|
+
}
|
|
46
|
+
[data-text-input] input:focus + [data-text-input-icon] {
|
|
47
|
+
color: var(--color-primary--dark);
|
|
48
|
+
}
|
|
49
|
+
[data-text-input] input:is(:-moz-placeholder) ~ [data-text-input-placeholder] {
|
|
50
|
+
top: var(--gap--md);
|
|
51
|
+
right: calc(100% - 48px);
|
|
52
|
+
translate: 100%;
|
|
53
|
+
visibility: hidden;
|
|
54
|
+
opacity: 0;
|
|
55
|
+
}
|
|
56
|
+
[data-text-input] input:is(:placeholder-shown) ~ [data-text-input-placeholder] {
|
|
57
|
+
top: var(--gap--md);
|
|
58
|
+
right: calc(100% - 48px);
|
|
59
|
+
translate: 100%;
|
|
60
|
+
visibility: hidden;
|
|
61
|
+
opacity: 0;
|
|
62
|
+
}
|
|
63
|
+
[data-text-input] input::-moz-placeholder {
|
|
64
|
+
opacity: 1;
|
|
65
|
+
color: rgba(var(--color-text--rgb), 0.4);
|
|
66
|
+
}
|
|
67
|
+
[data-text-input] input::placeholder {
|
|
68
|
+
opacity: 1;
|
|
69
|
+
color: rgba(var(--color-text--rgb), 0.4);
|
|
70
|
+
}
|
|
71
|
+
[data-text-input] [data-text-input-icon] {
|
|
72
|
+
display: flex;
|
|
73
|
+
position: absolute;
|
|
74
|
+
top: 0;
|
|
75
|
+
left: 0;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
align-items: center;
|
|
78
|
+
transition-duration: var(--transition-dur);
|
|
79
|
+
transition-property: color;
|
|
80
|
+
width: 48px;
|
|
81
|
+
height: 100%;
|
|
82
|
+
pointer-events: none;
|
|
83
|
+
}
|
|
84
|
+
[data-text-input] [data-text-input-placeholder] {
|
|
85
|
+
position: absolute;
|
|
86
|
+
transition-duration: var(--transition-dur);
|
|
87
|
+
transition-property: visibility, opacity, top, right, translate;
|
|
88
|
+
pointer-events: none;
|
|
89
|
+
color: rgba(var(--color-text--rgb), 0.4);
|
|
90
|
+
font-size: smaller;
|
|
91
|
+
top: 0;
|
|
92
|
+
right: var(--gap);
|
|
93
|
+
translate: 0;
|
|
94
|
+
visibility: visible;
|
|
95
|
+
opacity: 1;
|
|
96
|
+
}</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
+
interface TextInputProps extends HTMLInputAttributes {
|
|
4
|
+
icon?: Snippet;
|
|
5
|
+
}
|
|
6
|
+
declare const TextInput: import("svelte").Component<TextInputProps, {}, "value">;
|
|
7
|
+
type TextInput = ReturnType<typeof TextInput>;
|
|
8
|
+
export default TextInput;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let { color = 'var(--color-primary--dark)', size }: { color?: string; size?: string } = $props();
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<svg viewBox="0 0 57 60" xmlns="http://www.w3.org/2000/svg" stroke={color} style:width={size}>
|
|
6
|
+
<g fill="none" fill-rule="evenodd">
|
|
7
|
+
<g transform="translate(1 1)" stroke-width="3">
|
|
8
|
+
<circle cx="5" cy="50" r="5">
|
|
9
|
+
<animate
|
|
10
|
+
attributeName="cy"
|
|
11
|
+
begin="0s"
|
|
12
|
+
dur="2.2s"
|
|
13
|
+
values="50;5;50;50"
|
|
14
|
+
calcMode="linear"
|
|
15
|
+
repeatCount="indefinite"
|
|
16
|
+
/>
|
|
17
|
+
<animate
|
|
18
|
+
attributeName="cx"
|
|
19
|
+
begin="0s"
|
|
20
|
+
dur="2.2s"
|
|
21
|
+
values="5;27;49;5"
|
|
22
|
+
calcMode="linear"
|
|
23
|
+
repeatCount="indefinite"
|
|
24
|
+
/>
|
|
25
|
+
</circle>
|
|
26
|
+
<circle cx="27" cy="5" r="5">
|
|
27
|
+
<animate
|
|
28
|
+
attributeName="cy"
|
|
29
|
+
begin="0s"
|
|
30
|
+
dur="2.2s"
|
|
31
|
+
from="5"
|
|
32
|
+
to="5"
|
|
33
|
+
values="5;50;50;5"
|
|
34
|
+
calcMode="linear"
|
|
35
|
+
repeatCount="indefinite"
|
|
36
|
+
/>
|
|
37
|
+
<animate
|
|
38
|
+
attributeName="cx"
|
|
39
|
+
begin="0s"
|
|
40
|
+
dur="2.2s"
|
|
41
|
+
from="27"
|
|
42
|
+
to="27"
|
|
43
|
+
values="27;49;5;27"
|
|
44
|
+
calcMode="linear"
|
|
45
|
+
repeatCount="indefinite"
|
|
46
|
+
/>
|
|
47
|
+
</circle>
|
|
48
|
+
<circle cx="49" cy="50" r="5">
|
|
49
|
+
<animate
|
|
50
|
+
attributeName="cy"
|
|
51
|
+
begin="0s"
|
|
52
|
+
dur="2.2s"
|
|
53
|
+
values="50;50;5;50"
|
|
54
|
+
calcMode="linear"
|
|
55
|
+
repeatCount="indefinite"
|
|
56
|
+
/>
|
|
57
|
+
<animate
|
|
58
|
+
attributeName="cx"
|
|
59
|
+
from="49"
|
|
60
|
+
to="49"
|
|
61
|
+
begin="0s"
|
|
62
|
+
dur="2.2s"
|
|
63
|
+
values="49;5;27;49"
|
|
64
|
+
calcMode="linear"
|
|
65
|
+
repeatCount="indefinite"
|
|
66
|
+
/>
|
|
67
|
+
</circle>
|
|
68
|
+
</g>
|
|
69
|
+
</g>
|
|
70
|
+
</svg>
|
|
71
|
+
|
|
72
|
+
<style>svg {
|
|
73
|
+
display: inline-block;
|
|
74
|
+
aspect-ratio: 1;
|
|
75
|
+
}</style>
|