@marianmeres/stuic 3.0.0 → 3.0.2
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 -2
- package/dist/components/DismissibleMessage/DismissibleMessage.svelte.d.ts +0 -1
- package/dist/components/DismissibleMessage/index.css +116 -110
- package/dist/components/DropdownMenu/DropdownMenu.svelte +317 -74
- package/dist/components/DropdownMenu/DropdownMenu.svelte.d.ts +19 -1
- package/dist/components/DropdownMenu/index.css +236 -170
- package/dist/components/DropdownMenu/index.d.ts +1 -1
- package/dist/components/HoverExpandableWidth/HoverExpandableWidth.svelte +3 -1
- package/dist/components/HoverExpandableWidth/HoverExpandableWidth.svelte.d.ts +1 -0
- 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 +86 -33
- package/dist/components/ThemePreview/ThemePreview.svelte.d.ts +3 -1
- package/dist/components/ThemePreview/index.css +24 -8
- 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/icons/index.d.ts +1 -0
- package/dist/icons/index.js +1 -0
- 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 +246 -156
- package/dist/themes/blue-orange.js +24 -0
- package/dist/themes/cyan-red.css +246 -156
- package/dist/themes/cyan-red.js +24 -0
- package/dist/themes/cyan-slate.css +246 -156
- package/dist/themes/cyan-slate.js +25 -1
- package/dist/themes/emerald-pink.css +246 -156
- package/dist/themes/emerald-pink.js +25 -1
- package/dist/themes/fuchsia-emerald.css +246 -156
- package/dist/themes/fuchsia-emerald.js +25 -1
- package/dist/themes/gray.css +246 -156
- package/dist/themes/gray.js +24 -0
- package/dist/themes/indigo-amber.css +246 -156
- package/dist/themes/indigo-amber.js +26 -2
- package/dist/themes/neutral.css +246 -156
- package/dist/themes/neutral.js +24 -0
- package/dist/themes/pink-emerald.css +246 -156
- package/dist/themes/pink-emerald.js +25 -1
- package/dist/themes/pink-teal.css +253 -0
- package/dist/themes/pink-teal.d.ts +6 -0
- package/dist/themes/pink-teal.js +175 -0
- package/dist/themes/purple-yellow.css +246 -156
- package/dist/themes/purple-yellow.js +24 -0
- package/dist/themes/rainbow.css +246 -156
- package/dist/themes/rainbow.js +25 -1
- package/dist/themes/red-blue.css +246 -156
- package/dist/themes/red-blue.js +24 -0
- package/dist/themes/red-cyan.css +246 -156
- package/dist/themes/red-cyan.js +24 -0
- package/dist/themes/red-sky.css +253 -0
- package/dist/themes/red-sky.d.ts +6 -0
- package/dist/themes/red-sky.js +175 -0
- package/dist/themes/rose-teal.css +246 -156
- package/dist/themes/rose-teal.js +24 -0
- package/dist/themes/sky-amber.css +246 -156
- package/dist/themes/sky-amber.js +26 -2
- package/dist/themes/slate-cyan.css +246 -156
- package/dist/themes/slate-cyan.js +25 -1
- package/dist/themes/teal-rose.css +246 -156
- package/dist/themes/teal-rose.js +24 -0
- package/dist/themes/violet-lime.css +246 -156
- package/dist/themes/violet-lime.js +27 -3
- package/dist/utils/design-tokens.d.ts +1 -1
- package/dist/utils/design-tokens.js +44 -3
- 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}
|
|
@@ -176,6 +203,23 @@
|
|
|
176
203
|
</div>
|
|
177
204
|
</section>
|
|
178
205
|
|
|
206
|
+
<!-- HIGHLIGHT BOXES -->
|
|
207
|
+
<section class="preview-section">
|
|
208
|
+
{#if showLabels}
|
|
209
|
+
<h2 class="section-label">Highlighted Content</h2>
|
|
210
|
+
{/if}
|
|
211
|
+
|
|
212
|
+
<div class="highlight-box primary">
|
|
213
|
+
<strong>Primary Highlight</strong>
|
|
214
|
+
<p>This box uses primary intent colors for important content.</p>
|
|
215
|
+
</div>
|
|
216
|
+
|
|
217
|
+
<div class="highlight-box accent">
|
|
218
|
+
<strong>Accent Highlight</strong>
|
|
219
|
+
<p>This box uses accent colors to draw attention.</p>
|
|
220
|
+
</div>
|
|
221
|
+
</section>
|
|
222
|
+
|
|
179
223
|
<!-- ROLE COLORS -->
|
|
180
224
|
<section class="preview-section">
|
|
181
225
|
{#if showLabels}
|
|
@@ -193,6 +237,16 @@
|
|
|
193
237
|
<span class="surface-foreground-text">surface-foreground</span>
|
|
194
238
|
</div>
|
|
195
239
|
|
|
240
|
+
<div class="color-swatch surface-1">
|
|
241
|
+
<span class="swatch-label">surface-1</span>
|
|
242
|
+
<span class="surface-1-foreground-text">surface-1-foreground</span>
|
|
243
|
+
</div>
|
|
244
|
+
|
|
245
|
+
<div class="color-swatch surface-2">
|
|
246
|
+
<span class="swatch-label">surface-2</span>
|
|
247
|
+
<span class="surface-2-foreground-text">surface-2-foreground</span>
|
|
248
|
+
</div>
|
|
249
|
+
|
|
196
250
|
<div class="color-swatch muted-bg">
|
|
197
251
|
<span class="swatch-label">muted</span>
|
|
198
252
|
<span class="muted-foreground-text">muted-foreground</span>
|
|
@@ -220,36 +274,35 @@
|
|
|
220
274
|
<h2 class="section-label">Inputs</h2>
|
|
221
275
|
{/if}
|
|
222
276
|
|
|
223
|
-
<div class="input-examples">
|
|
224
|
-
<div class="input-wrapper">
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
277
|
+
<div class="input-examples flex items-center">
|
|
278
|
+
<!-- <div class="input-wrapper"> -->
|
|
279
|
+
<!-- <input type="text" class="preview-input" placeholder="Text input..." /> -->
|
|
280
|
+
<FieldInput class="m-0" />
|
|
281
|
+
<!-- </div> -->
|
|
282
|
+
<!-- <div class="input-wrapper"> -->
|
|
283
|
+
<FieldCheckbox label="Hey ho" class="m-0" />
|
|
284
|
+
<!-- <input
|
|
229
285
|
type="text"
|
|
230
286
|
class="preview-input focus"
|
|
231
287
|
value="Focused state"
|
|
232
288
|
readonly
|
|
233
|
-
/>
|
|
234
|
-
</div>
|
|
289
|
+
/> -->
|
|
290
|
+
<!-- </div> -->
|
|
235
291
|
</div>
|
|
236
292
|
</section>
|
|
237
293
|
{/if}
|
|
238
294
|
|
|
239
|
-
<!--
|
|
295
|
+
<!-- SWITCHES -->
|
|
240
296
|
<section class="preview-section">
|
|
241
297
|
{#if showLabels}
|
|
242
|
-
<h2 class="section-label">
|
|
298
|
+
<h2 class="section-label">Switches</h2>
|
|
243
299
|
{/if}
|
|
244
300
|
|
|
245
|
-
<div class="
|
|
246
|
-
<
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
<div class="highlight-box accent">
|
|
251
|
-
<strong>Accent Highlight</strong>
|
|
252
|
-
<p>This box uses accent colors to draw attention.</p>
|
|
301
|
+
<div class="flex flex-wrap items-center gap-4">
|
|
302
|
+
<Switch checked />
|
|
303
|
+
{#each INTENT_COLORS as intent}
|
|
304
|
+
<Switch {intent} checked />
|
|
305
|
+
{/each}
|
|
253
306
|
</div>
|
|
254
307
|
</section>
|
|
255
308
|
|
|
@@ -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
|
}
|
|
@@ -386,17 +402,17 @@
|
|
|
386
402
|
opacity: 0.9;
|
|
387
403
|
}
|
|
388
404
|
|
|
389
|
-
/* Using
|
|
405
|
+
/* Using surface-intent tokens for content boxes */
|
|
390
406
|
.stuic-theme-preview .highlight-box.primary {
|
|
391
|
-
background:
|
|
392
|
-
color: var(--stuic-color-primary);
|
|
393
|
-
border: 1px solid
|
|
407
|
+
background: var(--stuic-color-surface-primary);
|
|
408
|
+
color: var(--stuic-color-surface-primary-foreground);
|
|
409
|
+
border: 1px solid var(--stuic-color-surface-primary-border);
|
|
394
410
|
}
|
|
395
411
|
|
|
396
412
|
.stuic-theme-preview .highlight-box.accent {
|
|
397
|
-
background:
|
|
398
|
-
color: var(--stuic-color-accent);
|
|
399
|
-
border: 1px solid
|
|
413
|
+
background: var(--stuic-color-surface-accent);
|
|
414
|
+
color: var(--stuic-color-surface-accent-foreground);
|
|
415
|
+
border: 1px solid var(--stuic-color-surface-accent-border);
|
|
400
416
|
}
|
|
401
417
|
|
|
402
418
|
/* ============================================================================
|
|
@@ -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
|
}
|