@urbicon-ui/blocks 6.34.0 → 6.35.0

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 (30) hide show
  1. package/README.md +11 -1
  2. package/dist/components/Calendar/CalendarHeader.svelte +32 -26
  3. package/dist/components/Calendar/CalendarMiniMonth.svelte +10 -10
  4. package/dist/components/Calendar/calendar.variants.js +19 -5
  5. package/dist/components/FileUpload/FileUpload.svelte +17 -2
  6. package/dist/components/Planner/PlannerHeader.svelte +16 -13
  7. package/dist/components/Planner/planner.variants.js +14 -3
  8. package/dist/i18n/index.d.ts +268 -382
  9. package/dist/i18n/index.js +83 -9
  10. package/dist/internal/core/CoreIconButton.svelte +66 -0
  11. package/dist/internal/core/CoreIconButton.svelte.d.ts +13 -0
  12. package/dist/internal/core/CoreSpinner.svelte +49 -0
  13. package/dist/internal/core/CoreSpinner.svelte.d.ts +8 -0
  14. package/dist/internal/core/spinner-geometry.d.ts +6 -0
  15. package/dist/internal/core/spinner-geometry.js +6 -0
  16. package/dist/mint/registry.d.ts +20 -2
  17. package/dist/mint/registry.js +20 -2
  18. package/dist/primitives/Badge/Badge.svelte +5 -5
  19. package/dist/primitives/Badge/badge.variants.js +17 -1
  20. package/dist/primitives/Button/Button.svelte +4 -2
  21. package/dist/primitives/Dialog/Dialog.svelte +7 -5
  22. package/dist/primitives/Dialog/dialog.variants.d.ts +7 -0
  23. package/dist/primitives/Dialog/dialog.variants.js +17 -0
  24. package/dist/primitives/Drawer/Drawer.svelte +7 -5
  25. package/dist/primitives/Drawer/drawer.variants.d.ts +8 -0
  26. package/dist/primitives/Drawer/drawer.variants.js +17 -0
  27. package/dist/primitives/Spinner/Spinner.svelte +3 -1
  28. package/dist/primitives/Toast/Toaster.svelte +17 -2
  29. package/dist/utils/variants.js +44 -10
  30. package/package.json +4 -6
