@mediaradar/design-components 0.34.0 → 0.37.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
@@ -119,3 +119,30 @@ It fails if any class the installed version of this package uses is
119
119
  missing from the app's compiled CSS — whether because Tailwind isn't
120
120
  scanning the package, or because the app's `@mediaradar/design-tokens` is
121
121
  older than this package's peer range.
122
+
123
+ ## Approved components (COMP-11)
124
+
125
+ `@mediaradar/design-components/approved-components.json` lists every
126
+ component tagged `@status stable`, for the installed version:
127
+
128
+ ```json
129
+ { "version": "0.37.0", "components": ["BarChartPlaceholder", "Card", "..."] }
130
+ ```
131
+
132
+ COMP-11 (`docs/ux-frontend-standards.md`) says an app never defines its own
133
+ component with one of these names. Build the lint rule from this file rather
134
+ than a hand-typed list, so a new sign-off reaches the app with its normal
135
+ package bump. ESLint flat config (ESM):
136
+
137
+ ```js
138
+ import approved from '@mediaradar/design-components/approved-components.json' with { type: 'json' }
139
+
140
+ const NO_LOCAL_COPY = {
141
+ selector: `:matches(FunctionDeclaration, ClassDeclaration, VariableDeclarator)[id.name=/^(${approved.components.join('|')})$/]`,
142
+ message: 'COMP-11: this is an approved component; import it from @mediaradar/design-components instead of defining one with the same name.',
143
+ }
144
+ ```
145
+
146
+ In an `.eslintrc.cjs`, `require('@mediaradar/design-components/approved-components.json')`.
147
+ The file is written by the build from the `@pattern` blocks, so it always
148
+ matches the catalog (`search_components({ status: "stable" })`).
@@ -0,0 +1,14 @@
1
+ {
2
+ "version": "0.37.0",
3
+ "components": [
4
+ "BarChartPlaceholder",
5
+ "Card",
6
+ "DateRangeFilter",
7
+ "LineChartPlaceholder",
8
+ "PieChartPlaceholder",
9
+ "SelectAllVisible",
10
+ "SelectedSection",
11
+ "SelectionPicker",
12
+ "WorkspaceSelectedCard"
13
+ ]
14
+ }
package/dist/index.cjs CHANGED
@@ -645,7 +645,7 @@ var import_lucide_react5 = require("lucide-react");
645
645
  var import_jsx_runtime7 = require("react/jsx-runtime");
646
646
  function boxClass(on, disabled) {
647
647
  return cn(
648
- "flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-[5px] border transition-colors",
648
+ "flex size-4.5 shrink-0 items-center justify-center rounded-small border transition-colors",
649
649
  on ? "border-transparent bg-brand-primaryAction text-brand-onprimary" : "border-border-interactive bg-input",
650
650
  disabled && "cursor-not-allowed opacity-50"
651
651
  );
@@ -1453,7 +1453,7 @@ function SectionRail({
1453
1453
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1454
1454
  "h2",
1455
1455
  {
1456
- className: titleSerif ? "font-serif text-2xl font-normal tracking-tight text-text-primary sm:text-[28px]" : "text-xl font-medium tracking-tight text-text-primary sm:text-2xl",
1456
+ className: titleSerif ? "font-serif text-xl font-normal tracking-tight text-text-primary" : "text-xl font-medium tracking-tight text-text-primary",
1457
1457
  children: title
1458
1458
  }
1459
1459
  ),
@@ -1497,7 +1497,7 @@ function SectionRail({
1497
1497
  "div",
1498
1498
  {
1499
1499
  ref: scrollRef,
1500
- className: "flex gap-4 overflow-x-auto scroll-smooth pb-2 snap-x snap-mandatory scrollbar-none [&::-webkit-scrollbar]:hidden -mx-4 px-4 sm:mx-0 sm:px-0 *:w-[268px] *:shrink-0 *:snap-start lg:grid lg:grid-cols-[repeat(4,minmax(0,320px))] lg:gap-5 lg:overflow-visible lg:justify-start lg:*:w-auto lg:*:shrink lg:*:snap-none",
1500
+ className: "flex gap-4 overflow-x-auto scroll-smooth pb-2 snap-x snap-mandatory scrollbar-none [&::-webkit-scrollbar]:hidden -mx-4 px-4 sm:mx-0 sm:px-0 *:w-67 *:shrink-0 *:snap-start lg:grid lg:grid-cols-[repeat(4,minmax(0,320px))] lg:gap-5 lg:overflow-visible lg:justify-start lg:*:w-auto lg:*:shrink lg:*:snap-none",
1501
1501
  children
1502
1502
  }
1503
1503
  )
@@ -1915,12 +1915,12 @@ function SummaryGroupItem({
1915
1915
  className: cx5("shrink-0 text-text-secondary transition-transform", !open && "-rotate-90")
1916
1916
  }
1917
1917
  ),
1918
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: cx5("truncate font-semibold text-text-primary", nested ? "text-[12px]" : "text-[13px]"), children: group.label }),
1919
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shrink-0 rounded-full bg-subtle px-1.5 py-0.5 text-[11px] font-semibold text-text-secondary", children: ownCount })
1918
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: cx5("truncate font-semibold text-text-primary", nested ? "text-xs" : "text-dense"), children: group.label }),
1919
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shrink-0 rounded-full bg-subtle px-1.5 py-0.5 text-micro font-semibold text-text-secondary", children: ownCount })
1920
1920
  ]
