@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,209 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
interface Props extends HTMLAttributes<SVGElement> {
|
|
4
|
+
thin?: boolean;
|
|
5
|
+
size?: number | string;
|
|
6
|
+
}
|
|
7
|
+
let { thin, size, ...rest }: Props = $props();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<svg
|
|
11
|
+
{...rest}
|
|
12
|
+
data-duck-spinner
|
|
13
|
+
data-thin={thin}
|
|
14
|
+
width={size || 24}
|
|
15
|
+
height={size || 24}
|
|
16
|
+
viewBox="0 0 33.866664 33.866664"
|
|
17
|
+
version="1.1"
|
|
18
|
+
id="svg1"
|
|
19
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
20
|
+
>
|
|
21
|
+
<defs id="defs1" />
|
|
22
|
+
|
|
23
|
+
<g id="layer1" class="spinner">
|
|
24
|
+
<g class="circle-0" id="g22">
|
|
25
|
+
<path
|
|
26
|
+
class="line"
|
|
27
|
+
d="m 2.6736248,14.203488 c 0,0 1.3951363,-7.2354312 7.3763862,-10.1229312"
|
|
28
|
+
id="path16"
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
<path
|
|
32
|
+
class="line"
|
|
33
|
+
d="m 12.71875,2.8875 c 0,0 4.60625,-1.71875 9.4875,0.4812498"
|
|
34
|
+
id="path17"
|
|
35
|
+
/>
|
|
36
|
+
|
|
37
|
+
<path
|
|
38
|
+
class="line"
|
|
39
|
+
d="m 26.984672,6.2784102 c 0,0 4.335839,2.9861583 4.537202,11.2528398"
|
|
40
|
+
id="path18"
|
|
41
|
+
/>
|
|
42
|
+
|
|
43
|
+
<path
|
|
44
|
+
class="line"
|
|
45
|
+
d="m 29.595148,24.26875 c 0,0 -1.718898,3.074016 -4.260773,4.657814"
|
|
46
|
+
id="path19"
|
|
47
|
+
/>
|
|
48
|
+
|
|
49
|
+
<path
|
|
50
|
+
class="line"
|
|
51
|
+
d="m 2.3458408,16.147909 c 0,0 -0.2229316,2.290195 0.5701363,5.027807"
|
|
52
|
+
id="path20"
|
|
53
|
+
/>
|
|
54
|
+
|
|
55
|
+
<path
|
|
56
|
+
class="line"
|
|
57
|
+
d="m 4.05625,23.85625 c 0,0 2.8513975,4.80416 6.907648,6.316658"
|
|
58
|
+
id="path21"
|
|
59
|
+
/>
|
|
60
|
+
|
|
61
|
+
<path class="line" d="m 12.925,30.8 c 0,0 2.709727,1.613897 8.897227,-0.0361" id="path22" />
|
|
62
|
+
</g>
|
|
63
|
+
|
|
64
|
+
<g class="circle-1" id="g33">
|
|
65
|
+
<path
|
|
66
|
+
class="line"
|
|
67
|
+
d="m 8.1124998,6.9093749 c 0,0 3.4031252,-3.575 9.1093752,-3.334375"
|
|
68
|
+
id="path23"
|
|
69
|
+
/>
|
|
70
|
+
|
|
71
|
+
<path
|
|
72
|
+
class="line"
|
|
73
|
+
d="m 19.353125,3.7812501 c 0,0 2.6125,0.4468749 4.090625,1.44375"
|
|
74
|
+
id="path24"
|
|
75
|
+
/>
|
|
76
|
+
|
|
77
|
+
<path
|
|
78
|
+
class="line"
|
|
79
|
+
d="m 24.921875,6.2562498 c 0,0 2.578125,1.684375 3.85,4.3656252"
|
|
80
|
+
id="path25"
|
|
81
|
+
/>
|
|
82
|
+
|
|
83
|
+
<path class="line" d="m 29.35625,11.928125 0.412498,1.203125" id="path26" />
|
|
84
|
+
|
|
85
|
+
<path
|
|
86
|
+
class="line"
|
|
87
|
+
d="m 30.018892,14.511157 c 0,0 0.947965,3.913394 -0.802124,7.632334"
|
|
88
|
+
id="path27"
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
<path
|
|
92
|
+
class="line"
|
|
93
|
+
d="m 28.050043,24.160955 c 0,0 -0.872306,2.180701 -3.740298,3.943598"
|
|
94
|
+
id="path28"
|
|
95
|
+
/>
|
|
96
|
+
|
|
97
|
+
<path
|
|
98
|
+
class="line"
|
|
99
|
+
d="m 22.046263,29.19246 c 0,0 -1.89593,0.753513 -3.135576,0.923658"
|
|
100
|
+
id="path29"
|
|
101
|
+
/>
|
|
102
|
+
|
|
103
|
+
<path
|
|
104
|
+
class="line"
|
|
105
|
+
d="m 15.483429,30.140425 c 0,0 -5.298882,-0.486134 -7.996936,-3.743245"
|
|
106
|
+
id="path30"
|
|
107
|
+
/>
|
|
108
|
+
|
|
109
|
+
<path
|
|
110
|
+
class="line"
|
|
111
|
+
d="m 6.0843749,24.6125 c 0,0 -2.475,-3.09375 -2.475,-6.634375"
|
|
112
|
+
id="path31"
|
|
113
|
+
/>
|
|
114
|
+
|
|
115
|
+
<path
|
|
116
|
+
class="line"
|
|
117
|
+
d="M 3.678125,15.5375 C 3.713349,14.304345 3.8090817,13.658535 4.4343751,12.03125"
|
|
118
|
+
id="path32"
|
|
119
|
+
/>
|
|
120
|
+
|
|
121
|
+
<path
|
|
122
|
+
class="line"
|
|
123
|
+
d="m 5.2593749,10.45 c 0,0 1.1,-1.7187501 1.4437501,-2.0625002"
|
|
124
|
+
id="path33"
|
|
125
|
+
/>
|
|
126
|
+
</g>
|
|
127
|
+
</g>
|
|
128
|
+
|
|
129
|
+
<g id="layer2" class="duck" transform="translate(0.275,0.1375)">
|
|
130
|
+
<path
|
|
131
|
+
class="line body"
|
|
132
|
+
d="m 9.95702,9.979603 c -0.7389196,0.208826 -1.0762528,0.578285 -1.0441258,0.931682 0.032127,0.353397 0.128508,0.78711 1.1405078,0.803174 1.011998,0.01607 3.421521,0.08033 3.421521,0.08033 0,0 0.09639,0.337333 -0.01607,0.46584 -0.112449,0.128509 -3.5500282,2.232824 -3.325139,5.477647 0.224887,3.244824 1.879426,4.465647 1.879426,4.465647 0,0 0.04819,3.276951 0.06425,3.630348 0.01606,0.353396 0.144572,1.060189 0.658603,1.413586 0.514032,0.353399 1.65454,0.754982 2.955682,-0.04819 1.301141,-0.803175 2.666536,-1.943682 3.132379,-3.084189 0.46584,-1.140508 0.594348,-2.12038 0.594348,-2.409522 0,-0.289142 0.04819,-0.497969 0.658602,-0.497969 0.610412,0 3.935553,0.01607 4.128316,0.01607 0.192761,0 1.493903,-0.06425 1.831237,-0.867427 0.337332,-0.803173 0.41765,-1.89549 -0.497968,-3.100252 C 24.622977,16.051607 23.3379,14.766528 21.95644,14.493449 20.57498,14.220368 19.884252,14.284623 19.675426,14.043671 19.4666,13.802719 18.72768,12.983481 19.225647,12.035735 19.723615,11.087991 20.462536,9.4334513 19.900316,8.2286905 19.338094,7.0239223 18.599174,5.9316054 17.42654,5.6263993 16.253905,5.3211932 15.177652,5.2569394 14.406605,5.5942725 13.635557,5.9316054 12.880574,6.4135099 12.382606,7.3291285 11.884638,8.244747 11.884638,8.9354766 11.322418,9.3210006 10.760195,9.7065237 9.95702,9.9796019 9.95702,9.979603 Z"
|
|
133
|
+
id="path34"
|
|
134
|
+
/>
|
|
135
|
+
|
|
136
|
+
<circle class="line eye" id="path35" cx="15.920952" cy="8.3493843" r="1.069499" />
|
|
137
|
+
</g>
|
|
138
|
+
</svg>
|
|
139
|
+
|
|
140
|
+
<style>[data-duck-spinner] .line {
|
|
141
|
+
fill: none;
|
|
142
|
+
stroke: var(--color-text);
|
|
143
|
+
stroke-width: 1.2;
|
|
144
|
+
stroke-linecap: round;
|
|
145
|
+
stroke-linejoin: round;
|
|
146
|
+
stroke-dasharray: none;
|
|
147
|
+
transition-duration: var(--transition-duration);
|
|
148
|
+
transition-property: stroke;
|
|
149
|
+
}
|
|
150
|
+
[data-duck-spinner] .spinner {
|
|
151
|
+
transform-origin: center;
|
|
152
|
+
scale: 1.1;
|
|
153
|
+
}
|
|
154
|
+
[data-duck-spinner] .spinner > * {
|
|
155
|
+
transform-origin: center;
|
|
156
|
+
opacity: 0.64;
|
|
157
|
+
animation-duration: 3s;
|
|
158
|
+
animation-timing-function: linear;
|
|
159
|
+
animation-iteration-count: infinite;
|
|
160
|
+
animation-name: spin;
|
|
161
|
+
}
|
|
162
|
+
[data-duck-spinner] .spinner .circle-1 {
|
|
163
|
+
scale: 0.85;
|
|
164
|
+
opacity: 0.32;
|
|
165
|
+
animation-direction: reverse;
|
|
166
|
+
}
|
|
167
|
+
@keyframes spin {
|
|
168
|
+
from {
|
|
169
|
+
rotate: 0;
|
|
170
|
+
}
|
|
171
|
+
to {
|
|
172
|
+
rotate: 359deg;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
[data-duck-spinner] .duck {
|
|
176
|
+
transform-origin: center;
|
|
177
|
+
scale: 1.2;
|
|
178
|
+
animation-duration: 2s;
|
|
179
|
+
animation-timing-function: ease;
|
|
180
|
+
animation-iteration-count: infinite;
|
|
181
|
+
animation-name: slay;
|
|
182
|
+
}
|
|
183
|
+
@keyframes slay {
|
|
184
|
+
0% {
|
|
185
|
+
rotate: -24deg;
|
|
186
|
+
}
|
|
187
|
+
50% {
|
|
188
|
+
rotate: 24deg;
|
|
189
|
+
}
|
|
190
|
+
100% {
|
|
191
|
+
rotate: -24deg;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
[data-duck-spinner] .duck .body {
|
|
195
|
+
stroke-width: 1.5;
|
|
196
|
+
}
|
|
197
|
+
[data-duck-spinner] .duck .eye {
|
|
198
|
+
stroke-width: 1;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
[data-thin=true] .line {
|
|
202
|
+
stroke-width: 0.5;
|
|
203
|
+
}
|
|
204
|
+
[data-thin=true] .duck .body {
|
|
205
|
+
stroke-width: 1;
|
|
206
|
+
}
|
|
207
|
+
[data-thin=true] .duck .eye {
|
|
208
|
+
stroke-width: 0.8;
|
|
209
|
+
}</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
interface Props extends HTMLAttributes<SVGElement> {
|
|
3
|
+
thin?: boolean;
|
|
4
|
+
size?: number | string;
|
|
5
|
+
}
|
|
6
|
+
declare const DuckSpinner: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type DuckSpinner = ReturnType<typeof DuckSpinner>;
|
|
8
|
+
export default DuckSpinner;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
size?: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
let { size }: Props = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<div data-gap style:width={size}></div>
|
|
10
|
+
|
|
11
|
+
<style>[data-gap] {
|
|
12
|
+
display: block;
|
|
13
|
+
aspect-ratio: 1;
|
|
14
|
+
width: 1rem;
|
|
15
|
+
height: auto;
|
|
16
|
+
}</style>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
export interface AppBarProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
6
|
+
leading?: Snippet;
|
|
7
|
+
title?: Snippet;
|
|
8
|
+
actions?: Snippet;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { leading, title, actions, ...rest }: AppBarProps = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<section data-app-bar {...rest}>
|
|
15
|
+
<div data-app-bar-left>
|
|
16
|
+
<div data-app-bar-leading>
|
|
17
|
+
{@render leading?.()}
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div data-app-bar-title>
|
|
21
|
+
{@render title?.()}
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<div data-app-bar-actions>
|
|
26
|
+
{@render actions?.()}
|
|
27
|
+
</div>
|
|
28
|
+
</section>
|
|
29
|
+
|
|
30
|
+
<style>[data-app-bar] {
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
display: flex;
|
|
33
|
+
position: relative;
|
|
34
|
+
justify-content: space-between;
|
|
35
|
+
align-items: center;
|
|
36
|
+
gap: var(--gap--half);
|
|
37
|
+
-webkit-backdrop-filter: blur(var(--blur-length--x2));
|
|
38
|
+
backdrop-filter: blur(var(--blur-length--x2));
|
|
39
|
+
background-color: rgba(var(--color-bg--rgb), 0.88);
|
|
40
|
+
padding: 0 var(--gap--half);
|
|
41
|
+
min-height: var(--gap--x3);
|
|
42
|
+
}
|
|
43
|
+
[data-app-bar] [data-app-bar-left] {
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap: var(--gap--half);
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
}
|
|
49
|
+
[data-app-bar] [data-app-bar-left] [data-app-bar-title] {
|
|
50
|
+
flex: 1;
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
font-weight: bold;
|
|
53
|
+
font-size: 1.1rem;
|
|
54
|
+
text-overflow: ellipsis;
|
|
55
|
+
white-space: nowrap;
|
|
56
|
+
}
|
|
57
|
+
[data-app-bar] [data-app-bar-actions] {
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
gap: var(--gap--sm);
|
|
61
|
+
}</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
export interface AppBarProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
4
|
+
leading?: Snippet;
|
|
5
|
+
title?: Snippet;
|
|
6
|
+
actions?: Snippet;
|
|
7
|
+
}
|
|
8
|
+
declare const AppBar: import("svelte").Component<AppBarProps, {}, "">;
|
|
9
|
+
type AppBar = ReturnType<typeof AppBar>;
|
|
10
|
+
export default AppBar;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
|
|
4
|
+
let { children, ...rest }: HTMLAttributes<HTMLElement> = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<section {...rest} data-navigation-bar>
|
|
8
|
+
{@render children?.()}
|
|
9
|
+
</section>
|
|
10
|
+
|
|
11
|
+
<style>:root {
|
|
12
|
+
--gap--x3: 3rem;
|
|
13
|
+
--gap--x2: 2rem;
|
|
14
|
+
--gap: 1rem;
|
|
15
|
+
--gap--md: 0.7rem;
|
|
16
|
+
--gap--half: 0.5rem;
|
|
17
|
+
--gap--sm: 0.3rem;
|
|
18
|
+
--gap--xs: 0.1rem;
|
|
19
|
+
--break--xs: 540px;
|
|
20
|
+
--break--sm: 960px;
|
|
21
|
+
--break--md: 1320px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
[data-navigation-bar] {
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
display: flex;
|
|
27
|
+
position: relative;
|
|
28
|
+
justify-content: space-evenly;
|
|
29
|
+
border-top-right-radius: var(--radius);
|
|
30
|
+
border-top-left-radius: var(--radius);
|
|
31
|
+
background-color: var(--color-primary--lighter);
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: auto;
|
|
34
|
+
}
|
|
35
|
+
@media screen and (min-width: 540px) {
|
|
36
|
+
[data-navigation-bar] {
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
justify-content: flex-start;
|
|
39
|
+
border-top-left-radius: 0;
|
|
40
|
+
border-bottom-right-radius: var(--radius);
|
|
41
|
+
padding: 0 var(--gap--half);
|
|
42
|
+
width: -moz-min-content;
|
|
43
|
+
width: min-content;
|
|
44
|
+
height: 100%;
|
|
45
|
+
}
|
|
46
|
+
}</style>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAnchorAttributes } from 'svelte/elements';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
interface NavigationBarButtonProps extends HTMLAnchorAttributes {
|
|
6
|
+
icon: Snippet;
|
|
7
|
+
iconActive?: Snippet;
|
|
8
|
+
active?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { active, icon, iconActive, children, ...rest }: NavigationBarButtonProps = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<a {...rest} data-navigation-bar-button data-active={active}>
|
|
15
|
+
<div data-navigation-bar-button-icon>
|
|
16
|
+
{#if active}
|
|
17
|
+
{@render (iconActive || icon)()}
|
|
18
|
+
{:else}
|
|
19
|
+
{@render icon()}
|
|
20
|
+
{/if}
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
{@render children?.()}
|
|
24
|
+
</a>
|
|
25
|
+
|
|
26
|
+
<style>[data-navigation-bar-button] {
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
justify-content: flex-start;
|
|
31
|
+
align-items: center;
|
|
32
|
+
gap: var(--gap--xs);
|
|
33
|
+
background-color: transparent;
|
|
34
|
+
padding: var(--gap--half) 0;
|
|
35
|
+
width: 100%;
|
|
36
|
+
color: var(--color-text);
|
|
37
|
+
text-align: center;
|
|
38
|
+
font-size: 0.8rem;
|
|
39
|
+
text-decoration: none;
|
|
40
|
+
-webkit-tap-highlight-color: transparent;
|
|
41
|
+
}
|
|
42
|
+
[data-navigation-bar-button]:not(:disabled):active {
|
|
43
|
+
top: 0;
|
|
44
|
+
}
|
|
45
|
+
[data-navigation-bar-button]:hover > [data-navigation-bar-button-icon] {
|
|
46
|
+
background-color: var(--color-primary--light);
|
|
47
|
+
}
|
|
48
|
+
[data-navigation-bar-button][data-active=true] > [data-navigation-bar-button-icon] {
|
|
49
|
+
background-color: var(--color-primary);
|
|
50
|
+
color: var(--color-primary--text);
|
|
51
|
+
}
|
|
52
|
+
[data-navigation-bar-button] > [data-navigation-bar-button-icon] {
|
|
53
|
+
transition-duration: var(--transition-dur);
|
|
54
|
+
transition-property: color, background-color;
|
|
55
|
+
border-radius: var(--radius);
|
|
56
|
+
background-color: var(--color-primary--lighter);
|
|
57
|
+
padding: var(--gap--xs) var(--gap);
|
|
58
|
+
}</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HTMLAnchorAttributes } from 'svelte/elements';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
interface NavigationBarButtonProps extends HTMLAnchorAttributes {
|
|
4
|
+
icon: Snippet;
|
|
5
|
+
iconActive?: Snippet;
|
|
6
|
+
active?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const NavigationBarButton: import("svelte").Component<NavigationBarButtonProps, {}, "">;
|
|
9
|
+
type NavigationBarButton = ReturnType<typeof NavigationBarButton>;
|
|
10
|
+
export default NavigationBarButton;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { fade, fly } from 'svelte/transition';
|
|
3
|
+
import { Dialog, type DialogRootProps } from 'bits-ui';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
|
+
import IconButton from '../buttons/IconButton.svelte';
|
|
6
|
+
|
|
7
|
+
type DialogProps = DialogRootProps & {
|
|
8
|
+
trigger?: Snippet<[{ props: Record<string, unknown> }]>;
|
|
9
|
+
title?: Snippet;
|
|
10
|
+
close?: Snippet;
|
|
11
|
+
xs?: boolean;
|
|
12
|
+
sm?: boolean;
|
|
13
|
+
md?: boolean;
|
|
14
|
+
fluid?: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
let {
|
|
18
|
+
open = $bindable(false),
|
|
19
|
+
trigger,
|
|
20
|
+
title,
|
|
21
|
+
close,
|
|
22
|
+
children,
|
|
23
|
+
xs,
|
|
24
|
+
sm,
|
|
25
|
+
md,
|
|
26
|
+
fluid,
|
|
27
|
+
...rest
|
|
28
|
+
}: DialogProps = $props();
|
|
29
|
+
|
|
30
|
+
let duration = 200;
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<Dialog.Root {...rest} bind:open>
|
|
34
|
+
<Dialog.Trigger>
|
|
35
|
+
{#snippet child({ props })}
|
|
36
|
+
{@render trigger?.({ props })}
|
|
37
|
+
{/snippet}
|
|
38
|
+
</Dialog.Trigger>
|
|
39
|
+
<Dialog.Portal>
|
|
40
|
+
<Dialog.Overlay forceMount>
|
|
41
|
+
{#snippet child({ props, open })}
|
|
42
|
+
{#if open}
|
|
43
|
+
<div {...props} transition:fade={{ duration }}></div>
|
|
44
|
+
{/if}
|
|
45
|
+
{/snippet}
|
|
46
|
+
</Dialog.Overlay>
|
|
47
|
+
<Dialog.Content forceMount data-xs={xs} data-sm={sm} data-md={md} data-fluid={fluid}>
|
|
48
|
+
{#snippet child({ props, open })}
|
|
49
|
+
{#if open}
|
|
50
|
+
<div {...props} transition:fly={{ duration, y: 50 }}>
|
|
51
|
+
<div data-dialog-header>
|
|
52
|
+
<Dialog.Title children={title} />
|
|
53
|
+
<Dialog.Close>
|
|
54
|
+
{#snippet child({ props })}
|
|
55
|
+
<IconButton {...props}>
|
|
56
|
+
{@render close?.()}
|
|
57
|
+
</IconButton>
|
|
58
|
+
{/snippet}
|
|
59
|
+
</Dialog.Close>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div data-dialog-body>
|
|
63
|
+
{@render children?.()}
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
{/if}
|
|
67
|
+
{/snippet}
|
|
68
|
+
</Dialog.Content>
|
|
69
|
+
</Dialog.Portal>
|
|
70
|
+
</Dialog.Root>
|
|
71
|
+
|
|
72
|
+
<style>:global([data-dialog-overlay]) {
|
|
73
|
+
position: fixed;
|
|
74
|
+
top: 0;
|
|
75
|
+
left: 0;
|
|
76
|
+
width: 100%;
|
|
77
|
+
height: 100%;
|
|
78
|
+
-webkit-backdrop-filter: blur(var(--blur-length));
|
|
79
|
+
backdrop-filter: blur(var(--blur-length));
|
|
80
|
+
background-color: var(--color-border--strong);
|
|
81
|
+
z-index: 100;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
:global([data-dialog-content]) {
|
|
85
|
+
box-sizing: border-box;
|
|
86
|
+
position: fixed;
|
|
87
|
+
top: calc(50dvh - var(--gap));
|
|
88
|
+
left: calc(50lvw - var(--gap));
|
|
89
|
+
transform: translate(-50%, -50%);
|
|
90
|
+
max-width: calc(100% - var(--gap--x2));
|
|
91
|
+
max-height: calc(100dvh - var(--gap--x2));
|
|
92
|
+
margin: var(--gap);
|
|
93
|
+
background-color: var(--color-bg);
|
|
94
|
+
box-shadow: 0 4px 1rem var(--color-shadow);
|
|
95
|
+
border-radius: var(--radius);
|
|
96
|
+
overflow: hidden;
|
|
97
|
+
z-index: 100;
|
|
98
|
+
}
|
|
99
|
+
:global([data-dialog-content])[data-xs=true] {
|
|
100
|
+
max-width: min(100% - var(--gap--x2), var(--break--xs));
|
|
101
|
+
}
|
|
102
|
+
:global([data-dialog-content])[data-sm=true] {
|
|
103
|
+
max-width: min(100% - var(--gap--x2), var(--break--sm));
|
|
104
|
+
}
|
|
105
|
+
:global([data-dialog-content])[data-md=true] {
|
|
106
|
+
max-width: min(100% - var(--gap--x2), var(--break--md));
|
|
107
|
+
}
|
|
108
|
+
:global([data-dialog-content])[data-fluid=true] {
|
|
109
|
+
width: 100%;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
:global([data-dialog-header]) {
|
|
113
|
+
height: 48px;
|
|
114
|
+
display: flex;
|
|
115
|
+
justify-content: space-between;
|
|
116
|
+
align-items: center;
|
|
117
|
+
padding-left: var(--gap);
|
|
118
|
+
padding-right: var(--gap--sm);
|
|
119
|
+
overflow: hidden;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
:global([data-dialog-title]) {
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
text-overflow: ellipsis;
|
|
125
|
+
white-space: nowrap;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
:global([data-dialog-body]) {
|
|
129
|
+
box-sizing: border-box;
|
|
130
|
+
max-height: calc(100dvh - var(--gap--x2) - 48px);
|
|
131
|
+
overflow-y: auto;
|
|
132
|
+
padding: var(--gap);
|
|
133
|
+
}</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Dialog, type DialogRootProps } from 'bits-ui';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type DialogProps = DialogRootProps & {
|
|
4
|
+
trigger?: Snippet<[{
|
|
5
|
+
props: Record<string, unknown>;
|
|
6
|
+
}]>;
|
|
7
|
+
title?: Snippet;
|
|
8
|
+
close?: Snippet;
|
|
9
|
+
xs?: boolean;
|
|
10
|
+
sm?: boolean;
|
|
11
|
+
md?: boolean;
|
|
12
|
+
fluid?: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const Dialog: import("svelte").Component<DialogProps, {}, "open">;
|
|
15
|
+
type Dialog = ReturnType<typeof Dialog>;
|
|
16
|
+
export default Dialog;
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@celar-ui/svelte",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "cuikho210",
|
|
7
|
+
"email": "tonykms210@gmail.com",
|
|
8
|
+
"url": "https://github.com/cuikho210"
|
|
9
|
+
},
|
|
10
|
+
"private": false,
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "vite dev",
|
|
13
|
+
"build": "vite build && npm run prepack",
|
|
14
|
+
"preview": "vite preview",
|
|
15
|
+
"prepare": "svelte-kit sync || echo ''",
|
|
16
|
+
"prepack": "svelte-kit sync && svelte-package && publint",
|
|
17
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
18
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
19
|
+
"format": "prettier --write .",
|
|
20
|
+
"lint": "prettier --check . && eslint ."
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"!dist/**/*.test.*",
|
|
25
|
+
"!dist/**/*.spec.*"
|
|
26
|
+
],
|
|
27
|
+
"sideEffects": [
|
|
28
|
+
"**/*.css"
|
|
29
|
+
],
|
|
30
|
+
"svelte": "./dist/index.js",
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"type": "module",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"svelte": "./dist/index.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"svelte": "^5.0.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@eslint/compat": "^1.2.5",
|
|
44
|
+
"@eslint/js": "^9.18.0",
|
|
45
|
+
"@iconify-json/hugeicons": "^1.2.4",
|
|
46
|
+
"@sveltejs/adapter-auto": "^4.0.0",
|
|
47
|
+
"@sveltejs/kit": "^2.16.0",
|
|
48
|
+
"@sveltejs/package": "^2.0.0",
|
|
49
|
+
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
|
50
|
+
"autoprefixer": "^10.4.21",
|
|
51
|
+
"bits-ui": "^1.3.19",
|
|
52
|
+
"csstype": "^3.1.3",
|
|
53
|
+
"eslint": "^9.18.0",
|
|
54
|
+
"eslint-config-prettier": "^10.0.1",
|
|
55
|
+
"eslint-plugin-svelte": "^3.0.0",
|
|
56
|
+
"globals": "^16.0.0",
|
|
57
|
+
"prettier": "^3.4.2",
|
|
58
|
+
"prettier-plugin-svelte": "^3.3.3",
|
|
59
|
+
"publint": "^0.3.2",
|
|
60
|
+
"sass": "^1.86.3",
|
|
61
|
+
"svelte": "^5.0.0",
|
|
62
|
+
"svelte-check": "^4.0.0",
|
|
63
|
+
"typescript": "^5.0.0",
|
|
64
|
+
"typescript-eslint": "^8.20.0",
|
|
65
|
+
"unplugin-icons": "^22.1.0",
|
|
66
|
+
"vite": "^6.2.5"
|
|
67
|
+
},
|
|
68
|
+
"keywords": [
|
|
69
|
+
"svelte"
|
|
70
|
+
]
|
|
71
|
+
}
|