@primer/react 0.0.0-20260520211038 → 0.0.0-20260521135517

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,16 +1,6 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260520211038
4
-
5
- ### Minor Changes
6
-
7
- - [#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.
8
-
9
- ### Patch Changes
10
-
11
- - Fake entry to force publishing
12
-
13
- ## 38.24.0
3
+ ## 0.0.0-20260521135517
14
4
 
15
5
  ### Minor Changes
16
6
 
@@ -44,6 +34,8 @@
44
34
 
45
35
  - [#7842](https://github.com/primer/react/pull/7842) [`635357e`](https://github.com/primer/react/commit/635357e7d2963bb594718a754fb7f53c1f917c41) Thanks [@joshblack](https://github.com/joshblack)! - DataTable: Treat zero as a populated value when sorting numeric columns
46
36
 
37
+ - Fake entry to force publishing
38
+
47
39
  - [#7824](https://github.com/primer/react/pull/7824) [`6889235`](https://github.com/primer/react/commit/6889235fac93f17cfd0354758f4f9a1e6ff01942) Thanks [@jonrohan](https://github.com/jonrohan)! - Fix `usePaneWidth` triggering unnecessary React re-renders on every window resize
48
40
 
49
41
  - [#7833](https://github.com/primer/react/pull/7833) [`dfed7ca`](https://github.com/primer/react/commit/dfed7ca73532922ec0526dd85afcf7ae471c566e) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Timeline: Remove border override from TimelineBadge when variant is set
@@ -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,--inline-end-center,--inline-start-center,--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-bottom][data-align=right]{left:calc(anchor(left) - var(--anchored-overlay-anchor-offset-right))}.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-top][data-align=right]{left:calc(anchor(left) - var(--anchored-overlay-anchor-offset-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}@media screen and (max-width:calc(48rem - 0.02px)){.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-responsive=fullscreen]{--anchored-overlay-anchor-offset-left:0;--anchored-overlay-anchor-offset-right:0}}@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 --inline-end-center{align-self:anchor-center;bottom:auto;left:anchor(right);margin-left:var(--base-size-4,.25rem);top:auto}@position-try --inline-start-center{align-self:anchor-center;bottom:auto;left:auto;margin-right:var(--base-size-4,.25rem);right:anchor(left);top: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-d418ad31.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,iJAOiB,CACjB,mCAAoC,CAEpC,wBAA0B,CAD1B,WAqEF,CAlEE,oDAIE,QAAS,CAHT,UAAW,CACX,QAAS,CAGT,cAAe,CAFf,SAGF,CAEA,qEAGE,iBAAkB,CADlB,oDAWF,CARE,sFACE,SAAU,CACV,sEACF,CAEA,uFACE,qEACF,CAGF,kEAEE,kBAAmB,CACnB,iBAAkB,CAFlB,uCAYF,CARE,mFACE,SAAU,CACV,mBACF,CAEA,oFACE,qEACF,CAGF,mEAWE,sCAAgC,CAVhC,kBAAmB,CASnB,oDAAsD,CAEtD,iFACF,CAEA,oEACE,kBAAmB,CAEnB,qCAA+B,CAD/B,oDAAsD,CAEtD,kFACF,CAGE,mDADF,uEAEI,uCAAwC,CACxC,wCAEJ,CADE,CAIJ,uCAGE,QAAS,CAFT,mBAAoB,CACpB,oDAA8C,CAE9C,UACF,CAEA,wCACE,iBAAkB,CAElB,QAAS,CADT,oDAA8C,CAE9C,UACF,CAEA,kCAKE,wBAAyB,CAFzB,WAAY,CAFZ,kBAAmB,CAGnB,qCAA+B,CAF/B,QAIF,CAEA,oCAME,wBAAyB,CAFzB,WAAY,CAFZ,SAAU,CAGV,sCAAgC,CAJhC,kBAAmB,CAEnB,QAIF,CAEA,iCAEE,+BAA0B,CAC1B,WAAY,CACZ,eAAgB,CAChB,eAAgB,CAJhB,oDAKF,CAEA,8BAEE,4DAAsD,CACtD,WAAY,CACZ,eAAgB,CAChB,eAAgB,CAJhB,4BAKF","file":"AnchoredOverlay-d418ad31.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 --inline-end-center,\n --inline-start-center,\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 &[data-align='right'] {\n left: calc(anchor(left) - var(--anchored-overlay-anchor-offset-right));\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 &[data-align='right'] {\n left: calc(anchor(left) - var(--anchored-overlay-anchor-offset-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 &[data-responsive='fullscreen'] {\n @media screen and (--viewportRange-narrow) {\n --anchored-overlay-anchor-offset-left: 0;\n --anchored-overlay-anchor-offset-right: 0;\n }\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 --inline-end-center {\n left: anchor(right);\n top: auto;\n bottom: auto;\n margin-left: var(--base-size-4);\n align-self: anchor-center;\n}\n\n@position-try --inline-start-center {\n right: anchor(left);\n left: auto;\n top: auto;\n bottom: auto;\n margin-right: var(--base-size-4);\n align-self: anchor-center;\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-d418ad31.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,19 +1,21 @@
1
1
  import React from 'react';
2
- import { type PolymorphicProps } from '../utils/modern-polymorphic';
3
- type CardAs = 'div' | 'section';
4
- export type CardProps<As extends CardAs = 'div'> = PolymorphicProps<As, 'div', {
5
- /** Optional className for the root element. */
2
+ export type CardProps = React.ComponentPropsWithoutRef<'div'> & {
3
+ /**
4
+ * Provide an optional className to add to the outermost element rendered by
5
+ * the Card
6
+ */
6
7
  className?: string;
7
- /** Internal padding. @default 'normal' */
8
+ /**
9
+ * Controls the internal padding of the Card.
10
+ * @default 'normal'
11
+ */
8
12
  padding?: 'none' | 'condensed' | 'normal';
9
- /** Border radius. @default 'large' */
10
- borderRadius?: 'medium' | 'large';
11
13
  /**
12
- * Card contents. Provide either `Card.*` subcomponents (e.g. `Card.Heading`,
13
- * `Card.Description`, `Card.Metadata`) or custom content. Empty cards do not render.
14
+ * Controls the border radius of the Card.
15
+ * @default 'large'
14
16
  */
15
- children: React.ReactNode;
16
- }>;
17
+ borderRadius?: 'medium' | 'large';
18
+ };
17
19
  type HeadingLevel = 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
18
20
  type HeadingProps = React.ComponentPropsWithoutRef<'h3'> & {
19
21
  /**
@@ -23,9 +25,6 @@ type HeadingProps = React.ComponentPropsWithoutRef<'h3'> & {
23
25
  children: React.ReactNode;
24
26
  };
25
27
  type DescriptionProps = React.ComponentPropsWithoutRef<'p'> & {
26
- /**
27
- * Card description. Rendered as a `<p>`, so keep it to flowing text.
28
- */
29
28
  children: React.ReactNode;
30
29
  };
31
30
  type IconProps = {
@@ -50,57 +49,36 @@ type ImageProps = React.ComponentPropsWithoutRef<'img'> & {
50
49
  alt?: string;
51
50
  };
52
51
  type MenuProps = {
53
- /** Interactive control for the top-right corner of the card. */
54
52
  children: React.ReactNode;
55
53
  };
56
54
  type MetadataProps = React.ComponentPropsWithoutRef<'div'> & {
57
- /**
58
- * Metadata row at the bottom of the card. Any content works: text, icons,
59
- * a `Label`, an `Octicon`.
60
- */
61
55
  children: React.ReactNode;
62
56
  };
63
- declare const CardImpl: <As extends CardAs>(props: (React.ComponentPropsWithRef<React.ElementType extends As ? "div" : As> & {
64
- /** Optional className for the root element. */
65
- className?: string;
66
- /** Internal padding. @default 'normal' */
67
- padding?: "none" | "condensed" | "normal";
68
- /** Border radius. @default 'large' */
69
- borderRadius?: "medium" | "large";
57
+ declare const CardImpl: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
70
58
  /**
71
- * Card contents. Provide either `Card.*` subcomponents (e.g. `Card.Heading`,
72
- * `Card.Description`, `Card.Metadata`) or custom content. Empty cards do not render.
59
+ * Provide an optional className to add to the outermost element rendered by
60
+ * the Card
73
61
  */
74
- children: React.ReactNode;
75
- } extends infer T ? T extends React.ComponentPropsWithRef<React.ElementType extends As ? "div" : As> & {
76
- /** Optional className for the root element. */
77
62
  className?: string;
78
- /** Internal padding. @default 'normal' */
63
+ /**
64
+ * Controls the internal padding of the Card.
65
+ * @default 'normal'
66
+ */
79
67
  padding?: "none" | "condensed" | "normal";
80
- /** Border radius. @default 'large' */
81
- borderRadius?: "medium" | "large";
82
68
  /**
83
- * Card contents. Provide either `Card.*` subcomponents (e.g. `Card.Heading`,
84
- * `Card.Description`, `Card.Metadata`) or custom content. Empty cards do not render.
69
+ * Controls the border radius of the Card.
70
+ * @default 'large'
85
71
  */
86
- children: React.ReactNode;
87
- } ? T extends unknown ? Omit<T, "as"> : never : never : never) & {
88
- as?: As | undefined;
89
- } & React.RefAttributes<any>) => React.ReactNode;
90
- declare function CardIcon({ icon: IconComponent, 'aria-label': ariaLabel, className }: IconProps): React.JSX.Element;
91
- declare namespace CardIcon {
92
- var displayName: string;
93
- }
94
- declare function CardImage({ src, alt, className, ...rest }: ImageProps): React.JSX.Element;
95
- declare namespace CardImage {
96
- var displayName: string;
97
- }
98
- /**
99
- * Heading shown at the top of a Card.
100
- *
101
- * When the parent Card uses `as="section"`, the heading's `id` is
102
- * automatically wired to the section's `aria-labelledby`.
103
- */
72
+ borderRadius?: "medium" | "large";
73
+ } & React.RefAttributes<HTMLDivElement>>;
74
+ declare const CardIcon: {
75
+ ({ icon: IconComponent, "aria-label": ariaLabel, className }: IconProps): React.JSX.Element;
76
+ displayName: string;
77
+ };
78
+ declare const CardImage: {
79
+ ({ src, alt, className, ...rest }: ImageProps): React.JSX.Element;
80
+ displayName: string;
81
+ };
104
82
  declare const CardHeading: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & {
105
83
  /**
106
84
  * The heading level to render. Defaults to 'h3'.
@@ -109,27 +87,13 @@ declare const CardHeading: React.ForwardRefExoticComponent<Omit<React.DetailedHT
109
87
  children: React.ReactNode;
110
88
  } & React.RefAttributes<HTMLHeadingElement>>;
111
89
  declare const CardDescription: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & {
112
- /**
113
- * Card description. Rendered as a `<p>`, so keep it to flowing text.
114
- */
115
90
  children: React.ReactNode;
116
91
  } & React.RefAttributes<HTMLParagraphElement>>;
117
- /**
118
- * Top-right slot for a single interactive control.
119
- *
120
- * Give the control a label that names the card (e.g. `"More options for
121
- * Project Alpha"`, not just `"More options"`) so users can tell which card
122
- * the action applies to when several cards are visible.
123
- */
124
- declare function CardMenu({ children }: MenuProps): React.JSX.Element;
125
- declare namespace CardMenu {
126
- var displayName: string;
127
- }
92
+ declare const CardMenu: {
93
+ ({ children }: MenuProps): React.JSX.Element;
94
+ displayName: string;
95
+ };
128
96
  declare const CardMetadata: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
129
- /**
130
- * Metadata row at the bottom of the card. Any content works: text, icons,
131
- * a `Label`, an `Octicon`.
132
- */
133
97
  children: React.ReactNode;
134
98
  } & React.RefAttributes<HTMLDivElement>>;
135
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,KAAiE,MAAM,OAAO,CAAA;AAGrF,OAAO,EAAkB,KAAK,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAMlF,KAAK,MAAM,GAAG,KAAK,GAAG,SAAS,CAAA;AAE/B,MAAM,MAAM,SAAS,CAAC,EAAE,SAAS,MAAM,GAAG,KAAK,IAAI,gBAAgB,CACjE,EAAE,EACF,KAAK,EACL;IACE,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;IAEzC,sCAAsC;IACtC,YAAY,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;IAEjC;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CACF,CAAA;AAED,KAAK,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAEpD,KAAK,YAAY,GAAG,KAAK,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG;IACzD;;OAEG;IACH,EAAE,CAAC,EA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,QAAA,MAAM,QAAQ;kEAA+D,SAAS;;CAWrF,CAAA;AAID,QAAA,MAAM,SAAS;uCAAyC,UAAU;;CAEjE,CAAA;AAID,QAAA,MAAM,WAAW;IArIf;;OAEG;SACE,YAAY;cACP,KAAK,CAAC,SAAS;4CA0IzB,CAAA;AAEF,QAAA,MAAM,eAAe;cAxIT,KAAK,CAAC,SAAS;8CAiJzB,CAAA;AAEF,QAAA,MAAM,QAAQ;mBAAgB,SAAS;;CAEtC,CAAA;AAID,QAAA,MAAM,YAAY;cA1HN,KAAK,CAAC,SAAS;wCAmIzB,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
@@ -1,40 +1,43 @@
1
1
  import { c } from 'react-compiler-runtime';
2
2
  import { clsx } from 'clsx';
3
- import React, { forwardRef, useContext, createContext } from 'react';
3
+ import React, { forwardRef } from 'react';
4
4
  import classes from './Card.module.css.js';
5
- import { warning } from '../utils/warning.js';
6
- import { fixedForwardRef } from '../utils/modern-polymorphic.js';
7
- import { useId } from '../hooks/useId.js';
8
- import { jsx, jsxs } from 'react/jsx-runtime';
5
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
6
 
10
- const CardContext = /*#__PURE__*/createContext({});
11
- function CardComponent(props, ref) {
12
- const $ = c(67);
13
- const {
14
- children,
15
- className,
16
- padding: t0,
17
- borderRadius: t1,
18
- as: t2,
19
- ...rest
20
- } = props;
21
- const padding = t0 === undefined ? "normal" : t0;
22
- const borderRadius = t1 === undefined ? "large" : t1;
23
- const as = t2 === undefined ? "div" : t2;
24
- const Component = as;
25
- const generatedId = useId();
26
- const titleId = as === "section" ? generatedId : undefined;
27
- if (as === "section" && !("aria-label" in props) && !("aria-labelledby" in props)) {
28
- rest["aria-labelledby"] = titleId;
7
+ const CardImpl = /*#__PURE__*/forwardRef(function Card(t0, ref) {
8
+ const $ = c(53);
9
+ let children;
10
+ let className;
11
+ let rest;
12
+ let t1;
13
+ let t2;
14
+ if ($[0] !== t0) {
15
+ ({
16
+ children,
17
+ className,
18
+ padding: t1,
19
+ borderRadius: t2,
20
+ ...rest
21
+ } = t0);
22
+ $[0] = t0;
23
+ $[1] = children;
24
+ $[2] = className;
25
+ $[3] = rest;
26
+ $[4] = t1;
27
+ $[5] = t2;
28
+ } else {
29
+ children = $[1];
30
+ className = $[2];
31
+ rest = $[3];
32
+ t1 = $[4];
33
+ t2 = $[5];
29
34
  }
30
- let T0;
31
- let T1;
35
+ const padding = t1 === undefined ? "normal" : t1;
36
+ const borderRadius = t2 === undefined ? "large" : t2;
32
37
  let description;
33
38
  let heading;
34
39
  let menu;
35
40
  let metadata;
36
- let t10;
37
- let t11;
38
41
  let t3;
39
42
  let t4;
40
43
  let t5;
@@ -42,8 +45,8 @@ function CardComponent(props, ref) {
42
45
  let t7;
43
46
  let t8;
44
47
  let t9;
45
- if ($[0] !== Component || $[1] !== borderRadius || $[2] !== children || $[3] !== className || $[4] !== padding || $[5] !== ref || $[6] !== rest || $[7] !== titleId) {
46
- t11 = 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");
47
50
  bb0: {
48
51
  let icon = null;
49
52
  let image = null;
@@ -81,112 +84,64 @@ function CardComponent(props, ref) {
81
84
  }
82
85
  }
83
86
  const hasSlotChildren = icon || image || heading || description || metadata || menu;
84
- const isEmpty = !hasSlotChildren && childArray.length === 0;
85
- 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;
86
- if (isEmpty) {
87
- t11 = null;
88
- break bb0;
89
- }
90
87
  if (!hasSlotChildren) {
91
- let t12;
92
- if ($[23] !== titleId) {
93
- t12 = {
94
- titleId
95
- };
96
- $[23] = titleId;
97
- $[24] = t12;
88
+ let t10;
89
+ if ($[23] !== className) {
90
+ t10 = clsx(classes.Card, className);
91
+ $[23] = className;
92
+ $[24] = t10;
98
93
  } else {
99
- t12 = $[24];
94
+ t10 = $[24];
100
95
  }
101
- let t13;
102
- if ($[25] !== className) {
103
- t13 = clsx(classes.Card, className);
104
- $[25] = className;
105
- $[26] = t13;
106
- } else {
107
- t13 = $[26];
108
- }
109
- let t14;
110
- if ($[27] !== Component || $[28] !== borderRadius || $[29] !== children || $[30] !== padding || $[31] !== ref || $[32] !== rest || $[33] !== t13) {
111
- t14 = /*#__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", {
112
99
  ref: ref,
113
- className: t13,
114
- "data-component": "Card",
100
+ className: t10,
115
101
  "data-padding": padding,
116
102
  "data-border-radius": borderRadius,
117
103
  ...rest,
118
104
  children: children
119
105
  });
120
- $[27] = Component;
121
- $[28] = borderRadius;
122
- $[29] = children;
123
- $[30] = padding;
124
- $[31] = ref;
125
- $[32] = rest;
126
- $[33] = t13;
127
- $[34] = t14;
106
+ $[25] = borderRadius;
107
+ $[26] = children;
108
+ $[27] = padding;
109
+ $[28] = ref;
110
+ $[29] = rest;
111
+ $[30] = t10;
112
+ $[31] = t11;
128
113
  } else {
129
- t14 = $[34];
114
+ t11 = $[31];
130
115
  }
131
- let t15;
132
- if ($[35] !== t12 || $[36] !== t14) {
133
- t15 = /*#__PURE__*/jsx(CardContext.Provider, {
134
- value: t12,
135
- children: t14
136
- });
137
- $[35] = t12;
138
- $[36] = t14;
139
- $[37] = t15;
140
- } else {
141
- t15 = $[37];
142
- }
143
- t11 = t15;
116
+ t9 = t11;
144
117
  break bb0;
145
118
  }
146
- T1 = CardContext.Provider;
147
- if ($[38] !== titleId) {
148
- t10 = {
149
- titleId
150
- };
151
- $[38] = titleId;
152
- $[39] = t10;
153
- } else {
154
- t10 = $[39];
155
- }
156
- T0 = Component;
157
119
  t3 = ref;
158
- if ($[40] !== className) {
120
+ if ($[32] !== className) {
159
121
  t4 = clsx(classes.Card, className);
160
- $[40] = className;
161
- $[41] = t4;
122
+ $[32] = className;
123
+ $[33] = t4;
162
124
  } else {
163
- t4 = $[41];
125
+ t4 = $[33];
164
126
  }
165
- t5 = "Card";
166
- t6 = padding;
167
- t7 = borderRadius;
168
- t8 = rest;
169
- t9 = (image || icon) && /*#__PURE__*/jsx("div", {
127
+ t5 = padding;
128
+ t6 = borderRadius;
129
+ t7 = rest;
130
+ t8 = (image || icon) && /*#__PURE__*/jsx("div", {
170
131
  className: clsx(classes.CardHeader, image && classes.CardHeaderEdgeToEdge),
171
132
  children: image || icon
172
133
  });
173
134
  }
174
- $[0] = Component;
175
- $[1] = borderRadius;
176
- $[2] = children;
177
- $[3] = className;
178
- $[4] = padding;
179
- $[5] = ref;
180
- $[6] = rest;
181
- $[7] = titleId;
182
- $[8] = T0;
183
- $[9] = T1;
184
- $[10] = description;
185
- $[11] = heading;
186
- $[12] = menu;
187
- $[13] = metadata;
188
- $[14] = t10;
189
- $[15] = t11;
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;
190
145
  $[16] = t3;
191
146
  $[17] = t4;
192
147
  $[18] = t5;
@@ -195,14 +150,10 @@ function CardComponent(props, ref) {
195
150
  $[21] = t8;
196
151
  $[22] = t9;
197
152
  } else {
198
- T0 = $[8];
199
- T1 = $[9];
200
- description = $[10];
201
- heading = $[11];
202
- menu = $[12];
203
- metadata = $[13];
204
- t10 = $[14];
205
- t11 = $[15];
153
+ description = $[12];
154
+ heading = $[13];
155
+ menu = $[14];
156
+ metadata = $[15];
206
157
  t3 = $[16];
207
158
  t4 = $[17];
208
159
  t5 = $[18];
@@ -211,98 +162,80 @@ function CardComponent(props, ref) {
211
162
  t8 = $[21];
212
163
  t9 = $[22];
213
164
  }
214
- if (t11 !== Symbol.for("react.early_return_sentinel")) {
215
- return t11;
165
+ if (t9 !== Symbol.for("react.early_return_sentinel")) {
166
+ return t9;
216
167
  }
217
- let t12;
218
- if ($[42] !== description || $[43] !== heading) {
219
- t12 = /*#__PURE__*/jsxs("div", {
168
+ let t10;
169
+ if ($[34] !== description || $[35] !== heading) {
170
+ t10 = /*#__PURE__*/jsxs("div", {
220
171
  className: classes.CardContent,
221
172
  children: [heading, description]
222
173
  });
223
- $[42] = description;
224
- $[43] = heading;
225
- $[44] = t12;
174
+ $[34] = description;
175
+ $[35] = heading;
176
+ $[36] = t10;
226
177
  } else {
227
- t12 = $[44];
178
+ t10 = $[36];
228
179
  }
229
- let t13;
230
- if ($[45] !== metadata) {
231
- t13 = metadata ? /*#__PURE__*/jsx("div", {
180
+ let t11;
181
+ if ($[37] !== metadata) {
182
+ t11 = metadata ? /*#__PURE__*/jsx("div", {
232
183
  className: classes.CardMetadataContainer,
233
184
  children: metadata
234
185
  }) : null;
235
- $[45] = metadata;
236
- $[46] = t13;
186
+ $[37] = metadata;
187
+ $[38] = t11;
237
188
  } else {
238
- t13 = $[46];
189
+ t11 = $[38];
239
190
  }
240
- let t14;
241
- if ($[47] !== t12 || $[48] !== t13) {
242
- t14 = /*#__PURE__*/jsxs("div", {
191
+ let t12;
192
+ if ($[39] !== t10 || $[40] !== t11) {
193
+ t12 = /*#__PURE__*/jsxs("div", {
243
194
  className: classes.CardBody,
244
- children: [t12, t13]
195
+ children: [t10, t11]
245
196
  });
246
- $[47] = t12;
247
- $[48] = t13;
248
- $[49] = t14;
197
+ $[39] = t10;
198
+ $[40] = t11;
199
+ $[41] = t12;
249
200
  } else {
250
- t14 = $[49];
201
+ t12 = $[41];
251
202
  }
252
- let t15;
253
- if ($[50] !== menu) {
254
- t15 = menu ? /*#__PURE__*/jsx("div", {
203
+ let t13;
204
+ if ($[42] !== menu) {
205
+ t13 = menu ? /*#__PURE__*/jsx("div", {
255
206
  className: classes.CardMenu,
256
207
  children: menu
257
208
  }) : null;
258
- $[50] = menu;
259
- $[51] = t15;
209
+ $[42] = menu;
210
+ $[43] = t13;
260
211
  } else {
261
- t15 = $[51];
212
+ t13 = $[43];
262
213
  }
263
- let t16;
264
- if ($[52] !== T0 || $[53] !== t14 || $[54] !== t15 || $[55] !== t3 || $[56] !== t4 || $[57] !== t5 || $[58] !== t6 || $[59] !== t7 || $[60] !== t8 || $[61] !== t9) {
265
- t16 = /*#__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", {
266
217
  ref: t3,
267
218
  className: t4,
268
- "data-component": t5,
269
- "data-padding": t6,
270
- "data-border-radius": t7,
271
- ...t8,
272
- children: [t9, t14, t15]
219
+ "data-padding": t5,
220
+ "data-border-radius": t6,
221
+ ...t7,
222
+ children: [t8, t12, t13]
273
223
  });
274
- $[52] = T0;
275
- $[53] = t14;
276
- $[54] = t15;
277
- $[55] = t3;
278
- $[56] = t4;
279
- $[57] = t5;
280
- $[58] = t6;
281
- $[59] = t7;
282
- $[60] = t8;
283
- $[61] = t9;
284
- $[62] = t16;
285
- } else {
286
- t16 = $[62];
287
- }
288
- let t17;
289
- if ($[63] !== T1 || $[64] !== t10 || $[65] !== t16) {
290
- t17 = /*#__PURE__*/jsx(T1, {
291
- value: t10,
292
- children: t16
293
- });
294
- $[63] = T1;
295
- $[64] = t10;
296
- $[65] = t16;
297
- $[66] = t17;
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;
298
233
  } else {
299
- t17 = $[66];
234
+ t14 = $[52];
300
235
  }
301
- return t17;
302
- }
303
- CardComponent.displayName = 'Card';
304
- const CardImpl = fixedForwardRef(CardComponent);
305
- function CardIcon(t0) {
236
+ return t14;
237
+ });
238
+ const CardIcon = t0 => {
306
239
  const $ = c(10);
307
240
  const {
308
241
  icon: IconComponent,
@@ -331,7 +264,6 @@ function CardIcon(t0) {
331
264
  if ($[4] !== ariaLabel || $[5] !== t1 || $[6] !== t2 || $[7] !== t3 || $[8] !== t4) {
332
265
  t5 = /*#__PURE__*/jsx("span", {
333
266
  className: t1,
334
- "data-component": "Card.Icon",
335
267
  role: t2,
336
268
  "aria-label": ariaLabel,
337
269
  "aria-hidden": t3,
@@ -347,9 +279,9 @@ function CardIcon(t0) {
347
279
  t5 = $[9];
348
280
  }
349
281
  return t5;
350
- }
282
+ };
351
283
  CardIcon.displayName = 'Card.Icon';
352
- function CardImage(t0) {
284
+ const CardImage = t0 => {
353
285
  const $ = c(12);
354
286
  let className;
355
287
  let rest;
@@ -385,11 +317,10 @@ function CardImage(t0) {
385
317
  let t3;
386
318
  if ($[7] !== alt || $[8] !== rest || $[9] !== src || $[10] !== t2) {
387
319
  t3 = /*#__PURE__*/jsx("img", {
388
- ...rest,
389
320
  src: src,
390
321
  alt: alt,
391
322
  className: t2,
392
- "data-component": "Card.Image"
323
+ ...rest
393
324
  });
394
325
  $[7] = alt;
395
326
  $[8] = rest;
@@ -400,21 +331,12 @@ function CardImage(t0) {
400
331
  t3 = $[11];
401
332
  }
402
333
  return t3;
403
- }
334
+ };
404
335
  CardImage.displayName = 'Card.Image';
405
-
406
- /**
407
- * Heading shown at the top of a Card.
408
- *
409
- * When the parent Card uses `as="section"`, the heading's `id` is
410
- * automatically wired to the section's `aria-labelledby`.
411
- */
412
336
  const CardHeading = /*#__PURE__*/forwardRef(function CardHeading(t0, ref) {
413
- var _id;
414
- const $ = c(15);
337
+ const $ = c(13);
415
338
  let children;
416
339
  let className;
417
- let id;
418
340
  let rest;
419
341
  let t1;
420
342
  if ($[0] !== t0) {
@@ -422,58 +344,47 @@ const CardHeading = /*#__PURE__*/forwardRef(function CardHeading(t0, ref) {
422
344
  as: t1,
423
345
  children,
424
346
  className,
425
- id,
426
347
  ...rest
427
348
  } = t0);
428
349
  $[0] = t0;
429
350
  $[1] = children;
430
351
  $[2] = className;
431
- $[3] = id;
432
- $[4] = rest;
433
- $[5] = t1;
352
+ $[3] = rest;
353
+ $[4] = t1;
434
354
  } else {
435
355
  children = $[1];
436
356
  className = $[2];
437
- id = $[3];
438
- rest = $[4];
439
- t1 = $[5];
357
+ rest = $[3];
358
+ t1 = $[4];
440
359
  }
441
360
  const Component = t1 === undefined ? "h3" : t1;
442
- const {
443
- titleId
444
- } = useContext(CardContext);
445
- const t2 = (_id = id) !== null && _id !== void 0 ? _id : titleId;
446
- let t3;
447
- if ($[6] !== className) {
448
- t3 = clsx(classes.CardHeading, className);
449
- $[6] = className;
450
- $[7] = t3;
361
+ let t2;
362
+ if ($[5] !== className) {
363
+ t2 = clsx(classes.CardHeading, className);
364
+ $[5] = className;
365
+ $[6] = t2;
451
366
  } else {
452
- t3 = $[7];
367
+ t2 = $[6];
453
368
  }
454
- let t4;
455
- if ($[8] !== Component || $[9] !== children || $[10] !== ref || $[11] !== rest || $[12] !== t2 || $[13] !== t3) {
456
- t4 = /*#__PURE__*/jsx(Component, {
457
- ...rest,
369
+ let t3;
370
+ if ($[7] !== Component || $[8] !== children || $[9] !== ref || $[10] !== rest || $[11] !== t2) {
371
+ t3 = /*#__PURE__*/jsx(Component, {
458
372
  ref: ref,
459
- id: t2,
460
- className: t3,
461
- "data-component": "Card.Heading",
373
+ className: t2,
374
+ ...rest,
462
375
  children: children
463
376
  });
464
- $[8] = Component;
465
- $[9] = children;
466
- $[10] = ref;
467
- $[11] = rest;
468
- $[12] = t2;
469
- $[13] = t3;
470
- $[14] = t4;
377
+ $[7] = Component;
378
+ $[8] = children;
379
+ $[9] = ref;
380
+ $[10] = rest;
381
+ $[11] = t2;
382
+ $[12] = t3;
471
383
  } else {
472
- t4 = $[14];
384
+ t3 = $[12];
473
385
  }
474
- return t4;
386
+ return t3;
475
387
  });
476
- CardHeading.displayName = 'Card.Heading';
477
388
  const CardDescription = /*#__PURE__*/forwardRef(function CardDescription(t0, ref) {
478
389
  const $ = c(11);
479
390
  let children;
@@ -505,10 +416,9 @@ const CardDescription = /*#__PURE__*/forwardRef(function CardDescription(t0, ref
505
416
  let t2;
506
417
  if ($[6] !== children || $[7] !== ref || $[8] !== rest || $[9] !== t1) {
507
418
  t2 = /*#__PURE__*/jsx("p", {
508
- ...rest,
509
419
  ref: ref,
510
420
  className: t1,
511
- "data-component": "Card.Description",
421
+ ...rest,
512
422
  children: children
513
423
  });
514
424
  $[6] = children;
@@ -521,24 +431,14 @@ const CardDescription = /*#__PURE__*/forwardRef(function CardDescription(t0, ref
521
431
  }
522
432
  return t2;
523
433
  });
524
- CardDescription.displayName = 'Card.Description';
525
-
526
- /**
527
- * Top-right slot for a single interactive control.
528
- *
529
- * Give the control a label that names the card (e.g. `"More options for
530
- * Project Alpha"`, not just `"More options"`) so users can tell which card
531
- * the action applies to when several cards are visible.
532
- */
533
- function CardMenu(t0) {
434
+ const CardMenu = t0 => {
534
435
  const $ = c(2);
535
436
  const {
536
437
  children
537
438
  } = t0;
538
439
  let t1;
539
440
  if ($[0] !== children) {
540
- t1 = /*#__PURE__*/jsx("div", {
541
- "data-component": "Card.Menu",
441
+ t1 = /*#__PURE__*/jsx(Fragment, {
542
442
  children: children
543
443
  });
544
444
  $[0] = children;
@@ -547,7 +447,7 @@ function CardMenu(t0) {
547
447
  t1 = $[1];
548
448
  }
549
449
  return t1;
550
- }
450
+ };
551
451
  CardMenu.displayName = 'Card.Menu';
552
452
  const CardMetadata = /*#__PURE__*/forwardRef(function CardMetadata(t0, ref) {
553
453
  const $ = c(11);
@@ -580,10 +480,9 @@ const CardMetadata = /*#__PURE__*/forwardRef(function CardMetadata(t0, ref) {
580
480
  let t2;
581
481
  if ($[6] !== children || $[7] !== ref || $[8] !== rest || $[9] !== t1) {
582
482
  t2 = /*#__PURE__*/jsx("div", {
583
- ...rest,
584
483
  ref: ref,
585
484
  className: t1,
586
- "data-component": "Card.Metadata",
485
+ ...rest,
587
486
  children: children
588
487
  });
589
488
  $[6] = children;
@@ -596,6 +495,5 @@ const CardMetadata = /*#__PURE__*/forwardRef(function CardMetadata(t0, ref) {
596
495
  }
597
496
  return t2;
598
497
  });
599
- CardMetadata.displayName = 'Card.Metadata';
600
498
 
601
499
  export { CardDescription, CardHeading, CardIcon, CardImage, CardImpl, CardMenu, CardMetadata };
@@ -1,20 +1,17 @@
1
- import { CardIcon, CardImage, CardMenu } from './Card';
2
1
  import type { CardProps, CardIconProps, CardImageProps, CardHeadingProps, CardDescriptionProps, CardMenuProps, CardMetadataProps } from './Card';
3
- declare const Card: (<As extends "div" | "section">(props: (import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "div" : As> & {
2
+ declare const Card: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
4
3
  className?: string;
5
4
  padding?: "none" | "condensed" | "normal";
6
5
  borderRadius?: "medium" | "large";
7
- children: React.ReactNode;
8
- } extends infer T ? T extends import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "div" : As> & {
9
- className?: string;
10
- padding?: "none" | "condensed" | "normal";
11
- borderRadius?: "medium" | "large";
12
- children: React.ReactNode;
13
- } ? T extends unknown ? Omit<T, "as"> : never : never : never) & {
14
- as?: As | undefined;
15
- } & import("react").RefAttributes<any>) => React.ReactNode) & {
16
- Icon: typeof CardIcon;
17
- Image: typeof CardImage;
6
+ } & import("react").RefAttributes<HTMLDivElement>> & {
7
+ Icon: {
8
+ ({ icon: IconComponent, "aria-label": ariaLabel, className }: CardIconProps): import("react").JSX.Element;
9
+ displayName: string;
10
+ };
11
+ Image: {
12
+ ({ src, alt, className, ...rest }: CardImageProps): import("react").JSX.Element;
13
+ displayName: string;
14
+ };
18
15
  Heading: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & {
19
16
  as?: "h2" | "h3" | "h4" | "h5" | "h6";
20
17
  children: React.ReactNode;
@@ -22,7 +19,10 @@ declare const Card: (<As extends "div" | "section">(props: (import("react").Comp
22
19
  Description: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & {
23
20
  children: React.ReactNode;
24
21
  } & import("react").RefAttributes<HTMLParagraphElement>>;
25
- Menu: typeof CardMenu;
22
+ Menu: {
23
+ ({ children }: CardMenuProps): import("react").JSX.Element;
24
+ displayName: string;
25
+ };
26
26
  Metadata: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
27
27
  children: React.ReactNode;
28
28
  } & import("react").RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,QAAQ,EAAE,SAAS,EAAgC,QAAQ,EAAe,MAAM,QAAQ,CAAA;AAC1G,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\">\n <Card.Icon icon={RepoIcon} />\n <Card.Heading>primer/react</Card.Heading>\n <Card.Description>\n {\n 'Standalone cards render as a labelled <section> landmark. aria-labelledby is automatically wired to Card.Heading.'\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. When `Card.Heading` is present, `aria-labelledby` is automatically wired. Use the default `'div'` when the Card is inside an `<li>` of a list of cards."
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. When the parent Card uses `as=\"section\"`, the heading's `id` is automatically wired to the section's `aria-labelledby`."
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": "Interactive control for the top-right corner of the card."
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": "Metadata content for the bottom of the card. Accepts any content: plain text, icons, or other Primer components."
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-20260520211038",
4
+ "version": "0.0.0-20260521135517",
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"]}