(props: ColorPickerProps)
| 56 | * It simplifies building color pickers with customizable layouts via composition. |
| 57 | */ |
| 58 | export function ColorPicker(props: ColorPickerProps): JSX.Element { |
| 59 | let ctx = useSlottedContext(ColorPickerContext, props.slot); |
| 60 | props = mergeProps(ctx, props); |
| 61 | let state = useColorPickerState(props); |
| 62 | let renderProps = useRenderProps({ |
| 63 | ...props, |
| 64 | values: { |
| 65 | color: state.color |
| 66 | } |
| 67 | }); |
| 68 | |
| 69 | return ( |
| 70 | <Provider |
| 71 | values={[ |
| 72 | [ColorPickerStateContext, state], |
| 73 | [ColorSliderContext, {value: state.color, onChange: state.setColor}], |
| 74 | [ColorAreaContext, {value: state.color, onChange: state.setColor}], |
| 75 | [ColorWheelContext, {value: state.color, onChange: state.setColor}], |
| 76 | [ColorFieldContext, {value: state.color, onChange: state.setColor}], |
| 77 | [ColorSwatchContext, {color: state.color}], |
| 78 | [ColorSwatchPickerContext, {value: state.color, onChange: state.setColor}] |
| 79 | ]}> |
| 80 | {renderProps.children} |
| 81 | </Provider> |
| 82 | ); |
| 83 | } |
nothing calls this directly
no test coverage detected