@primer/react 0.0.0-20260519124320 → 0.0.0-20260519181013

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-20260519124320
3
+ ## 0.0.0-20260519181013
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -24,8 +24,6 @@
24
24
 
25
25
  - [#7776](https://github.com/primer/react/pull/7776) [`d6f61c1`](https://github.com/primer/react/commit/d6f61c1e197b52eb75cff97299bfac4caedcc1ac) Thanks [@llastflowers](https://github.com/llastflowers)! - Add `data-component` attributes for Blankslate, BranchName, Breadcrumbs, ButtonGroup, Checkbox, CheckboxGroup, CircleBadge, ConfirmationDialog, CounterLabel, and Dialog to provide stable selectors.
26
26
 
27
- - [#7852](https://github.com/primer/react/pull/7852) [`8966e0d`](https://github.com/primer/react/commit/8966e0dddd591fa83cc89b962ec1a6d8c0faa875) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Card: Add `data-component` attributes to `Card` and its subcomponents (`Icon`, `Image`, `Heading`, `Description`, `Metadata`, `Menu`). `Card` now requires `children`. Also improves docs and stories.
28
-
29
27
  - [#7816](https://github.com/primer/react/pull/7816) [`aef8548`](https://github.com/primer/react/commit/aef85486a77a544ab36fcc18470dc06bf2502b09) Thanks [@iansan5653](https://github.com/iansan5653)! - Replace `ActionBar` overflow calculations with CSS wrapping approach to improve performance and stability
30
28
 
31
29
  - [#7831](https://github.com/primer/react/pull/7831) [`0de97c2`](https://github.com/primer/react/commit/0de97c25ae2adb026b04f7cac46463779ff023a1) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Dialog: Support custom width values.
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export type CardProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> & {
2
+ export type CardProps = React.ComponentPropsWithoutRef<'div'> & {
3
3
  /**
4
4
  * Provide an optional className to add to the outermost element rendered by
5
5
  * the Card
@@ -15,15 +15,6 @@ export type CardProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'children'>
15
15
  * @default 'large'
16
16
  */
17
17
  borderRadius?: 'medium' | 'large';
18
- /**
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.
25
- */
26
- children: React.ReactNode;
27
18
  };
28
19
  type HeadingLevel = 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
29
20
  type HeadingProps = React.ComponentPropsWithoutRef<'h3'> & {
@@ -34,10 +25,6 @@ type HeadingProps = React.ComponentPropsWithoutRef<'h3'> & {
34
25
  children: React.ReactNode;
35
26
  };
36
27
  type DescriptionProps = React.ComponentPropsWithoutRef<'p'> & {
37
- /**
38
- * The descriptive text for the card. Rendered inside a `<p>` element so
39
- * should be flowing text content.
40
- */
41
28
  children: React.ReactNode;
42
29
  };
43
30
  type IconProps = {
@@ -62,25 +49,12 @@ type ImageProps = React.ComponentPropsWithoutRef<'img'> & {
62
49
  alt?: string;
63
50
  };
64
51
  type MenuProps = {
65
- /**
66
- * The interactive control(s) to render in the top-right corner of the card,
67
- * typically a single `IconButton` or `ActionMenu` trigger. When a card
68
- * contains a menu, make sure the control's accessible name includes enough
69
- * context to distinguish it from other cards (for example,
70
- * `Options for Project Alpha` rather than just `Options`).
71
- */
72
52
  children: React.ReactNode;
73
53
  };
74
54
  type MetadataProps = React.ComponentPropsWithoutRef<'div'> & {
75
- /**
76
- * The metadata content to render at the bottom of the card. Accepts any
77
- * content, including plain text, icons, and other Primer components (for
78
- * example a `Label`, `Octicon`, or any combination). Avoid using
79
- * `RelativeTime` until its outstanding accessibility issues are resolved.
80
- */
81
55
  children: React.ReactNode;
82
56
  };
83
- declare const CardImpl: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children"> & {
57
+ declare const CardImpl: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
84
58
  /**
85
59
  * Provide an optional className to add to the outermost element rendered by
86
60
  * the Card
@@ -96,15 +70,6 @@ declare const CardImpl: React.ForwardRefExoticComponent<Omit<Omit<React.Detailed
96
70
  * @default 'large'
97
71
  */
98
72
  borderRadius?: "medium" | "large";
99
- /**
100
- * The contents of the card. Provide either `Card.*` subcomponents (for
101
- * example `Card.Heading`, `Card.Description`, `Card.Metadata`) or any
102
- * custom content.
103
- *
104
- * A card with no children will not render — at least one meaningful
105
- * child is required.
106
- */
107
- children: React.ReactNode;
108
73
  } & React.RefAttributes<HTMLDivElement>>;
109
74
  declare const CardIcon: {
110
75
  ({ icon: IconComponent, "aria-label": ariaLabel, className }: IconProps): React.JSX.Element;
@@ -122,37 +87,13 @@ declare const CardHeading: React.ForwardRefExoticComponent<Omit<React.DetailedHT
122
87
  children: React.ReactNode;
123
88
  } & React.RefAttributes<HTMLHeadingElement>>;
124
89
  declare const CardDescription: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & {
125
- /**
126
- * The descriptive text for the card. Rendered inside a `<p>` element so
127
- * should be flowing text content.
128
- */
129
90
  children: React.ReactNode;
130
91
  } & React.RefAttributes<HTMLParagraphElement>>;
131
- /**
132
- * Renders an interactive control (or controls) positioned at the top-right
133
- * corner of the card. `Card.Menu` is intended for a single action trigger
134
- * such as an `IconButton` or `ActionMenu` anchor.
135
- *
136
- * Accessibility:
137
- * - The trigger's accessible name should include enough context to
138
- * distinguish it from triggers in other cards (for example,
139
- * `"More options for Project Alpha"` rather than just `"More options"`),
140
- * because lists of cards often share identical control labels.
141
- * - Avoid placing multiple interactive controls inside `Card.Menu`.
142
- * If a card needs multiple actions, expose them inside an `ActionMenu`
143
- * overlay so they remain reachable in a predictable focus order.
144
- */
145
92
  declare const CardMenu: {
146
93
  ({ children }: MenuProps): React.JSX.Element;
147
94
  displayName: string;
148
95
  };
149
96
  declare const CardMetadata: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
150
- /**
151
- * The metadata content to render at the bottom of the card. Accepts any
152
- * content, including plain text, icons, and other Primer components (for
153
- * example a `Label`, `Octicon`, or any combination). Avoid using
154
- * `RelativeTime` until its outstanding accessibility issues are resolved.
155
- */
156
97
  children: React.ReactNode;
157
98
  } & React.RefAttributes<HTMLDivElement>>;
158
99
  export { CardImpl, CardIcon, CardImage, CardHeading, CardDescription, CardMenu, CardMetadata };
@@ -1 +1 @@
1
- {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../src/Card/Card.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAIvC,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IAChF;;;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,GAAG,OAAO,CAAA;IAEjC;;;;;;;OAOG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAA;AAED,KAAK,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAEpD,KAAK,YAAY,GAAG,KAAK,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG;IACzD;;OAEG;IACH,EAAE,CAAC,EAAE,YAAY,CAAA;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAA;AAED,KAAK,gBAAgB,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EAAC,CAAA;AAC5F,YAAY,EAAC,YAAY,IAAI,gBAAgB,EAAC,CAAA;AAC9C,YAAY,EAAC,gBAAgB,IAAI,oBAAoB,EAAC,CAAA;AACtD,YAAY,EAAC,SAAS,IAAI,aAAa,EAAC,CAAA;AACxC,YAAY,EAAC,UAAU,IAAI,cAAc,EAAC,CAAA;AAC1C,YAAY,EAAC,SAAS,IAAI,aAAa,EAAC,CAAA;AACxC,YAAY,EAAC,aAAa,IAAI,iBAAiB,EAAC,CAAA"}
package/dist/Card/Card.js CHANGED
@@ -2,11 +2,10 @@ import { c } from 'react-compiler-runtime';
2
2
  import { clsx } from 'clsx';
3
3
  import React, { forwardRef } from 'react';
4
4
  import classes from './Card.module.css.js';
5
- import { warning } from '../utils/warning.js';
6
- import { jsx, jsxs } from 'react/jsx-runtime';
5
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
6
 
8
7
  const CardImpl = /*#__PURE__*/forwardRef(function Card(t0, ref) {
9
- const $ = c(55);
8
+ const $ = c(53);
10
9
  let children;
11
10
  let className;
12
11
  let rest;
@@ -39,7 +38,6 @@ const CardImpl = /*#__PURE__*/forwardRef(function Card(t0, ref) {
39
38
  let heading;
40
39
  let menu;
41
40
  let metadata;
42
- let t10;
43
41
  let t3;
44
42
  let t4;
45
43
  let t5;
@@ -48,7 +46,7 @@ const CardImpl = /*#__PURE__*/forwardRef(function Card(t0, ref) {
48
46
  let t8;
49
47
  let t9;
50
48
  if ($[6] !== borderRadius || $[7] !== children || $[8] !== className || $[9] !== padding || $[10] !== ref || $[11] !== rest) {
51
- t10 = Symbol.for("react.early_return_sentinel");
49
+ t9 = Symbol.for("react.early_return_sentinel");
52
50
  bb0: {
53
51
  let icon = null;
54
52
  let image = null;
@@ -86,58 +84,50 @@ const CardImpl = /*#__PURE__*/forwardRef(function Card(t0, ref) {
86
84
  }
87
85
  }
88
86
  const hasSlotChildren = icon || image || heading || description || metadata || menu;
89
- const isEmpty = !hasSlotChildren && childArray.length === 0;
90
- process.env.NODE_ENV !== "production" ? warning(isEmpty, "The <Card> component was rendered with no children and will not render. Provide either Card subcomponents (Card.Heading, Card.Description, etc.) or custom content.") : void 0;
91
- if (isEmpty) {
92
- t10 = null;
93
- break bb0;
94
- }
95
87
  if (!hasSlotChildren) {
96
- let t11;
97
- if ($[24] !== className) {
98
- t11 = clsx(classes.Card, className);
99
- $[24] = className;
100
- $[25] = t11;
88
+ let t10;
89
+ if ($[23] !== className) {
90
+ t10 = clsx(classes.Card, className);
91
+ $[23] = className;
92
+ $[24] = t10;
101
93
  } else {
102
- t11 = $[25];
94
+ t10 = $[24];
103
95
  }
104
- let t12;
105
- if ($[26] !== borderRadius || $[27] !== children || $[28] !== padding || $[29] !== ref || $[30] !== rest || $[31] !== t11) {
106
- t12 = /*#__PURE__*/jsx("div", {
96
+ let t11;
97
+ if ($[25] !== borderRadius || $[26] !== children || $[27] !== padding || $[28] !== ref || $[29] !== rest || $[30] !== t10) {
98
+ t11 = /*#__PURE__*/jsx("div", {
107
99
  ref: ref,
108
- className: t11,
109
- "data-component": "Card",
100
+ className: t10,
110
101
  "data-padding": padding,
111
102
  "data-border-radius": borderRadius,
112
103
  ...rest,
113
104
  children: children
114
105
  });
115
- $[26] = borderRadius;
116
- $[27] = children;
117
- $[28] = padding;
118
- $[29] = ref;
119
- $[30] = rest;
106
+ $[25] = borderRadius;
107
+ $[26] = children;
108
+ $[27] = padding;
109
+ $[28] = ref;
110
+ $[29] = rest;
111
+ $[30] = t10;
120
112
  $[31] = t11;
121
- $[32] = t12;
122
113
  } else {
123
- t12 = $[32];
114
+ t11 = $[31];
124
115
  }
125
- t10 = t12;
116
+ t9 = t11;
126
117
  break bb0;
127
118
  }
128
119
  t3 = ref;
129
- if ($[33] !== className) {
120
+ if ($[32] !== className) {
130
121
  t4 = clsx(classes.Card, className);
131
- $[33] = className;
132
- $[34] = t4;
122
+ $[32] = className;
123
+ $[33] = t4;
133
124
  } else {
134
- t4 = $[34];
125
+ t4 = $[33];
135
126
  }
136
- t5 = "Card";
137
- t6 = padding;
138
- t7 = borderRadius;
139
- t8 = rest;
140
- t9 = (image || icon) && /*#__PURE__*/jsx("div", {
127
+ t5 = padding;
128
+ t6 = borderRadius;
129
+ t7 = rest;
130
+ t8 = (image || icon) && /*#__PURE__*/jsx("div", {
141
131
  className: clsx(classes.CardHeader, image && classes.CardHeaderEdgeToEdge),
142
132
  children: image || icon
143
133
  });
@@ -152,102 +142,98 @@ const CardImpl = /*#__PURE__*/forwardRef(function Card(t0, ref) {
152
142
  $[13] = heading;
153
143
  $[14] = menu;
154
144
  $[15] = metadata;
155
- $[16] = t10;
156
- $[17] = t3;
157
- $[18] = t4;
158
- $[19] = t5;
159
- $[20] = t6;
160
- $[21] = t7;
161
- $[22] = t8;
162
- $[23] = t9;
145
+ $[16] = t3;
146
+ $[17] = t4;
147
+ $[18] = t5;
148
+ $[19] = t6;
149
+ $[20] = t7;
150
+ $[21] = t8;
151
+ $[22] = t9;
163
152
  } else {
164
153
  description = $[12];
165
154
  heading = $[13];
166
155
  menu = $[14];
167
156
  metadata = $[15];
168
- t10 = $[16];
169
- t3 = $[17];
170
- t4 = $[18];
171
- t5 = $[19];
172
- t6 = $[20];
173
- t7 = $[21];
174
- t8 = $[22];
175
- t9 = $[23];
157
+ t3 = $[16];
158
+ t4 = $[17];
159
+ t5 = $[18];
160
+ t6 = $[19];
161
+ t7 = $[20];
162
+ t8 = $[21];
163
+ t9 = $[22];
176
164
  }
177
- if (t10 !== Symbol.for("react.early_return_sentinel")) {
178
- return t10;
165
+ if (t9 !== Symbol.for("react.early_return_sentinel")) {
166
+ return t9;
179
167
  }
180
- let t11;
181
- if ($[35] !== description || $[36] !== heading) {
182
- t11 = /*#__PURE__*/jsxs("div", {
168
+ let t10;
169
+ if ($[34] !== description || $[35] !== heading) {
170
+ t10 = /*#__PURE__*/jsxs("div", {
183
171
  className: classes.CardContent,
184
172
  children: [heading, description]
185
173
  });
186
- $[35] = description;
187
- $[36] = heading;
188
- $[37] = t11;
174
+ $[34] = description;
175
+ $[35] = heading;
176
+ $[36] = t10;
189
177
  } else {
190
- t11 = $[37];
178
+ t10 = $[36];
191
179
  }
192
- let t12;
193
- if ($[38] !== metadata) {
194
- t12 = metadata ? /*#__PURE__*/jsx("div", {
180
+ let t11;
181
+ if ($[37] !== metadata) {
182
+ t11 = metadata ? /*#__PURE__*/jsx("div", {
195
183
  className: classes.CardMetadataContainer,
196
184
  children: metadata
197
185
  }) : null;
198
- $[38] = metadata;
199
- $[39] = t12;
186
+ $[37] = metadata;
187
+ $[38] = t11;
200
188
  } else {
201
- t12 = $[39];
189
+ t11 = $[38];
202
190
  }
203
- let t13;
204
- if ($[40] !== t11 || $[41] !== t12) {
205
- t13 = /*#__PURE__*/jsxs("div", {
191
+ let t12;
192
+ if ($[39] !== t10 || $[40] !== t11) {
193
+ t12 = /*#__PURE__*/jsxs("div", {
206
194
  className: classes.CardBody,
207
- children: [t11, t12]
195
+ children: [t10, t11]
208
196
  });
197
+ $[39] = t10;
209
198
  $[40] = t11;
210
199
  $[41] = t12;
211
- $[42] = t13;
212
200
  } else {
213
- t13 = $[42];
201
+ t12 = $[41];
214
202
  }
215
- let t14;
216
- if ($[43] !== menu) {
217
- t14 = menu ? /*#__PURE__*/jsx("div", {
203
+ let t13;
204
+ if ($[42] !== menu) {
205
+ t13 = menu ? /*#__PURE__*/jsx("div", {
218
206
  className: classes.CardMenu,
219
207
  children: menu
220
208
  }) : null;
221
- $[43] = menu;
222
- $[44] = t14;
209
+ $[42] = menu;
210
+ $[43] = t13;
223
211
  } else {
224
- t14 = $[44];
212
+ t13 = $[43];
225
213
  }
226
- let t15;
227
- if ($[45] !== t13 || $[46] !== t14 || $[47] !== t3 || $[48] !== t4 || $[49] !== t5 || $[50] !== t6 || $[51] !== t7 || $[52] !== t8 || $[53] !== t9) {
228
- t15 = /*#__PURE__*/jsxs("div", {
214
+ let t14;
215
+ if ($[44] !== t12 || $[45] !== t13 || $[46] !== t3 || $[47] !== t4 || $[48] !== t5 || $[49] !== t6 || $[50] !== t7 || $[51] !== t8) {
216
+ t14 = /*#__PURE__*/jsxs("div", {
229
217
  ref: t3,
230
218
  className: t4,
231
- "data-component": t5,
232
- "data-padding": t6,
233
- "data-border-radius": t7,
234
- ...t8,
235
- children: [t9, t13, t14]
219
+ "data-padding": t5,
220
+ "data-border-radius": t6,
221
+ ...t7,
222
+ children: [t8, t12, t13]
236
223
  });
224
+ $[44] = t12;
237
225
  $[45] = t13;
238
- $[46] = t14;
239
- $[47] = t3;
240
- $[48] = t4;
241
- $[49] = t5;
242
- $[50] = t6;
243
- $[51] = t7;
244
- $[52] = t8;
245
- $[53] = t9;
246
- $[54] = t15;
226
+ $[46] = t3;
227
+ $[47] = t4;
228
+ $[48] = t5;
229
+ $[49] = t6;
230
+ $[50] = t7;
231
+ $[51] = t8;
232
+ $[52] = t14;
247
233
  } else {
248
- t15 = $[54];
234
+ t14 = $[52];
249
235
  }
250
- return t15;
236
+ return t14;
251
237
  });
252
238
  const CardIcon = t0 => {
253
239
  const $ = c(10);
@@ -278,7 +264,6 @@ const CardIcon = t0 => {
278
264
  if ($[4] !== ariaLabel || $[5] !== t1 || $[6] !== t2 || $[7] !== t3 || $[8] !== t4) {
279
265
  t5 = /*#__PURE__*/jsx("span", {
280
266
  className: t1,
281
- "data-component": "Card.Icon",
282
267
  role: t2,
283
268
  "aria-label": ariaLabel,
284
269
  "aria-hidden": t3,
@@ -335,7 +320,6 @@ const CardImage = t0 => {
335
320
  src: src,
336
321
  alt: alt,
337
322
  className: t2,
338
- "data-component": "Card.Image",
339
323
  ...rest
340
324
  });
341
325
  $[7] = alt;
@@ -387,7 +371,6 @@ const CardHeading = /*#__PURE__*/forwardRef(function CardHeading(t0, ref) {
387
371
  t3 = /*#__PURE__*/jsx(Component, {
388
372
  ref: ref,
389
373
  className: t2,
390
- "data-component": "Card.Heading",
391
374
  ...rest,
392
375
  children: children
393
376
  });
@@ -435,7 +418,6 @@ const CardDescription = /*#__PURE__*/forwardRef(function CardDescription(t0, ref
435
418
  t2 = /*#__PURE__*/jsx("p", {
436
419
  ref: ref,
437
420
  className: t1,
438
- "data-component": "Card.Description",
439
421
  ...rest,
440
422
  children: children
441
423
  });
@@ -449,21 +431,6 @@ const CardDescription = /*#__PURE__*/forwardRef(function CardDescription(t0, ref
449
431
  }
450
432
  return t2;
451
433
  });
452
-
453
- /**
454
- * Renders an interactive control (or controls) positioned at the top-right
455
- * corner of the card. `Card.Menu` is intended for a single action trigger
456
- * such as an `IconButton` or `ActionMenu` anchor.
457
- *
458
- * Accessibility:
459
- * - The trigger's accessible name should include enough context to
460
- * distinguish it from triggers in other cards (for example,
461
- * `"More options for Project Alpha"` rather than just `"More options"`),
462
- * because lists of cards often share identical control labels.
463
- * - Avoid placing multiple interactive controls inside `Card.Menu`.
464
- * If a card needs multiple actions, expose them inside an `ActionMenu`
465
- * overlay so they remain reachable in a predictable focus order.
466
- */
467
434
  const CardMenu = t0 => {
468
435
  const $ = c(2);
469
436
  const {
@@ -471,8 +438,7 @@ const CardMenu = t0 => {
471
438
  } = t0;
472
439
  let t1;
473
440
  if ($[0] !== children) {
474
- t1 = /*#__PURE__*/jsx("div", {
475
- "data-component": "Card.Menu",
441
+ t1 = /*#__PURE__*/jsx(Fragment, {
476
442
  children: children
477
443
  });
478
444
  $[0] = children;
@@ -516,7 +482,6 @@ const CardMetadata = /*#__PURE__*/forwardRef(function CardMetadata(t0, ref) {
516
482
  t2 = /*#__PURE__*/jsx("div", {
517
483
  ref: ref,
518
484
  className: t1,
519
- "data-component": "Card.Metadata",
520
485
  ...rest,
521
486
  children: children
522
487
  });
@@ -1,9 +1,8 @@
1
1
  import type { CardProps, CardIconProps, CardImageProps, CardHeadingProps, CardDescriptionProps, CardMenuProps, CardMetadataProps } from './Card';
2
- declare const Card: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children"> & {
2
+ declare const Card: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
3
3
  className?: string;
4
4
  padding?: "none" | "condensed" | "normal";
5
5
  borderRadius?: "medium" | "large";
6
- children: React.ReactNode;
7
6
  } & import("react").RefAttributes<HTMLDivElement>> & {
8
7
  Icon: {
9
8
  ({ icon: IconComponent, "aria-label": ariaLabel, className }: CardIconProps): import("react").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Card/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EAClB,MAAM,QAAQ,CAAA;AAEf,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOR,CAAA;AAEF,OAAO,EAAC,IAAI,EAAC,CAAA;AACb,YAAY,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,GAClB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Card/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EAClB,MAAM,QAAQ,CAAA;AAEf,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOR,CAAA;AAEF,OAAO,EAAC,IAAI,EAAC,CAAA;AACb,YAAY,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,GAClB,CAAA"}
@@ -2126,28 +2126,18 @@
2126
2126
  "stories": [
2127
2127
  {
2128
2128
  "id": "experimental-components-card--default",
2129
- "code": "() => {\n return (\n <Card>\n <Card.Icon icon={RocketIcon} />\n <Card.Heading>Card Heading</Card.Heading>\n <Card.Description>\n This is a description of the card providing supplemental information.\n </Card.Description>\n <Card.Metadata>\n <PeopleIcon size={16} />3 contributors\n </Card.Metadata>\n </Card>\n )\n}"
2129
+ "code": "() => {\n return (\n <div\n style={{\n maxWidth: '400px',\n }}\n >\n <Card>\n <Card.Icon icon={RocketIcon} />\n <Card.Heading>Card Heading</Card.Heading>\n <Card.Description>\n This is a description of the card providing supplemental information.\n </Card.Description>\n <Card.Metadata>Updated 2 hours ago</Card.Metadata>\n </Card>\n </div>\n )\n}"
2130
2130
  },
2131
2131
  {
2132
2132
  "id": "experimental-components-card-features--with-image",
2133
- "code": "() => {\n return (\n <Card>\n <Card.Image src=\"https://github.com/octocat.png\" alt=\"Octocat\" />\n <Card.Heading>Card with Image</Card.Heading>\n <Card.Description>\n This card uses an edge-to-edge image instead of an icon.\n </Card.Description>\n </Card>\n )\n}"
2133
+ "code": "() => {\n return (\n <div\n style={{\n maxWidth: '400px',\n }}\n >\n <Card>\n <Card.Image src=\"https://github.com/octocat.png\" alt=\"Octocat\" />\n <Card.Heading>Card with Image</Card.Heading>\n <Card.Description>\n This card uses an edge-to-edge image instead of an icon.\n </Card.Description>\n </Card>\n </div>\n )\n}"
2134
2134
  },
2135
2135
  {
2136
2136
  "id": "experimental-components-card-features--with-metadata",
2137
- "code": "() => {\n return (\n <Card>\n <Card.Icon icon={RepoIcon} />\n <Card.Heading>primer/react</Card.Heading>\n <Card.Description>\n {\n \"GitHub's design system implemented as React components for building consistent user interfaces.\"\n }\n </Card.Description>\n <Card.Metadata>\n <StarIcon size={16} />\n 1.2k stars\n </Card.Metadata>\n </Card>\n )\n}"
2138
- },
2139
- {
2140
- "id": "experimental-components-card-features--with-menu",
2141
- "code": "() => {\n return (\n <Card>\n <Card.Icon icon={RepoIcon} />\n <Card.Heading>primer/react</Card.Heading>\n <Card.Description>\n {\n \"GitHub's design system implemented as React components for building consistent user interfaces.\"\n }\n </Card.Description>\n <Card.Menu>\n <ActionMenu>\n <ActionMenu.Anchor>\n <IconButton\n icon={KebabHorizontalIcon}\n aria-label=\"More options for primer/react\"\n variant=\"invisible\"\n />\n </ActionMenu.Anchor>\n <ActionMenu.Overlay>\n <ActionList>\n <ActionList.Item>Star</ActionList.Item>\n <ActionList.Item>Watch</ActionList.Item>\n <ActionList.Item>Fork</ActionList.Item>\n </ActionList>\n </ActionMenu.Overlay>\n </ActionMenu>\n </Card.Menu>\n </Card>\n )\n}"
2137
+ "code": "() => {\n return (\n <div\n style={{\n maxWidth: '400px',\n }}\n >\n <Card>\n <Card.Icon icon={RepoIcon} />\n <Card.Heading>primer/react</Card.Heading>\n <Card.Description>\n {\n \"GitHub's design system implemented as React components for building consistent user interfaces.\"\n }\n </Card.Description>\n <Card.Metadata>\n <StarIcon size={16} />\n 1.2k stars\n </Card.Metadata>\n </Card>\n </div>\n )\n}"
2142
2138
  }
2143
2139
  ],
2144
2140
  "props": [
2145
- {
2146
- "name": "children",
2147
- "type": "React.ReactNode",
2148
- "required": true,
2149
- "description": "The contents of the card. Provide either `Card.*` subcomponents (for example `Card.Heading`, `Card.Description`, `Card.Metadata`) or any custom content. A card with no children will not render."
2150
- },
2151
2141
  {
2152
2142
  "name": "className",
2153
2143
  "type": "string",
@@ -2211,36 +2201,15 @@
2211
2201
  },
2212
2202
  {
2213
2203
  "name": "Card.Description",
2214
- "props": [
2215
- {
2216
- "name": "children",
2217
- "type": "React.ReactNode",
2218
- "required": true,
2219
- "description": "The descriptive text for the card. Rendered inside a `<p>` element so should be flowing text content."
2220
- }
2221
- ]
2204
+ "props": []
2222
2205
  },
2223
2206
  {
2224
2207
  "name": "Card.Menu",
2225
- "props": [
2226
- {
2227
- "name": "children",
2228
- "type": "React.ReactNode",
2229
- "required": true,
2230
- "description": "The interactive control(s) to render in the top-right corner of the card, typically a single `IconButton` or `ActionMenu` trigger. When a card contains a menu, make sure the control's accessible name includes enough context to distinguish it from other cards (for example, 'Options for Project Alpha' rather than just 'Options')."
2231
- }
2232
- ]
2208
+ "props": []
2233
2209
  },
2234
2210
  {
2235
2211
  "name": "Card.Metadata",
2236
- "props": [
2237
- {
2238
- "name": "children",
2239
- "type": "React.ReactNode",
2240
- "required": true,
2241
- "description": "The metadata content to render at the bottom of the card. Accepts any content, including plain text, icons, and other Primer components (for example a `Label`, `Octicon`, or any combination). Avoid using `RelativeTime` until its outstanding accessibility issues are resolved."
2242
- }
2243
- ]
2212
+ "props": []
2244
2213
  }
2245
2214
  ]
2246
2215
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260519124320",
4
+ "version": "0.0.0-20260519181013",
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",
@@ -79,7 +79,7 @@
79
79
  "@github/tab-container-element": "^4.8.2",
80
80
  "@lit-labs/react": "1.2.1",
81
81
  "@oddbird/popover-polyfill": "^0.5.2",
82
- "@primer/behaviors": "^1.10.2",
82
+ "@primer/behaviors": "0.0.0-20260519163107",
83
83
  "@primer/live-region-element": "^0.7.1",
84
84
  "@primer/octicons-react": "^19.24.1",
85
85
  "@primer/primitives": "10.x || 11.x",