@spaethtech/svelte-ui 0.14.0 → 0.15.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/.claude/skills/svelte-ui/SKILL.md +14 -11
- package/dist/components/Carousel/Carousel.svelte +147 -0
- package/dist/components/Carousel/Carousel.svelte.d.ts +38 -0
- package/dist/components/Carousel/index.d.ts +1 -0
- package/dist/components/Carousel/index.js +1 -0
- package/dist/components/Combobox/Combobox.svelte +62 -31
- package/dist/components/Combobox/Combobox.svelte.d.ts +1 -1
- package/dist/components/CommandPalette/CommandPalette.svelte +203 -0
- package/dist/components/CommandPalette/CommandPalette.svelte.d.ts +23 -0
- package/dist/components/CommandPalette/index.d.ts +2 -0
- package/dist/components/CommandPalette/index.js +1 -0
- package/dist/components/ContextMenu/ContextMenu.svelte +58 -0
- package/dist/components/ContextMenu/ContextMenu.svelte.d.ts +16 -0
- package/dist/components/ContextMenu/index.d.ts +1 -0
- package/dist/components/ContextMenu/index.js +1 -0
- package/dist/components/EmptyState/EmptyState.svelte +68 -0
- package/dist/components/EmptyState/EmptyState.svelte.d.ts +19 -0
- package/dist/components/EmptyState/index.d.ts +1 -0
- package/dist/components/EmptyState/index.js +1 -0
- package/dist/components/Kbd/Kbd.svelte +53 -0
- package/dist/components/Kbd/Kbd.svelte.d.ts +15 -0
- package/dist/components/Kbd/index.d.ts +1 -0
- package/dist/components/Kbd/index.js +1 -0
- package/dist/components/Pagination/Pagination.svelte +58 -43
- package/dist/components/Pagination/Pagination.svelte.d.ts +7 -2
- package/dist/components/Rating.svelte +169 -30
- package/dist/components/Rating.svelte.d.ts +22 -4
- package/dist/components/ScrollArea/ScrollArea.svelte +71 -0
- package/dist/components/ScrollArea/ScrollArea.svelte.d.ts +15 -0
- package/dist/components/ScrollArea/index.d.ts +1 -0
- package/dist/components/ScrollArea/index.js +1 -0
- package/dist/components/Slider/Slider.svelte +5 -3
- package/dist/components/Splitter/Splitter.svelte +127 -0
- package/dist/components/Splitter/Splitter.svelte.d.ts +18 -0
- package/dist/components/Splitter/index.d.ts +1 -0
- package/dist/components/Splitter/index.js +1 -0
- package/dist/components/Stat/Stat.svelte +95 -0
- package/dist/components/Stat/Stat.svelte.d.ts +21 -0
- package/dist/components/Stat/index.d.ts +1 -0
- package/dist/components/Stat/index.js +1 -0
- package/dist/components/Timeline/Timeline.svelte +98 -0
- package/dist/components/Timeline/Timeline.svelte.d.ts +21 -0
- package/dist/components/Timeline/index.d.ts +2 -0
- package/dist/components/Timeline/index.js +1 -0
- package/dist/components/TokenInput/TokenInput.svelte +12 -6
- package/dist/components/Tree/Tree.svelte +178 -0
- package/dist/components/Tree/Tree.svelte.d.ts +26 -0
- package/dist/components/Tree/index.d.ts +2 -0
- package/dist/components/Tree/index.js +1 -0
- package/dist/index.d.ts +13 -2
- package/dist/index.js +10 -1
- package/docs/components.md +125 -22
- package/docs/usage.md +180 -13
- package/package.json +1 -1
package/docs/usage.md
CHANGED
|
@@ -311,21 +311,17 @@ A drag-and-drop + click file field (thumbnails, remove, optional progress).
|
|
|
311
311
|
label="Attachments" onfiles={(f) => console.log(f)} />
|
|
312
312
|
```
|
|
313
313
|
|
|
314
|
-
###
|
|
314
|
+
### Date range
|
|
315
315
|
|
|
316
|
-
|
|
316
|
+
Use `DatePicker` with the `range` prop — its value is a `{ start, end }` object.
|
|
317
317
|
|
|
318
318
|
```svelte
|
|
319
319
|
<script>
|
|
320
|
-
import {
|
|
321
|
-
let
|
|
322
|
-
let end = $state("");
|
|
320
|
+
import { DatePicker } from "@spaethtech/svelte-ui";
|
|
321
|
+
let range = $state({ start: null, end: null });
|
|
323
322
|
</script>
|
|
324
323
|
|
|
325
|
-
<
|
|
326
|
-
|
|
327
|
-
<!-- custom presets, or presets={[]} for calendar-only -->
|
|
328
|
-
<DateRangePicker bind:start bind:end presets={[{ label: "Q1", start: "2026-01-01", end: "2026-03-31" }]} />
|
|
324
|
+
<DatePicker range bind:value={range} label="Reporting period" />
|
|
329
325
|
```
|
|
330
326
|
|
|
331
327
|
### Stepper
|
|
@@ -740,7 +736,9 @@ A thin separating rule — horizontal (optionally labelled) or vertical (toolbar
|
|
|
740
736
|
|
|
741
737
|
### Pagination
|
|
742
738
|
|
|
743
|
-
A standalone page navigator
|
|
739
|
+
A standalone page navigator laid out like `DataTable`'s footer: a tinted band with an optional
|
|
740
|
+
per-page `Select`, a range total, and a `First · Prev · [page]/N · Next · Last` stepper whose page
|
|
741
|
+
indicator is an editable `NumberInput` (type a page + Enter to jump).
|
|
744
742
|
|
|
745
743
|
```svelte
|
|
746
744
|
<script>
|
|
@@ -749,10 +747,13 @@ A standalone page navigator (numbered buttons + ellipsis, prev/next, optional pe
|
|
|
749
747
|
let perPage = $state(10);
|
|
750
748
|
</script>
|
|
751
749
|
|
|
752
|
-
<Pagination bind:page bind:perPage total={247} perPageOptions={[10, 25, 50, 100]}
|
|
750
|
+
<Pagination bind:page bind:perPage total={247} perPageOptions={[10, 25, 50, 100]} />
|
|
751
|
+
|
|
752
|
+
<!-- Compact: just the stepper (no per-page Select) -->
|
|
753
|
+
<Pagination bind:page total={200} showTotal={false} />
|
|
753
754
|
|
|
754
|
-
<!--
|
|
755
|
-
<Pagination bind:page total={200}
|
|
755
|
+
<!-- variant tints the band surface + button hover (not the buttons); ghost = transparent band -->
|
|
756
|
+
<Pagination bind:page total={200} variant="primary" />
|
|
756
757
|
```
|
|
757
758
|
|
|
758
759
|
### Breadcrumbs
|
|
@@ -776,6 +777,172 @@ A navigation trail; the last item is the current page. `maxItems` collapses the
|
|
|
776
777
|
<Breadcrumbs items={trail} maxItems={4} separator="/" />
|
|
777
778
|
```
|
|
778
779
|
|
|
780
|
+
### Tree
|
|
781
|
+
|
|
782
|
+
A hierarchical, expandable tree.
|
|
783
|
+
|
|
784
|
+
```svelte
|
|
785
|
+
<script>
|
|
786
|
+
import { Tree } from "@spaethtech/svelte-ui";
|
|
787
|
+
const items = [
|
|
788
|
+
{ label: "src", children: [{ label: "index.ts" }, { label: "app.css" }] },
|
|
789
|
+
{ label: "package.json" },
|
|
790
|
+
];
|
|
791
|
+
let expanded = $state(["0"]); // key = id or index path
|
|
792
|
+
let selected = $state("");
|
|
793
|
+
</script>
|
|
794
|
+
|
|
795
|
+
<Tree {items} bind:expanded bind:selected onselect={(n) => console.log(n.label)} />
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
### ContextMenu
|
|
799
|
+
|
|
800
|
+
A right-click menu over any content.
|
|
801
|
+
|
|
802
|
+
```svelte
|
|
803
|
+
<script>
|
|
804
|
+
import { ContextMenu } from "@spaethtech/svelte-ui";
|
|
805
|
+
const items = [
|
|
806
|
+
{ label: "Open", onclick: () => {} },
|
|
807
|
+
{ label: "Delete", danger: true, onclick: () => {} },
|
|
808
|
+
];
|
|
809
|
+
</script>
|
|
810
|
+
|
|
811
|
+
<ContextMenu {items}>
|
|
812
|
+
<div>Right-click me</div>
|
|
813
|
+
</ContextMenu>
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
### Timeline
|
|
817
|
+
|
|
818
|
+
A vertical event sequence.
|
|
819
|
+
|
|
820
|
+
```svelte
|
|
821
|
+
<script>
|
|
822
|
+
import { Timeline } from "@spaethtech/svelte-ui";
|
|
823
|
+
const items = [
|
|
824
|
+
{ title: "Order placed", time: "Mon 9:14 AM", variant: "success" },
|
|
825
|
+
{ title: "Shipped", time: "Tue 8:05 AM", variant: "primary" },
|
|
826
|
+
{ title: "Out for delivery", time: "Wed" },
|
|
827
|
+
];
|
|
828
|
+
</script>
|
|
829
|
+
|
|
830
|
+
<Timeline {items} />
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
### Carousel
|
|
834
|
+
|
|
835
|
+
A sliding viewport with controls + dots.
|
|
836
|
+
|
|
837
|
+
```svelte
|
|
838
|
+
<script>
|
|
839
|
+
import { Carousel } from "@spaethtech/svelte-ui";
|
|
840
|
+
const photos = [{ url: "/1.jpg" }, { url: "/2.jpg" }];
|
|
841
|
+
let index = $state(0);
|
|
842
|
+
</script>
|
|
843
|
+
|
|
844
|
+
<Carousel items={photos} bind:index autoplay={4000}>
|
|
845
|
+
{#snippet slide(photo, i)}
|
|
846
|
+
<img src={photo.url} class="w-full h-64 object-cover" />
|
|
847
|
+
{/snippet}
|
|
848
|
+
</Carousel>
|
|
849
|
+
```
|
|
850
|
+
|
|
851
|
+
### CommandPalette
|
|
852
|
+
|
|
853
|
+
A ⌘K/Ctrl+K fuzzy command launcher.
|
|
854
|
+
|
|
855
|
+
```svelte
|
|
856
|
+
<script>
|
|
857
|
+
import { CommandPalette, type Command } from "@spaethtech/svelte-ui";
|
|
858
|
+
let open = $state(false);
|
|
859
|
+
const commands: Command[] = [
|
|
860
|
+
{ label: "New file", group: "Actions", shortcut: ["⌘", "N"], onrun: () => create() },
|
|
861
|
+
{ label: "Open settings", group: "Actions", onrun: () => goto("/settings") },
|
|
862
|
+
{ label: "Toggle theme", keywords: ["dark", "light"], onrun: () => toggleTheme() },
|
|
863
|
+
];
|
|
864
|
+
</script>
|
|
865
|
+
|
|
866
|
+
<!-- ⌘K / Ctrl+K opens it anywhere; or bind:open from your own trigger -->
|
|
867
|
+
<CommandPalette bind:open {commands} />
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
### Splitter
|
|
871
|
+
|
|
872
|
+
Two resizable panes with a draggable divider.
|
|
873
|
+
|
|
874
|
+
```svelte
|
|
875
|
+
<script>
|
|
876
|
+
import { Splitter } from "@spaethtech/svelte-ui";
|
|
877
|
+
let size = $state(35);
|
|
878
|
+
</script>
|
|
879
|
+
|
|
880
|
+
<Splitter bind:size class="h-64">
|
|
881
|
+
{#snippet start()}<aside>Sidebar</aside>{/snippet}
|
|
882
|
+
{#snippet end()}<main>Content</main>{/snippet}
|
|
883
|
+
</Splitter>
|
|
884
|
+
```
|
|
885
|
+
|
|
886
|
+
### ScrollArea
|
|
887
|
+
|
|
888
|
+
A themed scroll container.
|
|
889
|
+
|
|
890
|
+
```svelte
|
|
891
|
+
<script>
|
|
892
|
+
import { ScrollArea } from "@spaethtech/svelte-ui";
|
|
893
|
+
</script>
|
|
894
|
+
|
|
895
|
+
<ScrollArea maxHeight="16rem" variant="primary">
|
|
896
|
+
<!-- long content scrolls with a themed thin scrollbar -->
|
|
897
|
+
</ScrollArea>
|
|
898
|
+
|
|
899
|
+
<ScrollArea orientation="horizontal">…</ScrollArea>
|
|
900
|
+
```
|
|
901
|
+
|
|
902
|
+
### Stat
|
|
903
|
+
|
|
904
|
+
Metric/KPI cards; lay several in a `Grid`.
|
|
905
|
+
|
|
906
|
+
```svelte
|
|
907
|
+
<script>
|
|
908
|
+
import { Stat, Grid } from "@spaethtech/svelte-ui";
|
|
909
|
+
</script>
|
|
910
|
+
|
|
911
|
+
<Grid columns={{ base: 1, sm: 3 }} gap={4}>
|
|
912
|
+
<Stat label="Revenue" value="$48,120" delta="+12.4%" deltaLabel="vs last month" variant="success" />
|
|
913
|
+
<Stat label="Active users" value="8,241" delta={-3.1} deltaLabel="vs last week" />
|
|
914
|
+
<Stat label="Error rate" value="0.8%" delta={-0.2} invertDelta />
|
|
915
|
+
</Grid>
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
### EmptyState
|
|
919
|
+
|
|
920
|
+
A zero-data placeholder with an optional action.
|
|
921
|
+
|
|
922
|
+
```svelte
|
|
923
|
+
<script>
|
|
924
|
+
import { EmptyState, Button } from "@spaethtech/svelte-ui";
|
|
925
|
+
</script>
|
|
926
|
+
|
|
927
|
+
<EmptyState title="No projects yet" description="Create your first project to get started.">
|
|
928
|
+
{#snippet action()}<Button text="New project" variant="primary" />{/snippet}
|
|
929
|
+
</EmptyState>
|
|
930
|
+
```
|
|
931
|
+
|
|
932
|
+
### Kbd
|
|
933
|
+
|
|
934
|
+
Keyboard-key display.
|
|
935
|
+
|
|
936
|
+
```svelte
|
|
937
|
+
<script>
|
|
938
|
+
import { Kbd } from "@spaethtech/svelte-ui";
|
|
939
|
+
</script>
|
|
940
|
+
|
|
941
|
+
<Kbd text="Esc" />
|
|
942
|
+
<Kbd keys={["Ctrl", "K"]} />
|
|
943
|
+
<Kbd keys={["⌘", "⇧", "P"]} size="lg" />
|
|
944
|
+
```
|
|
945
|
+
|
|
779
946
|
### Chip
|
|
780
947
|
|
|
781
948
|
An interactive pill — filter/choice tokens, removable tags, clickable labels.
|