bref-ui 0.0.11 → 0.0.12
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 +14 -10
- package/dist/base/button/index.d.ts +0 -1
- package/dist/base/button/index.js +0 -1
- package/dist/base/index.d.ts +1 -0
- package/dist/base/index.js +1 -0
- package/dist/base/loading/circular-loading.svelte +94 -0
- package/dist/base/loading/circular-loading.svelte.d.ts +4 -0
- package/dist/base/loading/index.d.ts +4 -0
- package/dist/base/loading/index.js +4 -0
- package/dist/base/loading/morphing-shapes-loading.svelte +132 -0
- package/dist/base/loading/morphing-shapes-loading.svelte.d.ts +4 -0
- package/dist/base/loading/pulsing-dots-loading.svelte +114 -0
- package/dist/base/loading/pulsing-dots-loading.svelte.d.ts +4 -0
- package/dist/base/loading/textual-loading.svelte +171 -0
- package/dist/base/loading/textual-loading.svelte.d.ts +4 -0
- package/dist/base/loading/types.d.ts +11 -0
- package/dist/base/loading/types.js +1 -0
- package/dist/base/types.d.ts +1 -0
- package/dist/internal/demo-loading.svelte +95 -0
- package/dist/internal/demo-loading.svelte.d.ts +18 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -55,25 +55,29 @@ Bref handles:
|
|
|
55
55
|
|
|
56
56
|
## Base Components
|
|
57
57
|
|
|
58
|
-
- [
|
|
59
|
-
- [
|
|
60
|
-
- [
|
|
58
|
+
- [x] Icon
|
|
59
|
+
- [x] Button
|
|
60
|
+
- [x] Icon Button
|
|
61
|
+
- [x] Loading
|
|
62
|
+
- [x] Circular
|
|
63
|
+
- [x] Pulsing Dots
|
|
64
|
+
- [x] Morphing Shapes
|
|
65
|
+
- [x] Textual
|
|
61
66
|
- [ ] Input
|
|
62
67
|
- [ ] Textarea
|
|
68
|
+
- [ ] Avatar
|
|
69
|
+
- [ ] Progress
|
|
63
70
|
- [ ] Select
|
|
71
|
+
- [ ] Slider
|
|
72
|
+
- [ ] Skeleton
|
|
64
73
|
- [ ] Checkbox
|
|
74
|
+
- [ ] Badge
|
|
75
|
+
- [ ] Popover
|
|
65
76
|
- [ ] Radio
|
|
66
77
|
- [ ] Switch
|
|
67
|
-
- [ ] Avatar
|
|
68
78
|
- [ ] Img
|
|
69
|
-
- [ ] Icon
|
|
70
|
-
- [ ] Progress
|
|
71
79
|
- [ ] Meter
|
|
72
|
-
- [ ] Skeleton
|
|
73
|
-
- [ ] Spinner
|
|
74
|
-
- [ ] Badge
|
|
75
80
|
- [ ] Tooltip
|
|
76
|
-
- [ ] Popover
|
|
77
81
|
- [ ] Dialog
|
|
78
82
|
|
|
79
83
|
## Section Components
|
package/dist/base/index.d.ts
CHANGED
package/dist/base/index.js
CHANGED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { LoadingProps } from './types.js';
|
|
3
|
+
|
|
4
|
+
const { size = 'medium', color = 'primary' }: LoadingProps = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<div class={`${size} ${color}`} role="status" aria-label="Loading"></div>
|
|
8
|
+
|
|
9
|
+
<style>
|
|
10
|
+
div {
|
|
11
|
+
--internal-loader-size: 2rem;
|
|
12
|
+
--internal-loader-border-width: 3px;
|
|
13
|
+
|
|
14
|
+
width: var(--internal-loader-size);
|
|
15
|
+
height: var(--internal-loader-size);
|
|
16
|
+
border-radius: 50%;
|
|
17
|
+
border: var(--internal-loader-border-width) solid transparent;
|
|
18
|
+
border-top-color: var(--internal-current-color);
|
|
19
|
+
animation: spin 0.9s linear infinite;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@keyframes spin {
|
|
23
|
+
to {
|
|
24
|
+
transform: rotate(360deg);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Sizes */
|
|
29
|
+
.x-small {
|
|
30
|
+
--internal-loader-size: 1rem;
|
|
31
|
+
--internal-loader-border-width: 2px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.small {
|
|
35
|
+
--internal-loader-size: 1.5rem;
|
|
36
|
+
--internal-loader-border-width: 2px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.medium {
|
|
40
|
+
--internal-loader-size: 2rem;
|
|
41
|
+
--internal-loader-border-width: 3px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.large {
|
|
45
|
+
--internal-loader-size: 2.5rem;
|
|
46
|
+
--internal-loader-border-width: 3px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.x-large {
|
|
50
|
+
--internal-loader-size: 3rem;
|
|
51
|
+
--internal-loader-border-width: 4px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Color mappings */
|
|
55
|
+
.primary {
|
|
56
|
+
--internal-current-color: var(--color-primary);
|
|
57
|
+
--internal-current-color-soft: var(--color-primary-soft);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.secondary {
|
|
61
|
+
--internal-current-color: var(--color-secondary);
|
|
62
|
+
--internal-current-color-soft: var(--color-secondary-soft);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.success {
|
|
66
|
+
--internal-current-color: var(--color-success);
|
|
67
|
+
--internal-current-color-soft: var(--color-success-soft);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.warning {
|
|
71
|
+
--internal-current-color: var(--color-warning);
|
|
72
|
+
--internal-current-color-soft: var(--color-warning-soft);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.danger {
|
|
76
|
+
--internal-current-color: var(--color-danger);
|
|
77
|
+
--internal-current-color-soft: var(--color-danger-soft);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.info {
|
|
81
|
+
--internal-current-color: var(--color-info);
|
|
82
|
+
--internal-current-color-soft: var(--color-info-soft);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.foreground {
|
|
86
|
+
--internal-current-color: var(--color-foreground);
|
|
87
|
+
--internal-current-color-soft: var(--color-foreground-soft);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.background {
|
|
91
|
+
--internal-current-color: var(--color-background);
|
|
92
|
+
--internal-current-color-soft: var(--color-background-soft);
|
|
93
|
+
}
|
|
94
|
+
</style>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as CircularLoading } from './circular-loading.svelte';
|
|
2
|
+
export { default as PulsingDotsLoading } from './pulsing-dots-loading.svelte';
|
|
3
|
+
export { default as MorphingShapesLoading } from './morphing-shapes-loading.svelte';
|
|
4
|
+
export { default as TextualLoading } from './textual-loading.svelte';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as CircularLoading } from './circular-loading.svelte';
|
|
2
|
+
export { default as PulsingDotsLoading } from './pulsing-dots-loading.svelte';
|
|
3
|
+
export { default as MorphingShapesLoading } from './morphing-shapes-loading.svelte';
|
|
4
|
+
export { default as TextualLoading } from './textual-loading.svelte';
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { LoadingProps } from './types.js';
|
|
3
|
+
|
|
4
|
+
const { size = 'medium', color = 'primary' }: LoadingProps = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<div class={`${size} ${color}`} role="status" aria-label="Loading">
|
|
8
|
+
<div class="shape"></div>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<style>
|
|
12
|
+
div {
|
|
13
|
+
--internal-shape-size: 2rem;
|
|
14
|
+
width: var(--internal-shape-size);
|
|
15
|
+
height: var(--internal-shape-size);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.shape {
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
background-color: var(--internal-current-color);
|
|
22
|
+
animation:
|
|
23
|
+
morph 4s ease-in-out infinite,
|
|
24
|
+
rotate 8s linear infinite;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@keyframes morph {
|
|
28
|
+
0% {
|
|
29
|
+
/* Circle */
|
|
30
|
+
border-radius: 50%;
|
|
31
|
+
corner-shape: round;
|
|
32
|
+
}
|
|
33
|
+
14% {
|
|
34
|
+
/* Squircle */
|
|
35
|
+
border-radius: 35%;
|
|
36
|
+
corner-shape: squircle;
|
|
37
|
+
}
|
|
38
|
+
28% {
|
|
39
|
+
/* Blob with bevel corners */
|
|
40
|
+
border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
|
|
41
|
+
corner-shape: bevel;
|
|
42
|
+
}
|
|
43
|
+
42% {
|
|
44
|
+
/* Scoop corners */
|
|
45
|
+
border-radius: 40%;
|
|
46
|
+
corner-shape: scoop;
|
|
47
|
+
}
|
|
48
|
+
57% {
|
|
49
|
+
/* Organic blob */
|
|
50
|
+
border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
|
|
51
|
+
corner-shape: round;
|
|
52
|
+
}
|
|
53
|
+
71% {
|
|
54
|
+
/* Notched */
|
|
55
|
+
border-radius: 30%;
|
|
56
|
+
corner-shape: notch;
|
|
57
|
+
}
|
|
58
|
+
85% {
|
|
59
|
+
/* Another blob with squircle */
|
|
60
|
+
border-radius: 70% 30% 50% 50% / 30% 60% 40% 70%;
|
|
61
|
+
corner-shape: squircle;
|
|
62
|
+
}
|
|
63
|
+
100% {
|
|
64
|
+
/* Back to circle */
|
|
65
|
+
border-radius: 50%;
|
|
66
|
+
corner-shape: round;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@keyframes rotate {
|
|
71
|
+
from {
|
|
72
|
+
transform: rotate(0deg);
|
|
73
|
+
}
|
|
74
|
+
to {
|
|
75
|
+
transform: rotate(360deg);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Sizes */
|
|
80
|
+
.x-small {
|
|
81
|
+
--internal-shape-size: 1rem;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.small {
|
|
85
|
+
--internal-shape-size: 1.5rem;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.medium {
|
|
89
|
+
--internal-shape-size: 2rem;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.large {
|
|
93
|
+
--internal-shape-size: 2.5rem;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.x-large {
|
|
97
|
+
--internal-shape-size: 3rem;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* Color mappings */
|
|
101
|
+
.primary {
|
|
102
|
+
--internal-current-color: var(--color-primary);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.secondary {
|
|
106
|
+
--internal-current-color: var(--color-secondary);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.success {
|
|
110
|
+
--internal-current-color: var(--color-success);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.warning {
|
|
114
|
+
--internal-current-color: var(--color-warning);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.danger {
|
|
118
|
+
--internal-current-color: var(--color-danger);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.info {
|
|
122
|
+
--internal-current-color: var(--color-info);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.foreground {
|
|
126
|
+
--internal-current-color: var(--color-foreground);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.background {
|
|
130
|
+
--internal-current-color: var(--color-background);
|
|
131
|
+
}
|
|
132
|
+
</style>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { LoadingProps } from './types.js';
|
|
3
|
+
|
|
4
|
+
const { size = 'medium', color = 'primary' }: LoadingProps = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<div class={`${size} ${color}`} role="status" aria-label="Loading">
|
|
8
|
+
<span></span>
|
|
9
|
+
<span></span>
|
|
10
|
+
<span></span>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<style>
|
|
14
|
+
div {
|
|
15
|
+
--internal-dot-size: 0.5rem;
|
|
16
|
+
--internal-gap: 0.375rem;
|
|
17
|
+
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
gap: var(--internal-gap);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
span {
|
|
24
|
+
width: var(--internal-dot-size);
|
|
25
|
+
height: var(--internal-dot-size);
|
|
26
|
+
border-radius: 50%;
|
|
27
|
+
background-color: var(--internal-current-color);
|
|
28
|
+
animation: pulse 1.4s ease-in-out infinite;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
span:nth-child(1) {
|
|
32
|
+
animation-delay: 0s;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
span:nth-child(2) {
|
|
36
|
+
animation-delay: 0.2s;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
span:nth-child(3) {
|
|
40
|
+
animation-delay: 0.4s;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@keyframes pulse {
|
|
44
|
+
0%,
|
|
45
|
+
80%,
|
|
46
|
+
100% {
|
|
47
|
+
opacity: 0.3;
|
|
48
|
+
transform: scale(0.8);
|
|
49
|
+
}
|
|
50
|
+
40% {
|
|
51
|
+
opacity: 1;
|
|
52
|
+
transform: scale(1);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Sizes */
|
|
57
|
+
.x-small {
|
|
58
|
+
--internal-dot-size: 0.25rem;
|
|
59
|
+
--internal-gap: 0.2rem;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.small {
|
|
63
|
+
--internal-dot-size: 0.375rem;
|
|
64
|
+
--internal-gap: 0.25rem;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.medium {
|
|
68
|
+
--internal-dot-size: 0.5rem;
|
|
69
|
+
--internal-gap: 0.375rem;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.large {
|
|
73
|
+
--internal-dot-size: 0.625rem;
|
|
74
|
+
--internal-gap: 0.5rem;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.x-large {
|
|
78
|
+
--internal-dot-size: 0.75rem;
|
|
79
|
+
--internal-gap: 0.5rem;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* Color mappings */
|
|
83
|
+
.primary {
|
|
84
|
+
--internal-current-color: var(--color-primary);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.secondary {
|
|
88
|
+
--internal-current-color: var(--color-secondary);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.success {
|
|
92
|
+
--internal-current-color: var(--color-success);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.warning {
|
|
96
|
+
--internal-current-color: var(--color-warning);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.danger {
|
|
100
|
+
--internal-current-color: var(--color-danger);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.info {
|
|
104
|
+
--internal-current-color: var(--color-info);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.foreground {
|
|
108
|
+
--internal-current-color: var(--color-foreground);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.background {
|
|
112
|
+
--internal-current-color: var(--color-background);
|
|
113
|
+
}
|
|
114
|
+
</style>
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { TextualLoadingProps } from './types.js';
|
|
3
|
+
|
|
4
|
+
const DEFAULT_WORDS = [
|
|
5
|
+
'Thinking',
|
|
6
|
+
'Brewing',
|
|
7
|
+
'Conjuring',
|
|
8
|
+
'Pondering',
|
|
9
|
+
'Crunching',
|
|
10
|
+
'Fetching',
|
|
11
|
+
'Spinning',
|
|
12
|
+
'Warming',
|
|
13
|
+
'Polishing',
|
|
14
|
+
'Shuffling',
|
|
15
|
+
'Wiggling',
|
|
16
|
+
'Stretching',
|
|
17
|
+
'Juggling',
|
|
18
|
+
'Wrangling',
|
|
19
|
+
'Herding',
|
|
20
|
+
'Tickling',
|
|
21
|
+
'Poking',
|
|
22
|
+
'Nudging',
|
|
23
|
+
'Summoning',
|
|
24
|
+
'Manifesting'
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
const {
|
|
28
|
+
size = 'medium',
|
|
29
|
+
color = 'primary',
|
|
30
|
+
words = DEFAULT_WORDS,
|
|
31
|
+
hideDots = false,
|
|
32
|
+
typeSpeed = 'normal',
|
|
33
|
+
pauseSpeed = 'normal'
|
|
34
|
+
}: TextualLoadingProps = $props();
|
|
35
|
+
|
|
36
|
+
const TYPE_MS = { slow: 100, normal: 50, fast: 25 } as const;
|
|
37
|
+
const PAUSE_MS = { slow: 800, normal: 500, fast: 300 } as const;
|
|
38
|
+
|
|
39
|
+
let leftPart = $state('');
|
|
40
|
+
let rightPart = $state('');
|
|
41
|
+
let showCursor = $state(true);
|
|
42
|
+
|
|
43
|
+
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
|
|
44
|
+
|
|
45
|
+
const typeWord = async (word: string, prev: string) => {
|
|
46
|
+
const target = hideDots ? word : word + '...';
|
|
47
|
+
const maxLen = Math.max(target.length, prev.length);
|
|
48
|
+
const ms = TYPE_MS[typeSpeed];
|
|
49
|
+
|
|
50
|
+
for (let i = 0; i <= maxLen; i++) {
|
|
51
|
+
leftPart = target.slice(0, i);
|
|
52
|
+
rightPart = prev.slice(i + 1);
|
|
53
|
+
await sleep(ms);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
leftPart = target;
|
|
57
|
+
rightPart = '';
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
$effect(() => {
|
|
61
|
+
let cancelled = false;
|
|
62
|
+
|
|
63
|
+
const animate = async () => {
|
|
64
|
+
let index = 0;
|
|
65
|
+
let prev = '';
|
|
66
|
+
|
|
67
|
+
while (!cancelled) {
|
|
68
|
+
const word = words[index];
|
|
69
|
+
|
|
70
|
+
showCursor = true;
|
|
71
|
+
await typeWord(word, prev);
|
|
72
|
+
|
|
73
|
+
await sleep(TYPE_MS[typeSpeed]);
|
|
74
|
+
showCursor = false;
|
|
75
|
+
|
|
76
|
+
await sleep(PAUSE_MS[pauseSpeed]);
|
|
77
|
+
|
|
78
|
+
prev = hideDots ? word : word + '...';
|
|
79
|
+
index = (index + 1) % words.length;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
animate();
|
|
84
|
+
|
|
85
|
+
return () => {
|
|
86
|
+
cancelled = true;
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<span class={`${size} ${color}`} role="status" aria-label="Loading">
|
|
92
|
+
{leftPart}{#if showCursor}<span class="cursor">▌</span>{/if}{rightPart}
|
|
93
|
+
</span>
|
|
94
|
+
|
|
95
|
+
<style>
|
|
96
|
+
span {
|
|
97
|
+
--internal-font-size: 1rem;
|
|
98
|
+
|
|
99
|
+
font-size: var(--internal-font-size);
|
|
100
|
+
color: var(--internal-current-color);
|
|
101
|
+
font-weight: 500;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.cursor {
|
|
105
|
+
animation: blink 0.7s step-end infinite;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@keyframes blink {
|
|
109
|
+
0%,
|
|
110
|
+
100% {
|
|
111
|
+
opacity: 1;
|
|
112
|
+
}
|
|
113
|
+
50% {
|
|
114
|
+
opacity: 0;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* Sizes */
|
|
119
|
+
.x-small {
|
|
120
|
+
--internal-font-size: 0.75rem;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.small {
|
|
124
|
+
--internal-font-size: 0.875rem;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.medium {
|
|
128
|
+
--internal-font-size: 1rem;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.large {
|
|
132
|
+
--internal-font-size: 1.125rem;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.x-large {
|
|
136
|
+
--internal-font-size: 1.25rem;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* Color mappings */
|
|
140
|
+
.primary {
|
|
141
|
+
--internal-current-color: var(--color-primary);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.secondary {
|
|
145
|
+
--internal-current-color: var(--color-secondary);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.success {
|
|
149
|
+
--internal-current-color: var(--color-success);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.warning {
|
|
153
|
+
--internal-current-color: var(--color-warning);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.danger {
|
|
157
|
+
--internal-current-color: var(--color-danger);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.info {
|
|
161
|
+
--internal-current-color: var(--color-info);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.foreground {
|
|
165
|
+
--internal-current-color: var(--color-foreground);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.background {
|
|
169
|
+
--internal-current-color: var(--color-background);
|
|
170
|
+
}
|
|
171
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Color, Size, Speed } from '../types.ts';
|
|
2
|
+
export interface LoadingProps {
|
|
3
|
+
size?: Size;
|
|
4
|
+
color?: Color;
|
|
5
|
+
}
|
|
6
|
+
export interface TextualLoadingProps extends LoadingProps {
|
|
7
|
+
words?: string[];
|
|
8
|
+
hideDots?: boolean;
|
|
9
|
+
typeSpeed?: Speed;
|
|
10
|
+
pauseSpeed?: Speed;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/base/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export type Size = 'x-small' | 'small' | 'medium' | 'large' | 'x-large';
|
|
2
2
|
export type Color = 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info' | 'foreground' | 'background';
|
|
3
3
|
export type Variant = 'filled' | 'soft' | 'ghost';
|
|
4
|
+
export type Speed = 'slow' | 'normal' | 'fast';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import CircularLoading from '../base/loading/circular-loading.svelte';
|
|
3
|
+
import PulsingDotsLoading from '../base/loading/pulsing-dots-loading.svelte';
|
|
4
|
+
import MorphingShapesLoading from '../base/loading/morphing-shapes-loading.svelte';
|
|
5
|
+
import TextualLoading from '../base/loading/textual-loading.svelte';
|
|
6
|
+
import DemoSection from './demo-section.svelte';
|
|
7
|
+
import DemoCodeSnippet from './demo-code-snippet.svelte';
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<DemoSection
|
|
11
|
+
title="Loading"
|
|
12
|
+
id="loading"
|
|
13
|
+
description="Loading indicators with multiple styles: circular spinner, pulsing dots, morphing shapes, and textual."
|
|
14
|
+
>
|
|
15
|
+
<h3>Circular Loading</h3>
|
|
16
|
+
<div>
|
|
17
|
+
<CircularLoading size="x-small" />
|
|
18
|
+
<CircularLoading size="small" />
|
|
19
|
+
<CircularLoading size="medium" />
|
|
20
|
+
<CircularLoading size="large" />
|
|
21
|
+
<CircularLoading size="x-large" />
|
|
22
|
+
</div>
|
|
23
|
+
<h3>Pulsing Dots Loading</h3>
|
|
24
|
+
<div>
|
|
25
|
+
<PulsingDotsLoading size="x-small" />
|
|
26
|
+
<PulsingDotsLoading size="small" />
|
|
27
|
+
<PulsingDotsLoading size="medium" />
|
|
28
|
+
<PulsingDotsLoading size="large" />
|
|
29
|
+
<PulsingDotsLoading size="x-large" />
|
|
30
|
+
</div>
|
|
31
|
+
<h3>Morphing Shapes Loading</h3>
|
|
32
|
+
<div>
|
|
33
|
+
<MorphingShapesLoading size="x-small" />
|
|
34
|
+
<MorphingShapesLoading size="small" />
|
|
35
|
+
<MorphingShapesLoading size="medium" />
|
|
36
|
+
<MorphingShapesLoading size="large" />
|
|
37
|
+
<MorphingShapesLoading size="x-large" />
|
|
38
|
+
</div>
|
|
39
|
+
<h3>Textual Loading</h3>
|
|
40
|
+
<div class="textual">
|
|
41
|
+
<TextualLoading />
|
|
42
|
+
<TextualLoading words={['Thinking', 'Processing', 'Generating']} />
|
|
43
|
+
<TextualLoading words={['Please wait', 'Wait please']} hideDots />
|
|
44
|
+
<TextualLoading words={['Ready', 'Set', 'Go']} pauseSpeed="slow" typeSpeed="slow" />
|
|
45
|
+
</div>
|
|
46
|
+
<h3>Colors</h3>
|
|
47
|
+
<div>
|
|
48
|
+
<CircularLoading color="primary" />
|
|
49
|
+
<CircularLoading color="secondary" />
|
|
50
|
+
<CircularLoading color="success" />
|
|
51
|
+
<CircularLoading color="warning" />
|
|
52
|
+
<CircularLoading color="danger" />
|
|
53
|
+
<CircularLoading color="info" />
|
|
54
|
+
</div>
|
|
55
|
+
<div>
|
|
56
|
+
<PulsingDotsLoading color="primary" />
|
|
57
|
+
<PulsingDotsLoading color="secondary" />
|
|
58
|
+
<PulsingDotsLoading color="success" />
|
|
59
|
+
<PulsingDotsLoading color="warning" />
|
|
60
|
+
<PulsingDotsLoading color="danger" />
|
|
61
|
+
<PulsingDotsLoading color="info" />
|
|
62
|
+
</div>
|
|
63
|
+
<h3>Usage Example</h3>
|
|
64
|
+
<DemoCodeSnippet
|
|
65
|
+
snippet={`<CircularLoading size="medium" color="primary" />
|
|
66
|
+
|
|
67
|
+
<PulsingDotsLoading size="small" color="info" />
|
|
68
|
+
|
|
69
|
+
<MorphingShapesLoading size="large" color="success" />
|
|
70
|
+
|
|
71
|
+
<!-- Uses 20 fun default words -->
|
|
72
|
+
<TextualLoading />
|
|
73
|
+
|
|
74
|
+
<!-- Custom words -->
|
|
75
|
+
<TextualLoading
|
|
76
|
+
words={['Thinking', 'Processing']}
|
|
77
|
+
typeSpeed="fast"
|
|
78
|
+
pauseSpeed="slow"
|
|
79
|
+
/>`}
|
|
80
|
+
/>
|
|
81
|
+
</DemoSection>
|
|
82
|
+
|
|
83
|
+
<style>
|
|
84
|
+
div {
|
|
85
|
+
display: flex;
|
|
86
|
+
gap: 1.5rem;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: center;
|
|
89
|
+
flex-wrap: wrap;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.textual {
|
|
93
|
+
flex-direction: column;
|
|
94
|
+
}
|
|
95
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const DemoLoading: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type DemoLoading = InstanceType<typeof DemoLoading>;
|
|
18
|
+
export default DemoLoading;
|