Skip to content

Commit

Permalink
remove onCancel
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthkp committed Nov 7, 2024
1 parent 1b7b968 commit 679f5d0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
5 changes: 0 additions & 5 deletions packages/react/src/SelectPanel/SelectPanel.docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@
"defaultValue": "anchored",
"description": "Anchored to the button or centered on the screen. Modal variant also adds Save and Cancel buttons."
},
{
"name": "onCancel",
"type": "() => void",
"description": "Function that will be called when cancel button or close button is pressed. Required with variant='modal'"
},
{
"name": "footer",
"type": "string | React.ReactElement",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,7 @@ export const WithGroups = () => {
}

export const ModalVariant = () => {
const initialItems = [items[0], items[1]]
const [selected, setSelected] = React.useState<ItemInput[]>(initialItems)
const [selected, setSelected] = React.useState<ItemInput[]>([items[0], items[1]])
const [filter, setFilter] = React.useState('')
const filteredItems = items.filter(item => item.text.toLowerCase().startsWith(filter.toLowerCase()))
const [open, setOpen] = useState(false)
Expand All @@ -383,7 +382,6 @@ export const ModalVariant = () => {
<h1>Multi Select Panel as Modal</h1>
<SelectPanel
variant="modal"
onCancel={() => setSelected(initialItems)}
renderAnchor={({children, 'aria-labelledby': ariaLabelledBy, ...anchorProps}) => (
<Button aria-labelledby={` ${ariaLabelledBy}`} {...anchorProps}>
{children ?? 'Select Labels'}
Expand All @@ -403,8 +401,7 @@ export const ModalVariant = () => {
}

export const ModalVariantWithSecondaryAction = () => {
const initialItems = [items[0], items[1]]
const [selected, setSelected] = React.useState<ItemInput[]>(initialItems)
const [selected, setSelected] = React.useState<ItemInput[]>([items[0], items[1]])
const [filter, setFilter] = React.useState('')
const filteredItems = items.filter(item => item.text.toLowerCase().startsWith(filter.toLowerCase()))
const [open, setOpen] = useState(false)
Expand All @@ -415,7 +412,6 @@ export const ModalVariantWithSecondaryAction = () => {
<h1>Multi Select Panel as Modal with secondary action</h1>
<SelectPanel
variant="modal"
onCancel={() => setSelected(initialItems)}
// backward compatible API choice
// TODO: improve this API, rename it to a single secondaryAction or secondaryFooterSlotSomething
footer={<Button size="small">Edit labels</Button>}
Expand Down

0 comments on commit 679f5d0

Please sign in to comment.