1921
1921
  }
1922
1922
  ),
1923
- open && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "pt-2.5", children: ownCount === 0 && subCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[12px] text-text-secondary", children: "Nothing selected." }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-2.5", children: [
1923
+ open && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "pt-2.5", children: ownCount === 0 && subCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-xs text-text-secondary", children: "Nothing selected." }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-2.5", children: [
1924
1924
  ownCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
1925
1925
  group.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1926
1926
  "div",
@@ -1928,8 +1928,8 @@ function SummaryGroupItem({
1928
1928
  className: "flex items-center justify-between gap-2 rounded-control border border-border-default bg-canvas px-2 py-1",
1929
1929
  children: [
1930
1930
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "min-w-0 flex-1", children: [
1931
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "block truncate text-[12px] text-text-primary", children: item.name }),
1932
- item.meta && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "block truncate text-[11px] text-text-secondary", children: item.meta })
1931
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "block truncate text-xs text-text-primary", children: item.name }),
1932
+ item.meta && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "block truncate text-micro text-text-secondary", children: item.meta })
1933
1933
  ] }),
1934
1934
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1935
1935
  "button",
@@ -1951,7 +1951,7 @@ function SummaryGroupItem({
1951
1951
  type: "button",
1952
1952
  onClick: group.onRemoveAll,
1953
1953
  "data-testid": testIdPrefix && `${testIdPrefix}-remove-all-${group.id}`,
1954
- className: "mt-0.5 self-start text-[11px] font-medium text-text-link hover:underline",
1954
+ className: "mt-0.5 self-start text-micro font-medium text-text-link hover:underline",
1955
1955
  children: "Remove all"
1956
1956
  }
1957
1957
  )
@@ -2032,7 +2032,7 @@ function BlankLegend({ rows, reverse = false }) {
2032
2032
  var import_jsx_runtime18 = require("react/jsx-runtime");
2033
2033
  var BAR_PROFILE = [92, 86, 76, 65, 57, 40, 30, 24, 18, 13];
2034
2034
  function BarChartPlaceholder({ height = 220 }) {
2035
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AxisFrame, { height, xTicks: BAR_PROFILE.length, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex h-full w-full items-end gap-2", children: BAR_PROFILE.map((pct, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-1 rounded-t-[3px] bg-subtle", style: { height: `${pct}%` } }, i)) }) });
2035
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AxisFrame, { height, xTicks: BAR_PROFILE.length, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex h-full w-full items-end gap-2", children: BAR_PROFILE.map((pct, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-1 rounded-t-small bg-subtle", style: { height: `${pct}%` } }, i)) }) });
2036
2036
  }
2037
2037
 
2038
2038
  // src/LineChartPlaceholder.tsx
@@ -3494,11 +3494,12 @@ function workspaceInitials(name) {
3494
3494
  }
3495
3495
  var SIZES = {
3496
3496
  /** Matches a 15px lucide icon exactly, so a workspace name in a menu row
3497
- * left-aligns with labels in icon-led rows above and below it. */
3498
- xs: "h-[15px] w-[15px] rounded-[4px] text-[8px] tracking-tight",
3499
- /** 10px, not text-control-caption: that step is for dropdown captions.
3500
- * Two initials need to sit inside the 24px circle, a step below md. */
3501
- sm: "h-6 w-6 text-[10px]",
3497
+ * left-aligns with labels in icon-led rows above and below it. Shows one
3498
+ * initial: two at the smallest type step (10px) don't fit in 15px. */
3499
+ xs: "size-3.75 rounded-small text-badge",
3500
+ /** text-badge (10px), not text-control-caption: that step is for dropdown
3501
+ * captions. Two initials need to sit inside the 24px tile, a step below md. */
3502
+ sm: "h-6 w-6 text-badge",
3502
3503
  md: "h-7 w-7 text-micro",
3503
3504
  lg: "h-11 w-11 text-panel-title"
3504
3505
  };
@@ -3511,7 +3512,7 @@ function WorkspaceAvatar({ name, size = "md" }) {
3511
3512
  "flex shrink-0 items-center justify-center rounded-control bg-subtle font-semibold leading-none text-text-secondary",
3512
3513
  SIZES[size]
3513
3514
  ),
3514
- children: workspaceInitials(name ?? "All data")
3515
+ children: size === "xs" ? workspaceInitials(name ?? "All data").slice(0, 1) : workspaceInitials(name ?? "All data")
3515
3516
  }
3516
3517
  );
3517
3518
  }
