@primer/react 0.0.0-20260519214009 → 0.0.0-20260519215202

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260519214009
3
+ ## 0.0.0-20260519215202
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
2
  type BaseCardProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> & {
3
3
  /**
4
- * Provide an optional className to add to the outermost element rendered by
5
- * the Card
4
+ * Optional className for the root element.
6
5
  */
7
6
  className?: string;
8
7
  /**
@@ -16,32 +15,25 @@ type BaseCardProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> & {
16
15
  */
17
16
  borderRadius?: 'medium' | 'large';
18
17
  /**
19
- * The contents of the card. Provide either `Card.*` subcomponents (for
20
- * example `Card.Heading`, `Card.Description`, `Card.Metadata`) or any
21
- * custom content.
22
- *
23
- * A card with no children will not render — at least one meaningful
24
- * child is required.
18
+ * The card contents. Provide either `Card.*` subcomponents (e.g.
19
+ * `Card.Heading`, `Card.Description`, `Card.Metadata`) or custom content.
20
+ * Empty cards do not render.
25
21
  */
26
22
  children: React.ReactNode;
27
23
  };
28
24
  /**
29
- * Card rendered as a `<div>` — the default. Use this variant when the Card
30
- * is inside an `<li>` of a list of cards: the surrounding list already
31
- * provides grouping, so no additional landmark is needed. Do **not** use
32
- * `Card.Heading` in this context — screen readers handle list items and
33
- * headings as separate navigation modes, and combining them produces a
34
- * confusing experience.
25
+ * The default Card. Use this inside `<li>` when rendering a list of cards:
26
+ * the list already groups them, so the Card itself doesn't need to be a
27
+ * landmark. Don't use `Card.Heading` here.
35
28
  */
36
29
  type DivCardProps = BaseCardProps & {
37
30
  as?: 'div';
38
31
  };
39
32
  /**
40
- * Card rendered as a `<section>` — use this variant for standalone Cards
41
- * that are **not** part of a list of cards. The `<section>` becomes a
42
- * labelled region landmark for screen-reader users, so an accessible name
43
- * is required via either `aria-label` or `aria-labelledby` (typically
44
- * referencing the id of the `Card.Heading`).
33
+ * Renders the Card as a `<section>`. Use this for a standalone Card that
34
+ * isn't part of a list. The `<section>` is a region landmark, so it needs
35
+ * an accessible name via `aria-label` or `aria-labelledby` (the latter
36
+ * usually points at `Card.Heading`).
45
37
  */
