@urbicon-ui/blocks 6.2.0 → 6.3.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 (147) hide show
  1. package/dist/components/AreaChart/AreaChart.svelte +2 -6
  2. package/dist/components/BarChart/BarChart.svelte +2 -6
  3. package/dist/components/Calendar/Calendar.svelte +12 -10
  4. package/dist/components/Calendar/calendar.variants.d.ts +2 -1
  5. package/dist/components/Calendar/index.d.ts +2 -2
  6. package/dist/components/CommandPalette/CommandPalette.svelte +106 -39
  7. package/dist/components/CommandPalette/commandPalette.variants.d.ts +3 -7
  8. package/dist/components/CommandPalette/commandPalette.variants.js +0 -1
  9. package/dist/components/CommandPalette/index.d.ts +2 -2
  10. package/dist/components/CompositionBar/CompositionBar.svelte +12 -15
  11. package/dist/components/CompositionBar/composition-bar.variants.d.ts +3 -1
  12. package/dist/components/CompositionBar/index.d.ts +2 -2
  13. package/dist/components/DonutChart/DonutChart.svelte +2 -6
  14. package/dist/components/EmptyState/EmptyState.svelte +8 -9
  15. package/dist/components/EmptyState/emptyState.variants.d.ts +3 -1
  16. package/dist/components/EmptyState/index.d.ts +3 -3
  17. package/dist/components/FileUpload/FileUpload.svelte +17 -17
  18. package/dist/components/FileUpload/fileUpload.variants.d.ts +3 -11
  19. package/dist/components/FileUpload/fileUpload.variants.js +0 -5
  20. package/dist/components/FileUpload/index.d.ts +4 -3
  21. package/dist/components/Guide/Guide.svelte +5 -8
  22. package/dist/components/Guide/GuideArticle.svelte +5 -8
  23. package/dist/components/Guide/GuideBeacon.svelte +5 -8
  24. package/dist/components/Guide/GuideHint.svelte +5 -8
  25. package/dist/components/Guide/GuideMarker.svelte +5 -8
  26. package/dist/components/Guide/GuideMention.svelte +5 -8
  27. package/dist/components/Guide/GuidePanel.svelte +5 -8
  28. package/dist/components/Guide/guide.variants.d.ts +9 -1
  29. package/dist/components/Guide/index.d.ts +12 -9
  30. package/dist/components/LineChart/LineChart.svelte +2 -6
  31. package/dist/components/Planner/Planner.svelte +7 -10
  32. package/dist/components/Planner/index.d.ts +4 -4
  33. package/dist/components/Planner/planner.variants.d.ts +3 -1
  34. package/dist/components/Sankey/Sankey.svelte +8 -9
  35. package/dist/components/Sankey/index.d.ts +2 -2
  36. package/dist/components/Sankey/sankey.variants.d.ts +3 -1
  37. package/dist/components/SidebarLayout/SidebarLayout.svelte +17 -17
  38. package/dist/components/SidebarLayout/index.d.ts +8 -2
  39. package/dist/components/SidebarLayout/sidebar-layout.variants.d.ts +3 -1
  40. package/dist/components/ThemeSwitcher/ThemeSwitcher.svelte +30 -38
  41. package/dist/components/ThemeSwitcher/index.d.ts +6 -4
  42. package/dist/components/ThemeSwitcher/themeSwitcher.variants.d.ts +3 -1
  43. package/dist/primitives/Accordion/Accordion.svelte +7 -9
  44. package/dist/primitives/Accordion/AccordionItem.svelte +8 -20
  45. package/dist/primitives/Accordion/accordion.variants.d.ts +3 -1
  46. package/dist/primitives/Accordion/index.d.ts +6 -6
  47. package/dist/primitives/Alert/Alert.svelte +7 -21
  48. package/dist/primitives/Alert/alert.variants.d.ts +3 -1
  49. package/dist/primitives/Alert/index.d.ts +3 -3
  50. package/dist/primitives/Avatar/Avatar.svelte +17 -20
  51. package/dist/primitives/Avatar/avatar.variants.d.ts +3 -1
  52. package/dist/primitives/Avatar/index.d.ts +3 -3
  53. package/dist/primitives/Badge/Badge.svelte +2 -2
  54. package/dist/primitives/Badge/badge.variants.d.ts +3 -1
  55. package/dist/primitives/Badge/index.d.ts +2 -2
  56. package/dist/primitives/Breadcrumb/Breadcrumb.svelte +30 -32
  57. package/dist/primitives/Breadcrumb/breadcrumb.variants.d.ts +3 -1
  58. package/dist/primitives/Breadcrumb/index.d.ts +2 -2
  59. package/dist/primitives/Button/Button.svelte +21 -21
  60. package/dist/primitives/Button/button.variants.d.ts +3 -1
  61. package/dist/primitives/Button/index.d.ts +3 -3
  62. package/dist/primitives/ButtonGroup/ButtonGroup.svelte +15 -14
  63. package/dist/primitives/ButtonGroup/buttongroup.variants.d.ts +3 -1
  64. package/dist/primitives/ButtonGroup/index.d.ts +3 -2
  65. package/dist/primitives/Card/Card.svelte +15 -18
  66. package/dist/primitives/Card/card.variants.d.ts +3 -1
  67. package/dist/primitives/Card/index.d.ts +3 -3
  68. package/dist/primitives/Checkbox/Checkbox.svelte +20 -20
  69. package/dist/primitives/Checkbox/checkbox.variants.d.ts +3 -1
  70. package/dist/primitives/Checkbox/index.d.ts +7 -3
  71. package/dist/primitives/Collapsible/Collapsible.svelte +30 -30
  72. package/dist/primitives/Collapsible/collapsible.variants.d.ts +3 -1
  73. package/dist/primitives/Collapsible/index.d.ts +3 -3
  74. package/dist/primitives/Combobox/Combobox.svelte +20 -31
  75. package/dist/primitives/Combobox/combobox.variants.d.ts +3 -1
  76. package/dist/primitives/Combobox/index.d.ts +5 -3
  77. package/dist/primitives/Dialog/Dialog.svelte +7 -10
  78. package/dist/primitives/Dialog/dialog.variants.d.ts +3 -1
  79. package/dist/primitives/Dialog/index.d.ts +2 -2
  80. package/dist/primitives/Drawer/Drawer.svelte +7 -10
  81. package/dist/primitives/Drawer/drawer.variants.d.ts +3 -1
  82. package/dist/primitives/Drawer/index.d.ts +2 -2
  83. package/dist/primitives/Input/Input.svelte +54 -30
  84. package/dist/primitives/Input/index.d.ts +7 -3
  85. package/dist/primitives/Input/input.variants.d.ts +3 -1
  86. package/dist/primitives/Menu/Menu.svelte +23 -23
  87. package/dist/primitives/Menu/index.d.ts +4 -1
  88. package/dist/primitives/Menu/menu.variants.d.ts +3 -1
  89. package/dist/primitives/Pagination/Pagination.svelte +18 -16
  90. package/dist/primitives/Pagination/index.d.ts +2 -2
  91. package/dist/primitives/Pagination/pagination.variants.d.ts +3 -1
  92. package/dist/primitives/Popover/Popover.svelte +2 -6
  93. package/dist/primitives/Progress/Progress.svelte +17 -17
  94. package/dist/primitives/Progress/index.d.ts +8 -3
  95. package/dist/primitives/Progress/progress.variants.d.ts +3 -1
  96. package/dist/primitives/RadioGroup/RadioGroup.svelte +16 -16
  97. package/dist/primitives/RadioGroup/RadioItem.svelte +19 -19
  98. package/dist/primitives/RadioGroup/index.d.ts +3 -3
  99. package/dist/primitives/RadioGroup/radioGroup.variants.d.ts +4 -1
  100. package/dist/primitives/SegmentGroup/SegmentGroup.svelte +14 -11
  101. package/dist/primitives/SegmentGroup/SegmentItem.svelte +12 -11
  102. package/dist/primitives/SegmentGroup/index.d.ts +3 -3
  103. package/dist/primitives/SegmentGroup/segmentgroup.variants.d.ts +3 -1
  104. package/dist/primitives/Select/Select.svelte +31 -22
  105. package/dist/primitives/Select/index.d.ts +8 -3
  106. package/dist/primitives/Select/select.variants.d.ts +3 -1
  107. package/dist/primitives/Separator/Separator.svelte +2 -6
  108. package/dist/primitives/Sidebar/Sidebar.svelte +6 -9
  109. package/dist/primitives/Sidebar/index.d.ts +2 -2
  110. package/dist/primitives/Sidebar/sidebar.variants.d.ts +3 -1
  111. package/dist/primitives/Skeleton/Skeleton.svelte +7 -9
  112. package/dist/primitives/Skeleton/index.d.ts +3 -3
  113. package/dist/primitives/Skeleton/skeleton.variants.d.ts +3 -1
  114. package/dist/primitives/Skeleton/skeleton.variants.js +5 -6
  115. package/dist/primitives/Slider/Slider.svelte +19 -19
  116. package/dist/primitives/Slider/index.d.ts +8 -3
  117. package/dist/primitives/Slider/slider.variants.d.ts +3 -1
  118. package/dist/primitives/Spinner/Spinner.svelte +7 -9
  119. package/dist/primitives/Spinner/index.d.ts +5 -3
  120. package/dist/primitives/Spinner/spinner.variants.d.ts +3 -1
  121. package/dist/primitives/Stepper/Stepper.svelte +13 -18
  122. package/dist/primitives/Stepper/StepperStep.svelte +18 -19
  123. package/dist/primitives/Stepper/index.d.ts +5 -5
  124. package/dist/primitives/Stepper/stepper.variants.d.ts +3 -1
  125. package/dist/primitives/Tab/Tab.svelte +14 -17
  126. package/dist/primitives/Tab/TabItem.svelte +18 -19
  127. package/dist/primitives/Tab/TabPanel.svelte +10 -13
  128. package/dist/primitives/Tab/index.d.ts +7 -7
  129. package/dist/primitives/Tab/tab.variants.d.ts +3 -1
  130. package/dist/primitives/Textarea/Textarea.svelte +23 -23
  131. package/dist/primitives/Textarea/index.d.ts +7 -3
  132. package/dist/primitives/Textarea/textarea.variants.d.ts +3 -1
  133. package/dist/primitives/Toast/Toaster.svelte +5 -6
  134. package/dist/primitives/Toast/index.d.ts +2 -2
  135. package/dist/primitives/Toast/toast.variants.d.ts +3 -1
  136. package/dist/primitives/Toggle/Toggle.svelte +19 -19
  137. package/dist/primitives/Toggle/index.d.ts +7 -3
  138. package/dist/primitives/Toggle/toggle.variants.d.ts +3 -1
  139. package/dist/primitives/Toolbar/Toolbar.svelte +7 -9
  140. package/dist/primitives/Toolbar/index.d.ts +4 -3
  141. package/dist/primitives/Toolbar/toolbar.variants.d.ts +3 -1
  142. package/dist/primitives/Tooltip/Tooltip.svelte +7 -9
  143. package/dist/primitives/Tooltip/index.d.ts +2 -2
  144. package/dist/primitives/Tooltip/tooltip.variants.d.ts +3 -1
  145. package/dist/style/semantic.css +5 -0
  146. package/dist/utils/variants.d.ts +17 -0
  147. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { useBlocksI18n } from '../..';
