@primer/react 0.0.0-20260521224734 → 0.0.0-20260522115117

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,12 +1,27 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260521224734
3
+ ## 0.0.0-20260522115117
4
4
 
5
- ### Minor Changes
5
+ ### Patch Changes
6
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.
7
+ - [#7864](https://github.com/primer/react/pull/7864) [`3edf601`](https://github.com/primer/react/commit/3edf60187465206244029c521db76d64a178dc82) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Eliminate nested-update cascades in `useFocus`, `PageLayout.Pane`, and
8
+ `AnchoredOverlay`:
8
9
 
9
- ### Patch Changes
10
+ - `useFocus` no longer produces a second re-render after focusing; one
11
+ `focus()` call now results in exactly one render instead of two.
12
+ - `PageLayout.Pane` (resizable) no longer triggers a forced re-render
13
+ before paint on mount. The CSS variable and ARIA attributes are still
14
+ updated synchronously in the layout effect; the React state sync is
15
+ wrapped in `startTransition` so it runs in the transition lane rather
16
+ than as part of the layout-effect commit.
17
+ - `AnchoredOverlay` no longer keeps `useAnchoredPosition`'s scroll
18
+ listeners and `ResizeObserver` attached while it is closed. After an
19
+ open→close cycle, the first scroll/resize event no longer fires a
20
+ spurious `setPosition(undefined)` that re-renders the closed overlay.
21
+
22
+ Also adds a profiler-based test harness at
23
+ `src/utils/testing/profiler.tsx` so future regressions can be pinned with
24
+ `counter.updateCount` and `counter.nestedUpdateCount` assertions.
10
25
 
11
26
  - Fake entry to force publishing
12
27
 
@@ -1 +1 @@
1
- {"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/AnchoredOverlay/AnchoredOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAmC,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AAChE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAEhE,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAIhE,OAAO,KAAK,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,WAAW,CAAA;AAO1D,UAAU,8BAA8B;IACtC;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,YAAY,GAAG,iBAAiB,CAAC,EAChG,KAAK,EAAE,CAAC,KACL,GAAG,CAAC,OAAO,CAAA;IAEhB;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAE/C;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,UAAU,iCAAiC;IACzC;;;OAGG;IACH,YAAY,EAAE,IAAI,CAAA;IAElB;;;OAGG;IACH,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAC9C;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,MAAM,iCAAiC,GACzC,OAAO,CAAC,8B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AAE,OAAO,CAAA;IAC5B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IAC3C;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;CAChC;AAED,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GACzD,CAAC,8BAA8B,GAAG,iCAAiC,CAAC,GACpE,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,iBAAiB,GAAG,mBAAmB,CAAC,CAAC,CAAA;AAS9G;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAuRnF,CAAA"}
@@ -110,10 +110,13 @@ const AnchoredOverlay = ({
110
110
  anchorOffset,
111
111
  displayInViewport,
112
112
  onPositionChange: positionChange,
113
- // When native CSS anchor positioning is active, skip JS-based position
114
- // computation, scroll listeners, and resize observers since the browser
115
- // handles repositioning natively.
116
- enabled: !cssAnchorPositioning
113
+ // Disable position computation, scroll listeners, and resize observers
114
+ // when the overlay is closed (no floating element to position) or when
115
+ // native CSS anchor positioning is active (the browser handles it).
116
+ // Skipping the listeners while closed avoids a wasted re-render on the
117
+ // first scroll/resize after a close (where `setPosition(undefined)`
118
+ // would otherwise clear the stale open-position state).
119
+ enabled: open && !cssAnchorPositioning
117
120
  }, [overlayElement]);
118
121
  useEffect(() => {
119
122
  // ensure overlay ref gets cleared when closed, so position can reset between closing/re-opening
@@ -1,2 +1,2 @@
1
- .prc-Card-Card-pYjuL{background-color:var(--bgColor-default,#fff);border:var(--borderWidth-thin,.0625rem) solid var(--borderColor-default,#d1d9e0);box-shadow:var(--shadow-resting-small,0 1px 1px 0 #1f23280a,0 1px 2px 0 #1f232808);display:grid;gap:var(--stack-gap-normal,1rem);grid-auto-rows:max-content auto;overflow:hidden;position:relative}.prc-Card-Card-pYjuL[data-border-radius=large]{border-radius:var(--borderRadius-large,.75rem)}.prc-Card-Card-pYjuL[data-border-radius=medium]{border-radius:var(--borderRadius-medium,.375rem)}.prc-Card-Card-pYjuL[data-padding=normal]{padding:var(--stack-padding-spacious,1.5rem)}.prc-Card-Card-pYjuL[data-padding=condensed]{padding:var(--stack-padding-condensed,.5rem)}.prc-Card-Card-pYjuL[data-padding=none]{padding:0}.prc-Card-CardHeader-P5Qbb{display:block;height:auto;width:100%}.prc-Card-CardHeaderEdgeToEdge-3yCqT{margin-left:calc(var(--stack-padding-spacious,1.5rem)*-1);margin-right:calc(var(--stack-padding-spacious,1.5rem)*-1);margin-top:calc(var(--stack-padding-spacious,1.5rem)*-1);width:calc(100% + var(--stack-padding-spacious,1.5rem)*2)}.prc-Card-CardImage-2M8DM{display:block;height:auto;width:100%}.prc-Card-CardIcon-mIMfj{align-items:center;background-color:var(--bgColor-muted,#f6f8fa);border-radius:var(--borderRadius-medium,.375rem);color:var(--fgColor-muted,#59636e);display:flex;height:var(--base-size-32,2rem);justify-content:center;width:var(--base-size-32,2rem)}.prc-Card-CardBody-W1o-l{display:grid;gap:var(--stack-gap-normal,1rem)}.prc-Card-CardContent-omZDS{display:grid;gap:var(--stack-gap-condensed,.5rem)}.prc-Card-CardHeading-3HXyS{color:var(--fgColor-default,#1f2328);font:var(--text-title-shorthand-small,600 1rem/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji");margin:0}.prc-Card-CardDescription-MnJ3F{margin:0}.prc-Card-CardDescription-MnJ3F,.prc-Card-CardMetadataContainer-K-UlH{color:var(--fgColor-muted,#59636e);font:var(--text-body-shorthand-medium,400 .875rem/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji")}.prc-Card-CardMetadataContainer-K-UlH{align-items:center;display:flex;gap:var(--stack-gap-normal,1rem)}.prc-Card-CardMetadataItem-ellY9{align-items:center;display:flex;font:var(--text-body-shorthand-small,400 .75rem/1.625 -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji");gap:var(--stack-gap-condensed,.5rem)}.prc-Card-CardAction-VtI49{position:absolute;right:var(--base-size-16,1rem);top:var(--base-size-16,1rem);z-index:1}
2
- /*# sourceMappingURL=Card-d8a02dd9.css.map */
1
+ .prc-Card-Card-pYjuL{background-color:var(--bgColor-default,#fff);border:var(--borderWidth-thin,.0625rem) solid var(--borderColor-default,#d1d9e0);box-shadow:var(--shadow-resting-small,0 1px 1px 0 #1f23280a,0 1px 2px 0 #1f232808);display:grid;gap:var(--stack-gap-normal,1rem);grid-auto-rows:max-content auto;overflow:hidden;position:relative}.prc-Card-Card-pYjuL[data-border-radius=large]{border-radius:var(--borderRadius-large,.75rem)}.prc-Card-Card-pYjuL[data-border-radius=medium]{border-radius:var(--borderRadius-medium,.375rem)}.prc-Card-Card-pYjuL[data-padding=normal]{padding:var(--stack-padding-spacious,1.5rem)}.prc-Card-Card-pYjuL[data-padding=condensed]{padding:var(--stack-padding-condensed,.5rem)}.prc-Card-Card-pYjuL[data-padding=none]{padding:0}.prc-Card-CardHeader-P5Qbb{display:block;height:auto;width:100%}.prc-Card-CardHeaderEdgeToEdge-3yCqT{margin-left:calc(var(--stack-padding-spacious,1.5rem)*-1);margin-right:calc(var(--stack-padding-spacious,1.5rem)*-1);margin-top:calc(var(--stack-padding-spacious,1.5rem)*-1);width:calc(100% + var(--stack-padding-spacious,1.5rem)*2)}.prc-Card-CardImage-2M8DM{display:block;height:auto;width:100%}.prc-Card-CardIcon-mIMfj{align-items:center;background-color:var(--bgColor-muted,#f6f8fa);border-radius:var(--borderRadius-medium,.375rem);color:var(--fgColor-muted,#59636e);display:flex;height:var(--base-size-32,2rem);justify-content:center;width:var(--base-size-32,2rem)}.prc-Card-CardBody-W1o-l{display:grid;gap:var(--stack-gap-normal,1rem)}.prc-Card-CardContent-omZDS{display:grid;gap:var(--stack-gap-condensed,.5rem)}.prc-Card-CardHeading-3HXyS{color:var(--fgColor-default,#1f2328);font:var(--text-title-shorthand-small,600 1rem/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji");margin:0}.prc-Card-CardDescription-MnJ3F{margin:0}.prc-Card-CardDescription-MnJ3F,.prc-Card-CardMetadataContainer-K-UlH{color:var(--fgColor-muted,#59636e);font:var(--text-body-shorthand-medium,400 .875rem/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji")}.prc-Card-CardMetadataContainer-K-UlH{align-items:center;display:flex;gap:var(--stack-gap-normal,1rem)}.prc-Card-CardMetadataItem-ellY9{align-items:center;display:flex;font:var(--text-body-shorthand-small,400 .75rem/1.625 -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji");gap:var(--stack-gap-condensed,.5rem)}.prc-Card-CardMenu-1b3uS{position:absolute;right:var(--base-size-16,1rem);top:var(--base-size-16,1rem);z-index:1}
2
+ /*# sourceMappingURL=Card-cec366f8.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Card/Card.module.css.js"],"names":[],"mappings":"AAAA,qBAOE,4CAAwC,CAFxC,gFAAgE,CAChE,kFAAuC,CALvC,YAAa,CAOb,gCAA4B,CAJ5B,+BAAgC,CADhC,eAAgB,CADhB,iBA6BF,CArBE,+CACE,8CACF,CAEA,gDACE,gDACF,CAEA,0CAEE,4CACF,CAEA,6CAEE,4CACF,CAEA,wCACE,SACF,CAGF,2BACE,aAAc,CAEd,WAAY,CADZ,UAEF,CAEA,qCAIE,yDAAqD,CADrD,0DAAsD,CADtD,wDAAoD,CAGpD,yDAEF,CAEA,0BACE,aAAc,CAEd,WAAY,CADZ,UAEF,CAEA,yBAEE,kBAAmB,CAKnB,6CAAsC,CADtC,gDAAyC,CAEzC,kCAA2B,CAP3B,YAAa,CAIb,+BAA2B,CAF3B,sBAAuB,CACvB,8BAKF,CAEA,yBACE,YAAa,CACb,gCACF,CAEA,4BACE,YAAa,CACb,oCACF,CAEA,4BAEE,oCAA6B,CAD7B,2KAAuC,CAEvC,QACF,CAEA,gCAGE,QACF,CAEA,sEAJE,kCAA2B,CAD3B,8KAWF,CANA,sCAEE,kBAAmB,CADnB,YAAa,CAEb,gCAGF,CAEA,iCAEE,kBAAmB,CADnB,YAAa,CAGb,8KAAsC,CADtC,oCAEF,CAEA,2BACE,iBAAkB,CAElB,8BAA0B,CAD1B,4BAAwB,CAExB,SACF","file":"Card-d8a02dd9.css","sourcesContent":[".Card {\n display: grid;\n position: relative;\n overflow: hidden;\n grid-auto-rows: max-content auto;\n border: var(--borderWidth-thin) solid var(--borderColor-default);\n box-shadow: var(--shadow-resting-small);\n background-color: var(--bgColor-default);\n gap: var(--stack-gap-normal);\n\n &[data-border-radius='large'] {\n border-radius: var(--borderRadius-large);\n }\n\n &[data-border-radius='medium'] {\n border-radius: var(--borderRadius-medium);\n }\n\n &[data-padding='normal'] {\n /* stylelint-disable-next-line primer/spacing */\n padding: var(--stack-padding-spacious);\n }\n\n &[data-padding='condensed'] {\n /* stylelint-disable-next-line primer/spacing */\n padding: var(--stack-padding-condensed);\n }\n\n &[data-padding='none'] {\n padding: 0;\n }\n}\n\n.CardHeader {\n display: block;\n width: 100%;\n height: auto;\n}\n\n.CardHeaderEdgeToEdge {\n /* stylelint-disable primer/spacing */\n margin-top: calc(-1 * var(--stack-padding-spacious));\n margin-right: calc(-1 * var(--stack-padding-spacious));\n margin-left: calc(-1 * var(--stack-padding-spacious));\n width: calc(100% + 2 * var(--stack-padding-spacious));\n /* stylelint-enable primer/spacing */\n}\n\n.CardImage {\n display: block;\n width: 100%;\n height: auto;\n}\n\n.CardIcon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: var(--base-size-32);\n height: var(--base-size-32);\n border-radius: var(--borderRadius-medium);\n background-color: var(--bgColor-muted);\n color: var(--fgColor-muted);\n}\n\n.CardBody {\n display: grid;\n gap: var(--stack-gap-normal);\n}\n\n.CardContent {\n display: grid;\n gap: var(--stack-gap-condensed);\n}\n\n.CardHeading {\n font: var(--text-title-shorthand-small);\n color: var(--fgColor-default);\n margin: 0;\n}\n\n.CardDescription {\n font: var(--text-body-shorthand-medium);\n color: var(--fgColor-muted);\n margin: 0;\n}\n\n.CardMetadataContainer {\n display: flex;\n align-items: center;\n gap: var(--stack-gap-normal);\n font: var(--text-body-shorthand-medium);\n color: var(--fgColor-muted);\n}\n\n.CardMetadataItem {\n display: flex;\n align-items: center;\n gap: var(--stack-gap-condensed);\n font: var(--text-body-shorthand-small);\n}\n\n.CardAction {\n position: absolute;\n top: var(--base-size-16);\n right: var(--base-size-16);\n z-index: 1;\n}\n"]}
1
+ {"version":3,"sources":["../src/Card/Card.module.css.js"],"names":[],"mappings":"AAAA,qBAOE,4CAAwC,CAFxC,gFAAgE,CAChE,kFAAuC,CALvC,YAAa,CAOb,gCAA4B,CAJ5B,+BAAgC,CADhC,eAAgB,CADhB,iBA6BF,CArBE,+CACE,8CACF,CAEA,gDACE,gDACF,CAEA,0CAEE,4CACF,CAEA,6CAEE,4CACF,CAEA,wCACE,SACF,CAGF,2BACE,aAAc,CAEd,WAAY,CADZ,UAEF,CAEA,qCAIE,yDAAqD,CADrD,0DAAsD,CADtD,wDAAoD,CAGpD,yDAEF,CAEA,0BACE,aAAc,CAEd,WAAY,CADZ,UAEF,CAEA,yBAEE,kBAAmB,CAKnB,6CAAsC,CADtC,gDAAyC,CAEzC,kCAA2B,CAP3B,YAAa,CAIb,+BAA2B,CAF3B,sBAAuB,CACvB,8BAKF,CAEA,yBACE,YAAa,CACb,gCACF,CAEA,4BACE,YAAa,CACb,oCACF,CAEA,4BAEE,oCAA6B,CAD7B,2KAAuC,CAEvC,QACF,CAEA,gCAGE,QACF,CAEA,sEAJE,kCAA2B,CAD3B,8KAWF,CANA,sCAEE,kBAAmB,CADnB,YAAa,CAEb,gCAGF,CAEA,iCAEE,kBAAmB,CADnB,YAAa,CAGb,8KAAsC,CADtC,oCAEF,CAEA,yBACE,iBAAkB,CAElB,8BAA0B,CAD1B,4BAAwB,CAExB,SACF","file":"Card-cec366f8.css","sourcesContent":[".Card {\n display: grid;\n position: relative;\n overflow: hidden;\n grid-auto-rows: max-content auto;\n border: var(--borderWidth-thin) solid var(--borderColor-default);\n box-shadow: var(--shadow-resting-small);\n background-color: var(--bgColor-default);\n gap: var(--stack-gap-normal);\n\n &[data-border-radius='large'] {\n border-radius: var(--borderRadius-large);\n }\n\n &[data-border-radius='medium'] {\n border-radius: var(--borderRadius-medium);\n }\n\n &[data-padding='normal'] {\n /* stylelint-disable-next-line primer/spacing */\n padding: var(--stack-padding-spacious);\n }\n\n &[data-padding='condensed'] {\n /* stylelint-disable-next-line primer/spacing */\n padding: var(--stack-padding-condensed);\n }\n\n &[data-padding='none'] {\n padding: 0;\n }\n}\n\n.CardHeader {\n display: block;\n width: 100%;\n height: auto;\n}\n\n.CardHeaderEdgeToEdge {\n /* stylelint-disable primer/spacing */\n margin-top: calc(-1 * var(--stack-padding-spacious));\n margin-right: calc(-1 * var(--stack-padding-spacious));\n margin-left: calc(-1 * var(--stack-padding-spacious));\n width: calc(100% + 2 * var(--stack-padding-spacious));\n /* stylelint-enable primer/spacing */\n}\n\n.CardImage {\n display: block;\n width: 100%;\n height: auto;\n}\n\n.CardIcon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: var(--base-size-32);\n height: var(--base-size-32);\n border-radius: var(--borderRadius-medium);\n background-color: var(--bgColor-muted);\n color: var(--fgColor-muted);\n}\n\n.CardBody {\n display: grid;\n gap: var(--stack-gap-normal);\n}\n\n.CardContent {\n display: grid;\n gap: var(--stack-gap-condensed);\n}\n\n.CardHeading {\n font: var(--text-title-shorthand-small);\n color: var(--fgColor-default);\n margin: 0;\n}\n\n.CardDescription {\n font: var(--text-body-shorthand-medium);\n color: var(--fgColor-muted);\n margin: 0;\n}\n\n.CardMetadataContainer {\n display: flex;\n align-items: center;\n gap: var(--stack-gap-normal);\n font: var(--text-body-shorthand-medium);\n color: var(--fgColor-muted);\n}\n\n.CardMetadataItem {\n display: flex;\n align-items: center;\n gap: var(--stack-gap-condensed);\n font: var(--text-body-shorthand-small);\n}\n\n.CardMenu {\n position: absolute;\n top: var(--base-size-16);\n right: var(--base-size-16);\n z-index: 1;\n}\n"]}
@@ -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.
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 = {
@@ -49,58 +48,37 @@ type ImageProps = React.ComponentPropsWithoutRef<'img'> & {
49
48
  */
50
49
  alt?: string;
51
50
  };
52
- type ActionProps = {
53
- /** Interactive control for the top-right corner of the card. */
51
+ type MenuProps = {
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.
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.
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,34 +87,20 @@ 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 CardAction({ children }: ActionProps): React.JSX.Element;
125
- declare namespace CardAction {
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
- export { CardImpl, CardIcon, CardImage, CardHeading, CardDescription, CardAction, CardMetadata };
99
+ export { CardImpl, CardIcon, CardImage, CardHeading, CardDescription, CardMenu, CardMetadata };
136
100
  export type { HeadingProps as CardHeadingProps };
137
101
  export type { DescriptionProps as CardDescriptionProps };
138
102
  export type { IconProps as CardIconProps };
139
103
  export type { ImageProps as CardImageProps };
140
- export type { ActionProps as CardActionProps };
104
+ export type { MenuProps as CardMenuProps };
141
105
  export type { MetadataProps as CardMetadataProps };
142
106
  //# sourceMappingURL=Card.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../src/Card/Card.tsx"],"names":[],"mappings":"AACA,OAAO,KAAiE,MAAM,OAAO,CAAA;AAErF,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;;;OA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AAC,KAAK,CAAC,GAAG;IAC3D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAA;AAED,QAAA,MAAM,QAAQ;IAhEZ;;;OAGG;gBACS,MAAM;IAElB;;;OAGG;cACO,MAAM,GAAG,WAAW,GAAG,QAAQ;IAEzC;;;OAGG;mBACY,QAAQ,GAAG,OAAO;wCAoHjC,CAAA;AAEF,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,39 +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 { fixedForwardRef } from '../utils/modern-polymorphic.js';
6
- import { useId } from '../hooks/useId.js';
7
- import { jsx, jsxs } from 'react/jsx-runtime';
5
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
6
 
9
- const CardContext = /*#__PURE__*/createContext({});
10
- function CardComponent(props, ref) {
11
- const $ = c(67);
12
- const {
13
- children,
14
- className,
15
- padding: t0,
16
- borderRadius: t1,
17
- as: t2,
18
- ...rest
19
- } = props;
20
- const padding = t0 === undefined ? "normal" : t0;
21
- const borderRadius = t1 === undefined ? "large" : t1;
22
- const as = t2 === undefined ? "div" : t2;
23
- const Component = as;
24
- const generatedId = useId();
25
- const titleId = as === "section" ? generatedId : undefined;
26
- if (as === "section" && !("aria-label" in props) && !("aria-labelledby" in props)) {
27
- 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];
28
34
  }
29
- let T0;
30
- let T1;
35
+ const padding = t1 === undefined ? "normal" : t1;
36
+ const borderRadius = t2 === undefined ? "large" : t2;
31
37
  let description;
32
38
  let heading;
33
39
  let menu;
34
40
  let metadata;
35
- let t10;
36
- let t11;
37
41
  let t3;
38
42
  let t4;
39
43
  let t5;
@@ -41,8 +45,8 @@ function CardComponent(props, ref) {
41
45
  let t7;
42
46
  let t8;
43
47
  let t9;
44
- if ($[0] !== Component || $[1] !== borderRadius || $[2] !== children || $[3] !== className || $[4] !== padding || $[5] !== ref || $[6] !== rest || $[7] !== titleId) {
45
- 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");
46
50
  bb0: {
47
51
  let icon = null;
48
52
  let image = null;
@@ -70,7 +74,7 @@ function CardComponent(props, ref) {
70
74
  if (child.type === CardMetadata) {
71
75
  metadata = child;
72
76
  } else {
73
- if (child.type === CardAction) {
77
+ if (child.type === CardMenu) {
74
78
  menu = child;
75
79
  }
76
80
  }
@@ -80,111 +84,64 @@ function CardComponent(props, ref) {
80
84
  }
81
85
  }
82
86
  const hasSlotChildren = icon || image || heading || description || metadata || menu;
83
- const isEmpty = !hasSlotChildren && childArray.length === 0;
84
- if (isEmpty) {
85
- t11 = null;
86
- break bb0;
87
- }
88
87
  if (!hasSlotChildren) {
89
- let t12;
90
- if ($[23] !== titleId) {
91
- t12 = {
92
- titleId
93
- };
94
- $[23] = titleId;
95
- $[24] = t12;
88
+ let t10;
89
+ if ($[23] !== className) {
90
+ t10 = clsx(classes.Card, className);
91
+ $[23] = className;
92
+ $[24] = t10;
96
93
  } else {
97
- t12 = $[24];
94
+ t10 = $[24];
98
95
  }
99
- let t13;
100
- if ($[25] !== className) {
101
- t13 = clsx(classes.Card, className);
102
- $[25] = className;
103
- $[26] = t13;
104
- } else {
105
- t13 = $[26];
106
- }
107
- let t14;
108
- if ($[27] !== Component || $[28] !== borderRadius || $[29] !== children || $[30] !== padding || $[31] !== ref || $[32] !== rest || $[33] !== t13) {
109
- 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", {
110
99
  ref: ref,
111
- className: t13,
112
- "data-component": "Card",
100
+ className: t10,
113
101
  "data-padding": padding,
114
102
  "data-border-radius": borderRadius,
115
103
  ...rest,
116
104
  children: children
117
105
  });
118
- $[27] = Component;
119
- $[28] = borderRadius;
120
- $[29] = children;
121
- $[30] = padding;
122
- $[31] = ref;
123
- $[32] = rest;
124
- $[33] = t13;
125
- $[34] = t14;
106
+ $[25] = borderRadius;
107
+ $[26] = children;
108
+ $[27] = padding;
109
+ $[28] = ref;
110
+ $[29] = rest;
111
+ $[30] = t10;
112
+ $[31] = t11;
126
113
  } else {
127
- t14 = $[34];
114
+ t11 = $[31];
128
115
  }
129
- let t15;
130
- if ($[35] !== t12 || $[36] !== t14) {
131
- t15 = /*#__PURE__*/jsx(CardContext.Provider, {
132
- value: t12,
133
- children: t14
134
- });
135
- $[35] = t12;
136
- $[36] = t14;
137
- $[37] = t15;
138
- } else {
139
- t15 = $[37];
140
- }
141
- t11 = t15;
116
+ t9 = t11;
142
117
  break bb0;
143
118
  }
144
- T1 = CardContext.Provider;
145
- if ($[38] !== titleId) {
146
- t10 = {
147
- titleId
148
- };
149
- $[38] = titleId;
150
- $[39] = t10;
151
- } else {
152
- t10 = $[39];
153
- }
154
- T0 = Component;
155
119
  t3 = ref;
156
- if ($[40] !== className) {
120
+ if ($[32] !== className) {
157
121
  t4 = clsx(classes.Card, className);
158
- $[40] = className;
159
- $[41] = t4;
122
+ $[32] = className;
123
+ $[33] = t4;
160
124
  } else {
161
- t4 = $[41];
125
+ t4 = $[33];
162
126
  }
163
- t5 = "Card";
164
- t6 = padding;
165
- t7 = borderRadius;
166
- t8 = rest;
167
- t9 = (image || icon) && /*#__PURE__*/jsx("div", {
127
+ t5 = padding;
128
+ t6 = borderRadius;
129
+ t7 = rest;
130
+ t8 = (image || icon) && /*#__PURE__*/jsx("div", {
168
131
  className: clsx(classes.CardHeader, image && classes.CardHeaderEdgeToEdge),
169
132
  children: image || icon
170
133
  });
171
134
  }
172
- $[0] = Component;
173
- $[1] = borderRadius;
174
- $[2] = children;
175
- $[3] = className;
176
- $[4] = padding;
177
- $[5] = ref;
178
- $[6] = rest;
179
- $[7] = titleId;
180
- $[8] = T0;
181
- $[9] = T1;
182
- $[10] = description;
183
- $[11] = heading;
184
- $[12] = menu;
185
- $[13] = metadata;
186
- $[14] = t10;
187
- $[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;
188
145
  $[16] = t3;
189
146
  $[17] = t4;
190
147
  $[18] = t5;
@@ -193,14 +150,10 @@ function CardComponent(props, ref) {
193
150
  $[21] = t8;
194
151
  $[22] = t9;
195
152
  } else {
196
- T0 = $[8];
197
- T1 = $[9];
198
- description = $[10];
199
- heading = $[11];
200
- menu = $[12];
201
- metadata = $[13];
202
- t10 = $[14];
203
- t11 = $[15];
153
+ description = $[12];
154
+ heading = $[13];
155
+ menu = $[14];
156
+ metadata = $[15];
204
157
  t3 = $[16];
205
158
  t4 = $[17];
206
159
  t5 = $[18];
@@ -209,98 +162,80 @@ function CardComponent(props, ref) {
209
162
  t8 = $[21];
210
163
  t9 = $[22];
211
164
  }
212
- if (t11 !== Symbol.for("react.early_return_sentinel")) {
213
- return t11;
165
+ if (t9 !== Symbol.for("react.early_return_sentinel")) {
166
+ return t9;
214
167
  }
215
- let t12;
216
- if ($[42] !== description || $[43] !== heading) {
217
- t12 = /*#__PURE__*/jsxs("div", {
168
+ let t10;
169
+ if ($[34] !== description || $[35] !== heading) {
170
+ t10 = /*#__PURE__*/jsxs("div", {
218
171
  className: classes.CardContent,
219
172
  children: [heading, description]
220
173
  });
221
- $[42] = description;
222
- $[43] = heading;
223
- $[44] = t12;
174
+ $[34] = description;
175
+ $[35] = heading;
176
+ $[36] = t10;
224
177
  } else {
225
- t12 = $[44];
178
+ t10 = $[36];
226
179
  }
227
- let t13;
228
- if ($[45] !== metadata) {
229
- t13 = metadata ? /*#__PURE__*/jsx("div", {
180
+ let t11;
181
+ if ($[37] !== metadata) {
182
+ t11 = metadata ? /*#__PURE__*/jsx("div", {
230
183
  className: classes.CardMetadataContainer,
231
184
  children: metadata
232
185
  }) : null;
233
- $[45] = metadata;
234
- $[46] = t13;
186
+ $[37] = metadata;
187
+ $[38] = t11;
235
188
  } else {
236
- t13 = $[46];
189
+ t11 = $[38];
237
190
  }
238
- let t14;
239
- if ($[47] !== t12 || $[48] !== t13) {
240
- t14 = /*#__PURE__*/jsxs("div", {
191
+ let t12;
192
+ if ($[39] !== t10 || $[40] !== t11) {
193
+ t12 = /*#__PURE__*/jsxs("div", {
241
194
  className: classes.CardBody,
242
- children: [t12, t13]
195
+ children: [t10, t11]
243
196
  });
244
- $[47] = t12;
245
- $[48] = t13;
246
- $[49] = t14;
197
+ $[39] = t10;
198
+ $[40] = t11;
199
+ $[41] = t12;
247
200
  } else {
248
- t14 = $[49];
201
+ t12 = $[41];
249
202
  }
250
- let t15;
251
- if ($[50] !== menu) {
252
- t15 = menu ? /*#__PURE__*/jsx("div", {
253
- className: classes.CardAction,
203
+ let t13;
204
+ if ($[42] !== menu) {
205
+ t13 = menu ? /*#__PURE__*/jsx("div", {
206
+ className: classes.CardMenu,
254
207
  children: menu
255
208
  }) : null;
256
- $[50] = menu;
257
- $[51] = t15;
209
+ $[42] = menu;
210
+ $[43] = t13;
258
211
  } else {
259
- t15 = $[51];
212
+ t13 = $[43];
260
213
  }
261
- let t16;
262
- if ($[52] !== T0 || $[53] !== t14 || $[54] !== t15 || $[55] !== t3 || $[56] !== t4 || $[57] !== t5 || $[58] !== t6 || $[59] !== t7 || $[60] !== t8 || $[61] !== t9) {
263
- 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", {
264
217
  ref: t3,
265
218
  className: t4,
266
- "data-component": t5,
267
- "data-padding": t6,
268
- "data-border-radius": t7,
269
- ...t8,
270
- children: [t9, t14, t15]
219
+ "data-padding": t5,
220
+ "data-border-radius": t6,
221
+ ...t7,
222
+ children: [t8, t12, t13]
271
223
  });
272
- $[52] = T0;
273
- $[53] = t14;
274
- $[54] = t15;
275
- $[55] = t3;
276
- $[56] = t4;
277
- $[57] = t5;
278
- $[58] = t6;
279
- $[59] = t7;
280
- $[60] = t8;
281
- $[61] = t9;
282
- $[62] = t16;
283
- } else {
284
- t16 = $[62];
285
- }
286
- let t17;
287
- if ($[63] !== T1 || $[64] !== t10 || $[65] !== t16) {
288
- t17 = /*#__PURE__*/jsx(T1, {
289
- value: t10,
290
- children: t16
291
- });
292
- $[63] = T1;
293
- $[64] = t10;
294
- $[65] = t16;
295
- $[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;
296
233
  } else {
297
- t17 = $[66];
234
+ t14 = $[52];
298
235
  }
299
- return t17;
300
- }
301
- CardComponent.displayName = 'Card';
302
- const CardImpl = fixedForwardRef(CardComponent);
303
- function CardIcon(t0) {
236
+ return t14;
237
+ });
238
+ const CardIcon = t0 => {
304
239
  const $ = c(10);
305
240
  const {
306
241
  icon: IconComponent,
@@ -329,7 +264,6 @@ function CardIcon(t0) {
329
264
  if ($[4] !== ariaLabel || $[5] !== t1 || $[6] !== t2 || $[7] !== t3 || $[8] !== t4) {
330
265
  t5 = /*#__PURE__*/jsx("span", {
331
266
  className: t1,
332
- "data-component": "Card.Icon",
333
267
  role: t2,
334
268
  "aria-label": ariaLabel,
335
269
  "aria-hidden": t3,
@@ -345,9 +279,9 @@ function CardIcon(t0) {
345
279
  t5 = $[9];
346
280
  }
347
281
  return t5;
348
- }
282
+ };
349
283
  CardIcon.displayName = 'Card.Icon';
350
- function CardImage(t0) {
284
+ const CardImage = t0 => {
351
285
  const $ = c(12);
352
286
  let className;
353
287
  let rest;
@@ -383,11 +317,10 @@ function CardImage(t0) {
383
317
  let t3;
384
318
  if ($[7] !== alt || $[8] !== rest || $[9] !== src || $[10] !== t2) {
385
319
  t3 = /*#__PURE__*/jsx("img", {
386
- ...rest,
387
320
  src: src,
388
321
  alt: alt,
389
322
  className: t2,
390
- "data-component": "Card.Image"
323
+ ...rest
391
324
  });
392
325
  $[7] = alt;
393
326
  $[8] = rest;
@@ -398,21 +331,12 @@ function CardImage(t0) {
398
331
  t3 = $[11];
399
332
  }
400
333
  return t3;
401
- }
334
+ };
402
335
  CardImage.displayName = 'Card.Image';
403
-
404
- /**
405
- * Heading shown at the top of a Card.
406
- *
407
- * When the parent Card uses `as="section"`, the heading's `id` is
408
- * automatically wired to the section's `aria-labelledby`.
409
- */
410
336
  const CardHeading = /*#__PURE__*/forwardRef(function CardHeading(t0, ref) {
411
- var _id;
412
- const $ = c(15);
337
+ const $ = c(13);
413
338
  let children;
414
339
  let className;
415
- let id;
416
340
  let rest;
417
341
  let t1;
418
342
  if ($[0] !== t0) {
@@ -420,58 +344,47 @@ const CardHeading = /*#__PURE__*/forwardRef(function CardHeading(t0, ref) {
420
344
  as: t1,
421
345
  children,
422
346
  className,
423
- id,
424
347
  ...rest
425
348
  } = t0);
426
349
  $[0] = t0;
427
350
  $[1] = children;
428
351
  $[2] = className;
429
- $[3] = id;
430
- $[4] = rest;
431
- $[5] = t1;
352
+ $[3] = rest;
353
+ $[4] = t1;
432
354
  } else {
433
355
  children = $[1];
434
356
  className = $[2];
435
- id = $[3];
436
- rest = $[4];
437
- t1 = $[5];
357
+ rest = $[3];
358
+ t1 = $[4];
438
359
  }
439
360
  const Component = t1 === undefined ? "h3" : t1;
440
- const {
441
- titleId
442
- } = useContext(CardContext);
443
- const t2 = (_id = id) !== null && _id !== void 0 ? _id : titleId;
444
- let t3;
445
- if ($[6] !== className) {
446
- t3 = clsx(classes.CardHeading, className);
447
- $[6] = className;
448
- $[7] = t3;
361
+ let t2;
362
+ if ($[5] !== className) {
363
+ t2 = clsx(classes.CardHeading, className);
364
+ $[5] = className;
365
+ $[6] = t2;
449
366
  } else {
450
- t3 = $[7];
367
+ t2 = $[6];
451
368
  }
452
- let t4;
453
- if ($[8] !== Component || $[9] !== children || $[10] !== ref || $[11] !== rest || $[12] !== t2 || $[13] !== t3) {
454
- t4 = /*#__PURE__*/jsx(Component, {
455
- ...rest,
369
+ let t3;
370
+ if ($[7] !== Component || $[8] !== children || $[9] !== ref || $[10] !== rest || $[11] !== t2) {
371
+ t3 = /*#__PURE__*/jsx(Component, {
456
372
  ref: ref,
457
- id: t2,
458
- className: t3,
459
- "data-component": "Card.Heading",
373
+ className: t2,
374
+ ...rest,
460
375
  children: children
461
376
  });
462
- $[8] = Component;
463
- $[9] = children;
464
- $[10] = ref;
465
- $[11] = rest;
466
- $[12] = t2;
467
- $[13] = t3;
468
- $[14] = t4;
377
+ $[7] = Component;
378
+ $[8] = children;
379
+ $[9] = ref;
380
+ $[10] = rest;
381
+ $[11] = t2;
382
+ $[12] = t3;
469
383
  } else {
470
- t4 = $[14];
384
+ t3 = $[12];
471
385
  }
472
- return t4;
386
+ return t3;
473
387
  });
474
- CardHeading.displayName = 'Card.Heading';
475
388
  const CardDescription = /*#__PURE__*/forwardRef(function CardDescription(t0, ref) {
476
389
  const $ = c(11);
477
390
  let children;
@@ -503,10 +416,9 @@ const CardDescription = /*#__PURE__*/forwardRef(function CardDescription(t0, ref
503
416
  let t2;
504
417
  if ($[6] !== children || $[7] !== ref || $[8] !== rest || $[9] !== t1) {
505
418
  t2 = /*#__PURE__*/jsx("p", {
506
- ...rest,
507
419
  ref: ref,
508
420
  className: t1,
509
- "data-component": "Card.Description",
421
+ ...rest,
510
422
  children: children
511
423
  });
512
424
  $[6] = children;
@@ -519,24 +431,14 @@ const CardDescription = /*#__PURE__*/forwardRef(function CardDescription(t0, ref
519
431
  }
520
432
  return t2;
521
433
  });
522
- CardDescription.displayName = 'Card.Description';
523
-
524
- /**
525
- * Top-right slot for a single interactive control.
526
- *
527
- * Give the control a label that names the card (e.g. `"More options for
528
- * Project Alpha"`, not just `"More options"`) so users can tell which card
529
- * the action applies to when several cards are visible.
530
- */
531
- function CardAction(t0) {
434
+ const CardMenu = t0 => {
532
435
  const $ = c(2);
533
436
  const {
534
437
  children
535
438
  } = t0;
536
439
  let t1;
537
440
  if ($[0] !== children) {
538
- t1 = /*#__PURE__*/jsx("div", {
539
- "data-component": "Card.Action",
441
+ t1 = /*#__PURE__*/jsx(Fragment, {
540
442
  children: children
541
443
  });
542
444
  $[0] = children;
@@ -545,8 +447,8 @@ function CardAction(t0) {
545
447
  t1 = $[1];
546
448
  }
547
449
  return t1;
548
- }
549
- CardAction.displayName = 'Card.Action';
450
+ };
451
+ CardMenu.displayName = 'Card.Menu';
550
452
  const CardMetadata = /*#__PURE__*/forwardRef(function CardMetadata(t0, ref) {
551
453
  const $ = c(11);
552
454
  let children;
@@ -578,10 +480,9 @@ const CardMetadata = /*#__PURE__*/forwardRef(function CardMetadata(t0, ref) {
578
480
  let t2;
579
481
  if ($[6] !== children || $[7] !== ref || $[8] !== rest || $[9] !== t1) {
580
482
  t2 = /*#__PURE__*/jsx("div", {
581
- ...rest,
582
483
  ref: ref,
583
484
  className: t1,
584
- "data-component": "Card.Metadata",
485
+ ...rest,
585
486
  children: children
586
487
  });
587
488
  $[6] = children;
@@ -594,6 +495,5 @@ const CardMetadata = /*#__PURE__*/forwardRef(function CardMetadata(t0, ref) {
594
495
  }
595
496
  return t2;
596
497
  });
597
- CardMetadata.displayName = 'Card.Metadata';
598
498
 
599
- export { CardAction, CardDescription, CardHeading, CardIcon, CardImage, CardImpl, CardMetadata };
499
+ export { CardDescription, CardHeading, CardIcon, CardImage, CardImpl, CardMenu, CardMetadata };
@@ -1,5 +1,5 @@
1
- import './Card-d8a02dd9.css';
1
+ import './Card-cec366f8.css';
2
2
 
3
- var classes = {"Card":"prc-Card-Card-pYjuL","CardHeader":"prc-Card-CardHeader-P5Qbb","CardHeaderEdgeToEdge":"prc-Card-CardHeaderEdgeToEdge-3yCqT","CardImage":"prc-Card-CardImage-2M8DM","CardIcon":"prc-Card-CardIcon-mIMfj","CardBody":"prc-Card-CardBody-W1o-l","CardContent":"prc-Card-CardContent-omZDS","CardHeading":"prc-Card-CardHeading-3HXyS","CardDescription":"prc-Card-CardDescription-MnJ3F","CardMetadataContainer":"prc-Card-CardMetadataContainer-K-UlH","CardMetadataItem":"prc-Card-CardMetadataItem-ellY9","CardAction":"prc-Card-CardAction-VtI49"};
3
+ var classes = {"Card":"prc-Card-Card-pYjuL","CardHeader":"prc-Card-CardHeader-P5Qbb","CardHeaderEdgeToEdge":"prc-Card-CardHeaderEdgeToEdge-3yCqT","CardImage":"prc-Card-CardImage-2M8DM","CardIcon":"prc-Card-CardIcon-mIMfj","CardBody":"prc-Card-CardBody-W1o-l","CardContent":"prc-Card-CardContent-omZDS","CardHeading":"prc-Card-CardHeading-3HXyS","CardDescription":"prc-Card-CardDescription-MnJ3F","CardMetadataContainer":"prc-Card-CardMetadataContainer-K-UlH","CardMetadataItem":"prc-Card-CardMetadataItem-ellY9","CardMenu":"prc-Card-CardMenu-1b3uS"};
4
4
 
5
5
  export { classes as default };
@@ -1,20 +1,17 @@
1
- import { CardIcon, CardImage, CardAction } from './Card';
2
- import type { CardProps, CardIconProps, CardImageProps, CardHeadingProps, CardDescriptionProps, CardActionProps, CardMetadataProps } from './Card';
3
- declare const Card: (<As extends "div" | "section">(props: (import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "div" : As> & {
1
+ import type { CardProps, CardIconProps, CardImageProps, CardHeadingProps, CardDescriptionProps, CardMenuProps, CardMetadataProps } from './Card';
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,11 +19,14 @@ 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
- Action: typeof CardAction;
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>>;
29
29
  };
30
30
  export { Card };
31
- export type { CardProps, CardIconProps, CardImageProps, CardHeadingProps, CardDescriptionProps, CardActionProps, CardMetadataProps, };
31
+ export type { CardProps, CardIconProps, CardImageProps, CardHeadingProps, CardDescriptionProps, CardMenuProps, CardMetadataProps, };
32
32
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,QAAQ,EAAE,SAAS,EAAgC,UAAU,EAAe,MAAM,QAAQ,CAAA;AAC5G,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,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,eAAe,EACf,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"}
@@ -1,11 +1,11 @@
1
- import { CardImpl, CardMetadata, CardAction, CardDescription, CardHeading, CardImage, CardIcon } from './Card.js';
1
+ import { CardImpl, CardMetadata, CardMenu, CardDescription, CardHeading, CardImage, CardIcon } from './Card.js';
2
2
 
3
3
  const Card = Object.assign(CardImpl, {
4
4
  Icon: CardIcon,
5
5
  Image: CardImage,
6
6
  Heading: CardHeading,
7
7
  Description: CardDescription,
8
- Action: CardAction,
8
+ Menu: CardMenu,
9
9
  Metadata: CardMetadata
10
10
  });
11
11
 
@@ -1 +1 @@
1
- {"version":3,"file":"usePaneWidth.d.ts","sourceRoot":"","sources":["../../src/PageLayout/usePaneWidth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAA;AAQrD,KAAK,WAAW,GAAG,GAAG,MAAM,IAAI,CAAA;AAEhC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,WAAW,CAAA;IAChB,OAAO,EAAE,WAAW,CAAA;IACpB,GAAG,EAAE,WAAW,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;AAEpD;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,kBAAkB,CAAA;AAE3D,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,cAAc,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,OAAO,CAAA;IAClB,uFAAuF;IACvF,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IAC/C,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IACjD,iBAAiB,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IACzD;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,oFAAoF;IACpF,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,8HAA8H;IAC9H,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,8DAA8D;IAC9D,YAAY,EAAE,MAAM,CAAA;IACpB,wDAAwD;I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ACP,SAAS,EACT,iBAAiB,EACjB,mBAA2B,EAC3B,WAAW,EACX,YAAY,EAAE,eAAe,GAC9B,EAAE,mBAAmB,GAAG,kBAAkB,CAwR1C"}
@@ -350,13 +350,15 @@ function usePaneWidth(t0) {
350
350
  maxWidthDiffRef.current = getMaxWidthDiffFromViewport();
351
351
  const initialMax = getMaxPaneWidthRef.current();
352
352
  maxPaneWidthRef.current = initialMax;
353
- setMaxPaneWidth(initialMax);
354
353
  (_paneRef$current3 = paneRef.current) === null || _paneRef$current3 === void 0 ? void 0 : _paneRef$current3.style.setProperty("--pane-max-width", `${initialMax}px`);
355
354
  updateAriaValues(handleRef.current, {
356
355
  min: minPaneWidth,
357
356
  max: initialMax,
358
357
  current: currentWidthRef.current
359
358
  });
359
+ startTransition(() => {
360
+ setMaxPaneWidth(initialMax);
361
+ });
360
362
  if (customMaxWidth !== null && !constrainToViewport) {
361
363
  return;
362
364
  }
@@ -10,7 +10,7 @@ export type { BlankslateProps } from '../Blankslate';
10
10
  export { ButtonBase } from '../Button';
11
11
  export type { ButtonBaseProps } from '../Button';
12
12
  export { Card } from '../Card';
13
- export type { CardProps, CardIconProps, CardImageProps, CardHeadingProps, CardDescriptionProps, CardActionProps, CardMetadataProps, } from '../Card';
13
+ export type { CardProps, CardIconProps, CardImageProps, CardHeadingProps, CardDescriptionProps, CardMenuProps, CardMetadataProps, } from '../Card';
14
14
  export { DataTable, Table, createColumnHelper } from '../DataTable';
15
15
  export type { DataTableProps, TableProps, TableHeadProps, TableBodyProps, TableRowProps, TableHeaderProps, TableCellProps, TableContainerProps, TableTitleProps, TableSubtitleProps, TableActionsProps, Column, CellAlignment, ColumnWidth, UniqueRow, ObjectPaths, } from '../DataTable';
16
16
  export * from '../Dialog';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/experimental/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAA;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BAAiB,CAAA;AACjF,YAAY,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAA;AAEtD,OAAO,EAAC,kBAAkB,EAAE,8BAA8B,EAAC,MAAM,uBAAuB,CAAA;AACxF,YAAY,EAAC,uBAAuB,EAAE,4BAA4B,EAAC,MAAM,uBAAuB,CAAA;AAChG,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AACvC,YAAY,EAAC,eAAe,EAAC,MAAM,cAAc,CAAA;AAEjD,cAAc,mBAAmB,CAAA;AACjC,cAAc,QAAQ,CAAA;AAEtB,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAA;AACpC,YAAY,EAAC,aAAa,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAA"}
@@ -1,3 +1,11 @@
1
1
  import { type RefObject } from 'react';
2
- export declare function useFocus(): import("react").Dispatch<import("react").SetStateAction<HTMLElement | RefObject<HTMLElement> | null>>;
2
+ /**
3
+ * Returns a function that focuses the given element on the next render commit.
4
+ *
5
+ * The target is stored in a ref (not state) and the effect is gated by a
6
+ * version counter, so calling `focus()` produces exactly one render — never
7
+ * the two-render cascade you'd get from `setState(target)` followed by
8
+ * `setState(null)` inside the effect.
9
+ */
10
+ export declare function useFocus(): (target: HTMLElement | RefObject<HTMLElement>) => void;
3
11
  //# sourceMappingURL=useFocus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFocus.d.ts","sourceRoot":"","sources":["../../../src/internal/hooks/useFocus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,SAAS,EAAsB,MAAM,OAAO,CAAA;AAEzD,wBAAgB,QAAQ,0GAmBvB"}
1
+ {"version":3,"file":"useFocus.d.ts","sourceRoot":"","sources":["../../../src/internal/hooks/useFocus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,SAAS,EAA2C,MAAM,OAAO,CAAA;AAE9E;;;;;;;GAOG;AACH,wBAAgB,QAAQ,aAgBM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC,UAIjE"}
@@ -0,0 +1,35 @@
1
+ import { type ReactElement } from 'react';
2
+ export type RenderCounter = {
3
+ /** Total number of times the wrapped subtree has rendered (mount + updates). */
4
+ readonly count: number;
5
+ /** Number of mount renders. */
6
+ readonly mountCount: number;
7
+ /** Number of update renders (any cause). */
8
+ readonly updateCount: number;
9
+ /**
10
+ * Number of updates triggered inside the same commit cycle that produced the
11
+ * original render — i.e., a `setState` call from inside a `useLayoutEffect`
12
+ * that forced a synchronous re-render before paint. This is the canonical
13
+ * "nested update" / cascade signal; assert `nestedUpdateCount === 0` to pin
14
+ * that a component never forces a double-commit.
15
+ */
16
+ readonly nestedUpdateCount: number;
17
+ /** Reset the counter. */
18
+ reset(): void;
19
+ };
20
+ /**
21
+ * Returns a `[Wrap, counter]` pair. Wrap the component under test with `Wrap`
22
+ * to count how many times its subtree renders. Useful for asserting that a
23
+ * single user interaction (or a stable prop) does not cause cascading renders.
24
+ *
25
+ * @example
26
+ * const [Wrap, counter] = createRenderCounter()
27
+ * render(<Wrap><MyComponent /></Wrap>)
28
+ * // ... interaction ...
29
+ * expect(counter.updateCount).toBe(1)
30
+ * expect(counter.nestedUpdateCount).toBe(0)
31
+ */
32
+ export declare function createRenderCounter(id?: string): [(props: {
33
+ children: ReactElement | ReactElement[];
34
+ }) => ReactElement, RenderCounter];
35
+ //# sourceMappingURL=profiler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiler.d.ts","sourceRoot":"","sources":["../../../src/utils/testing/profiler.tsx"],"names":[],"mappings":"AAAA,OAAc,EAA0C,KAAK,YAAY,EAAC,MAAM,OAAO,CAAA;AAEvF,MAAM,MAAM,aAAa,GAAG;IAC1B,gFAAgF;IAChF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,+BAA+B;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,4CAA4C;IAC5C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;IAClC,yBAAyB;IACzB,KAAK,IAAI,IAAI,CAAA;CACd,CAAA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,SAAkB,GACnB,CAAC,CAAC,KAAK,EAAE;IAAC,QAAQ,EAAE,YAAY,GAAG,YAAY,EAAE,CAAA;CAAC,KAAK,YAAY,EAAE,aAAa,CAAC,CAsCrF"}
@@ -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.Action>\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.Action>\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
- "name": "Card.Action",
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
- ]
2207
+ "name": "Card.Menu",
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-20260521224734",
4
+ "version": "0.0.0-20260522115117",
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",