@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.
Files changed (144) hide show
  1. package/dist/actions/index.d.ts +1 -0
  2. package/dist/actions/index.js +1 -0
  3. package/dist/actions/typeahead.svelte.d.ts +53 -0
  4. package/dist/actions/typeahead.svelte.js +328 -0
  5. package/dist/base.css +17 -0
  6. package/dist/components/AlertConfirmPrompt/AlertConfirmPrompt.svelte +4 -3
  7. package/dist/components/AlertConfirmPrompt/AlertConfirmPrompt.svelte.d.ts +4 -3
  8. package/dist/components/AlertConfirmPrompt/Current.svelte +1 -2
  9. package/dist/components/AlertConfirmPrompt/Current.svelte.d.ts +0 -1
  10. package/dist/components/AlertConfirmPrompt/index.css +47 -43
  11. package/dist/components/AssetsPreview/AssetsPreview.svelte +0 -1
  12. package/dist/components/AssetsPreview/AssetsPreview.svelte.d.ts +0 -1
  13. package/dist/components/AssetsPreview/index.css +31 -29
  14. package/dist/components/Avatar/Avatar.svelte +0 -1
  15. package/dist/components/Avatar/Avatar.svelte.d.ts +0 -1
  16. package/dist/components/Avatar/index.css +87 -85
  17. package/dist/components/Backdrop/Backdrop.svelte +0 -1
  18. package/dist/components/Backdrop/Backdrop.svelte.d.ts +0 -1
  19. package/dist/components/Backdrop/index.css +15 -13
  20. package/dist/components/Button/Button.svelte +0 -1
  21. package/dist/components/Button/Button.svelte.d.ts +0 -1
  22. package/dist/components/Button/index.css +431 -429
  23. package/dist/components/ButtonGroupRadio/ButtonGroupRadio.svelte +0 -1
  24. package/dist/components/ButtonGroupRadio/ButtonGroupRadio.svelte.d.ts +0 -1
  25. package/dist/components/ButtonGroupRadio/index.css +123 -117
  26. package/dist/components/Collapsible/index.css +17 -15
  27. package/dist/components/CommandMenu/CommandMenu.svelte +7 -4
  28. package/dist/components/CommandMenu/CommandMenu.svelte.d.ts +0 -1
  29. package/dist/components/CommandMenu/index.css +27 -25
  30. package/dist/components/DismissibleMessage/DismissibleMessage.svelte +0 -1
  31. package/dist/components/DismissibleMessage/DismissibleMessage.svelte.d.ts +0 -1
  32. package/dist/components/DismissibleMessage/index.css +116 -110
  33. package/dist/components/DropdownMenu/DropdownMenu.svelte +0 -1
  34. package/dist/components/DropdownMenu/DropdownMenu.svelte.d.ts +0 -1
  35. package/dist/components/DropdownMenu/index.css +179 -177
  36. package/dist/components/Input/FieldInput.svelte +8 -0
  37. package/dist/components/Input/FieldInput.svelte.d.ts +2 -0
  38. package/dist/components/Input/FieldOptions.svelte +1 -1
  39. package/dist/components/Input/index.css +411 -398
  40. package/dist/components/KbdShortcut/KbdShortcut.svelte +4 -12
  41. package/dist/components/KbdShortcut/README.md +34 -0
  42. package/dist/components/KbdShortcut/index.css +55 -0
  43. package/dist/components/ListItemButton/ListItemButton.svelte +0 -1
  44. package/dist/components/ListItemButton/ListItemButton.svelte.d.ts +0 -1
  45. package/dist/components/ListItemButton/index.css +118 -116
  46. package/dist/components/Modal/Modal.svelte +0 -1
  47. package/dist/components/Modal/Modal.svelte.d.ts +0 -1
  48. package/dist/components/Modal/index.css +18 -16
  49. package/dist/components/ModalDialog/index.css +29 -27
  50. package/dist/components/Nav/Nav.svelte +732 -0
  51. package/dist/components/Nav/Nav.svelte.d.ts +110 -0
  52. package/dist/components/Nav/README.md +334 -0
  53. package/dist/components/Nav/index.css +318 -0
  54. package/dist/components/Nav/index.d.ts +1 -0
  55. package/dist/components/Nav/index.js +1 -0
  56. package/dist/components/Notifications/Notifications.svelte +2 -3
  57. package/dist/components/Notifications/Notifications.svelte.d.ts +0 -1
  58. package/dist/components/Notifications/index.css +158 -158
  59. package/dist/components/Notifications/notifications-stack.svelte.d.ts +4 -0
  60. package/dist/components/Notifications/notifications-stack.svelte.js +8 -0
  61. package/dist/components/Progress/Progress.svelte +4 -2
  62. package/dist/components/Progress/Progress.svelte.d.ts +1 -0
  63. package/dist/components/Progress/README.md +86 -15
  64. package/dist/components/Progress/_internal/Bar.svelte +4 -15
  65. package/dist/components/Progress/_internal/Bar.svelte.d.ts +1 -1
  66. package/dist/components/Progress/_internal/Circle.svelte +30 -2
  67. package/dist/components/Progress/_internal/Circle.svelte.d.ts +1 -0
  68. package/dist/components/Progress/index.css +47 -1
  69. package/dist/components/Skeleton/README.md +152 -0
  70. package/dist/components/Skeleton/Skeleton.svelte +6 -7
  71. package/dist/components/Skeleton/Skeleton.svelte.d.ts +0 -1
  72. package/dist/components/Skeleton/index.css +73 -43
  73. package/dist/components/Spinner/README.md +149 -37
  74. package/dist/components/Spinner/Spinner.svelte +14 -38
  75. package/dist/components/Spinner/Spinner.svelte.d.ts +2 -1
  76. package/dist/components/Spinner/SpinnerCircle.svelte +6 -34
  77. package/dist/components/Spinner/SpinnerCircle.svelte.d.ts +1 -0
  78. package/dist/components/Spinner/SpinnerCircleOscillate.svelte +10 -5
  79. package/dist/components/Spinner/SpinnerUnicode.svelte +3 -1
  80. package/dist/components/Spinner/SpinnerUnicode.svelte.d.ts +1 -0
  81. package/dist/components/Spinner/index.css +104 -0
  82. package/dist/components/Switch/README.md +34 -18
  83. package/dist/components/Switch/Switch.svelte +24 -46
  84. package/dist/components/Switch/Switch.svelte.d.ts +4 -2
  85. package/dist/components/Switch/index.css +120 -2
  86. package/dist/components/Switch/index.d.ts +1 -2
  87. package/dist/components/Switch/index.js +1 -2
  88. package/dist/components/TabbedMenu/README.md +28 -17
  89. package/dist/components/TabbedMenu/TabbedMenu.svelte +5 -46
  90. package/dist/components/TabbedMenu/TabbedMenu.svelte.d.ts +0 -1
  91. package/dist/components/TabbedMenu/index.css +85 -3
  92. package/dist/components/ThemePreview/ThemePreview.svelte +76 -23
  93. package/dist/components/ThemePreview/ThemePreview.svelte.d.ts +3 -1
  94. package/dist/components/ThemePreview/index.css +17 -1
  95. package/dist/components/TwCheck/README.md +32 -13
  96. package/dist/components/TwCheck/TwCheck.svelte +11 -9
  97. package/dist/components/TwCheck/TwCheck.svelte.d.ts +0 -1
  98. package/dist/components/TwCheck/index.css +14 -0
  99. package/dist/components/TypeaheadInput/TypeaheadInput.svelte +19 -187
  100. package/dist/components/TypeaheadInput/TypeaheadInput.svelte.d.ts +4 -2
  101. package/dist/index.css +44 -39
  102. package/dist/index.d.ts +1 -0
  103. package/dist/index.js +1 -0
  104. package/dist/themes/blue-orange.css +202 -148
  105. package/dist/themes/blue-orange.js +24 -0
  106. package/dist/themes/cyan-red.css +202 -148
  107. package/dist/themes/cyan-red.js +24 -0
  108. package/dist/themes/cyan-slate.css +202 -148
  109. package/dist/themes/cyan-slate.js +25 -1
  110. package/dist/themes/emerald-pink.css +202 -148
  111. package/dist/themes/emerald-pink.js +25 -1
  112. package/dist/themes/fuchsia-emerald.css +202 -148
  113. package/dist/themes/fuchsia-emerald.js +25 -1
  114. package/dist/themes/gray.css +202 -148
  115. package/dist/themes/gray.js +24 -0
  116. package/dist/themes/indigo-amber.css +202 -148
  117. package/dist/themes/indigo-amber.js +26 -2
  118. package/dist/themes/neutral.css +202 -148
  119. package/dist/themes/neutral.js +24 -0
  120. package/dist/themes/pink-emerald.css +202 -148
  121. package/dist/themes/pink-emerald.js +25 -1
  122. package/dist/themes/purple-yellow.css +202 -148
  123. package/dist/themes/purple-yellow.js +24 -0
  124. package/dist/themes/rainbow.css +202 -148
  125. package/dist/themes/rainbow.js +25 -1
  126. package/dist/themes/red-blue.css +202 -148
  127. package/dist/themes/red-blue.js +24 -0
  128. package/dist/themes/red-cyan.css +202 -148
  129. package/dist/themes/red-cyan.js +24 -0
  130. package/dist/themes/rose-teal.css +202 -148
  131. package/dist/themes/rose-teal.js +24 -0
  132. package/dist/themes/sky-amber.css +202 -148
  133. package/dist/themes/sky-amber.js +26 -2
  134. package/dist/themes/slate-cyan.css +202 -148
  135. package/dist/themes/slate-cyan.js +25 -1
  136. package/dist/themes/teal-rose.css +202 -148
  137. package/dist/themes/teal-rose.js +24 -0
  138. package/dist/themes/violet-lime.css +202 -148
  139. package/dist/themes/violet-lime.js +27 -3
  140. package/dist/utils/design-tokens.js +29 -2
  141. package/dist/utils/storage-abstraction.js +1 -1
  142. package/package.json +11 -28
  143. package/dist/components/Switch/SwitchButton.svelte +0 -134
  144. package/dist/components/Switch/SwitchButton.svelte.d.ts +0 -21