3
- import { getBlocksConfig, mergeSlotClasses, resolvePresetSlotClasses } from '../../provider';
3
+ import { getBlocksConfig, resolveSlotClasses } from '../../provider';
4
4
  import { resolveIcon } from '../../icons';
5
5
  import CloseIconDefault from '../../icons/CloseIcon.svelte';
6
6
  import { onDestroy } from 'svelte';
@@ -14,7 +14,7 @@
14
14
  import { overlayStack, getOverlayMotion } from '../../utils';
15
15
  import Button from '../Button/Button.svelte';
16
16
  import type { DialogProps } from './index';
17
- import { dialogVariants } from './dialog.variants';
17
+ import { dialogVariants, type DialogVariants } from './dialog.variants';
18
18
 
19
19
  const bt = useBlocksI18n();
20
20
 
@@ -62,13 +62,6 @@
62
62
 
63
63
  const blocksConfig = getBlocksConfig();
64
64
  const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
65
- const slotClasses = $derived(
66
- mergeSlotClasses(
67
- blocksConfig?.defaults?.Dialog?.slotClasses,
68
- resolvePresetSlotClasses(blocksConfig?.presets, 'Dialog', preset),
69
- slotClassesProp
70
- )
71
- );
72
65
 
73
66
  let dialogEl = $state<HTMLDialogElement>();
