-
Notifications
You must be signed in to change notification settings - Fork 638
feat: support custom slots #6976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: f50d6b3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR extends the useSlots functionality to support comparing components by their __SLOT__
property in addition to their component type. This enables consumers to create wrapper components around subcomponents while maintaining compatibility with @primer/react components that use slots.
Key Changes:
- Updated useSlots to support slot name identification via
__SLOT__
property - Added
__SLOT__
properties to components in both packages to enable slot-based matching - Modified components using useSlots to support the new slot configuration format
Reviewed Changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
packages/react/src/utils/get-slot-name.ts | New utility function to extract slot names from React elements |
packages/react/src/hooks/useSlots.ts | Core logic update to support slot-based matching and new configuration format |
packages/react/src/hooks/tests/useSlots.test.tsx | Comprehensive tests for new slot functionality |
packages/react/src/FormControl/FormControl.tsx | Updated to use new slot configuration and support slot-based component identification |
packages/react/src/FormControl/tests/FormControl.test.tsx | Tests for slot identification with wrapped components |
packages/react/src/FormControl/FormControlLabel.tsx | Added __SLOT__ property for slot identification |
packages/styled-react/src/components/*.tsx | Added __SLOT__ properties to multiple components for compatibility |
Multiple component files | Updated useSlots configurations and component type checks to support slot names |
👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks! |
…r/react into chore/implement-slot-names
// @ts-ignore - TS doesn't know about the __SLOT__ property | ||
ActionListItem.__SLOT__ = Symbol('ActionList.Item') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
open to suggestions about this @ts-ignore here
CC: @adierkens
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't want to push to your branch, but this should fix the TS types: 60799a3
👋 Hi, there are new commits since the last successful integration test. We recommend running the integration workflow once more, unless you are sure the new changes do not affect github/github. Thanks! |
👋 Hi, there are new commits since the last successful integration test. We recommend running the integration workflow once more, unless you are sure the new changes do not affect github/github. Thanks! |
👋 Hi, there are new commits since the last successful integration test. We recommend running the integration workflow once more, unless you are sure the new changes do not affect github/github. Thanks! |
1 similar comment
👋 Hi, there are new commits since the last successful integration test. We recommend running the integration workflow once more, unless you are sure the new changes do not affect github/github. Thanks! |
🟢 ci completed with status |
Extends useSlot functionality to support comparing by
__SLOT__
prop, not just component type. This allows consumers to create wrapper for subcomponents while still maintaining support with @primer/react components that use slotsChangelog
New
Changed
Rollout strategy
Testing & Reviewing
Merge checklist