@runwisp/ui 1.0.0 → 1.1.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 (31) hide show
  1. package/package.json +4 -4
  2. package/src/astro/SiteFooter.astro +149 -31
  3. package/src/lib/components/AlertDialog.svelte +63 -25
  4. package/src/lib/components/Badge.svelte +51 -33
  5. package/src/lib/components/Button.svelte +1 -1
  6. package/src/lib/components/DataGrid.svelte +151 -90
  7. package/src/lib/components/FilterBar.svelte +156 -0
  8. package/src/lib/components/FilterPill.svelte +180 -0
  9. package/src/lib/components/NotificationBell.svelte +70 -0
  10. package/src/lib/components/SearchInput.svelte +91 -0
  11. package/src/lib/components/StatusDot.svelte +38 -0
  12. package/src/lib/components/ThemeToggle.svelte +28 -33
  13. package/src/lib/components/Tooltip.svelte +5 -2
  14. package/src/lib/components/dashboard/run-filters.test.ts +2 -2
  15. package/src/lib/components/dashboard/run-filters.ts +5 -5
  16. package/src/lib/components/dashboard/run-helpers.test.ts +1 -1
  17. package/src/lib/components/dashboard/run-helpers.ts +1 -1
  18. package/src/lib/components/filter-spec.ts +94 -0
  19. package/src/lib/index.ts +26 -1
  20. package/src/lib/utils/debounce.test.ts +31 -0
  21. package/src/lib/utils/debounce.ts +22 -0
  22. package/src/lib/utils/filter.test.ts +172 -0
  23. package/src/lib/utils/filter.ts +79 -0
  24. package/src/lib/utils/theme.svelte.test.ts +142 -0
  25. package/src/lib/utils/theme.svelte.ts +71 -0
  26. package/src/stories/DataGrid.stories.svelte +64 -1
  27. package/src/stories/FilterBar.stories.svelte +61 -0
  28. package/src/stories/Welcome.mdx +1 -1
  29. package/src/astro/CTABand.astro +0 -39
  30. package/src/astro/Hero.astro +0 -58
  31. package/src/astro/SiteHeader.astro +0 -46
@@ -0,0 +1,61 @@
1
+ <!-- SPDX-FileCopyrightText: PoppyCake, s.r.o. -->
2
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
3
+
4
+ <script module>
5
+ import { defineMeta } from "@storybook/addon-svelte-csf";
6
+ import FilterBar from "$lib/components/FilterBar.svelte";
7
+ import { seedValues } from "$lib/components/filter-spec.js";
8
+
9
+ const { Story } = defineMeta({
10
+ title: "Data/FilterBar",
11
+ component: FilterBar,
12
+ tags: ["autodocs"],
13
+ });
14
+
15
+ /** @type {import("$lib/components/filter-spec.js").FilterField} */
16
+ const searchField = {
17
+ type: "search",
18
+ key: "q",
19
+ fields: ["name"],
20
+ placeholder: "Search tasks...",
21
+ };
22
+
23
+ /** @type {import("$lib/components/filter-spec.js").FilterField[]} */
24
+ const fields = [
25
+ searchField,
26
+ {
27
+ type: "select",
28
+ key: "status",
29
+ label: "Status",
30
+ primary: true,
31
+ options: [
32
+ { value: "all", label: "All" },
33
+ { value: "success", label: "Success" },
34
+ { value: "failed", label: "Failed" },
35
+ { value: "running", label: "Running" },
36
+ ],
37
+ },
38
+ { type: "number", key: "exitCode", label: "Exit code" },
39
+ { type: "daterange", key: "lastRun", label: "Last run" },
40
+ ];
41
+ </script>
42
+
43
+ <script>
44
+ let values = $state(seedValues(fields));
45
+ let preset = $state(seedValues(fields, { status: "failed", exitCode: "1" }));
46
+ </script>
47
+
48
+ <Story name="Default" asChild>
49
+ <div class="flex flex-col gap-4">
50
+ <FilterBar {fields} bind:values />
51
+ <pre class="font-mono text-xs text-on-surface-muted">{JSON.stringify(values, null, 2)}</pre>
52
+ </div>
53
+ </Story>
54
+
55
+ <Story name="Pre-filled (URL restore)" asChild>
56
+ <FilterBar {fields} bind:values={preset} />
57
+ </Story>
58
+
59
+ <Story name="Search Only" asChild>
60
+ <FilterBar fields={[searchField]} values={seedValues([searchField])} />
61
+ </Story>
@@ -185,7 +185,7 @@ import Logo from "../../static/runwisp_c.svg";
185
185
  </div>
186
186
  <div className="rw-card">
187
187
  <h3>Data</h3>
188
- <p>DataGrid, Avatar, StatusIndicator, StatCard, EmptyState</p>
188
+ <p>DataGrid, FilterBar, Avatar, StatusIndicator, StatCard, EmptyState</p>
189
189
  </div>
190
190
  <div className="rw-card">
191
191
  <h3>Navigation</h3>
