@dogsbay/ui 0.2.0-beta.121 → 0.2.0-beta.123

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dogsbay/ui",
3
- "version": "0.2.0-beta.121",
3
+ "version": "0.2.0-beta.123",
4
4
  "description": "Accessible UI components for Astro, inspired by Base UI and shadcn",
5
5
  "type": "module",
6
6
  "exports": {
@@ -22,9 +22,9 @@
22
22
  "katex": "^0.16.47",
23
23
  "maplibre-gl": "^5.24.0",
24
24
  "shiki": "^4.3.1",
25
- "@dogsbay/elements": "0.2.0-beta.121",
26
- "@dogsbay/icons": "0.2.0-beta.121",
27
- "@dogsbay/primitives": "0.2.0-beta.121"
25
+ "@dogsbay/elements": "0.2.0-beta.123",
26
+ "@dogsbay/icons": "0.2.0-beta.123",
27
+ "@dogsbay/primitives": "0.2.0-beta.123"
28
28
  },
29
29
  "files": [
30
30
  "src",
@@ -81,9 +81,12 @@ interface Props {
81
81
  /** Whether the details starts open */
82
82
  open?: boolean;
83
83
  class?: string;
84
+ /** id, data-*, aria-*: passed to the <details> (an `id` is a link target) */
85
+ [key: string]: unknown;
84
86
  }
85
87
 
86
- const { variant = "note", title, open = false, class: className } = Astro.props;
88
+ // `icon` is accepted (the serializer passes it) but not drawn: the variant sets the icon
89
+ const { variant = "note", title, open = false, class: className, icon: _icon, ...rest } = Astro.props;
87
90
  const v = variant || "note";
88
91
 
89
92
  // `plain` is chrome — a disclosure, nothing more. No role at all:
@@ -104,6 +107,7 @@ const icon = contentVariants.has(v) ? icons[v] : null;
104
107
  class:list={[wrapper({ variant, class: className }), "group/collapsible"]}
105
108
  data-variant={variant}
106
109
  open={open}
110
+ {...rest}
107
111
  >
108
112
  <summary class:list={[
109
113
  "flex cursor-pointer items-center gap-2 px-4 py-3 text-sm font-semibold select-none",
@@ -32,6 +32,8 @@ export type BadgeVariant = keyof typeof BADGE_VARIANTS;
32
32
 
33
33
  /** The class list for a variant; an unknown variant gets the base classes only. */
34
34
  export function badgeClass(variant: string | undefined): string {
35
- const v = BADGE_VARIANTS[(variant ?? "default") as BadgeVariant];
35
+ // Own keys only: `toString` or `__proto__` must not read Object.prototype
36
+ const key = variant ?? "default";
37
+ const v = Object.prototype.hasOwnProperty.call(BADGE_VARIANTS, key) ? BADGE_VARIANTS[key as BadgeVariant] : undefined;
36
38
  return v ? `${BADGE_BASE} ${v}` : BADGE_BASE;
37
39
  }
@@ -0,0 +1,28 @@
1
+ ---
2
+ /**
3
+ * DetailsSheet — wraps a CollapsibleAlert (a <details>) so it opens as a
4
+ * side sheet. The markup stays a working <details>: with no script the
5
+ * content is a normal collapsible block. `<db-details-sheet>` (from
6
+ * @dogsbay/elements) moves the body into a native modal <dialog> on the right
7
+ * while it is open.
8
+ *
9
+ * Usage:
10
+ * <DetailsSheet>
11
+ * <CollapsibleAlert title="Advanced options">…</CollapsibleAlert>
12
+ * </DetailsSheet>
13
+ */
14
+ interface Props {
15
+ /** The close button's accessible name */
16
+ closeLabel?: string;
17
+ }
18
+
19
+ const { closeLabel = "Close" } = Astro.props;
20
+ ---
21
+
22
+ <db-details-sheet close-label={closeLabel}>
23
+ <slot />
24
+ </db-details-sheet>
25
+
26
+ <script>
27
+ import "@dogsbay/elements/db-details-sheet";
28
+ </script>
@@ -0,0 +1 @@
1
+ export { default as DetailsSheet } from "./DetailsSheet.astro";
@@ -3,7 +3,8 @@ import { tv } from "tailwind-variants";
3
3
  import Icon from "../icon/Icon.astro";
4
4
 
5
5
  const linkCard = tv({
6
- base: "group flex flex-col gap-1 rounded-lg border bg-card p-4 text-card-foreground shadow-sm transition-colors hover:bg-accent/50",
6
+ // not-prose: the page's link underline would otherwise run under every line of the card
7
+ base: "not-prose group flex flex-col gap-1 rounded-lg border bg-card p-4 text-card-foreground no-underline shadow-sm transition-colors hover:bg-accent/50",
7
8
  });
8
9
 
9
10
  const linkCardTitle = tv({
@@ -55,10 +55,10 @@ const embedUrl = `https://${domain}/embed/${id}?autoplay=1${params ? "&" + param
55
55
  tabindex="0"
56
56
  aria-label={`Play: ${title}`}
57
57
  >
58
- {/* Thumbnail */}
58
+ {/* Thumbnail: decorative, the button's label already says "Play: <title>" (axe image-redundant-alt) */}
59
59
  <img
60
60
  src={posterUrl}
61
- alt={title}
61
+ alt=""
62
62
  loading="lazy"
63
63
  class="absolute inset-0 h-full w-full object-cover transition-opacity duration-300 group-hover/yt:opacity-80"
64
64
  />