@classic-homes/theme-svelte 1.13.1 → 1.13.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.
@@ -0,0 +1,29 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { render, screen } from '@testing-library/svelte';
3
+ import Input from '../lib/components/Input.svelte';
4
+ import Textarea from '../lib/components/Textarea.svelte';
5
+ import Select from '../lib/components/Select.svelte';
6
+ import PasswordInput from '../lib/components/PasswordInput.svelte';
7
+ // Form controls paint their own light surface (bg-background), so they must
8
+ // also set their own text color. Otherwise a dark parent that sets white text
9
+ // (Toolbar's text-toolbar-foreground) leaks into the value: white on white.
10
+ describe('light-surface controls own their text color', () => {
11
+ it('Input', () => {
12
+ render(Input, { props: { 'aria-label': 'Search' } });
13
+ expect(screen.getByRole('textbox', { name: 'Search' })).toHaveClass('bg-background', 'text-foreground');
14
+ });
15
+ it('Textarea', () => {
16
+ render(Textarea, { props: { 'aria-label': 'Notes' } });
17
+ expect(screen.getByRole('textbox', { name: 'Notes' })).toHaveClass('bg-background', 'text-foreground');
18
+ });
19
+ it('PasswordInput', () => {
20
+ const { container } = render(PasswordInput, { props: { id: 'pw' } });
21
+ expect(container.querySelector('#pw')).toHaveClass('bg-background', 'text-foreground');
22
+ });
23
+ it('Select trigger', () => {
24
+ const { container } = render(Select, {
25
+ props: { id: 'status', options: [{ value: 'a', label: 'Active' }], value: 'a' },
26
+ });
27
+ expect(container.querySelector('#status')).toHaveClass('bg-background', 'text-foreground');
28
+ });
29
+ });
@@ -166,7 +166,7 @@
166
166
  onfocus={() => (open = true)}
167
167
  onclick={() => (open = true)}
168
168
  class={cn(
169
- 'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-base sm:text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
169
+ 'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background text-foreground px-3 py-2 text-base sm:text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
170
170
  error && 'border-destructive focus:ring-destructive',
171
171
  className
172
172
  )}
@@ -262,7 +262,7 @@
262
262
  onfocus={() => (open = true)}
263
263
  onclick={() => (open = true)}
264
264
  class={cn(
265
- 'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-base sm:text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
265
+ 'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background text-foreground px-3 py-2 text-base sm:text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
266
266
  error && 'border-destructive focus:ring-destructive',
267
267
  className
268
268
  )}
@@ -431,7 +431,7 @@
431
431
  onkeydown={handleInputKeyDown}
432
432
  {disabled}
