UNPKG

@figlinq/react-chart-editor

Version:
2 lines 967 B
import PropTypes from"prop-types";import{useState}from"react";import{Dropdown,TextEditor}from"../index";import Field from"./Field";import{connectToContainer}from"../../lib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const UpdateMenuButtons=(props,context)=>{const _=context.localize;const[currentButtonIndex,setCurrentButtonIndex]=useState(0);return _jsxs(Field,{children:[_jsx(Dropdown,{attr:"buttons",label:_("Button"),options:props.fullValue.map((button,index)=>({label:_("Button")+` ${index+1}`,value:index})),updatePlot:index=>setCurrentButtonIndex(index),clearable:false,fullValue:currentButtonIndex}),_jsx(TextEditor,{attr:`buttons[${currentButtonIndex}].label`,richTextOnly:true})]})};UpdateMenuButtons.propTypes={attr:PropTypes.string,fullValue:PropTypes.array,updatePlot:PropTypes.func};UpdateMenuButtons.contextTypes={localize:PropTypes.func};export default connectToContainer(UpdateMenuButtons); //# sourceMappingURL=UpdateMenuButtons.js.map