Promote Blankslate to main exports#7841
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🦋 Changeset detectedLatest commit: e34b2ae The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
There was a problem hiding this comment.
Pull request overview
Promotes Blankslate from the experimental entrypoint to the main @primer/react API and introduces a shared polymorphic action subcomponent.
Changes:
- Adds main and experimental exports for
Blankslateand related prop types. - Introduces
Blankslate.Actionand refactors primary/secondary actions through shared behavior. - Updates tests, Storybook metadata, docs metadata, export snapshots, and adds a minor changeset.
Show a summary per file
| File | Description |
|---|---|
packages/react/src/index.ts |
Adds stable Blankslate exports. |
packages/react/src/experimental/index.ts |
Expands experimental type exports for Blankslate. |
packages/react/src/Blankslate/index.tsx |
Adds Action to the compound component export. |
packages/react/src/Blankslate/Blankslate.tsx |
Implements polymorphic action behavior and refactors existing actions. |
packages/react/src/Blankslate/Blankslate.test.tsx |
Adds runtime coverage for the new action behavior. |
packages/react/src/Blankslate/Blankslate.types.test.tsx |
Adds TypeScript usage coverage for action variants and element types. |
packages/react/src/Blankslate/Blankslate.stories.tsx |
Moves stories to stable Storybook path and uses Blankslate.Action. |
packages/react/src/Blankslate/Blankslate.features.stories.tsx |
Updates feature stories for stable path and new action API. |
packages/react/src/Blankslate/Blankslate.docs.json |
Updates docs metadata, import path, story IDs, and action props. |
packages/react/src/__tests__/__snapshots__/exports.test.ts.snap |
Updates export snapshots for new stable exports. |
.changeset/blankslate-ga-ready.md |
Adds a minor changeset for the public API promotion. |
Copilot's findings
Comments suppressed due to low confidence (3)
packages/react/src/Blankslate/Blankslate.tsx:171
- Rendering the secondary action as a
<button>throughLinkleaves the HTML button without atype, so it defaults tosubmitinside forms. Since this PR adds button rendering for secondary actions, this branch should settype="button"by default unless the caller explicitly supplies a type.
<Link {...props} as="button" className={className} ref={buttonRef}>
packages/react/src/Blankslate/Blankslate.tsx:184
- This exported prop type now only contains the internal element discriminator (
as/href) and drops the props the component actually accepts, such aschildren,onClick,className, and button attributes. That is a type regression from the previousBlankslate.PrimaryActionPropsand makes the newly exported prop type unusable for typed wrappers.
type BlankslatePrimaryActionProps = BlankslateActionElementProps
packages/react/src/Blankslate/Blankslate.tsx:194
- The exported secondary action prop type does not include the props supported by the component, including
children,onClick,className, and other button/link attributes. Because this PR documents and exports these subcomponent prop types, consumers usingBlankslateSecondaryActionPropswill not be able to type valid secondary action props, especially the new button variant.
type BlankslateSecondaryActionProps = BlankslateActionElementProps
- Files reviewed: 11/11 changed files
- Comments generated: 2
| <ButtonBase | ||
| {...props} | ||
| as="button" | ||
| className={className} | ||
| ref={buttonRef} | ||
| size={size === 'small' ? 'small' : undefined} | ||
| variant="primary" |
| type BlankslateActionProps = React.PropsWithChildren< | ||
| BlankslateActionElementProps & { | ||
| className?: string | ||
|
|
||
| type BlankslateSecondaryActionProps = React.PropsWithChildren<{ | ||
| href: string | ||
| }> | ||
| /** | ||
| * Specify the visual treatment of the action | ||
| */ | ||
| variant?: BlankslateActionVariant | ||
| } | ||
| > |
Closes #
Promotes
Blankslatefrom the experimental entrypoint to the main@primer/reactentrypoint and adds a new polymorphicBlankslate.Actionsubcomponent for primary and secondary actions that can render as buttons or links.Changelog
New
Blankslateis exported from@primer/reactBlankslate.Actionsupportsvariant="primary" | "secondary"and button/link renderingBlankslateActionPropsand related subcomponent prop types are exportedChanged
Blankslate.PrimaryActionandBlankslate.SecondaryActionnow use the shared polymorphic action behaviorRemoved
Rollout strategy
Testing & Reviewing
npm run build -w @primer/reactnpm run type-check -w @primer/reactnpx vitest run packages/react/src/Blankslate/Blankslate.test.tsx packages/react/src/__tests__/exports.test.tsMerge checklist