@@ -1,39 +0,0 @@
1
- ---
2
- // SPDX-FileCopyrightText: PoppyCake, s.r.o.
3
- // SPDX-License-Identifier: Apache-2.0
4
-
5
- interface Props {
6
- heading: string;
7
- sub?: string;
8
- tone?: "default" | "primary";
9
- class?: string;
10
- }
11
-
12
- const { heading, sub, tone = "default", class: className = "" } = Astro.props;
13
-
14
- const surface =
15
- tone === "primary" ? "bg-primary text-on-primary" : "bg-surface-raised text-on-surface";
16
- const subTone = tone === "primary" ? "text-on-primary/80" : "text-on-surface-muted";
17
- const hasCtas = Astro.slots.has("ctas");
18
- ---
19
-
20
- <section class:list={[className]}>
21
- <div class="mx-auto max-w-5xl px-6 py-16 sm:py-20">
22
- <div
23
- class:list={[
24
- surface,
25
- "rounded-[4px] border border-outline px-6 py-12 text-center shadow-sm sm:px-10",
26
- ]}
27
- >
28
- <h2 class="font-mono text-3xl font-extrabold sm:text-4xl">{heading}</h2>
29
- {sub && <p class:list={[subTone, "mt-4 font-sans text-lg"]}>{sub}</p>}
30
- {
31
- hasCtas && (
32
- <div class="mt-8 flex flex-wrap items-center justify-center gap-3">
33
- <slot name="ctas" />
34
- </div>
35
- )
36
- }
37
- </div>
38
- </div>
39
- </section>
@@ -1,58 +0,0 @@
1
- ---
2
- // SPDX-FileCopyrightText: PoppyCake, s.r.o.
3
- // SPDX-License-Identifier: Apache-2.0
4
-
5
- interface Props {
6
- headline: string;
7
- sub?: string;
8
- eyebrow?: string;
9
- align?: "left" | "center";
10
- size?: "md" | "lg";
11
- class?: string;
12
- }
13
-
14
- const { headline, sub, eyebrow, align = "left", size = "lg", class: className = "" } = Astro.props;
15
-
16
- const padding = size === "lg" ? "py-20 sm:py-24 lg:py-32" : "py-14 sm:py-16 lg:py-20";
17
- const headlineSize =
18
- size === "lg" ? "text-4xl sm:text-5xl lg:text-6xl" : "text-3xl sm:text-4xl lg:text-5xl";
19
- const hasMedia = Astro.slots.has("media");
20
- const hasCtas = Astro.slots.has("ctas");
21
- const layout = hasMedia ? "grid items-center gap-12 lg:grid-cols-2 lg:gap-16" : "mx-auto max-w-3xl";
22
- const textAlign = align === "center" && !hasMedia ? "text-center" : "";
23
- const ctaAlign = align === "center" && !hasMedia ? "justify-center" : "";
24
- ---
25
-
26
- <section class:list={["relative isolate overflow-hidden", className]}>
27
- <div class:list={["mx-auto max-w-6xl px-6", padding]}>
28
- <div class={layout}>
29
- <div class={textAlign}>
30
- {
31
- eyebrow && (
32
- <p class="text-info mb-4 font-mono text-[11.5px] font-medium tracking-[0.16em] uppercase">
33
- {eyebrow}
34
- </p>
35
- )
36
- }
37
- <h1 class:list={["text-on-surface font-mono font-extrabold", headlineSize]}>
38
- {headline}
39
- </h1>
40
- {sub && <p class="text-on-surface-muted mt-6 font-sans text-lg sm:text-xl">{sub}</p>}
41
- {
42
- hasCtas && (
43
- <div class:list={["mt-8 flex flex-wrap items-center gap-3", ctaAlign]}>
44
- <slot name="ctas" />
45
- </div>
46
- )
47
- }
48
- </div>
49
- {
50
- hasMedia && (
51
- <div class="lg:justify-self-end">
52
- <slot name="media" />
53
- </div>
54
- )
55
- }
56
- </div>
57
- </div>
58
- </section>
@@ -1,46 +0,0 @@
1
- ---
2
- // SPDX-FileCopyrightText: PoppyCake, s.r.o.
3
- // SPDX-License-Identifier: Apache-2.0
4
- import { Logo } from "@runwisp/ui";
5
-
6
- interface Props {
7
- homeHref?: string;
8
- wordmark?: string;
9
- class?: string;
10
- }
11
-
12
- const { homeHref = "/", wordmark = "RunWisp", class: className = "" } = Astro.props;
13
-
14
- const hasNav = Astro.slots.has("nav");
15
- const hasActions = Astro.slots.has("actions");
16
- ---
17
-
18
- <header class:list={["rw-bg-glass sticky top-0 z-40 border-b border-outline", className]}>
19
- <div class="mx-auto flex h-[52px] max-w-6xl items-center justify-between gap-6 px-6">
20
- <a
21
- href={homeHref}
22
- class="text-on-surface flex items-center gap-2"
23
- aria-label={`${wordmark} home`}
24
- >
25
- <Logo size="md" />
26
- <span class="font-mono font-bold tracking-tight">{wordmark}</span>
27
- </a>
28
- {
29
- hasNav && (
30
- <nav
31
- class="text-on-surface-muted hidden gap-6 font-mono text-sm sm:flex [&_a]:[&_a:hover]:text-primary"
32
- aria-label="Primary"
33
- >
34
- <slot name="nav" />
35
- </nav>
36
- )
37
- }
38
- {
39
- hasActions && (
40
- <div class="flex items-center gap-2">
41
- <slot name="actions" />
42
- </div>
43
- )
44
- }
45
- </div>
46
- </header>