@primer/react 0.0.0-20260519202353 → 0.0.0-20260519215202
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/dist/Card/Card.d.ts +38 -57
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/Card.js +149 -158
- package/dist/Card/index.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/Card/Card.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
type BaseCardProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> & {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* the Card
|
|
4
|
+
* Optional className for the root element.
|
|
6
5
|
*/
|
|
7
6
|
className?: string;
|
|
8
7
|
/**
|
|
@@ -16,32 +15,25 @@ type BaseCardProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> & {
|
|
|
16
15
|
*/
|
|
17
16
|
borderRadius?: 'medium' | 'large';
|
|
18
17
|
/**
|
|
19
|
-
* The contents
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* A card with no children will not render — at least one meaningful
|
|
24
|
-
* child is required.
|
|
18
|
+
* The card contents. Provide either `Card.*` subcomponents (e.g.
|
|
19
|
+
* `Card.Heading`, `Card.Description`, `Card.Metadata`) or custom content.
|
|
20
|
+
* Empty cards do not render.
|
|
25
21
|
*/
|
|
26
22
|
children: React.ReactNode;
|
|
27
23
|
};
|
|
28
24
|
/**
|
|
29
|
-
* Card
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* `Card.Heading` in this context — screen readers handle list items and
|
|
33
|
-
* headings as separate navigation modes, and combining them produces a
|
|
34
|
-
* confusing experience.
|
|
25
|
+
* The default Card. Use this inside `<li>` when rendering a list of cards:
|
|
26
|
+
* the list already groups them, so the Card itself doesn't need to be a
|
|
27
|
+
* landmark. Don't use `Card.Heading` here.
|
|
35
28
|
*/
|
|
36
29
|
type DivCardProps = BaseCardProps & {
|
|
37
30
|
as?: 'div';
|
|
38
31
|
};
|
|
39
32
|
/**
|
|
40
|
-
* Card
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* referencing the id of the `Card.Heading`).
|
|
33
|
+
* Renders the Card as a `<section>`. Use this for a standalone Card that
|
|
34
|
+
* isn't part of a list. The `<section>` is a region landmark, so it needs
|
|
35
|
+
* an accessible name via `aria-label` or `aria-labelledby` (the latter
|
|
36
|
+
* usually points at `Card.Heading`).
|
|
45
37
|
*/
|
|
46
38
|
type SectionCardProps = BaseCardProps & {
|
|
47
39
|
as: 'section';
|
|
@@ -61,8 +53,7 @@ type HeadingProps = React.ComponentPropsWithoutRef<'h3'> & {
|
|
|
61
53
|
};
|
|
62
54
|
type DescriptionProps = React.ComponentPropsWithoutRef<'p'> & {
|
|
63
55
|
/**
|
|
64
|
-
*
|
|
65
|
-
* should be flowing text content.
|
|
56
|
+
* Card description. Rendered as a `<p>`, so keep it to flowing text.
|
|
66
57
|
*/
|
|
67
58
|
children: React.ReactNode;
|
|
68
59
|
};
|
|
@@ -89,24 +80,22 @@ type ImageProps = React.ComponentPropsWithoutRef<'img'> & {
|
|
|
89
80
|
};
|
|
90
81
|
type MenuProps = {
|
|
91
82
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* `Options for Project Alpha` rather than just `Options`).
|
|
83
|
+
* Interactive control in the top-right of the card, usually an `IconButton`
|
|
84
|
+
* or `ActionMenu` trigger. Give the control a label that names the card
|
|
85
|
+
* (e.g. `"Options for Project Alpha"`, not just `"Options"`) so it's
|
|
86
|
+
* distinguishable when several cards are on screen.
|
|
97
87
|
*/
|
|
98
88
|
children: React.ReactNode;
|
|
99
89
|
};
|
|
100
90
|
type MetadataProps = React.ComponentPropsWithoutRef<'div'> & {
|
|
101
91
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* `RelativeTime` until its outstanding accessibility issues are resolved.
|
|
92
|
+
* Metadata row at the bottom of the card. Any content works: text, icons,
|
|
93
|
+
* a `Label`, an `Octicon`. Skip `RelativeTime` for now; it has open
|
|
94
|
+
* accessibility issues.
|
|
106
95
|
*/
|
|
107
96
|
children: React.ReactNode;
|
|
108
97
|
};
|
|
109
|
-
declare const CardImpl: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<
|
|
98
|
+
declare const CardImpl: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLElement>>;
|
|
110
99
|
declare const CardIcon: {
|
|
111
100
|
({ icon: IconComponent, "aria-label": ariaLabel, className }: IconProps): React.JSX.Element;
|
|
112
101
|
displayName: string;
|
|
@@ -118,15 +107,12 @@ declare const CardImage: {
|
|
|
118
107
|
/**
|
|
119
108
|
* Heading shown at the top of a Card.
|
|
120
109
|
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
* - Pair with `aria-labelledby` on the parent `Card` (referencing the
|
|
128
|
-
* heading's `id`) so the section landmark uses the visible heading as
|
|
129
|
-
* its accessible name.
|
|
110
|
+
* Only use this on a standalone Card (`as="section"`); don't use it inside
|
|
111
|
+
* an `<li>`, where the surrounding list already provides grouping.
|
|
112
|
+
*
|
|
113
|
+
* Give it an `id` and reference that id from the parent Card's
|
|
114
|
+
* `aria-labelledby` so the section landmark uses the heading as its
|
|
115
|
+
* accessible name.
|
|
130
116
|
*/
|
|
131
117
|
declare const CardHeading: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & {
|
|
132
118
|
/**
|
|
@@ -137,24 +123,20 @@ declare const CardHeading: React.ForwardRefExoticComponent<Omit<React.DetailedHT
|
|
|
137
123
|
} & React.RefAttributes<HTMLHeadingElement>>;
|
|
138
124
|
declare const CardDescription: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & {
|
|
139
125
|
/**
|
|
140
|
-
*
|
|
141
|
-
* should be flowing text content.
|
|
126
|
+
* Card description. Rendered as a `<p>`, so keep it to flowing text.
|
|
142
127
|
*/
|
|
143
128
|
children: React.ReactNode;
|
|
144
129
|
} & React.RefAttributes<HTMLParagraphElement>>;
|
|
145
130
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
131
|
+
* Top-right slot for a single interactive control, usually an `IconButton`
|
|
132
|
+
* or `ActionMenu` trigger.
|
|
133
|
+
*
|
|
134
|
+
* Give the control a label that names the card (e.g. `"More options for
|
|
135
|
+
* Project Alpha"`, not just `"More options"`) so users can tell which card
|
|
136
|
+
* the action applies to when several cards are visible.
|
|
149
137
|
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* distinguish it from triggers in other cards (for example,
|
|
153
|
-
* `"More options for Project Alpha"` rather than just `"More options"`),
|
|
154
|
-
* because lists of cards often share identical control labels.
|
|
155
|
-
* - Avoid placing multiple interactive controls inside `Card.Menu`.
|
|
156
|
-
* If a card needs multiple actions, expose them inside an `ActionMenu`
|
|
157
|
-
* overlay so they remain reachable in a predictable focus order.
|
|
138
|
+
* For more than one action, put them inside an `ActionMenu` rather than
|
|
139
|
+
* cramming multiple controls into `Card.Menu`.
|
|
158
140
|
*/
|
|
159
141
|
declare const CardMenu: {
|
|
160
142
|
({ children }: MenuProps): React.JSX.Element;
|
|
@@ -162,10 +144,9 @@ declare const CardMenu: {
|
|
|
162
144
|
};
|
|
163
145
|
declare const CardMetadata: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
164
146
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* `RelativeTime` until its outstanding accessibility issues are resolved.
|
|
147
|
+
* Metadata row at the bottom of the card. Any content works: text, icons,
|
|
148
|
+
* a `Label`, an `Octicon`. Skip `RelativeTime` for now; it has open
|
|
149
|
+
* accessibility issues.
|
|
169
150
|
*/
|
|
170
151
|
children: React.ReactNode;
|
|
171
152
|
} & React.RefAttributes<HTMLDivElement>>;
|
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;AAIvC,KAAK,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IAC7E
|
|
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
|
@@ -6,41 +6,40 @@ import { warning } from '../utils/warning.js';
|
|
|
6
6
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
8
|
const CardImpl = /*#__PURE__*/forwardRef(function Card(props, ref) {
|
|
9
|
-
const $ = c(
|
|
10
|
-
const t0 = props;
|
|
9
|
+
const $ = c(62);
|
|
11
10
|
let children;
|
|
12
11
|
let className;
|
|
13
12
|
let rest;
|
|
13
|
+
let t0;
|
|
14
14
|
let t1;
|
|
15
15
|
let t2;
|
|
16
|
-
|
|
17
|
-
if ($[0] !== t0) {
|
|
16
|
+
if ($[0] !== props) {
|
|
18
17
|
({
|
|
19
18
|
children,
|
|
20
19
|
className,
|
|
21
|
-
padding:
|
|
22
|
-
borderRadius:
|
|
23
|
-
as:
|
|
20
|
+
padding: t0,
|
|
21
|
+
borderRadius: t1,
|
|
22
|
+
as: t2,
|
|
24
23
|
...rest
|
|
25
|
-
} =
|
|
26
|
-
$[0] =
|
|
24
|
+
} = props);
|
|
25
|
+
$[0] = props;
|
|
27
26
|
$[1] = children;
|
|
28
27
|
$[2] = className;
|
|
29
28
|
$[3] = rest;
|
|
30
|
-
$[4] =
|
|
31
|
-
$[5] =
|
|
32
|
-
$[6] =
|
|
29
|
+
$[4] = t0;
|
|
30
|
+
$[5] = t1;
|
|
31
|
+
$[6] = t2;
|
|
33
32
|
} else {
|
|
34
33
|
children = $[1];
|
|
35
34
|
className = $[2];
|
|
36
35
|
rest = $[3];
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
t0 = $[4];
|
|
37
|
+
t1 = $[5];
|
|
38
|
+
t2 = $[6];
|
|
40
39
|
}
|
|
41
|
-
const padding =
|
|
42
|
-
const borderRadius =
|
|
43
|
-
const as =
|
|
40
|
+
const padding = t0 === undefined ? "normal" : t0;
|
|
41
|
+
const borderRadius = t1 === undefined ? "large" : t1;
|
|
42
|
+
const as = t2 === undefined ? "div" : t2;
|
|
44
43
|
const Component = as;
|
|
45
44
|
let T0;
|
|
46
45
|
let description;
|
|
@@ -48,15 +47,15 @@ const CardImpl = /*#__PURE__*/forwardRef(function Card(props, ref) {
|
|
|
48
47
|
let menu;
|
|
49
48
|
let metadata;
|
|
50
49
|
let t10;
|
|
51
|
-
let
|
|
50
|
+
let t3;
|
|
52
51
|
let t4;
|
|
53
52
|
let t5;
|
|
54
53
|
let t6;
|
|
55
54
|
let t7;
|
|
56
55
|
let t8;
|
|
57
56
|
let t9;
|
|
58
|
-
if ($[7] !== Component || $[8] !== as || $[9] !== borderRadius || $[10] !== children || $[11] !== className || $[12] !== padding || $[13] !==
|
|
59
|
-
|
|
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");
|
|
60
59
|
bb0: {
|
|
61
60
|
let icon = null;
|
|
62
61
|
let image = null;
|
|
@@ -96,62 +95,59 @@ const CardImpl = /*#__PURE__*/forwardRef(function Card(props, ref) {
|
|
|
96
95
|
const hasSlotChildren = icon || image || heading || description || metadata || menu;
|
|
97
96
|
const isEmpty = !hasSlotChildren && childArray.length === 0;
|
|
98
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;
|
|
99
|
-
|
|
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;
|
|
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;
|
|
102
99
|
if (isEmpty) {
|
|
103
|
-
|
|
100
|
+
t10 = null;
|
|
104
101
|
break bb0;
|
|
105
102
|
}
|
|
106
103
|
if (!hasSlotChildren) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
$[
|
|
112
|
-
$[29] = t13;
|
|
104
|
+
let t11;
|
|
105
|
+
if ($[29] !== className) {
|
|
106
|
+
t11 = clsx(classes.Card, className);
|
|
107
|
+
$[29] = className;
|
|
108
|
+
$[30] = t11;
|
|
113
109
|
} else {
|
|
114
|
-
|
|
110
|
+
t11 = $[30];
|
|
115
111
|
}
|
|
116
|
-
let
|
|
117
|
-
if ($[
|
|
118
|
-
|
|
119
|
-
ref:
|
|
120
|
-
className:
|
|
112
|
+
let t12;
|
|
113
|
+
if ($[31] !== Component || $[32] !== borderRadius || $[33] !== children || $[34] !== padding || $[35] !== ref || $[36] !== rest || $[37] !== t11) {
|
|
114
|
+
t12 = /*#__PURE__*/jsx(Component, {
|
|
115
|
+
ref: ref,
|
|
116
|
+
className: t11,
|
|
121
117
|
"data-component": "Card",
|
|
122
118
|
"data-padding": padding,
|
|
123
119
|
"data-border-radius": borderRadius,
|
|
124
120
|
...rest,
|
|
125
121
|
children: children
|
|
126
122
|
});
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
123
|
+
$[31] = Component;
|
|
124
|
+
$[32] = borderRadius;
|
|
125
|
+
$[33] = children;
|
|
126
|
+
$[34] = padding;
|
|
127
|
+
$[35] = ref;
|
|
128
|
+
$[36] = rest;
|
|
129
|
+
$[37] = t11;
|
|
130
|
+
$[38] = t12;
|
|
135
131
|
} else {
|
|
136
|
-
|
|
132
|
+
t12 = $[38];
|
|
137
133
|
}
|
|
138
|
-
|
|
134
|
+
t10 = t12;
|
|
139
135
|
break bb0;
|
|
140
136
|
}
|
|
141
137
|
T0 = Component;
|
|
142
|
-
|
|
143
|
-
if ($[
|
|
144
|
-
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
138
|
+
t3 = ref;
|
|
139
|
+
if ($[39] !== className) {
|
|
140
|
+
t4 = clsx(classes.Card, className);
|
|
141
|
+
$[39] = className;
|
|
142
|
+
$[40] = t4;
|
|
147
143
|
} else {
|
|
148
|
-
|
|
144
|
+
t4 = $[40];
|
|
149
145
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
146
|
+
t5 = "Card";
|
|
147
|
+
t6 = padding;
|
|
148
|
+
t7 = borderRadius;
|
|
149
|
+
t8 = rest;
|
|
150
|
+
t9 = (image || icon) && /*#__PURE__*/jsx("div", {
|
|
155
151
|
className: clsx(classes.CardHeader, image && classes.CardHeaderEdgeToEdge),
|
|
156
152
|
children: image || icon
|
|
157
153
|
});
|
|
@@ -162,111 +158,112 @@ const CardImpl = /*#__PURE__*/forwardRef(function Card(props, ref) {
|
|
|
162
158
|
$[10] = children;
|
|
163
159
|
$[11] = className;
|
|
164
160
|
$[12] = padding;
|
|
165
|
-
$[13] =
|
|
166
|
-
$[14] =
|
|
167
|
-
$[15] =
|
|
168
|
-
$[16] =
|
|
169
|
-
$[17] =
|
|
170
|
-
$[18] =
|
|
171
|
-
$[19] =
|
|
172
|
-
$[20] =
|
|
173
|
-
$[21] =
|
|
174
|
-
$[22] =
|
|
175
|
-
$[23] =
|
|
176
|
-
$[24] =
|
|
177
|
-
$[25] =
|
|
178
|
-
$[26] =
|
|
179
|
-
$[27] =
|
|
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;
|
|
180
177
|
} else {
|
|
181
|
-
T0 = $[
|
|
182
|
-
description = $[
|
|
183
|
-
heading = $[
|
|
184
|
-
menu = $[
|
|
185
|
-
metadata = $[
|
|
186
|
-
t10 = $[
|
|
187
|
-
|
|
188
|
-
t4 = $[
|
|
189
|
-
t5 = $[
|
|
190
|
-
t6 = $[
|
|
191
|
-
t7 = $[
|
|
192
|
-
t8 = $[
|
|
193
|
-
t9 = $[
|
|
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];
|
|
194
191
|
}
|
|
195
|
-
if (
|
|
196
|
-
return
|
|
192
|
+
if (t10 !== Symbol.for("react.early_return_sentinel")) {
|
|
193
|
+
return t10;
|
|
197
194
|
}
|
|
198
|
-
let
|
|
199
|
-
if ($[
|
|
200
|
-
|
|
195
|
+
let t11;
|
|
196
|
+
if ($[41] !== description || $[42] !== heading) {
|
|
197
|
+
t11 = /*#__PURE__*/jsxs("div", {
|
|
201
198
|
className: classes.CardContent,
|
|
202
199
|
children: [heading, description]
|
|
203
200
|
});
|
|
204
|
-
$[
|
|
205
|
-
$[
|
|
206
|
-
$[
|
|
201
|
+
$[41] = description;
|
|
202
|
+
$[42] = heading;
|
|
203
|
+
$[43] = t11;
|
|
207
204
|
} else {
|
|
208
|
-
|
|
205
|
+
t11 = $[43];
|
|
209
206
|
}
|
|
210
|
-
let
|
|
211
|
-
if ($[
|
|
212
|
-
|
|
207
|
+
let t12;
|
|
208
|
+
if ($[44] !== metadata) {
|
|
209
|
+
t12 = metadata ? /*#__PURE__*/jsx("div", {
|
|
213
210
|
className: classes.CardMetadataContainer,
|
|
214
211
|
children: metadata
|
|
215
212
|
}) : null;
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
213
|
+
$[44] = metadata;
|
|
214
|
+
$[45] = t12;
|
|
218
215
|
} else {
|
|
219
|
-
|
|
216
|
+
t12 = $[45];
|
|
220
217
|
}
|
|
221
|
-
let
|
|
222
|
-
if ($[
|
|
223
|
-
|
|
218
|
+
let t13;
|
|
219
|
+
if ($[46] !== t11 || $[47] !== t12) {
|
|
220
|
+
t13 = /*#__PURE__*/jsxs("div", {
|
|
224
221
|
className: classes.CardBody,
|
|
225
|
-
children: [
|
|
222
|
+
children: [t11, t12]
|
|
226
223
|
});
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
224
|
+
$[46] = t11;
|
|
225
|
+
$[47] = t12;
|
|
226
|
+
$[48] = t13;
|
|
230
227
|
} else {
|
|
231
|
-
|
|
228
|
+
t13 = $[48];
|
|
232
229
|
}
|
|
233
|
-
let
|
|
234
|
-
if ($[
|
|
235
|
-
|
|
230
|
+
let t14;
|
|
231
|
+
if ($[49] !== menu) {
|
|
232
|
+
t14 = menu ? /*#__PURE__*/jsx("div", {
|
|
236
233
|
className: classes.CardMenu,
|
|
237
234
|
children: menu
|
|
238
235
|
}) : null;
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
236
|
+
$[49] = menu;
|
|
237
|
+
$[50] = t14;
|
|
241
238
|
} else {
|
|
242
|
-
|
|
239
|
+
t14 = $[50];
|
|
243
240
|
}
|
|
244
|
-
let
|
|
245
|
-
if ($[
|
|
246
|
-
|
|
247
|
-
ref:
|
|
248
|
-
className:
|
|
249
|
-
"data-component":
|
|
250
|
-
"data-padding":
|
|
251
|
-
"data-border-radius":
|
|
252
|
-
...
|
|
253
|
-
children: [
|
|
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, {
|
|
244
|
+
ref: t3,
|
|
245
|
+
className: t4,
|
|
246
|
+
"data-component": t5,
|
|
247
|
+
"data-padding": t6,
|
|
248
|
+
"data-border-radius": t7,
|
|
249
|
+
...t8,
|
|
250
|
+
children: [t9, t13, t14]
|
|
254
251
|
});
|
|
255
|
-
$[
|
|
256
|
-
$[
|
|
257
|
-
$[
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
$[
|
|
261
|
-
$[
|
|
262
|
-
$[
|
|
263
|
-
$[
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
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;
|
|
266
263
|
} else {
|
|
267
|
-
|
|
264
|
+
t15 = $[61];
|
|
268
265
|
}
|
|
269
|
-
return
|
|
266
|
+
return t15;
|
|
270
267
|
});
|
|
271
268
|
const CardIcon = t0 => {
|
|
272
269
|
const $ = c(10);
|
|
@@ -372,15 +369,12 @@ CardImage.displayName = 'Card.Image';
|
|
|
372
369
|
/**
|
|
373
370
|
* Heading shown at the top of a Card.
|
|
374
371
|
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
*
|
|
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.
|
|
372
|
+
* Only use this on a standalone Card (`as="section"`); don't use it inside
|
|
373
|
+
* an `<li>`, where the surrounding list already provides grouping.
|
|
374
|
+
*
|
|
375
|
+
* Give it an `id` and reference that id from the parent Card's
|
|
376
|
+
* `aria-labelledby` so the section landmark uses the heading as its
|
|
377
|
+
* accessible name.
|
|
384
378
|
*/
|
|
385
379
|
const CardHeading = /*#__PURE__*/forwardRef(function CardHeading(t0, ref) {
|
|
386
380
|
const $ = c(13);
|
|
@@ -484,18 +478,15 @@ const CardDescription = /*#__PURE__*/forwardRef(function CardDescription(t0, ref
|
|
|
484
478
|
});
|
|
485
479
|
|
|
486
480
|
/**
|
|
487
|
-
*
|
|
488
|
-
*
|
|
489
|
-
*
|
|
481
|
+
* Top-right slot for a single interactive control, usually an `IconButton`
|
|
482
|
+
* or `ActionMenu` trigger.
|
|
483
|
+
*
|
|
484
|
+
* Give the control a label that names the card (e.g. `"More options for
|
|
485
|
+
* Project Alpha"`, not just `"More options"`) so users can tell which card
|
|
486
|
+
* the action applies to when several cards are visible.
|
|
490
487
|
*
|
|
491
|
-
*
|
|
492
|
-
*
|
|
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.
|
|
488
|
+
* For more than one action, put them inside an `ActionMenu` rather than
|
|
489
|
+
* cramming multiple controls into `Card.Menu`.
|
|
499
490
|
*/
|
|
500
491
|
const CardMenu = t0 => {
|
|
501
492
|
const $ = c(2);
|
package/dist/Card/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CardProps, CardIconProps, CardImageProps, CardHeadingProps, CardDescriptionProps, CardMenuProps, CardMetadataProps } from './Card';
|
|
2
|
-
declare const Card: import("react").ForwardRefExoticComponent<CardProps & import("react").RefAttributes<
|
|
2
|
+
declare const Card: import("react").ForwardRefExoticComponent<CardProps & import("react").RefAttributes<HTMLElement>> & {
|
|
3
3
|
Icon: {
|
|
4
4
|
({ icon: IconComponent, "aria-label": ariaLabel, className }: CardIconProps): import("react").JSX.Element;
|
|
5
5
|
displayName: string;
|
package/package.json
CHANGED