@primer/react 0.0.0-20260519181013 → 0.0.0-20260519214009
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 +184 -119
- 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-20260519214009
|
|
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<HTMLElement>>;
|
|
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,42 +2,51 @@ 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(62);
|
|
9
10
|
let children;
|
|
10
11
|
let className;
|
|
11
12
|
let rest;
|
|
13
|
+
let t0;
|
|
12
14
|
let t1;
|
|
13
15
|
let t2;
|
|
14
|
-
if ($[0] !==
|
|
16
|
+
if ($[0] !== props) {
|
|
15
17
|
({
|
|
16
18
|
children,
|
|
17
19
|
className,
|
|
18
|
-
padding:
|
|
19
|
-
borderRadius:
|
|
20
|
+
padding: t0,
|
|
21
|
+
borderRadius: t1,
|
|
22
|
+
as: t2,
|
|
20
23
|
...rest
|
|
21
|
-
} =
|
|
22
|
-
$[0] =
|
|
24
|
+
} = props);
|
|
25
|
+
$[0] = props;
|
|
23
26
|
$[1] = children;
|
|
24
27
|
$[2] = className;
|
|
25
28
|
$[3] = rest;
|
|
26
|
-
$[4] =
|
|
27
|
-
$[5] =
|
|
29
|
+
$[4] = t0;
|
|
30
|
+
$[5] = t1;
|
|
31
|
+
$[6] = t2;
|
|
28
32
|
} else {
|
|
29
33
|
children = $[1];
|
|
30
34
|
className = $[2];
|
|
31
35
|
rest = $[3];
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
t0 = $[4];
|
|
37
|
+
t1 = $[5];
|
|
38
|
+
t2 = $[6];
|
|
34
39
|
}
|
|
35
|
-
const padding =
|
|
36
|
-
const borderRadius =
|
|
40
|
+
const padding = t0 === undefined ? "normal" : t0;
|
|
41
|
+
const borderRadius = t1 === undefined ? "large" : t1;
|
|
42
|
+
const as = t2 === undefined ? "div" : t2;
|
|
43
|
+
const Component = as;
|
|
44
|
+
let T0;
|
|
37
45
|
let description;
|
|
38
46
|
let heading;
|
|
39
47
|
let menu;
|
|
40
48
|
let metadata;
|
|
49
|
+
let t10;
|
|
41
50
|
let t3;
|
|
42
51
|
let t4;
|
|
43
52
|
let t5;
|
|
@@ -45,8 +54,8 @@ const CardImpl = /*#__PURE__*/forwardRef(function Card(t0, ref) {
|
|
|
45
54
|
let t7;
|
|
46
55
|
let t8;
|
|
47
56
|
let t9;
|
|
48
|
-
if ($[
|
|
49
|
-
|
|
57
|
+
if ($[7] !== Component || $[8] !== as || $[9] !== borderRadius || $[10] !== children || $[11] !== className || $[12] !== padding || $[13] !== props || $[14] !== ref || $[15] !== rest) {
|
|
58
|
+
t10 = Symbol.for("react.early_return_sentinel");
|
|
50
59
|
bb0: {
|
|
51
60
|
let icon = null;
|
|
52
61
|
let image = null;
|
|
@@ -84,156 +93,177 @@ const CardImpl = /*#__PURE__*/forwardRef(function Card(t0, ref) {
|
|
|
84
93
|
}
|
|
85
94
|
}
|
|
86
95
|
const hasSlotChildren = icon || image || heading || description || metadata || menu;
|
|
96
|
+
const isEmpty = !hasSlotChildren && childArray.length === 0;
|
|
97
|
+
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;
|
|
98
|
+
process.env.NODE_ENV !== "production" ? warning(as === "section" && !("aria-label" in props) && !("aria-labelledby" in props), "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;
|
|
99
|
+
if (isEmpty) {
|
|
100
|
+
t10 = null;
|
|
101
|
+
break bb0;
|
|
102
|
+
}
|
|
87
103
|
if (!hasSlotChildren) {
|
|
88
|
-
let
|
|
89
|
-
if ($[
|
|
90
|
-
|
|
91
|
-
$[
|
|
92
|
-
$[
|
|
104
|
+
let t11;
|
|
105
|
+
if ($[29] !== className) {
|
|
106
|
+
t11 = clsx(classes.Card, className);
|
|
107
|
+
$[29] = className;
|
|
108
|
+
$[30] = t11;
|
|
93
109
|
} else {
|
|
94
|
-
|
|
110
|
+
t11 = $[30];
|
|
95
111
|
}
|
|
96
|
-
let
|
|
97
|
-
if ($[
|
|
98
|
-
|
|
112
|
+
let t12;
|
|
113
|
+
if ($[31] !== Component || $[32] !== borderRadius || $[33] !== children || $[34] !== padding || $[35] !== ref || $[36] !== rest || $[37] !== t11) {
|
|
114
|
+
t12 = /*#__PURE__*/jsx(Component, {
|
|
99
115
|
ref: ref,
|
|
100
|
-
className:
|
|
116
|
+
className: t11,
|
|
117
|
+
"data-component": "Card",
|
|
101
118
|
"data-padding": padding,
|
|
102
119
|
"data-border-radius": borderRadius,
|
|
103
120
|
...rest,
|
|
104
121
|
children: children
|
|
105
122
|
});
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
123
|
+
$[31] = Component;
|
|
124
|
+
$[32] = borderRadius;
|
|
125
|
+
$[33] = children;
|
|
126
|
+
$[34] = padding;
|
|
127
|
+
$[35] = ref;
|
|
128
|
+
$[36] = rest;
|
|
129
|
+
$[37] = t11;
|
|
130
|
+
$[38] = t12;
|
|
113
131
|
} else {
|
|
114
|
-
|
|
132
|
+
t12 = $[38];
|
|
115
133
|
}
|
|
116
|
-
|
|
134
|
+
t10 = t12;
|
|
117
135
|
break bb0;
|
|
118
136
|
}
|
|
137
|
+
T0 = Component;
|
|
119
138
|
t3 = ref;
|
|
120
|
-
if ($[
|
|
139
|
+
if ($[39] !== className) {
|
|
121
140
|
t4 = clsx(classes.Card, className);
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
141
|
+
$[39] = className;
|
|
142
|
+
$[40] = t4;
|
|
124
143
|
} else {
|
|
125
|
-
t4 = $[
|
|
144
|
+
t4 = $[40];
|
|
126
145
|
}
|
|
127
|
-
t5 =
|
|
128
|
-
t6 =
|
|
129
|
-
t7 =
|
|
130
|
-
t8 =
|
|
146
|
+
t5 = "Card";
|
|
147
|
+
t6 = padding;
|
|
148
|
+
t7 = borderRadius;
|
|
149
|
+
t8 = rest;
|
|
150
|
+
t9 = (image || icon) && /*#__PURE__*/jsx("div", {
|
|
131
151
|
className: clsx(classes.CardHeader, image && classes.CardHeaderEdgeToEdge),
|
|
132
152
|
children: image || icon
|
|
133
153
|
});
|
|
134
154
|
}
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
155
|
+
$[7] = Component;
|
|
156
|
+
$[8] = as;
|
|
157
|
+
$[9] = borderRadius;
|
|
158
|
+
$[10] = children;
|
|
159
|
+
$[11] = className;
|
|
160
|
+
$[12] = padding;
|
|
161
|
+
$[13] = props;
|
|
162
|
+
$[14] = ref;
|
|
163
|
+
$[15] = rest;
|
|
164
|
+
$[16] = T0;
|
|
165
|
+
$[17] = description;
|
|
166
|
+
$[18] = heading;
|
|
167
|
+
$[19] = menu;
|
|
168
|
+
$[20] = metadata;
|
|
169
|
+
$[21] = t10;
|
|
170
|
+
$[22] = t3;
|
|
171
|
+
$[23] = t4;
|
|
172
|
+
$[24] = t5;
|
|
173
|
+
$[25] = t6;
|
|
174
|
+
$[26] = t7;
|
|
175
|
+
$[27] = t8;
|
|
176
|
+
$[28] = t9;
|
|
152
177
|
} else {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
178
|
+
T0 = $[16];
|
|
179
|
+
description = $[17];
|
|
180
|
+
heading = $[18];
|
|
181
|
+
menu = $[19];
|
|
182
|
+
metadata = $[20];
|
|
183
|
+
t10 = $[21];
|
|
184
|
+
t3 = $[22];
|
|
185
|
+
t4 = $[23];
|
|
186
|
+
t5 = $[24];
|
|
187
|
+
t6 = $[25];
|
|
188
|
+
t7 = $[26];
|
|
189
|
+
t8 = $[27];
|
|
190
|
+
t9 = $[28];
|
|
164
191
|
}
|
|
165
|
-
if (
|
|
166
|
-
return
|
|
192
|
+
if (t10 !== Symbol.for("react.early_return_sentinel")) {
|
|
193
|
+
return t10;
|
|
167
194
|
}
|
|
168
|
-
let
|
|
169
|
-
if ($[
|
|
170
|
-
|
|
195
|
+
let t11;
|
|
196
|
+
if ($[41] !== description || $[42] !== heading) {
|
|
197
|
+
t11 = /*#__PURE__*/jsxs("div", {
|
|
171
198
|
className: classes.CardContent,
|
|
172
199
|
children: [heading, description]
|
|
173
200
|
});
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
201
|
+
$[41] = description;
|
|
202
|
+
$[42] = heading;
|
|
203
|
+
$[43] = t11;
|
|
177
204
|
} else {
|
|
178
|
-
|
|
205
|
+
t11 = $[43];
|
|
179
206
|
}
|
|
180
|
-
let
|
|
181
|
-
if ($[
|
|
182
|
-
|
|
207
|
+
let t12;
|
|
208
|
+
if ($[44] !== metadata) {
|
|
209
|
+
t12 = metadata ? /*#__PURE__*/jsx("div", {
|
|
183
210
|
className: classes.CardMetadataContainer,
|
|
184
211
|
children: metadata
|
|
185
212
|
}) : null;
|
|
186
|
-
$[
|
|
187
|
-
$[
|
|
213
|
+
$[44] = metadata;
|
|
214
|
+
$[45] = t12;
|
|
188
215
|
} else {
|
|
189
|
-
|
|
216
|
+
t12 = $[45];
|
|
190
217
|
}
|
|
191
|
-
let
|
|
192
|
-
if ($[
|
|
193
|
-
|
|
218
|
+
let t13;
|
|
219
|
+
if ($[46] !== t11 || $[47] !== t12) {
|
|
220
|
+
t13 = /*#__PURE__*/jsxs("div", {
|
|
194
221
|
className: classes.CardBody,
|
|
195
|
-
children: [
|
|
222
|
+
children: [t11, t12]
|
|
196
223
|
});
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
224
|
+
$[46] = t11;
|
|
225
|
+
$[47] = t12;
|
|
226
|
+
$[48] = t13;
|
|
200
227
|
} else {
|
|
201
|
-
|
|
228
|
+
t13 = $[48];
|
|
202
229
|
}
|
|
203
|
-
let
|
|
204
|
-
if ($[
|
|
205
|
-
|
|
230
|
+
let t14;
|
|
231
|
+
if ($[49] !== menu) {
|
|
232
|
+
t14 = menu ? /*#__PURE__*/jsx("div", {
|
|
206
233
|
className: classes.CardMenu,
|
|
207
234
|
children: menu
|
|
208
235
|
}) : null;
|
|
209
|
-
$[
|
|
210
|
-
$[
|
|
236
|
+
$[49] = menu;
|
|
237
|
+
$[50] = t14;
|
|
211
238
|
} else {
|
|
212
|
-
|
|
239
|
+
t14 = $[50];
|
|
213
240
|
}
|
|
214
|
-
let
|
|
215
|
-
if ($[
|
|
216
|
-
|
|
241
|
+
let t15;
|
|
242
|
+
if ($[51] !== T0 || $[52] !== t13 || $[53] !== t14 || $[54] !== t3 || $[55] !== t4 || $[56] !== t5 || $[57] !== t6 || $[58] !== t7 || $[59] !== t8 || $[60] !== t9) {
|
|
243
|
+
t15 = /*#__PURE__*/jsxs(T0, {
|
|
217
244
|
ref: t3,
|
|
218
245
|
className: t4,
|
|
219
|
-
"data-
|
|
220
|
-
"data-
|
|
221
|
-
|
|
222
|
-
|
|
246
|
+
"data-component": t5,
|
|
247
|
+
"data-padding": t6,
|
|
248
|
+
"data-border-radius": t7,
|
|
249
|
+
...t8,
|
|
250
|
+
children: [t9, t13, t14]
|
|
223
251
|
});
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
252
|
+
$[51] = T0;
|
|
253
|
+
$[52] = t13;
|
|
254
|
+
$[53] = t14;
|
|
255
|
+
$[54] = t3;
|
|
256
|
+
$[55] = t4;
|
|
257
|
+
$[56] = t5;
|
|
258
|
+
$[57] = t6;
|
|
259
|
+
$[58] = t7;
|
|
260
|
+
$[59] = t8;
|
|
261
|
+
$[60] = t9;
|
|
262
|
+
$[61] = t15;
|
|
233
263
|
} else {
|
|
234
|
-
|
|
264
|
+
t15 = $[61];
|
|
235
265
|
}
|
|
236
|
-
return
|
|
266
|
+
return t15;
|
|
237
267
|
});
|
|
238
268
|
const CardIcon = t0 => {
|
|
239
269
|
const $ = c(10);
|
|
@@ -264,6 +294,7 @@ const CardIcon = t0 => {
|
|
|
264
294
|
if ($[4] !== ariaLabel || $[5] !== t1 || $[6] !== t2 || $[7] !== t3 || $[8] !== t4) {
|
|
265
295
|
t5 = /*#__PURE__*/jsx("span", {
|
|
266
296
|
className: t1,
|
|
297
|
+
"data-component": "Card.Icon",
|
|
267
298
|
role: t2,
|
|
268
299
|
"aria-label": ariaLabel,
|
|
269
300
|
"aria-hidden": t3,
|
|
@@ -320,6 +351,7 @@ const CardImage = t0 => {
|
|
|
320
351
|
src: src,
|
|
321
352
|
alt: alt,
|
|
322
353
|
className: t2,
|
|
354
|
+
"data-component": "Card.Image",
|
|
323
355
|
...rest
|
|
324
356
|
});
|
|
325
357
|
$[7] = alt;
|
|
@@ -333,6 +365,20 @@ const CardImage = t0 => {
|
|
|
333
365
|
return t3;
|
|
334
366
|
};
|
|
335
367
|
CardImage.displayName = 'Card.Image';
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Heading shown at the top of a Card.
|
|
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.
|
|
381
|
+
*/
|
|
336
382
|
const CardHeading = /*#__PURE__*/forwardRef(function CardHeading(t0, ref) {
|
|
337
383
|
const $ = c(13);
|
|
338
384
|
let children;
|
|
@@ -371,6 +417,7 @@ const CardHeading = /*#__PURE__*/forwardRef(function CardHeading(t0, ref) {
|
|
|
371
417
|
t3 = /*#__PURE__*/jsx(Component, {
|
|
372
418
|
ref: ref,
|
|
373
419
|
className: t2,
|
|
420
|
+
"data-component": "Card.Heading",
|
|
374
421
|
...rest,
|
|
375
422
|
children: children
|
|
376
423
|
});
|
|
@@ -418,6 +465,7 @@ const CardDescription = /*#__PURE__*/forwardRef(function CardDescription(t0, ref
|
|
|
418
465
|
t2 = /*#__PURE__*/jsx("p", {
|
|
419
466
|
ref: ref,
|
|
420
467
|
className: t1,
|
|
468
|
+
"data-component": "Card.Description",
|
|
421
469
|
...rest,
|
|
422
470
|
children: children
|
|
423
471
|
});
|
|
@@ -431,6 +479,21 @@ const CardDescription = /*#__PURE__*/forwardRef(function CardDescription(t0, ref
|
|
|
431
479
|
}
|
|
432
480
|
return t2;
|
|
433
481
|
});
|
|
482
|
+
|
|
483
|
+
/**
|
|
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.
|
|
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.
|
|
496
|
+
*/
|
|
434
497
|
const CardMenu = t0 => {
|
|
435
498
|
const $ = c(2);
|
|
436
499
|
const {
|
|
@@ -438,7 +501,8 @@ const CardMenu = t0 => {
|
|
|
438
501
|
} = t0;
|
|
439
502
|
let t1;
|
|
440
503
|
if ($[0] !== children) {
|
|
441
|
-
t1 = /*#__PURE__*/jsx(
|
|
504
|
+
t1 = /*#__PURE__*/jsx("div", {
|
|
505
|
+
"data-component": "Card.Menu",
|
|
442
506
|
children: children
|
|
443
507
|
});
|
|
444
508
|
$[0] = children;
|
|
@@ -482,6 +546,7 @@ const CardMetadata = /*#__PURE__*/forwardRef(function CardMetadata(t0, ref) {
|
|
|
482
546
|
t2 = /*#__PURE__*/jsx("div", {
|
|
483
547
|
ref: ref,
|
|
484
548
|
className: t1,
|
|
549
|
+
"data-component": "Card.Metadata",
|
|
485
550
|
...rest,
|
|
486
551
|
children: children
|
|
487
552
|
});
|
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<HTMLElement>> & {
|
|
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-20260519214009",
|
|
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",
|