@mediaradar/design-components 0.5.0 → 0.6.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/README.md CHANGED
@@ -78,3 +78,35 @@ use Tailwind class names that only resolve correctly once a consuming app
78
78
  already has that package's Tailwind theme wired up. Declaring it as a peer
79
79
  (rather than not declaring it at all) means `npm install` at least warns if
80
80
  it's missing, instead of the component silently rendering unstyled.
81
+
82
+ The minimum version in that range is enforced, not guessed: this package's
83
+ CI (`npm run check:token-compat`) compiles the built bundle with real
84
+ Tailwind against the minimum allowed `@mediaradar/design-tokens` and the
85
+ latest published one, and fails if any class generates no CSS. If a
86
+ component needs a newer token, raise the minimum in the same PR.
87
+
88
+ ## Consuming app setup
89
+
90
+ Tailwind v4 skips `node_modules` when scanning for classes, so a class used
91
+ only inside this package compiles to nothing, with no build error. Point
92
+ Tailwind at the compiled bundle, after the app's last `@import`:
93
+
94
+ ```css
95
+ @source '../node_modules/@mediaradar/design-components/dist/index.js';
96
+ ```
97
+
98
+ (Tailwind v3 / `@config` apps: add
99
+ `./node_modules/@mediaradar/design-components/dist/*.{js,cjs}` to the
100
+ `content` array instead.)
101
+
102
+ Then verify it in CI, after the app's production build:
103
+
104
+ ```bash
105
+ npx design-components-check-coverage --css-dir dist # Vite
106
+ npx design-components-check-coverage --css-dir .next/static # Next.js
107
+ ```
108
+
109
+ It fails if any class the installed version of this package uses is
110
+ missing from the app's compiled CSS — whether because Tailwind isn't
111
+ scanning the package, or because the app's `@mediaradar/design-tokens` is
112
+ older than this package's peer range.
package/dist/index.cjs CHANGED
@@ -115,7 +115,7 @@ function InfoTip({ text, size = 11, label = "More information", trigger = "click
115
115
  {
116
116
  role: "tooltip",
117
117
  style: { position: "fixed", top: pos.top, left: pos.left, width: pos.width },
118
- className: "z-[90] rounded-control border border-border bg-surface px-3 py-2 text-[12px] font-normal not-italic normal-case leading-relaxed tracking-normal text-text-secondary shadow-overlay",
118
+ className: "z-[90] rounded-control border border-border-default bg-surface px-3 py-2 text-[12px] font-normal not-italic normal-case leading-relaxed tracking-normal text-text-secondary shadow-overlay",
119
119
  children: text
120
120
  }
121
121
  ),
@@ -464,7 +464,13 @@ function CheckBox({ checked, indeterminate, onChange, ariaLabel, disabled, testI
464
464
  "flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-[5px] border transition-colors",
465
465
  "focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus",
466
466
  on ? "border-transparent bg-brand-primaryAction text-white" : "border-border-interactive bg-input hover:border-brand-primaryAction",
467
- disabled && "cursor-not-allowed opacity-50"
467
+ // Cancels the unchecked hover-border preview when disabled -- without
468
+ // this, a disabled box still visually previews the "you can click
469
+ // this" affordance on hover even though the click does nothing.
470
+ // Found empirically reconciling this against insights-studio-
471
+ // prototype's own (more complete) local CheckBox during its
472
+ // migration -- that version already had this guard.
473
+ disabled && "cursor-not-allowed opacity-50 hover:border-border-interactive"
468
474
  ].filter(Boolean).join(" "),
469
475
  children: indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react4.Minus, { size: 13, strokeWidth: 3 }) : checked ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react4.Check, { size: 13, strokeWidth: 3 }) : null
470
476
  }
@@ -1131,7 +1137,7 @@ function SectionRail({
1131
1137
  type: "button",
1132
1138
  onClick: () => scroll(-1),
1133
1139
  "aria-label": "Previous",
1134
- className: "hidden h-10 w-10 items-center justify-center rounded-control border border-border text-text-secondary transition-colors hover:bg-subtle hover:text-text-primary sm:flex lg:hidden",
1140
+ className: "hidden h-10 w-10 items-center justify-center rounded-control border border-border-default text-text-secondary transition-colors hover:bg-subtle hover:text-text-primary sm:flex lg:hidden",
1135
1141
  children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react7.ChevronLeft, { size: 16 })
1136
1142
  }
1137
1143
  ),
@@ -1141,7 +1147,7 @@ function SectionRail({
1141
1147
  type: "button",
1142
1148
  onClick: () => scroll(1),
1143
1149
  "aria-label": "Next",
1144
- className: "hidden h-10 w-10 items-center justify-center rounded-control border border-border text-text-secondary transition-colors hover:bg-subtle hover:text-text-primary sm:flex lg:hidden",
1150
+ className: "hidden h-10 w-10 items-center justify-center rounded-control border border-border-default text-text-secondary transition-colors hover:bg-subtle hover:text-text-primary sm:flex lg:hidden",
1145
1151
  children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react7.ChevronRight, { size: 16 })
1146
1152
  }
1147
1153
  )
@@ -1492,7 +1498,7 @@ function cx5(...parts) {
1492
1498
  return parts.filter(Boolean).join(" ");
1493
1499
  }
1494
1500
  function WorkspaceSelectedCard({ groups, testIdPrefix }) {
1495
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("aside", { className: "sticky top-4 flex min-w-0 flex-col gap-4 self-start rounded-card border border-border bg-surface px-5 pb-5 pt-4 shadow-raised sm:px-6 sm:pb-6", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-col divide-y divide-border", children: groups.map((g) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SummaryGroupItem, { group: g, testIdPrefix }, g.id)) }) });
1501
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("aside", { className: "sticky top-4 flex min-w-0 flex-col gap-4 self-start rounded-card border border-border-default bg-surface px-5 pb-5 pt-4 shadow-raised sm:px-6 sm:pb-6", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-col divide-y divide-border-default", children: groups.map((g) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SummaryGroupItem, { group: g, testIdPrefix }, g.id)) }) });
1496
1502
  }
1497
1503
  function SummaryGroupItem({
1498
1504
  group,
@@ -1537,7 +1543,7 @@ function SummaryGroupItem({
1537
1543
  group.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1538
1544
  "div",
1539
1545
  {
1540
- className: "flex items-center justify-between gap-2 rounded-control border border-border bg-canvas px-2 py-1",
1546
+ className: "flex items-center justify-between gap-2 rounded-control border border-border-default bg-canvas px-2 py-1",
1541
1547
  children: [
1542
1548
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "min-w-0 flex-1", children: [
1543
1549
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "block truncate text-[12px] text-text-primary", children: item.name }),