@@ -1,8 +1,90 @@
1
- /* TabbedMenu component tokens */
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-surface);
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 = () => acp?.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
- <nav class="sidebar-nav">
99
- {#if showLabels}
100
- <span class="section-label">Navigation</span>
101
- {/if}
102
- <ul class="nav-list">
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
- <input type="text" class="preview-input" placeholder="Text input..." />
226
- </div>
227
- <div class="input-wrapper">
228
- <input
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 differently styled content at different breakpoints.
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 theme for background |
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
- ### With Theme
37
+ ### Customization Strategies
27
38
 
28
39
  ```svelte
29
- <TwCheck theme="blue">
30
- Tailwind is working!
31
- </TwCheck>
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**: Yellow text, no border
38
- - **Desktop (sm+)**: White text, teal border, larger font
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 (plain text), Tailwind CSS is not loading correctly.
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 "./index.css";
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 bg-(--stuic-twcheck-bg)
19
- inline-block px-2
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
- // simulating missing css var
27
- return theme
28
- ? `--stuic-twcheck-bg: var(--color-foo-bar-baz, var(--color-${theme}-600));`
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
 
@@ -4,7 +4,6 @@ export interface Props {
4
4
  children?: Snippet;
5
5
  theme?: string;
6
6
  }
7
- import "./index.css";
8
7
  declare const TwCheck: import("svelte").Component<Props, {}, "">;
9
8
  type TwCheck = ReturnType<typeof TwCheck>;
10
9
  export default TwCheck;
@@ -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
  }