@celar-ui/svelte 1.4.0 → 1.6.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/dist/buttons/ExpandedTextButton.svelte +9 -0
- package/dist/buttons/ExpandedTextButton.svelte.d.ts +5 -0
- package/dist/buttons/TextBaseButton.svelte +11 -3
- package/dist/buttons/TextBaseButton.svelte.d.ts +1 -0
- package/dist/buttons/styles/expanded_text_button.scss +20 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/navigation/AdaptiveSidebar.svelte +119 -0
- package/dist/navigation/AdaptiveSidebar.svelte.d.ts +9 -0
- package/package.json +2 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import './styles/expanded_text_button.scss';
|
|
3
|
+
import TextBaseButton from './TextBaseButton.svelte';
|
|
4
|
+
import type { TextBaseButtonProps } from './TextBaseButton.svelte';
|
|
5
|
+
|
|
6
|
+
let { gap = 'var(--gap)', ...rest }: TextBaseButtonProps = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<TextBaseButton {...rest} {gap} data-button-text-expanded />
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import './styles/expanded_text_button.scss';
|
|
2
|
+
import type { TextBaseButtonProps } from './TextBaseButton.svelte';
|
|
3
|
+
declare const ExpandedTextButton: import("svelte").Component<TextBaseButtonProps, {}, "">;
|
|
4
|
+
type ExpandedTextButton = ReturnType<typeof ExpandedTextButton>;
|
|
5
|
+
export default ExpandedTextButton;
|
|
@@ -6,13 +6,21 @@
|
|
|
6
6
|
|
|
7
7
|
export type TextBaseButtonProps = BaseButtonProps & {
|
|
8
8
|
icon?: Snippet;
|
|
9
|
+
gap?: string;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
|
-
let {
|
|
12
|
+
let {
|
|
13
|
+
children,
|
|
14
|
+
loading,
|
|
15
|
+
icon,
|
|
16
|
+
active = false,
|
|
17
|
+
gap = 'var(--gap--half)',
|
|
18
|
+
...rest
|
|
19
|
+
}: TextBaseButtonProps = $props();
|
|
12
20
|
</script>
|
|
13
21
|
|
|
14
22
|
{#snippet baseChildren()}
|
|
15
|
-
<div class="button-body" style:visibility={loading ? 'hidden' : 'initial'}>
|
|
23
|
+
<div class="button-body" style:visibility={loading ? 'hidden' : 'initial'} style:--body-gap={gap}>
|
|
16
24
|
{#if icon}
|
|
17
25
|
<span class="button-icon">
|
|
18
26
|
{@render icon()}
|
|
@@ -42,7 +50,7 @@
|
|
|
42
50
|
.button-body {
|
|
43
51
|
display: flex;
|
|
44
52
|
align-items: center;
|
|
45
|
-
gap: var(--gap
|
|
53
|
+
gap: var(--body-gap);
|
|
46
54
|
padding: 0 var(--gap);
|
|
47
55
|
}
|
|
48
56
|
.button-body .button-content {
|
|
@@ -2,6 +2,7 @@ import type { BaseButtonProps } from './BaseButton.svelte';
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
export type TextBaseButtonProps = BaseButtonProps & {
|
|
4
4
|
icon?: Snippet;
|
|
5
|
+
gap?: string;
|
|
5
6
|
};
|
|
6
7
|
declare const TextBaseButton: import("svelte").Component<TextBaseButtonProps, {}, "">;
|
|
7
8
|
type TextBaseButton = ReturnType<typeof TextBaseButton>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[data-button-text-expanded] {
|
|
2
|
+
transition-property: background-color, opacity, filter;
|
|
3
|
+
background-color: transparent;
|
|
4
|
+
color: var(--color-onPrimaryContainer);
|
|
5
|
+
display: block;
|
|
6
|
+
width: 100%;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
|
|
9
|
+
&:not(:disabled, [data-active='true']):hover {
|
|
10
|
+
background-color: var(--color-primaryContainer);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&:not(:disabled):active {
|
|
14
|
+
filter: brightness(0.95);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&[data-active='true'] {
|
|
18
|
+
background-color: var(--color-inversePrimary);
|
|
19
|
+
}
|
|
20
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './utils.js';
|
|
2
2
|
export { default as TextButton } from './buttons/TextButton.svelte';
|
|
3
|
+
export { default as ExpandedTextButton } from './buttons/ExpandedTextButton.svelte';
|
|
3
4
|
export { default as ElevatedButton } from './buttons/ElevatedButton.svelte';
|
|
4
5
|
export { default as FilledButton } from './buttons/FilledButton.svelte';
|
|
5
6
|
export { default as OutlinedButton } from './buttons/OutlinedButton.svelte';
|
|
@@ -34,3 +35,4 @@ export { default as AppBar } from './navigation/AppBar.svelte';
|
|
|
34
35
|
export { default as NavigationBar } from './navigation/NavigationBar.svelte';
|
|
35
36
|
export { default as NavigationBarButton } from './navigation/NavigationBarButton.svelte';
|
|
36
37
|
export { default as NavigationDrawer } from './navigation/NavigationDrawer.svelte';
|
|
38
|
+
export { default as AdaptiveSidebar } from './navigation/AdaptiveSidebar.svelte';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Reexport your entry components here
|
|
2
2
|
export * from './utils.js';
|
|
3
3
|
export { default as TextButton } from './buttons/TextButton.svelte';
|
|
4
|
+
export { default as ExpandedTextButton } from './buttons/ExpandedTextButton.svelte';
|
|
4
5
|
export { default as ElevatedButton } from './buttons/ElevatedButton.svelte';
|
|
5
6
|
export { default as FilledButton } from './buttons/FilledButton.svelte';
|
|
6
7
|
export { default as OutlinedButton } from './buttons/OutlinedButton.svelte';
|
|
@@ -35,3 +36,4 @@ export { default as AppBar } from './navigation/AppBar.svelte';
|
|
|
35
36
|
export { default as NavigationBar } from './navigation/NavigationBar.svelte';
|
|
36
37
|
export { default as NavigationBarButton } from './navigation/NavigationBarButton.svelte';
|
|
37
38
|
export { default as NavigationDrawer } from './navigation/NavigationDrawer.svelte';
|
|
39
|
+
export { default as AdaptiveSidebar } from './navigation/AdaptiveSidebar.svelte';
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
|
|
4
|
+
interface AdaptiveSidebarProps extends HTMLAttributes<HTMLElement> {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
collapsedSize?: string;
|
|
7
|
+
expandedSize?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
open = $bindable(false),
|
|
12
|
+
collapsedSize = '80px',
|
|
13
|
+
expandedSize = '300px',
|
|
14
|
+
children,
|
|
15
|
+
...rest
|
|
16
|
+
}: AdaptiveSidebarProps = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<div>
|
|
20
|
+
<input data-adaptive-sidebar-state type="checkbox" aria-hidden="true" checked={open} />
|
|
21
|
+
|
|
22
|
+
<div
|
|
23
|
+
data-adaptive-sidebar-backdrop
|
|
24
|
+
onclick={() => (open = false)}
|
|
25
|
+
onkeyup={(e) => {
|
|
26
|
+
if (e.key == 'Escape') open = false;
|
|
27
|
+
}}
|
|
28
|
+
aria-label="close adaptive sidebar"
|
|
29
|
+
role="button"
|
|
30
|
+
tabindex="0"
|
|
31
|
+
></div>
|
|
32
|
+
|
|
33
|
+
<aside
|
|
34
|
+
{...rest}
|
|
35
|
+
data-adaptive-sidebar
|
|
36
|
+
style:--collapsed={collapsedSize}
|
|
37
|
+
style:--expanded={expandedSize}
|
|
38
|
+
style:--width={open ? expandedSize : collapsedSize}
|
|
39
|
+
>
|
|
40
|
+
{@render children?.()}
|
|
41
|
+
</aside>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<style>:root {
|
|
45
|
+
--gap--x3: 3rem;
|
|
46
|
+
--gap--x2: 2rem;
|
|
47
|
+
--gap: 1rem;
|
|
48
|
+
--gap--md: 0.7rem;
|
|
49
|
+
--gap--half: 0.5rem;
|
|
50
|
+
--gap--sm: 0.3rem;
|
|
51
|
+
--gap--xs: 0.1rem;
|
|
52
|
+
--break--xs: 540px;
|
|
53
|
+
--break--sm: 960px;
|
|
54
|
+
--break--md: 1320px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
[data-adaptive-sidebar-backdrop] {
|
|
58
|
+
position: fixed;
|
|
59
|
+
top: 0;
|
|
60
|
+
left: 0;
|
|
61
|
+
width: 100%;
|
|
62
|
+
height: 100%;
|
|
63
|
+
-webkit-backdrop-filter: blur(var(--blur-length));
|
|
64
|
+
backdrop-filter: blur(var(--blur-length));
|
|
65
|
+
background-color: rgba(var(--color-onBackground--rgb), 0.2);
|
|
66
|
+
z-index: 100;
|
|
67
|
+
visibility: hidden;
|
|
68
|
+
opacity: 0;
|
|
69
|
+
transition-property: opacity, visibility;
|
|
70
|
+
transition-timing-function: ease-in;
|
|
71
|
+
transition-duration: var(--transition-dur);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
[data-adaptive-sidebar] {
|
|
75
|
+
box-sizing: border-box;
|
|
76
|
+
z-index: 100;
|
|
77
|
+
position: relative;
|
|
78
|
+
height: 100vh;
|
|
79
|
+
width: var(--expanded);
|
|
80
|
+
background-color: var(--color-surface);
|
|
81
|
+
padding: var(--gap);
|
|
82
|
+
border-top-right-radius: var(--gap--x2);
|
|
83
|
+
border-bottom-right-radius: var(--gap--x2);
|
|
84
|
+
max-width: 80vw;
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
transition-property: transform, width, opacity, visibility;
|
|
87
|
+
transition-timing-function: ease-in-out;
|
|
88
|
+
transition-duration: var(--transition-dur);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
[data-adaptive-sidebar-state] {
|
|
92
|
+
display: none;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@media screen and (max-width: 540px) {
|
|
96
|
+
[data-adaptive-sidebar] {
|
|
97
|
+
position: fixed;
|
|
98
|
+
top: 0;
|
|
99
|
+
left: 0;
|
|
100
|
+
box-shadow: 0 0rem var(--gap) var(--color-shadow--md);
|
|
101
|
+
transform: translateX(-100%);
|
|
102
|
+
opacity: 0;
|
|
103
|
+
visibility: hidden;
|
|
104
|
+
}
|
|
105
|
+
[data-adaptive-sidebar-state]:checked ~ [data-adaptive-sidebar-backdrop] {
|
|
106
|
+
opacity: 1;
|
|
107
|
+
visibility: visible;
|
|
108
|
+
}
|
|
109
|
+
[data-adaptive-sidebar-state]:checked ~ [data-adaptive-sidebar] {
|
|
110
|
+
transform: translateX(0);
|
|
111
|
+
opacity: 1;
|
|
112
|
+
visibility: visible;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
@media screen and (min-width: 541px) {
|
|
116
|
+
[data-adaptive-sidebar] {
|
|
117
|
+
width: var(--width);
|
|
118
|
+
}
|
|
119
|
+
}</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
interface AdaptiveSidebarProps extends HTMLAttributes<HTMLElement> {
|
|
3
|
+
open?: boolean;
|
|
4
|
+
collapsedSize?: string;
|
|
5
|
+
expandedSize?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const AdaptiveSidebar: import("svelte").Component<AdaptiveSidebarProps, {}, "open">;
|
|
8
|
+
type AdaptiveSidebar = ReturnType<typeof AdaptiveSidebar>;
|
|
9
|
+
export default AdaptiveSidebar;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celar-ui/svelte",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "cuikho210",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"preview": "vite preview",
|
|
18
18
|
"prepare": "svelte-kit sync || echo ''",
|
|
19
19
|
"prepack": "svelte-kit sync && svelte-package && publint",
|
|
20
|
-
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
20
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json && eslint .",
|
|
21
21
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
22
22
|
"format": "prettier --write .",
|
|
23
23
|
"lint": "prettier --check . && eslint .",
|