@primer/react 0.0.0-20260519181013 → 0.0.0-20260519202353
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 +3 -1
- package/dist/Card/Card.d.ts +91 -18
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/Card.js +181 -113
- package/dist/Card/index.d.ts +1 -5
- package/dist/Card/index.d.ts.map +1 -1
- package/generated/components.json +56 -7
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260519202353
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -24,6 +24,8 @@
|
|
|
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`). Add an `as` prop (`'div' | 'section'`) so standalone Cards can render as a labelled region landmark; `as="section"` requires `aria-label` or `aria-labelledby`. `Card` now requires `children`. Also improves docs and stories.
|
|
28
|
+
|
|
27
29
|
- [#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
|
|
28
30
|
|
|
29
31
|
- [#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.
|
package/dist/Card/Card.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
type BaseCardProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> & {
|
|
3
3
|
/**
|
|
4
4
|
* Provide an optional className to add to the outermost element rendered by
|
|
5
5
|
* the Card
|
|
@@ -15,7 +15,42 @@ export type CardProps = React.ComponentPropsWithoutRef<'div'> & {
|
|
|
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
|
+
};
|
|
28
|
+
/**
|
|
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.
|
|
35
|
+
*/
|
|
36
|
+
type DivCardProps = BaseCardProps & {
|
|
37
|
+
as?: 'div';
|
|
18
38
|
};
|
|
39
|
+
/**
|
|
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`).
|
|
45
|
+
*/
|
|
46
|
+
type SectionCardProps = BaseCardProps & {
|
|
47
|
+
as: 'section';
|
|
48
|
+
} & ({
|
|
49
|
+
'aria-label': string;
|
|
50
|
+
} | {
|
|
51
|
+
'aria-labelledby': string;
|
|
52
|
+
});
|
|
53
|
+
export type CardProps = DivCardProps | SectionCardProps;
|
|
19
54
|
type HeadingLevel = 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
20
55
|
type HeadingProps = React.ComponentPropsWithoutRef<'h3'> & {
|
|
21
56
|
/**
|
|
@@ -25,6 +60,10 @@ type HeadingProps = React.ComponentPropsWithoutRef<'h3'> & {
|
|
|
25
60
|
children: React.ReactNode;
|
|
26
61
|
};
|
|
27
62
|
type DescriptionProps = React.ComponentPropsWithoutRef<'p'> & {
|
|
63
|
+
/**
|
|
64
|
+
* The descriptive text for the card. Rendered inside a `<p>` element so
|
|
65
|
+
* should be flowing text content.
|
|
66
|
+
*/
|
|
28
67
|
children: React.ReactNode;
|
|
29
68
|
};
|
|
30
69
|
type IconProps = {
|
|
@@ -49,28 +88,25 @@ type ImageProps = React.ComponentPropsWithoutRef<'img'> & {
|
|
|
49
88
|
alt?: string;
|
|
50
89
|
};
|
|
51
90
|
type MenuProps = {
|
|
91
|
+
/**
|
|
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`).
|
|
97
|
+
*/
|
|
52
98
|
children: React.ReactNode;
|
|
53
99
|
};
|
|
54
100
|
type MetadataProps = React.ComponentPropsWithoutRef<'div'> & {
|
|
55
|
-
children: React.ReactNode;
|
|
56
|
-
};
|
|
57
|
-
declare const CardImpl: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
58
|
-
/**
|
|
59
|
-
* Provide an optional className to add to the outermost element rendered by
|
|
60
|
-
* the Card
|
|
61
|
-
*/
|
|
62
|
-
className?: string;
|
|
63
101
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Controls the border radius of the Card.
|
|
70
|
-
* @default 'large'
|
|
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.
|
|
71
106
|
*/
|
|
72
|
-
|
|
73
|
-
}
|
|
107
|
+
children: React.ReactNode;
|
|
108
|
+
};
|
|
109
|
+
declare const CardImpl: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
74
110
|
declare const CardIcon: {
|
|
75
111
|
({ icon: IconComponent, "aria-label": ariaLabel, className }: IconProps): React.JSX.Element;
|
|
76
112
|
displayName: string;
|
|
@@ -79,6 +115,19 @@ declare const CardImage: {
|
|
|
79
115
|
({ src, alt, className, ...rest }: ImageProps): React.JSX.Element;
|
|
80
116
|
displayName: string;
|
|
81
117
|
};
|
|
118
|
+
/**
|
|
119
|
+
* Heading shown at the top of a Card.
|
|
120
|
+
*
|
|
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.
|
|
130
|
+
*/
|
|
82
131
|
declare const CardHeading: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & {
|
|
83
132
|
/**
|
|
84
133
|
* The heading level to render. Defaults to 'h3'.
|
|
@@ -87,13 +136,37 @@ declare const CardHeading: React.ForwardRefExoticComponent<Omit<React.DetailedHT
|
|
|
87
136
|
children: React.ReactNode;
|
|
88
137
|
} & React.RefAttributes<HTMLHeadingElement>>;
|
|
89
138
|
declare const CardDescription: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & {
|
|
139
|
+
/**
|
|
140
|
+
* The descriptive text for the card. Rendered inside a `<p>` element so
|
|
141
|
+
* should be flowing text content.
|
|
142
|
+
*/
|
|
90
143
|
children: React.ReactNode;
|
|
91
144
|
} & React.RefAttributes<HTMLParagraphElement>>;
|
|
145
|
+
/**
|
|
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.
|
|
149
|
+
*
|
|
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.
|
|
158
|
+
*/
|
|
92
159
|
declare const CardMenu: {
|
|
93
160
|
({ children }: MenuProps): React.JSX.Element;
|
|
94
161
|
displayName: string;
|
|
95
162
|
};
|
|
96
163
|
declare const CardMetadata: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
164
|
+
/**
|
|
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.
|
|
169
|
+
*/
|
|
97
170
|
children: React.ReactNode;
|
|
98
171
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
99
172
|
export { CardImpl, CardIcon, CardImage, CardHeading, CardDescription, CardMenu, CardMetadata };
|
package/dist/Card/Card.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../src/Card/Card.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../src/Card/Card.tsx"],"names":[],"mappings":"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"}
|
package/dist/Card/Card.js
CHANGED
|
@@ -2,21 +2,25 @@ 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 {
|
|
5
|
+
import { warning } from '../utils/warning.js';
|
|
6
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
7
|
|
|
7
|
-
const CardImpl = /*#__PURE__*/forwardRef(function Card(
|
|
8
|
-
const $ = c(
|
|
8
|
+
const CardImpl = /*#__PURE__*/forwardRef(function Card(props, ref) {
|
|
9
|
+
const $ = c(61);
|
|
10
|
+
const t0 = props;
|
|
9
11
|
let children;
|
|
10
12
|
let className;
|
|
11
13
|
let rest;
|
|
12
14
|
let t1;
|
|
13
15
|
let t2;
|
|
16
|
+
let t3;
|
|
14
17
|
if ($[0] !== t0) {
|
|
15
18
|
({
|
|
16
19
|
children,
|
|
17
20
|
className,
|
|
18
21
|
padding: t1,
|
|
19
22
|
borderRadius: t2,
|
|
23
|
+
as: t3,
|
|
20
24
|
...rest
|
|
21
25
|
} = t0);
|
|
22
26
|
$[0] = t0;
|
|
@@ -25,28 +29,34 @@ const CardImpl = /*#__PURE__*/forwardRef(function Card(t0, ref) {
|
|
|
25
29
|
$[3] = rest;
|
|
26
30
|
$[4] = t1;
|
|
27
31
|
$[5] = t2;
|
|
32
|
+
$[6] = t3;
|
|
28
33
|
} else {
|
|
29
34
|
children = $[1];
|
|
30
35
|
className = $[2];
|
|
31
36
|
rest = $[3];
|
|
32
37
|
t1 = $[4];
|
|
33
38
|
t2 = $[5];
|
|
39
|
+
t3 = $[6];
|
|
34
40
|
}
|
|
35
41
|
const padding = t1 === undefined ? "normal" : t1;
|
|
36
42
|
const borderRadius = t2 === undefined ? "large" : t2;
|
|
43
|
+
const as = t3 === undefined ? "div" : t3;
|
|
44
|
+
const Component = as;
|
|
45
|
+
let T0;
|
|
37
46
|
let description;
|
|
38
47
|
let heading;
|
|
39
48
|
let menu;
|
|
40
49
|
let metadata;
|
|
41
|
-
let
|
|
50
|
+
let t10;
|
|
51
|
+
let t11;
|
|
42
52
|
let t4;
|
|
43
53
|
let t5;
|
|
44
54
|
let t6;
|
|
45
55
|
let t7;
|
|
46
56
|
let t8;
|
|
47
57
|
let t9;
|
|
48
|
-
if ($[
|
|
49
|
-
|
|
58
|
+
if ($[7] !== Component || $[8] !== as || $[9] !== borderRadius || $[10] !== children || $[11] !== className || $[12] !== padding || $[13] !== ref || $[14] !== rest) {
|
|
59
|
+
t11 = Symbol.for("react.early_return_sentinel");
|
|
50
60
|
bb0: {
|
|
51
61
|
let icon = null;
|
|
52
62
|
let image = null;
|
|
@@ -84,156 +94,179 @@ const CardImpl = /*#__PURE__*/forwardRef(function Card(t0, ref) {
|
|
|
84
94
|
}
|
|
85
95
|
}
|
|
86
96
|
const hasSlotChildren = icon || image || heading || description || metadata || menu;
|
|
97
|
+
const isEmpty = !hasSlotChildren && childArray.length === 0;
|
|
98
|
+
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;
|
|
99
|
+
const ariaLabel = rest["aria-label"];
|
|
100
|
+
const ariaLabelledby = rest["aria-labelledby"];
|
|
101
|
+
process.env.NODE_ENV !== "production" ? warning(as === "section" && !ariaLabel && !ariaLabelledby, "The <Card> component used with `as=\"section\"` requires either `aria-label` or `aria-labelledby` so screen-reader users can identify the labelled region. Typically `aria-labelledby` should reference the id of the `Card.Heading`.") : void 0;
|
|
102
|
+
if (isEmpty) {
|
|
103
|
+
t11 = null;
|
|
104
|
+
break bb0;
|
|
105
|
+
}
|
|
87
106
|
if (!hasSlotChildren) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
$[
|
|
107
|
+
const t12 = ref;
|
|
108
|
+
let t13;
|
|
109
|
+
if ($[28] !== className) {
|
|
110
|
+
t13 = clsx(classes.Card, className);
|
|
111
|
+
$[28] = className;
|
|
112
|
+
$[29] = t13;
|
|
93
113
|
} else {
|
|
94
|
-
|
|
114
|
+
t13 = $[29];
|
|
95
115
|
}
|
|
96
|
-
let
|
|
97
|
-
if ($[
|
|
98
|
-
|
|
99
|
-
ref:
|
|
100
|
-
className:
|
|
116
|
+
let t14;
|
|
117
|
+
if ($[30] !== Component || $[31] !== borderRadius || $[32] !== children || $[33] !== padding || $[34] !== rest || $[35] !== t12 || $[36] !== t13) {
|
|
118
|
+
t14 = /*#__PURE__*/jsx(Component, {
|
|
119
|
+
ref: t12,
|
|
120
|
+
className: t13,
|
|
121
|
+
"data-component": "Card",
|
|
101
122
|
"data-padding": padding,
|
|
102
123
|
"data-border-radius": borderRadius,
|
|
103
124
|
...rest,
|
|
104
125
|
children: children
|
|
105
126
|
});
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
127
|
+
$[30] = Component;
|
|
128
|
+
$[31] = borderRadius;
|
|
129
|
+
$[32] = children;
|
|
130
|
+
$[33] = padding;
|
|
131
|
+
$[34] = rest;
|
|
132
|
+
$[35] = t12;
|
|
133
|
+
$[36] = t13;
|
|
134
|
+
$[37] = t14;
|
|
113
135
|
} else {
|
|
114
|
-
|
|
136
|
+
t14 = $[37];
|
|
115
137
|
}
|
|
116
|
-
|
|
138
|
+
t11 = t14;
|
|
117
139
|
break bb0;
|
|
118
140
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
$[
|
|
141
|
+
T0 = Component;
|
|
142
|
+
t4 = ref;
|
|
143
|
+
if ($[38] !== className) {
|
|
144
|
+
t5 = clsx(classes.Card, className);
|
|
145
|
+
$[38] = className;
|
|
146
|
+
$[39] = t5;
|
|
124
147
|
} else {
|
|
125
|
-
|
|
148
|
+
t5 = $[39];
|
|
126
149
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
150
|
+
t6 = "Card";
|
|
151
|
+
t7 = padding;
|
|
152
|
+
t8 = borderRadius;
|
|
153
|
+
t9 = rest;
|
|
154
|
+
t10 = (image || icon) && /*#__PURE__*/jsx("div", {
|
|
131
155
|
className: clsx(classes.CardHeader, image && classes.CardHeaderEdgeToEdge),
|
|
132
156
|
children: image || icon
|
|
133
157
|
});
|
|
134
158
|
}
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
159
|
+
$[7] = Component;
|
|
160
|
+
$[8] = as;
|
|
161
|
+
$[9] = borderRadius;
|
|
162
|
+
$[10] = children;
|
|
163
|
+
$[11] = className;
|
|
164
|
+
$[12] = padding;
|
|
165
|
+
$[13] = ref;
|
|
166
|
+
$[14] = rest;
|
|
167
|
+
$[15] = T0;
|
|
168
|
+
$[16] = description;
|
|
169
|
+
$[17] = heading;
|
|
170
|
+
$[18] = menu;
|
|
171
|
+
$[19] = metadata;
|
|
172
|
+
$[20] = t10;
|
|
173
|
+
$[21] = t11;
|
|
174
|
+
$[22] = t4;
|
|
175
|
+
$[23] = t5;
|
|
176
|
+
$[24] = t6;
|
|
177
|
+
$[25] = t7;
|
|
178
|
+
$[26] = t8;
|
|
179
|
+
$[27] = t9;
|
|
152
180
|
} else {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
181
|
+
T0 = $[15];
|
|
182
|
+
description = $[16];
|
|
183
|
+
heading = $[17];
|
|
184
|
+
menu = $[18];
|
|
185
|
+
metadata = $[19];
|
|
186
|
+
t10 = $[20];
|
|
187
|
+
t11 = $[21];
|
|
188
|
+
t4 = $[22];
|
|
189
|
+
t5 = $[23];
|
|
190
|
+
t6 = $[24];
|
|
191
|
+
t7 = $[25];
|
|
192
|
+
t8 = $[26];
|
|
193
|
+
t9 = $[27];
|
|
164
194
|
}
|
|
165
|
-
if (
|
|
166
|
-
return
|
|
195
|
+
if (t11 !== Symbol.for("react.early_return_sentinel")) {
|
|
196
|
+
return t11;
|
|
167
197
|
}
|
|
168
|
-
let
|
|
169
|
-
if ($[
|
|
170
|
-
|
|
198
|
+
let t12;
|
|
199
|
+
if ($[40] !== description || $[41] !== heading) {
|
|
200
|
+
t12 = /*#__PURE__*/jsxs("div", {
|
|
171
201
|
className: classes.CardContent,
|
|
172
202
|
children: [heading, description]
|
|
173
203
|
});
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
204
|
+
$[40] = description;
|
|
205
|
+
$[41] = heading;
|
|
206
|
+
$[42] = t12;
|
|
177
207
|
} else {
|
|
178
|
-
|
|
208
|
+
t12 = $[42];
|
|
179
209
|
}
|
|
180
|
-
let
|
|
181
|
-
if ($[
|
|
182
|
-
|
|
210
|
+
let t13;
|
|
211
|
+
if ($[43] !== metadata) {
|
|
212
|
+
t13 = metadata ? /*#__PURE__*/jsx("div", {
|
|
183
213
|
className: classes.CardMetadataContainer,
|
|
184
214
|
children: metadata
|
|
185
215
|
}) : null;
|
|
186
|
-
$[
|
|
187
|
-
$[
|
|
216
|
+
$[43] = metadata;
|
|
217
|
+
$[44] = t13;
|
|
188
218
|
} else {
|
|
189
|
-
|
|
219
|
+
t13 = $[44];
|
|
190
220
|
}
|
|
191
|
-
let
|
|
192
|
-
if ($[
|
|
193
|
-
|
|
221
|
+
let t14;
|
|
222
|
+
if ($[45] !== t12 || $[46] !== t13) {
|
|
223
|
+
t14 = /*#__PURE__*/jsxs("div", {
|
|
194
224
|
className: classes.CardBody,
|
|
195
|
-
children: [
|
|
225
|
+
children: [t12, t13]
|
|
196
226
|
});
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
227
|
+
$[45] = t12;
|
|
228
|
+
$[46] = t13;
|
|
229
|
+
$[47] = t14;
|
|
200
230
|
} else {
|
|
201
|
-
|
|
231
|
+
t14 = $[47];
|
|
202
232
|
}
|
|
203
|
-
let
|
|
204
|
-
if ($[
|
|
205
|
-
|
|
233
|
+
let t15;
|
|
234
|
+
if ($[48] !== menu) {
|
|
235
|
+
t15 = menu ? /*#__PURE__*/jsx("div", {
|
|
206
236
|
className: classes.CardMenu,
|
|
207
237
|
children: menu
|
|
208
238
|
}) : null;
|
|
209
|
-
$[
|
|
210
|
-
$[
|
|
239
|
+
$[48] = menu;
|
|
240
|
+
$[49] = t15;
|
|
211
241
|
} else {
|
|
212
|
-
|
|
242
|
+
t15 = $[49];
|
|
213
243
|
}
|
|
214
|
-
let
|
|
215
|
-
if ($[
|
|
216
|
-
|
|
217
|
-
ref:
|
|
218
|
-
className:
|
|
219
|
-
"data-
|
|
220
|
-
"data-
|
|
221
|
-
|
|
222
|
-
|
|
244
|
+
let t16;
|
|
245
|
+
if ($[50] !== T0 || $[51] !== t10 || $[52] !== t14 || $[53] !== t15 || $[54] !== t4 || $[55] !== t5 || $[56] !== t6 || $[57] !== t7 || $[58] !== t8 || $[59] !== t9) {
|
|
246
|
+
t16 = /*#__PURE__*/jsxs(T0, {
|
|
247
|
+
ref: t4,
|
|
248
|
+
className: t5,
|
|
249
|
+
"data-component": t6,
|
|
250
|
+
"data-padding": t7,
|
|
251
|
+
"data-border-radius": t8,
|
|
252
|
+
...t9,
|
|
253
|
+
children: [t10, t14, t15]
|
|
223
254
|
});
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[46] = t3;
|
|
227
|
-
$[47] = t4;
|
|
228
|
-
$[48] = t5;
|
|
229
|
-
$[49] = t6;
|
|
230
|
-
$[50] = t7;
|
|
231
|
-
$[51] = t8;
|
|
255
|
+
$[50] = T0;
|
|
256
|
+
$[51] = t10;
|
|
232
257
|
$[52] = t14;
|
|
258
|
+
$[53] = t15;
|
|
259
|
+
$[54] = t4;
|
|
260
|
+
$[55] = t5;
|
|
261
|
+
$[56] = t6;
|
|
262
|
+
$[57] = t7;
|
|
263
|
+
$[58] = t8;
|
|
264
|
+
$[59] = t9;
|
|
265
|
+
$[60] = t16;
|
|
233
266
|
} else {
|
|
234
|
-
|
|
267
|
+
t16 = $[60];
|
|
235
268
|
}
|
|
236
|
-
return
|
|
269
|
+
return t16;
|
|
237
270
|
});
|
|
238
271
|
const CardIcon = t0 => {
|
|
239
272
|
const $ = c(10);
|
|
@@ -264,6 +297,7 @@ const CardIcon = t0 => {
|
|
|
264
297
|
if ($[4] !== ariaLabel || $[5] !== t1 || $[6] !== t2 || $[7] !== t3 || $[8] !== t4) {
|
|
265
298
|
t5 = /*#__PURE__*/jsx("span", {
|
|
266
299
|
className: t1,
|
|
300
|
+
"data-component": "Card.Icon",
|
|
267
301
|
role: t2,
|
|
268
302
|
"aria-label": ariaLabel,
|
|
269
303
|
"aria-hidden": t3,
|
|
@@ -320,6 +354,7 @@ const CardImage = t0 => {
|
|
|
320
354
|
src: src,
|
|
321
355
|
alt: alt,
|
|
322
356
|
className: t2,
|
|
357
|
+
"data-component": "Card.Image",
|
|
323
358
|
...rest
|
|
324
359
|
});
|
|
325
360
|
$[7] = alt;
|
|
@@ -333,6 +368,20 @@ const CardImage = t0 => {
|
|
|
333
368
|
return t3;
|
|
334
369
|
};
|
|
335
370
|
CardImage.displayName = 'Card.Image';
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Heading shown at the top of a Card.
|
|
374
|
+
*
|
|
375
|
+
* Accessibility:
|
|
376
|
+
* - Use only on **standalone** Cards (those rendered with `as="section"`).
|
|
377
|
+
* When the Card is inside an `<li>` in a list of cards, the surrounding
|
|
378
|
+
* list already provides grouping; adding a heading produces a confusing
|
|
379
|
+
* experience for screen-reader users, who handle list items and headings
|
|
380
|
+
* as separate navigation modes.
|
|
381
|
+
* - Pair with `aria-labelledby` on the parent `Card` (referencing the
|
|
382
|
+
* heading's `id`) so the section landmark uses the visible heading as
|
|
383
|
+
* its accessible name.
|
|
384
|
+
*/
|
|
336
385
|
const CardHeading = /*#__PURE__*/forwardRef(function CardHeading(t0, ref) {
|
|
337
386
|
const $ = c(13);
|
|
338
387
|
let children;
|
|
@@ -371,6 +420,7 @@ const CardHeading = /*#__PURE__*/forwardRef(function CardHeading(t0, ref) {
|
|
|
371
420
|
t3 = /*#__PURE__*/jsx(Component, {
|
|
372
421
|
ref: ref,
|
|
373
422
|
className: t2,
|
|
423
|
+
"data-component": "Card.Heading",
|
|
374
424
|
...rest,
|
|
375
425
|
children: children
|
|
376
426
|
});
|
|
@@ -418,6 +468,7 @@ const CardDescription = /*#__PURE__*/forwardRef(function CardDescription(t0, ref
|
|
|
418
468
|
t2 = /*#__PURE__*/jsx("p", {
|
|
419
469
|
ref: ref,
|
|
420
470
|
className: t1,
|
|
471
|
+
"data-component": "Card.Description",
|
|
421
472
|
...rest,
|
|
422
473
|
children: children
|
|
423
474
|
});
|
|
@@ -431,6 +482,21 @@ const CardDescription = /*#__PURE__*/forwardRef(function CardDescription(t0, ref
|
|
|
431
482
|
}
|
|
432
483
|
return t2;
|
|
433
484
|
});
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Renders an interactive control (or controls) positioned at the top-right
|
|
488
|
+
* corner of the card. `Card.Menu` is intended for a single action trigger
|
|
489
|
+
* such as an `IconButton` or `ActionMenu` anchor.
|
|
490
|
+
*
|
|
491
|
+
* Accessibility:
|
|
492
|
+
* - The trigger's accessible name should include enough context to
|
|
493
|
+
* distinguish it from triggers in other cards (for example,
|
|
494
|
+
* `"More options for Project Alpha"` rather than just `"More options"`),
|
|
495
|
+
* because lists of cards often share identical control labels.
|
|
496
|
+
* - Avoid placing multiple interactive controls inside `Card.Menu`.
|
|
497
|
+
* If a card needs multiple actions, expose them inside an `ActionMenu`
|
|
498
|
+
* overlay so they remain reachable in a predictable focus order.
|
|
499
|
+
*/
|
|
434
500
|
const CardMenu = t0 => {
|
|
435
501
|
const $ = c(2);
|
|
436
502
|
const {
|
|
@@ -438,7 +504,8 @@ const CardMenu = t0 => {
|
|
|
438
504
|
} = t0;
|
|
439
505
|
let t1;
|
|
440
506
|
if ($[0] !== children) {
|
|
441
|
-
t1 = /*#__PURE__*/jsx(
|
|
507
|
+
t1 = /*#__PURE__*/jsx("div", {
|
|
508
|
+
"data-component": "Card.Menu",
|
|
442
509
|
children: children
|
|
443
510
|
});
|
|
444
511
|
$[0] = children;
|
|
@@ -482,6 +549,7 @@ const CardMetadata = /*#__PURE__*/forwardRef(function CardMetadata(t0, ref) {
|
|
|
482
549
|
t2 = /*#__PURE__*/jsx("div", {
|
|
483
550
|
ref: ref,
|
|
484
551
|
className: t1,
|
|
552
|
+
"data-component": "Card.Metadata",
|
|
485
553
|
...rest,
|
|
486
554
|
children: children
|
|
487
555
|
});
|
package/dist/Card/index.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import type { CardProps, CardIconProps, CardImageProps, CardHeadingProps, CardDescriptionProps, CardMenuProps, CardMetadataProps } from './Card';
|
|
2
|
-
declare const Card: import("react").ForwardRefExoticComponent<
|
|
3
|
-
className?: string;
|
|
4
|
-
padding?: "none" | "condensed" | "normal";
|
|
5
|
-
borderRadius?: "medium" | "large";
|
|
6
|
-
} & import("react").RefAttributes<HTMLDivElement>> & {
|
|
2
|
+
declare const Card: import("react").ForwardRefExoticComponent<CardProps & import("react").RefAttributes<HTMLDivElement>> & {
|
|
7
3
|
Icon: {
|
|
8
4
|
({ icon: IconComponent, "aria-label": ariaLabel, className }: CardIconProps): import("react").JSX.Element;
|
|
9
5
|
displayName: string;
|
package/dist/Card/index.d.ts.map
CHANGED
|
@@ -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
|
|
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,18 +2126,40 @@
|
|
|
2126
2126
|
"stories": [
|
|
2127
2127
|
{
|
|
2128
2128
|
"id": "experimental-components-card--default",
|
|
2129
|
-
"code": "() => {\n return (\n <
|
|
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}"
|
|
2130
2130
|
},
|
|
2131
2131
|
{
|
|
2132
2132
|
"id": "experimental-components-card-features--with-image",
|
|
2133
|
-
"code": "() => {\n return (\n <
|
|
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}"
|
|
2134
2134
|
},
|
|
2135
2135
|
{
|
|
2136
2136
|
"id": "experimental-components-card-features--with-metadata",
|
|
2137
|
-
"code": "() => {\n return (\n <
|
|
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}"
|
|
2142
|
+
},
|
|
2143
|
+
{
|
|
2144
|
+
"id": "experimental-components-card-features--standalone-section",
|
|
2145
|
+
"code": "() => (\n <Card as=\"section\" aria-labelledby=\"standalone-card-heading\">\n <Card.Icon icon={RepoIcon} />\n <Card.Heading id=\"standalone-card-heading\">primer/react</Card.Heading>\n <Card.Description>\n {\n \"Standalone cards render as a labelled <section> landmark. The Card.Heading's id is referenced via aria-labelledby so screen readers announce the heading as the section's accessible name.\"\n }\n </Card.Description>\n </Card>\n)"
|
|
2146
|
+
},
|
|
2147
|
+
{
|
|
2148
|
+
"id": "experimental-components-card-features--in-list",
|
|
2149
|
+
"code": "() => (\n <ul className={classes.CardList} aria-label=\"Repositories\">\n <li>\n <Card>\n <Card.Icon icon={RepoIcon} />\n <Card.Description>primer/react</Card.Description>\n <Card.Metadata>\n <StarIcon size={16} />\n 1.2k stars\n </Card.Metadata>\n </Card>\n </li>\n <li>\n <Card>\n <Card.Icon icon={RepoIcon} />\n <Card.Description>primer/css</Card.Description>\n <Card.Metadata>\n <StarIcon size={16} />\n 850 stars\n </Card.Metadata>\n </Card>\n </li>\n <li>\n <Card>\n <Card.Icon icon={RepoIcon} />\n <Card.Description>primer/octicons</Card.Description>\n <Card.Metadata>\n <StarIcon size={16} />\n 2.1k stars\n </Card.Metadata>\n </Card>\n </li>\n </ul>\n)"
|
|
2150
|
+
},
|
|
2151
|
+
{
|
|
2152
|
+
"id": "experimental-components-card-features--interactive-content",
|
|
2153
|
+
"code": "() => {\n const repos = [\n {\n name: 'primer/react',\n },\n {\n name: 'primer/css',\n },\n {\n name: 'primer/octicons',\n },\n ]\n return (\n <ul className={classes.CardList} aria-label=\"Repositories\">\n {repos.map((repo) => (\n <li key={repo.name}>\n <Card>\n <Card.Icon icon={RepoIcon} />\n <Card.Description>{repo.name}</Card.Description>\n <Card.Metadata>\n <Button leadingVisual={StarIcon} size=\"small\">\n Star <VisuallyHidden>{repo.name}</VisuallyHidden>\n </Button>\n <Button leadingVisual={RepoForkedIcon} size=\"small\">\n Fork <VisuallyHidden>{repo.name}</VisuallyHidden>\n </Button>\n </Card.Metadata>\n </Card>\n </li>\n ))}\n </ul>\n )\n}"
|
|
2138
2154
|
}
|
|
2139
2155
|
],
|
|
2140
2156
|
"props": [
|
|
2157
|
+
{
|
|
2158
|
+
"name": "children",
|
|
2159
|
+
"type": "React.ReactNode",
|
|
2160
|
+
"required": true,
|
|
2161
|
+
"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."
|
|
2162
|
+
},
|
|
2141
2163
|
{
|
|
2142
2164
|
"name": "className",
|
|
2143
2165
|
"type": "string",
|
|
@@ -2154,6 +2176,12 @@
|
|
|
2154
2176
|
"type": "'medium' | 'large'",
|
|
2155
2177
|
"defaultValue": "'large'",
|
|
2156
2178
|
"description": "Controls the border radius of the Card."
|
|
2179
|
+
},
|
|
2180
|
+
{
|
|
2181
|
+
"name": "as",
|
|
2182
|
+
"type": "'div' | 'section'",
|
|
2183
|
+
"defaultValue": "'div'",
|
|
2184
|
+
"description": "The HTML element to render. Use `'section'` for **standalone** Cards (not inside a list of cards) so screen readers announce the Card as a labelled region; in that case, either `aria-label` or `aria-labelledby` is required. Use the default `'div'` (and omit `Card.Heading`) when the Card is inside an `<li>` of a list of cards — the surrounding list already provides grouping."
|
|
2157
2185
|
}
|
|
2158
2186
|
],
|
|
2159
2187
|
"subcomponents": [
|
|
@@ -2195,21 +2223,42 @@
|
|
|
2195
2223
|
"name": "as",
|
|
2196
2224
|
"type": "'h2' | 'h3' | 'h4' | 'h5' | 'h6'",
|
|
2197
2225
|
"defaultValue": "'h3'",
|
|
2198
|
-
"description": "The heading level to render."
|
|
2226
|
+
"description": "The heading level to render. Use on standalone Cards (with `as=\"section\"` on the parent `Card`) only; do not use `Card.Heading` when the Card is inside an `<li>` of a list of cards."
|
|
2199
2227
|
}
|
|
2200
2228
|
]
|
|
2201
2229
|
},
|
|
2202
2230
|
{
|
|
2203
2231
|
"name": "Card.Description",
|
|
2204
|
-
"props": [
|
|
2232
|
+
"props": [
|
|
2233
|
+
{
|
|
2234
|
+
"name": "children",
|
|
2235
|
+
"type": "React.ReactNode",
|
|
2236
|
+
"required": true,
|
|
2237
|
+
"description": "The descriptive text for the card. Rendered inside a `<p>` element so should be flowing text content."
|
|
2238
|
+
}
|
|
2239
|
+
]
|
|
2205
2240
|
},
|
|
2206
2241
|
{
|
|
2207
2242
|
"name": "Card.Menu",
|
|
2208
|
-
"props": [
|
|
2243
|
+
"props": [
|
|
2244
|
+
{
|
|
2245
|
+
"name": "children",
|
|
2246
|
+
"type": "React.ReactNode",
|
|
2247
|
+
"required": true,
|
|
2248
|
+
"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')."
|
|
2249
|
+
}
|
|
2250
|
+
]
|
|
2209
2251
|
},
|
|
2210
2252
|
{
|
|
2211
2253
|
"name": "Card.Metadata",
|
|
2212
|
-
"props": [
|
|
2254
|
+
"props": [
|
|
2255
|
+
{
|
|
2256
|
+
"name": "children",
|
|
2257
|
+
"type": "React.ReactNode",
|
|
2258
|
+
"required": true,
|
|
2259
|
+
"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."
|
|
2260
|
+
}
|
|
2261
|
+
]
|
|
2213
2262
|
}
|
|
2214
2263
|
]
|
|
2215
2264
|
},
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-20260519202353",
|
|
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": "
|
|
82
|
+
"@primer/behaviors": "^1.10.2",
|
|
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",
|