package/README.md CHANGED
@@ -107,7 +107,17 @@ Re-exports `@urbicon-ui/i18n`. Components with text content (Pagination, Menu, C
107
107
  </I18nProvider>
108
108
  ```
109
109
 
110
- For the provider/hook API, typed keys, SSR locale resolution, and opt-in lazy loading see the [@urbicon-ui/i18n](../i18n/) package.
110
+ **English is bundled eagerly; German is lazy.** The `de` catalog is a dynamic-import chunk, so an English-only app never bundles it. Before that chunk loads, `de` keys resolve to the English fallback (never the raw key). The provider loads `de` client-side on mount, which means a **server-rendered German app** would paint English first and flip on hydration. Fix it by registering `de` eagerly once at server start:
111
+
112
+ ```ts
113
+ // src/hooks.server.ts (evaluated once at server start — SSR-safe, static data)
114
+ import { registerBlocksLocale } from '@urbicon-ui/blocks';
115
+ import de from '@urbicon-ui/blocks/i18n/de';
116
+
117
+ registerBlocksLocale('de', de);
118
+ ```
119
+
120
+ For the provider/hook API, typed keys, SSR locale resolution, and the code-splitting + eager-register details see the [@urbicon-ui/i18n](../i18n/) package.
111
121
 
112
122
  ## Development
113
123
 
@@ -3,7 +3,8 @@
3
3
  import { Tooltip } from '../../primitives/Tooltip';
4
4
  import { Popover } from '../../primitives/Popover';
5
5
  import { SegmentGroup, SegmentItem } from '../../primitives/SegmentGroup';
6
- import { Button } from '../../primitives/Button';
6
+ // internal core, not the public component — keeps the public-to-public import graph clean (see internal/core/)
7
+ import CoreIconButton from '../../internal/core/CoreIconButton.svelte';
7
8
  import ChevronLeftIcon from '../../icons/ChevronLeftIcon.svelte';
8
9
  import ChevronRightIcon from '../../icons/ChevronRightIcon.svelte';
9
10
  import ChevronDownIcon from '../../icons/ChevronDownIcon.svelte';
@@ -125,18 +126,24 @@
125
126
  {@render children()}
126
127
  </div>
127
128
  {:else}
129
+ <!--
130
+ All header buttons render on the internal CoreIconButton (was `<Button
131
+ unstyled mint="none">`, which emitted only the call-site classes). The
132
+ core's plumbing overlaps the navButton slot's old baseline (inline-flex
133
+ centring, focus-visible reset, disabled opacity/cursor — now supplied by
134
+ the core, stripped from the slot); the deliberate deltas it introduces are
135
+ documented on the slot in calendar.variants.ts.
136
+ -->
128
137
  <div class={slot('header', className)} {...restProps}>
129
138
  <div class={slot('nav')}>
130
- <Button
131
- unstyled
132
- mint="none"
139
+ <CoreIconButton
133
140
  class={slot('navButton')}
134
141
  onclick={() => ctx.navigate(-1)}
135
142
  disabled={!ctx.canGoBack || ctx.disabled}
136
143
  aria-label={prevLabel}
137
144
  >
138
145
  <ChevronLeftIcon size={navIconSize} />
139
- </Button>
146
+ </CoreIconButton>
140
147
  </div>
141
148
 
142
149
  <div class="flex items-center gap-2">
@@ -162,40 +169,43 @@
162
169
  {/snippet}
163
170
  <div class="min-w-48 p-3">
164
171
  <div class="mb-2 flex items-center justify-between">
165
- <Button
166
- unstyled
167
- mint="none"
172
+ <CoreIconButton
168
173
  class={slot('navButton')}
169
174
  onclick={() => pickerYear--}
170
175
  aria-label={bt('calendar.previousYear')}
171
176
  >
172
177
  <ChevronLeftIcon size={pickerIconSize} />
173
- </Button>
178
+ </CoreIconButton>
174
179
  <span class="text-text-primary font-semibold tabular-nums">{pickerYear}</span>
175
- <Button
176
- unstyled
177
- mint="none"
180
+ <CoreIconButton
178
181
  class={slot('navButton')}
179
182
  onclick={() => pickerYear++}
180
183
  aria-label={bt('calendar.nextYear')}
181
184
  >
182
185
  <ChevronRightIcon size={pickerIconSize} />
183
- </Button>
186
+ </CoreIconButton>
184
187
  </div>
185
188
  <div class="grid grid-cols-3 gap-1">
186
189
  {#each months as m (m.index)}
187
- <Button
188
- unstyled
189
- mint="none"
190
+ <!--
191
+ Text-labelled month cell on the same CoreIconButton as the nav
192
+ buttons (removes the last CalendarHeader→Button edge). The core
193
+ REQUIRES aria-label, so it gets the visible label — the accessible
194
+ name stays the identical string. Never rendered disabled (the
195
+ picker closes when the calendar is disabled), so the core's
196
+ disabled plumbing is inert here.
197
+ -->
198
+ <CoreIconButton
190
199
  class="text-text-primary rounded-md px-2 py-1.5 text-sm transition-colors
191
200
  {m.isCurrent
192
201
  ? 'bg-primary-subtle ring-primary text-primary font-semibold ring-1'
193
202
  : 'hover:bg-surface-hover'}
194
- focus-visible:ring-primary/50 focus-visible:ring-2 focus-visible:outline-none"
203
+ focus-visible:ring-primary/50 focus-visible:ring-2"
195
204
  onclick={() => selectMonth(m.index)}
205
+ aria-label={m.label}
196
206
  >
197
207
  {m.label}
198
- </Button>
208
+ </CoreIconButton>
199
209
  {/each}
200
210
  </div>
201
211
  </div>
@@ -221,29 +231,25 @@
221
231
 
222
232
  {#if showToday}
223
233
  <Tooltip label={bt('calendar.today')}>
224
- <Button
225
- unstyled
226
- mint="none"
234
+ <CoreIconButton
227
235
  class="{slot('navButton')} ml-1"
228
236
  onclick={() => ctx.goToToday()}
229
237
  disabled={!ctx.canGoToToday || ctx.disabled}
230
238
  aria-label={bt('calendar.today')}
231
239
  >
232
240
  <CalendarIcon size={navIconSize} />
233
- </Button>
241
+ </CoreIconButton>
234
242
  </Tooltip>
235
243
  {/if}
236
244
 
237
- <Button
238
- unstyled
239
- mint="none"
245
+ <CoreIconButton
240
246
  class={slot('navButton')}
241
247
  onclick={() => ctx.navigate(1)}
242
248
  disabled={!ctx.canGoForward || ctx.disabled}
243
249
  aria-label={nextLabel}
244
250
  >
245
251
  <ChevronRightIcon size={navIconSize} />
246
- </Button>
252
+ </CoreIconButton>
247
253
  </div>
248
254
  </div>
249
255
  {/if}
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { useBlocksI18n } from '../..';
3
- import { Button } from '../../primitives/Button';
3
+ // internal core, not the public component — keeps the public-to-public import graph clean (see internal/core/)
4
+ import CoreIconButton from '../../internal/core/CoreIconButton.svelte';
4
5
  import { getCalendarContext, createSlotHelper } from './calendar.context';
5
6
  import {
6
7
  getMonthGrid,
@@ -118,27 +119,26 @@
118
119
  </script>
119
120
 
120
121
  <div class={slot('miniCalendar', className)}>
121
- <!-- Mini header -->
122
+ <!-- Mini header. Nav buttons render on the internal CoreIconButton (was
123
+ `<Button unstyled mint="none">`); the plumbing/slot split is documented
124
+ on the miniCalendarNavButton slot in calendar.variants.ts. Never
125
+ disabled, so the core's disabled plumbing is inert here. -->
122
126
  <div class={slot('miniCalendarHeader')}>
123
- <Button
124
- unstyled
125
- mint="none"
127
+ <CoreIconButton
126
128
  class={slot('miniCalendarNavButton')}
127
129
  onclick={() => navigateMini(-1)}
128
130
  aria-label={bt('calendar.previousMonth')}
129
131
  >
130
132
 
131
- </Button>
133
+ </CoreIconButton>
132
134
  <span class={slot('miniCalendarTitle')}>{miniTitle}</span>
133
- <Button
134
- unstyled
135
- mint="none"
135
+ <CoreIconButton
136
136
  class={slot('miniCalendarNavButton')}
137
137
  onclick={() => navigateMini(1)}
138
138
  aria-label={bt('calendar.nextMonth')}
139
139
  >
140
140
 
141
- </Button>
141
+ </CoreIconButton>
142
142
  </div>
143
143
 
144
144
  <!-- Weekday headers — narrow names duplicate in many locales (de-DE: M, D,
@@ -7,12 +7,23 @@ export const calendarVariants = tv({
7
7
  header: ['flex items-center justify-between', 'border-b border-border-hairline'],
8
8
  title: 'font-semibold text-text-primary select-none',
9
9
  nav: 'flex items-center gap-1',
10
+ // Rendered on the internal CoreIconButton (behaviour-only base: inline-flex
11
+ // centring, cursor/select affordance, focus-visible reset, disabled
12
+ // opacity/cursor/inertness), so this slot carries only the visual identity
13
+ // on top — the classes the core already supplies (inline-flex items-center
14
+ // justify-center, focus-visible:outline-none, disabled:opacity-50,
15
+ // disabled:cursor-not-allowed) are not repeated here. Deliberate deltas vs.
16
+ // the old `<Button unstyled mint="none">` render (which had NO plumbing):
17
+ // `cursor-pointer` (was the UA arrow — Tailwind 4 preflight doesn't set it;
18
+ // now consistent with every styled Button) and `disabled:pointer-events-none`
19
+ // (a disabled nav button is fully inert: no more hover-bg feedback or
20
+ // not-allowed cursor while disabled — matching the styled Button base).
21
+ // Mirrors planner.variants navButton. See internal/core/.
10
22
  navButton: [
11
- 'inline-flex items-center justify-center rounded-md',
23
+ 'rounded-md',
12
24
  'text-text-secondary hover:bg-surface-hover hover:text-text-primary',
13
25
  'transition-colors duration-[var(--blocks-duration-fast)]',
14
- 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2',
15
- 'disabled:opacity-50 disabled:cursor-not-allowed'
26
+ 'focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2'
16
27
  ],
17
28
  // Grid
18
29
  grid: 'w-full',
@@ -131,11 +142,14 @@ export const calendarVariants = tv({
131
142
  miniCalendar: ['shrink-0 flex flex-col', 'border-r border-border-hairline'],
132
143
  miniCalendarHeader: 'flex items-center justify-between',
133
144
  miniCalendarTitle: 'font-semibold text-text-primary text-center select-none',
145
+ // Rendered on the internal CoreIconButton — same plumbing/slot split as
146
+ // `navButton` above (and the same deliberate cursor-pointer delta); these
147
+ // buttons are never disabled, so the disabled plumbing is inert.
134
148
  miniCalendarNavButton: [
135
- 'inline-flex items-center justify-center rounded-md',
149
+ 'rounded-md',
136
150
  'text-text-secondary hover:bg-surface-hover hover:text-text-primary',
137
151
  'transition-colors duration-[var(--blocks-duration-fast)]',
138
- 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50'
152
+ 'focus-visible:ring-2 focus-visible:ring-primary/50'
139
153
  ],
140
154
  miniCalendarWeekday: 'text-center text-text-tertiary select-none font-medium',
141
155
  miniCalendarDay: [
@@ -17,7 +17,8 @@
17
17
  import DangerCircleIconDefault from '../../icons/DangerCircleIcon.svelte';
18
18
  import { mintRegistry } from '../../mint';
19
19
  import { Progress } from '../../primitives/Progress';
20
- import { Spinner } from '../../primitives/Spinner';
20
+ // internal core, not the public component — keeps the public-to-public import graph clean (see internal/core/)
21
+ import CoreSpinner from '../../internal/core/CoreSpinner.svelte';
21
22
  import { fly } from 'svelte/transition';
22
23
  import { quintOut } from 'svelte/easing';
23
24
  import { onDestroy } from 'svelte';
@@ -520,7 +521,21 @@
520
521
  <!-- Status indicator -->
521
522
  <div class={slot('fileItemStatusIcon')}>
522
523
  {#if entry.status === 'uploading'}
523
- <Spinner size="xs" visible />
524
+ <!--
525
+ CoreSpinner instead of the public Spinner (see internal/core/).
526
+ The old call was `visible` (explicitly true) with no label
527
+ override, and this branch already gates rendering on the
528
+ uploading status — so the core needs no {#if} of its own.
529
+ Deliberate a11y delta: the old Spinner emitted role="status" +
530
+ aria-live + an sr-only "Loading..." inside the file list's own
531
+ aria-live="polite" region (nested live regions); the core emits
532
+ no semantics — the list region owns announcements. `text-primary`
533
+ pins the old default color (the public Spinner's intent default),
534
+ matching the explicit text-success/text-danger on the sibling
535
+ status icons; it wins the duel against the core's `text-current`
536
+ by stylesheet order (theme colors sort after keyword colors).
537
+ -->
538
+ <CoreSpinner size="xs" class="text-primary" />
524
539
  {:else if entry.status === 'complete'}
525
540
  <CheckCircleIcon size={itemIconSize} class="text-success" />
526
541
  {:else if entry.status === 'error'}
@@ -6,7 +6,8 @@
6
6
  -->
7
7
  <script lang="ts">
8
8
  import { useBlocksI18n } from '../..';
9
- import { Button } from '../../primitives/Button';
9
+ // internal core, not the public component — keeps the public-to-public import graph clean (see internal/core/)
10
+ import CoreIconButton from '../../internal/core/CoreIconButton.svelte';
10
11
  import { Tooltip } from '../../primitives/Tooltip';
11
12
  import { resolveIcon } from '../../icons';
12
13
  import ChevronLeftIconDefault from '../../icons/ChevronLeftIcon.svelte';
@@ -37,44 +38,46 @@
37
38
  );
38
39
  </script>
39
40
 
41
+ <!--
42
+ Nav buttons render on the internal CoreIconButton (was `<Button unstyled
43
+ mint="none">`, which emitted only the call-site classes). The core's plumbing
44
+ overlaps the navButton slot's old baseline (inline-flex centring, focus-visible
45
+ reset, disabled opacity/cursor — now supplied by the core, stripped from the
46
+ slot); the deliberate deltas it introduces are documented on the slot in
47
+ planner.variants.ts.
48
+ -->
40
49
  <div class={ctx.slot('header')}>
41
50
  <div class={ctx.slot('nav')}>
42
- <Button
43
- unstyled
44
- mint="none"
51
+ <CoreIconButton
45
52
  class={ctx.slot('navButton')}
46
53
  onclick={() => ctx.navigate(-1)}
47
54
  disabled={!ctx.canGoBack || ctx.disabled}
48
55
  aria-label={prevLabel}
49
56
  >
50
57
  <ChevronLeftIcon size={16} />
51
- </Button>
58
+ </CoreIconButton>
52
59
  </div>
53
60
 
54
61
  <span class={ctx.slot('headerTitle')}>{ctx.title}</span>
55
62
 
56
63
  <div class={ctx.slot('nav')}>
57
64
  <Tooltip label={bt('planner.today')}>
58
- <Button
59
- unstyled
60
- mint="none"
65
+ <CoreIconButton
61
66
  class={ctx.slot('navButton')}
62
67
  onclick={() => ctx.goToToday()}
63
68
  disabled={!ctx.canGoToToday || ctx.disabled}
64
69
  aria-label={bt('planner.today')}
65
70
  >
66
71
  <CalendarDaysIcon size={16} />
67
- </Button>
72
+ </CoreIconButton>
68
73
  </Tooltip>
69
- <Button
70
- unstyled
71
- mint="none"
74
+ <CoreIconButton
72
75
  class={ctx.slot('navButton')}
73
76
  onclick={() => ctx.navigate(1)}
74
77
  disabled={!ctx.canGoForward || ctx.disabled}
75
78
  aria-label={nextLabel}
76
79
  >
77
80
  <ChevronRightIcon size={16} />
78
- </Button>
81
+ </CoreIconButton>
79
82
  </div>
80
83
  </div>
@@ -14,12 +14,23 @@ export const plannerVariants = tv({
14
14
  header: ['flex items-center justify-between gap-2', 'border-b border-border-hairline'],
15
15
  headerTitle: 'font-semibold text-text-primary select-none tabular-nums',
16
16
  nav: 'flex items-center gap-1',
17
+ // Rendered on the internal CoreIconButton (behaviour-only base: inline-flex
18
+ // centring, cursor/select affordance, focus-visible reset, disabled
19
+ // opacity/cursor/inertness), so this slot carries only the visual identity
20
+ // on top — the classes the core already supplies (inline-flex items-center
21
+ // justify-center, focus-visible:outline-none, disabled:opacity-50,
22
+ // disabled:cursor-not-allowed) are not repeated here. Deliberate deltas vs.
23
+ // the old `<Button unstyled mint="none">` render (which had NO plumbing):
24
+ // `cursor-pointer` (was the UA arrow — Tailwind 4 preflight doesn't set it;
25
+ // now consistent with every styled Button) and `disabled:pointer-events-none`
26
+ // (a disabled nav button is fully inert: no more hover-bg feedback or
27
+ // not-allowed cursor while disabled — matching the styled Button base).
28
+ // Mirrors calendar.variants navButton. See internal/core/.
17
29
  navButton: [
18
- 'inline-flex items-center justify-center rounded-md',
30
+ 'rounded-md',
19
31
  'text-text-secondary hover:bg-surface-hover hover:text-text-primary',
20
32
  'transition-colors duration-[var(--blocks-duration-fast)]',
21
- 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2',
22
- 'disabled:opacity-50 disabled:cursor-not-allowed'
33
+ 'focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2'
23
34
  ],
24
35
  // Grid scaffolding
25
36
  grid: 'w-full',