laif-ds 1.0.0 → 1.0.2

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.
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import { cn as i } from "../../lib/utils.js";
4
+ const o = /* @__PURE__ */ new Set(), a = (e) => {
5
+ o.has(e) || (o.add(e), console.warn(e));
6
+ }, s = 99, l = 8, u = (e, n, d) => {
7
+ if (e === void 0) return null;
8
+ if (e === !0) return { kind: "dot" };
9
+ if (typeof e == "number")
10
+ return !Number.isInteger(e) || e < 0 ? (a(
11
+ `NavBadge: \`badge\` on "${d}" must be a non-negative integer — got ${e}, ignored.`
12
+ ), null) : e === 0 ? null : n === "dot" ? { kind: "dot" } : {
13
+ kind: "text",
14
+ text: e > s ? `${s}+` : String(e)
15
+ };
16
+ const r = e.trim();
17
+ return r ? (r.length > l && a(
18
+ `NavBadge: \`badge\` on "${d}" is ${r.length} characters ("${r}") — keep it to ${l} or fewer, it will be clipped.`
19
+ ), n !== "full" ? { kind: "dot" } : { kind: "text", text: r }) : (a(
20
+ `NavBadge: \`badge\` on "${d}" is an empty string — ignored. Pass \`true\` for a dot.`
21
+ ), null);
22
+ }, x = (e) => (e ?? []).some((n) => u(n.badge, "dot", n.title)), g = "bg-d-primary text-d-primary-foreground inline-flex h-5 min-w-5 shrink-0 max-w-16 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums", c = "bg-d-primary border-d-primary-foreground inline-block size-2.5 rounded-full border", m = "bg-d-primary text-d-primary-foreground ring-d-card absolute inline-flex h-3.5 min-w-3.5 items-center justify-center rounded-full text-[10px] leading-none font-semibold tabular-nums ring-2", f = ({
23
+ text: e,
24
+ className: n
25
+ }) => /* @__PURE__ */ t(
26
+ "span",
27
+ {
28
+ "aria-hidden": "true",
29
+ "data-slot": "nav-badge",
30
+ className: i(g, n),
31
+ children: /* @__PURE__ */ t("span", { className: "truncate", children: e })
32
+ }
33
+ ), h = ({
34
+ text: e,
35
+ className: n
36
+ }) => /* @__PURE__ */ t(
37
+ "span",
38
+ {
39
+ "aria-hidden": "true",
40
+ "data-slot": "nav-badge",
41
+ className: i(m, e.length > 1 && "px-1", n),
42
+ children: e
43
+ }
44
+ ), b = ({ className: e }) => /* @__PURE__ */ t(
45
+ "span",
46
+ {
47
+ "aria-hidden": "true",
48
+ "data-slot": "nav-badge",
49
+ className: i(c, e)
50
+ }
51
+ ), y = (e, n) => e ? e.kind === "text" ? /* @__PURE__ */ t(f, { text: e.text, className: n }) : /* @__PURE__ */ t(b, { className: i("shrink-0", n) }) : null, B = ({
52
+ row: e,
53
+ badge: n
54
+ }) => n ? e.badgeLabel ? /* @__PURE__ */ t("span", { className: "sr-only", children: e.badgeLabel }) : (e.badge === !0 && a(
55
+ `NavBadge: \`badge: true\` on "${e.title}" without \`badgeLabel\` — the dot is invisible to screen readers.`
56
+ ), null) : null;
57
+ export {
58
+ b as NavBadgeDot,
59
+ h as NavBadgeOverlay,
60
+ f as NavBadgePill,
61
+ B as NavBadgeSrLabel,
62
+ u as normalizeNavBadge,
63
+ y as renderInlineNavBadge,
64
+ x as someRowBadged,
65
+ a as warnOnce
66
+ };