@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,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { getBlocksConfig,
|
|
2
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
3
3
|
import { getTierContext, useFormField } from '../../utils';
|
|
4
4
|
import type { RadioGroupProps } from './index';
|
|
5
5
|
import { setRadioGroupContext } from './radioGroup.context';
|
|
6
|
-
import { radioGroupVariants } from './radioGroup.variants';
|
|
6
|
+
import { radioGroupVariants, type RadioGroupVariants } from './radioGroup.variants';
|
|
7
7
|
|
|
8
8
|
let {
|
|
9
9
|
children,
|
|
@@ -40,13 +40,6 @@
|
|
|
40
40
|
|
|
41
41
|
const blocksConfig = getBlocksConfig();
|
|
42
42
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
43
|
-
const slotClasses = $derived(
|
|
44
|
-
mergeSlotClasses(
|
|
45
|
-
blocksConfig?.defaults?.RadioGroup?.slotClasses,
|
|
46
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'RadioGroup', preset),
|
|
47
|
-
slotClassesProp
|
|
48
|
-
)
|
|
49
|
-
);
|
|
50
43
|
|
|
51
44
|
const groupId = $derived(id || `radiogroup-${propsId}`);
|
|
52
45
|
const labelId = $derived(label ? `${groupId}-label` : undefined);
|
|
@@ -59,13 +52,20 @@
|
|
|
59
52
|
disabled
|
|
60
53
|
}));
|
|
61
54
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
55
|
+
// Variant props feed both the tv() style computation and the slot-class
|
|
56
|
+
// cascade — extracted into one derived so `resolveSlotClasses` can match
|
|
57
|
+
// conditional `overrides` against the group's active variants.
|
|
58
|
+
const variantProps: RadioGroupVariants = $derived({
|
|
59
|
+
orientation,
|
|
60
|
+
required: required || undefined,
|
|
61
|
+
error: !!error || undefined,
|
|
62
|
+
disabled: disabled || undefined
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const styles = $derived(radioGroupVariants(variantProps));
|
|
66
|
+
|
|
67
|
+
const slotClasses = $derived(
|
|
68
|
+
resolveSlotClasses(blocksConfig, 'RadioGroup', preset, variantProps, slotClassesProp)
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
function select(itemValue: string) {
|
|
@@ -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 type { RadioItemProps } from './index';
|
|
5
5
|
import { getRadioGroupContext } from './radioGroup.context';
|
|
6
|
-
import { radioItemVariants } from './radioGroup.variants';
|
|
6
|
+
import { radioItemVariants, type RadioItemVariants } from './radioGroup.variants';
|
|
7
7
|
|
|
8
8
|
let {
|
|
9
9
|
value,
|
|
@@ -23,13 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
const blocksConfig = getBlocksConfig();
|
|
25
25
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
26
|
-
const slotClasses = $derived(
|
|
27
|
-
mergeSlotClasses(
|
|
28
|
-
blocksConfig?.defaults?.RadioItem?.slotClasses,
|
|
29
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'RadioItem', preset),
|
|
30
|
-
slotClassesProp
|
|
31
|
-
)
|
|
32
|
-
);
|
|
33
26
|
|
|
34
27
|
const ctx = getRadioGroupContext();
|
|
35
28
|
|
|
@@ -37,16 +30,23 @@
|
|
|
37
30
|
const isDisabled = $derived(ctx.disabled || disabledProp);
|
|
38
31
|
const dataState = $derived(isChecked ? 'checked' : 'unchecked');
|
|
39
32
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
33
|
+
// Variant props feed both the tv() style computation and the slot-class
|
|
34
|
+
// cascade — extracted into one derived so `resolveSlotClasses` can match
|
|
35
|
+
// conditional `overrides` against the item's active variants.
|
|
36
|
+
const variantProps: RadioItemVariants = $derived({
|
|
37
|
+
size: ctx.size,
|
|
38
|
+
intent: ctx.intent,
|
|
39
|
+
variant: ctx.variant,
|
|
40
|
+
tier: ctx.tier,
|
|
41
|
+
checked: isChecked,
|
|
42
|
+
disabled: isDisabled || undefined,
|
|
43
|
+
error: ctx.error || undefined
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const styles = $derived(radioItemVariants(variantProps));
|
|
47
|
+
|
|
48
|
+
const slotClasses = $derived(
|
|
49
|
+
resolveSlotClasses(blocksConfig, 'RadioItem', preset, variantProps, slotClassesProp)
|
|
50
50
|
);
|
|
51
51
|
|
|
52
52
|
let controlElement = $state<HTMLElement>();
|
|
@@ -2,7 +2,7 @@ import type { Snippet } from 'svelte';
|
|
|
2
2
|
import type { HTMLAttributes, HTMLInputAttributes } from 'svelte/elements';
|
|
3
3
|
import type { MintProp } from '../../mint';
|
|
4
4
|
import type { InteractiveTier } from '../../utils';
|
|
5
|
-
import type { RadioItemVariants } from './radioGroup.variants';
|
|
5
|
+
import type { RadioGroupSlots, RadioItemSlots, RadioItemVariants } from './radioGroup.variants';
|
|
6
6
|
/**
|
|
7
7
|
* @description Accessible radio group for single-option selection with semantic intents and form integration.
|
|
8
8
|
* Uses native radio inputs for correct form behavior and ARIA semantics with keyboard navigation.
|
|
@@ -60,7 +60,7 @@ export interface RadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'c
|
|
|
60
60
|
/** Remove all default tv() classes. Only user-provided classes apply. */
|
|
61
61
|
unstyled?: boolean;
|
|
62
62
|
/** Per-slot class overrides merged with tv() styles. */
|
|
63
|
-
slotClasses?: Partial<Record<
|
|
63
|
+
slotClasses?: Partial<Record<RadioGroupSlots, string>>;
|
|
64
64
|
/**
|
|
65
65
|
* Apply a named preset registered via `<BlocksProvider presets={{ RadioGroup: {...} }}>`.
|
|
66
66
|
* Prefer this over `class` overrides when the requested look falls outside the
|
|
@@ -110,7 +110,7 @@ export interface RadioItemProps extends Omit<HTMLInputAttributes, 'type' | 'size
|
|
|
110
110
|
/** Remove all default tv() classes for this item. */
|
|
111
111
|
unstyled?: boolean;
|
|
112
112
|
/** Per-slot class overrides for this item. */
|
|
113
|
-
slotClasses?: Partial<Record<
|
|
113
|
+
slotClasses?: Partial<Record<RadioItemSlots, string>>;
|
|
114
114
|
/**
|
|
115
115
|
* Apply a named preset registered via `<BlocksProvider presets={{ RadioItem: {...} }}>`.
|
|
116
116
|
* 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 radioGroupVariants: (props?: import("../../utils/variants").TVProps<{
|
|
3
3
|
orientation: {
|
|
4
4
|
horizontal: {
|
|
@@ -190,3 +190,6 @@ export declare const radioItemVariants: (props?: import("../../utils/variants").
|
|
|
190
190
|
};
|
|
191
191
|
export type RadioGroupVariants = VariantProps<typeof radioGroupVariants>;
|
|
192
192
|
export type RadioItemVariants = VariantProps<typeof radioItemVariants>;
|
|
193
|
+
/** Slot names derived from the `tv()` config above — single source of truth for `slotClasses`. */
|
|
194
|
+
export type RadioGroupSlots = SlotNames<typeof radioGroupVariants>;
|
|
195
|
+
export type RadioItemSlots = SlotNames<typeof radioItemVariants>;
|
|
@@ -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 { segmentGroupVariants } from './segmentgroup.variants';
|
|
5
|
+
import { segmentGroupVariants, type SegmentGroupVariants } from './segmentgroup.variants';
|
|
6
6
|
import { setSegmentGroupContext } from './segmentGroup.context';
|
|
7
7
|
import type { SegmentGroupContext, SegmentGroupProps } from './index';
|
|
8
8
|
|
|
@@ -32,13 +32,6 @@
|
|
|
32
32
|
|
|
33
33
|
const blocksConfig = getBlocksConfig();
|
|
34
34
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
35
|
-
const slotClasses = $derived(
|
|
36
|
-
mergeSlotClasses(
|
|
37
|
-
blocksConfig?.defaults?.SegmentGroup?.slotClasses,
|
|
38
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'SegmentGroup', preset),
|
|
39
|
-
slotClassesProp
|
|
40
|
-
)
|
|
41
|
-
);
|
|
42
35
|
|
|
43
36
|
let containerElement = $state<HTMLDivElement>();
|
|
44
37
|
let indicatorStyle = $state('opacity: 0;');
|
|
@@ -46,8 +39,18 @@
|
|
|
46
39
|
// reactive so the indicator updates when new items register.
|
|
47
40
|
const registeredItems = new SvelteMap<string, HTMLElement>();
|
|
48
41
|
|
|
49
|
-
const
|
|
50
|
-
|
|
42
|
+
const variantProps: SegmentGroupVariants = $derived({
|
|
43
|
+
size,
|
|
44
|
+
appearance,
|
|
45
|
+
tier: effectiveTier,
|
|
46
|
+
fullWidth,
|
|
47
|
+
disabled
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const styles = $derived(segmentGroupVariants(variantProps));
|
|
51
|
+
|
|
52
|
+
const slotClasses = $derived(
|
|
53
|
+
resolveSlotClasses(blocksConfig, 'SegmentGroup', preset, variantProps, slotClassesProp)
|
|
51
54
|
);
|
|
52
55
|
|
|
53
56
|
function updateIndicator() {
|
|
@@ -1,8 +1,8 @@
|
|
|
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
|
-
import { segmentGroupVariants } from './segmentgroup.variants';
|
|
5
|
+
import { segmentGroupVariants, type SegmentGroupVariants } from './segmentgroup.variants';
|
|
6
6
|
import { getSegmentGroupContext } from './segmentGroup.context';
|
|
7
7
|
import type { SegmentItemProps } from './index';
|
|
8
8
|
|
|
@@ -20,21 +20,22 @@
|
|
|
20
20
|
const ctx = getSegmentGroupContext();
|
|
21
21
|
const blocksConfig = getBlocksConfig();
|
|
22
22
|
const unstyled = $derived(unstyledProp || ctx.unstyled || blocksConfig?.unstyled || false);
|
|
23
|
-
const slotClasses = $derived(
|
|
24
|
-
mergeSlotClasses(
|
|
25
|
-
blocksConfig?.defaults?.SegmentItem?.slotClasses,
|
|
26
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'SegmentItem', preset),
|
|
27
|
-
slotClassesProp
|
|
28
|
-
)
|
|
29
|
-
);
|
|
30
23
|
|
|
31
24
|
let itemElement = $state<HTMLButtonElement>();
|
|
32
25
|
|
|
33
26
|
const isActive = $derived(ctx.isActive(value));
|
|
34
27
|
const isDisabled = $derived(disabled || ctx.disabled);
|
|
35
28
|
|
|
36
|
-
const
|
|
37
|
-
|
|
29
|
+
const variantProps: SegmentGroupVariants = $derived({
|
|
30
|
+
size: ctx.size,
|
|
31
|
+
appearance: ctx.appearance,
|
|
32
|
+
tier: ctx.tier
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const styles = $derived(segmentGroupVariants(variantProps));
|
|
36
|
+
|
|
37
|
+
const slotClasses = $derived(
|
|
38
|
+
resolveSlotClasses(blocksConfig, 'SegmentItem', preset, variantProps, slotClassesProp)
|
|
38
39
|
);
|
|
39
40
|
|
|
40
41
|
onMount(() => {
|
|
@@ -2,7 +2,7 @@ import type { Snippet } from 'svelte';
|
|
|
2
2
|
import type { HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
|
3
3
|
import type { MintProp } from '../../mint';
|
|
4
4
|
import type { InteractiveTier } from '../../utils';
|
|
5
|
-
import type { SegmentGroupVariants } from './segmentgroup.variants';
|
|
5
|
+
import type { SegmentGroupSlots, SegmentGroupVariants } from './segmentgroup.variants';
|
|
6
6
|
/**
|
|
7
7
|
* Reactive context exposed to child SegmentItem components.
|
|
8
8
|
*/
|
|
@@ -49,7 +49,7 @@ export interface SegmentGroupProps extends SegmentGroupVariants, Omit<HTMLAttrib
|
|
|
49
49
|
/** Remove all default tv() classes. */
|
|
50
50
|
unstyled?: boolean;
|
|
51
51
|
/** Per-slot class overrides merged with tv() styles. */
|
|
52
|
-
slotClasses?: Partial<Record<
|
|
52
|
+
slotClasses?: Partial<Record<SegmentGroupSlots, string>>;
|
|
53
53
|
/**
|
|
54
54
|
* Apply a named preset registered via `<BlocksProvider presets={{ SegmentGroup: {...} }}>`.
|
|
55
55
|
* Prefer this over `class` overrides when the requested look falls outside the
|
|
@@ -93,7 +93,7 @@ export interface SegmentItemProps extends Omit<HTMLButtonAttributes, 'children'>
|
|
|
93
93
|
/** Remove all default tv() classes. */
|
|
94
94
|
unstyled?: boolean;
|
|
95
95
|
/** Per-slot class overrides merged with tv() styles. */
|
|
96
|
-
slotClasses?: Partial<Record<'item'
|
|
96
|
+
slotClasses?: Partial<Record<Extract<SegmentGroupSlots, 'item'>, string>>;
|
|
97
97
|
/**
|
|
98
98
|
* Apply a named preset registered via `<BlocksProvider presets={{ SegmentItem: {...} }}>`.
|
|
99
99
|
* 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 segmentGroupVariants: (props?: import("../../utils/variants").TVProps<{
|
|
3
3
|
tier: {
|
|
4
4
|
commit: {
|
|
@@ -78,3 +78,5 @@ export declare const segmentGroupVariants: (props?: import("../../utils/variants
|
|
|
78
78
|
}) | undefined) => string;
|
|
79
79
|
};
|
|
80
80
|
export type SegmentGroupVariants = VariantProps<typeof segmentGroupVariants>;
|
|
81
|
+
/** Slot names derived from the `tv()` config above — single source of truth for `slotClasses`. */
|
|
82
|
+
export type SegmentGroupSlots = SlotNames<typeof segmentGroupVariants>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<script lang="ts" generics="T extends string | number | boolean = string">
|
|
2
2
|
import { useBlocksI18n, mintRegistry } from '../..';
|
|
3
3
|
import { useFormField, getTierContext, useFloatingListbox } from '../../utils';
|
|
4
|
-
import { getBlocksConfig,
|
|
4
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
5
5
|
import { resolveIcon } from '../../icons';
|
|
6
6
|
import ChevronDownIconDefault from '../../icons/ChevronDownIcon.svelte';
|
|
7
7
|
import CheckIconDefault from '../../icons/CheckIcon.svelte';
|
|
8
8
|
import CloseIconDefault from '../../icons/CloseIcon.svelte';
|
|
9
9
|
import type { SelectProps, SelectOption } from './index';
|
|
10
|
-
import { selectVariants } from './select.variants';
|
|
10
|
+
import { selectVariants, type SelectVariants } from './select.variants';
|
|
11
11
|
|
|
12
12
|
const bt = useBlocksI18n();
|
|
13
13
|
|
|
@@ -91,13 +91,6 @@
|
|
|
91
91
|
|
|
92
92
|
const blocksConfig = getBlocksConfig();
|
|
93
93
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
94
|
-
const slotClasses = $derived(
|
|
95
|
-
mergeSlotClasses(
|
|
96
|
-
blocksConfig?.defaults?.Select?.slotClasses,
|
|
97
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'Select', preset),
|
|
98
|
-
slotClassesProp
|
|
99
|
-
)
|
|
100
|
-
);
|
|
101
94
|
|
|
102
95
|
// ARIA wiring is shared with every form primitive — see XC-2.
|
|
103
96
|
// All IDs are `$derived` so they react if the consumer changes `idProp`
|
|
@@ -186,17 +179,24 @@
|
|
|
186
179
|
/** Backward-compatible single-mode accessor. */
|
|
187
180
|
const selectedOption = $derived(multiple ? null : (selectedOptions[0] ?? null));
|
|
188
181
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
182
|
+
// Variant props feed both the tv() style computation and the slot-class
|
|
183
|
+
// cascade — extracted into one derived so `resolveSlotClasses` can match
|
|
184
|
+
// conditional `overrides` against the select's active variants.
|
|
185
|
+
const variantProps: SelectVariants = $derived({
|
|
186
|
+
tier: effectiveTier,
|
|
187
|
+
variant,
|
|
188
|
+
size,
|
|
189
|
+
open: open || undefined,
|
|
190
|
+
disabled: disabled || undefined,
|
|
191
|
+
error: !!error || undefined,
|
|
192
|
+
required: required || undefined,
|
|
193
|
+
messageType: error ? 'error' : 'helper'
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
const styles = $derived(selectVariants(variantProps));
|
|
197
|
+
|
|
198
|
+
const slotClasses = $derived(
|
|
199
|
+
resolveSlotClasses(blocksConfig, 'Select', preset, variantProps, slotClassesProp)
|
|
200
200
|
);
|
|
201
201
|
|
|
202
202
|
$effect(() => {
|
|
@@ -581,7 +581,12 @@
|
|
|
581
581
|
<CheckIcon />
|
|
582
582
|
</span>
|
|
583
583
|
{/if}
|
|
584
|
-
<span
|
|
584
|
+
<span
|
|
585
|
+
class={unstyled
|
|
586
|
+
? (slotClasses?.optionLabel ?? '')
|
|
587
|
+
: styles.optionLabel({ class: slotClasses?.optionLabel })}
|
|
588
|
+
>{option.label}</span
|
|
589
|
+
>
|
|
585
590
|
{#if effectiveIndicator === 'checkmark'}
|
|
586
591
|
<CheckIcon
|
|
587
592
|
class={unstyled
|
|
@@ -641,7 +646,11 @@
|
|
|
641
646
|
<CheckIcon />
|
|
642
647
|
</span>
|
|
643
648
|
{/if}
|
|
644
|
-
<span
|
|
649
|
+
<span
|
|
650
|
+
class={unstyled
|
|
651
|
+
? (slotClasses?.optionLabel ?? '')
|
|
652
|
+
: styles.optionLabel({ class: slotClasses?.optionLabel })}>{option.label}</span
|
|
653
|
+
>
|
|
645
654
|
{#if effectiveIndicator === 'checkmark'}
|
|
646
655
|
<CheckIcon
|
|
647
656
|
class={unstyled
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
import type { MintProp } from '../../mint';
|
|
4
|
-
import type { SelectVariants } from './select.variants';
|
|
4
|
+
import type { SelectSlots, SelectVariants } from './select.variants';
|
|
5
5
|
/**
|
|
6
6
|
* Primitive value types accepted by Select / Combobox options.
|
|
7
7
|
* Strings are the default; numbers and booleans cover form fields
|
|
@@ -235,8 +235,13 @@ interface SelectBaseProps<T extends SelectValue = string> extends Omit<SelectVar
|
|
|
235
235
|
class?: string;
|
|
236
236
|
/** Remove all default tv() classes. */
|
|
237
237
|
unstyled?: boolean;
|
|
238
|
-
/**
|
|
239
|
-
|
|
238
|
+
/**
|
|
239
|
+
* Per-slot class overrides merged with tv() styles. Slots: wrapper (root —
|
|
240
|
+
* what `class` also targets) | base | trigger | triggerText | placeholder |
|
|
241
|
+
* chevron | clear | listbox | option | optionLabel | optionCheck |
|
|
242
|
+
* optionCheckbox | group | groupLabel | label | message.
|
|
243
|
+
*/
|
|
244
|
+
slotClasses?: Partial<Record<SelectSlots, string>>;
|
|
240
245
|
/**
|
|
241
246
|
* Apply a named preset registered via `<BlocksProvider presets={{ Select: {...} }}>`.
|
|
242
247
|
* 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 selectVariants: (props?: import("../../utils/variants").TVProps<{
|
|
3
3
|
tier: {
|
|
4
4
|
modify: {
|
|
@@ -311,3 +311,5 @@ export declare const selectVariants: (props?: import("../../utils/variants").TVP
|
|
|
311
311
|
}) | undefined) => string;
|
|
312
312
|
};
|
|
313
313
|
export type SelectVariants = VariantProps<typeof selectVariants>;
|
|
314
|
+
/** Slot names derived from the `tv()` config above — single source of truth for `slotClasses`. */
|
|
315
|
+
export type SelectSlots = SlotNames<typeof selectVariants>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { getBlocksConfig,
|
|
2
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
3
3
|
import { separatorVariants } from './separator.variants';
|
|
4
4
|
import type { SeparatorProps } from './index';
|
|
5
5
|
|
|
@@ -17,11 +17,7 @@
|
|
|
17
17
|
const blocksConfig = getBlocksConfig();
|
|
18
18
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
19
19
|
const slotClasses = $derived(
|
|
20
|
-
|
|
21
|
-
blocksConfig?.defaults?.Separator?.slotClasses,
|
|
22
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'Separator', preset),
|
|
23
|
-
slotClassesProp
|
|
24
|
-
)
|
|
20
|
+
resolveSlotClasses(blocksConfig, 'Separator', preset, { orientation, size }, slotClassesProp)
|
|
25
21
|
);
|
|
26
22
|
|
|
27
23
|
const classes = $derived(
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import { quintOut } from 'svelte/easing';
|
|
5
5
|
import { fade } from 'svelte/transition';
|
|
6
6
|
import type { SidebarProps } from './index';
|
|
7
|
-
import { sidebarVariants } from './sidebar.variants';
|
|
8
|
-
import { getBlocksConfig,
|
|
7
|
+
import { sidebarVariants, type SidebarVariants } from './sidebar.variants';
|
|
8
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
9
9
|
import { lockBodyScroll, unlockBodyScroll } from '../../utils/overlay';
|
|
10
10
|
import { overlayStack } from '../../utils';
|
|
11
11
|
|
|
@@ -29,16 +29,13 @@
|
|
|
29
29
|
|
|
30
30
|
const blocksConfig = getBlocksConfig();
|
|
31
31
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
32
|
+
|
|
33
|
+
const variantProps: SidebarVariants = $derived({ side, mode });
|
|
34
|
+
const styles = $derived(sidebarVariants(variantProps));
|
|
32
35
|
const slotClasses = $derived(
|
|
33
|
-
|
|
34
|
-
blocksConfig?.defaults?.Sidebar?.slotClasses,
|
|
35
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'Sidebar', preset),
|
|
36
|
-
slotClassesProp
|
|
37
|
-
)
|
|
36
|
+
resolveSlotClasses(blocksConfig, 'Sidebar', preset, variantProps, slotClassesProp)
|
|
38
37
|
);
|
|
39
38
|
|
|
40
|
-
const styles = $derived(sidebarVariants({ side, mode }));
|
|
41
|
-
|
|
42
39
|
const panelTransform = $derived(
|
|
43
40
|
open ? 'translateX(0)' : side === 'left' ? 'translateX(-100%)' : 'translateX(100%)'
|
|
44
41
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
import type { SidebarVariants } from './sidebar.variants';
|
|
3
|
+
import type { SidebarSlots, SidebarVariants } from './sidebar.variants';
|
|
4
4
|
/**
|
|
5
5
|
* @description Sidebar primitive — fixed-position panel that is permanent on
|
|
6
6
|
* desktop (≥1024px) and slides in as a backdropped overlay on mobile. Use
|
|
@@ -88,7 +88,7 @@ export interface SidebarProps extends Omit<HTMLAttributes<HTMLElement>, 'childre
|
|
|
88
88
|
/** Strip all default styles. Combine with slotClasses for custom appearance. */
|
|
89
89
|
unstyled?: boolean;
|
|
90
90
|
/** Per-slot class overrides merged with variant styles. */
|
|
91
|
-
slotClasses?: Partial<Record<
|
|
91
|
+
slotClasses?: Partial<Record<SidebarSlots, string>>;
|
|
92
92
|
/**
|
|
93
93
|
* Apply a named preset registered via `<BlocksProvider presets={{ Sidebar: {...} }}>`.
|
|
94
94
|
* 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 sidebarVariants: (props?: import("../../utils/variants").TVProps<{
|
|
3
3
|
side: {
|
|
4
4
|
left: {
|
|
@@ -55,3 +55,5 @@ export declare const sidebarVariants: (props?: import("../../utils/variants").TV
|
|
|
55
55
|
}) | undefined) => string;
|
|
56
56
|
};
|
|
57
57
|
export type SidebarVariants = VariantProps<typeof sidebarVariants>;
|
|
58
|
+
/** Slot names derived from the `tv()` config above — single source of truth for `slotClasses`. */
|
|
59
|
+
export type SidebarSlots = SlotNames<typeof sidebarVariants>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { useBlocksI18n } from '../..';
|
|
3
|
-
import { getBlocksConfig,
|
|
4
|
-
import { skeletonVariants } from './skeleton.variants';
|
|
3
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
4
|
+
import { skeletonVariants, type SkeletonVariants } from './skeleton.variants';
|
|
5
5
|
import type { SkeletonProps } from './index';
|
|
6
6
|
|
|
7
7
|
const bt = useBlocksI18n();
|
|
@@ -23,16 +23,14 @@
|
|
|
23
23
|
|
|
24
24
|
const blocksConfig = getBlocksConfig();
|
|
25
25
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
26
|
+
|
|
27
|
+
const variantProps: SkeletonVariants = $derived({ variant, size, animation });
|
|
28
|
+
const styles = $derived(skeletonVariants(variantProps));
|
|
29
|
+
|
|
26
30
|
const slotClasses = $derived(
|
|
27
|
-
|
|
28
|
-
blocksConfig?.defaults?.Skeleton?.slotClasses,
|
|
29
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'Skeleton', preset),
|
|
30
|
-
slotClassesProp
|
|
31
|
-
)
|
|
31
|
+
resolveSlotClasses(blocksConfig, 'Skeleton', preset, variantProps, slotClassesProp)
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
-
const styles = $derived(skeletonVariants({ variant, size, animation }));
|
|
35
|
-
|
|
36
34
|
const inlineStyle = $derived(
|
|
37
35
|
[width ? `width:${width}` : '', height ? `height:${height}` : ''].filter(Boolean).join(';') ||
|
|
38
36
|
undefined
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
-
import type { SkeletonVariants } from './skeleton.variants';
|
|
2
|
+
import type { SkeletonSlots, SkeletonVariants } from './skeleton.variants';
|
|
3
3
|
/**
|
|
4
4
|
* @description Placeholder loading animation that mimics content layout.
|
|
5
5
|
* Use to reduce perceived loading time and prevent layout shift.
|
|
@@ -49,8 +49,8 @@ export interface SkeletonProps extends SkeletonVariants, HTMLAttributes<HTMLDivE
|
|
|
49
49
|
class?: string;
|
|
50
50
|
/** Strip all default tv() classes. Combine with `slotClasses` for full control. */
|
|
51
51
|
unstyled?: boolean;
|
|
52
|
-
/** Per-slot class overrides merged with (or replacing, when `unstyled`) tv() output. */
|
|
53
|
-
slotClasses?: Partial<Record<
|
|
52
|
+
/** Per-slot class overrides merged with (or replacing, when `unstyled`) tv() output. Slots: base | wrapper */
|
|
53
|
+
slotClasses?: Partial<Record<SkeletonSlots, string>>;
|
|
54
54
|
/**
|
|
55
55
|
* Apply a named preset registered via `<BlocksProvider presets={{ Skeleton: {...} }}>`.
|
|
56
56
|
* 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 skeletonVariants: (props?: import("../../utils/variants").TVProps<{
|
|
3
3
|
variant: {
|
|
4
4
|
text: {
|
|
@@ -49,3 +49,5 @@ export declare const skeletonVariants: (props?: import("../../utils/variants").T
|
|
|
49
49
|
}) | undefined) => string;
|
|
50
50
|
};
|
|
51
51
|
export type SkeletonVariants = VariantProps<typeof skeletonVariants>;
|
|
52
|
+
/** Slot names derived from the tv() config — single source of truth for slotClasses. */
|
|
53
|
+
export type SkeletonSlots = SlotNames<typeof skeletonVariants>;
|
|
@@ -27,14 +27,13 @@ export const skeletonVariants = tv({
|
|
|
27
27
|
base: 'animate-pulse motion-reduce:animate-none'
|
|
28
28
|
},
|
|
29
29
|
wave: {
|
|
30
|
-
// `via-surface-hover`
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
30
|
+
// `via-surface-hover` would resolve to the same tone as the base
|
|
31
|
+
// `surface-interactive`, leaving the shimmer invisible. The
|
|
32
|
+
// `skeleton-shimmer` token is a translucent-white glint that stays
|
|
33
|
+
// mode-aware via light-dark() (lower alpha in dark) — no `dark:` needed.
|
|
34
34
|
base: [
|
|
35
35
|
'animate-[blocks-shimmer_1.5s_ease-in-out_infinite]',
|
|
36
|
-
'bg-linear-to-r from-surface-interactive via-
|
|
37
|
-
'dark:via-white/10',
|
|
36
|
+
'bg-linear-to-r from-surface-interactive via-skeleton-shimmer to-surface-interactive',
|
|
38
37
|
'bg-size-[200%_100%]',
|
|
39
38
|
'motion-reduce:animate-none'
|
|
40
39
|
]
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { useBlocksI18n, mintRegistry } from '../..';
|
|
3
|
-
import { getBlocksConfig,
|
|
3
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
4
4
|
import { useFormField } from '../../utils';
|
|
5
5
|
import type { SliderProps } from './index';
|
|
6
|
-
import { sliderVariants } from './slider.variants';
|
|
6
|
+
import { sliderVariants, type SliderVariants } from './slider.variants';
|
|
7
7
|
|
|
8
8
|
const bt = useBlocksI18n();
|
|
9
9
|
|
|
@@ -39,13 +39,6 @@
|
|
|
39
39
|
|
|
40
40
|
const blocksConfig = getBlocksConfig();
|
|
41
41
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
42
|
-
const slotClasses = $derived(
|
|
43
|
-
mergeSlotClasses(
|
|
44
|
-
blocksConfig?.defaults?.Slider?.slotClasses,
|
|
45
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'Slider', preset),
|
|
46
|
-
slotClassesProp
|
|
47
|
-
)
|
|
48
|
-
);
|
|
49
42
|
|
|
50
43
|
// ARIA wiring is shared with every form primitive — see XC-2.
|
|
51
44
|
// Slider additionally injects a `statusId` into describedBy when the
|
|
@@ -232,16 +225,23 @@
|
|
|
232
225
|
return '';
|
|
233
226
|
});
|
|
234
227
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
228
|
+
// Variant props feed both the tv() style computation and the slot-class
|
|
229
|
+
// cascade — extracted into one derived so `resolveSlotClasses` can match
|
|
230
|
+
// conditional `overrides` against the slider's active variants.
|
|
231
|
+
const variantProps: SliderVariants = $derived({
|
|
232
|
+
intent,
|
|
233
|
+
size,
|
|
234
|
+
appearance,
|
|
235
|
+
disabled: disabled || undefined,
|
|
236
|
+
error: !!error || undefined,
|
|
237
|
+
messageType: error ? 'error' : 'helper',
|
|
238
|
+
rangeStatus: currentZoneStatus
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
const styles = $derived(sliderVariants(variantProps));
|
|
242
|
+
|
|
243
|
+
const slotClasses = $derived(
|
|
244
|
+
resolveSlotClasses(blocksConfig, 'Slider', preset, variantProps, slotClassesProp)
|
|
245
245
|
);
|
|
246
246
|
|
|
247
247
|
// aria-describedby chain: error > helper, plus rangeStatus when active.
|