@nqmcreative/ui 0.4.0 → 0.4.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.
Files changed (203) hide show
  1. package/README.md +17 -19
  2. package/dist/core/calendar.d.ts +1 -1
  3. package/dist/core/calendar.js +1 -1
  4. package/dist/core/date.d.ts +3 -3
  5. package/dist/core/date.js +1 -1
  6. package/dist/core/files.d.ts +2 -3
  7. package/dist/core/files.js +2 -3
  8. package/dist/core/index.d.ts +2 -4
  9. package/dist/core/index.js +2 -4
  10. package/dist/core/password.d.ts +1 -1
  11. package/dist/core/password.js +1 -1
  12. package/dist/core/tones.d.ts +10 -0
  13. package/dist/core/tones.js +19 -0
  14. package/dist/core/trigger.d.ts +8 -0
  15. package/dist/core/trigger.js +11 -0
  16. package/dist/styles/matte/Alert.svelte +2 -4
  17. package/dist/styles/matte/Avatar.svelte +16 -3
  18. package/dist/styles/matte/Breadcrumb.svelte +1 -4
  19. package/dist/styles/matte/Button.svelte +6 -2
  20. package/dist/styles/matte/Calendar.svelte +6 -9
  21. package/dist/styles/matte/Checkbox.svelte +49 -30
  22. package/dist/styles/matte/CheckboxGroup.svelte +15 -4
  23. package/dist/styles/matte/ColorInput.svelte +1 -4
  24. package/dist/styles/matte/Combobox.svelte +14 -8
  25. package/dist/styles/matte/CommandPalette.svelte +3 -6
  26. package/dist/styles/matte/ConfirmDialog.svelte +11 -6
  27. package/dist/styles/matte/ContextMenu.svelte +1 -4
  28. package/dist/styles/matte/CurrencyInput.svelte +1 -1
  29. package/dist/styles/matte/CurrencyInput.svelte.d.ts +1 -1
  30. package/dist/styles/matte/DatePicker.svelte +18 -11
  31. package/dist/styles/matte/DatePicker.svelte.d.ts +3 -0
  32. package/dist/styles/matte/Divider.svelte +1 -1
  33. package/dist/styles/matte/Drawer.svelte +11 -5
  34. package/dist/styles/matte/Dropdown.svelte +2 -5
  35. package/dist/styles/matte/Dropdown.svelte.d.ts +1 -1
  36. package/dist/styles/matte/Dropzone.svelte +9 -12
  37. package/dist/styles/matte/Dropzone.svelte.d.ts +1 -1
  38. package/dist/styles/matte/Field.svelte +59 -3
  39. package/dist/styles/matte/FileInput.svelte +11 -14
  40. package/dist/styles/matte/FileInput.svelte.d.ts +2 -2
  41. package/dist/styles/matte/Footer.svelte +15 -4
  42. package/dist/styles/matte/Footer.svelte.d.ts +1 -1
  43. package/dist/styles/matte/Input.svelte +9 -2
  44. package/dist/styles/matte/Label.svelte +3 -1
  45. package/dist/styles/matte/Link.svelte +13 -2
  46. package/dist/styles/matte/MenuItem.svelte +11 -4
  47. package/dist/styles/matte/Modal.svelte +11 -5
  48. package/dist/styles/matte/MultiSelect.svelte +5 -8
  49. package/dist/styles/matte/Navbar.svelte +5 -11
  50. package/dist/styles/matte/Pagination.svelte +3 -6
  51. package/dist/styles/matte/PinInput.svelte +1 -4
  52. package/dist/styles/matte/Radio.svelte +41 -22
  53. package/dist/styles/matte/RadioGroup.svelte +15 -4
  54. package/dist/styles/matte/SearchInput.svelte +1 -4
  55. package/dist/styles/matte/Select.svelte +4 -2
  56. package/dist/styles/matte/Sidebar.svelte +3 -6
  57. package/dist/styles/matte/Skeleton.svelte +2 -1
  58. package/dist/styles/matte/Spinner.svelte +2 -5
  59. package/dist/styles/matte/Spinner.svelte.d.ts +1 -1
  60. package/dist/styles/matte/Stat.svelte +27 -3
  61. package/dist/styles/matte/Switch.svelte +6 -1
  62. package/dist/styles/matte/Table.svelte +5 -8
  63. package/dist/styles/matte/Tabs.svelte +1 -1
  64. package/dist/styles/matte/TagsInput.svelte +5 -8
  65. package/dist/styles/matte/Textarea.svelte +4 -2
  66. package/dist/styles/matte/ThemeToggle.svelte +5 -8
  67. package/dist/styles/matte/TimeInput.svelte +2 -5
  68. package/dist/styles/matte/Toaster.svelte +23 -8
  69. package/dist/styles/matte/Tooltip.svelte +8 -1
  70. package/dist/styles/matte/index.d.ts +2 -3
  71. package/dist/styles/matte/index.js +1 -3
  72. package/dist/styles/matte/theme.css +21 -0
  73. package/dist/styles/paper/Alert.svelte +3 -5
  74. package/dist/styles/paper/Avatar.svelte +14 -3
  75. package/dist/styles/paper/Breadcrumb.svelte +1 -4
  76. package/dist/styles/paper/Button.svelte +5 -1
  77. package/dist/styles/paper/Calendar.svelte +6 -9
  78. package/dist/styles/paper/Card.svelte +1 -1
  79. package/dist/styles/paper/Checkbox.svelte +55 -36
  80. package/dist/styles/paper/CheckboxGroup.svelte +15 -4
  81. package/dist/styles/paper/ColorInput.svelte +1 -4
  82. package/dist/styles/paper/Combobox.svelte +14 -8
  83. package/dist/styles/paper/CommandPalette.svelte +3 -6
  84. package/dist/styles/paper/ConfirmDialog.svelte +9 -6
  85. package/dist/styles/paper/ContextMenu.svelte +1 -4
  86. package/dist/styles/paper/CurrencyInput.svelte +1 -1
  87. package/dist/styles/paper/CurrencyInput.svelte.d.ts +1 -1
  88. package/dist/styles/paper/DatePicker.svelte +18 -11
  89. package/dist/styles/paper/DatePicker.svelte.d.ts +3 -0
  90. package/dist/styles/paper/Divider.svelte +1 -1
  91. package/dist/styles/paper/Drawer.svelte +9 -5
  92. package/dist/styles/paper/Dropdown.svelte +2 -5
  93. package/dist/styles/paper/Dropdown.svelte.d.ts +1 -1
  94. package/dist/styles/paper/Dropzone.svelte +9 -12
  95. package/dist/styles/paper/Dropzone.svelte.d.ts +1 -1
  96. package/dist/styles/paper/Field.svelte +59 -3
  97. package/dist/styles/paper/FileInput.svelte +11 -14
  98. package/dist/styles/paper/FileInput.svelte.d.ts +2 -2
  99. package/dist/styles/paper/Footer.svelte +15 -4
  100. package/dist/styles/paper/Footer.svelte.d.ts +1 -1
  101. package/dist/styles/paper/Input.svelte +9 -2
  102. package/dist/styles/paper/Label.svelte +3 -1
  103. package/dist/styles/paper/Link.svelte +13 -2
  104. package/dist/styles/paper/MenuItem.svelte +11 -4
  105. package/dist/styles/paper/Modal.svelte +9 -5
  106. package/dist/styles/paper/MultiSelect.svelte +5 -8
  107. package/dist/styles/paper/Navbar.svelte +5 -11
  108. package/dist/styles/paper/Pagination.svelte +3 -6
  109. package/dist/styles/paper/PinInput.svelte +1 -4
  110. package/dist/styles/paper/Radio.svelte +41 -22
  111. package/dist/styles/paper/RadioGroup.svelte +15 -4
  112. package/dist/styles/paper/SearchInput.svelte +1 -4
  113. package/dist/styles/paper/SegmentedControl.svelte +2 -2
  114. package/dist/styles/paper/Select.svelte +4 -2
  115. package/dist/styles/paper/Sidebar.svelte +3 -6
  116. package/dist/styles/paper/Skeleton.svelte +2 -1
  117. package/dist/styles/paper/Spinner.svelte +2 -5
  118. package/dist/styles/paper/Spinner.svelte.d.ts +1 -1
  119. package/dist/styles/paper/Stat.svelte +24 -2
  120. package/dist/styles/paper/Switch.svelte +6 -1
  121. package/dist/styles/paper/Table.svelte +5 -8
  122. package/dist/styles/paper/Tabs.svelte +1 -1
  123. package/dist/styles/paper/TagsInput.svelte +5 -8
  124. package/dist/styles/paper/Textarea.svelte +4 -2
  125. package/dist/styles/paper/ThemeToggle.svelte +5 -8
  126. package/dist/styles/paper/TimeInput.svelte +2 -5
  127. package/dist/styles/paper/Toaster.svelte +22 -9
  128. package/dist/styles/paper/Tooltip.svelte +8 -1
  129. package/dist/styles/paper/index.d.ts +2 -3
  130. package/dist/styles/paper/index.js +1 -3
  131. package/dist/styles/paper/theme.css +21 -0
  132. package/dist/styles/sprout/Alert.svelte +4 -6
  133. package/dist/styles/sprout/Avatar.svelte +14 -3
  134. package/dist/styles/sprout/Breadcrumb.svelte +2 -5
  135. package/dist/styles/sprout/Button.svelte +8 -4
  136. package/dist/styles/sprout/Calendar.svelte +7 -10
  137. package/dist/styles/sprout/Card.svelte +2 -2
  138. package/dist/styles/sprout/Checkbox.svelte +55 -36
  139. package/dist/styles/sprout/CheckboxGroup.svelte +15 -4
  140. package/dist/styles/sprout/ColorInput.svelte +2 -5
  141. package/dist/styles/sprout/Combobox.svelte +15 -9
  142. package/dist/styles/sprout/CommandPalette.svelte +3 -6
  143. package/dist/styles/sprout/ConfirmDialog.svelte +9 -6
  144. package/dist/styles/sprout/ContextMenu.svelte +1 -4
  145. package/dist/styles/sprout/CurrencyInput.svelte +1 -1
  146. package/dist/styles/sprout/CurrencyInput.svelte.d.ts +1 -1
  147. package/dist/styles/sprout/DatePicker.svelte +20 -13
  148. package/dist/styles/sprout/DatePicker.svelte.d.ts +3 -0
  149. package/dist/styles/sprout/Divider.svelte +1 -1
  150. package/dist/styles/sprout/Drawer.svelte +9 -5
  151. package/dist/styles/sprout/Dropdown.svelte +2 -5
  152. package/dist/styles/sprout/Dropdown.svelte.d.ts +1 -1
  153. package/dist/styles/sprout/Dropzone.svelte +10 -13
  154. package/dist/styles/sprout/Dropzone.svelte.d.ts +1 -1
  155. package/dist/styles/sprout/Field.svelte +59 -3
  156. package/dist/styles/sprout/FileInput.svelte +14 -17
  157. package/dist/styles/sprout/FileInput.svelte.d.ts +2 -2
  158. package/dist/styles/sprout/Footer.svelte +15 -4
  159. package/dist/styles/sprout/Footer.svelte.d.ts +1 -1
  160. package/dist/styles/sprout/Input.svelte +9 -2
  161. package/dist/styles/sprout/Label.svelte +3 -1
  162. package/dist/styles/sprout/Link.svelte +13 -2
  163. package/dist/styles/sprout/LogoCloud.svelte +1 -1
  164. package/dist/styles/sprout/MenuItem.svelte +11 -4
  165. package/dist/styles/sprout/Modal.svelte +9 -5
  166. package/dist/styles/sprout/MultiSelect.svelte +8 -11
  167. package/dist/styles/sprout/Navbar.svelte +5 -11
  168. package/dist/styles/sprout/Pagination.svelte +3 -6
  169. package/dist/styles/sprout/PinInput.svelte +1 -4
  170. package/dist/styles/sprout/Radio.svelte +41 -22
  171. package/dist/styles/sprout/RadioGroup.svelte +15 -4
  172. package/dist/styles/sprout/SearchInput.svelte +2 -5
  173. package/dist/styles/sprout/SegmentedControl.svelte +2 -2
  174. package/dist/styles/sprout/Select.svelte +4 -2
  175. package/dist/styles/sprout/Sidebar.svelte +5 -7
  176. package/dist/styles/sprout/Skeleton.svelte +2 -1
  177. package/dist/styles/sprout/Spinner.svelte +2 -5
  178. package/dist/styles/sprout/Spinner.svelte.d.ts +1 -1
  179. package/dist/styles/sprout/Stat.svelte +24 -2
  180. package/dist/styles/sprout/Switch.svelte +6 -1
  181. package/dist/styles/sprout/Table.svelte +6 -9
  182. package/dist/styles/sprout/Tabs.svelte +1 -1
  183. package/dist/styles/sprout/TagsInput.svelte +6 -9
  184. package/dist/styles/sprout/Textarea.svelte +4 -2
  185. package/dist/styles/sprout/ThemeToggle.svelte +5 -8
  186. package/dist/styles/sprout/TimeInput.svelte +3 -6
  187. package/dist/styles/sprout/Toaster.svelte +25 -12
  188. package/dist/styles/sprout/Tooltip.svelte +8 -1
  189. package/dist/styles/sprout/index.d.ts +3 -4
  190. package/dist/styles/sprout/index.js +2 -4
  191. package/dist/styles/sprout/lift.d.ts +14 -0
  192. package/dist/styles/sprout/lift.js +23 -0
  193. package/dist/styles/sprout/theme.css +50 -24
  194. package/package.json +2 -19
  195. package/registry.json +7 -46
  196. package/dist/core/locale.svelte.d.ts +0 -101
  197. package/dist/core/locale.svelte.js +0 -167
  198. package/dist/styles/matte/LocaleProvider.svelte +0 -24
  199. package/dist/styles/matte/LocaleProvider.svelte.d.ts +0 -10
  200. package/dist/styles/paper/LocaleProvider.svelte +0 -24
  201. package/dist/styles/paper/LocaleProvider.svelte.d.ts +0 -10
  202. package/dist/styles/sprout/LocaleProvider.svelte +0 -24
  203. package/dist/styles/sprout/LocaleProvider.svelte.d.ts +0 -10
