mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
30 lines
877 B
JavaScript
30 lines
877 B
JavaScript
"use client";
|
|
import { renderElement } from "../../utils/use-render.js";
|
|
import { useSliderContext } from "./context.js";
|
|
import { forwardRef } from "react";
|
|
//#region src/ui/slider/slider-thumb.tsx
|
|
/** Draggable handle for setting the slider value. Receives focus and handles keyboard interaction. */
|
|
const SliderThumb = forwardRef(function SliderThumb(componentProps, forwardedRef) {
|
|
const { render, className, style, ...elementProps } = componentProps;
|
|
const context = useSliderContext();
|
|
const { state, thumbRef, thumbProps, getAttrs } = context;
|
|
const attrs = getAttrs(state);
|
|
return renderElement("div", {
|
|
render,
|
|
className,
|
|
style
|
|
}, {
|
|
state,
|
|
stateAttrMap: context.stateAttrMap,
|
|
ref: [forwardedRef, thumbRef],
|
|
props: [
|
|
attrs,
|
|
thumbProps,
|
|
elementProps
|
|
]
|
|
});
|
|
});
|
|
//#endregion
|
|
export { SliderThumb };
|
|
|
|
//# sourceMappingURL=slider-thumb.js.map
|