-
Notifications
You must be signed in to change notification settings - Fork 119
feat(popover): add form pill button #4018
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6a70258
feat(popover): add form pill button
nkrantz bbe6064
chore: kristians fix
nkrantz f977cd5
feat(popover): form pill final impl
krisantrobus ae31237
feat(popover): added variant to FormPillGroup and created PopoverForm…
krisantrobus 015c725
feat(docs): update popover and FormPill docs for new variants
krisantrobus d210cc2
Merge branch 'main' of github.com:twilio-labs/paste into popover/form…
krisantrobus 04220a9
Apply suggestions from code review
krisantrobus 0aa0612
chore(docs): pr structure suggestion
krisantrobus 18cdf7e
chore(docs): addressing pr comments
krisantrobus 55ded59
chore(docs): addressing pr comments
krisantrobus 8ddb8b4
chore(docs): typedocs
krisantrobus 86cc0b1
chore(docs): mention coming soon links
krisantrobus e3ff42a
Merge branch 'main' into popover/form-pill-button
kodiakhq[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@twilio-paste/form-pill-group": minor | ||
"@twilio-paste/core": minor | ||
--- | ||
|
||
[FormPillGroup] added a new variant 'tree' to support different interactions for FormPill where selecting the item triggers other flows instead of updating state directly. Reference Filters Pattern for in depth use case. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@twilio-paste/codemods": minor | ||
"@twilio-paste/popover": minor | ||
"@twilio-paste/core": minor | ||
--- | ||
|
||
[Popover] Added a new button variant to trigger the popover PopoverFormPillButton, only to be used as part of complex filters pattern |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
packages/paste-core/components/popover/src/PopoverFormPillButton.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { FormPill } from "@twilio-paste/form-pill-group"; | ||
import { NonModalDialogDisclosurePrimitive } from "@twilio-paste/non-modal-dialog-primitive"; | ||
import * as React from "react"; | ||
|
||
import { PopoverContext } from "./PopoverContext"; | ||
import type { PopoverFormPillButtonProps } from "./types"; | ||
|
||
const PopoverFormPillButton = React.forwardRef<HTMLElement, PopoverFormPillButtonProps>( | ||
({ children, element = "POPOVER_FORM_PILL", ...popoverButtonProps }, ref) => { | ||
const popover = React.useContext(PopoverContext); | ||
|
||
return ( | ||
<NonModalDialogDisclosurePrimitive | ||
element={element} | ||
{...(popover as any)} | ||
{...popoverButtonProps} | ||
as={FormPill} | ||
ref={ref} | ||
onSelect={(e: React.MouseEvent<HTMLButtonElement>) => { | ||
// @ts-expect-error Property 'toggle' does not exist on type 'Partial<PopoverState>', but it is there as it comes form DialogActions prop. | ||
popover.toggle(); | ||
// Call the actual onsSelect function passed to the component | ||
if (popoverButtonProps.onSelect) { | ||
popoverButtonProps.onSelect(e); | ||
} | ||
}} | ||
baseId={popover.baseId} | ||
> | ||
{children} | ||
</NonModalDialogDisclosurePrimitive> | ||
); | ||
}, | ||
); | ||
|
||
PopoverFormPillButton.displayName = "PopoverFormPillButton"; | ||
export { PopoverFormPillButton }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.