@xtyle/svelte 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/README.md +42 -0
  2. package/dist/Accordion.svelte +50 -0
  3. package/dist/Accordion.svelte.d.ts +22 -0
  4. package/dist/Alert.svelte +55 -0
  5. package/dist/Alert.svelte.d.ts +25 -0
  6. package/dist/AppShell.svelte +69 -0
  7. package/dist/AppShell.svelte.d.ts +27 -0
  8. package/dist/Avatar.svelte +53 -0
  9. package/dist/Avatar.svelte.d.ts +23 -0
  10. package/dist/AvatarGroup.svelte +31 -0
  11. package/dist/AvatarGroup.svelte.d.ts +18 -0
  12. package/dist/Badge.svelte +56 -0
  13. package/dist/Badge.svelte.d.ts +21 -0
  14. package/dist/Bar.svelte +69 -0
  15. package/dist/Bar.svelte.d.ts +30 -0
  16. package/dist/Breadcrumb.svelte +33 -0
  17. package/dist/Breadcrumb.svelte.d.ts +27 -0
  18. package/dist/Button.svelte +74 -0
  19. package/dist/Button.svelte.d.ts +28 -0
  20. package/dist/Card.svelte +26 -0
  21. package/dist/Card.svelte.d.ts +18 -0
  22. package/dist/CardLink.svelte +45 -0
  23. package/dist/CardLink.svelte.d.ts +18 -0
  24. package/dist/Carousel.svelte +39 -0
  25. package/dist/Carousel.svelte.d.ts +16 -0
  26. package/dist/Checkbox.svelte +59 -0
  27. package/dist/Checkbox.svelte.d.ts +21 -0
  28. package/dist/CheckboxGroup.svelte +47 -0
  29. package/dist/CheckboxGroup.svelte.d.ts +20 -0
  30. package/dist/Cluster.svelte +24 -0
  31. package/dist/Cluster.svelte.d.ts +17 -0
  32. package/dist/Code.svelte +29 -0
  33. package/dist/Code.svelte.d.ts +23 -0
  34. package/dist/ColorPicker.svelte +82 -0
  35. package/dist/ColorPicker.svelte.d.ts +26 -0
  36. package/dist/Dialog.svelte +60 -0
  37. package/dist/Dialog.svelte.d.ts +22 -0
  38. package/dist/Dock.svelte +57 -0
  39. package/dist/Dock.svelte.d.ts +23 -0
  40. package/dist/DockZone.svelte +74 -0
  41. package/dist/DockZone.svelte.d.ts +33 -0
  42. package/dist/Eyebrow.svelte +24 -0
  43. package/dist/Eyebrow.svelte.d.ts +17 -0
  44. package/dist/Field.svelte +92 -0
  45. package/dist/Field.svelte.d.ts +34 -0
  46. package/dist/FormGroup.svelte +43 -0
  47. package/dist/FormGroup.svelte.d.ts +18 -0
  48. package/dist/Grid.svelte +24 -0
  49. package/dist/Grid.svelte.d.ts +17 -0
  50. package/dist/Heading.svelte +20 -0
  51. package/dist/Heading.svelte.d.ts +14 -0
  52. package/dist/Heatmap.svelte +100 -0
  53. package/dist/Heatmap.svelte.d.ts +41 -0
  54. package/dist/Hero.svelte +20 -0
  55. package/dist/Hero.svelte.d.ts +13 -0
  56. package/dist/Icon.svelte +20 -0
  57. package/dist/Icon.svelte.d.ts +16 -0
  58. package/dist/Image.svelte +44 -0
  59. package/dist/Image.svelte.d.ts +19 -0
  60. package/dist/Kbd.svelte +21 -0
  61. package/dist/Kbd.svelte.d.ts +14 -0
  62. package/dist/Link.svelte +34 -0
  63. package/dist/Link.svelte.d.ts +18 -0
  64. package/dist/Menu.svelte +34 -0
  65. package/dist/Menu.svelte.d.ts +13 -0
  66. package/dist/NumberInput.svelte +76 -0
  67. package/dist/NumberInput.svelte.d.ts +25 -0
  68. package/dist/Pagination.svelte +56 -0
  69. package/dist/Pagination.svelte.d.ts +22 -0
  70. package/dist/Panel.svelte +52 -0
  71. package/dist/Panel.svelte.d.ts +19 -0
  72. package/dist/Parallax.svelte +19 -0
  73. package/dist/Parallax.svelte.d.ts +13 -0
  74. package/dist/Pie.svelte +48 -0
  75. package/dist/Pie.svelte.d.ts +17 -0
  76. package/dist/Progress.svelte +68 -0
  77. package/dist/Progress.svelte.d.ts +30 -0
  78. package/dist/Radio.svelte +72 -0
  79. package/dist/Radio.svelte.d.ts +24 -0
  80. package/dist/RadioGroup.svelte +39 -0
  81. package/dist/RadioGroup.svelte.d.ts +16 -0
  82. package/dist/Section.svelte +37 -0
  83. package/dist/Section.svelte.d.ts +21 -0
  84. package/dist/Segment.svelte +23 -0
  85. package/dist/Segment.svelte.d.ts +14 -0
  86. package/dist/Segmented.svelte +64 -0
  87. package/dist/Segmented.svelte.d.ts +28 -0
  88. package/dist/Select.svelte +57 -0
  89. package/dist/Select.svelte.d.ts +21 -0
  90. package/dist/Separator.svelte +23 -0
  91. package/dist/Separator.svelte.d.ts +16 -0
  92. package/dist/Skeleton.svelte +19 -0
  93. package/dist/Skeleton.svelte.d.ts +14 -0
  94. package/dist/Slider.svelte +82 -0
  95. package/dist/Slider.svelte.d.ts +24 -0
  96. package/dist/Sparkline.svelte +62 -0
  97. package/dist/Sparkline.svelte.d.ts +25 -0
  98. package/dist/Spinner.svelte +16 -0
  99. package/dist/Spinner.svelte.d.ts +12 -0
  100. package/dist/Splitter.svelte +85 -0
  101. package/dist/Splitter.svelte.d.ts +30 -0
  102. package/dist/Stack.svelte +23 -0
  103. package/dist/Stack.svelte.d.ts +16 -0
  104. package/dist/Stat.svelte +41 -0
  105. package/dist/Stat.svelte.d.ts +23 -0
  106. package/dist/Statusbar.svelte +50 -0
  107. package/dist/Statusbar.svelte.d.ts +20 -0
  108. package/dist/Swatch.svelte +48 -0
  109. package/dist/Swatch.svelte.d.ts +22 -0
  110. package/dist/Switch.svelte +69 -0
  111. package/dist/Switch.svelte.d.ts +24 -0
  112. package/dist/Table.svelte +39 -0
  113. package/dist/Table.svelte.d.ts +17 -0
  114. package/dist/Tabs.svelte +84 -0
  115. package/dist/Tabs.svelte.d.ts +28 -0
  116. package/dist/Text.svelte +38 -0
  117. package/dist/Text.svelte.d.ts +22 -0
  118. package/dist/Textarea.svelte +74 -0
  119. package/dist/Textarea.svelte.d.ts +25 -0
  120. package/dist/Toast.svelte +55 -0
  121. package/dist/Toast.svelte.d.ts +25 -0
  122. package/dist/Toc.svelte +22 -0
  123. package/dist/Toc.svelte.d.ts +15 -0
  124. package/dist/Toolbar.svelte +49 -0
  125. package/dist/Toolbar.svelte.d.ts +20 -0
  126. package/dist/Tooltip.svelte +28 -0
  127. package/dist/Tooltip.svelte.d.ts +19 -0
  128. package/dist/Tree.svelte +51 -0
  129. package/dist/Tree.svelte.d.ts +24 -0
  130. package/dist/elements.d.ts +65 -0
  131. package/dist/index.d.ts +65 -0
  132. package/dist/index.js +65 -0
  133. package/dist/register.d.ts +2 -0
  134. package/dist/register.js +2 -0
  135. package/package.json +41 -0