46
38
  type SectionCardProps = BaseCardProps & {
47
39
  as: 'section';
@@ -61,8 +53,7 @@ type HeadingProps = React.ComponentPropsWithoutRef<'h3'> & {
61
53
  };
62
54
  type DescriptionProps = React.ComponentPropsWithoutRef<'p'> & {
63
55
  /**
64
- * The descriptive text for the card. Rendered inside a `<p>` element so
65
- * should be flowing text content.
56
+ * Card description. Rendered as a `<p>`, so keep it to flowing text.
66
57
  */
67
58
  children: React.ReactNode;
68
59
  };
@@ -89,20 +80,18 @@ type ImageProps = React.ComponentPropsWithoutRef<'img'> & {
89
80
  };
90
81
  type MenuProps = {
91
82
  /**
92
- * The interactive control(s) to render in the top-right corner of the card,
93
- * typically a single `IconButton` or `ActionMenu` trigger. When a card
94
- * contains a menu, make sure the control's accessible name includes enough
95
- * context to distinguish it from other cards (for example,
96
- * `Options for Project Alpha` rather than just `Options`).
83
+ * Interactive control in the top-right of the card, usually an `IconButton`
84
+ * or `ActionMenu` trigger. Give the control a label that names the card
85
+ * (e.g. `"Options for Project Alpha"`, not just `"Options"`) so it's
86
+ * distinguishable when several cards are on screen.
97
87
  */
98
88
  children: React.ReactNode;
99
89
  };
100
90
  type MetadataProps = React.ComponentPropsWithoutRef<'div'> & {
101
91
  /**
102
- * The metadata content to render at the bottom of the card. Accepts any
103
- * content, including plain text, icons, and other Primer components (for
104
- * example a `Label`, `Octicon`, or any combination). Avoid using
105
- * `RelativeTime` until its outstanding accessibility issues are resolved.
92
+ * Metadata row at the bottom of the card. Any content works: text, icons,
93
+ * a `Label`, an `Octicon`. Skip `RelativeTime` for now; it has open
94
+ * accessibility issues.
106
95
  */
107
96
  children: React.ReactNode;
108
97
  };
@@ -118,15 +107,12 @@ declare const CardImage: {
118
107
  /**
119
108
  * Heading shown at the top of a Card.
120
109
  *
121
- * Accessibility:
122
- * - Use only on **standalone** Cards (those rendered with `as="section"`).
123
- * When the Card is inside an `<li>` in a list of cards, the surrounding
124
- * list already provides grouping; adding a heading produces a confusing
125
- * experience for screen-reader users, who handle list items and headings
126
- * as separate navigation modes.
127
- * - Pair with `aria-labelledby` on the parent `Card` (referencing the
128
- * heading's `id`) so the section landmark uses the visible heading as
129
- * its accessible name.
110
+ * Only use this on a standalone Card (`as="section"`); don't use it inside
111
+ * an `<li>`, where the surrounding list already provides grouping.
112
+ *
113
+ * Give it an `id` and reference that id from the parent Card's
114
+ * `aria-labelledby` so the section landmark uses the heading as its
115
+ * accessible name.
130
116
  */
131
117
  declare const CardHeading: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & {
132
118
  /**
@@ -137,24 +123,20 @@ declare const CardHeading: React.ForwardRefExoticComponent<Omit<React.DetailedHT
137
123
  } & React.RefAttributes<HTMLHeadingElement>>;
138
124
  declare const CardDescription: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & {
139
125
  /**
140
- * The descriptive text for the card. Rendered inside a `<p>` element so
141
- * should be flowing text content.
126
+ * Card description. Rendered as a `<p>`, so keep it to flowing text.
142
127
  */
143
128
  children: React.ReactNode;
144
129
  } & React.RefAttributes<HTMLParagraphElement>>;
145
130
  /**
146
- * Renders an interactive control (or controls) positioned at the top-right
147
- * corner of the card. `Card.Menu` is intended for a single action trigger
148
- * such as an `IconButton` or `ActionMenu` anchor.
131
+ * Top-right slot for a single interactive control, usually an `IconButton`
132
+ * or `ActionMenu` trigger.
133
+ *
134
+ * Give the control a label that names the card (e.g. `"More options for
135
+ * Project Alpha"`, not just `"More options"`) so users can tell which card
136
+ * the action applies to when several cards are visible.
149
137
  *
150
- * Accessibility:
151
- * - The trigger's accessible name should include enough context to
152
- * distinguish it from triggers in other cards (for example,
153
- * `"More options for Project Alpha"` rather than just `"More options"`),
154
- * because lists of cards often share identical control labels.
155
- * - Avoid placing multiple interactive controls inside `Card.Menu`.
156
- * If a card needs multiple actions, expose them inside an `ActionMenu`
157
- * overlay so they remain reachable in a predictable focus order.
138
+ * For more than one action, put them inside an `ActionMenu` rather than
139
+ * cramming multiple controls into `Card.Menu`.
158
140
  */
159
141
  declare const CardMenu: {
160
142
  ({ children }: MenuProps): React.JSX.Element;
@@ -162,10 +144,9 @@ declare const CardMenu: {
162
144
  };
163
145
  declare const CardMetadata: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
164
146
  /**
165
- * The metadata content to render at the bottom of the card. Accepts any
166
- * content, including plain text, icons, and other Primer components (for
167
- * example a `Label`, `Octicon`, or any combination). Avoid using
168
- * `RelativeTime` until its outstanding accessibility issues are resolved.
147
+ * Metadata row at the bottom of the card. Any content works: text, icons,
148
+ * a `Label`, an `Octicon`. Skip `RelativeTime` for now; it has open
149
+ * accessibility issues.
169
150
  */
170
151
  children: React.ReactNode;
171
152
  } & React.RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../src/Card/Card.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAIvC,KAAK,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IAC7E;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;IAEzC;;;OAGG;IACH,YAAY,CAAC,EAAE,QAAQ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YAAY,EAAC,SAAS,IAAI,aAAa,EAAC,CAAA;AACxC,YAAY,EAAC,aAAa,IAAI,iBAAiB,EAAC,CAAA"}
package/dist/Card/Card.js CHANGED
@@ -369,15 +369,12 @@ CardImage.displayName = 'Card.Image';
369
369
  /**
370
370
  * Heading shown at the top of a Card.
371
371
  *
372
- * Accessibility:
373
- * - Use only on **standalone** Cards (those rendered with `as="section"`).
374
- * When the Card is inside an `<li>` in a list of cards, the surrounding
375
- * list already provides grouping; adding a heading produces a confusing
376
- * experience for screen-reader users, who handle list items and headings
377
- * as separate navigation modes.
378
- * - Pair with `aria-labelledby` on the parent `Card` (referencing the
379
- * heading's `id`) so the section landmark uses the visible heading as
380
- * its accessible name.
372
+ * Only use this on a standalone Card (`as="section"`); don't use it inside
373
+ * an `<li>`, where the surrounding list already provides grouping.
374
+ *
375
+ * Give it an `id` and reference that id from the parent Card's
376
+ * `aria-labelledby` so the section landmark uses the heading as its
377
+ * accessible name.
381
378
  */
382
379
  const CardHeading = /*#__PURE__*/forwardRef(function CardHeading(t0, ref) {
383
380
  const $ = c(13);
@@ -481,18 +478,15 @@ const CardDescription = /*#__PURE__*/forwardRef(function CardDescription(t0, ref
481
478
  });
482
479
 
483
480
  /**
484
- * Renders an interactive control (or controls) positioned at the top-right
485
- * corner of the card. `Card.Menu` is intended for a single action trigger
486
- * such as an `IconButton` or `ActionMenu` anchor.
481
+ * Top-right slot for a single interactive control, usually an `IconButton`
482
+ * or `ActionMenu` trigger.
483
+ *
484
+ * Give the control a label that names the card (e.g. `"More options for
485
+ * Project Alpha"`, not just `"More options"`) so users can tell which card
486
+ * the action applies to when several cards are visible.
487
487
  *
488
- * Accessibility:
489
- * - The trigger's accessible name should include enough context to
490
- * distinguish it from triggers in other cards (for example,
491
- * `"More options for Project Alpha"` rather than just `"More options"`),
492
- * because lists of cards often share identical control labels.
493
- * - Avoid placing multiple interactive controls inside `Card.Menu`.
494
- * If a card needs multiple actions, expose them inside an `ActionMenu`
495
- * overlay so they remain reachable in a predictable focus order.
488
+ * For more than one action, put them inside an `ActionMenu` rather than
489
+ * cramming multiple controls into `Card.Menu`.
496
490
  */
497
491
  const CardMenu = t0 => {
498
492
  const $ = c(2);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260519214009",
4
+ "version": "0.0.0-20260519215202",
5
5
  "description": "An implementation of GitHub's Primer Design System using React",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",