@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.
- package/dist/components/AreaChart/AreaChart.svelte +2 -6
- package/dist/components/BarChart/BarChart.svelte +2 -6
- package/dist/components/Calendar/Calendar.svelte +12 -10
- package/dist/components/Calendar/calendar.variants.d.ts +2 -1
- package/dist/components/Calendar/index.d.ts +2 -2
- package/dist/components/CommandPalette/CommandPalette.svelte +106 -39
- package/dist/components/CommandPalette/commandPalette.variants.d.ts +3 -7
- package/dist/components/CommandPalette/commandPalette.variants.js +0 -1
- package/dist/components/CommandPalette/index.d.ts +2 -2
- package/dist/components/CompositionBar/CompositionBar.svelte +12 -15
- package/dist/components/CompositionBar/composition-bar.variants.d.ts +3 -1
- package/dist/components/CompositionBar/index.d.ts +2 -2
- package/dist/components/DonutChart/DonutChart.svelte +2 -6
- package/dist/components/EmptyState/EmptyState.svelte +8 -9
- package/dist/components/EmptyState/emptyState.variants.d.ts +3 -1
- package/dist/components/EmptyState/index.d.ts +3 -3
- package/dist/components/FileUpload/FileUpload.svelte +17 -17
- package/dist/components/FileUpload/fileUpload.variants.d.ts +3 -11
- package/dist/components/FileUpload/fileUpload.variants.js +0 -5
- package/dist/components/FileUpload/index.d.ts +4 -3
- package/dist/components/Guide/Guide.svelte +5 -8
- package/dist/components/Guide/GuideArticle.svelte +5 -8
- package/dist/components/Guide/GuideBeacon.svelte +5 -8
- package/dist/components/Guide/GuideHint.svelte +5 -8
- package/dist/components/Guide/GuideMarker.svelte +5 -8
- package/dist/components/Guide/GuideMention.svelte +5 -8
- package/dist/components/Guide/GuidePanel.svelte +5 -8
- package/dist/components/Guide/guide.variants.d.ts +9 -1
- package/dist/components/Guide/index.d.ts +12 -9
- package/dist/components/LineChart/LineChart.svelte +2 -6
- package/dist/components/Planner/Planner.svelte +7 -10
- package/dist/components/Planner/index.d.ts +4 -4
- package/dist/components/Planner/planner.variants.d.ts +3 -1
- package/dist/components/Sankey/Sankey.svelte +8 -9
- package/dist/components/Sankey/index.d.ts +2 -2
- package/dist/components/Sankey/sankey.variants.d.ts +3 -1
- package/dist/components/SidebarLayout/SidebarLayout.svelte +17 -17
- package/dist/components/SidebarLayout/index.d.ts +8 -2
- package/dist/components/SidebarLayout/sidebar-layout.variants.d.ts +3 -1
- package/dist/components/ThemeSwitcher/ThemeSwitcher.svelte +30 -38
- package/dist/components/ThemeSwitcher/index.d.ts +6 -4
- package/dist/components/ThemeSwitcher/themeSwitcher.variants.d.ts +3 -1
- package/dist/primitives/Accordion/Accordion.svelte +7 -9
- package/dist/primitives/Accordion/AccordionItem.svelte +8 -20
- package/dist/primitives/Accordion/accordion.variants.d.ts +3 -1
- package/dist/primitives/Accordion/index.d.ts +6 -6
- package/dist/primitives/Alert/Alert.svelte +7 -21
- package/dist/primitives/Alert/alert.variants.d.ts +3 -1
- package/dist/primitives/Alert/index.d.ts +3 -3
- package/dist/primitives/Avatar/Avatar.svelte +17 -20
- package/dist/primitives/Avatar/avatar.variants.d.ts +3 -1
- package/dist/primitives/Avatar/index.d.ts +3 -3
- package/dist/primitives/Badge/Badge.svelte +2 -2
- package/dist/primitives/Badge/badge.variants.d.ts +3 -1
- package/dist/primitives/Badge/index.d.ts +2 -2
- package/dist/primitives/Breadcrumb/Breadcrumb.svelte +30 -32
- package/dist/primitives/Breadcrumb/breadcrumb.variants.d.ts +3 -1
- package/dist/primitives/Breadcrumb/index.d.ts +2 -2
- package/dist/primitives/Button/Button.svelte +21 -21
- package/dist/primitives/Button/button.variants.d.ts +3 -1
- package/dist/primitives/Button/index.d.ts +3 -3
- package/dist/primitives/ButtonGroup/ButtonGroup.svelte +15 -14
- package/dist/primitives/ButtonGroup/buttongroup.variants.d.ts +3 -1
- package/dist/primitives/ButtonGroup/index.d.ts +3 -2
- package/dist/primitives/Card/Card.svelte +15 -18
- package/dist/primitives/Card/card.variants.d.ts +3 -1
- package/dist/primitives/Card/index.d.ts +3 -3
- package/dist/primitives/Checkbox/Checkbox.svelte +20 -20
- package/dist/primitives/Checkbox/checkbox.variants.d.ts +3 -1
- package/dist/primitives/Checkbox/index.d.ts +7 -3
- package/dist/primitives/Collapsible/Collapsible.svelte +30 -30
- package/dist/primitives/Collapsible/collapsible.variants.d.ts +3 -1
- package/dist/primitives/Collapsible/index.d.ts +3 -3
- package/dist/primitives/Combobox/Combobox.svelte +20 -31
- package/dist/primitives/Combobox/combobox.variants.d.ts +3 -1
- package/dist/primitives/Combobox/index.d.ts +5 -3
- package/dist/primitives/Dialog/Dialog.svelte +7 -10
- package/dist/primitives/Dialog/dialog.variants.d.ts +3 -1
- package/dist/primitives/Dialog/index.d.ts +2 -2
- package/dist/primitives/Drawer/Drawer.svelte +7 -10
- package/dist/primitives/Drawer/drawer.variants.d.ts +3 -1
- package/dist/primitives/Drawer/index.d.ts +2 -2
- package/dist/primitives/Input/Input.svelte +54 -30
- package/dist/primitives/Input/index.d.ts +7 -3
- package/dist/primitives/Input/input.variants.d.ts +3 -1
- package/dist/primitives/Menu/Menu.svelte +23 -23
- package/dist/primitives/Menu/index.d.ts +4 -1
- package/dist/primitives/Menu/menu.variants.d.ts +3 -1
- package/dist/primitives/Pagination/Pagination.svelte +18 -16
- package/dist/primitives/Pagination/index.d.ts +2 -2
- package/dist/primitives/Pagination/pagination.variants.d.ts +3 -1
- package/dist/primitives/Popover/Popover.svelte +2 -6
- package/dist/primitives/Progress/Progress.svelte +17 -17
- package/dist/primitives/Progress/index.d.ts +8 -3
- package/dist/primitives/Progress/progress.variants.d.ts +3 -1
- package/dist/primitives/RadioGroup/RadioGroup.svelte +16 -16
- package/dist/primitives/RadioGroup/RadioItem.svelte +19 -19
- package/dist/primitives/RadioGroup/index.d.ts +3 -3
- package/dist/primitives/RadioGroup/radioGroup.variants.d.ts +4 -1
- package/dist/primitives/SegmentGroup/SegmentGroup.svelte +14 -11
- package/dist/primitives/SegmentGroup/SegmentItem.svelte +12 -11
- package/dist/primitives/SegmentGroup/index.d.ts +3 -3
- package/dist/primitives/SegmentGroup/segmentgroup.variants.d.ts +3 -1
- package/dist/primitives/Select/Select.svelte +31 -22
- package/dist/primitives/Select/index.d.ts +8 -3
- package/dist/primitives/Select/select.variants.d.ts +3 -1
- package/dist/primitives/Separator/Separator.svelte +2 -6
- package/dist/primitives/Sidebar/Sidebar.svelte +6 -9
- package/dist/primitives/Sidebar/index.d.ts +2 -2
- package/dist/primitives/Sidebar/sidebar.variants.d.ts +3 -1
- package/dist/primitives/Skeleton/Skeleton.svelte +7 -9
- package/dist/primitives/Skeleton/index.d.ts +3 -3
- package/dist/primitives/Skeleton/skeleton.variants.d.ts +3 -1
- package/dist/primitives/Skeleton/skeleton.variants.js +5 -6
- package/dist/primitives/Slider/Slider.svelte +19 -19
- package/dist/primitives/Slider/index.d.ts +8 -3
- package/dist/primitives/Slider/slider.variants.d.ts +3 -1
- package/dist/primitives/Spinner/Spinner.svelte +7 -9
- package/dist/primitives/Spinner/index.d.ts +5 -3
- package/dist/primitives/Spinner/spinner.variants.d.ts +3 -1
- package/dist/primitives/Stepper/Stepper.svelte +13 -18
- package/dist/primitives/Stepper/StepperStep.svelte +18 -19
- package/dist/primitives/Stepper/index.d.ts +5 -5
- package/dist/primitives/Stepper/stepper.variants.d.ts +3 -1
- package/dist/primitives/Tab/Tab.svelte +14 -17
- package/dist/primitives/Tab/TabItem.svelte +18 -19
- package/dist/primitives/Tab/TabPanel.svelte +10 -13
- package/dist/primitives/Tab/index.d.ts +7 -7
- package/dist/primitives/Tab/tab.variants.d.ts +3 -1
- package/dist/primitives/Textarea/Textarea.svelte +23 -23
- package/dist/primitives/Textarea/index.d.ts +7 -3
- package/dist/primitives/Textarea/textarea.variants.d.ts +3 -1
- package/dist/primitives/Toast/Toaster.svelte +5 -6
- package/dist/primitives/Toast/index.d.ts +2 -2
- package/dist/primitives/Toast/toast.variants.d.ts +3 -1
- package/dist/primitives/Toggle/Toggle.svelte +19 -19
- package/dist/primitives/Toggle/index.d.ts +7 -3
- package/dist/primitives/Toggle/toggle.variants.d.ts +3 -1
- package/dist/primitives/Toolbar/Toolbar.svelte +7 -9
- package/dist/primitives/Toolbar/index.d.ts +4 -3
- package/dist/primitives/Toolbar/toolbar.variants.d.ts +3 -1
- package/dist/primitives/Tooltip/Tooltip.svelte +7 -9
- package/dist/primitives/Tooltip/index.d.ts +2 -2
- package/dist/primitives/Tooltip/tooltip.variants.d.ts +3 -1
- package/dist/style/semantic.css +5 -0
- package/dist/utils/variants.d.ts +17 -0
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
2
|
import type { MintProp } from '../../mint';
|
|
3
|
-
import type { SliderVariants } from './slider.variants';
|
|
3
|
+
import type { SliderSlots, SliderVariants } from './slider.variants';
|
|
4
4
|
/** A labelled tick mark on the slider track. */
|
|
5
5
|
export interface SliderMark {
|
|
6
6
|
value: number;
|
|
@@ -114,8 +114,13 @@ export interface SliderProps extends Omit<SliderVariants, 'error' | 'rangeStatus
|
|
|
114
114
|
class?: string;
|
|
115
115
|
/** Remove all default tv() classes. */
|
|
116
116
|
unstyled?: boolean;
|
|
117
|
-
/**
|
|
118
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Per-slot class overrides merged with tv() styles. Slots: wrapper (root —
|
|
119
|
+
* what `class` also targets) | header | label | valueText | base (the
|
|
120
|
+
* interactive track container) | track | range | thumb | mark | boundaryTick
|
|
121
|
+
* | rangeStatus | rangeStatusIcon | message.
|
|
122
|
+
*/
|
|
123
|
+
slotClasses?: Partial<Record<SliderSlots, string>>;
|
|
119
124
|
/**
|
|
120
125
|
* Apply a named preset registered via `<BlocksProvider presets={{ Slider: {...} }}>`.
|
|
121
126
|
* 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 sliderVariants: (props?: import("../../utils/variants").TVProps<{
|
|
3
3
|
intent: {
|
|
4
4
|
primary: {
|
|
@@ -254,3 +254,5 @@ export declare const sliderVariants: (props?: import("../../utils/variants").TVP
|
|
|
254
254
|
}) | undefined) => string;
|
|
255
255
|
};
|
|
256
256
|
export type SliderVariants = VariantProps<typeof sliderVariants>;
|
|
257
|
+
/** Slot names derived from the `tv()` config above — single source of truth for `slotClasses`. */
|
|
258
|
+
export type SliderSlots = SlotNames<typeof sliderVariants>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { getBlocksConfig,
|
|
3
|
-
import { spinnerVariants } from './spinner.variants';
|
|
2
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
3
|
+
import { spinnerVariants, type SpinnerVariants } from './spinner.variants';
|
|
4
4
|
import type { SpinnerProps } from './index';
|
|
5
5
|
|
|
6
6
|
let {
|
|
@@ -20,15 +20,13 @@
|
|
|
20
20
|
|
|
21
21
|
const blocksConfig = getBlocksConfig();
|
|
22
22
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
23
|
+
|
|
24
|
+
const variantProps: SpinnerVariants = $derived({ variant, size, intent, speed });
|
|
25
|
+
const styles = $derived(spinnerVariants(variantProps));
|
|
26
|
+
|
|
23
27
|
const slotClasses = $derived(
|
|
24
|
-
|
|
25
|
-
blocksConfig?.defaults?.Spinner?.slotClasses,
|
|
26
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'Spinner', preset),
|
|
27
|
-
slotClassesProp
|
|
28
|
-
)
|
|
28
|
+
resolveSlotClasses(blocksConfig, 'Spinner', preset, variantProps, slotClassesProp)
|
|
29
29
|
);
|
|
30
|
-
|
|
31
|
-
const styles = $derived(spinnerVariants({ variant, size, intent, speed }));
|
|
32
30
|
</script>
|
|
33
31
|
|
|
34
32
|
{#if visible}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
import type { SpinnerVariants } from './spinner.variants';
|
|
3
|
+
import type { SpinnerSlots, SpinnerVariants } from './spinner.variants';
|
|
4
4
|
/**
|
|
5
5
|
* @description Animated loading indicator with multiple animation styles and semantic intents.
|
|
6
6
|
*
|
|
@@ -39,8 +39,10 @@ export interface SpinnerProps extends SpinnerVariants, Omit<HTMLAttributes<HTMLD
|
|
|
39
39
|
class?: string;
|
|
40
40
|
/** Strip all default tv() classes. Combine with `slotClasses` for full control. */
|
|
41
41
|
unstyled?: boolean;
|
|
42
|
-
/** Per-slot class overrides merged with (or replacing, when `unstyled`) tv() output.
|
|
43
|
-
|
|
42
|
+
/** Per-slot class overrides merged with (or replacing, when `unstyled`) tv() output.
|
|
43
|
+
* Slots: base | svg | svgCircle | svgPath | dots | dot | pulse | pulseCenter |
|
|
44
|
+
* pulseRing | ring | ringElement | bars | bar | content | srOnly */
|
|
45
|
+
slotClasses?: Partial<Record<SpinnerSlots, string>>;
|
|
44
46
|
/**
|
|
45
47
|
* Apply a named preset registered via `<BlocksProvider presets={{ Spinner: {...} }}>`.
|
|
46
48
|
* 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 spinnerVariants: (props?: import("../../utils/variants").TVProps<{
|
|
3
3
|
variant: {
|
|
4
4
|
default: {};
|
|
@@ -226,3 +226,5 @@ export declare const spinnerVariants: (props?: import("../../utils/variants").TV
|
|
|
226
226
|
}) | undefined) => string;
|
|
227
227
|
};
|
|
228
228
|
export type SpinnerVariants = VariantProps<typeof spinnerVariants>;
|
|
229
|
+
/** Slot names derived from the tv() config — single source of truth for slotClasses. */
|
|
230
|
+
export type SpinnerSlots = SlotNames<typeof spinnerVariants>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { useBlocksI18n } from '../..';
|
|
3
|
-
import { getBlocksConfig,
|
|
3
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
4
4
|
import { getTierContext } from '../../utils';
|
|
5
|
-
import { stepperVariants } from './stepper.variants';
|
|
5
|
+
import { stepperVariants, type StepperVariants } from './stepper.variants';
|
|
6
6
|
import { setStepperContext } from './stepper.context';
|
|
7
7
|
import type { StepperProps, StepperContext } from './index';
|
|
8
8
|
|
|
@@ -35,13 +35,6 @@
|
|
|
35
35
|
|
|
36
36
|
const blocksConfig = getBlocksConfig();
|
|
37
37
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
38
|
-
const slotClasses = $derived(
|
|
39
|
-
mergeSlotClasses(
|
|
40
|
-
blocksConfig?.defaults?.Stepper?.slotClasses,
|
|
41
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'Stepper', preset),
|
|
42
|
-
slotClassesProp
|
|
43
|
-
)
|
|
44
|
-
);
|
|
45
38
|
|
|
46
39
|
const responsiveBreakpoint = $derived(
|
|
47
40
|
responsive === true ? 640 : typeof responsive === 'object' ? (responsive.breakpoint ?? 640) : 0
|
|
@@ -66,15 +59,17 @@
|
|
|
66
59
|
const effectiveOrientation = $derived(isCompact ? 'vertical' : orientation);
|
|
67
60
|
const effectiveVariant = $derived(isCompact ? 'minimal' : variant);
|
|
68
61
|
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
62
|
+
const variantProps: StepperVariants = $derived({
|
|
63
|
+
orientation: effectiveOrientation,
|
|
64
|
+
size,
|
|
65
|
+
variant: effectiveVariant,
|
|
66
|
+
tier: effectiveTier
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const styles = $derived(unstyled ? { base: () => '' } : stepperVariants(variantProps));
|
|
70
|
+
|
|
71
|
+
const slotClasses = $derived(
|
|
72
|
+
resolveSlotClasses(blocksConfig, 'Stepper', preset, variantProps, slotClassesProp)
|
|
78
73
|
);
|
|
79
74
|
|
|
80
75
|
let nextIdx = 0;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { getBlocksConfig,
|
|
3
|
-
import { stepperVariants } from './stepper.variants';
|
|
2
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
3
|
+
import { stepperVariants, type StepperVariants } from './stepper.variants';
|
|
4
4
|
import { getStepperContext } from './stepper.context';
|
|
5
5
|
import { resolveIcon } from '../../icons';
|
|
6
6
|
import CheckIconDefault from '../../icons/CheckIcon.svelte';
|
|
@@ -29,13 +29,6 @@
|
|
|
29
29
|
|
|
30
30
|
const blocksConfig = getBlocksConfig();
|
|
31
31
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
32
|
-
const slotClasses = $derived(
|
|
33
|
-
mergeSlotClasses(
|
|
34
|
-
blocksConfig?.defaults?.StepperStep?.slotClasses,
|
|
35
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'StepperStep', preset),
|
|
36
|
-
slotClassesProp
|
|
37
|
-
)
|
|
38
|
-
);
|
|
39
32
|
|
|
40
33
|
const ctx = getStepperContext();
|
|
41
34
|
const stepIndex = ctx.registerStep();
|
|
@@ -60,6 +53,17 @@
|
|
|
60
53
|
const isSeparatorComplete = $derived(stepIndex < ctx.activeStep);
|
|
61
54
|
const isActive = $derived(stepIndex === ctx.activeStep);
|
|
62
55
|
|
|
56
|
+
const variantProps: StepperVariants = $derived({
|
|
57
|
+
orientation: ctx.orientation,
|
|
58
|
+
size: ctx.size,
|
|
59
|
+
variant: ctx.variant,
|
|
60
|
+
tier: ctx.tier,
|
|
61
|
+
stepState: derivedState,
|
|
62
|
+
clickable: isClickable || undefined,
|
|
63
|
+
stepDisabled: isDisabled || undefined,
|
|
64
|
+
separatorComplete: isSeparatorComplete || undefined
|
|
65
|
+
});
|
|
66
|
+
|
|
63
67
|
const styles = $derived(
|
|
64
68
|
unstyled
|
|
65
69
|
? {
|
|
@@ -73,16 +77,11 @@
|
|
|
73
77
|
separator: () => '',
|
|
74
78
|
content: () => ''
|
|
75
79
|
}
|
|
76
|
-
: stepperVariants(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
stepState: derivedState,
|
|
82
|
-
clickable: isClickable || undefined,
|
|
83
|
-
stepDisabled: isDisabled || undefined,
|
|
84
|
-
separatorComplete: isSeparatorComplete || undefined
|
|
85
|
-
})
|
|
80
|
+
: stepperVariants(variantProps)
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const slotClasses = $derived(
|
|
84
|
+
resolveSlotClasses(blocksConfig, 'StepperStep', preset, variantProps, slotClassesProp)
|
|
86
85
|
);
|
|
87
86
|
|
|
88
87
|
function slot(key: keyof typeof styles, extra?: string) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
import type { InteractiveTier } from '../../utils';
|
|
4
|
-
import type { StepperVariants } from './stepper.variants';
|
|
4
|
+
import type { StepperSlots, StepperVariants } from './stepper.variants';
|
|
5
5
|
/** Context for Stepper ↔ StepperStep communication */
|
|
6
6
|
export interface StepperContext {
|
|
7
7
|
readonly activeStep: number;
|
|
@@ -91,8 +91,8 @@ export interface StepperProps extends Omit<StepperVariants, 'stepState' | 'click
|
|
|
91
91
|
class?: string;
|
|
92
92
|
/** Remove all default tv() classes. */
|
|
93
93
|
unstyled?: boolean;
|
|
94
|
-
/** Per-slot class overrides. */
|
|
95
|
-
slotClasses?: Partial<Record<
|
|
94
|
+
/** Per-slot class overrides. Slots: base | stepItem | step | indicatorColumn | indicator | labelGroup | label | description | separator | content */
|
|
95
|
+
slotClasses?: Partial<Record<StepperSlots, string>>;
|
|
96
96
|
/**
|
|
97
97
|
* Apply a named preset registered via `<BlocksProvider presets={{ Stepper: {...} }}>`.
|
|
98
98
|
* Prefer this over `class` overrides when the requested look falls outside the
|
|
@@ -138,8 +138,8 @@ export interface StepperStepProps extends Omit<HTMLAttributes<HTMLLIElement>, 'c
|
|
|
138
138
|
class?: string;
|
|
139
139
|
/** Remove all default tv() classes. */
|
|
140
140
|
unstyled?: boolean;
|
|
141
|
-
/** Per-slot class overrides. */
|
|
142
|
-
slotClasses?: Partial<Record<
|
|
141
|
+
/** Per-slot class overrides (subset of Stepper's, minus the root `base`). */
|
|
142
|
+
slotClasses?: Partial<Record<Exclude<StepperSlots, 'base'>, string>>;
|
|
143
143
|
/**
|
|
144
144
|
* Apply a named preset registered via `<BlocksProvider presets={{ StepperStep: {...} }}>`.
|
|
145
145
|
* 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 stepperVariants: (props?: import("../../utils/variants").TVProps<{
|
|
3
3
|
tier: {
|
|
4
4
|
commit: {
|
|
@@ -231,3 +231,5 @@ export declare const stepperVariants: (props?: import("../../utils/variants").TV
|
|
|
231
231
|
}) | undefined) => string;
|
|
232
232
|
};
|
|
233
233
|
export type StepperVariants = VariantProps<typeof stepperVariants>;
|
|
234
|
+
/** Slot names derived from the tv() config — single source of truth for slotClasses. */
|
|
235
|
+
export type StepperSlots = SlotNames<typeof stepperVariants>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { SvelteMap } from 'svelte/reactivity';
|
|
3
|
-
import { getBlocksConfig,
|
|
3
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
4
4
|
import { getTierContext } from '../../utils';
|
|
5
|
-
import { tabVariants } from './tab.variants';
|
|
5
|
+
import { tabVariants, type TabVariants } from './tab.variants';
|
|
6
6
|
import { setTabContext } from './tab.context';
|
|
7
7
|
import type { TabContext, TabProps } from './index';
|
|
8
8
|
|
|
@@ -34,13 +34,6 @@
|
|
|
34
34
|
|
|
35
35
|
const blocksConfig = getBlocksConfig();
|
|
36
36
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
37
|
-
const slotClasses = $derived(
|
|
38
|
-
mergeSlotClasses(
|
|
39
|
-
blocksConfig?.defaults?.Tab?.slotClasses,
|
|
40
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'Tab', preset),
|
|
41
|
-
slotClassesProp
|
|
42
|
-
)
|
|
43
|
-
);
|
|
44
37
|
|
|
45
38
|
let tabListElement = $state<HTMLDivElement>();
|
|
46
39
|
let indicatorStyle = $state('');
|
|
@@ -51,14 +44,18 @@
|
|
|
51
44
|
|
|
52
45
|
const registeredTabs = new SvelteMap<string, HTMLElement>();
|
|
53
46
|
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
47
|
+
const variantProps: TabVariants = $derived({
|
|
48
|
+
variant,
|
|
49
|
+
orientation,
|
|
50
|
+
size,
|
|
51
|
+
tier: effectiveTier,
|
|
52
|
+
fullWidth
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const styles = $derived(tabVariants(variantProps));
|
|
56
|
+
|
|
57
|
+
const slotClasses = $derived(
|
|
58
|
+
resolveSlotClasses(blocksConfig, 'Tab', preset, variantProps, slotClassesProp)
|
|
62
59
|
);
|
|
63
60
|
|
|
64
61
|
function updateIndicator() {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount } from 'svelte';
|
|
3
|
-
import { getBlocksConfig,
|
|
3
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
4
4
|
import { mintRegistry } from '../..';
|
|
5
5
|
import type { TabItemProps } from './index';
|
|
6
6
|
import { getTabContext } from './tab.context';
|
|
7
|
-
import { tabVariants } from './tab.variants';
|
|
7
|
+
import { tabVariants, type TabVariants } from './tab.variants';
|
|
8
8
|
|
|
9
9
|
let {
|
|
10
10
|
value,
|
|
@@ -21,13 +21,6 @@
|
|
|
21
21
|
|
|
22
22
|
const blocksConfig = getBlocksConfig();
|
|
23
23
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
24
|
-
const slotClasses = $derived(
|
|
25
|
-
mergeSlotClasses(
|
|
26
|
-
blocksConfig?.defaults?.TabItem?.slotClasses,
|
|
27
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'TabItem', preset),
|
|
28
|
-
slotClassesProp
|
|
29
|
-
)
|
|
30
|
-
);
|
|
31
24
|
|
|
32
25
|
let tabItemElement = $state<HTMLButtonElement>();
|
|
33
26
|
const tabContext = getTabContext();
|
|
@@ -39,13 +32,17 @@
|
|
|
39
32
|
const isActive = $derived(tabContext.isActive(value));
|
|
40
33
|
const isDisabled = $derived(disabled || tabContext.disabled);
|
|
41
34
|
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
35
|
+
const variantProps: TabVariants = $derived({
|
|
36
|
+
variant: tabContext.variant,
|
|
37
|
+
orientation: tabContext.orientation,
|
|
38
|
+
size: tabContext.size,
|
|
39
|
+
tier: tabContext.tier
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const styles = $derived(tabVariants(variantProps));
|
|
43
|
+
|
|
44
|
+
const slotClasses = $derived(
|
|
45
|
+
resolveSlotClasses(blocksConfig, 'TabItem', preset, variantProps, slotClassesProp)
|
|
49
46
|
);
|
|
50
47
|
|
|
51
48
|
onMount(() => {
|
|
@@ -85,17 +82,19 @@
|
|
|
85
82
|
{...restProps}
|
|
86
83
|
>
|
|
87
84
|
{#if icon}
|
|
88
|
-
<span class={unstyled ? '' : styles.icon()}>
|
|
85
|
+
<span class={unstyled ? (slotClasses?.icon ?? '') : styles.icon({ class: slotClasses?.icon })}>
|
|
89
86
|
{@render icon()}
|
|
90
87
|
</span>
|
|
91
88
|
{/if}
|
|
92
89
|
|
|
93
|
-
<span class={unstyled ? '' : styles.label()}>
|
|
90
|
+
<span class={unstyled ? (slotClasses?.label ?? '') : styles.label({ class: slotClasses?.label })}>
|
|
94
91
|
{@render children()}
|
|
95
92
|
</span>
|
|
96
93
|
|
|
97
94
|
{#if badge}
|
|
98
|
-
<span
|
|
95
|
+
<span
|
|
96
|
+
class={unstyled ? (slotClasses?.badge ?? '') : styles.badge({ class: slotClasses?.badge })}
|
|
97
|
+
>
|
|
99
98
|
{@render badge()}
|
|
100
99
|
</span>
|
|
101
100
|
{/if}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { getBlocksConfig,
|
|
2
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
3
3
|
import type { TabPanelProps } from './index';
|
|
4
4
|
import { getTabContext } from './tab.context';
|
|
5
|
-
import { tabVariants } from './tab.variants';
|
|
5
|
+
import { tabVariants, type TabVariants } from './tab.variants';
|
|
6
6
|
import { fade } from 'svelte/transition';
|
|
7
7
|
|
|
8
8
|
let {
|
|
@@ -20,13 +20,6 @@
|
|
|
20
20
|
|
|
21
21
|
const blocksConfig = getBlocksConfig();
|
|
22
22
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
23
|
-
const slotClasses = $derived(
|
|
24
|
-
mergeSlotClasses(
|
|
25
|
-
blocksConfig?.defaults?.TabPanel?.slotClasses,
|
|
26
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'TabPanel', preset),
|
|
27
|
-
slotClassesProp
|
|
28
|
-
)
|
|
29
|
-
);
|
|
30
23
|
|
|
31
24
|
const tabContext = getTabContext();
|
|
32
25
|
|
|
@@ -48,10 +41,14 @@
|
|
|
48
41
|
return false;
|
|
49
42
|
});
|
|
50
43
|
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
const variantProps: TabVariants = $derived({
|
|
45
|
+
size: tabContext.size
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const styles = $derived(tabVariants(variantProps));
|
|
49
|
+
|
|
50
|
+
const slotClasses = $derived(
|
|
51
|
+
resolveSlotClasses(blocksConfig, 'TabPanel', preset, variantProps, slotClassesProp)
|
|
55
52
|
);
|
|
56
53
|
</script>
|
|
57
54
|
|
|
@@ -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';
|
|
5
|
-
import type { TabVariants } from './tab.variants';
|
|
5
|
+
import type { TabSlots, TabVariants } from './tab.variants';
|
|
6
6
|
export interface TabContext {
|
|
7
7
|
registerTab: (value: string, element: HTMLElement) => () => void;
|
|
8
8
|
selectTab: (value: string) => void;
|
|
@@ -53,8 +53,8 @@ interface TabBaseProps extends Omit<TabVariants, 'orientation' | 'fullWidth'>, O
|
|
|
53
53
|
class?: string;
|
|
54
54
|
/** Strip all default tv() styles from the container and children. */
|
|
55
55
|
unstyled?: boolean;
|
|
56
|
-
/** Per-slot class overrides merged with (or replacing when unstyled) tv() styles. */
|
|
57
|
-
slotClasses?: Partial<Record<
|
|
56
|
+
/** Per-slot class overrides merged with (or replacing when unstyled) tv() styles. Slots: base | list | trigger | icon | label | badge | panel | indicator */
|
|
57
|
+
slotClasses?: Partial<Record<TabSlots, string>>;
|
|
58
58
|
/**
|
|
59
59
|
* Apply a named preset registered via `<BlocksProvider presets={{ Tab: {...} }}>`.
|
|
60
60
|
* Prefer this over `class` overrides when the requested look falls outside the
|
|
@@ -152,8 +152,8 @@ export interface TabItemProps extends Omit<HTMLAttributes<HTMLButtonElement>, 'c
|
|
|
152
152
|
class?: string;
|
|
153
153
|
/** Strip default tv() styles from this trigger. */
|
|
154
154
|
unstyled?: boolean;
|
|
155
|
-
/** Per-slot class overrides for the trigger. */
|
|
156
|
-
slotClasses?: Partial<Record<'trigger'
|
|
155
|
+
/** Per-slot class overrides for the trigger. Slots (subset of Tab's): trigger | icon | label | badge */
|
|
156
|
+
slotClasses?: Partial<Record<Extract<TabSlots, 'trigger' | 'icon' | 'label' | 'badge'>, string>>;
|
|
157
157
|
/**
|
|
158
158
|
* Apply a named preset registered via `<BlocksProvider presets={{ TabItem: {...} }}>`.
|
|
159
159
|
* Prefer this over `class` overrides when the requested look falls outside the
|
|
@@ -185,8 +185,8 @@ export interface TabPanelProps extends Omit<HTMLAttributes<HTMLDivElement>, 'chi
|
|
|
185
185
|
class?: string;
|
|
186
186
|
/** Strip default tv() styles from this panel. */
|
|
187
187
|
unstyled?: boolean;
|
|
188
|
-
/** Per-slot class overrides for the panel. */
|
|
189
|
-
slotClasses?: Partial<Record<'panel'
|
|
188
|
+
/** Per-slot class overrides for the panel. Slot (subset of Tab's): panel */
|
|
189
|
+
slotClasses?: Partial<Record<Extract<TabSlots, 'panel'>, string>>;
|
|
190
190
|
/**
|
|
191
191
|
* Apply a named preset registered via `<BlocksProvider presets={{ TabPanel: {...} }}>`.
|
|
192
192
|
* 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 tabVariants: (props?: import("../../utils/variants").TVProps<{
|
|
3
3
|
variant: {
|
|
4
4
|
line: {
|
|
@@ -143,3 +143,5 @@ export declare const tabVariants: (props?: import("../../utils/variants").TVProp
|
|
|
143
143
|
}) | undefined) => string;
|
|
144
144
|
};
|
|
145
145
|
export type TabVariants = VariantProps<typeof tabVariants>;
|
|
146
|
+
/** Slot names derived from the tv() config — single source of truth for slotClasses. */
|
|
147
|
+
export type TabSlots = SlotNames<typeof tabVariants>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { mintRegistry } from '../..';
|
|
3
|
-
import { getBlocksConfig,
|
|
3
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
4
4
|
import { useFormField, getTierContext } from '../../utils';
|
|
5
5
|
import type { TextareaProps } from './index';
|
|
6
|
-
import { textareaVariants } from './textarea.variants';
|
|
6
|
+
import { textareaVariants, type TextareaVariants } from './textarea.variants';
|
|
7
7
|
|
|
8
8
|
let {
|
|
9
9
|
label,
|
|
@@ -36,13 +36,6 @@
|
|
|
36
36
|
|
|
37
37
|
const blocksConfig = getBlocksConfig();
|
|
38
38
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
39
|
-
const slotClasses = $derived(
|
|
40
|
-
mergeSlotClasses(
|
|
41
|
-
blocksConfig?.defaults?.Textarea?.slotClasses,
|
|
42
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'Textarea', preset),
|
|
43
|
-
slotClassesProp
|
|
44
|
-
)
|
|
45
|
-
);
|
|
46
39
|
|
|
47
40
|
let textareaRef = $state<HTMLTextAreaElement>();
|
|
48
41
|
|
|
@@ -66,20 +59,27 @@
|
|
|
66
59
|
|
|
67
60
|
const showFooter = $derived(!!error || !!helper || (showCounter && maxlength));
|
|
68
61
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
62
|
+
// Variant props feed both the tv() style computation and the slot-class
|
|
63
|
+
// cascade — extracted into one derived so `resolveSlotClasses` can match
|
|
64
|
+
// conditional `overrides` against the textarea's active variants.
|
|
65
|
+
const variantProps: TextareaVariants = $derived({
|
|
66
|
+
tier: effectiveTier,
|
|
67
|
+
variant,
|
|
68
|
+
size,
|
|
69
|
+
intent,
|
|
70
|
+
autoResize: autoResize || undefined,
|
|
71
|
+
disabled: disabled || undefined,
|
|
72
|
+
readonly: readonly || undefined,
|
|
73
|
+
error: !!error || undefined,
|
|
74
|
+
required: required || undefined,
|
|
75
|
+
messageType: error ? 'error' : 'helper',
|
|
76
|
+
counterState
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const styles = $derived(textareaVariants(variantProps));
|
|
80
|
+
|
|
81
|
+
const slotClasses = $derived(
|
|
82
|
+
resolveSlotClasses(blocksConfig, 'Textarea', preset, variantProps, slotClassesProp)
|
|
83
83
|
);
|
|
84
84
|
|
|
85
85
|
const lineHeight = $derived(size === 'sm' ? 20 : size === 'lg' ? 28 : 24);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
2
2
|
import type { MintProp } from '../../mint';
|
|
3
|
-
import type { TextareaVariants } from './textarea.variants';
|
|
3
|
+
import type { TextareaSlots, TextareaVariants } from './textarea.variants';
|
|
4
4
|
/**
|
|
5
5
|
* @description Multi-line text input with auto-resize, character counter, and validation states.
|
|
6
6
|
* Shares the same variant/intent/size system as Input for visual consistency.
|
|
@@ -59,8 +59,12 @@ export interface TextareaProps extends Omit<TextareaVariants, 'error' | 'counter
|
|
|
59
59
|
class?: string;
|
|
60
60
|
/** Remove all default tv() classes. Only user-provided classes apply. */
|
|
61
61
|
unstyled?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Per-slot class overrides merged with tv() styles. Slots: wrapper (root —
|
|
64
|
+
* what `class` also targets) | base (the `<textarea>` element) | label |
|
|
65
|
+
* footer | message | counter.
|
|
66
|
+
*/
|
|
67
|
+
slotClasses?: Partial<Record<TextareaSlots, string>>;
|
|
64
68
|
/**
|
|
65
69
|
* Apply a named preset registered via `<BlocksProvider presets={{ Textarea: {...} }}>`.
|
|
66
70
|
* 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 textareaVariants: (props?: import("../../utils/variants").TVProps<{
|
|
3
3
|
tier: {
|
|
4
4
|
modify: {
|
|
@@ -191,3 +191,5 @@ export declare const textareaVariants: (props?: import("../../utils/variants").T
|
|
|
191
191
|
}) | undefined) => string;
|
|
192
192
|
};
|
|
193
193
|
export type TextareaVariants = VariantProps<typeof textareaVariants>;
|
|
194
|
+
/** Slot names derived from the `tv()` config above — single source of truth for `slotClasses`. */
|
|
195
|
+
export type TextareaSlots = SlotNames<typeof textareaVariants>;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import SuccessCircleIconDefault from '../../icons/SuccessCircleIcon.svelte';
|
|
11
11
|
import WarningTriangleIconDefault from '../../icons/WarningTriangleIcon.svelte';
|
|
12
12
|
import DangerCircleIconDefault from '../../icons/DangerCircleIcon.svelte';
|
|
13
|
-
import { getBlocksConfig,
|
|
13
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
14
14
|
import type { ToastProps } from './index';
|
|
15
15
|
|
|
16
16
|
const bt = useBlocksI18n();
|
|
@@ -38,12 +38,11 @@
|
|
|
38
38
|
|
|
39
39
|
const blocksConfig = getBlocksConfig();
|
|
40
40
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
41
|
+
// Component-level slot-class cascade. Per-toast `intent` is NOT part of
|
|
42
|
+
// activeProps — it is applied per row in the `slot(key, intent)` helper via
|
|
43
|
+
// its own `toastVariants({ placement, intent })` call (see below).
|
|
41
44
|
const slotClasses = $derived(
|
|
42
|
-
|
|
43
|
-
blocksConfig?.defaults?.Toaster?.slotClasses,
|
|
44
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'Toaster', preset),
|
|
45
|
-
slotClassesProp
|
|
46
|
-
)
|
|
45
|
+
resolveSlotClasses(blocksConfig, 'Toaster', preset, { placement }, slotClassesProp)
|
|
47
46
|
);
|
|
48
47
|
|
|
49
48
|
$effect(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
-
import type { ToastPlacement } from './toast.variants';
|
|
2
|
+
import type { ToasterSlots, ToastPlacement } from './toast.variants';
|
|
3
3
|
/**
|
|
4
4
|
* Canonical intents accepted by the toaster. Use as a runtime list when
|
|
5
5
|
* building dispatchers (e.g. `toaster[intent]?.(title, opts)`); use
|
|
@@ -82,7 +82,7 @@ export interface ToastProps extends Omit<HTMLAttributes<HTMLDivElement>, 'childr
|
|
|
82
82
|
/** Strip all default tv classes. Use with `slotClasses` for a fully custom look. */
|
|
83
83
|
unstyled?: boolean;
|
|
84
84
|
/** Per-slot class overrides merged with (or replacing, when `unstyled`) the default styles. */
|
|
85
|
-
slotClasses?: Partial<Record<
|
|
85
|
+
slotClasses?: Partial<Record<ToasterSlots, string>>;
|
|
86
86
|
/**
|
|
87
87
|
* Apply a named preset registered via `<BlocksProvider presets={{ Toaster: {...} }}>`.
|
|
88
88
|
* 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 toastVariants: (props?: import("../../utils/variants").TVProps<{
|
|
3
3
|
intent: {
|
|
4
4
|
primary: {
|
|
@@ -111,4 +111,6 @@ export declare const toastVariants: (props?: import("../../utils/variants").TVPr
|
|
|
111
111
|
}) | undefined) => string;
|
|
112
112
|
};
|
|
113
113
|
export type ToastVariants = VariantProps<typeof toastVariants>;
|
|
114
|
+
/** Slot names derived from the tv() config — single source of truth for slotClasses. */
|
|
115
|
+
export type ToasterSlots = SlotNames<typeof toastVariants>;
|
|
114
116
|
export type ToastPlacement = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center';
|