forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OptionUnstyled] Define ownerState and slot props' types (mui#32717)
- Loading branch information
1 parent
f625885
commit 4a5bde2
Showing
10 changed files
with
86 additions
and
12 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
packages/mui-base/src/OptionGroupUnstyled/OptionGroupUnstyled.spec.tsx
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,29 @@ | ||
import * as React from 'react'; | ||
import OptionGroupUnstyled, { | ||
OptionGroupUnstyledLabelSlotProps, | ||
OptionGroupUnstyledListSlotProps, | ||
OptionGroupUnstyledRootSlotProps, | ||
} from '@mui/base/OptionGroupUnstyled'; | ||
|
||
const Root = React.forwardRef(function Root( | ||
props: OptionGroupUnstyledRootSlotProps, | ||
ref: React.ForwardedRef<HTMLLIElement>, | ||
) { | ||
return <li {...props} ref={ref} />; | ||
}); | ||
|
||
const Label = React.forwardRef(function Label( | ||
props: OptionGroupUnstyledLabelSlotProps, | ||
ref: React.ForwardedRef<HTMLLIElement>, | ||
) { | ||
return <li {...props} ref={ref} />; | ||
}); | ||
|
||
const List = React.forwardRef(function List( | ||
props: OptionGroupUnstyledListSlotProps, | ||
ref: React.ForwardedRef<HTMLLIElement>, | ||
) { | ||
return <li {...props} ref={ref} />; | ||
}); | ||
|
||
const option = <OptionGroupUnstyled components={{ Root, Label, List }} />; |
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,7 +1,6 @@ | ||
export { default } from './OptionGroupUnstyled'; | ||
|
||
export type { default as OptionGroupUnstyledProps } from './OptionGroupUnstyledProps'; | ||
export * from './OptionGroupUnstyledProps'; | ||
export * from './OptionGroupUnstyled.types'; | ||
|
||
export { default as optionGroupUnstyledClasses } from './optionGroupUnstyledClasses'; | ||
export * from './optionGroupUnstyledClasses'; |
13 changes: 13 additions & 0 deletions
13
packages/mui-base/src/OptionUnstyled/OptionUnstyled.spec.tsx
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,13 @@ | ||
import * as React from 'react'; | ||
import OptionUnstyled, { OptionUnstyledRootSlotProps } from '@mui/base/OptionUnstyled'; | ||
|
||
const Root = React.forwardRef(function Root<TValue>( | ||
props: OptionUnstyledRootSlotProps<TValue>, | ||
ref: React.ForwardedRef<HTMLLIElement>, | ||
) { | ||
const { ownerState, ...other } = props; | ||
|
||
return <li data-selected={ownerState.selected} {...other} ref={ref} />; | ||
}); | ||
|
||
const option = <OptionUnstyled value={null} components={{ Root }} />; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
export { default } from './OptionUnstyled'; | ||
|
||
export type { default as OptionUnstyledProps } from './OptionUnstyledProps'; | ||
export * from './OptionUnstyledProps'; | ||
export * from './OptionUnstyled.types'; | ||
|
||
export { default as optionUnstyledClasses } from './optionUnstyledClasses'; | ||
export * from './optionUnstyledClasses'; |
4 changes: 2 additions & 2 deletions
4
packages/mui-base/src/SelectUnstyled/SelectUnstyledContext.ts
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