@primer/react 0.0.0-20260519215202 → 0.0.0-20260520025254

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260519215202
3
+ ## 0.0.0-20260520025254
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -24,8 +24,6 @@
24
24
 
25
25
  - [#7776](https://github.com/primer/react/pull/7776) [`d6f61c1`](https://github.com/primer/react/commit/d6f61c1e197b52eb75cff97299bfac4caedcc1ac) Thanks [@llastflowers](https://github.com/llastflowers)! - Add `data-component` attributes for Blankslate, BranchName, Breadcrumbs, ButtonGroup, Checkbox, CheckboxGroup, CircleBadge, ConfirmationDialog, CounterLabel, and Dialog to provide stable selectors.
26
26
 
27
- - [#7852](https://github.com/primer/react/pull/7852) [`8966e0d`](https://github.com/primer/react/commit/8966e0dddd591fa83cc89b962ec1a6d8c0faa875) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Card: Add `data-component` attributes to `Card` and its subcomponents (`Icon`, `Image`, `Heading`, `Description`, `Metadata`, `Menu`). 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
-
29
27
  - [#7816](https://github.com/primer/react/pull/7816) [`aef8548`](https://github.com/primer/react/commit/aef85486a77a544ab36fcc18470dc06bf2502b09) Thanks [@iansan5653](https://github.com/iansan5653)! - Replace `ActionBar` overflow calculations with CSS wrapping approach to improve performance and stability
30
28
 
31
29
  - [#7831](https://github.com/primer/react/pull/7831) [`0de97c2`](https://github.com/primer/react/commit/0de97c25ae2adb026b04f7cac46463779ff023a1) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Dialog: Support custom width values.
@@ -0,0 +1,2 @@
1
+ .prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium{position:relative}.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:none;position:absolute;right:var(--base-size-8,.5rem);top:var(--base-size-8,.5rem)}@media screen and (max-width:calc(48rem - 0.02px)){.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:inline-grid}}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z{position-try-fallbacks:flip-block,flip-inline,flip-block flip-inline,--fit-block-bottom,--fit-block-top;position-visibility:anchors-visible;position:fixed!important;z-index:100}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[popover]{border:0;inset:auto;margin:0;max-width:none;padding:0}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-bottom]{left:anchor(left);top:calc(anchor(bottom) + var(--base-size-4,.25rem))}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-bottom][data-align=left]{left:auto;right:calc(anchor(right) - var(--anchored-overlay-anchor-offset-left))}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-top]{bottom:anchor(top);left:anchor(left);margin-bottom:var(--base-size-4,.25rem)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-top][data-align=left]{left:auto;right:anchor(right)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-left]{margin-right:var(--base-size-4,.25rem);right:anchor(left);top:var(--anchored-overlay-top-override,anchor(top));position-try-fallbacks:flip-inline,flip-block,flip-start,--outside-left-to-bottom}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-right]{left:anchor(right);margin-left:var(--base-size-4,.25rem);top:var(--anchored-overlay-top-override,anchor(top));position-try-fallbacks:flip-inline,flip-block,flip-start,--outside-right-to-bottom}@position-try --outside-left-to-bottom{margin:0;right:anchor(right);top:calc(anchor(bottom) + var(--base-size-4,.25rem));width:auto}@position-try --outside-right-to-bottom{left:anchor(left);margin:0;top:calc(anchor(bottom) + var(--base-size-4,.25rem));width:auto}@position-try --fit-block-bottom{bottom:var(--base-size-8,.5rem);height:auto;max-height:none;overflow-y:auto;top:calc(anchor(bottom) + var(--base-size-4,.25rem))}@position-try --fit-block-top{bottom:calc(100vh - anchor(top) + var(--base-size-4,.25rem));height:auto;max-height:none;overflow-y:auto;top:var(--base-size-8,.5rem)}
2
+ /*# sourceMappingURL=AnchoredOverlay-bdead7ea.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/AnchoredOverlay/AnchoredOverlay.module.css.js"],"names":[],"mappings":"AAAA,0DACE,iBACF,CAEA,iDAIE,YAAa,CAHb,iBAAkB,CAElB,8BAAyB,CADzB,4BAOF,CAHE,mDANF,iDAOI,mBAEJ,CADE,CAGF,2CACE,uGAKiB,CACjB,mCAAoC,CAEpC,wBAA0B,CAD1B,WAsDF,CAnDE,oDAIE,QAAS,CAHT,UAAW,CACX,QAAS,CAGT,cAAe,CAFf,SAGF,CAEA,qEAGE,iBAAkB,CADlB,oDAOF,CAJE,sFACE,SAAU,CACV,sEACF,CAGF,kEAEE,kBAAmB,CACnB,iBAAkB,CAFlB,uCAQF,CAJE,mFACE,SAAU,CACV,mBACF,CAGF,mEAWE,sCAAgC,CAVhC,kBAAmB,CASnB,oDAAsD,CAEtD,iFACF,CAEA,oEACE,kBAAmB,CAEnB,qCAA+B,CAD/B,oDAAsD,CAEtD,kFACF,CAGF,uCAGE,QAAS,CAFT,mBAAoB,CACpB,oDAA8C,CAE9C,UACF,CAEA,wCACE,iBAAkB,CAElB,QAAS,CADT,oDAA8C,CAE9C,UACF,CAEA,iCAEE,+BAA0B,CAC1B,WAAY,CACZ,eAAgB,CAChB,eAAgB,CAJhB,oDAKF,CAEA,8BAEE,4DAAsD,CACtD,WAAY,CACZ,eAAgB,CAChB,eAAgB,CAJhB,4BAKF","file":"AnchoredOverlay-bdead7ea.css","sourcesContent":[".ResponsiveCloseButtonContainer {\n position: relative;\n}\n\n.ResponsiveCloseButton {\n position: absolute;\n top: var(--base-size-8);\n right: var(--base-size-8);\n display: none;\n\n @media screen and (--viewportRange-narrow) {\n display: inline-grid;\n }\n}\n\n.AnchoredOverlay {\n position-try-fallbacks:\n flip-block,\n flip-inline,\n flip-block flip-inline,\n --fit-block-bottom,\n --fit-block-top;\n position-visibility: anchors-visible;\n z-index: 100;\n position: fixed !important;\n\n &[popover] {\n inset: auto;\n margin: 0;\n padding: 0;\n border: 0;\n max-width: none;\n }\n\n &[data-side='outside-bottom'] {\n /* stylelint-disable primer/spacing */\n top: calc(anchor(bottom) + var(--base-size-4));\n left: anchor(left);\n\n &[data-align='left'] {\n left: auto;\n right: calc(anchor(right) - var(--anchored-overlay-anchor-offset-left));\n }\n }\n\n &[data-side='outside-top'] {\n margin-bottom: var(--base-size-4);\n bottom: anchor(top);\n left: anchor(left);\n\n &[data-align='left'] {\n left: auto;\n right: anchor(right);\n }\n }\n\n &[data-side='outside-left'] {\n right: anchor(left);\n /* Falls back to `anchor(top)` when JS hasn't overridden it. JS sets the\n override when the overlay's bottom would overflow the viewport so we\n can lift it up to keep the bottom edge on screen, mirroring the JS\n anchored-positioning code path.\n\n This override only applies when CSS cannot find space using the default position -\n or any of its defined fallbacks.\n */\n top: var(--anchored-overlay-top-override, anchor(top));\n margin-right: var(--base-size-4);\n position-try-fallbacks: flip-inline, flip-block, flip-start, --outside-left-to-bottom;\n }\n\n &[data-side='outside-right'] {\n left: anchor(right);\n top: var(--anchored-overlay-top-override, anchor(top));\n margin-left: var(--base-size-4);\n position-try-fallbacks: flip-inline, flip-block, flip-start, --outside-right-to-bottom;\n }\n}\n\n@position-try --outside-left-to-bottom {\n right: anchor(right);\n top: calc(anchor(bottom) + var(--base-size-4));\n margin: 0;\n width: auto;\n}\n\n@position-try --outside-right-to-bottom {\n left: anchor(left);\n top: calc(anchor(bottom) + var(--base-size-4));\n margin: 0;\n width: auto;\n}\n\n@position-try --fit-block-bottom {\n top: calc(anchor(bottom) + var(--base-size-4));\n bottom: var(--base-size-8);\n height: auto;\n max-height: none;\n overflow-y: auto;\n}\n\n@position-try --fit-block-top {\n top: var(--base-size-8);\n bottom: calc(100vh - anchor(top) + var(--base-size-4));\n height: auto;\n max-height: none;\n overflow-y: auto;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import './AnchoredOverlay-ec9e15fc.css';
1
+ import './AnchoredOverlay-bdead7ea.css';
2
2
 
3
3
  var classes = {"ResponsiveCloseButtonContainer":"prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium","ResponsiveCloseButton":"prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx","AnchoredOverlay":"prc-AnchoredOverlay-AnchoredOverlay-fYg9Z"};
4
4
 
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
- type BaseCardProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> & {
2
+ export type CardProps = React.ComponentPropsWithoutRef<'div'> & {
3
3
  /**
4
- * Optional className for the root element.
4
+ * Provide an optional className to add to the outermost element rendered by
5
+ * the Card
5
6
  */
6
7
  className?: string;
7
8
  /**
@@ -14,35 +15,7 @@ type BaseCardProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> & {
14
15
  * @default 'large'
15
16
  */
16
17
  borderRadius?: 'medium' | 'large';
17
- /**
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.
21
- */
22
- children: React.ReactNode;
23
- };
24
- /**
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.
28
- */
29
- type DivCardProps = BaseCardProps & {
30
- as?: 'div';
31
18
  };
32
- /**
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`).
37
- */
38
- type SectionCardProps = BaseCardProps & {
39
- as: 'section';
40
- } & ({
41
- 'aria-label': string;
42
- } | {
43
- 'aria-labelledby': string;
44
- });
45
- export type CardProps = DivCardProps | SectionCardProps;
46
19
  type HeadingLevel = 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
47
20
  type HeadingProps = React.ComponentPropsWithoutRef<'h3'> & {
48
21
  /**
@@ -52,9 +25,6 @@ type HeadingProps = React.ComponentPropsWithoutRef<'h3'> & {
52
25
  children: React.ReactNode;
53
26
  };
54
27
  type DescriptionProps = React.ComponentPropsWithoutRef<'p'> & {
55
- /**
56
- * Card description. Rendered as a `<p>`, so keep it to flowing text.
57
- */
58
28
  children: React.ReactNode;
59
29
  };
60
30
  type IconProps = {
@@ -79,23 +49,28 @@ type ImageProps = React.ComponentPropsWithoutRef<'img'> & {
79
49
  alt?: string;
80
50
  };
81
51
  type MenuProps = {
82
- /**
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.
87
- */
88
52
  children: React.ReactNode;
89
53
  };
90
54
  type MetadataProps = React.ComponentPropsWithoutRef<'div'> & {
91
- /**
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.
95
- */
96
55
  children: React.ReactNode;
97
56
  };
98
- declare const CardImpl: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLElement>>;
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
+ /**
64
+ * Controls the internal padding of the Card.
65
+ * @default 'normal'
66
+ */
67
+ padding?: "none" | "condensed" | "normal";
68
+ /**
69
+ * Controls the border radius of the Card.
70
+ * @default 'large'
71
+ */
72
+ borderRadius?: "medium" | "large";
73
+ } & React.RefAttributes<HTMLDivElement>>;
99
74
  declare const CardIcon: {
100
75
  ({ icon: IconComponent, "aria-label": ariaLabel, className }: IconProps): React.JSX.Element;
101
76
  displayName: string;
@@ -104,16 +79,6 @@ declare const CardImage: {
104
79
  ({ src, alt, className, ...rest }: ImageProps): React.JSX.Element;
105
80
  displayName: string;
106
81
  };
107
- /**
108
- * Heading shown at the top of a Card.
109
- *
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.
116
- */
117
82
  declare const CardHeading: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & {
118
83
  /**
119
84
  * The heading level to render. Defaults to 'h3'.
@@ -122,32 +87,13 @@ declare const CardHeading: React.ForwardRefExoticComponent<Omit<React.DetailedHT
122
87
  children: React.ReactNode;
123
88
  } & React.RefAttributes<HTMLHeadingElement>>;
124
89
  declare const CardDescription: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & {
125
- /**
126
- * Card description. Rendered as a `<p>`, so keep it to flowing text.
127
- */
128
90
  children: React.ReactNode;
129
91
  } & React.RefAttributes<HTMLParagraphElement>>;
130
- /**
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.
137
- *
138
- * For more than one action, put them inside an `ActionMenu` rather than
139
- * cramming multiple controls into `Card.Menu`.
140
- */
141
92
  declare const CardMenu: {
142
93
  ({ children }: MenuProps): React.JSX.Element;
143
94
  displayName: string;
144
95
  };
145
96
  declare const CardMetadata: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
146
- /**
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.
150
- */
151
97
  children: React.ReactNode;
152
98
  } & React.RefAttributes<HTMLDivElement>>;
153
99
  export { CardImpl, CardIcon, CardImage, CardHeading, CardDescription, CardMenu, CardMetadata };
@@ -1 +1 @@
1
- {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../src/Card/Card.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAIvC,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,I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AC5F,YAAY,EAAC,YAAY,IAAI,gBAAgB,EAAC,CAAA;AAC9C,YAAY,EAAC,gBAAgB,IAAI,oBAAoB,EAAC,CAAA;AACtD,YAAY,EAAC,SAAS,IAAI,aAAa,EAAC,CAAA;AACxC,YAAY,EAAC,UAAU,IAAI,cAAc,EAAC,CAAA;AAC1C,YAAY,EAAC,SAAS,IAAI,aAAa,EAAC,CAAA;AACxC,YAAY,EAAC,aAAa,IAAI,iBAAiB,EAAC,CAAA"}
package/dist/Card/Card.js CHANGED
@@ -2,51 +2,42 @@ import { c } from 'react-compiler-runtime';
2
2
  import { clsx } from 'clsx';
3
3
  import React, { forwardRef } from 'react';
4
4
  import classes from './Card.module.css.js';
5
- import { warning } from '../utils/warning.js';
6
- import { jsx, jsxs } from 'react/jsx-runtime';
5
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
6
 
8
- const CardImpl = /*#__PURE__*/forwardRef(function Card(props, ref) {
9
- const $ = c(62);
7
+ const CardImpl = /*#__PURE__*/forwardRef(function Card(t0, ref) {
8
+ const $ = c(53);
10
9
  let children;
11
10
  let className;
12
11
  let rest;
13
- let t0;
14
12
  let t1;
15
13
  let t2;
16
- if ($[0] !== props) {
14
+ if ($[0] !== t0) {
17
15
  ({
18
16
  children,
19
17
  className,
20
- padding: t0,
21
- borderRadius: t1,
22
- as: t2,
18
+ padding: t1,
19
+ borderRadius: t2,
23
20
  ...rest
24
- } = props);
25
- $[0] = props;
21
+ } = t0);
22
+ $[0] = t0;
26
23
  $[1] = children;
27
24
  $[2] = className;
28
25
  $[3] = rest;
29
- $[4] = t0;
30
- $[5] = t1;
31
- $[6] = t2;
26
+ $[4] = t1;
27
+ $[5] = t2;
32
28
  } else {
33
29
  children = $[1];
34
30
  className = $[2];
35
31
  rest = $[3];
36
- t0 = $[4];
37
- t1 = $[5];
38
- t2 = $[6];
32
+ t1 = $[4];
33
+ t2 = $[5];
39
34
  }
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;
35
+ const padding = t1 === undefined ? "normal" : t1;
36
+ const borderRadius = t2 === undefined ? "large" : t2;
45
37
  let description;
46
38
  let heading;
47
39
  let menu;
48
40
  let metadata;
49
- let t10;
50
41
  let t3;
51
42
  let t4;
52
43
  let t5;
@@ -54,8 +45,8 @@ const CardImpl = /*#__PURE__*/forwardRef(function Card(props, ref) {
54
45
  let t7;
55
46
  let t8;
56
47
  let t9;
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");
48
+ if ($[6] !== borderRadius || $[7] !== children || $[8] !== className || $[9] !== padding || $[10] !== ref || $[11] !== rest) {
49
+ t9 = Symbol.for("react.early_return_sentinel");
59
50
  bb0: {
60
51
  let icon = null;
61
52
  let image = null;
@@ -93,177 +84,156 @@ const CardImpl = /*#__PURE__*/forwardRef(function Card(props, ref) {
93
84
  }
94
85
  }
95
86
  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
- }
103
87
  if (!hasSlotChildren) {
104
- let t11;
105
- if ($[29] !== className) {
106
- t11 = clsx(classes.Card, className);
107
- $[29] = className;
108
- $[30] = t11;
88
+ let t10;
89
+ if ($[23] !== className) {
90
+ t10 = clsx(classes.Card, className);
91
+ $[23] = className;
92
+ $[24] = t10;
109
93
  } else {
110
- t11 = $[30];
94
+ t10 = $[24];
111
95
  }
112
- let t12;
113
- if ($[31] !== Component || $[32] !== borderRadius || $[33] !== children || $[34] !== padding || $[35] !== ref || $[36] !== rest || $[37] !== t11) {
114
- t12 = /*#__PURE__*/jsx(Component, {
96
+ let t11;
97
+ if ($[25] !== borderRadius || $[26] !== children || $[27] !== padding || $[28] !== ref || $[29] !== rest || $[30] !== t10) {
98
+ t11 = /*#__PURE__*/jsx("div", {
115
99
  ref: ref,
116
- className: t11,
117
- "data-component": "Card",
100
+ className: t10,
118
101
  "data-padding": padding,
119
102
  "data-border-radius": borderRadius,
120
103
  ...rest,
121
104
  children: children
122
105
  });
123
- $[31] = Component;
124
- $[32] = borderRadius;
125
- $[33] = children;
126
- $[34] = padding;
127
- $[35] = ref;
128
- $[36] = rest;
129
- $[37] = t11;
130
- $[38] = t12;
106
+ $[25] = borderRadius;
107
+ $[26] = children;
108
+ $[27] = padding;
109
+ $[28] = ref;
110
+ $[29] = rest;
111
+ $[30] = t10;
112
+ $[31] = t11;
131
113
  } else {
132
- t12 = $[38];
114
+ t11 = $[31];
133
115
  }
134
- t10 = t12;
116
+ t9 = t11;
135
117
  break bb0;
136
118
  }
137
- T0 = Component;
138
119
  t3 = ref;
139
- if ($[39] !== className) {
120
+ if ($[32] !== className) {
140
121
  t4 = clsx(classes.Card, className);
141
- $[39] = className;
142
- $[40] = t4;
122
+ $[32] = className;
123
+ $[33] = t4;
143
124
  } else {
144
- t4 = $[40];
125
+ t4 = $[33];
145
126
  }
146
- t5 = "Card";
147
- t6 = padding;
148
- t7 = borderRadius;
149
- t8 = rest;
150
- t9 = (image || icon) && /*#__PURE__*/jsx("div", {
127
+ t5 = padding;
128
+ t6 = borderRadius;
129
+ t7 = rest;
130
+ t8 = (image || icon) && /*#__PURE__*/jsx("div", {
151
131
  className: clsx(classes.CardHeader, image && classes.CardHeaderEdgeToEdge),
152
132
  children: image || icon
153
133
  });
154
134
  }
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;
135
+ $[6] = borderRadius;
136
+ $[7] = children;
137
+ $[8] = className;
138
+ $[9] = padding;
139
+ $[10] = ref;
140
+ $[11] = rest;
141
+ $[12] = description;
142
+ $[13] = heading;
143
+ $[14] = menu;
144
+ $[15] = metadata;
145
+ $[16] = t3;
146
+ $[17] = t4;
147
+ $[18] = t5;
148
+ $[19] = t6;
149
+ $[20] = t7;
150
+ $[21] = t8;
151
+ $[22] = t9;
177
152
  } else {
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];
153
+ description = $[12];
154
+ heading = $[13];
155
+ menu = $[14];
156
+ metadata = $[15];
157
+ t3 = $[16];
158
+ t4 = $[17];
159
+ t5 = $[18];
160
+ t6 = $[19];
161
+ t7 = $[20];
162
+ t8 = $[21];
163
+ t9 = $[22];
191
164
  }
192
- if (t10 !== Symbol.for("react.early_return_sentinel")) {
193
- return t10;
165
+ if (t9 !== Symbol.for("react.early_return_sentinel")) {
166
+ return t9;
194
167
  }
195
- let t11;
196
- if ($[41] !== description || $[42] !== heading) {
197
- t11 = /*#__PURE__*/jsxs("div", {
168
+ let t10;
169
+ if ($[34] !== description || $[35] !== heading) {
170
+ t10 = /*#__PURE__*/jsxs("div", {
198
171
  className: classes.CardContent,
199
172
  children: [heading, description]
200
173
  });
201
- $[41] = description;
202
- $[42] = heading;
203
- $[43] = t11;
174
+ $[34] = description;
175
+ $[35] = heading;
176
+ $[36] = t10;
204
177
  } else {
205
- t11 = $[43];
178
+ t10 = $[36];
206
179
  }
207
- let t12;
208
- if ($[44] !== metadata) {
209
- t12 = metadata ? /*#__PURE__*/jsx("div", {
180
+ let t11;
181
+ if ($[37] !== metadata) {
182
+ t11 = metadata ? /*#__PURE__*/jsx("div", {
210
183
  className: classes.CardMetadataContainer,
211
184
  children: metadata
212
185
  }) : null;
213
- $[44] = metadata;
214
- $[45] = t12;
186
+ $[37] = metadata;
187
+ $[38] = t11;
215
188
  } else {
216
- t12 = $[45];
189
+ t11 = $[38];
217
190
  }
218
- let t13;
219
- if ($[46] !== t11 || $[47] !== t12) {
220
- t13 = /*#__PURE__*/jsxs("div", {
191
+ let t12;
192
+ if ($[39] !== t10 || $[40] !== t11) {
193
+ t12 = /*#__PURE__*/jsxs("div", {
221
194
  className: classes.CardBody,
222
- children: [t11, t12]
195
+ children: [t10, t11]
223
196
  });
224
- $[46] = t11;
225
- $[47] = t12;
226
- $[48] = t13;
197
+ $[39] = t10;
198
+ $[40] = t11;
199
+ $[41] = t12;
227
200
  } else {
228
- t13 = $[48];
201
+ t12 = $[41];
229
202
  }
230
- let t14;
231
- if ($[49] !== menu) {
232
- t14 = menu ? /*#__PURE__*/jsx("div", {
203
+ let t13;
204
+ if ($[42] !== menu) {
205
+ t13 = menu ? /*#__PURE__*/jsx("div", {
233
206
  className: classes.CardMenu,
234
207
  children: menu
235
208
  }) : null;
236
- $[49] = menu;
237
- $[50] = t14;
209
+ $[42] = menu;
210
+ $[43] = t13;
238
211
  } else {
239
- t14 = $[50];
212
+ t13 = $[43];
240
213
  }
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, {
214
+ let t14;
215
+ if ($[44] !== t12 || $[45] !== t13 || $[46] !== t3 || $[47] !== t4 || $[48] !== t5 || $[49] !== t6 || $[50] !== t7 || $[51] !== t8) {
216
+ t14 = /*#__PURE__*/jsxs("div", {
244
217
  ref: t3,
245
218
  className: t4,
246
- "data-component": t5,
247
- "data-padding": t6,
248
- "data-border-radius": t7,
249
- ...t8,
250
- children: [t9, t13, t14]
219
+ "data-padding": t5,
220
+ "data-border-radius": t6,
221
+ ...t7,
222
+ children: [t8, t12, t13]
251
223
  });
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;
224
+ $[44] = t12;
225
+ $[45] = t13;
226
+ $[46] = t3;
227
+ $[47] = t4;
228
+ $[48] = t5;
229
+ $[49] = t6;
230
+ $[50] = t7;
231
+ $[51] = t8;
232
+ $[52] = t14;
263
233
  } else {
264
- t15 = $[61];
234
+ t14 = $[52];
265
235
  }
266
- return t15;
236
+ return t14;
267
237
  });
268
238
  const CardIcon = t0 => {
269
239
  const $ = c(10);
@@ -294,7 +264,6 @@ const CardIcon = t0 => {
294
264
  if ($[4] !== ariaLabel || $[5] !== t1 || $[6] !== t2 || $[7] !== t3 || $[8] !== t4) {
295
265
  t5 = /*#__PURE__*/jsx("span", {
296
266
  className: t1,
297
- "data-component": "Card.Icon",
298
267
  role: t2,
299
268
  "aria-label": ariaLabel,
300
269
  "aria-hidden": t3,
@@ -351,7 +320,6 @@ const CardImage = t0 => {
351
320
  src: src,
352
321
  alt: alt,
353
322
  className: t2,
354
- "data-component": "Card.Image",
355
323
  ...rest
356
324
  });
357
325
  $[7] = alt;
@@ -365,17 +333,6 @@ const CardImage = t0 => {
365
333
  return t3;
366
334
  };
367
335
  CardImage.displayName = 'Card.Image';
368
-
369
- /**
370
- * Heading shown at the top of a Card.
371
- *
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.
378
- */
379
336
  const CardHeading = /*#__PURE__*/forwardRef(function CardHeading(t0, ref) {
380
337
  const $ = c(13);
381
338
  let children;
@@ -414,7 +371,6 @@ const CardHeading = /*#__PURE__*/forwardRef(function CardHeading(t0, ref) {
414
371
  t3 = /*#__PURE__*/jsx(Component, {
415
372
  ref: ref,
416
373
  className: t2,
417
- "data-component": "Card.Heading",
418
374
  ...rest,
419
375
  children: children
420
376
  });
@@ -462,7 +418,6 @@ const CardDescription = /*#__PURE__*/forwardRef(function CardDescription(t0, ref
462
418
  t2 = /*#__PURE__*/jsx("p", {
463
419
  ref: ref,
464
420
  className: t1,
465
- "data-component": "Card.Description",
466
421
  ...rest,
467
422
  children: children
468
423
  });
@@ -476,18 +431,6 @@ const CardDescription = /*#__PURE__*/forwardRef(function CardDescription(t0, ref
476
431
  }
477
432
  return t2;
478
433
  });
479
-
480
- /**
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
- *
488
- * For more than one action, put them inside an `ActionMenu` rather than
489
- * cramming multiple controls into `Card.Menu`.
490
- */
491
434
  const CardMenu = t0 => {
492
435
  const $ = c(2);
493
436
  const {
@@ -495,8 +438,7 @@ const CardMenu = t0 => {
495
438
  } = t0;
496
439
  let t1;
497
440
  if ($[0] !== children) {
498
- t1 = /*#__PURE__*/jsx("div", {
499
- "data-component": "Card.Menu",
441
+ t1 = /*#__PURE__*/jsx(Fragment, {
500
442
  children: children
501
443
  });
502
444
  $[0] = children;
@@ -540,7 +482,6 @@ const CardMetadata = /*#__PURE__*/forwardRef(function CardMetadata(t0, ref) {
540
482
  t2 = /*#__PURE__*/jsx("div", {
541
483
  ref: ref,
542
484
  className: t1,
543
- "data-component": "Card.Metadata",
544
485
  ...rest,
545
486
  children: children
546
487
  });
@@ -1,5 +1,9 @@
1
1
  import type { CardProps, CardIconProps, CardImageProps, CardHeadingProps, CardDescriptionProps, CardMenuProps, CardMetadataProps } from './Card';
2
- declare const Card: import("react").ForwardRefExoticComponent<CardProps & import("react").RefAttributes<HTMLElement>> & {
2
+ declare const Card: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
3
+ className?: string;
4
+ padding?: "none" | "condensed" | "normal";
5
+ borderRadius?: "medium" | "large";
6
+ } & import("react").RefAttributes<HTMLDivElement>> & {
3
7
  Icon: {
4
8
  ({ icon: IconComponent, "aria-label": ariaLabel, className }: CardIconProps): import("react").JSX.Element;
5
9
  displayName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Card/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EAClB,MAAM,QAAQ,CAAA;AAEf,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;CAOR,CAAA;AAEF,OAAO,EAAC,IAAI,EAAC,CAAA;AACb,YAAY,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,GAClB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Card/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EAClB,MAAM,QAAQ,CAAA;AAEf,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOR,CAAA;AAEF,OAAO,EAAC,IAAI,EAAC,CAAA;AACb,YAAY,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,GAClB,CAAA"}
@@ -2126,40 +2126,18 @@
2126
2126
  "stories": [
2127
2127
  {
2128
2128
  "id": "experimental-components-card--default",
2129
- "code": "() => {\n return (\n <Card>\n <Card.Icon icon={RocketIcon} />\n <Card.Heading>Card Heading</Card.Heading>\n <Card.Description>\n This is a description of the card providing supplemental information.\n </Card.Description>\n <Card.Metadata>\n <PeopleIcon size={16} />3 contributors\n </Card.Metadata>\n </Card>\n )\n}"
2129
+ "code": "() => {\n return (\n <div\n style={{\n maxWidth: '400px',\n }}\n >\n <Card>\n <Card.Icon icon={RocketIcon} />\n <Card.Heading>Card Heading</Card.Heading>\n <Card.Description>\n This is a description of the card providing supplemental information.\n </Card.Description>\n <Card.Metadata>Updated 2 hours ago</Card.Metadata>\n </Card>\n </div>\n )\n}"
2130
2130
  },
2131
2131
  {
2132
2132
  "id": "experimental-components-card-features--with-image",
2133
- "code": "() => {\n return (\n <Card>\n <Card.Image src=\"https://github.com/octocat.png\" alt=\"Octocat\" />\n <Card.Heading>Card with Image</Card.Heading>\n <Card.Description>\n This card uses an edge-to-edge image instead of an icon.\n </Card.Description>\n </Card>\n )\n}"
2133
+ "code": "() => {\n return (\n <div\n style={{\n maxWidth: '400px',\n }}\n >\n <Card>\n <Card.Image src=\"https://github.com/octocat.png\" alt=\"Octocat\" />\n <Card.Heading>Card with Image</Card.Heading>\n <Card.Description>\n This card uses an edge-to-edge image instead of an icon.\n </Card.Description>\n </Card>\n </div>\n )\n}"
2134
2134
  },
2135
2135
  {
2136
2136
  "id": "experimental-components-card-features--with-metadata",
2137
- "code": "() => {\n return (\n <Card>\n <Card.Icon icon={RepoIcon} />\n <Card.Heading>primer/react</Card.Heading>\n <Card.Description>\n {\n \"GitHub's design system implemented as React components for building consistent user interfaces.\"\n }\n </Card.Description>\n <Card.Metadata>\n <StarIcon size={16} />\n 1.2k stars\n </Card.Metadata>\n </Card>\n )\n}"
2138
- },
2139
- {
2140
- "id": "experimental-components-card-features--with-menu",
2141
- "code": "() => {\n return (\n <Card>\n <Card.Icon icon={RepoIcon} />\n <Card.Heading>primer/react</Card.Heading>\n <Card.Description>\n {\n \"GitHub's design system implemented as React components for building consistent user interfaces.\"\n }\n </Card.Description>\n <Card.Menu>\n <ActionMenu>\n <ActionMenu.Anchor>\n <IconButton\n icon={KebabHorizontalIcon}\n aria-label=\"More options for primer/react\"\n variant=\"invisible\"\n />\n </ActionMenu.Anchor>\n <ActionMenu.Overlay>\n <ActionList>\n <ActionList.Item>Star</ActionList.Item>\n <ActionList.Item>Watch</ActionList.Item>\n <ActionList.Item>Fork</ActionList.Item>\n </ActionList>\n </ActionMenu.Overlay>\n </ActionMenu>\n </Card.Menu>\n </Card>\n )\n}"
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}"
2137
+ "code": "() => {\n return (\n <div\n style={{\n maxWidth: '400px',\n }}\n >\n <Card>\n <Card.Icon icon={RepoIcon} />\n <Card.Heading>primer/react</Card.Heading>\n <Card.Description>\n {\n \"GitHub's design system implemented as React components for building consistent user interfaces.\"\n }\n </Card.Description>\n <Card.Metadata>\n <StarIcon size={16} />\n 1.2k stars\n </Card.Metadata>\n </Card>\n </div>\n )\n}"
2154
2138
  }
2155
2139
  ],
2156
2140
  "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
- },
2163
2141
  {
2164
2142
  "name": "className",
2165
2143
  "type": "string",
@@ -2176,12 +2154,6 @@
2176
2154
  "type": "'medium' | 'large'",
2177
2155
  "defaultValue": "'large'",
2178
2156
  "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."
2185
2157
  }
2186
2158
  ],
2187
2159
  "subcomponents": [
@@ -2223,42 +2195,21 @@
2223
2195
  "name": "as",
2224
2196
  "type": "'h2' | 'h3' | 'h4' | 'h5' | 'h6'",
2225
2197
  "defaultValue": "'h3'",
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."
2198
+ "description": "The heading level to render."
2227
2199
  }
2228
2200
  ]
2229
2201
  },
2230
2202
  {
2231
2203
  "name": "Card.Description",
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
- ]
2204
+ "props": []
2240
2205
  },
2241
2206
  {
2242
2207
  "name": "Card.Menu",
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
- ]
2208
+ "props": []
2251
2209
  },
2252
2210
  {
2253
2211
  "name": "Card.Metadata",
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
- ]
2212
+ "props": []
2262
2213
  }
2263
2214
  ]
2264
2215
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260519215202",
4
+ "version": "0.0.0-20260520025254",
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",
@@ -1,2 +0,0 @@
1
- .prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium{position:relative}.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:none;position:absolute;right:var(--base-size-8,.5rem);top:var(--base-size-8,.5rem)}@media screen and (max-width:calc(48rem - 0.02px)){.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:inline-grid}}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z{position-try-fallbacks:flip-block,flip-inline,flip-block flip-inline;position-visibility:anchors-visible;position:fixed!important;z-index:100}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[popover]{border:0;inset:auto;margin:0;max-width:none;padding:0}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-bottom]{left:anchor(left);top:calc(anchor(bottom) + var(--base-size-4,.25rem))}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-bottom][data-align=left]{left:auto;right:calc(anchor(right) - var(--anchored-overlay-anchor-offset-left))}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-top]{bottom:anchor(top);left:anchor(left);margin-bottom:var(--base-size-4,.25rem)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-top][data-align=left]{left:auto;right:anchor(right)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-left]{margin-right:var(--base-size-4,.25rem);right:anchor(left);top:var(--anchored-overlay-top-override,anchor(top));position-try-fallbacks:flip-inline,flip-block,flip-start,--outside-left-to-bottom}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-right]{left:anchor(right);margin-left:var(--base-size-4,.25rem);top:var(--anchored-overlay-top-override,anchor(top));position-try-fallbacks:flip-inline,flip-block,flip-start,--outside-right-to-bottom}@position-try --outside-left-to-bottom{margin:0;right:anchor(right);top:calc(anchor(bottom) + var(--base-size-4,.25rem));width:auto}@position-try --outside-right-to-bottom{left:anchor(left);margin:0;top:calc(anchor(bottom) + var(--base-size-4,.25rem));width:auto}
2
- /*# sourceMappingURL=AnchoredOverlay-ec9e15fc.css.map */
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/AnchoredOverlay/AnchoredOverlay.module.css.js"],"names":[],"mappings":"AAAA,0DACE,iBACF,CAEA,iDAIE,YAAa,CAHb,iBAAkB,CAElB,8BAAyB,CADzB,4BAOF,CAHE,mDANF,iDAOI,mBAEJ,CADE,CAGF,2CACE,oEAGwB,CACxB,mCAAoC,CAEpC,wBAA0B,CAD1B,WAsDF,CAnDE,oDAIE,QAAS,CAHT,UAAW,CACX,QAAS,CAGT,cAAe,CAFf,SAGF,CAEA,qEAGE,iBAAkB,CADlB,oDAOF,CAJE,sFACE,SAAU,CACV,sEACF,CAGF,kEAEE,kBAAmB,CACnB,iBAAkB,CAFlB,uCAQF,CAJE,mFACE,SAAU,CACV,mBACF,CAGF,mEAWE,sCAAgC,CAVhC,kBAAmB,CASnB,oDAAsD,CAEtD,iFACF,CAEA,oEACE,kBAAmB,CAEnB,qCAA+B,CAD/B,oDAAsD,CAEtD,kFACF,CAGF,uCAGE,QAAS,CAFT,mBAAoB,CACpB,oDAA8C,CAE9C,UACF,CAEA,wCACE,iBAAkB,CAElB,QAAS,CADT,oDAA8C,CAE9C,UACF","file":"AnchoredOverlay-ec9e15fc.css","sourcesContent":[".ResponsiveCloseButtonContainer {\n position: relative;\n}\n\n.ResponsiveCloseButton {\n position: absolute;\n top: var(--base-size-8);\n right: var(--base-size-8);\n display: none;\n\n @media screen and (--viewportRange-narrow) {\n display: inline-grid;\n }\n}\n\n.AnchoredOverlay {\n position-try-fallbacks:\n flip-block,\n flip-inline,\n flip-block flip-inline;\n position-visibility: anchors-visible;\n z-index: 100;\n position: fixed !important;\n\n &[popover] {\n inset: auto;\n margin: 0;\n padding: 0;\n border: 0;\n max-width: none;\n }\n\n &[data-side='outside-bottom'] {\n /* stylelint-disable primer/spacing */\n top: calc(anchor(bottom) + var(--base-size-4));\n left: anchor(left);\n\n &[data-align='left'] {\n left: auto;\n right: calc(anchor(right) - var(--anchored-overlay-anchor-offset-left));\n }\n }\n\n &[data-side='outside-top'] {\n margin-bottom: var(--base-size-4);\n bottom: anchor(top);\n left: anchor(left);\n\n &[data-align='left'] {\n left: auto;\n right: anchor(right);\n }\n }\n\n &[data-side='outside-left'] {\n right: anchor(left);\n /* Falls back to `anchor(top)` when JS hasn't overridden it. JS sets the\n override when the overlay's bottom would overflow the viewport so we\n can lift it up to keep the bottom edge on screen, mirroring the JS\n anchored-positioning code path.\n\n This override only applies when CSS cannot find space using the default position -\n or any of its defined fallbacks.\n */\n top: var(--anchored-overlay-top-override, anchor(top));\n margin-right: var(--base-size-4);\n position-try-fallbacks: flip-inline, flip-block, flip-start, --outside-left-to-bottom;\n }\n\n &[data-side='outside-right'] {\n left: anchor(right);\n top: var(--anchored-overlay-top-override, anchor(top));\n margin-left: var(--base-size-4);\n position-try-fallbacks: flip-inline, flip-block, flip-start, --outside-right-to-bottom;\n }\n}\n\n@position-try --outside-left-to-bottom {\n right: anchor(right);\n top: calc(anchor(bottom) + var(--base-size-4));\n margin: 0;\n width: auto;\n}\n\n@position-try --outside-right-to-bottom {\n left: anchor(left);\n top: calc(anchor(bottom) + var(--base-size-4));\n margin: 0;\n width: auto;\n}\n"]}