@spaethtech/svelte-ui 0.20.1-dev.99.8654270 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Alert.svelte +15 -6
- package/dist/components/Alert.svelte.d.ts +4 -1
- package/dist/components/Avatar/Avatar.svelte +4 -2
- package/dist/components/Avatar/Avatar.svelte.d.ts +2 -1
- package/dist/components/Avatar/AvatarGroup.svelte +4 -1
- package/dist/components/Avatar/AvatarGroup.svelte.d.ts +2 -1
- package/dist/components/Badge/Badge.svelte +34 -7
- package/dist/components/Badge/Badge.svelte.d.ts +10 -1
- package/dist/components/Banner.svelte +4 -1
- package/dist/components/Banner.svelte.d.ts +2 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.svelte +4 -2
- package/dist/components/Breadcrumbs/Breadcrumbs.svelte.d.ts +2 -1
- package/dist/components/CardFooter.svelte +12 -1
- package/dist/components/CardFooter.svelte.d.ts +3 -0
- package/dist/components/Carousel/Carousel.svelte +4 -1
- package/dist/components/Carousel/Carousel.svelte.d.ts +2 -1
- package/dist/components/Chip/Chip.svelte +4 -1
- package/dist/components/Chip/Chip.svelte.d.ts +2 -1
- package/dist/components/Combobox/Combobox.svelte +4 -1
- package/dist/components/Combobox/Combobox.svelte.d.ts +2 -1
- package/dist/components/CommandPalette/CommandPalette.svelte +4 -2
- package/dist/components/CommandPalette/CommandPalette.svelte.d.ts +2 -1
- package/dist/components/ConfirmDialog.svelte +4 -1
- package/dist/components/ConfirmDialog.svelte.d.ts +2 -1
- package/dist/components/ContextMenu/ContextMenu.svelte +4 -2
- package/dist/components/ContextMenu/ContextMenu.svelte.d.ts +2 -1
- package/dist/components/DataTable.svelte +4 -1
- package/dist/components/DataTable.svelte.d.ts +2 -1
- package/dist/components/DatePicker.svelte +4 -2
- package/dist/components/DatePicker.svelte.d.ts +2 -1
- package/dist/components/Divider/Divider.svelte +6 -3
- package/dist/components/Divider/Divider.svelte.d.ts +2 -1
- package/dist/components/Drawer/Drawer.svelte +4 -1
- package/dist/components/Drawer/Drawer.svelte.d.ts +2 -1
- package/dist/components/EmailInput.svelte +2 -1
- package/dist/components/EmailInput.svelte.d.ts +2 -1
- package/dist/components/EmptyState/EmptyState.svelte +4 -2
- package/dist/components/EmptyState/EmptyState.svelte.d.ts +2 -1
- package/dist/components/FileUpload/FileUpload.svelte +4 -2
- package/dist/components/FileUpload/FileUpload.svelte.d.ts +2 -1
- package/dist/components/Grid.svelte +4 -2
- package/dist/components/Grid.svelte.d.ts +2 -1
- package/dist/components/Kbd/Kbd.svelte +5 -3
- package/dist/components/Kbd/Kbd.svelte.d.ts +2 -1
- package/dist/components/List.svelte +4 -2
- package/dist/components/List.svelte.d.ts +2 -1
- package/dist/components/Menu.svelte +4 -1
- package/dist/components/Menu.svelte.d.ts +2 -1
- package/dist/components/NumberInput.svelte +2 -1
- package/dist/components/NumberInput.svelte.d.ts +2 -1
- package/dist/components/Pagination/Pagination.svelte +4 -1
- package/dist/components/Pagination/Pagination.svelte.d.ts +2 -1
- package/dist/components/PasswordInput.svelte +2 -1
- package/dist/components/PasswordInput.svelte.d.ts +2 -1
- package/dist/components/Popup.svelte +8 -1
- package/dist/components/Popup.svelte.d.ts +2 -1
- package/dist/components/Progress/Progress.svelte +4 -2
- package/dist/components/Progress/Progress.svelte.d.ts +2 -1
- package/dist/components/Query.svelte +4 -2
- package/dist/components/Query.svelte.d.ts +2 -1
- package/dist/components/ScrollArea/ScrollArea.svelte +5 -2
- package/dist/components/ScrollArea/ScrollArea.svelte.d.ts +2 -1
- package/dist/components/SearchInput.svelte +2 -1
- package/dist/components/SearchInput.svelte.d.ts +2 -1
- package/dist/components/Select.svelte +3 -1
- package/dist/components/Select.svelte.d.ts +3 -1
- package/dist/components/SideBarMenu/SideBarMenu.svelte +7 -1
- package/dist/components/SideBarMenu/SideBarMenu.svelte.d.ts +2 -1
- package/dist/components/Skeleton/Skeleton.svelte +7 -2
- package/dist/components/Skeleton/Skeleton.svelte.d.ts +2 -1
- package/dist/components/Slider/Slider.svelte +4 -2
- package/dist/components/Slider/Slider.svelte.d.ts +2 -1
- package/dist/components/Spinner/Spinner.svelte +4 -1
- package/dist/components/Spinner/Spinner.svelte.d.ts +2 -1
- package/dist/components/Splitter/Splitter.svelte +4 -1
- package/dist/components/Splitter/Splitter.svelte.d.ts +2 -1
- package/dist/components/Stat/Stat.svelte +4 -2
- package/dist/components/Stat/Stat.svelte.d.ts +2 -1
- package/dist/components/Stepper/Stepper.svelte +4 -1
- package/dist/components/Stepper/Stepper.svelte.d.ts +2 -1
- package/dist/components/ThemeSelector.svelte +10 -2
- package/dist/components/ThemeSelector.svelte.d.ts +2 -1
- package/dist/components/ThemeToggle.svelte +10 -1
- package/dist/components/ThemeToggle.svelte.d.ts +2 -1
- package/dist/components/TimeRangeInput.svelte +5 -1
- package/dist/components/TimeRangeInput.svelte.d.ts +3 -1
- package/dist/components/Timeline/Timeline.svelte +4 -2
- package/dist/components/Timeline/Timeline.svelte.d.ts +2 -1
- package/dist/components/TokenInput/TokenInput.svelte +6 -1
- package/dist/components/TokenInput/TokenInput.svelte.d.ts +2 -1
- package/dist/components/Tree/Tree.svelte +11 -2
- package/dist/components/Tree/Tree.svelte.d.ts +2 -1
- package/dist/components/field-chrome.d.ts +22 -0
- package/dist/components/field-chrome.js +1 -0
- package/docs/components.md +27 -1
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
import { variantToken } from "../../types/variants.js";
|
|
19
19
|
import type { Size } from "../../types/sizes.js";
|
|
20
20
|
import { responsiveClasses, type Responsive } from "../../types/responsive.js";
|
|
21
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
21
22
|
|
|
22
23
|
let {
|
|
23
24
|
steps,
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
size = "md",
|
|
28
29
|
onstep,
|
|
29
30
|
class: cls = "",
|
|
31
|
+
...rest
|
|
30
32
|
}: {
|
|
31
33
|
steps: StepItem[];
|
|
32
34
|
current?: number;
|
|
@@ -35,7 +37,7 @@
|
|
|
35
37
|
size?: Responsive<Size>;
|
|
36
38
|
onstep?: (index: number) => void;
|
|
37
39
|
class?: string;
|
|
38
|
-
} = $props();
|
|
40
|
+
} & Omit<HTMLAttributes<HTMLElement>, "class"> = $props();
|
|
39
41
|
|
|
40
42
|
const token = $derived(variantToken[variant]);
|
|
41
43
|
const isH = $derived(orientation === "horizontal");
|
|
@@ -62,6 +64,7 @@
|
|
|
62
64
|
</script>
|
|
63
65
|
|
|
64
66
|
<ol
|
|
67
|
+
{...rest}
|
|
65
68
|
class="flex {isH ? 'flex-row items-start' : 'flex-col'} {cls}"
|
|
66
69
|
aria-label={i18n.messages.progress}
|
|
67
70
|
>
|
|
@@ -7,6 +7,7 @@ export type StepItem = {
|
|
|
7
7
|
import type { Variant } from "../../types/variants.js";
|
|
8
8
|
import type { Size } from "../../types/sizes.js";
|
|
9
9
|
import { type Responsive } from "../../types/responsive.js";
|
|
10
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
10
11
|
type $$ComponentProps = {
|
|
11
12
|
steps: StepItem[];
|
|
12
13
|
current?: number;
|
|
@@ -15,7 +16,7 @@ type $$ComponentProps = {
|
|
|
15
16
|
size?: Responsive<Size>;
|
|
16
17
|
onstep?: (index: number) => void;
|
|
17
18
|
class?: string;
|
|
18
|
-
}
|
|
19
|
+
} & Omit<HTMLAttributes<HTMLElement>, "class">;
|
|
19
20
|
declare const Stepper: import("svelte").Component<$$ComponentProps, {}, "current">;
|
|
20
21
|
type Stepper = ReturnType<typeof Stepper>;
|
|
21
22
|
export default Stepper;
|
|
@@ -5,10 +5,18 @@
|
|
|
5
5
|
import type { Size } from "../types/sizes.js";
|
|
6
6
|
import { responsiveClasses, type Responsive } from "../types/responsive.js";
|
|
7
7
|
import type { Variant } from "../types/variants.js";
|
|
8
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
8
9
|
import { applyTheme, readStoredTheme, type ThemeValue } from "./theme.js";
|
|
9
10
|
|
|
10
11
|
// Shared axes, forwarded to the underlying Select (and the label text tracks size).
|
|
11
|
-
let {
|
|
12
|
+
let {
|
|
13
|
+
size = "md",
|
|
14
|
+
variant,
|
|
15
|
+
...rest
|
|
16
|
+
}: { size?: Responsive<Size>; variant?: Variant } & Omit<
|
|
17
|
+
HTMLAttributes<HTMLDivElement>,
|
|
18
|
+
"class"
|
|
19
|
+
> = $props();
|
|
12
20
|
const labelText: Record<Size, string> = { sm: "text-xs", md: "text-sm", lg: "text-base" };
|
|
13
21
|
const labelClass = $derived(responsiveClasses(size, labelText));
|
|
14
22
|
|
|
@@ -33,7 +41,7 @@
|
|
|
33
41
|
});
|
|
34
42
|
</script>
|
|
35
43
|
|
|
36
|
-
<div class="flex items-center gap-2">
|
|
44
|
+
<div {...rest} class="flex items-center gap-2">
|
|
37
45
|
<label for="theme-selector" class="{labelClass} font-medium text-[var(--ui-color-text)]"
|
|
38
46
|
>Theme:</label
|
|
39
47
|
>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Size } from "../types/sizes.js";
|
|
2
2
|
import { type Responsive } from "../types/responsive.js";
|
|
3
3
|
import type { Variant } from "../types/variants.js";
|
|
4
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
5
|
type $$ComponentProps = {
|
|
5
6
|
size?: Responsive<Size>;
|
|
6
7
|
variant?: Variant;
|
|
7
|
-
}
|
|
8
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, "class">;
|
|
8
9
|
declare const ThemeSelector: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
9
10
|
type ThemeSelector = ReturnType<typeof ThemeSelector>;
|
|
10
11
|
export default ThemeSelector;
|
|
@@ -9,12 +9,18 @@
|
|
|
9
9
|
import type { Size } from "../types/sizes.js";
|
|
10
10
|
import type { Variant } from "../types/variants.js";
|
|
11
11
|
import type { Responsive } from "../types/responsive.js";
|
|
12
|
+
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
12
13
|
import { applyTheme, readStoredTheme, resolveTheme, type ThemeValue } from "./theme.js";
|
|
13
14
|
import IconSun from "~icons/mdi/weather-sunny";
|
|
14
15
|
import IconMoon from "~icons/mdi/weather-night";
|
|
15
16
|
|
|
16
17
|
// Shared axes, forwarded to the underlying Button. Icon-only, so it defaults to the chromeless ghost.
|
|
17
|
-
let {
|
|
18
|
+
let {
|
|
19
|
+
size = "md",
|
|
20
|
+
variant = "ghost",
|
|
21
|
+
...rest
|
|
22
|
+
}: { size?: Responsive<Size>; variant?: Variant } & Omit<HTMLButtonAttributes, "class"> =
|
|
23
|
+
$props();
|
|
18
24
|
|
|
19
25
|
// The stored value ("auto" until the user picks) and the tracked system preference.
|
|
20
26
|
let theme = $state<ThemeValue>("auto");
|
|
@@ -44,7 +50,10 @@
|
|
|
44
50
|
}
|
|
45
51
|
</script>
|
|
46
52
|
|
|
53
|
+
<!-- rest is fully typed on this component's own Props (below); the cast only sidesteps a TS
|
|
54
|
+
"union too complex" limit when spreading a wide attrs type into Button's ButtonProps|AnchorProps. -->
|
|
47
55
|
<Button
|
|
56
|
+
{...rest as Record<string, unknown>}
|
|
48
57
|
{size}
|
|
49
58
|
{variant}
|
|
50
59
|
onclick={toggle}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Size } from "../types/sizes.js";
|
|
2
2
|
import type { Variant } from "../types/variants.js";
|
|
3
3
|
import type { Responsive } from "../types/responsive.js";
|
|
4
|
+
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
4
5
|
type $$ComponentProps = {
|
|
5
6
|
size?: Responsive<Size>;
|
|
6
7
|
variant?: Variant;
|
|
7
|
-
}
|
|
8
|
+
} & Omit<HTMLButtonAttributes, "class">;
|
|
8
9
|
declare const ThemeToggle: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
9
10
|
type ThemeToggle = ReturnType<typeof ThemeToggle>;
|
|
10
11
|
export default ThemeToggle;
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
<script lang="ts">
|
|
12
12
|
import { uiI18n } from "../i18n.js";
|
|
13
13
|
const i18n = uiI18n();
|
|
14
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
15
|
+
import type { FieldChromeProps } from "./field-chrome.js";
|
|
14
16
|
import type { Size } from "../types/sizes.js";
|
|
15
17
|
import { responsiveClasses, type Responsive } from "../types/responsive.js";
|
|
16
18
|
import { resolveStep, type StepSpec } from "../types/time.js";
|
|
@@ -21,7 +23,9 @@
|
|
|
21
23
|
import IconClock from "~icons/mdi/clock-outline";
|
|
22
24
|
|
|
23
25
|
type RangeValue = { start: string | null; end: string | null };
|
|
24
|
-
interface Props
|
|
26
|
+
interface Props
|
|
27
|
+
extends Omit<HTMLInputAttributes, "type" | "value" | "size" | "step" | "class">,
|
|
28
|
+
FieldChromeProps {
|
|
25
29
|
/** `{ start, end }` with 24h `HH:MM` (or `HH:MM:SS` when `seconds`), or null. Bindable. */
|
|
26
30
|
value?: RangeValue | null;
|
|
27
31
|
/** Column interval: a number = minute step, or `{ hour, minute, second }`. Default 1 (minute). */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
2
|
+
import type { FieldChromeProps } from "./field-chrome.js";
|
|
1
3
|
import type { Size } from "../types/sizes.js";
|
|
2
4
|
import { type Responsive } from "../types/responsive.js";
|
|
3
5
|
import { type StepSpec } from "../types/time.js";
|
|
@@ -6,7 +8,7 @@ type RangeValue = {
|
|
|
6
8
|
start: string | null;
|
|
7
9
|
end: string | null;
|
|
8
10
|
};
|
|
9
|
-
interface Props {
|
|
11
|
+
interface Props extends Omit<HTMLInputAttributes, "type" | "value" | "size" | "step" | "class">, FieldChromeProps {
|
|
10
12
|
/** `{ start, end }` with 24h `HH:MM` (or `HH:MM:SS` when `seconds`), or null. Bindable. */
|
|
11
13
|
value?: RangeValue | null;
|
|
12
14
|
/** Column interval: a number = minute step, or `{ hour, minute, second }`. Default 1 (minute). */
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
21
|
<script lang="ts">
|
|
22
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
22
23
|
import { variantToken } from "../../types/variants.js";
|
|
23
24
|
import type { Size } from "../../types/sizes.js";
|
|
24
25
|
import { responsiveClasses, type Responsive } from "../../types/responsive.js";
|
|
@@ -28,12 +29,13 @@
|
|
|
28
29
|
variant = "primary",
|
|
29
30
|
size = "md",
|
|
30
31
|
class: cls = "",
|
|
32
|
+
...rest
|
|
31
33
|
}: {
|
|
32
34
|
items: TimelineItem[];
|
|
33
35
|
variant?: Variant;
|
|
34
36
|
size?: Responsive<Size>;
|
|
35
37
|
class?: string;
|
|
36
|
-
} = $props();
|
|
38
|
+
} & Omit<HTMLAttributes<HTMLOListElement>, "class"> = $props();
|
|
37
39
|
|
|
38
40
|
const dotSize: Record<Size, string> = { sm: "w-2.5 h-2.5", md: "w-3 h-3", lg: "w-3.5 h-3.5" };
|
|
39
41
|
const iconBox: Record<Size, string> = {
|
|
@@ -45,7 +47,7 @@
|
|
|
45
47
|
const tokenFor = (item: TimelineItem) => variantToken[item.variant ?? variant];
|
|
46
48
|
</script>
|
|
47
49
|
|
|
48
|
-
<ol class="flex flex-col {cls}">
|
|
50
|
+
<ol class="flex flex-col {cls}" {...rest}>
|
|
49
51
|
{#each items as item, i (i)}
|
|
50
52
|
{@const last = i === items.length - 1}
|
|
51
53
|
<li class="flex gap-3">
|
|
@@ -8,6 +8,7 @@ export type TimelineItem = {
|
|
|
8
8
|
variant?: Variant;
|
|
9
9
|
content?: Snippet;
|
|
10
10
|
};
|
|
11
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
11
12
|
import type { Size } from "../../types/sizes.js";
|
|
12
13
|
import { type Responsive } from "../../types/responsive.js";
|
|
13
14
|
type $$ComponentProps = {
|
|
@@ -15,7 +16,7 @@ type $$ComponentProps = {
|
|
|
15
16
|
variant?: Variant;
|
|
16
17
|
size?: Responsive<Size>;
|
|
17
18
|
class?: string;
|
|
18
|
-
}
|
|
19
|
+
} & Omit<HTMLAttributes<HTMLOListElement>, "class">;
|
|
19
20
|
declare const Timeline: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
20
21
|
type Timeline = ReturnType<typeof Timeline>;
|
|
21
22
|
export default Timeline;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
-->
|
|
9
9
|
<script lang="ts">
|
|
10
10
|
import type { Snippet } from "svelte";
|
|
11
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
11
12
|
import FieldChrome, { nextFieldId } from "../FieldChrome.svelte";
|
|
12
13
|
import Chip from "../Chip/Chip.svelte";
|
|
13
14
|
import type { Variant } from "../../types/variants.js";
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
id,
|
|
31
32
|
required = false,
|
|
32
33
|
class: cls = "",
|
|
34
|
+
...rest
|
|
33
35
|
}: {
|
|
34
36
|
values?: string[];
|
|
35
37
|
allowDuplicates?: boolean;
|
|
@@ -45,7 +47,9 @@
|
|
|
45
47
|
id?: string;
|
|
46
48
|
required?: boolean;
|
|
47
49
|
class?: string;
|
|
48
|
-
|
|
50
|
+
// Forwarded onto the field frame (`<label class="tok-field">`). `style` omitted — that frame
|
|
51
|
+
// computes its own (`--tok-border` vars). `class` goes to FieldChrome's chrome stack (existing).
|
|
52
|
+
} & Omit<HTMLAttributes<HTMLLabelElement>, "class" | "style"> = $props();
|
|
49
53
|
|
|
50
54
|
const controlId = id ?? nextFieldId();
|
|
51
55
|
const token = $derived(variantToken[variant]);
|
|
@@ -108,6 +112,7 @@
|
|
|
108
112
|
{#snippet control({ describedBy })}
|
|
109
113
|
<!-- A <label> so clicking anywhere in the field focuses the input natively (no JS handler). -->
|
|
110
114
|
<label
|
|
115
|
+
{...rest}
|
|
111
116
|
for={controlId}
|
|
112
117
|
class="tok-field flex flex-wrap items-center rounded-[var(--ui-border-radius)] border transition-colors {responsiveClasses(
|
|
113
118
|
size,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
3
|
import type { Variant } from "../../types/variants.js";
|
|
3
4
|
import type { Size } from "../../types/sizes.js";
|
|
4
5
|
import { type Responsive } from "../../types/responsive.js";
|
|
@@ -17,7 +18,7 @@ type $$ComponentProps = {
|
|
|
17
18
|
id?: string;
|
|
18
19
|
required?: boolean;
|
|
19
20
|
class?: string;
|
|
20
|
-
}
|
|
21
|
+
} & Omit<HTMLAttributes<HTMLLabelElement>, "class" | "style">;
|
|
21
22
|
declare const TokenInput: import("svelte").Component<$$ComponentProps, {}, "values">;
|
|
22
23
|
type TokenInput = ReturnType<typeof TokenInput>;
|
|
23
24
|
export default TokenInput;
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
<script lang="ts">
|
|
21
21
|
import IconChevronRight from "~icons/mdi/chevron-right";
|
|
22
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
22
23
|
import type { Variant } from "../../types/variants.js";
|
|
23
24
|
import { variantToken } from "../../types/variants.js";
|
|
24
25
|
import type { Size } from "../../types/sizes.js";
|
|
@@ -32,6 +33,7 @@
|
|
|
32
33
|
variant = "primary",
|
|
33
34
|
size = "md",
|
|
34
35
|
class: cls = "",
|
|
36
|
+
...rest
|
|
35
37
|
}: {
|
|
36
38
|
items: TreeNode[];
|
|
37
39
|
/** Keys of expanded nodes (bindable). */
|
|
@@ -42,7 +44,9 @@
|
|
|
42
44
|
variant?: Variant;
|
|
43
45
|
size?: Responsive<Size>;
|
|
44
46
|
class?: string;
|
|
45
|
-
|
|
47
|
+
// `style` omitted — rows compute their own inline style (indent + active tint). `onselect` omitted
|
|
48
|
+
// too: it collides with the DOM `onselect` in HTMLAttributes but has this component's own signature.
|
|
49
|
+
} & Omit<HTMLAttributes<HTMLElement>, "class" | "style" | "onselect"> = $props();
|
|
46
50
|
|
|
47
51
|
const token = $derived(variantToken[variant]);
|
|
48
52
|
const rowH: Record<Size, string> = { sm: "h-7 text-xs", md: "h-8 text-sm", lg: "h-10 text-base" };
|
|
@@ -137,7 +141,12 @@
|
|
|
137
141
|
</script>
|
|
138
142
|
|
|
139
143
|
<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
|
|
140
|
-
<ul
|
|
144
|
+
<ul
|
|
145
|
+
{...rest}
|
|
146
|
+
role="tree"
|
|
147
|
+
class="flex flex-col {responsiveClasses(size, iconCls)} {cls}"
|
|
148
|
+
onkeydown={onKeydown}
|
|
149
|
+
>
|
|
141
150
|
{#each flat as f (f.key)}
|
|
142
151
|
{@const active = selected === f.key}
|
|
143
152
|
<li role="none" class="list-none">
|
|
@@ -7,6 +7,7 @@ export type TreeNode = {
|
|
|
7
7
|
children?: TreeNode[];
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
};
|
|
10
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
10
11
|
import type { Variant } from "../../types/variants.js";
|
|
11
12
|
import type { Size } from "../../types/sizes.js";
|
|
12
13
|
import { type Responsive } from "../../types/responsive.js";
|
|
@@ -20,7 +21,7 @@ type $$ComponentProps = {
|
|
|
20
21
|
variant?: Variant;
|
|
21
22
|
size?: Responsive<Size>;
|
|
22
23
|
class?: string;
|
|
23
|
-
}
|
|
24
|
+
} & Omit<HTMLAttributes<HTMLElement>, "class" | "style" | "onselect">;
|
|
24
25
|
declare const Tree: import("svelte").Component<$$ComponentProps, {}, "selected" | "expanded">;
|
|
25
26
|
type Tree = ReturnType<typeof Tree>;
|
|
26
27
|
export default Tree;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
/**
|
|
3
|
+
* The shared **FieldChrome** vocabulary (`label` / `aside` / `error` / `description`) that `Input`,
|
|
4
|
+
* `TextArea`, and the specialized inputs (`PasswordInput` / `EmailInput` / `NumberInput` /
|
|
5
|
+
* `SearchInput`) all render through `FieldChrome`. See `FieldChrome.spec.md`.
|
|
6
|
+
*
|
|
7
|
+
* The specialized inputs forward `{...restProps}` into `<Input>` at runtime, so these props already
|
|
8
|
+
* WORK on them — they just weren't TYPED (their `Props` derived from `HTMLInputAttributes` alone,
|
|
9
|
+
* which has no `label`/`aside`/`error`/`description`). Extending this interface types them without any
|
|
10
|
+
* runtime change. `required`/`id` are NOT here — they are genuine `HTMLInputAttributes` and come from
|
|
11
|
+
* the base. Keep in sync with the chrome props declared on `Input`/`TextArea`.
|
|
12
|
+
*/
|
|
13
|
+
export interface FieldChromeProps {
|
|
14
|
+
/** Renders above the control; `null`/omitted → no label row. */
|
|
15
|
+
label?: string | null;
|
|
16
|
+
/** Right-aligned snippet in the label row. */
|
|
17
|
+
aside?: Snippet;
|
|
18
|
+
/** Inline error row (string → `{@html}`); also drives the shared error state (border + aria-invalid). */
|
|
19
|
+
error?: string | Snippet | null;
|
|
20
|
+
/** Muted help row below the control (string → `{@html}`). */
|
|
21
|
+
description?: string | Snippet | null;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/docs/components.md
CHANGED
|
@@ -17,6 +17,18 @@ Most sizeable/themeable components share two props (defined in `types/variants.t
|
|
|
17
17
|
- **`size`** — `sm` (24px), `md` (32px, **default**), `lg` (40px). Tied to the theme's
|
|
18
18
|
`--ui-height-sm` / `--ui-height` / `--ui-height-lg`.
|
|
19
19
|
|
|
20
|
+
## HTML attribute passthrough
|
|
21
|
+
|
|
22
|
+
Components forward the standard HTML attributes you pass — **`class`** (merged onto the root, appended
|
|
23
|
+
last so your classes win), **`data-*`** (e.g. a stable `data-testid` for e2e), **`aria-*`**, **`id`**,
|
|
24
|
+
**`title`**, and event handlers — onto their root element, typed against the matching `HTML*Attributes`.
|
|
25
|
+
So `<Badge data-testid="status" class="ml-2">` or `<Card onmouseenter={…}>` just work and type-check.
|
|
26
|
+
|
|
27
|
+
Exceptions: components that compute their own root **`style`** (themed `color-mix`, dimensions, drag
|
|
28
|
+
transforms — e.g. `Badge`, `Alert`, `Skeleton`, `DataTable`) do **not** accept a `style` override —
|
|
29
|
+
use `class`. Field-shaped components (`Input`, the specialized inputs, `Slider`, `TokenInput`,
|
|
30
|
+
`FileUpload`) route `class` to their outer field wrapper and land other attributes on the control.
|
|
31
|
+
|
|
20
32
|
## Field chrome (shared)
|
|
21
33
|
|
|
22
34
|
Every field-shaped component — `Input`, `Select`, `TextArea`, `Checkbox`, `Toggle` (and the
|
|
@@ -590,7 +602,21 @@ Status indicator / label.
|
|
|
590
602
|
- **Location**: `src/lib/components/Badge/Badge.svelte`
|
|
591
603
|
- **Axes**: `size`
|
|
592
604
|
- **Variants**: `default`, `primary`, `success`, `warning`, `danger`, `info`
|
|
593
|
-
- **Props**: `text`, `variant`, `size`, `dismissible`, `rounded`, `children`; dispatches `dismiss`
|
|
605
|
+
- **Props**: `text`, `variant`, `size`, `color`, `textColor`, `dismissible`, `rounded`, `href`, `children`; dispatches `dismiss`
|
|
606
|
+
- **Arbitrary colour (data-driven)**: `color` takes any CSS colour (e.g. a DB-stored `#rrggbb` for
|
|
607
|
+
operator-defined statuses) and overrides `variant` for the fill/border/text — `variant` is ignored
|
|
608
|
+
for colour when `color` is set (size/radius/`borderless` still apply). Pair with `textColor` (the
|
|
609
|
+
paired text/icon colour; default `var(--ui-color-text)`). The border stays on the shared tint scale
|
|
610
|
+
(`color` mixed toward the text at `--ui-tint-border-hover`, or just `color` when `borderless`). This
|
|
611
|
+
is the supported alternative to a `style` override, which the chip owns.
|
|
612
|
+
```svelte
|
|
613
|
+
<!-- operator-defined ticket status: {label, color: "#rrggbb", fg} from the DB -->
|
|
614
|
+
<Badge {size} borderless text={status.label} color={status.color} textColor={status.fg} />
|
|
615
|
+
```
|
|
616
|
+
- **Attribute passthrough**: leftover HTML attributes — `class` (merged, appended last), `data-*`
|
|
617
|
+
(e.g. a `data-testid` e2e hook), `aria-*`, `id`, `title`, event handlers — spread onto the chip's
|
|
618
|
+
root element. **`style` is not** passed through (the chip computes its own themed `style`); use
|
|
619
|
+
`class` for extra styling and **`color`/`textColor`** for an arbitrary chip colour.
|
|
594
620
|
|
|
595
621
|
### NotesEditor
|
|
596
622
|
|