74
67
  let panelEl = $state<HTMLElement>();
@@ -82,7 +75,11 @@
82
75
  const bodyId = `dialog-body-${uid}`;
83
76
  const overlayId = `dialog-${uid}`;
84
77
 
85
- const styles = $derived(dialogVariants({ size, placement, intent }));
78
+ const variantProps: DialogVariants = $derived({ size, placement, intent });
79
+ const styles = $derived(dialogVariants(variantProps));
80
+ const slotClasses = $derived(
81
+ resolveSlotClasses(blocksConfig, 'Dialog', preset, variantProps, slotClassesProp)
82
+ );
86
83
 
87
84
  function requestClose() {
88
85
  if (!isVisible || !open) return;
@@ -1,4 +1,4 @@
1
- import { type VariantProps } from '../../utils/variants';
1
+ import { type SlotNames, type VariantProps } from '../../utils/variants';
2
2
  export declare const dialogVariants: (props?: import("../../utils/variants").TVProps<{
3
3
  size: {
4
4
  sm: {
@@ -103,3 +103,5 @@ export declare const dialogVariants: (props?: import("../../utils/variants").TVP
103
103
  }) | undefined) => string;
104
104
  };
105
105
  export type DialogVariants = VariantProps<typeof dialogVariants>;
106
+ /** Slot names derived from the `tv()` config above — single source of truth for `slotClasses`. */
107
+ export type DialogSlots = SlotNames<typeof dialogVariants>;
@@ -1,6 +1,6 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { HTMLDialogAttributes } from 'svelte/elements';
3
- import type { DialogVariants } from './dialog.variants';
3
+ import type { DialogSlots, DialogVariants } from './dialog.variants';
4
4
  /**
5
5
  * @description Overlay dialog built on native dialog element. Can be used as a simple
6
6
  * content-agnostic overlay or as a structured dialog with title, footer, and intent accent.
@@ -76,7 +76,7 @@ export interface DialogProps extends Omit<HTMLDialogAttributes, 'children' | 'op
76
76
  /** Strip all default styles. Combine with slotClasses for fully custom appearance. */
77
77
  unstyled?: boolean;
78
78
  /** Per-slot class overrides merged with variant styles. */
79
- slotClasses?: Partial<Record<'dialog' | 'backdrop' | 'panel' | 'content' | 'header' | 'title' | 'body' | 'footer', string>>;
79
+ slotClasses?: Partial<Record<DialogSlots, string>>;
80
80
  /**
81
81
  * Apply a named preset registered via `<BlocksProvider presets={{ Dialog: {...} }}>`.
82
82
  * Prefer this over `class` overrides when the requested look falls outside the
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { useBlocksI18n } from '../..';
3
- import { getBlocksConfig, mergeSlotClasses, resolvePresetSlotClasses } from '../../provider';
3
+ import { getBlocksConfig, resolveSlotClasses } from '../../provider';
4
4
  import { resolveIcon } from '../../icons';
5
5
  import CloseIconDefault from '../../icons/CloseIcon.svelte';
6
6
  import { onDestroy } from 'svelte';
@@ -14,7 +14,7 @@
14
14
  import { overlayStack, getOverlayMotion } from '../../utils';
15
15
  import Button from '../Button/Button.svelte';
16
16
  import type { DrawerProps } from './index';
17
- import { drawerVariants } from './drawer.variants';
17
+ import { drawerVariants, type DrawerVariants } from './drawer.variants';
18
18
 
19
19
  const bt = useBlocksI18n();
20
20
 
@@ -54,13 +54,6 @@
54
54
 
55
55
  const blocksConfig = getBlocksConfig();
56
56
  const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
57
- const slotClasses = $derived(
58
- mergeSlotClasses(
59
- blocksConfig?.defaults?.Drawer?.slotClasses,
60
- resolvePresetSlotClasses(blocksConfig?.presets, 'Drawer', preset),
61
- slotClassesProp
62
- )
63
- );
64
57
 
65
58
  let dialogElement = $state<HTMLDialogElement>();
66
59
  let panelElement = $state<HTMLElement>();
@@ -72,7 +65,11 @@
72
65
  const bodyId = `drawer-body-${uid}`;
73
66
  const overlayId = `drawer-${uid}`;
74
67
 
75
- const styles = $derived(drawerVariants({ placement, size, intent }));
68
+ const variantProps: DrawerVariants = $derived({ placement, size, intent });
69
+ const styles = $derived(drawerVariants(variantProps));
70
+ const slotClasses = $derived(
71
+ resolveSlotClasses(blocksConfig, 'Drawer', preset, variantProps, slotClassesProp)
72
+ );
76
73
 
77
74
  const motion = $derived(
78
75
  getOverlayMotion({
@@ -1,4 +1,4 @@
1
- import { type VariantProps } from '../../utils/variants';
1
+ import { type SlotNames, type VariantProps } from '../../utils/variants';
2
2
  export declare const drawerVariants: (props?: import("../../utils/variants").TVProps<{
3
3
  placement: {
4
4
  left: {
@@ -92,3 +92,5 @@ export declare const drawerVariants: (props?: import("../../utils/variants").TVP
92
92
  }) | undefined) => string;
93
93
  };
94
94
  export type DrawerVariants = VariantProps<typeof drawerVariants>;
95
+ /** Slot names derived from the `tv()` config above — single source of truth for `slotClasses`. */
96
+ export type DrawerSlots = SlotNames<typeof drawerVariants>;
@@ -1,6 +1,6 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { HTMLDialogAttributes } from 'svelte/elements';
3
- import type { DrawerVariants } from './drawer.variants';
3
+ import type { DrawerSlots, DrawerVariants } from './drawer.variants';
4
4
  /**
5
5
  * @description Slide-in panel overlay from any edge of the viewport.
6
6
  * Uses native dialog with focus trap, backdrop click dismiss, and Escape key support.
@@ -66,7 +66,7 @@ export interface DrawerProps extends Omit<HTMLDialogAttributes, 'children' | 'op
66
66
  /** Strip all default styles. Combine with slotClasses for fully custom appearance. */
67
67
  unstyled?: boolean;
68
68
  /** Per-slot class overrides merged with variant styles. */
69
- slotClasses?: Partial<Record<'dialog' | 'backdrop' | 'panel' | 'header' | 'title' | 'body' | 'footer', string>>;
69
+ slotClasses?: Partial<Record<DrawerSlots, string>>;
70
70
  /**
71
71
  * Apply a named preset registered via `<BlocksProvider presets={{ Drawer: {...} }}>`.
72
72
  * Prefer this over `class` overrides when the requested look falls outside the
@@ -1,9 +1,9 @@
1
1
  <script lang="ts">
2
2
  import { useBlocksI18n, mintRegistry, createPersistentState } from '../..';
3
- import { getBlocksConfig, mergeSlotClasses, resolvePresetSlotClasses } from '../../provider';
3
+ import { getBlocksConfig, resolveSlotClasses } from '../../provider';
4
4
  import { useFormField, getTierContext } from '../../utils';
5
5
  import type { InputProps } from '.';
6
- import { inputVariants } from './input.variants';
6
+ import { inputVariants, type InputVariants } from './input.variants';
7
7
  import { resolveIcon } from '../../icons';
8
8
  import CloseIconDefault from '../../icons/CloseIcon.svelte';
9
9
 
@@ -50,13 +50,6 @@
50
50
 
51
51
  const blocksConfig = getBlocksConfig();
52
52
  const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
53
- const slotClasses = $derived(
54
- mergeSlotClasses(
55
- blocksConfig?.defaults?.Input?.slotClasses,
56
- resolvePresetSlotClasses(blocksConfig?.presets, 'Input', preset),
57
- slotClassesProp
58
- )
59
- );
60
53
 
61
54
  let inputRef = $state<HTMLInputElement>();
62
55
 
@@ -99,20 +92,27 @@
99
92
  const hasLeftIcon = $derived(!!leftIcon);
100
93
  const hasRightIcon = $derived(!!(effectiveRightIcon || shouldShowClear));
101
94
 
102
- const styles = $derived(
103
- inputVariants({
104
- tier: effectiveTier,
105
- variant,
106
- size,
107
- intent,
108
- disabled: disabled || undefined,
109
- readonly: readonly || undefined,
110
- error: !!error || undefined,
111
- required: required || undefined,
112
- hasLeftIcon: hasLeftIcon || undefined,
113
- hasRightIcon: hasRightIcon || undefined,
114
- messageType: error ? 'error' : 'helper'
115
- })
95
+ // Variant props feed both the tv() style computation and the slot-class
96
+ // cascade — extracted into one derived so `resolveSlotClasses` can match
97
+ // conditional `overrides` against the input's active variants.
98
+ const variantProps: InputVariants = $derived({
99
+ tier: effectiveTier,
100
+ variant,
101
+ size,
102
+ intent,
103
+ disabled: disabled || undefined,
104
+ readonly: readonly || undefined,
105
+ error: !!error || undefined,
106
+ required: required || undefined,
107
+ hasLeftIcon: hasLeftIcon || undefined,
108
+ hasRightIcon: hasRightIcon || undefined,
109
+ messageType: error ? 'error' : 'helper'
110
+ });
111
+
112
+ const styles = $derived(inputVariants(variantProps));
113
+
114
+ const slotClasses = $derived(
115
+ resolveSlotClasses(blocksConfig, 'Input', preset, variantProps, slotClassesProp)
116
116
  );
117
117
 
118
118
  // ARIA wiring is shared with every form primitive — see XC-2.
@@ -179,11 +179,17 @@
179
179
  : styles.container({ class: slotClasses?.container })}
180
180
  >
181
181
  {#if leftIcon}
182
- <div class={styles.iconContainer({ iconPosition: 'left' })}>
182
+ <div
183
+ class={unstyled
184
+ ? (slotClasses?.iconContainer ?? '')
185
+ : styles.iconContainer({ iconPosition: 'left', class: slotClasses?.iconContainer })}
186
+ >
183
187
  {#if onLeftIconClick}
184
188
  <button
185
189
  type="button"
186
- class={styles.iconButton()}
190
+ class={unstyled
191
+ ? (slotClasses?.iconButton ?? '')
192
+ : styles.iconButton({ class: slotClasses?.iconButton })}
187
193
  onclick={handleLeftIconClick}
188
194
  {disabled}
189
195
  aria-label={leftIconAriaLabel}
@@ -191,7 +197,11 @@
191
197
  {@render leftIcon()}
192
198
  </button>
193
199
  {:else}
194
- <span class={styles.iconDecoration()}>
200
+ <span
201
+ class={unstyled
202
+ ? (slotClasses?.iconDecoration ?? '')
203
+ : styles.iconDecoration({ class: slotClasses?.iconDecoration })}
204
+ >
195
205
  {@render leftIcon()}
196
206
  </span>
197
207
  {/if}
@@ -220,7 +230,9 @@
220
230
  >
221
231
  <button
222
232
  type="button"
223
- class={styles.iconButton()}
233
+ class={unstyled
234
+ ? (slotClasses?.iconButton ?? '')
235
+ : styles.iconButton({ class: slotClasses?.iconButton })}
224
236
  onclick={handleClear}
225
237
  aria-label={bt('accessibility.clearInput')}
226
238
  >
@@ -236,7 +248,9 @@
236
248
  {#if onRightIconClick}
237
249
  <button
238
250
  type="button"
239
- class={styles.iconButton()}
251
+ class={unstyled
252
+ ? (slotClasses?.iconButton ?? '')
253
+ : styles.iconButton({ class: slotClasses?.iconButton })}
240
254
  onclick={handleRightIconClick}
241
255
  {disabled}
242
256
  aria-label={rightIconAriaLabel}
@@ -244,7 +258,11 @@
244
258
  {@render effectiveRightIcon()}
245
259
  </button>
246
260
  {:else}
247
- <span class={styles.iconDecoration()}>
261
+ <span
262
+ class={unstyled
263
+ ? (slotClasses?.iconDecoration ?? '')
264
+ : styles.iconDecoration({ class: slotClasses?.iconDecoration })}
265
+ >
248
266
  {@render effectiveRightIcon()}
249
267
  </span>
250
268
  {/if}
@@ -253,7 +271,13 @@
253
271
  </div>
254
272
 
255
273
  {#if ff.errorId}
256
- <div id={ff.errorId} class={styles.message()} role="alert">
274
+ <div
275
+ id={ff.errorId}
276
+ class={unstyled
277
+ ? (slotClasses?.message ?? '')
278
+ : styles.message({ class: slotClasses?.message })}
279
+ role="alert"
280
+ >
257
281
  {error}
258
282
  </div>
259
283
  {:else if ff.hintId}
@@ -1,7 +1,7 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { HTMLInputAttributes } from 'svelte/elements';
3
3
  import type { MintProp } from '../../mint';
4
- import type { InputVariants } from './input.variants';
4
+ import type { InputSlots, InputVariants } from './input.variants';
5
5
  /**
6
6
  * @description Text input with labels, validation states, icons, and clearable functionality.
7
7
  * Supports outlined, filled, and ghost visual variants with automatic ARIA linking.
@@ -68,8 +68,12 @@ export interface InputProps extends Omit<InputVariants, 'error'>, Omit<HTMLInput
68
68
  class?: string;
69
69
  /** Remove all default tv() classes — only user-provided classes apply. */
70
70
  unstyled?: boolean;
71
- /** Per-slot class overrides merged with tv() styles. */
72
- slotClasses?: Partial<Record<'wrapper' | 'container' | 'base' | 'label' | 'message' | 'iconContainer', string>>;
71
+ /**
72
+ * Per-slot class overrides merged with tv() styles. Slots: wrapper (root
73
+ * what `class` also targets) | container | base (the `<input>` element) |
74
+ * label | message | iconContainer | iconButton | iconDecoration.
75
+ */
76
+ slotClasses?: Partial<Record<InputSlots, string>>;
73
77
  /**
74
78
  * Apply a named preset registered via `<BlocksProvider presets={{ Input: {...} }}>`.
75
79
  * Prefer this over `class` overrides when the requested look falls outside the
@@ -1,4 +1,4 @@
1
- import { type VariantProps } from '../../utils/variants';
1
+ import { type SlotNames, type VariantProps } from '../../utils/variants';
2
2
  export declare const inputVariants: (props?: import("../../utils/variants").TVProps<{
3
3
  tier: {
4
4
  modify: {
@@ -252,3 +252,5 @@ export declare const inputVariants: (props?: import("../../utils/variants").TVPr
252
252
  }) | undefined) => string;
253
253
  };
254
254
  export type InputVariants = VariantProps<typeof inputVariants>;
255
+ /** Slot names derived from the `tv()` config above — single source of truth for `slotClasses`. */
256
+ export type InputSlots = SlotNames<typeof inputVariants>;
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" generics="TItem extends MenuItemType = MenuItemType">
2
2
  import { useBlocksI18n } from '../..';
3
- import { getBlocksConfig, mergeSlotClasses, resolvePresetSlotClasses } from '../../provider';
4
- import { Button, menuVariants } from '..';
3
+ import { getBlocksConfig, resolveSlotClasses } from '../../provider';
4
+ import { Button, menuVariants, type MenuVariants } from '..';
5
5
  import { resolveIcon } from '../../icons';
6
6
  import ChevronDownIconDefault from '../../icons/ChevronDownIcon.svelte';
7
7
  import { getTierContext } from '../../utils/tier-context';
@@ -52,13 +52,6 @@
52
52
 
53
53
  const blocksConfig = getBlocksConfig();
54
54
  const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
55
- const slotClasses = $derived(
56
- mergeSlotClasses(
57
- blocksConfig?.defaults?.Menu?.slotClasses,
58
- resolvePresetSlotClasses(blocksConfig?.presets, 'Menu', preset),
59
- slotClassesProp
60
- )
61
- );
62
55
 
63
56
  const propsId = $props.id();
64
57
  const rootId = $derived(idProp ?? `menu-${propsId}`);
@@ -230,20 +223,27 @@
230
223
  return 'md';
231
224
  }
232
225
 
233
- const styles = $derived(
234
- menuVariants({
235
- open,
236
- itemSize: itemSizeForDepth(0),
237
- syncWidth,
238
- placement,
239
- chevronAnimation,
240
- usePortal,
241
- // Drives the floating panel's corner radius via the `tier` axis on
242
- // menuVariants — keeps the panel visually attached to its trigger
243
- // (e.g. pill trigger rounded-lg panel instead of near-flat
244
- // rounded-contain).
245
- tier: effectiveTier
246
- })
226
+ // Variant props feed both the tv() style computation and the slot-class
227
+ // cascade — extracted into one derived so `resolveSlotClasses` can match
228
+ // conditional `overrides` against the menu's active variants.
229
+ const variantProps: MenuVariants = $derived({
230
+ open,
231
+ itemSize: itemSizeForDepth(0),
232
+ syncWidth,
233
+ placement,
234
+ chevronAnimation,
235
+ usePortal,
236
+ // Drives the floating panel's corner radius via the `tier` axis on
237
+ // menuVariants — keeps the panel visually attached to its trigger
238
+ // (e.g. pill trigger → rounded-lg panel instead of near-flat
239
+ // rounded-contain).
240
+ tier: effectiveTier
241
+ });
242
+
243
+ const styles = $derived(menuVariants(variantProps));
244
+
245
+ const slotClasses = $derived(
246
+ resolveSlotClasses(blocksConfig, 'Menu', preset, variantProps, slotClassesProp)
247
247
  );
248
248
 
249
249
  const ctx: MenuContext = {
@@ -5,6 +5,7 @@ import type { ButtonVariants, MenuVariants } from '..';
5
5
  import type { AnimationProps } from '../../utils';
6
6
  import type { Placement } from '../../utils/floating';
7
7
  import type { InteractiveTier } from '../../utils/tier-context';
8
+ import type { MenuSlots } from './menu.variants';
8
9
  /**
9
10
  * @description Action menu (`role="menu"`) triggered by a button. Items are
10
11
  * verbs the user can invoke — Edit, Delete, Share, Export — and dispatch an
@@ -69,8 +70,10 @@ export interface MenuSpecificProps<TItem extends MenuItemType = MenuItemType> {
69
70
  unstyled?: boolean;
70
71
  /**
71
72
  * Per-slot class overrides merged with tailwind-variants styles.
73
+ * Slots: base | trigger | triggerText | chevron | content | header | section |
74
+ * divider | items | item | indicator | submenu | footer
72
75
  */
73
- slotClasses?: Partial<Record<'base' | 'trigger' | 'triggerText' | 'chevron' | 'content' | 'header' | 'section' | 'divider' | 'items' | 'item' | 'indicator' | 'submenu' | 'footer', string>>;
76
+ slotClasses?: Partial<Record<MenuSlots, string>>;
74
77
  /**
75
78
  * Apply a named preset registered via `<BlocksProvider presets={{ Menu: {...} }}>`.
76
79
  * Prefer this over `class` overrides when the requested look falls outside the
@@ -1,4 +1,4 @@
1
- import { type VariantProps } from '../../utils/variants';
1
+ import { type SlotNames, type VariantProps } from '../../utils/variants';
2
2
  export declare const menuVariants: (props?: import("../../utils/variants").TVProps<{
3
3
  open: {
4
4
  true: {
@@ -242,3 +242,5 @@ export declare const menuIconVariants: (props?: import("../../utils/variants").T
242
242
  }> | undefined) => string;
243
243
  export type MenuVariants = VariantProps<typeof menuVariants>;
244
244
  export type MenuIconVariants = VariantProps<typeof menuIconVariants>;
245
+ /** Slot names derived from the tv() config — single source of truth for slotClasses. */
246
+ export type MenuSlots = SlotNames<typeof menuVariants>;
@@ -1,8 +1,9 @@
1
1
  <script lang="ts">
2
2
  import PaginationItem from './PaginationItem.svelte';
3
3
  import { useBlocksI18n } from '../..';
4
- import { getBlocksConfig, mergeSlotClasses, resolvePresetSlotClasses } from '../../provider';
4
+ import { getBlocksConfig, resolveSlotClasses } from '../../provider';
5
5
  import { paginationVariants } from '..';
6
+ import type { PaginationVariants } from './pagination.variants';
6
7
  import { MediaQuery } from 'svelte/reactivity';
7
8
  import { computeEllipsisState, computeVisiblePageNumbers } from './pagination.engine';
8
9
  import type { PaginationProps } from '.';
@@ -49,21 +50,18 @@
49
50
 
50
51
  const blocksConfig = getBlocksConfig();
51
52
  const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
52
- const slotClasses = $derived(
53
- mergeSlotClasses(
54
- blocksConfig?.defaults?.Pagination?.slotClasses,
55
- resolvePresetSlotClasses(blocksConfig?.presets, 'Pagination', preset),
56
- slotClassesProp
57
- )
58
- );
59
53
 
60
- const styles = $derived(
61
- paginationVariants({
62
- layout,
63
- size,
64
- disabled,
65
- loading
66
- })
54
+ const variantProps: PaginationVariants = $derived({
55
+ layout,
56
+ size,
57
+ disabled,
58
+ loading
59
+ });
60
+
61
+ const styles = $derived(paginationVariants(variantProps));
62
+
63
+ const slotClasses = $derived(
64
+ resolveSlotClasses(blocksConfig, 'Pagination', preset, variantProps, slotClassesProp)
67
65
  );
68
66
 
69
67
  // Calculate pagination info for table layout
@@ -264,7 +262,11 @@
264
262
  </div>
265
263
  {:else}
266
264
  <!-- Default Layout: Full pagination -->
267
- <div class={styles.controls()}>
265
+ <div
266
+ class={unstyled
267
+ ? (slotClasses?.controls ?? '')
268
+ : styles.controls({ class: slotClasses?.controls })}
269
+ >
268
270
  {#if showFirstLast && !isFirstPage && showStartEllipsis}
269
271
  <PaginationItem
270
272
  {size}
@@ -2,7 +2,7 @@ import type { Snippet } from 'svelte';
2
2
  import type { HTMLAttributes } from 'svelte/elements';
3
3
  import type { MintProp } from '../../mint';
4
4
  import type { InteractiveTier } from '../../utils/tier-context';
5
- import type { PaginationVariants } from './pagination.variants';
5
+ import type { PaginationSlots, PaginationVariants } from './pagination.variants';
6
6
  export interface PaginationPageItem {
7
7
  label: string;
8
8
  value: number;
@@ -90,7 +90,7 @@ export interface PaginationProps extends Omit<PaginationVariants, 'disabled' | '
90
90
  /** Strip all default tailwind-variants classes for a fully custom build. */
91
91
  unstyled?: boolean;
92
92
  /** Per-slot class overrides merged with (or replacing, when unstyled) tv styles. Slots: base, info, controls, ellipsis. */
93
- slotClasses?: Partial<Record<'base' | 'info' | 'controls' | 'ellipsis', string>>;
93
+ slotClasses?: Partial<Record<PaginationSlots, string>>;
94
94
  /**
95
95
  * Apply a named preset registered via `<BlocksProvider presets={{ Pagination: {...} }}>`.
96
96
  * Prefer this over `class` overrides when the requested look falls outside the
@@ -1,4 +1,4 @@
1
- import { type VariantProps } from '../../utils/variants';
1
+ import { type SlotNames, type VariantProps } from '../../utils/variants';
2
2
  export declare const paginationVariants: (props?: import("../../utils/variants").TVProps<{
3
3
  layout: {
4
4
  default: {
@@ -79,3 +79,5 @@ export declare const paginationVariants: (props?: import("../../utils/variants")
79
79
  }) | undefined) => string;
80
80
  };
81
81
  export type PaginationVariants = VariantProps<typeof paginationVariants>;
82
+ /** Slot names derived from the tv() config — single source of truth for slotClasses. */
83
+ export type PaginationSlots = SlotNames<typeof paginationVariants>;
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { untrack } from 'svelte';
3
- import { getBlocksConfig, mergeSlotClasses, resolvePresetSlotClasses } from '../../provider';
3
+ import { getBlocksConfig, resolveSlotClasses } from '../../provider';
4
4
  import {
5
5
  autoUpdate,
6
6
  computePosition,
@@ -51,11 +51,7 @@
51
51
  const blocksConfig = getBlocksConfig();
52
52
  const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
53
53
  const slotClasses = $derived(
54
- mergeSlotClasses(
55
- blocksConfig?.defaults?.Popover?.slotClasses,
56
- resolvePresetSlotClasses(blocksConfig?.presets, 'Popover', preset),
57
- slotClassesProp
58
- )
54
+ resolveSlotClasses(blocksConfig, 'Popover', preset, { size }, slotClassesProp)
59
55
  );
60
56
 
61
57
  let internalTriggerElement = $state<HTMLElement | null>(null);
@@ -1,8 +1,8 @@
1
1
  <script lang="ts">
2
- import { getBlocksConfig, mergeSlotClasses, resolvePresetSlotClasses } from '../../provider';
2
+ import { getBlocksConfig, resolveSlotClasses } from '../../provider';
3
3
  import { useBlocksI18n } from '../..';
4
4
  import type { ProgressProps } from './index';
5
- import { progressVariants } from './progress.variants';
5
+ import { progressVariants, type ProgressVariants } from './progress.variants';
6
6
 
7
7
  const bt = useBlocksI18n();
8
8
 
@@ -30,13 +30,6 @@
30
30
 
31
31
  const blocksConfig = getBlocksConfig();
32
32
  const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
33
- const slotClasses = $derived(
34
- mergeSlotClasses(
35
- blocksConfig?.defaults?.Progress?.slotClasses,
36
- resolvePresetSlotClasses(blocksConfig?.presets, 'Progress', preset),
37
- slotClassesProp
38
- )
39
- );
40
33
 
41
34
  const isIndeterminate = $derived(indeterminateProp || value === undefined);
42
35
  const clampedValue = $derived(value !== undefined ? Math.min(Math.max(value, min), max) : 0);
@@ -47,14 +40,21 @@
47
40
  formatValue ? formatValue(clampedValue, max) : defaultFormat(clampedValue, max)
48
41
  );
49
42
 
50
- const styles = $derived(
51
- progressVariants({
52
- intent,
53
- size,
54
- indeterminate: isIndeterminate || undefined,
55
- striped: striped || undefined,
56
- animated: animated || undefined
57
- })
43
+ // Variant props feed both the tv() style computation and the slot-class
44
+ // cascade — extracted into one derived so `resolveSlotClasses` can match
45
+ // conditional `overrides` against the progress bar's active variants.
46
+ const variantProps: ProgressVariants = $derived({
47
+ intent,
48
+ size,
49
+ indeterminate: isIndeterminate || undefined,
50
+ striped: striped || undefined,
51
+ animated: animated || undefined
52
+ });
53
+
54
+ const styles = $derived(progressVariants(variantProps));
55
+
56
+ const slotClasses = $derived(
57
+ resolveSlotClasses(blocksConfig, 'Progress', preset, variantProps, slotClassesProp)
58
58
  );
59
59
 
60
60
  const circularRadius = $derived((circularSize - strokeWidth) / 2);
@@ -1,5 +1,5 @@
1
1
  import type { HTMLAttributes } from 'svelte/elements';
2
- import type { ProgressVariants } from './progress.variants';
2
+ import type { ProgressSlots, ProgressVariants } from './progress.variants';
3
3
  /**
4
4
  * @description Progress indicator for determinate and indeterminate loading states.
5
5
  * Supports linear bar and circular ring variants with semantic intents and animation.
@@ -45,8 +45,13 @@ export interface ProgressProps extends ProgressVariants, Omit<HTMLAttributes<HTM
45
45
  class?: string;
46
46
  /** Remove all default tv() classes. */
47
47
  unstyled?: boolean;
48
- /** Per-slot class overrides merged with tv() styles. */
49
- slotClasses?: Partial<Record<'wrapper' | 'header' | 'label' | 'valueText' | 'track' | 'fill' | 'circularWrapper' | 'circularTrack' | 'circularFill' | 'circularLabel', string>>;
48
+ /**
49
+ * Per-slot class overrides merged with tv() styles. Slots: wrapper (linear
50
+ * root — what `class` targets in linear shape) | header | label | valueText |
51
+ * track | fill | circularWrapper (circular root — what `class` targets in
52
+ * circular shape) | circularTrack | circularFill | circularLabel.
53
+ */
54
+ slotClasses?: Partial<Record<ProgressSlots, string>>;
50
55
  /**
51
56
  * Apply a named preset registered via `<BlocksProvider presets={{ Progress: {...} }}>`.
52
57
  * Prefer this over `class` overrides when the requested look falls outside the
@@ -1,4 +1,4 @@
1
- import { type VariantProps } from '../../utils/variants';
1
+ import { type SlotNames, type VariantProps } from '../../utils/variants';
2
2
  export declare const progressVariants: (props?: import("../../utils/variants").TVProps<{
3
3
  intent: {
4
4
  primary: {
@@ -164,3 +164,5 @@ export declare const progressVariants: (props?: import("../../utils/variants").T
164
164
  }) | undefined) => string;
165
165
  };
166
166
  export type ProgressVariants = VariantProps<typeof progressVariants>;
167
+ /** Slot names derived from the `tv()` config above — single source of truth for `slotClasses`. */
168
+ export type ProgressSlots = SlotNames<typeof progressVariants>;