@@ -16,7 +16,6 @@
16
16
  import Checkbox from './Checkbox.svelte';
17
17
  import type { Tone } from '../../core/tones.js';
18
18
  import { nextSort, sortRows, toggleKey, type TableSort } from '../../core/table.js';
19
- import { useLocale } from '../../core/locale.svelte.js';
20
19
  import { edge } from './lift.js';
21
20
 
22
21
  interface Props extends Omit<HTMLAttributes<HTMLDivElement>, 'onselect'> {
@@ -83,8 +82,6 @@
83
82
  ...rest
84
83
  }: Props = $props();
85
84
 
86
- const t = useLocale();
87
-
88
85
  const aligns = {
89
86
  left: 'text-left',
90
87
  center: 'text-center',
@@ -140,14 +137,14 @@
140
137
  >
141
138
  <span class="font-sans text-[13px] font-semibold text-text">
142
139
  {selected.length}
143
- {t.current.selected}
140
+ selected
144
141
  </span>
145
142
  <button
146
143
  type="button"
147
144
  onclick={clearSelection}
148
145
  class="rounded-full font-sans text-[13px] font-medium text-text-muted transition-colors duration-150 hover:text-text focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current"
149
146
  >
150
- {t.current.clear}
147
+ Clear selection
151
148
  </button>
152
149
  <div class="ml-auto flex flex-wrap items-center gap-2">
153
150
  {@render bulkActions?.({ selected, clear: clearSelection })}
@@ -177,7 +174,7 @@
177
174
  checked={allSelected}
178
175
  indeterminate={someSelected}
179
176
  {tone}
180
- aria-label={t.current.selectAllRows}
177
+ aria-label="Select all rows"
181
178
  onchange={toggleAll}
182
179
  />
183
180
  </th>
@@ -198,7 +195,7 @@
198
195
  <button
199
196
  type="button"
200
197
  onclick={() => toggleSort(column)}
201
- class="inline-flex items-center gap-1.5 rounded transition-colors duration-150 hover:text-text focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current
198
+ class="inline-flex items-center gap-1.5 rounded-md transition-colors duration-150 hover:text-text focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current
202
199
  {sort?.key === column.key ? 'text-text' : ''}"
203
200
  >
204
201
  {column.label}
@@ -224,7 +221,7 @@
224
221
  colspan={columns.length + (selectable ? 1 : 0)}
225
222
  class="px-4 py-10 text-center text-sm text-text-muted"
226
223
  >
227
- {#if empty}{@render empty()}{:else}{t.current.noData}{/if}
224
+ {#if empty}{@render empty()}{:else}No data{/if}
228
225
  </td>
229
226
  </tr>
230
227
  {:else}
@@ -241,7 +238,7 @@
241
238
  <Checkbox
242
239
  checked={isSelected}
243
240
  {tone}
244
- aria-label={t.current.selectRow}
241
+ aria-label="Select row"
245
242
  onchange={() => toggleRow(row)}
246
243
  />
247
244
  </td>
@@ -75,7 +75,7 @@
75
75
  }`;
76
76
  }
77
77
  return `${base} h-8 rounded-xl px-3.5 ${
78
- active ? `bg-bg text-text ${edge}` : 'text-text-muted hover:text-text'
78
+ active ? `bg-bg ${toneText[tone]} ${edge}` : 'text-text-muted hover:text-text'
79
79
  }`;
80
80
  }
81
81
  </script>
@@ -1,5 +1,4 @@
1
1
  <script lang="ts">
2
- import { useLocale } from '../../core/locale.svelte.js';
3
2
  import { addTag, splitTags, type TagRejection } from '../../core/tags.js';
4
3
  import { toneFocusWithinBorder, toneSoft, type Tone } from '../../core/tones.js';
5
4
  import { edge } from './lift.js';
@@ -47,8 +46,6 @@
47
46
  class: className = ''
48
47
  }: Props = $props();
49
48
 
50
- const t = useLocale();
51
-
52
49
  let draft = $state('');
53
50
  let field: HTMLInputElement | null = $state(null);
54
51
  /** The last refusal, cleared as soon as the next keystroke lands. */
@@ -112,8 +109,8 @@
112
109
  const messages: Record<TagRejection, string> = $derived({
113
110
  empty: '',
114
111
  short: `${minLength}+`,
115
- duplicate: t.current.duplicateTag,
116
- full: `${t.current.selected} ${tags.length}/${max}`
112
+ duplicate: 'Already added',
113
+ full: `$selected ${tags.length}/${max}`
117
114
  });
118
115
  </script>
119
116
 
@@ -137,8 +134,8 @@
137
134
  <button
138
135
  type="button"
139
136
  onclick={() => remove(index)}
140
- aria-label="{t.current.removeItem} {tag}"
141
- class="inline-flex size-4 items-center justify-center rounded transition-colors duration-150 hover:bg-bg/70 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-current"
137
+ aria-label="Remove {tag}"
138
+ class="inline-flex size-4 items-center justify-center rounded-full transition-colors duration-150 hover:bg-bg/70 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-current"
142
139
  >
143
140
  <svg class="size-2.5" viewBox="0 0 10 10" fill="none" aria-hidden="true">
144
141
  <path
@@ -157,8 +154,8 @@
157
154
  bind:value={draft}
158
155
  {disabled}
159
156
  readonly={full}
160
- placeholder={tags.length === 0 ? (placeholder ?? t.current.addTag) : ''}
161
- aria-label={placeholder ?? t.current.addTag}
157
+ placeholder={tags.length === 0 ? (placeholder ?? 'Add a tag') : ''}
158
+ aria-label={placeholder ?? 'Add a tag'}
162
159
  aria-invalid={invalid ? 'true' : undefined}
163
160
  onkeydown={onKeydown}
164
161
  onpaste={onPaste}
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { HTMLTextareaAttributes } from 'svelte/elements';
3
- import { toneFocusBorder, type Tone } from '../../core/tones.js';
3
+ import { focusRing, toneFocusBorder, toneRing, type Tone } from '../../core/tones.js';
4
4
  import { edge } from './lift.js';
5
5
 
6
6
  interface Props extends HTMLTextareaAttributes {
@@ -49,7 +49,9 @@
49
49
  bind:value
50
50
  {rows}
51
51
  aria-invalid={invalid ? 'true' : undefined}
52
- class="w-full rounded-xl border bg-bg px-3 py-2 font-sans text-sm text-text {edge} transition-colors duration-150 ease-brand-out placeholder:text-text-muted focus:outline-none disabled:pointer-events-none disabled:opacity-50
52
+ class="{focusRing} {toneRing[
53
+ tone
54
+ ]} w-full rounded-xl border bg-bg px-3 py-2 font-sans text-sm text-text {edge} transition-colors duration-150 ease-brand-out placeholder:text-text-muted disabled:pointer-events-none disabled:opacity-50
53
55
  {autoresize ? 'resize-none overflow-hidden' : 'resize-y'}
54
56
  {invalid ? 'border-danger' : `border-hairline-strong ${toneFocusBorder[tone]}`} {className}"
55
57
  {...rest}></textarea>
@@ -10,7 +10,6 @@
10
10
  storedTheme,
11
11
  type Theme
12
12
  } from '../../core/theme.svelte.js';
13
- import { useLocale } from '../../core/locale.svelte.js';
14
13
  import { edge } from './lift.js';
15
14
 
16
15
  interface Props {
@@ -34,8 +33,6 @@
34
33
  class: className = ''
35
34
  }: Props = $props();
36
35
 
37
- const t = useLocale();
38
-
39
36
  $effect(() => {
40
37
  applyTheme(theme);
41
38
  if (persist) persistTheme(theme);
@@ -51,8 +48,8 @@
51
48
  }
52
49
 
53
50
  const options = $derived([
54
- { value: 'light' as Theme, label: t.current.lightMode },
55
- { value: 'dark' as Theme, label: t.current.darkMode },
51
+ { value: 'light' as Theme, label: 'Light' },
52
+ { value: 'dark' as Theme, label: 'Dark' },
56
53
  { value: 'system' as Theme, label: 'Auto' }
57
54
  ]);
58
55
  </script>
@@ -96,7 +93,7 @@
96
93
  {#if variant === 'segmented'}
97
94
  <div
98
95
  role="radiogroup"
99
- aria-label={t.current.toggleTheme}
96
+ aria-label="Toggle theme"
100
97
  class="inline-flex items-center gap-1 rounded-2xl border border-hairline bg-bg-inset p-1 {className}"
101
98
  >
102
99
  {#each options as option (option.value)}
@@ -120,8 +117,8 @@
120
117
  <button
121
118
  type="button"
122
119
  onclick={cycle}
123
- aria-label="{t.current.toggleTheme} ({theme})"
124
- title={t.current.toggleTheme}
120
+ aria-label="Toggle theme ({theme})"
121
+ title="Toggle theme"
125
122
  class="inline-flex size-9 items-center justify-center rounded-xl border border-hairline bg-bg text-text-secondary {edge} transition-colors duration-150 ease-brand-out hover:bg-bg-alt hover:text-text {focusRing} {toneRing[
126
123
  tone
127
124
  ]} {className}"
@@ -1,6 +1,5 @@
1
1
  <script lang="ts">
2
2
  import type { HTMLInputAttributes } from 'svelte/elements';
3
- import { useLocale } from '../../core/locale.svelte.js';
4
3
  import { clampTime, formatTime, parseTime, stepTime } from '../../core/time.js';
5
4
  import type { Tone } from '../../core/tones.js';
6
5
  import Input, { type InputSize } from './Input.svelte';
@@ -38,8 +37,6 @@
38
37
  ...rest
39
38
  }: Props = $props();
40
39
 
41
- const t = useLocale();
42
-
43
40
  // Typed text and the bound value are separate until the field settles:
44
41
  // `9` is a valid thing to be halfway through typing and an invalid time.
45
42
  let text = $state('');
@@ -74,7 +71,7 @@
74
71
  }
75
72
 
76
73
  const stepper =
77
- 'grid size-6 place-items-center rounded text-text-secondary transition-colors duration-150 hover:bg-bg-inset hover:text-text focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-current';
74
+ 'grid size-6 place-items-center rounded-lg text-text-secondary transition-colors duration-150 hover:bg-bg-inset hover:text-text focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-current';
78
75
  </script>
79
76
 
80
77
  <Input
@@ -120,7 +117,7 @@
120
117
  class={stepper}
121
118
  {disabled}
122
119
  onclick={() => nudge(1)}
123
- aria-label={t.current.increase}
120
+ aria-label="Increase"
124
121
  >
125
122
  <svg class="size-3" viewBox="0 0 12 12" fill="none" aria-hidden="true">
126
123
  <path
@@ -137,7 +134,7 @@
137
134
  class={stepper}
138
135
  {disabled}
139
136
  onclick={() => nudge(-1)}
140
- aria-label={t.current.decrease}
137
+ aria-label="Decrease"
141
138
  >
142
139
  <svg class="size-3" viewBox="0 0 12 12" fill="none" aria-hidden="true">
143
140
  <path
@@ -6,7 +6,6 @@
6
6
  import { toneText } from '../../core/tones.js';
7
7
  import { iconMd } from './icon.js';
8
8
  import Spinner from './Spinner.svelte';
9
- import { useLocale } from '../../core/locale.svelte.js';
10
9
  import { soft } from './lift.js';
11
10
 
12
11
  export type ToasterPosition =
@@ -19,8 +18,6 @@
19
18
 
20
19
  let { position = 'bottom-right', class: className = '' }: Props = $props();
21
20
 
22
- const t = useLocale();
23
-
24
21
  const positions: Record<ToasterPosition, string> = {
25
22
  'top-left': 'top-4 left-4 items-start',
26
23
  'top-center': 'top-4 left-1/2 -translate-x-1/2 items-center',
@@ -34,27 +31,43 @@
34
31
  const fromLeft = $derived(position.endsWith('left'));
35
32
  const fromCenter = $derived(position.endsWith('center'));
36
33
 
34
+ /**
35
+ * A card sliding in from the edge of the screen, and a stack of them shuffling
36
+ * to make room, is exactly the motion this preference exists to stop. Under it
37
+ * the toast fades in place and the stack reorders instantly — the state change
38
+ * still reads, it just stops travelling.
39
+ *
40
+ * ponytail: read once at mount. Someone who flips the OS setting mid-session
41
+ * gets the new behaviour on the next load; a live listener is the upgrade.
42
+ */
43
+ const stillness =
44
+ typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;
45
+
37
46
  const enter = $derived(
38
- fromCenter ? { y: fromTop ? -16 : 16, x: 0 } : { x: fromLeft ? -16 : 16, y: 0 }
47
+ stillness
48
+ ? { x: 0, y: 0 }
49
+ : fromCenter
50
+ ? { y: fromTop ? -16 : 16, x: 0 }
51
+ : { x: fromLeft ? -16 : 16, y: 0 }
39
52
  );
40
53
  </script>
41
54
 
42
55
  <div
43
56
  use:portal
44
57
  aria-live="polite"
45
- aria-label={t.current.notifications}
46
- class="pointer-events-none fixed z-[100] flex w-[min(24rem,calc(100vw-2rem))] flex-col gap-2.5 {positions[
58
+ aria-label="Notifications"
59
+ class="pointer-events-none fixed z-100 flex w-[min(24rem,calc(100vw-2rem))] flex-col gap-2.5 {positions[
47
60
  position
48
61
  ]} {fromTop ? '' : 'flex-col-reverse'} {className}"
49
62
  >
50
63
  {#each toast.items as item (item.id)}
51
64
  <!--
52
- sprout puts every toast on the same cream card and lets the glyph
65
+ sprout puts every toast on the same white card and lets the glyph
53
66
  carry the tone. matte tints the whole surface; here a tinted block
54
67
  would fight the warm page underneath.
55
68
  -->
56
69
  <div
57
- animate:flip={{ duration: 200 }}
70
+ animate:flip={{ duration: stillness ? 0 : 200 }}
58
71
  in:fly={{ ...enter, duration: 220 }}
59
72
  out:fly={{ ...enter, duration: 160 }}
60
73
  role={item.tone === 'danger' ? 'alert' : 'status'}
@@ -96,7 +109,7 @@
96
109
  </span>
97
110
 
98
111
  <div class="flex min-w-0 flex-1 flex-col gap-1">
99
- <p class="text-sm leading-snug font-semibold text-text">{item.title}</p>
112
+ <p class="font-heading text-sm leading-snug font-semibold text-text">{item.title}</p>
100
113
  {#if item.description}
101
114
  <p class="text-[13px] leading-relaxed text-text-secondary">{item.description}</p>
102
115
  {/if}
@@ -107,7 +120,7 @@
107
120
  item.action?.onclick();
108
121
  toast.dismiss(item.id);
109
122
  }}
110
- class="mt-1 self-start rounded font-sans text-[13px] font-semibold underline underline-offset-2 {toneText[
123
+ class="mt-1 self-start rounded-md font-sans text-[13px] font-semibold underline underline-offset-2 {toneText[
111
124
  item.tone
112
125
  ]}"
113
126
  >
@@ -119,8 +132,8 @@
119
132
  <button
120
133
  type="button"
121
134
  onclick={() => toast.dismiss(item.id)}
122
- aria-label={t.current.dismiss}
123
- class="-m-1 shrink-0 rounded p-1 text-text-muted transition-colors duration-150 hover:bg-bg-inset hover:text-text focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current"
135
+ aria-label="Dismiss"
136
+ class="-m-1 shrink-0 rounded-xl p-1 text-text-muted transition-colors duration-150 hover:bg-bg-inset hover:text-text focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current"
124
137
  >
125
138
  <svg class="size-3.5" viewBox="0 0 14 14" fill="none" aria-hidden="true">
126
139
  <path
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from 'svelte';
3
+ import { describedBy } from '../../core/trigger.js';
3
4
  import type { HTMLAttributes } from 'svelte/elements';
4
5
  import { soft } from './lift.js';
5
6
 
@@ -14,6 +15,11 @@
14
15
 
15
16
  let { content, placement = 'top', class: className = '', children, ...rest }: Props = $props();
16
17
 
18
+ const uid = $props.id();
19
+ let wrapper: HTMLElement | null = $state(null);
20
+
21
+ $effect(() => describedBy(wrapper, `${uid}-tip`));
22
+
17
23
  const placements: Record<TooltipPlacement, string> = {
18
24
  top: 'bottom-full left-1/2 mb-1.5 -translate-x-1/2',
19
25
  bottom: 'top-full left-1/2 mt-1.5 -translate-x-1/2',
@@ -22,9 +28,10 @@
22
28
  };
23
29
  </script>
24
30
 
25
- <span class="group/tt relative inline-flex" {...rest}>
31
+ <span bind:this={wrapper} class="group/tt relative inline-flex" {...rest}>
26
32
  {@render children()}
27
33
  <span
34
+ id="{uid}-tip"
28
35
  role="tooltip"
29
36
  class="pointer-events-none invisible absolute z-50 rounded-xl bg-text px-2 py-1 font-sans text-xs font-medium whitespace-nowrap text-text-inverse opacity-0 {soft} transition-opacity duration-150 ease-brand-out group-focus-within/tt:visible group-focus-within/tt:opacity-100 group-hover/tt:visible group-hover/tt:opacity-100
30
37
  {placements[placement]} {className}"
@@ -1,13 +1,12 @@
1
1
  /**
2
- * Sprout — Warm and fully rounded — leaf green on cream, pill buttons, and a round display face. For school, community and family sites.
2
+ * Sprout — Warm and fully rounded — leaf green on white, pill buttons, and a round display face. For school, community and family sites.
3
3
  *
4
4
  * Generated by `bun run index`. Behaviour comes from
5
5
  * `@nqmcreative/ui/core`, re-exported below so this one import covers
6
6
  * the whole style.
7
7
  */
8
- export { TONES, focusRing, peerFocusRing, toneBorder, toneBorderLeft, toneBorderSoft, toneFill, toneFocusBorder, toneFocusWithinBorder, toneHoverBorder, toneHoverText, tonePeerChecked, tonePeerFocus, toneRing, toneSoft, toneSoftHover, toneSolid, toneSolidHover, toneSurface, toneText, anchored, clickOutside, focusTrap, focusable, navigateList, portal, toast, locale, setLocale, provideLocale, useLocale, enUS, idID, LocaleStore, applyTheme, storedTheme, toISO, fromISO, today, isSameDay, addDays, addMonths, monthGrid, weekdayNames, monthLabel, isOutOfRange, formatISO, parseFormatted } from '../../core/index.js';
9
- export type { Tone, Placement, AnchorOptions, ClickOutsideOptions, FocusTrapOptions, Toast, ToastOptions, ToastAction, Locale, Theme, DateFormat, TableSort, SortDirection, RejectedFile } from '../../core/index.js';
10
- export { default as LocaleProvider } from './LocaleProvider.svelte';
8
+ export { TONES, focusRing, peerFocusRing, toneBorder, toneBorderLeft, toneBorderSoft, toneFill, toneFocusBorder, toneFocusWithinBorder, focusWithinRing, toneFocusWithinRing, toneHoverBorder, toneHoverText, tonePeerChecked, tonePeerFocus, toneRing, toneSoft, toneSoftHover, toneSolid, toneSolidHover, toneSurface, toneText, anchored, clickOutside, focusTrap, focusable, navigateList, portal, toast, applyTheme, storedTheme, toISO, fromISO, today, isSameDay, addDays, addMonths, monthGrid, weekdayNames, monthLabel, isOutOfRange, formatISO, parseFormatted } from '../../core/index.js';
9
+ export type { Tone, Placement, AnchorOptions, ClickOutsideOptions, FocusTrapOptions, Toast, ToastOptions, ToastAction, Theme, DateFormat, TableSort, SortDirection, RejectedFile } from '../../core/index.js';
11
10
  export { default as Button } from './Button.svelte';
12
11
  export type { ButtonVariant, ButtonSize } from './Button.svelte';
13
12
  export { default as Link } from './Link.svelte';
@@ -1,14 +1,12 @@
1
1
  /**
2
- * Sprout — Warm and fully rounded — leaf green on cream, pill buttons, and a round display face. For school, community and family sites.
2
+ * Sprout — Warm and fully rounded — leaf green on white, pill buttons, and a round display face. For school, community and family sites.
3
3
  *
4
4
  * Generated by `bun run index`. Behaviour comes from
5
5
  * `@nqmcreative/ui/core`, re-exported below so this one import covers
6
6
  * the whole style.
7
7
  */
8
8
  /* --- shared behaviour --- */
9
- export { TONES, focusRing, peerFocusRing, toneBorder, toneBorderLeft, toneBorderSoft, toneFill, toneFocusBorder, toneFocusWithinBorder, toneHoverBorder, toneHoverText, tonePeerChecked, tonePeerFocus, toneRing, toneSoft, toneSoftHover, toneSolid, toneSolidHover, toneSurface, toneText, anchored, clickOutside, focusTrap, focusable, navigateList, portal, toast, locale, setLocale, provideLocale, useLocale, enUS, idID, LocaleStore, applyTheme, storedTheme, toISO, fromISO, today, isSameDay, addDays, addMonths, monthGrid, weekdayNames, monthLabel, isOutOfRange, formatISO, parseFormatted } from '../../core/index.js';
10
- /* --- locale --- */
11
- export { default as LocaleProvider } from './LocaleProvider.svelte';
9
+ export { TONES, focusRing, peerFocusRing, toneBorder, toneBorderLeft, toneBorderSoft, toneFill, toneFocusBorder, toneFocusWithinBorder, focusWithinRing, toneFocusWithinRing, toneHoverBorder, toneHoverText, tonePeerChecked, tonePeerFocus, toneRing, toneSoft, toneSoftHover, toneSolid, toneSolidHover, toneSurface, toneText, anchored, clickOutside, focusTrap, focusable, navigateList, portal, toast, applyTheme, storedTheme, toISO, fromISO, today, isSameDay, addDays, addMonths, monthGrid, weekdayNames, monthLabel, isOutOfRange, formatISO, parseFormatted } from '../../core/index.js';
12
10
  /* --- actions --- */
13
11
  export { default as Button } from './Button.svelte';
14
12
  export { default as Link } from './Link.svelte';
@@ -36,5 +36,19 @@ export declare const float = "shadow-[0_6px_0_0_rgba(20,83,45,0.09),0_28px_60px_
36
36
  * reads as one pressed object.
37
37
  */
38
38
  export declare const lift: Record<Tone, string>;
39
+ /**
40
+ * The quiet lip, for a button that is not a solid fill: `soft` and `outline`.
41
+ *
42
+ * Drawn in the tone's own border colour — the line `outline` already carries —
43
+ * so the bottom reads as that border thickening rather than as a shadow stuck
44
+ * underneath. `soft` has no border of its own, so pairing the two here is what
45
+ * gives both variants the same edge: the only difference left between them is
46
+ * the face above it.
47
+ *
48
+ * Shortens by the same 3px the button travels, exactly like `lift`. Without
49
+ * that second step a pressed button just slides down with its shadow attached
50
+ * and never reads as pressed at all.
51
+ */
52
+ export declare const liftSoft: Record<Tone, string>;
39
53
  /** The same lip at 3px, for things too small to travel: icon tiles, dots. */
40
54
  export declare const liftSm: Record<Tone, string>;
@@ -23,6 +23,29 @@ export const lift = {
23
23
  danger: 'shadow-[0_5px_0_0_color-mix(in_oklab,var(--color-danger)_72%,black)] active:shadow-[0_2px_0_0_color-mix(in_oklab,var(--color-danger)_72%,black)]',
24
24
  neutral: 'shadow-[0_5px_0_0_color-mix(in_oklab,var(--color-neutral)_72%,black)] active:shadow-[0_2px_0_0_color-mix(in_oklab,var(--color-neutral)_72%,black)]'
25
25
  };
26
+ /**
27
+ * The quiet lip, for a button that is not a solid fill: `soft` and `outline`.
28
+ *
29
+ * Drawn in the tone's own border colour — the line `outline` already carries —
30
+ * so the bottom reads as that border thickening rather than as a shadow stuck
31
+ * underneath. `soft` has no border of its own, so pairing the two here is what
32
+ * gives both variants the same edge: the only difference left between them is
33
+ * the face above it.
34
+ *
35
+ * Shortens by the same 3px the button travels, exactly like `lift`. Without
36
+ * that second step a pressed button just slides down with its shadow attached
37
+ * and never reads as pressed at all.
38
+ */
39
+ export const liftSoft = {
40
+ brand: 'shadow-[0_5px_0_0_var(--color-brand-border)] active:shadow-[0_2px_0_0_var(--color-brand-border)]',
41
+ accent: 'shadow-[0_5px_0_0_var(--color-accent-border)] active:shadow-[0_2px_0_0_var(--color-accent-border)]',
42
+ violet: 'shadow-[0_5px_0_0_var(--color-violet-border)] active:shadow-[0_2px_0_0_var(--color-violet-border)]',
43
+ info: 'shadow-[0_5px_0_0_var(--color-info-border)] active:shadow-[0_2px_0_0_var(--color-info-border)]',
44
+ success: 'shadow-[0_5px_0_0_var(--color-success-border)] active:shadow-[0_2px_0_0_var(--color-success-border)]',
45
+ warning: 'shadow-[0_5px_0_0_var(--color-warning-border)] active:shadow-[0_2px_0_0_var(--color-warning-border)]',
46
+ danger: 'shadow-[0_5px_0_0_var(--color-danger-border)] active:shadow-[0_2px_0_0_var(--color-danger-border)]',
47
+ neutral: 'shadow-[0_5px_0_0_var(--color-neutral-border)] active:shadow-[0_2px_0_0_var(--color-neutral-border)]'
48
+ };
26
49
  /** The same lip at 3px, for things too small to travel: icon tiles, dots. */
27
50
  export const liftSm = {
28
51
  brand: 'shadow-[0_3px_0_0_color-mix(in_oklab,var(--color-brand)_72%,black)]',
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * sprout — design tokens.
3
3
  *
4
- * The warm one: leaf green on cream, fully rounded corners, and a display face
4
+ * The warm one: leaf green on white, fully rounded corners, and a display face
5
5
  * with round terminals. Built for school, community and family sites, where the
6
6
  * reader is a parent on a phone rather than an operator at a desk. Import this
7
7
  * after `@import "tailwindcss";` in your app's CSS entry point.
@@ -17,16 +17,21 @@
17
17
  */
18
18
  @theme {
19
19
  /*
20
- * Surfaces are cream rather than white, and the greys are green-cast. A
21
- * neutral grey next to this much foliage reads as a printing error, so every
22
- * step of the scale carries a little of the brand hue.
20
+ * Surfaces are white, and the greys under them are near-neutral with only a
21
+ * hair of warmth. The green belongs to the brand, not to the paper: a page
22
+ * whose every secondary surface and every hover is tinted reads as tiring
23
+ * long before it reads as warm, so the neutrals stay out of the way.
24
+ *
25
+ * `--color-bg` is the face of a card; `--color-bg-alt` is the ground it sits
26
+ * on. Put `bg-bg-alt` on the body and cards float as white, which is the
27
+ * layering this style was drawn from.
23
28
  */
24
29
  /* --- surfaces --- */
25
- --color-bg: #fffefb;
26
- --color-bg-alt: #f0fdf4;
27
- --color-bg-inset: #e3f6e9;
28
- --color-hairline: #ecefe7;
29
- --color-hairline-strong: #d3e0d1;
30
+ --color-bg: #ffffff;
31
+ --color-bg-alt: #f7f7f4;
32
+ --color-bg-inset: #edede8;
33
+ --color-hairline: #e6e6e0;
34
+ --color-hairline-strong: #cfcfc7;
30
35
 
31
36
  /* --- text --- */
32
37
  --color-text: #1a3a1f;
@@ -136,25 +141,25 @@
136
141
  * Every utility built on these tokens follows automatically, so components
137
142
  * need no `dark:` classes of their own.
138
143
  *
139
- * The dark palette is a night garden rather than a neutral slate: the surfaces
140
- * keep the green cast, and every hue lifts a step or two so it still reads
141
- * against them.
144
+ * The dark palette is lamplight rather than a neutral slate: the surfaces carry
145
+ * the same honey cast as the light ones, and every hue lifts a step or two so
146
+ * it still reads against them.
142
147
  */
143
148
  @custom-variant dark (&:where(.dark, .dark *));
144
149
 
145
150
  .dark {
146
151
  color-scheme: dark;
147
152
 
148
- --color-bg: #0e1a11;
149
- --color-bg-alt: #14251a;
150
- --color-bg-inset: #1b3020;
151
- --color-hairline: #1e3524;
152
- --color-hairline-strong: #2f4a36;
153
+ --color-bg: #17140e;
154
+ --color-bg-alt: #211c13;
155
+ --color-bg-inset: #2d261a;
156
+ --color-hairline: #2a2317;
157
+ --color-hairline-strong: #453a27;
153
158
 
154
159
  --color-text: #f0f7f0;
155
160
  --color-text-secondary: #cadfcd;
156
161
  --color-text-muted: #94ad99;
157
- --color-text-inverse: #0e1a11;
162
+ --color-text-inverse: #17140e;
158
163
 
159
164
  --color-brand: #4ade80;
160
165
  --color-brand-hover: #86efac;
@@ -201,16 +206,16 @@
201
206
  :root:not(.light) {
202
207
  color-scheme: dark;
203
208
 
204
- --color-bg: #0e1a11;
205
- --color-bg-alt: #14251a;
206
- --color-bg-inset: #1b3020;
207
- --color-hairline: #1e3524;
208
- --color-hairline-strong: #2f4a36;
209
+ --color-bg: #17140e;
210
+ --color-bg-alt: #211c13;
211
+ --color-bg-inset: #2d261a;
212
+ --color-hairline: #2a2317;
213
+ --color-hairline-strong: #453a27;
209
214
 
210
215
  --color-text: #f0f7f0;
211
216
  --color-text-secondary: #cadfcd;
212
217
  --color-text-muted: #94ad99;
213
- --color-text-inverse: #0e1a11;
218
+ --color-text-inverse: #17140e;
214
219
 
215
220
  --color-brand: #4ade80;
216
221
  --color-brand-hover: #86efac;
@@ -253,3 +258,24 @@
253
258
  --color-neutral-border: #2f4a36;
254
259
  }
255
260
  }
261
+
262
+ /*
263
+ * The surfaces the browser draws for us.
264
+ *
265
+ * A caret and a highlight in the user-agent's blue belong to no design system,
266
+ * and they are the two the reader touches most: one sits in every field they
267
+ * type into, the other appears the moment they drag across a paragraph. The
268
+ * selection is mixed from the brand rather than pinned to a token so it stays
269
+ * a wash — the text underneath keeps its own colour and its own contrast.
270
+ */
271
+ @layer base {
272
+ ::selection {
273
+ background-color: color-mix(in oklab, var(--color-brand) 24%, transparent);
274
+ }
275
+
276
+ input,
277
+ textarea,
278
+ [contenteditable] {
279
+ caret-color: var(--color-brand);
280
+ }
281
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nqmcreative/ui",
3
- "version": "0.4.0",
4
- "description": "Svelte 5 + Tailwind CSS v4 component library — three styles (matte, paper, sprout), 71 components each, one shared behaviour core. No runtime dependencies.",
3
+ "version": "0.4.2",
4
+ "description": "Svelte 5 + Tailwind CSS v4 component library — three styles (matte, paper, sprout), 70 components each, one shared behaviour core. No runtime dependencies.",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
7
7
  "build": "vite build && svelte-kit sync && svelte-package && node scripts/strip-dist-tests.mjs && node scripts/generate-index.mjs && node scripts/generate-exports.mjs && node scripts/generate-registry.mjs && node scripts/generate-scoped-css.mjs && node scripts/generate-demos.mjs && publint",
@@ -42,11 +42,6 @@
42
42
  "svelte": "./dist/core/tones.js",
43
43
  "default": "./dist/core/tones.js"
44
44
  },
45
- "./core/locale": {
46
- "types": "./dist/core/locale.svelte.d.ts",
47
- "svelte": "./dist/core/locale.svelte.js",
48
- "default": "./dist/core/locale.svelte.js"
49
- },
50
45
  "./core/date": {
51
46
  "types": "./dist/core/date.d.ts",
52
47
  "svelte": "./dist/core/date.js",
@@ -91,10 +86,6 @@
91
86
  "types": "./dist/styles/matte/index.d.ts",
92
87
  "svelte": "./dist/styles/matte/index.js"
93
88
  },
94
- "./matte/locale-provider": {
95
- "types": "./dist/styles/matte/LocaleProvider.svelte.d.ts",
96
- "svelte": "./dist/styles/matte/LocaleProvider.svelte"
97
- },
98
89
  "./matte/button": {
99
90
  "types": "./dist/styles/matte/Button.svelte.d.ts",
100
91
  "svelte": "./dist/styles/matte/Button.svelte"
@@ -381,10 +372,6 @@
381
372
  "types": "./dist/styles/paper/index.d.ts",
382
373
  "svelte": "./dist/styles/paper/index.js"
383
374
  },
384
- "./paper/locale-provider": {
385
- "types": "./dist/styles/paper/LocaleProvider.svelte.d.ts",
386
- "svelte": "./dist/styles/paper/LocaleProvider.svelte"
387
- },
388
375
  "./paper/button": {
389
376
  "types": "./dist/styles/paper/Button.svelte.d.ts",
390
377
  "svelte": "./dist/styles/paper/Button.svelte"
@@ -671,10 +658,6 @@
671
658
  "types": "./dist/styles/sprout/index.d.ts",
672
659
  "svelte": "./dist/styles/sprout/index.js"
673
660
  },
674
- "./sprout/locale-provider": {
675
- "types": "./dist/styles/sprout/LocaleProvider.svelte.d.ts",
676
- "svelte": "./dist/styles/sprout/LocaleProvider.svelte"
677
- },
678
661
  "./sprout/button": {
679
662
  "types": "./dist/styles/sprout/Button.svelte.d.ts",
680
663
  "svelte": "./dist/styles/sprout/Button.svelte"