forked from mui/base-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.
Standalone useSliderOutput Reorganize again
- Loading branch information
1 parent
61b9e2e
commit cbd1ac6
Showing
25 changed files
with
357 additions
and
275 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use client'; | ||
import * as React from 'react'; | ||
import { CompoundComponentContext, CompoundComponentContextValue } from '../../useCompound'; | ||
import { SliderThumbMetadata } from '../SliderThumb/SliderThumb.types'; | ||
import { SliderContext, type SliderContextValue } from './SliderContext'; | ||
|
||
export type SliderProviderValue = SliderContextValue & { | ||
compoundComponentContextValue: CompoundComponentContextValue<any, SliderThumbMetadata>; | ||
}; | ||
|
||
export interface SliderProviderProps { | ||
value: SliderProviderValue; | ||
children: React.ReactNode; | ||
} | ||
|
||
/** | ||
* Sets up contexts for the Slider and its subcomponents. | ||
* | ||
* @ignore - do not document. | ||
*/ | ||
function SliderProvider(props: SliderProviderProps) { | ||
const { value: valueProp, children } = props; | ||
|
||
const { compoundComponentContextValue, ...contextValue } = valueProp; | ||
|
||
return ( | ||
<CompoundComponentContext.Provider value={compoundComponentContextValue}> | ||
<SliderContext.Provider value={contextValue}>{children}</SliderContext.Provider> | ||
</CompoundComponentContext.Provider> | ||
); | ||
} | ||
|
||
export { SliderProvider }; |
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.