@studiocms/ui 0.3.2 → 0.4.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/dist/components/Accordion/Accordion.astro +23 -0
- package/dist/components/Accordion/Item.astro +21 -0
- package/dist/components/Accordion/accordion.css +64 -0
- package/dist/components/Accordion/accordion.d.ts +1 -0
- package/dist/components/Accordion/accordion.js +70 -0
- package/dist/components/Badge/Badge.astro +49 -0
- package/dist/components/Badge/badge.css +111 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.astro +31 -0
- package/dist/components/Breadcrumbs/breadcrumbs.css +15 -0
- package/dist/components/Button/Button.astro +75 -0
- package/dist/components/Button/button.css +292 -0
- package/{src/components → dist/components/Card}/Card.astro +1 -48
- package/dist/components/Card/card.css +38 -0
- package/dist/components/Center/Center.astro +7 -0
- package/dist/components/Center/center.css +8 -0
- package/dist/components/Checkbox/Checkbox.astro +95 -0
- package/dist/components/Checkbox/checkbox.css +119 -0
- package/dist/components/Checkbox/checkbox.d.ts +2 -0
- package/dist/components/Checkbox/checkbox.js +20 -0
- package/{src/components → dist/components/Divider}/Divider.astro +2 -25
- package/dist/components/Divider/divider.css +21 -0
- package/dist/components/Dropdown/Dropdown.astro +116 -0
- package/dist/components/Dropdown/dropdown.css +180 -0
- package/dist/components/Dropdown/dropdown.d.ts +48 -0
- package/dist/components/Dropdown/dropdown.js +201 -0
- package/dist/components/Footer/Footer.astro +58 -0
- package/dist/components/Footer/footer.css +68 -0
- package/dist/components/Group/Group.astro +7 -0
- package/dist/components/Group/group.css +19 -0
- package/{src/utils → dist/components/Icon}/Icon.astro +1 -1
- package/{src/utils/iconType.ts → dist/components/Icon/iconType.d.ts} +0 -1
- package/dist/components/Icon/iconType.js +0 -0
- package/{src/components → dist/components/Input}/Input.astro +2 -48
- package/dist/components/Input/input.css +38 -0
- package/{src → dist}/components/Modal/Modal.astro +4 -122
- package/dist/components/Modal/modal.css +100 -0
- package/dist/components/Modal/modal.d.ts +48 -0
- package/dist/components/Modal/modal.js +129 -0
- package/dist/components/Progress/Progress.astro +21 -0
- package/dist/components/Progress/helper.d.ts +13 -0
- package/dist/components/Progress/helper.js +32 -0
- package/dist/components/Progress/progress.css +29 -0
- package/dist/components/Progress/progress.d.ts +1 -0
- package/dist/components/Progress/progress.js +10 -0
- package/dist/components/RadioGroup/RadioGroup.astro +124 -0
- package/dist/components/RadioGroup/radiogroup.css +96 -0
- package/dist/components/RadioGroup/radiogroup.d.ts +1 -0
- package/dist/components/RadioGroup/radiogroup.js +48 -0
- package/{src/components → dist/components/Row}/Row.astro +1 -24
- package/dist/components/Row/row.css +18 -0
- package/dist/components/SearchSelect/SearchSelect.astro +135 -0
- package/dist/components/SearchSelect/searchselect.css +95 -0
- package/dist/components/SearchSelect/searchselect.d.ts +6 -0
- package/dist/components/SearchSelect/searchselect.js +166 -0
- package/dist/components/Select/Select.astro +147 -0
- package/dist/components/Select/select.css +110 -0
- package/dist/components/Select/select.d.ts +1 -0
- package/dist/components/Select/select.js +143 -0
- package/dist/components/Sidebar/helpers.d.ts +76 -0
- package/dist/components/Sidebar/helpers.js +160 -0
- package/{src → dist}/components/Tabs/TabItem.astro +3 -3
- package/dist/components/Tabs/Tabs.astro +150 -0
- package/dist/components/Tabs/tabs.css +121 -0
- package/dist/components/Tabs/tabs.d.ts +1 -0
- package/dist/components/Tabs/tabs.js +82 -0
- package/{src/components → dist/components/Textarea}/Textarea.astro +2 -61
- package/dist/components/Textarea/textarea.css +49 -0
- package/dist/components/ThemeToggle/ThemeToggle.astro +21 -0
- package/dist/components/ThemeToggle/themetoggle.css +17 -0
- package/dist/components/ThemeToggle/themetoggle.d.ts +1 -0
- package/dist/components/ThemeToggle/themetoggle.js +4 -0
- package/dist/components/Toast/Toaster.astro +69 -0
- package/dist/components/Toast/toast.d.ts +8 -0
- package/dist/components/Toast/toast.js +9 -0
- package/dist/components/Toast/toaster.css +168 -0
- package/dist/components/Toast/toaster.d.ts +1 -0
- package/dist/components/Toast/toaster.js +160 -0
- package/dist/components/Toggle/Toggle.astro +84 -0
- package/dist/components/Toggle/toggle.css +93 -0
- package/dist/components/Toggle/toggle.d.ts +2 -0
- package/dist/components/Toggle/toggle.js +20 -0
- package/{src/components → dist/components/User}/User.astro +3 -43
- package/dist/components/User/user.css +35 -0
- package/dist/css/colors.css +95 -0
- package/dist/css/global.css +3 -0
- package/dist/css/radii.css +6 -0
- package/dist/css/resets.css +46 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +379 -0
- package/dist/toolbar/ColorPicker.d.ts +7 -0
- package/dist/toolbar/ColorPicker.js +85 -0
- package/dist/toolbar/icon.d.ts +1 -0
- package/dist/toolbar/icon.js +4 -0
- package/dist/toolbar/index.d.ts +2 -0
- package/dist/toolbar/index.js +292 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.js +0 -0
- package/dist/utils/ThemeHelper.d.ts +49 -0
- package/dist/utils/ThemeHelper.js +113 -0
- package/{src/utils/colors.ts → dist/utils/colors.d.ts} +1 -1
- package/dist/utils/colors.js +0 -0
- package/dist/utils/generateID.d.ts +2 -0
- package/dist/utils/generateID.js +6 -0
- package/dist/utils/headers.d.ts +43 -0
- package/dist/utils/headers.js +129 -0
- package/dist/utils/iconStrings.d.ts +4 -0
- package/dist/utils/iconStrings.js +13 -0
- package/dist/utils/integration-utils.d.ts +130 -0
- package/dist/utils/integration-utils.js +161 -0
- package/package.json +26 -10
- package/src/components/BaseHead.astro +0 -22
- package/src/components/Button.astro +0 -372
- package/src/components/Center.astro +0 -16
- package/src/components/Checkbox.astro +0 -250
- package/src/components/Dropdown/Dropdown.astro +0 -314
- package/src/components/Dropdown/dropdown.ts +0 -258
- package/src/components/Dropdown/index.ts +0 -2
- package/src/components/Footer.astro +0 -137
- package/src/components/Modal/index.ts +0 -2
- package/src/components/Modal/modal.ts +0 -163
- package/src/components/RadioGroup.astro +0 -299
- package/src/components/SearchSelect.astro +0 -486
- package/src/components/Select.astro +0 -467
- package/src/components/Sidebar/helpers.ts +0 -179
- package/src/components/Sidebar/index.ts +0 -3
- package/src/components/Tabs/Tabs.astro +0 -393
- package/src/components/Tabs/index.ts +0 -2
- package/src/components/ThemeToggle.astro +0 -46
- package/src/components/Toast/Toaster.astro +0 -470
- package/src/components/Toast/index.ts +0 -2
- package/src/components/Toast/toast.ts +0 -16
- package/src/components/Toggle.astro +0 -214
- package/src/components/index.ts +0 -27
- package/src/components.ts +0 -26
- package/src/css/colors.css +0 -106
- package/src/css/global.css +0 -2
- package/src/css/resets.css +0 -54
- package/src/env.d.ts +0 -15
- package/src/integration.ts +0 -31
- package/src/layouts/RootLayout.astro +0 -33
- package/src/layouts/index.ts +0 -2
- package/src/layouts.ts +0 -1
- package/src/types/index.ts +0 -11
- package/src/utils/ThemeHelper.ts +0 -145
- package/src/utils/create-resolver.ts +0 -30
- package/src/utils/generateID.ts +0 -5
- package/src/utils/headers.ts +0 -190
- package/src/utils/iconStrings.ts +0 -29
- package/src/utils/index.ts +0 -1
- package/src/utils/virtual-module-plugin-builder.ts +0 -37
- /package/{src → dist}/components/Sidebar/Double.astro +0 -0
- /package/{src → dist}/components/Sidebar/Single.astro +0 -0
- /package/{src → dist}/icons/Checkmark.astro +0 -0
- /package/{src → dist}/icons/ChevronUpDown.astro +0 -0
- /package/{src → dist}/icons/User.astro +0 -0
- /package/{src → dist}/icons/X-Mark.astro +0 -0
|
@@ -1,372 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLTag, Polymorphic } from 'astro/types';
|
|
3
|
-
import type { StudioCMSColorway } from '../utils/colors';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Props for the button component.
|
|
7
|
-
*/
|
|
8
|
-
type Props<As extends HTMLTag = 'button'> = Omit<Polymorphic<{ as: As }>, 'as'> & {
|
|
9
|
-
/**
|
|
10
|
-
* The polymorphic component to render the button as. Defaults to `button`.
|
|
11
|
-
*/
|
|
12
|
-
as?: As;
|
|
13
|
-
/**
|
|
14
|
-
* The size of the button. Defaults to `md`.
|
|
15
|
-
*/
|
|
16
|
-
size?: 'sm' | 'md' | 'lg';
|
|
17
|
-
/**
|
|
18
|
-
* Whether the button should be full width. Defaults to `false`.
|
|
19
|
-
*/
|
|
20
|
-
fullWidth?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* The colorway of the button. Defaults to `default`.
|
|
23
|
-
*/
|
|
24
|
-
color?: StudioCMSColorway;
|
|
25
|
-
/**
|
|
26
|
-
* The variant of the button. Defaults to `solid`.
|
|
27
|
-
*/
|
|
28
|
-
variant?: 'solid' | 'outlined' | 'flat';
|
|
29
|
-
/**
|
|
30
|
-
* Whether the button is disabled. Defaults to `false`.
|
|
31
|
-
*/
|
|
32
|
-
disabled?: boolean;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export type { Props };
|
|
36
|
-
|
|
37
|
-
const {
|
|
38
|
-
size = 'md',
|
|
39
|
-
fullWidth = false,
|
|
40
|
-
color = 'default',
|
|
41
|
-
variant = 'solid',
|
|
42
|
-
as: As = 'button',
|
|
43
|
-
disabled = false,
|
|
44
|
-
...props
|
|
45
|
-
} = Astro.props;
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
<As
|
|
49
|
-
class="sui-button"
|
|
50
|
-
class:list={[
|
|
51
|
-
fullWidth && "full",
|
|
52
|
-
disabled && "disabled",
|
|
53
|
-
size,
|
|
54
|
-
color,
|
|
55
|
-
variant,
|
|
56
|
-
]}
|
|
57
|
-
disabled={disabled}
|
|
58
|
-
tabindex={0}
|
|
59
|
-
{...props}>
|
|
60
|
-
<slot name="start-content" />
|
|
61
|
-
<slot />
|
|
62
|
-
<slot name="end-content" />
|
|
63
|
-
</As>
|
|
64
|
-
<style>
|
|
65
|
-
/* Default Styles */
|
|
66
|
-
.sui-button {
|
|
67
|
-
display: flex;
|
|
68
|
-
flex-direction: row;
|
|
69
|
-
align-items: center;
|
|
70
|
-
text-align: center;
|
|
71
|
-
|
|
72
|
-
position: relative;
|
|
73
|
-
|
|
74
|
-
/* Move gaps & radii to spacings.css later on */
|
|
75
|
-
gap: 0.5rem;
|
|
76
|
-
|
|
77
|
-
outline: none;
|
|
78
|
-
border: none;
|
|
79
|
-
|
|
80
|
-
font-weight: 400;
|
|
81
|
-
|
|
82
|
-
border-radius: 0.5rem;
|
|
83
|
-
|
|
84
|
-
transition: transform 0.15s, background-color 0.15s, border-color 0.15s, color 0.15s;
|
|
85
|
-
transition-timing-function: ease;
|
|
86
|
-
|
|
87
|
-
cursor: pointer;
|
|
88
|
-
|
|
89
|
-
/* Default colorway */
|
|
90
|
-
|
|
91
|
-
background-color: hsl(var(--default-base));
|
|
92
|
-
border-color: hsl(var(--border));
|
|
93
|
-
color: hsl(var(--text-normal));
|
|
94
|
-
|
|
95
|
-
min-width: fit-content;
|
|
96
|
-
|
|
97
|
-
will-change: transform;
|
|
98
|
-
|
|
99
|
-
text-decoration: none;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.sui-button.disabled {
|
|
103
|
-
pointer-events: none;
|
|
104
|
-
opacity: 0.5;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.sui-button.outlined {
|
|
108
|
-
border-width: 1px;
|
|
109
|
-
border-style: solid;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.sui-button.outlined:hover {
|
|
113
|
-
background-color: hsl(var(--default-hover));
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.sui-button.outlined:active {
|
|
117
|
-
background-color: hsl(var(--default-hover));
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.sui-button:hover {
|
|
121
|
-
background-color: hsl(var(--default-hover));
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.sui-button:active {
|
|
125
|
-
background-color: hsl(var(--default-active));
|
|
126
|
-
transform: scale(0.95);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.sui-button.flat {
|
|
130
|
-
background: hsla(var(--default-flat));
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.sui-button.flat:hover {
|
|
134
|
-
background: hsla(var(--default-flat-hover));
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.sui-button.flat:active {
|
|
138
|
-
background: hsla(var(--default-flat-active));
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/* Sizes */
|
|
142
|
-
.sui-button.sm {
|
|
143
|
-
height: 32px;
|
|
144
|
-
padding: 0.5rem 0.75rem;
|
|
145
|
-
|
|
146
|
-
font-size: 0.825em;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.sui-button.md {
|
|
150
|
-
height: 40px;
|
|
151
|
-
padding: 0.5rem 0.75rem;
|
|
152
|
-
|
|
153
|
-
font-size: 0.875em;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.sui-button.lg {
|
|
157
|
-
height: 48px;
|
|
158
|
-
padding: 0.75rem 1rem;
|
|
159
|
-
|
|
160
|
-
font-size: 1em;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.sui-button:focus-visible {
|
|
164
|
-
outline: 2px solid hsl(var(--text-normal));
|
|
165
|
-
outline-offset: 2px;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/* Primary Colorway */
|
|
169
|
-
.sui-button.primary {
|
|
170
|
-
background-color: hsl(var(--primary-base));
|
|
171
|
-
border-color: hsl(var(--primary-base));
|
|
172
|
-
color: hsl(var(--text-inverted));
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.sui-button.primary:hover {
|
|
176
|
-
background-color: hsl(var(--primary-hover));
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.sui-button.primary:active {
|
|
180
|
-
background-color: hsl(var(--primary-active));
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.sui-button.primary.outlined {
|
|
184
|
-
background-color: hsl(var(--default-base));
|
|
185
|
-
color: hsl(var(--text-normal));
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.sui-button.primary.outlined:hover {
|
|
189
|
-
background-color: hsl(var(--default-hover));
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.sui-button.primary.outlined:active {
|
|
193
|
-
background-color: hsl(var(--default-active));
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.sui-button.primary.flat {
|
|
197
|
-
background-color: hsla(var(--primary-flat));
|
|
198
|
-
color: hsl(259, 96%, 79%);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.sui-button.primary.flat:hover {
|
|
202
|
-
background-color: hsla(var(--primary-flat-hover));
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.sui-button.primary.flat:active {
|
|
206
|
-
background-color: hsla(var(--primary-flat-active));
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/* Success Colorway */
|
|
210
|
-
.sui-button.success {
|
|
211
|
-
background-color: hsl(var(--success-base));
|
|
212
|
-
border-color: hsl(var(--success-base));
|
|
213
|
-
color: hsl(var(--text-dark));
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.sui-button.success:hover {
|
|
217
|
-
background-color: hsl(var(--success-hover));
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
.sui-button.success:active {
|
|
221
|
-
background-color: hsl(var(--success-active));
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
.sui-button.success.outlined {
|
|
225
|
-
background-color: hsl(var(--default-base));
|
|
226
|
-
color: hsl(var(--text-normal));
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
.sui-button.success.outlined:hover {
|
|
230
|
-
background-color: hsl(var(--default-hover));
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
.sui-button.success.outlined:active {
|
|
234
|
-
background-color: hsl(var(--default-active));
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.sui-button.success.flat {
|
|
238
|
-
background-color: hsla(var(--success-flat));
|
|
239
|
-
color: hsl(var(--success-base));
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.sui-button.success.flat:hover {
|
|
243
|
-
background-color: hsla(var(--success-flat-hover));
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
.sui-button.success.flat:active {
|
|
247
|
-
background-color: hsla(var(--success-flat-active));
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/* Warning Colorway */
|
|
251
|
-
.sui-button.warning {
|
|
252
|
-
background-color: hsl(var(--warning-base));
|
|
253
|
-
border-color: hsl(var(--warning-base));
|
|
254
|
-
color: hsl(var(--text-dark));
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
.sui-button.warning:hover {
|
|
258
|
-
background-color: hsl(var(--warning-hover));
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
.sui-button.warning:active {
|
|
262
|
-
background-color: hsl(var(--warning-active));
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
.sui-button.warning.outlined {
|
|
266
|
-
background-color: hsl(var(--default-base));
|
|
267
|
-
color: hsl(var(--text-normal));
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
.sui-button.warning.outlined:hover {
|
|
271
|
-
background-color: hsl(var(--default-hover));
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
.sui-button.warning.outlined:active {
|
|
275
|
-
background-color: hsl(var(--default-active));
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
.sui-button.warning.flat {
|
|
279
|
-
background-color: hsla(var(--warning-flat));
|
|
280
|
-
color: hsl(var(--warning-base));
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
.sui-button.warning.flat:hover {
|
|
284
|
-
background-color: hsla(var(--warning-flat-hover));
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
.sui-button.warning.flat:active {
|
|
288
|
-
background-color: hsla(var(--warning-flat-active));
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/* Danger Colorway */
|
|
292
|
-
.sui-button.danger {
|
|
293
|
-
background-color: hsl(var(--danger-base));
|
|
294
|
-
border-color: hsl(var(--danger-base));
|
|
295
|
-
color: hsl(var(--text-light));
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
.sui-button.danger:hover {
|
|
299
|
-
background-color: hsl(var(--danger-hover));
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
.sui-button.danger:active {
|
|
303
|
-
background-color: hsl(var(--danger-active));
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
.sui-button.danger.outlined {
|
|
307
|
-
background-color: hsl(var(--default-base));
|
|
308
|
-
color: hsl(var(--text-normal));
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
.sui-button.danger.outlined:hover {
|
|
312
|
-
background-color: hsl(var(--default-hover));
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
.sui-button.danger.outlined:active {
|
|
316
|
-
background-color: hsl(var(--default-active));
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
.sui-button.danger.flat {
|
|
320
|
-
background-color: hsla(var(--danger-flat));
|
|
321
|
-
color: hsl(337, 92%, 71%);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
.sui-button.danger.flat:hover {
|
|
325
|
-
background-color: hsla(var(--danger-flat-hover));
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
.sui-button.danger.flat:active {
|
|
329
|
-
background-color: hsla(var(--danger-flat-active));
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
.sui-button.full {
|
|
333
|
-
width: 100%;
|
|
334
|
-
justify-content: center;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
[data-theme="light"] {
|
|
338
|
-
.sui-button.primary.flat {
|
|
339
|
-
color: hsl(259, 84%, 45%);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
.sui-button.success.flat {
|
|
343
|
-
background-color: hsl(var(--success-base), 0.2);
|
|
344
|
-
color: hsl(143, 59%, 20%);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
.sui-button.success.flat:hover {
|
|
348
|
-
background-color: hsla(var(--success-flat-hover));
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
.sui-button.success.flat:active {
|
|
352
|
-
background-color: hsla(var(--success-flat-active));
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
.sui-button.warning.flat {
|
|
356
|
-
background-color: hsla(var(--warning-base), 0.2);
|
|
357
|
-
color: hsl(48, 78%, 20%);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
.sui-button.warning.flat:hover {
|
|
361
|
-
background-color: hsla(var(--warning-base), 0.25);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
.sui-button.warning.flat:active {
|
|
365
|
-
background-color: hsla(var(--warning-base), 0.4);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
.sui-button.danger.flat {
|
|
369
|
-
color: hsl(339, 97%, 29%);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
</style>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<!-- This was made for Jumper, to keep him happy <3 -->
|
|
2
|
-
<div class="sui-center">
|
|
3
|
-
<slot />
|
|
4
|
-
</div>
|
|
5
|
-
<style>
|
|
6
|
-
.sui-center {
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
|
|
11
|
-
width: 100%;
|
|
12
|
-
height: 100%;
|
|
13
|
-
|
|
14
|
-
text-align: center;
|
|
15
|
-
}
|
|
16
|
-
</style>
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import Checkmark from '../icons/Checkmark.astro';
|
|
3
|
-
import type { StudioCMSColorway } from '../utils/colors';
|
|
4
|
-
import { generateID } from '../utils/generateID';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The props for the Checkbox component.
|
|
8
|
-
*/
|
|
9
|
-
interface Props {
|
|
10
|
-
/**
|
|
11
|
-
* The label of the checkbox.
|
|
12
|
-
*/
|
|
13
|
-
label: string;
|
|
14
|
-
/**
|
|
15
|
-
* The size of the checkbox. Defaults to `md`.
|
|
16
|
-
*/
|
|
17
|
-
size?: 'sm' | 'md' | 'lg';
|
|
18
|
-
/**
|
|
19
|
-
* The color of the checkbox. Defaults to `default`.
|
|
20
|
-
*/
|
|
21
|
-
color?: StudioCMSColorway;
|
|
22
|
-
/**
|
|
23
|
-
* Whether the checkbox is checked by default.
|
|
24
|
-
*/
|
|
25
|
-
defaultChecked?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Whether the checkbox is disabled.
|
|
28
|
-
*/
|
|
29
|
-
disabled?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* The name of the checkbox.
|
|
32
|
-
*/
|
|
33
|
-
name?: string;
|
|
34
|
-
/**
|
|
35
|
-
* Whether the checkbox is required.
|
|
36
|
-
*/
|
|
37
|
-
isRequired?: boolean;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const {
|
|
41
|
-
size = 'md',
|
|
42
|
-
color = 'default',
|
|
43
|
-
defaultChecked,
|
|
44
|
-
disabled,
|
|
45
|
-
name = generateID('checkbox'),
|
|
46
|
-
label,
|
|
47
|
-
isRequired,
|
|
48
|
-
} = Astro.props;
|
|
49
|
-
|
|
50
|
-
const iconSizes = {
|
|
51
|
-
sm: 14,
|
|
52
|
-
md: 16,
|
|
53
|
-
lg: 24,
|
|
54
|
-
};
|
|
55
|
-
---
|
|
56
|
-
<label
|
|
57
|
-
class="sui-checkmark-label"
|
|
58
|
-
for={name}
|
|
59
|
-
class:list={[
|
|
60
|
-
disabled && "disabled",
|
|
61
|
-
color,
|
|
62
|
-
size,
|
|
63
|
-
]}
|
|
64
|
-
>
|
|
65
|
-
<div
|
|
66
|
-
class="sui-checkmark-container"
|
|
67
|
-
tabindex="0"
|
|
68
|
-
role="checkbox"
|
|
69
|
-
aria-checked={defaultChecked}
|
|
70
|
-
aria-labelledby={`label-${name}`}
|
|
71
|
-
>
|
|
72
|
-
<Checkmark
|
|
73
|
-
class={'sui-checkmark'}
|
|
74
|
-
width={iconSizes[size]}
|
|
75
|
-
height={iconSizes[size]}
|
|
76
|
-
/>
|
|
77
|
-
<input
|
|
78
|
-
type="checkbox"
|
|
79
|
-
name={name}
|
|
80
|
-
id={name}
|
|
81
|
-
checked={defaultChecked}
|
|
82
|
-
disabled={disabled}
|
|
83
|
-
required={isRequired}
|
|
84
|
-
class="sui-checkbox"
|
|
85
|
-
hidden
|
|
86
|
-
/>
|
|
87
|
-
</div>
|
|
88
|
-
<span id={`label-${name}`}>
|
|
89
|
-
{label} <span class="req-star">{isRequired && "*"}</span>
|
|
90
|
-
</span>
|
|
91
|
-
</label>
|
|
92
|
-
<script>
|
|
93
|
-
const elements = document.querySelectorAll<HTMLDivElement>('.sui-checkmark-container');
|
|
94
|
-
const checkbox = document.querySelectorAll<HTMLInputElement>('.sui-checkbox');
|
|
95
|
-
|
|
96
|
-
for (const element of elements) {
|
|
97
|
-
if (element.dataset.initialized) continue;
|
|
98
|
-
|
|
99
|
-
element.dataset.initialized = 'true';
|
|
100
|
-
|
|
101
|
-
element.addEventListener('keydown', (e) => {
|
|
102
|
-
if (e.key !== 'Enter' && e.key !== ' ') return;
|
|
103
|
-
|
|
104
|
-
e.preventDefault();
|
|
105
|
-
|
|
106
|
-
const checkbox = element.querySelector<HTMLInputElement>('.sui-checkbox');
|
|
107
|
-
|
|
108
|
-
if (!checkbox) return;
|
|
109
|
-
|
|
110
|
-
checkbox.click();
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
for (const box of checkbox) {
|
|
115
|
-
if (box.dataset.initialized) continue;
|
|
116
|
-
|
|
117
|
-
box.dataset.initialized = 'true';
|
|
118
|
-
|
|
119
|
-
box.addEventListener('change', (e) => {
|
|
120
|
-
box.parentElement!.ariaChecked = (e.target as HTMLInputElement).checked ? 'true' : 'false';
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
</script>
|
|
124
|
-
<style>
|
|
125
|
-
.sui-checkmark-label {
|
|
126
|
-
display: flex;
|
|
127
|
-
flex-direction: row;
|
|
128
|
-
align-items: center;
|
|
129
|
-
gap: .5rem;
|
|
130
|
-
position: relative;
|
|
131
|
-
margin: .25rem 0;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.sui-checkmark-label.disabled {
|
|
135
|
-
opacity: 0.5;
|
|
136
|
-
pointer-events: none;
|
|
137
|
-
color: hsl(var(--text-muted));
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.sui-checkmark-container {
|
|
141
|
-
display: flex;
|
|
142
|
-
align-items: center;
|
|
143
|
-
justify-content: center;
|
|
144
|
-
background-color: hsl(var(--default-base));
|
|
145
|
-
border: 2px solid hsl(var(--default-base));
|
|
146
|
-
border-radius: .5rem;
|
|
147
|
-
cursor: pointer;
|
|
148
|
-
transition: background-color .15s, border .15s, transform .15s;
|
|
149
|
-
transition-timing-function: ease;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.sui-checkmark-container:focus-visible {
|
|
153
|
-
outline: 2px solid hsl(var(--text-normal));
|
|
154
|
-
outline-offset: 2px;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.sui-checkmark-label:hover .sui-checkmark-container {
|
|
158
|
-
background-color: hsl(var(--default-hover));
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.sui-checkmark-label:active .sui-checkmark-container {
|
|
162
|
-
background-color: hsl(var(--default-active));
|
|
163
|
-
scale: 0.9;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.sui-checkmark-label.sm {
|
|
167
|
-
font-size: .875em;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.sui-checkmark-label.sm .sui-checkmark-container {
|
|
171
|
-
width: 1.25rem;
|
|
172
|
-
height: 1.25rem;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.sui-checkmark-label.md .sui-checkmark-container {
|
|
176
|
-
width: 1.5rem;
|
|
177
|
-
height: 1.5rem;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.sui-checkmark-label.lg {
|
|
181
|
-
font-size: 1.125em;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.sui-checkmark-label.lg .sui-checkmark-container {
|
|
185
|
-
width: 1.75rem;
|
|
186
|
-
height: 1.75rem;
|
|
187
|
-
padding: .125rem;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.primary .sui-checkmark-container:has(.sui-checkbox:checked) {
|
|
191
|
-
border-color: hsl(var(--primary-base));
|
|
192
|
-
background-color: hsl(var(--primary-base));
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
.success .sui-checkmark-container:has(.sui-checkbox:checked) {
|
|
196
|
-
border-color: hsl(var(--success-base));
|
|
197
|
-
background-color: hsl(var(--success-base));
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.warning .sui-checkmark-container:has(.sui-checkbox:checked) {
|
|
201
|
-
border-color: hsl(var(--warning-base));
|
|
202
|
-
background-color: hsl(var(--warning-base));
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.danger .sui-checkmark-container:has(.sui-checkbox:checked) {
|
|
206
|
-
border-color: hsl(var(--danger-base));
|
|
207
|
-
background-color: hsl(var(--danger-base));
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
.req-star {
|
|
211
|
-
color: hsl(var(--danger-base));
|
|
212
|
-
font-weight: 700;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
.sui-checkbox {
|
|
216
|
-
width: 0;
|
|
217
|
-
height: 0;
|
|
218
|
-
visibility: hidden;
|
|
219
|
-
opacity: 0;
|
|
220
|
-
margin: 0;
|
|
221
|
-
}
|
|
222
|
-
</style>
|
|
223
|
-
<style is:global>
|
|
224
|
-
.sui-checkmark polyline {
|
|
225
|
-
transition: all .15s ease;
|
|
226
|
-
color: hsl(var(--text-normal));
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
.primary .sui-checkmark polyline {
|
|
230
|
-
color: hsl(var(--text-inverted));
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
.success .sui-checkmark polyline {
|
|
234
|
-
color: hsl(var(--text-dark));
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.warning .sui-checkmark polyline {
|
|
238
|
-
color: hsl(var(--text-dark));
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
.danger .sui-checkmark polyline {
|
|
242
|
-
color: hsl(var(--text-light));
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
.sui-checkmark-container:has(.sui-checkbox:checked) {
|
|
246
|
-
.sui-checkmark polyline {
|
|
247
|
-
stroke-dashoffset: 44;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
</style>
|