@studiocms/ui 0.0.1 → 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/README.md +28 -544
- package/package.json +10 -5
- package/src/components/Button.astro +58 -57
- package/src/components/Card.astro +11 -11
- package/src/components/Center.astro +2 -2
- package/src/components/Checkbox.astro +28 -27
- package/src/components/Divider.astro +8 -8
- package/src/components/Dropdown/Dropdown.astro +48 -40
- package/src/components/Dropdown/dropdown.ts +7 -6
- package/src/components/Footer.astro +120 -0
- package/src/components/Input.astro +15 -14
- package/src/components/Modal/Modal.astro +53 -29
- package/src/components/Modal/modal.ts +10 -9
- package/src/components/RadioGroup.astro +24 -24
- package/src/components/Row.astro +7 -7
- package/src/components/SearchSelect.astro +35 -31
- package/src/components/Select.astro +38 -29
- package/src/components/Sidebar/Double.astro +12 -12
- package/src/components/Sidebar/Single.astro +6 -6
- package/src/components/Sidebar/helpers.ts +7 -7
- package/src/components/Textarea.astro +26 -15
- package/src/components/ThemeToggle.astro +11 -8
- package/src/components/Toast/Toaster.astro +31 -30
- package/src/components/Toggle.astro +20 -20
- package/src/components/User.astro +15 -14
- package/src/components/index.ts +23 -22
- package/src/components.ts +1 -0
- package/src/css/colors.css +65 -65
- package/src/layouts/RootLayout.astro +1 -1
- package/src/types/index.ts +1 -1
- package/src/utils/ThemeHelper.ts +128 -117
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type { HTMLAttributes } from 'astro/types'
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
3
3
|
|
|
4
|
-
interface Props extends Exclude<HTMLAttributes<'aside'>, 'id'> {}
|
|
4
|
+
interface Props extends Exclude<HTMLAttributes<'aside'>, 'id'> {}
|
|
5
5
|
|
|
6
6
|
const props = Astro.props;
|
|
7
7
|
---
|
|
8
|
-
<aside id="sidebar" {...props}>
|
|
8
|
+
<aside id="sui-sidebar" {...props}>
|
|
9
9
|
<slot />
|
|
10
10
|
</aside>
|
|
11
11
|
<style>
|
|
12
|
-
#sidebar {
|
|
12
|
+
#sui-sidebar {
|
|
13
13
|
height: 100%;
|
|
14
14
|
min-width: 280px;
|
|
15
15
|
width: 280px;
|
|
@@ -24,12 +24,12 @@ const props = Astro.props;
|
|
|
24
24
|
transition: all .3s ease;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
#sidebar.active {
|
|
27
|
+
#sui-sidebar.active {
|
|
28
28
|
transform: translateX(0%);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
@media screen and (max-width: 840px) {
|
|
32
|
-
#sidebar {
|
|
32
|
+
#sui-sidebar {
|
|
33
33
|
transform: translateX(-100%);
|
|
34
34
|
position: absolute;
|
|
35
35
|
top: 0;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
class SingleSidebarHelper {
|
|
2
|
-
sidebar: HTMLElement;
|
|
3
|
-
sidebarToggle?: HTMLElement | undefined;
|
|
2
|
+
private sidebar: HTMLElement;
|
|
3
|
+
private sidebarToggle?: HTMLElement | undefined;
|
|
4
4
|
|
|
5
5
|
constructor(toggleID?: string) {
|
|
6
|
-
const sidebarContainer = document.getElementById('sidebar');
|
|
6
|
+
const sidebarContainer = document.getElementById('sui-sidebar');
|
|
7
7
|
|
|
8
8
|
if (!sidebarContainer) {
|
|
9
9
|
throw new Error(
|
|
10
|
-
`No item with ID 'sidebar' found. Please add the <Sidebar> component to this page.`
|
|
10
|
+
`No item with ID 'sui-sidebar' found. Please add the <Sidebar> component to this page.`
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -40,7 +40,7 @@ class SingleSidebarHelper {
|
|
|
40
40
|
this.sidebarToggle.addEventListener('click', () => {
|
|
41
41
|
this.sidebar.classList.toggle('active');
|
|
42
42
|
});
|
|
43
|
-
}
|
|
43
|
+
};
|
|
44
44
|
|
|
45
45
|
public hideSidebarOnClick = (elementID: string) => {
|
|
46
46
|
const element = document.getElementById(elementID);
|
|
@@ -72,10 +72,10 @@ class SingleSidebarHelper {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
class DoubleSidebarHelper {
|
|
75
|
-
sidebarsContainer: HTMLElement;
|
|
75
|
+
private sidebarsContainer: HTMLElement;
|
|
76
76
|
|
|
77
77
|
constructor() {
|
|
78
|
-
const sidebarsContainer = document.getElementById('sidebars');
|
|
78
|
+
const sidebarsContainer = document.getElementById('sui-sidebars');
|
|
79
79
|
|
|
80
80
|
if (!sidebarsContainer) {
|
|
81
81
|
throw new Error(
|
|
@@ -1,33 +1,38 @@
|
|
|
1
1
|
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
2
3
|
import { generateID } from '../utils/generateID';
|
|
3
4
|
|
|
4
|
-
interface Props {
|
|
5
|
+
interface Props extends HTMLAttributes<'textarea'> {
|
|
5
6
|
label?: string;
|
|
6
7
|
placeholder?: string;
|
|
7
8
|
isRequired?: boolean;
|
|
8
9
|
fullWidth?: boolean;
|
|
10
|
+
fullHeight?: boolean;
|
|
9
11
|
resize?: boolean;
|
|
10
12
|
name?: string;
|
|
11
13
|
disabled?: boolean;
|
|
12
14
|
defaultValue?: string;
|
|
13
|
-
}
|
|
15
|
+
}
|
|
14
16
|
|
|
15
17
|
const {
|
|
16
18
|
label,
|
|
17
19
|
placeholder,
|
|
18
20
|
isRequired,
|
|
19
21
|
fullWidth,
|
|
22
|
+
fullHeight,
|
|
20
23
|
resize,
|
|
21
24
|
name = generateID('textarea'),
|
|
22
25
|
disabled,
|
|
23
26
|
defaultValue,
|
|
27
|
+
...props
|
|
24
28
|
} = Astro.props;
|
|
25
29
|
---
|
|
26
30
|
<label
|
|
27
31
|
for={name}
|
|
28
|
-
class="textarea-label"
|
|
32
|
+
class="sui-textarea-label"
|
|
29
33
|
class:list={[
|
|
30
|
-
fullWidth && "full",
|
|
34
|
+
fullWidth && "full-width",
|
|
35
|
+
fullHeight && "full-height",
|
|
31
36
|
resize && "resize",
|
|
32
37
|
disabled && "disabled",
|
|
33
38
|
]}
|
|
@@ -39,38 +44,42 @@ const {
|
|
|
39
44
|
placeholder={placeholder}
|
|
40
45
|
name={name}
|
|
41
46
|
id={name}
|
|
42
|
-
class="textarea"
|
|
47
|
+
class="sui-textarea"
|
|
43
48
|
required={isRequired}
|
|
44
49
|
disabled={disabled}
|
|
50
|
+
{...props}
|
|
45
51
|
|
|
46
52
|
>{defaultValue}</textarea>
|
|
47
53
|
</label>
|
|
48
54
|
<style>
|
|
49
|
-
.textarea-label {
|
|
55
|
+
.sui-textarea-label {
|
|
50
56
|
display: flex;
|
|
51
57
|
flex-direction: column;
|
|
52
58
|
gap: .25rem;
|
|
53
|
-
margin-top: .5rem;
|
|
54
59
|
max-width: 80ch;
|
|
55
60
|
}
|
|
56
61
|
|
|
57
|
-
.textarea-label.disabled {
|
|
62
|
+
.sui-textarea-label.disabled {
|
|
58
63
|
opacity: 0.5;
|
|
59
64
|
pointer-events: none;
|
|
60
65
|
color: hsl(var(--text-muted));
|
|
61
66
|
}
|
|
62
67
|
|
|
63
|
-
.textarea-label.full {
|
|
68
|
+
.sui-textarea-label.full-width {
|
|
64
69
|
width: 100%;
|
|
65
70
|
max-width: none;
|
|
66
71
|
}
|
|
67
72
|
|
|
73
|
+
.sui-textarea-label.full-height {
|
|
74
|
+
height: 100%;
|
|
75
|
+
}
|
|
76
|
+
|
|
68
77
|
.label {
|
|
69
78
|
font-size: 14px;
|
|
70
79
|
}
|
|
71
80
|
|
|
72
|
-
.textarea {
|
|
73
|
-
padding: .65rem
|
|
81
|
+
.sui-textarea {
|
|
82
|
+
padding: .65rem;
|
|
74
83
|
border-radius: 8px;
|
|
75
84
|
border: 1px solid hsl(var(--border));
|
|
76
85
|
background: hsl(var(--background-step-2));
|
|
@@ -78,18 +87,20 @@ const {
|
|
|
78
87
|
transition: all .15s ease;
|
|
79
88
|
resize: none;
|
|
80
89
|
min-height: 12ch;
|
|
90
|
+
width: 100%;
|
|
91
|
+
height: 100%;
|
|
81
92
|
}
|
|
82
93
|
|
|
83
|
-
.textarea:hover {
|
|
94
|
+
.sui-textarea:hover {
|
|
84
95
|
background: hsl(var(--background-step-3));
|
|
85
96
|
}
|
|
86
97
|
|
|
87
|
-
.resize .textarea {
|
|
98
|
+
.resize .sui-textarea {
|
|
88
99
|
resize: both;
|
|
89
100
|
}
|
|
90
101
|
|
|
91
|
-
.textarea:active,
|
|
92
|
-
.textarea:focus {
|
|
102
|
+
.sui-textarea:active,
|
|
103
|
+
.sui-textarea:focus {
|
|
93
104
|
border: 1px solid hsl(var(--primary-base));
|
|
94
105
|
outline: none;
|
|
95
106
|
background: hsl(var(--background-step-2));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type { ComponentProps } from
|
|
3
|
-
import Button from
|
|
2
|
+
import type { ComponentProps } from 'astro/types';
|
|
3
|
+
import Button from './Button.astro';
|
|
4
4
|
|
|
5
|
-
interface Props extends ComponentProps<typeof Button> {}
|
|
5
|
+
interface Props extends ComponentProps<typeof Button> {}
|
|
6
6
|
|
|
7
7
|
const props = Astro.props;
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
<Button id='
|
|
10
|
+
<Button id='sui-theme-toggle' {...props}>
|
|
11
11
|
<div id="dark-content">
|
|
12
12
|
<slot name="dark" />
|
|
13
13
|
</div>
|
|
@@ -19,22 +19,25 @@ const props = Astro.props;
|
|
|
19
19
|
<script>
|
|
20
20
|
import { ThemeHelper } from '../utils/ThemeHelper';
|
|
21
21
|
|
|
22
|
-
const themeToggle = document.getElementById('
|
|
22
|
+
const themeToggle = document.getElementById('sui-theme-toggle');
|
|
23
23
|
const themeHelper = new ThemeHelper();
|
|
24
24
|
|
|
25
25
|
themeHelper.registerToggle(themeToggle);
|
|
26
26
|
</script>
|
|
27
27
|
|
|
28
28
|
<style is:global>
|
|
29
|
-
#
|
|
29
|
+
#sui-theme-toggle #dark-content, #sui-theme-toggle #light-content {
|
|
30
30
|
display: none;
|
|
31
|
+
width: fit-content;
|
|
32
|
+
height: fit-content;
|
|
33
|
+
max-height: 100%;
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
[data-theme="dark"] #
|
|
36
|
+
[data-theme="dark"] #sui-theme-toggle #dark-content {
|
|
34
37
|
display: block;
|
|
35
38
|
}
|
|
36
39
|
|
|
37
|
-
[data-theme="light"] #
|
|
40
|
+
[data-theme="light"] #sui-theme-toggle #light-content {
|
|
38
41
|
display: block;
|
|
39
42
|
}
|
|
40
43
|
</style>
|
|
@@ -11,7 +11,7 @@ interface Props {
|
|
|
11
11
|
closeButton?: boolean;
|
|
12
12
|
offset?: number;
|
|
13
13
|
gap?: number;
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
15
|
|
|
16
16
|
const {
|
|
17
17
|
position = 'top-center',
|
|
@@ -22,14 +22,14 @@ const {
|
|
|
22
22
|
} = Astro.props;
|
|
23
23
|
---
|
|
24
24
|
<div
|
|
25
|
-
id="toaster"
|
|
25
|
+
id="sui-toaster"
|
|
26
26
|
class:list={[
|
|
27
27
|
closeButton && "closeable",
|
|
28
28
|
position,
|
|
29
29
|
]},
|
|
30
30
|
>
|
|
31
31
|
<div
|
|
32
|
-
id="toast-drawer"
|
|
32
|
+
id="sui-toast-drawer"
|
|
33
33
|
data-offset={offset}
|
|
34
34
|
data-gap={gap}
|
|
35
35
|
data-duration={duration}
|
|
@@ -66,22 +66,22 @@ const {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
function createToast(props: ToastProps) {
|
|
69
|
-
const toastParent = document.getElementById('toast-drawer')! as HTMLDivElement;
|
|
69
|
+
const toastParent = document.getElementById('sui-toast-drawer')! as HTMLDivElement;
|
|
70
70
|
|
|
71
71
|
const toastContainer = document.createElement('div');
|
|
72
72
|
const toastID = generateID('toast');
|
|
73
73
|
toastContainer.id = toastID;
|
|
74
|
-
toastContainer.classList.add('toast-container', props.type, `${props.closeButton || props.persistent && "closeable"}`, `${props.persistent && 'persistent'}`);
|
|
74
|
+
toastContainer.classList.add('sui-toast-container', props.type, `${props.closeButton || props.persistent && "closeable"}`, `${props.persistent && 'persistent'}`);
|
|
75
75
|
|
|
76
76
|
const toastHeader = document.createElement('div');
|
|
77
|
-
toastHeader.classList.add('toast-header');
|
|
77
|
+
toastHeader.classList.add('sui-toast-header');
|
|
78
78
|
|
|
79
79
|
const toastHeaderLeftSide = document.createElement('div');
|
|
80
|
-
toastHeaderLeftSide.classList.add('toast-header-left-side')
|
|
80
|
+
toastHeaderLeftSide.classList.add('sui-toast-header-left-side')
|
|
81
81
|
|
|
82
82
|
const toastTitle = document.createElement('span');
|
|
83
83
|
toastTitle.textContent = props.title;
|
|
84
|
-
toastTitle.classList.add('toast-title');
|
|
84
|
+
toastTitle.classList.add('sui-toast-title');
|
|
85
85
|
|
|
86
86
|
let iconString: ValidIconString;
|
|
87
87
|
|
|
@@ -115,14 +115,14 @@ const {
|
|
|
115
115
|
if (props.description) {
|
|
116
116
|
const toastDesc = document.createElement('span');
|
|
117
117
|
toastDesc.innerHTML = props.description;
|
|
118
|
-
toastDesc.classList.add('toast-desc');
|
|
118
|
+
toastDesc.classList.add('sui-toast-desc');
|
|
119
119
|
|
|
120
120
|
toastContainer.appendChild(toastDesc);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
if (!props.persistent) {
|
|
124
124
|
const toastProgressBar = document.createElement('div');
|
|
125
|
-
toastProgressBar.classList.add('toast-progress-bar');
|
|
125
|
+
toastProgressBar.classList.add('sui-toast-progress-bar');
|
|
126
126
|
toastProgressBar.style.animationDuration = props.duration ? `${props.duration}ms` : `${toastParent.dataset.duration || 4000}ms`;
|
|
127
127
|
|
|
128
128
|
toastContainer.appendChild(toastProgressBar);
|
|
@@ -149,7 +149,7 @@ const {
|
|
|
149
149
|
});
|
|
150
150
|
</script>
|
|
151
151
|
<style>
|
|
152
|
-
#toaster {
|
|
152
|
+
#sui-toaster {
|
|
153
153
|
width: 100vw;
|
|
154
154
|
height: 100vh;
|
|
155
155
|
position: fixed;
|
|
@@ -157,9 +157,10 @@ const {
|
|
|
157
157
|
left: 0;
|
|
158
158
|
z-index: 100;
|
|
159
159
|
pointer-events: none;
|
|
160
|
+
color: hsl(var(--text-normal));
|
|
160
161
|
}
|
|
161
162
|
|
|
162
|
-
#toast-drawer {
|
|
163
|
+
#sui-toast-drawer {
|
|
163
164
|
max-width: 420px;
|
|
164
165
|
width: 100%;
|
|
165
166
|
height: fit-content;
|
|
@@ -168,14 +169,14 @@ const {
|
|
|
168
169
|
flex-direction: column;
|
|
169
170
|
}
|
|
170
171
|
|
|
171
|
-
#toaster.top-left #toast-drawer,
|
|
172
|
-
#toaster.bottom-left #toast-drawer {
|
|
172
|
+
#sui-toaster.top-left #sui-toast-drawer,
|
|
173
|
+
#sui-toaster.bottom-left #sui-toast-drawer {
|
|
173
174
|
left: 50%;
|
|
174
175
|
transform: translateX(-50%);
|
|
175
176
|
}
|
|
176
177
|
</style>
|
|
177
178
|
<style is:global>
|
|
178
|
-
.toast-container {
|
|
179
|
+
.sui-toast-container {
|
|
179
180
|
pointer-events: all;
|
|
180
181
|
padding: 1rem;
|
|
181
182
|
border-radius: .5rem;
|
|
@@ -192,14 +193,14 @@ const {
|
|
|
192
193
|
z-index: 90;
|
|
193
194
|
}
|
|
194
195
|
|
|
195
|
-
.toast-header {
|
|
196
|
+
.sui-toast-header {
|
|
196
197
|
display: flex;
|
|
197
198
|
flex-direction: row;
|
|
198
199
|
align-items: center;
|
|
199
200
|
justify-content: space-between;
|
|
200
201
|
}
|
|
201
202
|
|
|
202
|
-
.toast-header-left-side {
|
|
203
|
+
.sui-toast-header-left-side {
|
|
203
204
|
display: flex;
|
|
204
205
|
flex-direction: row;
|
|
205
206
|
gap: .5rem;
|
|
@@ -208,23 +209,23 @@ const {
|
|
|
208
209
|
font-size: 1.125em;
|
|
209
210
|
}
|
|
210
211
|
|
|
211
|
-
.toast-header-left-side svg {
|
|
212
|
+
.sui-toast-header-left-side svg {
|
|
212
213
|
color: hsl(var(--primary-base));
|
|
213
214
|
}
|
|
214
215
|
|
|
215
|
-
.toast-container.success .toast-header-left-side svg {
|
|
216
|
+
.sui-toast-container.success .sui-toast-header-left-side svg {
|
|
216
217
|
color: hsl(var(--success-base));
|
|
217
218
|
}
|
|
218
219
|
|
|
219
|
-
.toast-container.warning .toast-header-left-side svg {
|
|
220
|
+
.sui-toast-container.warning .sui-toast-header-left-side svg {
|
|
220
221
|
color: hsl(var(--warning-base));
|
|
221
222
|
}
|
|
222
223
|
|
|
223
|
-
.toast-container.danger .toast-header-left-side svg {
|
|
224
|
+
.sui-toast-container.danger .sui-toast-header-left-side svg {
|
|
224
225
|
color: hsl(var(--danger-base));
|
|
225
226
|
}
|
|
226
227
|
|
|
227
|
-
.toast-progress-bar {
|
|
228
|
+
.sui-toast-progress-bar {
|
|
228
229
|
position: absolute;
|
|
229
230
|
height: 4px;
|
|
230
231
|
width: 100%;
|
|
@@ -234,15 +235,15 @@ const {
|
|
|
234
235
|
animation: toast-progress forwards linear;
|
|
235
236
|
}
|
|
236
237
|
|
|
237
|
-
.toast-container.success .toast-progress-bar {
|
|
238
|
+
.sui-toast-container.success .sui-toast-progress-bar {
|
|
238
239
|
background-color: hsl(var(--success-base));
|
|
239
240
|
}
|
|
240
241
|
|
|
241
|
-
.toast-container.warning .toast-progress-bar {
|
|
242
|
+
.sui-toast-container.warning .sui-toast-progress-bar {
|
|
242
243
|
background-color: hsl(var(--warning-base));
|
|
243
244
|
}
|
|
244
245
|
|
|
245
|
-
.toast-container.danger .toast-progress-bar {
|
|
246
|
+
.sui-toast-container.danger .sui-toast-progress-bar {
|
|
246
247
|
background-color: hsl(var(--danger-base));
|
|
247
248
|
}
|
|
248
249
|
|
|
@@ -261,23 +262,23 @@ const {
|
|
|
261
262
|
background-color: hsl(var(--default-base));
|
|
262
263
|
}
|
|
263
264
|
|
|
264
|
-
.toast-container.closing {
|
|
265
|
+
.sui-toast-container.closing {
|
|
265
266
|
animation: toast-closing .25s ease forwards;
|
|
266
267
|
}
|
|
267
268
|
|
|
268
|
-
.toast-container.persistent {
|
|
269
|
+
.sui-toast-container.persistent {
|
|
269
270
|
border: 1px solid hsl(var(--primary-base));
|
|
270
271
|
}
|
|
271
272
|
|
|
272
|
-
.toast-container.persistent.success {
|
|
273
|
+
.sui-toast-container.persistent.success {
|
|
273
274
|
border: 1px solid hsl(var(--success-base));
|
|
274
275
|
}
|
|
275
276
|
|
|
276
|
-
.toast-container.persistent.warning {
|
|
277
|
+
.sui-toast-container.persistent.warning {
|
|
277
278
|
border: 1px solid hsl(var(--warning-base));
|
|
278
279
|
}
|
|
279
280
|
|
|
280
|
-
.toast-container.persistent.danger {
|
|
281
|
+
.sui-toast-container.persistent.danger {
|
|
281
282
|
border: 1px solid hsl(var(--danger-base));
|
|
282
283
|
}
|
|
283
284
|
|
|
@@ -10,7 +10,7 @@ interface Props {
|
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
name?: string;
|
|
12
12
|
isRequired?: boolean;
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
14
|
|
|
15
15
|
const {
|
|
16
16
|
size = 'md',
|
|
@@ -23,7 +23,7 @@ const {
|
|
|
23
23
|
} = Astro.props;
|
|
24
24
|
---
|
|
25
25
|
<label
|
|
26
|
-
class="toggle-label"
|
|
26
|
+
class="sui-toggle-label"
|
|
27
27
|
for={name}
|
|
28
28
|
class:list={[
|
|
29
29
|
disabled && "disabled",
|
|
@@ -31,8 +31,8 @@ const {
|
|
|
31
31
|
size,
|
|
32
32
|
]}
|
|
33
33
|
>
|
|
34
|
-
<div class="toggle-container">
|
|
35
|
-
<div class="toggle-switch" />
|
|
34
|
+
<div class="sui-toggle-container">
|
|
35
|
+
<div class="sui-toggle-switch" />
|
|
36
36
|
<input
|
|
37
37
|
type="checkbox"
|
|
38
38
|
name={name}
|
|
@@ -40,7 +40,7 @@ const {
|
|
|
40
40
|
checked={defaultChecked}
|
|
41
41
|
disabled={disabled}
|
|
42
42
|
required={isRequired}
|
|
43
|
-
class="checkbox"
|
|
43
|
+
class="sui-checkbox"
|
|
44
44
|
/>
|
|
45
45
|
</div>
|
|
46
46
|
<span>
|
|
@@ -48,7 +48,7 @@ const {
|
|
|
48
48
|
</span>
|
|
49
49
|
</label>
|
|
50
50
|
<style>
|
|
51
|
-
.toggle-label {
|
|
51
|
+
.sui-toggle-label {
|
|
52
52
|
display: flex;
|
|
53
53
|
flex-direction: row;
|
|
54
54
|
align-items: center;
|
|
@@ -57,17 +57,17 @@ const {
|
|
|
57
57
|
margin: .25rem 0;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
.toggle-label.disabled {
|
|
60
|
+
.sui-toggle-label.disabled {
|
|
61
61
|
opacity: 0.5;
|
|
62
62
|
pointer-events: none;
|
|
63
63
|
color: hsl(var(--text-muted));
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
.toggle-label:active .toggle-switch {
|
|
66
|
+
.sui-toggle-label:active .sui-toggle-switch {
|
|
67
67
|
transform: scale(0.85);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
.toggle-container {
|
|
70
|
+
.sui-toggle-container {
|
|
71
71
|
--toggle-height: 12px;
|
|
72
72
|
--toggle-width: 40px;
|
|
73
73
|
display: flex;
|
|
@@ -80,7 +80,7 @@ const {
|
|
|
80
80
|
border-radius: var(--toggle-height);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
.toggle-switch {
|
|
83
|
+
.sui-toggle-switch {
|
|
84
84
|
--switch: calc(var(--toggle-height) * 1.75);
|
|
85
85
|
height: var(--switch);
|
|
86
86
|
width: var(--switch);
|
|
@@ -92,42 +92,42 @@ const {
|
|
|
92
92
|
will-change: transform;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
.toggle-container:has(.checkbox:checked) .toggle-switch {
|
|
95
|
+
.sui-toggle-container:has(.sui-checkbox:checked) .sui-toggle-switch {
|
|
96
96
|
left: calc(100% - var(--switch));
|
|
97
97
|
background-color: hsl(var(--text-normal));
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
.toggle-label.sm .toggle-container {
|
|
100
|
+
.sui-toggle-label.sm .sui-toggle-container {
|
|
101
101
|
--toggle-height: 10px;
|
|
102
102
|
--toggle-width: 32px;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
.toggle-label.sm .toggle-switch {
|
|
105
|
+
.sui-toggle-label.sm .sui-toggle-switch {
|
|
106
106
|
--switch: calc(var(--toggle-height) * 1.65);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
.toggle-label.lg .toggle-container {
|
|
109
|
+
.sui-toggle-label.lg .sui-toggle-container {
|
|
110
110
|
--toggle-height: 16px;
|
|
111
111
|
--toggle-width: 48px;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
.toggle-label.lg .toggle-switch {
|
|
114
|
+
.sui-toggle-label.lg .sui-toggle-switch {
|
|
115
115
|
--switch: calc(var(--toggle-height) * 1.65);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
.toggle-label.primary .toggle-container:has(.checkbox:checked) {
|
|
118
|
+
.sui-toggle-label.primary .sui-toggle-container:has(.sui-checkbox:checked) {
|
|
119
119
|
background-color: hsl(var(--primary-base));
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
.toggle-label.success .toggle-container:has(.checkbox:checked) {
|
|
122
|
+
.sui-toggle-label.success .sui-toggle-container:has(.sui-checkbox:checked) {
|
|
123
123
|
background-color: hsl(var(--success-base));
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
.toggle-label.warning .toggle-container:has(.checkbox:checked) {
|
|
126
|
+
.sui-toggle-label.warning .sui-toggle-container:has(.sui-checkbox:checked) {
|
|
127
127
|
background-color: hsl(var(--warning-base));
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
.toggle-label.danger .toggle-container:has(.checkbox:checked) {
|
|
130
|
+
.sui-toggle-label.danger .sui-toggle-container:has(.sui-checkbox:checked) {
|
|
131
131
|
background-color: hsl(var(--danger-base));
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -136,7 +136,7 @@ const {
|
|
|
136
136
|
font-weight: 700;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
.checkbox {
|
|
139
|
+
.sui-checkbox {
|
|
140
140
|
width: 0;
|
|
141
141
|
height: 0;
|
|
142
142
|
visibility: hidden;
|
|
@@ -7,32 +7,33 @@ interface Props {
|
|
|
7
7
|
description: string;
|
|
8
8
|
avatar?: string;
|
|
9
9
|
class?: string;
|
|
10
|
-
|
|
10
|
+
loading?: 'eager' | 'lazy';
|
|
11
|
+
}
|
|
11
12
|
|
|
12
|
-
const { name, description, avatar, class: className } = Astro.props;
|
|
13
|
+
const { name, description, avatar, class: className, loading } = Astro.props;
|
|
13
14
|
---
|
|
14
|
-
<div class="user-container" class:list={[ className ]}>
|
|
15
|
-
<div class="avatar-container">
|
|
15
|
+
<div class="sui-user-container" class:list={[ className ]}>
|
|
16
|
+
<div class="sui-avatar-container">
|
|
16
17
|
{avatar ? (
|
|
17
|
-
<Image src={avatar} inferSize alt={name} class="avatar-img" />
|
|
18
|
+
<Image src={avatar} inferSize loading={loading} alt={name} class="sui-avatar-img" />
|
|
18
19
|
) : (
|
|
19
20
|
<Icon name='user' width={24} height={24} />
|
|
20
21
|
)}
|
|
21
22
|
</div>
|
|
22
|
-
<div class="text-content">
|
|
23
|
-
<span class="name">{name}</span>
|
|
24
|
-
<span class="description">{description}</span>
|
|
23
|
+
<div class="sui-text-content">
|
|
24
|
+
<span class="sui-name">{name}</span>
|
|
25
|
+
<span class="sui-description">{description}</span>
|
|
25
26
|
</div>
|
|
26
27
|
</div>
|
|
27
28
|
<style>
|
|
28
|
-
.user-container {
|
|
29
|
+
.sui-user-container {
|
|
29
30
|
display: flex;
|
|
30
31
|
flex-direction: row;
|
|
31
32
|
align-items: center;
|
|
32
33
|
gap: 1rem;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
.avatar-container {
|
|
36
|
+
.sui-avatar-container {
|
|
36
37
|
width: 2.5rem;
|
|
37
38
|
height: 2.5rem;
|
|
38
39
|
background-color: hsl(var(--default-base));
|
|
@@ -44,23 +45,23 @@ const { name, description, avatar, class: className } = Astro.props;
|
|
|
44
45
|
border: 1px solid hsl(var(--border));
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
.avatar-img {
|
|
48
|
+
.sui-avatar-img {
|
|
48
49
|
width: 100%;
|
|
49
50
|
height: auto;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
.text-content {
|
|
53
|
+
.sui-text-content {
|
|
53
54
|
display: flex;
|
|
54
55
|
flex-direction: column;
|
|
55
56
|
gap: .125rem;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
.name {
|
|
59
|
+
.sui-name {
|
|
59
60
|
font-size: 1em;
|
|
60
61
|
font-weight: 600;
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
.description {
|
|
64
|
+
.sui-description {
|
|
64
65
|
font-size: .875em;
|
|
65
66
|
font-weight: 400;
|
|
66
67
|
color: hsl(var(--text-muted));
|