@primer/react 0.0.0-20260519214009 → 0.0.0-20260519215202
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/dist/Card/Card.d.ts +37 -56
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/Card.js +14 -20
- 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,20 +80,18 @@ 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
|
};
|
|
@@ -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":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAIvC,KAAK,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IAC7E;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;IAEzC;;;OAGG;IACH,YAAY,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;IAEjC;;;;OAIG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAA;AAED;;;;GAIG;AACH,KAAK,YAAY,GAAG,aAAa,GAAG;IAClC,EAAE,CAAC,EAAE,KAAK,CAAA;CACX,CAAA;AAED;;;;;GAKG;AACH,KAAK,gBAAgB,GAAG,aAAa,GAAG;IACtC,EAAE,EAAE,SAAS,CAAA;CACd,GAAG,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAC,GAAG;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAC,CAAC,CAAA;AAE1D,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,gBAAgB,CAAA;AAEvD,KAAK,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAEpD,KAAK,YAAY,GAAG,KAAK,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAA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AA,MAAM,YAAY;IA7KhB;;;;OAIG;cACO,KAAK,CAAC,SAAS;wCAiLzB,CAAA;AAEF,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAC,CAAA;AAC5F,YAAY,EAAC,YAAY,IAAI,gBAAgB,EAAC,CAAA;AAC9C,YAAY,EAAC,gBAAgB,IAAI,oBAAoB,EAAC,CAAA;AACtD,YAAY,EAAC,SAAS,IAAI,aAAa,EAAC,CAAA;AACxC,YAAY,EAAC,UAAU,IAAI,cAAc,EAAC,CAAA;AAC1C,YAAY,EAAC,SAAS,IAAI,aAAa,EAAC,CAAA;AACxC,YAAY,EAAC,aAAa,IAAI,iBAAiB,EAAC,CAAA"}
|
package/dist/Card/Card.js
CHANGED
|
@@ -369,15 +369,12 @@ CardImage.displayName = 'Card.Image';
|
|
|
369
369
|
/**
|
|
370
370
|
* Heading shown at the top of a Card.
|
|
371
371
|
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
* - Pair with `aria-labelledby` on the parent `Card` (referencing the
|
|
379
|
-
* heading's `id`) so the section landmark uses the visible heading as
|
|
380
|
-
* its accessible name.
|
|
372
|
+
* Only use this on a standalone Card (`as="section"`); don't use it inside
|
|
373
|
+
* an `<li>`, where the surrounding list already provides grouping.
|
|
374
|
+
*
|
|
375
|
+
* Give it an `id` and reference that id from the parent Card's
|
|
376
|
+
* `aria-labelledby` so the section landmark uses the heading as its
|
|
377
|
+
* accessible name.
|
|
381
378
|
*/
|
|
382
379
|
const CardHeading = /*#__PURE__*/forwardRef(function CardHeading(t0, ref) {
|
|
383
380
|
const $ = c(13);
|
|
@@ -481,18 +478,15 @@ const CardDescription = /*#__PURE__*/forwardRef(function CardDescription(t0, ref
|
|
|
481
478
|
});
|
|
482
479
|
|
|
483
480
|
/**
|
|
484
|
-
*
|
|
485
|
-
*
|
|
486
|
-
*
|
|
481
|
+
* Top-right slot for a single interactive control, usually an `IconButton`
|
|
482
|
+
* or `ActionMenu` trigger.
|
|
483
|
+
*
|
|
484
|
+
* Give the control a label that names the card (e.g. `"More options for
|
|
485
|
+
* Project Alpha"`, not just `"More options"`) so users can tell which card
|
|
486
|
+
* the action applies to when several cards are visible.
|
|
487
487
|
*
|
|
488
|
-
*
|
|
489
|
-
*
|
|
490
|
-
* distinguish it from triggers in other cards (for example,
|
|
491
|
-
* `"More options for Project Alpha"` rather than just `"More options"`),
|
|
492
|
-
* because lists of cards often share identical control labels.
|
|
493
|
-
* - Avoid placing multiple interactive controls inside `Card.Menu`.
|
|
494
|
-
* If a card needs multiple actions, expose them inside an `ActionMenu`
|
|
495
|
-
* overlay so they remain reachable in a predictable focus order.
|
|
488
|
+
* For more than one action, put them inside an `ActionMenu` rather than
|
|
489
|
+
* cramming multiple controls into `Card.Menu`.
|
|
496
490
|
*/
|
|
497
491
|
const CardMenu = t0 => {
|
|
498
492
|
const $ = c(2);
|
package/package.json
CHANGED