Skip to content

Commit

Permalink
SelectPanel2: Export props + pass props (#4198)
Browse files Browse the repository at this point in the history
* export everything from SelectPanel

* pass root props to dialog

* Create few-rockets-begin.md

* Update exports.test.ts.snap

* export all types

* always forget to update snapshots
  • Loading branch information
siddharthkp authored Feb 2, 2024
1 parent 2217cef commit 65bde27
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/few-rockets-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

experimental/SelectPanel: Pass props from SelectPanel root to dialog element
6 changes: 6 additions & 0 deletions src/__tests__/__snapshots__/exports.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ exports[`@primer/react/drafts should not update exports without a semver change
"type Reference",
"type SavedReply",
"SelectPanel",
"type SelectPanelMessageProps",
"type SelectPanelProps",
"type SelectPanelSecondaryActionProps",
"type ShowSuggestionsEvent",
"type SlotConfig",
"type Suggestion",
Expand Down Expand Up @@ -364,6 +367,9 @@ exports[`@primer/react/experimental should not update exports without a semver c
"type Reference",
"type SavedReply",
"SelectPanel",
"type SelectPanelMessageProps",
"type SelectPanelProps",
"type SelectPanelSecondaryActionProps",
"type ShowSuggestionsEvent",
"type SlotConfig",
"type Suggestion",
Expand Down
5 changes: 3 additions & 2 deletions src/drafts/SelectPanel2/SelectPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ const Panel: React.FC<SelectPanelProps> = ({
'100%': {transform: 'scale(1, 1)'},
},
}}
{...props}
onClick={event => {
if (event.target === event.currentTarget) onClickOutside()
}}
Expand Down Expand Up @@ -488,7 +489,7 @@ const SecondaryCheckbox: React.FC<CheckboxProps> = ({id, children, ...props}) =>
)
}

type SelectPanelSecondaryActionProps = {children: React.ReactNode} & (
export type SelectPanelSecondaryActionProps = {children: React.ReactNode} & (
| ({variant: 'button'} & Partial<Omit<ButtonProps, 'variant'>>)
| ({variant: 'link'} & Partial<LinkProps>)
| ({variant: 'checkbox'; id?: string} & CheckboxProps)
Expand Down Expand Up @@ -525,7 +526,7 @@ const SelectPanelLoading: React.FC<{children: string}> = ({children = 'Fetching
)
}

type SelectPanelMessageProps = {children: React.ReactNode} & (
export type SelectPanelMessageProps = {children: React.ReactNode} & (
| {
size?: 'full'
title: string // title is required with size:full
Expand Down
2 changes: 1 addition & 1 deletion src/drafts/SelectPanel2/index.tsx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {SelectPanel} from './SelectPanel'
export * from './SelectPanel'

0 comments on commit 65bde27

Please sign in to comment.