-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(components): replace
Section
with ListBoxSection
and `MenuSec…
…tion` (#1498) * fix(components): replace `Section` with `ListBoxSection` and `MenuSection` * fix: ts
- Loading branch information
Showing
26 changed files
with
120 additions
and
67 deletions.
There are no files selected for viewing
This file contains 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,5 @@ | ||
--- | ||
"@launchpad-ui/components": patch | ||
--- | ||
|
||
Replace `Section` with `ListBoxSection` and `MenuSection` |
This file contains 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 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 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 |
---|---|---|
@@ -1,23 +1,41 @@ | ||
import type { forwardRefType } from '@react-types/shared'; | ||
import type { ForwardedRef } from 'react'; | ||
import type { SectionProps } from 'react-aria-components'; | ||
import type { ListBoxSectionProps, MenuSectionProps } from 'react-aria-components'; | ||
|
||
import { cva } from 'class-variance-authority'; | ||
import { forwardRef } from 'react'; | ||
import { Section as AriaSection } from 'react-aria-components'; | ||
import { | ||
ListBoxSection as AriaListBoxSection, | ||
MenuSection as AriaMenuSection, | ||
} from 'react-aria-components'; | ||
|
||
import styles from './styles/Section.module.css'; | ||
|
||
const section = cva(styles.section); | ||
|
||
const _Section = <T extends object>( | ||
{ className, ...props }: SectionProps<T>, | ||
const _ListBoxSection = <T extends object>( | ||
{ className, ...props }: ListBoxSectionProps<T>, | ||
ref: ForwardedRef<HTMLElement>, | ||
) => { | ||
return <AriaSection {...props} ref={ref} className={section({ className })} />; | ||
return <AriaListBoxSection {...props} ref={ref} className={section({ className })} />; | ||
}; | ||
|
||
const Section = (forwardRef as forwardRefType)(_Section); | ||
/** | ||
* A ListBoxSection represents a section within a ListBox. | ||
*/ | ||
const ListBoxSection = (forwardRef as forwardRefType)(_ListBoxSection); | ||
|
||
export { Section }; | ||
export type { SectionProps }; | ||
const _MenuSection = <T extends object>( | ||
{ className, ...props }: MenuSectionProps<T>, | ||
ref: ForwardedRef<HTMLElement>, | ||
) => { | ||
return <AriaMenuSection {...props} ref={ref} className={section({ className })} />; | ||
}; | ||
|
||
/** | ||
* A MenuSection represents a section within a Menu. | ||
*/ | ||
const MenuSection = (forwardRef as forwardRefType)(_MenuSection); | ||
|
||
export { ListBoxSection, MenuSection }; | ||
export type { ListBoxSectionProps, MenuSectionProps }; |
This file contains 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 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 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 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 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 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 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 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 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 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 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 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 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 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.