@mediaradar/design-components 0.17.0 → 0.18.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/dist/index.d.cts CHANGED
@@ -683,7 +683,8 @@ declare function SelectFilter({ caption, value, options, onChange, align, fullWi
683
683
  * switches the card into a padded content layout, replacing the header/body
684
684
  * shell mr-clientapps-insights-studio's own `CardShell` used to hand-roll.
685
685
  * @tokens rounded-card, border-border-default, bg-surface, shadow-raised,
686
- * hover:shadow-overlay, p-card-padding, text-text-primary, text-text-tertiary
686
+ * hover:shadow-overlay, p-card-padding, text-style-card-title, text-xs,
687
+ * text-text-tertiary
687
688
  * @behavior Without `title`, children render directly as the card's only
688
689
  * content -- no padding is applied, so callers that need a full-bleed image
689
690
  * or gradient flush against the card edge (the common case in
@@ -693,6 +694,10 @@ declare function SelectFilter({ caption, value, options, onChange, align, fullWi
693
694
  * standard padding, matching `CardShell`'s layout so it can be swapped in
694
695
  * directly. `staticCard` drops the hover-shadow transition for non-clickable
695
696
  * content (a KPI tile, a read-only summary) -- there's nothing to respond to.
697
+ * @a11y With `title`, the title renders as a real heading (`titleAs`,
698
+ * default `h3`) so screen-reader users can jump between cards; pick the
699
+ * level that fits the page outline rather than one that looks right --
700
+ * every level is styled the same. The card itself is an `<article>`.
696
701
  * @variant interactive - Default. Clickable/hoverable content -- deeper
697
702
  * shadow on hover signals it responds to the cursor.
698
703
  * @variant static - Set `staticCard`. Non-clickable content -- no hover
@@ -704,7 +709,7 @@ declare function SelectFilter({ caption, value, options, onChange, align, fullWi
704
709
  * <p>Body content</p>
705
710
  * </Card>
706
711
  * <Card staticCard>Non-interactive content</Card>
707
- * <Card title="Spend trend" subtitle="Last 90 days" action={<Link to="/spend">View all</Link>}>
712
+ * <Card title="Spend trend" subtitle="Last 90 days" titleAs="h2" action={<Link to="/spend">View all</Link>}>
708
713
  * <SpendChart />
709
714
  * </Card>
710
715
  * ```
@@ -718,6 +723,13 @@ interface CardProps extends Omit<React.HTMLAttributes<HTMLElement>, "title"> {
718
723
  * plus the card's standard content padding, matching `CardShell`.
719
724
  */
720
725
  title?: string;
726
+ /**
727
+ * Heading level for `title`. Defaults to `h3`; pass `h2` where the card's
728
+ * title is the first heading under the page's `h1`, so the page doesn't skip
729
+ * a level. Only the element changes: every level looks the same
730
+ * (`text-style-card-title`). Ignored without `title`.
731
+ */
732
+ titleAs?: "h2" | "h3" | "h4";
721
733
  /** Shown under `title` in a muted tertiary color. Ignored without `title`. */
722
734
  subtitle?: string;
723
735
  /** Trailing header content, e.g. a "View all" link. Ignored without `title`. */
package/dist/index.d.ts CHANGED
@@ -683,7 +683,8 @@ declare function SelectFilter({ caption, value, options, onChange, align, fullWi
683
683
  * switches the card into a padded content layout, replacing the header/body
684
684
  * shell mr-clientapps-insights-studio's own `CardShell` used to hand-roll.
685
685
  * @tokens rounded-card, border-border-default, bg-surface, shadow-raised,
686
- * hover:shadow-overlay, p-card-padding, text-text-primary, text-text-tertiary
686
+ * hover:shadow-overlay, p-card-padding, text-style-card-title, text-xs,
687
+ * text-text-tertiary
687
688
  * @behavior Without `title`, children render directly as the card's only
688
689
  * content -- no padding is applied, so callers that need a full-bleed image
689
690
  * or gradient flush against the card edge (the common case in
@@ -693,6 +694,10 @@ declare function SelectFilter({ caption, value, options, onChange, align, fullWi
693
694
  * standard padding, matching `CardShell`'s layout so it can be swapped in
694
695
  * directly. `staticCard` drops the hover-shadow transition for non-clickable
695
696
  * content (a KPI tile, a read-only summary) -- there's nothing to respond to.
697
+ * @a11y With `title`, the title renders as a real heading (`titleAs`,
698
+ * default `h3`) so screen-reader users can jump between cards; pick the
699
+ * level that fits the page outline rather than one that looks right --
700
+ * every level is styled the same. The card itself is an `<article>`.
696
701
  * @variant interactive - Default. Clickable/hoverable content -- deeper
697
702
  * shadow on hover signals it responds to the cursor.
698
703
  * @variant static - Set `staticCard`. Non-clickable content -- no hover
@@ -704,7 +709,7 @@ declare function SelectFilter({ caption, value, options, onChange, align, fullWi
704
709
  * <p>Body content</p>
705
710
  * </Card>
706
711
  * <Card staticCard>Non-interactive content</Card>
707
- * <Card title="Spend trend" subtitle="Last 90 days" action={<Link to="/spend">View all</Link>}>
712
+ * <Card title="Spend trend" subtitle="Last 90 days" titleAs="h2" action={<Link to="/spend">View all</Link>}>
708
713
  * <SpendChart />
709
714
  * </Card>
710
715
  * ```
@@ -718,6 +723,13 @@ interface CardProps extends Omit<React.HTMLAttributes<HTMLElement>, "title"> {
718
723
  * plus the card's standard content padding, matching `CardShell`.
719
724
  */
720
725
  title?: string;
726
+ /**
727
+ * Heading level for `title`. Defaults to `h3`; pass `h2` where the card's
728
+ * title is the first heading under the page's `h1`, so the page doesn't skip
729
+ * a level. Only the element changes: every level looks the same
730
+ * (`text-style-card-title`). Ignored without `title`.
731
+ */
732
+ titleAs?: "h2" | "h3" | "h4";
721
733
  /** Shown under `title` in a muted tertiary color. Ignored without `title`. */
722
734
  subtitle?: string;
723
735
  /** Trailing header content, e.g. a "View all" link. Ignored without `title`. */
package/dist/index.js CHANGED
@@ -1485,7 +1485,7 @@ function SelectFilter({
1485
1485
  // src/Card.tsx
1486
1486
  import { forwardRef } from "react";
1487
1487
  import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1488
- var Card = forwardRef(function Card2({ staticCard, title, subtitle, action, className, children, ...rest }, ref) {
1488
+ var Card = forwardRef(function Card2({ staticCard, title, titleAs: TitleTag = "h3", subtitle, action, className, children, ...rest }, ref) {
1489
1489
  return /* @__PURE__ */ jsx12(
1490
1490
  "article",
1491
1491
  {
@@ -1500,8 +1500,8 @@ var Card = forwardRef(function Card2({ staticCard, title, subtitle, action, clas
1500
1500
  children: title ? /* @__PURE__ */ jsxs11("div", { className: "flex flex-1 flex-col p-card-padding", children: [
1501
1501
  /* @__PURE__ */ jsxs11("div", { className: "flex items-start justify-between gap-2", children: [
1502
1502
  /* @__PURE__ */ jsxs11("div", { children: [
1503
- /* @__PURE__ */ jsx12("h3", { className: "text-[15px] font-semibold leading-snug text-text-primary", children: title }),
1504
- subtitle && /* @__PURE__ */ jsx12("p", { className: "mt-0.5 text-[12px] leading-snug text-text-tertiary", children: subtitle })
1503
+ /* @__PURE__ */ jsx12(TitleTag, { className: "text-style-card-title", children: title }),
1504
+ subtitle && /* @__PURE__ */ jsx12("p", { className: "mt-0.5 text-xs leading-snug text-text-tertiary", children: subtitle })
1505
1505
  ] }),
1506
1506
  action && /* @__PURE__ */ jsx12("div", { className: "shrink-0 text-text-tertiary", children: action })
1507
1507
  ] }),