433
433
  class={cn(
434
- 'flex h-10 w-full items-center rounded-md border border-input bg-background px-3 py-2 pr-10 text-base sm:text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
434
+ 'flex h-10 w-full items-center rounded-md border border-input bg-background text-foreground px-3 py-2 pr-10 text-base sm:text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
435
435
  !value && !isEditing && 'text-muted-foreground',
436
436
  displayError && 'border-destructive focus:ring-destructive',
437
437
  className
@@ -571,7 +571,7 @@
571
571
  bind:value={hour}
572
572
  onchange={updateTime}
573
573
  aria-label="Hour"
574
- class="h-8 rounded-md border border-input bg-background px-2 text-base sm:text-sm focus:outline-none focus:ring-2 focus:ring-ring"
574
+ class="h-8 rounded-md border border-input bg-background text-foreground px-2 text-base sm:text-sm focus:outline-none focus:ring-2 focus:ring-ring"
575
575
  >
576
576
  {#each hourOptions as h}
577
577
  <option value={timeFormat === '12h' ? h : h}>
@@ -584,7 +584,7 @@
584
584
  bind:value={minute}
585
585
  onchange={updateTime}
586
586
  aria-label="Minute"
587
- class="h-8 rounded-md border border-input bg-background px-2 text-base sm:text-sm focus:outline-none focus:ring-2 focus:ring-ring"
587
+ class="h-8 rounded-md border border-input bg-background text-foreground px-2 text-base sm:text-sm focus:outline-none focus:ring-2 focus:ring-ring"
588
588
  >
589
589
  {#each minuteOptions as m}
590
590
  <option value={m}>{String(m).padStart(2, '0')}</option>
@@ -595,7 +595,7 @@
595
595
  bind:value={period}
596
596
  onchange={updateTime}
597
597
  aria-label="AM or PM"
598
- class="h-8 rounded-md border border-input bg-background px-2 text-base sm:text-sm focus:outline-none focus:ring-2 focus:ring-ring"
598
+ class="h-8 rounded-md border border-input bg-background text-foreground px-2 text-base sm:text-sm focus:outline-none focus:ring-2 focus:ring-ring"
599
599
  >
600
600
  <option value="AM">AM</option>
601
601
  <option value="PM">PM</option>
@@ -82,7 +82,7 @@
82
82
  aria-invalid={ariaInvalid}
83
83
  aria-required={required}
84
84
  class={cn(
85
- 'flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base sm:text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
85
+ 'flex h-10 w-full rounded-md border border-input bg-background text-foreground px-3 py-2 text-base sm:text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
86
86
  ariaInvalid === true || ariaInvalid === 'true'
87
87
  ? 'border-destructive focus-visible:ring-destructive'
88
88
  : '',
@@ -227,7 +227,7 @@
227
227
  onfocus={() => (open = true)}
228
228
  onclick={() => (open = true)}
229
229
  class={cn(
230
- 'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
230
+ 'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background text-foreground px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
231
231
  error && 'border-destructive focus:ring-destructive'
232
232
  )}
233
233
  aria-invalid={error ? 'true' : undefined}
@@ -364,7 +364,7 @@
364
364
  onfocus={() => (open = true)}
365
365
  onclick={() => (open = true)}
366
366
  class={cn(
367
- 'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
367
+ 'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background text-foreground px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
368
368
  error && 'border-destructive focus:ring-destructive'
369
369
  )}
370
370
  aria-invalid={error ? 'true' : undefined}
@@ -159,7 +159,7 @@
159
159
  onclick={decrement}
160
160
  disabled={disabled || !canDecrement}
161
161
  class={cn(
162
- 'flex h-10 w-10 items-center justify-center rounded-l-md border border-r-0 border-input bg-background text-sm font-medium hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
162
+ 'flex h-10 w-10 items-center justify-center rounded-l-md border border-r-0 border-input bg-background text-foreground text-sm font-medium hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
163
163
  error && 'border-destructive'
164
164
  )}
165
165
  aria-label="Decrease value"
@@ -208,7 +208,7 @@
208
208
  onclick={increment}
209
209
  disabled={disabled || !canIncrement}
210
210
  class={cn(
211
- 'flex h-10 w-10 items-center justify-center rounded-r-md border border-l-0 border-input bg-background text-sm font-medium hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
211
+ 'flex h-10 w-10 items-center justify-center rounded-r-md border border-l-0 border-input bg-background text-foreground text-sm font-medium hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
212
212
  error && 'border-destructive'
213
213
  )}
214
214
  aria-label="Increase value"
@@ -251,7 +251,7 @@
251
251
  onclick={decrement}
252
252
  disabled={disabled || !canDecrement}
253
253
  class={cn(
254
- 'flex h-10 w-10 items-center justify-center rounded-l-md border border-r-0 border-input bg-background text-sm font-medium hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
254
+ 'flex h-10 w-10 items-center justify-center rounded-l-md border border-r-0 border-input bg-background text-foreground text-sm font-medium hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
255
255
  error && 'border-destructive'
256
256
  )}
257
257
  aria-label="Decrease value"
@@ -300,7 +300,7 @@
300
300
  onclick={increment}
301
301
  disabled={disabled || !canIncrement}
302
302
  class={cn(
303
- 'flex h-10 w-10 items-center justify-center rounded-r-md border border-l-0 border-input bg-background text-sm font-medium hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
303
+ 'flex h-10 w-10 items-center justify-center rounded-r-md border border-l-0 border-input bg-background text-foreground text-sm font-medium hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
304
304
  error && 'border-destructive'
305
305
  )}
306
306
  aria-label="Increase value"
@@ -244,7 +244,7 @@
244
244
  onpaste={handlePaste}
245
245
  onfocus={handleFocus}
246
246
  class={cn(
247
- 'h-10 w-10 text-base sm:h-12 sm:w-12 sm:text-lg text-center font-semibold rounded-md border border-input bg-background ring-offset-background transition-colors',
247
+ 'h-10 w-10 text-base sm:h-12 sm:w-12 sm:text-lg text-center font-semibold rounded-md border border-input bg-background text-foreground ring-offset-background transition-colors',
248
248
  'focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
249
249
  'disabled:cursor-not-allowed disabled:opacity-50',
250
250
  error && 'border-destructive focus:ring-destructive'
@@ -295,7 +295,7 @@
295
295
  onpaste={handlePaste}
296
296
  onfocus={handleFocus}
297
297
  class={cn(
298
- 'h-10 w-10 text-base sm:h-12 sm:w-12 sm:text-lg text-center font-semibold rounded-md border border-input bg-background ring-offset-background transition-colors',
298
+ 'h-10 w-10 text-base sm:h-12 sm:w-12 sm:text-lg text-center font-semibold rounded-md border border-input bg-background text-foreground ring-offset-background transition-colors',
299
299
  'focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
300
300
  'disabled:cursor-not-allowed disabled:opacity-50',
301
301
  error && 'border-destructive focus:ring-destructive'
@@ -69,7 +69,7 @@
69
69
  {id}
70
70
  {autocomplete}
71
71
  class={cn(
72
- 'flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 pr-10 text-base sm:text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
72
+ 'flex h-10 w-full rounded-md border border-input bg-background text-foreground px-3 py-2 pr-10 text-base sm:text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
73
73
  className
74
74
  )}
75
75
  oninput={handleInput}
@@ -132,7 +132,7 @@
132
132
  // Common trigger classes
133
133
  const triggerClasses = $derived(
134
134
  cn(
135
- 'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
135
+ 'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background text-foreground px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
136
136
  error && 'border-destructive focus:ring-destructive',
137
137
  className
138
138
  )
@@ -35,7 +35,7 @@
35
35
  canvas: 'block w-full cursor-crosshair touch-none',
36
36
  toolbar: 'flex flex-wrap items-center gap-2',
37
37
  toolButton:
38
- 'inline-flex h-9 w-9 items-center justify-center rounded-md border border-input bg-background text-sm font-medium ring-offset-background hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
38
+ 'inline-flex h-9 w-9 items-center justify-center rounded-md border border-input bg-background text-foreground text-sm font-medium ring-offset-background hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
39
39
  toolGroup: 'flex items-center gap-1.5',
40
40
  toolLabel: 'text-xs text-muted-foreground',
41
41
  colorPicker:
@@ -990,7 +990,7 @@
990
990
  oninput={handleTypedNameChange}
991
991
  placeholder="Enter your full name"
992
992
  class={cn(
993
- 'flex h-11 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
993
+ 'flex h-11 w-full rounded-md border border-input bg-background text-foreground px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
994
994
  error && 'border-destructive focus-visible:ring-destructive'
995
995
  )}
996
996
  {disabled}
@@ -62,7 +62,7 @@
62
62
  aria-describedby={ariaDescribedby}
63
63
  aria-invalid={ariaInvalid}
64
64
  class={cn(
65
- 'flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base sm:text-sm ring-offset-background placeholder:text-gray-500 dark:placeholder:text-gray-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 resize-y',
65
+ 'flex min-h-[80px] w-full rounded-md border border-input bg-background text-foreground px-3 py-2 text-base sm:text-sm ring-offset-background placeholder:text-gray-500 dark:placeholder:text-gray-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 resize-y',
66
66
  ariaInvalid === true || ariaInvalid === 'true'
67
67
  ? 'border-destructive focus-visible:ring-destructive'
68
68
  : '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classic-homes/theme-svelte",
3
- "version": "1.13.1",
3
+ "version": "1.13.2",
4
4
  "description": "Svelte components for the Classic theme system",
5
5
  "type": "module",
6
6
  "svelte": "./dist/lib/index.js",