UNPKG

devextreme-react

Version:

DevExtreme React UI and Visualization Components

87 lines (85 loc) 2.72 kB
/*! * devextreme-react * Version: 24.2.6 * Build date: Mon Mar 17 2025 * * Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-react */ "use client"; import * as React from "react"; import { memo, forwardRef, useImperativeHandle, useRef, useMemo } from "react"; import dxRangeSlider from "devextreme/ui/range_slider"; import { Component as BaseComponent } from "./core/component"; import NestedOption from "./core/nested-option"; const RangeSlider = memo(forwardRef((props, ref) => { const baseRef = useRef(null); useImperativeHandle(ref, () => ({ instance() { return baseRef.current?.getInstance(); } }), [baseRef.current]); const subscribableOptions = useMemo(() => (["value"]), []); const independentEvents = useMemo(() => (["onContentReady", "onDisposing", "onInitialized", "onValueChanged"]), []); const defaults = useMemo(() => ({ defaultValue: "value", }), []); const expectedChildren = useMemo(() => ({ label: { optionName: "label", isCollectionItem: false }, tooltip: { optionName: "tooltip", isCollectionItem: false } }), []); return (React.createElement((BaseComponent), { WidgetClass: dxRangeSlider, ref: baseRef, subscribableOptions, independentEvents, defaults, expectedChildren, ...props, })); })); const _componentFormat = (props) => { return React.createElement((NestedOption), { ...props, elementDescriptor: { OptionName: "format", }, }); }; const Format = Object.assign(_componentFormat, { componentType: "option", }); const _componentLabel = (props) => { return React.createElement((NestedOption), { ...props, elementDescriptor: { OptionName: "label", ExpectedChildren: { format: { optionName: "format", isCollectionItem: false } }, }, }); }; const Label = Object.assign(_componentLabel, { componentType: "option", }); const _componentTooltip = (props) => { return React.createElement((NestedOption), { ...props, elementDescriptor: { OptionName: "tooltip", ExpectedChildren: { format: { optionName: "format", isCollectionItem: false } }, }, }); }; const Tooltip = Object.assign(_componentTooltip, { componentType: "option", }); export default RangeSlider; export { RangeSlider, Format, Label, Tooltip };