@@ -0,0 +1,68 @@
1
+ <script lang="ts">
2
+ import "./register.js";
3
+ import type { Snippet } from "svelte";
4
+ import type { FullTone as Tone } from "@xtyle/core";
5
+
6
+ type ProgressVariant = "linear" | "circular";
7
+ type ProgressSize = "sm" | "md" | "lg";
8
+
9
+ interface Props {
10
+ variant?: ProgressVariant;
11
+ tone?: Tone;
12
+ size?: ProgressSize;
13
+ value?: number;
14
+ min?: number;
15
+ max?: number;
16
+ indeterminate?: boolean;
17
+ showValue?: boolean;
18
+ /** How `showValue` reads: `percent` (`80%`), `value` (the raw number), or `value-max` (`80/100`). */
19
+ valueFormat?: "percent" | "value" | "value-max";
20
+ /** Where the `showValue` readout sits: after the bar (`end`) or laid over the fill (`inset`). */
21
+ valuePosition?: "end" | "inset";
22
+ /** Tint the `showValue` readout with the active tone. */
23
+ colorizeValue?: boolean;
24
+ /** Report `role="meter"` (a capacity measurement) instead of `role="progressbar"` (a task). */
25
+ meter?: boolean;
26
+ ariaLabel?: string;
27
+ children?: Snippet;
28
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
29
+ [key: string]: unknown;
30
+ }
31
+
32
+ let {
33
+ variant = "linear",
34
+ tone = "accent",
35
+ size = "md",
36
+ value = 0,
37
+ min = 0,
38
+ max = 100,
39
+ indeterminate = false,
40
+ showValue = false,
41
+ valueFormat = "percent",
42
+ valuePosition = "end",
43
+ colorizeValue = false,
44
+ meter = false,
45
+ ariaLabel,
46
+ children,
47
+ ...rest
48
+ }: Props = $props();
49
+ </script>
50
+
51
+ <xtyle-progress
52
+ {...rest}
53
+ {variant}
54
+ {tone}
55
+ {size}
56
+ value={indeterminate ? undefined : value}
57
+ {min}
58
+ {max}
59
+ indeterminate={indeterminate || undefined}
60
+ show-value={showValue || undefined}
61
+ value-format={valueFormat !== "percent" ? valueFormat : undefined}
62
+ value-position={valuePosition !== "end" ? valuePosition : undefined}
63
+ colorize-value={colorizeValue || undefined}
64
+ meter={meter || undefined}
65
+ aria-label={ariaLabel ?? (rest["aria-label"] as string | undefined)}
66
+ >
67
+ {@render children?.()}
68
+ </xtyle-progress>
@@ -0,0 +1,30 @@
1
+ import "./register.js";
2
+ import type { Snippet } from "svelte";
3
+ import type { FullTone as Tone } from "@xtyle/core";
4
+ type ProgressVariant = "linear" | "circular";
5
+ type ProgressSize = "sm" | "md" | "lg";
6
+ interface Props {
7
+ variant?: ProgressVariant;
8
+ tone?: Tone;
9
+ size?: ProgressSize;
10
+ value?: number;
11
+ min?: number;
12
+ max?: number;
13
+ indeterminate?: boolean;
14
+ showValue?: boolean;
15
+ /** How `showValue` reads: `percent` (`80%`), `value` (the raw number), or `value-max` (`80/100`). */
16
+ valueFormat?: "percent" | "value" | "value-max";
17
+ /** Where the `showValue` readout sits: after the bar (`end`) or laid over the fill (`inset`). */
18
+ valuePosition?: "end" | "inset";
19
+ /** Tint the `showValue` readout with the active tone. */
20
+ colorizeValue?: boolean;
21
+ /** Report `role="meter"` (a capacity measurement) instead of `role="progressbar"` (a task). */
22
+ meter?: boolean;
23
+ ariaLabel?: string;
24
+ children?: Snippet;
25
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
26
+ [key: string]: unknown;
27
+ }
28
+ declare const Progress: import("svelte").Component<Props, {}, "">;
29
+ type Progress = ReturnType<typeof Progress>;
30
+ export default Progress;
@@ -0,0 +1,72 @@
1
+ <script lang="ts">
2
+ import "./register.js";
3
+ import type { Snippet } from "svelte";
4
+ import type { Size, FullTone as Tone } from "@xtyle/core";
5
+
6
+ interface Props {
7
+ tone?: Tone;
8
+ size?: Size;
9
+ name?: string;
10
+ value?: string;
11
+ checked?: boolean;
12
+ /** The selected value of the radio group, for `bind:group` across radios that share a `value`. */
13
+ group?: string;
14
+ disabled?: boolean;
15
+ invalid?: boolean;
16
+ label?: string;
17
+ labelledby?: string;
18
+ ariaLabel?: string;
19
+ onchange?: (event: Event) => void;
20
+ children?: Snippet;
21
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
22
+ [key: string]: unknown;
23
+ }
24
+
25
+ let {
26
+ tone = "accent",
27
+ size = "md",
28
+ name,
29
+ value,
30
+ checked = $bindable(false),
31
+ group = $bindable<string | undefined>(undefined),
32
+ disabled = false,
33
+ invalid = false,
34
+ label,
35
+ labelledby,
36
+ ariaLabel,
37
+ onchange,
38
+ children,
39
+ ...rest
40
+ }: Props = $props();
41
+
42
+ // With `bind:group`, the group's selected value drives checked (native radio-group semantics); a
43
+ // standalone radio keeps its own two-way `checked`.
44
+ const isChecked = $derived(group !== undefined ? group === value : checked);
45
+
46
+ function handleChange(event: Event) {
47
+ const target = event.target as HTMLElement & { checked: boolean };
48
+ if (group !== undefined) {
49
+ if (target.checked && value !== undefined) group = value;
50
+ } else {
51
+ checked = target.checked;
52
+ }
53
+ onchange?.(event);
54
+ }
55
+ </script>
56
+
57
+ <xtyle-radio
58
+ {...rest}
59
+ {tone}
60
+ {size}
61
+ {name}
62
+ {value}
63
+ checked={isChecked || undefined}
64
+ disabled={disabled || undefined}
65
+ invalid={invalid || undefined}
66
+ {label}
67
+ labelledby={labelledby || undefined}
68
+ aria-label={ariaLabel ?? (rest["aria-label"] as string | undefined)}
69
+ onchange={handleChange}
70
+ >
71
+ {@render children?.()}
72
+ </xtyle-radio>
@@ -0,0 +1,24 @@
1
+ import "./register.js";
2
+ import type { Snippet } from "svelte";
3
+ import type { Size, FullTone as Tone } from "@xtyle/core";
4
+ interface Props {
5
+ tone?: Tone;
6
+ size?: Size;
7
+ name?: string;
8
+ value?: string;
9
+ checked?: boolean;
10
+ /** The selected value of the radio group, for `bind:group` across radios that share a `value`. */
11
+ group?: string;
12
+ disabled?: boolean;
13
+ invalid?: boolean;
14
+ label?: string;
15
+ labelledby?: string;
16
+ ariaLabel?: string;
17
+ onchange?: (event: Event) => void;
18
+ children?: Snippet;
19
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
20
+ [key: string]: unknown;
21
+ }
22
+ declare const Radio: import("svelte").Component<Props, {}, "checked" | "group">;
23
+ type Radio = ReturnType<typeof Radio>;
24
+ export default Radio;
@@ -0,0 +1,39 @@
1
+ <script lang="ts">
2
+ import "./register.js";
3
+ import type { Snippet } from "svelte";
4
+
5
+ interface Props {
6
+ orientation?: "vertical" | "horizontal";
7
+ label?: string;
8
+ labelledby?: string;
9
+ disabled?: boolean;
10
+ ariaLabel?: string;
11
+ onchange?: (event: Event) => void;
12
+ children?: Snippet;
13
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
14
+ [key: string]: unknown;
15
+ }
16
+
17
+ let {
18
+ orientation = "vertical",
19
+ label,
20
+ labelledby,
21
+ disabled = false,
22
+ ariaLabel,
23
+ onchange,
24
+ children,
25
+ ...rest
26
+ }: Props = $props();
27
+ </script>
28
+
29
+ <xtyle-radio-group
30
+ {...rest}
31
+ {orientation}
32
+ {label}
33
+ labelledby={labelledby || undefined}
34
+ disabled={disabled || undefined}
35
+ aria-label={ariaLabel ?? (rest["aria-label"] as string | undefined)}
36
+ {onchange}
37
+ >
38
+ {@render children?.()}
39
+ </xtyle-radio-group>
@@ -0,0 +1,16 @@
1
+ import "./register.js";
2
+ import type { Snippet } from "svelte";
3
+ interface Props {
4
+ orientation?: "vertical" | "horizontal";
5
+ label?: string;
6
+ labelledby?: string;
7
+ disabled?: boolean;
8
+ ariaLabel?: string;
9
+ onchange?: (event: Event) => void;
10
+ children?: Snippet;
11
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
12
+ [key: string]: unknown;
13
+ }
14
+ declare const RadioGroup: import("svelte").Component<Props, {}, "">;
15
+ type RadioGroup = ReturnType<typeof RadioGroup>;
16
+ export default RadioGroup;
@@ -0,0 +1,37 @@
1
+ <script lang="ts">
2
+ import "./register.js";
3
+ import type { Snippet } from "svelte";
4
+ import type { FullTone } from "@xtyle/core";
5
+
6
+ type SectionTag = "section" | "div" | "header" | "footer";
7
+ type SectionVariant = "band" | "stage";
8
+ type SectionTone = "plain" | "quiet" | FullTone;
9
+ type SectionPadding = "none" | "sm" | "md" | "lg";
10
+
11
+ interface Props {
12
+ as?: SectionTag;
13
+ variant?: SectionVariant;
14
+ tone?: SectionTone;
15
+ bordered?: boolean;
16
+ padding?: SectionPadding;
17
+ label?: string;
18
+ children?: Snippet;
19
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
20
+ [key: string]: unknown;
21
+ }
22
+
23
+ let {
24
+ as = "section",
25
+ variant = "band",
26
+ tone = "plain",
27
+ bordered = false,
28
+ padding = "lg",
29
+ label,
30
+ children,
31
+ ...rest
32
+ }: Props = $props();
33
+ </script>
34
+
35
+ <xtyle-section {...rest} {as} {variant} {tone} {padding} {label} bordered={bordered || undefined}>
36
+ {@render children?.()}
37
+ </xtyle-section>
@@ -0,0 +1,21 @@
1
+ import "./register.js";
2
+ import type { Snippet } from "svelte";
3
+ import type { FullTone } from "@xtyle/core";
4
+ type SectionTag = "section" | "div" | "header" | "footer";
5
+ type SectionVariant = "band" | "stage";
6
+ type SectionTone = "plain" | "quiet" | FullTone;
7
+ type SectionPadding = "none" | "sm" | "md" | "lg";
8
+ interface Props {
9
+ as?: SectionTag;
10
+ variant?: SectionVariant;
11
+ tone?: SectionTone;
12
+ bordered?: boolean;
13
+ padding?: SectionPadding;
14
+ label?: string;
15
+ children?: Snippet;
16
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
17
+ [key: string]: unknown;
18
+ }
19
+ declare const Section: import("svelte").Component<Props, {}, "">;
20
+ type Section = ReturnType<typeof Section>;
21
+ export default Section;
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from "svelte";
3
+
4
+ interface Props {
5
+ /** The value this segment selects; emitted on `change` and submitted with the form. */
6
+ value: string;
7
+ /** Accessible name for the segment, since its content is markup (an icon) rather than text. */
8
+ label?: string;
9
+ disabled?: boolean;
10
+ children?: Snippet;
11
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the segment. */
12
+ [key: string]: unknown;
13
+ }
14
+
15
+ let { value, label, disabled = false, children, ...rest }: Props = $props();
16
+
17
+ // `slot` rides in a spread object, not a literal `slot="segment"` attribute: Svelte statically
18
+ // rejects a literal `slot` on a component root (it can't prove the parent is a custom element),
19
+ // but this span always lands inside `<xtyle-segmented>` at runtime, where the slot is valid.
20
+ const attrs = $derived({ slot: "segment", value, label, disabled: disabled || undefined, ...rest });
21
+ </script>
22
+
23
+ <span {...attrs}>{@render children?.()}</span>
@@ -0,0 +1,14 @@
1
+ import type { Snippet } from "svelte";
2
+ interface Props {
3
+ /** The value this segment selects; emitted on `change` and submitted with the form. */
4
+ value: string;
5
+ /** Accessible name for the segment, since its content is markup (an icon) rather than text. */
6
+ label?: string;
7
+ disabled?: boolean;
8
+ children?: Snippet;
9
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the segment. */
10
+ [key: string]: unknown;
11
+ }
12
+ declare const Segment: import("svelte").Component<Props, {}, "">;
13
+ type Segment = ReturnType<typeof Segment>;
14
+ export default Segment;
@@ -0,0 +1,64 @@
1
+ <script lang="ts">
2
+ import "./register.js";
3
+ import type { Snippet } from "svelte";
4
+ import type { Size, FullTone as Tone } from "@xtyle/core";
5
+
6
+ type SegmentOption = { value: string; label?: string; disabled?: boolean; badge?: string };
7
+
8
+ interface Props {
9
+ value?: string;
10
+ options?: string | ReadonlyArray<string | SegmentOption>;
11
+ disabled?: boolean;
12
+ size?: Size;
13
+ tone?: Tone;
14
+ label?: string;
15
+ labelledby?: string;
16
+ name?: string;
17
+ onchange?: (event: Event) => void;
18
+ /** `<Segment>` children for the rich-content mode (each holds an icon or other markup); they win
19
+ * over `options` when both are given. Omit for the plain-text `options` bar. */
20
+ children?: Snippet;
21
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
22
+ [key: string]: unknown;
23
+ }
24
+
25
+ let {
26
+ value = $bindable(""),
27
+ options,
28
+ disabled = false,
29
+ size = "md",
30
+ tone = "accent",
31
+ label,
32
+ labelledby,
33
+ name,
34
+ onchange,
35
+ children,
36
+ ...rest
37
+ }: Props = $props();
38
+
39
+ let host: (HTMLElement & { options: string | ReadonlyArray<string | SegmentOption> }) | undefined = $state();
40
+
41
+ $effect(() => {
42
+ if (host && options != null) host.options = options;
43
+ });
44
+
45
+ function handleChange(event: Event) {
46
+ const target = event.currentTarget as HTMLElement & { value: string };
47
+ value = target.value;
48
+ onchange?.(event);
49
+ }
50
+ </script>
51
+
52
+ <xtyle-segmented
53
+ bind:this={host}
54
+ {...rest}
55
+ value={value || undefined}
56
+ options={typeof options === "string" ? options : undefined}
57
+ disabled={disabled || undefined}
58
+ {size}
59
+ {tone}
60
+ {label}
61
+ labelledby={labelledby || undefined}
62
+ {name}
63
+ onchange={handleChange}
64
+ >{@render children?.()}</xtyle-segmented>
@@ -0,0 +1,28 @@
1
+ import "./register.js";
2
+ import type { Snippet } from "svelte";
3
+ import type { Size, FullTone as Tone } from "@xtyle/core";
4
+ type SegmentOption = {
5
+ value: string;
6
+ label?: string;
7
+ disabled?: boolean;
8
+ badge?: string;
9
+ };
10
+ interface Props {
11
+ value?: string;
12
+ options?: string | ReadonlyArray<string | SegmentOption>;
13
+ disabled?: boolean;
14
+ size?: Size;
15
+ tone?: Tone;
16
+ label?: string;
17
+ labelledby?: string;
18
+ name?: string;
19
+ onchange?: (event: Event) => void;
20
+ /** `<Segment>` children for the rich-content mode (each holds an icon or other markup); they win
21
+ * over `options` when both are given. Omit for the plain-text `options` bar. */
22
+ children?: Snippet;
23
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
24
+ [key: string]: unknown;
25
+ }
26
+ declare const Segmented: import("svelte").Component<Props, {}, "value">;
27
+ type Segmented = ReturnType<typeof Segmented>;
28
+ export default Segmented;
@@ -0,0 +1,57 @@
1
+ <script lang="ts">
2
+ import "./register.js";
3
+ import type { Snippet } from "svelte";
4
+ import type { Size } from "@xtyle/core";
5
+
6
+ interface Props {
7
+ label?: string;
8
+ value?: string;
9
+ size?: Size;
10
+ name?: string;
11
+ disabled?: boolean;
12
+ invalid?: boolean;
13
+ required?: boolean;
14
+ error?: string;
15
+ ariaLabel?: string;
16
+ onchange?: (event: Event) => void;
17
+ children?: Snippet;
18
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
19
+ [key: string]: unknown;
20
+ }
21
+
22
+ let {
23
+ label = "",
24
+ value = $bindable(""),
25
+ size = "md",
26
+ name,
27
+ disabled = false,
28
+ invalid = false,
29
+ required = false,
30
+ error = "",
31
+ ariaLabel,
32
+ onchange,
33
+ children,
34
+ ...rest
35
+ }: Props = $props();
36
+
37
+ function handleChange(event: Event) {
38
+ value = (event.target as HTMLElement & { value: string }).value;
39
+ onchange?.(event);
40
+ }
41
+ </script>
42
+
43
+ <xtyle-select
44
+ {...rest}
45
+ {label}
46
+ {value}
47
+ {size}
48
+ {name}
49
+ disabled={disabled || undefined}
50
+ invalid={invalid || undefined}
51
+ required={required || undefined}
52
+ {error}
53
+ aria-label={ariaLabel ?? (rest["aria-label"] as string | undefined)}
54
+ onchange={handleChange}
55
+ >
56
+ {@render children?.()}
57
+ </xtyle-select>
@@ -0,0 +1,21 @@
1
+ import "./register.js";
2
+ import type { Snippet } from "svelte";
3
+ import type { Size } from "@xtyle/core";
4
+ interface Props {
5
+ label?: string;
6
+ value?: string;
7
+ size?: Size;
8
+ name?: string;
9
+ disabled?: boolean;
10
+ invalid?: boolean;
11
+ required?: boolean;
12
+ error?: string;
13
+ ariaLabel?: string;
14
+ onchange?: (event: Event) => void;
15
+ children?: Snippet;
16
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
17
+ [key: string]: unknown;
18
+ }
19
+ declare const Select: import("svelte").Component<Props, {}, "value">;
20
+ type Select = ReturnType<typeof Select>;
21
+ export default Select;
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ import "./register.js";
3
+ import type { Snippet } from "svelte";
4
+
5
+ type Orientation = "horizontal" | "vertical";
6
+ type SeparatorVariant = "default" | "with-label";
7
+ type SeparatorSize = "thin" | "normal";
8
+
9
+ interface Props {
10
+ orientation?: Orientation;
11
+ variant?: SeparatorVariant;
12
+ size?: SeparatorSize;
13
+ children?: Snippet;
14
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
15
+ [key: string]: unknown;
16
+ }
17
+
18
+ let { orientation = "horizontal", variant = "default", size = "normal", children, ...rest }: Props = $props();
19
+ </script>
20
+
21
+ <xtyle-separator {...rest} {orientation} {variant} {size}>
22
+ {@render children?.()}
23
+ </xtyle-separator>
@@ -0,0 +1,16 @@
1
+ import "./register.js";
2
+ import type { Snippet } from "svelte";
3
+ type Orientation = "horizontal" | "vertical";
4
+ type SeparatorVariant = "default" | "with-label";
5
+ type SeparatorSize = "thin" | "normal";
6
+ interface Props {
7
+ orientation?: Orientation;
8
+ variant?: SeparatorVariant;
9
+ size?: SeparatorSize;
10
+ children?: Snippet;
11
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
12
+ [key: string]: unknown;
13
+ }
14
+ declare const Separator: import("svelte").Component<Props, {}, "">;
15
+ type Separator = ReturnType<typeof Separator>;
16
+ export default Separator;
@@ -0,0 +1,19 @@
1
+ <script lang="ts">
2
+ import "./register.js";
3
+ import type { Size } from "@xtyle/core";
4
+
5
+ type SkeletonShape = "text" | "line" | "block" | "circle";
6
+
7
+ interface Props {
8
+ shape?: SkeletonShape;
9
+ size?: Size;
10
+ class?: string;
11
+ style?: string;
12
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
13
+ [key: string]: unknown;
14
+ }
15
+
16
+ let { shape = "text", size = "md", class: extra, style, ...rest }: Props = $props();
17
+ </script>
18
+
19
+ <xtyle-skeleton {...rest} {shape} {size} class={extra} {style}></xtyle-skeleton>
@@ -0,0 +1,14 @@
1
+ import "./register.js";
2
+ import type { Size } from "@xtyle/core";
3
+ type SkeletonShape = "text" | "line" | "block" | "circle";
4
+ interface Props {
5
+ shape?: SkeletonShape;
6
+ size?: Size;
7
+ class?: string;
8
+ style?: string;
9
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
10
+ [key: string]: unknown;
11
+ }
12
+ declare const Skeleton: import("svelte").Component<Props, {}, "">;
13
+ type Skeleton = ReturnType<typeof Skeleton>;
14
+ export default Skeleton;
@@ -0,0 +1,82 @@
1
+ <script lang="ts">
2
+ import "./register.js";
3
+ import type { Size, FullTone as Tone } from "@xtyle/core";
4
+
5
+ interface Props {
6
+ value?: number;
7
+ min?: number;
8
+ max?: number;
9
+ step?: number;
10
+ disabled?: boolean;
11
+ size?: Size;
12
+ tone?: Tone;
13
+ label?: string;
14
+ labelledby?: string;
15
+ name?: string;
16
+ showValue?: boolean;
17
+ hideLabel?: boolean;
18
+ format?: ((value: number) => string) | null;
19
+ oninput?: (event: Event) => void;
20
+ onchange?: (event: Event) => void;
21
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
22
+ [key: string]: unknown;
23
+ }
24
+
25
+ let {
26
+ value = $bindable(0),
27
+ min = 0,
28
+ max = 100,
29
+ step = 1,
30
+ disabled = false,
31
+ size = "md",
32
+ tone = "accent",
33
+ label,
34
+ labelledby,
35
+ name,
36
+ showValue = false,
37
+ hideLabel = false,
38
+ format = null,
39
+ oninput,
40
+ onchange,
41
+ ...rest
42
+ }: Props = $props();
43
+
44
+ let host: (HTMLElement & { value: number; format: ((value: number) => string) | null }) | undefined =
45
+ $state();
46
+
47
+ $effect(() => {
48
+ if (host) host.format = format;
49
+ });
50
+
51
+ function sync(event: Event) {
52
+ const target = event.currentTarget as HTMLElement & { value: number };
53
+ value = target.value;
54
+ }
55
+ function handleInput(event: Event) {
56
+ sync(event);
57
+ oninput?.(event);
58
+ }
59
+ function handleChange(event: Event) {
60
+ sync(event);
61
+ onchange?.(event);
62
+ }
63
+ </script>
64
+
65
+ <xtyle-slider
66
+ bind:this={host}
67
+ {...rest}
68
+ {value}
69
+ {min}
70
+ {max}
71
+ {step}
72
+ disabled={disabled || undefined}
73
+ {size}
74
+ {tone}
75
+ {label}
76
+ labelledby={labelledby || undefined}
77
+ {name}
78
+ show-value={showValue || undefined}
79
+ hide-label={hideLabel || undefined}
80
+ oninput={handleInput}
81
+ onchange={handleChange}
82
+ ></xtyle-slider>