@marianmeres/stuic 3.0.0 → 3.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/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.js +1 -0
- package/dist/actions/typeahead.svelte.d.ts +53 -0
- package/dist/actions/typeahead.svelte.js +328 -0
- package/dist/base.css +17 -0
- package/dist/components/AlertConfirmPrompt/AlertConfirmPrompt.svelte +4 -3
- package/dist/components/AlertConfirmPrompt/AlertConfirmPrompt.svelte.d.ts +4 -3
- package/dist/components/AlertConfirmPrompt/Current.svelte +1 -2
- package/dist/components/AlertConfirmPrompt/Current.svelte.d.ts +0 -1
- package/dist/components/AlertConfirmPrompt/index.css +47 -43
- package/dist/components/AssetsPreview/AssetsPreview.svelte +0 -1
- package/dist/components/AssetsPreview/AssetsPreview.svelte.d.ts +0 -1
- package/dist/components/AssetsPreview/index.css +31 -29
- package/dist/components/Avatar/Avatar.svelte +0 -1
- package/dist/components/Avatar/Avatar.svelte.d.ts +0 -1
- package/dist/components/Avatar/index.css +87 -85
- package/dist/components/Backdrop/Backdrop.svelte +0 -1
- package/dist/components/Backdrop/Backdrop.svelte.d.ts +0 -1
- package/dist/components/Backdrop/index.css +15 -13
- package/dist/components/Button/Button.svelte +0 -1
- package/dist/components/Button/Button.svelte.d.ts +0 -1
- package/dist/components/Button/index.css +431 -429
- package/dist/components/ButtonGroupRadio/ButtonGroupRadio.svelte +0 -1
- package/dist/components/ButtonGroupRadio/ButtonGroupRadio.svelte.d.ts +0 -1
- package/dist/components/ButtonGroupRadio/index.css +123 -117
- package/dist/components/Collapsible/index.css +17 -15
- package/dist/components/CommandMenu/CommandMenu.svelte +7 -4
- package/dist/components/CommandMenu/CommandMenu.svelte.d.ts +0 -1
- package/dist/components/CommandMenu/index.css +27 -25
- package/dist/components/DismissibleMessage/DismissibleMessage.svelte +0 -1
- package/dist/components/DismissibleMessage/DismissibleMessage.svelte.d.ts +0 -1
- package/dist/components/DismissibleMessage/index.css +116 -110
- package/dist/components/DropdownMenu/DropdownMenu.svelte +0 -1
- package/dist/components/DropdownMenu/DropdownMenu.svelte.d.ts +0 -1
- package/dist/components/DropdownMenu/index.css +179 -177
- package/dist/components/Input/FieldInput.svelte +8 -0
- package/dist/components/Input/FieldInput.svelte.d.ts +2 -0
- package/dist/components/Input/FieldOptions.svelte +1 -1
- package/dist/components/Input/index.css +411 -398
- package/dist/components/KbdShortcut/KbdShortcut.svelte +4 -12
- package/dist/components/KbdShortcut/README.md +34 -0
- package/dist/components/KbdShortcut/index.css +55 -0
- package/dist/components/ListItemButton/ListItemButton.svelte +0 -1
- package/dist/components/ListItemButton/ListItemButton.svelte.d.ts +0 -1
- package/dist/components/ListItemButton/index.css +118 -116
- package/dist/components/Modal/Modal.svelte +0 -1
- package/dist/components/Modal/Modal.svelte.d.ts +0 -1
- package/dist/components/Modal/index.css +18 -16
- package/dist/components/ModalDialog/index.css +29 -27
- package/dist/components/Nav/Nav.svelte +732 -0
- package/dist/components/Nav/Nav.svelte.d.ts +110 -0
- package/dist/components/Nav/README.md +334 -0
- package/dist/components/Nav/index.css +318 -0
- package/dist/components/Nav/index.d.ts +1 -0
- package/dist/components/Nav/index.js +1 -0
- package/dist/components/Notifications/Notifications.svelte +2 -3
- package/dist/components/Notifications/Notifications.svelte.d.ts +0 -1
- package/dist/components/Notifications/index.css +158 -158
- package/dist/components/Notifications/notifications-stack.svelte.d.ts +4 -0
- package/dist/components/Notifications/notifications-stack.svelte.js +8 -0
- package/dist/components/Progress/Progress.svelte +4 -2
- package/dist/components/Progress/Progress.svelte.d.ts +1 -0
- package/dist/components/Progress/README.md +86 -15
- package/dist/components/Progress/_internal/Bar.svelte +4 -15
- package/dist/components/Progress/_internal/Bar.svelte.d.ts +1 -1
- package/dist/components/Progress/_internal/Circle.svelte +30 -2
- package/dist/components/Progress/_internal/Circle.svelte.d.ts +1 -0
- package/dist/components/Progress/index.css +47 -1
- package/dist/components/Skeleton/README.md +152 -0
- package/dist/components/Skeleton/Skeleton.svelte +6 -7
- package/dist/components/Skeleton/Skeleton.svelte.d.ts +0 -1
- package/dist/components/Skeleton/index.css +73 -43
- package/dist/components/Spinner/README.md +149 -37
- package/dist/components/Spinner/Spinner.svelte +14 -38
- package/dist/components/Spinner/Spinner.svelte.d.ts +2 -1
- package/dist/components/Spinner/SpinnerCircle.svelte +6 -34
- package/dist/components/Spinner/SpinnerCircle.svelte.d.ts +1 -0
- package/dist/components/Spinner/SpinnerCircleOscillate.svelte +10 -5
- package/dist/components/Spinner/SpinnerUnicode.svelte +3 -1
- package/dist/components/Spinner/SpinnerUnicode.svelte.d.ts +1 -0
- package/dist/components/Spinner/index.css +104 -0
- package/dist/components/Switch/README.md +34 -18
- package/dist/components/Switch/Switch.svelte +24 -46
- package/dist/components/Switch/Switch.svelte.d.ts +4 -2
- package/dist/components/Switch/index.css +120 -2
- package/dist/components/Switch/index.d.ts +1 -2
- package/dist/components/Switch/index.js +1 -2
- package/dist/components/TabbedMenu/README.md +28 -17
- package/dist/components/TabbedMenu/TabbedMenu.svelte +5 -46
- package/dist/components/TabbedMenu/TabbedMenu.svelte.d.ts +0 -1
- package/dist/components/TabbedMenu/index.css +85 -3
- package/dist/components/ThemePreview/ThemePreview.svelte +76 -23
- package/dist/components/ThemePreview/ThemePreview.svelte.d.ts +3 -1
- package/dist/components/ThemePreview/index.css +17 -1
- package/dist/components/TwCheck/README.md +32 -13
- package/dist/components/TwCheck/TwCheck.svelte +11 -9
- package/dist/components/TwCheck/TwCheck.svelte.d.ts +0 -1
- package/dist/components/TwCheck/index.css +14 -0
- package/dist/components/TypeaheadInput/TypeaheadInput.svelte +19 -187
- package/dist/components/TypeaheadInput/TypeaheadInput.svelte.d.ts +4 -2
- package/dist/index.css +44 -39
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/themes/blue-orange.css +202 -148
- package/dist/themes/blue-orange.js +24 -0
- package/dist/themes/cyan-red.css +202 -148
- package/dist/themes/cyan-red.js +24 -0
- package/dist/themes/cyan-slate.css +202 -148
- package/dist/themes/cyan-slate.js +25 -1
- package/dist/themes/emerald-pink.css +202 -148
- package/dist/themes/emerald-pink.js +25 -1
- package/dist/themes/fuchsia-emerald.css +202 -148
- package/dist/themes/fuchsia-emerald.js +25 -1
- package/dist/themes/gray.css +202 -148
- package/dist/themes/gray.js +24 -0
- package/dist/themes/indigo-amber.css +202 -148
- package/dist/themes/indigo-amber.js +26 -2
- package/dist/themes/neutral.css +202 -148
- package/dist/themes/neutral.js +24 -0
- package/dist/themes/pink-emerald.css +202 -148
- package/dist/themes/pink-emerald.js +25 -1
- package/dist/themes/purple-yellow.css +202 -148
- package/dist/themes/purple-yellow.js +24 -0
- package/dist/themes/rainbow.css +202 -148
- package/dist/themes/rainbow.js +25 -1
- package/dist/themes/red-blue.css +202 -148
- package/dist/themes/red-blue.js +24 -0
- package/dist/themes/red-cyan.css +202 -148
- package/dist/themes/red-cyan.js +24 -0
- package/dist/themes/rose-teal.css +202 -148
- package/dist/themes/rose-teal.js +24 -0
- package/dist/themes/sky-amber.css +202 -148
- package/dist/themes/sky-amber.js +26 -2
- package/dist/themes/slate-cyan.css +202 -148
- package/dist/themes/slate-cyan.js +25 -1
- package/dist/themes/teal-rose.css +202 -148
- package/dist/themes/teal-rose.js +24 -0
- package/dist/themes/violet-lime.css +202 -148
- package/dist/themes/violet-lime.js +27 -3
- package/dist/utils/design-tokens.js +29 -2
- package/dist/utils/storage-abstraction.js +1 -1
- package/package.json +11 -28
- package/dist/components/Switch/SwitchButton.svelte +0 -134
- package/dist/components/Switch/SwitchButton.svelte.d.ts +0 -21
|
@@ -1,8 +1,90 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
TABBED MENU COMPONENT TOKENS
|
|
3
|
+
Override globally: :root { --stuic-tabbed-menu-radius: 0; }
|
|
4
|
+
Override locally: <TabbedMenu style="--stuic-tabbed-menu-radius: 9999px;">
|
|
5
|
+
============================================================================ */
|
|
6
|
+
|
|
2
7
|
:root {
|
|
8
|
+
/* Color tokens */
|
|
3
9
|
--stuic-tabbed-menu-tab-bg: var(--stuic-color-muted);
|
|
4
10
|
--stuic-tabbed-menu-tab-text: var(--stuic-color-muted-foreground);
|
|
5
|
-
--stuic-tabbed-menu-tab-bg-active: var(--stuic-color-
|
|
6
|
-
--stuic-tabbed-menu-tab-text-active: var(--stuic-color-foreground);
|
|
11
|
+
--stuic-tabbed-menu-tab-bg-active: var(--stuic-color-primary);
|
|
12
|
+
--stuic-tabbed-menu-tab-text-active: var(--stuic-color-primary-foreground);
|
|
7
13
|
--stuic-tabbed-menu-border: var(--stuic-color-border);
|
|
14
|
+
--stuic-tabbed-menu-border-active: var(--stuic-color-primary);
|
|
15
|
+
|
|
16
|
+
/* Layout tokens */
|
|
17
|
+
--stuic-tabbed-menu-gap: calc(var(--spacing) * 1);
|
|
18
|
+
--stuic-tabbed-menu-radius: var(--radius-md);
|
|
19
|
+
--stuic-tabbed-menu-padding-x: calc(var(--spacing) * 4);
|
|
20
|
+
--stuic-tabbed-menu-padding-y: calc(var(--spacing) * 2);
|
|
21
|
+
--stuic-tabbed-menu-transition: 150ms;
|
|
22
|
+
--stuic-tabbed-menu-font-weight-active: var(--font-weight-medium);
|
|
23
|
+
--stuic-tabbed-menu-item-max-width: 10rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@layer components {
|
|
27
|
+
/* ============================================================================
|
|
28
|
+
BASE STYLES
|
|
29
|
+
============================================================================ */
|
|
30
|
+
|
|
31
|
+
.stuic-tabbed-menu {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: row;
|
|
34
|
+
gap: var(--stuic-tabbed-menu-gap);
|
|
35
|
+
list-style: none;
|
|
36
|
+
margin: 0;
|
|
37
|
+
padding: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.stuic-tabbed-menu-item {
|
|
41
|
+
min-width: 0;
|
|
42
|
+
flex: 1;
|
|
43
|
+
max-width: var(--stuic-tabbed-menu-item-max-width);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.stuic-tabbed-menu-tab {
|
|
47
|
+
display: block;
|
|
48
|
+
width: 100%;
|
|
49
|
+
padding: var(--stuic-tabbed-menu-padding-y) var(--stuic-tabbed-menu-padding-x);
|
|
50
|
+
border-radius: var(--stuic-tabbed-menu-radius) var(--stuic-tabbed-menu-radius) 0 0;
|
|
51
|
+
border: 1px solid var(--stuic-tabbed-menu-border);
|
|
52
|
+
border-bottom: 0;
|
|
53
|
+
background: var(--stuic-tabbed-menu-tab-bg);
|
|
54
|
+
color: var(--stuic-tabbed-menu-tab-text);
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
transition:
|
|
57
|
+
background var(--stuic-tabbed-menu-transition),
|
|
58
|
+
color var(--stuic-tabbed-menu-transition),
|
|
59
|
+
filter var(--stuic-tabbed-menu-transition);
|
|
60
|
+
text-align: center;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
text-overflow: ellipsis;
|
|
63
|
+
white-space: nowrap;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.stuic-tabbed-menu-tab:hover:not([aria-disabled="true"]) {
|
|
67
|
+
filter: brightness(1.05);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* Active tab state */
|
|
71
|
+
.stuic-tabbed-menu-tab[aria-selected="true"] {
|
|
72
|
+
background: var(--stuic-tabbed-menu-tab-bg-active);
|
|
73
|
+
color: var(--stuic-tabbed-menu-tab-text-active);
|
|
74
|
+
font-weight: var(--stuic-tabbed-menu-font-weight-active);
|
|
75
|
+
border-color: var(--stuic-tabbed-menu-border-active);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Disabled tab state */
|
|
79
|
+
.stuic-tabbed-menu-tab[aria-disabled="true"] {
|
|
80
|
+
opacity: 0.5;
|
|
81
|
+
cursor: not-allowed;
|
|
82
|
+
pointer-events: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* Focus styles */
|
|
86
|
+
.stuic-tabbed-menu-tab:focus-visible {
|
|
87
|
+
outline: 2px solid var(--stuic-color-ring);
|
|
88
|
+
outline-offset: 2px;
|
|
89
|
+
}
|
|
8
90
|
}
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
footer?: Snippet;
|
|
24
24
|
/** Optional AlertConfirmPromptStack*/
|
|
25
25
|
acp?: AlertConfirmPromptStack;
|
|
26
|
+
/** Optional NotificationsStack*/
|
|
27
|
+
notifications?: NotificationsStack;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
/** Intent colors to demonstrate */
|
|
@@ -40,15 +42,19 @@
|
|
|
40
42
|
</script>
|
|
41
43
|
|
|
42
44
|
<script lang="ts">
|
|
43
|
-
import "./index.css";
|
|
44
45
|
import { twMerge } from "../../utils/tw-merge.js";
|
|
45
46
|
import Button from "../Button/Button.svelte";
|
|
47
|
+
import Switch from "../Switch/Switch.svelte";
|
|
46
48
|
import { AlertConfirmPromptStack } from "../AlertConfirmPrompt/index.js";
|
|
47
49
|
import {
|
|
48
50
|
type DismissibleMessageIntent,
|
|
49
51
|
DismissibleMessage,
|
|
50
52
|
} from "../DismissibleMessage/index.js";
|
|
51
53
|
import { createClog } from "@marianmeres/clog";
|
|
54
|
+
import Nav, { type NavGroup } from "../Nav/Nav.svelte";
|
|
55
|
+
import type { NotificationsStack } from "../Notifications/notifications-stack.svelte.js";
|
|
56
|
+
import FieldInput from "../Input/FieldInput.svelte";
|
|
57
|
+
import FieldCheckbox from "../Input/FieldCheckbox.svelte";
|
|
52
58
|
|
|
53
59
|
const clog = createClog("ThemePreview", { color: "auto" });
|
|
54
60
|
|
|
@@ -63,12 +69,38 @@
|
|
|
63
69
|
sidebar,
|
|
64
70
|
footer,
|
|
65
71
|
acp,
|
|
72
|
+
notifications,
|
|
66
73
|
...rest
|
|
67
74
|
}: Props = $props();
|
|
68
75
|
|
|
69
76
|
let spacing = $derived(compact ? "gap-2 p-2" : "gap-4 p-4");
|
|
70
77
|
|
|
71
|
-
const alert = () =>
|
|
78
|
+
const alert = (intent?: string) => {
|
|
79
|
+
acp?.alert(intent);
|
|
80
|
+
notif(intent);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const notif = (intent?: string) => {
|
|
84
|
+
if (intent && notifications) {
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
86
|
+
(notifications as any)[intent]?.(intent);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// Navigation groups for sidebar
|
|
91
|
+
let activeNavId = $state("dashboard");
|
|
92
|
+
const navGroups: NavGroup[] = [
|
|
93
|
+
{
|
|
94
|
+
title: "Navigation",
|
|
95
|
+
id: "navigation",
|
|
96
|
+
items: [
|
|
97
|
+
{ id: "dashboard", label: "Dashboard" },
|
|
98
|
+
{ id: "settings", label: "Settings" },
|
|
99
|
+
{ id: "profile", label: "Profile" },
|
|
100
|
+
{ id: "archived", label: "Archived", disabled: true },
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
];
|
|
72
104
|
|
|
73
105
|
//
|
|
74
106
|
let dismissibleMessage = $state<string | null>();
|
|
@@ -95,17 +127,11 @@
|
|
|
95
127
|
{#if sidebar}
|
|
96
128
|
{@render sidebar()}
|
|
97
129
|
{:else}
|
|
98
|
-
<
|
|
99
|
-
{
|
|
100
|
-
|
|
101
|
-
{
|
|
102
|
-
|
|
103
|
-
<li class="nav-item active">Dashboard</li>
|
|
104
|
-
<li class="nav-item">Settings</li>
|
|
105
|
-
<li class="nav-item">Profile</li>
|
|
106
|
-
<li class="nav-item muted">Archived</li>
|
|
107
|
-
</ul>
|
|
108
|
-
</nav>
|
|
130
|
+
<Nav
|
|
131
|
+
groups={navGroups}
|
|
132
|
+
activeId={activeNavId}
|
|
133
|
+
onSelect={(item) => (activeNavId = item.id)}
|
|
134
|
+
/>
|
|
109
135
|
<div class="sidebar-footer">
|
|
110
136
|
<span class="muted-text">v1.0.0</span>
|
|
111
137
|
</div>
|
|
@@ -144,8 +170,9 @@
|
|
|
144
170
|
if (!["primary", "accent"].includes(intent)) {
|
|
145
171
|
dismissibleIntent = intent as DismissibleMessageIntent;
|
|
146
172
|
dismissibleMessage = intent;
|
|
173
|
+
notif(intent);
|
|
147
174
|
} else {
|
|
148
|
-
alert();
|
|
175
|
+
alert(intent);
|
|
149
176
|
}
|
|
150
177
|
}}
|
|
151
178
|
>
|
|
@@ -153,7 +180,7 @@
|
|
|
153
180
|
</Button>
|
|
154
181
|
{/each}
|
|
155
182
|
{:else}
|
|
156
|
-
<Button {intent} onclick={alert}>
|
|
183
|
+
<Button {intent} onclick={() => alert(intent)}>
|
|
157
184
|
{intent}
|
|
158
185
|
</Button>
|
|
159
186
|
{/if}
|
|
@@ -193,6 +220,16 @@
|
|
|
193
220
|
<span class="surface-foreground-text">surface-foreground</span>
|
|
194
221
|
</div>
|
|
195
222
|
|
|
223
|
+
<div class="color-swatch surface-1">
|
|
224
|
+
<span class="swatch-label">surface-1</span>
|
|
225
|
+
<span class="surface-1-foreground-text">surface-1-foreground</span>
|
|
226
|
+
</div>
|
|
227
|
+
|
|
228
|
+
<div class="color-swatch surface-2">
|
|
229
|
+
<span class="swatch-label">surface-2</span>
|
|
230
|
+
<span class="surface-2-foreground-text">surface-2-foreground</span>
|
|
231
|
+
</div>
|
|
232
|
+
|
|
196
233
|
<div class="color-swatch muted-bg">
|
|
197
234
|
<span class="swatch-label">muted</span>
|
|
198
235
|
<span class="muted-foreground-text">muted-foreground</span>
|
|
@@ -220,22 +257,38 @@
|
|
|
220
257
|
<h2 class="section-label">Inputs</h2>
|
|
221
258
|
{/if}
|
|
222
259
|
|
|
223
|
-
<div class="input-examples">
|
|
224
|
-
<div class="input-wrapper">
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
260
|
+
<div class="input-examples flex items-center">
|
|
261
|
+
<!-- <div class="input-wrapper"> -->
|
|
262
|
+
<!-- <input type="text" class="preview-input" placeholder="Text input..." /> -->
|
|
263
|
+
<FieldInput class="m-0" />
|
|
264
|
+
<!-- </div> -->
|
|
265
|
+
<!-- <div class="input-wrapper"> -->
|
|
266
|
+
<FieldCheckbox label="Hey ho" class="m-0" />
|
|
267
|
+
<!-- <input
|
|
229
268
|
type="text"
|
|
230
269
|
class="preview-input focus"
|
|
231
270
|
value="Focused state"
|
|
232
271
|
readonly
|
|
233
|
-
/>
|
|
234
|
-
</div>
|
|
272
|
+
/> -->
|
|
273
|
+
<!-- </div> -->
|
|
235
274
|
</div>
|
|
236
275
|
</section>
|
|
237
276
|
{/if}
|
|
238
277
|
|
|
278
|
+
<!-- SWITCHES -->
|
|
279
|
+
<section class="preview-section">
|
|
280
|
+
{#if showLabels}
|
|
281
|
+
<h2 class="section-label">Switches</h2>
|
|
282
|
+
{/if}
|
|
283
|
+
|
|
284
|
+
<div class="flex flex-wrap items-center gap-4">
|
|
285
|
+
<Switch checked />
|
|
286
|
+
{#each INTENT_COLORS as intent}
|
|
287
|
+
<Switch {intent} checked />
|
|
288
|
+
{/each}
|
|
289
|
+
</div>
|
|
290
|
+
</section>
|
|
291
|
+
|
|
239
292
|
<!-- HIGHLIGHT BOXES -->
|
|
240
293
|
<section class="preview-section">
|
|
241
294
|
{#if showLabels}
|
|
@@ -21,13 +21,15 @@ export interface Props extends Omit<HTMLAttributes<HTMLDivElement>, "children">
|
|
|
21
21
|
footer?: Snippet;
|
|
22
22
|
/** Optional AlertConfirmPromptStack*/
|
|
23
23
|
acp?: AlertConfirmPromptStack;
|
|
24
|
+
/** Optional NotificationsStack*/
|
|
25
|
+
notifications?: NotificationsStack;
|
|
24
26
|
}
|
|
25
27
|
/** Intent colors to demonstrate */
|
|
26
28
|
export declare const INTENT_COLORS: readonly ["primary", "accent", "destructive", "warning", "success", "info"];
|
|
27
29
|
/** Button variants to demonstrate */
|
|
28
30
|
export declare const BUTTON_VARIANTS: readonly ["solid", "outline", "ghost", "soft", "link"];
|
|
29
|
-
import "./index.css";
|
|
30
31
|
import { AlertConfirmPromptStack } from "../AlertConfirmPrompt/index.js";
|
|
32
|
+
import type { NotificationsStack } from "../Notifications/notifications-stack.svelte.js";
|
|
31
33
|
declare const ThemePreview: import("svelte").Component<Props, {}, "el">;
|
|
32
34
|
type ThemePreview = ReturnType<typeof ThemePreview>;
|
|
33
35
|
export default ThemePreview;
|
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
.stuic-theme-preview .color-swatch {
|
|
236
236
|
padding: 1rem;
|
|
237
237
|
border-radius: var(--stuic-theme-preview-radius);
|
|
238
|
-
border: 1px solid var(--stuic-color-border);
|
|
238
|
+
/* border: 1px solid var(--stuic-color-border); */
|
|
239
239
|
display: flex;
|
|
240
240
|
flex-direction: column;
|
|
241
241
|
gap: 0.5rem;
|
|
@@ -256,6 +256,14 @@
|
|
|
256
256
|
background: var(--stuic-color-surface);
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
+
.stuic-theme-preview .color-swatch.surface-1 {
|
|
260
|
+
background: var(--stuic-color-surface-1);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.stuic-theme-preview .color-swatch.surface-2 {
|
|
264
|
+
background: var(--stuic-color-surface-2);
|
|
265
|
+
}
|
|
266
|
+
|
|
259
267
|
.stuic-theme-preview .color-swatch.muted-bg {
|
|
260
268
|
background: var(--stuic-color-muted);
|
|
261
269
|
}
|
|
@@ -269,6 +277,14 @@
|
|
|
269
277
|
color: var(--stuic-color-surface-foreground);
|
|
270
278
|
}
|
|
271
279
|
|
|
280
|
+
.stuic-theme-preview .surface-1-foreground-text {
|
|
281
|
+
color: var(--stuic-color-surface-1-foreground);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.stuic-theme-preview .surface-2-foreground-text {
|
|
285
|
+
color: var(--stuic-color-surface-2-foreground);
|
|
286
|
+
}
|
|
287
|
+
|
|
272
288
|
.stuic-theme-preview .muted-foreground-text {
|
|
273
289
|
color: var(--stuic-color-muted-foreground);
|
|
274
290
|
}
|
|
@@ -1,43 +1,62 @@
|
|
|
1
1
|
# TwCheck
|
|
2
2
|
|
|
3
|
-
A development utility component to verify that Tailwind CSS is properly loaded and working. Displays
|
|
3
|
+
A development utility component to verify that Tailwind CSS is properly loaded and working. Displays different styles at different breakpoints.
|
|
4
4
|
|
|
5
5
|
## Props
|
|
6
6
|
|
|
7
7
|
| Prop | Type | Default | Description |
|
|
8
8
|
|------|------|---------|-------------|
|
|
9
|
-
| `theme` | `string` | - | Tailwind color
|
|
9
|
+
| `theme` | `string` | - | Tailwind color palette name (e.g., "blue", "amber") |
|
|
10
10
|
| `class` | `string` | - | Additional CSS classes |
|
|
11
11
|
|
|
12
|
+
## Component Tokens
|
|
13
|
+
|
|
14
|
+
Override to customize appearance:
|
|
15
|
+
|
|
16
|
+
```css
|
|
17
|
+
:root {
|
|
18
|
+
--stuic-twcheck-bg: var(--stuic-color-primary);
|
|
19
|
+
--stuic-twcheck-text: var(--stuic-color-primary-foreground);
|
|
20
|
+
--stuic-twcheck-border-color: var(--stuic-color-accent);
|
|
21
|
+
--stuic-twcheck-padding-x: calc(var(--spacing) * 2);
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
12
25
|
## Usage
|
|
13
26
|
|
|
14
27
|
### Basic Check
|
|
15
28
|
|
|
16
29
|
```svelte
|
|
17
30
|
<script lang="ts">
|
|
18
|
-
import { TwCheck } from 'stuic';
|
|
31
|
+
import { TwCheck } from '@marianmeres/stuic';
|
|
19
32
|
</script>
|
|
20
33
|
|
|
21
|
-
<TwCheck>
|
|
22
|
-
TW Check
|
|
23
|
-
</TwCheck>
|
|
34
|
+
<TwCheck>TW Check</TwCheck>
|
|
24
35
|
```
|
|
25
36
|
|
|
26
|
-
###
|
|
37
|
+
### Customization Strategies
|
|
27
38
|
|
|
28
39
|
```svelte
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
40
|
+
<!-- 1. Default styles (uses theme tokens) -->
|
|
41
|
+
<TwCheck>default</TwCheck>
|
|
42
|
+
|
|
43
|
+
<!-- 2. Tailwind class override -->
|
|
44
|
+
<TwCheck class="bg-green-600 text-white">green</TwCheck>
|
|
45
|
+
|
|
46
|
+
<!-- 3. CSS variable override -->
|
|
47
|
+
<TwCheck --stuic-twcheck-bg="var(--color-blue-600)">blue</TwCheck>
|
|
48
|
+
|
|
49
|
+
<!-- 4. Theme prop shorthand -->
|
|
50
|
+
<TwCheck theme="amber">amber</TwCheck>
|
|
32
51
|
```
|
|
33
52
|
|
|
34
53
|
## Visual Indicators
|
|
35
54
|
|
|
36
55
|
When Tailwind CSS is properly loaded:
|
|
37
|
-
- **Mobile**:
|
|
38
|
-
- **Desktop (sm+)**:
|
|
56
|
+
- **Mobile**: Smaller text (text-base), no border
|
|
57
|
+
- **Desktop (sm+)**: Larger text (text-2xl), visible border
|
|
39
58
|
|
|
40
|
-
If the component appears unstyled (
|
|
59
|
+
If the component appears unstyled (no size change, no border at wider viewports), Tailwind CSS is not loading correctly.
|
|
41
60
|
|
|
42
61
|
## Development Use
|
|
43
62
|
|
|
@@ -9,24 +9,26 @@
|
|
|
9
9
|
</script>
|
|
10
10
|
|
|
11
11
|
<script lang="ts">
|
|
12
|
-
import "
|
|
13
|
-
import { twMerge } from "tailwind-merge";
|
|
12
|
+
import { twMerge } from "../../utils/index.js";
|
|
14
13
|
|
|
15
14
|
let { class: classProp, children, theme }: Props = $props();
|
|
16
15
|
|
|
16
|
+
// Responsive classes demonstrate Tailwind is working:
|
|
17
|
+
// - Font size changes: text-base -> sm:text-2xl
|
|
18
|
+
// Note: border styles are in component CSS to avoid Vite HMR timing issues
|
|
17
19
|
const _default = `
|
|
18
|
-
stuic-twcheck
|
|
19
|
-
inline-block
|
|
20
|
-
text-yellow-300 sm:text-white
|
|
20
|
+
stuic-twcheck
|
|
21
|
+
inline-block
|
|
21
22
|
text-base sm:text-2xl
|
|
22
23
|
sm:border-2 border-teal-400
|
|
23
24
|
`;
|
|
24
25
|
|
|
25
26
|
const _buildTheme = (theme?: string) => {
|
|
26
|
-
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
:
|
|
27
|
+
if (!theme) return "";
|
|
28
|
+
return [
|
|
29
|
+
`--stuic-twcheck-bg: var(--color-${theme}-600)`,
|
|
30
|
+
`--stuic-twcheck-text: var(--color-${theme}-100, var(--color-white))`,
|
|
31
|
+
].join(";");
|
|
30
32
|
};
|
|
31
33
|
</script>
|
|
32
34
|
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
/* TwCheck component tokens */
|
|
2
2
|
:root {
|
|
3
3
|
--stuic-twcheck-bg: var(--stuic-color-primary);
|
|
4
|
+
--stuic-twcheck-text: var(--stuic-color-primary-foreground);
|
|
5
|
+
--stuic-twcheck-border-color: var(--stuic-color-accent);
|
|
6
|
+
--stuic-twcheck-padding-x: calc(var(--spacing) * 2);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* @layer components ensures Tailwind utilities (@layer utilities) win in the cascade */
|
|
10
|
+
@layer components {
|
|
11
|
+
.stuic-twcheck {
|
|
12
|
+
background: var(--stuic-twcheck-bg);
|
|
13
|
+
color: var(--stuic-twcheck-text);
|
|
14
|
+
border-color: var(--stuic-twcheck-border-color);
|
|
15
|
+
padding-left: var(--stuic-twcheck-padding-x);
|
|
16
|
+
padding-right: var(--stuic-twcheck-padding-x);
|
|
17
|
+
}
|
|
4
18
|
}
|