@zeyolabs/shopping 2026.11.39 → 2026.11.41

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.
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import Cluster from '@zeyolabs/ui/layout/Cluster.svelte';
2
3
  import Span from '@zeyolabs/ui/text/Span.svelte';
3
4
  import Text from '@zeyolabs/ui/text/Text.svelte';
4
5
  import Title from '@zeyolabs/ui/text/Title.svelte';
@@ -27,20 +28,20 @@
27
28
  No reviews yet. Bought this? You can review it from your order page.
28
29
  </Text>
29
30
  {:else}
30
- <Text class="mt-2 flex items-center gap-2">
31
+ <Cluster class="mt-2" gap="xs">
31
32
  <Stars rating={reviews.average} />
32
33
  <Span
33
34
  >{reviews.average} out of 5, from {reviews.count}
34
35
  {reviews.count === 1 ? 'review' : 'reviews'}</Span
35
36
  >
36
- </Text>
37
+ </Cluster>
37
38
  <ul class="mt-4 divide-y divide-[var(--bd)] border-y border-[var(--bd)]">
38
39
  {#each reviews.list as review (review.id)}
39
40
  <li class="py-4">
40
- <Text class="flex flex-wrap items-center gap-2">
41
- <Stars rating={review.rating} size="text-sm" />
42
- {#if review.title}<strong>{review.title}</strong>{/if}
43
- </Text>
41
+ <Cluster gap="xs">
42
+ <Stars rating={review.rating} size="sm" />
43
+ {#if review.title}<Span bold>{review.title}</Span>{/if}
44
+ </Cluster>
44
45
  <Text class="mt-2 whitespace-pre-line">{review.body}</Text>
45
46
  <Text class="mt-2" color="secondary">
46
47
  {review.name}, verified buyer, {date.format(review.createdAt)}
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import Badge from '@zeyolabs/ui/badge/Badge.svelte';
3
3
  import Boundary from '@zeyolabs/ui/boundary/Boundary.svelte';
4
+ import Span from '@zeyolabs/ui/text/Span.svelte';
4
5
  import Text from '@zeyolabs/ui/text/Text.svelte';
5
6
  import Title from '@zeyolabs/ui/text/Title.svelte';
6
7
 
@@ -19,24 +20,26 @@
19
20
  <Boundary message="Could not load stock.">
20
21
  {let rows = $derived(await getStock())}
21
22
  <div class="mt-4 overflow-x-auto rounded-xl border border-[var(--bd)] bg-white">
22
- <table class="w-full text-left text-sm">
23
+ <table class="w-full text-left">
23
24
  <thead class="border-b border-[var(--bd)] text-[var(--txs)]">
24
25
  <tr>
25
- <th class="px-4 py-2 font-medium">Product</th>
26
- <th class="px-4 py-2 font-medium">SKU</th>
27
- <th class="px-4 py-2 text-right font-medium">Waiting</th>
28
- <th class="px-4 py-2 text-right font-medium">Stock</th>
26
+ <th class="px-4 py-2"><Span bold size="sm">Product</Span></th>
27
+ <th class="px-4 py-2"><Span bold size="sm">SKU</Span></th>
28
+ <th class="px-4 py-2 text-right"><Span bold size="sm">Waiting</Span></th>
29
+ <th class="px-4 py-2 text-right"><Span bold size="sm">Stock</Span></th>
29
30
  </tr>
30
31
  </thead>
31
32
  <tbody class="divide-y divide-[var(--bd)]">
32
33
  {#each rows as row (row.id)}
33
34
  <tr>
34
- <td class="px-4 py-2 font-medium">
35
- {row.name}{row.variationLabel ? ` · ${row.variationLabel}` : ''}
35
+ <td class="px-4 py-2">
36
+ <Span bold size="sm"
37
+ >{row.name}{row.variationLabel ? ` · ${row.variationLabel}` : ''}</Span
38
+ >
36
39
  {#if !row.active}<Badge color="neutral">inactive</Badge>{/if}
37
40
  </td>
38
- <td class="px-4 py-2 whitespace-nowrap">{row.sku}</td>
39
- <td class="px-4 py-2 text-right">{row.waiting}</td>
41
+ <td class="px-4 py-2 whitespace-nowrap"><Span size="sm">{row.sku}</Span></td>
42
+ <td class="px-4 py-2 text-right"><Span size="sm">{row.waiting}</Span></td>
40
43
  <td class="px-4 py-2"
41
44
  ><StockRow
42
45
  id={row.id}
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { Form, NumberField } from '@zeyolabs/ui/form';
3
3
  import Button from '@zeyolabs/ui/form/Button.svelte';
4
+ import Cluster from '@zeyolabs/ui/layout/Cluster.svelte';
4
5
  import Span from '@zeyolabs/ui/text/Span.svelte';
5
6
 
6
7
  import { setStockForm } from '../admin.remote';
@@ -11,17 +12,12 @@
11
12
  const form = $derived(setStockForm.for(id));
12
13
  </script>
13
14
 
14
- <Form
15
- class="flex items-end justify-end gap-2"
16
- defaults={{ stock }}
17
- {form}
18
- hidden={{ productId: id }}
19
- reset={false}
20
- schema={StockSchema}
21
- >
22
- <!-- The column header says "Stock"; the label names the product for screen readers. -->
23
- <NumberField name="stock" {form} inputmode="numeric">
24
- <Span class="sr-only">Stock for {name}</Span>
25
- </NumberField>
26
- <Button {form}>Save</Button>
15
+ <Form defaults={{ stock }} {form} hidden={{ productId: id }} reset={false} schema={StockSchema}>
16
+ <Cluster gap="xs" justify="end" nowrap>
17
+ <!-- The column header says "Stock"; the label names the product for screen readers. -->
18
+ <NumberField name="stock" {form} inputmode="numeric">
19
+ <Span class="sr-only">Stock for {name}</Span>
20
+ </NumberField>
21
+ <Button {form}>Save</Button>
22
+ </Cluster>
27
23
  </Form>
@@ -2,6 +2,8 @@
2
2
  import { page as current } from '$app/state';
3
3
  import ChevronLeft from '@lucide/svelte/icons/chevron-left';
4
4
  import ChevronRight from '@lucide/svelte/icons/chevron-right';
5
+ import Cluster from '@zeyolabs/ui/layout/Cluster.svelte';
6
+ import Span from '@zeyolabs/ui/text/Span.svelte';
5
7
 
6
8
  import { Paging } from '../catalogue/library';
7
9
 
@@ -12,34 +14,38 @@
12
14
  n === 1 ? current.url.pathname : `${current.url.pathname}?page=${n}`;
13
15
 
14
16
  const box =
15
- 'inline-flex h-10 min-w-10 items-center justify-center gap-1 rounded-full px-3 text-sm no-underline';
17
+ 'inline-flex h-10 min-w-10 items-center justify-center gap-1 rounded-full px-3 no-underline';
16
18
  const link = `${box} border border-[var(--bd)] text-[var(--tx)] hover:border-[var(--primary-strong)] hover:text-[var(--primary-strong)]`;
17
19
  </script>
18
20
 
19
21
  {#if pages > 1}
20
22
  <!-- eslint-disable svelte/no-navigation-without-resolve -- same path as this page, only ?page changes -->
21
- <nav class="mt-10 flex flex-wrap items-center justify-center gap-2" aria-label="Pages">
22
- {#if page > 1}
23
- <a class={link} href={href(page - 1)} rel="prev">
24
- <ChevronLeft class="size-4" aria-hidden="true" /> Previous
25
- </a>
26
- {/if}
27
- {#each Paging.window(page, pages) as n, i (n ?? `gap-${i}`)}
28
- {#if n === null}
29
- <div class="{box} text-[var(--txt)]" aria-hidden="true">…</div>
30
- {:else if n === page}
31
- <div class="{box} bg-[var(--primary-strong)] font-medium text-white" aria-current="page">
32
- {n}
33
- </div>
34
- {:else}
35
- <a class={link} aria-label="Page {n}" href={href(n)}>{n}</a>
23
+ <nav class="mt-10" aria-label="Pages">
24
+ <Cluster gap="xs" justify="center">
25
+ {#if page > 1}
26
+ <a class={link} href={href(page - 1)} rel="prev">
27
+ <ChevronLeft class="size-4" aria-hidden="true" />
28
+ <Span size="sm">Previous</Span>
29
+ </a>
36
30
  {/if}
37
- {/each}
38
- {#if page < pages}
39
- <a class={link} href={href(page + 1)} rel="next">
40
- Next <ChevronRight class="size-4" aria-hidden="true" />
41
- </a>
42
- {/if}
31
+ {#each Paging.window(page, pages) as n, i (n ?? `gap-${i}`)}
32
+ {#if n === null}
33
+ <div class="{box} text-[var(--txt)]" aria-hidden="true"><Span size="sm">…</Span></div>
34
+ {:else if n === page}
35
+ <div class="{box} bg-[var(--primary-strong)] text-white" aria-current="page">
36
+ <Span bold size="sm">{n}</Span>
37
+ </div>
38
+ {:else}
39
+ <a class={link} aria-label="Page {n}" href={href(n)}><Span size="sm">{n}</Span></a>
40
+ {/if}
41
+ {/each}
42
+ {#if page < pages}
43
+ <a class={link} href={href(page + 1)} rel="next">
44
+ <Span size="sm">Next</Span>
45
+ <ChevronRight class="size-4" aria-hidden="true" />
46
+ </a>
47
+ {/if}
48
+ </Cluster>
43
49
  </nav>
44
50
  <!-- eslint-enable svelte/no-navigation-without-resolve -->
45
51
  {/if}
package/ui/Stars.svelte CHANGED
@@ -1,20 +1,22 @@
1
1
  <script lang="ts">
2
2
  /** A read-only star rating, e.g. 4.5 shows as four and a half of five stars. */
3
- let { rating, size = 'text-base' }: { rating: number; size?: string } = $props();
3
+ let { rating, size = 'md' }: { rating: number; size?: 'md' | 'sm' } = $props();
4
4
  const pct = $derived(`${Math.max(0, Math.min(5, rating)) * 20}%`);
5
5
  </script>
6
6
 
7
- <!-- eslint-disable svelte/no-restricted-html-elements -- an inline glyph graphic, not text -->
8
- <span
9
- class="relative inline-block leading-none {size}"
7
+ <div
8
+ style:font-size={size === 'sm' ? '14px' : '16px'}
9
+ style:line-height="1"
10
+ class="relative inline-block whitespace-nowrap"
10
11
  aria-label="{rating} out of 5 stars"
11
12
  role="img"
12
13
  >
13
- <span class="text-[var(--bd)]" aria-hidden="true">★★★★★</span>
14
- <span
14
+ <div class="text-[var(--bd)]" aria-hidden="true">★★★★★</div>
15
+ <div
15
16
  style:width={pct}
16
- class="absolute inset-0 overflow-hidden whitespace-nowrap text-[var(--primary-strong)]"
17
- aria-hidden="true">★★★★★</span
17
+ class="absolute inset-0 overflow-hidden text-[var(--primary-strong)]"
18
+ aria-hidden="true"
18
19
  >
19
- </span>
20
- <!-- eslint-enable svelte/no-restricted-html-elements -->
20
+ ★★★★★
21
+ </div>
22
+ </div>