@@ -3614,10 +3615,10 @@ function TablePagination({
3614
3615
  const current = Math.min(page, totalPages);
3615
3616
  const rangeStart = totalItems === 0 ? 0 : (current - 1) * perPage + 1;
3616
3617
  const rangeEnd = Math.min(current * perPage, totalItems);
3617
- const btn = "flex h-8 min-w-8 items-center justify-center rounded-control px-2 text-[13px] transition-colors";
3618
+ const btn = "flex h-8 min-w-8 items-center justify-center rounded-control px-2 text-dense transition-colors";
3618
3619
  const off = "disabled:pointer-events-none disabled:opacity-30";
3619
3620
  const stepBtn = cn(btn, "text-text-secondary hover:bg-subtle hover:text-text-primary", off);
3620
- const range = /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "text-[13px] text-text-tertiary tabular-nums", children: [
3621
+ const range = /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "text-dense text-text-tertiary tabular-nums", children: [
3621
3622
  rangeStart.toLocaleString(),
3622
3623
  " \u2013 ",
3623
3624
  rangeEnd.toLocaleString(),
@@ -3630,7 +3631,7 @@ function TablePagination({
3630
3631
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
3631
3632
  "div",
3632
3633
  {
3633
- className: cn("flex items-center gap-2 text-[13px] text-text-secondary", !onPerPageChange && "invisible"),
3634
+ className: cn("flex items-center gap-2 text-dense text-text-secondary", !onPerPageChange && "invisible"),
3634
3635
  children: [
3635
3636
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3636
3637
  SelectFilter,
@@ -3674,7 +3675,7 @@ function TablePagination({
3674
3675
  }
3675
3676
  ),
3676
3677
  pageWindow(current, totalPages).map(
3677
- (p) => typeof p === "string" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "px-1 text-[13px] text-text-tertiary", children: "\u2026" }, p) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3678
+ (p) => typeof p === "string" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "px-1 text-dense text-text-tertiary", children: "\u2026" }, p) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3678
3679
  "button",
3679
3680
  {
3680
3681
  type: "button",
@@ -4049,7 +4050,7 @@ function MultiSelectFilter({
4049
4050
  onClick: () => toggleGroup(g),
4050
4051
  className: "flex w-full items-center gap-2.5 rounded-control px-2 py-2 text-left transition-colors hover:bg-subtle",
4051
4052
  children: [
4052
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TriCheck, { state }),
4053
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CheckBoxBox, { checked: state === "all", indeterminate: state === "some" }),
4053
4054
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: cn("flex-1 text-[14px] text-text-primary", !plainParent && "font-semibold"), children: g.label }),
4054
4055
  counts && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(OptionCount, { n: countFor(g.id) })
4055
4056
  ]
@@ -4064,7 +4065,7 @@ function MultiSelectFilter({
4064
4065
  onClick: () => toggle(c.id),
4065
4066
  className: "flex w-full items-center gap-2.5 rounded-control py-2 pl-9 pr-2 text-left transition-colors hover:bg-subtle",
4066
4067
  children: [
4067
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TriCheck, { state: checked ? "all" : "none" }),
4068
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CheckBoxBox, { checked }),
4068
4069
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "flex-1 text-[14px] text-text-primary", children: c.label }),
4069
4070
  counts && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(OptionCount, { n: countFor(c.id) })
4070
4071
  ]
@@ -4082,16 +4083,7 @@ function MultiSelectFilter({
4082
4083
  onClick: () => toggle(o.id),
4083
4084
  className: "flex w-full items-center gap-2.5 rounded-control px-2 py-2 text-left transition-colors hover:bg-subtle",
4084
4085
  children: [
4085
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4086
- "span",
4087
- {
4088
- className: cn(
4089
- "flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-[5px] border transition-colors",
4090
- checked ? "border-transparent bg-brand-primaryAction text-brand-onprimary" : "border-border-interactive bg-input"
4091
- ),
4092
- children: checked && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react23.Check, { size: 13, strokeWidth: 3 })
4093
- }
4094
- ),
4086
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CheckBoxBox, { checked }),
4095
4087
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "flex-1 text-[14px] text-text-primary", children: o.label }),
4096
4088
  counts && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(OptionCount, { n: countFor(o.id) })
4097
4089
  ]
@@ -4118,22 +4110,6 @@ function MultiSelectFilter({
4118
4110
  )
4119
4111
  ] });
4120
4112
  }
4121
- function TriCheck({ state }) {
4122
- const filled = state !== "none";
4123
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
4124
- "span",
4125
- {
4126
- className: cn(
4127
- "flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-[5px] border transition-colors",
4128
- filled ? "border-transparent bg-brand-primaryAction text-brand-onprimary" : "border-border-interactive bg-input"
4129
- ),
4130
- children: [
4131
- state === "all" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react23.Check, { size: 13, strokeWidth: 3 }),
4132
- state === "some" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react23.Minus, { size: 13, strokeWidth: 3 })
4133
- ]
4134
- }
4135
- );
4136
- }
4137
4113
  function OptionCount({ n }) {
4138
4114
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "shrink-0 text-[12px] tabular-nums text-text-tertiary", children: [
4139
4115
  "(",