| 55 | * Returns collection of standard option editors definitions |
| 56 | */ |
| 57 | export const getAllOptionEditors = () => { |
| 58 | const number: StandardEditorsRegistryItem<number> = { |
| 59 | id: 'number', |
| 60 | name: 'Number', |
| 61 | description: 'Allows numeric values input', |
| 62 | editor: NumberValueEditor, |
| 63 | }; |
| 64 | |
| 65 | const slider: StandardEditorsRegistryItem<number> = { |
| 66 | id: 'slider', |
| 67 | name: 'Slider', |
| 68 | description: 'Allows numeric values input', |
| 69 | editor: SliderValueEditor, |
| 70 | }; |
| 71 | |
| 72 | const text: StandardEditorsRegistryItem<string> = { |
| 73 | id: 'text', |
| 74 | name: 'Text', |
| 75 | description: 'Allows string values input', |
| 76 | editor: StringValueEditor, |
| 77 | }; |
| 78 | |
| 79 | const strings: StandardEditorsRegistryItem<string[]> = { |
| 80 | id: 'strings', |
| 81 | name: 'String array', |
| 82 | description: 'An array of strings', |
| 83 | editor: StringArrayEditor, |
| 84 | }; |
| 85 | |
| 86 | const boolean: StandardEditorsRegistryItem<boolean> = { |
| 87 | id: 'boolean', |
| 88 | name: 'Boolean', |
| 89 | description: 'Allows boolean values input', |
| 90 | editor(props) { |
| 91 | return <Switch {...props} onChange={(e) => props.onChange(e.currentTarget.checked)} />; |
| 92 | }, |
| 93 | }; |
| 94 | |
| 95 | const select: StandardEditorsRegistryItem = { |
| 96 | id: 'select', |
| 97 | name: 'Select', |
| 98 | description: 'Allows option selection', |
| 99 | editor: SelectValueEditor, |
| 100 | }; |
| 101 | |
| 102 | const multiSelect: StandardEditorsRegistryItem = { |
| 103 | id: 'multi-select', |
| 104 | name: 'Multi select', |
| 105 | description: 'Allows for multiple option selection', |
| 106 | editor: MultiSelectValueEditor, |
| 107 | }; |
| 108 | |
| 109 | const radio: StandardEditorsRegistryItem = { |
| 110 | id: 'radio', |
| 111 | name: 'Radio', |
| 112 | description: 'Allows option selection', |
| 113 | editor(props) { |
| 114 | return <RadioButtonGroup {...props} options={props.item.settings?.options} />; |